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