Commit Graph

121 Commits

Author SHA1 Message Date
Jiewen Yao 9753360756 MdeModulePkg/CdExpressPei: Use PcdRecoveryFileName PCD.
This PCD is used to indicated the recovery file name.
The previous name - FvMain.Fv is hardcoded in CdExpressPei.
It does not make sense to force the name.

Now a platform may use any recovery file name.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2016-10-12 09:15:23 +08:00
Jiewen Yao 9381ad8701 MdeModulePkg/CdExpressPei: Fix capsule size mismatch issue.
Current PeiCdExpress driver will return capsule size to
be block aligned.
It will fail if we check the capsuleImageSize field.

The patch correct the returned capsule size.

Tested-by: Eric Dong <eric.dong@intel.com>

Cc: Feng Tian <feng.tian@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-10-08 09:31:05 +08:00
Hao Wu 6558fd7311 MdeModulePkg RamDiskDxe: Not use hardcode 'SectionInstance' to locate SSDT
This commit will scan all the EFI raw section instances within the
module's FV to make sure the NVDIMM root device SSDT can be properly
located.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Zhang Chao B <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
2016-07-20 15:07:19 +08:00
Tapan Shah 4b1f464688 MdeModulePkg/RamDiskDxe: Add Memory Type selection support in Ramdisk HII
Adding an option in HII menu so user can choose memory type to use when
creating a RAM Disk in system.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
2016-06-12 11:11:37 +08:00
Hao Wu 5cf8a917bd MdeModulePkg RamDiskDxe: Do not save 'Size' numeric value by varstore
The 'Size' numeric value used when creating a raw RAM disk does not
require a varstore to save its previous value in the create raw RAM disk
HII page.

The expecting behavior is that after a user created a raw RAM disk, the
next time when the create raw RAM disk page is entered, the 'Size' numeric
will be the default value (EFI_PAGE_SIZE).

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>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
2016-06-12 11:11:25 +08:00
Hao Wu 3ab7066e8d MdeModulePkg RamDiskDxe: Fix VS2010 build error
Potentially uninitialized local variables 'TableKey' and 'TableHeader'
might be used in functions RamDiskPublishNfit() and RamDiskUnpublishNfit()
in file RamDiskProtocol.c.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Qiu Shumin <shumin.qiu@intel.com>
2016-05-30 11:44:57 +08:00
Hao Wu 07fb9c2644 MdeModulePkg RamDiskDxe: VALID_ARCH cleanup to list supported options
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>
2016-05-25 13:29:43 +08:00
Hao Wu 09abc63675 MdeModulePkg RamDiskDxe: Fix wrong HII behavior for more than 8 RAM disks
The RamDiskDxe driver originally uses a variable-length HII varstore to
retrieve the HII checkbox status of each registered RAM disk.

However, HII does not support the variable-length varstore feature.
Therefore, only the checkbox status for the first 8 RAM disks are tracked
for the following definition of HII varstore structure considering the
alignment:

typedef struct {
  UINT64    Size;
  UINT8     RamDiskList[0];
  } RAM_DISK_CONFIGURATION;

This commit uses the private data of each registered RAM disks to track
the HII checkbox status instead to resolve the issue.

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>
2016-05-10 11:08:57 +08:00
Hao Wu 07a3fecd4c MdeModulePkg RamDiskDxe: Report ACPI NFIT for reserved memory RAM disks
The RamDiskDxe now will report RAM disks with reserved memory type to NFIT
in the ACPI table.

This commit will also make sure that an NVDIMM root device exists in the
\SB scope before reporting any RAM disk to NFIT.

To properly report the NVDIMM root device, one will need to append the
following content in the [Rule.Common.DXE_DRIVER] field in platform FDF
files:

RAW ACPI  Optional                |.acpi
RAW ASL   Optional                |.aml

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>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
2016-05-10 08:45:11 +08:00
Samer El-Haj-Mahmoud 5eae4ff002 MdeModulePkg RamDiskDxe: Fix incorrect RAM disk memory address calculation
EndingAddress is calculated incorrectly. Original code calculates it as
(StartingAddress + Size). Correct value should be (StartingAddress +
Size - 1.

Note:
Besides the changes made by Samer, Hao also fixed a similar issue in
RamDiskImpl.c

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Signed-off-by: Tapan Shah <tapandshah@hpe.com>
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
2016-03-31 13:08:44 +08:00
Hao Wu e33257215b MdeModulePkg PartitionDxe: Add Re-entry handling logic for BindingStop
There are scenario when the BindingStop service of PartitionDxe driver be
re-entered.

An example will be ejecting a DVD from a SATA DVDROM and then run
"reconnect -r" under shell. In this specific case, part of the calling
stack will be:

PartitionDriverBindingStop() (PartitionDxe) ->
Stop first child handle (PartitionDxe) ->
ScsiDiskFlushBlocksEx() (ScsiDiskDxe) ->
A media change is detected (ScsiDiskDxe) ->
Reinstall of BlockIO(2) protocols (ScsiDiskDxe) ->
Entering PartitionDriverBindingStop() again (PartitionDxe) ->
Potential risk of referencing already stopped child handle (PartitionDxe)
...

The current code has potential issue of referencing of already stopped
child handle. This commit adds re-entry handling logic to resolve such
issue.

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>
2016-03-29 15:50:01 +08:00
Hao Wu a5e5a2f581 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>
2016-03-29 13:39:13 +08:00
Hao Wu 744c71687b MdeModulePkg PartitionDxe: Some ISO images cannot be recognized properly
Some ISO images cannot be recognized properly when they are on media whose
block size is not 2048 bytes.

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>
2016-03-29 13:35:30 +08:00
Alcantara, Paulo a7b15909e8 MdeModulePkg/RamDiskDxe: Fix typo in HII message
s/Configutation/Configuration/

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paulo Alcantara <paulo.alc.cavalcanti@hp.com>
Signed-off-by: Juliano Ciocari <juliano.ciocari@hp.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@Intel.com>
2016-03-24 20:48:40 +08:00
Hao Wu 6a9bc80154 MdeModulePkg RamDiskDxe: Remove unnecessary TPL raise operations
There is no asynchronous operations to the registered RAM disks link list
maintained within RamDiskDxe driver, therefore, the TPL raise and restore
operations when dealing with the link list are unnecessary.

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>
2016-03-23 13:38:19 +08:00
Hao Wu 28620e603d MdeModulePkg RamDiskDxe: Uninstall DEVICE_PATH_PROTOCOL with correct param
Previously, the code uninstalls the DEVICE_PATH_PROTOCOL with the device
path given by caller of the 'RamDiskUnregister' function. The given device
path might be different from the one used to install the
DEVICE_PATH_PROTOCOL.

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>
2016-03-23 13:38:10 +08:00
Hao Wu 21a976e4c0 MdeModulePkg RamDiskDxe: Remove unnecessary 'DisconnectController' calls
The 'DisconnectController' function calls after
'UninstallMultipleProtocolInterfaces' are unnecessary, since
'DisconnectController' is called inside function
'UninstallMultipleProtocolInterfaces'.

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>
2016-03-23 13:38:01 +08:00
Hao Wu 216fefa3f5 MdeModulePkg RamDiskDxe: Install Block I/O 2 Protocol on RAM disk devices
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-02-29 13:51:19 +08:00
Hao Wu 20752cb8e7 MdeModulePkg: Add RamDiskDxe driver implementation
The RamDiskDxe driver will:
1. Produce the EFI RAM Disk Protocol
2. Install RAM disk device path and block I/O related protocols on the
   RAM disk device handle.
3. Install RAM disk configuration form to HII database

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-02-29 13:51:08 +08:00
Ni, Ruiyu ad24a4d735 MdeModulePkg/Partition: Fix 64bit build failure caused by last patch
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-02-23 15:21:32 +08:00
Ruiyu Ni e665a69d9d MdeModulePkg/Partition: Use proper partition number for MBR
UEFI Spec 2.3.1.D Section 9.3.5.1 says Partitions are numbered
according to their entry in their respective partition table,
starting with 1.
Update the code for MBR partition to follow this rule.

Ref: https://github.com/tianocore/edk2/issues/50

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-02-19 10:50:09 +08:00
Hao Wu 66ca22d05c 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
2015-12-22 13:55:13 +00:00
Jordan Justen 3f5287971f MdeModulePkg: Convert all .uni files to utf-8
To convert these files I ran:

$ python3 BaseTools/Scripts/ConvertUni.py MdeModulePkg

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19257 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-15 04:56:23 +00:00
Ronald Cron df473cc1fc MdeModulePkg/PartitionDxe: Fix media probe
The call in ProbeMediaStatus() to the ReadDisk() function of the
EFI_DISK_IO_PROTOCOL interface implemented in DiskIoDxe/DiskIo.c
crashed in DiskIo2ReadWriteDisk() because of the NULL value of
the destination buffer pointer.

Pass the address of a buffer in the stack instead of a NULL
pointer.

In addition to avoiding the crash, that way, the media probe does not
depend anymore on the way the EFI_DISK_IO_PROTOCOL implementation deals
with a NULL value of the destination buffer pointer as the UEFI
specification does not specify the expected behaviour.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ronald Cron <Ronald.Cron@arm.com>
Reviewed-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@17859 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-07 11:26:27 +00:00
Feng Tian 02c9f1448c MdeModulePkg/CdExpressPei: Fix build error
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17489 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-21 05:36:40 +00:00
Feng Tian f9964c8019 MdeModulePkg/CdExpressPei: Add RecoveryBlockIo2Ppi support
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17481 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-20 06:32:03 +00:00
Ruiyu Ni 173acde916 Fix IA32 build failure: Use MultU64x32 for 64bit * 32bit.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16604 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-13 05:33:47 +00:00
Olivier Martin 5d6bf9e229 MdeModulePkg/PartitionDxe: Fixed El Torito support when the medium is not a CDROM
El Torito format can be used on different media (eg: USB).
A ISO image can be dumped onto a USB mass-storage.

These media might not have the same block size as the CDROM media (ie: 2KB).
The El Torito code and the specification assumes a LBA 2KB.

In addition, the specification says in "12.3.4.4 CD-ROM and DVD-ROM":
UEFI code does not assume a fixed block size.

I was able to dupliacte the issue by copying a debian ISO on a USB driver.

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@16600 6f19259b-4bc3-4df7-8a09-765794883524
2015-01-12 12:28:36 +00:00
Samer El-Haj-Mahmoud 0133195170 MdeModulePkg: Misc comments and DEBUG messages
Fixed some spelling typos in some comments. Added a couple of useful DEBUG messages 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@hp.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16450 6f19259b-4bc3-4df7-8a09-765794883524
2014-11-27 01:01:43 +00:00
Ruiyu Ni bf5a9493fa 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
2014-10-15 04:49:04 +00:00
Gao, Liming 35c77daed9 MdeModulePkg: Convert non DOS format files to DOS format and remove unused module UNI files.
1. Module UNI and Package UNI files are not DOS format. Convert them to DOS format.
2. Remove unused SectionExtractionDxeModStrs.uni and SectionExtractionPeiModStrs.uni

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gao, Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16044 6f19259b-4bc3-4df7-8a09-765794883524
2014-09-03 08:39:12 +00:00
Zeng, Star fea55a1661 MdeModulePkg: INF/DEC file updates to EDK II packages
2. Add MODULE_UNI_FILE file that contains the localized Abstract and Description of a module.
a. Addresses an information gap between INF files and the UEFI Distribution Packaging Specification XML schema
b. There will be an associated update to UPT in BaseTools to consume MODULE_UNI_FILE and associated UNI file during UDP creation that performs the INF -> XML conversion.
c. There will be an associated update to UPT in BaseTools to produce MODULE_UNI_FILE and associated UNI file during UDP installation that performs the XML -> INF conversion.

3. Add Module Extra UNI file that provides the localized Name of a module.
a. [UserExtensions.TianoCore."ExtraFiles"] provides an easy method for a module to specify extra files not listed in [Sources] or [Binaries] sections to be added to a UDP without having to list the files in the UPT package information data file.
b. There will be an associated update to UPT in BaseTools to package up files listed in [UserExtensions.TianoCore."ExtraFiles"] during UDP creation.
c. UNI file contains localized name of a module to go along with the localized Abstract and Description from the MODULE_UNI_FILE.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zeng, Star <star.zeng@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15963 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-28 06:53:43 +00:00
Zeng, Star 6036e94dc9 MdeModulePkg: INF/DEC file updates to EDK II packages
1. Usage information in INF file comment blocks are either incomplete or incorrect.  
This includes usage information for Protocols/PPIs/GUIDs/PCDs/HOBs/Events/BootModes.  
The syntax for usage information in comment blocks is defined in the EDK II Module Information (INF) Specification

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zeng, Star <star.zeng@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15962 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-28 06:34:06 +00:00
Sergey Isakov 69c0fbd2c5 MdeModulePkg/PartitionDxe: Simplify the error handling of DriverBindingSupported().
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
Reviewed-by: Feng Tian <feng.tian@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15828 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-19 05:37:28 +00:00
Olivier Martin e645bd857d 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
2014-02-12 11:37:57 +00:00
Star Zeng 56a9e699dd MdeModulePkg CdExpressPei: Use correct PeiServices pointer to call low level BlockIoPpi->ReadBlocks.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15050 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-06 03:36:31 +00:00
Ruiyu Ni 4636295f46 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
2013-12-17 05:00:10 +00:00
Ruiyu Ni 80c83a6995 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
2013-09-17 05:11:30 +00:00
Laszlo Ersek 4e39b75e7e 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
2013-08-26 02:47:41 +00:00
Ruiyu Ni de49225db8 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
2013-08-22 05:15:05 +00:00
Ruiyu Ni b822eb4237 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
2013-08-21 08:35:44 +00:00
Olivier Martin f5ec0a86d8 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
2013-08-21 06:49:25 +00:00
Ruiyu Ni 493d8e3a5e 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
2013-08-20 03:14:30 +00:00
Star Zeng b4e027f1c6 MdeModulePkg PartitionDxe: Ensure the NumberOfPartitionEntries * 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
2013-07-31 01:09:38 +00:00
jyao1 dc204d5a0f Add comment for modules which have external input.
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-06-12 08:28:43 +00:00
niruiyu d0e9c3caeb Use PartitionHeader->SizeOfPartitionEntry instead of sizeof (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
2012-05-09 05:21:43 +00:00
qianouyang 21e1018b1c 1. Remove the unnecessary check of the existing of BlockIo2 in 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-12-01 05:10:41 +00:00
niruiyu c86b273d90 Grub4Dos copies the BPB of the first partition to the MBR. If the 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-10-12 02:45:02 +00:00
niruiyu 65fd395218 The patch enhances the Partition driver to return the media status (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-09-19 06:24:50 +00:00
jljusten 30c00a1cfa MdeModulePkg: Add CD Express PEIM
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-12 20:36:05 +00:00