[coreboot] New patch to review for coreboot: 458599f Add more information to the cbfstool print

Ronald G. Minnich (rminnich@gmail.com) gerrit at coreboot.org
Fri Jan 18 17:59:29 CET 2013


Ronald G. Minnich (rminnich at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2176

-gerrit

commit 458599f0754c6b73a8b0293a906960a63891f720
Author: Ronald G. Minnich <rminnich at gmail.com>
Date:   Fri Jan 18 10:58:42 2013 -0600

    Add more information to the cbfstool print
    
    Show what's in a stage or payload. This will let people better understand
    what's in a stage or payload.
    
    Change-Id: If6d9a877b4aedd5cece76774e41f0daadb20c008
    Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
---
 util/cbfstool/cbfs.h   |  2 ++
 util/cbfstool/common.c | 58 +++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/util/cbfstool/cbfs.h b/util/cbfstool/cbfs.h
index 617eeee..3dbeefd 100644
--- a/util/cbfstool/cbfs.h
+++ b/util/cbfstool/cbfs.h
@@ -106,6 +106,8 @@ struct cbfs_payload {
 #define CBFS_COMPONENT_NULL 0xFFFFFFFF
 
 int cbfs_file_header(unsigned long physaddr);
+#define CBFS_SUBHEADER(_p) ( (void *) ((((uint8_t *) (_p)) + ntohl((_p)->offset))) )
+
 struct cbfs_file *cbfs_create_empty_file(uint32_t physaddr, uint32_t size);
 
 #endif
diff --git a/util/cbfstool/common.c b/util/cbfstool/common.c
index 5413958..deedb47 100644
--- a/util/cbfstool/common.c
+++ b/util/cbfstool/common.c
@@ -274,10 +274,10 @@ uint64_t intfiletype(const char *name)
 void print_cbfs_directory(const char *filename)
 {
 	printf
-	    ("%s: %d kB, bootblocksize %d, romsize %d, offset 0x%x\n"
-	     "alignment: %d bytes, architecture: %s\n\n",
-	     basename((char *)filename), romsize / 1024, ntohl(master_header->bootblocksize),
-	     romsize, ntohl(master_header->offset), align, arch_to_string(arch));
+		("%s: %d kB, bootblocksize %d, romsize %d, offset 0x%x\n"
+		 "alignment: %d bytes, architecture: %s\n\n",
+		 basename((char *)filename), romsize / 1024, ntohl(master_header->bootblocksize),
+		 romsize, ntohl(master_header->offset), align, arch_to_string(arch));
 	printf("%-30s %-10s %-12s Size\n", "Name", "Offset", "Type");
 	uint32_t current = phys_start;
 	while (current < phys_end) {
@@ -286,7 +286,7 @@ void print_cbfs_directory(const char *filename)
 			continue;
 		}
 		struct cbfs_file *thisfile =
-		    (struct cbfs_file *)phys_to_virt(current);
+			(struct cbfs_file *)phys_to_virt(current);
 		uint32_t length = ntohl(thisfile->len);
 		char *fname = (char *)(phys_to_virt(current) + sizeof(struct cbfs_file));
 		if (strlen(fname) == 0)
@@ -295,6 +295,54 @@ void print_cbfs_directory(const char *filename)
 		printf("%-30s 0x%-8x %-12s %d\n", fname,
 		       current - phys_start + ntohl(master_header->offset),
 		       strfiletype(ntohl(thisfile->type)), length);
+		/* note the components of the subheader are in host order ... */
+		switch(ntohl(thisfile->type)){
+		case CBFS_COMPONENT_STAGE:
+		{
+			struct cbfs_stage *stage = CBFS_SUBHEADER(thisfile);
+			printf("\tcompression:%x,entry:%016llx,load:%016llx,len:0x%x,memlen:0x%x\n",
+			       stage->compression,
+			       stage->entry,
+			       stage->load,
+			       stage->len,
+			       stage->memlen);
+			break;
+		}
+		case CBFS_COMPONENT_PAYLOAD:
+		{
+			struct cbfs_payload_segment *payload = CBFS_SUBHEADER(thisfile);
+			printf("\ttype:%x,compression:%x,offset:0x%x,load:%016llx,len:0x%x,memlen:0x%x\n",
+			       payload->type,
+			       payload->compression,
+			       payload->offset,
+			       payload->load_addr,
+			       payload->len,
+			       payload->mem_len);
+			break;
+		}
+		case CBFS_COMPONENT_OPTIONROM:
+			break;
+		case CBFS_COMPONENT_BOOTSPLASH:
+			break;
+		case CBFS_COMPONENT_RAW:
+			break;
+		case CBFS_COMPONENT_VSA:
+			break;
+		case CBFS_COMPONENT_MBI:
+			break;
+		case CBFS_COMPONENT_MICROCODE:
+			break;
+		case CBFS_COMPONENT_CMOS_DEFAULT:
+			break;
+		case CBFS_COMPONENT_CMOS_LAYOUT:
+			break;
+		case CBFS_COMPONENT_DELETED:
+			break;
+		case CBFS_COMPONENT_NULL:
+			break;
+		default:
+			break;
+		}
 		current =
 		    ALIGN(current + ntohl(thisfile->len) +
 			  ntohl(thisfile->offset), align);



More information about the coreboot mailing list