From nobody Sat Nov 2 14:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486438392309402.3564484326781; Mon, 6 Feb 2017 19:33:12 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2B3BE820A6; Mon, 6 Feb 2017 19:33:11 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 917338204E for ; Mon, 6 Feb 2017 19:33:09 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 06 Feb 2017 19:33:09 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga004.fm.intel.com with ESMTP; 06 Feb 2017 19:33:08 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,344,1477983600"; d="scan'208";a="222151703" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Tue, 7 Feb 2017 11:33:00 +0800 Message-Id: <20170207033305.609040-2-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20170207033305.609040-1-ruiyu.ni@intel.com> References: <20170207033305.609040-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v3 1/6] MdeModulePkg/PciSioSerialDxe: Use MAX_UINT8 instead of PCI_BAR_ALL X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Feng Tian MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When BarIndex equals to 0xFF, default value 0 is used as the BAR index. Though PCI_BAR_ALL and MAX_UINT8 shares the same value, using PCI_BAR_ALL is like to match any BAR not BAR 0, it's more proper to use MAX_UINT8 here. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Feng Tian --- MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c b/MdeModulePkg/B= us/Pci/PciSioSerialDxe/Serial.c index 65ddf5d..a9dc827 100644 --- a/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c +++ b/MdeModulePkg/Bus/Pci/PciSioSerialDxe/Serial.c @@ -473,7 +473,7 @@ CreateSerialDevice ( // For PCI serial device, use the information from PCD // if (PciSerialParameter !=3D NULL) { - BarIndex =3D (PciSerialParameter->BarIndex =3D=3D PCI_BAR_ALL) ? 0 : P= ciSerialParameter->BarIndex; + BarIndex =3D (PciSerialParameter->BarIndex =3D=3D MAX_UINT8) ? 0 : Pci= SerialParameter->BarIndex; Offset =3D PciSerialParameter->Offset; if (PciSerialParameter->RegisterStride !=3D 0) { SerialDevice->RegisterStride =3D PciSerialParameter->RegisterStride; --=20 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Nov 2 14:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486438394102886.4597381410254; Mon, 6 Feb 2017 19:33:14 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5D550820AB; Mon, 6 Feb 2017 19:33:12 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8D3D5820A4 for ; Mon, 6 Feb 2017 19:33:10 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 06 Feb 2017 19:33:10 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga004.fm.intel.com with ESMTP; 06 Feb 2017 19:33:09 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,344,1477983600"; d="scan'208";a="222151711" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Tue, 7 Feb 2017 11:33:01 +0800 Message-Id: <20170207033305.609040-3-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20170207033305.609040-1-ruiyu.ni@intel.com> References: <20170207033305.609040-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v3 2/6] MdeModulePkg/PciBus: Accept Spec values as BarIndex and Alignment X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jeff Fan MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" PI spec IncompatiblePciSupport part defines (UINT64)-1 as all BARs and 0 to use existing alignment. PciBus driver didn't accept these values. It treated 0xFF as all BARs and 0xFFFFFFFFFFFFFFFFULL to use existing alignment. The patch changes the code to still accept old values while also accept values defined in PI spec. So that the driver can provide backward compatibility and follow spec. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Jeff Fan Reviewed-by: Feng Tian --- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 36 +++++++++++++-----= ---- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeMod= ulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index ac4d323..ecda088 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -1,7 +1,7 @@ /** @file PCI emumeration support functions implementation for PCI Bus module. =20 -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License @@ -17,6 +17,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHE= R EXPRESS OR IMPLIED. =20 extern CHAR16 *mBarTypeStr[]; =20 +#define OLD_ALIGN 0xFFFFFFFFFFFFFFFFULL +#define EVEN_ALIGN 0xFFFFFFFFFFFFFFFEULL +#define SQUAD_ALIGN 0xFFFFFFFFFFFFFFFDULL +#define DQUAD_ALIGN 0xFFFFFFFFFFFFFFFCULL + /** This routine is used to check whether the pci device is present. =20 @@ -1335,8 +1340,8 @@ UpdatePciInfo ( ) { EFI_STATUS Status; - UINTN BarIndex; - UINTN BarEndIndex; + UINT64 BarIndex; + UINT64 BarEndIndex; BOOLEAN SetFlag; VOID *Configuration; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr; @@ -1390,18 +1395,19 @@ UpdatePciInfo ( break; } =20 - BarIndex =3D (UINTN) Ptr->AddrTranslationOffset; + BarIndex =3D Ptr->AddrTranslationOffset; BarEndIndex =3D BarIndex; =20 // // Update all the bars in the device + // Compare against 0xFF is to keep backward compatibility. // - if (BarIndex =3D=3D PCI_BAR_ALL) { + if ((BarIndex =3D=3D MAX_UINT64) || (BarIndex =3D=3D 0xFF)) { BarIndex =3D 0; BarEndIndex =3D PCI_MAX_BAR - 1; } =20 - if (BarIndex > PCI_MAX_BAR) { + if (BarIndex >=3D PCI_MAX_BAR) { Ptr++; continue; } @@ -1472,7 +1478,7 @@ UpdatePciInfo ( // // Update the new length for the device // - if (Ptr->AddrLen !=3D PCI_BAR_NOCHANGE) { + if (Ptr->AddrLen !=3D 0) { PciIoDevice->PciBar[BarIndex].Length =3D Ptr->AddrLen; } } @@ -1488,6 +1494,8 @@ UpdatePciInfo ( =20 /** This routine will update the alignment with the new alignment. + Compare with OLD_ALIGN/EVEN_ALIGN/SQUAD_ALIGN/DQUAD_ALIGN is to keep + backward compatibility. =20 @param Alignment Input Old alignment. Output updated alignment. @param NewAlignment New alignment. @@ -1506,15 +1514,15 @@ SetNewAlign ( // The new alignment is the same as the original, // so skip it // - if (NewAlignment =3D=3D PCI_BAR_OLD_ALIGN) { + if ((NewAlignment =3D=3D 0) || (NewAlignment =3D=3D OLD_ALIGN)) { return ; } // // Check the validity of the parameter // - if (NewAlignment !=3D PCI_BAR_EVEN_ALIGN && - NewAlignment !=3D PCI_BAR_SQUAD_ALIGN && - NewAlignment !=3D PCI_BAR_DQUAD_ALIGN ) { + if (NewAlignment !=3D EVEN_ALIGN && + NewAlignment !=3D SQUAD_ALIGN && + NewAlignment !=3D DQUAD_ALIGN ) { *Alignment =3D NewAlignment; return ; } @@ -1533,15 +1541,15 @@ SetNewAlign ( // // Adjust the alignment to even, quad or double quad boundary // - if (NewAlignment =3D=3D PCI_BAR_EVEN_ALIGN) { + if (NewAlignment =3D=3D EVEN_ALIGN) { if ((OldAlignment & 0x01) !=3D 0) { OldAlignment =3D OldAlignment + 2 - (OldAlignment & 0x01); } - } else if (NewAlignment =3D=3D PCI_BAR_SQUAD_ALIGN) { + } else if (NewAlignment =3D=3D SQUAD_ALIGN) { if ((OldAlignment & 0x03) !=3D 0) { OldAlignment =3D OldAlignment + 4 - (OldAlignment & 0x03); } - } else if (NewAlignment =3D=3D PCI_BAR_DQUAD_ALIGN) { + } else if (NewAlignment =3D=3D DQUAD_ALIGN) { if ((OldAlignment & 0x07) !=3D 0) { OldAlignment =3D OldAlignment + 8 - (OldAlignment & 0x07); } --=20 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Nov 2 14:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 148643839683837.669481290748536; Mon, 6 Feb 2017 19:33:16 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8DFD0820B9; Mon, 6 Feb 2017 19:33:12 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7CE5D820AB for ; Mon, 6 Feb 2017 19:33:11 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 06 Feb 2017 19:33:11 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga004.fm.intel.com with ESMTP; 06 Feb 2017 19:33:10 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,344,1477983600"; d="scan'208";a="222151715" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Tue, 7 Feb 2017 11:33:02 +0800 Message-Id: <20170207033305.609040-4-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20170207033305.609040-1-ruiyu.ni@intel.com> References: <20170207033305.609040-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v3 3/6] MdeModulePkg/IncompatiblePciDevice: Do not use deprecated macros X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jeff Fan MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The patch replaces the following macros: DEVICE_ID_NOCARE (0xFF) --> MAX_UINT64 PCI_ACPI_UNUSED (0) --> 0 PCI_BAR_ALL (0xFF) --> MAX_UINT64 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 Cc: Jeff Fan Reviewed-by: Feng Tian --- .../IncompatiblePciDeviceSupport.c | 108 ++++++++++-------= ---- 1 file changed, 53 insertions(+), 55 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/Incompati= blePciDeviceSupport.c b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDx= e/IncompatiblePciDeviceSupport.c index 3d581b6..bf0d47a 100644 --- a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciD= eviceSupport.c +++ b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciD= eviceSupport.c @@ -1,11 +1,11 @@ /** @file This module is one template module for Incompatible PCI Device Support p= rotocol. - It includes one incompatile pci devices list template. + It includes one incompatible pci devices list template. =20 Incompatible PCI Device Support protocol allows the PCI bus driver to su= pport resource allocation for some PCI devices that do not comply with the PCI= Specification. =20 -Copyright (c) 2009, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
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, SubDevice= Id) \ VendorId, DeviceId, Revision, SubVendorId, SubDeviceId =20 -#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 =20 +#define EVEN_ALIGN 0xFFFFFFFFFFFFFFFEULL =20 /** Returns a list of ACPI resource descriptors that detail the special @@ -114,72 +112,72 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 mIncompatiblePci= DeviceList[] =3D { // Device Adaptec 9004 // DEVICE_INF_TAG, - PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCA= RE, DEVICE_ID_NOCARE), + PCI_DEVICE_ID(0x9004, MAX_UINT64, MAX_UINT64, MAX_UINT64, MAX_UINT64), 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, + MAX_UINT64, + 0, // // Device Adaptec 9005 // DEVICE_INF_TAG, - PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCA= RE, DEVICE_ID_NOCARE), + PCI_DEVICE_ID(0x9005, MAX_UINT64, MAX_UINT64, MAX_UINT64, MAX_UINT64), 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, + MAX_UINT64, + 0, // // Device QLogic 1007 // DEVICE_INF_TAG, - PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCA= RE, DEVICE_ID_NOCARE), + PCI_DEVICE_ID(0x1077, MAX_UINT64, MAX_UINT64, MAX_UINT64, MAX_UINT64), 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, + MAX_UINT64, + 0, // // Device Agilent 103C // DEVICE_INF_TAG, - PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCA= RE, DEVICE_ID_NOCARE), + PCI_DEVICE_ID(0x103C, MAX_UINT64, MAX_UINT64, MAX_UINT64, MAX_UINT64), 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, + MAX_UINT64, + 0, // // Device Agilent 15BC // DEVICE_INF_TAG, - PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCA= RE, DEVICE_ID_NOCARE), + PCI_DEVICE_ID(0x15BC, MAX_UINT64, MAX_UINT64, MAX_UINT64, MAX_UINT64), 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, + MAX_UINT64, + 0, // // The end of the list // @@ -285,31 +283,31 @@ PCheckDevice ( // // See if the Header matches the parameters passed in // - if (Header->VendorId !=3D DEVICE_ID_NOCARE) { + if (Header->VendorId !=3D MAX_UINT64) { if (Header->VendorId !=3D VendorId) { continue; } } =20 - if (Header->DeviceId !=3D DEVICE_ID_NOCARE) { + if (Header->DeviceId !=3D MAX_UINT64) { if (DeviceId !=3D Header->DeviceId) { continue; } } =20 - if (Header->RevisionId !=3D DEVICE_ID_NOCARE) { + if (Header->RevisionId !=3D MAX_UINT64) { if (RevisionId !=3D Header->RevisionId) { continue; } } =20 - if (Header->SubsystemVendorId !=3D DEVICE_ID_NOCARE) { + if (Header->SubsystemVendorId !=3D MAX_UINT64) { if (SubsystemVendorId !=3D Header->SubsystemVendorId) { continue; } } =20 - if (Header->SubsystemDeviceId !=3D DEVICE_ID_NOCARE) { + if (Header->SubsystemDeviceId !=3D MAX_UINT64) { if (SubsystemDeviceId !=3D Header->SubsystemDeviceId) { continue; } --=20 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Nov 2 14:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486438398668931.4920033900491; Mon, 6 Feb 2017 19:33:18 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C0219820B0; Mon, 6 Feb 2017 19:33:13 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7F995820B0 for ; Mon, 6 Feb 2017 19:33:12 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 06 Feb 2017 19:33:12 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga004.fm.intel.com with ESMTP; 06 Feb 2017 19:33:11 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,344,1477983600"; d="scan'208";a="222151721" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Tue, 7 Feb 2017 11:33:03 +0800 Message-Id: <20170207033305.609040-5-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20170207033305.609040-1-ruiyu.ni@intel.com> References: <20170207033305.609040-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v3 4/6] MdeModulePkg/IncompatiblePci: Use MAX_UINTN to match any IDs X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jeff Fan MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When the VendorId/DeviceId/RevisionId/SubsystemVendorId /SubsystemDeviceId is MAX_UINTN, 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, MAX_UINTN is never passed to this driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Jeff Fan Reviewed-by: Feng Tian --- .../IncompatiblePciDeviceSupport.c | 10 +++++-= ---- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/Incompati= blePciDeviceSupport.c b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDx= e/IncompatiblePciDeviceSupport.c index bf0d47a..149662d 100644 --- a/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciD= eviceSupport.c +++ b/MdeModulePkg/Bus/Pci/IncompatiblePciDeviceSupportDxe/IncompatiblePciD= eviceSupport.c @@ -283,31 +283,31 @@ PCheckDevice ( // // See if the Header matches the parameters passed in // - if (Header->VendorId !=3D MAX_UINT64) { + if ((Header->VendorId !=3D MAX_UINT64) && (VendorId !=3D MAX_UINTN))= { if (Header->VendorId !=3D VendorId) { continue; } } =20 - if (Header->DeviceId !=3D MAX_UINT64) { + if ((Header->DeviceId !=3D MAX_UINT64) && (DeviceId !=3D MAX_UINTN))= { if (DeviceId !=3D Header->DeviceId) { continue; } } =20 - if (Header->RevisionId !=3D MAX_UINT64) { + if ((Header->RevisionId !=3D MAX_UINT64) && (RevisionId !=3D MAX_UIN= TN)) { if (RevisionId !=3D Header->RevisionId) { continue; } } =20 - if (Header->SubsystemVendorId !=3D MAX_UINT64) { + if ((Header->SubsystemVendorId !=3D MAX_UINT64) && (SubsystemVendorI= d !=3D MAX_UINTN)) { if (SubsystemVendorId !=3D Header->SubsystemVendorId) { continue; } } =20 - if (Header->SubsystemDeviceId !=3D MAX_UINT64) { + if ((Header->SubsystemDeviceId !=3D MAX_UINT64) && (SubsystemDeviceI= d !=3D MAX_UINTN)) { if (SubsystemDeviceId !=3D Header->SubsystemDeviceId) { continue; } --=20 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Nov 2 14:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486438401093863.852618172157; Mon, 6 Feb 2017 19:33:21 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 00C68820B7; Mon, 6 Feb 2017 19:33:15 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 69D9D820A4 for ; Mon, 6 Feb 2017 19:33:13 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 06 Feb 2017 19:33:13 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga004.fm.intel.com with ESMTP; 06 Feb 2017 19:33:12 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,344,1477983600"; d="scan'208";a="222151722" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Tue, 7 Feb 2017 11:33:04 +0800 Message-Id: <20170207033305.609040-6-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20170207033305.609040-1-ruiyu.ni@intel.com> References: <20170207033305.609040-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v3 5/6] OvmfPkg/IncompatiblePci: Do not use deprecated macros X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laszlo Ersek MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Cc: Laszlo Ersek Reviewed-by: Laszlo Ersek --- .../IncompatiblePciDeviceSupport.c | 13 +++++++--= ---- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceS= upport.c b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSup= port.c index b6ff128..df9eb60 100644 --- a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c +++ b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c @@ -4,6 +4,7 @@ is not present), conserving 32-bit MMIO aperture for 32-bit BARs. =20 Copyright (C) 2016, Red Hat, Inc. + Copyright (c) 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made availa= ble under the terms and conditions of the BSD License which accompanies this @@ -66,19 +67,19 @@ STATIC CONST MMIO64_PREFERENCE mConfiguration =3D { ) ), ACPI_ADDRESS_SPACE_TYPE_MEM, // ResType - PCI_ACPI_UNUSED, // GenFlag - PCI_ACPI_UNUSED, // SpecificFlag + 0, // GenFlag + 0, // SpecificFlag 64, // AddrSpaceGranularity: // aperture selection= hint // for BAR allocation - PCI_ACPI_UNUSED, // AddrRangeMin - PCI_BAR_OLD_ALIGN, // AddrRangeMax: + 0, // AddrRangeMin + 0, // AddrRangeMax: // no special alignme= nt // for affected BARs - PCI_BAR_ALL, // AddrTranslationOffse= t: + MAX_UINT64, // AddrTranslationOffset: // hint covers all // eligible BARs - PCI_BAR_NOCHANGE // AddrLen: + 0 // AddrLen: // use probed BAR size }, // --=20 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat Nov 2 14:29:57 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486438403176652.8204077150225; Mon, 6 Feb 2017 19:33:23 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 331D8820CF; Mon, 6 Feb 2017 19:33:16 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 72DA68204E for ; Mon, 6 Feb 2017 19:33:14 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 06 Feb 2017 19:33:14 -0800 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.25]) by fmsmga004.fm.intel.com with ESMTP; 06 Feb 2017 19:33:13 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,344,1477983600"; d="scan'208";a="222151734" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Tue, 7 Feb 2017 11:33:05 +0800 Message-Id: <20170207033305.609040-7-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.9.0.windows.1 In-Reply-To: <20170207033305.609040-1-ruiyu.ni@intel.com> References: <20170207033305.609040-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v3 6/6] MdePkg/Pci22.h: Deprecate out-of-Spec IncompatiblePciDevice macros X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jeff Fan MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" DEVICE_ID_NOCARE is defined as 0xFFFF but Spec says (UINT64) -1 should be used to match any VendorId/DeviceId/RevisionId/ SubsystemVendorId/SubsystemDeviceId. PCI_BAR_OLD_ALIGN/PCI_BAR_EVEN_ALIGN/PCI_BAR_SQUAD_ALIGN/ PCI_BAR_DQUAD_ALIGN are defined but Spec doesn't have such definitions. PCI_BAR_ALL is defined as 0xFF but Spec says (UINT64) -1 should be used to match all BARs. All of the above macros are marked as deprecated. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni Reviewed-by: Liming Gao Cc: Jeff Fan --- MdePkg/Include/IndustryStandard/Pci22.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/MdePkg/Include/IndustryStandard/Pci22.h b/MdePkg/Include/Indus= tryStandard/Pci22.h index 4cf8389..5dec65d 100644 --- a/MdePkg/Include/IndustryStandard/Pci22.h +++ b/MdePkg/Include/IndustryStandard/Pci22.h @@ -7,7 +7,7 @@ PC Card Standard, 8.0 PCI Power Management Interface Specifiction, Revision 1.2 =20 - Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
Copyright (c) 2014 - 2015, Hewlett-Packard Development Company, L.P.
This program and the accompanying materials =20 are licensed and made available under the terms and conditions of the BS= D License =20 @@ -780,14 +780,25 @@ typedef struct { /// } EFI_PCI_CAPABILITY_HOTPLUG; =20 -#define DEVICE_ID_NOCARE 0xFFFF +/// +/// Below macros (till PCI_BAR_NOCHANGE) were used by EfiIncompatiblePciDe= viceSupport Protocol. +/// +#ifndef DISABLE_NEW_DEPRECATED_INTERFACES + +/// +/// [ATTENTION] These macros are deprecated because they don't match Spec = or not defined in Spec. +/// +#define DEVICE_ID_NOCARE 0xFFFF ///< Deprecated. Value = doesn't match Spec. +#define PCI_BAR_OLD_ALIGN 0xFFFFFFFFFFFFFFFFULL ///< Deprecated. Value = isn't defined in Spec. +#define PCI_BAR_EVEN_ALIGN 0xFFFFFFFFFFFFFFFEULL ///< Deprecated. Value = isn't defined in Spec. +#define PCI_BAR_SQUAD_ALIGN 0xFFFFFFFFFFFFFFFDULL ///< Deprecated. Value = isn't defined in Spec. +#define PCI_BAR_DQUAD_ALIGN 0xFFFFFFFFFFFFFFFCULL ///< Deprecated. Value = isn't defined in Spec. +#define PCI_BAR_ALL 0xFF ///< Deprecated. Value = doesn't match Spec. + +#endif =20 #define PCI_ACPI_UNUSED 0 #define PCI_BAR_NOCHANGE 0 -#define PCI_BAR_OLD_ALIGN 0xFFFFFFFFFFFFFFFFULL -#define PCI_BAR_EVEN_ALIGN 0xFFFFFFFFFFFFFFFEULL -#define PCI_BAR_SQUAD_ALIGN 0xFFFFFFFFFFFFFFFDULL -#define PCI_BAR_DQUAD_ALIGN 0xFFFFFFFFFFFFFFFCULL =20 #define PCI_BAR_IDX0 0x00 #define PCI_BAR_IDX1 0x01 @@ -795,7 +806,6 @@ typedef struct { #define PCI_BAR_IDX3 0x03 #define PCI_BAR_IDX4 0x04 #define PCI_BAR_IDX5 0x05 -#define PCI_BAR_ALL 0xFF =20 /// /// EFI PCI Option ROM definitions --=20 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel