The patch is good to me. Reviewed-by: Hao Wu <[email protected]>
Best Regards, Hao Wu > -----Original Message----- > From: Tian, Feng > Sent: Friday, June 24, 2016 3:25 PM > To: Wu, Hao A > Cc: [email protected] > Subject: [patch v3] MdeModulePkg/SdMmc: update TPL to notify to fix UEFI SCT > hang > > Compared with v2, we add missing critical region protection to error handling > path of SdRwSingleBlock & SdRwMultiBlocks functions. > > We also fix an issue found at v1 & v2, in which the enumeration timer should > work at TPL_CALLBACK level as DiskIo is required to be <= TPL_CALLBACK. > > Compared with v1, we added critical region protection on queue access made > in EraseBlock support. > > We have to upgrade the TPL level used by SdMmc stack because the > following flow: > > DiskIo2ReadWriteDisk() in logical partition -> PartitionReadBlocksEx() > in logical partition at TPL callback level -> ProbeMediaStatusEx() > with sync request -> DiskIo2ReadWriteDisk() in physical partition -> > waiting for async task completion. > > if the low layer driver doesn't run at TPL_NOTIFY level, it will have > no time to trigger async task and cause system hang. > > Cc: Hao Wu <[email protected]> > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Feng Tian <[email protected]> > --- > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 9 ++-- > MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 2 +- > MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c | 60 +++++++++++++-- > ------- > MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 42 +++++++++++---- > MdeModulePkg/Bus/Sd/SdDxe/SdDxe.c | 2 +- > 5 files changed, 75 insertions(+), 40 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > index ed6b557..0be081d 100644 > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c > @@ -238,6 +238,7 @@ SdMmcPciHcEnumerateDevice ( > LIST_ENTRY *Link; > LIST_ENTRY *NextLink; > SD_MMC_HC_TRB *Trb; > + EFI_TPL OldTpl; > > Private = (SD_MMC_HC_PRIVATE_DATA*)Context; > > @@ -251,6 +252,7 @@ SdMmcPciHcEnumerateDevice ( > // > // Signal all async task events at the slot with EFI_NO_MEDIA status. > // > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > for (Link = GetFirstNode (&Private->Queue); > !IsNull (&Private->Queue, Link); > Link = NextLink) { > @@ -263,6 +265,7 @@ SdMmcPciHcEnumerateDevice ( > SdMmcFreeTrb (Trb); > } > } > + gBS->RestoreTPL (OldTpl); > // > // Notify the upper layer the connect state change through > ReinstallProtocolInterface. > // > @@ -665,7 +668,7 @@ SdMmcPciHcDriverBindingStart ( > // > Status = gBS->CreateEvent ( > EVT_TIMER | EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > ProcessAsyncTaskList, > Private, > &Private->TimerEvent > @@ -961,7 +964,7 @@ SdMmcPassThruPassThru ( > // Wait async I/O list is empty before execute sync I/O operation. > // > while (TRUE) { > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > if (IsListEmpty (&Private->Queue)) { > gBS->RestoreTPL (OldTpl); > break; > @@ -1273,7 +1276,7 @@ SdMmcPassThruResetDevice ( > // > // Free all async I/O requests in the queue > // > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > > for (Link = GetFirstNode (&Private->Queue); > !IsNull (&Private->Queue, Link); > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > index 8978182..b4ff2af 100644 > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c > @@ -1315,7 +1315,7 @@ SdMmcCreateTrb ( > } > > if (Event != NULL) { > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Private->Queue, &Trb->TrbList); > gBS->RestoreTPL (OldTpl); > } > diff --git a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c > b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c > index 5fe710d..fc705e1 100644 > --- a/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c > +++ b/MdeModulePkg/Bus/Sd/EmmcDxe/EmmcBlockIo.c > @@ -339,7 +339,7 @@ EmmcSetExtCsd ( > } > > SetExtCsdReq->Signature = EMMC_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Partition->Queue, &SetExtCsdReq->Link); > gBS->RestoreTPL (OldTpl); > SetExtCsdReq->Packet.SdMmcCmdBlk = &SetExtCsdReq->SdMmcCmdBlk; > @@ -361,7 +361,7 @@ EmmcSetExtCsd ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > SetExtCsdReq, > &SetExtCsdReq->Event > @@ -382,7 +382,7 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (SetExtCsdReq != NULL)) { > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&SetExtCsdReq->Link); > gBS->RestoreTPL (OldTpl); > if (SetExtCsdReq->Event != NULL) { > @@ -395,7 +395,7 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (SetExtCsdReq != NULL) { > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&SetExtCsdReq->Link); > gBS->RestoreTPL (OldTpl); > FreePool (SetExtCsdReq); > @@ -445,7 +445,7 @@ EmmcSetBlkCount ( > } > > SetBlkCntReq->Signature = EMMC_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Partition->Queue, &SetBlkCntReq->Link); > gBS->RestoreTPL (OldTpl); > SetBlkCntReq->Packet.SdMmcCmdBlk = &SetBlkCntReq->SdMmcCmdBlk; > @@ -463,7 +463,7 @@ EmmcSetBlkCount ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > SetBlkCntReq, > &SetBlkCntReq->Event > @@ -484,7 +484,7 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (SetBlkCntReq != NULL)) { > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&SetBlkCntReq->Link); > gBS->RestoreTPL (OldTpl); > if (SetBlkCntReq->Event != NULL) { > @@ -497,7 +497,7 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (SetBlkCntReq != NULL) { > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&SetBlkCntReq->Link); > gBS->RestoreTPL (OldTpl); > FreePool (SetBlkCntReq); > @@ -562,7 +562,7 @@ EmmcProtocolInOut ( > } > > ProtocolReq->Signature = EMMC_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Partition->Queue, &ProtocolReq->Link); > gBS->RestoreTPL (OldTpl); > ProtocolReq->Packet.SdMmcCmdBlk = &ProtocolReq->SdMmcCmdBlk; > @@ -596,7 +596,7 @@ EmmcProtocolInOut ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > ProtocolReq, > &ProtocolReq->Event > @@ -617,7 +617,7 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (ProtocolReq != NULL)) { > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&ProtocolReq->Link); > gBS->RestoreTPL (OldTpl); > if (ProtocolReq->Event != NULL) { > @@ -630,7 +630,7 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (ProtocolReq != NULL) { > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&ProtocolReq->Link); > gBS->RestoreTPL (OldTpl); > FreePool (ProtocolReq); > @@ -688,7 +688,7 @@ EmmcRwMultiBlocks ( > } > > RwMultiBlkReq->Signature = EMMC_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Partition->Queue, &RwMultiBlkReq->Link); > gBS->RestoreTPL (OldTpl); > RwMultiBlkReq->Packet.SdMmcCmdBlk = &RwMultiBlkReq- > >SdMmcCmdBlk; > @@ -730,7 +730,7 @@ EmmcRwMultiBlocks ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > RwMultiBlkReq, > &RwMultiBlkReq->Event > @@ -751,7 +751,7 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (RwMultiBlkReq != NULL)) { > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&RwMultiBlkReq->Link); > gBS->RestoreTPL (OldTpl); > if (RwMultiBlkReq->Event != NULL) { > @@ -764,7 +764,7 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (RwMultiBlkReq != NULL) { > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&RwMultiBlkReq->Link); > gBS->RestoreTPL (OldTpl); > FreePool (RwMultiBlkReq); > @@ -901,7 +901,7 @@ EmmcReadWrite ( > if (EFI_ERROR (Status)) { > return Status; > } > - DEBUG ((EFI_D_INFO, "Emmc%a(): Lba 0x%x BlkNo 0x%x Event %p > with %r\n", IsRead ? "Read" : "Write", Lba, BlockNum, Token->Event, Status)); > + DEBUG ((EFI_D_INFO, "Emmc%a(): Part %d Lba 0x%x BlkNo 0x%x Event %p > with %r\n", IsRead ? "Read " : "Write", Partition->PartitionType, Lba, > BlockNum, > Token ? Token->Event : NULL, Status)); > > Lba += BlockNum; > Buffer = (UINT8*)Buffer + BufferSize; > @@ -1069,7 +1069,7 @@ EmmcResetEx ( > > Partition = EMMC_PARTITION_DATA_FROM_BLKIO2 (This); > > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > for (Link = GetFirstNode (&Partition->Queue); > !IsNull (&Partition->Queue, Link); > Link = NextLink) { > @@ -1629,7 +1629,7 @@ EmmcEraseBlockStart ( > } > > EraseBlockStart->Signature = EMMC_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Partition->Queue, &EraseBlockStart->Link); > gBS->RestoreTPL (OldTpl); > EraseBlockStart->Packet.SdMmcCmdBlk = &EraseBlockStart- > >SdMmcCmdBlk; > @@ -1652,7 +1652,7 @@ EmmcEraseBlockStart ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > EraseBlockStart, > &EraseBlockStart->Event > @@ -1673,7 +1673,9 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (EraseBlockStart != NULL)) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlockStart->Link); > + gBS->RestoreTPL (OldTpl); > if (EraseBlockStart->Event != NULL) { > gBS->CloseEvent (EraseBlockStart->Event); > } > @@ -1684,7 +1686,9 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (EraseBlockStart != NULL) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlockStart->Link); > + gBS->RestoreTPL (OldTpl); > FreePool (EraseBlockStart); > } > } > @@ -1732,7 +1736,7 @@ EmmcEraseBlockEnd ( > } > > EraseBlockEnd->Signature = EMMC_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Partition->Queue, &EraseBlockEnd->Link); > gBS->RestoreTPL (OldTpl); > EraseBlockEnd->Packet.SdMmcCmdBlk = &EraseBlockEnd->SdMmcCmdBlk; > @@ -1755,7 +1759,7 @@ EmmcEraseBlockEnd ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > EraseBlockEnd, > &EraseBlockEnd->Event > @@ -1776,7 +1780,9 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (EraseBlockEnd != NULL)) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlockEnd->Link); > + gBS->RestoreTPL (OldTpl); > if (EraseBlockEnd->Event != NULL) { > gBS->CloseEvent (EraseBlockEnd->Event); > } > @@ -1787,7 +1793,9 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (EraseBlockEnd != NULL) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlockEnd->Link); > + gBS->RestoreTPL (OldTpl); > FreePool (EraseBlockEnd); > } > } > @@ -1833,7 +1841,7 @@ EmmcEraseBlock ( > } > > EraseBlock->Signature = EMMC_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Partition->Queue, &EraseBlock->Link); > gBS->RestoreTPL (OldTpl); > EraseBlock->Packet.SdMmcCmdBlk = &EraseBlock->SdMmcCmdBlk; > @@ -1850,7 +1858,7 @@ EmmcEraseBlock ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > EraseBlock, > &EraseBlock->Event > @@ -1871,7 +1879,9 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (EraseBlock != NULL)) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlock->Link); > + gBS->RestoreTPL (OldTpl); > if (EraseBlock->Event != NULL) { > gBS->CloseEvent (EraseBlock->Event); > } > @@ -1882,7 +1892,9 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (EraseBlock != NULL) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlock->Link); > + gBS->RestoreTPL (OldTpl); > FreePool (EraseBlock); > } > } > diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > index d8b9459..516c3e7 100644 > --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c > @@ -340,7 +340,7 @@ SdRwSingleBlock ( > } > > RwSingleBlkReq->Signature = SD_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Device->Queue, &RwSingleBlkReq->Link); > gBS->RestoreTPL (OldTpl); > RwSingleBlkReq->Packet.SdMmcCmdBlk = &RwSingleBlkReq- > >SdMmcCmdBlk; > @@ -382,7 +382,7 @@ SdRwSingleBlock ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > RwSingleBlkReq, > &RwSingleBlkReq->Event > @@ -403,7 +403,9 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (RwSingleBlkReq != NULL)) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&RwSingleBlkReq->Link); > + gBS->RestoreTPL (OldTpl); > if (RwSingleBlkReq->Event != NULL) { > gBS->CloseEvent (RwSingleBlkReq->Event); > } > @@ -414,7 +416,9 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (RwSingleBlkReq != NULL) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&RwSingleBlkReq->Link); > + gBS->RestoreTPL (OldTpl); > FreePool (RwSingleBlkReq); > } > } > @@ -468,7 +472,7 @@ SdRwMultiBlocks ( > } > > RwMultiBlkReq->Signature = SD_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Device->Queue, &RwMultiBlkReq->Link); > gBS->RestoreTPL (OldTpl); > RwMultiBlkReq->Packet.SdMmcCmdBlk = &RwMultiBlkReq- > >SdMmcCmdBlk; > @@ -510,7 +514,7 @@ SdRwMultiBlocks ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > RwMultiBlkReq, > &RwMultiBlkReq->Event > @@ -531,7 +535,9 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (RwMultiBlkReq != NULL)) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&RwMultiBlkReq->Link); > + gBS->RestoreTPL (OldTpl); > if (RwMultiBlkReq->Event != NULL) { > gBS->CloseEvent (RwMultiBlkReq->Event); > } > @@ -542,7 +548,9 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (RwMultiBlkReq != NULL) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&RwMultiBlkReq->Link); > + gBS->RestoreTPL (OldTpl); > FreePool (RwMultiBlkReq); > } > } > @@ -830,7 +838,7 @@ SdResetEx ( > > Device = SD_DEVICE_DATA_FROM_BLKIO2 (This); > > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > for (Link = GetFirstNode (&Device->Queue); > !IsNull (&Device->Queue, Link); > Link = NextLink) { > @@ -1007,7 +1015,7 @@ SdEraseBlockStart ( > } > > EraseBlockStart->Signature = SD_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Device->Queue, &EraseBlockStart->Link); > gBS->RestoreTPL (OldTpl); > EraseBlockStart->Packet.SdMmcCmdBlk = &EraseBlockStart- > >SdMmcCmdBlk; > @@ -1030,7 +1038,7 @@ SdEraseBlockStart ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > EraseBlockStart, > &EraseBlockStart->Event > @@ -1051,7 +1059,9 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (EraseBlockStart != NULL)) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlockStart->Link); > + gBS->RestoreTPL (OldTpl); > if (EraseBlockStart->Event != NULL) { > gBS->CloseEvent (EraseBlockStart->Event); > } > @@ -1062,7 +1072,9 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (EraseBlockStart != NULL) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlockStart->Link); > + gBS->RestoreTPL (OldTpl); > FreePool (EraseBlockStart); > } > } > @@ -1107,7 +1119,7 @@ SdEraseBlockEnd ( > } > > EraseBlockEnd->Signature = SD_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Device->Queue, &EraseBlockEnd->Link); > gBS->RestoreTPL (OldTpl); > EraseBlockEnd->Packet.SdMmcCmdBlk = &EraseBlockEnd->SdMmcCmdBlk; > @@ -1130,7 +1142,7 @@ SdEraseBlockEnd ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > EraseBlockEnd, > &EraseBlockEnd->Event > @@ -1151,7 +1163,9 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (EraseBlockEnd != NULL)) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlockEnd->Link); > + gBS->RestoreTPL (OldTpl); > if (EraseBlockEnd->Event != NULL) { > gBS->CloseEvent (EraseBlockEnd->Event); > } > @@ -1162,7 +1176,9 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (EraseBlockEnd != NULL) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlockEnd->Link); > + gBS->RestoreTPL (OldTpl); > FreePool (EraseBlockEnd); > } > } > @@ -1205,7 +1221,7 @@ SdEraseBlock ( > } > > EraseBlock->Signature = SD_REQUEST_SIGNATURE; > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > InsertTailList (&Device->Queue, &EraseBlock->Link); > gBS->RestoreTPL (OldTpl); > EraseBlock->Packet.SdMmcCmdBlk = &EraseBlock->SdMmcCmdBlk; > @@ -1222,7 +1238,7 @@ SdEraseBlock ( > if ((Token != NULL) && (Token->Event != NULL)) { > Status = gBS->CreateEvent ( > EVT_NOTIFY_SIGNAL, > - TPL_CALLBACK, > + TPL_NOTIFY, > AsyncIoCallback, > EraseBlock, > &EraseBlock->Event > @@ -1243,7 +1259,9 @@ Error: > // The request and event will be freed in asynchronous callback for > success > case. > // > if (EFI_ERROR (Status) && (EraseBlock != NULL)) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlock->Link); > + gBS->RestoreTPL (OldTpl); > if (EraseBlock->Event != NULL) { > gBS->CloseEvent (EraseBlock->Event); > } > @@ -1254,7 +1272,9 @@ Error: > // For synchronous operation, free request whatever the execution result > is. > // > if (EraseBlock != NULL) { > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > RemoveEntryList (&EraseBlock->Link); > + gBS->RestoreTPL (OldTpl); > FreePool (EraseBlock); > } > } > diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdDxe.c > b/MdeModulePkg/Bus/Sd/SdDxe/SdDxe.c > index 7c70c60..0cf9067 100644 > --- a/MdeModulePkg/Bus/Sd/SdDxe/SdDxe.c > +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdDxe.c > @@ -800,7 +800,7 @@ SdDxeDriverBindingStop ( > // > // Free all on-going async tasks. > // > - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); > + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); > for (Link = GetFirstNode (&Device->Queue); > !IsNull (&Device->Queue, Link); > Link = NextLink) { > -- > 2.7.1.windows.2 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

