diff options
-rw-r--r-- | firmware/fw_base.S | 6 | ||||
-rw-r--r-- | firmware/objects.mk | 4 | ||||
-rw-r--r-- | include/sbi/sbi_scratch.h | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/firmware/fw_base.S b/firmware/fw_base.S index 3bf7c6a..aed0917 100644 --- a/firmware/fw_base.S +++ b/firmware/fw_base.S @@ -81,6 +81,12 @@ _scratch_init: la a4, _hartid_to_scratch REG_S a4, SBI_SCRATCH_HARTID_TO_SCRATCH_OFFSET(tp) REG_S zero, SBI_SCRATCH_TMP0_OFFSET(tp) +#ifdef FW_OPTIONS + li a4, FW_OPTIONS + REG_S a4, SBI_SCRATCH_OPTIONS_OFFSET(tp) +#else + REG_S zero, SBI_SCRATCH_OPTIONS_OFFSET(tp) +#endif add t1, t1, t2 blt t1, s7, _scratch_init diff --git a/firmware/objects.mk b/firmware/objects.mk index b8f6e88..72581eb 100644 --- a/firmware/objects.mk +++ b/firmware/objects.mk @@ -50,3 +50,7 @@ endif ifdef FW_PAYLOAD_FDT_ADDR firmware-genflags-$(FW_PAYLOAD) += -DFW_PAYLOAD_FDT_ADDR=$(FW_PAYLOAD_FDT_ADDR) endif + +ifdef FW_OPTIONS +firmware-genflags-y += -DFW_OPTIONS=$(FW_OPTIONS) +endif diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h index 1534893..4cba233 100644 --- a/include/sbi/sbi_scratch.h +++ b/include/sbi/sbi_scratch.h @@ -30,6 +30,8 @@ #define SBI_SCRATCH_HARTID_TO_SCRATCH_OFFSET (7 * __SIZEOF_POINTER__) /** Offset of tmp0 member in sbi_scratch */ #define SBI_SCRATCH_TMP0_OFFSET (8 * __SIZEOF_POINTER__) +/** Offset of options member in sbi_scratch */ +#define SBI_SCRATCH_OPTIONS_OFFSET (9 * __SIZEOF_POINTER__) /** sbi_ipi_data is located behind sbi_scratch. This struct is not packed. */ /** Offset of ipi_type in sbi_ipi_data */ @@ -64,6 +66,8 @@ struct sbi_scratch { unsigned long hartid_to_scratch; /** Temporary storage */ unsigned long tmp0; + /** Options for OpenSBI library */ + unsigned long options; } __packed; /** Get pointer to sbi_scratch for current HART */ |