Subject: read&write entry points duplicated in drivers (part 2 of 2) Index: pdpuba/many 2.11BSD Description: This is part 2 of 2. Repeated from part 1: The read and write entry points into many of the device drivers are essentially duplicated - all that is done is that physio() is called with the drivers strategy routine's address. Later versions of 4BSD have removed the individual driver's read&write functions and consolidated them into rawread() and rawwrite(). The read and write entries in the cdevsw[] are then replaced with rawread() and rawwrite() respectively. The space savings will of course vary depending on the number of disc and tape drivers present in the system. Repeat-By: Examine the code, look at (for example) ra.c and tm.c (one disc and one tape driver). Note that raread()/rawrite() and tmwrite()/tmread() merely call physio(), the same as any other disc or tape driver. Fix: The patch below will update all the necessary files. Part 2 is a cursory patch kit for the OTHERS directory (an attempt to keep those drivers somewhat updated). Note: the cdevsw[] structure has an extra member - the strategy routine is now present in both the bdevsw[] and cdevsw[] tables. Note: the 'kind' (BYTE/WORD) parameter to physio() is gone now, be sure to count the arguments to physio() when installing/porting a driver. No one could remember the origin of the BYTE/WORD stuff and testing showed that either the underlying hardware gave an error or nothing bad happened if the alignment was ignored. NOTE: Several of the OTHERS drivers had not been previously updated with the new dynamic buffer allocation - passing a NULL buffer pointer instead of allocating a static raw i/o buffer. This patch attempts to correct that. NO ATTEMPT has been made to get any of these drivers working, if they didn't work before they won't work now but at least the basic protocol differences have been defined. NOTE: the README file has been updated, out of the OTHERS directory this is one file worth reading. ----------------------------------------------------------------------------- *** /usr/src/sys/OTHERS/rs03.04/hs.c.old Wed May 7 20:22:12 1986 --- /usr/src/sys/OTHERS/rs03.04/hs.c Sun Sep 22 11:47:54 1991 *************** *** 36,42 **** struct hsdevice *HSADDR = (struct hsdevice *)0172040; struct buf hstab; - struct buf rhsbuf; hsroot() { --- 36,41 ---- *************** *** 161,178 **** hstab.b_actf = bp->av_forw; iodone(bp); hsstart(); - } - - hsread(dev) - dev_t dev; - { - physio(hsstrategy, &rhsbuf, dev, B_READ, WORD); - } - - hswrite(dev) - dev_t dev; - { - physio(hsstrategy, &rhsbuf, dev, B_WRITE, WORD); } #endif NHS #endif AUTOCONFIG --- 160,165 ---- *** /usr/src/sys/OTHERS/dvhp/dvhp.c.old Wed May 7 20:37:34 1986 --- /usr/src/sys/OTHERS/dvhp/dvhp.c Sun Sep 22 11:49:12 1991 *************** *** 39,49 **** }; struct buf dvhptab; - #ifdef UCB_DBUFS - struct buf rdvhpbuf[NHP]; - #else - struct buf rdvhpbuf; - #endif struct buf dvhputab[NDVHP]; #ifdef INTRLVE --- 39,44 ---- *************** *** 384,419 **** if (as & (1 << unit)) dvhpustart(unit); dvhpstart(); - } - - dvhpread(dev) - dev_t dev; - { - #ifdef UCB_DBUFS - register int unit = (minor(dev) >> 3) & 07; - - if (unit >= NHP) - u.u_error = ENXIO; - else - physio(dvhpstrategy, &rdvhpbuf[unit], dev, B_READ, WORD); - #else - physio(dvhpstrategy, &rdvhpbuf, dev, B_READ, WORD); - #endif - } - - dvhpwrite(dev) - dev_t dev; - { - #ifdef UCB_DBUFS - register int unit = (minor(dev) >> 3) & 07; - - if (unit >= NHP) - u.u_error = ENXIO; - else - physio(dvhpstrategy, &rdvhpbuf[unit], dev, B_WRITE, WORD); - #else - physio(dvhpstrategy, &rdvhpbuf, dev, B_WRITE, WORD); - #endif } #ifdef UCB_ECC --- 379,384 ---- *** /usr/src/sys/OTHERS/rp03/rp.c.old Wed May 7 20:25:41 1986 --- /usr/src/sys/OTHERS/rp03/rp.c Sun Sep 22 11:50:08 1991 *************** *** 60,70 **** }; struct buf rptab; - #ifdef UCB_DBUFS - struct buf rrpbuf[NRP]; - #else - struct buf rrpbuf; - #endif #define RP_NSECT 10 #define RP_NTRAC 20 --- 60,65 ---- *************** *** 207,242 **** bp->b_resid = -(rpaddr->rpwc << 1); iodone(bp); rpstart(); - } - - rpread(dev) - dev_t dev; - { - #ifdef UCB_DBUFS - register int unit = (minor(dev) >> 3) & 07; - - if (unit >= NRP) - u.u_error = ENXIO; - else - physio(rpstrategy, &rrpbuf[unit], dev, B_READ, WORD); - #else - physio(rpstrategy, &rrpbuf, dev, B_READ, WORD); - #endif - } - - rpwrite(dev) - dev_t dev; - { - #ifdef UCB_DBUFS - register int unit = (minor(dev) >> 3) & 07; - - if (unit >= NRP) - u.u_error = ENXIO; - else - physio(rpstrategy, &rrpbuf[unit], dev, B_WRITE, WORD); - #else - physio(rpstrategy, &rrpbuf, dev, B_WRITE, WORD); - #endif } #endif NRP #endif AUTOCONFIG --- 202,207 ---- *** /usr/src/sys/OTHERS/rx02/#2/rx.c.old Thu Sep 1 17:14:06 1988 --- /usr/src/sys/OTHERS/rx02/#2/rx.c Sun Sep 22 11:50:38 1991 *************** *** 53,59 **** #define seccnt(bp) ((int)((bp)->b_seccnt)) struct buf rxtab; - struct buf rrxbuf; struct buf crxbuf; /* buffer header for control functions */ /* --- 53,58 ---- *************** *** 333,351 **** *xmem = bp->b_xmem; if (*addr < bp->b_un.b_addr) /* overflow, bump xmem */ (*xmem)++; - } - - rxread(dev) - dev_t dev; - { - return (physio(rxstrategy, &rrxbuf, dev, B_READ, WORD)); - } - - - rxwrite(dev) - dev_t dev; - { - return (physio(rxstrategy, &rrxbuf, dev, B_WRITE, WORD)); } /* --- 332,337 ---- *** /usr/src/sys/OTHERS/rx02/#1/rx2.c.old Wed May 7 20:38:09 1986 --- /usr/src/sys/OTHERS/rx02/#1/rx2.c Sun Sep 22 11:51:04 1991 *************** *** 57,63 **** #define seccnt(bp) ((int) ((bp)->b_seccnt)) struct buf rx2tab; - struct buf rrx2buf; #ifdef RX2_IOCTL struct buf crx2buf; /* buffer header for control functions */ #endif --- 57,62 ---- *************** *** 296,316 **** if (*addr < bp->b_un.b_addr) /* overflow, bump xmem */ (*xmem)++; } - - - rx2read(dev) - dev_t dev; - { - physio(rx2strategy, &rrx2buf, dev, B_READ, WORD); - } - - - rx2write(dev) - dev_t dev; - { - physio(rx2strategy, &rrx2buf, dev, B_WRITE, WORD); - } - #ifdef RX2_IOCTL /* --- 295,300 ---- *** /usr/src/sys/OTHERS/rf11/rf.c.old Wed May 7 20:23:37 1986 --- /usr/src/sys/OTHERS/rf11/rf.c Sun Sep 22 11:51:22 1991 *************** *** 16,22 **** struct rfdevice *RFADDR = (struct rfdevice *)0177460; struct buf rftab; - struct buf rrfbuf; rfattach(addr, unit) struct rfdevice *addr; --- 16,21 ---- *************** *** 126,142 **** bp->b_resid = -(rfaddr->rfwc << 1); iodone(bp); rfstart(); - } - - rfread(dev) - dev_t dev; - { - physio(rfstrategy, &rrfbuf, dev, B_READ, WORD); - } - - rfwrite(dev) - dev_t dev; - { - physio(rfstrategy, &rrfbuf, dev, B_WRITE, WORD); } #endif NRF --- 125,129 ---- *** /usr/src/sys/OTHERS/ml11/ml.c.old Wed May 7 20:37:54 1986 --- /usr/src/sys/OTHERS/ml11/ml.c Sun Sep 22 11:51:45 1991 *************** *** 39,45 **** short ml_sizes[NML]; struct buf mltab; - struct buf rmlbuf; void mlprobe() --- 39,44 ---- *************** *** 212,228 **** bp->b_resid = 0; iodone(bp); mlstart(); - } - - mlread(dev) - dev_t dev; - { - physio(mlstrategy, &rmlbuf, dev, B_READ, WORD); - } - - mlwrite(dev) - dev_t dev; - { - physio(mlstrategy, &rmlbuf, dev, B_WRITE, WORD); } #endif NML --- 211,215 ---- *** /usr/src/sys/OTHERS/dv/dv.c.old Wed Apr 11 14:10:34 1990 --- /usr/src/sys/OTHERS/dv/dv.c Sun Sep 22 11:55:53 1991 *************** *** 70,76 **** int wcwcnt[4]; struct buf dvtab; - struct buf rdvbuf; char dvsecmap[] { 0, 4, 8, --- 70,75 ---- *************** *** 407,440 **** iodone(bp); if(n==0) dvstart(); - } - dvread(dev, uio) - dev_t dev; - struct uio *uio; - { - - if(dvphys(dev)) - physio(dvstrategy, &rdvbuf, dev, B_READ, WORD, uio); - } - - dvwrite(dev, uio) - dev_t dev; - struct uio *uio; - { - - if(dvphys(dev)) - physio(dvstrategy, &rdvbuf, dev, B_WRITE, WORD, uio); - } - - dvphys(dev, uio) - { - long c; - - c = uio->uio_offset >> 9; - c += (uio->uio_resid+511) / 512; - if(c > dv_sizes[minor(dev) & 07].nblocks) { - u.u_error = ENXIO; - return(0); - } - return(1); } --- 406,409 ---- *** /usr/src/sys/OTHERS/scsi/scsi.c.old Mon Feb 23 21:43:38 1987 --- /usr/src/sys/OTHERS/scsi/scsi.c Sun Sep 22 11:56:20 1991 *************** *** 117,123 **** char Initdata[8]; struct buf imitab; - struct buf rimibuf; unsigned imixblks; /* Number of blks transferred */ static int Didinit = 0; --- 117,122 ---- *************** *** 331,349 **** bp->b_resid = 0; iodone(bp); imistart(0); - } - - imiread(dev) - dev_t dev; - { - - physio(imistrategy, &rimibuf, dev, B_READ, WORD); - } - - imiwrite(dev) - dev_t dev; - { - - physio(imistrategy, &rimibuf, dev, B_WRITE, WORD); } #endif NIMI --- 330,334 ---- *** /usr/src/sys/OTHERS/ht/ht.c.old Wed Apr 11 16:46:32 1990 --- /usr/src/sys/OTHERS/ht/ht.c Sun Sep 22 12:11:41 1991 *************** *** 25,31 **** #endif struct buf httab; - struct buf rhtbuf; struct buf chtbuf; struct htdevice *HTADDR; --- 25,30 ---- *************** *** 179,184 **** --- 178,191 ---- register daddr_t *p; register struct tu_softc *sc = &tu_softc[TUUNIT(bp->b_dev)]; + /* This is almost certainly not in the right place and more work needs + * to be done in htstart(). See /sys/pdpuba/ht.c + */ + if (bp->b_flags & B_PHYS) { + sc->sc_blkno = sc->sc_nxrec = dbtofsb(bp->b_blkno); + sc->sc_nxrec++; + } + if(bp != &chtbuf) { #ifdef UNIBUS_MAP if ((httab.b_flags & B_RH70) == 0) *************** *** 321,327 **** err = HTADDR->hter; if (HTADDR->htcs2 & HTCS2_ERR || (err & HTER_HARD)) state = 0; ! if (bp == &rhtbuf) err &= ~HTER_FCE; if ((bp->b_flags & B_READ) && (HTADDR->htfs & HTFS_PES)) err &= ~(HTER_CSITM | HTER_CORCRC); --- 328,334 ---- err = HTADDR->hter; if (HTADDR->htcs2 & HTCS2_ERR || (err & HTER_HARD)) state = 0; ! if (bp->b_flags & B_PHYS) err &= ~HTER_FCE; if ((bp->b_flags & B_READ) && (HTADDR->htfs & HTFS_PES)) err &= ~(HTER_CSITM | HTER_CORCRC); *************** *** 416,447 **** HTADDR->htcs2 = ocs2; HTADDR->httc = omttc; HTADDR->htcs1 = HT_DCLR | HT_GO; - } - - htread(dev) - register dev_t dev; - { - htphys(dev); - physio(htstrategy, &rhtbuf, dev, B_READ); - } - - htwrite(dev) - register dev_t dev; - { - htphys(dev); - physio(htstrategy, &rhtbuf, dev, B_WRITE); - } - - htphys(dev, uio) - dev_t dev; - struct uio *uio; - { - daddr_t a; - register struct tu_softc *sc = &tu_softc[TUUNIT(dev)]; - - a = dbtofsb(uio->uio_offset >> PGSHIFT); - sc->sc_blkno = a; - sc->sc_nxrec = a + 1; } #ifdef HT_IOCTL --- 423,428 ---- *** /usr/src/sys/OTHERS/rm02.03.05/rm.c.old Thu Feb 19 15:11:48 1987 --- /usr/src/sys/OTHERS/rm02.03.05/rm.c Sun Sep 22 12:12:15 1991 *************** *** 74,80 **** #define RM_RDIST 6 struct buf rmtab; - struct buf rrmbuf[NRM]; #if NRM > 1 struct buf rmutab[NRM]; #endif --- 74,79 ---- *************** *** 525,550 **** rmustart(unit); #endif rmstart(); - } - - rmread(dev) - register dev_t dev; - { - register int unit = (minor(dev) >> 3) & 07; - - if (unit >= NRM) - return (ENXIO); - return (physio(rmstrategy, &rrmbuf[unit], dev, B_READ, WORD)); - } - - rmwrite(dev) - register dev_t dev; - { - register int unit = (minor(dev) >> 3) & 07; - - if (unit >= NRM) - return (ENXIO); - return (physio(rmstrategy, &rrmbuf[unit], dev, B_WRITE, WORD)); } #define exadr(x,y) (((long)(x) << 16) | (unsigned)(y)) --- 524,529 ---- *** /usr/src/sys/OTHERS/versatec/vp.c.old Wed Apr 11 17:44:30 1990 --- /usr/src/sys/OTHERS/versatec/vp.c Sun Sep 22 12:13:23 1991 *************** *** 137,143 **** uio->uio_resid++; if (vperror()) return; ! return (physio(vpstart, &vpbuf, dev, B_WRITE, WORD, uio)); /* note that newer 1200A's print @ 1000 lines/min = 2.2kbytes/sec */ } --- 137,143 ---- uio->uio_resid++; if (vperror()) return; ! return (physio(vpstart, &vpbuf, dev, B_WRITE, uio)); /* note that newer 1200A's print @ 1000 lines/min = 2.2kbytes/sec */ } *** /usr/src/sys/OTHERS/rp04.06/hp.c.old Thu Feb 19 15:11:12 1987 --- /usr/src/sys/OTHERS/rp04.06/hp.c Sun Sep 22 12:14:06 1991 *************** *** 77,83 **** }; struct buf hptab; - struct buf rhpbuf[NHP]; struct buf hputab[NHP]; #ifdef BADSECT struct dkbad hpbad[NHP]; --- 77,82 ---- *************** *** 484,509 **** if (as & (1 << unit)) hpustart(unit); hpstart(); - } - - hpread(dev) - register dev_t dev; - { - register int unit = (minor(dev) >> 3) & 07; - - if (unit >= NHP) - return (ENXIO); - return (physio(hpstrategy, &rhpbuf[unit], dev, B_READ, WORD)); - } - - hpwrite(dev) - register dev_t dev; - { - register int unit = (minor(dev) >> 3) & 07; - - if (unit >= NHP) - return (ENXIO); - return (physio(hpstrategy, &rhpbuf[unit], dev, B_WRITE, WORD)); } #define exadr(x,y) (((long)(x) << 16) | (unsigned)(y)) --- 483,488 ---- *** /usr/src/sys/OTHERS/rp04.06/hp_conf.c.old Thu Feb 26 18:26:55 1987 --- /usr/src/sys/OTHERS/rp04.06/hp_conf.c Sun Sep 22 12:28:32 1991 *************** *** 1,6 **** #include "hp.h" #if NHP > 0 ! int hpstrategy(), hpread(), hpwrite(), hproot(); extern struct buf hptab; #define hpopen nulldev #define hpclose nulldev --- 1,6 ---- #include "hp.h" #if NHP > 0 ! int hpstrategy(), hproot(); extern struct buf hptab; #define hpopen nulldev #define hpclose nulldev *************** *** 10,17 **** #define hpclose nodev #define hproot nulldev #define hpstrategy nodev - #define hpread nodev - #define hpwrite nodev #define _hptab ((struct buf *) NULL) #endif NHP --- 10,15 ---- *************** *** 19,22 **** hpopen, hpclose, hpstrategy, hproot, _hptab, /* hp = 14 */ hpopen, hpclose, hpread, hpwrite, ! nodev, nulldev, 0, SELECT(seltrue) --- 17,21 ---- hpopen, hpclose, hpstrategy, hproot, _hptab, /* hp = 14 */ hpopen, hpclose, hpread, hpwrite, ! nodev, nulldev, 0, SELECT(seltrue), ! hpstrategy, *** /usr/src/sys/OTHERS/fuji_160/dev/xp.c.old Thu May 28 01:12:16 1987 --- /usr/src/sys/OTHERS/fuji_160/dev/xp.c Sun Sep 22 12:15:05 1991 *************** *** 55,61 **** struct xp_controller xp_controller[NXP_CONTROLLER]; struct buf xptab; - struct buf rxpbuf[NXP]; struct buf xputab[NXP]; #ifdef INTRLVE --- 55,60 ---- *************** *** 246,252 **** mapalloc(bp); #endif UNIBUS_MAP #ifdef EXT_LSI ! if(bp == &rxpbuf) if(Sofub_alloc(bp) == 0) return; #endif --- 245,251 ---- mapalloc(bp); #endif UNIBUS_MAP #ifdef EXT_LSI ! if(bp->b_flags & B_PHYS) if(Sofub_alloc(bp) == 0) return; #endif *************** *** 553,559 **** xd->xp_cc = bp->b_cylin; bp->b_resid = - (xpaddr->hpwc << 1); #ifdef EXT_LSI ! if(bp == &rxpbuf) Sofub_relse(bp,bp->b_bcount); #endif iodone(bp); --- 552,558 ---- xd->xp_cc = bp->b_cylin; bp->b_resid = - (xpaddr->hpwc << 1); #ifdef EXT_LSI ! if(bp->b_flags & B_PHYS) Sofub_relse(bp,bp->b_bcount); #endif iodone(bp); *************** *** 574,592 **** xpustart(unit); xpstart(xc); } - - xpread(dev) - dev_t dev; - { - physio(xpstrategy, &rxpbuf[(minor(dev) >> 3) & 07], dev, B_READ); - } - - xpwrite(dev) - dev_t dev; - { - physio(xpstrategy, &rxpbuf[(minor(dev) >> 3) & 07], dev, B_WRITE); - } - #ifdef UCB_ECC #define exadr(x,y) (((long)(x) << 16) | (unsigned)(y)) --- 573,578 ---- *** /usr/src/sys/OTHERS/tektronix/tektronix.old Thu May 28 01:35:45 1987 --- /usr/src/sys/OTHERS/tektronix/tektronix Sun Sep 22 12:15:48 1991 *************** *** 103,110 **** (*cdevsw[major(fast_map[d])].d_read)(fast_map[d]); } ! fast_write(dev) dev_t dev; { register d; register struct device *addr; --- 103,111 ---- (*cdevsw[major(fast_map[d])].d_read)(fast_map[d]); } ! fast_write(dev, uio) dev_t dev; + struct uio *uio; { register d; register struct device *addr; *************** *** 130,136 **** fast[d].bc = u.u_count; if(u.u_count&1) u.u_count++; ! physio(fast_start, &fast_buf, dev, B_WRITE); } } else --- 131,137 ---- fast[d].bc = u.u_count; if(u.u_count&1) u.u_count++; ! physio(fast_start, &fast_buf, dev, B_WRITE, uio); } } else *** /usr/src/sys/OTHERS/rx01/rx.c.old Thu May 28 19:45:13 1987 --- /usr/src/sys/OTHERS/rx01/rx.c Sun Sep 22 12:16:16 1991 *************** *** 66,72 **** * Rx handler work areas */ struct buf rxtab, rxutab[NRX]; /* rxdevice tables */ - struct buf rrxbuf; /* * Rx strategy --- 66,71 ---- *************** *** 356,370 **** return (0); } return (1); - } - - rxread (dev) - { - physio (rxstrategy, &rrxbuf, dev, B_READ); - } - - rxwrite (dev) - { - physio (rxstrategy, &rrxbuf, dev, B_WRITE); } #endif NRX --- 355,359 ---- *** /usr/src/sys/OTHERS/scsi2/xe.c.old Thu May 28 19:45:14 1987 --- /usr/src/sys/OTHERS/scsi2/xe.c Sun Sep 22 12:16:39 1991 *************** *** 33,39 **** struct xedevice *XEADDR = (struct xedevice *) 0177460; struct buf xetab; - struct buf rxebuf; struct xecommand xec; u_short xecaddr[2]; struct xeinit xei[NXE]; --- 33,38 ---- *************** *** 474,490 **** iodone (bp); } xestart (); - } - - xeread (dev) - dev_t dev; - { - physio (xestrategy, &rxebuf, dev, B_READ); - } - - xewrite (dev) - dev_t dev; - { - physio (xestrategy, &rxebuf, dev, B_WRITE); } #endif NXE --- 473,477 ---- *** /usr/src/sys/OTHERS/ts/ts.c_Q22.old Thu Jun 19 17:50:26 1986 --- /usr/src/sys/OTHERS/ts/ts.c_Q22 Sun Sep 22 12:21:25 1991 *************** *** 46,59 **** struct buf tstab; struct buf ctsbuf; - /* - * Raw tape operations use rtsbuf. The driver - * notices when rtsbuf is being used and allows the user - * program to continue after errors and read records - * not of the standard length (BSIZE). - */ - struct buf rtsbuf; - struct tsdevice *TSADDR; #define INF ((daddr_t) ((u_short) 65535)) --- 46,51 ---- *************** *** 205,215 **** --- 197,217 ---- register struct buf *bp; { register s; + register struct ts_softc *sc; #ifdef UNIBUS_MAP if (bp != &ctsbuf) mapalloc(bp); #endif + + /* + * This is almost certainly wrong. See /sys/pdpuba/ts.c for how it's + * really done. + */ + sc = &ts_softc[TSUNIT(bp->b_dev)]; + sc->sc_blkno = dbtofsb(u.u_offset >> 9); + sc->sc_nxrec = sc->sc_blkno + 1; + bp->av_forw = NULL; s = spl5(); if (tstab.b_actf == NULL) *************** *** 412,418 **** * was too long or too short, then we don't * consider this an error. */ ! if (bp == &rtsbuf && (bp->b_flags & B_READ) && sc->sc_sts.s_xs0 & (TS_RLS | TS_RLL)) goto ignoreerr; /*NOTREACHED*/ --- 414,420 ---- * was too long or too short, then we don't * consider this an error. */ ! if (bp->b_flags & B_PHYS && (bp->b_flags & B_READ) && sc->sc_sts.s_xs0 & (TS_RLS | TS_RLL)) goto ignoreerr; /*NOTREACHED*/ *************** *** 433,439 **** * Non-i/o errors on non-raw tape * cause it to close. */ ! if (sc->sc_openf > 0 && bp != &rtsbuf) sc->sc_openf = -1; } break; --- 435,441 ---- * Non-i/o errors on non-raw tape * cause it to close. */ ! if (sc->sc_openf > 0 && !(bp->b_flags & B_PHYS)) sc->sc_openf = -1; } break; *************** *** 572,603 **** return (1); } return(0); - } - - tsread(dev) - register dev_t dev; - { - tsphys(dev); - bphysio(tsstrategy, &rtsbuf, dev, B_READ); - } - - tswrite(dev) - register dev_t dev; - { - tsphys(dev); - bphysio(tsstrategy, &rtsbuf, dev, B_WRITE); - } - - tsphys(dev) - dev_t dev; - { - register struct ts_softc *sc; - daddr_t a; - - sc = &ts_softc[TSUNIT(dev)]; - a = dbtofsb(u.u_offset >> 9); - sc->sc_blkno = a; - sc->sc_nxrec = a + 1; } #ifdef TS_IOCTL --- 574,579 ---- *** /usr/src/sys/OTHERS/tk/pdpuba/tk.c.old Sat Aug 13 17:59:01 1988 --- /usr/src/sys/OTHERS/tk/pdpuba/tk.c Sun Sep 22 12:22:10 1991 *************** *** 82,88 **** struct buf tktab[]; /* controller queue */ struct buf tkwtab; /* I/O wait queue */ - struct buf rtkbuf[]; /* RAW I/O buffer header, one per drive */ struct buf ctkbuf[]; /* buffer for tkcmd */ /* --- 82,87 ---- *************** *** 1173,1196 **** return(mp); } return(NULL); - } - - tkread(dev) - dev_t dev; - { - register unit; - - unit = minor(dev) & 7; - physio(tkstrategy, &rtkbuf[unit], dev, B_READ); - } - - tkwrite(dev) - dev_t dev; - { - register unit; - - unit = minor(dev) & 7; - physio(tkstrategy, &rtkbuf[unit], dev, B_WRITE); } tkfatal(unit, tkp, st, sa) --- 1172,1177 ---- *** /usr/src/sys/OTHERS/bad144/xp.c.old Sat Dec 31 17:25:17 1988 --- /usr/src/sys/OTHERS/bad144/xp.c Sun Sep 22 12:23:17 1991 *************** *** 225,231 **** #endif struct buf xptab; - struct buf rxpbuf[NXPD]; struct buf xputab[NXPD]; #ifdef BADSECT --- 225,230 ---- *************** *** 841,858 **** (as & (1 << xp_drive[unit].xp_unit))) xpustart(unit); xpstart(xc); - } - - xpread(dev) - dev_t dev; - { - return (physio(xpstrategy, &rxpbuf[xpunit(dev)], dev, B_READ, WORD)); - } - - xpwrite(dev) - dev_t dev; - { - return (physio(xpstrategy, &rxpbuf[xpunit(dev)], dev, B_WRITE, WORD)); } xpioctl(dev, cmd, data, flag) --- 840,845 ---- *** /usr/src/sys/OTHERS/README.old Fri Aug 28 01:52:10 1987 --- /usr/src/sys/OTHERS/README Sun Sep 22 16:14:06 1991 *************** *** 13,19 **** use the versatec driver as an example. Since it's a UNIBUS driver, we'll move vp.c into pdpuba. If you're installing a driver from the OTHERS directory, or you've got a local work of art that you wish to use, there ! are a few things you should check so that it will work correctly with 2.10BSD: Note, in the following examples, "XX" is the two or three letter designation that device drivers under UNIX get assigned, e.g. "vp" --- 13,19 ---- use the versatec driver as an example. Since it's a UNIBUS driver, we'll move vp.c into pdpuba. If you're installing a driver from the OTHERS directory, or you've got a local work of art that you wish to use, there ! are a few things you should check so that it will work correctly with 2.11BSD: Note, in the following examples, "XX" is the two or three letter designation that device drivers under UNIX get assigned, e.g. "vp" *************** *** 23,39 **** b) If your XXread and XXwrite routines use physio(), make sure that you're passing the correct number and types of arguments. - Between 2.9BSD and 2.10BSD a new argument was added to the - physio call that specifies whether WORD or BYTE transfers are - being attempted. c) The XXread and XXwrite routines should return 0, if successful, and the correct errno value (for later assignment to u.u_error) ! if they fail. It's cool to just return the result of physio(), ! it does the right thing. ! d) The XXioctl routine has changed a *lot* between 2.9 and 2.10: + XXioctl() now takes four arguments, (dev, cmd, data, flags) a device (dev_t), the ioctl command (u_int), a buffer address (caddr_t), and some flags (int). Of real --- 23,50 ---- b) If your XXread and XXwrite routines use physio(), make sure that you're passing the correct number and types of arguments. + Between the initial release of 2.11BSD and the present the + WORD/BYTE argument (added between 2.9 and 2.10) was removed. + If it is important to enforce alignment this can be done in + either the strategy routine or in XXread/XXwrite before calling + physio(). + c) The XXread and XXwrite routines should return 0, if successful, and the correct errno value (for later assignment to u.u_error) ! if they fail. All the XXread and XXwrite routines which only ! called physio() have been removed (the common routines rawread() ! and rawwrite() replacing XXread() and XXwrite() in the cdevsw[] ! table). ! Note: If XXread() and/or XXwrite() only calls physio() then ! the XXread and XXwrite entry points can be removed and the common ! routines 'rawread', 'rawwrite' used in the cdevsw[] table. See ! the entries for any of the disc or tape drivers for examples of ! this. + d) The XXioctl routine has changed a *lot* between 2.9 and 2.11: + + XXioctl() now takes four arguments, (dev, cmd, data, flags) a device (dev_t), the ioctl command (u_int), a buffer address (caddr_t), and some flags (int). Of real *************** *** 62,74 **** on "UNIBUS_MAP". You should ifdef *real* 22-bit QBUS addressing with the define "Q22" (see the comments in conf/GENERIC and pdp/machdep2.c.) Buffer cache buffers have to be mapped in to ! be accessed in 2.9BSD and 2.10BSD. I don't really understand how it worked before then, but some of the drivers in the OTHERS directory predate that, so be paranoid. f) The device addresses and partition table sizes should be included in the device driver itself, not in ioconf.c (which ! doesn't exist anymore.) See the drivers in pdpuba for examples. g) You should have an XXopen() routine that validates the unit number for the read, write, and ioctl system calls. See the --- 73,86 ---- on "UNIBUS_MAP". You should ifdef *real* 22-bit QBUS addressing with the define "Q22" (see the comments in conf/GENERIC and pdp/machdep2.c.) Buffer cache buffers have to be mapped in to ! be accessed in 2.9BSD and 2.11BSD. I don't really understand how it worked before then, but some of the drivers in the OTHERS directory predate that, so be paranoid. f) The device addresses and partition table sizes should be included in the device driver itself, not in ioconf.c (which ! is used for an entirely different purpose now.) See the drivers ! in pdpuba for examples. g) You should have an XXopen() routine that validates the unit number for the read, write, and ioctl system calls. See the *************** *** 211,221 **** --- 223,235 ---- #include "vp.h" #if NVP > 0 int vpopen(), vpclose(), vpwrite(), vpioctl(); + #define vpstrategy nulldev #else #define vpopen nodev #define vpclose nodev #define vpwrite nodev #define vpioctl nodev + #define vpstrategy nodev #endif NVP to the character device definition section of conf.c, and *************** *** 222,231 **** /* vp = 20 */ vpopen, vpclose, nodev, vpwrite, ! vpioctl, nulldev, 0, SELECT(nodev) to the character device switch table (cdevsw[]). Note, in our example, we've been assuming that NVP is the define that governs whether or not the device is included, as well as how many of them we have. For example, "#define NVP 5" in the file "vp.h" means that we --- 236,267 ---- /* vp = 20 */ vpopen, vpclose, nodev, vpwrite, ! vpioctl, nulldev, 0, SELECT(nodev), ! vpstrategy, to the character device switch table (cdevsw[]). + The strategy member of the cdevsw[] structure is new since 2.11BSD was + released. Since VP does not have a strategy routine a dummy definition + is created. Other devices (such as disc and tape drivers) do have + strategy routines and their entries look like: + + #include "tms.h" + #if NTMS > 0 + int tmscpopen(), tmscpclose(), tmscpstrategy(), tmscpioctl(); + #else + #define tmscpopen nodev + #define tmscpclose nodev + #define tmscpioctl nodev + #define tmscpstrategy nodev + #endif + + /* tmscp = 23 (tu81/tk50) */ + tmscpopen, tmscpclose, rawread, rawwrite, + tmscpioctl, nulldev, 0, seltrue, + tmscpstrategy, + }; + Note, in our example, we've been assuming that NVP is the define that governs whether or not the device is included, as well as how many of them we have. For example, "#define NVP 5" in the file "vp.h" means that we *************** *** 310,317 **** 2.9BSD and you'd probably be better off rewriting it from scratch or buying an IBM PC" ... ! Keith Bostic & Casey Leedom ORIGINAL README: ---------------- --- 346,361 ---- 2.9BSD and you'd probably be better off rewriting it from scratch or buying an IBM PC" ... ! Several of the drivers in the OTHERS directory should eventually ! be removed because working versions exist in the pdpuba directory. These ! are the ts-11 (OTHERS/ts - pdpuba/ts.c), rp04/rp06 (OTHERS/rp04.06 - ! pdpuba/xp.c), TMSCP (OTHERS/tk - pdpuba/tmscp.c), RX01&RX02 (OTHERS/rx01, ! OTHERS/rx02 - pdpuba/rx.c), MSCP (OTHERS/ra - pdpuba/ra.c), TU-16 (OTHERS/ht - ! pdpuba/ht.c), rm02/rm03/rm05 (OTHERS/rm02.03.05 - pdpuba/xp.c), Fuji-160 ! (OTHERS/fuji_160 - pdpuba/xp.c), dm11 (OTHERS/dm11 - pdpuba/dh.c). + + Keith Bostic & Casey Leedom (revised by Steven Schultz) ORIGINAL README: ----------------