summaryrefslogtreecommitdiffstats
path: root/MdePkg
Commit message (Collapse)AuthorAgeFilesLines
* MdePkg/Include: Add VA list support for VS2017/ARMPete Batard2018-02-071-0/+13
| | | | | | | | | VA_START, VA_END and VA_COPY are the same as the generic macros. VA_ARG was reverse engineered from MS ARM assembly output. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Pete Batard <pete@akeo.ie> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/Library/BaseLib: Enable VS2017/ARM buildsPete Batard2018-02-072-4/+17
| | | | | | | | | Most of the RVCT assembly can be reused as is for MSFT except for CpuBreakpoint.asm, which we need to force to Arm mode. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Pete Batard <pete@akeo.ie> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/Library/BaseStackCheckLib: Add Null handler for VS2017/ARMPete Batard2018-02-072-2/+21
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Pete Batard <pete@akeo.ie> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg: Disable some Level 4 warnings for VS2017/ARMLiming Gao2018-02-071-21/+75
| | | | | | | | | | | We disable the exact same warnings as IA32 and X64. Also create a dummy macro for PRESERVE8, as this is not supported by the Microsoft ARM assembler. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Pete Batard <pete@akeo.ie> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg ACPI: Add some macros for PPTTHeyi Guo2018-02-071-0/+18
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ming Huang <huangming23@huawei.com> Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/SafeString: Fix potential out-of-bound memory accessRuiyu Ni2018-02-061-9/+9
| | | | | | | | | | | | | | | | | | | | | | Today's implementation of [Ascii]StrnCpyS/[Ascii]StrnCatS calls StrnLenS () to get the length of source string but supplies the destination buffer size as max size. It's a bug that may cause out-of-bound memory access. For example: StrnCpyS (Dest[10], 10, "hello", 6) -> StrnLenS ("hello", 10) //< cause out-of bound memory access In a pool guard enabled environment, when using shell to edit an existing file which contains empty line, the page fault is met. The patch fixes the four library functions to avoid such out-of-bound memory access. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com>
* MdePkg/SimpleTextInEx.h: Fix comments alignmentRuiyu Ni2018-02-011-8/+5
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdePkg SafeIntLib: Update API definition to use the same output nameLiming Gao2018-02-011-6/+6
| | | | | | | | | | In SafeUintnToChar8(), update its output parameter name. Update pui8Result --> Result to match its library implementation Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* MdePkg ACPI: Correct processor struct of PPTTMing Huang2018-01-311-1/+1
| | | | | | | | | | | The Type field of EFI_ACPI_6_2_PPTT_STRUCTURE_PROCESSOR should be UINT8 as ACPI version 6.2 specification. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ming Huang <huangming23@huawei.com> Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/BaseSafeIntLib: Add SafeIntLib class and instanceSean Brogan2018-01-2515-9/+8915
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=798 SafeIntLib provides helper functions to prevent integer overflow during type conversion, addition, subtraction, and multiplication. Conversion Functions ==================== * Converting from a signed type to an unsigned type of the same size, or vice-versa. * Converting to a smaller type that could possibly overflow. * Converting from a signed type to a larger unsigned type. Unsigned Addition, Subtraction, Multiplication =============================================== * Unsigned integer math functions protect from overflow and underflow (in case of subtraction). Signed Addition, Subtraction, Multiplication ============================================ * Strongly consider using unsigned numbers. * Signed numbers are often used where unsigned numbers should be used. For example file sizes and array indices should always be unsigned. Subtracting a larger positive signed number from a smaller positive signed number with SafeInt32Sub() will succeed, producing a negative number, that then must not be used as an array index (but can occasionally be used as a pointer index.) Similarly for adding a larger magnitude negative number to a smaller magnitude positive number. * SafeIntLib does not protect you from such errors. It tells you if your integer operations overflowed, not if you are doing the right thing with your non-overflowed integers. * Likewise you can overflow a buffer with a non-overflowed unsigned index. Based on content from the following branch/commits: https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport https://github.com/Microsoft/MS_UEFI/commit/21ef3a321c907b40fa93797619c9f6c686dd92e0 https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61 https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* SecurityPkg:Tpm2DeviceLibDTpm: Support TPM command cancelZhang, Chao B2018-01-251-2/+6
| | | | | | | | | | | Support TPM Command cancel if executing command timeouts. Cancel could happen in long running command case Cc: Yao Jiewen <jiewen.yao@intel.com> Cc: Chinnusamy Rajkumar K <rajkumar.k.chinnusamy@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chao Zhang <chao.b.zhang@intel.com> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
* MdePkg Smbios.h: Update spec version info to 3.1.1Star Zeng2018-01-231-2/+2
| | | | | | | | | | | It was missed to be updated at SHA-1: 043026ac12c29703bb7e3c19b9ae5e8177bb554b. Cc: Liming Gao <liming.gao@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg: Update DEC and DSC version from 1.07 to 1.08Liming Gao2018-01-222-4/+4
| | | | | | | | UEFI2.7/PI1.6 have been added in MdePkg. Update DEC and DSC version to reflect those changes in MdePkg. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com>
* MdePkg/DMAR: Add the definition for DMA_CTRL_PLATFORM_OPT_IN_FLAG bitHao Wu2018-01-191-6/+12
| | | | | | | | | | | | For the support of VTd 2.5, add the BIT definition of DMA_CTRL_PLATFORM_OPT_IN_FLAG Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@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: Jiewen Yao <jiewen.yao@intel.com>
* MdePkg/BaseLib: add attribute 'RETURNS_TWICE' to SetJumpM1cha2018-01-103-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When compiling with any ARM toolchain and Os, registers can get trashed when returning for the second time from SetJump because GCC only handles this correctly when using standard names like 'setjmp' or 'getcontext'. When different names are used you have to use the attribute 'returns_twice' to tell gcc to be extra careful. example: extern int FN_NAME(void*); void jmp_buf_set(void *jmpb, void (*f)(void)) { if (!FN_NAME(jmpb)) f(); } this code produces this wrong code with Os: 00000000 <jmp_buf_set>: 0: e92d4010 push {r4, lr} 4: e1a04001 mov r4, r1 8: ebfffffe bl 0 <nonstandard_setjmp> c: e3500000 cmp r0, #0 10: 01a03004 moveq r3, r4 14: 08bd4010 popeq {r4, lr} 18: 012fff13 bxeq r3 1c: e8bd4010 pop {r4, lr} 20: e12fff1e bx lr The generated code pushes backups of r4 and lr to the stack and then saves all registers using nonstandard_setjmp. Then it pops the stack and jumps to the function in r3 which is the main problem because now the function can overwrite our register backups on the stack. When we return a second time from the call to nonstandard_setjmp, the stack pointer has it's original(pushed) position and when the code pops r4 and lr from the stack the values are not guaranteed to be the same. When using a standard name like setjmp or getcontext or adding '__attribute__((returns_twice))' to nonstandard_setjmp's declaration the code looks different: 00000000 <jmp_buf_set>: 0: e92d4007 push {r0, r1, r2, lr} 4: e58d1004 str r1, [sp, #4] 8: ebfffffe bl 0 <setjmp> c: e3500000 cmp r0, #0 10: 059d3004 ldreq r3, [sp, #4] 14: 01a0e00f moveq lr, pc 18: 012fff13 bxeq r3 1c: e28dd00c add sp, sp, #12 20: e49de004 pop {lr} ; (ldr lr, [sp], #4) 24: e12fff1e bx lr Here the problem is being solved by restoring r3 from the stack without popping it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg: add RETURNS_TWICE attributeM1cha2018-01-101-0/+20
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/PciExpressLib.h: Add missing include of PciExpress21.hRuiyu Ni2018-01-091-1/+3
| | | | | | | | | PCI_ECAM_ADDRESS() macro is defined in PciExpress21.h so always include PciExpress21.h in the library header file. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/BasePrintLib: Fix incomplete print outputWang, Jian J2018-01-021-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is caused by previous patch which tried to fix string over-read, which breaks UEFI menu rendering: the following /------------------------------------------------------------------------------\ | Device Manager | \------------------------------------------------------------------------------/ is rendered as /\ | Device Manager | \/.0 2.00 GHz (the spurious digits are SMBIOS data from the home screen) The problem appears to be that the CHAR16 value of BOXDRAW_HORIZONTAL equals 0x2500, which means that testing ArgumentString[] != '\0' (which tests the low byte only) will yield FALSE and terminate the loop prematurely. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/BasePrintLib: Fix error in Precision position calculationJian J Wang2017-12-281-2/+5
| | | | | | | | | | | | | | Due to a potential hole in the stop condition of loop, the two continuous access to ArgumentString (index, index+1) inside the loop might cause the string ending character ('\0') and the byte after it to be read. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/BaseLib.h: Rollback field name changesJian J Wang2017-12-271-36/+36
| | | | | | | | | Rollback commit 47595ac0b96aaa18246ac1be4a238893dd0aa0fe The original names follows the spec definition. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg: Update PI spec version to 1.6 in MdePkg.decLiming Gao2017-12-271-1/+1
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdePkg/BaseLib.h: Coding style clean-upJian J Wang2017-12-261-37/+37
| | | | | | | | | Cc: Dandan Bi <dandan.bi@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: Dandan Bi <dandan.bi@intel.com>
* MdePkg Acpi60.h: Add missing PCCT subspace type 1 and 2 definitionsStar Zeng2017-12-222-2/+94
| | | | | | | | | | | | Same change is done for Acpi61.h. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Chasel Chiu <chasel.chiu@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: Liming Gao <liming.gao@intel.com>
* MdePkg MemoryOverwriteControl.h: Correct typo 'bi' to 'bit'Star Zeng2017-12-191-1/+1
| | | | | | | | | Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Chao Zhang <chao.b.zhang@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>
* MdePkg/Include/Pi: Modify specification number encodingHao Wu2017-12-152-5/+5
| | | | | | | | | | | | | Change the PEI and DXE service table revisions to 1.6. The SMM part is already done by commit: 07c6a47e70ba54709b0e26237770f3c38685e860 & 2f208e59e4b994978a1a24affc306eb694a00327 Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/UefiSpec.h: Update the UEFI version to reflect new revisionHao Wu2017-12-151-3/+4
| | | | | | | Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg: correct and clarify documentation of VA_LIST in Base.hZenith4322017-12-121-8/+17
| | | | | | | | | | | | This is to resolve bug 457. https://bugzilla.tianocore.org/show_bug.cgi?id=457 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com> [lersek@redhat.com: reconstruct commit from patch pasted into email] Signed-off-by: Laszlo Ersek <lersek@redhat.com>
* MdePkg PciIo.h: Correct function description for ALLOCATE_BUFFERStar Zeng2017-12-121-2/+2
| | | | | | | | | | | | | | 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> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@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>
* MdePkg/Uefi ARM: only support native ARM/Thumb imagesArd Biesheuvel2017-12-111-3/+2
| | | | | | | | | | | | | The ARM calling convention is fundamentally incompatible with EBC, and having a cross compatible machine type identical to the native type does not make a lot of sense either. So restrict the compatible machine type for ARM to EFI_IMAGE_MACHINE_ARMTHUMB_MIXED, and remove the cross compatible. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/BaseLib: Add stack switch related definitions for IA32Jian J Wang2017-12-084-0/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new definitions include two structures IA32_TASK_STATE_SEGMENT IA32_TSS_DESCRIPTOR two macros IA32_GDT_TYPE_TSS IA32_GDT_ALIGNMENT and one API VOID EFIAPI AsmWriteTr ( IN UINT16 Selector ); They're needed to setup task gate and interrupt stack table for stack switch. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@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
* MdePkg: Arm/AArch64 - filter #pragma pack() when __ASSEMBLER__Leif Lindholm2017-12-072-2/+2
| | | | | | | | | | | | clang, when used as a preprocessor for dtc, does not discard #pragma statements although -x assembler-with-cpp is specified. This causes dtc to barf at a #pragma pack() statement that is already filtered out for __GNUC__. So add a check to also filter this out if __ASSEMBLER__. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg MmCommunication.h: Follow PI spec to update EFI_MM_COMMUNICATEStar Zeng2017-12-071-2/+12
| | | | | | | | | | | | Follow PI spec (>= 1.5) to add new return status code description and make CommSize OPTIONAL. 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.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
* MdePkg PiFirmwareVolume.h: Add USED_SIZE FV_EXT_TYPE definitionsStar Zeng2017-12-011-2/+21
| | | | | | | | | | | | | | | | The definitions are introduced by PI 1.6 spec. The EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE can be used to find out how many EFI_FVB2_ERASE_POLARITY bytes are at the end of the FV. When the FV gets shadowed into memory you only need to copy the used bytes into memory and fill the rest of the memory buffer with the erase value. 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: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/SerialDxe: Fix return valued in SerialSetAttributesJulien Grall2017-11-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | SerialSetAttributes is meant to match the behavior of the function EFI_SERIAL_IO_PROTOCOL.SetAttributes() in the UEFI spec (v2.7). This means the function can only return: - EFI_SUCCESS - EFI_INVALID_PARAMETER - EFI_DEVICE_ERROR However the function SerialPortSetAttributes may also validly return EFI_UNSUPPORTED. For instance this is the case of the Xen Console driver. EFI_UNSUPPORTED could be also interpreted as "One or more of the attributes has an unsupported value". So return EFI_INVALID_PARAMETER in that case. Lastly, to prevent another return slipping in the future, all the errors but EFI_INVALID_PARAMETER and EFI_UNSUPPORTED will return EFI_DEVICE_ERROR. Contributed-under: Tianocore Contribution Agreement 1.1 Signed-off-by: Julien Grall <julien.grall@linaro.org> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* MdeModulePkg/SerialDxe: Describe correctly EFI_DEVICE_ERROR for SetAttributesJulien Grall2017-11-301-1/+1
| | | | | | | | | | | Per the UEFIv2.7 spec, EFI_DEVICE_ERROR is returned when the serial device is not functioning correctly. Update the description to avoid confusion. Contributed-under: Tianocore Contribution Agreement 1.1 Signed-off-by: Julien Grall <julien.grall@linaro.org> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* MdePkg: Disable VS warning 4701 & 4703 for VS2017Liming Gao2017-11-292-4/+4
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* MdePkg: Fix MSFT C4255 warningSong, BinX2017-11-143-2/+3
| | | | | | | | | | | | | | | | | | V2: Fix MSFT C4255 warning V1: Enable MSFT C4255 warning. From MSDN: Compiler Warning (level 4) C4255 function' : no function prototype given: converting '()' to '(void)' The compiler did not find an explicit list of arguments to a function. This warning is for the C compiler only. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bell Song <binx.song@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg: Add definitions for the SPI protocols introduced in PI 1.6.Marvin.Haeuser@outlook.com2017-11-1312-0/+1721
| | | | | | | | | | | | | | | | | | | | | | | | This commit adds header files for the SPI protocols introduced in the UEFI PI 1.6 specification, as well as their GUIDs to MdePkg.dec. EFI_SPI_TRANSACTION_TYPE assumes an enum with its members ordered the way they are listed in the specification, as there are no values given explicitely. EFI_LEGACY_SPI_CONTROLLER_GUID assumes the character 'l' used in the specification was meant to be '1'. V2: - Fixed LegacySpiFlash.h's header guard. - Fixed LegacySpiSmmController's GUID name. - Removed EFI_SPI_NOR_FLASH_PROTOCOL_LF_READ_DATA as it's unused. - Added the missing SpiSmmNorFlash header. - Fixed all file endings to be CRLF. - Removed trailing whitespaces. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/NvdimmLabel.h: Add NVDIMM_LABEL protocol definitionRuiyu Ni2017-11-092-0/+354
| | | | | | | | | | NVDIMM_LABEL protocol is defined in UEFI 2.7 spec, to provide services that allow management of labels contained in a Label Storage Area in NVDIMM. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/Btt.h: Add Block Translation Table definitionsRuiyu Ni2017-11-092-0/+234
| | | | | | | | | | BTT definitions are defined in UEFI spec 2.7, to defines a layout and set of rules for doing block I/O that provide powerfail write atomicity of a single block in NVDIMM. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg/PciExpress21.h: Fix typo in PCI_REG_PCIE_SLOT_CONTROLRuiyu Ni2017-11-081-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | PCI_REG_PCIE_SLOT_CONTROL contains a typo. It is defined as: typedef union { struct { UINT32 AttentionButtonPressed : 1; UINT32 ... ... } Bits; UINT16 Uint16; } PCI_REG_PCIE_SLOT_CONTROL; The bit field data type should be UINT16 instead of UINT32, results sizeof (PCI_REG_PCIE_SLOT_CONTROL) equals to 4 instead of 2. Because this structure is used in PCI_CAPABILITY_PCIEXP as below: typedef struct { ... PCI_REG_PCIE_SLOT_CONTROL SlotControl; PCI_REG_PCIE_SLOT_STATUS SlotStatus; } PCI_CAPABILITY_PCIEXP; It cause the OFFSET_OF (PCI_CAPABILITY_PCIEXP, SlotStatus) equal to a wrong value. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdePkg: Deprecate EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESSZhang, Chao B2017-11-013-10/+10
| | | | | | | | | | | Mark EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS as deprecated. Also update some function descriptors accordingly. Cc: Long Qin <qin.long@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chao Zhang <chao.b.zhang@intel.com> Reviewed-by: Long Qin <qin.long@intel.com>
* SecurityPkg/Pkcs7Verify: Add the comments to address security problemLong Qin2017-10-181-1/+9
| | | | | | | | | | | | | | | | | | | | Add the comments to address security problems in the Pkcs7Verify Protocol per UEFI 2.7 updates. The Pkcs7Verifier function VerifySignature() has problematic use cases where it might be used to unwittingly bypass security checks. The specific problem is that if the supplied hash is a different algorithm from the blacklist hash, the hash will be approved even if it should have been denied. The added comments place a strong warning about the problem. It is possible to use the protocol reliably, either by agreeing a hash to use for all time (like sha256) or by looping over all supported hashes when using the protocol. Cc: Chao Zhang <chao.b.zhang@intel.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qin Long <qin.long@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
* MdePkg HobLib: Add BuildFv3Hob APIStar Zeng2017-10-104-4/+159
| | | | | | | | | | Add BuildFv3Hob API in HobLib.h and implement the API in HobLib instances PeiHobLib, DxeHobLib and DxeCoreHobLib. 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: Liming Gao <liming.gao@intel.com>
* MdePkg PiHob.h: Add FV3 HOB definitionsStar Zeng2017-10-101-2/+41
| | | | | | | | | Follow PI 1.6 spec to add FV3 HOB definitions 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: Liming Gao <liming.gao@intel.com>
* MdePkg: Add definitions for ACPI 6.2Star Zeng2017-10-102-2/+2944
| | | | | | | | 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: Liming Gao <liming.gao@intel.com>
* MdePkg: Correct BaseS3PciSegmentLib module name to match its uni fileLiming Gao2017-10-101-2/+2
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
* MdePkg BaseLib: Add new API CalculateCrc32()Liming Gao2017-10-102-0/+314
| | | | | | | | | CalculateCrc32() bases on the initialized mCrcTable. When CalculateCrc32() is used, mCrcTable will take 1KB size in the image. When CalculateCrc32() is not used, mCrcTable will not be built in the image, and no size impact. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com>
* MdePkg: Correct EfiGcdMemoryTypePersistent name to follow PI specLiming Gao2017-10-101-1/+5
| | | | | | | | | | PI spec defines EfiGcdMemoryTypePersistent name, MdePkg uses EfiGcdMemoryTypePersistentMemory name. So, EfiGcdMemoryTypePersistent is added. And, EfiGcdMemoryTypePersistentMemory is kept for compatility. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdePkg/IndustryStandard/Pci23: add vendor-specific capability headerLaszlo Ersek2017-10-031-0/+10
| | | | | | | | | | | | | | | | | | | | | | Revision 2.2 of the PCI Spec defines Capability IDs 0 through 6, inclusive, in Appendix H. It reserves IDs 7 through 255. Revision 2.3 of the PCI Spec adds Capability IDs 7 through 0xC, inclusive, in Appendix H. Capability ID 9 stands for "Vendor Specific". Add the EFI_PCI_CAPABILITY_ID_VENDOR macro and the EFI_PCI_CAPABILITY_VENDOR_HDR structure type to MdePkg/IndustryStandard, in order to describe this capability header. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Marcel Apfelbaum <marcel@redhat.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>