summaryrefslogtreecommitdiffstats
path: root/discover/platform.h
blob: a01ac7108ae562ae9cea3ecc7ed03b69357af6a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef PLATFORM_H
#define PLATFORM_H

#include <types/types.h>

struct platform {
	const char	*name;
	bool		(*probe)(struct platform *, void *);
	int		(*load_config)(struct platform *, struct config *);
	int		(*save_config)(struct platform *, struct config *);
	uint16_t	dhcp_arch_id;
	void		*platform_data;
};

int platform_init(void *ctx);
int platform_fini(void);
const struct platform *platform_get(void);

/* configuration interface */
const struct config *config_get(void);
int config_set(struct config *config);
void config_set_autoboot(bool autoboot_enabled);

/* for use by the platform-specific storage code */
void config_set_defaults(struct config *config);

#define __platform_ptrname(_n) __platform_ ## _n
#define  _platform_ptrname(_n) __platform_ptrname(_n)

#define register_platform(p) \
	static __attribute__((section("platforms"))) \
		__attribute__((used)) \
		struct platform * _platform_ptrname(__COUNTER__) = &p;

#endif /* PLATFORM_H */

OpenPOWER on IntegriCloud