From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::231; helo=mail-wr0-x231.google.com; envelope-from=roman.bacik@broadcom.com; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x231.google.com (mail-wr0-x231.google.com [IPv6:2a00:1450:400c:c0c::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DB0E020837991 for ; Thu, 10 May 2018 08:05:09 -0700 (PDT) Received: by mail-wr0-x231.google.com with SMTP id p4-v6so2365544wrh.3 for ; Thu, 10 May 2018 08:05:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=zn1Z7g0iPw5mkw/2QD9x/GcE+lP12UmIuaKvmzgJcgs=; b=W0aenwdj4bWqSOYCqQyFO1tdwE/tr6wBc8nkqCP7ahZsenTuk0RbIOSz85g34iMLvW ss2yPvhu5AcDOVWbSoCUSYD1/VRxMToiNMAL+GTT3VUvwBeBFPGFKAq2X9CvYfvM98o0 8mdTYmdwhS9b1TXwX6mRpbOqNvSYC4CaMXEs0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=zn1Z7g0iPw5mkw/2QD9x/GcE+lP12UmIuaKvmzgJcgs=; b=CXbvNYM9rGEqula7OaIq0av2f6cBJmhPzH/HEUBTc6KffeG4xdIV4IS+y/uAeDN5/y kNnV0vmRynhTHTXILDNUGgMmRXt/C2MWaYzPi2xRrsVC71G7QTjnVusgcZk9GVPR5RXL UJdMrr1njGQfQoXt9uEnrFfVM+UoB7SV/FYq/Aqxp8vOuK+m+6WWiI7NLUkENJga4oyQ 5mW1vaRrM/lGIp1jAr+NTlPnzEYpSn2FBTXj6mi4NCmN6ROaOwfZ0C8uO7t6gSERbN/e 57bozs2RmP6peNIRV+o5Vhe1iuxlbhApIx+zdaKrOr8BM/s0WJhNpY0zaAZeFpEdybSR 2UKg== X-Gm-Message-State: ALKqPwdyMZbIIOrF5QTDDTz3II4yYLSZXorWNRLYwtgAOZ+uHSoyfbIP nmN47e302Mcq7WOPMkABtO7IFUZYt7rDhW2fgEfesw== X-Google-Smtp-Source: AB8JxZp7aOSP8FS715oFcXcccj/2yAyo/q12KKZtO1J2PYXoFJLX6sm2dHP1hyXXc4Z9l4lJuVOI1dXOEm+a1yf0l0I= X-Received: by 2002:adf:c3cd:: with SMTP id d13-v6mr1689047wrg.282.1525964707877; Thu, 10 May 2018 08:05:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.188.78 with HTTP; Thu, 10 May 2018 08:04:27 -0700 (PDT) In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5BC8DBEA@SHSMSX104.ccr.corp.intel.com> References: <734D49CCEBEEF84792F5B80ED585239D5BC8DBEA@SHSMSX104.ccr.corp.intel.com> From: Roman Bacik Date: Thu, 10 May 2018 08:04:27 -0700 Message-ID: To: "Ni, Ruiyu" Cc: "edk2-devel@lists.01.org" , Vladimir Olovyannikov Subject: Re: [PATCH v2] MdeModulePkg/Bus: Enable to use device address when programming BARs X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 May 2018 15:05:10 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ray, Sadly our SoC requires offset instead of base+offset to be used when programming BARs. Moreover base+offset must be kept for the drivers to use the correct address. This applies to all PCI devices in the system. We would really appreciate if such requirement can be supported. Thanks, Roman On Wed, May 9, 2018 at 8:02 PM, Ni, Ruiyu wrote: > > Roman, > > Can you point to me the spec content which states the =E2=80=9COffset=E2= =80=9D instead of =E2=80=9CBase + Offset=E2=80=9D should be written to the = BAR? > > Does the policy apply to all PCI devices in a system, or certain PCI devi= ces in a system? > > > > Thanks/Ray > > > > From: Roman Bacik > Sent: Thursday, May 10, 2018 4:25 AM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu ; Vladimir Olovyannikov > Subject: [edk2] [PATCH v2] MdeModulePkg/Bus: Enable to use device address= when programming BARs > > > > Some SoCs require to use device address when BARs are programmed: > https://bugzilla.tianocore.org/show_bug.cgi?id=3D948 > > Cc: Ruiyu Ni > Cc: Vladimir Olovyannikov > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Roman Bacik > --- > MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf | 1 + > MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c | 8 +++++--- > MdeModulePkg/MdeModulePkg.dec | 3 +++ > MdeModulePkg/MdeModulePkg.dsc | 1 + > 4 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf b/MdeModulePkg/= Bus/Pci/PciBusDxe/PciBusDxe.inf > index 97608bfcf245..1368e5068574 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf > @@ -110,6 +110,7 @@ > gEfiMdeModulePkgTokenSpaceGuid.PcdAriSupport ## CONSU= MES > gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport ## CONSU= MES > gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration ## SOMET= IMES_CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdUseDeviceAddress ## CONSUMES > > [UserExtensions.TianoCore."ExtraFiles"] > PciBusDxeExtra.uni > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c b/MdeMod= ulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c > index 2f713fcee95e..a23bd1e258ef 100644 > --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c > +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c > @@ -1269,6 +1269,7 @@ ProgramBar ( > EFI_PCI_IO_PROTOCOL *PciIo; > UINT64 Address; > UINT32 Address32; > + BOOLEAN UseDeviceAddress; > > ASSERT (Node->Bar < PCI_MAX_BAR); > > @@ -1282,8 +1283,9 @@ ProgramBar ( > > Address =3D 0; > PciIo =3D &(Node->PciDev->PciIo); > + UseDeviceAddress =3D FeaturePcdGet (PcdUseDeviceAddress); > > - Address =3D Base + Node->Offset; > + Address =3D UseDeviceAddress? Node->Offset: Base + Node->Offset; > > // > // Indicate pci bus driver has allocated > @@ -1308,7 +1310,7 @@ ProgramBar ( > &Address > ); > > - Node->PciDev->PciBar[Node->Bar].BaseAddress =3D Address; > + Node->PciDev->PciBar[Node->Bar].BaseAddress =3D UseDeviceAddress? Ba= se + Address: Address; > > break; > > @@ -1335,7 +1337,7 @@ ProgramBar ( > &Address32 > ); > > - Node->PciDev->PciBar[Node->Bar].BaseAddress =3D Address; > + Node->PciDev->PciBar[Node->Bar].BaseAddress =3D UseDeviceAddress? Ba= se + Address: Address; > > break; > > diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.de= c > index cc397185f7b9..58425ee0d57f 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -1005,6 +1005,9 @@ > # @Prompt Enable UEFI Stack Guard. > gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x300010= 55 > > + ## Indicates whether the device address should be used for BAR program= ming > + gEfiMdeModulePkgTokenSpaceGuid.PcdUseDeviceAddress|FALSE|BOOLEAN|0x300= 01056 > + > [PcdsFixedAtBuild, PcdsPatchableInModule] > ## Dynamic type PCD can be registered callback function for Pcd settin= g action. > # PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number = of callback function > diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.ds= c > index ec24a50c7d0a..39b397cb13d9 100644 > --- a/MdeModulePkg/MdeModulePkg.dsc > +++ b/MdeModulePkg/MdeModulePkg.dsc > @@ -200,6 +200,7 @@ > gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0 > gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0 > gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries|28 > + gEfiMdeModulePkgTokenSpaceGuid.PcdUseDeviceAddress|FALSE > > [PcdsFixedAtBuild.IPF] > gEfiMdePkgTokenSpaceGuid.PcdIoBlockBaseAddressForIpf|0x0ffffc000000 > > > -- > 1.9.1