Various patches in common/
Subsystems (5)
v3 cover Various patches in common/
This collection of patches to common/ adds the following:
- EDID support for LCD displays
- TPM stress test
- gettime command to find out the time since boot
- Adds coreboot information to the 'version' command
- Fixes LMB on x86
- SHA256 hashing using a new hashing framework created in response to list feedback
- Reading raw data from a partition of a block device
Some patches have been dropped from v2 in response to list feedback.
Also fixes a few minor bugs and tidy-ups.
Changes in v3:
- Rename stricmp() to strcasecmp() to match Linux / POSIX
- Bracket strcasecmp() declarations with __HAVE_ARCH_...
- Rename stricmp() to strcasecmp() to match Linux / POSIX
- Correct hash error message to show the algorithm name, not always SHA1
- Fix ordering of hash.o in Makefile
- Correct hash command help to say 'hash' instead of 'sha1sum'
- Drop meminfo from this series
- Drop patch 'Update time command to avoid using get_timer_masked()'
Changes in v2:
- Remove arm: tag from bootstage step patch
- Convert space to tab in README
- Update gettime commit message to include boards without CONFIG_SYS_HZ
- Add more comments to the stdio strncpy commit message
- Add new patch to adjust sha1 functions to use const/unsigned
- Add new patch to adjust sha256 functions to const and watchdog
- Add stricmp() patch again since it is used in this series
- Add generic hash API to allow SHA256 command to be added without duplication
- Add new patch to change sha1sum to use generic hash API
- Add new hash command to support generic hash API
- Add patch to enable hashing and EDID on smdk5250
- Add x86 patch to enable io command for coreboot
- Add x86 tag to version command patch
Anton Staaf (1):
Add gettime command
Kenneth Waters (1):
Add a command to read raw blocks from a partition
Luigi Semenzato (1):
tpm: Add TPM stress test
Simon Glass (11):
Add new bootstage step for the main loop
Fix use of conditional LMB
sha1: Use const where possible, and unsigned for input len
sha256: Use const where possible and add watchdog function Add strcasecmp() and strncasecmp()
Add generic hash API
sha1sum: Use generic hash layer
Add hash command to perform hashing using various algorithms
console: Enable function to display console info
exynos: Enable hashing functions and EDID for smdk5250
x86: coreboot: Enable io command
Stefan Reinauer (1):
x86: Add coreboot version to u-boot's version command
Tom Wai-Hong Tam (3):
edid: Library of EDID decode and print
edid: Add I2C command for printing the EDID
fdt: edid: Enable fdt_add_edid() function when CONFIG_LCD defined
Vadim Bendebury (1):
Add console command to access io space registers
Vincent Palatin (1):
stdio: remove useless strncpy
README | 25 +++ arch/m68k/include/asm/string.h | 2 +- arch/powerpc/include/asm/string.h | 2 +- arch/sparc/include/asm/string.h | 2 +- common/Makefile | 6 + common/cmd_bootm.c | 2 +- common/cmd_gettime.c | 56 +++++++ common/cmd_hash.c | 63 ++++++++ common/cmd_i2c.c | 39 +++++ common/cmd_io.c | 93 +++++++++++ common/cmd_read.c | 81 ++++++++++ common/cmd_sha1sum.c | 129 +--------------- common/cmd_tpm.c | 93 +++++++++++- common/cmd_version.c | 7 +- common/console.c | 6 +- common/edid.c | 307 +++++++++++++++++++++++++++++++++++++ common/fdt_support.c | 2 +- common/hash.c | 221 ++++++++++++++++++++++++++ common/main.c | 2 + common/stdio.c | 1 - include/command.h | 8 +- include/config_cmd_all.h | 4 + include/configs/coreboot.h | 1 + include/configs/smdk5250.h | 7 + include/edid.h | 275 +++++++++++++++++++++++++++++++++ include/hash.h | 69 +++++++++ include/linux/string.h | 7 +- include/sha1.h | 26 +-- include/sha256.h | 8 +- lib/sha1.c | 19 ++- lib/sha256.c | 37 +++++- lib/string.c | 16 ++- 32 files changed, 1438 insertions(+), 178 deletions(-) create mode 100644 common/cmd_gettime.c create mode 100644 common/cmd_hash.c create mode 100644 common/cmd_io.c create mode 100644 common/cmd_read.c create mode 100644 common/edid.c create mode 100644 common/hash.c create mode 100644 include/edid.h create mode 100644 include/hash.h
Signature · 1 line
1.7.7.3
PATCH v3 1/20 Add new bootstage step for the main loop
Mark when we get to the main loop.
---
Changes in v3: None
Changes in v2:
- Remove arm: tag from bootstage step patch
common/main.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
common/main.c +2 -0
@@ -376,6 +376,8 @@ void main_loop (void)char bcs_set[16 ];#endif /* CONFIG_BOOTCOUNT_LIMIT */ +bootstage_mark_name (BOOTSTAGE_ID_MAIN_LOOP ,"main_loop" ); +#ifdef CONFIG_BOOTCOUNT_LIMIT bootcount =bootcount_load (); bootcount++;
Signature · 1 line
1.7.7.3
PATCH v3 2/20 Add gettime command
In reply to Simon GlassFrom: Anton Staaf <[email protected]>
Gettime returns the current timer value. If CONFIG_SYS_HZ is defined then the timer value is also converted to seconds.
Tegra20 (SeaBoard) # gettime
Timer val: 7754
Seconds : 7
Remainder : 754sys_hz = 1000
There has been some discussion about whether this is useful enough to be included in U-Boot. The following boards do not have CONFIG_SYS_HZ defined:
M52277EVBM52277EVB_stmicro
M53017EVB
M54418TWRM54418TWR_nand_miiM54418TWR_nand_rmiiM54418TWR_nand_rmii_lowfreqM54418TWR_serial_miiM54418TWR_serial_rmii
---
Changes in v3: None
Changes in v2:
- Convert space to tab in README
- Update gettime commit message to include boards without CONFIG_SYS_HZ
README | 1 + common/Makefile | 1 + common/cmd_gettime.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++ include/config_cmd_all.h | 1 + 4 files changed, 59 insertions(+), 0 deletions(-) create mode 100644 common/cmd_gettime.c
README +1 -0
@@ -819,6 +819,7 @@ The following options need to be configured: CONFIG_CMD_FDOS * Dos diskette Support CONFIG_CMD_FLASH flinfo, erase, protect CONFIG_CMD_FPGA FPGA device initialization support + CONFIG_CMD_GETTIME * Get time since boot CONFIG_CMD_GO * the 'go' command (exec code) CONFIG_CMD_GREPENV * search environment CONFIG_CMD_HWFLOW * RTS/CTS hw flow control
common/Makefile +1 -0
@@ -100,6 +100,7 @@ ifdef CONFIG_FPGA COBJS-$(CONFIG_CMD_FPGA) += cmd_fpga.o endif COBJS-$(CONFIG_CMD_FS_GENERIC) += cmd_fs.o +COBJS-$(CONFIG_CMD_GETTIME) += cmd_gettime.o COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o COBJS-$(CONFIG_CMD_IDE) += cmd_ide.o
common/cmd_gettime.c new file +56 -0
56 lines not on this page · raw message
include/config_cmd_all.h +1 -0
@@ -40,6 +40,7 @@#define CONFIG_CMD_FDOS /* Floppy DOS support */ #define CONFIG_CMD_FLASH /* flinfo, erase, protect */ #define CONFIG_CMD_FPGA /* FPGA configuration Support */ +#define CONFIG_CMD_GETTIME /* Get time since boot */ #define CONFIG_CMD_HWFLOW /* RTS/CTS hw flow control */ #define CONFIG_CMD_I2C /* I2C serial bus support */ #define CONFIG_CMD_IDE /* IDE harddisk support */
Signature · 1 line
1.7.7.3
PATCH v3 3/20 Add a command to read raw blocks from a partition
In reply to Simon GlassFrom: Kenneth Waters <[email protected]>
Sometimes data is on a block device and within a partition, but not in a particular filesystem.
This commands permits reading raw data from a partition.
---
Changes in v3: None
Changes in v2: None
README | 1 + common/Makefile | 1 + common/cmd_read.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++ include/config_cmd_all.h | 1 + 4 files changed, 84 insertions(+), 0 deletions(-) create mode 100644 common/cmd_read.c
README +1 -0
@@ -856,6 +856,7 @@ The following options need to be configured: CONFIG_CMD_PING * send ICMP ECHO_REQUEST to network host CONFIG_CMD_PORTIO * Port I/O + CONFIG_CMD_READ * Read raw data from partition CONFIG_CMD_REGINFO * Register dump CONFIG_CMD_RUN run command in env variable CONFIG_CMD_SAVES * save S record dump
common/Makefile +1 -0
@@ -142,6 +142,7 @@ endif COBJS-y += cmd_pcmcia.o COBJS-$(CONFIG_CMD_PORTIO) += cmd_portio.o COBJS-$(CONFIG_CMD_PXE) += cmd_pxe.o +COBJS-$(CONFIG_CMD_READ) += cmd_read.o COBJS-$(CONFIG_CMD_REGINFO) += cmd_reginfo.o COBJS-$(CONFIG_CMD_REISER) += cmd_reiser.o COBJS-$(CONFIG_CMD_SATA) += cmd_sata.o
common/cmd_read.c new file +81 -0
81 lines not on this page · raw message
include/config_cmd_all.h +1 -0
@@ -71,6 +71,7 @@#define CONFIG_CMD_REGINFO /* Register dump */ #define CONFIG_CMD_REISER /* Reiserfs support */ #define CONFIG_CMD_RARP /* rarpboot support */ +#define CONFIG_CMD_READ /* Read data from partition */ #define CONFIG_CMD_RUN /* run command in env variable */ #define CONFIG_CMD_SAVEENV /* saveenv */ #define CONFIG_CMD_SAVES /* save S record dump */
Signature · 1 line
1.7.7.3
PATCH v3 4/20 Fix use of conditional LMB
In reply to Simon GlassThis code was not guarded with CONFIG_LMB so failed to build on x86.
---
Changes in v3: None
Changes in v2: None
common/cmd_bootm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_bootm.c +1 -1
@@ -537,7 +537,7 @@ static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc, }break ;#endif -#if defined(CONFIG_OF_LIBFDT ) +#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_LMB )case BOOTM_STATE_FDT : { boot_fdt_add_mem_rsv_regions(&images.lmb,
Signature · 1 line
1.7.7.3
PATCH v3 5/20 stdio: remove useless strncpy
In reply to Simon GlassFrom: Vincent Palatin <[email protected]>
The name is already copied when we memcpy() the whole structure.
This is because struct stdio_dev has this field:
char name[16]; /* Device name */
So the data is inline, rather than being a pointer.
---
Changes in v3: None
Changes in v2:
- Add more comments to the stdio strncpy commit message
common/stdio.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
common/stdio.c +0 -1
@@ -135,7 +135,6 @@ struct stdio_dev* stdio_clone(struct stdio_dev *dev)return NULL ;memcpy (_dev, dev,sizeof (struct stdio_dev )); -strncpy (_dev->name, dev->name,16 );return _dev; }
Signature · 1 line
1.7.7.3
PATCH v3 6/20 sha1: Use const where possible, and unsigned for input len
In reply to Simon GlassIn preparation for making the hash function common, we may as well use const where we can. Also the input length cannot be negative, but may be very large, so use unsigned.
---
Changes in v3: None
Changes in v2:
- Add new patch to adjust sha1 functions to use const/unsigned
include/sha1.h | 26 +++++++++----------------- lib/sha1.c | 19 +++++++++++-------- 2 files changed, 20 insertions(+), 25 deletions(-)
include/sha1.h +9 -17
@@ -59,7 +59,8 @@ void sha1_starts( sha1_context *ctx );* \param input buffer holding the data * \param ilen length of the input data */ -void sha1_update (sha1_context *ctx,unsigned char *input,int ilen ); +void sha1_update (sha1_context *ctx,const unsigned char *input, +unsigned int ilen);/** * \brief SHA-1 final digest
@@ -76,8 +77,8 @@ void sha1_finish( sha1_context *ctx, unsigned char output[20] );* \param ilen length of the input data * \param output SHA-1 checksum result */ -void sha1_csum (unsigned char *input,int ilen, -unsigned char output[20 ] ); +void sha1_csum (const unsigned char *input,unsigned int ilen, +unsigned char *output);/** * \brief Output = SHA-1( input buffer ), with watchdog triggering
@@ -87,17 +88,8 @@ void sha1_csum( unsigned char *input, int ilen,* \param output SHA-1 checksum result * \param chunk_sz watchdog triggering period (in bytes of input processed) */ -void sha1_csum_wd (unsigned char *input,int ilen, -unsigned char output[20 ],unsigned int chunk_sz); - -/** -* \brief Output = SHA-1( file contents ) -* -* \param path input file name -* \param output SHA-1 checksum result -* \return 0 if successful, or 1 if fopen failed -*/ -int sha1_file (char *path,unsigned char output[20 ] ); +void sha1_csum_wd (const unsigned char *input,unsigned int ilen, +unsigned char *output,unsigned int chunk_sz);/** * \brief Output = HMAC-SHA-1( input buffer, hmac key )
@@ -108,9 +100,9 @@ int sha1_file( char *path, unsigned char output[20] );* \param ilen length of the input data * \param output HMAC-SHA-1 result */ -void sha1_hmac (unsigned char *key,int keylen, -unsigned char *input,int ilen, -unsigned char output[20 ] ); +void sha1_hmac (const unsigned char *key,int keylen, +const unsigned char *input,unsigned int ilen, +unsigned char *output);/** * \brief Checkup routine
lib/sha1.c +11 -8
@@ -73,7 +73,7 @@ void sha1_starts (sha1_context * ctx) ctx->state[4 ] =0xC3D2E1F0 ; } -static void sha1_process (sha1_context * ctx,unsigned char data[64 ]) +static void sha1_process (sha1_context *ctx,const unsigned char data[64 ]) {unsigned long temp,W [16 ],A ,B ,C ,D ,E ;
@@ -230,7 +230,8 @@ static void sha1_process (sha1_context * ctx, unsigned char data[64])/* * SHA-1 process buffer */ -void sha1_update (sha1_context * ctx,unsigned char *input,int ilen) +void sha1_update (sha1_context *ctx,const unsigned char *input, +unsigned int ilen) {int fill;unsigned long left;
@@ -305,7 +306,8 @@ void sha1_finish (sha1_context * ctx, unsigned char output[20])/* * Output = SHA-1( input buffer ) */ -void sha1_csum (unsigned char *input,int ilen,unsigned char output[20 ]) +void sha1_csum (const unsigned char *input,unsigned int ilen, +unsigned char *output) {sha1_context ctx;
@@ -318,12 +320,12 @@ void sha1_csum (unsigned char *input, int ilen, unsigned char output[20])* Output = SHA-1( input buffer ). Trigger the watchdog every 'chunk_sz' * bytes of input processed. */ -void sha1_csum_wd (unsigned char *input,int ilen,unsigned char output[20 ], -unsigned int chunk_sz) +void sha1_csum_wd (const unsigned char *input,unsigned int ilen, +unsigned char *output,unsigned int chunk_sz) {sha1_context ctx;#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) -unsigned char *end, *curr; +const unsigned char *end, *curr;int chunk;#endif
@@ -350,8 +352,9 @@ void sha1_csum_wd (unsigned char *input, int ilen, unsigned char output[20],/* * Output = HMAC-SHA-1( input buffer, hmac key ) */ -void sha1_hmac (unsigned char *key,int keylen, -unsigned char *input,int ilen,unsigned char output[20 ]) +void sha1_hmac (const unsigned char *key,int keylen, +const unsigned char *input,unsigned int ilen, +unsigned char *output) {int i;sha1_context ctx;
Signature · 1 line
1.7.7.3
PATCH v3 7/20 sha256: Use const where possible and add watchdog function
In reply to Simon GlassIn preparation for making the hash function common, we may as well use const where we can.
Also add a watchdog version of the hashing function.
---
Changes in v3: None
Changes in v2:
- Add new patch to adjust sha256 functions to const and watchdog
include/sha256.h | 8 +++++++- lib/sha256.c | 37 +++++++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-)
include/sha256.h +7 -1
@@ -3,6 +3,9 @@#define SHA256_SUM_LEN 32 +/* Reset watchdog each time we process this many bytes */ +#define CHUNKSZ_SHA256 (64 * 1024) + typedef struct { uint32_t total[2]; uint32_t state[8];
@@ -10,7 +13,10 @@ typedef struct { } sha256_context;void sha256_starts (sha256_context * ctx); -void sha256_update (sha256_context * ctx,uint8_t * input,uint32_t length); +void sha256_update (sha256_context *ctx,const uint8_t *input,uint32_t length);void sha256_finish (sha256_context * ctx,uint8_t digest[SHA256_SUM_LEN ]); +void sha256_csum_wd (const unsigned char *input,unsigned int ilen, +unsigned char *output,unsigned int chunk_sz); +#endif /* _SHA256_H */
lib/sha256.c +35 -2
@@ -60,7 +60,7 @@ void sha256_starts(sha256_context * ctx) ctx->state[7 ] =0x5BE0CD19 ; } -void sha256_process (sha256_context * ctx,uint8_t data[64 ]) +static void sha256_process (sha256_context *ctx,const uint8_t data[64 ]) {uint32_t temp1, temp2;uint32_t W [64 ];
@@ -191,7 +191,7 @@ void sha256_process(sha256_context * ctx, uint8_t data[64]) ctx->state[7 ] +=H ; } -void sha256_update (sha256_context * ctx,uint8_t * input,uint32_t length) +void sha256_update (sha256_context *ctx,const uint8_t *input,uint32_t length) {uint32_t left, fill;
@@ -260,3 +260,36 @@ void sha256_finish(sha256_context * ctx, uint8_t digest[32])PUT_UINT32_BE (ctx->state[6 ], digest,24 );PUT_UINT32_BE (ctx->state[7 ], digest,28 ); } + +/* +* Output = SHA-256( input buffer ). Trigger the watchdog every 'chunk_sz' +* bytes of input processed. +*/ +void sha256_csum_wd (const unsigned char *input,unsigned int ilen, +unsigned char *output,unsigned int chunk_sz) +{ +sha256_context ctx; +#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) +unsigned char *end, *curr; +int chunk; +#endif + +sha256_starts (&ctx); + +#if defined(CONFIG_HW_WATCHDOG ) || defined(CONFIG_WATCHDOG ) + curr = input; + end = input + ilen; +while (curr < end) { + chunk = end - curr; +if (chunk > chunk_sz) + chunk = chunk_sz; +sha256_update (&ctx, curr, chunk); + curr += chunk; +WATCHDOG_RESET (); + } +#else +sha256_update (&ctx, input, ilen); +#endif + +sha256_finish (&ctx, output); +}
Signature · 1 line
1.7.7.3
PATCH v3 8/20 Add strcasecmp() and strncasecmp()
In reply to Simon Glassstrncasecmp() is present as strnicmp() but disabled. Make it available and define strcasecmp() also. There is a only a small performance penalty to having strcasecmp() call strncasecmp(), so do this instead of a standalone function, to save code space.
Update the prototype in arch-specific headers as needed to avoid warnings.
---
Changes in v3:
- Rename stricmp() to strcasecmp() to match Linux / POSIX
- Bracket strcasecmp() declarations with __HAVE_ARCH_...
Changes in v2:
- Add stricmp() patch again since it is used in this series
arch/m68k/include/asm/string.h | 2 +- arch/powerpc/include/asm/string.h | 2 +- arch/sparc/include/asm/string.h | 2 +- include/linux/string.h | 7 +++++-- lib/string.c | 16 ++++++++++++---- 5 files changed, 20 insertions(+), 9 deletions(-)
arch/m68k/include/asm/string.h +1 -1
@@ -16,7 +16,7 @@#endif extern int strcasecmp (const char *,const char *); -extern int strncasecmp (const char *,const char *,int ); +extern int strncasecmp (const char *,const char *,__kernel_size_t );extern char *strcpy (char *,const char *);extern char *strncpy (char *,const char *,__kernel_size_t );extern __kernel_size_t strlen (const char *);
arch/powerpc/include/asm/string.h +1 -1
@@ -14,7 +14,7 @@#define __HAVE_ARCH_MEMCHRextern int strcasecmp (const char *,const char *); -extern int strncasecmp (const char *,const char *,int ); +extern int strncasecmp (const char *,const char *,__kernel_size_t );extern char *strcpy (char *,const char *);extern char *strncpy (char *,const char *,__kernel_size_t );extern __kernel_size_t strlen (const char *);
arch/sparc/include/asm/string.h +1 -1
@@ -40,7 +40,7 @@*/ extern int strcasecmp (const char *,const char *); -extern int strncasecmp (const char *,const char *,int ); +extern int strncasecmp (const char *,const char *,__kernel_size_t );extern char *strcpy (char *,const char *);extern char *strncpy (char *,const char *,__kernel_size_t );extern __kernel_size_t strlen (const char *);
include/linux/string.h +5 -2
@@ -38,8 +38,11 @@ extern int strcmp(const char *,const char *);#ifndef __HAVE_ARCH_STRNCMPextern int strncmp (const char *,const char *,__kernel_size_t );#endif -#if 0 /* not used - was: #ifndef __HAVE_ARCH_STRNICMP */ -extern int strnicmp (const char *,const char *,__kernel_size_t ); +#ifndef __HAVE_ARCH_STRCASECMP +int strcasecmp (const char *s1,const char *s2); +#endif +#ifndef __HAVE_ARCH_STRNCASECMP +extern int strncasecmp (const char *s1,const char *s2,__kernel_size_t len);#endif #ifndef __HAVE_ARCH_STRCHRextern char *strchr (const char *,int );
lib/string.c +12 -4
@@ -21,14 +21,13 @@#include <malloc.h> -#if 0 /* not used - was: #ifndef __HAVE_ARCH_STRNICMP */ /** -* strnicmp - Case insensitive, length-limited string comparison +* strncasecmp - Case insensitive, length-limited string comparison * @s1: One string * @s2: The other string * @len: the maximum number of characters to compare */ -int strnicmp (const char *s1,const char *s2,size_t len) +int strncasecmp (const char *s1,const char *s2,size_t len) {/* Yes, Virginia, it had better be unsigned */ unsigned char c1, c2;
@@ -52,7 +51,16 @@ int strnicmp(const char *s1, const char *s2, size_t len) }return (int )c1 - (int )c2; } -#endif + +/** +* strcasecmp - Case insensitive string comparison +* @s1: One string +* @s2: The other string +*/ +int strcasecmp (const char *s1,const char *s2) +{ +return strncasecmp (s1, s2,-1U ); +}char * ___strtok;
Signature · 1 line
1.7.7.3
PATCH v3 9/20 Add generic hash API
In reply to Simon GlassWe have a SHA1 command and want to add a SHA256 command also. Instead of duplicating the code, create a generic hash API which can process commands for different algorithms.
---
Changes in v3:
- Rename stricmp() to strcasecmp() to match Linux / POSIX
- Correct hash error message to show the algorithm name, not always SHA1
- Fix ordering of hash.o in Makefile
Changes in v2:
- Add generic hash API to allow SHA256 command to be added without duplication
common/Makefile | 1 + common/hash.c | 221 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/hash.h | 69 +++++++++++++++++ 3 files changed, 291 insertions(+), 0 deletions(-) create mode 100644 common/hash.c create mode 100644 include/hash.h
common/Makefile +1 -0
@@ -30,6 +30,7 @@ ifndef CONFIG_SPL_BUILD COBJS-y += main.o COBJS-y += command.o COBJS-y += exports.o +COBJS-y += hash.o COBJS-$(CONFIG_SYS_HUSH_PARSER) += hush.o COBJS-y += s_record.o COBJS-y += xyzModem.o
common/hash.c new file +221 -0
221 lines not on this page · raw message
include/hash.h new file +69 -0
69 lines not on this page · raw message
Signature · 1 line
1.7.7.3
PATCH v3 10/20 sha1sum: Use generic hash layer
In reply to Simon GlassUpdate the code to use the hash layer instead of local code.
---
Changes in v3: None
Changes in v2:
- Add new patch to change sha1sum to use generic hash API
common/cmd_sha1sum.c | 129 ++------------------------------------------------ 1 files changed, 4 insertions(+), 125 deletions(-)
common/cmd_sha1sum.c +4 -125
@@ -26,73 +26,11 @@#include <common.h> #include <command.h> +#include <hash.h> #include <sha1.h> -/* -* Store the resulting sum to an address or variable -*/ -static void store_result (const u8 *sum,const char *dest) -{ -unsigned int i; - -if (*dest =='*' ) { -u8 *ptr; - - ptr = (u8 *)simple_strtoul (dest +1 ,NULL ,16 ); -for (i =0 ; i <20 ; i++) - *ptr++ = sum[i]; - }else { -char str_output[41 ]; -char *str_ptr = str_output; - -for (i =0 ; i <20 ; i++) { -sprintf (str_ptr,"%02x" , sum[i]); - str_ptr +=2 ; - } - str_ptr ='\0' ; -setenv (dest, str_output); - } -} - -#ifdef CONFIG_SHA1SUM_VERIFY -static int parse_verify_sum (char *verify_str,u8 *vsum) -{ -if (*verify_str =='*' ) { -u8 *ptr; - - ptr = (u8 *)simple_strtoul (verify_str +1 ,NULL ,16 ); -memcpy (vsum, ptr,20 ); - }else { -unsigned int i; -char *vsum_str; - -if (strlen (verify_str) ==40 ) - vsum_str = verify_str; -else { - vsum_str =getenv (verify_str); -if (vsum_str ==NULL ||strlen (vsum_str) !=40 ) -return 1 ; - } - -for (i =0 ; i <20 ; i++) { -char *nullp = vsum_str + (i +1 ) *2 ; -char end = *nullp; - - *nullp ='\0' ; - *(u8 *)(vsum + i) = -simple_strtoul (vsum_str + (i *2 ),NULL ,16 ); - *nullp = end; - } - } -return 0 ; -} -int do_sha1sum (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { -ulong addr, len; -unsigned int i; -u8 output[20 ]; -u8 vsum[20 ];int verify =0 ;int ac;char *const *av;
@@ -102,75 +40,16 @@ int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) av = argv +1 ; ac = argc -1 ; +#ifdef CONFIG_SHA1SUM_VERIFY if (strcmp (*av,"-v" ) ==0 ) { verify =1 ; av++; ac--; -if (ac <3 ) -return CMD_RET_USAGE ; } +#endif - addr =simple_strtoul (*av++,NULL ,16 ); - len =simple_strtoul (*av++,NULL ,16 ); - -sha1_csum_wd ((unsigned char *) addr, len, output,CHUNKSZ_SHA1 ); - -if (!verify) { -printf ("SHA1 for %08lx ... %08lx ==> " , addr, addr + len -1 ); -for (i =0 ; i <20 ; i++) -printf ("%02x" , output[i]); -printf ("\n" ); - -if (ac >2 ) -store_result (output, *av); - }else { -char *verify_str = *av++; - -if (parse_verify_sum (verify_str, vsum)) { -printf ("ERROR: %s does not contain a valid SHA1 sum\n" , - verify_str); -return 1 ; - } -if (memcmp (output, vsum,20 ) !=0 ) { -printf ("SHA1 for %08lx ... %08lx ==> " , addr, - addr + len -1 ); -for (i =0 ; i <20 ; i++) -printf ("%02x" , output[i]); -printf (" != " ); -for (i =0 ; i <20 ; i++) -printf ("%02x" , vsum[i]); -printf (" ** ERROR **\n" ); -return 1 ; - } - } - -return 0 ; -} -#else -static int do_sha1sum (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) -{ -unsigned long addr, len; -unsigned int i; -u8 output[20 ]; - -if (argc <3 ) -return CMD_RET_USAGE ; - - addr =simple_strtoul (argv[1 ],NULL ,16 ); - len =simple_strtoul (argv[2 ],NULL ,16 ); - -sha1_csum_wd ((unsigned char *) addr, len, output,CHUNKSZ_SHA1 ); -printf ("SHA1 for %08lx ... %08lx ==> " , addr, addr + len -1 ); -for (i =0 ; i <20 ; i++) -printf ("%02x" , output[i]); -printf ("\n" ); - -if (argc >3 ) -store_result (output, argv[3 ]); - -return 0 ; +return hash_command ("sha1" , verify, cmdtp, flag, ac, av); } -#endif #ifdef CONFIG_SHA1SUM_VERIFY U_BOOT_CMD(
Signature · 1 line
1.7.7.3
PATCH v3 11/20 Add hash command to perform hashing using various algorithms
In reply to Simon GlassThis new command supports hashing SHA1 and SHA256. It could be extended to others such as MD5 and the CRC algorithms. The syntax is modeled on those:
hash <algorithm> <address> <length> [*<dest_addr> | <dest_envvar>]
to calculate a hash, and:
hash -v <algorithm> <address> <length> [*<verify_addr> | <verify_envvar>]
to verify a hash.
Use CONFIG_CMD_HASH to enable the command, CONFIG_SHA1 to enable SHA1 and CONFIG_SHA256 to enable SHA256.
The existing sha1sum command remains.
---
Changes in v3:
- Correct hash command help to say 'hash' instead of 'sha1sum'
Changes in v2:
- Add new hash command to support generic hash API
README | 18 +++++++++++++ common/Makefile | 1 + common/cmd_hash.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++ include/config_cmd_all.h | 1 + 4 files changed, 83 insertions(+), 0 deletions(-) create mode 100644 common/cmd_hash.c
README +18 -0
@@ -822,6 +822,7 @@ The following options need to be configured: CONFIG_CMD_GETTIME * Get time since boot CONFIG_CMD_GO * the 'go' command (exec code) CONFIG_CMD_GREPENV * search environment + CONFIG_CMD_HASH * calculate hash / digest CONFIG_CMD_HWFLOW * RTS/CTS hw flow control CONFIG_CMD_I2C * I2C serial bus support CONFIG_CMD_IDE * IDE harddisk support
@@ -2391,6 +2392,23 @@ CBFS (Coreboot Filesystem) support A better solution is to properly configure the firewall, but sometimes that is not allowed. +- Hashing support: + CONFIG_CMD_HASH + + This enables a generic 'hash' command which can produce + hashes / digests from a few algorithms (e.g. SHA1, SHA256). + + CONFIG_HASH_VERIFY + + Enable the hash verify command (hash -v). This adds to code + size a little. + + CONFIG_SHA1 - support SHA1 hashing + CONFIG_SHA256 - support SHA256 hashing + + Note: There is also a sha1sum command, which should perhaps + be deprecated in favour of 'hash sha1'. + - Show boot progress: CONFIG_SHOW_BOOT_PROGRESS
common/Makefile +1 -0
@@ -104,6 +104,7 @@ COBJS-$(CONFIG_CMD_FS_GENERIC) += cmd_fs.o COBJS-$(CONFIG_CMD_GETTIME) += cmd_gettime.o COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o COBJS-$(CONFIG_CMD_I2C) += cmd_i2c.o +COBJS-$(CONFIG_CMD_HASH) += cmd_hash.o COBJS-$(CONFIG_CMD_IDE) += cmd_ide.o COBJS-$(CONFIG_CMD_IMMAP) += cmd_immap.o COBJS-$(CONFIG_CMD_INI) += cmd_ini.o
common/cmd_hash.c new file +63 -0
63 lines not on this page · raw message
include/config_cmd_all.h +1 -0
@@ -41,6 +41,7 @@#define CONFIG_CMD_FLASH /* flinfo, erase, protect */ #define CONFIG_CMD_FPGA /* FPGA configuration Support */ #define CONFIG_CMD_GETTIME /* Get time since boot */ +#define CONFIG_CMD_HASH /* calculate hash / digest */ #define CONFIG_CMD_HWFLOW /* RTS/CTS hw flow control */ #define CONFIG_CMD_I2C /* I2C serial bus support */ #define CONFIG_CMD_IDE /* IDE harddisk support */
Signature · 1 line
1.7.7.3
PATCH v3 12/20 edid: Library of EDID decode and print
In reply to Simon GlassFrom: Tom Wai-Hong Tam <[email protected]>
This implements a library for accessing EDID data from an LCD panel. This is used to obtain information about the panel such as its resolution and type.
This is a tidied-up version of the original code pulled from
https://github.com/ynezz/u-boot-edid.
The changes we made are:
- removed bit fields in the struct;
- removed endianness cases in the struct;
- fixed some wrong definitions;
- fixed to fit 80 columns;
- fixed some code styles.
---
Changes in v3: None
Changes in v2: None
common/Makefile | 1 + common/edid.c | 307 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/edid.h | 275 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 583 insertions(+), 0 deletions(-) create mode 100644 common/edid.c create mode 100644 include/edid.h
common/Makefile +1 -0
@@ -188,6 +188,7 @@ COBJS-$(CONFIG_BOOTSTAGE) += bootstage.o COBJS-$(CONFIG_CONSOLE_MUX) += iomux.o COBJS-y += flash.o COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o +COBJS-$(CONFIG_I2C_EDID) += edid.o COBJS-$(CONFIG_KALLSYMS) += kallsyms.o COBJS-$(CONFIG_LCD) += lcd.o COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o
common/edid.c new file +307 -0
307 lines not on this page · raw message
include/edid.h new file +275 -0
275 lines not on this page · raw message
Signature · 1 line
1.7.7.3
PATCH v3 13/20 edid: Add I2C command for printing the EDID
In reply to Simon GlassFrom: Tom Wai-Hong Tam <[email protected]>
Add a single command to read the EDID information over I2C.
For example:
SMDK5250 # i2c dev 7
Setting bus to 7
SMDK5250 # i2c edid 50
EDID version: 1.4
Product ID code: 305c
Manufacturer: AUO
Serial number: 00000000
Manufactured in week: 0 year: 2011
Video input definition: digital signal, voltage level 0, blank to black Monitor is non-RGB
Maximum visible display size: 26 cm x 14 cm
Power management features: no active off, no suspend, no standby Estabilished timings:
Standard timings:
1366x768 60 Hz (detailed)
1366x768 60 Hz (detailed)Monitor ID: 2VD2K.B116XW
---
Changes in v3: None
Changes in v2: None
README | 5 +++++ common/cmd_i2c.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 0 deletions(-)
README +5 -0
@@ -1476,6 +1476,11 @@ CBFS (Coreboot Filesystem) support Support drawing of RLE8-compressed bitmaps on the LCD. + CONFIG_I2C_EDID + + Enables an 'i2c edid' command which can read EDID + information over I2C from an attached LCD display. + - Splash Screen Support: CONFIG_SPLASH_SCREEN
common/cmd_i2c.c +39 -0
@@ -78,6 +78,7 @@#include <common.h> #include <command.h> +#include <edid.h> #include <environment.h> #include <i2c.h> #include <malloc.h>
@@ -1246,6 +1247,38 @@ static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) }#endif +/* +* Syntax: +* i2c edid {i2c_chip} +*/ +#if defined(CONFIG_I2C_EDID ) +int do_edid (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +u_char chip; +struct edid1_info edid; + +if (argc <2 ) { +cmd_usage (cmdtp); +return 1 ; + } + + chip =simple_strtoul (argv[1 ],NULL ,16 ); +if (i2c_read (chip,0 ,1 , (uchar *)&edid,sizeof (edid)) !=0 ) { +puts ("Error reading EDID content.\n" ); +return 1 ; + } + +if (edid_check_info (&edid)) { +puts ("Content isn't valid EDID.\n" ); +return 1 ; + } + +edid_print_info (&edid); +return 0 ; + +} +#endif /* CONFIG_I2C_EDID */ +#if defined(CONFIG_I2C_MUX )static int do_i2c_add_bus (cmd_tbl_t * cmdtp,int flag,int argc,char *const argv[]) {
@@ -1335,6 +1368,9 @@ static cmd_tbl_t cmd_i2c_sub[] = {#if defined(CONFIG_I2C_MULTI_BUS ) U_BOOT_CMD_MKENT(dev, 1, 1, do_i2c_bus_num, "", ""),#endif /* CONFIG_I2C_MULTI_BUS */ +#if defined(CONFIG_I2C_EDID ) +U_BOOT_CMD_MKENT (edid,1 ,1 , do_edid,"" ,"" ), +#endif /* CONFIG_I2C_EDID */U_BOOT_CMD_MKENT (loop,3 ,1 , do_i2c_loop,"" ,"" ),U_BOOT_CMD_MKENT (md,3 ,1 , do_i2c_md,"" ,"" ), U_BOOT_CMD_MKENT(mm, 2, 1, do_i2c_mm, "", ""),
@@ -1385,6 +1421,9 @@ static char i2c_help_text[] =#if defined(CONFIG_I2C_MULTI_BUS ) "i2c dev [dev] - show or set current I2C bus\n"#endif /* CONFIG_I2C_MULTI_BUS */ +#if defined(CONFIG_I2C_EDID ) + "i2c edid chip - print EDID configuration information\n" +#endif /* CONFIG_I2C_EDID */ "i2c loop chip address[.0, .1, .2] [# of objects] - looping read of device\n" "i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device\n" "i2c mm chip address[.0, .1, .2] - write to I2C device (auto-incrementing)\n"
Signature · 1 line
1.7.7.3
PATCH v3 14/20 fdt: edid: Enable fdt_add_edid() function when CONFIG_LCD defined
In reply to Simon GlassFrom: Tom Wai-Hong Tam <[email protected]>
This function can be used for LCDs as well as monitors.
---
Changes in v3: None
Changes in v2: None
common/fdt_support.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
common/fdt_support.c +1 -1
@@ -1315,7 +1315,7 @@ int fdt_set_status_by_alias(void *fdt, const char* alias,return fdt_set_node_status (fdt, offset, status, error_code); } -#if defined(CONFIG_VIDEO ) +#if defined(CONFIG_VIDEO ) || defined(CONFIG_LCD )int fdt_add_edid (void *blob,const char *compat,unsigned char *edid_buf) {int noff;
Signature · 1 line
1.7.7.3
PATCH v3 15/20 Add console command to access io space registers
In reply to Simon GlassFrom: Vadim Bendebury <[email protected]>
Provide u-boot console functions to access IO space registers. A no thrills implementation, accessing one register at a time.
For example:
boot > iod 80
0080: 00000094
boot > iod.w 80
0080: 0094
boot > iod.b 80
0080: 94
boot > iow.b 0x80 12
boot > iod 0x80
0080: 00000012---
Changes in v3: None
Changes in v2: None
common/Makefile | 1 + common/cmd_io.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++ include/command.h | 8 ++-- include/config_cmd_all.h | 1 + 4 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 common/cmd_io.c
common/Makefile +1 -0
@@ -120,6 +120,7 @@ COBJS-$(CONFIG_LOGBUFFER) += cmd_log.o COBJS-$(CONFIG_ID_EEPROM) += cmd_mac.o COBJS-$(CONFIG_CMD_MD5SUM) += cmd_md5sum.o COBJS-$(CONFIG_CMD_MEMORY) += cmd_mem.o +COBJS-$(CONFIG_CMD_IO) += cmd_io.o COBJS-$(CONFIG_CMD_MFSL) += cmd_mfsl.o COBJS-$(CONFIG_MII) += miiphyutil.o COBJS-$(CONFIG_CMD_MII) += miiphyutil.o
common/cmd_io.c new file +93 -0
93 lines not on this page · raw message
include/command.h +4 -4
@@ -89,10 +89,10 @@ extern int cmd_auto_complete(const char *const prompt, char *buf, int *np, int **/ #if defined(CONFIG_CMD_MEMORY ) \ - || defined(CONFIG_CMD_I2C ) \ - || defined(CONFIG_CMD_ITEST ) \ - || defined(CONFIG_CMD_PCI ) \ - || defined(CONFIG_CMD_PORTIO ) + || defined(CONFIG_CMD_I2C ) \ + || defined(CONFIG_CMD_ITEST ) \ + || defined(CONFIG_CMD_PCI ) \ + || defined(CONFIG_CMD_PORTIO )#define CMD_DATA_SIZE extern int cmd_get_data_size (char * arg,int default_size);#endif
include/config_cmd_all.h +1 -0
@@ -48,6 +48,7 @@#define CONFIG_CMD_IMI /* iminfo */ #define CONFIG_CMD_IMLS /* List all found images */ #define CONFIG_CMD_IMMAP /* IMMR dump support */ +#define CONFIG_CMD_IO /* Access to X86 IO space */ #define CONFIG_CMD_IRQ /* irqinfo */ #define CONFIG_CMD_ITEST /* Integer (and string) test */ #define CONFIG_CMD_JFFS2 /* JFFS2 Support */
Signature · 1 line
1.7.7.3
PATCH v3 15/20 Add console command to access io space registers
Quoted 6 lines · Simon Glass
From: Vadim Bendebury <[email protected]>
Provide u-boot console functions to access IO space registers. A no thrills implementation, accessing one register at a time.
For example:
Quoted 9 lines
boot > iod 80
0080: 00000094
boot > iod.w 80
0080: 0094
boot > iod.b 80
0080: 94
boot > iow.b 0x80 12
boot > iod 0x80
0080: 00000012Doesn't md/mw accomplish the same?
Regards,
Fabio Estevam
PATCH v3 15/20 Add console command to access io space registers
Quoted 17 lines · Fabio Estevam
Quoted 6 lines · Simon Glass
From: Vadim Bendebury <[email protected]>
Provide u-boot console functions to access IO space registers. A no thrills implementation, accessing one register at a time.
For example:
Quoted 9 lines
boot > iod 80 0080: 00000094 boot > iod.w 80 0080: 0094 boot > iod.b 80 0080: 94 boot > iow.b 0x80 12 boot > iod 0x80 0080: 00000012
Quoted 2 lines
Doesn't md/mw accomplish the same?
No - md/mw access memory, the new commands access the IO space (which is an x86 architecture property).
cheers,
/vb
Quoted 3 lines
Regards,
Fabio Estevam
PATCH v3 15/20 Add console command to access io space registers
Quoted 2 lines · Vadim Bendebury
No - md/mw access memory, the new commands access the IO space (which is an x86 architecture property).
Ok, understood. On ARM we are able to access registers via md/mw.
Maybe it would be better to put a note in the commit message that this is x86 specific.
Regards,
Fabio Estevam
PATCH v3 15/20 Add console command to access io space registers
Hi Fabio,
Quoted 9 lines · Fabio Estevam
Quoted 2 lines · Vadim Bendebury
No - md/mw access memory, the new commands access the IO space (which is an x86 architecture property).
Ok, understood. On ARM we are able to access registers via md/mw.
Maybe it would be better to put a note in the commit message that this is x86 specific.
Yes I put it an x86: tag on it for the next version. I have not added any x86 note in the README - in fact this is sadly missing a README comment.
Regards,
Simon
Quoted 4 lines
Regards,
Fabio Estevam
PATCH v3 15/20 Add console command to access io space registers
Quoted 8 lines · Simon Glass
Hi Fabio,
Quoted 5 lines · Fabio Estevam
Quoted 2 lines · Vadim Bendebury
No - md/mw access memory, the new commands access the IO space (which is an x86 architecture property).
Quoted 8 lines
Quoted 4 lines
Ok, understood. On ARM we are able to access registers via md/mw.
Maybe it would be better to put a note in the commit message that this is x86 specific.
Yes I put it an x86: tag on it for the next version. I have not added any x86 note in the README - in fact this is sadly missing a README comment.
Please address adding to the README in another patch, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121212/96a9a143/attachment.pgp>
PATCH v3 16/20 console: Enable function to display console info
In reply to Simon GlassThe CONFIG_SYS_CONSOLE_INFO_QUIET option should suppress the console information, but allow boards to display it later if required. Adjust the code to support this.
This is used to avoid printing the information while the LCD display is not ready, since it only becomes ready when stdio init is complete.
---
Changes in v3: None
Changes in v2: None
common/console.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
common/console.c +4 -2
@@ -591,7 +591,6 @@ int console_init_f(void)void stdio_print_current_devices (void ) { -#ifndef CONFIG_SYS_CONSOLE_INFO_QUIET /* Print information */ puts ("In: " );if (stdio_devices[stdin] ==NULL ) {
@@ -613,7 +612,6 @@ void stdio_print_current_devices(void) }else {printf ("%s\n" , stdio_devices[stderr]->name); } -#endif /* CONFIG_SYS_CONSOLE_INFO_QUIET */ }#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
@@ -685,7 +683,9 @@ done: gd->flags |=GD_FLG_DEVINIT ;/* device initialization completed */ +#ifndef CONFIG_SYS_CONSOLE_INFO_QUIET stdio_print_current_devices (); +#endif /* CONFIG_SYS_CONSOLE_INFO_QUIET */ #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE /* set the environment variables (will overwrite previous env settings) */
@@ -760,7 +760,9 @@ int console_init_r(void) gd->flags |=GD_FLG_DEVINIT ;/* device initialization completed */ +#ifndef CONFIG_SYS_CONSOLE_INFO_QUIET stdio_print_current_devices (); +#endif /* CONFIG_SYS_CONSOLE_INFO_QUIET */ /* Setting environment variables */ for (i =0 ; i <3 ; i++) {
Signature · 1 line
1.7.7.3
PATCH v3 17/20 tpm: Add TPM stress test
In reply to Simon GlassFrom: Luigi Semenzato <[email protected]>
Add a simple command to stress-test a TPM (Trusted Platform Module).
---
Changes in v3:
- Drop meminfo from this series
- Drop patch 'Update time command to avoid using get_timer_masked()'
Changes in v2: None
common/cmd_tpm.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 87 insertions(+), 6 deletions(-)
common/cmd_tpm.c +87 -6
@@ -63,19 +63,68 @@ static int tpm_process(int argc, char * const argv[], cmd_tbl_t *cmdtp)return rv; } -static int do_tpm (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +#define CHECK (exp) do { \ + int _rv = exp; \ + if (_rv) { \ + printf("CHECK: %s %d %x\n", #exp, __LINE__, _rv);\ + } \ + } while (0) + +static int tpm_process_stress (int repeat_count) { +int i;int rv =0 ; +u8 request[] = {0x0 ,0xc1 , +0x0 ,0x0 ,0x0 ,0x16 , +0x0 ,0x0 ,0x0 ,0x65 , +0x0 ,0x0 ,0x0 ,0x4 , +0x0 ,0x0 ,0x0 ,0x4 , +0x0 ,0x0 ,0x1 ,0x9 }; +u8 response[MAX_TRANSACTION_SIZE ]; +u32 rlength =MAX_TRANSACTION_SIZE ; + +CHECK (tis_init ()); + +for (i =0 ; i < repeat_count; i++) { +CHECK (tis_open ()); + rv =tis_sendrecv (request,sizeof (request), response, &rlength); +if (rv) { +printf ("tpm test failed at step %d with 0x%x\n" , i, rv); +CHECK (tis_close ()); +break ; + } +CHECK (tis_close ()); +if ((response[6 ] || response[7 ] || response[8 ] || response[9 ]) + && response[9 ] !=0x26 ) { +/* Ignore postinit errors */ +printf ("tpm command failed at step %d\n" +"tpm error code: %02x%02x%02x%02x\n" , i, + response[6 ], response[7 ], + response[8 ], response[9 ]); + rv =-1 ; +break ; + } + } +return rv; +} -/* -* Verify that in case it is present, the first argument, it is -* exactly one character in size. -*/ -if (argc <7 ) { + +static int do_tpm_many (cmd_tbl_t *cmdtp,int flag, +int argc,char *const argv[],int repeat_count) + +{ +int rv =0 ; + +if (argc <7 && repeat_count ==0 ) {puts ("command should be@least six bytes in size\n" );return -1 ; } +if (repeat_count >0 ) { + rv =tpm_process_stress (repeat_count); +return rv; + } +if (tis_init ()) {puts ("tis_init() failed!\n" );return -1 ;
@@ -96,8 +145,40 @@ static int do_tpm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])return rv; } + +static int do_tpm (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +return do_tpm_many (cmdtp, flag, argc, argv,0 ); +} + +U_BOOT_CMD (tpm,MAX_TRANSACTION_SIZE ,1 , do_tpm,"<byte> [<byte> ...] - write data and read response" ,"send arbitrary data (at least 6 bytes) to the TPM " "device and read the response" ); + +static int do_tpm_stress (cmd_tbl_t *cmdtp,int flag, +int argc,char *const argv[]) +{ +long unsigned int n; +int rv; + +if (argc !=2 ) { +puts ("usage: tpm_stress <count>\n" ); +return -1 ; + } + + rv =strict_strtoul (argv[1 ],10 , &n); +if (rv) { +puts ("tpm_stress: bad count" ); +return -1 ; + } + +return do_tpm_many (cmdtp, flag, argc, argv, n); +} + +U_BOOT_CMD (tpm_stress,2 ,1 , do_tpm_stress, +"<n> - stress-test communication with TPM" , +"Repeat a TPM transaction (request-response) N times" +);
Signature · 1 line
1.7.7.3
PATCH v3 18/20 exynos: Enable hashing functions and EDID for smdk5250
In reply to Simon GlassEnable SHA1/SHA256 hashing and the hash command. Also enable EDID support for reading from an LCD.
---
Changes in v3: None
Changes in v2:
- Add patch to enable hashing and EDID on smdk5250
include/configs/smdk5250.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
include/configs/smdk5250.h +7 -0
@@ -203,6 +203,7 @@#define CONFIG_I2C_MULTI_BUS #define CONFIG_MAX_I2C_NUM 8#define CONFIG_SYS_I2C_SLAVE 0x0 +#define CONFIG_I2C_EDID /* Ethernet Controllor Driver */ #ifdef CONFIG_CMD_NET
@@ -215,4 +216,10 @@/* Enable devicetree support */ #define CONFIG_OF_LIBFDT +/* SHA hashing */ +#define CONFIG_CMD_HASH +#define CONFIG_HASH_VERIFY +#define CONFIG_SHA1 +#define CONFIG_SHA256 +#endif /* __CONFIG_H */
Signature · 1 line
1.7.7.3
PATCH v3 19/20 x86: coreboot: Enable io command
In reply to Simon GlassEnable the io command for x86 on coreboot.
---
Changes in v3: None
Changes in v2:
- Add x86 patch to enable io command for coreboot
include/configs/coreboot.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/coreboot.h +1 -0
@@ -152,6 +152,7 @@#define CONFIG_CMD_FPGA #define CONFIG_CMD_IMI #undef CONFIG_CMD_IMLS +#define CONFIG_CMD_IO #define CONFIG_CMD_IRQ #define CONFIG_CMD_ITEST #define CONFIG_CMD_LOADB
Signature · 1 line
1.7.7.3
PATCH v3 20/20 x86: Add coreboot version to u-boot's version command
In reply to Simon GlassFrom: Stefan Reinauer <[email protected]>
Since U-Boot runs from coreboot on x86, the Coreboot version is an important part of the boot state. This version information is available in the coreboot tables, so print it when the 'version' command is used.
---
Changes in v3: None
Changes in v2:
- Add x86 tag to version command patch
common/cmd_version.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
common/cmd_version.c +6 -1
@@ -25,6 +25,9 @@#include <command.h> #include <version.h> #include <linux/compiler.h> +#ifdef CONFIG_SYS_COREBOOT +#include <asm/arch/sysinfo.h> +#endif const char __weak version_string[] =U_BOOT_VERSION_STRING ;
@@ -37,7 +40,9 @@ static int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])#ifdef LD_VERSION_STRING puts (LD_VERSION_STRING "\n" );#endif - +#ifdef CONFIG_SYS_COREBOOT +printf ("coreboot-%s (%s)\n" , lib_sysinfo.version, lib_sysinfo.build); +#endif return 0 ; }
Signature · 1 line
1.7.7.3
v3 cover Various patches in common/
In reply to Simon GlassQuoted 109 lines · Simon Glass
This collection of patches to common/ adds the following:
- EDID support for LCD displays
- TPM stress test
- gettime command to find out the time since boot
- Adds coreboot information to the 'version' command
- Fixes LMB on x86
- SHA256 hashing using a new hashing framework created in response to list feedback
- Reading raw data from a partition of a block deviceSome patches have been dropped from v2 in response to list feedback.
Also fixes a few minor bugs and tidy-ups.
Changes in v3:
- Renamestricmp()tostrcasecmp()to match Linux / POSIX
- Bracketstrcasecmp()declarations with__HAVE_ARCH_...
- Renamestricmp()tostrcasecmp()to match Linux / POSIX
- Correct hash error message to show the algorithm name, not always SHA1
- Fix ordering of hash.o inMakefile
- Correct hash command help to say 'hash' instead of 'sha1sum'
- Drop meminfo from this series
- Drop patch 'Update time command to avoid usingget_timer_masked()'Changes in v2:
- Remove arm: tag from bootstage step patch
- Convert space to tab in README
- Update gettime commit message to include boards withoutCONFIG_SYS_HZ
- Add more comments to the stdio strncpy commit message
- Add new patch to adjust sha1 functions to use const/unsigned
- Add new patch to adjust sha256 functions to const and watchdog
- Addstricmp()patch again since it is used in this series
- Add generic hash API to allow SHA256 command to be added without duplication
- Add new patch to change sha1sum to use generic hash API
- Add new hash command to support generic hash API
- Add patch to enable hashing and EDID on smdk5250
- Add x86 patch to enable io command for coreboot
- Add x86 tag to version command patchAnton Staaf (1):
Add gettime commandKenneth Waters (1):
Add a command to read raw blocks from a partitionLuigi Semenzato (1):
tpm: Add TPM stress testSimon Glass (11):
Add new bootstage step for the main loop
Fix use of conditional LMB
sha1: Use const where possible, and unsigned for input len
sha256: Use const where possible and add watchdog function Addstrcasecmp()andstrncasecmp()
Add generic hash API
sha1sum: Use generic hash layer
Add hash command to perform hashing using various algorithms
console: Enable function to display console info
exynos: Enable hashing functions and EDID for smdk5250
x86: coreboot: Enable io commandStefan Reinauer (1):
x86: Add coreboot version to u-boot's version commandTom Wai-Hong Tam (3):
edid: Library of EDID decode and print
edid: Add I2C command for printing the EDID
fdt: edid: Enablefdt_add_edid()function whenCONFIG_LCDdefinedVadim Bendebury (1):
Add console command to access io space registersVincent Palatin (1):
stdio: remove useless strncpyREADME | 25 +++ arch/m68k/include/asm/string.h | 2 +- arch/powerpc/include/asm/string.h | 2 +- arch/sparc/include/asm/string.h | 2 +- common/Makefile | 6 + common/cmd_bootm.c | 2 +- common/cmd_gettime.c | 56 +++++++ common/cmd_hash.c | 63 ++++++++ common/cmd_i2c.c | 39 +++++ common/cmd_io.c | 93 +++++++++++ common/cmd_read.c | 81 ++++++++++ common/cmd_sha1sum.c | 129 +--------------- common/cmd_tpm.c | 93 +++++++++++- common/cmd_version.c | 7 +- common/console.c | 6 +- common/edid.c | 307 +++++++++++++++++++++++++++++++++++++ common/fdt_support.c | 2 +- common/hash.c | 221 ++++++++++++++++++++++++++ common/main.c | 2 + common/stdio.c | 1 - include/command.h | 8 +- include/config_cmd_all.h | 4 + include/configs/coreboot.h | 1 + include/configs/smdk5250.h | 7 + include/edid.h | 275 +++++++++++++++++++++++++++++++++ include/hash.h | 69 +++++++++ include/linux/string.h | 7 +- include/sha1.h | 26 +-- include/sha256.h | 8 +- lib/sha1.c | 19 ++- lib/sha256.c | 37 +++++- lib/string.c | 16 ++- 32 files changed, 1438 insertions(+), 178 deletions(-)
Quoted 8 lines
create mode 100644 common/cmd_gettime.c create mode 100644 common/cmd_hash.c create mode 100644 common/cmd_io.c create mode 100644 common/cmd_read.c create mode 100644 common/edid.c create mode 100644 common/hash.c create mode 100644 include/edid.h create mode 100644 include/hash.h
Except for 19 and 20, which never hit patchwork, this is now applied to u-boot/master. If you want to put 19 and 20 into u-boot-x86 that's fine with me. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121212/b783bf72/attachment.pgp>
v3 cover Various patches in common/
Hi Tom,
Quoted 120 lines · Tom Rini
Quoted 109 lines · Simon Glass
This collection of patches to common/ adds the following:
- EDID support for LCD displays
- TPM stress test
- gettime command to find out the time since boot
- Adds coreboot information to the 'version' command
- Fixes LMB on x86
- SHA256 hashing using a new hashing framework created in response to list feedback
- Reading raw data from a partition of a block deviceSome patches have been dropped from v2 in response to list feedback.
Also fixes a few minor bugs and tidy-ups.
Changes in v3:
- Renamestricmp()tostrcasecmp()to match Linux / POSIX
- Bracketstrcasecmp()declarations with__HAVE_ARCH_...
- Renamestricmp()tostrcasecmp()to match Linux / POSIX
- Correct hash error message to show the algorithm name, not always SHA1
- Fix ordering of hash.o inMakefile
- Correct hash command help to say 'hash' instead of 'sha1sum'
- Drop meminfo from this series
- Drop patch 'Update time command to avoid usingget_timer_masked()'Changes in v2:
- Remove arm: tag from bootstage step patch
- Convert space to tab in README
- Update gettime commit message to include boards withoutCONFIG_SYS_HZ
- Add more comments to the stdio strncpy commit message
- Add new patch to adjust sha1 functions to use const/unsigned
- Add new patch to adjust sha256 functions to const and watchdog
- Addstricmp()patch again since it is used in this series
- Add generic hash API to allow SHA256 command to be added without duplication
- Add new patch to change sha1sum to use generic hash API
- Add new hash command to support generic hash API
- Add patch to enable hashing and EDID on smdk5250
- Add x86 patch to enable io command for coreboot
- Add x86 tag to version command patchAnton Staaf (1):
Add gettime commandKenneth Waters (1):
Add a command to read raw blocks from a partitionLuigi Semenzato (1):
tpm: Add TPM stress testSimon Glass (11):
Add new bootstage step for the main loop
Fix use of conditional LMB
sha1: Use const where possible, and unsigned for input len
sha256: Use const where possible and add watchdog function Addstrcasecmp()andstrncasecmp()
Add generic hash API
sha1sum: Use generic hash layer
Add hash command to perform hashing using various algorithms
console: Enable function to display console info
exynos: Enable hashing functions and EDID for smdk5250
x86: coreboot: Enable io commandStefan Reinauer (1):
x86: Add coreboot version to u-boot's version commandTom Wai-Hong Tam (3):
edid: Library of EDID decode and print
edid: Add I2C command for printing the EDID
fdt: edid: Enablefdt_add_edid()function whenCONFIG_LCDdefinedVadim Bendebury (1):
Add console command to access io space registersVincent Palatin (1):
stdio: remove useless strncpyREADME | 25 +++ arch/m68k/include/asm/string.h | 2 +- arch/powerpc/include/asm/string.h | 2 +- arch/sparc/include/asm/string.h | 2 +- common/Makefile | 6 + common/cmd_bootm.c | 2 +- common/cmd_gettime.c | 56 +++++++ common/cmd_hash.c | 63 ++++++++ common/cmd_i2c.c | 39 +++++ common/cmd_io.c | 93 +++++++++++ common/cmd_read.c | 81 ++++++++++ common/cmd_sha1sum.c | 129 +--------------- common/cmd_tpm.c | 93 +++++++++++- common/cmd_version.c | 7 +- common/console.c | 6 +- common/edid.c | 307 +++++++++++++++++++++++++++++++++++++ common/fdt_support.c | 2 +- common/hash.c | 221 ++++++++++++++++++++++++++ common/main.c | 2 + common/stdio.c | 1 - include/command.h | 8 +- include/config_cmd_all.h | 4 + include/configs/coreboot.h | 1 + include/configs/smdk5250.h | 7 + include/edid.h | 275 +++++++++++++++++++++++++++++++++ include/hash.h | 69 +++++++++ include/linux/string.h | 7 +- include/sha1.h | 26 +-- include/sha256.h | 8 +- lib/sha1.c | 19 ++- lib/sha256.c | 37 +++++- lib/string.c | 16 ++- 32 files changed, 1438 insertions(+), 178 deletions(-)Quoted 8 lines
create mode 100644 common/cmd_gettime.c create mode 100644 common/cmd_hash.c create mode 100644 common/cmd_io.c create mode 100644 common/cmd_read.c create mode 100644 common/edid.c create mode 100644 common/hash.c create mode 100644 include/edid.h create mode 100644 include/hash.h
Quoted 3 lines
Except for 19 and 20, which never hit patchwork, this is now applied to u-boot/master. If you want to put 19 and 20 into u-boot-x86 that's fine with me. Thanks!
Thanks. Yes that is odd. I will try resending those two and if that works, pull into u-boot-x86.
Regards,
Simon
Quoted 3 lines
--
Tom