Wed Apr 24 02:27:33 2024 UTC (15d)
_vme_space_get(): Use VM_BESTFIT.


(thorpej)
diff -r1.30 -r1.31 src/sys/dev/vme/vme.c

cvs diff -r1.30 -r1.31 src/sys/dev/vme/vme.c (expand / switch to unified diff)

--- src/sys/dev/vme/vme.c 2023/12/04 01:49:29 1.30
+++ src/sys/dev/vme/vme.c 2024/04/24 02:27:33 1.31
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: vme.c,v 1.30 2023/12/04 01:49:29 thorpej Exp $ */ 1/* $NetBSD: vme.c,v 1.31 2024/04/24 02:27:33 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.
@@ -19,27 +19,27 @@ @@ -19,27 +19,27 @@
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * 28 *
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.30 2023/12/04 01:49:29 thorpej Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: vme.c,v 1.31 2024/04/24 02:27:33 thorpej Exp $");
33 33
34#include <sys/param.h> 34#include <sys/param.h>
35#include <sys/systm.h> 35#include <sys/systm.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/malloc.h> 37#include <sys/malloc.h>
38#include <sys/vmem.h> 38#include <sys/vmem.h>
39#include <sys/bus.h> 39#include <sys/bus.h>
40 40
41#include <dev/vme/vmereg.h> 41#include <dev/vme/vmereg.h>
42#include <dev/vme/vmevar.h> 42#include <dev/vme/vmevar.h>
43 43
44static void vme_extractlocators(int*, struct vme_attach_args *); 44static void vme_extractlocators(int*, struct vme_attach_args *);
45static int vmeprint(struct vme_attach_args *, char *); 45static int vmeprint(struct vme_attach_args *, char *);
@@ -326,19 +326,19 @@ _vme_space_get(struct vmebus_softc *sc,  @@ -326,19 +326,19 @@ _vme_space_get(struct vmebus_softc *sc,
326 vmem_addr_t help; 326 vmem_addr_t help;
327 int res; 327 int res;
328 328
329 vm = vme_select_map(sc, ams); 329 vm = vme_select_map(sc, ams);
330 if (!vm) 330 if (!vm)
331 return (EINVAL); 331 return (EINVAL);
332 332
333 res = vmem_xalloc(vm, len, 333 res = vmem_xalloc(vm, len,
334 align, /* align */ 334 align, /* align */
335 0, /* phase */ 335 0, /* phase */
336 0, /* nocross */ 336 0, /* nocross */
337 VMEM_ADDR_MIN, /* minaddr */ 337 VMEM_ADDR_MIN, /* minaddr */
338 VMEM_ADDR_MAX, /* maxaddr */ 338 VMEM_ADDR_MAX, /* maxaddr */
339 VM_NOSLEEP, 339 VM_BESTFIT | VM_NOSLEEP,
340 &help); 340 &help);
341 if (!res) 341 if (!res)
342 *addr = help; 342 *addr = help;
343 return (res); 343 return (res);
344} 344}