]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/HiiLib/HiiLib.c
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / HiiLib / HiiLib.c
CommitLineData
3eb9473e 1/*++\r
2\r
3Copyright (c) 2004 - 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12\r
13Module Name:\r
14\r
15 HiiLib.c\r
16 \r
17Abstract: \r
18\r
19 HII Library implementation that uses DXE protocols and services.\r
20\r
21--*/\r
22\r
23#include "EdkIIGlueDxe.h"\r
24\r
25/**\r
26 This function allocates pool for an EFI_HII_PACKAGES structure\r
27 with enough space for the variable argument list of package pointers.\r
28 The allocated structure is initialized using NumberOfPackages, Guid, \r
29 and the variable length argument list of package pointers.\r
30\r
31 @param NumberOfPackages The number of HII packages to prepare.\r
32 @param Guid Package GUID.\r
33\r
34 @return The allocated and initialized packages.\r
35\r
36**/\r
37EFI_HII_PACKAGES *\r
38EFIAPI\r
39GluePreparePackages (\r
40 IN UINTN NumberOfPackages,\r
41 IN CONST EFI_GUID *Guid OPTIONAL,\r
42 ...\r
43 )\r
44{\r
45 VA_LIST Args;\r
46 EFI_HII_PACKAGES *HiiPackages;\r
47 VOID **Package;\r
48 UINTN Index;\r
49\r
50 ASSERT (NumberOfPackages > 0);\r
51\r
52 HiiPackages = AllocateZeroPool (sizeof (EFI_HII_PACKAGES) + NumberOfPackages * sizeof (VOID *));\r
53 ASSERT (HiiPackages != NULL);\r
54\r
55 HiiPackages->GuidId = (EFI_GUID *) Guid;\r
56 HiiPackages->NumberOfPackages = NumberOfPackages;\r
57 Package = (VOID **) (((UINT8 *) HiiPackages) + sizeof (EFI_HII_PACKAGES));\r
58\r
59 VA_START (Args, Guid);\r
60\r
61 for (Index = 0; Index < NumberOfPackages; Index++) {\r
62 *Package = VA_ARG (Args, VOID *);\r
63 Package++;\r
64 }\r
65\r
66 VA_END (Args);\r
67\r
68 return HiiPackages;\r
69\r
70}\r