Module Name:    src
Committed By:   martin
Date:           Tue Oct  6 16:40:37 UTC 2015

Modified Files:
        src/sys/arch/sparc64/conf: files.sparc64
        src/sys/arch/sparc64/dev: auxio.c auxiovar.h
Added Files:
        src/sys/arch/sparc64/dev: auxio_ebus.c auxio_sbus.c

Log Message:
Split auxio at ebus and auxio at sbus properly, so we can build kernels
without sbus support.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/sparc64/conf/files.sparc64
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc64/dev/auxio.c
cvs rdiff -u -r0 -r1.6 src/sys/arch/sparc64/dev/auxio_ebus.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc64/dev/auxio_sbus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc64/dev/auxiovar.h

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/sparc64/conf/files.sparc64
diff -u src/sys/arch/sparc64/conf/files.sparc64:1.148 src/sys/arch/sparc64/conf/files.sparc64:1.149
--- src/sys/arch/sparc64/conf/files.sparc64:1.148	Sun Feb 15 01:43:11 2015
+++ src/sys/arch/sparc64/conf/files.sparc64	Tue Oct  6 16:40:36 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sparc64,v 1.148 2015/02/15 01:43:11 nakayama Exp $
+#	$NetBSD: files.sparc64,v 1.149 2015/10/06 16:40:36 martin Exp $
 
 # @(#)files.sparc64	8.1 (Berkeley) 7/19/93
 # sparc64-specific configuration info
@@ -114,6 +114,8 @@ device	auxio
 attach	auxio at ebus with auxio_ebus
 attach	auxio at sbus with auxio_sbus
 file	arch/sparc64/dev/auxio.c		auxio
+file	arch/sparc64/dev/auxio_sbus.c		auxio_sbus
+file	arch/sparc64/dev/auxio_ebus.c		auxio_ebus
 
 defflag	opt_auxio.h	BLINK
 

Index: src/sys/arch/sparc64/dev/auxio.c
diff -u src/sys/arch/sparc64/dev/auxio.c:1.24 src/sys/arch/sparc64/dev/auxio.c:1.25
--- src/sys/arch/sparc64/dev/auxio.c:1.24	Mon Aug 24 23:32:07 2015
+++ src/sys/arch/sparc64/dev/auxio.c	Tue Oct  6 16:40:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: auxio.c,v 1.24 2015/08/24 23:32:07 mrg Exp $	*/
+/*	$NetBSD: auxio.c,v 1.25 2015/10/06 16:40:36 martin Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001, 2015 Matthew R. Green
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auxio.c,v 1.24 2015/08/24 23:32:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auxio.c,v 1.25 2015/10/06 16:40:36 martin Exp $");
 
 #include "opt_auxio.h"
 
@@ -53,48 +53,9 @@ __KERNEL_RCSID(0, "$NetBSD: auxio.c,v 1.
 #include <sparc64/dev/auxioreg.h>
 #include <sparc64/dev/auxiovar.h>
 
-/*
- * on sun4u, auxio exists with one register (LED) on the sbus, and 5
- * registers on the ebus2 (pci) (LED, PCIMODE, FREQUENCY, SCSI
- * OSCILLATOR, and TEMP SENSE.
- */
-
-struct auxio_softc {
-	device_t		sc_dev;
-
-	kmutex_t		sc_lock;
-
-	/* parent's tag */
-	bus_space_tag_t		sc_tag;
-
-	/* handles to the various auxio register sets */
-	bus_space_handle_t	sc_led;
-	bus_space_handle_t	sc_pci;
-	bus_space_handle_t	sc_freq;
-	bus_space_handle_t	sc_scsi;
-	bus_space_handle_t	sc_temp;
-
-	int			sc_flags;
-#define	AUXIO_LEDONLY		0x1	// only sc_led is valid
-#define	AUXIO_EBUS		0x2
-};
-
-#define	AUXIO_ROM_NAME		"auxio"
-
-
 static uint32_t	auxio_read_led(struct auxio_softc *);
 static void	auxio_write_led(struct auxio_softc *, uint32_t);
-static void	auxio_attach_common(struct auxio_softc *);
-static int	auxio_ebus_match(device_t, cfdata_t, void *);
-static void	auxio_ebus_attach(device_t, device_t, void *);
-static int	auxio_sbus_match(device_t, cfdata_t, void *);
-static void	auxio_sbus_attach(device_t, device_t, void *);
-
-CFATTACH_DECL_NEW(auxio_ebus, sizeof(struct auxio_softc),
-    auxio_ebus_match, auxio_ebus_attach, NULL, NULL);
-
-CFATTACH_DECL_NEW(auxio_sbus, sizeof(struct auxio_softc),
-    auxio_sbus_match, auxio_sbus_attach, NULL, NULL);
+void	auxio_attach_common(struct auxio_softc *);
 
 extern struct cfdriver auxio_cd;
 
@@ -156,7 +117,7 @@ auxio_blink(void *x)
 }
 #endif
 
-static void
+void
 auxio_attach_common(struct auxio_softc *sc)
 {
 #ifdef BLINK
@@ -173,105 +134,6 @@ auxio_attach_common(struct auxio_softc *
 	printf("\n");
 }
 
-static int
-auxio_ebus_match(device_t parent, cfdata_t cf, void *aux)
-{
-	struct ebus_attach_args *ea = aux;
-
-	return (strcmp(AUXIO_ROM_NAME, ea->ea_name) == 0);
-}
-
-static void
-auxio_ebus_attach(device_t parent, device_t self, void *aux)
-{
-	struct auxio_softc *sc = device_private(self);
-	struct ebus_attach_args *ea = aux;
-
-	sc->sc_dev = self;
-	sc->sc_tag = ea->ea_bustag;
-
-	if (ea->ea_nreg < 1) {
-		printf(": no registers??\n");
-		return;
-	}
-
-	sc->sc_flags = AUXIO_EBUS;
-	if (ea->ea_nreg != 5) {
-		printf(": not 5 (%d) registers, only setting led",
-		    ea->ea_nreg);
-		sc->sc_flags |= AUXIO_LEDONLY;
-	} else if (ea->ea_nvaddr == 5) {
-		sparc_promaddr_to_handle(sc->sc_tag, 
-			ea->ea_vaddr[1], &sc->sc_pci);
-		sparc_promaddr_to_handle(sc->sc_tag, 
-			ea->ea_vaddr[2], &sc->sc_freq);
-		sparc_promaddr_to_handle(sc->sc_tag, 
-			ea->ea_vaddr[3], &sc->sc_scsi);
-		sparc_promaddr_to_handle(sc->sc_tag, 
-			ea->ea_vaddr[4], &sc->sc_temp);
-	} else {
-		bus_space_map(sc->sc_tag, EBUS_ADDR_FROM_REG(&ea->ea_reg[1]),
-			ea->ea_reg[1].size, 0, &sc->sc_pci);
-		bus_space_map(sc->sc_tag, EBUS_ADDR_FROM_REG(&ea->ea_reg[2]),
-			ea->ea_reg[2].size, 0, &sc->sc_freq);
-		bus_space_map(sc->sc_tag, EBUS_ADDR_FROM_REG(&ea->ea_reg[3]),
-			ea->ea_reg[3].size, 0, &sc->sc_scsi);
-		bus_space_map(sc->sc_tag, EBUS_ADDR_FROM_REG(&ea->ea_reg[4]),
-			ea->ea_reg[4].size, 0, &sc->sc_temp);
-	}
-
-	if (ea->ea_nvaddr > 0) {
-		sparc_promaddr_to_handle(sc->sc_tag, 
-			ea->ea_vaddr[0], &sc->sc_led);
-	} else {
-		bus_space_map(sc->sc_tag, EBUS_ADDR_FROM_REG(&ea->ea_reg[0]),
-			ea->ea_reg[0].size, 0, &sc->sc_led);
-	}
-	
-	auxio_attach_common(sc);
-}
-
-static int
-auxio_sbus_match(device_t parent, cfdata_t cf, void *aux)
-{
-	struct sbus_attach_args *sa = aux;
-
-	return strcmp(AUXIO_ROM_NAME, sa->sa_name) == 0;
-}
-
-static void
-auxio_sbus_attach(device_t parent, device_t self, void *aux)
-{
-	struct auxio_softc *sc = device_private(self);
-	struct sbus_attach_args *sa = aux;
-
-	sc->sc_dev = self;
-	sc->sc_tag = sa->sa_bustag;
-
-	if (sa->sa_nreg < 1) {
-		printf(": no registers??\n");
-		return;
-	}
-
-	if (sa->sa_nreg != 1) {
-		printf(": not 1 (%d/%d) registers??", sa->sa_nreg,
-		    sa->sa_npromvaddrs);
-		return;
-	}
-
-	/* sbus auxio only has one set of registers */
-	sc->sc_flags = AUXIO_LEDONLY;
-	if (sa->sa_npromvaddrs > 0) {
-		sbus_promaddr_to_handle(sc->sc_tag,
-			sa->sa_promvaddr, &sc->sc_led);
-	} else {
-		sbus_bus_map(sc->sc_tag, sa->sa_slot, sa->sa_offset,
-			sa->sa_size, 0, &sc->sc_led);
-	}
-
-	auxio_attach_common(sc);
-}
-
 int
 auxio_fd_control(u_int32_t bits)
 {

Index: src/sys/arch/sparc64/dev/auxiovar.h
diff -u src/sys/arch/sparc64/dev/auxiovar.h:1.7 src/sys/arch/sparc64/dev/auxiovar.h:1.8
--- src/sys/arch/sparc64/dev/auxiovar.h:1.7	Thu May 29 14:51:26 2008
+++ src/sys/arch/sparc64/dev/auxiovar.h	Tue Oct  6 16:40:36 2015
@@ -1,5 +1,5 @@
 /*	$OpenBSD: auxiovar.h,v 1.7 2005/03/09 18:41:48 miod Exp $	*/
-/*	$NetBSD: auxiovar.h,v 1.7 2008/05/29 14:51:26 mrg Exp $	*/
+/*	$NetBSD: auxiovar.h,v 1.8 2015/10/06 16:40:36 martin Exp $	*/
 
 /*
  * Copyright (c) 2000 Matthew R. Green
@@ -28,5 +28,36 @@
  */
 
 #ifndef _LOCORE
+
+/*
+ * on sun4u, auxio exists with one register (LED) on the sbus, and 5
+ * registers on the ebus2 (pci) (LED, PCIMODE, FREQUENCY, SCSI
+ * OSCILLATOR, and TEMP SENSE.
+ */
+
+struct auxio_softc {
+	device_t		sc_dev;
+
+	kmutex_t		sc_lock;
+
+	/* parent's tag */
+	bus_space_tag_t		sc_tag;
+
+	/* handles to the various auxio register sets */
+	bus_space_handle_t	sc_led;
+	bus_space_handle_t	sc_pci;
+	bus_space_handle_t	sc_freq;
+	bus_space_handle_t	sc_scsi;
+	bus_space_handle_t	sc_temp;
+
+	int			sc_flags;
+#define	AUXIO_LEDONLY		0x1	// only sc_led is valid
+#define	AUXIO_EBUS		0x2
+};
+
+#define	AUXIO_ROM_NAME		"auxio"
+
+void auxio_attach_common(struct auxio_softc *);
 int auxio_fd_control(u_int32_t);
+
 #endif

Added files:

Index: src/sys/arch/sparc64/dev/auxio_ebus.c
diff -u /dev/null src/sys/arch/sparc64/dev/auxio_ebus.c:1.6
--- /dev/null	Tue Oct  6 16:40:37 2015
+++ src/sys/arch/sparc64/dev/auxio_ebus.c	Tue Oct  6 16:40:36 2015
@@ -0,0 +1,118 @@
+/*	$NetBSD: auxio_ebus.c,v 1.6 2015/10/06 16:40:36 martin Exp $	*/
+
+/*
+ * Copyright (c) 2000, 2001, 2015 Matthew R. Green
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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.
+ */
+
+/*
+ * AUXIO registers support on the sbus & ebus2, used for the floppy driver
+ * and to control the system LED, for the BLINK option.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: auxio_ebus.c,v 1.6 2015/10/06 16:40:36 martin Exp $");
+
+#include "opt_auxio.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/callout.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+
+#include <dev/ebus/ebusreg.h>
+#include <dev/ebus/ebusvar.h>
+#include <dev/sbus/sbusvar.h>
+#include <sparc64/dev/auxioreg.h>
+#include <sparc64/dev/auxiovar.h>
+
+static int	auxio_ebus_match(device_t, cfdata_t, void *);
+static void	auxio_ebus_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(auxio_ebus, sizeof(struct auxio_softc),
+    auxio_ebus_match, auxio_ebus_attach, NULL, NULL);
+
+static int
+auxio_ebus_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct ebus_attach_args *ea = aux;
+
+	return (strcmp(AUXIO_ROM_NAME, ea->ea_name) == 0);
+}
+
+static void
+auxio_ebus_attach(device_t parent, device_t self, void *aux)
+{
+	struct auxio_softc *sc = device_private(self);
+	struct ebus_attach_args *ea = aux;
+
+	sc->sc_dev = self;
+	sc->sc_tag = ea->ea_bustag;
+
+	if (ea->ea_nreg < 1) {
+		printf(": no registers??\n");
+		return;
+	}
+
+	sc->sc_flags = AUXIO_EBUS;
+	if (ea->ea_nreg != 5) {
+		printf(": not 5 (%d) registers, only setting led",
+		    ea->ea_nreg);
+		sc->sc_flags |= AUXIO_LEDONLY;
+	} else if (ea->ea_nvaddr == 5) {
+		sparc_promaddr_to_handle(sc->sc_tag, 
+			ea->ea_vaddr[1], &sc->sc_pci);
+		sparc_promaddr_to_handle(sc->sc_tag, 
+			ea->ea_vaddr[2], &sc->sc_freq);
+		sparc_promaddr_to_handle(sc->sc_tag, 
+			ea->ea_vaddr[3], &sc->sc_scsi);
+		sparc_promaddr_to_handle(sc->sc_tag, 
+			ea->ea_vaddr[4], &sc->sc_temp);
+	} else {
+		bus_space_map(sc->sc_tag, EBUS_ADDR_FROM_REG(&ea->ea_reg[1]),
+			ea->ea_reg[1].size, 0, &sc->sc_pci);
+		bus_space_map(sc->sc_tag, EBUS_ADDR_FROM_REG(&ea->ea_reg[2]),
+			ea->ea_reg[2].size, 0, &sc->sc_freq);
+		bus_space_map(sc->sc_tag, EBUS_ADDR_FROM_REG(&ea->ea_reg[3]),
+			ea->ea_reg[3].size, 0, &sc->sc_scsi);
+		bus_space_map(sc->sc_tag, EBUS_ADDR_FROM_REG(&ea->ea_reg[4]),
+			ea->ea_reg[4].size, 0, &sc->sc_temp);
+	}
+
+	if (ea->ea_nvaddr > 0) {
+		sparc_promaddr_to_handle(sc->sc_tag, 
+			ea->ea_vaddr[0], &sc->sc_led);
+	} else {
+		bus_space_map(sc->sc_tag, EBUS_ADDR_FROM_REG(&ea->ea_reg[0]),
+			ea->ea_reg[0].size, 0, &sc->sc_led);
+	}
+	
+	auxio_attach_common(sc);
+}

Index: src/sys/arch/sparc64/dev/auxio_sbus.c
diff -u /dev/null src/sys/arch/sparc64/dev/auxio_sbus.c:1.1
--- /dev/null	Tue Oct  6 16:40:37 2015
+++ src/sys/arch/sparc64/dev/auxio_sbus.c	Tue Oct  6 16:40:36 2015
@@ -0,0 +1,101 @@
+/*	$NetBSD: auxio_sbus.c,v 1.1 2015/10/06 16:40:36 martin Exp $	*/
+
+/*
+ * Copyright (c) 2000, 2001, 2015 Matthew R. Green
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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.
+ */
+
+/*
+ * AUXIO registers support on the sbus & ebus2, used for the floppy driver
+ * and to control the system LED, for the BLINK option.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: auxio_sbus.c,v 1.1 2015/10/06 16:40:36 martin Exp $");
+
+#include "opt_auxio.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/callout.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/autoconf.h>
+#include <machine/cpu.h>
+
+#include <dev/ebus/ebusreg.h>
+#include <dev/ebus/ebusvar.h>
+#include <dev/sbus/sbusvar.h>
+#include <sparc64/dev/auxioreg.h>
+#include <sparc64/dev/auxiovar.h>
+
+static int	auxio_sbus_match(device_t, cfdata_t, void *);
+static void	auxio_sbus_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(auxio_sbus, sizeof(struct auxio_softc),
+    auxio_sbus_match, auxio_sbus_attach, NULL, NULL);
+
+static int
+auxio_sbus_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct sbus_attach_args *sa = aux;
+
+	return strcmp(AUXIO_ROM_NAME, sa->sa_name) == 0;
+}
+
+static void
+auxio_sbus_attach(device_t parent, device_t self, void *aux)
+{
+	struct auxio_softc *sc = device_private(self);
+	struct sbus_attach_args *sa = aux;
+
+	sc->sc_dev = self;
+	sc->sc_tag = sa->sa_bustag;
+
+	if (sa->sa_nreg < 1) {
+		printf(": no registers??\n");
+		return;
+	}
+
+	if (sa->sa_nreg != 1) {
+		printf(": not 1 (%d/%d) registers??", sa->sa_nreg,
+		    sa->sa_npromvaddrs);
+		return;
+	}
+
+	/* sbus auxio only has one set of registers */
+	sc->sc_flags = AUXIO_LEDONLY;
+	if (sa->sa_npromvaddrs > 0) {
+		sbus_promaddr_to_handle(sc->sc_tag,
+			sa->sa_promvaddr, &sc->sc_led);
+	} else {
+		sbus_bus_map(sc->sc_tag, sa->sa_slot, sa->sa_offset,
+			sa->sa_size, 0, &sc->sc_led);
+	}
+
+	auxio_attach_common(sc);
+}

Reply via email to