/* * Most of the IOC3 PCI config register aren't present * we emulate what is needed for a normal PCI enumeration
*/ staticint ioc3_cfg_rd(void *addr, int where, int size, u32 *value, u32 sid)
{
u32 cf, shift, mask;
/* * The Bridge ASIC supports both type 0 and type 1 access. Type 1 is * not really documented, so right now I can't write code which uses it. * Therefore we use type 0 accesses for now even though they won't work * correctly for PCI-to-PCI bridges. * * The function is complicated by the ultimate brokenness of the IOC3 chip * which is used in SGI systems. The IOC3 can only handle 32-bit PCI * accesses and does only decode parts of its address space.
*/ staticint pci_conf0_read_config(struct pci_bus *bus, unsignedint devfn, int where, int size, u32 *value)
{ struct bridge_controller *bc = BRIDGE_CONTROLLER(bus); struct bridge_regs *bridge = bc->base; int slot = PCI_SLOT(devfn); int fn = PCI_FUNC(devfn); void *addr;
u32 cf; int res;
addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID]; if (get_dbe(cf, (u32 *)addr)) return PCIBIOS_DEVICE_NOT_FOUND;
/* * IOC3 is broken beyond belief ... Don't even give the * generic PCI code a chance to look at it for real ...
*/ if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16))) {
addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2]; return ioc3_cfg_rd(addr, where, size, value,
bc->ioc3_sid[slot]);
}
/* * IOC3 is broken beyond belief ... Don't even give the * generic PCI code a chance to look at it for real ...
*/ if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16))) {
addr = &bridge->b_type1_cfg.c[(fn << 8) | (where & ~3)]; return ioc3_cfg_rd(addr, where, size, value,
bc->ioc3_sid[slot]);
}
staticint pci_conf0_write_config(struct pci_bus *bus, unsignedint devfn, int where, int size, u32 value)
{ struct bridge_controller *bc = BRIDGE_CONTROLLER(bus); struct bridge_regs *bridge = bc->base; int slot = PCI_SLOT(devfn); int fn = PCI_FUNC(devfn); void *addr;
u32 cf; int res;
addr = &bridge->b_type0_cfg_dev[slot].f[fn].c[PCI_VENDOR_ID]; if (get_dbe(cf, (u32 *)addr)) return PCIBIOS_DEVICE_NOT_FOUND;
/* * IOC3 is broken beyond belief ... Don't even give the * generic PCI code a chance to look at it for real ...
*/ if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16))) {
addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2]; return ioc3_cfg_wr(addr, where, size, value);
}
/* * IOC3 is broken beyond belief ... Don't even give the * generic PCI code a chance to look at it for real ...
*/ if (cf == (PCI_VENDOR_ID_SGI | (PCI_DEVICE_ID_SGI_IOC3 << 16))) {
addr = &bridge->b_type0_cfg_dev[slot].f[fn].l[where >> 2]; return ioc3_cfg_wr(addr, where, size, value);
}
staticint bridge_domain_activate(struct irq_domain *domain, struct irq_data *irqd, bool reserve)
{ struct bridge_irq_chip_data *data = irqd->chip_data; struct bridge_controller *bc = data->bc; int bit = irqd->parent_data->hwirq; int pin = irqd->hwirq;
u32 device;
bridge_write(bc, b_int_addr[pin].addr,
(((bc->intr_addr >> 30) & 0x30000) |
bit | (data->nasid << 8)));
bridge_set(bc, b_int_enable, (1 << pin));
bridge_set(bc, b_int_enable, 0x7ffffe00); /* more stuff in int_enable */
/* * Enable sending of an interrupt clear packet to the hub on a high to * low transition of the interrupt pin. * * IRIX sets additional bits in the address which are documented as * reserved in the bridge docs.
*/
bridge_set(bc, b_int_mode, (1UL << pin));
/* * We assume the bridge to have a 1:1 mapping between devices * (slots) and intr pins.
*/
device = bridge_read(bc, b_int_device);
device &= ~(7 << (pin*3));
device |= (pin << (pin*3));
bridge_write(bc, b_int_device, device);
/* * All observed requests have pin == 1. We could have a global here, that * gets incremented and returned every time - unfortunately, pci_map_irq * may be called on the same device over and over, and need to return the * same value. On O2000, pin can be 0 or 1, and PCI slots can be [0..7]. * * A given PCI device, in general, should be able to intr any of the cpus * on any one of the hubs connected to its xbow.
*/ staticint bridge_map_irq(conststruct pci_dev *dev, u8 slot, u8 pin)
{ struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus); struct irq_alloc_info info; int irq;
switch (pin) { case PCI_INTERRUPT_UNKNOWN: case PCI_INTERRUPT_INTA: case PCI_INTERRUPT_INTC:
pin = 0; break; case PCI_INTERRUPT_INTB: case PCI_INTERRUPT_INTD:
pin = 1;
}
staticvoid bridge_setup_board(struct bridge_controller *bc, char *partnum)
{ int i;
for (i = 0; i < ARRAY_SIZE(bridge_ioc3_devid); i++) if (!strncmp(partnum, bridge_ioc3_devid[i].match,
strlen(bridge_ioc3_devid[i].match))) {
bridge_ioc3_devid[i].setup(bc);
}
}
/* get part number from one wire prom */ if (bridge_get_partnum(virt_to_phys((void *)bd->bridge_addr), partnum)) return -EPROBE_DEFER; /* not available yet */
parent = irq_get_default_domain(); if (!parent) return -ENODEV;
fn = irq_domain_alloc_named_fwnode("BRIDGE"); if (!fn) return -ENOMEM;
domain = irq_domain_create_hierarchy(parent, 0, 8, fn,
&bridge_domain_ops, NULL); if (!domain) {
irq_domain_free_fwnode(fn); return -ENOMEM;
}
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.