History log of /device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a5e5a2f581eec25df0b42f6d8a41a39ae3cf2b6e 17-Mar-2016 Hao Wu <hao.a.wu@intel.com> MdeModulePkg DiskIoDxe: Media status check not be done at DiskIo level

Found an issue that file system cannot be started on a DVD when doing the
following process:

Boot to shell with a DVD inside a SATA DVDROM. Eject the DVD and run
"reconnect -r". Put the DVD inside again and run "reconnect -r".

The cause is that after executing the second reconnect action, DiskIo
immediately returns EFI_NO_MEDIA in function DiskIo2ReadWriteDisk() when
checking the media information. However, at this time, the media
information does not get updated by the ScsiDisk driver. Therefore, DiskIo
driver should left the no media check to ScsiDisk driver.

Generally, the media changed and media write protect check should also be
left to lower-level device driver. Thus, these two checks in function
DiskIo2ReadWriteDisk() are also removed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
66ca22d05cb88d3460e7caca112020b31dbcf2d0 22-Dec-2015 Hao Wu <hao.a.wu@intel.com> MdeModulePkg DiskIoDxe: Check for MediaPresent in DiskIo2ReadWriteDisk()

Add check to see if there is a media in the disk device. If not return
EFI_NO_MEDIA directly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19446 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
bf5a9493fa9d7013015ac511714d4efdca23ae34 15-Oct-2014 Ruiyu Ni <ruiyu.ni@intel.com> AtaBusDxe: Fix ReadBlockEx andWriteBlockEx to still signal event when the BufferSize is 0.
DiskIoDxe: Fix ReadDiskEx and WriteDiskEx to not modify the user’s buffer when the BufferSize is 0.
DiskIoDxe: Fix ReadDiskEx and WriteDiskEx hang issue when the submitted blockio2 task is completed before submitting another blockio2 task.
DiskIoDxe: Fix FlushEx to free the flush task item in callback (memory leak issue).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16215 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
e645bd857df95a8e2fac220fe98772cc6d37dee4 12-Feb-2014 Olivier Martin <olivier.martin@arm.com> MdeModulePkg/DiskIo: Introduced 'PcdDiskIoDataBufferBlockNum'

PcdDiskIoDataBufferBlockNum replaced the hardcoded value into
the Disk I/O driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-By: Tian, Feng <feng.tian@intel.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15235 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
4636295f460da20b7c1e5db1283262167193bf77 17-Dec-2013 Ruiyu Ni <ruiyu.ni@intel.com> Add the missing assignment of EFI_DISK_IO2_TOKEN::Token in FlushDiskEx() implementation. Without the assignment, system may hang sometimes.

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14991 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
80c83a6995db1914cc7db012f6b8f3e223e45847 17-Sep-2013 Ruiyu Ni <ruiyu.ni@intel.com> Fix 3 bugs in DiskIoDxe and PartitionDxe drivers introduced in DiskIo2 implementation.
1. DiskIo2 shouldn't signal the event when the *Ex interface returns failure status per the UEFI spec.
2. PartitionDxe should close DiskIo2 protocol when error happens in DriverBindingStart() otherwise Fat driver cannot open the DiskIo2 BY_DRIVER.
3. PartitionDxe should create event using TPL_NOTIFY instead of TPL_CALLBACK otherwise asynchronous FileIo may be blocked.

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14680 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
4e39b75e7ec56eaf71a1bab2d8c3bd487c7e2273 26-Aug-2013 Laszlo Ersek <lersek@redhat.com> MdeModulePkg/DiskIoDxe: fix source/destination pointer of overrun transfer

DiskIoCreateSubtaskList() may split the transfer into three segments:
- a leading segment, called underrun, which is the fractional, trailing
subset of the first underlying block,
- a middle segment, which is an integral multiple of underlying blocks,
- a trailing segment, called overrun, which is the fractional, leading
subset of the last underlying block.

This is an example read from the /EFI/BOOT/BOOTX64.EFI file, on the
RHEL-6.4 installation ISO (debug log enabled with EFI_D_BLKIO). The
underlying block size is 2048 bytes (IDE CD-ROM).

DiskIo: Create subtasks for task: Offset/BufferSize/Buffer = 0000000000004600/00002000/BD890018
R:Lba/Offset/Length/WorkingBuffer/Buffer = 0000000000000008/00000600/00000200/BD90D000/BD890018
R:Lba/Offset/Length/WorkingBuffer/Buffer = 000000000000000C/00000000/00000600/BD90D000/BD890218
R:Lba/Offset/Length/WorkingBuffer/Buffer = 0000000000000009/00000000/00001800/00000000/BD890218

The first line corresponds to the underrun.
The second line corresponds to the overrun.
The third line corresponds to the middle segment.

In decimal:
- task: read 8192 bytes from offset 17920, storing it at BD890018
- underrun:
- read block 8 [16384..18432) into the transfer area,
- copy 512 bytes from offset 1536 of the transfer area to BD890018
(target buffer offset 0, running total: 512)
- middle segment:
- read blocks 9, 10, 11 [18432..24576) into the transfer area,
- copy 6144 bytes from offset 0 of the transfer area to BD890218
(target buffer offset 512, running total: 6656)
- overrun:
- read block 12 [24576..26624) into the transfer area,
- copy 1536 bytes from offset 0 of the transfer area to BD890218 (!!!)
(target buffer offset 512 (!!!), running total 8192)

The values marked with (!!!) constitute the bug --
DiskIoCreateSubtaskList() doesn't take the size of the middle segment into
account when it calculates the destination (for reads) or source (for
writes) pointer for the overrun. This leads to data corruption.

When reading, data is copied form the transfer area to the target buffer
with

CopyMem (Subtask->Buffer, Subtask->WorkingBuffer + Subtask->Offset, Subtask->Length);

calls in DiskIo2OnReadWriteComplete() for nonblocking reads, and in
DiskIo2ReadWriteDisk() for blocking reads. Therefore it's enough to adjust
Subtask->Buffer when it is initialized. (See BD891A18 below.)

DiskIo: Create subtasks for task: Offset/BufferSize/Buffer = 0000000000004600/00002000/BD890018
R:Lba/Offset/Length/WorkingBuffer/Buffer = 0000000000000008/00000600/00000200/BD90D000/BD890018
R:Lba/Offset/Length/WorkingBuffer/Buffer = 000000000000000C/00000000/00000600/BD90D000/BD891A18
R:Lba/Offset/Length/WorkingBuffer/Buffer = 0000000000000009/00000000/00001800/00000000/BD890218

The patched call to DiskIoCreateSubtask() is also executed for write
requests. The changed Subtask->Buffer initialization fixes the "overrun
half writes" in DiskIo2ReadWriteDisk() too:

//
// A sub task before this one should be a block read operation, causing
// the WorkingBuffer filled with the entire one block data.
//
CopyMem (Subtask->WorkingBuffer + Subtask->Offset, Subtask->Buffer, Subtask->Length);

This code doubles for underrun and overrun half-writes. The patch doesn't
modify the underrun case.

If we're storing the overrun at the beginning of the pre-read last block
(which we're going to write out as a full block), then
- Subtask->Offset == 0,
- Subtask->Length == OverRun,
- the first byte *not* accessed in the source area is
((Buffer + UnderRunLength) + BufferSize) + OverRun.

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14602 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
de49225db86a2209fc09afb1baade3db1542b0cb 22-Aug-2013 Ruiyu Ni <ruiyu.ni@intel.com> Fix DDK3790 build failure.

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14587 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
b822eb4237ba856b3c66dd0a3bd996741084f629 21-Aug-2013 Ruiyu Ni <ruiyu.ni@intel.com> Fix function header comments for DiskIoDestroySubtask.

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14577 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
f5ec0a86d801442fe35c49bbe6c4b6cb6aa955cc 21-Aug-2013 Olivier Martin <olivier.martin@arm.com> MdeModulePkg/DiskIoDxe: Fixed GCC build error

Error: Variable "Media" was set but never used.

Change-Id: I1297b3de797e436ed403375c801945b3202b532c
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14575 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
493d8e3a5e86f78ef975e18dfa5754adce9e82de 20-Aug-2013 Ruiyu Ni <ruiyu.ni@intel.com> Add DiskIo2 protocol definition to MdePkg.
Change DiskIoDxe to produce DiskIo2 protocol when the BlockIo2 protocol is available.
Change PartitionDxe to produce BlockIo2 protocol based on DiskIo2 protocol instead of BlockIo2 protocol.

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Kinney Michael <michael.d.kinney@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14570 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
15cc67e616cad2dad3d3b6f9ba1cba856b5de414 05-May-2010 erictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524> raise TPL to TPL_CALLBACK level at DriverBindingStart() for all usb-related modules, which prevent DriverBindingStop() from being invoked when DriverBindingStart() runs.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10460 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
e5eed7d3641d71d7ea539e5379ea9c6a5cd97004 24-Apr-2010 hhtian <hhtian@6f19259b-4bc3-4df7-8a09-765794883524> Update the copyright notice format

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10418 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
48557c6550adecf39e1e8e140b1736275d070dfb 23-Dec-2008 qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> Code scrub DxeIpl, Runtime, DevicePath, FvbServicesLib, DiskIo, Partition, English, EBC.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7105 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
ff61847ddc91285a9ef8be00b89304870c493ef8 18-Jul-2008 qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> Code scrub for DiskIo, Partition & Unicode Collation

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5519 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
f42be64210ea5ef394835a3c35f0444086537f66 08-Apr-2008 qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> Update all files to follow doxygen style file header.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5002 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
d38a0f446fbb13a7969294cc6665ee7c789d9fc2 30-Sep-2007 qhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524> Update to support to produce Component Name and & Component Name 2 protocol based on Feature flag PcdComponentNameDisable & PcdComponentName2Disable.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4003 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
adbcbf8ffcaedab483d23b52e8283aaad74cc807 16-Jul-2007 vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> Modules cleanup.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3244 6f19259b-4bc3-4df7-8a09-765794883524
/device/linaro/bootloader/edk2/MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c