Re: [edk2] [Patch 2/5] IntelFsp2WrapperPkg SecFspWrapperPlatformSecLibSample: Remove MASM/GAS files

2016-07-08 Thread Mudusuru, Giri P
Reviewed-by: Giri P Mudusuru  

> -Original Message-
> From: Gao, Liming
> Sent: Friday, July 8, 2016 7:49 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Mudusuru, Giri P
> 
> Subject: [Patch 2/5] IntelFsp2WrapperPkg
> SecFspWrapperPlatformSecLibSample: Remove MASM/GAS files
> 
> Keep NASM file only for new added modules.
> 
> Cc: Jiewen Yao 
> Cc: Giri Mudusuru 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Liming Gao 
> ---
>  .../Ia32/PeiCoreEntry.S| 130 
>  .../Ia32/PeiCoreEntry.asm  | 140 
>  .../Ia32/SecEntry.S| 336 
>  .../Ia32/SecEntry.asm  | 353 
> -
>  .../SecFspWrapperPlatformSecLibSample/Ia32/Stack.S |  77 -
>  .../Ia32/Stack.asm |  82 -
>  .../SecFspWrapperPlatformSecLibSample.inf  |   6 -
>  7 files changed, 1124 deletions(-)
>  delete mode 100644
> IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCo
> reEntry.S
>  delete mode 100644
> IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCo
> reEntry.asm
>  delete mode 100644
> IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/SecEn
> try.S
>  delete mode 100644
> IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/SecEn
> try.asm
>  delete mode 100644
> IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Stack.
> S
>  delete mode 100644
> IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Stack.
> asm
> 
> diff --git
> a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Pei
> CoreEntry.S
> b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Pei
> CoreEntry.S
> deleted file mode 100644
> index c35f02b..000
> ---
> a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Pei
> CoreEntry.S
> +++ /dev/null
> @@ -1,130 +0,0 @@
> -#--
> -#
> -# Copyright (c) 2014, Intel Corporation. All rights reserved.
> -# This program and the accompanying materials
> -# are licensed and made available under the terms and conditions of the BSD
> License
> -# which accompanies this distribution.  The full text of the license may be 
> found
> at
> -# http://opensource.org/licenses/bsd-license.php.
> -#
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -#
> -# Module Name:
> -#
> -#  PeiCoreEntry.S
> -#
> -# Abstract:
> -#
> -#   Find and call SecStartup
> -#
> -#--
> -
> -ASM_GLOBAL ASM_PFX(CallPeiCoreEntryPoint)
> -ASM_PFX(CallPeiCoreEntryPoint):
> -  #
> -  # Obtain the hob list pointer
> -  #
> -  movl0x4(%esp), %eax
> -  #
> -  # Obtain the stack information
> -  #   ECX: start of range
> -  #   EDX: end of range
> -  #
> -  movl0x8(%esp), %ecx
> -  movl0xC(%esp), %edx
> -
> -  #
> -  # Platform init
> -  #
> -  pushal
> -  pushl %edx
> -  pushl %ecx
> -  pushl %eax
> -  call  ASM_PFX(PlatformInit)
> -  popl  %eax
> -  popl  %eax
> -  popl  %eax
> -  popal
> -
> -  #
> -  # Set stack top pointer
> -  #
> -  movl%edx, %esp
> -
> -  #
> -  # Push the hob list pointer
> -  #
> -  pushl   %eax
> -
> -  #
> -  # Save the value
> -  #   ECX: start of range
> -  #   EDX: end of range
> -  #
> -  movl%esp, %ebp
> -  pushl   %ecx
> -  pushl   %edx
> -
> -  #
> -  # Push processor count to stack first, then BIST status (AP then BSP)
> -  #
> -  movl$1, %eax
> -  cpuid
> -  shr $16, %ebx
> -  andl$0x00FF, %ebx
> -  cmp $1, %bl
> -  jae PushProcessorCount
> -
> -  #
> -  # Some processors report 0 logical processors.  Effectively 0 = 1.
> -  # So we fix up the processor count
> -  #
> -  inc %ebx
> -
> -PushProcessorCount:
> -  pushl   %ebx
> -
> -  #
> -  # We need to implement a long-term solution for BIST capture.  For now, we
> just copy BSP BIST
> -  # for all processor threads
> -  #
> -  xorl%ecx, %ecx
> -  movb%bl, %cl
> -PushBist:
> -  movd%mm0, %eax
> -  pushl   %eax
> -  loopPushBist
> -
> -  # Save Time-Stamp Counter
> -  movd  %mm5, %eax
> -  pushl %eax
> -
> -  movd  %mm6, %eax
> -  pushl %eax
> -
> -  #
> -  # Pass entry point of the PEI core
> -  #
> -  movl$0xFFE0, %edi
> -  pushl   %ds:(%edi)
> -
> -  #
> -  # Pass BFV into the PEI Core
> -  #
> -  movl$0xFFFC, %edi
> -  pushl   %ds:(%edi)
> -
> -  #
> -  # Pass stack size into the PEI Core
> -  #
> -  movl-4(%ebp), %ecx
> -  movl-8(%ebp), %edx
> -  pushl   %ecx   # RamBase
> -
> -  subl%ecx, %edx
> -  pushl   %edx   # RamSize
> -
> -  #
> -  # Pass Control into the PEI Core
> -  #
> -  call ASM_PFX(SecStartup)
> diff --git
> a/IntelFsp2Wrapp

Re: [edk2] [Patch 1/5] IntelFsp2WrapperPkg BaseFspWrapperApiLib: Remove MASM/GAS files

2016-07-08 Thread Mudusuru, Giri P
Reviewed-by: Giri P Mudusuru  

> -Original Message-
> From: Gao, Liming
> Sent: Friday, July 8, 2016 7:49 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Mudusuru, Giri P
> 
> Subject: [Patch 1/5] IntelFsp2WrapperPkg BaseFspWrapperApiLib: Remove
> MASM/GAS files
> 
> Keep NASM file only for new added modules.
> 
> Cc: Jiewen Yao 
> Cc: Giri Mudusuru 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Liming Gao 
> ---
>  .../BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf  |   2 -
>  .../Library/BaseFspWrapperApiLib/X64/Thunk64To32.S | 230 
> -
>  .../BaseFspWrapperApiLib/X64/Thunk64To32.asm   | 230 
> -
>  3 files changed, 462 deletions(-)
>  delete mode 100644
> IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
>  delete mode 100644
> IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.asm
> 
> diff --git
> a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.i
> nf
> b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.i
> nf
> index f2cef05..b52cfeb 100644
> ---
> a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.i
> nf
> +++
> b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.i
> nf
> @@ -43,12 +43,10 @@
>  [Sources.IA32]
>IA32/DispatchExecute.c
> 
>  [Sources.X64]
>X64/DispatchExecute.c
> -  X64/Thunk64To32.asm
> -  X64/Thunk64To32.S
>X64/Thunk64To32.nasm
> 
> 
> #
> ###
>  #
>  # Package Dependency Section - list of Package files that are required for
> diff --git
> a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
> b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
> deleted file mode 100644
> index b6b5c1a..000
> --- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
> +++ /dev/null
> @@ -1,230 +0,0 @@
> -#
> -# Copyright (c) 2014, Intel Corporation. All rights reserved.
> -# This program and the accompanying materials
> -# are licensed and made available under the terms and conditions of the BSD
> License
> -# which accompanies this distribution.  The full text of the license may be 
> found
> at
> -# http://opensource.org/licenses/bsd-license.php.
> -#
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -#
> -#
> -# Module Name:
> -#
> -#Thunk64To32.asm
> -#
> -# Abstract:
> -#
> -#   This is the assembly code to transition from long mode to compatibility
> mode to execute 32-bit code and then
> -#   transit back to long mode.
> -#
> -#---
> -
> -#
> -# Procedure:AsmExecute32BitCode
> -#
> -# Input:None
> -#
> -# Output:   None
> -#
> -# Prototype:UINT32
> -#   AsmExecute32BitCode (
> -# IN UINT64   Function,
> -# IN UINT64   Param1,
> -# IN UINT64   Param2,
> -# IN IA32_DESCRIPTOR  *InternalGdtr
> -# );
> -#
> -#
> -# Description:  A thunk function to execute 32-bit code in long mode.
> -#
> -#
> -
> -ASM_GLOBAL ASM_PFX(AsmExecute32BitCode)
> -ASM_PFX(AsmExecute32BitCode):
> -#
> -# save IFLAG and disable it
> -#
> -pushfq
> -cli
> -
> -#
> -# save orignal GDTR and CS
> -#
> -movl%ds, %eax
> -push%rax
> -movl%cs, %eax
> -push%rax
> -subq$0x10, %rsp
> -sgdt(%rsp)
> -#
> -# load internal GDT
> -#
> -lgdt(%r9)
> -#
> -# Save general purpose register and rflag register
> -#
> -pushfq
> -push%rdi
> -push%rsi
> -push%rbp
> -push%rbx
> -
> -#
> -# save CR3
> -#
> -movq%cr3, %rax
> -movq%rax, %rbp
> -
> -#
> -# Prepare the CS and return address for the transition from 32-bit to 
> 64-bit
> mode
> -#
> -movq$0x10, %rax  # load long mode selector
> -shl $32, %rax
> -lea ReloadCS(%rip), %r9   #Assume the ReloadCS is under 4G
> -orq %r9, %rax
> -push%rax
> -#
> -# Save parameters for 32-bit function call
> -#
> -movq%r8, %rax
> -shl $32, %rax
> -orq %rdx, %rax
> -push%rax
> -#
> -# save the 32-bit function entry and the return address into stack which 
> will
> be
> -# retrieve in compatibility mode.
> -#
> -lea ReturnBack(%rip), %rax   #Assume the ReloadCS is under 4G
> -shl $32, %rax
> -orq %rcx, %rax
> -push%rax
> -
> -#
> -# let rax save DS
> -#
> -movq

Re: [edk2] [Patch 3/5] IntelFsp2Pkg BaseFspDebugLibSerialPort: Remove MASM/GAS files

2016-07-08 Thread Mudusuru, Giri P
Reviewed-by: Giri P Mudusuru  

> -Original Message-
> From: Gao, Liming
> Sent: Friday, July 8, 2016 7:49 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Mudusuru, Giri P
> 
> Subject: [Patch 3/5] IntelFsp2Pkg BaseFspDebugLibSerialPort: Remove
> MASM/GAS files
> 
> Keep NASM file only for new added modules.
> 
> Cc: Jiewen Yao 
> Cc: Giri Mudusuru 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Liming Gao 
> ---
>  .../BaseFspDebugLibSerialPort.inf  |  2 --
>  .../BaseFspDebugLibSerialPort/Ia32/FspDebug.asm| 34 
> --
>  .../BaseFspDebugLibSerialPort/Ia32/FspDebug.s  | 30 ---
>  3 files changed, 66 deletions(-)
>  delete mode 100644
> IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
>  delete mode 100644
> IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s
> 
> diff --git
> a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.i
> nf
> b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.i
> nf
> index 33e72a6..49adfd8 100644
> ---
> a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.i
> nf
> +++
> b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.i
> nf
> @@ -27,12 +27,10 @@
>  [Sources]
>DebugLib.c
> 
>  [Sources.Ia32]
>Ia32/FspDebug.nasm
> -  Ia32/FspDebug.asm
> -  Ia32/FspDebug.s
> 
>  [Packages]
>MdePkg/MdePkg.dec
>IntelFsp2Pkg/IntelFsp2Pkg.dec
> 
> diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
> b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
> deleted file mode 100644
> index 8ac18ec..000
> --- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -;--
> -;
> -; Copyright (c) 2014, Intel Corporation. All rights reserved.
> -; This program and the accompanying materials
> -; are licensed and made available under the terms and conditions of the BSD
> License
> -; which accompanies this distribution.  The full text of the license may be 
> found
> at
> -; http://opensource.org/licenses/bsd-license.php.
> -;
> -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -;
> -; Abstract:
> -;
> -;   FSP Debug functions
> -;
> -;--
> -
> -.386
> -.model  flat,C
> -.code
> -
> -;--
> -; UINT32 *
> -; EFIAPI
> -; GetStackFramePointer (
> -;   VOID
> -;   );
> -;--
> -GetStackFramePointer  PROC  PUBLIC
> -mov eax, ebp
> -ret
> -GetStackFramePointer  ENDP
> -
> -END
> diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s
> b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s
> deleted file mode 100644
> index 0f8475f..000
> --- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -#--
> -#
> -# Copyright (c) 2014, Intel Corporation. All rights reserved.
> -# This program and the accompanying materials
> -# are licensed and made available under the terms and conditions of the BSD
> License
> -# which accompanies this distribution.  The full text of the license may be 
> found
> at
> -# http://opensource.org/licenses/bsd-license.php.
> -#
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -#
> -# Abstract:
> -#
> -#   FSP Debug functions
> -#
> -#--
> -
> -#--
> -# UINT32 *
> -# EFIAPI
> -# GetStackFramePointer (
> -#   VOID
> -#   )
> -#--
> -ASM_GLOBAL ASM_PFX(GetStackFramePointer)
> -ASM_PFX(GetStackFramePointer):
> -mov%ebp, %eax
> -ret
> -
> -
> --
> 1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch 4/5] IntelFsp2Pkg BaseFspSwitchStackLib: Remove MASM/GAS files

2016-07-08 Thread Mudusuru, Giri P
Reviewed-by: Giri P Mudusuru  

> -Original Message-
> From: Gao, Liming
> Sent: Friday, July 8, 2016 7:49 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Mudusuru, Giri P
> 
> Subject: [Patch 4/5] IntelFsp2Pkg BaseFspSwitchStackLib: Remove MASM/GAS
> files
> 
> Keep NASM file only for new added modules.
> 
> Cc: Jiewen Yao 
> Cc: Giri Mudusuru 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Liming Gao 
> ---
>  .../BaseFspSwitchStackLib.inf  |  2 -
>  .../Library/BaseFspSwitchStackLib/Ia32/Stack.asm   | 77 -
>  .../Library/BaseFspSwitchStackLib/Ia32/Stack.s | 78 
> --
>  3 files changed, 157 deletions(-)
>  delete mode 100644
> IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
>  delete mode 100644 IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
> 
> diff --git
> a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
> b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
> index cef8d68..b3c673a 100644
> --- a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
> +++ b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
> @@ -22,12 +22,10 @@
> 
>  [Sources.IA32]
>FspSwitchStackLib.c
> 
>  [Sources.IA32]
> -  Ia32/Stack.asm
> -  Ia32/Stack.s
>Ia32/Stack.nasm
> 
>  [Packages]
>MdePkg/MdePkg.dec
>IntelFsp2Pkg/IntelFsp2Pkg.dec
> diff --git a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
> b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
> deleted file mode 100644
> index 1efab52..000
> --- a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
> +++ /dev/null
> @@ -1,77 +0,0 @@
> -;--
> -;
> -; Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
> -; This program and the accompanying materials
> -; are licensed and made available under the terms and conditions of the BSD
> License
> -; which accompanies this distribution.  The full text of the license may be 
> found
> at
> -; http://opensource.org/licenses/bsd-license.php.
> -;
> -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -;
> -; Abstract:
> -;
> -;   Switch the stack from temporary memory to permenent memory.
> -;
> -;--
> -
> -.586p
> -.model  flat,C
> -.code
> -
> -;--
> -; UINT32
> -; EFIAPI
> -; Pei2LoaderSwitchStack (
> -;   VOID
> -;   )
> -;--
> -EXTERNDEF  C   MeasurePoint:PROC
> -Pei2LoaderSwitchStack   PROC C PUBLIC
> -xor eax, eax
> -jmp FspSwitchStack
> -Pei2LoaderSwitchStack   ENDP
> -
> -;--
> -; UINT32
> -; EFIAPI
> -; Loader2PeiSwitchStack (
> -;   VOID
> -;   )
> -;--
> -Loader2PeiSwitchStack   PROC C PUBLIC
> -jmp FspSwitchStack
> -Loader2PeiSwitchStack   ENDP
> -
> -;--
> -; UINT32
> -; EFIAPI
> -; FspSwitchStack (
> -;   VOID
> -;   )
> -;--
> -EXTERNDEF  C   SwapStack:PROC
> -FspSwitchStack   PROC C PUBLIC
> -; Save current contexts
> -pusheax
> -pushfd
> -cli
> -pushad
> -sub esp, 8
> -sidtfword ptr [esp]
> -
> -; Load new stack
> -pushesp
> -callSwapStack
> -mov esp, eax
> -
> -; Restore previous contexts
> -lidtfword ptr [esp]
> -add esp, 8
> -popad
> -popfd
> -add esp, 4
> -ret
> -FspSwitchStack   ENDP
> -
> -END
> diff --git a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
> b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
> deleted file mode 100644
> index a21a5b6..000
> --- a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
> +++ /dev/null
> @@ -1,78 +0,0 @@
> -#--
> -#
> -# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
> -# This program and the accompanying materials
> -# are licensed and made available under the terms and conditions of the BSD
> License
> -# which accompanies this distribution.  The full text of the license may be 
> found
> at
> -# http://opensource.org/licenses/bsd-license.php.
> -#
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -#
> -# Abstract:
> -#
> -#   Switch 

Re: [edk2] [Patch 5/5] IntelFsp2Pkg SecFspSecPlatformLibNull: Remove MASM/GAS files

2016-07-08 Thread Mudusuru, Giri P
Reviewed-by: Giri P Mudusuru  

> -Original Message-
> From: Gao, Liming
> Sent: Friday, July 8, 2016 7:49 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Mudusuru, Giri P
> 
> Subject: [Patch 5/5] IntelFsp2Pkg SecFspSecPlatformLibNull: Remove
> MASM/GAS files
> 
> Keep NASM file only for new added modules.
> 
> Cc: Jiewen Yao 
> Cc: Giri Mudusuru 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Liming Gao 
> ---
>  .../SecFspSecPlatformLibNull/Ia32/Flat32.asm   | 131 
> -
>  .../Library/SecFspSecPlatformLibNull/Ia32/Flat32.s | 110 -
>  .../SecFspSecPlatformLibNull/Ia32/SecCarInit.asm   |  51 
>  .../SecFspSecPlatformLibNull/Ia32/SecCarInit.s |  37 --
>  .../SecFspSecPlatformLibNull.inf   |   6 +-
>  5 files changed, 1 insertion(+), 334 deletions(-)
>  delete mode 100644
> IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
>  delete mode 100644
> IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.s
>  delete mode 100644
> IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/SecCarInit.asm
>  delete mode 100644
> IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/SecCarInit.s
> 
> diff --git a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
> b/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
> deleted file mode 100644
> index 9f144fc..000
> --- a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
> +++ /dev/null
> @@ -1,131 +0,0 @@
> -;; @file
> -;  This is the code that goes from real-mode to protected mode.
> -;  It consumes the reset vector, configures the stack.
> -;
> -; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> -; This program and the accompanying materials
> -; are licensed and made available under the terms and conditions of the BSD
> License
> -; which accompanies this distribution.  The full text of the license may be 
> found
> at
> -; http://opensource.org/licenses/bsd-license.php.
> -;
> -; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -;;
> -
> -;
> -; Define assembler characteristics
> -;
> -.586p
> -.xmm
> -.model flat, c
> -
> -EXTRN   TempRamInitApi:NEAR
> -
> -.code
> -
> -RET_ESI  MACRO
> -
> -  movdesi, mm7  ; restore ESP from MM7
> -  jmp esi
> -
> -ENDM
> -
> -;
> -; Perform early platform initialization
> -;
> -SecPlatformInitPROCNEARPUBLIC
> -
> -  RET_ESI
> -
> -SecPlatformInitENDP
> -
> -;
> -; Protected mode portion initializes stack, configures cache, and calls C 
> entry
> point
> -;
> -
> -;
> -;
> -; Procedure:ProtectedModeEntryPoint
> -;
> -; Input:Executing in 32 Bit Protected (flat) mode
> -;   cs: 0-4GB
> -;   ds: 0-4GB
> -;   es: 0-4GB
> -;   fs: 0-4GB
> -;   gs: 0-4GB
> -;   ss: 0-4GB
> -;
> -; Output:   This function never returns
> -;
> -; Destroys:
> -;   ecx
> -;   edi
> -;   esi
> -;   esp
> -;
> -; Description:
> -;   Perform any essential early platform initilaisation
> -;   Setup a stack
> -;
> -;
> -
> -ProtectedModeEntryPoint PROC NEAR C PUBLIC
> -  ;
> -  ; Dummy function. Consume 2 API to make sure they can be linked.
> -  ;
> -  mov  eax, TempRamInitApi
> -
> -  ; Should never return
> -  jmp  $
> -
> -ProtectedModeEntryPoint ENDP
> -
> -;
> -; ROM-based Global-Descriptor Table for the PEI Phase
> -;
> -align 16
> -PUBLIC  BootGdtTable
> -
> -;
> -; GDT[0]: 0x00: Null entry, never used.
> -;
> -NULL_SELequ $ - GDT_BASE; Selector [0]
> -GDT_BASE:
> -BootGdtTableDD  0
> -DD  0
> -;
> -; Linear code segment descriptor
> -;
> -LINEAR_CODE_SEL equ $ - GDT_BASE; Selector [0x8]
> -DW  0h  ; limit 0x
> -DW  0   ; base 0
> -DB  0
> -DB  09Bh; present, ring 0, data, 
> expand-up, not-writable
> -DB  0CFh; page-granular, 32-bit
> -DB  0
> -;
> -; System data segment descriptor
> -;
> -SYS_DATA_SELequ $ - GDT_BASE; Selector [0x10]
> -DW  0h  ; limit 0x
> -DW  0   ; base 0
> -DB  0
> -DB  093h; present, ring 0, data, 
> expand-up, not-writable
> -DB  0CFh; page-granular, 32-bit
> -DB  0
> -
> -GDT_SIZEEQU $ - BootGDTtable; Size, in bytes
> -
> -;
> -; GDT Descriptor
> -;
> -GdtDesc:  

[edk2] [Patch 4/5] IntelFsp2Pkg BaseFspSwitchStackLib: Remove MASM/GAS files

2016-07-08 Thread Liming Gao
Keep NASM file only for new added modules.

Cc: Jiewen Yao 
Cc: Giri Mudusuru 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 .../BaseFspSwitchStackLib.inf  |  2 -
 .../Library/BaseFspSwitchStackLib/Ia32/Stack.asm   | 77 -
 .../Library/BaseFspSwitchStackLib/Ia32/Stack.s | 78 --
 3 files changed, 157 deletions(-)
 delete mode 100644 IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
 delete mode 100644 IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s

diff --git 
a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf 
b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
index cef8d68..b3c673a 100644
--- a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
+++ b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
@@ -22,12 +22,10 @@
 
 [Sources.IA32]
   FspSwitchStackLib.c
 
 [Sources.IA32]
-  Ia32/Stack.asm
-  Ia32/Stack.s
   Ia32/Stack.nasm
 
 [Packages]
   MdePkg/MdePkg.dec
   IntelFsp2Pkg/IntelFsp2Pkg.dec
diff --git a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm 
b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
deleted file mode 100644
index 1efab52..000
--- a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
+++ /dev/null
@@ -1,77 +0,0 @@
-;--
-;
-; Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD 
License
-; which accompanies this distribution.  The full text of the license may be 
found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;
-; Abstract:
-;
-;   Switch the stack from temporary memory to permenent memory.
-;
-;--
-
-.586p
-.model  flat,C
-.code
-
-;--
-; UINT32
-; EFIAPI
-; Pei2LoaderSwitchStack (
-;   VOID
-;   )
-;--
-EXTERNDEF  C   MeasurePoint:PROC
-Pei2LoaderSwitchStack   PROC C PUBLIC
-xor eax, eax
-jmp FspSwitchStack
-Pei2LoaderSwitchStack   ENDP
-
-;--
-; UINT32
-; EFIAPI
-; Loader2PeiSwitchStack (
-;   VOID
-;   )
-;--
-Loader2PeiSwitchStack   PROC C PUBLIC
-jmp FspSwitchStack
-Loader2PeiSwitchStack   ENDP
-
-;--
-; UINT32
-; EFIAPI
-; FspSwitchStack (
-;   VOID
-;   )
-;--
-EXTERNDEF  C   SwapStack:PROC
-FspSwitchStack   PROC C PUBLIC
-; Save current contexts
-pusheax
-pushfd
-cli
-pushad
-sub esp, 8
-sidtfword ptr [esp]
-
-; Load new stack
-pushesp
-callSwapStack
-mov esp, eax
-
-; Restore previous contexts
-lidtfword ptr [esp]
-add esp, 8
-popad
-popfd
-add esp, 4
-ret
-FspSwitchStack   ENDP
-
-END
diff --git a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s 
b/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
deleted file mode 100644
index a21a5b6..000
--- a/IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
+++ /dev/null
@@ -1,78 +0,0 @@
-#--
-#
-# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Abstract:
-#
-#   Switch the stack from temporary memory to permenent memory.
-#
-#--
-
-
-#--
-# UINT32
-# EFIAPI
-# Pei2LoaderSwitchStack (
-#   VOID
-#   )
-#--
-ASM_GLOBAL ASM_PFX(Pei2LoaderSwitchStack)
-ASM_PFX(Pei2LoaderSwitchStack):
-xorl%eax, %eax
-jmp ASM_PFX(FspSwitchStack)
-
-#--

[edk2] [Patch 5/5] IntelFsp2Pkg SecFspSecPlatformLibNull: Remove MASM/GAS files

2016-07-08 Thread Liming Gao
Keep NASM file only for new added modules.

Cc: Jiewen Yao 
Cc: Giri Mudusuru 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 .../SecFspSecPlatformLibNull/Ia32/Flat32.asm   | 131 -
 .../Library/SecFspSecPlatformLibNull/Ia32/Flat32.s | 110 -
 .../SecFspSecPlatformLibNull/Ia32/SecCarInit.asm   |  51 
 .../SecFspSecPlatformLibNull/Ia32/SecCarInit.s |  37 --
 .../SecFspSecPlatformLibNull.inf   |   6 +-
 5 files changed, 1 insertion(+), 334 deletions(-)
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
 delete mode 100644 IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.s
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/SecCarInit.asm
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/SecCarInit.s

diff --git a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm 
b/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
deleted file mode 100644
index 9f144fc..000
--- a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
+++ /dev/null
@@ -1,131 +0,0 @@
-;; @file
-;  This is the code that goes from real-mode to protected mode.
-;  It consumes the reset vector, configures the stack.
-;
-; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD 
License
-; which accompanies this distribution.  The full text of the license may be 
found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;;
-
-;
-; Define assembler characteristics
-;
-.586p
-.xmm
-.model flat, c
-
-EXTRN   TempRamInitApi:NEAR
-
-.code 
-
-RET_ESI  MACRO
-
-  movdesi, mm7  ; restore ESP from MM7
-  jmp esi
-
-ENDM
-
-;
-; Perform early platform initialization
-;
-SecPlatformInitPROCNEARPUBLIC
-
-  RET_ESI
-
-SecPlatformInitENDP
-
-;
-; Protected mode portion initializes stack, configures cache, and calls C 
entry point
-;
-
-;
-;
-; Procedure:ProtectedModeEntryPoint
-;
-; Input:Executing in 32 Bit Protected (flat) mode
-;   cs: 0-4GB
-;   ds: 0-4GB
-;   es: 0-4GB
-;   fs: 0-4GB
-;   gs: 0-4GB
-;   ss: 0-4GB
-;
-; Output:   This function never returns
-;
-; Destroys:
-;   ecx
-;   edi
-;   esi
-;   esp
-;
-; Description:
-;   Perform any essential early platform initilaisation
-;   Setup a stack
-;
-;
-
-ProtectedModeEntryPoint PROC NEAR C PUBLIC
-  ;
-  ; Dummy function. Consume 2 API to make sure they can be linked.
-  ;
-  mov  eax, TempRamInitApi
-
-  ; Should never return
-  jmp  $
-
-ProtectedModeEntryPoint ENDP
-
-;
-; ROM-based Global-Descriptor Table for the PEI Phase
-;
-align 16
-PUBLIC  BootGdtTable
-
-;
-; GDT[0]: 0x00: Null entry, never used.
-;
-NULL_SELequ $ - GDT_BASE; Selector [0]
-GDT_BASE:
-BootGdtTableDD  0
-DD  0
-;
-; Linear code segment descriptor
-;
-LINEAR_CODE_SEL equ $ - GDT_BASE; Selector [0x8]
-DW  0h  ; limit 0x
-DW  0   ; base 0
-DB  0
-DB  09Bh; present, ring 0, data, 
expand-up, not-writable
-DB  0CFh; page-granular, 32-bit
-DB  0
-;
-; System data segment descriptor
-;
-SYS_DATA_SELequ $ - GDT_BASE; Selector [0x10]
-DW  0h  ; limit 0x
-DW  0   ; base 0
-DB  0
-DB  093h; present, ring 0, data, 
expand-up, not-writable
-DB  0CFh; page-granular, 32-bit
-DB  0
-
-GDT_SIZEEQU $ - BootGDTtable; Size, in bytes
-
-;
-; GDT Descriptor
-;
-GdtDesc:; GDT descriptor
-DW  GDT_SIZE - 1; GDT limit
-DD  OFFSET BootGdtTable ; GDT base address
-
-ProtectedModeEntryLinearAddress   LABEL   FWORD
-ProtectedModeEntryLinearOffsetLABEL   DWORD
-  DD  OFFSET ProtectedModeEntryPoint  ; Offset of our 32 bit code
-  DW  LINEAR_CODE_SEL
-  
-END
diff --git a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.s 
b/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.s
deleted file mode 100644
index d46d792..000
--- a/IntelFsp2Pkg/Library/SecFspSe

[edk2] [Patch 3/5] IntelFsp2Pkg BaseFspDebugLibSerialPort: Remove MASM/GAS files

2016-07-08 Thread Liming Gao
Keep NASM file only for new added modules.

Cc: Jiewen Yao 
Cc: Giri Mudusuru 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 .../BaseFspDebugLibSerialPort.inf  |  2 --
 .../BaseFspDebugLibSerialPort/Ia32/FspDebug.asm| 34 --
 .../BaseFspDebugLibSerialPort/Ia32/FspDebug.s  | 30 ---
 3 files changed, 66 deletions(-)
 delete mode 100644 
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
 delete mode 100644 
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s

diff --git 
a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf 
b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
index 33e72a6..49adfd8 100644
--- 
a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
+++ 
b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/BaseFspDebugLibSerialPort.inf
@@ -27,12 +27,10 @@
 [Sources]
   DebugLib.c
 
 [Sources.Ia32]
   Ia32/FspDebug.nasm
-  Ia32/FspDebug.asm
-  Ia32/FspDebug.s
 
 [Packages]
   MdePkg/MdePkg.dec
   IntelFsp2Pkg/IntelFsp2Pkg.dec
 
diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm 
b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
deleted file mode 100644
index 8ac18ec..000
--- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-;--
-;
-; Copyright (c) 2014, Intel Corporation. All rights reserved.
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD 
License
-; which accompanies this distribution.  The full text of the license may be 
found at
-; http://opensource.org/licenses/bsd-license.php.
-;
-; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-;
-; Abstract:
-;
-;   FSP Debug functions
-;
-;--
-
-.386
-.model  flat,C
-.code
-
-;--
-; UINT32 *
-; EFIAPI
-; GetStackFramePointer (
-;   VOID
-;   );
-;--
-GetStackFramePointer  PROC  PUBLIC
-mov eax, ebp
-ret
-GetStackFramePointer  ENDP
-
-END
diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s 
b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s
deleted file mode 100644
index 0f8475f..000
--- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s
+++ /dev/null
@@ -1,30 +0,0 @@
-#--
-#
-# Copyright (c) 2014, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Abstract:
-#
-#   FSP Debug functions
-#
-#--
-
-#--
-# UINT32 *
-# EFIAPI
-# GetStackFramePointer (
-#   VOID
-#   )
-#--
-ASM_GLOBAL ASM_PFX(GetStackFramePointer)
-ASM_PFX(GetStackFramePointer):
-mov%ebp, %eax
-ret
-
-
-- 
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 2/5] IntelFsp2WrapperPkg SecFspWrapperPlatformSecLibSample: Remove MASM/GAS files

2016-07-08 Thread Liming Gao
Keep NASM file only for new added modules.

Cc: Jiewen Yao 
Cc: Giri Mudusuru 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 .../Ia32/PeiCoreEntry.S| 130 
 .../Ia32/PeiCoreEntry.asm  | 140 
 .../Ia32/SecEntry.S| 336 
 .../Ia32/SecEntry.asm  | 353 -
 .../SecFspWrapperPlatformSecLibSample/Ia32/Stack.S |  77 -
 .../Ia32/Stack.asm |  82 -
 .../SecFspWrapperPlatformSecLibSample.inf  |   6 -
 7 files changed, 1124 deletions(-)
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.asm
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/SecEntry.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/SecEntry.asm
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Stack.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Stack.asm

diff --git 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.S
 
b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.S
deleted file mode 100644
index c35f02b..000
--- 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.S
+++ /dev/null
@@ -1,130 +0,0 @@
-#--
-#
-# Copyright (c) 2014, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-#  PeiCoreEntry.S
-#
-# Abstract:
-#
-#   Find and call SecStartup
-#
-#--
-
-ASM_GLOBAL ASM_PFX(CallPeiCoreEntryPoint)
-ASM_PFX(CallPeiCoreEntryPoint):
-  #
-  # Obtain the hob list pointer
-  #
-  movl0x4(%esp), %eax
-  #
-  # Obtain the stack information
-  #   ECX: start of range
-  #   EDX: end of range
-  #
-  movl0x8(%esp), %ecx
-  movl0xC(%esp), %edx
-
-  #
-  # Platform init
-  #
-  pushal
-  pushl %edx
-  pushl %ecx
-  pushl %eax
-  call  ASM_PFX(PlatformInit)
-  popl  %eax
-  popl  %eax
-  popl  %eax
-  popal
-
-  #
-  # Set stack top pointer
-  #
-  movl%edx, %esp
-
-  #
-  # Push the hob list pointer
-  #
-  pushl   %eax
-
-  #
-  # Save the value
-  #   ECX: start of range
-  #   EDX: end of range
-  #
-  movl%esp, %ebp
-  pushl   %ecx
-  pushl   %edx
-
-  #
-  # Push processor count to stack first, then BIST status (AP then BSP)
-  #
-  movl$1, %eax
-  cpuid
-  shr $16, %ebx
-  andl$0x00FF, %ebx
-  cmp $1, %bl
-  jae PushProcessorCount
-
-  #
-  # Some processors report 0 logical processors.  Effectively 0 = 1.
-  # So we fix up the processor count
-  #
-  inc %ebx
-
-PushProcessorCount:
-  pushl   %ebx
-
-  #
-  # We need to implement a long-term solution for BIST capture.  For now, we 
just copy BSP BIST
-  # for all processor threads
-  #
-  xorl%ecx, %ecx
-  movb%bl, %cl
-PushBist:
-  movd%mm0, %eax
-  pushl   %eax
-  loopPushBist
-
-  # Save Time-Stamp Counter
-  movd  %mm5, %eax
-  pushl %eax
-
-  movd  %mm6, %eax
-  pushl %eax
-
-  #
-  # Pass entry point of the PEI core
-  #
-  movl$0xFFE0, %edi
-  pushl   %ds:(%edi)
-
-  #
-  # Pass BFV into the PEI Core
-  #
-  movl$0xFFFC, %edi
-  pushl   %ds:(%edi)
-
-  #
-  # Pass stack size into the PEI Core
-  #
-  movl-4(%ebp), %ecx
-  movl-8(%ebp), %edx
-  pushl   %ecx   # RamBase
-
-  subl%ecx, %edx
-  pushl   %edx   # RamSize
-
-  #
-  # Pass Control into the PEI Core
-  #
-  call ASM_PFX(SecStartup)
diff --git 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.asm
 
b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.asm
deleted file mode 100644
index cd1c7b8..000
--- 
a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.asm
+++ /dev/null
@@ -1,140 +0,0 @@
-;--
-;
-; Copyright (c) 2014, Intel Corporation. All rights reserved.
-; This program and the accompanying materials
-; are licensed and made available under the terms and conditions of the BSD 
License
-; which accompanies this distribution.  The full t

[edk2] [Patch 0/5] Remove MASM/GAS from new IntelFsp2Pkg/IntelFps2WrapperPkg

2016-07-08 Thread Liming Gao
After NASM source files are added, MASM/GAS source files will not be kept for
new added modules and packages. IntelFsp2Pkg and IntelFps2WrapperPkg are added 
recently. They can be regarded as new packages. So, these changes remove 
MASM/GAS source files and keep NASM only for these two packages. 

Here, I would like to propose to add NASM only for IA32 and X64 assembly files 
in new modules and packages. If there is the real request for MASM or GAS, 
we can consider to add them later. 

Liming Gao (5):
  IntelFsp2WrapperPkg BaseFspWrapperApiLib: Remove MASM/GAS files
  IntelFsp2WrapperPkg SecFspWrapperPlatformSecLibSample: Remove MASM/GAS
files
  IntelFsp2Pkg BaseFspDebugLibSerialPort: Remove MASM/GAS files
  IntelFsp2Pkg BaseFspSwitchStackLib: Remove MASM/GAS files
  IntelFsp2Pkg SecFspSecPlatformLibNull: Remove MASM/GAS files

 .../BaseFspDebugLibSerialPort.inf  |   2 -
 .../BaseFspDebugLibSerialPort/Ia32/FspDebug.asm|  34 --
 .../BaseFspDebugLibSerialPort/Ia32/FspDebug.s  |  30 --
 .../BaseFspSwitchStackLib.inf  |   2 -
 .../Library/BaseFspSwitchStackLib/Ia32/Stack.asm   |  77 -
 .../Library/BaseFspSwitchStackLib/Ia32/Stack.s |  78 -
 .../SecFspSecPlatformLibNull/Ia32/Flat32.asm   | 131 
 .../Library/SecFspSecPlatformLibNull/Ia32/Flat32.s | 110 ---
 .../SecFspSecPlatformLibNull/Ia32/SecCarInit.asm   |  51 ---
 .../SecFspSecPlatformLibNull/Ia32/SecCarInit.s |  37 ---
 .../SecFspSecPlatformLibNull.inf   |   6 +-
 .../BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf  |   2 -
 .../Library/BaseFspWrapperApiLib/X64/Thunk64To32.S | 230 --
 .../BaseFspWrapperApiLib/X64/Thunk64To32.asm   | 230 --
 .../Ia32/PeiCoreEntry.S| 130 
 .../Ia32/PeiCoreEntry.asm  | 140 
 .../Ia32/SecEntry.S| 336 
 .../Ia32/SecEntry.asm  | 353 -
 .../SecFspWrapperPlatformSecLibSample/Ia32/Stack.S |  77 -
 .../Ia32/Stack.asm |  82 -
 .../SecFspWrapperPlatformSecLibSample.inf  |   6 -
 21 files changed, 1 insertion(+), 2143 deletions(-)
 delete mode 100644 
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.asm
 delete mode 100644 
IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/Ia32/FspDebug.s
 delete mode 100644 IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.asm
 delete mode 100644 IntelFsp2Pkg/Library/BaseFspSwitchStackLib/Ia32/Stack.s
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.asm
 delete mode 100644 IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/Flat32.s
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/SecCarInit.asm
 delete mode 100644 
IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/Ia32/SecCarInit.s
 delete mode 100644 
IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.asm
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/PeiCoreEntry.asm
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/SecEntry.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/SecEntry.asm
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Stack.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Stack.asm

-- 
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch 1/5] IntelFsp2WrapperPkg BaseFspWrapperApiLib: Remove MASM/GAS files

2016-07-08 Thread Liming Gao
Keep NASM file only for new added modules.

Cc: Jiewen Yao 
Cc: Giri Mudusuru 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 .../BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf  |   2 -
 .../Library/BaseFspWrapperApiLib/X64/Thunk64To32.S | 230 -
 .../BaseFspWrapperApiLib/X64/Thunk64To32.asm   | 230 -
 3 files changed, 462 deletions(-)
 delete mode 100644 
IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
 delete mode 100644 
IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.asm

diff --git 
a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf 
b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
index f2cef05..b52cfeb 100644
--- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
+++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFspWrapperApiLib.inf
@@ -43,12 +43,10 @@
 [Sources.IA32]
   IA32/DispatchExecute.c
 
 [Sources.X64]
   X64/DispatchExecute.c
-  X64/Thunk64To32.asm
-  X64/Thunk64To32.S
   X64/Thunk64To32.nasm
 
 

 #
 # Package Dependency Section - list of Package files that are required for
diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S 
b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
deleted file mode 100644
index b6b5c1a..000
--- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/Thunk64To32.S
+++ /dev/null
@@ -1,230 +0,0 @@
-#
-# Copyright (c) 2014, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#
-# Module Name:
-#
-#Thunk64To32.asm
-#
-# Abstract:
-#
-#   This is the assembly code to transition from long mode to compatibility 
mode to execute 32-bit code and then
-#   transit back to long mode.
-#
-#---
-
-#
-# Procedure:AsmExecute32BitCode
-#
-# Input:None
-#
-# Output:   None
-#
-# Prototype:UINT32
-#   AsmExecute32BitCode (
-# IN UINT64   Function,
-# IN UINT64   Param1,
-# IN UINT64   Param2,
-# IN IA32_DESCRIPTOR  *InternalGdtr
-# );
-#
-#
-# Description:  A thunk function to execute 32-bit code in long mode.
-#
-#
-
-ASM_GLOBAL ASM_PFX(AsmExecute32BitCode)
-ASM_PFX(AsmExecute32BitCode):
-#
-# save IFLAG and disable it
-#
-pushfq
-cli
-
-#
-# save orignal GDTR and CS
-#
-movl%ds, %eax
-push%rax
-movl%cs, %eax
-push%rax
-subq$0x10, %rsp
-sgdt(%rsp)
-#
-# load internal GDT
-#
-lgdt(%r9)
-#
-# Save general purpose register and rflag register
-#
-pushfq
-push%rdi
-push%rsi
-push%rbp
-push%rbx
-
-#
-# save CR3
-#
-movq%cr3, %rax
-movq%rax, %rbp
-
-#
-# Prepare the CS and return address for the transition from 32-bit to 
64-bit mode
-#
-movq$0x10, %rax  # load long mode selector
-shl $32, %rax
-lea ReloadCS(%rip), %r9   #Assume the ReloadCS is under 4G
-orq %r9, %rax
-push%rax
-#
-# Save parameters for 32-bit function call
-#
-movq%r8, %rax
-shl $32, %rax
-orq %rdx, %rax
-push%rax
-#
-# save the 32-bit function entry and the return address into stack which 
will be
-# retrieve in compatibility mode.
-#
-lea ReturnBack(%rip), %rax   #Assume the ReloadCS is under 4G
-shl $32, %rax
-orq %rcx, %rax
-push%rax
-
-#
-# let rax save DS
-#
-movq$0x18, %rax
-
-#
-# Change to Compatible Segment
-#
-movq$8, %rcx   # load compatible mode selector
-shl $32, %rcx
-lea Compatible(%rip), %rdx # assume address < 4G
-orq %rdx, %rcx
-push%rcx
-.byte   0xcb# retf
-
-Compatible:
-# reload DS/ES/SS to make sure they are correct referred to current GDT
-movw%ax, %ds
-movw%ax, %es
-movw%ax, %ss
-
-#
-# Disable paging
-#
-movq%cr0, %rcx
-btc $31, %ecx
-movq%rcx, %cr0
-#
-# Clear EFER.LME
-#
-movl$0xC

Re: [edk2] [PATCH v2 1/7] BaseTools-GenFw:Use EXE flag to check Elf section type

2016-07-08 Thread Ard Biesheuvel
On 8 July 2016 at 15:48, Shi, Steven  wrote:
> Hi Ard,
> You know, edk2 enforce the Elf section generation by link script 
> \BaseTools\Scripts\GccBase.lds. In the below part of GccBase.lds, you can see 
> edk2 has force linker to put .rodata into .text section. This is why I hope 
> to add SHF_EXECINSTR flag in the section check logic.
>

But why? How does that improve the current code?  And how can you be
sure that nobody is using GenFw with a different linker? For example,
RVCT uses GenFw, but does not use GccBase.lds.

Could we not just drop this patch, please?



>   .text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
> *(.text .text.* .stub .gnu.linkonce.t.*)
> *(.rodata .rodata.* .gnu.linkonce.r.*)
> *(.got .got.*)
>
> /*
>  * The contents of AutoGen.c files are constant from the POV of the 
> program,
>  * but most of its contents end up in .data or .bss by default since few 
> of
>  * the variable definitions that get emitted are declared as CONST.
>  */
> *:AutoGen.obj(.data .data.* .bss .bss.*)
>   }
>
> Below is a edk2 Elf image typical example, and you can see there is no 
> .rodata section, but a big .text section.
>> readelf -S 
>> /home/jshi19/edk2-fork/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe/DEBUG/UsbKbDxe.dll
>
> Section Headers:
>   [Nr] Name  Type Address   Offset
>Size  EntSize  Flags  Link  Info  Align
>   [ 0]   NULL   
>     0 0 0
>   [ 1] .text PROGBITS 0240  00c0
>5a24  0008  AX   0 0 64
>   [ 2] .rela.textRELA   8498
>44d0  0018   I   8 1 8
>   [ 3] .data PROGBITS 5c80  5b00
>0a68    WA   0 0 64
>   [ 4] .rela.dataRELA   c968
>04b0  0018   I   8 3 8
>   [ 5] .rela RELA 6700  6580
>04b0  0018   A   0 0 8
>   [ 6] .gnu_debuglinkPROGBITS   6a30
>0014     0 0 1
>   [ 7] .shstrtab STRTAB     ce18
>0046     0 0 1
>   [ 8] .symtab   SYMTAB     6a48
>11a0  0018   9   104 8
>   [ 9] .strtab   STRTAB     7be8
>08ab     0 0 1
> Key to Flags:
>   W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
>   I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
>   O (extra OS processing required) o (OS specific), p (processor specific)
>
>
> Anyway, I agree that it's better to enhance the Elf64Convert.c code comments 
> to highlight that the GenFw tool has the big assumption of linking through 
> GccBase.lds. What do you think?
>
>
> Steven Shi
> Intel\SSG\STO\UEFI Firmware
>
> Tel: +86 021-61166522
> iNet: 821-6522
>
>
>> -Original Message-
>> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
>> Sent: Friday, July 08, 2016 5:19 PM
>> To: Shi, Steven 
>> Cc: edk2-devel-01 ; Gao, Liming
>> ; af...@apple.com; Justen, Jordan L
>> ; Kinney, Michael D
>> 
>> Subject: Re: [PATCH v2 1/7] BaseTools-GenFw:Use EXE flag to check Elf
>> section type
>>
>> On 8 July 2016 at 10:42, Shi, Steven  wrote:
>> > Add SHF_EXECINSTR attribute flag in logic to check Elf Text and
>> > Data section type.
>>
>> Why?
>>
>> > Also fix some typo in the code comments and
>> > Debug strings.
>> >
>> > Contributed-under: TianoCore Contribution Agreement 1.0
>> > Signed-off-by: Steven Shi 
>> > ---
>> >  BaseTools/Source/C/GenFw/Elf64Convert.c | 10 +-
>> >  1 file changed, 5 insertions(+), 5 deletions(-)
>> >  mode change 100644 => 100755
>> BaseTools/Source/C/GenFw/Elf64Convert.c
>> >
>> > diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c
>> b/BaseTools/Source/C/GenFw/Elf64Convert.c
>> > old mode 100644
>> > new mode 100755
>> > index 024a2a0..7c838f3
>> > --- a/BaseTools/Source/C/GenFw/Elf64Convert.c
>> > +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
>> > @@ -75,7 +75,7 @@ CleanUp64 (
>> >);
>> >
>> >  //
>> > -// Rename ELF32 strucutres to common names to help when porting to
>> ELF64.
>> > +// Rename ELF32 structures to common names to help when porting to
>> ELF64.
>> >  //
>> >  typedef Elf64_Shdr Elf_Shdr;
>> >  typedef Elf64_Ehdr Elf_Ehdr;
>> > @@ -233,7 +233,7 @@ IsTextShdr (
>> >Elf_Shdr *Shdr
>> >)
>> >  {
>> > -  return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) ==
>> SHF_ALLOC);

Re: [edk2] [PATCH v2 1/7] BaseTools-GenFw:Use EXE flag to check Elf section type

2016-07-08 Thread Shi, Steven
Hi Ard,
You know, edk2 enforce the Elf section generation by link script 
\BaseTools\Scripts\GccBase.lds. In the below part of GccBase.lds, you can see 
edk2 has force linker to put .rodata into .text section. This is why I hope to 
add SHF_EXECINSTR flag in the section check logic.

  .text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
*(.text .text.* .stub .gnu.linkonce.t.*)
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.got .got.*)

/*
 * The contents of AutoGen.c files are constant from the POV of the program,
 * but most of its contents end up in .data or .bss by default since few of
 * the variable definitions that get emitted are declared as CONST.
 */
*:AutoGen.obj(.data .data.* .bss .bss.*)
  }

Below is a edk2 Elf image typical example, and you can see there is no .rodata 
section, but a big .text section.
> readelf -S 
> /home/jshi19/edk2-fork/Build/OvmfX64/DEBUG_GCC5/X64/MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe/DEBUG/UsbKbDxe.dll

Section Headers:
  [Nr] Name  Type Address   Offset
   Size  EntSize  Flags  Link  Info  Align
  [ 0]   NULL   
        0 0 0
  [ 1] .text PROGBITS 0240  00c0
   5a24  0008  AX   0 0 64
  [ 2] .rela.textRELA   8498
   44d0  0018   I   8 1 8
  [ 3] .data PROGBITS 5c80  5b00
   0a68    WA   0 0 64
  [ 4] .rela.dataRELA   c968
   04b0  0018   I   8 3 8
  [ 5] .rela RELA 6700  6580
   04b0  0018   A   0 0 8
  [ 6] .gnu_debuglinkPROGBITS   6a30
   0014     0 0 1
  [ 7] .shstrtab STRTAB     ce18
   0046     0 0 1
  [ 8] .symtab   SYMTAB     6a48
   11a0  0018   9   104 8
  [ 9] .strtab   STRTAB     7be8
   08ab     0 0 1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings), l (large)
  I (info), L (link order), G (group), T (TLS), E (exclude), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)


Anyway, I agree that it's better to enhance the Elf64Convert.c code comments to 
highlight that the GenFw tool has the big assumption of linking through 
GccBase.lds. What do you think?


Steven Shi
Intel\SSG\STO\UEFI Firmware

Tel: +86 021-61166522
iNet: 821-6522


> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Friday, July 08, 2016 5:19 PM
> To: Shi, Steven 
> Cc: edk2-devel-01 ; Gao, Liming
> ; af...@apple.com; Justen, Jordan L
> ; Kinney, Michael D
> 
> Subject: Re: [PATCH v2 1/7] BaseTools-GenFw:Use EXE flag to check Elf
> section type
> 
> On 8 July 2016 at 10:42, Shi, Steven  wrote:
> > Add SHF_EXECINSTR attribute flag in logic to check Elf Text and
> > Data section type.
> 
> Why?
> 
> > Also fix some typo in the code comments and
> > Debug strings.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Steven Shi 
> > ---
> >  BaseTools/Source/C/GenFw/Elf64Convert.c | 10 +-
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >  mode change 100644 => 100755
> BaseTools/Source/C/GenFw/Elf64Convert.c
> >
> > diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c
> b/BaseTools/Source/C/GenFw/Elf64Convert.c
> > old mode 100644
> > new mode 100755
> > index 024a2a0..7c838f3
> > --- a/BaseTools/Source/C/GenFw/Elf64Convert.c
> > +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
> > @@ -75,7 +75,7 @@ CleanUp64 (
> >);
> >
> >  //
> > -// Rename ELF32 strucutres to common names to help when porting to
> ELF64.
> > +// Rename ELF32 structures to common names to help when porting to
> ELF64.
> >  //
> >  typedef Elf64_Shdr Elf_Shdr;
> >  typedef Elf64_Ehdr Elf_Ehdr;
> > @@ -233,7 +233,7 @@ IsTextShdr (
> >Elf_Shdr *Shdr
> >)
> >  {
> > -  return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) ==
> SHF_ALLOC);
> > +  return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE |
> SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC));
> 
> So what happens to .rodata sections? They have SHF_ALLOC set, and
> SHF_EXECINSTR and SHF_WRITE cleared, so this function will now return
> FALSE for them.
> 
> >  }
> >
> >  STATIC
> > @@ -256,7 +256,7 @@ IsDataShdr (
> >if (IsHiiRsrcShdr(Shdr)) {
> >  return FALSE;
> >}
> > -  return (BOOLEAN) (Shdr->sh_flags &

Re: [edk2] [PATCH] ArmVirtPkg/PlatformBootManagerLib: Postpone the shell registration

2016-07-08 Thread Laszlo Ersek
On 07/08/16 12:33, Ard Biesheuvel wrote:
> On 8 July 2016 at 12:31, Laszlo Ersek  wrote:
>> This patch ports Gary's OvmfPkg commit 14b2ebc30c8b to ArmVirtPkg.
>>
>> Turns out Gary's argument in 14b2ebc30c8b is not only valid for Xen. The
>> same situation arises with QEMU if:
>> - the user specifies no boot order via fw_cfg at all (so QemuBootOrderLib
>>   won't touch the boot order), and
>> - the varstore file has just been created from the varstore template.
>>
>> In this case the user is dropped to the UEFI shell (because the shell is
>> registered earlier than all the auto-generated options), which is likely
>> not what the user wants.
>>
>> Cc: Ard Biesheuvel 
>> Cc: Gary Lin > Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Laszlo Ersek 
> 
> Reviewed-by: Ard Biesheuvel 

That was super quick, thank you (2 minutes :)).

Pushed as commit efadd41590b4.

I also fixed up the missing ">" in Gary's email address in the commit
message. (AFAICS git-send-email saved my bacon and corrected it for the
CC header, so Gary was on CC ultimately. I mainly wanted to inform Gary
that his patch was going to make it into ArmVirtPkg as well.)

Thanks!
Laszlo

>>  ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 14 --
>>  1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c 
>> b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
>> index 198d0602b3c0..eaafe7ff57ea 100644
>> --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
>> +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
>> @@ -424,12 +424,6 @@ PlatformRegisterOptionsAndKeys (
>>   NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL
>>   );
>>ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
>> -  //
>> -  // Register UEFI Shell
>> -  //
>> -  PlatformRegisterFvBootOption (
>> -PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE
>> -);
>>  }
>>
>>
>> @@ -558,6 +552,14 @@ PlatformBootManagerAfterConsole (
>>// the QEMU configuration.
>>//
>>EfiBootManagerRefreshAllBootOption ();
>> +
>> +  //
>> +  // Register UEFI Shell
>> +  //
>> +  PlatformRegisterFvBootOption (
>> +PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE
>> +);
>> +
>>SetBootOrderFromQemu ();
>>  }
>>
>> --
>> 1.8.3.1
>>

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] ArmVirtPkg/PlatformBootManagerLib: Postpone the shell registration

2016-07-08 Thread Ard Biesheuvel
On 8 July 2016 at 12:31, Laszlo Ersek  wrote:
> This patch ports Gary's OvmfPkg commit 14b2ebc30c8b to ArmVirtPkg.
>
> Turns out Gary's argument in 14b2ebc30c8b is not only valid for Xen. The
> same situation arises with QEMU if:
> - the user specifies no boot order via fw_cfg at all (so QemuBootOrderLib
>   won't touch the boot order), and
> - the varstore file has just been created from the varstore template.
>
> In this case the user is dropped to the UEFI shell (because the shell is
> registered earlier than all the auto-generated options), which is likely
> not what the user wants.
>
> Cc: Ard Biesheuvel 
> Cc: Gary Lin  Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 

Reviewed-by: Ard Biesheuvel 

> ---
>  ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c 
> b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
> index 198d0602b3c0..eaafe7ff57ea 100644
> --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
> +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
> @@ -424,12 +424,6 @@ PlatformRegisterOptionsAndKeys (
>   NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL
>   );
>ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
> -  //
> -  // Register UEFI Shell
> -  //
> -  PlatformRegisterFvBootOption (
> -PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE
> -);
>  }
>
>
> @@ -558,6 +552,14 @@ PlatformBootManagerAfterConsole (
>// the QEMU configuration.
>//
>EfiBootManagerRefreshAllBootOption ();
> +
> +  //
> +  // Register UEFI Shell
> +  //
> +  PlatformRegisterFvBootOption (
> +PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE
> +);
> +
>SetBootOrderFromQemu ();
>  }
>
> --
> 1.8.3.1
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] ArmVirtPkg/PlatformBootManagerLib: Postpone the shell registration

2016-07-08 Thread Laszlo Ersek
This patch ports Gary's OvmfPkg commit 14b2ebc30c8b to ArmVirtPkg.

Turns out Gary's argument in 14b2ebc30c8b is not only valid for Xen. The
same situation arises with QEMU if:
- the user specifies no boot order via fw_cfg at all (so QemuBootOrderLib
  won't touch the boot order), and
- the varstore file has just been created from the varstore template.

In this case the user is dropped to the UEFI shell (because the shell is
registered earlier than all the auto-generated options), which is likely
not what the user wants.

Cc: Ard Biesheuvel 
Cc: Gary Lin 
---
 ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c 
b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 198d0602b3c0..eaafe7ff57ea 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -424,12 +424,6 @@ PlatformRegisterOptionsAndKeys (
  NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL
  );
   ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
-  //
-  // Register UEFI Shell
-  //
-  PlatformRegisterFvBootOption (
-PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE
-);
 }
 
 
@@ -558,6 +552,14 @@ PlatformBootManagerAfterConsole (
   // the QEMU configuration.
   //
   EfiBootManagerRefreshAllBootOption ();
+
+  //
+  // Register UEFI Shell
+  //
+  PlatformRegisterFvBootOption (
+PcdGetPtr (PcdShellFile), L"EFI Internal Shell", LOAD_OPTION_ACTIVE
+);
+
   SetBootOrderFromQemu ();
 }
 
-- 
1.8.3.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg MemoryProfile: ASSERT to ensure 'DriverInfoData' is not NULL

2016-07-08 Thread Zeng, Star
Reviewed-by: Star Zeng 

-Original Message-
From: Wu, Hao A 
Sent: Friday, July 8, 2016 12:35 PM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A ; Zeng, Star 
Subject: [PATCH] MdeModulePkg MemoryProfile: ASSERT to ensure 'DriverInfoData' 
is not NULL

Code logic ensures that the pointer 'DriverInfoData' will not be NULL when it 
is used.

Add ASSERT as warning for case that will not happen.

Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu 
---
 MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c  | 1 +  
MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c 
b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
index 30c0df4..b67a17c 100644
--- a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
+++ b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c
@@ -442,6 +442,7 @@ BuildDriverInfo (
   if (EFI_ERROR (Status)) {
 return NULL;
   }
+  ASSERT (DriverInfoData != NULL);
 
   ZeroMem (DriverInfoData, sizeof (*DriverInfoData));
 
diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c 
b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
index ac832ce..93585f1 100644
--- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
+++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c
@@ -443,6 +443,7 @@ BuildDriverInfo (
   if (EFI_ERROR (Status)) {
 return NULL;
   }
+  ASSERT (DriverInfoData != NULL);
 
   ZeroMem (DriverInfoData, sizeof (*DriverInfoData));
 
--
1.9.5.msysgit.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] UefiCpuPkg/CpuDxe: StartupAllAPs in parallel mode

2016-07-08 Thread Laszlo Ersek
On 07/08/16 10:59, Fan, Jeff wrote:
> Laszlo,
> 
> Thanks your feedback and provided the history on MTRRs sync code.
> 
> DEBUG () running on Aps is a common issue to be avoided.
> For MtrrLib, DEBUG() is using DEBUG_CACHE for debug purpose only.
> Usually, MTRRs setting should be same between BSP/Aps. Dump MTRRs are
> enough for BSP. Maybe, we could enhance MtrrLib to avoid DEBUG ()
> running on Aps.

That's a good idea! Maybe we can sneak in some context so that
MtrrDebugPrintAllMtrrsWorker() knows it is running on an AP, and omits
debug logging.

> For the case 2) in StartupAllAPs() call in InitializeMpSupport(), it
> will be handled in our refactor on MP support between CpuMpPei and
> CpuDxe driver as Mike mentioned. I wish we could sent out MP Initial
> Lib support in a couple of weeks.

Sounds great!
Thanks!
Laszlo

> 
> Thanks!
> Jeff
> 
> 
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com] 
> Sent: Friday, July 08, 2016 4:38 PM
> To: Fan, Jeff; edk2-de...@ml01.01.org
> Cc: Kinney, Michael D; Tian, Feng
> Subject: Re: [Patch] UefiCpuPkg/CpuDxe: StartupAllAPs in parallel mode
> 
> Jeff,
> 
> On 07/08/16 09:45, Jeff Fan wrote:
>> SetMemoryAttributes() will sync BSP's MTRRs settings to all APs by 
>> StartupAllAPs service in serial mode. It may caused much performance 
>> impact if there are too much processors in system. This update is to 
>> invoke StartupAllAps in parallel mode. IA32 SDM does suggest to program 
>> MTRRs in parallel mode.
>>
>> Cc: Michael Kinney 
>> Cc: Feng Tian 
>> Cc: Laszlo Ersek 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Jeff Fan 
>> Reviewed-by: Feng Tian 
>> ---
>>  UefiCpuPkg/CpuDxe/CpuDxe.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c 
>> index daf97bd..78b2c88 100644
>> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
>> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
>> @@ -1,7 +1,7 @@
>>  /** @file
>>CPU DXE Module.
>>  
>> -  Copyright (c) 2008 - 2013, Intel Corporation. All rights 
>> reserved.
>> +  Copyright (c) 2008 - 2016, Intel Corporation. All rights 
>> + reserved.
>>This program and the accompanying materials
>>are licensed and made available under the terms and conditions of the BSD 
>> License
>>which accompanies this distribution.  The full text of the license 
>> may be found at @@ -422,7 +422,7 @@ CpuSetMemoryAttributes (
>>MpStatus = MpService->StartupAllAPs (
>>MpService,  // This
>>SetMtrrsFromBuffer, // Procedure
>> -  TRUE,   // SingleThread
>> +  FALSE,  // SingleThread
>>NULL,   // WaitEvent
>>0,  // TimeoutInMicrosecsond
>>&MtrrSettings,  // ProcedureArgument
>>
> 
> (1) This change looks "obvious" on the surface, and to be honest, when 
> looking at your patch now, I couldn't tell for a minute what I was thinking 
> when I set SingleThread=TRUE, in commit 94941c8853448.
> 
> Digging down a bit, I believe I remember now. The APs execute the following 
> call chain:
> 
> SetMtrrsFromBuffer() [UefiCpuPkg/CpuDxe/CpuMp.c]
>   MtrrSetAllMtrrs()  [UefiCpuPkg/Library/MtrrLib/MtrrLib.c]
> MtrrDebugPrintAllMtrrs() [UefiCpuPkg/Library/MtrrLib/MtrrLib.c]
>   MtrrDebugPrintAllMtrrsWorker() [UefiCpuPkg/Library/MtrrLib/MtrrLib.c]
> 
> I believe my reason for SingleThread=TRUE may have been that 
> MtrrDebugPrintAllMtrrsWorker() is not safe for parallel execution (with the 
> many DEBUG()s in it).
> 
> I agree this would be a nice improvement, both for performance and for 
> compliance with the SDM -- if only we could make SetMtrrsFromBuffer() 
> thread-safe, top to bottom.
> 
> (In my other patchset that you just reviewed (thanks for that BTW!), I also 
> verified that the WriteFeatureControl() AP procedure would be safe for 
> parallel execution. It is: it calls only AsmWriteMsr64(), which compiles to a 
> single WRMSR instruction. But here, SetMtrrsFromBuffer() is much more 
> complex, top to bottom.)
> 
> (2) If we end up modifying SingleThread to FALSE, then this is not the only 
> location that should be updated -- there's another StartupAllAPs() call in 
> InitializeMpSupport(). (See again commit 94941c8853448.)
> 
> Thanks!
> Laszlo
> 

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 1/7] BaseTools-GenFw:Use EXE flag to check Elf section type

2016-07-08 Thread Ard Biesheuvel
On 8 July 2016 at 10:42, Shi, Steven  wrote:
> Add SHF_EXECINSTR attribute flag in logic to check Elf Text and
> Data section type.

Why?

> Also fix some typo in the code comments and
> Debug strings.
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Steven Shi 
> ---
>  BaseTools/Source/C/GenFw/Elf64Convert.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>  mode change 100644 => 100755 BaseTools/Source/C/GenFw/Elf64Convert.c
>
> diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c 
> b/BaseTools/Source/C/GenFw/Elf64Convert.c
> old mode 100644
> new mode 100755
> index 024a2a0..7c838f3
> --- a/BaseTools/Source/C/GenFw/Elf64Convert.c
> +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
> @@ -75,7 +75,7 @@ CleanUp64 (
>);
>
>  //
> -// Rename ELF32 strucutres to common names to help when porting to ELF64.
> +// Rename ELF32 structures to common names to help when porting to ELF64.
>  //
>  typedef Elf64_Shdr Elf_Shdr;
>  typedef Elf64_Ehdr Elf_Ehdr;
> @@ -233,7 +233,7 @@ IsTextShdr (
>Elf_Shdr *Shdr
>)
>  {
> -  return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC);
> +  return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | 
> SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC));

So what happens to .rodata sections? They have SHF_ALLOC set, and
SHF_EXECINSTR and SHF_WRITE cleared, so this function will now return
FALSE for them.

>  }
>
>  STATIC
> @@ -256,7 +256,7 @@ IsDataShdr (
>if (IsHiiRsrcShdr(Shdr)) {
>  return FALSE;
>}
> -  return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC 
> | SHF_WRITE);
> +  return (BOOLEAN) (Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | 
> SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);

... and this function will also return FALSE for them.

So the result is that you are silently dropping ELF sections from the input.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] UefiCpuPkg/CpuDxe: StartupAllAPs in parallel mode

2016-07-08 Thread Fan, Jeff
Laszlo,

Thanks your feedback and provided the history on MTRRs sync code.

DEBUG () running on Aps is a common issue to be avoided.
For MtrrLib, DEBUG() is using DEBUG_CACHE for debug purpose only. Usually, 
MTRRs setting should be same between BSP/Aps. Dump MTRRs are enough for BSP. 
Maybe, we could enhance MtrrLib to avoid DEBUG () running on Aps. 

For the case 2) in StartupAllAPs() call in InitializeMpSupport(), it will be 
handled in our refactor on MP support between CpuMpPei and CpuDxe driver as 
Mike mentioned. 
I wish we could sent out MP Initial Lib support in a couple of weeks.

Thanks!
Jeff


-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Friday, July 08, 2016 4:38 PM
To: Fan, Jeff; edk2-de...@ml01.01.org
Cc: Kinney, Michael D; Tian, Feng
Subject: Re: [Patch] UefiCpuPkg/CpuDxe: StartupAllAPs in parallel mode

Jeff,

On 07/08/16 09:45, Jeff Fan wrote:
> SetMemoryAttributes() will sync BSP's MTRRs settings to all APs by 
> StartupAllAPs service in serial mode. It may caused much performance 
> impact if there are too much processors in system. This update is to 
> invoke StartupAllAps in parallel mode. IA32 SDM does suggest to program MTRRs 
> in parallel mode.
> 
> Cc: Michael Kinney 
> Cc: Feng Tian 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jeff Fan 
> Reviewed-by: Feng Tian 
> ---
>  UefiCpuPkg/CpuDxe/CpuDxe.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c 
> index daf97bd..78b2c88 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -1,7 +1,7 @@
>  /** @file
>CPU DXE Module.
>  
> -  Copyright (c) 2008 - 2013, Intel Corporation. All rights 
> reserved.
> +  Copyright (c) 2008 - 2016, Intel Corporation. All rights 
> + reserved.
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD 
> License
>which accompanies this distribution.  The full text of the license 
> may be found at @@ -422,7 +422,7 @@ CpuSetMemoryAttributes (
>MpStatus = MpService->StartupAllAPs (
>MpService,  // This
>SetMtrrsFromBuffer, // Procedure
> -  TRUE,   // SingleThread
> +  FALSE,  // SingleThread
>NULL,   // WaitEvent
>0,  // TimeoutInMicrosecsond
>&MtrrSettings,  // ProcedureArgument
> 

(1) This change looks "obvious" on the surface, and to be honest, when looking 
at your patch now, I couldn't tell for a minute what I was thinking when I set 
SingleThread=TRUE, in commit 94941c8853448.

Digging down a bit, I believe I remember now. The APs execute the following 
call chain:

SetMtrrsFromBuffer() [UefiCpuPkg/CpuDxe/CpuMp.c]
  MtrrSetAllMtrrs()  [UefiCpuPkg/Library/MtrrLib/MtrrLib.c]
MtrrDebugPrintAllMtrrs() [UefiCpuPkg/Library/MtrrLib/MtrrLib.c]
  MtrrDebugPrintAllMtrrsWorker() [UefiCpuPkg/Library/MtrrLib/MtrrLib.c]

I believe my reason for SingleThread=TRUE may have been that 
MtrrDebugPrintAllMtrrsWorker() is not safe for parallel execution (with the 
many DEBUG()s in it).

I agree this would be a nice improvement, both for performance and for 
compliance with the SDM -- if only we could make SetMtrrsFromBuffer() 
thread-safe, top to bottom.

(In my other patchset that you just reviewed (thanks for that BTW!), I also 
verified that the WriteFeatureControl() AP procedure would be safe for parallel 
execution. It is: it calls only AsmWriteMsr64(), which compiles to a single 
WRMSR instruction. But here, SetMtrrsFromBuffer() is much more complex, top to 
bottom.)

(2) If we end up modifying SingleThread to FALSE, then this is not the only 
location that should be updated -- there's another StartupAllAPs() call in 
InitializeMpSupport(). (See again commit 94941c8853448.)

Thanks!
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 5/7] BaseTools-Conf:Introduce CLANG38 new toolchain for x86

2016-07-08 Thread Ronny Chevalier
On Fri, Jul 8, 2016 at 9:42 AM, Shi, Steven  wrote:
> LANG38 uses Clang3.8.0, enable LLVM Link Time Optimization (LTO)
> and code size optimization flag (-Oz) by default for aggressive code
> size improvement. CLANG38 X64 code is small code model + PIE.
>
> Test pass platforms: OVMF (OvmfPkgIa32.dsc, OvmfPkgX64.dsc).
> Test compiler and linker version: LLVM 3.8, GNU ld 2.26.
>
> Example steps to use the CLANG38 tool chain to build OVMF platform:
> 1. Download and extract the llvm 3.8.0 Pre-Built Binaries from
> http://www.llvm.org/releases/ (e.g. http://www.llvm.org/releases/
> 3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz and
> extract it as ~/clang38).
> 2. Copy LLVMgold.so from https://github.com/shijunjing/edk2/blob/
> llvm/BaseTools/Bin/LLVMgold.so to above clang lib folder (e.g.
> ~/clang38/lib/LLVMgold.so, this step is needed only for CLANG38)
> 3. Install new version linker with plugin support (e.g. ld 2.26 in
> GNU Binutils 2.26 or Ubuntu16.04, this step is needed only for CLANG38)
> $ cd edk2
> $ git checkout llvm
> $ export CLANG38_BIN=path/to/your/clang38/
> (e.g. export CLANG38_BIN=~/clang38/bin/)
> $ source edksetup.sh
> $ make -C BaseTools/Source/C
> $ build -t CLANG38 -a X64 -p OvmfPkg/OvmfPkgX64.dsc -n 5 -b DEBUG
> -DDEBUG_ON_SERIAL_PORT
> $ cd edk2/Build/OvmfX64/DEBUG_CLANG38/FV
> $ qemu-system-x86_64.exe -bios OVMF.fd -serial file:serial.log -m 4096
>  -hda fat:.
>
> If you want, you can build and install GNU Binutils 2.26 as below steps
> in Ubuntu:
> Download binutils-2.26 source code from http://ftp.gnu.org/gnu/binutils/
>  and extract it to ~/binutils-2.26
> $sudo apt-get install bison
> $sudo apt-get install flex
> Install other necessary binutils build tools if missing
> $ mkdir build
> $ cd build
> $ ../binutils-2.26/configure --enable-gold --enable-plugins
> --disable-werror --prefix=/usr
> $ make -j 5
> $ sudo make install
>
> If you want, you can build LLVMgold.so as below steps
> Download llvm-3.8.0 source code from http://www.llvm.org/releases/
> 3.8.0/llvm-3.8.0.src.tar.xz and extract it to ~/llvm-3.8.0.src
> Download clang3.8.0 source code from http://www.llvm.org/releases/
> 3.8.0/cfe-3.8.0.src.tar.xz and extract it to ~/llvm-3.8.0.src/tools/clang
> Refer http://clang.llvm.org/get_started.html to Install other necessary
> clang build tools if missing
> $ mkdir llvm38build
> $ cd llvm38build
> If your GNU Binutils 2.26 is in /home/jshi19/binutils-2.26,
> $ cmake ../llvm-3.8.0.src -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release"
> -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_VERBOSE_MAKEFILE=ON
> -DCMAKE_CXX_COMPILER="/usr/bin/g++" -DCMAKE_C_COMPILER="/usr/bin/gcc"
> -DLLVM_BINUTILS_INCDIR=/home/jshi19/binutils-2.26/include
> $ make -j 5 LLVMgold The LLVMgold.so is in ~/llvm38build/lib/LLVMgold.so
>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Steven Shi 
> ---
>  BaseTools/Conf/build_rule.template |  7 ++-
>  BaseTools/Conf/tools_def.template  | 87 
> ++
>  2 files changed, 92 insertions(+), 2 deletions(-)
>
> diff --git a/BaseTools/Conf/build_rule.template 
> b/BaseTools/Conf/build_rule.template
> index 25cf380..4530d92 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -267,7 +267,10 @@
>
>  
>  "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
> -
> +
> +
> +"$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
> +
>  
>  "$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)
>
> @@ -295,7 +298,7 @@
>  "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) 
> @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)
>  "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
>
> -
> +
>  "$(DLINK)" -o ${dst} $(DLINK_FLAGS) 
> -Wl,--start-group,$(DLINK_SPATH),@$(STATIC_LIBRARY_FILES_LIST) 
> -Wl,--end-group $(DLINK2_FLAGS)
>  "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
>
> diff --git a/BaseTools/Conf/tools_def.template 
> b/BaseTools/Conf/tools_def.template
> index e41aad14..092a393 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -378,6 +378,12 @@ DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program 
> Files/CodeSourcery/Sourcery G
>  # Required to build platforms or ACPI tables:
>  #   Intel(r) ACPI Compiler from
>  #   https://acpica.org/downloads
> +#   CLANG38  -Linux-  Requires:
> +# Clang v3.8 or later, LLVMgold plugin and GNU 
> binutils 2.26 targeting x86_64-linux-gnu
> +#Optional:
> +# Required to build platforms or ACPI tables:
> +#   Intel(r) ACPI Compiler from
> +#   https://acpica.org/downloads
>  #   ELFGCC  -Linux-  Requires:
>  # GCC(this tool chain uses whatever version

Re: [edk2] [patch] NetworkPkg: Fix Assert issue in iSCSI driver.

2016-07-08 Thread Ye, Ting
Reviewed-by: Ye Ting  

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang 
Lubo
Sent: Friday, July 8, 2016 3:51 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Wu, Jiaxin 

Subject: [edk2] [patch] NetworkPkg: Fix Assert issue in iSCSI driver.

The bug existed in replacing AsciiStrToUnicodeStr with AsciiStrToUnicodeStrS, 
since MacString now is a pointer, the value sizeof(MacString)/sizeof 
(MacString[0]) is not correct here as the third parameter.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/IScsiDxe/IScsiConfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c 
b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 8015e3d..3631e72 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -685,11 +685,11 @@ IScsiConvertIfrNvDataToAttemptConfigData (
   MacString = (CHAR16 *) AllocateZeroPool (ISCSI_MAX_MAC_STRING_LEN * sizeof 
(CHAR16));
   if (MacString == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
 
-  AsciiStrToUnicodeStrS (Attempt->MacString, MacString, sizeof (MacString) / 
sizeof (MacString[0]));
+  AsciiStrToUnicodeStrS (Attempt->MacString, MacString, 
+ ISCSI_MAX_MAC_STRING_LEN);
 
   UnicodeSPrint (
 mPrivate->PortString,
 (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
 L"MAC: %s, PFA: Bus %d | Dev %d | Func %d, iSCSI mode: %s, IP version: %s",
--
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 3/7] MdePkg: Enable new MS VA intrinsics for GNUC x86 64bits build

2016-07-08 Thread Shi, Steven
Both GCC and LLVM 3.8 64bits support new variable argument (VA)
intrinsics for Microsoft ABI, enable these new VA intrinsics for
GNUC family 64bits code build. These VA intrinsics are only
permitted use in 64bits code, so not use them in 32bits code build.
The original 32bits GNU VA intrinsics has the same calling conversion
as MS, so we don’t need change them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi 
---
 MdePkg/Include/Base.h | 27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 MdePkg/Include/Base.h

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
old mode 100644
new mode 100755
index cbd9e55..5129b64
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -588,9 +588,32 @@ struct _LIST_ENTRY {
 
 #define VA_COPY(Dest, Start)  __va_copy (Dest, Start)
 
-#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS)
+
+#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS) && !defined 
(MDE_CPU_IA32)
+//
+// 64bits build only. Use GCC built-in macros for variable argument lists.
+//
+///
+/// Both GCC and LLVM 3.8 64bits support new variable argument intrinsics for 
Microsoft ABI
+///
+
+///
+/// Variable used to traverse the list of arguments. This type can vary by
+/// implementation and could be an array or structure.
+///
+typedef __builtin_ms_va_list VA_LIST;
+
+#define VA_START(Marker, Parameter)  __builtin_ms_va_start (Marker, Parameter)
+
+#define VA_ARG(Marker, TYPE) ((sizeof (TYPE) < sizeof (UINTN)) ? 
(TYPE)(__builtin_va_arg (Marker, UINTN)) : (TYPE)(__builtin_va_arg (Marker, 
TYPE)))
+
+#define VA_END(Marker)   __builtin_ms_va_end (Marker)
+
+#define VA_COPY(Dest, Start) __builtin_ms_va_copy (Dest, Start)
+
+#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS) && defined 
(MDE_CPU_IA32)
 //
-// Use GCC built-in macros for variable argument lists.
+// 32bits build only. Use GCC built-in macros for variable argument lists.
 //
 
 ///
-- 
2.7.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 0/7] Introduce three new toolchains in edk2

2016-07-08 Thread Shi, Steven
Please review my new commits in public branch:
https://github.com/shijunjing/edk2/commits/llvm_v2

I did below enhancements according feedback to 
V1(https://github.com/shijunjing/edk2/commits/review5):
1. Remove the Quark platform work around and code clean work from this serial 
patches.
2. Seperate three toolchains to three different patches.
3. Seperate GenFw update general part from x86 specific part and enhance the 
PIE/PIC commit log.
4. Not set -D EFI32, but use MDE_CPU_IA32 instead.


Shi, Steven (7):
  BaseTools-GenFw:Use EXE flag to check Elf section type
  BaseTools-GenFw:Add new x86_64 Elf relocation types for PIC/PIE code
  MdePkg: Enable new MS VA intrinsics for GNUC x86 64bits build
  BaseTools-Conf:Introduce GCC5 new toolchain for x86
  BaseTools-Conf:Introduce CLANG38 new toolchain for x86
  BaseTools-Conf:Introduce CLANGSCAN38 new toolchain for x86
  ShellPkg-UefiShellTftpCommandLib: Replace compiler builtin

 BaseTools/Conf/build_rule.template  |  17 +-
 BaseTools/Conf/tools_def.template   | 267 
 BaseTools/Source/C/GenFw/Elf64Convert.c | 115 --
 BaseTools/Source/C/GenFw/elf_common.h   |   9 +-
 MdePkg/Include/Base.h   |  27 ++-
 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c |   2 +-
 6 files changed, 419 insertions(+), 18 deletions(-)
 mode change 100644 => 100755 BaseTools/Conf/build_rule.template
 mode change 100644 => 100755 BaseTools/Conf/tools_def.template
 mode change 100644 => 100755 BaseTools/Source/C/GenFw/Elf64Convert.c
 mode change 100644 => 100755 BaseTools/Source/C/GenFw/elf_common.h
 mode change 100644 => 100755 MdePkg/Include/Base.h
 mode change 100644 => 100755 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c

-- 
2.7.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 7/7] ShellPkg-UefiShellTftpCommandLib: Replace compiler builtin

2016-07-08 Thread Shi, Steven
Use explicit CopyMem to replace compiler builtin to do the structure
values assignment.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi 
Reviewed-by: Jaben Carsey 

---
 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 mode change 100644 => 100755 ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c

diff --git a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c 
b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
old mode 100644
new mode 100755
index 666ee9d..5c50797
--- a/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
+++ b/ShellPkg/Library/UefiShellTftpCommandLib/Tftp.c
@@ -342,7 +342,7 @@ ShellCommandRunTftp (
 goto Error;
   }
 
-  Mtftp4ConfigData = DefaultMtftp4ConfigData;
+  CopyMem (&Mtftp4ConfigData, &DefaultMtftp4ConfigData, sizeof 
(EFI_MTFTP4_CONFIG_DATA));
 
   //
   // Check the host IPv4 address
-- 
2.7.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 4/7] BaseTools-Conf:Introduce GCC5 new toolchain for x86

2016-07-08 Thread Shi, Steven
GCC5 enable GCC Link Time Optimization (LTO) and code size
optimization (–Os) for aggressive code size improvement.
GCC5 X64 code is small code model + position independent
code (PIE).

Test pass platforms: OVMF (OvmfPkgIa32.dsc, OvmfPkgX64.dsc) and
Quark (Quark.dsc).
Test compiler and linker version: GCC 5.3, GCC 5.4, GNU ld 2.26.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi 
---
 BaseTools/Conf/build_rule.template |  9 
 BaseTools/Conf/tools_def.template  | 92 ++
 2 files changed, 101 insertions(+)
 mode change 100644 => 100755 BaseTools/Conf/build_rule.template
 mode change 100644 => 100755 BaseTools/Conf/tools_def.template

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
old mode 100644
new mode 100755
index 91bcc18..25cf380
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -295,6 +295,10 @@
 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) 
@$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)
 "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
 
+
+"$(DLINK)" -o ${dst} $(DLINK_FLAGS) 
-Wl,--start-group,$(DLINK_SPATH),@$(STATIC_LIBRARY_FILES_LIST) -Wl,--end-group 
$(DLINK2_FLAGS)
+"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
+
 
 "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via 
$(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
 
@@ -448,6 +452,11 @@
 "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
 "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(GENFW_FLAGS)
 
+
+"$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) 
$(INC) ${src}
+"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
+"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(GENFW_FLAGS)
+
 
 "$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj  $(ASLCC_FLAGS) 
$(INC) ${src}
 "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
old mode 100644
new mode 100755
index 2065fa3..e41aad14
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -366,6 +366,12 @@ DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program 
Files/CodeSourcery/Sourcery G
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler from
 #   https://acpica.org/downloads
+#   GCC5-Linux-  Requires:
+# GCC 5.x targeting x86_64-linux-gnu
+#Optional:
+# Required to build platforms or ACPI tables:
+#   Intel(r) ACPI Compiler from
+#   https://acpica.org/downloads
 #   CLANG35 -Linux,Windows-  Requires:
 # Clang v3.5 or later, and GNU binutils targeting 
aarch64-linux-gnu or arm-linux-gnueabi
 #Optional:
@@ -7410,3 +7416,89 @@ RELEASE_RVCTCYGWIN_ARM_CC_FLAGS  = "$(CCPATH_FLAG)" 
$(ARCHCC_FLAGS) $(PLATFORM_F
 # Build rule order
 #
 *_*_*_*_BUILDRULEORDER = nasm asm Asm ASM S s
+
+##
+#
+# GCC 5.x - This configuration is used to compile under Linux to produce
+# PE/COFF binaries using GCC 5.x with link-time optimization and image size 
optimization.
+# Tested with GNU Binutils 2.26, e.g. ld 2.26 and gcc-ar 2.26
+#
+##
+DEFINE GCC5_IA32_PREFIX  = ENV(GCC5_BIN)
+DEFINE GCC5_X64_PREFIX   = ENV(GCC5_BIN)
+
+*_GCC5_*_*_FAMILY= GCC
+*_GCC5_*_*_BUILDRULEFAMILY   = GCC5
+*_GCC5_*_MAKE_PATH   = DEF(GCC5_IA32_PREFIX)make
+*_GCC5_*_*_DLL   = ENV(GCC5_DLL)
+*_GCC5_*_ASL_PATH= DEF(UNIX_IASL_BIN)
+
+*_GCC5_*_PP_FLAGS= DEF(GCC_PP_FLAGS)
+*_GCC5_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
+*_GCC5_*_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)
+*_GCC5_*_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
+*_GCC5_*_APP_FLAGS   =
+*_GCC5_*_ASL_FLAGS   = DEF(IASL_FLAGS)
+*_GCC5_*_ASL_OUTFLAGS= DEF(IASL_OUTFLAGS)
+
+DEFINE GCC5_ALL_CC_FLAGS = -fshort-wchar -fno-strict-aliasing -Wall 
-Werror -Wno-array-bounds -Wno-address  -ffunction-sections -fdata-sections 
-fno-stack-protector -c -include AutoGen.h -fno-common -fno-builtin 
-DSTRING_ARRAY_NAME=$(BASE_NAME)Strings -Wno-unused-but-set-variable
+DEFINE GCC5_IA32_CC_FLAGS= DEF(GCC5_ALL_CC_FLAGS)

[edk2] [PATCH v2 2/7] BaseTools-GenFw:Add new x86_64 Elf relocation types for PIC/PIE code

2016-07-08 Thread Shi, Steven
Add support to convert new Elf relocation types
(R_X86_64_PLT32, R_X86_64_GOTPCREL, R_X86_64_GOTPCRELX,
R_X86_64_REX_GOTPCRELX) to PeCoff, which are required by
position independent code (PIC) built Elf image.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi 
---
 BaseTools/Source/C/GenFw/Elf64Convert.c | 105 +---
 BaseTools/Source/C/GenFw/elf_common.h   |   9 ++-
 2 files changed, 105 insertions(+), 9 deletions(-)
 mode change 100644 => 100755 BaseTools/Source/C/GenFw/elf_common.h

diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c 
b/BaseTools/Source/C/GenFw/Elf64Convert.c
index 7c838f3..fc241ab 100755
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -755,6 +755,11 @@ WriteSections64 (
 // Determine how to handle each relocation type based on the machine 
type.
 //
 if (mEhdr->e_machine == EM_X86_64) {
+  //
+  // See Relocation Types details semantics in Table 4.9 of
+  // SystemV x86_64 abi Draft Version 0.99.8
+  // 
https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-secure.pdf
+  //
   switch (ELF_R_TYPE(Rel->r_info)) {
   case R_X86_64_NONE:
 break;
@@ -763,24 +768,24 @@ WriteSections64 (
 // Absolute relocation.
 //
 VerboseMsg ("R_X86_64_64");
-VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX", 
-  (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), 
+VerboseMsg ("Offset: 0x%08X, Addend: 0x%016LX",
+  (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
   *(UINT64 *)Targ);
 *(UINT64 *)Targ = *(UINT64 *)Targ - SymShdr->sh_addr + 
mCoffSectionsOffset[Sym->st_shndx];
 VerboseMsg ("Relocation:  0x%016LX", *(UINT64*)Targ);
 break;
   case R_X86_64_32:
 VerboseMsg ("R_X86_64_32");
-VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", 
-  (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), 
+VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+  (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
   *(UINT32 *)Targ);
 *(UINT32 *)Targ = (UINT32)((UINT64)(*(UINT32 *)Targ) - 
SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
 VerboseMsg ("Relocation:  0x%08X", *(UINT32*)Targ);
 break;
   case R_X86_64_32S:
 VerboseMsg ("R_X86_64_32S");
-VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", 
-  (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), 
+VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+  (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
   *(UINT32 *)Targ);
 *(INT32 *)Targ = (INT32)((INT64)(*(INT32 *)Targ) - 
SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]);
 VerboseMsg ("Relocation:  0x%08X", *(UINT32*)Targ);
@@ -790,14 +795,45 @@ WriteSections64 (
 // Relative relocation: Symbol - Ip + Addend
 //
 VerboseMsg ("R_X86_64_PC32");
-VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X", 
-  (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)), 
+VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+  (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
   *(UINT32 *)Targ);
 *(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ
   + (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr)
   - (SecOffset - SecShdr->sh_addr));
 VerboseMsg ("Relocation:  0x%08X", *(UINT32 *)Targ);
 break;
+  case R_X86_64_PLT32:
+//
+// Relative relocation: L + A - P
+//
+VerboseMsg ("R_X86_64_PLT32");
+VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
+  (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
+  *(UINT32 *)Targ);
+*(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ
+  + (mCoffSectionsOffset[Sym->st_shndx] - SymShdr->sh_addr)
+  - (SecOffset - SecShdr->sh_addr));
+VerboseMsg ("Relocation:  0x%08X", *(UINT32 *)Targ);
+break;
+  case R_X86_64_GOTPCREL:
+//
+// Relative relocation: G + GOT + A - P
+//
+VerboseMsg ("R_X86_64_GOTPCREL");
+break;
+  case R_X86_64_GOTPCRELX:
+//
+// Relative relocation: G + GOT + A - P
+//
+VerboseMsg ("R_X86_64_GOTPCRELX");
+break;
+  case R_X86_64_REX_GOTPCRELX:
+//
+// Relative relocation: G + GOT + A - P
+//
+VerboseMsg ("R_X86_64_REX_GOTPCRELX");
+break;
   default:
 Error (NULL, 0, 3000, "Invalid", "%s un

[edk2] [PATCH v2 6/7] BaseTools-Conf:Introduce CLANGSCAN38 new toolchain for x86

2016-07-08 Thread Shi, Steven
CLANGSCAN38 is based on CLANG38 to seamlessly integrate Clang
scan-build analyzer infrastructure into edk2 build infrastructure.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi 
---
 BaseTools/Conf/build_rule.template |  7 ++-
 BaseTools/Conf/tools_def.template  | 88 ++
 2 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index 4530d92..c669557 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -137,6 +137,9 @@
 
 "$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
 
+
+"$(SCAN)" $(SCAN_FLAGS) -o $(SCAN_DST) "$(CC)" $(CC_FLAGS) -o ${dst} 
$(INC) ${src}
+
 [C-Code-File.COMMON.IPF]
 
 ?.c
@@ -268,7 +271,7 @@
 
 "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
 
-
+
 "$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
 
 
@@ -298,7 +301,7 @@
 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) 
@$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)
 "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
 
-
+
 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) 
-Wl,--start-group,$(DLINK_SPATH),@$(STATIC_LIBRARY_FILES_LIST) -Wl,--end-group 
$(DLINK2_FLAGS)
 "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
 
diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 092a393..efb7e4b 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -384,6 +384,12 @@ DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program 
Files/CodeSourcery/Sourcery G
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler from
 #   https://acpica.org/downloads
+#   CLANGSCAN38 -Linux-  Requires:
+# Clang v3.8 or later, and GNU binutils 2.26 
targeting x86_64-linux-gnu
+#Optional:
+# Required to build platforms or ACPI tables:
+#   Intel(r) ACPI Compiler from
+#   https://acpica.org/downloads
 #   ELFGCC  -Linux-  Requires:
 # GCC(this tool chain uses whatever version of gcc 
and binutils that is installed in /usr/bin)
 #Optional:
@@ -7504,6 +7510,88 @@ RELEASE_CLANG38_X64_CC_FLAGS   = 
DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__
 *_CLANG38_X64_OBJCOPY_FLAGS=
 *_CLANG38_X64_NASM_FLAGS   = -f elf64
 
+
+#
+# ClangScan 3.8 - This configuration is used to base on CLANG38 build tool 
chain to
+# run the clang static analyzer (scan-build) over edk2 codebase
+#
+
+
+*_CLANGSCAN38_*_*_FAMILY= GCC
+*_CLANGSCAN38_*_*_BUILDRULEFAMILY   = CLANGSCAN38
+*_CLANGSCAN38_*_MAKE_PATH   = DEF(GCC49_IA32_PREFIX)make
+*_CLANGSCAN38_*_*_DLL   = ENV(CLANG38_DLL)
+*_CLANGSCAN38_*_ASL_PATH= DEF(UNIX_IASL_BIN)
+
+*_CLANGSCAN38_*_PP_FLAGS= DEF(GCC_PP_FLAGS) -target 
x86_64-pc-linux-gnu
+*_CLANGSCAN38_*_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) -target 
x86_64-pc-linux-gnu
+*_CLANGSCAN38_*_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) -target 
x86_64-pc-linux-gnu
+*_CLANGSCAN38_*_APP_FLAGS   =
+*_CLANGSCAN38_*_ASL_FLAGS   = DEF(IASL_FLAGS)
+*_CLANGSCAN38_*_ASL_OUTFLAGS= DEF(IASL_OUTFLAGS)
+
+DEFINE CLANGSCAN38_ALL_CHECKER_FLAGS  = -enable-checker 
alpha.security.MallocOverflow -enable-checker alpha.security.ReturnPtrRange 
-enable-checker alpha.security.taint.TaintPropagation -disable-checker  
deadcode.DeadStores -disable-checker core.NullDereference
+DEFINE SCAN_OUTPUT_PATH = ~/ClangReport
+
+###
+# CLANGSCAN38 IA32 definitions
+###
+*_CLANGSCAN38_IA32_OBJCOPY_PATH = DEF(GCC49_IA32_PREFIX)objcopy
+*_CLANGSCAN38_IA32_SCAN_PATH= DEF(CLANG38_IA32_PREFIX)scan-build
+*_CLANGSCAN38_IA32_SCAN_DST = DEF(SCAN_OUTPUT_PATH)
+*_CLANGSCAN38_IA32_CC_PATH  = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANGSCAN38_IA32_SLINK_PATH   = DEF(CLANG38_IA32_PREFIX)llvm-ar
+*_CLANGSCAN38_IA32_DLINK_PATH   = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANGSCAN38_IA32_ASLDLINK_PATH= DEF(CLANG38_IA32_PREFIX)clang
+*_CLANGSCAN38_IA32_ASM_PATH = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANGSCAN38_IA32_PP_PATH  = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANGSCAN38_IA32_VFRPP_PATH   = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANGSCAN38_IA32_ASLCC_PATH   = DEF(CLANG38_IA32_PREFIX)clang
+*_CLANGSCAN38_IA32_ASLPP_PATH   = DEF(CLANG38_IA32_

[edk2] [PATCH v2 1/7] BaseTools-GenFw:Use EXE flag to check Elf section type

2016-07-08 Thread Shi, Steven
Add SHF_EXECINSTR attribute flag in logic to check Elf Text and
Data section type. Also fix some typo in the code comments and
Debug strings.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi 
---
 BaseTools/Source/C/GenFw/Elf64Convert.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)
 mode change 100644 => 100755 BaseTools/Source/C/GenFw/Elf64Convert.c

diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c 
b/BaseTools/Source/C/GenFw/Elf64Convert.c
old mode 100644
new mode 100755
index 024a2a0..7c838f3
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -75,7 +75,7 @@ CleanUp64 (
   );
 
 //
-// Rename ELF32 strucutres to common names to help when porting to ELF64.
+// Rename ELF32 structures to common names to help when porting to ELF64.
 //
 typedef Elf64_Shdr Elf_Shdr;
 typedef Elf64_Ehdr Elf_Ehdr;
@@ -233,7 +233,7 @@ IsTextShdr (
   Elf_Shdr *Shdr
   )
 {
-  return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC);
+  return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | SHF_ALLOC)) 
== (SHF_EXECINSTR | SHF_ALLOC));
 }
 
 STATIC
@@ -256,7 +256,7 @@ IsDataShdr (
   if (IsHiiRsrcShdr(Shdr)) {
 return FALSE;
   }
-  return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | 
SHF_WRITE);
+  return (BOOLEAN) (Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | SHF_ALLOC)) 
== (SHF_ALLOC | SHF_WRITE);
 }
 
 STATIC
@@ -661,9 +661,9 @@ WriteSections64 (
 
   default:
 //
-//  Ignore for unkown section type.
+//  Ignore for unknown section type.
 //
-VerboseMsg ("%s unknown section type %x. We directly copy this section 
into Coff file", mInImageName, (unsigned)Shdr->sh_type);
+VerboseMsg ("%s unknown section type %x. We directly ignore this 
section and NOT copy into Coff file", mInImageName, (unsigned)Shdr->sh_type);
 break;
   }
 }
-- 
2.7.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v2 5/7] BaseTools-Conf:Introduce CLANG38 new toolchain for x86

2016-07-08 Thread Shi, Steven
LANG38 uses Clang3.8.0, enable LLVM Link Time Optimization (LTO)
and code size optimization flag (-Oz) by default for aggressive code
size improvement. CLANG38 X64 code is small code model + PIE.

Test pass platforms: OVMF (OvmfPkgIa32.dsc, OvmfPkgX64.dsc).
Test compiler and linker version: LLVM 3.8, GNU ld 2.26.

Example steps to use the CLANG38 tool chain to build OVMF platform:
1. Download and extract the llvm 3.8.0 Pre-Built Binaries from
http://www.llvm.org/releases/ (e.g. http://www.llvm.org/releases/
3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz and
extract it as ~/clang38).
2. Copy LLVMgold.so from https://github.com/shijunjing/edk2/blob/
llvm/BaseTools/Bin/LLVMgold.so to above clang lib folder (e.g.
~/clang38/lib/LLVMgold.so, this step is needed only for CLANG38)
3. Install new version linker with plugin support (e.g. ld 2.26 in
GNU Binutils 2.26 or Ubuntu16.04, this step is needed only for CLANG38)
$ cd edk2
$ git checkout llvm
$ export CLANG38_BIN=path/to/your/clang38/
(e.g. export CLANG38_BIN=~/clang38/bin/)
$ source edksetup.sh
$ make -C BaseTools/Source/C
$ build -t CLANG38 -a X64 -p OvmfPkg/OvmfPkgX64.dsc -n 5 -b DEBUG
-DDEBUG_ON_SERIAL_PORT
$ cd edk2/Build/OvmfX64/DEBUG_CLANG38/FV
$ qemu-system-x86_64.exe -bios OVMF.fd -serial file:serial.log -m 4096
 -hda fat:.

If you want, you can build and install GNU Binutils 2.26 as below steps
in Ubuntu:
Download binutils-2.26 source code from http://ftp.gnu.org/gnu/binutils/
 and extract it to ~/binutils-2.26
$sudo apt-get install bison
$sudo apt-get install flex
Install other necessary binutils build tools if missing
$ mkdir build
$ cd build
$ ../binutils-2.26/configure --enable-gold --enable-plugins
--disable-werror --prefix=/usr
$ make -j 5
$ sudo make install

If you want, you can build LLVMgold.so as below steps
Download llvm-3.8.0 source code from http://www.llvm.org/releases/
3.8.0/llvm-3.8.0.src.tar.xz and extract it to ~/llvm-3.8.0.src
Download clang3.8.0 source code from http://www.llvm.org/releases/
3.8.0/cfe-3.8.0.src.tar.xz and extract it to ~/llvm-3.8.0.src/tools/clang
Refer http://clang.llvm.org/get_started.html to Install other necessary
clang build tools if missing
$ mkdir llvm38build
$ cd llvm38build
If your GNU Binutils 2.26 is in /home/jshi19/binutils-2.26,
$ cmake ../llvm-3.8.0.src -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release"
-DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_CXX_COMPILER="/usr/bin/g++" -DCMAKE_C_COMPILER="/usr/bin/gcc"
-DLLVM_BINUTILS_INCDIR=/home/jshi19/binutils-2.26/include
$ make -j 5 LLVMgold The LLVMgold.so is in ~/llvm38build/lib/LLVMgold.so

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Steven Shi 
---
 BaseTools/Conf/build_rule.template |  7 ++-
 BaseTools/Conf/tools_def.template  | 87 ++
 2 files changed, 92 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index 25cf380..4530d92 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -267,7 +267,10 @@
 
 
 "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
-
+
+
+"$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
+
 
 "$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)
 
@@ -295,7 +298,7 @@
 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) 
@$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS)
 "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
 
-
+
 "$(DLINK)" -o ${dst} $(DLINK_FLAGS) 
-Wl,--start-group,$(DLINK_SPATH),@$(STATIC_LIBRARY_FILES_LIST) -Wl,--end-group 
$(DLINK2_FLAGS)
 "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
 
diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index e41aad14..092a393 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -378,6 +378,12 @@ DEFINE SOURCERY_CYGWIN_TOOLS = /cygdrive/c/Program 
Files/CodeSourcery/Sourcery G
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler from
 #   https://acpica.org/downloads
+#   CLANG38  -Linux-  Requires:
+# Clang v3.8 or later, LLVMgold plugin and GNU 
binutils 2.26 targeting x86_64-linux-gnu
+#Optional:
+# Required to build platforms or ACPI tables:
+#   Intel(r) ACPI Compiler from
+#   https://acpica.org/downloads
 #   ELFGCC  -Linux-  Requires:
 # GCC(this tool chain uses whatever version of gcc 
and binutils that is installed in /usr/bin)
 #Optional:
@@ -7417,6 +7423,87 @@ RELEASE_RVCTCYGWIN_ARM_CC_FLAGS  = "$(CCPATH_FLAG)" 
$(ARCHCC_FLAGS) $(PLATFORM_F
 #
 *_*_*_*_BUILDRULEORDER = nasm asm Asm ASM S s
 

Re: [edk2] [Patch] UefiCpuPkg/CpuDxe: StartupAllAPs in parallel mode

2016-07-08 Thread Laszlo Ersek
Jeff,

On 07/08/16 09:45, Jeff Fan wrote:
> SetMemoryAttributes() will sync BSP's MTRRs settings to all APs by 
> StartupAllAPs
> service in serial mode. It may caused much performance impact if there are too
> much processors in system. This update is to invoke StartupAllAps in parallel
> mode. IA32 SDM does suggest to program MTRRs in parallel mode.
> 
> Cc: Michael Kinney 
> Cc: Feng Tian 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jeff Fan 
> Reviewed-by: Feng Tian 
> ---
>  UefiCpuPkg/CpuDxe/CpuDxe.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
> index daf97bd..78b2c88 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -1,7 +1,7 @@
>  /** @file
>CPU DXE Module.
>  
> -  Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.
> +  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD 
> License
>which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -422,7 +422,7 @@ CpuSetMemoryAttributes (
>MpStatus = MpService->StartupAllAPs (
>MpService,  // This
>SetMtrrsFromBuffer, // Procedure
> -  TRUE,   // SingleThread
> +  FALSE,  // SingleThread
>NULL,   // WaitEvent
>0,  // TimeoutInMicrosecsond
>&MtrrSettings,  // ProcedureArgument
> 

(1) This change looks "obvious" on the surface, and to be honest, when looking 
at your patch now, I couldn't tell for a minute what I was thinking when I set 
SingleThread=TRUE, in commit 94941c8853448.

Digging down a bit, I believe I remember now. The APs execute the following 
call chain:

SetMtrrsFromBuffer() [UefiCpuPkg/CpuDxe/CpuMp.c]
  MtrrSetAllMtrrs()  [UefiCpuPkg/Library/MtrrLib/MtrrLib.c]
MtrrDebugPrintAllMtrrs() [UefiCpuPkg/Library/MtrrLib/MtrrLib.c]
  MtrrDebugPrintAllMtrrsWorker() [UefiCpuPkg/Library/MtrrLib/MtrrLib.c]

I believe my reason for SingleThread=TRUE may have been that 
MtrrDebugPrintAllMtrrsWorker() is not safe for parallel execution (with the 
many DEBUG()s in it).

I agree this would be a nice improvement, both for performance and for 
compliance with the SDM -- if only we could make SetMtrrsFromBuffer() 
thread-safe, top to bottom.

(In my other patchset that you just reviewed (thanks for that BTW!), I also 
verified that the WriteFeatureControl() AP procedure would be safe for parallel 
execution. It is: it calls only AsmWriteMsr64(), which compiles to a single 
WRMSR instruction. But here, SetMtrrsFromBuffer() is much more complex, top to 
bottom.)

(2) If we end up modifying SingleThread to FALSE, then this is not the only 
location that should be updated -- there's another StartupAllAPs() call in 
InitializeMpSupport(). (See again commit 94941c8853448.)

Thanks!
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V2 0/7] Introduce three new toolchains in edk2

2016-07-08 Thread Ard Biesheuvel
On 8 July 2016 at 10:21, Gao, Liming  wrote:
> Ard:
>   For big change with lots of patches, we could send branch for code review, 
> not need send every patch.
>
>   This change is not big. It only includes 7 patches. So, you think he needs 
> to send his patches for review. Right?
>

Yes. For me as a reviewer, it is a lot less work to reply to the
patches in line. Now, I have to go to the github.com website, look at
the patches and copy/paste each part to I want to comment on. Also,
the mailing list serves as a public record for which exact version of
the patch I replied to.

Even for a big change with lots of patches, I still think they need to
be sent to the mailing list, unless they are mechanical search/replace
patches or deal with large binary files.

I have already spotted problems with Steven's series on the github
site, so I need the patches to be sent to the mailing list (and cc'ed
to me please) so I can respond.

-- 
Ard.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V2 0/7] Introduce three new toolchains in edk2

2016-07-08 Thread Gao, Liming
Ard:
  For big change with lots of patches, we could send branch for code review, 
not need send every patch. 

  This change is not big. It only includes 7 patches. So, you think he needs to 
send his patches for review. Right?

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Ard Biesheuvel
> Sent: Friday, July 08, 2016 4:18 PM
> To: Shi, Steven 
> Cc: Kinney, Michael D ; Justen, Jordan L
> ; edk2-devel@lists.01.org; af...@apple.com;
> Gao, Liming 
> Subject: Re: [edk2] [PATCH V2 0/7] Introduce three new toolchains in edk2
> 
> On 8 July 2016 at 04:37, Shi, Steven  wrote:
> > Hi Ard,
> > I've put v2 in the subject and change the branch name to
> https://github.com/shijunjing/edk2/commits/llvm_v2 . You can review all my
> serial patches in the branch link, and let me know if you need me send the
> patches in the mail list again.
> >
> 
> Yes, I need you to send the patches to the mailing list. You must
> always send the patches to the mailing list, so no need to even ask.
> 
> Thanks,
> Ard.
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [patch] NetworkPkg: Fix Assert issue in iSCSI driver.

2016-07-08 Thread Zeng, Star
Reviewed-by: Star Zeng 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Zhang 
Lubo
Sent: Friday, July 8, 2016 3:51 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting ; Fu, Siyuan ; Wu, Jiaxin 

Subject: [edk2] [patch] NetworkPkg: Fix Assert issue in iSCSI driver.

The bug existed in replacing AsciiStrToUnicodeStr with AsciiStrToUnicodeStrS, 
since MacString now is a pointer, the value sizeof(MacString)/sizeof 
(MacString[0]) is not correct here as the third parameter.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/IScsiDxe/IScsiConfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c 
b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 8015e3d..3631e72 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -685,11 +685,11 @@ IScsiConvertIfrNvDataToAttemptConfigData (
   MacString = (CHAR16 *) AllocateZeroPool (ISCSI_MAX_MAC_STRING_LEN * sizeof 
(CHAR16));
   if (MacString == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
 
-  AsciiStrToUnicodeStrS (Attempt->MacString, MacString, sizeof (MacString) / 
sizeof (MacString[0]));
+  AsciiStrToUnicodeStrS (Attempt->MacString, MacString, 
+ ISCSI_MAX_MAC_STRING_LEN);
 
   UnicodeSPrint (
 mPrivate->PortString,
 (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
 L"MAC: %s, PFA: Bus %d | Dev %d | Func %d, iSCSI mode: %s, IP version: %s",
--
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V2 0/7] Introduce three new toolchains in edk2

2016-07-08 Thread Ard Biesheuvel
On 8 July 2016 at 04:37, Shi, Steven  wrote:
> Hi Ard,
> I've put v2 in the subject and change the branch name to 
> https://github.com/shijunjing/edk2/commits/llvm_v2 . You can review all my 
> serial patches in the branch link, and let me know if you need me send the 
> patches in the mail list again.
>

Yes, I need you to send the patches to the mailing list. You must
always send the patches to the mailing list, so no need to even ask.

Thanks,
Ard.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 13/14] OvmfPkg: Fix typos in comments

2016-07-08 Thread Laszlo Ersek
On 07/08/16 08:21, Giri P Mudusuru wrote:
>   - accessibla to accessible
>   - exeuction to execution
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Giri P Mudusuru 
> ---
>  OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 6 +++---
>  OvmfPkg/VirtioBlkDxe/VirtioBlk.h | 4 ++--
>  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c | 4 ++--
>  OvmfPkg/XenIoPciDxe/XenIoPciDxe.c| 4 ++--
>  4 files changed, 9 insertions(+), 9 deletions(-)

Reviewed-by: Laszlo Ersek 

Commit 694673c9108f.

Thanks!
Laszlo


> diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c 
> b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
> index f1c3f87..3ce7228 100644
> --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
> +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.c
> @@ -11,7 +11,7 @@
>  synchronous requests and EFI_BLOCK_IO_PROTOCOL for now.
>  
>Copyright (C) 2012, Red Hat, Inc.
> -  Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.
> +  Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
>  
>This program and the accompanying materials are licensed and made available
>under the terms and conditions of the BSD License which accompanies this
> @@ -890,7 +890,7 @@ VirtioBlkExitBoot (
>  
>After we've pronounced support for a specific device in
>DriverBindingSupported(), we start managing said device (passed in by the
> -  Driver Exeuction Environment) with the following service.
> +  Driver Execution Environment) with the following service.
>  
>See DriverBindingSupported() for specification references.
>  
> @@ -905,7 +905,7 @@ VirtioBlkExitBoot (
>  
>@retval EFI_SUCCESS   Driver instance has been created and
>  initialized  for the virtio-blk device, it
> -is now accessibla via EFI_BLOCK_IO_PROTOCOL.
> +is now accessible via EFI_BLOCK_IO_PROTOCOL.
>  
>@retval EFI_OUT_OF_RESOURCES  Memory allocation failed.
>  
> diff --git a/OvmfPkg/VirtioBlkDxe/VirtioBlk.h 
> b/OvmfPkg/VirtioBlkDxe/VirtioBlk.h
> index ca4b7a0..6c402ca 100644
> --- a/OvmfPkg/VirtioBlkDxe/VirtioBlk.h
> +++ b/OvmfPkg/VirtioBlkDxe/VirtioBlk.h
> @@ -96,7 +96,7 @@ VirtioBlkDriverBindingSupported (
>  
>After we've pronounced support for a specific device in
>DriverBindingSupported(), we start managing said device (passed in by the
> -  Driver Exeuction Environment) with the following service.
> +  Driver Execution Environment) with the following service.
>  
>See DriverBindingSupported() for specification references.
>  
> @@ -111,7 +111,7 @@ VirtioBlkDriverBindingSupported (
>  
>@retval EFI_SUCCESS   Driver instance has been created and
>  initialized  for the virtio-blk device, it
> -is now accessibla via EFI_BLOCK_IO_PROTOCOL.
> +is now accessible via EFI_BLOCK_IO_PROTOCOL.
>  
>@retval EFI_OUT_OF_RESOURCES  Memory allocation failed.
>  
> diff --git a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c 
> b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c
> index 25b06fc..bc4f6fe 100644
> --- a/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c
> +++ b/OvmfPkg/VirtioPciDeviceDxe/VirtioPciDevice.c
> @@ -3,7 +3,7 @@
>This driver produces Virtio Device Protocol instances for Virtio PCI 
> devices.
>  
>Copyright (C) 2012, Red Hat, Inc.
> -  Copyright (c) 2012, Intel Corporation. All rights reserved.
> +  Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
>Copyright (C) 2013, ARM Ltd.
>  
>This program and the accompanying materials are licensed and made available
> @@ -393,7 +393,7 @@ VirtioPciUninit (
>  
>After we've pronounced support for a specific device in
>DriverBindingSupported(), we start managing said device (passed in by the
> -  Driver Exeuction Environment) with the following service.
> +  Driver Execution Environment) with the following service.
>  
>See DriverBindingSupported() for specification references.
>  
> diff --git a/OvmfPkg/XenIoPciDxe/XenIoPciDxe.c 
> b/OvmfPkg/XenIoPciDxe/XenIoPciDxe.c
> index c205cf7..15803eb 100644
> --- a/OvmfPkg/XenIoPciDxe/XenIoPciDxe.c
> +++ b/OvmfPkg/XenIoPciDxe/XenIoPciDxe.c
> @@ -3,7 +3,7 @@
>Driver for the virtual Xen PCI device
>  
>Copyright (C) 2012, Red Hat, Inc.
> -  Copyright (c) 2012, Intel Corporation. All rights reserved.
> +  Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.
>Copyright (C) 2013, ARM Ltd.
>Copyright (C) 2015, Linaro Ltd.
>  
> @@ -123,7 +123,7 @@ XenIoPciDeviceBindingSupported (
>  
>After we've pronounced support for a specific device in
>DriverBindingSupported(), we start managing said device (passed in by the
> -  Driver Exeuction Environment) with the following service.
> +  Driver Execution Environment) with the following service.
>  
>See DriverBindingSupported() for specific

Re: [edk2] [patch] NetworkPkg: Fix Assert issue in iSCSI driver.

2016-07-08 Thread Wu, Jiaxin
Reviewed-By: Wu Jiaxin 

Best Regards!
Jiaxin

> -Original Message-
> From: Zhang, Lubo
> Sent: Friday, July 8, 2016 3:51 PM
> To: edk2-devel@lists.01.org
> Cc: Fu, Siyuan ; Ye, Ting ; Wu,
> Jiaxin 
> Subject: [patch] NetworkPkg: Fix Assert issue in iSCSI driver.
> 
> The bug existed in replacing AsciiStrToUnicodeStr with AsciiStrToUnicodeStrS,
> since MacString now is a pointer, the value sizeof(MacString)/sizeof
> (MacString[0]) is not correct here as the third parameter.
> 
> Cc: Fu Siyuan 
> Cc: Ye Ting 
> Cc: Wu Jiaxin 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo 
> ---
>  NetworkPkg/IScsiDxe/IScsiConfig.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c
> b/NetworkPkg/IScsiDxe/IScsiConfig.c
> index 8015e3d..3631e72 100644
> --- a/NetworkPkg/IScsiDxe/IScsiConfig.c
> +++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
> @@ -685,11 +685,11 @@ IScsiConvertIfrNvDataToAttemptConfigData (
>MacString = (CHAR16 *) AllocateZeroPool (ISCSI_MAX_MAC_STRING_LEN *
> sizeof (CHAR16));
>if (MacString == NULL) {
>  return EFI_OUT_OF_RESOURCES;
>}
> 
> -  AsciiStrToUnicodeStrS (Attempt->MacString, MacString, sizeof (MacString)
> / sizeof (MacString[0]));
> +  AsciiStrToUnicodeStrS (Attempt->MacString, MacString,
> + ISCSI_MAX_MAC_STRING_LEN);
> 
>UnicodeSPrint (
>  mPrivate->PortString,
>  (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
>  L"MAC: %s, PFA: Bus %d | Dev %d | Func %d, iSCSI mode: %s, IP
> version: %s",
> --
> 1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [patch] NetworkPkg: Fix Assert issue in iSCSI driver.

2016-07-08 Thread Zhang Lubo
The bug existed in replacing AsciiStrToUnicodeStr with AsciiStrToUnicodeStrS,
since MacString now is a pointer, the value sizeof(MacString)/sizeof 
(MacString[0])
is not correct here as the third parameter.

Cc: Fu Siyuan 
Cc: Ye Ting 
Cc: Wu Jiaxin 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo 
---
 NetworkPkg/IScsiDxe/IScsiConfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NetworkPkg/IScsiDxe/IScsiConfig.c 
b/NetworkPkg/IScsiDxe/IScsiConfig.c
index 8015e3d..3631e72 100644
--- a/NetworkPkg/IScsiDxe/IScsiConfig.c
+++ b/NetworkPkg/IScsiDxe/IScsiConfig.c
@@ -685,11 +685,11 @@ IScsiConvertIfrNvDataToAttemptConfigData (
   MacString = (CHAR16 *) AllocateZeroPool (ISCSI_MAX_MAC_STRING_LEN * sizeof 
(CHAR16));
   if (MacString == NULL) {
 return EFI_OUT_OF_RESOURCES;
   }
 
-  AsciiStrToUnicodeStrS (Attempt->MacString, MacString, sizeof (MacString) / 
sizeof (MacString[0]));
+  AsciiStrToUnicodeStrS (Attempt->MacString, MacString, 
ISCSI_MAX_MAC_STRING_LEN);
 
   UnicodeSPrint (
 mPrivate->PortString,
 (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
 L"MAC: %s, PFA: Bus %d | Dev %d | Func %d, iSCSI mode: %s, IP version: %s",
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] UefiCpuPkg/CpuDxe: StartupAllAPs in parallel mode

2016-07-08 Thread Jeff Fan
SetMemoryAttributes() will sync BSP's MTRRs settings to all APs by StartupAllAPs
service in serial mode. It may caused much performance impact if there are too
much processors in system. This update is to invoke StartupAllAps in parallel
mode. IA32 SDM does suggest to program MTRRs in parallel mode.

Cc: Michael Kinney 
Cc: Feng Tian 
Cc: Laszlo Ersek 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
Reviewed-by: Feng Tian 
---
 UefiCpuPkg/CpuDxe/CpuDxe.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
index daf97bd..78b2c88 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -1,7 +1,7 @@
 /** @file
   CPU DXE Module.
 
-  Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.
+  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -422,7 +422,7 @@ CpuSetMemoryAttributes (
   MpStatus = MpService->StartupAllAPs (
   MpService,  // This
   SetMtrrsFromBuffer, // Procedure
-  TRUE,   // SingleThread
+  FALSE,  // SingleThread
   NULL,   // WaitEvent
   0,  // TimeoutInMicrosecsond
   &MtrrSettings,  // ProcedureArgument
-- 
2.7.4.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Intel FSP Firmware Volume content

2016-07-08 Thread Mudusuru, Giri P
Hi Marvin, Rafael,

Thank you for your studies on FSP. 

FSP is a self-contained binary. Since the silicon code implementation is based 
on edk2, some modules are redundant like PeiCore, DxeIpl as Rafael explained 
below (Thanks Rafael). 
While it is redundant, it is a small price to make FSP binary pluggable into 
different bootloaders (EDK2, Coreboot etc...)

Also entire FSP is implemented in PEI phase and DXE code is built in Dual mode 
(DXE and PEI for FSP) which is why you see *DxeFsp

Hope this clarifies your questions

Thanks and Regards,
-Giri

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Rafael
> Machado
> Sent: Thursday, July 7, 2016 4:31 AM
> To: Marvin H?user ; edk2-devel@lists.01.org
> Cc: Yao, Jiewen 
> Subject: Re: [edk2] Intel FSP Firmware Volume content
> 
> Hi Marvin
> 
> I'm also starting my studies on FSP, but I think I can help with at least
> one of the questions.
> About the two Sec cores.
> 
> The existence of two sec cores represents what is called "FSP Normal Boot"
> There is the main sec core, and another sec core that is placed inside the
> FspInitPei. They communicate to each other so the needed information is
> passed correctly.
> 
> Each sec core has it's responsibilities, so they don't do the same thing.
> 
> Hope this can help you to find more information.
> 
> Thanks and Regards
> Rafael R. Machado
> 
> 
> 
> Em qua, 6 de jul de 2016 às 20:40, Marvin H?user
> 
> escreveu:
> 
> > Dear EDK2 community members,
> >
> > Recently, I have gained interest in the Intel FSP and have been reading
> > the Intel documents regarding its design and integration with EDK2.
> > In the white paper 'A Tour Beyond BIOS Using the Intel(r) Firmware Support
> > Package with the EFI Developer Kit II', the chapter 'FSP Wrapper Boot Flow'
> > mentions different ways of how SecCore and following can interact with FSP.
> > This, in my opinion, implies that SecCore is present in source-form (likely
> > IntelFspWrapperPkg/FspWrapperSecCore), while the actual silicon
> > initialization is of course within the FSP binary. This is how I understood
> > it and thought it made sense.
> > However, when I opened a few of the FSP Firmware Volume files, I
> > discovered that it did not only have the FSP header and initialization
> > PEIMs/drivers, but also SecCore, PeiCore and FspDxeIpl embedded. For what
> > reason are these generic modules embedded? Until discovering them within
> > the image, I had assumed these would be provided by the consumer package.
> > To better understand the creation and consumption of Intel FSP, I have
> > looked at Quark and Braswell Reference Codes provided within the
> > edk2-platforms tree. BraswellPlatformPkg, which consumes BSWFSP.fd that
> has
> > SecCore embedded, also consumes FspWrapperSecCore (seen here:
> > https://github.com/tianocore/edk2-platforms/blob/pentium-celeron-n-
> udk2015/BraswellPlatformPkg/PlatformPkg.fdf#L387)
> > from the source tree. If I am not mistaken, building it would end up having
> > SecCore duplicated - once as part of the FSP volume (binary) and once
> > within the FVRECOVERY volume (source). As SecCore includes the Reset
> > Vector, wouldn't one of the two be obsolete as it would never be invoked?
> > The same applies to PeiCore and a few other generic modules which are part
> > oft he chain.
> >
> > Furthermore, a couple of modules that have 'Dxe' in their name are
> > declared as PEI module in their FFS header, for example 'PchInitDxeFsp'. I
> > have observed this in all FSP version I have looked at, including Braswell,
> > Broadwell and Ivy Bridge. Is there any special reason for that? Is it
> > because the FSP initialization code is what has them loaded and called, so
> > it doesn't matter?
> >
> > Please forgive me for my ignorance and thank you in advance for your time!
> >
> > Best regards,
> > Marvin.
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
> >
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel