]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/HiiLib/HiiLib.c
1) Sync EdkCompatibilityPkg with EDK 1.04. The changes includes:
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / HiiLib / HiiLib.c
CommitLineData
3eb9473e 1/*++\r
2\r
c7f33ca4 3Copyright (c) 2004 - 2007, Intel Corporation \r
3eb9473e 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
c7f33ca4 25#if (EFI_SPECIFICATION_VERSION < 0x0002000A)\r
3eb9473e 26/**\r
27 This function allocates pool for an EFI_HII_PACKAGES structure\r
28 with enough space for the variable argument list of package pointers.\r
29 The allocated structure is initialized using NumberOfPackages, Guid, \r
30 and the variable length argument list of package pointers.\r
31\r
32 @param NumberOfPackages The number of HII packages to prepare.\r
33 @param Guid Package GUID.\r
34\r
35 @return The allocated and initialized packages.\r
36\r
37**/\r
38EFI_HII_PACKAGES *\r
39EFIAPI\r
40GluePreparePackages (\r
41 IN UINTN NumberOfPackages,\r
42 IN CONST EFI_GUID *Guid OPTIONAL,\r
43 ...\r
44 )\r
45{\r
46 VA_LIST Args;\r
47 EFI_HII_PACKAGES *HiiPackages;\r
48 VOID **Package;\r
49 UINTN Index;\r
50\r
51 ASSERT (NumberOfPackages > 0);\r
52\r
53 HiiPackages = AllocateZeroPool (sizeof (EFI_HII_PACKAGES) + NumberOfPackages * sizeof (VOID *));\r
54 ASSERT (HiiPackages != NULL);\r
55\r
56 HiiPackages->GuidId = (EFI_GUID *) Guid;\r
57 HiiPackages->NumberOfPackages = NumberOfPackages;\r
58 Package = (VOID **) (((UINT8 *) HiiPackages) + sizeof (EFI_HII_PACKAGES));\r
59\r
60 VA_START (Args, Guid);\r
61\r
62 for (Index = 0; Index < NumberOfPackages; Index++) {\r
63 *Package = VA_ARG (Args, VOID *);\r
64 Package++;\r
65 }\r
66\r
67 VA_END (Args);\r
68\r
69 return HiiPackages;\r
70\r
71}\r
c7f33ca4 72#endif\r