/** Get pointer to sbi_platform for sbi_scratch pointer */
#define sbi_platform_ptr(__s) \
- ((struct sbi_platform *)((__s)->platform_addr))
+ ((const struct sbi_platform *)((__s)->platform_addr))
/** Get pointer to sbi_platform for current HART */
#define sbi_platform_thishart_ptr() \
- ((struct sbi_platform *)(sbi_scratch_thishart_ptr()->platform_addr))
+ ((const struct sbi_platform *)(sbi_scratch_thishart_ptr()->platform_addr))
/** Check whether the platform supports timer value */
#define sbi_platform_has_timer_value(__p) \
((__p)->features & SBI_PLATFORM_HAS_TIMER_VALUE)
*
* @return pointer to platform name on success and NULL on failure
*/
-static inline const char *sbi_platform_name(struct sbi_platform *plat)
+static inline const char *sbi_platform_name(const struct sbi_platform *plat)
{
if (plat)
return plat->name;
*
* @return TRUE if HART is disabled and FALSE otherwise
*/
-static inline bool sbi_platform_hart_disabled(struct sbi_platform *plat,
+static inline bool sbi_platform_hart_disabled(const struct sbi_platform *plat,
u32 hartid)
{
if (plat && (plat->disabled_hart_mask & (1 << hartid)))
*
* @return total number of HARTs
*/
-static inline u32 sbi_platform_hart_count(struct sbi_platform *plat)
+static inline u32 sbi_platform_hart_count(const struct sbi_platform *plat)
{
if (plat)
return plat->hart_count;
*
* @return stack size in bytes
*/
-static inline u32 sbi_platform_hart_stack_size(struct sbi_platform *plat)
+static inline u32 sbi_platform_hart_stack_size(const struct sbi_platform *plat)
{
if (plat)
return plat->hart_stack_size;
*
* @return 0 on success and negative error code on failure
*/
-static inline int sbi_platform_early_init(struct sbi_platform *plat,
+static inline int sbi_platform_early_init(const struct sbi_platform *plat,
bool cold_boot)
{
if (plat && plat->early_init)
*
* @return 0 on success and negative error code on failure
*/
-static inline int sbi_platform_final_init(struct sbi_platform *plat,
+static inline int sbi_platform_final_init(const struct sbi_platform *plat,
bool cold_boot)
{
if (plat && plat->final_init)
*
* @return number of PMP regions
*/
-static inline u32 sbi_platform_pmp_region_count(struct sbi_platform *plat,
+static inline u32 sbi_platform_pmp_region_count(const struct sbi_platform *plat,
u32 hartid)
{
if (plat && plat->pmp_region_count)
*
* @return 0 on success and negative error code on failure
*/
-static inline int sbi_platform_pmp_region_info(struct sbi_platform *plat,
+static inline int sbi_platform_pmp_region_info(const struct sbi_platform *plat,
u32 hartid, u32 index,
ulong *prot, ulong *addr,
ulong *log2size)
* @param plat pointer to struct sbi_platform
* @param ch character to write
*/
-static inline void sbi_platform_console_putc(struct sbi_platform *plat,
+static inline void sbi_platform_console_putc(const struct sbi_platform *plat,
char ch)
{
if (plat && plat->console_putc)
*
* @return character read from console input
*/
-static inline int sbi_platform_console_getc(struct sbi_platform *plat)
+static inline int sbi_platform_console_getc(const struct sbi_platform *plat)
{
if (plat && plat->console_getc)
return plat->console_getc();
*
* @return 0 on success and negative error code on failure
*/
-static inline int sbi_platform_console_init(struct sbi_platform *plat)
+static inline int sbi_platform_console_init(const struct sbi_platform *plat)
{
if (plat && plat->console_init)
return plat->console_init();
*
* @return 0 on success and negative error code on failure
*/
-static inline int sbi_platform_irqchip_init(struct sbi_platform *plat,
+static inline int sbi_platform_irqchip_init(const struct sbi_platform *plat,
bool cold_boot)
{
if (plat && plat->irqchip_init)
* @param plat pointer to struct sbi_platform
* @param target_hart HART ID of IPI target
*/
-static inline void sbi_platform_ipi_send(struct sbi_platform *plat,
+static inline void sbi_platform_ipi_send(const struct sbi_platform *plat,
u32 target_hart)
{
if (plat && plat->ipi_send)
* @param plat pointer to struct sbi_platform
* @param target_hart HART ID of IPI target
*/
-static inline void sbi_platform_ipi_sync(struct sbi_platform *plat,
+static inline void sbi_platform_ipi_sync(const struct sbi_platform *plat,
u32 target_hart)
{
if (plat && plat->ipi_sync)
* @param plat pointer to struct sbi_platform
* @param target_hart HART ID of IPI target
*/
-static inline void sbi_platform_ipi_clear(struct sbi_platform *plat,
+static inline void sbi_platform_ipi_clear(const struct sbi_platform *plat,
u32 target_hart)
{
if (plat && plat->ipi_clear)
*
* @return 0 on success and negative error code on failure
*/
-static inline int sbi_platform_ipi_init(struct sbi_platform *plat,
+static inline int sbi_platform_ipi_init(const struct sbi_platform *plat,
bool cold_boot)
{
if (plat && plat->ipi_init)
*
* @return 64bit timer value
*/
-static inline u64 sbi_platform_timer_value(struct sbi_platform *plat)
+static inline u64 sbi_platform_timer_value(const struct sbi_platform *plat)
{
if (plat && plat->timer_value)
return plat->timer_value();
* @param plat pointer to struct struct sbi_platform
* @param next_event timer value when timer event will happen
*/
-static inline void sbi_platform_timer_event_start(struct sbi_platform *plat,
- u64 next_event)
+static inline void sbi_platform_timer_event_start(
+ const struct sbi_platform *plat,
+ u64 next_event)
{
if (plat && plat->timer_event_start)
plat->timer_event_start(next_event);
*
* @param plat pointer to struct sbi_platform
*/
-static inline void sbi_platform_timer_event_stop(struct sbi_platform *plat)
+static inline void sbi_platform_timer_event_stop(
+ const struct sbi_platform *plat)
{
if (plat && plat->timer_event_stop)
plat->timer_event_stop();
*
* @return 0 on success and negative error code on failure
*/
-static inline int sbi_platform_timer_init(struct sbi_platform *plat,
+static inline int sbi_platform_timer_init(const struct sbi_platform *plat,
bool cold_boot)
{
if (plat && plat->timer_init)
*
* @return 0 on success and negative error code on failure
*/
-static inline int sbi_platform_system_reboot(struct sbi_platform *plat,
+static inline int sbi_platform_system_reboot(const struct sbi_platform *plat,
u32 type)
{
if (plat && plat->system_reboot)
*
* @return 0 on success and negative error code on failure
*/
-static inline int sbi_platform_system_shutdown(struct sbi_platform *plat,
+static inline int sbi_platform_system_shutdown(const struct sbi_platform *plat,
u32 type)
{
if (plat && plat->system_shutdown)
static void mstatus_init(struct sbi_scratch *scratch, u32 hartid)
{
- struct sbi_platform *plat = sbi_platform_ptr(scratch);
+ const struct sbi_platform *plat = sbi_platform_ptr(scratch);
/* Enable FPU */
if (misa_extension('D') || misa_extension('F'))
static int delegate_traps(struct sbi_scratch *scratch, u32 hartid)
{
- struct sbi_platform *plat = sbi_platform_ptr(scratch);
+ const struct sbi_platform *plat = sbi_platform_ptr(scratch);
unsigned long interrupts, exceptions;
if (!misa_extension('S'))
void sbi_hart_pmp_dump(struct sbi_scratch *scratch)
{
- struct sbi_platform *plat = sbi_platform_ptr(scratch);
+ const struct sbi_platform *plat = sbi_platform_ptr(scratch);
unsigned long prot, addr, size, l2l;
unsigned int i;
u32 i, count;
unsigned long fw_start, fw_size_log2;
ulong prot, addr, log2size;
- struct sbi_platform *plat = sbi_platform_ptr(scratch);
+ const struct sbi_platform *plat = sbi_platform_ptr(scratch);
if (!sbi_platform_has_pmp(plat))
return 0;
void sbi_hart_wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid)
{
unsigned long mipval;
- struct sbi_platform *plat = sbi_platform_ptr(scratch);
+ const struct sbi_platform *plat = sbi_platform_ptr(scratch);
if ((sbi_platform_hart_count(plat) <= hartid) ||
(COLDBOOT_WAIT_BITMAP_SIZE <= hartid))
void sbi_hart_wake_coldboot_harts(struct sbi_scratch *scratch, u32 hartid)
{
- struct sbi_platform *plat = sbi_platform_ptr(scratch);
+ const struct sbi_platform *plat = sbi_platform_ptr(scratch);
int max_hart = sbi_platform_hart_count(plat);
for(int i = 0; i < max_hart ; i++) {