| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: btvmeii.c,v 1.27 2023/12/05 15:58:32 thorpej Exp $ */ | | 1 | /* $NetBSD: btvmeii.c,v 1.28 2024/04/24 02:31:26 thorpej Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1999 | | 4 | * Copyright (c) 1999 |
5 | * Matthias Drochner. All rights reserved. | | 5 | * Matthias Drochner. 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. |
| @@ -22,27 +22,27 @@ | | | @@ -22,27 +22,27 @@ |
22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
26 | * SUCH DAMAGE. | | 26 | * SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | /* | | 29 | /* |
30 | * Driver for the Bit3/SBS PCI-VME adapter Model 2706. | | 30 | * Driver for the Bit3/SBS PCI-VME adapter Model 2706. |
31 | * Uses the common Tundra Universe code. | | 31 | * Uses the common Tundra Universe code. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include <sys/cdefs.h> | | 34 | #include <sys/cdefs.h> |
35 | __KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.27 2023/12/05 15:58:32 thorpej Exp $"); | | 35 | __KERNEL_RCSID(0, "$NetBSD: btvmeii.c,v 1.28 2024/04/24 02:31:26 thorpej Exp $"); |
36 | | | 36 | |
37 | #include <sys/param.h> | | 37 | #include <sys/param.h> |
38 | #include <sys/systm.h> | | 38 | #include <sys/systm.h> |
39 | #include <sys/kernel.h> | | 39 | #include <sys/kernel.h> |
40 | #include <sys/device.h> | | 40 | #include <sys/device.h> |
41 | | | 41 | |
42 | #include <dev/pci/pcireg.h> | | 42 | #include <dev/pci/pcireg.h> |
43 | #include <dev/pci/pcivar.h> | | 43 | #include <dev/pci/pcivar.h> |
44 | #include <dev/pci/pcidevs.h> | | 44 | #include <dev/pci/pcidevs.h> |
45 | | | 45 | |
46 | #include <sys/bus.h> | | 46 | #include <sys/bus.h> |
47 | #include <sys/kmem.h> | | 47 | #include <sys/kmem.h> |
48 | #include <sys/vmem.h> | | 48 | #include <sys/vmem.h> |
| @@ -318,27 +318,27 @@ b3_2706_map_vme(void *vsc, vme_addr_t vm | | | @@ -318,27 +318,27 @@ b3_2706_map_vme(void *vsc, vme_addr_t vm |
318 | vmebase = vmeaddr & ~(boundary - 1); | | 318 | vmebase = vmeaddr & ~(boundary - 1); |
319 | /* base of last mapped page */ | | 319 | /* base of last mapped page */ |
320 | vmeend = (vmeaddr + len - 1) & ~(boundary - 1); | | 320 | vmeend = (vmeaddr + len - 1) & ~(boundary - 1); |
321 | /* bytes in outgoing window required */ | | 321 | /* bytes in outgoing window required */ |
322 | maplen = vmeend - vmebase + boundary; | | 322 | maplen = vmeend - vmebase + boundary; |
323 | | | 323 | |
324 | if (vmem_xalloc(sc->vme_arena, | | 324 | if (vmem_xalloc(sc->vme_arena, |
325 | maplen, /* size */ | | 325 | maplen, /* size */ |
326 | boundary, /* align */ | | 326 | boundary, /* align */ |
327 | 0, /* phase */ | | 327 | 0, /* phase */ |
328 | 0, /* boundary */ | | 328 | 0, /* boundary */ |
329 | VMEM_ADDR_MIN, /* minaddr */ | | 329 | VMEM_ADDR_MIN, /* minaddr */ |
330 | VMEM_ADDR_MAX, /* maxaddr */ | | 330 | VMEM_ADDR_MAX, /* maxaddr */ |
331 | VM_NOSLEEP, | | 331 | VM_BESTFIT | VM_NOSLEEP, |
332 | &pcibase)) { | | 332 | &pcibase)) { |
333 | sc->windowused[wnd] = 0; | | 333 | sc->windowused[wnd] = 0; |
334 | return (ENOMEM); | | 334 | return (ENOMEM); |
335 | } | | 335 | } |
336 | | | 336 | |
337 | res = univ_pci_mapvme(&sc->univdata, wnd, vmebase, maplen, | | 337 | res = univ_pci_mapvme(&sc->univdata, wnd, vmebase, maplen, |
338 | am, datasizes, pcibase); | | 338 | am, datasizes, pcibase); |
339 | if (res) { | | 339 | if (res) { |
340 | vmem_xfree(sc->vme_arena, pcibase, maplen); | | 340 | vmem_xfree(sc->vme_arena, pcibase, maplen); |
341 | sc->windowused[wnd] = 0; | | 341 | sc->windowused[wnd] = 0; |
342 | return (res); | | 342 | return (res); |
343 | } | | 343 | } |
344 | | | 344 | |