Sun Jan 3 17:42:10 2021 UTC ()
malloc(9) -> kmem(9)


(thorpej)
diff -r1.67 -r1.68 src/sys/arch/atari/atari/autoconf.c
diff -r1.16 -r1.17 src/sys/arch/atari/atari/be_bus.c
diff -r1.60 -r1.61 src/sys/arch/atari/atari/bus.c
diff -r1.27 -r1.28 src/sys/arch/atari/atari/intr.c
diff -r1.20 -r1.21 src/sys/arch/atari/atari/le_bus.c
diff -r1.183 -r1.184 src/sys/arch/atari/atari/machdep.c
diff -r1.12 -r1.13 src/sys/arch/atari/atari/mainbus.c
diff -r1.86 -r1.87 src/sys/arch/atari/dev/hdfd.c
diff -r1.79 -r1.80 src/sys/arch/atari/dev/ite.c
diff -r1.34 -r1.35 src/sys/arch/atari/dev/md_root.c
diff -r1.78 -r1.79 src/sys/arch/atari/dev/zs.c
diff -r1.58 -r1.59 src/sys/arch/atari/pci/pci_machdep.c

cvs diff -r1.67 -r1.68 src/sys/arch/atari/atari/autoconf.c (expand / switch to unified diff)

--- src/sys/arch/atari/atari/autoconf.c 2019/06/29 16:41:18 1.67
+++ src/sys/arch/atari/atari/autoconf.c 2021/01/03 17:42:10 1.68
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: autoconf.c,v 1.67 2019/06/29 16:41:18 tsutsui Exp $ */ 1/* $NetBSD: autoconf.c,v 1.68 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1995 Leo Weppelman 4 * Copyright (c) 1995 Leo Weppelman
5 * Copyright (c) 1994 Christian E. Hopps 5 * Copyright (c) 1994 Christian E. Hopps
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.
@@ -21,39 +21,39 @@ @@ -21,39 +21,39 @@
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.67 2019/06/29 16:41:18 tsutsui Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.68 2021/01/03 17:42:10 thorpej Exp $");
35 35
36#include "opt_md.h" 36#include "opt_md.h"
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/reboot.h> 40#include <sys/reboot.h>
41#include <sys/conf.h> 41#include <sys/conf.h>
42#include <sys/buf.h> 42#include <sys/buf.h>
43#include <sys/device.h> 43#include <sys/device.h>
44#include <sys/disklabel.h> 44#include <sys/disklabel.h>
45#include <sys/disk.h> 45#include <sys/disk.h>
46#include <sys/malloc.h> 46#include <sys/kmem.h>
47#include <machine/disklabel.h> 47#include <machine/disklabel.h>
48#include <machine/cpu.h> 48#include <machine/cpu.h>
49#include <atari/atari/device.h> 49#include <atari/atari/device.h>
50 50
51#if defined(MEMORY_DISK_HOOKS) 51#if defined(MEMORY_DISK_HOOKS)
52#include <dev/md.h> 52#include <dev/md.h>
53#endif 53#endif
54 54
55#include "ioconf.h" 55#include "ioconf.h"
56 56
57static void findroot(void); 57static void findroot(void);
58static int mbmatch(device_t, cfdata_t, void *); 58static int mbmatch(device_t, cfdata_t, void *);
59static void mbattach(device_t, device_t, void *); 59static void mbattach(device_t, device_t, void *);
@@ -95,28 +95,27 @@ cpu_rootconf(void) @@ -95,28 +95,27 @@ cpu_rootconf(void)
95 * installation md(4) ramdisk. 95 * installation md(4) ramdisk.
96 * See sys/arch/atari/dev/md_root.c for details. 96 * See sys/arch/atari/dev/md_root.c for details.
97 */ 97 */
98#define RAMD_NDEV 3 /* XXX */ 98#define RAMD_NDEV 3 /* XXX */
99 99
100 if ((boothowto & RB_ASKNAME) != 0) { 100 if ((boothowto & RB_ASKNAME) != 0) {
101 int md_major, i; 101 int md_major, i;
102 cfdata_t cf; 102 cfdata_t cf;
103 struct md_softc *sc; 103 struct md_softc *sc;
104 104
105 md_major = devsw_name2blk("md", NULL, 0); 105 md_major = devsw_name2blk("md", NULL, 0);
106 if (md_major >= 0) { 106 if (md_major >= 0) {
107 for (i = 0; i < RAMD_NDEV; i++) { 107 for (i = 0; i < RAMD_NDEV; i++) {
108 cf = malloc(sizeof(*cf), M_DEVBUF, 108 cf = kmem_zalloc(sizeof(*cf), KM_SLEEP);
109 M_ZERO|M_WAITOK); 
110 if (cf == NULL) 109 if (cf == NULL)
111 break; /* XXX */ 110 break; /* XXX */
112 cf->cf_name = md_cd.cd_name; 111 cf->cf_name = md_cd.cd_name;
113 cf->cf_atname = md_cd.cd_name; 112 cf->cf_atname = md_cd.cd_name;
114 cf->cf_unit = i; 113 cf->cf_unit = i;
115 cf->cf_fstate = FSTATE_STAR; 114 cf->cf_fstate = FSTATE_STAR;
116 /* XXX mutex */ 115 /* XXX mutex */
117 sc = device_private(config_attach_pseudo(cf)); 116 sc = device_private(config_attach_pseudo(cf));
118 if (sc == NULL) 117 if (sc == NULL)
119 break; /* XXX */ 118 break; /* XXX */
120 } 119 }
121 } 120 }
122 } 121 }

cvs diff -r1.16 -r1.17 src/sys/arch/atari/atari/be_bus.c (expand / switch to unified diff)

--- src/sys/arch/atari/atari/be_bus.c 2019/11/10 21:16:25 1.16
+++ src/sys/arch/atari/atari/be_bus.c 2021/01/03 17:42:10 1.17
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: be_bus.c,v 1.16 2019/11/10 21:16:25 chs Exp $ */ 1/* $NetBSD: be_bus.c,v 1.17 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 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 Leo Weppelman. 8 * by Leo Weppelman.
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.
@@ -20,32 +20,32 @@ @@ -20,32 +20,32 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: be_bus.c,v 1.16 2019/11/10 21:16:25 chs Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: be_bus.c,v 1.17 2021/01/03 17:42:10 thorpej Exp $");
34 34
35#include <sys/types.h> 35#include <sys/types.h>
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/malloc.h> 38#include <sys/kmem.h>
39#include <machine/cpu.h> 39#include <machine/cpu.h>
40#include <sys/bus.h> 40#include <sys/bus.h>
41 41
42/* 42/*
43 * This file contains the common functions for using a big endian (linear) 43 * This file contains the common functions for using a big endian (linear)
44 * bus on a big endian atari. 44 * bus on a big endian atari.
45 */ 45 */
46 46
47 /* Autoconf detection stuff */ 47 /* Autoconf detection stuff */
48static int beb_bus_space_peek_1(bus_space_tag_t, 48static int beb_bus_space_peek_1(bus_space_tag_t,
49 bus_space_handle_t, bus_size_t); 49 bus_space_handle_t, bus_size_t);
50static int beb_bus_space_peek_2(bus_space_tag_t, 50static int beb_bus_space_peek_2(bus_space_tag_t,
51 bus_space_handle_t, bus_size_t); 51 bus_space_handle_t, bus_size_t);
@@ -168,32 +168,32 @@ static void beb_bus_space_set_region_8( @@ -168,32 +168,32 @@ static void beb_bus_space_set_region_8(
168 168
169#define __write_1(h, o, v) *((volatile uint8_t *)((h) + (o))) = (v) 169#define __write_1(h, o, v) *((volatile uint8_t *)((h) + (o))) = (v)
170#define __write_2(h, o, v) *((volatile uint16_t *)((h) + (o))) = (v) 170#define __write_2(h, o, v) *((volatile uint16_t *)((h) + (o))) = (v)
171#define __write_4(h, o, v) *((volatile uint32_t *)((h) + (o))) = (v) 171#define __write_4(h, o, v) *((volatile uint32_t *)((h) + (o))) = (v)
172#define __write_8(h, o, v) *((volatile uint64_t *)((h) + (o))) = (v) 172#define __write_8(h, o, v) *((volatile uint64_t *)((h) + (o))) = (v)
173 173
174bus_space_tag_t 174bus_space_tag_t
175beb_alloc_bus_space_tag(bus_space_tag_t storage) 175beb_alloc_bus_space_tag(bus_space_tag_t storage)
176{ 176{
177 bus_space_tag_t beb_t; 177 bus_space_tag_t beb_t;
178 178
179 /* 179 /*
180 * Allow the caller to specify storage space for the tag. This 180 * Allow the caller to specify storage space for the tag. This
181 * is used during console config (when malloc() can't be used). 181 * is used during console config (when kmem_alloc() can't be used).
182 */ 182 */
183 if (storage != NULL) 183 if (storage != NULL)
184 beb_t = storage; 184 beb_t = storage;
185 else { 185 else {
186 beb_t = malloc(sizeof(*beb_t), M_TEMP, M_WAITOK); 186 beb_t = kmem_alloc(sizeof(*beb_t), KM_SLEEP);
187 } 187 }
188 memset(beb_t, 0, sizeof(*beb_t)); 188 memset(beb_t, 0, sizeof(*beb_t));
189  189
190 beb_t->abs_p_1 = beb_bus_space_peek_1; 190 beb_t->abs_p_1 = beb_bus_space_peek_1;
191 beb_t->abs_p_2 = beb_bus_space_peek_2; 191 beb_t->abs_p_2 = beb_bus_space_peek_2;
192 beb_t->abs_p_4 = beb_bus_space_peek_4; 192 beb_t->abs_p_4 = beb_bus_space_peek_4;
193 beb_t->abs_p_8 = beb_bus_space_peek_8; 193 beb_t->abs_p_8 = beb_bus_space_peek_8;
194 beb_t->abs_r_1 = beb_bus_space_read_1; 194 beb_t->abs_r_1 = beb_bus_space_read_1;
195 beb_t->abs_r_2 = beb_bus_space_read_2; 195 beb_t->abs_r_2 = beb_bus_space_read_2;
196 beb_t->abs_r_4 = beb_bus_space_read_4; 196 beb_t->abs_r_4 = beb_bus_space_read_4;
197 beb_t->abs_r_8 = beb_bus_space_read_8; 197 beb_t->abs_r_8 = beb_bus_space_read_8;
198 beb_t->abs_rs_1 = beb_bus_space_read_1; 198 beb_t->abs_rs_1 = beb_bus_space_read_1;
199 beb_t->abs_rs_2 = beb_bus_space_read_2; 199 beb_t->abs_rs_2 = beb_bus_space_read_2;

cvs diff -r1.60 -r1.61 src/sys/arch/atari/atari/bus.c (expand / switch to unified diff)

--- src/sys/arch/atari/atari/bus.c 2018/03/10 03:44:43 1.60
+++ src/sys/arch/atari/atari/bus.c 2021/01/03 17:42:10 1.61
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bus.c,v 1.60 2018/03/10 03:44:43 tsutsui Exp $ */ 1/* $NetBSD: bus.c,v 1.61 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 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 and by Chris G. Demetriou. 9 * NASA Ames Research Center and by Chris G. Demetriou.
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
@@ -23,32 +23,32 @@ @@ -23,32 +23,32 @@
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
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#include "opt_m68k_arch.h" 33#include "opt_m68k_arch.h"
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.60 2018/03/10 03:44:43 tsutsui Exp $"); 36__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.61 2021/01/03 17:42:10 thorpej Exp $");
37 37
38#include <sys/param.h> 38#include <sys/param.h>
39#include <sys/systm.h> 39#include <sys/systm.h>
40#include <sys/extent.h> 40#include <sys/extent.h>
41#include <sys/malloc.h> 41#include <sys/kmem.h>
42#include <sys/mbuf.h> 42#include <sys/mbuf.h>
43#include <sys/proc.h> 43#include <sys/proc.h>
44 44
45#include <uvm/uvm.h> 45#include <uvm/uvm.h>
46 46
47#include <machine/cpu.h> 47#include <machine/cpu.h>
48#include <m68k/cacheops.h> 48#include <m68k/cacheops.h>
49#define _ATARI_BUS_DMA_PRIVATE 49#define _ATARI_BUS_DMA_PRIVATE
50#include <sys/bus.h> 50#include <sys/bus.h>
51 51
52int bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size, 52int bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
53 bus_size_t alignment, bus_size_t boundary, 53 bus_size_t alignment, bus_size_t boundary,
54 bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags, 54 bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags,
@@ -320,80 +320,84 @@ bus_space_mmap(bus_space_tag_t t, bus_ad @@ -320,80 +320,84 @@ bus_space_mmap(bus_space_tag_t t, bus_ad
320 int flags) 320 int flags)
321{ 321{
322 322
323 /* 323 /*
324 * "addr" is the base address of the device we're mapping. 324 * "addr" is the base address of the device we're mapping.
325 * "off" is the offset into that device. 325 * "off" is the offset into that device.
326 * 326 *
327 * Note we are called for each "page" in the device that 327 * Note we are called for each "page" in the device that
328 * the upper layers want to map. 328 * the upper layers want to map.
329 */ 329 */
330 return m68k_btop(addr + off); 330 return m68k_btop(addr + off);
331} 331}
332 332
 333static size_t
 334_bus_dmamap_mapsize(int const nsegments)
 335{
 336 KASSERT(nsegments > 0);
 337 return sizeof(struct atari_bus_dmamap) +
 338 (sizeof(bus_dma_segment_t) * (nsegments - 1));
 339}
 340
333/* 341/*
334 * Common function for DMA map creation. May be called by bus-specific 342 * Common function for DMA map creation. May be called by bus-specific
335 * DMA map creation functions. 343 * DMA map creation functions.
336 */ 344 */
337int 345int
338_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments, 346_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
339 bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamp) 347 bus_size_t maxsegsz, bus_size_t boundary, int flags, bus_dmamap_t *dmamp)
340{ 348{
341 struct atari_bus_dmamap *map; 349 struct atari_bus_dmamap *map;
342 void *mapstore; 350 void *mapstore;
343 size_t mapsize; 
344 351
345 /* 352 /*
346 * Allocate and initialize the DMA map. The end of the map 353 * Allocate and initialize the DMA map. The end of the map
347 * is a variable-sized array of segments, so we allocate enough 354 * is a variable-sized array of segments, so we allocate enough
348 * room for them in one shot. 355 * room for them in one shot.
349 * 356 *
350 * Note we don't preserve the WAITOK or NOWAIT flags. Preservation 357 * Note we don't preserve the WAITOK or NOWAIT flags. Preservation
351 * of ALLOCNOW notifies others that we've reserved these resources, 358 * of ALLOCNOW notifies others that we've reserved these resources,
352 * and they are not to be freed. 359 * and they are not to be freed.
353 * 360 *
354 * The bus_dmamap_t includes one bus_dma_segment_t, hence 361 * The bus_dmamap_t includes one bus_dma_segment_t, hence
355 * the (nsegments - 1). 362 * the (nsegments - 1).
356 */ 363 */
357 mapsize = sizeof(struct atari_bus_dmamap) + 364 if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
358 (sizeof(bus_dma_segment_t) * (nsegments - 1)); 365 (flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
359 if ((mapstore = malloc(mapsize, M_DMAMAP, 
360 (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) 
361 return ENOMEM; 366 return ENOMEM;
362 367
363 memset(mapstore, 0, mapsize); 
364 map = (struct atari_bus_dmamap *)mapstore; 368 map = (struct atari_bus_dmamap *)mapstore;
365 map->_dm_size = size; 369 map->_dm_size = size;
366 map->_dm_segcnt = nsegments; 370 map->_dm_segcnt = nsegments;
367 map->_dm_maxmaxsegsz = maxsegsz; 371 map->_dm_maxmaxsegsz = maxsegsz;
368 map->_dm_boundary = boundary; 372 map->_dm_boundary = boundary;
369 map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT); 373 map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
370 map->dm_maxsegsz = maxsegsz; 374 map->dm_maxsegsz = maxsegsz;
371 map->dm_mapsize = 0; /* no valid mappings */ 375 map->dm_mapsize = 0; /* no valid mappings */
372 map->dm_nsegs = 0; 376 map->dm_nsegs = 0;
373 377
374 *dmamp = map; 378 *dmamp = map;
375 return 0; 379 return 0;
376} 380}
377 381
378/* 382/*
379 * Common function for DMA map destruction. May be called by bus-specific 383 * Common function for DMA map destruction. May be called by bus-specific
380 * DMA map destruction functions. 384 * DMA map destruction functions.
381 */ 385 */
382void 386void
383_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map) 387_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
384{ 388{
385 389
386 free(map, M_DMAMAP); 390 kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
387} 391}
388 392
389/* 393/*
390 * Common function for loading a DMA map with a linear buffer. May 394 * Common function for loading a DMA map with a linear buffer. May
391 * be called by bus-specific DMA map load functions. 395 * be called by bus-specific DMA map load functions.
392 */ 396 */
393int 397int
394_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf, 398_bus_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
395 bus_size_t buflen, struct proc *p, int flags) 399 bus_size_t buflen, struct proc *p, int flags)
396{ 400{
397 paddr_t lastaddr; 401 paddr_t lastaddr;
398 int seg, error; 402 int seg, error;
399 struct vmspace *vm; 403 struct vmspace *vm;

cvs diff -r1.27 -r1.28 src/sys/arch/atari/atari/intr.c (expand / switch to unified diff)

--- src/sys/arch/atari/atari/intr.c 2019/11/10 21:16:25 1.27
+++ src/sys/arch/atari/atari/intr.c 2021/01/03 17:42:10 1.28
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: intr.c,v 1.27 2019/11/10 21:16:25 chs Exp $ */ 1/* $NetBSD: intr.c,v 1.28 2021/01/03 17:42:10 thorpej 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, Gordon W. Ross, Jason R. Thorpe, and Leo Weppelman. 8 * by Adam Glass, Gordon W. Ross, Jason R. Thorpe, and Leo Weppelman.
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.
@@ -20,32 +20,32 @@ @@ -20,32 +20,32 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.27 2019/11/10 21:16:25 chs Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.28 2021/01/03 17:42:10 thorpej Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/kernel.h> 37#include <sys/kernel.h>
38#include <sys/malloc.h> 38#include <sys/kmem.h>
39#include <sys/vmmeter.h> 39#include <sys/vmmeter.h>
40#include <sys/queue.h> 40#include <sys/queue.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/cpu.h> 42#include <sys/cpu.h>
43 43
44#include <machine/intr.h> 44#include <machine/intr.h>
45 45
46#define AVEC_MIN 1 46#define AVEC_MIN 1
47#define AVEC_MAX 7 47#define AVEC_MAX 7
48#define AVEC_LOC 25 48#define AVEC_LOC 25
49#define UVEC_MIN 0 49#define UVEC_MIN 0
50#define UVEC_MAX 191 50#define UVEC_MAX 191
51#define UVEC_LOC 64 51#define UVEC_LOC 64
@@ -102,60 +102,59 @@ intr_init(void) @@ -102,60 +102,59 @@ intr_init(void)
102 * - ih_arg 102 * - ih_arg
103 * The argument given to 'ih_fun' when ARG_CLOCKFRAME is not 103 * The argument given to 'ih_fun' when ARG_CLOCKFRAME is not
104 * specified. 104 * specified.
105 */ 105 */
106 106
107struct intrhand * 107struct intrhand *
108intr_establish(int vector, int type, int pri, hw_ifun_t ih_fun, void *ih_arg) 108intr_establish(int vector, int type, int pri, hw_ifun_t ih_fun, void *ih_arg)
109{ 109{
110 struct intrhand *ih, *cur_vec; 110 struct intrhand *ih, *cur_vec;
111 ih_list_t *vec_list; 111 ih_list_t *vec_list;
112 u_long *hard_vec; 112 u_long *hard_vec;
113 int s; 113 int s;
114 114
115 /* no point in sleeping unless someone can free memory. */ 115 ih = kmem_alloc(sizeof *ih, KM_SLEEP);
116 ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); 
117 ih->ih_fun = ih_fun; 116 ih->ih_fun = ih_fun;
118 ih->ih_arg = ih_arg; 117 ih->ih_arg = ih_arg;
119 ih->ih_type = type; 118 ih->ih_type = type;
120 ih->ih_pri = pri; 119 ih->ih_pri = pri;
121 ih->ih_vector = vector; 120 ih->ih_vector = vector;
122 121
123 /* 122 /*
124 * Do some validity checking on the 'vector' argument and determine 123 * Do some validity checking on the 'vector' argument and determine
125 * vector list this interrupt should be on. 124 * vector list this interrupt should be on.
126 */ 125 */
127 switch (type & (AUTO_VEC|USER_VEC)) { 126 switch (type & (AUTO_VEC|USER_VEC)) {
128 case AUTO_VEC: 127 case AUTO_VEC:
129 if (vector < AVEC_MIN || vector > AVEC_MAX) { 128 if (vector < AVEC_MIN || vector > AVEC_MAX) {
130 free(ih, M_DEVBUF); 129 kmem_free(ih, sizeof(*ih));
131 return NULL; 130 return NULL;
132 } 131 }
133 vec_list = &autovec_list[vector-1]; 132 vec_list = &autovec_list[vector-1];
134 hard_vec = &autovects[vector-1]; 133 hard_vec = &autovects[vector-1];
135 ih->ih_intrcnt = &intrcnt_auto[vector-1]; 134 ih->ih_intrcnt = &intrcnt_auto[vector-1];
136 break; 135 break;
137 case USER_VEC: 136 case USER_VEC:
138 if (vector < UVEC_MIN || vector > UVEC_MAX) { 137 if (vector < UVEC_MIN || vector > UVEC_MAX) {
139 free(ih, M_DEVBUF); 138 kmem_free(ih, sizeof(*ih));
140 return NULL; 139 return NULL;
141 } 140 }
142 vec_list = &uservec_list[vector]; 141 vec_list = &uservec_list[vector];
143 hard_vec = &uservects[vector]; 142 hard_vec = &uservects[vector];
144 ih->ih_intrcnt = &intrcnt_user[vector]; 143 ih->ih_intrcnt = &intrcnt_user[vector];
145 break; 144 break;
146 default: 145 default:
147 printf("%s: bogus vector type\n", __func__); 146 printf("%s: bogus vector type\n", __func__);
148 free(ih, M_DEVBUF); 147 kmem_free(ih, sizeof(*ih));
149 return NULL; 148 return NULL;
150 } 149 }
151 150
152 /* 151 /*
153 * If the vec_list is empty, we insert ourselves at the head of the 152 * If the vec_list is empty, we insert ourselves at the head of the
154 * list and we re-route the 'hard-vector' to the appropriate handler. 153 * list and we re-route the 'hard-vector' to the appropriate handler.
155 */ 154 */
156 if (vec_list->lh_first == NULL) { 155 if (vec_list->lh_first == NULL) {
157 156
158 s = splhigh(); 157 s = splhigh();
159 LIST_INSERT_HEAD(vec_list, ih, ih_link); 158 LIST_INSERT_HEAD(vec_list, ih, ih_link);
160 if (type & FAST_VEC) 159 if (type & FAST_VEC)
161 *hard_vec = (u_long)ih->ih_fun; 160 *hard_vec = (u_long)ih->ih_fun;
@@ -171,27 +170,27 @@ intr_establish(int vector, int type, int @@ -171,27 +170,27 @@ intr_establish(int vector, int type, int
171 *hard_vec = (u_long)intr_glue; 170 *hard_vec = (u_long)intr_glue;
172 } 171 }
173  172
174 splx(s); 173 splx(s);
175 174
176 return ih; 175 return ih;
177 } 176 }
178 177
179 /* 178 /*
180 * Check for FAST_VEC botches 179 * Check for FAST_VEC botches
181 */ 180 */
182 cur_vec = vec_list->lh_first; 181 cur_vec = vec_list->lh_first;
183 if (cur_vec->ih_type & FAST_VEC) { 182 if (cur_vec->ih_type & FAST_VEC) {
184 free(ih, M_DEVBUF); 183 kmem_free(ih, sizeof(*ih));
185 printf("intr_establish: vector cannot be shared\n"); 184 printf("intr_establish: vector cannot be shared\n");
186 return NULL; 185 return NULL;
187 } 186 }
188 187
189 /* 188 /*
190 * We traverse the list and place ourselves after any handlers with 189 * We traverse the list and place ourselves after any handlers with
191 * our current (or higher) priority level. 190 * our current (or higher) priority level.
192 */ 191 */
193 for (cur_vec = vec_list->lh_first; cur_vec->ih_link.le_next != NULL; 192 for (cur_vec = vec_list->lh_first; cur_vec->ih_link.le_next != NULL;
194 cur_vec = cur_vec->ih_link.le_next) { 193 cur_vec = cur_vec->ih_link.le_next) {
195 if (ih->ih_pri > cur_vec->ih_pri) { 194 if (ih->ih_pri > cur_vec->ih_pri) {
196 195
197 s = splhigh(); 196 s = splhigh();
@@ -249,27 +248,27 @@ intr_disestablish(struct intrhand *ih) @@ -249,27 +248,27 @@ intr_disestablish(struct intrhand *ih)
249 break; 248 break;
250 } 249 }
251 if (ih != cur_vec) { 250 if (ih != cur_vec) {
252 printf("intr_disestablish: 'ih' has inconsistent data\n"); 251 printf("intr_disestablish: 'ih' has inconsistent data\n");
253 return 0; 252 return 0;
254 } 253 }
255 254
256 s = splhigh(); 255 s = splhigh();
257 LIST_REMOVE(ih, ih_link); 256 LIST_REMOVE(ih, ih_link);
258 if ((vec_list->lh_first == NULL) && (ih->ih_type & FAST_VEC)) 257 if ((vec_list->lh_first == NULL) && (ih->ih_type & FAST_VEC))
259 *hard_vec = (u_long)intr_glue; 258 *hard_vec = (u_long)intr_glue;
260 splx(s); 259 splx(s);
261 260
262 free(ih, M_DEVBUF); 261 kmem_free(ih, sizeof(*ih));
263 return 1; 262 return 1;
264} 263}
265 264
266/* 265/*
267 * This is the dispatcher called by the low-level 266 * This is the dispatcher called by the low-level
268 * assembly language interrupt-glue routine. 267 * assembly language interrupt-glue routine.
269 */ 268 */
270void 269void
271intr_dispatch(struct clockframe frame) 270intr_dispatch(struct clockframe frame)
272{ 271{
273 static int unexpected, straycount; 272 static int unexpected, straycount;
274 int vector; 273 int vector;
275 int handled = 0; 274 int handled = 0;

cvs diff -r1.20 -r1.21 src/sys/arch/atari/atari/le_bus.c (expand / switch to unified diff)

--- src/sys/arch/atari/atari/le_bus.c 2019/11/10 21:16:25 1.20
+++ src/sys/arch/atari/atari/le_bus.c 2021/01/03 17:42:10 1.21
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: le_bus.c,v 1.20 2019/11/10 21:16:25 chs Exp $ */ 1/* $NetBSD: le_bus.c,v 1.21 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 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 Leo Weppelman. 8 * by Leo Weppelman.
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.
@@ -20,32 +20,32 @@ @@ -20,32 +20,32 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: le_bus.c,v 1.20 2019/11/10 21:16:25 chs Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: le_bus.c,v 1.21 2021/01/03 17:42:10 thorpej Exp $");
34 34
35#include <sys/types.h> 35#include <sys/types.h>
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/malloc.h> 38#include <sys/kmem.h>
39#include <sys/bswap.h> 39#include <sys/bswap.h>
40#include <machine/cpu.h> 40#include <machine/cpu.h>
41#include <sys/bus.h> 41#include <sys/bus.h>
42 42
43/* 43/*
44 * This file contains the common functions for using a litte endian (linear) 44 * This file contains the common functions for using a litte endian (linear)
45 * bus on a big endian atari. 45 * bus on a big endian atari.
46 */ 46 */
47 47
48 /* Autoconf detection stuff */ 48 /* Autoconf detection stuff */
49static int leb_bus_space_peek_1(bus_space_tag_t, 49static int leb_bus_space_peek_1(bus_space_tag_t,
50 bus_space_handle_t, bus_size_t); 50 bus_space_handle_t, bus_size_t);
51static int leb_bus_space_peek_2(bus_space_tag_t, 51static int leb_bus_space_peek_2(bus_space_tag_t,
@@ -252,32 +252,32 @@ static inline uint32_t swap32(uint32_t v @@ -252,32 +252,32 @@ static inline uint32_t swap32(uint32_t v
252 252
253#define __write_1(h, o, v) *((volatile uint8_t *)((h) + (o))) = (v) 253#define __write_1(h, o, v) *((volatile uint8_t *)((h) + (o))) = (v)
254#define __write_2(h, o, v) *((volatile uint16_t *)((h) + (o))) = swap16(v) 254#define __write_2(h, o, v) *((volatile uint16_t *)((h) + (o))) = swap16(v)
255#define __write_4(h, o, v) *((volatile uint32_t *)((h) + (o))) = swap32(v) 255#define __write_4(h, o, v) *((volatile uint32_t *)((h) + (o))) = swap32(v)
256#define __write_8(h, o, v) *((volatile uint64_t *)((h) + (o))) = bswap64(v) 256#define __write_8(h, o, v) *((volatile uint64_t *)((h) + (o))) = bswap64(v)
257 257
258bus_space_tag_t 258bus_space_tag_t
259leb_alloc_bus_space_tag(bus_space_tag_t storage) 259leb_alloc_bus_space_tag(bus_space_tag_t storage)
260{ 260{
261 bus_space_tag_t leb_t; 261 bus_space_tag_t leb_t;
262 262
263 /* 263 /*
264 * Allow the caller to specify storage space for the tag. This 264 * Allow the caller to specify storage space for the tag. This
265 * is used during console config (when malloc() can't be used). 265 * is used during console config (when kmem_alloc() can't be used).
266 */ 266 */
267 if (storage != NULL) 267 if (storage != NULL)
268 leb_t = storage; 268 leb_t = storage;
269 else { 269 else {
270 leb_t = malloc(sizeof(*leb_t), M_TEMP, M_WAITOK); 270 leb_t = kmem_alloc(sizeof(*leb_t), KM_SLEEP);
271 } 271 }
272 memset(leb_t, 0, sizeof(*leb_t)); 272 memset(leb_t, 0, sizeof(*leb_t));
273 273
274 leb_t->abs_p_1 = leb_bus_space_peek_1; 274 leb_t->abs_p_1 = leb_bus_space_peek_1;
275 leb_t->abs_p_2 = leb_bus_space_peek_2; 275 leb_t->abs_p_2 = leb_bus_space_peek_2;
276 leb_t->abs_p_4 = leb_bus_space_peek_4; 276 leb_t->abs_p_4 = leb_bus_space_peek_4;
277 leb_t->abs_p_8 = leb_bus_space_peek_8; 277 leb_t->abs_p_8 = leb_bus_space_peek_8;
278 leb_t->abs_r_1 = leb_bus_space_read_1; 278 leb_t->abs_r_1 = leb_bus_space_read_1;
279 leb_t->abs_r_2 = leb_bus_space_read_2; 279 leb_t->abs_r_2 = leb_bus_space_read_2;
280 leb_t->abs_r_4 = leb_bus_space_read_4; 280 leb_t->abs_r_4 = leb_bus_space_read_4;
281 leb_t->abs_r_8 = leb_bus_space_read_8; 281 leb_t->abs_r_8 = leb_bus_space_read_8;
282 leb_t->abs_rs_1 = leb_bus_space_read_1; 282 leb_t->abs_rs_1 = leb_bus_space_read_1;
283 leb_t->abs_rs_2 = leb_bus_space_read_stream_2; 283 leb_t->abs_rs_2 = leb_bus_space_read_stream_2;

cvs diff -r1.183 -r1.184 src/sys/arch/atari/atari/machdep.c (expand / switch to unified diff)

--- src/sys/arch/atari/atari/machdep.c 2020/06/11 19:20:43 1.183
+++ src/sys/arch/atari/atari/machdep.c 2021/01/03 17:42:10 1.184
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: machdep.c,v 1.183 2020/06/11 19:20:43 ad Exp $ */ 1/* $NetBSD: machdep.c,v 1.184 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988 University of Utah. 4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. 5 * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to Berkeley by 8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer 9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department. 10 * Science Department.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -29,45 +29,45 @@ @@ -29,45 +29,45 @@
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE. 34 * SUCH DAMAGE.
35 * 35 *
36 * from: Utah $Hdr: machdep.c 1.63 91/04/24$ 36 * from: Utah $Hdr: machdep.c 1.63 91/04/24$
37 * 37 *
38 * @(#)machdep.c 7.16 (Berkeley) 6/3/91 38 * @(#)machdep.c 7.16 (Berkeley) 6/3/91
39 */ 39 */
40 40
41#include <sys/cdefs.h> 41#include <sys/cdefs.h>
42__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.183 2020/06/11 19:20:43 ad Exp $"); 42__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.184 2021/01/03 17:42:10 thorpej Exp $");
43 43
44#include "opt_ddb.h" 44#include "opt_ddb.h"
45#include "opt_compat_netbsd.h" 45#include "opt_compat_netbsd.h"
46#include "opt_mbtype.h" 46#include "opt_mbtype.h"
47#include "opt_modular.h" 47#include "opt_modular.h"
48#include "opt_panicbutton.h" 48#include "opt_panicbutton.h"
49 49
50#include <sys/param.h> 50#include <sys/param.h>
51#include <sys/systm.h> 51#include <sys/systm.h>
52#include <sys/signalvar.h> 52#include <sys/signalvar.h>
53#include <sys/kernel.h> 53#include <sys/kernel.h>
54#include <sys/proc.h> 54#include <sys/proc.h>
55#include <sys/buf.h> 55#include <sys/buf.h>
56#include <sys/reboot.h> 56#include <sys/reboot.h>
57#include <sys/conf.h> 57#include <sys/conf.h>
58#include <sys/file.h> 58#include <sys/file.h>
59#include <sys/device.h> 59#include <sys/device.h>
60#include <sys/malloc.h> 60#include <sys/kmem.h>
61#include <sys/mbuf.h> 61#include <sys/mbuf.h>
62#include <sys/msgbuf.h> 62#include <sys/msgbuf.h>
63#include <sys/vnode.h> 63#include <sys/vnode.h>
64#include <sys/queue.h> 64#include <sys/queue.h>
65#include <sys/mount.h> 65#include <sys/mount.h>
66#include <sys/syscallargs.h> 66#include <sys/syscallargs.h>
67#include <sys/ksyms.h> 67#include <sys/ksyms.h>
68#include <sys/module.h> 68#include <sys/module.h>
69#include <sys/intr.h> 69#include <sys/intr.h>
70#include <sys/exec.h> 70#include <sys/exec.h>
71#include <sys/exec_aout.h> 71#include <sys/exec_aout.h>
72#include <sys/cpu.h> 72#include <sys/cpu.h>
73#include <sys/exec_elf.h> 73#include <sys/exec_elf.h>
@@ -620,27 +620,27 @@ add_sicallback(void (*function)(void *,  @@ -620,27 +620,27 @@ add_sicallback(void (*function)(void *,
620 struct si_callback *si; 620 struct si_callback *si;
621 int s; 621 int s;
622 622
623 /* 623 /*
624 * this function may be called from high-priority interrupt handlers. 624 * this function may be called from high-priority interrupt handlers.
625 * We may NOT block for memory-allocation in here!. 625 * We may NOT block for memory-allocation in here!.
626 */ 626 */
627 s = splhigh(); 627 s = splhigh();
628 if ((si = si_free) != NULL) 628 if ((si = si_free) != NULL)
629 si_free = si->next; 629 si_free = si->next;
630 splx(s); 630 splx(s);
631 631
632 if (si == NULL) { 632 if (si == NULL) {
633 si = malloc(sizeof(*si), M_TEMP, M_NOWAIT); 633 si = kmem_intr_alloc(sizeof(*si), KM_NOSLEEP);
634#ifdef DIAGNOSTIC 634#ifdef DIAGNOSTIC
635 if (si) 635 if (si)
636 ++ncbd; /* count # dynamically allocated */ 636 ++ncbd; /* count # dynamically allocated */
637#endif 637#endif
638 if (si == NULL) 638 if (si == NULL)
639 return; 639 return;
640 } 640 }
641 641
642 si->function = function; 642 si->function = function;
643 si->rock1 = rock1; 643 si->rock1 = rock1;
644 si->rock2 = rock2; 644 si->rock2 = rock2;
645 645
646 s = splhigh(); 646 s = splhigh();

cvs diff -r1.12 -r1.13 src/sys/arch/atari/atari/mainbus.c (expand / switch to unified diff)

--- src/sys/arch/atari/atari/mainbus.c 2019/11/10 21:16:25 1.12
+++ src/sys/arch/atari/atari/mainbus.c 2021/01/03 17:42:10 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mainbus.c,v 1.12 2019/11/10 21:16:25 chs Exp $ */ 1/* $NetBSD: mainbus.c,v 1.13 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 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 Leo Weppelman. 8 * by Leo Weppelman.
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.
@@ -20,32 +20,32 @@ @@ -20,32 +20,32 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.12 2019/11/10 21:16:25 chs Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.13 2021/01/03 17:42:10 thorpej Exp $");
34 34
35#include <sys/types.h> 35#include <sys/types.h>
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/systm.h> 37#include <sys/systm.h>
38#include <sys/malloc.h> 38#include <sys/kmem.h>
39#include <machine/cpu.h> 39#include <machine/cpu.h>
40#include <sys/bus.h> 40#include <sys/bus.h>
41 41
42static int mb_bus_space_peek_1(bus_space_tag_t, 42static int mb_bus_space_peek_1(bus_space_tag_t,
43 bus_space_handle_t, bus_size_t); 43 bus_space_handle_t, bus_size_t);
44static int mb_bus_space_peek_2(bus_space_tag_t, 44static int mb_bus_space_peek_2(bus_space_tag_t,
45 bus_space_handle_t, bus_size_t); 45 bus_space_handle_t, bus_size_t);
46static int mb_bus_space_peek_4(bus_space_tag_t, 46static int mb_bus_space_peek_4(bus_space_tag_t,
47 bus_space_handle_t, bus_size_t); 47 bus_space_handle_t, bus_size_t);
48static int mb_bus_space_peek_8(bus_space_tag_t, 48static int mb_bus_space_peek_8(bus_space_tag_t,
49 bus_space_handle_t, bus_size_t); 49 bus_space_handle_t, bus_size_t);
50static uint8_t mb_bus_space_read_1(bus_space_tag_t, 50static uint8_t mb_bus_space_read_1(bus_space_tag_t,
51 bus_space_handle_t, bus_size_t); 51 bus_space_handle_t, bus_size_t);
@@ -157,28 +157,27 @@ static void mb_bus_space_set_region_8(b @@ -157,28 +157,27 @@ static void mb_bus_space_set_region_8(b
157 *((volatile uint16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))) = v 157 *((volatile uint16_t *)(calc_addr(h, o, (t)->stride, (t)->wo_2))) = v
158 158
159#define __write_4(t, h, o, v) \ 159#define __write_4(t, h, o, v) \
160 *((volatile uint32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))) = v 160 *((volatile uint32_t *)(calc_addr(h, o, (t)->stride, (t)->wo_4))) = v
161 161
162#define __write_8(t, h, o, v) \ 162#define __write_8(t, h, o, v) \
163 *((volatile uint64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))) = v 163 *((volatile uint64_t *)(calc_addr(h, o, (t)->stride, (t)->wo_8))) = v
164 164
165bus_space_tag_t 165bus_space_tag_t
166mb_alloc_bus_space_tag(void) 166mb_alloc_bus_space_tag(void)
167{ 167{
168 bus_space_tag_t mb_t; 168 bus_space_tag_t mb_t;
169 169
170 /* Not really M_TEMP, is it.. */ 170 mb_t = kmem_zalloc(sizeof(*mb_t), KM_SLEEP);
171 mb_t = malloc(sizeof(*mb_t), M_TEMP, M_WAITOK|M_ZERO); 
172 mb_t->abs_p_1 = mb_bus_space_peek_1; 171 mb_t->abs_p_1 = mb_bus_space_peek_1;
173 mb_t->abs_p_2 = mb_bus_space_peek_2; 172 mb_t->abs_p_2 = mb_bus_space_peek_2;
174 mb_t->abs_p_4 = mb_bus_space_peek_4; 173 mb_t->abs_p_4 = mb_bus_space_peek_4;
175 mb_t->abs_p_8 = mb_bus_space_peek_8; 174 mb_t->abs_p_8 = mb_bus_space_peek_8;
176 mb_t->abs_r_1 = mb_bus_space_read_1; 175 mb_t->abs_r_1 = mb_bus_space_read_1;
177 mb_t->abs_r_2 = mb_bus_space_read_2; 176 mb_t->abs_r_2 = mb_bus_space_read_2;
178 mb_t->abs_r_4 = mb_bus_space_read_4; 177 mb_t->abs_r_4 = mb_bus_space_read_4;
179 mb_t->abs_r_8 = mb_bus_space_read_8; 178 mb_t->abs_r_8 = mb_bus_space_read_8;
180 mb_t->abs_rs_1 = mb_bus_space_read_1; 179 mb_t->abs_rs_1 = mb_bus_space_read_1;
181 mb_t->abs_rs_2 = mb_bus_space_read_2; 180 mb_t->abs_rs_2 = mb_bus_space_read_2;
182 mb_t->abs_rs_4 = mb_bus_space_read_4; 181 mb_t->abs_rs_4 = mb_bus_space_read_4;
183 mb_t->abs_rs_8 = mb_bus_space_read_8; 182 mb_t->abs_rs_8 = mb_bus_space_read_8;
184 mb_t->abs_rm_1 = mb_bus_space_read_multi_1; 183 mb_t->abs_rm_1 = mb_bus_space_read_multi_1;
@@ -227,28 +226,27 @@ mb_alloc_bus_space_tag(void) @@ -227,28 +226,27 @@ mb_alloc_bus_space_tag(void)
227 mb_t->abs_sm_8 = mb_bus_space_set_multi_8; 226 mb_t->abs_sm_8 = mb_bus_space_set_multi_8;
228 mb_t->abs_sr_1 = mb_bus_space_set_region_1; 227 mb_t->abs_sr_1 = mb_bus_space_set_region_1;
229 mb_t->abs_sr_2 = mb_bus_space_set_region_2; 228 mb_t->abs_sr_2 = mb_bus_space_set_region_2;
230 mb_t->abs_sr_4 = mb_bus_space_set_region_4; 229 mb_t->abs_sr_4 = mb_bus_space_set_region_4;
231 mb_t->abs_sr_8 = mb_bus_space_set_region_8; 230 mb_t->abs_sr_8 = mb_bus_space_set_region_8;
232 231
233 return mb_t; 232 return mb_t;
234} 233}
235 234
236void 235void
237mb_free_bus_space_tag(bus_space_tag_t mb_t) 236mb_free_bus_space_tag(bus_space_tag_t mb_t)
238{ 237{
239 238
240 /* Not really M_TEMP, is it.. */ 239 kmem_free(mb_t, sizeof(*mb_t));
241 free(mb_t, M_TEMP); 
242} 240}
243 241
244static int 242static int
245mb_bus_space_peek_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) 243mb_bus_space_peek_1(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
246{ 244{
247 245
248 return !badbaddr((void *)(calc_addr(h, o, t->stride, t->wo_1)), 1); 246 return !badbaddr((void *)(calc_addr(h, o, t->stride, t->wo_1)), 1);
249} 247}
250 248
251static int  249static int
252mb_bus_space_peek_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o) 250mb_bus_space_peek_2(bus_space_tag_t t, bus_space_handle_t h, bus_size_t o)
253{ 251{
254 252

cvs diff -r1.86 -r1.87 src/sys/arch/atari/dev/hdfd.c (expand / switch to unified diff)

--- src/sys/arch/atari/dev/hdfd.c 2019/11/10 21:16:25 1.86
+++ src/sys/arch/atari/dev/hdfd.c 2021/01/03 17:42:10 1.87
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: hdfd.c,v 1.86 2019/11/10 21:16:25 chs Exp $ */ 1/* $NetBSD: hdfd.c,v 1.87 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996 Leo Weppelman 4 * Copyright (c) 1996 Leo Weppelman
5 * Copyright (c) 1990 The Regents of the University of California. 5 * Copyright (c) 1990 The Regents of the University of California.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to Berkeley by 8 * This code is derived from software contributed to Berkeley by
9 * Don Ahn. 9 * Don Ahn.
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
@@ -81,42 +81,42 @@ @@ -81,42 +81,42 @@
81 * use ..." clause: 81 * use ..." clause:
82 * 82 *
83 * Copyright (c) 1993, 1994 by 83 * Copyright (c) 1993, 1994 by
84 * jc@irbs.UUCP (John Capo) 84 * jc@irbs.UUCP (John Capo)
85 * vak@zebub.msk.su (Serge Vakulenko) 85 * vak@zebub.msk.su (Serge Vakulenko)
86 * ache@astral.msk.su (Andrew A. Chernov) 86 * ache@astral.msk.su (Andrew A. Chernov)
87 * 87 *
88 * Copyright (c) 1993, 1994, 1995 by 88 * Copyright (c) 1993, 1994, 1995 by
89 * joerg_wunsch@uriah.sax.de (Joerg Wunsch) 89 * joerg_wunsch@uriah.sax.de (Joerg Wunsch)
90 * dufault@hda.com (Peter Dufault) 90 * dufault@hda.com (Peter Dufault)
91 */ 91 */
92 92
93#include <sys/cdefs.h> 93#include <sys/cdefs.h>
94__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.86 2019/11/10 21:16:25 chs Exp $"); 94__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.87 2021/01/03 17:42:10 thorpej Exp $");
95 95
96#include "opt_ddb.h" 96#include "opt_ddb.h"
97 97
98#include <sys/param.h> 98#include <sys/param.h>
99#include <sys/systm.h> 99#include <sys/systm.h>
100#include <sys/callout.h> 100#include <sys/callout.h>
101#include <sys/kernel.h> 101#include <sys/kernel.h>
102#include <sys/file.h> 102#include <sys/file.h>
103#include <sys/ioctl.h> 103#include <sys/ioctl.h>
104#include <sys/device.h> 104#include <sys/device.h>
105#include <sys/disklabel.h> 105#include <sys/disklabel.h>
106#include <sys/disk.h> 106#include <sys/disk.h>
107#include <sys/buf.h> 107#include <sys/buf.h>
108#include <sys/bufq.h> 108#include <sys/bufq.h>
109#include <sys/malloc.h> 109#include <sys/kmem.h>
110#include <sys/uio.h> 110#include <sys/uio.h>
111#include <sys/syslog.h> 111#include <sys/syslog.h>
112#include <sys/queue.h> 112#include <sys/queue.h>
113#include <sys/proc.h> 113#include <sys/proc.h>
114#include <sys/fdio.h> 114#include <sys/fdio.h>
115#include <sys/conf.h> 115#include <sys/conf.h>
116 116
117#include <uvm/uvm_extern.h> 117#include <uvm/uvm_extern.h>
118 118
119#include <machine/cpu.h> 119#include <machine/cpu.h>
120#include <sys/bus.h> 120#include <sys/bus.h>
121#include <machine/iomap.h> 121#include <machine/iomap.h>
122#include <machine/mfp.h> 122#include <machine/mfp.h>
@@ -1416,52 +1416,51 @@ fdioctl(dev_t dev, u_long cmd, void *add @@ -1416,52 +1416,51 @@ fdioctl(dev_t dev, u_long cmd, void *add
1416 1416
1417 case FDIOCFORMAT_TRACK: 1417 case FDIOCFORMAT_TRACK:
1418 if ((flag & FWRITE) == 0) 1418 if ((flag & FWRITE) == 0)
1419 return EBADF; /* must be opened for writing */ 1419 return EBADF; /* must be opened for writing */
1420 form_cmd = (struct fdformat_cmd *)addr; 1420 form_cmd = (struct fdformat_cmd *)addr;
1421 if (form_cmd->formatcmd_version != FDFORMAT_VERSION) 1421 if (form_cmd->formatcmd_version != FDFORMAT_VERSION)
1422 return EINVAL; /* wrong version of formatting prog */ 1422 return EINVAL; /* wrong version of formatting prog */
1423 1423
1424 if (form_cmd->head >= fd->sc_type->heads || 1424 if (form_cmd->head >= fd->sc_type->heads ||
1425 form_cmd->cylinder >= fd->sc_type->tracks) { 1425 form_cmd->cylinder >= fd->sc_type->tracks) {
1426 return EINVAL; 1426 return EINVAL;
1427 } 1427 }
1428 1428
1429 fd_formb = malloc(sizeof(struct ne7_fd_formb), 1429 fd_formb = kmem_alloc(sizeof(*fd_formb), KM_SLEEP);
1430 M_TEMP, M_WAITOK); 
1431 fd_formb->head = form_cmd->head; 1430 fd_formb->head = form_cmd->head;
1432 fd_formb->cyl = form_cmd->cylinder; 1431 fd_formb->cyl = form_cmd->cylinder;
1433 fd_formb->transfer_rate = fd->sc_type->rate; 1432 fd_formb->transfer_rate = fd->sc_type->rate;
1434 fd_formb->fd_formb_secshift = fd->sc_type->secsize; 1433 fd_formb->fd_formb_secshift = fd->sc_type->secsize;
1435 fd_formb->fd_formb_nsecs = fd->sc_type->sectrac; 1434 fd_formb->fd_formb_nsecs = fd->sc_type->sectrac;
1436 fd_formb->fd_formb_gaplen = fd->sc_type->gap2; 1435 fd_formb->fd_formb_gaplen = fd->sc_type->gap2;
1437 fd_formb->fd_formb_fillbyte = fd->sc_type->fillbyte; 1436 fd_formb->fd_formb_fillbyte = fd->sc_type->fillbyte;
1438 1437
1439 memset(il, 0,sizeof il); 1438 memset(il, 0,sizeof il);
1440 for (j = 0, i = 1; i <= fd_formb->fd_formb_nsecs; i++) { 1439 for (j = 0, i = 1; i <= fd_formb->fd_formb_nsecs; i++) {
1441 while (il[(j%fd_formb->fd_formb_nsecs)+1]) 1440 while (il[(j%fd_formb->fd_formb_nsecs)+1])
1442 j++; 1441 j++;
1443 il[(j%fd_formb->fd_formb_nsecs)+1] = i; 1442 il[(j%fd_formb->fd_formb_nsecs)+1] = i;
1444 j += fd->sc_type->interleave; 1443 j += fd->sc_type->interleave;
1445 } 1444 }
1446 for (i = 0; i < fd_formb->fd_formb_nsecs; i++) { 1445 for (i = 0; i < fd_formb->fd_formb_nsecs; i++) {
1447 fd_formb->fd_formb_cylno(i) = form_cmd->cylinder; 1446 fd_formb->fd_formb_cylno(i) = form_cmd->cylinder;
1448 fd_formb->fd_formb_headno(i) = form_cmd->head; 1447 fd_formb->fd_formb_headno(i) = form_cmd->head;
1449 fd_formb->fd_formb_secno(i) = il[i+1]; 1448 fd_formb->fd_formb_secno(i) = il[i+1];
1450 fd_formb->fd_formb_secsize(i) = fd->sc_type->secsize; 1449 fd_formb->fd_formb_secsize(i) = fd->sc_type->secsize;
1451 } 1450 }
1452  1451
1453 error = fdformat(dev, fd_formb, l->l_proc); 1452 error = fdformat(dev, fd_formb, l->l_proc);
1454 free(fd_formb, M_TEMP); 1453 kmem_free(fd_formb, sizeof(*fd_formb));
1455 return error; 1454 return error;
1456 1455
1457 case FDIOCGETOPTS: /* get drive options */ 1456 case FDIOCGETOPTS: /* get drive options */
1458 *(int *)addr = fd->sc_opts; 1457 *(int *)addr = fd->sc_opts;
1459 return 0; 1458 return 0;
1460 1459
1461 case FDIOCSETOPTS: /* set drive options */ 1460 case FDIOCSETOPTS: /* set drive options */
1462 fd->sc_opts = *(int *)addr; 1461 fd->sc_opts = *(int *)addr;
1463 return 0; 1462 return 0;
1464 1463
1465 1464
1466 default: 1465 default:
1467 return ENOTTY; 1466 return ENOTTY;

cvs diff -r1.79 -r1.80 src/sys/arch/atari/dev/ite.c (expand / switch to unified diff)

--- src/sys/arch/atari/dev/ite.c 2019/06/29 16:41:19 1.79
+++ src/sys/arch/atari/dev/ite.c 2021/01/03 17:42:10 1.80
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ite.c,v 1.79 2019/06/29 16:41:19 tsutsui Exp $ */ 1/* $NetBSD: ite.c,v 1.80 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988 University of Utah. 4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1990 The Regents of the University of California. 5 * Copyright (c) 1990 The Regents of the University of California.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to Berkeley by 8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer 9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department. 10 * Science Department.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -34,35 +34,35 @@ @@ -34,35 +34,35 @@
34 * SUCH DAMAGE. 34 * SUCH DAMAGE.
35 * 35 *
36 * from: Utah Hdr: ite.c 1.1 90/07/09 36 * from: Utah Hdr: ite.c 1.1 90/07/09
37 * from: @(#)ite.c 7.6 (Berkeley) 5/16/91 37 * from: @(#)ite.c 7.6 (Berkeley) 5/16/91
38 */ 38 */
39 39
40/* 40/*
41 * ite - bitmapped terminal. 41 * ite - bitmapped terminal.
42 * Supports VT200, a few terminal features will be unavailable until 42 * Supports VT200, a few terminal features will be unavailable until
43 * the system actually probes the device (i.e. not after consinit()) 43 * the system actually probes the device (i.e. not after consinit())
44 */ 44 */
45 45
46#include <sys/cdefs.h> 46#include <sys/cdefs.h>
47__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.79 2019/06/29 16:41:19 tsutsui Exp $"); 47__KERNEL_RCSID(0, "$NetBSD: ite.c,v 1.80 2021/01/03 17:42:10 thorpej Exp $");
48 48
49#include "opt_ddb.h" 49#include "opt_ddb.h"
50 50
51#include <sys/param.h> 51#include <sys/param.h>
52#include <sys/kernel.h> 52#include <sys/kernel.h>
53#include <sys/conf.h> 53#include <sys/conf.h>
54#include <sys/device.h> 54#include <sys/device.h>
55#include <sys/malloc.h> 55#include <sys/kmem.h>
56#include <sys/fcntl.h> 56#include <sys/fcntl.h>
57#include <sys/ioctl.h> 57#include <sys/ioctl.h>
58#include <sys/tty.h> 58#include <sys/tty.h>
59#include <sys/termios.h> 59#include <sys/termios.h>
60#include <sys/systm.h> 60#include <sys/systm.h>
61#include <sys/callout.h> 61#include <sys/callout.h>
62#include <sys/proc.h> 62#include <sys/proc.h>
63#include <dev/cons.h> 63#include <dev/cons.h>
64#include <sys/kauth.h> 64#include <sys/kauth.h>
65 65
66#include <machine/cpu.h> 66#include <machine/cpu.h>
67 67
68#include <atari/atari/device.h> 68#include <atari/atari/device.h>
@@ -351,39 +351,39 @@ itecnputc(dev_t dev, int c) @@ -351,39 +351,39 @@ itecnputc(dev_t dev, int c)
351 * an ite device, it is also called from itecninit(). 351 * an ite device, it is also called from itecninit().
352 * 352 *
353 */ 353 */
354void 354void
355iteinit(dev_t dev) 355iteinit(dev_t dev)
356{ 356{
357 struct ite_softc *sc; 357 struct ite_softc *sc;
358 358
359 sc = getitesp(dev); 359 sc = getitesp(dev);
360 if (sc->flags & ITE_INITED) 360 if (sc->flags & ITE_INITED)
361 return; 361 return;
362 if (atari_realconfig) { 362 if (atari_realconfig) {
363 if (sc->kbdmap && sc->kbdmap != &ascii_kbdmap) 363 if (sc->kbdmap && sc->kbdmap != &ascii_kbdmap)
364 free(sc->kbdmap, M_DEVBUF); 364 kmem_free(sc->kbdmap, sizeof(*sc->kbdmap));
365 sc->kbdmap = malloc(sizeof(struct kbdmap), M_DEVBUF, M_WAITOK); 365 sc->kbdmap = kmem_alloc(sizeof(*sc->kbdmap), KM_SLEEP);
366 memcpy(sc->kbdmap, &ascii_kbdmap, sizeof(struct kbdmap)); 366 memcpy(sc->kbdmap, &ascii_kbdmap, sizeof(struct kbdmap));
367 } 367 }
368 else 368 else
369 sc->kbdmap = &ascii_kbdmap; 369 sc->kbdmap = &ascii_kbdmap;
370 370
371 sc->cursorx = 0; 371 sc->cursorx = 0;
372 sc->cursory = 0; 372 sc->cursory = 0;
373 SUBR_INIT(sc); 373 SUBR_INIT(sc);
374 SUBR_CURSOR(sc, DRAW_CURSOR); 374 SUBR_CURSOR(sc, DRAW_CURSOR);
375 if (sc->tabs == NULL) 375 if (sc->tabs == NULL)
376 sc->tabs = malloc(MAX_TABS * sizeof(u_char),M_DEVBUF,M_WAITOK); 376 sc->tabs = kmem_alloc(MAX_TABS * sizeof(u_char), KM_SLEEP);
377 ite_reset(sc); 377 ite_reset(sc);
378 sc->flags |= ITE_INITED; 378 sc->flags |= ITE_INITED;
379} 379}
380 380
381int 381int
382iteopen(dev_t dev, int mode, int devtype, struct lwp *l) 382iteopen(dev_t dev, int mode, int devtype, struct lwp *l)
383{ 383{
384 struct ite_softc *sc; 384 struct ite_softc *sc;
385 struct tty *tp; 385 struct tty *tp;
386 int error, first, unit; 386 int error, first, unit;
387 387
388 unit = ITEUNIT(dev); 388 unit = ITEUNIT(dev);
389 if (unit >= ite_cd.cd_ndevs) 389 if (unit >= ite_cd.cd_ndevs)

cvs diff -r1.34 -r1.35 src/sys/arch/atari/dev/md_root.c (expand / switch to unified diff)

--- src/sys/arch/atari/dev/md_root.c 2018/09/03 16:29:24 1.34
+++ src/sys/arch/atari/dev/md_root.c 2021/01/03 17:42:10 1.35
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: md_root.c,v 1.34 2018/09/03 16:29:24 riastradh Exp $ */ 1/* $NetBSD: md_root.c,v 1.35 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 Leo Weppelman. 4 * Copyright (c) 1996 Leo Weppelman.
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.
@@ -16,32 +16,32 @@ @@ -16,32 +16,32 @@
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28#include <sys/cdefs.h> 28#include <sys/cdefs.h>
29__KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.34 2018/09/03 16:29:24 riastradh Exp $"); 29__KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.35 2021/01/03 17:42:10 thorpej Exp $");
30 30
31#include <sys/param.h> 31#include <sys/param.h>
32#include <sys/systm.h> 32#include <sys/systm.h>
33#include <sys/kernel.h> 33#include <sys/kernel.h>
34#include <sys/malloc.h> 34#include <sys/kmem.h>
35#include <sys/buf.h> 35#include <sys/buf.h>
36#include <sys/proc.h> 36#include <sys/proc.h>
37#include <sys/device.h> 37#include <sys/device.h>
38#include <sys/ioctl.h> 38#include <sys/ioctl.h>
39#include <sys/fcntl.h> 39#include <sys/fcntl.h>
40#include <sys/conf.h> 40#include <sys/conf.h>
41#include <sys/disklabel.h> 41#include <sys/disklabel.h>
42#include <sys/disk.h> 42#include <sys/disk.h>
43#include <sys/dkbad.h> 43#include <sys/dkbad.h>
44 44
45#include <dev/cons.h> 45#include <dev/cons.h>
46#include <dev/md.h> 46#include <dev/md.h>
47 47
@@ -119,33 +119,33 @@ md_attach_hook(int unit, struct md_conf  @@ -119,33 +119,33 @@ md_attach_hook(int unit, struct md_conf
119} 119}
120 120
121void 121void
122md_open_hook(int unit, struct md_conf *md) 122md_open_hook(int unit, struct md_conf *md)
123{ 123{
124 struct ramd_info *ri; 124 struct ramd_info *ri;
125 125
126 if (unit >= RAMD_NDEV) 126 if (unit >= RAMD_NDEV)
127 return; 127 return;
128 128
129 ri = &rd_info[unit]; 129 ri = &rd_info[unit];
130 if (md->md_type != MD_UNCONFIGURED) 130 if (md->md_type != MD_UNCONFIGURED)
131 return; /* Only configure once */ 131 return; /* Only configure once */
132 md->md_addr = malloc(ri->ramd_size, M_DEVBUF, M_WAITOK); 132 md->md_addr = kmem_alloc(ri->ramd_size, KM_SLEEP);
133 md->md_size = ri->ramd_size; 133 md->md_size = ri->ramd_size;
134 if (md->md_addr == NULL) 134 if (md->md_addr == NULL)
135 return; 135 return;
136 if (ri->ramd_flag & RAMD_LOAD) { 136 if (ri->ramd_flag & RAMD_LOAD) {
137 if (loaddisk(md, ri->ramd_dev, curlwp)) { 137 if (loaddisk(md, ri->ramd_dev, curlwp)) {
138 free(md->md_addr, M_DEVBUF); 138 kmem_free(md->md_addr, ri->ramd_size);
139 md->md_addr = NULL; 139 md->md_addr = NULL;
140 return; 140 return;
141 } 141 }
142 } 142 }
143 md->md_type = MD_KMEM_ALLOCATED; 143 md->md_type = MD_KMEM_ALLOCATED;
144} 144}
145 145
146static int 146static int
147loaddisk(struct md_conf *md, dev_t ld_dev, struct lwp *lwp) 147loaddisk(struct md_conf *md, dev_t ld_dev, struct lwp *lwp)
148{ 148{
149 struct buf *buf; 149 struct buf *buf;
150 int error; 150 int error;
151 const struct bdevsw *bdp; 151 const struct bdevsw *bdp;

cvs diff -r1.78 -r1.79 src/sys/arch/atari/dev/zs.c (expand / switch to unified diff)

--- src/sys/arch/atari/dev/zs.c 2018/02/08 09:05:17 1.78
+++ src/sys/arch/atari/dev/zs.c 2021/01/03 17:42:10 1.79
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: zs.c,v 1.78 2018/02/08 09:05:17 dholland Exp $ */ 1/* $NetBSD: zs.c,v 1.79 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This software was developed by the Computer Systems Engineering group 7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9 * contributed to Berkeley. 9 * contributed to Berkeley.
10 * 10 *
11 * 11 *
12 * All advertising materials mentioning features or use of this software 12 * All advertising materials mentioning features or use of this software
13 * must display the following acknowledgement: 13 * must display the following acknowledgement:
14 * This product includes software developed by the University of 14 * This product includes software developed by the University of
@@ -69,36 +69,36 @@ @@ -69,36 +69,36 @@
69 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 69 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
70 * POSSIBILITY OF SUCH DAMAGE. 70 * POSSIBILITY OF SUCH DAMAGE.
71 */ 71 */
72 72
73/* 73/*
74 * Zilog Z8530 (ZSCC) driver. 74 * Zilog Z8530 (ZSCC) driver.
75 * 75 *
76 * Runs two tty ports (modem2 and serial2) on zs0. 76 * Runs two tty ports (modem2 and serial2) on zs0.
77 * 77 *
78 * This driver knows far too much about chip to usage mappings. 78 * This driver knows far too much about chip to usage mappings.
79 */ 79 */
80 80
81#include <sys/cdefs.h> 81#include <sys/cdefs.h>
82__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.78 2018/02/08 09:05:17 dholland Exp $"); 82__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.79 2021/01/03 17:42:10 thorpej Exp $");
83 83
84#include <sys/param.h> 84#include <sys/param.h>
85#include <sys/systm.h> 85#include <sys/systm.h>
86#include <sys/proc.h> 86#include <sys/proc.h>
87#include <sys/device.h> 87#include <sys/device.h>
88#include <sys/conf.h> 88#include <sys/conf.h>
89#include <sys/file.h> 89#include <sys/file.h>
90#include <sys/ioctl.h> 90#include <sys/ioctl.h>
91#include <sys/malloc.h> 91#include <sys/kmem.h>
92#include <sys/tty.h> 92#include <sys/tty.h>
93#include <sys/time.h> 93#include <sys/time.h>
94#include <sys/kernel.h> 94#include <sys/kernel.h>
95#include <sys/syslog.h> 95#include <sys/syslog.h>
96#include <sys/kauth.h> 96#include <sys/kauth.h>
97 97
98#include <machine/cpu.h> 98#include <machine/cpu.h>
99#include <machine/iomap.h> 99#include <machine/iomap.h>
100#include <machine/scu.h> 100#include <machine/scu.h>
101#include <machine/mfp.h> 101#include <machine/mfp.h>
102#include <atari/dev/ym2149reg.h> 102#include <atari/dev/ym2149reg.h>
103 103
104#include <dev/ic/z8530reg.h> 104#include <dev/ic/z8530reg.h>
@@ -399,28 +399,28 @@ zsopen(dev_t dev, int flags, int mode, s @@ -399,28 +399,28 @@ zsopen(dev_t dev, int flags, int mode, s
399 sc = device_lookup_private(&zs_cd, zs); 399 sc = device_lookup_private(&zs_cd, zs);
400 if (sc == NULL) 400 if (sc == NULL)
401 return ENXIO; 401 return ENXIO;
402 cs = sc->sc_cs[unit & 1]; 402 cs = sc->sc_cs[unit & 1];
403 403
404 /* 404 /*
405 * When port A (ser02) is selected on the TT, make sure 405 * When port A (ser02) is selected on the TT, make sure
406 * the port is enabled. 406 * the port is enabled.
407 */ 407 */
408 if ((machineid & ATARI_TT) && !(unit & 1)) 408 if ((machineid & ATARI_TT) && !(unit & 1))
409 ym2149_ser2(1); 409 ym2149_ser2(1);
410 410
411 if (cs->cs_rbuf == NULL) { 411 if (cs->cs_rbuf == NULL) {
412 cs->cs_rbuf = malloc(ZLRB_RING_SIZE * sizeof(int), M_DEVBUF, 412 cs->cs_rbuf = kmem_alloc(ZLRB_RING_SIZE * sizeof(int),
413 M_WAITOK); 413 KM_SLEEP);
414 } 414 }
415 415
416 tp = cs->cs_ttyp; 416 tp = cs->cs_ttyp;
417 if (tp == NULL) { 417 if (tp == NULL) {
418 cs->cs_ttyp = tp = tty_alloc(); 418 cs->cs_ttyp = tp = tty_alloc();
419 tty_attach(tp); 419 tty_attach(tp);
420 tp->t_dev = dev; 420 tp->t_dev = dev;
421 tp->t_oproc = zsstart; 421 tp->t_oproc = zsstart;
422 tp->t_param = zsparam; 422 tp->t_param = zsparam;
423 } 423 }
424 424
425 if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp)) 425 if (kauth_authorize_device_tty(l->l_cred, KAUTH_DEVICE_TTY_OPEN, tp))
426 return EBUSY; 426 return EBUSY;

cvs diff -r1.58 -r1.59 src/sys/arch/atari/pci/pci_machdep.c (expand / switch to unified diff)

--- src/sys/arch/atari/pci/pci_machdep.c 2019/05/04 08:30:06 1.58
+++ src/sys/arch/atari/pci/pci_machdep.c 2021/01/03 17:42:10 1.59
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pci_machdep.c,v 1.58 2019/05/04 08:30:06 tsutsui Exp $ */ 1/* $NetBSD: pci_machdep.c,v 1.59 2021/01/03 17:42:10 thorpej Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 Leo Weppelman. All rights reserved. 4 * Copyright (c) 1996 Leo Weppelman. All rights reserved.
5 * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. 5 * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
6 * Copyright (c) 1994 Charles M. Hannum. All rights reserved. 6 * Copyright (c) 1994 Charles M. Hannum. 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
@@ -22,37 +22,37 @@ @@ -22,37 +22,37 @@
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: pci_machdep.c,v 1.58 2019/05/04 08:30:06 tsutsui Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.59 2021/01/03 17:42:10 thorpej Exp $");
36 36
37#include "opt_mbtype.h" 37#include "opt_mbtype.h"
38 38
39#include <sys/types.h> 39#include <sys/types.h>
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/time.h> 41#include <sys/time.h>
42#include <sys/systm.h> 42#include <sys/systm.h>
43#include <sys/errno.h> 43#include <sys/errno.h>
44#include <sys/device.h> 44#include <sys/device.h>
45#include <sys/malloc.h> 45#include <sys/kmem.h>
46 46
47#define _ATARI_BUS_DMA_PRIVATE 47#define _ATARI_BUS_DMA_PRIVATE
48#include <sys/bus.h> 48#include <sys/bus.h>
49 49
50#include <dev/pci/pcivar.h> 50#include <dev/pci/pcivar.h>
51#include <dev/pci/pcireg.h> 51#include <dev/pci/pcireg.h>
52#include <dev/pci/pcidevs.h> 52#include <dev/pci/pcidevs.h>
53 53
54#include <uvm/uvm_extern.h> 54#include <uvm/uvm_extern.h>
55 55
56#include <machine/cpu.h> 56#include <machine/cpu.h>
57#include <machine/iomap.h> 57#include <machine/iomap.h>
58#include <machine/mfp.h> 58#include <machine/mfp.h>
@@ -357,54 +357,52 @@ enable_pci_devices(void) @@ -357,54 +357,52 @@ enable_pci_devices(void)
357 /* 357 /*
358 * special case: if a display card is found and memory is 358 * special case: if a display card is found and memory is
359 * enabled preserve 128k at 0xa0000 as vga memory. 359 * enabled preserve 128k at 0xa0000 as vga memory.
360 * XXX: if a display card is found without being enabled, 360 * XXX: if a display card is found without being enabled,
361 * leave it alone! You will usually only create conflicts 361 * leave it alone! You will usually only create conflicts
362 * by enabeling it. 362 * by enabeling it.
363 */ 363 */
364 class = pci_conf_read(pc, tag, PCI_CLASS_REG); 364 class = pci_conf_read(pc, tag, PCI_CLASS_REG);
365 switch (PCI_CLASS(class)) { 365 switch (PCI_CLASS(class)) {
366 case PCI_CLASS_PREHISTORIC: 366 case PCI_CLASS_PREHISTORIC:
367 case PCI_CLASS_DISPLAY: 367 case PCI_CLASS_DISPLAY:
368 if (csr & (PCI_COMMAND_MEM_ENABLE | 368 if (csr & (PCI_COMMAND_MEM_ENABLE |
369 PCI_COMMAND_MASTER_ENABLE)) { 369 PCI_COMMAND_MASTER_ENABLE)) {
370 p = malloc(sizeof(struct pci_memreg), 370 p = kmem_zalloc(sizeof(struct pci_memreg),
371 M_TEMP, M_WAITOK); 371 KM_SLEEP);
372 memset(p, 0, sizeof(struct pci_memreg)); 
373 p->dev = dev; 372 p->dev = dev;
374 p->csr = csr; 373 p->csr = csr;
375 p->tag = tag; 374 p->tag = tag;
376 p->reg = 0; /* there is no register 375 p->reg = 0; /* there is no register
377 about this */ 376 about this */
378 p->size = 0x20000; /* 128kByte */ 377 p->size = 0x20000; /* 128kByte */
379 p->mask = 0xfffe0000; 378 p->mask = 0xfffe0000;
380 p->address = 0xa0000; 379 p->address = 0xa0000;
381 380
382 insert_into_list(&memlist, p); 381 insert_into_list(&memlist, p);
383 } else 382 } else
384 continue; 383 continue;
385 } 384 }
386 385
387 for (reg = PCI_MAPREG_START; reg < PCI_MAPREG_END; reg += 4) { 386 for (reg = PCI_MAPREG_START; reg < PCI_MAPREG_END; reg += 4) {
388 address = pci_conf_read(pc, tag, reg); 387 address = pci_conf_read(pc, tag, reg);
389 pci_conf_write(pc, tag, reg, 0xffffffff); 388 pci_conf_write(pc, tag, reg, 0xffffffff);
390 mask = pci_conf_read(pc, tag, reg); 389 mask = pci_conf_read(pc, tag, reg);
391 pci_conf_write(pc, tag, reg, address); 390 pci_conf_write(pc, tag, reg, address);
392 if (mask == 0) 391 if (mask == 0)
393 continue; /* Register unused */ 392 continue; /* Register unused */
394 393
395 p = malloc(sizeof(struct pci_memreg), 394 p = kmem_zalloc(sizeof(struct pci_memreg),
396 M_TEMP, M_WAITOK); 395 KM_SLEEP);
397 memset(p, 0, sizeof(struct pci_memreg)); 
398 p->dev = dev; 396 p->dev = dev;
399 p->csr = csr; 397 p->csr = csr;
400 p->tag = tag; 398 p->tag = tag;
401 p->reg = reg; 399 p->reg = reg;
402 p->mask = mask; 400 p->mask = mask;
403 p->address = 0; 401 p->address = 0;
404 402
405 if ((mask & PCI_MAPREG_TYPE_IO) != 0) { 403 if ((mask & PCI_MAPREG_TYPE_IO) != 0) {
406 p->size = PCI_MAPREG_IO_SIZE(mask); 404 p->size = PCI_MAPREG_IO_SIZE(mask);
407 405
408 /* 406 /*
409 * Align IO if necessary 407 * Align IO if necessary
410 */ 408 */
@@ -626,34 +624,34 @@ enable_pci_devices(void) @@ -626,34 +624,34 @@ enable_pci_devices(void)
626 printf("\ndev: %d, reg: 0x%02x, size: 0x%08x, addr: 0x%08x", 624 printf("\ndev: %d, reg: 0x%02x, size: 0x%08x, addr: 0x%08x",
627 p->dev, p->reg, p->size, p->address); 625 p->dev, p->reg, p->size, p->address);
628 p = LIST_NEXT(p, link); 626 p = LIST_NEXT(p, link);
629 } 627 }
630#endif 628#endif
631 629
632 /* 630 /*
633 * Free the lists 631 * Free the lists
634 */ 632 */
635 p = LIST_FIRST(&iolist); 633 p = LIST_FIRST(&iolist);
636 while (p != NULL) { 634 while (p != NULL) {
637 q = p; 635 q = p;
638 LIST_REMOVE(q, link); 636 LIST_REMOVE(q, link);
639 free(p, M_WAITOK); 637 kmem_free(p, sizeof(*p));
640 p = LIST_FIRST(&iolist); 638 p = LIST_FIRST(&iolist);
641 } 639 }
642 p = LIST_FIRST(&memlist); 640 p = LIST_FIRST(&memlist);
643 while (p != NULL) { 641 while (p != NULL) {
644 q = p; 642 q = p;
645 LIST_REMOVE(q, link); 643 LIST_REMOVE(q, link);
646 free(p, M_WAITOK); 644 kmem_free(p, sizeof(*p));
647 p = LIST_FIRST(&memlist); 645 p = LIST_FIRST(&memlist);
648 } 646 }
649} 647}
650 648
651pcitag_t 649pcitag_t
652pci_make_tag(pci_chipset_tag_t pc, int bus, int device, int function) 650pci_make_tag(pci_chipset_tag_t pc, int bus, int device, int function)
653{ 651{
654 652
655 return (bus << 16) | (device << 11) | (function << 8); 653 return (bus << 16) | (device << 11) | (function << 8);
656} 654}
657 655
658void 656void
659pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, int *bp, int *dp, int *fp) 657pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag, int *bp, int *dp, int *fp)