static int agp_nvidia_detach (device_t dev) { struct agp_nvidia_softc *sc = device_get_softc(dev); u_int32_t temp; agp_free_cdev(dev); /* GART Control */ temp = pci_read_config(sc->dev, AGP_NVIDIA_0_APSIZE, 4); pci_write_config(sc->dev, AGP_NVIDIA_0_APSIZE, temp & ~(0x100), 4); /* GTLB Control */ temp = pci_read_config(sc->mc2_dev, AGP_NVIDIA_2_GARTCTRL, 4); pci_write_config(sc->mc2_dev, AGP_NVIDIA_2_GARTCTRL, temp & ~(0x11), 4); /* Put the aperture back the way it started. */ AGP_SET_APERTURE(dev, sc->initial_aperture); /* restore iorr for previous aperture size */ nvidia_init_iorr(rman_get_start(sc->agp.as_aperture), sc->initial_aperture); agp_free_gatt(sc->gatt); agp_free_res(dev); return (0); }
static int agp_via_detach(struct agp_softc *sc) { struct agp_via_softc *asc = sc->as_chipc; int error; error = agp_generic_detach(sc); if (error) return error; pci_conf_write(sc->as_pc, sc->as_tag, asc->regs[REG_GARTCTRL], 0); pci_conf_write(sc->as_pc, sc->as_tag, asc->regs[REG_ATTBASE], 0); AGP_SET_APERTURE(sc, asc->initial_aperture); agp_free_gatt(sc, asc->gatt); return 0; }