Lines Matching defs:dev
61 #include <dev/agp/agppriv.h>
62 #include <dev/agp/agpreg.h>
63 #include <dev/agp/agp_i810.h>
64 #include <dev/pci/pcivar.h>
65 #include <dev/pci/pcireg.h>
66 #include <dev/pci/pci_private.h>
90 static void agp_82852_set_desc(device_t dev,
92 static void agp_i810_set_desc(device_t dev, const struct agp_i810_match *match);
94 static void agp_i810_dump_regs(device_t dev);
95 static void agp_i830_dump_regs(device_t dev);
96 static void agp_i855_dump_regs(device_t dev);
97 static void agp_i915_dump_regs(device_t dev);
98 static void agp_i965_dump_regs(device_t dev);
100 static int agp_i810_get_stolen_size(device_t dev);
101 static int agp_i830_get_stolen_size(device_t dev);
102 static int agp_i915_get_stolen_size(device_t dev);
104 static int agp_i810_get_gtt_mappable_entries(device_t dev);
105 static int agp_i830_get_gtt_mappable_entries(device_t dev);
106 static int agp_i915_get_gtt_mappable_entries(device_t dev);
108 static int agp_i810_get_gtt_total_entries(device_t dev);
109 static int agp_i965_get_gtt_total_entries(device_t dev);
110 static int agp_gen5_get_gtt_total_entries(device_t dev);
112 static int agp_i810_install_gatt(device_t dev);
113 static int agp_i830_install_gatt(device_t dev);
114 static int agp_i965_install_gatt(device_t dev);
115 static int agp_g4x_install_gatt(device_t dev);
117 static void agp_i810_deinstall_gatt(device_t dev);
118 static void agp_i830_deinstall_gatt(device_t dev);
120 static void agp_i810_install_gtt_pte(device_t dev, u_int index,
122 static void agp_i830_install_gtt_pte(device_t dev, u_int index,
124 static void agp_i915_install_gtt_pte(device_t dev, u_int index,
126 static void agp_i965_install_gtt_pte(device_t dev, u_int index,
128 static void agp_g4x_install_gtt_pte(device_t dev, u_int index,
131 static void agp_i810_write_gtt(device_t dev, u_int index, uint32_t pte);
132 static void agp_i915_write_gtt(device_t dev, u_int index, uint32_t pte);
133 static void agp_i965_write_gtt(device_t dev, u_int index, uint32_t pte);
134 static void agp_g4x_write_gtt(device_t dev, u_int index, uint32_t pte);
136 static u_int32_t agp_i810_read_gtt_pte(device_t dev, u_int index);
137 static u_int32_t agp_i915_read_gtt_pte(device_t dev, u_int index);
138 static u_int32_t agp_i965_read_gtt_pte(device_t dev, u_int index);
139 static u_int32_t agp_g4x_read_gtt_pte(device_t dev, u_int index);
141 static vm_paddr_t agp_i810_read_gtt_pte_paddr(device_t dev, u_int index);
142 static vm_paddr_t agp_i915_read_gtt_pte_paddr(device_t dev, u_int index);
144 static int agp_i810_set_aperture(device_t dev, u_int32_t aperture);
145 static int agp_i830_set_aperture(device_t dev, u_int32_t aperture);
146 static int agp_i915_set_aperture(device_t dev, u_int32_t aperture);
148 static int agp_i810_chipset_flush_setup(device_t dev);
149 static int agp_i915_chipset_flush_setup(device_t dev);
150 static int agp_i965_chipset_flush_setup(device_t dev);
152 static void agp_i810_chipset_flush_teardown(device_t dev);
153 static void agp_i915_chipset_flush_teardown(device_t dev);
154 static void agp_i965_chipset_flush_teardown(device_t dev);
156 static void agp_i810_chipset_flush(device_t dev);
157 static void agp_i830_chipset_flush(device_t dev);
158 static void agp_i915_chipset_flush(device_t dev);
649 agp_i810_match(device_t dev)
653 if (pci_get_class(dev) != PCIC_DISPLAY
654 || (pci_get_subclass(dev) != PCIS_DISPLAY_VGA &&
655 pci_get_subclass(dev) != PCIS_DISPLAY_OTHER))
658 devid = pci_get_devid(dev);
673 agp_i810_find_bridge(device_t dev)
722 agp_82852_set_desc(device_t dev, const struct agp_i810_match *match)
725 switch (pci_read_config(dev, AGP_I85X_CAPID, 1)) {
727 device_set_desc(dev,
731 device_set_desc(dev,
735 device_set_desc(dev,
739 device_set_desc(dev,
743 device_set_desc(dev,
750 agp_i810_set_desc(device_t dev, const struct agp_i810_match *match)
753 device_set_desc(dev, match->name);
757 agp_i810_probe(device_t dev)
763 if (resource_disabled("agp", device_get_unit(dev)))
765 match = agp_i810_match(dev);
769 bdev = agp_i810_find_bridge(dev);
786 match->driver->set_desc(dev, match);
791 agp_i810_dump_regs(device_t dev)
793 struct agp_i810_softc *sc = device_get_softc(dev);
795 device_printf(dev, "AGP_I810_PGTBL_CTL: %08x\n",
797 device_printf(dev, "AGP_I810_MISCC: 0x%04x\n",
802 agp_i830_dump_regs(device_t dev)
804 struct agp_i810_softc *sc = device_get_softc(dev);
806 device_printf(dev, "AGP_I810_PGTBL_CTL: %08x\n",
808 device_printf(dev, "AGP_I830_GCC1: 0x%02x\n",
813 agp_i855_dump_regs(device_t dev)
815 struct agp_i810_softc *sc = device_get_softc(dev);
817 device_printf(dev, "AGP_I810_PGTBL_CTL: %08x\n",
819 device_printf(dev, "AGP_I855_GCC1: 0x%02x\n",
824 agp_i915_dump_regs(device_t dev)
826 struct agp_i810_softc *sc = device_get_softc(dev);
828 device_printf(dev, "AGP_I810_PGTBL_CTL: %08x\n",
830 device_printf(dev, "AGP_I855_GCC1: 0x%02x\n",
832 device_printf(dev, "AGP_I915_MSAC: 0x%02x\n",
837 agp_i965_dump_regs(device_t dev)
839 struct agp_i810_softc *sc = device_get_softc(dev);
841 device_printf(dev, "AGP_I965_PGTBL_CTL2: %08x\n",
843 device_printf(dev, "AGP_I855_GCC1: 0x%02x\n",
845 device_printf(dev, "AGP_I965_MSAC: 0x%02x\n",
850 agp_i810_get_stolen_size(device_t dev)
854 sc = device_get_softc(dev);
861 agp_i830_get_stolen_size(device_t dev)
866 sc = device_get_softc(dev);
884 device_printf(dev,
893 agp_i915_get_stolen_size(device_t dev)
898 sc = device_get_softc(dev);
934 device_printf(dev, "Bad PGTBL size\n");
948 device_printf(dev, "Bad PGTBL size\n");
957 device_printf(dev, "Bad chiptype\n");
1020 device_printf(dev,
1034 agp_i810_get_gtt_mappable_entries(device_t dev)
1040 sc = device_get_softc(dev);
1051 agp_i830_get_gtt_mappable_entries(device_t dev)
1057 sc = device_get_softc(dev);
1068 agp_i915_get_gtt_mappable_entries(device_t dev)
1073 sc = device_get_softc(dev);
1074 ap = AGP_GET_APERTURE(dev);
1080 agp_i810_get_gtt_total_entries(device_t dev)
1084 sc = device_get_softc(dev);
1090 agp_i965_get_gtt_total_entries(device_t dev)
1096 sc = device_get_softc(dev);
1120 device_printf(dev, "Unknown page table size\n");
1127 agp_gen5_adjust_pgtbl_size(device_t dev, uint32_t sz)
1132 sc = device_get_softc(dev);
1147 agp_gen5_get_gtt_total_entries(device_t dev)
1152 sc = device_get_softc(dev);
1158 agp_gen5_adjust_pgtbl_size(dev, AGP_I810_PGTBL_SIZE_1MB);
1161 agp_gen5_adjust_pgtbl_size(dev, AGP_I810_PGTBL_SIZE_1_5MB);
1165 agp_gen5_adjust_pgtbl_size(dev, AGP_I810_PGTBL_SIZE_2MB);
1168 device_printf(dev, "Unknown page table size\n");
1172 return (agp_i965_get_gtt_total_entries(dev));
1176 agp_i810_install_gatt(device_t dev)
1180 sc = device_get_softc(dev);
1194 device_printf(dev, "contiguous allocation failed\n");
1222 agp_i830_install_gatt(device_t dev)
1226 sc = device_get_softc(dev);
1232 agp_gen4_install_gatt(device_t dev, const vm_size_t gtt_offset)
1236 sc = device_get_softc(dev);
1245 agp_i965_install_gatt(device_t dev)
1248 return (agp_gen4_install_gatt(dev, 512 * 1024));
1252 agp_g4x_install_gatt(device_t dev)
1255 return (agp_gen4_install_gatt(dev, 2 * 1024 * 1024));
1259 agp_i810_attach(device_t dev)
1264 sc = device_get_softc(dev);
1265 sc->bdev = agp_i810_find_bridge(dev);
1269 sc->match = agp_i810_match(dev);
1271 agp_set_aperture_resource(dev, sc->match->driver->gen <= 2 ?
1273 error = agp_generic_attach(dev);
1279 device_printf(dev, "agp_i810 does not support physical "
1285 if (bus_alloc_resources(dev, sc->match->driver->res_spec, sc->sc_res)) {
1286 agp_generic_detach(dev);
1290 sc->initial_aperture = AGP_GET_APERTURE(dev);
1292 sc->gatt->ag_entries = AGP_GET_APERTURE(dev) >> AGP_PAGE_SHIFT;
1294 if ((error = sc->match->driver->get_stolen_size(dev)) != 0 ||
1295 (error = sc->match->driver->install_gatt(dev)) != 0 ||
1296 (error = sc->match->driver->get_gtt_mappable_entries(dev)) != 0 ||
1297 (error = sc->match->driver->get_gtt_total_entries(dev)) != 0 ||
1298 (error = sc->match->driver->chipset_flush_setup(dev)) != 0) {
1299 bus_release_resources(dev, sc->match->driver->res_spec,
1302 agp_generic_detach(dev);
1306 intel_agp = dev;
1307 device_printf(dev, "aperture size is %dM",
1314 sc->match->driver->dump_regs(dev);
1315 device_printf(dev, "Mappable GTT entries: %d\n",
1317 device_printf(dev, "Total GTT entries: %d\n",
1324 agp_i810_deinstall_gatt(device_t dev)
1328 sc = device_get_softc(dev);
1334 agp_i830_deinstall_gatt(device_t dev)
1339 sc = device_get_softc(dev);
1346 agp_i810_detach(device_t dev)
1350 sc = device_get_softc(dev);
1351 agp_free_cdev(dev);
1354 sc->match->driver->deinstall_gatt(dev);
1356 sc->match->driver->chipset_flush_teardown(dev);
1359 AGP_SET_APERTURE(dev, sc->initial_aperture);
1362 bus_release_resources(dev, sc->match->driver->res_spec, sc->sc_res);
1363 agp_free_res(dev);
1369 agp_i810_resume(device_t dev)
1372 sc = device_get_softc(dev);
1374 AGP_SET_APERTURE(dev, sc->initial_aperture);
1380 return (bus_generic_resume(dev));
1393 agp_i810_set_aperture(device_t dev, u_int32_t aperture)
1398 sc = device_get_softc(dev);
1403 device_printf(dev, "bad aperture size %d\n", aperture);
1419 agp_i830_set_aperture(device_t dev, u_int32_t aperture)
1424 sc = device_get_softc(dev);
1428 device_printf(dev, "bad aperture size %d\n", aperture);
1443 agp_i915_set_aperture(device_t dev, u_int32_t aperture)
1446 return (agp_generic_set_aperture(dev, aperture));
1450 agp_i810_method_set_aperture(device_t dev, u_int32_t aperture)
1454 sc = device_get_softc(dev);
1455 return (sc->match->driver->set_aperture(dev, aperture));
1471 agp_i810_install_gtt_pte(device_t dev, u_int index, vm_offset_t physical,
1481 agp_i810_write_gtt(dev, index, pte);
1485 agp_i810_write_gtt(device_t dev, u_int index, uint32_t pte)
1489 sc = device_get_softc(dev);
1495 agp_i830_install_gtt_pte(device_t dev, u_int index, vm_offset_t physical,
1503 agp_i810_write_gtt(dev, index, pte);
1507 agp_i915_install_gtt_pte(device_t dev, u_int index, vm_offset_t physical,
1516 agp_i915_write_gtt(dev, index, pte);
1520 agp_i915_write_gtt(device_t dev, u_int index, uint32_t pte)
1524 sc = device_get_softc(dev);
1530 agp_i965_install_gtt_pte(device_t dev, u_int index, vm_offset_t physical,
1539 agp_i965_write_gtt(dev, index, pte);
1543 agp_i965_write_gtt(device_t dev, u_int index, uint32_t pte)
1547 sc = device_get_softc(dev);
1553 agp_g4x_install_gtt_pte(device_t dev, u_int index, vm_offset_t physical,
1562 agp_g4x_write_gtt(dev, index, pte);
1566 agp_g4x_write_gtt(device_t dev, u_int index, uint32_t pte)
1570 sc = device_get_softc(dev);
1576 agp_i810_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical)
1578 struct agp_i810_softc *sc = device_get_softc(dev);
1582 device_printf(dev, "failed: offset is 0x%08jx, "
1589 device_printf(dev, "trying to bind into stolen memory\n");
1592 sc->match->driver->install_gtt_pte(dev, index, physical, 0);
1597 agp_i810_unbind_page(device_t dev, vm_offset_t offset)
1602 sc = device_get_softc(dev);
1607 device_printf(dev, "trying to unbind from stolen memory\n");
1610 sc->match->driver->install_gtt_pte(dev, index, 0, 0);
1615 agp_i810_read_gtt_pte(device_t dev, u_int index)
1620 sc = device_get_softc(dev);
1626 agp_i915_read_gtt_pte(device_t dev, u_int index)
1631 sc = device_get_softc(dev);
1637 agp_i965_read_gtt_pte(device_t dev, u_int index)
1642 sc = device_get_softc(dev);
1648 agp_g4x_read_gtt_pte(device_t dev, u_int index)
1653 sc = device_get_softc(dev);
1659 agp_i810_read_gtt_pte_paddr(device_t dev, u_int index)
1665 sc = device_get_softc(dev);
1666 pte = sc->match->driver->read_gtt_pte(dev, index);
1672 agp_i915_read_gtt_pte_paddr(device_t dev, u_int index)
1678 sc = device_get_softc(dev);
1679 pte = sc->match->driver->read_gtt_pte(dev, index);
1688 agp_i810_flush_tlb(device_t dev)
1693 agp_i810_enable(device_t dev, u_int32_t mode)
1700 agp_i810_alloc_memory(device_t dev, int type, vm_size_t size)
1706 sc = device_get_softc(dev);
1779 agp_i810_free_memory(device_t dev, struct agp_memory *mem)
1787 sc = device_get_softc(dev);
1813 agp_i810_bind_memory(device_t dev, struct agp_memory *mem, vm_offset_t offset)
1820 offset + mem->am_size > AGP_GET_APERTURE(dev)) {
1821 device_printf(dev, "binding memory at bad offset %#x\n",
1826 sc = device_get_softc(dev);
1835 sc->match->driver->install_gtt_pte(dev, (offset + i) >>
1845 return (agp_generic_bind_memory(dev, mem, offset));
1860 agp_i810_unbind_memory(device_t dev, struct agp_memory *mem)
1865 sc = device_get_softc(dev);
1875 sc->match->driver->install_gtt_pte(dev,
1884 return (agp_generic_unbind_memory(dev, mem));
1889 sc->match->driver->install_gtt_pte(dev, i >> AGP_PAGE_SHIFT,
1930 agp_intel_gtt_clear_range(device_t dev, u_int first_entry, u_int num_entries)
1935 sc = device_get_softc(dev);
1937 sc->match->driver->install_gtt_pte(dev, first_entry + i,
1939 sc->match->driver->read_gtt_pte(dev, first_entry + num_entries - 1);
1943 agp_intel_gtt_insert_pages(device_t dev, u_int first_entry, u_int num_entries,
1949 sc = device_get_softc(dev);
1953 sc->match->driver->install_gtt_pte(dev, first_entry + i,
1956 sc->match->driver->read_gtt_pte(dev, first_entry + num_entries - 1);
1960 agp_intel_gtt_get(device_t dev)
1965 sc = device_get_softc(dev);
1979 agp_i810_chipset_flush_setup(device_t dev)
1986 agp_i810_chipset_flush_teardown(device_t dev)
1993 agp_i810_chipset_flush(device_t dev)
2000 agp_i830_chipset_flush(device_t dev)
2006 sc = device_get_softc(dev);
2019 agp_i915_chipset_flush_alloc_page(device_t dev, uint64_t start, uint64_t end)
2024 sc = device_get_softc(dev);
2025 vga = device_get_parent(dev);
2027 sc->sc_flush_page_res = BUS_ALLOC_RESOURCE(device_get_parent(vga), dev,
2031 device_printf(dev, "Failed to allocate flush page at 0x%jx\n",
2037 device_printf(dev, "Allocated flush page phys 0x%jx virt %p\n",
2045 agp_i915_chipset_flush_free_page(device_t dev)
2050 sc = device_get_softc(dev);
2051 vga = device_get_parent(dev);
2054 BUS_DEACTIVATE_RESOURCE(device_get_parent(vga), dev,
2056 BUS_RELEASE_RESOURCE(device_get_parent(vga), dev,
2061 agp_i915_chipset_flush_setup(device_t dev)
2067 sc = device_get_softc(dev);
2072 device_printf(dev,
2081 error = agp_i915_chipset_flush_alloc_page(dev, temp,
2087 error = agp_i915_chipset_flush_alloc_page(dev, 0, 0xffffffff);
2097 agp_i915_chipset_flush_teardown(device_t dev)
2102 sc = device_get_softc(dev);
2110 agp_i915_chipset_flush_free_page(dev);
2114 agp_i965_chipset_flush_setup(device_t dev)
2121 sc = device_get_softc(dev);
2129 device_printf(dev,
2138 error = agp_i915_chipset_flush_alloc_page(dev, temp,
2144 error = agp_i915_chipset_flush_alloc_page(dev, 0, ~0);
2157 agp_i965_chipset_flush_teardown(device_t dev)
2162 sc = device_get_softc(dev);
2170 agp_i915_chipset_flush_free_page(dev);
2174 agp_i915_chipset_flush(device_t dev)
2178 sc = device_get_softc(dev);
2183 agp_intel_gtt_chipset_flush(device_t dev)
2187 sc = device_get_softc(dev);
2188 sc->match->driver->chipset_flush(dev);
2193 agp_intel_gtt_unmap_memory(device_t dev, struct sglist *sg_list)
2198 agp_intel_gtt_map_memory(device_t dev, vm_page_t *pages, u_int num_entries,
2214 sc = device_get_softc(dev);
2223 error = bus_dma_tag_create(bus_get_dma_tag(dev),
2244 agp_intel_gtt_install_pte(device_t dev, u_int index, vm_paddr_t addr,
2249 sc = device_get_softc(dev);
2250 sc->match->driver->install_gtt_pte(dev, index, addr, flags);
2254 agp_intel_gtt_insert_sg_entries(device_t dev, struct sglist *sg_list,
2262 sc = device_get_softc(dev);
2267 sc->match->driver->install_gtt_pte(dev, first_entry + i,
2273 sc->match->driver->read_gtt_pte(dev, first_entry + i - 1);