Procházet zdrojové kódy

[efi] Raise TPL when calling UNDI entry point

The SnpDxe driver raises the task priority level to TPL_CALLBACK when
calling the UNDI entry point.  This does not appear to be a documented
requirement, but we should probably match the behaviour of SnpDxe to
minimise surprises to third party code.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown před 6 roky
rodič
revize
3ae70be5ba
1 změnil soubory, kde provedl 8 přidání a 0 odebrání
  1. 8
    0
      src/drivers/net/efi/nii.c

+ 8
- 0
src/drivers/net/efi/nii.c Zobrazit soubor

402
  */
402
  */
403
 static int nii_issue_cpb_db ( struct nii_nic *nii, unsigned int op, void *cpb,
403
 static int nii_issue_cpb_db ( struct nii_nic *nii, unsigned int op, void *cpb,
404
 			      size_t cpb_len, void *db, size_t db_len ) {
404
 			      size_t cpb_len, void *db, size_t db_len ) {
405
+	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
405
 	PXE_CDB cdb;
406
 	PXE_CDB cdb;
407
+	UINTN tpl;
406
 
408
 
407
 	/* Prepare command descriptor block */
409
 	/* Prepare command descriptor block */
408
 	memset ( &cdb, 0, sizeof ( cdb ) );
410
 	memset ( &cdb, 0, sizeof ( cdb ) );
414
 	cdb.DBsize = db_len;
416
 	cdb.DBsize = db_len;
415
 	cdb.IFnum = nii->nii->IfNum;
417
 	cdb.IFnum = nii->nii->IfNum;
416
 
418
 
419
+	/* Raise task priority level */
420
+	tpl = bs->RaiseTPL ( TPL_CALLBACK );
421
+
417
 	/* Issue command */
422
 	/* Issue command */
418
 	DBGC2 ( nii, "NII %s issuing %02x:%04x ifnum %d%s%s\n",
423
 	DBGC2 ( nii, "NII %s issuing %02x:%04x ifnum %d%s%s\n",
419
 		nii->dev.name, cdb.OpCode, cdb.OpFlags, cdb.IFnum,
424
 		nii->dev.name, cdb.OpCode, cdb.OpFlags, cdb.IFnum,
424
 		DBGC2_HD ( nii, db, db_len );
429
 		DBGC2_HD ( nii, db, db_len );
425
 	nii->issue ( ( intptr_t ) &cdb );
430
 	nii->issue ( ( intptr_t ) &cdb );
426
 
431
 
432
+	/* Restore task priority level */
433
+	bs->RestoreTPL ( tpl );
434
+
427
 	/* Check completion status */
435
 	/* Check completion status */
428
 	if ( cdb.StatCode != PXE_STATCODE_SUCCESS )
436
 	if ( cdb.StatCode != PXE_STATCODE_SUCCESS )
429
 		return -cdb.StatCode;
437
 		return -cdb.StatCode;

Načítá se…
Zrušit
Uložit