[edk2] [PATCH v2 4/6] MdeModulePkg/IncompatiblePci: Use -1 to match any IDs

Ruiyu Ni posted 6 patches 7 years, 8 months ago
There is a newer version of this series
[edk2] [PATCH v2 4/6] MdeModulePkg/IncompatiblePci: Use -1 to match any IDs
Posted by Ruiyu Ni 7 years, 8 months ago
When the VendorId/DeviceId/RevisionId/SubsystemVendorId
/SubsystemDeviceId is (UINT64)-1, IncompatiblePciDeviceSupport
driver doesn't use it to match any IDs.
The patch fixes this bug.
Since PciBus driver always calls IncompatiblePciDeviceSupport
using IDs read from HW, (UINT64)-1 is never passed to this
driver.

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                             | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
index 5a6a052..6a26013 100644
--- a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
@@ -283,31 +283,31 @@ PCheckDevice (
       //
       // See if the Header matches the parameters passed in
       //
-      if (Header->VendorId != (UINT64)-1) {
+      if ((Header->VendorId != (UINT64)-1) && (VendorId != (UINT64)-1)) {
         if (Header->VendorId != VendorId) {
           continue;
         }
       }
 
-      if (Header->DeviceId != (UINT64)-1) {
+      if ((Header->DeviceId != (UINT64)-1) && (DeviceId != (UINT64) -1)) {
         if (DeviceId != Header->DeviceId) {
           continue;
         }
       }
 
-      if (Header->RevisionId != (UINT64)-1) {
+      if ((Header->RevisionId != (UINT64)-1) && (RevisionId != (UINT64) -1)) {
         if (RevisionId != Header->RevisionId) {
           continue;
         }
       }
 
-      if (Header->SubsystemVendorId != (UINT64)-1) {
+      if ((Header->SubsystemVendorId != (UINT64)-1) && (SubsystemVendorId != (UINT64) -1)) {
         if (SubsystemVendorId != Header->SubsystemVendorId) {
           continue;
         }
       }
 
-      if (Header->SubsystemDeviceId != (UINT64)-1) {
+      if ((Header->SubsystemDeviceId != (UINT64)-1) && (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