Ver código fonte

[efi] Standardise PCI debug messages

Use the PCI bus:dev.fn address in debug messages, falling back to the
EFI handle name only if we do not yet have enough information to
determine the bus:dev.fn address.

Include the vendor and device IDs in debug messages when no suitable
driver is found, to match the diagnostics available in a BIOS
environment.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 anos atrás
pai
commit
17887f87b7
1 arquivos alterados com 31 adições e 29 exclusões
  1. 31
    29
      src/interface/efi/efi_pci.c

+ 31
- 29
src/interface/efi/efi_pci.c Ver arquivo

87
 			&efi_pci_root_bridge_io_protocol_guid,
87
 			&efi_pci_root_bridge_io_protocol_guid,
88
 			NULL, &num_handles, &handles ) ) != 0 ) {
88
 			NULL, &num_handles, &handles ) ) != 0 ) {
89
 		rc = -EEFI ( efirc );
89
 		rc = -EEFI ( efirc );
90
-		DBGC ( pci, "EFIPCI cannot locate root bridges: %s\n",
91
-		       strerror ( rc ) );
90
+		DBGC ( pci, "EFIPCI " PCI_FMT " cannot locate root bridges: "
91
+		       "%s\n", PCI_ARGS ( pci ), strerror ( rc ) );
92
 		goto err_locate;
92
 		goto err_locate;
93
 	}
93
 	}
94
 
94
 
100
 				&u.interface, efi_image_handle, *handle,
100
 				&u.interface, efi_image_handle, *handle,
101
 				EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) != 0 ) {
101
 				EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) != 0 ) {
102
 			rc = -EEFI ( efirc );
102
 			rc = -EEFI ( efirc );
103
-			DBGC ( pci, "EFIPCI cannot open %s: %s\n",
104
-			       efi_handle_name ( *handle ), strerror ( rc ) );
103
+			DBGC ( pci, "EFIPCI " PCI_FMT " cannot open %s: %s\n",
104
+			       PCI_ARGS ( pci ), efi_handle_name ( *handle ),
105
+			       strerror ( rc ) );
105
 			continue;
106
 			continue;
106
 		}
107
 		}
107
 		if ( u.root->SegmentNumber == PCI_SEG ( pci->busdevfn ) ) {
108
 		if ( u.root->SegmentNumber == PCI_SEG ( pci->busdevfn ) ) {
113
 				    &efi_pci_root_bridge_io_protocol_guid,
114
 				    &efi_pci_root_bridge_io_protocol_guid,
114
 				    efi_image_handle, *handle );
115
 				    efi_image_handle, *handle );
115
 	}
116
 	}
116
-	DBGC ( pci, "EFIPCI found no root bridge for " PCI_FMT "\n",
117
+	DBGC ( pci, "EFIPCI " PCI_FMT " found no root bridge\n",
117
 	       PCI_ARGS ( pci ) );
118
 	       PCI_ARGS ( pci ) );
118
 	rc = -ENOENT;
119
 	rc = -ENOENT;
119
 
120
 
163
 					efipci_address ( pci, location ), 1,
164
 					efipci_address ( pci, location ), 1,
164
 					value ) ) != 0 ) {
165
 					value ) ) != 0 ) {
165
 		rc = -EEFI ( efirc );
166
 		rc = -EEFI ( efirc );
166
-		DBG ( "EFIPCI config read from " PCI_FMT " offset %02lx "
167
-		      "failed: %s\n", PCI_ARGS ( pci ),
168
-		      EFIPCI_OFFSET ( location ), strerror ( rc ) );
167
+		DBGC ( pci, "EFIPCI " PCI_FMT " config read from offset %02lx "
168
+		       "failed: %s\n", PCI_ARGS ( pci ),
169
+		       EFIPCI_OFFSET ( location ), strerror ( rc ) );
169
 		goto err_read;
170
 		goto err_read;
170
 	}
171
 	}
171
 
172
 
201
 					 efipci_address ( pci, location ), 1,
202
 					 efipci_address ( pci, location ), 1,
202
 					 &value ) ) != 0 ) {
203
 					 &value ) ) != 0 ) {
203
 		rc = -EEFI ( efirc );
204
 		rc = -EEFI ( efirc );
204
-		DBG ( "EFIPCI config write to " PCI_FMT " offset %02lx "
205
-		      "failed: %s\n", PCI_ARGS ( pci ),
206
-		      EFIPCI_OFFSET ( location ), strerror ( rc ) );
205
+		DBGC ( pci, "EFIPCI " PCI_FMT " config write to offset %02lx "
206
+		       "failed: %s\n", PCI_ARGS ( pci ),
207
+		       EFIPCI_OFFSET ( location ), strerror ( rc ) );
207
 		goto err_write;
208
 		goto err_write;
208
 	}
209
 	}
209
 
210
 
268
 		       efi_handle_name ( device ), strerror ( rc ) );
269
 		       efi_handle_name ( device ), strerror ( rc ) );
269
 		goto err_get_location;
270
 		goto err_get_location;
270
 	}
271
 	}
271
-	DBGC2 ( device, "EFIPCI %s is PCI %04lx:%02lx:%02lx.%lx\n",
272
-		efi_handle_name ( device ), ( ( unsigned long ) pci_segment ),
273
-		( ( unsigned long ) pci_bus ), ( ( unsigned long ) pci_dev ),
274
-		( ( unsigned long ) pci_fn ) );
272
+	busdevfn = PCI_BUSDEVFN ( pci_segment, pci_bus, pci_dev, pci_fn );
273
+	pci_init ( pci, busdevfn );
274
+	DBGCP ( device, "EFIPCI " PCI_FMT " is %s\n",
275
+		PCI_ARGS ( pci ), efi_handle_name ( device ) );
275
 
276
 
276
 	/* Try to enable I/O cycles, memory cycles, and bus mastering.
277
 	/* Try to enable I/O cycles, memory cycles, and bus mastering.
277
 	 * Some platforms will 'helpfully' report errors if these bits
278
 	 * Some platforms will 'helpfully' report errors if these bits
290
 				    EFI_PCI_IO_ATTRIBUTE_BUS_MASTER, NULL );
291
 				    EFI_PCI_IO_ATTRIBUTE_BUS_MASTER, NULL );
291
 
292
 
292
 	/* Populate PCI device */
293
 	/* Populate PCI device */
293
-	busdevfn = PCI_BUSDEVFN ( pci_segment, pci_bus, pci_dev, pci_fn );
294
-	pci_init ( pci, busdevfn );
295
 	if ( ( rc = pci_read_config ( pci ) ) != 0 ) {
294
 	if ( ( rc = pci_read_config ( pci ) ) != 0 ) {
296
-		DBGC ( device, "EFIPCI %s cannot read PCI configuration: %s\n",
297
-		       efi_handle_name ( device ), strerror ( rc ) );
295
+		DBGC ( device, "EFIPCI " PCI_FMT " cannot read PCI "
296
+		       "configuration: %s\n",
297
+		       PCI_ARGS ( pci ), strerror ( rc ) );
298
 		goto err_pci_read_config;
298
 		goto err_pci_read_config;
299
 	}
299
 	}
300
 
300
 
364
 
364
 
365
 	/* Look for a driver */
365
 	/* Look for a driver */
366
 	if ( ( rc = pci_find_driver ( &pci ) ) != 0 ) {
366
 	if ( ( rc = pci_find_driver ( &pci ) ) != 0 ) {
367
-		DBGCP ( device, "EFIPCI %s has no driver\n",
368
-			efi_handle_name ( device ) );
367
+		DBGC ( device, "EFIPCI " PCI_FMT " (%04x:%04x class %06x) "
368
+		       "has no driver\n", PCI_ARGS ( &pci ), pci.vendor,
369
+		       pci.device, pci.class );
369
 		return rc;
370
 		return rc;
370
 	}
371
 	}
371
-	DBGC ( device, "EFIPCI %s has driver \"%s\"\n",
372
-	       efi_handle_name ( device ), pci.id->name );
372
+	DBGC ( device, "EFIPCI " PCI_FMT " (%04x:%04x class %06x) has driver "
373
+	       "\"%s\"\n", PCI_ARGS ( &pci ), pci.vendor, pci.device,
374
+	       pci.class, pci.id->name );
373
 
375
 
374
 	return 0;
376
 	return 0;
375
 }
377
 }
404
 
406
 
405
 	/* Find driver */
407
 	/* Find driver */
406
 	if ( ( rc = pci_find_driver ( pci ) ) != 0 ) {
408
 	if ( ( rc = pci_find_driver ( pci ) ) != 0 ) {
407
-		DBGC ( device, "EFIPCI %s has no driver\n",
408
-		       efi_handle_name ( device ) );
409
+		DBGC ( device, "EFIPCI " PCI_FMT " has no driver\n",
410
+		       PCI_ARGS ( pci ) );
409
 		goto err_find_driver;
411
 		goto err_find_driver;
410
 	}
412
 	}
411
 
413
 
415
 
417
 
416
 	/* Probe driver */
418
 	/* Probe driver */
417
 	if ( ( rc = pci_probe ( pci ) ) != 0 ) {
419
 	if ( ( rc = pci_probe ( pci ) ) != 0 ) {
418
-		DBGC ( device, "EFIPCI %s could not probe driver \"%s\": %s\n",
419
-		       efi_handle_name ( device ), pci->id->name,
420
+		DBGC ( device, "EFIPCI " PCI_FMT " could not probe driver "
421
+		       "\"%s\": %s\n", PCI_ARGS ( pci ), pci->id->name,
420
 		       strerror ( rc ) );
422
 		       strerror ( rc ) );
421
 		goto err_probe;
423
 		goto err_probe;
422
 	}
424
 	}
423
-	DBGC ( device, "EFIPCI %s using driver \"%s\"\n",
424
-	       efi_handle_name ( device ), pci->id->name );
425
+	DBGC ( device, "EFIPCI " PCI_FMT " using driver \"%s\"\n",
426
+	       PCI_ARGS ( pci ), pci->id->name );
425
 
427
 
426
 	efidev_set_drvdata ( efidev, pci );
428
 	efidev_set_drvdata ( efidev, pci );
427
 	return 0;
429
 	return 0;

Carregando…
Cancelar
Salvar