INTRMAP_CREATE(9) FreeBSD Kernel Developer's Manual INTRMAP_CREATE(9)
NAME
intrmap_create, intrmap_destroy, intrmap_count, intrmap_cpu - interrupt
to CPU mapping API
SYNOPSIS
#include <sys/intrmap.h>
struct intrmap *
intrmap_create(const struct device *dv, unsigned int nintr,
unsigned int maxintr, unsigned int flags);
void
intrmap_destroy(struct intrmap *im);
unsigned int
intrmap_count(struct intrmap *im);
struct cpu_info *
intrmap_cpu(struct intrmap *im, unsigned int index);
DESCRIPTION
The interrupt to CPU mapping API supports the use of multiple CPUs by
hardware drivers. Drivers that can use multiple interrupts use the API
to request a set of CPUs that they can establish those interrupts on.
The API limits the requested number of interrupts to what is available on
the system, and attempts to distribute the requested interrupts over
those CPUs. On some platforms the API will filter the set of available
CPUs.
intrmap_create() allocates an interrupt map data structure for use by the
driver identified by dv. The number of interrupts the hardware supports
is specified via the nintr argument. The driver supplies the maximum
number of interrupts it can support via maxintr, which, along with the
number of available CPUs at the time the function is called, is used as a
constraint on the number of requested interrupts. nintr may be zero to
use the driver limit as the number of requested interrupts. The flags
argument may have the following defines OR'ed together:
INTRMAP_POWEROF2
The hardware only supports a power of 2 number of interrupts,
so constrain the number of supplied interrupts after the
system and driver limits are applied.
intrmap_destroy() frees the memory associated with the interrupt map data
structure passed via im.
intrmap_count() returns the number of interrupts that the driver can
establish according to the im interrupt map.
intrmap_cpu() returns which CPU the interrupt specified in index should
be established on according to the im interrupt map. Interrupts are
identified as a number from 0 to the value returned by intrmap_count().
CONTEXT
intrmap_create(), intrmap_destroy(), intrmap_count(), and intrmap_cpu()
can be called during autoconf, or from process context.
RETURN VALUES
intrmap_create() returns a pointer to an interrupt mapping structure on
success, or NULL on failure.
intrmap_count() returns the number of interrupts that were allocated for
the driver to use.
intrmap_cpu() returns a pointer to the cpu_info structure for the CPU
that the interrupt should be established on.
HISTORY
The interrupt mapping API is based on the if_ringmap API in DragonFly.
It was ported to OpenBSD 6.8 by David Gwynne <
[email protected]>.
FreeBSD 14.1-RELEASE-p8 July 31, 2022 FreeBSD 14.1-RELEASE-p8