malloc(9) -> kmem(9)
This commit is contained in:
parent
0eb2702f38
commit
d206c3458b
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ap_ms104_sh4_intr.c,v 1.3 2019/11/10 21:16:27 chs Exp $ */
|
||||
/* $NetBSD: ap_ms104_sh4_intr.c,v 1.4 2020/11/21 16:21:24 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 2009 NONAKA Kimihiro <nonaka@netbsd.org>
|
||||
|
@ -26,12 +26,12 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ap_ms104_sh4_intr.c,v 1.3 2019/11/10 21:16:27 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ap_ms104_sh4_intr.c,v 1.4 2020/11/21 16:21:24 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <sh3/devreg.h>
|
||||
|
@ -102,7 +102,7 @@ extintr_establish(int irq, int trigger, int level,
|
|||
|
||||
KDASSERT(irq >= 1 && irq <= 14);
|
||||
|
||||
ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
|
||||
ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
|
||||
|
||||
s = _cpu_intr_suspend();
|
||||
|
||||
|
@ -223,7 +223,7 @@ extintr_disestablish(void *cookie)
|
|||
|
||||
evcnt_detach(&ih->ih_evcnt);
|
||||
|
||||
free((void *)ih, M_DEVBUF);
|
||||
kmem_free((void *)ih, sizeof(*ih));
|
||||
|
||||
if (--eih->eih_nih == 0) {
|
||||
uint8_t reg;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: shpcmcia.c,v 1.4 2012/10/27 17:17:51 chs Exp $ */
|
||||
/* $NetBSD: shpcmcia.c,v 1.5 2020/11/21 16:21:24 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 2009 NONAKA Kimihiro <nonaka@netbsd.org>
|
||||
|
@ -26,13 +26,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: shpcmcia.c,v 1.4 2012/10/27 17:17:51 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: shpcmcia.c,v 1.5 2020/11/21 16:21:24 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/kthread.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/callout.h>
|
||||
|
@ -400,9 +400,9 @@ shpcmcia_event_thread(void *arg)
|
|||
break;
|
||||
if (pe2->pe_type == SHPCMCIA_EVENT_INSERT) {
|
||||
SIMPLEQ_REMOVE_HEAD(&h->events, pe_q);
|
||||
free(pe1, M_TEMP);
|
||||
kmem_free(pe1, sizeof(*pe1));
|
||||
SIMPLEQ_REMOVE_HEAD(&h->events, pe_q);
|
||||
free(pe2, M_TEMP);
|
||||
kmem_free(pe2, sizeof(*pe2));
|
||||
}
|
||||
}
|
||||
splx(s);
|
||||
|
@ -425,9 +425,9 @@ shpcmcia_event_thread(void *arg)
|
|||
break;
|
||||
if (pe2->pe_type == SHPCMCIA_EVENT_REMOVE) {
|
||||
SIMPLEQ_REMOVE_HEAD(&h->events, pe_q);
|
||||
free(pe1, M_TEMP);
|
||||
kmem_free(pe1, sizeof(*pe1));
|
||||
SIMPLEQ_REMOVE_HEAD(&h->events, pe_q);
|
||||
free(pe2, M_TEMP);
|
||||
kmem_free(pe2, sizeof(*pe2));
|
||||
}
|
||||
}
|
||||
splx(s);
|
||||
|
@ -441,7 +441,7 @@ shpcmcia_event_thread(void *arg)
|
|||
panic("shpcmcia_event_thread: unknown event %d",
|
||||
pe->pe_type);
|
||||
}
|
||||
free(pe, M_TEMP);
|
||||
kmem_free(pe, sizeof(*pe));
|
||||
}
|
||||
|
||||
h->event_thread = NULL;
|
||||
|
@ -458,7 +458,7 @@ shpcmcia_queue_event(struct shpcmcia_handle *h, int event)
|
|||
struct shpcmcia_event *pe;
|
||||
int s;
|
||||
|
||||
pe = malloc(sizeof(*pe), M_TEMP, M_NOWAIT);
|
||||
pe = kmem_intr_alloc(sizeof(*pe), KM_NOSLEEP);
|
||||
if (pe == NULL)
|
||||
panic("shpcmcia_queue_event: can't allocate event");
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus_dma.c,v 1.4 2015/01/22 03:43:24 nonaka Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.5 2020/11/21 16:21:24 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005 NONAKA Kimihiro <nonaka@netbsd.org>
|
||||
|
@ -26,13 +26,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.4 2015/01/22 03:43:24 nonaka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.5 2020/11/21 16:21:24 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/mbuf.h>
|
||||
#define _EVBSH3_BUS_DMA_PRIVATE
|
||||
#include <sys/bus.h>
|
||||
|
@ -69,6 +69,14 @@ struct _bus_dma_tag evbsh3_bus_dma = {
|
|||
._dmamem_mmap = _bus_dmamem_mmap,
|
||||
};
|
||||
|
||||
static size_t
|
||||
_bus_dmamap_mapsize(int const nsegments)
|
||||
{
|
||||
KASSERT(nsegments > 0);
|
||||
return sizeof(struct _bus_dmamap)
|
||||
+ (sizeof(bus_dma_segment_t) * (nsegments - 1));
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a DMA map.
|
||||
*/
|
||||
|
@ -78,7 +86,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
|||
{
|
||||
bus_dmamap_t map;
|
||||
void *mapstore;
|
||||
size_t mapsize;
|
||||
|
||||
DPRINTF(("%s: t = %p, size = %ld, nsegments = %d, maxsegsz = %ld,"
|
||||
" boundary = %ld, flags = %x\n",
|
||||
|
@ -94,10 +101,8 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
|||
* Preservation of ALLOCNOW notifies others that we've
|
||||
* reserved these resources, and they are not to be freed.
|
||||
*/
|
||||
mapsize = sizeof(struct _bus_dmamap)
|
||||
+ (sizeof(bus_dma_segment_t) * (nsegments - 1));
|
||||
mapstore = malloc(mapsize, M_DMAMAP, M_ZERO
|
||||
| ((flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK));
|
||||
mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
|
||||
(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP);
|
||||
if (mapstore == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
|
@ -126,7 +131,7 @@ _bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
|
|||
|
||||
DPRINTF(("%s: t = %p, map = %p\n", __func__, t, map));
|
||||
|
||||
free(map, M_DMAMAP);
|
||||
kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus_dma.c,v 1.59 2017/05/18 16:34:56 christos Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.60 2020/11/21 16:07:18 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.59 2017/05/18 16:34:56 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.60 2020/11/21 16:07:18 thorpej Exp $");
|
||||
|
||||
#include "opt_cputype.h"
|
||||
|
||||
|
@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.59 2017/05/18 16:34:56 christos Exp $"
|
|||
#include <sys/mbuf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
|
@ -87,6 +88,14 @@ pmax_bus_dma_init(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static size_t
|
||||
_bus_dmamap_mapsize(int const nsegments)
|
||||
{
|
||||
KASSERT(nsegments > 0);
|
||||
return sizeof(struct pmax_bus_dmamap) +
|
||||
(sizeof(bus_dma_segment_t) * (nsegments - 1));
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for DMA map creation. May be called by bus-specific
|
||||
* DMA map creation functions.
|
||||
|
@ -97,7 +106,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
|||
{
|
||||
struct pmax_bus_dmamap *map;
|
||||
void *mapstore;
|
||||
size_t mapsize;
|
||||
|
||||
/*
|
||||
* Allocate and initialize the DMA map. The end of the map
|
||||
|
@ -111,13 +119,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
|||
* The bus_dmamap_t includes one bus_dma_segment_t, hence
|
||||
* the (nsegments - 1).
|
||||
*/
|
||||
mapsize = sizeof(struct pmax_bus_dmamap) +
|
||||
(sizeof(bus_dma_segment_t) * (nsegments - 1));
|
||||
if ((mapstore = malloc(mapsize, M_DMAMAP,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
|
||||
if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
|
||||
(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
memset(mapstore, 0, mapsize);
|
||||
map = (struct pmax_bus_dmamap *)mapstore;
|
||||
map->_dm_size = size;
|
||||
map->_dm_segcnt = nsegments;
|
||||
|
@ -141,7 +146,7 @@ void
|
|||
_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
{
|
||||
|
||||
free(map, M_DMAMAP);
|
||||
kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dt.c,v 1.13 2019/11/10 21:16:31 chs Exp $ */
|
||||
/* $NetBSD: dt.c,v 1.14 2020/11/21 16:07:18 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
|
||||
|
@ -133,7 +133,7 @@ SOFTWARE.
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dt.c,v 1.13 2019/11/10 21:16:31 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dt.c,v 1.14 2020/11/21 16:07:18 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -143,7 +143,7 @@ __KERNEL_RCSID(0, "$NetBSD: dt.c,v 1.13 2019/11/10 21:16:31 chs Exp $");
|
|||
#include <sys/file.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/intr.h>
|
||||
|
||||
#include <dev/dec/lk201.h>
|
||||
|
@ -215,11 +215,11 @@ dt_attach(device_t parent, device_t self, void *aux)
|
|||
|
||||
dt_cninit();
|
||||
|
||||
msg = malloc(sizeof(*msg) * DT_BUF_CNT, M_DEVBUF, M_WAITOK);
|
||||
msg = kmem_alloc(sizeof(*msg) * DT_BUF_CNT, KM_SLEEP);
|
||||
sc->sc_sih = softint_establish(SOFTINT_SERIAL, dt_dispatch, sc);
|
||||
if (sc->sc_sih == NULL) {
|
||||
printf("%s: memory exhausted\n", device_xname(self));
|
||||
free(msg, M_DEVBUF);
|
||||
kmem_free(msg, sizeof(*msg) * DT_BUF_CNT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: gten.c,v 1.21 2019/11/10 21:16:31 chs Exp $ */
|
||||
/* $NetBSD: gten.c,v 1.22 2020/11/21 15:59:53 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: gten.c,v 1.21 2019/11/10 21:16:31 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: gten.c,v 1.22 2020/11/21 15:59:53 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -38,7 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: gten.c,v 1.21 2019/11/10 21:16:31 chs Exp $");
|
|||
#include <sys/device.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
@ -139,8 +139,8 @@ gten_attach(device_t parent, device_t self, void *aux)
|
|||
gt->gt_ri = >en_console_ri;
|
||||
gt->gt_nscreens = 1;
|
||||
} else {
|
||||
gt->gt_ri = malloc(sizeof(*gt->gt_ri),
|
||||
M_DEVBUF, M_WAITOK|M_ZERO);
|
||||
gt->gt_ri = kmem_zalloc(sizeof(*gt->gt_ri),
|
||||
KM_SLEEP);
|
||||
#if 0
|
||||
error = pci_mapreg_map(pa, 0x14,
|
||||
PCI_MAPREG_TYPE_MEM|PCI_MAPREG_MEM_TYPE_32BIT,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pci_machdep.c,v 1.43 2019/11/10 21:16:31 chs Exp $ */
|
||||
/* $NetBSD: pci_machdep.c,v 1.44 2020/11/21 15:59:53 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.43 2019/11/10 21:16:31 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.44 2020/11/21 15:59:53 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -48,7 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.43 2019/11/10 21:16:31 chs Exp $")
|
|||
#include <sys/errno.h>
|
||||
#include <sys/extent.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
|
@ -323,8 +323,8 @@ prep_pci_conf_hook(void *v, int bus, int dev, int func, pcireg_t id)
|
|||
*/
|
||||
if (PCI_CLASS(class) == PCI_CLASS_BRIDGE &&
|
||||
PCI_SUBCLASS(class) == PCI_SUBCLASS_BRIDGE_PCI) {
|
||||
pbi = malloc(sizeof(struct genppc_pci_chipset_businfo),
|
||||
M_DEVBUF, M_WAITOK);
|
||||
pbi = kmem_alloc(sizeof(struct genppc_pci_chipset_businfo),
|
||||
KM_SLEEP);
|
||||
pbi->pbi_properties = prop_dictionary_create();
|
||||
KASSERT(pbi->pbi_properties != NULL);
|
||||
setup_pciintr_map(pbi, bus, dev, func);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pnpbus.c,v 1.12 2019/11/10 21:16:32 chs Exp $ */
|
||||
/* $NetBSD: pnpbus.c,v 1.13 2020/11/21 15:59:53 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -30,13 +30,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pnpbus.c,v 1.12 2019/11/10 21:16:32 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pnpbus.c,v 1.13 2020/11/21 15:59:53 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/extent.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <machine/pio.h>
|
||||
|
@ -102,7 +102,7 @@ pnp_newirq(void *v, struct pnpresources *r, int size)
|
|||
struct _S4_Pack *p = v;
|
||||
struct pnpbus_irq *irq;
|
||||
|
||||
irq = malloc(sizeof(struct pnpbus_irq), M_DEVBUF, M_WAITOK);
|
||||
irq = kmem_alloc(sizeof(struct pnpbus_irq), KM_SLEEP);
|
||||
|
||||
irq->mask = le16dec(&p->IRQMask[0]);
|
||||
|
||||
|
@ -123,7 +123,7 @@ pnp_newdma(void *v, struct pnpresources *r, int size)
|
|||
struct _S5_Pack *p = v;
|
||||
struct pnpbus_dma *dma;
|
||||
|
||||
dma = malloc(sizeof(struct pnpbus_dma), M_DEVBUF, M_WAITOK);
|
||||
dma = kmem_alloc(sizeof(struct pnpbus_dma), KM_SLEEP);
|
||||
|
||||
dma->mask = le16dec(&p->DMAMask);
|
||||
if (size > 2)
|
||||
|
@ -144,7 +144,7 @@ pnp_newioport(void *v, struct pnpresources *r, int size)
|
|||
struct pnpbus_io *io;
|
||||
uint16_t mask;
|
||||
|
||||
io = malloc(sizeof(struct pnpbus_io), M_DEVBUF, M_WAITOK);
|
||||
io = kmem_alloc(sizeof(struct pnpbus_io), KM_SLEEP);
|
||||
mask = p->IOInfo & ISAAddr16bit ? 0xffff : 0x03ff;
|
||||
io->minbase = (p->RangeMin[0] | (p->RangeMin[1] << 8)) & mask;
|
||||
io->maxbase = (p->RangeMax[0] | (p->RangeMax[1] << 8)) & mask;
|
||||
|
@ -164,7 +164,7 @@ pnp_newfixedioport(void *v, struct pnpresources *r, int size)
|
|||
struct _S9_Pack *p = v;
|
||||
struct pnpbus_io *io;
|
||||
|
||||
io = malloc(sizeof(struct pnpbus_io), M_DEVBUF, M_WAITOK);
|
||||
io = kmem_alloc(sizeof(struct pnpbus_io), KM_SLEEP);
|
||||
io->minbase = (p->Range[0] | (p->Range[1] << 8)) & 0x3ff;
|
||||
io->len = p->IONum;
|
||||
io->maxbase = -1;
|
||||
|
@ -184,7 +184,7 @@ pnp_newiomem(void *v, struct pnpresources *r, int size)
|
|||
struct _L1_Pack *pack = v;
|
||||
|
||||
if (pack->Count0 >= 0x9) {
|
||||
mem = malloc(sizeof(struct pnpbus_mem), M_DEVBUF, M_WAITOK);
|
||||
mem = kmem_alloc(sizeof(struct pnpbus_mem), KM_SLEEP);
|
||||
mem->minbase = (pack->Data[2] << 16) | (pack->Data[1] << 8);
|
||||
mem->maxbase = (pack->Data[4] << 16) | (pack->Data[3] << 8);
|
||||
mem->align = (pack->Data[6] << 8) | pack->Data[5];
|
||||
|
@ -206,7 +206,7 @@ pnp_newaddr(void *v, struct pnpresources *r, int size)
|
|||
struct _L4_PPCPack *p = &pack->L4_Data.L4_PPCPack;
|
||||
|
||||
if (p->PPCData[0] == 1) {/* type IO */
|
||||
io = malloc(sizeof(struct pnpbus_io), M_DEVBUF, M_WAITOK);
|
||||
io = kmem_alloc(sizeof(struct pnpbus_io), KM_SLEEP);
|
||||
io->minbase = (uint16_t)le64dec(&p->PPCData[4]);
|
||||
io->maxbase = -1;
|
||||
io->align = p->PPCData[1];
|
||||
|
@ -217,7 +217,7 @@ pnp_newaddr(void *v, struct pnpresources *r, int size)
|
|||
|
||||
return 0;
|
||||
} else if (p->PPCData[0] == 2) {
|
||||
mem = malloc(sizeof(struct pnpbus_mem), M_DEVBUF, M_WAITOK);
|
||||
mem = kmem_alloc(sizeof(struct pnpbus_mem), KM_SLEEP);
|
||||
mem->minbase = (uint32_t)le64dec(&p->PPCData[4]);
|
||||
mem->maxbase = -1;
|
||||
mem->align = p->PPCData[1];
|
||||
|
@ -238,7 +238,7 @@ pnp_newcompatid(void *v, struct pnpresources *r, int size)
|
|||
struct pnpbus_compatid *id;
|
||||
uint32_t cid;
|
||||
|
||||
id = malloc(sizeof(*id), M_DEVBUF, M_WAITOK);
|
||||
id = kmem_alloc(sizeof(*id), KM_SLEEP);
|
||||
cid = le32dec(p->CompatId);
|
||||
pnp_devid_to_string(cid, id->idstr);
|
||||
id->next = r->compatids;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mainbus.c,v 1.37 2020/07/07 03:38:48 thorpej Exp $ */
|
||||
/* $NetBSD: mainbus.c,v 1.38 2020/11/21 15:59:53 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.37 2020/07/07 03:38:48 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.38 2020/11/21 15:59:53 thorpej Exp $");
|
||||
|
||||
#include "opt_pci.h"
|
||||
#include "opt_residual.h"
|
||||
|
@ -43,7 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.37 2020/07/07 03:38:48 thorpej Exp $")
|
|||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <sys/bus.h>
|
||||
|
@ -130,12 +130,10 @@ mainbus_attach(device_t parent, device_t self, void *aux)
|
|||
* XXX that's not currently possible.
|
||||
*/
|
||||
#if NPCI > 0
|
||||
genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF,
|
||||
M_WAITOK);
|
||||
genppc_pct = kmem_alloc(sizeof(struct genppc_pci_chipset), KM_SLEEP);
|
||||
prep_pci_get_chipset_tag(genppc_pct);
|
||||
|
||||
pbi = malloc(sizeof(struct genppc_pci_chipset_businfo),
|
||||
M_DEVBUF, M_WAITOK);
|
||||
pbi = kmem_alloc(sizeof(struct genppc_pci_chipset_businfo), KM_SLEEP);
|
||||
pbi->pbi_properties = prop_dictionary_create();
|
||||
KASSERT(pbi->pbi_properties != NULL);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mca_machdep.c,v 1.4 2011/07/18 17:26:56 dyoung Exp $ */
|
||||
/* $NetBSD: mca_machdep.c,v 1.5 2020/11/21 15:52:32 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -36,12 +36,12 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mca_machdep.c,v 1.4 2011/07/18 17:26:56 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mca_machdep.c,v 1.5 2020/11/21 15:52:32 thorpej Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -381,8 +381,8 @@ mca_dmamap_create(bus_dma_tag_t t, bus_size_t size, int flags,
|
|||
/*
|
||||
* Allocate our cookie if not yet done.
|
||||
*/
|
||||
cookie = malloc(sizeof(struct rs6000_dma_cookie), M_DMAMAP,
|
||||
((flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK) | M_ZERO);
|
||||
cookie = kmem_zalloc(sizeof(struct rs6000_dma_cookie),
|
||||
((flags & BUS_DMA_NOWAIT) ? KM_SLEEP : KM_NOSLEEP));
|
||||
if (cookie == NULL) {
|
||||
|
||||
return ENOMEM;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mcadma_machdep.c,v 1.3 2011/07/18 17:26:56 dyoung Exp $ */
|
||||
/* $NetBSD: mcadma_machdep.c,v 1.4 2020/11/21 15:52:32 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -30,13 +30,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mcadma_machdep.c,v 1.3 2011/07/18 17:26:56 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mcadma_machdep.c,v 1.4 2020/11/21 15:52:32 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/mbuf.h>
|
||||
|
||||
|
@ -116,8 +116,8 @@ _mca_bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int flags,
|
|||
/*
|
||||
* Allocate our cookie if not yet done.
|
||||
*/
|
||||
cookie = malloc(sizeof(struct rs6000_dma_cookie), M_DMAMAP,
|
||||
((flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK) | M_ZERO);
|
||||
cookie = kmem_zalloc(sizeof(struct rs6000_dma_cookie),
|
||||
((flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP));
|
||||
if (cookie == NULL) {
|
||||
|
||||
return ENOMEM;
|
||||
|
@ -143,7 +143,7 @@ _mca_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
|
|||
{
|
||||
struct rs6000_dma_cookie *cookie = map->_dm_cookie;
|
||||
|
||||
free(cookie, M_DMAMAP);
|
||||
kmem_free(cookie, sizeof(struct rs6000_dma_cookie));
|
||||
_bus_dmamap_destroy(t, map);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pic_iocc.c,v 1.5 2019/11/10 21:16:32 chs Exp $ */
|
||||
/* $NetBSD: pic_iocc.c,v 1.6 2020/11/21 15:52:32 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -30,10 +30,10 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: pic_iocc.c,v 1.5 2019/11/10 21:16:32 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pic_iocc.c,v 1.6 2020/11/21 15:52:32 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
|
@ -59,7 +59,7 @@ setup_iocc(void)
|
|||
struct pic_ops *pic;
|
||||
int i;
|
||||
|
||||
pic = malloc(sizeof(struct pic_ops), M_DEVBUF, M_WAITOK);
|
||||
pic = kmem_alloc(sizeof(struct pic_ops), KM_SLEEP);
|
||||
pic->pic_numintrs = 16;
|
||||
pic->pic_cookie = (void *)NULL;
|
||||
pic->pic_enable_irq = iocc_enable_irq;
|
||||
|
|
Loading…
Reference in New Issue