diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-26 13:59:54 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-26 13:59:54 +0100 |
| commit | 7870d56b155c2be73cdacfba94eeb893cd55628e (patch) | |
| tree | f95699d91e19635c7aa0e99dbf114da2a06e80a2 /kernel/main.c | |
| parent | 30d6ab8c6b40b2897fa3f49cce0302cc6c3a66e6 (diff) | |
| download | fbos-7870d56b155c2be73cdacfba94eeb893cd55628e.tar.gz fbos-7870d56b155c2be73cdacfba94eeb893cd55628e.zip | |
dt: Fetch the CPU frequency as well
If the 'timebase-frequency' property is available under the 'cpus' node
from the DTB blob, it makes sense to try to fetch this value from there
instead of hardcoding it. For other use-cases, where this information is
not available through DT (e.g. ACPI on the VisionFive2 board), we will
have to hardcode it with a default value even if it's not the proper
one.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'kernel/main.c')
| -rw-r--r-- | kernel/main.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/main.c b/kernel/main.c index fdcef1f..a39ed29 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -16,6 +16,13 @@ struct task_struct tasks[4] = { [TASK_FIZZBUZZ] = { .stack = stack[3], .entry_addr = nullptr, }, }; +// Defined in fbos/init.h. +struct dt_info info = { + .cpu_freq = 0, + .initrd_start = 0, + .initrd_end = 0, +}; + /* * This is the main entry point of the kernel after head.S is done. This * function can (and will) assume that everything has been reset and that we can @@ -26,8 +33,8 @@ __noreturn __kernel void start_kernel(void *dtb) printk("Welcome to FizzBuzz OS!\n"); // Extract information from the DTB blob. - struct initrd_addr addr = find_dt_initrd_addr(dtb); - extract_initrd((unsigned char *)addr.start, addr.end - addr.start, tasks); + get_dt_info(dtb, &info); + extract_initrd((unsigned char *)info.initrd_start, info.initrd_end - info.initrd_start, tasks); // At this point everything has already been handled: setup the interrupt // vector and enable the timer to start ticking and scheduling the three |
