Module Name: src Committed By: cliff Date: Tue Sep 15 02:32:02 UTC 2009
Modified Files: src/sys/arch/mips/conf [matt-nb5-mips64]: files.rmixl src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_obio.c rmixl_obiovar.h rmixlvar.h Added Files: src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_eb_space.c rmixl_el_space.c Removed Files: src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_obio_space.c Log Message: obio now provides both big endian and little endian bus spaces to allow child devices to use according to access method needs also preparing for dual bus_dma methods, one for addrs <4GB, the other for all memory, including addrs >= 4GB the bulk of XLS DMA work is still TBD To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/mips/conf/files.rmixl cvs rdiff -u -r0 -r1.1.2.1 src/sys/arch/mips/rmi/rmixl_eb_space.c \ src/sys/arch/mips/rmi/rmixl_el_space.c cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/mips/rmi/rmixl_obio.c \ src/sys/arch/mips/rmi/rmixl_obiovar.h src/sys/arch/mips/rmi/rmixlvar.h cvs rdiff -u -r1.1.2.2 -r0 src/sys/arch/mips/rmi/rmixl_obio_space.c 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.rmixl diff -u src/sys/arch/mips/conf/files.rmixl:1.1.2.1 src/sys/arch/mips/conf/files.rmixl:1.1.2.2 --- src/sys/arch/mips/conf/files.rmixl:1.1.2.1 Sun Sep 13 03:27:38 2009 +++ src/sys/arch/mips/conf/files.rmixl Tue Sep 15 02:32:01 2009 @@ -1,4 +1,4 @@ -# $NetBSD: files.rmixl,v 1.1.2.1 2009/09/13 03:27:38 cliff Exp $ +# $NetBSD: files.rmixl,v 1.1.2.2 2009/09/15 02:32:01 cliff Exp $ # # Configuration info for RMI XLP, XLR, XLS # @@ -10,7 +10,8 @@ device obio: obio, pcibus attach obio at mainbus file arch/mips/rmi/rmixl_obio.c obio needs-count -file arch/mips/rmi/rmixl_obio_space.c obio +file arch/mips/rmi/rmixl_el_space.c obio +file arch/mips/rmi/rmixl_eb_space.c obio # NS16550 compatible serial ports attach com at obio with rmixl_com Index: src/sys/arch/mips/rmi/rmixl_obio.c diff -u src/sys/arch/mips/rmi/rmixl_obio.c:1.1.2.2 src/sys/arch/mips/rmi/rmixl_obio.c:1.1.2.3 --- src/sys/arch/mips/rmi/rmixl_obio.c:1.1.2.2 Sun Sep 13 20:35:00 2009 +++ src/sys/arch/mips/rmi/rmixl_obio.c Tue Sep 15 02:32:02 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: rmixl_obio.c,v 1.1.2.2 2009/09/13 20:35:00 cliff Exp $ */ +/* $NetBSD: rmixl_obio.c,v 1.1.2.3 2009/09/15 02:32:02 cliff Exp $ */ /* * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rmixl_obio.c,v 1.1.2.2 2009/09/13 20:35:00 cliff Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rmixl_obio.c,v 1.1.2.3 2009/09/15 02:32:02 cliff Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -54,21 +54,19 @@ #include "locators.h" -int obio_match(struct device *, struct cfdata *, void *); -void obio_attach(struct device *, struct device *, void *); +static int obio_match(struct device *, struct cfdata *, void *); +static void obio_attach(struct device *, struct device *, void *); +static int obio_print(void *, const char *); +static int obio_search(struct device *, struct cfdata *, const int *, void *); +static void obio_bus_init(struct obio_softc *); -CFATTACH_DECL(obio, sizeof(struct device), +CFATTACH_DECL(obio, sizeof(struct obio_softc), obio_match, obio_attach, NULL, NULL); -int obio_print(void *, const char *); -int obio_search(struct device *, struct cfdata *, - const int *, void *); - -/* there can be only one */ -int obio_found; +int obio_found; int -obio_match(struct device *parent, struct cfdata *cf, void *aux) +obio_match(struct device * parent, struct cfdata *cf, void *aux) { if (obio_found) return 0; @@ -76,16 +74,17 @@ } void -obio_attach(struct device *parent, device_t self, void *aux) +obio_attach(struct device * parent, struct device * self, void *aux) { struct obio_softc *sc = device_private(self); bus_addr_t ba; obio_found = 1; - rmixl_obio_bus_init(); - ba = rmixl_obio_get_io_pbase(); - sc->sc_bst = rmixl_obio_get_bus_space_tag(); + ba = (bus_addr_t)rmixl_configuration.rc_io_pbase; + KASSERT(ba != 0); + + obio_bus_init(sc); aprint_normal(" addr %#lx size %#x\n", ba, RMIXL_IO_DEV_SIZE); aprint_naive("\n"); @@ -113,13 +112,14 @@ } int -obio_search(struct device *parent, struct cfdata *cf, +obio_search(struct device * parent, struct cfdata *cf, const int *ldesc, void *aux) { struct obio_softc *sc = device_private(parent); struct obio_attach_args obio; - obio.obio_bst = sc->sc_bst; + obio.obio_el_bst = sc->sc_el_bst; + obio.obio_eb_bst = sc->sc_eb_bst; obio.obio_addr = cf->cf_loc[OBIOCF_ADDR]; obio.obio_size = cf->cf_loc[OBIOCF_SIZE]; obio.obio_mult = cf->cf_loc[OBIOCF_MULT]; @@ -130,3 +130,39 @@ return 0; } + +static void +obio_bus_init(struct obio_softc *sc) +{ + static int done = 0; + + if (done) + return; + done = 1; + + /* little endian space */ + if (rmixl_configuration.rc_el_memt.bs_cookie == 0) + rmixl_el_bus_mem_init(&rmixl_configuration.rc_el_memt, + &rmixl_configuration); + + /* big endian space */ + if (rmixl_configuration.rc_eb_memt.bs_cookie == 0) + rmixl_eb_bus_mem_init(&rmixl_configuration.rc_eb_memt, + &rmixl_configuration); +#ifdef NOTYET + /* dma space for addr < 4GB */ + if (rmixl_configuration.rc_lt4G_dmat._cookie == 0) + rmixl_dma_init(&rmixl_configuration.rc_lt4G_dmat); + /* dma space for all memory, including >= 4GB */ + if (rmixl_configuration.rc_ge4G_dmat._cookie == 0) + rmixl_dma_init(&rmixl_configuration.rc_ge4G_dmat); +#endif + + sc->sc_base = (bus_addr_t)rmixl_configuration.rc_io_pbase; + sc->sc_size = (bus_size_t)RMIXL_IO_DEV_SIZE; + sc->sc_el_bst = (bus_space_tag_t)&rmixl_configuration.rc_el_memt; + sc->sc_eb_bst = (bus_space_tag_t)&rmixl_configuration.rc_eb_memt; + sc->sc_lt4G_dmat = &rmixl_configuration.rc_lt4G_dmat; + sc->sc_ge4G_dmat = &rmixl_configuration.rc_ge4G_dmat; +} + Index: src/sys/arch/mips/rmi/rmixl_obiovar.h diff -u src/sys/arch/mips/rmi/rmixl_obiovar.h:1.1.2.2 src/sys/arch/mips/rmi/rmixl_obiovar.h:1.1.2.3 --- src/sys/arch/mips/rmi/rmixl_obiovar.h:1.1.2.2 Sun Sep 13 07:00:30 2009 +++ src/sys/arch/mips/rmi/rmixl_obiovar.h Tue Sep 15 02:32:02 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: rmixl_obiovar.h,v 1.1.2.2 2009/09/13 07:00:30 cliff Exp $ */ +/* $NetBSD: rmixl_obiovar.h,v 1.1.2.3 2009/09/15 02:32:02 cliff Exp $ */ #ifndef _MIPS_RMIXL_OBIOVAR_H_ #define _MIPS_RMIXL_OBIOVAR_H_ @@ -7,7 +7,8 @@ #include <mips/pci_machdep.h> struct obio_attach_args { - bus_space_tag_t obio_bst; + bus_space_tag_t obio_el_bst; + bus_space_tag_t obio_eb_bst; bus_addr_t obio_addr; bus_size_t obio_size; int obio_intr; @@ -17,9 +18,10 @@ typedef struct obio_softc { struct device sc_dev; - bus_dma_tag_t sc_dmat; - bus_space_tag_t sc_bst; - bus_space_handle_t sc_bsh; + bus_space_tag_t sc_el_bst; + bus_space_tag_t sc_eb_bst; + bus_dma_tag_t sc_lt4G_dmat; + bus_dma_tag_t sc_ge4G_dmat; bus_addr_t sc_base; bus_size_t sc_size; Index: src/sys/arch/mips/rmi/rmixlvar.h diff -u src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.2 src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.3 --- src/sys/arch/mips/rmi/rmixlvar.h:1.1.2.2 Sun Sep 13 07:00:30 2009 +++ src/sys/arch/mips/rmi/rmixlvar.h Tue Sep 15 02:32:02 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: rmixlvar.h,v 1.1.2.2 2009/09/13 07:00:30 cliff Exp $ */ +/* $NetBSD: rmixlvar.h,v 1.1.2.3 2009/09/15 02:32:02 cliff Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -40,8 +40,10 @@ struct rmixl_config { uint64_t rc_io_pbase; - struct mips_bus_space rc_memt; - struct mips_bus_dma_tag rc_pci_dmat; + struct mips_bus_space rc_el_memt; /* little endian bus */ + struct mips_bus_space rc_eb_memt; /* big endian bus */ + struct mips_bus_dma_tag rc_lt4G_dmat; /* space < 4GB */ + struct mips_bus_dma_tag rc_ge4G_dmat; /* space < memsize */ struct mips_pci_chipset rc_pc; struct extent *rc_io_ex; struct extent *rc_mem_ex; @@ -50,10 +52,8 @@ extern struct rmixl_config rmixl_configuration; -extern void rmixl_bus_mem_init(bus_space_tag_t, void *); -extern void rmixl_obio_bus_init(void); -extern bus_space_tag_t rmixl_obio_get_bus_space_tag(void); -extern bus_addr_t rmixl_obio_get_io_pbase(void); +extern void rmixl_el_bus_mem_init(bus_space_tag_t, void *); +extern void rmixl_eb_bus_mem_init(bus_space_tag_t, void *); extern void *rmixl_intr_establish(int, int, int (*)(void *), void *); extern void rmixl_intr_disestablish(void *); Added files: Index: src/sys/arch/mips/rmi/rmixl_eb_space.c diff -u /dev/null src/sys/arch/mips/rmi/rmixl_eb_space.c:1.1.2.1 --- /dev/null Tue Sep 15 02:32:02 2009 +++ src/sys/arch/mips/rmi/rmixl_eb_space.c Tue Sep 15 02:32:02 2009 @@ -0,0 +1,58 @@ +/* $NetBSD: rmixl_eb_space.c,v 1.1.2.1 2009/09/15 02:32:02 cliff Exp $ */ + +/*- + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. + * + * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``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 FOUNDATION OR CONTRIBUTORS + * 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. + */ + +/* + * Big Endian bus_space(9) support for RMI {XLP,XLR,XLS} chips + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: rmixl_eb_space.c,v 1.1.2.1 2009/09/15 02:32:02 cliff Exp $"); + +#include <sys/types.h> +#include <sys/param.h> + +#include <machine/bus.h> +#include <mips/rmi/rmixl_obiovar.h> +#include <mips/rmi/rmixlreg.h> +#include <mips/rmi/rmixlvar.h> + +#define CHIP rmixl_eb +#define CHIP_MEM /* defined */ +#define CHIP_ACCESS_SIZE 4 +#define CHIP_BIG_ENDIAN + +/* MEM region 1 */ +#define CHIP_W1_BUS_START(v) 0 +#define CHIP_W1_BUS_END(v) (RMIXL_IO_DEV_SIZE - 1) +#define CHIP_W1_SYS_START(v) (((struct rmixl_config *)(v))->rc_io_pbase) +#define CHIP_W1_SYS_END(v) (CHIP_W1_SYS_START(v) + RMIXL_IO_DEV_SIZE - 1) + +#include <mips/mips/bus_space_alignstride_chipdep.c> Index: src/sys/arch/mips/rmi/rmixl_el_space.c diff -u /dev/null src/sys/arch/mips/rmi/rmixl_el_space.c:1.1.2.1 --- /dev/null Tue Sep 15 02:32:02 2009 +++ src/sys/arch/mips/rmi/rmixl_el_space.c Tue Sep 15 02:32:02 2009 @@ -0,0 +1,58 @@ +/* $NetBSD: rmixl_el_space.c,v 1.1.2.1 2009/09/15 02:32:02 cliff Exp $ */ + +/*- + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. + * + * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``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 FOUNDATION OR CONTRIBUTORS + * 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. + */ + +/* + * Little Endian bus_space(9) support for RMI {XLP,XLR,XLS} chips + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: rmixl_el_space.c,v 1.1.2.1 2009/09/15 02:32:02 cliff Exp $"); + +#include <sys/types.h> +#include <sys/param.h> + +#include <machine/bus.h> +#include <mips/rmi/rmixl_obiovar.h> +#include <mips/rmi/rmixlreg.h> +#include <mips/rmi/rmixlvar.h> + +#define CHIP rmixl_el +#define CHIP_MEM /* defined */ +#define CHIP_ACCESS_SIZE 4 +#define CHIP_LITTLE_ENDIAN + +/* MEM region 1 */ +#define CHIP_W1_BUS_START(v) 0 +#define CHIP_W1_BUS_END(v) (RMIXL_IO_DEV_SIZE - 1) +#define CHIP_W1_SYS_START(v) (((struct rmixl_config *)(v))->rc_io_pbase) +#define CHIP_W1_SYS_END(v) (CHIP_W1_SYS_START(v) + RMIXL_IO_DEV_SIZE - 1) + +#include <mips/mips/bus_space_alignstride_chipdep.c>