/* * * Setting up a PCI * * pci_ctrl->first_busno = <first bus number (0)> * pci_ctrl->last_busno = <last bus number (0xff)> * pci_ctrl->ops = <PCI config operations> * pci_ctrl->map_irq = <function to return the interrupt number for a device> * * pci_ctrl->io_space.start = <IO space start address (PCI view)> * pci_ctrl->io_space.end = <IO space end address (PCI view)> * pci_ctrl->io_space.base = <IO space offset: address 0 from CPU space> * pci_ctrl->mem_space.start = <MEM space start address (PCI view)> * pci_ctrl->mem_space.end = <MEM space end address (PCI view)> * pci_ctrl->mem_space.base = <MEM space offset: address 0 from CPU space> * * pcibios_init_resource(&pci_ctrl->io_resource, <IO space start>, * <IO space end>, IORESOURCE_IO, "PCI host bridge"); * pcibios_init_resource(&pci_ctrl->mem_resources[0], <MEM space start>, * <MEM space end>, IORESOURCE_MEM, "PCI host bridge"); * * pci_ctrl->last_busno = pciauto_bus_scan(pci_ctrl,pci_ctrl->first_busno); * * int __init pciauto_bus_scan(struct pci_controller *pci_ctrl, int current_bus) *
*/
staticvoid __init
pciauto_setup_bars(struct pci_dev *dev, int bar_limit)
{ int bar_size; int bar, bar_nr; int *upper_limit; int found_mem64 = 0;
for (bar = PCI_BASE_ADDRESS_0, bar_nr = 0;
bar <= bar_limit;
bar+=4, bar_nr++)
{ /* Tickle the BAR and get the size */
pci_write_config_dword(dev, bar, 0xffffffff);
pci_read_config_dword(dev, bar, &bar_size);
/* If BAR is not implemented go to the next BAR */ if (!bar_size) continue;
/* Check the BAR type and set our address mask */ if (bar_size & PCI_BASE_ADDRESS_SPACE_IO)
{
bar_size &= PCI_BASE_ADDRESS_IO_MASK;
upper_limit = &pciauto_upper_iospc;
pr_debug("PCI Autoconfig: BAR %d, I/O, ", bar_nr);
} else
{ if ((bar_size & PCI_BASE_ADDRESS_MEM_TYPE_MASK) ==
PCI_BASE_ADDRESS_MEM_TYPE_64)
found_mem64 = 1;
/* Allocate PCI I/O and/or memory space */
pr_debug("PCI Autoconfig: Found Bus %d, Device %d, Function %d\n",
current_bus, PCI_SLOT(pci_devfn), PCI_FUNC(pci_devfn));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.