DPDK 21.11.9
rte_bus.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2016 NXP
3 */
4
5#ifndef _RTE_BUS_H_
6#define _RTE_BUS_H_
7
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include <stdio.h>
22
23#include <rte_log.h>
24#include <rte_dev.h>
25
27RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
28
29
39 RTE_IOVA_DC = 0, /* Don't care mode */
40 RTE_IOVA_PA = (1 << 0), /* DMA using physical address */
41 RTE_IOVA_VA = (1 << 1) /* DMA using virtual address */
42};
43
55typedef int (*rte_bus_scan_t)(void);
56
67typedef int (*rte_bus_probe_t)(void);
68
91typedef struct rte_device *
92(*rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp,
93 const void *data);
94
106typedef int (*rte_bus_plug_t)(struct rte_device *dev);
107
119typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
120
139typedef int (*rte_bus_parse_t)(const char *name, void *addr);
140
155typedef int (*rte_bus_devargs_parse_t)(struct rte_devargs *da);
156
175typedef int (*rte_dev_dma_map_t)(struct rte_device *dev, void *addr,
176 uint64_t iova, size_t len);
177
196typedef int (*rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr,
197 uint64_t iova, size_t len);
198
211typedef int (*rte_bus_hot_unplug_handler_t)(struct rte_device *dev);
212
226typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
227
232 RTE_BUS_SCAN_UNDEFINED,
233 RTE_BUS_SCAN_ALLOWLIST,
234 RTE_BUS_SCAN_BLOCKLIST,
235};
236
242};
243
244
255typedef enum rte_iova_mode (*rte_bus_get_iommu_class_t)(void);
256
257
261struct rte_bus {
263 const char *name;
281};
282
290void rte_bus_register(struct rte_bus *bus);
291
299void rte_bus_unregister(struct rte_bus *bus);
300
308int rte_bus_scan(void);
309
319
326void rte_bus_dump(FILE *f);
327
343typedef int (*rte_bus_cmp_t)(const struct rte_bus *bus, const void *data);
344
367struct rte_bus *rte_bus_find(const struct rte_bus *start, rte_bus_cmp_t cmp,
368 const void *data);
369
373struct rte_bus *rte_bus_find_by_device(const struct rte_device *dev);
374
378struct rte_bus *rte_bus_find_by_name(const char *busname);
379
380
389
394#define RTE_REGISTER_BUS(nm, bus) \
395RTE_INIT_PRIO(businitfn_ ##nm, BUS) \
396{\
397 (bus).name = RTE_STR(nm);\
398 rte_bus_register(&bus); \
399}
400
401#ifdef __cplusplus
402}
403#endif
404
405#endif /* _RTE_BUS_H */
struct rte_device *(* rte_bus_find_device_t)(const struct rte_device *start, rte_dev_cmp_t cmp, const void *data)
Definition: rte_bus.h:92
int(* rte_bus_devargs_parse_t)(struct rte_devargs *da)
Definition: rte_bus.h:155
int(* rte_bus_sigbus_handler_t)(const void *failure_addr)
Definition: rte_bus.h:226
rte_bus_scan_mode
Definition: rte_bus.h:231
int(* rte_dev_dma_unmap_t)(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
Definition: rte_bus.h:196
int(* rte_bus_hot_unplug_handler_t)(struct rte_device *dev)
Definition: rte_bus.h:211
int(* rte_bus_unplug_t)(struct rte_device *dev)
Definition: rte_bus.h:119
enum rte_iova_mode rte_bus_get_iommu_class(void)
rte_iova_mode
Definition: rte_bus.h:38
int rte_bus_scan(void)
void rte_bus_register(struct rte_bus *bus)
struct rte_bus * rte_bus_find_by_device(const struct rte_device *dev)
int(* rte_bus_scan_t)(void)
Definition: rte_bus.h:55
void rte_bus_dump(FILE *f)
RTE_TAILQ_HEAD(rte_bus_list, rte_bus)
int(* rte_bus_probe_t)(void)
Definition: rte_bus.h:67
int(* rte_bus_parse_t)(const char *name, void *addr)
Definition: rte_bus.h:139
int(* rte_bus_plug_t)(struct rte_device *dev)
Definition: rte_bus.h:106
struct rte_bus * rte_bus_find_by_name(const char *busname)
void rte_bus_unregister(struct rte_bus *bus)
int(* rte_bus_cmp_t)(const struct rte_bus *bus, const void *data)
Definition: rte_bus.h:343
int rte_bus_probe(void)
enum rte_iova_mode(* rte_bus_get_iommu_class_t)(void)
Definition: rte_bus.h:255
int(* rte_dev_dma_map_t)(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
Definition: rte_bus.h:175
struct rte_bus * rte_bus_find(const struct rte_bus *start, rte_bus_cmp_t cmp, const void *data)
void *(* rte_dev_iterate_t)(const void *start, const char *devstr, const struct rte_dev_iterator *it)
Definition: rte_dev.h:269
int(* rte_dev_cmp_t)(const struct rte_device *dev, const void *data)
Definition: rte_dev.h:183
enum rte_bus_scan_mode scan_mode
Definition: rte_bus.h:241
rte_dev_dma_map_t dma_map
Definition: rte_bus.h:271
rte_bus_parse_t parse
Definition: rte_bus.h:269
rte_bus_probe_t probe
Definition: rte_bus.h:265
RTE_TAILQ_ENTRY(rte_bus) next
rte_dev_iterate_t dev_iterate
Definition: rte_bus.h:275
rte_bus_unplug_t unplug
Definition: rte_bus.h:268
rte_bus_find_device_t find_device
Definition: rte_bus.h:266
rte_bus_scan_t scan
Definition: rte_bus.h:264
const char * name
Definition: rte_bus.h:263
rte_bus_devargs_parse_t devargs_parse
Definition: rte_bus.h:270
rte_bus_sigbus_handler_t sigbus_handler
Definition: rte_bus.h:278
rte_bus_hot_unplug_handler_t hot_unplug_handler
Definition: rte_bus.h:276
rte_bus_plug_t plug
Definition: rte_bus.h:267
rte_bus_get_iommu_class_t get_iommu_class
Definition: rte_bus.h:274
struct rte_bus_conf conf
Definition: rte_bus.h:273
rte_dev_dma_unmap_t dma_unmap
Definition: rte_bus.h:272
const char * name
Definition: rte_dev.h:87