/* * We can't use pci_get_device() here since we are * called from interrupt context.
*/ staticvoid pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, int warn)
{ struct pci_dev *dev;
/* * We don't use this to fix the device, but initialisation of it. * It's not the correct use for this, but it works. * Note that the arbiter/ISA bridge appears to be buggy, specifically in * the following area: * 1. park on CPU * 2. ISA bridge ping-pong * 3. ISA bridge master handling of target RETRY * * Bug 3 is responsible for the sound DMA grinding to a halt. We now * live with bug 2.
*/ staticvoid pci_fixup_83c553(struct pci_dev *dev)
{ /* * Set memory region to start at address 0, and enable IO
*/
pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_SPACE_MEMORY);
pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_IO);
/* * All memory requests from ISA to be channelled to PCI
*/
pci_write_config_byte(dev, 0x48, 0xff);
/* * Enable ping-pong on bus master to ISA bridge transactions. * This improves the sound DMA substantially. The fixed * priority arbiter also helps (see below).
*/
pci_write_config_byte(dev, 0x42, 0x01);
/* * We used to set the arbiter to "park on last master" (bit * 1 set), but unfortunately the CyberPro does not park the * bus. We must therefore park on CPU. Unfortunately, this * may trigger yet another bug in the 553.
*/
pci_write_config_byte(dev, 0x83, 0x02);
/* * Make the ISA DMA request lowest priority, and disable * rotating priorities completely.
*/
pci_write_config_byte(dev, 0x80, 0x11);
pci_write_config_byte(dev, 0x81, 0x00);
/* * Route INTA input to IRQ 11, and set IRQ11 to be level * sensitive.
*/
pci_write_config_word(dev, 0x44, 0xb000);
outb(0x08, 0x4d1);
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_83C553, pci_fixup_83c553);
/* * Prevent the PCI layer from seeing the resources allocated to this device * if it is the host bridge by marking it as such. These resources are of * no consequence to the PCI layer (they are handled elsewhere).
*/ staticvoid pci_fixup_dec21285(struct pci_dev *dev)
{ if (dev->devfn == 0) { struct resource *r;
/* * Put the DEC21142 to sleep
*/ staticvoid pci_fixup_dec21142(struct pci_dev *dev)
{
pci_write_config_dword(dev, 0x40, 0x80000000);
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142, pci_fixup_dec21142);
/* * The CY82C693 needs some rather major fixups to ensure that it does * the right thing. Idea from the Alpha people, with a few additions. * * We ensure that the IDE base registers are set to 1f0/3f4 for the * primary bus, and 170/374 for the secondary bus. Also, hide them * from the PCI subsystem view as well so we won't try to perform * our own auto-configuration on them. * * In addition, we ensure that the PCI IDE interrupts are routed to * IRQ 14 and IRQ 15 respectively. * * The above gets us to a point where the IDE on this device is * functional. However, The CY82C693U _does not work_ in bus * master mode without locking the PCI bus solid.
*/ staticvoid pci_fixup_cy82c693(struct pci_dev *dev)
{ if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
u32 base0, base1;
/* * Enable ISA master and DMA post write buffering.
*/
pci_write_config_byte(dev, 0x45, 0x03);
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, pci_fixup_cy82c693);
/* * If the bus contains any of these devices, then we must not turn on * parity checking of any kind. Currently this is CyberPro 20x0 only.
*/ staticinlineint pdev_bad_for_parity(struct pci_dev *dev)
{ return ((dev->vendor == PCI_VENDOR_ID_INTERG &&
(dev->device == PCI_DEVICE_ID_INTERG_2000 ||
dev->device == PCI_DEVICE_ID_INTERG_2010)) ||
(dev->vendor == PCI_VENDOR_ID_ITE &&
dev->device == PCI_DEVICE_ID_ITE_8152));
}
/* * pcibios_fixup_bus - Called after each bus is probed, * but before its children are examined.
*/ void pcibios_fixup_bus(struct pci_bus *bus)
{ struct pci_dev *dev;
u16 features = PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_FAST_BACK;
/* * Walk the devices on this bus, working out what we can * and can't support.
*/
list_for_each_entry(dev, &bus->devices, bus_list) {
u16 status;
pci_read_config_word(dev, PCI_STATUS, &status);
/* * If any device on this bus does not support fast back * to back transfers, then the bus as a whole is not able * to support them. Having fast back to back transfers * on saves us one PCI cycle per transaction.
*/ if (!(status & PCI_STATUS_FAST_BACK))
features &= ~PCI_COMMAND_FAST_BACK;
if (pdev_bad_for_parity(dev))
features &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
switch (dev->class >> 8) { case PCI_CLASS_BRIDGE_PCI:
pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &status);
status |= PCI_BRIDGE_CTL_PARITY|PCI_BRIDGE_CTL_MASTER_ABORT;
status &= ~(PCI_BRIDGE_CTL_BUS_RESET|PCI_BRIDGE_CTL_FAST_BACK);
pci_write_config_word(dev, PCI_BRIDGE_CONTROL, status); break;
case PCI_CLASS_BRIDGE_CARDBUS:
pci_read_config_word(dev, PCI_CB_BRIDGE_CONTROL, &status);
status |= PCI_CB_BRIDGE_CTL_PARITY|PCI_CB_BRIDGE_CTL_MASTER_ABORT;
pci_write_config_word(dev, PCI_CB_BRIDGE_CONTROL, status); break;
}
}
/* * Now walk the devices again, this time setting them up.
*/
list_for_each_entry(dev, &bus->devices, bus_list) {
u16 cmd;
/* * Propagate the flags to the PCI bridge.
*/ if (bus->self && bus->self->hdr_type == PCI_HEADER_TYPE_BRIDGE) { if (features & PCI_COMMAND_FAST_BACK)
bus->bridge_ctl |= PCI_BRIDGE_CTL_FAST_BACK; if (features & PCI_COMMAND_PARITY)
bus->bridge_ctl |= PCI_BRIDGE_CTL_PARITY;
}
/* * Report what we did for this bus
*/
pr_info("PCI: bus%d: Fast back to back transfers %sabled\n",
bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis");
}
EXPORT_SYMBOL(pcibios_fixup_bus);
/* * Swizzle the device pin each time we cross a bridge. If a platform does * not provide a swizzle function, we perform the standard PCI swizzling. * * The default swizzling walks up the bus tree one level at a time, applying * the standard swizzle function at each step, stopping when it finds the PCI * root bus. This will return the slot number of the bridge device on the * root bus and the interrupt pin on that device which should correspond * with the downstream device interrupt. * * Platforms may override this, in which case the slot and pin returned * depend entirely on the platform code. However, please note that the * PCI standard swizzle is implemented on plug-in cards and Cardbus based * PCI extenders, so it can not be ignored.
*/ static u8 pcibios_swizzle(struct pci_dev *dev, u8 *pin)
{ struct pci_sys_data *sys = dev->sysdata; int slot, oldpin = *pin;
ret = request_resource(&ioport_resource, &sys->io_res); if (ret) {
pr_err("PCI: unable to allocate I/O port region (%d)\n", ret); return ret;
}
pci_add_resource_offset(&sys->resources, &sys->io_res,
sys->io_offset);
/* * We insert PCI resources into the iomem_resource and * ioport_resource trees in either pci_bus_claim_resources() * or pci_bus_assign_resources().
*/ if (pci_has_flag(PCI_PROBE_ONLY)) {
pci_bus_claim_resources(bus);
} else { struct pci_bus *child;
/* * From arch/i386/kernel/pci-i386.c: * * We need to avoid collisions with `mirrored' VGA ports * and other strange ISA hardware, so we always want the * addresses to be allocated in the 0x000-0x0ff region * modulo 0x400. * * Why? Because some silly external IO cards only decode * the low 10 bits of the IO address. The 0x00-0xff region * is reserved for motherboard devices that decode all 16 * bits, so it's ok to allocate at, say, 0x2800-0x28ff, * but we want to try to avoid allocating at 0x2900-0x2bff * which might be mirrored at 0x0100-0x03ff..
*/
resource_size_t pcibios_align_resource(void *data, conststruct resource *res,
resource_size_t size, resource_size_t align)
{ struct pci_dev *dev = data;
resource_size_t start = res->start; struct pci_host_bridge *host_bridge;
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.