MdeModulePkg: Refine codes of iSCSI driver

The RSDT is only used when the bios need to support ACPI 1.0
version. When change PcdAcpiExposedTableVersions to 0x3C, it
will not support ACPI 1.0. The default is 0x3E.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by:  Eric Dong <eric.dong@intel.com>
This commit is contained in:
Zhang Lubo 2016-08-11 10:24:10 +08:00 committed by Jiaxin Wu
parent a012df5ec6
commit 998731099e
1 changed files with 20 additions and 15 deletions

View File

@ -436,9 +436,12 @@ IScsiPublishIbft (
EFI_HANDLE *HandleBuffer; EFI_HANDLE *HandleBuffer;
UINT8 *Heap; UINT8 *Heap;
UINT8 Checksum; UINT8 Checksum;
UINTN Index;
EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp; EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;
EFI_ACPI_DESCRIPTION_HEADER *Rsdt; EFI_ACPI_DESCRIPTION_HEADER *Rsdt;
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
Rsdt = NULL;
Xsdt = NULL;
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol); Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -449,25 +452,22 @@ IScsiPublishIbft (
// //
// Find ACPI table RSD_PTR from system table // Find ACPI table RSD_PTR from system table
// //
for (Index = 0, Rsdp = NULL; Index < gST->NumberOfTableEntries; Index++) { Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **) &Rsdp);
if (CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), &gEfiAcpi20TableGuid) || if (EFI_ERROR (Status)) {
CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), &gEfiAcpi10TableGuid) || Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **) &Rsdp);
CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), &gEfiAcpiTableGuid)
) {
//
// A match was found.
//
Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *) gST->ConfigurationTable[Index].VendorTable;
break;
}
} }
if (Rsdp == NULL) { if (EFI_ERROR (Status) || (Rsdp == NULL)) {
return ; return ;
} else { } else if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION && Rsdp->XsdtAddress != 0) {
Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->XsdtAddress;
} else if (Rsdp->RsdtAddress != 0) {
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress; Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress;
} }
if ((Xsdt == NULL) && (Rsdt == NULL)) {
return ;
}
if (mIbftInstalled) { if (mIbftInstalled) {
Status = AcpiTableProtocol->UninstallAcpiTable ( Status = AcpiTableProtocol->UninstallAcpiTable (
@ -506,7 +506,12 @@ IScsiPublishIbft (
// //
// Fill in the various section of the iSCSI Boot Firmware Table. // Fill in the various section of the iSCSI Boot Firmware Table.
// //
IScsiInitIbfTableHeader (Table, Rsdt->OemId, &Rsdt->OemTableId); if (Rsdp->Revision >= EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER_REVISION) {
IScsiInitIbfTableHeader (Table, Xsdt->OemId, &Xsdt->OemTableId);
} else {
IScsiInitIbfTableHeader (Table, Rsdt->OemId, &Rsdt->OemTableId);
}
IScsiInitControlSection (Table, HandleCount); IScsiInitControlSection (Table, HandleCount);
IScsiFillInitiatorSection (Table, &Heap, HandleBuffer[0]); IScsiFillInitiatorSection (Table, &Heap, HandleBuffer[0]);
IScsiFillNICAndTargetSections (Table, &Heap, HandleCount, HandleBuffer); IScsiFillNICAndTargetSections (Table, &Heap, HandleCount, HandleBuffer);