diff mbox series

[u-boot-next,10/12] x86: pci: Use PCI_CONF1_ADDRESS() macro

Message ID 20211126104252.5443-11-pali@kernel.org
State Accepted
Commit 7598759d194e09a8301f2912739feda9cb7dcb70
Delegated to: Tom Rini
Headers show
Series Common U-Boot macros for PCI Configuration Mechanism #1 | expand

Commit Message

Pali Rohár Nov. 26, 2021, 10:42 a.m. UTC
x86 platform uses standard format of Config Address for PCI Configuration
Mechanism #1. So use new U-Boot macro PCI_CONF1_ADDRESS().

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/x86/cpu/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Glass Dec. 28, 2021, 8:32 a.m. UTC | #1
On Fri, 26 Nov 2021 at 03:43, Pali Rohár <pali@kernel.org> wrote:
>
> x86 platform uses standard format of Config Address for PCI Configuration
> Mechanism #1. So use new U-Boot macro PCI_CONF1_ADDRESS().
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
>  arch/x86/cpu/pci.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Jan. 13, 2022, 1:52 a.m. UTC | #2
On Fri, Nov 26, 2021 at 11:42:50AM +0100, Pali Rohár wrote:

> x86 platform uses standard format of Config Address for PCI Configuration
> Mechanism #1. So use new U-Boot macro PCI_CONF1_ADDRESS().
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/arch/x86/cpu/pci.c b/arch/x86/cpu/pci.c
index d4f9290ca73b..8a992ed82339 100644
--- a/arch/x86/cpu/pci.c
+++ b/arch/x86/cpu/pci.c
@@ -20,7 +20,7 @@ 
 int pci_x86_read_config(pci_dev_t bdf, uint offset, ulong *valuep,
 			enum pci_size_t size)
 {
-	outl(bdf | (offset & 0xfc) | PCI_CFG_EN, PCI_REG_ADDR);
+	outl(PCI_CONF1_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset), PCI_REG_ADDR);
 	switch (size) {
 	case PCI_SIZE_8:
 		*valuep = inb(PCI_REG_DATA + (offset & 3));
@@ -39,7 +39,7 @@  int pci_x86_read_config(pci_dev_t bdf, uint offset, ulong *valuep,
 int pci_x86_write_config(pci_dev_t bdf, uint offset, ulong value,
 			 enum pci_size_t size)
 {
-	outl(bdf | (offset & 0xfc) | PCI_CFG_EN, PCI_REG_ADDR);
+	outl(PCI_CONF1_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset), PCI_REG_ADDR);
 	switch (size) {
 	case PCI_SIZE_8:
 		outb(value, PCI_REG_DATA + (offset & 3));