blob: 3b6b4642a42126d01d67f5af11b473dca3bfd6fc (
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
|
diff -Naur grub-2.06/grub-core/loader/riscv64/linux.c grub-2.06-mod/grub-core/loader/riscv64/linux.c
--- grub-2.06/grub-core/loader/riscv64/linux.c 2021-07-03 19:45:08.797409969 +0200
+++ grub-2.06-mod/grub-core/loader/riscv64/linux.c 2021-07-03 19:43:54.673239976 +0200
@@ -48,6 +48,13 @@
static grub_addr_t initrd_start;
static grub_addr_t initrd_end;
+#define get_hartid(__v) \
+{ \
+ __asm__ __volatile__ ("mv %0, tp" \
+ : "=r" (__v) : \
+ : "memory"); \
+}
+
grub_err_t
grub_arch_efi_linux_check_image (struct linux_arch_kernel_header * lh)
{
@@ -68,6 +75,7 @@
finalize_params_linux (void)
{
int node, retval;
+ int hartid;
void *fdt;
@@ -83,6 +91,9 @@
if (node < 1)
goto failure;
+ get_hartid(hartid);
+ grub_fdt_set_prop32 (fdt, node, "boot-hartid", hartid);
+
/* Set initrd info */
if (initrd_start && initrd_end > initrd_start)
{
|