From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web10.12650.1586951724559072734 for ; Wed, 15 Apr 2020 04:55:25 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Me0OGQGh; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586951723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XVCB+FpCkDMdrhwbRKa44Ty5uq1tUzZ6PhRPBfiaQOw=; b=Me0OGQGhxnb8U4S48aSEpgT2osqZdFMPOFHxVFvlolV3/CKPNe0Ko77cQwEn5OKVdgbM67 Dviy0q/h8G2PMUnxcU9MVUuFv4vedW1Z0FKls53SyT4zWvDmFnO24CIw99ZiDNMoRBKeZJ gsBL5dMj407ii30NUtUaoRVpc1BH9LE= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-166-OczZaaZ6OzKGO69htStydg-1; Wed, 15 Apr 2020 07:55:21 -0400 X-MC-Unique: OczZaaZ6OzKGO69htStydg-1 Received: by mail-ed1-f69.google.com with SMTP id eb6so2676614edb.12 for ; Wed, 15 Apr 2020 04:55:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7o0FV3doRZpr6nE/mLJ+Bd55KU4kF/LfIrxim4Fn854=; b=grwUanW82wllJIVIhMSKBL3Is9/dEfuvLzDq3WDHN+ydt816NGt/8CK8Q1zNeAT3p/ qan7y9BcN9HTwi/NcumOmwuxh2HZAB5E3Do6Nxwnw8CNahekNq3prPhXuHRHesPpz7Vx 166wCySE+PDQd/CFKbuni8qwvEjHUk9wT2wfBPlXOmmpD1ktkdVZEfapDNKHPIIBuG3C uGLU3C5gJF+xhe5QTshAqp/OmngGPUbaMIQvdJb8DkRyWag30//G/5jlWIWNNcHzX8r9 pcTu4TxqbPiMeolfCR8/KuVOp/OrVxbW68Qd5pLGGB8jFqhByhT3gwohzKjDxGL0SMvo 8i/g== X-Gm-Message-State: AGi0PuYONOBMzUvVqJGWfd7bmfniE7Me5ii751z3KYEAmxg7cTC/oTOX 5T3gFOmtn0BA7iNOt9BlGXZXB203TvOiszxQQPLeozUVTaow93u7A9bMYE90zE/dr2fTRxqhniB k4Sns9qDBzlXsEg== X-Received: by 2002:a05:6402:1d1c:: with SMTP id dg28mr22764408edb.135.1586951720351; Wed, 15 Apr 2020 04:55:20 -0700 (PDT) X-Google-Smtp-Source: APiQypLlcIMeODlulyRFBo+SKAqgsw5BZ17v971dAvaFN2tjm2FX1PjidbeGDIYDZe6qqg8fN8yKsA== X-Received: by 2002:a05:6402:1d1c:: with SMTP id dg28mr22764393edb.135.1586951720100; Wed, 15 Apr 2020 04:55:20 -0700 (PDT) Return-Path: Received: from [192.168.1.39] (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id hh1sm2507064ejb.46.2020.04.15.04.55.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Apr 2020 04:55:19 -0700 (PDT) Subject: Re: [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro To: Laszlo Ersek , edk2-devel-groups-io Cc: Ard Biesheuvel , Hao A Wu , Jian J Wang , Ray Ni References: <20200409113017.18233-1-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: <92cbf590-aa1c-16ea-ebab-75f26f68017a@redhat.com> Date: Wed, 15 Apr 2020 13:55:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200409113017.18233-1-lersek@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed 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 its > 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 > --- > MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDevi= ceIo.h | 2 -- > MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDevi= ceIo.c | 4 ++-- > 2 files changed, 2 insertions(+), 4 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscover= ablePciDeviceIo.h b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDis= coverablePciDeviceIo.h > index 15541c281153..3e6df3bebdd7 100644 > --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci= DeviceIo.h > +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci= DeviceIo.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/NonDiscover= ablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDis= coverablePciDeviceIo.c > index c3e83003a01c..a40c1a959350 100644 > --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci= DeviceIo.c > +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePci= DeviceIo.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 Reviewed-by: Philippe Mathieu-Daude