static int isab_pci_attach(device_t dev) { bus_generic_probe(dev); return (isab_attach(dev)); }
static int acpi_isab_attach(device_t dev) { struct acpi_isab_softc *sc; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); sc = device_get_softc(dev); sc->ap_dev = dev; sc->ap_handle = acpi_get_handle(dev); return (isab_attach(dev)); }
static int viapm_pro_attach(device_t dev) { struct viapm_softc *viapm = (struct viapm_softc *)device_get_softc(dev); u_int32_t l; mtx_init(&viapm->lock, device_get_nameunit(dev), "viapm", MTX_DEF); if (!(viapm->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &viapm->iorid, RF_ACTIVE))) { device_printf(dev, "could not allocate bus space\n"); goto error; } #ifdef notyet /* force irq 9 */ l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1); pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 0x80, 1); viapm->irqrid = 0; if (!(viapm->irqres = bus_alloc_resource(dev, SYS_RES_IRQ, &viapm->irqrid, 9, 9, 1, RF_SHAREABLE | RF_ACTIVE))) { device_printf(dev, "could not allocate irq\n"); goto error; } if (bus_setup_intr(dev, viapm->irqres, INTR_TYPE_MISC | INTR_MPSAFE, (driver_intr_t *) viasmb_intr, viapm, &viapm->irqih)) { device_printf(dev, "could not setup irq\n"); goto error; } #endif if (bootverbose) { l = pci_read_config(dev, VIAPM_PRO_REVID, 1); device_printf(dev, "SMBus revision code 0x%x\n", l); } viapm->smbus = device_add_child(dev, "smbus", -1); /* probe and attach the smbus */ bus_generic_attach(dev); /* disable slave function */ VIAPM_OUTB(SMBSCTRL, VIAPM_INB(SMBSCTRL) & ~SMBSCTRL_ENABLE); /* enable the SMBus controller function */ l = pci_read_config(dev, VIAPM_PRO_SMBCTRL, 1); pci_write_config(dev, VIAPM_PRO_SMBCTRL, l | 1, 1); #ifdef notyet /* enable interrupts */ VIAPM_OUTB(SMBHCTRL, VIAPM_INB(SMBHCTRL) | SMBHCTRL_ENABLE); #endif #ifdef DEV_ISA /* If this device is a PCI-ISA bridge, then attach an ISA bus. */ if ((pci_get_class(dev) == PCIC_BRIDGE) && (pci_get_subclass(dev) == PCIS_BRIDGE_ISA)) isab_attach(dev); #endif return 0; error: if (viapm->iores) bus_release_resource(dev, SYS_RES_IOPORT, viapm->iorid, viapm->iores); #ifdef notyet if (viapm->irqres) bus_release_resource(dev, SYS_RES_IRQ, viapm->irqrid, viapm->irqres); #endif mtx_destroy(&viapm->lock); return ENXIO; }