public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Jeff Fan <jeff.fan@intel.com>, Feng Tian <feng.tian@intel.com>
Subject: [PATCH v2 4/6] MdeModulePkg/IncompatiblePci: Use -1 to match any IDs
Date: Mon,  6 Feb 2017 14:00:57 +0800	[thread overview]
Message-ID: <20170206060059.595976-5-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20170206060059.595976-1-ruiyu.ni@intel.com>

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



  parent reply	other threads:[~2017-02-06  6:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06  6:00 [PATCH v2 0/6] Fix PciBus to accept Spec values as BarIndex and Alignment Ruiyu Ni
2017-02-06  6:00 ` [PATCH v2 1/6] MdeModulePkg/PciSioSerialDxe: Use MAX_UINT8 instead of PCI_BAR_ALL Ruiyu Ni
2017-02-08  7:44   ` Tian, Feng
2017-02-06  6:00 ` [PATCH v2 2/6] MdeModulePkg/PciBus: Accept Spec values as BarIndex and Alignment Ruiyu Ni
2017-02-06  8:36   ` Tian, Feng
2017-02-06  6:00 ` [PATCH v2 3/6] MdeModulePkg/IncompatiblePciDevice: Do not use deprecated macros Ruiyu Ni
2017-02-06 17:40   ` Kinney, Michael D
2017-02-06 17:55     ` Kinney, Michael D
2017-02-07  3:09       ` Ni, Ruiyu
2017-02-06  6:00 ` Ruiyu Ni [this message]
2017-02-06  6:00 ` [PATCH v2 5/6] OvmfPkg/IncompatiblePci: " Ruiyu Ni
2017-02-06  6:00 ` [PATCH v2 6/6] MdePkg/Pci22.h: Deprecate out-of-Spec IncompatiblePciDevice macros Ruiyu Ni
2017-02-06  8:18   ` Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170206060059.595976-5-ruiyu.ni@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox