mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-09-21 07:01:57 +00:00
image: Fix up checkpatch warnings in image-board.c
Tidy up the warnings. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
41506ff5a5
commit
3d2a47f11c
1 changed files with 72 additions and 70 deletions
|
@ -41,7 +41,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
* pointer to a ramdisk image header, if image was found and valid
|
* pointer to a ramdisk image header, if image was found and valid
|
||||||
* otherwise, return NULL
|
* otherwise, return NULL
|
||||||
*/
|
*/
|
||||||
static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
|
static const image_header_t *image_get_ramdisk(ulong rd_addr, u8 arch,
|
||||||
int verify)
|
int verify)
|
||||||
{
|
{
|
||||||
const image_header_t *rd_hdr = (const image_header_t *)rd_addr;
|
const image_header_t *rd_hdr = (const image_header_t *)rd_addr;
|
||||||
|
@ -112,6 +112,7 @@ U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);
|
||||||
ulong env_get_bootm_low(void)
|
ulong env_get_bootm_low(void)
|
||||||
{
|
{
|
||||||
char *s = env_get("bootm_low");
|
char *s = env_get("bootm_low");
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
ulong tmp = hextoul(s, NULL);
|
ulong tmp = hextoul(s, NULL);
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -131,6 +132,7 @@ phys_size_t env_get_bootm_size(void)
|
||||||
phys_size_t tmp, size;
|
phys_size_t tmp, size;
|
||||||
phys_addr_t start;
|
phys_addr_t start;
|
||||||
char *s = env_get("bootm_size");
|
char *s = env_get("bootm_size");
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
|
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -155,6 +157,7 @@ phys_size_t env_get_bootm_mapsize(void)
|
||||||
{
|
{
|
||||||
phys_size_t tmp;
|
phys_size_t tmp;
|
||||||
char *s = env_get("bootm_mapsize");
|
char *s = env_get("bootm_mapsize");
|
||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
|
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -179,6 +182,7 @@ void memmove_wd(void *to, void *from, size_t len, ulong chunksz)
|
||||||
}
|
}
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
size_t tail = (len > chunksz) ? chunksz : len;
|
size_t tail = (len > chunksz) ? chunksz : len;
|
||||||
|
|
||||||
WATCHDOG_RESET();
|
WATCHDOG_RESET();
|
||||||
if (to > from) {
|
if (to > from) {
|
||||||
to -= tail;
|
to -= tail;
|
||||||
|
@ -319,7 +323,7 @@ int genimg_has_config(bootm_headers_t *images)
|
||||||
* @rd_end: pointer to a ulong variable, will hold ramdisk end
|
* @rd_end: pointer to a ulong variable, will hold ramdisk end
|
||||||
*
|
*
|
||||||
* boot_get_ramdisk() is responsible for finding a valid ramdisk image.
|
* boot_get_ramdisk() is responsible for finding a valid ramdisk image.
|
||||||
* Curently supported are the following ramdisk sources:
|
* Currently supported are the following ramdisk sources:
|
||||||
* - multicomponent kernel/ramdisk image,
|
* - multicomponent kernel/ramdisk image,
|
||||||
* - commandline provided address of decicated ramdisk image.
|
* - commandline provided address of decicated ramdisk image.
|
||||||
*
|
*
|
||||||
|
@ -332,7 +336,7 @@ int genimg_has_config(bootm_headers_t *images)
|
||||||
* rd_start and rd_end are set to 0 if no ramdisk exists
|
* rd_start and rd_end are set to 0 if no ramdisk exists
|
||||||
*/
|
*/
|
||||||
int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
|
int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
uint8_t arch, ulong *rd_start, ulong *rd_end)
|
u8 arch, ulong *rd_start, ulong *rd_end)
|
||||||
{
|
{
|
||||||
ulong rd_addr, rd_load;
|
ulong rd_addr, rd_load;
|
||||||
ulong rd_data, rd_len;
|
ulong rd_data, rd_len;
|
||||||
|
@ -372,7 +376,8 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
*/
|
*/
|
||||||
if (select && strcmp(select, "-") == 0) {
|
if (select && strcmp(select, "-") == 0) {
|
||||||
debug("## Skipping init Ramdisk\n");
|
debug("## Skipping init Ramdisk\n");
|
||||||
rd_len = rd_data = 0;
|
rd_len = 0;
|
||||||
|
rd_data = 0;
|
||||||
} else if (select || genimg_has_config(images)) {
|
} else if (select || genimg_has_config(images)) {
|
||||||
#if IMAGE_ENABLE_FIT
|
#if IMAGE_ENABLE_FIT
|
||||||
if (select) {
|
if (select) {
|
||||||
|
@ -389,20 +394,18 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
|
|
||||||
if (fit_parse_conf(select, default_addr,
|
if (fit_parse_conf(select, default_addr,
|
||||||
&rd_addr, &fit_uname_config)) {
|
&rd_addr, &fit_uname_config)) {
|
||||||
debug("* ramdisk: config '%s' from image at "
|
debug("* ramdisk: config '%s' from image at 0x%08lx\n",
|
||||||
"0x%08lx\n",
|
|
||||||
fit_uname_config, rd_addr);
|
fit_uname_config, rd_addr);
|
||||||
} else if (fit_parse_subimage(select, default_addr,
|
} else if (fit_parse_subimage(select, default_addr,
|
||||||
&rd_addr, &fit_uname_ramdisk)) {
|
&rd_addr,
|
||||||
debug("* ramdisk: subimage '%s' from image at "
|
&fit_uname_ramdisk)) {
|
||||||
"0x%08lx\n",
|
debug("* ramdisk: subimage '%s' from image at 0x%08lx\n",
|
||||||
fit_uname_ramdisk, rd_addr);
|
fit_uname_ramdisk, rd_addr);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
rd_addr = hextoul(select, NULL);
|
rd_addr = hextoul(select, NULL);
|
||||||
debug("* ramdisk: cmdline image address = "
|
debug("* ramdisk: cmdline image address = 0x%08lx\n",
|
||||||
"0x%08lx\n",
|
|
||||||
rd_addr);
|
rd_addr);
|
||||||
}
|
}
|
||||||
#if IMAGE_ENABLE_FIT
|
#if IMAGE_ENABLE_FIT
|
||||||
|
@ -413,7 +416,8 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
*/
|
*/
|
||||||
rd_addr = map_to_sysmem(images->fit_hdr_os);
|
rd_addr = map_to_sysmem(images->fit_hdr_os);
|
||||||
rd_noffset = fit_get_node_from_config(images,
|
rd_noffset = fit_get_node_from_config(images,
|
||||||
FIT_RAMDISK_PROP, rd_addr);
|
FIT_RAMDISK_PROP,
|
||||||
|
rd_addr);
|
||||||
if (rd_noffset == -ENOENT)
|
if (rd_noffset == -ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
else if (rd_noffset < 0)
|
else if (rd_noffset < 0)
|
||||||
|
@ -430,14 +434,14 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
switch (genimg_get_format(buf)) {
|
switch (genimg_get_format(buf)) {
|
||||||
#if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
|
#if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
|
||||||
case IMAGE_FORMAT_LEGACY:
|
case IMAGE_FORMAT_LEGACY:
|
||||||
printf("## Loading init Ramdisk from Legacy "
|
printf("## Loading init Ramdisk from Legacy Image at %08lx ...\n",
|
||||||
"Image at %08lx ...\n", rd_addr);
|
rd_addr);
|
||||||
|
|
||||||
bootstage_mark(BOOTSTAGE_ID_CHECK_RAMDISK);
|
bootstage_mark(BOOTSTAGE_ID_CHECK_RAMDISK);
|
||||||
rd_hdr = image_get_ramdisk(rd_addr, arch,
|
rd_hdr = image_get_ramdisk(rd_addr, arch,
|
||||||
images->verify);
|
images->verify);
|
||||||
|
|
||||||
if (rd_hdr == NULL)
|
if (!rd_hdr)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
rd_data = image_get_data(rd_hdr);
|
rd_data = image_get_data(rd_hdr);
|
||||||
|
@ -480,21 +484,21 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
puts("Wrong Ramdisk Image Format\n");
|
puts("Wrong Ramdisk Image Format\n");
|
||||||
rd_data = rd_len = rd_load = 0;
|
rd_data = 0;
|
||||||
|
rd_len = 0;
|
||||||
|
rd_load = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (images->legacy_hdr_valid &&
|
} else if (images->legacy_hdr_valid &&
|
||||||
image_check_type(&images->legacy_hdr_os_copy,
|
image_check_type(&images->legacy_hdr_os_copy,
|
||||||
IH_TYPE_MULTI)) {
|
IH_TYPE_MULTI)) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now check if we have a legacy mult-component image,
|
* Now check if we have a legacy mult-component image,
|
||||||
* get second entry data start address and len.
|
* get second entry data start address and len.
|
||||||
*/
|
*/
|
||||||
bootstage_mark(BOOTSTAGE_ID_RAMDISK);
|
bootstage_mark(BOOTSTAGE_ID_RAMDISK);
|
||||||
printf("## Loading init Ramdisk from multi component "
|
printf("## Loading init Ramdisk from multi component Legacy Image at %08lx ...\n",
|
||||||
"Legacy Image at %08lx ...\n",
|
|
||||||
(ulong)images->legacy_hdr_os);
|
(ulong)images->legacy_hdr_os);
|
||||||
|
|
||||||
image_multi_getimg(images->legacy_hdr_os, 1, &rd_data, &rd_len);
|
image_multi_getimg(images->legacy_hdr_os, 1, &rd_data, &rd_len);
|
||||||
|
@ -503,7 +507,8 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
* no initrd image
|
* no initrd image
|
||||||
*/
|
*/
|
||||||
bootstage_mark(BOOTSTAGE_ID_NO_RAMDISK);
|
bootstage_mark(BOOTSTAGE_ID_NO_RAMDISK);
|
||||||
rd_len = rd_data = 0;
|
rd_len = 0;
|
||||||
|
rd_data = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rd_data) {
|
if (!rd_data) {
|
||||||
|
@ -559,7 +564,6 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
|
||||||
initrd_high = env_get_bootm_mapsize() + env_get_bootm_low();
|
initrd_high = env_get_bootm_mapsize() + env_get_bootm_low();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
debug("## initrd_high = 0x%08lx, copy_to_ram = %d\n",
|
debug("## initrd_high = 0x%08lx, copy_to_ram = %d\n",
|
||||||
initrd_high, initrd_copy_to_ram);
|
initrd_high, initrd_copy_to_ram);
|
||||||
|
|
||||||
|
@ -615,7 +619,7 @@ error:
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SYS_BOOT_RAMDISK_HIGH */
|
#endif /* CONFIG_SYS_BOOT_RAMDISK_HIGH */
|
||||||
|
|
||||||
int boot_get_setup(bootm_headers_t *images, uint8_t arch,
|
int boot_get_setup(bootm_headers_t *images, u8 arch,
|
||||||
ulong *setup_start, ulong *setup_len)
|
ulong *setup_start, ulong *setup_len)
|
||||||
{
|
{
|
||||||
#if IMAGE_ENABLE_FIT
|
#if IMAGE_ENABLE_FIT
|
||||||
|
@ -628,7 +632,7 @@ int boot_get_setup(bootm_headers_t *images, uint8_t arch,
|
||||||
#if IMAGE_ENABLE_FIT
|
#if IMAGE_ENABLE_FIT
|
||||||
#if defined(CONFIG_FPGA)
|
#if defined(CONFIG_FPGA)
|
||||||
int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
|
int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
uint8_t arch, const ulong *ld_start, ulong * const ld_len)
|
u8 arch, const ulong *ld_start, ulong * const ld_len)
|
||||||
{
|
{
|
||||||
ulong tmp_img_addr, img_data, img_len;
|
ulong tmp_img_addr, img_data, img_len;
|
||||||
void *buf;
|
void *buf;
|
||||||
|
@ -666,7 +670,7 @@ int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
fit_img_result = fit_image_load(images,
|
fit_img_result = fit_image_load(images,
|
||||||
tmp_img_addr,
|
tmp_img_addr,
|
||||||
(const char **)&uname,
|
(const char **)&uname,
|
||||||
&(images->fit_uname_cfg),
|
&images->fit_uname_cfg,
|
||||||
arch,
|
arch,
|
||||||
IH_TYPE_FPGA,
|
IH_TYPE_FPGA,
|
||||||
BOOTSTAGE_ID_FPGA_INIT,
|
BOOTSTAGE_ID_FPGA_INIT,
|
||||||
|
@ -711,7 +715,7 @@ int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void fit_loadable_process(uint8_t img_type,
|
static void fit_loadable_process(u8 img_type,
|
||||||
ulong img_data,
|
ulong img_data,
|
||||||
ulong img_len)
|
ulong img_len)
|
||||||
{
|
{
|
||||||
|
@ -729,7 +733,7 @@ static void fit_loadable_process(uint8_t img_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
|
int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
uint8_t arch, const ulong *ld_start, ulong * const ld_len)
|
u8 arch, const ulong *ld_start, ulong * const ld_len)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* These variables are used to hold the current image location
|
* These variables are used to hold the current image location
|
||||||
|
@ -746,7 +750,7 @@ int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
int conf_noffset;
|
int conf_noffset;
|
||||||
int fit_img_result;
|
int fit_img_result;
|
||||||
const char *uname;
|
const char *uname;
|
||||||
uint8_t img_type;
|
u8 img_type;
|
||||||
|
|
||||||
/* Check to see if the images struct has a FIT configuration */
|
/* Check to see if the images struct has a FIT configuration */
|
||||||
if (!genimg_has_config(images)) {
|
if (!genimg_has_config(images)) {
|
||||||
|
@ -769,15 +773,13 @@ int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
|
||||||
|
|
||||||
for (loadables_index = 0;
|
for (loadables_index = 0;
|
||||||
uname = fdt_stringlist_get(buf, conf_noffset,
|
uname = fdt_stringlist_get(buf, conf_noffset,
|
||||||
FIT_LOADABLE_PROP, loadables_index,
|
FIT_LOADABLE_PROP,
|
||||||
NULL), uname;
|
loadables_index, NULL), uname;
|
||||||
loadables_index++)
|
loadables_index++) {
|
||||||
{
|
fit_img_result = fit_image_load(images, tmp_img_addr,
|
||||||
fit_img_result = fit_image_load(images,
|
|
||||||
tmp_img_addr,
|
|
||||||
&uname,
|
&uname,
|
||||||
&(images->fit_uname_cfg), arch,
|
&images->fit_uname_cfg,
|
||||||
IH_TYPE_LOADABLE,
|
arch, IH_TYPE_LOADABLE,
|
||||||
BOOTSTAGE_ID_FIT_LOADABLE_START,
|
BOOTSTAGE_ID_FIT_LOADABLE_START,
|
||||||
FIT_LOAD_OPTIONAL_NON_ZERO,
|
FIT_LOAD_OPTIONAL_NON_ZERO,
|
||||||
&img_data, &img_len);
|
&img_data, &img_len);
|
||||||
|
@ -834,8 +836,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
|
||||||
|
|
||||||
cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
|
cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
|
||||||
env_get_bootm_mapsize() + env_get_bootm_low());
|
env_get_bootm_mapsize() + env_get_bootm_low());
|
||||||
|
if (!cmdline)
|
||||||
if (cmdline == NULL)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
s = env_get("bootargs");
|
s = env_get("bootargs");
|
||||||
|
@ -844,7 +845,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
|
||||||
|
|
||||||
strcpy(cmdline, s);
|
strcpy(cmdline, s);
|
||||||
|
|
||||||
*cmd_start = (ulong) & cmdline[0];
|
*cmd_start = (ulong)cmdline;
|
||||||
*cmd_end = *cmd_start + strlen(cmdline);
|
*cmd_end = *cmd_start + strlen(cmdline);
|
||||||
|
|
||||||
debug("## cmdline at 0x%08lx ... 0x%08lx\n", *cmd_start, *cmd_end);
|
debug("## cmdline at 0x%08lx ... 0x%08lx\n", *cmd_start, *cmd_end);
|
||||||
|
@ -872,11 +873,12 @@ int boot_get_kbd(struct lmb *lmb, struct bd_info **kbd)
|
||||||
*kbd = (struct bd_info *)(ulong)lmb_alloc_base(lmb,
|
*kbd = (struct bd_info *)(ulong)lmb_alloc_base(lmb,
|
||||||
sizeof(struct bd_info),
|
sizeof(struct bd_info),
|
||||||
0xf,
|
0xf,
|
||||||
env_get_bootm_mapsize() + env_get_bootm_low());
|
env_get_bootm_mapsize() +
|
||||||
if (*kbd == NULL)
|
env_get_bootm_low());
|
||||||
|
if (!*kbd)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
**kbd = *(gd->bd);
|
**kbd = *gd->bd;
|
||||||
|
|
||||||
debug("## kernel board info at 0x%08lx\n", (ulong)*kbd);
|
debug("## kernel board info at 0x%08lx\n", (ulong)*kbd);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue