Sat Nov 21 22:37:11 2020 UTC ()
malloc(9) -> kmem(9)


(thorpej)
diff -r1.35 -r1.36 src/sys/arch/vax/uba/qv.c
diff -r1.2 -r1.3 src/sys/arch/vax/uba/qvkbd.c
diff -r1.35 -r1.36 src/sys/arch/vax/vax/bus_dma.c
diff -r1.35 -r1.36 src/sys/arch/vax/vax/multicpu.c
diff -r1.4 -r1.5 src/sys/arch/vax/vsa/lcg.c
diff -r1.58 -r1.59 src/sys/arch/vax/vsa/smg.c
diff -r1.9 -r1.10 src/sys/arch/vax/vsa/spx.c

cvs diff -r1.35 -r1.36 src/sys/arch/vax/uba/qv.c (expand / switch to unified diff)

--- src/sys/arch/vax/uba/qv.c 2020/06/14 01:40:06 1.35
+++ src/sys/arch/vax/uba/qv.c 2020/11/21 22:37:11 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: qv.c,v 1.35 2020/06/14 01:40:06 chs Exp $ */ 1/* $NetBSD: qv.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $ */
2/* 2/*
3 * Copyright (c) 2015 Charles H. Dickman. All rights reserved. 3 * Copyright (c) 2015 Charles H. Dickman. All rights reserved.
4 * Derived from smg.c 4 * Derived from smg.c
5 * Copyright (c) 1998 Ludd, University of Lule}, Sweden. 5 * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -21,36 +21,36 @@ @@ -21,36 +21,36 @@
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30/* 1 2 3 4 5 6 7 */ 30/* 1 2 3 4 5 6 7 */
31/*3456789012345678901234567890123456789012345678901234567890123456789012345678*/ 31/*3456789012345678901234567890123456789012345678901234567890123456789012345678*/
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: qv.c,v 1.35 2020/06/14 01:40:06 chs Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: qv.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $");
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/callout.h> 38#include <sys/callout.h>
39#include <sys/conf.h> 39#include <sys/conf.h>
40#include <sys/cpu.h> 40#include <sys/cpu.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/kernel.h> 42#include <sys/kernel.h>
43#include <sys/malloc.h> 43#include <sys/kmem.h>
44#include <sys/extent.h> /***/ 44#include <sys/extent.h> /***/
45#include <sys/time.h> 45#include <sys/time.h>
46#include <sys/bus.h> 46#include <sys/bus.h>
47#include <vax/include/pte.h> /* temporary */ 47#include <vax/include/pte.h> /* temporary */
48#include <machine/sid.h> 48#include <machine/sid.h>
49#include <dev/cons.h> 49#include <dev/cons.h>
50#include <dev/qbus/ubavar.h> 50#include <dev/qbus/ubavar.h>
51#include <dev/wscons/wsdisplayvar.h> 51#include <dev/wscons/wsdisplayvar.h>
52#include <dev/wscons/wsconsio.h> 52#include <dev/wscons/wsconsio.h>
53#include <dev/wscons/wscons_callbacks.h> 53#include <dev/wscons/wscons_callbacks.h>
54#include <dev/wsfont/wsfont.h> 54#include <dev/wsfont/wsfont.h>
55#include <dev/wsfb/genfbvar.h> 55#include <dev/wsfb/genfbvar.h>
56#include <vax/include/sgmap.h> /***/ 56#include <vax/include/sgmap.h> /***/
@@ -890,43 +890,43 @@ qv_mmap(void *v, void *vs, off_t offset, @@ -890,43 +890,43 @@ qv_mmap(void *v, void *vs, off_t offset,
890 return (sc->sc_fbphys) >> PGSHIFT; 890 return (sc->sc_fbphys) >> PGSHIFT;
891} 891}
892 892
893/* 893/*
894 * emulop allocate screen 894 * emulop allocate screen
895 */ 895 */
896int 896int
897qv_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, 897qv_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
898 int *curxp, int *curyp, long *defattrp) 898 int *curxp, int *curyp, long *defattrp)
899{ 899{
900 struct qv_softc *sc = device_private(v); 900 struct qv_softc *sc = device_private(v);
901 struct qv_screen *ss; 901 struct qv_screen *ss;
902 902
903 ss = malloc(sizeof(struct qv_screen), M_DEVBUF, M_WAITOK|M_ZERO); 903 ss = kmem_zalloc(sizeof(struct qv_screen), KM_SLEEP);
904 ss->ss_sc = sc; 904 ss->ss_sc = sc;
905 ss->ss_type = type; 905 ss->ss_type = type;
906 *cookiep = ss; 906 *cookiep = ss;
907 *curxp = *curyp = *defattrp = 0; 907 *curxp = *curyp = *defattrp = 0;
908 printf("qv_alloc_screen: \"%s\" %p\n", type->name, ss); 908 printf("qv_alloc_screen: \"%s\" %p\n", type->name, ss);
909 return 0; 909 return 0;
910} 910}
911 911
912/* 912/*
913 * emulop free screen 913 * emulop free screen
914 */ 914 */
915void 915void
916qv_free_screen(void *v, void *cookie) 916qv_free_screen(void *v, void *cookie)
917{ 917{
918 printf("qv_free_screen: %p\n", cookie); 918 printf("qv_free_screen: %p\n", cookie);
919 free(cookie, M_DEVBUF); 919 kmem_free(cookie, sizeof(struct qv_screen));
920} 920}
921 921
922/* 922/*
923 * emulop show screen 923 * emulop show screen
924 */ 924 */
925int 925int
926qv_show_screen(void *v, void *cookie, int waitok, 926qv_show_screen(void *v, void *cookie, int waitok,
927 void (*cb)(void *, int, int), void *cbarg) 927 void (*cb)(void *, int, int), void *cbarg)
928{ 928{
929 struct qv_screen *ss = cookie; 929 struct qv_screen *ss = cookie;
930 const struct _wsscreen_descr *descr; 930 const struct _wsscreen_descr *descr;
931 int row, col, line; 931 int row, col, line;
932 printf("qv_show_screen: %p\n", cookie); 932 printf("qv_show_screen: %p\n", cookie);

cvs diff -r1.2 -r1.3 src/sys/arch/vax/uba/qvkbd.c (expand / switch to unified diff)

--- src/sys/arch/vax/uba/qvkbd.c 2019/11/10 21:16:33 1.2
+++ src/sys/arch/vax/uba/qvkbd.c 2020/11/21 22:37:11 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: qvkbd.c,v 1.2 2019/11/10 21:16:33 chs Exp $ */ 1/* $NetBSD: qvkbd.c,v 1.3 2020/11/21 22:37:11 thorpej Exp $ */
2 2
3/* Copyright (c) 2015 Charles H. Dickman. All rights reserved. 3/* Copyright (c) 2015 Charles H. Dickman. All rights reserved.
4 * Derived from dzkbd.c 4 * Derived from dzkbd.c
5 * 5 *
6 * Copyright (c) 1992, 1993 6 * Copyright (c) 1992, 1993
7 * The Regents of the University of California. All rights reserved. 7 * The Regents of the University of California. All rights reserved.
8 * 8 *
9 * This software was developed by the Computer Systems Engineering group 9 * This software was developed by the Computer Systems Engineering group
10 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 10 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
11 * contributed to Berkeley. 11 * contributed to Berkeley.
12 * 12 *
13 * All advertising materials mentioning features or use of this software 13 * All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement: 14 * must display the following acknowledgement:
@@ -44,27 +44,27 @@ @@ -44,27 +44,27 @@
44 44
45/* 45/*
46 * LK200/LK400 keyboard attached to line 0 of the QVSS aux port 46 * LK200/LK400 keyboard attached to line 0 of the QVSS aux port
47 */ 47 */
48 48
49#include <sys/cdefs.h> 49#include <sys/cdefs.h>
50__KERNEL_RCSID(0, "$$"); 50__KERNEL_RCSID(0, "$$");
51 51
52#include <sys/param.h> 52#include <sys/param.h>
53#include <sys/systm.h> 53#include <sys/systm.h>
54#include <sys/device.h> 54#include <sys/device.h>
55#include <sys/ioctl.h> 55#include <sys/ioctl.h>
56#include <sys/syslog.h> 56#include <sys/syslog.h>
57#include <sys/malloc.h> 57#include <sys/kmem.h>
58#include <sys/intr.h> 58#include <sys/intr.h>
59 59
60#include <dev/wscons/wsconsio.h> 60#include <dev/wscons/wsconsio.h>
61#include <dev/wscons/wskbdvar.h> 61#include <dev/wscons/wskbdvar.h>
62#include <dev/wscons/wsksymdef.h> 62#include <dev/wscons/wsksymdef.h>
63#include <dev/wscons/wsksymvar.h> 63#include <dev/wscons/wsksymvar.h>
64#include <dev/dec/wskbdmap_lk201.h> 64#include <dev/dec/wskbdmap_lk201.h>
65 65
66#include <sys/bus.h> 66#include <sys/bus.h>
67 67
68#include <vax/uba/qvareg.h> 68#include <vax/uba/qvareg.h>
69#include <vax/uba/qvavar.h> 69#include <vax/uba/qvavar.h>
70#include <vax/uba/qvkbdvar.h> 70#include <vax/uba/qvkbdvar.h>
@@ -161,28 +161,27 @@ qvkbd_attach(device_t parent, device_t s @@ -161,28 +161,27 @@ qvkbd_attach(device_t parent, device_t s
161 struct qvkbd_internal *qvi; 161 struct qvkbd_internal *qvi;
162 struct wskbddev_attach_args a; 162 struct wskbddev_attach_args a;
163 int isconsole; 163 int isconsole;
164 164
165 qvaux->sc_qvaux[daa->daa_line].qvaux_catch = qvkbd_input; 165 qvaux->sc_qvaux[daa->daa_line].qvaux_catch = qvkbd_input;
166 qvaux->sc_qvaux[daa->daa_line].qvaux_private = qvkbd; 166 qvaux->sc_qvaux[daa->daa_line].qvaux_private = qvkbd;
167 ls = &qvaux->sc_qvaux[daa->daa_line]; 167 ls = &qvaux->sc_qvaux[daa->daa_line];
168 168
169 isconsole = (daa->daa_flags & QVAUXKBD_CONSOLE); 169 isconsole = (daa->daa_flags & QVAUXKBD_CONSOLE);
170 170
171 if (isconsole) { 171 if (isconsole) {
172 qvi = &qvkbd_console_internal; 172 qvi = &qvkbd_console_internal;
173 } else { 173 } else {
174 qvi = malloc(sizeof(struct qvkbd_internal), 174 qvi = kmem_alloc(sizeof(struct qvkbd_internal), KM_SLEEP);
175 M_DEVBUF, M_WAITOK); 
176 qvi->qvi_ks.attmt.sendchar = qvkbd_sendchar; 175 qvi->qvi_ks.attmt.sendchar = qvkbd_sendchar;
177 qvi->qvi_ks.attmt.cookie = ls; 176 qvi->qvi_ks.attmt.cookie = ls;
178 } 177 }
179 qvi->qvi_ls = ls; 178 qvi->qvi_ls = ls;
180 qvkbd->sc_itl = qvi; 179 qvkbd->sc_itl = qvi;
181 180
182 printf("\n"); 181 printf("\n");
183 182
184 if (!isconsole) { 183 if (!isconsole) {
185 DELAY(100000); 184 DELAY(100000);
186 lk201_init(&qvi->qvi_ks); 185 lk201_init(&qvi->qvi_ks);
187 } 186 }
188 187

cvs diff -r1.35 -r1.36 src/sys/arch/vax/vax/bus_dma.c (expand / switch to unified diff)

--- src/sys/arch/vax/vax/bus_dma.c 2018/04/27 07:53:07 1.35
+++ src/sys/arch/vax/vax/bus_dma.c 2020/11/21 22:37:11 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bus_dma.c,v 1.35 2018/04/27 07:53:07 maxv Exp $ */ 1/* $NetBSD: bus_dma.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996, 1997, 1998 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 Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center. 9 * NASA Ames Research Center.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -25,94 +25,99 @@ @@ -25,94 +25,99 @@
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE. 30 * POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32/* 32/*
33 * bus_dma routines for vax. File copied from arm32/bus_dma.c. 33 * bus_dma routines for vax. File copied from arm32/bus_dma.c.
34 * NetBSD: bus_dma.c,v 1.11 1998/09/21 22:53:35 thorpej Exp 34 * NetBSD: bus_dma.c,v 1.11 1998/09/21 22:53:35 thorpej Exp
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.35 2018/04/27 07:53:07 maxv Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/systm.h> 41#include <sys/systm.h>
42#include <sys/kernel.h> 42#include <sys/kernel.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
44#include <sys/buf.h> 44#include <sys/buf.h>
45#include <sys/reboot.h> 45#include <sys/reboot.h>
46#include <sys/conf.h> 46#include <sys/conf.h>
47#include <sys/file.h> 47#include <sys/file.h>
48#include <sys/malloc.h> 48#include <sys/kmem.h>
49#include <sys/mbuf.h> 49#include <sys/mbuf.h>
50#include <sys/vnode.h> 50#include <sys/vnode.h>
51#include <sys/device.h> 51#include <sys/device.h>
52 52
53#include <uvm/uvm.h> 53#include <uvm/uvm.h>
54 54
55#define _VAX_BUS_DMA_PRIVATE 55#define _VAX_BUS_DMA_PRIVATE
56#include <machine/bus.h> 56#include <machine/bus.h>
57 57
58#include <machine/ka43.h> 58#include <machine/ka43.h>
59#include <machine/sid.h> 59#include <machine/sid.h>
60 60
61extern paddr_t avail_start, avail_end; 61extern paddr_t avail_start, avail_end;
62extern vaddr_t virtual_avail; 62extern vaddr_t virtual_avail;
63 63
64int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *, 64int _bus_dmamap_load_buffer(bus_dma_tag_t, bus_dmamap_t, void *,
65 bus_size_t, struct vmspace *, int, vaddr_t *, int *, bool); 65 bus_size_t, struct vmspace *, int, vaddr_t *, int *, bool);
66int _bus_dma_inrange(bus_dma_segment_t *, int, bus_addr_t); 66int _bus_dma_inrange(bus_dma_segment_t *, int, bus_addr_t);
67int _bus_dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t, 67int _bus_dmamem_alloc_range(bus_dma_tag_t, bus_size_t, bus_size_t,
68 bus_size_t, bus_dma_segment_t*, int, int *, int, vaddr_t, vaddr_t); 68 bus_size_t, bus_dma_segment_t*, int, int *, int, vaddr_t, vaddr_t);
 69
 70static size_t
 71_bus_dmamap_mapsize(int const nsegments)
 72{
 73 KASSERT(nsegments > 0);
 74 return sizeof(struct vax_bus_dmamap) +
 75 (sizeof(bus_dma_segment_t) * (nsegments - 1));
 76}
 77
69/* 78/*
70 * Common function for DMA map creation. May be called by bus-specific 79 * Common function for DMA map creation. May be called by bus-specific
71 * DMA map creation functions. 80 * DMA map creation functions.
72 */ 81 */
73int 82int
74_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments, 83_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
75 bus_size_t maxsegsz, bus_size_t boundary, int flags, 84 bus_size_t maxsegsz, bus_size_t boundary, int flags,
76 bus_dmamap_t *dmamp) 85 bus_dmamap_t *dmamp)
77{ 86{
78 struct vax_bus_dmamap *map; 87 struct vax_bus_dmamap *map;
79 void *mapstore; 88 void *mapstore;
80 size_t mapsize; 
81 89
82#ifdef DEBUG_DMA 90#ifdef DEBUG_DMA
83 printf("dmamap_create: t=%p size=%lx nseg=%x msegsz=%lx boundary=%lx flags=%x\n", 91 printf("dmamap_create: t=%p size=%lx nseg=%x msegsz=%lx boundary=%lx flags=%x\n",
84 t, size, nsegments, maxsegsz, boundary, flags); 92 t, size, nsegments, maxsegsz, boundary, flags);
85#endif /* DEBUG_DMA */ 93#endif /* DEBUG_DMA */
86 94
87 /* 95 /*
88 * Allocate and initialize the DMA map. The end of the map 96 * Allocate and initialize the DMA map. The end of the map
89 * is a variable-sized array of segments, so we allocate enough 97 * is a variable-sized array of segments, so we allocate enough
90 * room for them in one shot. 98 * room for them in one shot.
91 * 99 *
92 * Note we don't preserve the WAITOK or NOWAIT flags. Preservation 100 * Note we don't preserve the WAITOK or NOWAIT flags. Preservation
93 * of ALLOCNOW notifies others that we've reserved these resources, 101 * of ALLOCNOW notifies others that we've reserved these resources,
94 * and they are not to be freed. 102 * and they are not to be freed.
95 * 103 *
96 * The bus_dmamap_t includes one bus_dma_segment_t, hence 104 * The bus_dmamap_t includes one bus_dma_segment_t, hence
97 * the (nsegments - 1). 105 * the (nsegments - 1).
98 */ 106 */
99 mapsize = sizeof(struct vax_bus_dmamap) + 107 if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
100 (sizeof(bus_dma_segment_t) * (nsegments - 1)); 108 (flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
101 if ((mapstore = malloc(mapsize, M_DMAMAP, 
102 (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) 
103 return (ENOMEM); 109 return (ENOMEM);
104 110
105 memset(mapstore, 0, mapsize); 
106 map = (struct vax_bus_dmamap *)mapstore; 111 map = (struct vax_bus_dmamap *)mapstore;
107 map->_dm_size = size; 112 map->_dm_size = size;
108 map->_dm_segcnt = nsegments; 113 map->_dm_segcnt = nsegments;
109 map->_dm_maxmaxsegsz = maxsegsz; 114 map->_dm_maxmaxsegsz = maxsegsz;
110 map->_dm_boundary = boundary; 115 map->_dm_boundary = boundary;
111 map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT); 116 map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
112 map->dm_maxsegsz = maxsegsz; 117 map->dm_maxsegsz = maxsegsz;
113 map->dm_mapsize = 0; /* no valid mappings */ 118 map->dm_mapsize = 0; /* no valid mappings */
114 map->dm_nsegs = 0; 119 map->dm_nsegs = 0;
115 120
116 *dmamp = map; 121 *dmamp = map;
117#ifdef DEBUG_DMA 122#ifdef DEBUG_DMA
118 printf("dmamap_create:map=%p\n", map); 123 printf("dmamap_create:map=%p\n", map);
@@ -125,27 +130,27 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_ @@ -125,27 +130,27 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
125 * DMA map destruction functions. 130 * DMA map destruction functions.
126 */ 131 */
127void 132void
128_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map) 133_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
129{ 134{
130 135
131#ifdef DEBUG_DMA 136#ifdef DEBUG_DMA
132 printf("dmamap_destroy: t=%p map=%p\n", t, map); 137 printf("dmamap_destroy: t=%p map=%p\n", t, map);
133#endif /* DEBUG_DMA */ 138#endif /* DEBUG_DMA */
134#ifdef DIAGNOSTIC 139#ifdef DIAGNOSTIC
135 if (map->dm_nsegs > 0) 140 if (map->dm_nsegs > 0)
136 printf("bus_dmamap_destroy() called for map with valid mappings\n"); 141 printf("bus_dmamap_destroy() called for map with valid mappings\n");
137#endif /* DIAGNOSTIC */ 142#endif /* DIAGNOSTIC */
138 free(map, M_DEVBUF); 143 kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
139} 144}
140 145
141/* 146/*
142 * Common function for loading a DMA map with a linear buffer. May 147 * Common function for loading a DMA map with a linear buffer. May
143 * be called by bus-specific DMA map load functions. 148 * be called by bus-specific DMA map load functions.
144 */ 149 */
145int 150int
146_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf, 151_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
147 bus_size_t buflen, struct proc *p, int flags) 152 bus_size_t buflen, struct proc *p, int flags)
148{ 153{
149 vaddr_t lastaddr = 0; 154 vaddr_t lastaddr = 0;
150 int seg, error; 155 int seg, error;
151 struct vmspace *vm; 156 struct vmspace *vm;

cvs diff -r1.35 -r1.36 src/sys/arch/vax/vax/multicpu.c (expand / switch to unified diff)

--- src/sys/arch/vax/vax/multicpu.c 2019/11/10 21:16:33 1.35
+++ src/sys/arch/vax/vax/multicpu.c 2020/11/21 22:37:11 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: multicpu.c,v 1.35 2019/11/10 21:16:33 chs Exp $ */ 1/* $NetBSD: multicpu.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved. 4 * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -19,34 +19,34 @@ @@ -19,34 +19,34 @@
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27/* 27/*
28 * CPU-type independent code to spin up other VAX CPU's. 28 * CPU-type independent code to spin up other VAX CPU's.
29 */ 29 */
30 30
31#include <sys/cdefs.h> 31#include <sys/cdefs.h>
32__KERNEL_RCSID(0, "$NetBSD: multicpu.c,v 1.35 2019/11/10 21:16:33 chs Exp $"); 32__KERNEL_RCSID(0, "$NetBSD: multicpu.c,v 1.36 2020/11/21 22:37:11 thorpej Exp $");
33 33
34#include "opt_multiprocessor.h" 34#include "opt_multiprocessor.h"
35 35
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/cpu.h> 37#include <sys/cpu.h>
38#include <sys/device.h> 38#include <sys/device.h>
39#include <sys/malloc.h> 39#include <sys/kmem.h>
40#include <sys/proc.h> 40#include <sys/proc.h>
41#include <sys/xcall.h> 41#include <sys/xcall.h>
42#include <sys/ipi.h> 42#include <sys/ipi.h>
43 43
44#include <uvm/uvm_extern.h> 44#include <uvm/uvm_extern.h>
45 45
46#include <vax/vax/gencons.h> 46#include <vax/vax/gencons.h>
47 47
48#include "ioconf.h" 48#include "ioconf.h"
49 49
50const struct cpu_mp_dep *mp_dep_call; 50const struct cpu_mp_dep *mp_dep_call;
51 51
52struct cpuq { 52struct cpuq {
@@ -58,63 +58,63 @@ struct cpuq { @@ -58,63 +58,63 @@ struct cpuq {
58SIMPLEQ_HEAD(, cpuq) cpuq = SIMPLEQ_HEAD_INITIALIZER(cpuq); 58SIMPLEQ_HEAD(, cpuq) cpuq = SIMPLEQ_HEAD_INITIALIZER(cpuq);
59 59
60extern long avail_start, avail_end; 60extern long avail_start, avail_end;
61struct cpu_info_qh cpus = SIMPLEQ_HEAD_INITIALIZER(cpus); 61struct cpu_info_qh cpus = SIMPLEQ_HEAD_INITIALIZER(cpus);
62 62
63void 63void
64cpu_boot_secondary_processors(void) 64cpu_boot_secondary_processors(void)
65{ 65{
66 struct cpuq *q; 66 struct cpuq *q;
67 67
68 while ((q = SIMPLEQ_FIRST(&cpuq))) { 68 while ((q = SIMPLEQ_FIRST(&cpuq))) {
69 SIMPLEQ_REMOVE_HEAD(&cpuq, cq_q); 69 SIMPLEQ_REMOVE_HEAD(&cpuq, cq_q);
70 (*mp_dep_call->cpu_startslave)(q->cq_ci); 70 (*mp_dep_call->cpu_startslave)(q->cq_ci);
71 free(q, M_TEMP); 71 kmem_free(q, sizeof(*q));
72 } 72 }
73} 73}
74 74
75/* 75/*
76 * Allocate a cpu_info struct and fill it in then prepare for getting 76 * Allocate a cpu_info struct and fill it in then prepare for getting
77 * started by cpu_boot_secondary_processors(). 77 * started by cpu_boot_secondary_processors().
78 */ 78 */
79void 79void
80cpu_slavesetup(device_t self, int slotid) 80cpu_slavesetup(device_t self, int slotid)
81{ 81{
82 struct cpu_info *ci; 82 struct cpu_info *ci;
83 struct cpuq *cq; 83 struct cpuq *cq;
84 struct vm_page *pg; 84 struct vm_page *pg;
85 vaddr_t istackbase; 85 vaddr_t istackbase;
86 86
87 KASSERT(device_private(self) == NULL); 87 KASSERT(device_private(self) == NULL);
88 88
89 ci = malloc(sizeof(*ci), M_DEVBUF, M_ZERO|M_WAITOK); 89 ci = kmem_zalloc(sizeof(*ci), KM_SLEEP);
90 self->dv_private = ci; 90 self->dv_private = ci;
91 ci->ci_dev = self; 91 ci->ci_dev = self;
92 ci->ci_slotid = slotid; 92 ci->ci_slotid = slotid;
93 ci->ci_cpuid = device_unit(self); 93 ci->ci_cpuid = device_unit(self);
94 94
95 /* Allocate an interrupt stack */ 95 /* Allocate an interrupt stack */
96 pg = uvm_pagealloc(NULL, 0, NULL, 0); 96 pg = uvm_pagealloc(NULL, 0, NULL, 0);
97 if (pg == NULL) 97 if (pg == NULL)
98 panic("cpu_slavesetup2"); 98 panic("cpu_slavesetup2");
99 99
100 istackbase = VM_PAGE_TO_PHYS(pg) | KERNBASE; 100 istackbase = VM_PAGE_TO_PHYS(pg) | KERNBASE;
101 kvtopte(istackbase)->pg_v = 0; /* istack safety belt */ 101 kvtopte(istackbase)->pg_v = 0; /* istack safety belt */
102 102
103 /* Populate the PCB and the cpu_info struct */ 103 /* Populate the PCB and the cpu_info struct */
104 ci->ci_istack = istackbase + PAGE_SIZE; 104 ci->ci_istack = istackbase + PAGE_SIZE;
105 SIMPLEQ_INSERT_TAIL(&cpus, ci, ci_next); 105 SIMPLEQ_INSERT_TAIL(&cpus, ci, ci_next);
106 106
107 cq = malloc(sizeof(*cq), M_TEMP, M_WAITOK|M_ZERO); 107 cq = kmem_zalloc(sizeof(*cq), KM_SLEEP);
108 cq->cq_ci = ci; 108 cq->cq_ci = ci;
109 cq->cq_dev = ci->ci_dev; 109 cq->cq_dev = ci->ci_dev;
110 SIMPLEQ_INSERT_TAIL(&cpuq, cq, cq_q); 110 SIMPLEQ_INSERT_TAIL(&cpuq, cq, cq_q);
111 111
112 mi_cpu_attach(ci); /* let the MI parts know about the new cpu */ 112 mi_cpu_attach(ci); /* let the MI parts know about the new cpu */
113} 113}
114 114
115/* 115/*
116 * Send an IPI of type type to the CPU with logical device number cpu. 116 * Send an IPI of type type to the CPU with logical device number cpu.
117 */ 117 */
118void 118void
119cpu_send_ipi(int cpu, int type) 119cpu_send_ipi(int cpu, int type)
120{ 120{

cvs diff -r1.4 -r1.5 src/sys/arch/vax/vsa/lcg.c (expand / switch to unified diff)

--- src/sys/arch/vax/vsa/lcg.c 2018/06/06 01:49:08 1.4
+++ src/sys/arch/vax/vsa/lcg.c 2020/11/21 22:37:11 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lcg.c,v 1.4 2018/06/06 01:49:08 maya Exp $ */ 1/* $NetBSD: lcg.c,v 1.5 2020/11/21 22:37:11 thorpej Exp $ */
2/* 2/*
3 * LCG accelerated framebuffer driver 3 * LCG accelerated framebuffer driver
4 * Copyright (c) 2003, 2004 Blaz Antonic 4 * Copyright (c) 2003, 2004 Blaz Antonic
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.
@@ -24,36 +24,36 @@ @@ -24,36 +24,36 @@
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31/* 31/*
32 * Resurrection and dumb framebuffer mode by Björn Johannesson 32 * Resurrection and dumb framebuffer mode by Björn Johannesson
33 * rherdware@yahoo.com in December 2014 33 * rherdware@yahoo.com in December 2014
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: lcg.c,v 1.4 2018/06/06 01:49:08 maya Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: lcg.c,v 1.5 2020/11/21 22:37:11 thorpej Exp $");
38 38
39#define LCG_NO_ACCEL 39#define LCG_NO_ACCEL
40 40
41#include <sys/param.h> 41#include <sys/param.h>
42#include <sys/device.h> 42#include <sys/device.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44#include <sys/callout.h> 44#include <sys/callout.h>
45#include <sys/time.h> 45#include <sys/time.h>
46#include <sys/malloc.h> 46#include <sys/kmem.h>
47#include <sys/conf.h> 47#include <sys/conf.h>
48#include <sys/kernel.h> 48#include <sys/kernel.h>
49#include <sys/systm.h> 49#include <sys/systm.h>
50 50
51#include <machine/vsbus.h> 51#include <machine/vsbus.h>
52#include <machine/sid.h> 52#include <machine/sid.h>
53#include <machine/cpu.h> 53#include <machine/cpu.h>
54#include <machine/lcgreg.h> 54#include <machine/lcgreg.h>
55 55
56#include <dev/cons.h> 56#include <dev/cons.h>
57 57
58#include <dev/dec/dzreg.h> 58#include <dev/dec/dzreg.h>
59#include <dev/dec/dzvar.h> 59#include <dev/dec/dzvar.h>
@@ -779,27 +779,27 @@ lcg_mmap(void *v, void *vs, off_t offset @@ -779,27 +779,27 @@ lcg_mmap(void *v, void *vs, off_t offset
779{ 779{
780 if (offset >= lcg_fb_size || offset < 0) 780 if (offset >= lcg_fb_size || offset < 0)
781 return -1; 781 return -1;
782 return (LCG_FB_ADDR + offset) >> PGSHIFT; 782 return (LCG_FB_ADDR + offset) >> PGSHIFT;
783} 783}
784 784
785int 785int
786lcg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, 786lcg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
787 int *curxp, int *curyp, long *defattrp) 787 int *curxp, int *curyp, long *defattrp)
788{ 788{
789 int i; 789 int i;
790 struct lcg_screen *ss; 790 struct lcg_screen *ss;
791 791
792 *cookiep = malloc(sizeof(struct lcg_screen), M_DEVBUF, M_WAITOK); 792 *cookiep = kmem_alloc(sizeof(struct lcg_screen), KM_SLEEP);
793 bzero(*cookiep, sizeof(struct lcg_screen)); 793 bzero(*cookiep, sizeof(struct lcg_screen));
794 *curxp = *curyp = 0; 794 *curxp = *curyp = 0;
795 *defattrp = (LCG_BG_COLOR << 4) | LCG_FG_COLOR; 795 *defattrp = (LCG_BG_COLOR << 4) | LCG_FG_COLOR;
796 ss = *cookiep; 796 ss = *cookiep;
797 for (i = 0; i < lcg_cols * lcg_rows; ++i) 797 for (i = 0; i < lcg_cols * lcg_rows; ++i)
798 ss->ss_image[i].attr = (LCG_BG_COLOR << 4) | LCG_FG_COLOR; 798 ss->ss_image[i].attr = (LCG_BG_COLOR << 4) | LCG_FG_COLOR;
799 return 0; 799 return 0;
800} 800}
801 801
802void 802void
803lcg_free_screen(void *v, void *cookie) 803lcg_free_screen(void *v, void *cookie)
804{ 804{
805} 805}

cvs diff -r1.58 -r1.59 src/sys/arch/vax/vsa/smg.c (expand / switch to unified diff)

--- src/sys/arch/vax/vsa/smg.c 2019/03/14 23:49:38 1.58
+++ src/sys/arch/vax/vsa/smg.c 2020/11/21 22:37:11 1.59
@@ -1,50 +1,50 @@ @@ -1,50 +1,50 @@
1/* $NetBSD: smg.c,v 1.58 2019/03/14 23:49:38 thorpej Exp $ */ 1/* $NetBSD: smg.c,v 1.59 2020/11/21 22:37:11 thorpej Exp $ */
2/* 2/*
3 * Copyright (c) 1998 Ludd, University of Lule}, Sweden. 3 * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.58 2019/03/14 23:49:38 thorpej Exp $"); 28__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.59 2020/11/21 22:37:11 thorpej Exp $");
29 29
30#include <sys/param.h> 30#include <sys/param.h>
31#include <sys/systm.h> 31#include <sys/systm.h>
32#include <sys/callout.h> 32#include <sys/callout.h>
33#include <sys/conf.h> 33#include <sys/conf.h>
34#include <sys/cpu.h> 34#include <sys/cpu.h>
35#include <sys/device.h> 35#include <sys/device.h>
36#include <sys/kernel.h> 36#include <sys/kernel.h>
37#include <sys/malloc.h> 37#include <sys/kmem.h>
38#include <sys/time.h> 38#include <sys/time.h>
39 39
40#include <machine/vsbus.h> 40#include <machine/vsbus.h>
41#include <machine/sid.h> 41#include <machine/sid.h>
42#include <machine/ka420.h> 42#include <machine/ka420.h>
43 43
44#include <dev/cons.h> 44#include <dev/cons.h>
45 45
46#include <dev/dec/dzreg.h> 46#include <dev/dec/dzreg.h>
47#include <dev/dec/dzvar.h> 47#include <dev/dec/dzvar.h>
48#include <dev/dec/dzkbdvar.h> 48#include <dev/dec/dzkbdvar.h>
49 49
50#include <dev/wscons/wsdisplayvar.h> 50#include <dev/wscons/wsdisplayvar.h>
@@ -522,27 +522,27 @@ smg_ioctl(void *v, void *vs, u_long cmd, @@ -522,27 +522,27 @@ smg_ioctl(void *v, void *vs, u_long cmd,
522 522
523static paddr_t 523static paddr_t
524smg_mmap(void *v, void *vs, off_t offset, int prot) 524smg_mmap(void *v, void *vs, off_t offset, int prot)
525{ 525{
526 if (offset >= SMSIZE || offset < 0) 526 if (offset >= SMSIZE || offset < 0)
527 return -1; 527 return -1;
528 return (SMADDR + offset) >> PGSHIFT; 528 return (SMADDR + offset) >> PGSHIFT;
529} 529}
530 530
531int 531int
532smg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, 532smg_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
533 int *curxp, int *curyp, long *defattrp) 533 int *curxp, int *curyp, long *defattrp)
534{ 534{
535 *cookiep = malloc(sizeof(struct smg_screen), M_DEVBUF, M_WAITOK|M_ZERO); 535 *cookiep = kmem_zalloc(sizeof(struct smg_screen), KM_SLEEP);
536 *curxp = *curyp = *defattrp = 0; 536 *curxp = *curyp = *defattrp = 0;
537 return 0; 537 return 0;
538} 538}
539 539
540void 540void
541smg_free_screen(void *v, void *cookie) 541smg_free_screen(void *v, void *cookie)
542{ 542{
543} 543}
544 544
545int 545int
546smg_show_screen(void *v, void *cookie, int waitok, 546smg_show_screen(void *v, void *cookie, int waitok,
547 void (*cb)(void *, int, int), void *cbarg) 547 void (*cb)(void *, int, int), void *cbarg)
548{ 548{

cvs diff -r1.9 -r1.10 src/sys/arch/vax/vsa/spx.c (expand / switch to unified diff)

--- src/sys/arch/vax/vsa/spx.c 2016/07/07 06:55:39 1.9
+++ src/sys/arch/vax/vsa/spx.c 2020/11/21 22:37:11 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: spx.c,v 1.9 2016/07/07 06:55:39 msaitoh Exp $ */ 1/* $NetBSD: spx.c,v 1.10 2020/11/21 22:37:11 thorpej Exp $ */
2/* 2/*
3 * SPX/LCSPX/SPXg/SPXgt accelerated framebuffer driver for NetBSD/VAX 3 * SPX/LCSPX/SPXg/SPXgt accelerated framebuffer driver for NetBSD/VAX
4 * Copyright (c) 2005 Blaz Antonic 4 * Copyright (c) 2005 Blaz Antonic
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This software contains code written by Michael L. Hitch. 7 * This software contains code written by Michael L. Hitch.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -22,35 +22,35 @@ @@ -22,35 +22,35 @@
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: spx.c,v 1.9 2016/07/07 06:55:39 msaitoh Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: spx.c,v 1.10 2020/11/21 22:37:11 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/callout.h> 39#include <sys/callout.h>
40#include <sys/conf.h> 40#include <sys/conf.h>
41#include <sys/cpu.h> 41#include <sys/cpu.h>
42#include <sys/device.h> 42#include <sys/device.h>
43#include <sys/malloc.h> 43#include <sys/kmem.h>
44#include <sys/time.h> 44#include <sys/time.h>
45 45
46#include <machine/vsbus.h> 46#include <machine/vsbus.h>
47#include <machine/sid.h> 47#include <machine/sid.h>
48#include <machine/ka420.h> 48#include <machine/ka420.h>
49 49
50#include <dev/cons.h> 50#include <dev/cons.h>
51 51
52#include <dev/dec/dzreg.h> 52#include <dev/dec/dzreg.h>
53#include <dev/dec/dzvar.h> 53#include <dev/dec/dzvar.h>
54#include <dev/dec/dzkbdvar.h> 54#include <dev/dec/dzkbdvar.h>
55 55
56#include <dev/wscons/wsdisplayvar.h> 56#include <dev/wscons/wsdisplayvar.h>
@@ -1045,42 +1045,42 @@ spx_mmap(void *v, void *vs, off_t offset @@ -1045,42 +1045,42 @@ spx_mmap(void *v, void *vs, off_t offset
1045 if (offset >= spx_fb_size || offset < 0) 1045 if (offset >= spx_fb_size || offset < 0)
1046 return -1; 1046 return -1;
1047 1047
1048 return (SPX_FB_ADDR + offset) >> PGSHIFT; 1048 return (SPX_FB_ADDR + offset) >> PGSHIFT;
1049} 1049}
1050 1050
1051static int 1051static int
1052spx_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep, 1052spx_alloc_screen(void *v, const struct wsscreen_descr *type, void **cookiep,
1053 int *curxp, int *curyp, long *defattrp) 1053 int *curxp, int *curyp, long *defattrp)
1054{ 1054{
1055 int i; 1055 int i;
1056 struct spx_screen *ss; 1056 struct spx_screen *ss;
1057 1057
1058 ss = malloc(sizeof(struct spx_screen), M_DEVBUF, M_WAITOK | M_ZERO); 1058 ss = kmem_zalloc(sizeof(struct spx_screen), KM_SLEEP);
1059 1059
1060 *cookiep = ss; 1060 *cookiep = ss;
1061 *curxp = *curyp = 0; 1061 *curxp = *curyp = 0;
1062 *defattrp = (SPX_BG_COLOR << 4) | SPX_FG_COLOR; 1062 *defattrp = (SPX_BG_COLOR << 4) | SPX_FG_COLOR;
1063 1063
1064 for (i = 0; i < spx_cols * spx_rows; ++i) 1064 for (i = 0; i < spx_cols * spx_rows; ++i)
1065 ss->ss_image[i].attr = *defattrp; 1065 ss->ss_image[i].attr = *defattrp;
1066 1066
1067 return 0; 1067 return 0;
1068} 1068}
1069 1069
1070static void 1070static void
1071spx_free_screen(void *v, void *cookie) 1071spx_free_screen(void *v, void *cookie)
1072{ 1072{
1073/* FIXME add something to actually free malloc()ed screen? */ 1073/* FIXME add something to actually free kmem_zalloc()ed screen? */
1074} 1074}
1075 1075
1076static int 1076static int
1077spx_show_screen(void *v, void *cookie, int waitok, 1077spx_show_screen(void *v, void *cookie, int waitok,
1078 void (*cb)(void *, int, int), void *cbarg) 1078 void (*cb)(void *, int, int), void *cbarg)
1079{ 1079{
1080 struct spx_screen *ss = cookie; 1080 struct spx_screen *ss = cookie;
1081 u_int row, col, attr; 1081 u_int row, col, attr;
1082 u_char c; 1082 u_char c;
1083 1083
1084 if (ss == curscr) 1084 if (ss == curscr)
1085 return (0); 1085 return (0);
1086 1086