Subject: Bug in multiple controller support in MSCP driver (+fix) Index: sys/pdpuba/ra.c 2.11BSD Description: The multiple controller support in the MSCP (ra.c) driver only works with the first controller. The first access to a drive on additional controller will crash the system. Repeat-By: Add a second MSCP controller with a drive attached. Attempt to create a file system on the drive. Fix: The problem was in not clearing the controller number when using the "dkunit()" macro. The patch below will fix the problem by adding a mask of 7 after the two uses of dkunit(). -------------------------------------------------------------------------- *** /sys/pdpuba/ra.c.old Sun Sep 22 08:40:02 1991 --- /sys/pdpuba/ra.c Wed Dec 18 01:02:09 1991 *************** *** 14,19 **** --- 14,24 ---- /* * ra.c - MSCP Driver + * Date: Dec 18 1991 + * The controller number (bits 6 and 7 of the minor device) were not + * being masked off after using dkunit(). This caused a crash when + * the controller number was other than 0. + * * Date: Sep 22 1991 * The read and write entries were removed as part of implementing the * common rawread and rawwrite routines. *************** *** 436,442 **** int s; /* Is disk online */ ! if ((disk = sc->sc_drives[dkunit(bp)]) == NULL || disk->ra_dsize <= 0L) goto bad; /* Valid block in device partition */ --- 441,447 ---- int s; /* Is disk online */ ! if ((disk = sc->sc_drives[dkunit(bp) & 7]) == NULL || disk->ra_dsize <= 0L) goto bad; /* Valid block in device partition */ *************** *** 551,557 **** goto out; mp->m_cmdref = (unsigned)bp; /* pointer to get back */ mp->m_opcode = bp->b_flags & B_READ ? M_O_READ : M_O_WRITE; ! mp->m_unit = dkunit(bp); disk = sc->sc_drives[mp->m_unit]; temp = bp->b_blkno + disk->ra_size[minor(bp->b_dev) & 7].blkoff; mp->m_lbn_l = loint(temp); --- 556,562 ---- goto out; mp->m_cmdref = (unsigned)bp; /* pointer to get back */ mp->m_opcode = bp->b_flags & B_READ ? M_O_READ : M_O_WRITE; ! mp->m_unit = dkunit(bp) & 7; disk = sc->sc_drives[mp->m_unit]; temp = bp->b_blkno + disk->ra_size[minor(bp->b_dev) & 7].blkoff; mp->m_lbn_l = loint(temp);