Module Name:    src
Committed By:   simonb
Date:           Wed Aug 12 12:56:30 UTC 2009

Modified Files:
        src/sys/arch/mips/conf: files.sibyte
        src/sys/arch/mips/sibyte/dev: sbmac.c sbobio.c sbobiovar.h sbscd.c
            sbscdvar.h sbscn.c sbtimer.c sbwdog.c
        src/sys/arch/mips/sibyte/include: sb1250_regs.h
        src/sys/arch/sbmips/conf: GENERIC

Log Message:
Remove many magic numbers for addresses and interrupt numbers, and use
constants defined in SiByte/Broadcom standard header files.  Switch from
using offsets for locators to actual addresses.

Tested on a swarm (my rhone is dead, but should be OK there too).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/conf/files.sibyte
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/mips/sibyte/dev/sbmac.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/sibyte/dev/sbobio.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/sibyte/dev/sbobiovar.h \
    src/sys/arch/mips/sibyte/dev/sbscdvar.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/mips/sibyte/dev/sbscd.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/mips/sibyte/dev/sbscn.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/sibyte/dev/sbtimer.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/sibyte/dev/sbwdog.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/sibyte/include/sb1250_regs.h
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/sbmips/conf/GENERIC

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/conf/files.sibyte
diff -u src/sys/arch/mips/conf/files.sibyte:1.5 src/sys/arch/mips/conf/files.sibyte:1.6
--- src/sys/arch/mips/conf/files.sibyte:1.5	Sat Oct 25 15:05:00 2003
+++ src/sys/arch/mips/conf/files.sibyte	Wed Aug 12 12:56:29 2009
@@ -3,12 +3,12 @@
 ###
 
 # System Control/Debug
-device	sbscd {[offset = -1], [intr[2] = {-1,-1}]}
+device	sbscd {[addr = -1], [intr[2] = {-1,-1}]}
 attach	sbscd at zbbus
 file	arch/mips/sibyte/dev/sbscd.c		sbscd
 
 # On-board I/O (slow I/O bridge)
-device	sbobio {[offset = -1], [intr[2] = {-1,-1}]}
+device	sbobio {[addr = -1], [intr[2] = {-1,-1}]}
 attach	sbobio at zbbus
 file	arch/mips/sibyte/dev/sbobio.c		sbobio
 

Index: src/sys/arch/mips/sibyte/dev/sbmac.c
diff -u src/sys/arch/mips/sibyte/dev/sbmac.c:1.32 src/sys/arch/mips/sibyte/dev/sbmac.c:1.33
--- src/sys/arch/mips/sibyte/dev/sbmac.c:1.32	Wed Mar 18 17:06:45 2009
+++ src/sys/arch/mips/sibyte/dev/sbmac.c	Wed Aug 12 12:56:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sbmac.c,v 1.32 2009/03/18 17:06:45 cegger Exp $ */
+/* $NetBSD: sbmac.c,v 1.33 2009/08/12 12:56:29 simonb Exp $ */
 
 /*
  * Copyright 2000, 2001, 2004
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.32 2009/03/18 17:06:45 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.33 2009/08/12 12:56:29 simonb Exp $");
 
 #include "bpfilter.h"
 #include "opt_inet.h"
@@ -2284,7 +2284,7 @@
 
 	/* Determine controller base address */
 
-	sc->sbm_base = (sbmac_port_t) sap->sa_base + sap->sa_locs.sa_offset;
+	sc->sbm_base = sap->sa_locs.sa_addr;
 
 	eaddr = sc->sbm_hwaddr;
 

Index: src/sys/arch/mips/sibyte/dev/sbobio.c
diff -u src/sys/arch/mips/sibyte/dev/sbobio.c:1.16 src/sys/arch/mips/sibyte/dev/sbobio.c:1.17
--- src/sys/arch/mips/sibyte/dev/sbobio.c:1.16	Fri Nov 11 06:27:09 2005
+++ src/sys/arch/mips/sibyte/dev/sbobio.c	Wed Aug 12 12:56:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sbobio.c,v 1.16 2005/11/11 06:27:09 simonb Exp $ */
+/* $NetBSD: sbobio.c,v 1.17 2009/08/12 12:56:29 simonb Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,13 +33,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbobio.c,v 1.16 2005/11/11 06:27:09 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbobio.c,v 1.17 2009/08/12 12:56:29 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/systm.h>
 
 #include <machine/locore.h>
+#include <mips/sibyte/include/sb1250_int.h>
 #include <mips/sibyte/include/sb1250_regs.h>
 #include <mips/sibyte/include/sb1250_scd.h>
 #include <mips/sibyte/include/zbbusvar.h>
@@ -56,49 +57,115 @@
 static int	sbobio_print(void *, const char *);
 static const char *sbobio_device_type_name(enum sbobio_device_type type);
 
+/*
+ * XXXsimonb:
+ *	DUART register addresses seem to offset by 0x100 for some
+ *	reason I can't fathom so we just can't use A_DUART for the
+ *	address of the DUART.  Eg,
+ *		A_DUART_CHANREG(0, 0) = 0x0010060000
+ *	   and	R_DUART_MODE_REG_1 = 0x100 (first reg in the duart)
+ *	but the 1125/1250 manual says the DUART starts at
+ *	0x0010060100.
+ *	We define our own R_DUART_REGBASE to R_DUART_MODE_REG_1
+ *	so that we can use a symbolic name to refer to the start
+ *	of the duart register space.
+ */
+
 static const struct sbobio_attach_locs sb1250_rev1_sbobio_devs[] = {
-	{ 0x0000, {6,-1},	SBOBIO_DEVTYPE_SMBUS		},
-	{ 0x0008, {7,-1},	SBOBIO_DEVTYPE_SMBUS		},
-	{ 0x0100, {8,9},	SBOBIO_DEVTYPE_DUART		},
-	{ 0x0400, {10,-1},	SBOBIO_DEVTYPE_SYNCSERIAL	},
-	{ 0x0800, {11,-1},	SBOBIO_DEVTYPE_SYNCSERIAL	},
+	{ A_SMB_0,
+	  { K_INT_SMB_0, -1 },
+	  SBOBIO_DEVTYPE_SMBUS },
+	{ A_SMB_1,
+	  { K_INT_SMB_1, -1 },
+	  SBOBIO_DEVTYPE_SMBUS },
+	{ A_DUART_CHANREG(0, R_DUART_REGBASE),
+	  { K_INT_UART_0, K_INT_UART_1 },
+	  SBOBIO_DEVTYPE_DUART },
+	{ A_SER_BASE_0,
+	  { K_INT_SER_0, -1 },
+	  SBOBIO_DEVTYPE_SYNCSERIAL },
+	{ A_SER_BASE_1,
+	  { K_INT_SER_1, -1 },
+	  SBOBIO_DEVTYPE_SYNCSERIAL },
 #if 0
-	{ 0x1000, {-1,-1},	SBOBIO_DEVTYPE_GBUS,		}, /* XXXCGD ??? */
+	{ A_IO_EXT_BASE,
+	  { -1, -1 },
+	  SBOBIO_DEVTYPE_GBUS },
 #endif
-	{ 0x4000, {19,-1},	SBOBIO_DEVTYPE_MAC,		},
-	{ 0x5000, {20,-1},	SBOBIO_DEVTYPE_MAC,		},
-	{ 0x6000, {21,-1},	SBOBIO_DEVTYPE_MAC,		},
+	{ A_MAC_BASE_0,
+	  { K_INT_MAC_0, -1 },
+	  SBOBIO_DEVTYPE_MAC },
+	{ A_MAC_BASE_1,
+	  { K_INT_MAC_1, -1 },
+	  SBOBIO_DEVTYPE_MAC },
+	{ A_MAC_BASE_2,
+	  { K_INT_MAC_2, -1 },
+	  SBOBIO_DEVTYPE_MAC },
 };
 static const int sb1250_rev1_sbobio_dev_count =
     sizeof sb1250_rev1_sbobio_devs / sizeof sb1250_rev1_sbobio_devs[0];
 
 static const struct sbobio_attach_locs sb1250_sbobio_devs[] = {
-	{ 0x0000, {6,-1},	SBOBIO_DEVTYPE_SMBUS		},
-	{ 0x0008, {7,-1},	SBOBIO_DEVTYPE_SMBUS		},
-	{ 0x0100, {8,9},	SBOBIO_DEVTYPE_DUART		},
-	{ 0x0400, {10,-1},	SBOBIO_DEVTYPE_SYNCSERIAL	},
-	{ 0x0800, {11,-1},	SBOBIO_DEVTYPE_SYNCSERIAL	},
+	{ A_SMB_0,
+	  { K_INT_SMB_0, -1 },
+	  SBOBIO_DEVTYPE_SMBUS },
+	{ A_SMB_1,
+	  { K_INT_SMB_1, -1 },
+	  SBOBIO_DEVTYPE_SMBUS },
+	{ A_DUART_CHANREG(0, R_DUART_REGBASE),
+	  { K_INT_UART_0, K_INT_UART_1},
+	  SBOBIO_DEVTYPE_DUART },
+	{ A_SER_BASE_0,
+	  { K_INT_SER_0, -1 },
+	  SBOBIO_DEVTYPE_SYNCSERIAL },
+	{ A_SER_BASE_1,
+	  { K_INT_SER_1, -1 },
+	  SBOBIO_DEVTYPE_SYNCSERIAL },
 #if 0
-	{ 0x1000, {-1,-1},	SBOBIO_DEVTYPE_GBUS,		}, /* XXXCGD ??? */
+	{ A_IO_EXT_BASE,
+	  { -1, -1 },
+	  SBOBIO_DEVTYPE_GBUS },
 #endif
-	{ 0x4000, {19,61},	SBOBIO_DEVTYPE_MAC,		},
-	{ 0x5000, {20,62},	SBOBIO_DEVTYPE_MAC,		},
-	{ 0x6000, {21,63},	SBOBIO_DEVTYPE_MAC,		},
+	{ A_MAC_BASE_0,
+	  { K_INT_MAC_0, K_INT_MAC_0_CH1 },
+	  SBOBIO_DEVTYPE_MAC },
+	{ A_MAC_BASE_1,
+	  { K_INT_MAC_1, K_INT_MAC_1_CH1 },
+	  SBOBIO_DEVTYPE_MAC },
+	{ A_MAC_BASE_2,
+	  { K_INT_MAC_2, K_INT_MAC_2_CH1 },
+	  SBOBIO_DEVTYPE_MAC },
 };
 static const int sb1250_sbobio_dev_count =
     sizeof sb1250_sbobio_devs / sizeof sb1250_sbobio_devs[0];
 
 static const struct sbobio_attach_locs sb112x_sbobio_devs[] = {
-	{ 0x0000, {6,-1},	SBOBIO_DEVTYPE_SMBUS		},
-	{ 0x0008, {7,-1},	SBOBIO_DEVTYPE_SMBUS		},
-	{ 0x0100, {8,9},	SBOBIO_DEVTYPE_DUART		},
-	{ 0x0400, {10,-1},	SBOBIO_DEVTYPE_SYNCSERIAL	},
-	{ 0x0800, {11,-1},	SBOBIO_DEVTYPE_SYNCSERIAL	},
+	{ A_SMB_0,
+	  { K_INT_SMB_0, -1 },
+	  SBOBIO_DEVTYPE_SMBUS },
+	{ A_SMB_1,
+	  { K_INT_SMB_1, -1 },
+	  SBOBIO_DEVTYPE_SMBUS },
+	{ A_DUART_CHANREG(0, R_DUART_REGBASE),
+	  { K_INT_UART_0, K_INT_UART_1 },
+	  SBOBIO_DEVTYPE_DUART },
+	{ A_SER_BASE_0,
+	  { K_INT_SER_0, -1 },
+	  SBOBIO_DEVTYPE_SYNCSERIAL },
+	{ A_SER_BASE_1,
+	  { K_INT_SER_1, -1 },
+	  SBOBIO_DEVTYPE_SYNCSERIAL },
 #if 0
-	{ 0x1000, {-1,-1},	SBOBIO_DEVTYPE_GBUS,		}, /* XXXCGD ??? */
+	{ A_IO_EXT_BASE,
+	  { -1, -1 },
+	  SBOBIO_DEVTYPE_GBUS },
 #endif
-	{ 0x4000, {19,61},	SBOBIO_DEVTYPE_MAC,		},
-	{ 0x5000, {20,62},	SBOBIO_DEVTYPE_MAC,		},
+	{ A_MAC_BASE_0,
+	  { K_INT_MAC_0, K_INT_MAC_0_CH1 },
+	  SBOBIO_DEVTYPE_MAC },
+	{ A_MAC_BASE_1,
+	  { K_INT_MAC_1, K_INT_MAC_1_CH1 },
+	  SBOBIO_DEVTYPE_MAC },
 };
 static const int sb112x_sbobio_dev_count =
     sizeof sb112x_sbobio_devs / sizeof sb112x_sbobio_devs[0];
@@ -167,10 +234,9 @@
 
 	for (i = 0; i < devcount; i++) {
 		memset(&sa, 0, sizeof sa);
-		sa.sa_base = A_PHYS_IO_SYSTEM;
 		sa.sa_locs = devs[i];
 
-		locs[SBOBIOCF_OFFSET] = devs[i].sa_offset;
+		locs[SBOBIOCF_ADDR] = devs[i].sa_addr;
 		locs[SBOBIOCF_INTR + 0] = devs[i].sa_intr[0];
 		locs[SBOBIOCF_INTR + 1] = devs[i].sa_intr[1];
 
@@ -189,11 +255,11 @@
 	if (pnp)
 		aprint_normal("%s at %s",
 		    sbobio_device_type_name(sap->sa_locs.sa_type), pnp);
-	aprint_normal(" offset 0x%lx", (long)sap->sa_locs.sa_offset);
+	aprint_normal(" addr 0x%x", sap->sa_locs.sa_addr);
 	for (i = 0; i < 2; i++) {
 		if (sap->sa_locs.sa_intr[i] != SBOBIOCF_INTR_DEFAULT)
-			aprint_normal("%s%ld", i == 0 ? " intr " : ",",
-			    (long)sap->sa_locs.sa_intr[i]);
+			aprint_normal("%s%d", i == 0 ? " intr " : ",",
+			    sap->sa_locs.sa_intr[i]);
 	}
 	return (UNCONF);
 }

Index: src/sys/arch/mips/sibyte/dev/sbobiovar.h
diff -u src/sys/arch/mips/sibyte/dev/sbobiovar.h:1.2 src/sys/arch/mips/sibyte/dev/sbobiovar.h:1.3
--- src/sys/arch/mips/sibyte/dev/sbobiovar.h:1.2	Fri Feb  7 17:38:49 2003
+++ src/sys/arch/mips/sibyte/dev/sbobiovar.h	Wed Aug 12 12:56:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sbobiovar.h,v 1.2 2003/02/07 17:38:49 cgd Exp $ */
+/* $NetBSD: sbobiovar.h,v 1.3 2009/08/12 12:56:29 simonb Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -46,13 +46,12 @@
 
 /* autoconfiguration match information for zbbus children */
 struct sbobio_attach_locs {
-	sbobio_offset		sa_offset;
+	sbobio_offset		sa_addr;
 	u_int			sa_intr[2];
 	enum sbobio_device_type	sa_type;
 };
 
+/* XXX can probably just get away without separate sbobio_attach_locs ? */
 struct sbobio_attach_args {
 	struct sbobio_attach_locs sa_locs;
-
-	long			sa_base;
 };
Index: src/sys/arch/mips/sibyte/dev/sbscdvar.h
diff -u src/sys/arch/mips/sibyte/dev/sbscdvar.h:1.2 src/sys/arch/mips/sibyte/dev/sbscdvar.h:1.3
--- src/sys/arch/mips/sibyte/dev/sbscdvar.h:1.2	Fri Feb  7 17:38:49 2003
+++ src/sys/arch/mips/sibyte/dev/sbscdvar.h	Wed Aug 12 12:56:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sbscdvar.h,v 1.2 2003/02/07 17:38:49 cgd Exp $ */
+/* $NetBSD: sbscdvar.h,v 1.3 2009/08/12 12:56:29 simonb Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -45,13 +45,12 @@
 
 /* autoconfiguration match information for zbbus children */
 struct sbscd_attach_locs {
-	sbscd_offset		sa_offset;
+	sbscd_offset		sa_addr;
 	u_int			sa_intr[2];
 	enum sbscd_device_type	sa_type;
 };
 
+/* XXX can probably just get away without separate sbscd_attach_locs ? */
 struct sbscd_attach_args {
 	struct sbscd_attach_locs sa_locs;
-
-	long			sa_base;
 };

Index: src/sys/arch/mips/sibyte/dev/sbscd.c
diff -u src/sys/arch/mips/sibyte/dev/sbscd.c:1.14 src/sys/arch/mips/sibyte/dev/sbscd.c:1.15
--- src/sys/arch/mips/sibyte/dev/sbscd.c:1.14	Mon Jun 16 08:36:51 2008
+++ src/sys/arch/mips/sibyte/dev/sbscd.c	Wed Aug 12 12:56:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sbscd.c,v 1.14 2008/06/16 08:36:51 cegger Exp $ */
+/* $NetBSD: sbscd.c,v 1.15 2009/08/12 12:56:29 simonb Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,12 +33,15 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbscd.c,v 1.14 2008/06/16 08:36:51 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbscd.c,v 1.15 2009/08/12 12:56:29 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/systm.h>
 
+#include <mips/sibyte/include/sb1250_int.h>
+#include <mips/sibyte/include/sb1250_regs.h>
+#include <mips/sibyte/include/sb1250_scd.h>
 #include <mips/sibyte/include/zbbusvar.h>
 #include <mips/sibyte/dev/sbscdvar.h>
 
@@ -55,15 +58,31 @@
 
 static const struct sbscd_attach_locs sb1250_sbscd_devs[] = {
 #if 0
-	{ 0x20000, {-1,-1},	SBSCD_DEVTYPE_ICU,		},
+	{ A_IMR_CPU0_BASE,
+	  { -1, -1 },
+	  SBSCD_DEVTYPE_ICU },
 #endif
-	{ 0x20050, {0,-1},	SBSCD_DEVTYPE_WDOG,		},
-	{ 0x20150, {1,-1},	SBSCD_DEVTYPE_WDOG,		},
-	{ 0x20070, {2,-1},	SBSCD_DEVTYPE_TIMER,		},
-	{ 0x20078, {3,-1},	SBSCD_DEVTYPE_TIMER,		},
-	{ 0x20170, {4,-1},	SBSCD_DEVTYPE_TIMER,		},
-	{ 0x20178, {5,-1},	SBSCD_DEVTYPE_TIMER,		},
-	{ 0x1FFA0, {-1,-1},	SBSCD_DEVTYPE_JTAGCONS,		},
+	{ A_SCD_WDOG_0,
+	  { K_INT_WATCHDOG_TIMER_0, -1 },
+	  SBSCD_DEVTYPE_WDOG },
+	{ A_SCD_WDOG_1,
+	  { K_INT_WATCHDOG_TIMER_1, -1 },
+	  SBSCD_DEVTYPE_WDOG },
+	{ A_SCD_TIMER_0,
+	  { K_INT_TIMER_0, -1 },
+	  SBSCD_DEVTYPE_TIMER },
+	{ A_SCD_TIMER_1,
+	  { K_INT_TIMER_1, -1 },
+	  SBSCD_DEVTYPE_TIMER },
+	{ A_SCD_TIMER_2,
+	  { K_INT_TIMER_2, -1 },
+	  SBSCD_DEVTYPE_TIMER },
+	{ A_SCD_TIMER_3,
+	  { K_INT_TIMER_3, -1 },
+	  SBSCD_DEVTYPE_TIMER },
+	{ A_SCD_JTAG_BASE + 0x1FFA0, 	/* XXX magic number for jtag addr */
+	  { -1, -1 },
+	  SBSCD_DEVTYPE_JTAGCONS },
 	/* XXX others */
 };
 static const int sb1250_sbscd_dev_count = __arraycount(sb1250_sbscd_devs);
@@ -90,10 +109,9 @@
 
 	for (i = 0; i < sb1250_sbscd_dev_count; i++) {
 		memset(&sa, 0, sizeof sa);
-		sa.sa_base = 0x10000000;			/* XXXCGD */
 		sa.sa_locs = sb1250_sbscd_devs[i];
 
-		locs[SBSCDCF_OFFSET] = sb1250_sbscd_devs[i].sa_offset;
+		locs[SBSCDCF_ADDR] = sb1250_sbscd_devs[i].sa_addr;
 		locs[SBSCDCF_INTR + 0] =
 			sb1250_sbscd_devs[i].sa_intr[0];
 		locs[SBSCDCF_INTR + 1] =
@@ -114,11 +132,11 @@
 	if (pnp)
 		aprint_normal("%s at %s",
 		    sbscd_device_type_name(sap->sa_locs.sa_type), pnp);
-	aprint_normal(" offset 0x%lx", (long)sap->sa_locs.sa_offset);
+	aprint_normal(" addr 0x%x", sap->sa_locs.sa_addr);
 	for (i = 0; i < 2; i++) {
 		if (sap->sa_locs.sa_intr[i] != -1)
-			aprint_normal("%s%ld", i == 0 ? " intr " : ",",
-			    (long)sap->sa_locs.sa_intr[i]);
+			aprint_normal("%s%d", i == 0 ? " intr " : ",",
+			    sap->sa_locs.sa_intr[i]);
 	}
 	return (UNCONF);
 }

Index: src/sys/arch/mips/sibyte/dev/sbscn.c
diff -u src/sys/arch/mips/sibyte/dev/sbscn.c:1.28 src/sys/arch/mips/sibyte/dev/sbscn.c:1.29
--- src/sys/arch/mips/sibyte/dev/sbscn.c:1.28	Sat Mar 14 15:36:10 2009
+++ src/sys/arch/mips/sibyte/dev/sbscn.c	Wed Aug 12 12:56:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sbscn.c,v 1.28 2009/03/14 15:36:10 dsl Exp $ */
+/* $NetBSD: sbscn.c,v 1.29 2009/08/12 12:56:29 simonb Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -109,7 +109,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.28 2009/03/14 15:36:10 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.29 2009/08/12 12:56:29 simonb Exp $");
 
 #define	SBSCN_DEBUG
 
@@ -276,7 +276,7 @@
 	struct sbobio_attach_args *sap = aux;
 	int i;
 
-	sc->sc_addr = sap->sa_base + sap->sa_locs.sa_offset;
+	sc->sc_addr = sap->sa_locs.sa_addr;
 
 	printf("\n");
 	for (i = 0; i < 2; i++)

Index: src/sys/arch/mips/sibyte/dev/sbtimer.c
diff -u src/sys/arch/mips/sibyte/dev/sbtimer.c:1.13 src/sys/arch/mips/sibyte/dev/sbtimer.c:1.14
--- src/sys/arch/mips/sibyte/dev/sbtimer.c:1.13	Tue Jan  8 14:38:47 2008
+++ src/sys/arch/mips/sibyte/dev/sbtimer.c	Wed Aug 12 12:56:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sbtimer.c,v 1.13 2008/01/08 14:38:47 simonb Exp $ */
+/* $NetBSD: sbtimer.c,v 1.14 2009/08/12 12:56:29 simonb Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbtimer.c,v 1.13 2008/01/08 14:38:47 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbtimer.c,v 1.14 2009/08/12 12:56:29 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -92,12 +92,12 @@
 	const char *comment = "";
 
 	sc->sc_flags = device_cfdata(&sc->sc_dev)->cf_flags;
-	sc->sc_addr_icnt = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base +
-	    sa->sa_locs.sa_offset + R_SCD_TIMER_INIT);
-	sc->sc_addr_cnt = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base +
-	    sa->sa_locs.sa_offset + R_SCD_TIMER_CNT);
-	sc->sc_addr_cfg = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_base +
-	    sa->sa_locs.sa_offset + R_SCD_TIMER_CFG);
+	sc->sc_addr_icnt = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_locs.sa_addr +
+	    R_SCD_TIMER_INIT);
+	sc->sc_addr_cnt = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_locs.sa_addr +
+	    R_SCD_TIMER_CNT);
+	sc->sc_addr_cfg = (uint64_t *)MIPS_PHYS_TO_KSEG1(sa->sa_locs.sa_addr +
+	    R_SCD_TIMER_CFG);
 
 	printf(": ");
 	if ((sc->sc_flags & SBTIMER_CLOCK) != 0) {

Index: src/sys/arch/mips/sibyte/dev/sbwdog.c
diff -u src/sys/arch/mips/sibyte/dev/sbwdog.c:1.7 src/sys/arch/mips/sibyte/dev/sbwdog.c:1.8
--- src/sys/arch/mips/sibyte/dev/sbwdog.c:1.7	Thu Jan 12 04:40:50 2006
+++ src/sys/arch/mips/sibyte/dev/sbwdog.c	Wed Aug 12 12:56:29 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: sbwdog.c,v 1.7 2006/01/12 04:40:50 simonb Exp $ */
+/* $NetBSD: sbwdog.c,v 1.8 2009/08/12 12:56:29 simonb Exp $ */
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbwdog.c,v 1.7 2006/01/12 04:40:50 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbwdog.c,v 1.8 2009/08/12 12:56:29 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -94,7 +94,7 @@
 	struct sbscd_attach_args *sa = aux;
 
 	sc->sc_wdog_period = SBWDOG_DEFAULT_PERIOD;
-	sc->sc_addr = MIPS_PHYS_TO_KSEG1(sa->sa_base + sa->sa_locs.sa_offset);
+	sc->sc_addr = MIPS_PHYS_TO_KSEG1(sa->sa_locs.sa_addr);
 
 	printf(": %d second period\n", sc->sc_wdog_period);
 

Index: src/sys/arch/mips/sibyte/include/sb1250_regs.h
diff -u src/sys/arch/mips/sibyte/include/sb1250_regs.h:1.8 src/sys/arch/mips/sibyte/include/sb1250_regs.h:1.9
--- src/sys/arch/mips/sibyte/include/sb1250_regs.h:1.8	Tue Aug 11 12:34:06 2009
+++ src/sys/arch/mips/sibyte/include/sb1250_regs.h	Wed Aug 12 12:56:30 2009
@@ -305,6 +305,7 @@
 #define R_DUART_CMD                 0x150
 #define R_DUART_RX_HOLD             0x160
 #define R_DUART_TX_HOLD             0x170
+#define R_DUART_REGBASE	            R_DUART_MODE_REG_1	/* Added for NetBSD */
 
 #if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
 #define R_DUART_FULL_CTL	    0x140

Index: src/sys/arch/sbmips/conf/GENERIC
diff -u src/sys/arch/sbmips/conf/GENERIC:1.74 src/sys/arch/sbmips/conf/GENERIC:1.75
--- src/sys/arch/sbmips/conf/GENERIC:1.74	Fri Mar  6 20:31:51 2009
+++ src/sys/arch/sbmips/conf/GENERIC	Wed Aug 12 12:56:30 2009
@@ -1,10 +1,10 @@
-# $NetBSD: GENERIC,v 1.74 2009/03/06 20:31:51 joerg Exp $
+# $NetBSD: GENERIC,v 1.75 2009/08/12 12:56:30 simonb Exp $
 
 include 	"arch/sbmips/conf/std.sbmips"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.74 $"
+#ident 		"GENERIC-$Revision: 1.75 $"
 
 #options 	LOCKDEBUG	# XXX XXX XXX XXX
 #options 	DEBUG		# extra kernel debugging support
@@ -138,16 +138,16 @@
 sbscd*		at zbbus? busid ?
 sbobio*		at zbbus? busid ?
 
-#sbicu*		at sbscd? offset ?
-sbwdog*		at sbscd? offset ? intr ?
-sbtimer0	at sbscd? offset ? intr ? flags 0x01		# clock
-#sbtimer1	at sbscd? offset ? intr ? flags 0x02		# statclock
-sbtimer*	at sbscd? offset ? intr ?
-
-sbmac*		at sbobio? offset ?
-sbscn*		at sbobio? offset ?
-#sbgbus*	at sbobio? offset ?
-smbus*		at sbobio? offset ?
+#sbicu*		at sbscd? addr ?
+sbwdog*		at sbscd? addr ? intr ?
+sbtimer0	at sbscd? addr ? intr ? flags 0x01		# clock
+#sbtimer1	at sbscd? addr ? intr ? flags 0x02		# statclock
+sbtimer*	at sbscd? addr ? intr ?
+
+sbmac*		at sbobio? addr ?
+sbscn*		at sbobio? addr ?
+#sbgbus*	at sbobio? addr ?
+smbus*		at sbobio? addr ?
 
 xirtc*		at smbus? chan ? dev ?		# Xicor X1241 RTC
 m41t81rtc*	at smbus? chan ? dev ?		# ST M41T81 RTC

Reply via email to