* [patch] NetworkPkg: Refine codes of iSCSI driver @ 2016-08-11 2:27 Zhang Lubo 2016-08-11 6:14 ` Ye, Ting 0 siblings, 1 reply; 5+ messages in thread From: Zhang Lubo @ 2016-08-11 2:27 UTC (permalink / raw) To: edk2-devel; +Cc: Eric Dong, Ye Ting, Fu Siyuan 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> --- NetworkPkg/IScsiDxe/IScsiIbft.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiIbft.c b/NetworkPkg/IScsiDxe/IScsiIbft.c index 3c179bf..27d098d 100644 --- a/NetworkPkg/IScsiDxe/IScsiIbft.c +++ b/NetworkPkg/IScsiDxe/IScsiIbft.c @@ -454,42 +454,42 @@ IScsiPublishIbft ( EFI_STATUS Status; EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; 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)) { return ; } // // 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, mTableKey ); @@ -518,11 +518,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); IScsiFillInitiatorSection (Table, &Heap); IScsiFillNICAndTargetSections (Table, &Heap); Checksum = CalculateCheckSum8((UINT8 *)Table, Table->Length); -- 1.9.5.msysgit.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [patch] NetworkPkg: Refine codes of iSCSI driver 2016-08-11 2:27 [patch] NetworkPkg: Refine codes of iSCSI driver Zhang Lubo @ 2016-08-11 6:14 ` Ye, Ting 2016-08-11 7:01 ` Zhang, Lubo 0 siblings, 1 reply; 5+ messages in thread From: Ye, Ting @ 2016-08-11 6:14 UTC (permalink / raw) To: Zhang, Lubo, edk2-devel@lists.01.org; +Cc: Dong, Eric, Fu, Siyuan Hi Lubo, Could you please describe the changes introduced by this patch in your log message? Thanks, Ting -----Original Message----- From: Zhang, Lubo Sent: Thursday, August 11, 2016 10:27 AM To: edk2-devel@lists.01.org Cc: Dong, Eric <eric.dong@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> Subject: [patch] 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> --- NetworkPkg/IScsiDxe/IScsiIbft.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiIbft.c b/NetworkPkg/IScsiDxe/IScsiIbft.c index 3c179bf..27d098d 100644 --- a/NetworkPkg/IScsiDxe/IScsiIbft.c +++ b/NetworkPkg/IScsiDxe/IScsiIbft.c @@ -454,42 +454,42 @@ IScsiPublishIbft ( EFI_STATUS Status; EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; 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)) { return ; } // // 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, mTableKey ); @@ -518,11 +518,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); IScsiFillInitiatorSection (Table, &Heap); IScsiFillNICAndTargetSections (Table, &Heap); Checksum = CalculateCheckSum8((UINT8 *)Table, Table->Length); -- 1.9.5.msysgit.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] NetworkPkg: Refine codes of iSCSI driver 2016-08-11 6:14 ` Ye, Ting @ 2016-08-11 7:01 ` Zhang, Lubo 2016-08-11 7:10 ` Ye, Ting 0 siblings, 1 reply; 5+ messages in thread From: Zhang, Lubo @ 2016-08-11 7:01 UTC (permalink / raw) To: Ye, Ting, Dong, Eric; +Cc: Fu, Siyuan, edk2-devel@lists.01.org From my understanding, the default PcdAcpiExposedTableVersions is 0x3E, it can support ACPI table above version 1.0.but when changing the PCD to 0x3C, table 1.0 will not be installed and supported . However the original code Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress ...... IScsiInitIbfTableHeader (Table, Rsdt->OemId, &Rsdt->OemTableId); always assume the Rsdt is not NULL which is used for table 1.0. So we should distinguish which table version we find. If table version above 1.0, we use the Rsdp->XsdtAddress instead of Rsdp->RsdtAddress. Best Regards Lubo -----Original Message----- From: Ye, Ting Sent: Thursday, August 11, 2016 2:14 PM To: Zhang, Lubo <lubo.zhang@intel.com>; edk2-devel@lists.01.org Cc: Dong, Eric <eric.dong@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> Subject: RE: [patch] NetworkPkg: Refine codes of iSCSI driver Hi Lubo, Could you please describe the changes introduced by this patch in your log message? Thanks, Ting -----Original Message----- From: Zhang, Lubo Sent: Thursday, August 11, 2016 10:27 AM To: edk2-devel@lists.01.org Cc: Dong, Eric <eric.dong@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> Subject: [patch] 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> --- NetworkPkg/IScsiDxe/IScsiIbft.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiIbft.c b/NetworkPkg/IScsiDxe/IScsiIbft.c index 3c179bf..27d098d 100644 --- a/NetworkPkg/IScsiDxe/IScsiIbft.c +++ b/NetworkPkg/IScsiDxe/IScsiIbft.c @@ -454,42 +454,42 @@ IScsiPublishIbft ( EFI_STATUS Status; EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; 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)) { return ; } // // 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, mTableKey ); @@ -518,11 +518,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); IScsiFillInitiatorSection (Table, &Heap); IScsiFillNICAndTargetSections (Table, &Heap); Checksum = CalculateCheckSum8((UINT8 *)Table, Table->Length); -- 1.9.5.msysgit.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] NetworkPkg: Refine codes of iSCSI driver 2016-08-11 7:01 ` Zhang, Lubo @ 2016-08-11 7:10 ` Ye, Ting 2016-08-11 7:17 ` Zhang, Lubo 0 siblings, 1 reply; 5+ messages in thread From: Ye, Ting @ 2016-08-11 7:10 UTC (permalink / raw) To: Zhang, Lubo, Dong, Eric; +Cc: Fu, Siyuan, edk2-devel@lists.01.org So how about adding your below sentences to the log message when you check in? I think it is more clear why we introduce the change to iSCSI. Others are good to me. Reviewed-by: Ye Ting <ting.ye@intel.com> -----Original Message----- From: Zhang, Lubo Sent: Thursday, August 11, 2016 3:01 PM To: Ye, Ting <ting.ye@intel.com>; Dong, Eric <eric.dong@intel.com> Cc: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org Subject: RE: [patch] NetworkPkg: Refine codes of iSCSI driver From my understanding, the default PcdAcpiExposedTableVersions is 0x3E, it can support ACPI table above version 1.0.but when changing the PCD to 0x3C, table 1.0 will not be installed and supported . However the original code Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress ...... IScsiInitIbfTableHeader (Table, Rsdt->OemId, &Rsdt->OemTableId); always assume the Rsdt is not NULL which is used for table 1.0. So we should distinguish which table version we find. If table version above 1.0, we use the Rsdp->XsdtAddress instead of Rsdp->RsdtAddress. Best Regards Lubo -----Original Message----- From: Ye, Ting Sent: Thursday, August 11, 2016 2:14 PM To: Zhang, Lubo <lubo.zhang@intel.com>; edk2-devel@lists.01.org Cc: Dong, Eric <eric.dong@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> Subject: RE: [patch] NetworkPkg: Refine codes of iSCSI driver Hi Lubo, Could you please describe the changes introduced by this patch in your log message? Thanks, Ting -----Original Message----- From: Zhang, Lubo Sent: Thursday, August 11, 2016 10:27 AM To: edk2-devel@lists.01.org Cc: Dong, Eric <eric.dong@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> Subject: [patch] 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> --- NetworkPkg/IScsiDxe/IScsiIbft.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiIbft.c b/NetworkPkg/IScsiDxe/IScsiIbft.c index 3c179bf..27d098d 100644 --- a/NetworkPkg/IScsiDxe/IScsiIbft.c +++ b/NetworkPkg/IScsiDxe/IScsiIbft.c @@ -454,42 +454,42 @@ IScsiPublishIbft ( EFI_STATUS Status; EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; 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)) { return ; } // // 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, mTableKey ); @@ -518,11 +518,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); IScsiFillInitiatorSection (Table, &Heap); IScsiFillNICAndTargetSections (Table, &Heap); Checksum = CalculateCheckSum8((UINT8 *)Table, Table->Length); -- 1.9.5.msysgit.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] NetworkPkg: Refine codes of iSCSI driver 2016-08-11 7:10 ` Ye, Ting @ 2016-08-11 7:17 ` Zhang, Lubo 0 siblings, 0 replies; 5+ messages in thread From: Zhang, Lubo @ 2016-08-11 7:17 UTC (permalink / raw) To: Ye, Ting; +Cc: Fu, Siyuan, edk2-devel@lists.01.org, Dong, Eric Ok, I will update the log. Thanks Lubo -----Original Message----- From: Ye, Ting Sent: Thursday, August 11, 2016 3:11 PM To: Zhang, Lubo <lubo.zhang@intel.com>; Dong, Eric <eric.dong@intel.com> Cc: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org Subject: RE: [patch] NetworkPkg: Refine codes of iSCSI driver So how about adding your below sentences to the log message when you check in? I think it is more clear why we introduce the change to iSCSI. Others are good to me. Reviewed-by: Ye Ting <ting.ye@intel.com> -----Original Message----- From: Zhang, Lubo Sent: Thursday, August 11, 2016 3:01 PM To: Ye, Ting <ting.ye@intel.com>; Dong, Eric <eric.dong@intel.com> Cc: Fu, Siyuan <siyuan.fu@intel.com>; edk2-devel@lists.01.org Subject: RE: [patch] NetworkPkg: Refine codes of iSCSI driver From my understanding, the default PcdAcpiExposedTableVersions is 0x3E, it can support ACPI table above version 1.0.but when changing the PCD to 0x3C, table 1.0 will not be installed and supported . However the original code Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Rsdp->RsdtAddress ...... IScsiInitIbfTableHeader (Table, Rsdt->OemId, &Rsdt->OemTableId); always assume the Rsdt is not NULL which is used for table 1.0. So we should distinguish which table version we find. If table version above 1.0, we use the Rsdp->XsdtAddress instead of Rsdp->RsdtAddress. Best Regards Lubo -----Original Message----- From: Ye, Ting Sent: Thursday, August 11, 2016 2:14 PM To: Zhang, Lubo <lubo.zhang@intel.com>; edk2-devel@lists.01.org Cc: Dong, Eric <eric.dong@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> Subject: RE: [patch] NetworkPkg: Refine codes of iSCSI driver Hi Lubo, Could you please describe the changes introduced by this patch in your log message? Thanks, Ting -----Original Message----- From: Zhang, Lubo Sent: Thursday, August 11, 2016 10:27 AM To: edk2-devel@lists.01.org Cc: Dong, Eric <eric.dong@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com> Subject: [patch] 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> --- NetworkPkg/IScsiDxe/IScsiIbft.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/NetworkPkg/IScsiDxe/IScsiIbft.c b/NetworkPkg/IScsiDxe/IScsiIbft.c index 3c179bf..27d098d 100644 --- a/NetworkPkg/IScsiDxe/IScsiIbft.c +++ b/NetworkPkg/IScsiDxe/IScsiIbft.c @@ -454,42 +454,42 @@ IScsiPublishIbft ( EFI_STATUS Status; EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; 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)) { return ; } // // 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, mTableKey ); @@ -518,11 +518,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); IScsiFillInitiatorSection (Table, &Heap); IScsiFillNICAndTargetSections (Table, &Heap); Checksum = CalculateCheckSum8((UINT8 *)Table, Table->Length); -- 1.9.5.msysgit.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-08-11 7:18 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-08-11 2:27 [patch] NetworkPkg: Refine codes of iSCSI driver Zhang Lubo 2016-08-11 6:14 ` Ye, Ting 2016-08-11 7:01 ` Zhang, Lubo 2016-08-11 7:10 ` Ye, Ting 2016-08-11 7:17 ` Zhang, Lubo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox