From 3e3c05523c66b9ff0df19d88985132a05755d6c9 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 6 Jan 2016 08:08:19 -0800 Subject: [PATCH] PDP11, VAX: Fix AutoConfigure to allow multiple dynamically configured devices to allocate from the same pool of fixed addresses. Dynamically configured devices simulate multiple controllers with a single DEVICE structure and can have the number of controllers being simulated set by the user. DLI, DZ, DUP, DMC, TDC, VH, DC are all dynamically configured devices. DLI and TDC are dynamically configured devices which get static bus addresses. --- PDP11/pdp11_defs.h | 6 +++++ PDP11/pdp11_io_lib.c | 53 ++++++++++++++++++-------------------------- VAX/vax610_defs.h | 10 ++++++++- VAX/vax630_defs.h | 10 ++++++++- VAX/vax730_defs.h | 10 ++++++++- VAX/vax750_defs.h | 10 ++++++++- VAX/vax780_defs.h | 10 ++++++++- VAX/vax860_defs.h | 10 ++++++++- VAX/vaxmod_defs.h | 10 ++++++++- 9 files changed, 90 insertions(+), 39 deletions(-) diff --git a/PDP11/pdp11_defs.h b/PDP11/pdp11_defs.h index fca5fa4d..40633823 100644 --- a/PDP11/pdp11_defs.h +++ b/PDP11/pdp11_defs.h @@ -521,6 +521,12 @@ struct pdp_dib { uint32 ulnt; /* IO length per-device */ /* Only need to be populated */ /* when numunits != num devices */ + int32 numc; /* Number of controllers */ + /* this field handles devices */ + /* where multiple instances are */ + /* simulated through a single */ + /* DEVICE structure (e.g., DZ, VH, DL, DC). */ + /* Populated by auto-configure */ }; typedef struct pdp_dib DIB; diff --git a/PDP11/pdp11_io_lib.c b/PDP11/pdp11_io_lib.c index 98d444d1..61ad5a15 100644 --- a/PDP11/pdp11_io_lib.c +++ b/PDP11/pdp11_io_lib.c @@ -551,15 +551,15 @@ return SCPE_OK; /* Autoconfiguration - The table reflects the MicroVAX 3900 microcode, with one field addition - the - number of controllers field handles devices where multiple instances - are simulated through a single DEVICE structure (e.g., DZ, VH, DL, DC). + The table reflects the MicroVAX 3900 microcode, with one field + addition: + a valid flag marking the end of the list when the value is -1 - The table has been reviewed, extended and updated to reflect the contents of - the auto configure table in VMS sysgen (V5.5-2) + The table has been reviewed, extended and updated to reflect the + contents of the auto configure table in VMS sysgen (V5.5-2) - A minus number of vectors indicates a field that should be calculated - but not placed in the DIB (RQ, TQ dynamic vectors) + A minus number of vectors indicates a field that should be + calculated but not placed in the DIB (RQ, TQ dynamic vectors) An amod value of 0 indicates that all addresses are FIXED An vmod value of 0 indicates that all vectors are FIXED */ @@ -567,7 +567,7 @@ return SCPE_OK; typedef struct { const char *dnam[AUTO_MAXC]; - int32 numc; + int32 valid; int32 numv; uint32 amod; uint32 vmod; @@ -624,11 +624,6 @@ AUTO_CON auto_tab[] = {/*c #v am vm fxa fxv */ 014240, 014250, 014260, 014270, 014300, 014310, 014320, 014330, 014340, 014350, 014360, 014370} }, /* DC11 - fx CSRs */ - { { "TDC" }, 1, 2, 0, 8, - {016500, 016510, 016520, 016530, - 016540, 016550, 016560, 016570, - 016600, 016610, 016620, 016630, - 016640, 016650, 016660, 016670} }, /* TU58 - fx CSRs */ { { NULL }, 1, 1, 0, 4, {015200, 015210, 015220, 015230, 015240, 015250, 015260, 015270, @@ -652,11 +647,11 @@ AUTO_CON auto_tab[] = {/*c #v am vm fxa fxv */ 017430, 017432, 017434, 017436} }, /* DT11 - fx CSRs */ { { NULL }, 1, 2, 0, 8, {016200, 016240} }, /* DX11 */ - { { "DLI" }, 1, 2, 0, 8, + { { "TDC", "DLI" }, 1, 2, 0, 8, {016500, 016510, 016520, 016530, 016540, 016550, 016560, 016570, 016600, 016610, 016620, 016630, - 016740, 016750, 016760, 016770} }, /* KL11/DL11/DLV11 - fx CSRs */ + 016740, 016750, 016760, 016770} }, /* KL11/DL11/DLV11/TU58 - fx CSRs */ { { NULL }, 1, 2, 0, 8, { 0 } }, /* DLV11J - fx CSRs */ { { NULL }, 1, 2, 8, 8 }, /* DJ11 */ { { NULL }, 1, 2, 16, 8 }, /* DH11 */ @@ -773,7 +768,7 @@ AUTO_CON auto_tab[] = {/*c #v am vm fxa fxv */ { { NULL }, 1, 2, 4, 8 }, /* DTC05, DECvoice */ { { NULL }, 1, 2, 8, 8 }, /* KWV32 (DSV11) */ { { NULL }, 1, 1, 64, 4 }, /* QZA */ - { { NULL }, -1 } /* end table */ + { { NULL }, -1 } /* end table */ }; #if !defined(DEV_NEXUS) @@ -801,7 +796,7 @@ if (done) for (j = 0; (dptr = sim_devices[j]) != NULL; j++) { if ((dptr->flags & (DEV_UBUS | DEV_QBUS)) == 0) continue; - for (autp = auto_tab; autp->numc >= 0; autp++) { + for (autp = auto_tab; autp->valid >= 0; autp++) { for (k=0; autp->dnam[k]; k++) { if (!strcmp(dptr->name, autp->dnam[k])) { dibp = (DIB *)dptr->ctxt; @@ -827,7 +822,7 @@ t_stat auto_config (const char *name, int32 nctrl) { uint32 csr = IOPAGEBASE + AUTO_CSRBASE; uint32 vec = AUTO_VECBASE; -int32 ilvl, ibit; +int32 ilvl, ibit, numc; extern UNIT cpu_unit; AUTO_CON *autp; DEVICE *dptr; @@ -837,20 +832,13 @@ uint32 j, k, jdis, vmask, amask; if (autcon_enb == 0) /* enabled? */ return SCPE_OK; if (name) { /* updating? */ - if (nctrl < 0) + dptr = find_dev (name); + dibp = (DIB *) dptr->ctxt; /* get DIB */ + if ((nctrl < 0) || (dptr == NULL) || (dibp == NULL)) return SCPE_ARG; - for (autp = auto_tab; autp->numc >= 0; autp++) { - for (j = 0; (j < AUTO_MAXC) && autp->dnam[j]; j++) { - if (strcmp (name, autp->dnam[j]) == 0) { - autp->numc = nctrl; - break; - } - } - if ((j < AUTO_MAXC) && autp->dnam[j] && (strcmp (name, autp->dnam[j]) == 0)) - break; - } + dibp->numc = nctrl; } -for (autp = auto_tab; autp->numc >= 0; autp++) { /* loop thru table */ +for (autp = auto_tab; autp->valid >= 0; autp++) { /* loop thru table */ if (autp->amod) { /* floating csr? */ amask = autp->amod - 1; csr = (csr + amask) & ~amask; /* align csr */ @@ -877,6 +865,7 @@ for (autp = auto_tab; autp->numc >= 0; autp++) { /* loop thru table */ dibp = (DIB *) dptr->ctxt; /* get DIB */ if (dibp == NULL) /* not there??? */ return SCPE_IERR; + numc = dibp->numc ? dibp->numc : 1; ilvl = dibp->vloc / 32; ibit = dibp->vloc % 32; /* Identify how many devices earlier in the device list are @@ -891,7 +880,7 @@ for (autp = auto_tab; autp->numc >= 0; autp++) { /* loop thru table */ dibp->ba = IOPAGEBASE + autp->fixa[j-jdis]; /* use it */ else { /* no fixed left */ dibp->ba = csr; /* set CSR */ - csr += (autp->numc * autp->amod); /* next CSR */ + csr += (numc * autp->amod); /* next CSR */ } /* end else */ if (autp->numv) { /* vec needed? */ if (autp->fixv[j-jdis]) { /* fixed vec avail? */ @@ -904,7 +893,7 @@ for (autp = auto_tab; autp->numc >= 0; autp++) { /* loop thru table */ vec = (vec + vmask) & ~vmask; /* align vector */ if (autp->numv > 0) dibp->vec = vec; /* set vector */ - vec += (autp->numc * numv * 4); + vec += (numc * numv * 4); } /* end else */ } /* end vec needed */ } /* end for j */ diff --git a/VAX/vax610_defs.h b/VAX/vax610_defs.h index 6bf3156d..4ecdb901 100644 --- a/VAX/vax610_defs.h +++ b/VAX/vax610_defs.h @@ -196,7 +196,15 @@ typedef struct { int32 vloc; /* locator */ int32 vec; /* value */ int32 (*ack[VEC_DEVMAX])(void); /* ack routine */ - uint32 ulnt; /* IO length per unit */ + uint32 ulnt; /* IO length per-device */ + /* Only need to be populated */ + /* when numunits != num devices */ + int32 numc; /* Number of controllers */ + /* this field handles devices */ + /* where multiple instances are */ + /* simulated through a single */ + /* DEVICE structure (e.g., DZ, VH, DL, DC). */ + /* Populated by auto-configure */ } DIB; /* Qbus I/O page layout - see pdp11_io_lib.c for address layout details */ diff --git a/VAX/vax630_defs.h b/VAX/vax630_defs.h index 82fad7d5..43105e84 100644 --- a/VAX/vax630_defs.h +++ b/VAX/vax630_defs.h @@ -246,7 +246,15 @@ typedef struct { int32 vloc; /* locator */ int32 vec; /* value */ int32 (*ack[VEC_DEVMAX])(void); /* ack routine */ - uint32 ulnt; /* IO length per unit */ + uint32 ulnt; /* IO length per-device */ + /* Only need to be populated */ + /* when numunits != num devices */ + int32 numc; /* Number of controllers */ + /* this field handles devices */ + /* where multiple instances are */ + /* simulated through a single */ + /* DEVICE structure (e.g., DZ, VH, DL, DC). */ + /* Populated by auto-configure */ } DIB; /* Qbus I/O page layout - see pdp11_io_lib.c for address layout details */ diff --git a/VAX/vax730_defs.h b/VAX/vax730_defs.h index d25054dc..a91d438e 100644 --- a/VAX/vax730_defs.h +++ b/VAX/vax730_defs.h @@ -238,7 +238,15 @@ typedef struct { int32 vloc; /* locator */ int32 vec; /* value */ int32 (*ack[VEC_DEVMAX])(void); /* ack routine */ - uint32 ulnt; /* IO length per unit */ + uint32 ulnt; /* IO length per-device */ + /* Only need to be populated */ + /* when numunits != num devices */ + int32 numc; /* Number of controllers */ + /* this field handles devices */ + /* where multiple instances are */ + /* simulated through a single */ + /* DEVICE structure (e.g., DZ, VH, DL, DC). */ + /* Populated by auto-configure */ } DIB; /* Unibus I/O page layout - see pdp11_io_lib.c for address layout details */ diff --git a/VAX/vax750_defs.h b/VAX/vax750_defs.h index 3bd2ae07..62f46562 100644 --- a/VAX/vax750_defs.h +++ b/VAX/vax750_defs.h @@ -278,7 +278,15 @@ typedef struct { int32 vloc; /* locator */ int32 vec; /* value */ int32 (*ack[VEC_DEVMAX])(void); /* ack routine */ - uint32 ulnt; /* IO length per unit */ + uint32 ulnt; /* IO length per-device */ + /* Only need to be populated */ + /* when numunits != num devices */ + int32 numc; /* Number of controllers */ + /* this field handles devices */ + /* where multiple instances are */ + /* simulated through a single */ + /* DEVICE structure (e.g., DZ, VH, DL, DC). */ + /* Populated by auto-configure */ } DIB; /* Unibus I/O page layout - see pdp11_io_lib.c for address layout details diff --git a/VAX/vax780_defs.h b/VAX/vax780_defs.h index 9c4088ca..a93a0026 100644 --- a/VAX/vax780_defs.h +++ b/VAX/vax780_defs.h @@ -292,7 +292,15 @@ typedef struct { int32 vloc; /* locator */ int32 vec; /* value */ int32 (*ack[VEC_DEVMAX])(void); /* ack routine */ - uint32 ulnt; /* IO length per unit */ + uint32 ulnt; /* IO length per-device */ + /* Only need to be populated */ + /* when numunits != num devices */ + int32 numc; /* Number of controllers */ + /* this field handles devices */ + /* where multiple instances are */ + /* simulated through a single */ + /* DEVICE structure (e.g., DZ, VH, DL, DC). */ + /* Populated by auto-configure */ } DIB; /* Unibus I/O page layout - see pdp11_io_lib.c for address layout details diff --git a/VAX/vax860_defs.h b/VAX/vax860_defs.h index e8e17a91..212fec74 100644 --- a/VAX/vax860_defs.h +++ b/VAX/vax860_defs.h @@ -322,7 +322,15 @@ typedef struct { int32 vloc; /* locator */ int32 vec; /* value */ int32 (*ack[VEC_DEVMAX])(void); /* ack routine */ - uint32 ulnt; /* IO length per unit */ + uint32 ulnt; /* IO length per-device */ + /* Only need to be populated */ + /* when numunits != num devices */ + int32 numc; /* Number of controllers */ + /* this field handles devices */ + /* where multiple instances are */ + /* simulated through a single */ + /* DEVICE structure (e.g., DZ, VH, DL, DC). */ + /* Populated by auto-configure */ } DIB; /* Unibus I/O page layout - XUB,RQB,RQC,RQD float based on number of DZ's diff --git a/VAX/vaxmod_defs.h b/VAX/vaxmod_defs.h index 9ae7dc32..fa15a37a 100644 --- a/VAX/vaxmod_defs.h +++ b/VAX/vaxmod_defs.h @@ -296,7 +296,15 @@ typedef struct { int32 vloc; /* locator */ int32 vec; /* value */ int32 (*ack[VEC_DEVMAX])(void); /* ack routine */ - uint32 ulnt; /* IO length per unit */ + uint32 ulnt; /* IO length per-device */ + /* Only need to be populated */ + /* when numunits != num devices */ + int32 numc; /* Number of controllers */ + /* this field handles devices */ + /* where multiple instances are */ + /* simulated through a single */ + /* DEVICE structure (e.g., DZ, VH, DL, DC). */ + /* Populated by auto-configure */ } DIB; /* Qbus I/O page layout - see pdp11_io_lib.c for address layout details */