Lines Matching refs:devid
175 dev_t mdevadd(int devid, ppnum_t base, unsigned int size, int phys);
176 dev_t mdevlookup(int devid);
187 int devid;
189 devid = minor(dev); /* Get minor device number */
191 if (devid > 16) return (ENXIO); /* Not valid */
193 if ((flags & FWRITE) && (mdev[devid].mdFlags & mdRO)) return (EACCES); /* Currently mounted RO */
201 int devid;
204 devid = minor(dev); /* Get minor device number */
206 if (devid > 16) return (ENXIO); /* Not valid */
207 if (!(mdev[devid].mdFlags & mdInited)) return (ENXIO); /* Have we actually been defined yet? */
209 mdata = ((addr64_t)mdev[devid].mdBase << 12) + uio->uio_offset; /* Point to the area in "file" */
218 if (mdev[devid].mdFlags & mdPhys) {
235 int devid;
239 devid = minor(buf_device(bp)); /* Get minor device number */
241 if ((mdev[devid].mdFlags & mdInited) == 0) { /* Have we actually been defined yet? */
249 blkoff = buf_blkno(bp) * mdev[devid].mdSecsize; /* Get offset into file */
256 if (blkoff >= (mdev[devid].mdSize << 12)) { /* Are they trying to read/write at/after end? */
257 if(blkoff != (mdev[devid].mdSize << 12)) { /* Are we trying to read after EOF? */
264 if ((blkoff + buf_count(bp)) > (mdev[devid].mdSize << 12)) { /* Will this read go past end? */
265 buf_setcount(bp, ((mdev[devid].mdSize << 12) - blkoff)); /* Yes, trim to max */
274 fvaddr = (mdev[devid].mdBase << 12) + blkoff; /* Point to offset into ram disk */
277 if(!(mdev[devid].mdFlags & mdPhys)) { /* Physical mapped disk? */
303 if(!(mdev[devid].mdFlags & mdPhys)) { /* Physical mapped disk? */
353 int devid;
355 devid = minor(dev); /* Get minor device number */
357 if (devid > 16) return (ENXIO); /* Not valid */
384 *f = mdev[devid].mdSecsize;
392 mdev[devid].mdSecsize = *f; /* set the new block size */
400 if(!(mdev[devid].mdFlags & mdInited)) return (ENXIO);
401 *f = ((mdev[devid].mdSize << 12) + mdev[devid].mdSecsize - 1) / mdev[devid].mdSecsize;
405 if(!(mdev[devid].mdFlags & mdInited)) return (ENXIO);
406 *o = ((mdev[devid].mdSize << 12) + mdev[devid].mdSecsize - 1) / mdev[devid].mdSecsize;
419 int devid;
421 devid = minor(dev); /* Get minor device number */
422 if (devid > 16) return (ENXIO); /* Not valid */
424 if ((mdev[devid].mdFlags & mdInited) == 0) return(-1); /* Not inited yet */
426 return(mdev[devid].mdSecsize);
435 int devid, phys;
459 devid = ba[3] & 0xF; /* Assume digit */
460 if(ba[3] > '9') devid += 9; /* Adjust for hex digits */
475 dev = mdevadd(devid, base >> 12, size >> 12, phys); /* Go add the device */
539 dev_t mdevadd(int devid, ppnum_t base, unsigned int size, int phys) {
543 if(devid < 0) {
545 devid = -1;
548 if(devid < 0)devid = i; /* Remember first free one */
555 if(devid < 0) { /* Do we have free slots? */
560 if(devid >= 16) { /* Giving us something bogus? */
561 panic("mdevadd: attempt to explicitly add a bogus memory device: %08X\n", devid);
563 if(mdev[devid].mdFlags &mdInited) { /* Already there? */
564 panic("mdevadd: attempt to explicitly add a previously defined memory device: %08X\n", devid);
584 mdev[devid].mdBDev = makedev(mdevBMajor, devid); /* Get the device number */
585 mdev[devid].mdbdevb = devfs_make_node(mdev[devid].mdBDev, DEVFS_BLOCK, /* Make the node */
587 0600, "md%d", devid);
588 if (mdev[devid].mdbdevb == NULL) { /* Did we make one? */
593 mdev[devid].mdCDev = makedev(mdevCMajor, devid); /* Get the device number */
594 mdev[devid].mdcdevb = devfs_make_node(mdev[devid].mdCDev, DEVFS_CHAR, /* Make the node */
596 0600, "rmd%d", devid);
597 if (mdev[devid].mdcdevb == NULL) { /* Did we make one? */
602 mdev[devid].mdBase = base; /* Set the base address of ram disk */
603 mdev[devid].mdSize = size; /* Set the length of the ram disk */
604 mdev[devid].mdSecsize = DEV_BSIZE; /* Set starting block size */
605 if(phys) mdev[devid].mdFlags |= mdPhys; /* Show that we are in physical memory */
606 mdev[devid].mdFlags |= mdInited; /* Show we are all set up */
608 devid, devid, mdev[devid].mdBDev, mdev[devid].mdCDev, base << 12, size << 12);
609 return mdev[devid].mdBDev;
613 dev_t mdevlookup(int devid) {
615 if((devid < 0) || (devid > 15)) return -1; /* Filter any bogus requests */
616 if(!(mdev[devid].mdFlags & mdInited)) return -1; /* This one hasn't been defined */
617 return mdev[devid].mdBDev; /* Return the device number */