MdeModulePkg RamDiskDxe: Not use hardcode 'SectionInstance' to locate SSDT

This commit will scan all the EFI raw section instances within the
module's FV to make sure the NVDIMM root device SSDT can be properly
located.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Zhang Chao B <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
This commit is contained in:
Hao Wu 2016-07-12 20:10:42 +08:00
parent 6596018924
commit 6558fd7311

View File

@ -75,35 +75,49 @@ RamDiskPublishSsdt (
{
EFI_STATUS Status;
EFI_ACPI_DESCRIPTION_HEADER *Table;
UINTN SectionInstance;
UINTN TableSize;
Status = GetSectionFromFv (
&gEfiCallerIdGuid,
EFI_SECTION_RAW,
1,
(VOID **) &Table,
&TableSize
);
ASSERT_EFI_ERROR (Status);
Status = EFI_SUCCESS;
SectionInstance = 0;
ASSERT (Table->OemTableId == SIGNATURE_64 ('R', 'a', 'm', 'D', 'i', 's', 'k', ' '));
//
// Scan all the EFI raw section instances in FV to find the NVDIMM root
// device SSDT.
//
while (TRUE) {
Status = GetSectionFromFv (
&gEfiCallerIdGuid,
EFI_SECTION_RAW,
SectionInstance,
(VOID **) &Table,
&TableSize
);
if (EFI_ERROR (Status)) {
break;
}
Status = mAcpiTableProtocol->InstallAcpiTable (
mAcpiTableProtocol,
Table,
TableSize,
&mRamDiskSsdtTableKey
);
ASSERT_EFI_ERROR (Status);
if (Table->OemTableId == SIGNATURE_64 ('R', 'a', 'm', 'D', 'i', 's', 'k', ' ')) {
Status = mAcpiTableProtocol->InstallAcpiTable (
mAcpiTableProtocol,
Table,
TableSize,
&mRamDiskSsdtTableKey
);
ASSERT_EFI_ERROR (Status);
if (!EFI_ERROR (Status)) {
mRamDiskSsdtTableKeyValid = TRUE;
} else {
mRamDiskSsdtTableKeyValid = FALSE;
if (!EFI_ERROR (Status)) {
mRamDiskSsdtTableKeyValid = TRUE;
}
FreePool (Table);
return Status;
} else {
FreePool (Table);
SectionInstance++;
}
}
FreePool (Table);
return Status;
}