Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/agp/agp.c
Show First 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | agp_set_aperture_resource(device_t dev, int rid) | ||||
struct agp_softc *sc = device_get_softc(dev); | struct agp_softc *sc = device_get_softc(dev); | ||||
sc->as_aperture_rid = rid; | sc->as_aperture_rid = rid; | ||||
} | } | ||||
int | int | ||||
agp_generic_attach(device_t dev) | agp_generic_attach(device_t dev) | ||||
{ | { | ||||
struct make_dev_args mdargs; | |||||
struct agp_softc *sc = device_get_softc(dev); | struct agp_softc *sc = device_get_softc(dev); | ||||
int i; | int error, i, unit; | ||||
u_int memsize; | u_int memsize; | ||||
/* | /* | ||||
* Find and map the aperture, RF_SHAREABLE for DRM but not RF_ACTIVE | * Find and map the aperture, RF_SHAREABLE for DRM but not RF_ACTIVE | ||||
* because the kernel doesn't need to map it. | * because the kernel doesn't need to map it. | ||||
*/ | */ | ||||
if (sc->as_aperture_rid != -1) { | if (sc->as_aperture_rid != -1) { | ||||
Show All 27 Lines | agp_generic_attach(device_t dev) | ||||
/* | /* | ||||
* Initialise stuff for the userland device. | * Initialise stuff for the userland device. | ||||
*/ | */ | ||||
agp_devclass = devclass_find("agp"); | agp_devclass = devclass_find("agp"); | ||||
TAILQ_INIT(&sc->as_memory); | TAILQ_INIT(&sc->as_memory); | ||||
sc->as_nextid = 1; | sc->as_nextid = 1; | ||||
sc->as_devnode = make_dev(&agp_cdevsw, | sc->as_devalias = NULL; | ||||
0, UID_ROOT, GID_WHEEL, 0600, "agpgart"); | |||||
sc->as_devnode->si_drv1 = dev; | |||||
return 0; | make_dev_args_init(&mdargs); | ||||
mdargs.mda_devsw = &agp_cdevsw; | |||||
mdargs.mda_uid = UID_ROOT; | |||||
mdargs.mda_gid = GID_WHEEL; | |||||
mdargs.mda_mode = 0600; | |||||
mdargs.mda_si_drv1 = sc; | |||||
mdargs.mda_si_drv2 = NULL; | |||||
unit = device_get_unit(dev); | |||||
error = make_dev_s(&mdargs, &sc->as_devnode, "agpgart%d", unit); | |||||
if (error == 0) { | |||||
kib: error == 0 && unit == 0 ? | |||||
/* | |||||
* Create an alias for the first device that shows up. | |||||
*/ | |||||
if (unit == 0) { | |||||
(void)make_dev_alias_p(MAKEDEV_CHECKNAME, | |||||
&sc->as_devalias, sc->as_devnode, "agpgart"); | |||||
} | } | ||||
} else { | |||||
agp_free_res(dev); | |||||
} | |||||
return error; | |||||
} | |||||
void | void | ||||
agp_free_cdev(device_t dev) | agp_free_cdev(device_t dev) | ||||
{ | { | ||||
struct agp_softc *sc = device_get_softc(dev); | struct agp_softc *sc = device_get_softc(dev); | ||||
destroy_dev(sc->as_devnode); | destroy_dev(sc->as_devnode); | ||||
if (sc->as_devalias != NULL) | |||||
destroy_dev(sc->as_devalias); | |||||
} | } | ||||
void | void | ||||
agp_free_res(device_t dev) | agp_free_res(device_t dev) | ||||
{ | { | ||||
struct agp_softc *sc = device_get_softc(dev); | struct agp_softc *sc = device_get_softc(dev); | ||||
if (sc->as_aperture != NULL) | if (sc->as_aperture != NULL) | ||||
▲ Show 20 Lines • Show All 780 Lines • Show Last 20 Lines |
error == 0 && unit == 0 ?