When reading data from non-blockingly from a CD-ROM logic partition, the
procedure can be shown by the following call stack:
(The write process is similar)
|-------------------|
| DiskIoDxe (logic) |<---Raise Tpl to TPL_CALLBACK
|-------------------|
|
| Sub-task 1 (UnderRun) succeeds
|
| |-----------------| |-----------------| |-----------------|
+--->| PartitionDxe |---->| DiskIoDxe (Phy) |---->| ScsiDiskDxe |
| |-----------------| |-----------------| |-----------------|
|
| Sub-task 2 (OverRun) fails
|
| |-----------------| |-----------------| |-----------------|
+--->| PartitionDxe |---->| DiskIoDxe (Phy) |---->| ScsiDiskDxe |
| |-----------------| |-----------------| |-----------------|
| ^
| |
More subtasks... Wait indefinitely
|
|<---Restore Tpl
|
Completes
In PartitionDxe, if the 'Lba' and 'BufferSize' parameters passed to
function PartitionReadBlocksEx() are invalid, the function will issue a
blocking ReadDisk call (in function ProbeMediaStatusEx()).
In DiskIoDxe, blocking I/O request will wait for all the non-blocking I/O
requests to complete first before sending down the blocking request.
If the Tpl of the async I/O callback in ScsiDiskDxe is TPL_CALLBACK and
Sub-task 1 (UnderRun) succeeds but Sub-task 2 (OverRun) fails with an
invalid parameter, DiskIoDxe will wait indefinitely for the event created
by ScsiDiskDxe of Sub-task 1 to signal.
Therefore, the async I/O callback functions in ScsiDiskDxe, ScsiBusDxe and
UefiScsiLib need to raise Tpl to TPL_NOTIFY to avoid the above-mentioned
indefinite wait. Plus, the UFS PassThru driver also needs to raise Tpl to
TPL_NOTIFY when processing async SCSI task list.
Hao Wu (4):
MdeModulePkg ScsiDiskDxe: Raise the Tpl of async IO callback to
TPL_NOTIFY
MdePkg UefiScsiLib: Raise the Tpl of async IO callback to TPL_NOTIFY
MdeModulePkg ScsiBusDxe: Raise the Tpl of async IO callback to
TPL_NOTIFY
MdeModulePkg UfsPassThruDxe: Raise to TPL_NOTIFY when dealing async
task
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c | 2 +-
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 59 ++++++++++++++++++----
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 8 ++-
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 2 +-
.../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 2 +-
MdePkg/Library/UefiScsiLib/UefiScsiLib.c | 8 +--
6 files changed, 62 insertions(+), 19 deletions(-)
--
1.9.5.msysgit.0
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel