Lines Matching refs:dev
28 __FBSDID("$FreeBSD: releng/11.0/sys/dev/agp/agp_via.c 244926 2013-01-01 18:16:49Z antoine $");
40 #include <dev/agp/agppriv.h>
41 #include <dev/agp/agpreg.h>
42 #include <dev/pci/pcivar.h>
43 #include <dev/pci/pcireg.h>
66 agp_via_match(device_t dev)
68 if (pci_get_class(dev) != PCIC_BRIDGE
69 || pci_get_subclass(dev) != PCIS_BRIDGE_HOST)
72 if (agp_find_caps(dev) == 0)
75 switch (pci_get_devid(dev)) {
144 agp_via_probe(device_t dev)
148 if (resource_disabled("agp", device_get_unit(dev)))
150 desc = agp_via_match(dev);
152 device_set_desc(dev, desc);
160 agp_via_attach(device_t dev)
162 struct agp_via_softc *sc = device_get_softc(dev);
171 capid = pci_read_config(dev, agp_find_caps(dev) + AGP_CAPID, 4);
173 agpsel = pci_read_config(dev, AGP_VIA_AGPSEL, 1);
178 error = agp_generic_attach(dev);
182 sc->initial_aperture = AGP_GET_APERTURE(dev);
185 gatt = agp_alloc_gatt(dev);
193 if (AGP_SET_APERTURE(dev, AGP_GET_APERTURE(dev) / 2)) {
194 agp_generic_detach(dev);
202 pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical | 3, 4);
205 pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4);
210 pci_write_config(dev, sc->regs[REG_ATTBASE], gatt->ag_physical, 4);
213 gartctrl = pci_read_config(dev, sc->regs[REG_GARTCTRL], 4);
214 pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl | (3 << 7), 4);
217 device_printf(dev, "aperture size is %dM\n",
224 agp_via_detach(device_t dev)
226 struct agp_via_softc *sc = device_get_softc(dev);
228 agp_free_cdev(dev);
230 pci_write_config(dev, sc->regs[REG_GARTCTRL], 0, 4);
231 pci_write_config(dev, sc->regs[REG_ATTBASE], 0, 4);
232 AGP_SET_APERTURE(dev, sc->initial_aperture);
234 agp_free_res(dev);
240 agp_via_get_aperture(device_t dev)
242 struct agp_via_softc *sc = device_get_softc(dev);
246 apsize = pci_read_config(dev, sc->regs[REG_APSIZE], 1);
257 apsize = pci_read_config(dev, sc->regs[REG_APSIZE], 2) & 0xfff;
280 device_printf(dev, "Invalid aperture setting 0x%x\n",
281 pci_read_config(dev, sc->regs[REG_APSIZE], 2));
288 agp_via_set_aperture(device_t dev, u_int32_t aperture)
290 struct agp_via_softc *sc = device_get_softc(dev);
305 pci_write_config(dev, sc->regs[REG_APSIZE], apsize, 1);
339 device_printf(dev, "Invalid aperture size (%dMb)\n",
343 val = pci_read_config(dev, sc->regs[REG_APSIZE], 2);
344 pci_write_config(dev, sc->regs[REG_APSIZE],
351 agp_via_bind_page(device_t dev, vm_offset_t offset, vm_offset_t physical)
353 struct agp_via_softc *sc = device_get_softc(dev);
363 agp_via_unbind_page(device_t dev, vm_offset_t offset)
365 struct agp_via_softc *sc = device_get_softc(dev);
375 agp_via_flush_tlb(device_t dev)
377 struct agp_via_softc *sc = device_get_softc(dev);
381 pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x8f, 4);
382 pci_write_config(dev, sc->regs[REG_GARTCTRL], 0x0f, 4);
384 gartctrl = pci_read_config(dev, sc->regs[REG_GARTCTRL], 4);
385 pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl &
387 pci_write_config(dev, sc->regs[REG_GARTCTRL], gartctrl, 4);