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: https://svn.code.sf.net/p/edk2/code/branches/UDK2014.SP1@16424 6f19259b-4bc3-4df7-8a09-765794883524
Sync patch r16217 from main trunk.

Add comments for FSVariable driver which used by Duet platform only, trust all meta data for this platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

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

Add comments for FSVariable driver which used by Duet platform only, trust all meta data for this platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

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

Add PubKey index check before touching PubKey cache. Internal PubKey Variable PubkeyIndex is always 0, causing Index – 1 overflow. Update corresponding comments.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Dong Guo <guo.dong@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>

(cherry picked from commit 13f6b584f5ab78f349c2d480093aae122e3ea949)

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

Add comments to clarify mPubKeyStore buffer MemCopy. There is no memory overflow issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>

(cherry picked from commit 396d9cb178f841ab3980f5f788ae26231e02fbc8)

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

Update edksetup.bat to support Microsoft Visual Studio 2013 when building the Nt32Pkg emulation platform (enabled using the --nt32 flag).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: lhauch <larry.hauch@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

(cherry picked from commit efbdab2014f869b31b77ec5fa2f3f79fbd41cee1)

git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2014.SP1@16431 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: https://svn.code.sf.net/p/edk2/code/branches/UDK2014.SP1@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: https://svn.code.sf.net/p/edk2/code/branches/UDK2014.SP1@16433 6f19259b-4bc3-4df7-8a09-765794883524
Sync patch r16281 from main trunk.

Remove redundant ASSERT in TcgDxe & TreeDxe. Some asserts are removed directly, some are replaced by debug output.
ASSERT for SetupEventLog is kept. It is the foundation of TcgProtocol and TrEEProtocol

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>

(cherry picked from commit 2013c26b068bf06b532a93c33cd1824e09d91cd6)

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

Fix execution status & DEBUG message level mismatch. EFI_D_ERROR is used only when failure/case can't be resolved by code.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Dong Guo <guo.dong@intel.com>

(cherry picked from commit c70d19067cfb95bf4d1de4963d1b3480ccaf36e0)

git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2014.SP1@16435 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: https://svn.code.sf.net/p/edk2/code/branches/UDK2014.SP1@16436 6f19259b-4bc3-4df7-8a09-765794883524
Sync patch r16337 from main trunk.

Fix a bug in DHCP6 driver when using DUID LLT.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Dong Eric <eric.dong@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>

(cherry picked from commit a95992233b9ddc53bc52583d09104eab22f9fb72)

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

BaseTools: Fix a cleanall issue.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yingke Liu <yingke.d.liu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

(cherry picked from commit 3cd9371f68ea90aab26b0cde94f1916f56036df2)

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