Browse Source

[pxe] Improve pxe_undi debug messages

The PXE debugging messages have remained pretty much unaltered since
Etherboot 5.4, and are now difficult to read in comparison to most of
the rest of gPXE.

Bring the pxe_undi debug messages up to normal gPXE standards.
tags/v0.9.8
Michael Brown 15 years ago
parent
commit
9580f9d5cd
2 changed files with 93 additions and 32 deletions
  1. 92
    32
      src/arch/i386/interface/pxe/pxe_undi.c
  2. 1
    0
      src/include/gpxe/pci.h

+ 92
- 32
src/arch/i386/interface/pxe/pxe_undi.c View File

95
  * Status: working
95
  * Status: working
96
  */
96
  */
97
 PXENV_EXIT_t pxenv_undi_startup ( struct s_PXENV_UNDI_STARTUP *undi_startup ) {
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
 	undi_startup->Status = PXENV_STATUS_SUCCESS;
100
 	undi_startup->Status = PXENV_STATUS_SUCCESS;
101
 	return PXENV_EXIT_SUCCESS;
101
 	return PXENV_EXIT_SUCCESS;
106
  * Status: working
106
  * Status: working
107
  */
107
  */
108
 PXENV_EXIT_t pxenv_undi_cleanup ( struct s_PXENV_UNDI_CLEANUP *undi_cleanup ) {
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
 	pxe_netdev_close();
111
 	pxe_netdev_close();
112
 
112
 
120
  */
120
  */
121
 PXENV_EXIT_t pxenv_undi_initialize ( struct s_PXENV_UNDI_INITIALIZE
121
 PXENV_EXIT_t pxenv_undi_initialize ( struct s_PXENV_UNDI_INITIALIZE
122
 				     *undi_initialize ) {
122
 				     *undi_initialize ) {
123
-	DBG ( "PXENV_UNDI_INITIALIZE" );
123
+	DBG ( "PXENV_UNDI_INITIALIZE protocolini %08x\n",
124
+	      undi_initialize->ProtocolIni );
124
 
125
 
125
 	undi_initialize->Status = PXENV_STATUS_SUCCESS;
126
 	undi_initialize->Status = PXENV_STATUS_SUCCESS;
126
 	return PXENV_EXIT_SUCCESS;
127
 	return PXENV_EXIT_SUCCESS;
134
 					*undi_reset_adapter ) {
135
 					*undi_reset_adapter ) {
135
 	int rc;
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
 	pxe_netdev_close();
141
 	pxe_netdev_close();
140
 	if ( ( rc = pxe_netdev_open() ) != 0 ) {
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
 		undi_reset_adapter->Status = PXENV_STATUS ( rc );
145
 		undi_reset_adapter->Status = PXENV_STATUS ( rc );
142
 		return PXENV_EXIT_FAILURE;
146
 		return PXENV_EXIT_FAILURE;
143
 	}
147
 	}
152
  */
156
  */
153
 PXENV_EXIT_t pxenv_undi_shutdown ( struct s_PXENV_UNDI_SHUTDOWN
157
 PXENV_EXIT_t pxenv_undi_shutdown ( struct s_PXENV_UNDI_SHUTDOWN
154
 				   *undi_shutdown ) {
158
 				   *undi_shutdown ) {
155
-	DBG ( "PXENV_UNDI_SHUTDOWN" );
159
+	DBG ( "PXENV_UNDI_SHUTDOWN\n" );
156
 
160
 
157
 	pxe_netdev_close();
161
 	pxe_netdev_close();
158
 
162
 
167
 PXENV_EXIT_t pxenv_undi_open ( struct s_PXENV_UNDI_OPEN *undi_open ) {
171
 PXENV_EXIT_t pxenv_undi_open ( struct s_PXENV_UNDI_OPEN *undi_open ) {
168
 	int rc;
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
 	if ( ( rc = pxe_netdev_open() ) != 0 ) {
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
 		undi_open->Status = PXENV_STATUS ( rc );
181
 		undi_open->Status = PXENV_STATUS ( rc );
174
 		return PXENV_EXIT_FAILURE;
182
 		return PXENV_EXIT_FAILURE;
175
 	}
183
 	}
183
  * Status: working
191
  * Status: working
184
  */
192
  */
185
 PXENV_EXIT_t pxenv_undi_close ( struct s_PXENV_UNDI_CLOSE *undi_close ) {
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
 	pxe_netdev_close();
196
 	pxe_netdev_close();
189
 
197
 
209
 	unsigned int i;
217
 	unsigned int i;
210
 	int rc;
218
 	int rc;
211
 
219
 
212
-	DBG ( "PXENV_UNDI_TRANSMIT" );
220
+	DBG2 ( "PXENV_UNDI_TRANSMIT" );
213
 
221
 
214
 	/* Forcibly enable interrupts at this point, to work around
222
 	/* Forcibly enable interrupts at this point, to work around
215
 	 * callers that never call PXENV_UNDI_OPEN before attempting
223
 	 * callers that never call PXENV_UNDI_OPEN before attempting
227
 		ll_hlen = 0;
235
 		ll_hlen = 0;
228
 		break;
236
 		break;
229
 	default:
237
 	default:
238
+		DBG2 ( " %02x invalid protocol\n", undi_transmit->Protocol );
230
 		undi_transmit->Status = PXENV_STATUS_UNDI_INVALID_PARAMETER;
239
 		undi_transmit->Status = PXENV_STATUS_UNDI_INVALID_PARAMETER;
231
 		return PXENV_EXIT_FAILURE;
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
 	/* Calculate total packet length */
244
 	/* Calculate total packet length */
236
 	copy_from_real ( &tbd, undi_transmit->TBD.segment,
245
 	copy_from_real ( &tbd, undi_transmit->TBD.segment,
237
 			 undi_transmit->TBD.offset, sizeof ( tbd ) );
246
 			 undi_transmit->TBD.offset, sizeof ( tbd ) );
238
 	len = tbd.ImmedLength;
247
 	len = tbd.ImmedLength;
239
-	DBG ( " %d", tbd.ImmedLength );
248
+	DBG2 ( " %04x:%04x+%x", tbd.Xmit.segment, tbd.Xmit.offset,
249
+	       tbd.ImmedLength );
240
 	for ( i = 0 ; i < tbd.DataBlkCount ; i++ ) {
250
 	for ( i = 0 ; i < tbd.DataBlkCount ; i++ ) {
241
 		datablk = &tbd.DataBlock[i];
251
 		datablk = &tbd.DataBlock[i];
242
 		len += datablk->TDDataLen;
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
 	/* Allocate and fill I/O buffer */
257
 	/* Allocate and fill I/O buffer */
247
 	iobuf = alloc_iob ( ll_hlen + len );
258
 	iobuf = alloc_iob ( ll_hlen + len );
248
 	if ( ! iobuf ) {
259
 	if ( ! iobuf ) {
260
+		DBG2 ( " could not allocate iobuf\n" );
249
 		undi_transmit->Status = PXENV_STATUS_OUT_OF_RESOURCES;
261
 		undi_transmit->Status = PXENV_STATUS_OUT_OF_RESOURCES;
250
 		return PXENV_EXIT_FAILURE;
262
 		return PXENV_EXIT_FAILURE;
251
 	}
263
 	}
270
 					 undi_transmit->DestAddr.offset,
282
 					 undi_transmit->DestAddr.offset,
271
 					 ll_protocol->ll_addr_len );
283
 					 ll_protocol->ll_addr_len );
272
 			ll_dest = destaddr;
284
 			ll_dest = destaddr;
285
+			DBG2 ( " DEST %s", ll_protocol->ntoa ( ll_dest ) );
273
 		} else {
286
 		} else {
274
-			DBG ( " BCAST" );
275
 			ll_dest = ll_protocol->ll_broadcast;
287
 			ll_dest = ll_protocol->ll_broadcast;
288
+			DBG2 ( " BCAST" );
276
 		}
289
 		}
277
 
290
 
278
 		/* Add link-layer header */
291
 		/* Add link-layer header */
279
 		if ( ( rc = ll_protocol->push ( pxe_netdev, iobuf, ll_dest,
292
 		if ( ( rc = ll_protocol->push ( pxe_netdev, iobuf, ll_dest,
280
 						pxe_netdev->ll_addr,
293
 						pxe_netdev->ll_addr,
281
 						net_protocol->net_proto ))!=0){
294
 						net_protocol->net_proto ))!=0){
295
+			DBG2 ( " could not add link-layer header: %s\n",
296
+			       strerror ( rc ) );
282
 			free_iob ( iobuf );
297
 			free_iob ( iobuf );
283
 			undi_transmit->Status = PXENV_STATUS ( rc );
298
 			undi_transmit->Status = PXENV_STATUS ( rc );
284
 			return PXENV_EXIT_FAILURE;
299
 			return PXENV_EXIT_FAILURE;
286
 	}
301
 	}
287
 
302
 
288
 	/* Transmit packet */
303
 	/* Transmit packet */
304
+	DBG2 ( "\n" ); /* ISR may trigger before we return from netdev_tx() */
289
 	if ( ( rc = netdev_tx ( pxe_netdev, iobuf ) ) != 0 ) {
305
 	if ( ( rc = netdev_tx ( pxe_netdev, iobuf ) ) != 0 ) {
306
+		DBG2 ( "PXENV_UNDI_TRANSMIT could not transmit: %s\n",
307
+		       strerror ( rc ) );
290
 		undi_transmit->Status = PXENV_STATUS ( rc );
308
 		undi_transmit->Status = PXENV_STATUS ( rc );
291
 		return PXENV_EXIT_FAILURE;
309
 		return PXENV_EXIT_FAILURE;
292
 	}
310
 	}
305
 PXENV_EXIT_t
323
 PXENV_EXIT_t
306
 pxenv_undi_set_mcast_address ( struct s_PXENV_UNDI_SET_MCAST_ADDRESS
324
 pxenv_undi_set_mcast_address ( struct s_PXENV_UNDI_SET_MCAST_ADDRESS
307
 			       *undi_set_mcast_address ) {
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
 	undi_set_mcast_address->Status = PXENV_STATUS_UNSUPPORTED;
329
 	undi_set_mcast_address->Status = PXENV_STATUS_UNSUPPORTED;
311
 	return PXENV_EXIT_FAILURE;
330
 	return PXENV_EXIT_FAILURE;
318
 PXENV_EXIT_t 
337
 PXENV_EXIT_t 
319
 pxenv_undi_set_station_address ( struct s_PXENV_UNDI_SET_STATION_ADDRESS
338
 pxenv_undi_set_station_address ( struct s_PXENV_UNDI_SET_STATION_ADDRESS
320
 				 *undi_set_station_address ) {
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
 	/* If adapter is open, the change will have no effect; return
345
 	/* If adapter is open, the change will have no effect; return
325
 	 * an error
346
 	 * an error
326
 	 */
347
 	 */
327
 	if ( pxe_netdev->state & NETDEV_OPEN ) {
348
 	if ( pxe_netdev->state & NETDEV_OPEN ) {
349
+		DBG ( " failed: netdev is open\n" );
328
 		undi_set_station_address->Status =
350
 		undi_set_station_address->Status =
329
 			PXENV_STATUS_UNDI_INVALID_STATE;
351
 			PXENV_STATUS_UNDI_INVALID_STATE;
330
 		return PXENV_EXIT_FAILURE;
352
 		return PXENV_EXIT_FAILURE;
333
 	/* Update MAC address */
355
 	/* Update MAC address */
334
 	memcpy ( pxe_netdev->ll_addr,
356
 	memcpy ( pxe_netdev->ll_addr,
335
 		 &undi_set_station_address->StationAddress,
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
 	undi_set_station_address->Status = PXENV_STATUS_SUCCESS;
361
 	undi_set_station_address->Status = PXENV_STATUS_SUCCESS;
339
 	return PXENV_EXIT_SUCCESS;
362
 	return PXENV_EXIT_SUCCESS;
340
 }
363
 }
348
 pxenv_undi_set_packet_filter ( struct s_PXENV_UNDI_SET_PACKET_FILTER
371
 pxenv_undi_set_packet_filter ( struct s_PXENV_UNDI_SET_PACKET_FILTER
349
 			       *undi_set_packet_filter ) {
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
 	/* Pretend that we succeeded, otherwise the 3Com DOS UNDI
377
 	/* Pretend that we succeeded, otherwise the 3Com DOS UNDI
354
 	 * driver refuses to load.  (We ignore the filter value in the
378
 	 * driver refuses to load.  (We ignore the filter value in the
355
 	 * PXENV_UNDI_OPEN call anyway.)
379
 	 * PXENV_UNDI_OPEN call anyway.)
356
 	 */
380
 	 */
357
-	DBG ( " %02x", undi_set_packet_filter->filter );
358
 	undi_set_packet_filter->Status = PXENV_STATUS_SUCCESS;
381
 	undi_set_packet_filter->Status = PXENV_STATUS_SUCCESS;
359
 
382
 
360
 	return PXENV_EXIT_SUCCESS;
383
 	return PXENV_EXIT_SUCCESS;
395
 	undi_get_information->RxBufCt = 1;
418
 	undi_get_information->RxBufCt = 1;
396
 	undi_get_information->TxBufCt = 1;
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
 	undi_get_information->Status = PXENV_STATUS_SUCCESS;
425
 	undi_get_information->Status = PXENV_STATUS_SUCCESS;
399
 	return PXENV_EXIT_SUCCESS;
426
 	return PXENV_EXIT_SUCCESS;
400
 }
427
 }
412
 	undi_get_statistics->RcvCRCErrors = pxe_netdev->rx_stats.bad;
439
 	undi_get_statistics->RcvCRCErrors = pxe_netdev->rx_stats.bad;
413
 	undi_get_statistics->RcvResourceErrors = pxe_netdev->rx_stats.bad;
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
 	undi_get_statistics->Status = PXENV_STATUS_SUCCESS;
447
 	undi_get_statistics->Status = PXENV_STATUS_SUCCESS;
416
 	return PXENV_EXIT_SUCCESS;
448
 	return PXENV_EXIT_SUCCESS;
417
 }
449
 }
422
  */
454
  */
423
 PXENV_EXIT_t pxenv_undi_clear_statistics ( struct s_PXENV_UNDI_CLEAR_STATISTICS
455
 PXENV_EXIT_t pxenv_undi_clear_statistics ( struct s_PXENV_UNDI_CLEAR_STATISTICS
424
 					   *undi_clear_statistics ) {
456
 					   *undi_clear_statistics ) {
425
-	DBG ( "PXENV_UNDI_CLEAR_STATISTICS" );
457
+	DBG ( "PXENV_UNDI_CLEAR_STATISTICS\n" );
426
 
458
 
427
 	memset ( &pxe_netdev->tx_stats, 0, sizeof ( pxe_netdev->tx_stats ) );
459
 	memset ( &pxe_netdev->tx_stats, 0, sizeof ( pxe_netdev->tx_stats ) );
428
 	memset ( &pxe_netdev->rx_stats, 0, sizeof ( pxe_netdev->rx_stats ) );
460
 	memset ( &pxe_netdev->rx_stats, 0, sizeof ( pxe_netdev->rx_stats ) );
438
  */
470
  */
439
 PXENV_EXIT_t pxenv_undi_initiate_diags ( struct s_PXENV_UNDI_INITIATE_DIAGS
471
 PXENV_EXIT_t pxenv_undi_initiate_diags ( struct s_PXENV_UNDI_INITIATE_DIAGS
440
 					 *undi_initiate_diags ) {
472
 					 *undi_initiate_diags ) {
441
-	DBG ( "PXENV_UNDI_INITIATE_DIAGS" );
473
+	DBG ( "PXENV_UNDI_INITIATE_DIAGS failed: unsupported\n" );
442
 
474
 
443
 	undi_initiate_diags->Status = PXENV_STATUS_UNSUPPORTED;
475
 	undi_initiate_diags->Status = PXENV_STATUS_UNSUPPORTED;
444
 	return PXENV_EXIT_FAILURE;
476
 	return PXENV_EXIT_FAILURE;
451
  */
483
  */
452
 PXENV_EXIT_t pxenv_undi_force_interrupt ( struct s_PXENV_UNDI_FORCE_INTERRUPT
484
 PXENV_EXIT_t pxenv_undi_force_interrupt ( struct s_PXENV_UNDI_FORCE_INTERRUPT
453
 					  *undi_force_interrupt ) {
485
 					  *undi_force_interrupt ) {
454
-	DBG ( "PXENV_UNDI_FORCE_INTERRUPT" );
486
+	DBG ( "PXENV_UNDI_FORCE_INTERRUPT failed: unsupported\n" );
455
 
487
 
456
 	undi_force_interrupt->Status = PXENV_STATUS_UNSUPPORTED;
488
 	undi_force_interrupt->Status = PXENV_STATUS_UNSUPPORTED;
457
 	return PXENV_EXIT_FAILURE;
489
 	return PXENV_EXIT_FAILURE;
464
 PXENV_EXIT_t
496
 PXENV_EXIT_t
465
 pxenv_undi_get_mcast_address ( struct s_PXENV_UNDI_GET_MCAST_ADDRESS
497
 pxenv_undi_get_mcast_address ( struct s_PXENV_UNDI_GET_MCAST_ADDRESS
466
 			       *undi_get_mcast_address ) {
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
 	undi_get_mcast_address->Status = PXENV_STATUS_UNSUPPORTED;
504
 	undi_get_mcast_address->Status = PXENV_STATUS_UNSUPPORTED;
470
 	return PXENV_EXIT_FAILURE;
505
 	return PXENV_EXIT_FAILURE;
499
 		 */
534
 		 */
500
 		undi_get_nic_type->info.pci.SubVendor_ID = 0xffff;
535
 		undi_get_nic_type->info.pci.SubVendor_ID = 0xffff;
501
 		undi_get_nic_type->info.pci.SubDevice_ID = 0xffff;
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
 		break; }
544
 		break; }
503
 	case BUS_TYPE_ISAPNP: {
545
 	case BUS_TYPE_ISAPNP: {
504
 		struct pnp_nic_info *info = &undi_get_nic_type->info.pnp;
546
 		struct pnp_nic_info *info = &undi_get_nic_type->info.pnp;
510
 		/* Cheat: remaining fields are probably unnecessary,
552
 		/* Cheat: remaining fields are probably unnecessary,
511
 		 * and would require adding extra code to isapnp.c.
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
 		break; }
558
 		break; }
514
 	default:
559
 	default:
560
+		DBG ( " failed: unknown bus type\n" );
515
 		undi_get_nic_type->Status = PXENV_STATUS_FAILURE;
561
 		undi_get_nic_type->Status = PXENV_STATUS_FAILURE;
516
 		return PXENV_EXIT_FAILURE;
562
 		return PXENV_EXIT_FAILURE;
517
 	}
563
 	}
541
 	memset ( undi_get_iface_info->Reserved, 0,
587
 	memset ( undi_get_iface_info->Reserved, 0,
542
 		 sizeof(undi_get_iface_info->Reserved) );
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
 	undi_get_iface_info->Status = PXENV_STATUS_SUCCESS;
593
 	undi_get_iface_info->Status = PXENV_STATUS_SUCCESS;
545
 	return PXENV_EXIT_SUCCESS;
594
 	return PXENV_EXIT_SUCCESS;
546
 }
595
 }
551
  */
600
  */
552
 PXENV_EXIT_t pxenv_undi_get_state ( struct s_PXENV_UNDI_GET_STATE
601
 PXENV_EXIT_t pxenv_undi_get_state ( struct s_PXENV_UNDI_GET_STATE
553
 				    *undi_get_state ) {
602
 				    *undi_get_state ) {
554
-	DBG ( "PXENV_UNDI_GET_STATE" );
603
+	DBG ( "PXENV_UNDI_GET_STATE failed: unsupported\n" );
555
 
604
 
556
 	undi_get_state->Status = PXENV_STATUS_UNSUPPORTED;
605
 	undi_get_state->Status = PXENV_STATUS_UNSUPPORTED;
557
 	return PXENV_EXIT_FAILURE;
606
 	return PXENV_EXIT_FAILURE;
573
 	unsigned int prottype;
622
 	unsigned int prottype;
574
 	int rc;
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
 	/* Just in case some idiot actually looks at these fields when
630
 	/* Just in case some idiot actually looks at these fields when
579
 	 * we weren't meant to fill them in...
631
 	 * we weren't meant to fill them in...
586
 
638
 
587
 	switch ( undi_isr->FuncFlag ) {
639
 	switch ( undi_isr->FuncFlag ) {
588
 	case PXENV_UNDI_ISR_IN_START :
640
 	case PXENV_UNDI_ISR_IN_START :
589
-		DBG ( " START" );
641
+		DBGC2 ( &pxenv_undi_isr, " START" );
590
 
642
 
591
 		/* Call poll().  This should acknowledge the device
643
 		/* Call poll().  This should acknowledge the device
592
 		 * interrupt and queue up any received packet.
644
 		 * interrupt and queue up any received packet.
597
 		netdev_irq ( pxe_netdev, 0 );
649
 		netdev_irq ( pxe_netdev, 0 );
598
 
650
 
599
 		/* Always say it was ours for the sake of simplicity */
651
 		/* Always say it was ours for the sake of simplicity */
652
+		DBGC2 ( &pxenv_undi_isr, " OURS" );
600
 		undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_OURS;
653
 		undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_OURS;
601
 		break;
654
 		break;
602
 	case PXENV_UNDI_ISR_IN_PROCESS :
655
 	case PXENV_UNDI_ISR_IN_PROCESS :
603
-		DBG ( " PROCESS" );
604
-		/* Fall through */
605
 	case PXENV_UNDI_ISR_IN_GET_NEXT :
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
 		/* Some dumb NBPs (e.g. emBoot's winBoot/i) never call
661
 		/* Some dumb NBPs (e.g. emBoot's winBoot/i) never call
609
 		 * PXENV_UNDI_ISR with FuncFlag=PXENV_UNDI_ISR_START;
662
 		 * PXENV_UNDI_ISR with FuncFlag=PXENV_UNDI_ISR_START;
618
 		 * netdev TX queue is empty, report the TX completion.
671
 		 * netdev TX queue is empty, report the TX completion.
619
 		 */
672
 		 */
620
 		if ( undi_tx_count && list_empty ( &pxe_netdev->tx_queue ) ) {
673
 		if ( undi_tx_count && list_empty ( &pxe_netdev->tx_queue ) ) {
621
-			DBG ( " TXC" );
674
+			DBGC2 ( &pxenv_undi_isr, " TXC" );
622
 			undi_tx_count--;
675
 			undi_tx_count--;
623
 			undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_TRANSMIT;
676
 			undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_TRANSMIT;
624
 			break;
677
 			break;
627
 		/* Remove first packet from netdev RX queue */
680
 		/* Remove first packet from netdev RX queue */
628
 		iobuf = netdev_rx_dequeue ( pxe_netdev );
681
 		iobuf = netdev_rx_dequeue ( pxe_netdev );
629
 		if ( ! iobuf ) {
682
 		if ( ! iobuf ) {
630
-			DBG ( " DONE" );
683
+			DBGC2 ( &pxenv_undi_isr, " DONE" );
631
 			/* No more packets remaining */
684
 			/* No more packets remaining */
632
 			undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_DONE;
685
 			undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_DONE;
633
 			/* Re-enable interrupts */
686
 			/* Re-enable interrupts */
637
 
690
 
638
 		/* Copy packet to base memory buffer */
691
 		/* Copy packet to base memory buffer */
639
 		len = iob_len ( iobuf );
692
 		len = iob_len ( iobuf );
640
-		DBG ( " RX %zd", len );
693
+		DBGC2 ( &pxenv_undi_isr, " RX" );
641
 		if ( len > sizeof ( basemem_packet ) ) {
694
 		if ( len > sizeof ( basemem_packet ) ) {
642
 			/* Should never happen */
695
 			/* Should never happen */
696
+			DBGC2 ( &pxenv_undi_isr, " overlength (%x)", len );
643
 			len = sizeof ( basemem_packet );
697
 			len = sizeof ( basemem_packet );
644
 		}
698
 		}
645
 		memcpy ( basemem_packet, iobuf->data, len );
699
 		memcpy ( basemem_packet, iobuf->data, len );
673
 			prottype = P_UNKNOWN;
727
 			prottype = P_UNKNOWN;
674
 			break;
728
 			break;
675
 		}
729
 		}
676
-		DBG ( " %s", ( net_protocol ? net_protocol->name : "RAW" ) );
677
 
730
 
678
 		/* Fill in UNDI_ISR structure */
731
 		/* Fill in UNDI_ISR structure */
679
 		undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_RECEIVE;
732
 		undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_RECEIVE;
684
 		undi_isr->Frame.offset = __from_data16 ( basemem_packet );
737
 		undi_isr->Frame.offset = __from_data16 ( basemem_packet );
685
 		undi_isr->ProtType = prottype;
738
 		undi_isr->ProtType = prottype;
686
 		undi_isr->PktType = XMT_DESTADDR;
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
 		/* Free packet */
746
 		/* Free packet */
689
 		free_iob ( iobuf );
747
 		free_iob ( iobuf );
690
 		break;
748
 		break;
691
 	default :
749
 	default :
692
-		DBG ( " INVALID(%04x)", undi_isr->FuncFlag );
750
+		DBGC2 ( &pxenv_undi_isr, " INVALID(%04x)\n",
751
+			undi_isr->FuncFlag );
693
 
752
 
694
 		/* Should never happen */
753
 		/* Should never happen */
695
 		undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_DONE;
754
 		undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_DONE;
697
 		return PXENV_EXIT_FAILURE;
756
 		return PXENV_EXIT_FAILURE;
698
 	}
757
 	}
699
 
758
 
759
+	DBGC2 ( &pxenv_undi_isr, "\n" );
700
 	undi_isr->Status = PXENV_STATUS_SUCCESS;
760
 	undi_isr->Status = PXENV_STATUS_SUCCESS;
701
 	return PXENV_EXIT_SUCCESS;
761
 	return PXENV_EXIT_SUCCESS;
702
 }
762
 }

+ 1
- 0
src/include/gpxe/pci.h View File

321
 #define PCI_DEVFN( slot, func )		( ( (slot) << 3 ) | (func) )
321
 #define PCI_DEVFN( slot, func )		( ( (slot) << 3 ) | (func) )
322
 #define PCI_SLOT( devfn )		( ( (devfn) >> 3 ) & 0x1f )
322
 #define PCI_SLOT( devfn )		( ( (devfn) >> 3 ) & 0x1f )
323
 #define PCI_FUNC( devfn )		( (devfn) & 0x07 )
323
 #define PCI_FUNC( devfn )		( (devfn) & 0x07 )
324
+#define PCI_BUS( busdevfn )		( (busdevfn) >> 8 )
324
 #define PCI_BUSDEVFN( bus, devfn )	( ( (bus) << 8 ) | (devfn) )
325
 #define PCI_BUSDEVFN( bus, devfn )	( ( (bus) << 8 ) | (devfn) )
325
 
326
 
326
 #define PCI_BASE_CLASS( class )		( (class) >> 16 )
327
 #define PCI_BASE_CLASS( class )		( (class) >> 16 )

Loading…
Cancel
Save