From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.8354.1586437734771219690 for ; Thu, 09 Apr 2020 06:08:54 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4461230E; Thu, 9 Apr 2020 06:08:54 -0700 (PDT) Received: from [192.168.1.81] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 53A313F73D; Thu, 9 Apr 2020 06:08:53 -0700 (PDT) Subject: Re: [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro To: Laszlo Ersek , edk2-devel-groups-io Cc: Hao A Wu , Jian J Wang , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , Ray Ni References: <20200409113017.18233-1-lersek@redhat.com> From: "Ard Biesheuvel" Message-ID: <048bd04b-997f-4b0b-0453-eaaadc31c76c@arm.com> Date: Thu, 9 Apr 2020 15:08:52 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200409113017.18233-1-lersek@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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"). >=20 > 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). >=20 > "NonDiscoverablePciDeviceIo.h" gets the definition of PCI_MAX_BAR via i= ts > existent #include directive. >=20 > Build-tested only. >=20 > Cc: Ard Biesheuvel > Cc: Hao A Wu > Cc: Jian J Wang > Cc: Philippe Mathieu-Daud=C3=A9 > Cc: Ray Ni > Signed-off-by: Laszlo Ersek Reviewed-by: Ard Biesheuvel > --- > MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDe= viceIo.h | 2 -- > MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDe= viceIo.c | 4 ++-- > 2 files changed, 2 insertions(+), 4 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscov= erablePciDeviceIo.h b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/No= nDiscoverablePciDeviceIo.h > index 15541c281153..3e6df3bebdd7 100644 > --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverableP= ciDeviceIo.h > +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverableP= ciDeviceIo.h > @@ -36,8 +36,6 @@ > #define PCI_ID_VENDOR_UNKNOWN 0xffff > #define PCI_ID_DEVICE_DONTCARE 0x0000 > =20 > -#define PCI_MAX_BARS 6 > - > extern EFI_CPU_ARCH_PROTOCOL *mCpu; > =20 > typedef struct { > diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscov= erablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/No= nDiscoverablePciDeviceIo.c > index c3e83003a01c..a40c1a959350 100644 > --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverableP= ciDeviceIo.c > +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverableP= ciDeviceIo.c > @@ -1679,8 +1679,8 @@ InitializePciIoProtocol ( > ASSERT (Desc->Desc =3D=3D ACPI_ADDRESS_SPACE_DESCRIPTOR); > ASSERT (Desc->ResType =3D=3D ACPI_ADDRESS_SPACE_TYPE_MEM); > =20 > - if (Idx >=3D PCI_MAX_BARS || > - (Idx =3D=3D PCI_MAX_BARS - 1 && Desc->AddrSpaceGranularity =3D= =3D 64)) { > + if (Idx >=3D PCI_MAX_BAR || > + (Idx =3D=3D PCI_MAX_BAR - 1 && Desc->AddrSpaceGranularity =3D=3D= 64)) { > DEBUG ((DEBUG_ERROR, > "%a: resource count exceeds number of emulated BARs\n", > __FUNCTION__)); >=20