summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* BaseTools: Correct Target Path in CodaTargetList replace PathYunhua Feng2018-01-101-1/+2
| | | | | | | | | | | Target Path in CodaTargetList is DebugDir path, correct replace path with DebugDir Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* MdeModulePkg/PciBus: Change switch-case to if-else to fix EBC buildRuiyu Ni2018-01-101-13/+7
| | | | | | | | | | | EBC compiler doesn't treat EFI_xxx as constant due to these macros are UINT64 type in 64bit env and UINT32 type in 32bit env. So it reports error when "case EFI_xxx" is used. The patch changes to use if-else to fix EBC build failure. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* UefiCpuPkg/MtrrLib: Correct typo to change vector to vertexRuiyu Ni2018-01-101-95/+95
| | | | | | | | | | The patch only change the comments and variable name so doesn't impact the functionality. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Cc: Star Zeng <star.zeng@intel.com>
* UefiCpuPkg/MtrrLib: Handle one setting request covering all memoryRuiyu Ni2018-01-101-1/+6
| | | | | | | | | | | *SetMemoryAttribute*() API cannot handle the setting request that looks like <0, MAX_ADDRESS, Type>. The buggy parameter checking logic returns Unsupported for this case. The patch fixes the checking logic to handle such case. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* UefiCpuPkg/MtrrLib: Fix bug that may calculate wrong MTRR resultRuiyu Ni2018-01-101-12/+25
| | | | | | | | | | | | | Code forgot to initialize the optional weight between adjacent vertices. It caused wrong MTRR result was calculated for some memory settings. The logic was incorrectly removed when converting from POC code. The patch adds back the initialization. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* UefiCpuPkg/MtrrLib: Refine the debug messagesRuiyu Ni2018-01-101-30/+53
| | | | | | | | | | | | | MtrrSetMemoryAttributesInMtrrSettings() missed the debug messages of memory attribute request and status. The patch moves all debug messages from MtrrSetMemoryAttributeInMtrrSettings() to MtrrSetMemoryAttributesInMtrrSettings() and refines the debug message to carry more information. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Cc: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/MdeModulePkg.uni: clarify Heap Guard usageJian J Wang2018-01-101-2/+10
| | | | | | | | 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>
* MdeModulePkg/MdeModulePkg.dec: clarify Heap Guard usageJian J Wang2018-01-101-0/+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>
* NetworkPkg/IScsiDxe: Set ExitBootServiceEvent to NULL after close it.Jiaxin Wu2018-01-101-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | v2: * Refine the commit log. There are two place to close the ISCSI ExitBootServiceEvent: #1.IScsiOnExitBootService(), which is the callback function of ExitBootServiceEvent. #2.IScsiCleanDriverData(), which will be invoked by ISCSI driver binding stop(). So, the ExitBootServiceEvent will be closed and freed when exit boot server is triggered. But it may be closed and freed again in ISCSI driver binding stop(), which will result in the issue recorded at https://bugzilla.tianocore.org/show_bug.cgi?id=742. This patch is to resolve the issue. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* MdeModulePkg/IScsiDxe: Set ExitBootServiceEvent to NULL after close it.Jiaxin Wu2018-01-101-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | v2: * Refine the commit log. There are two place to close the ISCSI ExitBootServiceEvent: #1.IScsiOnExitBootService(), which is the callback function of ExitBootServiceEvent. #2.IScsiCleanDriverData(), which will be invoked by ISCSI driver binding stop(). So, the ExitBootServiceEvent will be closed and freed when exit boot server is triggered. But it may be closed and freed again in ISCSI driver binding stop(), which will result in the issue recorded at https://bugzilla.tianocore.org/show_bug.cgi?id=742. This patch is to resolve the issue. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* NetworkPkg/HttpDxe: Fix build warning error if CHAR8 is unsigned.Jiaxin Wu2018-01-101-2/+2
| | | | | | | | | | | | | | | | | | | | This patch is to fix the compiler warning error: C4245. The issue will happen if the below build option is enabled: *_*_*_CC_FLAGS = -J. That's because the value of ('A' - 'a') is a negative value, which will be converted to an unsigned type if CHAR8 is treated as unsigned: Src -= ('A' - 'a'); The above issue is also recorded at: https://bugzilla.tianocore.org/show_bug.cgi?id=815. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* MdeModulePkg: Freed packet buffer when error occurs to avoid memory leak.Wang Fan2018-01-101-1/+5
| | | | | | | | | | | | | | * In function Mtftp4WrqSendBlock(), when packet is not needed, function returns EFI_ABORTED but not freed the packet buffer. It results some memory leak and this patch is to fix this issue. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* MdeModulePkg: Fixed two issues when error occurs in Mtftp4Start.Wang Fan2018-01-101-8/+12
| | | | | | | | | | | | | | | | * This function sets returned status as token status and signal token when error occurs, and it results token status not compliance with spec definition. This patch fixed this issue. * This function restore Tpl twice when Mtftp4WrqStart() returns an error, this patch fixed this issue. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* UefiCpuPkg/MpInitLib: fix wrong address set as Stack Guard for APsJian J Wang2018-01-101-1/+18
| | | | | | | | | | | | | | The reason is that DXE part initialization will reuse the stack allocated at PEI phase, if MP was initialized before. Some code added to check this situation and use stack base address saved in HOB passed from PEI. 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: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* UefiCpuPkg/MpInitLib: fix incorrect stack top init for cpu0Jian J Wang2018-01-101-1/+1
| | | | | | | | | | | | | | | | As the name suggests, CpuMpData->CpuInfoInHob[0].ApTopOfStack must be init to the top of stack. But the MpInitLibInitialize() passed the base address of stack to InitializeApData(), which is not correct. Although this stack is not used for BSP, it's should be fixed in case of misunderstanding and future possible code changes. 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: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* BaseTools: Add back the cc71d8 version's fixYonghong Zhu2018-01-091-6/+6
| | | | | | | | The version cc71d8's fix was washed out by structure pcd report patch. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Not print SKUID info for PCD when it is only Single SKUIDYonghong Zhu2018-01-091-35/+59
| | | | | | | | | | when it is only single SKUID, we don't need to print the SKUID info for every PCD since in the Global section there already have this info. For DefaultStore, we use same rule. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* UefiCpuPkg/MpInitLib: Fix a bug that AP enters timer INT handlerRuiyu Ni2018-01-091-1/+5
| | | | | | | | | | When SourceLevelDebug is enabled, AP randomly executes the DXECORE timer handler logic. The root cause is the interrupts are not masked in AP wake up procedure. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jeff Fan <vanjeff_919@hotmail.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>
* MdeModulePkg/DxeUdpIoLib: Did some code enhancement for UdpIoLibWang Fan2018-01-092-30/+80
| | | | | | | | | | | | | * Added some ASSERT descriptions for library APIs. * Added "Optional" option for Context parameter in UdpIoCancelDgrams(). * Added function return status check for UdpIoFreeIo(). Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@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>
* ShellPkg/UefiShellLevel2CommandsLib: add missing EFIAPI call conv specLaszlo Ersek2018-01-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UefiShellLevel2CommandsLib (somewhat questionably) calls the BaseLib-internal function InternalCharToUpper(). This function is declared in "MdePkg/Library/BaseLib/BaseLibInternals.h", which is not a public library class header. UefiShellLevel2CommandsLib therefore duplicates the function declaration, but a mistake was made: the EFIAPI calling convention is not spelled out on the duplicated declaration. Therefore calls made from UefiShellLevel2CommandsLib will not match the actual function definition in "MdePkg/Library/BaseLib/String.c", when GCC/X64 toolchains are used. One consequence of this is that cross-filesystem copies don't work in the UEFI shell (see the StrniCmp() function in "UefiShellLevel2CommandsLib.c"). From the original report: > FS0:\efi\ubuntu\> cp grubx64.efi fs1:\ > > cp: The source and destination are the same. Copy the declaration from "BaseLibInternals.h" to "UefiShellLevel2CommandsLib.c" verbatim. Reported-by: Rebecca Cran <rebecca@bluestop.org> Analyzed-by: Thomas Palmer <thomas.palmer@hpe.com> Analyzed-by: Liming Gao <liming.gao@intel.com> Ref: http://mid.mail-archive.com/47cd17d8-f022-6ca5-2f52-06a8250f8d14@cran.org.uk Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Rebecca Cran <rebecca@bluestop.org> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Thomas Palmer <thomas.palmer@hpe.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Thomas Palmer <thomas.palmer@hpe.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* MdeModulePkg/PciBus: Reserve Bus number for non-root and root HPBsRuiyu Ni2018-01-081-2/+2
| | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=656 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
* MdeModulePkg/PciBusDxe: cope with HPCs that request no bus nr paddingRuiyu Ni2018-01-081-5/+14
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* BaseTools: Fix Sku inherit issue.BobCF2018-01-082-2/+4
| | | | | | | | The final Pcd value should only be override by its parents. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Feng Bob C <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Fix Pcd value override issue caused by SKU inheritFeng, Bob C2018-01-081-2/+44
| | | | | | | | Pcd default value in DEC should only be assigned once. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com>
* BaseTools: Fix an issue in HiiPcd generationBobCF2018-01-081-3/+2
| | | | | | | | | | DynamicHiiPcd may be used by PEIM or DXE driver. All used DynamicHiiPcd value should be collected and placed into the default setting PCD PcdNvStoreDefaultValueBuffer. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com>
* EmbeddedPkg/FdtLib: Update FdtLib to v1.4.5Pankaj Bansal2018-01-0514-87/+760
| | | | | | | | | | | | | Update the FdtLib so that new APIs provided by FdtLib like fdt_address_cells, fdt_size_cells etc. can be used. Reference code: https://git.kernel.org/pub/scm/utils/dtc/dtc.git/tree/libfdt?h=v1.4.5 Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Pankaj Bansal <pankaj.bansal@nxp.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* IntelSiliconPkg IntelVTdDxe: Support early SetAttributes()Star Zeng2018-01-054-3/+202
| | | | | | | | | Support early SetAttributes() before DMAR table is installed. 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>
* IntelSiliconPkg IntelVTdDxe: Use TPL to protect list/engine operationStar Zeng2018-01-054-31/+26
| | | | | | | 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>
* IntelSiliconPkg IntelVTdDxe: Signal AcpiNotificationFunc() initiallyStar Zeng2018-01-052-4/+15
| | | | | | | | | | Signal AcpiNotificationFunc() initially for the case that DMAR table has been installed when creating event. 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>
* MdeModulePkg/DxeNetLib: Fix an error in packet length counting.Wang Fan2018-01-041-2/+1
| | | | | | | | | | | | | * In old implementation, the operation len-- assumes AsciiSPrint() has counted NULL terminator, and it's not correct. 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: Jiaxin Wu <jiaxin.wu@intel.com>
* MdeModulePkg/DxeNetLib: Add parameter check and ASSERT handling.Wang Fan2018-01-041-14/+105
| | | | | | | | | | | | | | | | * Library API should check the input parameters before use, or ASSERT to tell it has to meet some requirements. But in DxeNetLib, not all functions follows this rule. * ASSERT shouldn't be used as error handling, add some handling code for errors. * Add some ASSERT commence in function notes. 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>
* MdeModulePkg/DxeNetLib: Fix a potential issue in macro definition.Wang Fan2018-01-041-1/+1
| | | | | | | | | | | | | | The NIC_ITEM_CONFIG_SIZE macro in DxeNetLib is defined as: sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) * MAX_IP4_CONFIG_IN_VARIABLE. This macro should be surrounded with parenthesis to avoid being incorrectly used. 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>
* NetworkPkg: Update PXE driver to check for NULL pointer before use it.Fu Siyuan2018-01-041-12/+8
| | | | | | | | | | This patch is to fix the issue that dereferencing of "This" (EFI_LOAD_FILE_PROTOCOL) in EfiPxeLoadFile() is happening before the NULL check. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Add assert for buffer pointer from DHCP driver.Fu Siyuan2018-01-041-0/+4
| | | | | | | | | | | The PxeBcDhcp4CallBack() is provided for DHCP driver to invoke packet check during DHCP process, the DHCP driver should make sure Packet and NewPacket has meaningful value. This patch adds assert for this. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Fix memory leak problem in PXE driver.Fu Siyuan2018-01-042-7/+25
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Check allocated buffer pointer before use.Fu Siyuan2018-01-041-1/+4
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* NetworkPkg: Abort the PXE process if DHCP has been started by other instance.Fu Siyuan2018-01-041-7/+2
| | | | | | | | | | | PXE need to use extended DHCP options and check received offers in callback function, so there is no need to continue the PXE process if DHCP driver has been started by other instance but not PXE driver itself. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Sriram Subramanian <sriram-s@hpe.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* BaseTools: Fix compile error on VS2010Yonghong Zhu2018-01-031-3/+2
| | | | | | | | VS2010 also defined RSIZE_MAX, so we undef it first. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/DevicePath: fix GCC build error in print_mem(), and clean it upLaszlo Ersek2018-01-031-6/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently "BaseTools/Source/C/DevicePath/DevicePath.c" fails to build with GCC48: > DevicePath.c: In function 'print_mem': > DevicePath.c:109:5: error: 'for' loop initial declarations are only > allowed in C99 mode > for (size_t i=0; i<n; i++) { > ^ > DevicePath.c:109:5: note: use option -std=c99 or -std=gnu99 to compile > your code In addition, the print_mem() function does not conform to the edk2 coding style: - we use CamelCase and no underscores in identifiers, - the types and type qualifiers should follow the edk2 style, - initialization as part of definition is forbidden for local variables. Clean these up. While updating the print_mem()/PrintMem() call sites, also remove the superfluous parentheses around the second argument. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Fixes: 7dbc50bd244d95fdc1741b9cfc561f0bfd724de1 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools CommonLib: Fix printf %llx issue on UINT64Liming Gao2018-01-031-5/+1
| | | | | | | | | | UINT64 is defined as the different type for the different ARCHs. To let it work for all archs and compilers, add (unsigned long long) for the input value together with %llx. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* MdeModulePkg: Add error handling when IP address is Class EWang Fan2018-01-031-3/+12
| | | | | | | | | | | | | | | | | The Dhcp4.TransmitReceive() API should be able to use at any time according to UEFI spec. While in classless addressing network, the netmask must be explicitly provided together with the station address. But if the DHCP instance haven't be configured with a valid netmask, we need compute it according to the classful addressing rule. In such case, if the user configures with class E IP address, ASSERT will happen, we need to handle this case and return error status code. Cc: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wang Fan <fan.wang@intel.com> Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
* BaseTools: Fix the regression bug of a74398 for SubFv ImageYonghong Zhu2018-01-031-2/+2
| | | | | | | | | in version a74398 we use guid value and Fv name as ffs dir for FILE statement, this patch apply this rule on subFv image. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: resolve initialization order errors in VfrFormPkg.hzenith4322018-01-023-414/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang generates many warnings warning: field 'XXX' is uninitialized when used here [-Wuninitialized] for VfrFormPkg.h. VfrFormPkg.h defines many classes derived from CIfrObj (along with other base classes.) Each of these derived classes defines a non-static member field that serves as a duplicate pointer to an original pointer defined in the CIfrObj base class, but cast to a different pointer type. The derived class constructor passes the duplicate pointer to base class constructors: 1) Once passes the address of the duplicate pointer to the CIfrObj constructor to have it initialized. 2) Then passes the duplicate pointer to one or more subsequent base class constructors to be used. Both 1) and 2) constitute undefined behavior in C++. C++ prescribes that base classes are initialized before non-static members when initializing a derived class. So when base class constructors are executing, it is not permitted to assume any non-static members of the derived class exist (even to the stage of having their storage allocated.) clang does not issue warnings for 1), but issues warnings -Wuninitialized for 2). This coding methodology is resolved as follows: a) The CIfrObj object accessor method for retrieving the original pointer is revised to a template member function that returns the original pointer cast to a desired target type. b) The call to CIfrObj constructor is no longer used to initialize the duplicate pointer in the derived class. c) Any subsequent calls to a base class constructor that need to use the pointer, retrieve it from the CIfrObj base class using the template accessor method. d) If the derived class makes no further use of the pointer, then the duplicate pointer defined in it is eliminated. e) If the derived class needs the duplicate pointer for other use, the duplicate pointer remains in the derived class and is initialized in proper order from the original pointer in CIfrObj. f) Existing source code that previously used the CIfrObj pointer accessor method is revised to use the template method. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: silence parentheses-equality warningzenith4322018-01-024-1/+7
| | | | | | | | | | | | Some code generated by antlr causes clang to emit warning warning: equality comparison with extraneous parentheses [-Wparentheses-equality] The warning is suppressed specifically for clang without affecting other compilers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: eliminate unused expression resultzenith4322018-01-022-3/+3
| | | | | | | | | Remove some code generated by antlr that causes clang to emit warning warning: expression result unused [-Wunused-value] Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: correct mal-typed CVfrDLGLexer::errstdzenith4322018-01-021-1/+1
| | | | | | | | | | The member function CVfrDLGLexer::errstd is intended as an override virtual function of DLGLexerBase::errstd, but due to mismatched prototype, it didn't override, and never got called. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zenith432 <zenith432@users.sourceforge.net> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/DxePrintLibPrint2Protocol: Fix incomplete print outputWang, Jian J2018-01-021-2/+6
| | | | | | | | | | | | | | | This is caused by a previous patch which tried to fix string over-read. It's found that that patch for PrintLib in MdePkg will cause premature terminating of loop used to traversing format string and cause incomplete string output. Because this library uses similar code to do the same job, it has the same issue too. So the fix is also the same. 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: Star Zeng <star.zeng@intel.com>