summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* UefiCpuPkg/dec: Add PcdCpuSmmStaticPageTable.Jiewen Yao2016-11-171-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If enabled, SMM will not use on-demand paging. SMM will build static page table for all memory. The page table size depend on 2 things: 1) The 1G paging capability. 2) The whole system memory/MMIO addressing capability. A) If the system only supports 2M paging, When the whole memory/MMIO is 32bit, we only need 1+1+4=6 pages for 4G. When the whole memory/MMIO is 39bit, we need 1+1+256 pages (~ 1M) When the whole memory/MMIO is 48bit, we need 1+256+256*256 pages (~ 257M) B) If the system supports 1G paging. When the whole memory/MMIO is 32bit, we only need 1+1+4=6 pages for 4G. (We still generate 2M page for maintenance consideration.) When the whole memory/MMIO is 39bit, we still need 6 pages. (We setup 1G paging for >1G.) When the whole memory/MMIO is 48bit, we need 1+256 pages (~ 1M). Cc: Jeff Fan <jeff.fan@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Star Zeng <star.zeng@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> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdeModulePkg/PiSmmCore: Add MemoryAttributes support.Jiewen Yao2016-11-177-26/+2473
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SMM memory attribute table concept is similar to UEFI memory attribute table. The new file MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c and the new code in MdeModulePkg/Core/PiSmmCore/Page.c are based on the algorithms and implementation from MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c and MdeModulePkg/Core/Dxe/Mem/Page.c. These new components are based on the Memory Attributes Table feature from the UEFI Specification and the existing DXE Core implementation that supports that feature. This SMM MemoryAttributes table is produced at SmmEndOfDxe event. So that the consumer (PiSmmCpu) may consult this table to set memory attribute in page table. This patch also installs LoadedImage protocol to SMM protocol database, so that the SMM image info can be got easily to construct the PiSmmMemoryAttributes table. Cc: Jeff Fan <jeff.fan@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Star Zeng <star.zeng@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> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdeModulePkg/dec: Add gEdkiiPiSmmMemoryAttributesTableGuid.Jiewen Yao2016-11-171-0/+3
| | | | | | | | | | | | | | | This table describes the SMM memory attributes. Cc: Jeff Fan <jeff.fan@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Star Zeng <star.zeng@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> Tested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* ArmVirtPkg DxeHobLib: Update func header description of BuildFv(2)Hob()Star Zeng2016-11-171-1/+3
| | | | | | | | | | | | | | | | | | | Update the function header description of BuildFv(2)Hob() to match with HobLib.h in MdePkg. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205 Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> 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: Liming Gao <liming.gao@intel.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
* IntelFrameworkPkg PeiHobLib: Check FV alignment when building FV HOBStar Zeng2016-11-171-1/+69
| | | | | | | | | | | | | | | | | If the FvImage buffer is not at its required alignment, then ASSERT(). Also update the function header description of BuildFv(2)Hob() correspondingly. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205 Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@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> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg HobLib: Check FV alignment when building FV HOBStar Zeng2016-11-174-4/+78
| | | | | | | | | | | | | | | | | If the FvImage buffer is not at its required alignment, then ASSERT(). Also update the function header description of BuildFv(2)Hob() correspondingly. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205 Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@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: Liming Gao <liming.gao@intel.com> Regression-tested-by: Laszlo Ersek <lersek@redhat.com>
* MdeModulePkg DxeCore: Show error message on unaligned FvImage issueStar Zeng2016-11-171-1/+8
| | | | | | | | | | Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205 Cc: Jiewen Yao <jiewen.yao@intel.com> 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg/Ip4Dxe: Correct the return statusJiaxin Wu2016-11-171-7/+3
| | | | | | | | | | | | | | | This patch made the following change: * DataItem->Status should be updated to the status code. * Data should not be freed if EFI_NOT_READY returned. Cc: Santhapur Naveen <naveens@amiindia.co.in> Cc: Laszlo Ersek <lersek@redhat.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: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* MdeModulePkg/Ip4Dxe: Add wrong/invalid subnet checkJiaxin Wu2016-11-172-6/+12
| | | | | | | | | | | | | | | | | | v2: * Separate out the return status fix. * Replace IP4_MASK_MAX with IP4_MASK_NUM. * Remove the ON_EXIT label. This patch is used to add the wrong/invalid subnet check. Cc: Santhapur Naveen <naveens@amiindia.co.in> Cc: Laszlo Ersek <lersek@redhat.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: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg AcpiTables: Use PcdDebugIoPort to describe QEMU debug consoleLiming Gao2016-11-162-1/+5
| | | | | | | Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* MdePkg/BaseLib: Add one wrapper on RdRand access for parameter check.Qin Long2016-11-169-61/+188
| | | | | | | | | | Add one wrapper implementation over assembly RdRand access to check possible NULL parameter, for better alignment with comment description. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qin Long <qin.long@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* UefiCpuPkg/MpInitLib: Update AP information when BSP switchedJeff Fan2016-11-162-0/+4
| | | | | | | | | | | When BSP switched, we need to update some AP information. For example, ApStartupSignalBuffer and ApTopOfStack. Cc: Feng Tian <feng.tian@intel.com> Cc: Michael D 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>
* UefiCpuPkg/MpInitLib: Program AP stack in fixed addressJeff Fan2016-11-164-27/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, MpInitLib will program AP stack in dynamic address. Each processor will calculate its stack address by adding stack size based on the last stack address. That means AP may have the different stack address everytime it is wakeup by INIT-SIPI-SIPI. When all APs have wakeup to execute AP task, each each has been assigned one stack address. Once the timeout happened on some of APs, BSP will send INIT- SIPI-SIPI to wake up APs. We need to re-assign stack for APs. Based on the current implementation, we might assign one stack address used by other APs. It will cause the unexpected stack overlapped issue. This fix changed the stack assignment policy. We will record the stack address assigned to AP at first time AP wakeup. When AP failed on AP task, BSP could reassigned the same stack for it. Getting initial APIC ID in assembly code could help AP to get saved its stack address. Cc: Feng Tian <feng.tian@intel.com> Cc: Michael D 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>
* UefiCpuPkg/MpInitLib: Add InitFlag and CpuInfo in MP_CPU_EXCHANGE_INFOJeff Fan2016-11-164-2/+8
| | | | | | | | Cc: Feng Tian <feng.tian@intel.com> Cc: Michael D 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>
* UefiCpuPkg/MpInitLib: Remove CPU information from CPU_AP_DATAJeff Fan2016-11-162-38/+39
| | | | | | | | | | | | | | | | | Some CPU information (InitialApicId/ApicId/Health) are duplicated in CPU_AP_DATA and CPU_INFO_IN_HOB. This update is to remove the ones from CPU_AP_DATA and update MpInitLib to consume the ones from CPU_INFO_IN_HOB. V2: Fixed potential un-initialized variable issue. Cc: Feng Tian <feng.tian@intel.com> Cc: Michael D 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>
* UefiCpuPkg/MpInitLib: Force sending INIT-SIPI-SIPI to reset APsJeff Fan2016-11-161-0/+5
| | | | | | | | | | | | | | | | If BSP found APs timeout happened when AP executing AP task, BSP will reset APs by WakeUpAP(). However, if ApLoopMode is ApMwaitLoop or ApRunLoop, WakeUpAp() will try to write semaphore in memory to wake up AP. It cannot wake up APs actually if APs still executing AP task. This fix is to set ApInitReconfig flag to force BSP to send INIT-SIPI-SIPI to wake up APs. Cc: Feng Tian <feng.tian@intel.com> Cc: Michael D 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>
* UefiCpuPkg/MpInitLib: Fixed offset error on Cr3LocationJeff Fan2016-11-161-1/+1
| | | | | | | | | | | Cr3Location offset value should be 0x34 not 0x3C. Cc: Feng Tian <feng.tian@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Michael D 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>
* UefiCpuPkg/PiSmmCpuDxeSmm: Free SmramRanges to save SMM spaceJeff Fan2016-11-161-0/+1
| | | | | | | | | Cc: Zeng Star <star.zeng@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Zeng Star <star.zeng@intel.com>
* ShellPkg: #ifndef of header files should have postfix underscoreRuiyu Ni2016-11-163-6/+6
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* ShellPkg/dmpstore: Support "-sfo"Ruiyu Ni2016-11-162-61/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch adds the "-sfo" support to "dmpstore" command. When -l or -d is specified, -sfo is not supported. When the variable specified by name and GUID cannot be found, an error message is displayed; Otherwise, the SFO is displayed. E.g.: "dmpstore -guid GuidThatDoesntExist -sfo" produces output as: ShellCommand,"dmpstore" VariableInfo,"","GuidThatDoesntExist","","","" "dmpstore NameThatDoesntExist -guid GuidThatDoesntExist -sfo" produces output as: ShellCommand,"dmpstore" dmpstore: No matching variables found. Guid GuidThatDoesntExist, Name NameThatDoesntExist The difference between the above 2 cases is that former one only specifies the GUID, but the latter one specifies both name and GUID. Since not specifying GUID means to use GlobalVariableGuid, "dmpstore NameThatDoesntExist -sfo" produces the similar output as latter one. I personally prefer to always produce SFO output for both cases. But the above behavior is the discussion result between HPE engineers. 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> Reviewed-by: Tapan Shah <tapandshah@hpe.com>
* BaseTools tools_def.txt: Include AutoGen.h in GCC ASLPP_FLAGSLiming Gao2016-11-161-5/+5
| | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=227 Refer to VS ASLPP_FLAGS, force include AutoGen.h so that ASL code can use FixedPcdGetXX to get FixedPcd value. 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>
* BaseTools tools_def.txt: Remove -P option in GCC ASLPP_FLAGSLiming Gao2016-11-161-2/+2
| | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=227 After -P option is removed, the generated preprocessed ASL file will have line markers. The extra information can be removed by Trim script. ASL code can refer to the definition in C source file. This has been supported in VS and XCODE tool chains. 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>
* ArmPkg/Library/ArmDmaLib: Deallocate Map buffer in case of errorDaniil Egranov2016-11-151-5/+11
| | | | | | | | | | | | | The patch is fixing memory leak in case of errors. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daniil Egranov <daniil.egranov@arm.com> Tested-by; Ryan Harkin <ryan.harkin@linaro.org> Style fixes: use goto for error handling, whitespace fixes Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* SecurityPkg: Fix typos in commentsZhang, Chao B2016-11-152-2/+2
| | | | | | | | | | | | | | | | This patch fixes the following typos: - intialized -> initialized - TURE -> TRUE - successull -> successfully - hanlder -> handler - funciton -> function - Seperator -> Separator - Sumbit -> Submit Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
* SecurityPkg: Fix typos in commentsZhang, Chao B2016-11-1512-16/+16
| | | | | | | | | | | | | | | | This patch fixes the following typos: - intialized -> initialized - TURE -> TRUE - successull -> successfully - hanlder -> handler - funciton -> function - Seperator -> Separator - Sumbit -> Submit Also convert EFI_D_ERROR to DEBUG_ERROR for some debug messages. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
* MdeModulePkg/CapsuleApp: remove unused definition.Jiewen Yao2016-11-151-3/+0
| | | | | | | | | | | | | remove EFI_CAPSULE_FROM_FILE_DIR remove EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED. no one uses them. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Feng Tian <feng.tian@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: Michael D Kinney <michael.d.kinney@intel.com>
* ShellPkg: Fix typos in comments and variablesGary Lin2016-11-158-18/+18
| | | | | | | | | | | | | - funciton -> function - paramter -> parameter - supresses -> suppresses - Seperator -> Separator - permenant -> permanent Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com>
* OptionRomPkg: Fix typos in commentsGary Lin2016-11-153-6/+6
| | | | | | | | | | - stoping -> stopping - Sumbit -> Submit - pionter -> pointer Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com>
* Nt32Pkg: Fix typos in comments and variablesGary Lin2016-11-157-38/+38
| | | | | | | | | | | | | | | | | | | | | | | | | - discontiguous -> discontinuous - reloaced -> relocated - supresses -> suppresses - debuging -> debugging - suported -> supported - availble -> available - environmemt -> environment - Seperator -> Separator - remmeber -> remember - interperted -> interpreted - the a new -> the new - initailized -> initialized - attribue -> attribute - boundry -> boundary - nto -> not - permenent -> permanent - immediatly -> immediately - excuted -> executed Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com>
* DuetPkg: Fix typos in commentsGary Lin2016-11-158-18/+18
| | | | | | | | | | | | | | | | | | | - TURE -> TRUE - successull -> successfully - Libary -> Library - Incude -> Include - futhure -> future - Predfined -> Predefined - minimue -> minimum - predeined -> predefined - excute -> execute - dirver -> driver - hanlde -> handle - boundry -> boundary Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com>
* BaseTools: FILE DATA to support relative path under Multiple workspaceYonghong Zhu2016-11-151-1/+4
| | | | | | | | | | Fix the bug that FILE DATA to support relative path under Multiple workspace. 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>
* BaseTools: Fix the bug to support generate FFS by Align=AutoYonghong Zhu2016-11-151-1/+3
| | | | | | | | | | | FDF spec support to use 'Auto' as <FfsAlignmentValues>, but current Tool report error about -a=Auto is invalid option when we set Align=Auto for RAW File. 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>
* UefiCpuPkg/PiSmmCpuDxeSmm: Decrease mNumberToFinish in AP safe codeJeff Fan2016-11-154-15/+18
| | | | | | | | | | | | | | | | | | | | | We will put APs into hlt-loop in safe code. But we decrease mNumberToFinish before APs enter into the safe code. Paolo pointed out this gap. This patch is to move mNumberToFinish decreasing to the safe code. It could make sure BSP could wait for all APs are running in safe code. https://bugzilla.tianocore.org/show_bug.cgi?id=216 Reported-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
* UefiCpuPkg/PiSmmCpuDxeSmm: Place AP to 32bit protected mode on S3 pathJeff Fan2016-11-151-5/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | On S3 path, we may transfer to long mode (if DXE is long mode) to restore CPU contexts with CR3 = SmmS3Cr3 (in SMM). AP will execute hlt-loop after CPU contexts restoration. Once one NMI or SMI happens, APs may exit from hlt state and execute the instruction after HLT instruction. If APs are running on long mode, page table is required to fetch the instruction. However, CR3 pointer to page table in SMM. APs will crash. This fix is to disable long mode on APs and transfer to 32bit protected mode to execute hlt-loop. Then CR3 and page table will no longer be required. https://bugzilla.tianocore.org/show_bug.cgi?id=216 Reported-by: Laszlo Ersek <lersek@redhat.com> Analyzed-by: Paolo Bonzini <pbonzini@redhat.com> Analyzed-by: Laszlo Ersek <lersek@redhat.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
* UefiCpuPkg/PiSmmCpuDxeSmm: Put AP into safe hlt-loop code on S3 pathJeff Fan2016-11-154-2/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On S3 path, we will wake up APs to restore CPU context in PiSmmCpuDxeSmm driver. However, we place AP in hlt-loop under 1MB space borrowed after CPU restoring CPU contexts. In case, one NMI or SMI happens, APs may exit from hlt state and execute the instruction after HLT instruction. But the code under 1MB is no longer safe at that time. This fix is to allocate one ACPI NVS range to place the AP hlt-loop code. When CPU finished restoration CPU contexts, AP will execute in this ACPI NVS range. https://bugzilla.tianocore.org/show_bug.cgi?id=216 v2: 1. Make stack alignment per Laszlo's comment. 2. Trim whitespace at end of end. 3. Update year mark in file header. Reported-by: Laszlo Ersek <lersek@redhat.com> Analyzed-by: Paolo Bonzini <pbonzini@redhat.com> Analyzed-by: Laszlo Ersek <lersek@redhat.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
* MdeModulePkg/BMMUI: add comments for function parameterDandan Bi2016-11-151-0/+1
| | | | | | | 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>
* IntelSiliconPkg: Add PCD for Graphics VBT FFS GUIDGiri P Mudusuru2016-11-141-0/+12
| | | | | | | | | | | Added PCD PcdIntelGraphicsVbtFileGuid to store raw format Graphics Video BIOS Table (VBT) in FFS. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Giri P Mudusuru <giri.p.mudusuru@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
* BaseTools/Scripts: Add BinToPcd utilityMichael Kinney2016-11-141-0/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=228 Add a utility that converts a binary file into a VOID* PCD value or a full DSC file VOID* PCD statement with support for all the DSC supported PCD sections. usage: BinToPcd [-h] [--version] -i INPUTFILE [-o OUTPUTFILE] [-p PCDNAME] [-t {VPD,HII}] [-m MAXSIZE] [-f OFFSET] [-n VARIABLENAME] [-g VARIABLEGUID] [-v] [-q] [--debug [0-9]] Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement. Copyright (c) 2016, Intel Corporation. All rights reserved. optional arguments: -h, --help show this help message and exit --version show program's version number and exit -i INPUTFILE, --input INPUTFILE Input binary filename -o OUTPUTFILE, --output OUTPUTFILE Output filename for PCD value or PCD statement -p PCDNAME, --pcd PCDNAME Name of the PCD in the form <PcdTokenSpaceGuidCName>.<PcdCName> -t {VPD,HII}, --type {VPD,HII} PCD statement type (HII or VPD). Default is standard. -m MAXSIZE, --max-size MAXSIZE Maximum size of the PCD. Ignored with --type HII. -f OFFSET, --offset OFFSET VPD offset if --type is VPD. UEFI Variable offset if --type is HII. -n VARIABLENAME, --variable-name VARIABLENAME UEFI variable name. Only used with --type HII. -g VARIABLEGUID, --variable-guid VARIABLEGUID UEFI variable GUID C name. Only used with --type HII. -v, --verbose Increase output messages -q, --quiet Reduce output messages --debug [0-9] Set debug level This utility can be used in PCD value mode to convert a binary file into a string that can then be copied into the PCD value field of a VOID* PCD. The following is an example of PCD value mode on an 8 byte test.bin file. BinToPcd.py -i test.bin {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} The DSC file VOID* PCD statement mode can be used to generate a complete PCD statement for the PCD section types that a DSC file supports: [PcdsFixedAtBuild] [PcdsPatchableInModule] [PcdsDynamicDefault] [PcdsDynamicExDefault] [PcdsDynamicVpd] [PcdsDynamicExVpd] [PcdsDynamicHii] [PcdsDynamicExHii] The PCD statement mode is useful when combined with a !include statement in a DSC file. BinToPcd.py can be used to convert a binary file to a PCD statement in an output file, and that output file can be included into a DSC file in the matching PCD section to set the value of the PCD to the value from the binary file without having to copy the value into the DSC file. Updates can be made to the included file without editing the DSC file. Some example use cases are the setting the public key PCDs such as: gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer The following example converts a public key binary file to a [PcdsFixedAtBuild] compatible PCD statement: BinToPcd.py -i PublicKey.bin -o PublicKey.pcd --pcd gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBufferkenSpaceGuid The PublicKey.pcd output file contains a single line: gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer|{0x48, ...} A DSC file can be updated to include the PublicKey.pcd file: [PcdsFixedAtBuild] !include PublicKey.pcd Value examples =============== BinToPcd.py -i test.bin {0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} Normal examples: ================= BinToPcd.py -i test.bin -p Guid.Token Guid.Token|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} BinToPcd.py -i test.bin -p Guid.Token -m 20 Guid.Token|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}|VOID*|20 VPD examples: ============= BinToPcd.py -i test.bin -p Guid.Token -t VPD Guid.Name|*|8|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} BinToPcd.py -i test.bin -p Guid.Token -t VPD -f 20 Guid.Name|20|8|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} BinToPcd.py -i test.bin -p Guid.Token -t VPD -m 10 Guid.Name|*|10|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} BinToPcd.py -i test.bin -p Guid.Token -t VPD -f 20 -m 10 Guid.Name|20|10|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a} HII examples: ============= BinToPcd.py -i test.bin -p Guid.Token -t HII -g VarGuid -n VarName Guid.Name|L"VarName"|VarGuid|0|{0x48, 0x65, 0x6c, 0x6c} BinToPcd.py -i test.bin -p Guid.Token -t HII -g VarGuid -n VarName -f 8 Guid.Name|L"VarName"|VarGuid|8|{0x48, 0x65, 0x6c, 0x6c} Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* EmbeddedPkg: MmcDxe: add SPEC_VERS field in CSD structureHaojian Zhuang2016-11-141-1/+2
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Tested-by: Ryan Harkin <ryan.harkin@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* EmbeddedPkg: MmcDxe: declare ECSD structureHaojian Zhuang2016-11-142-3/+158
| | | | | | | | | | Declare fields in ECSD structure. And drop the original 128 words arrary. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Tested-by: Ryan Harkin <ryan.harkin@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* EmbeddedPkg: MmcDxe: move ECSD into CardInfo structureHaojian Zhuang2016-11-142-3/+3
| | | | | | | | | | Since ECSD also describes the information of card, move it into structure CardInfo. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Tested-by: Ryan Harkin <ryan.harkin@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* EmbeddedPkg: MmcDxe: wait OCR busy bit freeHaojian Zhuang2016-11-141-3/+8
| | | | | | | | | | | According to eMMC spec, OCR.PowerUp bit is also busy bit. If the busy bit is '0', CMD1 should be sent and OCR should be fetched again. And add a timeout counter on the repeated steps. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Tested-by: Ryan Harkin <ryan.harkin@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* DuetPkg: Add POSTBUILD in DSC files to run post-build automaticallyHao Wu2016-11-1410-150/+105
| | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=220 Currently, the post-build scripts PostBuild.bat/PostBuild.sh in DuetPkg need to be run manually. Especially for Windows batch script, it also requires users to set the build options (like tool chain, target and arch) in file Conf/target.txt. If users using command line options via '-t' or '-a', the post-build script won't work properly. The package DSC files now support the feature to execute post-build script automatically by adding a 'POSTBUILD' definition. This feature also passes the build options into the post-build script as parameters. This commit uses this feature to make the post-build works for DuetPkg more user-friendly. Also, ReadMe.txt is updated to reflect the new steps for UEFI Emulation (DUET) development. 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>
* DuetPkg: Use 'echo off' in BATCH script filesHao Wu2016-11-143-143/+146
| | | | | | | | | | Instead of putting a '@' at the beginning of every command in BATCH script files, use 'echo off' at the beginning of each file. 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>
* DuetPkg: Resolve white-space issues for post-build scripts & ReadMeHao Wu2016-11-145-211/+211
| | | | | | | 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>
* MdeModulePkg/UsbMass: Revert changes of removing retry logicFeng Tian2016-11-142-12/+3
| | | | | | | | | | | | | | This patch is used to revert changes done in commit 17f3e942 bc527fbd75068d2d5752b6af54917487 - "MdeModulePkg/UsbMass: Not retry if usb bot transfer execution fail" It's because Usb Floppy will report DEVICE_ERROR for the first several cmds when it need spin up. so retry logic makes sense. Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* IntelFsp2Pkg: Support to return error status from FSP API doneThomaiyar, Richard Marian2016-11-142-23/+163
| | | | | | | | | | | | | | | | Added FspMemoryInitDone2, FspTempRamExitDone2, FspSiliconInitDone2 to return error status to Boot Loader for FSP API calls. To maintain backward compatibility existing functions (FspMemoryInitDone, FspTempRamExitDone, FspSiliconInitDone) declaration left untouched. Cc: Maurice Ma <maurice.ma@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Richard Thomaiyar <richard.marian.thomaiyar@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
* MdePkg: Fix spec mismatch in string representation of EMMC dev nodeFeng Tian2016-11-142-2/+2
| | | | | | | | Cc: Eric Jin <eric.jin@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* UefiCpuPkg/DxeMpLib: Place APs to suitable state on Legacy OS bootJeff Fan2016-11-142-0/+13
| | | | | | | | | | | | | | | | | Currently, DxeMpLib only places APs into specified c-state in Exit Boot Service callback function for UEFI OS boot. We need to put APs into specified c-state for legacy OS boot also. https://bugzilla.tianocore.org/show_bug.cgi?id=210 Cc: Laszlo Ersek <lersek@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael D 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>
* UefiCpuPkg/DxeMpLib: Rename MpInitExitBootServicesCallback()Jeff Fan2016-11-141-3/+3
| | | | | | | | | | | | | | | | | Rename MpInitExitBootServicesCallback() to MpInitChangeApLoopCallback() because it will not only be invoked on Exit Boot Service Event, but also will be invoked on Legacy Ready To Boot Event. https://bugzilla.tianocore.org/show_bug.cgi?id=210 Cc: Laszlo Ersek <lersek@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael D 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>