浏览代码

[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 7 年前
父节点
当前提交
3ae70be5ba
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8
    0
      src/drivers/net/efi/nii.c

+ 8
- 0
src/drivers/net/efi/nii.c 查看文件

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

正在加载...
取消
保存