-/* $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>
#include "bpfilter.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#endif
#include <machine/cpu.h>
-#include <machine/pio.h>
+#include <machine/bus.h>
#include <dev/ic/elink3var.h>
#include <dev/ic/elink3reg.h>
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct eisa_attach_args *ea = aux;
/* must match one of our known ID strings */
{
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;
-/* $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
#include "com.h"
+
#define COM_IBUFSIZE (2 * 512)
#define COM_IHIGHWATER ((3 * COM_IBUFSIZE) / 4)
#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
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
#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 */
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
int iobase, needioh;
#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)
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;
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,
/*
* Stop output on a line.
*/
-void
+int
comstop(tp, flag)
struct tty *tp;
+ int flag;
{
int s;
if (!ISSET(tp->t_state, TS_TTSTOP))
SET(tp->t_state, TS_FLUSH);
splx(s);
+ return 0;
}
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;
comconsinit = 0;
}
+void
cominit(bc, ioh, rate)
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
splx(s);
}
+int
comcngetc(dev)
dev_t dev;
{
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 */
-/* $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>
#include "bpfilter.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#endif
#include <machine/cpu.h>
-#include <machine/pio.h>
+#include <machine/bus.h>
#include <dev/ic/elink3var.h>
#include <dev/ic/elink3reg.h>
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));
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 *));
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;
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;
}
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);
/*
* 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);
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 ));
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
* 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);
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;
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
*/
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) {
/*
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) {
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;
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;
-
}
}
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)
* 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);
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) {
* 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)
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)
;
}
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;
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;
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);
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;
}
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);
}
* 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);
}
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) {
}
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
}
void
-epmbuffill(sc)
- struct ep_softc *sc;
+epmbuffill(v)
+ void *v;
{
+ struct ep_softc *sc = v;
int s, i;
s = splnet();
-/* $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>
#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
-/* $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>
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. */
#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 *));
-/* $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
};
-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)
return x;
}
-static __inline__ void
+static __inline void
ad_write(sc, reg, data)
struct ad1848_softc *sc;
int reg;
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};
struct ad1848_volume *gp;
{
u_char reg;
- u_int atten;
DPRINTF(("cs4231_set_mic_gain: %d\n", gp->left));
int chans;
{
register struct ad1848_softc *sc = addr;
- int mode;
DPRINTF(("ad1848_set_channels: %d\n", chans));
ad1848_reset(sc)
register struct ad1848_softc *sc;
{
+#if 0
u_char r;
+#endif
DPRINTF(("ad1848_reset\n"));
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) {
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) {
-/* $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
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 *));
-/* $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
#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 */
-/* $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
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 */
#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)
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 = {
{
struct aic_softc *sc = match;
struct isa_attach_args *ia = aux;
- int i, len, ic;
#ifdef NEWCONFIG
if (ia->ia_iobase == IOBASEUNK)
{
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 */
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);
int
aic_reselect(sc, message)
struct aic_softc *sc;
- u_char message;
+ int message;
{
u_char selid, target, lun;
struct aic_acb *acb;
aic_sched_msgout(sc, SEND_DEV_RESET);
break;
+#ifdef notdef
abort:
aic_sched_msgout(sc, SEND_ABORT);
break;
+#endif
}
outb(iobase + SXFRCTL0, CHEN | SPIOEN);
register struct aic_softc *sc;
{
int iobase = sc->sc_iobase;
+#if AIC_USE_SYNCHRONOUS
struct aic_tinfo *ti;
+#endif
u_char sstat1;
int 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 */
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);
}
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);
-/* $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
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) {
struct bt_model model;
struct bt_revision revision;
struct bt_digit digit;
- char dummy[8];
char *p;
/*
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"));
#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 */
#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
-/* $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
#include "com.h"
+
#define COM_IBUFSIZE (2 * 512)
#define COM_IHIGHWATER ((3 * COM_IBUFSIZE) / 4)
#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
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
#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 */
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
int iobase, needioh;
#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)
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;
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,
/*
* Stop output on a line.
*/
-void
+int
comstop(tp, flag)
struct tty *tp;
+ int flag;
{
int s;
if (!ISSET(tp->t_state, TS_TTSTOP))
SET(tp->t_state, TS_FLUSH);
splx(s);
+ return 0;
}
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;
comconsinit = 0;
}
+void
cominit(bc, ioh, rate)
bus_chipset_tag_t bc;
bus_io_handle_t ioh;
splx(s);
}
+int
comcngetc(dev)
dev_t dev;
{
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 */
-/* $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
* 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;
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;
-/* $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.
#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));
-/* $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.
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 *));
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 *));
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 *));
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 *));
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
*/
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.
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;
/*
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
void * addr;
void *buf;
int size;
- void (*intr)();
+ void (*intr) __P((void *));
void *arg;
{
register struct ad1848_softc *ac = addr;
* 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;
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));
{
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);
}
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);
{
register int port = sc->sc_iobase;
int ignore = 0, voice, rval = 0;
- unsigned long addr;
unsigned char intr, status;
/*
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;
* Ignore other interrupts for now
*/
}
+ return 0;
}
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));
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
int blocksize;
{
register struct gus_softc *sc = addr;
- register unsigned long i;
DPRINTF(("gus_round_blocksize called\n"));
{
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);
{
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);
gus_set_endaddr(sc, voice, addr)
struct gus_softc *sc;
int voice;
- unsigned long addr;
+ u_long addr;
{
register int port = sc->sc_iobase;
}
-#if 0
+#ifdef GUSPLAYDEBUG
/*
* Set current address. called at splgus()
*/
gus_set_curaddr(sc, voice, addr)
struct gus_softc *sc;
int voice;
- unsigned long addr;
+ u_long addr;
{
register int port = sc->sc_iobase;
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);
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;
void * addr;
void *buf;
int size;
- void (*callback)();
+ void (*callback) __P((void *));
void *arg;
{
register struct ad1848_softc *sc = addr;
void * addr;
void *buf;
int size;
- void (*callback)();
+ void (*callback) __P((void *));
void *arg;
{
register struct gus_softc *sc = addr;
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;
return(0);
}
-STATIC inline int
+STATIC __inline int
gus_from_vol(cp, vol)
mixer_ctrl_t *cp;
struct ad1848_volume *vol;
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));
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));
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));
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) {
void *addr;
struct audio_encoding *fp;
{
- register struct gus_softc *sc = addr;
-
switch (fp->index) {
case 0:
strcpy(fp->name, AudioEmulaw);
-/* $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.
#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
*/
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};
-/* $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
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));
}
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);
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";
(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);
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);
*/
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];
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];
sc->mem_shared = 1;
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.
*
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;
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;
}
/*
{
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);
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. */
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;
}
/*
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;
-/* $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
#include "bpfilter.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/mbuf.h>
* 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));
/*
* Initialize interface.
*/
-int
+void
elinit(sc)
struct el_softc *sc;
{
{
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();
-/* $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.
*
#include "bpfilter.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#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>
#endif
#include <machine/cpu.h>
-#include <machine/pio.h>
+#include <machine/bus.h>
#include <dev/ic/elink3var.h>
#include <dev/ic/elink3reg.h>
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;
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;
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 &&
{
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> ");
-/* $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.
#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>
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;
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 *));
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
* 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;
cmd->ie_junk = 0xff;
}
-static inline void
+static __inline void
ie_ack(sc, mask)
struct ie_softc *sc;
u_int mask;
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;
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. */
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;
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;
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)
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);
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. */
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};
* 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;
{
* 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;
* 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;
& (IE_RBUF_SIZE | (IE_RBUF_SIZE - 1)));
}
-static inline int
+static __inline int
ie_packet_len(sc)
struct ie_softc *sc;
{
*/
static void
chan_attn_timeout(rock)
- caddr_t rock;
+ void *rock;
{
*(int *)rock = 1;
{
volatile struct ie_sys_ctl_block *scb = sc->scb;
void *ptr;
- int n;
ptr = (void *)ALIGN(scb + 1);
-/* $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
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 */
#endif
void *sc_ih;
+ bus_io_handle_t sc_ioh;
void *sc_sh;
int sc_card;
int sc_rap, sc_rdp; /* LANCE registers */
-/* $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.
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
-/* $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>
-/* $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.
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/device.h>
+#include <sys/conf.h>
#include <sys/syslog.h>
#ifdef i386 /* XXX */
#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
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 *));
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);
}
* 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);
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;
}
/* 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;
}
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;
}
* 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];
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;
}
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;
}
}
* 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);
}
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;
-/* $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.
};
/* 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));
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 };
if (!sc)
return ENXIO;
- if (error = mcdlock(sc))
+ if ((error = mcdlock(sc)) != 0)
return error;
if (sc->sc_dk.dk_openmask != 0) {
}
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);
MCD_TRACE("close: partition=%d\n", part, 0, 0, 0);
- if (error = mcdlock(sc))
+ if ((error = mcdlock(sc)) != 0)
return error;
switch (fmt) {
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;
}
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));
if ((flag & FWRITE) == 0)
return EBADF;
- if (error = mcdlock(sc))
+ if ((error = mcdlock(sc)) != 0)
return error;
sc->flags |= MCDF_LABELLING;
}
void
-mcd_pseudointr(sc)
- struct mcd_softc *sc;
+mcd_pseudointr(v)
+ void *v;
{
+ struct mcd_softc *sc = v;
int s;
s = splbio();
printf("; giving up\n");
changed:
-harderr:
/* Invalidate the buffer. */
bp->b_flags |= B_ERROR;
bp->b_resid = bp->b_bcount - mbx->skip;
-/* $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.
int pasopen __P((dev_t, int));
int pas_getdev __P((void *, struct audio_device *));
+void pasconf __P((int, int, int, int));
/*
#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);
-/* $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.
#include <sys/device.h>
#include <sys/proc.h>
#include <sys/user.h>
-#include <sys/cpu.h>
#include <machine/pio.h>
-/* $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
#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));
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.
*/
};
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;
}
void
-pss_setaddr(int addr, int configAddr)
+pss_setaddr(addr, configAddr)
+ int addr;
+ int configAddr;
{
int val;
* enable the chosen interrupt.
*/
int
-pss_setint(int intNum, int configAddress)
+pss_setint(intNum, configAddress)
+ int intNum;
+ int configAddress;
{
int val;
switch(intNum) {
}
int
-pss_setdma(int dmaNum, int configAddress)
+pss_setdma(dmaNum, configAddress)
+ int dmaNum;
+ int configAddress;
{
int val;
* 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;
}
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;
* 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;
}
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),
}
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),
*/
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);
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;
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 */
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;
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) {
int
pss_set_treble(sc, treb)
register struct pss_softc *sc;
- u_char treb;
+ u_int treb;
{
DPRINTF(("pss_set_treble: %d\n", treb));
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;
int port;
{
register struct ad1848_softc *ac = addr;
- register struct pss_softc *sc = ac->parent;
DPRINTF(("pss_set_in_port: %d\n", port));
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)) {
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));
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) {
-/* $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.
{
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,
-/* $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.
#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;
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"));
sbdsp_attach(sc)
struct sbdsp_softc *sc;
{
- register int iobase = sc->sc_iobase;
/* Set defaults */
if (ISSB16CLASS(sc))
void *addr;
struct audio_encoding *fp;
{
- register struct sbdsp_softc *sc = addr;
-
switch (fp->index) {
case 0:
strcpy(fp->name, AudioEmulaw);
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;
void *addr;
void *p;
int cc;
- void (*intr)();
+ void (*intr) __P((void *));
void *arg;
{
register struct sbdsp_softc *sc = addr;
void *addr;
void *p;
int cc;
- void (*intr)();
+ void (*intr) __P((void *));
void *arg;
{
register struct sbdsp_softc *sc = addr;
return EINVAL;
}
break;
+ default:
+ return EINVAL;
}
switch (cp->dev) {
case SB_CD_PORT:
src = SBP_CD_VOL;
break;
+ default:
+ return EINVAL;
}
sbdsp_mix_write(sc, src, gain);
-/* $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.
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 *));
#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 *));
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;
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
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;
-/* $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.
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;
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
splx(s);
}
-static inline void
+static __inline void
uha_init_mscp(uha, mscp)
struct uha_softc *uha;
struct uha_mscp *mscp;
uha->mscphash[hashnum] = mscp;
}
-static inline void
+static __inline void
uha_reset_mscp(uha, mscp)
struct uha_softc *uha;
struct uha_mscp *mscp;
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 {
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"));
-/* $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.
#include <sys/disklabel.h>
#include <sys/disk.h>
#include <sys/syslog.h>
+#include <sys/proc.h>
#include <vm/vm.h>
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
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
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)
}
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));
command = (bp->b_flags & B_READ) ?
WDCC_READ : WDCC_WRITE;
break;
+ default:
+#ifdef DIAGNOSTIC
+ panic("bad wd mode");
+#endif
+ return;
}
/* Initiate command! */
return 1;
wderror(wd, bp, "hard error");
+#ifdef B_FORMAT
bad:
+#endif
bp->b_error = EIO;
bp->b_flags |= B_ERROR;
goto done;
}
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;
if (wd == 0)
return ENXIO;
- if (error = wdlock(wd))
+ if ((error = wdlock(wd)) != 0)
return error;
if (wd->sc_dk.dk_openmask != 0) {
}
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) {
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,
if ((flag & FWRITE) == 0)
return EBADF;
- if (error = wdlock(wd))
+ if ((error = wdlock(wd)) != 0)
return error;
wd->sc_flags |= WDF_LABELLING;
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);
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;
}
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);
-/* $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
{
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)
break;
default:
- printf("%s: unrecognized interrupt type %02x", c);
+ printf("%s: unrecognized interrupt type %02x",
+ sc->sc_dev.dv_xname, c);
break;
}
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) {
if ((scb->flags & SCB_POLLED) == 0)
timeout(wds_timeout, scb, (scb->timeout * hz) / 1000);
- next:
++sc->sc_mbofull;
wds_nextmbx(wmbo, wmbx, mbo);
}
u_char stat;
{
struct scsi_xfer *xs = scb->xs;
- int i, x;
/* XXXXX */
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;
struct scsi_xfer *xs = scb->xs;
struct scsi_sense *ss = (void *)&scb->sense.scb;
int s;
- u_char c;
- int i;
/* XXXXX */
-/* $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
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.
*/
int port;
{
register struct ad1848_softc *ac = addr;
- register struct wss_softc *sc = ac->parent;
DPRINTF(("wss_set_in_port: %d\n", port));
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)) {
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));
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));
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) {
-/* $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.
#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>
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));
* 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;
/* 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 */
* 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];
* 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];
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;
}
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;
}
}
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));
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;
}
* 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>
}
void *
-Realloc(void *ptr, size_t size)
+Realloc(ptr, size)
+ void *ptr;
+ size_t size;
{
void *p = realloc(ptr, size);
if (!p)
}
sym_t *
-lookup(char *name)
+lookup(name)
+ char *name;
{
sym_t *p;
p->patch[p->npatch - 1] = location;
}
-void backpatch(void)
+void backpatch()
{
int i;
sym_t *p;
* since the sequencer RAM is loaded that way.
*/
void
-output(FILE *fp)
+output(fp)
+ FILE *fp;
{
int i;
}
char **
-getl(int *n)
+getl(n)
+ int *n;
{
int i;
char *p, *quote;
}
int
-eval_sdi(char **a, int spec)
+eval_sdi(a, spec)
+ char **a;
+ int spec;
{
sym_t *p;
unsigned val;
}
int
-eval_addr(char **a, int spec)
+eval_addr(a, spec)
+ char **a;
+ int spec;
{
sym_t *p;
}
int
-crack(char **a, int n)
+crack(a, n)
+ char **a;
+ int n;
{
int i;
int I_imm, I_addr;
-/* $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)
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;
}
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");
-/* $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>
#include "bpfilter.h"
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#endif
#include <machine/cpu.h>
-#include <machine/pio.h>
+#include <machine/bus.h>
#include <dev/ic/elink3var.h>
#include <dev/ic/elink3reg.h>
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)
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);
/*
-/* $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 $ */
/**************************************************************************
**
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);
*/
+#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
**----------------------------------------------------------
*/
+#ifndef __NetBSD__
U_INT32 ncr_info (int unit)
{
return (1); /* may be changed later */
}
+#endif
/*----------------------------------------------------------
**
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
#ifdef __NetBSD__
+int ncr_print __P((void *, char *));
+
int
ncr_print(aux, name)
void *aux;
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;
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;
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;
-/* $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.
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);
-/* $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.
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct pci_attach_args *pa = aux;
/*