SHOW IOSPACE, again

Show IOSPACE doesn't always get the number of devices right due to device creativity.

o The distinction between UNIT and DEVICE has blurred
o MUX devices merge several physical devices into one device/unit
o Dynamic device sizing has made things more volatile.

This edit solves the problem for SHOW IOSPACE by adding an (optional) word to the DIBs.
The word contains the amount of IO space consumed by each instance of the physical device that's being emulated.
E.G., if it's a DZ11, the device is the DZ11 module, or 8 lines, even though the MUX device may support 32.

This enables SHOW IOSPACE to determine the number of physical devices being emulated, which is what folks need when configuring software.  The word may have other uses - in a generic dynamic device sizing routine - which is why the amount of IOSPACE per device was chosen rather than the 'number of physical devices.'

The edit should not make any existing device regress.  If the new word (ulnt) is zero (not initialized), SHOW IOSPACE will default to the number of units in the device, or if there's no device (CPUs), 1 as before.  If it is present, the number of devices is the calculated as total allocation/allocation-per-device.

The edit updates all the devices that seem to require this treatment, and all the processors that define the UNIBUS/QBUS DIBs.
This commit is contained in:
Timothe Litt 2013-07-11 15:39:15 -04:00
parent 95e54dc60e
commit 91c7d26095
34 changed files with 57 additions and 32 deletions

View file

@ -613,6 +613,7 @@ struct pdp_dib {
int32 vloc; /* locator */
int32 vec; /* value */
int32 (*ack[VEC_DEVMAX])(void); /* ack routines */
uint32 ulnt; /* IO length per unit */
};
typedef struct pdp_dib DIB;

View file

@ -1129,8 +1129,8 @@ while (done == 0) { /* sort ascending */
}
}
} /* end while */
fprintf (st, " Address Vector BR Device\n"
"----------------- -------- -- ------\n");
fprintf (st, " Address Vector BR # Device\n"
"----------------- -------- -- -- ------\n");
for (i = 0; dib_tab[i] != NULL; i++) { /* print table */
for (j = 0, dptr = NULL; sim_devices[j] != NULL; j++) {
if (((DIB*) sim_devices[j]->ctxt) == dib_tab[i]) {
@ -1156,7 +1156,8 @@ for (i = 0; dib_tab[i] != NULL; i++) { /* print table */
(dib_tab[i]->vloc<=19)? 5: 4);
else
fprintf (st, " ");
fprintf (st, " %s\n", dptr? sim_dname (dptr): "CPU");
fprintf (st, " %2u %s\n", (dib_tab[i]->ulnt? dib_tab[i]->lnt/dib_tab[i]->ulnt:
(dptr? dptr->numunits: 1)), dptr? sim_dname (dptr): "CPU");
}
return SCPE_OK;
}

View file

@ -387,7 +387,7 @@ t_stat rp_set_size (UNIT *uptr, int32 val, char *cptr, void *desc);
DIB rp_dib = {
IOBA_RP, IOLN_RP, &rp_rd, &rp_wr,
1, IVCL (RP), VEC_RP, { &rp_inta }
1, IVCL (RP), VEC_RP, { &rp_inta }, IOLN_RP
};
UNIT rp_unit[] = {

View file

@ -359,7 +359,7 @@ t_stat tu_map_err (UNIT *uptr, t_stat st, t_bool qdt);
DIB tu_dib = {
IOBA_TU, IOLN_TU, &tu_rd, &tu_wr,
1, IVCL (TU), VEC_TU, { &tu_inta }
1, IVCL (TU), VEC_TU, { &tu_inta }, IOLN_TU,
};
UNIT tu_unit[] = {

View file

@ -154,7 +154,7 @@ char *dcx_description (DEVICE *dptr);
DIB dci_dib = {
IOBA_AUTO, IOLN_DC * DCX_LINES, &dcx_rd, &dcx_wr,
2, IVCL (DCI), VEC_AUTO, { &dci_iack, &dco_iack }
2, IVCL (DCI), VEC_AUTO, { &dci_iack, &dco_iack }, IOLN_DC,
};
UNIT dci_unit = { UDATA (&dci_svc, 0, 0), KBD_POLL_WAIT };

View file

@ -511,6 +511,7 @@ struct pdp_dib {
int32 vloc; /* locator */
int32 vec; /* value */
int32 (*ack[VEC_DEVMAX])(void); /* ack routines */
uint32 ulnt; /* IO length per-unit */
};
typedef struct pdp_dib DIB;

View file

@ -118,7 +118,7 @@ void dlx_reset_ln (int32 ln);
DIB dli_dib = {
IOBA_AUTO, IOLN_DL * DLX_LINES, &dlx_rd, &dlx_wr,
2, IVCL (DLI), VEC_AUTO, { &dli_iack, &dlo_iack }
2, IVCL (DLI), VEC_AUTO, { &dli_iack, &dlo_iack }, IOLN_DL,
};
UNIT dli_unit = { UDATA (&dli_svc, 0, 0), KBD_POLL_WAIT };
@ -160,7 +160,7 @@ DEVICE dli_dev = {
1, 10, 31, 1, 8, 8,
NULL, NULL, &dlx_reset,
NULL, &dlx_attach, &dlx_detach,
&dli_dib, DEV_UBUS | DEV_QBUS | DEV_DISABLE | DEV_DIS | DEV_MUX
&dli_dib, DEV_UBUS | DEV_QBUS | DEV_DISABLE | DEV_DIS
};
/* DLO data structures
@ -219,7 +219,7 @@ DEVICE dlo_dev = {
DLX_LINES, 10, 31, 1, 8, 8,
NULL, NULL, &dlx_reset,
NULL, NULL, NULL,
NULL, DEV_UBUS | DEV_QBUS | DEV_DISABLE | DEV_DIS
NULL, DEV_UBUS | DEV_QBUS | DEV_DISABLE | DEV_DIS | DEV_MUX
};
/* Terminal input routines */

View file

@ -293,7 +293,8 @@ char *dz_description (DEVICE *dptr);
DIB dz_dib = {
IOBA_AUTO, IOLN_DZ * DZ_MUXES, &dz_rd, &dz_wr,
2, IVCL (DZRX), VEC_AUTO, { &dz_rxinta, &dz_txinta }
2, IVCL (DZRX), VEC_AUTO, { &dz_rxinta, &dz_txinta },
IOLN_DZ,
};
UNIT dz_unit = { UDATA (&dz_svc, UNIT_IDLE|UNIT_ATTABLE|DZ_8B_DFLT, 0) };

View file

@ -581,7 +581,7 @@ char *hk_description (DEVICE *dptr);
DIB hk_dib = {
IOBA_AUTO, IOLN_HK, &hk_rd, &hk_wr,
1, IVCL (HK), VEC_AUTO, { NULL }
1, IVCL (HK), VEC_AUTO, { NULL }, IOLN_HK,
};
UNIT hk_unit[] = {

View file

@ -298,7 +298,7 @@ t_stat show_iospace (FILE *st, UNIT *uptr, int32 val, void *desc)
uint32 i, j;
DEVICE *dptr;
DIB *dibp;
uint32 maxaddr, maxname;
uint32 maxaddr, maxname, maxdev;
int32 maxvec, vecwid;
char valbuf[40];
@ -308,6 +308,7 @@ if (build_dib_tab ()) /* build IO page */
maxaddr = 0;
maxvec = 0;
maxname = 0;
maxdev = 1;
for (i = 0, dibp = NULL; i < (IOPAGESIZE >> 1); i++) { /* loop thru entries */
size_t l;
@ -326,6 +327,10 @@ for (i = 0, dibp = NULL; i < (IOPAGESIZE >> 1); i++) { /* loop thru entries */
l = strlen (dptr? sim_dname (dptr): "CPU");
if (l>maxname)
maxname = (int32)l;
j = (dibp->ulnt? dibp->lnt/dibp->ulnt:
(dptr? dptr->numunits: 1));
if (j > maxdev)
maxdev = j;
} /* end if */
} /* end for i */
maxaddr = fprint_val (NULL, (t_value) dibp->ba, DEV_RDX, 32, PV_LEFT);
@ -333,6 +338,8 @@ sprintf (valbuf, "%03o", maxvec);
vecwid = maxvec = (int32) strlen (valbuf);
if (vecwid < 3)
vecwid = 3;
sprintf (valbuf, "%u", maxdev);
maxdev = (uint32)strlen (valbuf);
j = strlen ("Address");
i = (maxaddr*2)+3+1;
@ -352,7 +359,7 @@ else
maxvec = i+j;
fprintf (st, " %*.*sVector%*.*s", i/2, i/2, " ", (i/2)+i%2, (i/2)+i%2, " ");
fprintf (st, " BR Device\n");
fprintf (st, " BR %*.*s# Device\n", (maxdev -1), (maxdev-1));
for (i = 0; i < maxaddr; i++)
fputc ('-', st);
fprintf (st, " ");
@ -360,6 +367,10 @@ for (i = 0; i < (uint32)maxvec; i++)
fputc ('-', st);
fprintf (st, " -- ");
for (i=0; i < maxdev; i++) {
fputc ('-', st);
}
fputc (' ', st);
i = strlen ("Device");
if (maxname < i)
@ -397,7 +408,9 @@ for (i = 0, dibp = NULL; i < (IOPAGESIZE >> 1); i++) { /* loop thru entries */
fprintf (st, " %2u", dibp->vloc/32);
else
fprintf (st, " ");
fprintf (st, " %s\n", dptr? sim_dname (dptr): "CPU");
fprintf (st, " %*u %s\n", maxdev, (dibp->ulnt? dibp->lnt/dibp->ulnt:
(dptr? dptr->numunits: 1)),
dptr? sim_dname (dptr): "CPU");
} /* end if */
} /* end for i */
return SCPE_OK;

View file

@ -201,7 +201,7 @@ static DIB kg_dib = {
(IOLN_KG + 2) * KG_UNITS,
&kg_rd,
&kg_wr,
0, 0, 0, { NULL }
0, 0, 0, { NULL }, IOLN_KG+2
};
static UNIT kg_unit[] = {

View file

@ -187,7 +187,7 @@ static DIB rc_dib = {
IOLN_RC,
&rc_rd,
&rc_wr,
1, IVCL (RC), VEC_AUTO, { NULL }
1, IVCL (RC), VEC_AUTO, { NULL }, IOLN_RC,
};
static UNIT rc_unit = {

View file

@ -145,7 +145,7 @@ uint32 update_rfcs (uint32 newcs, uint32 newdae);
DIB rf_dib = {
IOBA_AUTO, IOLN_RF, &rf_rd, &rf_wr,
1, IVCL (RF), VEC_AUTO, {NULL}
1, IVCL (RF), VEC_AUTO, {NULL}, IOLN_RF,
};

View file

@ -207,7 +207,7 @@ static int32 mba_mapofs[(MBA_OFSMASK + 1) >> 1] = {
DIB mba0_dib = {
IOBA_AUTO, IOLN_RP, &mba_rd, &mba_wr,
1, IVCL (RP), VEC_AUTO, { &mba0_inta }
1, IVCL (RP), VEC_AUTO, { &mba0_inta }, IOLN_RP,
};
UNIT mba0_unit = { UDATA (NULL, 0, 0) };

View file

@ -216,7 +216,7 @@ t_stat rk_boot (int32 unitno, DEVICE *dptr);
DIB rk_dib = {
IOBA_AUTO, IOLN_RK, &rk_rd, &rk_wr,
1, IVCL (RK), VEC_AUTO, { &rk_inta }
1, IVCL (RK), VEC_AUTO, { &rk_inta }, IOLN_RK,
};
UNIT rk_unit[] = {

View file

@ -275,7 +275,7 @@ char *rl_description (DEVICE *dptr);
static DIB rl_dib = {
IOBA_AUTO, IOLN_RL, &rl_rd, &rl_wr,
1, IVCL (RL), VEC_AUTO, { NULL } };
1, IVCL (RL), VEC_AUTO, { NULL }, IOLN_RL };
static UNIT rl_unit[] = {
{ UDATA (&rl_svc, UNIT_FIX+UNIT_ATTABLE+UNIT_DISABLE+

View file

@ -857,7 +857,7 @@ MSC rq_ctx = { 0 };
DIB rq_dib = {
IOBA_AUTO, IOLN_RQ, &rq_rd, &rq_wr,
1, IVCL (RQ), 0, { &rq_inta }
1, IVCL (RQ), 0, { &rq_inta }, IOLN_RQ
};
UNIT rq_unit[] = {

View file

@ -144,7 +144,7 @@ void rx_done (int32 esr_flags, int32 new_ecode);
DIB rx_dib = {
IOBA_AUTO, IOLN_RX, &rx_rd, &rx_wr,
1, IVCL (RX), VEC_AUTO, { NULL }
1, IVCL (RX), VEC_AUTO, { NULL }, IOLN_RX,
};
UNIT rx_unit[] = {

View file

@ -180,7 +180,7 @@ char *ry_description (DEVICE *dptr);
DIB ry_dib = {
IOBA_AUTO, IOLN_RY, &ry_rd, &ry_wr,
1, IVCL (RY), VEC_AUTO, { NULL }
1, IVCL (RY), VEC_AUTO, { NULL }, IOLN_RY,
};
UNIT ry_unit[] = {

View file

@ -150,7 +150,7 @@ uint32 ta_crc (uint8 *buf, uint32 cnt);
DIB ta_dib = {
IOBA_AUTO, IOLN_TA, &ta_rd, &ta_wr,
1, IVCL (TA), VEC_AUTO, { NULL }
1, IVCL (TA), VEC_AUTO, { NULL }, IOLN_TA
};
UNIT ta_unit[] = {

View file

@ -319,7 +319,7 @@ int32 dt_gethdr (UNIT *uptr, int32 blk, int32 relpos);
DIB dt_dib = {
IOBA_AUTO, IOLN_TC, &dt_rd, &dt_wr,
1, IVCL (DTA), VEC_AUTO, { NULL }
1, IVCL (DTA), VEC_AUTO, { NULL }, IOLN_TC,
};
UNIT dt_unit[] = {

View file

@ -191,7 +191,7 @@ t_stat tm_vlock (UNIT *uptr, int32 val, char *cptr, void *desc);
DIB tm_dib = {
IOBA_AUTO, IOLN_TM, &tm_rd, &tm_wr,
1, IVCL (TM), VEC_AUTO, { NULL }
1, IVCL (TM), VEC_AUTO, { NULL }, IOLN_TM,
};
UNIT tm_unit[] = {

View file

@ -417,7 +417,7 @@ UNIT *tq_getucb (uint32 lu);
DIB tq_dib = {
IOBA_AUTO, IOLN_TQ, &tq_rd, &tq_wr,
1, IVCL (TQ), 0, { &tq_inta }
1, IVCL (TQ), 0, { &tq_inta }, IOLN_TQ,
};
UNIT tq_unit[] = {

View file

@ -311,7 +311,7 @@ char *ts_description (DEVICE *dptr);
DIB ts_dib = {
IOBA_AUTO, IOLN_TS, &ts_rd, &ts_wr,
1, IVCL (TS), VEC_AUTO, { NULL }
1, IVCL (TS), VEC_AUTO, { NULL }, IOLN_TS
};
UNIT ts_unit = { UDATA (&ts_svc, UNIT_ATTABLE + UNIT_ROABLE + UNIT_DISABLE, 0) };

View file

@ -361,7 +361,8 @@ static DIB vh_dib = {
2, /* # of vectors */
IVCL (VHRX),
VEC_FLOAT,
{ &vh_rxinta, &vh_txinta } /* int. ack. routines */
{ &vh_rxinta, &vh_txinta }, /* int. ack. routines */
IOLN_VH, /* IO space per device */
};
static UNIT vh_unit[VH_MUXES] = {

View file

@ -326,7 +326,7 @@ struct xq_device xqb = {
#define IOLN_XQ 020
DIB xqa_dib = { IOBA_AUTO, IOLN_XQ, &xq_rd, &xq_wr,
1, IVCL (XQ), 0, { &xq_int } };
1, IVCL (XQ), 0, { &xq_int }, IOLN_XQ };
UNIT xqa_unit[] = {
{ UDATA (&xq_svc, UNIT_IDLE|UNIT_ATTABLE|UNIT_DISABLE, 2047) }, /* receive timer */

View file

@ -134,7 +134,7 @@ char *xu_description (DEVICE *dptr);
#define IOLN_XU 010
DIB xua_dib = { IOBA_AUTO, IOLN_XU, &xu_rd, &xu_wr,
1, IVCL (XU), VEC_AUTO, {&xu_int} };
1, IVCL (XU), VEC_AUTO, {&xu_int}, IOLN_XU };
UNIT xua_unit[] = {
{ UDATA (&xu_svc, UNIT_IDLE|UNIT_ATTABLE|UNIT_DISABLE, 0) }, /* receive timer */
@ -234,7 +234,7 @@ DEVICE xu_dev = {
#define IOLN_XU 010
DIB xub_dib = { IOBA_AUTO, IOLN_XU, &xu_rd, &xu_wr,
1, IVCL (XU), 0, { &xu_int } };
1, IVCL (XU), 0, { &xu_int }, IOLN_XU };
UNIT xub_unit[] = {
{ UDATA (&xu_svc, UNIT_IDLE|UNIT_ATTABLE|UNIT_DISABLE, 0) } /* receive timer */

View file

@ -196,6 +196,7 @@ typedef struct {
int32 vloc; /* locator */
int32 vec; /* value */
int32 (*ack[VEC_DEVMAX])(void); /* ack routine */
uint32 ulnt; /* IO length per unit */
} DIB;
/* Qbus I/O page layout - see pdp11_io_lib.c for address layout details */

View file

@ -243,6 +243,7 @@ typedef struct {
int32 vloc; /* locator */
int32 vec; /* value */
int32 (*ack[VEC_DEVMAX])(void); /* ack routine */
uint32 ulnt; /* IO length per unit */
} DIB;
/* Qbus I/O page layout - see pdp11_io_lib.c for address layout details */

View file

@ -237,6 +237,7 @@ typedef struct {
int32 vloc; /* locator */
int32 vec; /* value */
int32 (*ack[VEC_DEVMAX])(void); /* ack routine */
uint32 ulnt; /* IO length per unit */
} DIB;
/* Unibus I/O page layout - see pdp11_io_lib.c for address layout details */

View file

@ -274,6 +274,7 @@ typedef struct {
int32 vloc; /* locator */
int32 vec; /* value */
int32 (*ack[VEC_DEVMAX])(void); /* ack routine */
uint32 ulnt; /* IO length per unit */
} DIB;
/* Unibus I/O page layout - see pdp11_io_lib.c for address layout details

View file

@ -286,6 +286,7 @@ typedef struct {
int32 vloc; /* locator */
int32 vec; /* value */
int32 (*ack[VEC_DEVMAX])(void); /* ack routine */
uint32 ulnt; /* IO length per unit */
} DIB;
/* Unibus I/O page layout - see pdp11_io_lib.c for address layout details

View file

@ -321,6 +321,7 @@ typedef struct {
int32 vloc; /* locator */
int32 vec; /* value */
int32 (*ack[VEC_DEVMAX])(void); /* ack routine */
uint32 ulnt; /* IO length per unit */
} DIB;
/* Unibus I/O page layout - XUB,RQB,RQC,RQD float based on number of DZ's

View file

@ -284,6 +284,7 @@ typedef struct {
int32 vloc; /* locator */
int32 vec; /* value */
int32 (*ack[VEC_DEVMAX])(void); /* ack routine */
uint32 ulnt; /* IO length per unit */
} DIB;
/* Qbus I/O page layout - see pdp11_io_lib.c for address layout details */