summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Murphree <smurph@cvs.openbsd.org>2002-02-16 05:41:29 +0000
committerSteve Murphree <smurph@cvs.openbsd.org>2002-02-16 05:41:29 +0000
commitd09b8340dd57785f736d705ab1d2f31eec8b95b2 (patch)
tree8fbe57231d53b816dccec3a22e34de46267cb98b
parent2544ae041415b528cf5a68f8fb1b914f4cd86cfb (diff)
eisa support for ahc. (left out)
-rw-r--r--sys/dev/eisa/ahc_eisa.c87
1 files changed, 53 insertions, 34 deletions
diff --git a/sys/dev/eisa/ahc_eisa.c b/sys/dev/eisa/ahc_eisa.c
index 37c3642f56f..cdd5e4f2142 100644
--- a/sys/dev/eisa/ahc_eisa.c
+++ b/sys/dev/eisa/ahc_eisa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahc_eisa.c,v 1.9 2000/03/22 02:55:40 smurph Exp $ */
+/* $OpenBSD: ahc_eisa.c,v 1.10 2002/02/16 05:41:28 smurph Exp $ */
/* $NetBSD: ahc_eisa.c,v 1.10 1996/10/21 22:30:58 thorpej Exp $ */
/*
@@ -32,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ahc_eisa.c,v 1.9 2000/03/22 02:55:40 smurph Exp $
+ * $Id: ahc_eisa.c,v 1.10 2002/02/16 05:41:28 smurph Exp $
*/
#include "eisa.h"
@@ -51,22 +51,12 @@
#include <dev/eisa/eisareg.h>
#include <dev/eisa/eisavar.h>
#include <dev/eisa/eisadevs.h>
+#include <dev/ic/aic7xxx_openbsd.h>
+#include <dev/ic/aic7xxx_inline.h>
#include <dev/ic/aic7xxxreg.h>
-#include <dev/ic/aic7xxxvar.h>
#define AHC_EISA_SLOT_OFFSET 0xc00
#define AHC_EISA_IOSIZE 0x100
-#define INTDEF 0x5cul /* Interrupt Definition Register */
-
-/*
- * Under normal circumstances, these messages are unnecessary
- * and not terribly cosmetic.
- */
-#ifdef DEBUG
-#define bootverbose 1
-#else
-#define bootverbose 1
-#endif
int ahc_eisa_irq __P((bus_space_tag_t, bus_space_handle_t));
int ahc_eisa_match __P((struct device *, void *, void *));
@@ -94,7 +84,7 @@ bus_space_handle_t ioh;
bus_space_write_1(iot, ioh, HCNTRL, hcntrl | PAUSE);
intdef = bus_space_read_1(iot, ioh, INTDEF);
- switch (irq = (intdef & 0xf)) {
+ switch (irq = (intdef & VECTOR)) {
case 9:
case 10:
case 11:
@@ -152,8 +142,6 @@ ahc_eisa_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- ahc_chip chip;
- u_char channel = 'A'; /* Only one channel */
struct ahc_softc *ahc = (void *)self;
struct eisa_attach_args *ea = aux;
bus_space_tag_t iot = ea->ea_iot;
@@ -165,8 +153,23 @@ void *aux;
u_int biosctrl;
u_int scsiconf;
u_int scsiconf1;
+ u_int intdef;
- ahc->sc_dmat = ea->ea_dmat;
+ /*
+ * We really don't allocate our softc, but
+ * we need to do the initialization. And this
+ * also allocates the platform_data structure.
+ */
+ ahc_alloc(ahc, ahc->sc_dev.dv_xname);
+
+ ahc_set_name(ahc, ahc->sc_dev.dv_xname);
+ ahc_set_unit(ahc, ahc->sc_dev.dv_unit);
+
+ /* set dma tags */
+ ahc->parent_dmat = ea->ea_dmat;
+ ahc->buffer_dmat = ea->ea_dmat;
+ ahc->shared_data_dmat = ea->ea_dmat;
+
if (bus_space_map(iot, EISA_SLOT_ADDR(ea->ea_slot) +
AHC_EISA_SLOT_OFFSET, AHC_EISA_IOSIZE, 0, &ioh))
panic("ahc_eisa_attach: could not map I/O addresses");
@@ -175,23 +178,29 @@ void *aux;
if (strcmp(ea->ea_idstring, "ADP7770") == 0) {
model = EISA_PRODUCT_ADP7770;
- chip = AHC_AIC7770|AHC_EISA;
} else if (strcmp(ea->ea_idstring, "ADP7771") == 0) {
model = EISA_PRODUCT_ADP7771;
- chip = AHC_AIC7770|AHC_EISA;
} else {
panic("ahc_eisa_attach: Unknown device type %s",
ea->ea_idstring);
}
printf(": %s\n", model);
-
- ahc_construct(ahc, iot, ioh, chip, AHC_FNONE, AHC_AIC7770_FE, channel);
ahc->channel = 'A';
ahc->channel_b = 'B';
+ ahc->chip = AHC_AIC7770|AHC_EISA;
+ ahc->features = AHC_AIC7770_FE;
+ ahc->bugs |= AHC_TMODE_WIDEODD_BUG;
+ ahc->flags |= AHC_PAGESCBS;
+
if (ahc_reset(ahc) != 0)
return;
+ /* See if we are edge triggered */
+ intdef = ahc_inb(ahc, INTDEF);
+ if ((intdef & EDGE_TRIG) != 0)
+ ahc->flags |= AHC_EDGE_INTERRUPT;
+
if (eisa_intr_map(ec, irq, &ih)) {
printf("%s: couldn't map interrupt (%d)\n",
ahc->sc_dev.dv_xname, irq);
@@ -221,7 +230,7 @@ void *aux;
/* Get the primary channel information */
if ((biosctrl & CHANNEL_B_PRIMARY) != 0)
- ahc->flags |= AHC_CHANNEL_B_PRIMARY;
+ ahc->platform_data->channel_b_primary = TRUE;
if ((biosctrl & BIOSMODE) == BIOSDISABLED) {
ahc->flags |= AHC_USEDEFAULTS;
@@ -257,17 +266,17 @@ void *aux;
u_char sblkctl;
u_char sblkctl_orig;
- sblkctl_orig = AHC_INB(ahc, SBLKCTL);
+ sblkctl_orig = ahc_inb(ahc, SBLKCTL);
sblkctl = sblkctl_orig ^ AUTOFLUSHDIS;
- AHC_OUTB(ahc, SBLKCTL, sblkctl);
- sblkctl = AHC_INB(ahc, SBLKCTL);
+ ahc_outb(ahc, SBLKCTL, sblkctl);
+ sblkctl = ahc_inb(ahc, SBLKCTL);
if (sblkctl != sblkctl_orig) {
id_string = "aic7770 >= Rev E, ";
/*
* Ensure autoflush is enabled
*/
sblkctl &= ~AUTOFLUSHDIS;
- AHC_OUTB(ahc, SBLKCTL, sblkctl);
+ ahc_outb(ahc, SBLKCTL, sblkctl);
/* Allow paging on this adapter */
ahc->flags |= AHC_PAGESCBS;
@@ -279,9 +288,9 @@ void *aux;
/* Setup the FIFO threshold and the bus off time */
{
- u_char hostconf = AHC_INB(ahc, HOSTCONF);
- AHC_OUTB(ahc, BUSSPD, hostconf & DFTHRSH);
- AHC_OUTB(ahc, BUSTIME, (hostconf << 2) & BOFF);
+ u_char hostconf = ahc_inb(ahc, HOSTCONF);
+ ahc_outb(ahc, BUSSPD, hostconf & DFTHRSH);
+ ahc_outb(ahc, BUSTIME, (hostconf << 2) & BOFF);
}
/*
@@ -292,21 +301,29 @@ void *aux;
return;
}
+ /* Special func to force negotiation */
+ ahc_force_neg(ahc);
+
+ /*
+ * Link this softc in with all other ahc instances.
+ */
+ ahc_softc_insert(ahc);
+
/*
* Enable the board's BUS drivers
*/
- AHC_OUTB(ahc, BCTL, ENABLE);
+ ahc_outb(ahc, BCTL, ENABLE);
intrstr = eisa_intr_string(ec, ih);
/*
* The IRQMS bit enables level sensitive interrupts only allow
* IRQ sharing if its set.
*/
- ahc->sc_ih = eisa_intr_establish(ec, ih, ahc->pause & IRQMS
+ ahc->platform_data->ih = eisa_intr_establish(ec, ih, ahc->pause & IRQMS
? IST_LEVEL : IST_EDGE,
- IPL_BIO, ahc_intr, ahc,
+ IPL_BIO, ahc_platform_intr, ahc,
ahc->sc_dev.dv_xname);
- if (ahc->sc_ih == NULL) {
+ if (ahc->platform_data->ih == NULL) {
printf("%s: couldn't establish interrupt",
ahc->sc_dev.dv_xname);
if (intrstr != NULL)
@@ -318,6 +335,8 @@ void *aux;
if (intrstr != NULL)
printf("%s: interrupting at %s\n", ahc->sc_dev.dv_xname,
intrstr);
+
+ ahc_intr_enable(ahc, TRUE);
/* Attach sub-devices - always succeeds */
ahc_attach(ahc);