Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sun3/dev Better implementation of driver "match" fu...
details: https://anonhg.NetBSD.org/src/rev/b71ad9b389d3
branches: trunk
changeset: 471719:b71ad9b389d3
user: gwr <gwr%NetBSD.org@localhost>
date: Fri Apr 09 04:26:27 1999 +0000
description:
Better implementation of driver "match" function,
and warning/error cleanup.
diffstat:
sys/arch/sun3/dev/sebuf.c | 37 +++++++++++++++++++++++++++++++------
sys/arch/sun3/dev/si_sebuf.c | 17 ++++-------------
2 files changed, 35 insertions(+), 19 deletions(-)
diffs (112 lines):
diff -r 08a516401f5f -r b71ad9b389d3 sys/arch/sun3/dev/sebuf.c
--- a/sys/arch/sun3/dev/sebuf.c Fri Apr 09 04:01:09 1999 +0000
+++ b/sys/arch/sun3/dev/sebuf.c Fri Apr 09 04:26:27 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sebuf.c,v 1.4 1998/01/12 20:32:24 thorpej Exp $ */
+/* $NetBSD: sebuf.c,v 1.5 1999/04/09 04:26:27 gwr Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -69,6 +69,8 @@
#include "sereg.h"
#include "sevar.h"
+#define offsetof(type, member) ((size_t)(&((type *)0)->member))
+
struct sebuf_softc {
struct device sc_dev; /* base device (required) */
struct sebuf_regs *sc_regs;
@@ -93,6 +95,8 @@
void *args;
{
struct confargs *ca = args;
+ struct se_regs *sreg;
+ struct ie_regs *ereg;
int pa, x;
if (ca->ca_paddr == -1)
@@ -104,12 +108,33 @@
if (x == -1)
return (0);
- /* Does the "ie" CSR look right? */
- pa = ca->ca_paddr + 0x1FF00; /* XXX */
- /* Want to poke 0xFFFF here first. XXX */
- x = bus_peek(ca->ca_bustype, pa+2, 2);
- if ((x == -1) || (x & 0xFFF))
+ /* Look at the CSR for the SCSI part. */
+ pa = ca->ca_paddr + offsetof(struct sebuf_regs, se_scsi_regs);
+ sreg = bus_tmapin(ca->ca_bustype, pa);
+ /* Write some bits that are wired to zero. */
+ sreg->se_csr = 0xFFF3;
+ x = peek_word((caddr_t)(&sreg->se_csr));
+ bus_tmapout(sreg);
+ if ((x == -1) || (x & 0xFCF0)) {
+#ifdef DEBUG
+ printf("sebuf_match: SCSI csr=0x%x\n", x);
+#endif
return (0);
+ }
+
+ /* Look at the CSR for the Ethernet part. */
+ pa = ca->ca_paddr + offsetof(struct sebuf_regs, se_eth_regs);
+ ereg = bus_tmapin(ca->ca_bustype, pa);
+ /* Write some bits that are wired to zero. */
+ ereg->ie_csr = 0x0FFF;
+ x = peek_word((caddr_t)(&ereg->ie_csr));
+ bus_tmapout(ereg);
+ if ((x == -1) || (x & 0xFFF)) {
+#ifdef DEBUG
+ printf("sebuf_match: Ether csr=0x%x\n", x);
+#endif
+ return (0);
+ }
/* Default interrupt priority always splbio==2 */
if (ca->ca_intpri == -1)
diff -r 08a516401f5f -r b71ad9b389d3 sys/arch/sun3/dev/si_sebuf.c
--- a/sys/arch/sun3/dev/si_sebuf.c Fri Apr 09 04:01:09 1999 +0000
+++ b/sys/arch/sun3/dev/si_sebuf.c Fri Apr 09 04:26:27 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: si_sebuf.c,v 1.7 1998/11/19 21:49:46 thorpej Exp $ */
+/* $NetBSD: si_sebuf.c,v 1.8 1999/04/09 04:26:27 gwr Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -561,15 +561,10 @@
static void
se_minphys(struct buf *bp)
{
- if (bp->b_bcount > MAX_DMA_LEN) {
-#ifdef DEBUG
- if (se_debug) {
- printf("se_minphys len = 0x%x.\n", bp->b_bcount);
- Debugger();
- }
-#endif
+
+ if (bp->b_bcount > MAX_DMA_LEN)
bp->b_bcount = MAX_DMA_LEN;
- }
+
return (minphys(bp));
}
@@ -594,9 +589,6 @@
#ifdef DEBUG
if (!claimed) {
printf("se_intr: spurious from SBC\n");
- if (se_debug & 4) {
- Debugger(); /* XXX */
- }
}
#endif
/* Yes, we DID cause this interrupt. */
@@ -653,7 +645,6 @@
*/
if (xlen > MAX_DMA_LEN) {
printf("se_dma_alloc: excessive xlen=0x%x\n", xlen);
- Debugger();
ncr_sc->sc_datalen = xlen = MAX_DMA_LEN;
}
Home |
Main Index |
Thread Index |
Old Index