Skip to content

Commit 462d9a3

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 462d9a3

File tree

1 file changed

+55
-43
lines changed

1 file changed

+55
-43
lines changed

MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c

Lines changed: 55 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,12 +1985,13 @@ 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;
1994+
NeedToInstallTable = NULL;
19941995

19951996
if (PcdGetBool (PcdNoACPIReclaimMemory)) {
19961997
AcpiAllocateMemoryType = EfiACPIMemoryNVS;
@@ -2164,30 +2165,34 @@ InstallAcpiTableFromAcpiSiliconHob (
21642165
NeedToInstallTable = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)SocEntryTable)->Dsdt;
21652166
}
21662167

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

2187-
DEBUG ((DEBUG_INFO, "Installed DSDT in the DXE Table list!\n"));
2189+
DEBUG ((DEBUG_INFO, "Installed DSDT in the DXE Table list!\n"));
2190+
}
2191+
} else {
2192+
DEBUG ((DEBUG_ERROR, "The DSDT content is not correct, then skip it!\n"));
21882193
}
21892194
} else {
2190-
DEBUG ((DEBUG_ERROR, "The DSDT content is not correct, then skip it!\n"));
2195+
DEBUG ((DEBUG_ERROR, "The DSDT Table not initialized during PEI phase yet.\n"));
21912196
}
21922197

21932198
//
@@ -2199,27 +2204,34 @@ InstallAcpiTableFromAcpiSiliconHob (
21992204
NeedToInstallTable = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)SocEntryTable)->FirmwareCtrl;
22002205
}
22012206

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);
2207+
if (NeedToInstallTable != NULL) {
2208+
//
2209+
// if signature can not be found from the XFirmwareCtrl / FirmwareCtrl field then skip it.
2210+
//
2211+
if (((EFI_ACPI_DESCRIPTION_HEADER *)NeedToInstallTable)->Signature == EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
2212+
Status = AddTableToList (AcpiTableInstance, NeedToInstallTable, TRUE, Version, TRUE, &TableKey);
2213+
if (EFI_ERROR (Status)) {
2214+
DEBUG ((DEBUG_ERROR, "Fail to add FACS in the DXE Table list!\n"));
2215+
ASSERT_EFI_ERROR (Status);
2216+
break;
2217+
} else {
2218+
Status = PublishTables (AcpiTableInstance, Version);
2219+
if (!EFI_ERROR (Status)) {
2220+
//
2221+
// Add a new table successfully, notify registed callback
2222+
//
2223+
if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {
2224+
SdtNotifyAcpiList (AcpiTableInstance, Version, TableKey);
2225+
}
22162226
}
2217-
}
22182227

2219-
DEBUG ((DEBUG_INFO, "Installed FACS in the DXE Table list!\n"));
2228+
DEBUG ((DEBUG_INFO, "Installed FACS in the DXE Table list!\n"));
2229+
}
2230+
} else {
2231+
DEBUG ((DEBUG_ERROR, "The FACS content is not correct, then skip it!\n"));
22202232
}
22212233
} else {
2222-
DEBUG ((DEBUG_ERROR, "The FACS content is not correct, then skip it!\n"));
2234+
DEBUG ((DEBUG_ERROR, "The FACS Table not initialized during PEI phase yet.\n"));
22232235
}
22242236
}
22252237
}

0 commit comments

Comments
 (0)