Lines Matching refs:bus
55 #define CONFIG_CMD(bus, devfn, where) \ argument
56 (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
68 static inline int __query(const struct pci_bus *bus, unsigned int devfn) in __query() argument
71 return bus->number == 0 && (devfn == PCI_DEVFN(0, 0)); in __query()
72 return bus->number == 1; in __query()
73 return bus->number == 0 && in __query()
82 static int pci_ampci_read_config_byte(struct pci_bus *bus, unsigned int devfn, in pci_ampci_read_config_byte() argument
87 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { in pci_ampci_read_config_byte()
91 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); in pci_ampci_read_config_byte()
94 if (__query(bus, devfn)) in pci_ampci_read_config_byte()
95 __pcidebug("=> %02hx", bus, devfn, where, value); in pci_ampci_read_config_byte()
102 static int pci_ampci_read_config_word(struct pci_bus *bus, unsigned int devfn, in pci_ampci_read_config_word() argument
107 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { in pci_ampci_read_config_word()
111 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); in pci_ampci_read_config_word()
114 if (__query(bus, devfn)) in pci_ampci_read_config_word()
115 __pcidebug("=> %04hx", bus, devfn, where, value); in pci_ampci_read_config_word()
122 static int pci_ampci_read_config_dword(struct pci_bus *bus, unsigned int devfn, in pci_ampci_read_config_dword() argument
127 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { in pci_ampci_read_config_dword()
131 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); in pci_ampci_read_config_dword()
134 if (__query(bus, devfn)) in pci_ampci_read_config_dword()
135 __pcidebug("=> %08x", bus, devfn, where, value); in pci_ampci_read_config_dword()
142 static int pci_ampci_write_config_byte(struct pci_bus *bus, unsigned int devfn, in pci_ampci_write_config_byte() argument
147 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { in pci_ampci_write_config_byte()
151 if (bus->number == 0 && in pci_ampci_write_config_byte()
154 __pcidebug("<= %02x", bus, devfn, where, value); in pci_ampci_write_config_byte()
155 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); in pci_ampci_write_config_byte()
162 static int pci_ampci_write_config_word(struct pci_bus *bus, unsigned int devfn, in pci_ampci_write_config_word() argument
167 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { in pci_ampci_write_config_word()
171 if (__query(bus, devfn)) in pci_ampci_write_config_word()
172 __pcidebug("<= %04hx", bus, devfn, where, value); in pci_ampci_write_config_word()
173 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); in pci_ampci_write_config_word()
180 static int pci_ampci_write_config_dword(struct pci_bus *bus, unsigned int devfn, in pci_ampci_write_config_dword() argument
185 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { in pci_ampci_write_config_dword()
189 if (__query(bus, devfn)) in pci_ampci_write_config_dword()
190 __pcidebug("<= %08x", bus, devfn, where, value); in pci_ampci_write_config_dword()
191 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); in pci_ampci_write_config_dword()
198 static int pci_ampci_read_config(struct pci_bus *bus, unsigned int devfn, in pci_ampci_read_config() argument
203 return pci_ampci_read_config_byte(bus, devfn, where, val); in pci_ampci_read_config()
205 return pci_ampci_read_config_word(bus, devfn, where, val); in pci_ampci_read_config()
207 return pci_ampci_read_config_dword(bus, devfn, where, val); in pci_ampci_read_config()
214 static int pci_ampci_write_config(struct pci_bus *bus, unsigned int devfn, in pci_ampci_write_config() argument
219 return pci_ampci_write_config_byte(bus, devfn, where, val); in pci_ampci_write_config()
221 return pci_ampci_write_config_word(bus, devfn, where, val); in pci_ampci_write_config()
223 return pci_ampci_write_config_dword(bus, devfn, where, val); in pci_ampci_write_config()
247 struct pci_bus bus; /* Fake bus and device */ in pci_sanity_check() local
250 bus.number = 0; in pci_sanity_check()
252 if ((!o->read(&bus, 0, PCI_CLASS_DEVICE, 2, &x) && in pci_sanity_check()
254 (!o->read(&bus, 0, PCI_VENDOR_ID, 2, &x) && in pci_sanity_check()
288 if (!dev->bus) in pcibios_fixup_device_resources()
305 if (!dev->bus) in pcibios_fixup_bridge_resources()
322 void pcibios_fixup_bus(struct pci_bus *bus) in pcibios_fixup_bus() argument
326 if (bus->self) { in pcibios_fixup_bus()
327 pci_read_bridge_bases(bus); in pcibios_fixup_bus()
328 pcibios_fixup_bridge_resources(bus->self); in pcibios_fixup_bus()
331 list_for_each_entry(dev, &bus->devices, bus_list) in pcibios_fixup_bus()
345 struct pci_bus *bus; in pcibios_init() local
375 bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources); in pcibios_init()
376 if (!bus) in pcibios_init()
382 pci_bus_add_devices(bus); in pcibios_init()
411 static void __init unit_disable_pcnet(struct pci_bus *bus, struct pci_ops *o) in unit_disable_pcnet() argument
415 bus->number = 0; in unit_disable_pcnet()
417 o->read (bus, PCI_DEVFN(2, 0), PCI_VENDOR_ID, 4, &x); in unit_disable_pcnet()
418 o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); in unit_disable_pcnet()
422 o->write(bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, x); in unit_disable_pcnet()
423 o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); in unit_disable_pcnet()
424 o->write(bus, PCI_DEVFN(2, 0), PCI_BASE_ADDRESS_0, 4, 0x00030001); in unit_disable_pcnet()
425 o->read (bus, PCI_DEVFN(2, 0), PCI_BASE_ADDRESS_0, 4, &x); in unit_disable_pcnet()
450 struct pci_bus bus; /* Fake bus and device */ in unit_pci_init() local
456 memset(&bus, 0, sizeof(bus)); in unit_pci_init()
481 bus.number = 0; in unit_pci_init()
484 o->read (&bus, PCI_DEVFN(3, 0), PCI_COMMAND, 2, &x); in unit_pci_init()
488 o->write(&bus, PCI_DEVFN(3, 0), PCI_COMMAND, 2, x); in unit_pci_init()
490 o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE, 1, &x); in unit_pci_init()
491 o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE_UPPER16, 4, &x); in unit_pci_init()
492 o->read (&bus, PCI_DEVFN(3, 0), PCI_MEMORY_BASE, 4, &x); in unit_pci_init()
493 o->read (&bus, PCI_DEVFN(3, 0), PCI_PREF_MEMORY_BASE, 4, &x); in unit_pci_init()
495 o->write(&bus, PCI_DEVFN(3, 0), PCI_IO_BASE, 1, 0x01); in unit_pci_init()
496 o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE, 1, &x); in unit_pci_init()
497 o->write(&bus, PCI_DEVFN(3, 0), PCI_IO_BASE_UPPER16, 4, 0x00020000); in unit_pci_init()
498 o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE_UPPER16, 4, &x); in unit_pci_init()
499 o->write(&bus, PCI_DEVFN(3, 0), PCI_MEMORY_BASE, 4, 0xEBB0EA00); in unit_pci_init()
500 o->read (&bus, PCI_DEVFN(3, 0), PCI_MEMORY_BASE, 4, &x); in unit_pci_init()
501 o->write(&bus, PCI_DEVFN(3, 0), PCI_PREF_MEMORY_BASE, 4, 0xE9F0E800); in unit_pci_init()
502 o->read (&bus, PCI_DEVFN(3, 0), PCI_PREF_MEMORY_BASE, 4, &x); in unit_pci_init()
504 unit_disable_pcnet(&bus, o); in unit_pci_init()