Browse Source

[bofm] Increase amount of debugging available

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
e316684450
1 changed files with 48 additions and 32 deletions
  1. 48
    32
      src/interface/efi/efi_bofm.c

+ 48
- 32
src/interface/efi/efi_bofm.c View File

165
 	EFI_STATUS efirc;
165
 	EFI_STATUS efirc;
166
 	int rc;
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
 	/* Create corresponding PCI device, if any */
170
 	/* Create corresponding PCI device, if any */
171
 	efipci = efipci_create ( efidrv, device );
171
 	efipci = efipci_create ( efidrv, device );
176
 
176
 
177
 	/* Look for a BOFM driver */
177
 	/* Look for a BOFM driver */
178
 	if ( ( rc = bofm_find_driver ( &efipci->pci ) ) != 0 ) {
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
 			PCI_ARGS ( &efipci->pci ) );
180
 			PCI_ARGS ( &efipci->pci ) );
181
 		efirc = EFI_UNSUPPORTED;
181
 		efirc = EFI_UNSUPPORTED;
182
 		goto err_no_driver;
182
 		goto err_no_driver;
185
 	/* Locate BOFM protocol */
185
 	/* Locate BOFM protocol */
186
 	if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
186
 	if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
187
 					    &bofm1.interface ) ) != 0 ) {
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
 		efirc = EFI_UNSUPPORTED;
190
 		efirc = EFI_UNSUPPORTED;
191
 		goto err_not_bofm;
191
 		goto err_not_bofm;
192
 	}
192
 	}
196
 						      0x04 /* Can change MAC */,
196
 						      0x04 /* Can change MAC */,
197
 						      0x00 /* No iSCSI */,
197
 						      0x00 /* No iSCSI */,
198
 						      0x02 /* Version */ ))!=0){
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
 		       efi_strerror ( efirc ) );
201
 		       efi_strerror ( efirc ) );
202
 		goto err_cannot_register;
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
 	       PCI_ARGS ( &efipci->pci ), efipci->pci.id->name );
206
 	       PCI_ARGS ( &efipci->pci ), efipci->pci.id->name );
207
 
207
 
208
 	/* Destroy temporary PCI device */
208
 	/* Destroy temporary PCI device */
241
 		void *interface;
241
 		void *interface;
242
 	} bofm2;
242
 	} bofm2;
243
 	struct efi_pci_device *efipci;
243
 	struct efi_pci_device *efipci;
244
-	userptr_t bofmtab;
244
+	IBM_BOFM_TABLE *bofmtab;
245
+	IBM_BOFM_TABLE *bofmtab2;
245
 	EFI_STATUS efirc;
246
 	EFI_STATUS efirc;
246
 	int bofmrc;
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
 	/* Create corresponding PCI device */
251
 	/* Create corresponding PCI device */
251
 	efipci = efipci_create ( efidrv, device );
252
 	efipci = efipci_create ( efidrv, device );
261
 	/* Locate BOFM protocol */
262
 	/* Locate BOFM protocol */
262
 	if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
263
 	if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
263
 					    &bofm1.interface ) ) != 0 ) {
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
 		goto err_locate_bofm;
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
 	/* Locate BOFM2 protocol, if available */
274
 	/* Locate BOFM2 protocol, if available */
270
 	if ( ( efirc = bs->LocateProtocol ( &bofm2_protocol_guid, NULL,
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
 		assert ( bofm2.bofm2->RegisterSupport ==
281
 		assert ( bofm2.bofm2->RegisterSupport ==
283
 			 bofm1.bofm1->RegisterSupport );
282
 			 bofm1.bofm1->RegisterSupport );
284
 		assert ( bofm2.bofm2->SetStatus == bofm1.bofm1->SetStatus );
283
 		assert ( bofm2.bofm2->SetStatus == bofm1.bofm1->SetStatus );
285
-		bofmtab = virt_to_user ( &bofm2.bofm2->BofmTable );
286
 	} else {
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
 	/* Process BOFM table */
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
 	       PCI_ARGS ( &efipci->pci ), bofmrc );
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
 	/* Return BOFM status */
313
 	/* Return BOFM status */
298
 	if ( ( efirc = bofm1.bofm1->SetStatus ( bofm1.bofm1, device, FALSE,
314
 	if ( ( efirc = bofm1.bofm1->SetStatus ( bofm1.bofm1, device, FALSE,
299
 						bofmrc ) ) != 0 ) {
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
 		       "%s\n", PCI_ARGS ( &efipci->pci ),
317
 		       "%s\n", PCI_ARGS ( &efipci->pci ),
302
 		       efi_strerror ( efirc ) );
318
 		       efi_strerror ( efirc ) );
303
 		goto err_set_status;
319
 		goto err_set_status;
332
 	struct efi_driver *efidrv =
348
 	struct efi_driver *efidrv =
333
 		container_of ( driver, struct efi_driver, driver );
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
 		device, ( ( unsigned long ) num_children ), children );
352
 		device, ( ( unsigned long ) num_children ), children );
337
 
353
 
338
 	return 0;
354
 	return 0;
353
 
369
 
354
 	/* Install driver */
370
 	/* Install driver */
355
 	if ( ( efirc = efi_driver_install ( efidrv ) ) != 0 ) {
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
 		       efi_strerror ( efirc ) );
373
 		       efi_strerror ( efirc ) );
358
 		return;
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
 /** EFI BOFM startup function */
380
 /** EFI BOFM startup function */

Loading…
Cancel
Save