|
FreeBSD kernel kern code
|
#include <sys/cdefs.h>#include <sys/param.h>#include <sys/lock.h>#include <sys/mutex.h>#include <sys/kernel.h>#include <sys/systm.h>#include <sys/malloc.h>#include <sys/module.h>#include <machine/bus.h>#include <sys/mbpool.h>
Go to the source code of this file.
Data Structures | |
| struct | mbtrail |
| struct | mbfree |
| struct | mbpage |
| struct | mbpool |
Macros | |
| #define | MBP_CARD 0x8000 |
| #define | MBP_USED 0x4000 |
| #define | MBP_PMSK 0x3fff /* page number mask */ |
| #define | MBP_CMSK 0x01ff /* chunk number mask */ |
| #define | C2T(P, C) |
| #define | N2C(P, PG, C) |
| #define | HMAKE(P, C) ((((P) & MBP_PMSK) << 16) | ((C) << 7)) |
| #define | HPAGE(H) (((H) >> 16) & MBP_PMSK) |
| #define | HCHUNK(H) (((H) >> 7) & MBP_CMSK) |
Functions | |
| __FBSDID ("$BSDSUniX$") | |
| MODULE_VERSION (libmbpool, 1) | |
| static | MALLOC_DEFINE (M_MBPOOL,"mbpools","mbuf pools") |
| int | mbp_create (struct mbpool **pp, const char *name, bus_dma_tag_t dmat, u_int max_pages, size_t page_size, size_t chunk_size) |
| void | mbp_destroy (struct mbpool *p) |
| static void | mbp_callback (void *arg, bus_dma_segment_t *segs, int nsegs, int error) |
| static void | mbp_alloc_page (struct mbpool *p) |
| void * | mbp_alloc (struct mbpool *p, bus_addr_t *pap, uint32_t *hp) |
| void | mbp_free (struct mbpool *p, void *ptr) |
| void | mbp_ext_free (void *buf, void *arg) |
| void | mbp_card_free (struct mbpool *p) |
| void | mbp_count (struct mbpool *p, u_int *used, u_int *card, u_int *free) |
| void * | mbp_get (struct mbpool *p, uint32_t h) |
| void * | mbp_get_keep (struct mbpool *p, uint32_t h) |
| void | mbp_sync (struct mbpool *p, uint32_t h, bus_addr_t off, bus_size_t len, u_int op) |
| #define C2T | ( | P, | |
| C | |||
| ) |
Definition at line 98 of file subr_mbpool.c.
Referenced by mbp_alloc(), mbp_alloc_page(), mbp_card_free(), mbp_count(), mbp_destroy(), mbp_free(), mbp_get(), and mbp_get_keep().
Definition at line 112 of file subr_mbpool.c.
Referenced by mbp_get(), mbp_get_keep(), and mbp_sync().
| #define HMAKE | ( | P, | |
| C | |||
| ) | ((((P) & MBP_PMSK) << 16) | ((C) << 7)) |
Definition at line 110 of file subr_mbpool.c.
Referenced by mbp_alloc().
Definition at line 111 of file subr_mbpool.c.
Referenced by mbp_get(), mbp_get_keep(), and mbp_sync().
| #define MBP_CARD 0x8000 |
Definition at line 64 of file subr_mbpool.c.
Referenced by mbp_alloc(), mbp_card_free(), mbp_count(), mbp_destroy(), mbp_free(), mbp_get(), and mbp_get_keep().
| #define MBP_CMSK 0x01ff /* chunk number mask */ |
Definition at line 67 of file subr_mbpool.c.
| #define MBP_PMSK 0x3fff /* page number mask */ |
Definition at line 66 of file subr_mbpool.c.
Referenced by mbp_card_free().
| #define MBP_USED 0x4000 |
Definition at line 65 of file subr_mbpool.c.
Referenced by mbp_alloc(), mbp_count(), mbp_destroy(), and mbp_free().
| #define N2C | ( | P, | |
| PG, | |||
| C | |||
| ) |
Definition at line 104 of file subr_mbpool.c.
Referenced by mbp_alloc_page(), mbp_card_free(), mbp_count(), mbp_destroy(), mbp_get(), and mbp_get_keep().
| __FBSDID | ( | "$BSDSUniX$" | ) |
|
static |
| void* mbp_alloc | ( | struct mbpool * | p, |
| bus_addr_t * | pap, | ||
| uint32_t * | hp | ||
| ) |
Definition at line 237 of file subr_mbpool.c.
References C2T, mbtrail::chunk, mbpool::chunk_size, mbpool::free_lock, HMAKE, mbp_alloc_page(), MBP_CARD, MBP_USED, and mbtrail::page.

|
static |
Definition at line 194 of file subr_mbpool.c.
References bus_dmamap_load(), C2T, mbtrail::chunk, mbpool::dmat, mbpage::map, mbpool::max_pages, mbp_callback(), N2C, mbpool::name, mbtrail::page, mbpool::page_size, mbpage::phy, printf(), and mbpage::va.
Referenced by mbp_alloc().


|
static |
Definition at line 184 of file subr_mbpool.c.
Referenced by mbp_alloc_page().

| void mbp_card_free | ( | struct mbpool * | p | ) |
Definition at line 292 of file subr_mbpool.c.
References C2T, mbpool::free_lock, MBP_CARD, MBP_PMSK, N2C, and mbtrail::page.
| void mbp_count | ( | struct mbpool * | p, |
| u_int * | used, | ||
| u_int * | card, | ||
| u_int * | free | ||
| ) |
Definition at line 318 of file subr_mbpool.c.
References C2T, mbpool::free_lock, MBP_CARD, MBP_USED, N2C, and mbtrail::page.
| int mbp_create | ( | struct mbpool ** | pp, |
| const char * | name, | ||
| bus_dma_tag_t | dmat, | ||
| u_int | max_pages, | ||
| size_t | page_size, | ||
| size_t | chunk_size | ||
| ) |
Definition at line 118 of file subr_mbpool.c.
References mbpool::chunk_size, mbpool::dmat, malloc(), mbpool::max_pages, mtx_init(), mbpool::name, and mbpool::page_size.

| void mbp_destroy | ( | struct mbpool * | p | ) |
Definition at line 150 of file subr_mbpool.c.
References C2T, mbpool::dmat, free(), mbpool::free_lock, mbpage::map, MBP_CARD, MBP_USED, mtx_destroy(), N2C, mbpool::name, mbtrail::page, printf(), and mbpage::va.

| void mbp_ext_free | ( | void * | buf, |
| void * | arg | ||
| ) |
Definition at line 283 of file subr_mbpool.c.
References mbp_free().

| void mbp_free | ( | struct mbpool * | p, |
| void * | ptr | ||
| ) |
Definition at line 268 of file subr_mbpool.c.
References C2T, mbpool::free_lock, MBP_CARD, MBP_USED, and mbtrail::page.
Referenced by mbp_ext_free().

| void* mbp_get | ( | struct mbpool * | p, |
| uint32_t | h | ||
| ) |
Definition at line 346 of file subr_mbpool.c.
References C2T, HCHUNK, HPAGE, MBP_CARD, N2C, mbpool::name, mbtrail::page, and printf().

| void* mbp_get_keep | ( | struct mbpool * | p, |
| uint32_t | h | ||
| ) |
Definition at line 368 of file subr_mbpool.c.
References C2T, HCHUNK, HPAGE, MBP_CARD, N2C, mbpool::name, mbtrail::page, and printf().

| void mbp_sync | ( | struct mbpool * | p, |
| uint32_t | h, | ||
| bus_addr_t | off, | ||
| bus_size_t | len, | ||
| u_int | op | ||
| ) |
Definition at line 389 of file subr_mbpool.c.
References mbpool::chunk_size, mbpool::dmat, HCHUNK, and HPAGE.
| MODULE_VERSION | ( | libmbpool | , |
| 1 | |||
| ) |