PDP11, VAX: Cleaned MSCP/TMSCP packet queues to be uint16

This commit is contained in:
Mark Pizzolato 2017-03-12 19:06:46 -07:00
parent 12f43e660f
commit 14b9265af3
3 changed files with 25 additions and 42 deletions

View file

@ -166,8 +166,8 @@ extern int32 MMR2;
#define UNIT_NOAUTO (1 << UNIT_V_NOAUTO)
#define UNIT_DTYPE (UNIT_M_DTYPE << UNIT_V_DTYPE)
#define GET_DTYPE(x) (((x) >> UNIT_V_DTYPE) & UNIT_M_DTYPE)
#define cpkt u3 /* current packet */
#define pktq u4 /* packet queue */
#define cpkt us9 /* current packet */
#define pktq us10 /* packet queue */
#define uf buf /* settable unit flags */
#define cnum wait /* controller index */
#define io_status u5 /* io status from callback */
@ -1514,14 +1514,10 @@ if (cp->csta < CST_UP) { /* still init? */
} /* end if */
for (i = 0; i < RQ_NUMDR; i++) { /* chk unit q's */
uint16 tpktq;
nuptr = dptr->units + i; /* ptr to unit */
if (nuptr->cpkt || (nuptr->pktq == 0))
continue;
tpktq = (uint16)nuptr->pktq;
pkt = rq_deqh (cp, &tpktq); /* get top of q */
nuptr->pktq = tpktq;
pkt = rq_deqh (cp, &nuptr->pktq); /* get top of q */
if (!rq_mscp (cp, pkt, FALSE)) /* process */
return SCPE_OK;
}
@ -1663,17 +1659,17 @@ tpkt = 0; /* set no mtch */
if ((uptr = rq_getucb (cp, lu))) { /* get unit */
if (uptr->cpkt && /* curr pkt? */
(GETP32 (uptr->cpkt, CMD_REFL) == ref)) { /* match ref? */
tpkt = (uint16)uptr->cpkt; /* save match */
tpkt = uptr->cpkt; /* save match */
uptr->cpkt = 0; /* gonzo */
sim_cancel (uptr); /* cancel unit */
sim_activate (dptr->units + RQ_QUEUE, rq_qtime);
}
else if (uptr->pktq && /* head of q? */
(GETP32 (uptr->pktq, CMD_REFL) == ref)) { /* match ref? */
tpkt = (uint16)uptr->pktq; /* save match */
tpkt = uptr->pktq; /* save match */
uptr->pktq = cp->pak[tpkt].link; /* unlink */
}
else if ((prv = (uint16)uptr->pktq)) { /* srch pkt q */
else if ((prv = uptr->pktq)) { /* srch pkt q */
while ((tpkt = cp->pak[prv].link)) { /* walk list */
if (GETP32 (tpkt, RSP_REFL) == ref) { /* match? unlink */
cp->pak[prv].link = cp->pak[tpkt].link;
@ -1707,10 +1703,7 @@ sim_debug (DBG_TRC, rq_devmap[cp->cnum], "rq_avl\n");
if ((uptr = rq_getucb (cp, lu))) { /* unit exist? */
if (q && uptr->cpkt) { /* need to queue? */
uint16 tpktq = (uint16)uptr->pktq;
rq_enqt (cp, &tpktq, pkt); /* do later */
uptr->pktq = tpktq;
rq_enqt (cp, &uptr->pktq, pkt); /* do later */
return OK;
}
uptr->flags = uptr->flags & ~UNIT_ONL; /* not online */
@ -1807,10 +1800,7 @@ sim_debug (DBG_TRC, rq_devmap[cp->cnum], "rq_onl\n");
if ((uptr = rq_getucb (cp, lu))) { /* unit exist? */
if (q && uptr->cpkt) { /* need to queue? */
uint16 tpktq = (uint16)uptr->pktq;
rq_enqt (cp, &tpktq, pkt); /* do later */
uptr->pktq = tpktq;
rq_enqt (cp, &uptr->pktq, pkt); /* do later */
return OK;
}
if ((uptr->flags & UNIT_ATT) == 0) /* not attached? */
@ -1882,10 +1872,7 @@ sim_debug (DBG_TRC, rq_devmap[cp->cnum], "rq_suc\n");
if ((uptr = rq_getucb (cp, lu))) { /* unit exist? */
if (q && uptr->cpkt) { /* need to queue? */
uint16 tpktq = (uint16)uptr->pktq;
rq_enqt (cp, &tpktq, pkt); /* do later */
uptr->pktq = tpktq;
rq_enqt (cp, &uptr->pktq, pkt); /* do later */
return OK;
}
if ((uptr->flags & UNIT_ATT) == 0) /* not attached? */
@ -1916,10 +1903,7 @@ sim_debug (DBG_TRC, rq_devmap[cp->cnum], "rq_fmt\n");
if ((uptr = rq_getucb (cp, lu))) { /* unit exist? */
if (q && uptr->cpkt) { /* need to queue? */
uint16 tpktq = (uint16)uptr->pktq;
rq_enqt (cp, &tpktq, pkt); /* do later */
uptr->pktq = tpktq;
rq_enqt (cp, &uptr->pktq, pkt); /* do later */
return OK;
}
if (GET_DTYPE (uptr->flags) != RX33_DTYPE) /* RX33? */
@ -2273,7 +2257,7 @@ return SCPE_OK;
t_bool rq_rw_end (MSC *cp, UNIT *uptr, uint16 flg, uint16 sts)
{
uint16 pkt = (uint16)uptr->cpkt; /* packet */
uint16 pkt = uptr->cpkt; /* packet */
uint16 cmd = GETP (pkt, CMD_OPC, OPC); /* get cmd */
uint32 bc = GETP32 (pkt, RW_BCL); /* init bc */
uint32 wbc = GETP32 (pkt, RW_WBCL); /* work bc */
@ -2313,7 +2297,7 @@ if ((cp->cflgs & CF_THS) == 0) /* logging? */
return OK;
if (!rq_deqf (cp, &pkt)) /* get log pkt */
return ERR;
tpkt = (uint16)uptr->cpkt; /* rw pkt */
tpkt = uptr->cpkt; /* rw pkt */
lu = cp->pak[tpkt].d[CMD_UN]; /* unit # */
lbn = GETP32 (tpkt, RW_WBLL); /* recent LBN */
dtyp = GET_DTYPE (uptr->flags); /* drv type */
@ -2367,7 +2351,7 @@ if ((cp->cflgs & CF_THS) == 0) /* logging? */
return OK;
if (!rq_deqf (cp, &pkt)) /* get log pkt */
return ERR;
tpkt = (uint16)uptr->cpkt; /* rw pkt */
tpkt = uptr->cpkt; /* rw pkt */
cp->pak[pkt].d[ELP_REFL] = cp->pak[tpkt].d[CMD_REFL]; /* copy cmd ref */
cp->pak[pkt].d[ELP_REFH] = cp->pak[tpkt].d[CMD_REFH];
cp->pak[pkt].d[ELP_UN] = cp->pak[tpkt].d[CMD_UN]; /* copy unit */

View file

@ -117,8 +117,8 @@
#define UNIT_SXC (1 << UNIT_V_SXC)
#define UNIT_POL (1 << UNIT_V_POL)
#define UNIT_TMK (1 << UNIT_V_TMK)
#define cpkt u3 /* current packet */
#define pktq u4 /* packet queue */
#define cpkt us9 /* current packet */
#define pktq us10 /* packet queue */
#define uf buf /* settable unit flags */
#define objp wait /* object position */
#define io_status u5 /* io status from callback */
@ -730,7 +730,7 @@ for (i = 0; i < TQ_NUMDR; i++) { /* chk unit q's */
nuptr = tq_dev.units + i; /* ptr to unit */
if (nuptr->cpkt || (nuptr->pktq == 0))
continue;
tpkt = (uint16)nuptr->pktq;
tpkt = nuptr->pktq;
pkt = tq_deqh (&tpkt); /* get top of q */
nuptr->pktq = tpkt;
if (!tq_mscp (pkt, FALSE)) /* process */
@ -836,10 +836,7 @@ else { /* valid cmd */
if ((uptr = tq_getucb (lu))) { /* valid unit? */
if (q && (tq_cmf[cmd] & CMF_SEQ) && /* queueing, seq, */
(uptr->cpkt || uptr->pktq)) { /* and active? */
uint16 tpktq = (uint16)uptr->pktq;
tq_enqt (&tpktq, pkt); /* do later */
uptr->pktq = tpktq;
tq_enqt (&uptr->pktq, pkt); /* do later */
return OK;
}
/* if (tq_cmf[cmd] & MD_CDL) *//* clr cch lost? */
@ -920,17 +917,17 @@ tpkt = 0; /* set no mtch */
if ((uptr = tq_getucb (lu))) { /* get unit */
if (uptr->cpkt && /* curr pkt? */
(GETP32 (uptr->cpkt, CMD_REFL) == ref)) { /* match ref? */
tpkt = (uint16)uptr->cpkt; /* save match */
tpkt = uptr->cpkt; /* save match */
uptr->cpkt = 0; /* gonzo */
sim_cancel (uptr); /* cancel unit */
sim_activate (&tq_unit[TQ_QUEUE], tq_qtime);
}
else if (uptr->pktq && /* head of q? */
(GETP32 (uptr->pktq, CMD_REFL) == ref)) { /* match ref? */
tpkt = (uint16)uptr->pktq; /* save match */
tpkt = uptr->pktq; /* save match */
uptr->pktq = tq_pkt[tpkt].link; /* unlink */
}
else if ((prv = (uint16)uptr->pktq)) { /* srch pkt q */
else if ((prv = uptr->pktq)) { /* srch pkt q */
while ((tpkt = tq_pkt[prv].link)) { /* walk list */
if (GETP32 (tpkt, RSP_REFL) == ref) { /* match ref? */
tq_pkt[prv].link = tq_pkt[tpkt].link; /* unlink */
@ -1508,7 +1505,7 @@ return SCPE_IOERR;
t_bool tq_mot_end (UNIT *uptr, uint32 flg, uint16 sts, uint32 rsiz)
{
uint16 pkt = (uint16)uptr->cpkt; /* packet */
uint16 pkt = uptr->cpkt; /* packet */
uint32 cmd = GETP (pkt, CMD_OPC, OPC); /* get cmd */
uint16 lnt = RW_LNT_T; /* assume rw */
@ -1645,7 +1642,7 @@ if ((tq_cflgs & CF_THS) == 0) /* logging? */
return OK;
if (!tq_deqf (&pkt)) /* get log pkt */
return ERR;
tpkt = (uint16)uptr->cpkt; /* rw pkt */
tpkt = uptr->cpkt; /* rw pkt */
lu = tq_pkt[tpkt].d[CMD_UN]; /* unit # */
tq_pkt[pkt].d[ELP_REFL] = tq_pkt[tpkt].d[CMD_REFL]; /* copy cmd ref */
@ -1681,7 +1678,7 @@ if ((tq_cflgs & CF_THS) == 0) /* logging? */
return OK;
if (!tq_deqf (&pkt)) /* get log pkt */
return ERR;
tpkt = (uint16)uptr->cpkt; /* rw pkt */
tpkt = uptr->cpkt; /* rw pkt */
tq_pkt[pkt].d[ELP_REFL] = tq_pkt[tpkt].d[CMD_REFL]; /* copy cmd ref */
tq_pkt[pkt].d[ELP_REFH] = tq_pkt[tpkt].d[CMD_REFH]; /* copy cmd ref */
tq_pkt[pkt].d[ELP_UN] = tq_pkt[tpkt].d[CMD_UN]; /* copy unit */

View file

@ -552,6 +552,8 @@ struct UNIT {
int32 u6; /* device specific */
void *up7; /* device specific */
void *up8; /* device specific */
uint16 us9; /* device specific */
uint16 us10; /* device specific */
void *tmxr; /* TMXR linkage */
t_bool (*cancel)(UNIT *);
double usecs_remaining; /* time balance for long delays */