PDP11: Reworked RH to device mapping for proper static address assignment

Operating systems and boot driver code presume that each Massbus
device will always be at a specific fixed address and use a specific fixed vector.
The prior implementation assigned the first active Massbus device to RHA
and followed in order for subsequent devices.  This could leave devices at
addresses and vectors that software or boot drivers wouldn't expect.

The problem which was originally reported in #301 should now be properly
solved.  As a consequence of the need to have fixed addresses and vectors,
some combinations of devices can not coexist in a system without causing
conflicts with each other.  TM and TU have conflicting interrupts.  TM and
TS have conflicting addresses and interrupts.
This commit is contained in:
Mark Pizzolato 2017-02-23 12:26:39 -08:00
parent f9cfae0c00
commit 1e981e0d64
3 changed files with 12 additions and 53 deletions

View file

@ -418,6 +418,5 @@ for (i = 0; (dptr = sim_devices[i]) != NULL; i++) { /* loop thru dev */
}
} /* end if enabled */
} /* end for */
fixup_mbus_tab ();
return SCPE_OK;
}

View file

@ -581,8 +581,12 @@ AUTO_CON auto_tab[] = {/*c #v am vm fxa fxv */
{017300} }, /* KE11-A - fx CSR, no VEC */
{ { "KG" }, 1, 0, 0, 0,
{010700} }, /* KG11-A - fx CSR, no VEC */
{ { "RHA", "RHB", "RHC" }, 1, 1, 0, 0,
{016700, 012440, 012040}, {0254, 0224, 0204} }, /* RH11/RH70 - fx CSR, fx VEC */
{ { "RHA" }, 1, 1, 0, 0,
{016700}, {0254} }, /* RH11/RH70 - fx CSR, fx VEC */
{ { "RHB" }, 1, 1, 0, 0,
{012440}, {0224} }, /* RH11/RH70 - fx CSR, fx VEC */
{ { "RHC" }, 1, 1, 0, 0,
{012040}, {0204} }, /* RH11/RH70 - fx CSR, fx VEC */
{ { "CLK" }, 1, 1, 0, 0,
{017546}, {0100} }, /* KW11L - fx CSR, fx VEC */
{ { "PCLK" }, 1, 1, 0, 0,

View file

@ -184,8 +184,6 @@ static t_stat (*mbregR[MBA_NUM])(int32 *dat, int32 ad, int32 md);
static t_stat (*mbregW[MBA_NUM])(int32 dat, int32 ad, int32 md);
static int32 (*mbabort[MBA_NUM])(void);
static int32 mba_active = 0; /* Number of active MBA's */
/* Unibus to register offset map */
static int32 mba_mapofs[(MBA_OFSMASK + 1) >> 1] = {
@ -892,7 +890,6 @@ for (i = mba_devs = 0; sim_devices[i] != NULL; i++) {
mba_devs++;
}
}
mba_active = 0;
}
/* Build dispatch tables */
@ -900,13 +897,16 @@ mba_active = 0;
t_stat build_mbus_tab (DEVICE *dptr, DIB *dibp)
{
uint32 idx;
static const char *mbus_devs[MBA_NUM+1] = {"RP", "TU", "RS", NULL};
if ((dptr == NULL) || (dibp == NULL)) /* validate args */
return SCPE_IERR;
idx = mba_active++;
for (idx = 0; mbus_devs[idx]; idx++)
if (!strcmp (dptr->name, mbus_devs[idx]))
break;
if ((!mbus_devs[idx]) || (idx >= MBA_NUM))
return SCPE_IERR;
dibp->ba = idx; /* Mbus # */
if (idx >= MBA_NUM)
return SCPE_STOP;
if ((mbregR[idx] && dibp->rd && /* conflict? */
(mbregR[idx] != dibp->rd)) ||
(mbregW[idx] && dibp->wr &&
@ -926,50 +926,6 @@ mba_dev[idx].flags &= ~DEV_DIS; /* mark MBA enabled */
return build_ubus_tab (&mba_dev[idx], (DIB *)mba_dev[idx].ctxt);
}
void fixup_mbus_tab (void)
{
uint32 idx, idy, active;
DEVICE *dptr;
DIB *dibp;
static const char *mbus_devs[MBA_NUM+1] = {"RP", "TU", "RS", NULL};
for (idx = active = 0; idx < MBA_NUM; idx++) {
dptr = find_dev (mbus_devs[idx]);
if (!dptr)
break;
if (dptr->flags & DEV_DIS)
continue;
dibp = (DIB *)dptr->ctxt;
if (dibp->ba != active) {
t_stat (*TmbregR)(int32 *dat, int32 ad, int32 md) = mbregR[active];
t_stat (*TmbregW)(int32 dat, int32 ad, int32 md) = mbregW[active];
int32 (*Tmbabort)(void) = mbabort[active];
mbregR[active] = mbregR[dibp->ba];
mbregW[active] = mbregW[dibp->ba];
mbabort[active] = mbabort[dibp->ba];;
mbregR[dibp->ba] = TmbregR;
mbregW[dibp->ba] = TmbregW;
mbabort[dibp->ba] = Tmbabort;;
for (idy = 1; idy < MBA_NUM; idy++) {
DEVICE *ydptr = find_dev (mbus_devs[idy]);
DIB *ydibp = (DIB *)ydptr->ctxt;
if (ydibp->ba != active)
continue;
ydibp->ba = dibp->ba;
dibp->ba = active;
break;
}
}
((DIB *)mba_dev[dibp->ba].ctxt)->lnt = dibp->lnt;
((DIB *)mba_dev[dibp->ba].ctxt)->ulnt = dibp->ulnt;
++active;
}
}
t_stat rh_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, const char *cptr)
{
const char *const text =