if ((tbus == bus_num) && (tdevice == dev_num)) {
*slot = tslot; return0;
} else { /* Did not get a match on the target PCI device. Check *ifthecurrentIRQtableentryisaPCI-to-PCI *bridgedevice.Ifso,anditssecondarybus *matchesthebusnumberforthetargetdevice,Ineed *tosavethebridge'sslotnumber.IfIcannotfind *anentryforthetargetdevice,Iwillhaveto *assumeit'sontheothersideofthebridge,and *assignitthebridge'sslot.
*/
bus->number = tbus;
pci_bus_read_config_dword(bus, PCI_DEVFN(tdevice, 0),
PCI_CLASS_REVISION, &work);
if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) {
pci_bus_read_config_dword(bus,
PCI_DEVFN(tdevice, 0),
PCI_PRIMARY_BUS, &work); // See if bridge's secondary bus matches target bus. if (((work >> 8) & 0x000000FF) == (long) bus_num)
bridgeSlot = tslot;
}
}
}
/* If we got here, we didn't find an entry in the IRQ mapping table for *thetargetPCIdevice.Ifwediddeterminethatthetargetdevice *isontheothersideofaPCI-to-PCIbridge,returntheslotnumber *forthebridge.
*/ if (bridgeSlot != 0xFF) {
*slot = bridgeSlot; return0;
} /* Couldn't find an entry in the routing table for this PCI device */ return -1;
}
/*FIXME: these capabilities aren't used but if they are *theyneedtobecorrectlyimplemented
*/
slot->capabilities |= PCISLOT_REPLACE_SUPPORTED;
slot->capabilities |= PCISLOT_INTERLOCK_SUPPORTED;
if (is_slot64bit(slot))
slot->capabilities |= PCISLOT_64_BIT_SUPPORTED; if (is_slot66mhz(slot))
slot->capabilities |= PCISLOT_66_MHZ_SUPPORTED; if (bus->cur_bus_speed == PCI_SPEED_66MHz)
slot->capabilities |= PCISLOT_66_MHZ_OPERATION;
/* FIXME: We also need to hook the NMI handler eventually. *thisalsoneedstobeworkedwithChristoph *register_NMI_handler();
*/ /* Map rom address */
cpqhp_rom_start = ioremap(ROM_PHY_ADDR, ROM_PHY_LEN); if (!cpqhp_rom_start) {
err("Could not ioremap memory region for ROM\n");
retval = -EIO; goto error;
}
/* Now, map the int15 entry point if we are on compaq specific *hardware
*/
compaq_nvram_init(cpqhp_rom_start);
/* Map smbios table entry point structure */
smbios_table = detect_SMBIOS_pointer(cpqhp_rom_start,
cpqhp_rom_start + ROM_PHY_LEN); if (!smbios_table) {
err("Could not find the SMBIOS pointer in memory\n");
retval = -EIO; goto error_rom_start;
}
smbios_start = ioremap(readl(smbios_table + ST_ADDRESS),
readw(smbios_table + ST_LENGTH)); if (!smbios_start) {
err("Could not ioremap memory region taken from SMBIOS values\n");
retval = -EIO; goto error_smbios_start;
}
bus = pdev->subordinate; if (!bus) {
pci_notice(pdev, "the device is not a bridge, skipping\n");
rc = -ENODEV; goto err_disable_device;
}
/* Need to read VID early b/c it's used to differentiate CPQ and INTC *discovery
*/
vendor_id = pdev->vendor; if ((vendor_id != PCI_VENDOR_ID_COMPAQ) &&
(vendor_id != PCI_VENDOR_ID_INTEL)) {
err(msg_HPC_non_compaq_or_intel);
rc = -ENODEV; goto err_disable_device;
}
dbg("Vendor ID: %x\n", vendor_id);
/* Check for the proper subsystem IDs *IntelusesadifferentSSIDprogrammingmodelthanCompaq. *ForIntel,eachSSIDbitidentifiesaPHPcapability. *AlsoIntelHPCsmayhaveRID=0.
*/ if ((pdev->revision <= 2) && (vendor_id != PCI_VENDOR_ID_INTEL)) {
err(msg_HPC_not_supported);
rc = -ENODEV; goto err_disable_device;
}
/* TODO: This code can be made to support non-Compaq or Intel *subsystemIDs
*/
subsystem_vid = pdev->subsystem_vendor;
dbg("Subsystem Vendor ID: %x\n", subsystem_vid); if ((subsystem_vid != PCI_VENDOR_ID_COMPAQ) && (subsystem_vid != PCI_VENDOR_ID_INTEL)) {
err(msg_HPC_non_compaq_or_intel);
rc = -ENODEV; goto err_disable_device;
}
case PCI_VENDOR_ID_INTEL: /* Check for speed capability (0=33, 1=66) */ if (subsystem_deviceid & 0x0001)
bus->max_bus_speed = PCI_SPEED_66MHz; else
bus->max_bus_speed = PCI_SPEED_33MHz;
/* Check for push button */ if (subsystem_deviceid & 0x0002)
ctrl->push_button = 0; else
ctrl->push_button = 1;
/* Check for slot switch type (0=mechanical, 1=not mechanical) */ if (subsystem_deviceid & 0x0004)
ctrl->slot_switch_type = 0; else
ctrl->slot_switch_type = 1;
/* PHP Status (0=De-feature PHP, 1=Normal operation) */ if (subsystem_deviceid & 0x0008)
ctrl->defeature_PHP = 1; /* PHP supported */ else
ctrl->defeature_PHP = 0; /* PHP not supported */
/* Alternate Base Address Register Interface *(0=notsupported,1=supported)
*/ if (subsystem_deviceid & 0x0010)
ctrl->alternate_base_address = 1; else
ctrl->alternate_base_address = 0;
/* PCI Config Space Index (0=not supported, 1=supported) */ if (subsystem_deviceid & 0x0020)
ctrl->pci_config_space = 1; else
ctrl->pci_config_space = 0;
/* PCI-X support */ if (subsystem_deviceid & 0x0080) {
ctrl->pcix_support = 1; if (subsystem_deviceid & 0x0040) /* 133MHz PCI-X if bit 7 is 1 */
ctrl->pcix_speed_capability = 1; else /* 100MHz PCI-X if bit 7 is 1 and bit 0 is 0, */ /* 66MHz PCI-X if bit 7 is 1 and bit 0 is 1 */
ctrl->pcix_speed_capability = 0;
} else { /* Conventional PCI */
ctrl->pcix_support = 0;
ctrl->pcix_speed_capability = 0;
} break;
/* make our own copy of the pci bus structure,
* as we like tweaking it a lot */
ctrl->pci_bus = kmemdup(pdev->bus, sizeof(*ctrl->pci_bus), GFP_KERNEL); if (!ctrl->pci_bus) {
err("out of memory\n");
rc = -ENOMEM; goto err_free_ctrl;
}
/* find the physical slot number of the first hot plug slot */
/* Get slot won't work for devices behind bridges, but *inthiscaseitwillalwaysbecalledforthe"base" *bus/dev/funcofaslot. *CS:thisisleveragingthePCIIRQroutingcodefromthekernel
* (pci-pc.c: get_irq_routing_table) */
rc = get_slot_mapping(ctrl->pci_bus, pdev->bus->number,
(readb(ctrl->hpc_reg + SLOT_MASK) >> 4),
&(ctrl->first_slot));
dbg("get_slot_mapping: first_slot = %d, returned = %d\n",
ctrl->first_slot, rc); if (rc) {
err(msg_initialization_err, rc); goto err_iounmap;
}
/* Store PCI Config Space for all devices on this bus */
rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK)); if (rc) {
err("%s: unable to save PCI configuration data, error %d\n",
__func__, rc); goto err_iounmap;
}
/* *GetIO,memory,andIRQresourcesfornewdevices
*/ /* The next line is required for cpqhp_find_available_resources */
ctrl->interrupt = pdev->irq; if (ctrl->interrupt < 0x10) {
cpqhp_legacy_mode = 1;
dbg("System seems to be configured for Full Table Mapped MPS mode\n");
}
/* Setup the slot information structures */
rc = ctrl_slot_setup(ctrl, smbios_start, smbios_table); if (rc) {
err(msg_initialization_err, 6);
err("%s: unable to save PCI configuration data, error %d\n",
__func__, rc); goto err_iounmap;
}
/* Mask all general input interrupts */
writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_MASK);
/* set up the interrupt */
dbg("HPC interrupt = %d\n", ctrl->interrupt); if (request_irq(ctrl->interrupt, cpqhp_ctrl_intr,
IRQF_SHARED, MY_NAME, ctrl)) {
err("Can't get irq %d for the hotplug pci controller\n",
ctrl->interrupt);
rc = -ENODEV; goto err_iounmap;
}
/* Enable Shift Out interrupt and clear it, also enable SERR on power *fault
*/
temp_word = readw(ctrl->hpc_reg + MISC);
temp_word |= 0x4006;
writew(temp_word, ctrl->hpc_reg + MISC);
/* Changed 05/05/97 to clear all interrupts at start */
writel(0xFFFFFFFFL, ctrl->hpc_reg + INT_INPUT_CLEAR);
/* We have to save the presence info for these slots */
temp_word = ctrl->ctrl_int_comp >> 16;
func->presence_save = (temp_word >> hp_slot) & 0x01;
func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02;
res = ctrl->io_head; while (res) {
tres = res;
res = res->next;
kfree(tres);
}
res = ctrl->mem_head; while (res) {
tres = res;
res = res->next;
kfree(tres);
}
res = ctrl->p_mem_head; while (res) {
tres = res;
res = res->next;
kfree(tres);
}
res = ctrl->bus_head; while (res) {
tres = res;
res = res->next;
kfree(tres);
}
kfree(ctrl->pci_bus);
tctrl = ctrl;
ctrl = ctrl->next;
kfree(tctrl);
}
for (loop = 0; loop < 256; loop++) {
next = cpqhp_slot_list[loop]; while (next != NULL) {
res = next->io_head; while (res) {
tres = res;
res = res->next;
kfree(tres);
}
res = next->mem_head; while (res) {
tres = res;
res = res->next;
kfree(tres);
}
res = next->p_mem_head; while (res) {
tres = res;
res = res->next;
kfree(tres);
}
res = next->bus_head; while (res) {
tres = res;
res = res->next;
kfree(tres);
}
TempSlot = next;
next = next->next;
kfree(TempSlot);
}
}
/* Stop the notification mechanism */ if (initialized)
cpqhp_event_stop_thread();
/* unmap the rom address */ if (cpqhp_rom_start)
iounmap(cpqhp_rom_start); if (smbios_start)
iounmap(smbios_start);
}
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.