From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web10.19777.1586972451025469215 for ; Wed, 15 Apr 2020 10:40:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MrUq0AVg; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586972450; h=from:from:reply-to: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=obz72hS3avZFMat8BaK/qmBwzM48gQ990IbUxtFlRFU=; b=MrUq0AVgOWtomujq5nL6re5JzZhh5d7lsULxogdYuPrghaWoh78P0zl1Eo3b0b7l8UMHwK VTSUz6/N8wlTWHH0NFR5jRhJpjzJeuB6Dsx8A4glaLaOUiOXHXKaHklSg9/C3yrYinKiWa YSOM8fkbPrOuO7ztaGvrVcaMyOq2YGk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-211-jhLCyBC4MtajM2a1RcGqsw-1; Wed, 15 Apr 2020 13:40:46 -0400 X-MC-Unique: jhLCyBC4MtajM2a1RcGqsw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 545838017F3; Wed, 15 Apr 2020 17:40:45 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-155.ams2.redhat.com [10.36.112.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id B489911A065; Wed, 15 Apr 2020 17:40:43 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro From: "Laszlo Ersek" To: Hao A Wu , Jian J Wang , Ray Ni Cc: edk2-devel-groups-io , Ard Biesheuvel , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Reply-To: devel@edk2.groups.io, lersek@redhat.com References: <20200409113017.18233-1-lersek@redhat.com> Message-ID: <6a945ef7-63b9-7c6b-7392-56ec48e8873f@redhat.com> Date: Wed, 15 Apr 2020 19:40:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200409113017.18233-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hao, Jian, Ray: can one of you please approve this patch? Thanks Laszlo On 04/09/20 13:30, 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/NonDiscoverablePciDevic= eIo.h | 2 -- > MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDevic= eIo.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