public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro
@ 2020-04-09 11:30 Laszlo Ersek
  2020-04-09 13:08 ` Ard Biesheuvel
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Laszlo Ersek @ 2020-04-09 11:30 UTC (permalink / raw)
  To: edk2-devel-groups-io
  Cc: Ard Biesheuvel, Hao A Wu, Jian J Wang,
	Philippe Mathieu-Daudé, Ray Ni

NonDiscoverablePciDeviceDxe currently #defines the module-internal
PCI_MAX_BARS macro, with value 6 (and type "int").

Remove this private macro definition, and adopt PCI_MAX_BAR from
"MdePkg/Include/IndustryStandard/Pci22.h". Both the value and the type
remain unchanged (the standard PCI_MAX_BAR macro expands to 0x0006).

"NonDiscoverablePciDeviceIo.h" gets the definition of PCI_MAX_BAR via its
existent #include <IndustryStandard/Pci.h> directive.

Build-tested only.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h | 2 --
 MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
index 15541c281153..3e6df3bebdd7 100644
--- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
+++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
@@ -36,8 +36,6 @@
 #define PCI_ID_VENDOR_UNKNOWN         0xffff
 #define PCI_ID_DEVICE_DONTCARE        0x0000
 
-#define PCI_MAX_BARS                  6
-
 extern EFI_CPU_ARCH_PROTOCOL      *mCpu;
 
 typedef struct {
diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
index c3e83003a01c..a40c1a959350 100644
--- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
+++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
@@ -1679,8 +1679,8 @@ InitializePciIoProtocol (
     ASSERT (Desc->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR);
     ASSERT (Desc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM);
 
-    if (Idx >= PCI_MAX_BARS ||
-        (Idx == PCI_MAX_BARS - 1 && Desc->AddrSpaceGranularity == 64)) {
+    if (Idx >= PCI_MAX_BAR ||
+        (Idx == PCI_MAX_BAR - 1 && Desc->AddrSpaceGranularity == 64)) {
       DEBUG ((DEBUG_ERROR,
         "%a: resource count exceeds number of emulated BARs\n",
         __FUNCTION__));
-- 
2.19.1.3.g30247aa5d201


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

* Re: [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro
  2020-04-09 11:30 [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro Laszlo Ersek
@ 2020-04-09 13:08 ` Ard Biesheuvel
  2020-04-15 11:55 ` Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2020-04-09 13:08 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel-groups-io
  Cc: Hao A Wu, Jian J Wang, Philippe Mathieu-Daudé, Ray Ni

On 4/9/20 1:30 PM, Laszlo Ersek wrote:
> NonDiscoverablePciDeviceDxe currently #defines the module-internal
> PCI_MAX_BARS macro, with value 6 (and type "int").
> 
> Remove this private macro definition, and adopt PCI_MAX_BAR from
> "MdePkg/Include/IndustryStandard/Pci22.h". Both the value and the type
> remain unchanged (the standard PCI_MAX_BAR macro expands to 0x0006).
> 
> "NonDiscoverablePciDeviceIo.h" gets the definition of PCI_MAX_BAR via its
> existent #include <IndustryStandard/Pci.h> directive.
> 
> Build-tested only.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>

> ---
>   MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h | 2 --
>   MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c | 4 ++--
>   2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> index 15541c281153..3e6df3bebdd7 100644
> --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> @@ -36,8 +36,6 @@
>   #define PCI_ID_VENDOR_UNKNOWN         0xffff
>   #define PCI_ID_DEVICE_DONTCARE        0x0000
>   
> -#define PCI_MAX_BARS                  6
> -
>   extern EFI_CPU_ARCH_PROTOCOL      *mCpu;
>   
>   typedef struct {
> diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> index c3e83003a01c..a40c1a959350 100644
> --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> @@ -1679,8 +1679,8 @@ InitializePciIoProtocol (
>       ASSERT (Desc->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR);
>       ASSERT (Desc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM);
>   
> -    if (Idx >= PCI_MAX_BARS ||
> -        (Idx == PCI_MAX_BARS - 1 && Desc->AddrSpaceGranularity == 64)) {
> +    if (Idx >= PCI_MAX_BAR ||
> +        (Idx == PCI_MAX_BAR - 1 && Desc->AddrSpaceGranularity == 64)) {
>         DEBUG ((DEBUG_ERROR,
>           "%a: resource count exceeds number of emulated BARs\n",
>           __FUNCTION__));
> 


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

* Re: [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro
  2020-04-09 11:30 [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro Laszlo Ersek
  2020-04-09 13:08 ` Ard Biesheuvel
@ 2020-04-15 11:55 ` Philippe Mathieu-Daudé
  2020-04-15 17:40 ` [edk2-devel] " Laszlo Ersek
  2020-04-16 20:54 ` Laszlo Ersek
  3 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-15 11:55 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel-groups-io
  Cc: Ard Biesheuvel, Hao A Wu, Jian J Wang, Ray Ni

On 4/9/20 1:30 PM, Laszlo Ersek wrote:
> NonDiscoverablePciDeviceDxe currently #defines the module-internal
> PCI_MAX_BARS macro, with value 6 (and type "int").
> 
> Remove this private macro definition, and adopt PCI_MAX_BAR from
> "MdePkg/Include/IndustryStandard/Pci22.h". Both the value and the type
> remain unchanged (the standard PCI_MAX_BAR macro expands to 0x0006).
> 
> "NonDiscoverablePciDeviceIo.h" gets the definition of PCI_MAX_BAR via its
> existent #include <IndustryStandard/Pci.h> directive.
> 
> Build-tested only.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>   MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h | 2 --
>   MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c | 4 ++--
>   2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> index 15541c281153..3e6df3bebdd7 100644
> --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> @@ -36,8 +36,6 @@
>   #define PCI_ID_VENDOR_UNKNOWN         0xffff
>   #define PCI_ID_DEVICE_DONTCARE        0x0000
>   
> -#define PCI_MAX_BARS                  6
> -
>   extern EFI_CPU_ARCH_PROTOCOL      *mCpu;
>   
>   typedef struct {
> diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> index c3e83003a01c..a40c1a959350 100644
> --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> @@ -1679,8 +1679,8 @@ InitializePciIoProtocol (
>       ASSERT (Desc->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR);
>       ASSERT (Desc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM);
>   
> -    if (Idx >= PCI_MAX_BARS ||
> -        (Idx == PCI_MAX_BARS - 1 && Desc->AddrSpaceGranularity == 64)) {
> +    if (Idx >= PCI_MAX_BAR ||
> +        (Idx == PCI_MAX_BAR - 1 && Desc->AddrSpaceGranularity == 64)) {
>         DEBUG ((DEBUG_ERROR,
>           "%a: resource count exceeds number of emulated BARs\n",
>           __FUNCTION__));
> 

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>


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

* Re: [edk2-devel] [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro
  2020-04-09 11:30 [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro Laszlo Ersek
  2020-04-09 13:08 ` Ard Biesheuvel
  2020-04-15 11:55 ` Philippe Mathieu-Daudé
@ 2020-04-15 17:40 ` Laszlo Ersek
  2020-04-16  1:36   ` Ni, Ray
  2020-04-16 20:54 ` Laszlo Ersek
  3 siblings, 1 reply; 6+ messages in thread
From: Laszlo Ersek @ 2020-04-15 17:40 UTC (permalink / raw)
  To: Hao A Wu, Jian J Wang, Ray Ni
  Cc: edk2-devel-groups-io, Ard Biesheuvel, Philippe Mathieu-Daudé

Hao, Jian, Ray:

can one of you please approve this patch?

Thanks
Laszlo

On 04/09/20 13:30, Laszlo Ersek wrote:
> NonDiscoverablePciDeviceDxe currently #defines the module-internal
> PCI_MAX_BARS macro, with value 6 (and type "int").
> 
> Remove this private macro definition, and adopt PCI_MAX_BAR from
> "MdePkg/Include/IndustryStandard/Pci22.h". Both the value and the type
> remain unchanged (the standard PCI_MAX_BAR macro expands to 0x0006).
> 
> "NonDiscoverablePciDeviceIo.h" gets the definition of PCI_MAX_BAR via its
> existent #include <IndustryStandard/Pci.h> directive.
> 
> Build-tested only.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h | 2 --
>  MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c | 4 ++--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> index 15541c281153..3e6df3bebdd7 100644
> --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> @@ -36,8 +36,6 @@
>  #define PCI_ID_VENDOR_UNKNOWN         0xffff
>  #define PCI_ID_DEVICE_DONTCARE        0x0000
>  
> -#define PCI_MAX_BARS                  6
> -
>  extern EFI_CPU_ARCH_PROTOCOL      *mCpu;
>  
>  typedef struct {
> diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> index c3e83003a01c..a40c1a959350 100644
> --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> @@ -1679,8 +1679,8 @@ InitializePciIoProtocol (
>      ASSERT (Desc->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR);
>      ASSERT (Desc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM);
>  
> -    if (Idx >= PCI_MAX_BARS ||
> -        (Idx == PCI_MAX_BARS - 1 && Desc->AddrSpaceGranularity == 64)) {
> +    if (Idx >= PCI_MAX_BAR ||
> +        (Idx == PCI_MAX_BAR - 1 && Desc->AddrSpaceGranularity == 64)) {
>        DEBUG ((DEBUG_ERROR,
>          "%a: resource count exceeds number of emulated BARs\n",
>          __FUNCTION__));
> 


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

* Re: [edk2-devel] [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro
  2020-04-15 17:40 ` [edk2-devel] " Laszlo Ersek
@ 2020-04-16  1:36   ` Ni, Ray
  0 siblings, 0 replies; 6+ messages in thread
From: Ni, Ray @ 2020-04-16  1:36 UTC (permalink / raw)
  To: devel@edk2.groups.io, lersek@redhat.com, Wu, Hao A, Wang, Jian J
  Cc: Ard Biesheuvel, Philippe Mathieu-Daudé

Reviewed-by: Ray Ni <ray.ni@intel.com>

> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Thursday, April 16, 2020 1:41 AM
> To: Wu, Hao A <hao.a.wu@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Ni, Ray <ray.ni@intel.com>
> Cc: edk2-devel-groups-io <devel@edk2.groups.io>; Ard Biesheuvel <ard.biesheuvel@arm.com>; Philippe Mathieu-Daudé
> <philmd@redhat.com>
> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro
> 
> Hao, Jian, Ray:
> 
> can one of you please approve this patch?
> 
> Thanks
> Laszlo
> 
> On 04/09/20 13:30, Laszlo Ersek wrote:
> > NonDiscoverablePciDeviceDxe currently #defines the module-internal
> > PCI_MAX_BARS macro, with value 6 (and type "int").
> >
> > Remove this private macro definition, and adopt PCI_MAX_BAR from
> > "MdePkg/Include/IndustryStandard/Pci22.h". Both the value and the type
> > remain unchanged (the standard PCI_MAX_BAR macro expands to 0x0006).
> >
> > "NonDiscoverablePciDeviceIo.h" gets the definition of PCI_MAX_BAR via its
> > existent #include <IndustryStandard/Pci.h> directive.
> >
> > Build-tested only.
> >
> > Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Jian J Wang <jian.j.wang@intel.com>
> > Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> > ---
> >  MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h | 2 --
> >  MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c | 4 ++--
> >  2 files changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> > index 15541c281153..3e6df3bebdd7 100644
> > --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> > +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> > @@ -36,8 +36,6 @@
> >  #define PCI_ID_VENDOR_UNKNOWN         0xffff
> >  #define PCI_ID_DEVICE_DONTCARE        0x0000
> >
> > -#define PCI_MAX_BARS                  6
> > -
> >  extern EFI_CPU_ARCH_PROTOCOL      *mCpu;
> >
> >  typedef struct {
> > diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> > index c3e83003a01c..a40c1a959350 100644
> > --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> > +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> > @@ -1679,8 +1679,8 @@ InitializePciIoProtocol (
> >      ASSERT (Desc->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR);
> >      ASSERT (Desc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM);
> >
> > -    if (Idx >= PCI_MAX_BARS ||
> > -        (Idx == PCI_MAX_BARS - 1 && Desc->AddrSpaceGranularity == 64)) {
> > +    if (Idx >= PCI_MAX_BAR ||
> > +        (Idx == PCI_MAX_BAR - 1 && Desc->AddrSpaceGranularity == 64)) {
> >        DEBUG ((DEBUG_ERROR,
> >          "%a: resource count exceeds number of emulated BARs\n",
> >          __FUNCTION__));
> >


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

* Re: [edk2-devel] [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro
  2020-04-09 11:30 [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro Laszlo Ersek
                   ` (2 preceding siblings ...)
  2020-04-15 17:40 ` [edk2-devel] " Laszlo Ersek
@ 2020-04-16 20:54 ` Laszlo Ersek
  3 siblings, 0 replies; 6+ messages in thread
From: Laszlo Ersek @ 2020-04-16 20:54 UTC (permalink / raw)
  To: Ard Biesheuvel, Philippe Mathieu-Daudé, Ray Ni
  Cc: edk2-devel-groups-io, Hao A Wu, Jian J Wang

On 04/09/20 13:30, Laszlo Ersek wrote:
> NonDiscoverablePciDeviceDxe currently #defines the module-internal
> PCI_MAX_BARS macro, with value 6 (and type "int").
> 
> Remove this private macro definition, and adopt PCI_MAX_BAR from
> "MdePkg/Include/IndustryStandard/Pci22.h". Both the value and the type
> remain unchanged (the standard PCI_MAX_BAR macro expands to 0x0006).
> 
> "NonDiscoverablePciDeviceIo.h" gets the definition of PCI_MAX_BAR via its
> existent #include <IndustryStandard/Pci.h> directive.
> 
> Build-tested only.
> 
> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>  MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h | 2 --
>  MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c | 4 ++--
>  2 files changed, 2 insertions(+), 4 deletions(-)

Pushed as commit a7947b6366a6, via
<https://github.com/tianocore/edk2/pull/520>.

Thanks!
Laszlo

> 
> diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> index 15541c281153..3e6df3bebdd7 100644
> --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.h
> @@ -36,8 +36,6 @@
>  #define PCI_ID_VENDOR_UNKNOWN         0xffff
>  #define PCI_ID_DEVICE_DONTCARE        0x0000
>  
> -#define PCI_MAX_BARS                  6
> -
>  extern EFI_CPU_ARCH_PROTOCOL      *mCpu;
>  
>  typedef struct {
> diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> index c3e83003a01c..a40c1a959350 100644
> --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c
> @@ -1679,8 +1679,8 @@ InitializePciIoProtocol (
>      ASSERT (Desc->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR);
>      ASSERT (Desc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM);
>  
> -    if (Idx >= PCI_MAX_BARS ||
> -        (Idx == PCI_MAX_BARS - 1 && Desc->AddrSpaceGranularity == 64)) {
> +    if (Idx >= PCI_MAX_BAR ||
> +        (Idx == PCI_MAX_BAR - 1 && Desc->AddrSpaceGranularity == 64)) {
>        DEBUG ((DEBUG_ERROR,
>          "%a: resource count exceeds number of emulated BARs\n",
>          __FUNCTION__));
> 


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

end of thread, other threads:[~2020-04-16 20:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-09 11:30 [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro Laszlo Ersek
2020-04-09 13:08 ` Ard Biesheuvel
2020-04-15 11:55 ` Philippe Mathieu-Daudé
2020-04-15 17:40 ` [edk2-devel] " Laszlo Ersek
2020-04-16  1:36   ` Ni, Ray
2020-04-16 20:54 ` Laszlo Ersek

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