diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/sbi/sbi_dbtr.h | 10 | ||||
| -rw-r--r-- | include/sbi/sbi_ecall_interface.h | 14 | ||||
| -rw-r--r-- | include/sbi/sbi_hart_protection.h | 7 | ||||
| -rw-r--r-- | include/sbi/sbi_hartmask.h | 4 | ||||
| -rw-r--r-- | include/sbi/sbi_timer.h | 3 | ||||
| -rw-r--r-- | include/sbi/sbi_tlb.h | 31 | ||||
| -rw-r--r-- | include/sbi_utils/hsm/fdt_hsm_andes_atcsmu.h | 8 |
7 files changed, 74 insertions, 3 deletions
diff --git a/include/sbi/sbi_dbtr.h b/include/sbi/sbi_dbtr.h index 5e0bf84e..90871f0d 100644 --- a/include/sbi/sbi_dbtr.h +++ b/include/sbi/sbi_dbtr.h @@ -77,6 +77,16 @@ struct sbi_dbtr_hart_triggers_state { u32 probed; }; +/** Platform specific debug trigger operations */ +struct sbi_dbtr_device { + char name[32]; + bool (*trigger_supported)(unsigned long idx, unsigned long tdata1, + unsigned long tdata2, unsigned long tdata3); +}; + +const struct sbi_dbtr_device *sbi_dbtr_get_device(void); +void sbi_dbtr_set_device(const struct sbi_dbtr_device *dev); + #define TDATA1_GET_TYPE(_t1) \ EXTRACT_FIELD(_t1, RV_DBTR_BIT_MASK(TDATA1, TYPE)) diff --git a/include/sbi/sbi_ecall_interface.h b/include/sbi/sbi_ecall_interface.h index acb91a01..fd4e77ca 100644 --- a/include/sbi/sbi_ecall_interface.h +++ b/include/sbi/sbi_ecall_interface.h @@ -271,6 +271,8 @@ struct sbi_pmu_event_info { #define SBI_PMU_EVENT_IDX_TYPE_OFFSET 16 #define SBI_PMU_EVENT_IDX_TYPE_MASK (0xF << SBI_PMU_EVENT_IDX_TYPE_OFFSET) #define SBI_PMU_EVENT_IDX_CODE_MASK 0xFFFF +#define SBI_PMU_EVENT_IDX_MBZ_OFFSET 20 +#define SBI_PMU_EVENT_IDX_MBZ_MASK (0xFFF << SBI_PMU_EVENT_IDX_MBZ_OFFSET) #define SBI_PMU_EVENT_RAW_IDX 0x20000 #define SBI_PMU_EVENT_RAW_V2_IDX 0x30000 @@ -304,10 +306,22 @@ struct sbi_pmu_event_info { /* Flags defined for counter start function */ #define SBI_PMU_START_FLAG_SET_INIT_VALUE (1 << 0) #define SBI_PMU_START_FLAG_INIT_FROM_SNAPSHOT (1 << 1) +/* Start flags valid mask */ +#define SBI_PMU_START_FLAGS_MASK \ + ( \ + SBI_PMU_START_FLAG_SET_INIT_VALUE | \ + SBI_PMU_START_FLAG_INIT_FROM_SNAPSHOT \ + ) /* Flags defined for counter stop function */ #define SBI_PMU_STOP_FLAG_RESET (1 << 0) #define SBI_PMU_STOP_FLAG_TAKE_SNAPSHOT (1 << 1) +/* Stop flags valid mask */ +#define SBI_PMU_STOP_FLAGS_MASK \ + ( \ + SBI_PMU_STOP_FLAG_RESET | \ + SBI_PMU_STOP_FLAG_TAKE_SNAPSHOT \ + ) /* SBI function IDs for DBCN extension */ #define SBI_EXT_DBCN_CONSOLE_WRITE 0x0 diff --git a/include/sbi/sbi_hart_protection.h b/include/sbi/sbi_hart_protection.h index de5f2f89..cafe6ee7 100644 --- a/include/sbi/sbi_hart_protection.h +++ b/include/sbi/sbi_hart_protection.h @@ -50,11 +50,14 @@ struct sbi_hart_protection { }; /** - * Get the best hart memory protection mechanism + * Get a string containing names of protection mechanisms + * + * @param out_str pointer to output string + * @param out_str_size maximum size of output string * * @return pointer to best hart memory protection mechanism */ -struct sbi_hart_protection *sbi_hart_memory_protection_best(void); +void sbi_hart_protection_get_str(char *out_str, int out_str_size); /** * Register a hart protection mechanism diff --git a/include/sbi/sbi_hartmask.h b/include/sbi/sbi_hartmask.h index 200ab6e5..da6821ee 100644 --- a/include/sbi/sbi_hartmask.h +++ b/include/sbi/sbi_hartmask.h @@ -20,7 +20,11 @@ * also represents the maximum number of HART ids generic OpenSBI * can handle. */ +#ifdef CONFIG_HARTMASK_MAX_BITS +#define SBI_HARTMASK_MAX_BITS CONFIG_HARTMASK_MAX_BITS +#else #define SBI_HARTMASK_MAX_BITS 128 +#endif /** Representation of hartmask */ struct sbi_hartmask { diff --git a/include/sbi/sbi_timer.h b/include/sbi/sbi_timer.h index 2a040927..17d6c1dc 100644 --- a/include/sbi/sbi_timer.h +++ b/include/sbi/sbi_timer.h @@ -140,6 +140,9 @@ bool sbi_timer_waitms_until(bool (*predicate)(void *), void *arg, /** Get timer value for current HART */ u64 sbi_timer_value(void); +/** Get timer frequency for current HART */ +unsigned long sbi_timer_frequency(void); + /** Compute timer value after specified milliseconds */ static inline u64 sbi_timer_value_after_msecs(ulong msecs) { diff --git a/include/sbi/sbi_tlb.h b/include/sbi/sbi_tlb.h index 3936e857..6db8744d 100644 --- a/include/sbi/sbi_tlb.h +++ b/include/sbi/sbi_tlb.h @@ -54,6 +54,37 @@ do { \ #define SBI_TLB_INFO_SIZE sizeof(struct sbi_tlb_info) +/** Collection of Local TLB operations */ +struct sbi_tlb_local_operations { + /** Local fence.i */ + void (*local_fence_i)(struct sbi_tlb_info *tinfo); + + /** Local supervisor-mode TLB flush */ + void (*local_sfence_vma)(struct sbi_tlb_info *tinfo); + + /** Local supervisor-mode TLB flush with ASID */ + void (*local_sfence_vma_asid)(struct sbi_tlb_info *tinfo); + + /** Local G-stage TLB flush for a specific VMID */ + void (*local_hfence_gvma_vmid)(struct sbi_tlb_info *tinfo); + + /** Local G-stage TLB flush */ + void (*local_hfence_gvma)(struct sbi_tlb_info *tinfo); + + /** Local VS-stage TLB flush with ASID */ + void (*local_hfence_vvma_asid)(struct sbi_tlb_info *tinfo); + + /** Local VS-stage TLB flush */ + void (*local_hfence_vvma)(struct sbi_tlb_info *tinfo); +}; + +/** Get the local TLB operations */ +const struct sbi_tlb_local_operations *sbi_tlb_get_local_operations(void); + +/** Set the local TLB operations */ +void sbi_tlb_set_local_operations( + const struct sbi_tlb_local_operations *ops); + void __sbi_sfence_vma_all(); int sbi_tlb_request(ulong hmask, ulong hbase, struct sbi_tlb_info *tinfo); diff --git a/include/sbi_utils/hsm/fdt_hsm_andes_atcsmu.h b/include/sbi_utils/hsm/fdt_hsm_andes_atcsmu.h index 5e71fab7..bb9a2bc2 100644 --- a/include/sbi_utils/hsm/fdt_hsm_andes_atcsmu.h +++ b/include/sbi_utils/hsm/fdt_hsm_andes_atcsmu.h @@ -9,6 +9,11 @@ #include <sbi/sbi_types.h> +struct atcsmu_sleep_arg { + u32 hartid; + bool deep_sleep; +}; + /* clang-format off */ #define SCRATCH_PAD_OFFSET 0x40 @@ -36,6 +41,7 @@ #define PCS_WAKEUP_RTC_ALARM_MASK BIT(2) #define PCS_WAKEUP_UART2_MASK BIT(9) #define PCS_WAKEUP_MSIP_MASK BIT(29) +#define PCS_WAKEUP_MEIP_MASK BIT(31) #define PCS0_CTL_OFFSET 0x94 #define PCSm_CTL_OFFSET(i) ((i + 3) * 0x20 + PCS0_CTL_OFFSET) @@ -60,6 +66,6 @@ int atcsmu_set_reset_vector(u64 wakeup_addr, u32 hartid); u32 atcsmu_get_sleep_type(u32 hartid); void atcsmu_write_scratch(u32 value); u32 atcsmu_read_scratch(void); -bool atcsmu_pcs_is_sleep(u32 hartid, bool deep_sleep); +bool atcsmu_hart_is_sleep(void *opaque); #endif |
