Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev * Remove aif_get_mailboxstatus() from the aac_interf...
details: https://anonhg.NetBSD.org/src/rev/82754cd91b0e
branches: trunk
changeset: 574476:82754cd91b0e
user: briggs <briggs%NetBSD.org@localhost>
date: Tue Mar 01 03:31:45 2005 +0000
description:
* Remove aif_get_mailboxstatus() from the aac_interface structure. Replace
with aif_get_mailbox(). Make it return uint32_t instead of 'int'.
* Add an AAC_GET_MAILBOX() macro and change AAC_GET_MAILBOXSTATUS() to use
that.
* Update the Dell PERC 2QC quirk code to use AAC_GET_MAILBOX instead of the
StrongARM-specific code. While StrongARM access is correct for that card,
it's a bad example of how to access the mailbox registers.
* Add the GETINFO command and use it to get and display the card's
supported options at a verbose level during attachment.
diffstat:
sys/dev/ic/aac.c | 41 +++++++++++++++++++++++++++++++++++------
sys/dev/ic/aacreg.h | 3 ++-
sys/dev/ic/aacvar.h | 18 +++++++++++++-----
sys/dev/pci/aac_pci.c | 26 +++++++++++++-------------
4 files changed, 63 insertions(+), 25 deletions(-)
diffs (266 lines):
diff -r 48d9068d158b -r 82754cd91b0e sys/dev/ic/aac.c
--- a/sys/dev/ic/aac.c Tue Mar 01 03:19:17 2005 +0000
+++ b/sys/dev/ic/aac.c Tue Mar 01 03:31:45 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aac.c,v 1.16 2005/02/27 00:27:00 perry Exp $ */
+/* $NetBSD: aac.c,v 1.17 2005/03/01 03:31:45 briggs Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.16 2005/02/27 00:27:00 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.17 2005/03/01 03:31:45 briggs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -340,9 +340,18 @@
return (table[i + 1].string);
}
+/*
+ * bitmask_snprintf(9) format string for the adapter options.
+ */
+static char *optfmt =
+ "\20\1SNAPSHOT\2CLUSTERS\3WCACHE\4DATA64\5HOSTTIME\6RAID50"
+ "\7WINDOW4GB"
+ "\10SCSIUPGD\11SOFTERR\12NORECOND\13SGMAP64\14ALARM\15NONDASD";
+
static void
aac_describe_controller(struct aac_softc *sc)
{
+ u_int8_t fmtbuf[256];
u_int8_t buf[AAC_FIB_DATASIZE];
u_int16_t bufsize;
struct aac_adapter_info *info;
@@ -386,6 +395,11 @@
info->MonitorRevision.buildNumber,
((u_int32_t)info->SerialNumber & 0xffffff));
+ aprint_verbose("%s: Controller supports: %s\n",
+ sc->sc_dv.dv_xname,
+ bitmask_snprintf(sc->sc_supported_options, optfmt, fmtbuf,
+ sizeof(fmtbuf)));
+
/* Save the kernel revision structure for later use. */
sc->sc_revision = info->KernelRevision;
}
@@ -397,7 +411,7 @@
static int
aac_check_firmware(struct aac_softc *sc)
{
- u_int32_t major, minor;
+ u_int32_t major, minor, opts;
if ((sc->sc_quirks & AAC_QUIRK_PERC2QC) != 0) {
if (aac_sync_command(sc, AAC_MONKER_GETKERNVER, 0, 0, 0, 0,
@@ -408,8 +422,8 @@
}
/* These numbers are stored as ASCII! */
- major = (AAC_GETREG4(sc, AAC_SA_MAILBOX + 4) & 0xff) - 0x30;
- minor = (AAC_GETREG4(sc, AAC_SA_MAILBOX + 8) & 0xff) - 0x30;
+ major = (AAC_GET_MAILBOX(sc, 1) & 0xff) - 0x30;
+ minor = (AAC_GET_MAILBOX(sc, 2) & 0xff) - 0x30;
if (major == 1) {
aprint_error(
"%s: firmware version %d.%d not supported.\n",
@@ -418,6 +432,15 @@
}
}
+ if (aac_sync_command(sc, AAC_MONKER_GETINFO, 0, 0, 0, 0, NULL)) {
+ aprint_error("%s: GETINFO failed\n", sc->sc_dv.dv_xname);
+ return (1);
+ }
+ opts = AAC_GET_MAILBOX(sc, 1);
+ sc->sc_supported_options = opts;
+
+ /* XXX -- Enable 64-bit sglists if we can */
+
return (0);
}
@@ -732,6 +755,8 @@
&i, sizeof(i), NULL, NULL))
printf("%s: unable to halt controller\n",
sc->sc_dv.dv_xname);
+
+ sc->sc_flags &= ~AAC_ONLINE;
}
}
@@ -967,7 +992,7 @@
fib->Header.StructType = AAC_FIBTYPE_TFIB;
fib->Header.Size = htole16(sizeof(*fib) + datasize);
fib->Header.SenderSize = htole16(sizeof(*fib));
- fib->Header.SenderFibAddress = htole32((u_int32_t)fib); /* XXX */
+ fib->Header.SenderFibAddress = 0; /* htole32((u_int32_t)fib); * XXX */
fib->Header.ReceiverFibAddress = htole32(fibpa);
/*
@@ -988,6 +1013,10 @@
*/
if (aac_sync_command(sc, AAC_MONKER_SYNCFIB, fibpa, 0, 0, 0, &status))
return (EIO);
+ if (status != 1) {
+ printf("%s: syncfib command %04x status %08x\n",
+ sc->sc_dv.dv_xname, command, status);
+ }
bus_dmamap_sync(sc->sc_dmat, sc->sc_common_dmamap,
(caddr_t)fib - (caddr_t)sc->sc_common, sizeof(*fib),
diff -r 48d9068d158b -r 82754cd91b0e sys/dev/ic/aacreg.h
--- a/sys/dev/ic/aacreg.h Tue Mar 01 03:19:17 2005 +0000
+++ b/sys/dev/ic/aacreg.h Tue Mar 01 03:31:45 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aacreg.h,v 1.3 2005/02/27 00:27:00 perry Exp $ */
+/* $NetBSD: aacreg.h,v 1.4 2005/03/01 03:31:45 briggs Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -358,6 +358,7 @@
#define AAC_MONKER_INITSTRUCT 0x05
#define AAC_MONKER_SYNCFIB 0x0c
#define AAC_MONKER_GETKERNVER 0x11
+#define AAC_MONKER_GETINFO 0x19
/*
* Command status values
diff -r 48d9068d158b -r 82754cd91b0e sys/dev/ic/aacvar.h
--- a/sys/dev/ic/aacvar.h Tue Mar 01 03:19:17 2005 +0000
+++ b/sys/dev/ic/aacvar.h Tue Mar 01 03:31:45 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aacvar.h,v 1.5 2005/02/27 00:27:00 perry Exp $ */
+/* $NetBSD: aacvar.h,v 1.6 2005/03/01 03:31:45 briggs Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -148,7 +148,14 @@
/*
* Quirk listings.
*/
-#define AAC_QUIRK_PERC2QC 0x0001
+#define AAC_QUIRK_PERC2QC (1 << 0) /* Dell PERC 2QC */
+#define AAC_QUIRK_SG_64BIT (1 << 4) /* Use 64-bit S/G addresses */
+#define AAC_QUIRK_4GB_WINDOW (1 << 5) /* Device can access host mem
+ * in 2GB-4GB range */
+#define AAC_QUIRK_NO4GB (1 << 6) /* Can't access host mem >2GB */
+#define AAC_QUIRK_256FIBS (1 << 7) /* Can only handle 256 cmds */
+#define AAC_QUIRK_BROKEN_MMAP (1 << 8) /* Broken HostPhysMemPages */
+
/*
* We gather a number of adapter-visible items into a single structure.
@@ -190,7 +197,7 @@
void (*aif_set_istatus)(struct aac_softc *, int);
void (*aif_set_mailbox)(struct aac_softc *, u_int32_t,
u_int32_t, u_int32_t, u_int32_t, u_int32_t);
- int (*aif_get_mailboxstatus)(struct aac_softc *);
+ uint32_t (*aif_get_mailbox)(struct aac_softc *, int);
void (*aif_set_interrupts)(struct aac_softc *, int);
};
@@ -205,8 +212,8 @@
((sc)->sc_if.aif_set_mailbox((sc), (command), (arg0), \
(arg1), (arg2), (arg3))); \
} while(0)
-#define AAC_GET_MAILBOXSTATUS(sc) \
- ((sc)->sc_if.aif_get_mailboxstatus(sc))
+#define AAC_GET_MAILBOX(sc, mb) ((sc)->sc_if.aif_get_mailbox(sc, mb))
+#define AAC_GET_MAILBOXSTATUS(sc) (AAC_GET_MAILBOX(sc, 0))
#define AAC_MASK_INTERRUPTS(sc) \
((sc)->sc_if.aif_set_interrupts((sc), 0))
#define AAC_UNMASK_INTERRUPTS(sc) \
@@ -288,6 +295,7 @@
struct aac_drive sc_hdr[AAC_MAX_CONTAINERS];
int sc_nunits;
int sc_flags;
+ uint32_t sc_supported_options;
};
#define AAC_HWIF_I960RX 0
#define AAC_HWIF_STRONGARM 1
diff -r 48d9068d158b -r 82754cd91b0e sys/dev/pci/aac_pci.c
--- a/sys/dev/pci/aac_pci.c Tue Mar 01 03:19:17 2005 +0000
+++ b/sys/dev/pci/aac_pci.c Tue Mar 01 03:31:45 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aac_pci.c,v 1.11 2005/02/27 00:27:32 perry Exp $ */
+/* $NetBSD: aac_pci.c,v 1.12 2005/03/01 03:31:45 briggs Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aac_pci.c,v 1.11 2005/02/27 00:27:32 perry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aac_pci.c,v 1.12 2005/03/01 03:31:45 briggs Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -103,7 +103,7 @@
void aac_rx_clear_istatus(struct aac_softc *, int);
void aac_rx_set_mailbox(struct aac_softc *, u_int32_t, u_int32_t,
u_int32_t, u_int32_t, u_int32_t);
-int aac_rx_get_mailboxstatus(struct aac_softc *);
+uint32_t aac_rx_get_mailbox(struct aac_softc *, int);
void aac_rx_set_interrupts(struct aac_softc *, int);
/* StrongARM interface */
@@ -113,7 +113,7 @@
void aac_sa_clear_istatus(struct aac_softc *, int);
void aac_sa_set_mailbox(struct aac_softc *, u_int32_t, u_int32_t,
u_int32_t, u_int32_t, u_int32_t);
-int aac_sa_get_mailboxstatus(struct aac_softc *);
+uint32_t aac_sa_get_mailbox(struct aac_softc *, int);
void aac_sa_set_interrupts(struct aac_softc *, int);
const struct aac_interface aac_rx_interface = {
@@ -122,7 +122,7 @@
aac_rx_get_istatus,
aac_rx_clear_istatus,
aac_rx_set_mailbox,
- aac_rx_get_mailboxstatus,
+ aac_rx_get_mailbox,
aac_rx_set_interrupts
};
@@ -132,7 +132,7 @@
aac_sa_get_istatus,
aac_sa_clear_istatus,
aac_sa_set_mailbox,
- aac_sa_get_mailboxstatus,
+ aac_sa_get_mailbox,
aac_sa_set_interrupts
};
@@ -585,20 +585,20 @@
}
/*
- * Fetch the immediate command status word
+ * Fetch the specified mailbox
*/
-int
-aac_sa_get_mailboxstatus(struct aac_softc *sc)
+uint32_t
+aac_sa_get_mailbox(struct aac_softc *sc, int mb)
{
- return (AAC_GETREG4(sc, AAC_SA_MAILBOX));
+ return (AAC_GETREG4(sc, AAC_SA_MAILBOX + (mb * 4)));
}
-int
-aac_rx_get_mailboxstatus(struct aac_softc *sc)
+uint32_t
+aac_rx_get_mailbox(struct aac_softc *sc, int mb)
{
- return (AAC_GETREG4(sc, AAC_RX_MAILBOX));
+ return (AAC_GETREG4(sc, AAC_RX_MAILBOX + (mb * 4)));
}
/*
Home |
Main Index |
Thread Index |
Old Index