Selaa lähdekoodia

[bofm] Increase amount of debugging available

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 vuotta sitten
vanhempi
commit
e316684450
1 muutettua tiedostoa jossa 48 lisäystä ja 32 poistoa
  1. 48
    32
      src/interface/efi/efi_bofm.c

+ 48
- 32
src/interface/efi/efi_bofm.c Näytä tiedosto

@@ -165,7 +165,7 @@ efi_bofm_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver,
165 165
 	EFI_STATUS efirc;
166 166
 	int rc;
167 167
 
168
-	DBGCP ( efidrv, "BOFM DRIVER_SUPPORTED %p (%p)\n", device, child );
168
+	DBGCP ( efidrv, "EFIBOFM DRIVER_SUPPORTED %p (%p)\n", device, child );
169 169
 
170 170
 	/* Create corresponding PCI device, if any */
171 171
 	efipci = efipci_create ( efidrv, device );
@@ -176,7 +176,7 @@ efi_bofm_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver,
176 176
 
177 177
 	/* Look for a BOFM driver */
178 178
 	if ( ( rc = bofm_find_driver ( &efipci->pci ) ) != 0 ) {
179
-		DBGC2 ( efidrv, "BOFM " PCI_FMT " has no driver\n",
179
+		DBGCP ( efidrv, "EFIBOFM " PCI_FMT " has no driver\n",
180 180
 			PCI_ARGS ( &efipci->pci ) );
181 181
 		efirc = EFI_UNSUPPORTED;
182 182
 		goto err_no_driver;
@@ -185,8 +185,8 @@ efi_bofm_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver,
185 185
 	/* Locate BOFM protocol */
186 186
 	if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
187 187
 					    &bofm1.interface ) ) != 0 ) {
188
-		DBGC ( efidrv, "BOFM " PCI_FMT " cannot find BOFM protocol\n",
189
-		       PCI_ARGS ( &efipci->pci ) );
188
+		DBGC ( efidrv, "EFIBOFM " PCI_FMT " cannot find BOFM "
189
+		       "protocol\n", PCI_ARGS ( &efipci->pci ) );
190 190
 		efirc = EFI_UNSUPPORTED;
191 191
 		goto err_not_bofm;
192 192
 	}
@@ -196,13 +196,13 @@ efi_bofm_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver,
196 196
 						      0x04 /* Can change MAC */,
197 197
 						      0x00 /* No iSCSI */,
198 198
 						      0x02 /* Version */ ))!=0){
199
-		DBGC ( efidrv, "BOFM " PCI_FMT " could not register support: "
200
-		       "%s\n", PCI_ARGS ( &efipci->pci ),
199
+		DBGC ( efidrv, "EFIBOFM " PCI_FMT " could not register "
200
+		       "support: %s\n", PCI_ARGS ( &efipci->pci ),
201 201
 		       efi_strerror ( efirc ) );
202 202
 		goto err_cannot_register;
203 203
 	}
204 204
 
205
-	DBGC ( efidrv, "BOFM " PCI_FMT " is supported by driver \"%s\"\n",
205
+	DBGC ( efidrv, "EFIBOFM " PCI_FMT " is supported by driver \"%s\"\n",
206 206
 	       PCI_ARGS ( &efipci->pci ), efipci->pci.id->name );
207 207
 
208 208
 	/* Destroy temporary PCI device */
@@ -241,11 +241,12 @@ static EFI_STATUS EFIAPI efi_bofm_start ( EFI_DRIVER_BINDING_PROTOCOL *driver,
241 241
 		void *interface;
242 242
 	} bofm2;
243 243
 	struct efi_pci_device *efipci;
244
-	userptr_t bofmtab;
244
+	IBM_BOFM_TABLE *bofmtab;
245
+	IBM_BOFM_TABLE *bofmtab2;
245 246
 	EFI_STATUS efirc;
246 247
 	int bofmrc;
247 248
 
248
-	DBGCP ( efidrv, "BOFM DRIVER_START %p (%p)\n", device, child );
249
+	DBGCP ( efidrv, "EFIBOFM DRIVER_START %p (%p)\n", device, child );
249 250
 
250 251
 	/* Create corresponding PCI device */
251 252
 	efipci = efipci_create ( efidrv, device );
@@ -261,43 +262,58 @@ static EFI_STATUS EFIAPI efi_bofm_start ( EFI_DRIVER_BINDING_PROTOCOL *driver,
261 262
 	/* Locate BOFM protocol */
262 263
 	if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
263 264
 					    &bofm1.interface ) ) != 0 ) {
264
-		DBGC ( efidrv, "BOFM " PCI_FMT " cannot find BOFM protocol\n",
265
-		       PCI_ARGS ( &efipci->pci ) );
265
+		DBGC ( efidrv, "EFIBOFM " PCI_FMT " cannot find BOFM "
266
+		       "protocol\n", PCI_ARGS ( &efipci->pci ) );
266 267
 		goto err_locate_bofm;
267 268
 	}
269
+	bofmtab = &bofm1.bofm1->BofmTable;
270
+	DBGC ( efidrv, "EFIBOFM " PCI_FMT " found version 1 BOFM table at "
271
+	       "%p+%04x\n", PCI_ARGS ( &efipci->pci ), bofmtab,
272
+	       bofmtab->Parameters.Length );
268 273
 
269 274
 	/* Locate BOFM2 protocol, if available */
270 275
 	if ( ( efirc = bs->LocateProtocol ( &bofm2_protocol_guid, NULL,
271
-					    &bofm2.interface ) ) != 0 ) {
272
-		DBGC ( efidrv, "BOFM " PCI_FMT " cannot find BOFM2 protocol\n",
273
-		       PCI_ARGS ( &efipci->pci ) );
274
-		/* Not a fatal error; may be a BOFM1-only system */
275
-		bofm2.bofm2 = NULL;
276
-	}
277
-
278
-	/* Select appropriate BOFM table (v1 or v2) to use */
279
-	if ( bofm2.bofm2 ) {
280
-		DBGC ( efidrv, "BOFM " PCI_FMT " using version 2 BOFM table\n",
281
-		       PCI_ARGS ( &efipci->pci ) );
276
+					    &bofm2.interface ) ) == 0 ) {
277
+		bofmtab2 = &bofm2.bofm2->BofmTable;
278
+		DBGC ( efidrv, "EFIBOFM " PCI_FMT " found version 2 BOFM table "
279
+		       "at %p+%04x\n", PCI_ARGS ( &efipci->pci ), bofmtab2,
280
+		       bofmtab2->Parameters.Length );
282 281
 		assert ( bofm2.bofm2->RegisterSupport ==
283 282
 			 bofm1.bofm1->RegisterSupport );
284 283
 		assert ( bofm2.bofm2->SetStatus == bofm1.bofm1->SetStatus );
285
-		bofmtab = virt_to_user ( &bofm2.bofm2->BofmTable );
286 284
 	} else {
287
-		DBGC ( efidrv, "BOFM " PCI_FMT " using version 1 BOFM table\n",
288
-		       PCI_ARGS ( &efipci->pci ) );
289
-		bofmtab = virt_to_user ( &bofm1.bofm1->BofmTable );
285
+		DBGC ( efidrv, "EFIBOFM " PCI_FMT " cannot find BOFM2 "
286
+		       "protocol\n", PCI_ARGS ( &efipci->pci ) );
287
+		/* Not a fatal error; may be a BOFM1-only system */
288
+		bofmtab2 = NULL;
290 289
 	}
291 290
 
292 291
 	/* Process BOFM table */
293
-	bofmrc = bofm ( bofmtab, &efipci->pci );
294
-	DBGC ( efidrv, "BOFM " PCI_FMT " status %08x\n",
292
+	DBGC2 ( efidrv, "EFIBOFM " PCI_FMT " version 1 before processing:\n",
293
+		PCI_ARGS ( &efipci->pci ) );
294
+	DBGC2_HD ( efidrv, bofmtab, bofmtab->Parameters.Length );
295
+	if ( bofmtab2 ) {
296
+		DBGC2 ( efidrv, "EFIBOFM " PCI_FMT " version 2 before "
297
+			"processing:\n", PCI_ARGS ( &efipci->pci ) );
298
+		DBGC2_HD ( efidrv, bofmtab2, bofmtab2->Parameters.Length );
299
+	}
300
+	bofmrc = bofm ( virt_to_user ( bofmtab2 ? bofmtab2 : bofmtab ),
301
+			&efipci->pci );
302
+	DBGC ( efidrv, "EFIBOFM " PCI_FMT " status %08x\n",
295 303
 	       PCI_ARGS ( &efipci->pci ), bofmrc );
304
+	DBGC2 ( efidrv, "EFIBOFM " PCI_FMT " version 1 after processing:\n",
305
+		PCI_ARGS ( &efipci->pci ) );
306
+	DBGC2_HD ( efidrv, bofmtab, bofmtab->Parameters.Length );
307
+	if ( bofmtab2 ) {
308
+		DBGC2 ( efidrv, "EFIBOFM " PCI_FMT " version 2 after "
309
+			"processing:\n", PCI_ARGS ( &efipci->pci ) );
310
+		DBGC2_HD ( efidrv, bofmtab2, bofmtab2->Parameters.Length );
311
+	}
296 312
 
297 313
 	/* Return BOFM status */
298 314
 	if ( ( efirc = bofm1.bofm1->SetStatus ( bofm1.bofm1, device, FALSE,
299 315
 						bofmrc ) ) != 0 ) {
300
-		DBGC ( efidrv, "BOFM " PCI_FMT " could not set BOFM status: "
316
+		DBGC ( efidrv, "EFIBOFM " PCI_FMT " could not set BOFM status: "
301 317
 		       "%s\n", PCI_ARGS ( &efipci->pci ),
302 318
 		       efi_strerror ( efirc ) );
303 319
 		goto err_set_status;
@@ -332,7 +348,7 @@ static EFI_STATUS EFIAPI efi_bofm_stop ( EFI_DRIVER_BINDING_PROTOCOL *driver,
332 348
 	struct efi_driver *efidrv =
333 349
 		container_of ( driver, struct efi_driver, driver );
334 350
 
335
-	DBGCP ( efidrv, "BOFM DRIVER_STOP %p (%ld %p)\n",
351
+	DBGCP ( efidrv, "EFIBOFM DRIVER_STOP %p (%ld %p)\n",
336 352
 		device, ( ( unsigned long ) num_children ), children );
337 353
 
338 354
 	return 0;
@@ -353,12 +369,12 @@ static void efi_bofm_driver_init ( void ) {
353 369
 
354 370
 	/* Install driver */
355 371
 	if ( ( efirc = efi_driver_install ( efidrv ) ) != 0 ) {
356
-		DBGC ( efidrv, "BOFM could not install driver: %s\n",
372
+		DBGC ( efidrv, "EFIBOFM could not install driver: %s\n",
357 373
 		       efi_strerror ( efirc ) );
358 374
 		return;
359 375
 	}
360 376
 
361
-	DBGC ( efidrv, "BOFM driver installed\n" );
377
+	DBGC ( efidrv, "EFIBOFM driver installed\n" );
362 378
 }
363 379
 
364 380
 /** EFI BOFM startup function */

Loading…
Peruuta
Tallenna