NetworkPkg: 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:14:55 +08:00 committed by Jiaxin Wu
parent 998731099e
commit 79d909849c
1 changed files with 20 additions and 15 deletions

View File

@ -456,10 +456,12 @@ IScsiPublishIbft (
EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER *Table;
EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;
EFI_ACPI_DESCRIPTION_HEADER *Rsdt;
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
UINT8 *Heap;
UINT8 Checksum;
UINTN Index;
Rsdt = NULL;
Xsdt = NULL;
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
if (EFI_ERROR (Status)) {
@ -469,25 +471,23 @@ IScsiPublishIbft (
//
// Find ACPI table RSD_PTR from the system table.
//
for (Index = 0, Rsdp = NULL; Index < gST->NumberOfTableEntries; Index++) {
if (CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), &gEfiAcpi20TableGuid) ||
CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), &gEfiAcpi10TableGuid) ||
CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), &gEfiAcpiTableGuid)
) {
//
// A match was found.
//
Rsdp = (EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *) gST->ConfigurationTable[Index].VendorTable;
break;
}
Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **) &Rsdp);
if (EFI_ERROR (Status)) {
Status = EfiGetSystemConfigurationTable (&gEfiAcpi10TableGuid, (VOID **) &Rsdp);
}
if (Rsdp == NULL) {
if (EFI_ERROR (Status) || (Rsdp == NULL)) {
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;
}
if ((Xsdt == NULL) && (Rsdt == NULL)) {
return ;
}
if (mIbftInstalled) {
Status = AcpiTableProtocol->UninstallAcpiTable (
AcpiTableProtocol,
@ -520,7 +520,12 @@ IScsiPublishIbft (
//
// 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);
IScsiFillInitiatorSection (Table, &Heap);
IScsiFillNICAndTargetSections (Table, &Heap);