summaryrefslogtreecommitdiffstats
path: root/include/bootchooser.h
blob: 7822c01459e4f6b6b71501216fbe039a8076a0af (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
37
#ifndef __BOOTCHOOSER_H
#define __BOOTCHOOSER_H

#include <of.h>
#include <boot.h>

struct bootchooser;
struct bootchooser_target;

struct bootchooser *bootchooser_get(void);
int bootchooser_save(struct bootchooser *bootchooser);
int bootchooser_put(struct bootchooser *bootchooser);

void bootchooser_info(struct bootchooser *bootchooser);

int bootchooser_boot(struct bootchooser *bc);

struct bootchooser_target *bootchooser_get_last_chosen(struct bootchooser *bootchooser);
const char *bootchooser_target_name(struct bootchooser_target *target);
struct bootchooser_target *bootchooser_target_by_name(struct bootchooser *bootchooser,
						      const char *name);
void bootchooser_target_force_boot(struct bootchooser_target *target);

int bootchooser_target_set_attempts(struct bootchooser_target *target, int attempts);
int bootchooser_target_set_priority(struct bootchooser_target *target, int priority);

void bootchooser_last_boot_successful(void);

struct bootchooser_target *bootchooser_target_first(struct bootchooser *bootchooser);
struct bootchooser_target *bootchooser_target_next(struct bootchooser *bootchooser,
					       struct bootchooser_target *cur);

#define bootchooser_for_each_target(bootchooser, target) \
	for (target = bootchooser_target_first(bootchooser); target; \
	     target = bootchooser_target_next(bootchooser, target))

#endif /* __BOOTCHOOSER_H */