summaryrefslogtreecommitdiff
path: root/sys/dev/eisa
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/eisa')
-rw-r--r--sys/dev/eisa/Makefile8
-rw-r--r--sys/dev/eisa/aha1742.c242
-rw-r--r--sys/dev/eisa/devlist2h.awk190
-rw-r--r--sys/dev/eisa/eisa.c252
-rw-r--r--sys/dev/eisa/eisadevs67
-rw-r--r--sys/dev/eisa/eisadevs.h63
-rw-r--r--sys/dev/eisa/eisadevs_data.h117
-rw-r--r--sys/dev/eisa/eisareg.h76
-rw-r--r--sys/dev/eisa/eisavar.h75
-rw-r--r--sys/dev/eisa/files.eisa16
10 files changed, 946 insertions, 160 deletions
diff --git a/sys/dev/eisa/Makefile b/sys/dev/eisa/Makefile
new file mode 100644
index 00000000000..9eab8fde9ec
--- /dev/null
+++ b/sys/dev/eisa/Makefile
@@ -0,0 +1,8 @@
+# $OpenBSD: Makefile,v 1.1 1996/04/18 23:47:08 niklas Exp $
+# $NetBSD: Makefile,v 1.1 1996/02/26 23:46:17 cgd Exp $
+
+AWK= awk
+
+eisadevs.h eisadevs_data.h: eisadevs devlist2h.awk
+ /bin/rm -f eisadevs.h eisadevs_data.h
+ ${AWK} -f devlist2h.awk eisadevs
diff --git a/sys/dev/eisa/aha1742.c b/sys/dev/eisa/aha1742.c
index 3759e9d72ed..8d01311a804 100644
--- a/sys/dev/eisa/aha1742.c
+++ b/sys/dev/eisa/aha1742.c
@@ -1,4 +1,5 @@
-/* $NetBSD: aha1742.c,v 1.52 1995/10/04 00:35:10 mycroft Exp $ */
+/* $OpenBSD: aha1742.c,v 1.4 1996/04/18 23:47:09 niklas Exp $ */
+/* $NetBSD: aha1742.c,v 1.57 1996/03/08 22:03:26 cgd Exp $ */
/*
* Copyright (c) 1994 Charles Hannum. All rights reserved.
@@ -58,10 +59,11 @@
#include <sys/proc.h>
#include <sys/user.h>
-#include <machine/pio.h>
+#include <machine/bus.h>
#include <dev/eisa/eisareg.h>
#include <dev/eisa/eisavar.h>
+#include <dev/eisa/eisadevs.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
@@ -263,8 +265,9 @@ struct ahb_softc {
struct device sc_dev;
struct isadev sc_id;
void *sc_ih;
+ bus_chipset_tag_t sc_bc;
+ bus_io_handle_t sc_ioh;
- int sc_iobase;
int sc_irq;
struct ahb_ecb *immed_ecb; /* an outstanding immediete command */
@@ -283,7 +286,7 @@ void ahb_done __P((struct ahb_softc *, struct ahb_ecb *));
void ahb_free_ecb __P((struct ahb_softc *, struct ahb_ecb *, int));
struct ahb_ecb *ahb_get_ecb __P((struct ahb_softc *, int));
struct ahb_ecb *ahb_ecb_phys_kv __P((struct ahb_softc *, physaddr));
-int ahb_find __P((struct ahb_softc *));
+int ahb_find __P((bus_chipset_tag_t, bus_io_handle_t, struct ahb_softc *));
void ahb_init __P((struct ahb_softc *));
void ahbminphys __P((struct buf *));
int ahb_scsi_cmd __P((struct scsi_xfer *));
@@ -314,12 +317,11 @@ struct scsi_device ahb_dev = {
NULL, /* Use default 'done' routine */
};
-int ahbprobe();
-int ahbprobe1 __P((struct ahb_softc *, struct isa_attach_args *));
-void ahbattach();
+int ahbmatch __P((struct device *, void *, void *));
+void ahbattach __P((struct device *, struct device *, void *));
struct cfdriver ahbcd = {
- NULL, "ahb", ahbprobe, ahbattach, DV_DULL, sizeof(struct ahb_softc)
+ NULL, "ahb", ahbmatch, ahbattach, DV_DULL, sizeof(struct ahb_softc)
};
/*
@@ -331,12 +333,12 @@ ahb_send_mbox(ahb, opcode, ecb)
int opcode;
struct ahb_ecb *ecb;
{
- int iobase = ahb->sc_iobase;
- int stport = iobase + G2STAT;
+ bus_chipset_tag_t bc = ahb->sc_bc;
+ bus_io_handle_t ioh = ahb->sc_ioh;
int wait = 300; /* 1ms should be enough */
while (--wait) {
- if ((inb(stport) & (G2STAT_BUSY | G2STAT_MBOX_EMPTY))
+ if ((bus_io_read_1(bc, ioh, G2STAT) & (G2STAT_BUSY | G2STAT_MBOX_EMPTY))
== (G2STAT_MBOX_EMPTY))
break;
delay(10);
@@ -346,8 +348,8 @@ ahb_send_mbox(ahb, opcode, ecb)
Debugger();
}
- outl(iobase + MBOXOUT0, KVTOPHYS(ecb)); /* don't know this will work */
- outb(iobase + ATTN, opcode | ecb->xs->sc_link->target);
+ bus_io_write_4(bc, ioh, MBOXOUT0, KVTOPHYS(ecb)); /* don't know this will work */
+ bus_io_write_1(bc, ioh, ATTN, opcode | ecb->xs->sc_link->target);
}
/*
@@ -359,15 +361,15 @@ ahb_poll(ahb, xs, count)
struct scsi_xfer *xs;
int count;
{ /* in msec */
- int iobase = ahb->sc_iobase;
- int stport = iobase + G2STAT;
+ bus_chipset_tag_t bc = ahb->sc_bc;
+ bus_io_handle_t ioh = ahb->sc_ioh;
while (count) {
/*
* If we had interrupts enabled, would we
* have got an interrupt?
*/
- if (inb(stport) & G2STAT_INT_PEND)
+ if (bus_io_read_1(bc, ioh, G2STAT) & G2STAT_INT_PEND)
ahbintr(ahb);
if (xs->flags & ITSDONE)
return 0;
@@ -386,12 +388,12 @@ ahb_send_immed(ahb, target, cmd)
int target;
u_long cmd;
{
- int iobase = ahb->sc_iobase;
- int stport = iobase + G2STAT;
+ bus_chipset_tag_t bc = ahb->sc_bc;
+ bus_io_handle_t ioh = ahb->sc_ioh;
int wait = 100; /* 1 ms enough? */
while (--wait) {
- if ((inb(stport) & (G2STAT_BUSY | G2STAT_MBOX_EMPTY))
+ if ((bus_io_read_1(bc, ioh, G2STAT) & (G2STAT_BUSY | G2STAT_MBOX_EMPTY))
== (G2STAT_MBOX_EMPTY))
break;
delay(10);
@@ -401,9 +403,9 @@ ahb_send_immed(ahb, target, cmd)
Debugger();
}
- outl(iobase + MBOXOUT0, cmd); /* don't know this will work */
- outb(iobase + G2CNTRL, G2CNTRL_SET_HOST_READY);
- outb(iobase + ATTN, OP_IMMED | target);
+ bus_io_write_4(bc, ioh, MBOXOUT0, cmd); /* don't know this will work */
+ bus_io_write_1(bc, ioh, G2CNTRL, G2CNTRL_SET_HOST_READY);
+ bus_io_write_1(bc, ioh, ATTN, OP_IMMED | target);
}
/*
@@ -412,87 +414,39 @@ ahb_send_immed(ahb, target, cmd)
* the actual probe routine to check it out.
*/
int
-ahbprobe(parent, self, aux)
- struct device *parent, *self;
- void *aux;
+ahbmatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
{
- struct ahb_softc *ahb = (void *)self;
- struct isa_attach_args *ia = aux;
- int iobase;
- u_short vendor, model;
-
-#ifdef NEWCONFIG
- if (ia->ia_iobase != IOBASEUNK)
- return ahbprobe1(ahb, ia);
-#endif
+ struct eisa_attach_args *ea = aux;
+ bus_chipset_tag_t bc = ea->ea_bc;
+ bus_io_handle_t ioh;
+ int rv;
- while (ahb_slot < MAX_SLOTS) {
- ahb_slot++;
- iobase = 0x1000 * ahb_slot;
+ /* must match one of our known ID strings */
+ if (strcmp(ea->ea_idstring, "ADP0000") &&
+ strcmp(ea->ea_idstring, "ADP0001") &&
+ strcmp(ea->ea_idstring, "ADP0002") &&
+ strcmp(ea->ea_idstring, "ADP0400"))
+ return (0);
- vendor = htons(inw(iobase + EISA_VENDOR));
- if (vendor != 0x0490) /* `ADP' */
- continue;
-
- model = htons(inw(iobase + EISA_MODEL));
- if ((model & 0xfff0) != 0x0000 &&
- (model & 0xfff0) != 0x0100) {
-#ifndef trusted
- printf("ahbprobe: ignoring model %04x\n", model);
-#endif
- continue;
- }
+ if (bus_io_map(bc, EISA_SLOT_ADDR(ea->ea_slot), EISA_SLOT_SIZE, &ioh))
+ return (0);
#ifdef notyet
- outb(iobase + EISA_CONTROL, EISA_ENABLE | EISA_RESET);
- delay(10);
- outb(iobase + EISA_CONTROL, EISA_ENABLE);
- /* Wait for reset? */
- delay(1000);
+ /* This won't compile as-is, anyway. */
+ bus_io_write_1(bc, ioh, EISA_CONTROL, EISA_ENABLE | EISA_RESET);
+ delay(10);
+ bus_io_write_1(bc, ioh, EISA_CONTROL, EISA_ENABLE);
+ /* Wait for reset? */
+ delay(1000);
#endif
- ia->ia_iobase = iobase;
- if (ahbprobe1(ahb, ia))
- return 1;
- }
-
- return 0;
-}
-
-/*
- * Check if the device can be found at the port given
- * and if so, set it up ready for further work
- * as an argument, takes the isa_device structure from
- * autoconf.c.
- */
-int
-ahbprobe1(ahb, ia)
- struct ahb_softc *ahb;
- struct isa_attach_args *ia;
-{
-
- ahb->sc_iobase = ia->ia_iobase;
+ rv = !ahb_find(bc, ioh, NULL);
- /*
- * Try initialise a unit at this location
- * sets up dma and bus speed, loads ahb->sc_irq
- */
- if (ahb_find(ahb) != 0)
- return 0;
+ bus_io_unmap(ea->ea_bc, ioh, EISA_SLOT_SIZE);
- if (ia->ia_irq != IRQUNK) {
- if (ia->ia_irq != ahb->sc_irq) {
- printf("%s: irq mismatch; kernel configured %d != board configured %d\n",
- ahb->sc_dev.dv_xname, ia->ia_irq, ahb->sc_irq);
- return 0;
- }
- } else
- ia->ia_irq = ahb->sc_irq;
-
- ia->ia_drq = DRQUNK;
- ia->ia_msize = 0;
- ia->ia_iosize = 0x1000;
- return 1;
+ return (rv);
}
ahbprint()
@@ -508,9 +462,18 @@ ahbattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- struct isa_attach_args *ia = aux;
+ struct eisa_attach_args *ea = aux;
struct ahb_softc *ahb = (void *)self;
- u_short model;
+ bus_chipset_tag_t bc = ea->ea_bc;
+ bus_io_handle_t ioh;
+ char *model;
+
+ ahb->sc_bc = bc;
+ if (bus_io_map(bc, EISA_SLOT_ADDR(ea->ea_slot), EISA_SLOT_SIZE, &ioh))
+ panic("ahbattach: could not map I/O addresses");
+ ahb->sc_ioh = ioh;
+ if (ahb_find(bc, ioh, ahb))
+ panic("ahbattach: ahb_find failed!");
ahb_init(ahb);
TAILQ_INIT(&ahb->free_ecb);
@@ -524,22 +487,22 @@ ahbattach(parent, self, aux)
ahb->sc_link.device = &ahb_dev;
ahb->sc_link.openings = 2;
- printf(": ");
- model = htons(inw(ahb->sc_iobase + EISA_MODEL));
- switch (model & 0xfff0) {
- case 0x0000:
- printf("model 1740 or 1742");
- break;
- case 0x0100:
- printf("model 1744");
- break;
- }
- printf(", revision %d\n", model & 0x000f);
+ if (!strcmp(ea->ea_idstring, "ADP0000"))
+ model = EISA_PRODUCT_ADP0000;
+ else if (!strcmp(ea->ea_idstring, "ADP0001"))
+ model = EISA_PRODUCT_ADP0001;
+ else if (!strcmp(ea->ea_idstring, "ADP0002"))
+ model = EISA_PRODUCT_ADP0002;
+ else if (!strcmp(ea->ea_idstring, "ADP0400"))
+ model = EISA_PRODUCT_ADP0400;
+ else
+ model = "unknown model!";
+ printf(" irq %d: %s\n", ahb->sc_irq, model);
#ifdef NEWCONFIG
isa_establish(&ahb->sc_id, &ahb->sc_dev);
#endif
- ahb->sc_ih = eisa_intr_establish(ia->ia_irq, IST_LEVEL, IPL_BIO,
+ ahb->sc_ih = eisa_intr_establish(ahb->sc_irq, IST_LEVEL, IPL_BIO,
ahbintr, ahb, ahb->sc_dev.dv_xname);
/*
@@ -556,16 +519,17 @@ ahbintr(arg)
void *arg;
{
struct ahb_softc *ahb = arg;
+ bus_chipset_tag_t bc = ahb->sc_bc;
+ bus_io_handle_t ioh = ahb->sc_ioh;
struct ahb_ecb *ecb;
u_char ahbstat;
u_long mboxval;
- int iobase = ahb->sc_iobase;
#ifdef AHBDEBUG
printf("%s: ahbintr ", ahb->sc_dev.dv_xname);
#endif /* AHBDEBUG */
- if ((inb(iobase + G2STAT) & G2STAT_INT_PEND) == 0)
+ if ((bus_io_read_1(bc, ioh, G2STAT) & G2STAT_INT_PEND) == 0)
return 0;
for (;;) {
@@ -573,9 +537,9 @@ ahbintr(arg)
* First get all the information and then
* acknowlege the interrupt
*/
- ahbstat = inb(iobase + G2INTST);
- mboxval = inl(iobase + MBOXIN0);
- outb(iobase + G2CNTRL, G2CNTRL_CLEAR_EISA_INT);
+ ahbstat = bus_io_read_1(bc, ioh, G2INTST);
+ mboxval = bus_io_read_4(bc, ioh, MBOXIN0);
+ bus_io_write_1(bc, ioh, G2CNTRL, G2CNTRL_CLEAR_EISA_INT);
#ifdef AHBDEBUG
printf("status = 0x%x ", ahbstat);
@@ -620,7 +584,7 @@ ahbintr(arg)
ahb_done(ahb, ecb);
}
- if ((inb(iobase + G2STAT) & G2STAT_INT_PEND) == 0)
+ if ((bus_io_read_1(bc, ioh, G2STAT) & G2STAT_INT_PEND) == 0)
return 1;
}
}
@@ -823,16 +787,16 @@ ahb_ecb_phys_kv(ahb, ecb_phys)
* Start the board, ready for normal operation
*/
int
-ahb_find(ahb)
+ahb_find(bc, ioh, ahb)
+ bus_chipset_tag_t bc;
+ bus_io_handle_t ioh;
struct ahb_softc *ahb;
{
- int iobase = ahb->sc_iobase;
- int stport = iobase + G2STAT;
u_char intdef;
- int i;
+ int i, irq, busid;
int wait = 1000; /* 1 sec enough? */
- outb(iobase + PORTADDR, PORTADDR_ENHANCED);
+ bus_io_write_1(bc, ioh, PORTADDR, PORTADDR_ENHANCED);
#define NO_NO 1
#ifdef NO_NO
@@ -840,67 +804,73 @@ ahb_find(ahb)
* reset board, If it doesn't respond, assume
* that it's not there.. good for the probe
*/
- outb(iobase + G2CNTRL, G2CNTRL_HARD_RESET);
+ bus_io_write_1(bc, ioh, G2CNTRL, G2CNTRL_HARD_RESET);
delay(1000);
- outb(iobase + G2CNTRL, 0);
+ bus_io_write_1(bc, ioh, G2CNTRL, 0);
delay(10000);
while (--wait) {
- if ((inb(stport) & G2STAT_BUSY) == 0)
+ if ((bus_io_read_1(bc, ioh, G2STAT) & G2STAT_BUSY) == 0)
break;
delay(1000);
}
if (!wait) {
-#ifdef AHBDEBUG
+#ifdef AHBDEBUG
if (ahb_debug & AHB_SHOWMISC)
printf("ahb_find: No answer from aha1742 board\n");
#endif /*AHBDEBUG */
return ENXIO;
}
- i = inb(iobase + MBOXIN0);
+ i = bus_io_read_1(bc, ioh, MBOXIN0);
if (i) {
printf("self test failed, val = 0x%x\n", i);
return EIO;
}
/* Set it again, just to be sure. */
- outb(iobase + PORTADDR, PORTADDR_ENHANCED);
+ bus_io_write_1(bc, ioh, PORTADDR, PORTADDR_ENHANCED);
#endif
- while (inb(stport) & G2STAT_INT_PEND) {
+ while (bus_io_read_1(bc, ioh, G2STAT) & G2STAT_INT_PEND) {
printf(".");
- outb(iobase + G2CNTRL, G2CNTRL_CLEAR_EISA_INT);
+ bus_io_write_1(bc, ioh, G2CNTRL, G2CNTRL_CLEAR_EISA_INT);
delay(10000);
}
- intdef = inb(iobase + INTDEF);
+ intdef = bus_io_read_1(bc, ioh, INTDEF);
switch (intdef & 0x07) {
case INT9:
- ahb->sc_irq = 9;
+ irq = 9;
break;
case INT10:
- ahb->sc_irq = 10;
+ irq = 10;
break;
case INT11:
- ahb->sc_irq = 11;
+ irq = 11;
break;
case INT12:
- ahb->sc_irq = 12;
+ irq = 12;
break;
case INT14:
- ahb->sc_irq = 14;
+ irq = 14;
break;
case INT15:
- ahb->sc_irq = 15;
+ irq = 15;
break;
default:
printf("illegal int setting %x\n", intdef);
return EIO;
}
- outb(iobase + INTDEF, (intdef | INTEN)); /* make sure we can interrupt */
+ bus_io_write_1(bc, ioh, INTDEF, (intdef | INTEN)); /* make sure we can interrupt */
/* who are we on the scsi bus? */
- ahb->ahb_scsi_dev = (inb(iobase + SCSIDEF) & HSCSIID);
+ busid = (bus_io_read_1(bc, ioh, SCSIDEF) & HSCSIID);
+
+ /* if we want to fill in softc, do so now */
+ if (ahb != NULL) {
+ ahb->sc_irq = irq;
+ ahb->ahb_scsi_dev = busid;
+ }
/*
* Note that we are going and return (to probe)
diff --git a/sys/dev/eisa/devlist2h.awk b/sys/dev/eisa/devlist2h.awk
new file mode 100644
index 00000000000..475234b6435
--- /dev/null
+++ b/sys/dev/eisa/devlist2h.awk
@@ -0,0 +1,190 @@
+#! /usr/bin/awk -f
+# $OpenBSD: devlist2h.awk,v 1.1 1996/04/18 23:47:10 niklas Exp $
+# $NetBSD: devlist2h.awk,v 1.1 1996/02/26 23:46:20 cgd Exp $
+#
+# Copyright (c) 1995, 1996 Christopher G. Demetriou
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by Christopher G. Demetriou.
+# 4. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+BEGIN {
+ nproducts = nvendors = 0
+ dfile="eisadevs_data.h"
+ hfile="eisadevs.h"
+}
+NR == 1 {
+ VERSION = $0
+ gsub("\\$", "", VERSION)
+
+ printf("/*\n") > dfile
+ printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
+ > dfile
+ printf(" *\n") > dfile
+ printf(" * generated from:\n") > dfile
+ printf(" *\t%s\n", VERSION) > dfile
+ printf(" */\n") > dfile
+
+ printf("/*\n") > hfile
+ printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \
+ > hfile
+ printf(" *\n") > hfile
+ printf(" * generated from:\n") > hfile
+ printf(" *\t%s\n", VERSION) > hfile
+ printf(" */\n") > hfile
+
+ next
+}
+$1 == "vendor" {
+ nvendors++
+
+ vendorindex[$2] = nvendors; # record index for this name, for later.
+ vendors[nvendors, 1] = $2; # name/ID
+ i = 2; f = 3;
+
+ # comments
+ ocomment = oparen = 0
+ if (f <= NF) {
+ ocomment = 1;
+ }
+ while (f <= NF) {
+ if ($f == "#") {
+ oparen = 1
+ f++
+ continue
+ }
+ if (oparen) {
+ f++
+ continue
+ }
+ vendors[nvendors, i] = $f
+ i++; f++;
+ }
+
+ next
+}
+$1 == "product" {
+ nproducts++
+
+ products[nproducts, 1] = $2; # vendor name
+ products[nproducts, 2] = $3; # product id
+ printf("#define\tEISA_PRODUCT_%s%s\t\"", products[nproducts, 1],
+ products[nproducts, 2]) > hfile
+
+ i = vendorindex[products[nproducts, 1]]; j = 2;
+ needspace = 0;
+ while (vendors[i, j] != "") {
+ if (needspace)
+ printf(" ") > hfile
+ printf("%s", vendors[i, j]) > hfile
+ needspace = 1
+ j++
+ }
+
+ if (needspace)
+ printf(" ") > hfile
+
+ i=3; f = 4;
+
+ # comments
+ ocomment = oparen = 0
+ if (f <= NF) {
+ ocomment = 1;
+ }
+ while (f <= NF) {
+ if ($f == "#") {
+ printf("(") > hfile
+ oparen = 1
+ f++
+ continue
+ }
+ if (oparen) {
+ printf("%s", $f) > hfile
+ if (f < NF)
+ printf(" ") > hfile
+ f++
+ continue
+ }
+ products[nproducts, i] = $f
+ printf("%s", products[nproducts, i]) > hfile
+ if (f < NF)
+ printf(" ") > hfile
+ i++; f++;
+ }
+ if (oparen)
+ printf(")") > hfile
+ if (ocomment)
+ printf("\"") > hfile
+ printf("\n") > hfile
+
+ next
+}
+{
+ if ($0 == "")
+ blanklines++
+ if (blanklines != 2 && blanklines != 3)
+ print $0 > hfile
+ if (blanklines < 2)
+ print $0 > dfile
+}
+END {
+ # print out the match tables
+
+ printf("\n") > dfile
+
+ printf("struct eisa_knowndev eisa_knowndevs[] = {\n") > dfile
+ for (i = 1; i <= nproducts; i++) {
+ printf("\t{\n") > dfile
+ printf("\t 0,\n") > dfile
+ printf("\t \"%s%s\",\n", products[i, 1], products[i, 2]) \
+ > dfile
+ printf("\t EISA_PRODUCT_%s%s,\n", \
+ products[i, 1], products[i, 2]) \
+ > dfile
+
+ printf("\t},\n") > dfile
+ }
+ for (i = 1; i <= nvendors; i++) {
+ printf("\t{\n") > dfile
+ printf("\t EISA_KNOWNDEV_NOPROD,\n") \
+ > dfile
+ printf("\t \"%s\",\n", vendors[i, 1]) \
+ > dfile
+ printf("\t \"") > dfile
+ j = 2;
+ needspace = 0;
+ while (vendors[i, j] != "") {
+ if (needspace)
+ printf(" ") > dfile
+ printf("%s", vendors[i, j]) > dfile
+ needspace = 1
+ j++
+ }
+ printf("\",\n") > dfile
+ printf("\t},\n") > dfile
+ }
+ printf("\t{ 0, NULL, NULL, }\n") > dfile
+ printf("};\n") > dfile
+}
diff --git a/sys/dev/eisa/eisa.c b/sys/dev/eisa/eisa.c
new file mode 100644
index 00000000000..38a72a42d9b
--- /dev/null
+++ b/sys/dev/eisa/eisa.c
@@ -0,0 +1,252 @@
+/* $OpenBSD: eisa.c,v 1.1 1996/04/18 23:47:10 niklas Exp $ */
+/* $NetBSD: eisa.c,v 1.7 1996/03/14 04:02:58 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * EISA Bus device
+ *
+ * Makes sure an EISA bus is present, and finds and attaches devices
+ * living on it.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+
+#include <dev/eisa/eisareg.h>
+#include <dev/eisa/eisavar.h>
+#include <dev/eisa/eisadevs.h>
+
+int eisamatch __P((struct device *, void *, void *));
+void eisaattach __P((struct device *, struct device *, void *));
+
+struct cfdriver eisacd = {
+ NULL, "eisa", eisamatch, eisaattach, DV_DULL, sizeof(struct device)
+};
+
+int eisasubmatch __P((struct device *, void *, void *));
+int eisaprint __P((void *, char *));
+void eisa_devinfo __P((const char *, char *));
+
+int
+eisamatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct cfdata *cf = match;
+ struct eisabus_attach_args *eba = aux;
+
+ if (strcmp(eba->eba_busname, cf->cf_driver->cd_name))
+ return (0);
+
+ /* XXX check other indicators */
+
+ return (1);
+}
+
+int
+eisaprint(aux, pnp)
+ void *aux;
+ char *pnp;
+{
+ register struct eisa_attach_args *ea = aux;
+ char devinfo[256];
+
+ if (pnp) {
+ eisa_devinfo(ea->ea_idstring, devinfo);
+ printf("%s at %s", devinfo, pnp);
+ }
+ printf(" slot %d", ea->ea_slot);
+ return (UNCONF);
+}
+
+int
+eisasubmatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct cfdata *cf = match;
+ struct eisa_attach_args *ea = aux;
+
+ if (cf->eisacf_slot != EISA_UNKNOWN_SLOT &&
+ cf->eisacf_slot != ea->ea_slot)
+ return 0;
+ return ((*cf->cf_driver->cd_match)(parent, match, aux));
+}
+
+void
+eisaattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct eisabus_attach_args *eba = aux;
+ bus_chipset_tag_t bc;
+ int slot;
+
+ printf("\n");
+
+ bc = eba->eba_bc;
+
+ /*
+ * Search for and attach subdevices.
+ *
+ * Slot 0 is the "motherboard" slot, and the code attaching
+ * the EISA bus should have already attached an ISA bus there.
+ */
+ for (slot = 1; slot < EISA_MAX_SLOT; slot++) {
+ struct eisa_attach_args ea;
+ struct cfdata *cf;
+ u_int slotaddr;
+ bus_io_handle_t slotioh;
+ int i;
+
+ ea.ea_bc = bc;
+ ea.ea_slot = slot;
+ slotaddr = EISA_SLOT_ADDR(slot);
+
+ /*
+ * Get a mapping for the whole slot-specific address
+ * space. If we can't, assume nothing's there but warn
+ * about it.
+ */
+ if (bus_io_map(bc, slotaddr, EISA_SLOT_SIZE, &slotioh)) {
+ printf("%s: can't map I/O space for slot %d\n", slot);
+ continue;
+ }
+
+ /* Get the vendor ID bytes */
+ for (i = 0; i < EISA_NVIDREGS; i++)
+ ea.ea_vid[i] = bus_io_read_1(bc, slotioh,
+ EISA_SLOTOFF_VID + i);
+
+ /* Check for device existence */
+ if (EISA_VENDID_NODEV(ea.ea_vid)) {
+#if 0
+ printf("no device at %s slot %d\n", self->dv_xname,
+ slot);
+ printf("\t(0x%x, 0x%x)\n", ea.ea_vid[0],
+ ea.ea_vid[1]);
+#endif
+ bus_io_unmap(bc, slotioh, EISA_SLOT_SIZE);
+ continue;
+ }
+
+ /* And check that the firmware didn't biff something badly */
+ if (EISA_VENDID_IDDELAY(ea.ea_vid)) {
+ printf("%s slot %d not configured by BIOS?\n",
+ self->dv_xname, slot);
+ bus_io_unmap(bc, slotioh, EISA_SLOT_SIZE);
+ continue;
+ }
+
+ /* Get the product ID bytes */
+ for (i = 0; i < EISA_NPIDREGS; i++)
+ ea.ea_pid[i] = bus_io_read_1(bc, slotioh,
+ EISA_SLOTOFF_PID + i);
+
+ /* Create the ID string from the vendor and product IDs */
+ ea.ea_idstring[0] = EISA_VENDID_0(ea.ea_vid);
+ ea.ea_idstring[1] = EISA_VENDID_1(ea.ea_vid);
+ ea.ea_idstring[2] = EISA_VENDID_2(ea.ea_vid);
+ ea.ea_idstring[3] = EISA_PRODID_0(ea.ea_pid);
+ ea.ea_idstring[4] = EISA_PRODID_1(ea.ea_pid);
+ ea.ea_idstring[5] = EISA_PRODID_2(ea.ea_pid);
+ ea.ea_idstring[6] = EISA_PRODID_3(ea.ea_pid);
+ ea.ea_idstring[7] = '\0'; /* sanity */
+
+ /* We no longer need the I/O handle; free it. */
+ bus_io_unmap(bc, slotioh, EISA_SLOT_SIZE);
+
+ /* Attach matching device. */
+ config_found_sm(self, &ea, eisaprint, eisasubmatch);
+ }
+}
+
+#ifdef EISAVERBOSE
+/*
+ * Descriptions of of known vendors and devices ("products").
+ */
+struct eisa_knowndev {
+ int flags;
+ const char *id, *name;
+};
+#define EISA_KNOWNDEV_NOPROD 0x01 /* match on vendor only */
+
+#include <dev/eisa/eisadevs_data.h>
+#endif /* EISAVERBOSE */
+
+void
+eisa_devinfo(id, cp)
+ const char *id;
+ char *cp;
+{
+ const char *name;
+ int onlyvendor;
+#ifdef EISAVERBOSE
+ struct eisa_knowndev *edp;
+ int match;
+ const char *unmatched = "unknown ";
+#else
+ const char *unmatched = "";
+#endif
+
+ onlyvendor = 0;
+ name = NULL;
+
+#ifdef EISAVERBOSE
+ /* find the device in the table, if possible. */
+ edp = eisa_knowndevs;
+ while (edp->id != NULL) {
+ /* check this entry for a match */
+ if ((edp->flags & EISA_KNOWNDEV_NOPROD) != 0)
+ match = !strncmp(edp->id, id, 3);
+ else
+ match = !strcmp(edp->id, id);
+ if (match) {
+ name = edp->name;
+ onlyvendor = (edp->flags & EISA_KNOWNDEV_NOPROD) != 0;
+ break;
+ }
+ edp++;
+ }
+#endif
+
+ if (name == NULL)
+ cp += sprintf(cp, "%sdevice %s", unmatched, id);
+ else if (onlyvendor) /* never if not EISAVERBOSE */
+ cp += sprintf(cp, "unknown %s device %s", name, id);
+ else
+ cp += sprintf(cp, "%s", name);
+}
diff --git a/sys/dev/eisa/eisadevs b/sys/dev/eisa/eisadevs
new file mode 100644
index 00000000000..8a1e3e9e035
--- /dev/null
+++ b/sys/dev/eisa/eisadevs
@@ -0,0 +1,67 @@
+$OpenBSD: eisadevs,v 1.1 1996/04/18 23:47:11 niklas Exp $
+/* $NetBSD: eisadevs,v 1.1 1996/02/26 23:46:22 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * List of known EISA vendors
+ */
+
+vendor ADP Adaptec
+vendor BUS BusLogic
+vendor DEC Digital Equipment
+vendor TCM 3Com
+
+/*
+ * List of known products, grouped by vendor.
+ */
+
+/* Adaptec products */
+product ADP 0000 AHA-1740
+product ADP 0001 AHA-1740A
+product ADP 0002 AHA-1742A
+product ADP 0400 AHA-1744
+product ADP 7770 AIC-7770 (on motherboard)
+product ADP 7771 AHA-274x
+product ADP 7756 AHA-284x (BIOS enabled)
+product ADP 7757 AHA-284x (BIOS disabled)
+
+/* BusLogic products */
+/* XXX */
+
+/* Digital Equipment products */
+product DEC 4250 DE425
+/* ??? DEC DEFEA */
+
+/* 3Com products */
+product TCM 5092 3C579-TP
+product TCM 5093 3C579
diff --git a/sys/dev/eisa/eisadevs.h b/sys/dev/eisa/eisadevs.h
new file mode 100644
index 00000000000..0f8b7c3b9b9
--- /dev/null
+++ b/sys/dev/eisa/eisadevs.h
@@ -0,0 +1,63 @@
+/*
+ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
+ *
+ * generated from:
+ * OpenBSD
+ */
+/* $NetBSD: eisadevs,v 1.1 1996/02/26 23:46:22 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * List of known products, grouped by vendor.
+ */
+
+/* Adaptec products */
+#define EISA_PRODUCT_ADP0000 "Adaptec AHA-1740"
+#define EISA_PRODUCT_ADP0001 "Adaptec AHA-1740A"
+#define EISA_PRODUCT_ADP0002 "Adaptec AHA-1742A"
+#define EISA_PRODUCT_ADP0400 "Adaptec AHA-1744"
+#define EISA_PRODUCT_ADP7770 "Adaptec AIC-7770 (on motherboard)"
+#define EISA_PRODUCT_ADP7771 "Adaptec AHA-274x"
+#define EISA_PRODUCT_ADP7756 "Adaptec AHA-284x (BIOS enabled)"
+#define EISA_PRODUCT_ADP7757 "Adaptec AHA-284x (BIOS disabled)"
+
+/* BusLogic products */
+/* XXX */
+
+/* Digital Equipment products */
+#define EISA_PRODUCT_DEC4250 "Digital Equipment DE425"
+/* ??? DEC DEFEA */
+
+/* 3Com products */
+#define EISA_PRODUCT_TCM5092 "3Com 3C579-TP"
+#define EISA_PRODUCT_TCM5093 "3Com 3C579"
diff --git a/sys/dev/eisa/eisadevs_data.h b/sys/dev/eisa/eisadevs_data.h
new file mode 100644
index 00000000000..2ba485a4c45
--- /dev/null
+++ b/sys/dev/eisa/eisadevs_data.h
@@ -0,0 +1,117 @@
+/*
+ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
+ *
+ * generated from:
+ * OpenBSD
+ */
+/* $NetBSD: eisadevs,v 1.1 1996/02/26 23:46:22 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995, 1996 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+struct eisa_knowndev eisa_knowndevs[] = {
+ {
+ 0,
+ "ADP0000",
+ EISA_PRODUCT_ADP0000,
+ },
+ {
+ 0,
+ "ADP0001",
+ EISA_PRODUCT_ADP0001,
+ },
+ {
+ 0,
+ "ADP0002",
+ EISA_PRODUCT_ADP0002,
+ },
+ {
+ 0,
+ "ADP0400",
+ EISA_PRODUCT_ADP0400,
+ },
+ {
+ 0,
+ "ADP7770",
+ EISA_PRODUCT_ADP7770,
+ },
+ {
+ 0,
+ "ADP7771",
+ EISA_PRODUCT_ADP7771,
+ },
+ {
+ 0,
+ "ADP7756",
+ EISA_PRODUCT_ADP7756,
+ },
+ {
+ 0,
+ "ADP7757",
+ EISA_PRODUCT_ADP7757,
+ },
+ {
+ 0,
+ "DEC4250",
+ EISA_PRODUCT_DEC4250,
+ },
+ {
+ 0,
+ "TCM5092",
+ EISA_PRODUCT_TCM5092,
+ },
+ {
+ 0,
+ "TCM5093",
+ EISA_PRODUCT_TCM5093,
+ },
+ {
+ EISA_KNOWNDEV_NOPROD,
+ "ADP",
+ "Adaptec",
+ },
+ {
+ EISA_KNOWNDEV_NOPROD,
+ "BUS",
+ "BusLogic",
+ },
+ {
+ EISA_KNOWNDEV_NOPROD,
+ "DEC",
+ "Digital Equipment",
+ },
+ {
+ EISA_KNOWNDEV_NOPROD,
+ "TCM",
+ "3Com",
+ },
+ { 0, NULL, NULL, }
+};
diff --git a/sys/dev/eisa/eisareg.h b/sys/dev/eisa/eisareg.h
index 1d53a1d5a16..b965dfeda3f 100644
--- a/sys/dev/eisa/eisareg.h
+++ b/sys/dev/eisa/eisareg.h
@@ -1,7 +1,8 @@
-/* $NetBSD: eisareg.h,v 1.1 1995/04/17 12:08:21 cgd Exp $ */
+/* $OpenBSD: eisareg.h,v 1.2 1996/04/18 23:47:12 niklas Exp $ */
+/* $NetBSD: eisareg.h,v 1.2 1996/02/27 00:21:02 cgd Exp $ */
/*
- * Copyright (c) 1995 Christopher G. Demetriou
+ * Copyright (c) 1995, 1996 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,6 +32,75 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef __DEV_EISA_EISAREG_H__
+#define __DEV_EISA_EISAREG_H__
+
/*
- * XXX something should go here. nothing does, yet.
+ * Register (etc.) descriptions for the EISA bus.
+
+ * Mostly culled from EISA chipset descriptions in:
+ * Intel Peripheral Components Databook (1992)
*/
+
+/*
+ * Max number of EISA slots in a machine. 64K I/O space total.
+ */
+#define EISA_MAX_SLOT 16 /* number of slots. 0 -> 0xf */
+
+/*
+ * Slot I/O space size, and I/O address of a given slot.
+ */
+#define EISA_SLOT_SIZE 0x1000
+#define EISA_SLOT_ADDR(s) ((s) * EISA_SLOT_SIZE)
+
+/*
+ * Slot offsets for important/standard registers.
+ */
+#define EISA_SLOTOFF_VID 0xc80 /* offset of vendor id regs */
+#define EISA_NVIDREGS 2
+#define EISA_SLOTOFF_PID 0xc82 /* offset of product id regs */
+#define EISA_NPIDREGS 2
+
+
+/*
+ * EISA ID functions, used to manipulate and decode EISA ID registers.
+ * ``Somebody was let out without adult supervision.''
+ */
+
+#define EISA_IDSTRINGLEN 8 /* length of ID string, incl. NUL */
+
+/*
+ * Vendor ID: three characters, encoded in 16 bits.
+ *
+ * EISA_VENDID_NODEV returns true if there's no device in the slot.
+ * EISA_VENDID_IDDELAY returns true if there's a device in the slot,
+ * but that device hasn't been configured by system firmware.
+ * EISA_VENDID_n returns the "n"th character of the vendor ID.
+ */
+#define EISA_VENDID_NODEV(vid) \
+ (((vid)[0] & 0x80) != 0)
+#define EISA_VENDID_IDDELAY(vid) \
+ (((vid)[0] & 0xf0) == 0x70)
+#define EISA_VENDID_0(vid) \
+ ((((vid)[0] & 0x7c) >> 2) + '@')
+#define EISA_VENDID_1(vid) \
+ (((((vid)[0] & 0x03) << 3) | (((vid)[1] & 0xe0) >> 5)) + '@')
+#define EISA_VENDID_2(vid) \
+ (((vid)[1] & 0x1f) + '@')
+
+/*
+ * Product ID: four hex digits, encoded in 16 bits (normal, sort of).
+ *
+ * EISA_PRIDID_n returns the "n"th hex digit of the product ID.
+ */
+#define __EISA_HEX_MAP "0123456789ABCDEF"
+#define EISA_PRODID_0(pid) \
+ (__EISA_HEX_MAP[(((pid)[0] >> 4) & 0xf)])
+#define EISA_PRODID_1(pid) \
+ (__EISA_HEX_MAP[(((pid)[0] >> 0) & 0xf)])
+#define EISA_PRODID_2(pid) \
+ (__EISA_HEX_MAP[(((pid)[1] >> 4) & 0xf)])
+#define EISA_PRODID_3(pid) \
+ (__EISA_HEX_MAP[(((pid)[1] >> 0) & 0xf)])
+
+#endif /* !__DEV_EISA_EISAREG_H__ */
diff --git a/sys/dev/eisa/eisavar.h b/sys/dev/eisa/eisavar.h
index 996e8dee1c3..d0ddeeb1fbc 100644
--- a/sys/dev/eisa/eisavar.h
+++ b/sys/dev/eisa/eisavar.h
@@ -1,7 +1,8 @@
-/* $NetBSD: eisavar.h,v 1.1 1995/04/17 12:08:23 cgd Exp $ */
+/* $OpenBSD: eisavar.h,v 1.3 1996/04/18 23:47:13 niklas Exp $ */
+/* $NetBSD: eisavar.h,v 1.4 1996/03/08 20:25:22 cgd Exp $ */
/*
- * Copyright (c) 1995 Christopher G. Demetriou
+ * Copyright (c) 1995, 1996 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,23 +32,75 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef __DEV_EISA_EISAVAR_H__
+#define __DEV_EISA_EISAVAR_H__
+
/*
- * XXX
- * XXX EISA AUTOCONFIG SHOULD BE SEPERATED FROM ISA AUTOCONFIG!!!
- * XXX
+ * Definitions for EISA autoconfiguration.
+ *
+ * This file describes types, constants, and functions which are used
+ * for EISA autoconfiguration.
*/
+#include <machine/bus.h>
+#include <dev/eisa/eisareg.h> /* For ID register & string info. */
+
+
+typedef int eisa_slot_t; /* really only needs to be 4 bits */
+
+
/*
- * pull in the ISA definitions
+ * EISA bus attach arguments.
*/
-#include <dev/isa/isavar.h>
+struct eisabus_attach_args {
+ char *eba_busname; /* XXX should be common */
+ bus_chipset_tag_t eba_bc; /* XXX should be common */
+};
+
/*
- * and bend them to our twisted ways:
- * map the functions, etc. that are used
+ * EISA device attach arguments.
*/
+struct eisa_attach_args {
+ bus_chipset_tag_t ea_bc;
+
+ eisa_slot_t ea_slot;
+ u_int8_t ea_vid[EISA_NVIDREGS];
+ u_int8_t ea_pid[EISA_NPIDREGS];
+ char ea_idstring[EISA_IDSTRINGLEN];
+};
+
+
+/*
+ * Easy to remember names for EISA device locators.
+ */
+
+#define eisacf_slot cf_loc[0] /* slot */
+
+
+/*
+ * EISA device locator values that mean "unknown" or "unspecified."
+ * Note that not all are supplied by 'config' and should be filled
+ * in by the device if appropriate.
+ */
+
+#define EISA_UNKNOWN_SLOT ((eisa_slot_t)-1)
+
+/*
+ * The EISA bus cfdriver, so that subdevices can more easily tell
+ * what bus they're on.
+ */
+
+extern struct cfdriver eisacd;
+
+/*
+ * XXX interrupt attachment, etc., is done by using the ISA interfaces.
+ * XXX THIS SHOULD CHANGE.
+ */
+
+#include <dev/isa/isavar.h>
-#define eisa_attach_args isa_attach_args /* XXX */
-#define eisadev isadev /* XXX */
#define eisa_intr_establish isa_intr_establish /* XXX */
#define eisa_intr_disestablish isa_intr_disestablish /* XXX */
+
+#endif /* !__DEV_EISA_EISAVAR_H__ */
diff --git a/sys/dev/eisa/files.eisa b/sys/dev/eisa/files.eisa
index 1b06919738e..7db823d1a57 100644
--- a/sys/dev/eisa/files.eisa
+++ b/sys/dev/eisa/files.eisa
@@ -1,17 +1,13 @@
-# $NetBSD: files.eisa,v 1.2 1995/04/17 17:54:15 cgd Exp $
+# $OpenBSD: files.eisa,v 1.2 1996/04/18 23:47:14 niklas Exp $
+# $NetBSD: files.eisa,v 1.6 1996/03/04 03:29:12 cgd Exp $
#
# Config.new file and device description for machine-independent EISA code.
# Included by ports that need it. Requires that the SCSI files be
# defined first.
-# XXX IN A PERFECT WORLD:
-# ports should define their own "device eisa" line (like the one below,
-# but with the correct bus attachment).
-
-# XXX there should be MI EISA configuration, but not yet.
-#device eisa at root {[slot = -1]}
-#file dev/eisa/eisa.c eisa
+device eisa at eisabus {[slot = -1]}
+file dev/eisa/eisa.c eisa needs-flag
# Adaptec AHA-174x EISA SCSI Host Adapter family
-device ahb at isa: scsi # XXX should be at EISA
-file dev/eisa/aha1742.c ahb
+device ahb at eisa: scsi
+file dev/eisa/aha1742.c ahb