Commit Graph

4559 Commits

Author SHA1 Message Date
Michael Kinney 7328295cb2 MdeModulePkg/DxeCore: Fix ASSERT() from GCD DEBUG() messages
If a BaseAddress of NULL is passed into DXE Core services
CoreAllocateIoSpace() or CoreAllocateMemorySpace(), and
DEBUG() messages are enabled, then a NULL pointer reference
is made.  The parameter check for BaseAddress is performed
in the function CoreAllocateSpace() after the DEBUG()
messages.  A check is added in the DEBUG() messages to
prevent the NULL pointer reference.

This issue was found with PI SCTs with DEBUG messages
enabled in the DXE Core.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.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>
Reviewed-by: Feng Tian <feng.tian@Intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-01-10 11:22:02 -08:00
Ruiyu Ni 0dc3359ac6 MdeModulePkg/Bds: Fix a bug that may causes S4 fails to resume
When firmware boots to UiApp, the memory type information settings
are saved to NV storage and the settings in HOB are changed as well.
Because UiApp is an APPLICATION type of boot option, system doesn't
reset when settings change.
But when user selects OS to boot in UiApp, because the settings in HOB
was updated when booting to UiApp, the BDS doesn't think the settings
change, expected reset doesn't happen.

The patch fixes this issue to not update the settings in HOB.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
2017-01-06 20:46:42 +08:00
Dandan Bi 74e2b93496 MdeModulePkg/StaControllerDxe: Fix coding style issue
Remove the empty line.

Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2017-01-05 14:41:42 +08:00
Dandan Bi bc83ca81ab MdeModulePkg/DxeCapsuleLibFmp: Fix incorrect MODULE_TYPE
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2017-01-05 14:41:40 +08:00
Jiaxin Wu d52f9163de MdeModulePkg/Ip4Dxe: Fix the potential NULL pointer free
Ip4Config2SetDnsServer may cause ASSERT if the invalid DNS
server address received. The issue is triggered by the NULL
pointer(Tmp) free.

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>
2017-01-04 08:40:09 +08:00
Laszlo Ersek 387ccad8f6 MdeModulePkg: S3SaveStateDxe, SmmS3SaveState: save 64-bit LoopTimes
The BootScriptWriteMemPoll() helper function in both drivers does the
following:

- pop Delay from the variable argument list as UINT64, then truncate it to
  UINTN,

- divide Delay by 10, using DivU64x32Remainder(), then store the quotient
  in LoopTimes (also UINTN),

- pass LoopTimes to S3BootScriptSaveMemPoll() as last argument.

The truncation to UINTN is superfluous and wrong in this logic (not to
mention incompatible with the PI spec); it prevents callers from
specifying Delays longer than 0xFFFF_FFFF * 100ns (approximately 429
seconds == 7 minutes 9 seconds) on Ia32. In particular it prevents callers
from specifying an infinite timeout (for example, 0xFFFF_FFFF_FFFF_FFFF *
100ns, approximately 58494 years).

Change the type of Delay and LoopTimes to UINT64. Keep the same logic,
just remove the truncations. The resultant LoopTimes values can be safely
passed to S3BootScriptSaveMemPoll() thanks to the previous patch.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
2017-01-03 12:23:38 +01:00
Laszlo Ersek 63042a7188 MdePkg, MdeModulePkg: S3BootScriptSaveMemPoll(): accept 64-bit LoopTimes
The BaseNull instance of S3BootScriptLib obviously doesn't care about the
type of the S3BootScriptSaveMemPoll() function's LoopTimes parameter; this
lib instance doesn't do anything with the parameters received in
S3BootScriptSaveMemPoll().

The PiDxe instance saves the LoopTimes parameter in
EFI_BOOT_SCRIPT_MEM_POLL.LoopTimes. This target field already has UINT64
type. Furthermore, the BootScriptExecuteMemPoll() function in the same
library instance already uses a local UINT64 variable called LoopTimes to
count up to EFI_BOOT_SCRIPT_MEM_POLL.LoopTimes. This means that the the
UINTN type for S3BootScriptSaveMemPoll()'s LoopTimes parameter is an
unnecessary restriction.

The callers of S3BootScriptSaveMemPoll() will be updated in the next
patches, functionally. At this stage, they will continue to compile, since
UINT64 parameters can accept UINTN arguments.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
2017-01-03 12:22:47 +01:00
Hao Wu 7c6075e254 MdeModulePkg/PrintLib: Add missing return status check for Print APIs
https://bugzilla.tianocore.org/show_bug.cgi?id=307

For the following APIs in PrintLib instance
MdeModulePkg\Library\DxePrintLibPrint2Protocol:
UnicodeVSPrint
UnicodeSPrint
UnicodeVSPrintAsciiFormat
UnicodeSPrintAsciiFormat
AsciiVSPrint
AsciiSPrint
AsciiVSPrintUnicodeFormat
AsciiSPrintUnicodeFormat

The internal function DxePrintLibPrint2ProtocolVaListToBaseList() will be
called to convert a VA_LIST to a BASE_LIST. However, those APIs miss
checking the return value of the internal function.

This commit adds codes to check the return value. If the VA_LIST fails to
be converted to a BASE_LIST, those PrintLib APIs will return 0 and leave
the output 'StartOfBuffer' unmodified.

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>
2017-01-03 16:32:52 +08:00
Star Zeng 35dadd7c54 MdeModulePkg Ps2KbDxe: Execute key notify func at TPL_CALLBACK
Current implementation executes key notify function in TimerHandler
at TPL_NOTIFY. The code change is to make key notify function
executed at TPL_CALLBACK to reduce the time occupied at TPL_NOTIFY.

The code will signal KeyNotify process event if the key pressed
matches any key registered and insert the KeyData to the EFI Key
queue for notify, then the KeyNotify process handler will invoke
key notify functions at TPL_CALLBACK.

Cc: Ruiyu Ni <Ruiyu.ni@intel.com>
Cc: Michael Kinney <michael.d.kinney@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: Ruiyu Ni <Ruiyu.ni@intel.com>
2016-12-26 18:17:00 +08:00
Star Zeng 47b612db90 MdeModulePkg TerminalDxe: Execute key notify func at TPL_CALLBACK
Current implementation executes key notify function in TimerHandler
at TPL_NOTIFY. The code change is to make key notify function
executed at TPL_CALLBACK to reduce the time occupied at TPL_NOTIFY.

The code will signal KeyNotify process event if the key pressed
matches any key registered and insert the KeyData to the EFI Key
queue for notify, then the KeyNotify process handler will invoke
key notify functions at TPL_CALLBACK.

Cc: Ruiyu Ni <Ruiyu.ni@intel.com>
Cc: Michael Kinney <michael.d.kinney@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: Ruiyu Ni <Ruiyu.ni@intel.com>
2016-12-26 18:16:59 +08:00
Star Zeng 4ae46dbacd MdeModulePkg UsbKbDxe: Execute key notify func at TPL_CALLBACK
Current implementation executes key notify function in TimerHandler
at TPL_NOTIFY. The code change is to make key notify function
executed at TPL_CALLBACK to reduce the time occupied at TPL_NOTIFY.

The code will signal KeyNotify process event if the key pressed
matches any key registered and insert the KeyData to the EFI Key
queue for notify, then the KeyNotify process handler will invoke
key notify functions at TPL_CALLBACK.

Cc: Ruiyu Ni <Ruiyu.ni@intel.com>
Cc: Michael Kinney <michael.d.kinney@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: Ruiyu Ni <Ruiyu.ni@intel.com>
2016-12-26 18:16:58 +08:00
Star Zeng cf88579c10 MdeModulePkg ConSplitterDxe: Support toggle state sync
Register key notify for toggle state (CapsLock, NumLock and ScrollLock)
sync between multiple keyboards.
The implementation for this feature requires keyboard driver supports
EFI_KEY_STATE_EXPOSED, and turns on physical TextInEx partial key
report for toggle state sync.
The virtual TextInEx will report the partial key after it is required
by calling SetState(X | KEY_STATE_VALID_EXPOSED) explicitly.

Cc: Ruiyu Ni <Ruiyu.ni@intel.com>
Cc: Michael Kinney <michael.d.kinney@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: Ruiyu Ni <Ruiyu.ni@intel.com>
2016-12-26 18:16:58 +08:00
Jiewen Yao 3f31ea1b3d MdeModulePkg/CapsuleLib: Follow UEFI 22.2.3 to process FMP.
Previous logic does not follow UEFI 22.2.3 to process FMP strictly.
It may cause FMP image not be processed in some corner case.
The updated logic follows UEFI 22.2.3.

The way to check if a capsule is processed is also simplified.

The function - ProcessFmpCapsuleImage() is too big, so that
we created sub-functions - StartFmpImage(), DumpAllFmpInfo(),
GetFmpHandleBufferByType(), SetFmpImageData(), RecordFmpCapsuleStatus()
to improve the readability.

The function - ProcessTheseCapsules() is too big, so that
we created sub-functions - InitCapsulePtr(), AreAllImagesProcessed(),
PopulateCapsuleInConfigurationTable() to improve the readability.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2016-12-26 12:23:34 +08:00
Jiewen Yao 777034ce83 MdeModulePkg/CapsuleLib: Support result rolling over.
According to UEFI spec, capsule result variable may roll over to 0.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2016-12-26 12:23:33 +08:00
Jiewen Yao 8f6db16134 MdeModulePkg/CapsuleLib: Add CapsuleTarget support.
UEFI spec requires CapsuleTarget to be a device path associated
with FMP producer.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2016-12-26 12:23:32 +08:00
Jiewen Yao a3850a1b45 MdeModulePkg/CapsuleLib: remove ImageIndex check.
UEFI specification does not require ImageIndex check,
it only requires ImageTypeId check.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2016-12-23 10:13:05 +08:00
Jiewen Yao de5209d5db MdeModulePkg/CapsuleApp: Dump capsule name in record.
According to UEFI spec, capsule report variable should include
a null terminator for capsule name and capsule target, if they are
not present.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2016-12-23 10:08:04 +08:00
Jiewen Yao d8487a34f0 MdeModulePkg/CapsuleLib: Add NULL capsule name in record.
According to UEFI spec, capsule report variable should include
a null terminator for capsule name and capsule target, if they are
not present.

The reserved field is zeroed.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2016-12-23 10:08:04 +08:00
Hao Wu 81a1084340 MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum function logic
This commit refines the logic for the CvtNum function. It avoids using the
decrement operator '--' for array index to prevent possible mis-reports by
static code checkers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
2016-12-22 16:17:21 +08:00
Hao Wu 69e856dfa5 MdeModulePkg/DxeNetLib: Rewrite NetblockChecksum function logic
This commit rewrites the logic for NetblockChecksum. It processes the
checksum of the left-over byte first to prevent possible mis-reports by
static code checkers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
2016-12-22 16:17:19 +08:00
Dandan Bi 9a882490e4 MdeModulePkg/NonDiscoverableDeviceRegistrationLib: Fix coding style issues
1. Fix issues in comments
2. Fix Guid/protocol format

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
2016-12-20 10:51:25 +08:00
Dandan Bi a9e0c1f6ac MdeModulePkg/SataControllerDxe: Fix coding style issue
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-12-20 10:51:23 +08:00
Dandan Bi 4d9ea30931 MdeModulePkg/TerminalDxe: Initialize variable after declaration
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-12-20 10:51:22 +08:00
Dandan Bi 072b2327c1 MdeModulePkg/EmmcDxe: Avoid Non-Boolean type used as Boolean
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
2016-12-20 10:51:20 +08:00
Dandan Bi 789b86acfb MdeModulePkg/EbcDxe: Make variable name follow rules
For variable name, it should contain lower case characters.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2016-12-20 10:51:19 +08:00
Dandan Bi 3a9ac06921 MdeModulePkg/CapsuleApp: Fix Guid format issues
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2016-12-20 10:51:17 +08:00
Dandan Bi 5f16ecdb02 MdeModulePkg/NonDiscoverablePciDevice: Make variable definition follow rule
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2016-12-19 09:20:01 +08:00
Dandan Bi 43b7cd61c9 MdeModulePkg/NonDiscoverablePciDeviceDxe: Add comments for functions
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2016-12-19 09:19:54 +08:00
Dandan Bi 1525ff38cb MdeModulePkg/NonDiscoverablePciDeviceDxe: Fix VS2010/2012 build failure
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2016-12-19 09:19:48 +08:00
Fu Siyuan 471342bbef MdeModulePkg: Replace ASSERT with error return code in PXE driver.
This patch remove the ASSERT when receive a DHCP packet large than the maximum
cache buffer size.

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>
2016-12-19 08:54:15 +08:00
Ard Biesheuvel 16296a126c MdeModulePkg/NonDiscoverablePciDeviceDxe: add support for non-coherent DMA
Add support for non-coherent DMA, either by performing explicit cache
maintenance when DMA mappings are aligned to the CPU's DMA buffer alignment,
or by bounce buffering via uncached mappings otherwise.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2016-12-15 08:20:33 +00:00
Dandan Bi aaa61995af MdeModulePkg/CapsuleApp: Fix GUID/protocol format issues
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2016-12-14 21:34:47 +08:00
Dandan Bi ea7dcfed68 MdeModulePkg: Add missing info string for PCDs
Some Pcds are added to the dec file, but miss to add the
prompt&&help info to the uni file, now add them.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2016-12-14 21:34:46 +08:00
Dandan Bi 11ee1bc93d MdeModulePkg: Make the comments align with the function
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2016-12-14 21:34:45 +08:00
Liming Gao 9a7d1adf5d MdeModulePkg EbcDxe: Fix CLANG38 build failure
Change structure value assignment with CopyMem() API.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2016-12-14 14:38:05 +08:00
Hao Wu 82bf462e3a MdeModulePkg/NonDiscoverablePciDev: Fix type mismatch in switch/case
Fix switch/case statement type mismatch in functions PciIoMemRead &
PciIoMemWrite.

Parameter 'Width' is of enum type EFI_PCI_IO_PROTOCOL_WIDTH, but the enum
type provided in 'switch (Width)' block is of type
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
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>
2016-12-13 11:37:24 +08:00
Jiewen Yao 2961c65425 MdeModulePkg/CapsuleLib: Correct debug message.
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2016-12-13 11:05:41 +08:00
Liming Gao 94a1bc1212 MdeModulePkg PiSmmCore: Retrieve Smram base address from system table
PiSmmIpl records LoadModuleAtFixAddressSmramBase in LMFAConfigurationTable.
Update PiSmmCore to directly get the address from this system table.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiewen Yao <jiewen.yao@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>
2016-12-12 10:52:33 +08:00
Liming Gao a7d10bb09d MdeModulePkg SmmIpl: Fill Smram range for SMM driver when LMFA enable
Allocate the additional Smram range to describe the reserved smram for
SMM core and driver when LMFA feature is enabled.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiewen Yao <jiewen.yao@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>
2016-12-12 10:52:32 +08:00
Liming Gao ddfae2640c MdeModulePkg PiSmmCore: Update FreePages to handle zero address and pages
https://bugzilla.tianocore.org/show_bug.cgi?id=278

Zero memory address or zero number pages are invalid to SmmFreePages().

Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiewen Yao <jiewen.yao@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>
2016-12-12 10:52:31 +08:00
Star Zeng d5aef955b9 MdeModulePkg VariableSmm: Check InfoSize correctly
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=290

Current SmmVariableGetStatistics() in VariableSmm.c is always
checking input InfoSize against the first variable info,
it is incorrect.

For instance, there are three variables.
BootOrder
Boot0000
Boot0001

If the input InfoEntry is holding the second variable info (Boot0000)
and InfoSize is sizeof (VARIABLE_INFO_ENTRY) + StrSize (L"Boot0000"),
current code will return EFI_BUFFER_TOO_SMALL, but it should return
the third variable info (Boot0001).

This patch is to refine the code logic.

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>
2016-12-12 09:55:37 +08:00
Star Zeng 62016c1e89 MdeModulePkg VariableSmm: Do not need check CommBufferSize buffer
Current code in SmmVariableHandler() checks CommBufferSize
buffer to make sure it points to outside SMRAM in
"case SMM_VARIABLE_FUNCTION_GET_STATISTICS".

But after eaae7b33b1,
CommBufferSize buffer points to SMRAM that was used by
SMM core to cache CommSize from SmmCommunication protocol,
then the check will fail definitely and GET_STATISTICS
feature breaks.

In fact, do not need check CommBufferSize buffer at all
even before eaae7b33b1.
Before eaae7b33b1,
CommBufferSize buffer pointed to gSmmCorePrivate->BufferSize
that is outside SMRAM, the check will success definitely;
after eaae7b33b1,
CommBufferSize buffer points to local variable BufferSize
(in SMRAM) in SmmEntryPoint(), the check is not needed
definitely.

The patch is to remove the check.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@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>
2016-12-12 09:17:58 +08:00
Ard Biesheuvel 8b78de74dc MdeModulePkg/NonDiscoverablePciDevice: add missing cast and EFIAPI modifiers
Add missing EFIAPI modifiers to the functions that are exposed via the
PCI I/O protocol.

At the same time, add a missing UINT8 cast which breaks the build on
Visual Studio.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
2016-12-09 14:51:36 +00:00
Dandan Bi f42f22f5dd MdeModulePkg/EbcDxe: Fix incorrect Copyright format
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
2016-12-09 10:38:36 +08:00
Ruiyu Ni 8537bd7ef6 MdeModulePkg/BdsDxe: Initialize gConnectConInEvent earlier
PlatformBootManagerBeforeConsole() might want to trigger this event
to connect ConIn so BdsDxe initializes this event before
PlatformBootManagerBeforeConsole().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
Cc: Chao B Zhang <chao.b.zhang@intel.com>
2016-12-08 10:11:01 +08:00
Ard Biesheuvel a42e6d448d MdeModulePkg: implement generic PCI I/O driver for non-discoverable devices
This implements support for non-discoverable PCI compatible devices, i.e,
devices that are not on a PCI bus but that can be controlled by generic PCI
drivers in EDK2.

This is implemented as a UEFI driver, which means we take full advantage
of the UEFI driver model, and only instantiate those devices that are
necessary for booting.

Care is taken to deal with DMA addressing limitations: DMA mappings and
allocations are moved below 4 GB if the PCI driver has not informed us
that the device being driven is 64-bit DMA capable. DMA is implemented as
coherent, support for non-coherent DMA is implemented by a subsequent patch.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
2016-12-07 09:45:56 +00:00
Ard Biesheuvel 1652dc2158 MdeModulePkg: introduce helper library to register non-discoverable devices
Non-discoverable devices need to be registered explicitly by the platform.
Introduce a helper library that takes care of this.

This implementation currently only supports registering devices that are
covered by one or more MMIO resources. The underlying protocol allows for
more flexibility than that, but this is currently sufficient for the use
cases that we know about.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
2016-12-07 09:01:27 +00:00
Ard Biesheuvel 9598cdc292 MdeModulePkg: introduce non-discoverable device protocol
Introduce a protocol that can be exposed by a platform for devices that
are not discoverable, usually because they are wired straight to the
memory bus rather than to an enumerable bus like PCI or USB.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
2016-12-07 09:01:27 +00:00
Zhang Lubo 5a066b87bd MdeModulePkg: Fix assert in iSCSI.
The bug is caused by using already freed memory.
If there is already an attempt and execute
'reconnect -r' command, all the ConfigFormEntry structure
will be freed in IScsiDriverBindingStop, but the
mCallbackInfo->Current is not configured as null and
this pointer will be used again in IScsiFormExtractConfig.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
2016-12-07 16:13:11 +08:00
Jiewen Yao f1afa0a92d MdeModulePkg/PiSmmCore: use EfiPagesToSize to prevent build error.
EFI_PAGES_TO_SIZE only handles UINTN, so we use EfiPagesToSize
to handle UINT64.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
2016-12-07 13:13:54 +08:00