From: ftillier Date: Mon, 3 Apr 2006 21:43:42 +0000 (+0000) Subject: [HCAFWUPDATE] Update to print out PSID and handle X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=6623045c960831b879c5aa0f0beeea1981e977e5;p=~shefty%2Frdma-win.git [HCAFWUPDATE] Update to print out PSID and handle user data and FW configuration sections. git-svn-id: svn://openib.tc.cornell.edu/gen1@277 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/tools/fwupdate/user/flint.cpp b/trunk/tools/fwupdate/user/flint.cpp index d6cd7bea..5e36b802 100644 --- a/trunk/tools/fwupdate/user/flint.cpp +++ b/trunk/tools/fwupdate/user/flint.cpp @@ -107,12 +107,28 @@ struct PS { uint32_t fi_size; uint32_t signature; uint32_t fw_reserved[5]; - uint32_t vsd[56]; + uint32_t vsd[52]; + union { + uint32_t as_uint32[4]; + char as_str[16]; + } psid; uint32_t branch_to; uint32_t crc016; }; -enum { H_FIRST=1, H_DDR=1, H_CNF=2, H_JMP=3, H_EMT=4, H_ROM=5, H_GUID=6, - H_BOARD_ID=7, H_LAST=7 }; +enum { + H_FIRST=1, + H_DDR=1, + H_CNF=2, + H_JMP=3, + H_EMT=4, + H_ROM=5, + H_GUID=6, + H_BOARD_ID=7, + H_USER_DATA=8, + H_FW_CONF=9, + H_LAST =9 +}; + struct GPH { uint32_t type; uint32_t size; @@ -1420,6 +1436,12 @@ bool checkGen(FBase& f, uint32_t beg, sprintf(pr, "%s /0x%08"PRIx32"-0x%08"PRIx32" (0x%06"PRIx32")/ (EMT Service)", pref, offs, offs+size+(unsigned)sizeof(gph)+3, size+(unsigned)sizeof(gph)+4); break; + case H_FW_CONF: + size = gph.size * sizeof(uint32_t); + sprintf(pr, "%s /0x%08x-0x%08x (0x%06x)/ (FW Configuration)", + pref, offs, offs+size+(uint32_t)sizeof(gph)+3, + size+(uint32_t)sizeof(gph)+4); + break; case H_ROM: size = gph.size * sizeof(uint32_t); sprintf(pr, "%s /0x%08"PRIx32"-0x%08"PRIx32" (0x%06"PRIx32")/ (ROM)", @@ -1430,14 +1452,25 @@ bool checkGen(FBase& f, uint32_t beg, sprintf(pr, "%s /0x%08"PRIx32"-0x%08"PRIx32" (0x%06"PRIx32")/ (GUID)", pref, offs, offs+size+(unsigned)sizeof(gph)+3, size+(unsigned)sizeof(gph)+4); break; + case H_USER_DATA: + size = gph.size * sizeof(uint32_t); + sprintf(pr, "%s /0x%08x-0x%08x (0x%06x)/ (User Data)", + pref, offs, offs+size+(uint32_t)sizeof(gph)+3, + size+(uint32_t)sizeof(gph)+4); + break; case H_BOARD_ID: size = gph.size * sizeof(uint32_t); sprintf(pr, "%s /0x%08"PRIx32"-0x%08"PRIx32" (0x%06"PRIx32")/ (Board ID)", pref, offs, offs+size+(unsigned)sizeof(gph)+3,size+(u_int32_t)sizeof(gph)+4); break; default: - report("%s /0x%08"PRIx32"/ - Invalid partition type (%"PRIx32")\n", pref,offs,gph.type); - return false; + // For forward compatibility, try analyzing even if section type is uncknown + // Assuming the size is in DW, like all other sections (except emt service). + // If this assumption is wrong, CRC calc would fail - no harm done. + size = gph.size * sizeof(uint32_t); + sprintf(pr, "%s /0x%08x-0x%08x (0x%06x)/ (UNKNOWN SECTION TYPE (%d))", + pref, offs, offs+size+(uint32_t)sizeof(gph)+3, + size+(uint32_t)sizeof(gph)+4, gph.type); } // CRC @@ -2287,7 +2320,8 @@ bool showInfo(FBase &device, FlashCommandLine cl) hardwareversion >>=24; device.read(SECT_SIZE*section, &ps, sizeof(ps)); TOCPUBY(ps,sizeof(ps)); - printf("Image Type : Fail Safe\n"); + printf("PSID : %s\n",ps.psid.as_str); + printf("Image Type : Fail Safe\n"); if (hardwareversion != 0xA0 && hardwareversion != 0xA1) { printf("Hardware Version : 0xInvalid\n");