public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* reg: [edk2] [PATCH v1] NetworkPkg/SNPDxe: Validate the Memory BAR as per UEFI Spec
@ 2019-12-04 10:06 Sivaraman Nainar
  2020-01-14 12:37 ` [edk2-devel] " Maciej Rabeda
  0 siblings, 1 reply; 2+ messages in thread
From: Sivaraman Nainar @ 2019-12-04 10:06 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Wu, Jiaxin

[-- Attachment #1: Type: text/plain, Size: 2146 bytes --]

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;


[-- Attachment #2: Type: text/html, Size: 8872 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [edk2-devel] reg: [edk2] [PATCH v1] NetworkPkg/SNPDxe: Validate the Memory BAR as per UEFI Spec
  2019-12-04 10:06 reg: [edk2] [PATCH v1] NetworkPkg/SNPDxe: Validate the Memory BAR as per UEFI Spec Sivaraman Nainar
@ 2020-01-14 12:37 ` Maciej Rabeda
  0 siblings, 0 replies; 2+ messages in thread
From: Maciej Rabeda @ 2020-01-14 12:37 UTC (permalink / raw)
  To: devel, sivaramann; +Cc: Wu, Jiaxin

[-- Attachment #1: Type: text/plain, Size: 2502 bytes --]

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 
> <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;
>
> 

[-- Attachment #2: Type: text/html, Size: 7420 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-14 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-04 10:06 reg: [edk2] [PATCH v1] NetworkPkg/SNPDxe: Validate the Memory BAR as per UEFI Spec Sivaraman Nainar
2020-01-14 12:37 ` [edk2-devel] " Maciej Rabeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox