10 #ifndef _DRIVER_MANAGER_H_ 11 #define _DRIVER_MANAGER_H_ 14 #include <drvmgr/drvmgr_list.h> 26 #define DRVMGR_LEVEL_MAX 4 31 #ifndef DRVMGR_USE_LOCKS 32 #define DRVMGR_USE_LOCKS 1 40 #define BUS_LIST_HEAD(list) LIST_HEAD(list, struct drvmgr_bus) 41 #define BUS_LIST_TAIL(list) LIST_TAIL(list, struct drvmgr_bus) 42 #define DEV_LIST_HEAD(list) LIST_HEAD(list, struct drvmgr_dev) 43 #define DEV_LIST_TAIL(list) LIST_TAIL(list, struct drvmgr_dev) 44 #define DRV_LIST_HEAD(list) LIST_HEAD(list, struct drvmgr_drv) 45 #define DRV_LIST_TAIL(list) LIST_TAIL(list, struct drvmgr_drv) 48 #define DRVMGR_BUS_TYPE_NONE 0 49 #define DRVMGR_BUS_TYPE_ROOT 1 50 #define DRVMGR_BUS_TYPE_PCI 2 51 #define DRVMGR_BUS_TYPE_AMBAPP 3 52 #define DRVMGR_BUS_TYPE_LEON2_AMBA 4 53 #define DRVMGR_BUS_TYPE_AMBAPP_DIST 5 54 #define DRVMGR_BUS_TYPE_SPW_RMAP 6 55 #define DRVMGR_BUS_TYPE_AMBAPP_RMAP 7 80 #define DRIVER_ID_BUS_MASK 0x00000000000000FFULL 83 #define DRIVER_ID_RSV_MASK 0xFF00000000000000ULL 86 #define DRIVER_ID_DEV_MASK 0x00FFFFFFFFFFFF00ULL 89 #define DRIVER_ID(busid, devid) ((unsigned long long) \ 90 ((((unsigned long long)(devid) << 8) & DRIVER_ID_DEV_MASK) | \ 91 ((unsigned long long)(busid) & DRIVER_ID_BUS_MASK))) 94 #define DRIVER_BUSID_GET(id) ((unsigned long long)(id) & DRIVER_ID_BUS_MASK) 95 #define DRIVER_DEVID_GET(id) (((unsigned long long)(id) & DRIVER_ID_DEV_MASK) >> 8) 97 #define DRIVER_ROOTBUS_ID(bus_type) DRIVER_ID(bus_type, 0) 102 #define DRIVER_ROOT_ID DRIVER_ROOTBUS_ID(DRVMGR_BUS_TYPE_ROOT) 105 #define DRIVER_PCIBUS_ID DRIVER_ROOTBUS_ID(DRVMGR_BUS_TYPE_PCI) 108 #define DRIVER_GRLIB_AMBAPP_ID DRIVER_ROOTBUS_ID(DRVMGR_BUS_TYPE_AMBAPP) 111 #define DRIVER_LEON2_AMBA_ID DRIVER_ROOTBUS_ID(DRVMGR_BUS_TYPE_LEON2_AMBA) 114 #define DRIVER_AMBAPP_DIST_ID DRIVER_ROOTBUS_ID(DRVMGR_BUS_TYPE_AMBAPP_DIST) 126 typedef void (*drvmgr_isr)(
void *arg);
131 int (*init[DRVMGR_LEVEL_MAX])(
struct drvmgr_bus *);
136 int (*int_register)(
struct drvmgr_dev *,
int index,
const char *info, drvmgr_isr isr,
void *arg);
137 int (*int_unregister)(
struct drvmgr_dev *,
int index, drvmgr_isr isr,
void *arg);
138 int (*int_clear)(
struct drvmgr_dev *,
int index);
139 int (*int_mask)(
struct drvmgr_dev *,
int index);
140 int (*int_unmask)(
struct drvmgr_dev *,
int index);
142 int (*int_set_affinity)(
struct drvmgr_dev *,
int index,
143 const Processor_mask *cpus);
149 int (*get_freq)(
struct drvmgr_dev*, int,
unsigned int*);
154 void (*print)(
void *
p,
char *str),
void *
p);
156 #define BUS_OPS_NUM (sizeof(struct drvmgr_bus_ops)/sizeof(void (*)(void))) 162 #define DRVMGR_FUNC(_ID_, _FUNC_) {(int)(_ID_), (void *)(_FUNC_)} 163 #define DRVMGR_FUNC_END {0, NULL} 182 DRVMGR_KT_STRING = 2,
183 DRVMGR_KT_POINTER = 3,
186 #define DRVMGR_KEY_EMPTY {NULL, DRVMGR_KT_NONE, {0}} 187 #define DRVMGR_RES_EMPTY {0, 0, NULL} 188 #define MMAP_EMPTY {0, 0, 0} 200 enum drvmgr_kt key_type;
233 #define DRVMGR_TRANSLATE_ONE2ONE NULL 234 #define DRVMGR_TRANSLATE_NO_BRIDGE ((void *)1) 259 #define BUS_STATE_INIT_FAILED 0x00000001 260 #define BUS_STATE_LIST_INACTIVE 0x00001000 261 #define BUS_STATE_DEPEND_FAILED 0x00000004 264 #define DEV_STATE_INIT_FAILED 0x00000001 265 #define DEV_STATE_INIT_DONE 0x00000002 266 #define DEV_STATE_DEPEND_FAILED 0x00000004 267 #define DEV_STATE_UNITED 0x00000100 268 #define DEV_STATE_REMOVED 0x00000200 269 #define DEV_STATE_IGNORED 0x00000400 272 #define DEV_STATE_LIST_INACTIVE 0x00001000 298 int (*init[DRVMGR_LEVEL_MAX])(
struct drvmgr_dev *);
300 int (*
info)(
struct drvmgr_dev *, void (*print)(
void *
p,
char *str),
void *
p,
int,
char *argv[]);
302 #define DRVMGR_OPS_NUM(x) (sizeof(x)/sizeof(void (*)(void))) 323 typedef void (*drvmgr_drv_reg_func)(void);
344 extern void _DRV_Manager_initialization(
void);
351 extern void _DRV_Manager_init_level(
int level);
358 extern int drvmgr_init(
void);
364 extern void drvmgr_init_update(
void);
367 extern int drvmgr_root_drv_register(
struct drvmgr_drv *drv);
370 extern int drvmgr_drv_register(
struct drvmgr_drv *drv);
373 extern int drvmgr_dev_register(
struct drvmgr_dev *dev);
385 extern int drvmgr_dev_unregister(
struct drvmgr_dev *dev);
388 extern int drvmgr_bus_register(
struct drvmgr_bus *bus);
391 extern int drvmgr_bus_unregister(
struct drvmgr_bus *bus);
398 extern int drvmgr_children_unregister(
struct drvmgr_bus *bus);
401 extern int drvmgr_dev_drv_separate(
struct drvmgr_dev *dev);
409 extern int drvmgr_alloc_dev(
struct drvmgr_dev **pdev,
int extra);
417 extern int drvmgr_alloc_bus(
struct drvmgr_bus **pbus,
int extra);
427 extern void drvmgr_bus_res_add(
struct drvmgr_bus *bus,
461 enum drvmgr_kt key_type);
478 enum drvmgr_kt key_type);
513 #define DRVMGR_FED_BF 1 514 #define DRVMGR_FED_DF 0 515 extern intptr_t drvmgr_for_each_dev(
528 extern int drvmgr_get_dev(
539 extern int drvmgr_freq_get(
542 unsigned int *freq_hz);
553 extern int drvmgr_get_dev_prefix(
struct drvmgr_dev *
dev,
char *dev_prefix);
568 extern int drvmgr_interrupt_register(
585 extern int drvmgr_interrupt_unregister(
600 extern int drvmgr_interrupt_clear(
614 extern int drvmgr_interrupt_unmask(
626 extern int drvmgr_interrupt_mask(
639 extern int drvmgr_interrupt_set_affinity(
642 const Processor_mask *cpus);
646 enum drvmgr_tr_opts {
665 CPUMEM_FROM_DMA = 0x1,
681 DMAMEM_FROM_CPU = 0x3,
683 #define DRVMGR_TR_REVERSE 0x1 684 #define DRVMGR_TR_PATH 0x2 722 extern unsigned int drvmgr_translate(
724 unsigned int options,
747 extern unsigned int drvmgr_translate_bus(
762 extern int drvmgr_translate_check(
764 unsigned int options,
773 extern int drvmgr_func_get(
void *obj,
int funcid,
void **func);
776 extern int drvmgr_func_call(
void *obj,
int funcid,
void *a,
void *b,
void *c,
void *d);
782 #define DRVMGR_FUNCID(major, minor) ((((major) & 0xfff) << 20) | ((minor) & 0xfffff)) 783 #define DRVMGR_FUNCID_NONE 0 784 #define DRVMGR_FUNCID_END DRVMGR_FUNCID(DRVMGR_FUNCID_NONE, 0) 793 #define RW_SIZE_1 0x00001 794 #define RW_SIZE_2 0x00002 795 #define RW_SIZE_4 0x00004 796 #define RW_SIZE_8 0x00008 797 #define RW_SIZE_ANY 0x00000 798 #define RW_SIZE(id) ((unsigned int)(id) & 0xf) 800 #define RW_DIR_ANY 0x00000 801 #define RW_READ 0x00000 802 #define RW_WRITE 0x00010 803 #define RW_SET 0x00020 804 #define RW_DIR(id) (((unsigned int)(id) >> 4) & 0x3) 806 #define RW_RAW 0x00000 807 #define RW_LITTLE 0x00040 808 #define RW_BIG 0x00080 809 #define RW_ENDIAN(id) (((unsigned int)(id) >> 6) & 0x3) 811 #define RW_TYPE_ANY 0x00000 812 #define RW_REG 0x00100 813 #define RW_MEM 0x00200 814 #define RW_MEMREG 0x00300 815 #define RW_CFG 0x00400 816 #define RW_TYPE(id) (((unsigned int)(id) >> 8) & 0xf) 818 #define RW_ARG 0x01000 819 #define RW_ERR 0x02000 822 #define DRVMGR_RWFUNC(minor) DRVMGR_FUNCID(FUNCID_RW, minor) 833 typedef uint8_t (*drvmgr_r8)(uint8_t *srcadr);
834 typedef uint16_t (*drvmgr_r16)(uint16_t *srcadr);
835 typedef uint32_t (*drvmgr_r32)(uint32_t *srcadr);
836 typedef uint64_t (*drvmgr_r64)(uint64_t *srcadr);
837 typedef void (*drvmgr_w8)(uint8_t *dstadr, uint8_t data);
838 typedef void (*drvmgr_w16)(uint16_t *dstadr, uint16_t data);
839 typedef void (*drvmgr_w32)(uint32_t *dstadr, uint32_t data);
840 typedef void (*drvmgr_w64)(uint64_t *dstadr, uint64_t data);
844 typedef int (*drvmgr_rmem)(
void *dest,
const void *src,
int n);
848 typedef int (*drvmgr_wmem)(
void *dest,
const void *src,
int n);
852 typedef int (*drvmgr_memset)(
void *dstadr,
int c,
size_t n);
855 typedef uint8_t (*drvmgr_r8_arg)(uint8_t *srcadr,
void *a);
856 typedef uint16_t (*drvmgr_r16_arg)(uint16_t *srcadr,
void *a);
857 typedef uint32_t (*drvmgr_r32_arg)(uint32_t *srcadr,
void *a);
858 typedef uint64_t (*drvmgr_r64_arg)(uint64_t *srcadr,
void *a);
859 typedef void (*drvmgr_w8_arg)(uint8_t *dstadr, uint8_t data,
void *a);
860 typedef void (*drvmgr_w16_arg)(uint16_t *dstadr, uint16_t data,
void *a);
861 typedef void (*drvmgr_w32_arg)(uint32_t *dstadr, uint32_t data,
void *a);
862 typedef void (*drvmgr_w64_arg)(uint64_t *dstadr, uint64_t data,
void *a);
863 typedef int (*drvmgr_rmem_arg)(
void *dest,
const void *src,
int n,
void *a);
864 typedef int (*drvmgr_wmem_arg)(
void *dest,
const void *src,
int n,
void *a);
865 typedef int (*drvmgr_memset_arg)(
void *dstadr,
int c,
size_t n,
void *a);
869 int funcid,
void *adr);
872 extern void drvmgr_rw_memset(
906 extern int drvmgr_for_each_listdev(
908 unsigned int state_set_mask,
909 unsigned int state_clr_mask,
914 #define PRINT_DEVS_FAILED 0x01 915 #define PRINT_DEVS_ASSIGNED 0x02 916 #define PRINT_DEVS_UNASSIGNED 0x04 917 #define PRINT_DEVS_IGNORED 0x08 918 #define PRINT_DEVS_ALL (PRINT_DEVS_FAILED | \ 919 PRINT_DEVS_ASSIGNED | \ 920 PRINT_DEVS_UNASSIGNED |\ 924 extern void drvmgr_summary(
void);
927 extern void drvmgr_print_devs(
unsigned int options);
930 extern void drvmgr_print_topo(
void);
935 extern void drvmgr_print_mem(
void);
937 #define OPTION_DEV_GENINFO 0x00000001 938 #define OPTION_DEV_BUSINFO 0x00000002 939 #define OPTION_DEV_DRVINFO 0x00000004 940 #define OPTION_DRV_DEVS 0x00000100 941 #define OPTION_BUS_DEVS 0x00010000 942 #define OPTION_RECURSIVE 0x01000000 943 #define OPTION_INFO_ALL 0xffffffff 946 extern void drvmgr_info(
void *
id,
unsigned int options);
949 extern void drvmgr_info_dev(
struct drvmgr_dev *
dev,
unsigned int options);
952 extern void drvmgr_info_bus(
struct drvmgr_bus *bus,
unsigned int options);
955 extern void drvmgr_info_drv(
struct drvmgr_drv *drv,
unsigned int options);
958 extern void drvmgr_info_devs_on_bus(
struct drvmgr_bus *bus,
unsigned int options);
961 extern void drvmgr_info_devs(
unsigned int options);
964 extern void drvmgr_info_drvs(
unsigned int options);
967 extern void drvmgr_info_buses(
unsigned int options);
970 extern struct drvmgr_drv *drvmgr_drv_by_id(uint64_t
id);
973 extern struct drvmgr_drv *drvmgr_drv_by_name(
const char *name);
976 extern struct drvmgr_dev *drvmgr_dev_by_name(
const char *name);
struct drvmgr_drv_ops * ops
Definition: drvmgr.h:313
unsigned int size
Definition: drvmgr.h:227
struct drvmgr_bus * parent
Definition: drvmgr.h:282
uint64_t drv_id
Definition: drvmgr.h:310
struct drvmgr_bus_res * reslist
Definition: drvmgr.h:248
int(* unite)(struct drvmgr_drv *, struct drvmgr_dev *)
Definition: drvmgr.h:133
struct drvmgr_drv * next
Definition: drvmgr.h:307
struct drvmgr_dev * children
Definition: drvmgr.h:244
int minor_bus
Definition: drvmgr.h:209
struct drvmgr_drv_res resource[]
Definition: drvmgr.h:216
int state
Definition: drvmgr.h:254
unsigned char bus_type
Definition: drvmgr.h:239
struct drvmgr_bus_ops * ops
Definition: drvmgr.h:245
struct drvmgr_bus * bus
Definition: drvmgr.h:288
struct drvmgr_map_entry * maps_up
Definition: drvmgr.h:249
void * priv
Definition: drvmgr.h:243
unsigned p
Definition: tte.h:90
char * str
Definition: drvmgr.h:193
int bus_type
Definition: drvmgr.h:312
struct drvmgr_func * funcs
Definition: drvmgr.h:314
void(* get_info_dev)(struct drvmgr_dev *, void(*print)(void *p, char *str), void *p)
Definition: drvmgr.h:153
char * from_adr
Definition: drvmgr.h:228
int(* info)(struct drvmgr_dev *, void(*print)(void *p, char *str), void *p, int, char *argv[])
Definition: drvmgr.h:300
struct drvmgr_dev * next_in_bus
Definition: drvmgr.h:278
unsigned int state
Definition: drvmgr.h:291
struct drvmgr_dev * dev
Definition: drvmgr.h:242
void * ptr
Definition: drvmgr.h:194
struct drvmgr_dev * next
Definition: drvmgr.h:277
int obj_type
Definition: drvmgr.h:276
struct drvmgr_map_entry * maps_down
Definition: drvmgr.h:250
struct drvmgr_func * funcs
Definition: drvmgr.h:246
int dev_cnt
Definition: drvmgr.h:247
char * name
Definition: drvmgr.h:226
char * name
Definition: drvmgr.h:311
struct drvmgr_key * keys
Definition: drvmgr.h:210
struct drvmgr_dev * next_in_drv
Definition: drvmgr.h:279
char * dev_prefix
Definition: drvmgr.h:122
int error
Definition: drvmgr.h:293
int(* remove)(struct drvmgr_dev *)
Definition: drvmgr.h:299
unsigned int dev_cnt
Definition: drvmgr.h:315
void * businfo
Definition: drvmgr.h:287
int obj_type
Definition: drvmgr.h:306
struct drvmgr_dev * dev
Definition: drvmgr.h:308
int level
Definition: drvmgr.h:292
unsigned int i
Definition: drvmgr.h:192
short minor_bus
Definition: drvmgr.h:284
void * priv
Definition: drvmgr.h:286
int level
Definition: drvmgr.h:253
short minor_drv
Definition: drvmgr.h:283
unsigned size
Definition: tte.h:74
unsigned char depth
Definition: drvmgr.h:240
unsigned int dev_priv_size
Definition: drvmgr.h:316
struct drvmgr_drv * drv
Definition: drvmgr.h:281
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
char * name
Definition: drvmgr.h:285
struct drvmgr_bus * next
Definition: drvmgr.h:241
struct drvmgr_bus_res * next
Definition: drvmgr.h:215
Definition: drvmgr_list.h:24
SuperCore SMP Implementation.
int obj_type
Definition: drvmgr.h:238
char * to_adr
Definition: drvmgr.h:230
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77
uint64_t drv_id
Definition: drvmgr.h:208
int error
Definition: drvmgr.h:255