summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Disk
AgeCommit message (Collapse)Author
2013-09-17Fix 3 bugs in DiskIoDxe and PartitionDxe drivers introduced in DiskIo2 ↵Ruiyu Ni
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
2013-08-26MdeModulePkg/DiskIoDxe: fix source/destination pointer of overrun transferLaszlo Ersek
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
2013-08-22Fix DDK3790 build failure.Ruiyu Ni
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
2013-08-21Fix function header comments for DiskIoDestroySubtask.Ruiyu Ni
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
2013-08-21MdeModulePkg/DiskIoDxe: Fixed GCC build errorOlivier Martin
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
2013-08-20Add DiskIo2 protocol definition to MdePkg.Ruiyu Ni
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
2013-07-31MdeModulePkg PartitionDxe: Ensure the NumberOfPartitionEntries * ↵Star Zeng
SizeOfPartitionEntry doesn't overflow. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14520 6f19259b-4bc3-4df7-8a09-765794883524
2012-06-12Add comment for modules which have external input.jyao1
signed-off-by: jiewen.yao@intel.com reviewed-by: guo.dong@intel.com reviewed-by: ting.ye@intel.com reviewed-by: liming.gao@intel.com reviewed-by: elvin.li@intel.com git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13446 6f19259b-4bc3-4df7-8a09-765794883524
2012-05-09Use PartitionHeader->SizeOfPartitionEntry instead of sizeof ↵niruiyu
(EFI_PARTITION_ENTRY). Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13296 6f19259b-4bc3-4df7-8a09-765794883524
2011-12-011. Remove the unnecessary check of the existing of BlockIo2 in ↵qianouyang
PartitionDriverBindingSupported(). 2. Remove the comments of the BlockIo2 check in PartitionDriverBindingStart(). Signed-off-by: qianouyang Reviewed-by: niruiyu git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12806 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-12Grub4Dos copies the BPB of the first partition to the MBR. If the ↵niruiyu
DriverBindingStart() of the Fat driver gets run before that of Partition driver only the first partition can be recognized. Let the driver binding version of Partition driver be higher than that of Fat driver to make sure the DriverBindingStart() of the Partition driver gets run before that of Fat driver so that all the partitions can be recognized. Signed-off-by: niruiyu Reviewed-by: erictian git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12528 6f19259b-4bc3-4df7-8a09-765794883524
2011-09-19The patch enhances the Partition driver to return the media status ↵niruiyu
(EFI_NO_MEDIA/EFI_MEDIA_CHANGED) even the other parameters are not valid for BlockIo2 interfaces. Signed-off-by: niruiyu Reviewed-by: erictian Reviewed-by: qianouyang git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12378 6f19259b-4bc3-4df7-8a09-765794883524
2011-07-12MdeModulePkg: Add CD Express PEIMjljusten
Signed-off-by: jljusten Reviewed-by: mdkinney git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12012 6f19259b-4bc3-4df7-8a09-765794883524
2011-07-06Fix the comments to follow UEFI Spec regarding how to check an EFI_HANDLE is ↵niruiyu
valid/invalid. Signed-off-by: niruiyu Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11987 6f19259b-4bc3-4df7-8a09-765794883524
2011-06-08String Reference Cleanup.lzeng14
Signed-off-by: lzeng14 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11762 6f19259b-4bc3-4df7-8a09-765794883524
2011-05-27MdeModulePkg: Fixed memory corruption when BlockIo2 is not presentgeekboy15a
Fixed NULL pointer reference of BlockIo2.Media in partition code. This resulted in the interrupt vector table being corrupted in a legacy (CSM) based system. Signed-off-by: geekboy15a Reviewed-by: mdkinney Reviewed-by: niruiyu Reviewed-by: jljusten git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11711 6f19259b-4bc3-4df7-8a09-765794883524
2011-05-23Change Partition/ScsiDxe driver to produce Block IO revision 3.niruiyu
Signed-off-by: niruiyu Reviewed-by: erictian git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11692 6f19259b-4bc3-4df7-8a09-765794883524
2011-05-19Update the function's descriptions (which is in AtaBus, AtaAtapiPassThru, ↵qianouyang
Partition drivers) to make them be consistent with the code. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11678 6f19259b-4bc3-4df7-8a09-765794883524
2011-05-06Add Pointer check for NULL before referring it and remove unnecessary ↵qianouyang
pointer check in AtaAtapiPassThru and Partition Drivers. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11627 6f19259b-4bc3-4df7-8a09-765794883524
2011-05-03Add BlockIO2 Protocol.qianouyang
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11606 6f19259b-4bc3-4df7-8a09-765794883524
2011-04-25Change BlockIo drivers to return EFI_NO_MEDIA or EFI_MEDIA_CHANGED even the ↵niruiyu
Buffer/BufferSize/Lba is invalid so that caller can probe the media status easier. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11584 6f19259b-4bc3-4df7-8a09-765794883524
2011-04-01Set the BlockIo.Media.IoAlign to 0 because the BlockIo produced by Partition ↵niruiyu
driver consumes DiskIo for read/write operation which doesn't have IO alignment requirement. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11493 6f19259b-4bc3-4df7-8a09-765794883524
2011-03-14Enhance inf and dec file to follow specs.ydong10
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11392 6f19259b-4bc3-4df7-8a09-765794883524
2010-07-20Per UEFI Spec, LowestAlignedLba and LogicalBlocksPerPhysicalBlock must be 0 ↵niruiyu
for logical partitions. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10668 6f19259b-4bc3-4df7-8a09-765794883524
2010-05-05raise TPL to TPL_CALLBACK level at DriverBindingStart() for all usb-related ↵erictian
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
2010-04-24Update the copyright notice formathhtian
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10418 6f19259b-4bc3-4df7-8a09-765794883524
2010-02-241. Correct File header to ## @filelgao4
2. Remove unnecessary .common] postfix on section. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10052 6f19259b-4bc3-4df7-8a09-765794883524
2009-09-21Update partition driver to not produce BlockIo if a GPT with OS-specific ↵qhuang8
field (BIT1) set in its partition attributes. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9293 6f19259b-4bc3-4df7-8a09-765794883524
2009-09-161. updated "the Bus Driver that creates all of its child handles on the ↵vanjeff
first call to Start()" not to create any child handle if RemainingDeviepath is the End of Device Path Node, per UEFI 2.3. The others changes include: a. Check RemainingDevicePath at beginning of Supported(), make sure it has been verified before Start() is called. b. Check IO protocol firstly rather than EfiDevicePathProtocolGuid, reduce the times entering into Start() function because EfiDevicePathProtocolGuid existed on most of handle. 2. roll back serial drivers not to create child device, if the device speicifed by remainingdevicepath cannot find in the created devices list. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9267 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-14Enhance Partition driver for EFI_NO_MEDIA caseqhuang8
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9070 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-14Enhance GPT to remove the assumption that GPT partition entry in PMBR must ↵qhuang8
be the first partition entry. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9069 6f19259b-4bc3-4df7-8a09-765794883524
2009-08-14Fix a potential issue to use FreePool() with NULL pointer.qhuang8
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9068 6f19259b-4bc3-4df7-8a09-765794883524
2009-07-24Roll back the change in Partition driver. currently we enhance the EHCI ↵eric_tian
driver to guarantee that the EHCI controller get attached to the EHCI controller before the UHCI driver attaches to the UHCI controller. This way can avoid the case happen that UHCI sees the disconnect and EHCI sees the connect event due to the control transfer in shared port. It may cause Partition.Start to be interrupted by Partition.Stop. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8991 6f19259b-4bc3-4df7-8a09-765794883524
2009-07-22if Usb mass storage interface returns EFI_DEVICE_ERROR, we should jump out ↵eric_tian
the loop which is used to determine if the current block device supports GPT/Torito/MBR in Partition driver. This way can avoid Partition.start is interrupted by itself Partition.stop(). git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8977 6f19259b-4bc3-4df7-8a09-765794883524
2009-06-02Use DiskIo->WriteDisk() API to avoid alignment issue.qhuang8
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8445 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-30Replace references to RFC 3066 with RFC 4646. gikidy
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8212 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-27Fix the bug that the "Offset" parameter for DiskIo protocol should be ↵qhuang8
byte-oriented. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8175 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-22Use DiskIo->ReadDisk() API to avoid alignment issue.qhuang8
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8144 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-10Using sizeof(EFO_BLOCK_IO_MEDIA) replace Macro.gikidy
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8054 6f19259b-4bc3-4df7-8a09-765794883524
2009-04-02Modified for use reversion field and fix a typo. gikidy
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8006 6f19259b-4bc3-4df7-8a09-765794883524
2009-01-21Meta-data reviewed and verified.gikidy
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7326 6f19259b-4bc3-4df7-8a09-765794883524
2009-01-20Meta-data review.gikidy
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7319 6f19259b-4bc3-4df7-8a09-765794883524
2009-01-20Meta-data review.gikidy
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7313 6f19259b-4bc3-4df7-8a09-765794883524
2008-12-23Code scrub DxeIpl, Runtime, DevicePath, FvbServicesLib, DiskIo, Partition, ↵qhuang8
English, EBC. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7105 6f19259b-4bc3-4df7-8a09-765794883524
2008-12-18check the usage of %d,%x,%ld,%lx and so on in debug print statement.jji4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7080 6f19259b-4bc3-4df7-8a09-765794883524
2008-12-16Clean up to update the reference of the these macros:qhuang8
EFI_SIGNATURE_16 -> SIGNATURE_16 EFI_SIGNATURE_32 -> SIGNATURE_32 EFI_SIGNATURE_64 -> SIGNATURE_64 EFI_FIELD_OFFSET -> OFFSET_OF EFI_MAX_BIT -> MAX_BIT EFI_MAX_ADDRESS -> MAX_ADDRESS These macros are not defined in UEFI spec. It makes more sense to use the equivalent macros in Base.h to avoid alias. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7056 6f19259b-4bc3-4df7-8a09-765794883524
2008-12-041)Global variables have been moved backward ahead of functions.jji4
2)INF comments have been reviewed. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6839 6f19259b-4bc3-4df7-8a09-765794883524
2008-12-03Remove some useless EDK_RELEASE_VERSION, EFI_SPECIFICATION_VERSION ,and ↵gikidy
review VALID_ARCHITECTURES in inf files with DSC file. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6818 6f19259b-4bc3-4df7-8a09-765794883524
2008-11-111, Add <Library/DevicePathLib.h> for all source that use device path utility ↵klu2
macros 2, Add DevicePathLib library class to module's INF that use device path utility macros git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6456 6f19259b-4bc3-4df7-8a09-765794883524
2008-10-27re-defined CDROM_VOLUME_DESCRIPTOR to be a union including Boot Record ↵vanjeff
Volume Descriptor and Primary Volume Description. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6251 6f19259b-4bc3-4df7-8a09-765794883524