[edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice: Do not use deprecated macros

Ruiyu Ni posted 6 patches 7 years, 8 months ago
There is a newer version of this series
[edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice: Do not use deprecated macros
Posted by Ruiyu Ni 7 years, 8 months ago
The patch replaces the following macros:
DEVICE_ID_NOCARE (0xFF) --> (UINT64)-1
PCI_ACPI_UNUSED (0) --> 0
PCI_BAR_ALL (0xFF) --> (UINT64)-1
PCI_BAR_NOCHANGE (0) --> 0
PCI_BAR_EVEN_ALIGN --> EVEN_ALIGN (local definition)

Since the PciBus driver was updated to accept Spec defined values
in previous commit, the above replacements don't impact
functionality.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
---
 .../IncompatiblePciDeviceSupport.c                 | 108 ++++++++++-----------
 1 file changed, 53 insertions(+), 55 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
index 3d581b6..5a6a052 100644
--- a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
@@ -1,11 +1,11 @@
 /** @file
   This module is one template module for Incompatible PCI Device Support protocol.
-  It includes one incompatile pci devices list template.
+  It includes one incompatible pci devices list template.
   
   Incompatible PCI Device Support protocol allows the PCI bus driver to support
   resource allocation for some PCI devices that do not comply with the PCI Specification.
 
-Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -48,13 +48,11 @@ typedef struct {
 #define PCI_DEVICE_ID(VendorId, DeviceId, Revision, SubVendorId, SubDeviceId) \
     VendorId, DeviceId, Revision, SubVendorId, SubDeviceId
 
-#define PCI_BAR_TYPE_IO   ACPI_ADDRESS_SPACE_TYPE_IO
-#define PCI_BAR_TYPE_MEM  ACPI_ADDRESS_SPACE_TYPE_MEM
-
 #define DEVICE_INF_TAG    0xFFF2
 #define DEVICE_RES_TAG    0xFFF1
 #define LIST_END_TAG      0x0000
 
+#define EVEN_ALIGN        0xFFFFFFFFFFFFFFFEULL
 
 /**
   Returns a list of ACPI resource descriptors that detail the special
@@ -114,72 +112,72 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 mIncompatiblePciDeviceList[] = {
   // Device Adaptec 9004
   //
   DEVICE_INF_TAG,
-  PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
+  PCI_DEVICE_ID(0x9004, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
   DEVICE_RES_TAG,
-  PCI_BAR_TYPE_IO,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_BAR_EVEN_ALIGN,
-  PCI_BAR_ALL,
-  PCI_BAR_NOCHANGE,
+  ACPI_ADDRESS_SPACE_TYPE_IO,
+  0,
+  0,
+  0,
+  0,
+  EVEN_ALIGN,
+  (UINT64)-1,
+  0,
   //
   // Device Adaptec 9005
   //
   DEVICE_INF_TAG,
-  PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
+  PCI_DEVICE_ID(0x9005, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
   DEVICE_RES_TAG,
-  PCI_BAR_TYPE_IO,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_BAR_EVEN_ALIGN,
-  PCI_BAR_ALL,
-  PCI_BAR_NOCHANGE,
+  ACPI_ADDRESS_SPACE_TYPE_IO,
+  0,
+  0,
+  0,
+  0,
+  EVEN_ALIGN,
+  (UINT64)-1,
+  0,
   //
   // Device QLogic  1007
   //
   DEVICE_INF_TAG,
-  PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
+  PCI_DEVICE_ID(0x1077, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
   DEVICE_RES_TAG,
-  PCI_BAR_TYPE_IO,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_BAR_EVEN_ALIGN,
-  PCI_BAR_ALL,
-  PCI_BAR_NOCHANGE,
+  ACPI_ADDRESS_SPACE_TYPE_IO,
+  0,
+  0,
+  0,
+  0,
+  EVEN_ALIGN,
+  (UINT64)-1,
+  0,
   //
   // Device Agilent 103C
   //
   DEVICE_INF_TAG,
-  PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
+  PCI_DEVICE_ID(0x103C, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
   DEVICE_RES_TAG,
-  PCI_BAR_TYPE_IO,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_BAR_EVEN_ALIGN,
-  PCI_BAR_ALL,
-  PCI_BAR_NOCHANGE,
+  ACPI_ADDRESS_SPACE_TYPE_IO,
+  0,
+  0,
+  0,
+  0,
+  EVEN_ALIGN,
+  (UINT64)-1,
+  0,
   //
   // Device Agilent 15BC
   //
   DEVICE_INF_TAG,
-  PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
+  PCI_DEVICE_ID(0x15BC, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
   DEVICE_RES_TAG,
-  PCI_BAR_TYPE_IO,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_ACPI_UNUSED,
-  PCI_BAR_EVEN_ALIGN,
-  PCI_BAR_ALL,
-  PCI_BAR_NOCHANGE,
+  ACPI_ADDRESS_SPACE_TYPE_IO,
+  0,
+  0,
+  0,
+  0,
+  EVEN_ALIGN,
+  (UINT64)-1,
+  0,
   //
   // The end of the list
   //
@@ -285,31 +283,31 @@ PCheckDevice (
       //
       // See if the Header matches the parameters passed in
       //
-      if (Header->VendorId != DEVICE_ID_NOCARE) {
+      if (Header->VendorId != (UINT64)-1) {
         if (Header->VendorId != VendorId) {
           continue;
         }
       }
 
-      if (Header->DeviceId != DEVICE_ID_NOCARE) {
+      if (Header->DeviceId != (UINT64)-1) {
         if (DeviceId != Header->DeviceId) {
           continue;
         }
       }
 
-      if (Header->RevisionId != DEVICE_ID_NOCARE) {
+      if (Header->RevisionId != (UINT64)-1) {
         if (RevisionId != Header->RevisionId) {
           continue;
         }
       }
 
-      if (Header->SubsystemVendorId != DEVICE_ID_NOCARE) {
+      if (Header->SubsystemVendorId != (UINT64)-1) {
         if (SubsystemVendorId != Header->SubsystemVendorId) {
           continue;
         }
       }
 
-      if (Header->SubsystemDeviceId != DEVICE_ID_NOCARE) {
+      if (Header->SubsystemDeviceId != (UINT64)-1) {
         if (SubsystemDeviceId != Header->SubsystemDeviceId) {
           continue;
         }
-- 
2.9.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice: Do not use deprecated macros
Posted by Kinney, Michael D 7 years, 8 months ago
Ray,

Can we use MAX_UINT64 instead of (UINT64)-1?

Thanks,

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ruiyu Ni
> Sent: Sunday, February 5, 2017 10:01 PM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng <feng.tian@intel.com>; Fan, Jeff <jeff.fan@intel.com>
> Subject: [edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice: Do not use
> deprecated macros
> 
> The patch replaces the following macros:
> DEVICE_ID_NOCARE (0xFF) --> (UINT64)-1
> PCI_ACPI_UNUSED (0) --> 0
> PCI_BAR_ALL (0xFF) --> (UINT64)-1
> PCI_BAR_NOCHANGE (0) --> 0
> PCI_BAR_EVEN_ALIGN --> EVEN_ALIGN (local definition)
> 
> Since the PciBus driver was updated to accept Spec defined values
> in previous commit, the above replacements don't impact
> functionality.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jeff Fan <jeff.fan@intel.com>
> Cc: Feng Tian <feng.tian@intel.com>
> ---
>  .../IncompatiblePciDeviceSupport.c                 | 108 ++++++++++-----------
>  1 file changed, 53 insertions(+), 55 deletions(-)
> 
> diff --git
> a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
> b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
> index 3d581b6..5a6a052 100644
> ---
> a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
> +++
> b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
> @@ -1,11 +1,11 @@
>  /** @file
>    This module is one template module for Incompatible PCI Device Support protocol.
> -  It includes one incompatile pci devices list template.
> +  It includes one incompatible pci devices list template.
> 
>    Incompatible PCI Device Support protocol allows the PCI bus driver to support
>    resource allocation for some PCI devices that do not comply with the PCI
> Specification.
> 
> -Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD License
>  which accompanies this distribution.  The full text of the license may be found at
> @@ -48,13 +48,11 @@ typedef struct {
>  #define PCI_DEVICE_ID(VendorId, DeviceId, Revision, SubVendorId, SubDeviceId) \
>      VendorId, DeviceId, Revision, SubVendorId, SubDeviceId
> 
> -#define PCI_BAR_TYPE_IO   ACPI_ADDRESS_SPACE_TYPE_IO
> -#define PCI_BAR_TYPE_MEM  ACPI_ADDRESS_SPACE_TYPE_MEM
> -
>  #define DEVICE_INF_TAG    0xFFF2
>  #define DEVICE_RES_TAG    0xFFF1
>  #define LIST_END_TAG      0x0000
> 
> +#define EVEN_ALIGN        0xFFFFFFFFFFFFFFFEULL
> 
>  /**
>    Returns a list of ACPI resource descriptors that detail the special
> @@ -114,72 +112,72 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64
> mIncompatiblePciDeviceList[] = {
>    // Device Adaptec 9004
>    //
>    DEVICE_INF_TAG,
> -  PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> DEVICE_ID_NOCARE),
> +  PCI_DEVICE_ID(0x9004, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
>    DEVICE_RES_TAG,
> -  PCI_BAR_TYPE_IO,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_BAR_EVEN_ALIGN,
> -  PCI_BAR_ALL,
> -  PCI_BAR_NOCHANGE,
> +  ACPI_ADDRESS_SPACE_TYPE_IO,
> +  0,
> +  0,
> +  0,
> +  0,
> +  EVEN_ALIGN,
> +  (UINT64)-1,
> +  0,
>    //
>    // Device Adaptec 9005
>    //
>    DEVICE_INF_TAG,
> -  PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> DEVICE_ID_NOCARE),
> +  PCI_DEVICE_ID(0x9005, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
>    DEVICE_RES_TAG,
> -  PCI_BAR_TYPE_IO,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_BAR_EVEN_ALIGN,
> -  PCI_BAR_ALL,
> -  PCI_BAR_NOCHANGE,
> +  ACPI_ADDRESS_SPACE_TYPE_IO,
> +  0,
> +  0,
> +  0,
> +  0,
> +  EVEN_ALIGN,
> +  (UINT64)-1,
> +  0,
>    //
>    // Device QLogic  1007
>    //
>    DEVICE_INF_TAG,
> -  PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> DEVICE_ID_NOCARE),
> +  PCI_DEVICE_ID(0x1077, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
>    DEVICE_RES_TAG,
> -  PCI_BAR_TYPE_IO,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_BAR_EVEN_ALIGN,
> -  PCI_BAR_ALL,
> -  PCI_BAR_NOCHANGE,
> +  ACPI_ADDRESS_SPACE_TYPE_IO,
> +  0,
> +  0,
> +  0,
> +  0,
> +  EVEN_ALIGN,
> +  (UINT64)-1,
> +  0,
>    //
>    // Device Agilent 103C
>    //
>    DEVICE_INF_TAG,
> -  PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> DEVICE_ID_NOCARE),
> +  PCI_DEVICE_ID(0x103C, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
>    DEVICE_RES_TAG,
> -  PCI_BAR_TYPE_IO,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_BAR_EVEN_ALIGN,
> -  PCI_BAR_ALL,
> -  PCI_BAR_NOCHANGE,
> +  ACPI_ADDRESS_SPACE_TYPE_IO,
> +  0,
> +  0,
> +  0,
> +  0,
> +  EVEN_ALIGN,
> +  (UINT64)-1,
> +  0,
>    //
>    // Device Agilent 15BC
>    //
>    DEVICE_INF_TAG,
> -  PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> DEVICE_ID_NOCARE),
> +  PCI_DEVICE_ID(0x15BC, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
>    DEVICE_RES_TAG,
> -  PCI_BAR_TYPE_IO,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_ACPI_UNUSED,
> -  PCI_BAR_EVEN_ALIGN,
> -  PCI_BAR_ALL,
> -  PCI_BAR_NOCHANGE,
> +  ACPI_ADDRESS_SPACE_TYPE_IO,
> +  0,
> +  0,
> +  0,
> +  0,
> +  EVEN_ALIGN,
> +  (UINT64)-1,
> +  0,
>    //
>    // The end of the list
>    //
> @@ -285,31 +283,31 @@ PCheckDevice (
>        //
>        // See if the Header matches the parameters passed in
>        //
> -      if (Header->VendorId != DEVICE_ID_NOCARE) {
> +      if (Header->VendorId != (UINT64)-1) {
>          if (Header->VendorId != VendorId) {
>            continue;
>          }
>        }
> 
> -      if (Header->DeviceId != DEVICE_ID_NOCARE) {
> +      if (Header->DeviceId != (UINT64)-1) {
>          if (DeviceId != Header->DeviceId) {
>            continue;
>          }
>        }
> 
> -      if (Header->RevisionId != DEVICE_ID_NOCARE) {
> +      if (Header->RevisionId != (UINT64)-1) {
>          if (RevisionId != Header->RevisionId) {
>            continue;
>          }
>        }
> 
> -      if (Header->SubsystemVendorId != DEVICE_ID_NOCARE) {
> +      if (Header->SubsystemVendorId != (UINT64)-1) {
>          if (SubsystemVendorId != Header->SubsystemVendorId) {
>            continue;
>          }
>        }
> 
> -      if (Header->SubsystemDeviceId != DEVICE_ID_NOCARE) {
> +      if (Header->SubsystemDeviceId != (UINT64)-1) {
>          if (SubsystemDeviceId != Header->SubsystemDeviceId) {
>            continue;
>          }
> --
> 2.9.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice: Do not use deprecated macros
Posted by Kinney, Michael D 7 years, 8 months ago
Ray,

As a follow up, I do see the PI Specification using (UINTN)-1 and (UINT64)-1.

I think the intent is unsigned values with all bits set, which is what the 
MAX_UINTx macros provide in the EDK II without depending on type casting a
signed value to an unsigned value.

Mike

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Monday, February 6, 2017 9:41 AM
> To: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Cc: Tian, Feng <feng.tian@intel.com>; Fan, Jeff <jeff.fan@intel.com>
> Subject: RE: [edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice: Do not use
> deprecated macros
> 
> Ray,
> 
> Can we use MAX_UINT64 instead of (UINT64)-1?
> 
> Thanks,
> 
> Mike
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ruiyu Ni
> > Sent: Sunday, February 5, 2017 10:01 PM
> > To: edk2-devel@lists.01.org
> > Cc: Tian, Feng <feng.tian@intel.com>; Fan, Jeff <jeff.fan@intel.com>
> > Subject: [edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice: Do not use
> > deprecated macros
> >
> > The patch replaces the following macros:
> > DEVICE_ID_NOCARE (0xFF) --> (UINT64)-1
> > PCI_ACPI_UNUSED (0) --> 0
> > PCI_BAR_ALL (0xFF) --> (UINT64)-1
> > PCI_BAR_NOCHANGE (0) --> 0
> > PCI_BAR_EVEN_ALIGN --> EVEN_ALIGN (local definition)
> >
> > Since the PciBus driver was updated to accept Spec defined values
> > in previous commit, the above replacements don't impact
> > functionality.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> > Cc: Jeff Fan <jeff.fan@intel.com>
> > Cc: Feng Tian <feng.tian@intel.com>
> > ---
> >  .../IncompatiblePciDeviceSupport.c                 | 108 ++++++++++-----------
> >  1 file changed, 53 insertions(+), 55 deletions(-)
> >
> > diff --git
> >
> a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
> >
> b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
> > index 3d581b6..5a6a052 100644
> > ---
> >
> a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
> > +++
> >
> b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
> > @@ -1,11 +1,11 @@
> >  /** @file
> >    This module is one template module for Incompatible PCI Device Support protocol.
> > -  It includes one incompatile pci devices list template.
> > +  It includes one incompatible pci devices list template.
> >
> >    Incompatible PCI Device Support protocol allows the PCI bus driver to support
> >    resource allocation for some PCI devices that do not comply with the PCI
> > Specification.
> >
> > -Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
> > +Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
> >  This program and the accompanying materials
> >  are licensed and made available under the terms and conditions of the BSD License
> >  which accompanies this distribution.  The full text of the license may be found at
> > @@ -48,13 +48,11 @@ typedef struct {
> >  #define PCI_DEVICE_ID(VendorId, DeviceId, Revision, SubVendorId, SubDeviceId) \
> >      VendorId, DeviceId, Revision, SubVendorId, SubDeviceId
> >
> > -#define PCI_BAR_TYPE_IO   ACPI_ADDRESS_SPACE_TYPE_IO
> > -#define PCI_BAR_TYPE_MEM  ACPI_ADDRESS_SPACE_TYPE_MEM
> > -
> >  #define DEVICE_INF_TAG    0xFFF2
> >  #define DEVICE_RES_TAG    0xFFF1
> >  #define LIST_END_TAG      0x0000
> >
> > +#define EVEN_ALIGN        0xFFFFFFFFFFFFFFFEULL
> >
> >  /**
> >    Returns a list of ACPI resource descriptors that detail the special
> > @@ -114,72 +112,72 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64
> > mIncompatiblePciDeviceList[] = {
> >    // Device Adaptec 9004
> >    //
> >    DEVICE_INF_TAG,
> > -  PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> > DEVICE_ID_NOCARE),
> > +  PCI_DEVICE_ID(0x9004, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
> >    DEVICE_RES_TAG,
> > -  PCI_BAR_TYPE_IO,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_BAR_EVEN_ALIGN,
> > -  PCI_BAR_ALL,
> > -  PCI_BAR_NOCHANGE,
> > +  ACPI_ADDRESS_SPACE_TYPE_IO,
> > +  0,
> > +  0,
> > +  0,
> > +  0,
> > +  EVEN_ALIGN,
> > +  (UINT64)-1,
> > +  0,
> >    //
> >    // Device Adaptec 9005
> >    //
> >    DEVICE_INF_TAG,
> > -  PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> > DEVICE_ID_NOCARE),
> > +  PCI_DEVICE_ID(0x9005, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
> >    DEVICE_RES_TAG,
> > -  PCI_BAR_TYPE_IO,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_BAR_EVEN_ALIGN,
> > -  PCI_BAR_ALL,
> > -  PCI_BAR_NOCHANGE,
> > +  ACPI_ADDRESS_SPACE_TYPE_IO,
> > +  0,
> > +  0,
> > +  0,
> > +  0,
> > +  EVEN_ALIGN,
> > +  (UINT64)-1,
> > +  0,
> >    //
> >    // Device QLogic  1007
> >    //
> >    DEVICE_INF_TAG,
> > -  PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> > DEVICE_ID_NOCARE),
> > +  PCI_DEVICE_ID(0x1077, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
> >    DEVICE_RES_TAG,
> > -  PCI_BAR_TYPE_IO,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_BAR_EVEN_ALIGN,
> > -  PCI_BAR_ALL,
> > -  PCI_BAR_NOCHANGE,
> > +  ACPI_ADDRESS_SPACE_TYPE_IO,
> > +  0,
> > +  0,
> > +  0,
> > +  0,
> > +  EVEN_ALIGN,
> > +  (UINT64)-1,
> > +  0,
> >    //
> >    // Device Agilent 103C
> >    //
> >    DEVICE_INF_TAG,
> > -  PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> > DEVICE_ID_NOCARE),
> > +  PCI_DEVICE_ID(0x103C, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
> >    DEVICE_RES_TAG,
> > -  PCI_BAR_TYPE_IO,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_BAR_EVEN_ALIGN,
> > -  PCI_BAR_ALL,
> > -  PCI_BAR_NOCHANGE,
> > +  ACPI_ADDRESS_SPACE_TYPE_IO,
> > +  0,
> > +  0,
> > +  0,
> > +  0,
> > +  EVEN_ALIGN,
> > +  (UINT64)-1,
> > +  0,
> >    //
> >    // Device Agilent 15BC
> >    //
> >    DEVICE_INF_TAG,
> > -  PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> > DEVICE_ID_NOCARE),
> > +  PCI_DEVICE_ID(0x15BC, (UINT64)-1, (UINT64)-1, (UINT64)-1, (UINT64)-1),
> >    DEVICE_RES_TAG,
> > -  PCI_BAR_TYPE_IO,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_ACPI_UNUSED,
> > -  PCI_BAR_EVEN_ALIGN,
> > -  PCI_BAR_ALL,
> > -  PCI_BAR_NOCHANGE,
> > +  ACPI_ADDRESS_SPACE_TYPE_IO,
> > +  0,
> > +  0,
> > +  0,
> > +  0,
> > +  EVEN_ALIGN,
> > +  (UINT64)-1,
> > +  0,
> >    //
> >    // The end of the list
> >    //
> > @@ -285,31 +283,31 @@ PCheckDevice (
> >        //
> >        // See if the Header matches the parameters passed in
> >        //
> > -      if (Header->VendorId != DEVICE_ID_NOCARE) {
> > +      if (Header->VendorId != (UINT64)-1) {
> >          if (Header->VendorId != VendorId) {
> >            continue;
> >          }
> >        }
> >
> > -      if (Header->DeviceId != DEVICE_ID_NOCARE) {
> > +      if (Header->DeviceId != (UINT64)-1) {
> >          if (DeviceId != Header->DeviceId) {
> >            continue;
> >          }
> >        }
> >
> > -      if (Header->RevisionId != DEVICE_ID_NOCARE) {
> > +      if (Header->RevisionId != (UINT64)-1) {
> >          if (RevisionId != Header->RevisionId) {
> >            continue;
> >          }
> >        }
> >
> > -      if (Header->SubsystemVendorId != DEVICE_ID_NOCARE) {
> > +      if (Header->SubsystemVendorId != (UINT64)-1) {
> >          if (SubsystemVendorId != Header->SubsystemVendorId) {
> >            continue;
> >          }
> >        }
> >
> > -      if (Header->SubsystemDeviceId != DEVICE_ID_NOCARE) {
> > +      if (Header->SubsystemDeviceId != (UINT64)-1) {
> >          if (SubsystemDeviceId != Header->SubsystemDeviceId) {
> >            continue;
> >          }
> > --
> > 2.9.0.windows.1
> >
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice: Do not use deprecated macros
Posted by Ni, Ruiyu 7 years, 8 months ago
Mike,
OK I will change to MAX_UINT64.

Thanks/Ray

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Tuesday, February 7, 2017 1:55 AM
> To: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org; Kinney, Michael
> D <michael.d.kinney@intel.com>
> Cc: Tian, Feng <feng.tian@intel.com>; Fan, Jeff <jeff.fan@intel.com>
> Subject: RE: [edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice:
> Do not use deprecated macros
> 
> Ray,
> 
> As a follow up, I do see the PI Specification using (UINTN)-1 and (UINT64)-1.
> 
> I think the intent is unsigned values with all bits set, which is what the
> MAX_UINTx macros provide in the EDK II without depending on type casting
> a signed value to an unsigned value.
> 
> Mike
> 
> > -----Original Message-----
> > From: Kinney, Michael D
> > Sent: Monday, February 6, 2017 9:41 AM
> > To: Ni, Ruiyu <ruiyu.ni@intel.com>; edk2-devel@lists.01.org; Kinney,
> > Michael D <michael.d.kinney@intel.com>
> > Cc: Tian, Feng <feng.tian@intel.com>; Fan, Jeff <jeff.fan@intel.com>
> > Subject: RE: [edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice:
> > Do not use deprecated macros
> >
> > Ray,
> >
> > Can we use MAX_UINT64 instead of (UINT64)-1?
> >
> > Thanks,
> >
> > Mike
> >
> > > -----Original Message-----
> > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf
> > > Of Ruiyu Ni
> > > Sent: Sunday, February 5, 2017 10:01 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Tian, Feng <feng.tian@intel.com>; Fan, Jeff <jeff.fan@intel.com>
> > > Subject: [edk2] [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice:
> > > Do not use deprecated macros
> > >
> > > The patch replaces the following macros:
> > > DEVICE_ID_NOCARE (0xFF) --> (UINT64)-1 PCI_ACPI_UNUSED (0) --> 0
> > > PCI_BAR_ALL (0xFF) --> (UINT64)-1 PCI_BAR_NOCHANGE (0) --> 0
> > > PCI_BAR_EVEN_ALIGN --> EVEN_ALIGN (local definition)
> > >
> > > Since the PciBus driver was updated to accept Spec defined values in
> > > previous commit, the above replacements don't impact functionality.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> > > Cc: Jeff Fan <jeff.fan@intel.com>
> > > Cc: Feng Tian <feng.tian@intel.com>
> > > ---
> > >  .../IncompatiblePciDeviceSupport.c                 | 108 ++++++++++-----------
> > >  1 file changed, 53 insertions(+), 55 deletions(-)
> > >
> > > diff --git
> > >
> >
> a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/Incompatible
> Pci
> > DeviceSupport.c
> > >
> >
> b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/Incompatible
> Pci
> > DeviceSupport.c
> > > index 3d581b6..5a6a052 100644
> > > ---
> > >
> >
> a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/Incompatible
> Pci
> > DeviceSupport.c
> > > +++
> > >
> >
> b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/Incompatible
> Pci
> > DeviceSupport.c
> > > @@ -1,11 +1,11 @@
> > >  /** @file
> > >    This module is one template module for Incompatible PCI Device
> Support protocol.
> > > -  It includes one incompatile pci devices list template.
> > > +  It includes one incompatible pci devices list template.
> > >
> > >    Incompatible PCI Device Support protocol allows the PCI bus driver to
> support
> > >    resource allocation for some PCI devices that do not comply with
> > > the PCI Specification.
> > >
> > > -Copyright (c) 2009, Intel Corporation. All rights reserved.<BR>
> > > +Copyright (c) 2009 - 2017, Intel Corporation. All rights
> > > +reserved.<BR>
> > >  This program and the accompanying materials  are licensed and made
> > > available under the terms and conditions of the BSD License  which
> > > accompanies this distribution.  The full text of the license may be
> > > found at @@ -48,13 +48,11 @@ typedef struct {  #define
> > > PCI_DEVICE_ID(VendorId, DeviceId, Revision, SubVendorId, SubDeviceId)
> \
> > >      VendorId, DeviceId, Revision, SubVendorId, SubDeviceId
> > >
> > > -#define PCI_BAR_TYPE_IO   ACPI_ADDRESS_SPACE_TYPE_IO
> > > -#define PCI_BAR_TYPE_MEM  ACPI_ADDRESS_SPACE_TYPE_MEM
> > > -
> > >  #define DEVICE_INF_TAG    0xFFF2
> > >  #define DEVICE_RES_TAG    0xFFF1
> > >  #define LIST_END_TAG      0x0000
> > >
> > > +#define EVEN_ALIGN        0xFFFFFFFFFFFFFFFEULL
> > >
> > >  /**
> > >    Returns a list of ACPI resource descriptors that detail the
> > > special @@ -114,72 +112,72 @@ GLOBAL_REMOVE_IF_UNREFERENCED
> UINT64
> > > mIncompatiblePciDeviceList[] = {
> > >    // Device Adaptec 9004
> > >    //
> > >    DEVICE_INF_TAG,
> > > -  PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> > > DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
> > > +  PCI_DEVICE_ID(0x9004, (UINT64)-1, (UINT64)-1, (UINT64)-1,
> > > + (UINT64)-1),
> > >    DEVICE_RES_TAG,
> > > -  PCI_BAR_TYPE_IO,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_BAR_EVEN_ALIGN,
> > > -  PCI_BAR_ALL,
> > > -  PCI_BAR_NOCHANGE,
> > > +  ACPI_ADDRESS_SPACE_TYPE_IO,
> > > +  0,
> > > +  0,
> > > +  0,
> > > +  0,
> > > +  EVEN_ALIGN,
> > > +  (UINT64)-1,
> > > +  0,
> > >    //
> > >    // Device Adaptec 9005
> > >    //
> > >    DEVICE_INF_TAG,
> > > -  PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> > > DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
> > > +  PCI_DEVICE_ID(0x9005, (UINT64)-1, (UINT64)-1, (UINT64)-1,
> > > + (UINT64)-1),
> > >    DEVICE_RES_TAG,
> > > -  PCI_BAR_TYPE_IO,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_BAR_EVEN_ALIGN,
> > > -  PCI_BAR_ALL,
> > > -  PCI_BAR_NOCHANGE,
> > > +  ACPI_ADDRESS_SPACE_TYPE_IO,
> > > +  0,
> > > +  0,
> > > +  0,
> > > +  0,
> > > +  EVEN_ALIGN,
> > > +  (UINT64)-1,
> > > +  0,
> > >    //
> > >    // Device QLogic  1007
> > >    //
> > >    DEVICE_INF_TAG,
> > > -  PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> > > DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
> > > +  PCI_DEVICE_ID(0x1077, (UINT64)-1, (UINT64)-1, (UINT64)-1,
> > > + (UINT64)-1),
> > >    DEVICE_RES_TAG,
> > > -  PCI_BAR_TYPE_IO,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_BAR_EVEN_ALIGN,
> > > -  PCI_BAR_ALL,
> > > -  PCI_BAR_NOCHANGE,
> > > +  ACPI_ADDRESS_SPACE_TYPE_IO,
> > > +  0,
> > > +  0,
> > > +  0,
> > > +  0,
> > > +  EVEN_ALIGN,
> > > +  (UINT64)-1,
> > > +  0,
> > >    //
> > >    // Device Agilent 103C
> > >    //
> > >    DEVICE_INF_TAG,
> > > -  PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> > > DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
> > > +  PCI_DEVICE_ID(0x103C, (UINT64)-1, (UINT64)-1, (UINT64)-1,
> > > + (UINT64)-1),
> > >    DEVICE_RES_TAG,
> > > -  PCI_BAR_TYPE_IO,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_BAR_EVEN_ALIGN,
> > > -  PCI_BAR_ALL,
> > > -  PCI_BAR_NOCHANGE,
> > > +  ACPI_ADDRESS_SPACE_TYPE_IO,
> > > +  0,
> > > +  0,
> > > +  0,
> > > +  0,
> > > +  EVEN_ALIGN,
> > > +  (UINT64)-1,
> > > +  0,
> > >    //
> > >    // Device Agilent 15BC
> > >    //
> > >    DEVICE_INF_TAG,
> > > -  PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE,
> > > DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
> > > +  PCI_DEVICE_ID(0x15BC, (UINT64)-1, (UINT64)-1, (UINT64)-1,
> > > + (UINT64)-1),
> > >    DEVICE_RES_TAG,
> > > -  PCI_BAR_TYPE_IO,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_ACPI_UNUSED,
> > > -  PCI_BAR_EVEN_ALIGN,
> > > -  PCI_BAR_ALL,
> > > -  PCI_BAR_NOCHANGE,
> > > +  ACPI_ADDRESS_SPACE_TYPE_IO,
> > > +  0,
> > > +  0,
> > > +  0,
> > > +  0,
> > > +  EVEN_ALIGN,
> > > +  (UINT64)-1,
> > > +  0,
> > >    //
> > >    // The end of the list
> > >    //
> > > @@ -285,31 +283,31 @@ PCheckDevice (
> > >        //
> > >        // See if the Header matches the parameters passed in
> > >        //
> > > -      if (Header->VendorId != DEVICE_ID_NOCARE) {
> > > +      if (Header->VendorId != (UINT64)-1) {
> > >          if (Header->VendorId != VendorId) {
> > >            continue;
> > >          }
> > >        }
> > >
> > > -      if (Header->DeviceId != DEVICE_ID_NOCARE) {
> > > +      if (Header->DeviceId != (UINT64)-1) {
> > >          if (DeviceId != Header->DeviceId) {
> > >            continue;
> > >          }
> > >        }
> > >
> > > -      if (Header->RevisionId != DEVICE_ID_NOCARE) {
> > > +      if (Header->RevisionId != (UINT64)-1) {
> > >          if (RevisionId != Header->RevisionId) {
> > >            continue;
> > >          }
> > >        }
> > >
> > > -      if (Header->SubsystemVendorId != DEVICE_ID_NOCARE) {
> > > +      if (Header->SubsystemVendorId != (UINT64)-1) {
> > >          if (SubsystemVendorId != Header->SubsystemVendorId) {
> > >            continue;
> > >          }
> > >        }
> > >
> > > -      if (Header->SubsystemDeviceId != DEVICE_ID_NOCARE) {
> > > +      if (Header->SubsystemDeviceId != (UINT64)-1) {
> > >          if (SubsystemDeviceId != Header->SubsystemDeviceId) {
> > >            continue;
> > >          }
> > > --
> > > 2.9.0.windows.1
> > >
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel