]> git.openfabrics.org - ~adrianc/mstflint.git/commitdiff
fixed inband access for ConnectIB
authorAdrian Chiris <adrianc@mellanox.com>
Thu, 3 Apr 2014 11:30:17 +0000 (14:30 +0300)
committerAdrian Chiris <adrianc@mellanox.com>
Thu, 3 Apr 2014 11:30:17 +0000 (14:30 +0300)
mflash/mflash.c
mtcr_ul/mtcr_ul.c

index 05220f862e6d4e59ee66fa9816e475f7ea1552cd..0c41efc8ca84e87d5458fe4384a0e18af7a89570 100644 (file)
@@ -2168,7 +2168,11 @@ int get_dev_info(mflash* mfl)
          } else {
              if (has_icmd_if(mfl->attr.hw_dev_id)) {
                  if (mfl->opts[MFO_IGNORE_CASHE_REP_GUARD] == 0) {
-                     mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_ICMD;
+                    #ifdef MST_UL
+                         mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_INBAND;
+                    #else
+                         mfl->opts[MFO_FW_ACCESS_TYPE_BY_MFILE] = ATBM_ICMD;
+                    #endif
                  }
              }
          }
index 2a3ebd78c0a9795b1af98e1fe078d011352f0cf3..a6540bc3a193c2e2537e3ae0c0d7dc111bdb107a 100644 (file)
@@ -1435,8 +1435,16 @@ static int mreg_send_wrapper(mfile* mf, u_int8_t *data, int r_icmd_size, int w_i
                 return ME_MAD_SEND_FAILED;
             }
     } else if (supports_icmd(mf)) {
-       //printf("-D- w size: %d , r size: %d\n",w_icmd_size,r_icmd_size);
-        rc = icmd_send_command_int(mf, FLASH_REG_ACCESS, data, w_icmd_size, r_icmd_size, 0);
+        #ifdef MST_UL
+        //ugly hack to avoid warnings
+            if (0) {
+                rc = icmd_send_command_int(mf, FLASH_REG_ACCESS, data, w_icmd_size, r_icmd_size, 0);
+            }
+            // in mstflint we access through inband
+            rc = maccess_reg_mad(mf, data);
+        #else
+            rc = icmd_send_command_int(mf, FLASH_REG_ACCESS, data, w_icmd_size, r_icmd_size, 0);
+        #endif
         if (rc) {
                return rc;
         }
@@ -1511,9 +1519,9 @@ static int mreg_send_raw(mfile *mf, u_int16_t reg_id, maccess_reg_method_t metho
 }
 
 
-#define GOLAN_HW_ID 511
-#define SHOMRON_HW_ID 521
-#define PELICAN_HW_ID 583
+#define CIB_HW_ID 511
+#define CX4_HW_ID 521
+#define SW_IB_HW_ID 583
 #define CX3_PRO_HW_ID 0x1F7
 #define CX3_HW_ID_REV 0x1f5
 
@@ -1521,15 +1529,17 @@ static int mreg_send_raw(mfile *mf, u_int16_t reg_id, maccess_reg_method_t metho
 
 static int supports_icmd(mfile* mf) {
 #ifndef MST_UL_ICMD
-       (void)mf; // avoid warnings
-       return 0;
+#ifndef MST_UL
+    (void)mf; // avoid warnings
+    return 0;
+#endif
 #endif
        u_int32_t dev_id;
        mread4(mf,HW_ID_ADDR, &dev_id); // cr might be locked and retured 0xbad0cafe but we dont care we search for device that supports icmd
        switch (dev_id & 0xffff) { // that the hw device id
-               case GOLAN_HW_ID : //golan
-               case SHOMRON_HW_ID : // shomron
-               case PELICAN_HW_ID : // pelican
+               case CIB_HW_ID : //golan
+               case CX4_HW_ID : // shomron
+               case SW_IB_HW_ID : // pelican
                        return 1;
                default:
                        break;
@@ -1558,8 +1568,13 @@ int mget_max_reg_size(mfile *mf) {
        if (mf->access_type == MTCR_ACCESS_INBAND) {
                return INBAND_MAX_REG_SIZE;
        }
-       if (supports_icmd(mf)){ // we support icmd and we dont use IB interface -> we use icmd for reg access
-               return ICMD_MAX_REG_SIZE;
+       if (supports_icmd(mf)){
+           // we support icmd and we dont use IB interface -> we use icmd for reg access
+        #ifdef MST_UL
+               return INBAND_MAX_REG_SIZE;
+        #else
+               return ICMD_MAX_REG_SIZE;
+        #endif
        }
        if (supports_tools_cmdif_reg(mf)) {
                return TOOLS_HCR_MAX_MBOX;