From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4001:c0b::242; helo=mail-it0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (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 1F2BD20961825 for ; Sun, 13 May 2018 03:25:21 -0700 (PDT) Received: by mail-it0-x242.google.com with SMTP id c3-v6so7299733itj.4 for ; Sun, 13 May 2018 03:25:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cBor3E80I/VDn0JabVOM6INu038nuvByDhSAw0djVL0=; b=gxwKOZfkIQ7JLkz6k8w2ZUz/LSjABPEukpmE1ar+TDRnSWQpz8otktkPpV7f0tVWgr V/2GgZHMrsgtvUUeNtYcuap4USliaJ0Cmvme89I+URYZLkzigFcD0/eWjUq8Ax1kE5Ks T1qHLS6z6ufiGMeNpM8KKd5eSTYERE+u9Wum8= 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; bh=cBor3E80I/VDn0JabVOM6INu038nuvByDhSAw0djVL0=; b=nYzgLHKeb3xTMbxYDsUG2Zc1GuLbhkgQIOFdxRMxNS7eOZptE9DCsLVzZSFzVRtCJu xljyjmCRPf3l3R2ZG3ON+8FRTok5HBYvvzOfzgTCHXW75ecsYLzLmPsiDDeKbr5cxzpD 93nVB96s2FeT6n+wvxt8ibQ/GGyCCsYAEBH8oTA/cEg9BN5afY0RCcmCbK4E2i/mIBZX 8pTan+AKnV9WDXlnNwu4pGnJyXeTelxsY0mWg10Jl3VdJmMUclDFF+3NqVTaiwRPPKpL KZUAji3GSGYuj+6432mSkPeJkaLZBIfXCkiw1AU6nb23m+ToWdaKkSXIX3uBGhUtXIfJ mpDg== X-Gm-Message-State: ALKqPwdRF+fujmKmYn1jPAOTqCjx3A4tExgRL3VJB5xkwMIvYNAjlglf nrzP7R0wwwUX+Fz9vhCttLexyFHzN10wqLyfAfVJsEhE X-Google-Smtp-Source: AB8JxZod4ZdDWc8Ux6HqupSaGAaG5rKa4U+lUuG00Jy+RUO1o8/t8UdW8ZbcGSt7NKtxHPIZswy2IaH4mq5MS/NekQE= X-Received: by 2002:a24:af45:: with SMTP id l5-v6mr5217608iti.106.1526207120682; Sun, 13 May 2018 03:25:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.187.134 with HTTP; Sun, 13 May 2018 03:25:20 -0700 (PDT) In-Reply-To: <51c562dc1e3275caf4a87939912e46d5@mail.gmail.com> References: <51c562dc1e3275caf4a87939912e46d5@mail.gmail.com> From: Ard Biesheuvel Date: Sun, 13 May 2018 12:25:20 +0200 Message-ID: To: Roman Bacik Cc: "edk2-devel@lists.01.org" , Ruiyu Ni , Vladimir Olovyannikov Subject: Re: [PATCH] Enable using 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: Sun, 13 May 2018 10:25:22 -0000 Content-Type: text/plain; charset="UTF-8" On 9 May 2018 at 22:17, Roman Bacik wrote: > I will upload v2 with the corrected subject - add package name MdeModulePkg/Bus > . > I don't think this is the correct approach. Please use the address translation support that has been added recently to PciHostBridgeDxe and PciHostBridgeLib. > > > *From:* Roman Bacik [mailto:roman.bacik@broadcom.com] > *Sent:* Thursday, May 3, 2018 3:55 PM > *To:* edk2-devel@lists.01.org > *Cc:* Ruiyu Ni; Vladimir Olovyannikov > *Subject:* [edk2] [PATCH] Enable using device address when programming BARs > > > > Some SoCs require to use device address when BARs are programmed: > https://bugzilla.tianocore.org/show_bug.cgi?id=948 > > 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 ## CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdMrIovSupport ## CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration ## > SOMETIMES_CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdUseDeviceAddress ## CONSUMES > > [UserExtensions.TianoCore."ExtraFiles"] > PciBusDxeExtra.uni > diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c > b/MdeModulePkg/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 = 0; > PciIo = &(Node->PciDev->PciIo); > + UseDeviceAddress = FeaturePcdGet (PcdUseDeviceAddress); > > - Address = Base + Node->Offset; > + Address = UseDeviceAddress? Node->Offset: Base + Node->Offset; > > // > // Indicate pci bus driver has allocated > @@ -1308,7 +1310,7 @@ ProgramBar ( > &Address > ); > > - Node->PciDev->PciBar[Node->Bar].BaseAddress = Address; > + Node->PciDev->PciBar[Node->Bar].BaseAddress = UseDeviceAddress? Base + > Address: Address; > > break; > > @@ -1335,7 +1337,7 @@ ProgramBar ( > &Address32 > ); > > - Node->PciDev->PciBar[Node->Bar].BaseAddress = Address; > + Node->PciDev->PciBar[Node->Bar].BaseAddress = UseDeviceAddress? Base + > Address: Address; > > break; > > diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec > 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|0x30001055 > > + ## Indicates whether the device address should be used for BAR > programming > + > gEfiMdeModulePkgTokenSpaceGuid.PcdUseDeviceAddress|FALSE|BOOLEAN|0x30001056 > + > [PcdsFixedAtBuild, PcdsPatchableInModule] > ## Dynamic type PCD can be registered callback function for Pcd setting > action. > # PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of > callback function > diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc > 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 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel