]> git.ozlabs.org Git - petitboot/blob - discover/platform.h
discover: Reject ADD_URL actions without configured network
[petitboot] / discover / platform.h
1 #ifndef PLATFORM_H
2 #define PLATFORM_H
3
4 #include <types/types.h>
5
6 struct platform {
7         const char      *name;
8         bool            (*probe)(struct platform *, void *);
9         int             (*load_config)(struct platform *, struct config *);
10         int             (*save_config)(struct platform *, struct config *);
11         int             (*get_sysinfo)(struct platform *, struct system_info *);
12         uint16_t        dhcp_arch_id;
13         void            *platform_data;
14 };
15
16 int platform_init(void *ctx);
17 int platform_fini(void);
18 const struct platform *platform_get(void);
19 int platform_get_sysinfo(struct system_info *info);
20
21 /* configuration interface */
22 const struct config *config_get(void);
23 int config_set(struct config *config);
24 void config_set_autoboot(bool autoboot_enabled);
25
26 /* for use by the platform-specific storage code */
27 void config_set_defaults(struct config *config);
28
29 #define __platform_ptrname(_n) __platform_ ## _n
30 #define  _platform_ptrname(_n) __platform_ptrname(_n)
31
32 #define register_platform(p) \
33         static __attribute__((section("platforms"))) \
34                 __attribute__((used)) \
35                 struct platform * _platform_ptrname(__COUNTER__) = &p;
36
37 #endif /* PLATFORM_H */
38