diff --git a/SEL32/sel32_chan.c b/SEL32/sel32_chan.c index 51c806c..36ec19c 100644 --- a/SEL32/sel32_chan.c +++ b/SEL32/sel32_chan.c @@ -255,7 +255,6 @@ int32 IOCLQ_Get(IOCLQ *qptr, uint32 *old) /* see if the IOCLQ is empty */ if (qptr->ioclq_in == qptr->ioclq_out) { -// sim_debug(DEBUG_EXP, &cpu_dev, "IOCLQ_Get IOCLQ empty\n"); return -1; /* IOCLQ is empty, tell caller */ } *old = qptr->ioclq_fifo[qptr->ioclq_out]; /* get the next entry */ @@ -707,7 +706,6 @@ loop: /* DC can only be used with a read/write cmd */ /* TODO move ccw code to LPR processing */ /* TEMP FIX FOR LPR */ -// if (chp->ccw_flags & FLAG_DC) { if ((chp->ccw_flags & FLAG_DC) && (chsa != 0x7ef8)) { if ((chp->ccw_cmd != 0x02) && (chp->ccw_cmd != 0x01)) { chp->chan_status |= STATUS_PCHK; /* program check for invalid DC */ @@ -959,7 +957,6 @@ void chan_end(uint16 chsa, uint16 flags) { sim_debug(DEBUG_EXP, &cpu_dev, "chan_end INFO_CEND set chsa %04x ccw_flags %04x status %04x byte %02x\n", chsa, chp->ccw_flags, chp->chan_status, chp->chan_byte); -/// return; /* just return */ } chp->chan_info |= INFO_CEND; /* we have been here */ @@ -1284,7 +1281,6 @@ nothere: *status = 0; /* CCs = 0, OK return */ else /* return CC1 for non iop/mfp devices */ -//1003 *status = CC1BIT; /* CCs = 1, not busy */ *status = 0; /* CCs = 0, OK return */ sim_debug(DEBUG_DETAIL, &cpu_dev, "checkxio lchsa %04x rchsa %04x done CC status %08x\n", @@ -1449,7 +1445,6 @@ missing: /* handle an Ethernet controller busy by sending interrupt/status */ chp->chan_status = STATUS_BUSY|STATUS_CEND|STATUS_DEND; /* set busy status */ chp->ccw_count = 0; /* zero count */ -//0312 store_csw(chp); /* store the status */ push_csw(chp); /* store the status */ chp->chan_status = tstat; /* restore status */ chp->ccw_count = tcnt; /* restore count */ @@ -1522,7 +1517,6 @@ missing: "SIO pre_io call return NO INCH %04x chsa %04x cstat %02x cmd %02x cnt %02x\n", incha, chsa, tempa, cmd, word2); if ((cmd != 0) || ((MASK16 & word2) == 0)) { -// *status = CC1BIT; /* request accepted, no status, so CC1 */ *status = 0; /* request accepted, no status, so CC1 */ return SCPE_OK; /* just do nothing until inch */ } @@ -1776,8 +1770,6 @@ t_stat stopxio(uint16 lchsa, uint32 *status) { /* stop XIO */ itva = SPAD[0xf1] + (inta<<2); /* int vector address */ chan_icb = RMW(itva); /* Interrupt context block addr */ iocla = RMW(chan_icb+16); /* iocla is in wd 4 of ICB */ -// /* reset the DC or CC bits to force completion after current IOCD */ -// chp->ccw_flags &= ~(FLAG_DC|FLAG_CC); /* reset chaining bits */ /* reset the CC bit to force completion after current IOCD */ chp->ccw_flags &= ~FLAG_CC; /* reset chaining bits */ sim_debug(DEBUG_CMD, &cpu_dev, @@ -1790,18 +1782,6 @@ t_stat stopxio(uint16 lchsa, uint32 *status) { /* stop XIO */ sim_debug(DEBUG_CMD, &cpu_dev, "STPIO not busy return rchsa %04x cmd %02x ccw_flags %04x status %04x byte %02x\n", rchsa, chp->ccw_cmd, chp->ccw_flags, *status, chp->chan_byte); -#ifdef GIVE_STATUS_ON_NOT_BUSY_05112021 -// NOW off 05142021 */ - chp->chan_byte = BUFF_DONE; /* we are done */ - chp->chan_status = (STATUS_DEND|STATUS_CEND); -// store_csw(chp); /* store the status */ - push_csw(chp); /* store the status 1st in FIFO */ - /* change chan_byte to BUFF_POST */ - chp->chan_byte = BUFF_POST; /* show done with data */ - chp->chan_status = 0; /* no status anymore */ - chp->ccw_cmd = 0; /* no command anymore */ - irq_pend = 1; /* flag to test for int condition */ -#endif return SCPE_OK; /* No CC's all OK */ } @@ -2071,7 +2051,6 @@ t_stat haltxio(uint16 lchsa, uint32 *status) { /* halt XIO */ irq_pend = 1; /* flag to test for int condition */ /* see if any status ready to post */ -// if (FIFO_Num(rchsa)) { if ((FIFO_Num(rchsa)) && (CPUSTATUS & BIT24)) { /* interrupts blocked? */ sim_debug(DEBUG_IRQ, &cpu_dev, "HIO rchsa %04x LOOK FIFO #%1x irq %02x inch %06x chp %p icba %06x chan_byte %02x\n", @@ -2090,21 +2069,23 @@ t_stat haltxio(uint16 lchsa, uint32 *status) { /* halt XIO */ sim_debug(DEBUG_XIO, &cpu_dev, "HIO END incha %06x chan_icba+20 %08x rchsa %04x sw1 %08x sw2 %08x\n", incha, RMW(chan_icb+20), rchsa, RMW(incha), RMW(incha+4)); -// if ((CPUSTATUS & BIT24) == 0) /* interrupts blocked? */ -// INTS[inta] &= ~INTS_REQ; /* clear any level request if no status */ -// INTS[inta] |= INTS_REQ; /* set level request if status */ - *status = CC2BIT; /* status stored from SIO, so CC2 */ - return SCPE_OK; /* No CC's all OK */ + /*ADDED 111921 to disable int request after data posted */ + INTS[inta] &= ~INTS_REQ; /* clear any level request */ + *status = CC2BIT; /* status stored from SIO, so CC2 */ + return SCPE_OK; /* No CC's all OK */ } else { sim_debug(DEBUG_IRQ, &cpu_dev, "HIO rchsa %04x NOT POSTED FIFO #%1x irq %02x inch %06x chan_icba %06x chan_byte %02x\n", rchsa, FIFO_Num(rchsa), inta, chp->chan_inch_addr, chan_icb, chp->chan_byte); /* now store the status dw address into word 5 of the ICB for the channel */ - WMW(chan_icb+20, 0); /* post sw addr 0 in ICB+5w & reset CCs */ - *status = 0; /* no status stored from TIO, so no CC */ - return SCPE_OK; /* No CC's all OK */ + WMW(chan_icb+20, 0); /* post sw addr 0 in ICB+5w & reset CCs */ + *status = 0; /* no status stored from HIO, so no CC */ + return SCPE_OK; /* No CC's all OK */ } } + if ((CPUSTATUS & BIT24) == 0) { /* interrupts blocked? */ + sim_debug(DEBUG_DETAIL, &cpu_dev, "HIO after END2 INTS not blocked!\n"); + } return SCPE_OK; /* CC1 & all OK */ } /* the device is not busy, so cmd is completed */ @@ -2121,7 +2102,6 @@ t_stat haltxio(uint16 lchsa, uint32 *status) { /* halt XIO */ sim_debug(DEBUG_EXP, &cpu_dev, "haltxio BUFF_DONE2 chp %p chan_byte %04x\n", chp, chp->chan_byte); chp->chan_status = (STATUS_DEND|STATUS_CEND); -// store_csw(chp); /* store the status */ push_csw(chp); /* store the status 1st in FIFO */ /* change chan_byte to BUFF_POST */ chp->chan_byte = BUFF_POST; /* show done with data */ @@ -2249,12 +2229,10 @@ t_stat grabxio(uint16 lchsa, uint32 *status) { /* grab controller XIO n/u */ // try using CC4 on MPX3X when still busy if (chp->chan_byte == BUFF_POST) { uint32 chan_icb; /* Interrupt level context block address */ -// uint32 iocla; /* I/O channel IOCL address int ICB */ uint32 inta = ((~spadent)>>16)&0x7f; /* get channel interrupt level */ /* get the address of the interrupt IVL in main memory */ uint32 itva = SPAD[0xf1] + (inta<<2); /* int vector address */ chan_icb = RMW(itva); /* Interrupt context block addr */ -// iocla = RMW(chan_icb+16); /* iocla is in wd 4 of ICB */ *status = CC1BIT; /* request accepted, no status, so CC1 */ /* see if any status ready to post */ if (FIFO_Num(rchsa)) { @@ -2566,7 +2544,6 @@ uint32 scan_chan(uint32 *ilev) { TPSD[0] = M[0]; /* save PSD from loc 0&4 */ TPSD[1] = M[1]; /* save the status double word to memory */ -// WMW(tempa, sw1); /* save sa & IOCD address in status WD 1 loc */ /* set BIT 1 to show status stored */ WMW(tempa, sw1|BIT1); /* save sa & IOCD address in status WD 1 loc */ WMW(tempa+4, sw2); /* save status and residual cnt in status WD 2 loc */ @@ -2789,7 +2766,6 @@ t_stat chan_set_devs() { if ((dptr->flags & DEV_DIS) || /* Skip disabled devices */ ((dibp->chan_prg) == NULL)) { /* must have channel info for each device */ chsa = GET_UADDR(uptr->u3); /* ch/sa value */ -//printf("Device %s chsa %04x not set up dibp %p uptr %p\n", dptr->name, chsa, dibp, uptr); continue; } @@ -2797,8 +2773,6 @@ t_stat chan_set_devs() { /* Check if address is in unit or dev entry */ for (j = 0; j < dptr->numunits; j++) { /* loop through unit entries */ chsa = GET_UADDR(uptr->u3); /* ch/sa value */ -//printf("Setup device %s%d chsa %04x type %02x dibp %p uptr %p\n", -//dptr->name, j, chsa, GET_TYPE(uptr->flags), dibp, uptr); /* zero some channel data loc's for device */ chp->unitptr = uptr; /* set the unit back pointer */ chp->chan_status = 0; /* clear the channel status */ @@ -2819,10 +2793,8 @@ t_stat chan_set_devs() { if (dptr->flags & DEV_CHAN) { /* see if channel address already defined */ if (dib_chan[get_chan(chsa)] != 0) { -//printf("Channel mux %04x already defined, aborting\n", chsa); return SCPE_IERR; /* no, arg error */ } -//printf("Setting Channel mux %04x dibp %p\n", chsa, dibp); /* channel mux, save dib for channel */ dib_chan[get_chan(chsa)] = dibp; if (dibp->dev_ini != NULL) /* if there is an init routine, call it now */ @@ -2830,13 +2802,11 @@ t_stat chan_set_devs() { } else { /* we have unit 0 of non-IOP/MFP device */ if (dib_unit[chsa] != 0) { -//printf("Channel/Dev %04x already defined uptr %p\n", chsa, uptr); return SCPE_IERR; /* no, arg error */ } else { /* channel mux, save dib for channel */ /* for now, save any zero dev as chan */ if (chsa) { -//printf("Setting Channel zero unit 0 device %04x dibp %p uptr %p\n", chsa, dibp, uptr); dib_unit[chsa] = dibp; /* no, save the dib address */ if (dibp->dev_ini != NULL) /* if there is an init routine, call it now */ dibp->dev_ini(uptr, 1); /* init the channel */ @@ -2846,7 +2816,6 @@ t_stat chan_set_devs() { } else { /* see if address already defined */ if (dib_unit[chsa] != 0) { -//printf("Channel/SubAddress %04x multiple defined, aborting\n", chsa); return SCPE_IERR; /* no, arg error */ } dib_unit[chsa] = dibp; /* no, save the dib address */ @@ -2868,10 +2837,8 @@ t_stat chan_set_devs() { if (dib_unit[i<<8]) { /* write dibp to channel array */ dib_chan[i] = dib_unit[i<<8]; /* save the channel dib */ -//printf("Chan_set_dev new Channel %04x defined at dibp %p\n", i<<8, dib_unit[i<<8]); } } else { -//printf("Chan_set_dev Channel %04x defined at dibp %p\n", i<<8, dib_chan[i]); /* channel is defined, see if defined in dib_unit array */ if ((dib_unit[i<<8]) == 0) { /* write dibp to units array */ @@ -2899,15 +2866,12 @@ t_stat set_dev_addr(UNIT *uptr, int32 val, CONST char *cptr, void *desc) { dptr = get_dev(uptr); /* find the device from unit pointer */ if (dptr == NULL) { /* device not found, so error */ fprintf(stderr, "Set dev no DEVICE cptr %s uptr %p\r\n", cptr, uptr); -//printf("Set dev no DEVICE ptr %s\r\n", cptr); return SCPE_IERR; /* error */ } -//printf("Set dev DEVICE ptr %s uptr %p\r\n", cptr, uptr); dibp = (DIB *)dptr->ctxt; /* get dib pointer from device struct */ if (dibp == NULL) { /* we need a DIB */ fprintf(stderr, "Set dev no DIB ptr %s uptr %p\r\n", cptr, uptr); -//printf("Set dev no DIB ptr %s\r\n", cptr); return SCPE_IERR; /* no DIB, so error */ } @@ -2915,7 +2879,6 @@ t_stat set_dev_addr(UNIT *uptr, int32 val, CONST char *cptr, void *desc) { if (r != SCPE_OK) /* need good number */ return r; /* number error, return error */ -//printf("Set new dev DEVICE ptr %s chan %04x\r\n", cptr, chan); dibp->chan_addr = chan; /* set new parent channel addr */ /* change all the unit addresses with the new channel, but keep sub address */ @@ -2926,21 +2889,12 @@ t_stat set_dev_addr(UNIT *uptr, int32 val, CONST char *cptr, void *desc) { for (i = 0; i < dibp->numunits; i++) { int mask=dibp->mask; /* sa bits that are used */ ochsa = GET_UADDR(tuptr->u3); /* get old chsa for this unit */ -//printf("Got unit %x old chsa %04x mask %04x\r\n", i, ochsa, mask); dib_unit[ochsa] = NULL; /* clear sa dib pointer */ dib_unit[ochsa&0x7f00] = NULL; /* clear the channel dib address */ chan &= ~mask; /* remove the unit number */ chsa = chan | (ochsa & mask); /* put in new sa */ -//6 if (ochsa & 0xf0) { /* Is this a channel device IOP/MFP */ -//6 chan &= 0x7ff0; /* clean channel sub-address */ -//6 chsa = chan | (ochsa & 0xf); /* merge new channel with old sa */ -//6 } else { -//6 chan &= 0x7f00; /* clean channel address */ -//6 chsa = chan | (ochsa & 0xff); /* merge new channel with old sa */ -//6 } if (chsa != ochsa) { fprintf(stderr, "Set unit %x new chsa %04x old chsa %04x\r\n", i, chsa, ochsa); -//printf("Set unit %x new chsa %04x old chsa %04x\r\n", i, chsa, ochsa); } tuptr->u3 &= ~UNIT_ADDR_MASK; /* clear old chsa for this unit */ tuptr->u3 |= UNIT_ADDR(chsa); /* set new chsa for this unit */ diff --git a/SEL32/sel32_cpu.c b/SEL32/sel32_cpu.c index e4b0b3e..de75eae 100644 --- a/SEL32/sel32_cpu.c +++ b/SEL32/sel32_cpu.c @@ -6006,7 +6006,9 @@ skipdqe2: case 0x3: /* LPSD F980 */ /* fall through */; case 0x5: /* LPSDCM FA80 */ +#ifdef MAYBE_NO irq_pend = 1; /* start scanning interrupts again */ +#endif if ((MODES & PRIVBIT) == 0) { /* must be privileged */ TRAPME = PRIVVIOL_TRAP; /* set the trap to take */ if ((CPU_MODEL == MODEL_97) || (CPU_MODEL == MODEL_V9)) @@ -6317,7 +6319,9 @@ skipdqe: /* |-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------| */ /* */ case 0xFC>>2: /* 0xFC IMM - IMM */ /* XIO, CD, TD, Interrupt Control */ +#ifdef MAYBE_NO irq_pend = 1; /* start scanning interrupts again */ +#endif if ((MODES & PRIVBIT) == 0) { /* must be privileged to do I/O */ TRAPME = PRIVVIOL_TRAP; /* set the trap to take */ if ((CPU_MODEL == MODEL_97) || (CPU_MODEL == MODEL_V9)) diff --git a/SEL32/sel32_defs.h b/SEL32/sel32_defs.h index bbe2726..701fe8c 100644 --- a/SEL32/sel32_defs.h +++ b/SEL32/sel32_defs.h @@ -414,7 +414,7 @@ extern DEBTAB dev_debug[]; /* general instruction decode equates */ #define IND 0x00100000 /* indirect bit in instruction, bit 11 */ #define F_BIT 0x00080000 /* byte flag addressing bit 11 in instruction */ -#define C_BITS 0x00000003 /* byte number or hw, dw, dw flags bits 20 & 31 */ +#define C_BITS 0x00000003 /* byte number or hw, dw, dw flags bits 30 & 31 */ #define BIT0 0x80000000 /* general use for bit 0 testing */ #define BIT1 0x40000000 /* general use for bit 1 testing */ #define BIT2 0x20000000 /* general use for bit 2 testing */ diff --git a/SEL32/sel32_disk.c b/SEL32/sel32_disk.c index be976a3..dae2cec 100644 --- a/SEL32/sel32_disk.c +++ b/SEL32/sel32_disk.c @@ -587,8 +587,6 @@ uint32 get_dmatrk(UNIT *uptr, uint32 star, uint8 buf[]) int unit = (uptr - dptr->units); /* get the UNIT number */ int len, i, cn, found = -1; -#define SPEEDUP -#ifdef SPEEDUP int ds = ((CYL(type) - 3) * HDS(type)) * SPT(type); /* diag start */ /* get file offset in sectors */ tstart = STAR2SEC(star, SPT(type), SPC(type)); @@ -599,12 +597,6 @@ uint32 get_dmatrk(UNIT *uptr, uint32 star, uint8 buf[]) buf[4] = 0; return nstar; /* not in diag track, return */ } -#else - /* get file offset in sectors */ - tstart = STAR2SEC(star, SPT(type), SPC(type)); - /* convert sector number back to chs value to sync disk for diags */ - nstar = disksec2star(tstart, type); -#endif cyl = (nstar >> 16) & 0xffff; /* get the cylinder */ trk = (nstar >> 8) & 0xff; /* get the track */ @@ -612,7 +604,6 @@ uint32 get_dmatrk(UNIT *uptr, uint32 star, uint8 buf[]) /* get track number */ tstart = (cyl * HDS(type)) + trk; -// sim_debug(DEBUG_EXP, dptr, sim_debug(DEBUG_DETAIL, dptr, "get_dmatrk RTL star %08x nstar %08x cyl %4x(%d) trk %x sec# %06x\n", star, nstar, cyl, cyl, trk, tstart); @@ -632,7 +623,6 @@ uint32 get_dmatrk(UNIT *uptr, uint32 star, uint8 buf[]) buf[i] = tkl_label[unit].tkl[cn].label[i]; found = cn; tkl_label[unit].tkl[cn].age++; -// sim_debug(DEBUG_EXP, dptr, sim_debug(DEBUG_DETAIL, dptr, "get_dpatrk found in Cache to %06x\n", offset); break; @@ -642,7 +632,6 @@ uint32 get_dmatrk(UNIT *uptr, uint32 star, uint8 buf[]) /* see if found in cache */ if (found == -1) { /* file offset in bytes */ -// sim_debug(DEBUG_EXP, dptr, sim_debug(DEBUG_DETAIL, dptr, "get_dpatrk RTL SEEK on seek to %06x\n", offset); @@ -729,7 +718,6 @@ t_stat disk_iocl(CHANP *chp, int32 tic_ok) uint32 word1 = 0; uint32 word2 = 0; int32 docmd = 0; -// DIB *dibp = dib_unit[chp->chan_dev];/* get the DIB pointer */ UNIT *uptr = chp->unitptr; /* get the unit ptr */ uint16 chan = get_chan(chp->chan_dev); /* our channel */ uint16 chsa = chp->chan_dev; /* our chan/sa */ @@ -781,9 +769,6 @@ loop: chp->chan_caw, chan, word1, word2); chp->chan_caw = (chp->chan_caw & 0xfffffc) + 8; /* point to next IOCD */ -#ifdef BAD_05142021 - chp->ccw_cmd = (word1 >> 24) & 0xff; /* set command from IOCD wd 1 */ -#endif /* Check if we had data chaining in previous iocd */ /* if we did, use previous cmd value */ @@ -871,14 +856,9 @@ loop: } /* Check if we had data chaining in previous iocd */ -#ifdef BAD_05152021 - if ((chp->chan_info & INFO_SIOCD) || /* see if 1st IOCD in channel prog */ - ((chp->ccw_flags & FLAG_DC) == 0)) { /* last IOCD have DC set? */ -#else if ((chp->chan_info & INFO_SIOCD) || /* see if 1st IOCD in channel prog */ (((chp->chan_info & INFO_SIOCD) == 0) && /* see if 1st IOCD in channel prog */ ((chp->ccw_flags & FLAG_DC) == 0))) { /* last IOCD have DC set? */ -#endif sim_debug(DEBUG_CMD, dptr, "disk_iocl @%06x DO CMD No DC, ccw_flags %04x cmd %02x\n", chp->chan_caw, chp->ccw_flags, chp->ccw_cmd); @@ -925,7 +905,6 @@ loop: return 1; /* if none, error */ } -// sim_debug(DEBUG_XIO, dptr, sim_debug(DEBUG_DETAIL, dptr, "disk_iocl @%06x before start_cmd chan %04x status %04x count %04x SNS %08x\n", chp->chan_caw, chan, chp->chan_status, chp->ccw_count, uptr->u5); @@ -937,7 +916,6 @@ loop: chp->chan_status = (chp->chan_status & 0xff00) | devstat; chp->chan_info &= ~INFO_SIOCD; /* show not first IOCD in channel prog */ -// sim_debug(DEBUG_XIO, dptr, sim_debug(DEBUG_DETAIL, dptr, "disk_iocl @%06x after start_cmd chan %04x status %08x count %04x byte %02x\n", chp->chan_caw, chan, chp->chan_status, chp->ccw_count, chp->chan_byte); @@ -962,7 +940,6 @@ loop: if (chp->chan_status & (STATUS_DEND|STATUS_CEND)) { uint16 chsa = GET_UADDR(uptr->u3); /* get channel & sub address */ chan_end(chsa, SNS_CHNEND|SNS_DEVEND); /* show I/O complete */ -// sim_debug(DEBUG_XIO, dptr, sim_debug(DEBUG_DETAIL, dptr, "disk_iocl @%06x FIFO #%1x cmd complete chan %04x status %04x count %04x\n", chp->chan_caw, FIFO_Num(chsa), chan, chp->chan_status, chp->ccw_count); @@ -970,7 +947,6 @@ loop: } /* the device processor returned OK (0), so wait for I/O to complete */ /* nothing happening, so return */ -// sim_debug(DEBUG_XIO, dptr, sim_debug(DEBUG_DETAIL, dptr, "disk_iocl @%06x return, chan %04x status %04x count %04x irq_pend %1x\n", chp->chan_caw, chan, chp->chan_status, chp->ccw_count, irq_pend); @@ -984,7 +960,6 @@ t_stat disk_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) int32 unit = (uptr - dptr->units); CHANP *chp = find_chanp_ptr(chsa); /* find the chanp pointer */ -// sim_debug(DEBUG_CMD, dptr, sim_debug(DEBUG_DETAIL, dptr, "disk_startcmd chsa %04x unit %02x cmd %02x CMD %08x\n", chsa, unit, cmd, uptr->CMD); @@ -1001,7 +976,6 @@ t_stat disk_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) return SNS_BSY; } uptr->SNS2 |= SNS_USEL; /* unit selected */ -// sim_debug(DEBUG_CMD, dptr, sim_debug(DEBUG_DETAIL, dptr, "disk_startcmd CMD continue unit=%02x cmd %02x iocla %06x cnt %04x\n", unit, cmd, chp->chan_caw, chp->ccw_count); @@ -1017,11 +991,9 @@ t_stat disk_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) uptr->SNS &= ~SNS_CMDREJ; /* not rejected yet */ uptr->CMD |= DSK_INCH2; /* use 0xF0 for inch, just need int */ #ifdef FAST_FOR_UTX -// sim_activate(uptr, 40); /* start things off */ sim_activate(uptr, 30); /* start things off */ #else sim_activate(uptr, 250); /* start things off */ -// sim_activate(uptr, 500); /* start things off */ #endif return SCPE_OK; /* good to go */ break; @@ -1061,22 +1033,13 @@ t_stat disk_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) "disk_startcmd starting disk cmd %02x chsa %04x\n", cmd, chsa); #ifdef FAST_FOR_UTX -// sim_activate(uptr, 40); /* start things off */ /* when value was 50, UTX would get a spontainous interrupt */ /* when value was 30, UTX would get a spontainous interrupt */ /* when starting cron */ /* changed to 25 from 30 121420 */ -//121420sim_activate(uptr, 30); /* start things off */ -#ifdef BAD_05142021 - sim_activate(uptr, 25); /* start things off */ -#else sim_activate(uptr, 20); /* start things off */ /* when using 500, UTX gets "ioi: sio at 801 failed, cc3, retry=0" */ -// sim_activate(uptr, 50); /* start things off */ -// sim_activate(uptr, 500); /* start things off */ -#endif #else -// sim_activate(uptr, 250); /* start things off */ sim_activate(uptr, 500); /* start things off */ #endif return SCPE_OK; /* good to go */ @@ -1097,7 +1060,6 @@ t_stat disk_haltio(UNIT *uptr) { int cmd = uptr->CMD & DSK_CMDMSK; CHANP *chp = find_chanp_ptr(chsa); /* find the chanp pointer */ -// sim_debug(DEBUG_EXP, dptr, sim_debug(DEBUG_DETAIL, dptr, "disk_haltio enter chsa %04x cmd = %02x\n", chsa, cmd); @@ -1148,7 +1110,6 @@ t_stat disk_srv(UNIT *uptr) uint8 buf2[1024]; sim_debug(DEBUG_CMD, dptr, -// sim_debug(DEBUG_DETAIL, dptr, "disk_srv entry unit %02x CMD %08x chsa %04x count %04x %x/%x/%x \n", unit, uptr->CMD, chsa, chp->ccw_count, STAR2CYL(uptr->CHS), (uptr->CHS >> 8)&0xff, (uptr->CHS&0xff)); @@ -1161,7 +1122,6 @@ t_stat disk_srv(UNIT *uptr) } } -// sim_debug(DEBUG_CMD, dptr, sim_debug(DEBUG_DETAIL, dptr, "disk_srv cmd=%02x chsa %04x count %04x\n", cmd, chsa, chp->ccw_count); @@ -1543,7 +1503,6 @@ iha_error: /* we have already seeked to the required sector */ /* we do not need to seek again, so move on */ chan_end(chsa, SNS_DEVEND|SNS_CHNEND); -// return SCPE_OK; break; } else { /* we have wasted enough time, we are there */ @@ -1552,12 +1511,9 @@ iha_error: unit, uptr->STAR >> 16, uptr->CHS >> 16); uptr->CHS = uptr->STAR; /* we are there */ #ifdef FAST_FOR_UTX -// sim_activate(uptr, 25); /* start things off */ -// sim_activate(uptr, 20); /* start things off */ sim_activate(uptr, 15); /* start things off */ #else sim_activate(uptr, 150); /* start things off */ -// sim_activate(uptr, 300); /* start things off */ #endif break; } @@ -1691,11 +1647,8 @@ iha_error: "disk_srv seeking unit=%02x to %04x/%02x/%02x from cyl %04x (%04x)\n", unit, cyl, trk, buf[3], tcyl, diff); #ifdef FAST_FOR_UTX -// sim_activate(uptr, 20); /* start us off */ -// sim_activate(uptr, 25); /* start things off */ sim_activate(uptr, 15); /* start things off */ #else -// sim_activate(uptr, 200+diff); /* start us off */ sim_activate(uptr, 400+diff); /* start us off */ #endif } else { @@ -1831,8 +1784,6 @@ iha_error: case DSK_FNSK: /* 0x0B Format for no skip */ /* buffer must be on halfword boundry if not STATUS_PCHK and SNS_CMDREJ status */ -// chp->chan_status |= STATUS_PCHK; /* program check for invalid cmd */ -// uptr->SNS |= SNS_CMDREJ; /* cmd rejected */ /* byte count can not exceed 20160 for the track */ uptr->CMD &= LMASK; /* remove old status bits & cmd */ sim_debug(DEBUG_CMD, dptr, @@ -1962,14 +1913,6 @@ if ((chp->ccw_addr == 0x3cde0) && (buf[0] == 0x4a)) { sim_debug(DEBUG_CMD, dptr, "disk_srv READ buf %s\n", bufp); } #endif -#if 0 - sim_debug(DEBUG_DETAIL, dptr, - "disk_srv READ data %02x%02x%02x%02x %02x%02x%02x%02x " - "%02x%02x%02x%02x %02x%02x%02x%02x\n", - buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], - buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]); -#endif - uptr->CHS++; /* next sector number */ /* process the next sector of data */ for (i=0; iccw_addr == 0x3cde0) && (buf[0] == 0x4a)) { "DISK sector read complete, %x bytes to go from diskfile %04x/%02x/%02x\n", chp->ccw_count, STAR2CYL(uptr->CHS), ((uptr->CHS) >> 8)&0xff, (uptr->CHS&0xff)); #ifdef FAST_FOR_UTX -// sim_activate(uptr, 25); /* start things off */ -// sim_activate(uptr, 20); /* start things off */ -#ifdef BAD_05142021 - sim_activate(uptr, 15); /* start things off */ -#else -// sim_activate(uptr, 10); /* start things off */ -// sim_activate(uptr, 50); /* start things off */ sim_activate(uptr, 10); /* start things off */ -#endif #else -// sim_activate(uptr, 150); /* wait to read next sector */ sim_activate(uptr, 300); /* wait to read next sector */ #endif break; @@ -2291,11 +2225,8 @@ if ((chp->ccw_addr == 0x3cde0) && (buf[0] == 0x4a)) { } #ifdef FAST_FOR_UTX -// sim_activate(uptr, 25); /* start things off */ -// sim_activate(uptr, 20); /* start things off */ sim_activate(uptr, 15); /* start things off */ #else -// sim_activate(uptr, 150); /* wait to read next sector */ sim_activate(uptr, 300); /* wait to read next sector */ #endif break; @@ -2783,11 +2714,7 @@ int disk_label(UNIT *uptr) { int32 daddr = (CYL(type)-4) * SPC(type) + (HDS(type)-2) * SPT(type); /* get sector address of utx flaw map sec 1 pointer */ /* use this address for sec 1 label pointer */ -#ifndef NOT_NEEDED_0128 int32 uaddr = (CYL(type)-4) * SPC(type) + (HDS(type)-4) * SPT(type); -#else - int32 uaddr = (CYL(type)-4) * SPC(type) + (HDS(type)-3) * SPT(type); -#endif /* write 30 byte track labels for all tracks on disk */ /* tot_tracks entries will be created starting at end of disk */ @@ -2864,7 +2791,6 @@ int disk_label(UNIT *uptr) { } /* if this is removed, utx is unable to create newfs */ /* get preposterous size 0 error message */ -#ifndef XXXX_121720 /* maybe not needed, but left anyway */ /* uaddr has umap value for track zero label */ if (CHS == 0) { /* only write dmap address in trk 0 */ @@ -2874,7 +2800,6 @@ int disk_label(UNIT *uptr) { label[18] = (uaddr >> 8) & 0xff; label[19] = (uaddr) & 0xff; } -#endif /* the tech doc shows the cyl/trk/sec data is in the first 4 bytes */ /* of the track label, BUT it is really in the configuration data */ @@ -2939,22 +2864,6 @@ int disk_label(UNIT *uptr) { label[14] = 0; label[15] = 0; - /* if this is written, UTX will not be able to do a newfs */ - /* gets preposterous size 0 error */ -#ifdef XXXX_121720 - /* uaddr has umap value for sector one label */ - if (CHS == 1) { /* only write dmap address in trk 0 */ - /* output last sector address of disk */ - label[12] = (uaddr >> 24) & 0xff; /* lumapp UMAP pointer */ - label[13] = (uaddr >> 16) & 0xff; - label[14] = (uaddr >> 8) & 0xff; - label[15] = (uaddr) & 0xff; - sim_debug(DEBUG_CMD, dptr, - "disk_format WSL uaddr star %02x %02x %02x %02x\n", - label[12], label[13], label[14], label[15]); - } -#endif - /* the tech doc shows the cyl/trk/sec data is in the first 4 bytes */ /* of the track label, BUT it is really in the configuration data */ /* area too. Byte 27 is sectors/track and byte 28 is number of heads. */ @@ -3000,10 +2909,8 @@ int disk_format(UNIT *uptr) { /* last sector address of disk (cyl * hds * spt) - 1 */ uint32 laddr = CAP(type) - 1; /* last sector of disk */ -#ifndef NOT_NEEDED_0128 /* last track address of disk (cyl * hds * spt) - spt */ uint32 ltaddr = CAP(type)-SPT(type); /* last track of disk */ -#endif /* get sector address of vendor defect table VDT */ /* put data = 0xf0000000 0xf4000000 */ @@ -3014,19 +2921,13 @@ int disk_format(UNIT *uptr) { /* 0x9a000000 + (cyl-1), 0xf4000000 */ int32 daddr = (CYL(type)-4) * SPC(type) + (HDS(type)-2) * SPT(type); -#ifndef NOT_NEEDED_0128 /* get sector address of utx flaw data (1 track long) */ /* set trace data to zero */ int32 faddr = (CYL(type)-4) * SPC(type) + (HDS(type)-3) * SPT(type); -#endif /* get sector address of utx flaw map sec 1 pointer */ /* use this address for sec 1 label pointer */ -#ifndef NOT_NEEDED_0128 int32 uaddr = (CYL(type)-4) * SPC(type) + (HDS(type)-4) * SPT(type); -#else - int32 uaddr = (CYL(type)-4) * SPC(type) + (HDS(type)-3) * SPT(type); -#endif /* vendor flaw map in vaddr */ uint32 vmap[2] = {0xf0000004, 0xf4000000}; @@ -3035,18 +2936,15 @@ int disk_format(UNIT *uptr) { uint32 dmap[4] = {0xf0000000 | (cap-1), 0x8a000000 | daddr, 0x9a000000 | (cap-1), 0xf4000000}; -#ifndef NOT_NEEDED_0128 /* utx flaw map */ uint32 fmap[4] = {0xf0000000 | (cap-1), 0x8a000000 | daddr, 0x9a000000 | ltaddr, 0xf4000000}; -#endif /* see if -i or -n specified on attach command */ if (!(sim_switches & SWMASK('N')) && !(sim_switches & SWMASK('I'))) { sim_switches = 0; /* simh tests 'N' & 'Y' switches */ /* see if user wants to initialize the disk */ if (!get_yn("Initialize disk? [Y] ", TRUE)) { -// printf("disk_format init question is false\r\n"); sim_switches = oldsw; return 1; } @@ -3055,7 +2953,6 @@ int disk_format(UNIT *uptr) { /* VDT 249264 (819/18/0) 0x3cdb0 for 9346 - 823/19/16 vaddr */ /* MDT 249248 (819/17/0) 0x3cda0 for 9346 - 823/19/16 daddr */ -// /* UMAP 249232 (819/16/0) 0x3cd90 for 9346 - 823/19/16 uaddr */ /* UMAP 249216 (819/15/0) 0x3cd80 for 9346 - 823/19/16 uaddr */ /* seek to sector 0 */ @@ -3100,12 +2997,10 @@ int disk_format(UNIT *uptr) { ((dmap[i] & 0xff0000) >> 8) | ((dmap[i] >> 24) & 0xff)); } -#ifndef NOT_USED_0128 for (i=0; i<4; i++) { fmap[i] = (((fmap[i] & 0xff) << 24) | ((fmap[i] & 0xff00) << 8) | ((fmap[i] & 0xff0000) >> 8) | ((fmap[i] >> 24) & 0xff)); } -#endif /* now seek to end of disk and write the dmap data */ /* setup dmap pointed to by track label 0 wd[3] = (cyl-4) * spt + (spt - 1) */ @@ -3152,7 +3047,6 @@ int disk_format(UNIT *uptr) { return 1; } -#ifndef NOT_NEEDED_0128 /* write dummy UTX DMAP to faddr */ if ((sim_fseek(uptr->fileref, faddr*ssize, SEEK_SET)) != 0) { /* seek DMAP */ sim_debug(DEBUG_CMD, dptr, @@ -3166,7 +3060,6 @@ int disk_format(UNIT *uptr) { faddr, faddr*ssize); return 1; } -#endif printf("Disk %s has %x (%d) cyl, %x (%d) hds, %x (%d) sec\r\n", disk_type[type].name, CYL(type), CYL(type), HDS(type), HDS(type), @@ -3176,10 +3069,8 @@ int disk_format(UNIT *uptr) { printf("writing to dmap sec %x (%d) %x (%d) dmap to %x (%d) %x (%d)\r\n", cap-1, cap-1, (cap-1)*ssize, (cap-1)*ssize, daddr, daddr, daddr*ssize, daddr*ssize); -#ifndef NOT_NEEDED_0128 printf("writing to fmap sec %x (%d) bytes %x (%d)\r\n", faddr, faddr, (faddr)*ssize, (faddr)*ssize); -#endif printf("writing to umap sec %x (%d) bytes %x (%d)\r\n", uaddr, uaddr, (uaddr)*ssize, (uaddr)*ssize); diff --git a/SEL32/sel32_ec.c b/SEL32/sel32_ec.c index c799b49..cb03fcc 100644 --- a/SEL32/sel32_ec.c +++ b/SEL32/sel32_ec.c @@ -37,62 +37,62 @@ #define CMD u3 /* u3 */ /* in u3 is device command code and status */ -#define EC_CMDMSK 0x0ff /* Command being run */ +#define EC_CMDMSK 0x0ff /* Command being run */ /* commands */ -#define EC_INCH 0x00 /* Initialize channel */ -#define EC_INCH2 0xf0 /* Initialize channel command for processing */ -#define EC_WRITE 0x01 /* Write frame */ -#define EC_READ 0x02 /* Read frame*/ -#define EC_NOP 0x03 /* No operation */ -#define EC_SNS 0x04 /* Sense */ -#define EC_LIA 0x07 /* Load individual address */ -#define EC_TIC 0x08 /* Transfer in channel */ -#define EC_CGA 0x0B /* Disable multicast address */ -#define EC_LGA 0x0F /* Load Multicast address */ -#define EC_LCC 0x10 /* Configure LCC */ -#define EC_STATS 0x14 /* Read Statistics */ -#define EC_CSTATS 0x15 /* Clear software counters */ -#define EC_BUSY 0x100 /* Mark Device as Busy */ +#define EC_INCH 0x00 /* Initialize channel */ +#define EC_INCH2 0xF0 /* Initialize channel command for processing */ +#define EC_WRITE 0x01 /* Write frame */ +#define EC_READ 0x02 /* Read frame*/ +#define EC_NOP 0x03 /* No operation */ +#define EC_SNS 0x04 /* Sense */ +#define EC_LIA 0x07 /* Load individual address */ +#define EC_TIC 0x08 /* Transfer in channel */ +#define EC_CGA 0x0B /* Disable multicast address */ +#define EC_LGA 0x0F /* Load Multicast address */ +#define EC_LCC 0x10 /* Configure LCC */ +#define EC_STATS 0x14 /* Read Statistics */ +#define EC_CSTATS 0x15 /* Clear software counters */ +#define EC_BUSY 0x100 /* Mark Device as Busy */ #define SNS u5 /* u5 */ /* Sense byte 0 */ -#define SNS_CMDREJ 0x80000000 /* Command reject */ -#define SNS_SPARE0 0x40000000 /* Spare */ -#define SNS_SPARE1 0x20000000 /* Spare */ -#define SNS_EQUCHK 0x10000000 /* Equipment check */ -#define SNS_SPARE2 0x08000000 /* Spare */ -#define SNS_SPARE3 0x04000000 /* Spare */ -#define SNS_MODE_M 0x03000000 /* Mode Mask */ +#define SNS_CMDREJ 0x80000000 /* Command reject */ +#define SNS_SPARE0 0x40000000 /* Spare */ +#define SNS_SPARE1 0x20000000 /* Spare */ +#define SNS_EQUCHK 0x10000000 /* Equipment check */ +#define SNS_SPARE2 0x08000000 /* Spare */ +#define SNS_SPARE3 0x04000000 /* Spare */ +#define SNS_MODE_M 0x03000000 /* Mode Mask */ /* Sense byte 1 */ -#define SNS_RCV_RDY 0x00800000 /* Receive unit ready */ -#define SNS_TMT_DEF 0x00400000 /* Transmission deferred */ -#define SNS_COL_RTY 0x00300000 /* Collision retry */ -#define SNS_HRT_TST 0x00080000 /* Heartbeat test failure */ -#define SNS_DMA_UND 0x00040000 /* DMA under run */ -#define SNS_LST_CTS 0x00020000 /* Lost Clear to send */ -#define SNS_NO_CAR 0x00010000 /* No carrier. */ +#define SNS_RCV_RDY 0x00800000 /* Receive unit ready */ +#define SNS_TMT_DEF 0x00400000 /* Transmission deferred */ +#define SNS_COL_RTY 0x00300000 /* Collision retry */ +#define SNS_HRT_TST 0x00080000 /* Heartbeat test failure */ +#define SNS_DMA_UND 0x00040000 /* DMA under run */ +#define SNS_LST_CTS 0x00020000 /* Lost Clear to send */ +#define SNS_NO_CAR 0x00010000 /* No carrier. */ /* Sense byte 2 & 3 */ -#define SNS_XFR_MASK 0x0000FFFF /* Previous frame count */ +#define SNS_XFR_MASK 0x0000FFFF /* Previous frame count */ typedef uint32 in_addr_T; #define ETHTYPE_ARP 0x0806 #define ETHTYPE_IP 0x0800 -#define STAT_FR_ALIGN 0 /* Frame alignment errors */ -#define STAT_FR_CRC 1 /* Frame CRC errors */ -#define STAT_LCL_AVAIL 2 /* Local bus available errors */ -#define STAT_LCL_OVER 3 /* Local bus overflow */ -#define STAT_TX_COLL 4 /* Transmission collisions */ -#define STAT_RX_LEN 5 /* Receive length errors */ -#define STAT_TX_SUCC 6 /* Transmitt success after 2-15 collisions */ -#define STAT_TX_DEF 7 /* Transmitt deferred */ -#define STAT_TX_UNSUCC 8 /* Transmitt unsuccessful */ -#define STAT_TX_SUCC1 9 /* Transmitt success after 1 collision */ -#define STAT_LEN 10 /* Number of half word stats */ +#define STAT_FR_ALIGN 0 /* Frame alignment errors */ +#define STAT_FR_CRC 1 /* Frame CRC errors */ +#define STAT_LCL_AVAIL 2 /* Local bus available errors */ +#define STAT_LCL_OVER 3 /* Local bus overflow */ +#define STAT_TX_COLL 4 /* Transmission collisions */ +#define STAT_RX_LEN 5 /* Receive length errors */ +#define STAT_TX_SUCC 6 /* Transmitt success after 2-15 collisions */ +#define STAT_TX_DEF 7 /* Transmitt deferred */ +#define STAT_TX_UNSUCC 8 /* Transmitt unsuccessful */ +#define STAT_TX_SUCC1 9 /* Transmitt success after 1 collision */ +#define STAT_LEN 10 /* Number of half word stats */ PACKED_BEGIN struct ec_eth_hdr { @@ -106,64 +106,64 @@ struct ec_eth_hdr { */ PACKED_BEGIN struct ip { - uint8 ip_v_hl; /* version,header length */ - uint8 ip_tos; /* type of service */ - uint16 ip_len; /* total length */ - uint16 ip_id; /* identification */ - uint16 ip_off; /* fragment offset field */ -#define IP_DF 0x4000 /* don't fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - uint8 ip_ttl; /* time to live */ - uint8 ip_p; /* protocol */ - uint16 ip_sum; /* checksum */ + uint8 ip_v_hl; /* version,header length */ + uint8 ip_tos; /* type of service */ + uint16 ip_len; /* total length */ + uint16 ip_id; /* identification */ + uint16 ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* don't fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + uint8 ip_ttl; /* time to live */ + uint8 ip_p; /* protocol */ + uint16 ip_sum; /* checksum */ in_addr_T ip_src; - in_addr_T ip_dst; /* source and dest address */ + in_addr_T ip_dst; /* source and dest address */ } PACKED_END; #define TCP_PROTO 6 PACKED_BEGIN struct tcp { - uint16 tcp_sport; /* Source port */ - uint16 tcp_dport; /* Destination port */ - uint32 seq; /* Sequence number */ - uint32 ack; /* Ack number */ - uint16 flags; /* Flags */ + uint16 tcp_sport; /* Source port */ + uint16 tcp_dport; /* Destination port */ + uint32 seq; /* Sequence number */ + uint32 ack; /* Ack number */ + uint16 flags; /* Flags */ #define TCP_FL_FIN 0x01 #define TCP_FL_SYN 0x02 #define TCP_FL_RST 0x04 #define TCP_FL_PSH 0x08 #define TCP_FL_ACK 0x10 #define TCP_FL_URG 0x20 - uint16 window; /* Window size */ - uint16 chksum; /* packet checksum */ - uint16 urgent; /* Urgent pointer */ + uint16 window; /* Window size */ + uint16 chksum; /* packet checksum */ + uint16 urgent; /* Urgent pointer */ } PACKED_END; #define UDP_PROTO 17 PACKED_BEGIN struct udp { - uint16 udp_sport; /* Source port */ - uint16 udp_dport; /* Destination port */ - uint16 len; /* Length */ - uint16 chksum; /* packet checksum */ + uint16 udp_sport; /* Source port */ + uint16 udp_dport; /* Destination port */ + uint16 len; /* Length */ + uint16 chksum; /* packet checksum */ } PACKED_END; PACKED_BEGIN struct udp_hdr { in_addr_T ip_src; - in_addr_T ip_dst; /* source and dest address */ + in_addr_T ip_dst; /* source and dest address */ uint8 zero; - uint8 proto; /* Protocol */ - uint16 hlen; /* Length of header and data */ + uint8 proto; /* Protocol */ + uint16 hlen; /* Length of header and data */ } PACKED_END; #define ICMP_PROTO 1 PACKED_BEGIN struct icmp { - uint8 type; /* Type of packet */ - uint8 code; /* Code */ - uint16 chksum; /* packet checksum */ + uint8 type; /* Type of packet */ + uint8 code; /* Code */ + uint16 chksum; /* packet checksum */ } PACKED_END; PACKED_BEGIN @@ -192,25 +192,25 @@ struct arp_hdr { } PACKED_END; struct ec_device { - ETH_PCALLBACK rcallback; /* read callback routine */ - ETH_PCALLBACK wcallback; /* write callback routine */ - ETH_MAC mac; /* Hardware MAC addresses */ + ETH_PCALLBACK rcallback; /* read callback routine */ + ETH_PCALLBACK wcallback; /* write callback routine */ + ETH_MAC mac; /* Hardware MAC addresses */ ETH_DEV etherface; ETH_QUE ReadQ; - ETH_PACK rec_buff[1024]; /* Buffer for received packet */ - ETH_PACK snd_buff; /* Buffer for sending packet */ - int macs_n; /* Number of multi-cast addresses */ - ETH_MAC macs[67]; /* Watched Multi-cast addresses */ - int amc; /* Recieve all multicast packets */ - uint32 rx_count; /* Packets received */ - uint32 tx_count; /* Packets sent */ - t_stat drop_cnt; /* Packets dropped */ - int r_pkt; /* Packet pending */ - int poll; /* Need to poll receiver */ - int lp_rdy; /* Loop back packet ready */ - int rec_ptr; /* Receive pointer */ - int xtr_ptr; /* Extract pointer */ - uint8 conf[12]; /* user specified configuration */ + ETH_PACK rec_buff[1024]; /* Buffer for received packet */ + ETH_PACK snd_buff; /* Buffer for sending packet */ + int macs_n; /* Number of multi-cast addresses */ + ETH_MAC macs[67]; /* Watched Multi-cast addresses */ + int amc; /* Recieve all multicast packets */ + uint32 rx_count; /* Packets received */ + uint32 tx_count; /* Packets sent */ + t_stat drop_cnt; /* Packets dropped */ + int r_pkt; /* Packet pending */ + int poll; /* Need to poll receiver */ + int lp_rdy; /* Loop back packet ready */ + int rec_ptr; /* Receive pointer */ + int xtr_ptr; /* Extract pointer */ + uint8 conf[12]; /* user specified configuration */ } ec_data; #define LOOP_MSK 0x3ff @@ -245,11 +245,10 @@ t_stat ec_detach (UNIT * uptr); t_stat ec_help (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr); const char *ec_description (DEVICE *dptr); -#define ec_master_uptr (&ec_unit[0]) /* Unit doing receive digestion */ +#define ec_master_uptr (&ec_unit[0]) /* Unit doing receive digestion */ UNIT ec_unit[] = { {UDATA(ec_rec_srv, UNIT_IDLE|UNIT_ATTABLE, 0), 0, UNIT_ADDR(0xE00)}, /* 0 */ -#ifndef FOR_DIAG {UDATA(ec_srv, UNIT_IDLE|UNIT_DIS|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE01)}, /* 1 */ {UDATA(ec_srv, UNIT_IDLE|UNIT_DIS|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE02)}, /* 2 */ {UDATA(ec_srv, UNIT_IDLE|UNIT_DIS|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE03)}, /* 3 */ @@ -265,23 +264,6 @@ UNIT ec_unit[] = { {UDATA(ec_srv, UNIT_IDLE|UNIT_DIS|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE0D)}, /* D */ {UDATA(ec_srv, UNIT_IDLE|UNIT_DIS|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE0E)}, /* E */ {UDATA(ec_srv, UNIT_IDLE|UNIT_DIS|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE0F)}, /* F */ -#else - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE01)}, /* 1 */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE02)}, /* 2 */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE03)}, /* 3 */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE04)}, /* 4 */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE05)}, /* 5 */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE06)}, /* 6 */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE07)}, /* 7 */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE08)}, /* 8 */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE09)}, /* 9 */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE0A)}, /* A */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE0B)}, /* B */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE0C)}, /* C */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE0D)}, /* D */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE0E)}, /* E */ - {UDATA(ec_srv, UNIT_IDLE|UNIT_SUBCHAN, 0), 0, UNIT_ADDR(0xE0F)}, /* F */ -#endif }; DIB ec_dib = { @@ -402,11 +384,17 @@ loop: sim_debug(DEBUG_CMD, dptr, "ec_iocl @%06x read ccw chsa %04x IOCD wd 1 %08x wd 2 %08x SNS %08x\n", chp->chan_caw, chp->chan_dev, word1, word2, uptr->SNS); +//#define DYNAMIC_DEBUG +#ifdef DYNAMIC_DEBUG + if ((word1 == 0x0202f000) && (word2 == 0x0000003C) && (uptr->SNS == 0x0080003e)) { + cpu_dev.dctrl |= (DEBUG_INST|DEBUG_XIO); /* start instruction trace */ + } else + if ((word1 == 0x0202f000) && (word2 == 0x00000040) && (uptr->SNS == 0x0080003e)) { + cpu_dev.dctrl &= ~(DEBUG_INST|DEBUG_XIO); /* stop instruction trace */ + } +#endif chp->chan_caw = (chp->chan_caw & 0xfffffc) + 8; /* point to next IOCD */ -#ifdef BAD_05142021 - chp->ccw_cmd = (word1 >> 24) & 0xff; /* set new command from IOCD wd 1 */ -#endif /* Check if we had data chaining in previous iocd */ /* if we did, use previous cmd value */ @@ -458,7 +446,7 @@ loop: //T20 if (((word2 & 0xffff) < ETH_MIN_PACKET) && /* not at least 60 bytes */ //UTX if (((word2 & 0xffff) < 20) && /* not at least 20 bytes */ if (((chp->chan_info & INFO_SIOCD) == 1) && /* see if 1st IOCD in channel prog */ - ((word2 & 0xffff) < 20) && /* not at least 20 bytes */ + ((word2 & 0xffff) < 20) && /* and not at least 20 bytes */ ((word2 & BIT0) == 0)) { /* and not data chained */ sim_debug(DEBUG_DETAIL, &ec_dev, "ec_iocl READ error small packet 0x%04x\n", word2 & 0xffff); @@ -479,10 +467,9 @@ loop: case EC_WRITE: /* see if too few bytes */ //T20 if (((word2 & 0xffff) < ETH_MIN_PACKET) && /* not at least 60 bytes */ -//T20 if (((word2 & 0xffff) < 10) && /* not at least 10 bytes */ //UTX if (((word2 & 0xffff) < 8) && /* not at least 8 bytes */ if (((chp->chan_info & INFO_SIOCD) == 1) && /* see if 1st IOCD in channel prog */ - ((word2 & 0xffff) < 8) && /* not at least 8 bytes */ + ((word2 & 0xffff) < 8) && /* and not at least 8 bytes */ ((word2 & BIT0) == 0)) { /* and not data chained */ sim_debug(DEBUG_DETAIL, &ec_dev, "ec_iocl WRITE error small packet 0x%04x\n", word2 & 0xffff); @@ -568,14 +555,9 @@ loop: } /* Check if we had data chaining in previous iocd */ -#ifdef BAD_05152021 - if ((chp->chan_info & INFO_SIOCD) || /* see if 1st IOCD in channel prog */ - ((chp->ccw_flags & FLAG_DC) == 0)) { /* last IOCD have DC set? */ -#else if ((chp->chan_info & INFO_SIOCD) || /* see if 1st IOCD in channel prog */ (((chp->chan_info & INFO_SIOCD) == 0) && /* see if 1st IOCD in channel prog */ - ((chp->ccw_flags & FLAG_DC) == 0))) { /* last IOCD have DC set? */ -#endif + ((chp->ccw_flags & FLAG_DC) == 0))) { /* last IOCD have DC set? */ sim_debug(DEBUG_CMD, dptr, "ec_iocl @%06x DO CMD No DC, ccw_flags %04x cmd %02x\n", chp->chan_caw, chp->ccw_flags, chp->ccw_cmd); @@ -710,10 +692,10 @@ t_stat ec_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) /* Unit is online, so process a command */ switch (cmd) { case EC_WRITE: /* Write command 0x01 */ - uptr->CMD |= cmd|EC_BUSY; /* save cmd */ -// This works most of the time & stops at test 30 with no len errors -//*RC*/ sim_activate(uptr, 7000); /* start things off */ -// This works + uptr->CMD |= (cmd|EC_BUSY); /* save cmd */ + // This works most of the time & stops at test 30 with no len errors +//Was sim_activate(uptr, 5000); /* start things off */ + // This works /*jb*/ sim_activate(uptr, 7500); /* start things off */ return 0; case EC_INCH: /* INCH cmd 0x0 */ @@ -730,9 +712,8 @@ t_stat ec_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) /* Fall through */ case EC_SNS: /* Sense 0x04 */ uptr->CMD |= cmd|EC_BUSY; /* save cmd */ -//*RC*/ sim_activate(uptr, 200); /* start things off */ -/*jb*/ sim_activate(uptr, 150); /* start things off */ -//old JBsim_activate(uptr, 50); /* start things off */ +//Was M sim_activate(uptr, 100); /* start things off */ + sim_activate(uptr, 150); /* start things off */ return 0; } @@ -788,7 +769,7 @@ t_stat ec_srv(UNIT *uptr) uint32 mema; int i; int n, len; - int pirq; + int pirq, cnt, dcnt; uint8 ch; uint8 buf[1520]; uint8 *pck; @@ -799,8 +780,8 @@ t_stat ec_srv(UNIT *uptr) chp, cmd, chsa, chp->ccw_count, uptr->SNS); switch (cmd) { -// case EC_INCH: /* INCH cmd 0x0 */ - case EC_INCH2: /* INCH cmd 0xF0 */ +// case EC_INCH: /* 0x00 INCH cmd */ + case EC_INCH2: /* 0xF0 INCH cmd */ len = chp->ccw_count; /* INCH command count */ mema = chp->ccw_addr; /* get inch or buffer addr */ sim_debug(DEBUG_CMD, dptr, @@ -827,7 +808,7 @@ t_stat ec_srv(UNIT *uptr) chan_end(chsa, SNS_CHNEND|SNS_DEVEND); break; - case EC_LIA: /* Load individual address */ + case EC_LIA: /* 0x07 Load individual address */ uptr->CMD &= LMASK; /* remove old status bits & cmd */ for(i = 0; i < sizeof (ETH_MAC); i++) { if (chan_read_byte(chsa, &buf[i])) { @@ -845,11 +826,11 @@ t_stat ec_srv(UNIT *uptr) if (ec_master_uptr->flags & UNIT_ATT) /* set promiscuous if bit 7 of byte zero of mac address is set */ eth_filter (&ec_data.etherface, n, ec_data.macs, ec_data.amc, - ec_data.macs[0][0] & 1); + ec_data.macs[0][0] & 1); chan_end(chsa, SNS_CHNEND|SNS_DEVEND); break; - case EC_CGA: /* Disable multicast address */ + case EC_CGA: /* 0x0B Disable multicast address */ uptr->CMD &= LMASK; /* remove old status bits & cmd */ ec_data.macs_n = 0; ec_data.amc = 0; @@ -862,7 +843,7 @@ t_stat ec_srv(UNIT *uptr) chan_end(chsa, SNS_CHNEND|SNS_DEVEND); break; - case EC_LGA: /* Load Multicast address */ + case EC_LGA: /* 0x0F Load Multicast address */ uptr->CMD &= LMASK; /* remove old status bits & cmd */ ec_data.macs_n = 0; len = 2; @@ -891,114 +872,219 @@ t_stat ec_srv(UNIT *uptr) chan_end(chsa, SNS_CHNEND|SNS_DEVEND); break; - case EC_WRITE: /* Write command 0x01 */ + case EC_WRITE: /* 0x01 Write command */ /* get queue length */ n = (((ec_data.rec_ptr) & LOOP_MSK) + LOOP_MSK + 1) - ec_data.xtr_ptr; if (n >LOOP_MSK) n -= (LOOP_MSK + 1); - len = sizeof(struct ec_eth_hdr); /* header size */ + len = sizeof(struct ec_eth_hdr); /* std header size /dest/src/len/ (14) */ pirq = 0; uptr->CMD &= LMASK; /* remove old status bits & cmd */ - sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv START %04x write %d %d size=%d cnt %d q %d\n", - chsa, ec_data.xtr_ptr, ec_data.rec_ptr, ec_data.conf[9], chp->ccw_count, n); + i = GET_MODE(ec_master_uptr->flags); /* get the mode setting */ + sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv START %04x mode %d write %d %d conf=%d cnt 0x%x q %d\n", + chsa, i, ec_data.xtr_ptr, ec_data.rec_ptr, ec_data.conf[9], chp->ccw_count, n); hdr = (struct ec_eth_hdr *)(&ec_data.snd_buff.msg[0]); pck = (uint8 *)(&ec_data.snd_buff.msg[0]); uptr->SNS &= LMASK; /* remove old count */ + + /* create packet: destination(6)/source(6)/type(2) or len(2)/ data 46-1500 */ switch (GET_MODE(ec_master_uptr->flags)) { case 0: - /* destination / source / type or len / data 46-1500 */ - for(i = 0; i < sizeof (struct ec_eth_hdr); i++) { + /* user buffer has /dest(6)/src(6)/type(2) or len(2)/ data/ */ + /* create packet: destination(6)/source(6)/type(2) or len(2)/ data 46-1500 */ + + /* copy users header unchanged */ + for(i = 0; i < sizeof(struct ec_eth_hdr); i++) { if (chan_read_byte(chsa, &pck[i])) { pirq = 1; + n = i; + sim_debug(DEBUG_DETAIL, &ec_dev, "rw_end case 0 error 0\n"); goto wr_end; } } - /* set transfer count of user bytes supplied */ - uptr->SNS |= (sizeof(struct ec_eth_hdr) & 0xffff); /* set transfer count */ + /* set transfer count of standard header supplied */ + uptr->SNS |= (sizeof(struct ec_eth_hdr) & 0xffff); /* set transfer count (14) */ + + /* copy in user supplied packet data */ + /* make min cnt 60 and max 1514 */ + i = sizeof(struct ec_eth_hdr); /* dest/src/len 14 bytes */ + while (chan_read_byte(chsa, &ch) == 0) { + if (i < ETH_MAX_PACKET) { +/*GG*/ if (i>6 && i<28) + sim_debug(DEBUG_DATA, &ec_dev, "ec_srv data[%3x]: %06x %02x\n", + i, chp->ccw_addr, ch); + pck[i] = ch; + } + i++; + uptr->SNS++; /* set count */ + } sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv case 0 transmit bytes %d (0x%x) SNS %08x\n", len, len, uptr->SNS); break; case 1: case 2: - /* copy destination */ - for(i = 0; i < sizeof (ETH_MAC); i++) { + /* user buffer has /dest(6)/type(2)/data(46-1500)/ */ + /* create packet: destination(6)/source(6)/type(2) or len(2)/ data 46-1500 */ + /* copy in user dest/type/data */ + + /* get 6 byte destination from user */ + for(i = 0; i < sizeof(ETH_MAC); i++) { if (chan_read_byte(chsa, &pck[i])) { pirq = 1; + n = i; + sim_debug(DEBUG_DETAIL, &ec_dev, "rw_end case 1&2 error 0\n"); goto wr_end; } } - /* insert source */ - memcpy(&hdr->src, ec_data.mac, sizeof (ETH_MAC)); - /* copy two byte type */ + /* insert 6 byte source from configuration */ + memcpy(&hdr->src, ec_data.mac, sizeof(ETH_MAC)); + + /* copy two byte type/len from user buffer */ for(i = sizeof(ETH_MAC) * 2; i < sizeof(struct ec_eth_hdr); i++) { if (chan_read_byte(chsa, &pck[i])) { pirq = 1; + n = i; + sim_debug(DEBUG_DETAIL, &ec_dev, "rw_end case 1&2 error 2\n"); goto wr_end; } } - /* set transfer count of user bytes supplied */ + /* set transfer count of user bytes supplied dest(6)/type(2) */ uptr->SNS |= ((sizeof(struct ec_eth_hdr) - sizeof(ETH_MAC)) & 0xffff); + + /* copy in user supplied packet data */ + /* make min cnt 60 and max 1514 */ + i = sizeof(struct ec_eth_hdr); /* dest/src/len 14 bytes */ + while (chan_read_byte(chsa, &ch) == 0) { + if (i < ETH_MAX_PACKET) { +/*GG*/ if (i>6 && i<28) + sim_debug(DEBUG_DATA, &ec_dev, "ec_srv data[%3x]: %06x %02x\n", + i, chp->ccw_addr, ch); + pck[i] = ch; + } + i++; + uptr->SNS++; /* set count */ + } sim_debug(DEBUG_DETAIL, &ec_dev, - "ec_srv case 1&2 transmit bytes %d (0x%x) SNS %08x\n", - len-6, len-6, uptr->SNS); + "ec_srv case 1&2 transmit bytes %d (0x%x) SNS %08x i 0x%x\n", + len-6, len-6, uptr->SNS, i); + + /* This code is to simulate word transfers into memory */ + /* from the users buffer. 1-3 extra bytes are placed */ + /* into the buffer. Diags in test 20 checks for this data */ + /* being present. These were set to 0 by the old code */ + /* and diags would complain 11/11/2021 */ + /* save data count */ + dcnt = i - sizeof(struct ec_eth_hdr); /* dest/src/len 14 bytes */ + n = 0; + while (dcnt++ % 4) { + pck[i+n] = RMB(((chp->ccw_addr+n))); + sim_debug(DEBUG_DATA, &ec_dev, "ec_srx i %x data[%3x]: %06x %02x\n", + i, i+n, chp->ccw_addr+n, pck[i+n]); + n++; + } + n = n + i; /* last written char in buffer */ break; case 3: - /* copy destination */ - for(i = 0; i < sizeof (ETH_MAC); i++) { + /* user buffer has /dest(6)/data(46-1500)/ */ + /* create packet: destination(6)/source(6)/type(2) or len(2)/ data 46-1500 */ + + /* copy destination(6) from user buffer */ + for(i = 0; i < sizeof(ETH_MAC); i++) { if (chan_read_byte(chsa, &pck[i])) { pirq = 1; + n = i; + sim_debug(DEBUG_DETAIL, &ec_dev, "rw_end case 3 error 0\n"); goto wr_end; } } - /* insert source */ - memcpy(&hdr->src, ec_data.mac, sizeof (ETH_MAC)); - /* insert type */ + /* insert source(6) */ + memcpy(&hdr->src, ec_data.mac, sizeof(ETH_MAC)); + +//#define USE_DATA_CNT +#ifdef USE_DATA_CNT + /* insert type(2) */ hdr->type = htons(ETHTYPE_IP); +#endif /* set transfer count of user bytes supplied */ uptr->SNS |= ((sizeof(struct ec_eth_hdr) - sizeof(ETH_MAC) - sizeof(int16)) & 0xffff); + + /* copy in user supplied packet data */ + /* make min cnt 60 and max 1514 */ + i = sizeof(struct ec_eth_hdr); /* dest/src/len 14 bytes */ + cnt = 0; + while (chan_read_byte(chsa, &ch) == 0) { + if (i < ETH_MAX_PACKET) { +/*GG*/ if (i>6 && i<28) + sim_debug(DEBUG_DATA, &ec_dev, "ec_srv data[%3x]: %06x %02x\n", + i, chp->ccw_addr, ch); + pck[i] = ch; + } + i++; + uptr->SNS++; /* set count */ +#ifndef USE_DATA_CNT + cnt++; /* user data count */ +#endif + } + +#ifndef USE_DATA_CNT + /* insert type(2) */ +// hdr->type = htons(ETHTYPE_IP); + hdr->type = htons(cnt); /* set cnt into type/count field */ +#endif + sim_debug(DEBUG_DETAIL, &ec_dev, - "ec_srv case 3 transmit bytes %d (0x%x) SNS %08x\n", - len-8, len-8, uptr->SNS); + "ec_srv case 3 transmit bytes %d (0x%x) SNS %08x i 0x%x cnt %x\n", + len-8, len-8, uptr->SNS, i, cnt); + + /* This code is to simulate word transfers into memory */ + /* from the users buffer. 1-3 extra bytes are placed */ + /* into the buffer. Diags in test 20 check for this data */ + /* being present. These were set to 0 by the old code */ + /* and diags would complain 11/11/2021 */ + /* save data count */ + dcnt = i - sizeof(struct ec_eth_hdr); /* dest/src/len 14 bytes */ + n = 0; + while (dcnt++ % 4) { + pck[i+n] = RMB(((chp->ccw_addr+n))); + sim_debug(DEBUG_DATA, &ec_dev, "ec_srx i %x data[%3x]: %06x %02x\n", + i, i+n, chp->ccw_addr+n, pck[i+n]); + n++; + } + n = n + i; /* last written char in buffer */ break; } - /* copy in packet data */ - i = sizeof(struct ec_eth_hdr); - while (chan_read_byte(chsa, &ch) == 0) { - if (i < ETH_MAX_PACKET) { - sim_debug(DEBUG_DATA, &ec_dev, "ec_srv data: %06x %02x\n", - chp->ccw_addr, ch); - pck[i] = ch; - } - i++; - uptr->SNS++; /* set count */ - } wr_end: - ec_data.snd_buff.len = i; + ec_data.snd_buff.len = i; /* set actual count */ ec_packet_debug(&ec_data, "send", &ec_data.snd_buff); sim_debug(DEBUG_DETAIL, &ec_dev, - "ec_srv @wr_end counts i %04x SNS %04x\n", i, uptr->SNS); + "ec_srv @wr_end count 0x%x i 0x%04x SNS 0x%04x\n", + chp->ccw_count, i, uptr->SNS); /* make sure packet is minimum size for mode 1,2 & 3 */ + /* when handling non-loopback packets */ if ((ec_data.snd_buff.len < ec_data.conf[9]) && GET_MODE(ec_master_uptr->flags)) { - /* Pad the packet */ - while(i < ETH_MIN_PACKET) { - ec_data.snd_buff.len++; - pck[i++] = 0; + /* If not in loopback, pad packet */ + if (((ec_data.conf[0] & 0x40) == 0) || + /* this fixes test 20 for mode 3 */ + (GET_MODE(ec_master_uptr->flags) != 3)) { + /* Pad the packet */ + while(i < ETH_MIN_PACKET) { + ec_data.snd_buff.len++; /* increment actual count */ + pck[n++] = 0; + i++; + } + } + sim_debug(DEBUG_DETAIL, &ec_dev, + "ec_srv @wr_end2 count 0x%x i 0x%04x n 0x%04x SNS 0x%04x\n", + chp->ccw_count, i, n, uptr->SNS); + if (i <= ETH_MIN_PACKET) { + ec_packet_debug(&ec_data, "send", &ec_data.snd_buff); } } -#ifdef NOTHERE - /* see if too few bytes */ - if (ec_data.snd_buff.len < ec_data.conf[9]) { - sim_debug(DEBUG_DETAIL, &ec_dev, - "ec_srv WRITE error user small packet %d %d\n", chp->ccw_count, ec_data.conf[9]); - /* diags wants prog check instead of unit check */ - pirq = 1; - } -#endif /* see if too many bytes, did not get channel end before packet filled */ if (ec_data.snd_buff.len > ETH_MAX_PACKET) { sim_debug(DEBUG_DETAIL, &ec_dev, @@ -1008,8 +1094,9 @@ wr_end: break; } -/*jb*/ ec_data.tx_count++; - if ((ec_data.conf[0] & 0x40) != 0) { + ec_data.tx_count++; + if (ec_data.conf[0] & 0x40) { /* see if internal loopback */ + /* yes loopback, buffer the packet */ int q = (((ec_data.rec_ptr + 1) & LOOP_MSK) + LOOP_MSK + 1) - ec_data.xtr_ptr; if (q >LOOP_MSK) q -= (LOOP_MSK + 1); @@ -1023,31 +1110,23 @@ wr_end: memcpy(&ec_data.rec_buff[ec_data.rec_ptr], &ec_data.snd_buff, sizeof(ETH_PACK)); ec_data.rec_ptr = (ec_data.rec_ptr + 1) & LOOP_MSK; - sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv write rec queued %d xtr %d queue %04x\n", + sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv WRITE rec queued %d xtr %d queue %04x\n", ec_data.rec_ptr, ec_data.xtr_ptr, q); -//jb ec_data.rx_count++; -//jb ec_data.tx_count++; } } + /* check for internal loopback */ if ((ec_data.conf[0] & 0x40) == 0) { -#ifdef NOTHERE - /* Pad the packet */ - while(i < ETH_MIN_PACKET) { - ec_data.snd_buff.len++; - pck[i++] = 0; - } -#endif + /* no loopback, write out the packet */ if (eth_write(&ec_data.etherface, &ec_data.snd_buff, NULL) != SCPE_OK) { sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv short packet %d\n", i); /* diags wants prog check instead of unit check */ pirq = 1; -//jb ec_data.tx_count++; } } sim_debug(DEBUG_DETAIL, &ec_dev, - "ec_srv sent packet %d bytes tx_count=%08x SNS %08x\n", - ec_data.snd_buff.len, ec_data.tx_count, uptr->SNS); + "ec_srv sent packet pirq %d 0x%x bytes tx_count=%08x SNS %08x\n", + pirq, ec_data.snd_buff.len, ec_data.tx_count, uptr->SNS); if (pirq) chan_end(chsa, SNS_CHNEND|SNS_DEVEND|STATUS_PCHK); @@ -1056,24 +1135,27 @@ wr_end: } break; - case EC_READ: /* Read command 0x02 */ + case EC_READ: /* 0x02 Read command */ /* If no data to receive wait for some more */ if (ec_data.xtr_ptr == ec_data.rec_ptr) { - sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv WAIT %04x read %d %d size=%d cnt %d\n", - chsa, ec_data.xtr_ptr, ec_data.rec_ptr, ec_data.conf[9], chp->ccw_count); -//jb sim_clock_coschedule(uptr, 500); /* continue poll */ -//jb sim_clock_coschedule(uptr, 511); /* continue poll */ - sim_activate(uptr, 511); /* continue poll */ +// sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv WAIT %04x read %d %d size=%d cnt %d\n", +// chsa, ec_data.xtr_ptr, ec_data.rec_ptr, ec_data.conf[9], chp->ccw_count); +//Was Mar sim_clock_coschedule(uptr, 1000); /* continue poll */ +//XX sim_clock_coschedule(uptr, 1500); /* continue poll */ +//HH sim_activate(uptr, 1511); /* continue poll */ + /* this is OK for mode 0, 1, 2, 3 */ + sim_activate(uptr, 2511); /* continue poll */ return SCPE_OK; } /* get queue length */ n = (((ec_data.rec_ptr) & LOOP_MSK) + LOOP_MSK + 1) - ec_data.xtr_ptr; - if (n >LOOP_MSK) + if (n > LOOP_MSK) n -= (LOOP_MSK + 1); pirq = 0; - sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv START %04x read %d %d size=%d cnt %d q %d\n", - chsa, ec_data.xtr_ptr, ec_data.rec_ptr, ec_data.conf[9], chp->ccw_count, n); - uptr->CMD &= LMASK; /* remove old status bits & cmd */ + i = GET_MODE(ec_master_uptr->flags); /* get the mode setting */ + sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv START %04x mode %d read %d %d conf=%d cnt %d q %d\n", + chsa, i, ec_data.xtr_ptr, ec_data.rec_ptr, ec_data.conf[9], chp->ccw_count, n); + uptr->CMD &= LMASK; /* remove old status bits & cnt */ /* Read must be word bounded */ if (chp->ccw_addr & 0x3) { @@ -1092,36 +1174,31 @@ wr_end: pck = (uint8 *)(&ec_data.rec_buff[ec_data.xtr_ptr].msg[0]); len = (int)(ec_data.rec_buff[ec_data.xtr_ptr].len); n = sizeof(struct ec_eth_hdr); -#ifdef NOTHERE - if (len < ec_data.conf[9]) { - sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv READ error short read len %x size %x %x\n", - len, chp->ccw_count, ec_data.conf[9]); - ec_data.xtr_ptr = (ec_data.xtr_ptr + 1) & LOOP_MSK; - chp->ccw_count = 0; - /* diags wants prog check instead of unit check test 4F */ -//jb chan_end(chsa, SNS_CHNEND|SNS_DEVEND|STATUS_PCHK); - chan_end(chsa, SNS_CHNEND|SNS_DEVEND|STATUS_LENGTH); - break; - } -#endif + cnt = len - n; /* number of data bytes */ + sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv READ addr %06x pktlen 0x%x rdcnt 0x%x conf 0x%x\n", + chp->ccw_addr, len, chp->ccw_count, ec_data.conf[9]); + switch (GET_MODE(ec_master_uptr->flags)) { case 0: - /* destination / source / type or len */ - for(i = 0; i < sizeof (struct ec_eth_hdr); i++) { + /* create output: destination(6)/source(6)/type(2) or len(2)/ data 46-1500 */ + /* user buffer: destination(6)/source(6)/type(2) or len)2) */ + for(i = 0; i < sizeof(struct ec_eth_hdr); i++) { if (chan_write_byte(chsa, &pck[i])) { pirq = 1; break; } } - uptr->SNS |= (len & 0xffff); /* set transfer count */ + uptr->SNS |= (len & 0xffff); /* set real transfer count */ sim_debug(DEBUG_DETAIL, &ec_dev, - "ec_srv case 0 received bytes %d (0x%x) SNS %08x\n", - len, len, uptr->SNS); + "ec_srv case 0 received bytes %d (0x%x) SNS %08x i 0x%x cnt 0x%x\n", + len, len, uptr->SNS, i, cnt); break; case 1: case 2: - /* copy destination */ - for(i = 0; i < sizeof (ETH_MAC); i++) { + /* create output: destination(6)/len(2)/source(6)/type(2) or len(2)/ data 46-1500 */ + /* destination / len / source / type or len */ + /* copy 6 byte destination */ + for(i = 0; i < sizeof(ETH_MAC); i++) { if (chan_write_byte(chsa, &pck[i])) { pirq = 1; break; @@ -1139,21 +1216,24 @@ wr_end: pirq = 1; break; } - /* copy in source / type or len */ + /* copy in source(6)/type(2) 6 + 2 = 8 = 14 - 6 */ for(; i < sizeof(struct ec_eth_hdr); i++) { if (chan_write_byte(chsa, &pck[i])) { pirq = 1; break; } + if (i>5) + sim_debug(DEBUG_DATA, &ec_dev, "ec_srr pck[%3x]: %02x\n", i, pck[i]); } - uptr->SNS |= ((len + 2) & 0xffff); /* set transfer count */ + uptr->SNS |= ((len+2) & 0xffff); /* set real transfer count */ sim_debug(DEBUG_DETAIL, &ec_dev, - "ec_srv case 1&2 received bytes %d (0x%x) SNS %08x\n", - len+2, len+2, uptr->SNS); + "ec_srv case 1&2 received bytes %d (0x%x) SNS %08x i 0x%x cnt 0x%x\n", + len, len, uptr->SNS, i, cnt); break; case 3: - /* copy destination */ - for(i = 0; i < sizeof (ETH_MAC); i++) { + /* create output: destination(6)/len(2)/source(6)/len(2)/ data 46-1500 */ + /* copy 6 byte destination */ + for(i = 0; i < sizeof(ETH_MAC); i++) { if (chan_write_byte(chsa, &pck[i])) { pirq = 1; break; @@ -1171,12 +1251,14 @@ wr_end: pirq = 1; break; } - /* copy in source */ - for(; i < sizeof(ETH_MAC) * 2; i++) { + /* copy in 6 byte source */ + for (; i < sizeof(ETH_MAC) * 2; i++) { if (chan_write_byte(chsa, &pck[i])) { pirq = 1; break; } + if (i>5) + sim_debug(DEBUG_DATA, &ec_dev, "ec_srr pck[%3x]: %02x\n", i, pck[i]); } /* insert length byte 1 */ ch = (len >> 8) & 0xff; @@ -1190,42 +1272,57 @@ wr_end: pirq = 1; break; } -//bad n += 2; /* add 2 bytes to header */ - uptr->SNS |= ((len + 4) & 0xffff); /* set transfer count */ + uptr->SNS |= ((len + 2) & 0xffff); /* set real transfer count */ sim_debug(DEBUG_DETAIL, &ec_dev, - "ec_srv case 3 received bytes %d (0x%x) SNS %08x\n", - len+4, len+4, uptr->SNS); + "ec_srv case 3 received bytes %d (0x%x) SNS %08x i 0x%x cnt 0x%x\n", + len, len, uptr->SNS, i, cnt); break; } -// for(i = sizeof(struct ec_eth_hdr); i < len; i++) { - for(i = n; i < len; i++) { + + /* see if user did not request enough data */ + i = sizeof(struct ec_eth_hdr); + if (pirq || (i >= len)) { + ec_data.xtr_ptr = (ec_data.xtr_ptr + 1) & LOOP_MSK; + ec_data.rx_count++; + sim_debug(DEBUG_DETAIL, &ec_dev, + "ec_srv0 pirq %d cnt %x received bytes %d of %d rx_count=%08x conf %x\n", + pirq, cnt, i, len, ec_data.rx_count, ec_data.conf[9]); + /* diag wants incorrect length error */ + chan_end(chsa, SNS_CHNEND|SNS_DEVEND|STATUS_LENGTH); + break; + } + + /* now copy in the user data */ + for (i = sizeof(struct ec_eth_hdr); i < len; i++) { + if (i > (len - 8)) + sim_debug(DEBUG_DETAIL, &ec_dev, "ec_sww pck[%3x]: %02x %02x\n", i, pck[i], chp->ccw_count); if (chan_write_byte(chsa, &pck[i])) { /* we read less than or exact bytes, good to go */ ec_data.xtr_ptr = (ec_data.xtr_ptr + 1) & LOOP_MSK; ec_data.rx_count++; sim_debug(DEBUG_DETAIL, &ec_dev, - "ec_srv received bytes %d of %d rx_count=%08x conf %x\n", - i, len, ec_data.rx_count, ec_data.conf[9]); + "ec_srv1 left 0x%x rec'd 0x%x bytes rx_count %08x conf %02x SNS %08x\n", + chp->ccw_count, len, ec_data.rx_count, ec_data.conf[9], uptr->SNS); + /* diag wants incorrect length error */ chan_end(chsa, SNS_CHNEND|SNS_DEVEND|STATUS_LENGTH); + sim_debug(DEBUG_DETAIL, dptr, + "ec_srv done cmd=%02x chsa %04x addr %06x count %04x SNS 0x%08x stat %04x\n", + cmd, chsa, chp->ccw_addr, chp->ccw_count, uptr->SNS, chp->chan_status); return SCPE_OK; } } /* we have some bytes left, set count mismatch */ chp->ccw_flags |= FLAG_SLI; ec_data.xtr_ptr = (ec_data.xtr_ptr + 1) & LOOP_MSK; -/*jb*/ ec_data.rx_count++; + ec_data.rx_count++; sim_debug(DEBUG_DETAIL, &ec_dev, - "ec_srv received bytes %d (0x%x) rx_count=%08x conf %02x SNS %08x\n", - len, len, ec_data.rx_count, ec_data.conf[9], uptr->SNS); - if (pirq) - /* diag want incorrect length error */ -//jb chan_end(chsa, SNS_CHNEND|SNS_DEVEND|STATUS_PCHK); - chan_end(chsa, SNS_CHNEND|SNS_DEVEND|STATUS_LENGTH); - else - chan_end(chsa, SNS_CHNEND|SNS_DEVEND); + "ec_srv2 left 0x%x rec'd 0x%x bytes rx_count %08x conf %02x SNS %08x\n", + chp->ccw_count, len, ec_data.rx_count, ec_data.conf[9], uptr->SNS); + /* diag does not want incorrect length error */ + chan_end(chsa, SNS_CHNEND|SNS_DEVEND); break; - case EC_LCC: /* Configure LCC 0x10 */ + case EC_LCC: /* 0x10 Configure LCC */ uptr->CMD &= LMASK; /* remove old status bits & cmd */ /* Read up to 12 bytes of configuration data */ for (i = 0; i < 12; i++) { @@ -1241,7 +1338,7 @@ wr_end: chan_end(chsa, SNS_CHNEND|SNS_DEVEND); break; - case EC_STATS: /* Read Statistics */ + case EC_STATS: /* 0x14 Read Statistics */ ch = 0; /* First 5 words are always zero since these errors are not supported */ uptr->CMD &= LMASK; /* remove old status bits & cmd */ @@ -1278,7 +1375,7 @@ wr_end: chan_end(chsa, SNS_CHNEND|SNS_DEVEND); break; - case EC_CSTATS: /* Clear software counters */ + case EC_CSTATS: /* 0x15 Clear software counters */ uptr->CMD &= LMASK; /* remove old status bits & cmd */ ec_data.rx_count = ec_data.tx_count = 0; (void)chan_read_byte(chsa, &ch); @@ -1288,7 +1385,7 @@ wr_end: chan_end(chsa, SNS_CHNEND|SNS_DEVEND); break; - case EC_NOP: /* NOP 0x03 */ + case EC_NOP: /* 0x03 NOP */ uptr->CMD &= LMASK; /* remove old status bits & cmd */ sim_debug(DEBUG_CMD, dptr, "ec_srv cmd NOP chsa %04x count %04x completed\n", @@ -1298,7 +1395,7 @@ wr_end: chan_end(chsa, SNS_CHNEND|SNS_DEVEND); /* return OK */ break; - case EC_SNS: /* 0x4 */ + case EC_SNS: /* 0x04 Sense */ sim_debug(DEBUG_CMD, dptr, "ec_startcmd CMD sense cnt %02x\n", chp->ccw_count); uptr->CMD &= LMASK; /* remove old status bits & cmd */ @@ -1313,7 +1410,6 @@ wr_end: } } -//jb len = ec_data.rec_buff[ec_data.xtr_ptr].len; len = uptr->SNS & 0xffff; sim_debug(DEBUG_DETAIL, &ec_dev, "ec_srv SNS len %d xt %d rd %d\n", len, ec_data.xtr_ptr, ec_data.rec_ptr); @@ -1343,7 +1439,7 @@ wr_end: break; } uptr->SNS &= ~(SNS_CMDREJ|SNS_EQUCHK); /* clear old status */ -/*jb*/ uptr->SNS &= 0xffff0000; /* clear last count */ + uptr->SNS &= 0xffff0000; /* clear last count */ chan_end(chsa, SNS_CHNEND|SNS_DEVEND); /* done */ break; @@ -1354,7 +1450,8 @@ wr_end: chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITCHK); } sim_debug(DEBUG_DETAIL, dptr, - "ec_srv done cmd=%02x chsa %04x count %04x\n", cmd, chsa, chp->ccw_count); + "ec_srv done cmd=%02x chsa %04x count %04x addr %06x flags %04x stat %x SNS 0x%x\n", + cmd, chsa, chp->ccw_count, chp->ccw_addr, chp->ccw_flags, chp->chan_status, uptr->SNS); return SCPE_OK; } @@ -1385,6 +1482,8 @@ t_stat ec_haltio(UNIT *uptr) { "ec_haltio HIO I/O stop chsa %04x cmd = %02x\n", chsa, cmd); /* No unit exception status for ethernet */ chan_end(chsa, SNS_CHNEND|SNS_DEVEND); /* force end */ +// chan_end(chsa, SNS_CHNEND|SNS_DEVEND|STATUS_LENGTH|STATUS_PCHK); +// chan_end(chsa, SNS_CHNEND|SNS_DEVEND|STATUS_LENGTH); return SCPE_IOERR; } uptr->CMD &= LMASK; /* make non-busy */ @@ -1401,7 +1500,6 @@ void ec_ini(UNIT *uptr, t_bool f) uptr->CMD &= LMASK; /* remove old status bits & cmd */ uptr->SNS = 0; /* save mode value */ -// uptr->SNS = SNS_RCV_RDY; /* status is online & ready */ memset(&ec_data.conf[0], 0, sizeof(ec_data.conf)); ec_data.macs_n = 0; ec_data.tx_count = 0; @@ -1432,13 +1530,12 @@ t_stat ec_rsctrl(UNIT *uptr) { sim_debug(DEBUG_EXP, dptr, "ec_rsctlr chsa %04x cmd = %02x\n", chsa, cmd); -// memset(&ec_data.conf[0], 0, sizeof(ec_data.conf)); +// memset(&ec_data.conf[0], 0, sizeof(ec_data.conf)); ec_data.tx_count = 0; ec_data.rx_count = 0; ec_data.drop_cnt = 0; ec_data.rec_ptr = 0; /* clear queue */ ec_data.xtr_ptr = 0; /* clear queue */ -// uptr->SNS = SNS_RCV_RDY; /* status is online & ready */ return SCPE_OK; } @@ -1451,7 +1548,6 @@ t_stat ec_rschnlio(UNIT *uptr) { sim_debug(DEBUG_EXP, dptr, "ec_rschnl chsa %04x cmd = %02x\n", chsa, cmd); ec_ini(uptr, 0); /* reset the unit */ -// uptr->SNS = SNS_RCV_RDY; /* status is online & ready */ /* the interrupt level will be reset in sel32_chan.c code */ return SCPE_OK; } @@ -1576,12 +1672,22 @@ void ec_packet_debug(struct ec_device *ec, const char *action, action, arp_op, eth_dst, eth_src, arp_shwaddr, arp_sipaddr, arp_dhwaddr, arp_dipaddr); return; } +#ifdef OLDWAY if (ntohs(eth->type) != ETHTYPE_IP) { payload = (uint8 *)&packet->msg[0]; len = packet->len; sim_data_trace(&ec_dev, ec_unit, payload, "", len, "", DEBUG_DATA); return; } +#else + /* always dump packet */ + payload = (uint8 *)&packet->msg[0]; + len = packet->len; + sim_data_trace(&ec_dev, ec_unit, payload, "", len, "", DEBUG_DATA); + if (ntohs(eth->type) != ETHTYPE_IP) { + return; + } +#endif if (!(ec_dev.dctrl & (DEBUG_TCP|DEBUG_UDP|DEBUG_ICMP))) return; memcpy(&ipaddr, &ip->ip_src, sizeof(ipaddr)); @@ -1751,8 +1857,7 @@ t_stat ec_attach(UNIT* uptr, CONST char* cptr) eth_setcrc(&ec_data.etherface, 0); /* Enable CRC */ /* init read queue (first time only) */ - status = ethq_init(&ec_data.ReadQ, 8); -//JBstatus = ethq_init(&ec_data.ReadQ, 16); /* try 16 per device */ + status = ethq_init(&ec_data.ReadQ, 8); /* 8 per device */ if (status != SCPE_OK) { eth_close(&ec_data.etherface); uptr->filename = NULL; diff --git a/SEL32/sel32_mt.c b/SEL32/sel32_mt.c index fc2ad1d..9f78d14 100644 --- a/SEL32/sel32_mt.c +++ b/SEL32/sel32_mt.c @@ -39,7 +39,6 @@ #include "sel32_defs.h" #include "sim_tape.h" -//#define SLOW #if NUM_DEVS_MT > 0 #define BUFFSIZE (64 * 1024) @@ -310,7 +309,6 @@ DIB mta_dib = { NULL, /* t_stat (*test_io)(UNIT *uptr) */ /* Test I/O */ NULL, /* t_stat (*rsctl_io)(UNIT *uptr) */ /* Reset Controller */ mt_rschnlio, /* t_stat (*rschnl_io)(UNIT *uptr) */ /* Reset Channel */ -/// mt_iocl, /* t_stat (*iocl_io)(CHANP *chp, int32 tic_ok)) */ /* Process IOCL */ NULL, /* t_stat (*iocl_io)(CHANP *chp, int32 tic_ok)) */ /* Process IOCL */ mt_ini, /* void (*dev_ini)(UNIT *, t_bool) */ /* init function */ mta_unit, /* UNIT* units */ /* Pointer to units structure */ @@ -330,7 +328,6 @@ DEVICE mta_dev = { NULL, NULL, &mt_reset, &mt_boot, &mt_attach, &mt_detach, /* ctxt is the DIB pointer */ &mta_dib, DEV_BUF_NUM(0)|DEV_DIS|DEV_DISABLE|DEV_DEBUG|DEV_TAPE, 0, dev_debug, -// &mta_dib, DEV_BUF_NUM(0)|DEV_DISABLE|DEV_DEBUG|DEV_TAPE, 0, dev_debug, NULL, NULL, &mt_help, NULL, NULL, &mt_description }; @@ -359,7 +356,6 @@ DIB mtb_dib = { NULL, /* t_stat (*test_io)(UNIT *uptr) */ /* Test I/O */ NULL, /* t_stat (*rsctl_io)(UNIT *uptr) */ /* Reset Controller */ mt_rschnlio, /* t_stat (*rschnl_io)(UNIT *uptr) */ /* Reset Channel */ -/// mt_iocl, /* t_stat (*iocl_io)(CHANP *chp, int32 tic_ok)) */ /* Process IOCL */ NULL, /* t_stat (*iocl_io)(CHANP *chp, int32 tic_ok)) */ /* Process IOCL */ mt_ini, /* void (*dev_ini)(UNIT *, t_bool) */ /* init function */ mtb_unit, /* UNIT* units */ /* Pointer to units structure */ @@ -378,7 +374,6 @@ DEVICE mtb_dev = { NUM_UNITS_MT, 8, 15, 1, 8, 8, NULL, NULL, &mt_reset, &mt_boot, &mt_attach, &mt_detach, &mtb_dib, DEV_BUF_NUM(0)|DEV_DIS|DEV_DISABLE|DEV_DEBUG|DEV_TAPE, 0, dev_debug, -// &mtb_dib, DEV_BUF_NUM(1)|DEV_DISABLE|DEV_DEBUG|DEV_TAPE, 0, dev_debug NULL, NULL, &mt_help, NULL, NULL, &mt_description }; #endif @@ -494,7 +489,6 @@ loop: /* 1st command can not be a TIC */ if (chp->ccw_cmd == CMD_TIC) { chp->chan_status |= STATUS_PCHK; /* program check for invalid tic */ -//??// uptr->SNS |= SNS_CMDREJ; /* cmd rejected status */ sim_debug(DEBUG_EXP, dptr, "mt_iocl TIC bad cmd chan_status[%04x] %04x\n", chan, chp->chan_status); @@ -524,7 +518,6 @@ loop: } chp->chan_caw = word1 & MASK24; /* get new IOCD address */ chp->chan_status |= STATUS_PCHK; /* program check for invalid tic */ -//??// uptr->SNS |= SNS_CMDREJ; /* cmd rejected status */ sim_debug(DEBUG_EXP, dptr, "mt_iocl TIC ERROR chan_status[%04x] %04x\n", chan, chp->chan_status); return 1; /* error return */ @@ -546,7 +539,6 @@ loop: } /* Set up for this command */ -//??//chp->ccw_flags = (word2 >> 16) & 0xf800; /* get flags from bits 0-4 of WD 2 of IOCD */ chp->ccw_flags = (word2 >> 16) & 0xfc00; /* get flags from bits 0-4 of WD 2 of IOCD */ chp->chan_status = 0; /* clear status for next IOCD */ /* make a 24 bit address */ @@ -756,7 +748,6 @@ t_stat mt_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) mt_busy[GET_DEV_BUF(dptr->flags)] = 1; /* show we are busy */ sim_debug(DEBUG_EXP, dptr, "mt_startcmd sense %08x return OK chan %04x cmd %02x\n", uptr->SNS, chan, cmd); -//5 sim_activate(uptr, 100); /* Start unit off */ sim_activate(uptr, 20); /* Start unit off */ return SCPE_OK; /* good to go */ @@ -811,7 +802,6 @@ t_stat mt_error(UNIT *uptr, uint16 chsa, t_stat r, DEVICE *dptr) case MTSE_BOT: /* beginning of tape */ uptr->SNS |= SNS_LOAD; /* tape at BOT */ sim_debug(DEBUG_CMD, dptr, "BOT\n"); -//77 chan_end(chsa, SNS_CHNEND|SNS_DEVEND); /* we are done with command */ chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); break; @@ -950,8 +940,6 @@ t_stat mt_srv(UNIT *uptr) case MT_SETM: /* 0x83 */ /* set mode byte */ sim_debug(DEBUG_CMD, dptr, "mt_srv cmd 0x83 SETM unit=%02x\n", unit); -/*DYNAMIC DEBUG*/ -//cpu_dev.dctrl |= DEBUG_INST; /* start instruction trace */ /* Grab data until channel has no more */ if (chan_read_byte(chsa, &ch)) { if (uptr->POS > 0) { /* Only if data in record */ @@ -971,7 +959,6 @@ t_stat mt_srv(UNIT *uptr) sim_debug(DEBUG_CMD, dptr, "Write mode data in unit %02x POS %04x mode %02x\n", unit, uptr->POS, ch); uptr->hwmark = uptr->POS; /* set high water mark */ -//5 sim_activate(uptr, 40); /* wait time */ sim_activate(uptr, 30); /* wait time */ } return SCPE_OK; @@ -993,12 +980,7 @@ t_stat mt_srv(UNIT *uptr) switch (cmd) { case MT_READ: /* 0x02 */ /* read a record from the device */ -// sim_debug(DEBUG_DETAIL, -// dptr, "mt_srv cmd(2)READ unit %02x bufnum %x hwmark %03x\n", -// unit, bufnum, uptr->hwmark); -#ifndef SLOW reread: -#endif if (uptr->CMD & MT_READDONE) { /* is the read complete */ uptr->SNS &= ~(SNS_LOAD|SNS_EOT); /* reset BOT & EOT */ if (sim_tape_eot(uptr)) { /* see if at EOM */ @@ -1046,14 +1028,6 @@ reread: sim_debug(DEBUG_CMD, dptr, "mt_srv READ mem %s\n", bufp); bufp = dump_mem(m+32, 16); sim_debug(DEBUG_CMD, dptr, "mt_srv READ mem %s\n", bufp); - -/*DYNAMIC DEBUG*/ -/* J */ -//if ((chp->ccw_addr == 0x54e00) && (mt_buffer[0][0] == 0x4a)) -//cpu_dev.dctrl |= DEBUG_INST; /* start instruction trace */ - -//if ((chp->ccw_addr == 0x7f96c0) && (mt_buffer[0][0] == 0x80)) -//cpu_dev.dctrl |= DEBUG_INST; /* start instruction trace */ } /* get a char from the buffer */ ch = mt_buffer[bufnum][uptr->POS++]; @@ -1067,9 +1041,7 @@ reread: /* Send dummy character to force SLI */ chan_write_byte(chsa, &ch); /* write the byte */ sim_debug(DEBUG_CMD, dptr, "Read unit %02x send dump SLI\n", unit); -//5 sim_activate(uptr, (uptr->hwmark-uptr->POS) * 10); /* wait again */ sim_activate(uptr, (uptr->hwmark-uptr->POS) * 4); /* wait again */ -//77 sim_activate(uptr, 50); uptr->CMD |= MT_READDONE; /* read is done */ break; } @@ -1095,17 +1067,9 @@ reread: "Read end of data unit %02x cnt %04x ch %02x hwm %04x\n", unit, uptr->POS, ch, uptr->hwmark); uptr->CMD |= MT_READDONE; /* read is done */ -#ifdef SLOW -//5 sim_activate(uptr, 40); /* wait again */ - sim_activate(uptr, 30); /* wait again */ - } else -//5 sim_activate(uptr, 40); /* wait again */ - sim_activate(uptr, 30); /* wait again */ -#else goto reread; } else goto reread; -#endif } break; @@ -1120,9 +1084,7 @@ reread: break; } -#ifndef SLOW rewrite: -#endif /* Grab data until channel has no more */ if (chan_read_byte(chsa, &ch)) { if (uptr->POS > 0) { /* Only if data in record */ @@ -1139,14 +1101,8 @@ rewrite: sim_debug(DEBUG_DATA, dptr, "Write data unit=%02x %04x %02x\n", unit, uptr->POS, ch); uptr->hwmark = uptr->POS; -#ifndef SLOW goto rewrite; -#endif } -//#ifdef SLOW -//5 sim_activate(uptr, 40); -// sim_activate(uptr, 30); /* wait again */ -//#endif break; case MT_RDBK: /* 0x0C */ /* Read Backwards */ @@ -1182,7 +1138,6 @@ rewrite: unit, uptr->POS); /* If not read whole record, skip till end */ if (uptr->POS >= 0) { -//5 sim_activate(uptr, (uptr->POS) * 20); sim_activate(uptr, (uptr->POS) * 10); uptr->CMD |= MT_READDONE; return SCPE_OK; @@ -1198,7 +1153,6 @@ rewrite: mt_busy[bufnum] &= ~1; chan_end(chsa, SNS_CHNEND|SNS_DEVEND); } else -//5 sim_activate(uptr, 40); sim_activate(uptr, 30); } break; @@ -1213,7 +1167,6 @@ rewrite: return SCPE_OK; } uptr->POS ++; -//5 sim_activate(uptr, 500); sim_activate(uptr, 100); } else { sim_debug(DEBUG_CMD, dptr, "Write Mark unit=%02x\n", unit); @@ -1225,7 +1178,6 @@ rewrite: break; case MT_BSR: /* 0x53 */ /* Backspace record */ -//77 chp->ccw_count = 0; /* zero the count */ sim_debug(DEBUG_CMD, dptr, "mt_srv cmd 0x53 BSR unit %02x POS %x SNS %08x\n", unit, uptr->POS, uptr->SNS); switch (uptr->POS ) { @@ -1237,14 +1189,10 @@ rewrite: return SCPE_OK; } uptr->POS++; -//5 sim_activate(uptr, 500); sim_activate(uptr, 30); break; case 1: -//66 skip = 1; /* skip back 1 record */ uptr->POS++; -//77 uptr->SNS &= ~(SNS_LOAD|SNS_EOT|SNS_FMRKDT); /* reset BOT, EOT, EOF */ -//66 r = sim_tape_sprecsr(uptr, skip, &reclen); r = sim_tape_sprecr(uptr, &reclen); sim_debug(DEBUG_CMD, dptr, "Backspace rec unit %02x POS %x r %x\n", unit, uptr->POS, r); @@ -1252,17 +1200,14 @@ rewrite: if (r == MTSE_TMK) { /* test for EOF */ uptr->POS++; sim_debug(DEBUG_CMD, dptr, "BSR got EOF MARK\n"); -//5 sim_activate(uptr, 50); sim_activate(uptr, 30); /* SEL requires Unit Except & BOT on BOT */ } else if (r == MTSE_BOT) { uptr->POS+= 2; sim_debug(DEBUG_CMD, dptr, "BSR got BOT\n"); -//5 sim_activate(uptr, 50); sim_activate(uptr, 30); } else { sim_debug(DEBUG_CMD, dptr, "Backspace reclen %04x SNS %08x\n", reclen, uptr->SNS); -//5 sim_activate(uptr, 50); sim_activate(uptr, 30); } break; @@ -1290,7 +1235,6 @@ rewrite: break; case MT_BSF: /* 0x73 */ /* Backspace file */ -//77 chp->ccw_count = 0; /* zero the count */ sim_debug(DEBUG_CMD, dptr, "mt_srv cmd 0x73 BSF unit %02x POS %04x\n", unit, uptr->POS); switch(uptr->POS) { @@ -1302,7 +1246,6 @@ rewrite: break; } uptr->POS++; -//5 sim_activate(uptr, 500); sim_activate(uptr, 100); break; case 1: @@ -1313,7 +1256,6 @@ rewrite: uptr->SNS &= ~(SNS_LOAD|SNS_EOT|SNS_FMRKDT); /* reset BOT, EOT, EOF */ #ifdef NBSF /* using the backspace file call does not work with MPX */ -//77?? r = sim_tape_spfiler(uptr, skip, &reclen); r = sim_tape_spfiler(uptr, skip, &reclen); uptr->POS++; #else @@ -1323,12 +1265,10 @@ rewrite: if (r == MTSE_TMK) { uptr->POS++; sim_debug(DEBUG_CMD, dptr, "BSF got EOF MARK\n"); -//5 sim_activate(uptr, 50); sim_activate(uptr, 30); } else if (r == MTSE_BOT) { uptr->POS+= 2; sim_debug(DEBUG_CMD, dptr, "BSF got BOT\n"); -//5 sim_activate(uptr, 50); sim_activate(uptr, 30); } else { /* already there */ @@ -1344,8 +1284,6 @@ rewrite: mt_busy[bufnum] &= ~1; sim_debug(DEBUG_CMD, dptr, "Backspace file Completed with NO EOF status\n"); chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); -//00 chan_end(chsa, SNS_CHNEND|SNS_DEVEND); -//88 chan_end(chsa, SNS_CHNEND|SNS_DEVEND); break; #endif #ifdef NBSF @@ -1358,8 +1296,6 @@ rewrite: mt_busy[bufnum] &= ~1; sim_debug(DEBUG_CMD, dptr, "Backspace file Completed with EOF status\n"); chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); -//00 chan_end(chsa, SNS_CHNEND|SNS_DEVEND); -//88 chan_end(chsa, SNS_CHNEND|SNS_DEVEND); break; #ifdef NBSF case 4: /* BOT */ @@ -1370,50 +1306,36 @@ rewrite: mt_busy[bufnum] &= ~1; uptr->SNS |= SNS_LOAD; /* set BOT detected */ sim_debug(DEBUG_CMD, dptr, "Backspace file Completed with BOT status\n"); -#ifdef NBSF chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); -//77?? chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); -#else - chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); -//00 chan_end(chsa, SNS_CHNEND|SNS_DEVEND); -//88 chan_end(chsa, SNS_CHNEND|SNS_DEVEND); -#endif break; } break; case MT_FSR: /* 0x43 */ /* Advance record */ -//77 chp->ccw_count = 0; /* zero the count */ switch(uptr->POS) { case 0: sim_debug(DEBUG_CMD, dptr, "Skip rec entry unit=%02x POS %x\n", unit, uptr->POS); uptr->POS++; -//5 sim_activate(uptr, 500); sim_activate(uptr, 30); break; case 1: -//66 skip = 1; /* skip 1 record */ uptr->POS++; uptr->SNS &= ~(SNS_LOAD|SNS_EOT|SNS_FMRKDT); /* reset BOT, EOT, EOF */ -//66 r = sim_tape_sprecsf(uptr, skip, &reclen); r = sim_tape_sprecf(uptr, &reclen); sim_debug(DEBUG_CMD, dptr, "Skip rec unit=%02x r %x\n", unit, r); if (r == MTSE_TMK) { uptr->POS = 3; uptr->SNS |= SNS_FMRKDT; /* file mark detected */ sim_debug(DEBUG_CMD, dptr, "FSR got EOF MARK\n"); -//5 sim_activate(uptr, 50); sim_activate(uptr, 30); } else if (r == MTSE_EOM) { uptr->POS = 4; uptr->SNS |= SNS_EOT; /* set EOT status */ sim_debug(DEBUG_CMD, dptr, "FSR got EOT\n"); -//5 sim_activate(uptr, 50); sim_activate(uptr, 30); } else { sim_debug(DEBUG_CMD, dptr, "FSR skipped %04x byte record\n", reclen); -//5 sim_activate(uptr, 10 + (10 * reclen)); sim_activate(uptr, 30); } break; @@ -1421,8 +1343,6 @@ rewrite: uptr->CMD &= ~(MT_CMDMSK); mt_busy[bufnum] &= ~1; sim_debug(DEBUG_CMD, dptr, "Skip record Completed\n"); -/*DYNAMIC DEBUG*/ -//cpu_dev.dctrl |= DEBUG_INST; /* start instruction trace */ chan_end(chsa, SNS_CHNEND|SNS_DEVEND); /* we are done dev|chan end */ break; case 3: @@ -1430,51 +1350,42 @@ rewrite: mt_busy[bufnum] &= ~1; sim_debug(DEBUG_CMD, dptr, "Skip record now at EOF\n"); chan_end(chsa, SNS_DEVEND|SNS_UNITEXP); -//77 chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); break; case 4: uptr->CMD &= ~(MT_CMDMSK); mt_busy[bufnum] &= ~1; sim_debug(DEBUG_CMD, dptr, "Skip record now at EOT\n"); chan_end(chsa, SNS_DEVEND|SNS_UNITEXP); -//77 chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); break; } break; case MT_FSF: /* 0x63 */ /* advance filemark */ -//77 chp->ccw_count = 0; /* zero the count */ switch(uptr->POS) { case 0: sim_debug(DEBUG_CMD, dptr, "Skip file entry sense %08x unit %02x\n", uptr->SNS, unit); uptr->POS++; -//5 sim_activate(uptr, 500); sim_activate(uptr, 30); break; case 1: skip = 1; /* skip forward 1 file */ -/*EE*/ uptr->POS++; + uptr->POS++; uptr->SNS &= ~(SNS_LOAD|SNS_EOT|SNS_FMRKDT); /* reset BOT, EOT, EOF */ -//EE r = sim_tape_sprecf(uptr, &reclen); -/*EE*/ r = sim_tape_spfilef(uptr, skip, &reclen); -//77 r = sim_tape_spfilef(uptr, skip, &reclen); + r = sim_tape_spfilef(uptr, skip, &reclen); sim_debug(DEBUG_CMD, dptr, "Skip file unit=%02x r %x\n", unit, r); if (r == MTSE_TMK) { uptr->POS++; uptr->SNS |= SNS_FMRKDT; /* file mark detected */ sim_debug(DEBUG_CMD, dptr, "FSF EOF MARK sense %08x\n", uptr->SNS); -//5 sim_activate(uptr, 50); sim_activate(uptr, 30); } else if (r == MTSE_EOM) { uptr->SNS |= SNS_EOT; /* set EOT status */ sim_debug(DEBUG_CMD, dptr, "FSF EOT sense %08x\n", uptr->SNS); uptr->POS+= 2; -//5 sim_activate(uptr, 50); sim_activate(uptr, 30); } else { sim_debug(DEBUG_CMD, dptr, "FSF skipped %04x file\n", reclen); -//5 sim_activate(uptr, 50); sim_activate(uptr, 30); } break; @@ -1483,27 +1394,21 @@ rewrite: mt_busy[bufnum] &= ~1; sim_debug(DEBUG_CMD, dptr, "Skip file done sense %08x unit %02x\n", uptr->SNS, unit); -//88 chan_end(chsa, SNS_CHNEND|SNS_DEVEND); /* we are done dev|chan end */ -//00 chan_end(chsa, SNS_CHNEND|SNS_DEVEND); /* we are done dev|chan end */ -//EE chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); -/*EE*/ chan_end(chsa, SNS_CHNEND|SNS_DEVEND); /* we are done dev|chan end */ + chan_end(chsa, SNS_CHNEND|SNS_DEVEND); /* we are done dev|chan end */ break; -/*EE*/ case 3: -/*EE*/ uptr->CMD &= ~(MT_CMDMSK); -/*EE*/ mt_busy[bufnum] &= ~1; -/*EE*/ sim_debug(DEBUG_CMD, dptr, -/*EE*/ "Skip file got EOF sense %08x unit %02x\n", uptr->SNS, unit); -/*EE*/ chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); -/*EE*/ break; -//EE case 3: -/*EE*/ case 4: + case 3: + uptr->CMD &= ~(MT_CMDMSK); + mt_busy[bufnum] &= ~1; + sim_debug(DEBUG_CMD, dptr, + "Skip file got EOF sense %08x unit %02x\n", uptr->SNS, unit); + chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); + break; + case 4: uptr->CMD &= ~(MT_CMDMSK); uptr->SNS |= SNS_EOT; /* set EOT status */ mt_busy[bufnum] &= ~1; sim_debug(DEBUG_CMD, dptr, "Skip file got EOT sense %08x unit %02x\n", uptr->SNS, unit); -//88 chan_end(chsa, SNS_DEVEND|SNS_UNITEXP); -//00 chan_end(chsa, SNS_DEVEND|SNS_UNITEXP); chan_end(chsa, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP); break; } @@ -1519,14 +1424,12 @@ rewrite: chan_end(chsa, SNS_DEVEND|SNS_UNITEXP); } else { uptr->POS ++; -//5 sim_activate(uptr, 500); sim_activate(uptr, 50); } break; case 1: sim_debug(DEBUG_CMD, dptr, "Erase unit=%02x\n", unit); r = sim_tape_wrgap(uptr, 35); -//5 sim_activate(uptr, 5000); sim_activate(uptr, 100); uptr->POS++; break; @@ -1544,8 +1447,6 @@ rewrite: uptr->POS++; sim_debug(DEBUG_CMD, dptr, "Start rewind unit %02x\n", unit); sim_activate(uptr, 2500); -//5 sim_activate(uptr, 1500); -//6 sim_activate(uptr, 150); } else { sim_debug(DEBUG_CMD, dptr, "Rewind complete unit %02x\n", unit); uptr->CMD &= ~(MT_CMDMSK); @@ -1561,7 +1462,6 @@ rewrite: uptr->POS++; mt_busy[bufnum] &= ~1; sim_debug(DEBUG_CMD, dptr, "Start rewind/unload unit %02x\n", unit); -//5 sim_activate(uptr, 30000); sim_activate(uptr, 300); } else { sim_debug(DEBUG_CMD, dptr, "Unload unit=%02x\n", unit); diff --git a/SEL32/tests/SetupNet b/SEL32/tests/SetupNet index 76c67de..ef4c308 100755 --- a/SEL32/tests/SetupNet +++ b/SEL32/tests/SetupNet @@ -28,19 +28,48 @@ # OpenBSD 6.7 # NetBSD 9.1 +# CHANGE HISTORY +# 2021/4/8 avoid setting PATH in scripts for root +# 2021/5/31 whereis used without -b in OpenBSD and NetBSD +# Corrected: bridge create and fwdelay done twice for NetBSD +# FreeBSD: tapX opened by userland program not by ifconfig +# 2021/11/17 check for existance of br0 done too lousy. Done better. +# # uncomment next line if you need more than one tap = run multiple SIMHs... #OPSMODE="expert" # ... by editting the saved params file followed by rerun of this script -PATH="/bin:/sbin:/etc:/usr/sbin:/usr/bin" -export PATH - OS=`uname -s` case $OS in "FreeBSD" | "OpenBSD" | "NetBSD") + # List of Utils + LOU="ifconfig brconfig sysctl chown netstat" + + # set $util to path of util for all in $LOU + for U in $LOU + do + # whereis -b in only FreeBSD as in Linux + if test $OS = "FreeBSD" + then + eval ${U}="`whereis -b $U | + awk '{ if($2 != "") + print $2; + else + print "void"; + }'`" + else + eval ${U}="`whereis $U | + awk '{ if($1 != "") + print $1; + else + print "void"; + }'`" + fi + done + # make list of all interfaces ignoring lo - AVL_IF=`ifconfig -a | + AVL_IF=`$ifconfig -a | grep -v '^[ ]' | awk -F: '{ print $1 }' | grep -v 'lo' | @@ -61,41 +90,50 @@ case $OS in ;; "Linux") + # List of Utils + LOU="ip brctl tunctl netstat" + + # set $util to path of util for all in $LOU + for U in $LOU + do + eval ${U}="`whereis -b $U | + awk '{ if($2 != "") + print $2; + else + print "void"; + }'`" + done + + ERR=0 # check brctl to exist - L=`whereis brctl | - awk -F: '{ print $2 }' | - grep brctl | - wc -l` - if test $L -eq 0 + if test $brctl = "void" then echo 'No brctl program -- please install package bridge-utils' + ERR=1 fi # check tunctl to exist - LL=`whereis tunctl | - awk -F: '{ print $2 }' | - grep tunctl | - wc -l` - if test $LL -eq 0 + if test $tunctl = "void" then echo 'No tunctl program -- please install package uml-utilities' + ERR=1 fi # quit when either not installed - if test $L -eq 0 -o $LL -eq 0 + if test $ERR -eq 1 then exit 1 fi # make list of all interfaces ignoring lo - AVL_IF=`ip link show | + AVL_IF=`$ip link show | grep '^[0-9]' | awk -F: '{ print $2 }' | grep -v 'lo' | sed '1,$s/^ //'` # found br0 in active interfaces? - L=`echo $AVL_IF | grep br0 | wc -l` + L=`echo $AVL_IF | tr ' ' '\012' | grep '^br0$' | wc -l` if test $L -ne 0 then echo "$0: br0 already configured." @@ -116,10 +154,10 @@ do N=`expr $N + 1` case $OS in "FreeBSD" | "OpenBSD" | "NetBSD") - IPCMD="ifconfig $I " + IPCMD="$ifconfig $I " ;; "Linux") - IPCMD="ip addr show $I " + IPCMD="$ip addr show $I " ;; esac @@ -192,10 +230,10 @@ if test "x$IPNR" = "x" then case $OS in "FreeBSD" | "OpenBSD" | "NetBSD") - IPCMD="ifconfig $ACT_IF " + IPCMD="$ifconfig $ACT_IF " ;; "Linux") - IPCMD="ip addr show dev $ACT_IF " + IPCMD="$ip addr show dev $ACT_IF " ;; esac @@ -219,11 +257,11 @@ if test "x$IPBRO" = "x" then case $OS in "FreeBSD" | "OpenBSD" | "NetBSD") - IPCMD="ifconfig $ACT_IF " + IPCMD="$ifconfig $ACT_IF " SEDBRO='1s/^.*broadcast //' ;; "Linux") - IPCMD="ip addr show dev $ACT_IF " + IPCMD="$ip addr show dev $ACT_IF " SEDBRO='1s/^.*brd //' ;; esac @@ -240,13 +278,13 @@ if test "x$DEFRT" = "x" then case $OS in "FreeBSD" | "OpenBSD" | "NetBSD") - DEFRT=`netstat -rn | + DEFRT=`$netstat -rn | grep $ACT_IF | grep 'default' | awk '{ print $2 }'` ;; "Linux") - DEFRT=`netstat -rn | + DEFRT=`$netstat -rn | grep $ACT_IF | grep '^0\.' | uniq | @@ -340,8 +378,6 @@ cat - > $JOBFILE <<\EOF # This script should be run under root permission -PATH="/bin:/sbin:/etc:/usr/sbin:/usr/bin" -export PATH EOF cat - > $TMPFILE <<\EOF @@ -357,30 +393,30 @@ EOF case $OS in "Linux") - echo "CMD=\"brctl addbr br0\"" >> $JOBFILE + echo "CMD=\"$brctl addbr br0\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE N=0 while test $N -lt $NrTaps do - echo "CMD=\"tunctl -t tap${N} -u ${SimhUser}\"" >> $JOBFILE + echo "CMD=\"$tunctl -t tap${N} -u ${SimhUser}\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE N=`expr $N + 1` done - echo "CMD=\"brctl addif br0 ${ACT_IF}\"" >> $JOBFILE + echo "CMD=\"$brctl addif br0 ${ACT_IF}\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE - echo "CMD=\"brctl setfd br0 0\"" >> $JOBFILE + echo "CMD=\"$brctl setfd br0 0\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE - echo "CMD=\"ip link set ${ACT_IF} down\"" >> $JOBFILE + echo "CMD=\"$ip link set ${ACT_IF} down\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE if ! test "$IPNR" = "not configured" then - echo "CMD=\"ip addr add ${IPNR} dev br0\"" >> $JOBFILE + echo "CMD=\"$ip addr add ${IPNR} dev br0\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE fi @@ -388,23 +424,23 @@ case $OS in then ## if test ! "x$DEFRT" = "x" ## then - ## echo "CMD=\"ip route del default via ${DEFRT} dev ${ACT_IF}\"" >> $JOBFILE + ## echo "CMD=\"$ip route del default via ${DEFRT} dev ${ACT_IF}\"" >> $JOBFILE ## cat $TMPFILE >> $JOBFILE ## fi - echo "CMD=\"ip addr del ${IPNR} dev ${ACT_IF}\"" >> $JOBFILE + echo "CMD=\"$ip addr del ${IPNR} dev ${ACT_IF}\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE fi - echo "CMD=\"ip link set ${ACT_IF} up\"" >> $JOBFILE + echo "CMD=\"$ip link set ${ACT_IF} up\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE - echo "CMD=\"ip link set br0 up\"" >> $JOBFILE + echo "CMD=\"$ip link set br0 up\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE if test ! "x$DEFRT" = "x" then - echo "CMD=\"ip route add default via ${DEFRT} dev br0\"" >> $JOBFILE + echo "CMD=\"$ip route add default via ${DEFRT} dev br0\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE fi @@ -418,10 +454,10 @@ case $OS in N=0 while test $N -lt $NrTaps do - echo "CMD=\"brctl addif br0 tap${N}\"" >> $JOBFILE + echo "CMD=\"$brctl addif br0 tap${N}\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE - echo "CMD=\"ip link set tap${N} up\"" >> $JOBFILE + echo "CMD=\"$ip link set tap${N} up\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE N=`expr $N + 1` @@ -434,33 +470,30 @@ case $OS in N=0 while test $N -lt $NrTaps do - echo "CMD=\"ifconfig tap${N} create\"" >> $JOBFILE - cat $TMPFILE >> $JOBFILE - - echo "CMD=\"ifconfig tap${N} up\"" >> $JOBFILE + echo "CMD=\"$ifconfig tap${N} create\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE N=`expr $N + 1` done - echo "CMD=\"sysctl net.link.tap.up_on_open=1\"" >> $JOBFILE + echo "CMD=\"$sysctl net.link.tap.up_on_open=1\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE - echo "CMD=\"ifconfig bridge0 create\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 create\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE case $NrTaps in 1 ) - echo "CMD=\"ifconfig bridge0 addm ${ACT_IF} addm tap0\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 addm ${ACT_IF} addm tap0\"" >> $JOBFILE ;; 2 ) - echo "CMD=\"ifconfig bridge0 addm ${ACT_IF} addm tap0 addm tap1\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 addm ${ACT_IF} addm tap0 addm tap1\"" >> $JOBFILE ;; 3 ) - echo "CMD=\"ifconfig bridge0 addm ${ACT_IF} addm tap0 addm tap1 addm tap2\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 addm ${ACT_IF} addm tap0 addm tap1 addm tap2\"" >> $JOBFILE ;; 4 ) - echo "CMD=\"ifconfig bridge0 addm ${ACT_IF} addm tap0 addm tap1 addm tap2 addm tap3\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 addm ${ACT_IF} addm tap0 addm tap1 addm tap2 addm tap3\"" >> $JOBFILE ;; * ) echo "Sorry too many taps..." @@ -468,7 +501,7 @@ case $OS in esac cat $TMPFILE >> $JOBFILE - echo "CMD=\"ifconfig bridge0 up\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 up\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE BRIDGE="bridge0" EXAMPLE="tap:tap0" @@ -477,33 +510,33 @@ case $OS in N=0 while test $N -lt $NrTaps do - echo "CMD=\"ifconfig tap${N} create\"" >> $JOBFILE + echo "CMD=\"$ifconfig tap${N} create\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE - echo "CMD=\"ifconfig tap${N} up\"" >> $JOBFILE + echo "CMD=\"$ifconfig tap${N} up\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE N=`expr $N + 1` done - echo "CMD=\"ifconfig bridge0 create\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 create\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE - echo "CMD=\"ifconfig bridge0 fwddelay 4\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 fwddelay 4\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE case $NrTaps in 1 ) - echo "CMD=\"ifconfig bridge0 add ${ACT_IF} add tap0\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 add ${ACT_IF} add tap0\"" >> $JOBFILE ;; 2 ) - echo "CMD=\"ifconfig bridge0 add ${ACT_IF} add tap0 add tap1\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 add ${ACT_IF} add tap0 add tap1\"" >> $JOBFILE ;; 3 ) - echo "CMD=\"ifconfig bridge0 add ${ACT_IF} add tap0 add tap1 add tap2\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 add ${ACT_IF} add tap0 add tap1 add tap2\"" >> $JOBFILE ;; 4 ) - echo "CMD=\"ifconfig bridge0 add ${ACT_IF} add tap0 add tap1 add tap2 add tap3\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 add ${ACT_IF} add tap0 add tap1 add tap2 add tap3\"" >> $JOBFILE ;; * ) echo "Sorry too many taps..." @@ -511,7 +544,7 @@ case $OS in esac cat $TMPFILE >> $JOBFILE - echo "CMD=\"ifconfig bridge0 up\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 up\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE BRIDGE="bridge0" EXAMPLE="tap:tap0" @@ -520,33 +553,33 @@ case $OS in N=0 while test $N -lt $NrTaps do - echo "CMD=\"ifconfig tap${N} create\"" >> $JOBFILE + echo "CMD=\"$ifconfig tap${N} create\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE - echo "CMD=\"ifconfig tap${N} up\"" >> $JOBFILE + echo "CMD=\"$ifconfig tap${N} up\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE N=`expr $N + 1` done - echo "CMD=\"ifconfig bridge0 create\"" >> $JOBFILE + echo "CMD=\"$ifconfig bridge0 create\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE - echo "CMD=\"brconfig bridge0 fwddelay 1\"" >> $JOBFILE + echo "CMD=\"$brconfig bridge0 fwddelay 1\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE case $NrTaps in 1 ) - echo "CMD=\"brconfig bridge0 add ${ACT_IF} add tap0\"" >> $JOBFILE + echo "CMD=\"$brconfig bridge0 add ${ACT_IF} add tap0\"" >> $JOBFILE ;; 2 ) - echo "CMD=\"brconfig bridge0 add ${ACT_IF} add tap0 add tap1\"" >> $JOBFILE + echo "CMD=\"$brconfig bridge0 add ${ACT_IF} add tap0 add tap1\"" >> $JOBFILE ;; 3 ) - echo "CMD=\"brconfig bridge0 add ${ACT_IF} add tap0 add tap1 add tap2\"" >> $JOBFILE + echo "CMD=\"$brconfig bridge0 add ${ACT_IF} add tap0 add tap1 add tap2\"" >> $JOBFILE ;; 4 ) - echo "CMD=\"brconfig bridge0 add ${ACT_IF} add tap0 add tap1 add tap2 add tap3\"" >> $JOBFILE + echo "CMD=\"$brconfig bridge0 add ${ACT_IF} add tap0 add tap1 add tap2 add tap3\"" >> $JOBFILE ;; * ) echo "Sorry too many taps..." @@ -554,11 +587,7 @@ case $OS in esac cat $TMPFILE >> $JOBFILE - echo "CMD=\"brconfig bridge0 up\"" >> $JOBFILE - cat $TMPFILE >> $JOBFILE - - echo "CMD=\"ifconfig bridge0 create\"" >> $JOBFILE - echo "CMD=\"brconfig bridge0 fwddelay 1\"" >> $JOBFILE + echo "CMD=\"$brconfig bridge0 up\"" >> $JOBFILE cat $TMPFILE >> $JOBFILE BRIDGE="bridge0"