Lines Matching +full:bus +full:- +full:addr
1 // SPDX-License-Identifier: GPL-2.0
3 * Numascale NumaConnect-specific PCI code
19 static inline char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) in pci_dev_base() argument
21 struct pci_mmcfg_region *cfg = pci_mmconfig_lookup(seg, bus); in pci_dev_base()
23 if (cfg && cfg->virt) in pci_dev_base()
24 return cfg->virt + (PCI_MMCFG_BUS_OFFSET(bus) | (devfn << 12)); in pci_dev_base()
28 static int pci_mmcfg_read_numachip(unsigned int seg, unsigned int bus, in pci_mmcfg_read_numachip() argument
31 char __iomem *addr; in pci_mmcfg_read_numachip() local
33 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ in pci_mmcfg_read_numachip()
34 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) { in pci_mmcfg_read_numachip()
35 err: *value = -1; in pci_mmcfg_read_numachip()
36 return -EINVAL; in pci_mmcfg_read_numachip()
40 if (unlikely(bus == 0 && devfn >= limit)) { in pci_mmcfg_read_numachip()
41 *value = -1; in pci_mmcfg_read_numachip()
46 addr = pci_dev_base(seg, bus, devfn); in pci_mmcfg_read_numachip()
47 if (!addr) { in pci_mmcfg_read_numachip()
54 *value = mmio_config_readb(addr + reg); in pci_mmcfg_read_numachip()
57 *value = mmio_config_readw(addr + reg); in pci_mmcfg_read_numachip()
60 *value = mmio_config_readl(addr + reg); in pci_mmcfg_read_numachip()
68 static int pci_mmcfg_write_numachip(unsigned int seg, unsigned int bus, in pci_mmcfg_write_numachip() argument
71 char __iomem *addr; in pci_mmcfg_write_numachip() local
73 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */ in pci_mmcfg_write_numachip()
74 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) in pci_mmcfg_write_numachip()
75 return -EINVAL; in pci_mmcfg_write_numachip()
78 if (unlikely(bus == 0 && devfn >= limit)) in pci_mmcfg_write_numachip()
82 addr = pci_dev_base(seg, bus, devfn); in pci_mmcfg_write_numachip()
83 if (!addr) { in pci_mmcfg_write_numachip()
85 return -EINVAL; in pci_mmcfg_write_numachip()
90 mmio_config_writeb(addr + reg, value); in pci_mmcfg_write_numachip()
93 mmio_config_writew(addr + reg, value); in pci_mmcfg_write_numachip()
96 mmio_config_writel(addr + reg, value); in pci_mmcfg_write_numachip()
114 /* For remote I/O, restrict bus 0 access to the actual number of AMD in pci_numachip_init()
123 /* Use NumaChip PCI accessors for non-extended and extended access */ in pci_numachip_init()