* USB device drivers use M_USBDEV instead of M_DEVBUF.
* USB HC drivers use M_USBHC instead of M_DEVBUF.
In a vanilla setup, this enlarges the USB memory pool.
ok anton@
-/* $OpenBSD: ehci.c,v 1.215 2021/10/26 16:29:49 deraadt Exp $ */
+/* $OpenBSD: ehci.c,v 1.216 2021/11/22 10:17:14 mglocker Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
return (err);
if (ehcixfer == NULL) {
- ehcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT);
+ ehcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT);
if (ehcixfer == NULL) {
printf("%s: unable to allocate pool descriptor\n",
sc->sc_bus.bdev.dv_xname);
-/* $OpenBSD: if_athn_usb.c,v 1.62 2021/10/31 12:24:02 stsp Exp $ */
+/* $OpenBSD: if_athn_usb.c,v 1.63 2021/11/22 10:17:14 mglocker Exp $ */
/*-
* Copyright (c) 2011 Damien Bergamini <damien.bergamini@free.fr>
{
struct athn_node *an;
- an = malloc(sizeof(struct athn_node), M_DEVBUF, M_NOWAIT | M_ZERO);
+ an = malloc(sizeof(struct athn_node), M_USBDEV, M_NOWAIT | M_ZERO);
return (struct ieee80211_node *)an;
}
-/* $OpenBSD: if_otus.c,v 1.69 2021/02/25 02:48:20 dlg Exp $ */
+/* $OpenBSD: if_otus.c,v 1.70 2021/11/22 10:17:14 mglocker Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
struct ieee80211_node *
otus_node_alloc(struct ieee80211com *ic)
{
- return malloc(sizeof (struct otus_node), M_DEVBUF, M_NOWAIT | M_ZERO);
+ return malloc(sizeof (struct otus_node), M_USBDEV, M_NOWAIT | M_ZERO);
}
int
-/* $OpenBSD: if_run.c,v 1.134 2021/11/01 12:08:46 krw Exp $ */
+/* $OpenBSD: if_run.c,v 1.135 2021/11/22 10:17:14 mglocker Exp $ */
/*-
* Copyright (c) 2008-2010 Damien Bergamini <damien.bergamini@free.fr>
struct ieee80211_node *
run_node_alloc(struct ieee80211com *ic)
{
- return malloc(sizeof (struct run_node), M_DEVBUF, M_NOWAIT | M_ZERO);
+ return malloc(sizeof (struct run_node), M_USBDEV, M_NOWAIT | M_ZERO);
}
int
-/* $OpenBSD: if_wi_usb.c,v 1.74 2021/08/09 07:21:48 jmatthew Exp $ */
+/* $OpenBSD: if_wi_usb.c,v 1.75 2021/11/22 10:17:14 mglocker Exp $ */
/*
* Copyright (c) 2003 Dale Rahn. All rights reserved.
while (sc->wi_usb_nummem) {
sc->wi_usb_nummem--;
- free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_DEVBUF,
+ free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_USBDEV,
sc->wi_usb_txmemsize[sc->wi_usb_nummem]);
sc->wi_usb_txmem[sc->wi_usb_nummem] = NULL;
sc->wi_usb_txmemsize[sc->wi_usb_nummem] = 0;
/* free alloc_nicmem regions */
while (sc->wi_usb_nummem) {
sc->wi_usb_nummem--;
- free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_DEVBUF,
+ free(sc->wi_usb_txmem[sc->wi_usb_nummem], M_USBDEV,
sc->wi_usb_txmemsize[sc->wi_usb_nummem]);
sc->wi_usb_txmem[sc->wi_usb_nummem] = NULL;
sc->wi_usb_txmemsize[sc->wi_usb_nummem] = 0;
return ENOMEM;
}
- sc->wi_usb_txmem[nmem] = malloc(len, M_DEVBUF, M_WAITOK | M_CANFAIL);
+ sc->wi_usb_txmem[nmem] = malloc(len, M_USBDEV, M_WAITOK | M_CANFAIL);
if (sc->wi_usb_txmem[nmem] == NULL) {
sc->wi_usb_nummem--;
return ENOMEM;
struct wi_usb_thread_info *wi_thread_info;
int s;
- wi_thread_info = malloc(sizeof(*wi_thread_info), M_DEVBUF, M_WAITOK);
+ wi_thread_info = malloc(sizeof(*wi_thread_info), M_USBDEV, M_WAITOK);
/*
* is there a remote possibility that the device could
-/* $OpenBSD: if_zyd.c,v 1.125 2020/07/31 10:49:33 mglocker Exp $ */
+/* $OpenBSD: if_zyd.c,v 1.126 2021/11/22 10:17:14 mglocker Exp $ */
/*-
* Copyright (c) 2006 by Damien Bergamini <damien.bergamini@free.fr>
struct ieee80211_node *
zyd_node_alloc(struct ieee80211com *ic)
{
- return malloc(sizeof (struct zyd_node), M_DEVBUF, M_NOWAIT | M_ZERO);
+ return malloc(sizeof (struct zyd_node), M_USBDEV, M_NOWAIT | M_ZERO);
}
int
-/* $OpenBSD: ohci.c,v 1.162 2021/10/26 16:29:49 deraadt Exp $ */
+/* $OpenBSD: ohci.c,v 1.163 2021/11/22 10:17:14 mglocker Exp $ */
/* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
LIST_INIT(&sc->sc_hash_itds[i]);
if (ohcixfer == NULL) {
- ohcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT);
+ ohcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT);
if (ohcixfer == NULL) {
printf("%s: unable to allocate pool descriptor\n",
sc->sc_bus.bdev.dv_xname);
-/* $OpenBSD: uaudio.c,v 1.161 2021/05/18 10:02:00 ratchov Exp $ */
+/* $OpenBSD: uaudio.c,v 1.162 2021/11/22 10:17:14 mglocker Exp $ */
/*
* Copyright (c) 2018 Alexandre Ratchov <alex@caoua.org>
*
while (1) {
if (n == NULL) {
n = malloc(sizeof(struct uaudio_name),
- M_DEVBUF, M_WAITOK);
+ M_USBDEV, M_WAITOK);
n->templ = templ;
n->unit = 0;
n->next = sc->names;
/* XXX: use 'res' here */
r->nval += max - min + 1;
- e = malloc(sizeof(struct uaudio_ranges_el), M_DEVBUF, M_WAITOK);
+ e = malloc(sizeof(struct uaudio_ranges_el), M_USBDEV, M_WAITOK);
e->min = min;
e->max = max;
e->res = res;
while ((e = r->el) != NULL) {
r->el = e->next;
- free(e, M_DEVBUF, sizeof(struct uaudio_ranges_el));
+ free(e, M_USBDEV, sizeof(struct uaudio_ranges_el));
}
r->nval = 0;
}
if (sizeof(req_buf) >= req_size)
req = req_buf;
else
- req = malloc(req_size, M_DEVBUF, M_WAITOK);
+ req = malloc(req_size, M_USBDEV, M_WAITOK);
p.rptr = p.wptr = req;
if (!uaudio_req(sc, UT_READ_CLASS_INTERFACE,
}
if (req != req_buf)
- free(req, M_DEVBUF, req_size);
+ free(req, M_USBDEV, req_size);
return 1;
}
return;
}
- m = malloc(sizeof(struct uaudio_mixent), M_DEVBUF, M_WAITOK);
+ m = malloc(sizeof(struct uaudio_mixent), M_USBDEV, M_WAITOK);
m->chan = chan;
m->fname = features[uac_type].name;
m->type = features[uac_type].mix_type;
&m->ranges)) {
printf("%s: failed to get ranges for %s control\n",
DEVNAME(sc), m->fname);
- free(m, M_DEVBUF, sizeof(struct uaudio_mixent));
+ free(m, M_USBDEV, sizeof(struct uaudio_mixent));
return;
}
if (m->ranges.el == NULL) {
printf("%s: skipped %s control with empty range\n",
DEVNAME(sc), m->fname);
- free(m, M_DEVBUF, sizeof(struct uaudio_mixent));
+ free(m, M_USBDEV, sizeof(struct uaudio_mixent));
return;
}
#ifdef UAUDIO_DEBUG
if (cmp == 0) {
DPRINTF("%02u: %s.%s: duplicate feature for chan %d\n",
u->id, u->name, m->fname, m->chan);
- free(m, M_DEVBUF, sizeof(struct uaudio_mixent));
+ free(m, M_USBDEV, sizeof(struct uaudio_mixent));
return;
}
if (cmp > 0)
*/
u = uaudio_unit_byid(sc, id);
if (u == NULL) {
- u = malloc(sizeof(struct uaudio_unit), M_DEVBUF, M_WAITOK);
+ u = malloc(sizeof(struct uaudio_unit), M_USBDEV, M_WAITOK);
u->id = id;
u->type = subtype;
u->term = 0;
unsigned int type, subtype;
int ispcm = 0;
- a = malloc(sizeof(struct uaudio_alt), M_DEVBUF, M_WAITOK);
+ a = malloc(sizeof(struct uaudio_alt), M_USBDEV, M_WAITOK);
a->mode = 0;
a->nch = 0;
a->v1_rates = 0;
}
if (!ispcm) {
DPRINTF("%s: non-pcm iface\n", __func__);
- free(a, M_DEVBUF, sizeof(struct uaudio_alt));
+ free(a, M_USBDEV, sizeof(struct uaudio_alt));
return 1;
}
}
if (a->mode == 0) {
printf("%s: no data endpoints found\n", DEVNAME(sc));
- free(a, M_DEVBUF, sizeof(struct uaudio_alt));
+ free(a, M_USBDEV, sizeof(struct uaudio_alt));
return 1;
}
*pa = a;
return 1;
failed:
- free(a, M_DEVBUF, sizeof(struct uaudio_alt));
+ free(a, M_USBDEV, sizeof(struct uaudio_alt));
return 0;
}
break;
}
p = malloc(sizeof(struct uaudio_params),
- M_DEVBUF, M_WAITOK);
+ M_USBDEV, M_WAITOK);
p->palt = ap;
p->ralt = ar;
p->v1_rates = rates;
if (sc->params_list == NULL) {
for (a = sc->alts; a != NULL; a = a->next) {
p = malloc(sizeof(struct uaudio_params),
- M_DEVBUF, M_WAITOK);
+ M_USBDEV, M_WAITOK);
if (a->mode == AUMODE_PLAY) {
p->palt = a;
p->ralt = NULL;
return ENOMEM;
xfer->sizes = mallocarray(count,
- sizeof(xfer->sizes[0]), M_DEVBUF, M_WAITOK);
+ sizeof(xfer->sizes[0]), M_USBDEV, M_WAITOK);
if (xfer->sizes == NULL)
return ENOMEM;
xfer->usb_xfer = NULL;
}
if (xfer->sizes != NULL) {
- free(xfer->sizes, M_DEVBUF,
+ free(xfer->sizes, M_USBDEV,
sizeof(xfer->sizes[0]) * count);
xfer->sizes = NULL;
}
while ((alt = sc->alts) != NULL) {
sc->alts = alt->next;
- free(alt, M_DEVBUF, sizeof(struct uaudio_alt));
+ free(alt, M_USBDEV, sizeof(struct uaudio_alt));
}
while ((params = sc->params_list) != NULL) {
sc->params_list = params->next;
- free(params, M_DEVBUF, sizeof(struct uaudio_params));
+ free(params, M_USBDEV, sizeof(struct uaudio_params));
}
while ((unit = sc->unit_list) != NULL) {
while ((mixent = unit->mixent_list) != NULL) {
unit->mixent_list = mixent->next;
uaudio_ranges_clear(&mixent->ranges);
- free(mixent, M_DEVBUF, sizeof(struct uaudio_mixent));
+ free(mixent, M_USBDEV, sizeof(struct uaudio_mixent));
}
uaudio_ranges_clear(&unit->rates);
- free(unit, M_DEVBUF, sizeof(struct uaudio_unit));
+ free(unit, M_USBDEV, sizeof(struct uaudio_unit));
}
while ((name = sc->names)) {
sc->names = name->next;
- free(name, M_DEVBUF, sizeof(struct uaudio_name));
+ free(name, M_USBDEV, sizeof(struct uaudio_name));
}
return rv;
-/* $OpenBSD: udl.c,v 1.95 2021/10/27 09:09:55 jasper Exp $ */
+/* $OpenBSD: udl.c,v 1.96 2021/11/22 10:17:14 mglocker Exp $ */
/*
* Copyright (c) 2009 Marcus Glocker <mglocker@openbsd.org>
/* allocate character backing store */
sc->sc_cbs = mallocarray(sc->sc_ri.ri_rows, sc->sc_ri.ri_cols *
- sizeof(*sc->sc_cbs), M_DEVBUF, M_NOWAIT|M_ZERO);
+ sizeof(*sc->sc_cbs), M_USBDEV, M_NOWAIT|M_ZERO);
if (sc->sc_cbs == NULL) {
printf("%s: can't allocate mem for character backing store!\n",
DN(sc));
/* free character backing store */
if (sc->sc_cbs != NULL)
- free(sc->sc_cbs, M_DEVBUF, sc->sc_cbslen);
+ free(sc->sc_cbs, M_USBDEV, sc->sc_cbslen);
sc->sc_nscreens--;
}
udl_free_huffman(struct udl_softc *sc)
{
if (sc->sc_huffman != NULL) {
- free(sc->sc_huffman, M_DEVBUF, sc->sc_huffman_size);
+ free(sc->sc_huffman, M_USBDEV, sc->sc_huffman_size);
sc->sc_huffman = NULL;
sc->sc_huffman_size = 0;
DPRINTF(1, "%s: huffman table freed\n", DN(sc));
size = round_page(size);
if (sc->sc_fbmem == NULL) {
- sc->sc_fbmem = malloc(size, M_DEVBUF, M_NOWAIT|M_ZERO);
+ sc->sc_fbmem = malloc(size, M_USBDEV, M_NOWAIT|M_ZERO);
if (sc->sc_fbmem == NULL)
return (-1);
}
udl_fbmem_free(struct udl_softc *sc)
{
if (sc->sc_fbmem != NULL) {
- free(sc->sc_fbmem, M_DEVBUF, sc->sc_fbmemsize);
+ free(sc->sc_fbmem, M_USBDEV, sc->sc_fbmemsize);
sc->sc_fbmem = NULL;
sc->sc_fbmemsize = 0;
}
{
struct udl_cmd_buf *cb = &sc->sc_cmd_buf;
- cb->buf = malloc(UDL_CMD_MAX_XFER_SIZE, M_DEVBUF, M_NOWAIT|M_ZERO);
+ cb->buf = malloc(UDL_CMD_MAX_XFER_SIZE, M_USBDEV, M_NOWAIT|M_ZERO);
if (cb->buf == NULL) {
printf("%s: %s: can't allocate buffer!\n",
DN(sc), FUNC);
struct udl_cmd_buf *cb = &sc->sc_cmd_buf;
if (cb->buf != NULL) {
- free(cb->buf, M_DEVBUF, UDL_CMD_MAX_XFER_SIZE);
+ free(cb->buf, M_USBDEV, UDL_CMD_MAX_XFER_SIZE);
cb->buf = NULL;
}
cb->off = 0;
-/* $OpenBSD: uhci.c,v 1.153 2021/10/26 16:29:49 deraadt Exp $ */
+/* $OpenBSD: uhci.c,v 1.154 2021/11/22 10:17:14 mglocker Exp $ */
/* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
uhci_reset(sc);
if (uhcixfer == NULL) {
- uhcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT);
+ uhcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT);
if (uhcixfer == NULL) {
printf("%s: unable to allocate pool descriptor\n",
sc->sc_bus.bdev.dv_xname);
-/* $OpenBSD: umass_scsi.c,v 1.61 2020/09/22 19:32:53 krw Exp $ */
+/* $OpenBSD: umass_scsi.c,v 1.62 2021/11/22 10:17:14 mglocker Exp $ */
/* $NetBSD: umass_scsipi.c,v 1.9 2003/02/16 23:14:08 augustss Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
struct umass_scsi_softc *scbus;
u_int16_t flags = 0;
- scbus = malloc(sizeof(*scbus), M_DEVBUF, M_WAITOK | M_ZERO);
+ scbus = malloc(sizeof(*scbus), M_USBDEV, M_WAITOK | M_ZERO);
sc->bus = scbus;
if (scbus != NULL) {
if (scbus->sc_child != NULL)
rv = config_detach(scbus->sc_child, flags);
- free(scbus, M_DEVBUF, sizeof(*scbus));
+ free(scbus, M_USBDEV, sizeof(*scbus));
sc->bus = NULL;
}
-/* $OpenBSD: utvfu.c,v 1.11 2020/07/31 10:49:33 mglocker Exp $ */
+/* $OpenBSD: utvfu.c,v 1.12 2021/11/22 10:17:14 mglocker Exp $ */
/*
* Copyright (c) 2013 Lubomir Rintel
* Copyright (c) 2013 Federico Simoncelli
struct utvfu_frame_buf *fb = &sc->sc_fb;
fb->size = sc->sc_max_frame_sz;
- fb->buf = malloc(fb->size, M_DEVBUF, M_NOWAIT);
+ fb->buf = malloc(fb->size, M_USBDEV, M_NOWAIT);
if (fb->buf == NULL) {
printf("%s: can't allocate frame buffer!\n", DEVNAME(sc));
return (ENOMEM);
struct utvfu_frame_buf *fb = &sc->sc_fb;
if (fb->buf != NULL) {
- free(fb->buf, M_DEVBUF, fb->size);
+ free(fb->buf, M_USBDEV, fb->size);
fb->buf = NULL;
}
if (sc->sc_mmap_buffer != NULL) {
- free(sc->sc_mmap_buffer, M_DEVBUF, sc->sc_mmap_bufsz);
+ free(sc->sc_mmap_buffer, M_USBDEV, sc->sc_mmap_bufsz);
sc->sc_mmap_buffer = NULL;
memset(sc->sc_mmap, 0, sizeof(sc->sc_mmap));
}
return (ENOMEM);
sc->sc_mmap_bufsz *= sc->sc_mmap_count;
sc->sc_mmap_bufsz = round_page(sc->sc_mmap_bufsz); /* page align */
- sc->sc_mmap_buffer = malloc(sc->sc_mmap_bufsz, M_DEVBUF, M_NOWAIT);
+ sc->sc_mmap_buffer = malloc(sc->sc_mmap_bufsz, M_USBDEV, M_NOWAIT);
if (sc->sc_mmap_buffer == NULL) {
printf("%s: can't allocate mmap buffer!\n", DEVNAME(sc));
return (ENOMEM);
-/* $OpenBSD: uvideo.c,v 1.213 2021/05/31 21:06:48 mglocker Exp $ */
+/* $OpenBSD: uvideo.c,v 1.214 2021/11/22 10:17:14 mglocker Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
return (USBD_NOMEM);
}
- fb->buf = malloc(fb->buf_size, M_DEVBUF, M_NOWAIT);
+ fb->buf = malloc(fb->buf_size, M_USBDEV, M_NOWAIT);
if (fb->buf == NULL) {
printf("%s: can't allocate frame buffer!\n", DEVNAME(sc));
return (USBD_NOMEM);
struct uvideo_frame_buffer *fb = &sc->sc_frame_buffer;
if (fb->buf != NULL) {
- free(fb->buf, M_DEVBUF, fb->buf_size);
+ free(fb->buf, M_USBDEV, fb->buf_size);
fb->buf = NULL;
}
if (sc->sc_mmap_buffer != NULL) {
- free(sc->sc_mmap_buffer, M_DEVBUF, sc->sc_mmap_buffer_size);
+ free(sc->sc_mmap_buffer, M_USBDEV, sc->sc_mmap_buffer_size);
sc->sc_mmap_buffer = NULL;
sc->sc_mmap_buffer_size = 0;
}
}
buf_size_total = sc->sc_mmap_count * buf_size;
buf_size_total = round_page(buf_size_total); /* page align buffer */
- sc->sc_mmap_buffer = malloc(buf_size_total, M_DEVBUF, M_NOWAIT);
+ sc->sc_mmap_buffer = malloc(buf_size_total, M_USBDEV, M_NOWAIT);
if (sc->sc_mmap_buffer == NULL) {
printf("%s: can't allocate mmap buffer!\n", DEVNAME(sc));
sc->sc_mmap_count = 0;
-/* $OpenBSD: xhci.c,v 1.122 2021/10/26 16:29:49 deraadt Exp $ */
+/* $OpenBSD: xhci.c,v 1.123 2021/11/22 10:17:14 mglocker Exp $ */
/*
* Copyright (c) 2014-2015 Martin Pieuchot
return (error);
if (xhcixfer == NULL) {
- xhcixfer = malloc(sizeof(struct pool), M_DEVBUF, M_NOWAIT);
+ xhcixfer = malloc(sizeof(struct pool), M_USBHC, M_NOWAIT);
if (xhcixfer == NULL) {
printf("%s: unable to allocate pool descriptor\n",
DEVNAME(sc));