Lines Matching +full:data +full:- +full:bus
1 // SPDX-License-Identifier: GPL-2.0-only
29 #define MAX_DEV_NUM (31 - ID_SEL_BEGIN)
33 struct pci_bus *bus, in loongson_pcibios_config_access() argument
35 u32 *data) in loongson_pcibios_config_access() argument
37 u32 busnum = bus->number; in loongson_pcibios_config_access()
46 /* board-specific part,currently,only fuloong2f,yeeloong2f in loongson_pcibios_config_access()
60 *data = cs5536_pci_conf_read4(function, reg); in loongson_pcibios_config_access()
63 cs5536_pci_conf_write4(function, reg, *data); in loongson_pcibios_config_access()
69 /* Type 0 configuration for onboard PCI bus */ in loongson_pcibios_config_access()
71 return -1; in loongson_pcibios_config_access()
76 /* Type 1 configuration for offboard PCI bus */ in loongson_pcibios_config_access()
93 writel(cpu_to_le32(*data), addrp); in loongson_pcibios_config_access()
95 *data = le32_to_cpu(readl(addrp)); in loongson_pcibios_config_access()
106 return -1; in loongson_pcibios_config_access()
116 * read/write a 32bit word and mask/modify the data we actually want.
118 static int loongson_pcibios_read(struct pci_bus *bus, unsigned int devfn, in loongson_pcibios_read() argument
121 u32 data = 0; in loongson_pcibios_read() local
128 if (loongson_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, in loongson_pcibios_read()
129 &data)) in loongson_pcibios_read()
130 return -1; in loongson_pcibios_read()
133 *val = (data >> ((where & 3) << 3)) & 0xff; in loongson_pcibios_read()
135 *val = (data >> ((where & 3) << 3)) & 0xffff; in loongson_pcibios_read()
137 *val = data; in loongson_pcibios_read()
142 static int loongson_pcibios_write(struct pci_bus *bus, unsigned int devfn, in loongson_pcibios_write() argument
145 u32 data = 0; in loongson_pcibios_write() local
153 data = val; in loongson_pcibios_write()
155 if (loongson_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, in loongson_pcibios_write()
156 where, &data)) in loongson_pcibios_write()
157 return -1; in loongson_pcibios_write()
160 data = (data & ~(0xff << ((where & 3) << 3))) | in loongson_pcibios_write()
163 data = (data & ~(0xffff << ((where & 3) << 3))) | in loongson_pcibios_write()
167 if (loongson_pcibios_config_access(PCI_ACCESS_WRITE, bus, devfn, where, in loongson_pcibios_write()
168 &data)) in loongson_pcibios_write()
169 return -1; in loongson_pcibios_write()
184 struct pci_bus bus = { in _rdmsr() local
191 loongson_pcibios_write(&bus, devfn, PCI_MSR_ADDR, 4, msr); in _rdmsr()
192 loongson_pcibios_read(&bus, devfn, PCI_MSR_DATA_LO, 4, lo); in _rdmsr()
193 loongson_pcibios_read(&bus, devfn, PCI_MSR_DATA_HI, 4, hi); in _rdmsr()
200 struct pci_bus bus = { in _wrmsr() local
207 loongson_pcibios_write(&bus, devfn, PCI_MSR_ADDR, 4, msr); in _wrmsr()
208 loongson_pcibios_write(&bus, devfn, PCI_MSR_DATA_LO, 4, lo); in _wrmsr()
209 loongson_pcibios_write(&bus, devfn, PCI_MSR_DATA_HI, 4, hi); in _wrmsr()