From 1ca215cfeae3cfea0d53563886a4b01debc8c8a2 Mon Sep 17 00:00:00 2001
From: Edward Pierzchalski <ed.pierzchalski@data61.csiro.au>
Date: Thu, 14 Mar 2019 13:38:56 +1100
Subject: [PATCH] RISCV: make sure `i` has a uniform type.

The C parser produces abbreviations for local variables that depend on
the variable type and the order they appear in the source.

The signature for `get_avail_p_reg` on RISCV has a different type for
`i` than every other function, which causes issues when `hardware.h` is
included early in `kernel_all.c_pp`. Changing the type to `word_t`
avoids these issues.
---
 include/plat/spike/plat/machine/hardware.h | 2 +-
 src/plat/spike/machine/hardware.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/plat/spike/plat/machine/hardware.h b/include/plat/spike/plat/machine/hardware.h
index 0c6968411..b7c1930ac 100644
--- a/include/plat/spike/plat/machine/hardware.h
+++ b/include/plat/spike/plat/machine/hardware.h
@@ -60,7 +60,7 @@
 #ifndef __ASSEMBLER__
 
 int get_num_avail_p_regs(void);
-p_region_t get_avail_p_reg(unsigned int i);
+p_region_t get_avail_p_reg(word_t i);
 bool_t add_avail_p_reg(p_region_t reg);
 void map_kernel_devices(void);
 
diff --git a/src/plat/spike/machine/hardware.c b/src/plat/spike/machine/hardware.c
index 10cdc9e84..86e85c9c8 100644
--- a/src/plat/spike/machine/hardware.c
+++ b/src/plat/spike/machine/hardware.c
@@ -51,7 +51,7 @@ BOOT_CODE int get_num_avail_p_regs(void)
     return sizeof(avail_p_regs) / sizeof(p_region_t);
 }
 
-BOOT_CODE p_region_t get_avail_p_reg(unsigned int i)
+BOOT_CODE p_region_t get_avail_p_reg(word_t i)
 {
     return avail_p_regs[i];
 }
-- 
GitLab