3 UEFI Miscellaneous boot Services InstallConfigurationTable service
5 Copyright (c) 2006 - 2008, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #define CONFIG_TABLE_SIZE_INCREASED 0x10
20 UINTN mSystemTableAllocateSize
= 0;
32 Find a config table by name in system table's ConfigurationTable.
36 Guid - The table name to look for
38 Table - Pointer of the config table
42 EFI_NOT_FOUND - Could not find the table in system table's ConfigurationTable.
44 EFI_SUCCESS - Table successfully found.
50 for (Index
= 0; Index
< gDxeCoreST
->NumberOfTableEntries
; Index
++) {
51 if (CompareGuid (Guid
, &(gDxeCoreST
->ConfigurationTable
[Index
].VendorGuid
))) {
52 *Table
= gDxeCoreST
->ConfigurationTable
[Index
].VendorTable
;
64 CoreInstallConfigurationTable (
72 Boot Service called to add, modify, or remove a system configuration table from
77 Guid - Pointer to the GUID for the entry to add, update, or remove
78 Table - Pointer to the configuration table for the entry to add, update, or
83 EFI_SUCCESS Guid, Table pair added, updated, or removed.
84 EFI_INVALID_PARAMETER Input GUID not valid.
85 EFI_NOT_FOUND Attempted to delete non-existant entry
86 EFI_OUT_OF_RESOURCES Not enough memory available
91 EFI_CONFIGURATION_TABLE
*EfiConfigurationTable
;
94 // If Guid is NULL, then this operation cannot be performed
97 return EFI_INVALID_PARAMETER
;
100 EfiConfigurationTable
= gDxeCoreST
->ConfigurationTable
;
103 // Search all the table for an entry that matches Guid
105 for (Index
= 0; Index
< gDxeCoreST
->NumberOfTableEntries
; Index
++) {
106 if (CompareGuid (Guid
, &(gDxeCoreST
->ConfigurationTable
[Index
].VendorGuid
))) {
111 if (Index
< gDxeCoreST
->NumberOfTableEntries
) {
113 // A match was found, so this is either a modify or a delete operation
117 // If Table is not NULL, then this is a modify operation.
118 // Modify the table enty and return.
120 gDxeCoreST
->ConfigurationTable
[Index
].VendorTable
= Table
;
123 // Signal Configuration Table change
125 CoreNotifySignalList (Guid
);
131 // A match was found and Table is NULL, so this is a delete operation.
133 gDxeCoreST
->NumberOfTableEntries
--;
136 // Copy over deleted entry
139 &(EfiConfigurationTable
[Index
]),
140 &(gDxeCoreST
->ConfigurationTable
[Index
+ 1]),
141 (gDxeCoreST
->NumberOfTableEntries
- Index
) * sizeof (EFI_CONFIGURATION_TABLE
)
147 // No matching GUIDs were found, so this is an add operation.
152 // If Table is NULL on an add operation, then return an error.
154 return EFI_NOT_FOUND
;
158 // Assume that Index == gDxeCoreST->NumberOfTableEntries
160 if ((Index
* sizeof (EFI_CONFIGURATION_TABLE
)) >= mSystemTableAllocateSize
) {
162 // Allocate a table with one additional entry.
164 mSystemTableAllocateSize
+= (CONFIG_TABLE_SIZE_INCREASED
* sizeof (EFI_CONFIGURATION_TABLE
));
165 EfiConfigurationTable
= CoreAllocateRuntimePool (mSystemTableAllocateSize
);
166 if (EfiConfigurationTable
== NULL
) {
168 // If a new table could not be allocated, then return an error.
170 return EFI_OUT_OF_RESOURCES
;
173 if (gDxeCoreST
->ConfigurationTable
!= NULL
) {
175 // Copy the old table to the new table.
178 EfiConfigurationTable
,
179 gDxeCoreST
->ConfigurationTable
,
180 Index
* sizeof (EFI_CONFIGURATION_TABLE
)
186 CoreFreePool (gDxeCoreST
->ConfigurationTable
);
190 // Update System Table
192 gDxeCoreST
->ConfigurationTable
= EfiConfigurationTable
;
196 // Fill in the new entry
198 CopyMem ((VOID
*)&EfiConfigurationTable
[Index
].VendorGuid
, Guid
, sizeof (EFI_GUID
));
199 EfiConfigurationTable
[Index
].VendorTable
= Table
;
202 // This is an add operation, so increment the number of table entries
204 gDxeCoreST
->NumberOfTableEntries
++;
208 // Fix up the CRC-32 in the EFI System Table
210 CalculateEfiHdrCrc (&gDxeCoreST
->Hdr
);
213 // Signal Configuration Table change
215 CoreNotifySignalList (Guid
);