[HCAFWUPDATE] Update to print out PSID and handle
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 3 Apr 2006 21:43:42 +0000 (21:43 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 3 Apr 2006 21:43:42 +0000 (21:43 +0000)
user data and FW configuration sections.

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@277 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

tools/fwupdate/user/flint.cpp

index d6cd7be..5e36b80 100644 (file)
@@ -107,12 +107,28 @@ struct PS {
     uint32_t fi_size;\r
     uint32_t signature;\r
     uint32_t fw_reserved[5];\r
-    uint32_t vsd[56];\r
+    uint32_t vsd[52];\r
+       union {\r
+               uint32_t        as_uint32[4];\r
+               char            as_str[16];\r
+       } psid;\r
     uint32_t branch_to;\r
     uint32_t crc016;\r
 };\r
-enum { H_FIRST=1, H_DDR=1, H_CNF=2, H_JMP=3, H_EMT=4, H_ROM=5, H_GUID=6,\r
-       H_BOARD_ID=7, H_LAST=7 };\r
+enum {\r
+       H_FIRST=1,\r
+       H_DDR=1,\r
+       H_CNF=2,\r
+       H_JMP=3,\r
+       H_EMT=4,\r
+       H_ROM=5,\r
+       H_GUID=6,\r
+       H_BOARD_ID=7,\r
+       H_USER_DATA=8,\r
+       H_FW_CONF=9,\r
+       H_LAST  =9\r
+};\r
+\r
 struct GPH {\r
     uint32_t type;\r
     uint32_t size;\r
@@ -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)",\r
                 pref, offs, offs+size+(unsigned)sizeof(gph)+3, size+(unsigned)sizeof(gph)+4);\r
         break;\r
+    case H_FW_CONF:\r
+        size = gph.size * sizeof(uint32_t);\r
+        sprintf(pr, "%s /0x%08x-0x%08x (0x%06x)/ (FW Configuration)",\r
+                pref, offs, offs+size+(uint32_t)sizeof(gph)+3,\r
+                size+(uint32_t)sizeof(gph)+4);\r
+        break;\r
     case H_ROM:\r
         size = gph.size * sizeof(uint32_t);\r
         sprintf(pr, "%s /0x%08"PRIx32"-0x%08"PRIx32" (0x%06"PRIx32")/ (ROM)",\r
@@ -1430,14 +1452,25 @@ bool checkGen(FBase& f, uint32_t beg,
         sprintf(pr, "%s /0x%08"PRIx32"-0x%08"PRIx32" (0x%06"PRIx32")/ (GUID)",\r
                 pref, offs, offs+size+(unsigned)sizeof(gph)+3, size+(unsigned)sizeof(gph)+4);\r
         break;\r
+    case H_USER_DATA:\r
+        size = gph.size * sizeof(uint32_t);\r
+        sprintf(pr, "%s /0x%08x-0x%08x (0x%06x)/ (User Data)",\r
+                pref, offs, offs+size+(uint32_t)sizeof(gph)+3,\r
+                size+(uint32_t)sizeof(gph)+4);\r
+        break;\r
     case H_BOARD_ID:\r
         size = gph.size * sizeof(uint32_t);\r
         sprintf(pr, "%s /0x%08"PRIx32"-0x%08"PRIx32" (0x%06"PRIx32")/ (Board ID)",\r
                 pref, offs, offs+size+(unsigned)sizeof(gph)+3,size+(u_int32_t)sizeof(gph)+4);\r
         break; \r
     default:\r
-        report("%s /0x%08"PRIx32"/ - Invalid partition type (%"PRIx32")\n", pref,offs,gph.type);\r
-        return false;\r
+        // For forward compatibility, try analyzing even if section type is uncknown\r
+        // Assuming the size is in DW, like all other sections (except emt service).\r
+        // If this assumption is wrong, CRC calc would fail - no harm done.\r
+        size = gph.size * sizeof(uint32_t);\r
+        sprintf(pr, "%s /0x%08x-0x%08x (0x%06x)/ (UNKNOWN SECTION TYPE (%d))",\r
+                pref, offs, offs+size+(uint32_t)sizeof(gph)+3,\r
+                size+(uint32_t)sizeof(gph)+4, gph.type);\r
     }\r
 \r
     // CRC\r
@@ -2287,7 +2320,8 @@ bool showInfo(FBase &device, FlashCommandLine cl)
                hardwareversion >>=24;\r
         device.read(SECT_SIZE*section, &ps, sizeof(ps));\r
         TOCPUBY(ps,sizeof(ps));\r
-        printf("Image Type        : Fail Safe\n");\r
+               printf("PSID              : %s\n",ps.psid.as_str);\r
+               printf("Image Type        : Fail Safe\n");\r
         if (hardwareversion != 0xA0 && hardwareversion != 0xA1)\r
         {\r
             printf("Hardware Version  : 0xInvalid\n");\r