feat: cleanup init code, small other refactors

This commit is contained in:
2021-09-01 21:43:21 +02:00
parent e693b12915
commit 073051c99e
21 changed files with 118 additions and 76 deletions

View File

@@ -10,9 +10,12 @@ extern struct init __stop_init[];
#define NUM_DRIVERS ((size_t)(__stop_init - __start_init))
#define DRIVER(i) ((__start_init) + (i))
void init_execute_all() {
void init_execute_all(enum init_stage stage) {
for (size_t i = 0; i < NUM_DRIVERS; ++i) {
printf("init %s\n", DRIVER(i)->name);
if (DRIVER(i)->stage != stage) continue;
if (stage > INIT_STAGE_EARLY_BOOT_0) {
printf("init %s\n", DRIVER(i)->name);
}
DRIVER(i)->init();
}
}