Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
intel_vtd.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Intel Corporation
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#ifndef ZEPHYR_INCLUDE_DRIVERS_INTEL_VTD_H_
7#define ZEPHYR_INCLUDE_DRIVERS_INTEL_VTD_H_
8
10
11typedef int (*vtd_alloc_entries_f)(const struct device *dev,
12 uint8_t n_entries);
13
14typedef uint32_t (*vtd_remap_msi_f)(const struct device *dev,
15 msi_vector_t *vector,
16 uint8_t n_vector);
17
18typedef int (*vtd_remap_f)(const struct device *dev,
19 uint8_t irte_idx,
20 uint16_t vector,
22 uint16_t src_id);
23
24typedef int (*vtd_set_irte_vector_f)(const struct device *dev,
25 uint8_t irte_idx,
26 uint16_t vector);
27
28typedef int (*vtd_get_irte_by_vector_f)(const struct device *dev,
29 uint16_t vector);
30
31typedef uint16_t (*vtd_get_irte_vector_f)(const struct device *dev,
32 uint8_t irte_idx);
33
34typedef int (*vtd_set_irte_irq_f)(const struct device *dev,
35 uint8_t irte_idx,
36 unsigned int irq);
37
38typedef int (*vtd_get_irte_by_irq_f)(const struct device *dev,
39 unsigned int irq);
40
41typedef void (*vtd_set_irte_msi_f)(const struct device *dev,
42 uint8_t irte_idx,
43 bool msi);
44
45typedef bool (*vtd_irte_is_msi_f)(const struct device *dev,
46 uint8_t irte_idx);
47
60
71static inline int vtd_allocate_entries(const struct device *dev,
72 uint8_t n_entries)
73{
74 const struct vtd_driver_api *api =
75 (const struct vtd_driver_api *)dev->api;
76
77 return api->allocate_entries(dev, n_entries);
78}
79
89static inline uint32_t vtd_remap_msi(const struct device *dev,
90 msi_vector_t *vector,
91 uint8_t n_vector)
92{
93 const struct vtd_driver_api *api =
94 (const struct vtd_driver_api *)dev->api;
95
96 return api->remap_msi(dev, vector, n_vector);
97}
98
110static inline int vtd_remap(const struct device *dev,
111 uint8_t irte_idx,
112 uint16_t vector,
114 uint16_t src_id)
115{
116 const struct vtd_driver_api *api =
117 (const struct vtd_driver_api *)dev->api;
118
119 return api->remap(dev, irte_idx, vector, flags, src_id);
120}
121
131static inline int vtd_set_irte_vector(const struct device *dev,
132 uint8_t irte_idx,
133 uint16_t vector)
134{
135 const struct vtd_driver_api *api =
136 (const struct vtd_driver_api *)dev->api;
137
138 return api->set_irte_vector(dev, irte_idx, vector);
139}
140
149static inline int vtd_get_irte_by_vector(const struct device *dev,
150 uint16_t vector)
151{
152 const struct vtd_driver_api *api =
153 (const struct vtd_driver_api *)dev->api;
154
155 return api->get_irte_by_vector(dev, vector);
156}
157
166static inline uint16_t vtd_get_irte_vector(const struct device *dev,
167 uint8_t irte_idx)
168{
169 const struct vtd_driver_api *api =
170 (const struct vtd_driver_api *)dev->api;
171
172 return api->get_irte_vector(dev, irte_idx);
173}
174
184static inline int vtd_set_irte_irq(const struct device *dev,
185 uint8_t irte_idx,
186 unsigned int irq)
187{
188 const struct vtd_driver_api *api =
189 (const struct vtd_driver_api *)dev->api;
190
191 return api->set_irte_irq(dev, irte_idx, irq);
192}
193
202static inline int vtd_get_irte_by_irq(const struct device *dev,
203 unsigned int irq)
204{
205 const struct vtd_driver_api *api =
206 (const struct vtd_driver_api *)dev->api;
207
208 return api->get_irte_by_irq(dev, irq);
209}
210
211static inline void vtd_set_irte_msi(const struct device *dev,
212 uint8_t irte_idx,
213 bool msi)
214{
215 const struct vtd_driver_api *api =
216 (const struct vtd_driver_api *)dev->api;
217
218 api->set_irte_msi(dev, irte_idx, msi);
219}
220
221static inline bool vtd_irte_is_msi(const struct device *dev,
222 uint8_t irte_idx)
223{
224 const struct vtd_driver_api *api =
225 (const struct vtd_driver_api *)dev->api;
226
227 return api->irte_is_msi(dev, irte_idx);
228}
229
230
231#endif /* ZEPHYR_INCLUDE_DRIVERS_INTEL_VTD_H_ */
void(* vtd_set_irte_msi_f)(const struct device *dev, uint8_t irte_idx, bool msi)
Definition intel_vtd.h:41
int(* vtd_set_irte_vector_f)(const struct device *dev, uint8_t irte_idx, uint16_t vector)
Definition intel_vtd.h:24
int(* vtd_get_irte_by_irq_f)(const struct device *dev, unsigned int irq)
Definition intel_vtd.h:38
static int vtd_get_irte_by_irq(const struct device *dev, unsigned int irq)
Get the irte allocated for the given irq.
Definition intel_vtd.h:202
static int vtd_set_irte_vector(const struct device *dev, uint8_t irte_idx, uint16_t vector)
Set the vector on the allocated irte.
Definition intel_vtd.h:131
int(* vtd_alloc_entries_f)(const struct device *dev, uint8_t n_entries)
Definition intel_vtd.h:11
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.
Definition intel_vtd.h:110
static int vtd_get_irte_by_vector(const struct device *dev, uint16_t vector)
Get the irte allocated for the given vector.
Definition intel_vtd.h:149
bool(* vtd_irte_is_msi_f)(const struct device *dev, uint8_t irte_idx)
Definition intel_vtd.h:45
int(* vtd_set_irte_irq_f)(const struct device *dev, uint8_t irte_idx, unsigned int irq)
Definition intel_vtd.h:34
static uint16_t vtd_get_irte_vector(const struct device *dev, uint8_t irte_idx)
Get the vector given to the IRTE.
Definition intel_vtd.h:166
static bool vtd_irte_is_msi(const struct device *dev, uint8_t irte_idx)
Definition intel_vtd.h:221
static int vtd_allocate_entries(const struct device *dev, uint8_t n_entries)
Allocate contiguous IRTEs.
Definition intel_vtd.h:71
int(* vtd_get_irte_by_vector_f)(const struct device *dev, uint16_t vector)
Definition intel_vtd.h:28
uint32_t(* vtd_remap_msi_f)(const struct device *dev, msi_vector_t *vector, uint8_t n_vector)
Definition intel_vtd.h:14
static int vtd_set_irte_irq(const struct device *dev, uint8_t irte_idx, unsigned int irq)
Set the irq on the allocated irte.
Definition intel_vtd.h:184
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.
Definition intel_vtd.h:89
static void vtd_set_irte_msi(const struct device *dev, uint8_t irte_idx, bool msi)
Definition intel_vtd.h:211
uint16_t(* vtd_get_irte_vector_f)(const struct device *dev, uint8_t irte_idx)
Definition intel_vtd.h:31
int(* vtd_remap_f)(const struct device *dev, uint8_t irte_idx, uint16_t vector, uint32_t flags, uint16_t src_id)
Definition intel_vtd.h:18
flags
Definition parser.h:96
#define bool
Definition stdbool.h:13
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:417
Definition msi.h:51
Definition intel_vtd.h:48
vtd_set_irte_vector_f set_irte_vector
Definition intel_vtd.h:52
vtd_alloc_entries_f allocate_entries
Definition intel_vtd.h:49
vtd_get_irte_by_vector_f get_irte_by_vector
Definition intel_vtd.h:53
vtd_remap_msi_f remap_msi
Definition intel_vtd.h:50
vtd_irte_is_msi_f irte_is_msi
Definition intel_vtd.h:58
vtd_remap_f remap
Definition intel_vtd.h:51
vtd_set_irte_msi_f set_irte_msi
Definition intel_vtd.h:57
vtd_get_irte_vector_f get_irte_vector
Definition intel_vtd.h:54
vtd_set_irte_irq_f set_irte_irq
Definition intel_vtd.h:55
vtd_get_irte_by_irq_f get_irte_by_irq
Definition intel_vtd.h:56