Lines 205-211
Link Here
|
205 |
agp_generic_attach(device_t dev) |
205 |
agp_generic_attach(device_t dev) |
206 |
{ |
206 |
{ |
207 |
struct agp_softc *sc = device_get_softc(dev); |
207 |
struct agp_softc *sc = device_get_softc(dev); |
208 |
int i; |
208 |
struct make_dev_args mda; |
|
|
209 |
int i, unit, res; |
209 |
u_int memsize; |
210 |
u_int memsize; |
210 |
|
211 |
|
211 |
/* |
212 |
/* |
Lines 249-256
Link Here
|
249 |
TAILQ_INIT(&sc->as_memory); |
250 |
TAILQ_INIT(&sc->as_memory); |
250 |
sc->as_nextid = 1; |
251 |
sc->as_nextid = 1; |
251 |
|
252 |
|
252 |
sc->as_devnode = make_dev(&agp_cdevsw, |
253 |
/* |
253 |
0, UID_ROOT, GID_WHEEL, 0600, "agpgart"); |
254 |
* MAKEDEV_CHECKNAME will not panic but return an error in make_dev_s(). |
|
|
255 |
* Unit 1 is always named "agpgart". Addition units are numbered starting |
256 |
* from 2 (i.e. "agpgarg2"). |
257 |
*/ |
258 |
unit = devclass_find_free_unit(agp_devclass, 0); |
259 |
make_dev_args_init(&mda); |
260 |
mda.mda_flags = MAKEDEV_CHECKNAME; |
261 |
mda.mda_devsw = &agp_cdevsw; |
262 |
mda.mda_uid = UID_ROOT; |
263 |
mda.mda_gid = GID_WHEEL; |
264 |
mda.mda_mode = 0600; |
265 |
mda.mda_unit = unit; |
266 |
if (unit == 1) { |
267 |
res = make_dev_s(&mda, &sc->as_devnode, "agpgart"); |
268 |
} else { |
269 |
res = make_dev_s(&mda, &sc->as_devnode, "agpgart%d", unit); |
270 |
} |
271 |
if (res != 0) { |
272 |
device_printf(dev, "error %d in make_dev(agpgart, unit %d)\n", |
273 |
res, unit); |
274 |
mtx_destroy(&sc->as_lock); |
275 |
return (res); |
276 |
} |
254 |
sc->as_devnode->si_drv1 = dev; |
277 |
sc->as_devnode->si_drv1 = dev; |
255 |
|
278 |
|
256 |
return 0; |
279 |
return 0; |