mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
Merge "armv7: qca: common: smem: skip printing the partition info if it exceeds flash size"
This commit is contained in:
commit
053a0869f6
2 changed files with 45 additions and 2 deletions
|
|
@ -42,6 +42,9 @@
|
||||||
#ifdef IPQ_UBI_VOL_WRITE_SUPPORT
|
#ifdef IPQ_UBI_VOL_WRITE_SUPPORT
|
||||||
static struct ubi_device *ubi;
|
static struct ubi_device *ubi;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern unsigned int get_spi_flash_size(void);
|
||||||
|
|
||||||
typedef struct smem_pmic_type
|
typedef struct smem_pmic_type
|
||||||
{
|
{
|
||||||
unsigned pmic_model;
|
unsigned pmic_model;
|
||||||
|
|
@ -1162,10 +1165,39 @@ static void print_ubi_vol_info(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int check_flash_exceed(struct smem_ptn *p, uint32_t offset, uint32_t psize) {
|
||||||
|
|
||||||
|
uint32_t fsize = 0;
|
||||||
|
qca_smem_flash_info_t *sfi = &qca_smem_flash_info;
|
||||||
|
uint32_t flash_type = sfi->flash_type;
|
||||||
|
|
||||||
|
if(flash_type == SMEM_BOOT_SPI_FLASH)
|
||||||
|
flash_type = part_which_flash(p) ? SMEM_BOOT_QSPI_NAND_FLASH :
|
||||||
|
SMEM_BOOT_SPI_FLASH;
|
||||||
|
|
||||||
|
switch (flash_type) {
|
||||||
|
case SMEM_BOOT_SPI_FLASH:
|
||||||
|
fsize = get_spi_flash_size();
|
||||||
|
break;
|
||||||
|
#ifdef CONFIG_CMD_NAND
|
||||||
|
case SMEM_BOOT_QSPI_NAND_FLASH:
|
||||||
|
fsize = nand_info[CONFIG_QPIC_NAND_NAND_INFO_IDX].size;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offset + psize > fsize)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int do_smeminfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
int do_smeminfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
{
|
{
|
||||||
qca_smem_flash_info_t *sfi = &qca_smem_flash_info;
|
qca_smem_flash_info_t *sfi = &qca_smem_flash_info;
|
||||||
int i;
|
int i,ret;
|
||||||
uint32_t bsize;
|
uint32_t bsize;
|
||||||
#ifdef IPQ_UBI_VOL_WRITE_SUPPORT
|
#ifdef IPQ_UBI_VOL_WRITE_SUPPORT
|
||||||
ubi_set_rootfs_part();
|
ubi_set_rootfs_part();
|
||||||
|
|
@ -1218,6 +1250,11 @@ int do_smeminfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
psize = ((loff_t)p->size) * bsize;
|
psize = ((loff_t)p->size) * bsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* skip printing the partition that exceeds flash size */
|
||||||
|
ret = check_flash_exceed(p, ((loff_t)p->start) * bsize, psize);
|
||||||
|
if (ret)
|
||||||
|
continue;
|
||||||
|
|
||||||
printf("%3d: " smem_ptn_name_fmt " 0x%08x %#16llx %#16llx\n",
|
printf("%3d: " smem_ptn_name_fmt " 0x%08x %#16llx %#16llx\n",
|
||||||
i, p->name, p->attr, ((loff_t)p->start) * bsize, psize);
|
i, p->name, p->attr, ((loff_t)p->start) * bsize, psize);
|
||||||
#ifdef IPQ_UBI_VOL_WRITE_SUPPORT
|
#ifdef IPQ_UBI_VOL_WRITE_SUPPORT
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,12 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
static u32 spi_fsize;
|
||||||
|
|
||||||
|
u32 get_spi_flash_size(void) {
|
||||||
|
return spi_fsize;
|
||||||
|
}
|
||||||
|
|
||||||
static void spi_flash_addr(struct spi_flash *flash, u32 addr, u8 *cmd)
|
static void spi_flash_addr(struct spi_flash *flash, u32 addr, u8 *cmd)
|
||||||
{
|
{
|
||||||
/* cmd[0] is actual command */
|
/* cmd[0] is actual command */
|
||||||
|
|
@ -1324,7 +1330,7 @@ do_generic_probe:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
spi_fsize = flash->size;
|
||||||
#ifdef CONFIG_SPI_NAND
|
#ifdef CONFIG_SPI_NAND
|
||||||
print_sf_info:
|
print_sf_info:
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue