Browse Source

Forward-port event queue fixes from 5.4 tree.

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
e5865e796b
1 changed files with 27 additions and 0 deletions
  1. 27
    0
      src/drivers/net/etherfabric.c

+ 27
- 0
src/drivers/net/etherfabric.c View File

746
 #define EF1_TX_ENGINE_EN_WIDTH 1
746
 #define EF1_TX_ENGINE_EN_WIDTH 1
747
 #define EF1_RX_ENGINE_EN_LBN 18
747
 #define EF1_RX_ENGINE_EN_LBN 18
748
 #define EF1_RX_ENGINE_EN_WIDTH 1
748
 #define EF1_RX_ENGINE_EN_WIDTH 1
749
+#define EF1_TURBO2_LBN 17
750
+#define EF1_TURBO2_WIDTH 1
751
+#define EF1_TURBO1_LBN 16
752
+#define EF1_TURBO1_WIDTH 1
753
+#define EF1_TURBO3_LBN 14
754
+#define EF1_TURBO3_WIDTH 1
749
 #define EF1_LB_RESET_LBN 3
755
 #define EF1_LB_RESET_LBN 3
750
 #define EF1_LB_RESET_WIDTH 1
756
 #define EF1_LB_RESET_WIDTH 1
751
 #define EF1_MAC_RESET_LBN 2
757
 #define EF1_MAC_RESET_LBN 2
900
 #define EF1_EV_CODE_WIDTH 8
906
 #define EF1_EV_CODE_WIDTH 8
901
 #define EF1_RX_EV_DECODE 0x01
907
 #define EF1_RX_EV_DECODE 0x01
902
 #define EF1_TX_EV_DECODE 0x02
908
 #define EF1_TX_EV_DECODE 0x02
909
+#define EF1_TIMER_EV_DECODE 0x0b
903
 #define EF1_DRV_GEN_EV_DECODE 0x0f
910
 #define EF1_DRV_GEN_EV_DECODE 0x0f
904
 
911
 
905
 /* Receive events */
912
 /* Receive events */
1097
 	EFAB_SET_DWORD_FIELD ( reg, EF1_MASTER_EVENTS, 0 );
1104
 	EFAB_SET_DWORD_FIELD ( reg, EF1_MASTER_EVENTS, 0 );
1098
 	EFAB_SET_DWORD_FIELD ( reg, EF1_TX_ENGINE_EN, 0 );
1105
 	EFAB_SET_DWORD_FIELD ( reg, EF1_TX_ENGINE_EN, 0 );
1099
 	EFAB_SET_DWORD_FIELD ( reg, EF1_RX_ENGINE_EN, 0 );
1106
 	EFAB_SET_DWORD_FIELD ( reg, EF1_RX_ENGINE_EN, 0 );
1107
+	EFAB_SET_DWORD_FIELD ( reg, EF1_TURBO2, 1 );
1108
+	EFAB_SET_DWORD_FIELD ( reg, EF1_TURBO1, 1 );
1109
+	EFAB_SET_DWORD_FIELD ( reg, EF1_TURBO3, 1 );
1100
 	EFAB_SET_DWORD_FIELD ( reg, EF1_CAM_ENABLE, 1 );
1110
 	EFAB_SET_DWORD_FIELD ( reg, EF1_CAM_ENABLE, 1 );
1101
 	ef1002_writel ( efab, &reg, EF1_CTR_GEN_STATUS0_REG );
1111
 	ef1002_writel ( efab, &reg, EF1_CTR_GEN_STATUS0_REG );
1102
 	udelay ( 1000 );
1112
 	udelay ( 1000 );
1184
 				EF1_RX_KER_BUF_ADR,
1194
 				EF1_RX_KER_BUF_ADR,
1185
 				virt_to_bus ( rx_buf->addr ) );
1195
 				virt_to_bus ( rx_buf->addr ) );
1186
 	ef1002_writel ( efab, &rxd.dword[0], EF1_RX_DESC_FIFO + 0 );
1196
 	ef1002_writel ( efab, &rxd.dword[0], EF1_RX_DESC_FIFO + 0 );
1197
+	wmb();
1187
 	ef1002_writel ( efab, &rxd.dword[1], EF1_RX_DESC_FIFO + 4 );
1198
 	ef1002_writel ( efab, &rxd.dword[1], EF1_RX_DESC_FIFO + 4 );
1188
 	udelay ( 10 );
1199
 	udelay ( 10 );
1189
 }
1200
 }
1219
 
1230
 
1220
 	ef1002_writel ( efab, &txd.dword[0], EF1_TX_DESC_FIFO + 0 );
1231
 	ef1002_writel ( efab, &txd.dword[0], EF1_TX_DESC_FIFO + 0 );
1221
 	ef1002_writel ( efab, &txd.dword[1], EF1_TX_DESC_FIFO + 4 );
1232
 	ef1002_writel ( efab, &txd.dword[1], EF1_TX_DESC_FIFO + 4 );
1233
+	wmb();
1222
 	ef1002_writel ( efab, &txd.dword[2], EF1_TX_DESC_FIFO + 8 );
1234
 	ef1002_writel ( efab, &txd.dword[2], EF1_TX_DESC_FIFO + 8 );
1223
 	udelay ( 10 );
1235
 	udelay ( 10 );
1224
 }
1236
 }
1266
 		/* RX len not available via event FIFO */
1278
 		/* RX len not available via event FIFO */
1267
 		event->rx_len = ETH_FRAME_LEN;
1279
 		event->rx_len = ETH_FRAME_LEN;
1268
 		break;
1280
 		break;
1281
+	case EF1_TIMER_EV_DECODE:
1282
+		/* These are safe to ignore.  We seem to get some at
1283
+		 * start of day, presumably due to the timers starting
1284
+		 * up with random contents.
1285
+		 */
1286
+		event->type = EFAB_EV_NONE;
1287
+		break;
1269
 	default:
1288
 	default:
1270
 		printf ( "Unknown event type %d data %08lx\n", ev_code,
1289
 		printf ( "Unknown event type %d data %08lx\n", ev_code,
1271
 			 EFAB_DWORD_FIELD ( reg, EFAB_DWORD_0 ) );
1290
 			 EFAB_DWORD_FIELD ( reg, EFAB_DWORD_0 ) );
2717
 	if ( ! retrieve )
2736
 	if ( ! retrieve )
2718
 		return 1;
2737
 		return 1;
2719
 
2738
 
2739
+	/* There seems to be a hardware race.  The event can show up
2740
+	 * on the event FIFO before the DMA has completed, so we
2741
+	 * insert a tiny delay.  If this proves unreliable, we should
2742
+	 * switch to using event DMA rather than the event FIFO, since
2743
+	 * event DMA ordering is guaranteed.
2744
+	 */
2745
+	udelay ( 1 );
2746
+
2720
 	/* Copy packet contents */
2747
 	/* Copy packet contents */
2721
 	nic->packetlen = rx_buf->len;
2748
 	nic->packetlen = rx_buf->len;
2722
 	memcpy ( nic->packet, rx_buf->addr, nic->packetlen );
2749
 	memcpy ( nic->packet, rx_buf->addr, nic->packetlen );

Loading…
Cancel
Save