Lines Matching refs:dev
28 __FBSDID("$FreeBSD: releng/11.0/sys/dev/pci/vga_pci.c 296336 2016-03-03 05:07:35Z jhibbits $");
51 #include <dev/pci/pcireg.h>
52 #include <dev/pci/pcivar.h>
70 static struct resource *vga_pci_alloc_resource(device_t dev, device_t child,
73 static int vga_pci_release_resource(device_t dev, device_t child, int type,
81 vga_pci_is_boot_display(device_t dev)
88 if ((pci_get_class(dev) != PCIC_DISPLAY &&
89 (pci_get_class(dev) != PCIC_OLD ||
90 pci_get_subclass(dev) != PCIS_OLD_VGA)))
93 unit = device_get_unit(dev);
114 pcib = device_get_parent(device_get_parent(dev));
126 config = pci_read_config(dev, PCIR_COMMAND, 2);
135 pci_write_config(dev, PCIR_COMMAND, config | PCIM_CMD_INTxDIS, 2);
139 device_set_flags(dev, 1);
145 vga_pci_map_bios(device_t dev, size_t *size)
151 if (vga_pci_is_boot_display(dev)) {
167 res = vga_pci_alloc_resource(dev, NULL, SYS_RES_MEMORY, &rid, 0,
178 vga_pci_unmap_bios(device_t dev, void *bios)
187 if (vga_pci_is_boot_display(dev)) {
199 vr = lookup_res(device_get_softc(dev), PCIR_BIOS);
203 vga_pci_release_resource(dev, NULL, SYS_RES_MEMORY, PCIR_BIOS,
208 vga_pci_repost(device_t dev)
213 if (!vga_pci_is_boot_display(dev))
221 regs.R_AH = pci_get_bus(dev);
222 regs.R_AL = (pci_get_slot(dev) << 3) | (pci_get_function(dev) & 0x07);
225 device_printf(dev, "REPOSTing\n");
238 vga_pci_probe(device_t dev)
241 switch (pci_get_class(dev)) {
245 if (pci_get_subclass(dev) != PCIS_OLD_VGA)
253 vga_pci_is_boot_display(dev);
255 device_set_desc(dev, "VGA-compatible display");
260 vga_pci_attach(device_t dev)
263 bus_generic_probe(dev);
266 device_add_child(dev, "drm", -1);
267 device_add_child(dev, "drmn", -1);
268 bus_generic_attach(dev);
270 if (vga_pci_is_boot_display(dev))
271 device_printf(dev, "Boot video device\n");
277 vga_pci_suspend(device_t dev)
280 return (bus_generic_suspend(dev));
284 vga_pci_resume(device_t dev)
287 return (bus_generic_resume(dev));
293 vga_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
296 return (BUS_READ_IVAR(device_get_parent(dev), dev, which, result));
300 vga_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value)
307 vga_pci_setup_intr(device_t dev, device_t child, struct resource *irq,
311 return (BUS_SETUP_INTR(device_get_parent(dev), dev, irq, flags,
316 vga_pci_teardown_intr(device_t dev, device_t child, struct resource *irq,
319 return (BUS_TEARDOWN_INTR(device_get_parent(dev), dev, irq, cookie));
336 vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid,
348 vr = lookup_res(device_get_softc(dev), *rid);
352 vr->vr_res = bus_alloc_resource(dev, type, rid, start,
358 return (bus_alloc_resource(dev, type, rid, start, end, count, flags));
362 vga_pci_release_resource(device_t dev, device_t child, int type, int rid,
375 vr = lookup_res(device_get_softc(dev), rid);
387 error = bus_release_resource(dev, type, rid, r);
395 return (bus_release_resource(dev, type, rid, r));
401 vga_pci_read_config(device_t dev, device_t child, int reg, int width)
404 return (pci_read_config(dev, reg, width));
408 vga_pci_write_config(device_t dev, device_t child, int reg,
412 pci_write_config(dev, reg, val, width);
416 vga_pci_enable_busmaster(device_t dev, device_t child)
419 return (pci_enable_busmaster(dev));
423 vga_pci_disable_busmaster(device_t dev, device_t child)
426 return (pci_disable_busmaster(dev));
430 vga_pci_enable_io(device_t dev, device_t child, int space)
433 device_printf(dev, "child %s requested pci_enable_io\n",
435 return (pci_enable_io(dev, space));
439 vga_pci_disable_io(device_t dev, device_t child, int space)
442 device_printf(dev, "child %s requested pci_disable_io\n",
444 return (pci_disable_io(dev, space));
448 vga_pci_get_vpd_ident(device_t dev, device_t child, const char **identptr)
451 return (pci_get_vpd_ident(dev, identptr));
455 vga_pci_get_vpd_readonly(device_t dev, device_t child, const char *kw,
459 return (pci_get_vpd_readonly(dev, kw, vptr));
463 vga_pci_set_powerstate(device_t dev, device_t child, int state)
466 device_printf(dev, "child %s requested pci_set_powerstate\n",
468 return (pci_set_powerstate(dev, state));
472 vga_pci_get_powerstate(device_t dev, device_t child)
475 device_printf(dev, "child %s requested pci_get_powerstate\n",
477 return (pci_get_powerstate(dev));
481 vga_pci_assign_interrupt(device_t dev, device_t child)
484 device_printf(dev, "child %s requested pci_assign_interrupt\n",
486 return (PCI_ASSIGN_INTERRUPT(device_get_parent(dev), dev));
490 vga_pci_find_cap(device_t dev, device_t child, int capability,
494 return (pci_find_cap(dev, capability, capreg));
498 vga_pci_find_extcap(device_t dev, device_t child, int capability,
502 return (pci_find_extcap(dev, capability, capreg));
506 vga_pci_find_htcap(device_t dev, device_t child, int capability,
510 return (pci_find_htcap(dev, capability, capreg));
514 vga_pci_alloc_msi(device_t dev, device_t child, int *count)
519 sc = device_get_softc(dev);
522 error = pci_alloc_msi(dev, count);
529 vga_pci_alloc_msix(device_t dev, device_t child, int *count)
534 sc = device_get_softc(dev);
537 error = pci_alloc_msix(dev, count);
544 vga_pci_remap_msix(device_t dev, device_t child, int count,
549 sc = device_get_softc(dev);
552 return (pci_remap_msix(dev, count, vectors));
556 vga_pci_release_msi(device_t dev, device_t child)
561 sc = device_get_softc(dev);
564 error = pci_release_msi(dev);
571 vga_pci_msi_count(device_t dev, device_t child)
574 return (pci_msi_count(dev));
578 vga_pci_msix_count(device_t dev, device_t child)
581 return (pci_msix_count(dev));