diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-26 21:43:54 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2024-11-26 21:43:54 +0100 |
| commit | 87d1a2597ceedd03a7d4005db1bf82b72b423a18 (patch) | |
| tree | e53bf20d06016b37fde0067526ed7abd95b848e8 /test/test_dt.c | |
| parent | eec442be4d2dd0a1630a820ee43220e635450aa7 (diff) | |
| download | fbos-87d1a2597ceedd03a7d4005db1bf82b72b423a18.tar.gz fbos-87d1a2597ceedd03a7d4005db1bf82b72b423a18.zip | |
Show the detected machine model
Originally I was planning to detect the machine model just in case we
needed to do workaround for special cases. But since apparently even
VisionFive2 brings its own CPU frequency base on DT, this is not even
needed. Hence, fetching the model is now a cool message being shown on
boot.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'test/test_dt.c')
| -rw-r--r-- | test/test_dt.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/test_dt.c b/test/test_dt.c index f606d2e..b80be33 100644 --- a/test/test_dt.c +++ b/test/test_dt.c @@ -1,6 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <assert.h> +#include <string.h> #include <fbos/dt.h> @@ -28,6 +29,7 @@ void dt_info_from(const char *const path, struct dt_info *info) void test_qemu(void) { struct dt_info info = { + .model = { '\0' }, .cpu_freq = 0, .initrd_start = 0, .initrd_end = 0, @@ -38,11 +40,13 @@ void test_qemu(void) assert(info.initrd_start == 0x84200000); assert(info.initrd_end == 0x84200c00); assert(info.cpu_freq == 0x989680); + assert(strcmp(info.model, "riscv-virtio,qemu") == 0); } void test_vf2(void) { struct dt_info info = { + .model = { '\0' }, .cpu_freq = 0, .initrd_start = 0, .initrd_end = 0, @@ -53,6 +57,7 @@ void test_vf2(void) assert(info.initrd_start == 0x46100000); assert(info.initrd_end == 0x47139ce3); assert(info.cpu_freq == 0x3d0900); + assert(strcmp(info.model, "StarFive VisionFive 2 v1.3B") == 0); } int main(void) |
