1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-29 22:41:17 +02:00

stm32mp: stm32prog: solve warning for 64bits compilation

Solve many compilation warning when stm32prog is activated on the aarch64.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
This commit is contained in:
Patrick Delaunay
2022-09-06 18:53:19 +02:00
committed by Patrice Chotard
parent ada8fe0c42
commit 3df19b8bec
5 changed files with 31 additions and 32 deletions

View File

@@ -126,21 +126,21 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
char *bootm_argv[5] = { char *bootm_argv[5] = {
"bootm", boot_addr_start, "-", dtb_addr, NULL "bootm", boot_addr_start, "-", dtb_addr, NULL
}; };
u32 uimage = data->uimage; const void *uimage = (void *)data->uimage;
u32 dtb = data->dtb; const void *dtb = (void *)data->dtb;
u32 initrd = data->initrd; const void *initrd = (void *)data->initrd;
if (!dtb) if (!dtb)
bootm_argv[3] = env_get("fdtcontroladdr"); bootm_argv[3] = env_get("fdtcontroladdr");
else else
snprintf(dtb_addr, sizeof(dtb_addr) - 1, snprintf(dtb_addr, sizeof(dtb_addr) - 1,
"0x%x", dtb); "0x%p", dtb);
snprintf(boot_addr_start, sizeof(boot_addr_start) - 1, snprintf(boot_addr_start, sizeof(boot_addr_start) - 1,
"0x%x", uimage); "0x%p", uimage);
if (initrd) { if (initrd) {
snprintf(initrd_addr, sizeof(initrd_addr) - 1, "0x%x:0x%x", snprintf(initrd_addr, sizeof(initrd_addr) - 1, "0x%p:0x%zx",
initrd, data->initrd_size); initrd, data->initrd_size);
bootm_argv[2] = initrd_addr; bootm_argv[2] = initrd_addr;
} }
@@ -148,7 +148,7 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
printf("Booting kernel at %s %s %s...\n\n\n", printf("Booting kernel at %s %s %s...\n\n\n",
boot_addr_start, bootm_argv[2], bootm_argv[3]); boot_addr_start, bootm_argv[2], bootm_argv[3]);
/* Try bootm for legacy and FIT format image */ /* Try bootm for legacy and FIT format image */
if (genimg_get_format((void *)uimage) != IMAGE_FORMAT_INVALID) if (genimg_get_format(uimage) != IMAGE_FORMAT_INVALID)
do_bootm(cmdtp, 0, 4, bootm_argv); do_bootm(cmdtp, 0, 4, bootm_argv);
else if (CONFIG_IS_ENABLED(CMD_BOOTZ)) else if (CONFIG_IS_ENABLED(CMD_BOOTZ))
do_bootz(cmdtp, 0, 4, bootm_argv); do_bootz(cmdtp, 0, 4, bootm_argv);

View File

@@ -322,7 +322,7 @@ void stm32prog_header_check(uintptr_t raw_header, struct image_header_s *header)
header->image_length = 0x0; header->image_length = 0x0;
} }
static u32 stm32prog_header_checksum(u32 addr, struct image_header_s *header) static u32 stm32prog_header_checksum(uintptr_t addr, struct image_header_s *header)
{ {
u32 i, checksum; u32 i, checksum;
u8 *payload; u8 *payload;
@@ -398,7 +398,7 @@ static int parse_name(struct stm32prog_data *data,
if (strlen(p) < sizeof(part->name)) { if (strlen(p) < sizeof(part->name)) {
strcpy(part->name, p); strcpy(part->name, p);
} else { } else {
stm32prog_err("Layout line %d: partition name too long [%d]: %s", stm32prog_err("Layout line %d: partition name too long [%zd]: %s",
i, strlen(p), p); i, strlen(p), p);
result = -EINVAL; result = -EINVAL;
} }
@@ -537,7 +537,7 @@ int (* const parse[COL_NB_STM32])(struct stm32prog_data *data, int i, char *p,
}; };
static int parse_flash_layout(struct stm32prog_data *data, static int parse_flash_layout(struct stm32prog_data *data,
ulong addr, uintptr_t addr,
ulong size) ulong size)
{ {
int column = 0, part_nb = 0, ret; int column = 0, part_nb = 0, ret;
@@ -1440,7 +1440,7 @@ int stm32prog_otp_write(struct stm32prog_data *data, u32 offset, u8 *buffer,
if (offset + *size > otp_size) if (offset + *size > otp_size)
*size = otp_size - offset; *size = otp_size - offset;
memcpy((void *)((u32)data->otp_part + offset), buffer, *size); memcpy((void *)((uintptr_t)data->otp_part + offset), buffer, *size);
return 0; return 0;
} }
@@ -1479,7 +1479,7 @@ int stm32prog_otp_read(struct stm32prog_data *data, u32 offset, u8 *buffer,
data->otp_part, OTP_SIZE_TA); data->otp_part, OTP_SIZE_TA);
else if (IS_ENABLED(CONFIG_ARM_SMCCC)) else if (IS_ENABLED(CONFIG_ARM_SMCCC))
result = stm32_smc_exec(STM32_SMC_BSEC, STM32_SMC_READ_ALL, result = stm32_smc_exec(STM32_SMC_BSEC, STM32_SMC_READ_ALL,
(u32)data->otp_part, 0); (unsigned long)data->otp_part, 0);
if (result) if (result)
goto end_otp_read; goto end_otp_read;
} }
@@ -1491,7 +1491,7 @@ int stm32prog_otp_read(struct stm32prog_data *data, u32 offset, u8 *buffer,
if (offset + *size > otp_size) if (offset + *size > otp_size)
*size = otp_size - offset; *size = otp_size - offset;
memcpy(buffer, (void *)((u32)data->otp_part + offset), *size); memcpy(buffer, (void *)((uintptr_t)data->otp_part + offset), *size);
end_otp_read: end_otp_read:
log_debug("%s: result %i\n", __func__, result); log_debug("%s: result %i\n", __func__, result);
@@ -1521,7 +1521,7 @@ int stm32prog_otp_start(struct stm32prog_data *data)
data->otp_part, OTP_SIZE_TA); data->otp_part, OTP_SIZE_TA);
} else if (IS_ENABLED(CONFIG_ARM_SMCCC)) { } else if (IS_ENABLED(CONFIG_ARM_SMCCC)) {
arm_smccc_smc(STM32_SMC_BSEC, STM32_SMC_WRITE_ALL, arm_smccc_smc(STM32_SMC_BSEC, STM32_SMC_WRITE_ALL,
(u32)data->otp_part, 0, 0, 0, 0, 0, &res); (uintptr_t)data->otp_part, 0, 0, 0, 0, 0, &res);
if (!res.a0) { if (!res.a0) {
switch (res.a1) { switch (res.a1) {
@@ -1951,7 +1951,7 @@ int stm32prog_dfu_init(struct stm32prog_data *data)
return dfu_init_entities(data); return dfu_init_entities(data);
} }
int stm32prog_init(struct stm32prog_data *data, ulong addr, ulong size) int stm32prog_init(struct stm32prog_data *data, uintptr_t addr, ulong size)
{ {
memset(data, 0x0, sizeof(*data)); memset(data, 0x0, sizeof(*data));
data->read_phase = PHASE_RESET; data->read_phase = PHASE_RESET;

View File

@@ -154,7 +154,7 @@ struct stm32prog_data {
u32 offset; u32 offset;
char error[255]; char error[255];
struct stm32prog_part_t *cur_part; struct stm32prog_part_t *cur_part;
u32 *otp_part; void *otp_part;
u8 pmic_part[PMIC_SIZE]; u8 pmic_part[PMIC_SIZE];
/* SERIAL information */ /* SERIAL information */
@@ -165,12 +165,12 @@ struct stm32prog_data {
u8 read_phase; u8 read_phase;
/* bootm information */ /* bootm information */
u32 uimage; uintptr_t uimage;
u32 dtb; uintptr_t dtb;
u32 initrd; uintptr_t initrd;
u32 initrd_size; size_t initrd_size;
u32 script; uintptr_t script;
/* OPTEE PTA NVMEM */ /* OPTEE PTA NVMEM */
struct udevice *tee; struct udevice *tee;
@@ -209,7 +209,7 @@ char *stm32prog_get_error(struct stm32prog_data *data);
} }
/* Main function */ /* Main function */
int stm32prog_init(struct stm32prog_data *data, ulong addr, ulong size); int stm32prog_init(struct stm32prog_data *data, uintptr_t addr, ulong size);
void stm32prog_clean(struct stm32prog_data *data); void stm32prog_clean(struct stm32prog_data *data);
#ifdef CONFIG_CMD_STM32PROG_SERIAL #ifdef CONFIG_CMD_STM32PROG_SERIAL

View File

@@ -300,7 +300,7 @@ static void stm32prog_serial_putc(u8 w_byte)
} }
/* Helper function ************************************************/ /* Helper function ************************************************/
static u8 stm32prog_start(struct stm32prog_data *data, u32 address) static u8 stm32prog_start(struct stm32prog_data *data, uintptr_t address)
{ {
u8 ret = 0; u8 ret = 0;
struct dfu_entity *dfu_entity; struct dfu_entity *dfu_entity;
@@ -353,7 +353,7 @@ static u8 stm32prog_start(struct stm32prog_data *data, u32 address)
} else { } else {
void (*entry)(void) = (void *)address; void (*entry)(void) = (void *)address;
printf("## Starting application at 0x%x ...\n", address); printf("## Starting application at 0x%p ...\n", (void *)address);
(*entry)(); (*entry)();
printf("## Application terminated\n"); printf("## Application terminated\n");
ret = -ENOEXEC; ret = -ENOEXEC;
@@ -368,9 +368,9 @@ static u8 stm32prog_start(struct stm32prog_data *data, u32 address)
* @tmp_xor: Current xor value to update * @tmp_xor: Current xor value to update
* Return: The address area * Return: The address area
*/ */
static u32 get_address(u8 *tmp_xor) static uintptr_t get_address(u8 *tmp_xor)
{ {
u32 address = 0x0; uintptr_t address = 0x0;
u8 data; u8 data;
data = stm32prog_serial_getc(); data = stm32prog_serial_getc();
@@ -487,7 +487,7 @@ static void get_phase_command(struct stm32prog_data *data)
*/ */
static void read_memory_command(struct stm32prog_data *data) static void read_memory_command(struct stm32prog_data *data)
{ {
u32 address = 0x0; uintptr_t address = 0x0;
u8 rcv_data = 0x0, tmp_xor = 0x0; u8 rcv_data = 0x0, tmp_xor = 0x0;
u32 counter = 0x0; u32 counter = 0x0;
@@ -532,7 +532,7 @@ static void read_memory_command(struct stm32prog_data *data)
*/ */
static void start_command(struct stm32prog_data *data) static void start_command(struct stm32prog_data *data)
{ {
u32 address = 0; uintptr_t address = 0;
u8 tmp_xor = 0x0; u8 tmp_xor = 0x0;
u8 ret, rcv_data; u8 ret, rcv_data;
@@ -546,8 +546,7 @@ static void start_command(struct stm32prog_data *data)
return; return;
} }
/* validate partition */ /* validate partition */
ret = stm32prog_start(data, ret = stm32prog_start(data, address);
address);
if (ret) if (ret)
stm32prog_serial_result(ABORT_BYTE); stm32prog_serial_result(ABORT_BYTE);

View File

@@ -41,7 +41,7 @@ static int stm32prog_set_phase(struct stm32prog_data *data, u8 phase,
static int stm32prog_cmd_write(u64 offset, void *buf, long *len) static int stm32prog_cmd_write(u64 offset, void *buf, long *len)
{ {
u8 phase; u8 phase;
u32 address; uintptr_t address;
u8 *pt = buf; u8 *pt = buf;
void (*entry)(void); void (*entry)(void);
int ret; int ret;
@@ -58,7 +58,7 @@ static int stm32prog_cmd_write(u64 offset, void *buf, long *len)
address = (pt[1] << 24) | (pt[2] << 16) | (pt[3] << 8) | pt[4]; address = (pt[1] << 24) | (pt[2] << 16) | (pt[3] << 8) | pt[4];
if (phase == PHASE_RESET) { if (phase == PHASE_RESET) {
entry = (void *)address; entry = (void *)address;
printf("## Starting application at 0x%x ...\n", address); printf("## Starting application at 0x%p ...\n", entry);
(*entry)(); (*entry)();
printf("## Application terminated\n"); printf("## Application terminated\n");
return 0; return 0;