Lines Matching +full:bus +full:- +full:addr
1 // SPDX-License-Identifier: GPL-2.0
11 #include <linux/pci-ecam.h>
29 static int handle_ea_bar(u32 e0, int bar, struct pci_bus *bus, in handle_ea_bar() argument
32 void __iomem *addr; in handle_ea_bar() local
35 /* Entries are 16-byte aligned; bits[2,3] select word in entry */ in handle_ea_bar()
43 addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */ in handle_ea_bar()
44 if (!addr) in handle_ea_bar()
47 v = readl(addr); in handle_ea_bar()
49 v |= 2; /* EA entry-1. Base-L */ in handle_ea_bar()
57 addr = bus->ops->map_bus(bus, devfn, bar); /* BAR 0 */ in handle_ea_bar()
58 if (!addr) in handle_ea_bar()
61 barl_orig = readl(addr + 0); in handle_ea_bar()
62 writel(0xffffffff, addr + 0); in handle_ea_bar()
63 barl_rb = readl(addr + 0); in handle_ea_bar()
64 writel(barl_orig, addr + 0); in handle_ea_bar()
67 v |= 0xc; /* EA entry-2. Offset-L */ in handle_ea_bar()
72 addr = bus->ops->map_bus(bus, devfn, bar + 4); /* BAR 1 */ in handle_ea_bar()
73 if (!addr) in handle_ea_bar()
76 v = readl(addr); /* EA entry-3. Base-H */ in handle_ea_bar()
83 static int thunder_ecam_p2_config_read(struct pci_bus *bus, unsigned int devfn, in thunder_ecam_p2_config_read() argument
86 struct pci_config_window *cfg = bus->sysdata; in thunder_ecam_p2_config_read()
88 void __iomem *addr; in thunder_ecam_p2_config_read() local
100 return pci_generic_config_read(bus, devfn, where, size, val); in thunder_ecam_p2_config_read()
103 addr = bus->ops->map_bus(bus, devfn, where_a); in thunder_ecam_p2_config_read()
104 if (!addr) in thunder_ecam_p2_config_read()
107 v = readl(addr); in thunder_ecam_p2_config_read()
110 * Bit 44 of the 64-bit Base must match the same bit in in thunder_ecam_p2_config_read()
112 * the high-order 32 bits, shift everything down by 32 bits. in thunder_ecam_p2_config_read()
114 node_bits = upper_32_bits(cfg->res.start) & (1 << 12); in thunder_ecam_p2_config_read()
122 static int thunder_ecam_config_read(struct pci_bus *bus, unsigned int devfn, in thunder_ecam_config_read() argument
128 void __iomem *addr; in thunder_ecam_config_read() local
132 addr = bus->ops->map_bus(bus, devfn, 0xc); in thunder_ecam_config_read()
133 if (!addr) in thunder_ecam_config_read()
136 v = readl(addr); in thunder_ecam_config_read()
138 /* Check for non type-00 header */ in thunder_ecam_config_read()
141 addr = bus->ops->map_bus(bus, devfn, 8); in thunder_ecam_config_read()
142 if (!addr) in thunder_ecam_config_read()
145 class_rev = readl(addr); in thunder_ecam_config_read()
150 /* Pass-2 handling */ in thunder_ecam_config_read()
153 return thunder_ecam_p2_config_read(bus, devfn, where, in thunder_ecam_config_read()
164 /* BAR or SR-IOV BAR */ in thunder_ecam_config_read()
169 addr = bus->ops->map_bus(bus, devfn, 0); in thunder_ecam_config_read()
170 if (!addr) in thunder_ecam_config_read()
173 vendor_device = readl(addr); in thunder_ecam_config_read()
177 pr_debug("%04x:%04x - Fix pass#: %08x, where: %03x, devfn: %03x\n", in thunder_ecam_config_read()
181 /* Check for non type-00 header */ in thunder_ecam_config_read()
187 addr = bus->ops->map_bus(bus, devfn, 0x70); in thunder_ecam_config_read()
188 if (!addr) in thunder_ecam_config_read()
192 v = readl(addr); in thunder_ecam_config_read()
201 addr = bus->ops->map_bus(bus, devfn, where_a); in thunder_ecam_config_read()
202 if (!addr) in thunder_ecam_config_read()
205 v = readl(addr); in thunder_ecam_config_read()
225 /* EA entry-0. PP=0, BAR0 Size:3 */ in thunder_ecam_config_read()
227 0x10, bus, devfn, where, in thunder_ecam_config_read()
230 /* EA entry-1. PP=0, BAR4 Size:3 */ in thunder_ecam_config_read()
232 0x20, bus, devfn, where, in thunder_ecam_config_read()
235 /* EA entry-2. PP=0, BAR2, Size:3 */ in thunder_ecam_config_read()
237 0x18, bus, devfn, where, in thunder_ecam_config_read()
240 /* EA entry-2. PP=4, VF_BAR0 (9), Size:3 */ in thunder_ecam_config_read()
242 0x1a4, bus, devfn, where, in thunder_ecam_config_read()
245 /* EA entry-3. PP=4, VF_BAR4 (d), Size:3 */ in thunder_ecam_config_read()
247 0x1b4, bus, devfn, where, in thunder_ecam_config_read()
257 addr = bus->ops->map_bus(bus, devfn, where_a); in thunder_ecam_config_read()
258 if (!addr) in thunder_ecam_config_read()
261 v = readl(addr); in thunder_ecam_config_read()
289 /* Enabled, not-Write, SP=ff, PP=05, BEI=6, ES=4 */ in thunder_ecam_config_read()
295 v = 0x00000002; /* Base-L 64-bit */ in thunder_ecam_config_read()
300 v = 0xfffffffe; /* MaxOffset-L 64-bit */ in thunder_ecam_config_read()
305 v = 0x00008430; /* NIC Base-H */ in thunder_ecam_config_read()
310 v = 0x0000000f; /* MaxOffset-H */ in thunder_ecam_config_read()
316 return pci_generic_config_read(bus, devfn, where, size, val); in thunder_ecam_config_read()
319 static int thunder_ecam_config_write(struct pci_bus *bus, unsigned int devfn, in thunder_ecam_config_write() argument
328 /* BAR or SR-IOV BAR */ in thunder_ecam_config_write()
331 return pci_generic_config_write(bus, devfn, where, size, val); in thunder_ecam_config_write()
346 .compatible = "cavium,pci-host-thunder-ecam",