main: Export chip_id as a global

Some things need to be chip-specific, as the ADT isn't generic enough.

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-10-18 17:33:49 +09:00
parent ecceec9b5c
commit 4fa0200053
2 changed files with 9 additions and 3 deletions

View file

@ -27,7 +27,9 @@ struct vector_args next_stage;
const char version_tag[] = "##m1n1_ver##" BUILD_TAG;
const char *const m1n1_version = version_tag + 12;
void print_info(void)
u32 board_id = ~0, chip_id = ~0;
void get_device_info(void)
{
printf("Device info:\n");
printf(" Model: %s\n", (const char *)adt_getprop(adt, 0, "model", NULL));
@ -35,7 +37,6 @@ void print_info(void)
int chosen = adt_path_offset(adt, "/chosen");
if (chosen > 0) {
u32 board_id = ~0, chip_id = ~0;
if (ADT_GETPROP(adt, chosen, "board-id", &board_id) < 0)
printf("Failed to find board-id\n");
if (ADT_GETPROP(adt, chosen, "chip-id", &chip_id) < 0)
@ -77,6 +78,8 @@ void m1n1_main(void)
printf("Running in EL%lu\n\n", mrs(CurrentEL) >> 2);
get_device_info();
heapblock_init();
mmu_init();
@ -85,7 +88,6 @@ void m1n1_main(void)
fb_display_logo();
#endif
print_info();
aic_init();
wdt_disable();
pmgr_init();

View file

@ -404,6 +404,10 @@ struct vector_args {
bool restore_logo;
};
extern u32 board_id, chip_id;
#define T8103 0x8103
extern struct vector_args next_stage;
void deep_wfi(void);