Exemplo n.º 1
0
static void *
auich_allocm(void *v, int direction, size_t size)
{
	struct auich_softc *sc;
	struct auich_dma *p;
	int error;

	if (size > (ICH_DMALIST_MAX * ICH_DMASEG_MAX))
		return NULL;

	p = kmem_alloc(sizeof(*p), KM_SLEEP);
	if (p == NULL)
		return NULL;

	sc = v;
	error = auich_allocmem(sc, size, 0, p);
	if (error) {
		kmem_free(p, sizeof(*p));
		return NULL;
	}

	p->next = sc->sc_dmas;
	sc->sc_dmas = p;

	return KERNADDR(p);
}
Exemplo n.º 2
0
static void *
auich_allocm(void *v, int direction, size_t size,
    struct malloc_type *pool, int flags)
{
	struct auich_softc *sc;
	struct auich_dma *p;
	int error;

	if (size > (ICH_DMALIST_MAX * ICH_DMASEG_MAX))
		return NULL;

	p = malloc(sizeof(*p), pool, flags|M_ZERO);
	if (p == NULL)
		return NULL;

	sc = v;
	error = auich_allocmem(sc, size, 0, p);
	if (error) {
		free(p, pool);
		return NULL;
	}

	p->next = sc->sc_dmas;
	sc->sc_dmas = p;

	return KERNADDR(p);
}