Skip to contentSkip to conversation

Improve FDT blob lifecycle self-documentation

PATCH New Samuel Holland 3 participants 20 messages Jul 31, 2024 – Aug 24, 2024

Subsystems (4)
lore
Share & tools
lore

Samuel Holland

author maintainer
#0 lore raw

cover Improve FDT blob lifecycle self-documentation

This series improves the documentation of the FDT blob lifecycle within the OpenSBI code by more explicitly indicating which functions and platform callbacks may modify the FDT blob, and by avoiding ad-hoc calls to fdt_get_address() outside the top-level platform callbacks.

Samuel Holland (16):
lib: utils/fdt: Fix fdt_add_cpu_idle_states() prototype
lib: utils/regmap: Fix typo in comment
lib: utils/fdt: Constify FDT parsing functions
lib: utils/gpio: Constify FDT pointers in parsing functions
lib: utils/i2c: Constify FDT pointers in parsing functions
lib: utils/ipi: Constify FDT pointers in parsing functions
lib: utils/irqchip: Constify FDT pointers in parsing functions
lib: utils/regmap: Constify FDT pointers in parsing functions
lib: utils/reset: Constify FDT pointers in parsing functions
lib: utils/serial: Constify FDT pointers in parsing functions
lib: utils/timer: Constify FDT pointers in parsing functions
platform: generic: Constify FDT pointers in fw_platform_init()
platform: generic: Pass FDT to early/final_init overrides
lib: utils/reset: Pass the FDT to fdt_reset_init()
lib: utils/serial: Pass the FDT to fdt_serial_init()
lib: utils/fdt: Add fdt_get_address_rw() helper

 include/sbi_utils/fdt/fdt_domain.h           |  4 +-
 include/sbi_utils/fdt/fdt_fixup.h            |  2 +-
 include/sbi_utils/fdt/fdt_helper.h           | 61 ++++++++++---------
 include/sbi_utils/fdt/fdt_pmu.h              |  4 +-
 include/sbi_utils/gpio/fdt_gpio.h            |  4 +-
 include/sbi_utils/i2c/fdt_i2c.h              |  4 +-
 include/sbi_utils/ipi/fdt_ipi.h              |  2 +-
 include/sbi_utils/irqchip/fdt_irqchip.h      |  2 +-
 include/sbi_utils/regmap/fdt_regmap.h        |  8 +--
 include/sbi_utils/reset/fdt_reset.h          | 10 ++--
 include/sbi_utils/serial/fdt_serial.h        |  6 +-
 include/sbi_utils/timer/fdt_timer.h          |  2 +-
 lib/utils/fdt/fdt_domain.c                   | 31 +++++++---
 lib/utils/fdt/fdt_helper.c                   | 62 ++++++++++----------
 lib/utils/fdt/fdt_pmu.c                      |  2 +-
 lib/utils/gpio/fdt_gpio.c                    |  6 +-
 lib/utils/gpio/fdt_gpio_designware.c         |  2 +-
 lib/utils/gpio/fdt_gpio_sifive.c             |  2 +-
 lib/utils/gpio/fdt_gpio_starfive.c           |  2 +-
 lib/utils/i2c/fdt_i2c.c                      |  6 +-
 lib/utils/i2c/fdt_i2c_dw.c                   |  4 +-
 lib/utils/i2c/fdt_i2c_sifive.c               |  4 +-
 lib/utils/ipi/fdt_ipi.c                      |  2 +-
 lib/utils/ipi/fdt_ipi_mswi.c                 |  2 +-
 lib/utils/ipi/fdt_ipi_plicsw.c               |  4 +-
 lib/utils/irqchip/fdt_irqchip.c              |  2 +-
 lib/utils/irqchip/fdt_irqchip_aplic.c        |  4 +-
 lib/utils/irqchip/fdt_irqchip_imsic.c        |  6 +-
 lib/utils/irqchip/fdt_irqchip_plic.c         |  4 +-
 lib/utils/regmap/fdt_regmap.c                |  8 +--
 lib/utils/regmap/fdt_regmap_syscon.c         |  2 +-
 lib/utils/reset/fdt_reset.c                  |  5 +-
 lib/utils/reset/fdt_reset_atcwdt200.c        |  2 +-
 lib/utils/reset/fdt_reset_gpio.c             |  2 +-
 lib/utils/reset/fdt_reset_htif.c             |  2 +-
 lib/utils/reset/fdt_reset_sg2042_hwmon_mcu.c |  2 +-
 lib/utils/reset/fdt_reset_sunxi_wdt.c        |  2 +-
 lib/utils/reset/fdt_reset_syscon.c           |  4 +-
 lib/utils/serial/fdt_serial.c                |  3 +-
 lib/utils/serial/fdt_serial_cadence.c        |  2 +-
 lib/utils/serial/fdt_serial_gaisler.c        |  2 +-
 lib/utils/serial/fdt_serial_htif.c           |  2 +-
 lib/utils/serial/fdt_serial_litex.c          |  2 +-
 lib/utils/serial/fdt_serial_renesas_scif.c   |  2 +-
 lib/utils/serial/fdt_serial_shakti.c         |  4 +-
 lib/utils/serial/fdt_serial_sifive.c         |  4 +-
 lib/utils/serial/fdt_serial_uart8250.c       |  2 +-
 lib/utils/serial/fdt_serial_xlnx_uartlite.c  |  4 +-
 lib/utils/timer/fdt_timer.c                  |  2 +-
 lib/utils/timer/fdt_timer_mtimer.c           |  2 +-
 lib/utils/timer/fdt_timer_plmt.c             |  2 +-
 platform/fpga/ariane/platform.c              |  2 +-
 platform/fpga/openpiton/platform.c           |  4 +-
 platform/generic/allwinner/sun20i-d1.c       |  3 +-
 platform/generic/andes/ae350.c               | 10 ++--
 platform/generic/andes/andes_pma.c           |  6 +-
 platform/generic/include/andes/andes_pma.h   |  3 +-
 platform/generic/include/platform_override.h |  6 +-
 platform/generic/platform.c                  | 21 ++++---
 platform/generic/renesas/rzfive/rzfive.c     |  8 ++-
 platform/generic/sifive/fu740.c              |  5 +-
 platform/generic/sophgo/sg2042.c             |  2 +-
 platform/generic/starfive/jh7110.c           | 12 ++--
 platform/generic/thead/thead-generic.c       |  2 +-
 platform/kendryte/k210/platform.c            |  2 +-
 platform/nuclei/ux600/platform.c             |  2 +-
 66 files changed, 210 insertions(+), 194 deletions(-)
Signature · 1 line
2.45.1
author maintainer
#1 lore raw

PATCH 1/16 lib: utils/fdt: Fix fdt_add_cpu_idle_states() prototype

The function prototype should use the same parameter name as the documentation and the function definition.

Fixes 33bf9174602c ("lib: utils: Add fdt_add_cpu_idle_states() helper function")

---

 include/sbi_utils/fdt/fdt_fixup.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/sbi_utils/fdt/fdt_fixup.h +1 -1
index ecd55a72..21a53011 100644
@@ -30,7 +30,7 @@ struct sbi_cpu_idle_state {
  * @param states: array of idle state descriptions, ending with empty element
  * @return zero on success and -ve on failure
  */
-int fdt_add_cpu_idle_states(void *dtb, const struct sbi_cpu_idle_state *state);
+int fdt_add_cpu_idle_states(void *fdt, const struct sbi_cpu_idle_state *state);
 
 /**
  * Fix up the CPU node in the device tree
Signature · 1 line
2.45.1
author maintainer
#2 lore raw

PATCH 2/16 lib: utils/regmap: Fix typo in comment

In reply to Samuel Holland

Balance the quotation marks; double quotes are idiomatic here.

---

 include/sbi_utils/regmap/fdt_regmap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/sbi_utils/regmap/fdt_regmap.h +1 -1
index 0672162c..403dd7d4 100644
@@ -25,7 +25,7 @@ struct fdt_regmap {
 int fdt_regmap_get_by_phandle(void *fdt, u32 phandle,
 			      struct regmap **out_rmap);
 
-/** Get regmap instance based on "regmap' property of the specified DT node */
+/** Get regmap instance based on "regmap" property of the specified DT node */
 int fdt_regmap_get(void *fdt, int nodeoff, struct regmap **out_rmap);
 
 #endif
Signature · 1 line
2.45.1
author maintainer
#3 lore raw

PATCH 3/16 lib: utils/fdt: Constify FDT parsing functions

In reply to Samuel Holland

Distinguish between functions which modify the devicetree and those which only extract information from it. Other than the iterators in fdt_domain.c, this is a mechanical conversion.

---

 include/sbi_utils/fdt/fdt_domain.h |  4 +-
 include/sbi_utils/fdt/fdt_helper.h | 54 +++++++++++++-------------
 include/sbi_utils/fdt/fdt_pmu.h    |  4 +-
 lib/utils/fdt/fdt_domain.c         | 31 +++++++++++----
 lib/utils/fdt/fdt_helper.c         | 62 +++++++++++++++---------------
 lib/utils/fdt/fdt_pmu.c            |  2 +-
 6 files changed, 87 insertions(+), 70 deletions(-)
include/sbi_utils/fdt/fdt_domain.h +2 -2
index ee09d1bf..8c2dee09 100644
@@ -70,12 +70,12 @@ void fdt_domain_fixup(void *fdt);
  *
  * @return 0 on success and negative error code on failure
  */
-int fdt_domains_populate(void *fdt);
+int fdt_domains_populate(const void *fdt);
 
 #else
 
 static inline void fdt_domain_fixup(void *fdt) { }
-static inline int fdt_domains_populate(void *fdt) { return 0; }
+static inline int fdt_domains_populate(const void *fdt) { return 0; }
 
 #endif
 
include/sbi_utils/fdt/fdt_helper.h +27 -27

111 lines not on this page · raw message

include/sbi_utils/fdt/fdt_pmu.h +2 -2
index b10ae270..b31d8351 100644
@@ -52,7 +52,7 @@ int fdt_pmu_fixup(void *fdt);
  *
  * @return 0 on success and negative error code on failure
  */
-int fdt_pmu_setup(void *fdt);
+int fdt_pmu_setup(const void *fdt);
 
 /**
  * Get the mhpmevent select value read from DT for a given event
@@ -70,7 +70,7 @@ extern uint32_t hw_event_count;
 #else
 
 static inline void fdt_pmu_fixup(void *fdt) { }
-static inline int fdt_pmu_setup(void *fdt) { return 0; }
+static inline int fdt_pmu_setup(const void *fdt) { return 0; }
 static inline uint64_t fdt_pmu_get_select_value(uint32_t event_idx) { return 0; }
 
 #endif
lib/utils/fdt/fdt_domain.c +24 -7
index fa1c3575..1fa53a72 100644
@@ -48,6 +48,14 @@ int fdt_iterate_each_domain(void *fdt, void *opaque,
 	return 0;
 }
 
+static int fdt_iterate_each_domain_ro(const void *fdt, void *opaque,
+				      int (*fn)(const void *fdt, int domain_offset,
+						void *opaque))
+{
+	return fdt_iterate_each_domain((void *)fdt, opaque,
+				       (int (*)(void *, int,  void *))fn);
+}
+
 int fdt_iterate_each_memregion(void *fdt, int domain_offset, void *opaque,
 			       int (*fn)(void *fdt, int domain_offset,
 					 int region_offset, u32 region_access,
@@ -88,6 +96,15 @@ int fdt_iterate_each_memregion(void *fdt, int domain_offset, void *opaque,
 	return 0;
 }
 
+static int fdt_iterate_each_memregion_ro(const void *fdt, int domain_offset, void *opaque,
+					 int (*fn)(const void *fdt, int domain_offset,
+						   int region_offset, u32 region_access,
+						   void *opaque))
+{
+	return fdt_iterate_each_memregion((void *)fdt, domain_offset, opaque,
+					  (int (*)(void *, int, int, u32, void *))fn);
+}
+
 struct __fixup_find_domain_offset_info {
 	const char *name;
 	int *doffset;
@@ -228,7 +245,7 @@ struct parse_region_data {
 	u32 max_regions;
 };
 
-static int __fdt_parse_region(void *fdt, int domain_offset,
+static int __fdt_parse_region(const void *fdt, int domain_offset,
 			      int region_offset, u32 region_access,
 			      void *opaque)
 {
@@ -283,7 +300,7 @@ static int __fdt_parse_region(void *fdt, int domain_offset,
 	return 0;
 }
 
-static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque)
+static int __fdt_parse_domain(const void *fdt, int domain_offset, void *opaque)
 {
 	u32 val32;
 	u64 val64;
@@ -347,8 +364,8 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque)
 	}
 
 	/* Setup memregions from DT */
-	err = fdt_iterate_each_memregion(fdt, domain_offset, &preg,
-					 __fdt_parse_region);
+	err = fdt_iterate_each_memregion_ro(fdt, domain_offset, &preg,
+					    __fdt_parse_region);
 	if (err)
 		goto fail_free_all;
 
@@ -491,7 +508,7 @@ fail_free_domain:
 	return err;
 }
 
-int fdt_domains_populate(void *fdt)
+int fdt_domains_populate(const void *fdt)
 {
 	const u32 *val;
 	int cold_domain_offset;
@@ -530,6 +547,6 @@ int fdt_domains_populate(void *fdt)
 	}
 
 	/* Iterate over each domain in FDT and populate details */
-	return fdt_iterate_each_domain(fdt, &cold_domain_offset,
-				       __fdt_parse_domain);
+	return fdt_iterate_each_domain_ro(fdt, &cold_domain_offset,
+					  __fdt_parse_domain);
 }
lib/utils/fdt/fdt_helper.c +31 -31

247 lines not on this page · raw message

lib/utils/fdt/fdt_pmu.c +1 -1
index e23e8223..64de569e 100644
@@ -56,7 +56,7 @@ int fdt_pmu_fixup(void *fdt)
 	return 0;
 }
 
-int fdt_pmu_setup(void *fdt)
+int fdt_pmu_setup(const void *fdt)
 {
 	int i, pmu_offset, len, result;
 	const u32 *event_val;
Signature · 1 line
2.45.1
author maintainer
#4 lore raw

PATCH 4/16 lib: utils/gpio: Constify FDT pointers in parsing functions

In reply to Samuel Holland

Indicate that none of these functions modify the devicetree by constifying the parameter type.

---

 include/sbi_utils/gpio/fdt_gpio.h    | 4 ++--
 lib/utils/gpio/fdt_gpio.c            | 6 +++---
 lib/utils/gpio/fdt_gpio_designware.c | 2 +-
 lib/utils/gpio/fdt_gpio_sifive.c     | 2 +-
 lib/utils/gpio/fdt_gpio_starfive.c   | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)
include/sbi_utils/gpio/fdt_gpio.h +2 -2
index ccbf2a11..303ef632 100644
@@ -20,12 +20,12 @@ struct fdt_gpio {
 	int (*xlate)(struct gpio_chip *chip,
 		     const struct fdt_phandle_args *pargs,
 		     struct gpio_pin *out_pin);
-	int (*init)(void *fdt, int nodeoff, u32 phandle,
+	int (*init)(const void *fdt, int nodeoff, u32 phandle,
 		    const struct fdt_match *match);
 };
 
 /** Get a GPIO pin using "gpios" DT property of client DT node */
-int fdt_gpio_pin_get(void *fdt, int nodeoff, int index,
+int fdt_gpio_pin_get(const void *fdt, int nodeoff, int index,
 		     struct gpio_pin *out_pin);
 
 /** Simple xlate function to convert two GPIO FDT cells into GPIO pin */
lib/utils/gpio/fdt_gpio.c +3 -3
index 7258128d..d8d847f1 100644
@@ -31,7 +31,7 @@ static struct fdt_gpio *fdt_gpio_driver(struct gpio_chip *chip)
 	return NULL;
 }
 
-static int fdt_gpio_init(void *fdt, u32 phandle)
+static int fdt_gpio_init(const void *fdt, u32 phandle)
 {
 	int pos, nodeoff, rc;
 	struct fdt_gpio *drv;
@@ -64,7 +64,7 @@ static int fdt_gpio_init(void *fdt, u32 phandle)
 	return SBI_ENOSYS;
 }
 
-static int fdt_gpio_chip_find(void *fdt, u32 phandle,
+static int fdt_gpio_chip_find(const void *fdt, u32 phandle,
 			      struct gpio_chip **out_chip)
 {
 	int rc;
@@ -88,7 +88,7 @@ static int fdt_gpio_chip_find(void *fdt, u32 phandle,
 	return 0;
 }
 
-int fdt_gpio_pin_get(void *fdt, int nodeoff, int index,
+int fdt_gpio_pin_get(const void *fdt, int nodeoff, int index,
 		     struct gpio_pin *out_pin)
 {
 	int rc;
lib/utils/gpio/fdt_gpio_designware.c +1 -1
index 018e2d54..20701a15 100644
@@ -78,7 +78,7 @@ static void dw_gpio_set(struct gpio_pin *gp, int value)
  * bank A is the only one with irq support but we're not using it here
 */
 
-static int dw_gpio_init_bank(void *fdt, int nodeoff, u32 phandle,
+static int dw_gpio_init_bank(const void *fdt, int nodeoff, u32 phandle,
 			     const struct fdt_match *match)
 {
 	struct dw_gpio_chip *chip;
lib/utils/gpio/fdt_gpio_sifive.c +1 -1
index 5e3f39d7..e5dbe2be 100644
@@ -62,7 +62,7 @@ static void sifive_gpio_set(struct gpio_pin *gp, int value)
 
 extern struct fdt_gpio fdt_gpio_sifive;
 
-static int sifive_gpio_init(void *fdt, int nodeoff, u32 phandle,
+static int sifive_gpio_init(const void *fdt, int nodeoff, u32 phandle,
 			    const struct fdt_match *match)
 {
 	int rc;
lib/utils/gpio/fdt_gpio_starfive.c +1 -1
index bd2a9f21..d84ff1fe 100644
@@ -71,7 +71,7 @@ static void starfive_gpio_set(struct gpio_pin *gp, int value)
 
 extern struct fdt_gpio fdt_gpio_starfive;
 
-static int starfive_gpio_init(void *fdt, int nodeoff, u32 phandle,
+static int starfive_gpio_init(const void *fdt, int nodeoff, u32 phandle,
 			      const struct fdt_match *match)
 {
 	int rc;
Signature · 1 line
2.45.1
author maintainer
#5 lore raw

PATCH 5/16 lib: utils/i2c: Constify FDT pointers in parsing functions

In reply to Samuel Holland

Indicate that none of these functions modify the devicetree by constifying the parameter type.

---

 include/sbi_utils/i2c/fdt_i2c.h | 4 ++--
 lib/utils/i2c/fdt_i2c.c         | 6 +++---
 lib/utils/i2c/fdt_i2c_dw.c      | 4 ++--
 lib/utils/i2c/fdt_i2c_sifive.c  | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)
include/sbi_utils/i2c/fdt_i2c.h +2 -2
index c6e33399..65758ec2 100644
@@ -15,12 +15,12 @@
 /** FDT based I2C adapter driver */
 struct fdt_i2c_adapter {
 	const struct fdt_match *match_table;
-	int (*init)(void *fdt, int nodeoff,
+	int (*init)(const void *fdt, int nodeoff,
 		    const struct fdt_match *match);
 };
 
 /** Get I2C adapter identified by nodeoff */
-int fdt_i2c_adapter_get(void *fdt, int nodeoff,
+int fdt_i2c_adapter_get(const void *fdt, int nodeoff,
 			struct i2c_adapter **out_adapter);
 
 #endif
lib/utils/i2c/fdt_i2c.c +3 -3
index 6fd35dd0..d23b40db 100644
@@ -20,7 +20,7 @@
 extern struct fdt_i2c_adapter *fdt_i2c_adapter_drivers[];
 extern unsigned long fdt_i2c_adapter_drivers_size;
 
-static int fdt_i2c_adapter_init(void *fdt, int nodeoff)
+static int fdt_i2c_adapter_init(const void *fdt, int nodeoff)
 {
 	int pos, rc;
 	struct fdt_i2c_adapter *drv;
@@ -43,7 +43,7 @@ static int fdt_i2c_adapter_init(void *fdt, int nodeoff)
 	return SBI_ENOSYS;
 }
 
-static int fdt_i2c_adapter_find(void *fdt, int nodeoff,
+static int fdt_i2c_adapter_find(const void *fdt, int nodeoff,
 				struct i2c_adapter **out_adapter)
 {
 	int rc;
@@ -67,7 +67,7 @@ static int fdt_i2c_adapter_find(void *fdt, int nodeoff,
 	return 0;
 }
 
-int fdt_i2c_adapter_get(void *fdt, int nodeoff,
+int fdt_i2c_adapter_get(const void *fdt, int nodeoff,
 			struct i2c_adapter **out_adapter)
 {
 	int rc;
lib/utils/i2c/fdt_i2c_dw.c +2 -2
index 358ad3c7..7d14ea0d 100644
@@ -15,8 +15,8 @@
 #include <sbi_utils/i2c/dw_i2c.h>
 #include <sbi_utils/i2c/fdt_i2c.h>
 
-static int fdt_dw_i2c_init(void *fdt, int nodeoff,
-			     const struct fdt_match *match)
+static int fdt_dw_i2c_init(const void *fdt, int nodeoff,
+			   const struct fdt_match *match)
 {
 	int rc;
 	struct dw_i2c_adapter *adapter;
lib/utils/i2c/fdt_i2c_sifive.c +2 -2
index 11740624..b420a7da 100644
@@ -230,8 +230,8 @@ static int sifive_i2c_adapter_read(struct i2c_adapter *ia, uint8_t addr,
 	return 0;
 }
 
-static int sifive_i2c_init(void *fdt, int nodeoff,
-			    const struct fdt_match *match)
+static int sifive_i2c_init(const void *fdt, int nodeoff,
+			   const struct fdt_match *match)
 {
 	int rc;
 	struct sifive_i2c_adapter *adapter;
Signature · 1 line
2.45.1
author maintainer
#6 lore raw

PATCH 6/16 lib: utils/ipi: Constify FDT pointers in parsing functions

In reply to Samuel Holland

Indicate that none of these functions modify the devicetree by constifying the parameter type.

---

 include/sbi_utils/ipi/fdt_ipi.h | 2 +-
 lib/utils/ipi/fdt_ipi.c         | 2 +-
 lib/utils/ipi/fdt_ipi_mswi.c    | 2 +-
 lib/utils/ipi/fdt_ipi_plicsw.c  | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
include/sbi_utils/ipi/fdt_ipi.h +1 -1
index 1dd9062d..c6245201 100644
@@ -16,7 +16,7 @@
 
 struct fdt_ipi {
 	const struct fdt_match *match_table;
-	int (*cold_init)(void *fdt, int nodeoff, const struct fdt_match *match);
+	int (*cold_init)(const void *fdt, int nodeoff, const struct fdt_match *match);
 	int (*warm_init)(void);
 	void (*exit)(void);
 };
lib/utils/ipi/fdt_ipi.c +1 -1
index 0b75093e..959cf57d 100644
@@ -36,7 +36,7 @@ static int fdt_ipi_cold_init(void)
 	int pos, noff, rc;
 	struct fdt_ipi *drv;
 	const struct fdt_match *match;
-	void *fdt = fdt_get_address();
+	const void *fdt = fdt_get_address();
 
 	for (pos = 0; pos < fdt_ipi_drivers_size; pos++) {
 		drv = fdt_ipi_drivers[pos];
lib/utils/ipi/fdt_ipi_mswi.c +1 -1
index a709abe1..c78dead1 100644
@@ -13,7 +13,7 @@
 #include <sbi_utils/ipi/fdt_ipi.h>
 #include <sbi_utils/ipi/aclint_mswi.h>
 
-static int ipi_mswi_cold_init(void *fdt, int nodeoff,
+static int ipi_mswi_cold_init(const void *fdt, int nodeoff,
 			      const struct fdt_match *match)
 {
 	int rc;
lib/utils/ipi/fdt_ipi_plicsw.c +2 -2
index bf29bfc1..32885745 100644
@@ -17,8 +17,8 @@
 
 extern struct plicsw_data plicsw;
 
-int fdt_plicsw_cold_ipi_init(void *fdt, int nodeoff,
-				const struct fdt_match *match)
+int fdt_plicsw_cold_ipi_init(const void *fdt, int nodeoff,
+			     const struct fdt_match *match)
 {
 	int rc;
 
Signature · 1 line
2.45.1
author maintainer
#7 lore raw

PATCH 7/16 lib: utils/irqchip: Constify FDT pointers in parsing functions

In reply to Samuel Holland

Indicate that none of these functions modify the devicetree by constifying the parameter type.

---

 include/sbi_utils/irqchip/fdt_irqchip.h | 2 +-
 lib/utils/irqchip/fdt_irqchip.c         | 2 +-
 lib/utils/irqchip/fdt_irqchip_aplic.c   | 4 ++--
 lib/utils/irqchip/fdt_irqchip_imsic.c   | 6 +++---
 lib/utils/irqchip/fdt_irqchip_plic.c    | 4 ++--
 5 files changed, 9 insertions(+), 9 deletions(-)
include/sbi_utils/irqchip/fdt_irqchip.h +1 -1
index 63e9fd9e..bc02c0c8 100644
@@ -16,7 +16,7 @@
 
 struct fdt_irqchip {
 	const struct fdt_match *match_table;
-	int (*cold_init)(void *fdt, int nodeoff, const struct fdt_match *match);
+	int (*cold_init)(const void *fdt, int nodeoff, const struct fdt_match *match);
 	int (*warm_init)(void);
 	void (*exit)(void);
 };
lib/utils/irqchip/fdt_irqchip.c +1 -1
index c38b1d85..b4f054ae 100644
@@ -53,7 +53,7 @@ static int fdt_irqchip_cold_init(void)
 	int pos, noff, rc;
 	struct fdt_irqchip *drv;
 	const struct fdt_match *match;
-	void *fdt = fdt_get_address();
+	const void *fdt = fdt_get_address();
 
 	for (pos = 0; pos < fdt_irqchip_drivers_size; pos++) {
 		drv = fdt_irqchip_drivers[pos];
lib/utils/irqchip/fdt_irqchip_aplic.c +2 -2
index 583a3e30..6eb6e085 100644
@@ -22,8 +22,8 @@ static int irqchip_aplic_warm_init(void)
 	return 0;
 }
 
-static int irqchip_aplic_cold_init(void *fdt, int nodeoff,
-				  const struct fdt_match *match)
+static int irqchip_aplic_cold_init(const void *fdt, int nodeoff,
+				   const struct fdt_match *match)
 {
 	int rc;
 	struct aplic_data *pd;
lib/utils/irqchip/fdt_irqchip_imsic.c +3 -3
index 4eb18545..ca62b427 100644
@@ -16,7 +16,7 @@
 #include <sbi_utils/irqchip/fdt_irqchip.h>
 #include <sbi_utils/irqchip/imsic.h>
 
-static int irqchip_imsic_update_hartid_table(void *fdt, int nodeoff,
+static int irqchip_imsic_update_hartid_table(const void *fdt, int nodeoff,
 					     struct imsic_data *id)
 {
 	const fdt32_t *val;
@@ -58,8 +58,8 @@ static int irqchip_imsic_update_hartid_table(void *fdt, int nodeoff,
 	return 0;
 }
 
-static int irqchip_imsic_cold_init(void *fdt, int nodeoff,
-				    const struct fdt_match *match)
+static int irqchip_imsic_cold_init(const void *fdt, int nodeoff,
+				   const struct fdt_match *match)
 {
 	int rc;
 	struct imsic_data *id;
lib/utils/irqchip/fdt_irqchip_plic.c +2 -2
index 829c5ee2..a8aa4fcd 100644
@@ -85,7 +85,7 @@ static int irqchip_plic_warm_init(void)
 				      plic_get_hart_scontext(scratch));
 }
 
-static int irqchip_plic_update_hartid_table(void *fdt, int nodeoff,
+static int irqchip_plic_update_hartid_table(const void *fdt, int nodeoff,
 					    struct plic_data *pd)
 {
 	const fdt32_t *val;
@@ -132,7 +132,7 @@ static int irqchip_plic_update_hartid_table(void *fdt, int nodeoff,
 	return 0;
 }
 
-static int irqchip_plic_cold_init(void *fdt, int nodeoff,
+static int irqchip_plic_cold_init(const void *fdt, int nodeoff,
 				  const struct fdt_match *match)
 {
 	int rc;
Signature · 1 line
2.45.1
author maintainer
#8 lore raw

PATCH 8/16 lib: utils/regmap: Constify FDT pointers in parsing functions

In reply to Samuel Holland

Indicate that none of these functions modify the devicetree by constifying the parameter type.

---

 include/sbi_utils/regmap/fdt_regmap.h | 6 +++---
 lib/utils/regmap/fdt_regmap.c         | 8 ++++----
 lib/utils/regmap/fdt_regmap_syscon.c  | 2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)
include/sbi_utils/regmap/fdt_regmap.h +3 -3
index 403dd7d4..86e72442 100644
@@ -17,15 +17,15 @@ struct fdt_phandle_args;
 /** FDT based regmap driver */
 struct fdt_regmap {
 	const struct fdt_match *match_table;
-	int (*init)(void *fdt, int nodeoff, u32 phandle,
+	int (*init)(const void *fdt, int nodeoff, u32 phandle,
 		    const struct fdt_match *match);
 };
 
 /** Get regmap instance based on phandle */
-int fdt_regmap_get_by_phandle(void *fdt, u32 phandle,
+int fdt_regmap_get_by_phandle(const void *fdt, u32 phandle,
 			      struct regmap **out_rmap);
 
 /** Get regmap instance based on "regmap" property of the specified DT node */
-int fdt_regmap_get(void *fdt, int nodeoff, struct regmap **out_rmap);
+int fdt_regmap_get(const void *fdt, int nodeoff, struct regmap **out_rmap);
 
 #endif
lib/utils/regmap/fdt_regmap.c +4 -4
index fffac1de..f02d2f07 100644
@@ -16,7 +16,7 @@
 extern struct fdt_regmap *fdt_regmap_drivers[];
 extern unsigned long fdt_regmap_drivers_size;
 
-static int fdt_regmap_init(void *fdt, int nodeoff, u32 phandle)
+static int fdt_regmap_init(const void *fdt, int nodeoff, u32 phandle)
 {
 	int pos, rc;
 	struct fdt_regmap *drv;
@@ -39,7 +39,7 @@ static int fdt_regmap_init(void *fdt, int nodeoff, u32 phandle)
 	return SBI_ENOSYS;
 }
 
-static int fdt_regmap_find(void *fdt, int nodeoff, u32 phandle,
+static int fdt_regmap_find(const void *fdt, int nodeoff, u32 phandle,
 			   struct regmap **out_rmap)
 {
 	int rc;
@@ -63,7 +63,7 @@ static int fdt_regmap_find(void *fdt, int nodeoff, u32 phandle,
 	return 0;
 }
 
-int fdt_regmap_get_by_phandle(void *fdt, u32 phandle,
+int fdt_regmap_get_by_phandle(const void *fdt, u32 phandle,
 			      struct regmap **out_rmap)
 {
 	int pnodeoff;
@@ -78,7 +78,7 @@ int fdt_regmap_get_by_phandle(void *fdt, u32 phandle,
 	return fdt_regmap_find(fdt, pnodeoff, phandle, out_rmap);
 }
 
-int fdt_regmap_get(void *fdt, int nodeoff, struct regmap **out_rmap)
+int fdt_regmap_get(const void *fdt, int nodeoff, struct regmap **out_rmap)
 {
 	int len;
 	const fdt32_t *val;
lib/utils/regmap/fdt_regmap_syscon.c +1 -1
index d87b6e09..a95f2515 100644
@@ -159,7 +159,7 @@ static int regmap_syscon_write_be32(struct regmap *rmap, unsigned int reg,
 	return 0;
 }
 
-static int regmap_syscon_init(void *fdt, int nodeoff, u32 phandle,
+static int regmap_syscon_init(const void *fdt, int nodeoff, u32 phandle,
 			      const struct fdt_match *match)
 {
 	struct syscon_regmap *srm;
Signature · 1 line
2.45.1
author maintainer
#9 lore raw

PATCH 9/16 lib: utils/reset: Constify FDT pointers in parsing functions

In reply to Samuel Holland

Indicate that none of these functions modify the devicetree by constifying the parameter type.

---

 include/sbi_utils/reset/fdt_reset.h          | 6 +++---
 lib/utils/reset/fdt_reset.c                  | 4 ++--
 lib/utils/reset/fdt_reset_atcwdt200.c        | 2 +-
 lib/utils/reset/fdt_reset_gpio.c             | 2 +-
 lib/utils/reset/fdt_reset_htif.c             | 2 +-
 lib/utils/reset/fdt_reset_sg2042_hwmon_mcu.c | 2 +-
 lib/utils/reset/fdt_reset_sunxi_wdt.c        | 2 +-
 lib/utils/reset/fdt_reset_syscon.c           | 4 ++--
 platform/generic/sifive/fu740.c              | 2 +-
 platform/generic/starfive/jh7110.c           | 6 +++---
 10 files changed, 16 insertions(+), 16 deletions(-)
include/sbi_utils/reset/fdt_reset.h +3 -3
index ea8063b8..80179873 100644
@@ -14,7 +14,7 @@
 
 struct fdt_reset {
 	const struct fdt_match *match_table;
-	int (*init)(void *fdt, int nodeoff, const struct fdt_match *match);
+	int (*init)(const void *fdt, int nodeoff, const struct fdt_match *match);
 };
 
 #ifdef CONFIG_FDT_RESET
@@ -22,7 +22,7 @@ struct fdt_reset {
 /**
  * fdt_reset_driver_init() - initialize reset driver based on the device-tree
  */
-int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv);
+int fdt_reset_driver_init(const void *fdt, struct fdt_reset *drv);
 
 /**
  * fdt_reset_init() - initialize reset drivers based on the device-tree
@@ -33,7 +33,7 @@ void fdt_reset_init(void);
 
 #else
 
-static inline int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv)
+static inline int fdt_reset_driver_init(const void *fdt, struct fdt_reset *drv)
 {
 	return 0;
 }
lib/utils/reset/fdt_reset.c +2 -2
index ee4e29a3..960c08d0 100644
@@ -17,7 +17,7 @@
 extern struct fdt_reset *fdt_reset_drivers[];
 extern unsigned long fdt_reset_drivers_size;
 
-int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv)
+int fdt_reset_driver_init(const void *fdt, struct fdt_reset *drv)
 {
 	int noff, rc, cnt = 0;
 	const struct fdt_match *match;
@@ -45,7 +45,7 @@ int fdt_reset_driver_init(void *fdt, struct fdt_reset *drv)
 void fdt_reset_init(void)
 {
 	int pos;
-	void *fdt = fdt_get_address();
+	const void *fdt = fdt_get_address();
 
 	for (pos = 0; pos < fdt_reset_drivers_size; pos++)
 		fdt_reset_driver_init(fdt, fdt_reset_drivers[pos]);
lib/utils/reset/fdt_reset_atcwdt200.c +1 -1
index 03d547b9..6ef3b134 100644
@@ -80,7 +80,7 @@ static struct sbi_system_reset_device atcwdt200_reset = {
 	.system_reset	    = ae350_system_reset,
 };
 
-static int atcwdt200_reset_init(void *fdt, int nodeoff,
+static int atcwdt200_reset_init(const void *fdt, int nodeoff,
 				const struct fdt_match *match)
 {
 	uint64_t reg_addr;
lib/utils/reset/fdt_reset_gpio.c +1 -1
index 6a908dd7..de81e2eb 100644
@@ -113,7 +113,7 @@ static struct sbi_system_reset_device gpio_restart = {
 	.system_reset = gpio_system_restart
 };
 
-static int gpio_reset_init(void *fdt, int nodeoff,
+static int gpio_reset_init(const void *fdt, int nodeoff,
 			   const struct fdt_match *match)
 {
 	int rc, len;
lib/utils/reset/fdt_reset_htif.c +1 -1
index 2cc52dda..7c04c81c 100644
@@ -11,7 +11,7 @@
 #include <sbi_utils/fdt/fdt_helper.h>
 #include <sbi_utils/sys/htif.h>
 
-static int htif_reset_init(void *fdt, int nodeoff,
+static int htif_reset_init(const void *fdt, int nodeoff,
 			   const struct fdt_match *match)
 {
 	bool custom = false;
lib/utils/reset/fdt_reset_sg2042_hwmon_mcu.c +1 -1
index 51bd74ab..368cd108 100644
@@ -76,7 +76,7 @@ static int sg2042_mcu_reset_check_board(struct i2c_adapter *adap, uint32_t reg)
 	return 0;
 }
 
-static int sg2042_mcu_reset_init(void *fdt, int nodeoff,
+static int sg2042_mcu_reset_init(const void *fdt, int nodeoff,
 				 const struct fdt_match *match)
 {
 	int ret, i2c_bus;
lib/utils/reset/fdt_reset_sunxi_wdt.c +1 -1
index 446d32b4..f4b06d23 100644
@@ -49,7 +49,7 @@ static struct sbi_system_reset_device sunxi_wdt_reset = {
 	.system_reset = sunxi_wdt_system_reset,
 };
 
-static int sunxi_wdt_reset_init(void *fdt, int nodeoff,
+static int sunxi_wdt_reset_init(const void *fdt, int nodeoff,
 				const struct fdt_match *match)
 {
 	uint64_t reg_addr;
lib/utils/reset/fdt_reset_syscon.c +2 -2
index bae9ec58..0dd76acb 100644
@@ -96,8 +96,8 @@ static struct sbi_system_reset_device syscon_reboot = {
 	.system_reset = syscon_do_reboot
 };
 
-static int syscon_reset_init(void *fdt, int nodeoff,
-			   const struct fdt_match *match)
+static int syscon_reset_init(const void *fdt, int nodeoff,
+			     const struct fdt_match *match)
 {
 	int rc, len;
 	const fdt32_t *val, *mask;
platform/generic/sifive/fu740.c +1 -1
index fe71ce6a..ce83a050 100644
@@ -173,7 +173,7 @@ static struct sbi_system_reset_device da9063_reset_i2c = {
 	.system_reset = da9063_system_reset
 };
 
-static int da9063_reset_init(void *fdt, int nodeoff,
+static int da9063_reset_init(const void *fdt, int nodeoff,
 			     const struct fdt_match *match)
 {
 	int rc, i2c_bus;
platform/generic/starfive/jh7110.c +3 -3
index 62dcd256..560fe1d7 100644
@@ -186,9 +186,9 @@ static struct sbi_system_reset_device pm_reset = {
 	.system_reset = pm_system_reset
 };
 
-static int starfive_jh7110_inst_init(void *fdt);
+static int starfive_jh7110_inst_init(const void *fdt);
 
-static int pm_reset_init(void *fdt, int nodeoff,
+static int pm_reset_init(const void *fdt, int nodeoff,
 			 const struct fdt_match *match)
 {
 	int rc;
@@ -232,7 +232,7 @@ static struct fdt_reset fdt_reset_pmic = {
 	.init = pm_reset_init,
 };
 
-static int starfive_jh7110_inst_init(void *fdt)
+static int starfive_jh7110_inst_init(const void *fdt)
 {
 	int noff, rc = 0;
 	const fdt32_t *val;
Signature · 1 line
2.45.1
author maintainer
#10 lore raw

PATCH 10/16 lib: utils/serial: Constify FDT pointers in parsing functions

In reply to Samuel Holland

Indicate that none of these functions modify the devicetree by constifying the parameter type.

---

 include/sbi_utils/serial/fdt_serial.h       | 2 +-
 lib/utils/serial/fdt_serial.c               | 2 +-
 lib/utils/serial/fdt_serial_cadence.c       | 2 +-
 lib/utils/serial/fdt_serial_gaisler.c       | 2 +-
 lib/utils/serial/fdt_serial_htif.c          | 2 +-
 lib/utils/serial/fdt_serial_litex.c         | 2 +-
 lib/utils/serial/fdt_serial_renesas_scif.c  | 2 +-
 lib/utils/serial/fdt_serial_shakti.c        | 4 ++--
 lib/utils/serial/fdt_serial_sifive.c        | 4 ++--
 lib/utils/serial/fdt_serial_uart8250.c      | 2 +-
 lib/utils/serial/fdt_serial_xlnx_uartlite.c | 4 ++--
 11 files changed, 14 insertions(+), 14 deletions(-)
include/sbi_utils/serial/fdt_serial.h +1 -1
index daa2e4f5..a0053a16 100644
@@ -16,7 +16,7 @@
 
 struct fdt_serial {
 	const struct fdt_match *match_table;
-	int (*init)(void *fdt, int nodeoff, const struct fdt_match *match);
+	int (*init)(const void *fdt, int nodeoff, const struct fdt_match *match);
 };
 
 int fdt_serial_init(void);
lib/utils/serial/fdt_serial.c +1 -1
index 798ac749..6f995cf7 100644
@@ -23,7 +23,7 @@ int fdt_serial_init(void)
 	struct fdt_serial *drv;
 	const struct fdt_match *match;
 	int pos, noff = -1, len, coff, rc;
-	void *fdt = fdt_get_address();
+	const void *fdt = fdt_get_address();
 
 	/* Find offset of node pointed to by stdout-path */
 	coff = fdt_path_offset(fdt, "/chosen");
lib/utils/serial/fdt_serial_cadence.c +1 -1
index ae59e4c1..ee7d7797 100644
@@ -10,7 +10,7 @@
 #include <sbi_utils/serial/fdt_serial.h>
 #include <sbi_utils/serial/cadence-uart.h>
 
-static int serial_cadence_init(void *fdt, int nodeoff,
+static int serial_cadence_init(const void *fdt, int nodeoff,
 			       const struct fdt_match *match)
 {
 	int rc;
lib/utils/serial/fdt_serial_gaisler.c +1 -1
index 74988e34..cae1727d 100644
@@ -11,7 +11,7 @@
 #include <sbi_utils/serial/fdt_serial.h>
 #include <sbi_utils/serial/gaisler-uart.h>
 
-static int serial_gaisler_init(void *fdt, int nodeoff,
+static int serial_gaisler_init(const void *fdt, int nodeoff,
 			       const struct fdt_match *match)
 {
 	int rc;
lib/utils/serial/fdt_serial_htif.c +1 -1
index 7d88e7a1..43557f6c 100644
@@ -18,7 +18,7 @@ static const struct fdt_match serial_htif_match[] = {
 	{ },
 };
 
-static int serial_htif_init(void *fdt, int nodeoff,
+static int serial_htif_init(const void *fdt, int nodeoff,
 			    const struct fdt_match *match)
 {
 	int rc;
lib/utils/serial/fdt_serial_litex.c +1 -1
index 3b3b306b..9aed719f 100644
@@ -12,7 +12,7 @@
 #include <sbi_utils/serial/fdt_serial.h>
 #include <sbi_utils/serial/litex-uart.h>
 
-static int serial_litex_init(void *fdt, int nodeoff,
+static int serial_litex_init(const void *fdt, int nodeoff,
 			     const struct fdt_match *match)
 {
 	uint64_t reg_addr, reg_size;
lib/utils/serial/fdt_serial_renesas_scif.c +1 -1
index c331ca1a..41356d1d 100644
@@ -7,7 +7,7 @@
 #include <sbi_utils/serial/fdt_serial.h>
 #include <sbi_utils/serial/renesas-scif.h>
 
-static int serial_renesas_scif_init(void *fdt, int nodeoff,
+static int serial_renesas_scif_init(const void *fdt, int nodeoff,
 				    const struct fdt_match *match)
 {
 	struct platform_uart_data uart = { 0 };
lib/utils/serial/fdt_serial_shakti.c +2 -2
index 0e056303..2bafc99b 100644
@@ -9,8 +9,8 @@
 #include <sbi_utils/serial/fdt_serial.h>
 #include <sbi_utils/serial/shakti-uart.h>
 
-static int serial_shakti_init(void *fdt, int nodeoff,
-				const struct fdt_match *match)
+static int serial_shakti_init(const void *fdt, int nodeoff,
+			      const struct fdt_match *match)
 {
 	int rc;
 	struct platform_uart_data uart = { 0 };
lib/utils/serial/fdt_serial_sifive.c +2 -2
index 3ca10913..f551b78c 100644
@@ -11,8 +11,8 @@
 #include <sbi_utils/serial/fdt_serial.h>
 #include <sbi_utils/serial/sifive-uart.h>
 
-static int serial_sifive_init(void *fdt, int nodeoff,
-				const struct fdt_match *match)
+static int serial_sifive_init(const void *fdt, int nodeoff,
+			      const struct fdt_match *match)
 {
 	int rc;
 	struct platform_uart_data uart = { 0 };
lib/utils/serial/fdt_serial_uart8250.c +1 -1
index 7b5d6a4c..10d201cc 100644
@@ -11,7 +11,7 @@
 #include <sbi_utils/serial/fdt_serial.h>
 #include <sbi_utils/serial/uart8250.h>
 
-static int serial_uart8250_init(void *fdt, int nodeoff,
+static int serial_uart8250_init(const void *fdt, int nodeoff,
 				const struct fdt_match *match)
 {
 	int rc;
lib/utils/serial/fdt_serial_xlnx_uartlite.c +2 -2
index 9f04aea3..0a829ad2 100644
@@ -11,8 +11,8 @@
 #include <sbi_utils/serial/fdt_serial.h>
 #include <sbi_utils/serial/xlnx_uartlite.h>
 
-static int serial_xlnx_uartlite_init(void *fdt, int nodeoff,
-				const struct fdt_match *match)
+static int serial_xlnx_uartlite_init(const void *fdt, int nodeoff,
+				     const struct fdt_match *match)
 {
 	int rc;
 	struct platform_uart_data uart = { 0 };
Signature · 1 line
2.45.1
author maintainer
#11 lore raw

PATCH 11/16 lib: utils/timer: Constify FDT pointers in parsing functions

In reply to Samuel Holland

Indicate that none of these functions modify the devicetree by constifying the parameter type.

---

 include/sbi_utils/timer/fdt_timer.h | 2 +-
 lib/utils/timer/fdt_timer.c         | 2 +-
 lib/utils/timer/fdt_timer_mtimer.c  | 2 +-
 lib/utils/timer/fdt_timer_plmt.c    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
include/sbi_utils/timer/fdt_timer.h +1 -1
index cf105fed..555ebcba 100644
@@ -16,7 +16,7 @@
 
 struct fdt_timer {
 	const struct fdt_match *match_table;
-	int (*cold_init)(void *fdt, int nodeoff, const struct fdt_match *match);
+	int (*cold_init)(const void *fdt, int nodeoff, const struct fdt_match *match);
 	int (*warm_init)(void);
 	void (*exit)(void);
 };
lib/utils/timer/fdt_timer.c +1 -1
index f4687304..aa0494e4 100644
@@ -36,7 +36,7 @@ static int fdt_timer_cold_init(void)
 	int pos, noff, rc;
 	struct fdt_timer *drv;
 	const struct fdt_match *match;
-	void *fdt = fdt_get_address();
+	const void *fdt = fdt_get_address();
 
 	for (pos = 0; pos < fdt_timer_drivers_size; pos++) {
 		drv = fdt_timer_drivers[pos];
lib/utils/timer/fdt_timer_mtimer.c +1 -1
index 9e27e3ab..458e8881 100644
@@ -30,7 +30,7 @@ static SBI_LIST_HEAD(mtn_list);
 
 static struct aclint_mtimer_data *mt_reference = NULL;
 
-static int timer_mtimer_cold_init(void *fdt, int nodeoff,
+static int timer_mtimer_cold_init(const void *fdt, int nodeoff,
 				  const struct fdt_match *match)
 {
 	int rc;
lib/utils/timer/fdt_timer_plmt.c +1 -1
index e8be91b9..88a42e2a 100644
@@ -13,7 +13,7 @@
 
 extern struct plmt_data plmt;
 
-static int fdt_plmt_cold_timer_init(void *fdt, int nodeoff,
+static int fdt_plmt_cold_timer_init(const void *fdt, int nodeoff,
 				    const struct fdt_match *match)
 {
 	int rc;
Signature · 1 line
2.45.1
author maintainer
#12 lore raw

PATCH 12/16 platform: generic: Constify FDT pointers in fw_platform_init()

In reply to Samuel Holland

Indicate that none of these functions modify the devicetree by constifying the parameter type.

---

 platform/generic/include/platform_override.h | 2 +-
 platform/generic/platform.c                  | 6 +++---
 platform/generic/starfive/jh7110.c           | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
platform/generic/include/platform_override.h +1 -1
index b0585c21..bd6fdacc 100644
@@ -29,7 +29,7 @@ struct platform_override {
 	int (*extensions_init)(const struct fdt_match *match,
 			       struct sbi_hart_features *hfeatures);
 	int (*pmu_init)(const struct fdt_match *match);
-	void (*fw_init)(void *fdt, const struct fdt_match *match);
+	void (*fw_init)(const void *fdt, const struct fdt_match *match);
 	int (*vendor_ext_provider)(long funcid,
 				   struct sbi_trap_regs *regs,
 				   struct sbi_ecall_return *out,
platform/generic/platform.c +3 -3
index 3470474a..4d26ae7c 100644
@@ -36,7 +36,7 @@ extern unsigned long platform_override_modules_size;
 static const struct platform_override *generic_plat = NULL;
 static const struct fdt_match *generic_plat_match = NULL;
 
-static void fw_platform_lookup_special(void *fdt, int root_offset)
+static void fw_platform_lookup_special(const void *fdt, int root_offset)
 {
 	const struct platform_override *plat;
 	const struct fdt_match *match;
@@ -81,7 +81,7 @@ static DECLARE_BITMAP(generic_coldboot_harts, SBI_HARTMASK_MAX_BITS);
  * according to the DT property "cold-boot-harts" in "/chosen/opensbi-config" 
  * DT node. If there is no "cold-boot-harts" in DT, all harts will be allowed.
  */
-static void fw_platform_coldboot_harts_init(void *fdt)
+static void fw_platform_coldboot_harts_init(const void *fdt)
 {
 	int chosen_offset, config_offset, cpu_offset, len, err;
 	u32 val32;
@@ -146,7 +146,7 @@ unsigned long fw_platform_init(unsigned long arg0, unsigned long arg1,
 				unsigned long arg4)
 {
 	const char *model;
-	void *fdt = (void *)arg1;
+	const void *fdt = (void *)arg1;
 	u32 hartid, hart_count = 0;
 	int rc, root_offset, cpus_offset, cpu_offset, len;
 
platform/generic/starfive/jh7110.c +1 -1
index 560fe1d7..48451895 100644
@@ -298,7 +298,7 @@ static bool starfive_jh7110_cold_boot_allowed(u32 hartid,
 	return true;
 }
 
-static void starfive_jh7110_fw_init(void *fdt, const struct fdt_match *match)
+static void starfive_jh7110_fw_init(const void *fdt, const struct fdt_match *match)
 {
 	const fdt32_t *val;
 	int len, coff;
Signature · 1 line
2.45.1
author maintainer
#13 lore raw

PATCH 13/16 platform: generic: Pass FDT to early/final_init overrides

In reply to Samuel Holland

Several of these override functions access the FDT blob. Explicitly indicate which callbacks are allowed to modify the FDT blob by passing the parameter as a possibly-const pointer. This also reduces code size by deduplicating the call to fdt_get_address().

---

 platform/generic/allwinner/sun20i-d1.c       |  3 ++-
 platform/generic/andes/ae350.c               | 10 ++++------
 platform/generic/andes/andes_pma.c           |  6 ++----
 platform/generic/include/andes/andes_pma.h   |  3 ++-
 platform/generic/include/platform_override.h |  4 ++--
 platform/generic/platform.c                  |  9 ++++-----
 platform/generic/renesas/rzfive/rzfive.c     |  8 +++++---
 platform/generic/sifive/fu740.c              |  3 +--
 platform/generic/sophgo/sg2042.c             |  2 +-
 platform/generic/starfive/jh7110.c           |  4 +---
 platform/generic/thead/thead-generic.c       |  2 +-
 11 files changed, 25 insertions(+), 29 deletions(-)
platform/generic/allwinner/sun20i-d1.c +2 -1
index ab2eee55..9b1d5559 100644
@@ -187,7 +187,8 @@ static const struct sbi_hsm_device sun20i_d1_ppu = {
 	.hart_resume	= sun20i_d1_hart_resume,
 };
 
-static int sun20i_d1_final_init(bool cold_boot, const struct fdt_match *match)
+static int sun20i_d1_final_init(bool cold_boot, void *fdt,
+				const struct fdt_match *match)
 {
 	if (cold_boot) {
 		sun20i_d1_riscv_cfg_init();
platform/generic/andes/ae350.c +4 -6
index 63c10bc4..efe36927 100644
@@ -87,12 +87,9 @@ static const struct sbi_hsm_device andes_smu = {
 	.hart_stop    = ae350_hart_stop,
 };
 
-static void ae350_hsm_device_init(void)
+static void ae350_hsm_device_init(const void *fdt)
 {
 	int rc;
-	void *fdt;
-
-	fdt = fdt_get_address();
 
 	rc = fdt_parse_compat_addr(fdt, (uint64_t *)&smu.addr,
 				   "andestech,atcsmu");
@@ -102,10 +99,11 @@ static void ae350_hsm_device_init(void)
 	}
 }
 
-static int ae350_final_init(bool cold_boot, const struct fdt_match *match)
+static int ae350_final_init(bool cold_boot, void *fdt,
+			    const struct fdt_match *match)
 {
 	if (cold_boot)
-		ae350_hsm_device_init();
+		ae350_hsm_device_init(fdt);
 
 	return 0;
 }
platform/generic/andes/andes_pma.c +2 -4
index 9c37720b..035f9ec9 100644
@@ -238,14 +238,14 @@ static int andes_fdt_reserved_memory_fixup(void *fdt,
 	return andes_fdt_pma_resv(fdt, pma, entry, parent);
 }
 
-int andes_pma_setup_regions(const struct andes_pma_region *pma_regions,
+int andes_pma_setup_regions(void *fdt,
+			    const struct andes_pma_region *pma_regions,
 			    unsigned int pma_regions_count)
 {
 	unsigned long mmsc = csr_read(CSR_MMSC_CFG);
 	unsigned int dt_populate_cnt;
 	unsigned int i, j;
 	unsigned long pa;
-	void *fdt;
 	int ret;
 
 	if (!pma_regions || !pma_regions_count)
@@ -270,8 +270,6 @@ int andes_pma_setup_regions(const struct andes_pma_region *pma_regions,
 	if (!dt_populate_cnt)
 		return 0;
 
-	fdt = fdt_get_address();
-
 	ret = fdt_open_into(fdt, fdt,
 			    fdt_totalsize(fdt) + (64 * dt_populate_cnt));
 	if (ret < 0)
platform/generic/include/andes/andes_pma.h +2 -1
index 5ea12475..1bcda788 100644
@@ -44,7 +44,8 @@ struct andes_pma_region {
 	bool dma_default;
 };
 
-int andes_pma_setup_regions(const struct andes_pma_region *pma_regions,
+int andes_pma_setup_regions(void *fdt,
+			    const struct andes_pma_region *pma_regions,
 			    unsigned int pma_regions_count);
 
 #endif /* _ANDES_PMA_H_ */
platform/generic/include/platform_override.h +2 -2
index bd6fdacc..946fb8f7 100644
@@ -21,8 +21,8 @@ struct platform_override {
 	u64 (*tlbr_flush_limit)(const struct fdt_match *match);
 	u32 (*tlb_num_entries)(const struct fdt_match *match);
 	bool (*cold_boot_allowed)(u32 hartid, const struct fdt_match *match);
-	int (*early_init)(bool cold_boot, const struct fdt_match *match);
-	int (*final_init)(bool cold_boot, const struct fdt_match *match);
+	int (*early_init)(bool cold_boot, const void *fdt, const struct fdt_match *match);
+	int (*final_init)(bool cold_boot, void *fdt, const struct fdt_match *match);
 	void (*early_exit)(const struct fdt_match *match);
 	void (*final_exit)(const struct fdt_match *match);
 	int (*fdt_fixup)(void *fdt, const struct fdt_match *match);
platform/generic/platform.c +4 -5
index 4d26ae7c..6f9fb4db 100644
@@ -221,6 +221,7 @@ static int generic_nascent_init(void)
 
 static int generic_early_init(bool cold_boot)
 {
+	const void *fdt = fdt_get_address();
 	int rc;
 
 	if (cold_boot) {
@@ -237,16 +238,16 @@ static int generic_early_init(bool cold_boot)
 	if (!generic_plat || !generic_plat->early_init)
 		return 0;
 
-	return generic_plat->early_init(cold_boot, generic_plat_match);
+	return generic_plat->early_init(cold_boot, fdt, generic_plat_match);
 }
 
 static int generic_final_init(bool cold_boot)
 {
-	void *fdt;
+	void *fdt = fdt_get_address();
 	int rc;
 
 	if (generic_plat && generic_plat->final_init) {
-		rc = generic_plat->final_init(cold_boot, generic_plat_match);
+		rc = generic_plat->final_init(cold_boot, fdt, generic_plat_match);
 		if (rc)
 			return rc;
 	}
@@ -254,8 +255,6 @@ static int generic_final_init(bool cold_boot)
 	if (!cold_boot)
 		return 0;
 
-	fdt = fdt_get_address();
-
 	fdt_cpu_fixup(fdt);
 	fdt_fixups(fdt);
 	fdt_domain_fixup(fdt);
platform/generic/renesas/rzfive/rzfive.c +5 -3
index 515bcd76..59084c41 100644
@@ -24,13 +24,15 @@ static const struct andes_pma_region renesas_rzfive_pma_regions[] = {
 	},
 };
 
-static int renesas_rzfive_final_init(bool cold_boot, const struct fdt_match *match)
+static int renesas_rzfive_final_init(bool cold_boot, void *fdt,
+				     const struct fdt_match *match)
 {
-	return andes_pma_setup_regions(renesas_rzfive_pma_regions,
+	return andes_pma_setup_regions(fdt, renesas_rzfive_pma_regions,
 				       array_size(renesas_rzfive_pma_regions));
 }
 
-static int renesas_rzfive_early_init(bool cold_boot, const struct fdt_match *match)
+static int renesas_rzfive_early_init(bool cold_boot, const void *fdt,
+				     const struct fdt_match *match)
 {
 	/*
 	 * Renesas RZ/Five RISC-V SoC has Instruction local memory and
platform/generic/sifive/fu740.c +1 -2
index ce83a050..46dc02ae 100644
@@ -226,11 +226,10 @@ static u64 sifive_fu740_tlbr_flush_limit(const struct fdt_match *match)
 	return 0;
 }
 
-static int sifive_fu740_final_init(bool cold_boot,
+static int sifive_fu740_final_init(bool cold_boot, void *fdt,
 				   const struct fdt_match *match)
 {
 	int rc;
-	void *fdt = fdt_get_address();
 
 	if (cold_boot) {
 		rc = fdt_reset_driver_init(fdt, &fdt_reset_da9063);
platform/generic/sophgo/sg2042.c +1 -1
index ae2d702e..eca9afb7 100644
@@ -21,7 +21,7 @@
 #define SOPHGO_SG2042_TIMER_SIZE	0x10000UL
 #define SOPHGO_SG2042_TIMER_NUM		16
 
-static int sophgo_sg2042_early_init(bool cold_boot,
+static int sophgo_sg2042_early_init(bool cold_boot, const void *fdt,
 				    const struct fdt_match *match)
 {
 	thead_register_tlb_flush_trap_handler();
platform/generic/starfive/jh7110.c +1 -3
index 48451895..264fe99c 100644
@@ -277,11 +277,9 @@ err:
 	return rc;
 }
 
-static int starfive_jh7110_final_init(bool cold_boot,
+static int starfive_jh7110_final_init(bool cold_boot, void *fdt,
 				      const struct fdt_match *match)
 {
-	void *fdt = fdt_get_address();
-
 	if (cold_boot) {
 		fdt_reset_driver_init(fdt, &fdt_reset_pmic);
 	}
platform/generic/thead/thead-generic.c +1 -1
index c82e0c1b..be64831c 100644
@@ -19,7 +19,7 @@ struct thead_generic_quirks {
 	u64	errata;
 };
 
-static int thead_generic_early_init(bool cold_boot,
+static int thead_generic_early_init(bool cold_boot, const void *fdt,
 				    const struct fdt_match *match)
 {
 	struct thead_generic_quirks *quirks = (void *)match->data;
Signature · 1 line
2.45.1
author maintainer
#14 lore raw

PATCH 14/16 lib: utils/reset: Pass the FDT to fdt_reset_init()

In reply to Samuel Holland

Indicate that this function does not modify the FDT blob, and deduplicate the call to fdt_get_address().

---

 include/sbi_utils/reset/fdt_reset.h | 4 ++--
 lib/utils/reset/fdt_reset.c         | 3 +--
 platform/generic/platform.c         | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)
include/sbi_utils/reset/fdt_reset.h +2 -2
index 80179873..f126fd33 100644
@@ -29,7 +29,7 @@ int fdt_reset_driver_init(const void *fdt, struct fdt_reset *drv);
  *
  * This function shall be invoked in final init.
  */
-void fdt_reset_init(void);
+void fdt_reset_init(const void *fdt);
 
 #else
 
@@ -37,7 +37,7 @@ static inline int fdt_reset_driver_init(const void *fdt, struct fdt_reset *drv)
 {
 	return 0;
 }
-static inline void fdt_reset_init(void) { }
+static inline void fdt_reset_init(const void *fdt) { }
 
 #endif
 
lib/utils/reset/fdt_reset.c +1 -2
index 960c08d0..05deb75e 100644
@@ -42,10 +42,9 @@ int fdt_reset_driver_init(const void *fdt, struct fdt_reset *drv)
 	return cnt > 0 ? 0 : SBI_ENODEV;
 }
 
-void fdt_reset_init(void)
+void fdt_reset_init(const void *fdt)
 {
 	int pos;
-	const void *fdt = fdt_get_address();
 
 	for (pos = 0; pos < fdt_reset_drivers_size; pos++)
 		fdt_reset_driver_init(fdt, fdt_reset_drivers[pos]);
platform/generic/platform.c +1 -1
index 6f9fb4db..2850d55d 100644
@@ -225,7 +225,7 @@ static int generic_early_init(bool cold_boot)
 	int rc;
 
 	if (cold_boot) {
-		fdt_reset_init();
+		fdt_reset_init(fdt);
 
 		if (semihosting_enabled())
 			rc = semihosting_init();
Signature · 1 line
2.45.1
author maintainer
#15 lore raw

PATCH 15/16 lib: utils/serial: Pass the FDT to fdt_serial_init()

In reply to Samuel Holland

Indicate that this function does not modify the FDT blob, and deduplicate the call to fdt_get_address().

---

 include/sbi_utils/serial/fdt_serial.h | 4 ++--
 lib/utils/serial/fdt_serial.c         | 3 +--
 platform/generic/platform.c           | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)
include/sbi_utils/serial/fdt_serial.h +2 -2
index a0053a16..572475c9 100644
@@ -19,11 +19,11 @@ struct fdt_serial {
 	int (*init)(const void *fdt, int nodeoff, const struct fdt_match *match);
 };
 
-int fdt_serial_init(void);
+int fdt_serial_init(const void *fdt);
 
 #else
 
-static inline int fdt_serial_init(void) { return 0; }
+static inline int fdt_serial_init(const void *fdt) { return 0; }
 
 #endif
 
lib/utils/serial/fdt_serial.c +1 -2
index 6f995cf7..a2a96cb2 100644
@@ -17,13 +17,12 @@
 extern struct fdt_serial *fdt_serial_drivers[];
 extern unsigned long fdt_serial_drivers_size;
 
-int fdt_serial_init(void)
+int fdt_serial_init(const void *fdt)
 {
 	const void *prop;
 	struct fdt_serial *drv;
 	const struct fdt_match *match;
 	int pos, noff = -1, len, coff, rc;
-	const void *fdt = fdt_get_address();
 
 	/* Find offset of node pointed to by stdout-path */
 	coff = fdt_path_offset(fdt, "/chosen");
platform/generic/platform.c +1 -1
index 2850d55d..7c809b00 100644
@@ -230,7 +230,7 @@ static int generic_early_init(bool cold_boot)
 		if (semihosting_enabled())
 			rc = semihosting_init();
 		else
-			rc = fdt_serial_init();
+			rc = fdt_serial_init(fdt);
 		if (rc)
 			return rc;
 	}
Signature · 1 line
2.45.1
author maintainer
#16 lore raw

PATCH 16/16 lib: utils/fdt: Add fdt_get_address_rw() helper

In reply to Samuel Holland

Help tracking the lifecycle of the FDT blob by indicating which parts of the firmware modify it, and thus invalidate any previously-obtained offsets or pointers to data inside the blob.

---

 include/sbi_utils/fdt/fdt_helper.h | 7 ++++++-
 platform/fpga/ariane/platform.c    | 2 +-
 platform/fpga/openpiton/platform.c | 4 ++--
 platform/generic/platform.c        | 4 ++--
 platform/kendryte/k210/platform.c  | 2 +-
 platform/nuclei/ux600/platform.c   | 2 +-
 6 files changed, 13 insertions(+), 8 deletions(-)
include/sbi_utils/fdt/fdt_helper.h +6 -1
index 28ae7677..7329b84c 100644
@@ -114,7 +114,12 @@ int fdt_parse_plicsw_node(const void *fdt, int nodeoffset, unsigned long *plicsw
 int fdt_parse_compat_addr(const void *fdt, uint64_t *addr,
 			  const char *compatible);
 
-static inline void *fdt_get_address(void)
+static inline const void *fdt_get_address(void)
+{
+	return (const void *)root.next_arg1;
+}
+
+static inline void *fdt_get_address_rw(void)
 {
 	return (void *)root.next_arg1;
 }
platform/fpga/ariane/platform.c +1 -1
index 8d46d888..ec0584ab 100644
@@ -87,7 +87,7 @@ static int ariane_final_init(bool cold_boot)
 	if (!cold_boot)
 		return 0;
 
-	fdt = fdt_get_address();
+	fdt = fdt_get_address_rw();
 	fdt_fixups(fdt);
 
 	return 0;
platform/fpga/openpiton/platform.c +2 -2
index dd74a0c2..81cc48f4 100644
@@ -70,7 +70,7 @@ static struct aclint_mtimer_data mtimer = {
  */
 static int openpiton_early_init(bool cold_boot)
 {
-	void *fdt;
+	const void *fdt;
 	struct platform_uart_data uart_data = { 0 };
 	struct plic_data plic_data;
 	unsigned long aclint_freq;
@@ -118,7 +118,7 @@ static int openpiton_final_init(bool cold_boot)
 	if (!cold_boot)
 		return 0;
 
-	fdt = fdt_get_address();
+	fdt = fdt_get_address_rw();
 	fdt_fixups(fdt);
 
 	return 0;
platform/generic/platform.c +2 -2
index 7c809b00..52dd6e62 100644
@@ -243,7 +243,7 @@ static int generic_early_init(bool cold_boot)
 
 static int generic_final_init(bool cold_boot)
 {
-	void *fdt = fdt_get_address();
+	void *fdt = fdt_get_address_rw();
 	int rc;
 
 	if (generic_plat && generic_plat->final_init) {
@@ -314,7 +314,7 @@ static int generic_extensions_init(struct sbi_hart_features *hfeatures)
 
 static int generic_domains_init(void)
 {
-	void *fdt = fdt_get_address();
+	const void *fdt = fdt_get_address();
 	int offset, ret;
 
 	ret = fdt_domains_populate(fdt);
platform/kendryte/k210/platform.c +1 -1
index 531adcd5..2f3f7079 100644
@@ -124,7 +124,7 @@ static int k210_final_init(bool cold_boot)
 	if (!cold_boot)
 		return 0;
 
-	fdt = fdt_get_address();
+	fdt = fdt_get_address_rw();
 
 	fdt_cpu_fixup(fdt);
 	fdt_fixups(fdt);
platform/nuclei/ux600/platform.c +1 -1
index 2289366c..5610e7c7 100644
@@ -181,7 +181,7 @@ static int ux600_final_init(bool cold_boot)
 	if (!cold_boot)
 		return 0;
 
-	fdt = fdt_get_address();
+	fdt = fdt_get_address_rw();
 	ux600_modify_dt(fdt);
 
 	return 0;
Signature · 1 line
2.45.1
#17 lore raw

PATCH 16/16 lib: utils/fdt: Add fdt_get_address_rw() helper

Quoted 20 lines · Samuel Holland

Help tracking the lifecycle of the FDT blob by indicating which parts of the firmware modify it, and thus invalidate any previously-obtained offsets or pointers to data inside the blob.

---

 include/sbi_utils/fdt/fdt_helper.h | 7 ++++++-
 platform/fpga/ariane/platform.c    | 2 +-
 platform/fpga/openpiton/platform.c | 4 ++--
 platform/generic/platform.c        | 4 ++--
 platform/kendryte/k210/platform.c  | 2 +-
 platform/nuclei/ux600/platform.c   | 2 +-
 6 files changed, 13 insertions(+), 8 deletions(-)
include/sbi_utils/fdt/fdt_helper.h +0 -0
index 28ae7677..7329b84c 100644

include/sbi_utils/fdt/fdt_helper.h int fdt_parse_plicsw_node(const void *fdt, int nodeoffset, unsigned long *plicsw · line 122

Quoted 10 lines
include/sbi_utils/fdt/fdt_helper.h +6 -1
@@ -114,7 +114,12 @@ int fdt_parse_plicsw_node(const void *fdt, int nodeoffset, unsigned long *plicsw
 int fdt_parse_compat_addr(const void *fdt, uint64_t *addr,
 			  const char *compatible);
 
-static inline void *fdt_get_address(void)
+static inline const void *fdt_get_address(void)
+{
+	return (const void *)root.next_arg1;
+}
+
+static inline void *fdt_get_address_rw(void)

I'm not sure this _rw variant is necessary. The addition of the 'const' to each local pointer which doesn't intend to be used to write is probably annotation enough, but either way.

Thanks,
drew

#18 lore raw

cover Improve FDT blob lifecycle self-documentation

In reply to Samuel Holland
Quoted 15 lines · Samuel Holland

This series improves the documentation of the FDT blob lifecycle within the OpenSBI code by more explicitly indicating which functions and platform callbacks may modify the FDT blob, and by avoiding ad-hoc calls to fdt_get_address() outside the top-level platform callbacks.

Samuel Holland (16):
lib: utils/fdt: Fix fdt_add_cpu_idle_states() prototype
lib: utils/regmap: Fix typo in comment
lib: utils/fdt: Constify FDT parsing functions
lib: utils/gpio: Constify FDT pointers in parsing functions
lib: utils/i2c: Constify FDT pointers in parsing functions
lib: utils/ipi: Constify FDT pointers in parsing functions
lib: utils/irqchip: Constify FDT pointers in parsing functions
lib: utils/regmap: Constify FDT pointers in parsing functions

Quoted 9 lines

lib: utils/reset: Constify FDT pointers in parsing functions
lib: utils/serial: Constify FDT pointers in parsing functions
lib: utils/timer: Constify FDT pointers in parsing functions
platform: generic: Constify FDT pointers in fw_platform_init()
platform: generic: Pass FDT to early/final_init overrides
lib: utils/reset: Pass the FDT to fdt_reset_init()
lib: utils/serial: Pass the FDT to fdt_serial_init()
lib: utils/fdt: Add fdt_get_address_rw() helper

This is a nice improvement, Samuel.

For the series,

Thanks,
drew

Applied
#19 lore raw

cover Improve FDT blob lifecycle self-documentation

In reply to Samuel Holland
Quoted 16 lines · On Wed, Jul 31, 2024 at 10:29?AM Samuel Holland <[email protected]>…

This series improves the documentation of the FDT blob lifecycle within the OpenSBI code by more explicitly indicating which functions and platform callbacks may modify the FDT blob, and by avoiding ad-hoc calls to fdt_get_address() outside the top-level platform callbacks.

Samuel Holland (16):
lib: utils/fdt: Fix fdt_add_cpu_idle_states() prototype
lib: utils/regmap: Fix typo in comment
lib: utils/fdt: Constify FDT parsing functions
lib: utils/gpio: Constify FDT pointers in parsing functions
lib: utils/i2c: Constify FDT pointers in parsing functions
lib: utils/ipi: Constify FDT pointers in parsing functions
lib: utils/irqchip: Constify FDT pointers in parsing functions
lib: utils/regmap: Constify FDT pointers in parsing functions

Quoted 8 lines

lib: utils/reset: Constify FDT pointers in parsing functions
lib: utils/serial: Constify FDT pointers in parsing functions
lib: utils/timer: Constify FDT pointers in parsing functions
platform: generic: Constify FDT pointers in fw_platform_init()
platform: generic: Pass FDT to early/final_init overrides
lib: utils/reset: Pass the FDT to fdt_reset_init()
lib: utils/serial: Pass the FDT to fdt_serial_init()
lib: utils/fdt: Add fdt_get_address_rw() helper

LGTM.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 77 lines
 include/sbi_utils/fdt/fdt_domain.h           |  4 +-
 include/sbi_utils/fdt/fdt_fixup.h            |  2 +-
 include/sbi_utils/fdt/fdt_helper.h           | 61 ++++++++++---------
 include/sbi_utils/fdt/fdt_pmu.h              |  4 +-
 include/sbi_utils/gpio/fdt_gpio.h            |  4 +-
 include/sbi_utils/i2c/fdt_i2c.h              |  4 +-
 include/sbi_utils/ipi/fdt_ipi.h              |  2 +-
 include/sbi_utils/irqchip/fdt_irqchip.h      |  2 +-
 include/sbi_utils/regmap/fdt_regmap.h        |  8 +--
 include/sbi_utils/reset/fdt_reset.h          | 10 ++--
 include/sbi_utils/serial/fdt_serial.h        |  6 +-
 include/sbi_utils/timer/fdt_timer.h          |  2 +-
 lib/utils/fdt/fdt_domain.c                   | 31 +++++++---
 lib/utils/fdt/fdt_helper.c                   | 62 ++++++++++----------
 lib/utils/fdt/fdt_pmu.c                      |  2 +-
 lib/utils/gpio/fdt_gpio.c                    |  6 +-
 lib/utils/gpio/fdt_gpio_designware.c         |  2 +-
 lib/utils/gpio/fdt_gpio_sifive.c             |  2 +-
 lib/utils/gpio/fdt_gpio_starfive.c           |  2 +-
 lib/utils/i2c/fdt_i2c.c                      |  6 +-
 lib/utils/i2c/fdt_i2c_dw.c                   |  4 +-
 lib/utils/i2c/fdt_i2c_sifive.c               |  4 +-
 lib/utils/ipi/fdt_ipi.c                      |  2 +-
 lib/utils/ipi/fdt_ipi_mswi.c                 |  2 +-
 lib/utils/ipi/fdt_ipi_plicsw.c               |  4 +-
 lib/utils/irqchip/fdt_irqchip.c              |  2 +-
 lib/utils/irqchip/fdt_irqchip_aplic.c        |  4 +-
 lib/utils/irqchip/fdt_irqchip_imsic.c        |  6 +-
 lib/utils/irqchip/fdt_irqchip_plic.c         |  4 +-
 lib/utils/regmap/fdt_regmap.c                |  8 +--
 lib/utils/regmap/fdt_regmap_syscon.c         |  2 +-
 lib/utils/reset/fdt_reset.c                  |  5 +-
 lib/utils/reset/fdt_reset_atcwdt200.c        |  2 +-
 lib/utils/reset/fdt_reset_gpio.c             |  2 +-
 lib/utils/reset/fdt_reset_htif.c             |  2 +-
 lib/utils/reset/fdt_reset_sg2042_hwmon_mcu.c |  2 +-
 lib/utils/reset/fdt_reset_sunxi_wdt.c        |  2 +-
 lib/utils/reset/fdt_reset_syscon.c           |  4 +-
 lib/utils/serial/fdt_serial.c                |  3 +-
 lib/utils/serial/fdt_serial_cadence.c        |  2 +-
 lib/utils/serial/fdt_serial_gaisler.c        |  2 +-
 lib/utils/serial/fdt_serial_htif.c           |  2 +-
 lib/utils/serial/fdt_serial_litex.c          |  2 +-
 lib/utils/serial/fdt_serial_renesas_scif.c   |  2 +-
 lib/utils/serial/fdt_serial_shakti.c         |  4 +-
 lib/utils/serial/fdt_serial_sifive.c         |  4 +-
 lib/utils/serial/fdt_serial_uart8250.c       |  2 +-
 lib/utils/serial/fdt_serial_xlnx_uartlite.c  |  4 +-
 lib/utils/timer/fdt_timer.c                  |  2 +-
 lib/utils/timer/fdt_timer_mtimer.c           |  2 +-
 lib/utils/timer/fdt_timer_plmt.c             |  2 +-
 platform/fpga/ariane/platform.c              |  2 +-
 platform/fpga/openpiton/platform.c           |  4 +-
 platform/generic/allwinner/sun20i-d1.c       |  3 +-
 platform/generic/andes/ae350.c               | 10 ++--
 platform/generic/andes/andes_pma.c           |  6 +-
 platform/generic/include/andes/andes_pma.h   |  3 +-
 platform/generic/include/platform_override.h |  6 +-
 platform/generic/platform.c                  | 21 ++++---
 platform/generic/renesas/rzfive/rzfive.c     |  8 ++-
 platform/generic/sifive/fu740.c              |  5 +-
 platform/generic/sophgo/sg2042.c             |  2 +-
 platform/generic/starfive/jh7110.c           | 12 ++--
 platform/generic/thead/thead-generic.c       |  2 +-
 platform/kendryte/k210/platform.c            |  2 +-
 platform/nuclei/ux600/platform.c             |  2 +-
 66 files changed, 210 insertions(+), 194 deletions(-)

--
2.45.1

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi