]>
Commit | Line | Data |
---|---|---|
1 | /*++\r | |
2 | \r | |
3 | Copyright (c) 2007, Intel Corporation\r | |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | VariableWorker.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Framework PEIM to provide the Variable functionality\r | |
19 | \r | |
20 | --*/\r | |
21 | //\r | |
22 | // The package level header files this module uses\r | |
23 | //\r | |
24 | #include <PiPei.h>\r | |
25 | \r | |
26 | //\r | |
27 | // The protocols, PPI and GUID defintions for this module\r | |
28 | //\r | |
29 | #include <Ppi/ReadOnlyVariable.h>\r | |
30 | //\r | |
31 | // The Library classes this module consumes\r | |
32 | //\r | |
33 | #include <Library/DebugLib.h>\r | |
34 | #include <Library/PeimEntryPoint.h>\r | |
35 | #include <Library/HobLib.h>\r | |
36 | #include <Library/PcdLib.h>\r | |
37 | #include <Library/BaseMemoryLib.h>\r | |
38 | \r | |
39 | \r | |
40 | #include <Variable.h>\r | |
41 | \r | |
42 | /**\r | |
43 | Get one variable by the index count.\r | |
44 | \r | |
45 | @param IndexTable The pointer to variable index table.\r | |
46 | @param Count The index count of variable in index table.\r | |
47 | \r | |
48 | @return The pointer to variable header indexed by count.\r | |
49 | \r | |
50 | **/\r | |
51 | VARIABLE_HEADER *\r | |
52 | GetVariableByIndex (\r | |
53 | IN VARIABLE_INDEX_TABLE *IndexTable,\r | |
54 | IN UINT32 Count\r | |
55 | )\r | |
56 | {\r | |
57 | return (VARIABLE_HEADER *) (UINTN) (IndexTable->Index[Count] + ((UINTN) IndexTable->StartPtr & 0xFFFF0000));\r | |
58 | }\r | |
59 | \r | |
60 | /**\r | |
61 | Record Variable in VariableIndex HOB.\r | |
62 | \r | |
63 | Record Variable in VariableIndex HOB and update the length of variable index table.\r | |
64 | \r | |
65 | @param IndexTable The pointer to variable index table.\r | |
66 | @param Variable The pointer to the variable that will be recorded.\r | |
67 | \r | |
68 | @retval VOID\r | |
69 | \r | |
70 | **/\r | |
71 | VOID\r | |
72 | VariableIndexTableUpdate (\r | |
73 | IN OUT VARIABLE_INDEX_TABLE *IndexTable,\r | |
74 | IN VARIABLE_HEADER *Variable\r | |
75 | )\r | |
76 | {\r | |
77 | IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;\r | |
78 | \r | |
79 | return;\r | |
80 | }\r | |
81 | \r |