]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | HII Library implementation that uses DXE protocols and services.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation<BR>\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | Module Name: HiiLib.c\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | \r | |
18 | #include <FrameworkDxe.h>\r | |
19 | \r | |
20 | \r | |
21 | #include <Library/FrameworkHiiLib.h>\r | |
22 | #include <Library/DebugLib.h>\r | |
23 | #include <Library/MemoryAllocationLib.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 | |
37 | EFI_HII_PACKAGES *\r | |
38 | EFIAPI\r | |
39 | PreparePackages (\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 |