1 1.23 andvar /* $NetBSD: hcsc.c,v 1.23 2025/05/19 06:16:24 andvar Exp $ */ 2 1.1 bjh21 3 1.1 bjh21 /* 4 1.2 bjh21 * Copyright (c) 2001 Ben Harris 5 1.1 bjh21 * Copyright (c) 1998 The NetBSD Foundation, Inc. 6 1.1 bjh21 * All rights reserved. 7 1.1 bjh21 * 8 1.1 bjh21 * This code is derived from software contributed to The NetBSD Foundation 9 1.1 bjh21 * by Mark Brinicombe of Causality Limited. 10 1.1 bjh21 * 11 1.1 bjh21 * Redistribution and use in source and binary forms, with or without 12 1.1 bjh21 * modification, are permitted provided that the following conditions 13 1.1 bjh21 * are met: 14 1.1 bjh21 * 1. Redistributions of source code must retain the above copyright 15 1.1 bjh21 * notice, this list of conditions and the following disclaimer. 16 1.1 bjh21 * 2. Redistributions in binary form must reproduce the above copyright 17 1.1 bjh21 * notice, this list of conditions and the following disclaimer in the 18 1.1 bjh21 * documentation and/or other materials provided with the distribution. 19 1.1 bjh21 * 20 1.1 bjh21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21 1.1 bjh21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 1.1 bjh21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 1.1 bjh21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 1.1 bjh21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 1.1 bjh21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 1.1 bjh21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 1.1 bjh21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 1.1 bjh21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 1.1 bjh21 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 1.1 bjh21 * POSSIBILITY OF SUCH DAMAGE. 31 1.1 bjh21 */ 32 1.2 bjh21 /* 33 1.2 bjh21 * Copyright (c) 1996, 1997 Matthias Pfaller. 34 1.2 bjh21 * All rights reserved. 35 1.2 bjh21 * 36 1.2 bjh21 * Redistribution and use in source and binary forms, with or without 37 1.2 bjh21 * modification, are permitted provided that the following conditions 38 1.2 bjh21 * are met: 39 1.2 bjh21 * 1. Redistributions of source code must retain the above copyright 40 1.2 bjh21 * notice, this list of conditions and the following disclaimer. 41 1.2 bjh21 * 2. Redistributions in binary form must reproduce the above copyright 42 1.2 bjh21 * notice, this list of conditions and the following disclaimer in the 43 1.2 bjh21 * documentation and/or other materials provided with the distribution. 44 1.2 bjh21 * 45 1.2 bjh21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 46 1.2 bjh21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 47 1.2 bjh21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 48 1.2 bjh21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 49 1.2 bjh21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 50 1.2 bjh21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 51 1.2 bjh21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 52 1.2 bjh21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 53 1.2 bjh21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 54 1.2 bjh21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 55 1.2 bjh21 */ 56 1.1 bjh21 57 1.1 bjh21 /* 58 1.1 bjh21 * HCCS 8-bit SCSI driver using the generic NCR5380 driver 59 1.6 bjh21 * 60 1.6 bjh21 * Andy Armstrong gives some details of the HCCS SCSI cards at 61 1.6 bjh21 * <URL:http://www.armlinux.org/~webmail/linux-arm/1997-08/msg00042.html>. 62 1.1 bjh21 */ 63 1.1 bjh21 64 1.8 lukem #include <sys/cdefs.h> 65 1.23 andvar __KERNEL_RCSID(0, "$NetBSD: hcsc.c,v 1.23 2025/05/19 06:16:24 andvar Exp $"); 66 1.8 lukem 67 1.1 bjh21 #include <sys/param.h> 68 1.1 bjh21 69 1.1 bjh21 #include <sys/systm.h> 70 1.1 bjh21 #include <sys/kernel.h> 71 1.1 bjh21 #include <sys/device.h> 72 1.1 bjh21 #include <sys/buf.h> 73 1.1 bjh21 #include <dev/scsipi/scsi_all.h> 74 1.1 bjh21 #include <dev/scsipi/scsipi_all.h> 75 1.1 bjh21 #include <dev/scsipi/scsiconf.h> 76 1.1 bjh21 77 1.1 bjh21 #include <dev/ic/ncr5380reg.h> 78 1.1 bjh21 #include <dev/ic/ncr5380var.h> 79 1.1 bjh21 80 1.1 bjh21 #include <machine/bootconfig.h> 81 1.1 bjh21 82 1.1 bjh21 #include <dev/podulebus/podulebus.h> 83 1.1 bjh21 #include <dev/podulebus/podules.h> 84 1.7 bjh21 #include <dev/podulebus/powerromreg.h> 85 1.1 bjh21 86 1.5 bjh21 #include <dev/podulebus/hcscreg.h> 87 1.5 bjh21 88 1.18 tsutsui int hcsc_match(device_t, cfdata_t, void *); 89 1.18 tsutsui void hcsc_attach(device_t, device_t, void *); 90 1.1 bjh21 91 1.18 tsutsui static int hcsc_pdma_in(struct ncr5380_softc *, int, int, uint8_t *); 92 1.18 tsutsui static int hcsc_pdma_out(struct ncr5380_softc *, int, int, uint8_t *); 93 1.2 bjh21 94 1.2 bjh21 95 1.1 bjh21 /* 96 1.1 bjh21 * HCCS 8-bit SCSI softc structure. 97 1.1 bjh21 * 98 1.1 bjh21 * Contains the generic ncr5380 device node, podule information and 99 1.1 bjh21 * global information required by the driver. 100 1.1 bjh21 */ 101 1.1 bjh21 102 1.1 bjh21 struct hcsc_softc { 103 1.1 bjh21 struct ncr5380_softc sc_ncr5380; 104 1.2 bjh21 bus_space_tag_t sc_pdmat; 105 1.2 bjh21 bus_space_handle_t sc_pdmah; 106 1.1 bjh21 void *sc_ih; 107 1.1 bjh21 struct evcnt sc_intrcnt; 108 1.1 bjh21 }; 109 1.1 bjh21 110 1.18 tsutsui CFATTACH_DECL_NEW(hcsc, sizeof(struct hcsc_softc), 111 1.12 thorpej hcsc_match, hcsc_attach, NULL, NULL); 112 1.1 bjh21 113 1.1 bjh21 /* 114 1.1 bjh21 * Card probe function 115 1.1 bjh21 * 116 1.1 bjh21 * Just match the manufacturer and podule ID's 117 1.1 bjh21 */ 118 1.1 bjh21 119 1.1 bjh21 int 120 1.18 tsutsui hcsc_match(device_t parent, cfdata_t cf, void *aux) 121 1.1 bjh21 { 122 1.1 bjh21 struct podulebus_attach_args *pa = aux; 123 1.1 bjh21 124 1.7 bjh21 /* Normal ROM */ 125 1.4 bjh21 if (pa->pa_product == PODULE_HCCS_IDESCSI && 126 1.4 bjh21 strncmp(pa->pa_descr, "SCSI", 4) == 0) 127 1.7 bjh21 return 1; 128 1.7 bjh21 /* PowerROM */ 129 1.7 bjh21 if (pa->pa_product == PODULE_ALSYSTEMS_SCSI && 130 1.7 bjh21 podulebus_initloader(pa) == 0 && 131 1.7 bjh21 podloader_callloader(pa, 0, 0) == PRID_HCCS_SCSI1) 132 1.4 bjh21 return 1; 133 1.4 bjh21 return 0; 134 1.1 bjh21 } 135 1.1 bjh21 136 1.1 bjh21 /* 137 1.1 bjh21 * Card attach function 138 1.1 bjh21 * 139 1.1 bjh21 */ 140 1.1 bjh21 141 1.1 bjh21 void 142 1.18 tsutsui hcsc_attach(device_t parent, device_t self, void *aux) 143 1.1 bjh21 { 144 1.17 thorpej struct hcsc_softc *sc = device_private(self); 145 1.18 tsutsui struct ncr5380_softc *ncr_sc = &sc->sc_ncr5380; 146 1.1 bjh21 struct podulebus_attach_args *pa = aux; 147 1.9 bjh21 #ifndef NCR5380_USE_BUS_SPACE 148 1.18 tsutsui uint8_t *iobase; 149 1.9 bjh21 #endif 150 1.21 chs char hi_option[sizeof(device_xname(self)) + 8]; 151 1.1 bjh21 152 1.18 tsutsui ncr_sc->sc_dev = self; 153 1.18 tsutsui ncr_sc->sc_min_dma_len = 0; 154 1.18 tsutsui ncr_sc->sc_no_disconnect = 0; 155 1.18 tsutsui ncr_sc->sc_parity_disable = 0; 156 1.18 tsutsui 157 1.18 tsutsui ncr_sc->sc_dma_alloc = NULL; 158 1.18 tsutsui ncr_sc->sc_dma_free = NULL; 159 1.18 tsutsui ncr_sc->sc_dma_poll = NULL; 160 1.18 tsutsui ncr_sc->sc_dma_setup = NULL; 161 1.18 tsutsui ncr_sc->sc_dma_start = NULL; 162 1.18 tsutsui ncr_sc->sc_dma_eop = NULL; 163 1.18 tsutsui ncr_sc->sc_dma_stop = NULL; 164 1.18 tsutsui ncr_sc->sc_intr_on = NULL; 165 1.18 tsutsui ncr_sc->sc_intr_off = NULL; 166 1.1 bjh21 167 1.1 bjh21 #ifdef NCR5380_USE_BUS_SPACE 168 1.18 tsutsui ncr_sc->sc_regt = pa->pa_fast_t; 169 1.18 tsutsui bus_space_map(ncr_sc->sc_regt, 170 1.5 bjh21 pa->pa_fast_base + HCSC_DP8490_OFFSET, 8, 0, 171 1.18 tsutsui &ncr_sc->sc_regh); 172 1.18 tsutsui ncr_sc->sci_r0 = 0; 173 1.18 tsutsui ncr_sc->sci_r1 = 1; 174 1.18 tsutsui ncr_sc->sci_r2 = 2; 175 1.18 tsutsui ncr_sc->sci_r3 = 3; 176 1.18 tsutsui ncr_sc->sci_r4 = 4; 177 1.18 tsutsui ncr_sc->sci_r5 = 5; 178 1.18 tsutsui ncr_sc->sci_r6 = 6; 179 1.18 tsutsui ncr_sc->sci_r7 = 7; 180 1.1 bjh21 #else 181 1.5 bjh21 iobase = (u_char *)pa->pa_fast_base + HCSC_DP8490_OFFSET; 182 1.18 tsutsui ncr_sc->sci_r0 = iobase + 0; 183 1.18 tsutsui ncr_sc->sci_r1 = iobase + 4; 184 1.18 tsutsui ncr_sc->sci_r2 = iobase + 8; 185 1.18 tsutsui ncr_sc->sci_r3 = iobase + 12; 186 1.18 tsutsui ncr_sc->sci_r4 = iobase + 16; 187 1.18 tsutsui ncr_sc->sci_r5 = iobase + 20; 188 1.18 tsutsui ncr_sc->sci_r6 = iobase + 24; 189 1.18 tsutsui ncr_sc->sci_r7 = iobase + 28; 190 1.1 bjh21 #endif 191 1.2 bjh21 sc->sc_pdmat = pa->pa_mod_t; 192 1.5 bjh21 bus_space_map(sc->sc_pdmat, pa->pa_mod_base + HCSC_PDMA_OFFSET, 1, 0, 193 1.5 bjh21 &sc->sc_pdmah); 194 1.1 bjh21 195 1.18 tsutsui ncr_sc->sc_rev = NCR_VARIANT_DP8490; 196 1.1 bjh21 197 1.18 tsutsui ncr_sc->sc_pio_in = hcsc_pdma_in; 198 1.18 tsutsui ncr_sc->sc_pio_out = hcsc_pdma_out; 199 1.1 bjh21 200 1.1 bjh21 /* Provide an override for the host id */ 201 1.18 tsutsui ncr_sc->sc_channel.chan_id = 7; 202 1.13 itojun snprintf(hi_option, sizeof(hi_option), "%s.hostid", 203 1.18 tsutsui device_xname(self)); 204 1.1 bjh21 (void)get_bootconf_option(boot_args, hi_option, 205 1.18 tsutsui BOOTOPT_TYPE_INT, &ncr_sc->sc_channel.chan_id); 206 1.18 tsutsui ncr_sc->sc_adapter.adapt_minphys = minphys; 207 1.1 bjh21 208 1.18 tsutsui aprint_normal(": host ID %d\n", ncr_sc->sc_channel.chan_id); 209 1.1 bjh21 210 1.1 bjh21 evcnt_attach_dynamic(&sc->sc_intrcnt, EVCNT_TYPE_INTR, NULL, 211 1.18 tsutsui device_xname(self), "intr"); 212 1.1 bjh21 sc->sc_ih = podulebus_irq_establish(pa->pa_ih, IPL_BIO, ncr5380_intr, 213 1.1 bjh21 sc, &sc->sc_intrcnt); 214 1.1 bjh21 215 1.18 tsutsui ncr5380_attach(ncr_sc); 216 1.2 bjh21 } 217 1.2 bjh21 218 1.2 bjh21 #ifndef HCSC_TSIZE_OUT 219 1.2 bjh21 #define HCSC_TSIZE_OUT 512 220 1.2 bjh21 #endif 221 1.2 bjh21 222 1.2 bjh21 #ifndef HCSC_TSIZE_IN 223 1.2 bjh21 #define HCSC_TSIZE_IN 512 224 1.2 bjh21 #endif 225 1.2 bjh21 226 1.2 bjh21 #define TIMEOUT 1000000 227 1.2 bjh21 228 1.16 perry static inline int 229 1.2 bjh21 hcsc_ready(struct ncr5380_softc *sc) 230 1.2 bjh21 { 231 1.2 bjh21 int i; 232 1.2 bjh21 233 1.2 bjh21 for (i = TIMEOUT; i > 0; i--) { 234 1.2 bjh21 if ((NCR5380_READ(sc,sci_csr) & 235 1.2 bjh21 (SCI_CSR_DREQ | SCI_CSR_PHASE_MATCH)) == 236 1.2 bjh21 (SCI_CSR_DREQ | SCI_CSR_PHASE_MATCH)) 237 1.18 tsutsui return 1; 238 1.2 bjh21 239 1.2 bjh21 if ((NCR5380_READ(sc, sci_csr) & SCI_CSR_PHASE_MATCH) == 0 || 240 1.2 bjh21 SCI_BUSY(sc) == 0) 241 1.18 tsutsui return 0; 242 1.2 bjh21 } 243 1.18 tsutsui printf("%s: ready timeout\n", device_xname(sc->sc_dev)); 244 1.18 tsutsui return 0; 245 1.2 bjh21 } 246 1.2 bjh21 247 1.2 bjh21 248 1.2 bjh21 249 1.2 bjh21 /* Return zero on success. */ 250 1.16 perry static inline void hcsc_wait_not_req(struct ncr5380_softc *sc) 251 1.2 bjh21 { 252 1.2 bjh21 int timo; 253 1.18 tsutsui 254 1.2 bjh21 for (timo = TIMEOUT; timo; timo--) { 255 1.2 bjh21 if ((NCR5380_READ(sc, sci_bus_csr) & SCI_BUS_REQ) == 0 || 256 1.2 bjh21 (NCR5380_READ(sc, sci_csr) & SCI_CSR_PHASE_MATCH) == 0 || 257 1.2 bjh21 SCI_BUSY(sc) == 0) { 258 1.2 bjh21 return; 259 1.2 bjh21 } 260 1.2 bjh21 } 261 1.18 tsutsui printf("%s: pdma not_req timeout\n", device_xname(sc->sc_dev)); 262 1.2 bjh21 } 263 1.2 bjh21 264 1.2 bjh21 static int 265 1.2 bjh21 hcsc_pdma_in(struct ncr5380_softc *ncr_sc, int phase, int datalen, 266 1.18 tsutsui uint8_t *data) 267 1.2 bjh21 { 268 1.18 tsutsui struct hcsc_softc *sc = (struct hcsc_softc *)ncr_sc; 269 1.2 bjh21 bus_space_tag_t pdmat = sc->sc_pdmat; 270 1.2 bjh21 bus_space_handle_t pdmah = sc->sc_pdmah; 271 1.2 bjh21 int s, resid, len; 272 1.2 bjh21 273 1.2 bjh21 s = splbio(); 274 1.2 bjh21 275 1.2 bjh21 NCR5380_WRITE(ncr_sc, sci_mode, 276 1.2 bjh21 NCR5380_READ(ncr_sc, sci_mode) | SCI_MODE_DMA); 277 1.2 bjh21 NCR5380_WRITE(ncr_sc, sci_irecv, 0); 278 1.2 bjh21 279 1.2 bjh21 resid = datalen; 280 1.2 bjh21 while (resid > 0) { 281 1.22 riastrad len = uimin(resid, HCSC_TSIZE_IN); 282 1.2 bjh21 if (hcsc_ready(ncr_sc) == 0) 283 1.2 bjh21 goto interrupt; 284 1.2 bjh21 bus_space_read_multi_1(pdmat, pdmah, 0, data, len); 285 1.2 bjh21 data += len; 286 1.2 bjh21 resid -= len; 287 1.2 bjh21 } 288 1.2 bjh21 289 1.2 bjh21 hcsc_wait_not_req(ncr_sc); 290 1.2 bjh21 291 1.2 bjh21 interrupt: 292 1.2 bjh21 SCI_CLR_INTR(ncr_sc); 293 1.2 bjh21 NCR5380_WRITE(ncr_sc, sci_mode, 294 1.2 bjh21 NCR5380_READ(ncr_sc, sci_mode) & ~SCI_MODE_DMA); 295 1.2 bjh21 splx(s); 296 1.2 bjh21 return datalen - resid; 297 1.2 bjh21 } 298 1.2 bjh21 299 1.2 bjh21 static int 300 1.2 bjh21 hcsc_pdma_out(struct ncr5380_softc *ncr_sc, int phase, int datalen, 301 1.18 tsutsui uint8_t *data) 302 1.2 bjh21 { 303 1.18 tsutsui struct hcsc_softc *sc = (struct hcsc_softc *)ncr_sc; 304 1.2 bjh21 bus_space_tag_t pdmat = sc->sc_pdmat; 305 1.2 bjh21 bus_space_handle_t pdmah = sc->sc_pdmah; 306 1.2 bjh21 int i, s, icmd, resid; 307 1.2 bjh21 308 1.2 bjh21 s = splbio(); 309 1.2 bjh21 icmd = NCR5380_READ(ncr_sc, sci_icmd) & SCI_ICMD_RMASK; 310 1.2 bjh21 NCR5380_WRITE(ncr_sc, sci_icmd, icmd | SCI_ICMD_DATA); 311 1.2 bjh21 NCR5380_WRITE(ncr_sc, sci_mode, 312 1.2 bjh21 NCR5380_READ(ncr_sc, sci_mode) | SCI_MODE_DMA); 313 1.2 bjh21 NCR5380_WRITE(ncr_sc, sci_dma_send, 0); 314 1.2 bjh21 315 1.2 bjh21 resid = datalen; 316 1.2 bjh21 if (hcsc_ready(ncr_sc) == 0) 317 1.2 bjh21 goto interrupt; 318 1.2 bjh21 319 1.2 bjh21 if (resid > HCSC_TSIZE_OUT) { 320 1.2 bjh21 /* 321 1.2 bjh21 * Because of the chips DMA prefetch, phase changes 322 1.2 bjh21 * etc, won't be detected until we have written at 323 1.2 bjh21 * least one byte more. We pre-write 4 bytes so 324 1.2 bjh21 * subsequent transfers will be aligned to a 4 byte 325 1.23 andvar * boundary. Assuming disconnects will only occur on 326 1.2 bjh21 * block boundaries, we then correct for the pre-write 327 1.2 bjh21 * when and if we get a phase change. If the chip had 328 1.2 bjh21 * DMA byte counting hardware, the assumption would not 329 1.2 bjh21 * be necessary. 330 1.2 bjh21 */ 331 1.2 bjh21 bus_space_write_multi_1(pdmat, pdmah, 0, data, 4); 332 1.2 bjh21 data += 4; 333 1.2 bjh21 resid -= 4; 334 1.14 perry 335 1.2 bjh21 for (; resid >= HCSC_TSIZE_OUT; resid -= HCSC_TSIZE_OUT) { 336 1.2 bjh21 if (hcsc_ready(ncr_sc) == 0) { 337 1.2 bjh21 resid += 4; /* Overshot */ 338 1.2 bjh21 goto interrupt; 339 1.2 bjh21 } 340 1.2 bjh21 bus_space_write_multi_1(pdmat, pdmah, 0, data, 341 1.2 bjh21 HCSC_TSIZE_OUT); 342 1.2 bjh21 data += HCSC_TSIZE_OUT; 343 1.2 bjh21 } 344 1.2 bjh21 if (hcsc_ready(ncr_sc) == 0) { 345 1.2 bjh21 resid += 4; /* Overshot */ 346 1.2 bjh21 goto interrupt; 347 1.2 bjh21 } 348 1.2 bjh21 } 349 1.2 bjh21 350 1.2 bjh21 if (resid) { 351 1.2 bjh21 bus_space_write_multi_1(pdmat, pdmah, 0, data, resid); 352 1.2 bjh21 resid = 0; 353 1.2 bjh21 } 354 1.2 bjh21 for (i = TIMEOUT; i > 0; i--) { 355 1.2 bjh21 if ((NCR5380_READ(ncr_sc, sci_csr) 356 1.2 bjh21 & (SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) 357 1.2 bjh21 != SCI_CSR_DREQ) 358 1.2 bjh21 break; 359 1.2 bjh21 } 360 1.2 bjh21 if (i != 0) 361 1.2 bjh21 bus_space_write_1(pdmat, pdmah, 0, 0); 362 1.2 bjh21 else 363 1.2 bjh21 printf("%s: timeout waiting for final SCI_DSR_DREQ.\n", 364 1.18 tsutsui device_xname(ncr_sc->sc_dev)); 365 1.2 bjh21 366 1.2 bjh21 hcsc_wait_not_req(ncr_sc); 367 1.2 bjh21 interrupt: 368 1.2 bjh21 SCI_CLR_INTR(ncr_sc); 369 1.2 bjh21 NCR5380_WRITE(ncr_sc, sci_mode, 370 1.2 bjh21 NCR5380_READ(ncr_sc, sci_mode) & ~SCI_MODE_DMA); 371 1.2 bjh21 NCR5380_WRITE(ncr_sc, sci_icmd, icmd); 372 1.2 bjh21 splx(s); 373 1.18 tsutsui return datalen - resid; 374 1.1 bjh21 } 375