Browse Source

[golan] Fix building with GCC 6

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
08230599ef
2 changed files with 21 additions and 6 deletions
  1. 14
    6
      src/drivers/infiniband/golan.c
  2. 7
    0
      src/drivers/infiniband/golan.h

+ 14
- 6
src/drivers/infiniband/golan.c View File

843
 static void golan_destory_eq(struct golan *golan)
843
 static void golan_destory_eq(struct golan *golan)
844
 {
844
 {
845
 	struct golan_cmd_layout	*cmd;
845
 	struct golan_cmd_layout	*cmd;
846
+	struct golan_destroy_eq_mbox_in *in;
846
 	uint8_t eqn = golan->eq.eqn;
847
 	uint8_t eqn = golan->eq.eqn;
847
 	int rc;
848
 	int rc;
848
 
849
 
853
 					sizeof(struct golan_destroy_eq_mbox_in),
854
 					sizeof(struct golan_destroy_eq_mbox_in),
854
 					sizeof(struct golan_destroy_eq_mbox_out));
855
 					sizeof(struct golan_destroy_eq_mbox_out));
855
 
856
 
856
-	((struct golan_destroy_eq_mbox_in *)(cmd->in))->eqn = eqn;
857
+	in = GOLAN_MBOX_IN ( cmd, in );
858
+	in->eqn = eqn;
857
 	rc = send_command_and_wait(golan, DEF_CMD_IDX, NO_MBOX, NO_MBOX, __FUNCTION__);
859
 	rc = send_command_and_wait(golan, DEF_CMD_IDX, NO_MBOX, NO_MBOX, __FUNCTION__);
858
 	GOLAN_PRINT_RC_AND_CMD_STATUS;
860
 	GOLAN_PRINT_RC_AND_CMD_STATUS;
859
 
861
 
1630
 static int golan_query_vport_context ( struct ib_device *ibdev ) {
1632
 static int golan_query_vport_context ( struct ib_device *ibdev ) {
1631
 	struct golan *golan = ib_get_drvdata ( ibdev );
1633
 	struct golan *golan = ib_get_drvdata ( ibdev );
1632
 	struct golan_cmd_layout	*cmd;
1634
 	struct golan_cmd_layout	*cmd;
1635
+	struct golan_query_hca_vport_context_inbox *in;
1633
 	struct golan_query_hca_vport_context_data *context_data;
1636
 	struct golan_query_hca_vport_context_data *context_data;
1634
 	int rc;
1637
 	int rc;
1635
 
1638
 
1638
 			sizeof(struct golan_query_hca_vport_context_inbox),
1641
 			sizeof(struct golan_query_hca_vport_context_inbox),
1639
 			sizeof(struct golan_query_hca_vport_context_outbox) );
1642
 			sizeof(struct golan_query_hca_vport_context_outbox) );
1640
 
1643
 
1641
-	((struct golan_query_hca_vport_context_inbox *)(cmd->in))->port_num = (u8)ibdev->port;
1644
+	in = GOLAN_MBOX_IN ( cmd, in );
1645
+	in->port_num = (u8)ibdev->port;
1642
 
1646
 
1643
 	rc = send_command_and_wait ( golan, DEF_CMD_IDX, GEN_MBOX, GEN_MBOX, __FUNCTION__ );
1647
 	rc = send_command_and_wait ( golan, DEF_CMD_IDX, GEN_MBOX, GEN_MBOX, __FUNCTION__ );
1644
 	GOLAN_CHECK_RC_AND_CMD_STATUS( err_query_vport_context_cmd );
1648
 	GOLAN_CHECK_RC_AND_CMD_STATUS( err_query_vport_context_cmd );
1662
 static int golan_query_vport_gid ( struct ib_device *ibdev ) {
1666
 static int golan_query_vport_gid ( struct ib_device *ibdev ) {
1663
 	struct golan *golan = ib_get_drvdata( ibdev );
1667
 	struct golan *golan = ib_get_drvdata( ibdev );
1664
 	struct golan_cmd_layout	*cmd;
1668
 	struct golan_cmd_layout	*cmd;
1669
+	struct golan_query_hca_vport_gid_inbox *in;
1665
 	union ib_gid *ib_gid;
1670
 	union ib_gid *ib_gid;
1666
 	int rc;
1671
 	int rc;
1667
 
1672
 
1670
 			sizeof(struct golan_query_hca_vport_gid_inbox),
1675
 			sizeof(struct golan_query_hca_vport_gid_inbox),
1671
 			sizeof(struct golan_query_hca_vport_gid_outbox) );
1676
 			sizeof(struct golan_query_hca_vport_gid_outbox) );
1672
 
1677
 
1673
-	((struct golan_query_hca_vport_gid_inbox *)(cmd->in))->port_num = (u8)ibdev->port;
1674
-	((struct golan_query_hca_vport_gid_inbox *)(cmd->in))->gid_index = 0;
1678
+	in = GOLAN_MBOX_IN ( cmd, in );
1679
+	in->port_num = (u8)ibdev->port;
1680
+	in->gid_index = 0;
1675
 	rc = send_command_and_wait ( golan, DEF_CMD_IDX, GEN_MBOX, GEN_MBOX, __FUNCTION__ );
1681
 	rc = send_command_and_wait ( golan, DEF_CMD_IDX, GEN_MBOX, GEN_MBOX, __FUNCTION__ );
1676
 	GOLAN_CHECK_RC_AND_CMD_STATUS( err_query_vport_gid_cmd );
1682
 	GOLAN_CHECK_RC_AND_CMD_STATUS( err_query_vport_gid_cmd );
1677
 
1683
 
1688
 static int golan_query_vport_pkey ( struct ib_device *ibdev ) {
1694
 static int golan_query_vport_pkey ( struct ib_device *ibdev ) {
1689
 	struct golan *golan = ib_get_drvdata ( ibdev );
1695
 	struct golan *golan = ib_get_drvdata ( ibdev );
1690
 	struct golan_cmd_layout	*cmd;
1696
 	struct golan_cmd_layout	*cmd;
1697
+	struct golan_query_hca_vport_pkey_inbox *in;
1691
 	//struct golan_query_hca_vport_pkey_data *pkey_table;
1698
 	//struct golan_query_hca_vport_pkey_data *pkey_table;
1692
 	int pkey_table_size_in_entries = (1 << (7 + golan->caps.pkey_table_size));
1699
 	int pkey_table_size_in_entries = (1 << (7 + golan->caps.pkey_table_size));
1693
 	int rc;
1700
 	int rc;
1698
 			sizeof(struct golan_outbox_hdr) + 8 +
1705
 			sizeof(struct golan_outbox_hdr) + 8 +
1699
 			sizeof(struct golan_query_hca_vport_pkey_data) * pkey_table_size_in_entries );
1706
 			sizeof(struct golan_query_hca_vport_pkey_data) * pkey_table_size_in_entries );
1700
 
1707
 
1701
-	((struct golan_query_hca_vport_pkey_inbox *)(cmd->in))->port_num = (u8)ibdev->port;
1702
-	((struct golan_query_hca_vport_pkey_inbox *)(cmd->in))->pkey_index = 0xffff;
1708
+	in = GOLAN_MBOX_IN ( cmd, in );
1709
+	in->port_num = (u8)ibdev->port;
1710
+	in->pkey_index = 0xffff;
1703
 	rc = send_command_and_wait ( golan, DEF_CMD_IDX, GEN_MBOX, GEN_MBOX, __FUNCTION__ );
1711
 	rc = send_command_and_wait ( golan, DEF_CMD_IDX, GEN_MBOX, GEN_MBOX, __FUNCTION__ );
1704
 	GOLAN_CHECK_RC_AND_CMD_STATUS( err_query_vport_pkey_cmd );
1712
 	GOLAN_CHECK_RC_AND_CMD_STATUS( err_query_vport_pkey_cmd );
1705
 
1713
 

+ 7
- 0
src/drivers/infiniband/golan.h View File

74
 #define GET_INBOX(golan, idx)		(&(((struct mbox *)(golan->mboxes.inbox))[idx]))
74
 #define GET_INBOX(golan, idx)		(&(((struct mbox *)(golan->mboxes.inbox))[idx]))
75
 #define GET_OUTBOX(golan, idx)		(&(((struct mbox *)(golan->mboxes.outbox))[idx]))
75
 #define GET_OUTBOX(golan, idx)		(&(((struct mbox *)(golan->mboxes.outbox))[idx]))
76
 
76
 
77
+#define GOLAN_MBOX_IN( cmd_ptr, in_ptr ) ( {				  \
78
+	union {								  \
79
+		__be32 raw[4];						  \
80
+		typeof ( *(in_ptr) ) cooked;				  \
81
+	} *u = container_of ( &(cmd_ptr)->in[0], typeof ( *u ), raw[0] ); \
82
+	&u->cooked; } )
83
+
77
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
84
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
78
 
85
 
79
 /* Fw status fields */
86
 /* Fw status fields */

Loading…
Cancel
Save