Browse Source

Added sw2hw_mpt

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
def5ae9127
2 changed files with 79 additions and 2 deletions
  1. 6
    0
      src/drivers/net/mlx_ipoib/arbel.h
  2. 73
    2
      src/drivers/net/mlx_ipoib/mt25218.c

+ 6
- 0
src/drivers/net/mlx_ipoib/arbel.h View File

39
 #define ARBEL_HCR_QUERY_DEV_LIM		0x0003
39
 #define ARBEL_HCR_QUERY_DEV_LIM		0x0003
40
 #define ARBEL_HCR_QUERY_FW		0x0004
40
 #define ARBEL_HCR_QUERY_FW		0x0004
41
 #define ARBEL_HCR_INIT_HCA		0x0007
41
 #define ARBEL_HCR_INIT_HCA		0x0007
42
+#define ARBEL_HCR_CLOSE_HCA		0x0008
43
+#define ARBEL_HCR_SW2HW_MPT		0x000d
42
 #define ARBEL_HCR_SW2HW_CQ		0x0016
44
 #define ARBEL_HCR_SW2HW_CQ		0x0016
43
 #define ARBEL_HCR_HW2SW_CQ		0x0017
45
 #define ARBEL_HCR_HW2SW_CQ		0x0017
44
 #define ARBEL_HCR_RST2INIT_QPEE		0x0019
46
 #define ARBEL_HCR_RST2INIT_QPEE		0x0019
101
 struct MLX_DECLARE_STRUCT ( arbelprm_mad_ifc );
103
 struct MLX_DECLARE_STRUCT ( arbelprm_mad_ifc );
102
 struct MLX_DECLARE_STRUCT ( arbelprm_mgm_entry );
104
 struct MLX_DECLARE_STRUCT ( arbelprm_mgm_entry );
103
 struct MLX_DECLARE_STRUCT ( arbelprm_mgm_hash );
105
 struct MLX_DECLARE_STRUCT ( arbelprm_mgm_hash );
106
+struct MLX_DECLARE_STRUCT ( arbelprm_mpt );
104
 struct MLX_DECLARE_STRUCT ( arbelprm_qp_db_record );
107
 struct MLX_DECLARE_STRUCT ( arbelprm_qp_db_record );
105
 struct MLX_DECLARE_STRUCT ( arbelprm_qp_ee_state_transitions );
108
 struct MLX_DECLARE_STRUCT ( arbelprm_qp_ee_state_transitions );
106
 struct MLX_DECLARE_STRUCT ( arbelprm_query_dev_lim );
109
 struct MLX_DECLARE_STRUCT ( arbelprm_query_dev_lim );
333
 /** Global protection domain */
336
 /** Global protection domain */
334
 #define ARBEL_GLOBAL_PD			0x123456
337
 #define ARBEL_GLOBAL_PD			0x123456
335
 
338
 
339
+/** Memory key prefix */
340
+#define ARBEL_MKEY_PREFIX		0x77000000UL
341
+
336
 /*
342
 /*
337
  * HCA commands
343
  * HCA commands
338
  *
344
  *

+ 73
- 2
src/drivers/net/mlx_ipoib/mt25218.c View File

235
 			   0, init_hca, 0, NULL );
235
 			   0, init_hca, 0, NULL );
236
 }
236
 }
237
 
237
 
238
+static inline int
239
+arbel_cmd_close_hca ( struct arbel *arbel ) {
240
+	return arbel_cmd ( arbel,
241
+			   ARBEL_HCR_VOID_CMD ( ARBEL_HCR_CLOSE_HCA ),
242
+			   0, NULL, 0, NULL );
243
+}
244
+
245
+static inline int
246
+arbel_cmd_sw2hw_mpt ( struct arbel *arbel, unsigned int index,
247
+		      const struct arbelprm_mpt *mpt ) {
248
+	return arbel_cmd ( arbel,
249
+			   ARBEL_HCR_IN_CMD ( ARBEL_HCR_SW2HW_MPT,
250
+					      1, sizeof ( *mpt ) ),
251
+			   0, mpt, index, NULL );
252
+}
253
+
238
 static inline int
254
 static inline int
239
 arbel_cmd_sw2hw_cq ( struct arbel *arbel, unsigned long cqn,
255
 arbel_cmd_sw2hw_cq ( struct arbel *arbel, unsigned long cqn,
240
 		     const struct arbelprm_completion_queue_context *cqctx ) {
256
 		     const struct arbelprm_completion_queue_context *cqctx ) {
405
 			   0, map, 1, NULL );
421
 			   0, map, 1, NULL );
406
 }
422
 }
407
 
423
 
424
+/***************************************************************************
425
+ *
426
+ * Event queue operations
427
+ *
428
+ ***************************************************************************
429
+ */
430
+
431
+static int arbel_create_eq ( struct arbel *arbel ) {
432
+}
433
+
408
 /***************************************************************************
434
 /***************************************************************************
409
  *
435
  *
410
  * Completion queue operations
436
  * Completion queue operations
1800
  ***************************************************************************
1826
  ***************************************************************************
1801
  */
1827
  */
1802
 
1828
 
1829
+/**
1830
+ * Set up memory protection table
1831
+ *
1832
+ * @v arbel		Arbel device
1833
+ * @ret rc		Return status code
1834
+ */
1835
+static int arbel_setup_mpt ( struct arbel *arbel ) {
1836
+	struct arbelprm_mpt mpt;
1837
+	uint32_t key;
1838
+	int rc;
1839
+
1840
+	/* Derive key */
1841
+	key = ( arbel->limits.reserved_mrws | ARBEL_MKEY_PREFIX );
1842
+	arbel->reserved_lkey = ( ( key << 8 ) | ( key >> 24 ) );
1843
+
1844
+	/* Initialise memory protection table */
1845
+	memset ( &mpt, 0, sizeof ( mpt ) );
1846
+	MLX_FILL_4 ( &mpt, 0,
1847
+		     r_w, 1,
1848
+		     pa, 1,
1849
+		     lr, 1,
1850
+		     lw, 1 );
1851
+	MLX_FILL_1 ( &mpt, 2, mem_key, key );
1852
+	MLX_FILL_1 ( &mpt, 3, pd, ARBEL_GLOBAL_PD );
1853
+	MLX_FILL_1 ( &mpt, 6, reg_wnd_len_h, 0xffffffffUL );
1854
+	MLX_FILL_1 ( &mpt, 7, reg_wnd_len_l, 0xffffffffUL );
1855
+	if ( ( rc = arbel_cmd_sw2hw_mpt ( arbel, arbel->limits.reserved_mrws,
1856
+					  &mpt ) ) != 0 ) {
1857
+		DBGC ( arbel, "Arbel %p could not set up MPT: %s\n",
1858
+		       arbel, strerror ( rc ) );
1859
+		return rc;
1860
+	}
1861
+
1862
+	return 0;
1863
+}
1864
+	
1803
 /**
1865
 /**
1804
  * Probe PCI device
1866
  * Probe PCI device
1805
  *
1867
  *
1878
 		       arbel, strerror ( rc ) );
1940
 		       arbel, strerror ( rc ) );
1879
 		goto err_init_hca;
1941
 		goto err_init_hca;
1880
 	}
1942
 	}
1943
+
1944
+	/* Set up memory protection */
1945
+	if ( ( rc = arbel_setup_mpt ( arbel ) ) != 0 )
1946
+		goto err_setup_mpt;
1947
+
1948
+		     
1881
 #endif
1949
 #endif
1882
 
1950
 
1883
 
1951
 
1889
 	arbel->mailbox_in = dev_buffers_p->inprm_buf;
1957
 	arbel->mailbox_in = dev_buffers_p->inprm_buf;
1890
 	arbel->mailbox_out = dev_buffers_p->outprm_buf;
1958
 	arbel->mailbox_out = dev_buffers_p->outprm_buf;
1891
 #endif
1959
 #endif
1892
-	arbel->db_rec = dev_ib_data.uar_context_base;
1960
+#if ! SELF_INIT
1893
 	arbel->reserved_lkey = dev_ib_data.mkey;
1961
 	arbel->reserved_lkey = dev_ib_data.mkey;
1962
+#endif
1963
+	arbel->db_rec = dev_ib_data.uar_context_base;
1894
 	arbel->eqn = dev_ib_data.eq.eqn;
1964
 	arbel->eqn = dev_ib_data.eq.eqn;
1895
 
1965
 
1896
 
1966
 
1912
 	ib_driver_close ( 0 );
1982
 	ib_driver_close ( 0 );
1913
  err_ib_driver_init:
1983
  err_ib_driver_init:
1914
 
1984
 
1915
-	
1985
+ err_setup_mpt:
1986
+	arbel_cmd_close_hca ( arbel );
1916
  err_init_hca:
1987
  err_init_hca:
1917
 	arbel_free_icm ( arbel );
1988
 	arbel_free_icm ( arbel );
1918
  err_alloc_icm:
1989
  err_alloc_icm:

Loading…
Cancel
Save