From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web11.16148.1587070500980267764 for ; Thu, 16 Apr 2020 13:55:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H2ESAg2x; 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=1587070500; 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=7/f5CkTdmr73LWiMRSO3UARJvFyJNP9jW7ZjQDp+Chg=; b=H2ESAg2x0P8CSlaSsu7gObAtY0SSUH3IbUbxx3XhFPG5SCkICtrPI8ekJ1e6C6JMY5tOne E0NbvwFW66IjciI2lpK3UPEGZxvthYHRXzg9+IN/A1yaM2s6umNLHWJ2t1lCLFVMVfMswD eERxlxoqMchcQ3OcGJEjXVw9uLtH/oI= 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-7-IsfUylBrNwikJz5040zkYQ-1; Thu, 16 Apr 2020 16:54:57 -0400 X-MC-Unique: IsfUylBrNwikJz5040zkYQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D377E801A17; Thu, 16 Apr 2020 20:54:54 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-225.ams2.redhat.com [10.36.114.225]) by smtp.corp.redhat.com (Postfix) with ESMTP id 679682B479; Thu, 16 Apr 2020 20:54:53 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/NonDiscoverablePciDeviceDxe: use standard PCI_MAX_BAR macro From: "Laszlo Ersek" To: Ard Biesheuvel , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , Ray Ni Cc: edk2-devel-groups-io , Hao A Wu , Jian J Wang Reply-To: devel@edk2.groups.io, lersek@redhat.com References: <20200409113017.18233-1-lersek@redhat.com> Message-ID: <78f5a887-389c-f4a1-23c2-70177287d53b@redhat.com> Date: Thu, 16 Apr 2020 22:54:52 +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.11 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 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(-) Pushed as commit a7947b6366a6, via . Thanks! Laszlo >=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