Skip to content

Commit b67e237

Browse files
committed
MdeModulePkg/AcpiTableDxe: Fixed exception when enable SpecialPool
In some corner cases the NeedToInstallTable not been initialized well in the InstallAcpiTableFromAcpiSiliconHob, which caused exception when enable special pool function. This patch fixed exception by initialize NeedToInstallTable well. Signed-off-by: George Liao <[email protected]>
1 parent 1c74842 commit b67e237

File tree

1 file changed

+64
-43
lines changed

1 file changed

+64
-43
lines changed

MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c

Lines changed: 64 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,12 +1985,12 @@ InstallAcpiTableFromAcpiSiliconHob (
19851985
//
19861986
// Initial variable.
19871987
//
1988-
SiAcpiHobRsdp = NULL;
1989-
SiCommonAcpiTable = NULL;
1990-
AcpiSiliconHob = GET_GUID_HOB_DATA (GuidHob);
1991-
Status = EFI_SUCCESS;
1992-
Version = PcdGet32 (PcdAcpiExposedTableVersions);
1993-
TableKey = 0;
1988+
SiAcpiHobRsdp = NULL;
1989+
SiCommonAcpiTable = NULL;
1990+
AcpiSiliconHob = GET_GUID_HOB_DATA (GuidHob);
1991+
Status = EFI_SUCCESS;
1992+
Version = PcdGet32 (PcdAcpiExposedTableVersions);
1993+
TableKey = 0;
19941994

19951995
if (PcdGetBool (PcdNoACPIReclaimMemory)) {
19961996
AcpiAllocateMemoryType = EfiACPIMemoryNVS;
@@ -2162,32 +2162,41 @@ InstallAcpiTableFromAcpiSiliconHob (
21622162
NeedToInstallTable = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)SocEntryTable)->XDsdt;
21632163
} else if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)SocEntryTable)->Dsdt != 0) {
21642164
NeedToInstallTable = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)SocEntryTable)->Dsdt;
2165+
} else {
2166+
//
2167+
// The XDsdt or Dsdt not be detected, so set NeedToInstallTable to NULL to skip Dsdt installation.
2168+
//
2169+
NeedToInstallTable = NULL;
21652170
}
21662171

2167-
//
2168-
// if signature can not be found from the XDsdt / Dsdt field then skip it.
2169-
//
2170-
if (((EFI_ACPI_DESCRIPTION_HEADER *)NeedToInstallTable)->Signature == EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) {
2171-
Status = AddTableToList (AcpiTableInstance, NeedToInstallTable, TRUE, Version, TRUE, &TableKey);
2172-
if (EFI_ERROR (Status)) {
2173-
DEBUG ((DEBUG_ERROR, "Fail to add DSDT in the DXE Table list!\n"));
2174-
ASSERT_EFI_ERROR (Status);
2175-
break;
2176-
} else {
2177-
Status = PublishTables (AcpiTableInstance, Version);
2178-
if (!EFI_ERROR (Status)) {
2179-
//
2180-
// Add a new table successfully, notify registed callback
2181-
//
2182-
if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {
2183-
SdtNotifyAcpiList (AcpiTableInstance, Version, TableKey);
2172+
if (NeedToInstallTable != NULL) {
2173+
//
2174+
// if signature can not be found from the XDsdt / Dsdt field then skip it.
2175+
//
2176+
if (((EFI_ACPI_DESCRIPTION_HEADER *)NeedToInstallTable)->Signature == EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) {
2177+
Status = AddTableToList (AcpiTableInstance, NeedToInstallTable, TRUE, Version, TRUE, &TableKey);
2178+
if (EFI_ERROR (Status)) {
2179+
DEBUG ((DEBUG_ERROR, "Fail to add DSDT in the DXE Table list!\n"));
2180+
ASSERT_EFI_ERROR (Status);
2181+
break;
2182+
} else {
2183+
Status = PublishTables (AcpiTableInstance, Version);
2184+
if (!EFI_ERROR (Status)) {
2185+
//
2186+
// Add a new table successfully, notify registed callback
2187+
//
2188+
if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {
2189+
SdtNotifyAcpiList (AcpiTableInstance, Version, TableKey);
2190+
}
21842191
}
2185-
}
21862192

2187-
DEBUG ((DEBUG_INFO, "Installed DSDT in the DXE Table list!\n"));
2193+
DEBUG ((DEBUG_INFO, "Installed DSDT in the DXE Table list!\n"));
2194+
}
2195+
} else {
2196+
DEBUG ((DEBUG_ERROR, "The DSDT content is not correct, then skip it!\n"));
21882197
}
21892198
} else {
2190-
DEBUG ((DEBUG_ERROR, "The DSDT content is not correct, then skip it!\n"));
2199+
DEBUG ((DEBUG_ERROR, "The DSDT Table not initialized during PEI phase yet.\n"));
21912200
}
21922201

21932202
//
@@ -2197,29 +2206,41 @@ InstallAcpiTableFromAcpiSiliconHob (
21972206
NeedToInstallTable = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)SocEntryTable)->XFirmwareCtrl;
21982207
} else if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)SocEntryTable)->FirmwareCtrl != 0) {
21992208
NeedToInstallTable = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)SocEntryTable)->FirmwareCtrl;
2209+
} else {
2210+
//
2211+
// The XFirmwareCtrl or FirmwareCtrl not be detected, so set NeedToInstallTable to NULL to skip Facs installation.
2212+
//
2213+
NeedToInstallTable = NULL;
22002214
}
22012215

2202-
if (((EFI_ACPI_DESCRIPTION_HEADER *)NeedToInstallTable)->Signature == EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
2203-
Status = AddTableToList (AcpiTableInstance, NeedToInstallTable, TRUE, Version, TRUE, &TableKey);
2204-
if (EFI_ERROR (Status)) {
2205-
DEBUG ((DEBUG_ERROR, "Fail to add FACS in the DXE Table list!\n"));
2206-
ASSERT_EFI_ERROR (Status);
2207-
break;
2208-
} else {
2209-
Status = PublishTables (AcpiTableInstance, Version);
2210-
if (!EFI_ERROR (Status)) {
2211-
//
2212-
// Add a new table successfully, notify registed callback
2213-
//
2214-
if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {
2215-
SdtNotifyAcpiList (AcpiTableInstance, Version, TableKey);
2216+
if (NeedToInstallTable != NULL) {
2217+
//
2218+
// if signature can not be found from the XFirmwareCtrl / FirmwareCtrl field then skip it.
2219+
//
2220+
if (((EFI_ACPI_DESCRIPTION_HEADER *)NeedToInstallTable)->Signature == EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
2221+
Status = AddTableToList (AcpiTableInstance, NeedToInstallTable, TRUE, Version, TRUE, &TableKey);
2222+
if (EFI_ERROR (Status)) {
2223+
DEBUG ((DEBUG_ERROR, "Fail to add FACS in the DXE Table list!\n"));
2224+
ASSERT_EFI_ERROR (Status);
2225+
break;
2226+
} else {
2227+
Status = PublishTables (AcpiTableInstance, Version);
2228+
if (!EFI_ERROR (Status)) {
2229+
//
2230+
// Add a new table successfully, notify registed callback
2231+
//
2232+
if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {
2233+
SdtNotifyAcpiList (AcpiTableInstance, Version, TableKey);
2234+
}
22162235
}
2217-
}
22182236

2219-
DEBUG ((DEBUG_INFO, "Installed FACS in the DXE Table list!\n"));
2237+
DEBUG ((DEBUG_INFO, "Installed FACS in the DXE Table list!\n"));
2238+
}
2239+
} else {
2240+
DEBUG ((DEBUG_ERROR, "The FACS content is not correct, then skip it!\n"));
22202241
}
22212242
} else {
2222-
DEBUG ((DEBUG_ERROR, "The FACS content is not correct, then skip it!\n"));
2243+
DEBUG ((DEBUG_ERROR, "The FACS Table not initialized during PEI phase yet.\n"));
22232244
}
22242245
}
22252246
}

0 commit comments

Comments
 (0)