| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. | 2 * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. |
| 3 * | 3 * |
| 4 * See file CREDITS for list of people who contributed to this | 4 * See file CREDITS for list of people who contributed to this |
| 5 * project. | 5 * project. |
| 6 * | 6 * |
| 7 * This program is free software; you can redistribute it and/or | 7 * This program is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU General Public License as | 8 * modify it under the terms of the GNU General Public License as |
| 9 * published by the Free Software Foundation; either version 2 of | 9 * published by the Free Software Foundation; either version 2 of |
| 10 * the License, or (at your option) any later version. | 10 * the License, or (at your option) any later version. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 /** | 39 /** |
| 40 * Defines the number of bytes in the reserved area of the BCT. | 40 * Defines the number of bytes in the reserved area of the BCT. |
| 41 */ | 41 */ |
| 42 #define NVBOOT_BCT_RESERVED_SIZE 3 | 42 #define NVBOOT_BCT_RESERVED_SIZE 3 |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * Defines the maximum number of bootloader descriptions in the BCT. | 45 * Defines the maximum number of bootloader descriptions in the BCT. |
| 46 */ | 46 */ |
| 47 #define NVBOOT_MAX_BOOTLOADERS 4 | 47 #define NVBOOT_MAX_BOOTLOADERS 4 |
| 48 | 48 |
| 49 #define NVBOOT_BCT_USED_DATA_SIZE» 534 | 49 #define NVBOOT_BCT_USED_DATA_SIZE» 2052 |
| 50 |
| 51 /** |
| 52 * Defines the maximum number of device parameter sets in the BCT. |
| 53 * The value must be equal to (1 << # of device straps) |
| 54 */ |
| 55 #define NVBOOT_BCT_MAX_PARAM_SETS 4 |
| 50 | 56 |
| 51 /** | 57 /** |
| 52 * Defines the number of entries (bits) in the bad block table. | 58 * Defines the number of entries (bits) in the bad block table. |
| 53 * The consequences of changing its value are as follows. Using P as the | 59 * The consequences of changing its value are as follows. Using P as the |
| 54 * # of physical blocks in the boot loader and B as the value of this | 60 * # of physical blocks in the boot loader and B as the value of this |
| 55 * constant: | 61 * constant: |
| 56 * B > P: There will be unused storage in the bad block table. | 62 * B > P: There will be unused storage in the bad block table. |
| 57 * B < P: The virtual block size will be greater than the physical block | 63 * B < P: The virtual block size will be greater than the physical block |
| 58 * size, so the granularity of the bad block table will be less than | 64 * size, so the granularity of the bad block table will be less than |
| 59 * one bit per physical block. | 65 * one bit per physical block. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 86 enum {NVBOOT_CMAC_AES_HASH_LENGTH = 4}; | 92 enum {NVBOOT_CMAC_AES_HASH_LENGTH = 4}; |
| 87 | 93 |
| 88 /** | 94 /** |
| 89 * Defines the storage for a hash value (128 bits). | 95 * Defines the storage for a hash value (128 bits). |
| 90 */ | 96 */ |
| 91 typedef struct nvboot_hash_rec | 97 typedef struct nvboot_hash_rec |
| 92 { | 98 { |
| 93 u_int32_t hash[NVBOOT_CMAC_AES_HASH_LENGTH]; | 99 u_int32_t hash[NVBOOT_CMAC_AES_HASH_LENGTH]; |
| 94 } nvboot_hash; | 100 } nvboot_hash; |
| 95 | 101 |
| 102 /// Defines various data widths supported. |
| 103 typedef enum |
| 104 { |
| 105 /** |
| 106 * Specifies a 1 bit interface to eMMC. |
| 107 * Note that 1-bit data width is only for the driver's internal use. |
| 108 * Fuses doesn't provide option to select 1-bit data width. |
| 109 * The driver selects 1-bit internally based on need. |
| 110 * It is used for reading Extended CSD and when the power class |
| 111 * requirements of a card for 4-bit or 8-bit transfers are not |
| 112 * supported by the target board. |
| 113 */ |
| 114 nvboot_sdmmc_data_width_1bit = 0, |
| 115 |
| 116 /// Specifies a 4 bit interface to eMMC. |
| 117 nvboot_sdmmc_data_width_4bit = 1, |
| 118 |
| 119 /// Specifies a 8 bit interface to eMMC. |
| 120 nvboot_sdmmc_data_width_8bit = 2, |
| 121 |
| 122 nvboot_sdmmc_data_width_num, |
| 123 nvboot_sdmmc_data_width_force32 = 0x7FFFFFFF |
| 124 } nvboot_sdmmc_data_width; |
| 125 |
| 126 /// Defines the parameters that can be changed after BCT is read. |
| 127 typedef struct nvboot_sdmmc_params_rec |
| 128 { |
| 129 /** |
| 130 * Specifies the clock divider for the SDMMC controller's clock source, |
| 131 * which is PLLP running at 432MHz. If it is set to 18, then the SDMMC |
| 132 * controller runs at 432/18 = 24MHz. |
| 133 */ |
| 134 u_int8_t clock_divider; |
| 135 |
| 136 /// Specifies the data bus width. Supported data widths are 4/8 bits. |
| 137 nvboot_sdmmc_data_width data_width; |
| 138 |
| 139 /** |
| 140 * Max Power class supported by the target board. |
| 141 * The driver determines the best data width and clock frequency |
| 142 * supported within the power class range (0 to Max) if the selected |
| 143 * data width cannot be used at the chosen clock frequency. |
| 144 */ |
| 145 u_int8_t max_power_class_supported; |
| 146 u_int32_t reserved; |
| 147 } nvboot_sdmmc_params; |
| 148 |
| 149 typedef enum |
| 150 { |
| 151 /// Specifies SPI clock source to be PLLP. |
| 152 nvboot_spi_clock_source_pllp_out0 = 0, |
| 153 |
| 154 /// Specifies SPI clock source to be PLLC. |
| 155 nvboot_spi_clock_source_pllc_out0, |
| 156 |
| 157 /// Specifies SPI clock source to be PLLM. |
| 158 nvboot_spi_clock_source_pllm_out0, |
| 159 |
| 160 /// Specifies SPI clock source to be ClockM. |
| 161 nvboot_spi_clock_source_clockm, |
| 162 |
| 163 nvboot_spi_clock_source_num, |
| 164 nvboot_spi_clock_source_force32 = 0x7FFFFFF |
| 165 } nvboot_spi_clock_source; |
| 166 |
| 167 |
| 168 /** |
| 169 * Defines the parameters SPI FLASH devices. |
| 170 */ |
| 171 typedef struct nvboot_spiflash_params_rec |
| 172 { |
| 173 /** |
| 174 * Specifies the clock source to use. |
| 175 */ |
| 176 nvboot_spi_clock_source clock_source; |
| 177 |
| 178 /** |
| 179 * Specifes the clock divider to use. |
| 180 * The value is a 7-bit value based on an input clock of 432Mhz. |
| 181 * Divider = (432+ DesiredFrequency-1)/DesiredFrequency; |
| 182 * Typical values: |
| 183 * NORMAL_READ at 20MHz: 22 |
| 184 * FAST_READ at 33MHz: 14 |
| 185 * FAST_READ at 40MHz: 11 |
| 186 * FAST_READ at 50MHz: 9 |
| 187 */ |
| 188 u_int8_t clock_divider; |
| 189 |
| 190 /** |
| 191 * Specifies the type of command for read operations. |
| 192 * NV_FALSE specifies a NORMAL_READ Command |
| 193 * NV_TRUE specifies a FAST_READ Command |
| 194 */ |
| 195 u_int8_t read_command_type_fast; |
| 196 } nvboot_spiflash_params; |
| 197 |
| 198 /** |
| 199 * Defines the union of the parameters required by each device. |
| 200 */ |
| 201 typedef union{ |
| 202 /// Specifies optimized parameters for eMMC and eSD |
| 203 nvboot_sdmmc_params sdmmc_params; |
| 204 /// Specifies optimized parameters for SPI NOR |
| 205 nvboot_spiflash_params spiflash_params; |
| 206 } nvboot_dev_params; |
| 207 |
| 208 /** |
| 209 * Identifies the types of devices from which the system booted. |
| 210 * Used to identify primary and secondary boot devices. |
| 211 * @note These no longer match the fuse API device values (for |
| 212 * backward compatibility with AP15). |
| 213 */ |
| 214 typedef enum |
| 215 { |
| 216 /// Specifies a default (unset) value. |
| 217 nvboot_dev_type_none = 0, |
| 218 |
| 219 /// Specifies SPI NOR. |
| 220 nvboot_dev_type_spi = 3, |
| 221 |
| 222 /// Specifies SDMMC (either eMMC or eSD). |
| 223 nvboot_dev_type_sdmmc, |
| 224 |
| 225 nvboot_dev_type_max, |
| 226 |
| 227 /// Ignore -- Forces compilers to make 32-bit enums. |
| 228 nvboot_dev_type_force32 = 0x7FFFFFFF |
| 229 } nvboot_dev_type; |
| 230 |
| 96 /** | 231 /** |
| 97 * Stores information needed to locate and verify a boot loader. | 232 * Stores information needed to locate and verify a boot loader. |
| 98 * | 233 * |
| 99 * There is one \c nv_bootloader_info structure for each copy of a BL stored on | 234 * There is one \c nv_bootloader_info structure for each copy of a BL stored on |
| 100 * the device. | 235 * the device. |
| 101 */ | 236 */ |
| 102 typedef struct nv_bootloader_info_rec | 237 typedef struct nv_bootloader_info_rec |
| 103 { | 238 { |
| 104 u_int32_t version; | 239 u_int32_t version; |
| 105 u_int32_t start_blk; | 240 u_int32_t start_blk; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 131 * key attacks based on knowledge of this structure. | 266 * key attacks based on knowledge of this structure. |
| 132 */ | 267 */ |
| 133 typedef struct nvboot_config_table_rec | 268 typedef struct nvboot_config_table_rec |
| 134 { | 269 { |
| 135 nvboot_hash crypto_hash; | 270 nvboot_hash crypto_hash; |
| 136 nvboot_hash random_aes_blk; | 271 nvboot_hash random_aes_blk; |
| 137 u_int32_t boot_data_version; | 272 u_int32_t boot_data_version; |
| 138 u_int32_t block_size_log2; | 273 u_int32_t block_size_log2; |
| 139 u_int32_t page_size_log2; | 274 u_int32_t page_size_log2; |
| 140 u_int32_t partition_size; | 275 u_int32_t partition_size; |
| 141 » u_int32_t bct_used_data[NVBOOT_BCT_USED_DATA_SIZE]; | 276 » u_int32_t num_param_sets; |
| 277 » nvboot_dev_type dev_type[NVBOOT_BCT_MAX_PARAM_SETS]; |
| 278 » nvboot_dev_params dev_params[NVBOOT_BCT_MAX_PARAM_SETS]; |
| 279 » u_int8_t bct_used_data[NVBOOT_BCT_USED_DATA_SIZE]; |
| 142 nvboot_badblock_table badblock_table; | 280 nvboot_badblock_table badblock_table; |
| 143 u_int32_t bootloader_used; | 281 u_int32_t bootloader_used; |
| 144 nv_bootloader_info bootloader[NVBOOT_MAX_BOOTLOADERS]; | 282 nv_bootloader_info bootloader[NVBOOT_MAX_BOOTLOADERS]; |
| 145 u_int8_t customer_data[NVBOOT_BCT_CUSTOMER_DATA_SIZE]; | 283 u_int8_t customer_data[NVBOOT_BCT_CUSTOMER_DATA_SIZE]; |
| 146 u_int8_t enable_fail_back; | 284 u_int8_t enable_fail_back; |
| 147 u_int8_t reserved[NVBOOT_BCT_RESERVED_SIZE]; | 285 u_int8_t reserved[NVBOOT_BCT_RESERVED_SIZE]; |
| 148 } nvboot_config_table; | 286 } nvboot_config_table; |
| 149 | 287 |
| 150 /** @} */ | 288 /** @} */ |
| 151 #endif /* #ifndef INCLUDED_NVBOOT_BCT_H */ | 289 #endif /* #ifndef INCLUDED_NVBOOT_BCT_H */ |
| OLD | NEW |