Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
intel_vtd.h File Reference

Go to the source code of this file.

Data Structures

struct  vtd_driver_api
 

Typedefs

typedef int(* vtd_alloc_entries_f) (const struct device *dev, uint8_t n_entries)
 
typedef uint32_t(* vtd_remap_msi_f) (const struct device *dev, msi_vector_t *vector, uint8_t n_vector)
 
typedef int(* vtd_remap_f) (const struct device *dev, uint8_t irte_idx, uint16_t vector, uint32_t flags, uint16_t src_id)
 
typedef int(* vtd_set_irte_vector_f) (const struct device *dev, uint8_t irte_idx, uint16_t vector)
 
typedef int(* vtd_get_irte_by_vector_f) (const struct device *dev, uint16_t vector)
 
typedef uint16_t(* vtd_get_irte_vector_f) (const struct device *dev, uint8_t irte_idx)
 
typedef int(* vtd_set_irte_irq_f) (const struct device *dev, uint8_t irte_idx, unsigned int irq)
 
typedef int(* vtd_get_irte_by_irq_f) (const struct device *dev, unsigned int irq)
 
typedef void(* vtd_set_irte_msi_f) (const struct device *dev, uint8_t irte_idx, bool msi)
 
typedef bool(* vtd_irte_is_msi_f) (const struct device *dev, uint8_t irte_idx)
 

Functions

static int vtd_allocate_entries (const struct device *dev, uint8_t n_entries)
 Allocate contiguous IRTEs.
 
static uint32_t vtd_remap_msi (const struct device *dev, msi_vector_t *vector, uint8_t n_vector)
 Generate the MSI Message Address data for the given vector.
 
static int vtd_remap (const struct device *dev, uint8_t irte_idx, uint16_t vector, uint32_t flags, uint16_t src_id)
 Remap the given vector.
 
static int vtd_set_irte_vector (const struct device *dev, uint8_t irte_idx, uint16_t vector)
 Set the vector on the allocated irte.
 
static int vtd_get_irte_by_vector (const struct device *dev, uint16_t vector)
 Get the irte allocated for the given vector.
 
static uint16_t vtd_get_irte_vector (const struct device *dev, uint8_t irte_idx)
 Get the vector given to the IRTE.
 
static int vtd_set_irte_irq (const struct device *dev, uint8_t irte_idx, unsigned int irq)
 Set the irq on the allocated irte.
 
static int vtd_get_irte_by_irq (const struct device *dev, unsigned int irq)
 Get the irte allocated for the given irq.
 
static void vtd_set_irte_msi (const struct device *dev, uint8_t irte_idx, bool msi)
 
static bool vtd_irte_is_msi (const struct device *dev, uint8_t irte_idx)
 

Typedef Documentation

◆ vtd_alloc_entries_f

typedef int(* vtd_alloc_entries_f) (const struct device *dev, uint8_t n_entries)

◆ vtd_get_irte_by_irq_f

typedef int(* vtd_get_irte_by_irq_f) (const struct device *dev, unsigned int irq)

◆ vtd_get_irte_by_vector_f

typedef int(* vtd_get_irte_by_vector_f) (const struct device *dev, uint16_t vector)

◆ vtd_get_irte_vector_f

typedef uint16_t(* vtd_get_irte_vector_f) (const struct device *dev, uint8_t irte_idx)

◆ vtd_irte_is_msi_f

typedef bool(* vtd_irte_is_msi_f) (const struct device *dev, uint8_t irte_idx)

◆ vtd_remap_f

typedef int(* vtd_remap_f) (const struct device *dev, uint8_t irte_idx, uint16_t vector, uint32_t flags, uint16_t src_id)

◆ vtd_remap_msi_f

typedef uint32_t(* vtd_remap_msi_f) (const struct device *dev, msi_vector_t *vector, uint8_t n_vector)

◆ vtd_set_irte_irq_f

typedef int(* vtd_set_irte_irq_f) (const struct device *dev, uint8_t irte_idx, unsigned int irq)

◆ vtd_set_irte_msi_f

typedef void(* vtd_set_irte_msi_f) (const struct device *dev, uint8_t irte_idx, bool msi)

◆ vtd_set_irte_vector_f

typedef int(* vtd_set_irte_vector_f) (const struct device *dev, uint8_t irte_idx, uint16_t vector)

Function Documentation

◆ vtd_allocate_entries()

static int vtd_allocate_entries ( const struct device * dev,
uint8_t n_entries )
inlinestatic

Allocate contiguous IRTEs.

Parameters
devPointer to the device structure for the driver instance
n_entriesHow many IRTE to allocate

Note: It will try to allocate all, or it will fail.

Returns
The first allocated IRTE index, or -EBUSY on failure

◆ vtd_get_irte_by_irq()

static int vtd_get_irte_by_irq ( const struct device * dev,
unsigned int irq )
inlinestatic

Get the irte allocated for the given irq.

Parameters
devPointer to the device structure for the driver instance
irqA valid IRQ number
Returns
0 or positive value on success, a negative errno otherwise

◆ vtd_get_irte_by_vector()

static int vtd_get_irte_by_vector ( const struct device * dev,
uint16_t vector )
inlinestatic

Get the irte allocated for the given vector.

Parameters
devPointer to the device structure for the driver instance
vectorAn allocated interrupt vector
Returns
0 or positive value on success, a negative errno otherwise

◆ vtd_get_irte_vector()

static uint16_t vtd_get_irte_vector ( const struct device * dev,
uint8_t irte_idx )
inlinestatic

Get the vector given to the IRTE.

Parameters
devPointer to the device structure for the driver instance
irte_idxA previously allocated irte entry index number
Returns
the vector set to this IRTE

◆ vtd_irte_is_msi()

static bool vtd_irte_is_msi ( const struct device * dev,
uint8_t irte_idx )
inlinestatic

◆ vtd_remap()

static int vtd_remap ( const struct device * dev,
uint8_t irte_idx,
uint16_t vector,
uint32_t flags,
uint16_t src_id )
inlinestatic

Remap the given vector.

Parameters
devPointer to the device structure for the driver instance
irte_idxA previously allocated irte entry index number
vectorAn allocated interrupt vector
flagsinterrupt flags
src_ida valid source ID or USHRT_MAX if none
Returns
0 on success, a negative errno otherwise

◆ vtd_remap_msi()

static uint32_t vtd_remap_msi ( const struct device * dev,
msi_vector_t * vector,
uint8_t n_vector )
inlinestatic

Generate the MSI Message Address data for the given vector.

Parameters
devPointer to the device structure for the driver instance
vectorA valid allocated MSI vector array
n_vectorthe size of the vector array
Returns
The MSI Message Address value

◆ vtd_set_irte_irq()

static int vtd_set_irte_irq ( const struct device * dev,
uint8_t irte_idx,
unsigned int irq )
inlinestatic

Set the irq on the allocated irte.

Parameters
devPointer to the device structure for the driver instance
irte_idxA previously allocated irte entry index number
irqA valid IRQ number
Returns
0, a negative errno otherwise

◆ vtd_set_irte_msi()

static void vtd_set_irte_msi ( const struct device * dev,
uint8_t irte_idx,
bool msi )
inlinestatic

◆ vtd_set_irte_vector()

static int vtd_set_irte_vector ( const struct device * dev,
uint8_t irte_idx,
uint16_t vector )
inlinestatic

Set the vector on the allocated irte.

Parameters
devPointer to the device structure for the driver instance
irte_idxA previously allocated irte entry index number
vectorAn allocated interrupt vector
Returns
0, a negative errno otherwise