Rename last_bl_blk to last_blk
PATCH 1/3 Rename last_bl_blk to last_blk
Also update the next_bct_blk. Then we have the correct pointer to the next block for the next image write.
--- src/cbootimage.h | 2 +- src/data_layout.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
src/cbootimage.h +1 -1
@@ -95,7 +95,7 @@ typedef struct build_image_context_recu_int8_t *bct;char *bct_filename; -u_int32_t last_bl_blk; +u_int32_t last_blk;u_int32_t bct_size;/* The BCT file size */ u_int32_t boot_data_version;/* The boot data version of BCT */ u_int8_t bct_init;/* The flag for the memory allocation of bct */
src/data_layout.c +2 -1
@@ -552,8 +552,9 @@ write_bootloaders(build_image_context *context) current_blk++; virtual_blk++; } - context->last_bl_blk = current_blk; + context->last_blk = current_blk; } + context->next_bct_blk = context->last_blk +1 ;free (buffer); }
Signature · 1 line
1.8.3.2
PATCH 2/3 Add Tegra132 support for the cbootimage utility
In reply to a message not in the archive--- src/Makefile.am | 12 +- src/cbootimage.c | 9 +- src/cbootimage.h | 13 +- src/data_layout.c | 297 ++++++++- src/data_layout.h | 5 +- src/parse.c | 63 +- src/parse.h | 77 ++- src/set.c | 22 +- src/set.h | 8 +- src/t132/nvbctlib_t132.c | 1241 ++++++++++++++++++++++++++++++++++++ src/t132/nvboot_bct_t132.h | 438 +++++++++++++ src/t132/nvboot_sdram_param_t132.h | 803 +++++++++++++++++++++++ src/t132/parse_t132.c | 429 +++++++++++++ 13 files changed, 3404 insertions(+), 13 deletions(-) create mode 100644 src/t132/nvbctlib_t132.c create mode 100644 src/t132/nvboot_bct_t132.h create mode 100644 src/t132/nvboot_sdram_param_t132.h create mode 100644 src/t132/parse_t132.c
src/Makefile.am +10 -2
@@ -11,10 +11,12 @@ cbootimage_SOURCES = \ aes_ref.c \ context.c \ parse.c \ + t132/parse_t132.c \ t124/parse_t124.c \ t114/parse_t114.c \ t30/parse_t30.c \ t20/parse_t20.c \ + t132/nvbctlib_t132.c \ t124/nvbctlib_t124.c \ t114/nvbctlib_t114.c \ t30/nvbctlib_t30.c \
@@ -33,7 +35,9 @@ cbootimage_SOURCES = \ t114/nvboot_bct_t114.h \ t114/nvboot_sdram_param_t114.h \ t124/nvboot_bct_t124.h \ - t124/nvboot_sdram_param_t124.h + t124/nvboot_sdram_param_t124.h \ + t132/nvboot_bct_t132.h \ + t132/nvboot_sdram_param_t132.h cbootimage_LDADD = -lm
@@ -45,10 +49,12 @@ bct_dump_SOURCES = \ aes_ref.c \ context.c \ parse.c \ + t132/parse_t132.c \ t124/parse_t124.c \ t114/parse_t114.c \ t30/parse_t30.c \ t20/parse_t20.c \ + t132/nvbctlib_t132.c \ t124/nvbctlib_t124.c \ t114/nvbctlib_t114.c \ t30/nvbctlib_t30.c \
@@ -67,4 +73,6 @@ bct_dump_SOURCES = \ t114/nvboot_bct_t114.h \ t114/nvboot_sdram_param_t114.h \ t124/nvboot_bct_t124.h \ - t124/nvboot_sdram_param_t124.h + t124/nvboot_sdram_param_t124.h \ + t132/nvboot_bct_t132.h \ + t132/nvboot_sdram_param_t132.h
src/cbootimage.c +6 -3
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -71,10 +71,11 @@ usage(void)printf (" -gbct Generate the new bct file.\n" );printf (" -o<ODM_DATA> Specify the odm_data(in hex).\n" );printf (" -t|--tegra NN Select target device. Must be one of:\n" ); -printf (" 20, 30, 114, 124.\n" ); +printf (" 20, 30, 114, 124, 132.\n" );printf (" Default: 20. This option is deprecated\n" );printf (" -s|--soc tegraNN Select target device. Must be one of:\n" ); -printf (" tegra20, tegra30, tegra114, tegra124.\n" ); +printf (" tegra20, tegra30, tegra114, tegra124,\n" ); +printf (" tegra132.\n" );printf (" Default: tegra20.\n" );printf (" -u|--update Copy input image data and update bct\n" );printf (" configs into new image file.\n" );
@@ -128,6 +129,8 @@ process_command_line(int argc, char *argv[], build_image_context *context)t114_get_soc_config (context, &g_soc_config); }else if (!strcasecmp ("124" , optarg)) {t124_get_soc_config (context, &g_soc_config); + }else if (!strcasecmp ("132" , optarg)) { +t132_get_soc_config (context, &g_soc_config); }else {printf ("Unsupported chipname!\n" );usage ();
src/cbootimage.h +11 -2
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -44,8 +44,11 @@#define BOOTDATA_VERSION_T30 NVBOOT_BOOTDATA_VERSION(0x3, 0x1)#define BOOTDATA_VERSION_T114 NVBOOT_BOOTDATA_VERSION(0x35, 0x1)#define BOOTDATA_VERSION_T124 NVBOOT_BOOTDATA_VERSION(0x40, 0x1) +#define BOOTDATA_VERSION_T132 NVBOOT_BOOTDATA_VERSION(0x13, 0x1) -#define NVBOOT_CONFIG_TABLE_SIZE_MAX 8192 +#define MAX_MTS_SIZE (4 * 1024 * 1024) + +#define NVBOOT_CONFIG_TABLE_SIZE_MAX 8704/* * Enumerations
@@ -55,6 +58,7 @@ typedef enum { file_type_bl =0 , file_type_bct, + file_type_mts, } file_type;/*
@@ -94,6 +98,11 @@ typedef struct build_image_context_recu_int8_t generate_bct;u_int8_t *bct; +char *mts_filename; +u_int32_t mts_load_addr; +u_int32_t mts_entry_point; +u_int32_t mts_attr; +char *bct_filename;u_int32_t last_blk;u_int32_t bct_size;/* The BCT file size */
src/data_layout.c +296 -1
337 lines not on this page · raw message
src/data_layout.h +4 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -37,6 +37,9 @@ void destroy_block_list(blk_data_handle);int update_bl (struct build_image_context_rec *context); +int +update_mts_image (build_image_context *context); +void update_context (struct build_image_context_rec *context);
src/parse.c +62 -1
91 lines not on this page · raw message
src/parse.h +76 -1
158 lines not on this page · raw message
src/set.c +21 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -123,6 +123,26 @@ set_bootloader(build_image_context *context,return update_bl (context); } +/* +* Processes commands to set a MTS image. +* +* @param context The main context pointer +* @param filename The file name of MTS image +* @param load_addr The load address value for MTS image +* @param entry_point The entry point value for MTS image +* @return 0 and 1 for success and failure +*/ +int +set_mts_image (build_image_context *context, +char *filename, +u_int32_t load_addr, +u_int32_t entry_point) +{ + context->mts_filename = filename; + context->mts_load_addr = load_addr; + context->mts_entry_point = entry_point; +return update_mts_image (context); +}#define DEFAULT () \ default: \ printf("Unexpected token %d at line %d\n", \
src/set.h +7 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -36,6 +36,12 @@ set_bootloader(build_image_context *context, u_int32_t entry_point);int +set_mts_image (build_image_context *context, +char *filename, +u_int32_t load_addr, +u_int32_t entry_point); + +int context_set_value (build_image_context *context,parse_token token,void *value);
src/t132/nvbctlib_t132.c new file +1241 -0
1,241 lines not on this page · raw message
src/t132/nvboot_bct_t132.h new file +438 -0
438 lines not on this page · raw message
src/t132/nvboot_sdram_param_t132.h new file +803 -0
566 lines not on this page · raw message
src/t132/parse_t132.c new file +429 -0
429 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.8.3.2
Part of the diff is not shown here. View the raw message.
PATCH 3/3 Dump MTS information by bct_dump utility.
In reply to a message not in the archiveThe MTS is only for Tegra132 now.
--- src/bct_dump.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
src/bct_dump.c +40 -0
@@ -73,6 +73,16 @@ static value_data const bl_values[] = { { token_bl_attribute, "Attributes = ", format_u32_hex8 }, }; +static value_data const mts_values[] = { + { token_mts_info_version,"Version = " , format_u32_hex8 }, + { token_mts_info_start_block,"Start block = " , format_u32 }, + { token_mts_info_start_page,"Start page = " , format_u32 }, + { token_mts_info_length,"Length = " , format_u32 }, + { token_mts_info_load_address,"Load address = " , format_u32_hex8 }, + { token_mts_info_entry_point,"Entry point = " , format_u32_hex8 }, + { token_mts_info_attribute,"Attributes = " , format_u32_hex8 }, +}; +/*****************************************************************************/ static void format_u32_hex8 (char const * message,void * data) {
@@ -177,6 +187,7 @@ int main(int argc, char *argv[])u_int32_t bootloaders_used;u_int32_t parameters_used;u_int32_t sdram_used; +u_int32_t mts_used;nvboot_dev_type type;param_types data;int i;
@@ -234,6 +245,35 @@ int main(int argc, char *argv[]) } } +/* Display mts values */ + e = g_soc_config->get_value (token_mts_used, + &mts_used, + context.bct); + +if ((e ==0 ) && (mts_used>0 )) { +int mts_count =sizeof (mts_values) /sizeof (mts_values[0 ]); + +printf ("#\n" +"# These values are set by cbootimage using the\n" +"# mts provided by the Mts=... or MtsPreboot=...\n" +"# configuration option.\n" +"#\n" ); + +for (i =0 ; i < mts_used; ++i) { +for (j =0 ; j < mts_count; ++j) { + e = g_soc_config->get_mts_info (&context, + i, + mts_values[j].id, + &(data.val)); +printf ("# Mts[%d]." , i); + +if (e) + data.val =-1 ; + + mts_values[j].format (mts_values[j].message, &data); + } + } + }/* Display flash device parameters */ e = g_soc_config->get_value(token_num_param_sets, ¶meters_used,
Signature · 1 line
1.8.3.2
Sorry, this is a series for cbootimage. I forgot to add the prefix. Will add in next version.
Thanks,
Vince
Quoted 37 lines · Vince Hsu
Also update the
next_bct_blk. Then we have the correct pointer to the next block for the next image write.Signed-off-by Vince Hsu <[email protected]>--- src/cbootimage.h | 2 +- src/data_layout.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)src/cbootimage.h +1
-1@@ -95,7 +95,7 @@ typedef struct build_image_context_recu_int8_t *bct;char *bct_filename; -u_int32_t last_bl_blk; +u_int32_t last_blk;u_int32_t bct_size;/* The BCT file size */ u_int32_t boot_data_version;/* The boot data version of BCT */ u_int8_t bct_init;/* The flag for the memory allocation of bct */ src/data_layout.c +2
-1@@ -552,8 +552,9 @@ write_bootloaders(build_image_context *context) current_blk++; virtual_blk++; } - context->last_bl_blk = current_blk; + context->last_blk = current_blk; } + context->next_bct_blk = context->last_blk +1 ;free (buffer); }
Re: [PATCH 2/3] Add Tegra132 support for the cbootimage utility
In reply to a message not in the archiveQuoted 1 line · Vince Hsu
Signed-off-by Vince Hsu <[email protected]>
Need more of a patch description here. At least mention the new command line arguments, and what Tegra132 is.
Quoted 15 lines
src/data_layout.c +11
-0@@ -327,6 +328,27 @@ do { \SET_BL_FIELD (to, field, v); \ }while (0 ); +#define SET_MTS_FIELD (instance, field, value) \ +do { \ + g_soc_config->set_mts_info(context, \ + instance, \ + token_mts_info_##field, \ + value); \ +} while (0); + +#define GET_MTS_FIELD (instance, field, ptr) \ +g_soc_config->get_mts_info(context, \ + instance, \
src/data_layout.c do { \ · line 351
Quoted 10 lines
src/data_layout.c +10
-0+ token_mts_info_##field, \ + ptr); + +#define COPY_MTS_FIELD (from, to, field) \ +do { \ + u_int32_t v; \ + GET_MTS_FIELD(from, field, &v); \ + SET_MTS_FIELD(to, field, v); \ +} while (0); +
The trailing backslashes appear to have a lot of variable whitespace here, can you clean these up?
Quoted 5 lines
src/data_layout.c +2
-0return err; } +/* +* Load the mts image then update it with the information from config file.
src/data_layout.c fail: · line 667
Quoted 10 lines
src/data_layout.c +10
-0+* In the interest of expediency, all mts's allocated from bottom to top start +* at page 0 of a block, and all mts's allocated from top to bottom end at +* the end of a block. +* +* @param context The main context pointer +* @return 0 for success +*/ +static int +write_mts_image (build_image_context *context) +{
This whole function is almost identical to write_bootloaders(), can you pull out the common parts of these functions and parameterize the differences to avoid the code duplication?
src/parse.c static parse_item parse_simple_items[] = · line 93
Quoted 6 lines
src/parse.c +2
-0@@ -87,6 +89,8 @@ static parse_item parse_simple_items[] = { "BootLoader=", token_bootloader, parse_bootloader }, { "Redundancy=", token_redundancy, parse_value_u32 }, { "Bctcopy=", token_bct_copy, parse_value_u32 }, + { "MtsPreboot=", token_mts_preboot, parse_mts_image}, + { "Mts=", token_mts, parse_mts_image},
Whitespace looks off here
src/parse.c static parse_item s_top_level_items[] = { · line 113
Quoted 9 lines
src/parse.c +2
-0{ "Version=", token_version, parse_value_u32 }, { "PreBctPadBlocks=", token_pre_bct_pad_blocks, parse_value_u32 }, { NULL, 0, NULL } /* Must be last */@@ -105,6 +109,8 @@ static parse_item s_top_level_items[] = { { "BootLoader=", token_bootloader, parse_bootloader }, { "Redundancy=", token_redundancy, parse_value_u32 }, { "Bctcopy=", token_bct_copy, parse_value_u32 }, + { "MtsPreboot=", token_mts_preboot, parse_mts_image}, + { "Mts=", token_mts, parse_mts_image},
and here
Quoted 17 lines
src/t132/nvbctlib_t132.c new file +17
-0+cbootimage_soc_config tegra132_config = { + .init_bad_block_table = t132_init_bad_block_table, + .set_dev_param = t132_set_dev_param, + .get_dev_param = t132_get_dev_param, + .set_sdram_param = t132_set_sdram_param, + .get_sdram_param = t132_get_sdram_param, + .setbl_param = t132_setbl_param, + .getbl_param = t132_getbl_param, + .set_value = t132_bct_set_value, + .get_value = t132_bct_get_value, + .set_data = t132_bct_set_data, + .get_bct_size = t132_get_bct_size, + .set_mts_info = t132_set_mts_info, + .get_mts_info = t132_get_mts_info, + .token_supported = t132_bct_token_supported, + + .devtype_table = s_devtype_table_t132,
src/t132/nvbctlib_t132.c line 1223
Quoted 10 lines
src/t132/nvbctlib_t132.c new file +10
-0+ .sdmmc_data_width_table = s_sdmmc_data_width_table_t132, + .spi_clock_source_table = s_spi_clock_source_table_t132, + .nvboot_memory_type_table = s_nvboot_memory_type_table_t132, + .sdram_field_table = s_sdram_field_table_t132, + .nand_table = 0, + .sdmmc_table = s_sdmmc_table_t132, + .spiflash_table = s_spiflash_table_t132, + .device_type_table = s_device_type_table_t132, +}; +
Since Tegra132 and Tegra124 are so similar, can we reuse the Tegra124 version of any of these to avoid the duplication?
-Allen
nvpublic
Re: [PATCH 2/3] Add Tegra132 support for the cbootimage utility
In reply to a message not in the archiveQuoted 63 lines · Allen Martin
Quoted 1 line · Vince Hsu
Signed-off-by Vince Hsu <[email protected]>Need more of a patch description here. At least mention the new command line arguments, and what Tegra132 is.
Quoted 15 lines
src/data_layout.c +11
-0@@ -327,6 +328,27 @@ do { \SET_BL_FIELD (to, field, v); \ }while (0 ); +#define SET_MTS_FIELD (instance, field, value) \ +do { \ + g_soc_config->set_mts_info(context, \ + instance, \ + token_mts_info_##field, \ + value); \ +} while (0); + +#define GET_MTS_FIELD (instance, field, ptr) \ +g_soc_config->get_mts_info(context, \ + instance, \src/data_layout.c do { \ · line 351
Quoted 10 lines
src/data_layout.c +10
-0+ token_mts_info_##field, \ + ptr); + +#define COPY_MTS_FIELD (from, to, field) \ +do { \ + u_int32_t v; \ + GET_MTS_FIELD(from, field, &v); \ + SET_MTS_FIELD(to, field, v); \ +} while (0); +The trailing backslashes appear to have a lot of variable whitespace here, can you clean these up?
Quoted 5 lines
src/data_layout.c +2
-0return err; } +/* +* Load the mts image then update it with the information from config file. src/data_layout.c fail: · line 667
Quoted 10 lines
src/data_layout.c +10
-0+* In the interest of expediency, all mts's allocated from bottom to top start +* at page 0 of a block, and all mts's allocated from top to bottom end at +* the end of a block. +* +* @param context The main context pointer +* @return 0 for success +*/ +static int +write_mts_image (build_image_context *context) +{This whole function is almost identical to
write_bootloaders(), can you pull out the common parts of these functions and parameterize the differences to avoid the code duplication?src/parse.c static parse_item parse_simple_items[] = · line 93
Quoted 6 lines
src/parse.c +2
-0@@ -87,6 +89,8 @@ static parse_item parse_simple_items[] = { "BootLoader=", token_bootloader, parse_bootloader }, { "Redundancy=", token_redundancy, parse_value_u32 }, { "Bctcopy=", token_bct_copy, parse_value_u32 }, + { "MtsPreboot=", token_mts_preboot, parse_mts_image}, + { "Mts=", token_mts, parse_mts_image},Whitespace looks off here
Quoted 10 lines
src/parse.c static parse_item s_top_level_items[] = { · line 113
Quoted 9 lines
src/parse.c +2
-0{ "Version=", token_version, parse_value_u32 }, { "PreBctPadBlocks=", token_pre_bct_pad_blocks, parse_value_u32 }, { NULL, 0, NULL } /* Must be last */@@ -105,6 +109,8 @@ static parse_item s_top_level_items[] = { { "BootLoader=", token_bootloader, parse_bootloader }, { "Redundancy=", token_redundancy, parse_value_u32 }, { "Bctcopy=", token_bct_copy, parse_value_u32 }, + { "MtsPreboot=", token_mts_preboot, parse_mts_image}, + { "Mts=", token_mts, parse_mts_image},and here
Will modify for all the comments above accordingly. Thanks.
Quoted 23 lines
Quoted 23 lines
src/t132/nvbctlib_t132.c new file +21
-0+cbootimage_soc_config tegra132_config = { + .init_bad_block_table = t132_init_bad_block_table, + .set_dev_param = t132_set_dev_param, + .get_dev_param = t132_get_dev_param, + .set_sdram_param = t132_set_sdram_param, + .get_sdram_param = t132_get_sdram_param, + .setbl_param = t132_setbl_param, + .getbl_param = t132_getbl_param, + .set_value = t132_bct_set_value, + .get_value = t132_bct_get_value, + .set_data = t132_bct_set_data, + .get_bct_size = t132_get_bct_size, + .set_mts_info = t132_set_mts_info, + .get_mts_info = t132_get_mts_info, + .token_supported = t132_bct_token_supported, + + .devtype_table = s_devtype_table_t132, + .sdmmc_data_width_table = s_sdmmc_data_width_table_t132, + .spi_clock_source_table = s_spi_clock_source_table_t132, + .nvboot_memory_type_table = s_nvboot_memory_type_table_t132, + .sdram_field_table = s_sdram_field_table_t132,
Quoted 8 lines
src/t132/nvbctlib_t132.c line 1223
Quoted 6 lines
src/t132/nvbctlib_t132.c new file +6
-0+ .nand_table = 0, + .sdmmc_table = s_sdmmc_table_t132, + .spiflash_table = s_spiflash_table_t132, + .device_type_table = s_device_type_table_t132, +}; +Since Tegra132 and Tegra124 are so similar, can we reuse the Tegra124 version of any of these to avoid the duplication?
We can export most of the functions in nvbctlib_t124.c for this. Do you like that?
Thanks,
Vince
Quoted 5 lines
-Allen
nvpublic
Re: [PATCH 2/3] Add Tegra132 support for the cbootimage utility
In reply to a message not in the archiveHi,
Quoted 21 lines · Allen Martin
Quoted 21 lines
Quoted 21 lines
src/t132/nvbctlib_t132.c new file +21
-0+cbootimage_soc_config tegra132_config = { + .init_bad_block_table = t132_init_bad_block_table, + .set_dev_param = t132_set_dev_param, + .get_dev_param = t132_get_dev_param, + .set_sdram_param = t132_set_sdram_param, + .get_sdram_param = t132_get_sdram_param, + .setbl_param = t132_setbl_param, + .getbl_param = t132_getbl_param, + .set_value = t132_bct_set_value, + .get_value = t132_bct_get_value, + .set_data = t132_bct_set_data, + .get_bct_size = t132_get_bct_size, + .set_mts_info = t132_set_mts_info, + .get_mts_info = t132_get_mts_info, + .token_supported = t132_bct_token_supported, + + .devtype_table = s_devtype_table_t132, + .sdmmc_data_width_table = s_sdmmc_data_width_table_t132, + .spi_clock_source_table = s_spi_clock_source_table_t132, + .nvboot_memory_type_table = s_nvboot_memory_type_table_t132, + .sdram_field_table = s_sdram_field_table_t132,
Quoted 8 lines
Quoted 6 lines
src/t132/nvbctlib_t132.c line 1223
Quoted 6 lines
src/t132/nvbctlib_t132.c new file +6
-0+ .nand_table = 0, + .sdmmc_table = s_sdmmc_table_t132, + .spiflash_table = s_spiflash_table_t132, + .device_type_table = s_device_type_table_t132, +}; +Since Tegra132 and Tegra124 are so similar, can we reuse the Tegra124 version of any of these to avoid the duplication?
Some of these functions like setbl_param refer to the macros/definitions in nvboot_bct_txx.h. So maybe they look similar, actually they don't. If we want to generalize these functions, we might have to refactor nvboot_bct_txx.h and some more stuff. Can we leave it as is?
Thanks,
Vince
Re: [PATCH 2/3] Add Tegra132 support for the cbootimage utility
In reply to a message not in the archiveQuoted 32 lines · Vince Hsu
Hi,
Quoted 21 lines · Allen Martin
Quoted 21 lines
Quoted 21 lines
src/t132/nvbctlib_t132.c new file +21
-0+cbootimage_soc_config tegra132_config = { + .init_bad_block_table = t132_init_bad_block_table, + .set_dev_param = t132_set_dev_param, + .get_dev_param = t132_get_dev_param, + .set_sdram_param = t132_set_sdram_param, + .get_sdram_param = t132_get_sdram_param, + .setbl_param = t132_setbl_param, + .getbl_param = t132_getbl_param, + .set_value = t132_bct_set_value, + .get_value = t132_bct_get_value, + .set_data = t132_bct_set_data, + .get_bct_size = t132_get_bct_size, + .set_mts_info = t132_set_mts_info, + .get_mts_info = t132_get_mts_info, + .token_supported = t132_bct_token_supported, + + .devtype_table = s_devtype_table_t132, + .sdmmc_data_width_table = s_sdmmc_data_width_table_t132, + .spi_clock_source_table = s_spi_clock_source_table_t132, + .nvboot_memory_type_table = s_nvboot_memory_type_table_t132, + .sdram_field_table = s_sdram_field_table_t132,Quoted 8 lines
Quoted 6 lines
src/t132/nvbctlib_t132.c line 1223
Quoted 6 lines
src/t132/nvbctlib_t132.c new file +6
-0+ .nand_table = 0, + .sdmmc_table = s_sdmmc_table_t132, + .spiflash_table = s_spiflash_table_t132, + .device_type_table = s_device_type_table_t132, +}; +Since Tegra132 and Tegra124 are so similar, can we reuse the Tegra124 version of any of these to avoid the duplication?
Quoted 4 lines
Some of these functions like
setbl_paramrefer to the macros/definitions innvboot_bct_txx.h. So maybe they look similar, actually they don't. If we want to generalize these functions, we might have to refactornvboot_bct_txx.hand some more stuff. Can we leave it as is?
I can see how this could turn into a can of worms. I just seems like a shame to have to duplicate so much code for a new SoC that's ~90% the same as the previous SoC. Can the token tables be reused, or do they have the same issue?
-Allen
Re: [PATCH 2/3] Add Tegra132 support for the cbootimage utility
In reply to a message not in the archiveQuoted 33 lines · Allen Martin
Quoted 32 lines · Vince Hsu
Hi,
Quoted 29 lines · Allen Martin
Quoted 19 lines
Quoted 19 lines
(quoted diff) +19
-0+cbootimage_soc_config tegra132_config = { + .init_bad_block_table = t132_init_bad_block_table, + .set_dev_param = t132_set_dev_param, + .get_dev_param = t132_get_dev_param, + .set_sdram_param = t132_set_sdram_param, + .get_sdram_param = t132_get_sdram_param, + .setbl_param = t132_setbl_param, + .getbl_param = t132_getbl_param, + .set_value = t132_bct_set_value, + .get_value = t132_bct_get_value, + .set_data = t132_bct_set_data, + .get_bct_size = t132_get_bct_size, + .set_mts_info = t132_set_mts_info, + .get_mts_info = t132_get_mts_info, + .token_supported = t132_bct_token_supported, + + .devtype_table = s_devtype_table_t132, + .sdmmc_data_width_table = s_sdmmc_data_width_table_t132, + .spi_clock_source_table = s_spi_clock_source_table_t132,Quoted 8 lines
Review
Quoted 8 lines
(quoted diff) +8
-0+ .nvboot_memory_type_table = s_nvboot_memory_type_table_t132, + .sdram_field_table = s_sdram_field_table_t132, + .nand_table = 0, + .sdmmc_table = s_sdmmc_table_t132, + .spiflash_table = s_spiflash_table_t132, + .device_type_table = s_device_type_table_t132, +}; +Since Tegra132 and Tegra124 are so similar, can we reuse the Tegra124 version of any of these to avoid the duplication?
Quoted 8 lines
Quoted 4 lines
Some of these functions like
setbl_paramrefer to the macros/definitions innvboot_bct_txx.h. So maybe they look similar, actually they don't. If we want to generalize these functions, we might have to refactornvboot_bct_txx.hand some more stuff. Can we leave it as is?I can see how this could turn into a can of worms. I just seems like a shame to have to duplicate so much code for a new SoC that's ~90% the same as the previous SoC. Can the token tables be reused, or do they have the same issue?
The token table is something like supported feature list. Every SoC from t20 to t132 has only slight differences from others. But keeping a simple table for each SoC might be reasonable here?
Thanks,
Vince
Re: [PATCH 2/3] Add Tegra132 support for the cbootimage utility
In reply to a message not in the archiveQuoted 38 lines · Vince Hsu
Quoted 37 lines · Allen Martin
Quoted 36 lines · Vince Hsu
Hi,
Quoted 21 lines · Allen Martin
Quoted 21 lines
Quoted 21 lines
(quoted diff) +21
-0+cbootimage_soc_config tegra132_config = { + .init_bad_block_table = t132_init_bad_block_table, + .set_dev_param = t132_set_dev_param, + .get_dev_param = t132_get_dev_param, + .set_sdram_param = t132_set_sdram_param, + .get_sdram_param = t132_get_sdram_param, + .setbl_param = t132_setbl_param, + .getbl_param = t132_getbl_param, + .set_value = t132_bct_set_value, + .get_value = t132_bct_get_value, + .set_data = t132_bct_set_data, + .get_bct_size = t132_get_bct_size, + .set_mts_info = t132_set_mts_info, + .get_mts_info = t132_get_mts_info, + .token_supported = t132_bct_token_supported, + + .devtype_table = s_devtype_table_t132, + .sdmmc_data_width_table = s_sdmmc_data_width_table_t132, + .spi_clock_source_table = s_spi_clock_source_table_t132, + .nvboot_memory_type_table = s_nvboot_memory_type_table_t132, + .sdram_field_table = s_sdram_field_table_t132,Quoted 8 lines
Quoted 6 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ .nand_table = 0, + .sdmmc_table = s_sdmmc_table_t132, + .spiflash_table = s_spiflash_table_t132, + .device_type_table = s_device_type_table_t132, +}; +Since Tegra132 and Tegra124 are so similar, can we reuse the Tegra124 version of any of these to avoid the duplication?
Some of these functions like
setbl_paramrefer to the macros/definitions innvboot_bct_txx.h. So maybe they look similar, actually they don't. If we want to generalize these functions, we might have to refactornvboot_bct_txx.hand some more stuff. Can we leave it as is?
Quoted 8 lines
Quoted 4 lines
I can see how this could turn into a can of worms. I just seems like a shame to have to duplicate so much code for a new SoC that's ~90% the same as the previous SoC. Can the token tables be reused, or do they have the same issue?
The token table is something like supported feature list. Every SoC from t20 to t132 has only slight differences from others. But keeping a simple table for each SoC might be reasonable here?
Some of them, like s_sdram_field_table_t124 are not so simple. Maybe what's really needed is a better way to describe the BCT that's not implemented in C code combined with a very generic parser.
It just doesn't seem maintainable to keep having to copy over a thousand lines of code for each SoC to just tweak a few fields. It makes it hard to review too, since it's really hard to see what the new Tegra132 features are.
I agree it's probably beyond the scope of this patch to fix this, but could you add detail to the commit message about the differences between the Tegra124 and Tegra132 BCT and what changes you made relative to Tegra124 to help me with the review?
-Allen