From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.10901.1579005437639214869 for ; Tue, 14 Jan 2020 04:37:17 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: linux.intel.com, ip: 134.134.136.100, mailfrom: maciej.rabeda@linux.intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2020 04:37:16 -0800 X-IronPort-AV: E=Sophos;i="5.69,432,1571727600"; d="scan'208,217";a="218943761" Received: from mrabeda-mobl.ger.corp.intel.com (HELO [10.102.8.43]) ([10.102.8.43]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Jan 2020 04:37:15 -0800 Subject: Re: [edk2-devel] reg: [edk2] [PATCH v1] NetworkPkg/SNPDxe: Validate the Memory BAR as per UEFI Spec To: devel@edk2.groups.io, sivaramann@amiindia.co.in Cc: "Wu, Jiaxin" References: From: "Maciej Rabeda" Message-ID: <3d077ab7-dd2b-af78-55a1-25fc2a3d15b0@linux.intel.com> Date: Tue, 14 Jan 2020 13:37:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------18CE1B5E7778F642EDCB66A1" Content-Language: pl --------------18CE1B5E7778F642EDCB66A1 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Hello Siva, Which tools did you use to generate this patch? I cannot apply it via 'git am' command. Did you follow the edk2 git guide (using git format-patch && git send-email commands)? https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers Thanks, Maciej On 04-Dec-19 11:06, Sivaraman Nainar wrote: > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2335 > > > This patch is to check the PCI Memory Base Address Register is valid > or not. > > *** a\NetworkPkg\SnpDxe\Snp.c 2019-11-11 16:53:40.773300500 +0530 > > --- b\NetworkPkg\SnpDxe\Snp.c 2019-11-03 18:46:02.000000000 +0530 > > *************** SimpleNetworkDriverStart ( > > *** 266,272 **** > > UINT8                                     BarIndex; > > PXE_STATFLAGS                             InitStatFlags; > > EFI_PCI_IO_PROTOCOL                       *PciIo; > > ! EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR   *BarDesc = NULL; > > BOOLEAN                                   FoundIoBar; > > BOOLEAN                                   FoundMemoryBar; > > --- 266,272 ---- > > UINT8                                     BarIndex; > >    PXE_STATFLAGS InitStatFlags; > > EFI_PCI_IO_PROTOCOL                       *PciIo; > > ! EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR         *BarDesc; > > BOOLEAN                                   FoundIoBar; > >     BOOLEAN                   FoundMemoryBar; > > *************** SimpleNetworkDriverStart ( > > *** 481,494 **** > >       } else if (EFI_ERROR (Status)) { > >         goto Error_DeleteSNP; > >       } > > !              //PXE boot fails with cards having non-continuous BAR. > > !              // From UEFI Spec, GetBarAttributes can have only > descriptors of type ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR > > !     // and ACPI_END_TAG_DESCRIPTOR. > > !     if( BarDesc->Header.Header.Byte != > ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR )  { > > !       FreePool (BarDesc); > > !       continue; > > !     } > > ! > >       if ((!FoundMemoryBar) && (BarDesc->ResType == > ACPI_ADDRESS_SPACE_TYPE_MEM)) { > >         Snp->MemoryBarIndex = BarIndex; > >         FoundMemoryBar      = TRUE; > > --- 481,487 ---- > >       } else if (EFI_ERROR (Status)) { > >         goto Error_DeleteSNP; > >       } > > ! > >       if ((!FoundMemoryBar) && (BarDesc->ResType == > ACPI_ADDRESS_SPACE_TYPE_MEM)) { > >         Snp->MemoryBarIndex = BarIndex; > >         FoundMemoryBar      = TRUE; > > --------------18CE1B5E7778F642EDCB66A1 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: 8bit

Hello Siva,

Which tools did you use to generate this patch? I cannot apply it via 'git am' command.
Did you follow the edk2 git guide (using git format-patch && git send-email commands)?
https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers

Thanks,
Maciej

On 04-Dec-19 11:06, Sivaraman Nainar wrote:

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2335

 

This patch is to check the PCI Memory Base Address Register is valid or not.

 

*** a\NetworkPkg\SnpDxe\Snp.c           2019-11-11 16:53:40.773300500 +0530

--- b\NetworkPkg\SnpDxe\Snp.c                             2019-11-03 18:46:02.000000000 +0530

*************** SimpleNetworkDriverStart (

*** 266,272 ****

    UINT8                                     BarIndex;

    PXE_STATFLAGS                             InitStatFlags;

    EFI_PCI_IO_PROTOCOL                       *PciIo;

!   EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR   *BarDesc = NULL;

    BOOLEAN                                   FoundIoBar;

    BOOLEAN                                   FoundMemoryBar;

 

--- 266,272 ----

    UINT8                                     BarIndex;

   PXE_STATFLAGS                             InitStatFlags;

    EFI_PCI_IO_PROTOCOL                       *PciIo;

!   EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR         *BarDesc;

    BOOLEAN                                   FoundIoBar;

    BOOLEAN                                   FoundMemoryBar;

 

*************** SimpleNetworkDriverStart (

*** 481,494 ****

      } else if (EFI_ERROR (Status)) {

        goto Error_DeleteSNP;

      }

!              //PXE boot fails with cards having non-continuous BAR.

!              // From UEFI Spec, GetBarAttributes can have only descriptors of type ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR

!     // and ACPI_END_TAG_DESCRIPTOR.

!     if( BarDesc->Header.Header.Byte != ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR )  {

!       FreePool (BarDesc);

!       continue;

!     }

!    

      if ((!FoundMemoryBar) && (BarDesc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM)) {

        Snp->MemoryBarIndex = BarIndex;

        FoundMemoryBar      = TRUE;

--- 481,487 ----

      } else if (EFI_ERROR (Status)) {

        goto Error_DeleteSNP;

      }

!

      if ((!FoundMemoryBar) && (BarDesc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM)) {

        Snp->MemoryBarIndex = BarIndex;

        FoundMemoryBar      = TRUE;

 

--------------18CE1B5E7778F642EDCB66A1--