Mon Dec 14 07:18:26 2009 UTC ()
- replace single bus space with two (big & little endian) bus spaces for obio


(cliff)
diff -r1.1.2.7 -r1.1.2.8 src/sys/arch/mips/rmi/rmixl_obio.c
diff -r1.1.2.6 -r1.1.2.7 src/sys/arch/mips/rmi/rmixl_obiovar.h
diff -r1.1.2.8 -r1.1.2.9 src/sys/arch/mips/rmi/rmixlvar.h

cvs diff -r1.1.2.7 -r1.1.2.8 src/sys/arch/mips/rmi/rmixl_obio.c (expand / switch to unified diff)

--- src/sys/arch/mips/rmi/rmixl_obio.c 2009/11/18 01:14:49 1.1.2.7
+++ src/sys/arch/mips/rmi/rmixl_obio.c 2009/12/14 07:18:26 1.1.2.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rmixl_obio.c,v 1.1.2.7 2009/11/18 01:14:49 cliff Exp $ */ 1/* $NetBSD: rmixl_obio.c,v 1.1.2.8 2009/12/14 07:18:26 cliff Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc. 4 * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Jason R. Thorpe for Wasabi Systems, Inc. 7 * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE. 35 * POSSIBILITY OF SUCH DAMAGE.
36 */ 36 */
37 37
38/* 38/*
39 * On-board device autoconfiguration support for RMI {XLP, XLR, XLS} chips 39 * On-board device autoconfiguration support for RMI {XLP, XLR, XLS} chips
40 */ 40 */
41 41
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43__KERNEL_RCSID(0, "$NetBSD: rmixl_obio.c,v 1.1.2.7 2009/11/18 01:14:49 cliff Exp $"); 43__KERNEL_RCSID(0, "$NetBSD: rmixl_obio.c,v 1.1.2.8 2009/12/14 07:18:26 cliff Exp $");
44 44
45#include "locators.h" 45#include "locators.h"
46#include "obio.h" 46#include "obio.h"
47#include "pci.h" 47#include "pci.h"
48 48
49#include <sys/param.h> 49#include <sys/param.h>
50#include <sys/systm.h> 50#include <sys/systm.h>
51#include <sys/device.h> 51#include <sys/device.h>
52#include <sys/extent.h> 52#include <sys/extent.h>
53#include <sys/malloc.h> 53#include <sys/malloc.h>
54 54
55#define _MIPS_BUS_DMA_PRIVATE 55#define _MIPS_BUS_DMA_PRIVATE
56#include <machine/bus.h> 56#include <machine/bus.h>
@@ -131,70 +131,76 @@ obio_print(void *aux, const char *pnp) @@ -131,70 +131,76 @@ obio_print(void *aux, const char *pnp)
131 aprint_normal(" mult %d", obio->obio_mult); 131 aprint_normal(" mult %d", obio->obio_mult);
132 if (obio->obio_intr != OBIOCF_INTR_DEFAULT) 132 if (obio->obio_intr != OBIOCF_INTR_DEFAULT)
133 aprint_normal(" intr %d", obio->obio_intr); 133 aprint_normal(" intr %d", obio->obio_intr);
134 134
135 return (UNCONF); 135 return (UNCONF);
136} 136}
137 137
138static int 138static int
139obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) 139obio_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
140{ 140{
141 struct obio_softc *sc = device_private(parent); 141 struct obio_softc *sc = device_private(parent);
142 struct obio_attach_args obio; 142 struct obio_attach_args obio;
143 143
144 obio.obio_bst = sc->sc_bst; 144 obio.obio_eb_bst = sc->sc_eb_bst;
 145 obio.obio_el_bst = sc->sc_el_bst;
145 obio.obio_addr = cf->cf_loc[OBIOCF_ADDR]; 146 obio.obio_addr = cf->cf_loc[OBIOCF_ADDR];
146 obio.obio_size = cf->cf_loc[OBIOCF_SIZE]; 147 obio.obio_size = cf->cf_loc[OBIOCF_SIZE];
147 obio.obio_mult = cf->cf_loc[OBIOCF_MULT]; 148 obio.obio_mult = cf->cf_loc[OBIOCF_MULT];
148 obio.obio_intr = cf->cf_loc[OBIOCF_INTR]; 149 obio.obio_intr = cf->cf_loc[OBIOCF_INTR];
149 obio.obio_29bit_dmat = sc->sc_29bit_dmat; 150 obio.obio_29bit_dmat = sc->sc_29bit_dmat;
150 obio.obio_32bit_dmat = sc->sc_32bit_dmat; 151 obio.obio_32bit_dmat = sc->sc_32bit_dmat;
151 obio.obio_64bit_dmat = sc->sc_64bit_dmat; 152 obio.obio_64bit_dmat = sc->sc_64bit_dmat;
152 153
153 if (config_match(parent, cf, &obio) > 0) 154 if (config_match(parent, cf, &obio) > 0)
154 config_attach(parent, cf, &obio, obio_print); 155 config_attach(parent, cf, &obio, obio_print);
155 156
156 return 0; 157 return 0;
157} 158}
158 159
159static void 160static void
160obio_bus_init(struct obio_softc *sc) 161obio_bus_init(struct obio_softc *sc)
161{ 162{
162 struct rmixl_config *rcp = &rmixl_configuration; 163 struct rmixl_config *rcp = &rmixl_configuration;
163 static int done = 0; 164 static int done = 0;
164 165
165 if (done) 166 if (done)
166 return; 167 return;
167 done = 1; 168 done = 1;
168 169
169 /* obio (devio) space */ 170 /* obio (devio) space, Big Endian */
170 if (rcp->rc_obio_memt.bs_cookie == 0) 171 if (rcp->rc_obio_eb_memt.bs_cookie == 0)
171 rmixl_obio_bus_mem_init(&rcp->rc_obio_memt, rcp); 172 rmixl_obio_eb_bus_mem_init(&rcp->rc_obio_eb_memt, rcp);
 173
 174 /* obio (devio) space, Little Endian */
 175 if (rcp->rc_obio_el_memt.bs_cookie == 0)
 176 rmixl_obio_el_bus_mem_init(&rcp->rc_obio_el_memt, rcp);
172 177
173 /* dma space for addr < 512MB */ 178 /* dma space for addr < 512MB */
174 if (rcp->rc_29bit_dmat._cookie == 0) 179 if (rcp->rc_29bit_dmat._cookie == 0)
175 obio_dma_init_29(&rcp->rc_29bit_dmat); 180 obio_dma_init_29(&rcp->rc_29bit_dmat);
176#ifdef NOTYET 181#ifdef NOTYET
177 /* dma space for addr < 4GB */ 182 /* dma space for addr < 4GB */
178 if (rcp->rc_32bit_dmat._cookie == 0) 183 if (rcp->rc_32bit_dmat._cookie == 0)
179 obio_dma_init_32(&rcp->rc_32bit_dmat); 184 obio_dma_init_32(&rcp->rc_32bit_dmat);
180 /* dma space for all memory, including >= 4GB */ 185 /* dma space for all memory, including >= 4GB */
181 if (rcp->rc_64bit_dmat._cookie == 0) 186 if (rcp->rc_64bit_dmat._cookie == 0)
182 obio_dma_init_64(&rcp->rc_64bit_dmat); 187 obio_dma_init_64(&rcp->rc_64bit_dmat);
183#endif 188#endif
184 189
185 sc->sc_base = (bus_addr_t)rcp->rc_io_pbase; 190 sc->sc_base = (bus_addr_t)rcp->rc_io_pbase;
186 sc->sc_size = (bus_size_t)RMIXL_IO_DEV_SIZE; 191 sc->sc_size = (bus_size_t)RMIXL_IO_DEV_SIZE;
187 sc->sc_bst = (bus_space_tag_t)&rcp->rc_obio_memt; 192 sc->sc_eb_bst = (bus_space_tag_t)&rcp->rc_obio_eb_memt;
 193 sc->sc_el_bst = (bus_space_tag_t)&rcp->rc_obio_el_memt;
188 sc->sc_29bit_dmat = &rcp->rc_29bit_dmat; 194 sc->sc_29bit_dmat = &rcp->rc_29bit_dmat;
189#ifdef NOTYET 195#ifdef NOTYET
190 sc->sc_32bit_dmat = &rcp->rc_32bit_dmat; 196 sc->sc_32bit_dmat = &rcp->rc_32bit_dmat;
191 sc->sc_64bit_dmat = &rcp->rc_64bit_dmat; 197 sc->sc_64bit_dmat = &rcp->rc_64bit_dmat;
192#else 198#else
193 sc->sc_32bit_dmat = NULL; 199 sc->sc_32bit_dmat = NULL;
194 sc->sc_64bit_dmat = NULL; 200 sc->sc_64bit_dmat = NULL;
195#endif 201#endif
196} 202}
197 203
198static void 204static void
199obio_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset, 205obio_bus_dmamap_sync(bus_dma_tag_t t, bus_dmamap_t map, bus_addr_t offset,
200 bus_size_t len, int ops) 206 bus_size_t len, int ops)

cvs diff -r1.1.2.6 -r1.1.2.7 src/sys/arch/mips/rmi/rmixl_obiovar.h (expand / switch to unified diff)

--- src/sys/arch/mips/rmi/rmixl_obiovar.h 2009/11/15 22:58:15 1.1.2.6
+++ src/sys/arch/mips/rmi/rmixl_obiovar.h 2009/12/14 07:18:26 1.1.2.7
@@ -1,31 +1,33 @@ @@ -1,31 +1,33 @@
1/* $NetBSD: rmixl_obiovar.h,v 1.1.2.6 2009/11/15 22:58:15 cliff Exp $ */ 1/* $NetBSD: rmixl_obiovar.h,v 1.1.2.7 2009/12/14 07:18:26 cliff Exp $ */
2 2
3#ifndef _MIPS_RMI_RMIXL_OBIOVAR_H_ 3#ifndef _MIPS_RMI_RMIXL_OBIOVAR_H_
4#define _MIPS_RMI_RMIXL_OBIOVAR_H_ 4#define _MIPS_RMI_RMIXL_OBIOVAR_H_
5 5
6#include <dev/pci/pcivar.h> 6#include <dev/pci/pcivar.h>
7#include <mips/bus_dma.h> 7#include <mips/bus_dma.h>
8#include <mips/pci_machdep.h> 8#include <mips/pci_machdep.h>
9 9
10struct obio_attach_args { 10struct obio_attach_args {
11 bus_space_tag_t obio_bst; 11 bus_space_tag_t obio_eb_bst;
 12 bus_space_tag_t obio_el_bst;
12 bus_addr_t obio_addr; 13 bus_addr_t obio_addr;
13 bus_size_t obio_size; 14 bus_size_t obio_size;
14 int obio_intr; 15 int obio_intr;
15 unsigned int obio_mult; 16 unsigned int obio_mult;
16 bus_dma_tag_t obio_29bit_dmat; 17 bus_dma_tag_t obio_29bit_dmat;
17 bus_dma_tag_t obio_32bit_dmat; 18 bus_dma_tag_t obio_32bit_dmat;
18 bus_dma_tag_t obio_64bit_dmat; 19 bus_dma_tag_t obio_64bit_dmat;
19}; 20};
20 21
21typedef struct obio_softc { 22typedef struct obio_softc {
22 device_t sc_dev; 23 device_t sc_dev;
23 bus_space_tag_t sc_bst; 24 bus_space_tag_t sc_eb_bst;
 25 bus_space_tag_t sc_el_bst;
24 bus_dma_tag_t sc_29bit_dmat; 26 bus_dma_tag_t sc_29bit_dmat;
25 bus_dma_tag_t sc_32bit_dmat; 27 bus_dma_tag_t sc_32bit_dmat;
26 bus_dma_tag_t sc_64bit_dmat; 28 bus_dma_tag_t sc_64bit_dmat;
27 bus_addr_t sc_base; 29 bus_addr_t sc_base;
28 bus_size_t sc_size; 30 bus_size_t sc_size;
29} obio_softc_t; 31} obio_softc_t;
30 32
31#endif /* _MIPS_RMI_RMIXL_OBIOVAR_H_ */ 33#endif /* _MIPS_RMI_RMIXL_OBIOVAR_H_ */

cvs diff -r1.1.2.8 -r1.1.2.9 src/sys/arch/mips/rmi/rmixlvar.h (expand / switch to unified diff)

--- src/sys/arch/mips/rmi/rmixlvar.h 2009/11/18 01:16:07 1.1.2.8
+++ src/sys/arch/mips/rmi/rmixlvar.h 2009/12/14 07:18:26 1.1.2.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: rmixlvar.h,v 1.1.2.8 2009/11/18 01:16:07 cliff Exp $ */ 1/* $NetBSD: rmixlvar.h,v 1.1.2.9 2009/12/14 07:18:26 cliff Exp $ */
2 2
3/* 3/*
4 * Copyright 2002 Wasabi Systems, Inc. 4 * Copyright 2002 Wasabi Systems, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Written by Simon Burge for Wasabi Systems, Inc. 7 * Written by Simon Burge for Wasabi Systems, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -90,46 +90,49 @@ typedef enum { @@ -90,46 +90,49 @@ typedef enum {
90 RMIXL_INTR_LOW, 90 RMIXL_INTR_LOW,
91} rmixl_intr_polarity_t; 91} rmixl_intr_polarity_t;
92 92
93struct rmixl_config { 93struct rmixl_config {
94 uint64_t rc_io_pbase;  94 uint64_t rc_io_pbase;
95 bus_addr_t rc_pcie_cfg_pbase;  95 bus_addr_t rc_pcie_cfg_pbase;
96 bus_size_t rc_pcie_cfg_size; 96 bus_size_t rc_pcie_cfg_size;
97 bus_addr_t rc_pcie_ecfg_pbase;  97 bus_addr_t rc_pcie_ecfg_pbase;
98 bus_size_t rc_pcie_ecfg_size; 98 bus_size_t rc_pcie_ecfg_size;
99 bus_addr_t rc_pci_mem_pbase;  99 bus_addr_t rc_pci_mem_pbase;
100 bus_size_t rc_pci_mem_size; 100 bus_size_t rc_pci_mem_size;
101 bus_addr_t rc_pci_io_pbase;  101 bus_addr_t rc_pci_io_pbase;
102 bus_size_t rc_pci_io_size; 102 bus_size_t rc_pci_io_size;
103 struct mips_bus_space rc_obio_memt; /* DEVIO */ 103 struct mips_bus_space rc_obio_eb_memt; /* DEVIO -eb */
 104 struct mips_bus_space rc_obio_el_memt; /* DEVIO -el */
104 struct mips_bus_space rc_pcie_cfg_memt; /* PCI CFG */ 105 struct mips_bus_space rc_pcie_cfg_memt; /* PCI CFG */
105 struct mips_bus_space rc_pcie_ecfg_memt; /* PCI ECFG */ 106 struct mips_bus_space rc_pcie_ecfg_memt; /* PCI ECFG */
106 struct mips_bus_space rc_pci_memt; /* PCI MEM */ 107 struct mips_bus_space rc_pci_memt; /* PCI MEM */
107 struct mips_bus_space rc_pci_iot; /* PCI IO */ 108 struct mips_bus_space rc_pci_iot; /* PCI IO */
108 struct mips_bus_dma_tag rc_29bit_dmat; 109 struct mips_bus_dma_tag rc_29bit_dmat;
109 struct mips_bus_dma_tag rc_32bit_dmat; 110 struct mips_bus_dma_tag rc_32bit_dmat;
110 struct mips_bus_dma_tag rc_64bit_dmat; 111 struct mips_bus_dma_tag rc_64bit_dmat;
111 struct extent *rc_phys_ex; /* Note: MB units */ 112 struct extent *rc_phys_ex; /* Note: MB units */
112 struct extent *rc_obio_ex; 113 struct extent *rc_obio_eb_ex;
 114 struct extent *rc_obio_el_ex;
113 struct extent *rc_pcie_cfg_ex; 115 struct extent *rc_pcie_cfg_ex;
114 struct extent *rc_pcie_ecfg_ex; 116 struct extent *rc_pcie_ecfg_ex;
115 struct extent *rc_pcie_mem_ex; 117 struct extent *rc_pcie_mem_ex;
116 struct extent *rc_pcie_io_ex; 118 struct extent *rc_pcie_io_ex;
117 int rc_mallocsafe; 119 int rc_mallocsafe;
118}; 120};
119 121
120extern struct rmixl_config rmixl_configuration; 122extern struct rmixl_config rmixl_configuration;
121 123
122extern void rmixl_obio_bus_mem_init(bus_space_tag_t, void *); 124extern void rmixl_obio_eb_bus_mem_init(bus_space_tag_t, void *);
 125extern void rmixl_obio_el_bus_mem_init(bus_space_tag_t, void *);
123extern void rmixl_pcie_cfg_bus_mem_init(bus_space_tag_t, void *); 126extern void rmixl_pcie_cfg_bus_mem_init(bus_space_tag_t, void *);
124extern void rmixl_pcie_ecfg_bus_mem_init(bus_space_tag_t, void *); 127extern void rmixl_pcie_ecfg_bus_mem_init(bus_space_tag_t, void *);
125extern void rmixl_pcie_bus_mem_init(bus_space_tag_t, void *); 128extern void rmixl_pcie_bus_mem_init(bus_space_tag_t, void *);
126extern void rmixl_pcie_bus_io_init(bus_space_tag_t, void *); 129extern void rmixl_pcie_bus_io_init(bus_space_tag_t, void *);
127 130
128extern const char *rmixl_intr_string(int); 131extern const char *rmixl_intr_string(int);
129extern void *rmixl_intr_establish(int, int, 132extern void *rmixl_intr_establish(int, int,
130 rmixl_intr_trigger_t, rmixl_intr_polarity_t, 133 rmixl_intr_trigger_t, rmixl_intr_polarity_t,
131 int (*)(void *), void *); 134 int (*)(void *), void *);
132extern void rmixl_intr_disestablish(void *); 135extern void rmixl_intr_disestablish(void *);
133 136
134extern void rmixl_addr_error_init(void); 137extern void rmixl_addr_error_init(void);
135extern int rmixl_addr_error_check(void); 138extern int rmixl_addr_error_check(void);