diff --git a/sys/arch/luna68k/stand/boot/autoconf.c b/sys/arch/luna68k/stand/boot/autoconf.c index 607bc52fb646..bdd347a03bff 100644 --- a/sys/arch/luna68k/stand/boot/autoconf.c +++ b/sys/arch/luna68k/stand/boot/autoconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.7 2013/01/22 15:48:40 tsutsui Exp $ */ +/* $NetBSD: autoconf.c,v 1.8 2014/01/03 02:03:12 tsutsui Exp $ */ /* * Copyright (c) 1992 OMRON Corporation. @@ -470,9 +470,6 @@ same_hw_device(struct hp_hw *hw, struct hp_device *hd) case SCSI: found = dr_type(hd->hp_driver, "scsi"); break; - case VME: - case MISC: - break; } return(found); } diff --git a/sys/arch/luna68k/stand/boot/device.h b/sys/arch/luna68k/stand/boot/device.h index 0628774ba0ca..a1ed5d3cf4e7 100644 --- a/sys/arch/luna68k/stand/boot/device.h +++ b/sys/arch/luna68k/stand/boot/device.h @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.5 2013/01/14 12:28:11 tsutsui Exp $ */ +/* $NetBSD: device.h,v 1.6 2014/01/03 02:03:12 tsutsui Exp $ */ /* * Copyright (c) 1992 OMRON Corporation. @@ -98,49 +98,25 @@ struct hp_device { int hp_ipl; }; -struct devqueue { - struct devqueue *dq_forw; - struct devqueue *dq_back; - int dq_ctlr; - int dq_unit; - int dq_slave; - struct driver *dq_driver; -}; - struct hp_hw { uint8_t *hw_addr; /* physical address of registers */ short hw_type; /* type (defined below) */ char *hw_name; /* HP product name */ }; -#define MAX_CTLR 16 /* Totally arbitrary */ -#define MAXSLAVES 8 /* Currently the HPIB limit */ +#define MAX_CTLR 8 /* Totally arbitrary */ +#define MAXSLAVES 8 /* Currently the SCSI limit */ #define WILD_CARD_CTLR 0 /* A controller is a card which can have one or more slaves attached */ #define CONTROLLER 0x10 -#define HPIB 0x16 -#define SCSI 0x17 -#define VME 0x18 -#define FLINK 0x19 +#define SCSI (CONTROLLER | 0) -/* Slaves are devices which attach to controllers, e.g. disks, tapes */ -#define RD 0x2a -#define PPI 0x2b -#define CT 0x2c - -/* These are not controllers, but may have their own HPIB address */ -#define BITMAP 1 -#define NET 2 -#define FPA 4 -#define MISC 5 -#define KEYBOARD 6 -#define COMMDCA 7 -#define COMMDCM 8 -#define COMMDCL 9 -#define PPORT 10 -#define SIO 11 +/* Non-disk device types */ +#define NET 1 +#define KEYBOARD 2 +#define SIO 3 extern struct hp_ctlr hp_cinit[]; extern struct hp_device hp_dinit[]; diff --git a/sys/arch/luna68k/stand/boot/ioconf.c b/sys/arch/luna68k/stand/boot/ioconf.c index 966776bb2803..629267b3ba77 100644 --- a/sys/arch/luna68k/stand/boot/ioconf.c +++ b/sys/arch/luna68k/stand/boot/ioconf.c @@ -1,4 +1,4 @@ -/* $NetBSD: ioconf.c,v 1.3 2013/01/14 01:37:57 tsutsui Exp $ */ +/* $NetBSD: ioconf.c,v 1.4 2014/01/03 02:03:12 tsutsui Exp $ */ /* * Copyright (c) 1992 OMRON Corporation. @@ -74,10 +74,6 @@ #include #include - -#define C (void *) -#define D (struct driver *) - extern struct driver scdriver; extern struct driver sddriver; extern struct driver ledriver; @@ -85,20 +81,20 @@ extern struct driver stdriver; struct hp_ctlr hp_cinit[] = { /* driver, unit, alive, addr, flags */ - { &scdriver, 0, 0, C 0x0, 0x0 }, - { &scdriver, 1, 0, C 0x0, 0x0 }, + { &scdriver, 0, 0, NULL, 0x0 }, + { &scdriver, 1, 0, NULL, 0x0 }, {0}, }; struct hp_device hp_dinit[] = { /*driver, cdriver, unit, ctlr, slave, addr, dk, flags*/ -{ &sddriver, &scdriver, 0, 0, 6, C 0x0, 1, 0x0 }, -{ &sddriver, &scdriver, 1, 0, 5, C 0x0, 1, 0x0 }, -{ &sddriver, &scdriver, 2, 1, 6, C 0x0, 1, 0x0 }, -{ &sddriver, &scdriver, 3, 1, 5, C 0x0, 1, 0x0 }, -{ &ledriver, NULL, 0, 0, 0, C 0x0, 0, 0x0 }, +{ &sddriver, &scdriver, 0, 0, 6, NULL, 1, 0x0 }, +{ &sddriver, &scdriver, 1, 0, 5, NULL, 1, 0x0 }, +{ &sddriver, &scdriver, 2, 1, 6, NULL, 1, 0x0 }, +{ &sddriver, &scdriver, 3, 1, 5, NULL, 1, 0x0 }, +{ &ledriver, NULL, 0, 0, 0, NULL, 0, 0x0 }, #ifdef notyet -{ &stdriver, &scdriver, 0, 0, 4, C 0x0, 0, 0x0 }, +{ &stdriver, &scdriver, 0, 0, 4, NULL, 0, 0x0 }, #endif {0} }; diff --git a/sys/arch/luna68k/stand/boot/sd.c b/sys/arch/luna68k/stand/boot/sd.c index 28255caae613..59db8cac84df 100644 --- a/sys/arch/luna68k/stand/boot/sd.c +++ b/sys/arch/luna68k/stand/boot/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.5 2013/01/22 15:48:40 tsutsui Exp $ */ +/* $NetBSD: sd.c,v 1.6 2014/01/03 02:03:12 tsutsui Exp $ */ /* * Copyright (c) 1992 OMRON Corporation. @@ -89,15 +89,12 @@ struct disklabel sdlabel[NSD]; struct sd_softc { struct hp_device *sc_hd; - struct devqueue sc_dq; - int sc_format_pid; /* process using "format" mode */ short sc_flags; short sc_type; /* drive type */ short sc_punit; /* physical unit (scsi lun) */ u_short sc_bshift; /* convert device blocks to DEV_BSIZE blks */ u_int sc_blks; /* number of blocks on device */ int sc_blksize; /* device block size in bytes */ - u_int sc_wpms; /* average xfer rate in 16 bit wds/sec. */ }; struct sd_devdata { @@ -120,7 +117,6 @@ struct sd_devdata sd_devdata[NSD]; #define sdunit(x) ((minor(x) >> 3) & 0x7) #define sdpart(x) (minor(x) & 0x7) -#define sdpunit(x) ((x) & 7) static struct scsi_inquiry inqbuf; static struct scsi_fmt_cdb inq = { @@ -210,7 +206,6 @@ sdident(struct sd_softc *sc, struct hp_device *hd) ++sc->sc_bshift; sc->sc_blks <<= sc->sc_bshift; } - sc->sc_wpms = 32 * (60 * DEV_BSIZE / 2); /* XXX */ return(inqbuf.type); } @@ -228,7 +223,7 @@ sdinit(void *arg) hd->hp_ctlr, hd->hp_slave); #endif sc->sc_hd = hd; - sc->sc_punit = sdpunit(hd->hp_flags); + sc->sc_punit = 0; /* XXX no LUN support yet */ sc->sc_type = sdident(sc, hd); if (sc->sc_type < 0) return(0); diff --git a/sys/arch/luna68k/stand/boot/sio.c b/sys/arch/luna68k/stand/boot/sio.c index cb641e8d1d14..df87db73ac24 100644 --- a/sys/arch/luna68k/stand/boot/sio.c +++ b/sys/arch/luna68k/stand/boot/sio.c @@ -1,4 +1,4 @@ -/* $NetBSD: sio.c,v 1.3 2013/01/21 11:58:12 tsutsui Exp $ */ +/* $NetBSD: sio.c,v 1.4 2014/01/03 02:03:12 tsutsui Exp $ */ /* * Copyright (c) 1992 OMRON Corporation. @@ -87,12 +87,6 @@ struct rcvbuf rcvbuf[NSIO]; int sioconsole = -1; struct siodevice *sio_addr[2]; -int cur_unit; - - -#define siounit(x) ( x & 0xffff ) -#define isprint(c) ((c >= 0x20) && (c < 0x7F) ? 1 : 0) - void _siointr(void) @@ -106,7 +100,9 @@ _siointr(void) void siointr(int unit) { -/* struct siodevice *sio = sio_addr[unit]; */ +#if 0 + struct siodevice *sio = sio_addr[unit]; +#endif int rr0 = sioreg(REG(unit, RR0), 0); int rr1 = sioreg(REG(unit, RR1), 0); @@ -114,8 +110,10 @@ siointr(int unit) if (rr1 & RR1_FRAMING) return; - if (rr1 & (RR1_PARITY | RR1_OVERRUN)) - sioreg(REG(unit, WR0), WR0_ERRRST); /* Channel-A Error Reset */ + if (rr1 & (RR1_PARITY | RR1_OVERRUN)) { + /* Channel-A Error Reset */ + sioreg(REG(unit, WR0), WR0_ERRRST); + } if (unit == 1) { int c = kbd_decode(sio_addr[unit]->sio_data); @@ -137,8 +135,8 @@ siointr(int unit) void siocnprobe(struct consdev *cp) { - sio_addr[0] = (struct siodevice *) 0x51000000; - sio_addr[1] = (struct siodevice *) 0x51000004; + sio_addr[0] = (struct siodevice *)0x51000000; + sio_addr[1] = (struct siodevice *)0x51000004; /* make sure hardware exists */ if (badaddr((short *)sio_addr[0])) { @@ -149,14 +147,14 @@ siocnprobe(struct consdev *cp) /* locate the major number */ /* initialize required fields */ - cp->cn_dev = cur_unit = 0; + cp->cn_dev = 0; cp->cn_pri = CN_NORMAL; } void siocninit(struct consdev *cp) { - int unit = siounit(cp->cn_dev); + int unit = cp->cn_dev; sioinit(); sioconsole = unit; @@ -165,36 +163,38 @@ siocninit(struct consdev *cp) int siocngetc(dev_t dev) { - int c, unit = siounit(dev); + int c, unit = dev; if (RBUF_EMPTY(unit)) return 0; POP_RBUF(unit, c); - return(c); + return c; } void siocnputc(dev_t dev, int c) { - int unit = siounit(dev); + int unit = dev; int s; if (sioconsole == -1) { - (void) sioinit(); + (void)sioinit(); sioconsole = unit; } s = splsio(); /* wait for any pending transmission to finish */ - while ((sioreg(REG(unit, RR0), 0) & RR0_TXEMPTY) == 0); + while ((sioreg(REG(unit, RR0), 0) & RR0_TXEMPTY) == 0) + continue; sio_addr[unit]->sio_data = (c & 0xFF); /* wait for any pending transmission to finish */ - while ((sioreg(REG(unit, RR0), 0) & RR0_TXEMPTY) == 0); + while ((sioreg(REG(unit, RR0), 0) & RR0_TXEMPTY) == 0) + continue; splx(s); } @@ -211,26 +211,42 @@ sioinit(void) s = splsio(); - sioreg(REG(0, WR0), WR0_CHANRST); /* Channel-A Reset */ + /* Channel-A Reset */ + sioreg(REG(0, WR0), WR0_CHANRST); - sioreg(WR2A, WR2_VEC86 | WR2_INTR_1); /* Set CPU BUS Interface Mode */ - sioreg(WR2B, 0); /* Set Interrupt Vector */ + /* Set CPU BUS Interface Mode */ + sioreg(WR2A, WR2_VEC86 | WR2_INTR_1); + /* Set Interrupt Vector */ + sioreg(WR2B, 0); - sioreg(REG(0, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ - sioreg(REG(0, WR4), WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY); /* Tx/Rx */ - sioreg(REG(0, WR3), WR3_RX8BIT | WR3_RXENBL); /* Rx */ - sioreg(REG(0, WR5), WR5_TX8BIT | WR5_TXENBL | WR5_DTR | WR5_RTS); /* Tx */ - sioreg(REG(0, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ - sioreg(REG(0, WR1), WR1_RXALLS); /* Interrupted All Char. */ + /* Reset E/S Interrupt */ + sioreg(REG(0, WR0), WR0_RSTINT); + /* Tx/Rx */ + sioreg(REG(0, WR4), WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY); + /* Rx */ + sioreg(REG(0, WR3), WR3_RX8BIT | WR3_RXENBL); + /* Tx */ + sioreg(REG(0, WR5), WR5_TX8BIT | WR5_TXENBL | WR5_DTR | WR5_RTS); + /* Reset E/S Interrupt */ + sioreg(REG(0, WR0), WR0_RSTINT); + /* Interrupted All Char. */ + sioreg(REG(0, WR1), WR1_RXALLS); - sioreg(REG(1, WR0), WR0_CHANRST); /* Channel-A Reset */ + /* Channel-A Reset */ + sioreg(REG(1, WR0), WR0_CHANRST); - sioreg(REG(1, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ - sioreg(REG(1, WR4), WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY); /* Tx/Rx */ - sioreg(REG(1, WR3), WR3_RX8BIT | WR3_RXENBL); /* Rx */ - sioreg(REG(1, WR5), WR5_TX8BIT | WR5_TXENBL); /* Tx */ - sioreg(REG(1, WR0), WR0_RSTINT); /* Reset E/S Interrupt */ - sioreg(REG(1, WR1), WR1_RXALLS); /* Interrupted All Char. */ + /* Reset E/S Interrupt */ + sioreg(REG(1, WR0), WR0_RSTINT); + /* Tx/Rx */ + sioreg(REG(1, WR4), WR4_BAUD96 | WR4_STOP1 | WR4_NPARITY); + /* Rx */ + sioreg(REG(1, WR3), WR3_RX8BIT | WR3_RXENBL); + /* Tx */ + sioreg(REG(1, WR5), WR5_TX8BIT | WR5_TXENBL); + /* Reset E/S Interrupt */ + sioreg(REG(1, WR0), WR0_RSTINT); + /* Interrupted All Char. */ + sioreg(REG(1, WR1), WR1_RXALLS); splx(s); } @@ -244,12 +260,12 @@ sioreg(int reg, int val) if (isStatusReg(reg)) { if (REGNO(reg) != 0) - sio_addr[chan]->sio_cmd = REGNO(reg); - return(sio_addr[chan]->sio_stat); + sio_addr[chan]->sio_cmd = REGNO(reg); + return sio_addr[chan]->sio_stat; } else { if (REGNO(reg) != 0) - sio_addr[chan]->sio_cmd = REGNO(reg); + sio_addr[chan]->sio_cmd = REGNO(reg); sio_addr[chan]->sio_cmd = val; - return(val); + return val; } }