Lines Matching refs:pci
55 static unsigned long pci_bar ( struct pci_device *pci, unsigned int reg ) { in pci_bar() argument
59 pci_read_config_dword ( pci, reg, &low ); in pci_bar()
62 pci_read_config_dword ( pci, reg + 4, &high ); in pci_bar()
90 unsigned long pci_bar_start ( struct pci_device *pci, unsigned int reg ) { in pci_bar_start() argument
93 bar = pci_bar ( pci, reg ); in pci_bar_start()
114 static void pci_read_bases ( struct pci_device *pci ) { in pci_read_bases() argument
119 bar = pci_bar ( pci, reg ); in pci_read_bases()
121 if ( ! pci->ioaddr ) in pci_read_bases()
122 pci->ioaddr = in pci_read_bases()
125 if ( ! pci->membase ) in pci_read_bases()
126 pci->membase = in pci_read_bases()
143 void adjust_pci_device ( struct pci_device *pci ) { in adjust_pci_device() argument
147 pci_read_config_word ( pci, PCI_COMMAND, &pci_command ); in adjust_pci_device()
152 "Updating PCI command %04x->%04x\n", pci->bus, in adjust_pci_device()
153 PCI_SLOT ( pci->devfn ), PCI_FUNC ( pci->devfn ), in adjust_pci_device()
155 pci_write_config_word ( pci, PCI_COMMAND, new_command ); in adjust_pci_device()
158 pci_read_config_byte ( pci, PCI_LATENCY_TIMER, &pci_latency); in adjust_pci_device()
161 "low at %d. Setting to 32.\n", pci->bus, in adjust_pci_device()
162 PCI_SLOT ( pci->devfn ), PCI_FUNC ( pci->devfn ), in adjust_pci_device()
164 pci_write_config_byte ( pci, PCI_LATENCY_TIMER, 32); in adjust_pci_device()
177 static int pci_probe ( struct pci_device *pci ) { in pci_probe() argument
184 "irq %d)\n", pci->bus, PCI_SLOT ( pci->devfn ), in pci_probe()
185 PCI_FUNC ( pci->devfn ), pci->vendor, pci->device, in pci_probe()
186 pci->membase, pci->ioaddr, pci->irq ); in pci_probe()
192 ( id->vendor != pci->vendor ) ) in pci_probe()
195 ( id->device != pci->device ) ) in pci_probe()
197 pci->driver = driver; in pci_probe()
198 pci->driver_name = id->name; in pci_probe()
199 DBG ( "...using driver %s\n", pci->driver_name ); in pci_probe()
200 if ( ( rc = driver->probe ( pci, id ) ) != 0 ) { in pci_probe()
217 static void pci_remove ( struct pci_device *pci ) { in pci_remove() argument
218 pci->driver->remove ( pci ); in pci_remove()
219 DBG ( "Removed PCI device %02x:%02x.%x\n", pci->bus, in pci_remove()
220 PCI_SLOT ( pci->devfn ), PCI_FUNC ( pci->devfn ) ); in pci_remove()
232 struct pci_device *pci = NULL; in pcibus_probe() local
245 if ( ! pci ) in pcibus_probe()
246 pci = malloc ( sizeof ( *pci ) ); in pcibus_probe()
247 if ( ! pci ) { in pcibus_probe()
251 memset ( pci, 0, sizeof ( *pci ) ); in pcibus_probe()
252 pci->bus = bus; in pcibus_probe()
253 pci->devfn = devfn; in pcibus_probe()
259 pci_read_config_byte ( pci, PCI_HEADER_TYPE, in pcibus_probe()
266 pci_read_config_dword ( pci, PCI_VENDOR_ID, &tmp ); in pcibus_probe()
271 pci->vendor = ( tmp & 0xffff ); in pcibus_probe()
272 pci->device = ( tmp >> 16 ); in pcibus_probe()
273 pci_read_config_dword ( pci, PCI_REVISION, &tmp ); in pcibus_probe()
274 pci->class = ( tmp >> 8 ); in pcibus_probe()
275 pci_read_config_byte ( pci, PCI_INTERRUPT_LINE, in pcibus_probe()
276 &pci->irq ); in pcibus_probe()
277 pci_read_bases ( pci ); in pcibus_probe()
280 snprintf ( pci->dev.name, sizeof ( pci->dev.name ), in pcibus_probe()
283 pci->dev.desc.bus_type = BUS_TYPE_PCI; in pcibus_probe()
284 pci->dev.desc.location = PCI_BUSDEVFN (bus, devfn); in pcibus_probe()
285 pci->dev.desc.vendor = pci->vendor; in pcibus_probe()
286 pci->dev.desc.device = pci->device; in pcibus_probe()
287 pci->dev.desc.class = pci->class; in pcibus_probe()
288 pci->dev.desc.ioaddr = pci->ioaddr; in pcibus_probe()
289 pci->dev.desc.irq = pci->irq; in pcibus_probe()
290 pci->dev.parent = &rootdev->dev; in pcibus_probe()
291 list_add ( &pci->dev.siblings, &rootdev->dev.children); in pcibus_probe()
292 INIT_LIST_HEAD ( &pci->dev.children ); in pcibus_probe()
295 if ( pci_probe ( pci ) == 0 ) { in pcibus_probe()
297 pci = NULL; in pcibus_probe()
300 list_del ( &pci->dev.siblings ); in pcibus_probe()
305 free ( pci ); in pcibus_probe()
309 free ( pci ); in pcibus_probe()
320 struct pci_device *pci; in pcibus_remove() local
323 list_for_each_entry_safe ( pci, tmp, &rootdev->dev.children, in pcibus_remove()
325 pci_remove ( pci ); in pcibus_remove()
326 list_del ( &pci->dev.siblings ); in pcibus_remove()
327 free ( pci ); in pcibus_remove()