diff options
author | PA4WDH | 2021-07-13 19:47:04 +0200 |
---|---|---|
committer | PA4WDH | 2021-07-13 19:47:04 +0200 |
commit | 5884c94b1f92c00406d137c9f308c098e5268a59 (patch) | |
tree | 8483f1da04bf5cbed41220bafcffa502cae95eaa /sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch | |
download | unmatched-patchwork-5884c94b1f92c00406d137c9f308c098e5268a59.tar.gz unmatched-patchwork-5884c94b1f92c00406d137c9f308c098e5268a59.tar.bz2 unmatched-patchwork-5884c94b1f92c00406d137c9f308c098e5268a59.zip |
Initial commit
Diffstat (limited to 'sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch')
-rw-r--r-- | sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch b/sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch new file mode 100644 index 0000000..3b6b464 --- /dev/null +++ b/sys-boot/grub/files/grub-2.06-add-boot-hartid-to-fdt.patch @@ -0,0 +1,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) + { |