forked from Mirrors/opensbi
lib: utils/serial: Pass the FDT to fdt_serial_init()
Indicate that this function does not modify the FDT blob, and deduplicate the call to fdt_get_address(). Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
fa6dfce017
commit
c36801841e
@@ -19,11 +19,11 @@ struct fdt_serial {
|
|||||||
int (*init)(const 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);
|
int fdt_serial_init(const void *fdt);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline int fdt_serial_init(void) { return 0; }
|
static inline int fdt_serial_init(const void *fdt) { return 0; }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -17,13 +17,12 @@
|
|||||||
extern struct fdt_serial *fdt_serial_drivers[];
|
extern struct fdt_serial *fdt_serial_drivers[];
|
||||||
extern unsigned long fdt_serial_drivers_size;
|
extern unsigned long fdt_serial_drivers_size;
|
||||||
|
|
||||||
int fdt_serial_init(void)
|
int fdt_serial_init(const void *fdt)
|
||||||
{
|
{
|
||||||
const void *prop;
|
const void *prop;
|
||||||
struct fdt_serial *drv;
|
struct fdt_serial *drv;
|
||||||
const struct fdt_match *match;
|
const struct fdt_match *match;
|
||||||
int pos, noff = -1, len, coff, rc;
|
int pos, noff = -1, len, coff, rc;
|
||||||
const void *fdt = fdt_get_address();
|
|
||||||
|
|
||||||
/* Find offset of node pointed to by stdout-path */
|
/* Find offset of node pointed to by stdout-path */
|
||||||
coff = fdt_path_offset(fdt, "/chosen");
|
coff = fdt_path_offset(fdt, "/chosen");
|
||||||
|
@@ -230,7 +230,7 @@ static int generic_early_init(bool cold_boot)
|
|||||||
if (semihosting_enabled())
|
if (semihosting_enabled())
|
||||||
rc = semihosting_init();
|
rc = semihosting_init();
|
||||||
else
|
else
|
||||||
rc = fdt_serial_init();
|
rc = fdt_serial_init(fdt);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user