diff --git a/sys/dev/agp/agp_amd.c b/sys/dev/agp/agp_amd.c index 16125fb3990c..198b926241fb 100644 --- a/sys/dev/agp/agp_amd.c +++ b/sys/dev/agp/agp_amd.c @@ -246,6 +246,11 @@ static int agp_amd_detach(device_t dev) { struct agp_amd_softc *sc = device_get_softc(dev); + int error; + + error = agp_generic_detach(dev); + if (error) + return error; /* Disable the TLB.. */ WRITE2(AGP_AMD751_STATUS, @@ -261,6 +266,10 @@ agp_amd_detach(device_t dev) AGP_SET_APERTURE(dev, sc->initial_aperture); agp_amd_free_gatt(sc->gatt); + + bus_release_resource(dev, SYS_RES_MEMORY, + AGP_AMD751_REGISTERS, sc->regs); + return 0; } diff --git a/sys/pci/agp_amd.c b/sys/pci/agp_amd.c index 16125fb3990c..198b926241fb 100644 --- a/sys/pci/agp_amd.c +++ b/sys/pci/agp_amd.c @@ -246,6 +246,11 @@ static int agp_amd_detach(device_t dev) { struct agp_amd_softc *sc = device_get_softc(dev); + int error; + + error = agp_generic_detach(dev); + if (error) + return error; /* Disable the TLB.. */ WRITE2(AGP_AMD751_STATUS, @@ -261,6 +266,10 @@ agp_amd_detach(device_t dev) AGP_SET_APERTURE(dev, sc->initial_aperture); agp_amd_free_gatt(sc->gatt); + + bus_release_resource(dev, SYS_RES_MEMORY, + AGP_AMD751_REGISTERS, sc->regs); + return 0; }