Thu Jan 19 08:03:22 2012 UTC ()
Improved true/false for cpu_rmixl?


(matt)
diff -r1.1.2.25 -r1.1.2.26 src/sys/arch/mips/rmi/rmixlvar.h

cvs diff -r1.1.2.25 -r1.1.2.26 src/sys/arch/mips/rmi/rmixlvar.h (switch to unified diff)

--- src/sys/arch/mips/rmi/rmixlvar.h 2012/01/04 16:17:54 1.1.2.25
+++ src/sys/arch/mips/rmi/rmixlvar.h 2012/01/19 08:03:22 1.1.2.26
@@ -1,344 +1,356 @@ @@ -1,344 +1,356 @@
1/* $NetBSD: rmixlvar.h,v 1.1.2.25 2012/01/04 16:17:54 matt Exp $ */ 1/* $NetBSD: rmixlvar.h,v 1.1.2.26 2012/01/19 08:03:22 matt 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
15 * notice, this list of conditions and the following disclaimer in the 15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution. 16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software 17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement: 18 * must display the following acknowledgement:
19 * This product includes software developed for the NetBSD Project by 19 * This product includes software developed for the NetBSD Project by
20 * Wasabi Systems, Inc. 20 * Wasabi Systems, Inc.
21 * 4. The name of Wasabi Systems, Inc. may not be used to endorse 21 * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 * or promote products derived from this software without specific prior 22 * or promote products derived from this software without specific prior
23 * written permission. 23 * written permission.
24 * 24 *
25 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 25 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
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#ifndef _MIPS_RMI_RMIXLVAR_H_ 38#ifndef _MIPS_RMI_RMIXLVAR_H_
39#define _MIPS_RMI_RMIXLVAR_H_ 39#define _MIPS_RMI_RMIXLVAR_H_
40 40
41#include <sys/bus.h> 41#include <sys/bus.h>
42#include <sys/extent.h> 42#include <sys/extent.h>
43 43
44#include <dev/pci/pcivar.h> 44#include <dev/pci/pcivar.h>
45 45
46#include <mips/cpu.h> 46#include <mips/cpu.h>
47#include <mips/locore.h> 47#include <mips/locore.h>
48 48
49#include <mips/rmi/rmixl_firmware.h> 49#include <mips/rmi/rmixl_firmware.h>
50#include <mips/rmi/rmixlreg.h> 50#include <mips/rmi/rmixlreg.h>
51 51
52void rmixl_pcr_init_core(bool); 52void rmixl_pcr_init_core(bool);
53 53
54static inline int 54static inline int
55cpu_rmixl_chip_type(const struct pridtab *ct) 55cpu_rmixl_chip_type(const struct pridtab *ct)
56{ 56{
57 return ct->cpu_cidflags & MIPS_CIDFL_RMI_TYPE; 57 return ct->cpu_cidflags & MIPS_CIDFL_RMI_TYPE;
58} 58}
59 59
60static inline bool 60static inline bool
61cpu_rmixl(const struct pridtab *ct) 61cpu_rmixl(const struct pridtab *ct)
62{ 62{
63 return ct->cpu_cid == MIPS_PRID_CID_RMI; 63 return ct->cpu_cid == MIPS_PRID_CID_RMI;
64} 64}
65 65
66static inline bool 66static inline bool
67cpu_rmixlr(const struct pridtab *ct) 67cpu_rmixlr(const struct pridtab *ct)
68{ 68{
69#ifdef MIPS64_XLR 69#ifdef MIPS64_XLR
 70#if (MIPS64_XLS + MIPS64_XLP) == 0
 71 return true;
 72#else
70 return cpu_rmixl(ct) && cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLR; 73 return cpu_rmixl(ct) && cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLR;
 74#endif
71#else 75#else
72 return false; 76 return false;
73#endif 77#endif
74} 78}
75 79
76static inline bool 80static inline bool
77cpu_rmixls(const struct pridtab *ct) 81cpu_rmixls(const struct pridtab *ct)
78{ 82{
79#ifdef MIPS64_XLS 83#ifdef MIPS64_XLS
 84#if (MIPS64_XLR + MIPS64_XLP) == 0
 85 return true;
 86#else
80 return cpu_rmixl(ct) && cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLS; 87 return cpu_rmixl(ct) && cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLS;
 88#endif
81#else 89#else
82 return false; 90 return false;
83#endif 91#endif
84} 92}
85 93
86static inline bool 94static inline bool
87cpu_rmixlp(const struct pridtab *ct) 95cpu_rmixlp(const struct pridtab *ct)
88{ 96{
89#ifdef MIPS64_XLP 97#ifdef MIPS64_XLP
 98#if (MIPS64_XLR + MIPS64_XLS) == 0
 99 return true;
 100#else
90 return cpu_rmixl(ct) && cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLP; 101 return cpu_rmixl(ct) && cpu_rmixl_chip_type(ct) == CIDFL_RMI_TYPE_XLP;
 102#endif
91#else 103#else
92 return false; 104 return false;
93#endif 105#endif
94} 106}
95 107
96typedef enum { 108typedef enum {
97 PSB_TYPE_UNKNOWN=0, 109 PSB_TYPE_UNKNOWN=0,
98 PSB_TYPE_RMI, 110 PSB_TYPE_RMI,
99 PSB_TYPE_DELL, 111 PSB_TYPE_DELL,
100} rmixlfw_psb_type_t; 112} rmixlfw_psb_type_t;
101 113
102static inline const char * 114static inline const char *
103rmixlfw_psb_type_name(rmixlfw_psb_type_t type) 115rmixlfw_psb_type_name(rmixlfw_psb_type_t type)
104{ 116{
105 switch(type) { 117 switch(type) {
106 case PSB_TYPE_UNKNOWN: 118 case PSB_TYPE_UNKNOWN:
107 return "unknown"; 119 return "unknown";
108 case PSB_TYPE_RMI: 120 case PSB_TYPE_RMI:
109 return "RMI"; 121 return "RMI";
110 case PSB_TYPE_DELL: 122 case PSB_TYPE_DELL:
111 return "DELL"; 123 return "DELL";
112 default: 124 default:
113 return "undefined"; 125 return "undefined";
114 } 126 }
115} 127}
116 128
117typedef enum { 129typedef enum {
118 RMIXLP_8XX, 130 RMIXLP_8XX,
119 RMIXLP_4XX, 131 RMIXLP_4XX,
120 /* These next 4 need to be in this order */ 132 /* These next 4 need to be in this order */
121 RMIXLP_3XX, 133 RMIXLP_3XX,
122 RMIXLP_3XXL, 134 RMIXLP_3XXL,
123 RMIXLP_3XXH, 135 RMIXLP_3XXH,
124 RMIXLP_3XXQ, 136 RMIXLP_3XXQ,
125 RMIXLP_ANY, /* must be last */ 137 RMIXLP_ANY, /* must be last */
126} rmixlp_variant_t; 138} rmixlp_variant_t;
127 139
128#define RMIXLP_8XX_P (RMIXLP_8XX <= rmixl_configuration.rc_xlp_variant \ 140#define RMIXLP_8XX_P (RMIXLP_8XX <= rmixl_configuration.rc_xlp_variant \
129 && rmixl_configuration.rc_xlp_variant <= RMIXLP_4XX) 141 && rmixl_configuration.rc_xlp_variant <= RMIXLP_4XX)
130#define RMIXLP_3XX_P (RMIXLP_3XX <= rmixl_configuration.rc_xlp_variant \ 142#define RMIXLP_3XX_P (RMIXLP_3XX <= rmixl_configuration.rc_xlp_variant \
131 && rmixl_configuration.rc_xlp_variant <= RMIXLP_3XXQ) 143 && rmixl_configuration.rc_xlp_variant <= RMIXLP_3XXQ)
132 144
133struct rmixl_region { 145struct rmixl_region {
134 bus_addr_t r_pbase; 146 bus_addr_t r_pbase;
135 bus_size_t r_size; 147 bus_size_t r_size;
136}; 148};
137 149
138struct rmixl_config { 150struct rmixl_config {
139 struct rmixl_region rc_io;  151 struct rmixl_region rc_io;
140 struct rmixl_region rc_flash[RMIXLP_SBC_NFLASH]; /* FLASH_BAR */ 152 struct rmixl_region rc_flash[RMIXLP_SBC_NFLASH]; /* FLASH_BAR */
141 struct rmixl_region rc_pci_cfg; 153 struct rmixl_region rc_pci_cfg;
142 struct rmixl_region rc_pci_ecfg; 154 struct rmixl_region rc_pci_ecfg;
143 struct rmixl_region rc_pci_mem; 155 struct rmixl_region rc_pci_mem;
144 struct rmixl_region rc_pci_io; 156 struct rmixl_region rc_pci_io;
145 struct rmixl_region rc_pci_link_mem[RMIXLP_SBC_NPCIE_MEM]; 157 struct rmixl_region rc_pci_link_mem[RMIXLP_SBC_NPCIE_MEM];
146 struct rmixl_region rc_pci_link_io[RMIXLP_SBC_NPCIE_IO]; 158 struct rmixl_region rc_pci_link_io[RMIXLP_SBC_NPCIE_IO];
147 struct rmixl_region rc_srio_mem; 159 struct rmixl_region rc_srio_mem;
148 struct rmixl_region rc_norflash[RMIXLP_NOR_NCS]; /* XLP */ 160 struct rmixl_region rc_norflash[RMIXLP_NOR_NCS]; /* XLP */
149 struct mips_bus_space rc_obio_eb_memt; /* DEVIO -eb */ 161 struct mips_bus_space rc_obio_eb_memt; /* DEVIO -eb */
150 struct mips_bus_space rc_obio_el_memt; /* DEVIO -el */ 162 struct mips_bus_space rc_obio_el_memt; /* DEVIO -el */
151 struct mips_bus_space rc_iobus_memt; /* Peripherals IO Bus */ 163 struct mips_bus_space rc_iobus_memt; /* Peripherals IO Bus */
152 struct mips_bus_space rc_pci_cfg_memt; /* PCI CFG */ 164 struct mips_bus_space rc_pci_cfg_memt; /* PCI CFG */
153 struct mips_bus_space rc_pci_ecfg_eb_memt; /* PCI ECFG */ 165 struct mips_bus_space rc_pci_ecfg_eb_memt; /* PCI ECFG */
154 struct mips_bus_space rc_pci_ecfg_el_memt; /* PCI ECFG */ 166 struct mips_bus_space rc_pci_ecfg_el_memt; /* PCI ECFG */
155 struct mips_bus_space rc_pci_memt; /* PCI MEM */ 167 struct mips_bus_space rc_pci_memt; /* PCI MEM */
156 struct mips_bus_space rc_pci_iot; /* PCI IO */ 168 struct mips_bus_space rc_pci_iot; /* PCI IO */
157 struct mips_bus_space rc_srio_memt; /* SRIO MEM */ 169 struct mips_bus_space rc_srio_memt; /* SRIO MEM */
158 struct mips_bus_dma_tag rc_dma_tag; 170 struct mips_bus_dma_tag rc_dma_tag;
159 struct mips_pci_chipset rc_pci_chipset; /* pci_chipset_t */ 171 struct mips_pci_chipset rc_pci_chipset; /* pci_chipset_t */
160 bus_space_handle_t rc_pci_cfg_memh; 172 bus_space_handle_t rc_pci_cfg_memh;
161 bus_space_handle_t rc_pci_ecfg_eb_memh; 173 bus_space_handle_t rc_pci_ecfg_eb_memh;
162 bus_space_handle_t rc_pci_ecfg_el_memh; 174 bus_space_handle_t rc_pci_ecfg_el_memh;
163 bus_dma_tag_t rc_dmat64; 175 bus_dma_tag_t rc_dmat64;
164 bus_dma_tag_t rc_dmat32; 176 bus_dma_tag_t rc_dmat32;
165 bus_dma_tag_t rc_dmat29; 177 bus_dma_tag_t rc_dmat29;
166 struct extent * rc_phys_ex; /* Note: MB units */ 178 struct extent * rc_phys_ex; /* Note: MB units */
167 struct extent * rc_obio_eb_ex; 179 struct extent * rc_obio_eb_ex;
168 struct extent * rc_obio_el_ex; 180 struct extent * rc_obio_el_ex;
169 struct extent * rc_iobus_ex; 181 struct extent * rc_iobus_ex;
170 struct extent * rc_pci_mem_ex; 182 struct extent * rc_pci_mem_ex;
171 struct extent * rc_pci_io_ex; 183 struct extent * rc_pci_io_ex;
172 struct extent * rc_srio_mem_ex; 184 struct extent * rc_srio_mem_ex;
173 uint64_t rc_gpio_available; 185 uint64_t rc_gpio_available;
174 rmixlfw_info_t rc_psb_info; 186 rmixlfw_info_t rc_psb_info;
175 rmixlfw_psb_type_t rc_psb_type; 187 rmixlfw_psb_type_t rc_psb_type;
176 volatile struct rmixlfw_cpu_wakeup_info * 188 volatile struct rmixlfw_cpu_wakeup_info *
177 rc_cpu_wakeup_info; 189 rc_cpu_wakeup_info;
178 const void * rc_cpu_wakeup_end; 190 const void * rc_cpu_wakeup_end;
179 const char * rc_cpuname; 191 const char * rc_cpuname;
180 int rc_mallocsafe; 192 int rc_mallocsafe;
181 rmixlp_variant_t rc_xlp_variant; 193 rmixlp_variant_t rc_xlp_variant;
182 uint8_t rc_ncores; 194 uint8_t rc_ncores;
183}; 195};
184 196
185extern struct rmixl_config rmixl_configuration; 197extern struct rmixl_config rmixl_configuration;
186 198
187void rmixl_flash_eb_bus_mem_init(bus_space_tag_t, void *); 199void rmixl_flash_eb_bus_mem_init(bus_space_tag_t, void *);
188void rmixl_flash_el_bus_mem_init(bus_space_tag_t, void *); 200void rmixl_flash_el_bus_mem_init(bus_space_tag_t, void *);
189void rmixl_iobus_bus_mem_init(bus_space_tag_t, void *); 201void rmixl_iobus_bus_mem_init(bus_space_tag_t, void *);
190void rmixl_obio_eb_bus_mem_init(bus_space_tag_t, void *); 202void rmixl_obio_eb_bus_mem_init(bus_space_tag_t, void *);
191void rmixl_obio_el_bus_mem_init(bus_space_tag_t, void *); 203void rmixl_obio_el_bus_mem_init(bus_space_tag_t, void *);
192void rmixl_pci_cfg_el_bus_mem_init(bus_space_tag_t, void *); 204void rmixl_pci_cfg_el_bus_mem_init(bus_space_tag_t, void *);
193void rmixl_pci_cfg_eb_bus_mem_init(bus_space_tag_t, void *); 205void rmixl_pci_cfg_eb_bus_mem_init(bus_space_tag_t, void *);
194void rmixl_pci_ecfg_el_bus_mem_init(bus_space_tag_t, void *); 206void rmixl_pci_ecfg_el_bus_mem_init(bus_space_tag_t, void *);
195void rmixl_pci_ecfg_eb_bus_mem_init(bus_space_tag_t, void *); 207void rmixl_pci_ecfg_eb_bus_mem_init(bus_space_tag_t, void *);
196void rmixl_pci_eb_bus_mem_init(bus_space_tag_t, void *); 208void rmixl_pci_eb_bus_mem_init(bus_space_tag_t, void *);
197void rmixl_pci_el_bus_mem_init(bus_space_tag_t, void *); 209void rmixl_pci_el_bus_mem_init(bus_space_tag_t, void *);
198void rmixl_pci_bus_io_init(bus_space_tag_t, void *); 210void rmixl_pci_bus_io_init(bus_space_tag_t, void *);
199 211
200void rmixlp_pcie_pc_init(void); 212void rmixlp_pcie_pc_init(void);
201 213
202void rmixl_addr_error_init(void); 214void rmixl_addr_error_init(void);
203int rmixl_addr_error_check(void); 215int rmixl_addr_error_check(void);
204 216
205uint64_t rmixl_mfcr(u_int); 217uint64_t rmixl_mfcr(u_int);
206void rmixl_mtcr(uint64_t, u_int); 218void rmixl_mtcr(uint64_t, u_int);
207 219
208void rmixl_eirr_ack(uint64_t, uint64_t, uint64_t); 220void rmixl_eirr_ack(uint64_t, uint64_t, uint64_t);
209 221
210void rmixl_fmn_init(void); 222void rmixl_fmn_init(void);
211 223
212void rmixl_init_early_cons(struct rmixl_config *, bool); 224void rmixl_init_early_cons(struct rmixl_config *, bool);
213void rmixl_mach_xlp_init(struct rmixl_config *); 225void rmixl_mach_xlp_init(struct rmixl_config *);
214void rmixl_mach_xlsxlr_init(struct rmixl_config *); 226void rmixl_mach_xlsxlr_init(struct rmixl_config *);
215void rmixl_mach_freq_init(struct rmixl_config *, bool, bool); 227void rmixl_mach_freq_init(struct rmixl_config *, bool, bool);
216void rmixl_mach_init_parse_args(int, char **); 228void rmixl_mach_init_parse_args(int, char **);
217void rmixl_mach_init_common(struct rmixl_config *, vaddr_t, uint64_t, 229void rmixl_mach_init_common(struct rmixl_config *, vaddr_t, uint64_t,
218 bool, bool); 230 bool, bool);
219uint64_t rmixl_physaddr_init(void); 231uint64_t rmixl_physaddr_init(void);
220uint64_t rmixlfw_init(int64_t); 232uint64_t rmixlfw_init(int64_t);
221 233
222/* 234/*
223 * rmixl_cache_err_dis: 235 * rmixl_cache_err_dis:
224 * - disable Cache, Data ECC, Snoop Tag Parity, Tag Parity errors 236 * - disable Cache, Data ECC, Snoop Tag Parity, Tag Parity errors
225 * - clear the cache error log 237 * - clear the cache error log
226 * - return previous value from RMIXL_PCR_L1D_CONFIG0 238 * - return previous value from RMIXL_PCR_L1D_CONFIG0
227 */ 239 */
228static inline uint64_t 240static inline uint64_t
229rmixl_cache_err_dis(void) 241rmixl_cache_err_dis(void)
230{ 242{
231 uint64_t r; 243 uint64_t r;
232 244
233 r = rmixl_mfcr(RMIXL_PCR_L1D_CONFIG0); 245 r = rmixl_mfcr(RMIXL_PCR_L1D_CONFIG0);
234 rmixl_mtcr(RMIXL_PCR_L1D_CONFIG0, r & ~0x2e); 246 rmixl_mtcr(RMIXL_PCR_L1D_CONFIG0, r & ~0x2e);
235 rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG, 0); 247 rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG, 0);
236 return r; 248 return r;
237} 249}
238 250
239/* 251/*
240 * rmixl_cache_err_restore: 252 * rmixl_cache_err_restore:
241 * - clear the cache error log, cache error overflow log, 253 * - clear the cache error log, cache error overflow log,
242 * and cache interrupt registers 254 * and cache interrupt registers
243 * - restore previous value to RMIXL_PCR_L1D_CONFIG0 255 * - restore previous value to RMIXL_PCR_L1D_CONFIG0
244 */ 256 */
245static inline void 257static inline void
246rmixl_cache_err_restore(uint64_t r) 258rmixl_cache_err_restore(uint64_t r)
247{ 259{
248 rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG, 0); 260 rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG, 0);
249 rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_OVF_LO, 0); 261 rmixl_mtcr(RMIXL_PCR_L1D_CACHE_ERROR_OVF_LO, 0);
250 rmixl_mtcr(RMIXL_PCR_L1D_CACHE_INTERRUPT, 0); 262 rmixl_mtcr(RMIXL_PCR_L1D_CACHE_INTERRUPT, 0);
251 rmixl_mtcr(RMIXL_PCR_L1D_CONFIG0, r); 263 rmixl_mtcr(RMIXL_PCR_L1D_CONFIG0, r);
252} 264}
253 265
254static inline uint64_t 266static inline uint64_t
255rmixl_cache_err_check(void) 267rmixl_cache_err_check(void)
256{ 268{
257 return rmixl_mfcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG); 269 return rmixl_mfcr(RMIXL_PCR_L1D_CACHE_ERROR_LOG);
258} 270}
259 271
260static inline int 272static inline int
261rmixl_probe_4(volatile uint32_t *va) 273rmixl_probe_4(volatile uint32_t *va)
262{ 274{
263 uint32_t tmp; 275 uint32_t tmp;
264 uint32_t r; 276 uint32_t r;
265 int err; 277 int err;
266 int s; 278 int s;
267 279
268 s = splhigh(); 280 s = splhigh();
269 r = rmixl_cache_err_dis(); 281 r = rmixl_cache_err_dis();
270 tmp = *va; /* probe */ 282 tmp = *va; /* probe */
271 err = rmixl_cache_err_check(); 283 err = rmixl_cache_err_check();
272 rmixl_cache_err_restore(r); 284 rmixl_cache_err_restore(r);
273 splx(s); 285 splx(s);
274 286
275 return (err == 0); 287 return (err == 0);
276} 288}
277 289
278static inline uint32_t 290static inline uint32_t
279rmixlp_read_4(uint32_t tag, bus_size_t offset) 291rmixlp_read_4(uint32_t tag, bus_size_t offset)
280{ 292{
281#if 0 293#if 0
282 const struct rmixl_config * const rcp = &rmixl_configuration; 294 const struct rmixl_config * const rcp = &rmixl_configuration;
283 295
284 return bus_space_read_4(rcp->rc_pci_ecfg_memt, rcp->rc_pci_ecfg_memh, 296 return bus_space_read_4(rcp->rc_pci_ecfg_memt, rcp->rc_pci_ecfg_memh,
285 offset); 297 offset);
286#else 298#else
287 const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase 299 const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase
288 + tag + offset; 300 + tag + offset;
289 301
290 return be32toh(*(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr)); 302 return be32toh(*(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr));
291#endif 303#endif
292} 304}
293 305
294static inline uint64_t 306static inline uint64_t
295rmixlp_read_8(uint32_t tag, bus_size_t offset) 307rmixlp_read_8(uint32_t tag, bus_size_t offset)
296{ 308{
297#if 0 309#if 0
298 const struct rmixl_config * const rcp = &rmixl_configuration; 310 const struct rmixl_config * const rcp = &rmixl_configuration;
299 311
300 return bus_space_read_8(rcp->rc_pci_ecfg_memt, rcp->rc_pci_ecfg_memh, 312 return bus_space_read_8(rcp->rc_pci_ecfg_memt, rcp->rc_pci_ecfg_memh,
301 offset); 313 offset);
302#else 314#else
303 const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase 315 const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase
304 + tag + offset; 316 + tag + offset;
305 317
306 return be64toh(*(volatile uint64_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr)); 318 return be64toh(*(volatile uint64_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr));
307#endif 319#endif
308} 320}
309 321
310static inline void 322static inline void
311rmixlp_write_4(uint32_t tag, bus_size_t offset, uint32_t v) 323rmixlp_write_4(uint32_t tag, bus_size_t offset, uint32_t v)
312{ 324{
313 const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase 325 const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase
314 + tag + offset; 326 + tag + offset;
315 327
316 *(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr) = htobe32(v); 328 *(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr) = htobe32(v);
317 __asm __volatile("sync"); 329 __asm __volatile("sync");
318} 330}
319 331
320static inline void 332static inline void
321rmixlp_write_8(uint32_t tag, bus_size_t offset, uint64_t v) 333rmixlp_write_8(uint32_t tag, bus_size_t offset, uint64_t v)
322{ 334{
323 const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase 335 const paddr_t ecfg_addr = rmixl_configuration.rc_pci_ecfg.r_pbase
324 + tag + offset; 336 + tag + offset;
325 337
326 *(volatile uint64_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr) = htobe64(v); 338 *(volatile uint64_t *)MIPS_PHYS_TO_KSEG1(ecfg_addr) = htobe64(v);
327 __asm __volatile("sync"); 339 __asm __volatile("sync");
328} 340}
329 341
330static inline void 342static inline void
331rmixl_physaddr_add(struct extent *ext, const char *name, 343rmixl_physaddr_add(struct extent *ext, const char *name,
332 struct rmixl_region *rp, bus_addr_t xpbase, bus_size_t xsize) 344 struct rmixl_region *rp, bus_addr_t xpbase, bus_size_t xsize)
333{ 345{
334 rp->r_pbase = xpbase; 346 rp->r_pbase = xpbase;
335 rp->r_size = xsize; 347 rp->r_size = xsize;
336 u_long base = xpbase >> 20; 348 u_long base = xpbase >> 20;
337 u_long size = xsize >> 20; 349 u_long size = xsize >> 20;
338 if (extent_alloc_region(ext, base, size, EX_NOWAIT) != 0) { 350 if (extent_alloc_region(ext, base, size, EX_NOWAIT) != 0) {
339 panic("%s: %s: extent_alloc_region(%p, %#lx, %#lx, %#x) " 351 panic("%s: %s: extent_alloc_region(%p, %#lx, %#lx, %#x) "
340 "failed", __func__, name, ext, base, size, EX_NOWAIT); 352 "failed", __func__, name, ext, base, size, EX_NOWAIT);
341 } 353 }
342} 354}
343 355
344#endif /* _MIPS_RMI_RMIXLVAR_H_ */ 356#endif /* _MIPS_RMI_RMIXLVAR_H_ */