public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zhang, Lubo" <lubo.zhang@intel.com>
To: "Dong, Eric" <eric.dong@intel.com>
Cc: "Ye, Ting" <ting.ye@intel.com>,
	"Fu, Siyuan" <siyuan.fu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [patch] MdeModulePkg: Refine codes of iSCSI driver
Date: Thu, 11 Aug 2016 07:19:18 +0000	[thread overview]
Message-ID: <7619447B08B8F74DA4FF2A813B79803B01A4EDF7@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1470882464-25832-1-git-send-email-lubo.zhang@intel.com>

Hi Eric
    Do you have any comments for this patch.

Best regards
Lubo 

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zhang Lubo
Sent: Thursday, August 11, 2016 10:28 AM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Dong, Eric <eric.dong@intel.com>
Subject: [edk2] [patch] 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>
---
 .../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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2016-08-11  7:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11  2:27 [patch] MdeModulePkg: Refine codes of iSCSI driver Zhang Lubo
2016-08-11  7:19 ` Zhang, Lubo [this message]
2016-08-11  8:43   ` Dong, Eric

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7619447B08B8F74DA4FF2A813B79803B01A4EDF7@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox