tx39.c revision 1.8.2.2 1 1.8.2.2 wrstuden /* $NetBSD: tx39.c,v 1.8.2.2 1999/12/27 18:32:10 wrstuden Exp $ */
2 1.8.2.2 wrstuden
3 1.8.2.2 wrstuden /*
4 1.8.2.2 wrstuden * Copyright (c) 1999, by UCHIYAMA Yasushi
5 1.8.2.2 wrstuden * All rights reserved.
6 1.8.2.2 wrstuden *
7 1.8.2.2 wrstuden * Redistribution and use in source and binary forms, with or without
8 1.8.2.2 wrstuden * modification, are permitted provided that the following conditions
9 1.8.2.2 wrstuden * are met:
10 1.8.2.2 wrstuden * 1. Redistributions of source code must retain the above copyright
11 1.8.2.2 wrstuden * notice, this list of conditions and the following disclaimer.
12 1.8.2.2 wrstuden * 2. The name of the developer may NOT be used to endorse or promote products
13 1.8.2.2 wrstuden * derived from this software without specific prior written permission.
14 1.8.2.2 wrstuden *
15 1.8.2.2 wrstuden * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 1.8.2.2 wrstuden * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 1.8.2.2 wrstuden * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 1.8.2.2 wrstuden * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 1.8.2.2 wrstuden * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 1.8.2.2 wrstuden * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 1.8.2.2 wrstuden * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 1.8.2.2 wrstuden * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 1.8.2.2 wrstuden * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 1.8.2.2 wrstuden * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 1.8.2.2 wrstuden * SUCH DAMAGE.
26 1.8.2.2 wrstuden *
27 1.8.2.2 wrstuden */
28 1.8.2.2 wrstuden
29 1.8.2.2 wrstuden #include "opt_tx39_debug.h"
30 1.8.2.2 wrstuden #include "m38813c.h"
31 1.8.2.2 wrstuden #include "p7416buf.h"
32 1.8.2.2 wrstuden #include "tc5165buf.h"
33 1.8.2.2 wrstuden
34 1.8.2.2 wrstuden #include <sys/param.h>
35 1.8.2.2 wrstuden #include <sys/systm.h>
36 1.8.2.2 wrstuden #include <sys/device.h>
37 1.8.2.2 wrstuden
38 1.8.2.2 wrstuden #include <machine/locore.h> /* cpu_id */
39 1.8.2.2 wrstuden #include <machine/bootinfo.h> /* bootinfo */
40 1.8.2.2 wrstuden #include <machine/sysconf.h> /* platform */
41 1.8.2.2 wrstuden
42 1.8.2.2 wrstuden #include <machine/platid.h>
43 1.8.2.2 wrstuden #include <machine/platid_mask.h>
44 1.8.2.2 wrstuden
45 1.8.2.2 wrstuden #include <machine/bus.h>
46 1.8.2.2 wrstuden #include <machine/intr.h>
47 1.8.2.2 wrstuden
48 1.8.2.2 wrstuden #include <hpcmips/hpcmips/machdep.h> /* cpu_model */
49 1.8.2.2 wrstuden
50 1.8.2.2 wrstuden #include <hpcmips/tx/tx39biureg.h>
51 1.8.2.2 wrstuden #include <hpcmips/tx/tx39reg.h>
52 1.8.2.2 wrstuden #include <hpcmips/tx/tx39var.h>
53 1.8.2.2 wrstuden #ifdef TX391X
54 1.8.2.2 wrstuden #include <hpcmips/tx/tx3912videovar.h>
55 1.8.2.2 wrstuden #endif
56 1.8.2.2 wrstuden
57 1.8.2.2 wrstuden #include <sys/termios.h>
58 1.8.2.2 wrstuden #include <sys/ttydefaults.h>
59 1.8.2.2 wrstuden #include <hpcmips/tx/tx39uartvar.h>
60 1.8.2.2 wrstuden #ifndef CONSPEED
61 1.8.2.2 wrstuden #define CONSPEED TTYDEF_SPEED
62 1.8.2.2 wrstuden #endif
63 1.8.2.2 wrstuden
64 1.8.2.2 wrstuden /* console keyboard */
65 1.8.2.2 wrstuden #if NP7416BUF > 0
66 1.8.2.2 wrstuden #include <hpcmips/dev/p7416bufvar.h>
67 1.8.2.2 wrstuden #endif
68 1.8.2.2 wrstuden #if NM38813C > 0
69 1.8.2.2 wrstuden #include <hpcmips/dev/m38813cvar.h>
70 1.8.2.2 wrstuden #endif
71 1.8.2.2 wrstuden #if NTC5165BUF > 0
72 1.8.2.2 wrstuden #include <hpcmips/dev/tc5165bufvar.h>
73 1.8.2.2 wrstuden #endif
74 1.8.2.2 wrstuden
75 1.8.2.2 wrstuden extern unsigned nullclkread __P((void));
76 1.8.2.2 wrstuden extern unsigned (*clkread) __P((void));
77 1.8.2.2 wrstuden
78 1.8.2.2 wrstuden struct tx_chipset_tag tx_chipset;
79 1.8.2.2 wrstuden
80 1.8.2.2 wrstuden #ifdef TX39_DEBUG
81 1.8.2.2 wrstuden u_int32_t tx39debugflag;
82 1.8.2.2 wrstuden #endif
83 1.8.2.2 wrstuden
84 1.8.2.2 wrstuden void tx_init __P((void));
85 1.8.2.2 wrstuden int tx39icu_intr __P((u_int32_t, u_int32_t, u_int32_t, u_int32_t));
86 1.8.2.2 wrstuden int tx39_find_dram __P((u_int32_t, u_int32_t));
87 1.8.2.2 wrstuden
88 1.8.2.2 wrstuden /* TX39-specific initialization vector */
89 1.8.2.2 wrstuden void tx_os_init __P((void));
90 1.8.2.2 wrstuden void tx_bus_reset __P((void));
91 1.8.2.2 wrstuden void tx_cons_init __P((void));
92 1.8.2.2 wrstuden void tx_device_register __P((struct device *, void *));
93 1.8.2.2 wrstuden void tx_fb_init __P((caddr_t*));
94 1.8.2.2 wrstuden int tx_mem_init __P((caddr_t));
95 1.8.2.2 wrstuden void tx_reboot __P((int howto, char *bootstr));
96 1.8.2.2 wrstuden int tx_intr __P((u_int32_t mask, u_int32_t pc, u_int32_t statusReg,
97 1.8.2.2 wrstuden u_int32_t causeReg));
98 1.8.2.2 wrstuden
99 1.8.2.2 wrstuden void
100 1.8.2.2 wrstuden tx_init()
101 1.8.2.2 wrstuden {
102 1.8.2.2 wrstuden tx_chipset_tag_t tc;
103 1.8.2.2 wrstuden int model, rev;
104 1.8.2.2 wrstuden
105 1.8.2.2 wrstuden tc = tx_conf_get_tag();
106 1.8.2.2 wrstuden /*
107 1.8.2.2 wrstuden * Platform Specific Function Hooks
108 1.8.2.2 wrstuden */
109 1.8.2.2 wrstuden platform.os_init = tx_os_init;
110 1.8.2.2 wrstuden platform.bus_reset = tx_bus_reset;
111 1.8.2.2 wrstuden platform.cons_init = tx_cons_init;
112 1.8.2.2 wrstuden platform.device_register = tx_device_register;
113 1.8.2.2 wrstuden platform.fb_init = tx_fb_init;
114 1.8.2.2 wrstuden platform.mem_init = tx_mem_init;
115 1.8.2.2 wrstuden platform.reboot = tx_reboot;
116 1.8.2.2 wrstuden
117 1.8.2.2 wrstuden model = (cpu_id.cpu.cp_majrev << 4)| cpu_id.cpu.cp_minrev;
118 1.8.2.2 wrstuden
119 1.8.2.2 wrstuden switch (model) {
120 1.8.2.2 wrstuden default:
121 1.8.2.2 wrstuden /* Unknown TOSHIBA TX39-series */
122 1.8.2.2 wrstuden sprintf(cpu_model, "Unknown TOSHIBA TX39-series %x.%x",
123 1.8.2.2 wrstuden cpu_id.cpu.cp_majrev, cpu_id.cpu.cp_minrev);
124 1.8.2.2 wrstuden break;
125 1.8.2.2 wrstuden case TMPR3912:
126 1.8.2.2 wrstuden sprintf(cpu_model, "TOSHIBA TMPR3912");
127 1.8.2.2 wrstuden cpuspeed = 50; /* XXX Should calibrate XXX */
128 1.8.2.2 wrstuden break;
129 1.8.2.2 wrstuden case TMPR3922:
130 1.8.2.2 wrstuden rev = tx_conf_read(tc, TX3922_REVISION_REG);
131 1.8.2.2 wrstuden sprintf(cpu_model, "TOSHIBA TMPR3922 rev. %x.%x",
132 1.8.2.2 wrstuden (rev >> 4) & 0xf, rev & 0xf);
133 1.8.2.2 wrstuden cpuspeed = 100; /* XXX Should calibrate XXX */
134 1.8.2.2 wrstuden break;
135 1.8.2.2 wrstuden }
136 1.8.2.2 wrstuden }
137 1.8.2.2 wrstuden
138 1.8.2.2 wrstuden void
139 1.8.2.2 wrstuden tx_os_init()
140 1.8.2.2 wrstuden {
141 1.8.2.2 wrstuden /*
142 1.8.2.2 wrstuden * Set up interrupt handling and I/O addresses.
143 1.8.2.2 wrstuden */
144 1.8.2.2 wrstuden mips_hardware_intr = tx39icu_intr;
145 1.8.2.2 wrstuden
146 1.8.2.2 wrstuden splvec.splbio = MIPS_SPL_2_4;
147 1.8.2.2 wrstuden splvec.splnet = MIPS_SPL_2_4;
148 1.8.2.2 wrstuden splvec.spltty = MIPS_SPL_2_4;
149 1.8.2.2 wrstuden splvec.splimp = MIPS_SPL_2_4;
150 1.8.2.2 wrstuden splvec.splclock = MIPS_SPL_2_4;
151 1.8.2.2 wrstuden splvec.splstatclock = MIPS_SPL_2_4;
152 1.8.2.2 wrstuden
153 1.8.2.2 wrstuden /* no high resolution timer circuit; possibly never called */
154 1.8.2.2 wrstuden clkread = nullclkread;
155 1.8.2.2 wrstuden }
156 1.8.2.2 wrstuden
157 1.8.2.2 wrstuden void
158 1.8.2.2 wrstuden tx_fb_init(kernend)
159 1.8.2.2 wrstuden caddr_t *kernend;
160 1.8.2.2 wrstuden {
161 1.8.2.2 wrstuden #ifdef TX391X
162 1.8.2.2 wrstuden tx_chipset_tag_t tc;
163 1.8.2.2 wrstuden u_int32_t fb_start, fb_addr, fb_size, fb_line_bytes;
164 1.8.2.2 wrstuden
165 1.8.2.2 wrstuden /* Initialize to access TX39 configuration register */
166 1.8.2.2 wrstuden tc = tx_conf_get_tag();
167 1.8.2.2 wrstuden
168 1.8.2.2 wrstuden fb_start = MIPS_KSEG0_TO_PHYS(*kernend);
169 1.8.2.2 wrstuden tx3912video_init(tc, fb_start, bootinfo->fb_width,
170 1.8.2.2 wrstuden bootinfo->fb_height, &fb_addr, &fb_size,
171 1.8.2.2 wrstuden &fb_line_bytes);
172 1.8.2.2 wrstuden
173 1.8.2.2 wrstuden /* Setup bootinfo */
174 1.8.2.2 wrstuden bootinfo->fb_line_bytes = fb_line_bytes;
175 1.8.2.2 wrstuden bootinfo->fb_addr = (unsigned char*)MIPS_PHYS_TO_KSEG1(fb_addr);
176 1.8.2.2 wrstuden
177 1.8.2.2 wrstuden /* Skip V-RAM area */
178 1.8.2.2 wrstuden *kernend += fb_size;
179 1.8.2.2 wrstuden #endif /* TX391X */
180 1.8.2.2 wrstuden #ifdef TX392X
181 1.8.2.2 wrstuden /*
182 1.8.2.2 wrstuden * Plum V-RAM isn't accessible until pmap_bootstrap,
183 1.8.2.2 wrstuden * at this time, frame buffer device is disabled.
184 1.8.2.2 wrstuden */
185 1.8.2.2 wrstuden bootinfo->fb_addr = 0;
186 1.8.2.2 wrstuden #endif /* TX392X */
187 1.8.2.2 wrstuden }
188 1.8.2.2 wrstuden
189 1.8.2.2 wrstuden int
190 1.8.2.2 wrstuden tx_mem_init(kernend)
191 1.8.2.2 wrstuden caddr_t kernend; /* kseg0 */
192 1.8.2.2 wrstuden {
193 1.8.2.2 wrstuden u_int32_t startaddr, endaddr;
194 1.8.2.2 wrstuden int npage, xpage, kpage;
195 1.8.2.2 wrstuden
196 1.8.2.2 wrstuden startaddr = MIPS_PHYS_TO_KSEG1(
197 1.8.2.2 wrstuden (btoc((u_int32_t)kernend - MIPS_KSEG0_START)) << PGSHIFT);
198 1.8.2.2 wrstuden endaddr = MIPS_PHYS_TO_KSEG1(TX39_SYSADDR_DRAMBANK0CS1 +
199 1.8.2.2 wrstuden TX39_SYSADDR_DRAMBANK_LEN);
200 1.8.2.2 wrstuden kpage = btoc(MIPS_KSEG1_TO_PHYS(startaddr));
201 1.8.2.2 wrstuden
202 1.8.2.2 wrstuden /* D-RAM bank0 */
203 1.8.2.2 wrstuden npage = tx39_find_dram(startaddr, endaddr);
204 1.8.2.2 wrstuden
205 1.8.2.2 wrstuden printf("DRAM bank0: %d pages (%dMByte) reserved %d pages\n",
206 1.8.2.2 wrstuden npage + 1, ((npage + 1) * NBPG) / 0x100000, kpage + 1);
207 1.8.2.2 wrstuden npage -= kpage; /* exclude kernel area */
208 1.8.2.2 wrstuden
209 1.8.2.2 wrstuden /* Clear DRAM area */
210 1.8.2.2 wrstuden memset((void*)startaddr, 0, npage * NBPG);
211 1.8.2.2 wrstuden
212 1.8.2.2 wrstuden /* D-RAM bank1 XXX find only. not usable yet */
213 1.8.2.2 wrstuden startaddr = MIPS_PHYS_TO_KSEG1(TX39_SYSADDR_DRAMBANK1CS1);
214 1.8.2.2 wrstuden endaddr = MIPS_PHYS_TO_KSEG1(TX39_SYSADDR_DRAMBANK1CS1 +
215 1.8.2.2 wrstuden TX39_SYSADDR_DRAMBANK_LEN);
216 1.8.2.2 wrstuden xpage = tx39_find_dram(startaddr, endaddr);
217 1.8.2.2 wrstuden printf("DRAM bank1: %d pages (%dMByte) ...but not usable yet\n",
218 1.8.2.2 wrstuden xpage + 1, ((xpage + 1) * NBPG) / 0x100000);
219 1.8.2.2 wrstuden
220 1.8.2.2 wrstuden /*
221 1.8.2.2 wrstuden * Clear currently unused D-RAM area
222 1.8.2.2 wrstuden * (For reboot Windows CE clearly)
223 1.8.2.2 wrstuden */
224 1.8.2.2 wrstuden memset((void*)startaddr, 0, npage * NBPG);
225 1.8.2.2 wrstuden memset((void*)(KERNBASE + 0x400), 0,
226 1.8.2.2 wrstuden KERNTEXTOFF - KERNBASE - 0x800);
227 1.8.2.2 wrstuden
228 1.8.2.2 wrstuden return npage; /* Return bank0's memory only */
229 1.8.2.2 wrstuden }
230 1.8.2.2 wrstuden
231 1.8.2.2 wrstuden void
232 1.8.2.2 wrstuden tx_reboot(howto, bootstr)
233 1.8.2.2 wrstuden int howto;
234 1.8.2.2 wrstuden char *bootstr;
235 1.8.2.2 wrstuden {
236 1.8.2.2 wrstuden goto *(u_int32_t *)MIPS_RESET_EXC_VEC;
237 1.8.2.2 wrstuden }
238 1.8.2.2 wrstuden
239 1.8.2.2 wrstuden int
240 1.8.2.2 wrstuden tx39_find_dram(startaddr, endaddr)
241 1.8.2.2 wrstuden u_int32_t startaddr; /* kseg1 */
242 1.8.2.2 wrstuden u_int32_t endaddr; /* kseg1 */
243 1.8.2.2 wrstuden {
244 1.8.2.2 wrstuden #define DRAM_MAGIC0 0xac1dcafe
245 1.8.2.2 wrstuden #define DRAM_MAGIC1 0x19700220
246 1.8.2.2 wrstuden u_int32_t page;
247 1.8.2.2 wrstuden int npage;
248 1.8.2.2 wrstuden
249 1.8.2.2 wrstuden page = startaddr;
250 1.8.2.2 wrstuden ((volatile int *)page)[0] = DRAM_MAGIC0;
251 1.8.2.2 wrstuden ((volatile int *)page)[4] = DRAM_MAGIC1;
252 1.8.2.2 wrstuden page += NBPG;
253 1.8.2.2 wrstuden for (npage = 0; page < endaddr; page += NBPG, npage++) {
254 1.8.2.2 wrstuden if ((((volatile int *)page)[0] == DRAM_MAGIC0 &&
255 1.8.2.2 wrstuden ((volatile int *)page)[4] == DRAM_MAGIC1)) {
256 1.8.2.2 wrstuden return npage;
257 1.8.2.2 wrstuden }
258 1.8.2.2 wrstuden }
259 1.8.2.2 wrstuden /* no memory in this bank */
260 1.8.2.2 wrstuden return 0;
261 1.8.2.2 wrstuden }
262 1.8.2.2 wrstuden
263 1.8.2.2 wrstuden void
264 1.8.2.2 wrstuden tx_bus_reset()
265 1.8.2.2 wrstuden {
266 1.8.2.2 wrstuden /* hpcmips port don't use */
267 1.8.2.2 wrstuden }
268 1.8.2.2 wrstuden
269 1.8.2.2 wrstuden void
270 1.8.2.2 wrstuden tx_cons_init()
271 1.8.2.2 wrstuden {
272 1.8.2.2 wrstuden int slot;
273 1.8.2.2 wrstuden #define CONSPLATIDMATCH(p) \
274 1.8.2.2 wrstuden platid_match(&platid, &platid_mask_MACH_##p)
275 1.8.2.2 wrstuden
276 1.8.2.2 wrstuden #ifdef SERIALCONSSLOT
277 1.8.2.2 wrstuden slot = SERIALCONSSLOT;
278 1.8.2.2 wrstuden #else
279 1.8.2.2 wrstuden slot = TX39_UARTA;
280 1.8.2.2 wrstuden #endif
281 1.8.2.2 wrstuden if (bootinfo->bi_cnuse & BI_CNUSE_SERIAL) {
282 1.8.2.2 wrstuden if(txcom_cnattach(slot, CONSPEED,
283 1.8.2.2 wrstuden (TTYDEF_CFLAG & ~(CSIZE | PARENB)) |
284 1.8.2.2 wrstuden CS8)) {
285 1.8.2.2 wrstuden panic("tx_cons_init: can't attach serial console.");
286 1.8.2.2 wrstuden }
287 1.8.2.2 wrstuden } else {
288 1.8.2.2 wrstuden #if NP7416BUF > 0
289 1.8.2.2 wrstuden if(CONSPLATIDMATCH(COMPAQ_C) &&
290 1.8.2.2 wrstuden p7416buf_cnattach(TX39_SYSADDR_CS3)) {
291 1.8.2.2 wrstuden panic("tx_cons_init: can't init console");
292 1.8.2.2 wrstuden }
293 1.8.2.2 wrstuden #endif
294 1.8.2.2 wrstuden #if NM38813C > 0
295 1.8.2.2 wrstuden if(CONSPLATIDMATCH(VICTOR_INTERLINK) &&
296 1.8.2.2 wrstuden m38813c_cnattach(TX39_SYSADDR_CARD1)) {
297 1.8.2.2 wrstuden panic("tx_cons_init: can't init console");
298 1.8.2.2 wrstuden }
299 1.8.2.2 wrstuden #endif
300 1.8.2.2 wrstuden #if NTC5165BUF > 0
301 1.8.2.2 wrstuden if(CONSPLATIDMATCH(SHARP_TELIOS) &&
302 1.8.2.2 wrstuden tc5165buf_cnattach(TX39_SYSADDR_CS1)) {
303 1.8.2.2 wrstuden panic("tx_cons_init: can't init console");
304 1.8.2.2 wrstuden }
305 1.8.2.2 wrstuden #endif
306 1.8.2.2 wrstuden }
307 1.8.2.2 wrstuden
308 1.8.2.2 wrstuden }
309 1.8.2.2 wrstuden
310 1.8.2.2 wrstuden void
311 1.8.2.2 wrstuden tx_device_register(dev, aux)
312 1.8.2.2 wrstuden struct device *dev;
313 1.8.2.2 wrstuden void *aux;
314 1.8.2.2 wrstuden {
315 1.8.2.2 wrstuden /* hpcmips port don't use */
316 1.8.2.2 wrstuden }
317 1.8.2.2 wrstuden
318 1.8.2.2 wrstuden void
319 1.8.2.2 wrstuden tx_conf_register_intr(t, intrt)
320 1.8.2.2 wrstuden tx_chipset_tag_t t;
321 1.8.2.2 wrstuden void *intrt;
322 1.8.2.2 wrstuden {
323 1.8.2.2 wrstuden if (tx_chipset.tc_intrt) {
324 1.8.2.2 wrstuden panic("duplicate intrt");
325 1.8.2.2 wrstuden }
326 1.8.2.2 wrstuden
327 1.8.2.2 wrstuden if (t != &tx_chipset) {
328 1.8.2.2 wrstuden panic("bogus tx_chipset_tag");
329 1.8.2.2 wrstuden }
330 1.8.2.2 wrstuden
331 1.8.2.2 wrstuden tx_chipset.tc_intrt = intrt;
332 1.8.2.2 wrstuden }
333 1.8.2.2 wrstuden
334 1.8.2.2 wrstuden #ifdef TX39_PREFER_FUNCTION
335 1.8.2.2 wrstuden tx_chipset_tag_t
336 1.8.2.2 wrstuden tx_conf_get_tag()
337 1.8.2.2 wrstuden {
338 1.8.2.2 wrstuden return (tx_chipset_tag_t)&tx_chipset;
339 1.8.2.2 wrstuden }
340 1.8.2.2 wrstuden
341 1.8.2.2 wrstuden txreg_t
342 1.8.2.2 wrstuden tx_conf_read(t, reg)
343 1.8.2.2 wrstuden tx_chipset_tag_t t;
344 1.8.2.2 wrstuden int reg;
345 1.8.2.2 wrstuden {
346 1.8.2.2 wrstuden return *((txreg_t*)(TX39_SYSADDR_CONFIG_REG_KSEG1 + reg));
347 1.8.2.2 wrstuden }
348 1.8.2.2 wrstuden
349 1.8.2.2 wrstuden void
350 1.8.2.2 wrstuden tx_conf_write(t, reg, val)
351 1.8.2.2 wrstuden tx_chipset_tag_t t;
352 1.8.2.2 wrstuden int reg;
353 1.8.2.2 wrstuden txreg_t val;
354 1.8.2.2 wrstuden {
355 1.8.2.2 wrstuden *((txreg_t*)(TX39_SYSADDR_CONFIG_REG_KSEG1 + reg)) = val;
356 1.8.2.2 wrstuden }
357 1.8.2.2 wrstuden #endif /* TX39_PREFER_FUNCTION */
358 1.8.2.2 wrstuden
359 1.8.2.2 wrstuden int
360 1.8.2.2 wrstuden __is_set_print(reg, mask, name)
361 1.8.2.2 wrstuden u_int32_t reg;
362 1.8.2.2 wrstuden int mask;
363 1.8.2.2 wrstuden char *name;
364 1.8.2.2 wrstuden {
365 1.8.2.2 wrstuden if (reg & mask) {
366 1.8.2.2 wrstuden printf("%s ", name);
367 1.8.2.2 wrstuden return 1;
368 1.8.2.2 wrstuden }
369 1.8.2.2 wrstuden return 0;
370 1.8.2.2 wrstuden }
371