Sync patch r16215 from main trunk.

AtaBusDxe: Fix ReadBlockEx and WriteBlockEx 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: svn://svn.code.sf.net/p/edk2/code/branches/UDK2014.SP1/MdeModulePkg@16424 6f19259b-4bc3-4df7-8a09-765794883524
Sync patch r16278 from main trunk.

Fix a bug introuduced by r16104, not all NIC device implement both memory and IO bar.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>

(cherry picked from commit eb0d6c6d909b00861845607750db35e4fa905121)

git-svn-id: svn://svn.code.sf.net/p/edk2/code/branches/UDK2014.SP1/MdeModulePkg@16432 6f19259b-4bc3-4df7-8a09-765794883524
Sync patch r16280 from main trunk.

MdeModulePkg/SecurityPkg Variable: Add boundary check for while (IsValidVariableHeader (Variable)).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: svn://svn.code.sf.net/p/edk2/code/branches/UDK2014.SP1/MdeModulePkg@16433 6f19259b-4bc3-4df7-8a09-765794883524
Sync patch r16321 from main trunk.

MdeModulePkg/AtaAtapiPassThru: don't write read-only AHCI MMIO register

Per AHCI 1.1 spec, AE bit of GHC register is read-only if CAP.SAM is 1

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>

(cherry picked from commit 88a6b93f82a756e94d782acaaeacc9f3d74ab319)

git-svn-id: svn://svn.code.sf.net/p/edk2/code/branches/UDK2014.SP1/MdeModulePkg@16436 6f19259b-4bc3-4df7-8a09-765794883524