| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: rumpdev_bus_dma.c,v 1.10 2020/11/02 18:58:06 christos Exp $ */ | | 1 | /* $NetBSD: rumpdev_bus_dma.c,v 1.11 2022/02/13 19:20:41 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2013 Antti Kantee | | 4 | * Copyright (c) 2013 Antti Kantee |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -58,42 +58,40 @@ | | | @@ -58,42 +58,40 @@ |
58 | | | 58 | |
59 | /* | | 59 | /* |
60 | * bus_dma(9) implementation which runs on top of rump kernel hypercalls. | | 60 | * bus_dma(9) implementation which runs on top of rump kernel hypercalls. |
61 | * It's essentially the same as the PowerPC implementation its based on, | | 61 | * It's essentially the same as the PowerPC implementation its based on, |
62 | * except with some indirection and PowerPC MD features removed. | | 62 | * except with some indirection and PowerPC MD features removed. |
63 | * This should/could be expected to run on x86, other archs may need | | 63 | * This should/could be expected to run on x86, other archs may need |
64 | * some cache flushing hooks. | | 64 | * some cache flushing hooks. |
65 | * | | 65 | * |
66 | * From sys/arch/powerpc/powerpc/bus_dma.c: | | 66 | * From sys/arch/powerpc/powerpc/bus_dma.c: |
67 | * NetBSD: bus_dma.c,v 1.46 2012/02/01 09:54:03 matt Exp | | 67 | * NetBSD: bus_dma.c,v 1.46 2012/02/01 09:54:03 matt Exp |
68 | */ | | 68 | */ |
69 | | | 69 | |
70 | #include <sys/cdefs.h> | | 70 | #include <sys/cdefs.h> |
71 | __KERNEL_RCSID(0, "$NetBSD: rumpdev_bus_dma.c,v 1.10 2020/11/02 18:58:06 christos Exp $"); | | 71 | __KERNEL_RCSID(0, "$NetBSD: rumpdev_bus_dma.c,v 1.11 2022/02/13 19:20:41 riastradh Exp $"); |
72 | | | 72 | |
73 | #include <sys/param.h> | | 73 | #include <sys/param.h> |
74 | #include <sys/systm.h> | | 74 | #include <sys/systm.h> |
75 | #include <sys/kernel.h> | | 75 | #include <sys/kernel.h> |
76 | #include <sys/device.h> | | 76 | #include <sys/device.h> |
77 | #include <sys/kmem.h> | | 77 | #include <sys/kmem.h> |
78 | #include <sys/proc.h> | | 78 | #include <sys/proc.h> |
79 | #include <sys/mbuf.h> | | 79 | #include <sys/mbuf.h> |
80 | #include <sys/bus.h> | | 80 | #include <sys/bus.h> |
81 | #include <sys/intr.h> | | 81 | #include <sys/intr.h> |
82 | | | 82 | |
83 | #include "pci_user.h" | | 83 | #include "pci_user.h" |
84 | | | 84 | |
85 | #define EIEIO membar_sync() | | | |
86 | | | | |
87 | int _bus_dmamap_load_buffer (bus_dma_tag_t, bus_dmamap_t, void *, | | 85 | int _bus_dmamap_load_buffer (bus_dma_tag_t, bus_dmamap_t, void *, |
88 | bus_size_t, struct vmspace *, int, paddr_t *, int *, int); | | 86 | bus_size_t, struct vmspace *, int, paddr_t *, int *, int); |
89 | | | 87 | |
90 | /* | | 88 | /* |
91 | * Common function for DMA map creation. May be called by bus-specific | | 89 | * Common function for DMA map creation. May be called by bus-specific |
92 | * DMA map creation functions. | | 90 | * DMA map creation functions. |
93 | */ | | 91 | */ |
94 | int | | 92 | int |
95 | bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments, | | 93 | bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments, |
96 | bus_size_t maxsegsz, bus_size_t boundary, int flags, | | 94 | bus_size_t maxsegsz, bus_size_t boundary, int flags, |
97 | bus_dmamap_t *dmamp) | | 95 | bus_dmamap_t *dmamp) |
98 | { | | 96 | { |
99 | bus_dmamap_t map; | | 97 | bus_dmamap_t map; |