summaryrefslogtreecommitdiff
path: root/MdeModulePkg
AgeCommit message (Collapse)AuthorFilesLines
2017-12-25MdeModulePkg: Update PCD driver to support the optimized PcdDataBaseLiming Gao8-460/+346
https://bugzilla.tianocore.org/show_bug.cgi?id=546 BaseTools will generate the optimized PCD database to save the image size at build time for multiple SKUs. The optimized PCD database layout will be like below, the PCD database will be composed of the full default SKU data (PCD_DATABASE_INIT) and the non-default SKU delta data(PCD_DATABASE_SKU_DELTA). PCD driver will build HOB to store the full default SKU data, and patch HOB data based on non-default SKU delta data for the SKU set by SetSku(), it can save memory resource at boot time. // // PCD database layout: // +---------------------------------+ // | PCD_DATABASE_INIT (DEFAULT SKU) | // +---------------------------------+ // | PCD_DATABASE_SKU_DELTA (SKU A) | // +---------------------------------+ // | PCD_DATABASE_SKU_DELTA (SKU B) | // +---------------------------------+ // | ...... | // +---------------------------------+ // BaseTools, PCD database and driver updates are needed for this proposal. For single SKU (default) case, this proposal is expected to have no impact. For multi-SKU case, PCD database format will be changed. So, PcdDataBase Version is also updated from 6 to 7. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-25MdeModulePkg PCD: Enable Firmware to retrieve the default settingLiming Gao3-1/+111
https://bugzilla.tianocore.org/show_bug.cgi?id=611 Update PCD driver to retrieve the default setting and set the initial EFI variable when PcdSetNvStoreDefaultId is set. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-25MdeModulePkg HiiDataBase: Enable Firmware to retrieve the default settingLiming Gao3-2/+523
https://bugzilla.tianocore.org/show_bug.cgi?id=611 Update HiiDataBase to retrieve the default setting and patch IFR data Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-25MdeModulePkg: Enable Firmware to retrieve the default settingLiming Gao3-0/+89
https://bugzilla.tianocore.org/show_bug.cgi?id=611 Add two PCDs and new PCD DB format definition Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-25MdeModulePkg VariableDxe: Update it supports normal format variable storageLiming Gao1-1/+112
PEI may report the normal format variable storage HOB for the default EFI variable. VariableDxe needs to support it and set them into NV variable region. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-22MdeModulePkg/DpcLib: return error if failed to locate DPC protocol.Fu Siyuan1-1/+1
This patch updates the constructor of DpcLib to return error if failed to locate DPC protocol. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
2017-12-22MdeModulePkg: Clarify usage of PcdHeapGuardPropertyMaskJian J Wang2-4/+12
Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-22MdeModulePkg/Ip4Dxe: Clean up IP4 interface if failed to open ARP protocol.Fu Siyuan1-0/+1
This patch fixes a bug in Ip4ConfigProtocol, that new created IP interface is not freed if Open ARP protocol failed. Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
2017-12-22MdeModulePkg/Ip4Dxe: Remove redundant code in Ip4Config2InitInstance().Fu Siyuan1-12/+0
Instance->Dhcp4Event is not necessary to be created in Ip4Config2InitInstance. Because it will created in Ip4StartAutoConfig() later. Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
2017-12-22MdeModulePkg/IpIoLib: Check the input parameters before use them.Fu Siyuan2-25/+68
This patch updates the DxeIpIoLib to check the input parameters before using. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
2017-12-22MdeModulePkg/IpIoDxe: Update API description to match the function ↵Fu Siyuan2-8/+30
implementation. This patch updates some API descriptions in DxeIpIoLib to match the real implementation. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
2017-12-22MdeModulePkg/IpIoLib: add more error handling code to DxeIpIoLib.Fu Siyuan2-37/+58
In DxeIpIo, there are several places not check the returned value of called functions. This patch is to add the error handling to these functions. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
2017-12-19MdeModulePkg/Core: Fix incorrect memory map generated in a rare caseJian J Wang2-4/+4
The root cause is that mImagePropertiesPrivateData.CodeSegmentCountMax was not updated with correct value due to the fact that SortImageRecord() called before might change the content of current ImageRecord. This will in turn cause incorrect memory map entries generated in SplitTable(). Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2017-12-18MdeModulePkg: Update Api from NetLibDetectMedia to NetLibDetectMediaWaitTimeout.fanwang27-16/+21
Since new Api NetLibDetectMediaWaitTimeout was involved to support connecting state handling, and it is forward compatible. So apply this Api in MdeModulePkg. V2: *Define time period in a macro instead of hard code. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Signed-off-by: fanwang2 <fan.wang@intel.com>
2017-12-18MdeModulePkg/IpIoLib: return error instead of ASSERT if input parameter is ↵Fu Siyuan2-13/+23
incorrect. This patch updates the DxeIpIoLib to return EFI_INVALID_PARAMETER instead of ASSERT if the input pointers are not correct. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
2017-12-18MdeModulePkg/Ip4Dxe: return error on memory allocate failure instead of ASSERT.Fu Siyuan1-4/+15
This patch updates the IP4 driver to use error status code instead of ASSERT if failed to allocate memory buffer. Reviewed-by: Ye Ting <ting.ye@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
2017-12-15MdeModulePkg/Variable/RuntimeDxe: Modify function return statuschenc21-7/+19
Make VariableServiceSetVariable and VariableServiceQueryVariableInfo functions return status following UEFI 2.7 spec. Cc: Zhang Chao <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: chenc2 <chen.a.chen@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
2017-12-15MdeModulePkg/DxeIplPeim: fix incorrect page table split during protectingJian J Wang1-2/+4
The root cause of this issue is that, during splitting page table, the page size should be the value of next level (smaller one) instead of current level. The wrong page size will then cause wrong page table introduced, which will break the normal boot. Validation works include booting to Windows 10 and Fedora 26 on real Intel platform and OVMF emulated platform in addition to manual checks on page table with JTAG tool. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-15MdeModulePkg PiSmmCore: Use SxDispatch in SmmEndOfDxeHandler()Star Zeng1-32/+33
As some implementation of SMM Child Dispatcher (including SxDispatch) may deny the handler registration after SmmReadyToLock, using SxDispatch in SmmReadyToBootHandler() will be too late. This patch updates code to use SxDispatch in SmmEndOfDxeHandler() instead of SmmReadyToBootHandler(). Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2017-12-13MdeModulePkg PiSmmCore: Ensure SxDispatch not NULL before dereferencedStar Zeng1-1/+1
Cc: Hao Wu <hao.a.wu@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2017-12-13MdeModulePkg/Dhcp4Dxe: Check Media status before starting DHCP process.Jiaxin Wu1-1/+12
This patch is to resolve the issue reported @ https://bugzilla.tianocore.org/show_bug.cgi?id=804. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Karunakar P <karunakarp@amiindia.co.in> Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
2017-12-13MdeModulePkg/Ip4Dxe: Cleanup the resource after error happen during ↵Jiaxin Wu1-9/+37
Ip4StartAutoConfig(). Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wang Fan <fan.wang@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>
2017-12-13MdeModulePkg/UefiPxeBcDxe: Discard the normal ICMP packets and recycle the ↵Jiaxin Wu1-7/+7
received ICMP data. This patch is to discard the normal ICMP packets and recycle the received ICMP data to avoid the memory leak. Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Heyi Guo <heyi.guo@linaro.org> Cc: Ye Ting <ting.ye@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Tested-by: Heyi Guo <heyi.guo@linaro.org> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
2017-12-13MdeModulePkg/PiSmmCore: Fix issues in Heap GuardJian J Wang2-19/+76
One issue is that macros defined in HeapGuard.h GUARD_HEAP_TYPE_PAGE GUARD_HEAP_TYPE_POOL doesn't match the definition of PCD PcdHeapGuardPropertyMask in MdeModulePkg.dec. This patch fixed it by exchanging the BIT0 and BIT1 of them. Another is that method AdjustMemoryF() will return a bigger NumberOfPages than the value passed in. This is caused by counting twice of a shared Guard page which can be used for both head and tail Guard of the memory before it and after it. This happens only when partially freeing just one page in the middle of a bunch of allocated pages. The freed page should be turned into a new Guard page. Cc: Jie Lin <jie.lin@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-13MdeModulePkg/DxeCore: Fix issues in Heap GuardJian J Wang4-28/+88
One issue is that macros defined in HeapGuard.h GUARD_HEAP_TYPE_PAGE GUARD_HEAP_TYPE_POOL doesn't match the definition of PCD PcdHeapGuardPropertyMask in MdeModulePkg.dec. This patch fixed it by exchanging the BIT0 and BIT1 of them. Another is that method AdjustMemoryF() will return a bigger NumberOfPages than the value passed in. This is caused by counting twice of a shared Guard page which can be used for both head and tail Guard of the memory before it and after it. This happens only when partially freeing just one page in the middle of a bunch of allocated pages. The freed page should be turned into a new Guard page. Cc: Jie Lin <jie.lin@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-12MdeModulePkg/PiSmmCore: fix GCC build errorLaszlo Ersek1-1/+1
> MdeModulePkg/Core/PiSmmCore/PiSmmCore.c: In function > 'SmmReadyToBootHandler': > MdeModulePkg/Core/PiSmmCore/PiSmmCore.c:323:14: error: passing argument > 3 of 'SmmLocateProtocol' from incompatible pointer type [-Werror] > ); > ^ > In file included from MdeModulePkg/Core/PiSmmCore/PiSmmCore.c:15:0: > MdeModulePkg/Core/PiSmmCore/PiSmmCore.h:586:1: note: expected 'void **' > but argument is of type 'struct EFI_SMM_SX_DISPATCH2_PROTOCOL **' > SmmLocateProtocol ( > ^ > cc1: all warnings being treated as errors Cc: Eric Dong <eric.dong@intel.com> Cc: Star Zeng <star.zeng@intel.com> Fixes: 7b9b55b2ef7be13608605dc58a54b9ca04be4e40 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
2017-12-12MdeModulePkg/Ip4Dxe: fix ICMP echo reply memory leakHeyi Guo1-0/+3
When UEFI receives ICMP echo packets it will enter Ip4IcmpReplyEcho function, and then call Ip4Output. However, if Ip4Output gets some error and exits early, e.g. fails to find the route entry, memory buffer of "Data" gets no chance to be freed and memory leak will be caused. If there is such an attacker in the network, we will see UEFI runs out of memory and system hangs. So we explicitly free the memory when error status is returned. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Junbiao Hong <hongjunbiao@huawei.com> Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Reviewed-by: Siyuan Fu <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
2017-12-12MdeModulePkg PiSmmCore: Unregister each other for LegacyBoot and EBSStar Zeng1-0/+22
Otherwise, LegacyBoot may be triggered wrongly by other code in UEFI OS, or vice versa. Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2017-12-12MdeModulePkg PiSmmCore: Only install EndOfS3Resume during S3 resumeStar Zeng3-4/+77
Otherwise, it may be triggered wrongly by other code in OS. This patch is to use S3 entry callback to determine if it will be during S3 resume, and check it in SmmReadyToBootHandler(). Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2017-12-12MdeModulePkg: Rename SmmEndOfS3ResumeProtocolGuid to EndOfS3ResumeGuidStar Zeng5-16/+16
Rename SmmEndOfS3ResumeProtocolGuid to EndOfS3ResumeGuid as the GUID may be used to install PPI in future to notify PEI phase code. The references in UefiCpuPkg are also being updated. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2017-12-12MdeModulePkg PiSmmIpl: Add missing update to the prototypeStar Zeng1-7/+17
It is missing to update the prototype of SmmCommunicationCommunicate() in d1632f694be027dee87dd18fa8172d674221face. This patch is to add it. Cc: Dandan Bi <dandan.bi@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
2017-12-12MdeModulePkg/TcpIoLib: Cancel TCP token if connect/accept is timeout.Fu Siyuan1-0/+10
This patch updates TcpIoConnect() and TcpIoAccept() that the Tcp.Cancel() should be invoked to cancel the corresponding request when timeout occurs. 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>
2017-12-12MdeModulePkg/TcpIoLib: Check input Timeout before calling CheckEvent() service.Fu Siyuan2-17/+17
For TcpIoConnect() and TcpIoAccept(), this patch adds the check for Timeout event before calling CheckEvent() service so as to avoid the unnecessary function call. 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>
2017-12-12MdeModulePkg/DxeIpl: Mark page table as read-onlyJian J Wang3-4/+364
This patch will set the memory pages used for page table as read-only memory after the paging is setup. CR0.WP must set to let it take into effect. A simple page table memory management mechanism, page table pool concept, is introduced to simplify the page table memory allocation and protection. It will also help to reduce the potential recursive "split" action during updating memory paging attributes. The basic idea is to allocate a bunch of continuous pages of memory in advance as one or more page table pools, and all future page tables consumption will happen in those pool instead of system memory. If the page pool is reserved at the boundary of 2MB page and with same size of 2MB page, there's no page granularity "split" operation will be needed, because the memory of new page tables (if needed) will be usually in the same page as target page table you're working on. And since we have centralized page tables (a few 2MB pages), it's easier to protect them by changing their attributes to be read-only once and for all. There's no need to apply the protection for new page tables any more as long as the pool has free pages available. Once current page table pool has been used up, one can allocate another 2MB memory pool and just set this new 2MB memory block to be read-only instead of setting the new page tables one page by one page. Two new PCDs PcdPageTablePoolUnitSize and PcdPageTablePoolAlignment are used to specify the size and alignment for page table pool. For IA32 processor 0x200000 (2MB) is the only choice for both of them to meet the requirement of page table pool. Laszlo (lersek@redhat.com) did a regression test on QEMU virtual platform with one middle version of this series patch. The details can be found at https://lists.01.org/pipermail/edk2-devel/2017-December/018625.html There're a few changes after his work. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2017-12-12MdeModulePkg: Correct function description for AllocateBufferStar Zeng4-6/+6
DUAL_ADDRESS_CYCLE is missing in the EFI_UNSUPPORTED return status description. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2017-12-11MdeModulePkg DxeIpl: Move ClearFirst4KPage/IsNullDetectionEnabled definitionStar Zeng2-27/+26
Move ClearFirst4KPage/IsNullDetectionEnabled definition from DxeIpl.h to VirtualMemory.h as they are implemented in VirtualMemory.c and only used in IA32/X64 ARCH. Cc: Jian J Wang <jian.j.wang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
2017-12-11MdeModulePkg: loose VA_COPY with no matching VA_END on a return pathZenith4321-0/+1
In CheckRemainingSpaceForConsistencyInternal, one of the return paths leaves a loose VA_COPY with no matching VA_END. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-09MdeModulePkg/ScsiDisk: Return EFI_NO_MEDIA when no media presentsRuiyu Ni1-11/+30
Current code always return EFI_MEDIA_CHANGED no matter the media is removed from CD/DVD drive or the media is changed. It doesn't strictly follow the UEFI Spec. Update code to return EFI_NO_MEDIA when media is removed. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2017-12-08MdeModulePkg/DxeIpl: Enable paging for Stack GuardJian J Wang4-15/+46
Stack guard feature makes use of paging mechanism to monitor if there's a stack overflow occurred during boot. This patch will check setting of PCD PcdCpuStackGuard. If it's TRUE, DxeIpl will setup page table and set the page at which the stack base locates to be NOT PRESENT. If stack is used up and memory access cross into the last page of it, #PF exception will be triggered. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com> Reviewed-by: Jiewen.yao@intel.com
2017-12-08MdeModulePkg/Core/Dxe: Call new API InitializeCpuExceptionHandlersEx insteadJian J Wang1-1/+1
Original API InitializeCpuExceptionHandlers is used in DxeMain to initialize exception handlers but it does not support setting up stack switch required by Stack Guard feature. Using the new API instead to make sure Stack Guard feature is applicable to most part of code. Since this API is called before memory service initialization, there's no way to call AllocateXxx API to reserve memory. Global variables are used for this special case. GDT table is reserved at least 2KB which should be big enough for all current use cases. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com> Reviewed-by: Jiewen.yao@intel.com
2017-12-08MdeModulePkg/CpuExceptionHandlerLibNull: Add new API implementationJian J Wang1-0/+34
This patch add implementation of new API InitializeCpuExceptionHandlersEx introduced into CpuExceptionHandlerLib on behalf of Stack Guard feature. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com> Reviewed-by: Jiewen.yao@intel.com
2017-12-08MdeModulePkg/CpuExceptionHandlerLib.h: Add a new API ↵Jian J Wang1-0/+97
InitializeCpuExceptionHandlersEx A new API InitializeCpuExceptionHandlersEx() is introduced to support initializing exception handlers with extra functionalities which need extra init data, such as stack switch for Stack Guard feature. EFI_STATUS EFIAPI InitializeCpuExceptionHandlersEx ( IN EFI_VECTOR_HANDOFF_INFO *VectorInfo OPTIONAL, IN CPU_EXCEPTION_INIT_DATA *InitData OPTIONAL ); By default, this method should include all functionalities implemented by InitializeCpuExceptionHandlers(), plus extra initialization works, if any. This is could be done by calling InitializeCpuExceptionHandlers() directly in this method besides the extra works. InitData is optional and its use and content are processor arch dependent. The typical usage of it is to convey resources which have to be reserved elsewhere and are necessary for the extra initialization of exception. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com> Reviewed-by: Jiewen.yao@intel.com
2017-12-08MdeModulePkg/metafile: Add PCD PcdCpuStackGuardJian J Wang2-0/+14
PcdCpuStackGuard is introduced to enable/disable Stack Guard feature. Its value is FALSE by default. This feature is suggested to be enabled only if the cpu driver and CpuExceptionHandlerLib have supported stack switch for the processor used in platform. Otherwise the exception dump message won't be printed out when there's a stack overflow happened. Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com> Reviewed-by: Jiewen.yao@intel.com
2017-12-08MdeModulePkg/NetLib: Fix an error when AIP doesn't support network media ↵fanwang21-0/+18
state detection AIP may not support detecting network media state, in this case, should call NetLibDetectMedia to get media state. This patch is to fix this issue. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> 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: Jiaxin Wu <jiaxin.wu@intel.com>
2017-12-07MdeModulePkg PiSmmIpl: Handle CommSize OPTIONAL caseStar Zeng2-23/+40
Handle CommSize OPTIONAL case for SmmCommunicate. And return EFI_ACCESS_DENIED when CommunicationBuffer is not valid for SMM to access. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2017-12-06MdeModulePkg/NetLib: Add NetLibDetectMediaWaitTimeout() API to support ↵fanwang23-0/+205
EFI_NOT_READY media state detection In wireless connection, connecting state needs to be cared more about. ECR 1772 redefined the state EFI_NOT_READY to represent connecting state and can be retrieved from Aip protocol. This patch adds a new API to check media state at a specified time interval when network is connecting until the connection process finishes or timeout. V2: * Return error status code directly when Aip protocol falied to detect media rather than wait for another time's check. * Set media state default value to EFI_SUCCESS since some platforms may not support retrieving media state from Aip protocol. Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
2017-12-06MdeModulePkg/DisplayEngineDxe: Remove unnecessary parentheses in 'if'Hao Wu1-1/+1
This commit removes unnecessary parentheses in 'if' statements to resolve the build failures by the XCODE5 tool chain. Cc: Eric Dong <eric.dong@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-06MdeModulePkg/PartitionDxe: Remove unnecessary parentheses in 'if'Hao Wu1-1/+1
This commit removes unnecessary parentheses in 'if' statements to resolve the build failures by the XCODE5 tool chain. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-12-05MdeModulePkg/Core/Dxe: log informative memprotect msgs at DEBUG_INFO levelLaszlo Ersek1-4/+9
In commit 7eb927db3e25 ("MdeModulePkg/DxeCore: implement memory protection policy", 2017-02-24), we added two informative messages with the InitializeDxeNxMemoryProtectionPolicy() function: > InitializeDxeNxMemoryProtectionPolicy: applying strict permissions to > active memory regions and > InitializeDxeNxMemoryProtectionPolicy: applying strict permissions to > inactive memory regions The messages don't report errors or warnings, thus downgrade their log masks from DEBUG_ERROR to DEBUG_INFO. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Eric Dong <eric.dong@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1520485 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-12-05MdeModulePkg: Update PeiCore to pass XCODE tool chainLiming Gao1-1/+2
It fixes the warning for loop has empty body [-Werror,-Wempty-body]. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liang Vincent <vincent.liang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>