Lines Matching defs:mdev
155 struct mdev {
164 } mdev[16];
193 if ((flags & FWRITE) && (mdev[devid].mdFlags & mdRO)) return (EACCES); /* Currently mounted RO */
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) {
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? */
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;
424 if ((mdev[devid].mdFlags & mdInited) == 0) return(-1); /* Not inited yet */
426 return(mdev[devid].mdSecsize);
547 if(!(mdev[i].mdFlags & mdInited)) { /* Is this a free one? */
551 if(!(((base + size -1 ) < mdev[i].mdBase) || ((mdev[i].mdBase + mdev[i].mdSize - 1) < base))) { /* Is there any overlap? */
552 panic("mdevadd: attempt to add overlapping memory device at %08X-%08X\n", mdev[i].mdBase, mdev[i].mdBase + mdev[i].mdSize - 1);
563 if(mdev[devid].mdFlags &mdInited) { /* Already there? */
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 */
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 */
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;
616 if(!(mdev[devid].mdFlags & mdInited)) return -1; /* This one hasn't been defined */
617 return mdev[devid].mdBDev; /* Return the device number */
625 if(!(mdev[i].mdFlags & mdInited)) continue; /* Ignore unused mdevs */
627 devfs_remove(mdev[i].mdbdevb); /* Remove the block device */
628 devfs_remove(mdev[i].mdcdevb); /* Remove the character device */
630 mdev[i].mdBase = 0; /* Clear the mdev's storage */
631 mdev[i].mdSize = 0;
632 mdev[i].mdSecsize = 0;
633 mdev[i].mdFlags = 0;
634 mdev[i].mdBDev = 0;
635 mdev[i].mdCDev = 0;
636 mdev[i].mdbdevb = 0;
637 mdev[i].mdcdevb = 0;