From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by ml01.01.org (Postfix) with ESMTP id 2B9A11A1DED for ; Wed, 10 Aug 2016 19:28:11 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 10 Aug 2016 19:28:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,503,1464678000"; d="scan'208";a="1033538387" Received: from shwdeopenpsi116.ccr.corp.intel.com ([10.239.9.11]) by orsmga002.jf.intel.com with ESMTP; 10 Aug 2016 19:28:03 -0700 From: Zhang Lubo To: edk2-devel@lists.01.org Cc: Eric Dong , Ye Ting , Fu Siyuan Date: Thu, 11 Aug 2016 10:27:44 +0800 Message-Id: <1470882464-25832-1-git-send-email-lubo.zhang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [patch] MdeModulePkg: Refine codes of iSCSI driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2016 02:28:11 -0000 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 Cc: Eric Dong Cc: Ye Ting Cc: Fu Siyuan --- .../Universal/Network/IScsiDxe/IScsiIbft.c | 35 ++++++++++++---------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c index e5f685f..45d89a6 100644 --- a/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c +++ b/MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c @@ -434,42 +434,42 @@ IScsiPublishIbft ( EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER *Table; UINTN HandleCount; EFI_HANDLE *HandleBuffer; UINT8 *Heap; UINT8 Checksum; - UINTN Index; EFI_ACPI_3_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp; EFI_ACPI_DESCRIPTION_HEADER *Rsdt; + EFI_ACPI_DESCRIPTION_HEADER *Xsdt; + + Rsdt = NULL; + Xsdt = NULL; Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol); if (EFI_ERROR (Status)) { return ; } // // Find ACPI table RSD_PTR from 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, mTableKey @@ -504,11 +504,16 @@ IScsiPublishIbft ( Heap = (UINT8 *) Table + IBFT_HEAP_OFFSET; // // 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); IScsiFillInitiatorSection (Table, &Heap, HandleBuffer[0]); IScsiFillNICAndTargetSections (Table, &Heap, HandleCount, HandleBuffer); Checksum = CalculateCheckSum8((UINT8 *)Table, Table->Length); -- 1.9.5.msysgit.1