bcm2835_bsc.c revision 1.1.4.2 1 1.1.4.2 riz /* $NetBSD: bcm2835_bsc.c,v 1.1.4.2 2013/02/13 01:36:14 riz Exp $ */
2 1.1.4.2 riz
3 1.1.4.2 riz /*
4 1.1.4.2 riz * Copyright (c) 2012 Jonathan A. Kollasch
5 1.1.4.2 riz * All rights reserved.
6 1.1.4.2 riz *
7 1.1.4.2 riz * Redistribution and use in source and binary forms, with or without
8 1.1.4.2 riz * modification, are permitted provided that the following conditions
9 1.1.4.2 riz * are met:
10 1.1.4.2 riz * 1. Redistributions of source code must retain the above copyright
11 1.1.4.2 riz * notice, this list of conditions and the following disclaimer.
12 1.1.4.2 riz * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.4.2 riz * notice, this list of conditions and the following disclaimer in the
14 1.1.4.2 riz * documentation and/or other materials provided with the distribution.
15 1.1.4.2 riz *
16 1.1.4.2 riz * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 1.1.4.2 riz * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 1.1.4.2 riz * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 1.1.4.2 riz * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 1.1.4.2 riz * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 1.1.4.2 riz * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 1.1.4.2 riz * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 1.1.4.2 riz * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 1.1.4.2 riz * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 1.1.4.2 riz * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 1.1.4.2 riz * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 1.1.4.2 riz */
28 1.1.4.2 riz
29 1.1.4.2 riz #include <sys/cdefs.h>
30 1.1.4.2 riz __KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc.c,v 1.1.4.2 2013/02/13 01:36:14 riz Exp $");
31 1.1.4.2 riz
32 1.1.4.2 riz #include <sys/param.h>
33 1.1.4.2 riz #include <sys/device.h>
34 1.1.4.2 riz #include <sys/systm.h>
35 1.1.4.2 riz #include <sys/mutex.h>
36 1.1.4.2 riz #include <sys/bus.h>
37 1.1.4.2 riz #include <sys/intr.h>
38 1.1.4.2 riz
39 1.1.4.2 riz #include <dev/i2c/i2cvar.h>
40 1.1.4.2 riz
41 1.1.4.2 riz #include <arm/broadcom/bcm_amba.h>
42 1.1.4.2 riz #include <arm/broadcom/bcm2835reg.h>
43 1.1.4.2 riz #include <arm/broadcom/bcm2835_bscreg.h>
44 1.1.4.2 riz #include <arm/broadcom/bcm2835_gpio_subr.h>
45 1.1.4.2 riz
46 1.1.4.2 riz #if defined(_KERNEL_OPT)
47 1.1.4.2 riz #include "opt_kernhist.h"
48 1.1.4.2 riz #endif
49 1.1.4.2 riz #include <sys/kernhist.h>
50 1.1.4.2 riz
51 1.1.4.2 riz KERNHIST_DECL(bsciichist);
52 1.1.4.2 riz
53 1.1.4.2 riz struct bsciic_softc {
54 1.1.4.2 riz device_t sc_dev;
55 1.1.4.2 riz bus_space_tag_t sc_iot;
56 1.1.4.2 riz bus_space_handle_t sc_ioh;
57 1.1.4.2 riz bus_size_t sc_ios;
58 1.1.4.2 riz struct i2c_controller sc_i2c;
59 1.1.4.2 riz kmutex_t sc_buslock;
60 1.1.4.2 riz void *sc_inth;
61 1.1.4.2 riz };
62 1.1.4.2 riz
63 1.1.4.2 riz static int bsciic_match(device_t, cfdata_t, void *);
64 1.1.4.2 riz static void bsciic_attach(device_t, device_t, void *);
65 1.1.4.2 riz
66 1.1.4.2 riz void bsciic_dump_regs(struct bsciic_softc * const);
67 1.1.4.2 riz
68 1.1.4.2 riz static int bsciic_acquire_bus(void *, int);
69 1.1.4.2 riz static void bsciic_release_bus(void *, int);
70 1.1.4.2 riz static int bsciic_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t,
71 1.1.4.2 riz void *, size_t, int);
72 1.1.4.2 riz
73 1.1.4.2 riz CFATTACH_DECL_NEW(bsciic, sizeof(struct bsciic_softc),
74 1.1.4.2 riz bsciic_match, bsciic_attach, NULL, NULL);
75 1.1.4.2 riz
76 1.1.4.2 riz static int
77 1.1.4.2 riz bsciic_match(device_t parent, cfdata_t match, void *aux)
78 1.1.4.2 riz {
79 1.1.4.2 riz struct amba_attach_args * const aaa = aux;
80 1.1.4.2 riz
81 1.1.4.2 riz if (strcmp(aaa->aaa_name, "bcmbsc") != 0)
82 1.1.4.2 riz return 0;
83 1.1.4.2 riz
84 1.1.4.2 riz return 1;
85 1.1.4.2 riz }
86 1.1.4.2 riz
87 1.1.4.2 riz static void
88 1.1.4.2 riz bsciic_attach(device_t parent, device_t self, void *aux)
89 1.1.4.2 riz {
90 1.1.4.2 riz struct bsciic_softc * const sc = device_private(self);
91 1.1.4.2 riz struct amba_attach_args * const aaa = aux;
92 1.1.4.2 riz struct i2cbus_attach_args iba;
93 1.1.4.2 riz u_int bscunit = ~0;
94 1.1.4.2 riz
95 1.1.4.2 riz switch (aaa->aaa_addr) {
96 1.1.4.2 riz case BCM2835_BSC0_BASE:
97 1.1.4.2 riz bscunit = 0;
98 1.1.4.2 riz break;
99 1.1.4.2 riz case BCM2835_BSC1_BASE:
100 1.1.4.2 riz bscunit = 1;
101 1.1.4.2 riz break;
102 1.1.4.2 riz }
103 1.1.4.2 riz
104 1.1.4.2 riz aprint_naive("\n");
105 1.1.4.2 riz aprint_normal(": BSC%u\n", bscunit);
106 1.1.4.2 riz
107 1.1.4.2 riz KERNHIST_INIT(bsciichist, 512);
108 1.1.4.2 riz
109 1.1.4.2 riz sc->sc_dev = self;
110 1.1.4.2 riz
111 1.1.4.2 riz mutex_init(&sc->sc_buslock, MUTEX_DEFAULT, IPL_NONE);
112 1.1.4.2 riz
113 1.1.4.2 riz sc->sc_iot = aaa->aaa_iot;
114 1.1.4.2 riz if (bus_space_map(aaa->aaa_iot, aaa->aaa_addr, aaa->aaa_size, 0,
115 1.1.4.2 riz &sc->sc_ioh) != 0) {
116 1.1.4.2 riz aprint_error_dev(sc->sc_dev, "unable to map device\n");
117 1.1.4.2 riz return;
118 1.1.4.2 riz }
119 1.1.4.2 riz sc->sc_ios = aaa->aaa_size;
120 1.1.4.2 riz
121 1.1.4.2 riz switch (aaa->aaa_addr) {
122 1.1.4.2 riz case BCM2835_BSC0_BASE:
123 1.1.4.2 riz /* SDA0 on GPIO0, SCL0 on GPIO1 */
124 1.1.4.2 riz bcm2835gpio_function_select(0, BCM2835_GPIO_ALT0);
125 1.1.4.2 riz bcm2835gpio_function_select(1, BCM2835_GPIO_ALT0);
126 1.1.4.2 riz break;
127 1.1.4.2 riz case BCM2835_BSC1_BASE:
128 1.1.4.2 riz /* SDA1 on GPIO2, SCL1 on GPIO3 */
129 1.1.4.2 riz bcm2835gpio_function_select(2, BCM2835_GPIO_ALT0);
130 1.1.4.2 riz bcm2835gpio_function_select(3, BCM2835_GPIO_ALT0);
131 1.1.4.2 riz break;
132 1.1.4.2 riz }
133 1.1.4.2 riz
134 1.1.4.2 riz /* clear FIFO, disable controller */
135 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_C, BSC_C_CLEAR_CLEAR);
136 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_S, BSC_S_CLKT |
137 1.1.4.2 riz BSC_S_ERR | BSC_S_DONE);
138 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_DIV,
139 1.1.4.2 riz __SHIFTIN(250000000/100000, BSC_DIV_CDIV)); // XXX may not be this
140 1.1.4.2 riz
141 1.1.4.2 riz sc->sc_i2c.ic_cookie = sc;
142 1.1.4.2 riz sc->sc_i2c.ic_acquire_bus = bsciic_acquire_bus;
143 1.1.4.2 riz sc->sc_i2c.ic_release_bus = bsciic_release_bus;
144 1.1.4.2 riz sc->sc_i2c.ic_exec = bsciic_exec;
145 1.1.4.2 riz
146 1.1.4.2 riz memset(&iba, 0, sizeof(iba));
147 1.1.4.2 riz
148 1.1.4.2 riz iba.iba_tag = &sc->sc_i2c;
149 1.1.4.2 riz iba.iba_type = 0;
150 1.1.4.2 riz config_found_ia(self, "i2cbus", &iba, iicbus_print);
151 1.1.4.2 riz }
152 1.1.4.2 riz
153 1.1.4.2 riz void
154 1.1.4.2 riz bsciic_dump_regs(struct bsciic_softc * const sc)
155 1.1.4.2 riz {
156 1.1.4.2 riz KERNHIST_FUNC(__func__);
157 1.1.4.2 riz KERNHIST_CALLED(bsciichist);
158 1.1.4.2 riz
159 1.1.4.2 riz KERNHIST_LOG(bsciichist, "C %08x S %08x D %08x A %08x",
160 1.1.4.2 riz bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_C),
161 1.1.4.2 riz bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S),
162 1.1.4.2 riz bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_DLEN),
163 1.1.4.2 riz bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_A)
164 1.1.4.2 riz );
165 1.1.4.2 riz }
166 1.1.4.2 riz
167 1.1.4.2 riz static int
168 1.1.4.2 riz bsciic_acquire_bus(void *v, int flags)
169 1.1.4.2 riz {
170 1.1.4.2 riz struct bsciic_softc * const sc = v;
171 1.1.4.2 riz uint32_t s;
172 1.1.4.2 riz
173 1.1.4.2 riz mutex_enter(&sc->sc_buslock);
174 1.1.4.2 riz
175 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_S, BSC_S_CLKT |
176 1.1.4.2 riz BSC_S_ERR | BSC_S_DONE);
177 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_C, BSC_C_I2CEN |
178 1.1.4.2 riz BSC_C_CLEAR_CLEAR);
179 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
180 1.1.4.2 riz KASSERT((s & BSC_S_TA) == 0);
181 1.1.4.2 riz
182 1.1.4.2 riz return 0;
183 1.1.4.2 riz }
184 1.1.4.2 riz
185 1.1.4.2 riz static void
186 1.1.4.2 riz bsciic_release_bus(void *v, int flags)
187 1.1.4.2 riz {
188 1.1.4.2 riz struct bsciic_softc * const sc = v;
189 1.1.4.2 riz
190 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_C, BSC_C_CLEAR_CLEAR);
191 1.1.4.2 riz
192 1.1.4.2 riz mutex_exit(&sc->sc_buslock);
193 1.1.4.2 riz }
194 1.1.4.2 riz
195 1.1.4.2 riz static int
196 1.1.4.2 riz bsciic_exec(void *v, i2c_op_t op, i2c_addr_t addr, const void *cmdbuf,
197 1.1.4.2 riz size_t cmdlen, void *databuf, size_t datalen, int flags)
198 1.1.4.2 riz {
199 1.1.4.2 riz KERNHIST_FUNC(__func__); KERNHIST_CALLED(bsciichist);
200 1.1.4.2 riz struct bsciic_softc * const sc = v;
201 1.1.4.2 riz uint32_t c, s, dlen, a;
202 1.1.4.2 riz uint32_t j;
203 1.1.4.2 riz uint8_t *buf;
204 1.1.4.2 riz size_t len;
205 1.1.4.2 riz size_t pos;
206 1.1.4.2 riz int error = 0;
207 1.1.4.2 riz const bool isread = I2C_OP_READ_P(op);
208 1.1.4.2 riz
209 1.1.4.2 riz flags |= I2C_F_POLL;
210 1.1.4.2 riz
211 1.1.4.2 riz #if 0
212 1.1.4.2 riz device_printf(sc->sc_dev, "exec: op %d, addr 0x%x, cmdbuf %p, "
213 1.1.4.2 riz "cmdlen %zu, databuf %p, datalen %zu, flags 0x%x\n",
214 1.1.4.2 riz op, addr, cmdbuf, cmdlen, databuf, datalen, flags);
215 1.1.4.2 riz #endif
216 1.1.4.2 riz
217 1.1.4.2 riz a = __SHIFTIN(addr, BSC_A_ADDR);
218 1.1.4.2 riz c = BSC_C_I2CEN | BSC_C_CLEAR_CLEAR;
219 1.1.4.2 riz #if notyet
220 1.1.4.2 riz c |= BSC_C_INTR | BSC_C_INTT | BSC_C_INTD;
221 1.1.4.2 riz #endif
222 1.1.4.2 riz
223 1.1.4.2 riz buf = __UNCONST(cmdbuf);
224 1.1.4.2 riz len = cmdlen;
225 1.1.4.2 riz
226 1.1.4.2 riz if (isread)
227 1.1.4.2 riz dlen = cmdlen;
228 1.1.4.2 riz else
229 1.1.4.2 riz dlen = cmdlen + datalen;
230 1.1.4.2 riz dlen = __SHIFTIN(dlen, BSC_DLEN_DLEN);
231 1.1.4.2 riz
232 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
233 1.1.4.2 riz if ((s & BSC_S_TA) != 0)
234 1.1.4.2 riz bsciic_dump_regs(sc);
235 1.1.4.2 riz KASSERT((s & BSC_S_TA) == 0);
236 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_DLEN, dlen);
237 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_A, a);
238 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_C, c | BSC_C_ST);
239 1.1.4.2 riz
240 1.1.4.2 riz do {
241 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
242 1.1.4.2 riz } while ((s & BSC_S_TA) == 0);
243 1.1.4.2 riz
244 1.1.4.2 riz flood_again:
245 1.1.4.2 riz KERNHIST_LOG(bsciichist, "flood top %p %zu", buf, len, 0, 0);
246 1.1.4.2 riz j = 10000000;
247 1.1.4.2 riz for (pos = 0; pos < len; ) {
248 1.1.4.2 riz if (--j == 0)
249 1.1.4.2 riz return -1;
250 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
251 1.1.4.2 riz KERNHIST_LOG(bsciichist, "w s %08x", s, 0, 0, 0);
252 1.1.4.2 riz if ((s & BSC_S_CLKT) != 0) {
253 1.1.4.2 riz error = EIO;
254 1.1.4.2 riz goto done;
255 1.1.4.2 riz }
256 1.1.4.2 riz if ((s & BSC_S_ERR) != 0) {
257 1.1.4.2 riz error = EIO;
258 1.1.4.2 riz goto done;
259 1.1.4.2 riz }
260 1.1.4.2 riz if ((s & BSC_S_DONE) != 0)
261 1.1.4.2 riz break;
262 1.1.4.2 riz if ((s & BSC_S_TXD) == 0)
263 1.1.4.2 riz continue;
264 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_FIFO, buf[pos]);
265 1.1.4.2 riz KERNHIST_LOG(bsciichist, "w %p %p %02x", buf, &buf[pos],
266 1.1.4.2 riz buf[pos], 0);
267 1.1.4.2 riz pos++;
268 1.1.4.2 riz }
269 1.1.4.2 riz KERNHIST_LOG(bsciichist, "flood bot %p %zu", buf, len, 0, 0);
270 1.1.4.2 riz
271 1.1.4.2 riz if (buf == cmdbuf && !isread) {
272 1.1.4.2 riz buf = databuf;
273 1.1.4.2 riz len = datalen;
274 1.1.4.2 riz goto flood_again;
275 1.1.4.2 riz }
276 1.1.4.2 riz
277 1.1.4.2 riz do {
278 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
279 1.1.4.2 riz } while ((s & BSC_S_TA) != 0);
280 1.1.4.2 riz
281 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
282 1.1.4.2 riz s &= BSC_S_CLKT|BSC_S_ERR|BSC_S_DONE;
283 1.1.4.2 riz KASSERT((s & BSC_S_DONE) != 0);
284 1.1.4.2 riz if (s != 0)
285 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_S, s);
286 1.1.4.2 riz
287 1.1.4.2 riz if (!isread)
288 1.1.4.2 riz goto done;
289 1.1.4.2 riz
290 1.1.4.2 riz c |= BSC_C_READ;
291 1.1.4.2 riz
292 1.1.4.2 riz buf = databuf;
293 1.1.4.2 riz len = datalen;
294 1.1.4.2 riz dlen = datalen;
295 1.1.4.2 riz
296 1.1.4.2 riz dlen = __SHIFTIN(dlen, BSC_DLEN_DLEN);
297 1.1.4.2 riz KASSERT(dlen >= 1);
298 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_DLEN, dlen);
299 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_A, a);
300 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_C, c | BSC_C_ST);
301 1.1.4.2 riz
302 1.1.4.2 riz do {
303 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
304 1.1.4.2 riz } while ((s & BSC_S_TA) == 0);
305 1.1.4.2 riz
306 1.1.4.2 riz KERNHIST_LOG(bsciichist, "drain top %p %zu", buf, len, 0, 0);
307 1.1.4.2 riz j = 10000000;
308 1.1.4.2 riz for (pos = 0; pos < len; ) {
309 1.1.4.2 riz if (--j == 0)
310 1.1.4.2 riz return -1;
311 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
312 1.1.4.2 riz KERNHIST_LOG(bsciichist, "r s %08x", s, 0, 0, 0);
313 1.1.4.2 riz if ((s & BSC_S_CLKT) != 0) {
314 1.1.4.2 riz error = EIO;
315 1.1.4.2 riz goto done;
316 1.1.4.2 riz }
317 1.1.4.2 riz if ((s & BSC_S_ERR) != 0) {
318 1.1.4.2 riz error = EIO;
319 1.1.4.2 riz goto done;
320 1.1.4.2 riz }
321 1.1.4.2 riz if ((s & BSC_S_DONE) != 0)
322 1.1.4.2 riz break;
323 1.1.4.2 riz if ((s & BSC_S_RXD) == 0)
324 1.1.4.2 riz continue;
325 1.1.4.2 riz j = 10000000;
326 1.1.4.2 riz buf[pos] = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_FIFO);
327 1.1.4.2 riz KERNHIST_LOG(bsciichist, "r %p %p %02x", buf, &buf[pos],
328 1.1.4.2 riz buf[pos], 0);
329 1.1.4.2 riz pos++;
330 1.1.4.2 riz }
331 1.1.4.2 riz KERNHIST_LOG(bsciichist, "drain bot %p %zu", buf, len, 0, 0);
332 1.1.4.2 riz
333 1.1.4.2 riz do {
334 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
335 1.1.4.2 riz } while ((s & BSC_S_TA) != 0);
336 1.1.4.2 riz
337 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
338 1.1.4.2 riz s &= BSC_S_CLKT|BSC_S_ERR|BSC_S_DONE;
339 1.1.4.2 riz KASSERT((s & BSC_S_DONE) != 0);
340 1.1.4.2 riz if (s != 0)
341 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_S, s);
342 1.1.4.2 riz
343 1.1.4.2 riz done:
344 1.1.4.2 riz bsciic_dump_regs(sc);
345 1.1.4.2 riz
346 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_DLEN, 0);
347 1.1.4.2 riz
348 1.1.4.2 riz do {
349 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
350 1.1.4.2 riz } while ((s & BSC_S_TA) != 0);
351 1.1.4.2 riz
352 1.1.4.2 riz bsciic_dump_regs(sc);
353 1.1.4.2 riz
354 1.1.4.2 riz s = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BSC_S);
355 1.1.4.2 riz s &= BSC_S_CLKT|BSC_S_ERR|BSC_S_DONE;
356 1.1.4.2 riz if (s != 0)
357 1.1.4.2 riz bus_space_write_4(sc->sc_iot, sc->sc_ioh, BSC_S, s);
358 1.1.4.2 riz
359 1.1.4.2 riz bsciic_dump_regs(sc);
360 1.1.4.2 riz
361 1.1.4.2 riz return error;
362 1.1.4.2 riz }
363