Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/isa Update ISA/VL frontend for new ahc driver ...
details: https://anonhg.NetBSD.org/src/rev/b10a8d757576
branches: trunk
changeset: 483652:b10a8d757576
user: fvdl <fvdl%NetBSD.org@localhost>
date: Wed Mar 15 02:05:19 2000 +0000
description:
Update ISA/VL frontend for new ahc driver (done by Noriyuki Soda).
diffstat:
sys/arch/i386/isa/ahc_isa.c | 305 +++++++++++++++++++++++--------------------
1 files changed, 165 insertions(+), 140 deletions(-)
diffs (truncated from 432 to 300 lines):
diff -r 2960e728d44c -r b10a8d757576 sys/arch/i386/isa/ahc_isa.c
--- a/sys/arch/i386/isa/ahc_isa.c Wed Mar 15 02:04:43 2000 +0000
+++ b/sys/arch/i386/isa/ahc_isa.c Wed Mar 15 02:05:19 2000 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: ahc_isa.c,v 1.12 1998/03/22 12:53:55 drochner Exp $ */
+/* $NetBSD: ahc_isa.c,v 1.13 2000/03/15 02:05:19 fvdl Exp $ */
/*
* Product specific probe and attach routines for:
- * 284X VLbus SCSI controllers
+ * AHA-284X VL-bus SCSI controllers
*
- * Copyright (c) 1994, 1995, 1996 Justin T. Gibbs.
+ * Copyright (c) 1994, 1995, 1996, 1997, 1998 Justin T. Gibbs.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -13,10 +13,7 @@
* 1. Redistributions of source code must retain the above copyright
* notice immediately at the beginning of the file, without modification,
* 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. The name of the author may not be used to endorse or promote products
+ * 2. 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 AND CONTRIBUTORS ``AS IS'' AND
@@ -30,6 +27,8 @@
* 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.
+ *
+ * $FreeBSD: src/sys/dev/aic7xxx/ahc_eisa.c,v 1.15 2000/01/29 14:22:19 peter Exp $
*/
/*-
@@ -115,9 +114,6 @@
*
* -- Jason R. Thorpe <thorpej%NetBSD.ORG@localhost>
* July 12, 1996
- *
- * TODO: some code could be shared with ahc_eisa.c, but it would probably
- * be a logistical mightmare to even try.
*/
#include <sys/param.h>
@@ -140,20 +136,32 @@
#include <dev/eisa/eisavar.h>
#include <dev/eisa/eisadevs.h>
-#include <dev/ic/aic7xxxreg.h>
+#include <dev/microcode/aic7xxx/aic7xxx_reg.h>
#include <dev/ic/aic7xxxvar.h>
+#include <dev/ic/aic77xxreg.h>
+#include <dev/ic/aic77xxvar.h>
+#include <dev/ic/smc93cx6var.h>
+
+/*
+ * Under normal circumstances, these messages are unnecessary
+ * and not terribly cosmetic.
+ */
+#ifdef DEBUG
+#define bootverbose 1
+#else
+#define bootverbose 1
+#endif
/* IO port address setting range as EISA slot number */
#define AHC_ISA_MIN_SLOT 0x1 /* from iobase = 0x1c00 */
#define AHC_ISA_MAX_SLOT 0xe /* to iobase = 0xec00 */
-#define AHC_ISA_SLOT_OFFSET 0xc00 /* offset from EISA IO space */
-#define AHC_ISA_IOSIZE 0x100
+#define AHC_ISA_SLOT_OFFSET AHC_EISA_SLOT_OFFSET
+#define AHC_ISA_IOSIZE AHC_EISA_IOSIZE
/*
* I/O port offsets
*/
-#define INTDEF 0x5cul /* Interrupt Definition Register */
#define AHC_ISA_VID (EISA_SLOTOFF_VID - AHC_ISA_SLOT_OFFSET)
#define AHC_ISA_PID (EISA_SLOTOFF_PID - AHC_ISA_SLOT_OFFSET)
#define AHC_ISA_PRIMING AHC_ISA_VID /* enable vendor/product ID */
@@ -164,15 +172,15 @@
#define AHC_ISA_PRIMING_VID(index) (AHC_ISA_VID + (index))
#define AHC_ISA_PRIMING_PID(index) (AHC_ISA_PID + (index))
-int ahc_isa_irq __P((bus_space_tag_t, bus_space_handle_t));
int ahc_isa_idstring __P((bus_space_tag_t, bus_space_handle_t, char *));
int ahc_isa_match __P((struct isa_attach_args *, bus_addr_t));
int ahc_isa_probe __P((struct device *, struct cfdata *, void *));
void ahc_isa_attach __P((struct device *, struct device *, void *));
+void aha2840_load_seeprom __P((struct ahc_softc *ahc));
struct cfattach ahc_isa_ca = {
- sizeof(struct ahc_data), ahc_isa_probe, ahc_isa_attach
+ sizeof(struct ahc_softc), ahc_isa_probe, ahc_isa_attach
};
/*
@@ -192,36 +200,6 @@
static LIST_HEAD(, ahc_isa_slot) ahc_isa_all_slots;
static int ahc_isa_slot_initialized;
-/*
- * Return irq setting of the board, otherwise -1.
- */
-int
-ahc_isa_irq(iot, ioh)
- bus_space_tag_t iot;
- bus_space_handle_t ioh;
-{
- int irq;
- u_char intdef;
-
- ahc_reset("ahc_isa", iot, ioh);
- intdef = bus_space_read_1(iot, ioh, INTDEF);
- switch (irq = (intdef & 0xf)) {
- case 9:
- case 10:
- case 11:
- case 12:
- case 14:
- case 15:
- break;
- default:
- printf("ahc_isa_irq: illegal irq setting %d\n", irq);
- return -1;
- }
-
- /* Note that we are going and return (to probe) */
- return irq;
-}
-
int
ahc_isa_idstring(iot, ioh, idstring)
bus_space_tag_t iot;
@@ -309,7 +287,7 @@
strcmp(idstring, "ADP7757"))
irq = -1; /* unknown ID strings */
else
- irq = ahc_isa_irq(iot, ioh);
+ irq = ahc_aic77xx_irq(iot, ioh);
bus_space_unmap(iot, ioh, AHC_ISA_IOSIZE);
@@ -393,14 +371,13 @@
struct device *parent, *self;
void *aux;
{
- ahc_type type;
- struct ahc_data *ahc = (void *)self;
+ struct ahc_softc *ahc = (void *)self;
struct isa_attach_args *ia = aux;
bus_space_tag_t iot = ia->ia_iot;
bus_space_handle_t ioh;
- int irq;
+ int irq, intrtype;
+ const char *intrtypestr;
char idstring[EISA_IDSTRINGLEN];
- const char *model;
if (bus_space_map(iot, ia->ia_iobase, ia->ia_iosize, 0, &ioh)) {
printf(": can't map i/o space\n");
@@ -408,127 +385,175 @@
}
if (!ahc_isa_idstring(iot, ioh, idstring)) {
printf(": can't read ID string\n");
- return;
+ goto free_io;
}
- if ((irq = ahc_isa_irq(iot, ioh)) < 0) {
- printf(": ahc_isa_irq failed\n");
- return;
+ if ((irq = ahc_aic77xx_irq(iot, ioh)) < 0) {
+ printf(": ahc_aic77xx_irq failed\n");
+ goto free_io;
}
if (strcmp(idstring, "ADP7756") == 0) {
- model = EISA_PRODUCT_ADP7756;
- type = AHC_284;
+ printf(": %s\n", EISA_PRODUCT_ADP7756);
} else if (strcmp(idstring, "ADP7757") == 0) {
- model = EISA_PRODUCT_ADP7757;
- type = AHC_284;
+ printf(": %s\n", EISA_PRODUCT_ADP7757);
} else {
printf(": unknown device type %s\n", idstring);
- return;
+ goto free_io;
}
- printf(": %s\n", model);
- ahc_construct(ahc, iot, ioh, ia->ia_dmat, type, AHC_FNONE);
+ if (ahc_alloc(ahc, ioh, iot, ia->ia_dmat,
+ AHC_AIC7770|AHC_VL, AHC_AIC7770_FE, AHC_FNONE))
+ goto free_io;
/*
* Tell the bus-dma interface that we can do 32bit dma
+ * NOTE: this variable is first referenced in ahc_init().
*/
ahc->sc_dmaflags = ISABUS_DMA_32BIT;
-#ifdef DEBUG
+ ahc->channel = 'A';
+ ahc->channel_b = 'B';
+ if (ahc_reset(ahc) != 0)
+ goto free_ahc;
+
+ /*
+ * The IRQMS bit enables level sensitive interrupts. Only allow
+ * IRQ sharing if it's set.
+ * NOTE: ahc->pause is initialized in ahc_alloc().
+ */
+ if (ahc->pause & IRQMS) {
+ intrtype = IST_LEVEL;
+ intrtypestr = "level sensitive";
+ } else {
+ intrtype = IST_EDGE;
+ intrtypestr = "edge triggered";
+ }
+ ahc->ih = isa_intr_establish(ia->ia_ic, irq,
+ intrtype, IPL_BIO, ahc_intr, ahc);
+ if (ahc->ih == NULL) {
+ printf("%s: couldn't establish %s interrupt\n",
+ ahc->sc_dev.dv_xname, intrtypestr);
+ goto free_ahc;
+ }
+
/*
* Tell the user what type of interrupts we're using.
* usefull for debugging irq problems
*/
- printf( "%s: Using %s Interrupts\n", ahc_name(ahc),
- ahc->pause & IRQMS ? "Level Sensitive" : "Edge Triggered");
-#endif
+ if (bootverbose) {
+ printf("%s: Using %s interrupts\n",
+ ahc->sc_dev.dv_xname, intrtypestr);
+ }
/*
* Now that we know we own the resources we need, do the
* card initialization.
- *
- * First, the aic7770 card specific setup.
*/
+ aha2840_load_seeprom(ahc);
+
+ /* Attach sub-devices */
+ if (ahc_aic77xx_attach(ahc) == 0)
+ return; /* succeed */
- /* XXX
- * On AHA-284x,
- * all values are automagically intialized at
- * POST for these cards, so we can always rely
- * on the Scratch Ram values. However, we should
- * read the SEEPROM here (Dan has the code to do
- * it) so we can say what kind of translation the
- * BIOS is using. Printing out the geometry could
- * save a lot of users the grief of failed installs.
- */
+ /* failed */
+ isa_intr_disestablish(ia->ia_ic, ahc->ih);
+free_ahc:
+ ahc_free(ahc);
+free_io:
+ bus_space_unmap(iot, ioh, ia->ia_iosize);
+}
+
+/*
+ * Read the 284x SEEPROM.
+ */
+void
+aha2840_load_seeprom(struct ahc_softc *ahc)
+{
+ struct seeprom_descriptor sd;
+ struct seeprom_config sc;
+ u_int16_t checksum = 0;
+ u_int8_t scsi_conf;
+ int have_seeprom;
- /*
- * See if we have a Rev E or higher aic7770. Anything below a
- * Rev E will have a R/O autoflush disable configuration bit.
- * It's still not clear exactly what is differenent about the Rev E.
- * We think it allows 8 bit entries in the QOUTFIFO to support
- * "paging" SCBs so you can have more than 4 commands active at
- * once.
- */
- {
- char *id_string;
- u_char sblkctl;
- u_char sblkctl_orig;
Home |
Main Index |
Thread Index |
Old Index