[PATCH 10/10] microblaze: branch to base vector address on reset

Ovidiu Panait ovidiu.panait at windriver.com
Wed Nov 17 13:40:26 CET 2021


Current code assumes that the vector base address is always at 0x0.
However, this value is configurable for MicroBlaze using the
CONFIG_XILINX_MICROBLAZE0_VECTOR_BASE_ADDR Kconfig option. Update the
reset routines to branch to this location instead.

Signed-off-by: Ovidiu Panait <ovidiu.panait at windriver.com>
---

 arch/microblaze/cpu/spl.c              | 6 ++++--
 drivers/sysreset/sysreset_microblaze.c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/microblaze/cpu/spl.c b/arch/microblaze/cpu/spl.c
index 06d4af99b2..cea6d56f16 100644
--- a/arch/microblaze/cpu/spl.c
+++ b/arch/microblaze/cpu/spl.c
@@ -12,6 +12,7 @@
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/u-boot.h>
+#include <linux/stringify.h>
 
 bool boot_linux;
 
@@ -54,8 +55,9 @@ int spl_start_uboot(void)
 
 int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	__asm__ __volatile__ ("mts rmsr, r0;" \
-			      "bra r0");
+	__asm__ __volatile__ (
+	    "mts rmsr, r0;" \
+	    "brai " __stringify(CONFIG_XILINX_MICROBLAZE0_VECTOR_BASE_ADDR));
 
 	return 0;
 }
diff --git a/drivers/sysreset/sysreset_microblaze.c b/drivers/sysreset/sysreset_microblaze.c
index 514c95817f..83a7f77ac4 100644
--- a/drivers/sysreset/sysreset_microblaze.c
+++ b/drivers/sysreset/sysreset_microblaze.c
@@ -8,13 +8,15 @@
 #include <errno.h>
 #include <sysreset.h>
 #include <linux/err.h>
+#include <linux/stringify.h>
 
 static int microblaze_sysreset_request(struct udevice *dev,
 				       enum sysreset_t type)
 {
 	puts("Microblaze soft reset sysreset\n");
-	__asm__ __volatile__ ("	mts rmsr, r0;" \
-				"bra r0");
+	__asm__ __volatile__ (
+	    "mts rmsr, r0;" \
+	    "brai " __stringify(CONFIG_XILINX_MICROBLAZE0_VECTOR_BASE_ADDR));
 
 	return -EINPROGRESS;
 }
-- 
2.25.1



More information about the U-Boot mailing list