|
@@ -95,7 +95,7 @@ static void pxe_netdev_close ( void ) {
|
95
|
95
|
* Status: working
|
96
|
96
|
*/
|
97
|
97
|
PXENV_EXIT_t pxenv_undi_startup ( struct s_PXENV_UNDI_STARTUP *undi_startup ) {
|
98
|
|
- DBG ( "PXENV_UNDI_STARTUP" );
|
|
98
|
+ DBG ( "PXENV_UNDI_STARTUP\n" );
|
99
|
99
|
|
100
|
100
|
undi_startup->Status = PXENV_STATUS_SUCCESS;
|
101
|
101
|
return PXENV_EXIT_SUCCESS;
|
|
@@ -106,7 +106,7 @@ PXENV_EXIT_t pxenv_undi_startup ( struct s_PXENV_UNDI_STARTUP *undi_startup ) {
|
106
|
106
|
* Status: working
|
107
|
107
|
*/
|
108
|
108
|
PXENV_EXIT_t pxenv_undi_cleanup ( struct s_PXENV_UNDI_CLEANUP *undi_cleanup ) {
|
109
|
|
- DBG ( "PXENV_UNDI_CLEANUP" );
|
|
109
|
+ DBG ( "PXENV_UNDI_CLEANUP\n" );
|
110
|
110
|
|
111
|
111
|
pxe_netdev_close();
|
112
|
112
|
|
|
@@ -120,7 +120,8 @@ PXENV_EXIT_t pxenv_undi_cleanup ( struct s_PXENV_UNDI_CLEANUP *undi_cleanup ) {
|
120
|
120
|
*/
|
121
|
121
|
PXENV_EXIT_t pxenv_undi_initialize ( struct s_PXENV_UNDI_INITIALIZE
|
122
|
122
|
*undi_initialize ) {
|
123
|
|
- DBG ( "PXENV_UNDI_INITIALIZE" );
|
|
123
|
+ DBG ( "PXENV_UNDI_INITIALIZE protocolini %08x\n",
|
|
124
|
+ undi_initialize->ProtocolIni );
|
124
|
125
|
|
125
|
126
|
undi_initialize->Status = PXENV_STATUS_SUCCESS;
|
126
|
127
|
return PXENV_EXIT_SUCCESS;
|
|
@@ -134,10 +135,13 @@ PXENV_EXIT_t pxenv_undi_reset_adapter ( struct s_PXENV_UNDI_RESET
|
134
|
135
|
*undi_reset_adapter ) {
|
135
|
136
|
int rc;
|
136
|
137
|
|
137
|
|
- DBG ( "PXENV_UNDI_RESET_ADAPTER" );
|
|
138
|
+ DBG ( "PXENV_UNDI_RESET_ADAPTER %04x\n",
|
|
139
|
+ undi_reset_adapter->R_Mcast_Buf.MCastAddrCount );
|
138
|
140
|
|
139
|
141
|
pxe_netdev_close();
|
140
|
142
|
if ( ( rc = pxe_netdev_open() ) != 0 ) {
|
|
143
|
+ DBG ( "PXENV_UNDI_RESET_ADAPTER could not reopen %s: %s\n",
|
|
144
|
+ pxe_netdev->name, strerror ( rc ) );
|
141
|
145
|
undi_reset_adapter->Status = PXENV_STATUS ( rc );
|
142
|
146
|
return PXENV_EXIT_FAILURE;
|
143
|
147
|
}
|
|
@@ -152,7 +156,7 @@ PXENV_EXIT_t pxenv_undi_reset_adapter ( struct s_PXENV_UNDI_RESET
|
152
|
156
|
*/
|
153
|
157
|
PXENV_EXIT_t pxenv_undi_shutdown ( struct s_PXENV_UNDI_SHUTDOWN
|
154
|
158
|
*undi_shutdown ) {
|
155
|
|
- DBG ( "PXENV_UNDI_SHUTDOWN" );
|
|
159
|
+ DBG ( "PXENV_UNDI_SHUTDOWN\n" );
|
156
|
160
|
|
157
|
161
|
pxe_netdev_close();
|
158
|
162
|
|
|
@@ -167,9 +171,13 @@ PXENV_EXIT_t pxenv_undi_shutdown ( struct s_PXENV_UNDI_SHUTDOWN
|
167
|
171
|
PXENV_EXIT_t pxenv_undi_open ( struct s_PXENV_UNDI_OPEN *undi_open ) {
|
168
|
172
|
int rc;
|
169
|
173
|
|
170
|
|
- DBG ( "PXENV_UNDI_OPEN" );
|
|
174
|
+ DBG ( "PXENV_UNDI_OPEN flag %04x filter %04x mcast %04x\n",
|
|
175
|
+ undi_open->OpenFlag, undi_open->PktFilter,
|
|
176
|
+ undi_open->R_Mcast_Buf.MCastAddrCount );
|
171
|
177
|
|
172
|
178
|
if ( ( rc = pxe_netdev_open() ) != 0 ) {
|
|
179
|
+ DBG ( "PXENV_UNDI_OPEN could not open %s: %s\n",
|
|
180
|
+ pxe_netdev->name, strerror ( rc ) );
|
173
|
181
|
undi_open->Status = PXENV_STATUS ( rc );
|
174
|
182
|
return PXENV_EXIT_FAILURE;
|
175
|
183
|
}
|
|
@@ -183,7 +191,7 @@ PXENV_EXIT_t pxenv_undi_open ( struct s_PXENV_UNDI_OPEN *undi_open ) {
|
183
|
191
|
* Status: working
|
184
|
192
|
*/
|
185
|
193
|
PXENV_EXIT_t pxenv_undi_close ( struct s_PXENV_UNDI_CLOSE *undi_close ) {
|
186
|
|
- DBG ( "PXENV_UNDI_CLOSE" );
|
|
194
|
+ DBG ( "PXENV_UNDI_CLOSE\n" );
|
187
|
195
|
|
188
|
196
|
pxe_netdev_close();
|
189
|
197
|
|
|
@@ -209,7 +217,7 @@ PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
|
209
|
217
|
unsigned int i;
|
210
|
218
|
int rc;
|
211
|
219
|
|
212
|
|
- DBG ( "PXENV_UNDI_TRANSMIT" );
|
|
220
|
+ DBG2 ( "PXENV_UNDI_TRANSMIT" );
|
213
|
221
|
|
214
|
222
|
/* Forcibly enable interrupts at this point, to work around
|
215
|
223
|
* callers that never call PXENV_UNDI_OPEN before attempting
|
|
@@ -227,25 +235,29 @@ PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
|
227
|
235
|
ll_hlen = 0;
|
228
|
236
|
break;
|
229
|
237
|
default:
|
|
238
|
+ DBG2 ( " %02x invalid protocol\n", undi_transmit->Protocol );
|
230
|
239
|
undi_transmit->Status = PXENV_STATUS_UNDI_INVALID_PARAMETER;
|
231
|
240
|
return PXENV_EXIT_FAILURE;
|
232
|
241
|
}
|
233
|
|
- DBG ( " %s", ( net_protocol ? net_protocol->name : "RAW" ) );
|
|
242
|
+ DBG2 ( " %s", ( net_protocol ? net_protocol->name : "RAW" ) );
|
234
|
243
|
|
235
|
244
|
/* Calculate total packet length */
|
236
|
245
|
copy_from_real ( &tbd, undi_transmit->TBD.segment,
|
237
|
246
|
undi_transmit->TBD.offset, sizeof ( tbd ) );
|
238
|
247
|
len = tbd.ImmedLength;
|
239
|
|
- DBG ( " %d", tbd.ImmedLength );
|
|
248
|
+ DBG2 ( " %04x:%04x+%x", tbd.Xmit.segment, tbd.Xmit.offset,
|
|
249
|
+ tbd.ImmedLength );
|
240
|
250
|
for ( i = 0 ; i < tbd.DataBlkCount ; i++ ) {
|
241
|
251
|
datablk = &tbd.DataBlock[i];
|
242
|
252
|
len += datablk->TDDataLen;
|
243
|
|
- DBG ( "+%d", datablk->TDDataLen );
|
|
253
|
+ DBG2 ( " %04x:%04x+%x", datablk->TDDataPtr.segment,
|
|
254
|
+ datablk->TDDataPtr.offset, datablk->TDDataLen );
|
244
|
255
|
}
|
245
|
256
|
|
246
|
257
|
/* Allocate and fill I/O buffer */
|
247
|
258
|
iobuf = alloc_iob ( ll_hlen + len );
|
248
|
259
|
if ( ! iobuf ) {
|
|
260
|
+ DBG2 ( " could not allocate iobuf\n" );
|
249
|
261
|
undi_transmit->Status = PXENV_STATUS_OUT_OF_RESOURCES;
|
250
|
262
|
return PXENV_EXIT_FAILURE;
|
251
|
263
|
}
|
|
@@ -270,15 +282,18 @@ PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
|
270
|
282
|
undi_transmit->DestAddr.offset,
|
271
|
283
|
ll_protocol->ll_addr_len );
|
272
|
284
|
ll_dest = destaddr;
|
|
285
|
+ DBG2 ( " DEST %s", ll_protocol->ntoa ( ll_dest ) );
|
273
|
286
|
} else {
|
274
|
|
- DBG ( " BCAST" );
|
275
|
287
|
ll_dest = ll_protocol->ll_broadcast;
|
|
288
|
+ DBG2 ( " BCAST" );
|
276
|
289
|
}
|
277
|
290
|
|
278
|
291
|
/* Add link-layer header */
|
279
|
292
|
if ( ( rc = ll_protocol->push ( pxe_netdev, iobuf, ll_dest,
|
280
|
293
|
pxe_netdev->ll_addr,
|
281
|
294
|
net_protocol->net_proto ))!=0){
|
|
295
|
+ DBG2 ( " could not add link-layer header: %s\n",
|
|
296
|
+ strerror ( rc ) );
|
282
|
297
|
free_iob ( iobuf );
|
283
|
298
|
undi_transmit->Status = PXENV_STATUS ( rc );
|
284
|
299
|
return PXENV_EXIT_FAILURE;
|
|
@@ -286,7 +301,10 @@ PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
|
286
|
301
|
}
|
287
|
302
|
|
288
|
303
|
/* Transmit packet */
|
|
304
|
+ DBG2 ( "\n" ); /* ISR may trigger before we return from netdev_tx() */
|
289
|
305
|
if ( ( rc = netdev_tx ( pxe_netdev, iobuf ) ) != 0 ) {
|
|
306
|
+ DBG2 ( "PXENV_UNDI_TRANSMIT could not transmit: %s\n",
|
|
307
|
+ strerror ( rc ) );
|
290
|
308
|
undi_transmit->Status = PXENV_STATUS ( rc );
|
291
|
309
|
return PXENV_EXIT_FAILURE;
|
292
|
310
|
}
|
|
@@ -305,7 +323,8 @@ PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
|
305
|
323
|
PXENV_EXIT_t
|
306
|
324
|
pxenv_undi_set_mcast_address ( struct s_PXENV_UNDI_SET_MCAST_ADDRESS
|
307
|
325
|
*undi_set_mcast_address ) {
|
308
|
|
- DBG ( "PXENV_UNDI_SET_MCAST_ADDRESS" );
|
|
326
|
+ DBG ( "PXENV_UNDI_SET_MCAST_ADDRESS %04x failed: unsupported\n",
|
|
327
|
+ undi_set_mcast_address->R_Mcast_Buf.MCastAddrCount );
|
309
|
328
|
|
310
|
329
|
undi_set_mcast_address->Status = PXENV_STATUS_UNSUPPORTED;
|
311
|
330
|
return PXENV_EXIT_FAILURE;
|
|
@@ -318,13 +337,16 @@ pxenv_undi_set_mcast_address ( struct s_PXENV_UNDI_SET_MCAST_ADDRESS
|
318
|
337
|
PXENV_EXIT_t
|
319
|
338
|
pxenv_undi_set_station_address ( struct s_PXENV_UNDI_SET_STATION_ADDRESS
|
320
|
339
|
*undi_set_station_address ) {
|
|
340
|
+ struct ll_protocol *ll_protocol = pxe_netdev->ll_protocol;
|
321
|
341
|
|
322
|
|
- DBG ( "PXENV_UNDI_SET_STATION_ADDRESS" );
|
|
342
|
+ DBG ( "PXENV_UNDI_SET_STATION_ADDRESS %s",
|
|
343
|
+ ll_protocol->ntoa ( undi_set_station_address->StationAddress ) );
|
323
|
344
|
|
324
|
345
|
/* If adapter is open, the change will have no effect; return
|
325
|
346
|
* an error
|
326
|
347
|
*/
|
327
|
348
|
if ( pxe_netdev->state & NETDEV_OPEN ) {
|
|
349
|
+ DBG ( " failed: netdev is open\n" );
|
328
|
350
|
undi_set_station_address->Status =
|
329
|
351
|
PXENV_STATUS_UNDI_INVALID_STATE;
|
330
|
352
|
return PXENV_EXIT_FAILURE;
|
|
@@ -333,8 +355,9 @@ pxenv_undi_set_station_address ( struct s_PXENV_UNDI_SET_STATION_ADDRESS
|
333
|
355
|
/* Update MAC address */
|
334
|
356
|
memcpy ( pxe_netdev->ll_addr,
|
335
|
357
|
&undi_set_station_address->StationAddress,
|
336
|
|
- pxe_netdev->ll_protocol->ll_addr_len );
|
|
358
|
+ ll_protocol->ll_addr_len );
|
337
|
359
|
|
|
360
|
+ DBG ( "\n" );
|
338
|
361
|
undi_set_station_address->Status = PXENV_STATUS_SUCCESS;
|
339
|
362
|
return PXENV_EXIT_SUCCESS;
|
340
|
363
|
}
|
|
@@ -348,13 +371,13 @@ PXENV_EXIT_t
|
348
|
371
|
pxenv_undi_set_packet_filter ( struct s_PXENV_UNDI_SET_PACKET_FILTER
|
349
|
372
|
*undi_set_packet_filter ) {
|
350
|
373
|
|
351
|
|
- DBG ( "PXENV_UNDI_SET_PACKET_FILTER" );
|
|
374
|
+ DBG ( "PXENV_UNDI_SET_PACKET_FILTER %02x\n",
|
|
375
|
+ undi_set_packet_filter->filter );
|
352
|
376
|
|
353
|
377
|
/* Pretend that we succeeded, otherwise the 3Com DOS UNDI
|
354
|
378
|
* driver refuses to load. (We ignore the filter value in the
|
355
|
379
|
* PXENV_UNDI_OPEN call anyway.)
|
356
|
380
|
*/
|
357
|
|
- DBG ( " %02x", undi_set_packet_filter->filter );
|
358
|
381
|
undi_set_packet_filter->Status = PXENV_STATUS_SUCCESS;
|
359
|
382
|
|
360
|
383
|
return PXENV_EXIT_SUCCESS;
|
|
@@ -395,6 +418,10 @@ PXENV_EXIT_t pxenv_undi_get_information ( struct s_PXENV_UNDI_GET_INFORMATION
|
395
|
418
|
undi_get_information->RxBufCt = 1;
|
396
|
419
|
undi_get_information->TxBufCt = 1;
|
397
|
420
|
|
|
421
|
+ DBG ( " io %04x irq %d mtu %d %s %s\n",
|
|
422
|
+ undi_get_information->BaseIo, undi_get_information->IntNumber,
|
|
423
|
+ undi_get_information->MaxTranUnit, ll_protocol->name,
|
|
424
|
+ ll_protocol->ntoa ( &undi_get_information->CurrentNodeAddress ));
|
398
|
425
|
undi_get_information->Status = PXENV_STATUS_SUCCESS;
|
399
|
426
|
return PXENV_EXIT_SUCCESS;
|
400
|
427
|
}
|
|
@@ -412,6 +439,11 @@ PXENV_EXIT_t pxenv_undi_get_statistics ( struct s_PXENV_UNDI_GET_STATISTICS
|
412
|
439
|
undi_get_statistics->RcvCRCErrors = pxe_netdev->rx_stats.bad;
|
413
|
440
|
undi_get_statistics->RcvResourceErrors = pxe_netdev->rx_stats.bad;
|
414
|
441
|
|
|
442
|
+ DBG ( " txok %d rxok %d rxcrc %d rxrsrc %d\n",
|
|
443
|
+ undi_get_statistics->XmtGoodFrames,
|
|
444
|
+ undi_get_statistics->RcvGoodFrames,
|
|
445
|
+ undi_get_statistics->RcvCRCErrors,
|
|
446
|
+ undi_get_statistics->RcvResourceErrors );
|
415
|
447
|
undi_get_statistics->Status = PXENV_STATUS_SUCCESS;
|
416
|
448
|
return PXENV_EXIT_SUCCESS;
|
417
|
449
|
}
|
|
@@ -422,7 +454,7 @@ PXENV_EXIT_t pxenv_undi_get_statistics ( struct s_PXENV_UNDI_GET_STATISTICS
|
422
|
454
|
*/
|
423
|
455
|
PXENV_EXIT_t pxenv_undi_clear_statistics ( struct s_PXENV_UNDI_CLEAR_STATISTICS
|
424
|
456
|
*undi_clear_statistics ) {
|
425
|
|
- DBG ( "PXENV_UNDI_CLEAR_STATISTICS" );
|
|
457
|
+ DBG ( "PXENV_UNDI_CLEAR_STATISTICS\n" );
|
426
|
458
|
|
427
|
459
|
memset ( &pxe_netdev->tx_stats, 0, sizeof ( pxe_netdev->tx_stats ) );
|
428
|
460
|
memset ( &pxe_netdev->rx_stats, 0, sizeof ( pxe_netdev->rx_stats ) );
|
|
@@ -438,7 +470,7 @@ PXENV_EXIT_t pxenv_undi_clear_statistics ( struct s_PXENV_UNDI_CLEAR_STATISTICS
|
438
|
470
|
*/
|
439
|
471
|
PXENV_EXIT_t pxenv_undi_initiate_diags ( struct s_PXENV_UNDI_INITIATE_DIAGS
|
440
|
472
|
*undi_initiate_diags ) {
|
441
|
|
- DBG ( "PXENV_UNDI_INITIATE_DIAGS" );
|
|
473
|
+ DBG ( "PXENV_UNDI_INITIATE_DIAGS failed: unsupported\n" );
|
442
|
474
|
|
443
|
475
|
undi_initiate_diags->Status = PXENV_STATUS_UNSUPPORTED;
|
444
|
476
|
return PXENV_EXIT_FAILURE;
|
|
@@ -451,7 +483,7 @@ PXENV_EXIT_t pxenv_undi_initiate_diags ( struct s_PXENV_UNDI_INITIATE_DIAGS
|
451
|
483
|
*/
|
452
|
484
|
PXENV_EXIT_t pxenv_undi_force_interrupt ( struct s_PXENV_UNDI_FORCE_INTERRUPT
|
453
|
485
|
*undi_force_interrupt ) {
|
454
|
|
- DBG ( "PXENV_UNDI_FORCE_INTERRUPT" );
|
|
486
|
+ DBG ( "PXENV_UNDI_FORCE_INTERRUPT failed: unsupported\n" );
|
455
|
487
|
|
456
|
488
|
undi_force_interrupt->Status = PXENV_STATUS_UNSUPPORTED;
|
457
|
489
|
return PXENV_EXIT_FAILURE;
|
|
@@ -464,7 +496,10 @@ PXENV_EXIT_t pxenv_undi_force_interrupt ( struct s_PXENV_UNDI_FORCE_INTERRUPT
|
464
|
496
|
PXENV_EXIT_t
|
465
|
497
|
pxenv_undi_get_mcast_address ( struct s_PXENV_UNDI_GET_MCAST_ADDRESS
|
466
|
498
|
*undi_get_mcast_address ) {
|
467
|
|
- DBG ( "PXENV_UNDI_GET_MCAST_ADDRESS" );
|
|
499
|
+ struct in_addr ip = { .s_addr = undi_get_mcast_address->InetAddr };
|
|
500
|
+
|
|
501
|
+ DBG ( "PXENV_UNDI_GET_MCAST_ADDRESS %s failed: unsupported\n",
|
|
502
|
+ inet_ntoa ( ip ) );
|
468
|
503
|
|
469
|
504
|
undi_get_mcast_address->Status = PXENV_STATUS_UNSUPPORTED;
|
470
|
505
|
return PXENV_EXIT_FAILURE;
|
|
@@ -499,6 +534,13 @@ PXENV_EXIT_t pxenv_undi_get_nic_type ( struct s_PXENV_UNDI_GET_NIC_TYPE
|
499
|
534
|
*/
|
500
|
535
|
undi_get_nic_type->info.pci.SubVendor_ID = 0xffff;
|
501
|
536
|
undi_get_nic_type->info.pci.SubDevice_ID = 0xffff;
|
|
537
|
+ DBG ( " PCI %02x:%02x.%x %04x:%04x (%04x:%04x) %02x%02x%02x "
|
|
538
|
+ "rev %02x\n", PCI_BUS ( info->BusDevFunc ),
|
|
539
|
+ PCI_SLOT ( info->BusDevFunc ),
|
|
540
|
+ PCI_FUNC ( info->BusDevFunc ), info->Vendor_ID,
|
|
541
|
+ info->Dev_ID, info->SubVendor_ID, info->SubDevice_ID,
|
|
542
|
+ info->Base_Class, info->Sub_Class, info->Prog_Intf,
|
|
543
|
+ info->Rev );
|
502
|
544
|
break; }
|
503
|
545
|
case BUS_TYPE_ISAPNP: {
|
504
|
546
|
struct pnp_nic_info *info = &undi_get_nic_type->info.pnp;
|
|
@@ -510,8 +552,12 @@ PXENV_EXIT_t pxenv_undi_get_nic_type ( struct s_PXENV_UNDI_GET_NIC_TYPE
|
510
|
552
|
/* Cheat: remaining fields are probably unnecessary,
|
511
|
553
|
* and would require adding extra code to isapnp.c.
|
512
|
554
|
*/
|
|
555
|
+ DBG ( " ISAPnP CSN %04x %08x %02x%02x%02x\n",
|
|
556
|
+ info->CardSelNum, info->EISA_Dev_ID,
|
|
557
|
+ info->Base_Class, info->Sub_Class, info->Prog_Intf );
|
513
|
558
|
break; }
|
514
|
559
|
default:
|
|
560
|
+ DBG ( " failed: unknown bus type\n" );
|
515
|
561
|
undi_get_nic_type->Status = PXENV_STATUS_FAILURE;
|
516
|
562
|
return PXENV_EXIT_FAILURE;
|
517
|
563
|
}
|
|
@@ -541,6 +587,9 @@ PXENV_EXIT_t pxenv_undi_get_iface_info ( struct s_PXENV_UNDI_GET_IFACE_INFO
|
541
|
587
|
memset ( undi_get_iface_info->Reserved, 0,
|
542
|
588
|
sizeof(undi_get_iface_info->Reserved) );
|
543
|
589
|
|
|
590
|
+ DBG ( " %s %dbps flags %08x\n", undi_get_iface_info->IfaceType,
|
|
591
|
+ undi_get_iface_info->LinkSpeed,
|
|
592
|
+ undi_get_iface_info->ServiceFlags );
|
544
|
593
|
undi_get_iface_info->Status = PXENV_STATUS_SUCCESS;
|
545
|
594
|
return PXENV_EXIT_SUCCESS;
|
546
|
595
|
}
|
|
@@ -551,7 +600,7 @@ PXENV_EXIT_t pxenv_undi_get_iface_info ( struct s_PXENV_UNDI_GET_IFACE_INFO
|
551
|
600
|
*/
|
552
|
601
|
PXENV_EXIT_t pxenv_undi_get_state ( struct s_PXENV_UNDI_GET_STATE
|
553
|
602
|
*undi_get_state ) {
|
554
|
|
- DBG ( "PXENV_UNDI_GET_STATE" );
|
|
603
|
+ DBG ( "PXENV_UNDI_GET_STATE failed: unsupported\n" );
|
555
|
604
|
|
556
|
605
|
undi_get_state->Status = PXENV_STATUS_UNSUPPORTED;
|
557
|
606
|
return PXENV_EXIT_FAILURE;
|
|
@@ -573,7 +622,10 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
|
573
|
622
|
unsigned int prottype;
|
574
|
623
|
int rc;
|
575
|
624
|
|
576
|
|
- DBG ( "PXENV_UNDI_ISR" );
|
|
625
|
+ /* Use coloured debug, since UNDI ISR messages are likely to
|
|
626
|
+ * be interspersed amongst other UNDI messages.
|
|
627
|
+ */
|
|
628
|
+ DBGC2 ( &pxenv_undi_isr, "PXENV_UNDI_ISR" );
|
577
|
629
|
|
578
|
630
|
/* Just in case some idiot actually looks at these fields when
|
579
|
631
|
* we weren't meant to fill them in...
|
|
@@ -586,7 +638,7 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
|
586
|
638
|
|
587
|
639
|
switch ( undi_isr->FuncFlag ) {
|
588
|
640
|
case PXENV_UNDI_ISR_IN_START :
|
589
|
|
- DBG ( " START" );
|
|
641
|
+ DBGC2 ( &pxenv_undi_isr, " START" );
|
590
|
642
|
|
591
|
643
|
/* Call poll(). This should acknowledge the device
|
592
|
644
|
* interrupt and queue up any received packet.
|
|
@@ -597,13 +649,14 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
|
597
|
649
|
netdev_irq ( pxe_netdev, 0 );
|
598
|
650
|
|
599
|
651
|
/* Always say it was ours for the sake of simplicity */
|
|
652
|
+ DBGC2 ( &pxenv_undi_isr, " OURS" );
|
600
|
653
|
undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_OURS;
|
601
|
654
|
break;
|
602
|
655
|
case PXENV_UNDI_ISR_IN_PROCESS :
|
603
|
|
- DBG ( " PROCESS" );
|
604
|
|
- /* Fall through */
|
605
|
656
|
case PXENV_UNDI_ISR_IN_GET_NEXT :
|
606
|
|
- DBG ( " GET_NEXT" );
|
|
657
|
+ DBGC2 ( &pxenv_undi_isr, " %s",
|
|
658
|
+ ( ( undi_isr->FuncFlag == PXENV_UNDI_ISR_IN_PROCESS ) ?
|
|
659
|
+ "PROCESS" : "GET_NEXT" ) );
|
607
|
660
|
|
608
|
661
|
/* Some dumb NBPs (e.g. emBoot's winBoot/i) never call
|
609
|
662
|
* PXENV_UNDI_ISR with FuncFlag=PXENV_UNDI_ISR_START;
|
|
@@ -618,7 +671,7 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
|
618
|
671
|
* netdev TX queue is empty, report the TX completion.
|
619
|
672
|
*/
|
620
|
673
|
if ( undi_tx_count && list_empty ( &pxe_netdev->tx_queue ) ) {
|
621
|
|
- DBG ( " TXC" );
|
|
674
|
+ DBGC2 ( &pxenv_undi_isr, " TXC" );
|
622
|
675
|
undi_tx_count--;
|
623
|
676
|
undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_TRANSMIT;
|
624
|
677
|
break;
|
|
@@ -627,7 +680,7 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
|
627
|
680
|
/* Remove first packet from netdev RX queue */
|
628
|
681
|
iobuf = netdev_rx_dequeue ( pxe_netdev );
|
629
|
682
|
if ( ! iobuf ) {
|
630
|
|
- DBG ( " DONE" );
|
|
683
|
+ DBGC2 ( &pxenv_undi_isr, " DONE" );
|
631
|
684
|
/* No more packets remaining */
|
632
|
685
|
undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_DONE;
|
633
|
686
|
/* Re-enable interrupts */
|
|
@@ -637,9 +690,10 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
|
637
|
690
|
|
638
|
691
|
/* Copy packet to base memory buffer */
|
639
|
692
|
len = iob_len ( iobuf );
|
640
|
|
- DBG ( " RX %zd", len );
|
|
693
|
+ DBGC2 ( &pxenv_undi_isr, " RX" );
|
641
|
694
|
if ( len > sizeof ( basemem_packet ) ) {
|
642
|
695
|
/* Should never happen */
|
|
696
|
+ DBGC2 ( &pxenv_undi_isr, " overlength (%x)", len );
|
643
|
697
|
len = sizeof ( basemem_packet );
|
644
|
698
|
}
|
645
|
699
|
memcpy ( basemem_packet, iobuf->data, len );
|
|
@@ -673,7 +727,6 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
|
673
|
727
|
prottype = P_UNKNOWN;
|
674
|
728
|
break;
|
675
|
729
|
}
|
676
|
|
- DBG ( " %s", ( net_protocol ? net_protocol->name : "RAW" ) );
|
677
|
730
|
|
678
|
731
|
/* Fill in UNDI_ISR structure */
|
679
|
732
|
undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_RECEIVE;
|
|
@@ -684,12 +737,18 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
|
684
|
737
|
undi_isr->Frame.offset = __from_data16 ( basemem_packet );
|
685
|
738
|
undi_isr->ProtType = prottype;
|
686
|
739
|
undi_isr->PktType = XMT_DESTADDR;
|
|
740
|
+ DBGC2 ( &pxenv_undi_isr, " %04x:%04x+%x(%x) %s hlen %d",
|
|
741
|
+ undi_isr->Frame.segment, undi_isr->Frame.offset,
|
|
742
|
+ undi_isr->BufferLength, undi_isr->FrameLength,
|
|
743
|
+ ( net_protocol ? net_protocol->name : "RAW" ),
|
|
744
|
+ undi_isr->FrameHeaderLength );
|
687
|
745
|
|
688
|
746
|
/* Free packet */
|
689
|
747
|
free_iob ( iobuf );
|
690
|
748
|
break;
|
691
|
749
|
default :
|
692
|
|
- DBG ( " INVALID(%04x)", undi_isr->FuncFlag );
|
|
750
|
+ DBGC2 ( &pxenv_undi_isr, " INVALID(%04x)\n",
|
|
751
|
+ undi_isr->FuncFlag );
|
693
|
752
|
|
694
|
753
|
/* Should never happen */
|
695
|
754
|
undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_DONE;
|
|
@@ -697,6 +756,7 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
|
697
|
756
|
return PXENV_EXIT_FAILURE;
|
698
|
757
|
}
|
699
|
758
|
|
|
759
|
+ DBGC2 ( &pxenv_undi_isr, "\n" );
|
700
|
760
|
undi_isr->Status = PXENV_STATUS_SUCCESS;
|
701
|
761
|
return PXENV_EXIT_SUCCESS;
|
702
|
762
|
}
|