Lines Matching refs:brdev
230 cbb_pci_probe(device_t brdev) in cbb_pci_probe() argument
241 if (cbb_chipset(pci_get_devid(brdev), &name) != CB_UNKNOWN) { in cbb_pci_probe()
242 device_set_desc(brdev, name); in cbb_pci_probe()
251 baseclass = pci_get_class(brdev); in cbb_pci_probe()
252 subclass = pci_get_subclass(brdev); in cbb_pci_probe()
253 progif = pci_get_progif(brdev); in cbb_pci_probe()
256 device_set_desc(brdev, "PCI-CardBus Bridge"); in cbb_pci_probe()
280 cbb_pci_attach(device_t brdev) in cbb_pci_attach() argument
286 struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev); in cbb_pci_attach()
292 parent = device_get_parent(brdev); in cbb_pci_attach()
293 mtx_init(&sc->mtx, device_get_nameunit(brdev), "cbb", MTX_DEF); in cbb_pci_attach()
294 sc->chipset = cbb_chipset(pci_get_devid(brdev), NULL); in cbb_pci_attach()
295 sc->dev = brdev; in cbb_pci_attach()
297 sc->domain = pci_get_domain(brdev); in cbb_pci_attach()
300 pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1); in cbb_pci_attach()
301 pcib_setup_secbus(brdev, &sc->bus, 1); in cbb_pci_attach()
303 sc->bus.sec = pci_read_config(brdev, PCIR_SECBUS_2, 1); in cbb_pci_attach()
304 sc->bus.sub = pci_read_config(brdev, PCIR_SUBBUS_2, 1); in cbb_pci_attach()
309 sc->base_res = bus_alloc_resource_any(brdev, SYS_RES_MEMORY, &rid, in cbb_pci_attach()
312 device_printf(brdev, "Could not map register memory\n"); in cbb_pci_attach()
316 DEVPRINTF((brdev, "Found memory at %jx\n", in cbb_pci_attach()
321 sc->cbdev = device_add_child(brdev, "cardbus", -1); in cbb_pci_attach()
323 DEVPRINTF((brdev, "WARNING: cannot add cardbus bus.\n")); in cbb_pci_attach()
325 DEVPRINTF((brdev, "WARNING: cannot attach cardbus bus!\n")); in cbb_pci_attach()
329 exca_init(&sc->exca, brdev, sc->bst, sc->bsh, CBB_EXCA_OFFSET); in cbb_pci_attach()
336 sctx = device_get_sysctl_ctx(brdev); in cbb_pci_attach()
337 soid = device_get_sysctl_tree(brdev); in cbb_pci_attach()
364 DEVPRINTF((brdev, "Secondary bus is %d\n", sc->bus.sec)); in cbb_pci_attach()
365 pribus = pci_read_config(brdev, PCIR_PRIBUS_2, 1); in cbb_pci_attach()
370 DEVPRINTF((brdev, "Setting primary bus to %d\n", in cbb_pci_attach()
372 pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1); in cbb_pci_attach()
376 DEVPRINTF((brdev, "Secondary bus set to %d subbus %d\n", in cbb_pci_attach()
378 pci_write_config(brdev, PCIR_SECBUS_2, sc->bus.sec, 1); in cbb_pci_attach()
379 pci_write_config(brdev, PCIR_SUBBUS_2, sc->bus.sub, 1); in cbb_pci_attach()
385 sc->irq_res = bus_alloc_resource_any(brdev, SYS_RES_IRQ, &rid, in cbb_pci_attach()
388 device_printf(brdev, "Unable to map IRQ...\n"); in cbb_pci_attach()
392 if (bus_setup_intr(brdev, sc->irq_res, INTR_TYPE_AV | INTR_MPSAFE, in cbb_pci_attach()
394 device_printf(brdev, "couldn't establish interrupt\n"); in cbb_pci_attach()
402 cbb_power(brdev, CARD_OFF); in cbb_pci_attach()
411 cbb_print_config(brdev); in cbb_pci_attach()
415 "%s event thread", device_get_nameunit(brdev))) { in cbb_pci_attach()
416 device_printf(brdev, "unable to create event thread.\n"); in cbb_pci_attach()
423 bus_release_resource(brdev, SYS_RES_IRQ, 0, sc->irq_res); in cbb_pci_attach()
425 bus_release_resource(brdev, SYS_RES_MEMORY, CBBR_SOCKBASE, in cbb_pci_attach()
433 cbb_pci_detach(device_t brdev) in cbb_pci_detach() argument
436 struct cbb_softc *sc = device_get_softc(brdev); in cbb_pci_detach()
440 error = cbb_detach(brdev); in cbb_pci_detach()
443 pcib_free_secbus(brdev, &sc->bus); in cbb_pci_detach()
665 cbb_pci_shutdown(device_t brdev) in cbb_pci_shutdown() argument
667 struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev); in cbb_pci_shutdown()
679 PCI_MASK_CONFIG(brdev, CBBR_BRIDGECTRL, |CBBM_BRIDGECTRL_RESET, 2); in cbb_pci_shutdown()
683 cbb_power(brdev, CARD_OFF); in cbb_pci_shutdown()
690 pci_write_config(brdev, CBBR_MEMBASE0, 0, 4); in cbb_pci_shutdown()
691 pci_write_config(brdev, CBBR_MEMLIMIT0, 0, 4); in cbb_pci_shutdown()
692 pci_write_config(brdev, CBBR_MEMBASE1, 0, 4); in cbb_pci_shutdown()
693 pci_write_config(brdev, CBBR_MEMLIMIT1, 0, 4); in cbb_pci_shutdown()
694 pci_write_config(brdev, CBBR_IOBASE0, 0, 4); in cbb_pci_shutdown()
695 pci_write_config(brdev, CBBR_IOLIMIT0, 0, 4); in cbb_pci_shutdown()
696 pci_write_config(brdev, CBBR_IOBASE1, 0, 4); in cbb_pci_shutdown()
697 pci_write_config(brdev, CBBR_IOLIMIT1, 0, 4); in cbb_pci_shutdown()
850 cbb_maxslots(device_t brdev) in cbb_maxslots() argument
856 cbb_read_config(device_t brdev, u_int b, u_int s, u_int f, u_int reg, int width) in cbb_read_config() argument
861 return (PCIB_READ_CONFIG(device_get_parent(device_get_parent(brdev)), in cbb_read_config()
866 cbb_write_config(device_t brdev, u_int b, u_int s, u_int f, u_int reg, uint32_t val, in cbb_write_config() argument
872 PCIB_WRITE_CONFIG(device_get_parent(device_get_parent(brdev)), in cbb_write_config()
877 cbb_pci_suspend(device_t brdev) in cbb_pci_suspend() argument
880 struct cbb_softc *sc = device_get_softc(brdev); in cbb_pci_suspend()
882 error = bus_generic_suspend(brdev); in cbb_pci_suspend()
891 cbb_pci_resume(device_t brdev) in cbb_pci_resume() argument
894 struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev); in cbb_pci_resume()
921 error = bus_generic_resume(brdev); in cbb_pci_resume()