Compare commits

...

179 Commits

Author SHA1 Message Date
324a4c9d7d ShellBinPkg: Ia32/X64 Shell binary update.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
(cherry picked from commit 46e2632b4e)
2017-06-13 16:26:05 +08:00
37a0c27fe1 MdeModulePkg/BMMUiLib: Fix incorrect variable name
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=592

In function UpdateConsoleContent, we compare console name
with "ErrOut" string to check whether the content in console
Error device page has been changed. But when call function
UpdateConsoleContent, we pass console name as "ConErr" by mistake.
This patch is to fix the inconsistent issue.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit 983f59932d)
2017-06-13 10:48:07 +08:00
2447ae30ac SecurityPkg TcgDxe: Simplify debug msg when "TPM not working properly"
Current code for case "TPM not working properly" uses the predefined
macro __FILE__ in debug format string, but uses predefined macro
__LINE__ as parameter, and it also uses multiple pairs of "" in debug
format string.

To be simple and clear, this patch is to update the code to just use
"DriverEntry: TPM not working properly\n" as the debug message.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Amy Chan <amy.chan@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
(cherry picked from commit ec4910cd33)
2017-06-10 13:25:25 +08:00
9e0da2fa43 ShellPkg: Fix typo errors in ifconfig help output
Found few instances where IPv4 and DHCPv4 spelled incorrectly
as IP4 and DHCP4 respectively.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit 97f1cd597e)
2017-06-10 10:25:53 +08:00
0a92412e8f Shell/alias: Print detailed error when deleting alias
STR_GEN_ERR_NOT_FOUND is added and currently is only
used by alias command. This string template can be used
by other commands as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
(cherry picked from commit 937bc66e1e)
2017-06-10 10:25:52 +08:00
a54759c134 ShellPkg/ifconfig: Update help message
Couple of instances had IP4 mentioned, instead of IPv4.
Changing all to IPv4 to maintain consistency.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
(cherry picked from commit c1f4b86ba7)
2017-06-09 10:52:20 +08:00
ed6ff8b7d4 ShellPkg: Remove unnecessary Readme.txt
The Readme.txt contains instructions about how to integrate Shell
into Nt32. Actually Nt32 already contains a macro USE_OLD_SHELL to
choose OLD or NEW Shell.

So remove this txt file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit 752234768e)
2017-06-09 10:32:53 +08:00
872c124c6f BaseTools/Bin: Update the BaseTools Win32 binaries version information
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
2017-06-08 08:47:24 +08:00
ec198f52fc MdePkg: update Wi-Fi/Supplicant header files to meet UEFI 2.7.
This patch is used to update supplicant.h and wifi2.h
to meet UEFI 2.7 definition. Add EfiSupplicant80211PMK
field in EFI_SUPPLICANT_DATA_TYPE and change **NetworkDesc
to NetworkDesc[1] in EFI_80211_GET_NETWORKS_RESULT.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <fan.wang@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
(cherry picked from commit b941c34ef8)
2017-06-07 16:19:47 +08:00
d615a3a136 BaseTools: Fix the bug use same FMP_PAYLOAD in different capsule file
Fix the bug that use same FMP_PAYLOAD in different capsule file. Because
in previous FMP generation, the FMP already be generated, so we don't
need to regenerate again.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit d4c558e83d)
2017-06-07 16:16:16 +08:00
41e13d1056 BaseTools: Fix incremental build failure that override file be removed
Fix a Incremental build failure. The case is: Both A and B package will
include a same .h file, and in the driver's packages section, A
package is listed before B package, so we will use the .h file in the A
package and build success, then we directly delete the .h file in package
A, it cause increment build failure since in the AutoGenTimeStamp file
the .h file in A can't be found.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 4a1167dfef)
2017-06-07 16:16:16 +08:00
a12787c356 ShellBinPkg: Ia32/X64 Shell binary update.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
(cherry picked from commit b9f1625193)
2017-06-07 09:50:44 +08:00
a5765eec77 ShellPkg/parse: Handle Unicode stream from pipe correctly
The original code expects the Unicode stream from pipe doesn't
contains the Unicode BOM.
But that's not true.
Commit [9ed21946c7] changes
CreateFileInterfaceMem() to add the BOM for Unicode stream.

When parse pipe support was firstly added, a private implementation
ParseReturnStdInLine() was created to specially handle
the Unicode stream without BOM. Since now the Unicode steam contains
BOM, the private implementation can be removed and
ShellFileHandleReturnLine() can be used directly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit 4e6394455a)
2017-06-07 08:53:05 +08:00
0164fa8f43 ShellPkg/alias: Return status for alias deletion
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit 7bd5a2c81e)
2017-06-07 08:53:05 +08:00
695d419c4c ShellPkg/alias: Fix bug to support upper-case alias
alias in UEFI Shell is case insensitive.
Old code saves the alias to variable storage without
converting the alias to lower-case, which results
upper case alias setting doesn't work.
The patch converts the alias to lower case before saving
to variable storage.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Tapan Shah <tapandshah@hpe.com>
(cherry picked from commit 7ec69844b8)
2017-06-07 08:53:04 +08:00
a56bfec25f MdePkg: Add BluetoothAttribute.h and BluetoothLeConfig.h
UEFI Spec 2.7 introduces BluetoothAttribute and BluetoothLeConfig
protocols. The patch adds the definitions for them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 9c94cc2ca2)
2017-06-07 08:49:33 +08:00
756065c328 MdePkg/BluetoothIo: Formalize function header comments.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 1e4547668e)
2017-06-07 08:49:32 +08:00
d82ea26664 MdePkg/BluetoothHc: Add detailed function header comments
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 5a39f404f3)
2017-06-07 08:49:30 +08:00
f9a4814a2d MdePkg/BluetoothConfig: Add new EFI_BLUETOOTH_CONFIG_DATA_TYPE types
UEFI spec 2.7 adds new EFI_BLUETOOTH_CONFIG_DATA_TYPE types.
The patch adds them to the header file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 0cbd5830b4)
2017-06-07 08:49:30 +08:00
c26c4067f3 MdePkg/DevicePath: Add BluetoothLe device path node support
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
(cherry picked from commit ff5623e990)
2017-06-07 08:49:29 +08:00
3e47c01c85 ShellPkg/UefiShellLib: Avoid reading undefined content before string
https://bugzilla.tianocore.org/show_bug.cgi?id=566

In function InternalShellPrintWorker(), if the string in variable
'mPostReplaceFormat2' starts with character L'%', the following
expression:

*(ResumeLocation-1) == L'^' at line 2831

will read an undefined value before the starting of string
'mPostReplaceFormat2'.

This commit adds additional logic to avoid reading undefined content.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit d727614c91)
2017-06-02 15:58:27 +08:00
fc2ef2115f MdeModulePkg/Xhci: Correct the indention of comments
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit b0b626ea2f)
2017-06-02 15:57:04 +08:00
121e15a578 ShellPkg/UefiShellLib: Check correct variable for NULL
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit 5220897839)
2017-06-02 15:18:04 +08:00
14bb6567c7 MdeModulePkg/Xhci: Remove TRB when canceling Async Int Transfer
Some USB devices don't report data periodically through Int
Transfer. They report data only when be asked. If the TRB
is not removed from the XHCI HW, when next time HOST asks
data again, the data is reported but consumed by the previous
TRB, which results the HOST thinks data never comes.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit b33b1055b0)
2017-06-02 14:25:26 +08:00
8f0dea41bc MdeModulePkg/MnpDxe: Fix EBC build hang issue.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
(cherry picked from commit 54d7177c78)
2017-06-02 13:19:23 +08:00
0e3899bed8 MdeModulePkg/UsbBus: Correct debug message
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit 76d1c752cb)
2017-06-02 13:02:01 +08:00
0b5813b95d MdeModulePkg/UsbBus: Fix system hang when failed to uninstall UsbIo
When "reconnect -r" is typed in shell, UsbFreeInterface() is called
to uninstall the UsbIo and DevicePath. But When a UsbIo is opened
by a driver and that driver rejects to close the UsbIo in Stop(),
the uninstall doesn't succeed.
But UsbFreeInterface () frees the DevicePath memory without check
whether the uninstall succeeds.
It leads to the DXE core database contain a DevicePath instance but
that instance's memory is freed.
Assertion happens when someone calls InstallProtocol(DevicePath)
because the InstallProtocol() checks all DevicePath instance to
find whether the same one exits in database.

We haven't seen any USB device driver which rejects to close UsbIo
in Stop(), but it's very likely.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
(cherry picked from commit b659b503fa)
2017-06-02 13:02:01 +08:00
8ecee3850d BaseTools/Bin: Update the BaseTools Win32 binaries version information
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
2017-05-31 15:20:21 +08:00
508dc16eae MdePkg/DevicePathLib: Reverse the byte order of BD_ADDR for Bluetooth
For the following two functions:
DevPathFromTextBluetooth()
DevPathToTextBluetooth()

The Bluetooth device address "UINT8  Address[6]" is displayed with the
order from Address[5] to Address[0]. This commit reverses the order.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
(cherry picked from commit 4fc8277133)
2017-05-31 10:33:23 +08:00
ed500f9ed0 UefiCpuPkg/MpInitLib: Force to enable X2APIC if CPU number > 255
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit 71d8226ac6)
2017-05-27 14:10:55 +08:00
537b39af13 UefiCpuPkg/MpInitLib: Check APIC mode change around AP function
If APIC ID values are changed during AP functions execution, we need to update
new APIC ID values in local data structure accordingly.

But if APIC mode change happened during AP function execution, we do not support
APIC ID value changed.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit c6b0feb396)
2017-05-27 14:10:54 +08:00
dc834fb544 UefiCpuPkg/CpuCommonFeaturesLib: Support X2APIC enable
Current X2APIC is enabled in MpInitLib (used by CpuMpPei and CpuDxe) to follow
SDM suggestion. That means we only enable X2APIC if we found there are any
initial CPU ID value >= 255.

This patch is to provide one chance for platform to enable X2APIC even there is
no any initial CPU ID value >= 255.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit 6661abb695)
2017-05-27 14:10:53 +08:00
60b6b38cde BaseTools: Correct if condition expression for DatumType == 'VOID*'
Correct the if condition expression for DatumType == 'VOID*'. Current
this condition is not work since the DatumType is changed before we do
the value judgement.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 687bde9cac)
2017-05-25 11:32:40 +08:00
d3b84e02eb BaseTools: Fix the bug that different DSC file use same build output
We meet a corner case that build different DSC file, but the DSC file use
same build output directory, and the different DSC file use a same PCD
with different Pcd Type, it cause build failure.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 2d49938845)
2017-05-25 11:32:40 +08:00
60ea76dd3a BaseTools: Fix incremental build bug on DynamicPcd Token Generation
During incremental build, we meet the bug that the different drivers use
the different token for the same DynamicPcd.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 99adfe9f51)
2017-05-25 11:32:39 +08:00
931f669d81 UefiCpuPkg/MpInitLib: Fix X64 XCODE5/NASM compatibility issues
https://bugzilla.tianocore.org/show_bug.cgi?id=565

Fix NASM compatibility issues with XCODE5 tool chain.
The XCODE5 tool chain for X64 builds using PIE (Position
Independent Executable).  For most assembly sources using
PIE mode does not cause any issues.

However, if assembly code is copied to a different address
(such as AP startup code in the MpInitLib), then the
X64 assembly source must be implemented to be compatible
with PIE mode that uses RIP relative addressing.

The specific changes in this patch are:

* Use LEA instruction instead of MOV instruction to lookup
  the addresses of functions.

* The assembly function RendezvousFunnelProc() is copied
  below 1MB so it can be executed as part of the MpInitLib
  AP startup sequence.  RendezvousFunnelProc() calls the
  external function InitializeFloatingPointUnits().  The
  absolute address of InitializeFloatingPointUnits() is
  added to the MP_CPU_EXCHANGE_INFO structure that is passed
  to RendezvousFunnelProc().

Cc: Andrew Fish <afish@apple.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Andrew Fish <afish@apple.com>
(cherry picked from commit 3b2928b469)
2017-05-24 15:07:00 -07:00
8bb0a06208 MdeModulePkg/LogoDxe: Return error if HII Package not present
https://bugzilla.tianocore.org/show_bug.cgi?id=554

Update LogoDxe module to print a DEBUG() message and exit
with an error instead of ASSERT_EFI_ERROR() if the HII
Image Package with the logo image is not present.

If a tool chain does not support generation of PE/COFF
resource sections, then this module can not produce the logo
from an HII Image Package.  XCODE5 is an example of a tool
chain that does not currently support generation of PE/COFF
resource sections.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit 1c020add31)
2017-05-24 15:06:35 -07:00
cfab632610 edk2: Add .DS_Store to .gitignore for macOS
https://bugzilla.tianocore.org/show_bug.cgi?id=558

macOS may generate .DS_Store files in directories.
The .gitignore file is updated to ignore these
.DS_Store files.

Cc: Andrew Fish <afish@apple.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Andrew Fish <afish@apple.com>
(cherry picked from commit 112f4ada2e)
2017-05-24 15:06:14 -07:00
4dae0b6999 BaseTools: Clean up tools_def.template for XCODE5
Reorganize the statements for XCODE5 to match other tool
chains and remove dependency on XCLANG and XCODE32

Cc: Andrew Fish <afish@apple.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Andrew Fish <afish@apple.com>
(cherry picked from commit 3e1d93c32e)
2017-05-24 15:06:01 -07:00
4f953cca20 BaseTools: Add -D NO_MSABI_VARGS to X64 XCODE5 CC_FLAGS
https://bugzilla.tianocore.org/show_bug.cgi?id=561

Update BaseTools/Conf/tools_def.template to add the define

-D NO_MSABI_VAARGS

To CC_FLAGS for X64 XCODE5 builds.

The llvm/clang compiler used in XCODE5 builds supports the
_ms_ versions of the vararg builtins, but the compiler
generates build errors.

The recommendation from the XCODE5 experts is to never use
the _ms_ version of the vararg builtins.  The define
NO_MSABI_VARARGS is already supported in MdePkg/Include/Base.h
and forces the use the standard vararg builtins.

Cc: Andrew Fish <afish@apple.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Andrew Fish <afish@apple.com>
(cherry picked from commit bdaced0bcf)
2017-05-24 15:05:45 -07:00
6933eb824a OvmfPkg: Add XCODE5 statements to fix build break
https://bugzilla.tianocore.org/show_bug.cgi?id=559

The XCODE5 tool chain has a FAMILY of GCC.  The
GCC statements in the [BuildOptions] section add
flags that are not compatible with XCODE5.  Add
empty XCODE5 statements in [BuildOptions] sections
to prevent the use of the GCC flags in XCODE5
builds.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 01e9597540)
2017-05-24 15:05:32 -07:00
e10f7f1bae UefiCpuPkg: Use FINIT instead of hex values
https://bugzilla.tianocore.org/show_bug.cgi?id=560

Update X64 NASM file to match IA32 NASM file
and use FINIT instruction instead of hand
assembled hex values for the FINIT instruction.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
(cherry picked from commit b9dbc03e5a)
2017-05-24 15:05:18 -07:00
19b5379a3c UefiCpuPkg/BaseUefiCpuLib: Use NASM read-only data section name
https://bugzilla.tianocore.org/show_bug.cgi?id=556

NASM requires read-only data sections to use the section
name .rodata.  This fix changes .rdata to .rodata.

The build failure from use of .rdata is seen when using
the XCODE5 tool chain.

Section "7.8.1 macho extensions to the SECTION Directive"
of the NASM documentation at http://www.nasm.us/doc/
describes the section name requirements.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
(cherry picked from commit 5b78f30d81)
2017-05-24 15:05:08 -07:00
66a539b5d4 UefiCpuPkg/PiSmmCpuDxeSmm: Add missing JMP instruction
https://bugzilla.tianocore.org/show_bug.cgi?id=555

Add JMP instruction in SmiEntry.S file that is missing.  This
updates SmiEntry.S to match the logic in SmiEntry.asm and
SmiEntry.nasm.

The default BUILDRULEORDER has .nasm higher priority than
.asm or .S, so this issue was not seen with MSFT or GCC
tool chain families.  The XCODE5 tool chain overrides the
BUILDRULEORDER with .S higher than .nasm, so this issue
was only seen when using XCODE5 tool chain when IA32 SMM
is enabled.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 0d0a19cb14)
2017-05-24 15:04:55 -07:00
cb053bb8a3 PcAtChipsetPkg/SerialIoLib: Remove negative value shift
https://bugzilla.tianocore.org/show_bug.cgi?id=553

Remove left shift of negative values that always evaluate
to 0 to address build errors from the llvm/clang compiler
used in the XCODE5 tool chain.

Clang rightfully complains about left-shifting ~DLAB. DLAB is #defined
as 0x01 (an "int"), hence ~DLAB has value (-2) on all edk2 platforms.
Left-shifting a negative int is undefined behavior.

Rather than replacing ~DLAB with ~(UINT32)DLAB, realize that the nonzero
bits of (~(UINT32)DLAB << 7) would all be truncated away in the final
conversion to UINT8 anyway. So just remove (~DLAB << 7).

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit bbd61de5db)
2017-05-24 15:04:16 -07:00
1a6ed43a07 MdeModulePkg SmiHandlerProfile: Use fixed data type in data structure
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=568

Use fixed data type in data structure and make the structure
be natural aligned.
Without this update, the code must assume DXE and SMM are using
same data type (same size of UINTN), but it may be not true at
some case, for example, after standalone SMM feature is enabled.
With this update, the data structure will be phase independent
and convenient for consumer to parse the data.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit f248539538)
2017-05-24 15:29:02 +08:00
93637612c0 MdeModulePkg SmiHandlerProfile: Fix no PDB case handling incorrectly
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=569

The PdbStringOffset should be set to 0 for no PDB case,
then SmiHandlerProfileInfo can use it to know whether
there is PCD info or not.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 8ced192d5c)
2017-05-24 15:29:01 +08:00
d58f502728 UefiCpuPkg/DxeMpInitLib.inf: Add missing SynchronizationLib
Contributed-under: TianoCore Contribution Agreement 1.0
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit ac63e9392e)
2017-05-23 14:48:27 +08:00
7ecf635971 MdeModulePkg/BDS: Fix a buffer overflow bug
KeyOption points to a buffer holding the content of Key####.
So its size is smaller than EFI_BOOT_MANAGER_KEY_OPTION.
Old code to assign value to KeyOption->OptionNumber modifies
the memory outside of the KeyOption buffer.

The patch fixes this bug.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Steven Shi <steven.shi@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
(cherry picked from commit 7320b8ed18)
2017-05-22 09:51:18 +08:00
454d99de04 CryptoPkg/BaseCryptLib: Add NULL pointer checks in DH and P7Verify
Add more NULL pointer checks before using them in DhGenerateKey and
Pkcs7GetCertificatesList functions to eliminate possible dereferenced
pointer issue.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
(cherry picked from commit a9fb7b7803)
2017-05-22 09:00:16 +08:00
3ecfa5668f MdeModulePkg PCD: Fix TmpTokenSpaceBufferCount not assigned correctly
When DynamicEx PCD is only used in PEI code, but not DXE code,
current implementation of DxePcdGetNextTokenSpace does not assign
TmpTokenSpaceBufferCount correctly, but leaves it as initial value,
then DxePcdGetNextTokenSpace may return incorrect token space guid
and status.

This patch is to fix this issue.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit da0df6ca8f)
2017-05-19 11:36:34 +08:00
2d18c3a917 MdeModulePkg/UfsPassThruDxe: Fix typo in UfsPassThruGetTargetLun()
For function UfsPassThruGetTargetLun(), the length of the input device
node specified by 'DevicePath' should be compared with the size of
'UFS_DEVICE_PATH' rather than the size of 'SCSI_DEVICE_PATH'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit a8321feebb)
2017-05-17 15:30:44 +08:00
ceaf8ece84 BaseTools/Bin: Update the BaseTools Win32 binaries version information
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
2017-05-13 09:52:45 +08:00
b46e49e70d BaseTools: Fix the bug for CArray PCD override in command line
This patch updated the CArray PCD override format from B"{}" to H"{}"
which align to build spec. Besides, it also do the clean up for the
function BuildOptionPcdValueFormat.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit db55dac775)
2017-05-12 16:45:50 +08:00
b0cfe7bb57 ShellBinPkg: Ia32/X64 Shell binary update.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
(cherry picked from commit 7607599627)
2017-05-12 14:54:20 +08:00
6358c320ad BaseTools: Fix the bug that FixedPcdGetPtr failure for CArray Pcd
This patch for the bug FixedPcdGetPtr report failure for the CArray type
Pcd. 1) correct the Fixed Pcd list; 2) correct the Fixed Pcd in Library
AutoGen file to same with Driver AutoGen file format.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-05-12 13:37:49 +08:00
1d22d00766 MdeModulePkg SmiHandlerProfile: Fix memory leak in DumpSmiChildContext
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=530

In DumpSmiChildContext() of SmiHandlerProfile.c and
SmiHandlerProfileInfo.c, the return buffer from
ConvertDevicePathToText() should be freed after used.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit fb1c81a1e5)
2017-05-12 13:09:12 +08:00
219fee13c8 ShellPkg/memmap: Dump memory map information for all memory types
The patch dumps memory map information for all memory types.
But to follow the SFO format of "memmap" defined in Shell 2.2 spec,
the patch doesn't dump the memory map information for OEM/OS
memory types. But it does include the OEM/OS memory in the total
size in SFO format.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit 8bb61740d4)
2017-05-12 10:51:43 +08:00
14ddca5afe ShellPkg/memmap: Refine code
The patch changes Buffer to Descriptors, changes
(UINT8 *Walker) to (EFI_MEMORY_DESCRIPTOR *Walker).
The change makes lots of type conversion unnecessary.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit ac25ebdccc)
2017-05-12 10:51:43 +08:00
afd7109b1c ShellPkg/HandleParsingLib: Show LoadedImageProtocol file name
This patch adds support for showing the file name associated with a
LoadedImageProtocol file path. This is a behavior that was present in
the old shell but has been lost in the new shell.

For example, using 'dh -v' in the old shell:

    Handle D3 (3A552218)
    Image (3A54C918)   File:MicrocodeUpdate
        ParentHandle..: 3A666398

vs. the new shell:

    D3: 3A552218
    LoadedImage
        Revision......: 0x00001000
        ParentHandle..: 3A666398

Here's what the output of 'dh -v' looks like after this patch:

    D3: 3A552218
    LoadedImage
        Name..........: MicrocodeUpdate
        Revision......: 0x00001000
        ParentHandle..: 3A666398

This seems like useful information for the shell to display.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit f4ac435465)
2017-05-11 19:17:16 +08:00
b6adb11163 ShellPkg/HandleParsingLib: Open LoadedImageProtocol first
This patch changes the order of operations to make sure we can open the
LoadedImageProtocol before getting the format string. This should not
affect functionality, and makes the next patch easier to review.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit bbb212afa0)
2017-05-11 19:17:16 +08:00
9107fb6f55 ShellPkg/HandleParsingLib: Show LoadedImageProtocol file path as text
This patch adds support for displaying a text representation of the file
path associated with a LoadedImageProtocol. This is a behavior that was
present in the old shell but has been lost in the new shell.

For example, using 'dh -v' in the old shell:

    FilePath......: FvFile(F3331DE6-4A55-44E4-B767-7453F7A1A021)
    FilePath......: \EFI\BOOT\BOOTX64.EFI

vs. the new shell:

    FilePath......: 3A539018
    FilePath......: 3A728718

This seems like useful information for the shell to display.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit c15323ae2e)
2017-05-11 19:17:15 +08:00
d30c0e3f5a ShellPkg/ShellCommandLib: Update DumpHex to print {|}~
ASCII characters {|}~ should be printed by DumpHex. The problem is that
if you have a string like

    {xizzy}~{foo|bar}~{quux}

in the dumped data, it will not appear as such in the *-delimited ASCII
column to the right, but as

    .xizzy...foo.bar...quux.

which is less than ideal.

Most of the commit message was inspired by/shamelessly stolen from
Laszlo's example:

    https://lists.01.org/pipermail/edk2-devel/2017-April/010266.html

Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
(cherry picked from commit 4bf3b994e8)
2017-05-11 19:17:15 +08:00
9f7e9a0687 UefiCpuPkg/PiSmmCpuDxeSmm: Fix logic check error
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 29dc8aa861)
2017-05-11 16:34:58 +08:00
a08c8afa4c UefiCpuPkg/PiSmmCpuDxeSmm: Check ProcessorId == INVALID_APIC_ID
If PcdCpuHotPlugSupport is TRUE, gSmst->NumberOfCpus will be the
PcdCpuMaxLogicalProcessorNumber. If gSmst->SmmStartupThisAp() is invoked for
those un-existed processors, ASSERT() happened in ConfigSmmCodeAccessCheck().

This fix is to check if ProcessorId is valid before invoke
gSmst->SmmStartupThisAp() in ConfigSmmCodeAccessCheck() and to check if
ProcessorId is valid in InternalSmmStartupThisAp() to avoid unexpected DEBUG
error message displayed.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit b7025df8f9)
2017-05-11 16:34:57 +08:00
c345ecbb9b UefiCpuPkg/SmmCpuFeaturesLib: Correct print level
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit 5d0933f9ba)
2017-05-11 16:34:56 +08:00
166481dabf UefiCpuPkg/SmmCpuFeaturesLib: Fix Ia32/SmiEntry.asm build issue
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit 6afc643ce0)
2017-05-11 16:34:56 +08:00
52dd44ec92 SecurityPkg: Add TCG Spec info to TCG related modules
Add TCG Spec compliance info to TCG related module INFs.

Cc: Qin Long <qin.long@intel.com>
Cc: Yao Jiewen <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
(cherry picked from commit 6d92ae11d1)
2017-05-11 16:23:41 +08:00
103f53b650 BaseTools: Correct VOID* PatchPcd Size in Library Autogen
This patch correct the VOID* PatchPcd Size info generated in the
Library's autogen file. Update it to use the MaxDatumSize.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-05-11 14:32:12 +08:00
0ebc1fa295 MdeModulePkg CapsuleApp: Fix mixed EOL format issue
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit 8ecb1e9bef)
2017-05-11 12:59:49 +08:00
dee4573998 NetworkPkg/IScsiDxe: Switch IP4 configuration policy to Static before DHCP
DHCP4 service allows only one of its children to be configured in the active
state. If the DHCP4 D.O.R.A started by IP4 auto configuration and has not
been completed, the Dhcp4 state machine will not be in the right state for
the iSCSI to start a new round D.O.R.A. So, we need to switch it's policy to
static.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
(cherry picked from commit ef810bc807)
2017-05-11 10:54:46 +08:00
1316cced3e MdeModulePkg/FormDisplay: Make the LineWidth of option consistent
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=529

LineWidth of option in funcrion UpdateSkipInfoForMenu and DisplayOneMenu
are inconsistent. Now fix this issue to avoid incorrect UI display.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit df5914993c)
2017-05-11 10:51:03 +08:00
72d014cd18 BaseTools/Ecc: Add line break support for exception list
Add line break support for exception list.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-05-11 09:31:50 +08:00
ca89f36940 BaseTools: Sync BrotliCompress script the same style
- Sync BrotliCompress script the same style with BrotliCompress.bat

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 8ee193e898)
2017-05-10 16:30:59 +08:00
96f3ca2307 BaseTools: Add --version option in Brotli and BrotliCompress
https://bugzilla.tianocore.org/show_bug.cgi?id=464
V2:
- Add build version

V1:
- Add --version option in Brotli and BrotliCompress

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 98cb468435)
2017-05-10 16:30:57 +08:00
c95b7d8ee1 Nt32Pkg/SnpNt32Dxe: Fix hang issue when multiple network interfaces existed
Currently all the network interfaces share the one recycled transmit buffer
array, which is used to store the recycled buffer address. However, those
recycled buffers are allocated by the different MNP interface if the multiple
network interfaces existed. Then, SNP GetStatus may return one recycled transmit
buffer address to the another MNP interface, which may result in the MNP driver
hang after 'reconnect -r' operation.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
(cherry picked from commit d547b32dcc)
2017-05-09 14:36:39 +08:00
1531c7bd82 NetworkPkg: Fix issue in dns driver when building DHCP packet.
Currently, DNS driver configure the dhcp message type to inform
when building dhcp packet to get dns info from, but it not works
with dhcp server deployed on linux system. However it works well
when changed to request type.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
(cherry picked from commit b61fda1129)
2017-05-09 14:36:31 +08:00
82729eef4c MdeModulePkg: Addressing TCP Window Retraction when window scale factor is used.
The RFC1323 which defines the TCP window scale option has been obsoleted by RFC7323.
This patch is to follow the RFC7323 to address the TCP window retraction problem
when a non-zero scale factor is used.
The changes has been test in high packet loss rate network by using HTTP boot and
iSCSI file read/write.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
(cherry picked from commit ca12a0c83b)
2017-05-09 08:53:03 +08:00
a28adad906 NetworkPkg: Addressing TCP Window Retraction when window scale factor is used.
The RFC1323 which defines the TCP window scale option has been obsoleted by RFC7323.
This patch is to follow the RFC7323 to address the TCP window retraction problem
when a non-zero scale factor is used.
The changes has been test in high packet loss rate network by using HTTP boot and
iSCSI file read/write.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
(cherry picked from commit 3696ceaecb)
2017-05-09 08:53:01 +08:00
66dcf570a6 MdeModulePkg: Add wnd scale check before shrinking window.
Moving Right window edge to the left on sender side without additional check
can lead to the TCP deadlock, when receiver ACKs proper segment, while sender
discards it for future ACK. To prevent this add check if usable window (or
shrink amount in this case) is bigger then receiver's window scale factor.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrey Tepin <atepin@kraftway.ru>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
(cherry picked from commit 207b3d2b0b)
2017-05-09 08:52:58 +08:00
b583486b14 NetworkPkg: Add wnd scale check before shrinking window.
Moving Right window edge to the left on sender side without additional check
can lead to the TCP deadlock, when receiver ACKs proper segment, while sender
discards it for future ACK. To prevent this add check if usable window (or
shrink amount in this case) is bigger then receiver's window scale factor.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Andrey Tepin <atepin@kraftway.ru>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
(cherry picked from commit 2d5afbdad1)
2017-05-09 08:52:55 +08:00
85426bd106 UefiCpuPkg/MtrrLib: Don't report OutOfResource when MTRR is enough
The MTRR calculation algorithm contains a bug that when left
subtraction cannot produce better MTRR solution, it forgets
to restore the BaseAddress/Length so that MtrrLibGetMtrrNumber()
returns bigger value of actual required MTRR numbers.
As a result, the MtrrLib reports OutOfResource but actually the
MTRR is enough.

MEMORY_RANGE mC[] = {
  0, 0x100000, CacheUncacheable,
  0x100000, 0x89F00000, CacheWriteBack,
  0x8A000000, 0x75000000, CacheUncacheable,
  0xFF000000, 0x01000000, CacheWriteProtected,
  0x100000000, 0x7F00000000, CacheUncacheable,
  0xFC240000, 0x2000, CacheWriteCombining // <-- trigger the error
};

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
(cherry picked from commit 3654c4623c)
2017-05-08 13:36:50 +08:00
455af1049f UefiCpuPkg: Update package version to 0.80
Cc: Feng Tian <feng.tian@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit 007b51e180)
2017-05-08 13:32:22 +08:00
08f2c8fd3a UefiCpuPkg: Update package version to 0.80
Cc: Feng Tian <feng.tian@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit 9304197261)
2017-05-08 13:25:00 +08:00
69a8a9ee20 MdePkg DxeServicesLib: Handle potential NULL FvHandle
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=514

The FvHandle input to InternalGetSectionFromFv() may be NULL,
then ASSERT will appear. It is because the LoadedImage->DeviceHandle
returned from InternalImageHandleToFvHandle() may be NULL.
For example for DxeCore, there is LoadedImage protocol installed
for it, but the LoadedImage->DeviceHandle could not be initialized
before the FV2 (contain DxeCore) protocol is installed.

This patch is to update InternalGetSectionFromFv() to return
EFI_NOT_FOUND directly for NULL FvHandle.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit d7b96017cc)
2017-05-08 09:02:03 +08:00
bd49174d05 BaseTools: PCD can only use single access method by source build
Add the error check that A PCD can only use one type for all source
modules.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-05-08 07:56:49 +08:00
91751a0825 BaseTools: remove the hardcoded /bin/bash for PreBuild/PostBuild
This patch remove the hardcoded /bin/bash for PreBuild/PostBuild
scripts.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-05-08 07:56:02 +08:00
f30c40618b MdeModulePkg: Update DEC/DSC version from 0.96 to 0.97
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 717ba86de7)
2017-05-05 15:56:08 +08:00
e399d6ff56 SecurityPkg/Pkcs7VerifyDxe: Add format check in DB list contents
Add the size check for invalid format detection in AllowedDb,
RevokedDb and TimeStampDb list contents.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
(cherry picked from commit 76b35710b9)
2017-05-05 15:07:40 +08:00
fd9e6ee972 SecurityPkg: Update package version to 0.97
Update package version of SecurityPkg to 0.97.

Cc: Qin Long <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
(cherry picked from commit de8e4dc4df)
2017-05-05 13:30:15 +08:00
32c1d95881 NetworkPkg: Update package version to 0.97.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
(cherry picked from commit 9ee3283bfb)
2017-05-05 11:46:50 +08:00
3b530b3896 CryptoPkg: Update package version to 0.97
Update package version of CryptoPkg to 0.97.

Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
(cherry picked from commit b5a9dc8beb)
2017-05-05 11:30:58 +08:00
c54144f512 MdePkg: Update DEC and DSC version from 1.06 to 1.07
UEFI2.6 have been added in MdePkg. Update DEC and DSC version to
reflect those changes in MdePkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 908a47c5f6)
2017-05-05 11:17:22 +08:00
7903b6d2b0 ShellPkg: Update package version to 1.01
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit cc43244842)
2017-05-04 15:55:56 +08:00
929246cc03 ShellPkg/UefiHandleParsingLib: Fix memory leak
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit 00324f3fce)
2017-05-04 15:55:56 +08:00
7ff98a2f77 ShellPkg/Shell: eliminate double-free in RunSplitCommand()
Commit bd3fc8133b ("ShellPkg/App: Fix memory leak and save resources.",
2016-05-20) added a FreePool() call for Split->SplitStdIn, near end of the
RunSplitCommand(), right after the same shell file was closed with
CloseFile(). The argument was:

> 1) RunSplitCommand() allocates the initial SplitStdOut via
>    CreateFileInterfaceMem(). Free SplitStdIn after the swap to fix
>    the memory leak.

There is no memory leak actually, and the FreePool() call in question
constitutes a double-free:

(a) This is how the handle is established:

    ConvertEfiFileProtocolToShellHandle (
      CreateFileInterfaceMem (Unicode),
      NULL
      );

    CreateFileInterfaceMem() allocates an EFI_FILE_PROTOCOL_MEM object and
    populates it fully. ConvertEfiFileProtocolToShellHandle() allocates
    some administrative structures and links the EFI_FILE_PROTOCOL_MEM
    object into "mFileHandleList".

(b) EFI_SHELL_PROTOCOL.CloseFile() is required to close the
    SHELL_FILE_HANDLE and to release all associated data. Accordingly,
    near the end of RunSplitCommand(), we have:

    EfiShellClose()
      ShellFileHandleRemove()
        //
        // undoes the effects of ConvertEfiFileProtocolToShellHandle()
        //
      ConvertShellHandleToEfiFileProtocol()
        //
        // note that this does not adjust the pointer value; it's a pure
        // type cast
        //
      FileHandleClose()
        FileInterfaceMemClose()
          //
          // tears down EFI_FILE_PROTOCOL_MEM completely, undoing the
          // effects of CreateFileInterfaceMem ()
          //

The FreePool() call added by bd3fc8133b conflicts with

  SHELL_FREE_NON_NULL(This);

in FileInterfaceMemClose(), so remove it.

This error can be reproduced for example with:

> Shell> map | more
> 'more' is not recognized as an internal or external command, operable
> program, or script file.

which triggers:

> ASSERT MdeModulePkg/Core/Dxe/Mem/Pool.c(624): CR has Bad Signature

with the following stack dump:

> #0  0x000000007f6dc094 in CpuDeadLoop () at
>     MdePkg/Library/BaseLib/CpuDeadLoop.c:37
> #1  0x000000007f6dd1b4 in DebugAssert (FileName=0x7f6ed9f0
>     "MdeModulePkg/Core/Dxe/Mem/Pool.c", LineNumber=624,
>     Description=0x7f6ed9d8 "CR has Bad Signature") at
>     OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c:153
> #2  0x000000007f6d075d in CoreFreePoolI (Buffer=0x7e232c98,
>     PoolType=0x7f6bc1c4) at MdeModulePkg/Core/Dxe/Mem/Pool.c:624
> #3  0x000000007f6d060e in CoreInternalFreePool (Buffer=0x7e232c98,
>     PoolType=0x7f6bc1c4) at MdeModulePkg/Core/Dxe/Mem/Pool.c:529
> #4  0x000000007f6d0648 in CoreFreePool (Buffer=0x7e232c98) at
>     MdeModulePkg/Core/Dxe/Mem/Pool.c:552
> #5  0x000000007d49fbf8 in FreePool (Buffer=0x7e232c98) at
>     MdePkg/Library/UefiMemoryAllocationLib/MemoryAllocationLib.c:818
> #6  0x000000007d4875c3 in RunSplitCommand (CmdLine=0x7d898398,
>     StdIn=0x0, StdOut=0x0) at ShellPkg/Application/Shell/Shell.c:1813
> #7  0x000000007d487d59 in ProcessNewSplitCommandLine
>     (CmdLine=0x7d898398) at ShellPkg/Application/Shell/Shell.c:2121
> #8  0x000000007d488937 in RunShellCommand (CmdLine=0x7e233018,
>     CommandStatus=0x0) at ShellPkg/Application/Shell/Shell.c:2670
> #9  0x000000007d488b0b in RunCommand (CmdLine=0x7e233018) at
>     ShellPkg/Application/Shell/Shell.c:2732
> #10 0x000000007d4867c8 in DoShellPrompt () at
>     ShellPkg/Application/Shell/Shell.c:1349
> #11 0x000000007d48524d in UefiMain (ImageHandle=0x7e24c898,
>     SystemTable=0x7f5b6018) at ShellPkg/Application/Shell/Shell.c:631

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Marvin Häuser <Marvin.Haeuser@outlook.com>
Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Fixes: bd3fc8133b
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Marvin Häuser <Marvin.Haeuser@outlook.com>
(cherry picked from commit 227fe49d5d)
2017-05-04 15:55:55 +08:00
c2fb3cd166 ShellPkg/Shell: clean up bogus member types in SPLIT_LIST
The "SPLIT_LIST.SplitStdOut" and "SPLIT_LIST.SplitStdIn" members currently
have type (SHELL_FILE_HANDLE *). This is wrong; SHELL_FILE_HANDLE is
already a pointer, there's no need to store a pointer to a pointer.

The error is obvious if we check where and how these members are used:

- In the RunSplitCommand() function, these members are used (populated)
  extensively; this function has to be updated in sync.

  ConvertEfiFileProtocolToShellHandle() already returns the temporary
  memory file created with CreateFileInterfaceMem() as SHELL_FILE_HANDLE,
  not as (SHELL_FILE_HANDLE *).

- In particular, the ConvertShellHandleToEfiFileProtocol() calls need to
  be dropped as well in RunSplitCommand(), since
  EFI_SHELL_PROTOCOL.SetFilePosition() and EFI_SHELL_PROTOCOL.CloseFile()
  take SHELL_FILE_HANDLE parameters, not (EFI_FILE_PROTOCOL *).

  Given that ConvertShellHandleToEfiFileProtocol() only performs a
  type-cast (it does not adjust any pointer values), *and*
  SHELL_FILE_HANDLE -- taken by EFI_SHELL_PROTOCOL member functions -- is
  actually a typedef to (VOID *) -- see more on this later --, this
  conversion error hasn't been caught by compilers.

- In the ProcessNewSplitCommandLine() function, RunSplitCommand() is
  called either initially (passing in NULL / NULL; no update needed), or
  recursively (passing in Split->SplitStdIn / Split->SplitStdOut; again no
  update is necessary beyond the RunSplitCommand() modification above).

- In the UpdateStdInStdOutStdErr() and RestoreStdInStdOutStdErr()
  functions, said structure members are compared and assigned to
  "EFI_SHELL_PARAMETERS_PROTOCOL.StdIn" and
  "EFI_SHELL_PARAMETERS_PROTOCOL.StdOut", both of which have type
  SHELL_FILE_HANDLE, *not* (SHELL_FILE_HANDLE *).

  The compiler hasn't caught this error because of the fatally flawed type
  definition of SHELL_FILE_HANDLE, namely

    typedef VOID *SHELL_FILE_HANDLE;

  Pointer-to-void silently converts to and from most other pointer types;
  among them, pointer-to-pointer-to-void. That is also why no update is
  necessary for UpdateStdInStdOutStdErr() and RestoreStdInStdOutStdErr()
  in this fix.

(

Generally speaking, using (VOID *) typedefs for opaque handles is a tragic
mistake in all of the UEFI-related specifications; this practice defeats
any type checking that compilers might help programmers with. The right
way to define an opaque handle is as follows:

  //
  // Introduce the incomplete structure type, and the derived pointer
  // type, in both the specification and the public edk2 headers. Note
  // that the derived pointer type itself is a complete type, and it can
  // be used freely by client code.
  //
  typedef struct SHELL_FILE *SHELL_FILE_HANDLE;

  //
  // Complete the structure type in the edk2 internal C source files.
  //
  struct SHELL_FILE {
    //
    // list fields
    //
  };

This way the structure size and members remain hidden from client code,
but the C compiler can nonetheless catch any invalid conversions between
incompatible XXX_HANDLE types.

)

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Marvin Häuser <Marvin.Haeuser@outlook.com>
Cc: Qiu Shumin <shumin.qiu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit 1bd0bf153e)
2017-05-04 15:55:55 +08:00
f567743825 ShellPkg SmbiosView: Display Type 0 BIOS segment in hexadecimal
The SMBIOS Type 0 BIOS segment field is currently displayed in decimal.
Since this field is likely to have a value like 0xE800 or 0xF000, using
hexadecimal seems like a better choice.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit fed709deb4)
2017-05-04 15:55:55 +08:00
09a0dbeb3f SecurityPkg: Consume SmmIoLib.
Update code to consume SmmIoLib to pass build.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 350e9150cc)
2017-05-04 10:08:22 +08:00
7154167901 SecurityPkg OpalPasswordSmm: Consume SmmIoLib.
Update code to consume SmmIoLib to check Mmio validation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 50e6bb98ee)
2017-05-04 10:08:22 +08:00
2078ead60d NetworkPkg: Fix PXEv6 boot failure when DhcpBinl offer received.
In case of the DHCP and PXE services on different servers,PXEv6 boot will
failure when DhcpBinl offer received. The issue is caused by the following
reasons:
* PXE Client doesn't append VENDOR_CLASS request parameter, so the
offer replied from DHCP service will not contain VENDOR_CLASS option
(16).
* Once the DhcpBinl offer is selected, the boot discover message should
be sent out to request the bootfile by this offer. Current implementation
always use servers multi-cast address instead of BootFileUrl address in
dhcp6 offer. we should check it first, then decide whether use multi-cast
address or not.
* If DhcpBinl offer is selected, the boot discover message shouldn't
find server ID Option from DhcpBinl offer. That's incorrect because DHCP
service and PXE service on different servers. In such a case, we can ignore
the Server ID Option.

With the above fix in the patch, PXEv6 can boot successfully when DhcpBinl
offer received.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
(cherry picked from commit be37315a08)
2017-05-03 11:31:08 +08:00
efbf0349e7 NetworkPkg: Fix bug in iSCSI mode ipv6 when enabling target DHCP.
if the server name expressed as a site local address begain with FEC0
when retrieving from dhcpv6 option 59 boot file url, it incorrectly process it
as a dns name.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
(cherry picked from commit 91cdd20f70)
2017-05-02 11:14:37 +08:00
eb7506f76d NetworkPkg: Fix issue the iSCSI client can not send reset packet.
if we already established a iSCSI connection from initiator to target
based on IPv4 stack, after using reconnect -r command, we can not rebuild
the session with the windows target, since the server thought the session
is still exist.  This issue is caused by wrong place of acquire ownership of
sock lock which lead the iSCSI can not reset the connection correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
(cherry picked from commit 597cf8a19f)
2017-05-02 11:14:30 +08:00
5b3b1e00dc MdeModulePkg: Fix issue the iSCSI client can not send reset packet correctly.
if we already established a iSCSI connection from initiator to target
based on IPv4 stack, after using reconnect -r command, we can not rebuild
the session with the windows target, since the server thought the session
is still exist.  This issue is caused by wrong place of acquire ownership of
sock lock which lead the iSCSI can not reset the connection correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
(cherry picked from commit e3793f9834)
2017-05-02 11:14:24 +08:00
905190af42 CryptoPkg/SmmCryptLib: Enable HMAC-SHA256 support for SMM.
Enable HMAC-SHA256 cipher support in SmmCryptLib instance.

Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
(cherry picked from commit 25942a4026)
2017-05-02 09:07:08 +08:00
0c0490ecaa MdePkg/dsc: add SmmIoLib
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2017-04-28 16:44:27 +08:00
ed906ffb84 MdePkg/dec: Add SmmIoLib.
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2017-04-28 16:44:26 +08:00
20237f4854 MdePkg/SmmIoLib: Add sample instance.
The sample instance check if IO resource is valid
one defined in GCD.
A platform may choose add more check to exclude some
other IO resource.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2017-04-28 16:44:24 +08:00
d64de223f7 MdePkg/SmmIoLib: Add header file.
This SmmIoLib is used to check if an IO resource
is valid in SMM.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2017-04-28 16:44:22 +08:00
7a4b6b1688 MdeModulePkg/Ip4Dxe: Fix the incorrect RemoveEntryList
Cc: Subramanian Sriram <sriram-s@hpe.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
(cherry picked from commit ad18ec9543)
2017-04-28 08:24:13 +08:00
11a4e7057b BaseTools: Rsa2048Sha256GenerateKeys to support OPENSSL_PATH has space
Update Rsa2048Sha256GenerateKeys Tool to support the case that
OPENSSL_PATH has space characters.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-04-27 21:27:46 +08:00
ffd2cde5d2 BaseTools: Rsa2048Sha256Sign Tool to support OPENSSL_PATH has space
Update Rsa2048Sha256Sign Tool to support the case that OPENSSL_PATH has
space characters.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-04-27 21:26:44 +08:00
1377330367 BaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space
Update Pkcs7Sign Tool to support the case that OPENSSL_PATH has space
characters.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-04-27 21:26:02 +08:00
3b43e9c06a BaseTools/VolInfo: Update OPENSSL_PATH to support space characters
Update OPENSSL_PATH handling to support space characters in the Path.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-04-27 21:25:06 +08:00
78fbc8ec8e BaseTools: fix the typo in function name LanuchPostbuild
The patch fix function name typo LanuchPostbuild ==> LaunchPostbuild.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nikolai SAOUKH <nms@otdel-1.org>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-04-27 21:24:31 +08:00
88a0b204ec BaseTools: Fix a bug for BOOLEAN type value in Asbuilt inf
When the PCD value is set to TRUE or FALSE, while it is not exchanged to
its int value, it cause error in the function int(Pcd.DefaultValue, 0).

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-04-27 21:23:41 +08:00
407a5c55ba PeCoffGetEntryPointLib: Fix spelling issue
*Serach* should be *Search*

Cc: Liming Gao <liming.gao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 9e981317be)
2017-04-26 11:30:27 +08:00
44c7d1d40c UefiCpuPkg/MpLib.c: Set AP state after X2APIC mode enabled
After X2APIC mode is enabled, APs need to be set tp IDLE state, otherwise APs
cannot be waken up by MP PPI services.

https://bugzilla.tianocore.org/show_bug.cgi?id=505

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
(cherry picked from commit 59a119f0fc)
2017-04-26 11:30:26 +08:00
5fc4b658e6 UefiCpuPkg: Move ProgramVirtualWireMode() to MpInitLib
In PEI phase, BSP did not program vitural wired mode while APs did.

Move program virtual wired mode from CpuDxe to MpInitLib, thus it could benefit
on both CpuDxe and CpuMpPei.

https://bugzilla.tianocore.org/show_bug.cgi?id=496

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
(cherry picked from commit 9d64a9fd9e)
2017-04-26 11:30:25 +08:00
094d3a4142 UefiCpuPkg/MpInitLib: needn't to allocate AP reset vector
Because we will always borrow the AP reset vector space for AP waking up. We
needn't allocate such range to prevent other module to use it. It could simply
the code.

https://bugzilla.tianocore.org/show_bug.cgi?id=500

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
(cherry picked from commit c934a0a581)
2017-04-26 11:30:24 +08:00
28614a7b7c UefiCpuPkg/MpInitLib: save/restore original contents
If APs is in HLT-LOOP mode, we need AP reset vector for waking up APs. This
updating is to save/restore original contents of AP reset vector around waking
up APs always.

https://bugzilla.tianocore.org/show_bug.cgi?id=500

Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
(cherry picked from commit 9293d6e42e)
2017-04-26 11:30:23 +08:00
9b68006c93 MdeModulePKg/BDS: Build meaningful description for Wi-Fi boot option
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Fan Wang <fan.wang@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
(cherry picked from commit 6bbd4a8f5f)
2017-04-26 09:38:15 +08:00
0abf7713aa MdeModulePkg/Ip4Dxe: Refine the IPv4 configuration help info
Below value indicate whether network address configured successfully
or not:
Network Device List->MAC->IPv4 Network Configuration->Configured.

This patch is to refine its help info.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
(cherry picked from commit d7dd4f0a06)
2017-04-25 18:20:32 +08:00
fa939c26b6 MdeModulePkg: Update PiSmmCore to set correct ImageAddress into LoadedImage
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit d5a67b3da1)
2017-04-25 09:51:18 +08:00
71a9aa1c50 MdeModulePkg PiSmmIpl: Fix the issue in LMFA feature
SmramBase should be got from mLMFAConfigurationTable.

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit c2aeb66fff)
2017-04-25 09:51:18 +08:00
4d3f4a20f1 MdeModulePkg/UfsPciHc: Avoid overriding return value in BindingStart
In function UfsHcDriverBindingStart(), the return value 'Status' may be
overridden during the original PCI attributes restore process.

This commit refines the logic to avoid such override.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit 1a5ae66175)
2017-04-25 09:10:14 +08:00
9fe5799446 MdeModulePkg/UfsPciHc: Remove unused field in UfsHc private struct
The commit removes the unused field 'EFI_HANDLE  Handle' in Ufs host
controller private data structure 'UFS_HOST_CONTROLLER_PRIVATE_DATA'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit c36ea72ebd)
2017-04-25 09:10:14 +08:00
5794c3a92c MdeModulePkg/NvmExpressDxe: Handling return of write to sq and cq db
In case of an async command if updating the submission queue tail
doorbell fails then the command will not be picked up by device and
no completion response will be created. This scenario has to be handled.
Also if we create an AsyncRequest element and insert in the async queue,
it will never receive a completion so in the timer routine this element
won't be freed, resulting in memory leak. Also in case of blocking calls
we should capture the status of updating completion queue head doorbell
register and return it to caller of PassThru.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Suman Prakash <suman.p@samsung.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
(cherry picked from commit f6b139bde7)
2017-04-25 09:10:13 +08:00
844a25f983 MdeModulePkg: Discard received broadcast message in DxeIpIoLib.
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 dd29d8b356)
2017-04-24 10:13:29 +08:00
b4244d101d MdeModulePkg/PiSmmCore: Remove redundant PoolTail pointer assignment
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit f8f931f632)
2017-04-24 09:02:46 +08:00
f35772deee MdeModulePkg/DeviceManagerUiLib: Fix the network device MAC display issue
v3:
* Add NULL string check.

v2:
* Define new STR_FORM_NETWORK_DEVICE_TITLE_HEAD for L" Network Device "
instead of hard code in the code.

Network device tile (STR_FORM_NETWORK_DEVICE_TITLE) is dynamic adjusted
according the different MAC value. So, the string value shouldn't be treated
as a constant string (Network Device). Otherwise, the display will be
incorrect.

Reproduce: Device Manager->Network Device List, select to enter MAC, then to
press ESC back to previous page, then re-enter, found each enter/ESC operation,
the MAC address display +1.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit 205a4b0c15)
2017-04-21 14:05:18 +08:00
7430771ec3 MdeModulePkg/Mtftp4Dxe: Add invalid ServerIp check during MTFTP configuration
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
(cherry picked from commit 17b25f5203)
2017-04-21 14:05:11 +08:00
ca740d75d6 NetworkPkg/TlsAuthConfigDxe: Close and free the file related resource
v2:
* Define one new internal function to clean the file content.

TlsAuthConfigDxe open file by FileExplorerLib. It need to close
file handler and free file related resource in some cases.
* User enrolls Cert by escape the Config page.
* The Cert is not X509 type.
* User chooses another file after he selected a file.

Cc: Zhang Chao B <chao.b.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Chao Zhang<chao.b.zhang@intel.com>
(cherry picked from commit 8ca4176883)
2017-04-21 14:05:04 +08:00
d1ffb4e436 NetworkPkg: Correct the proxy DHCP offer handing
When PXE10/WFM11a offer received, we should only cache
the first PXE10/WFM11a offer, and discard the others. But
Current we discard all PXE10/WFM11a offer. This patch is
to fix this issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
(cherry picked from commit 8cdd559be6)
2017-04-21 14:04:57 +08:00
e51b591e2d NetworkPkg/HttpDxe: Fix HTTP download OS image over 4G size failure
UINT32 integer overflow will happen once the download OS image over
4G size. This patch is to fix this issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Sriram Subramanian <sriram-s@hpe.com>
(cherry picked from commit 6893b16fb9)
2017-04-21 14:04:50 +08:00
6d644dd0d0 MdeModulePkg/FirmwarePerformanceDxe: Error Level is not used correctly
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit d3d562b904)
2017-04-21 10:48:30 +08:00
250c5b2aaa MdeModulePkg/UefiBootManagerLib: Avoid buggy USB short-form expanding
When a load option points to a physical UsbIo controller, whose
device path contains UsbClass or UsbWwid node, old logic
unconditionally treats it as a short-form device path and expands
it. But the expanding gets the exactly same device path, and the
device path is passed to BmGetNextLoadOptionDevicePath() which
then passes this device path to BmExpandUsbDevicePath() again.
This causes a infinite recursion.

The patch avoids the USB short-form expanding when the device path
points to a physical UsbIo controller.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
(cherry picked from commit 21e359dcca)
2017-04-20 16:33:52 +08:00
c0b1ed569f NetworkPkg: Fix bug related DAD issue in IP6 driver.
If we set PXEv6 as the first boot option and reboot immediately
after the first successful boot, it will assert. the root cause is
when we set the policy from manual to automatic in PXE driver,
the ip6 Configure item size is already set to zero and other
structures are also released, So it is not needed to perform DAD call
back function which is invoked by Ip6ConfigSetMaunualAddress.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
(cherry picked from commit 52cad7d0d8)
2017-04-20 15:55:04 +08:00
d7c94fca2f NetworkPkg: Add check logic for iSCSI driver.
Need to check variable of mPrivate whether is
null before used and redefine the array length
of target address for keyword.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
(cherry picked from commit b28bf4143d)
2017-04-20 15:54:57 +08:00
b4221a2e9e MdeModulePkg PiSmmCore: Enhance SMM FreePool to catch buffer overflow
This solution is equivalent to DXE core.

AllocatePool() allocates POOL_TAIL after the buffer.
This POOL_TAIL is checked at FreePool().
If the there is buffer overflow, the issue can be caught at FreePool().

This patch could also handle the eight-byte aligned allocation
requirement. The discussion related to the eight-byte aligned
allocation requirement is at
https://lists.01.org/pipermail/edk2-devel/2017-April/009995.html.

According to the PI spec (Vol 4, Section 3.2 SmmAllocatePool()):
The SmmAllocatePool() function ... All allocations are eight-byte aligned.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
(cherry picked from commit 861c8dff2f)
2017-04-20 14:13:53 +08:00
ce0f811c28 MdeModulePkg/Ufs: Wait fDeviceInit be cleared by devices during init
In the origin codes, the host sets the fDeviceInit flag to initiate device
initialization, but does not check whether the device resets this flag
to indicate the device initialization is completed.

Details can be referred at UFS 2.0 Spec Section 14.2 - Flags.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
(cherry picked from commit 95ad8f7f6a)
2017-04-20 13:11:49 +08:00
c29973b789 MdeModulePkg/UfsPassThruDxe: Replace 'EFI_D_XXX' with 'DEBUG_XXX'
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>
(cherry picked from commit edd94e74c8)
2017-04-20 13:11:48 +08:00
0a69072ca0 ShellPkg/pci: Fix VS2012 build failure
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
(cherry picked from commit f1894fa294)
2017-04-20 11:19:19 +08:00
66cbba1044 ShellPkg/comp: Fix file tag name.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
(cherry picked from commit a32c1a5b1c)
2017-04-20 11:19:19 +08:00
5359955ddb MdeModulePkg/TerminalDxe: Avoid always append device path to *Dev
When TerminalDxe Start() is called multiple times, the old logic
unconditionally appended the terminal device path candidates to
*Dev (ConInDev/ConOutDev/ErrOutDev), resulting the volatile storage
is full.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit b9c04b88a1)
2017-04-20 10:25:21 +08:00
f76eb7c132 MdeModulePkg DxeCore: Fix issue to print GUID value %g without pointer
https://bugzilla.tianocore.org/show_bug.cgi?id=474

Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(cherry picked from commit e061798895)
2017-04-19 14:19:24 +08:00
d012503729 UefiCpuPkg/PiSmmCpuDxeSmm: Lock should be acquired
SMM BSP's *busy* state should be acquired. We could use AcquireSpinLock()
instead of AcquireSpinLockOrFail().

Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
(cherry picked from commit 170a3c1e0f)
2017-04-19 11:20:12 +08:00
ffb4af3b5a ShellPkg/Pci: Always dump the extended config space for PCIE
It is to align to the original behavior before "-ec" option was
added.

The patch also refines the code to make it more readable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Cc: Jim Dailey <Jim.Dailey@dell.com>
(cherry picked from commit 33cc487c26)
2017-04-19 10:55:36 +08:00
4a75bfb5a0 MdeModulePkg/HiiDB: Avoid incorrect results of multiplication
An example:
The codes in function Output8bitPixel in Image.c:
OffsetY = BITMAP_LEN_8_BIT ((UINT32) Image->Width, Ypos);

Both Image->Width and Ypos are of type UINT16. They will be promoted to
int (signed) first, and then perform the multiplication defined by macro
BITMAP_LEN_8_BIT. If the result of multiplication between Image->Width and
Ypos exceeds the range of type int, a potential incorrect results
will be assigned to OffsetY.

This commit adds explicit UINT32 type cast for 'Image->Width' to avoid
possible overflow in the int range. And also fix similar issues in
HiiDatabase.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
(cherry picked from commit f76bc44362)
2017-04-18 15:58:18 +08:00
757decbd53 MdeModulePkg/BMMUiLib: Update codes of initializing ConsoleXXXCheck array
When initializing ConsoleOutCheck/ConsoleInCheck/ConsoleErrCheck array in
BMM_FAKE_NV_DATA structure, also need to consider whether the terminal
device is ConOut/ConIn/ConErr or not.

Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
(cherry picked from commit d508fe87fe)
2017-04-18 15:58:18 +08:00
870f872bad UefiCpuPkg/MtrrLib: Avoid running unnecessary code
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
(cherry picked from commit c9b4492133)
2017-04-18 10:49:43 +08:00
d999d6c8e4 BaseTools: Update the Conf directory to use the absolute path
Update the Conf directory to use the absolute path for build_rule.txt
and tools_def.txt.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-04-18 10:44:15 +08:00
cbdde352d1 ShellPkg/ConsistMapping: Remove unneeded memory reallocation
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit 17c3dc1939)
2017-04-18 10:26:25 +08:00
6efcd38566 MdeModulePkg/BootManagerMenu: Add assertion to indicate no DIV by 0
BootMenuSelectItem() contains code to DIV BootMenuData->ItemCount.
When BootMenuData->ItemCount can be 0, the DIV operation may
trigger CPU exception.
But in logic, this case won't happen. So add assertion to indicate
it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
(cherry picked from commit 51a1db9b24)
2017-04-17 16:04:47 +08:00
03b4f340d7 CryptoPkg: Correct some minor issues in function comments
Correct some minor comment issues in BaseCryptLib.h and
CryptPkcs7Verify.c, including:
  - missed "out" in parameter property for ARC4 interfaces;
  - Wrong Comment tail in Pkcs7GetAttachedContent function

Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
(cherry picked from commit 0c9fc4b167)
2017-04-14 16:45:51 +08:00
6e5dc5541b MdeModulePkg CapsuleApp: Add directory support
Current CapsuleApp only supports input/output file from rootdirectory.
If the CapsuleApp and related file are put into subdirectory,
below message will be shown when running the CapsuleApp in shell.

"CapsuleApp: capsule image (Capsule image file name) is not found."

This patch is to add directory support for CapsuleApp
by using shell protocol.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 8b17683a27)
2017-04-14 13:49:44 +08:00
53ae831443 IntelFrameworkPkg/UefiLib: Avoid mis-calculate of graphic console size
The commit adds check in function InternalPrintGraphic() to ensure that
the expression:

Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)

will not overflow in the UINTN range.

The commit also adds an explicit UINT32 type cast for 'Blt->Width' to
avoid possible overflow in the int range for:

Blt->Width * Blt->Height

Since both Blt->Width and Blt->Height are of type UINT16. They will be
promoted to int (signed) first, and then perform the multiplication
operation. If the result of multiplication between Blt->Width and
Blt->Height exceeds the range of type int, a potential incorrect size will
be passed into function AllocateZeroPool().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 9c0e4db3db)
2017-04-14 13:25:01 +08:00
591c1bed31 MdePkg/UefiLib: Avoid mis-calculate of graphic console size
The commit adds check in function InternalPrintGraphic() to ensure that
the expression:

Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)

will not overflow in the UINTN range.

The commit also adds an explicit UINT32 type cast for 'Blt->Width' to
avoid possible overflow in the int range for:

Blt->Width * Blt->Height

Since both Blt->Width and Blt->Height are of type UINT16. They will be
promoted to int (signed) first, and then perform the multiplication
operation. If the result of multiplication between Blt->Width and
Blt->Height exceeds the range of type int, a potential incorrect size will
be passed into function AllocateZeroPool().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 458cd568b6)
2017-04-14 13:25:00 +08:00
abf1027b09 MdeModulePkg/DxeCore: Add ASSERT to ensure no subtract underflow
For function SplitRecord() in file PropertiesTable.c, there is a
potential subtract underflow case for line:

  return TotalNewRecordCount - 1;

However, such case will not happen since the logic in function
SplitTable() ensure that when calling SplitRecord(), the variable
'TotalNewRecordCount' will not be zero when performing the subtraction.
It will be handled in the previous if statement:

  if (MaxSplitRecordCount == 0) {
    CopyMem (NewRecord, OldRecord, DescriptorSize);
    return 0;
  }

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 1860cb00c1)
2017-04-14 13:25:00 +08:00
729b6b5164 MdeModulePkg/PiSmmCore: Fix potentially uninitialized local variable
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit 89558f1653)
2017-04-14 13:25:00 +08:00
adeef88496 BaseTools/Bin: Update the BaseTools Win32 binaries version information
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
2017-04-14 10:55:39 +08:00
321ec73af7 MdeModulePkg BrotliLib: Fix the regression logic issue in loop
In V2, change logic to avoid use mtf[-1] style to get value.

Roll back to previous logic, and use point + offset to get byte value.

Cc: Bell Song <binx.song@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bell Song <binx.song@intel.com>
(cherry picked from commit 2c8d2545f5)
2017-04-14 10:53:21 +08:00
fc3ce2f30c BaseTools: Add option in CLANG38 to disable warning unknown-warning-option
https://bugzilla.tianocore.org/show_bug.cgi?id=466

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
(cherry picked from commit ab200776cd)
2017-04-13 13:26:35 +08:00
7dbcca8820 MdeModulePkg: Fix BrotliCustomDecompressLib potential issue
- Fix BrotliCustomDecompressLib potential issue

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 36a0d5cab8)
2017-04-13 13:25:43 +08:00
6aecbe2de8 BaseTools/ECC: Add a new checkpoint
Add a new checkpoint to check if the SMM communication parameter has
a correct buffer type.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-04-13 10:33:06 +08:00
e83897e90c BaseTools: Fix re-build issue after tools_def/build_rule updated.
Add tools_def.txt and build_rule.txt to workspace autogen timestamp file.
Now it will not skip autogen if this two file is updated.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-04-13 10:31:24 +08:00
4df1410641 BaseTools: Fix build fail after clean or cleanall target.
Remove module AutoGenTimeStamp file during clean or cleanall.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin <derek.lin2@hpe.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-04-13 10:30:44 +08:00
fca6831ae4 IntelFrameworkModulePkg/IdeBusDxe: Fix undefined behavior in signed left shift
In function AtapiReadCapacity(), the following expression:
IdeDev->BlkIo.Media->LastBlock = (Data.LastLba3 << 24) |
  (Data.LastLba2 << 16) |
  (Data.LastLba1 << 8) |
  Data.LastLba0;

(There is also a similar case in this function.)

will involve undefined behavior in signed left shift operations.

Since Data.LastLbaX is of type UINT8, and
IdeDev->BlkIo.Media->LastBlock is of type UINT64. Therefore,
Data.LastLbaX will be promoted to int (32 bits, signed) first,
and then perform the left shift operation.

According to the C11 spec, Section 6.5.7:
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
  bits are filled with zeros. If E1 has an unsigned type, the value
  of the result is E1 * 2^E2 , reduced modulo one more than the
  maximum value representable in the result type. If E1 has a signed
  type and nonnegative value, and E1 * 2^E2 is representable in the
  result type, then that is the resulting value; otherwise, the
  behavior is undefined.

So if bit 7 of Data.LastLba3 is 1, (Data.LastLba3 << 24) will be out of
the range within int type. The undefined behavior of the signed left shift
will lead to a potential of setting the high 32 bits of
IdeDev->BlkIo.Media->LastBlock to 1 during the cast from type int to type
UINT64.

This commit will add an explicit UINT32 type cast for Data.LastLba3 to
resolve this 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>
(cherry picked from commit f90c4fff00)
2017-04-13 09:10:50 +08:00
549a342e1e MdeModulePkg/UsbBotPei: Fix undefined behavior in signed left shift
In function PeiUsbReadCapacity(), the following expression:
LastBlock = (Data.LastLba3 << 24) |
  (Data.LastLba2 << 16) |
  (Data.LastLba1 << 8) |
  Data.LastLba0;

(There is also a similar case in function PeiUsbReadFormattedCapacity().)

will involve undefined behavior in signed left shift operations.

Since Data.LastLbaX is of type UINT8, they will be promoted to int (32
bits, signed) first, and then perform the left shift operation.

According to the C11 spec, Section 6.5.7:
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
  bits are filled with zeros. If E1 has an unsigned type, the value
  of the result is E1 * 2^E2 , reduced modulo one more than the
  maximum value representable in the result type. If E1 has a signed
  type and nonnegative value, and E1 * 2^E2 is representable in the
  result type, then that is the resulting value; otherwise, the
  behavior is undefined.

So if bit 7 of Data.LastLba3 is 1, (Data.LastLba3 << 24) will be out of
the range within int type. The undefined behavior of the signed left shift
might incur potential issues.

This commit will add an explicit UINT32 type cast for Data.LastLba3 to
refine the codes.

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>
(cherry picked from commit a2617ed627)
2017-04-13 09:10:49 +08:00
602b573d61 MdeModulePkg/UfsBlkIoPei: Fix undefined behavior in signed left shift
In function UfsBlockIoPeimGetMediaInfo(), the following expression:
Private->Media[DeviceIndex].LastBlock  = (Capacity16.LastLba3 << 24) |
  (Capacity16.LastLba2 << 16) |
  (Capacity16.LastLba1 << 8) |
  Capacity16.LastLba0;

(There is also a similar case in this function.)

will involve undefined behavior in signed left shift operations.

Since Capacity16.LastLbaX is of type UINT8, and
Private->Media[DeviceIndex].LastBlock is of type UINT64. Therefore,
Capacity16.LastLbaX will be promoted to int (32 bits, signed) first, and
then perform the left shift operation.

According to the C11 spec, Section 6.5.7:
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
  bits are filled with zeros. If E1 has an unsigned type, the value
  of the result is E1 * 2^E2 , reduced modulo one more than the
  maximum value representable in the result type. If E1 has a signed
  type and nonnegative value, and E1 * 2^E2 is representable in the
  result type, then that is the resulting value; otherwise, the
  behavior is undefined.

So if bit 7 of Capacity16.LastLba3 is 1, (Capacity16.LastLba3 << 24) will
be out of the range within int type. The undefined behavior of the signed
left shift will lead to a potential of setting the high 32 bits of
Private->Media[DeviceIndex].LastBlock to 1 during the cast from type int
to type UINT64.

This commit will add an explicit UINT32 type cast for Capacity16.LastLba3
to resolve this 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>
(cherry picked from commit da117dda23)
2017-04-13 09:10:48 +08:00
bfbcd7e4b2 MdeModulePkg/IdeBusPei: Fix undefined behavior in signed left shift
In function ReadCapacity(), the following expression:
MediaInfo->LastBlock = (Data.LastLba3 << 24) |
  (Data.LastLba2 << 16) |
  (Data.LastLba1 << 8) |
  Data.LastLba0;

(There is also a similar case in this function.)

will involve undefined behavior in signed left shift operations.

Since Data.LastLbaX is of type UINT8, and MediaInfo->LastBlock is of type
UINTN. Therefore, Data.LastLbaX will be promoted to int (32 bits, signed)
first, and then perform the left shift operation.

According to the C11 spec, Section 6.5.7:
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
  bits are filled with zeros. If E1 has an unsigned type, the value
  of the result is E1 * 2^E2 , reduced modulo one more than the
  maximum value representable in the result type. If E1 has a signed
  type and nonnegative value, and E1 * 2^E2 is representable in the
  result type, then that is the resulting value; otherwise, the
  behavior is undefined.

So if bit 7 of Data.LastLba3 is 1, (Data.LastLba3 << 24) will be out of
the range within int type. The undefined behavior of the signed left shift
will lead to a potential of setting the high 32 bits of
MediaInfo->LastBlock to 1 during the cast from type int to type UINT64
for X64 builds.

This commit will add an explicit UINT32 type cast for Data.LastLba3 to
resolve this 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>
(cherry picked from commit 3778a4dfcd)
2017-04-13 09:10:48 +08:00
1e2d930951 MdeModulePkg/ScsiDiskDxe: Fix undefined behavior in signed left shift
In function GetMediaInfo(), the following expression:
ScsiDiskDevice->BlkIo.Media->LastBlock =  (Capacity10->LastLba3 << 24) |
                                          (Capacity10->LastLba2 << 16) |
                                          (Capacity10->LastLba1 << 8)  |
                                           Capacity10->LastLba0;
will involve undefined behavior in signed left shift operations.

Since Capacity10->LastLbaX is of type UINT8, and
ScsiDiskDevice->BlkIo.Media->LastBlock is of type UINT64. Therefore,
Capacity10->LastLbaX will be promoted to int (32 bits, signed) first,
and then perform the left shift operation.

According to the C11 spec, Section 6.5.7:
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated
  bits are filled with zeros. If E1 has an unsigned type, the value
  of the result is E1 * 2^E2 , reduced modulo one more than the
  maximum value representable in the result type. If E1 has a signed
  type and nonnegative value, and E1 * 2^E2 is representable in the
  result type, then that is the resulting value; otherwise, the
  behavior is undefined.

So if bit 7 of Capacity10->LastLba3 is 1, (Capacity10->LastLba3 << 24)
will be out of the range within int type. The undefined behavior of the
signed left shift will lead to a potential of setting the high 32 bits
of ScsiDiskDevice->BlkIo.Media->LastBlock to 1 during the cast from type
int to type UINT64.

This commit will add an explicit UINT32 type cast for
Capacity10->LastLba3 to resolve this 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>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 7c115e775b)
2017-04-13 09:10:48 +08:00
df082f757a MdeModulePkg/Dxe/Image: Restore mCurrentImage on all paths
This commit makes sure that in function CoreStartImage(), module
variable 'mCurrentImage' is restored to the current start image context
on all code paths.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 7a14d54f6c)
2017-04-13 09:10:47 +08:00
0b75171b76 SecurityPkg/SecurityPkg.dec: Update PcdPkcs7CertBuffer PCD.
This patch updates the PcdPkcs7CertBuffer PCD to use the new
generated test certificate data for PKCS7 verification. This
was used as sample trusted certificate in the verification of
Signed Capsule Update.
(The updated value is still only for test purpose.)

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Long Qin <qin.long@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
(cherry picked from commit d3e0c996d5)
2017-04-12 13:42:00 +08:00
0ffecbead1 BaseTools/Pkcs7Sign: Update the test certificates & Readme.md
The old TestRoot certificate used for Pkcs7Sign is not compliant to
Root CA certificate requirement with incorrect basic constraints and
key usage setting.
When OpenSSL in CryptoPkg was updated from 1.0.2xx to the latest
1.1.0xx, the CA certificate checking was enforced for more extension
validations, which will raise the verification failure when stilling
using the old sample certificates.

This patch re-generated one set of test certificates used in
Pkcs7Sign demo, and updated the corresponding Readme.md to describe
how to set the options in openssl configuration file.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Long Qin <qin.long@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
(cherry picked from commit f536d7c3ed)
2017-04-12 13:41:27 +08:00
ca41ee781d BaseTools/ECC: Change check rule for Ifndef statement
Remove the check of Ifndef statement on .c files, only check on .h
files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
2017-04-12 09:39:59 +08:00
c69a51ce65 UefiCpuPkg: Error Level is not used correctly
Cc: Feng Tian <feng.tian@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2017-04-12 09:00:37 +08:00
ae480c61f4 SecurityPkg: Error Level is not used correctly
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2017-04-12 09:00:32 +08:00
cbfd09a014 MdeModulePkg: Error Level is not used correctly
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2017-04-12 09:00:29 +08:00
216 changed files with 4867 additions and 2711 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
Build/ Build/
tags/ tags/
.DS_Store

View File

@ -1 +1,2 @@
Win32 https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32 Win32 -r 253 https://svn.code.sf.net/p/edk2-toolbinaries/code/trunk/Win32
GIT: 0e088c19ab31fccd1d2f55d9e4fe0314b57c0097 https://github.com/tianocore/edk2-BaseTools-win32.git

View File

@ -11,32 +11,52 @@
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
# #
LVL="--quality 9" QLT="-q 9"
INPUTFLAG=0
while [ $# != 0 ];do for arg; do
case $1 in if [ $1 = -d ]
-d) then
ARGS+="--decompress " INPUTFLAG=1
;; fi
-e) if [ $1 = -e ]
;; then
-g) INPUTFLAG=1
ARGS+="--gap $2 "
shift shift
;; continue;
-l) fi
LVL="--quality $2 " if [ $1 = -g ]
then
ARGS+="$1 $2 "
shift shift
;;
-o)
ARGS+="--output $2 "
shift shift
;; continue;
*) fi
ARGS+="--input $1 " if [ $1 = -o ]
esac then
ARGS+="$1 $2 "
shift
shift
continue;
fi
if [ $1 = -q ]
then
QLT="$1 $2 "
shift
shift
continue;
fi
if [ $INPUTFLAG -eq 1 ]
then
if [ -z $2 ]
then
ARGS+="$QLT -i $1 "
break;
fi
fi
ARGS+="$1 "
shift shift
done done
exec Brotli $ARGS $LVL exec Brotli $ARGS

View File

@ -5512,7 +5512,7 @@ DEFINE CLANG38_X64_PREFIX = ENV(CLANG38_BIN)
DEFINE CLANG38_IA32_TARGET = -target i686-pc-linux-gnu DEFINE CLANG38_IA32_TARGET = -target i686-pc-linux-gnu
DEFINE CLANG38_X64_TARGET = -target x86_64-pc-linux-gnu DEFINE CLANG38_X64_TARGET = -target x86_64-pc-linux-gnu
DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -Wno-empty-body -fno-stack-protector -mms-bitfields -Wno-address -Wno-shift-negative-value -Wno-parentheses-equality -Wno-unknown-pragmas -Wno-tautological-constant-out-of-range-compare -Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -msoft-float -mno-implicit-float -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -funsigned-char -fno-ms-extensions -Wno-null-dereference -Wno-tautological-compare -Wno-unknown-warning-option
########################### ###########################
# CLANG38 IA32 definitions # CLANG38 IA32 definitions
@ -7435,18 +7435,10 @@ RELEASE_XCLANG_X64_CC_FLAGS = -ccc-host-triple x86_64-pc-win32-macho -c -Os
*_XCODE5_*_*_BUILDRULEFAMILY = XCODE *_XCODE5_*_*_BUILDRULEFAMILY = XCODE
*_XCODE5_*_*_BUILDRULEORDER = S s nasm *_XCODE5_*_*_BUILDRULEORDER = S s nasm
*_XCODE5_*_ASL_PATH = /usr/bin/iasl
*_XCODE5_*_MAKE_PATH = make
*_XCODE5_*_DSYMUTIL_PATH = /usr/bin/dsymutil
DEBUG_XCODE5_*_MTOC_FLAGS = -align 0x20 -d $(DEBUG_DIR)/$(MODULE_NAME).dll
NOOPT_XCODE5_*_MTOC_FLAGS = -align 0x20 -d $(DEBUG_DIR)/$(MODULE_NAME).dll
RELEASE_XCODE5_*_MTOC_FLAGS = -align 0x20
# #
# use xcode-select to change Xcode version of command line tools # use xcode-select to change Xcode version of command line tools
# #
*_XCODE5_*_MAKE_PATH = make
*_XCODE5_*_CC_PATH = clang *_XCODE5_*_CC_PATH = clang
*_XCODE5_*_SLINK_PATH = libtool *_XCODE5_*_SLINK_PATH = libtool
*_XCODE5_*_DLINK_PATH = ld *_XCODE5_*_DLINK_PATH = ld
@ -7457,6 +7449,25 @@ RELEASE_XCODE5_*_MTOC_FLAGS = -align 0x20
*_XCODE5_*_ASLCC_PATH = clang *_XCODE5_*_ASLCC_PATH = clang
*_XCODE5_*_ASLPP_PATH = clang *_XCODE5_*_ASLPP_PATH = clang
*_XCODE5_*_ASLDLINK_PATH = ld *_XCODE5_*_ASLDLINK_PATH = ld
*_XCODE5_*_DSYMUTIL_PATH = /usr/bin/dsymutil
*_XCODE5_*_MTOC_PATH = /usr/local/bin/mtoc
##################
# ASL definitions
##################
*_XCODE5_*_ASLCC_FLAGS = -x c -save-temps -g -O0 -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -c -include AutoGen.h
*_XCODE5_*_ASLDLINK_FLAGS = -e _ReferenceAcpiTable -preload -segalign 0x20 -pie -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
*_XCODE5_*_ASLPP_FLAGS = -x c -E -include AutoGen.h
*_XCODE5_*_ASL_FLAGS =
*_XCODE5_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
##################
# MTOC definitions
##################
DEBUG_XCODE5_*_MTOC_FLAGS = -align 0x20 -d $(DEBUG_DIR)/$(MODULE_NAME).dll
NOOPT_XCODE5_*_MTOC_FLAGS = -align 0x20 -d $(DEBUG_DIR)/$(MODULE_NAME).dll
RELEASE_XCODE5_*_MTOC_FLAGS = -align 0x20
#################### ####################
# IA-32 definitions # IA-32 definitions
@ -7476,8 +7487,6 @@ RELEASE_XCODE5_IA32_ASM_FLAGS = -arch i386
RELEASE_XCODE5_IA32_CC_FLAGS = -arch i386 -c -Os -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS) RELEASE_XCODE5_IA32_CC_FLAGS = -arch i386 -c -Os -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
NOOPT_XCODE5_IA32_CC_FLAGS = -arch i386 -c -g -O0 -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS) NOOPT_XCODE5_IA32_CC_FLAGS = -arch i386 -c -g -O0 -Wall -Werror -include AutoGen.h -funsigned-char -fno-stack-protector -fno-builtin -fshort-wchar -fasm-blocks -mdynamic-no-pic -mno-implicit-float -mms-bitfields -msoft-float -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
################## ##################
# X64 definitions # X64 definitions
################## ##################
@ -7493,16 +7502,9 @@ RELEASE_XCODE5_X64_ASM_FLAGS = -arch x86_64
*_XCODE5_*_PP_FLAGS = -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h *_XCODE5_*_PP_FLAGS = -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
*_XCODE5_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE -include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h *_XCODE5_*_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE -include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
DEBUG_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
DEBUG_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS) NOOPT_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -O0 -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
NOOPT_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -g -O0 -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS) RELEASE_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -D NO_MSABI_VA_FUNCS $(PLATFORM_FLAGS)
RELEASE_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -Os -Wall -Werror -Wextra -include AutoGen.h -funsigned-char -fno-ms-extensions -fno-stack-protector -fno-builtin -fshort-wchar -mno-implicit-float -mms-bitfields -Wno-unused-parameter -Wno-missing-braces -Wno-missing-field-initializers -Wno-tautological-compare -Wno-sign-compare -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang $(PLATFORM_FLAGS)
*_XCODE5_*_ASLCC_FLAGS = -x c -save-temps -g -O0 -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -c -include AutoGen.h
*_XCODE5_*_ASLDLINK_FLAGS = -e _ReferenceAcpiTable -preload -segalign 0x20 -pie -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
*_XCODE5_*_ASLPP_FLAGS = -x c -E -include AutoGen.h
*_XCODE5_*_ASL_FLAGS =
*_XCODE5_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
#################################################################################### ####################################################################################
# #

View File

@ -14,48 +14,54 @@
@echo off @echo off
@setlocal @setlocal
set LVL=--quality 9 set QLT=-q 9
set INPUTFLAG=0
:Begin :Begin
if "%1"=="" goto End if "%1"=="" goto End
if "%1"=="-d" ( if "%1"=="-d" (
set ARGS=%ARGS% --decompress set INPUTFLAG=1
shift
goto Begin
) )
if "%1"=="-e" ( if "%1"=="-e" (
set INPUTFLAG=1
shift shift
goto Begin goto Begin
) )
if "%1"=="-g" ( if "%1"=="-g" (
set ARGS=%ARGS% --gap %2 set ARGS=%ARGS% %1 %2
shift
shift
goto Begin
)
if "%1"=="-l" (
set LVL=--quality %2
shift shift
shift shift
goto Begin goto Begin
) )
if "%1"=="-o" ( if "%1"=="-o" (
set ARGS=%ARGS% --output %2 set ARGS=%ARGS% %1 %2
set INTMP=%2
shift shift
shift shift
goto Begin goto Begin
) )
set ARGS=%ARGS% --input %1 if "%1"=="-q" (
set QLT=%1 %2
shift
shift
goto Begin
)
if %INPUTFLAG%==1 (
if "%2"=="" (
set ARGS=%ARGS% %QLT% -i %1
goto End
)
)
set ARGS=%ARGS% %1
shift shift
goto Begin goto Begin
:End :End
Brotli %ARGS% %LVL% Brotli %ARGS%
@echo on @echo on

View File

@ -13,6 +13,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#include <Common/BuildVersion.h>
#include "../dec/decode.h" #include "../dec/decode.h"
#include "../enc/encode.h" #include "../enc/encode.h"
@ -67,6 +68,11 @@ static int ParseQuality(const char* s, int* quality) {
return 0; return 0;
} }
#define UTILITY_NAME "Brotli"
#define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 5
#define UTILITY_REVERSION 2
static void ParseArgv(int argc, char **argv, static void ParseArgv(int argc, char **argv,
char **input_path, char **input_path,
char **output_path, char **output_path,
@ -110,6 +116,15 @@ static void ParseArgv(int argc, char **argv,
} }
*verbose = 1; *verbose = 1;
continue; continue;
} else if (!strcmp("--version", argv[k])) {
fprintf(stderr,
"%s Version %d.%d.%d %s\n",
UTILITY_NAME,
UTILITY_MAJOR_VERSION,
UTILITY_MINOR_VERSION,
UTILITY_REVERSION,
__BUILD_VERSION);
exit(1);
} }
if (k < argc - 1) { if (k < argc - 1) {
if (!strcmp("--input", argv[k]) || if (!strcmp("--input", argv[k]) ||
@ -177,7 +192,8 @@ error:
fprintf(stderr, fprintf(stderr,
"Usage: %s [--force] [--quality n] [--gap n] [--decompress]" "Usage: %s [--force] [--quality n] [--gap n] [--decompress]"
" [--input filename] [--output filename] [--repeat iters]" " [--input filename] [--output filename] [--repeat iters]"
" [--verbose] [--window n] [--custom-dictionary filename]\n", " [--verbose] [--window n] [--custom-dictionary filename]"
" [--version]\n",
argv[0]); argv[0]);
exit(1); exit(1);
} }

View File

@ -331,7 +331,10 @@ Returns:
if (OpenSslEnv == NULL) { if (OpenSslEnv == NULL) {
OpenSslPath = OpenSslCommand; OpenSslPath = OpenSslCommand;
} else { } else {
OpenSslPath = malloc(strlen(OpenSslEnv)+strlen(OpenSslCommand)+1); //
// We add quotes to the Openssl Path in case it has space characters
//
OpenSslPath = malloc(2+strlen(OpenSslEnv)+strlen(OpenSslCommand)+1);
if (OpenSslPath == NULL) { if (OpenSslPath == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!"); Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
return GetUtilityStatus (); return GetUtilityStatus ();
@ -1591,11 +1594,12 @@ CombinePath (
{ {
UINT32 DefaultPathLen; UINT32 DefaultPathLen;
UINT64 Index; UINT64 Index;
CHAR8 QuotesStr[] = "\"";
strcpy(NewPath, QuotesStr);
DefaultPathLen = strlen(DefaultPath); DefaultPathLen = strlen(DefaultPath);
strcpy(NewPath, DefaultPath); strcat(NewPath, DefaultPath);
Index = 0; Index = 0;
for (; Index < DefaultPathLen; Index ++) { for (; Index < DefaultPathLen + 1; Index ++) {
if (NewPath[Index] == '\\' || NewPath[Index] == '/') { if (NewPath[Index] == '\\' || NewPath[Index] == '/') {
if (NewPath[Index + 1] != '\0') { if (NewPath[Index + 1] != '\0') {
NewPath[Index] = '/'; NewPath[Index] = '/';
@ -1607,6 +1611,7 @@ CombinePath (
NewPath[Index + 1] = '\0'; NewPath[Index + 1] = '\0';
} }
strcat(NewPath, AppendPath); strcat(NewPath, AppendPath);
strcat(NewPath, QuotesStr);
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -62,7 +62,10 @@ gMakeTypeMap = {"MSFT":"nmake", "GCC":"gmake"}
## Build rule configuration file ## Build rule configuration file
gDefaultBuildRuleFile = 'Conf/build_rule.txt' gDefaultBuildRuleFile = 'build_rule.txt'
## Tools definition configuration file
gDefaultToolsDefFile = 'tools_def.txt'
## Build rule default version ## Build rule default version
AutoGenReqBuildRuleVerNum = "0.1" AutoGenReqBuildRuleVerNum = "0.1"
@ -413,7 +416,7 @@ class WorkspaceAutoGen(AutoGen):
if HasTokenSpace: if HasTokenSpace:
if (PcdItem.TokenCName, PcdItem.TokenSpaceGuidCName) == (TokenCName, TokenSpaceGuidCName): if (PcdItem.TokenCName, PcdItem.TokenSpaceGuidCName) == (TokenCName, TokenSpaceGuidCName):
PcdDatumType = PcdItem.DatumType PcdDatumType = PcdItem.DatumType
NewValue = self._BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue) NewValue = BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue)
FoundFlag = True FoundFlag = True
else: else:
if PcdItem.TokenCName == TokenCName: if PcdItem.TokenCName == TokenCName:
@ -422,7 +425,7 @@ class WorkspaceAutoGen(AutoGen):
TokenSpaceGuidCNameList.append(PcdItem.TokenSpaceGuidCName) TokenSpaceGuidCNameList.append(PcdItem.TokenSpaceGuidCName)
PcdDatumType = PcdItem.DatumType PcdDatumType = PcdItem.DatumType
TokenSpaceGuidCName = PcdItem.TokenSpaceGuidCName TokenSpaceGuidCName = PcdItem.TokenSpaceGuidCName
NewValue = self._BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue) NewValue = BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, pcdvalue)
FoundFlag = True FoundFlag = True
else: else:
EdkLogger.error( EdkLogger.error(
@ -501,6 +504,22 @@ class WorkspaceAutoGen(AutoGen):
SourcePcdDict['FixedAtBuild'].append((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) SourcePcdDict['FixedAtBuild'].append((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName))
else: else:
pass pass
#
# A PCD can only use one type for all source modules
#
for i in SourcePcdDict_Keys:
for j in SourcePcdDict_Keys:
if i != j:
IntersectionList = list(set(SourcePcdDict[i]).intersection(set(SourcePcdDict[j])))
if len(IntersectionList) > 0:
EdkLogger.error(
'build',
FORMAT_INVALID,
"Building modules from source INFs, following PCD use %s and %s access method. It must be corrected to use only one access method." % (i, j),
ExtraData="%s" % '\n\t'.join([str(P[1]+'.'+P[0]) for P in IntersectionList])
)
else:
pass
# #
# intersection the BinaryPCD for Mixed PCD # intersection the BinaryPCD for Mixed PCD
@ -642,15 +661,35 @@ class WorkspaceAutoGen(AutoGen):
self._BuildCommand = None self._BuildCommand = None
# #
# Create BuildOptions Macro & PCD metafile. # Create BuildOptions Macro & PCD metafile, also add the Active Platform and FDF file.
# #
content = 'gCommandLineDefines: ' content = 'gCommandLineDefines: '
content += str(GlobalData.gCommandLineDefines) content += str(GlobalData.gCommandLineDefines)
content += os.linesep content += os.linesep
content += 'BuildOptionPcd: ' content += 'BuildOptionPcd: '
content += str(GlobalData.BuildOptionPcd) content += str(GlobalData.BuildOptionPcd)
content += os.linesep
content += 'Active Platform: '
content += str(self.Platform)
content += os.linesep
if self.FdfFile:
content += 'Flash Image Definition: '
content += str(self.FdfFile)
SaveFileOnChange(os.path.join(self.BuildDir, 'BuildOptions'), content, False) SaveFileOnChange(os.path.join(self.BuildDir, 'BuildOptions'), content, False)
#
# Create PcdToken Number file for Dynamic/DynamicEx Pcd.
#
PcdTokenNumber = 'PcdTokenNumber: '
if Pa.PcdTokenNumber:
if Pa.DynamicPcdList:
for Pcd in Pa.DynamicPcdList:
PcdTokenNumber += os.linesep
PcdTokenNumber += str((Pcd.TokenCName, Pcd.TokenSpaceGuidCName))
PcdTokenNumber += ' : '
PcdTokenNumber += str(Pa.PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName])
SaveFileOnChange(os.path.join(self.BuildDir, 'PcdTokenNumber'), PcdTokenNumber, False)
# #
# Get set of workspace metafiles # Get set of workspace metafiles
# #
@ -678,31 +717,6 @@ class WorkspaceAutoGen(AutoGen):
print >> file, f print >> file, f
return True return True
def _BuildOptionPcdValueFormat(self, TokenSpaceGuidCName, TokenCName, PcdDatumType, Value):
if PcdDatumType == 'VOID*':
if Value.startswith('L'):
if not Value[1]:
EdkLogger.error('build', OPTION_VALUE_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", B"{...}"')
Value = Value[0] + '"' + Value[1:] + '"'
elif Value.startswith('B'):
if not Value[1]:
EdkLogger.error('build', OPTION_VALUE_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", B"{...}"')
Value = Value[1:]
else:
if not Value[0]:
EdkLogger.error('build', OPTION_VALUE_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", B"{...}"')
Value = '"' + Value + '"'
IsValid, Cause = CheckPcdDatum(PcdDatumType, Value)
if not IsValid:
EdkLogger.error('build', FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))
if PcdDatumType == 'BOOLEAN':
Value = Value.upper()
if Value == 'TRUE' or Value == '1':
Value = '1'
elif Value == 'FALSE' or Value == '0':
Value = '0'
return Value
def _GetMetaFiles(self, Target, Toolchain, Arch): def _GetMetaFiles(self, Target, Toolchain, Arch):
AllWorkSpaceMetaFiles = set() AllWorkSpaceMetaFiles = set()
@ -721,10 +735,19 @@ class WorkspaceAutoGen(AutoGen):
AllWorkSpaceMetaFiles.add(self.MetaFile.Path) AllWorkSpaceMetaFiles.add(self.MetaFile.Path)
# #
# add build_rule.txt & tools_def.txt
#
AllWorkSpaceMetaFiles.add(os.path.join(GlobalData.gConfDirectory, gDefaultBuildRuleFile))
AllWorkSpaceMetaFiles.add(os.path.join(GlobalData.gConfDirectory, gDefaultToolsDefFile))
# add BuildOption metafile # add BuildOption metafile
# #
AllWorkSpaceMetaFiles.add(os.path.join(self.BuildDir, 'BuildOptions')) AllWorkSpaceMetaFiles.add(os.path.join(self.BuildDir, 'BuildOptions'))
# add PcdToken Number file for Dynamic/DynamicEx Pcd
#
AllWorkSpaceMetaFiles.add(os.path.join(self.BuildDir, 'PcdTokenNumber'))
for Arch in self.ArchList: for Arch in self.ArchList:
Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain] Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain]
PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch) PGen = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)
@ -2735,10 +2758,7 @@ class ModuleAutoGen(AutoGen):
if self._FixedAtBuildPcds: if self._FixedAtBuildPcds:
return self._FixedAtBuildPcds return self._FixedAtBuildPcds
for Pcd in self.ModulePcdList: for Pcd in self.ModulePcdList:
if self.IsLibrary: if Pcd.Type != "FixedAtBuild":
if not (Pcd.Pending == False and Pcd.Type == "FixedAtBuild"):
continue
elif Pcd.Type != "FixedAtBuild":
continue continue
if Pcd not in self._FixedAtBuildPcds: if Pcd not in self._FixedAtBuildPcds:
self._FixedAtBuildPcds.append(Pcd) self._FixedAtBuildPcds.append(Pcd)
@ -3917,6 +3937,13 @@ class ModuleAutoGen(AutoGen):
else: else:
continue continue
PcdValue = '' PcdValue = ''
if Pcd.DatumType == 'BOOLEAN':
BoolValue = Pcd.DefaultValue.upper()
if BoolValue == 'TRUE':
Pcd.DefaultValue = '1'
elif BoolValue == 'FALSE':
Pcd.DefaultValue = '0'
if Pcd.DatumType != 'VOID*': if Pcd.DatumType != 'VOID*':
HexFormat = '0x%02x' HexFormat = '0x%02x'
if Pcd.DatumType == 'UINT16': if Pcd.DatumType == 'UINT16':
@ -4183,6 +4210,8 @@ class ModuleAutoGen(AutoGen):
with open(self.GetTimeStampPath(),'r') as f: with open(self.GetTimeStampPath(),'r') as f:
for source in f: for source in f:
source = source.rstrip('\n') source = source.rstrip('\n')
if not os.path.exists(source):
return False
if source not in ModuleAutoGen.TimeDict : if source not in ModuleAutoGen.TimeDict :
ModuleAutoGen.TimeDict[source] = os.stat(source)[8] ModuleAutoGen.TimeDict[source] = os.stat(source)[8]
if ModuleAutoGen.TimeDict[source] > DstTimeStamp: if ModuleAutoGen.TimeDict[source] > DstTimeStamp:

View File

@ -1203,21 +1203,22 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
else: else:
AutoGenH.Append('extern volatile %s %s%s;\n' % (DatumType, PcdVariableName, Array)) AutoGenH.Append('extern volatile %s %s%s;\n' % (DatumType, PcdVariableName, Array))
AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeName, Type, TokenCName)) AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeName, Type, TokenCName))
PcdDataSize = GetPcdSize(Pcd)
if Pcd.DatumType == 'VOID*': if Pcd.DatumType == 'VOID*':
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeName, TokenCName, TokenCName, TokenCName)) AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeName, TokenCName, TokenCName, TokenCName))
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, TokenCName, TokenCName, TokenCName)) AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, TokenCName, TokenCName, TokenCName))
AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, Pcd.MaxDatumSize))
else: else:
AutoGenH.Append('#define %s(Value) (%s = (Value))\n' % (SetModeName, PcdVariableName)) AutoGenH.Append('#define %s(Value) (%s = (Value))\n' % (SetModeName, PcdVariableName))
AutoGenH.Append('#define %s(Value) ((%s = (Value)), RETURN_SUCCESS)\n' % (SetModeStatusName, PcdVariableName)) AutoGenH.Append('#define %s(Value) ((%s = (Value)), RETURN_SUCCESS)\n' % (SetModeStatusName, PcdVariableName))
PcdDataSize = GetPcdSize(Pcd)
AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, PcdDataSize)) AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, PcdDataSize))
AutoGenH.Append('#define %s %s\n' % (GetModeSizeName,PatchPcdSizeVariableName)) AutoGenH.Append('#define %s %s\n' % (GetModeSizeName,PatchPcdSizeVariableName))
AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName) AutoGenH.Append('extern UINTN %s; \n' % PatchPcdSizeVariableName)
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG: if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:
key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName)) key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))
PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_' + TokenCName
if DatumType == 'VOID*' and Array == '[]': if DatumType == 'VOID*' and Array == '[]':
DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L'] DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']
AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array)) AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))
@ -1225,6 +1226,9 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName) AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd or (Info.IsLibrary and not Info._ReferenceModules)): if PcdItemType == TAB_PCDS_FIXED_AT_BUILD and (key in Info.ConstPcd or (Info.IsLibrary and not Info._ReferenceModules)):
if Pcd.DatumType == 'VOID*':
AutoGenH.Append('#define _PCD_VALUE_%s %s%s\n' %(TokenCName, Type, PcdVariableName))
else:
AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue)) AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue))
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD: if PcdItemType == TAB_PCDS_FIXED_AT_BUILD:

View File

@ -1,7 +1,7 @@
## @file ## @file
# Create makefile for MS nmake and GNU make # Create makefile for MS nmake and GNU make
# #
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -386,7 +386,7 @@ ${END}
# #
clean: clean:
\t${BEGIN}${clean_command} \t${BEGIN}${clean_command}
\t${END} \t${END}\t$(RM) AutoGenTimeStamp
# #
# clean all generated files # clean all generated files
@ -395,6 +395,7 @@ cleanall:
${BEGIN}\t${cleanall_command} ${BEGIN}\t${cleanall_command}
${END}\t$(RM) *.pdb *.idb > NUL 2>&1 ${END}\t$(RM) *.pdb *.idb > NUL 2>&1
\t$(RM) $(BIN_DIR)${separator}$(MODULE_NAME).efi \t$(RM) $(BIN_DIR)${separator}$(MODULE_NAME).efi
\t$(RM) AutoGenTimeStamp
# #
# clean all dependent libraries built # clean all dependent libraries built
@ -1452,6 +1453,14 @@ class TopLevelMakefile(BuildFile):
if GlobalData.BuildOptionPcd: if GlobalData.BuildOptionPcd:
for index, option in enumerate(GlobalData.gCommand): for index, option in enumerate(GlobalData.gCommand):
if "--pcd" == option and GlobalData.gCommand[index+1]: if "--pcd" == option and GlobalData.gCommand[index+1]:
pcdName, pcdValue = GlobalData.gCommand[index+1].split('=')
if pcdValue.startswith('H'):
pcdValue = 'H' + '"' + pcdValue[1:] + '"'
ExtraOption += " --pcd " + pcdName + '=' + pcdValue
elif pcdValue.startswith('L'):
pcdValue = 'L' + '"' + pcdValue[1:] + '"'
ExtraOption += " --pcd " + pcdName + '=' + pcdValue
else:
ExtraOption += " --pcd " + GlobalData.gCommand[index+1] ExtraOption += " --pcd " + GlobalData.gCommand[index+1]
MakefileName = self._FILE_NAME_[self._FileType] MakefileName = self._FILE_NAME_[self._FileType]

View File

@ -2062,6 +2062,32 @@ def PackRegistryFormatGuid(Guid):
int(Guid[4][-2:], 16) int(Guid[4][-2:], 16)
) )
def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Value):
if PcdDatumType == 'VOID*':
if Value.startswith('L'):
if not Value[1]:
EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')
Value = Value[0] + '"' + Value[1:] + '"'
elif Value.startswith('H'):
if not Value[1]:
EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')
Value = Value[1:]
else:
if not Value[0]:
EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')
Value = '"' + Value + '"'
IsValid, Cause = CheckPcdDatum(PcdDatumType, Value)
if not IsValid:
EdkLogger.error("build", FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))
if PcdDatumType == 'BOOLEAN':
Value = Value.upper()
if Value == 'TRUE' or Value == '1':
Value = '1'
elif Value == 'FALSE' or Value == '0':
Value = '0'
return Value
## ##
# #
# This acts like the main() function for the script, unless it is 'import'ed into another # This acts like the main() function for the script, unless it is 'import'ed into another

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define checkpoints used by ECC tool # This file is used to define checkpoints used by ECC tool
# #
# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -41,6 +41,134 @@ class Check(object):
self.DeclAndDataTypeCheck() self.DeclAndDataTypeCheck()
self.FunctionLayoutCheck() self.FunctionLayoutCheck()
self.NamingConventionCheck() self.NamingConventionCheck()
self.SmmCommParaCheck()
def SmmCommParaCheck(self):
self.SmmCommParaCheckBufferType()
# Check if SMM communication function has correct parameter type
# 1. Get function calling with instance./->Communicate() interface
# and make sure the protocol instance is of type EFI_SMM_COMMUNICATION_PROTOCOL.
# 2. Find the origin of the 2nd parameter of Communicate() interface, if -
# a. it is a local buffer on stack
# report error.
# b. it is a global buffer, check the driver that holds the global buffer is of type DXE_RUNTIME_DRIVER
# report success.
# c. it is a buffer by AllocatePage/AllocatePool (may be wrapped by nested function calls),
# check the EFI_MEMORY_TYPE to be EfiRuntimeServicesCode,EfiRuntimeServicesData,
# EfiACPIMemoryNVS or EfiReservedMemoryType
# report success.
# d. it is a buffer located via EFI_SYSTEM_TABLE.ConfigurationTable (may be wrapped by nested function calls)
# report warning to indicate human code review.
# e. it is a buffer from other kind of pointers (may need to trace into nested function calls to locate),
# repeat checks in a.b.c and d.
def SmmCommParaCheckBufferType(self):
if EccGlobalData.gConfig.SmmCommParaCheckBufferType == '1' or EccGlobalData.gConfig.SmmCommParaCheckAll == '1':
EdkLogger.quiet("Checking SMM communication parameter type ...")
# Get all EFI_SMM_COMMUNICATION_PROTOCOL interface
CommApiList = []
for IdentifierTable in EccGlobalData.gIdentifierTableList:
SqlCommand = """select ID, Name, BelongsToFile from %s
where Modifier = 'EFI_SMM_COMMUNICATION_PROTOCOL*' """ % (IdentifierTable)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
if RecordSet:
for Record in RecordSet:
if Record[1] not in CommApiList:
CommApiList.append(Record[1])
# For each interface, check the second parameter
for CommApi in CommApiList:
for IdentifierTable in EccGlobalData.gIdentifierTableList:
SqlCommand = """select ID, Name, Value, BelongsToFile, StartLine from %s
where Name = '%s->Communicate' and Model = %s""" \
% (IdentifierTable, CommApi, MODEL_IDENTIFIER_FUNCTION_CALLING)
RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
if RecordSet:
# print IdentifierTable
for Record in RecordSet:
# Get the second parameter for Communicate function
SecondPara = Record[2].split(',')[1].strip()
SecondParaIndex = None
if SecondPara.startswith('&'):
SecondPara = SecondPara[1:]
if SecondPara.endswith(']'):
SecondParaIndex = SecondPara[SecondPara.find('[') + 1:-1]
SecondPara = SecondPara[:SecondPara.find('[')]
# Get the ID
Id = Record[0]
# Get the BelongsToFile
BelongsToFile = Record[3]
# Get the source file path
SqlCommand = """select FullPath from File where ID = %s""" % BelongsToFile
NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
FullPath = NewRecordSet[0][0]
# Get the line no of function calling
StartLine = Record[4]
# Get the module type
SqlCommand = """select Value3 from INF where BelongsToFile = (select ID from File
where Path = (select Path from File where ID = %s) and Model = 1011)
and Value2 = 'MODULE_TYPE'""" % BelongsToFile
NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
ModuleType = NewRecordSet[0][0] if NewRecordSet else None
# print BelongsToFile, FullPath, StartLine, ModuleType, SecondPara
Value = FindPara(FullPath, SecondPara, StartLine)
# Find the value of the parameter
if Value:
if 'AllocatePage' in Value \
or 'AllocatePool' in Value \
or 'AllocateRuntimePool' in Value \
or 'AllocateZeroPool' in Value:
pass
else:
if '->' in Value:
if not EccGlobalData.gException.IsException(
ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE, Value):
EccGlobalData.gDb.TblReport.Insert(ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE,
OtherMsg="Please review the buffer type"
+ "is correct or not. If it is correct" +
" please add [%s] to exception list"
% Value,
BelongsToTable=IdentifierTable,
BelongsToItem=Id)
else:
if not EccGlobalData.gException.IsException(
ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE, Value):
EccGlobalData.gDb.TblReport.Insert(ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE,
OtherMsg="Please review the buffer type"
+ "is correct or not. If it is correct" +
" please add [%s] to exception list"
% Value,
BelongsToTable=IdentifierTable,
BelongsToItem=Id)
# Not find the value of the parameter
else:
SqlCommand = """select ID, Modifier, Name, Value, Model, BelongsToFunction from %s
where Name = '%s' and StartLine < %s order by StartLine DESC""" \
% (IdentifierTable, SecondPara, StartLine)
NewRecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
if NewRecordSet:
Value = NewRecordSet[0][1]
if 'AllocatePage' in Value \
or 'AllocatePool' in Value \
or 'AllocateRuntimePool' in Value \
or 'AllocateZeroPool' in Value:
pass
else:
if not EccGlobalData.gException.IsException(
ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE, Value):
EccGlobalData.gDb.TblReport.Insert(ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE,
OtherMsg="Please review the buffer type"
+ "is correct or not. If it is correct" +
" please add [%s] to exception list"
% Value,
BelongsToTable=IdentifierTable,
BelongsToItem=Id)
else:
pass
# Check UNI files # Check UNI files
def UniCheck(self): def UniCheck(self):
@ -941,7 +1069,7 @@ class Check(object):
# Check Guid Format in module INF # Check Guid Format in module INF
def MetaDataFileCheckModuleFileGuidFormat(self): def MetaDataFileCheckModuleFileGuidFormat(self):
if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.MetaDataFileCheckModuleFileGuidFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Check Guid Format in module INF ...") EdkLogger.quiet("Check Guid Format in module INF ...")
Table = EccGlobalData.gDb.TblInf Table = EccGlobalData.gDb.TblInf
SqlCommand = """ SqlCommand = """
@ -984,7 +1112,7 @@ class Check(object):
# Check Protocol Format in module INF # Check Protocol Format in module INF
def MetaDataFileCheckModuleFileProtocolFormat(self): def MetaDataFileCheckModuleFileProtocolFormat(self):
if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.MetaDataFileCheckModuleFileProtocolFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Check Protocol Format in module INF ...") EdkLogger.quiet("Check Protocol Format in module INF ...")
Table = EccGlobalData.gDb.TblInf Table = EccGlobalData.gDb.TblInf
SqlCommand = """ SqlCommand = """
@ -1015,7 +1143,7 @@ class Check(object):
# Check Ppi Format in module INF # Check Ppi Format in module INF
def MetaDataFileCheckModuleFilePpiFormat(self): def MetaDataFileCheckModuleFilePpiFormat(self):
if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePpiFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Check Ppi Format in module INF ...") EdkLogger.quiet("Check Ppi Format in module INF ...")
Table = EccGlobalData.gDb.TblInf Table = EccGlobalData.gDb.TblInf
SqlCommand = """ SqlCommand = """
@ -1043,7 +1171,7 @@ class Check(object):
# Check Pcd Format in module INF # Check Pcd Format in module INF
def MetaDataFileCheckModuleFilePcdFormat(self): def MetaDataFileCheckModuleFilePcdFormat(self):
if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.MetaDataFileCheckModuleFilePcdFormat == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Check Pcd Format in module INF ...") EdkLogger.quiet("Check Pcd Format in module INF ...")
Table = EccGlobalData.gDb.TblInf Table = EccGlobalData.gDb.TblInf
SqlCommand = """ SqlCommand = """
@ -1139,9 +1267,10 @@ class Check(object):
FileTable = 'Identifier' + str(Id) FileTable = 'Identifier' + str(Id)
self.NamingConventionCheckDefineStatement(FileTable) self.NamingConventionCheckDefineStatement(FileTable)
self.NamingConventionCheckTypedefStatement(FileTable) self.NamingConventionCheckTypedefStatement(FileTable)
self.NamingConventionCheckIfndefStatement(FileTable)
self.NamingConventionCheckVariableName(FileTable) self.NamingConventionCheckVariableName(FileTable)
self.NamingConventionCheckSingleCharacterVariable(FileTable) self.NamingConventionCheckSingleCharacterVariable(FileTable)
if os.path.splitext(F)[1] in ('.h'):
self.NamingConventionCheckIfndefStatement(FileTable)
self.NamingConventionCheckPathName() self.NamingConventionCheckPathName()
self.NamingConventionCheckFunctionName() self.NamingConventionCheckFunctionName()
@ -1183,7 +1312,7 @@ class Check(object):
# Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'. # Check whether the #ifndef at the start of an include file uses both prefix and postfix underscore characters, '_'.
def NamingConventionCheckIfndefStatement(self, FileTable): def NamingConventionCheckIfndefStatement(self, FileTable):
if EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.NamingConventionCheckIfndefStatement == '1' or EccGlobalData.gConfig.NamingConventionCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking naming covention of #ifndef statement ...") EdkLogger.quiet("Checking naming covention of #ifndef statement ...")
SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF) SqlCommand = """select ID, Value from %s where Model = %s""" % (FileTable, MODEL_IDENTIFIER_MACRO_IFNDEF)
@ -1260,6 +1389,19 @@ class Check(object):
if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_SINGLE_CHARACTER_VARIABLE, OtherMsg="The variable name [%s] does not follow the rules" % (Record[1]), BelongsToTable=FileTable, BelongsToItem=Record[0])
def FindPara(FilePath, Para, CallingLine):
Lines = open(FilePath).readlines()
Line = ''
for Index in range(CallingLine - 1, 0, -1):
# Find the nearest statement for Para
Line = Lines[Index].strip()
if Line.startswith('%s = ' % Para):
Line = Line.strip()
return Line
break
return ''
## ##
# #
# This acts like the main() function for the script, unless it is 'import'ed into another # This acts like the main() function for the script, unless it is 'import'ed into another

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define class Configuration # This file is used to define class Configuration
# #
# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -256,6 +256,11 @@ class Configuration(object):
# Check PCD whether defined the prompt, help in the DEC file and localized information in the associated UNI file. # Check PCD whether defined the prompt, help in the DEC file and localized information in the associated UNI file.
self.UniCheckPCDInfo = 1 self.UniCheckPCDInfo = 1
# Check SMM communication function parameter
self.SmmCommParaCheckAll = 0
# Check if the EFI_SMM_COMMUNICATION_PROTOCOL parameter buffer type is Reserved / ACPI NVS or UEFI RT code/data
self.SmmCommParaCheckBufferType = -1
# #
# The check points in this section are reserved # The check points in this section are reserved
# #

View File

@ -1,7 +1,7 @@
## @file ## @file
# Standardized Error Hanlding infrastructures. # Standardized Error Hanlding infrastructures.
# #
# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -105,6 +105,8 @@ ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED = 10022
ERROR_SPELLING_CHECK_ALL = 11000 ERROR_SPELLING_CHECK_ALL = 11000
ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE = 12001
gEccErrorMessage = { gEccErrorMessage = {
ERROR_GENERAL_CHECK_ALL : "", ERROR_GENERAL_CHECK_ALL : "",
ERROR_GENERAL_CHECK_NO_TAB : "'TAB' character is not allowed in source code, please replace each 'TAB' with two spaces", ERROR_GENERAL_CHECK_NO_TAB : "'TAB' character is not allowed in source code, please replace each 'TAB' with two spaces",
@ -198,5 +200,7 @@ gEccErrorMessage = {
ERROR_META_DATA_FILE_CHECK_FORMAT_PCD : "Wrong Pcd Format used in Module file", ERROR_META_DATA_FILE_CHECK_FORMAT_PCD : "Wrong Pcd Format used in Module file",
ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED : "Not defined LibraryClass used in the Module file.", ERROR_META_DATA_FILE_CHECK_LIBRARY_NOT_DEFINED : "Not defined LibraryClass used in the Module file.",
ERROR_SPELLING_CHECK_ALL : "", ERROR_SPELLING_CHECK_ALL : "",
ERROR_SMM_COMM_PARA_CHECK_BUFFER_TYPE : "SMM communication function may use wrong parameter type",
} }

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to parse exception items found by ECC tool # This file is used to parse exception items found by ECC tool
# #
# Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -72,7 +72,7 @@ class ExceptionCheck(object):
self.ExceptionList = self.ExceptionListXml.ToList() self.ExceptionList = self.ExceptionListXml.ToList()
def IsException(self, ErrorID, KeyWord, FileID=-1): def IsException(self, ErrorID, KeyWord, FileID=-1):
if (str(ErrorID), KeyWord) in self.ExceptionList: if (str(ErrorID), KeyWord.replace('\r\n', '\n')) in self.ExceptionList:
return True return True
else: else:
return False return False

View File

@ -261,6 +261,13 @@ UniCheckPCDInfo = 1
# Uncheck whether UNI file is in UTF-16 format # Uncheck whether UNI file is in UTF-16 format
GeneralCheckUni = -1 GeneralCheckUni = -1
#
# SMM Communicate Function Parameter Checking
#
SmmCommParaCheckAll = 0
# Check if the EFI_SMM_COMMUNICATION_PROTOCOL parameter buffer type is Reserved / ACPI NVS or UEFI RT code/data
SmmCommParaCheckBufferType = 1
# #
# The check points in this section are reserved # The check points in this section are reserved
# #

View File

@ -1,7 +1,7 @@
## @file ## @file
# generate capsule # generate capsule
# #
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
# #
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -141,6 +141,11 @@ class Capsule (CapsuleClassObject) :
Content.write(File.read()) Content.write(File.read())
File.close() File.close()
for fmp in self.FmpPayloadList: for fmp in self.FmpPayloadList:
if fmp.Existed:
FwMgrHdr.write(pack('=Q', PreSize))
PreSize += len(fmp.Buffer)
Content.write(fmp.Buffer)
continue
if fmp.ImageFile: if fmp.ImageFile:
for Obj in fmp.ImageFile: for Obj in fmp.ImageFile:
fmp.ImageFile = Obj.GenCapsuleSubItem() fmp.ImageFile = Obj.GenCapsuleSubItem()
@ -169,12 +174,12 @@ class Capsule (CapsuleClassObject) :
dwLength = 4 + 2 + 2 + 16 + 16 + 256 + 256 dwLength = 4 + 2 + 2 + 16 + 16 + 256 + 256
fmp.ImageFile = CapOutputTmp fmp.ImageFile = CapOutputTmp
AuthData = [fmp.MonotonicCount, dwLength, WIN_CERT_REVISION, WIN_CERT_TYPE_EFI_GUID, fmp.Certificate_Guid] AuthData = [fmp.MonotonicCount, dwLength, WIN_CERT_REVISION, WIN_CERT_TYPE_EFI_GUID, fmp.Certificate_Guid]
Buffer = fmp.GenCapsuleSubItem(AuthData) fmp.Buffer = fmp.GenCapsuleSubItem(AuthData)
else: else:
Buffer = fmp.GenCapsuleSubItem() fmp.Buffer = fmp.GenCapsuleSubItem()
FwMgrHdr.write(pack('=Q', PreSize)) FwMgrHdr.write(pack('=Q', PreSize))
PreSize += len(Buffer) PreSize += len(fmp.Buffer)
Content.write(Buffer) Content.write(fmp.Buffer)
BodySize = len(FwMgrHdr.getvalue()) + len(Content.getvalue()) BodySize = len(FwMgrHdr.getvalue()) + len(Content.getvalue())
Header.write(pack('=I', HdrSize + BodySize)) Header.write(pack('=I', HdrSize + BodySize))
# #

View File

@ -183,6 +183,8 @@ class CapsulePayload(CapsuleData):
self.VendorCodeFile = [] self.VendorCodeFile = []
self.Certificate_Guid = None self.Certificate_Guid = None
self.MonotonicCount = None self.MonotonicCount = None
self.Existed = False
self.Buffer = None
def GenCapsuleSubItem(self, AuthData=[]): def GenCapsuleSubItem(self, AuthData=[]):
if not self.Version: if not self.Version:
@ -239,4 +241,5 @@ class CapsulePayload(CapsuleData):
VendorFile = open(self.VendorCodeFile, 'rb') VendorFile = open(self.VendorCodeFile, 'rb')
Buffer += VendorFile.read() Buffer += VendorFile.read()
VendorFile.close() VendorFile.close()
self.Existed = True
return Buffer return Buffer

View File

@ -39,6 +39,7 @@ from Common.Misc import SaveFileOnChange
from Common.Misc import ClearDuplicatedInf from Common.Misc import ClearDuplicatedInf
from Common.Misc import GuidStructureStringToGuidString from Common.Misc import GuidStructureStringToGuidString
from Common.Misc import CheckPcdDatum from Common.Misc import CheckPcdDatum
from Common.Misc import BuildOptionPcdValueFormat
from Common.BuildVersion import gBUILD_VERSION from Common.BuildVersion import gBUILD_VERSION
from Common.MultipleWorkspace import MultipleWorkspace as mws from Common.MultipleWorkspace import MultipleWorkspace as mws
@ -408,31 +409,6 @@ def CheckBuildOptionPcd():
GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, NewValue) GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, NewValue)
def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Value):
if PcdDatumType == 'VOID*':
if Value.startswith('L'):
if not Value[1]:
EdkLogger.error('GenFds', OPTION_VALUE_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", B"{...}"')
Value = Value[0] + '"' + Value[1:] + '"'
elif Value.startswith('B'):
if not Value[1]:
EdkLogger.error('GenFds', OPTION_VALUE_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", B"{...}"')
Value = Value[1:]
else:
if not Value[0]:
EdkLogger.error('GenFds', OPTION_VALUE_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", B"{...}"')
Value = '"' + Value + '"'
IsValid, Cause = CheckPcdDatum(PcdDatumType, Value)
if not IsValid:
EdkLogger.error('build', FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName))
if PcdDatumType == 'BOOLEAN':
Value = Value.upper()
if Value == 'TRUE' or Value == '1':
Value = '1'
elif Value == 'FALSE' or Value == '0':
Value = '0'
return Value
## FindExtendTool() ## FindExtendTool()
# #

View File

@ -102,6 +102,8 @@ if __name__ == '__main__':
try: try:
OpenSslPath = os.environ['OPENSSL_PATH'] OpenSslPath = os.environ['OPENSSL_PATH']
OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand) OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand)
if ' ' in OpenSslCommand:
OpenSslCommand = '"' + OpenSslCommand + '"'
except: except:
pass pass

View File

@ -21,10 +21,44 @@ You may need the following steps for initialization:
rd ./demoCA /S/Q rd ./demoCA /S/Q
mkdir ./demoCA mkdir ./demoCA
echo "" > ./demoCA/index.txt echo.>./demoCA/index.txt
echo 01 > ./demoCA/serial echo 01 > ./demoCA/serial
mkdir ./demoCA/newcerts mkdir ./demoCA/newcerts
OpenSSL will apply the options from the specified sections in openssl.cnf when creating certificates or certificate signing requests. Make sure your configuration in openssl.cnf is correct and rational for certificate constraints.
The following sample sections were used when generating test certificates in this readme.
...
[ req ]
default_bits = 2048
default_keyfile = privkey.pem
distinguished_name = req_distinguished_name
attributes = req_attributes
x509_extensions = v3_ca # The extensions to add to the self signed cert
...
[ v3_ca ]
# Extensions for a typical Root CA.
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid:always,issuer
basicConstraints = critical,CA:true
keyUsage = critical, digitalSignature, cRLSign, keyCertSign
...
[ v3_intermediate_ca ]
# Extensions for a typical intermediate CA.
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer
basicConstraints = critical, CA:true
keyUsage = critical, digitalSignature, cRLSign, keyCertSign
...
[ usr_cert ]
# Extensions for user end certificates.
basicConstraints = CA:FALSE
nsCertType = client, email
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment
extendedKeyUsage = clientAuth, emailProtection
...
* Generate the certificate chain: * Generate the certificate chain:
NOTE: User MUST set a UNIQUE "Common Name" on the different certificate NOTE: User MUST set a UNIQUE "Common Name" on the different certificate
@ -37,7 +71,7 @@ Generate a root key:
Generate a self-signed root certificate: Generate a self-signed root certificate:
openssl req -new -x509 -days 3650 -key TestRoot.key -out TestRoot.crt openssl req -extensions v3_ca -new -x509 -days 3650 -key TestRoot.key -out TestRoot.crt
openssl x509 -in TestRoot.crt -out TestRoot.cer -outform DER openssl x509 -in TestRoot.crt -out TestRoot.cer -outform DER
openssl x509 -inform DER -in TestRoot.cer -outform PEM -out TestRoot.pub.pem openssl x509 -inform DER -in TestRoot.cer -outform PEM -out TestRoot.pub.pem
@ -50,7 +84,7 @@ Generate the intermediate key:
Generate the intermediate certificate: Generate the intermediate certificate:
openssl req -new -days 3650 -key TestSub.key -out TestSub.csr openssl req -new -days 3650 -key TestSub.key -out TestSub.csr
openssl ca -extensions v3_ca -in TestSub.csr -days 3650 -out TestSub.crt -cert TestRoot.crt -keyfile TestRoot.key openssl ca -extensions v3_intermediate_ca -in TestSub.csr -days 3650 -out TestSub.crt -cert TestRoot.crt -keyfile TestRoot.key
openssl x509 -in TestSub.crt -out TestSub.cer -outform DER openssl x509 -in TestSub.crt -out TestSub.cer -outform DER
openssl x509 -inform DER -in TestSub.cer -outform PEM -out TestSub.pub.pem openssl x509 -inform DER -in TestSub.cer -outform PEM -out TestSub.pub.pem
@ -63,7 +97,7 @@ Generate User key:
Generate User certificate: Generate User certificate:
openssl req -new -days 3650 -key TestCert.key -out TestCert.csr openssl req -new -days 3650 -key TestCert.key -out TestCert.csr
openssl ca -in TestCert.csr -days 3650 -out TestCert.crt -cert TestSub.crt -keyfile TestSub.key` openssl ca -extensions usr_cert -in TestCert.csr -days 3650 -out TestCert.crt -cert TestSub.crt -keyfile TestSub.key
openssl x509 -in TestCert.crt -out TestCert.cer -outform DER openssl x509 -in TestCert.crt -out TestCert.cer -outform DER
openssl x509 -inform DER -in TestCert.cer -outform PEM -out TestCert.pub.pem openssl x509 -inform DER -in TestCert.cer -outform PEM -out TestCert.pub.pem

View File

@ -1,57 +1,60 @@
Bag Attributes Bag Attributes
localKeyID: 01 00 00 00 localKeyID: 32 25 22 FA 81 B3 BF 25 E2 F7 8F 0B 1B C4 50 70 BB B7 85 96
Microsoft CSP Name: Microsoft Strong Cryptographic Provider subject=/C=CN/ST=SH/O=TianoCore/OU=EDKII/CN=TestCert/emailAddress=edkii@tianocore.org
friendlyName: PvkTmp:133cc061-112c-467a-b8cf-dc0a56d7830e issuer=/C=CN/ST=SH/O=TianoCore/OU=EDKII/CN=TestSub/emailAddress=edkii@tianocore.org
Key Attributes
X509v3 Key Usage: 80
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSPHYSohF+fim4
89iNx8CcCG/fPb7KLu9Dsq+pB4Pc/UJtaaA+D7RK3PhqNCrWbb+gCNgm7lxiOCrH
mm0tPal71UV8VFUiTM7Zf1y8VBFCHJ92ykmS7MDwqV25oMGGocz4jdcPl3r2yFFq
d9jaBAPjUsHRbs8AC8CKHexOACfeydgQoj9KPWH9DUFQyXcbtMyGXAvFCktnSNRQ
f01UdNJebeD6+wlQn0sUaojn1lu570OdZ3AkJlm6bTEKvfHeOB21GaHnQ1O1RVtq
vd/KjFHhxSSw8meTsyqN/Toa/80FyUKEmTIaJdEaq/C2XKaUACezsYqvRxDq+pli
kyiIpt6bAgMBAAECggEAEeqpdrf3l71iZEAwCJLwNM3N0xawEPp2Ix+56OY8UC+R
W3FlCiWHa+Kt5uk0VGhG4Zcj0IVEuV3zU9hGRxQ2dy8Wn9h/Q8AQWdKCbKqKIMT7
/qRjJkauju3ZR1x8SX/6anuKXWUsUh8R5o7/eRqj1U6242+FmhZWhTWMVbQsLl3y
AShlw56zwdto543Ssl+MLuUtkxT4UZwmo6k/BucvdYsvwWp8dAluhDp2onAfOMLn
10Bk3Bl9AgnpcQEeGwFConmgBv31UhdYftfIj2R4tTZRDuC+GzRT6jl1Qu6JfPSp
30tmW5x3aa3946VZw2DKNiBqqYllJM1+kkzmGj+jgQKBgQC1Pzl8gv3q2TH9MlTD
Tn9rUEs5OhjCrgZrSXoY2rfLcqJf2Tqm6I4xsVXvuePMyu8+DRD1Xizq6otUzNsN
qh+UVkGRrFYRsgCgv1ratUti2ZlIPrR3JZsz8f23TAMGFFWCNHDH2rb1UanRD+g8
vO4fQM8FPxBfb6wcgDYqNNMdGwKBgQDOjKhqp5sNNXNF7/rfH6H8RfKVOXuCK1Xy
PU3Hgzd1wMfoebku4j5zQi2topzy664k9oeLCJj4GNDeHAqMttWD6TzDlMGJfdnj
bNcrr+HnqUXByU2kS+bcTgBzsyT/1m1M7pKwtSYJzYXP1AHQny3Ip5kutCMo19td
R4LfdebcgQKBgF3CHQzJ/mw0euWN2cdGnid3W9J4uUJMH8n0MpMU4ar+2/xVNUAO
YTBXmirusGbKO8SPocwsMXQ8bGMrrc19yeREUpr22XdB6408L9WfnyW9hsuWlGhm
LclLT4I4cf/9GNbIJedcvvRckEozvmFdIplMP0tpeiDEdfYwZNSkiuktAoGBAL5m
gTXYDSFO/VUiFFOsOElyPV174LOsuQyVoGZjOjOtI1rVInTqkAD1p1/hf+aahSyD
qYzrvv8s+RVWKg9u10JDNgVg0kupHLr98RfPiWJg8vHhXFYwtb6tlNMS9+9yvczm
O4jzY/4zW7+qQoYKxkyq2pVn7uVOnmPNcQIHEGqBAoGBAJMfZV2vpxY6kti8SXzb
PscYI3ZbbKyJLq4+KHGcKCqqbLiY4ao8vflDyDwBm+TJg4xq9wjJAN2riE9nuuds
99mYW/8R30BIfiH/4oBHjggb0NC5K3vHR4KGDKcUiIKZPv1r7mNeYw227N4n/dPM
NXjlZVuS6mqc2T+GPzAJj/Uf
-----END PRIVATE KEY-----
Bag Attributes
localKeyID: 01 00 00 00
subject=/CN=TestCert
issuer=/CN=TestSub
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIC/TCCAemgAwIBAgIQ0+nLBVt+jbJMSfzhFpRJrDAJBgUrDgMCHQUAMBIxEDAO MIIEKzCCAxOgAwIBAgICEAMwDQYJKoZIhvcNAQELBQAwdDELMAkGA1UEBhMCQ04x
BgNVBAMTB1Rlc3RTdWIwHhcNMTYwODA0MTUwMjMwWhcNMzkxMjMxMjM1OTU5WjAT CzAJBgNVBAgMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsMBUVES0lJ
MREwDwYDVQQDEwhUZXN0Q2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC MRAwDgYDVQQDDAdUZXN0U3ViMSIwIAYJKoZIhvcNAQkBFhNlZGtpaUB0aWFub2Nv
ggEBAJI8dhKiEX5+Kbjz2I3HwJwIb989vsou70Oyr6kHg9z9Qm1poD4PtErc+Go0 cmUub3JnMB4XDTE3MDQxMDA4MzgwNFoXDTE4MDQxMDA4MzgwNFowdTELMAkGA1UE
KtZtv6AI2CbuXGI4KseabS09qXvVRXxUVSJMztl/XLxUEUIcn3bKSZLswPCpXbmg BhMCQ04xCzAJBgNVBAgMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsM
wYahzPiN1w+XevbIUWp32NoEA+NSwdFuzwALwIod7E4AJ97J2BCiP0o9Yf0NQVDJ BUVES0lJMREwDwYDVQQDDAhUZXN0Q2VydDEiMCAGCSqGSIb3DQEJARYTZWRraWlA
dxu0zIZcC8UKS2dI1FB/TVR00l5t4Pr7CVCfSxRqiOfWW7nvQ51ncCQmWbptMQq9 dGlhbm9jb3JlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPe+
8d44HbUZoedDU7VFW2q938qMUeHFJLDyZ5OzKo39Ohr/zQXJQoSZMhol0Rqr8LZc 2NX/Tf0iWMJgYMXMoWOiveX9FGx9YcwH+BKn9ZPZHig6CsZ6B17fwBWek8rIOAOR
ppQAJ7Oxiq9HEOr6mWKTKIim3psCAwEAAaNWMFQwDAYDVR0TAQH/BAIwADBEBgNV W8FL+UyRhsnKF/oKjMN7awiLjackjq8m0bPFHVl4dJooulHmSPCsRMeG/pWs4DVP
HQEEPTA7gBAeQOcW6KCBdWSbrvKQrBrfoRUwEzERMA8GA1UEAxMIVGVzdFJvb3SC WiIoF1uvXN6MZ3zt0hofgqPnGjJQF0HLECrPqyBv7sit9fIaNZ/clqcR3ZqdXQRU
ELOMZKZtPz2BS8i5NTXdHNMwCQYFKw4DAh0FAAOCAQEAK7YgK6iiTo07d3CSY4xG fEk7dE8pg+ZjNNa/5WTGwSBB7Ieku4jGbKybvpj6FtEP/8YyAJC3fOD+Y4PIQCnF
9N0QS2m4LsBPrF8pFmk5h6R81MFEdBZrA+zggbUujQ2IGB7k6F7WvP3F3B3AXZtx xzWchOGrFcoeqgf/hLhzoiRvalgnvjczbo3W4sgFwFD/WxoDqb1l1moHyOubw5oT
DW1FYrQheQhTT5wx85LxFdLy+q6uwUtJi/VyErPmZOcds3QaBXPvG/UykFbu24JV CdD+J+QwdFl1kCkG+K8CAwEAAaOBxTCBwjAJBgNVHRMEAjAAMBEGCWCGSAGG+EIB
K2ScLpQVyzmkTN7GWSXrIO6eHHMQgeRX3XjRutbR8CKP1pWTOY+MO4G6YZqrzLdp AQQEAwIFoDAzBglghkgBhvhCAQ0EJhYkT3BlblNTTCBHZW5lcmF0ZWQgQ2xpZW50
opYFPgvdZpTL3IKSSkp31Amu5oidkvzLgallC3SOYdLZirWEIAAXW2LVYXwiiL6L IENlcnRpZmljYXRlMB0GA1UdDgQWBBTACEuCjiL/cFrP+l8hECWctq+Q+TAfBgNV
HEIV/G9u85jhKhv/z9l8F/1Eg4HHGSYba8pf1HQA+WsQwi4BVp4x4MBoeHOolyVT HSMEGDAWgBTWnWbWSXz6II1ddWkqQQp6A1ql6zAOBgNVHQ8BAf8EBAMCBeAwHQYD
/A== VR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMEMA0GCSqGSIb3DQEBCwUAA4IBAQA7
vYHdpk9u63dpMKAt5MrKU9dxVn/wuqNaYQMucvQLpcE12fgWMhV2wOHlmk3fJxq7
CnD8QVaRbL3OQYWQQDA+sGNSJ9r71WFFET++94Rny6BzTz+dkrvIS4WaL/vLZ17c
/gOsMCZUlhodxDcSSkachab3eE/VTEzOMUm41YYeW7USIoNSSgkWSnwZQVgcIg93
F9X6lIr0Ik6rxHMq2ManiuSh6cMjJMGYGf2/58TySIefrXTe2A3TKQR27OYjfXJO
l/H7u+4HS9AVCA7b9NihR5iSho5HrWqNC4Mmuz8D8iFOI2nWcek86StDswtoqDtu
yekXblzF5lQY0goqDiks
-----END CERTIFICATE----- -----END CERTIFICATE-----
Bag Attributes
localKeyID: 32 25 22 FA 81 B3 BF 25 E2 F7 8F 0B 1B C4 50 70 BB B7 85 96
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQD3vtjV/039IljC
YGDFzKFjor3l/RRsfWHMB/gSp/WT2R4oOgrGegde38AVnpPKyDgDkVvBS/lMkYbJ
yhf6CozDe2sIi42nJI6vJtGzxR1ZeHSaKLpR5kjwrETHhv6VrOA1T1oiKBdbr1ze
jGd87dIaH4Kj5xoyUBdByxAqz6sgb+7IrfXyGjWf3JanEd2anV0EVHxJO3RPKYPm
YzTWv+VkxsEgQeyHpLuIxmysm76Y+hbRD//GMgCQt3zg/mODyEApxcc1nIThqxXK
HqoH/4S4c6Ikb2pYJ743M26N1uLIBcBQ/1saA6m9ZdZqB8jrm8OaEwnQ/ifkMHRZ
dZApBvivAgMBAAECggEBAJ8NtLJ27T/1vBxWuepjfL217sroFyOrv4y5FQgNMvnP
q6/Ry7cvAupjJjP7EhFfR67qtIi92PjSeUG18HzEJykdZFMhHTlQnBZRCtKqWzRk
xB9wxGXuPafeQW4D+hBn4632GvzQ1mYziKEMbShkmr3QuxO1PDlO+A9yahfCKbBx
SPCo+McV+N4c8ft/0UPMxqJLcZSMWscrBMCw1OhGdHry4CEr+NWHBeAAUWXrGSlq
BPwM6PT00fku1RwQrw0QZw0YKL8VH5iA/uD8hfuaO2YUlt2Z025csNRyIPrizr6v
Q8Is7jetqPpXulWSBtSYoghTj97DeYQQsQwck+tQN6kCgYEA/beFmdojyc9CoLkd
0MgwyPBdWma77rj80PAgeRm0hl2KQa8pA6dL/1y5x3vA25gqBr++q+KmSkYT6z/Z
n3llOk6pRlSWFlxuSLHVjOb/Qp1V/uxEG68Tg8L/I3SlMWiQ+/MnsXNHh+WEtKcZ
FCVd0ASA4NbsKYKflT2QgraDB00CgYEA+fmRrwRlkh2OxVrxpGFER2uosYGlwQiq
Xb75eU8BnpO8CCnXtBK4Uv3J6l/zfc+Tr2LzzgPkQiWd4NF1/EFxCNQA5kxGcPf5
F4f8dPr8CrADO1JNrX2ITHsosaaC1ImdW/r6tl66Ie2ueCImk5Yfu5DQv7JrKh/d
lrTEUxJL2esCgYEA2VKBla9MSGjH4XOvHk7busJotC6be3fo1e9ZYWGrSAyHiIvI
zeBXMHz0hPJz16UXGoDTideyKJyuIyul9Pu+wZrvU9bQWIcD0DDDgtW6gAzUxG8M
R8pHJO26LVyUwyWWSrmUnmLoOndWnIck7CS1nqC849o0n7nLh8IcLlq3EWECgYEA
1HkeLE4na2f2R6fChv8qAy7uJ1rUodwUuzQtZsAR11EpXSL7tpLG27veGXpPQ9vh
Yw1PwAesx9Cjfklr6OtTAbb5wMaKhVExB6BNpL0E6KytQon1foaaCLASadXnlHIY
L+uHmOWxfk9BodkdQwsyk8JGvPoRfq+xMH0b9qQxltsCgYEAtNf8yvoTXUHa2zje
PvI6OiQjuiON5UIt9KkQNrIrcm4wiQ2eVdkCQcUstuXtmBtvnsrxlay0jbSz2bV6
1sWlJIvfZJujC901yMs5+twr6jMuXZ6ashWF1f2UbwgtKvh49PPgly4RhWST3Kp1
J1AmCrzTwtaNmTZd1g5IYreXpKw=
-----END PRIVATE KEY-----

View File

@ -1,19 +1,25 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIC/TCCAemgAwIBAgIQ0+nLBVt+jbJMSfzhFpRJrDAJBgUrDgMCHQUAMBIxEDAO MIIEKzCCAxOgAwIBAgICEAMwDQYJKoZIhvcNAQELBQAwdDELMAkGA1UEBhMCQ04x
BgNVBAMTB1Rlc3RTdWIwHhcNMTYwODA0MTUwMjMwWhcNMzkxMjMxMjM1OTU5WjAT CzAJBgNVBAgMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsMBUVES0lJ
MREwDwYDVQQDEwhUZXN0Q2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC MRAwDgYDVQQDDAdUZXN0U3ViMSIwIAYJKoZIhvcNAQkBFhNlZGtpaUB0aWFub2Nv
ggEBAJI8dhKiEX5+Kbjz2I3HwJwIb989vsou70Oyr6kHg9z9Qm1poD4PtErc+Go0 cmUub3JnMB4XDTE3MDQxMDA4MzgwNFoXDTE4MDQxMDA4MzgwNFowdTELMAkGA1UE
KtZtv6AI2CbuXGI4KseabS09qXvVRXxUVSJMztl/XLxUEUIcn3bKSZLswPCpXbmg BhMCQ04xCzAJBgNVBAgMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsM
wYahzPiN1w+XevbIUWp32NoEA+NSwdFuzwALwIod7E4AJ97J2BCiP0o9Yf0NQVDJ BUVES0lJMREwDwYDVQQDDAhUZXN0Q2VydDEiMCAGCSqGSIb3DQEJARYTZWRraWlA
dxu0zIZcC8UKS2dI1FB/TVR00l5t4Pr7CVCfSxRqiOfWW7nvQ51ncCQmWbptMQq9 dGlhbm9jb3JlLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPe+
8d44HbUZoedDU7VFW2q938qMUeHFJLDyZ5OzKo39Ohr/zQXJQoSZMhol0Rqr8LZc 2NX/Tf0iWMJgYMXMoWOiveX9FGx9YcwH+BKn9ZPZHig6CsZ6B17fwBWek8rIOAOR
ppQAJ7Oxiq9HEOr6mWKTKIim3psCAwEAAaNWMFQwDAYDVR0TAQH/BAIwADBEBgNV W8FL+UyRhsnKF/oKjMN7awiLjackjq8m0bPFHVl4dJooulHmSPCsRMeG/pWs4DVP
HQEEPTA7gBAeQOcW6KCBdWSbrvKQrBrfoRUwEzERMA8GA1UEAxMIVGVzdFJvb3SC WiIoF1uvXN6MZ3zt0hofgqPnGjJQF0HLECrPqyBv7sit9fIaNZ/clqcR3ZqdXQRU
ELOMZKZtPz2BS8i5NTXdHNMwCQYFKw4DAh0FAAOCAQEAK7YgK6iiTo07d3CSY4xG fEk7dE8pg+ZjNNa/5WTGwSBB7Ieku4jGbKybvpj6FtEP/8YyAJC3fOD+Y4PIQCnF
9N0QS2m4LsBPrF8pFmk5h6R81MFEdBZrA+zggbUujQ2IGB7k6F7WvP3F3B3AXZtx xzWchOGrFcoeqgf/hLhzoiRvalgnvjczbo3W4sgFwFD/WxoDqb1l1moHyOubw5oT
DW1FYrQheQhTT5wx85LxFdLy+q6uwUtJi/VyErPmZOcds3QaBXPvG/UykFbu24JV CdD+J+QwdFl1kCkG+K8CAwEAAaOBxTCBwjAJBgNVHRMEAjAAMBEGCWCGSAGG+EIB
K2ScLpQVyzmkTN7GWSXrIO6eHHMQgeRX3XjRutbR8CKP1pWTOY+MO4G6YZqrzLdp AQQEAwIFoDAzBglghkgBhvhCAQ0EJhYkT3BlblNTTCBHZW5lcmF0ZWQgQ2xpZW50
opYFPgvdZpTL3IKSSkp31Amu5oidkvzLgallC3SOYdLZirWEIAAXW2LVYXwiiL6L IENlcnRpZmljYXRlMB0GA1UdDgQWBBTACEuCjiL/cFrP+l8hECWctq+Q+TAfBgNV
HEIV/G9u85jhKhv/z9l8F/1Eg4HHGSYba8pf1HQA+WsQwi4BVp4x4MBoeHOolyVT HSMEGDAWgBTWnWbWSXz6II1ddWkqQQp6A1ql6zAOBgNVHQ8BAf8EBAMCBeAwHQYD
/A== VR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMEMA0GCSqGSIb3DQEBCwUAA4IBAQA7
vYHdpk9u63dpMKAt5MrKU9dxVn/wuqNaYQMucvQLpcE12fgWMhV2wOHlmk3fJxq7
CnD8QVaRbL3OQYWQQDA+sGNSJ9r71WFFET++94Rny6BzTz+dkrvIS4WaL/vLZ17c
/gOsMCZUlhodxDcSSkachab3eE/VTEzOMUm41YYeW7USIoNSSgkWSnwZQVgcIg93
F9X6lIr0Ik6rxHMq2ManiuSh6cMjJMGYGf2/58TySIefrXTe2A3TKQR27OYjfXJO
l/H7u+4HS9AVCA7b9NihR5iSho5HrWqNC4Mmuz8D8iFOI2nWcek86StDswtoqDtu
yekXblzF5lQY0goqDiks
-----END CERTIFICATE----- -----END CERTIFICATE-----

View File

@ -1,56 +1,58 @@
Bag Attributes Bag Attributes
localKeyID: 01 00 00 00 localKeyID: F4 2E C8 1D 29 A0 02 47 B7 93 2B 69 8D 8D D1 33 7A E3 09 30
Microsoft CSP Name: Microsoft Strong Cryptographic Provider subject=/C=CN/ST=SH/L=SH/O=TianoCore/OU=EDKII/CN=TestRoot/emailAddress=edkii@tianocore.org
friendlyName: PvkTmp:76c92422-d6f3-4763-9b80-b423fd921d00 issuer=/C=CN/ST=SH/L=SH/O=TianoCore/OU=EDKII/CN=TestRoot/emailAddress=edkii@tianocore.org
Key Attributes
X509v3 Key Usage: 80
-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCU5jNPVsMHoNCZ
V8PhVkIBcFkcL0pmjzSek7227JKkkFFdxo+1w4YV32CAvrh4WVub/SeSaczKjj6e
gUdbhO9cm7NKQ1uNCzEEALaKwKn1IdA/zbBnfVAzLvsbLBYu7lYBh/bI1FMHZ5kL
Rr8dkMbbf21iDEqsqKI8eQ+tj/7B6OUnPfmmmh3sml9iUS6YHSm6a4r7Qw5oKfW+
Z0hEKEX+HTtQcmrAuwyfAmGtY6eH9jKfPhZc7swFvRfoRlKvUIqmfhZpg2lbbk3H
z4C4zfZmP75soOicJmC6qQXdcUq9AKgM91CrRNY+hyE8LeYzJ14hJ7ncOEjWOpbh
F0dlZc49AgMBAAECgf8dY26Sej8u15Xiri/l3zXgy7aR7uAAbFGoM8fv2exQgIDk
FrdxTDtqzqTSxGAkfUWs4Ip2DUEeZDwF/qjW4FCzb3mI/QmNt70Yd9KsEDAmDkZ2
wylcYC2l7IqVEl6HZMpNyiu5hfXdTn/tlkkUIiKr6POYmFR6IyPiS61Tm4LQXyhv
iW+Lx0GqFQcH82CsbNRNgJGJk/BIiHn7kNDi5rRrKsmTuKEQB9iwF/rKp+lnJN0g
4qTv2bbZVxj39QWdOovU5LCL+1WJdkA2mpFpZjBEsTdF+UEGCbixdiftfovnZa64
rofw3pIxr97XS42D3OmdPmSokpwqcQtjTXfScCECgYEAvxBMHcEFMZX644hhZtH7
t0/PCka9DUBZfe58r+lmgSvlbMCka9OvKGtr86+j0IdWqmGWxRHAuk3KR3NIC3EU
mD0rYSWiStW0I/cmHidS/a9OdWWHtWi1LcXX7KBn9AjKjPzghqAfDAkRxYfZKLIo
PRL44O/RM6nJ1j7az5CgWR0CgYEAx4FW/xVVL1Z0kn/VyNVYLdlhV4zMNn6Cu0ko
jebQydDBh4Tsne2A4dPonZQSsEiJ6jhzaUZr7l5OAEp+0aX0M/h6JbxTcA4CK3Xr
X2TAaOCkPc1r0I79ZduKymyMNrWfXHenvFVl57klp9eFRQJ6o+pZB9ysFzPHXbci
4VCsX6ECgYBMqAdB8M1apafxXihmDl2FoJmar+LtzCGbqvGPyn772FbGGUxejqG5
/89iB9gbtBELbvgEvSisFsXPgOso3Ae9RN2Aro68o50QyPocIv7jFVDPPRsDp6z5
XmVRZNIQUO6jPln+6YNLWuAsdmKkN0Z5qoD8DnvK1JZMRQ+ZM5eB6QKBgQCuvz+w
VsMyn4uj9o0PSK/gGRQGV7FX2iAwY7g98vrWix+40FlhS3MkWzTZMaXc+uyyV5ff
kmtfcwLnhljm0XHBQ9fZzcdX0y1bXAI6oElYk8vIxnG1UEnsOgyrmcCG+zcHC1fE
wxhri+TLyx9UfwNlKBOrq0KhYB00nQDUUpFpgQKBgQCPWpNeNQ8hCARnayhzu2fE
HEPG1P/resOp0u+c4jy4TeHVa9806wqZlkYNRKNn09Ub5Ajpp05dwdb+JvUSkWwr
vOmE94WeLg5FuNzPAQjwAe+Eq54Vk8TdAhdLSu1m2xdBKFtEOk6TQTmRBCiknwhg
19TgHd8hEFnz6ZICAeWGbQ==
-----END PRIVATE KEY-----
Bag Attributes
localKeyID: 01 00 00 00
subject=/CN=TestRoot
issuer=/CN=TestRoot
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIC8DCCAdygAwIBAgIQNDAnfwU9lYVDoKT1DJrnyjAJBgUrDgMCHQUAMBMxETAP MIID7DCCAtSgAwIBAgIJAMCRxeK3ZsD4MA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD
BgNVBAMTCFRlc3RSb290MB4XDTE2MDgwNDE1MDE0OFoXDTM5MTIzMTIzNTk1OVow VQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNVBAcMAlNIMRIwEAYDVQQKDAlUaWFu
EzERMA8GA1UEAxMIVGVzdFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK b0NvcmUxDjAMBgNVBAsMBUVES0lJMREwDwYDVQQDDAhUZXN0Um9vdDEiMCAGCSqG
AoIBAQCU5jNPVsMHoNCZV8PhVkIBcFkcL0pmjzSek7227JKkkFFdxo+1w4YV32CA SIb3DQEJARYTZWRraWlAdGlhbm9jb3JlLm9yZzAeFw0xNzA0MTAwODI3NDBaFw0x
vrh4WVub/SeSaczKjj6egUdbhO9cm7NKQ1uNCzEEALaKwKn1IdA/zbBnfVAzLvsb NzA1MTAwODI3NDBaMIGCMQswCQYDVQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNV
LBYu7lYBh/bI1FMHZ5kLRr8dkMbbf21iDEqsqKI8eQ+tj/7B6OUnPfmmmh3sml9i BAcMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsMBUVES0lJMREwDwYD
US6YHSm6a4r7Qw5oKfW+Z0hEKEX+HTtQcmrAuwyfAmGtY6eH9jKfPhZc7swFvRfo VQQDDAhUZXN0Um9vdDEiMCAGCSqGSIb3DQEJARYTZWRraWlAdGlhbm9jb3JlLm9y
RlKvUIqmfhZpg2lbbk3Hz4C4zfZmP75soOicJmC6qQXdcUq9AKgM91CrRNY+hyE8 ZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALkpKWxgDNcj9n3u8GL/
LeYzJ14hJ7ncOEjWOpbhF0dlZc49AgMBAAGjSDBGMEQGA1UdAQQ9MDuAEM61es/l 2cmqVYyBlVY/t1ZTsMKCEsU7dSO5TdbEVXPzqpWoG/OTfp5A5B0inJMHC9eqW9fk
Icdr8+yS1L9lKjWhFTATMREwDwYDVQQDEwhUZXN0Um9vdIIQNDAnfwU9lYVDoKT1 GiGE12NZA1Af9RRVk5Gb9VKwvw5caDtZUpiWVuGrxEO7BVd4RQGfWBVTDhGULw7x
DJrnyjAJBgUrDgMCHQUAA4IBAQBrDeAK0O5bP7ZzSGLo9Fvh7dkAxeUOaPtTMzBq phmiboY5KzONx8Xr7h4z0zKUwVnEDJcLEkhfM/ZgdH1XwhMtfamHozXqkYM/Z3qS
YLruOFtRY3DVfgX+5EUqFWIb/Nh1k1b25gaFIfcIRya5/gVOkCJU9DkJTFyOzXw7 HwFTn2JfmRL9cxstnitsNEmvTwePwOlrnl95NdoqXIju9khh2pbjSEaglByd9lyH
r0stGAb0XCQqZPdZdSiXqZAsukYCamRmSTLLXTT+JOREsMKtFxsFfdNYiC6+Dtcr Du90CZENPVrnxUyKeqyhhbZnRBdVUjroEU1YopMAYup7gO3Pvd91gEu5ZWOtC010
yly/KCU92Ls8OFLmJ/rSuEVrX39LsCMF6K9n6OJsL5/4c3/DF7yyalsq82vT3H/f +lkCAwEAAaNjMGEwHQYDVR0OBBYEFBaq1o4bLUPzLbAkrTZlP7L6sSztMB8GA1Ud
L9CrBgz+A+eNguyEPch97ctqWzVIVQf7qngaAbuYRYvaiuMhV4YVIxdQG5y8Glmo IwQYMBaAFBaq1o4bLUPzLbAkrTZlP7L6sSztMA8GA1UdEwEB/wQFMAMBAf8wDgYD
Kq06fgEkg/ewYea9T9mRkKcquQw7q5UgHPB0zgK6FF3xkSVK VR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4IBAQCV3t+kFNuSIngavTGdHtcv
ChARXXRh6DDE8xXpMFT0uwwEeBNdLN2MkpDRnNDQGKOj/IwoWtSRTQjD9hrI3aYI
WOIVlfstLYqxMIC9mrbhLCA+3cTHVWXPKBf07tq+d3DVUtYVevutr/3VRZBa5jFC
14SzSVZq00fzv2hgiw/ir/Tj7BK54joWEU5Nc3mvR4VMdiaeizLAjsLcJ6bvrJOe
oV7PNEXgKsedTdfXN3KX+Fj5tjVI8dEKcn/9TXzpzNhIG0lSU95RAVM1vJDNjIrM
QyCnRf8rVbCLLf9VFUuE0MPTkJyUS1XVYuoiq2Jo3VPG3KXdmi2OeXwunORmgIwd
-----END CERTIFICATE----- -----END CERTIFICATE-----
Bag Attributes
localKeyID: F4 2E C8 1D 29 A0 02 47 B7 93 2B 69 8D 8D D1 33 7A E3 09 30
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC5KSlsYAzXI/Z9
7vBi/9nJqlWMgZVWP7dWU7DCghLFO3UjuU3WxFVz86qVqBvzk36eQOQdIpyTBwvX
qlvX5BohhNdjWQNQH/UUVZORm/VSsL8OXGg7WVKYllbhq8RDuwVXeEUBn1gVUw4R
lC8O8aYZom6GOSszjcfF6+4eM9MylMFZxAyXCxJIXzP2YHR9V8ITLX2ph6M16pGD
P2d6kh8BU59iX5kS/XMbLZ4rbDRJr08Hj8Dpa55feTXaKlyI7vZIYdqW40hGoJQc
nfZchw7vdAmRDT1a58VMinqsoYW2Z0QXVVI66BFNWKKTAGLqe4Dtz73fdYBLuWVj
rQtNdPpZAgMBAAECggEAci5d6wT4Jht5P4N/Ha2kweWWR8UJMFyuVD/bura3mITn
4ZW92HjOMWjLgupeAkCsTi65/PWBFHG97cqSRHnXW2At6ofTsS9j1JxJGfvQtqNj
zhlR9XdJperfvN5Nc277BkuWUj/O86d5/4Ef29lMknZGLeNHLs15qiWpe1p+HKvt
+DfL7Prl5qWA5G90QmXgRQJbThl1TYLCYkETB+9m3MIRm8Z01XKH+fm4ahgclEkG
XaQl04DhMEo7A/sC8NUnozOMEf81Ixkt3wEpoEDtZ+WhRTrgLF23Q4sXAIBMlEfz
Pz2UaX/9KBT1dRbZseStIjJKMc8qd+pC7Ww2tuHEOQKBgQDmLdFSgHc2URQW/Otj
fr9S/Z7EPSOA/tmh4dFhQGwzKF4Us838deRz2cRTbgq5BHuBCrMEPRBiX8h4WLEB
NVZ73JjgOfyshcDXWNg5noc9f24HYHMZnjcFmHNokpyIgxLl2qgN8f03doJEmKkj
pm/VnfZmkGDd65IXRp8MYMTQOwKBgQDN7ofqKWK5SA+vt+tDOkCYq6eHKb9+ImPh
PreikT5xc9SMtb0tGlIjKydsiqA9Jv1WRnpUG0fVfMyagBSOrKt9wC143VEvOtkR
QJehmLLYG97HP7CXtniAWeKuc2pfCd+nGdHLFmduuTEEDcxab5LQc5dvYQ/RfznF
YVunt73qewKBgQCg11VUpCYpU2CJa7SEMtY4hLbDg8FiazLiVqx7m4u/964+IyKG
Dk9T0NDKR7PAc2xl0HclOBJR24J27erJ4F6NcKl2za5NU61cDV4SbT8tbvUQvInR
Veg2xb+nTAOLtKOo8DDMhdMeRXZjvpU6LxwolhfOtYaqq+jK0PNkr933bwKBgA0G
RiBgR7cyQJO7jSyuVYGSccERuePPZwPLBLBKgWmJiurvX6ynmoRQ6WhrCCF2AtXf
FUOWih+Nih9HdIVllF8atYWMceML1MjLjguRbdZPRPLTK2cdClgL11NzR0oFhNi7
wFIY86fEHL6F5OPfZKi8dtp7iBWW919tfe+IpoFbAoGBAMzNKKBHG5eMuKQI/Dww
50PDHu25TGUiTc1bHx18v7mGlcvhEPkDYAKd3y7FN5VRoooarGYlLDHXez0FvDTa
ABFUUad70bULTqRTSmld0I9CWWnYs0vaFKgIemddQ7W2eXr7N+N+ED+OK/PvWjMq
LMKhChf252RfOYdB+WN6alVG
-----END PRIVATE KEY-----

View File

@ -1,18 +1,23 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIC8DCCAdygAwIBAgIQNDAnfwU9lYVDoKT1DJrnyjAJBgUrDgMCHQUAMBMxETAP MIID7DCCAtSgAwIBAgIJAMCRxeK3ZsD4MA0GCSqGSIb3DQEBCwUAMIGCMQswCQYD
BgNVBAMTCFRlc3RSb290MB4XDTE2MDgwNDE1MDE0OFoXDTM5MTIzMTIzNTk1OVow VQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNVBAcMAlNIMRIwEAYDVQQKDAlUaWFu
EzERMA8GA1UEAxMIVGVzdFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK b0NvcmUxDjAMBgNVBAsMBUVES0lJMREwDwYDVQQDDAhUZXN0Um9vdDEiMCAGCSqG
AoIBAQCU5jNPVsMHoNCZV8PhVkIBcFkcL0pmjzSek7227JKkkFFdxo+1w4YV32CA SIb3DQEJARYTZWRraWlAdGlhbm9jb3JlLm9yZzAeFw0xNzA0MTAwODI3NDBaFw0x
vrh4WVub/SeSaczKjj6egUdbhO9cm7NKQ1uNCzEEALaKwKn1IdA/zbBnfVAzLvsb NzA1MTAwODI3NDBaMIGCMQswCQYDVQQGEwJDTjELMAkGA1UECAwCU0gxCzAJBgNV
LBYu7lYBh/bI1FMHZ5kLRr8dkMbbf21iDEqsqKI8eQ+tj/7B6OUnPfmmmh3sml9i BAcMAlNIMRIwEAYDVQQKDAlUaWFub0NvcmUxDjAMBgNVBAsMBUVES0lJMREwDwYD
US6YHSm6a4r7Qw5oKfW+Z0hEKEX+HTtQcmrAuwyfAmGtY6eH9jKfPhZc7swFvRfo VQQDDAhUZXN0Um9vdDEiMCAGCSqGSIb3DQEJARYTZWRraWlAdGlhbm9jb3JlLm9y
RlKvUIqmfhZpg2lbbk3Hz4C4zfZmP75soOicJmC6qQXdcUq9AKgM91CrRNY+hyE8 ZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALkpKWxgDNcj9n3u8GL/
LeYzJ14hJ7ncOEjWOpbhF0dlZc49AgMBAAGjSDBGMEQGA1UdAQQ9MDuAEM61es/l 2cmqVYyBlVY/t1ZTsMKCEsU7dSO5TdbEVXPzqpWoG/OTfp5A5B0inJMHC9eqW9fk
Icdr8+yS1L9lKjWhFTATMREwDwYDVQQDEwhUZXN0Um9vdIIQNDAnfwU9lYVDoKT1 GiGE12NZA1Af9RRVk5Gb9VKwvw5caDtZUpiWVuGrxEO7BVd4RQGfWBVTDhGULw7x
DJrnyjAJBgUrDgMCHQUAA4IBAQBrDeAK0O5bP7ZzSGLo9Fvh7dkAxeUOaPtTMzBq phmiboY5KzONx8Xr7h4z0zKUwVnEDJcLEkhfM/ZgdH1XwhMtfamHozXqkYM/Z3qS
YLruOFtRY3DVfgX+5EUqFWIb/Nh1k1b25gaFIfcIRya5/gVOkCJU9DkJTFyOzXw7 HwFTn2JfmRL9cxstnitsNEmvTwePwOlrnl95NdoqXIju9khh2pbjSEaglByd9lyH
r0stGAb0XCQqZPdZdSiXqZAsukYCamRmSTLLXTT+JOREsMKtFxsFfdNYiC6+Dtcr Du90CZENPVrnxUyKeqyhhbZnRBdVUjroEU1YopMAYup7gO3Pvd91gEu5ZWOtC010
yly/KCU92Ls8OFLmJ/rSuEVrX39LsCMF6K9n6OJsL5/4c3/DF7yyalsq82vT3H/f +lkCAwEAAaNjMGEwHQYDVR0OBBYEFBaq1o4bLUPzLbAkrTZlP7L6sSztMB8GA1Ud
L9CrBgz+A+eNguyEPch97ctqWzVIVQf7qngaAbuYRYvaiuMhV4YVIxdQG5y8Glmo IwQYMBaAFBaq1o4bLUPzLbAkrTZlP7L6sSztMA8GA1UdEwEB/wQFMAMBAf8wDgYD
Kq06fgEkg/ewYea9T9mRkKcquQw7q5UgHPB0zgK6FF3xkSVK VR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4IBAQCV3t+kFNuSIngavTGdHtcv
ChARXXRh6DDE8xXpMFT0uwwEeBNdLN2MkpDRnNDQGKOj/IwoWtSRTQjD9hrI3aYI
WOIVlfstLYqxMIC9mrbhLCA+3cTHVWXPKBf07tq+d3DVUtYVevutr/3VRZBa5jFC
14SzSVZq00fzv2hgiw/ir/Tj7BK54joWEU5Nc3mvR4VMdiaeizLAjsLcJ6bvrJOe
oV7PNEXgKsedTdfXN3KX+Fj5tjVI8dEKcn/9TXzpzNhIG0lSU95RAVM1vJDNjIrM
QyCnRf8rVbCLLf9VFUuE0MPTkJyUS1XVYuoiq2Jo3VPG3KXdmi2OeXwunORmgIwd
-----END CERTIFICATE----- -----END CERTIFICATE-----

View File

@ -1,57 +1,59 @@
Bag Attributes Certificate:
localKeyID: 01 00 00 00 Data:
Microsoft CSP Name: Microsoft Strong Cryptographic Provider Version: 3 (0x2)
friendlyName: PvkTmp:11e8b08d-46fb-45a2-90c4-d458be4a1276 Serial Number: 4098 (0x1002)
Key Attributes Signature Algorithm: sha256WithRSAEncryption
X509v3 Key Usage: 80 Issuer: C = CN, ST = SH, L = SH, O = TianoCore, OU = EDKII, CN = TestRoot, emailAddress = edkii@tianocore.org
-----BEGIN PRIVATE KEY----- Validity
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCfNn3oUo5iCBXg Not Before: Apr 10 08:33:45 2017 GMT
x1AUxgHG/h23/WyThgYj2NAToG3S51i0MGamyjGP8GbBphRc0ORpIhQE8Va+NPjW Not After : Apr 10 08:33:45 2018 GMT
cdoh4sXLOroW3Es26sR+cxdRwNF0/YxK/+JboYDmdUecgcwqipIv795bVQjRLCyT Subject: C = CN, ST = SH, O = TianoCore, OU = EDKII, CN = TestSub, emailAddress = edkii@tianocore.org
/+LjLXs/B3XM/jc4jHa7gs+AmwH2DXz9VTsIHmXrm/KGZ64VQzFbJYJl+KvFAmlm Subject Public Key Info:
LcL+t099lyiJYL+3LY2ajonzkAidVQylIfsmhAlcnGee6MYfPxLQRe4pIIlhyXAK Public Key Algorithm: rsaEncryption
ZixBnAlZvifo3JRwTKXRHzkj6Vp5KhDsi/31Y54iLJQHiet/FlymIHrtkFpC47xi Public-Key: (2048 bit)
ndF6jNpfAgMBAAECggEAD4owC9xS+A/gosnmxRWhLXJhet3fb8llvAX4zpGau+Uc Modulus:
wVRKu1OCNucOAISx+W/iJhN6GhQRlWByO+wXkGB5UcwaRwpFb8dxBQPoGMYAgQdm 00:c5:3a:af:16:34:9a:14:61:74:8c:39:1a:04:1f:
XsOkV7E8dZdTirEYjmZsElsP5vY2dW7MWGhiFYO7mHv6ltbmk5G83Qci3biYyRKB 7b:95:d3:40:b7:ea:26:a7:7b:8d:76:d3:86:1b:7c:
4Qb+q/1yl9tdqRvMnLshgSNSa2onGiJ8k9NniSnfnKCc4S0pliy2Z5HOPQCi2QAk 07:17:d2:56:72:36:13:b4:6c:75:b7:bf:d1:35:d1:
eVWORHz5jL8lzlVCflOL7VZiS13YORMDIj0S9LyMhXO4bAtsgWfldqOupNgNW0qI 31:d5:9a:07:c1:62:4e:aa:3d:bd:d8:40:8b:48:9a:
FwzrNvIXhQxeUiqylzfKNCzuBA11CFBnPt/+agv10QKBgQDH82PHMC3GH8Teq0lw c5:46:c4:c3:10:2c:d4:82:d9:6d:f4:c3:de:85:fa:
J5G+zYQol1ikRU7O116cAcV04P8HAiAmZ2lrP4DSJWD3y3sOjnnK54KmXkHVcNJI 34:1d:d1:74:7a:5f:16:34:59:2b:2b:03:61:46:62:
IDjb8d/BZjuYqdylfKhoKNgAdI1WcNKOz7KOK6Le8/ZK1uh1ZHMA6M+L9mTtQjhW d7:88:62:59:4d:d8:55:00:52:54:e1:15:5e:a9:ec:
DyoMvEGsQmNHnYF5n3zPQWUMFQKBgQDL17jZMLOORK2U+Iqu0cTVttGUjg/agP+r d6:e8:51:fd:ef:8e:68:5f:d2:40:d2:61:ef:2c:1d:
D4RWwA6BKI0vW3fFOka9MsjBpRZkZdXucq1TusDl8/J30FD/Cjp/gt9RwCQAvk44 5b:a7:6e:14:4c:12:bc:60:81:8e:66:c9:84:51:c2:
Zp6HU3TFEsBdXU+3XeJqTtyJqFuPkRQWrd0UeudSiEJammAlzyF7pPZioF1mucOA 89:51:fc:e5:7f:86:9a:78:a4:c1:f7:0f:a9:a5:97:
nCcDecLFowKBgBv1gKI9rmjh0FmCggZYwhx4CF7UquRtfJOXsfcGmGG7hG2qcmxs 60:dd:6f:c8:a0:fd:ea:07:2f:01:36:0a:e8:bd:0e:
UWVZv92itGhx34ctjQI+VRqGW5ZI7F6BgvHeZHdaoEK8ncnWIIZQD8QgiBLqO8cU dc:48:2e:85:22:7b:bb:db:68:78:eb:cd:6a:54:07:
a9dNarzaSDo2ytJ/dUVPSJY9oec7Nz1xaWPWfyhjMBa3g39KOd2RO1vxAoGBAMRD f7:81:a5:52:8f:f3:5c:09:1e:76:a3:d1:91:8f:ee:
Q9r6JSeJwId6diy0FAyhJVEfJux+36tYGVddO5nn7Wf3bW4cGhf4WYr45IJt+njH 86:2c:85:49:99:96:4f:5f:5b:0d:08:ae:d8:20:e8:
OVMwsKG3K3FoxVOKCaDT5SjVEtUUZkOvqlspY3iMAWLjgOlQH7uzimuQCfhE+06K e3:67:70:c6:ec:0e:0e:bd:bf:3c:f6:db:e4:45:d5:
wB4D581zHFAX6xL8R4TA4+k59jP+D9o4fue9yGZ5AoGAMn+TsY1IZFSY1fw6TTHq 7a:bb:9f:d1:3b:18:89:fc:63:ac:c2:30:b8:fa:bb:
sp9PiYQQqTMjRkzE7GRXbb1rdE6WoLkSk4Dz4u/B9E7YVzTZggYhPisChu6wZPtK 8a:24:63:4e:79:58:78:72:ab:27:36:3d:bb:4f:47:
IiXBGu8h3GygUGI/WdNRKHW5nst9IZWrtVJ06c87jWqOktbgBnrbqXUG1rgRZr+i d6:ef
n3sJLF+GGwzdp/gCxLMH66M= Exponent: 65537 (0x10001)
-----END PRIVATE KEY----- X509v3 extensions:
Bag Attributes X509v3 Subject Key Identifier:
localKeyID: 01 00 00 00 D6:9D:66:D6:49:7C:FA:20:8D:5D:75:69:2A:41:0A:7A:03:5A:A5:EB
subject=/CN=TestSub X509v3 Authority Key Identifier:
issuer=/CN=TestRoot keyid:16:AA:D6:8E:1B:2D:43:F3:2D:B0:24:AD:36:65:3F:B2:FA:B1:2C:ED
-----BEGIN CERTIFICATE-----
MIIDADCCAeygAwIBAgIQs4xkpm0/PYFLyLk1Nd0c0zAJBgUrDgMCHQUAMBMxETAP X509v3 Basic Constraints: critical
BgNVBAMTCFRlc3RSb290MB4XDTE2MDgwNDE1MDIwOVoXDTM5MTIzMTIzNTk1OVow CA:TRUE
EjEQMA4GA1UEAxMHVGVzdFN1YjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC X509v3 Key Usage: critical
ggEBAJ82fehSjmIIFeDHUBTGAcb+Hbf9bJOGBiPY0BOgbdLnWLQwZqbKMY/wZsGm Digital Signature, Certificate Sign, CRL Sign
FFzQ5GkiFATxVr40+NZx2iHixcs6uhbcSzbqxH5zF1HA0XT9jEr/4luhgOZ1R5yB Signature Algorithm: sha256WithRSAEncryption
zCqKki/v3ltVCNEsLJP/4uMtez8Hdcz+NziMdruCz4CbAfYNfP1VOwgeZeub8oZn 83:3c:ae:b2:fc:99:3d:33:b3:da:ca:26:83:8c:a9:ae:f8:bb:
rhVDMVslgmX4q8UCaWYtwv63T32XKIlgv7ctjZqOifOQCJ1VDKUh+yaECVycZ57o ad:05:37:97:a5:f8:0d:2b:4e:3e:e5:b7:12:68:f8:64:d4:bd:
xh8/EtBF7ikgiWHJcApmLEGcCVm+J+jclHBMpdEfOSPpWnkqEOyL/fVjniIslAeJ ff:65:7d:57:98:61:cd:47:10:a5:6a:bd:66:89:74:ce:5e:28:
638WXKYgeu2QWkLjvGKd0XqM2l8CAwEAAaNZMFcwDwYDVR0TAQH/BAUwAwEB/zBE 29:39:67:c9:1f:54:ec:78:76:b1:dd:04:91:63:b6:8c:2f:86:
BgNVHQEEPTA7gBDOtXrP5SHHa/PsktS/ZSo1oRUwEzERMA8GA1UEAxMIVGVzdFJv 59:1f:c4:2b:a1:4a:8c:a8:5b:f6:8a:92:f0:83:bb:92:92:5c:
b3SCEDQwJ38FPZWFQ6Ck9Qya58owCQYFKw4DAh0FAAOCAQEAFT8uXdMSHCmatVNg b1:1c:18:95:3d:d6:be:6d:79:9d:4f:7b:92:1f:68:f5:1f:cd:
LMKsyVA/jJgXGncHmAy59Vjo2+KCIooEuY3NaK527LxB1yi9+UyMe2+Ia4KWcEGY f4:37:2d:1e:e3:f6:eb:f2:8a:a4:8d:a1:c5:db:0c:3a:59:01:
+mb+PDTDrlsYtjIU3aRzDpyXUrkYV/D6vZaw+zsgAquQkCi+WwEYZ4uCSUznlcyt dc:be:a9:c1:0b:04:ba:e8:02:a9:85:cd:d7:48:0d:f6:60:30:
U3p2Rd/+tvQqq5UerPfRBIs6JTUerwRGUQurTNpzqCGClo3zi58yuOEbNIrOzW1D 2b:05:ba:e0:c7:d8:9f:23:14:37:04:0a:a7:bc:b6:c8:25:31:
MtQFKUtKkMx4rg6NT9kq/ICXt8k3UIsXh52NTYchkLlsnCgaoKzW2DFqSMFL3KC0 e4:9a:41:a5:83:c2:ee:89:d3:fa:a5:7c:ae:a6:14:22:a4:5f:
NmQtmKaPo3mBIYJT0WDofYzas2TQO8cBiQHGrSqXNFAfI5eUo3qLtsRE+7Z9F2Mw 73:03:f2:7b:3c:51:f7:76:2a:0a:cf:ee:71:35:1c:bc:ff:3f:
HgNmsA== 9b:d5:b1:33:e0:b6:fc:2a:c8:ab:84:89:cd:fa:1c:ee:12:8c:
-----END CERTIFICATE----- 07:ba:93:46:50:b3:3f:73:05:be:67:58:60:90:05:2c:d3:b6:
19:7c:a4:f0:6e:ee:d4:f2:0e:f5:02:79:5f:2c:28:83:1e:83:
c6:92:ba:7c

View File

@ -1,19 +1,23 @@
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIDADCCAeygAwIBAgIQs4xkpm0/PYFLyLk1Nd0c0zAJBgUrDgMCHQUAMBMxETAP MIID1jCCAr6gAwIBAgICEAIwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAkNO
BgNVBAMTCFRlc3RSb290MB4XDTE2MDgwNDE1MDIwOVoXDTM5MTIzMTIzNTk1OVow MQswCQYDVQQIDAJTSDELMAkGA1UEBwwCU0gxEjAQBgNVBAoMCVRpYW5vQ29yZTEO
EjEQMA4GA1UEAxMHVGVzdFN1YjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC MAwGA1UECwwFRURLSUkxETAPBgNVBAMMCFRlc3RSb290MSIwIAYJKoZIhvcNAQkB
ggEBAJ82fehSjmIIFeDHUBTGAcb+Hbf9bJOGBiPY0BOgbdLnWLQwZqbKMY/wZsGm FhNlZGtpaUB0aWFub2NvcmUub3JnMB4XDTE3MDQxMDA4MzM0NVoXDTE4MDQxMDA4
FFzQ5GkiFATxVr40+NZx2iHixcs6uhbcSzbqxH5zF1HA0XT9jEr/4luhgOZ1R5yB MzM0NVowdDELMAkGA1UEBhMCQ04xCzAJBgNVBAgMAlNIMRIwEAYDVQQKDAlUaWFu
zCqKki/v3ltVCNEsLJP/4uMtez8Hdcz+NziMdruCz4CbAfYNfP1VOwgeZeub8oZn b0NvcmUxDjAMBgNVBAsMBUVES0lJMRAwDgYDVQQDDAdUZXN0U3ViMSIwIAYJKoZI
rhVDMVslgmX4q8UCaWYtwv63T32XKIlgv7ctjZqOifOQCJ1VDKUh+yaECVycZ57o hvcNAQkBFhNlZGtpaUB0aWFub2NvcmUub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOC
xh8/EtBF7ikgiWHJcApmLEGcCVm+J+jclHBMpdEfOSPpWnkqEOyL/fVjniIslAeJ AQ8AMIIBCgKCAQEAxTqvFjSaFGF0jDkaBB97ldNAt+omp3uNdtOGG3wHF9JWcjYT
638WXKYgeu2QWkLjvGKd0XqM2l8CAwEAAaNZMFcwDwYDVR0TAQH/BAUwAwEB/zBE tGx1t7/RNdEx1ZoHwWJOqj292ECLSJrFRsTDECzUgtlt9MPehfo0HdF0el8WNFkr
BgNVHQEEPTA7gBDOtXrP5SHHa/PsktS/ZSo1oRUwEzERMA8GA1UEAxMIVGVzdFJv KwNhRmLXiGJZTdhVAFJU4RVeqezW6FH9745oX9JA0mHvLB1bp24UTBK8YIGOZsmE
b3SCEDQwJ38FPZWFQ6Ck9Qya58owCQYFKw4DAh0FAAOCAQEAFT8uXdMSHCmatVNg UcKJUfzlf4aaeKTB9w+ppZdg3W/IoP3qBy8BNgrovQ7cSC6FInu722h4681qVAf3
LMKsyVA/jJgXGncHmAy59Vjo2+KCIooEuY3NaK527LxB1yi9+UyMe2+Ia4KWcEGY gaVSj/NcCR52o9GRj+6GLIVJmZZPX1sNCK7YIOjjZ3DG7A4Ovb889tvkRdV6u5/R
+mb+PDTDrlsYtjIU3aRzDpyXUrkYV/D6vZaw+zsgAquQkCi+WwEYZ4uCSUznlcyt OxiJ/GOswjC4+ruKJGNOeVh4cqsnNj27T0fW7wIDAQABo2MwYTAdBgNVHQ4EFgQU
U3p2Rd/+tvQqq5UerPfRBIs6JTUerwRGUQurTNpzqCGClo3zi58yuOEbNIrOzW1D 1p1m1kl8+iCNXXVpKkEKegNapeswHwYDVR0jBBgwFoAUFqrWjhstQ/MtsCStNmU/
MtQFKUtKkMx4rg6NT9kq/ICXt8k3UIsXh52NTYchkLlsnCgaoKzW2DFqSMFL3KC0 svqxLO0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcN
NmQtmKaPo3mBIYJT0WDofYzas2TQO8cBiQHGrSqXNFAfI5eUo3qLtsRE+7Z9F2Mw AQELBQADggEBAIM8rrL8mT0zs9rKJoOMqa74u60FN5el+A0rTj7ltxJo+GTUvf9l
HgNmsA== fVeYYc1HEKVqvWaJdM5eKCk5Z8kfVOx4drHdBJFjtowvhlkfxCuhSoyoW/aKkvCD
u5KSXLEcGJU91r5teZ1Pe5IfaPUfzfQ3LR7j9uvyiqSNocXbDDpZAdy+qcELBLro
AqmFzddIDfZgMCsFuuDH2J8jFDcECqe8tsglMeSaQaWDwu6J0/qlfK6mFCKkX3MD
8ns8Ufd2KgrP7nE1HLz/P5vVsTPgtvwqyKuEic36HO4SjAe6k0ZQsz9zBb5nWGCQ
BSzTthl8pPBu7tTyDvUCeV8sKIMeg8aSunw=
-----END CERTIFICATE----- -----END CERTIFICATE-----

View File

@ -64,6 +64,8 @@ if __name__ == '__main__':
try: try:
OpenSslPath = os.environ['OPENSSL_PATH'] OpenSslPath = os.environ['OPENSSL_PATH']
OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand) OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand)
if ' ' in OpenSslCommand:
OpenSslCommand = '"' + OpenSslCommand + '"'
except: except:
pass pass

View File

@ -85,6 +85,8 @@ if __name__ == '__main__':
try: try:
OpenSslPath = os.environ['OPENSSL_PATH'] OpenSslPath = os.environ['OPENSSL_PATH']
OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand) OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand)
if ' ' in OpenSslCommand:
OpenSslCommand = '"' + OpenSslCommand + '"'
except: except:
pass pass

View File

@ -2,7 +2,7 @@
# build a platform or a module # build a platform or a module
# #
# Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR>
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
# #
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -54,7 +54,7 @@ import Common.GlobalData as GlobalData
# Version and Copyright # Version and Copyright
VersionNumber = "0.60" + ' ' + gBUILD_VERSION VersionNumber = "0.60" + ' ' + gBUILD_VERSION
__version__ = "%prog Version " + VersionNumber __version__ = "%prog Version " + VersionNumber
__copyright__ = "Copyright (c) 2007 - 2016, Intel Corporation All rights reserved." __copyright__ = "Copyright (c) 2007 - 2017, Intel Corporation All rights reserved."
## standard targets of build command ## standard targets of build command
gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 'clean', 'cleanall', 'cleanlib', 'run'] gSupportedTarget = ['all', 'genc', 'genmake', 'modules', 'libraries', 'fds', 'clean', 'cleanall', 'cleanlib', 'run']
@ -989,7 +989,6 @@ class Build():
self.PostbuildScript = PostbuildList[0] self.PostbuildScript = PostbuildList[0]
self.Postbuild = ' '.join(PostbuildList) self.Postbuild = ' '.join(PostbuildList)
self.Postbuild += self.PassCommandOption(self.BuildTargetList, self.ArchList, self.ToolChainList) self.Postbuild += self.PassCommandOption(self.BuildTargetList, self.ArchList, self.ToolChainList)
#self.LanuchPostbuild()
else: else:
EdkLogger.error("Postbuild", POSTBUILD_ERROR, "the postbuild script %s is not exist.\n If you'd like to disable the Postbuild process, please use the format: -D POSTBUILD=\"\" " %(PostbuildList[0])) EdkLogger.error("Postbuild", POSTBUILD_ERROR, "the postbuild script %s is not exist.\n If you'd like to disable the Postbuild process, please use the format: -D POSTBUILD=\"\" " %(PostbuildList[0]))
@ -1040,7 +1039,7 @@ class Build():
Process = Popen(args, stdout=PIPE, stderr=PIPE) Process = Popen(args, stdout=PIPE, stderr=PIPE)
else: else:
args = ' && '.join((self.Prebuild, 'env > ' + PrebuildEnvFile)) args = ' && '.join((self.Prebuild, 'env > ' + PrebuildEnvFile))
Process = Popen(args, stdout=PIPE, stderr=PIPE, shell=True, executable="/bin/bash") Process = Popen(args, stdout=PIPE, stderr=PIPE, shell=True)
# launch two threads to read the STDOUT and STDERR # launch two threads to read the STDOUT and STDERR
EndOfProcedure = Event() EndOfProcedure = Event()
@ -1076,13 +1075,13 @@ class Build():
os.environ.update(dict(envs)) os.environ.update(dict(envs))
EdkLogger.info("\n- Prebuild Done -\n") EdkLogger.info("\n- Prebuild Done -\n")
def LanuchPostbuild(self): def LaunchPostbuild(self):
if self.Postbuild: if self.Postbuild:
EdkLogger.info("\n- Postbuild Start -\n") EdkLogger.info("\n- Postbuild Start -\n")
if sys.platform == "win32": if sys.platform == "win32":
Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE) Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE)
else: else:
Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE, shell=True, executable="/bin/bash") Process = Popen(self.Postbuild, stdout=PIPE, stderr=PIPE, shell=True)
# launch two threads to read the STDOUT and STDERR # launch two threads to read the STDOUT and STDERR
EndOfProcedure = Event() EndOfProcedure = Event()
EndOfProcedure.clear() EndOfProcedure.clear()
@ -2331,7 +2330,7 @@ def Main():
if ReturnCode == 0: if ReturnCode == 0:
try: try:
MyBuild.LanuchPostbuild() MyBuild.LaunchPostbuild()
Conclusion = "Done" Conclusion = "Done"
except: except:
Conclusion = "Failed" Conclusion = "Failed"

View File

@ -20,7 +20,7 @@
PACKAGE_NAME = CryptoPkg PACKAGE_NAME = CryptoPkg
PACKAGE_UNI_FILE = CryptoPkg.uni PACKAGE_UNI_FILE = CryptoPkg.uni
PACKAGE_GUID = 36470E80-36F2-4ba0-8CC8-937C7D9FF888 PACKAGE_GUID = 36470E80-36F2-4ba0-8CC8-937C7D9FF888
PACKAGE_VERSION = 0.96 PACKAGE_VERSION = 0.97
[Includes] [Includes]
Include Include

View File

@ -1,7 +1,7 @@
## @file ## @file
# Cryptographic Library Package for UEFI Security Implementation. # Cryptographic Library Package for UEFI Security Implementation.
# #
# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -20,7 +20,7 @@
[Defines] [Defines]
PLATFORM_NAME = CryptoPkg PLATFORM_NAME = CryptoPkg
PLATFORM_GUID = E1063286-6C8C-4c25-AEF0-67A9A5B6E6B6 PLATFORM_GUID = E1063286-6C8C-4c25-AEF0-67A9A5B6E6B6
PLATFORM_VERSION = 0.96 PLATFORM_VERSION = 0.97
DSC_SPECIFICATION = 0x00010005 DSC_SPECIFICATION = 0x00010005
OUTPUT_DIRECTORY = Build/CryptoPkg OUTPUT_DIRECTORY = Build/CryptoPkg
SUPPORTED_ARCHITECTURES = IA32|X64|IPF|ARM|AARCH64 SUPPORTED_ARCHITECTURES = IA32|X64|IPF|ARM|AARCH64

View File

@ -1790,7 +1790,7 @@ Arc4Init (
If Output is NULL, then return FALSE. If Output is NULL, then return FALSE.
If this interface is not supported, then return FALSE. If this interface is not supported, then return FALSE.
@param[in] Arc4Context Pointer to the ARC4 context. @param[in, out] Arc4Context Pointer to the ARC4 context.
@param[in] Input Pointer to the buffer containing the data to be encrypted. @param[in] Input Pointer to the buffer containing the data to be encrypted.
@param[in] InputSize Size of the Input buffer in bytes. @param[in] InputSize Size of the Input buffer in bytes.
@param[out] Output Pointer to a buffer that receives the ARC4 encryption output. @param[out] Output Pointer to a buffer that receives the ARC4 encryption output.
@ -1822,7 +1822,7 @@ Arc4Encrypt (
If Output is NULL, then return FALSE. If Output is NULL, then return FALSE.
If this interface is not supported, then return FALSE. If this interface is not supported, then return FALSE.
@param[in] Arc4Context Pointer to the ARC4 context. @param[in, out] Arc4Context Pointer to the ARC4 context.
@param[in] Input Pointer to the buffer containing the data to be decrypted. @param[in] Input Pointer to the buffer containing the data to be decrypted.
@param[in] InputSize Size of the Input buffer in bytes. @param[in] InputSize Size of the Input buffer in bytes.
@param[out] Output Pointer to a buffer that receives the ARC4 decryption output. @param[out] Output Pointer to a buffer that receives the ARC4 decryption output.
@ -2511,7 +2511,7 @@ Pkcs7Verify (
@retval TRUE The P7Data was correctly formatted for processing. @retval TRUE The P7Data was correctly formatted for processing.
@retval FALSE The P7Data was not correctly formatted for processing. @retval FALSE The P7Data was not correctly formatted for processing.
*/ **/
BOOLEAN BOOLEAN
EFIAPI EFIAPI
Pkcs7GetAttachedContent ( Pkcs7GetAttachedContent (

View File

@ -232,7 +232,9 @@ DhGenerateKey (
return FALSE; return FALSE;
} }
if (PublicKey != NULL) {
BN_bn2bin (DhPubKey, PublicKey); BN_bn2bin (DhPubKey, PublicKey);
}
*PublicKeySize = Size; *PublicKeySize = Size;
} }

View File

@ -558,7 +558,9 @@ Pkcs7GetCertificatesList (
} }
} }
CtxUntrusted = X509_STORE_CTX_get0_untrusted (CertCtx); CtxUntrusted = X509_STORE_CTX_get0_untrusted (CertCtx);
if (CtxUntrusted != NULL) {
(VOID)sk_X509_delete_ptr (CtxUntrusted, Signer); (VOID)sk_X509_delete_ptr (CtxUntrusted, Signer);
}
// //
// Build certificates stack chained from Signer's certificate. // Build certificates stack chained from Signer's certificate.
@ -711,8 +713,10 @@ _Error:
} }
sk_X509_free (Signers); sk_X509_free (Signers);
if (CertCtx != NULL) {
X509_STORE_CTX_cleanup (CertCtx); X509_STORE_CTX_cleanup (CertCtx);
X509_STORE_CTX_free (CertCtx); X509_STORE_CTX_free (CertCtx);
}
if (SingleCert != NULL) { if (SingleCert != NULL) {
free (SingleCert); free (SingleCert);
@ -925,7 +929,7 @@ _Exit:
@retval TRUE The P7Data was correctly formatted for processing. @retval TRUE The P7Data was correctly formatted for processing.
@retval FALSE The P7Data was not correctly formatted for processing. @retval FALSE The P7Data was not correctly formatted for processing.
*/ **/
BOOLEAN BOOLEAN
EFIAPI EFIAPI
Pkcs7GetAttachedContent ( Pkcs7GetAttachedContent (

View File

@ -7,7 +7,7 @@
# buffer overflow or integer overflow. # buffer overflow or integer overflow.
# #
# Note: MD4 Digest functions, SHA-384 Digest functions, SHA-512 Digest functions, # Note: MD4 Digest functions, SHA-384 Digest functions, SHA-512 Digest functions,
# HMAC-MD5 functions, HMAC-SHA1/SHA256 functions, TDES/ARC4 functions, RSA external # HMAC-MD5 functions, HMAC-SHA1 functions, TDES/ARC4 functions, RSA external
# functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and # functions, PKCS#7 SignedData sign functions, Diffie-Hellman functions, and
# authenticode signature verification functions are not supported in this instance. # authenticode signature verification functions are not supported in this instance.
# #
@ -46,7 +46,7 @@
Hash/CryptSha512Null.c Hash/CryptSha512Null.c
Hmac/CryptHmacMd5Null.c Hmac/CryptHmacMd5Null.c
Hmac/CryptHmacSha1Null.c Hmac/CryptHmacSha1Null.c
Hmac/CryptHmacSha256Null.c Hmac/CryptHmacSha256.c
Cipher/CryptAes.c Cipher/CryptAes.c
Cipher/CryptTdesNull.c Cipher/CryptTdesNull.c
Cipher/CryptArc4Null.c Cipher/CryptArc4Null.c

View File

@ -1,7 +1,7 @@
/** @file /** @file
This file contains all helper functions on the ATAPI command This file contains all helper functions on the ATAPI command
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -1053,7 +1053,7 @@ AtapiReadCapacity (
if (!EFI_ERROR (Status) && *SResult == SenseNoSenseKey) { if (!EFI_ERROR (Status) && *SResult == SenseNoSenseKey) {
if (IdeDev->Type == IdeCdRom) { if (IdeDev->Type == IdeCdRom) {
IdeDev->BlkIo.Media->LastBlock = (Data.LastLba3 << 24) | IdeDev->BlkIo.Media->LastBlock = ((UINT32) Data.LastLba3 << 24) |
(Data.LastLba2 << 16) | (Data.LastLba2 << 16) |
(Data.LastLba1 << 8) | (Data.LastLba1 << 8) |
Data.LastLba0; Data.LastLba0;
@ -1076,7 +1076,7 @@ AtapiReadCapacity (
IdeDev->BlkIo.Media->LastBlock = 0; IdeDev->BlkIo.Media->LastBlock = 0;
} else { } else {
IdeDev->BlkIo.Media->LastBlock = (FormatData.LastLba3 << 24) | IdeDev->BlkIo.Media->LastBlock = ((UINT32) FormatData.LastLba3 << 24) |
(FormatData.LastLba2 << 16) | (FormatData.LastLba2 << 16) |
(FormatData.LastLba1 << 8) | (FormatData.LastLba1 << 8) |
FormatData.LastLba0; FormatData.LastLba0;

View File

@ -2,7 +2,7 @@
Mde UEFI library API implementation. Mde UEFI library API implementation.
Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE
Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -474,7 +474,14 @@ InternalPrintGraphic (
} else if (FeaturePcdGet (PcdUgaConsumeSupport)) { } else if (FeaturePcdGet (PcdUgaConsumeSupport)) {
ASSERT (UgaDraw!= NULL); ASSERT (UgaDraw!= NULL);
Blt->Image.Bitmap = AllocateZeroPool (Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); //
// Ensure Width * Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow.
//
if (Blt->Width > DivU64x32 (MAX_UINTN, Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {
goto Error;
}
Blt->Image.Bitmap = AllocateZeroPool ((UINT32) Blt->Width * Blt->Height * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
ASSERT (Blt->Image.Bitmap != NULL); ASSERT (Blt->Image.Bitmap != NULL);
// //

View File

@ -1,7 +1,7 @@
/** @file /** @file
The application to show the Boot Manager Menu. The application to show the Boot Manager Menu.
Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -374,6 +374,7 @@ BootMenuSelectItem (
if (BootMenuData == NULL || WantSelectItem >= BootMenuData->ItemCount) { if (BootMenuData == NULL || WantSelectItem >= BootMenuData->ItemCount) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
ASSERT (BootMenuData->ItemCount != 0);
SavedAttribute = gST->ConOut->Mode->Attribute; SavedAttribute = gST->ConOut->Mode->Attribute;
RePaintItems = FALSE; RePaintItems = FALSE;
StartCol = BootMenuData->MenuScreen.StartCol; StartCol = BootMenuData->MenuScreen.StartCol;

View File

@ -18,22 +18,14 @@
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/PrintLib.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/SimpleFileSystem.h> #include <Protocol/SimpleFileSystem.h>
#include <Protocol/ShellParameters.h> #include <Protocol/ShellParameters.h>
#include <Protocol/Shell.h>
#include <Guid/FileInfo.h> #include <Guid/FileInfo.h>
#include <Guid/Gpt.h>
#define IS_HYPHEN(a) ((a) == L'-')
#define IS_NULL(a) ((a) == L'\0')
#define MAX_ARG_NUM 11
UINTN Argc; UINTN Argc;
CHAR16 **Argv; CHAR16 **Argv;
EFI_SHELL_PROTOCOL *mShellProtocol = NULL;
/** /**
@ -64,273 +56,29 @@ GetArg (
} }
/** /**
Return File System Volume containing this shell application. Get shell protocol.
@return File System Volume containing this shell application. @return Pointer to shell protocol.
**/ **/
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * EFI_SHELL_PROTOCOL *
GetMyVol ( GetShellProtocol (
VOID VOID
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
Status = gBS->HandleProtocol ( if (mShellProtocol == NULL) {
gImageHandle, Status = gBS->LocateProtocol (
&gEfiLoadedImageProtocolGuid, &gEfiShellProtocolGuid,
(VOID **)&LoadedImage
);
ASSERT_EFI_ERROR (Status);
Status = gBS->HandleProtocol (
LoadedImage->DeviceHandle,
&gEfiSimpleFileSystemProtocolGuid,
(VOID **)&Vol
);
if (!EFI_ERROR (Status)) {
return Vol;
}
return NULL;
}
/**
Read a file from this volume.
@param[in] Vol File System Volume
@param[in] FileName The file to be read.
@param[out] BufferSize The file buffer size
@param[out] Buffer The file buffer
@retval EFI_SUCCESS Read file successfully
@retval EFI_NOT_FOUND File not found
**/
EFI_STATUS
ReadFileFromVol (
IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol,
IN CHAR16 *FileName,
OUT UINTN *BufferSize,
OUT VOID **Buffer
)
{
EFI_STATUS Status;
EFI_FILE_HANDLE RootDir;
EFI_FILE_HANDLE Handle;
UINTN FileInfoSize;
EFI_FILE_INFO *FileInfo;
UINTN TempBufferSize;
VOID *TempBuffer;
//
// Open the root directory
//
Status = Vol->OpenVolume (Vol, &RootDir);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Open the file
//
Status = RootDir->Open (
RootDir,
&Handle,
FileName,
EFI_FILE_MODE_READ,
0
);
if (EFI_ERROR (Status)) {
RootDir->Close (RootDir);
return Status;
}
RootDir->Close (RootDir);
//
// Get the file information
//
FileInfoSize = sizeof(EFI_FILE_INFO) + 1024;
FileInfo = AllocateZeroPool (FileInfoSize);
if (FileInfo == NULL) {
Handle->Close (Handle);
return Status;
}
Status = Handle->GetInfo (
Handle,
&gEfiFileInfoGuid,
&FileInfoSize,
FileInfo
);
if (EFI_ERROR (Status)) {
Handle->Close (Handle);
gBS->FreePool (FileInfo);
return Status;
}
//
// Allocate buffer for the file data. The last CHAR16 is for L'\0'
//
TempBufferSize = (UINTN) FileInfo->FileSize + sizeof(CHAR16);
TempBuffer = AllocateZeroPool (TempBufferSize);
if (TempBuffer == NULL) {
Handle->Close (Handle);
gBS->FreePool (FileInfo);
return Status;
}
gBS->FreePool (FileInfo);
//
// Read the file data to the buffer
//
Status = Handle->Read (
Handle,
&TempBufferSize,
TempBuffer
);
if (EFI_ERROR (Status)) {
Handle->Close (Handle);
gBS->FreePool (TempBuffer);
return Status;
}
Handle->Close (Handle);
*BufferSize = TempBufferSize;
*Buffer = TempBuffer;
return EFI_SUCCESS;
}
/**
Read a file.
If ScanFs is FLASE, it will use this Vol as default Fs.
If ScanFs is TRUE, it will scan all FS and check the file.
If there is only one file match the name, it will be read.
If there is more than one file match the name, it will return Error.
@param[in,out] ThisVol File System Volume
@param[in] FileName The file to be read.
@param[out] BufferSize The file buffer size
@param[out] Buffer The file buffer
@param[in] ScanFs Need Scan all FS
@retval EFI_SUCCESS Read file successfully
@retval EFI_NOT_FOUND File not found
@retval EFI_NO_MAPPING There is duplicated files found
**/
EFI_STATUS
ReadFileToBufferEx (
IN OUT EFI_SIMPLE_FILE_SYSTEM_PROTOCOL **ThisVol,
IN CHAR16 *FileName,
OUT UINTN *BufferSize,
OUT VOID **Buffer,
IN BOOLEAN ScanFs
)
{
EFI_STATUS Status;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
UINTN TempBufferSize;
VOID *TempBuffer;
UINTN NoHandles;
EFI_HANDLE *HandleBuffer;
UINTN Index;
//
// Check parameters
//
if ((FileName == NULL) || (Buffer == NULL) || (ThisVol == NULL)) {
return EFI_INVALID_PARAMETER;
}
//
// not scan fs
//
if (!ScanFs) {
if (*ThisVol == NULL) {
*ThisVol = GetMyVol ();
if (*ThisVol == NULL) {
return EFI_INVALID_PARAMETER;
}
}
//
// Read file directly from Vol
//
return ReadFileFromVol (*ThisVol, FileName, BufferSize, Buffer);
}
//
// need scan fs
//
//
// Get all Vol handle
//
Status = gBS->LocateHandleBuffer (
ByProtocol,
&gEfiSimpleFileSystemProtocolGuid,
NULL, NULL,
&NoHandles, (VOID **) &mShellProtocol
&HandleBuffer
); );
if (EFI_ERROR (Status) && (NoHandles == 0)) { if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND; mShellProtocol = NULL;
}
//
// Walk through each Vol
//
*ThisVol = NULL;
*BufferSize = 0;
*Buffer = NULL;
for (Index = 0; Index < NoHandles; Index++) {
Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiSimpleFileSystemProtocolGuid,
(VOID **)&Vol
);
if (EFI_ERROR(Status)) {
continue;
}
Status = ReadFileFromVol (Vol, FileName, &TempBufferSize, &TempBuffer);
if (!EFI_ERROR (Status)) {
//
// Read file OK, check duplication
//
if (*ThisVol != NULL) {
//
// Find the duplicated file
//
gBS->FreePool (TempBuffer);
gBS->FreePool (*Buffer);
Print (L"Duplicated FileName found!\n");
return EFI_NO_MAPPING;
} else {
//
// Record value
//
*ThisVol = Vol;
*BufferSize = TempBufferSize;
*Buffer = TempBuffer;
}
} }
} }
// return mShellProtocol;
// Scan Fs done
//
if (*ThisVol == NULL) {
return EFI_NOT_FOUND;
}
//
// Done
//
return EFI_SUCCESS;
} }
/** /**
@ -341,7 +89,8 @@ ReadFileToBufferEx (
@param[out] Buffer The file buffer @param[out] Buffer The file buffer
@retval EFI_SUCCESS Read file successfully @retval EFI_SUCCESS Read file successfully
@retval EFI_NOT_FOUND File not found @retval EFI_NOT_FOUND Shell protocol or file not found
@retval others Read file failed
**/ **/
EFI_STATUS EFI_STATUS
ReadFileToBuffer ( ReadFileToBuffer (
@ -350,9 +99,64 @@ ReadFileToBuffer (
OUT VOID **Buffer OUT VOID **Buffer
) )
{ {
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol; EFI_STATUS Status;
Vol = NULL; EFI_SHELL_PROTOCOL *ShellProtocol;
return ReadFileToBufferEx(&Vol, FileName, BufferSize, Buffer, FALSE); SHELL_FILE_HANDLE Handle;
UINT64 FileSize;
UINTN TempBufferSize;
VOID *TempBuffer;
ShellProtocol = GetShellProtocol();
if (ShellProtocol == NULL) {
return EFI_NOT_FOUND;
}
//
// Open file by FileName.
//
Status = ShellProtocol->OpenFileByName (
FileName,
&Handle,
EFI_FILE_MODE_READ
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Get the file size.
//
Status = ShellProtocol->GetFileSize (Handle, &FileSize);
if (EFI_ERROR (Status)) {
ShellProtocol->CloseFile (Handle);
return Status;
}
TempBufferSize = (UINTN) FileSize;
TempBuffer = AllocateZeroPool (TempBufferSize);
if (TempBuffer == NULL) {
ShellProtocol->CloseFile (Handle);
return EFI_OUT_OF_RESOURCES;
}
//
// Read the file data to the buffer
//
Status = ShellProtocol->ReadFile (
Handle,
&TempBufferSize,
TempBuffer
);
if (EFI_ERROR (Status)) {
ShellProtocol->CloseFile (Handle);
return Status;
}
ShellProtocol->CloseFile (Handle);
*BufferSize = TempBufferSize;
*Buffer = TempBuffer;
return EFI_SUCCESS;
} }
/** /**
@ -363,6 +167,8 @@ ReadFileToBuffer (
@param[in] Buffer The file buffer @param[in] Buffer The file buffer
@retval EFI_SUCCESS Write file successfully @retval EFI_SUCCESS Write file successfully
@retval EFI_NOT_FOUND Shell protocol not found
@retval others Write file failed
**/ **/
EFI_STATUS EFI_STATUS
WriteFileFromBuffer ( WriteFileFromBuffer (
@ -372,79 +178,69 @@ WriteFileFromBuffer (
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
EFI_FILE_HANDLE RootDir; EFI_SHELL_PROTOCOL *ShellProtocol;
EFI_FILE_HANDLE Handle; SHELL_FILE_HANDLE Handle;
EFI_FILE_INFO *FileInfo;
UINTN TempBufferSize; UINTN TempBufferSize;
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Vol;
Vol = GetMyVol(); ShellProtocol = GetShellProtocol();
if (Vol == NULL) { if (ShellProtocol == NULL) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
// //
// Open the root directory // Open file by FileName.
// //
Status = Vol->OpenVolume (Vol, &RootDir); Status = ShellProtocol->OpenFileByName (
if (EFI_ERROR (Status)) {
return Status;
}
//
// Open the file
//
Status = RootDir->Open (
RootDir,
&Handle,
FileName, FileName,
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE| EFI_FILE_MODE_CREATE, &Handle,
0 EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
RootDir->Close (RootDir);
return Status; return Status;
} }
// //
// Delete file // Empty the file contents.
// //
Status = Handle->Delete(Handle); FileInfo = ShellProtocol->GetFileInfo (Handle);
if (EFI_ERROR(Status)) { if (FileInfo == NULL) {
return Status; ShellProtocol->CloseFile (Handle);
return EFI_DEVICE_ERROR;
} }
// //
// Open the file again // If the file size is already 0, then it has been empty.
// //
Status = RootDir->Open ( if (FileInfo->FileSize != 0) {
RootDir, //
&Handle, // Set the file size to 0.
FileName, //
EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE| EFI_FILE_MODE_CREATE, FileInfo->FileSize = 0;
0 Status = ShellProtocol->SetFileInfo (Handle, FileInfo);
);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
RootDir->Close (RootDir); FreePool (FileInfo);
ShellProtocol->CloseFile (Handle);
return Status; return Status;
} }
}
RootDir->Close (RootDir); FreePool (FileInfo);
// //
// Write the file data from the buffer // Write the file data from the buffer
// //
TempBufferSize = BufferSize; TempBufferSize = BufferSize;
Status = Handle->Write ( Status = ShellProtocol->WriteFile (
Handle, Handle,
&TempBufferSize, &TempBufferSize,
Buffer Buffer
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Handle->Close (Handle); ShellProtocol->CloseFile (Handle);
return Status; return Status;
} }
Handle->Close (Handle); ShellProtocol->CloseFile (Handle);
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -21,11 +21,7 @@
#include <Library/UefiRuntimeServicesTableLib.h> #include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiLib.h> #include <Library/UefiLib.h>
#include <Library/PrintLib.h> #include <Library/PrintLib.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/GraphicsOutput.h> #include <Protocol/GraphicsOutput.h>
#include <Guid/FileInfo.h>
#include <Guid/Gpt.h>
#include <Guid/GlobalVariable.h> #include <Guid/GlobalVariable.h>
#include <Guid/CapsuleReport.h> #include <Guid/CapsuleReport.h>
#include <Guid/SystemResourceTable.h> #include <Guid/SystemResourceTable.h>
@ -117,7 +113,8 @@ DumpEsrtData (
@param[out] Buffer The file buffer @param[out] Buffer The file buffer
@retval EFI_SUCCESS Read file successfully @retval EFI_SUCCESS Read file successfully
@retval EFI_NOT_FOUND File not found @retval EFI_NOT_FOUND Shell protocol or file not found
@retval others Read file failed
**/ **/
EFI_STATUS EFI_STATUS
ReadFileToBuffer ( ReadFileToBuffer (
@ -134,6 +131,8 @@ ReadFileToBuffer (
@param[in] Buffer The file buffer @param[in] Buffer The file buffer
@retval EFI_SUCCESS Write file successfully @retval EFI_SUCCESS Write file successfully
@retval EFI_NOT_FOUND Shell protocol not found
@retval others Write file failed
**/ **/
EFI_STATUS EFI_STATUS
WriteFileFromBuffer ( WriteFileFromBuffer (

View File

@ -4,7 +4,7 @@
# This application can trigger capsule update process. It can also # This application can trigger capsule update process. It can also
# generate capsule image, or dump capsule variable information. # generate capsule image, or dump capsule variable information.
# #
# Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at # which accompanies this distribution. The full text of the license may be found at
@ -40,8 +40,6 @@
MdeModulePkg/MdeModulePkg.dec MdeModulePkg/MdeModulePkg.dec
[Guids] [Guids]
gEfiFileInfoGuid ## CONSUMES ## GUID
gEfiPartTypeSystemPartGuid ## CONSUMES ## GUID
gEfiGlobalVariableGuid ## CONSUMES ## GUID gEfiGlobalVariableGuid ## CONSUMES ## GUID
gEfiCapsuleReportGuid ## CONSUMES ## GUID gEfiCapsuleReportGuid ## CONSUMES ## GUID
gEfiFmpCapsuleGuid ## CONSUMES ## GUID gEfiFmpCapsuleGuid ## CONSUMES ## GUID
@ -51,11 +49,10 @@
gEfiSystemResourceTableGuid ## CONSUMES ## GUID gEfiSystemResourceTableGuid ## CONSUMES ## GUID
[Protocols] [Protocols]
gEfiLoadedImageProtocolGuid ## CONSUMES
gEfiSimpleFileSystemProtocolGuid ## CONSUMES
gEfiGraphicsOutputProtocolGuid ## CONSUMES gEfiGraphicsOutputProtocolGuid ## CONSUMES
gEfiFirmwareManagementProtocolGuid ## CONSUMES gEfiFirmwareManagementProtocolGuid ## CONSUMES
gEfiShellParametersProtocolGuid ## CONSUMES gEfiShellParametersProtocolGuid ## CONSUMES
gEfiShellProtocolGuid ## CONSUMES
[LibraryClasses] [LibraryClasses]
BaseLib BaseLib

View File

@ -266,8 +266,8 @@ GetDriverNameString (
// //
// Method 1: Get the name string from image PDB // Method 1: Get the name string from image PDB
// //
if (ImageStruct->Header.Length > sizeof (SMM_CORE_IMAGE_DATABASE_STRUCTURE)) { if (ImageStruct->PdbStringOffset != 0) {
GetShortPdbFileName ((CHAR8 *) (ImageStruct + 1), mNameString); GetShortPdbFileName ((CHAR8 *) ((UINTN) ImageStruct + ImageStruct->PdbStringOffset), mNameString);
return mNameString; return mNameString;
} }
@ -348,15 +348,17 @@ DumpSmmLoadedImage(
if (ImageStruct->Header.Signature == SMM_CORE_IMAGE_DATABASE_SIGNATURE) { if (ImageStruct->Header.Signature == SMM_CORE_IMAGE_DATABASE_SIGNATURE) {
NameString = GetDriverNameString (ImageStruct); NameString = GetDriverNameString (ImageStruct);
Print(L" <Image Name=\"%a\"", NameString); Print(L" <Image Name=\"%a\"", NameString);
Print(L" Base=\"0x%x\" Size=\"0x%x\"", ImageStruct->ImageBase, ImageStruct->ImageSize); Print(L" Base=\"0x%lx\" Size=\"0x%lx\"", ImageStruct->ImageBase, ImageStruct->ImageSize);
if (ImageStruct->EntryPoint != 0) { if (ImageStruct->EntryPoint != 0) {
Print(L" EntryPoint=\"0x%x\"", ImageStruct->EntryPoint); Print(L" EntryPoint=\"0x%lx\"", ImageStruct->EntryPoint);
} }
Print(L" FvFile=\"%g\"", &ImageStruct->FileGuid); Print(L" FvFile=\"%g\"", &ImageStruct->FileGuid);
Print(L" RefId=\"0x%x\"", ImageStruct->ImageRef); Print(L" RefId=\"0x%x\"", ImageStruct->ImageRef);
Print(L">\n"); Print(L">\n");
if (ImageStruct->PdbStringOffset != 0) {
PdbString = (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset); PdbString = (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset);
Print(L" <Pdb>%a</Pdb>\n", PdbString); Print(L" <Pdb>%a</Pdb>\n", PdbString);
}
Print(L" </Image>\n"); Print(L" </Image>\n");
} }
@ -535,8 +537,10 @@ DumpSmiChildContext (
IN UINTN ContextSize IN UINTN ContextSize
) )
{ {
CHAR16 *Str;
if (CompareGuid (HandlerType, &gEfiSmmSwDispatch2ProtocolGuid)) { if (CompareGuid (HandlerType, &gEfiSmmSwDispatch2ProtocolGuid)) {
Print(L" SwSmi=\"0x%x\"", ((EFI_SMM_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue); Print(L" SwSmi=\"0x%lx\"", ((SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue);
} else if (CompareGuid (HandlerType, &gEfiSmmSxDispatch2ProtocolGuid)) { } else if (CompareGuid (HandlerType, &gEfiSmmSxDispatch2ProtocolGuid)) {
Print(L" SxType=\"%a\"", SxTypeToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Type)); Print(L" SxType=\"%a\"", SxTypeToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Type));
Print(L" SxPhase=\"%a\"", SxPhaseToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Phase)); Print(L" SxPhase=\"%a\"", SxPhaseToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Phase));
@ -555,7 +559,11 @@ DumpSmiChildContext (
Print(L" IoTrapType=\"%a\"", IoTrapTypeToString(((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Type)); Print(L" IoTrapType=\"%a\"", IoTrapTypeToString(((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Type));
} else if (CompareGuid (HandlerType, &gEfiSmmUsbDispatch2ProtocolGuid)) { } else if (CompareGuid (HandlerType, &gEfiSmmUsbDispatch2ProtocolGuid)) {
Print(L" UsbType=\"0x%x\"", UsbTypeToString(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context)->Type)); Print(L" UsbType=\"0x%x\"", UsbTypeToString(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context)->Type));
Print(L" UsbDevicePath=\"%s\"", ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE)); Str = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE);
Print(L" UsbDevicePath=\"%s\"", Str);
if (Str != NULL) {
FreePool (Str);
}
} else { } else {
Print(L" Context=\""); Print(L" Context=\"");
InternalDumpData (Context, ContextSize); InternalDumpData (Context, ContextSize);
@ -601,14 +609,14 @@ DumpSmiHandler(
Print(L" <Pdb>%a</Pdb>\n", (UINT8 *)ImageStruct + ImageStruct->PdbStringOffset); Print(L" <Pdb>%a</Pdb>\n", (UINT8 *)ImageStruct + ImageStruct->PdbStringOffset);
} }
Print(L" </Module>\n"); Print(L" </Module>\n");
Print(L" <Handler Address=\"0x%x\">\n", SmiHandlerStruct->Handler); Print(L" <Handler Address=\"0x%lx\">\n", SmiHandlerStruct->Handler);
if (ImageStruct != NULL) { if (ImageStruct != NULL) {
Print(L" <RVA>0x%x</RVA>\n", SmiHandlerStruct->Handler - ImageStruct->ImageBase); Print(L" <RVA>0x%x</RVA>\n", (UINTN) (SmiHandlerStruct->Handler - ImageStruct->ImageBase));
} }
Print(L" </Handler>\n", SmiHandlerStruct->Handler); Print(L" </Handler>\n", SmiHandlerStruct->Handler);
Print(L" <Caller Address=\"0x%x\">\n", SmiHandlerStruct->CallerAddr); Print(L" <Caller Address=\"0x%lx\">\n", SmiHandlerStruct->CallerAddr);
if (ImageStruct != NULL) { if (ImageStruct != NULL) {
Print(L" <RVA>0x%x</RVA>\n", SmiHandlerStruct->CallerAddr - ImageStruct->ImageBase); Print(L" <RVA>0x%x</RVA>\n", (UINTN) (SmiHandlerStruct->CallerAddr - ImageStruct->ImageBase));
} }
Print(L" </Caller>\n", SmiHandlerStruct->Handler); Print(L" </Caller>\n", SmiHandlerStruct->Handler);
SmiHandlerStruct = (VOID *)((UINTN)SmiHandlerStruct + SmiHandlerStruct->Length); SmiHandlerStruct = (VOID *)((UINTN)SmiHandlerStruct + SmiHandlerStruct->Length);

View File

@ -2140,7 +2140,7 @@ ReadCapacity (
if (MediaInfo->DeviceType == IdeCDROM) { if (MediaInfo->DeviceType == IdeCDROM) {
MediaInfo->LastBlock = (Data.LastLba3 << 24) | (Data.LastLba2 << 16) | (Data.LastLba1 << 8) | Data.LastLba0; MediaInfo->LastBlock = ((UINT32) Data.LastLba3 << 24) | (Data.LastLba2 << 16) | (Data.LastLba1 << 8) | Data.LastLba0;
MediaInfo->MediaPresent = TRUE; MediaInfo->MediaPresent = TRUE;
// //
// Because the user data portion in the sector of the Data CD supported // Because the user data portion in the sector of the Data CD supported
@ -2161,7 +2161,7 @@ ReadCapacity (
MediaInfo2->MediaPresent = FALSE; MediaInfo2->MediaPresent = FALSE;
MediaInfo2->LastBlock = 0; MediaInfo2->LastBlock = 0;
} else { } else {
MediaInfo->LastBlock = (FormatData.LastLba3 << 24) | MediaInfo->LastBlock = ((UINT32) FormatData.LastLba3 << 24) |
(FormatData.LastLba2 << 16) | (FormatData.LastLba2 << 16) |
(FormatData.LastLba1 << 8) | (FormatData.LastLba1 << 8) |
FormatData.LastLba0; FormatData.LastLba0;

View File

@ -603,7 +603,7 @@ NvmExpressPassThru (
Private->SqTdbl[QueueId].Sqt ^= 1; Private->SqTdbl[QueueId].Sqt ^= 1;
} }
Data = ReadUnaligned32 ((UINT32*)&Private->SqTdbl[QueueId]); Data = ReadUnaligned32 ((UINT32*)&Private->SqTdbl[QueueId]);
PciIo->Mem.Write ( Status = PciIo->Mem.Write (
PciIo, PciIo,
EfiPciIoWidthUint32, EfiPciIoWidthUint32,
NVME_BAR, NVME_BAR,
@ -612,6 +612,10 @@ NvmExpressPassThru (
&Data &Data
); );
if (EFI_ERROR (Status)) {
goto EXIT;
}
// //
// For non-blocking requests, return directly if the command is placed // For non-blocking requests, return directly if the command is placed
// in the submission queue. // in the submission queue.
@ -695,7 +699,7 @@ NvmExpressPassThru (
} }
Data = ReadUnaligned32 ((UINT32*)&Private->CqHdbl[QueueId]); Data = ReadUnaligned32 ((UINT32*)&Private->CqHdbl[QueueId]);
PciIo->Mem.Write ( Status = PciIo->Mem.Write (
PciIo, PciIo,
EfiPciIoWidthUint32, EfiPciIoWidthUint32,
NVME_BAR, NVME_BAR,

View File

@ -2,7 +2,7 @@
UfsHcDxe driver is used to provide platform-dependent info, mainly UFS host controller UfsHcDxe driver is used to provide platform-dependent info, mainly UFS host controller
MMIO base, to upper layer UFS drivers. MMIO base, to upper layer UFS drivers.
Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -32,7 +32,6 @@ EFI_DRIVER_BINDING_PROTOCOL gUfsHcDriverBinding = {
// //
UFS_HOST_CONTROLLER_PRIVATE_DATA gUfsHcTemplate = { UFS_HOST_CONTROLLER_PRIVATE_DATA gUfsHcTemplate = {
UFS_HC_PRIVATE_DATA_SIGNATURE, // Signature UFS_HC_PRIVATE_DATA_SIGNATURE, // Signature
NULL, // Handle
{ // UfsHcProtocol { // UfsHcProtocol
UfsHcGetMmioBar, UfsHcGetMmioBar,
UfsHcAllocateBuffer, UfsHcAllocateBuffer,
@ -672,13 +671,12 @@ Done:
// //
// Restore original PCI attributes // Restore original PCI attributes
// //
Status = PciIo->Attributes ( PciIo->Attributes (
PciIo, PciIo,
EfiPciIoAttributeOperationSet, EfiPciIoAttributeOperationSet,
Private->PciAttributes, Private->PciAttributes,
NULL NULL
); );
ASSERT_EFI_ERROR (Status);
} }
gBS->CloseProtocol ( gBS->CloseProtocol (
Controller, Controller,

View File

@ -2,7 +2,7 @@
UfsHcDxe driver is used to provide platform-dependent info, mainly UFS host controller UfsHcDxe driver is used to provide platform-dependent info, mainly UFS host controller
MMIO base, to upper layer UFS drivers. MMIO base, to upper layer UFS drivers.
Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -49,11 +49,10 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gUfsHcComponentName2;
typedef struct _UFS_HOST_CONTROLLER_PRIVATE_DATA UFS_HOST_CONTROLLER_PRIVATE_DATA; typedef struct _UFS_HOST_CONTROLLER_PRIVATE_DATA UFS_HOST_CONTROLLER_PRIVATE_DATA;
// //
// Nvme private data structure. // Ufs host controller private data structure.
// //
struct _UFS_HOST_CONTROLLER_PRIVATE_DATA { struct _UFS_HOST_CONTROLLER_PRIVATE_DATA {
UINT32 Signature; UINT32 Signature;
EFI_HANDLE Handle;
EDKII_UFS_HOST_CONTROLLER_PROTOCOL UfsHc; EDKII_UFS_HOST_CONTROLLER_PROTOCOL UfsHc;
EFI_PCI_IO_PROTOCOL *PciIo; EFI_PCI_IO_PROTOCOL *PciIo;

View File

@ -1319,6 +1319,7 @@ XhciDelAsyncIntTransfer (
LIST_ENTRY *Next; LIST_ENTRY *Next;
URB *Urb; URB *Urb;
EFI_USB_DATA_DIRECTION Direction; EFI_USB_DATA_DIRECTION Direction;
EFI_STATUS Status;
Direction = ((EpNum & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut; Direction = ((EpNum & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut;
EpNum &= 0x0F; EpNum &= 0x0F;
@ -1330,6 +1331,15 @@ XhciDelAsyncIntTransfer (
if ((Urb->Ep.BusAddr == BusAddr) && if ((Urb->Ep.BusAddr == BusAddr) &&
(Urb->Ep.EpAddr == EpNum) && (Urb->Ep.EpAddr == EpNum) &&
(Urb->Ep.Direction == Direction)) { (Urb->Ep.Direction == Direction)) {
//
// Device doesn't finish the IntTransfer until real data comes
// So the TRB should be removed as well.
//
Status = XhcDequeueTrbFromEndpoint (Xhc, Urb);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "XhciDelAsyncIntTransfer: XhcDequeueTrbFromEndpoint failed\n"));
}
RemoveEntryList (&Urb->UrbList); RemoveEntryList (&Urb->UrbList);
FreePool (Urb->Data); FreePool (Urb->Data);
XhcFreeUrb (Xhc, Urb); XhcFreeUrb (Xhc, Urb);
@ -1354,9 +1364,20 @@ XhciDelAllAsyncIntTransfers (
LIST_ENTRY *Entry; LIST_ENTRY *Entry;
LIST_ENTRY *Next; LIST_ENTRY *Next;
URB *Urb; URB *Urb;
EFI_STATUS Status;
EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) { EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList); Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
//
// Device doesn't finish the IntTransfer until real data comes
// So the TRB should be removed as well.
//
Status = XhcDequeueTrbFromEndpoint (Xhc, Urb);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "XhciDelAllAsyncIntTransfers: XhcDequeueTrbFromEndpoint failed\n"));
}
RemoveEntryList (&Urb->UrbList); RemoveEntryList (&Urb->UrbList);
FreePool (Urb->Data); FreePool (Urb->Data);
XhcFreeUrb (Xhc, Urb); XhcFreeUrb (Xhc, Urb);

View File

@ -1,7 +1,7 @@
/** @file /** @file
SCSI disk driver that layers on every SCSI IO protocol in the system. SCSI disk driver that layers on every SCSI IO protocol in the system.
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -2754,7 +2754,7 @@ GetMediaInfo (
UINT8 *Ptr; UINT8 *Ptr;
if (!ScsiDiskDevice->Cdb16Byte) { if (!ScsiDiskDevice->Cdb16Byte) {
ScsiDiskDevice->BlkIo.Media->LastBlock = (Capacity10->LastLba3 << 24) | ScsiDiskDevice->BlkIo.Media->LastBlock = ((UINT32) Capacity10->LastLba3 << 24) |
(Capacity10->LastLba2 << 16) | (Capacity10->LastLba2 << 16) |
(Capacity10->LastLba1 << 8) | (Capacity10->LastLba1 << 8) |
Capacity10->LastLba0; Capacity10->LastLba0;

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -737,11 +737,11 @@ UfsBlockIoPeimGetMediaInfo (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
} }
Private->Media[DeviceIndex].LastBlock = (Capacity16.LastLba3 << 24) | (Capacity16.LastLba2 << 16) | (Capacity16.LastLba1 << 8) | Capacity16.LastLba0; Private->Media[DeviceIndex].LastBlock = ((UINT32)Capacity16.LastLba3 << 24) | (Capacity16.LastLba2 << 16) | (Capacity16.LastLba1 << 8) | Capacity16.LastLba0;
Private->Media[DeviceIndex].LastBlock |= LShiftU64 ((UINT64)Capacity16.LastLba7, 56) | LShiftU64((UINT64)Capacity16.LastLba6, 48) | LShiftU64 ((UINT64)Capacity16.LastLba5, 40) | LShiftU64 ((UINT64)Capacity16.LastLba4, 32); Private->Media[DeviceIndex].LastBlock |= LShiftU64 ((UINT64)Capacity16.LastLba7, 56) | LShiftU64((UINT64)Capacity16.LastLba6, 48) | LShiftU64 ((UINT64)Capacity16.LastLba5, 40) | LShiftU64 ((UINT64)Capacity16.LastLba4, 32);
Private->Media[DeviceIndex].BlockSize = (Capacity16.BlockSize3 << 24) | (Capacity16.BlockSize2 << 16) | (Capacity16.BlockSize1 << 8) | Capacity16.BlockSize0; Private->Media[DeviceIndex].BlockSize = (Capacity16.BlockSize3 << 24) | (Capacity16.BlockSize2 << 16) | (Capacity16.BlockSize1 << 8) | Capacity16.BlockSize0;
} else { } else {
Private->Media[DeviceIndex].LastBlock = (Capacity.LastLba3 << 24) | (Capacity.LastLba2 << 16) | (Capacity.LastLba1 << 8) | Capacity.LastLba0; Private->Media[DeviceIndex].LastBlock = ((UINT32)Capacity.LastLba3 << 24) | (Capacity.LastLba2 << 16) | (Capacity.LastLba1 << 8) | Capacity.LastLba0;
Private->Media[DeviceIndex].BlockSize = (Capacity.BlockSize3 << 24) | (Capacity.BlockSize2 << 16) | (Capacity.BlockSize1 << 8) | Capacity.BlockSize0; Private->Media[DeviceIndex].BlockSize = (Capacity.BlockSize3 << 24) | (Capacity.BlockSize2 << 16) | (Capacity.BlockSize1 << 8) | Capacity.BlockSize0;
} }

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -479,10 +479,10 @@ UfsPassThruGetTargetLun (
} }
// //
// Check whether the DevicePath belongs to SCSI_DEVICE_PATH // Check whether the DevicePath belongs to UFS_DEVICE_PATH
// //
if ((DevicePath->Type != MESSAGING_DEVICE_PATH) || (DevicePath->SubType != MSG_UFS_DP) || if ((DevicePath->Type != MESSAGING_DEVICE_PATH) || (DevicePath->SubType != MSG_UFS_DP) ||
(DevicePathNodeLength(DevicePath) != sizeof(SCSI_DEVICE_PATH))) { (DevicePathNodeLength(DevicePath) != sizeof(UFS_DEVICE_PATH))) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -729,6 +729,48 @@ UfsPassThruDriverBindingSupported (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Finishes device initialization by setting fDeviceInit flag and waiting untill device responds by
clearing it.
@param[in] Private Pointer to the UFS_PASS_THRU_PRIVATE_DATA.
@retval EFI_SUCCESS The operation succeeds.
@retval Others The operation fails.
**/
EFI_STATUS
UfsFinishDeviceInitialization (
IN UFS_PASS_THRU_PRIVATE_DATA *Private
)
{
EFI_STATUS Status;
UINT8 DeviceInitStatus;
UINT8 Timeout;
DeviceInitStatus = 0xFF;
//
// The host enables the device initialization completion by setting fDeviceInit flag.
//
Status = UfsSetFlag (Private, UfsFlagDevInit);
if (EFI_ERROR (Status)) {
return Status;
}
Timeout = 5;
do {
Status = UfsReadFlag (Private, UfsFlagDevInit, &DeviceInitStatus);
if (EFI_ERROR (Status)) {
return Status;
}
MicroSecondDelay (1);
Timeout--;
} while (DeviceInitStatus != 0 && Timeout != 0);
return EFI_SUCCESS;
}
/** /**
Starts a device controller or a bus controller. Starts a device controller or a bus controller.
@ -777,14 +819,14 @@ UfsPassThruDriverBindingStart (
UFS_PASS_THRU_PRIVATE_DATA *Private; UFS_PASS_THRU_PRIVATE_DATA *Private;
UINTN UfsHcBase; UINTN UfsHcBase;
UINT32 Index; UINT32 Index;
UFS_CONFIG_DESC Config; UFS_UNIT_DESC UnitDescriptor;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
UfsHc = NULL; UfsHc = NULL;
Private = NULL; Private = NULL;
UfsHcBase = 0; UfsHcBase = 0;
DEBUG ((EFI_D_INFO, "==UfsPassThru Start== Controller = %x\n", Controller)); DEBUG ((DEBUG_INFO, "==UfsPassThru Start== Controller = %x\n", Controller));
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
Controller, Controller,
@ -796,7 +838,7 @@ UfsPassThruDriverBindingStart (
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Open Ufs Host Controller Protocol Error, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "Open Ufs Host Controller Protocol Error, Status = %r\n", Status));
goto Error; goto Error;
} }
@ -805,7 +847,7 @@ UfsPassThruDriverBindingStart (
// //
Status = UfsHc->GetUfsHcMmioBar (UfsHc, &UfsHcBase); Status = UfsHc->GetUfsHcMmioBar (UfsHc, &UfsHcBase);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Get Ufs Host Controller Mmio Bar Error, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "Get Ufs Host Controller Mmio Bar Error, Status = %r\n", Status));
goto Error; goto Error;
} }
@ -814,7 +856,7 @@ UfsPassThruDriverBindingStart (
// //
Private = AllocateCopyPool (sizeof (UFS_PASS_THRU_PRIVATE_DATA), &gUfsPassThruTemplate); Private = AllocateCopyPool (sizeof (UFS_PASS_THRU_PRIVATE_DATA), &gUfsPassThruTemplate);
if (Private == NULL) { if (Private == NULL) {
DEBUG ((EFI_D_ERROR, "Unable to allocate Ufs Pass Thru private data\n")); DEBUG ((DEBUG_ERROR, "Unable to allocate Ufs Pass Thru private data\n"));
Status = EFI_OUT_OF_RESOURCES; Status = EFI_OUT_OF_RESOURCES;
goto Error; goto Error;
} }
@ -829,7 +871,7 @@ UfsPassThruDriverBindingStart (
// //
Status = UfsControllerInit (Private); Status = UfsControllerInit (Private);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Ufs Host Controller Initialization Error, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "Ufs Host Controller Initialization Error, Status = %r\n", Status));
goto Error; goto Error;
} }
@ -840,25 +882,13 @@ UfsPassThruDriverBindingStart (
// //
Status = UfsExecNopCmds (Private); Status = UfsExecNopCmds (Private);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Ufs Sending NOP IN command Error, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "Ufs Sending NOP IN command Error, Status = %r\n", Status));
goto Error; goto Error;
} }
// Status = UfsFinishDeviceInitialization (Private);
// The host enables the device initialization completion by setting fDeviceInit flag.
//
Status = UfsSetFlag (Private, UfsFlagDevInit);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Ufs Set fDeviceInit Flag Error, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "Device failed to finish initialization, Status = %r\n", Status));
goto Error;
}
//
// Get Ufs Device's Lun Info by reading Configuration Descriptor.
//
Status = UfsRwDeviceDesc (Private, TRUE, UfsConfigDesc, 0, 0, &Config, sizeof (UFS_CONFIG_DESC));
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Ufs Get Configuration Descriptor Error, Status = %r\n", Status));
goto Error; goto Error;
} }
@ -867,9 +897,14 @@ UfsPassThruDriverBindingStart (
// TODO: Parse device descriptor to decide if exposing RPMB LUN to upper layer for authentication access. // TODO: Parse device descriptor to decide if exposing RPMB LUN to upper layer for authentication access.
// //
for (Index = 0; Index < 8; Index++) { for (Index = 0; Index < 8; Index++) {
if (Config.UnitDescConfParams[Index].LunEn != 0) { Status = UfsRwDeviceDesc (Private, TRUE, UfsUnitDesc, (UINT8) Index, 0, &UnitDescriptor, sizeof (UFS_UNIT_DESC));
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to read unit descriptor, index = %X, status = %r\n", Index, Status));
continue;
}
if (UnitDescriptor.LunEn == 0x1) {
DEBUG ((DEBUG_INFO, "UFS LUN %X is enabled\n", Index));
Private->Luns.BitMask |= (BIT0 << Index); Private->Luns.BitMask |= (BIT0 << Index);
DEBUG ((EFI_D_INFO, "Ufs Lun %d is enabled\n", Index));
} }
} }
@ -884,7 +919,7 @@ UfsPassThruDriverBindingStart (
&Private->TimerEvent &Private->TimerEvent
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Ufs Create Async Tasks Event Error, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "Ufs Create Async Tasks Event Error, Status = %r\n", Status));
goto Error; goto Error;
} }
@ -894,7 +929,7 @@ UfsPassThruDriverBindingStart (
UFS_HC_ASYNC_TIMER UFS_HC_ASYNC_TIMER
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Ufs Set Periodic Timer Error, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "Ufs Set Periodic Timer Error, Status = %r\n", Status));
goto Error; goto Error;
} }
@ -986,7 +1021,7 @@ UfsPassThruDriverBindingStop (
LIST_ENTRY *Entry; LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry; LIST_ENTRY *NextEntry;
DEBUG ((EFI_D_INFO, "==UfsPassThru Stop== Controller Controller = %x\n", Controller)); DEBUG ((DEBUG_INFO, "==UfsPassThru Stop== Controller Controller = %x\n", Controller));
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
Controller, Controller,

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -122,16 +122,13 @@ typedef struct {
typedef struct _UFS_DEVICE_MANAGEMENT_REQUEST_PACKET { typedef struct _UFS_DEVICE_MANAGEMENT_REQUEST_PACKET {
UINT64 Timeout; UINT64 Timeout;
VOID *InDataBuffer; VOID *DataBuffer;
VOID *OutDataBuffer;
UINT8 Opcode; UINT8 Opcode;
UINT8 DescId; UINT8 DescId;
UINT8 Index; UINT8 Index;
UINT8 Selector; UINT8 Selector;
UINT32 InTransferLength; UINT32 TransferLength;
UINT32 OutTransferLength;
UINT8 DataDirection; UINT8 DataDirection;
UINT8 Ocs;
} UFS_DEVICE_MANAGEMENT_REQUEST_PACKET; } UFS_DEVICE_MANAGEMENT_REQUEST_PACKET;
// //
@ -716,6 +713,25 @@ UfsSetFlag (
IN UINT8 FlagId IN UINT8 FlagId
); );
/**
Read specified flag from a UFS device.
@param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.
@param[in] FlagId The ID of flag to be read.
@param[out] Value The flag's value.
@retval EFI_SUCCESS The flag was read successfully.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to read the flag.
@retval EFI_TIMEOUT A timeout occurred while waiting for the completion of reading the flag.
**/
EFI_STATUS
UfsReadFlag (
IN UFS_PASS_THRU_PRIVATE_DATA *Private,
IN UINT8 FlagId,
OUT UINT8 *Value
);
/** /**
Read or write specified device descriptor of a UFS device. Read or write specified device descriptor of a UFS device.
@ -743,6 +759,31 @@ UfsRwDeviceDesc (
IN UINT32 DescSize IN UINT32 DescSize
); );
/**
Read or write specified attribute of a UFS device.
@param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.
@param[in] Read The boolean variable to show r/w direction.
@param[in] AttrId The ID of Attribute.
@param[in] Index The Index of Attribute.
@param[in] Selector The Selector of Attribute.
@param[in, out] Attributes The value of Attribute to be read or written.
@retval EFI_SUCCESS The Attribute was read/written successfully.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to r/w the Attribute.
@retval EFI_TIMEOUT A timeout occurred while waiting for the completion of r/w the Attribute.
**/
EFI_STATUS
UfsRwAttributes (
IN UFS_PASS_THRU_PRIVATE_DATA *Private,
IN BOOLEAN Read,
IN UINT8 AttrId,
IN UINT8 Index,
IN UINT8 Selector,
IN OUT UINT32 *Attributes
);
/** /**
Sends NOP IN cmd to a UFS device for initialization process request. Sends NOP IN cmd to a UFS device for initialization process request.
For more details, please refer to UFS 2.0 spec Figure 13.3. For more details, please refer to UFS 2.0 spec Figure 13.3.

View File

@ -157,34 +157,34 @@ DumpUicCmdExecResult (
case 0x00: case 0x00:
break; break;
case 0x01: case 0x01:
DEBUG ((EFI_D_VERBOSE, "UIC configuration command fails - INVALID_MIB_ATTRIBUTE\n")); DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - INVALID_MIB_ATTRIBUTE\n"));
break; break;
case 0x02: case 0x02:
DEBUG ((EFI_D_VERBOSE, "UIC configuration command fails - INVALID_MIB_ATTRIBUTE_VALUE\n")); DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - INVALID_MIB_ATTRIBUTE_VALUE\n"));
break; break;
case 0x03: case 0x03:
DEBUG ((EFI_D_VERBOSE, "UIC configuration command fails - READ_ONLY_MIB_ATTRIBUTE\n")); DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - READ_ONLY_MIB_ATTRIBUTE\n"));
break; break;
case 0x04: case 0x04:
DEBUG ((EFI_D_VERBOSE, "UIC configuration command fails - WRITE_ONLY_MIB_ATTRIBUTE\n")); DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - WRITE_ONLY_MIB_ATTRIBUTE\n"));
break; break;
case 0x05: case 0x05:
DEBUG ((EFI_D_VERBOSE, "UIC configuration command fails - BAD_INDEX\n")); DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - BAD_INDEX\n"));
break; break;
case 0x06: case 0x06:
DEBUG ((EFI_D_VERBOSE, "UIC configuration command fails - LOCKED_MIB_ATTRIBUTE\n")); DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - LOCKED_MIB_ATTRIBUTE\n"));
break; break;
case 0x07: case 0x07:
DEBUG ((EFI_D_VERBOSE, "UIC configuration command fails - BAD_TEST_FEATURE_INDEX\n")); DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - BAD_TEST_FEATURE_INDEX\n"));
break; break;
case 0x08: case 0x08:
DEBUG ((EFI_D_VERBOSE, "UIC configuration command fails - PEER_COMMUNICATION_FAILURE\n")); DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - PEER_COMMUNICATION_FAILURE\n"));
break; break;
case 0x09: case 0x09:
DEBUG ((EFI_D_VERBOSE, "UIC configuration command fails - BUSY\n")); DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - BUSY\n"));
break; break;
case 0x0A: case 0x0A:
DEBUG ((EFI_D_VERBOSE, "UIC configuration command fails - DME_FAILURE\n")); DEBUG ((DEBUG_VERBOSE, "UIC configuration command fails - DME_FAILURE\n"));
break; break;
default : default :
ASSERT (FALSE); ASSERT (FALSE);
@ -195,7 +195,7 @@ DumpUicCmdExecResult (
case 0x00: case 0x00:
break; break;
case 0x01: case 0x01:
DEBUG ((EFI_D_VERBOSE, "UIC control command fails - FAILURE\n")); DEBUG ((DEBUG_VERBOSE, "UIC control command fails - FAILURE\n"));
break; break;
default : default :
ASSERT (FALSE); ASSERT (FALSE);
@ -217,34 +217,34 @@ DumpQueryResponseResult (
{ {
switch (Result) { switch (Result) {
case 0xF6: case 0xF6:
DEBUG ((EFI_D_VERBOSE, "Query Response with Parameter Not Readable\n")); DEBUG ((DEBUG_VERBOSE, "Query Response with Parameter Not Readable\n"));
break; break;
case 0xF7: case 0xF7:
DEBUG ((EFI_D_VERBOSE, "Query Response with Parameter Not Writeable\n")); DEBUG ((DEBUG_VERBOSE, "Query Response with Parameter Not Writeable\n"));
break; break;
case 0xF8: case 0xF8:
DEBUG ((EFI_D_VERBOSE, "Query Response with Parameter Already Written\n")); DEBUG ((DEBUG_VERBOSE, "Query Response with Parameter Already Written\n"));
break; break;
case 0xF9: case 0xF9:
DEBUG ((EFI_D_VERBOSE, "Query Response with Invalid Length\n")); DEBUG ((DEBUG_VERBOSE, "Query Response with Invalid Length\n"));
break; break;
case 0xFA: case 0xFA:
DEBUG ((EFI_D_VERBOSE, "Query Response with Invalid Value\n")); DEBUG ((DEBUG_VERBOSE, "Query Response with Invalid Value\n"));
break; break;
case 0xFB: case 0xFB:
DEBUG ((EFI_D_VERBOSE, "Query Response with Invalid Selector\n")); DEBUG ((DEBUG_VERBOSE, "Query Response with Invalid Selector\n"));
break; break;
case 0xFC: case 0xFC:
DEBUG ((EFI_D_VERBOSE, "Query Response with Invalid Index\n")); DEBUG ((DEBUG_VERBOSE, "Query Response with Invalid Index\n"));
break; break;
case 0xFD: case 0xFD:
DEBUG ((EFI_D_VERBOSE, "Query Response with Invalid Idn\n")); DEBUG ((DEBUG_VERBOSE, "Query Response with Invalid Idn\n"));
break; break;
case 0xFE: case 0xFE:
DEBUG ((EFI_D_VERBOSE, "Query Response with Invalid Opcode\n")); DEBUG ((DEBUG_VERBOSE, "Query Response with Invalid Opcode\n"));
break; break;
case 0xFF: case 0xFF:
DEBUG ((EFI_D_VERBOSE, "Query Response with General Failure\n")); DEBUG ((DEBUG_VERBOSE, "Query Response with General Failure\n"));
break; break;
default : default :
ASSERT (FALSE); ASSERT (FALSE);
@ -402,7 +402,7 @@ UfsInitUtpPrdt (
if ((BufferSize & (BIT0 | BIT1)) != 0) { if ((BufferSize & (BIT0 | BIT1)) != 0) {
BufferSize &= ~(BIT0 | BIT1); BufferSize &= ~(BIT0 | BIT1);
DEBUG ((EFI_D_WARN, "UfsInitUtpPrdt: The BufferSize [%d] is not dword-aligned!\n", BufferSize)); DEBUG ((DEBUG_WARN, "UfsInitUtpPrdt: The BufferSize [%d] is not dword-aligned!\n", BufferSize));
} }
if (BufferSize == 0) { if (BufferSize == 0) {
@ -602,32 +602,13 @@ UfsCreateDMCommandDesc (
} }
DataDirection = Packet->DataDirection; DataDirection = Packet->DataDirection;
if (DataDirection == UfsDataIn) { DataSize = Packet->TransferLength;
DataSize = Packet->InTransferLength; Data = Packet->DataBuffer;
Data = Packet->InDataBuffer;
} else if (DataDirection == UfsDataOut) {
DataSize = Packet->OutTransferLength;
Data = Packet->OutDataBuffer;
} else {
DataSize = 0;
Data = NULL;
}
if (((Opcode != UtpQueryFuncOpcodeSetFlag) && (Opcode != UtpQueryFuncOpcodeClrFlag) && (Opcode != UtpQueryFuncOpcodeTogFlag))
&& ((DataSize == 0) || (Data == NULL))) {
return EFI_INVALID_PARAMETER;
}
if (((Opcode == UtpQueryFuncOpcodeSetFlag) || (Opcode == UtpQueryFuncOpcodeClrFlag) || (Opcode == UtpQueryFuncOpcodeTogFlag))
&& ((DataSize != 0) || (Data != NULL))) {
return EFI_INVALID_PARAMETER;
}
if ((Opcode == UtpQueryFuncOpcodeWrAttr) && (DataSize != sizeof (UINT32))) {
return EFI_INVALID_PARAMETER;
}
if ((Opcode == UtpQueryFuncOpcodeWrDesc) || (Opcode == UtpQueryFuncOpcodeRdDesc)) { if ((Opcode == UtpQueryFuncOpcodeWrDesc) || (Opcode == UtpQueryFuncOpcodeRdDesc)) {
if (DataSize == 0 || Data == NULL) {
return EFI_INVALID_PARAMETER;
}
TotalLen = ROUNDUP8 (sizeof (UTP_QUERY_REQ_UPIU)) + ROUNDUP8 (sizeof (UTP_QUERY_RESP_UPIU)) + ROUNDUP8 (DataSize); TotalLen = ROUNDUP8 (sizeof (UTP_QUERY_REQ_UPIU)) + ROUNDUP8 (sizeof (UTP_QUERY_RESP_UPIU)) + ROUNDUP8 (DataSize);
} else { } else {
TotalLen = ROUNDUP8 (sizeof (UTP_QUERY_REQ_UPIU)) + ROUNDUP8 (sizeof (UTP_QUERY_RESP_UPIU)); TotalLen = ROUNDUP8 (sizeof (UTP_QUERY_REQ_UPIU)) + ROUNDUP8 (sizeof (UTP_QUERY_RESP_UPIU));
@ -867,6 +848,183 @@ UfsStopExecCmd (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Extracts return data from query response upiu.
@param[in] Packet Pointer to the UFS_DEVICE_MANAGEMENT_REQUEST_PACKET.
@param[in] QueryResp Pointer to the query response.
@retval EFI_INVALID_PARAMETER Packet or QueryResp are empty or opcode is invalid.
@retval EFI_SUCCESS Data extracted.
**/
EFI_STATUS
UfsGetReturnDataFromQueryResponse (
IN UFS_DEVICE_MANAGEMENT_REQUEST_PACKET *Packet,
IN UTP_QUERY_RESP_UPIU *QueryResp
)
{
UINT16 ReturnDataSize;
UINT32 ReturnData;
if (Packet == NULL || QueryResp == NULL) {
return EFI_INVALID_PARAMETER;
}
switch (Packet->Opcode) {
case UtpQueryFuncOpcodeRdDesc:
ReturnDataSize = QueryResp->Tsf.Length;
SwapLittleEndianToBigEndian ((UINT8*)&ReturnDataSize, sizeof (UINT16));
CopyMem (Packet->DataBuffer, (QueryResp + 1), ReturnDataSize);
Packet->TransferLength = ReturnDataSize;
break;
case UtpQueryFuncOpcodeWrDesc:
ReturnDataSize = QueryResp->Tsf.Length;
SwapLittleEndianToBigEndian ((UINT8*)&ReturnDataSize, sizeof (UINT16));
Packet->TransferLength = ReturnDataSize;
break;
case UtpQueryFuncOpcodeRdFlag:
case UtpQueryFuncOpcodeSetFlag:
case UtpQueryFuncOpcodeClrFlag:
case UtpQueryFuncOpcodeTogFlag:
CopyMem (Packet->DataBuffer, &QueryResp->Tsf.Value, sizeof (UINT8));
break;
case UtpQueryFuncOpcodeRdAttr:
case UtpQueryFuncOpcodeWrAttr:
ReturnData = QueryResp->Tsf.Value;
SwapLittleEndianToBigEndian ((UINT8*) &ReturnData, sizeof (UINT32));
CopyMem (Packet->DataBuffer, &ReturnData, sizeof (UINT32));
break;
default:
return EFI_INVALID_PARAMETER;
}
return EFI_SUCCESS;
}
/**
Creates Transfer Request descriptor and sends Query Request to the device.
@param[in] Private Pointer to the UFS_PASS_THRU_PRIVATE_DATA.
@param[in] Packet Pointer to the UFS_DEVICE_MANAGEMENT_REQUEST_PACKET.
@retval EFI_SUCCESS The device descriptor was read/written successfully.
@retval EFI_DEVICE_ERROR A device error occurred while attempting to r/w the device descriptor.
@retval EFI_TIMEOUT A timeout occurred while waiting for the completion of r/w the device descriptor.
**/
EFI_STATUS
UfsSendDmRequestRetry (
IN UFS_PASS_THRU_PRIVATE_DATA *Private,
IN UFS_DEVICE_MANAGEMENT_REQUEST_PACKET *Packet
)
{
UINT8 Slot;
UTP_TRD *Trd;
VOID *CmdDescHost;
VOID *CmdDescMapping;
UINT32 CmdDescSize;
EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHc;
UTP_QUERY_RESP_UPIU *QueryResp;
EFI_STATUS Status;
//
// Find out which slot of transfer request list is available.
//
Status = UfsFindAvailableSlotInTrl (Private, &Slot);
if (EFI_ERROR (Status)) {
return Status;
}
Trd = ((UTP_TRD*)Private->UtpTrlBase) + Slot;
//
// Fill transfer request descriptor to this slot.
//
Status = UfsCreateDMCommandDesc (Private, Packet, Trd, &CmdDescHost, &CmdDescMapping);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to create DM command descriptor\n"));
return Status;
}
UfsHc = Private->UfsHostController;
QueryResp = (UTP_QUERY_RESP_UPIU*)((UINT8*)CmdDescHost + Trd->RuO * sizeof (UINT32));
ASSERT (QueryResp != NULL);
CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32);
//
// Start to execute the transfer request.
//
UfsStartExecCmd (Private, Slot);
//
// Wait for the completion of the transfer request.
//
Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0, 0, Packet->Timeout);
if (EFI_ERROR (Status)) {
goto Exit;
}
if (Trd->Ocs != 0 || QueryResp->QueryResp != UfsUtpQueryResponseSuccess) {
DEBUG ((DEBUG_ERROR, "Failed to send query request, OCS = %X, QueryResp = %X\n", Trd->Ocs, QueryResp->QueryResp));
DumpQueryResponseResult (QueryResp->QueryResp);
Status = EFI_DEVICE_ERROR;
goto Exit;
}
Status = UfsGetReturnDataFromQueryResponse (Packet, QueryResp);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to get return data from query response\n"));
goto Exit;
}
Exit:
UfsHc->Flush (UfsHc);
UfsStopExecCmd (Private, Slot);
if (CmdDescMapping != NULL) {
UfsHc->Unmap (UfsHc, CmdDescMapping);
}
if (CmdDescHost != NULL) {
UfsHc->FreeBuffer (UfsHc, EFI_SIZE_TO_PAGES (CmdDescSize), CmdDescHost);
}
return Status;
}
/**
Sends Query Request to the device. Query is sent until device responds correctly or counter runs out.
@param[in] Private Pointer to the UFS_PASS_THRU_PRIVATE_DATA.
@param[in] Packet Pointer to the UFS_DEVICE_MANAGEMENT_PACKET.
@retval EFI_SUCCESS The device responded correctly to the Query request.
@retval EFI_DEVICE_ERROR A device error occurred while waiting for the response from the device.
@retval EFI_TIMEOUT A timeout occurred while waiting for the completion of the operation.
**/
EFI_STATUS
UfsSendDmRequest (
IN UFS_PASS_THRU_PRIVATE_DATA *Private,
IN UFS_DEVICE_MANAGEMENT_REQUEST_PACKET *Packet
)
{
EFI_STATUS Status;
UINT8 Retry;
Status = EFI_SUCCESS;
for (Retry = 0; Retry < 5; Retry ++) {
Status = UfsSendDmRequestRetry (Private, Packet);
if (!EFI_ERROR (Status)) {
return EFI_SUCCESS;
}
}
DEBUG ((DEBUG_ERROR, "Failed to get response from the device after %d retries\n", Retry));
return Status;
}
/** /**
Read or write specified device descriptor of a UFS device. Read or write specified device descriptor of a UFS device.
@ -894,106 +1052,25 @@ UfsRwDeviceDesc (
IN UINT32 DescSize IN UINT32 DescSize
) )
{ {
EFI_STATUS Status;
UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet; UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet;
UINT8 Slot;
UTP_TRD *Trd;
UTP_QUERY_RESP_UPIU *QueryResp;
UINT32 CmdDescSize;
UINT16 ReturnDataSize;
VOID *CmdDescHost;
VOID *CmdDescMapping;
EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHc;
ZeroMem (&Packet, sizeof (UFS_DEVICE_MANAGEMENT_REQUEST_PACKET)); ZeroMem (&Packet, sizeof (UFS_DEVICE_MANAGEMENT_REQUEST_PACKET));
if (Read) { if (Read) {
Packet.DataDirection = UfsDataIn; Packet.DataDirection = UfsDataIn;
Packet.InDataBuffer = Descriptor;
Packet.InTransferLength = DescSize;
Packet.Opcode = UtpQueryFuncOpcodeRdDesc; Packet.Opcode = UtpQueryFuncOpcodeRdDesc;
} else { } else {
Packet.DataDirection = UfsDataOut; Packet.DataDirection = UfsDataOut;
Packet.OutDataBuffer = Descriptor;
Packet.OutTransferLength = DescSize;
Packet.Opcode = UtpQueryFuncOpcodeWrDesc; Packet.Opcode = UtpQueryFuncOpcodeWrDesc;
} }
Packet.DataBuffer = Descriptor;
Packet.TransferLength = DescSize;
Packet.DescId = DescId; Packet.DescId = DescId;
Packet.Index = Index; Packet.Index = Index;
Packet.Selector = Selector; Packet.Selector = Selector;
Packet.Timeout = UFS_TIMEOUT; Packet.Timeout = UFS_TIMEOUT;
// return UfsSendDmRequest (Private, &Packet);
// Find out which slot of transfer request list is available.
//
Status = UfsFindAvailableSlotInTrl (Private, &Slot);
if (EFI_ERROR (Status)) {
return Status;
}
Trd = ((UTP_TRD*)Private->UtpTrlBase) + Slot;
//
// Fill transfer request descriptor to this slot.
//
Status = UfsCreateDMCommandDesc (Private, &Packet, Trd, &CmdDescHost, &CmdDescMapping);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Check the transfer request result.
//
UfsHc = Private->UfsHostController;
QueryResp = (UTP_QUERY_RESP_UPIU*)((UINT8*)CmdDescHost + Trd->RuO * sizeof (UINT32));
ASSERT (QueryResp != NULL);
CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32);
//
// Start to execute the transfer request.
//
UfsStartExecCmd (Private, Slot);
//
// Wait for the completion of the transfer request.
//
Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0 << Slot, 0, Packet.Timeout);
if (EFI_ERROR (Status)) {
goto Exit;
}
if (QueryResp->QueryResp != 0) {
DumpQueryResponseResult (QueryResp->QueryResp);
Status = EFI_DEVICE_ERROR;
goto Exit;
}
if (Trd->Ocs == 0) {
ReturnDataSize = QueryResp->Tsf.Length;
SwapLittleEndianToBigEndian ((UINT8*)&ReturnDataSize, sizeof (UINT16));
if (Read) {
CopyMem (Packet.InDataBuffer, (QueryResp + 1), ReturnDataSize);
Packet.InTransferLength = ReturnDataSize;
} else {
Packet.OutTransferLength = ReturnDataSize;
}
} else {
Status = EFI_DEVICE_ERROR;
}
Exit:
UfsHc->Flush (UfsHc);
UfsStopExecCmd (Private, Slot);
if (CmdDescMapping != NULL) {
UfsHc->Unmap (UfsHc, CmdDescMapping);
}
if (CmdDescHost != NULL) {
UfsHc->FreeBuffer (UfsHc, EFI_SIZE_TO_PAGES (CmdDescSize), CmdDescHost);
}
return Status;
} }
/** /**
@ -1021,16 +1098,7 @@ UfsRwAttributes (
IN OUT UINT32 *Attributes IN OUT UINT32 *Attributes
) )
{ {
EFI_STATUS Status;
UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet; UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet;
UINT8 Slot;
UTP_TRD *Trd;
UTP_QUERY_RESP_UPIU *QueryResp;
UINT32 CmdDescSize;
UINT32 ReturnData;
VOID *CmdDescHost;
VOID *CmdDescMapping;
EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHc;
ZeroMem (&Packet, sizeof (UFS_DEVICE_MANAGEMENT_REQUEST_PACKET)); ZeroMem (&Packet, sizeof (UFS_DEVICE_MANAGEMENT_REQUEST_PACKET));
@ -1041,77 +1109,13 @@ UfsRwAttributes (
Packet.DataDirection = UfsDataOut; Packet.DataDirection = UfsDataOut;
Packet.Opcode = UtpQueryFuncOpcodeWrAttr; Packet.Opcode = UtpQueryFuncOpcodeWrAttr;
} }
Packet.DataBuffer = Attributes;
Packet.DescId = AttrId; Packet.DescId = AttrId;
Packet.Index = Index; Packet.Index = Index;
Packet.Selector = Selector; Packet.Selector = Selector;
Packet.Timeout = UFS_TIMEOUT; Packet.Timeout = UFS_TIMEOUT;
// return UfsSendDmRequest (Private, &Packet);
// Find out which slot of transfer request list is available.
//
Status = UfsFindAvailableSlotInTrl (Private, &Slot);
if (EFI_ERROR (Status)) {
return Status;
}
Trd = ((UTP_TRD*)Private->UtpTrlBase) + Slot;
//
// Fill transfer request descriptor to this slot.
//
Status = UfsCreateDMCommandDesc (Private, &Packet, Trd, &CmdDescHost, &CmdDescMapping);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Check the transfer request result.
//
UfsHc = Private->UfsHostController;
QueryResp = (UTP_QUERY_RESP_UPIU*)((UINT8*)CmdDescHost + Trd->RuO * sizeof (UINT32));
ASSERT (QueryResp != NULL);
CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32);
//
// Start to execute the transfer request.
//
UfsStartExecCmd (Private, Slot);
//
// Wait for the completion of the transfer request.
//
Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0 << Slot, 0, Packet.Timeout);
if (EFI_ERROR (Status)) {
goto Exit;
}
if (QueryResp->QueryResp != 0) {
DumpQueryResponseResult (QueryResp->QueryResp);
Status = EFI_DEVICE_ERROR;
goto Exit;
}
if (Trd->Ocs == 0) {
ReturnData = QueryResp->Tsf.Value;
SwapLittleEndianToBigEndian ((UINT8*)&ReturnData, sizeof (UINT32));
*Attributes = ReturnData;
} else {
Status = EFI_DEVICE_ERROR;
}
Exit:
UfsHc->Flush (UfsHc);
UfsStopExecCmd (Private, Slot);
if (CmdDescMapping != NULL) {
UfsHc->Unmap (UfsHc, CmdDescMapping);
}
if (CmdDescHost != NULL) {
UfsHc->FreeBuffer (UfsHc, EFI_SIZE_TO_PAGES (CmdDescSize), CmdDescHost);
}
return Status;
} }
/** /**
@ -1135,15 +1139,7 @@ UfsRwFlags (
IN OUT UINT8 *Value IN OUT UINT8 *Value
) )
{ {
EFI_STATUS Status;
UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet; UFS_DEVICE_MANAGEMENT_REQUEST_PACKET Packet;
UINT8 Slot;
UTP_TRD *Trd;
UTP_QUERY_RESP_UPIU *QueryResp;
UINT32 CmdDescSize;
VOID *CmdDescHost;
VOID *CmdDescMapping;
EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHc;
if (Value == NULL) { if (Value == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -1165,74 +1161,13 @@ UfsRwFlags (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
} }
Packet.DataBuffer = Value;
Packet.DescId = FlagId; Packet.DescId = FlagId;
Packet.Index = 0; Packet.Index = 0;
Packet.Selector = 0; Packet.Selector = 0;
Packet.Timeout = UFS_TIMEOUT; Packet.Timeout = UFS_TIMEOUT;
// return UfsSendDmRequest (Private, &Packet);
// Find out which slot of transfer request list is available.
//
Status = UfsFindAvailableSlotInTrl (Private, &Slot);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Fill transfer request descriptor to this slot.
//
Trd = ((UTP_TRD*)Private->UtpTrlBase) + Slot;
Status = UfsCreateDMCommandDesc (Private, &Packet, Trd, &CmdDescHost, &CmdDescMapping);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Check the transfer request result.
//
UfsHc = Private->UfsHostController;
QueryResp = (UTP_QUERY_RESP_UPIU*)((UINT8*)CmdDescHost + Trd->RuO * sizeof (UINT32));
ASSERT (QueryResp != NULL);
CmdDescSize = Trd->RuO * sizeof (UINT32) + Trd->RuL * sizeof (UINT32);
//
// Start to execute the transfer request.
//
UfsStartExecCmd (Private, Slot);
//
// Wait for the completion of the transfer request.
//
Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0 << Slot, 0, Packet.Timeout);
if (EFI_ERROR (Status)) {
goto Exit;
}
if (QueryResp->QueryResp != 0) {
DumpQueryResponseResult (QueryResp->QueryResp);
Status = EFI_DEVICE_ERROR;
goto Exit;
}
if (Trd->Ocs == 0) {
*Value = (UINT8)QueryResp->Tsf.Value;
} else {
Status = EFI_DEVICE_ERROR;
}
Exit:
UfsHc->Flush (UfsHc);
UfsStopExecCmd (Private, Slot);
if (CmdDescMapping != NULL) {
UfsHc->Unmap (UfsHc, CmdDescMapping);
}
if (CmdDescHost != NULL) {
UfsHc->FreeBuffer (UfsHc, EFI_SIZE_TO_PAGES (CmdDescSize), CmdDescHost);
}
return Status;
} }
/** /**
@ -1559,7 +1494,7 @@ UfsExecScsiCmds (
// //
Packet->TargetStatus = Response->Status; Packet->TargetStatus = Response->Status;
if (Response->Response != 0) { if (Response->Response != 0) {
DEBUG ((EFI_D_ERROR, "UfsExecScsiCmds() fails with Target Failure\n")); DEBUG ((DEBUG_ERROR, "UfsExecScsiCmds() fails with Target Failure\n"));
Status = EFI_DEVICE_ERROR; Status = EFI_DEVICE_ERROR;
goto Exit; goto Exit;
} }
@ -1717,7 +1652,7 @@ UfsExecUicCommands (
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
DEBUG ((EFI_D_INFO, "UfsPassThruDxe: found a attached UFS device\n")); DEBUG ((DEBUG_INFO, "UfsPassThruDxe: found a attached UFS device\n"));
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -2084,29 +2019,29 @@ UfsControllerInit (
Status = UfsEnableHostController (Private); Status = UfsEnableHostController (Private);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "UfsControllerInit: Enable Host Controller Fails, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "UfsControllerInit: Enable Host Controller Fails, Status = %r\n", Status));
return Status; return Status;
} }
Status = UfsDeviceDetection (Private); Status = UfsDeviceDetection (Private);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "UfsControllerInit: Device Detection Fails, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "UfsControllerInit: Device Detection Fails, Status = %r\n", Status));
return Status; return Status;
} }
Status = UfsInitTaskManagementRequestList (Private); Status = UfsInitTaskManagementRequestList (Private);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "UfsControllerInit: Task management list initialization Fails, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "UfsControllerInit: Task management list initialization Fails, Status = %r\n", Status));
return Status; return Status;
} }
Status = UfsInitTransferRequestList (Private); Status = UfsInitTransferRequestList (Private);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "UfsControllerInit: Transfer list initialization Fails, Status = %r\n", Status)); DEBUG ((DEBUG_ERROR, "UfsControllerInit: Transfer list initialization Fails, Status = %r\n", Status));
return Status; return Status;
} }
DEBUG ((EFI_D_INFO, "UfsControllerInit Finished\n")); DEBUG ((DEBUG_INFO, "UfsControllerInit Finished\n"));
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -2167,7 +2102,7 @@ UfsControllerStop (
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
} }
DEBUG ((EFI_D_INFO, "UfsController is stopped\n")); DEBUG ((DEBUG_INFO, "UfsController is stopped\n"));
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -2274,7 +2209,7 @@ ProcessAsyncTaskList (
// case. // case.
// //
Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR; Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR;
DEBUG ((EFI_D_VERBOSE, "ProcessAsyncTaskList(): Signal Event %p UfsMmioRead32() Error.\n", TransReq->CallerEvent)); DEBUG ((DEBUG_VERBOSE, "ProcessAsyncTaskList(): Signal Event %p UfsMmioRead32() Error.\n", TransReq->CallerEvent));
SignalCallerEvent (Private, TransReq); SignalCallerEvent (Private, TransReq);
continue; continue;
} }
@ -2291,7 +2226,7 @@ ProcessAsyncTaskList (
// Timeout occurs. // Timeout occurs.
// //
Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND; Packet->HostAdapterStatus = EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND;
DEBUG ((EFI_D_VERBOSE, "ProcessAsyncTaskList(): Signal Event %p EFI_TIMEOUT.\n", TransReq->CallerEvent)); DEBUG ((DEBUG_VERBOSE, "ProcessAsyncTaskList(): Signal Event %p EFI_TIMEOUT.\n", TransReq->CallerEvent));
SignalCallerEvent (Private, TransReq); SignalCallerEvent (Private, TransReq);
continue; continue;
} }
@ -2316,7 +2251,7 @@ ProcessAsyncTaskList (
// //
Packet->TargetStatus = Response->Status; Packet->TargetStatus = Response->Status;
if (Response->Response != 0) { if (Response->Response != 0) {
DEBUG ((EFI_D_VERBOSE, "ProcessAsyncTaskList(): Signal Event %p Target Failure.\n", TransReq->CallerEvent)); DEBUG ((DEBUG_VERBOSE, "ProcessAsyncTaskList(): Signal Event %p Target Failure.\n", TransReq->CallerEvent));
SignalCallerEvent (Private, TransReq); SignalCallerEvent (Private, TransReq);
continue; continue;
} }
@ -2336,12 +2271,12 @@ ProcessAsyncTaskList (
} }
} }
} else { } else {
DEBUG ((EFI_D_VERBOSE, "ProcessAsyncTaskList(): Signal Event %p Target Device Error.\n", TransReq->CallerEvent)); DEBUG ((DEBUG_VERBOSE, "ProcessAsyncTaskList(): Signal Event %p Target Device Error.\n", TransReq->CallerEvent));
SignalCallerEvent (Private, TransReq); SignalCallerEvent (Private, TransReq);
continue; continue;
} }
DEBUG ((EFI_D_VERBOSE, "ProcessAsyncTaskList(): Signal Event %p Success.\n", TransReq->CallerEvent)); DEBUG ((DEBUG_VERBOSE, "ProcessAsyncTaskList(): Signal Event %p Success.\n", TransReq->CallerEvent));
SignalCallerEvent (Private, TransReq); SignalCallerEvent (Private, TransReq);
} }
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Pei USB ATATPI command implementations. Pei USB ATATPI command implementations.
Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions are licensed and made available under the terms and conditions
@ -274,7 +274,7 @@ PeiUsbReadCapacity (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
} }
LastBlock = (Data.LastLba3 << 24) | (Data.LastLba2 << 16) | (Data.LastLba1 << 8) | Data.LastLba0; LastBlock = ((UINT32) Data.LastLba3 << 24) | (Data.LastLba2 << 16) | (Data.LastLba1 << 8) | Data.LastLba0;
if (LastBlock == 0xFFFFFFFF) { if (LastBlock == 0xFFFFFFFF) {
DEBUG ((EFI_D_INFO, "The usb device LBA count is larger than 0xFFFFFFFF!\n")); DEBUG ((EFI_D_INFO, "The usb device LBA count is larger than 0xFFFFFFFF!\n"));
@ -346,7 +346,7 @@ PeiUsbReadFormattedCapacity (
PeiBotDevice->Media2.LastBlock = 0; PeiBotDevice->Media2.LastBlock = 0;
} else { } else {
LastBlock = (FormatData.LastLba3 << 24) | (FormatData.LastLba2 << 16) | (FormatData.LastLba1 << 8) | FormatData.LastLba0; LastBlock = ((UINT32) FormatData.LastLba3 << 24) | (FormatData.LastLba2 << 16) | (FormatData.LastLba1 << 8) | FormatData.LastLba0;
if (LastBlock == 0xFFFFFFFF) { if (LastBlock == 0xFFFFFFFF) {
DEBUG ((EFI_D_INFO, "The usb device LBA count is larger than 0xFFFFFFFF!\n")); DEBUG ((EFI_D_INFO, "The usb device LBA count is larger than 0xFFFFFFFF!\n"));
} }

View File

@ -2,7 +2,7 @@
Usb bus enumeration support. Usb bus enumeration support.
Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -53,28 +53,33 @@ UsbGetEndpointDesc (
@param UsbIf The USB interface to free. @param UsbIf The USB interface to free.
@retval EFI_ACCESS_DENIED The interface is still occupied.
@retval EFI_SUCCESS The interface is freed.
**/ **/
VOID EFI_STATUS
UsbFreeInterface ( UsbFreeInterface (
IN USB_INTERFACE *UsbIf IN USB_INTERFACE *UsbIf
) )
{ {
EFI_STATUS Status;
UsbCloseHostProtoByChild (UsbIf->Device->Bus, UsbIf->Handle); UsbCloseHostProtoByChild (UsbIf->Device->Bus, UsbIf->Handle);
gBS->UninstallMultipleProtocolInterfaces ( Status = gBS->UninstallMultipleProtocolInterfaces (
UsbIf->Handle, UsbIf->Handle,
&gEfiDevicePathProtocolGuid, &gEfiDevicePathProtocolGuid, UsbIf->DevicePath,
UsbIf->DevicePath, &gEfiUsbIoProtocolGuid, &UsbIf->UsbIo,
&gEfiUsbIoProtocolGuid,
&UsbIf->UsbIo,
NULL NULL
); );
if (!EFI_ERROR (Status)) {
if (UsbIf->DevicePath != NULL) { if (UsbIf->DevicePath != NULL) {
FreePool (UsbIf->DevicePath); FreePool (UsbIf->DevicePath);
} }
FreePool (UsbIf); FreePool (UsbIf);
} else {
UsbOpenHostProtoByChild (UsbIf->Device->Bus, UsbIf->Handle);
}
return Status;
} }
@ -525,7 +530,13 @@ UsbRemoveConfig (
Status = UsbDisconnectDriver (UsbIf); Status = UsbDisconnectDriver (UsbIf);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
UsbFreeInterface (UsbIf); Status = UsbFreeInterface (UsbIf);
if (EFI_ERROR (Status)) {
UsbConnectDriver (UsbIf);
}
}
if (!EFI_ERROR (Status)) {
Device->Interfaces[Index] = NULL; Device->Interfaces[Index] = NULL;
} else { } else {
ReturnStatus = Status; ReturnStatus = Status;

View File

@ -2,7 +2,7 @@
Wrapper function for usb host controller interface. Wrapper function for usb host controller interface.
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -1364,10 +1364,10 @@ UsbBusRecursivelyConnectWantedUsbIo (
// //
// Recursively connect the wanted Usb Io handle // Recursively connect the wanted Usb Io handle
// //
DEBUG ((EFI_D_INFO, "UsbConnectDriver: TPL before connect is %d\n", (UINT32)UsbGetCurrentTpl ())); DEBUG ((EFI_D_INFO, "UsbBusRecursivelyConnectWantedUsbIo: TPL before connect is %d\n", (UINT32)UsbGetCurrentTpl ()));
Status = gBS->ConnectController (UsbIf->Handle, NULL, NULL, TRUE); Status = gBS->ConnectController (UsbIf->Handle, NULL, NULL, TRUE);
UsbIf->IsManaged = (BOOLEAN)!EFI_ERROR (Status); UsbIf->IsManaged = (BOOLEAN)!EFI_ERROR (Status);
DEBUG ((EFI_D_INFO, "UsbConnectDriver: TPL after connect is %d\n", (UINT32)UsbGetCurrentTpl())); DEBUG ((EFI_D_INFO, "UsbBusRecursivelyConnectWantedUsbIo: TPL after connect is %d\n", (UINT32)UsbGetCurrentTpl()));
} }
} }
} }

View File

@ -773,7 +773,7 @@ FvIsBeingProcesssed (
for (Link = mFvHandleList.ForwardLink; Link != &mFvHandleList; Link = Link->ForwardLink) { for (Link = mFvHandleList.ForwardLink; Link != &mFvHandleList; Link = Link->ForwardLink) {
KnownHandle = CR(Link, KNOWN_HANDLE, Link, KNOWN_HANDLE_SIGNATURE); KnownHandle = CR(Link, KNOWN_HANDLE, Link, KNOWN_HANDLE_SIGNATURE);
if (CompareGuid (&FvNameGuid, &KnownHandle->FvNameGuid)) { if (CompareGuid (&FvNameGuid, &KnownHandle->FvNameGuid)) {
DEBUG ((EFI_D_ERROR, "FvImage on FvHandle %p and %p has the same FvNameGuid %g.\n", FvHandle, KnownHandle->Handle, FvNameGuid)); DEBUG ((EFI_D_ERROR, "FvImage on FvHandle %p and %p has the same FvNameGuid %g.\n", FvHandle, KnownHandle->Handle, &FvNameGuid));
return NULL; return NULL;
} }
} }

View File

@ -1647,6 +1647,12 @@ CoreStartImage (
// //
PERF_START (NULL, "StartImage:", NULL, Tick); PERF_START (NULL, "StartImage:", NULL, Tick);
PERF_END (NULL, "StartImage:", NULL, 0); PERF_END (NULL, "StartImage:", NULL, 0);
//
// Pop the current start image context
//
mCurrentImage = LastImage;
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
Image->JumpContext = ALIGN_POINTER (Image->JumpBuffer, BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT); Image->JumpContext = ALIGN_POINTER (Image->JumpBuffer, BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT);

View File

@ -576,6 +576,11 @@ SplitRecord (
TempRecord.NumberOfPages = EfiSizeToPages (PhysicalEnd - PhysicalStart); TempRecord.NumberOfPages = EfiSizeToPages (PhysicalEnd - PhysicalStart);
} while ((ImageRecord != NULL) && (PhysicalStart < PhysicalEnd)); } while ((ImageRecord != NULL) && (PhysicalStart < PhysicalEnd));
//
// The logic in function SplitTable() ensures that TotalNewRecordCount will not be zero if the
// code reaches here.
//
ASSERT (TotalNewRecordCount != 0);
return TotalNewRecordCount - 1; return TotalNewRecordCount - 1;
} }

View File

@ -596,7 +596,7 @@ SmmLoadImage (
} }
CopyMem (DriverEntry->LoadedImage->FilePath, FilePath, GetDevicePathSize (FilePath)); CopyMem (DriverEntry->LoadedImage->FilePath, FilePath, GetDevicePathSize (FilePath));
DriverEntry->LoadedImage->ImageBase = (VOID *)(UINTN)DriverEntry->ImageBuffer; DriverEntry->LoadedImage->ImageBase = (VOID *)(UINTN) ImageContext.ImageAddress;
DriverEntry->LoadedImage->ImageSize = ImageContext.ImageSize; DriverEntry->LoadedImage->ImageSize = ImageContext.ImageSize;
DriverEntry->LoadedImage->ImageCodeType = EfiRuntimeServicesCode; DriverEntry->LoadedImage->ImageCodeType = EfiRuntimeServicesCode;
DriverEntry->LoadedImage->ImageDataType = EfiRuntimeServicesData; DriverEntry->LoadedImage->ImageDataType = EfiRuntimeServicesData;
@ -615,7 +615,7 @@ SmmLoadImage (
} }
CopyMem (DriverEntry->SmmLoadedImage.FilePath, FilePath, GetDevicePathSize(FilePath)); CopyMem (DriverEntry->SmmLoadedImage.FilePath, FilePath, GetDevicePathSize(FilePath));
DriverEntry->SmmLoadedImage.ImageBase = (VOID *)(UINTN)DriverEntry->ImageBuffer; DriverEntry->SmmLoadedImage.ImageBase = (VOID *)(UINTN) ImageContext.ImageAddress;
DriverEntry->SmmLoadedImage.ImageSize = ImageContext.ImageSize; DriverEntry->SmmLoadedImage.ImageSize = ImageContext.ImageSize;
DriverEntry->SmmLoadedImage.ImageCodeType = EfiRuntimeServicesCode; DriverEntry->SmmLoadedImage.ImageCodeType = EfiRuntimeServicesCode;
DriverEntry->SmmLoadedImage.ImageDataType = EfiRuntimeServicesData; DriverEntry->SmmLoadedImage.ImageDataType = EfiRuntimeServicesData;

View File

@ -1196,12 +1196,28 @@ extern LIST_ENTRY mSmmMemoryMap;
// //
#define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1) #define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
#define POOL_HEAD_SIGNATURE SIGNATURE_32('p','h','d','0')
typedef struct { typedef struct {
UINTN Size; UINT32 Signature;
BOOLEAN Available; BOOLEAN Available;
EFI_MEMORY_TYPE Type; EFI_MEMORY_TYPE Type;
UINTN Size;
} POOL_HEADER; } POOL_HEADER;
#define POOL_TAIL_SIGNATURE SIGNATURE_32('p','t','a','l')
typedef struct {
UINT32 Signature;
UINT32 Reserved;
UINTN Size;
} POOL_TAIL;
#define POOL_OVERHEAD (sizeof(POOL_HEADER) + sizeof(POOL_TAIL))
#define HEAD_TO_TAIL(a) \
((POOL_TAIL *) (((CHAR8 *) (a)) + (a)->Size - sizeof(POOL_TAIL)));
typedef struct { typedef struct {
POOL_HEADER Header; POOL_HEADER Header;
LIST_ENTRY Link; LIST_ENTRY Link;

View File

@ -263,6 +263,7 @@ EFI_PHYSICAL_ADDRESS mSmramCacheBase;
UINT64 mSmramCacheSize; UINT64 mSmramCacheSize;
EFI_SMM_COMMUNICATE_HEADER mCommunicateHeader; EFI_SMM_COMMUNICATE_HEADER mCommunicateHeader;
EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE *mLMFAConfigurationTable = NULL;
// //
// Table of Protocol notification and GUIDed Event notifications that the SMM IPL requires // Table of Protocol notification and GUIDed Event notifications that the SMM IPL requires
@ -841,7 +842,7 @@ GetPeCoffImageFixLoadingAssignedAddress(
FixLoadingAddress = 0; FixLoadingAddress = 0;
Status = EFI_NOT_FOUND; Status = EFI_NOT_FOUND;
SmramBase = mCurrentSmramRange->CpuStart; SmramBase = mLMFAConfigurationTable->SmramBase;
// //
// Get PeHeader pointer // Get PeHeader pointer
// //
@ -1519,7 +1520,6 @@ SmmIplEntry (
UINT64 MaxSize; UINT64 MaxSize;
VOID *Registration; VOID *Registration;
UINT64 SmmCodeSize; UINT64 SmmCodeSize;
EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE *LMFAConfigurationTable;
EFI_CPU_ARCH_PROTOCOL *CpuArch; EFI_CPU_ARCH_PROTOCOL *CpuArch;
EFI_STATUS SetAttrStatus; EFI_STATUS SetAttrStatus;
EFI_SMRAM_DESCRIPTOR *SmramRangeSmmDriver; EFI_SMRAM_DESCRIPTOR *SmramRangeSmmDriver;
@ -1623,14 +1623,14 @@ SmmIplEntry (
// //
Status = EfiGetSystemConfigurationTable ( Status = EfiGetSystemConfigurationTable (
&gLoadFixedAddressConfigurationTableGuid, &gLoadFixedAddressConfigurationTableGuid,
(VOID **) &LMFAConfigurationTable (VOID **) &mLMFAConfigurationTable
); );
if (!EFI_ERROR (Status) && LMFAConfigurationTable != NULL) { if (!EFI_ERROR (Status) && mLMFAConfigurationTable != NULL) {
LMFAConfigurationTable->SmramBase = mCurrentSmramRange->CpuStart; mLMFAConfigurationTable->SmramBase = mCurrentSmramRange->CpuStart;
// //
// Print the SMRAM base // Print the SMRAM base
// //
DEBUG ((EFI_D_INFO, "LOADING MODULE FIXED INFO: TSEG BASE is %x. \n", LMFAConfigurationTable->SmramBase)); DEBUG ((EFI_D_INFO, "LOADING MODULE FIXED INFO: TSEG BASE is %x. \n", mLMFAConfigurationTable->SmramBase));
} }
// //

View File

@ -1,7 +1,7 @@
/** @file /** @file
SMM Memory pool management functions. SMM Memory pool management functions.
Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at distribution. The full text of the license may be found at
@ -133,9 +133,11 @@ InternalAllocPoolByIndex (
{ {
EFI_STATUS Status; EFI_STATUS Status;
FREE_POOL_HEADER *Hdr; FREE_POOL_HEADER *Hdr;
POOL_TAIL *Tail;
EFI_PHYSICAL_ADDRESS Address; EFI_PHYSICAL_ADDRESS Address;
SMM_POOL_TYPE SmmPoolType; SMM_POOL_TYPE SmmPoolType;
Address = 0;
SmmPoolType = UefiMemoryTypeToSmmPoolType(PoolType); SmmPoolType = UefiMemoryTypeToSmmPoolType(PoolType);
ASSERT (PoolIndex <= MAX_POOL_INDEX); ASSERT (PoolIndex <= MAX_POOL_INDEX);
@ -153,18 +155,26 @@ InternalAllocPoolByIndex (
} else { } else {
Status = InternalAllocPoolByIndex (PoolType, PoolIndex + 1, &Hdr); Status = InternalAllocPoolByIndex (PoolType, PoolIndex + 1, &Hdr);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Hdr->Header.Signature = 0;
Hdr->Header.Size >>= 1; Hdr->Header.Size >>= 1;
Hdr->Header.Available = TRUE; Hdr->Header.Available = TRUE;
Hdr->Header.Type = PoolType; Hdr->Header.Type = 0;
Tail = HEAD_TO_TAIL(&Hdr->Header);
Tail->Signature = 0;
Tail->Size = 0;
InsertHeadList (&mSmmPoolLists[SmmPoolType][PoolIndex], &Hdr->Link); InsertHeadList (&mSmmPoolLists[SmmPoolType][PoolIndex], &Hdr->Link);
Hdr = (FREE_POOL_HEADER*)((UINT8*)Hdr + Hdr->Header.Size); Hdr = (FREE_POOL_HEADER*)((UINT8*)Hdr + Hdr->Header.Size);
} }
} }
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Hdr->Header.Signature = POOL_HEAD_SIGNATURE;
Hdr->Header.Size = MIN_POOL_SIZE << PoolIndex; Hdr->Header.Size = MIN_POOL_SIZE << PoolIndex;
Hdr->Header.Available = FALSE; Hdr->Header.Available = FALSE;
Hdr->Header.Type = PoolType; Hdr->Header.Type = PoolType;
Tail = HEAD_TO_TAIL(&Hdr->Header);
Tail->Signature = POOL_TAIL_SIGNATURE;
Tail->Size = Hdr->Header.Size;
} }
*FreePoolHdr = Hdr; *FreePoolHdr = Hdr;
@ -175,13 +185,15 @@ InternalAllocPoolByIndex (
Internal Function. Free a pool by specified PoolIndex. Internal Function. Free a pool by specified PoolIndex.
@param FreePoolHdr The pool to free. @param FreePoolHdr The pool to free.
@param PoolTail The pointer to the pool tail.
@retval EFI_SUCCESS Pool successfully freed. @retval EFI_SUCCESS Pool successfully freed.
**/ **/
EFI_STATUS EFI_STATUS
InternalFreePoolByIndex ( InternalFreePoolByIndex (
IN FREE_POOL_HEADER *FreePoolHdr IN FREE_POOL_HEADER *FreePoolHdr,
IN POOL_TAIL *PoolTail
) )
{ {
UINTN PoolIndex; UINTN PoolIndex;
@ -194,7 +206,11 @@ InternalFreePoolByIndex (
SmmPoolType = UefiMemoryTypeToSmmPoolType(FreePoolHdr->Header.Type); SmmPoolType = UefiMemoryTypeToSmmPoolType(FreePoolHdr->Header.Type);
PoolIndex = (UINTN) (HighBitSet32 ((UINT32)FreePoolHdr->Header.Size) - MIN_POOL_SHIFT); PoolIndex = (UINTN) (HighBitSet32 ((UINT32)FreePoolHdr->Header.Size) - MIN_POOL_SHIFT);
FreePoolHdr->Header.Signature = 0;
FreePoolHdr->Header.Available = TRUE; FreePoolHdr->Header.Available = TRUE;
FreePoolHdr->Header.Type = 0;
PoolTail->Signature = 0;
PoolTail->Size = 0;
ASSERT (PoolIndex < MAX_POOL_INDEX); ASSERT (PoolIndex < MAX_POOL_INDEX);
InsertHeadList (&mSmmPoolLists[SmmPoolType][PoolIndex], &FreePoolHdr->Link); InsertHeadList (&mSmmPoolLists[SmmPoolType][PoolIndex], &FreePoolHdr->Link);
return EFI_SUCCESS; return EFI_SUCCESS;
@ -222,17 +238,23 @@ SmmInternalAllocatePool (
) )
{ {
POOL_HEADER *PoolHdr; POOL_HEADER *PoolHdr;
POOL_TAIL *PoolTail;
FREE_POOL_HEADER *FreePoolHdr; FREE_POOL_HEADER *FreePoolHdr;
EFI_STATUS Status; EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS Address; EFI_PHYSICAL_ADDRESS Address;
UINTN PoolIndex; UINTN PoolIndex;
Address = 0;
if (PoolType != EfiRuntimeServicesCode && if (PoolType != EfiRuntimeServicesCode &&
PoolType != EfiRuntimeServicesData) { PoolType != EfiRuntimeServicesData) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
Size += sizeof (*PoolHdr); //
// Adjust the size by the pool header & tail overhead
//
Size += POOL_OVERHEAD;
if (Size > MAX_POOL_SIZE) { if (Size > MAX_POOL_SIZE) {
Size = EFI_SIZE_TO_PAGES (Size); Size = EFI_SIZE_TO_PAGES (Size);
Status = SmmInternalAllocatePages (AllocateAnyPages, PoolType, Size, &Address); Status = SmmInternalAllocatePages (AllocateAnyPages, PoolType, Size, &Address);
@ -241,9 +263,13 @@ SmmInternalAllocatePool (
} }
PoolHdr = (POOL_HEADER*)(UINTN)Address; PoolHdr = (POOL_HEADER*)(UINTN)Address;
PoolHdr->Signature = POOL_HEAD_SIGNATURE;
PoolHdr->Size = EFI_PAGES_TO_SIZE (Size); PoolHdr->Size = EFI_PAGES_TO_SIZE (Size);
PoolHdr->Available = FALSE; PoolHdr->Available = FALSE;
PoolHdr->Type = PoolType; PoolHdr->Type = PoolType;
PoolTail = HEAD_TO_TAIL(PoolHdr);
PoolTail->Signature = POOL_TAIL_SIGNATURE;
PoolTail->Size = PoolHdr->Size;
*Buffer = PoolHdr + 1; *Buffer = PoolHdr + 1;
return Status; return Status;
} }
@ -314,13 +340,30 @@ SmmInternalFreePool (
) )
{ {
FREE_POOL_HEADER *FreePoolHdr; FREE_POOL_HEADER *FreePoolHdr;
POOL_TAIL *PoolTail;
if (Buffer == NULL) { if (Buffer == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
FreePoolHdr = (FREE_POOL_HEADER*)((POOL_HEADER*)Buffer - 1); FreePoolHdr = (FREE_POOL_HEADER*)((POOL_HEADER*)Buffer - 1);
ASSERT (FreePoolHdr->Header.Signature == POOL_HEAD_SIGNATURE);
ASSERT (!FreePoolHdr->Header.Available); ASSERT (!FreePoolHdr->Header.Available);
PoolTail = HEAD_TO_TAIL(&FreePoolHdr->Header);
ASSERT (PoolTail->Signature == POOL_TAIL_SIGNATURE);
ASSERT (FreePoolHdr->Header.Size == PoolTail->Size);
if (FreePoolHdr->Header.Signature != POOL_HEAD_SIGNATURE) {
return EFI_INVALID_PARAMETER;
}
if (PoolTail->Signature != POOL_TAIL_SIGNATURE) {
return EFI_INVALID_PARAMETER;
}
if (FreePoolHdr->Header.Size != PoolTail->Size) {
return EFI_INVALID_PARAMETER;
}
if (FreePoolHdr->Header.Size > MAX_POOL_SIZE) { if (FreePoolHdr->Header.Size > MAX_POOL_SIZE) {
ASSERT (((UINTN)FreePoolHdr & EFI_PAGE_MASK) == 0); ASSERT (((UINTN)FreePoolHdr & EFI_PAGE_MASK) == 0);
@ -330,7 +373,7 @@ SmmInternalFreePool (
EFI_SIZE_TO_PAGES (FreePoolHdr->Header.Size) EFI_SIZE_TO_PAGES (FreePoolHdr->Header.Size)
); );
} }
return InternalFreePoolByIndex (FreePoolHdr); return InternalFreePoolByIndex (FreePoolHdr, PoolTail);
} }
/** /**

View File

@ -33,13 +33,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "PiSmmCore.h" #include "PiSmmCore.h"
#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))
typedef struct { typedef struct {
EFI_GUID FileGuid; EFI_GUID FileGuid;
UINTN ImageRef; PHYSICAL_ADDRESS EntryPoint;
UINTN EntryPoint; PHYSICAL_ADDRESS ImageBase;
UINTN ImageBase; UINT64 ImageSize;
UINTN ImageSize; UINT32 ImageRef;
UINTN PdbStringSize; UINT16 PdbStringSize;
CHAR8 *PdbString; CHAR8 *PdbString;
} IMAGE_STRUCT; } IMAGE_STRUCT;
@ -89,8 +92,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY *mSmmCoreSmiEntryList = &mSmiEntry
GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY *mSmmCoreHardwareSmiEntryList = &mHardwareSmiEntryList; GLOBAL_REMOVE_IF_UNREFERENCED LIST_ENTRY *mSmmCoreHardwareSmiEntryList = &mHardwareSmiEntryList;
GLOBAL_REMOVE_IF_UNREFERENCED IMAGE_STRUCT *mImageStruct; GLOBAL_REMOVE_IF_UNREFERENCED IMAGE_STRUCT *mImageStruct;
GLOBAL_REMOVE_IF_UNREFERENCED UINTN mImageStructCountMax; GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mImageStructCountMax;
GLOBAL_REMOVE_IF_UNREFERENCED UINTN mImageStructCount; GLOBAL_REMOVE_IF_UNREFERENCED UINT32 mImageStructCount;
GLOBAL_REMOVE_IF_UNREFERENCED VOID *mSmiHandlerProfileDatabase; GLOBAL_REMOVE_IF_UNREFERENCED VOID *mSmiHandlerProfileDatabase;
GLOBAL_REMOVE_IF_UNREFERENCED UINTN mSmiHandlerProfileDatabaseSize; GLOBAL_REMOVE_IF_UNREFERENCED UINTN mSmiHandlerProfileDatabaseSize;
@ -162,9 +165,9 @@ GetDriverGuid (
**/ **/
VOID VOID
AddImageStruct( AddImageStruct(
IN UINTN ImageBase, IN PHYSICAL_ADDRESS ImageBase,
IN UINTN ImageSize, IN UINT64 ImageSize,
IN UINTN EntryPoint, IN PHYSICAL_ADDRESS EntryPoint,
IN EFI_GUID *Guid, IN EFI_GUID *Guid,
IN CHAR8 *PdbString IN CHAR8 *PdbString
) )
@ -185,7 +188,7 @@ AddImageStruct(
PdbStringSize = AsciiStrSize(PdbString); PdbStringSize = AsciiStrSize(PdbString);
mImageStruct[mImageStructCount].PdbString = AllocateCopyPool (PdbStringSize, PdbString); mImageStruct[mImageStructCount].PdbString = AllocateCopyPool (PdbStringSize, PdbString);
if (mImageStruct[mImageStructCount].PdbString != NULL) { if (mImageStruct[mImageStructCount].PdbString != NULL) {
mImageStruct[mImageStructCount].PdbStringSize = PdbStringSize; mImageStruct[mImageStructCount].PdbStringSize = (UINT16) PdbStringSize;
} }
} }
@ -222,7 +225,7 @@ AddressToImageStruct(
@return image reference index @return image reference index
**/ **/
UINTN UINT32
AddressToImageRef( AddressToImageRef(
IN UINTN Address IN UINTN Address
) )
@ -233,7 +236,7 @@ AddressToImageRef(
if (ImageStruct != NULL) { if (ImageStruct != NULL) {
return ImageStruct->ImageRef; return ImageStruct->ImageRef;
} }
return (UINTN)-1; return (UINT32)-1;
} }
/** /**
@ -252,11 +255,11 @@ GetSmmLoadedImage(
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
CHAR16 *PathStr; CHAR16 *PathStr;
EFI_SMM_DRIVER_ENTRY *LoadedImagePrivate; EFI_SMM_DRIVER_ENTRY *LoadedImagePrivate;
UINTN EntryPoint; PHYSICAL_ADDRESS EntryPoint;
VOID *EntryPointInImage; VOID *EntryPointInImage;
EFI_GUID Guid; EFI_GUID Guid;
CHAR8 *PdbString; CHAR8 *PdbString;
UINTN RealImageBase; PHYSICAL_ADDRESS RealImageBase;
HandleBufferSize = 0; HandleBufferSize = 0;
HandleBuffer = NULL; HandleBuffer = NULL;
@ -286,7 +289,7 @@ GetSmmLoadedImage(
} }
NoHandles = HandleBufferSize/sizeof(EFI_HANDLE); NoHandles = HandleBufferSize/sizeof(EFI_HANDLE);
mImageStructCountMax = NoHandles; mImageStructCountMax = (UINT32) NoHandles;
mImageStruct = AllocateZeroPool(mImageStructCountMax * sizeof(IMAGE_STRUCT)); mImageStruct = AllocateZeroPool(mImageStructCountMax * sizeof(IMAGE_STRUCT));
if (mImageStruct == NULL) { if (mImageStruct == NULL) {
goto Done; goto Done;
@ -309,8 +312,8 @@ GetSmmLoadedImage(
LoadedImagePrivate = BASE_CR(LoadedImage, EFI_SMM_DRIVER_ENTRY, SmmLoadedImage); LoadedImagePrivate = BASE_CR(LoadedImage, EFI_SMM_DRIVER_ENTRY, SmmLoadedImage);
RealImageBase = (UINTN)LoadedImage->ImageBase; RealImageBase = (UINTN)LoadedImage->ImageBase;
if (LoadedImagePrivate->Signature == EFI_SMM_DRIVER_ENTRY_SIGNATURE) { if (LoadedImagePrivate->Signature == EFI_SMM_DRIVER_ENTRY_SIGNATURE) {
EntryPoint = (UINTN)LoadedImagePrivate->ImageEntryPoint; EntryPoint = LoadedImagePrivate->ImageEntryPoint;
if ((EntryPoint != 0) && ((EntryPoint < (UINTN)LoadedImage->ImageBase) || (EntryPoint >= ((UINTN)LoadedImage->ImageBase + (UINTN)LoadedImage->ImageSize)))) { if ((EntryPoint != 0) && ((EntryPoint < (UINTN)LoadedImage->ImageBase) || (EntryPoint >= ((UINTN)LoadedImage->ImageBase + LoadedImage->ImageSize)))) {
// //
// If the EntryPoint is not in the range of image buffer, it should come from emulation environment. // If the EntryPoint is not in the range of image buffer, it should come from emulation environment.
// So patch ImageBuffer here to align the EntryPoint. // So patch ImageBuffer here to align the EntryPoint.
@ -320,9 +323,9 @@ GetSmmLoadedImage(
RealImageBase = (UINTN)LoadedImage->ImageBase + EntryPoint - (UINTN)EntryPointInImage; RealImageBase = (UINTN)LoadedImage->ImageBase + EntryPoint - (UINTN)EntryPointInImage;
} }
} }
DEBUG ((DEBUG_INFO, "(0x%x - 0x%x", RealImageBase, (UINTN)LoadedImage->ImageSize)); DEBUG ((DEBUG_INFO, "(0x%lx - 0x%lx", RealImageBase, LoadedImage->ImageSize));
if (EntryPoint != 0) { if (EntryPoint != 0) {
DEBUG ((DEBUG_INFO, ", EntryPoint:0x%x", EntryPoint)); DEBUG ((DEBUG_INFO, ", EntryPoint:0x%lx", EntryPoint));
} }
DEBUG ((DEBUG_INFO, ")\n")); DEBUG ((DEBUG_INFO, ")\n"));
@ -334,7 +337,7 @@ GetSmmLoadedImage(
} }
DEBUG ((DEBUG_INFO, " (%s)\n", PathStr)); DEBUG ((DEBUG_INFO, " (%s)\n", PathStr));
AddImageStruct((UINTN)RealImageBase, (UINTN)LoadedImage->ImageSize, EntryPoint, &Guid, PdbString); AddImageStruct(RealImageBase, LoadedImage->ImageSize, EntryPoint, &Guid, PdbString);
} }
Done: Done:
@ -356,8 +359,10 @@ DumpSmiChildContext (
IN UINTN ContextSize IN UINTN ContextSize
) )
{ {
CHAR16 *Str;
if (CompareGuid (HandlerType, &gEfiSmmSwDispatch2ProtocolGuid)) { if (CompareGuid (HandlerType, &gEfiSmmSwDispatch2ProtocolGuid)) {
DEBUG ((DEBUG_INFO, " SwSmi - 0x%x\n", ((EFI_SMM_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue)); DEBUG ((DEBUG_INFO, " SwSmi - 0x%lx\n", ((SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue));
} else if (CompareGuid (HandlerType, &gEfiSmmSxDispatch2ProtocolGuid)) { } else if (CompareGuid (HandlerType, &gEfiSmmSxDispatch2ProtocolGuid)) {
DEBUG ((DEBUG_INFO, " SxType - 0x%x\n", ((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Type)); DEBUG ((DEBUG_INFO, " SxType - 0x%x\n", ((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Type));
DEBUG ((DEBUG_INFO, " SxPhase - 0x%x\n", ((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Phase)); DEBUG ((DEBUG_INFO, " SxPhase - 0x%x\n", ((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Phase));
@ -376,7 +381,11 @@ DumpSmiChildContext (
DEBUG ((DEBUG_INFO, " IoTrapType - 0x%x\n", ((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Type)); DEBUG ((DEBUG_INFO, " IoTrapType - 0x%x\n", ((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Type));
} else if (CompareGuid (HandlerType, &gEfiSmmUsbDispatch2ProtocolGuid)) { } else if (CompareGuid (HandlerType, &gEfiSmmUsbDispatch2ProtocolGuid)) {
DEBUG ((DEBUG_INFO, " UsbType - 0x%x\n", ((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context)->Type)); DEBUG ((DEBUG_INFO, " UsbType - 0x%x\n", ((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context)->Type));
DEBUG ((DEBUG_INFO, " UsbDevicePath - %s\n", ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE))); Str = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE);
DEBUG ((DEBUG_INFO, " UsbDevicePath - %s\n", Str));
if (Str != NULL) {
FreePool (Str);
}
} else { } else {
DEBUG ((DEBUG_INFO, " Context - ")); DEBUG ((DEBUG_INFO, " Context - "));
InternalDumpData (Context, ContextSize); InternalDumpData (Context, ContextSize);
@ -416,12 +425,12 @@ DumpSmiHandlerOnSmiEntry(
} }
DEBUG ((DEBUG_INFO, " Handler - 0x%x", SmiHandler->Handler)); DEBUG ((DEBUG_INFO, " Handler - 0x%x", SmiHandler->Handler));
if (ImageStruct != NULL) { if (ImageStruct != NULL) {
DEBUG ((DEBUG_INFO, " <== RVA - 0x%x", (UINTN)SmiHandler->Handler - ImageStruct->ImageBase)); DEBUG ((DEBUG_INFO, " <== RVA - 0x%x", (UINTN)SmiHandler->Handler - (UINTN) ImageStruct->ImageBase));
} }
DEBUG ((DEBUG_INFO, "\n")); DEBUG ((DEBUG_INFO, "\n"));
DEBUG ((DEBUG_INFO, " CallerAddr - 0x%x", SmiHandler->CallerAddr)); DEBUG ((DEBUG_INFO, " CallerAddr - 0x%x", SmiHandler->CallerAddr));
if (ImageStruct != NULL) { if (ImageStruct != NULL) {
DEBUG ((DEBUG_INFO, " <== RVA - 0x%x", SmiHandler->CallerAddr - ImageStruct->ImageBase)); DEBUG ((DEBUG_INFO, " <== RVA - 0x%x", SmiHandler->CallerAddr - (UINTN) ImageStruct->ImageBase));
} }
DEBUG ((DEBUG_INFO, "\n")); DEBUG ((DEBUG_INFO, "\n"));
} }
@ -527,11 +536,11 @@ GetSmmImageDatabaseSize(
) )
{ {
UINTN Size; UINTN Size;
UINTN Index; UINT32 Index;
Size = (sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE)) * mImageStructCount; Size = 0;
for (Index = 0; Index < mImageStructCount; Index++) { for (Index = 0; Index < mImageStructCount; Index++) {
Size += mImageStruct[Index].PdbStringSize; Size += sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE) + GET_OCCUPIED_SIZE (mImageStruct[Index].PdbStringSize, sizeof (UINT64));
} }
return Size; return Size;
} }
@ -558,7 +567,7 @@ GetSmmSmiHandlerSizeOnSmiEntry(
ListEntry != &SmiEntry->SmiHandlers; ListEntry != &SmiEntry->SmiHandlers;
ListEntry = ListEntry->ForwardLink) { ListEntry = ListEntry->ForwardLink) {
SmiHandler = CR(ListEntry, SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE); SmiHandler = CR(ListEntry, SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
Size += sizeof(SMM_CORE_SMI_HANDLER_STRUCTURE) + SmiHandler->ContextSize; Size += sizeof(SMM_CORE_SMI_HANDLER_STRUCTURE) + GET_OCCUPIED_SIZE (SmiHandler->ContextSize, sizeof (UINT64));
} }
return Size; return Size;
@ -634,21 +643,25 @@ GetSmmImageDatabaseData (
if (Size >= ExpectedSize) { if (Size >= ExpectedSize) {
return 0; return 0;
} }
if (sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE) + mImageStruct[Index].PdbStringSize > ExpectedSize - Size) { if (sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE) + GET_OCCUPIED_SIZE (mImageStruct[Index].PdbStringSize, sizeof (UINT64)) > ExpectedSize - Size) {
return 0; return 0;
} }
ImageStruct->Header.Signature = SMM_CORE_IMAGE_DATABASE_SIGNATURE; ImageStruct->Header.Signature = SMM_CORE_IMAGE_DATABASE_SIGNATURE;
ImageStruct->Header.Length = (UINT32)(sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE) + mImageStruct[Index].PdbStringSize); ImageStruct->Header.Length = (UINT32)(sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE) + GET_OCCUPIED_SIZE (mImageStruct[Index].PdbStringSize, sizeof (UINT64)));
ImageStruct->Header.Revision = SMM_CORE_IMAGE_DATABASE_REVISION; ImageStruct->Header.Revision = SMM_CORE_IMAGE_DATABASE_REVISION;
CopyGuid(&ImageStruct->FileGuid, &mImageStruct[Index].FileGuid); CopyGuid(&ImageStruct->FileGuid, &mImageStruct[Index].FileGuid);
ImageStruct->ImageRef = mImageStruct[Index].ImageRef; ImageStruct->ImageRef = mImageStruct[Index].ImageRef;
ImageStruct->EntryPoint = mImageStruct[Index].EntryPoint; ImageStruct->EntryPoint = mImageStruct[Index].EntryPoint;
ImageStruct->ImageBase = mImageStruct[Index].ImageBase; ImageStruct->ImageBase = mImageStruct[Index].ImageBase;
ImageStruct->ImageSize = mImageStruct[Index].ImageSize; ImageStruct->ImageSize = mImageStruct[Index].ImageSize;
if (mImageStruct[Index].PdbStringSize != 0) {
ImageStruct->PdbStringOffset = sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE); ImageStruct->PdbStringOffset = sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE);
CopyMem ((VOID *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset), mImageStruct[Index].PdbString, mImageStruct[Index].PdbStringSize); CopyMem ((VOID *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset), mImageStruct[Index].PdbString, mImageStruct[Index].PdbStringSize);
} else {
ImageStruct->PdbStringOffset = 0;
}
ImageStruct = (SMM_CORE_IMAGE_DATABASE_STRUCTURE *)((UINTN)ImageStruct + ImageStruct->Header.Length); ImageStruct = (SMM_CORE_IMAGE_DATABASE_STRUCTURE *)((UINTN)ImageStruct + ImageStruct->Header.Length);
Size += sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE) + mImageStruct[Index].PdbStringSize; Size += sizeof(SMM_CORE_IMAGE_DATABASE_STRUCTURE) + GET_OCCUPIED_SIZE (mImageStruct[Index].PdbStringSize, sizeof (UINT64));
} }
if (ExpectedSize != Size) { if (ExpectedSize != Size) {
@ -672,7 +685,7 @@ GetSmmSmiHandlerDataOnSmiEntry(
IN SMI_ENTRY *SmiEntry, IN SMI_ENTRY *SmiEntry,
IN OUT VOID *Data, IN OUT VOID *Data,
IN UINTN MaxSize, IN UINTN MaxSize,
OUT UINTN *Count OUT UINT32 *Count
) )
{ {
SMM_CORE_SMI_HANDLER_STRUCTURE *SmiHandlerStruct; SMM_CORE_SMI_HANDLER_STRUCTURE *SmiHandlerStruct;
@ -692,11 +705,11 @@ GetSmmSmiHandlerDataOnSmiEntry(
*Count = 0; *Count = 0;
return 0; return 0;
} }
if (sizeof(SMM_CORE_SMI_HANDLER_STRUCTURE) + SmiHandler->ContextSize > MaxSize - Size) { if (sizeof(SMM_CORE_SMI_HANDLER_STRUCTURE) + GET_OCCUPIED_SIZE (SmiHandler->ContextSize, sizeof (UINT64)) > MaxSize - Size) {
*Count = 0; *Count = 0;
return 0; return 0;
} }
SmiHandlerStruct->Length = (UINT32)(sizeof(SMM_CORE_SMI_HANDLER_STRUCTURE) + SmiHandler->ContextSize); SmiHandlerStruct->Length = (UINT32)(sizeof(SMM_CORE_SMI_HANDLER_STRUCTURE) + GET_OCCUPIED_SIZE (SmiHandler->ContextSize, sizeof (UINT64)));
SmiHandlerStruct->CallerAddr = (UINTN)SmiHandler->CallerAddr; SmiHandlerStruct->CallerAddr = (UINTN)SmiHandler->CallerAddr;
SmiHandlerStruct->Handler = (UINTN)SmiHandler->Handler; SmiHandlerStruct->Handler = (UINTN)SmiHandler->Handler;
SmiHandlerStruct->ImageRef = AddressToImageRef((UINTN)SmiHandler->Handler); SmiHandlerStruct->ImageRef = AddressToImageRef((UINTN)SmiHandler->Handler);
@ -707,7 +720,7 @@ GetSmmSmiHandlerDataOnSmiEntry(
} else { } else {
SmiHandlerStruct->ContextBufferOffset = 0; SmiHandlerStruct->ContextBufferOffset = 0;
} }
Size += sizeof(SMM_CORE_SMI_HANDLER_STRUCTURE) + SmiHandler->ContextSize; Size += sizeof(SMM_CORE_SMI_HANDLER_STRUCTURE) + GET_OCCUPIED_SIZE (SmiHandler->ContextSize, sizeof (UINT64));
SmiHandlerStruct = (SMM_CORE_SMI_HANDLER_STRUCTURE *)((UINTN)SmiHandlerStruct + SmiHandlerStruct->Length); SmiHandlerStruct = (SMM_CORE_SMI_HANDLER_STRUCTURE *)((UINTN)SmiHandlerStruct + SmiHandlerStruct->Length);
*Count = *Count + 1; *Count = *Count + 1;
} }
@ -738,7 +751,7 @@ GetSmmSmiDatabaseData(
SMI_ENTRY *SmiEntry; SMI_ENTRY *SmiEntry;
UINTN Size; UINTN Size;
UINTN SmiHandlerSize; UINTN SmiHandlerSize;
UINTN SmiHandlerCount; UINT32 SmiHandlerCount;
SmiStruct = Data; SmiStruct = Data;
Size = 0; Size = 0;
@ -1122,6 +1135,36 @@ ConvertSmiHandlerUsbContext (
return SmiHandlerUsbContext; return SmiHandlerUsbContext;
} }
/**
Convert EFI_SMM_SW_REGISTER_CONTEXT to SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT.
@param SwContext A pointer to EFI_SMM_SW_REGISTER_CONTEXT
@param SwContextSize The size of EFI_SMM_SW_REGISTER_CONTEXT in bytes
@param SmiHandlerSwContextSize The size of SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT in bytes
@return SmiHandlerSwContext A pointer to SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT
**/
SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT *
ConvertSmiHandlerSwContext (
IN EFI_SMM_SW_REGISTER_CONTEXT *SwContext,
IN UINTN SwContextSize,
OUT UINTN *SmiHandlerSwContextSize
)
{
SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT *SmiHandlerSwContext;
ASSERT (SwContextSize == sizeof(EFI_SMM_SW_REGISTER_CONTEXT));
SmiHandlerSwContext = AllocatePool (sizeof (SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT));
if (SmiHandlerSwContext == NULL) {
*SmiHandlerSwContextSize = 0;
return NULL;
}
SmiHandlerSwContext->SwSmiInputValue = SwContext->SwSmiInputValue;
*SmiHandlerSwContextSize = sizeof (SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT);
return SmiHandlerSwContext;
}
/** /**
This function is called by SmmChildDispatcher module to report This function is called by SmmChildDispatcher module to report
a new SMI handler is registered, to SmmCore. a new SMI handler is registered, to SmmCore.
@ -1176,6 +1219,8 @@ SmiHandlerProfileRegisterHandler (
if (Context != NULL) { if (Context != NULL) {
if (CompareGuid (HandlerGuid, &gEfiSmmUsbDispatch2ProtocolGuid)) { if (CompareGuid (HandlerGuid, &gEfiSmmUsbDispatch2ProtocolGuid)) {
SmiHandler->Context = ConvertSmiHandlerUsbContext (Context, ContextSize, &SmiHandler->ContextSize); SmiHandler->Context = ConvertSmiHandlerUsbContext (Context, ContextSize, &SmiHandler->ContextSize);
} else if (CompareGuid (HandlerGuid, &gEfiSmmSwDispatch2ProtocolGuid)) {
SmiHandler->Context = ConvertSmiHandlerSwContext (Context, ContextSize, &SmiHandler->ContextSize);
} else { } else {
SmiHandler->Context = AllocateCopyPool (ContextSize, Context); SmiHandler->Context = AllocateCopyPool (ContextSize, Context);
} }
@ -1251,6 +1296,8 @@ SmiHandlerProfileUnregisterHandler (
if (Context != NULL) { if (Context != NULL) {
if (CompareGuid (HandlerGuid, &gEfiSmmUsbDispatch2ProtocolGuid)) { if (CompareGuid (HandlerGuid, &gEfiSmmUsbDispatch2ProtocolGuid)) {
SearchContext = ConvertSmiHandlerUsbContext (Context, ContextSize, &SearchContextSize); SearchContext = ConvertSmiHandlerUsbContext (Context, ContextSize, &SearchContextSize);
} else if (CompareGuid (HandlerGuid, &gEfiSmmSwDispatch2ProtocolGuid)) {
SearchContext = ConvertSmiHandlerSwContext (Context, ContextSize, &SearchContextSize);
} }
} }

View File

@ -25,12 +25,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/SmmSxDispatch2.h> #include <Protocol/SmmSxDispatch2.h>
#include <Protocol/SmmUsbDispatch2.h> #include <Protocol/SmmUsbDispatch2.h>
#pragma pack(1)
typedef struct { typedef struct {
UINT32 Signature; UINT32 Signature;
UINT32 Length; UINT32 Length;
UINT32 Revision; UINT32 Revision;
UINT8 Reserved[4];
} SMM_CORE_DATABASE_COMMON_HEADER; } SMM_CORE_DATABASE_COMMON_HEADER;
#define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D') #define SMM_CORE_IMAGE_DATABASE_SIGNATURE SIGNATURE_32 ('S','C','I','D')
@ -39,12 +38,12 @@ typedef struct {
typedef struct { typedef struct {
SMM_CORE_DATABASE_COMMON_HEADER Header; SMM_CORE_DATABASE_COMMON_HEADER Header;
EFI_GUID FileGuid; EFI_GUID FileGuid;
UINTN ImageRef; PHYSICAL_ADDRESS EntryPoint;
UINTN EntryPoint; PHYSICAL_ADDRESS ImageBase;
UINTN ImageBase; UINT64 ImageSize;
UINTN ImageSize; UINT32 ImageRef;
UINT16 PdbStringOffset; UINT16 PdbStringOffset;
UINT8 Reserved2[6]; UINT8 Reserved[2];
//CHAR8 PdbString[]; //CHAR8 PdbString[];
} SMM_CORE_IMAGE_DATABASE_STRUCTURE; } SMM_CORE_IMAGE_DATABASE_STRUCTURE;
@ -64,7 +63,7 @@ typedef enum {
// NULL // NULL
// Context for SmmCoreSmiHandlerCategoryHardwareHandler: // Context for SmmCoreSmiHandlerCategoryHardwareHandler:
// (NOTE: The context field should NOT include any data pointer.) // (NOTE: The context field should NOT include any data pointer.)
// gEfiSmmSwDispatch2ProtocolGuid: EFI_SMM_SW_REGISTER_CONTEXT // gEfiSmmSwDispatch2ProtocolGuid: (EFI_SMM_SW_REGISTER_CONTEXT => SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT)
// gEfiSmmSxDispatch2ProtocolGuid: EFI_SMM_SX_REGISTER_CONTEXT // gEfiSmmSxDispatch2ProtocolGuid: EFI_SMM_SX_REGISTER_CONTEXT
// gEfiSmmPowerButtonDispatch2ProtocolGuid: EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT // gEfiSmmPowerButtonDispatch2ProtocolGuid: EFI_SMM_POWER_BUTTON_REGISTER_CONTEXT
// gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT // gEfiSmmStandbyButtonDispatch2ProtocolGuid: EFI_SMM_STANDBY_BUTTON_REGISTER_CONTEXT
@ -80,22 +79,26 @@ typedef struct {
//UINT8 DevicePath[DevicePathSize]; //UINT8 DevicePath[DevicePathSize];
} SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT; } SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT;
typedef struct {
UINT64 SwSmiInputValue;
} SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT;
typedef struct { typedef struct {
UINT32 Length; UINT32 Length;
UINTN CallerAddr; UINT32 ImageRef;
UINTN Handler; PHYSICAL_ADDRESS CallerAddr;
UINTN ImageRef; PHYSICAL_ADDRESS Handler;
UINT16 ContextBufferOffset; UINT16 ContextBufferOffset;
UINT8 Reserved2[2]; UINT8 Reserved[2];
UINT32 ContextBufferSize; UINT32 ContextBufferSize;
//UINT8 ContextBuffer[]; //UINT8 ContextBuffer[];
} SMM_CORE_SMI_HANDLER_STRUCTURE; } SMM_CORE_SMI_HANDLER_STRUCTURE;
typedef struct { typedef struct {
SMM_CORE_DATABASE_COMMON_HEADER Header; SMM_CORE_DATABASE_COMMON_HEADER Header;
UINT32 HandlerCategory;
EFI_GUID HandlerType; EFI_GUID HandlerType;
UINTN HandlerCount; UINT32 HandlerCategory;
UINT32 HandlerCount;
//SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount]; //SMM_CORE_SMI_HANDLER_STRUCTURE Handler[HandlerCount];
} SMM_CORE_SMI_DATABASE_STRUCTURE; } SMM_CORE_SMI_DATABASE_STRUCTURE;
@ -144,8 +147,6 @@ typedef struct {
#define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}} #define SMI_HANDLER_PROFILE_GUID {0x49174342, 0x7108, 0x409b, {0x8b, 0xbe, 0x65, 0xfd, 0xa8, 0x53, 0x89, 0xf5}}
#pragma pack()
extern EFI_GUID gSmiHandlerProfileGuid; extern EFI_GUID gSmiHandlerProfileGuid;
typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL; typedef struct _SMI_HANDLER_PROFILE_PROTOCOL SMI_HANDLER_PROFILE_PROTOCOL;

View File

@ -1302,7 +1302,7 @@ BootMaintCallback (
} else if ((QuestionId >= CON_OUT_DEVICE_QUESTION_ID) && (QuestionId < CON_OUT_DEVICE_QUESTION_ID + MAX_MENU_NUMBER)) { } else if ((QuestionId >= CON_OUT_DEVICE_QUESTION_ID) && (QuestionId < CON_OUT_DEVICE_QUESTION_ID + MAX_MENU_NUMBER)) {
UpdateConsoleContent (L"ConOut", CurrentFakeNVMap); UpdateConsoleContent (L"ConOut", CurrentFakeNVMap);
} else if ((QuestionId >= CON_ERR_DEVICE_QUESTION_ID) && (QuestionId < CON_ERR_DEVICE_QUESTION_ID + MAX_MENU_NUMBER)) { } else if ((QuestionId >= CON_ERR_DEVICE_QUESTION_ID) && (QuestionId < CON_ERR_DEVICE_QUESTION_ID + MAX_MENU_NUMBER)) {
UpdateConsoleContent (L"ConErr", CurrentFakeNVMap); UpdateConsoleContent (L"ErrOut", CurrentFakeNVMap);
} }
} }

View File

@ -1031,6 +1031,7 @@ GetConsoleInCheck (
BM_MENU_ENTRY *NewMenuEntry; BM_MENU_ENTRY *NewMenuEntry;
UINT8 *ConInCheck; UINT8 *ConInCheck;
BM_CONSOLE_CONTEXT *NewConsoleContext; BM_CONSOLE_CONTEXT *NewConsoleContext;
BM_TERMINAL_CONTEXT *NewTerminalContext;
ASSERT (CallbackData != NULL); ASSERT (CallbackData != NULL);
@ -1041,6 +1042,13 @@ GetConsoleInCheck (
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
ConInCheck[Index] = NewConsoleContext->IsActive; ConInCheck[Index] = NewConsoleContext->IsActive;
} }
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
ASSERT (Index + ConsoleInpMenu.MenuNumber < MAX_MENU_NUMBER);
ConInCheck[Index + ConsoleInpMenu.MenuNumber] = NewTerminalContext->IsConIn;
}
} }
/** /**
@ -1060,6 +1068,7 @@ GetConsoleOutCheck (
BM_MENU_ENTRY *NewMenuEntry; BM_MENU_ENTRY *NewMenuEntry;
UINT8 *ConOutCheck; UINT8 *ConOutCheck;
BM_CONSOLE_CONTEXT *NewConsoleContext; BM_CONSOLE_CONTEXT *NewConsoleContext;
BM_TERMINAL_CONTEXT *NewTerminalContext;
ASSERT (CallbackData != NULL); ASSERT (CallbackData != NULL);
ConOutCheck = &CallbackData->BmmFakeNvData.ConsoleOutCheck[0]; ConOutCheck = &CallbackData->BmmFakeNvData.ConsoleOutCheck[0];
@ -1069,6 +1078,13 @@ GetConsoleOutCheck (
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
ConOutCheck[Index] = NewConsoleContext->IsActive; ConOutCheck[Index] = NewConsoleContext->IsActive;
} }
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
ASSERT (Index + ConsoleOutMenu.MenuNumber < MAX_MENU_NUMBER);
ConOutCheck[Index + ConsoleOutMenu.MenuNumber] = NewTerminalContext->IsConOut;
}
} }
/** /**
@ -1088,6 +1104,7 @@ GetConsoleErrCheck (
BM_MENU_ENTRY *NewMenuEntry; BM_MENU_ENTRY *NewMenuEntry;
UINT8 *ConErrCheck; UINT8 *ConErrCheck;
BM_CONSOLE_CONTEXT *NewConsoleContext; BM_CONSOLE_CONTEXT *NewConsoleContext;
BM_TERMINAL_CONTEXT *NewTerminalContext;
ASSERT (CallbackData != NULL); ASSERT (CallbackData != NULL);
ConErrCheck = &CallbackData->BmmFakeNvData.ConsoleErrCheck[0]; ConErrCheck = &CallbackData->BmmFakeNvData.ConsoleErrCheck[0];
@ -1097,6 +1114,13 @@ GetConsoleErrCheck (
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
ConErrCheck[Index] = NewConsoleContext->IsActive; ConErrCheck[Index] = NewConsoleContext->IsActive;
} }
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
ASSERT (Index + ConsoleErrMenu.MenuNumber < MAX_MENU_NUMBER);
ConErrCheck[Index + ConsoleErrMenu.MenuNumber] = NewTerminalContext->IsStdErr;
}
} }
/** /**

View File

@ -126,6 +126,7 @@ BrotliDecompress (
BrotliState * BroState; BrotliState * BroState;
VOID * Temp; VOID * Temp;
TotalOut = 0;
AvailableOut = FILE_BUFFER_SIZE; AvailableOut = FILE_BUFFER_SIZE;
Result = BROTLI_RESULT_ERROR; Result = BROTLI_RESULT_ERROR;
BroState = BrotliCreateState(BrAlloc, BrFree, BuffInfo); BroState = BrotliCreateState(BrAlloc, BrFree, BuffInfo);

View File

@ -802,6 +802,7 @@ static BROTLI_INLINE uint32_t ReadBlockLength(const HuffmanCode* table,
uint32_t code; uint32_t code;
uint32_t nbits; uint32_t nbits;
code = ReadSymbol(table, br); code = ReadSymbol(table, br);
if (code >= BROTLI_NUM_BLOCK_LEN_SYMBOLS) code = BROTLI_NUM_BLOCK_LEN_SYMBOLS - 1;
nbits = kBlockLengthPrefixCode[code].nbits; /* nbits == 2..24 */ nbits = kBlockLengthPrefixCode[code].nbits; /* nbits == 2..24 */
return kBlockLengthPrefixCode[code].offset + BrotliReadBits(br, nbits); return kBlockLengthPrefixCode[code].offset + BrotliReadBits(br, nbits);
} }
@ -854,6 +855,7 @@ static BROTLI_NOINLINE void InverseMoveToFrontTransform(
uint32_t i = 4; uint32_t i = 4;
uint32_t upper_bound = state->mtf_upper_bound; uint32_t upper_bound = state->mtf_upper_bound;
uint8_t* mtf = &state->mtf[4]; /* Make mtf[-1] addressable. */ uint8_t* mtf = &state->mtf[4]; /* Make mtf[-1] addressable. */
uint8_t* mtft = &state->mtf[3];
/* Load endian-aware constant. */ /* Load endian-aware constant. */
const uint8_t b0123[4] = {0, 1, 2, 3}; const uint8_t b0123[4] = {0, 1, 2, 3};
uint32_t pattern; uint32_t pattern;
@ -872,13 +874,13 @@ static BROTLI_NOINLINE void InverseMoveToFrontTransform(
for (i = 0; i < v_len; ++i) { for (i = 0; i < v_len; ++i) {
int index = v[i]; int index = v[i];
uint8_t value = mtf[index]; uint8_t value = mtf[index];
upper_bound |= v[i]; upper_bound |= (uint32_t)v[i];
v[i] = value; v[i] = value;
mtf[-1] = value; mtft[0] = value;
do { while (index >= 0) {
mtft[index + 1] = mtft[index];
index--; index--;
mtf[index + 1] = mtf[index]; }
} while (index >= 0);
} }
/* Remember amount of elements to be reinitialized. */ /* Remember amount of elements to be reinitialized. */
state->mtf_upper_bound = upper_bound; state->mtf_upper_bound = upper_bound;
@ -1498,6 +1500,7 @@ static BROTLI_INLINE BROTLI_BOOL ReadCommandInternal(
return BROTLI_FALSE; return BROTLI_FALSE;
} }
} }
if (cmd_code >= BROTLI_NUM_COMMAND_SYMBOLS) cmd_code = BROTLI_NUM_COMMAND_SYMBOLS - 1;
v = kCmdLut[cmd_code]; v = kCmdLut[cmd_code];
s->distance_code = v.distance_code; s->distance_code = v.distance_code;
s->distance_context = v.context; s->distance_context = v.context;
@ -2209,7 +2212,9 @@ BrotliDecoderResult BrotliDecoderDecompressStream(
} }
s->max_distance = s->max_backward_distance; s->max_distance = s->max_backward_distance;
if (s->state == BROTLI_STATE_COMMAND_POST_WRITE_1) { if (s->state == BROTLI_STATE_COMMAND_POST_WRITE_1) {
if (s->ringbuffer != 0) {
memcpy(s->ringbuffer, s->ringbuffer_end, (size_t)s->pos); memcpy(s->ringbuffer, s->ringbuffer_end, (size_t)s->pos);
}
if (s->meta_block_remaining_len == 0) { if (s->meta_block_remaining_len == 0) {
/* Next metablock, if any */ /* Next metablock, if any */
s->state = BROTLI_STATE_METABLOCK_DONE; s->state = BROTLI_STATE_METABLOCK_DONE;

View File

@ -540,9 +540,12 @@ CreateDeviceManagerForm(
// Update the network device form titile. // Update the network device form titile.
// //
if (NextShowFormId == NETWORK_DEVICE_FORM_ID) { if (NextShowFormId == NETWORK_DEVICE_FORM_ID) {
String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NULL); String = HiiGetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE_HEAD), NULL);
NewStringLen = StrLen(mSelectedMacAddrString) * 2; if (String == NULL) {
NewStringLen += (StrLen(String) + 2) * 2; return;
}
NewStringLen = StrLen (mSelectedMacAddrString) * 2;
NewStringLen += (StrLen (String) + 2) * 2;
NewStringTitle = AllocatePool (NewStringLen); NewStringTitle = AllocatePool (NewStringLen);
UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString); UnicodeSPrint (NewStringTitle, NewStringLen, L"%s %s", String, mSelectedMacAddrString);
HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL); HiiSetString (HiiHandle, STRING_TOKEN (STR_FORM_NETWORK_DEVICE_TITLE), NewStringTitle, NULL);

View File

@ -2,7 +2,7 @@
// //
// String definitions for the Device Manager. // String definitions for the Device Manager.
// //
// Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR> // Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
// This program and the accompanying materials // This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License // are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at // which accompanies this distribution. The full text of the license may be found at
@ -42,6 +42,7 @@
#language fr-FR "" #language fr-FR ""
#string STR_EXIT_STRING #language en-US "Press ESC to exit." #string STR_EXIT_STRING #language en-US "Press ESC to exit."
#language fr-FR "Press ESC to exit." #language fr-FR "Press ESC to exit."
#string STR_FORM_NETWORK_DEVICE_TITLE_HEAD #language en-US "Network Device"
#string STR_FORM_NETWORK_DEVICE_TITLE #language en-US "Network Device" #string STR_FORM_NETWORK_DEVICE_TITLE #language en-US "Network Device"
#language fr-FR "Network Device" #language fr-FR "Network Device"
#string STR_FORM_NETWORK_DEVICE_HELP #language en-US "Network Device Help..." #string STR_FORM_NETWORK_DEVICE_HELP #language en-US "Network Device Help..."

View File

@ -1028,6 +1028,12 @@ IpIoListenHandlerDpc (
} }
if (IpIo->IpVersion == IP_VERSION_4) { if (IpIo->IpVersion == IP_VERSION_4) {
if (IP4_IS_LOCAL_BROADCAST (EFI_IP4 (RxData->Ip4RxData.Header->SourceAddress))) {
//
// The source address is a broadcast address, discard it.
//
goto CleanUp;
}
if ((EFI_IP4 (RxData->Ip4RxData.Header->SourceAddress) != 0) && if ((EFI_IP4 (RxData->Ip4RxData.Header->SourceAddress) != 0) &&
(IpIo->SubnetMask != 0) && (IpIo->SubnetMask != 0) &&
IP4_NET_EQUAL (IpIo->StationIp, EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), IpIo->SubnetMask) && IP4_NET_EQUAL (IpIo->StationIp, EFI_NTOHL (((EFI_IP4_RECEIVE_DATA *) RxData)->Header->SourceAddress), IpIo->SubnetMask) &&

View File

@ -1546,6 +1546,14 @@ BmGetNextLoadOptionDevicePath (
// //
return BmExpandUriDevicePath (FilePath, FullPath); return BmExpandUriDevicePath (FilePath, FullPath);
} else { } else {
Node = FilePath;
Status = gBS->LocateDevicePath (&gEfiUsbIoProtocolGuid, &Node, &Handle);
if (EFI_ERROR (Status)) {
//
// Only expand the USB WWID/Class device path
// when FilePath doesn't point to a physical UsbIo controller.
// Otherwise, infinite recursion will happen.
//
for (Node = FilePath; !IsDevicePathEnd (Node); Node = NextDevicePathNode (Node)) { for (Node = FilePath; !IsDevicePathEnd (Node); Node = NextDevicePathNode (Node)) {
if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) && if ((DevicePathType (Node) == MESSAGING_DEVICE_PATH) &&
((DevicePathSubType (Node) == MSG_USB_CLASS_DP) || (DevicePathSubType (Node) == MSG_USB_WWID_DP))) { ((DevicePathSubType (Node) == MSG_USB_CLASS_DP) || (DevicePathSubType (Node) == MSG_USB_WWID_DP))) {
@ -1568,6 +1576,7 @@ BmGetNextLoadOptionDevicePath (
return BmExpandUsbDevicePath (FilePath, FullPath, Node); return BmExpandUsbDevicePath (FilePath, FullPath, Node);
} }
} }
}
// //
// For the below cases, FilePath only expands to one Full path. // For the below cases, FilePath only expands to one Full path.

View File

@ -382,13 +382,13 @@ BmGetNetworkDescription (
// //
// The PXE device path is like: // The PXE device path is like:
// ....../Mac(...)[/Vlan(...)] // ....../Mac(...)[/Vlan(...)][/Wi-Fi(...)]
// ....../Mac(...)[/Vlan(...)]/IPv4(...) // ....../Mac(...)[/Vlan(...)][/Wi-Fi(...)]/IPv4(...)
// ....../Mac(...)[/Vlan(...)]/IPv6(...) // ....../Mac(...)[/Vlan(...)][/Wi-Fi(...)]/IPv6(...)
// //
// The HTTP device path is like: // The HTTP device path is like:
// ....../Mac(...)[/Vlan(...)]/IPv4(...)/Uri(...) // ....../Mac(...)[/Vlan(...)][/Wi-Fi(...)]/IPv4(...)/Uri(...)
// ....../Mac(...)[/Vlan(...)]/IPv6(...)/Uri(...) // ....../Mac(...)[/Vlan(...)][/Wi-Fi(...)]/IPv6(...)/Uri(...)
// //
while (!IsDevicePathEnd (DevicePath) && while (!IsDevicePathEnd (DevicePath) &&
((DevicePathType (DevicePath) != MESSAGING_DEVICE_PATH) || ((DevicePathType (DevicePath) != MESSAGING_DEVICE_PATH) ||
@ -404,6 +404,9 @@ BmGetNetworkDescription (
Mac = (MAC_ADDR_DEVICE_PATH *) DevicePath; Mac = (MAC_ADDR_DEVICE_PATH *) DevicePath;
DevicePath = NextDevicePathNode (DevicePath); DevicePath = NextDevicePathNode (DevicePath);
//
// Locate the optional Vlan node
//
if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&
(DevicePathSubType (DevicePath) == MSG_VLAN_DP) (DevicePathSubType (DevicePath) == MSG_VLAN_DP)
) { ) {
@ -413,6 +416,18 @@ BmGetNetworkDescription (
Vlan = NULL; Vlan = NULL;
} }
//
// Skip the optional Wi-Fi node
//
if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&
(DevicePathSubType (DevicePath) == MSG_WIFI_DP)
) {
DevicePath = NextDevicePathNode (DevicePath);
}
//
// Locate the IP node
//
if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&
((DevicePathSubType (DevicePath) == MSG_IPv4_DP) || ((DevicePathSubType (DevicePath) == MSG_IPv4_DP) ||
(DevicePathSubType (DevicePath) == MSG_IPv6_DP)) (DevicePathSubType (DevicePath) == MSG_IPv6_DP))
@ -423,6 +438,9 @@ BmGetNetworkDescription (
Ip = NULL; Ip = NULL;
} }
//
// Locate the URI node
//
if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) && if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&
(DevicePathSubType (DevicePath) == MSG_URI_DP) (DevicePathSubType (DevicePath) == MSG_URI_DP)
) { ) {

View File

@ -42,7 +42,7 @@ VOID *mBmTxtInExRegistration = NULL;
**/ **/
UINTN UINTN
BmSizeOfKeyOption ( BmSizeOfKeyOption (
EFI_BOOT_MANAGER_KEY_OPTION *KeyOption IN CONST EFI_BOOT_MANAGER_KEY_OPTION *KeyOption
) )
{ {
return OFFSET_OF (EFI_BOOT_MANAGER_KEY_OPTION, Keys) return OFFSET_OF (EFI_BOOT_MANAGER_KEY_OPTION, Keys)
@ -61,7 +61,7 @@ BmSizeOfKeyOption (
**/ **/
BOOLEAN BOOLEAN
BmIsKeyOptionValid ( BmIsKeyOptionValid (
IN EFI_BOOT_MANAGER_KEY_OPTION *KeyOption, IN CONST EFI_BOOT_MANAGER_KEY_OPTION *KeyOption,
IN UINTN KeyOptionSize IN UINTN KeyOptionSize
) )
{ {
@ -158,16 +158,15 @@ BmCollectKeyOptions (
{ {
UINTN Index; UINTN Index;
BM_COLLECT_KEY_OPTIONS_PARAM *Param; BM_COLLECT_KEY_OPTIONS_PARAM *Param;
EFI_BOOT_MANAGER_KEY_OPTION *KeyOption; VOID *KeyOption;
UINT16 OptionNumber; UINT16 OptionNumber;
UINTN KeyOptionSize; UINTN KeyOptionSize;
Param = (BM_COLLECT_KEY_OPTIONS_PARAM *) Context; Param = (BM_COLLECT_KEY_OPTIONS_PARAM *) Context;
if (BmIsKeyOptionVariable (Name, Guid, &OptionNumber)) { if (BmIsKeyOptionVariable (Name, Guid, &OptionNumber)) {
GetEfiGlobalVariable2 (Name, (VOID**) &KeyOption, &KeyOptionSize); GetEfiGlobalVariable2 (Name, &KeyOption, &KeyOptionSize);
ASSERT (KeyOption != NULL); ASSERT (KeyOption != NULL);
KeyOption->OptionNumber = OptionNumber;
if (BmIsKeyOptionValid (KeyOption, KeyOptionSize)) { if (BmIsKeyOptionValid (KeyOption, KeyOptionSize)) {
Param->KeyOptions = ReallocatePool ( Param->KeyOptions = ReallocatePool (
Param->KeyOptionCount * sizeof (EFI_BOOT_MANAGER_KEY_OPTION), Param->KeyOptionCount * sizeof (EFI_BOOT_MANAGER_KEY_OPTION),
@ -179,12 +178,13 @@ BmCollectKeyOptions (
// Insert the key option in order // Insert the key option in order
// //
for (Index = 0; Index < Param->KeyOptionCount; Index++) { for (Index = 0; Index < Param->KeyOptionCount; Index++) {
if (KeyOption->OptionNumber < Param->KeyOptions[Index].OptionNumber) { if (OptionNumber < Param->KeyOptions[Index].OptionNumber) {
break; break;
} }
} }
CopyMem (&Param->KeyOptions[Index + 1], &Param->KeyOptions[Index], (Param->KeyOptionCount - Index) * sizeof (EFI_BOOT_MANAGER_KEY_OPTION)); CopyMem (&Param->KeyOptions[Index + 1], &Param->KeyOptions[Index], (Param->KeyOptionCount - Index) * sizeof (EFI_BOOT_MANAGER_KEY_OPTION));
CopyMem (&Param->KeyOptions[Index], KeyOption, BmSizeOfKeyOption (KeyOption)); CopyMem (&Param->KeyOptions[Index], KeyOption, KeyOptionSize);
Param->KeyOptions[Index].OptionNumber = OptionNumber;
Param->KeyOptionCount++; Param->KeyOptionCount++;
} }
FreePool (KeyOption); FreePool (KeyOption);

View File

@ -1,7 +1,7 @@
/** @file /** @file
Logo DXE Driver, install Edkii Platform Logo protocol. Logo DXE Driver, install Edkii Platform Logo protocol.
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -133,7 +133,10 @@ InitializeLogo (
NULL, NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL EFI_OPEN_PROTOCOL_GET_PROTOCOL
); );
ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "HII Image Package with logo not found in PE/COFF resource section\n"));
return Status;
}
// //
// Publish HII package list to HII Database. // Publish HII package list to HII Database.

View File

@ -24,7 +24,7 @@
PACKAGE_NAME = MdeModulePkg PACKAGE_NAME = MdeModulePkg
PACKAGE_UNI_FILE = MdeModulePkg.uni PACKAGE_UNI_FILE = MdeModulePkg.uni
PACKAGE_GUID = BA0D78D6-2CAF-414b-BD4D-B6762A894288 PACKAGE_GUID = BA0D78D6-2CAF-414b-BD4D-B6762A894288
PACKAGE_VERSION = 0.96 PACKAGE_VERSION = 0.97
[Includes] [Includes]
Include Include

View File

@ -2,7 +2,7 @@
# EFI/PI Reference Module Package for All Architectures # EFI/PI Reference Module Package for All Architectures
# #
# (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR> # (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
# #
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -17,7 +17,7 @@
[Defines] [Defines]
PLATFORM_NAME = MdeModule PLATFORM_NAME = MdeModule
PLATFORM_GUID = 587CE499-6CBE-43cd-94E2-186218569478 PLATFORM_GUID = 587CE499-6CBE-43cd-94E2-186218569478
PLATFORM_VERSION = 0.96 PLATFORM_VERSION = 0.97
DSC_SPECIFICATION = 0x00010005 DSC_SPECIFICATION = 0x00010005
OUTPUT_DIRECTORY = Build/MdeModule OUTPUT_DIRECTORY = Build/MdeModule
SUPPORTED_ARCHITECTURES = IA32|IPF|X64|EBC|ARM|AARCH64 SUPPORTED_ARCHITECTURES = IA32|IPF|X64|EBC|ARM|AARCH64

View File

@ -103,7 +103,7 @@ S3BootScriptExecutorEntryFunction (
// //
// X64 S3 Resume // X64 S3 Resume
// //
DEBUG ((EFI_D_ERROR, "Call AsmDisablePaging64() to return to S3 Resume in PEI Phase\n")); DEBUG ((DEBUG_INFO, "Call AsmDisablePaging64() to return to S3 Resume in PEI Phase\n"));
PeiS3ResumeState->AsmTransferControl = (EFI_PHYSICAL_ADDRESS)(UINTN)AsmTransferControl32; PeiS3ResumeState->AsmTransferControl = (EFI_PHYSICAL_ADDRESS)(UINTN)AsmTransferControl32;
if ((Facs != NULL) && if ((Facs != NULL) &&
@ -128,7 +128,7 @@ S3BootScriptExecutorEntryFunction (
// //
// IA32 S3 Resume // IA32 S3 Resume
// //
DEBUG ((EFI_D_ERROR, "Call SwitchStack() to return to S3 Resume in PEI Phase\n")); DEBUG ((DEBUG_INFO, "Call SwitchStack() to return to S3 Resume in PEI Phase\n"));
PeiS3ResumeState->AsmTransferControl = (EFI_PHYSICAL_ADDRESS)(UINTN)AsmTransferControl; PeiS3ResumeState->AsmTransferControl = (EFI_PHYSICAL_ADDRESS)(UINTN)AsmTransferControl;
SwitchStack ( SwitchStack (
@ -160,7 +160,7 @@ S3BootScriptExecutorEntryFunction (
// //
// X64 long mode waking vector // X64 long mode waking vector
// //
DEBUG (( EFI_D_ERROR, "Transfer to 64bit OS waking vector - %x\r\n", (UINTN)Facs->XFirmwareWakingVector)); DEBUG ((DEBUG_INFO, "Transfer to 64bit OS waking vector - %x\r\n", (UINTN)Facs->XFirmwareWakingVector));
if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
SwitchStack ( SwitchStack (
(SWITCH_STACK_ENTRY_POINT)(UINTN)Facs->XFirmwareWakingVector, (SWITCH_STACK_ENTRY_POINT)(UINTN)Facs->XFirmwareWakingVector,
@ -177,7 +177,7 @@ S3BootScriptExecutorEntryFunction (
// //
// IA32 protected mode waking vector (Page disabled) // IA32 protected mode waking vector (Page disabled)
// //
DEBUG (( EFI_D_ERROR, "Transfer to 32bit OS waking vector - %x\r\n", (UINTN)Facs->XFirmwareWakingVector)); DEBUG ((DEBUG_INFO, "Transfer to 32bit OS waking vector - %x\r\n", (UINTN)Facs->XFirmwareWakingVector));
if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) {
AsmDisablePaging64 ( AsmDisablePaging64 (
0x10, 0x10,
@ -199,7 +199,7 @@ S3BootScriptExecutorEntryFunction (
// //
// 16bit Realmode waking vector // 16bit Realmode waking vector
// //
DEBUG (( EFI_D_ERROR, "Transfer to 16bit OS waking vector - %x\r\n", (UINTN)Facs->FirmwareWakingVector)); DEBUG ((DEBUG_INFO, "Transfer to 16bit OS waking vector - %x\r\n", (UINTN)Facs->FirmwareWakingVector));
AsmTransferControl (Facs->FirmwareWakingVector, 0x0); AsmTransferControl (Facs->FirmwareWakingVector, 0x0);
} }

View File

@ -3,7 +3,7 @@
Set a IDT entry for interrupt vector 3 for debug purpose for x64 platform Set a IDT entry for interrupt vector 3 for debug purpose for x64 platform
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR> Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
@ -234,7 +234,7 @@ PageFaultHandler (
UINTN PTIndex; UINTN PTIndex;
PFAddress = AsmReadCr2 (); PFAddress = AsmReadCr2 ();
DEBUG ((EFI_D_ERROR, "BootScript - PageFaultHandler: Cr2 - %lx\n", PFAddress)); DEBUG ((DEBUG_INFO, "BootScript - PageFaultHandler: Cr2 - %lx\n", PFAddress));
if (PFAddress >= mPhyMask + SIZE_4KB) { if (PFAddress >= mPhyMask + SIZE_4KB) {
return FALSE; return FALSE;

View File

@ -5,7 +5,7 @@
for Firmware Basic Boot Performance Record and other boot performance records, for Firmware Basic Boot Performance Record and other boot performance records,
and install FPDT to ACPI table. and install FPDT to ACPI table.
Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -876,7 +876,7 @@ FirmwarePerformanceDxeEntryPoint (
// //
// SEC Performance Data Hob not found, ResetEnd in ACPI FPDT table will be 0. // SEC Performance Data Hob not found, ResetEnd in ACPI FPDT table will be 0.
// //
DEBUG ((EFI_D_ERROR, "FPDT: WARNING: SEC Performance Data Hob not found, ResetEnd will be set to 0!\n")); DEBUG ((DEBUG_WARN, "FPDT: WARNING: SEC Performance Data Hob not found, ResetEnd will be set to 0!\n"));
} }
if (FeaturePcdGet (PcdFirmwarePerformanceDataTableS3Support)) { if (FeaturePcdGet (PcdFirmwarePerformanceDataTableS3Support)) {

View File

@ -407,7 +407,7 @@ S3AllocatePageTablesBuffer (
} }
TotalPageTableSize += ExtraPageTablePages; TotalPageTableSize += ExtraPageTablePages;
DEBUG ((EFI_D_ERROR, "AcpiS3ContextSave TotalPageTableSize - 0x%x pages\n", TotalPageTableSize)); DEBUG ((DEBUG_INFO, "AcpiS3ContextSave TotalPageTableSize - 0x%x pages\n", TotalPageTableSize));
// //
// By architecture only one PageMapLevel4 exists - so lets allocate storage for it. // By architecture only one PageMapLevel4 exists - so lets allocate storage for it.

View File

@ -763,7 +763,7 @@ GetCapsuleDescriptors (
(VOID *) &CapsuleDataPtr64 (VOID *) &CapsuleDataPtr64
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Capsule -- capsule variable not set\n")); DEBUG ((DEBUG_INFO, "Capsule -- capsule variable not set\n"));
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
// //

View File

@ -2,7 +2,7 @@
Create the variable to save the base address of page table and stack Create the variable to save the base address of page table and stack
for transferring into long mode in IA32 capsule PEI. for transferring into long mode in IA32 capsule PEI.
Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -160,7 +160,7 @@ PrepareContextForCapsulePei (
TotalPagesNum = NumberOfPml4EntriesNeeded + 1; TotalPagesNum = NumberOfPml4EntriesNeeded + 1;
} }
TotalPagesNum += ExtraPageTablePages; TotalPagesNum += ExtraPageTablePages;
DEBUG ((EFI_D_ERROR, "CapsuleRuntimeDxe X64 TotalPagesNum - 0x%x pages\n", TotalPagesNum)); DEBUG ((DEBUG_INFO, "CapsuleRuntimeDxe X64 TotalPagesNum - 0x%x pages\n", TotalPagesNum));
LongModeBuffer.PageTableAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateReservedMemoryBelow4G (EFI_PAGES_TO_SIZE (TotalPagesNum)); LongModeBuffer.PageTableAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateReservedMemoryBelow4G (EFI_PAGES_TO_SIZE (TotalPagesNum));
ASSERT (LongModeBuffer.PageTableAddress != 0); ASSERT (LongModeBuffer.PageTableAddress != 0);

View File

@ -993,6 +993,49 @@ TerminalDriverBindingStop (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Compare a device path data structure to that of all the nodes of a
second device path instance.
@param Multi A pointer to a multi-instance device path data structure.
@param Single A pointer to a single-instance device path data structure.
@retval TRUE If the Single is contained within Multi.
@retval FALSE The Single is not match within Multi.
**/
BOOLEAN
MatchDevicePaths (
IN EFI_DEVICE_PATH_PROTOCOL *Multi,
IN EFI_DEVICE_PATH_PROTOCOL *Single
)
{
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *DevicePathInst;
UINTN Size;
DevicePath = Multi;
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
//
// Search for the match of 'Single' in 'Multi'
//
while (DevicePathInst != NULL) {
//
// If the single device path is found in multiple device paths,
// return success
//
if (CompareMem (Single, DevicePathInst, Size) == 0) {
FreePool (DevicePathInst);
return TRUE;
}
FreePool (DevicePathInst);
DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);
}
return FALSE;
}
/** /**
Update terminal device path in Console Device Environment Variables. Update terminal device path in Console Device Environment Variables.
@ -1018,8 +1061,12 @@ TerminalUpdateConsoleDevVariable (
// //
// Get global variable and its size according to the name given. // Get global variable and its size according to the name given.
// //
GetEfiGlobalVariable2 (VariableName, (VOID**)&Variable, NULL); Status = GetEfiGlobalVariable2 (VariableName, (VOID**)&Variable, NULL);
if (Variable == NULL) { if (Status == EFI_NOT_FOUND) {
Status = EFI_SUCCESS;
Variable = NULL;
}
if (EFI_ERROR (Status)) {
return; return;
} }
@ -1028,17 +1075,21 @@ TerminalUpdateConsoleDevVariable (
// //
for (TerminalType = 0; TerminalType < ARRAY_SIZE (mTerminalType); TerminalType++) { for (TerminalType = 0; TerminalType < ARRAY_SIZE (mTerminalType); TerminalType++) {
SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath); SetTerminalDevicePath (TerminalType, ParentDevicePath, &TempDevicePath);
if (TempDevicePath != NULL) {
if (!MatchDevicePaths (Variable, TempDevicePath)) {
NewVariable = AppendDevicePathInstance (Variable, TempDevicePath); NewVariable = AppendDevicePathInstance (Variable, TempDevicePath);
ASSERT (NewVariable != NULL); if (NewVariable != NULL) {
if (Variable != NULL) { if (Variable != NULL) {
FreePool (Variable); FreePool (Variable);
} }
Variable = NewVariable;
}
}
if (TempDevicePath != NULL) {
FreePool (TempDevicePath); FreePool (TempDevicePath);
} }
Variable = NewVariable;
} }
VariableSize = GetDevicePathSize (Variable); VariableSize = GetDevicePathSize (Variable);

View File

@ -877,7 +877,7 @@ UpdateSkipInfoForMenu (
CHAR16 *OutputString; CHAR16 *OutputString;
UINT16 GlyphWidth; UINT16 GlyphWidth;
Width = (UINT16) gOptionBlockWidth; Width = (UINT16) gOptionBlockWidth - 1;
GlyphWidth = 1; GlyphWidth = 1;
Row = 1; Row = 1;

View File

@ -105,7 +105,7 @@ GetImageIdOrAddress (
case EFI_HII_IIBT_IMAGE_8BIT_TRANS: case EFI_HII_IIBT_IMAGE_8BIT_TRANS:
Length = sizeof (EFI_HII_IIBT_IMAGE_8BIT_BLOCK) - sizeof (UINT8) + Length = sizeof (EFI_HII_IIBT_IMAGE_8BIT_BLOCK) - sizeof (UINT8) +
BITMAP_LEN_8_BIT ( BITMAP_LEN_8_BIT (
ReadUnaligned16 (&((EFI_HII_IIBT_IMAGE_8BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width), (UINT32) ReadUnaligned16 (&((EFI_HII_IIBT_IMAGE_8BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width),
ReadUnaligned16 (&((EFI_HII_IIBT_IMAGE_8BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height) ReadUnaligned16 (&((EFI_HII_IIBT_IMAGE_8BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height)
); );
ImageIdCurrent++; ImageIdCurrent++;
@ -115,7 +115,7 @@ GetImageIdOrAddress (
case EFI_HII_IIBT_IMAGE_24BIT_TRANS: case EFI_HII_IIBT_IMAGE_24BIT_TRANS:
Length = sizeof (EFI_HII_IIBT_IMAGE_24BIT_BLOCK) - sizeof (EFI_HII_RGB_PIXEL) + Length = sizeof (EFI_HII_IIBT_IMAGE_24BIT_BLOCK) - sizeof (EFI_HII_RGB_PIXEL) +
BITMAP_LEN_24_BIT ( BITMAP_LEN_24_BIT (
ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width), (UINT32) ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width),
ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height) ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height)
); );
ImageIdCurrent++; ImageIdCurrent++;
@ -453,7 +453,7 @@ Output8bitPixel (
// Convert the pixel from 8 bits to corresponding color. // Convert the pixel from 8 bits to corresponding color.
// //
for (Ypos = 0; Ypos < Image->Height; Ypos++) { for (Ypos = 0; Ypos < Image->Height; Ypos++) {
OffsetY = BITMAP_LEN_8_BIT (Image->Width, Ypos); OffsetY = BITMAP_LEN_8_BIT ((UINT32) Image->Width, Ypos);
// //
// All bits are meaningful since the bitmap is 8 bits per pixel. // All bits are meaningful since the bitmap is 8 bits per pixel.
// //
@ -493,7 +493,7 @@ Output24bitPixel (
BitMapPtr = Image->Bitmap; BitMapPtr = Image->Bitmap;
for (Ypos = 0; Ypos < Image->Height; Ypos++) { for (Ypos = 0; Ypos < Image->Height; Ypos++) {
OffsetY = BITMAP_LEN_8_BIT (Image->Width, Ypos); OffsetY = BITMAP_LEN_8_BIT ((UINT32) Image->Width, Ypos);
CopyRgbToGopPixel (&BitMapPtr[OffsetY], &Data[OffsetY], Image->Width); CopyRgbToGopPixel (&BitMapPtr[OffsetY], &Data[OffsetY], Image->Width);
} }
@ -650,7 +650,7 @@ HiiNewImage (
} }
NewBlockSize = sizeof (EFI_HII_IIBT_IMAGE_24BIT_BLOCK) - sizeof (EFI_HII_RGB_PIXEL) + NewBlockSize = sizeof (EFI_HII_IIBT_IMAGE_24BIT_BLOCK) - sizeof (EFI_HII_RGB_PIXEL) +
BITMAP_LEN_24_BIT (Image->Width, Image->Height); BITMAP_LEN_24_BIT ((UINT32) Image->Width, Image->Height);
// //
// Get the image package in the package list, // Get the image package in the package list,
@ -753,7 +753,7 @@ HiiNewImage (
} }
WriteUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) ImageBlocks)->Bitmap.Width, Image->Width); WriteUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) ImageBlocks)->Bitmap.Width, Image->Width);
WriteUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) ImageBlocks)->Bitmap.Height, Image->Height); WriteUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) ImageBlocks)->Bitmap.Height, Image->Height);
CopyGopToRgbPixel (((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) ImageBlocks)->Bitmap.Bitmap, Image->Bitmap, Image->Width * Image->Height); CopyGopToRgbPixel (((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) ImageBlocks)->Bitmap.Bitmap, Image->Bitmap, (UINT32) Image->Width * Image->Height);
// //
// Append the block end // Append the block end
@ -896,7 +896,7 @@ IGetImage (
// //
CopyMem (&Iibt1bit, CurrentImageBlock, sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK)); CopyMem (&Iibt1bit, CurrentImageBlock, sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK));
ImageLength = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ImageLength = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) *
(Iibt1bit.Bitmap.Width * Iibt1bit.Bitmap.Height); ((UINT32) Iibt1bit.Bitmap.Width * Iibt1bit.Bitmap.Height);
Image->Bitmap = AllocateZeroPool (ImageLength); Image->Bitmap = AllocateZeroPool (ImageLength);
if (Image->Bitmap == NULL) { if (Image->Bitmap == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -947,7 +947,7 @@ IGetImage (
case EFI_HII_IIBT_IMAGE_24BIT: case EFI_HII_IIBT_IMAGE_24BIT:
Width = ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width); Width = ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width);
Height = ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height); Height = ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height);
ImageLength = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * (Width * Height); ImageLength = sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ((UINT32) Width * Height);
Image->Bitmap = AllocateZeroPool (ImageLength); Image->Bitmap = AllocateZeroPool (ImageLength);
if (Image->Bitmap == NULL) { if (Image->Bitmap == NULL) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
@ -1095,7 +1095,7 @@ HiiSetImage (
case EFI_HII_IIBT_IMAGE_8BIT_TRANS: case EFI_HII_IIBT_IMAGE_8BIT_TRANS:
OldBlockSize = sizeof (EFI_HII_IIBT_IMAGE_8BIT_BLOCK) - sizeof (UINT8) + OldBlockSize = sizeof (EFI_HII_IIBT_IMAGE_8BIT_BLOCK) - sizeof (UINT8) +
BITMAP_LEN_8_BIT ( BITMAP_LEN_8_BIT (
ReadUnaligned16 (&((EFI_HII_IIBT_IMAGE_8BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width), (UINT32) ReadUnaligned16 (&((EFI_HII_IIBT_IMAGE_8BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width),
ReadUnaligned16 (&((EFI_HII_IIBT_IMAGE_8BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height) ReadUnaligned16 (&((EFI_HII_IIBT_IMAGE_8BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height)
); );
break; break;
@ -1103,7 +1103,7 @@ HiiSetImage (
case EFI_HII_IIBT_IMAGE_24BIT_TRANS: case EFI_HII_IIBT_IMAGE_24BIT_TRANS:
OldBlockSize = sizeof (EFI_HII_IIBT_IMAGE_24BIT_BLOCK) - sizeof (EFI_HII_RGB_PIXEL) + OldBlockSize = sizeof (EFI_HII_IIBT_IMAGE_24BIT_BLOCK) - sizeof (EFI_HII_RGB_PIXEL) +
BITMAP_LEN_24_BIT ( BITMAP_LEN_24_BIT (
ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width), (UINT32) ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Width),
ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height) ReadUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) CurrentImageBlock)->Bitmap.Height)
); );
break; break;
@ -1115,7 +1115,7 @@ HiiSetImage (
// Create the new image block according to input image. // Create the new image block according to input image.
// //
NewBlockSize = sizeof (EFI_HII_IIBT_IMAGE_24BIT_BLOCK) - sizeof (EFI_HII_RGB_PIXEL) + NewBlockSize = sizeof (EFI_HII_IIBT_IMAGE_24BIT_BLOCK) - sizeof (EFI_HII_RGB_PIXEL) +
BITMAP_LEN_24_BIT (Image->Width, Image->Height); BITMAP_LEN_24_BIT ((UINT32) Image->Width, Image->Height);
// //
// Adjust the image package to remove the original block firstly then add the new block. // Adjust the image package to remove the original block firstly then add the new block.
// //
@ -1140,7 +1140,7 @@ HiiSetImage (
WriteUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) NewImageBlock)->Bitmap.Width, Image->Width); WriteUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) NewImageBlock)->Bitmap.Width, Image->Width);
WriteUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) NewImageBlock)->Bitmap.Height, Image->Height); WriteUnaligned16 ((VOID *) &((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) NewImageBlock)->Bitmap.Height, Image->Height);
CopyGopToRgbPixel (((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) NewImageBlock)->Bitmap.Bitmap, CopyGopToRgbPixel (((EFI_HII_IIBT_IMAGE_24BIT_BLOCK *) NewImageBlock)->Bitmap.Bitmap,
Image->Bitmap, Image->Width * Image->Height); Image->Bitmap, (UINT32) Image->Width * Image->Height);
CopyMem ((UINT8 *) NewImageBlock + NewBlockSize, (UINT8 *) CurrentImageBlock + OldBlockSize, Part2Size); CopyMem ((UINT8 *) NewImageBlock + NewBlockSize, (UINT8 *) CurrentImageBlock + OldBlockSize, Part2Size);

View File

@ -9,7 +9,7 @@
SmmLockBoxHandler(), SmmLockBoxRestore(), SmmLockBoxUpdate(), SmmLockBoxSave() SmmLockBoxHandler(), SmmLockBoxRestore(), SmmLockBoxUpdate(), SmmLockBoxSave()
will receive untrusted input and do basic validation. will receive untrusted input and do basic validation.
Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions are licensed and made available under the terms and conditions
@ -267,7 +267,7 @@ SmmLockBoxHandler (
EFI_SMM_LOCK_BOX_PARAMETER_HEADER *LockBoxParameterHeader; EFI_SMM_LOCK_BOX_PARAMETER_HEADER *LockBoxParameterHeader;
UINTN TempCommBufferSize; UINTN TempCommBufferSize;
DEBUG ((EFI_D_ERROR, "SmmLockBox SmmLockBoxHandler Enter\n")); DEBUG ((DEBUG_INFO, "SmmLockBox SmmLockBoxHandler Enter\n"));
// //
// If input is invalid, stop processing this SMI // If input is invalid, stop processing this SMI
@ -294,9 +294,9 @@ SmmLockBoxHandler (
LockBoxParameterHeader->ReturnStatus = (UINT64)-1; LockBoxParameterHeader->ReturnStatus = (UINT64)-1;
DEBUG ((EFI_D_ERROR, "SmmLockBox LockBoxParameterHeader - %x\n", (UINTN)LockBoxParameterHeader)); DEBUG ((DEBUG_INFO, "SmmLockBox LockBoxParameterHeader - %x\n", (UINTN)LockBoxParameterHeader));
DEBUG ((EFI_D_ERROR, "SmmLockBox Command - %x\n", (UINTN)LockBoxParameterHeader->Command)); DEBUG ((DEBUG_INFO, "SmmLockBox Command - %x\n", (UINTN)LockBoxParameterHeader->Command));
switch (LockBoxParameterHeader->Command) { switch (LockBoxParameterHeader->Command) {
case EFI_SMM_LOCK_BOX_COMMAND_SAVE: case EFI_SMM_LOCK_BOX_COMMAND_SAVE:
@ -341,7 +341,7 @@ SmmLockBoxHandler (
LockBoxParameterHeader->Command = (UINT32)-1; LockBoxParameterHeader->Command = (UINT32)-1;
DEBUG ((EFI_D_ERROR, "SmmLockBox SmmLockBoxHandler Exit\n")); DEBUG ((DEBUG_INFO, "SmmLockBox SmmLockBoxHandler Exit\n"));
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Vfr file for IP4Dxe. Vfr file for IP4Dxe.
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -31,7 +31,7 @@ formset
checkbox varid = IP4_CONFIG2_IFR_NVDATA.Configure, checkbox varid = IP4_CONFIG2_IFR_NVDATA.Configure,
prompt = STRING_TOKEN(STR_IP4_CONFIGURE), prompt = STRING_TOKEN(STR_IP4_CONFIGURE),
help = STRING_TOKEN(STR_IP4_CONFIGURE), help = STRING_TOKEN(STR_IP4_CONFIGURE_HELP),
flags = INTERACTIVE, flags = INTERACTIVE,
key = KEY_ENABLE, key = KEY_ENABLE,
endcheckbox; endcheckbox;

View File

@ -1,7 +1,7 @@
// /** @file // /** @file
// String definitions for Ip4Config2 formset // String definitions for Ip4Config2 formset
// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR> // Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
// This program and the accompanying materials // This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License // are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at // which accompanies this distribution. The full text of the license may be found at
@ -22,6 +22,7 @@
#string STR_IP4_DEVICE_FORM_TITLE #language en-US "" #string STR_IP4_DEVICE_FORM_TITLE #language en-US ""
#string STR_IP4_DEVICE_FORM_HELP #language en-US "" #string STR_IP4_DEVICE_FORM_HELP #language en-US ""
#string STR_IP4_CONFIGURE #language en-US "Configured" #string STR_IP4_CONFIGURE #language en-US "Configured"
#string STR_IP4_CONFIGURE_HELP #language en-US "Indicate whether network address configured successfully or not."
#string STR_IP4_ENABLE_DHCP #language en-US "Enable DHCP" #string STR_IP4_ENABLE_DHCP #language en-US "Enable DHCP"
#string STR_IP4_LOCAL_IP_ADDRESS #language en-US "Local IP Address" #string STR_IP4_LOCAL_IP_ADDRESS #language en-US "Local IP Address"
#string STR_IP4_IP_ADDRESS_HELP #language en-US "Enter IP address in dotted-decimal notation. Example: 192.168.10.12\r\n" #string STR_IP4_IP_ADDRESS_HELP #language en-US "Enter IP address in dotted-decimal notation. Example: 192.168.10.12\r\n"

View File

@ -855,7 +855,7 @@ Ip4OnArpResolvedDpc (
Status = Interface->Mnp->Transmit (Interface->Mnp, &Token->MnpToken); Status = Interface->Mnp->Transmit (Interface->Mnp, &Token->MnpToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
RemoveEntryList (Entry); RemoveEntryList (&Token->Link);
Token->CallBack (Token->IpInstance, Token->Packet, Status, 0, Token->Context); Token->CallBack (Token->IpInstance, Token->Packet, Status, 0, Token->Context);
Ip4FreeLinkTxToken (Token); Ip4FreeLinkTxToken (Token);
@ -1081,7 +1081,7 @@ SEND_NOW:
InsertTailList (&Interface->SentFrames, &Token->Link); InsertTailList (&Interface->SentFrames, &Token->Link);
Status = Interface->Mnp->Transmit (Interface->Mnp, &Token->MnpToken); Status = Interface->Mnp->Transmit (Interface->Mnp, &Token->MnpToken);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
RemoveEntryList (&Interface->SentFrames); RemoveEntryList (&Token->Link);
goto ON_ERROR; goto ON_ERROR;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
Implementation of Managed Network Protocol private services. Implementation of Managed Network Protocol private services.
Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions are licensed and made available under the terms and conditions
of the BSD License which accompanies this distribution. The full of the BSD License which accompanies this distribution. The full
@ -235,7 +235,7 @@ MnpAddFreeTxBuf (
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
for (Index = 0; Index < Count; Index++) { for (Index = 0; Index < Count; Index++) {
TxBufWrap = (MNP_TX_BUF_WRAP*) AllocatePool (sizeof (MNP_TX_BUF_WRAP) + MnpDeviceData->BufferLength - 1); TxBufWrap = (MNP_TX_BUF_WRAP*) AllocatePool (OFFSET_OF (MNP_TX_BUF_WRAP, TxBuf) + MnpDeviceData->BufferLength );
if (TxBufWrap == NULL) { if (TxBufWrap == NULL) {
DEBUG ((EFI_D_ERROR, "MnpAddFreeTxBuf: TxBuf Alloc failed.\n")); DEBUG ((EFI_D_ERROR, "MnpAddFreeTxBuf: TxBuf Alloc failed.\n"));

View File

@ -2,7 +2,7 @@
Interface routine for Mtftp4. Interface routine for Mtftp4.
(C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR> (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -667,6 +667,10 @@ EfiMtftp4Configure (
Gateway = NTOHL (Gateway); Gateway = NTOHL (Gateway);
ServerIp = NTOHL (ServerIp); ServerIp = NTOHL (ServerIp);
if (ServerIp == 0 || IP4_IS_LOCAL_BROADCAST (ServerIp)) {
return EFI_INVALID_PARAMETER;
}
if (!ConfigData->UseDefaultSetting && if (!ConfigData->UseDefaultSetting &&
((!IP4_IS_VALID_NETMASK (Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Ip, Netmask))))) { ((!IP4_IS_VALID_NETMASK (Netmask) || (Netmask != 0 && !NetIp4IsUnicast (Ip, Netmask))))) {

View File

@ -162,15 +162,6 @@ SockDestroyChild (
ASSERT (Tcb != NULL); ASSERT (Tcb != NULL);
Status = EfiAcquireLockOrFail (&(Sock->Lock));
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "SockDestroyChild: Get the lock to "
"access socket failed with %r\n", Status));
return EFI_ACCESS_DENIED;
}
// //
// Close the IP protocol. // Close the IP protocol.
// //
@ -214,6 +205,15 @@ SockDestroyChild (
NULL NULL
); );
Status = EfiAcquireLockOrFail (&(Sock->Lock));
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "SockDestroyChild: Get the lock to "
"access socket failed with %r\n", Status));
return EFI_ACCESS_DENIED;
}
// //
// force protocol layer to detach the PCB // force protocol layer to detach the PCB
// //

View File

@ -1,7 +1,7 @@
/** @file /** @file
TCP input process routines. TCP input process routines.
Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -703,6 +703,7 @@ TcpInput (
TCP_SEG *Seg; TCP_SEG *Seg;
TCP_SEQNO Right; TCP_SEQNO Right;
TCP_SEQNO Urg; TCP_SEQNO Urg;
INT32 Usable;
NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE); NET_CHECK_SIGNATURE (Nbuf, NET_BUF_SIGNATURE);
@ -1187,9 +1188,27 @@ TcpInput (
} }
if (TCP_SEQ_LT (Right, Tcb->SndNxt)) { if (TCP_SEQ_LT (Right, Tcb->SndNxt)) {
//
// Check for Window Retraction in RFC7923 section 2.4.
// The lower n bits of the peer's actual receive window is wiped out if TCP
// window scale is enabled, it will look like the peer is shrinking the window.
// Check whether the SndNxt is out of the advertised receive window by more than
// 2^Rcv.Wind.Shift before moving the SndNxt to the left.
//
DEBUG (
(EFI_D_WARN,
"TcpInput: peer advise negative useable window for connected TCB %p\n",
Tcb)
);
Usable = TCP_SUB_SEQ (Tcb->SndNxt, Right);
if ((Usable >> Tcb->SndWndScale) > 0) {
DEBUG (
(EFI_D_WARN,
"TcpInput: SndNxt is out of window by more than window scale for TCB %p\n",
Tcb)
);
Tcb->SndNxt = Right; Tcb->SndNxt = Right;
}
if (Right == Tcb->SndUna) { if (Right == Tcb->SndUna) {
TcpClearTimer (Tcb, TCP_TIMER_REXMIT); TcpClearTimer (Tcb, TCP_TIMER_REXMIT);

View File

@ -1,7 +1,7 @@
/** @file /** @file
Misc support routines for tcp. Misc support routines for tcp.
Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -78,6 +78,7 @@ TcpInitTcbLocal (
// First window size is never scaled // First window size is never scaled
// //
Tcb->RcvWndScale = 0; Tcb->RcvWndScale = 0;
Tcb->RetxmitSeqMax = 0;
Tcb->ProbeTimerOn = FALSE; Tcb->ProbeTimerOn = FALSE;
} }

View File

@ -1,7 +1,7 @@
/** @file /** @file
TCP output process routines. TCP output process routines.
Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR> Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -671,14 +671,36 @@ TcpRetransmit (
// 2. must in the current send window // 2. must in the current send window
// 3. will not change the boundaries of queued segments. // 3. will not change the boundaries of queued segments.
// //
if (TCP_SEQ_LT (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
DEBUG ((EFI_D_WARN, "TcpRetransmit: retransmission cancelled " //
"because send window too small for TCB %p\n", Tcb)); // Handle the Window Retraction if TCP window scale is enabled according to RFC7323:
// On first retransmission, or if the sequence number is out of
// window by less than 2^Rcv.Wind.Shift, then do normal
// retransmission(s) without regard to the receiver window as long
// as the original segment was in window when it was sent.
//
if ((Tcb->SndWndScale != 0) &&
(TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax) || TCP_SEQ_BETWEEN (Tcb->SndWl2 + Tcb->SndWnd, Seq, Tcb->SndWl2 + Tcb->SndWnd + (1 << Tcb->SndWndScale)))) {
Len = TCP_SUB_SEQ (Tcb->SndNxt, Seq);
DEBUG (
(EFI_D_WARN,
"TcpRetransmit: retransmission without regard to the receiver window for TCB %p\n",
Tcb)
);
} else if (TCP_SEQ_GEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq)) {
Len = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
} else {
DEBUG (
(EFI_D_WARN,
"TcpRetransmit: retransmission cancelled because send window too small for TCB %p\n",
Tcb)
);
return 0; return 0;
} }
Len = TCP_SUB_SEQ (Tcb->SndWl2 + Tcb->SndWnd, Seq);
Len = MIN (Len, Tcb->SndMss); Len = MIN (Len, Tcb->SndMss);
Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len); Nbuf = TcpGetSegmentSndQue (Tcb, Seq, Len);
@ -692,6 +714,10 @@ TcpRetransmit (
goto OnError; goto OnError;
} }
if (TCP_SEQ_GT (Seq, Tcb->RetxmitSeqMax)) {
Tcb->RetxmitSeqMax = Seq;
}
// //
// The retransmitted buffer may be on the SndQue, // The retransmitted buffer may be on the SndQue,
// trim TCP head because all the buffer on SndQue // trim TCP head because all the buffer on SndQue

View File

@ -1,7 +1,7 @@
/** @file /** @file
Tcp Protocol header file. Tcp Protocol header file.
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -250,6 +250,12 @@ struct _TCP_CB {
UINT32 TimeWaitTimeout; ///< The TIME_WAIT time out UINT32 TimeWaitTimeout; ///< The TIME_WAIT time out
UINT32 ConnectTimeout; ///< The connect establishment time out UINT32 ConnectTimeout; ///< The connect establishment time out
//
// RFC7323
// Addressing Window Retraction for TCP Window Scale Option.
//
TCP_SEQNO RetxmitSeqMax; ///< Max Seq number in previous retransmission.
// //
// configuration for tcp provided by user // configuration for tcp provided by user
// //

View File

@ -1296,6 +1296,7 @@ DxePcdGetNextTokenSpace (
(EFI_GUID *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->GuidTableOffset) (EFI_GUID *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->GuidTableOffset)
); );
CopyMem (TmpTokenSpaceBuffer, PeiTokenSpaceTable, sizeof (EFI_GUID*) * PeiTokenSpaceTableSize); CopyMem (TmpTokenSpaceBuffer, PeiTokenSpaceTable, sizeof (EFI_GUID*) * PeiTokenSpaceTableSize);
TmpTokenSpaceBufferCount = PeiTokenSpaceTableSize;
FreePool (PeiTokenSpaceTable); FreePool (PeiTokenSpaceTable);
} }

Some files were not shown because too many files have changed in this diff Show More