]>
Commit | Line | Data |
---|---|---|
0a869bf8 | 1 | /** @file\r |
2 | HII Library implementation that uses DXE protocols and services.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation<BR>\r | |
53f93f7e | 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 | |
0a869bf8 | 9 | \r |
53f93f7e | 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 | |
0a869bf8 | 12 | \r |
13 | Module Name: HiiLib.c\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | //\r | |
53f93f7e | 18 | // The package level header files this module uses\r |
0a869bf8 | 19 | //\r |
564995cd | 20 | #include <FrameworkDxe.h>\r |
53f93f7e | 21 | //\r |
22 | // The protocols, PPI and GUID defintions for this module\r | |
23 | //\r | |
24 | //\r | |
25 | // The Library classes this module consumes\r | |
26 | //\r | |
27 | #include <Library/FrameworkHiiLib.h>\r | |
28 | #include <Library/DebugLib.h>\r | |
29 | #include <Library/MemoryAllocationLib.h>\r | |
0a869bf8 | 30 | \r |
31 | /**\r | |
32 | This function allocates pool for an EFI_HII_PACKAGES structure\r | |
33 | with enough space for the variable argument list of package pointers.\r | |
53f93f7e | 34 | The allocated structure is initialized using NumberOfPackages, Guid,\r |
0a869bf8 | 35 | and the variable length argument list of package pointers.\r |
36 | \r | |
37 | @param NumberOfPackages The number of HII packages to prepare.\r | |
38 | @param Guid Package GUID.\r | |
39 | \r | |
40 | @return The allocated and initialized packages.\r | |
41 | \r | |
42 | **/\r | |
43 | EFI_HII_PACKAGES *\r | |
44 | EFIAPI\r | |
45 | PreparePackages (\r | |
46 | IN UINTN NumberOfPackages,\r | |
47 | IN CONST EFI_GUID *Guid OPTIONAL,\r | |
48 | ...\r | |
49 | )\r | |
50 | {\r | |
51 | VA_LIST Args;\r | |
52 | EFI_HII_PACKAGES *HiiPackages;\r | |
53 | VOID **Package;\r | |
54 | UINTN Index;\r | |
55 | \r | |
56 | ASSERT (NumberOfPackages > 0);\r | |
57 | \r | |
58 | HiiPackages = AllocateZeroPool (sizeof (EFI_HII_PACKAGES) + NumberOfPackages * sizeof (VOID *));\r | |
59 | ASSERT (HiiPackages != NULL);\r | |
60 | \r | |
61 | HiiPackages->GuidId = (EFI_GUID *) Guid;\r | |
62 | HiiPackages->NumberOfPackages = NumberOfPackages;\r | |
63 | Package = (VOID **) (((UINT8 *) HiiPackages) + sizeof (EFI_HII_PACKAGES));\r | |
64 | \r | |
65 | VA_START (Args, Guid);\r | |
66 | \r | |
67 | for (Index = 0; Index < NumberOfPackages; Index++) {\r | |
68 | *Package = VA_ARG (Args, VOID *);\r | |
69 | Package++;\r | |
70 | }\r | |
71 | \r | |
72 | VA_END (Args);\r | |
73 | \r | |
74 | return HiiPackages;\r | |
75 | \r | |
76 | }\r |