1#ifndef BOOT_MODULES_H_
2#define BOOT_MODULES_H_
3
4#include <barrelfish/barrelfish.h>
5#include <int_route/int_model.h>
6
7struct module_info;
8struct int_startup_argument;
9
10struct driver_argument {
11    struct capref arg_caps;
12    struct int_startup_argument int_arg;
13    struct cnoderef argnode_ref;
14    char* module_name;
15    uint64_t flags;
16};
17typedef errval_t(*module_start_fn)(coreid_t where, struct module_info* mi,
18        char* record, struct driver_argument * int_arg);
19
20#define MAX_DRIVER_INSTANCES 16
21
22struct module_info {
23    char* complete_line;
24    char* path;
25    char* binary;
26
27    char* args; ///< cmd args as a single string
28
29    char* cmdargs; ///< Used for pointers in argv
30    int argc;
31    char* argv[MAX_CMDLINE_ARGS + 1];
32
33    struct domain_instance* driverinstance;
34    coreid_t core;
35
36    module_start_fn start_function;
37    uint8_t allow_multi;    ///< allow multiple driver instances
38    uint8_t num_started;    ///< keeps track of the number of started domains
39    coreid_t coreoffset;     ///< next coreid to start the new instance on
40    struct capref did[MAX_DRIVER_INSTANCES];
41};
42
43
44errval_t init_driver_argument(struct driver_argument *arg);
45
46void init_environ(void);
47errval_t init_boot_modules(void);
48struct module_info* find_module(char*);
49struct module_info* find_corectrl_for_cpu_type(enum cpu_type cpu_type);
50
51bool is_started(struct module_info*);
52bool can_start(struct module_info*);
53bool is_auto_driver(struct module_info*);
54void set_start_function(char*, module_start_fn);
55void set_started(struct module_info*);
56void set_multi_instance(struct module_info*, uint8_t);
57void set_core_id_offset(struct module_info*, coreid_t);
58struct capref *get_did_ptr(struct module_info *);
59coreid_t get_core_id_offset(struct module_info*);
60
61#endif /* BOOT_MODULES_H_ */
62