summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/eisa/if_ep_eisa.c30
-rw-r--r--sys/dev/ic/com.c70
-rw-r--r--sys/dev/ic/elink3.c222
-rw-r--r--sys/dev/ic/elink3reg.h6
-rw-r--r--sys/dev/ic/elink3var.h8
-rw-r--r--sys/dev/isa/ad1848.c28
-rw-r--r--sys/dev/isa/ad1848var.h6
-rw-r--r--sys/dev/isa/ahareg.h12
-rw-r--r--sys/dev/isa/aic6360.c47
-rw-r--r--sys/dev/isa/bt.c8
-rw-r--r--sys/dev/isa/btreg.h14
-rw-r--r--sys/dev/isa/com.c70
-rw-r--r--sys/dev/isa/elink.c76
-rw-r--r--sys/dev/isa/elink.h6
-rw-r--r--sys/dev/isa/gus.c111
-rw-r--r--sys/dev/isa/ics2101.c8
-rw-r--r--sys/dev/isa/if_ed.c98
-rw-r--r--sys/dev/isa/if_el.c10
-rw-r--r--sys/dev/isa/if_ep_isa.c158
-rw-r--r--sys/dev/isa/if_ie.c94
-rw-r--r--sys/dev/isa/if_levar.h19
-rw-r--r--sys/dev/isa/isa.c5
-rw-r--r--sys/dev/isa/isadma.c4
-rw-r--r--sys/dev/isa/lpt.c51
-rw-r--r--sys/dev/isa/mcd.c45
-rw-r--r--sys/dev/isa/pas.c13
-rw-r--r--sys/dev/isa/pcmcia_pcic.c3
-rw-r--r--sys/dev/isa/pss.c98
-rw-r--r--sys/dev/isa/sb.c5
-rw-r--r--sys/dev/isa/sbdsp.c32
-rw-r--r--sys/dev/isa/sbdspvar.h8
-rw-r--r--sys/dev/isa/seagate.c10
-rw-r--r--sys/dev/isa/ultra14f.c29
-rw-r--r--sys/dev/isa/wd.c84
-rw-r--r--sys/dev/isa/wds.c20
-rw-r--r--sys/dev/isa/wss.c13
-rw-r--r--sys/dev/isa/wt.c48
-rw-r--r--sys/dev/microcode/aic7xxx/aic7xxx_asm.c29
-rw-r--r--sys/dev/pci/if_de.c10
-rw-r--r--sys/dev/pci/if_ep_pci.c26
-rw-r--r--sys/dev/pci/ncr.c24
-rw-r--r--sys/dev/pci/pci.c7
-rw-r--r--sys/dev/pci/ppb.c5
43 files changed, 1007 insertions, 663 deletions
diff --git a/sys/dev/eisa/if_ep_eisa.c b/sys/dev/eisa/if_ep_eisa.c
index 2145d35ebc9..8ca2de48c67 100644
--- a/sys/dev/eisa/if_ep_eisa.c
+++ b/sys/dev/eisa/if_ep_eisa.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ep_eisa.c,v 1.1 1996/04/25 02:16:40 thorpej Exp $ */
+/* $NetBSD: if_ep_eisa.c,v 1.3 1996/05/03 19:07:18 christos Exp $ */
/*
* Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
@@ -33,6 +33,7 @@
#include "bpfilter.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
@@ -60,7 +61,7 @@
#endif
#include <machine/cpu.h>
-#include <machine/pio.h>
+#include <machine/bus.h>
#include <dev/ic/elink3var.h>
#include <dev/ic/elink3reg.h>
@@ -87,7 +88,6 @@ ep_eisa_match(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct eisa_attach_args *ea = aux;
/* must match one of our known ID strings */
@@ -106,31 +106,39 @@ ep_eisa_attach(parent, self, aux)
{
struct ep_softc *sc = (void *)self;
struct eisa_attach_args *ea = aux;
- int iobase, irq, k;
+ bus_chipset_tag_t bc = ea->ea_bc;
+ bus_io_handle_t ioh;
+ int irq, k;
u_short conn = 0;
eisa_chipset_tag_t ec = ea->ea_ec;
eisa_intr_handle_t ih;
const char *model, *intrstr;
- sc->ep_iobase = iobase = EISA_SLOT_ADDR(ea->ea_slot);
+ /* Map i/o space. */
+ if (bus_io_map(bc, EISA_SLOT_ADDR(ea->ea_slot), EISA_SLOT_SIZE,
+ &ioh))
+ panic("ep_eisa_attach: can't map i/o space");
+
sc->bustype = EP_BUS_EISA;
+ sc->sc_ioh = ioh;
+ sc->sc_bc = bc;
/* Reset card. */
- outb(iobase + EISA_CONTROL, EISA_ENABLE | EISA_RESET);
+ bus_io_write_1(bc, ioh, EISA_CONTROL, EISA_ENABLE | EISA_RESET);
delay(10);
- outb(iobase + EISA_CONTROL, EISA_ENABLE);
+ bus_io_write_1(bc, ioh, EISA_CONTROL, EISA_ENABLE);
/* Wait for reset? */
delay(1000);
- /* XXX What is this doing?! */
- k = inw(iobase + EP_W0_ADDRESS_CFG);
+ /* XXX What is this doing?! Reading the i/o address? */
+ k = bus_io_read_2(bc, ioh, EP_W0_ADDRESS_CFG);
k = (k & 0x1f) * 0x10 + 0x200;
/* Read the IRQ from the card. */
- irq = inw(iobase + EP_W0_RESOURCE_CFG) >> 12;
+ irq = bus_io_read_2(bc, ioh, EP_W0_RESOURCE_CFG) >> 12;
GO_WINDOW(0);
- conn = inw(iobase + EP_W0_CONFIG_CTRL);
+ conn = bus_io_read_2(bc, ioh, EP_W0_CONFIG_CTRL);
if (strcmp(ea->ea_idstring, "TCM5091") == 0)
model = EISA_PRODUCT_TCM5091;
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c
index 5570f7ef424..112b40fad55 100644
--- a/sys/dev/ic/com.c
+++ b/sys/dev/ic/com.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: com.c,v 1.12 1996/04/29 14:16:15 hvozda Exp $ */
-/* $NetBSD: com.c,v 1.79 1996/04/15 18:54:31 cgd Exp $ */
+/* $OpenBSD: com.c,v 1.13 1996/05/07 07:36:25 deraadt Exp $ */
+/* $NetBSD: com.c,v 1.80 1996/04/29 20:03:00 christos Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996
@@ -75,6 +75,7 @@
#include "com.h"
+
#define COM_IBUFSIZE (2 * 512)
#define COM_IHIGHWATER ((3 * COM_IBUFSIZE) / 4)
@@ -121,15 +122,25 @@ struct com_softc {
#ifdef COM_HAYESP
int comprobeHAYESP __P((bus_io_handle_t hayespioh, struct com_softc *sc));
#endif
-int comopen __P((dev_t, int, int, struct proc *));
-int comclose __P((dev_t, int, int, struct proc *));
-void comdiag __P((void *));
-int comintr __P((void *));
-void compoll __P((void *));
-int comparam __P((struct tty *, struct termios *));
-void comstart __P((struct tty *));
-void com_absent_notify __P((struct com_softc *sc));
-void comstart_pending __P((void *arg));
+void comdiag __P((void *));
+int comspeed __P((long));
+int comparam __P((struct tty *, struct termios *));
+void comstart __P((struct tty *));
+int comintr __P((void *));
+void compoll __P((void *));
+
+/* XXX: These belong elsewhere */
+cdev_decl(com);
+bdev_decl(com);
+
+struct consdev;
+void comcnprobe __P((struct consdev *));
+void comcninit __P((struct consdev *));
+int comcngetc __P((dev_t));
+void comcnputc __P((dev_t, int));
+void comcnpollc __P((dev_t, int));
+
+static u_char tiocm_xxx2mcr __P((int));
/*
* XXX the following two cfattach structs should be different, and possibly
@@ -155,7 +166,7 @@ struct cfdriver com_cd = {
NULL, "com", DV_TTY
};
-int cominit __P((bus_chipset_tag_t, bus_io_handle_t, int));
+void cominit __P((bus_chipset_tag_t, bus_io_handle_t, int));
#ifndef CONSPEED
#define CONSPEED B9600
@@ -194,20 +205,18 @@ extern int kgdb_debug_init;
#if NCOM_PCMCIA
#include <dev/pcmcia/pcmciavar.h>
-int com_pcmcia_match __P((struct device *, void *, void *));
-void com_pcmcia_attach __P((struct device *, struct device *, void *));
-int com_pcmcia_detach __P((struct device *));
+int com_pcmcia_match __P((struct device *, void *, void *));
+void com_pcmcia_attach __P((struct device *, struct device *, void *));
+int com_pcmcia_detach __P((struct device *));
struct cfattach com_pcmcia_ca = {
sizeof(struct com_softc), com_pcmcia_match, comattach,
com_pcmcia_detach
};
-int
-com_pcmcia_mod __P((struct pcmcia_link *pc_link,
- struct device *self,
- struct pcmcia_conf *pc_cf,
- struct cfdata *cf));
+int com_pcmcia_mod __P((struct pcmcia_link *pc_link, struct device *self,
+ struct pcmcia_conf *pc_cf, struct cfdata *cf));
+void com_absent_notify __P((struct com_softc *sc));
/* additional setup needed for pcmcia devices */
/* modify config entry */
@@ -507,7 +516,6 @@ comprobe(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
int iobase, needioh;
@@ -537,6 +545,7 @@ comprobe(parent, match, aux)
#endif
#if NCOM_COMMULTI
if (1) {
+ struct cfdata *cf = match;
struct commulti_attach_args *ca = aux;
if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != ca->ca_slave)
@@ -580,11 +589,9 @@ comattach(parent, self, aux)
void *aux;
{
struct com_softc *sc = (void *)self;
- struct cfdata *cf = sc->sc_dev.dv_cfdata;
int iobase, irq;
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
- struct tty *tp;
#ifdef COM_HAYESP
int hayesp_ports[] = { 0x140, 0x180, 0x280, 0x300, 0 };
int *hayespp;
@@ -715,7 +722,7 @@ comattach(parent, self, aux)
if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
kgdb_dev = -1; /* can't debug over console port */
else {
- (void) cominit(bc, ioh, kgdb_rate);
+ cominit(bc, ioh, kgdb_rate);
if (kgdb_debug_init) {
/*
* Print prefix of device name,
@@ -1342,9 +1349,10 @@ stopped:
/*
* Stop output on a line.
*/
-void
+int
comstop(tp, flag)
struct tty *tp;
+ int flag;
{
int s;
@@ -1353,6 +1361,7 @@ comstop(tp, flag)
if (!ISSET(tp->t_state, TS_TTSTOP))
SET(tp->t_state, TS_FLUSH);
splx(s);
+ return 0;
}
void
@@ -1607,14 +1616,11 @@ void
comcnprobe(cp)
struct consdev *cp;
{
- bus_chipset_tag_t bc;
+ /* XXX NEEDS TO BE FIXED XXX */
+ bus_chipset_tag_t bc = 0;
bus_io_handle_t ioh;
int found;
-#if 0
- XXX NEEDS TO BE FIXED XXX
- bc = ???;
-#endif
if (bus_io_map(bc, CONADDR, COM_NPORTS, &ioh)) {
cp->cn_pri = CN_DEAD;
return;
@@ -1657,6 +1663,7 @@ comcninit(cp)
comconsinit = 0;
}
+void
cominit(bc, ioh, rate)
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
@@ -1676,6 +1683,7 @@ cominit(bc, ioh, rate)
splx(s);
}
+int
comcngetc(dev)
dev_t dev;
{
@@ -1710,7 +1718,7 @@ comcnputc(dev, c)
if (dev != kgdb_dev)
#endif
if (comconsinit == 0) {
- (void) cominit(bc, ioh, comdefaultrate);
+ cominit(bc, ioh, comdefaultrate);
comconsinit = 1;
}
/* wait for any pending transmission to finish */
diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c
index 36ef54701b3..fa99384c50a 100644
--- a/sys/dev/ic/elink3.c
+++ b/sys/dev/ic/elink3.c
@@ -1,4 +1,4 @@
-/* $NetBSD: elink3.c,v 1.1 1996/04/25 02:17:34 thorpej Exp $ */
+/* $NetBSD: elink3.c,v 1.4 1996/05/03 19:08:47 christos Exp $ */
/*
* Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
@@ -33,6 +33,7 @@
#include "bpfilter.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
@@ -61,7 +62,7 @@
#endif
#include <machine/cpu.h>
-#include <machine/pio.h>
+#include <machine/bus.h>
#include <dev/ic/elink3var.h>
#include <dev/ic/elink3reg.h>
@@ -74,7 +75,7 @@ struct cfdriver ep_cd = {
NULL, "ep", DV_IFNET
};
-static void epxstat __P((struct ep_softc *));
+static void eptxstat __P((struct ep_softc *));
static int epstatus __P((struct ep_softc *));
void epinit __P((struct ep_softc *));
int epioctl __P((struct ifnet *, u_long, caddr_t));
@@ -83,12 +84,10 @@ void epwatchdog __P((int));
void epreset __P((struct ep_softc *));
void epread __P((struct ep_softc *));
struct mbuf *epget __P((struct ep_softc *, int));
-void epmbuffill __P((struct ep_softc *));
+void epmbuffill __P((void *));
void epmbufempty __P((struct ep_softc *));
-void epstop __P((struct ep_softc *));
void epsetfilter __P((struct ep_softc *));
void epsetlink __P((struct ep_softc *));
-u_short epreadeeprom __P((int id_port, int offset));
static int epbusyeeprom __P((struct ep_softc *));
@@ -97,6 +96,8 @@ epconfig(sc, conn)
struct ep_softc *sc;
u_int conn;
{
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
u_short i;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
@@ -128,10 +129,10 @@ epconfig(sc, conn)
u_short x;
if (epbusyeeprom(sc))
return;
- outw(BASE + EP_W0_EEPROM_COMMAND, READ_EEPROM | i);
+ bus_io_write_2(bc, ioh, EP_W0_EEPROM_COMMAND, READ_EEPROM | i);
if (epbusyeeprom(sc))
return;
- x = inw(BASE + EP_W0_EEPROM_DATA);
+ x = bus_io_read_2(bc, ioh, EP_W0_EEPROM_DATA);
sc->sc_arpcom.ac_enaddr[(i << 1)] = x >> 8;
sc->sc_arpcom.ac_enaddr[(i << 1) + 1] = x;
}
@@ -166,40 +167,43 @@ epinit(sc)
register struct ep_softc *sc;
{
register struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
int i;
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS)
+ while (bus_io_read_2(bc, ioh, EP_STATUS) & S_COMMAND_IN_PROGRESS)
;
if (sc->bustype != EP_BUS_PCI) {
GO_WINDOW(0);
- outw(BASE + EP_W0_CONFIG_CTRL, 0);
- outw(BASE + EP_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ);
+ bus_io_write_2(bc, ioh, EP_W0_CONFIG_CTRL, 0);
+ bus_io_write_2(bc, ioh, EP_W0_CONFIG_CTRL, ENABLE_DRQ_IRQ);
}
if (sc->bustype == EP_BUS_PCMCIA) {
#ifdef EP_COAX_DEFAULT
- outw(BASE + EP_W0_ADDRESS_CFG,3<<14);
+ bus_io_write_2(bc, ioh, EP_W0_ADDRESS_CFG,3<<14);
#else
- outw(BASE + EP_W0_ADDRESS_CFG,0<<14);
+ bus_io_write_2(bc, ioh, EP_W0_ADDRESS_CFG,0<<14);
#endif
- outw(BASE + EP_W0_RESOURCE_CFG, 0x3f00);
+ bus_io_write_2(bc, ioh, EP_W0_RESOURCE_CFG, 0x3f00);
}
GO_WINDOW(2);
for (i = 0; i < 6; i++) /* Reload the ether_addr. */
- outb(BASE + EP_W2_ADDR_0 + i, sc->sc_arpcom.ac_enaddr[i]);
+ bus_io_write_1(bc, ioh, EP_W2_ADDR_0 + i,
+ sc->sc_arpcom.ac_enaddr[i]);
- outw(BASE + EP_COMMAND, RX_RESET);
- outw(BASE + EP_COMMAND, TX_RESET);
+ bus_io_write_2(bc, ioh, EP_COMMAND, RX_RESET);
+ bus_io_write_2(bc, ioh, EP_COMMAND, TX_RESET);
GO_WINDOW(1); /* Window 1 is operating window */
for (i = 0; i < 31; i++)
- inb(BASE + EP_W1_TX_STATUS);
+ bus_io_read_1(bc, ioh, EP_W1_TX_STATUS);
- outw(BASE + EP_COMMAND, SET_RD_0_MASK | S_CARD_FAILURE |
+ bus_io_write_2(bc, ioh, EP_COMMAND, SET_RD_0_MASK | S_CARD_FAILURE |
S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
- outw(BASE + EP_COMMAND, SET_INTR_MASK | S_CARD_FAILURE |
+ bus_io_write_2(bc, ioh, EP_COMMAND, SET_INTR_MASK | S_CARD_FAILURE |
S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
/*
@@ -208,13 +212,13 @@ epinit(sc)
* already be queued. However, a single stray interrupt is
* unimportant.
*/
- outw(BASE + EP_COMMAND, ACK_INTR | 0xff);
+ bus_io_write_2(bc, ioh, EP_COMMAND, ACK_INTR | 0xff);
epsetfilter(sc);
epsetlink(sc);
- outw(BASE + EP_COMMAND, RX_ENABLE);
- outw(BASE + EP_COMMAND, TX_ENABLE);
+ bus_io_write_2(bc, ioh, EP_COMMAND, RX_ENABLE);
+ bus_io_write_2(bc, ioh, EP_COMMAND, TX_ENABLE);
epmbuffill(sc);
@@ -233,7 +237,7 @@ epsetfilter(sc)
register struct ifnet *ifp = &sc->sc_arpcom.ac_if;
GO_WINDOW(1); /* Window 1 is operating window */
- outw(BASE + EP_COMMAND, SET_RX_FILTER |
+ bus_io_write_2(sc->sc_bc, sc->sc_ioh, EP_COMMAND, SET_RX_FILTER |
FIL_INDIVIDUAL | FIL_BRDCST |
((ifp->if_flags & IFF_MULTICAST) ? FIL_MULTICAST : 0 ) |
((ifp->if_flags & IFF_PROMISC) ? FIL_PROMISC : 0 ));
@@ -244,6 +248,8 @@ epsetlink(sc)
register struct ep_softc *sc;
{
register struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
/*
* you can `ifconfig (link0|-link0) ep0' to get the following
@@ -254,26 +260,27 @@ epsetlink(sc)
* set too, then you get the UTP port.
*/
GO_WINDOW(4);
- outw(BASE + EP_W4_MEDIA_TYPE, DISABLE_UTP);
+ bus_io_write_2(bc, ioh, EP_W4_MEDIA_TYPE, DISABLE_UTP);
if (!(ifp->if_flags & IFF_LINK0) && (sc->ep_connectors & BNC)) {
if (sc->bustype == EP_BUS_PCMCIA) {
GO_WINDOW(0);
- outw(BASE + EP_W0_ADDRESS_CFG,3<<14);
+ bus_io_write_2(bc, ioh, EP_W0_ADDRESS_CFG,3<<14);
GO_WINDOW(1);
}
- outw(BASE + EP_COMMAND, START_TRANSCEIVER);
+ bus_io_write_2(bc, ioh, EP_COMMAND, START_TRANSCEIVER);
delay(1000);
}
if (ifp->if_flags & IFF_LINK0) {
- outw(BASE + EP_COMMAND, STOP_TRANSCEIVER);
+ bus_io_write_2(bc, ioh, EP_COMMAND, STOP_TRANSCEIVER);
delay(1000);
if ((ifp->if_flags & IFF_LINK1) && (sc->ep_connectors & UTP)) {
if (sc->bustype == EP_BUS_PCMCIA) {
GO_WINDOW(0);
- outw(BASE + EP_W0_ADDRESS_CFG,0<<14);
+ bus_io_write_2(bc, ioh,
+ EP_W0_ADDRESS_CFG,0<<14);
GO_WINDOW(4);
}
- outw(BASE + EP_W4_MEDIA_TYPE, ENABLE_UTP);
+ bus_io_write_2(bc, ioh, EP_W4_MEDIA_TYPE, ENABLE_UTP);
}
}
GO_WINDOW(1);
@@ -288,6 +295,8 @@ epstart(ifp)
struct ifnet *ifp;
{
register struct ep_softc *sc = ep_cd.cd_devs[ifp->if_unit];
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
struct mbuf *m, *m0;
int sh, len, pad;
@@ -321,20 +330,22 @@ startagain:
goto readcheck;
}
- if (inw(BASE + EP_W1_FREE_TX) < len + pad + 4) {
- outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | (len + pad + 4));
+ if (bus_io_read_2(bc, ioh, EP_W1_FREE_TX) < len + pad + 4) {
+ bus_io_write_2(bc, ioh, EP_COMMAND,
+ SET_TX_AVAIL_THRESH | (len + pad + 4));
/* not enough room in FIFO */
ifp->if_flags |= IFF_OACTIVE;
return;
} else {
- outw(BASE + EP_COMMAND, SET_TX_AVAIL_THRESH | 2044);
+ bus_io_write_2(bc, ioh, EP_COMMAND,
+ SET_TX_AVAIL_THRESH | 2044);
}
IF_DEQUEUE(&ifp->if_snd, m0);
if (m0 == 0) /* not really needed */
return;
- outw(BASE + EP_COMMAND, SET_TX_START_THRESH |
+ bus_io_write_2(bc, ioh, EP_COMMAND, SET_TX_START_THRESH |
(len / 4 + sc->tx_start_thresh));
#if NBPFILTER > 0
@@ -348,43 +359,47 @@ startagain:
*/
sh = splhigh();
- outw(BASE + EP_W1_TX_PIO_WR_1, len);
- outw(BASE + EP_W1_TX_PIO_WR_1, 0xffff); /* Second dword meaningless */
+ bus_io_write_2(bc, ioh, EP_W1_TX_PIO_WR_1, len);
+ bus_io_write_2(bc, ioh, EP_W1_TX_PIO_WR_1,
+ 0xffff); /* Second dword meaningless */
if (EP_IS_BUS_32(sc->bustype)) {
for (m = m0; m; ) {
if (m->m_len > 3)
- outsl(BASE + EP_W1_TX_PIO_WR_1,
- mtod(m, caddr_t), m->m_len / 4);
+ bus_io_write_multi_4(bc, ioh,
+ EP_W1_TX_PIO_WR_1, mtod(m, u_int32_t *),
+ m->m_len / 4);
if (m->m_len & 3)
- outsb(BASE + EP_W1_TX_PIO_WR_1,
- mtod(m, caddr_t) + (m->m_len & ~3),
- m->m_len & 3);
+ bus_io_write_multi_1(bc, ioh,
+ EP_W1_TX_PIO_WR_1,
+ mtod(m, u_int8_t *) + (m->m_len & ~3),
+ m->m_len & 3);
MFREE(m, m0);
m = m0;
}
} else {
for (m = m0; m; ) {
if (m->m_len > 1)
- outsw(BASE + EP_W1_TX_PIO_WR_1,
- mtod(m, caddr_t), m->m_len / 2);
+ bus_io_write_multi_2(bc, ioh,
+ EP_W1_TX_PIO_WR_1, mtod(m, u_int16_t *),
+ m->m_len / 2);
if (m->m_len & 1)
- outb(BASE + EP_W1_TX_PIO_WR_1,
- *(mtod(m, caddr_t) + m->m_len - 1));
+ bus_io_write_1(bc, ioh, EP_W1_TX_PIO_WR_1,
+ *(mtod(m, u_int8_t *) + m->m_len - 1));
MFREE(m, m0);
m = m0;
}
}
while (pad--)
- outb(BASE + EP_W1_TX_PIO_WR_1, 0);
+ bus_io_write_1(bc, ioh, EP_W1_TX_PIO_WR_1, 0);
splx(sh);
++ifp->if_opackets;
readcheck:
- if ((inw(BASE + EP_W1_RX_STATUS) & ERR_INCOMPLETE) == 0) {
+ if ((bus_io_read_2(bc, ioh, EP_W1_RX_STATUS) & ERR_INCOMPLETE) == 0) {
/* We received a complete packet. */
- u_short status = inw(BASE + EP_STATUS);
+ u_short status = bus_io_read_2(bc, ioh, EP_STATUS);
if ((status & S_INTR_LATCH) == 0) {
/*
@@ -423,13 +438,15 @@ static int
epstatus(sc)
register struct ep_softc *sc;
{
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
u_short fifost;
/*
* Check the FIFO status and act accordingly
*/
GO_WINDOW(4);
- fifost = inw(BASE + EP_W4_FIFO_DIAG);
+ fifost = bus_io_read_2(bc, ioh, EP_W4_FIFO_DIAG);
GO_WINDOW(1);
if (fifost & FIFOS_RX_UNDERRUN) {
@@ -466,14 +483,16 @@ static void
eptxstat(sc)
register struct ep_softc *sc;
{
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
int i;
/*
* We need to read+write TX_STATUS until we get a 0 status
* in order to turn off the interrupt flag.
*/
- while ((i = inb(BASE + EP_W1_TX_STATUS)) & TXS_COMPLETE) {
- outb(BASE + EP_W1_TX_STATUS, 0x0);
+ while ((i = bus_io_read_1(bc, ioh, EP_W1_TX_STATUS)) & TXS_COMPLETE) {
+ bus_io_write_1(bc, ioh, EP_W1_TX_STATUS, 0x0);
if (i & TXS_JABBER) {
++sc->sc_arpcom.ac_if.if_oerrors;
@@ -494,11 +513,10 @@ eptxstat(sc)
epreset(sc);
} else if (i & TXS_MAX_COLLISION) {
++sc->sc_arpcom.ac_if.if_collisions;
- outw(BASE + EP_COMMAND, TX_ENABLE);
+ bus_io_write_2(bc, ioh, EP_COMMAND, TX_ENABLE);
sc->sc_arpcom.ac_if.if_flags &= ~IFF_OACTIVE;
} else
sc->tx_succ_ok = (sc->tx_succ_ok+1) & 127;
-
}
}
@@ -507,14 +525,16 @@ epintr(arg)
void *arg;
{
register struct ep_softc *sc = arg;
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
u_short status;
int ret = 0;
for (;;) {
- outw(BASE + EP_COMMAND, C_INTR_LATCH);
+ bus_io_write_2(bc, ioh, EP_COMMAND, C_INTR_LATCH);
- status = inw(BASE + EP_STATUS);
+ status = bus_io_read_2(bc, ioh, EP_STATUS);
if ((status & (S_TX_COMPLETE | S_TX_AVAIL |
S_RX_COMPLETE | S_CARD_FAILURE)) == 0)
@@ -528,7 +548,7 @@ epintr(arg)
* Due to the i386 interrupt queueing, we may get spurious
* interrupts occasionally.
*/
- outw(BASE + EP_COMMAND, ACK_INTR | status);
+ bus_io_write_2(bc, ioh, EP_COMMAND, ACK_INTR | status);
if (status & S_RX_COMPLETE)
epread(sc);
@@ -556,12 +576,14 @@ void
epread(sc)
register struct ep_softc *sc;
{
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *m;
struct ether_header *eh;
int len;
- len = inw(BASE + EP_W1_RX_STATUS);
+ len = bus_io_read_2(bc, ioh, EP_W1_RX_STATUS);
again:
if (ifp->if_flags & IFF_DEBUG) {
@@ -653,7 +675,7 @@ again:
* I'll modify epread() so that it can handle RX_EARLY interrupts.
*/
if (epstatus(sc)) {
- len = inw(BASE + EP_W1_RX_STATUS);
+ len = bus_io_read_2(bc, ioh, EP_W1_RX_STATUS);
/* Check if we are stuck and reset [see XXX comment] */
if (len & ERR_INCOMPLETE) {
if (ifp->if_flags & IFF_DEBUG)
@@ -668,8 +690,8 @@ again:
return;
abort:
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS)
+ bus_io_write_2(bc, ioh, EP_COMMAND, RX_DISCARD_TOP_PACK);
+ while (bus_io_read_2(bc, ioh, EP_STATUS) & S_COMMAND_IN_PROGRESS)
;
}
@@ -678,6 +700,8 @@ epget(sc, totlen)
struct ep_softc *sc;
int totlen;
{
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct mbuf *top, **mp, *m;
int len;
@@ -736,19 +760,22 @@ epget(sc, totlen)
if (EP_IS_BUS_32(sc->bustype)) {
if (len > 3) {
len &= ~3;
- insl(BASE + EP_W1_RX_PIO_RD_1,
- mtod(m, caddr_t), len / 4);
+ bus_io_read_multi_4(bc, ioh,
+ EP_W1_RX_PIO_RD_1, mtod(m, u_int32_t *),
+ len / 4);
} else
- insb(BASE + EP_W1_RX_PIO_RD_1,
- mtod(m, caddr_t), len);
+ bus_io_read_multi_1(bc, ioh,
+ EP_W1_RX_PIO_RD_1, mtod(m, u_int8_t *),
+ len);
} else {
if (len > 1) {
len &= ~1;
- insw(BASE + EP_W1_RX_PIO_RD_1,
- mtod(m, caddr_t), len / 2);
+ bus_io_read_multi_2(bc, ioh,
+ EP_W1_RX_PIO_RD_1, mtod(m, u_int16_t *),
+ len / 2);
} else
- *(mtod(m, caddr_t)) =
- inb(BASE + EP_W1_RX_PIO_RD_1);
+ *(mtod(m, u_int8_t *)) =
+ bus_io_read_1(bc, ioh, EP_W1_RX_PIO_RD_1);
}
m->m_len = len;
totlen -= len;
@@ -756,8 +783,8 @@ epget(sc, totlen)
mp = &m->m_next;
}
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS)
+ bus_io_write_2(bc, ioh, EP_COMMAND, RX_DISCARD_TOP_PACK);
+ while (bus_io_read_2(bc, ioh, EP_STATUS) & S_COMMAND_IN_PROGRESS)
;
splx(sh);
@@ -778,7 +805,7 @@ epioctl(ifp, cmd, data)
s = splnet();
- if ((error = ether_ioctl(ifp, sc->sc_arpcom, cmd, data)) > 0) {
+ if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) {
splx(s);
return error;
}
@@ -881,19 +908,21 @@ void
epstop(sc)
register struct ep_softc *sc;
{
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
- outw(BASE + EP_COMMAND, RX_DISABLE);
- outw(BASE + EP_COMMAND, RX_DISCARD_TOP_PACK);
- while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS)
+ bus_io_write_2(bc, ioh, EP_COMMAND, RX_DISABLE);
+ bus_io_write_2(bc, ioh, EP_COMMAND, RX_DISCARD_TOP_PACK);
+ while (bus_io_read_2(bc, ioh, EP_STATUS) & S_COMMAND_IN_PROGRESS)
;
- outw(BASE + EP_COMMAND, TX_DISABLE);
- outw(BASE + EP_COMMAND, STOP_TRANSCEIVER);
- outw(BASE + EP_COMMAND, RX_RESET);
- outw(BASE + EP_COMMAND, TX_RESET);
- outw(BASE + EP_COMMAND, C_INTR_LATCH);
- outw(BASE + EP_COMMAND, SET_RD_0_MASK);
- outw(BASE + EP_COMMAND, SET_INTR_MASK);
- outw(BASE + EP_COMMAND, SET_RX_FILTER);
+ bus_io_write_2(bc, ioh, EP_COMMAND, TX_DISABLE);
+ bus_io_write_2(bc, ioh, EP_COMMAND, STOP_TRANSCEIVER);
+ bus_io_write_2(bc, ioh, EP_COMMAND, RX_RESET);
+ bus_io_write_2(bc, ioh, EP_COMMAND, TX_RESET);
+ bus_io_write_2(bc, ioh, EP_COMMAND, C_INTR_LATCH);
+ bus_io_write_2(bc, ioh, EP_COMMAND, SET_RD_0_MASK);
+ bus_io_write_2(bc, ioh, EP_COMMAND, SET_INTR_MASK);
+ bus_io_write_2(bc, ioh, EP_COMMAND, SET_RX_FILTER);
epmbufempty(sc);
}
@@ -909,20 +938,24 @@ epstop(sc)
* each card compares the data on the bus; if there is a difference
* then that card goes into ID_WAIT state again). In the meantime;
* one bit of data is returned in the AX register which is conveniently
- * returned to us by inb(). Hence; we read 16 times getting one
+ * returned to us by bus_io_read_1(). Hence; we read 16 times getting one
* bit of data with each read.
+ *
+ * NOTE: the caller must provide an i/o handle for ELINK_ID_PORT!
*/
-u_short
-epreadeeprom(id_port, offset)
- int id_port;
- int offset;
+u_int16_t
+epreadeeprom(bc, ioh, offset)
+ bus_chipset_tag_t bc;
+ bus_io_handle_t ioh;
+ int offset;
{
- int i, data = 0;
+ u_int16_t data = 0;
+ int i;
- outb(id_port, 0x80 + offset);
+ bus_io_write_1(bc, ioh, 0, 0x80 + offset);
delay(1000);
for (i = 0; i < 16; i++)
- data = (data << 1) | (inw(id_port) & 1);
+ data = (data << 1) | (bus_io_read_2(bc, ioh, 0) & 1);
return (data);
}
@@ -930,6 +963,8 @@ static int
epbusyeeprom(sc)
struct ep_softc *sc;
{
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
int i = 100, j;
if (sc->bustype == EP_BUS_PCMCIA) {
@@ -938,7 +973,7 @@ epbusyeeprom(sc)
}
while (i--) {
- j = inw(BASE + EP_W0_EEPROM_COMMAND);
+ j = bus_io_read_2(bc, ioh, EP_W0_EEPROM_COMMAND);
if (j & EEPROM_BUSY)
delay(100);
else
@@ -958,9 +993,10 @@ epbusyeeprom(sc)
}
void
-epmbuffill(sc)
- struct ep_softc *sc;
+epmbuffill(v)
+ void *v;
{
+ struct ep_softc *sc = v;
int s, i;
s = splnet();
diff --git a/sys/dev/ic/elink3reg.h b/sys/dev/ic/elink3reg.h
index a125013030e..721ee04f163 100644
--- a/sys/dev/ic/elink3reg.h
+++ b/sys/dev/ic/elink3reg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: elink3reg.h,v 1.1 1996/04/25 02:17:35 thorpej Exp $ */
+/* $NetBSD: elink3reg.h,v 1.2 1996/04/30 22:32:39 thorpej Exp $ */
/*
* Copyright (c) 1995 Herb Peyerl <hpeyerl@novatel.ca>
@@ -318,8 +318,8 @@
#define ENABLE_DRQ_IRQ 0x0001
#define MFG_ID 0x506d /* `TCM' */
#define PROD_ID 0x5090
-#define BASE sc->ep_iobase
-#define GO_WINDOW(x) outw(BASE+EP_COMMAND, WINDOW_SELECT|x)
+#define GO_WINDOW(x) bus_io_write_2(sc->sc_bc, \
+ sc->sc_ioh, EP_COMMAND, WINDOW_SELECT|x)
#define AUI 0x1
#define BNC 0x2
#define UTP 0x4
diff --git a/sys/dev/ic/elink3var.h b/sys/dev/ic/elink3var.h
index a048a44c2a7..534c68d8c66 100644
--- a/sys/dev/ic/elink3var.h
+++ b/sys/dev/ic/elink3var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: elink3var.h,v 1.1 1996/04/25 02:17:36 thorpej Exp $ */
+/* $NetBSD: elink3var.h,v 1.3 1996/05/03 19:08:48 christos Exp $ */
/*
* Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
@@ -38,7 +38,8 @@ struct ep_softc {
void *sc_ih;
struct arpcom sc_arpcom; /* Ethernet common part */
- int ep_iobase; /* i/o bus address */
+ bus_chipset_tag_t sc_bc; /* bus cookie */
+ bus_io_handle_t sc_ioh; /* bus i/o handle */
char ep_connectors; /* Connectors on this card. */
#define MAX_MBS 8 /* # of mbufs we keep around */
struct mbuf *mb[MAX_MBS]; /* spare mbuf storage. */
@@ -60,6 +61,7 @@ struct ep_softc {
#define EP_ABSENT 0x02
};
-u_short epreadeeprom __P((int id_port, int offset));
+u_int16_t epreadeeprom __P((bus_chipset_tag_t, bus_io_handle_t, int));
void epconfig __P((struct ep_softc *, u_int));
int epintr __P((void *));
+void epstop __P((struct ep_softc *));
diff --git a/sys/dev/isa/ad1848.c b/sys/dev/isa/ad1848.c
index af1e2e2d2f7..916eabd557b 100644
--- a/sys/dev/isa/ad1848.c
+++ b/sys/dev/isa/ad1848.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ad1848.c,v 1.4 1996/04/18 23:47:28 niklas Exp $ */
-/* $NetBSD: ad1848.c,v 1.9 1996/03/01 04:08:24 mycroft Exp $ */
+/* $OpenBSD: ad1848.c,v 1.5 1996/05/07 07:35:55 deraadt Exp $ */
+/* $NetBSD: ad1848.c,v 1.10 1996/04/29 20:02:32 christos Exp $ */
/*
* Copyright (c) 1994 John Brezak
@@ -149,11 +149,16 @@ static int ad1848_init_values[] = {
};
-int ad1848_probe();
-void ad1848_attach();
-
void ad1848_reset __P((struct ad1848_softc *));
int ad1848_set_speed __P((struct ad1848_softc *, int));
+int ad1848_set_format __P((struct ad1848_softc *, int, int));
+void ad1848_mute_monitor __P((void *, int));
+
+static int ad_read __P((struct ad1848_softc *, int));
+static __inline void ad_write __P((struct ad1848_softc *, int, int));
+static void ad_set_MCE __P((struct ad1848_softc *, int));
+static void wait_for_calibration __P((struct ad1848_softc *));
+
static int
ad_read(sc, reg)
@@ -169,7 +174,7 @@ ad_read(sc, reg)
return x;
}
-static __inline__ void
+static __inline void
ad_write(sc, reg, data)
struct ad1848_softc *sc;
int reg;
@@ -469,7 +474,6 @@ void
ad1848_attach(sc)
struct ad1848_softc *sc;
{
- register int iobase = sc->sc_iobase;
int i;
struct ad1848_volume vol_mid = {150, 150};
struct ad1848_volume vol_0 = {0, 0};
@@ -652,7 +656,6 @@ ad1848_set_mic_gain(sc, gp)
struct ad1848_volume *gp;
{
u_char reg;
- u_int atten;
DPRINTF(("cs4231_set_mic_gain: %d\n", gp->left));
@@ -1050,7 +1053,6 @@ ad1848_set_channels(addr, chans)
int chans;
{
register struct ad1848_softc *sc = addr;
- int mode;
DPRINTF(("ad1848_set_channels: %d\n", chans));
@@ -1296,7 +1298,9 @@ void
ad1848_reset(sc)
register struct ad1848_softc *sc;
{
+#if 0
u_char r;
+#endif
DPRINTF(("ad1848_reset\n"));
@@ -1502,11 +1506,10 @@ ad1848_dma_input(addr, p, cc, intr, arg)
void *addr;
void *p;
int cc;
- void (*intr)();
+ void (*intr) __P((void *));
void *arg;
{
register struct ad1848_softc *sc = addr;
- register int iobase;
register u_char reg;
if (sc->sc_locked) {
@@ -1557,11 +1560,10 @@ ad1848_dma_output(addr, p, cc, intr, arg)
void *addr;
void *p;
int cc;
- void (*intr)();
+ void (*intr) __P((void *));
void *arg;
{
register struct ad1848_softc *sc = addr;
- register int iobase;
register u_char reg;
if (sc->sc_locked) {
diff --git a/sys/dev/isa/ad1848var.h b/sys/dev/isa/ad1848var.h
index cee085d899c..30ce614cf42 100644
--- a/sys/dev/isa/ad1848var.h
+++ b/sys/dev/isa/ad1848var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ad1848var.h,v 1.7 1995/11/10 04:30:40 mycroft Exp $ */
+/* $NetBSD: ad1848var.h,v 1.8 1996/04/29 20:02:37 christos Exp $ */
/*
* Copyright (c) 1994 John Brezak
@@ -124,8 +124,8 @@ int ad1848_get_channels __P((void *));
int ad1848_round_blocksize __P((void *, int));
-int ad1848_dma_output __P((void *, void *, int, void (*)(), void*));
-int ad1848_dma_input __P((void *, void *, int, void (*)(), void*));
+int ad1848_dma_output __P((void *, void *, int, void (*)(void *), void*));
+int ad1848_dma_input __P((void *, void *, int, void (*)(void *), void*));
int ad1848_commit_settings __P((void *));
diff --git a/sys/dev/isa/ahareg.h b/sys/dev/isa/ahareg.h
index 6173f89354a..53df2eabfba 100644
--- a/sys/dev/isa/ahareg.h
+++ b/sys/dev/isa/ahareg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahareg.h,v 1.2 1996/04/22 20:03:04 hannken Exp $ */
+/* $OpenBSD: ahareg.h,v 1.3 1996/05/07 07:36:05 deraadt Exp $ */
typedef u_int8_t physaddr[3];
typedef u_int8_t physlen[3];
#define ltophys _lto3b
@@ -40,10 +40,12 @@ typedef u_int8_t physlen[3];
#define AHA_START_SCSI 0x02 /* start scsi command */
#define AHA_INQUIRE_REVISION 0x04 /* Adapter Inquiry */
#define AHA_MBO_INTR_EN 0x05 /* Enable MBO available interrupt */
-/*#define AHA_SEL_TIMEOUT_SET 0x06 /* set selection time-out */
-/*#define AHA_BUS_ON_TIME_SET 0x07 /* set bus-on time */
-/*#define AHA_BUS_OFF_TIME_SET 0x08 /* set bus-off time */
-/*#define AHA_SPEED_SET 0x09 /* set transfer speed */
+#if 0
+#define AHA_SEL_TIMEOUT_SET 0x06 /* set selection time-out */
+#define AHA_BUS_ON_TIME_SET 0x07 /* set bus-on time */
+#define AHA_BUS_OFF_TIME_SET 0x08 /* set bus-off time */
+#define AHA_SPEED_SET 0x09 /* set transfer speed */
+#endif
#define AHA_INQUIRE_DEVICES 0x0a /* return installed devices 0-7 */
#define AHA_INQUIRE_CONFIG 0x0b /* return configuration data */
#define AHA_TARGET_EN 0x0c /* enable target mode */
diff --git a/sys/dev/isa/aic6360.c b/sys/dev/isa/aic6360.c
index f88a484ea62..5f29e589674 100644
--- a/sys/dev/isa/aic6360.c
+++ b/sys/dev/isa/aic6360.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: aic6360.c,v 1.7 1996/04/21 22:22:39 deraadt Exp $ */
-/* $NetBSD: aic6360.c,v 1.44 1996/04/11 22:28:08 cgd Exp $ */
+/* $OpenBSD: aic6360.c,v 1.8 1996/05/07 07:36:09 deraadt Exp $ */
+/* $NetBSD: aic6360.c,v 1.45 1996/04/29 20:02:45 christos Exp $ */
#define integrate static inline
@@ -454,7 +454,9 @@ struct aic_acb {
u_char target_stat; /* SCSI status byte */
-/* struct aic_dma_seg dma[AIC_NSEG]; /* Physical addresses+len */
+#ifdef notdef
+ struct aic_dma_seg dma[AIC_NSEG]; /* Physical addresses+len */
+#endif
TAILQ_ENTRY(aic_acb) chain;
struct scsi_xfer *xs; /* SCSI xfer ctrl block from above */
@@ -560,7 +562,7 @@ struct aic_softc {
#define AIC_SHOWTRACE 0x10
#define AIC_SHOWSTART 0x20
#define AIC_DOBREAK 0x40
-int aic_debug = 0x00; /* AIC_SHOWSTART|AIC_SHOWMISC|AIC_SHOWTRACE; /**/
+int aic_debug = 0x00; /* AIC_SHOWSTART|AIC_SHOWMISC|AIC_SHOWTRACE; */
#define AIC_PRINT(b, s) do {if ((aic_debug & (b)) != 0) printf s;} while (0)
#define AIC_BREAK() do {if ((aic_debug & AIC_DOBREAK) != 0) Debugger();} while (0)
#define AIC_ASSERT(x) do {if (x) {} else {printf("%s at line %d: assertion failed\n", sc->sc_dev.dv_xname, __LINE__); Debugger();}} while (0)
@@ -595,10 +597,21 @@ int aic_find __P((struct aic_softc *));
void aic_sched __P((struct aic_softc *));
void aic_scsi_reset __P((struct aic_softc *));
void aic_reset __P((struct aic_softc *));
+void aic_free_acb __P((struct aic_softc *, struct aic_acb *, int));
+struct aic_acb* aic_get_acb __P((struct aic_softc *, int));
+int aic_reselect __P((struct aic_softc *, int));
+void aic_sense __P((struct aic_softc *, struct aic_acb *));
+void aic_msgin __P((struct aic_softc *));
+void aic_abort __P((struct aic_softc *, struct aic_acb *));
+void aic_msgout __P((struct aic_softc *));
+int aic_dataout_pio __P((struct aic_softc *, u_char *, int));
+int aic_datain_pio __P((struct aic_softc *, u_char *, int));
#if AIC_DEBUG
-void aic_print_active_acb();
-void aic_dump_driver();
-void aic_dump6360();
+void aic_print_acb __P((struct aic_acb *));
+void aic_dump_driver __P((struct aic_softc *));
+void aic_dump6360 __P((struct aic_softc *));
+void aic_show_scsi_cmd __P((struct aic_acb *));
+void aic_print_active_acb __P((void));
#endif
struct cfattach aic_ca = {
@@ -638,7 +651,6 @@ aicprobe(parent, match, aux)
{
struct aic_softc *sc = match;
struct isa_attach_args *ia = aux;
- int i, len, ic;
#ifdef NEWCONFIG
if (ia->ia_iobase == IOBASEUNK)
@@ -683,7 +695,6 @@ aic_find(sc)
{
int iobase = sc->sc_iobase;
char chip_id[sizeof(IDSTRING)]; /* For chips that support it */
- char *start;
int i;
/* Remove aic6360 from possible powerdown mode */
@@ -874,7 +885,7 @@ aic_init(sc)
untimeout(aic_timeout, acb);
aic_done(sc, acb);
}
- while (acb = sc->nexus_list.tqh_first) {
+ while ((acb = sc->nexus_list.tqh_first) != NULL) {
acb->xs->error = XS_DRIVER_STUFFUP;
untimeout(aic_timeout, acb);
aic_done(sc, acb);
@@ -1136,7 +1147,7 @@ aic_select(sc, acb)
int
aic_reselect(sc, message)
struct aic_softc *sc;
- u_char message;
+ int message;
{
u_char selid, target, lun;
struct aic_acb *acb;
@@ -1625,9 +1636,11 @@ nextbyte:
aic_sched_msgout(sc, SEND_DEV_RESET);
break;
+#ifdef notdef
abort:
aic_sched_msgout(sc, SEND_ABORT);
break;
+#endif
}
outb(iobase + SXFRCTL0, CHEN | SPIOEN);
@@ -1652,7 +1665,9 @@ aic_msgout(sc)
register struct aic_softc *sc;
{
int iobase = sc->sc_iobase;
+#if AIC_USE_SYNCHRONOUS
struct aic_tinfo *ti;
+#endif
u_char sstat1;
int n;
@@ -1844,7 +1859,7 @@ aic_dataout_pio(sc, p, n)
int n;
{
int iobase = sc->sc_iobase;
- register u_char dmastat;
+ register u_char dmastat = 0;
int out = 0;
#define DOUTAMOUNT 128 /* Full FIFO */
@@ -2527,9 +2542,9 @@ aic_print_acb(acb)
struct aic_acb *acb;
{
- printf("acb@%x xs=%x flags=%x", acb, acb->xs, acb->flags);
- printf(" dp=%x dleft=%d target_stat=%x\n",
- (long)acb->data_addr, acb->data_length, acb->target_stat);
+ printf("acb@%p xs=%p flags=%x", acb, acb->xs, acb->flags);
+ printf(" dp=%p dleft=%d target_stat=%x\n",
+ acb->data_addr, acb->data_length, acb->target_stat);
aic_show_scsi_cmd(acb);
}
@@ -2579,7 +2594,7 @@ aic_dump_driver(sc)
struct aic_tinfo *ti;
int i;
- printf("nexus=%x prevphase=%x\n", sc->sc_nexus, sc->sc_prevphase);
+ printf("nexus=%p prevphase=%x\n", sc->sc_nexus, sc->sc_prevphase);
printf("state=%x msgin=%x msgpriq=%x msgoutq=%x lastmsg=%x currmsg=%x\n",
sc->sc_state, sc->sc_imess[0],
sc->sc_msgpriq, sc->sc_msgoutq, sc->sc_lastmsg, sc->sc_currmsg);
diff --git a/sys/dev/isa/bt.c b/sys/dev/isa/bt.c
index 20672f11cf0..39c2904476e 100644
--- a/sys/dev/isa/bt.c
+++ b/sys/dev/isa/bt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bt.c,v 1.8 1996/04/25 18:54:47 is Exp $ */
+/* $NetBSD: bt.c,v 1.9 1996/04/29 20:02:53 christos Exp $ */
#define BTDIAG
#define integrate
@@ -694,11 +694,10 @@ bt_start_ccbs(sc)
int iobase = sc->sc_iobase;
struct bt_mbx_out *wmbo; /* Mail Box Out pointer */
struct bt_ccb *ccb;
- int i;
wmbo = wmbx->tmbo;
- while (ccb = sc->sc_waiting_ccb.tqh_first) {
+ while ((ccb = sc->sc_waiting_ccb.tqh_first) != NULL) {
if (sc->sc_mbofull >= BT_MBX_SIZE) {
bt_collect_mbo(sc);
if (sc->sc_mbofull >= BT_MBX_SIZE) {
@@ -1022,7 +1021,6 @@ bt_inquire_setup_information(sc)
struct bt_model model;
struct bt_revision revision;
struct bt_digit digit;
- char dummy[8];
char *p;
/*
@@ -1101,7 +1099,9 @@ bt_scsi_cmd(xs)
int seg; /* scatter gather seg being worked on */
u_long thiskv, thisphys, nextphys;
int bytes_this_seg, bytes_this_page, datalen, flags;
+#ifdef TFS
struct iovec *iovp;
+#endif
int s;
SC_DEBUG(sc_link, SDEV_DB2, ("bt_scsi_cmd\n"));
diff --git a/sys/dev/isa/btreg.h b/sys/dev/isa/btreg.h
index 886911afa7f..5bb6c9b9d30 100644
--- a/sys/dev/isa/btreg.h
+++ b/sys/dev/isa/btreg.h
@@ -39,10 +39,12 @@ typedef u_int8_t physlen[4];
#define BT_START_SCSI 0x02 /* start scsi command */
#define BT_INQUIRE_REVISION 0x04 /* Adapter Inquiry */
#define BT_MBO_INTR_EN 0x05 /* Enable MBO available interrupt */
-/*#define BT_SEL_TIMEOUT_SET 0x06 /* set selection time-out */
-/*#define BT_BUS_ON_TIME_SET 0x07 /* set bus-on time */
-/*#define BT_BUS_OFF_TIME_SET 0x08 /* set bus-off time */
-/*#define BT_SPEED_SET 0x09 /* set transfer speed */
+#if 0
+#define BT_SEL_TIMEOUT_SET 0x06 /* set selection time-out */
+#define BT_BUS_ON_TIME_SET 0x07 /* set bus-on time */
+#define BT_BUS_OFF_TIME_SET 0x08 /* set bus-off time */
+#define BT_SPEED_SET 0x09 /* set transfer speed */
+#endif
#define BT_INQUIRE_DEVICES 0x0a /* return installed devices 0-7 */
#define BT_INQUIRE_CONFIG 0x0b /* return configuration data */
#define BT_TARGET_EN 0x0c /* enable target mode */
@@ -96,7 +98,9 @@ struct bt_mbx_in {
#if defined(BIG_DMA)
WARNING...THIS WON'T WORK(won't fit on 1 page)
-/* #define BT_NSEG 2048 /* Number of scatter gather segments - to much vm */
+#if 0
+#define BT_NSEG 2048 /* Number of scatter gather segments - to much vm */
+#endif
#define BT_NSEG 128
#else
#define BT_NSEG 33
diff --git a/sys/dev/isa/com.c b/sys/dev/isa/com.c
index 5570f7ef424..112b40fad55 100644
--- a/sys/dev/isa/com.c
+++ b/sys/dev/isa/com.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: com.c,v 1.12 1996/04/29 14:16:15 hvozda Exp $ */
-/* $NetBSD: com.c,v 1.79 1996/04/15 18:54:31 cgd Exp $ */
+/* $OpenBSD: com.c,v 1.13 1996/05/07 07:36:25 deraadt Exp $ */
+/* $NetBSD: com.c,v 1.80 1996/04/29 20:03:00 christos Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996
@@ -75,6 +75,7 @@
#include "com.h"
+
#define COM_IBUFSIZE (2 * 512)
#define COM_IHIGHWATER ((3 * COM_IBUFSIZE) / 4)
@@ -121,15 +122,25 @@ struct com_softc {
#ifdef COM_HAYESP
int comprobeHAYESP __P((bus_io_handle_t hayespioh, struct com_softc *sc));
#endif
-int comopen __P((dev_t, int, int, struct proc *));
-int comclose __P((dev_t, int, int, struct proc *));
-void comdiag __P((void *));
-int comintr __P((void *));
-void compoll __P((void *));
-int comparam __P((struct tty *, struct termios *));
-void comstart __P((struct tty *));
-void com_absent_notify __P((struct com_softc *sc));
-void comstart_pending __P((void *arg));
+void comdiag __P((void *));
+int comspeed __P((long));
+int comparam __P((struct tty *, struct termios *));
+void comstart __P((struct tty *));
+int comintr __P((void *));
+void compoll __P((void *));
+
+/* XXX: These belong elsewhere */
+cdev_decl(com);
+bdev_decl(com);
+
+struct consdev;
+void comcnprobe __P((struct consdev *));
+void comcninit __P((struct consdev *));
+int comcngetc __P((dev_t));
+void comcnputc __P((dev_t, int));
+void comcnpollc __P((dev_t, int));
+
+static u_char tiocm_xxx2mcr __P((int));
/*
* XXX the following two cfattach structs should be different, and possibly
@@ -155,7 +166,7 @@ struct cfdriver com_cd = {
NULL, "com", DV_TTY
};
-int cominit __P((bus_chipset_tag_t, bus_io_handle_t, int));
+void cominit __P((bus_chipset_tag_t, bus_io_handle_t, int));
#ifndef CONSPEED
#define CONSPEED B9600
@@ -194,20 +205,18 @@ extern int kgdb_debug_init;
#if NCOM_PCMCIA
#include <dev/pcmcia/pcmciavar.h>
-int com_pcmcia_match __P((struct device *, void *, void *));
-void com_pcmcia_attach __P((struct device *, struct device *, void *));
-int com_pcmcia_detach __P((struct device *));
+int com_pcmcia_match __P((struct device *, void *, void *));
+void com_pcmcia_attach __P((struct device *, struct device *, void *));
+int com_pcmcia_detach __P((struct device *));
struct cfattach com_pcmcia_ca = {
sizeof(struct com_softc), com_pcmcia_match, comattach,
com_pcmcia_detach
};
-int
-com_pcmcia_mod __P((struct pcmcia_link *pc_link,
- struct device *self,
- struct pcmcia_conf *pc_cf,
- struct cfdata *cf));
+int com_pcmcia_mod __P((struct pcmcia_link *pc_link, struct device *self,
+ struct pcmcia_conf *pc_cf, struct cfdata *cf));
+void com_absent_notify __P((struct com_softc *sc));
/* additional setup needed for pcmcia devices */
/* modify config entry */
@@ -507,7 +516,6 @@ comprobe(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
int iobase, needioh;
@@ -537,6 +545,7 @@ comprobe(parent, match, aux)
#endif
#if NCOM_COMMULTI
if (1) {
+ struct cfdata *cf = match;
struct commulti_attach_args *ca = aux;
if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != ca->ca_slave)
@@ -580,11 +589,9 @@ comattach(parent, self, aux)
void *aux;
{
struct com_softc *sc = (void *)self;
- struct cfdata *cf = sc->sc_dev.dv_cfdata;
int iobase, irq;
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
- struct tty *tp;
#ifdef COM_HAYESP
int hayesp_ports[] = { 0x140, 0x180, 0x280, 0x300, 0 };
int *hayespp;
@@ -715,7 +722,7 @@ comattach(parent, self, aux)
if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
kgdb_dev = -1; /* can't debug over console port */
else {
- (void) cominit(bc, ioh, kgdb_rate);
+ cominit(bc, ioh, kgdb_rate);
if (kgdb_debug_init) {
/*
* Print prefix of device name,
@@ -1342,9 +1349,10 @@ stopped:
/*
* Stop output on a line.
*/
-void
+int
comstop(tp, flag)
struct tty *tp;
+ int flag;
{
int s;
@@ -1353,6 +1361,7 @@ comstop(tp, flag)
if (!ISSET(tp->t_state, TS_TTSTOP))
SET(tp->t_state, TS_FLUSH);
splx(s);
+ return 0;
}
void
@@ -1607,14 +1616,11 @@ void
comcnprobe(cp)
struct consdev *cp;
{
- bus_chipset_tag_t bc;
+ /* XXX NEEDS TO BE FIXED XXX */
+ bus_chipset_tag_t bc = 0;
bus_io_handle_t ioh;
int found;
-#if 0
- XXX NEEDS TO BE FIXED XXX
- bc = ???;
-#endif
if (bus_io_map(bc, CONADDR, COM_NPORTS, &ioh)) {
cp->cn_pri = CN_DEAD;
return;
@@ -1657,6 +1663,7 @@ comcninit(cp)
comconsinit = 0;
}
+void
cominit(bc, ioh, rate)
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
@@ -1676,6 +1683,7 @@ cominit(bc, ioh, rate)
splx(s);
}
+int
comcngetc(dev)
dev_t dev;
{
@@ -1710,7 +1718,7 @@ comcnputc(dev, c)
if (dev != kgdb_dev)
#endif
if (comconsinit == 0) {
- (void) cominit(bc, ioh, comdefaultrate);
+ cominit(bc, ioh, comdefaultrate);
comconsinit = 1;
}
/* wait for any pending transmission to finish */
diff --git a/sys/dev/isa/elink.c b/sys/dev/isa/elink.c
index d33a000f21b..f97d1acff65 100644
--- a/sys/dev/isa/elink.c
+++ b/sys/dev/isa/elink.c
@@ -1,6 +1,7 @@
-/* $NetBSD: elink.c,v 1.7 1995/01/29 07:36:56 cgd Exp $ */
+/* $NetBSD: elink.c,v 1.9 1996/05/03 19:06:27 christos Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
* Copyright (c) 1994, 1995 Charles Hannum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,34 +34,83 @@
* Common code for dealing with 3COM ethernet cards.
*/
-#include <sys/types.h>
-#include <machine/pio.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/queue.h>
+
+#include <machine/bus.h>
+
#include <dev/isa/elink.h>
/*
+ * This list keeps track of which ISAs have gotten an elink_reset().
+ */
+struct elink_done_reset {
+ LIST_ENTRY(elink_done_reset) er_link;
+ int er_bus;
+};
+static LIST_HEAD(, elink_done_reset) elink_all_resets;
+static int elink_all_resets_initialized;
+
+/*
* Issue a `global reset' to all cards, and reset the ID state machines. We
* have to be careful to do the global reset only once during autoconfig, to
* prevent resetting boards that have already been configured.
+ *
+ * The "bus" argument here is the unit number of the ISA bus, e.g. "0"
+ * if the bus is "isa0".
+ *
+ * NOTE: the caller MUST provide an i/o handle for ELINK_ID_PORT!
*/
void
-elink_reset()
-{
- static int x = 0;
+elink_reset(bc, ioh, bus)
+ bus_chipset_tag_t bc;
+ bus_io_handle_t ioh;
+ int bus;
+{
+ struct elink_done_reset *er;
- if (x == 0) {
- x = 1;
- outb(ELINK_ID_PORT, ELINK_RESET);
+ if (elink_all_resets_initialized == 0) {
+ LIST_INIT(&elink_all_resets);
+ elink_all_resets_initialized = 1;
}
- outb(ELINK_ID_PORT, 0x00);
- outb(ELINK_ID_PORT, 0x00);
+
+ /*
+ * Reset these cards if we haven't done so already.
+ */
+ for (er = elink_all_resets.lh_first; er != NULL;
+ er = er->er_link.le_next)
+ if (er->er_bus == bus)
+ goto out;
+
+ /* Mark this bus so we don't do it again. */
+ er = (struct elink_done_reset *)malloc(sizeof(struct elink_done_reset),
+ M_DEVBUF, M_NOWAIT);
+ if (er == NULL)
+ panic("elink_reset: can't allocate state storage");
+
+ er->er_bus = bus;
+ LIST_INSERT_HEAD(&elink_all_resets, er, er_link);
+
+ /* Haven't reset the cards on this bus, yet. */
+ bus_io_write_1(bc, ioh, 0, ELINK_RESET);
+
+ out:
+ bus_io_write_1(bc, ioh, 0, 0x00);
+ bus_io_write_1(bc, ioh, 0, 0x00);
}
/*
* The `ID sequence' is really just snapshots of an 8-bit CRC register as 0
* bits are shifted in. Different board types use different polynomials.
+ *
+ * NOTE: the caller MUST provide an i/o handle for ELINK_ID_PORT!
*/
void
-elink_idseq(p)
+elink_idseq(bc, ioh, p)
+ bus_chipset_tag_t bc;
+ bus_io_handle_t ioh;
register u_char p;
{
register int i;
@@ -68,7 +118,7 @@ elink_idseq(p)
c = 0xff;
for (i = 255; i; i--) {
- outb(ELINK_ID_PORT, c);
+ bus_io_write_1(bc, ioh, 0, c);
if (c & 0x80) {
c <<= 1;
c ^= p;
diff --git a/sys/dev/isa/elink.h b/sys/dev/isa/elink.h
index c2af300887e..e4934ef09d0 100644
--- a/sys/dev/isa/elink.h
+++ b/sys/dev/isa/elink.h
@@ -1,4 +1,4 @@
-/* $NetBSD: elink.h,v 1.3 1994/10/27 04:17:11 cgd Exp $ */
+/* $NetBSD: elink.h,v 1.4 1996/04/30 22:16:31 thorpej Exp $ */
/*
* Copyright (c) 1994 Charles Hannum. All rights reserved.
@@ -35,5 +35,5 @@
#define ELINK_507_POLY 0xe7
#define ELINK_509_POLY 0xcf
-void elink_reset __P((void));
-void elink_idseq __P((u_char p));
+void elink_reset __P((bus_chipset_tag_t, bus_io_handle_t, int));
+void elink_idseq __P((bus_chipset_tag_t, bus_io_handle_t, u_char p));
diff --git a/sys/dev/isa/gus.c b/sys/dev/isa/gus.c
index 9a72f7a6182..b45a5005882 100644
--- a/sys/dev/isa/gus.c
+++ b/sys/dev/isa/gus.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: gus.c,v 1.9 1996/04/21 22:23:28 deraadt Exp $ */
-/* $NetBSD: gus.c,v 1.13 1996/04/11 22:28:42 cgd Exp $ */
+/* $OpenBSD: gus.c,v 1.10 1996/05/07 07:36:36 deraadt Exp $ */
+/* $NetBSD: gus.c,v 1.15 1996/05/03 22:35:24 jtk Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -381,8 +381,8 @@ int gus_get_out_port __P((void *));
int gus_set_in_port __P((void *, int));
int gus_get_in_port __P((void *));
int gus_commit_settings __P((void *));
-int gus_dma_output __P((void *, void *, int, void (*)(), void *));
-int gus_dma_input __P((void *, void *, int, void (*)(), void *));
+int gus_dma_output __P((void *, void *, int, void (*)(void *), void *));
+int gus_dma_input __P((void *, void *, int, void (*)(void *), void *));
int gus_halt_out_dma __P((void *));
int gus_halt_in_dma __P((void *));
int gus_cont_out_dma __P((void *));
@@ -392,8 +392,8 @@ int gusmax_set_precision __P((void *, u_int));
int gusmax_get_precision __P((void *));
int gusmax_round_blocksize __P((void *, int));
int gusmax_commit_settings __P((void *));
-int gusmax_dma_output __P((void *, void *, int, void (*)(), void *));
-int gusmax_dma_input __P((void *, void *, int, void (*)(), void *));
+int gusmax_dma_output __P((void *, void *, int, void (*)(void *), void *));
+int gusmax_dma_input __P((void *, void *, int, void (*)(void *), void *));
int gusmax_halt_out_dma __P((void *));
int gusmax_halt_in_dma __P((void *));
int gusmax_cont_out_dma __P((void *));
@@ -423,11 +423,13 @@ STATIC void gus_set_voices __P((struct gus_softc *, int));
STATIC void gus_set_volume __P((struct gus_softc *, int, int));
STATIC void gus_set_samprate __P((struct gus_softc *, int, int));
STATIC void gus_set_recrate __P((struct gus_softc *, u_long));
-STATIC void gus_start_voice __P((struct gus_softc *, int, int)),
- gus_stop_voice __P((struct gus_softc *, int, int)),
- gus_set_endaddr __P((struct gus_softc *, int, u_long)),
- gus_set_curaddr __P((struct gus_softc *, int, u_long));
+STATIC void gus_start_voice __P((struct gus_softc *, int, int));
+STATIC void gus_stop_voice __P((struct gus_softc *, int, int));
+STATIC void gus_set_endaddr __P((struct gus_softc *, int, u_long));
+#ifdef GUSPLAYDEBUG
+STATIC void gus_set_curaddr __P((struct gus_softc *, int, u_long));
STATIC u_long gus_get_curaddr __P((struct gus_softc *, int));
+#endif
STATIC int gus_dmaout_intr __P((struct gus_softc *));
STATIC void gus_dmaout_dointr __P((struct gus_softc *));
STATIC void gus_dmaout_timeout __P((void *));
@@ -436,7 +438,7 @@ STATIC int gus_voice_intr __P((struct gus_softc *));
STATIC void gus_start_playing __P((struct gus_softc *, int));
STATIC int gus_continue_playing __P((struct gus_softc *, int));
STATIC u_char guspeek __P((int, u_long));
-STATIC unsigned long convert_to_16bit();
+STATIC u_long convert_to_16bit __P((u_long));
STATIC int gus_setfd __P((void *, int));
STATIC int gus_mixer_set_port __P((void *, mixer_ctrl_t *));
STATIC int gus_mixer_get_port __P((void *, mixer_ctrl_t *));
@@ -452,6 +454,11 @@ STATIC void gusics_mic_mute __P((struct ics2101_softc *, int));
STATIC void gusics_linein_mute __P((struct ics2101_softc *, int));
STATIC void gusics_cd_mute __P((struct ics2101_softc *, int));
+STATIC __inline int gus_to_vol __P((mixer_ctrl_t *, struct ad1848_volume *));
+STATIC __inline int gus_from_vol __P((mixer_ctrl_t *, struct ad1848_volume *));
+
+void stereo_dmaintr __P((void *));
+
/*
* ISA bus driver routines
*/
@@ -682,9 +689,6 @@ gusprobe(parent, match, aux)
register int iobase = ia->ia_iobase;
int recdrq = cf->cf_flags;
- int i;
- unsigned char s1, s2;
-
/*
* Before we do anything else, make sure requested IRQ and DRQ are
* valid for this card.
@@ -791,7 +795,7 @@ gusattach(parent, self, aux)
register struct gus_softc *sc = (void *) self;
register struct isa_attach_args *ia = aux;
register int port = ia->ia_iobase;
- int s,i;
+ int i;
register unsigned char c,d,m;
/*
@@ -889,8 +893,7 @@ gusattach(parent, self, aux)
guspoke(port, 0L, 0x00);
for(i = 1; i < 1024; i++) {
- unsigned long loc;
- unsigned char val;
+ u_long loc;
/*
* See if we've run into mirroring yet
@@ -1102,7 +1105,7 @@ gusmax_dma_output(addr, buf, size, intr, arg)
void * addr;
void *buf;
int size;
- void (*intr)();
+ void (*intr) __P((void *));
void *arg;
{
register struct ad1848_softc *ac = addr;
@@ -1113,7 +1116,8 @@ gusmax_dma_output(addr, buf, size, intr, arg)
* called at splgus() from interrupt handler.
*/
void
-stereo_dmaintr(void *arg)
+stereo_dmaintr(arg)
+ void *arg;
{
struct gus_softc *sc = arg;
struct stereo_dma_intr *sa = &sc->sc_stereo;
@@ -1159,13 +1163,13 @@ gus_dma_output(addr, buf, size, intr, arg)
void * addr;
void *buf;
int size;
- void (*intr)();
+ void (*intr) __P((void *));
void *arg;
{
struct gus_softc *sc = addr;
u_char *buffer = buf;
u_long boarddma;
- int i, flags;
+ int flags;
DMAPRINTF(("gus_dma_output %d @ %x\n", size, buf));
@@ -1240,8 +1244,10 @@ gusmax_close(addr)
{
register struct ad1848_softc *ac = addr;
register struct gus_softc *sc = ac->parent;
-/* ac->aux1_mute = 1;
+#if 0
+ ac->aux1_mute = 1;
ad1848_mute_aux1(ac, 1); /* turn off DAC output */
+#endif
ad1848_close(ac);
gusclose(sc);
}
@@ -1366,7 +1372,9 @@ gus_dmaout_timeout(arg)
SELECT_GUS_REG(port, GUSREG_DMA_CONTROL);
outb(sc->sc_iobase+GUS_DATA_HIGH, 0);
-/* isa_dmaabort(sc->sc_drq); /* XXX we will dmadone below? */
+#if 0
+ isa_dmaabort(sc->sc_drq); /* XXX we will dmadone below? */
+#endif
gus_dmaout_dointr(sc);
splx(s);
@@ -1550,7 +1558,6 @@ gus_voice_intr(sc)
{
register int port = sc->sc_iobase;
int ignore = 0, voice, rval = 0;
- unsigned long addr;
unsigned char intr, status;
/*
@@ -1676,7 +1683,7 @@ gus_voice_intr(sc)
printf("gusdmaout botch?\n");
else {
/* clean out to avoid double calls */
- void (*pfunc)() = sc->sc_dmaoutintr;
+ void (*pfunc) __P((void *)) = sc->sc_dmaoutintr;
void *arg = sc->sc_outarg;
sc->sc_outarg = 0;
@@ -1690,6 +1697,7 @@ gus_voice_intr(sc)
* Ignore other interrupts for now
*/
}
+ return 0;
}
STATIC void
@@ -1875,12 +1883,11 @@ STATIC void
gusdmaout(sc, flags, gusaddr, buffaddr, length)
struct gus_softc *sc;
int flags, length;
- unsigned long gusaddr;
+ u_long gusaddr;
caddr_t buffaddr;
{
register unsigned char c = (unsigned char) flags;
register int port = sc->sc_iobase;
- int s;
DMAPRINTF(("gusdmaout flags=%x scflags=%x\n", flags, sc->sc_flags));
@@ -1952,9 +1959,9 @@ gus_start_voice(sc, voice, intrs)
int intrs;
{
register int port = sc->sc_iobase;
- unsigned long start;
- unsigned long current;
- unsigned long end;
+ u_long start;
+ u_long current;
+ u_long end;
/*
* Pick all the values for the voice out of the gus_voice struct
@@ -2251,7 +2258,6 @@ gus_round_blocksize(addr, blocksize)
int blocksize;
{
register struct gus_softc *sc = addr;
- register unsigned long i;
DPRINTF(("gus_round_blocksize called\n"));
@@ -2527,14 +2533,14 @@ gus_set_samprate(sc, voice, freq)
{
register int port = sc->sc_iobase;
unsigned int fc;
- unsigned long temp, f = (unsigned long) freq;
+ u_long temp, f = (u_long) freq;
/*
* calculate fc based on the number of active voices;
* we need to use longs to preserve enough bits
*/
- temp = (unsigned long) gus_max_frequency[sc->sc_voices-GUS_MIN_VOICES];
+ temp = (u_long) gus_max_frequency[sc->sc_voices-GUS_MIN_VOICES];
fc = (unsigned int)(((f << 9L) + (temp >> 1L)) / temp);
@@ -2594,10 +2600,11 @@ gus_set_recrate(sc, rate)
{
register int port = sc->sc_iobase;
u_char realrate;
- int s;
DPRINTF(("gus_set_recrate %lu\n", rate));
-/* realrate = 9878400/(16*(rate+2)); /* formula from GUS docs */
+#if 0
+ realrate = 9878400/(16*(rate+2)); /* formula from GUS docs */
+#endif
realrate = (9878400 >> 4)/rate - 2; /* formula from code, sigh. */
SELECT_GUS_REG(port, GUSREG_SAMPLE_FREQ);
@@ -2692,7 +2699,7 @@ STATIC void
gus_set_endaddr(sc, voice, addr)
struct gus_softc *sc;
int voice;
- unsigned long addr;
+ u_long addr;
{
register int port = sc->sc_iobase;
@@ -2708,7 +2715,7 @@ gus_set_endaddr(sc, voice, addr)
}
-#if 0
+#ifdef GUSPLAYDEBUG
/*
* Set current address. called at splgus()
*/
@@ -2716,7 +2723,7 @@ STATIC void
gus_set_curaddr(sc, voice, addr)
struct gus_softc *sc;
int voice;
- unsigned long addr;
+ u_long addr;
{
register int port = sc->sc_iobase;
@@ -2733,18 +2740,17 @@ gus_set_curaddr(sc, voice, addr)
outw(port+GUS_DATA_LOW, ADDR_LOW(addr));
}
-#endif
/*
* Get current GUS playback address. Called at splgus().
*/
-STATIC unsigned long
+STATIC u_long
gus_get_curaddr(sc, voice)
struct gus_softc *sc;
int voice;
{
register int port = sc->sc_iobase;
- unsigned long addr;
+ u_long addr;
outb(port+GUS_VOICE_SELECT, (unsigned char) voice);
SELECT_GUS_REG(port, GUSREG_CUR_ADDR_HIGH|GUSREG_READ);
@@ -2760,17 +2766,18 @@ gus_get_curaddr(sc, voice)
return(addr);
}
+#endif
/*
* Convert an address value to a "16 bit" value - why this is necessary I
* have NO idea
*/
-STATIC unsigned long
+STATIC u_long
convert_to_16bit(address)
- unsigned long address;
+ u_long address;
{
- unsigned long old_address;
+ u_long old_address;
old_address = address;
address >>= 1;
@@ -3219,7 +3226,7 @@ gusmax_dma_input(addr, buf, size, callback, arg)
void * addr;
void *buf;
int size;
- void (*callback)();
+ void (*callback) __P((void *));
void *arg;
{
register struct ad1848_softc *sc = addr;
@@ -3235,7 +3242,7 @@ gus_dma_input(addr, buf, size, callback, arg)
void * addr;
void *buf;
int size;
- void (*callback)();
+ void (*callback) __P((void *));
void *arg;
{
register struct gus_softc *sc = addr;
@@ -3431,7 +3438,7 @@ gus_setfd(addr, flag)
return(0); /* nothing fancy to do. */
}
-STATIC inline int
+STATIC __inline int
gus_to_vol(cp, vol)
mixer_ctrl_t *cp;
struct ad1848_volume *vol;
@@ -3448,7 +3455,7 @@ gus_to_vol(cp, vol)
return(0);
}
-STATIC inline int
+STATIC __inline int
gus_from_vol(cp, vol)
mixer_ctrl_t *cp;
struct ad1848_volume *vol;
@@ -3473,7 +3480,6 @@ gusmax_mixer_get_port(addr, cp)
register struct ad1848_softc *ac = addr;
register struct gus_softc *sc = ac->parent;
struct ad1848_volume vol;
- u_char eq;
int error = EINVAL;
DPRINTF(("gusmax_mixer_get_port: port=%d\n", cp->dev));
@@ -3626,7 +3632,6 @@ gus_mixer_get_port(addr, cp)
register struct ics2101_softc *ic = &sc->sc_mixer;
struct ad1848_volume vol;
int error = EINVAL;
- u_int mute;
DPRINTF(("gus_mixer_get_port: dev=%d type=%d\n", cp->dev, cp->type));
@@ -3950,7 +3955,6 @@ gus_mixer_set_port(addr, cp)
register struct ics2101_softc *ic = &sc->sc_mixer;
struct ad1848_volume vol;
int error = EINVAL;
- u_int mute;
DPRINTF(("gus_mixer_set_port: dev=%d type=%d\n", cp->dev, cp->type));
@@ -4107,9 +4111,6 @@ gusmax_mixer_query_devinfo(addr, dip)
void *addr;
register mixer_devinfo_t *dip;
{
- register struct ad1848_softc *ac = addr;
- register struct gus_softc *sc = ac->parent;
-
DPRINTF(("gusmax_query_devinfo: index=%d\n", dip->index));
switch(dip->index) {
@@ -4466,8 +4467,6 @@ gus_query_encoding(addr, fp)
void *addr;
struct audio_encoding *fp;
{
- register struct gus_softc *sc = addr;
-
switch (fp->index) {
case 0:
strcpy(fp->name, AudioEmulaw);
diff --git a/sys/dev/isa/ics2101.c b/sys/dev/isa/ics2101.c
index 97bd6f97502..458d1424ffd 100644
--- a/sys/dev/isa/ics2101.c
+++ b/sys/dev/isa/ics2101.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ics2101.c,v 1.2 1996/03/08 16:42:57 niklas Exp $ */
-/* $NetBSD: ics2101.c,v 1.3 1996/02/05 02:22:11 jtc Exp $ */
+/* $OpenBSD: ics2101.c,v 1.3 1996/05/07 07:36:42 deraadt Exp $ */
+/* $NetBSD: ics2101.c,v 1.4 1996/04/29 20:03:10 christos Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -68,6 +68,8 @@
#define cvt_value(val) ((val) >> 1)
+static void ics2101_mix_doit __P((struct ics2101_softc *, u_int, u_int, u_int,
+ u_int));
/*
* Program one channel of the ICS mixer
*/
@@ -76,7 +78,7 @@
static void
ics2101_mix_doit(sc, chan, side, value, flags)
struct ics2101_softc *sc;
- unsigned int chan, side, value, flags;
+ u_int chan, side, value, flags;
{
unsigned char flip_left[6] = {0x01, 0x01, 0x01, 0x02, 0x01, 0x02};
unsigned char flip_right[6] = {0x02, 0x02, 0x02, 0x01, 0x02, 0x01};
diff --git a/sys/dev/isa/if_ed.c b/sys/dev/isa/if_ed.c
index db1654fb8fb..5435c1fcdc2 100644
--- a/sys/dev/isa/if_ed.c
+++ b/sys/dev/isa/if_ed.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_ed.c,v 1.13 1996/05/05 13:38:19 mickey Exp $ */
-/* $NetBSD: if_ed.c,v 1.93 1996/04/11 22:28:55 cgd Exp $ */
+/* $OpenBSD: if_ed.c,v 1.14 1996/05/07 07:36:47 deraadt Exp $ */
+/* $NetBSD: if_ed.c,v 1.96 1996/05/03 19:05:30 christos Exp $ */
/*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -375,8 +375,6 @@ edprobe(parent, match, aux)
void *match, *aux;
{
struct ed_softc *sc = match;
- struct cfdata *cf = sc->sc_dev.dv_cfdata;
- struct isa_attach_args *ia = aux;
return (ed_find(match, sc->sc_dev.dv_cfdata, aux));
}
@@ -462,6 +460,10 @@ ed_find_WD80x3(sc, cf, ia)
bc = ia->ia_bc;
rv = 0;
+ /* Set initial values for width/size. */
+ memsize = 8192;
+ isa16bit = 0;
+
if (bus_io_map(bc, ia->ia_iobase, ED_WD_IO_PORTS, &ioh))
return (0);
@@ -511,9 +513,6 @@ ed_find_WD80x3(sc, cf, ia)
sc->vendor = ED_VENDOR_WD_SMC;
sc->type = bus_io_read_1(bc, ioh, asicbase + ED_WD_CARD_ID);
- /* Set initial values for width/size. */
- memsize = 8192;
- isa16bit = 0;
switch (sc->type) {
case ED_TYPE_WD8003S:
sc->type_str = "WD8003S";
@@ -750,7 +749,7 @@ ed_find_WD80x3(sc, cf, ia)
(sc->type == ED_TYPE_TOSHIBA1) ||
(sc->type == ED_TYPE_TOSHIBA4) ||
#endif
- (sc->type == ED_TYPE_WD8013EBT) && !sc->is790) {
+ ((sc->type == ED_TYPE_WD8013EBT) && !sc->is790)) {
sc->wd_laar_proto =
((ia->ia_maddr >> 19) &
ED_WD_LAAR_ADDRHI);
@@ -867,13 +866,19 @@ ed_find_3Com(sc, cf, ia)
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
bus_mem_handle_t memh;
- int i, rv, mapped_mem = 0;
+ int i;
u_int memsize;
- u_char isa16bit, sum, x;
+ u_char isa16bit, x;
int ptr, asicbase, nicbase;
+ /*
+ * Hmmm...a 16bit 3Com board has 16k of memory, but only an 8k window
+ * to it.
+ */
+ memsize = 8192;
+
+
bc = ia->ia_bc;
- rv = 0;
if (bus_io_map(bc, ia->ia_iobase, ED_WD_IO_PORTS, &ioh))
return (0);
@@ -891,28 +896,28 @@ ed_find_3Com(sc, cf, ia)
*/
x = bus_io_read_1(bc, ioh, asicbase + ED_3COM_BCFR);
if (x == 0 || (x & (x - 1)) != 0)
- goto out;
+ goto err;
ptr = ffs(x) - 1;
if (ia->ia_iobase != IOBASEUNK) {
if (ia->ia_iobase != ed_3com_iobase[ptr]) {
printf("%s: %s mismatch; kernel configured %x != board configured %x\n",
"iobase", sc->sc_dev.dv_xname, ia->ia_iobase,
ed_3com_iobase[ptr]);
- goto out;
+ goto err;
}
} else
ia->ia_iobase = ed_3com_iobase[ptr]; /* XXX --thorpej */
x = bus_io_read_1(bc, ioh, asicbase + ED_3COM_PCFR);
if (x == 0 || (x & (x - 1)) != 0)
- goto out;
+ goto err;
ptr = ffs(x) - 1;
if (ia->ia_maddr != MADDRUNK) {
if (ia->ia_maddr != ed_3com_maddr[ptr]) {
printf("%s: %s mismatch; kernel configured %x != board configured %x\n",
"maddr", sc->sc_dev.dv_xname, ia->ia_maddr,
ed_3com_maddr[ptr]);
- goto out;
+ goto err;
}
} else
ia->ia_maddr = ed_3com_maddr[ptr];
@@ -928,7 +933,7 @@ ed_find_3Com(sc, cf, ia)
printf("%s: irq mismatch; kernel configured %d != board configured %d\n",
sc->sc_dev.dv_xname, ia->ia_irq,
ed_3com_irq[ptr]);
- goto out;
+ goto err;
}
} else
ia->ia_irq = ed_3com_irq[ptr];
@@ -961,12 +966,6 @@ ed_find_3Com(sc, cf, ia)
sc->cr_proto = ED_CR_RD2;
/*
- * Hmmm...a 16bit 3Com board has 16k of memory, but only an 8k window
- * to it.
- */
- memsize = 8192;
-
- /*
* Get station address from on-board ROM.
*
* First, map ethernet address PROM over the top of where the NIC
@@ -1012,8 +1011,7 @@ ed_find_3Com(sc, cf, ia)
ED_CR_RD2 | ED_CR_PAGE_0 | ED_CR_STP);
if (bus_mem_map(bc, ia->ia_maddr, memsize, 0, &memh))
- goto out;
- mapped_mem = 1;
+ goto err;
sc->mem_start = 0; /* offset */
sc->mem_size = memsize;
sc->mem_end = sc->mem_start + memsize;
@@ -1113,24 +1111,21 @@ ed_find_3Com(sc, cf, ia)
ia->ia_msize = memsize;
ia->ia_iosize = ED_3COM_IO_PORTS;
- rv = 1;
- out:
/*
* XXX Sould always unmap, but we can't yet.
* XXX Need to squish "indirect" first.
*/
- if (rv == 0) {
- bus_io_unmap(bc, ioh, ED_3COM_IO_PORTS);
- if (mapped_mem)
- bus_mem_unmap(bc, memh, memsize);
- } else {
- /* XXX this is all "indirect" brokenness */
- sc->sc_bc = bc;
- sc->sc_ioh = ioh;
- sc->sc_memh = memh;
- }
- return (rv);
+ sc->sc_bc = bc;
+ sc->sc_ioh = ioh;
+ sc->sc_memh = memh;
+ return 1;
+
+ out:
+ bus_mem_unmap(bc, memh, memsize);
+ err:
+ bus_io_unmap(bc, ioh, ED_3COM_IO_PORTS);
+ return 0;
}
/*
@@ -1144,15 +1139,13 @@ ed_find_Novell(sc, cf, ia)
{
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
- bus_mem_handle_t memh;
u_int memsize, n;
- u_char romdata[16], isa16bit = 0, tmp;
+ u_char romdata[16], tmp;
static u_char test_pattern[32] = "THIS is A memory TEST pattern";
u_char test_buffer[32];
- int rv, asicbase, nicbase;
+ int asicbase, nicbase;
bc = ia->ia_bc;
- rv = 0;
if (bus_io_map(bc, ia->ia_iobase, ED_NOVELL_IO_PORTS, &ioh))
return (0);
@@ -1308,7 +1301,7 @@ ed_find_Novell(sc, cf, ia)
if (mstart == 0) {
printf("%s: cannot find start of RAM\n",
sc->sc_dev.dv_xname);
- goto out;
+ goto err;
}
/* Search for the end of RAM. */
@@ -1367,22 +1360,19 @@ ed_find_Novell(sc, cf, ia)
NIC_PUT(bc, ioh, nicbase, ED_P0_ISR, 0xff);
ia->ia_iosize = ED_NOVELL_IO_PORTS;
- rv = 1;
- out:
/*
* XXX Sould always unmap, but we can't yet.
* XXX Need to squish "indirect" first.
*/
- if (rv == 0)
- bus_io_unmap(bc, ioh, ED_NOVELL_IO_PORTS);
- else {
- /* XXX this is all "indirect" brokenness */
- sc->sc_bc = bc;
- sc->sc_ioh = ioh;
- sc->sc_memh = memh;
- }
- return (rv);
+ sc->sc_bc = bc;
+ sc->sc_ioh = ioh;
+ /* sc_memh is not used by this driver */
+ return 1;
+ out:
+ bus_io_unmap(bc, ioh, ED_NOVELL_IO_PORTS);
+
+ return 0;
}
/*
@@ -1751,7 +1741,7 @@ edstart(ifp)
struct mbuf *m0, *m;
int buffer;
int asicbase = sc->asic_base;
- int len, i;
+ int len;
if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
return;
diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c
index 8a1a0eb838f..42213f55926 100644
--- a/sys/dev/isa/if_el.c
+++ b/sys/dev/isa/if_el.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_el.c,v 1.8 1996/05/05 13:38:27 mickey Exp $ */
-/* $NetBSD: if_el.c,v 1.36 1996/04/11 22:29:07 cgd Exp $ */
+/* $OpenBSD: if_el.c,v 1.9 1996/05/07 07:36:53 deraadt Exp $ */
+/* $NetBSD: if_el.c,v 1.37 1996/04/29 20:03:17 christos Exp $ */
/*
* Copyright (c) 1994, Matthew E. Kimmel. Permission is hereby granted
@@ -22,6 +22,7 @@
#include "bpfilter.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/mbuf.h>
@@ -78,7 +79,7 @@ struct el_softc {
* prototypes
*/
int elintr __P((void *));
-int elinit __P((struct el_softc *));
+void elinit __P((struct el_softc *));
int elioctl __P((struct ifnet *, u_long, caddr_t));
void elstart __P((struct ifnet *));
void elwatchdog __P((int));
@@ -259,7 +260,7 @@ el_hardreset(sc)
/*
* Initialize interface.
*/
-int
+void
elinit(sc)
struct el_softc *sc;
{
@@ -616,7 +617,6 @@ elioctl(ifp, cmd, data)
{
struct el_softc *sc = el_cd.cd_devs[ifp->if_unit];
struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
int s, error = 0;
s = splnet();
diff --git a/sys/dev/isa/if_ep_isa.c b/sys/dev/isa/if_ep_isa.c
index ddb6a3a5f00..2b9c1290b4b 100644
--- a/sys/dev/isa/if_ep_isa.c
+++ b/sys/dev/isa/if_ep_isa.c
@@ -1,6 +1,7 @@
-/* $NetBSD: if_ep_isa.c,v 1.1 1996/04/25 02:15:47 thorpej Exp $ */
+/* $NetBSD: if_ep_isa.c,v 1.3 1996/05/03 19:06:25 christos Exp $ */
/*
+ * Copyright (c) 1996 Jason R. Thorpe <thorpej@beer.org>
* Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
* All rights reserved.
*
@@ -33,6 +34,7 @@
#include "bpfilter.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
@@ -40,6 +42,7 @@
#include <sys/syslog.h>
#include <sys/select.h>
#include <sys/device.h>
+#include <sys/queue.h>
#include <net/if.h>
#include <net/if_dl.h>
@@ -60,7 +63,7 @@
#endif
#include <machine/cpu.h>
-#include <machine/pio.h>
+#include <machine/bus.h>
#include <dev/ic/elink3var.h>
#include <dev/ic/elink3reg.h>
@@ -75,11 +78,27 @@ struct cfattach ep_isa_ca = {
sizeof(struct ep_softc), ep_isa_probe, ep_isa_attach
};
-static void epaddcard __P((int, int));
+static void epaddcard __P((int, int, int));
-#define MAXEPCARDS 10 /* 10 ISA slots */
+/*
+ * This keeps track of which ISAs have been through an ep probe sequence.
+ * A simple static variable isn't enough, since it's conceivable that
+ * a system might have more than one ISA bus.
+ *
+ * The "er_bus" member is the unit number of the parent ISA bus, e.g. "0"
+ * for "isa0".
+ */
+struct ep_isa_done_probe {
+ LIST_ENTRY(ep_isa_done_probe) er_link;
+ int er_bus;
+};
+static LIST_HEAD(, ep_isa_done_probe) ep_isa_all_probes;
+static int ep_isa_probes_initialized;
+
+#define MAXEPCARDS 20 /* if you have more than 20, you lose */
static struct epcard {
+ int bus;
int iobase;
int irq;
char available;
@@ -87,13 +106,13 @@ static struct epcard {
static int nepcards;
static void
-epaddcard(iobase, irq)
- int iobase;
- int irq;
+epaddcard(bus, iobase, irq)
+ int bus, iobase, irq;
{
if (nepcards >= MAXEPCARDS)
return;
+ epcards[nepcards].bus = bus;
epcards[nepcards].iobase = iobase;
epcards[nepcards].irq = (irq == 2) ? 9 : irq;
epcards[nepcards].available = 1;
@@ -113,58 +132,93 @@ ep_isa_probe(parent, match, aux)
void *match, *aux;
{
struct isa_attach_args *ia = aux;
- static int probed;
+ bus_chipset_tag_t bc = ia->ia_bc;
+ bus_io_handle_t ioh;
int slot, iobase, irq, i;
- u_short vendor, model;
+ u_int16_t vendor, model;
+ struct ep_isa_done_probe *er;
+ int bus = parent->dv_unit;
- if (!probed) {
- probed = 1;
+ if (ep_isa_probes_initialized == 0) {
+ LIST_INIT(&ep_isa_all_probes);
+ ep_isa_probes_initialized = 1;
+ }
+
+ /*
+ * Probe this bus if we haven't done so already.
+ */
+ for (er = ep_isa_all_probes.lh_first; er != NULL;
+ er = er->er_link.le_next)
+ if (er->er_bus == parent->dv_unit)
+ goto bus_probed;
+
+ /*
+ * Mark this bus so we don't probe it again.
+ */
+ er = (struct ep_isa_done_probe *)
+ malloc(sizeof(struct ep_isa_done_probe), M_DEVBUF, M_NOWAIT);
+ if (er == NULL)
+ panic("ep_isa_probe: can't allocate state storage");
+
+ er->er_bus = bus;
+ LIST_INSERT_HEAD(&ep_isa_all_probes, er, er_link);
+
+ /*
+ * Map the Etherlink ID port for the probe sequence.
+ */
+ if (bus_io_map(bc, ELINK_ID_PORT, 1, &ioh)) {
+ printf("ep_isa_probe: can't map Etherlink ID port\n");
+ return 0;
+ }
- for (slot = 0; slot < MAXEPCARDS; slot++) {
- elink_reset();
- elink_idseq(ELINK_509_POLY);
+ for (slot = 0; slot < MAXEPCARDS; slot++) {
+ elink_reset(bc, ioh, parent->dv_unit);
+ elink_idseq(bc, ioh, ELINK_509_POLY);
- /* Untag all the adapters so they will talk to us. */
- if (slot == 0)
- outb(ELINK_ID_PORT, TAG_ADAPTER + 0);
+ /* Untag all the adapters so they will talk to us. */
+ if (slot == 0)
+ bus_io_write_1(bc, ioh, 0, TAG_ADAPTER + 0);
- vendor =
- htons(epreadeeprom(ELINK_ID_PORT, EEPROM_MFG_ID));
- if (vendor != MFG_ID)
- continue;
+ vendor = htons(epreadeeprom(bc, ioh, EEPROM_MFG_ID));
+ if (vendor != MFG_ID)
+ continue;
- model =
- htons(epreadeeprom(ELINK_ID_PORT, EEPROM_PROD_ID));
- if ((model & 0xfff0) != PROD_ID) {
+ model = htons(epreadeeprom(bc, ioh, EEPROM_PROD_ID));
+ if ((model & 0xfff0) != PROD_ID) {
#ifndef trusted
- printf(
- "ep_isa_probe: ignoring model %04x\n", model);
+ printf(
+ "ep_isa_probe: ignoring model %04x\n", model);
#endif
- continue;
+ continue;
}
- iobase = epreadeeprom(ELINK_ID_PORT, EEPROM_ADDR_CFG);
- iobase = (iobase & 0x1f) * 0x10 + 0x200;
-
- irq = epreadeeprom(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
- irq >>= 12;
- epaddcard(iobase, irq);
-
- /* so card will not respond to contention again */
- outb(ELINK_ID_PORT, TAG_ADAPTER + 1);
-
- /*
- * XXX: this should probably not be done here
- * because it enables the drq/irq lines from
- * the board. Perhaps it should be done after
- * we have checked for irq/drq collisions?
- */
- outb(ELINK_ID_PORT, ACTIVATE_ADAPTER_TO_CONFIG);
- }
- /* XXX should we sort by ethernet address? */
+ iobase = epreadeeprom(bc, ioh, EEPROM_ADDR_CFG);
+ iobase = (iobase & 0x1f) * 0x10 + 0x200;
+
+ irq = epreadeeprom(bc, ioh, EEPROM_RESOURCE_CFG);
+ irq >>= 12;
+ epaddcard(bus, iobase, irq);
+
+ /* so card will not respond to contention again */
+ bus_io_write_1(bc, ioh, 0, TAG_ADAPTER + 1);
+
+ /*
+ * XXX: this should probably not be done here
+ * because it enables the drq/irq lines from
+ * the board. Perhaps it should be done after
+ * we have checked for irq/drq collisions?
+ */
+ bus_io_write_1(bc, ioh, 0, ACTIVATE_ADAPTER_TO_CONFIG);
}
+ /* XXX should we sort by ethernet address? */
+
+ bus_io_unmap(bc, ioh, 1);
+
+ bus_probed:
for (i = 0; i < nepcards; i++) {
+ if (epcards[i].bus != bus)
+ continue;
if (epcards[i].available == 0)
continue;
if (ia->ia_iobase != IOBASEUNK &&
@@ -193,14 +247,20 @@ ep_isa_attach(parent, self, aux)
{
struct ep_softc *sc = (void *)self;
struct isa_attach_args *ia = aux;
+ bus_chipset_tag_t bc = ia->ia_bc;
+ bus_io_handle_t ioh;
u_short conn = 0;
- int iobase;
- sc->ep_iobase = iobase = ia->ia_iobase;
+ /* Map i/o space. */
+ if (bus_io_map(bc, ia->ia_iobase, ia->ia_iosize, &ioh))
+ panic("ep_isa_attach: can't map i/o space");
+
+ sc->sc_bc = bc;
+ sc->sc_ioh = ioh;
sc->bustype = EP_BUS_ISA;
GO_WINDOW(0);
- conn = inw(iobase + EP_W0_CONFIG_CTRL);
+ conn = bus_io_read_2(bc, ioh, EP_W0_CONFIG_CTRL);
printf(": <3Com 3C509 Ethernet> ");
diff --git a/sys/dev/isa/if_ie.c b/sys/dev/isa/if_ie.c
index d224f872fb1..8c2926131c8 100644
--- a/sys/dev/isa/if_ie.c
+++ b/sys/dev/isa/if_ie.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_ie.c,v 1.8 1996/05/05 13:38:46 mickey Exp $ */
-/* $NetBSD: if_ie.c,v 1.47 1996/04/11 22:29:27 cgd Exp $ */
+/* $OpenBSD: if_ie.c,v 1.9 1996/05/07 07:36:59 deraadt Exp $ */
+/* $NetBSD: if_ie.c,v 1.49 1996/04/30 22:21:54 thorpej Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles Hannum.
@@ -141,7 +141,8 @@ iomem, and to make 16-pointers, we subtract sc_maddr and and with 0xffff.
#include <vm/vm.h>
#include <machine/cpu.h>
-#include <machine/pio.h>
+#include <machine/pio.h> /* XXX convert this driver! */
+#include <machine/bus.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
@@ -228,8 +229,8 @@ struct ie_softc {
struct arpcom sc_arpcom;
- void (*reset_586)();
- void (*chan_attn)();
+ void (*reset_586) __P((struct ie_softc *));
+ void (*chan_attn) __P((struct ie_softc *));
enum ie_hardware hard_type;
int hard_vers;
@@ -295,6 +296,8 @@ void iememinit __P((void *, struct ie_softc *));
static int mc_setup __P((struct ie_softc *, void *));
static void mc_reset __P((struct ie_softc *));
+vm_offset_t kvtop __P((caddr_t)); /* XXX: Should not use this */
+
#ifdef IEDEBUG
void print_rbd __P((volatile struct ie_recv_buf_desc *));
@@ -302,8 +305,24 @@ int in_ierint = 0;
int in_ietint = 0;
#endif
-int ieprobe __P((struct device *, void *, void *));
-void ieattach __P((struct device *, struct device *, void *));
+int ieprobe __P((struct device *, void *, void *));
+void ieattach __P((struct device *, struct device *, void *));
+int sl_probe __P((struct ie_softc *, struct isa_attach_args *));
+int el_probe __P((struct ie_softc *, struct isa_attach_args *));
+int ee16_probe __P((struct ie_softc *, struct isa_attach_args *));
+int check_ie_present __P((struct ie_softc *, caddr_t, u_int));
+
+static __inline void ie_setup_config __P((volatile struct ie_config_cmd *,
+ int, int));
+static __inline void ie_ack __P((struct ie_softc *, u_int));
+static __inline int ether_equal __P((u_char *, u_char *));
+static __inline int check_eh __P((struct ie_softc *, struct ether_header *,
+ int *));
+static __inline int ie_buflen __P((struct ie_softc *, int));
+static __inline int ie_packet_len __P((struct ie_softc *));
+
+static void chan_attn_timeout __P((void *));
+static void run_tdr __P((struct ie_softc *, struct ie_tdr_cmd *));
struct cfattach ie_ca = {
sizeof(struct ie_softc), ieprobe, ieattach
@@ -323,7 +342,7 @@ struct cfdriver ie_cd = {
* Here are a few useful functions. We could have done these as macros, but
* since we have the inline facility, it makes sense to use that instead.
*/
-static inline void
+static __inline void
ie_setup_config(cmd, promiscuous, manchester)
volatile struct ie_config_cmd *cmd;
int promiscuous, manchester;
@@ -343,7 +362,7 @@ ie_setup_config(cmd, promiscuous, manchester)
cmd->ie_junk = 0xff;
}
-static inline void
+static __inline void
ie_ack(sc, mask)
struct ie_softc *sc;
u_int mask;
@@ -446,8 +465,10 @@ el_probe(sc, ia)
struct ie_softc *sc;
struct isa_attach_args *ia;
{
+ bus_chipset_tag_t bc = ia->ia_bc;
+ bus_io_handle_t ioh;
u_char c;
- int i;
+ int i, rval = 0;
u_char signature[] = "*3COM*";
sc->sc_iobase = ia->ia_iobase;
@@ -456,28 +477,39 @@ el_probe(sc, ia)
sc->reset_586 = el_reset_586;
sc->chan_attn = el_chan_attn;
- /* Reset and put card in CONFIG state without changing address. */
- elink_reset();
- elink_idseq(ELINK_507_POLY);
- elink_idseq(ELINK_507_POLY);
+ /*
+ * Map the Etherlink ID port for the probe sequence.
+ */
+ if (bus_io_map(bc, ELINK_ID_PORT, 1, &ioh)) {
+ printf("3c507 probe: can't map Etherlink ID port\n");
+ return 0;
+ }
+
+ /*
+ * Reset and put card in CONFIG state without changing address.
+ * XXX Indirect brokenness here!
+ */
+ elink_reset(bc, ioh, sc->sc_dev.dv_parent->dv_unit);
+ elink_idseq(bc, ioh, ELINK_507_POLY);
+ elink_idseq(bc, ioh, ELINK_507_POLY);
outb(ELINK_ID_PORT, 0xff);
/* Check for 3COM signature before proceeding. */
outb(PORT + IE507_CTRL, inb(PORT + IE507_CTRL) & 0xfc); /* XXX */
for (i = 0; i < 6; i++)
if (inb(PORT + i) != signature[i])
- return 0;
+ goto out;
c = inb(PORT + IE507_MADDR);
if (c & 0x20) {
printf("%s: can't map 3C507 RAM in high memory\n",
sc->sc_dev.dv_xname);
- return 0;
+ goto out;
}
/* Go to RUN state. */
outb(ELINK_ID_PORT, 0x00);
- elink_idseq(ELINK_507_POLY);
+ elink_idseq(bc, ioh, ELINK_507_POLY);
outb(ELINK_ID_PORT, 0x00);
/* Set bank 2 for version info and read BCD version byte. */
@@ -493,7 +525,7 @@ el_probe(sc, ia)
if (ia->ia_irq != i) {
printf("%s: irq mismatch; kernel configured %d != board configured %d\n",
sc->sc_dev.dv_xname, ia->ia_irq, i);
- return 0;
+ goto out;
}
} else
ia->ia_irq = i;
@@ -504,7 +536,7 @@ el_probe(sc, ia)
if (ia->ia_maddr != i) {
printf("%s: maddr mismatch; kernel configured %x != board configured %x\n",
sc->sc_dev.dv_xname, ia->ia_maddr, i);
- return 0;
+ goto out;
}
} else
ia->ia_maddr = i;
@@ -520,7 +552,7 @@ el_probe(sc, ia)
if (!sc->sc_msize) {
printf("%s: can't find shared memory\n", sc->sc_dev.dv_xname);
outb(PORT + IE507_CTRL, EL_CTRL_NRST);
- return 0;
+ goto out;
}
if (!ia->ia_msize)
@@ -529,7 +561,7 @@ el_probe(sc, ia)
printf("%s: msize mismatch; kernel configured %d != board configured %d\n",
sc->sc_dev.dv_xname, ia->ia_msize, sc->sc_msize);
outb(PORT + IE507_CTRL, EL_CTRL_NRST);
- return 0;
+ goto out;
}
slel_get_address(sc);
@@ -538,7 +570,11 @@ el_probe(sc, ia)
outb(PORT + IE507_ICTRL, 1);
ia->ia_iosize = 16;
- return 1;
+ rval = 1;
+
+ out:
+ bus_io_unmap(bc, ioh, 1);
+ return rval;
}
/* Taken almost exactly from Rod's if_ix.c. */
@@ -549,12 +585,9 @@ ee16_probe(sc, ia)
struct isa_attach_args *ia;
{
int i;
- int cnt_id;
u_short board_id, id_var1, id_var2, checksum = 0;
u_short eaddrtemp, irq;
u_short pg, adjust, decode, edecode;
- u_char lock_bit;
- u_char c;
u_char bart_config;
short irq_translate[] = {0, 0x09, 0x03, 0x04, 0x05, 0x0a, 0x0b, 0};
@@ -982,7 +1015,7 @@ ietint(sc)
* Compare two Ether/802 addresses for equality, inlined and unrolled for
* speed. I'd love to have an inline assembler version of this...
*/
-static inline int
+static __inline int
ether_equal(one, two)
u_char *one, *two;
{
@@ -1005,7 +1038,7 @@ ether_equal(one, two)
* only client which will fiddle with IFF_PROMISC is BPF. This is
* probably a good assumption, but we do not make it here. (Yet.)
*/
-static inline int
+static __inline int
check_eh(sc, eh, to_bpf)
struct ie_softc *sc;
struct ether_header *eh;
@@ -1113,7 +1146,7 @@ check_eh(sc, eh, to_bpf)
* IE_RBUF_SIZE is an even power of two. If somehow the act_len exceeds
* the size of the buffer, then we are screwed anyway.
*/
-static inline int
+static __inline int
ie_buflen(sc, head)
struct ie_softc *sc;
int head;
@@ -1123,7 +1156,7 @@ ie_buflen(sc, head)
& (IE_RBUF_SIZE | (IE_RBUF_SIZE - 1)));
}
-static inline int
+static __inline int
ie_packet_len(sc)
struct ie_softc *sc;
{
@@ -1782,7 +1815,7 @@ iereset(sc)
*/
static void
chan_attn_timeout(rock)
- caddr_t rock;
+ void *rock;
{
*(int *)rock = 1;
@@ -2009,7 +2042,6 @@ ieinit(sc)
{
volatile struct ie_sys_ctl_block *scb = sc->scb;
void *ptr;
- int n;
ptr = (void *)ALIGN(scb + 1);
diff --git a/sys/dev/isa/if_levar.h b/sys/dev/isa/if_levar.h
index 00f8941339c..e28b35a0966 100644
--- a/sys/dev/isa/if_levar.h
+++ b/sys/dev/isa/if_levar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_levar.h,v 1.3 1995/10/07 09:19:16 mycroft Exp $ */
+/* $NetBSD: if_levar.h,v 1.4 1996/04/29 20:03:23 christos Exp $ */
/*
* LANCE Ethernet driver header file
@@ -48,12 +48,16 @@ struct le_softc {
struct device sc_dev; /* base structure */
struct arpcom sc_arpcom; /* Ethernet common part */
- void (*sc_copytodesc)(); /* Copy to descriptor */
- void (*sc_copyfromdesc)(); /* Copy from descriptor */
-
- void (*sc_copytobuf)(); /* Copy to buffer */
- void (*sc_copyfrombuf)(); /* Copy from buffer */
- void (*sc_zerobuf)(); /* and Zero bytes in buffer */
+ void (*sc_copytodesc) /* Copy to descriptor */
+ __P((struct le_softc *, void *, int, int));
+ void (*sc_copyfromdesc) /* Copy from descriptor */
+ __P((struct le_softc *, void *, int, int));
+ void (*sc_copytobuf) /* Copy to buffer */
+ __P((struct le_softc *, void *, int, int));
+ void (*sc_copyfrombuf) /* Copy from buffer */
+ __P((struct le_softc *, void *, int, int));
+ void (*sc_zerobuf) /* and Zero bytes in buffer */
+ __P((struct le_softc *, int, int));
u_int16_t sc_conf3; /* CSR3 value */
@@ -77,6 +81,7 @@ struct le_softc {
#endif
void *sc_ih;
+ bus_io_handle_t sc_ioh;
void *sc_sh;
int sc_card;
int sc_rap, sc_rdp; /* LANCE registers */
diff --git a/sys/dev/isa/isa.c b/sys/dev/isa/isa.c
index eacc572c3e2..c92d09119b9 100644
--- a/sys/dev/isa/isa.c
+++ b/sys/dev/isa/isa.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: isa.c,v 1.7 1996/05/04 09:39:22 niklas Exp $ */
-/* $NetBSD: isa.c,v 1.80 1996/04/11 22:25:44 cgd Exp $ */
+/* $OpenBSD: isa.c,v 1.8 1996/05/07 07:37:07 deraadt Exp $ */
+/* $NetBSD: isa.c,v 1.81 1996/04/29 20:03:24 christos Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles Hannum. All rights reserved.
@@ -45,6 +45,7 @@
int isamatch __P((struct device *, void *, void *));
void isaattach __P((struct device *, struct device *, void *));
+int isaprint __P((void *, char *));
struct cfattach isa_ca = {
sizeof(struct isa_softc), isamatch, isaattach
diff --git a/sys/dev/isa/isadma.c b/sys/dev/isa/isadma.c
index cce6db161e7..1a3bd8eba59 100644
--- a/sys/dev/isa/isadma.c
+++ b/sys/dev/isa/isadma.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: isadma.c,v 1.5 1996/04/22 20:03:05 hannken Exp $ */
-/* $NetBSD: isadma.c,v 1.18 1996/03/31 20:51:43 mycroft Exp $ */
+/* $OpenBSD: isadma.c,v 1.6 1996/05/07 07:37:10 deraadt Exp $ */
+/* $NetBSD: isadma.c,v 1.19 1996/04/29 20:03:26 christos Exp $ */
#include <sys/param.h>
#include <sys/systm.h>
diff --git a/sys/dev/isa/lpt.c b/sys/dev/isa/lpt.c
index 24499ddbc45..571ed8b7a8d 100644
--- a/sys/dev/isa/lpt.c
+++ b/sys/dev/isa/lpt.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: lpt.c,v 1.9 1996/04/21 22:24:18 deraadt Exp $ */
-/* $NetBSD: lpt.c,v 1.37 1996/04/11 22:29:37 cgd Exp $ */
+/* $OpenBSD: lpt.c,v 1.10 1996/05/07 07:37:16 deraadt Exp $ */
+/* $NetBSD: lpt.c,v 1.38 1996/04/29 20:30:48 christos Exp $ */
/*
* Copyright (c) 1993, 1994 Charles Hannum.
@@ -63,6 +63,7 @@
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/device.h>
+#include <sys/conf.h>
#include <sys/syslog.h>
#ifdef i386 /* XXX */
@@ -82,9 +83,9 @@
#define LPT_BSIZE 1024
#if !defined(DEBUG) || !defined(notdef)
-#define lprintf
+#define LPRINTF(a)
#else
-#define lprintf if (lptdebug) printf
+#define LPRINTF if (lptdebug) printf a
int lptdebug = 1;
#endif
@@ -112,6 +113,9 @@ struct lpt_softc {
u_char sc_laststatus;
};
+/* XXX does not belong here */
+cdev_decl(lpt);
+
int lptprobe __P((struct device *, void *, void *));
void lptattach __P((struct device *, struct device *, void *));
int lptintr __P((void *));
@@ -160,8 +164,8 @@ lpt_port_test(bc, ioh, base, off, data, mask)
delay(10);
temp = bus_io_read_1(bc, ioh, off) & mask;
} while (temp != data && --timeout);
- lprintf("lpt: port=0x%x out=0x%x in=0x%x timeout=%d\n", base + off,
- data, temp, timeout);
+ LPRINTF(("lpt: port=0x%x out=0x%x in=0x%x timeout=%d\n", base + off,
+ data, temp, timeout));
return (temp == data);
}
@@ -281,9 +285,11 @@ lptattach(parent, self, aux)
* Reset the printer, then wait until it's selected and not busy.
*/
int
-lptopen(dev, flag)
+lptopen(dev, flag, mode, p)
dev_t dev;
int flag;
+ int mode;
+ struct proc *p;
{
int unit = LPTUNIT(dev);
u_char flags = LPTFLAGS(dev);
@@ -314,7 +320,7 @@ lptopen(dev, flag)
sc->sc_state = LPT_INIT;
sc->sc_flags = flags;
- lprintf("%s: open: flags=0x%x\n", sc->sc_dev.dv_xname, flags);
+ LPRINTF(("%s: open: flags=0x%x\n", sc->sc_dev.dv_xname, flags));
bc = sc->sc_bc;
ioh = sc->sc_ioh;
@@ -335,8 +341,8 @@ lptopen(dev, flag)
}
/* wait 1/4 second, give up if we get a signal */
- if (error = tsleep((caddr_t)sc, LPTPRI | PCATCH, "lptopen",
- STEP) != EWOULDBLOCK) {
+ error = tsleep((caddr_t)sc, LPTPRI | PCATCH, "lptopen", STEP);
+ if (error != EWOULDBLOCK) {
sc->sc_state = 0;
return error;
}
@@ -356,7 +362,7 @@ lptopen(dev, flag)
if ((sc->sc_flags & LPT_NOINTR) == 0)
lptwakeup(sc);
- lprintf("%s: opened\n", sc->sc_dev.dv_xname);
+ LPRINTF(("%s: opened\n", sc->sc_dev.dv_xname));
return 0;
}
@@ -399,9 +405,11 @@ lptwakeup(arg)
* Close the device, and free the local line buffer.
*/
int
-lptclose(dev, flag)
+lptclose(dev, flag, mode, p)
dev_t dev;
int flag;
+ int mode;
+ struct proc *p;
{
int unit = LPTUNIT(dev);
struct lpt_softc *sc = lpt_cd.cd_devs[unit];
@@ -419,7 +427,7 @@ lptclose(dev, flag)
bus_io_write_1(bc, ioh, lpt_control, LPC_NINIT);
brelse(sc->sc_inbuf);
- lprintf("%s: closed\n", sc->sc_dev.dv_xname);
+ LPRINTF(("%s: closed\n", sc->sc_dev.dv_xname));
return 0;
}
@@ -471,14 +479,15 @@ pushbytes(sc)
while (sc->sc_count > 0) {
/* if the printer is ready for a char, give it one */
if ((sc->sc_state & LPT_OBUSY) == 0) {
- lprintf("%s: write %d\n", sc->sc_dev.dv_xname,
- sc->sc_count);
+ LPRINTF(("%s: write %d\n", sc->sc_dev.dv_xname,
+ sc->sc_count));
s = spltty();
(void) lptintr(sc);
splx(s);
}
- if (error = tsleep((caddr_t)sc, LPTPRI | PCATCH,
- "lptwrite2", 0))
+ error = tsleep((caddr_t)sc, LPTPRI | PCATCH,
+ "lptwrite2", 0);
+ if (error)
return error;
}
}
@@ -490,15 +499,16 @@ pushbytes(sc)
* chars moved to the output queue.
*/
int
-lptwrite(dev, uio)
+lptwrite(dev, uio, flags)
dev_t dev;
struct uio *uio;
+ int flags;
{
struct lpt_softc *sc = lpt_cd.cd_devs[LPTUNIT(dev)];
size_t n;
int error = 0;
- while (n = min(LPT_BSIZE, uio->uio_resid)) {
+ while ((n = min(LPT_BSIZE, uio->uio_resid)) != 0) {
uiomove(sc->sc_cp = sc->sc_inbuf->b_data, n, uio);
sc->sc_count = n;
error = pushbytes(sc);
@@ -554,11 +564,12 @@ lptintr(arg)
}
int
-lptioctl(dev, cmd, data, flag)
+lptioctl(dev, cmd, data, flag, p)
dev_t dev;
u_long cmd;
caddr_t data;
int flag;
+ struct proc *p;
{
int error = 0;
diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c
index 0381f74e1fd..851a367ef2c 100644
--- a/sys/dev/isa/mcd.c
+++ b/sys/dev/isa/mcd.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: mcd.c,v 1.10 1996/04/24 16:51:16 mickey Exp $ */
-/* $NetBSD: mcd.c,v 1.47 1996/04/11 22:29:43 cgd Exp $ */
+/* $OpenBSD: mcd.c,v 1.11 1996/05/07 07:37:20 deraadt Exp $ */
+/* $NetBSD: mcd.c,v 1.48 1996/04/29 20:28:44 christos Exp $ */
/*
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@@ -140,10 +140,9 @@ struct mcd_softc {
};
/* prototypes */
-int mcdopen __P((dev_t, int, int, struct proc *));
-int mcdclose __P((dev_t, int, int));
-int mcdioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-int mcdsize __P((dev_t));
+/* XXX does not belong here */
+cdev_decl(mcd);
+bdev_decl(mcd);
static int bcd2bin __P((bcd_t));
static bcd_t bin2bcd __P((int));
@@ -187,10 +186,13 @@ struct cfdriver mcd_cd = {
NULL, "mcd", DV_DISK
};
-void mcdgetdisklabel __P((struct mcd_softc *));
-int mcd_get_parms __P((struct mcd_softc *));
-void mcdstrategy __P((struct buf *));
-void mcdstart __P((struct mcd_softc *));
+void mcdgetdisklabel __P((struct mcd_softc *));
+int mcd_get_parms __P((struct mcd_softc *));
+void mcdstrategy __P((struct buf *));
+void mcdstart __P((struct mcd_softc *));
+int mcdlock __P((struct mcd_softc *));
+void mcdunlock __P((struct mcd_softc *));
+void mcd_pseudointr __P((void *));
struct dkdriver mcddkdriver = { mcdstrategy };
@@ -290,7 +292,7 @@ mcdopen(dev, flag, fmt, p)
if (!sc)
return ENXIO;
- if (error = mcdlock(sc))
+ if ((error = mcdlock(sc)) != 0)
return error;
if (sc->sc_dk.dk_openmask != 0) {
@@ -380,9 +382,10 @@ bad3:
}
int
-mcdclose(dev, flag, fmt)
+mcdclose(dev, flag, fmt, p)
dev_t dev;
int flag, fmt;
+ struct proc *p;
{
struct mcd_softc *sc = mcd_cd.cd_devs[MCDUNIT(dev)];
int part = MCDPART(dev);
@@ -390,7 +393,7 @@ mcdclose(dev, flag, fmt)
MCD_TRACE("close: partition=%d\n", part, 0, 0, 0);
- if (error = mcdlock(sc))
+ if ((error = mcdlock(sc)) != 0)
return error;
switch (fmt) {
@@ -428,7 +431,7 @@ mcdstrategy(bp)
bp->b_blkno, bp->b_bcount, 0);
if (bp->b_blkno < 0 ||
(bp->b_bcount % sc->blksize) != 0) {
- printf("%s: strategy: blkno = %d bcount = %d\n",
+ printf("%s: strategy: blkno = %d bcount = %ld\n",
sc->sc_dev.dv_xname, bp->b_blkno, bp->b_bcount);
bp->b_error = EINVAL;
goto bad;
@@ -528,18 +531,20 @@ loop:
}
int
-mcdread(dev, uio)
+mcdread(dev, uio, flags)
dev_t dev;
struct uio *uio;
+ int flags;
{
return (physio(mcdstrategy, NULL, dev, B_READ, minphys, uio));
}
int
-mcdwrite(dev, uio)
+mcdwrite(dev, uio, flags)
dev_t dev;
struct uio *uio;
+ int flags;
{
return (physio(mcdstrategy, NULL, dev, B_WRITE, minphys, uio));
@@ -577,7 +582,7 @@ mcdioctl(dev, cmd, addr, flag, p)
if ((flag & FWRITE) == 0)
return EBADF;
- if (error = mcdlock(sc))
+ if ((error = mcdlock(sc)) != 0)
return error;
sc->flags |= MCDF_LABELLING;
@@ -1010,9 +1015,10 @@ msf2hsg(msf, relative)
}
void
-mcd_pseudointr(sc)
- struct mcd_softc *sc;
+mcd_pseudointr(v)
+ void *v;
{
+ struct mcd_softc *sc = v;
int s;
s = splbio();
@@ -1163,7 +1169,6 @@ readerr:
printf("; giving up\n");
changed:
-harderr:
/* Invalidate the buffer. */
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount - mbx->skip;
diff --git a/sys/dev/isa/pas.c b/sys/dev/isa/pas.c
index 4227615cb36..c5697fa8ea0 100644
--- a/sys/dev/isa/pas.c
+++ b/sys/dev/isa/pas.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pas.c,v 1.9 1996/04/21 22:24:23 deraadt Exp $ */
-/* $NetBSD: pas.c,v 1.15 1996/04/11 22:29:48 cgd Exp $ */
+/* $OpenBSD: pas.c,v 1.10 1996/05/07 07:37:25 deraadt Exp $ */
+/* $NetBSD: pas.c,v 1.16 1996/04/29 20:03:28 christos Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -102,6 +102,7 @@ struct pas_softc {
int pasopen __P((dev_t, int));
int pas_getdev __P((void *, struct audio_device *));
+void pasconf __P((int, int, int, int));
/*
@@ -170,10 +171,12 @@ static struct audio_device pas_device = {
#define paswrite(d, p) outb(p, d)
void
-pasconf(int model, int sbbase, int sbirq, int sbdrq)
+pasconf(model, sbbase, sbirq, sbdrq)
+ int model;
+ int sbbase;
+ int sbirq;
+ int sbdrq;
{
- int i;
-
paswrite(0x00, INTERRUPT_MASK);
/* Local timer control register */
paswrite(0x36, SAMPLE_COUNTER_CONTROL);
diff --git a/sys/dev/isa/pcmcia_pcic.c b/sys/dev/isa/pcmcia_pcic.c
index dfcf2ea4a81..60f5c065ae4 100644
--- a/sys/dev/isa/pcmcia_pcic.c
+++ b/sys/dev/isa/pcmcia_pcic.c
@@ -1,4 +1,4 @@
-/* $Id: pcmcia_pcic.c,v 1.5 1996/04/29 14:16:53 hvozda Exp $ */
+/* $Id: pcmcia_pcic.c,v 1.6 1996/05/07 07:37:28 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996 John T. Kohl
* All rights reserved.
@@ -49,7 +49,6 @@
#include <sys/device.h>
#include <sys/proc.h>
#include <sys/user.h>
-#include <sys/cpu.h>
#include <machine/pio.h>
diff --git a/sys/dev/isa/pss.c b/sys/dev/isa/pss.c
index 9e551882061..b101ce3cfdd 100644
--- a/sys/dev/isa/pss.c
+++ b/sys/dev/isa/pss.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pss.c,v 1.8 1996/04/21 22:24:26 deraadt Exp $ */
-/* $NetBSD: pss.c,v 1.13 1996/04/11 22:29:52 cgd Exp $ */
+/* $OpenBSD: pss.c,v 1.9 1996/05/07 07:37:33 deraadt Exp $ */
+/* $NetBSD: pss.c,v 1.14 1996/04/29 20:00:39 christos Exp $ */
/*
* Copyright (c) 1994 John Brezak
@@ -150,16 +150,16 @@ int pssdebug = 0;
#define DPRINTF(x)
#endif
-int pssprobe();
+int pssprobe __P((struct device *, void *, void *));
void pssattach __P((struct device *, struct device *, void *));
-int spprobe();
+int spprobe __P((struct device *, void *, void *));
void spattach __P((struct device *, struct device *, void *));
-int mpuprobe();
+int mpuprobe __P((struct device *, void *, void *));
void mpuattach __P((struct device *, struct device *, void *));
-int pcdprobe();
+int pcdprobe __P((struct device *, void *, void *));
void pcdattach __P((struct device *, struct device *, void *));
int spopen __P((dev_t, int));
@@ -180,6 +180,28 @@ int pss_mixer_set_port __P((void *, mixer_ctrl_t *));
int pss_mixer_get_port __P((void *, mixer_ctrl_t *));
int pss_query_devinfo __P((void *, mixer_devinfo_t *));
+void pss_dspwrite __P((struct pss_softc *, int));
+void pss_setaddr __P((int, int));
+int pss_setint __P((int, int));
+int pss_setdma __P((int, int));
+int pss_testdma __P((struct pss_softc *, int));
+int pss_reset_dsp __P((struct pss_softc *));
+int pss_download_dsp __P((struct pss_softc *, u_char *, int));
+void pss_dump_regs __P((struct pss_softc *));
+int pss_set_master_gain __P((struct pss_softc *, struct ad1848_volume *));
+int pss_set_master_mode __P((struct pss_softc *, int));
+int pss_set_treble __P((struct pss_softc *, u_int));
+int pss_set_bass __P((struct pss_softc *, u_int));
+int pss_get_master_gain __P((struct pss_softc *, struct ad1848_volume *));
+int pss_get_master_mode __P((struct pss_softc *, u_int *));
+int pss_get_treble __P((struct pss_softc *, u_char *));
+int pss_get_bass __P((struct pss_softc *, u_char *));
+
+static int pss_to_vol __P((mixer_ctrl_t *, struct ad1848_volume *));
+static int pss_from_vol __P((mixer_ctrl_t *, struct ad1848_volume *));
+
+void wss_dump_regs __P((struct ad1848_softc *));
+
/*
* Define our interface to the higher level audio driver.
*/
@@ -277,7 +299,9 @@ struct audio_device pss_device = {
};
void
-pss_dspwrite(struct pss_softc *sc, int data)
+pss_dspwrite(sc, data)
+ struct pss_softc *sc;
+ int data;
{
int i;
int pss_base = sc->sc_iobase;
@@ -299,7 +323,9 @@ pss_dspwrite(struct pss_softc *sc, int data)
}
void
-pss_setaddr(int addr, int configAddr)
+pss_setaddr(addr, configAddr)
+ int addr;
+ int configAddr;
{
int val;
@@ -315,7 +341,9 @@ pss_setaddr(int addr, int configAddr)
* enable the chosen interrupt.
*/
int
-pss_setint(int intNum, int configAddress)
+pss_setint(intNum, configAddress)
+ int intNum;
+ int configAddress;
{
int val;
switch(intNum) {
@@ -374,7 +402,9 @@ pss_setint(int intNum, int configAddress)
}
int
-pss_setdma(int dmaNum, int configAddress)
+pss_setdma(dmaNum, configAddress)
+ int dmaNum;
+ int configAddress;
{
int val;
@@ -515,7 +545,9 @@ pss_testirq(struct pss_softc *sc, int intNum)
* is ok.
*/
int
-pss_testdma(struct pss_softc *sc, int dmaNum)
+pss_testdma(sc, dmaNum)
+ struct pss_softc *sc;
+ int dmaNum;
{
int iobase = sc->sc_iobase;
int val;
@@ -588,7 +620,8 @@ pss_testdma(struct pss_softc *sc, int dmaNum)
}
int
-pss_reset_dsp(struct pss_softc *sc)
+pss_reset_dsp(sc)
+ struct pss_softc *sc;
{
u_long i;
int pss_base = sc->sc_iobase;
@@ -615,7 +648,10 @@ pss_reset_dsp(struct pss_softc *sc)
* byte which removes BR.
*/
int
-pss_download_dsp(struct pss_softc *sc, u_char *block, int size)
+pss_download_dsp(sc, block, size)
+ struct pss_softc *sc;
+ u_char *block;
+ int size;
{
int i, val, count;
int pss_base = sc->sc_iobase;
@@ -685,7 +721,8 @@ pss_download_dsp(struct pss_softc *sc, u_char *block, int size)
}
void
-wss_dump_regs(struct ad1848_softc *sc)
+wss_dump_regs(sc)
+ struct ad1848_softc *sc;
{
printf("WSS regs: config=%x version=%x\n",
(u_char)inb(sc->sc_iobase+WSS_CONFIG),
@@ -693,7 +730,8 @@ wss_dump_regs(struct ad1848_softc *sc)
}
void
-pss_dump_regs(struct pss_softc *sc)
+pss_dump_regs(sc)
+ struct pss_softc *sc;
{
printf("PSS regs: status=%x vers=%x ",
(u_short)inw(sc->sc_iobase+PSS_STATUS),
@@ -709,13 +747,13 @@ pss_dump_regs(struct pss_softc *sc)
*/
int
pssprobe(parent, self, aux)
- struct device *parent, *self;
+ struct device *parent;
+ void *self;
void *aux;
{
- struct pss_softc *sc = (void *)self;
+ struct pss_softc *sc = self;
struct isa_attach_args *ia = aux;
int iobase = ia->ia_iobase;
- int i;
if (!PSS_BASE_VALID(iobase)) {
printf("pss: configured iobase %x invalid\n", iobase);
@@ -812,8 +850,8 @@ spprobe(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct ad1848_softc *sc = (void *)match;
- struct pss_softc *pc = (void *)parent;
+ struct ad1848_softc *sc = match;
+ struct pss_softc *pc = (void *) parent;
struct cfdata *cf = (void *)sc->sc_dev.dv_cfdata;
u_char bits;
int i;
@@ -906,8 +944,8 @@ mpuprobe(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct mpu_softc *sc = (void *)match;
- struct pss_softc *pc = (void *)parent;
+ struct mpu_softc *sc = match;
+ struct pss_softc *pc = (void *) parent;
struct cfdata *cf = (void *)sc->sc_dev.dv_cfdata;
/* Check if midi is enabled; if it is check the interrupt */
@@ -951,8 +989,8 @@ pcdprobe(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct cd_softc *sc = (void *)match;
- struct pss_softc *pc = (void *)parent;
+ struct cd_softc *sc = match;
+ struct pss_softc *pc = (void *) parent;
struct cfdata *cf = (void *)sc->sc_dev.dv_cfdata;
u_short val;
@@ -964,7 +1002,7 @@ pcdprobe(parent, match, aux)
val = inw(pc->sc_iobase+CD_CONFIG);
outw(pc->sc_iobase+CD_CONFIG, 0);
val &= CD_POL_MASK;
- val | CD_POL_BIT; /* XXX if (pol) */
+ val |= CD_POL_BIT; /* XXX if (pol) */
outw(pc->sc_iobase+CD_CONFIG, val);
if (cf->cf_irq == IRQUNK) {
@@ -1233,7 +1271,7 @@ pss_set_master_mode(sc, mode)
int
pss_set_treble(sc, treb)
register struct pss_softc *sc;
- u_char treb;
+ u_int treb;
{
DPRINTF(("pss_set_treble: %d\n", treb));
@@ -1348,7 +1386,7 @@ mpuintr(arg)
sr = inb(sc->sc_iobase+MIDI_STATUS_REG);
- printf("mpuintr: sc=%x sr=%x\n", sc, sr);
+ printf("mpuintr: sc=%p sr=%x\n", sc, sr);
/* XXX Need to clear intr */
return 1;
@@ -1410,7 +1448,6 @@ pss_set_in_port(addr, port)
int port;
{
register struct ad1848_softc *ac = addr;
- register struct pss_softc *sc = ac->parent;
DPRINTF(("pss_set_in_port: %d\n", port));
@@ -1437,7 +1474,6 @@ pss_get_in_port(addr)
void *addr;
{
register struct ad1848_softc *ac = addr;
- register struct pss_softc *sc = ac->parent;
int port = PSS_MIC_IN_LVL;
switch(ad1848_get_rec_port(ac)) {
@@ -1465,7 +1501,6 @@ pss_mixer_set_port(addr, cp)
register struct ad1848_softc *ac = addr;
register struct pss_softc *sc = ac->parent;
struct ad1848_volume vol;
- u_char eq;
int error = EINVAL;
DPRINTF(("pss_mixer_set_port: dev=%d type=%d\n", cp->dev, cp->type));
@@ -1692,9 +1727,6 @@ pss_query_devinfo(addr, dip)
void *addr;
register mixer_devinfo_t *dip;
{
- register struct ad1848_softc *ac = addr;
- register struct pss_softc *sc = ac->parent;
-
DPRINTF(("pss_query_devinfo: index=%d\n", dip->index));
switch(dip->index) {
diff --git a/sys/dev/isa/sb.c b/sys/dev/isa/sb.c
index 09fd816e061..8e08f39b818 100644
--- a/sys/dev/isa/sb.c
+++ b/sys/dev/isa/sb.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sb.c,v 1.9 1996/04/21 22:24:30 deraadt Exp $ */
-/* $NetBSD: sb.c,v 1.34 1996/04/11 22:30:01 cgd Exp $ */
+/* $OpenBSD: sb.c,v 1.10 1996/05/07 07:37:37 deraadt Exp $ */
+/* $NetBSD: sb.c,v 1.35 1996/04/29 20:03:29 christos Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -271,7 +271,6 @@ sbattach(parent, self, aux)
{
register struct sbdsp_softc *sc = (struct sbdsp_softc *)self;
struct isa_attach_args *ia = (struct isa_attach_args *)aux;
- register int iobase = ia->ia_iobase;
int err;
sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
diff --git a/sys/dev/isa/sbdsp.c b/sys/dev/isa/sbdsp.c
index b5fcce0c5ea..448cee0acab 100644
--- a/sys/dev/isa/sbdsp.c
+++ b/sys/dev/isa/sbdsp.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sbdsp.c,v 1.4 1996/04/18 23:47:47 niklas Exp $ */
-/* $NetBSD: sbdsp.c,v 1.24 1996/03/16 04:00:11 jtk Exp $ */
+/* $OpenBSD: sbdsp.c,v 1.5 1996/05/07 07:37:41 deraadt Exp $ */
+/* $NetBSD: sbdsp.c,v 1.25 1996/04/29 20:03:31 christos Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -120,9 +120,21 @@ u_int sbdsp_jazz16_probe __P((struct sbdsp_softc *));
#define SB_DAC_LS_MAX 0xd4 /* 22727 Hz */
#define SB_DAC_HS_MAX 0xea /* 45454 Hz */
+int sbdsp16_wait __P((int));
+void sbdsp_to __P((void *));
+void sbdsp_pause __P((struct sbdsp_softc *));
+int sbdsp_setrate __P((struct sbdsp_softc *, int, int, int *));
+int sbdsp_tctosr __P((struct sbdsp_softc *, int));
+int sbdsp_set_timeconst __P((struct sbdsp_softc *, int));
+
+#ifdef AUDIO_DEBUG
+void sb_printsc __P((struct sbdsp_softc *));
+#endif
+
#ifdef AUDIO_DEBUG
void
-sb_printsc(struct sbdsp_softc *sc)
+sb_printsc(sc)
+ struct sbdsp_softc *sc;
{
int i;
@@ -153,7 +165,6 @@ int
sbdsp_probe(sc)
struct sbdsp_softc *sc;
{
- register int iobase = sc->sc_iobase;
if (sbdsp_reset(sc) < 0) {
DPRINTF(("sbdsp: couldn't reset card\n"));
@@ -223,7 +234,6 @@ void
sbdsp_attach(sc)
struct sbdsp_softc *sc;
{
- register int iobase = sc->sc_iobase;
/* Set defaults */
if (ISSB16CLASS(sc))
@@ -359,8 +369,6 @@ sbdsp_query_encoding(addr, fp)
void *addr;
struct audio_encoding *fp;
{
- register struct sbdsp_softc *sc = addr;
-
switch (fp->index) {
case 0:
strcpy(fp->name, AudioEmulaw);
@@ -476,7 +484,7 @@ sbdsp_set_ifilter(addr, which)
int which;
{
register struct sbdsp_softc *sc = addr;
- int rval, mixval;
+ int mixval;
if (ISSBPROCLASS(sc)) {
mixval = sbdsp_mix_read(sc, SBP_INFILTER) & ~SBP_IFILTER_MASK;
@@ -1098,7 +1106,7 @@ sbdsp_dma_input(addr, p, cc, intr, arg)
void *addr;
void *p;
int cc;
- void (*intr)();
+ void (*intr) __P((void *));
void *arg;
{
register struct sbdsp_softc *sc = addr;
@@ -1214,7 +1222,7 @@ sbdsp_dma_output(addr, p, cc, intr, arg)
void *addr;
void *p;
int cc;
- void (*intr)();
+ void (*intr) __P((void *));
void *arg;
{
register struct sbdsp_softc *sc = addr;
@@ -1490,6 +1498,8 @@ sbdsp_mixer_set_port(addr, cp)
return EINVAL;
}
break;
+ default:
+ return EINVAL;
}
switch (cp->dev) {
@@ -1511,6 +1521,8 @@ sbdsp_mixer_set_port(addr, cp)
case SB_CD_PORT:
src = SBP_CD_VOL;
break;
+ default:
+ return EINVAL;
}
sbdsp_mix_write(sc, src, gain);
diff --git a/sys/dev/isa/sbdspvar.h b/sys/dev/isa/sbdspvar.h
index 0016dc36872..c290671ac4b 100644
--- a/sys/dev/isa/sbdspvar.h
+++ b/sys/dev/isa/sbdspvar.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: sbdspvar.h,v 1.4 1996/04/18 23:47:48 niklas Exp $ */
-/* $NetBSD: sbdspvar.h,v 1.12 1996/03/16 04:00:13 jtk Exp $ */
+/* $OpenBSD: sbdspvar.h,v 1.5 1996/05/07 07:37:46 deraadt Exp $ */
+/* $NetBSD: sbdspvar.h,v 1.13 1996/04/29 20:28:50 christos Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -180,8 +180,8 @@ int sbdsp_get_avail_out_ports __P((void *));
int sbdsp_speaker_ctl __P((void *, int));
int sbdsp_commit_settings __P((void *));
-int sbdsp_dma_output __P((void *, void *, int, void (*)(), void*));
-int sbdsp_dma_input __P((void *, void *, int, void (*)(), void*));
+int sbdsp_dma_output __P((void *, void *, int, void (*)(void *), void*));
+int sbdsp_dma_input __P((void *, void *, int, void (*)(void *), void*));
int sbdsp_haltdma __P((void *));
int sbdsp_contdma __P((void *));
diff --git a/sys/dev/isa/seagate.c b/sys/dev/isa/seagate.c
index 67e70d04696..d426bd3db8a 100644
--- a/sys/dev/isa/seagate.c
+++ b/sys/dev/isa/seagate.c
@@ -260,12 +260,14 @@ static const BiosSignature signatures[] = {
#define nsignatures (sizeof(signatures) / sizeof(signatures[0]))
+#ifdef notdef
static const char *bases[] = {
(char *) 0xc8000, (char *) 0xca000, (char *) 0xcc000,
(char *) 0xce000, (char *) 0xdc000, (char *) 0xde000
};
#define nbases (sizeof(bases) / sizeof(bases[0]))
+#endif
int seaintr __P((void *));
int sea_scsi_cmd __P((struct scsi_xfer *));
@@ -383,7 +385,7 @@ seaprobe(parent, match, aux)
break;
default:
#ifdef DIAGNOSTIC
- printf("%s: board type unknown at address 0x%lx\n",
+ printf("%s: board type unknown at address %p\n",
sea->sc_dev.dv_xname, sea->maddr);
#endif
return 0;
@@ -629,8 +631,9 @@ sea_get_scb(sea, flags)
break;
}
if (sea->numscbs < SEA_SCB_MAX) {
- if (scb = (struct sea_scb *) malloc(sizeof(struct sea_scb),
- M_TEMP, M_NOWAIT)) {
+ scb = (struct sea_scb *) malloc(sizeof(struct sea_scb),
+ M_TEMP, M_NOWAIT);
+ if (scb) {
bzero(scb, sizeof(struct sea_scb));
sea->numscbs++;
} else
@@ -884,6 +887,7 @@ sea_reselect(sea)
printf("%s: expecting IDENTIFY message, got 0x%x\n",
sea->sc_dev.dv_xname, msg[0]);
abort = 1;
+ scb = NULL;
} else {
lun = msg[0] & 0x07;
diff --git a/sys/dev/isa/ultra14f.c b/sys/dev/isa/ultra14f.c
index 79464cc4d6c..2db41f76b9c 100644
--- a/sys/dev/isa/ultra14f.c
+++ b/sys/dev/isa/ultra14f.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ultra14f.c,v 1.13 1996/04/21 22:24:36 deraadt Exp $ */
-/* $NetBSD: ultra14f.c,v 1.64 1996/04/11 22:30:20 cgd Exp $ */
+/* $OpenBSD: ultra14f.c,v 1.14 1996/05/07 07:37:54 deraadt Exp $ */
+/* $NetBSD: ultra14f.c,v 1.65 1996/04/29 19:51:30 christos Exp $ */
/*
* Copyright (c) 1994 Charles Hannum. All rights reserved.
@@ -264,11 +264,11 @@ struct uha_softc {
int sc_iobase;
int sc_irq, sc_drq;
- void (*send_mbox)();
- int (*abort)();
- int (*poll)();
- int (*intr)();
- void (*init)();
+ void (*send_mbox) __P((struct uha_softc *, struct uha_mscp *));
+ int (*abort) __P((struct uha_softc *, struct uha_mscp *));
+ int (*poll) __P((struct uha_softc *, struct scsi_xfer *, int));
+ int (*intr) __P((void *));
+ void (*init) __P((struct uha_softc *));
struct uha_mscp *mscphash[MSCP_HASH_SIZE];
TAILQ_HEAD(, uha_mscp) free_mscp;
@@ -302,6 +302,9 @@ void uha_timeout __P((void *arg));
void uha_print_mscp __P((struct uha_mscp *));
void uha_print_active_mscp __P((struct uha_softc *));
#endif
+static __inline void uha_init_mscp __P((struct uha_softc *, struct uha_mscp *));
+static __inline void uha_reset_mscp __P((struct uha_softc *,
+ struct uha_mscp *));
u_long scratch;
#define UHA_SHOWMSCPS 0x01
@@ -811,7 +814,7 @@ uha_free_mscp(uha, mscp, flags)
splx(s);
}
-static inline void
+static __inline void
uha_init_mscp(uha, mscp)
struct uha_softc *uha;
struct uha_mscp *mscp;
@@ -829,7 +832,7 @@ uha_init_mscp(uha, mscp)
uha->mscphash[hashnum] = mscp;
}
-static inline void
+static __inline void
uha_reset_mscp(uha, mscp)
struct uha_softc *uha;
struct uha_mscp *mscp;
@@ -864,8 +867,10 @@ uha_get_mscp(uha, flags)
break;
}
if (uha->nummscps < UHA_MSCP_MAX) {
- if (mscp = (struct uha_mscp *) malloc(sizeof(struct uha_mscp),
- M_TEMP, M_NOWAIT)) {
+ mscp = (struct uha_mscp *)
+ malloc(sizeof(struct uha_mscp),
+ M_TEMP, M_NOWAIT);
+ if (mscp) {
uha_init_mscp(uha, mscp);
uha->nummscps++;
} else {
@@ -1156,7 +1161,9 @@ uha_scsi_cmd(xs)
int seg; /* scatter gather seg being worked on */
u_long thiskv, thisphys, nextphys;
int bytes_this_seg, bytes_this_page, datalen, flags;
+#ifdef TFS
struct iovec *iovp;
+#endif
int s;
SC_DEBUG(sc_link, SDEV_DB2, ("uha_scsi_cmd\n"));
diff --git a/sys/dev/isa/wd.c b/sys/dev/isa/wd.c
index 293048e8981..8b22c59e798 100644
--- a/sys/dev/isa/wd.c
+++ b/sys/dev/isa/wd.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: wd.c,v 1.11 1996/04/29 14:17:00 hvozda Exp $ */
-/* $NetBSD: wd.c,v 1.148 1996/04/11 22:30:31 cgd Exp $ */
+/* $OpenBSD: wd.c,v 1.12 1996/05/07 07:37:58 deraadt Exp $ */
+/* $NetBSD: wd.c,v 1.149 1996/04/29 19:50:47 christos Exp $ */
/*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
@@ -47,6 +47,7 @@
#include <sys/disklabel.h>
#include <sys/disk.h>
#include <sys/syslog.h>
+#include <sys/proc.h>
#include <vm/vm.h>
@@ -137,8 +138,9 @@ struct wdc_softc {
u_char sc_error; /* copy of error register */
};
-int wdcprobe __P((struct device *, void *, void *));
-void wdcattach __P((struct device *, struct device *, void *));
+int wdcprobe __P((struct device *, void *, void *));
+void wdcattach __P((struct device *, struct device *, void *));
+int wdcintr __P((void *));
struct cfattach wdc_ca = {
sizeof(struct wdc_softc), wdcprobe, wdcattach
@@ -150,6 +152,7 @@ struct cfdriver wdc_cd = {
int wdprobe __P((struct device *, void *, void *));
void wdattach __P((struct device *, struct device *, void *));
+int wdprint __P((void *, char *));
struct cfattach wd_ca = {
sizeof(struct wd_softc), wdprobe, wdattach
@@ -159,27 +162,34 @@ struct cfdriver wd_cd = {
NULL, "wd", DV_DISK
};
-void wdgetdisklabel __P((struct wd_softc *));
-int wd_get_parms __P((struct wd_softc *));
-void wdstrategy __P((struct buf *));
-void wdstart __P((struct wd_softc *));
+void wdgetdisklabel __P((struct wd_softc *));
+int wd_get_parms __P((struct wd_softc *));
+void wdstrategy __P((struct buf *));
+void wdstart __P((struct wd_softc *));
struct dkdriver wddkdriver = { wdstrategy };
-void wdfinish __P((struct wd_softc *, struct buf *));
-int wdcintr __P((void *));
-void wdcstart __P((struct wdc_softc *));
-int wdcommand __P((struct wd_softc *, int, int, int, int, int));
-int wdcommandshort __P((struct wdc_softc *, int, int));
-int wdcontrol __P((struct wd_softc *));
-int wdsetctlr __P((struct wd_softc *));
+/* XXX: these should go elsewhere */
+cdev_decl(wd);
+bdev_decl(wd);
+
+void wdfinish __P((struct wd_softc *, struct buf *));
+int dcintr __P((void *));
+void wdcstart __P((struct wdc_softc *));
+int wdcommand __P((struct wd_softc *, int, int, int, int, int));
+int wdcommandshort __P((struct wdc_softc *, int, int));
+int wdcontrol __P((struct wd_softc *));
+int wdsetctlr __P((struct wd_softc *));
static void bad144intern __P((struct wd_softc *));
-int wdcreset __P((struct wdc_softc *));
-void wdcrestart __P((void *arg));
-void wdcunwedge __P((struct wdc_softc *));
-void wdctimeout __P((void *arg));
-void wderror __P((void *, struct buf *, char *));
-int wdcwait __P((struct wdc_softc *, int));
+int wdcreset __P((struct wdc_softc *));
+void wdcrestart __P((void *arg));
+void wdcunwedge __P((struct wdc_softc *));
+void wdctimeout __P((void *arg));
+void wderror __P((void *, struct buf *, char *));
+int wdcwait __P((struct wdc_softc *, int));
+int wdlock __P((struct wd_softc *));
+void wdunlock __P((struct wd_softc *));
+
/* ST506 spec says that if READY or SEEKCMPLT go off, then the read or write
command is aborted. */
#define wait_for_drq(d) wdcwait(d, WDCS_DRDY | WDCS_DSC | WDCS_DRQ)
@@ -479,18 +489,20 @@ wdfinish(wd, bp)
}
int
-wdread(dev, uio)
+wdread(dev, uio, flags)
dev_t dev;
struct uio *uio;
+ int flags;
{
return (physio(wdstrategy, NULL, dev, B_READ, minphys, uio));
}
int
-wdwrite(dev, uio)
+wdwrite(dev, uio, flags)
dev_t dev;
struct uio *uio;
+ int flags;
{
return (physio(wdstrategy, NULL, dev, B_WRITE, minphys, uio));
@@ -685,6 +697,11 @@ loop:
command = (bp->b_flags & B_READ) ?
WDCC_READ : WDCC_WRITE;
break;
+ default:
+#ifdef DIAGNOSTIC
+ panic("bad wd mode");
+#endif
+ return;
}
/* Initiate command! */
@@ -798,7 +815,9 @@ wdcintr(arg)
return 1;
wderror(wd, bp, "hard error");
+#ifdef B_FORMAT
bad:
+#endif
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
goto done;
@@ -887,9 +906,10 @@ wdunlock(wd)
}
int
-wdopen(dev, flag, fmt)
+wdopen(dev, flag, fmt, p)
dev_t dev;
int flag, fmt;
+ struct proc *p;
{
struct wd_softc *wd;
int unit, part;
@@ -902,7 +922,7 @@ wdopen(dev, flag, fmt)
if (wd == 0)
return ENXIO;
- if (error = wdlock(wd))
+ if ((error = wdlock(wd)) != 0)
return error;
if (wd->sc_dk.dk_openmask != 0) {
@@ -966,15 +986,16 @@ bad3:
}
int
-wdclose(dev, flag, fmt)
+wdclose(dev, flag, fmt, p)
dev_t dev;
int flag, fmt;
+ struct proc *p;
{
struct wd_softc *wd = wd_cd.cd_devs[WDUNIT(dev)];
int part = WDPART(dev);
int error;
- if (error = wdlock(wd))
+ if ((error = wdlock(wd)) != 0)
return error;
switch (fmt) {
@@ -1212,7 +1233,6 @@ int
wdsetctlr(wd)
struct wd_softc *wd;
{
- struct wdc_softc *wdc = (void *)wd->sc_dev.dv_parent;
#ifdef WDDEBUG
printf("wd(%d,%d) C%dH%dS%d\n", wd->sc_dev.dv_unit, wd->sc_drive,
@@ -1345,7 +1365,7 @@ wdioctl(dev, cmd, addr, flag, p)
if ((flag & FWRITE) == 0)
return EBADF;
- if (error = wdlock(wd))
+ if ((error = wdlock(wd)) != 0)
return error;
wd->sc_flags |= WDF_LABELLING;
@@ -1429,7 +1449,7 @@ wdsize(dev)
int part;
int size;
- if (wdopen(dev, 0, S_IFBLK) != 0)
+ if (wdopen(dev, 0, S_IFBLK, NULL) != 0)
return -1;
wd = wd_cd.cd_devs[WDUNIT(dev)];
part = WDPART(dev);
@@ -1437,7 +1457,7 @@ wdsize(dev)
size = -1;
else
size = wd->sc_dk.dk_label->d_partitions[part].p_size;
- if (wdclose(dev, 0, S_IFBLK) != 0)
+ if (wdclose(dev, 0, S_IFBLK, NULL) != 0)
return -1;
return size;
}
@@ -1687,7 +1707,9 @@ wdcwait(wdc, mask)
int iobase = wdc->sc_iobase;
int timeout = 0;
u_char status;
+#ifdef WDCNDELAY_DEBUG
extern int cold;
+#endif
for (;;) {
wdc->sc_status = status = inb(iobase+wd_status);
diff --git a/sys/dev/isa/wds.c b/sys/dev/isa/wds.c
index c102f7008af..a5135b02f0c 100644
--- a/sys/dev/isa/wds.c
+++ b/sys/dev/isa/wds.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wds.c,v 1.4 1996/04/11 22:30:38 cgd Exp $ */
+/* $NetBSD: wds.c,v 1.5 1996/04/29 19:48:26 christos Exp $ */
#define WDSDIAG
#define integrate
@@ -370,11 +370,7 @@ wdsintr(arg)
{
struct wds_softc *sc = arg;
int iobase = sc->sc_iobase;
- u_char sts;
-
- struct wds_mbx_in *in;
- struct wds_scb *scb;
- u_char stat, c;
+ u_char c;
/* Was it really an interrupt from the board? */
if ((inb(iobase + WDS_STAT) & WDSS_IRQ) == 0)
@@ -396,7 +392,8 @@ wdsintr(arg)
break;
default:
- printf("%s: unrecognized interrupt type %02x", c);
+ printf("%s: unrecognized interrupt type %02x",
+ sc->sc_dev.dv_xname, c);
break;
}
@@ -639,12 +636,11 @@ wds_start_scbs(sc)
int iobase = sc->sc_iobase;
struct wds_mbx_out *wmbo; /* Mail Box Out pointer */
struct wds_scb *scb;
- int i;
u_char c;
wmbo = wmbx->tmbo;
- while (scb = sc->sc_waiting_scb.tqh_first) {
+ while ((scb = sc->sc_waiting_scb.tqh_first) != NULL) {
if (sc->sc_mbofull >= WDS_MBX_SIZE) {
wds_collect_mbo(sc);
if (sc->sc_mbofull >= WDS_MBX_SIZE) {
@@ -674,7 +670,6 @@ wds_start_scbs(sc)
if ((scb->flags & SCB_POLLED) == 0)
timeout(wds_timeout, scb, (scb->timeout * hz) / 1000);
- next:
++sc->sc_mbofull;
wds_nextmbx(wmbo, wmbx, mbo);
}
@@ -692,7 +687,6 @@ wds_done(sc, scb, stat)
u_char stat;
{
struct scsi_xfer *xs = scb->xs;
- int i, x;
/* XXXXX */
@@ -964,7 +958,9 @@ wds_scsi_cmd(xs)
int seg;
u_long thiskv, thisphys, nextphys;
int bytes_this_seg, bytes_this_page, datalen, flags;
+#ifdef TFS
struct iovec *iovp;
+#endif
int s;
int iobase;
@@ -1163,8 +1159,6 @@ wds_sense(sc, scb)
struct scsi_xfer *xs = scb->xs;
struct scsi_sense *ss = (void *)&scb->sense.scb;
int s;
- u_char c;
- int i;
/* XXXXX */
diff --git a/sys/dev/isa/wss.c b/sys/dev/isa/wss.c
index 7e9b14296bf..2c1f914fdf6 100644
--- a/sys/dev/isa/wss.c
+++ b/sys/dev/isa/wss.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: wss.c,v 1.9 1996/04/24 16:51:15 mickey Exp $ */
-/* $NetBSD: wss.c,v 1.11 1996/04/11 22:30:46 cgd Exp $ */
+/* $OpenBSD: wss.c,v 1.10 1996/05/07 07:38:08 deraadt Exp $ */
+/* $NetBSD: wss.c,v 1.12 1996/04/29 19:46:09 christos Exp $ */
/*
* Copyright (c) 1994 John Brezak
@@ -115,6 +115,8 @@ int wss_mixer_set_port __P((void *, mixer_ctrl_t *));
int wss_mixer_get_port __P((void *, mixer_ctrl_t *));
int wss_query_devinfo __P((void *, mixer_devinfo_t *));
+static int wss_to_vol __P((mixer_ctrl_t *, struct ad1848_volume *));
+static int wss_from_vol __P((mixer_ctrl_t *, struct ad1848_volume *));
/*
* Define our interface to the higher level audio driver.
*/
@@ -368,7 +370,6 @@ wss_set_in_port(addr, port)
int port;
{
register struct ad1848_softc *ac = addr;
- register struct wss_softc *sc = ac->parent;
DPRINTF(("wss_set_in_port: %d\n", port));
@@ -395,7 +396,6 @@ wss_get_in_port(addr)
void *addr;
{
register struct ad1848_softc *ac = addr;
- register struct wss_softc *sc = ac->parent;
int port = WSS_MIC_IN_LVL;
switch(ad1848_get_rec_port(ac)) {
@@ -423,7 +423,6 @@ wss_mixer_set_port(addr, cp)
register struct ad1848_softc *ac = addr;
register struct wss_softc *sc = ac->parent;
struct ad1848_volume vol;
- u_char eq;
int error = EINVAL;
DPRINTF(("wss_mixer_set_port: dev=%d type=%d\n", cp->dev, cp->type));
@@ -510,7 +509,6 @@ wss_mixer_get_port(addr, cp)
register struct ad1848_softc *ac = addr;
register struct wss_softc *sc = ac->parent;
struct ad1848_volume vol;
- u_char eq;
int error = EINVAL;
DPRINTF(("wss_mixer_get_port: port=%d\n", cp->dev));
@@ -597,9 +595,6 @@ wss_query_devinfo(addr, dip)
void *addr;
register mixer_devinfo_t *dip;
{
- register struct ad1848_softc *ac = addr;
- register struct wss_softc *sc = ac->parent;
-
DPRINTF(("wss_query_devinfo: index=%d\n", dip->index));
switch(dip->index) {
diff --git a/sys/dev/isa/wt.c b/sys/dev/isa/wt.c
index 70e051a7694..9d55fa4880d 100644
--- a/sys/dev/isa/wt.c
+++ b/sys/dev/isa/wt.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: wt.c,v 1.8 1996/04/21 22:24:52 deraadt Exp $ */
-/* $NetBSD: wt.c,v 1.31 1996/04/11 22:30:49 cgd Exp $ */
+/* $OpenBSD: wt.c,v 1.9 1996/05/07 07:38:11 deraadt Exp $ */
+/* $NetBSD: wt.c,v 1.32 1996/04/29 19:45:32 christos Exp $ */
/*
* Streamer tape driver.
@@ -60,6 +60,8 @@
#include <sys/ioctl.h>
#include <sys/mtio.h>
#include <sys/device.h>
+#include <sys/proc.h>
+#include <sys/conf.h>
#include <vm/vm_param.h>
@@ -150,6 +152,10 @@ struct wt_softc {
u_char BUSY, NOEXCEP, RESETMASK, RESETVAL, ONLINE, RESET, REQUEST, IEN;
};
+/* XXX: These don't belong here really */
+cdev_decl(wt);
+bdev_decl(wt);
+
int wtwait __P((struct wt_softc *sc, int catch, char *msg));
int wtcmd __P((struct wt_softc *sc, int cmd));
int wtstart __P((struct wt_softc *sc, int flag, void *vaddr, size_t len));
@@ -283,9 +289,11 @@ wtsize(dev)
* Open routine, called on every device open.
*/
int
-wtopen(dev, flag)
+wtopen(dev, flag, mode, p)
dev_t dev;
int flag;
+ int mode;
+ struct proc *p;
{
int unit = minor(dev) & T_UNIT;
struct wt_softc *sc;
@@ -304,7 +312,7 @@ wtopen(dev, flag)
/* If the tape is in rewound state, check the status and set density. */
if (sc->flags & TPSTART) {
/* If rewind is going on, wait */
- if (error = wtwait(sc, PCATCH, "wtrew"))
+ if ((error = wtwait(sc, PCATCH, "wtrew")) != 0)
return error;
/* Check the controller status */
@@ -372,8 +380,11 @@ wtopen(dev, flag)
* Close routine, called on last device close.
*/
int
-wtclose(dev)
+wtclose(dev, flags, mode, p)
dev_t dev;
+ int flags;
+ int mode;
+ struct proc *p;
{
int unit = minor(dev) & T_UNIT;
struct wt_softc *sc = wt_cd.cd_devs[unit];
@@ -423,11 +434,12 @@ done:
* ioctl(int fd, WTQICMD, int qicop) -- do QIC op
*/
int
-wtioctl(dev, cmd, addr, flag)
+wtioctl(dev, cmd, addr, flag, p)
dev_t dev;
u_long cmd;
- void *addr;
+ caddr_t addr;
int flag;
+ struct proc *p;
{
int unit = minor(dev) & T_UNIT;
struct wt_softc *sc = wt_cd.cd_devs[unit];
@@ -444,11 +456,11 @@ wtioctl(dev, cmd, addr, flag)
case QIC_ERASE: /* erase the whole tape */
if ((sc->flags & TPWRITE) == 0 || (sc->flags & TPWP))
return EACCES;
- if (error = wtwait(sc, PCATCH, "wterase"))
+ if ((error = wtwait(sc, PCATCH, "wterase")) != 0)
return error;
break;
case QIC_RETENS: /* retension the tape */
- if (error = wtwait(sc, PCATCH, "wtretens"))
+ if ((error = wtwait(sc, PCATCH, "wtretens")) != 0)
return error;
break;
}
@@ -494,25 +506,25 @@ wtioctl(dev, cmd, addr, flag)
case MTOFFL: /* rewind and put the drive offline */
if (sc->flags & TPREW) /* rewind is running */
return 0;
- if (error = wtwait(sc, PCATCH, "wtorew"))
+ if ((error = wtwait(sc, PCATCH, "wtorew")) != 0)
return error;
wtrewind(sc);
return 0;
case MTFSF: /* forward space file */
for (count = ((struct mtop*)addr)->mt_count; count > 0;
--count) {
- if (error = wtwait(sc, PCATCH, "wtorfm"))
+ if ((error = wtwait(sc, PCATCH, "wtorfm")) != 0)
return error;
- if (error = wtreadfm(sc))
+ if ((error = wtreadfm(sc)) != 0)
return error;
}
return 0;
case MTWEOF: /* write an end-of-file record */
if ((sc->flags & TPWRITE) == 0 || (sc->flags & TPWP))
return EACCES;
- if (error = wtwait(sc, PCATCH, "wtowfm"))
+ if ((error = wtwait(sc, PCATCH, "wtowfm")) != 0)
return error;
- if (error = wtwritefm(sc))
+ if ((error = wtwritefm(sc)) != 0)
return error;
return 0;
}
@@ -601,18 +613,20 @@ xit:
}
int
-wtread(dev, uio)
+wtread(dev, uio, flags)
dev_t dev;
struct uio *uio;
+ int flags;
{
return (physio(wtstrategy, NULL, dev, B_READ, minphys, uio));
}
int
-wtwrite(dev, uio)
+wtwrite(dev, uio, flags)
dev_t dev;
struct uio *uio;
+ int flags;
{
return (physio(wtstrategy, NULL, dev, B_WRITE, minphys, uio));
@@ -843,7 +857,7 @@ wtwait(sc, catch, msg)
WTDBPRINT(("wtwait() `%s'\n", msg));
while (sc->flags & (TPACTIVE | TPREW | TPRMARK | TPWMARK))
- if (error = tsleep((caddr_t)sc, WTPRI | catch, msg, 0))
+ if ((error = tsleep((caddr_t)sc, WTPRI | catch, msg, 0)) != 0)
return error;
return 0;
}
diff --git a/sys/dev/microcode/aic7xxx/aic7xxx_asm.c b/sys/dev/microcode/aic7xxx/aic7xxx_asm.c
index 698fa4e08b3..2d2a47efb4a 100644
--- a/sys/dev/microcode/aic7xxx/aic7xxx_asm.c
+++ b/sys/dev/microcode/aic7xxx/aic7xxx_asm.c
@@ -43,7 +43,7 @@
* are token separators.
*
*-M*************************************************************************/
-static char id[] = "$Id: aic7xxx_asm.c,v 1.2 1996/05/05 12:42:38 deraadt Exp $";
+static char id[] = "$Id: aic7xxx_asm.c,v 1.3 1996/05/07 07:38:22 deraadt Exp $";
#include <ctype.h>
#include <stdio.h>
#include <string.h>
@@ -87,7 +87,9 @@ Malloc(size_t size)
}
void *
-Realloc(void *ptr, size_t size)
+Realloc(ptr, size)
+ void *ptr;
+ size_t size;
{
void *p = realloc(ptr, size);
if (!p)
@@ -141,7 +143,8 @@ define(char *name, int value)
}
sym_t *
-lookup(char *name)
+lookup(name)
+ char *name;
{
sym_t *p;
@@ -160,7 +163,7 @@ patch(sym_t *p, int location)
p->patch[p->npatch - 1] = location;
}
-void backpatch(void)
+void backpatch()
{
int i;
sym_t *p;
@@ -200,7 +203,8 @@ void backpatch(void)
* since the sequencer RAM is loaded that way.
*/
void
-output(FILE *fp)
+output(fp)
+ FILE *fp;
{
int i;
@@ -214,7 +218,8 @@ output(FILE *fp)
}
char **
-getl(int *n)
+getl(n)
+ int *n;
{
int i;
char *p, *quote;
@@ -373,7 +378,9 @@ eval_operand(char **a, int spec)
}
int
-eval_sdi(char **a, int spec)
+eval_sdi(a, spec)
+ char **a;
+ int spec;
{
sym_t *p;
unsigned val;
@@ -443,7 +450,9 @@ eval_sdi(char **a, int spec)
}
int
-eval_addr(char **a, int spec)
+eval_addr(a, spec)
+ char **a;
+ int spec;
{
sym_t *p;
@@ -468,7 +477,9 @@ eval_addr(char **a, int spec)
}
int
-crack(char **a, int n)
+crack(a, n)
+ char **a;
+ int n;
{
int i;
int I_imm, I_addr;
diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c
index bf310e46f8f..aefcf00fc41 100644
--- a/sys/dev/pci/if_de.c
+++ b/sys/dev/pci/if_de.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_de.c,v 1.7 1996/05/05 13:38:58 mickey Exp $ */
-/* $NetBSD: if_de.c,v 1.17 1996/04/01 19:37:54 cgd Exp $ */
+/* $OpenBSD: if_de.c,v 1.8 1996/05/07 07:38:29 deraadt Exp $ */
+/* $NetBSD: if_de.c,v 1.18 1996/05/03 17:32:20 christos Exp $ */
/*-
* Copyright (c) 1994, 1995 Matt Thomas (matt@lkg.dec.com)
@@ -1937,7 +1937,7 @@ tulip_ioctl(
s = splnet();
- if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) {
+ if ((error = ether_ioctl(ifp, &sc->tulip_ac, cmd, data)) > 0) {
splx(s);
return error;
}
@@ -2593,14 +2593,14 @@ tulip_pci_attach(
if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin,
pa->pa_intrline, &intrhandle)) {
- printf(": couldn't map interrupt\n", self->dv_xname);
+ printf(": couldn't map interrupt\n");
return;
}
intrstr = pci_intr_string(pc, intrhandle);
sc->tulip_ih = pci_intr_establish(pc, intrhandle, IPL_NET,
tulip_intr, sc, self->dv_xname);
if (sc->tulip_ih == NULL) {
- printf(": couldn't establish interrupt", self->dv_xname);
+ printf(": couldn't establish interrupt");
if (intrstr != NULL)
printf(" at %s", intrstr);
printf("\n");
diff --git a/sys/dev/pci/if_ep_pci.c b/sys/dev/pci/if_ep_pci.c
index 94f0270528f..bd44943ceb9 100644
--- a/sys/dev/pci/if_ep_pci.c
+++ b/sys/dev/pci/if_ep_pci.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ep_pci.c,v 1.1 1996/04/25 02:17:06 thorpej Exp $ */
+/* $NetBSD: if_ep_pci.c,v 1.3 1996/05/03 19:08:00 christos Exp $ */
/*
* Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
@@ -33,6 +33,7 @@
#include "bpfilter.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
@@ -59,7 +60,7 @@
#endif
#include <machine/cpu.h>
-#include <machine/pio.h>
+#include <machine/bus.h>
#include <dev/ic/elink3var.h>
#include <dev/ic/elink3reg.h>
@@ -86,7 +87,6 @@ ep_pci_match(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct pci_attach_args *pa = (struct pci_attach_args *) aux;
if (PCI_VENDORID(pa->pa_id) != PCI_VENDOR_3COM)
@@ -109,21 +109,29 @@ ep_pci_attach(parent, self, aux)
void *aux;
{
struct ep_softc *sc = (void *)self;
- u_short conn = 0;
struct pci_attach_args *pa = aux;
pci_chipset_tag_t pc = pa->pa_pc;
+ bus_chipset_tag_t bc = pa->pa_bc;
+ bus_io_addr_t iobase;
+ bus_io_size_t iosize;
pci_intr_handle_t ih;
- int iobase;
- u_short i;
+ u_short i, conn = 0;
char *model;
const char *intrstr = NULL;
- if (pci_map_io(pa->pa_tag, PCI_CBMA, &iobase)) {
- printf(": couldn't map io\n");
+ if (pci_io_find(pc, pa->pa_tag, PCI_CBMA, &iobase, &iosize)) {
+ printf(": can't find i/o space\n");
return;
}
+
+ if (bus_io_map(bc, iobase, iosize, &sc->sc_ioh)) {
+ printf(": can't map i/o space\n");
+ return;
+ }
+
+ sc->sc_bc = bc;
sc->bustype = EP_BUS_PCI;
- sc->ep_iobase = iobase; /* & 0xfffffff0 */
+
i = pci_conf_read(pc, pa->pa_tag, PCI_CONN);
/*
diff --git a/sys/dev/pci/ncr.c b/sys/dev/pci/ncr.c
index d98f8d2b3d7..56433f73cd4 100644
--- a/sys/dev/pci/ncr.c
+++ b/sys/dev/pci/ncr.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ncr.c,v 1.7 1996/04/21 22:25:22 deraadt Exp $ */
-/* $NetBSD: ncr.c,v 1.33 1996/04/03 08:44:15 mycroft Exp $ */
+/* $OpenBSD: ncr.c,v 1.8 1996/05/07 07:38:40 deraadt Exp $ */
+/* $NetBSD: ncr.c,v 1.34 1996/05/03 17:39:49 christos Exp $ */
/**************************************************************************
**
@@ -1273,12 +1273,12 @@ static void ncr_exception (ncb_p np);
static void ncr_free_ccb (ncb_p np, ccb_p cp, int flags);
static void ncr_getclock (ncb_p np);
static ccb_p ncr_get_ccb (ncb_p np, u_long flags, u_long t,u_long l);
-static U_INT32 ncr_info (int unit);
static void ncr_init (ncb_p np, char * msg, u_long code);
#ifdef __NetBSD__
static int ncr_intr (void *);
#else /* !__NetBSD__ */
static int ncr_intr (ncb_p np);
+static U_INT32 ncr_info (int unit);
#endif /* __NetBSD__ */
static void ncr_int_ma (ncb_p np);
static void ncr_int_sir (ncb_p np);
@@ -1329,8 +1329,10 @@ static void ncr_attach (pcici_t tag, int unit);
*/
+#if 0
static char ident[] =
- "\n$NetBSD: ncr.c,v 1.33 1996/04/03 08:44:15 mycroft Exp $\n";
+ "\n$NetBSD: ncr.c,v 1.34 1996/05/03 17:39:49 christos Exp $\n";
+#endif
u_long ncr_version = NCR_VERSION * 11
+ (u_long) sizeof (struct ncb) * 7
@@ -3257,10 +3259,12 @@ void ncr_minphys (struct buf *bp)
**----------------------------------------------------------
*/
+#ifndef __NetBSD__
U_INT32 ncr_info (int unit)
{
return (1); /* may be changed later */
}
+#endif
/*----------------------------------------------------------
**
@@ -3276,10 +3280,10 @@ ncr_probe(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct pci_attach_args *pa = aux;
+#if 0
+ struct cfdata *cf = match;
-#ifdef 0
if (!pci_targmatch(cf, pa))
return 0;
#endif
@@ -3339,6 +3343,8 @@ static char* ncr_probe (pcici_t tag, pcidi_t type)
#ifdef __NetBSD__
+int ncr_print __P((void *, char *));
+
int
ncr_print(aux, name)
void *aux;
@@ -4292,7 +4298,7 @@ void ncr_complete (ncb_p np, ccb_p cp)
ncb_profile (np, cp);
if (DEBUG_FLAGS & DEBUG_TINY)
- printf ("CCB=%x STAT=%x/%x\n", (unsigned long)cp & 0xfff,
+ printf ("CCB=%lx STAT=%x/%x\n", (unsigned long)cp & 0xfff,
cp->host_status,cp->scsi_status);
xp = cp->xfer;
@@ -4759,7 +4765,7 @@ static void ncr_setsync (ncb_p np, ccb_p cp, u_char sxfer)
xp = cp->xfer;
assert (xp);
if (!xp) return;
- assert (target == xp->sc_link->target & 7);
+ assert (target == (xp->sc_link->target & 7));
tp = &np->target[target];
tp->period= sxfer&0xf ? ((sxfer>>5)+4) * np->ns_sync : 0xffff;
@@ -4818,7 +4824,7 @@ static void ncr_setwide (ncb_p np, ccb_p cp, u_char wide)
xp = cp->xfer;
assert (xp);
if (!xp) return;
- assert (target == xp->sc_link->target & 7);
+ assert (target == (xp->sc_link->target & 7));
tp = &np->target[target];
tp->widedone = wide+1;
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 1e69d44b454..e88e710b1d3 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pci.c,v 1.2 1996/04/21 22:25:34 deraadt Exp $ */
-/* $NetBSD: pci.c,v 1.18 1996/03/27 04:08:24 cgd Exp $ */
+/* $OpenBSD: pci.c,v 1.3 1996/05/07 07:38:49 deraadt Exp $ */
+/* $NetBSD: pci.c,v 1.19 1996/05/03 17:33:49 christos Exp $ */
/*
* Copyright (c) 1995, 1996 Christopher G. Demetriou. All rights reserved.
@@ -105,8 +105,7 @@ pciattach(parent, self, aux)
pcitag_t tag;
pcireg_t id, class, intr, bhlcr;
struct pci_attach_args pa;
- struct cfdata *cf;
- int supported, pin;
+ int pin;
tag = pci_make_tag(pc, bus, device, 0);
id = pci_conf_read(pc, tag, PCI_ID_REG);
diff --git a/sys/dev/pci/ppb.c b/sys/dev/pci/ppb.c
index 69ad20265f2..87a6b1c0eeb 100644
--- a/sys/dev/pci/ppb.c
+++ b/sys/dev/pci/ppb.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ppb.c,v 1.2 1996/04/21 22:25:53 deraadt Exp $ */
-/* $NetBSD: ppb.c,v 1.7 1996/03/27 04:08:34 cgd Exp $ */
+/* $OpenBSD: ppb.c,v 1.3 1996/05/07 07:38:51 deraadt Exp $ */
+/* $NetBSD: ppb.c,v 1.8 1996/05/03 17:33:51 christos Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@@ -68,7 +68,6 @@ ppbmatch(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct pci_attach_args *pa = aux;
/*