Lines Matching +full:child +full:- +full:interrupt +full:- +full:base
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
71 static int pcib_reset_child(device_t dev, device_t child, int flags);
147 "Clear firmware-assigned resources for PCI-PCI bridge I/O windows.");
150 * Get the corresponding window if this resource from a child device was
151 * sub-allocated from one of our window resource managers.
158 if (rman_is_region_manager(r, &sc->io.rman)) in pcib_get_resource_window()
159 return (&sc->io); in pcib_get_resource_window()
164 rman_is_region_manager(r, &sc->pmem.rman)) in pcib_get_resource_window()
165 return (&sc->pmem); in pcib_get_resource_window()
166 if (rman_is_region_manager(r, &sc->mem.rman)) in pcib_get_resource_window()
167 return (&sc->mem); in pcib_get_resource_window()
174 * Is a resource from a child device sub-allocated from one of our
182 return (rman_is_region_manager(r, &sc->bus.rman)); in pcib_is_resource_managed()
190 return (pw->valid && pw->base < pw->limit); in pcib_is_window_open()
203 PCI_ENABLE_IO(device_get_parent(sc->dev), sc->dev, type); in pcib_activate_window()
212 dev = sc->dev; in pcib_write_windows()
213 if (sc->io.valid && mask & WIN_IO) { in pcib_write_windows()
217 sc->io.base >> 16, 2); in pcib_write_windows()
219 sc->io.limit >> 16, 2); in pcib_write_windows()
221 pci_write_config(dev, PCIR_IOBASEL_1, sc->io.base >> 8, 1); in pcib_write_windows()
222 pci_write_config(dev, PCIR_IOLIMITL_1, sc->io.limit >> 8, 1); in pcib_write_windows()
226 pci_write_config(dev, PCIR_MEMBASE_1, sc->mem.base >> 16, 2); in pcib_write_windows()
227 pci_write_config(dev, PCIR_MEMLIMIT_1, sc->mem.limit >> 16, 2); in pcib_write_windows()
230 if (sc->pmem.valid && mask & WIN_PMEM) { in pcib_write_windows()
234 sc->pmem.base >> 32, 4); in pcib_write_windows()
236 sc->pmem.limit >> 32, 4); in pcib_write_windows()
238 pci_write_config(dev, PCIR_PMBASEL_1, sc->pmem.base >> 16, 2); in pcib_write_windows()
239 pci_write_config(dev, PCIR_PMLIMITL_1, sc->pmem.limit >> 16, 2); in pcib_write_windows()
253 if (!(sc->bridgectl & PCIB_BCR_ISA_ENABLE)) in pcib_is_isa_range()
257 if (start + count - 1 != end) in pcib_is_isa_range()
264 /* Check for overlap with 0x000 - 0x0ff as a special case. */ in pcib_is_isa_range()
282 device_printf(sc->dev, in pcib_is_isa_range()
283 "I/O range %#jx-%#jx overlaps with an ISA alias\n", start, in pcib_is_isa_range()
295 newarray = malloc(sizeof(struct resource *) * (w->count + count), in pcib_add_window_resources()
297 if (w->res != NULL) in pcib_add_window_resources()
298 bcopy(w->res, newarray, sizeof(struct resource *) * w->count); in pcib_add_window_resources()
299 bcopy(res, newarray + w->count, sizeof(struct resource *) * count); in pcib_add_window_resources()
300 free(w->res, M_DEVBUF); in pcib_add_window_resources()
301 w->res = newarray; in pcib_add_window_resources()
302 w->count += count; in pcib_add_window_resources()
305 error = rman_manage_region(&w->rman, rman_get_start(res[i]), in pcib_add_window_resources()
322 * of the next non-alias range. As a special case, addresses in pcib_walk_nonisa_ranges()
323 * in the range 0x000 - 0x0ff should also be skipped since in pcib_walk_nonisa_ranges()
368 if (as->error != 0) in alloc_ranges()
371 w = &as->sc->io; in alloc_ranges()
372 rid = w->reg; in alloc_ranges()
374 device_printf(as->sc->dev, in alloc_ranges()
375 "allocating non-ISA range %#jx-%#jx\n", start, end); in alloc_ranges()
376 as->res[as->count] = bus_alloc_resource(as->sc->dev, SYS_RES_IOPORT, in alloc_ranges()
377 &rid, start, end, end - start + 1, RF_ACTIVE | RF_UNMAPPED); in alloc_ranges()
378 if (as->res[as->count] == NULL) in alloc_ranges()
379 as->error = ENXIO; in alloc_ranges()
381 as->count++; in alloc_ranges()
403 bus_release_resource(sc->dev, SYS_RES_IOPORT, in pcib_alloc_nonisa_ranges()
404 sc->io.reg, as.res[i]); in pcib_alloc_nonisa_ranges()
411 pcib_add_window_resources(&sc->io, as.res, as.count); in pcib_alloc_nonisa_ranges()
426 w->rman.rm_start = 0; in pcib_alloc_window()
427 w->rman.rm_end = max_address; in pcib_alloc_window()
428 w->rman.rm_type = RMAN_ARRAY; in pcib_alloc_window()
430 device_get_nameunit(sc->dev), w->name); in pcib_alloc_window()
431 w->rman.rm_descr = strdup(buf, M_DEVBUF); in pcib_alloc_window()
432 error = rman_init(&w->rman); in pcib_alloc_window()
435 device_get_nameunit(sc->dev), w->name); in pcib_alloc_window()
440 if (w->base > max_address || w->limit > max_address) { in pcib_alloc_window()
441 device_printf(sc->dev, in pcib_alloc_window()
442 "initial %s window has too many bits, ignoring\n", w->name); in pcib_alloc_window()
445 if (type == SYS_RES_IOPORT && sc->bridgectl & PCIB_BCR_ISA_ENABLE) in pcib_alloc_window()
446 (void)pcib_alloc_nonisa_ranges(sc, w->base, w->limit); in pcib_alloc_window()
448 rid = w->reg; in pcib_alloc_window()
449 res = bus_alloc_resource(sc->dev, type, &rid, w->base, w->limit, in pcib_alloc_window()
450 w->limit - w->base + 1, flags | RF_ACTIVE | RF_UNMAPPED); in pcib_alloc_window()
454 if (w->res == NULL) { in pcib_alloc_window()
455 device_printf(sc->dev, in pcib_alloc_window()
456 "failed to allocate initial %s window: %#jx-%#jx\n", in pcib_alloc_window()
457 w->name, (uintmax_t)w->base, (uintmax_t)w->limit); in pcib_alloc_window()
458 w->base = max_address; in pcib_alloc_window()
459 w->limit = 0; in pcib_alloc_window()
460 pcib_write_windows(sc, w->mask); in pcib_alloc_window()
476 dev = sc->dev; in pcib_probe_windows()
486 * If 'val' is zero, then only 16-bits of I/O space in pcib_probe_windows()
491 sc->io.valid = 1; in pcib_probe_windows()
495 sc->io.valid = 1; in pcib_probe_windows()
498 if (sc->io.valid) { in pcib_probe_windows()
499 sc->io.reg = PCIR_IOBASEL_1; in pcib_probe_windows()
500 sc->io.step = 12; in pcib_probe_windows()
501 sc->io.mask = WIN_IO; in pcib_probe_windows()
502 sc->io.name = "I/O port"; in pcib_probe_windows()
504 sc->io.base = PCI_PPBIOBASE( in pcib_probe_windows()
506 sc->io.limit = PCI_PPBIOLIMIT( in pcib_probe_windows()
511 sc->io.base = PCI_PPBIOBASE(0, val); in pcib_probe_windows()
512 sc->io.limit = PCI_PPBIOLIMIT(0, in pcib_probe_windows()
516 pcib_alloc_window(sc, &sc->io, SYS_RES_IOPORT, 0, max); in pcib_probe_windows()
520 sc->mem.valid = 1; in pcib_probe_windows()
521 sc->mem.reg = PCIR_MEMBASE_1; in pcib_probe_windows()
522 sc->mem.step = 20; in pcib_probe_windows()
523 sc->mem.mask = WIN_MEM; in pcib_probe_windows()
524 sc->mem.name = "memory"; in pcib_probe_windows()
525 sc->mem.base = PCI_PPBMEMBASE(0, in pcib_probe_windows()
527 sc->mem.limit = PCI_PPBMEMLIMIT(0, in pcib_probe_windows()
529 pcib_alloc_window(sc, &sc->mem, SYS_RES_MEMORY, 0, 0xffffffff); in pcib_probe_windows()
535 * If 'val' is zero, then only 32-bits of memory space in pcib_probe_windows()
540 sc->pmem.valid = 1; in pcib_probe_windows()
544 sc->pmem.valid = 1; in pcib_probe_windows()
547 if (sc->pmem.valid) { in pcib_probe_windows()
548 sc->pmem.reg = PCIR_PMBASEL_1; in pcib_probe_windows()
549 sc->pmem.step = 20; in pcib_probe_windows()
550 sc->pmem.mask = WIN_PMEM; in pcib_probe_windows()
551 sc->pmem.name = "prefetch"; in pcib_probe_windows()
553 sc->pmem.base = PCI_PPBMEMBASE( in pcib_probe_windows()
555 sc->pmem.limit = PCI_PPBMEMLIMIT( in pcib_probe_windows()
560 sc->pmem.base = PCI_PPBMEMBASE(0, val); in pcib_probe_windows()
561 sc->pmem.limit = PCI_PPBMEMLIMIT(0, in pcib_probe_windows()
565 pcib_alloc_window(sc, &sc->pmem, SYS_RES_MEMORY, in pcib_probe_windows()
576 if (!w->valid) in pcib_release_window()
579 dev = sc->dev; in pcib_release_window()
580 error = rman_fini(&w->rman); in pcib_release_window()
582 device_printf(dev, "failed to release %s rman\n", w->name); in pcib_release_window()
585 free(__DECONST(char *, w->rman.rm_descr), M_DEVBUF); in pcib_release_window()
587 for (i = 0; i < w->count; i++) { in pcib_release_window()
588 error = bus_free_resource(dev, type, w->res[i]); in pcib_release_window()
591 "failed to release %s resource: %d\n", w->name, in pcib_release_window()
594 free(w->res, M_DEVBUF); in pcib_release_window()
601 pcib_release_window(sc, &sc->pmem, SYS_RES_MEMORY); in pcib_free_windows()
602 pcib_release_window(sc, &sc->mem, SYS_RES_MEMORY); in pcib_free_windows()
603 pcib_release_window(sc, &sc->io, SYS_RES_IOPORT); in pcib_free_windows()
621 bus->sub_reg = PCIR_SUBBUS_1; in pcib_setup_secbus()
625 bus->sub_reg = PCIR_SUBBUS_2; in pcib_setup_secbus()
630 bus->sec = pci_read_config(dev, sec_reg, 1); in pcib_setup_secbus()
631 bus->sub = pci_read_config(dev, bus->sub_reg, 1); in pcib_setup_secbus()
632 bus->dev = dev; in pcib_setup_secbus()
633 bus->rman.rm_start = 0; in pcib_setup_secbus()
634 bus->rman.rm_end = PCI_BUSMAX; in pcib_setup_secbus()
635 bus->rman.rm_type = RMAN_ARRAY; in pcib_setup_secbus()
637 bus->rman.rm_descr = strdup(buf, M_DEVBUF); in pcib_setup_secbus()
638 error = rman_init(&bus->rman); in pcib_setup_secbus()
648 bus->res = bus_alloc_resource_anywhere(dev, PCI_RES_BUS, &rid, in pcib_setup_secbus()
650 if (bus->res == NULL) { in pcib_setup_secbus()
655 bus->res = bus_alloc_resource_anywhere(dev, PCI_RES_BUS, &rid, in pcib_setup_secbus()
657 } else if (rman_get_size(bus->res) < min_count) in pcib_setup_secbus()
662 (void)bus_adjust_resource(dev, PCI_RES_BUS, bus->res, in pcib_setup_secbus()
663 rman_get_start(bus->res), rman_get_start(bus->res) + in pcib_setup_secbus()
664 min_count - 1); in pcib_setup_secbus()
669 if (bus->res != NULL) { in pcib_setup_secbus()
670 error = rman_manage_region(&bus->rman, rman_get_start(bus->res), in pcib_setup_secbus()
671 rman_get_end(bus->res)); in pcib_setup_secbus()
674 bus->sec = rman_get_start(bus->res); in pcib_setup_secbus()
675 bus->sub = rman_get_end(bus->res); in pcib_setup_secbus()
684 error = rman_fini(&bus->rman); in pcib_free_secbus()
689 free(__DECONST(char *, bus->rman.rm_descr), M_DEVBUF); in pcib_free_secbus()
691 error = bus_free_resource(dev, PCI_RES_BUS, bus->res); in pcib_free_secbus()
698 pcib_suballoc_bus(struct pcib_secbus *bus, device_t child, int *rid, in pcib_suballoc_bus() argument
703 res = rman_reserve_resource(&bus->rman, start, end, count, flags, in pcib_suballoc_bus()
704 child); in pcib_suballoc_bus()
709 device_printf(bus->dev, in pcib_suballoc_bus()
710 "allocated bus range (%ju-%ju) for rid %d of %s\n", in pcib_suballoc_bus()
712 pcib_child_name(child)); in pcib_suballoc_bus()
729 old_end = rman_get_end(bus->res); in pcib_grow_subbus()
731 error = bus_adjust_resource(bus->dev, PCI_RES_BUS, bus->res, in pcib_grow_subbus()
732 rman_get_start(bus->res), new_end); in pcib_grow_subbus()
736 device_printf(bus->dev, "grew bus range to %ju-%ju\n", in pcib_grow_subbus()
737 rman_get_start(bus->res), rman_get_end(bus->res)); in pcib_grow_subbus()
738 error = rman_manage_region(&bus->rman, old_end + 1, in pcib_grow_subbus()
739 rman_get_end(bus->res)); in pcib_grow_subbus()
742 bus->sub = rman_get_end(bus->res); in pcib_grow_subbus()
743 pci_write_config(bus->dev, bus->sub_reg, bus->sub, 1); in pcib_grow_subbus()
748 pcib_alloc_subbus(struct pcib_secbus *bus, device_t child, int *rid, in pcib_alloc_subbus() argument
758 res = pcib_suballoc_bus(bus, child, rid, start, end, count, flags); in pcib_alloc_subbus()
767 if (rman_last_free_region(&bus->rman, &start_free, &end_free) != 0 || in pcib_alloc_subbus()
768 end_free != bus->sub) in pcib_alloc_subbus()
769 start_free = bus->sub + 1; in pcib_alloc_subbus()
772 new_end = start_free + count - 1; in pcib_alloc_subbus()
783 device_printf(bus->dev, in pcib_alloc_subbus()
785 printf("\tback candidate range: %ju-%ju\n", start_free, in pcib_alloc_subbus()
789 return (pcib_suballoc_bus(bus, child, rid, start, end, count, in pcib_alloc_subbus()
796 * PCI-express HotPlug support.
801 "Enable support for native PCI-express HotPlug.");
815 dev = sc->dev; in pcib_probe_hotplug()
822 sc->pcie_slot_cap = pcie_read_config(dev, PCIER_SLOT_CAP, 4); in pcib_probe_hotplug()
824 if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_HPC) == 0) in pcib_probe_hotplug()
832 * do not. Since they always report that the MRL is open, child in pcib_probe_hotplug()
839 if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_MRLSP) != 0) { in pcib_probe_hotplug()
858 sc->flags |= PCIB_HOTPLUG; in pcib_probe_hotplug()
875 dev = sc->dev; in pcib_pcie_hotplug_command()
877 if (sc->flags & PCIB_HOTPLUG_CMD_PENDING) in pcib_pcie_hotplug_command()
885 device_printf(dev, "HotPlug command: %04x -> %04x\n", ctl, new); in pcib_pcie_hotplug_command()
887 if (!(sc->pcie_slot_cap & PCIEM_SLOT_CAP_NCCS) && in pcib_pcie_hotplug_command()
889 sc->flags |= PCIB_HOTPLUG_CMD_PENDING; in pcib_pcie_hotplug_command()
892 &sc->pcie_cc_task, hz); in pcib_pcie_hotplug_command()
901 dev = sc->dev; in pcib_pcie_hotplug_command_completed()
905 if (!(sc->flags & PCIB_HOTPLUG_CMD_PENDING)) in pcib_pcie_hotplug_command_completed()
907 taskqueue_cancel_timeout(taskqueue_pci_hp, &sc->pcie_cc_task, NULL); in pcib_pcie_hotplug_command_completed()
908 sc->flags &= ~PCIB_HOTPLUG_CMD_PENDING; in pcib_pcie_hotplug_command_completed()
922 if (sc->flags & PCIB_DETACHING) in pcib_hotplug_inserted()
926 if ((sc->pcie_slot_sta & PCIEM_SLOT_STA_PDS) == 0) in pcib_hotplug_inserted()
930 if (sc->pcie_slot_sta & PCIEM_SLOT_STA_PFD) in pcib_hotplug_inserted()
934 if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_MRLSP && in pcib_hotplug_inserted()
935 (sc->pcie_slot_sta & PCIEM_SLOT_STA_MRLSS) != 0) in pcib_hotplug_inserted()
942 * Returns -1 if the card is fully inserted, powered, and ready for
954 if (!(sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE)) in pcib_hotplug_present()
957 return (-1); in pcib_hotplug_present()
963 "Enable support for PCI-express Electromechanical Interlock.");
972 if ((sc->pcie_slot_sta & (PCIEM_SLOT_STA_PDC | PCIEM_SLOT_STA_PDS)) == in pcib_pcie_hotplug_update()
974 sc->flags &= ~PCIB_DETACHING; in pcib_pcie_hotplug_update()
979 if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_PIP) { in pcib_pcie_hotplug_update()
983 else if (sc->flags & PCIB_DETACH_PENDING) in pcib_pcie_hotplug_update()
990 if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_PCP) { in pcib_pcie_hotplug_update()
1004 if ((sc->pcie_slot_cap & PCIEM_SLOT_CAP_EIP) && in pcib_pcie_hotplug_update()
1007 ei_engaged = (sc->pcie_slot_sta & PCIEM_SLOT_STA_EIS) != 0; in pcib_pcie_hotplug_update()
1015 * changed on this interrupt. Stop any scheduled timer if in pcib_pcie_hotplug_update()
1019 !(sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE) && in pcib_pcie_hotplug_update()
1020 sc->pcie_slot_sta & in pcib_pcie_hotplug_update()
1023 device_printf(sc->dev, in pcib_pcie_hotplug_update()
1027 &sc->pcie_dll_task, hz); in pcib_pcie_hotplug_update()
1028 } else if (sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE) in pcib_pcie_hotplug_update()
1029 taskqueue_cancel_timeout(taskqueue_pci_hp, &sc->pcie_dll_task, in pcib_pcie_hotplug_update()
1035 * During attach the child "pci" device is added synchronously; in pcib_pcie_hotplug_update()
1036 * otherwise, the task is scheduled to manage the child in pcib_pcie_hotplug_update()
1040 (pcib_hotplug_present(sc) != 0) != (sc->child != NULL)) in pcib_pcie_hotplug_update()
1041 taskqueue_enqueue(taskqueue_pci_hp, &sc->pcie_hp_task); in pcib_pcie_hotplug_update()
1052 dev = sc->dev; in pcib_pcie_intr_hotplug()
1054 old_slot_sta = sc->pcie_slot_sta; in pcib_pcie_intr_hotplug()
1055 sc->pcie_slot_sta = pcie_read_config(dev, PCIER_SLOT_STA, 2); in pcib_pcie_intr_hotplug()
1058 pcie_write_config(dev, PCIER_SLOT_STA, sc->pcie_slot_sta, 2); in pcib_pcie_intr_hotplug()
1061 device_printf(dev, "HotPlug interrupt: %#x\n", in pcib_pcie_intr_hotplug()
1062 sc->pcie_slot_sta); in pcib_pcie_intr_hotplug()
1064 if (sc->pcie_slot_sta & PCIEM_SLOT_STA_ABP) { in pcib_pcie_intr_hotplug()
1065 if (sc->flags & PCIB_DETACH_PENDING) { in pcib_pcie_intr_hotplug()
1068 sc->flags &= ~PCIB_DETACH_PENDING; in pcib_pcie_intr_hotplug()
1070 &sc->pcie_ab_task, NULL); in pcib_pcie_intr_hotplug()
1075 sc->flags |= PCIB_DETACH_PENDING; in pcib_pcie_intr_hotplug()
1077 &sc->pcie_ab_task, 5 * hz); in pcib_pcie_intr_hotplug()
1080 if (sc->pcie_slot_sta & PCIEM_SLOT_STA_PFD) in pcib_pcie_intr_hotplug()
1082 if (sc->pcie_slot_sta & PCIEM_SLOT_STA_MRLSC) in pcib_pcie_intr_hotplug()
1084 sc->pcie_slot_sta & PCIEM_SLOT_STA_MRLSS ? "open" : in pcib_pcie_intr_hotplug()
1086 if (bootverbose && sc->pcie_slot_sta & PCIEM_SLOT_STA_PDC) in pcib_pcie_intr_hotplug()
1088 sc->pcie_slot_sta & PCIEM_SLOT_STA_PDS ? "card present" : in pcib_pcie_intr_hotplug()
1090 if (sc->pcie_slot_sta & PCIEM_SLOT_STA_CC) in pcib_pcie_intr_hotplug()
1092 if (sc->pcie_slot_sta & PCIEM_SLOT_STA_DLLSC) { in pcib_pcie_intr_hotplug()
1093 sc->pcie_link_sta = pcie_read_config(dev, PCIER_LINK_STA, 2); in pcib_pcie_intr_hotplug()
1097 sc->pcie_link_sta & PCIEM_LINK_STA_DL_ACTIVE ? in pcib_pcie_intr_hotplug()
1113 dev = sc->dev; in pcib_pcie_hotplug_task()
1115 if (sc->child == NULL) { in pcib_pcie_hotplug_task()
1116 sc->child = device_add_child(dev, "pci", DEVICE_UNIT_ANY); in pcib_pcie_hotplug_task()
1120 if (sc->child != NULL) { in pcib_pcie_hotplug_task()
1121 if (device_delete_child(dev, sc->child) == 0) in pcib_pcie_hotplug_task()
1122 sc->child = NULL; in pcib_pcie_hotplug_task()
1134 if (sc->flags & PCIB_DETACH_PENDING) { in pcib_pcie_ab_timeout()
1135 sc->flags |= PCIB_DETACHING; in pcib_pcie_ab_timeout()
1136 sc->flags &= ~PCIB_DETACH_PENDING; in pcib_pcie_ab_timeout()
1146 device_t dev = sc->dev; in pcib_pcie_cc_timeout()
1153 sc->flags &= ~PCIB_HOTPLUG_CMD_PENDING; in pcib_pcie_cc_timeout()
1156 "Missed HotPlug interrupt waiting for Command Completion\n"); in pcib_pcie_cc_timeout()
1166 device_t dev = sc->dev; in pcib_pcie_dll_timeout()
1174 sc->flags |= PCIB_DETACHING; in pcib_pcie_dll_timeout()
1176 } else if (sta != sc->pcie_link_sta) { in pcib_pcie_dll_timeout()
1178 "Missed HotPlug interrupt waiting for DLL Active\n"); in pcib_pcie_dll_timeout()
1190 rid = -1; in pcib_alloc_pcie_irq()
1191 dev = sc->dev; in pcib_alloc_pcie_irq()
1194 * For simplicity, only use MSI-X if there is a single message. in pcib_alloc_pcie_irq()
1201 sc->pcie_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in pcib_alloc_pcie_irq()
1203 if (sc->pcie_mem == NULL) { in pcib_alloc_pcie_irq()
1205 "Failed to allocate BAR for MSI-X table\n"); in pcib_alloc_pcie_irq()
1223 sc->pcie_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, in pcib_alloc_pcie_irq()
1225 if (sc->pcie_irq == NULL) { in pcib_alloc_pcie_irq()
1227 "Failed to allocate interrupt for PCI-e events\n"); in pcib_alloc_pcie_irq()
1233 error = bus_setup_intr(dev, sc->pcie_irq, INTR_TYPE_MISC|INTR_MPSAFE, in pcib_alloc_pcie_irq()
1234 NULL, pcib_pcie_intr_hotplug, sc, &sc->pcie_ihand); in pcib_alloc_pcie_irq()
1236 device_printf(dev, "Failed to setup PCI-e interrupt handler\n"); in pcib_alloc_pcie_irq()
1237 bus_release_resource(dev, SYS_RES_IRQ, rid, sc->pcie_irq); in pcib_alloc_pcie_irq()
1251 dev = sc->dev; in pcib_release_pcie_irq()
1252 error = bus_teardown_intr(dev, sc->pcie_irq, sc->pcie_ihand); in pcib_release_pcie_irq()
1255 error = bus_free_resource(dev, SYS_RES_IRQ, sc->pcie_irq); in pcib_release_pcie_irq()
1261 if (sc->pcie_mem != NULL) in pcib_release_pcie_irq()
1262 error = bus_free_resource(dev, SYS_RES_MEMORY, sc->pcie_mem); in pcib_release_pcie_irq()
1272 dev = sc->dev; in pcib_setup_hotplug()
1273 TASK_INIT(&sc->pcie_hp_task, 0, pcib_pcie_hotplug_task, sc); in pcib_setup_hotplug()
1274 TIMEOUT_TASK_INIT(taskqueue_pci_hp, &sc->pcie_ab_task, 0, in pcib_setup_hotplug()
1276 TIMEOUT_TASK_INIT(taskqueue_pci_hp, &sc->pcie_cc_task, 0, in pcib_setup_hotplug()
1278 TIMEOUT_TASK_INIT(taskqueue_pci_hp, &sc->pcie_dll_task, 0, in pcib_setup_hotplug()
1280 sc->pcie_hp_lock = bus_topo_mtx(); in pcib_setup_hotplug()
1286 sc->pcie_link_sta = pcie_read_config(dev, PCIER_LINK_STA, 2); in pcib_setup_hotplug()
1287 sc->pcie_slot_sta = pcie_read_config(dev, PCIER_SLOT_STA, 2); in pcib_setup_hotplug()
1290 pcie_write_config(dev, PCIER_SLOT_STA, sc->pcie_slot_sta, 2); in pcib_setup_hotplug()
1297 if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_APB) in pcib_setup_hotplug()
1299 if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_PCP) in pcib_setup_hotplug()
1301 if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_MRLSP) in pcib_setup_hotplug()
1303 if (!(sc->pcie_slot_cap & PCIEM_SLOT_CAP_NCCS)) in pcib_setup_hotplug()
1307 if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_AIP) { in pcib_setup_hotplug()
1322 if (sc->flags & PCIB_DETACH_PENDING) { in pcib_detach_hotplug()
1323 sc->flags &= ~PCIB_DETACH_PENDING; in pcib_detach_hotplug()
1324 taskqueue_cancel_timeout(taskqueue_pci_hp, &sc->pcie_ab_task, in pcib_detach_hotplug()
1327 sc->flags |= PCIB_DETACHING; in pcib_detach_hotplug()
1329 if (sc->flags & PCIB_HOTPLUG_CMD_PENDING) { in pcib_detach_hotplug()
1330 taskqueue_cancel_timeout(taskqueue_pci_hp, &sc->pcie_cc_task, in pcib_detach_hotplug()
1333 sc->flags &= ~PCIB_HOTPLUG_CMD_PENDING; in pcib_detach_hotplug()
1343 if (sc->pcie_slot_cap & PCIEM_SLOT_CAP_AIP) { in pcib_detach_hotplug()
1353 taskqueue_drain(taskqueue_pci_hp, &sc->pcie_hp_task); in pcib_detach_hotplug()
1354 taskqueue_drain_timeout(taskqueue_pci_hp, &sc->pcie_ab_task); in pcib_detach_hotplug()
1355 taskqueue_drain_timeout(taskqueue_pci_hp, &sc->pcie_cc_task); in pcib_detach_hotplug()
1356 taskqueue_drain_timeout(taskqueue_pci_hp, &sc->pcie_dll_task); in pcib_detach_hotplug()
1378 device_set_desc(dev, "PCI-PCI bridge"); in pcib_probe()
1379 return(-10000); in pcib_probe()
1393 sc->dev = dev; in pcib_attach_common()
1398 sc->domain = pci_get_domain(dev); in pcib_attach_common()
1399 sc->bridgectl = pci_read_config(dev, PCIR_BRIDGECTL_1, 2); in pcib_attach_common()
1405 sc->pribus = pci_get_bus(dev); in pcib_attach_common()
1406 pci_write_config(dev, PCIR_PRIBUS_1, sc->pribus, 1); in pcib_attach_common()
1414 CTLFLAG_RD, &sc->domain, 0, "Domain number"); in pcib_attach_common()
1416 CTLFLAG_RD, &sc->pribus, 0, "Primary bus number"); in pcib_attach_common()
1418 CTLFLAG_RD, &sc->bus.sec, 0, "Secondary bus number"); in pcib_attach_common()
1420 CTLFLAG_RD, &sc->bus.sub, 0, "Subordinate bus number"); in pcib_attach_common()
1427 * The i82380FB mobile docking controller is a PCI-PCI bridge, in pcib_attach_common()
1436 sc->flags |= PCIB_SUBTRACTIVE; in pcib_attach_common()
1441 sc->flags |= PCIB_DISABLE_MSI; in pcib_attach_common()
1444 sc->flags |= PCIB_DISABLE_MSIX; in pcib_attach_common()
1447 * Intel 815, 845 and other chipsets say they are PCI-PCI bridges, in pcib_attach_common()
1449 * BA/CA/DB and E) PCI bridges are HUB-PCI bridges, in Intelese. in pcib_attach_common()
1456 sc->flags |= PCIB_SUBTRACTIVE; in pcib_attach_common()
1461 pcib_setup_secbus(dev, &sc->bus, 1); in pcib_attach_common()
1464 if (sc->flags & PCIB_HOTPLUG) in pcib_attach_common()
1468 device_printf(dev, " domain %d\n", sc->domain); in pcib_attach_common()
1469 device_printf(dev, " secondary bus %d\n", sc->bus.sec); in pcib_attach_common()
1470 device_printf(dev, " subordinate bus %d\n", sc->bus.sub); in pcib_attach_common()
1471 if (pcib_is_window_open(&sc->io)) in pcib_attach_common()
1472 device_printf(dev, " I/O decode 0x%jx-0x%jx\n", in pcib_attach_common()
1473 (uintmax_t)sc->io.base, (uintmax_t)sc->io.limit); in pcib_attach_common()
1474 if (pcib_is_window_open(&sc->mem)) in pcib_attach_common()
1475 device_printf(dev, " memory decode 0x%jx-0x%jx\n", in pcib_attach_common()
1476 (uintmax_t)sc->mem.base, (uintmax_t)sc->mem.limit); in pcib_attach_common()
1477 if (pcib_is_window_open(&sc->pmem)) in pcib_attach_common()
1478 device_printf(dev, " prefetched decode 0x%jx-0x%jx\n", in pcib_attach_common()
1479 (uintmax_t)sc->pmem.base, (uintmax_t)sc->pmem.limit); in pcib_attach_common()
1480 if (sc->bridgectl & (PCIB_BCR_ISA_ENABLE | PCIB_BCR_VGA_ENABLE) || in pcib_attach_common()
1481 sc->flags & PCIB_SUBTRACTIVE) { in pcib_attach_common()
1484 if (sc->bridgectl & PCIB_BCR_ISA_ENABLE) { in pcib_attach_common()
1488 if (sc->bridgectl & PCIB_BCR_VGA_ENABLE) { in pcib_attach_common()
1492 if (sc->flags & PCIB_SUBTRACTIVE) in pcib_attach_common()
1511 if (sc->flags & PCIB_HOTPLUG) in pcib_present()
1523 if (sc->bus.sec == 0) { in pcib_attach_child()
1535 sc->child = device_add_child(dev, "pci", DEVICE_UNIT_ANY); in pcib_attach_child()
1559 if (sc->flags & PCIB_HOTPLUG) { in pcib_detach()
1569 pcib_free_secbus(dev, &sc->bus); in pcib_detach()
1603 pcib_child_present(device_t dev, device_t child) in pcib_child_present() argument
1610 if (retval != 0 && sc->flags & PCIB_HOTPLUG) in pcib_child_present()
1619 pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) in pcib_read_ivar() argument
1625 *result = sc->domain; in pcib_read_ivar()
1628 *result = sc->bus.sec; in pcib_read_ivar()
1635 pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value) in pcib_write_ivar() argument
1653 device_t child, int type, int *rid, rman_res_t start, rman_res_t end, in pcib_suballoc_resource() argument
1661 res = rman_reserve_resource(&w->rman, start, end, count, in pcib_suballoc_resource()
1662 flags & ~RF_ACTIVE, child); in pcib_suballoc_resource()
1667 device_printf(sc->dev, in pcib_suballoc_resource()
1668 "allocated %s range (%#jx-%#jx) for rid %x of %s\n", in pcib_suballoc_resource()
1669 w->name, rman_get_start(res), rman_get_end(res), *rid, in pcib_suballoc_resource()
1670 pcib_child_name(child)); in pcib_suballoc_resource()
1675 if (bus_activate_resource(child, type, *rid, res) != 0) { in pcib_suballoc_resource()
1690 rman_res_t base, limit, wmask; in pcib_alloc_new_window() local
1698 * was larger than the non-aliased range size of 0x100 our in pcib_alloc_new_window()
1702 if (type == SYS_RES_IOPORT && sc->bridgectl & PCIB_BCR_ISA_ENABLE && in pcib_alloc_new_window()
1704 for (base = 0xf000; (long)base >= 0; base -= 0x1000) { in pcib_alloc_new_window()
1705 limit = base + 0xfff; in pcib_alloc_new_window()
1710 * window that overlaps are the non-alias in pcib_alloc_new_window()
1711 * ranges within [base, limit], so this isn't in pcib_alloc_new_window()
1714 if (start + count > limit - 0x400) in pcib_alloc_new_window()
1716 if (base == 0) { in pcib_alloc_new_window()
1719 * 0 is 0x400-0x4ff. in pcib_alloc_new_window()
1721 if (end - count + 1 < 0x400) in pcib_alloc_new_window()
1724 if (end - count + 1 < base) in pcib_alloc_new_window()
1728 if (pcib_alloc_nonisa_ranges(sc, base, limit) == 0) { in pcib_alloc_new_window()
1729 w->base = base; in pcib_alloc_new_window()
1730 w->limit = limit; in pcib_alloc_new_window()
1737 wmask = ((rman_res_t)1 << w->step) - 1; in pcib_alloc_new_window()
1738 if (RF_ALIGNMENT(flags) < w->step) { in pcib_alloc_new_window()
1740 flags |= RF_ALIGNMENT_LOG2(w->step); in pcib_alloc_new_window()
1744 count = roundup2(count, (rman_res_t)1 << w->step); in pcib_alloc_new_window()
1745 rid = w->reg; in pcib_alloc_new_window()
1746 res = bus_alloc_resource(sc->dev, type, &rid, start, end, count, in pcib_alloc_new_window()
1752 w->base = rman_get_start(res); in pcib_alloc_new_window()
1753 w->limit = rman_get_end(res); in pcib_alloc_new_window()
1757 /* Try to expand an existing window to the requested base and limit. */
1760 rman_res_t base, rman_res_t limit) in pcib_expand_window() argument
1765 KASSERT(base <= w->base && limit >= w->limit, in pcib_expand_window()
1772 KASSERT(limit == w->limit || base == w->base, in pcib_expand_window()
1777 * window behind an ISA-enabled bridge. Since I/O windows in pcib_expand_window()
1783 if (type == SYS_RES_IOPORT && sc->bridgectl & PCIB_BCR_ISA_ENABLE && in pcib_expand_window()
1784 (limit <= 65535 || (base <= 65535 && base != w->base))) { in pcib_expand_window()
1785 KASSERT(limit == w->limit || limit <= 65535, in pcib_expand_window()
1788 if (base != w->base) in pcib_expand_window()
1789 error = pcib_alloc_nonisa_ranges(sc, base, w->base - 1); in pcib_expand_window()
1791 error = pcib_alloc_nonisa_ranges(sc, w->limit + 1, in pcib_expand_window()
1794 w->base = base; in pcib_expand_window()
1795 w->limit = limit; in pcib_expand_window()
1802 * but for an ISA-enabled bridge we might be growing the I/O window in pcib_expand_window()
1806 for (i = 0; i < w->count; i++) { in pcib_expand_window()
1807 if (rman_get_end(w->res[i]) == w->limit) in pcib_expand_window()
1810 KASSERT(i != w->count, ("did not find existing resource")); in pcib_expand_window()
1811 res = w->res[i]; in pcib_expand_window()
1815 * existing range. The one exception is the ISA-enabled case in pcib_expand_window()
1819 if (type == SYS_RES_IOPORT && sc->bridgectl & PCIB_BCR_ISA_ENABLE && in pcib_expand_window()
1820 w->base <= 65535) { in pcib_expand_window()
1825 KASSERT(w->base == rman_get_start(res), in pcib_expand_window()
1830 error = bus_adjust_resource(sc->dev, type, res, force_64k_base ? in pcib_expand_window()
1831 rman_get_start(res) : base, limit); in pcib_expand_window()
1836 if (w->base != base) { in pcib_expand_window()
1837 error = rman_manage_region(&w->rman, base, w->base - 1); in pcib_expand_window()
1838 w->base = base; in pcib_expand_window()
1840 error = rman_manage_region(&w->rman, w->limit + 1, limit); in pcib_expand_window()
1841 w->limit = limit; in pcib_expand_window()
1845 device_printf(sc->dev, in pcib_expand_window()
1846 "failed to expand %s resource manager\n", w->name); in pcib_expand_window()
1847 (void)bus_adjust_resource(sc->dev, type, res, force_64k_base ? in pcib_expand_window()
1848 rman_get_start(res) : w->base, w->limit); in pcib_expand_window()
1870 if (!w->valid) in pcib_grow_window()
1872 if (sc->bridgectl & PCIB_BCR_ISA_ENABLE && count > 0x100 && in pcib_grow_window()
1875 if (end > w->rman.rm_end) in pcib_grow_window()
1876 end = w->rman.rm_end; in pcib_grow_window()
1877 if (start + count - 1 > end || start + count < start) in pcib_grow_window()
1879 wmask = ((rman_res_t)1 << w->step) - 1; in pcib_grow_window()
1885 if (w->res == NULL) { in pcib_grow_window()
1890 device_printf(sc->dev, in pcib_grow_window()
1891 "failed to allocate initial %s window (%#jx-%#jx,%#jx)\n", in pcib_grow_window()
1892 w->name, start, end, count); in pcib_grow_window()
1896 device_printf(sc->dev, in pcib_grow_window()
1897 "allocated initial %s window of %#jx-%#jx\n", in pcib_grow_window()
1898 w->name, (uintmax_t)w->base, (uintmax_t)w->limit); in pcib_grow_window()
1915 * non-alias ranges when it is grown in either direction. in pcib_grow_window()
1917 * XXX: Special case: if w->res is completely empty and the in pcib_grow_window()
1918 * request size is larger than w->res, we should find the in pcib_grow_window()
1919 * optimal aligned buffer containing w->res and allocate that. in pcib_grow_window()
1922 device_printf(sc->dev, in pcib_grow_window()
1923 "attempting to grow %s window for (%#jx-%#jx,%#jx)\n", in pcib_grow_window()
1924 w->name, start, end, count); in pcib_grow_window()
1926 if (start < w->base) { in pcib_grow_window()
1927 if (rman_first_free_region(&w->rman, &start_free, &end_free) != in pcib_grow_window()
1928 0 || start_free != w->base) in pcib_grow_window()
1929 end_free = w->base; in pcib_grow_window()
1934 end_free &= ~(align - 1); in pcib_grow_window()
1935 end_free--; in pcib_grow_window()
1936 front = end_free - (count - 1); in pcib_grow_window()
1947 printf("\tfront candidate range: %#jx-%#jx\n", in pcib_grow_window()
1950 front = w->base - front; in pcib_grow_window()
1955 if (end > w->limit) { in pcib_grow_window()
1956 if (rman_last_free_region(&w->rman, &start_free, &end_free) != in pcib_grow_window()
1957 0 || end_free != w->limit) in pcib_grow_window()
1958 start_free = w->limit + 1; in pcib_grow_window()
1964 back = start_free + count - 1; in pcib_grow_window()
1975 printf("\tback candidate range: %#jx-%#jx\n", in pcib_grow_window()
1978 back -= w->limit; in pcib_grow_window()
1991 error = pcib_expand_window(sc, w, type, w->base - front, in pcib_grow_window()
1992 w->limit); in pcib_grow_window()
1997 error = pcib_expand_window(sc, w, type, w->base, in pcib_grow_window()
1998 w->limit + back); in pcib_grow_window()
2008 device_printf(sc->dev, "grew %s window to %#jx-%#jx\n", in pcib_grow_window()
2009 w->name, (uintmax_t)w->base, (uintmax_t)w->limit); in pcib_grow_window()
2013 KASSERT((w->base & wmask) == 0, ("start address is not aligned")); in pcib_grow_window()
2014 KASSERT((w->limit & wmask) == wmask, ("end address is not aligned")); in pcib_grow_window()
2015 pcib_write_windows(sc, w->mask); in pcib_grow_window()
2024 pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, in pcib_alloc_resource() argument
2039 if (sc->bridgectl & PCIB_BCR_VGA_ENABLE) in pcib_alloc_resource()
2040 return (bus_generic_alloc_resource(dev, child, type, in pcib_alloc_resource()
2048 return (pcib_alloc_subbus(&sc->bus, child, rid, start, end, in pcib_alloc_resource()
2053 r = pcib_suballoc_resource(sc, &sc->io, child, type, rid, start, in pcib_alloc_resource()
2055 if (r != NULL || (sc->flags & PCIB_SUBTRACTIVE) != 0) in pcib_alloc_resource()
2057 if (pcib_grow_window(sc, &sc->io, type, start, end, count, in pcib_alloc_resource()
2059 r = pcib_suballoc_resource(sc, &sc->io, child, type, in pcib_alloc_resource()
2072 r = pcib_suballoc_resource(sc, &sc->pmem, child, type, in pcib_alloc_resource()
2077 r = pcib_suballoc_resource(sc, &sc->mem, child, type, rid, in pcib_alloc_resource()
2079 if (r != NULL || (sc->flags & PCIB_SUBTRACTIVE) != 0) in pcib_alloc_resource()
2082 if (pcib_grow_window(sc, &sc->pmem, type, start, end, in pcib_alloc_resource()
2084 r = pcib_suballoc_resource(sc, &sc->pmem, child, in pcib_alloc_resource()
2090 if (pcib_grow_window(sc, &sc->mem, type, start, end, count, in pcib_alloc_resource()
2092 r = pcib_suballoc_resource(sc, &sc->mem, child, type, in pcib_alloc_resource()
2096 return (bus_generic_alloc_resource(dev, child, type, rid, in pcib_alloc_resource()
2104 if (sc->flags & PCIB_SUBTRACTIVE && r == NULL) in pcib_alloc_resource()
2105 return (bus_generic_alloc_resource(dev, child, type, rid, in pcib_alloc_resource()
2111 pcib_adjust_resource(device_t bus, device_t child, struct resource *r, in pcib_adjust_resource() argument
2123 * If the resource wasn't sub-allocated from one of our region in pcib_adjust_resource()
2127 return (bus_generic_adjust_resource(bus, child, r, start, end)); in pcib_adjust_resource()
2131 * If our bus range isn't big enough to grow the sub-allocation in pcib_adjust_resource()
2137 if (start >= sc->bus.sec && end > sc->bus.sub) { in pcib_adjust_resource()
2138 error = pcib_grow_subbus(&sc->bus, end); in pcib_adjust_resource()
2149 ("%s: no window for resource (%#jx-%#jx) type %d", in pcib_adjust_resource()
2153 * If our window isn't big enough to grow the sub-allocation in pcib_adjust_resource()
2156 if (start < w->base || end > w->limit) { in pcib_adjust_resource()
2157 wmask = ((rman_res_t)1 << w->step) - 1; in pcib_adjust_resource()
2159 MIN(start & ~wmask, w->base), in pcib_adjust_resource()
2160 MAX(end | wmask, w->limit)); in pcib_adjust_resource()
2164 device_printf(sc->dev, in pcib_adjust_resource()
2165 "grew %s window to %#jx-%#jx\n", in pcib_adjust_resource()
2166 w->name, (uintmax_t)w->base, in pcib_adjust_resource()
2167 (uintmax_t)w->limit); in pcib_adjust_resource()
2168 pcib_write_windows(sc, w->mask); in pcib_adjust_resource()
2176 pcib_release_resource(device_t dev, device_t child, struct resource *r) in pcib_release_resource() argument
2184 error = bus_deactivate_resource(child, r); in pcib_release_resource()
2190 return (bus_generic_release_resource(dev, child, r)); in pcib_release_resource()
2194 pcib_activate_resource(device_t dev, device_t child, struct resource *r) in pcib_activate_resource() argument
2201 return (bus_generic_activate_resource(dev, child, r)); in pcib_activate_resource()
2210 error = BUS_MAP_RESOURCE(dev, child, r, NULL, &map); in pcib_activate_resource()
2222 pcib_deactivate_resource(device_t dev, device_t child, struct resource *r) in pcib_deactivate_resource() argument
2229 return (bus_generic_deactivate_resource(dev, child, r)); in pcib_deactivate_resource()
2239 BUS_UNMAP_RESOURCE(dev, child, r, &map); in pcib_deactivate_resource()
2247 for (int i = 0; i < w->count; i++) { in pcib_find_parent_resource()
2248 if (rman_get_start(w->res[i]) <= rman_get_start(r) && in pcib_find_parent_resource()
2249 rman_get_end(w->res[i]) >= rman_get_end(r)) in pcib_find_parent_resource()
2250 return (w->res[i]); in pcib_find_parent_resource()
2256 pcib_map_resource(device_t dev, device_t child, struct resource *r, in pcib_map_resource() argument
2268 return (bus_generic_map_resource(dev, child, r, argsp, map)); in pcib_map_resource()
2283 args.offset = start - rman_get_start(pres); in pcib_map_resource()
2289 pcib_unmap_resource(device_t dev, device_t child, struct resource *r, in pcib_unmap_resource() argument
2298 return (bus_generic_unmap_resource(dev, child, r, map)); in pcib_unmap_resource()
2308 * to the non-ARI slot/function. The downstream port will convert it back in
2320 if (sc->flags & PCIB_ENABLE_ARI) { in pcib_xlate_ari()
2322 ("Non-zero slot number with ARI enabled!")); in pcib_xlate_ari()
2333 ctl2 = pci_read_config(sc->dev, pcie_pos + PCIER_DEVICE_CTL2, 4); in pcib_enable_ari()
2335 pci_write_config(sc->dev, pcie_pos + PCIER_DEVICE_CTL2, ctl2, 4); in pcib_enable_ari()
2337 sc->flags |= PCIB_ENABLE_ARI; in pcib_enable_ari()
2372 if (sc->flags & PCIB_ENABLE_ARI) in pcib_ari_maxslots()
2385 if (sc->flags & PCIB_ENABLE_ARI) in pcib_ari_maxfuncs()
2400 if (sc->flags & PCIB_ENABLE_ARI) { in pcib_ari_decode_rid()
2410 * Since we are a child of a PCI bus, its parent must support the pcib interface.
2451 * Route an interrupt across a PCI bridge.
2462 * The PCI standard defines a swizzle of the child-side device/intpin to in pcib_route_interrupt()
2463 * the parent-side intpin as follows. in pcib_route_interrupt()
2465 * device = device on child bus in pcib_route_interrupt()
2466 * child_intpin = intpin on child bus slot (0-3) in pcib_route_interrupt()
2467 * parent_intpin = intpin on parent bus slot (0-3) in pcib_route_interrupt()
2471 parent_intpin = (pci_get_slot(dev) + (pin - 1)) % 4; in pcib_route_interrupt()
2481 pci_get_slot(dev), 'A' + pin - 1, intnum); in pcib_route_interrupt()
2486 /* Pass request to alloc MSI/MSI-X messages up to the parent bridge. */
2493 if (sc->flags & PCIB_DISABLE_MSI) in pcib_alloc_msi()
2500 /* Pass request to release MSI/MSI-X messages up to the parent bridge. */
2510 /* Pass request to alloc an MSI-X message up to the parent bridge. */
2517 if (sc->flags & PCIB_DISABLE_MSIX) in pcib_alloc_msix()
2523 /* Pass request to release an MSI-X message up to the parent bridge. */
2533 /* Pass request to map MSI/MSI-X message up to parent bridge. */
2567 return ((sc->flags & PCIB_ENABLE_ARI) != 0); in pcib_ari_enabled()
2585 if (sc->flags & PCIB_ENABLE_ARI) { in pcib_ari_get_id()
2683 * the firmware overrides the method of PCI-PCI bridges. in pcib_request_feature()
2711 pcib_reset_child(device_t dev, device_t child, int flags) in pcib_reset_child() argument
2717 if (dev == NULL || device_get_parent(child) != dev) in pcib_reset_child()
2720 if (device_get_devclass(child) != devclass_find("pci")) in pcib_reset_child()
2723 if (pdinfo->cfg.pcie.pcie_location != 0 && in pcib_reset_child()
2724 (pdinfo->cfg.pcie.pcie_type == PCIEM_TYPE_DOWNSTREAM_PORT || in pcib_reset_child()
2725 pdinfo->cfg.pcie.pcie_type == PCIEM_TYPE_ROOT_PORT)) { in pcib_reset_child()
2726 error = bus_helper_reset_prepare(child, flags); in pcib_reset_child()
2729 pdinfo->cfg.pcie.pcie_location); in pcib_reset_child()
2731 bus_helper_reset_post(child, flags); in pcib_reset_child()