| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ncr.c,v 1.49 2018/09/03 16:29:28 riastradh Exp $ */ | | 1 | /* $NetBSD: ncr.c,v 1.49.4.1 2020/03/23 10:06:26 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1996 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1996 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Adam Glass, David Jones, Gordon W. Ross, and Jens A. Nilsson. | | 8 | * by Adam Glass, David Jones, Gordon W. Ross, and Jens A. Nilsson. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -32,27 +32,27 @@ | | | @@ -32,27 +32,27 @@ |
32 | /* | | 32 | /* |
33 | * This file contains the machine-dependent parts of the NCR-5380 | | 33 | * This file contains the machine-dependent parts of the NCR-5380 |
34 | * controller. The machine-independent parts are in ncr5380sbc.c. | | 34 | * controller. The machine-independent parts are in ncr5380sbc.c. |
35 | * | | 35 | * |
36 | * Jens A. Nilsson. | | 36 | * Jens A. Nilsson. |
37 | * | | 37 | * |
38 | * Credits: | | 38 | * Credits: |
39 | * | | 39 | * |
40 | * This code is based on arch/sun3/dev/si* | | 40 | * This code is based on arch/sun3/dev/si* |
41 | * Written by David Jones, Gordon Ross, and Adam Glass. | | 41 | * Written by David Jones, Gordon Ross, and Adam Glass. |
42 | */ | | 42 | */ |
43 | | | 43 | |
44 | #include <sys/cdefs.h> | | 44 | #include <sys/cdefs.h> |
45 | __KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49 2018/09/03 16:29:28 riastradh Exp $"); | | 45 | __KERNEL_RCSID(0, "$NetBSD: ncr.c,v 1.49.4.1 2020/03/23 10:06:26 martin Exp $"); |
46 | | | 46 | |
47 | #include <sys/param.h> | | 47 | #include <sys/param.h> |
48 | #include <sys/systm.h> | | 48 | #include <sys/systm.h> |
49 | #include <sys/buf.h> | | 49 | #include <sys/buf.h> |
50 | #include <sys/bus.h> | | 50 | #include <sys/bus.h> |
51 | #include <sys/cpu.h> | | 51 | #include <sys/cpu.h> |
52 | #include <sys/device.h> | | 52 | #include <sys/device.h> |
53 | #include <sys/errno.h> | | 53 | #include <sys/errno.h> |
54 | #include <sys/kernel.h> | | 54 | #include <sys/kernel.h> |
55 | #include <sys/malloc.h> | | 55 | #include <sys/malloc.h> |
56 | #include <sys/proc.h> | | 56 | #include <sys/proc.h> |
57 | | | 57 | |
58 | #include <dev/scsipi/scsi_all.h> | | 58 | #include <dev/scsipi/scsi_all.h> |
| @@ -265,27 +265,31 @@ si_dma_alloc(struct ncr5380_softc *ncr_s | | | @@ -265,27 +265,31 @@ si_dma_alloc(struct ncr5380_softc *ncr_s |
265 | * have as many PDMA handles as the driver has processes. | | 265 | * have as many PDMA handles as the driver has processes. |
266 | * (instances?) | | 266 | * (instances?) |
267 | */ | | 267 | */ |
268 | for (i = 0; i < SCI_OPENINGS; i++) { | | 268 | for (i = 0; i < SCI_OPENINGS; i++) { |
269 | if ((sc->ncr_dma[i].dh_flags & SIDH_BUSY) == 0) | | 269 | if ((sc->ncr_dma[i].dh_flags & SIDH_BUSY) == 0) |
270 | goto found; | | 270 | goto found; |
271 | } | | 271 | } |
272 | panic("sbc: no free PDMA handles"); | | 272 | panic("sbc: no free PDMA handles"); |
273 | found: | | 273 | found: |
274 | dh = &sc->ncr_dma[i]; | | 274 | dh = &sc->ncr_dma[i]; |
275 | dh->dh_flags = SIDH_BUSY; | | 275 | dh->dh_flags = SIDH_BUSY; |
276 | dh->dh_addr = ncr_sc->sc_dataptr; | | 276 | dh->dh_addr = ncr_sc->sc_dataptr; |
277 | dh->dh_len = xlen; | | 277 | dh->dh_len = xlen; |
278 | dh->dh_proc = xs->bp->b_proc; | | 278 | if (((vaddr_t)ncr_sc->sc_dataptr & KERNBASE) == 0) { |
| | | 279 | if (xs->bp == NULL) |
| | | 280 | panic("si_dma_alloc"); |
| | | 281 | dh->dh_proc = xs->bp->b_proc; |
| | | 282 | } |
279 | | | 283 | |
280 | /* Remember dest buffer parameters */ | | 284 | /* Remember dest buffer parameters */ |
281 | if (xs->xs_control & XS_CTL_DATA_OUT) | | 285 | if (xs->xs_control & XS_CTL_DATA_OUT) |
282 | dh->dh_flags |= SIDH_OUT; | | 286 | dh->dh_flags |= SIDH_OUT; |
283 | | | 287 | |
284 | sr->sr_dma_hand = dh; | | 288 | sr->sr_dma_hand = dh; |
285 | } | | 289 | } |
286 | | | 290 | |
287 | void | | 291 | void |
288 | si_dma_free(struct ncr5380_softc *ncr_sc) | | 292 | si_dma_free(struct ncr5380_softc *ncr_sc) |
289 | { | | 293 | { |
290 | struct sci_req *sr = ncr_sc->sc_current; | | 294 | struct sci_req *sr = ncr_sc->sc_current; |
291 | struct si_dma_handle *dh = sr->sr_dma_hand; | | 295 | struct si_dma_handle *dh = sr->sr_dma_hand; |