@@ -11492,6 +11492,127 @@ mlxsw_reg_mgpir_unpack(char *payload, u8 *num_of_devices,
11492
11492
* num_of_slots = mlxsw_reg_mgpir_num_of_slots_get (payload );
11493
11493
}
11494
11494
11495
+ /* MBCT - Management Binary Code Transfer Register
11496
+ * -----------------------------------------------
11497
+ * This register allows to transfer binary codes from the host to
11498
+ * the management FW by transferring it by chunks of maximum 1KB.
11499
+ */
11500
+ #define MLXSW_REG_MBCT_ID 0x9120
11501
+ #define MLXSW_REG_MBCT_LEN 0x420
11502
+
11503
+ MLXSW_REG_DEFINE (mbct , MLXSW_REG_MBCT_ID , MLXSW_REG_MBCT_LEN );
11504
+
11505
+ /* reg_mbct_slot_index
11506
+ * Slot index. 0 is reserved.
11507
+ * Access: Index
11508
+ */
11509
+ MLXSW_ITEM32 (reg , mbct , slot_index , 0x00 , 0 , 4 );
11510
+
11511
+ /* reg_mbct_data_size
11512
+ * Actual data field size in bytes for the current data transfer.
11513
+ * Access: WO
11514
+ */
11515
+ MLXSW_ITEM32 (reg , mbct , data_size , 0x04 , 0 , 11 );
11516
+
11517
+ enum mlxsw_reg_mbct_op {
11518
+ MLXSW_REG_MBCT_OP_ERASE_INI_IMAGE = 1 ,
11519
+ MLXSW_REG_MBCT_OP_DATA_TRANSFER , /* Download */
11520
+ MLXSW_REG_MBCT_OP_ACTIVATE ,
11521
+ MLXSW_REG_MBCT_OP_CLEAR_ERRORS = 6 ,
11522
+ MLXSW_REG_MBCT_OP_QUERY_STATUS ,
11523
+ };
11524
+
11525
+ /* reg_mbct_op
11526
+ * Access: WO
11527
+ */
11528
+ MLXSW_ITEM32 (reg , mbct , op , 0x08 , 28 , 4 );
11529
+
11530
+ /* reg_mbct_last
11531
+ * Indicates that the current data field is the last chunk of the INI.
11532
+ * Access: WO
11533
+ */
11534
+ MLXSW_ITEM32 (reg , mbct , last , 0x08 , 26 , 1 );
11535
+
11536
+ /* reg_mbct_oee
11537
+ * Opcode Event Enable. When set a BCTOE event will be sent once the opcode
11538
+ * was executed and the fsm_state has changed.
11539
+ * Access: WO
11540
+ */
11541
+ MLXSW_ITEM32 (reg , mbct , oee , 0x08 , 25 , 1 );
11542
+
11543
+ enum mlxsw_reg_mbct_status {
11544
+ /* Partial data transfer completed successfully and ready for next
11545
+ * data transfer.
11546
+ */
11547
+ MLXSW_REG_MBCT_STATUS_PART_DATA = 2 ,
11548
+ MLXSW_REG_MBCT_STATUS_LAST_DATA ,
11549
+ MLXSW_REG_MBCT_STATUS_ERASE_COMPLETE ,
11550
+ /* Error - trying to erase INI while it being used. */
11551
+ MLXSW_REG_MBCT_STATUS_ERROR_INI_IN_USE ,
11552
+ /* Last data transfer completed, applying magic pattern. */
11553
+ MLXSW_REG_MBCT_STATUS_ERASE_FAILED = 7 ,
11554
+ MLXSW_REG_MBCT_STATUS_INI_ERROR ,
11555
+ MLXSW_REG_MBCT_STATUS_ACTIVATION_FAILED ,
11556
+ MLXSW_REG_MBCT_STATUS_ILLEGAL_OPERATION = 11 ,
11557
+ };
11558
+
11559
+ /* reg_mbct_status
11560
+ * Status.
11561
+ * Access: RO
11562
+ */
11563
+ MLXSW_ITEM32 (reg , mbct , status , 0x0C , 24 , 5 );
11564
+
11565
+ enum mlxsw_reg_mbct_fsm_state {
11566
+ MLXSW_REG_MBCT_FSM_STATE_INI_IN_USE = 5 ,
11567
+ MLXSW_REG_MBCT_FSM_STATE_ERROR ,
11568
+ };
11569
+
11570
+ /* reg_mbct_fsm_state
11571
+ * FSM state.
11572
+ * Access: RO
11573
+ */
11574
+ MLXSW_ITEM32 (reg , mbct , fsm_state , 0x0C , 16 , 4 );
11575
+
11576
+ #define MLXSW_REG_MBCT_DATA_LEN 1024
11577
+
11578
+ /* reg_mbct_data
11579
+ * Up to 1KB of data.
11580
+ * Access: WO
11581
+ */
11582
+ MLXSW_ITEM_BUF (reg , mbct , data , 0x20 , MLXSW_REG_MBCT_DATA_LEN );
11583
+
11584
+ static inline void mlxsw_reg_mbct_pack (char * payload , u8 slot_index ,
11585
+ enum mlxsw_reg_mbct_op op , bool oee )
11586
+ {
11587
+ MLXSW_REG_ZERO (mbct , payload );
11588
+ mlxsw_reg_mbct_slot_index_set (payload , slot_index );
11589
+ mlxsw_reg_mbct_op_set (payload , op );
11590
+ mlxsw_reg_mbct_oee_set (payload , oee );
11591
+ }
11592
+
11593
+ static inline void mlxsw_reg_mbct_dt_pack (char * payload ,
11594
+ u16 data_size , bool last ,
11595
+ const char * data )
11596
+ {
11597
+ if (WARN_ON (data_size > MLXSW_REG_MBCT_DATA_LEN ))
11598
+ return ;
11599
+ mlxsw_reg_mbct_data_size_set (payload , data_size );
11600
+ mlxsw_reg_mbct_last_set (payload , last );
11601
+ mlxsw_reg_mbct_data_memcpy_to (payload , data );
11602
+ }
11603
+
11604
+ static inline void
11605
+ mlxsw_reg_mbct_unpack (const char * payload , u8 * p_slot_index ,
11606
+ enum mlxsw_reg_mbct_status * p_status ,
11607
+ enum mlxsw_reg_mbct_fsm_state * p_fsm_state )
11608
+ {
11609
+ if (p_slot_index )
11610
+ * p_slot_index = mlxsw_reg_mbct_slot_index_get (payload );
11611
+ * p_status = mlxsw_reg_mbct_status_get (payload );
11612
+ if (p_fsm_state )
11613
+ * p_fsm_state = mlxsw_reg_mbct_fsm_state_get (payload );
11614
+ }
11615
+
11495
11616
/* MDDQ - Management DownStream Device Query Register
11496
11617
* --------------------------------------------------
11497
11618
* This register allows to query the DownStream device properties. The desired
@@ -12990,6 +13111,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
12990
13111
MLXSW_REG (mtptpt ),
12991
13112
MLXSW_REG (mfgd ),
12992
13113
MLXSW_REG (mgpir ),
13114
+ MLXSW_REG (mbct ),
12993
13115
MLXSW_REG (mddq ),
12994
13116
MLXSW_REG (mddc ),
12995
13117
MLXSW_REG (mfde ),
0 commit comments