Re: [edk2] [PATCH 0/9] first round of proposed fixups for "add support for AArch64 QEMU/KVM v6"

2014-09-03 Thread Ard Biesheuvel
On 4 September 2014 04:09, Laszlo Ersek  wrote:
> Hi Ard,
>
> I started to review your v6 patchset in reverse order -- I first created
> a map between your v5 and v6 patches (as much as it was possible), then
> started to look at the DSC file(s) first. The requirement to dynamically
> determine the UART base address from the DTB is a very intrusive one,
> unfortunately. So, the first thing that caught my eye was the various
> new instances of the SerialPortLib class.
>
> As we discussed on #linaro-enterprise, "EarlyFdtPL011SerialPortLib" is
> not appropriate for DXE_CORE, because it accesses the initial copy of
> the DTB (at the bottom of the system DRAM), and at that point, when the
> DXE_CORE is already running, that memory area is no longer protected
> (because we decided to relocate it instead of protecting it in-place).
>
> So, I didn't get very far in the v6 review, but I do think I can propose
> an improvement for the DXE_CORE's serial port library. Please see the
> following patches.
>

Looks great, thanks! I will look in more detail later today, but one
thing comes to mind already:
since the PcdGet() call in the constructor of the ordinary FdtPL011
library is causing dependency hell and the need for a cloned
UefiBootServicesTableLib, is there any reason we can't use your
DXE_CORE version for *all* stages after DXE_CORE as well? Getting the
base address from a HOB and caching it doesn't seem more heavy weight
than getting it from a Dynamic PCD, and it would allow us to drop some
of the nasty stuff.


> I sought to separate these patches out in such a way that you can review
> them easily, and more importantly, apply them on top of your v6 tree,
> then rebase the entire thing, and *squash* my patches into your patches.
> It should be obvious for each one of mine which one of yours it should
> be squashed into, purely from the paths in each patch.
>

I will try to send out v7 by noon tomorrow, thanks

Cheers,
Ard.



> As a summary, with these "fixups" applied, we have the following
> situation (marking where the "fixups" make a difference relative to your
> v6):
>
> (1) In SEC:
> - code runs from flash
> - code uses temporary RAM only
> - qemu's DTB is protected (distinct from temp RAM)
> - SerialPortLib ("EarlyFdt" variant) parses QEMU's original DTB for
>   each write call (because it cannot store the UART base anywhere,
>   as state)
> - PCDs are unavailable
> - HOBs are unavailable (HobLib definitely)
> - the SEC half or ArmVirtualizationPlatformLib, ie. function
>   ArmPlatformInitialize(), only asserts
>   !PcdSystemMemoryInitializeInSec
>
> (2) In PEI, while on temporary RAM (covering PEI_CORE and PEIMs):
> - code runs from flash
> - code uses temporary RAM only
> - qemu's DTB is protected (distinct from temp RAM)
> - SerialPortLib ("EarlyFdt" variant) parses QEMU's original DTB for
>   each write call (because it cannot store the UART base anywhere,
>   as state)
> - the PCD database is available, in a HOB, located in temp RAM,
> - HOBs are available, in temp RAM,
> - the PEI half of ArmVirtualizationPlatformLib, ie. function
>   ArmPlatformInitializeSystemMemory(), running as part of
>   MemoryInitPeim, does the following:
>   - parses QEMU's DTB,
>   - saves the DRAM size in the dynamic PcdSystemMemorySize,
>   - saves the UART base in the dynamic PcdPL011BaseAddress,
>   - saves the UART base address in a new, special HOB [CHANGE].
> (Note that in general we can't assume that this HOB would be
> available to any other PEIMs, especially not the PCD PEIM.)
> - once ArmPlatformInitializeSystemMemory() returns to
>   InitializeMemory(), in ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c:
>   - permanent PEI RAM is installed, based on PcdSystemMemorySize
>   - the PEI_CORE relocates itself to said perm RAM
>   - the HOB list and the PCD database are migrated to perm RAM
>
> (3) In PEI, while on permanent RAM (covering PEI_CORE and PEIMs):
> - code runs from flash
> - code uses permanent RAM
> - qemu's DTB is protected (distinct from perm RAM)
> - SerialPortLib ("EarlyFdt" variant) still parses QEMU's original
>   DTB for each write call. Maybe this could be optimized, but it is
>   good enough for the rest of PEI, so DO NOT TOUCH IT. :)
> - the PCD database is available in perm RAM
> - HOBs are available in perm RAM,
> - ArmPlatformPkg/PlatformPei/PlatformPeim can now run (see the Depex
>   it inherits from our PlatformPeiLib instance), and in
>   PlatformPeim():
>   - it copies QEMU's DTB to a freshly allocated block in perm PEI
> RAM, setting the dynamic PcdDeviceTreeBaseAddress
>   - an FV HOB is built for the DXE IPL PEIM
>   - the original DTB is left in place for the rest of PEI
>
> (4) DXE_CORE
> - code has been decompressed and runs from RAM
> - code uses the entirety of the syst

Re: [edk2] [PATCH] MdePkg NASM Thunk16: Work around NASM 2.09.04 - 2.10rc1 bug

2014-09-03 Thread Gao, Liming
Jordan:
  The patch is good.  Reviewed-by: Gao, Liming 

  Please commit this patch. 

Thanks
Liming
-Original Message-
From: Jordan Justen [mailto:jordan.l.jus...@intel.com] 
Sent: Thursday, September 04, 2014 1:33 AM
To: edk2-devel@lists.sourceforge.net
Cc: Mike Maslenkin
Subject: [edk2] [PATCH] MdePkg NASM Thunk16: Work around NASM 2.09.04 - 2.10rc1 
bug

Without this change, NASM 2.09.04 will hang with OVMF+CSM on both IA32 and X64.

Tested on OVMF+CSM on GCC49 with NASM 2.07, 2.09.04 and 2.11.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Mike Maslenkin 
---
 MdePkg/Library/BaseLib/Ia32/Thunk16.nasm | 6 +-  
MdePkg/Library/BaseLib/X64/Thunk16.nasm  | 6 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm 
b/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
index e8468a3..e3d0d4e 100644
--- a/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
+++ b/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
@@ -85,7 +85,11 @@ _BackFromUserCode:
 BITS16
 pushss
 pushcs
-o32 calldword .Base ; push eip
+;
+; Note: We can't use o32 on the next instruction because of a bug
+; in NASM 2.09.04 through 2.10rc1.
+;
+calldword .Base ; push eip
 .Base:
 pushfd
 cli ; disable interrupts
diff --git a/MdePkg/Library/BaseLib/X64/Thunk16.nasm 
b/MdePkg/Library/BaseLib/X64/Thunk16.nasm
index 6084fac..7c4a8d3 100644
--- a/MdePkg/Library/BaseLib/X64/Thunk16.nasm
+++ b/MdePkg/Library/BaseLib/X64/Thunk16.nasm
@@ -83,7 +83,11 @@ _BackFromUserCode:
 BITS16
 pushss
 pushcs
-o32 calldword .Base ; push eip
+;
+; Note: We can't use o32 on the next instruction because of a bug
+; in NASM 2.09.04 through 2.10rc1.
+;
+calldword .Base ; push eip
 .Base:
 pushdword 0 ; reserved high order 32 bits of EFlags
 pushfd
--
2.1.0


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to MdeModulePkg

2014-09-03 Thread Ni, Ruiyu
Jaben,
Do you agree to rename PathCleanUpDirectories to PathNormalize?

Thanks,
Ray

-Original Message-
From: Olivier Martin [mailto:olivier.mar...@arm.com] 
Sent: Wednesday, September 03, 2014 11:27 PM
To: edk2-devel@lists.sourceforge.net; Ni, Ruiyu; Tian, Feng
Cc: Ronald Cron; Carsey, Jaben
Subject: RE: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to MdeModulePkg

Ruiyi/Feng, any update on this one?

Now people are porting file system to EDK2, exposing this library to a
common package (instead of ShellPkg) could avoid code duplication across the
repository.

The reason I am pinging this thread is that we are actually looking at
removing some of our code duplication in some of our file system protocol
implementations using this library.

> -Original Message-
> From: Olivier Martin [mailto:olivier.mar...@arm.com]
> Sent: 15 August 2014 09:40
> To: 'Ni, Ruiyu'; edk2-devel@lists.sourceforge.net; Tian, Feng
> Cc: Brendan Jackman
> Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> MdeModulePkg
> 
> I am quite happy to make some change to this library if Jaben agrees
> with
> this change. But this patch only moves the existing BasePathLib from
> one
> package to another one.
> 
> Olivier
> 
> > -Original Message-
> > From: Ni, Ruiyu [mailto:ruiyu...@intel.com]
> > Sent: 15 August 2014 06:23
> > To: edk2-devel@lists.sourceforge.net; Tian, Feng; Olivier Martin
> > Cc: Brendan Jackman
> > Subject: RE: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> > MdeModulePkg
> >
> > I think maybe PathCleanUpDirectories is not a good name to describe
> > this API's behavior. It's a API to normalize the file path but do
> > nothing to the directory content. Would "PathNormalize" be better?
> >
> > -Original Message-
> > From: Carsey, Jaben [mailto:jaben.car...@intel.com]
> > Sent: Friday, August 15, 2014 4:41 AM
> > To: edk2-devel@lists.sourceforge.net; Tian, Feng; Olivier Martin
> > (olivier.mar...@arm.com)
> > Cc: Brendan Jackman
> > Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> > MdeModulePkg
> >
> > Reviewed-by: Jaben Carsey 
> >
> > I didn't notice this email originally. I think that this looks like a
> > good change.  What other feedback are you hoping for?
> >
> > -Jaben
> >
> >
> > > -Original Message-
> > > From: Olivier Martin [mailto:olivier.mar...@arm.com]
> > > Sent: Thursday, August 14, 2014 12:06 PM
> > > To: edk2-devel@lists.sourceforge.net; Tian, Feng
> > > Cc: Brendan Jackman
> > > Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> > > MdeModulePkg
> > >
> > > Any feedback on this one?
> > >
> > > Thanks,
> > > Olivier
> > >
> > > > -Original Message-
> > > > From: Olivier Martin [mailto:olivier.mar...@arm.com]
> > > > Sent: 24 March 2014 20:23
> > > > To: feng.t...@intel.com
> > > > Cc: Brendan Jackman; edk2-devel@lists.sourceforge.net
> > > > Subject: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> > > > MdeModulePkg
> > > >
> > > > From: Brendan Jackman 
> > > >
> > > > This library is useful to other modules than the shell - for
> > example
> > > > filesystem drivers.
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > > Signed-off-by: Brendan Jackman 
> > > > Reviewed-by: Olivier Martin 
> > > > ---
> > > >  AppPkg/AppPkg.dsc|   2 +-
> > > >  EmulatorPkg/EmulatorPkg.dsc  |   2 +-
> > > >  MdeModulePkg/Include/Library/PathLib.h   |  56
> +++
> > > >  MdeModulePkg/Library/BasePathLib/BasePathLib.c   | 123
> > > > +++
> > > >  MdeModulePkg/Library/BasePathLib/BasePathLib.inf |  38 +++
> > > >  OvmfPkg/OvmfPkgIa32.dsc  |   2 +-
> > > >  OvmfPkg/OvmfPkgIa32X64.dsc   |   2 +-
> > > >  OvmfPkg/OvmfPkgX64.dsc   |   2 +-
> > > >  ShellPkg/Include/Library/PathLib.h   |  56 -
> --
> > > >  ShellPkg/Library/BasePathLib/BasePathLib.c   | 123 -
> --
> > 
> > > > 
> > > >  ShellPkg/Library/BasePathLib/BasePathLib.inf |  38 ---
> > > >  ShellPkg/ShellPkg.dsc|   2 +-
> > > >  StdLib/StdLib.dsc|   2 +-
> > > >  StdLib/StdLib.inc|   2 +-
> > > >  14 files changed, 225 insertions(+), 225 deletions(-)  create
> mode
> > > > 100644 MdeModulePkg/Include/Library/PathLib.h
> > > >  create mode 100644
> MdeModulePkg/Library/BasePathLib/BasePathLib.c
> > > >  create mode 100644
> > MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > > >  delete mode 100644 ShellPkg/Include/Library/PathLib.h
> > > >  delete mode 100644 ShellPkg/Library/BasePathLib/BasePathLib.c
> > > >  delete mode 100644 ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > >
> > > > diff --git a/AppPkg/AppPkg.dsc b/AppPkg/AppPkg.dsc index
> > > > d0aac2c..491332a 100644
> > > > --- a/AppPkg/AppPkg.dsc
> > > > +++ b/AppPk

Re: [edk2] [edk2-buildtools] Tianocore.org wiki performance issues

2014-09-03 Thread Bruce Cran
I was wondering if anyone had considered using something like Phabricator (
http://phabricator.org/) to bring the various services (wiki, code etc.)
together again?  Since it includes wiki, code review, bug tracker,
repository browser etc. it could provide a single, integrated site where it
might be easier to find information.

-- 
Bruce

On Thu, Jul 24, 2014 at 11:43 AM, Jarlstrom, Laurie <
laurie.jarlst...@intel.com> wrote:

>  Another update:
>
> Also I have noticed that if you are behind a firewall that the Sourceforge
> tianocore  wiki is
> substantially slower.
>
> I have had best results with the Firefox browser and with proxy settings
> as set up to being used behind a fire wall.
>
> This is still slower than the tianocore Github
>  wiki but much better than some of the other
> browsers also having their proxy settings set accordingly.
>
>
>
>
>
> thanks,
>
> Laurie
>
>
>
> laurie.jarlst...@intel.com
>
> *EFI / Framework Technical *
>
> *Marketing Engineering Team*
>
> *(503) 712-9395*
>
> *From:* Jarlstrom, Laurie
> *Sent:* Wednesday, July 16, 2014 11:45 AM
> *To:* Jarlstrom, Laurie; edk2-devel@lists.sourceforge.net;
> edk2-buildtools-de...@lists.sourceforge.net
> *Subject:* RE: [edk2-buildtools] Tianocore.org wiki performance issues
>
>
>
> Please note that github does not work with IE 7 or 8.
>
> You will get an error message from that bowser
>
>
>
>
>
> *Please note that GitHub no longer supports Internet Explorer versions 7
> or 8.*
>
> We recommend upgrading to the latest Internet Explorer
> , Google Chrome
> , or Firefox .
>
> If you are using IE 9 or later, make sure you turn off "Compatibility
> View"
> 
> .
>
>
>
>
>
> thanks,
>
> Laurie
>
>
>
> laurie.jarlst...@intel.com
>
> *EFI / Framework Technical *
>
> *Marketing Engineering Team*
>
> *(503) 712-9395*
>
> *From:* Jarlstrom, Laurie [mailto:laurie.jarlst...@intel.com
> ]
> *Sent:* Wednesday, July 16, 2014 11:27 AM
> *To:* edk2-devel@lists.sourceforge.net;
> edk2-buildtools-de...@lists.sourceforge.net
> *Subject:* [edk2-buildtools] Tianocore.org wiki performance issues
>
>
>
> All,
>
> The github wiki pages  http://tianocore.github.io/  have much better
> performance than the Sourceforge wiki pages.  Please use the github link
>  for now unless you find a link that is missing or not correct.
>
>
>
> There is a link on the main htttp://tianocore.org  page to goto the
> github link.
>
>
>
> The Projects
>  link (on
> the upper right with Google Chrome) of the main github page can help you
> traverse through though the same links from the Sourceforge wiki pages.
>
>
>
> Meanwhile the Sourceforge mediawiki is still available and we will be
> maintaining a both for now.
>
>
>
> Thanks to Jordan for getting the github wiki up in place.
>
>
>
> thanks,
>
> Laurie
>
>
>
> laurie.jarlst...@intel.com
>
> *EFI / Framework Technical *
>
> *Marketing Engineering Team*
>
> *(503) 712-9395*
>
>
> --
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> ___
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>
>


-- 
-- 
Bruce Cran
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] TCG Physical Presence equates

2014-09-03 Thread Dong, Guo

I know there are some common in these 2 head files. But I still don't see much 
benefit to combine them together.
Put them in different header file:

1)  TPM 2.0 specification is new. It is easy to maintain the header file if 
spec is updated.

2)  For usage, user doesn't need to know the header file for TPM 1.2 if 
only TPM 2.0 chip is used.

3)  If TPM1.2 chip is deprecated after some years, we don't need to update 
TPM 2.0 related files.

Thanks,
Guo
From: Anbazhagan, Baraneedharan [mailto:anbazha...@hp.com]
Sent: Wednesday, September 03, 2014 5:49 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] TCG Physical Presence equates

Physical Presence Interface section of below MSFT link indicates that it's 
based on TCG specification. In the current code TrEEHaveValidTpmRequest & 
HaveValidTpmRequest filters the commands accordingly. Thanks.

-Baranee

From: Dong, Guo [mailto:guo.d...@intel.com]
Sent: Tuesday, September 02, 2014 10:32 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] TCG Physical Presence equates

Hi Baranee,

PhysicalPresenceData.h is based on TCG specification and used for TPM1.2.
TrEEPhysicalPresenceData.h is based on MSFT specification 
(http://msdn.microsoft.com/en-us/library/windows/hardware/jj923067.aspx) and 
used for TPM2.0.
So it is not necessary to put them together.

Thanks,
Guo

From: Anbazhagan, Baraneedharan [mailto:anbazha...@hp.com]
Sent: Wednesday, September 03, 2014 4:21 AM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] TCG Physical Presence equates

SecurityPkg maintainers,
Can we have a common header file based on TCG PPI specification for both TPM1.2 
and TPM2 instead of defining equates in PhysicalPresenceData.h and 
TrEEPhysicalPresenceData.h?

-Baranee

CONFIDENTIALITY NOTICE: The information contained in this e-mail and any 
accompanying documents may contain information which is HP confidential or 
otherwise protected from disclosure. This transmission may also be protected by 
the attorney-client privilege, the attorney work-product privilege, or both. If 
you are not the intended recipient of this message, or if this message has been 
addressed to you in error, please immediately alert the sender by reply e-mail 
and then delete this message, including any attachments. Any dissemination, 
distribution or other use of the contents of this message by anyone other than 
the intended recipient is strictly prohibited.

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] The DXE Core does not link with Xcode 5 for IA32

2014-09-03 Thread Gao, Liming
Andrew:
  The original code is "while (Counter > 0x) {", we meet with the same 
issue in UNIXGCC tool chain. So, we change the code to "while ((Counter & 
0xULL) != 0) {".  Now, you meet with this issue again in XCODE 
tool chain. The possible fix is to use BaseLib API. The code could be changed 
to "while (RShiftU64 (Counter, 32) > 0) {"

Thanks
Liming
From: Andrew Fish [mailto:af...@apple.com]
Sent: Thursday, September 04, 2014 8:07 AM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] The DXE Core does not link with Xcode 5 for IA32

It looks like the 64-bit bit wise and operation is causing the compiler to emit 
an __umoddi3 I'm looking into to how to work around this issue.

>build -p MdeModulePkg/MdeModulePkg.dsc -a IA32 -t XCODE5 -n 1

Building ... /Users/andrewfish/work/src/edk2/MdeModulePkg/Core/Dxe/DxeMain.inf 
[IA32]
"ld" -arch i386 -u __ModuleEntryPoint -e __ModuleEntryPoint -preload -segalign 
0x20 -pie -all_load -dead_strip -seg1addr 0x240 -read_only_relocs suppress -map 
/Users/andrewfish/work/src/edk2/Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.map
 -o 
/Users/andrewfish/work/src/edk2/Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll
  -filelist 
/Users/andrewfish/work/src/edk2/Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/static_library_files.lst
Undefined symbols for architecture i386:
  "___umoddi3", referenced from:
  _CoreInternalWaitForTick in DxeCore.lib(Stall.obj)

~/work/src/edk2(master)>otool -tvV 
Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/Misc/Stall.obj
Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/Misc/Stall.obj:
(__TEXT,__text) section
_CoreInternalWaitForTick:
pushl   %ebp
0001movl%esp, %ebp
0003pushl   %ebx
0004pushl   %edi
0005pushl   %esi
0006subl $0x1c, %esp
0009movl0x683, %eax
000emovl_CoreInternalWaitForTick(%eax), %esi
0010movl_CoreInternalWaitForTick(%esi), %ecx
0012movl0x8(%ebp), %ebx
0015movl0xc(%ebp), %edi
0018testl  %edi, %edi
001aje 0x6e
001cmovl%ecx, -0x10(%ebp)
001f leal   -0x1(%edi), %eax
0022movl%ebx, _CoreInternalWaitForTick(%esp)
0025movl%eax, 0x4(%esp)
0029movl$_CoreInternalWaitForTick, 0xc(%esp)
0031movl$0x, 0x8(%esp)
0039calll  ___umoddi3

~/work/src/edk2(master)>lldb  
Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/Misc/Stall.obj
Current executable set to 
'Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/Misc/Stall.obj'
 (i386).
(lldb) dis -b -m -n CoreInternalWaitForTick
Stall.obj`CoreInternalWaitForTick at Stall.c:34
   33   )
   34 {
   35   while ((Counter & 0xULL) != 0) {
Stall.obj[0x0]:  55   pushl  %ebp
Stall.obj[0x1]:  89 e5movl   %esp, %ebp
Stall.obj`CoreInternalWaitForTick + 3 at Stall.c:36
   35   while ((Counter & 0xULL) != 0) {
   36 gMetronome->WaitForTick (gMetronome, 0x);
   37 Counter -= 0x;
Stall.obj[0x3]:  53   pushl  %ebx
Stall.obj[0x4]:  57   pushl  %edi
Stall.obj[0x5]:  56   pushl  %esi
Stall.obj[0x6]:  83 ec 1c subl   $0x1c, %esp
Stall.obj[0x9]:  a1 83 06 00 00   movl   0x683, %eax
Stall.obj[0xe]:  8b 30movl   (%eax), %esi
Stall.obj[0x10]:  8b 0emovl   (%esi), %ecx
Stall.obj[0x12]:  8b 5d 08 movl   0x8(%ebp), %ebx
Stall.obj[0x15]:  8b 7d 0c movl   0xc(%ebp), %edi
Stall.obj[0x18]:  85 fftestl  %edi, %edi
Stall.obj[0x1a]:  74 52je 0x6e  ; 
CoreInternalWaitForTick + 110 at Stall.c:39
Stall.obj[0x1c]:  89 4d f0 movl   %ecx, -0x10(%ebp)
Stall.obj`CoreInternalWaitForTick + 31 at Stall.c:35
   34 {
   35   while ((Counter & 0xULL) != 0) {
   36 gMetronome->WaitForTick (gMetronome, 0x);
Stall.obj[0x1f]:  8d 47 ff leal   -0x1(%edi), %eax
Stall.obj[0x22]:  89 1c 24 movl   %ebx, (%esp)
Stall.obj[0x25]:  89 44 24 04  movl   %eax, 0x4(%esp)
Stall.obj[0x29]:  c7 44 24 0c 00 00 00 00  movl   $0x0, 0xc(%esp)
Stall.obj[0x31]:  c7 44 24 08 ff ff ff ff  movl   $0x, 0x8(%esp)
Stall.obj[0x39]:  e8 c2 ff ff ff   calll  

[edk2] [PATCH 0/9] first round of proposed fixups for "add support for AArch64 QEMU/KVM v6"

2014-09-03 Thread Laszlo Ersek
Hi Ard,

I started to review your v6 patchset in reverse order -- I first created
a map between your v5 and v6 patches (as much as it was possible), then
started to look at the DSC file(s) first. The requirement to dynamically
determine the UART base address from the DTB is a very intrusive one,
unfortunately. So, the first thing that caught my eye was the various
new instances of the SerialPortLib class.

As we discussed on #linaro-enterprise, "EarlyFdtPL011SerialPortLib" is
not appropriate for DXE_CORE, because it accesses the initial copy of
the DTB (at the bottom of the system DRAM), and at that point, when the
DXE_CORE is already running, that memory area is no longer protected
(because we decided to relocate it instead of protecting it in-place).

So, I didn't get very far in the v6 review, but I do think I can propose
an improvement for the DXE_CORE's serial port library. Please see the
following patches.

I sought to separate these patches out in such a way that you can review
them easily, and more importantly, apply them on top of your v6 tree,
then rebase the entire thing, and *squash* my patches into your patches.
It should be obvious for each one of mine which one of yours it should
be squashed into, purely from the paths in each patch.

As a summary, with these "fixups" applied, we have the following
situation (marking where the "fixups" make a difference relative to your
v6):

(1) In SEC:
- code runs from flash
- code uses temporary RAM only
- qemu's DTB is protected (distinct from temp RAM)
- SerialPortLib ("EarlyFdt" variant) parses QEMU's original DTB for
  each write call (because it cannot store the UART base anywhere,
  as state)
- PCDs are unavailable
- HOBs are unavailable (HobLib definitely)
- the SEC half or ArmVirtualizationPlatformLib, ie. function
  ArmPlatformInitialize(), only asserts
  !PcdSystemMemoryInitializeInSec

(2) In PEI, while on temporary RAM (covering PEI_CORE and PEIMs):
- code runs from flash
- code uses temporary RAM only
- qemu's DTB is protected (distinct from temp RAM)
- SerialPortLib ("EarlyFdt" variant) parses QEMU's original DTB for
  each write call (because it cannot store the UART base anywhere,
  as state)
- the PCD database is available, in a HOB, located in temp RAM,
- HOBs are available, in temp RAM,
- the PEI half of ArmVirtualizationPlatformLib, ie. function
  ArmPlatformInitializeSystemMemory(), running as part of
  MemoryInitPeim, does the following:
  - parses QEMU's DTB,
  - saves the DRAM size in the dynamic PcdSystemMemorySize,
  - saves the UART base in the dynamic PcdPL011BaseAddress,
  - saves the UART base address in a new, special HOB [CHANGE].
(Note that in general we can't assume that this HOB would be
available to any other PEIMs, especially not the PCD PEIM.)
- once ArmPlatformInitializeSystemMemory() returns to
  InitializeMemory(), in ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c:
  - permanent PEI RAM is installed, based on PcdSystemMemorySize
  - the PEI_CORE relocates itself to said perm RAM
  - the HOB list and the PCD database are migrated to perm RAM

(3) In PEI, while on permanent RAM (covering PEI_CORE and PEIMs):
- code runs from flash
- code uses permanent RAM
- qemu's DTB is protected (distinct from perm RAM)
- SerialPortLib ("EarlyFdt" variant) still parses QEMU's original
  DTB for each write call. Maybe this could be optimized, but it is
  good enough for the rest of PEI, so DO NOT TOUCH IT. :)
- the PCD database is available in perm RAM
- HOBs are available in perm RAM,
- ArmPlatformPkg/PlatformPei/PlatformPeim can now run (see the Depex
  it inherits from our PlatformPeiLib instance), and in
  PlatformPeim():
  - it copies QEMU's DTB to a freshly allocated block in perm PEI
RAM, setting the dynamic PcdDeviceTreeBaseAddress
  - an FV HOB is built for the DXE IPL PEIM
  - the original DTB is left in place for the rest of PEI

(4) DXE_CORE
- code has been decompressed and runs from RAM
- code uses the entirety of the system DRAM
- qemu's DTB is *not* protected (must be assumed lost)
- the "EarlyFdt" variant of SerialPortLib must not attempt to parse
  the original DTB as a consequence -- this is the problem in v6
- The relocated DTB is protected
- the PCD database is protected, but it is inaccessible, because the
  PPI (PEI driver) is not available any longer, and the protocol
  (DXE driver) is not available yet
- HOBs are protected and accessible (read-only) with HobLib
- therefore a new instance of SerialPortLib,
  DxeCorePL011SerialPortLibInitialize, is added that doesn't parse
  the old DTB (because that must be considered destroyed), doesn't
  use any dynamic PCDs (because those are unavailable, see above),
  instead it relies on the special HOB from step

[edk2] [PATCH 8/9] FdtPL011SerialPortLib: add DXE_CORE implementation

2014-09-03 Thread Laszlo Ersek
DXE_CORE is special because it can use
- neither the original, in-place DTB (since DXE_CORE itself reallocates
  that memory for DXE purposes),
- nor any dynamic PCDs (because the PCD PPI's are no more available, and
  the PCD protocol is not yet available).

Therefore we can only rely on the HOB where we stashed the UART base
address. Accordingly, the FdtLib dependency is replaced with a HobLib
dependency (relative to EarlyFdtPL011SerialPortLib), and so is the
PcdPL011BaseAddress dependency (relative to FdtPL011SerialPortLib).

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 .../DxeCorePL011SerialPortLib.inf  |  46 +++
 .../DxeCorePL011SerialPortLib.c| 142 +
 2 files changed, 188 insertions(+)
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/DxeCorePL011SerialPortLib.inf
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/DxeCorePL011SerialPortLib.c

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/DxeCorePL011SerialPortLib.inf
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/DxeCorePL011SerialPortLib.inf
new file mode 100644
index 000..19d9a1b
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/DxeCorePL011SerialPortLib.inf
@@ -0,0 +1,46 @@
+#/** @file
+#
+#  Component description file for DxeCorePL011SerialPortLib module
+#
+#  Copyright (c) 2011-2012, ARM Ltd. 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = DxeCorePL011SerialPortLib
+  FILE_GUID  = ED74F129-1287-4915-BA7A-1684A4C076F2
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = SerialPortLib|DXE_CORE
+  CONSTRUCTOR= DxeCorePL011SerialPortLibInitialize
+
+[Sources.common]
+  DxeCorePL011SerialPortLib.c
+
+[LibraryClasses]
+  PL011UartLib
+  PcdLib
+  HobLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+  ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec
+
+[FixedPcd]
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
+  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
+
+[Guids]
+  gEarlyPL011BaseAddressGuid
diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/DxeCorePL011SerialPortLib.c
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/DxeCorePL011SerialPortLib.c
new file mode 100644
index 000..3fbbf29
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/DxeCorePL011SerialPortLib.c
@@ -0,0 +1,142 @@
+/** @file
+  Serial I/O Port library functions with base address discovered from FDT
+
+  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
+  Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.
+  Copyright (c) 2014, Linaro Ltd. All rights reserved.
+  Copyright (c) 2014, Red Hat, Inc.
+
+  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.
+
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+UINTN mSerialBaseAddress;
+
+RETURN_STATUS
+EFIAPI
+SerialPortInitialize (
+  VOID
+  )
+{
+  return RETURN_SUCCESS;
+}
+
+RETURN_STATUS
+EFIAPI
+DxeCorePL011SerialPortLibInitialize (
+  VOID
+  )
+{
+  VOID*Hob;
+  CONST UINT64*UartBase;
+  UINT64  BaudRate;
+  UINT32  ReceiveFifoDepth;
+  EFI_PARITY_TYPE Parity;
+  UINT8   DataBits;
+  EFI_STOP_BITS_TYPE  StopBits;
+
+  Hob = GetFirstGuidHob (&gEarlyPL011BaseAddressGuid);
+  if (Hob == NULL || GET_GUID_HOB_DATA_SIZE (Hob) != sizeof *UartBase) {
+return RETURN_NOT_FOUND;
+  }
+  UartBase = GET_GUID_HOB_DATA (Hob);
+
+  mSerialBaseAddress = (UINTN)*UartBase;
+  if (mSerialBaseAddress == 0) {
+return RETURN_NOT_FOUND;
+  }
+
+  BaudRate = (UINTN)PcdGet64 (PcdUartDefaultBaudRate);
+  ReceiveFifoDepth = 0

[edk2] [PATCH 9/9] ArmVirtualizationPkg: DSC: resolve SerialPortLib for DXE_CORE

2014-09-03 Thread Laszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc 
b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
index 682113d..61e110a 100644
--- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
@@ -165,7 +165,7 @@
   
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   
PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
-  
SerialPortLib|ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf
+  
SerialPortLib|ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/DxeCorePL011SerialPortLib.inf
 
 [LibraryClasses.common.DXE_DRIVER]
   
ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
-- 
1.8.3.1


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH 3/9] ArmVirtualizationPkg: DSC: resolve HobLib dependencies for SEC

2014-09-03 Thread Laszlo Ersek
In the next patch we'll add HobLib client code to the PEI half of our
ArmVirtualizationPlatformLib library. However, the library as a whole is
used in both SEC and PEI modules. Although HobLib is unusable in SEC
(because we don't have the necessary PEI services ready yet), and we
actually don't use HobLib in the SEC-invoked part of the library, we add
the necessary library resolutions for SEC, so that the module compiles for
SEC.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc | 4 
 1 file changed, 4 insertions(+)

diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc 
b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
index 43aeb59..682113d 100644
--- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
@@ -116,6 +116,10 @@
   
DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
   
DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLibBase.inf
   
SerialPortLib|ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf
+  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
+  PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
+  
PeiServicesTablePointerLib|ArmPlatformPkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf
+  
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
   
 [LibraryClasses.common.PEI_CORE]
   PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
-- 
1.8.3.1



--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH 7/9] FdtPL011SerialPortLib.inf: drop bogus PcdSystemMemorySize reference

2014-09-03 Thread Laszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 .../Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf  | 1 -
 1 file changed, 1 deletion(-)

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf
index 15db56b..fd2139e 100644
--- 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf
@@ -47,4 +47,3 @@
 
 [Pcd]
   gArmVirtualizationTokenSpaceGuid.PcdPL011BaseAddress
-  gArmTokenSpaceGuid.PcdSystemMemorySize
-- 
1.8.3.1



--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH 5/9] ArmVirtualizationPlatformLib: stash dynamic UART base in a HOB in the PEI code

2014-09-03 Thread Laszlo Ersek
In this patch we stash the dynamic UART base in a HOB, for the DXE CORE only.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 .../ArmVirtualizationPlatformLib.inf   |  4 
 .../Library/ArmVirtualizationPlatformLib/Virt.c| 14 ++
 2 files changed, 18 insertions(+)

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf
index 241766b..09b0123 100644
--- 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf
@@ -34,6 +34,7 @@
   PrintLib
   FdtLib
   SerialPortLib
+  HobLib
 
 [Sources.common]
   Virt.c
@@ -61,3 +62,6 @@
   gArmTokenSpaceGuid.PcdArmPrimaryCore
   gArmTokenSpaceGuid.PcdFdBaseAddress
   gArmTokenSpaceGuid.PcdFdSize
+
+[Guids]
+  gEarlyPL011BaseAddressGuid
diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/Virt.c
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/Virt.c
index c10ef91..9056510 100644
--- 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/Virt.c
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/Virt.c
@@ -2,6 +2,7 @@
 *
 *  Copyright (c) 2011-2013, ARM Limited. All rights reserved.
 *  Copyright (c) 2014, Linaro Limited. All rights reserved.
+*  Copyright (c) 2014, Red Hat, Inc.
 *
 *
 *  This program and the accompanying materials
@@ -20,6 +21,12 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 /**
   Return the current Boot Mode
@@ -71,6 +78,7 @@ ArmPlatformInitializeSystemMemory (
   UINT64  NewBase;
   UINT64  NewSize;
   BOOLEAN HaveMemory, HaveUART;
+  UINT64  *HobData;
 
   NewBase = 0;
   NewSize = 0;
@@ -78,6 +86,10 @@ ArmPlatformInitializeSystemMemory (
   HaveMemory = FALSE;
   HaveUART = FALSE;
 
+  HobData = BuildGuidHob (&gEarlyPL011BaseAddressGuid, sizeof *HobData);
+  ASSERT (HobData != NULL);
+  *HobData = 0;
+
   DeviceTreeBase = (VOID *)(UINTN)FixedPcdGet64 
(PcdDeviceTreeInitialBaseAddress);
   ASSERT (DeviceTreeBase != NULL);
 
@@ -155,6 +167,8 @@ ArmPlatformInitializeSystemMemory (
 DEBUG ((EFI_D_INFO, "%a: PL011 UART @ 0x%lx\n", __FUNCTION__, 
UartBase));
 
 PcdSet64 (PcdPL011BaseAddress, UartBase);
+*HobData = UartBase;
+
 HaveUART = TRUE;
 continue;
   }
-- 
1.8.3.1



--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH 1/9] ArmVirtualizationPkg: DSC: fix line endings

2014-09-03 Thread Laszlo Ersek
they all should be CRLF.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 .../ArmVirtualizationPkg/ArmVirtualization.dsc.inc | 44 +++---
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc 
b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
index ff38b76..43aeb59 100644
--- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
@@ -54,12 +54,12 @@
   #BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf
 
-  # Networking Requirements
-  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
-  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
-  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
-  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
-
+  # Networking Requirements
+  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
+  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
+  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
+
   # ARM Architectural Libraries
   
CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
   
DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
@@ -317,19 +317,19 @@
   #
   gArmTokenSpaceGuid.PcdArmUncachedMemoryMask|0x
 
-[Components.common]
-  #
-  # Networking stack
-  #
-  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
-  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
-  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
-  MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
-  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
-  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
-  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
-  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
-  MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
-  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
-  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
-  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
+[Components.common]
+  #
+  # Networking stack
+  #
+  MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
+  MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
+  MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
+  MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
+  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
+  MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
+  MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
+  MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
+  MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
+  MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
+  MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf
+  MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf
-- 
1.8.3.1



--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH 2/9] ArmVirtualizationPkg: introduce gEarlyPL011BaseAddressGuid

2014-09-03 Thread Laszlo Ersek
This GUID will identify a customized HOB that carries the base address of
the PL011 serial port, for clients that cannot access PCDs.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 .../Include/Guid/EarlyPL011BaseAddress.h   | 27 ++
 .../ArmVirtualizationPkg/ArmVirtualizationPkg.dec  |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Include/Guid/EarlyPL011BaseAddress.h

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Include/Guid/EarlyPL011BaseAddress.h 
b/ArmPlatformPkg/ArmVirtualizationPkg/Include/Guid/EarlyPL011BaseAddress.h
new file mode 100644
index 000..1b703a81
--- /dev/null
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/Include/Guid/EarlyPL011BaseAddress.h
@@ -0,0 +1,27 @@
+/** @file
+  GUID for the HOB that caches the base address of the PL011 serial port, for
+  when PCD access is not available.
+
+  Copyright (C) 2014, Red Hat, Inc.
+
+  This program and the accompanying materials are licensed and made available
+  under the terms and conditions of the BSD License that 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.
+
+**/
+
+#ifndef __EARLY_PL011_BASE_ADDRESS_H__
+#define __EARLY_PL011_BASE_ADDRESS_H__
+
+#define EARLY_PL011_BASE_ADDRESS_GUID { \
+  0xB199DEA9, 0xFD5C, 0x4A84, \
+  { 0x80, 0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } \
+}
+
+extern EFI_GUID gEarlyPL011BaseAddressGuid;
+
+#endif
diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec 
b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec
index 37f00a2..34833aa 100644
--- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec
@@ -32,6 +32,7 @@
 
 [Guids.common]
   gArmVirtualizationTokenSpaceGuid = { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 
0x6E, 0x2E, 0x36, 0x5B, 0x80, 0x63, 0x66 } }
+  gEarlyPL011BaseAddressGuid   = { 0xB199DEA9, 0xFD5C, 0x4A84, { 0x80, 
0x82, 0x2F, 0x41, 0x70, 0x78, 0x03, 0x05 } }
 
 [PcdsFixedAtBuild]
   #
-- 
1.8.3.1



--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH 4/9] ArmVirtualizationPlatformLib: lock down client module types

2014-09-03 Thread Laszlo Ersek
Also, clean up a number of phase-related comments.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 .../ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf | 2 +-
 .../Library/ArmVirtualizationPlatformLib/Virt.c   | 8 +++-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf
index 5bb7f07..241766b 100644
--- 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf
@@ -18,7 +18,7 @@
   FILE_GUID  = 00214cc1-06d1-45fe-9700-dca5726ad7bf
   MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = ArmPlatformLib
+  LIBRARY_CLASS  = ArmPlatformLib|SEC PEIM
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/Virt.c
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/Virt.c
index c1820d5..c10ef91 100644
--- 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/Virt.c
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/Virt.c
@@ -38,11 +38,7 @@ ArmPlatformGetBootMode (
 }
 
 /**
-  Initialize controllers that must setup in the normal world
-
-  This function is called by the ArmPlatformPkg/Pei or 
ArmPlatformPkg/Pei/PlatformPeim
-  in the PEI phase.
-
+  This function is called by PrePeiCore, in the SEC phase.
 **/
 RETURN_STATUS
 ArmPlatformInitialize (
@@ -62,6 +58,8 @@ ArmPlatformInitialize (
 
   This memory is generally represented by the DRAM.
 
+  This function is called from InitializeMemory() in MemoryInitPeim, in the PEI
+  phase.
 **/
 VOID
 ArmPlatformInitializeSystemMemory (
-- 
1.8.3.1



--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH 6/9] ArmVirtualizationPkg: FdtPL011SerialPortLib: lock down allowed clients

2014-09-03 Thread Laszlo Ersek
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek 
---
 .../Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf| 2 +-
 .../Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf
index 4db0513..d62f87b 100644
--- 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf
@@ -20,7 +20,7 @@
   FILE_GUID  = 0983616A-49BC-4732-B531-4AF98D2056F0
   MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = SerialPortLib
+  LIBRARY_CLASS  = SerialPortLib|SEC PEI_CORE PEIM
 
 [Sources.common]
   EarlyFdtPL011SerialPortLib.c
diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf
index b4fc712..15db56b 100644
--- 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf
@@ -20,7 +20,7 @@
   FILE_GUID  = 0983616A-49BC-4732-B531-4AF98D2056F0
   MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = SerialPortLib
+  LIBRARY_CLASS  = SerialPortLib|DXE_DRIVER UEFI_DRIVER 
DXE_RUNTIME_DRIVER
   CONSTRUCTOR= FdtPL011SerialPortLibInitialize
 
 [Sources.common]
-- 
1.8.3.1



--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] HII ORDERED_LIST support

2014-09-03 Thread Dong, Eric
Tim,

Add my comments below.


From: Tim Lewis [mailto:tim.le...@insyde.com]
Sent: Thursday, September 04, 2014 12:04 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] HII ORDERED_LIST support

Eric -

Here is what I am thinking: we can extend the UEFI specification (which I will 
do in a separate ECR), to allow either the UINT8 or the BUFFER value for 
"option" and "default" If UINT8, then it will work on a single container. If 
BUFFER then it works on all containers. It may take me a week (after IDF) to 
get the ECR written for UEFI.
[[[Eric]]] If in BUFFER type, we can create a sample like below. In this case, 
only one "text" for this option, how to show the different value for this 
orderedlist? Maybe we need to update the "text" field also? I agree it has 
value to support BUFFER type for default opcode, because in this case we can 
set default value for "orderedlist" opcode. But I don't know the value to 
support BUFFER for "option"? It will make the "option" more complicate to 
handle. Also the "option" can be used for "Oneof" opcode, we also need consider 
this opcode when we clarify the "option" opcode.
  orderedlist
varid   = MyIfrNVData.BootOrder,
prompt  = STRING_TOKEN(0x006D),
help= STRING_TOKEN(0x0059),
option text = STRING_TOKEN(0x006F), value = 2  1  3, flags = 0;
  endlist;

I think that if we document this behavior, it will be useful.

Are there any other question types where there are multiple value types 
possible? Obviously UINTx. How about CHECKBOX with integer? Or NUMERIC with 
BOOLEAN? Just thinking ahead.
[[[Eric]]] I think we don't have that question.

Tim

From: Dong, Eric [mailto:eric.d...@intel.com]
Sent: Tuesday, September 02, 2014 10:45 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] HII ORDERED_LIST support

After internal discussion, we agree default opcode can support ordered list 
opcode, I will follow up to enable it.

For your proposal, item 2 I think it's not an acceptable proposal, take below 
code for example:
  orderedlist
varid   = MyIfrNVData.BootOrder,
prompt  = STRING_TOKEN(0x006D),
help= STRING_TOKEN(0x0059),
option text = STRING_TOKEN(0x006F), value = 2, flags = 0;
option text = STRING_TOKEN(0x006E), value = 1, flags = DEFAULT;
option text = STRING_TOKEN(0x0070), value = 3, flags = 0;
  endlist;
normally, we can see option 2/option 1/option 3 for this ordered list. But base 
on your proposal, the default for this ordered list opcode is option 1/option 
1/option 1, do you think  this is an valid ordered list result? I think if 
DEFAULT flag is set, we can just skip this flag. We can use default opcode to 
set default for ordered list opcode.

For your proposal, I think you can submit an ECR for it.

Thanks,
Eric
From: Tim Lewis [mailto:tim.le...@insyde.com]
Sent: Wednesday, September 03, 2014 10:24 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] HII ORDERED_LIST support

Again, these are EDK2 decisions. They are not limitations of the specification. 
The UEFI specification does not indicate that the EFI_IFR_ONE_OF_OPTION default 
flag cannot work for ordered list. The UEFI specification does not say that 
there is any limitation to the default opcode. It does not say that 
EFI_IFR_TYPE_BUFFER cannot be used.   These are EDK2 and VFR limitations, not 
specification limits.

So, that is why I made the proposal below: to try and clarify the behavior if 
these exist based on the UEFI specification language.

Tim

From: Dong, Eric [mailto:eric.d...@intel.com]
Sent: Tuesday, September 02, 2014 7:10 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] HII ORDERED_LIST support

For ordered list opcode, we not support set default flags in the option field. 
It is useful for oneof opcode not for ordered list opcode. Also I think your 
proposal of item 2) also not acceptable. We not support set default value 
through option for ordered list opcode.

The value for ordered list opcode is buffer type, but the default opcode not 
support save buffer type value(The EFI_IFR_TYPE_VALUE not support buffer type), 
so the default opcode can't be used by ordered list opcode.
[cid:image001.jpg@01CFC821.9B41F220]

[cid:image002.jpg@01CFC821.9B41F220]

Current for ordered list opcode, browser based on the current option order nest 
in this question to set the default value for it.
From: Tim Lewis [mailto:tim.le...@insyde.com]
Sent: Wednesday, September 03, 2014 5:32 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] HII ORDERED_LIST support

Eric -

I believe that what you say is useful. But I don't think the specification 
describes that behavior.

The next question, wh

Re: [edk2] [PATCH 01/12] MdePkg: BaseOrderedCollectionRedBlackTreeLib: add constructor

2014-09-03 Thread Laszlo Ersek
On 09/03/14 00:56, Laszlo Ersek wrote:
> Calls to constructors of interdependent library instances are generated in
> the correct order only if all library instances in question have
> constructors. If some have no constructors, then the rest may see their
> constructors called out of order.
> 
> Cycle detection also only works when all library instances have
> constructors.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Laszlo Ersek 
> ---
>  .../BaseOrderedCollectionRedBlackTreeLib.inf   |  2 ++
>  .../BaseOrderedCollectionRedBlackTreeLib.c | 10 
> ++
>  2 files changed, 12 insertions(+)
> 
> diff --git 
> a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
>  
> b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
> index a68afc8..f846a79 100644
> --- 
> a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
> +++ 
> b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf
> @@ -32,6 +32,8 @@
>VERSION_STRING = 1.0
>LIBRARY_CLASS  = OrderedCollectionLib
>  
> +  CONSTRUCTOR= 
> BaseOrderedCollectionRedBlackTreeLibConstructor
> +
>  #
>  #  VALID_ARCHITECTURES   = IA32 X64 IPF EBC
>  #
> diff --git 
> a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
>  
> b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
> index 8d18a4b..23ba8de 100644
> --- 
> a/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
> +++ 
> b/MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.c
> @@ -1452,3 +1452,13 @@ RedBlackTreeValidate (
>DEBUG ((DEBUG_VERBOSE, "%a: Tree=%p BlackHeight=%Ld Count=%Ld\n",
>  __FUNCTION__, Tree, (INT64)BlackHeight, (INT64)ForwardCount));
>  }
> +
> +
> +RETURN_STATUS
> +EFIAPI
> +BaseOrderedCollectionRedBlackTreeLibConstructor (
> +  VOID
> +  )
> +{
> +  return RETURN_SUCCESS;
> +}
> 

Self-NACK for this patchset -- please ignore. I've seen the light.

Thanks
Laszlo

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] [PATCH] MdePkg NASM Thunk16: Add missing ASM_PFX for InternalAsmThunk16

2014-09-03 Thread Gao, Liming
The patch is good. Reviewed-by: Gao, Liming 

-Original Message-
From: Jordan Justen [mailto:jordan.l.jus...@intel.com] 
Sent: Thursday, September 04, 2014 1:34 AM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] [PATCH] MdePkg NASM Thunk16: Add missing ASM_PFX for 
InternalAsmThunk16

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Sergey Isakov 
---
 MdePkg/Library/BaseLib/Ia32/Thunk16.nasm | 2 +-  
MdePkg/Library/BaseLib/X64/Thunk16.nasm  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm 
b/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
index e3d0d4e..794d831 100644
--- a/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
+++ b/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
@@ -58,7 +58,7 @@ SECTION .data
 ;
 ; These are global constant to convey information to C code.
 ;
-ASM_PFX(m16Size) DW  InternalAsmThunk16 - ASM_PFX(m16Start)
+ASM_PFX(m16Size) DW  ASM_PFX(InternalAsmThunk16) - 
ASM_PFX(m16Start)
 ASM_PFX(mThunk16Attr)DW  _BackFromUserCode.ThunkAttrEnd - 4 - 
ASM_PFX(m16Start)
 ASM_PFX(m16Gdt)  DW  _NullSegDesc - ASM_PFX(m16Start)
 ASM_PFX(m16GdtrBase) DW  _16GdtrBase - ASM_PFX(m16Start)
diff --git a/MdePkg/Library/BaseLib/X64/Thunk16.nasm 
b/MdePkg/Library/BaseLib/X64/Thunk16.nasm
index 7c4a8d3..cfa55d4 100644
--- a/MdePkg/Library/BaseLib/X64/Thunk16.nasm
+++ b/MdePkg/Library/BaseLib/X64/Thunk16.nasm
@@ -56,7 +56,7 @@ SECTION .data
 ;
 ; These are global constant to convey information to C code.
 ;
-ASM_PFX(m16Size) DW  InternalAsmThunk16 - ASM_PFX(m16Start)
+ASM_PFX(m16Size) DW  ASM_PFX(InternalAsmThunk16) - 
ASM_PFX(m16Start)
 ASM_PFX(mThunk16Attr)DW  _BackFromUserCode.ThunkAttrEnd - 4 - 
ASM_PFX(m16Start)
 ASM_PFX(m16Gdt)  DW  _NullSeg - ASM_PFX(m16Start)
 ASM_PFX(m16GdtrBase) DW  _16GdtrBase - ASM_PFX(m16Start)
@@ -269,7 +269,7 @@ BITS64
   
 sgdt[rsp + 60h]   ; save GDT stack in argument space
 movzx   r10, word [rsp + 60h]   ; r10 <- GDT limit 
-lea r11, [rcx + (InternalAsmThunk16 - _BackFromUserCode.SavedCr4End) + 
0xf]
+lea r11, [rcx + (ASM_PFX(InternalAsmThunk16) - 
_BackFromUserCode.SavedCr4End) + 0xf]
 and r11, ~0xf; r11 <- 16-byte aligned shadowed GDT table 
in real mode buffer
 
 mov [rcx + (SavedGdt - _BackFromUserCode.SavedCr4End)], r10w  ; 
save the limit of shadowed GDT table
--
2.1.0


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] The DXE Core does not link with Xcode 5 for IA32

2014-09-03 Thread Andrew Fish
It looks like the 64-bit bit wise and operation is causing the compiler to emit 
an __umoddi3 I’m looking into to how to work around this issue.

>build -p MdeModulePkg/MdeModulePkg.dsc -a IA32 -t XCODE5 -n 1

Building ... /Users/andrewfish/work/src/edk2/MdeModulePkg/Core/Dxe/DxeMain.inf 
[IA32]
"ld" -arch i386 -u __ModuleEntryPoint -e __ModuleEntryPoint -preload -segalign 
0x20 -pie -all_load -dead_strip -seg1addr 0x240 -read_only_relocs suppress -map 
/Users/andrewfish/work/src/edk2/Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.map
 -o 
/Users/andrewfish/work/src/edk2/Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/DEBUG/DxeCore.dll
  -filelist 
/Users/andrewfish/work/src/edk2/Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/static_library_files.lst
Undefined symbols for architecture i386:
  "___umoddi3", referenced from:
  _CoreInternalWaitForTick in DxeCore.lib(Stall.obj)

~/work/src/edk2(master)>otool -tvV 
Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/Misc/Stall.obj
Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/Misc/Stall.obj:
(__TEXT,__text) section
_CoreInternalWaitForTick:
pushl   %ebp
0001movl%esp, %ebp
0003pushl   %ebx
0004pushl   %edi
0005pushl   %esi
0006subl$0x1c, %esp
0009movl0x683, %eax
000emovl_CoreInternalWaitForTick(%eax), %esi
0010movl_CoreInternalWaitForTick(%esi), %ecx
0012movl0x8(%ebp), %ebx
0015movl0xc(%ebp), %edi
0018testl   %edi, %edi
001aje  0x6e
001cmovl%ecx, -0x10(%ebp)
001fleal-0x1(%edi), %eax
0022movl%ebx, _CoreInternalWaitForTick(%esp)
0025movl%eax, 0x4(%esp)
0029movl$_CoreInternalWaitForTick, 0xc(%esp)
0031movl$0x, 0x8(%esp)
0039calll   ___umoddi3

~/work/src/edk2(master)>lldb  
Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/Misc/Stall.obj
Current executable set to 
'Build/MdeModule/DEBUG_XCODE5/IA32/MdeModulePkg/Core/Dxe/DxeMain/OUTPUT/Misc/Stall.obj'
 (i386).
(lldb) dis -b -m -n CoreInternalWaitForTick
Stall.obj`CoreInternalWaitForTick at Stall.c:34
   33 )
   34   {
   35 while ((Counter & 0xULL) != 0) {
Stall.obj[0x0]:  55   pushl  %ebp
Stall.obj[0x1]:  89 e5movl   %esp, %ebp
Stall.obj`CoreInternalWaitForTick + 3 at Stall.c:36
   35 while ((Counter & 0xULL) != 0) {
   36   gMetronome->WaitForTick (gMetronome, 0x);
   37   Counter -= 0x;
Stall.obj[0x3]:  53   pushl  %ebx
Stall.obj[0x4]:  57   pushl  %edi
Stall.obj[0x5]:  56   pushl  %esi
Stall.obj[0x6]:  83 ec 1c subl   $0x1c, %esp
Stall.obj[0x9]:  a1 83 06 00 00   movl   0x683, %eax
Stall.obj[0xe]:  8b 30movl   (%eax), %esi
Stall.obj[0x10]:  8b 0emovl   (%esi), %ecx
Stall.obj[0x12]:  8b 5d 08 movl   0x8(%ebp), %ebx
Stall.obj[0x15]:  8b 7d 0c movl   0xc(%ebp), %edi
Stall.obj[0x18]:  85 fftestl  %edi, %edi
Stall.obj[0x1a]:  74 52je 0x6e  ; 
CoreInternalWaitForTick + 110 at Stall.c:39
Stall.obj[0x1c]:  89 4d f0 movl   %ecx, -0x10(%ebp)
Stall.obj`CoreInternalWaitForTick + 31 at Stall.c:35
   34   {
   35 while ((Counter & 0xULL) != 0) {
   36   gMetronome->WaitForTick (gMetronome, 0x);
Stall.obj[0x1f]:  8d 47 ff leal   -0x1(%edi), %eax
Stall.obj[0x22]:  89 1c 24 movl   %ebx, (%esp)
Stall.obj[0x25]:  89 44 24 04  movl   %eax, 0x4(%esp)
Stall.obj[0x29]:  c7 44 24 0c 00 00 00 00  movl   $0x0, 0xc(%esp)
Stall.obj[0x31]:  c7 44 24 08 ff ff ff ff  movl   $0x, 0x8(%esp)
Stall.obj[0x39]:  e8 c2 ff ff ff   calll  0x0   ; 
CoreInternalWaitForTick at Stall.c:34
Stall.obj[0x3e]:  89 45 ec movl   %eax, -0x14(%ebp)
Stall.obj[0x41]:  8b 4d f0 movl   -0x10(%ebp), %ecx


Thanks,

Andrew Fish--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] Issues building OVMF from Xen with Arch Linux

2014-09-03 Thread Zir Blazer
Well, I have both good news and bad news. The good news first:
After all, it *DID* was an issue with Python version. Before, I followed the 
instructions in Arch Linux wiki that should fix build issues due to the 
coexistence of the two Python 
versions:https://wiki.archlinux.org/index.php/python#Dealing_with_version_problem_in_build_scripts
However, it produced the same result, so I discarded a Python version issue. 
After some walking in circles, I decided to try to compile edk2 standalone by 
following the instructions here, using git to download the Source Code then 
trying to make -C BaseTools:https://wiki.ubuntu.com/UEFI/EDK2

This also caused the same invalid syntax error. Being totally fresh Source 
Code, at this point I started to really believe on the Python version issue, 
due the fact that there should be no considerations for Arch Linux's Python 2/3 
coexistence in the edk2 repository. What fixed this was quite rudimentary in a 
less-than-elegant fashion: I simply deleted the /usr/bin/python file, then 
replaced it with a copy of /usr/bin/python2. And finally, BaseTools builded.


I was looking around Makefiles looking what I will have to change to make edk2 
aware that it should use python2 and not python. I think I found that: There is 
an ovmf-svn package from Arch Linux User Repository that seems to be the latest 
version of edk2 Source Code. This one has a PKGBUILD which a few lines that 
replace python to python2 in a few places of edk2 Source Code. The reason of my 
issue is that there is no patch to fix this in the Source Code that is 
downloaded when pulled with --enable-ovmf with the xen package, which is fresh 
and unchanged, so it by default uses Python 3 instead of 2. At least now I know 
what I need to manually change.




The bad news is that it still fails to build with xen. Reason this time is:


GenFw: ERROR 3000: Invalid, Unsupported section alignment


This one seems to be a know error related to GCC 4.9 for all what I was able to 
google. However, Arch Linux User Repository ovmf-svn package has two patchs 
specifically to tackle this issue, so I suppose that it would build properly if 
I were using that package. Problem is, Xen seems to require to be builded with 
OVMF included in it, and I didn't found info claiming that I can simply 
copypaste somewhere the OVMF binaries ready to use. So I need to apply this fix 
myself, too.
Now I need to figure out how to pull a stunt that can both replace python to 
python2 and fix GenFw error for GCC 4.9 in the source that xen pulls when I use 
--enable-ovmf. And then, I will finally be able to make a happy build.




> Date: Tue, 2 Sep 2014 12:58:10 +0200
> From: ler...@redhat.com
> To: edk2-devel@lists.sourceforge.net
> Subject: Re: [edk2] Issues building OVMF from Xen with Arch Linux
> 
> On 08/30/14 02:34, Zir Blazer wrote:
> > First of all, I want to say that I'm not developer and know very little
> > about programming, so if you need more info that what I'm currently
> > providing, please be as detailed as possible to tell me how to get you
> > it. I usually achieve some success when I follow guides, check wikis and
> > the like, when I have to go more far than that its a break point for me.
> > 
> > 
> > I'm trying to install Xen with Arch Linux as Dom0, using Nested
> > Virtualization for testing before moving to native. Xen supports UEFI
> > DomUs (VMs) if I use OVMF, which should be enabled when compiling, and I
> > decided to give that a try so I can have a cutting edge and full
> > featured system. As far that I know, this is done by using --enable-ovmf
> > option, which on Arch Linux xen package, I can include in the
> > ./configure line in PKGBUILD. So in this file:
> > https://aur.archlinux.org/packages/xe/xen/PKGBUILD
> > 
> > I change this...
> > 
> > build() {
> > export CFLAGS+='-Wall -Wstrict-prototypes -Wno-unused-local-typedefs 
> > -Wno-sizeof-pointer-memaccess'
> > cd $pkgname-$pkgver/
> > ./autogen.sh
> > *./configure PYTHON=/usr/bin/python2 --prefix=/usr --localstatedir=/run*
> > make LANG=C PYTHON=python2 dist-{xen,tools,kernels}
> > unset CFLAGS
> > make LANG=C PYTHON=python2 dist-stubdom
> > }
> > 
> > to this...
> > 
> > *./configure PYTHON=/usr/bin/python2 --prefix=/usr --localstatedir=/run 
> > --enable-ovmf*
> > 
> > 
> > 
> > So far, using makepkg without adding OVMF builds with no issues. When I
> > use OVMF, it downloads some 150 MiB or so worth of data (A clone of your
> > Source Repository I suppose), and starts to build but fails. The point
> > where it fails and error message is IDENTICAL to this guy who posted in
> > xen-devel Mailing List:
> > http://lists.xen.org/archives/html/xen-devel/2014-07/msg02855.html
> > 
> > What refuses to build is in this file:
> > https://github.com/tianocore/edk2/blob/master/BaseTools/Tests/TestTools.py
> > 
> > Line 87   print description, '(base64 encoded):'
> > 
> > It was suggested to him to try building with Python 2 instead 

Re: [edk2] Getting Started UEFI driver on Minnowboard

2014-09-03 Thread Toto Lebolo
OK I might be using an older version 0.11



On Wednesday, September 3, 2014 3:17 PM, Toto Lebolo  
wrote:
 


Thanks Brian. Actually that's what I tried first but I am getting this error:

UEFI Driver creation failed.


On Wednesday, September 3, 2014 7:22 AM, "Richardson, Brian" 
 wrote:
 


Check out the UEFI Driver Wizard on tianocore.
http://tianocore.sourceforge.net/wiki/UEFI_Driver_Wizard 

Thanks ... br
---
Brian Richardson -- brian.richard...@intel.com -- Twitter: intel_brian

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Tuesday, September 02, 2014 7:04 PM
To: Toto Lebolo; edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Getting Started UEFI driver on Minnowboard

On 09/03/14 00:43, Toto Lebolo wrote:
> I would like to write a device driver on Minnowboard to access 
> hardware resources. Is there a sample code to start with? I've tried 
> the BlankDrv for nt32 from Intel but it doesn't seems to work fine on the 
> minnowboard.
> Any suggestion is welcome.

http://www.uefi.org/specifications
https://github.com/tianocore/tianocore.github.io/wiki/Driver-Developer
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-User-Documentation
https://github.com/tianocore/tianocore.github.io/wiki/UEFI-EDKII-Learning-Dev
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Specifications

The UEFI Driver Writer's Guide is especially good.

Laszlo


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] Getting Started UEFI driver on Minnowboard

2014-09-03 Thread Toto Lebolo
Thanks Brian. Actually that's what I tried first but I am getting this error:

UEFI Driver creation failed.



On Wednesday, September 3, 2014 7:22 AM, "Richardson, Brian" 
 wrote:
 


Check out the UEFI Driver Wizard on tianocore.
http://tianocore.sourceforge.net/wiki/UEFI_Driver_Wizard 

Thanks ... br
---
Brian Richardson -- brian.richard...@intel.com -- Twitter: intel_brian

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Tuesday, September 02, 2014 7:04 PM
To: Toto Lebolo; edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Getting Started UEFI driver on Minnowboard

On 09/03/14 00:43, Toto Lebolo wrote:
> I would like to write a device driver on Minnowboard to access 
> hardware resources. Is there a sample code to start with? I've tried 
> the BlankDrv for nt32 from Intel but it doesn't seems to work fine on the 
> minnowboard.
> Any suggestion is welcome.

http://www.uefi.org/specifications
https://github.com/tianocore/tianocore.github.io/wiki/Driver-Developer
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-User-Documentation
https://github.com/tianocore/tianocore.github.io/wiki/UEFI-EDKII-Learning-Dev
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Specifications

The UEFI Driver Writer's Guide is especially good.

Laszlo


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to MdeModulePkg

2014-09-03 Thread Mcdaniel, Daryl
FYI
I am also in the process of moving libraries out of the Shell into a common set 
of libraries usable everywhere.
An ultimate destination has not yet been decided because of strict requirements 
on what may go into the EDK II "core" code (MdePkg, etc.) and the requirement 
that the Shell may not depend on any package that is not part of the "core".


Daryl McDaniel

"It is the mark of an educated mind to be able to entertain a thought without 
accepting it."
- Aristotle


-Original Message-
From: Olivier Martin [mailto:olivier.mar...@arm.com] 
Sent: Wednesday, September 03, 2014 8:27 AM
To: edk2-devel@lists.sourceforge.net; Ni, Ruiyu; Tian, Feng
Cc: Ronald Cron
Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to MdeModulePkg

Ruiyi/Feng, any update on this one?

Now people are porting file system to EDK2, exposing this library to a common 
package (instead of ShellPkg) could avoid code duplication across the 
repository.

The reason I am pinging this thread is that we are actually looking at removing 
some of our code duplication in some of our file system protocol 
implementations using this library.

> -Original Message-
> From: Olivier Martin [mailto:olivier.mar...@arm.com]
> Sent: 15 August 2014 09:40
> To: 'Ni, Ruiyu'; edk2-devel@lists.sourceforge.net; Tian, Feng
> Cc: Brendan Jackman
> Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to 
> MdeModulePkg
> 
> I am quite happy to make some change to this library if Jaben agrees 
> with this change. But this patch only moves the existing BasePathLib 
> from one package to another one.
> 
> Olivier
> 
> > -Original Message-
> > From: Ni, Ruiyu [mailto:ruiyu...@intel.com]
> > Sent: 15 August 2014 06:23
> > To: edk2-devel@lists.sourceforge.net; Tian, Feng; Olivier Martin
> > Cc: Brendan Jackman
> > Subject: RE: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to 
> > MdeModulePkg
> >
> > I think maybe PathCleanUpDirectories is not a good name to describe 
> > this API's behavior. It's a API to normalize the file path but do 
> > nothing to the directory content. Would "PathNormalize" be better?
> >
> > -Original Message-
> > From: Carsey, Jaben [mailto:jaben.car...@intel.com]
> > Sent: Friday, August 15, 2014 4:41 AM
> > To: edk2-devel@lists.sourceforge.net; Tian, Feng; Olivier Martin
> > (olivier.mar...@arm.com)
> > Cc: Brendan Jackman
> > Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to 
> > MdeModulePkg
> >
> > Reviewed-by: Jaben Carsey 
> >
> > I didn't notice this email originally. I think that this looks like 
> > a good change.  What other feedback are you hoping for?
> >
> > -Jaben
> >
> >
> > > -Original Message-
> > > From: Olivier Martin [mailto:olivier.mar...@arm.com]
> > > Sent: Thursday, August 14, 2014 12:06 PM
> > > To: edk2-devel@lists.sourceforge.net; Tian, Feng
> > > Cc: Brendan Jackman
> > > Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to 
> > > MdeModulePkg
> > >
> > > Any feedback on this one?
> > >
> > > Thanks,
> > > Olivier
> > >
> > > > -Original Message-
> > > > From: Olivier Martin [mailto:olivier.mar...@arm.com]
> > > > Sent: 24 March 2014 20:23
> > > > To: feng.t...@intel.com
> > > > Cc: Brendan Jackman; edk2-devel@lists.sourceforge.net
> > > > Subject: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to 
> > > > MdeModulePkg
> > > >
> > > > From: Brendan Jackman 
> > > >
> > > > This library is useful to other modules than the shell - for
> > example
> > > > filesystem drivers.
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > > Signed-off-by: Brendan Jackman 
> > > > Reviewed-by: Olivier Martin 
> > > > ---
> > > >  AppPkg/AppPkg.dsc|   2 +-
> > > >  EmulatorPkg/EmulatorPkg.dsc  |   2 +-
> > > >  MdeModulePkg/Include/Library/PathLib.h   |  56
> +++
> > > >  MdeModulePkg/Library/BasePathLib/BasePathLib.c   | 123
> > > > +++
> > > >  MdeModulePkg/Library/BasePathLib/BasePathLib.inf |  38 +++
> > > >  OvmfPkg/OvmfPkgIa32.dsc  |   2 +-
> > > >  OvmfPkg/OvmfPkgIa32X64.dsc   |   2 +-
> > > >  OvmfPkg/OvmfPkgX64.dsc   |   2 +-
> > > >  ShellPkg/Include/Library/PathLib.h   |  56 -
> --
> > > >  ShellPkg/Library/BasePathLib/BasePathLib.c   | 123 -
> --
> > 
> > > > 
> > > >  ShellPkg/Library/BasePathLib/BasePathLib.inf |  38 ---
> > > >  ShellPkg/ShellPkg.dsc|   2 +-
> > > >  StdLib/StdLib.dsc|   2 +-
> > > >  StdLib/StdLib.inc|   2 +-
> > > >  14 files changed, 225 insertions(+), 225 deletions(-)  create
> mode
> > > > 100644 MdeModulePkg/Include/Library/PathLib.h
> > > >  create mode 100644
> MdeModulePkg/Library/BasePathLib/BasePathLib.c
> > > >  create mode 100644
> > MdeModulePkg/Library/Ba

Re: [edk2] Warning C4244 causes build failure with older Microsoft compilers

2014-09-03 Thread Mcdaniel, Daryl
I would like to see the conversion warning retained for every compiler and 
version supported for EDK II.
If a particular version of a compiler has a buggy implementation of the warning 
and gives too many false positives, then the warning may be disabled for that 
specific version.

I've spent the last several years fixing a ton of code (open source and 
proprietary) that breaks when built with different compilers or for different 
processor architectures because of assignment of larger data types to smaller 
ones.  (implicit conversions)

I think that every instance of this type of assignment should require an 
explicit cast to indicate that such a conversion is happening.  It won't 
eliminate errors but it will indicate that the author was possibly aware that 
they were assigning to a smaller/different data type.

The EDK II code base is one of the highest quality open-source projects I have 
had to deal with.  Mostly because of the requirement that all of the code must 
work with multiple compilers and explicitly specify object sizes and 
conversions between them.  INTN and UINTN are still a bit of a wart, but the 
next release of the "EDK II Coding Standard" should help clear that up.

I agree that it can be a hassle, but in the end the code will be much more 
maintainable and robust.

And, it is easy enough to temporarily disable this warning in the [BootOptions] 
section of your .dsc or .inf files if you have to deal with someone else's code 
that doesn't yet come up to standards.

Daryl McDaniel

"It is the mark of an educated mind to be able to entertain a thought without 
accepting it."
- Aristotle

-Original Message-
From: Scott Duplichan [mailto:sc...@notabs.org] 
Sent: Tuesday, September 02, 2014 9:40 PM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] Warning C4244 causes build failure with older Microsoft 
compilers

EDK2 builds with 'warning level 4' when using Microsoft tools. For the most 
part, that enables desirable warnings similar to those provided by gcc -Wall. 
There is one major difference though, Microsoft warning level
4 warns about the routine practice of assigning a larger size integer to a 
smaller size integer. The Microsoft warning looks like:

warning C4244: conversion from 'UINT32' to 'UINT8', possible loss of data

Gcc has a warning option that is similar to Microsoft C4244: -WConversion But 
the gcc option -Wall does _not_ enable -Wconversion. In fact, gcc option 
-Wextra doesn't even enable -Wconversion. That suggests that -Wconversion is a 
specialty warning not suitable for general use. EDK2 gcc builds do not enable 
-Wconversion.

I think Microsoft warning C4244 (and similar) should be removed from
EDK2 so that Microsoft warning settings are more consistent with gcc warning 
settings. But that might be a difficult change to push through.
While it would be interesting to see what others think, completely removing 
Microsoft Warning C4244 is a discussion for another day.

The immediate problem should be a lot easier to get agreement on. The problem 
is that warning C4244 is buggy/imperfect in older Microsoft compilers (DDK3790, 
VS2003, VS2005). As a result, some builds fail with those compilers, but pass 
with newer ones. Here are examples:

OvmfPkg\Library\LoadLinuxLib\Linux.c(387)
OvmfPkg\Library\LoadLinuxLib\Linux.c(388)
OvmfPkg\VirtioBlkDxe\VirtioBlk.c(773)
OvmfPkg\VirtioBlkDxe\VirtioBlk.c(774)
OvmfPkg\VirtioNetDxe\DriverBinding.c(132)
OvmfPkg\VirtioScsiDxe\VirtioScsi.c(751)
StdLib\BsdSocketLib\res_mkupdate.c(186)

Here are code snippets that demonstrate the warning C4344 problem with older 
Microsoft compilers:

#if defined (__GNUC__)
#include 
#else
#define uint16_t unsigned __int16
#define uint32_t unsigned __int32
#define uint64_t unsigned __int64
#endif
char test1 (int x) {return !x;}
char test2 (int x) {return x == 1;}
char test3 (int x) {return x & 1;}
uint32_t test4 (uint64_t x) {return x >> 32;} uint32_t test5 (uint64_t x) 
{return x && 0x;} enum {a=1, b=2}; uint16_t test6 (int x) {return x ? a 
: b;}

/*
W A R N I N G   C O U N T S
Tool chain   test1  test2  test3  test4  test5  test6
DDK3790 /W41  1  1  1  0  1
VS2003  /W41  1  1  1  0  1
VS2005  /W41  1  1  1  0  0
VS2008  /W40  0  0  0  0  0
VS2010  /W40  0  0  0  0  0
VS2012  /W40  0  0  0  0  0
VS2013  /W40  0  0  0  0  0

With VS2008 and newer, Microsoft compilers eliminate several causes of unwanted 
warnings.

If others agree, I can make a BaseTools\Conf\tools_def.template patch to 
disable warning C4244 for DDK3790, VS2003, and VS2005.

Thanks,
Scott




--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
h

Re: [edk2] ShellPkg: Updates the logic to allow RM to have silent/quiet mode work successfully.

2014-09-03 Thread Bjorge, Erik C
Reviewed-by: Erik Bjorge 

From: Carsey, Jaben
Sent: Wednesday, September 03, 2014 10:44 AM
To: Bjorge, Erik C
Cc: edk2-devel@lists.sourceforge.net; Carsey, Jaben
Subject: ShellPkg: Updates the logic to allow RM to have silent/quiet mode work 
successfully.

Updates the logic to allow RM and CP to have silent/quiet mode work 
successfully.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey 
mailto:jaben.car...@intel.com>>
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] ShellPkg: Updates the logic to allow RM to have silent/quiet mode work successfully.

2014-09-03 Thread Carsey, Jaben
Updates the logic to allow RM and CP to have silent/quiet mode work 
successfully.

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


Rm.c.patch
Description: Rm.c.patch
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH] MdePkg NASM Thunk16: Add missing ASM_PFX for InternalAsmThunk16

2014-09-03 Thread Jordan Justen
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Sergey Isakov 
---
 MdePkg/Library/BaseLib/Ia32/Thunk16.nasm | 2 +-
 MdePkg/Library/BaseLib/X64/Thunk16.nasm  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm 
b/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
index e3d0d4e..794d831 100644
--- a/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
+++ b/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
@@ -58,7 +58,7 @@ SECTION .data
 ;
 ; These are global constant to convey information to C code.
 ;
-ASM_PFX(m16Size) DW  InternalAsmThunk16 - ASM_PFX(m16Start)
+ASM_PFX(m16Size) DW  ASM_PFX(InternalAsmThunk16) - 
ASM_PFX(m16Start)
 ASM_PFX(mThunk16Attr)DW  _BackFromUserCode.ThunkAttrEnd - 4 - 
ASM_PFX(m16Start)
 ASM_PFX(m16Gdt)  DW  _NullSegDesc - ASM_PFX(m16Start)
 ASM_PFX(m16GdtrBase) DW  _16GdtrBase - ASM_PFX(m16Start)
diff --git a/MdePkg/Library/BaseLib/X64/Thunk16.nasm 
b/MdePkg/Library/BaseLib/X64/Thunk16.nasm
index 7c4a8d3..cfa55d4 100644
--- a/MdePkg/Library/BaseLib/X64/Thunk16.nasm
+++ b/MdePkg/Library/BaseLib/X64/Thunk16.nasm
@@ -56,7 +56,7 @@ SECTION .data
 ;
 ; These are global constant to convey information to C code.
 ;
-ASM_PFX(m16Size) DW  InternalAsmThunk16 - ASM_PFX(m16Start)
+ASM_PFX(m16Size) DW  ASM_PFX(InternalAsmThunk16) - 
ASM_PFX(m16Start)
 ASM_PFX(mThunk16Attr)DW  _BackFromUserCode.ThunkAttrEnd - 4 - 
ASM_PFX(m16Start)
 ASM_PFX(m16Gdt)  DW  _NullSeg - ASM_PFX(m16Start)
 ASM_PFX(m16GdtrBase) DW  _16GdtrBase - ASM_PFX(m16Start)
@@ -269,7 +269,7 @@ BITS64
   
 sgdt[rsp + 60h]   ; save GDT stack in argument space
 movzx   r10, word [rsp + 60h]   ; r10 <- GDT limit 
-lea r11, [rcx + (InternalAsmThunk16 - _BackFromUserCode.SavedCr4End) + 
0xf]
+lea r11, [rcx + (ASM_PFX(InternalAsmThunk16) - 
_BackFromUserCode.SavedCr4End) + 0xf]
 and r11, ~0xf; r11 <- 16-byte aligned shadowed GDT table 
in real mode buffer
 
 mov [rcx + (SavedGdt - _BackFromUserCode.SavedCr4End)], r10w  ; 
save the limit of shadowed GDT table
-- 
2.1.0


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH] MdePkg NASM Thunk16: Work around NASM 2.09.04 - 2.10rc1 bug

2014-09-03 Thread Jordan Justen
Without this change, NASM 2.09.04 will hang with OVMF+CSM on both IA32
and X64.

Tested on OVMF+CSM on GCC49 with NASM 2.07, 2.09.04 and 2.11.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen 
Cc: Mike Maslenkin 
---
 MdePkg/Library/BaseLib/Ia32/Thunk16.nasm | 6 +-
 MdePkg/Library/BaseLib/X64/Thunk16.nasm  | 6 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm 
b/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
index e8468a3..e3d0d4e 100644
--- a/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
+++ b/MdePkg/Library/BaseLib/Ia32/Thunk16.nasm
@@ -85,7 +85,11 @@ _BackFromUserCode:
 BITS16
 pushss
 pushcs
-o32 calldword .Base ; push eip
+;
+; Note: We can't use o32 on the next instruction because of a bug
+; in NASM 2.09.04 through 2.10rc1.
+;
+calldword .Base ; push eip
 .Base:
 pushfd
 cli ; disable interrupts
diff --git a/MdePkg/Library/BaseLib/X64/Thunk16.nasm 
b/MdePkg/Library/BaseLib/X64/Thunk16.nasm
index 6084fac..7c4a8d3 100644
--- a/MdePkg/Library/BaseLib/X64/Thunk16.nasm
+++ b/MdePkg/Library/BaseLib/X64/Thunk16.nasm
@@ -83,7 +83,11 @@ _BackFromUserCode:
 BITS16
 pushss
 pushcs
-o32 calldword .Base ; push eip
+;
+; Note: We can't use o32 on the next instruction because of a bug
+; in NASM 2.09.04 through 2.10rc1.
+;
+calldword .Base ; push eip
 .Base:
 pushdword 0 ; reserved high order 32 bits of EFlags
 pushfd
-- 
2.1.0


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] Warning C4244 causes build failure with older Microsoft compilers

2014-09-03 Thread Scott Duplichan
Laszlo Ersek [mailto:ler...@redhat.com] wrote:



]You wanted to write "&" rather than "&&", but this mistake only makes
]your point more clear. :)

Oh, you are certainly right. I did mess that up. Here is a revised test.
I also added one more test case, along with gcc -Wconversion results. The
gcc -Wconversion addition is because Liming asked about it. I will put
details about gcc -Wconversion in the response to his email.


#if defined (__GNUC__)
#include 
#else
#define uint8_t  unsigned __int8
#define uint16_t unsigned __int16
#define uint32_t unsigned __int32
#define uint64_t unsigned __int64
#endif
uint8_t test1 (int x) {return !x;}
uint8_t test2 (int x) {return x == 1;}
uint8_t test3 (int x) {return x && 1;}
uint32_t test4 (uint64_t x) {return x >> 32;}
uint32_t test5 (uint64_t x) {return x & 0x;}
enum {a=1, b=2}; uint16_t test6 (int x) {return x ? a : b;}
uint8_t  test7 (uint8_t a, uint8_t b) {return a + b;}

/*
W A R N I N G   C O U N T S
Tool chain test1  test2  test3  test4  test5  test6  test7
DDK3790 /W4  1  1  1  1  1  1  0
VS2003  /W4  1  1  1  1  1  1  0
VS2005  /W4  1  1  1  1  1  0  0
VS2008  /W4  0  0  0  0  0  0  0
VS2010  /W4  0  0  0  0  0  0  0
VS2012  /W4  0  0  0  0  0  0  0
VS2013  /W4  0  0  0  0  0  0  0
gcc430 -Wconversion  1  1  1  1  1  1  1
gcc490 -Wconversion  0  0  0  1  0  0  1




]I'd appreciate if such a patch was applied.
]
]Thanks
]Laszlo

OK, your vote is to remove Microsoft C4244 from VS2005 and older.
See my response to Liming's comments for more discussion.

Thanks,
Scott

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] HII ORDERED_LIST support

2014-09-03 Thread Tim Lewis
Eric -

Here is what I am thinking: we can extend the UEFI specification (which I will 
do in a separate ECR), to allow either the UINT8 or the BUFFER value for 
"option" and "default" If UINT8, then it will work on a single container. If 
BUFFER then it works on all containers. It may take me a week (after IDF) to 
get the ECR written for UEFI.

I think that if we document this behavior, it will be useful.

Are there any other question types where there are multiple value types 
possible? Obviously UINTx. How about CHECKBOX with integer? Or NUMERIC with 
BOOLEAN? Just thinking ahead.

Tim

From: Dong, Eric [mailto:eric.d...@intel.com]
Sent: Tuesday, September 02, 2014 10:45 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] HII ORDERED_LIST support

After internal discussion, we agree default opcode can support ordered list 
opcode, I will follow up to enable it.

For your proposal, item 2 I think it's not an acceptable proposal, take below 
code for example:
  orderedlist
varid   = MyIfrNVData.BootOrder,
prompt  = STRING_TOKEN(0x006D),
help= STRING_TOKEN(0x0059),
option text = STRING_TOKEN(0x006F), value = 2, flags = 0;
option text = STRING_TOKEN(0x006E), value = 1, flags = DEFAULT;
option text = STRING_TOKEN(0x0070), value = 3, flags = 0;
  endlist;
normally, we can see option 2/option 1/option 3 for this ordered list. But base 
on your proposal, the default for this ordered list opcode is option 1/option 
1/option 1, do you think  this is an valid ordered list result? I think if 
DEFAULT flag is set, we can just skip this flag. We can use default opcode to 
set default for ordered list opcode.

For your proposal, I think you can submit an ECR for it.

Thanks,
Eric
From: Tim Lewis [mailto:tim.le...@insyde.com]
Sent: Wednesday, September 03, 2014 10:24 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] HII ORDERED_LIST support

Again, these are EDK2 decisions. They are not limitations of the specification. 
The UEFI specification does not indicate that the EFI_IFR_ONE_OF_OPTION default 
flag cannot work for ordered list. The UEFI specification does not say that 
there is any limitation to the default opcode. It does not say that 
EFI_IFR_TYPE_BUFFER cannot be used.   These are EDK2 and VFR limitations, not 
specification limits.

So, that is why I made the proposal below: to try and clarify the behavior if 
these exist based on the UEFI specification language.

Tim

From: Dong, Eric [mailto:eric.d...@intel.com]
Sent: Tuesday, September 02, 2014 7:10 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] HII ORDERED_LIST support

For ordered list opcode, we not support set default flags in the option field. 
It is useful for oneof opcode not for ordered list opcode. Also I think your 
proposal of item 2) also not acceptable. We not support set default value 
through option for ordered list opcode.

The value for ordered list opcode is buffer type, but the default opcode not 
support save buffer type value(The EFI_IFR_TYPE_VALUE not support buffer type), 
so the default opcode can't be used by ordered list opcode.
[cid:image001.jpg@01CFC756.016ED7B0]

[cid:image002.jpg@01CFC756.016ED7B0]

Current for ordered list opcode, browser based on the current option order nest 
in this question to set the default value for it.
From: Tim Lewis [mailto:tim.le...@insyde.com]
Sent: Wednesday, September 03, 2014 5:32 AM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] HII ORDERED_LIST support

Eric -

I believe that what you say is useful. But I don't think the specification 
describes that behavior.

The next question, which was asked by someone else on the EDK2 list, is what to 
do with "default" Both the flag for the "option" and the separate "default" 
opcode. The "just the value for the one container" does not seem like a good 
usage for default, since normally the engineer would like to saw the default 
values for all containers. But if "option" is for 1 container, then how does 
that work for default?

So here is a proposal for a clarification I would like to see in the UEFI 
specification:


1)  That, for ordered list, the "option values" should refer to a single 
container.

2)  When setting the default value using "option" then all containers will 
be filled with that value.

3)  When setting the default value using "default" then the "value" will be 
a Buffer type, with one byte of the Buffer per container. If the default value 
is smaller than the Buffer size, then the remaining containers will be filled 
with 0.

Tim


From: Dong, Eric [mailto:eric.d...@intel.com]
Sent: Monday, September 01, 2014 6:40 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] HII ORDERED_LIST support

T

Re: [edk2] Warning C4244 causes build failure with older Microsoft compilers

2014-09-03 Thread Scott Duplichan
Gao, Liming [mailto:liming@intel.com] wrote:


]Scott:
]  1. Could we enable this option in GCC to make it same to Microsoft?

Enabling gcc -Wconversion is certainly an option. The big challenge with
doing so is this: The operation of both the gcc and Microsoft version of
this warning have been refined and improved over the years. Here is some
discussion about the gcc version of this warning:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40752 
Here are examples of discrepancies with this warning for various compilers:

#if defined (__GNUC__)
#include 
#else
#define uint8_t  unsigned __int8
#define uint16_t unsigned __int16
#define uint32_t unsigned __int32
#define uint64_t unsigned __int64
#endif
uint8_t test1 (int x) {return !x;}
uint8_t test2 (int x) {return x == 1;}
uint8_t test3 (int x) {return x && 1;}
uint32_t test4 (uint64_t x) {return x >> 32;}
uint32_t test5 (uint64_t x) {return x & 0x;}
enum {a=1, b=2}; uint16_t test6 (int x) {return x ? a : b;}
uint8_t  test7 (uint8_t a, uint8_t b) {return a + b;}

/*
W A R N I N G   C O U N T S
Tool chain test1  test2  test3  test4  test5  test6  test7
DDK3790 /W4  1  1  1  1  1  1  0
VS2003  /W4  1  1  1  1  1  1  0
VS2005  /W4  1  1  1  1  1  0  0
VS2008  /W4  0  0  0  0  0  0  0
VS2010  /W4  0  0  0  0  0  0  0
VS2012  /W4  0  0  0  0  0  0  0
VS2013  /W4  0  0  0  0  0  0  0
gcc430 -Wconversion  1  1  1  1  1  1  1
gcc490 -Wconversion  0  0  0  1  0  0  1

Test7 shows that gcc -Wconversion adds a new warning case not present in any
Microsoft compiler. Because of this, enabling gcc -Wconversion might create
new gcc build fails to fix. I have not tried gcc -Wconversion on EDK2 yet.


]  2. Seemly, there is the warning C4344 problem in older Microsoft compilers. 
But, ]this warning can detect the real case.  Now,
there are few failure cases. How about ]fix them all?

I think I understand what you are saying. In other words, "how about work around
the cases that fail with older Microsoft compilers?" I think the biggest problem
with doing so is knowing when the old Microsoft tools fail. We could 'fix' them
all today. But what about for future code? Apparently few of the developers here
use the older Microsoft tools. It would help if someone would setup an automated
build server that runs all supported compilers.

Just to make it clear, I really believe warning C4244 should be removed
entirely. But I am not going to argue for this because I don't think I
can convince enough people. Here is my argument against Microsoft warning
C4244 for anyone interested:
http://notabs.org/coding/warningLevel4.htm

Here is a list of possible resolutions:

Microsoft compiler   GCC compiler
1   Disable C4244 for VS2005 and older   no change
2   Disable C4244 for VS2005 and older   enable -Wconversion
3   no changeenable -Wconversion
4   Disable C4244, all versions  no change


pros and cons: 
Disable C4244 for VS2005 and older solves the problem without code changes.
Adding gcc -Wconversion lets gcc developers produce better Microsoft 
compatibility.
Adding gcc -Wconversion may create a few new warnings in the gcc build.
Eliminating C4244 entirely increases code portability.

Thanks,
Scott

]Thanks
]Liming


-Original Message-
From: Scott Duplichan [mailto:sc...@notabs.org] 
Sent: Wednesday, September 03, 2014 12:40 PM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] Warning C4244 causes build failure with older Microsoft 
compilers

EDK2 builds with 'warning level 4' when using Microsoft tools. For the most 
part, that enables desirable warnings similar to those
provided by gcc -Wall. There is one major difference though, Microsoft warning 
level
4 warns about the routine practice of assigning a larger size integer to a 
smaller size integer. The Microsoft warning looks like:

warning C4244: conversion from 'UINT32' to 'UINT8', possible loss of data

Gcc has a warning option that is similar to Microsoft C4244: -WConversion But 
the gcc option -Wall does _not_ enable -Wconversion.
In fact, gcc option -Wextra doesn't even enable -Wconversion. That suggests 
that -Wconversion is a specialty warning not suitable
for general use. EDK2 gcc builds do not enable -Wconversion.

I think Microsoft warning C4244 (and similar) should be removed from
EDK2 so that Microsoft warning settings are more consistent with gcc warning 
settings. But that might be a difficult change to push
through.
While it would be interesting to see what others think, completely removing 
Microsoft Warning C4244 is a discussion for another day.

The immediate problem should be a lot easier to get agreement on. The pro

Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to MdeModulePkg

2014-09-03 Thread Olivier Martin
Ruiyi/Feng, any update on this one?

Now people are porting file system to EDK2, exposing this library to a
common package (instead of ShellPkg) could avoid code duplication across the
repository.

The reason I am pinging this thread is that we are actually looking at
removing some of our code duplication in some of our file system protocol
implementations using this library.

> -Original Message-
> From: Olivier Martin [mailto:olivier.mar...@arm.com]
> Sent: 15 August 2014 09:40
> To: 'Ni, Ruiyu'; edk2-devel@lists.sourceforge.net; Tian, Feng
> Cc: Brendan Jackman
> Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> MdeModulePkg
> 
> I am quite happy to make some change to this library if Jaben agrees
> with
> this change. But this patch only moves the existing BasePathLib from
> one
> package to another one.
> 
> Olivier
> 
> > -Original Message-
> > From: Ni, Ruiyu [mailto:ruiyu...@intel.com]
> > Sent: 15 August 2014 06:23
> > To: edk2-devel@lists.sourceforge.net; Tian, Feng; Olivier Martin
> > Cc: Brendan Jackman
> > Subject: RE: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> > MdeModulePkg
> >
> > I think maybe PathCleanUpDirectories is not a good name to describe
> > this API's behavior. It's a API to normalize the file path but do
> > nothing to the directory content. Would "PathNormalize" be better?
> >
> > -Original Message-
> > From: Carsey, Jaben [mailto:jaben.car...@intel.com]
> > Sent: Friday, August 15, 2014 4:41 AM
> > To: edk2-devel@lists.sourceforge.net; Tian, Feng; Olivier Martin
> > (olivier.mar...@arm.com)
> > Cc: Brendan Jackman
> > Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> > MdeModulePkg
> >
> > Reviewed-by: Jaben Carsey 
> >
> > I didn't notice this email originally. I think that this looks like a
> > good change.  What other feedback are you hoping for?
> >
> > -Jaben
> >
> >
> > > -Original Message-
> > > From: Olivier Martin [mailto:olivier.mar...@arm.com]
> > > Sent: Thursday, August 14, 2014 12:06 PM
> > > To: edk2-devel@lists.sourceforge.net; Tian, Feng
> > > Cc: Brendan Jackman
> > > Subject: Re: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> > > MdeModulePkg
> > >
> > > Any feedback on this one?
> > >
> > > Thanks,
> > > Olivier
> > >
> > > > -Original Message-
> > > > From: Olivier Martin [mailto:olivier.mar...@arm.com]
> > > > Sent: 24 March 2014 20:23
> > > > To: feng.t...@intel.com
> > > > Cc: Brendan Jackman; edk2-devel@lists.sourceforge.net
> > > > Subject: [edk2] [PATCH 1/3] Move BasePathLib from ShellPkg to
> > > > MdeModulePkg
> > > >
> > > > From: Brendan Jackman 
> > > >
> > > > This library is useful to other modules than the shell - for
> > example
> > > > filesystem drivers.
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > > Signed-off-by: Brendan Jackman 
> > > > Reviewed-by: Olivier Martin 
> > > > ---
> > > >  AppPkg/AppPkg.dsc|   2 +-
> > > >  EmulatorPkg/EmulatorPkg.dsc  |   2 +-
> > > >  MdeModulePkg/Include/Library/PathLib.h   |  56
> +++
> > > >  MdeModulePkg/Library/BasePathLib/BasePathLib.c   | 123
> > > > +++
> > > >  MdeModulePkg/Library/BasePathLib/BasePathLib.inf |  38 +++
> > > >  OvmfPkg/OvmfPkgIa32.dsc  |   2 +-
> > > >  OvmfPkg/OvmfPkgIa32X64.dsc   |   2 +-
> > > >  OvmfPkg/OvmfPkgX64.dsc   |   2 +-
> > > >  ShellPkg/Include/Library/PathLib.h   |  56 -
> --
> > > >  ShellPkg/Library/BasePathLib/BasePathLib.c   | 123 -
> --
> > 
> > > > 
> > > >  ShellPkg/Library/BasePathLib/BasePathLib.inf |  38 ---
> > > >  ShellPkg/ShellPkg.dsc|   2 +-
> > > >  StdLib/StdLib.dsc|   2 +-
> > > >  StdLib/StdLib.inc|   2 +-
> > > >  14 files changed, 225 insertions(+), 225 deletions(-)  create
> mode
> > > > 100644 MdeModulePkg/Include/Library/PathLib.h
> > > >  create mode 100644
> MdeModulePkg/Library/BasePathLib/BasePathLib.c
> > > >  create mode 100644
> > MdeModulePkg/Library/BasePathLib/BasePathLib.inf
> > > >  delete mode 100644 ShellPkg/Include/Library/PathLib.h
> > > >  delete mode 100644 ShellPkg/Library/BasePathLib/BasePathLib.c
> > > >  delete mode 100644 ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > >
> > > > diff --git a/AppPkg/AppPkg.dsc b/AppPkg/AppPkg.dsc index
> > > > d0aac2c..491332a 100644
> > > > --- a/AppPkg/AppPkg.dsc
> > > > +++ b/AppPkg/AppPkg.dsc
> > > > @@ -82,7 +82,7 @@
> > > >ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> > > >
> > > >
> >
> FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
> > > >SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf
> > > > -  PathLib|ShellPkg/Library/BasePathLib/BasePathLib.inf
> > > > +  PathLib|MdeModulePkg/Library/BasePathLib/Bas

Re: [edk2] "UEFI Driver creation failed" in the UEFI Driver Wizard application

2014-09-03 Thread Richardson, Brian
Need more information ... but first, make sure you have a setup a valid 
EDKII/UDK2010 workspace before trying to build a driver.

Thanks ... br
---
Brian Richardson -- brian.richard...@intel.com -- Twitter: intel_brian

From: Toto Lebolo [mailto:toto_leb...@yahoo.com]
Sent: Tuesday, September 02, 2014 3:24 PM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] "UEFI Driver creation failed" in the UEFI Driver Wizard 
application

I could not make this work. I am trying to create a simple driver.
Anybody can help?
MiKL~
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] Getting Started UEFI driver on Minnowboard

2014-09-03 Thread Richardson, Brian
Check out the UEFI Driver Wizard on tianocore.
http://tianocore.sourceforge.net/wiki/UEFI_Driver_Wizard 

Thanks ... br
---
Brian Richardson -- brian.richard...@intel.com -- Twitter: intel_brian

-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Tuesday, September 02, 2014 7:04 PM
To: Toto Lebolo; edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] Getting Started UEFI driver on Minnowboard

On 09/03/14 00:43, Toto Lebolo wrote:
> I would like to write a device driver on Minnowboard to access 
> hardware resources. Is there a sample code to start with? I've tried 
> the BlankDrv for nt32 from Intel but it doesn't seems to work fine on the 
> minnowboard.
> Any suggestion is welcome.

http://www.uefi.org/specifications
https://github.com/tianocore/tianocore.github.io/wiki/Driver-Developer
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-User-Documentation
https://github.com/tianocore/tianocore.github.io/wiki/UEFI-EDKII-Learning-Dev
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Specifications

The UEFI Driver Writer's Guide is especially good.

Laszlo


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] [PATCH] MdePkg BaseLib NASM Thunk16: Initialize _16GdtrBase to 0

2014-09-03 Thread Sergey Isakov
Hi sirs,
In commit 16024 you forget to set 
ASM_PFX(InternalAsmThunk16)
in two places

Sergey

On 01.09.2014, at 16:28, Sergey Isakov wrote:

> 
> On 01.09.2014, at 14:58, Paolo Bonzini wrote:
> 
>> Il 31/08/2014 20:23, Sergey Isakov ha scritto:
>>> Clang assembler doesn’t support 16 bit codes.
>> 
>> (please don't top-post)
>> 
>> Does Apple not ship gas anymore and replaces it with clang's integrated
>> assembler?
> Yes, does not ship
> -bash: gas: command not found
>> 
>> In either case, how the clang folks can say "use the clang integrated
>> assembler and file bugs" with a straight face when asked to upgrade
>> NASM?  This is not a bug that would have to be filed, it's a substantial
>> feature request...
> This discussion began from the problem of Thunk16.S that contains db codes 
> instead of real assembler mnemonic.
> The instruction .code16 can't be compiled with clang integrated assembler.
> Switching to nasm may resolve this problem as well as possiblity to use the 
> same sources for all OSes. 
>> 
>> Paolo
>> 
>>> On 31 авг. 2014 г., at 20:16, Paolo Bonzini  wrote:
>>> 
 Il 30/08/2014 08:47, Jordan Justen ha scritto:
> All,
> 
> Sergey reported that XCLANG was able to build and link with my latest
> version. (Apparently he still has issues booting OVMF, but I don't
> think it is specifically due to NASM Thunk16.)
> 
> Therefore, I'll commit the NASM series now with Liming's r-b.
> 
> I'll send out a separate email noting that NASM 2.07 or newer will now
> be required for building BaseLib for IA32 & X64 (except Visual Studio
> and ICC).
 
 Out of curiosity, what's the reason for converting to NASM?  gas
 supports both Intel syntax and 16-bit code.
 
 Paolo
 
 
 --
 Slashdot TV.  
 Video for Nerds.  Stuff that matters.
 http://tv.slashdot.org/
 ___
 edk2-devel mailing list
 edk2-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/edk2-devel
>>> 
>>> 
>>> --
>>> Slashdot TV.  
>>> Video for Nerds.  Stuff that matters.
>>> http://tv.slashdot.org/
>>> ___
>>> edk2-devel mailing list
>>> edk2-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
>>> 
>> 
>> 
>> --
>> Slashdot TV.  
>> Video for Nerds.  Stuff that matters.
>> http://tv.slashdot.org/
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/edk2-devel
> 
> 
> --
> Slashdot TV.  
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> ___
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH v6 17/23] ArmVirtualizationPkg: add device tree based PL011 SerialPortLib

2014-09-03 Thread Ard Biesheuvel
This adds 2 implementations of SerialPortLib for device tree based platforms
using a PL011 UART:
- an 'early' one which is completely stateless and uses only fixed PCDs
- a normal one which takes its base address from a potentially dynamic
  PcdPL011BaseAddress PCD

A NULL SerialPortExtLib instance is also provided.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 .../ArmVirtualizationPkg/ArmVirtualizationPkg.dec  |   1 +
 .../EarlyFdtPL011SerialPortLib.c   | 186 +
 .../EarlyFdtPL011SerialPortLib.inf |  45 +
 .../FdtPL011SerialPortLib/FdtPL011SerialPortLib.c  | 145 
 .../FdtPL011SerialPortLib.inf  |  50 ++
 .../FdtPL011SerialPortLib/NullSerialPortExtLib.c   |  47 ++
 .../FdtPL011SerialPortLib/NullSerialPortExtLib.inf |  30 
 7 files changed, 504 insertions(+)
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.inf
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.c
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/FdtPL011SerialPortLib.inf
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/NullSerialPortExtLib.c
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/NullSerialPortExtLib.inf

diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec 
b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec
index 8d51182d716b..37f00a29bf1e 100644
--- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec
@@ -44,3 +44,4 @@
 
 [PcdsDynamic,PcdsFixedAtBuild]
   
gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeBaseAddress|0x0|UINT64|0x0002
+  gArmVirtualizationTokenSpaceGuid.PcdPL011BaseAddress|0x0|UINT64|0x0003
diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
new file mode 100644
index ..67c80003bde5
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/FdtPL011SerialPortLib/EarlyFdtPL011SerialPortLib.c
@@ -0,0 +1,186 @@
+/** @file
+  Serial I/O Port library functions with base address discovered from FDT
+
+  Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
+  Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.
+  Copyright (c) 2014, Linaro Ltd. 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.
+
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+RETURN_STATUS
+EFIAPI
+SerialPortInitialize (
+  VOID
+  )
+{
+  //
+  // This SerialPortInitialize() function is completely empty, for a number of
+  // reasons:
+  // - if we are executing from flash, it is hard to keep state (i.e., store 
the
+  //   discovered base address in a global), and the most robust way to deal
+  //   with this is to discover the base address at every Write ();
+  // - calls to the Write() function in this module may be issued before this
+  //   initialization function is called: this is not a problem when the base
+  //   address of the UART is hardcoded, and only the baud rate may be wrong,
+  //   but if we don't know the base address yet, we may be poking into memory
+  //   that does not tolerate being poked into;
+  // - SEC and PEI phases produce debug output only, so with debug disabled, no
+  //   initialization (or device tree parsing) is performed at all.
+  //
+  // Note that this means that on *every* Write () call, the device tree will 
be
+  // parsed and the UART re-initialized. However, this is a small price to pay
+  // for having serial debug output on a UART with no fixed base address.
+  //
+  return RETURN_SUCCESS;
+}
+
+STATIC
+UINT64
+SerialPortGetBaseAddress (
+  VOID
+  )
+{
+  UINT64  BaudRate;
+  UINT32  ReceiveFifoDepth;
+  EFI_PARITY_TYPE Parity;
+  UINT8   DataBits;
+  EFI_STOP_BITS_TYPE  StopBits;
+  VOID*DeviceTreeBase;
+  INT32   Node, Prev;
+
+  DeviceTreeBase = (VOID *)(UINTN)FixedPcdGet64 
(PcdDeviceTreeInitialBaseAddress);
+
+  if (DeviceTreeBase == NULL || fdt_check_header (DeviceTreeBase) != 0) {
+return 0;
+  }
+
+  //
+  // Enumerat

[edk2] [PATCH v6 19/23] ArmVirtualizationPkg: add ArmVirtualizationPlatformLib library

2014-09-03 Thread Ard Biesheuvel
This is an implementation of ArmPlatformLib that discovers the size of system
DRAM from a device tree blob located at the address passed in
gArmTokenSpaceGuid.PcdDeviceTreeBaseAddress, which should equal the value in
gArmTokenSpaceGuid.PcdSystemMemoryBase.

As the device tree blob is passed in system DRAM, this library can only be used
if sufficient DRAM is available (>= 128 MB) and if not using shadowed NOR. The
reason for this is that it makes it easier to guarantee that such a device tree
blob at base of DRAM will not be clobbered before we get a chance to preserve 
it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Casadevall 
Signed-off-by: Ard Biesheuvel 
---

Added detection of PL011 UART base address, improved comments, removed unused
functions and fixed whitespace issues. Also uses PcdDeviceTreeInitialBaseAddress
now not PcdDeviceTreeBaseAddress


 .../AARCH64/VirtHelper.S   |  86 ++
 .../ArmVirtualizationPlatformLib/ARM/VirtHelper.S  |  74 
 .../ArmVirtualizationPlatformLib.inf   |  63 +++
 .../Library/ArmVirtualizationPlatformLib/Virt.c| 189 +
 .../Library/ArmVirtualizationPlatformLib/VirtMem.c | 107 
 5 files changed, 519 insertions(+)
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/AARCH64/VirtHelper.S
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ARM/VirtHelper.S
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ArmVirtualizationPlatformLib.inf
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/Virt.c
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/VirtMem.c

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/AARCH64/VirtHelper.S
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/AARCH64/VirtHelper.S
new file mode 100644
index ..14200fc17b3e
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/AARCH64/VirtHelper.S
@@ -0,0 +1,86 @@
+#
+#  Copyright (c) 2011-2013, ARM Limited. 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.
+#
+#
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+.text
+.align 2
+
+GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
+GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
+GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
+GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
+GCC_ASM_EXPORT(ArmGetPhysAddrTop)
+
+GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
+GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
+GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)
+
+ASM_PFX(ArmPlatformPeiBootAction):
+  ret
+
+//UINTN
+//ArmPlatformGetPrimaryCoreMpId (
+//  VOID
+//  );
+ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
+  LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)
+  ldrh   w0, [x0]
+  ret
+
+//UINTN
+//ArmPlatformIsPrimaryCore (
+//  IN UINTN MpId
+//  );
+ASM_PFX(ArmPlatformIsPrimaryCore):
+  mov   x0, #1
+  ret
+
+//UINTN
+//ArmPlatformGetCorePosition (
+//  IN UINTN MpId
+//  );
+// With this function: CorePos = (ClusterId * 4) + CoreId
+ASM_PFX(ArmPlatformGetCorePosition):
+  and   x1, x0, #ARM_CORE_MASK
+  and   x0, x0, #ARM_CLUSTER_MASK
+  add   x0, x1, x0, LSR #6
+  ret
+
+//EFI_PHYSICAL_ADDRESS
+//GetPhysAddrTop (
+//  VOID
+//  );
+ASM_PFX(ArmGetPhysAddrTop):
+  mrs   x0, id_aa64mmfr0_el1
+  adr   x1, .LPARanges
+  and   x0, x0, #7
+  ldrb  w1, [x1, x0]
+  mov   x0, #1
+  lsl   x0, x0, x1
+  ret
+
+//
+// Bits 0..2 of the AA64MFR0_EL1 system register encode the size of the
+// physical address space supported on this CPU:
+// 0 == 32 bits, 1 == 36 bits, etc etc
+// 6 and 7 are reserved
+//
+.LPARanges:
+  .byte 32, 36, 40, 42, 44, 48, -1, -1
+
+ASM_FUNCTION_REMOVE_IF_UNREFERENCED
diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ARM/VirtHelper.S
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ARM/VirtHelper.S
new file mode 100644
index ..255f99598740
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformLib/ARM/VirtHelper.S
@@ -0,0 +1,74 @@
+#
+#  Copyright (c) 2011-2013, ARM Limited. All rights reserved.
+#  Copyright (c) 2014, Linaro Limited. All rights reserved.
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD 
Li

[edk2] [PATCH v6 23/23] ArmVirtualizationPkg: add ArmVirtualizationQemu platform

2014-09-03 Thread Ard Biesheuvel
This adds support for executing UEFI in a QEMU/mach-virt emulated environment.
The following assumptions are made about the target:
- DRAM base at 0x4000_, containing the device tree blob
- DRAM size at least 1 MB
- device tree uses 64-bit physical base addresses and sizes
- ARM architected timer
- Cortex-A15 CPU (if built for 32-bit)

The following information is retrieved from the device tree:
- PL011 UART base address
- GIC base addresses
- virtual timer interrupt
- PL031 RTC base address
- DRAM size, must be at least 128 MB
- virtio MMIO transports
- PSCI 0.2 availability (for reset and poweroff)

The device tree image is relocated and installed as a configuration table
so an EFI stub enabled kernel can be booted directly without the need for
a bootloader.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Casadevall 
Signed-off-by: Ard Biesheuvel 
---

Lots of changes resulting from all the changes in the previous patches, i.e.,
renamed PCDs, new libraries, library overrides to support the dynamic PL011
base address etc etc.

 .../ArmVirtualizationPkg/ArmVirtualization.dsc.inc | 335 +
 .../ArmVirtualizationPkg/ArmVirtualizationQemu.dsc | 265 
 .../ArmVirtualizationPkg/ArmVirtualizationQemu.fdf | 334 
 3 files changed, 934 insertions(+)
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.dsc
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationQemu.fdf

diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc 
b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
new file mode 100644
index ..ff38b768fc80
--- /dev/null
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc
@@ -0,0 +1,335 @@
+#
+#  Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+#  Copyright (c) 2014, Linaro Limited. 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. 
+#
+#
+
+[LibraryClasses.common]
+!if $(TARGET) == RELEASE
+  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+  
UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
+!else
+  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+  
UncachedMemoryAllocationLib|ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf
+!endif
+  
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
+  
+  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+  
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+  
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+  PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+  IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+  
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+
+  UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+  
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+  
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+  
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+  HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+  
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
  
+
+  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+
+  #
+  # Allow dynamic PCDs
+  #
+  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  
+  # 1/123 faster than Stm or Vstm version
+  #BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  BaseMemoryLib|ArmPkg/Library/BaseMemoryLibStm/BaseMemoryLibStm.inf
+
+  # Networking Requirements
+  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+  DpcLib|MdeModuleP

[edk2] [PATCH v6 21/23] ArmVirtualizationPkg: add PlatformPeiLib library

2014-09-03 Thread Ard Biesheuvel
This is a fork of the ARM PlatformPeiLib for virtual machines. The main
purpose of having this specific implementation is that it allows us to
preserve the device tree blob if it was passed to us in system DRAM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---

Removed the 'Reviewed-by: Laszlo Ersek ' as this module was
changed to load the device tree from PcdDeviceTreeInitialBaseAddress, but store
the new offset in PcdDeviceTreeBaseAddress (as before).



 .../Library/PlatformPeiLib/PlatformPeiLib.c| 47 +
 .../Library/PlatformPeiLib/PlatformPeiLib.inf  | 48 ++
 2 files changed, 95 insertions(+)
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c
new file mode 100644
index ..41d506cf717f
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c
@@ -0,0 +1,47 @@
+/** @file
+*
+*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+*  Copyright (c) 2014, Linaro Limited. 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.
+*
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+EFI_STATUS
+EFIAPI
+PlatformPeim (
+  VOID
+  )
+{
+  VOID   *Base;
+  VOID   *NewBase;
+  UINTN  FdtSize;
+
+  Base = (VOID*)(UINTN)FixedPcdGet64 (PcdDeviceTreeInitialBaseAddress);
+  ASSERT (fdt_check_header (Base) == 0);
+
+  FdtSize = fdt_totalsize (Base);
+  NewBase = AllocatePages (EFI_SIZE_TO_PAGES (FdtSize));
+  ASSERT (NewBase != NULL);
+
+  CopyMem (NewBase, Base, FdtSize);
+  PcdSet64 (PcdDeviceTreeBaseAddress, (UINT64)(UINTN)NewBase);
+
+  BuildFvHob (PcdGet32(PcdFvBaseAddress), PcdGet32(PcdFvSize));
+
+  return EFI_SUCCESS;
+}
diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf
new file mode 100644
index ..e544b528d261
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf
@@ -0,0 +1,48 @@
+#/** @file
+#
+#  Copyright (c) 2011-2012, ARM Limited. All rights reserved.
+#  Copyright (c) 2014, Linaro Limited. 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = PlatformPeiLib
+  FILE_GUID  = 59C11815-F8DA-4F49-B4FB-EC1E41ED1F06
+  MODULE_TYPE= SEC
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PlatformPeiLib
+
+[Sources]
+  PlatformPeiLib.c
+
+[Packages]
+  ArmPkg/ArmPkg.dec
+  ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  EmbeddedPkg/EmbeddedPkg.dec
+
+[LibraryClasses]
+  DebugLib
+  HobLib
+  FdtLib
+
+[FixedPcd]
+  gArmTokenSpaceGuid.PcdFvBaseAddress
+  gArmTokenSpaceGuid.PcdFvSize
+  gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress
+
+[Pcd]
+  gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeBaseAddress
+
+[Depex]
+  gEfiPeiMemoryDiscoveredPpiGuid
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH v6 20/23] ArmVirtualizationPkg: add ArmVirtualizationPlatformSysConfigLib library

2014-09-03 Thread Ard Biesheuvel
This introduces an implementation of ArmPlatformSysConfigLib for virtual
machines. This is currently a stub, but some peripheral drivers (such as
the PL031 RTC driver) rely on one to be available.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Casadevall 
Acked-by: Laszlo Ersek 
Signed-off-by: Ard Biesheuvel 
---

Trivial changes only

 .../ArmVirtualizationPlatformSysConfigLib.c| 87 ++
 .../ArmVirtualizationPlatformSysConfigLib.inf  | 31 
 2 files changed, 118 insertions(+)
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformSysConfigLib/ArmVirtualizationPlatformSysConfigLib.c
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformSysConfigLib/ArmVirtualizationPlatformSysConfigLib.inf

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformSysConfigLib/ArmVirtualizationPlatformSysConfigLib.c
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformSysConfigLib/ArmVirtualizationPlatformSysConfigLib.c
new file mode 100644
index ..0aa173d79834
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformSysConfigLib/ArmVirtualizationPlatformSysConfigLib.c
@@ -0,0 +1,87 @@
+/** @file
+
+  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.
+  Copyright (c) 2014, Linaro Ltd. 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.
+
+**/
+
+#include 
+
+#include 
+
+
+RETURN_STATUS
+ArmPlatformSysConfigInitialize (
+  VOID
+  )
+{
+  return RETURN_SUCCESS;
+}
+
+/***
+ * GENERAL FUNCTION: AccessSysCfgRegister
+ * Interacts with
+ *SYS_CFGSTAT
+ *SYS_CFGDATA
+ *SYS_CFGCTRL
+ * for setting and for reading out values
+ ***/
+
+RETURN_STATUS
+AccessSysCfgRegister (
+  IN UINT32   ReadWrite,
+  IN UINT32   Function,
+  IN UINT32   Site,
+  IN UINT32   Position,
+  IN UINT32   Device,
+  IN OUT UINT32*  Data
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
+
+RETURN_STATUS
+ArmPlatformSysConfigGet (
+  IN  SYS_CONFIG_FUNCTION   Function,
+  OUT UINT32*   Value
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
+
+RETURN_STATUS
+ArmPlatformSysConfigGetValues (
+  IN  SYS_CONFIG_FUNCTION   Function,
+  IN  UINTN Size,
+  OUT UINT32*   Values
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
+
+RETURN_STATUS
+ArmPlatformSysConfigSet (
+  IN  SYS_CONFIG_FUNCTION   Function,
+  IN  UINT32Value
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
+
+RETURN_STATUS
+ArmPlatformSysConfigSetDevice (
+  IN  SYS_CONFIG_FUNCTION   Function,
+  IN  UINT32Device,
+  IN  UINT32Value
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformSysConfigLib/ArmVirtualizationPlatformSysConfigLib.inf
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformSysConfigLib/ArmVirtualizationPlatformSysConfigLib.inf
new file mode 100644
index ..2c723077e117
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPlatformSysConfigLib/ArmVirtualizationPlatformSysConfigLib.inf
@@ -0,0 +1,31 @@
+#/** @file
+#
+#  Component description file for ArmVirtualizationPlatformSysConfigLib module
+#
+#  Copyright (c) 2011-2012, ARM Ltd. All rights reserved.
+#  Copyright (c) 2014, Linaro Ltd. 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = ArmVirtualizationPlatformSysConfigLib
+  FILE_GUID  = b5988e68-a2cc-49ac-9ca8-8cc78420ae45
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = ArmPlatformSysConfigLib
+
+[Sources.common]
+  ArmVirtualizationPlatformSysConfigLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://t

[edk2] [PATCH v6 18/23] ArmVirtualizationPkg: add VirtFdtDxe driver

2014-09-03 Thread Ard Biesheuvel
This driver enumerates the device nodes in the device tree located at the
base address passed in gArmTokenSpaceGuid.PcdDeviceTreeBaseAddress, and
installs drivers for devices it cares about (GIC interrupt controller, RTC,
architected timer interrupt)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---

Removed 'Reviewed-by: Laszlo Ersek ': added detection of PSCI
device node in the device tree for reset and poweroff handling.

 .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c   | 282 +
 .../ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf |  61 +
 2 files changed, 343 insertions(+)
 create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.inf

diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c 
b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c
new file mode 100644
index ..25152e70b0c8
--- /dev/null
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/VirtFdtDxe/VirtFdtDxe.c
@@ -0,0 +1,282 @@
+/** @file
+*  Device tree enumeration DXE driver for ARM Virtual Machines
+*
+*  Copyright (c) 2014, Linaro Ltd. 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.
+*
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+CONST UINT32 mUint32Max = 0xU;
+
+#pragma pack (1)
+typedef struct {
+  VENDOR_DEVICE_PATH  Vendor;
+  UINT64  PhysBase;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
+} VIRTIO_TRANSPORT_DEVICE_PATH;
+#pragma pack ()
+
+typedef enum {
+  PropertyTypeUnknown,
+  PropertyTypeGic,
+  PropertyTypeRtc,
+  PropertyTypeVirtio,
+  PropertyTypeUart,
+  PropertyTypeTimer,
+  PropertyTypePsci,
+} PROPERTY_TYPE;
+
+typedef struct {
+  PROPERTY_TYPE Type;
+  CHAR8 Compatible[20];
+} PROPERTY;
+
+STATIC CONST PROPERTY CompatibleProperties[] = {
+  { PropertyTypeGic, "arm,cortex-a15-gic"  },
+  { PropertyTypeRtc, "arm,pl031"   },
+  { PropertyTypeVirtio,  "virtio,mmio" },
+  { PropertyTypeUart,"arm,pl011"   },
+  { PropertyTypeTimer,   "arm,armv7-timer" },
+  { PropertyTypeTimer,   "arm,armv8-timer" },
+  { PropertyTypePsci,"arm,psci-0.2"},
+  { PropertyTypeUnknown, ""}
+};
+
+typedef struct {
+  UINT32  Type;
+  UINT32  Number;
+  UINT32  Flags;
+} INTERRUPT_PROP;
+
+STATIC
+PROPERTY_TYPE
+GetTypeFromNode (
+  IN CONST CHAR8 *NodeType,
+  IN UINTN   Size
+  )
+{
+  CONST CHAR8 *Compatible;
+
+  //
+  // A 'compatible' node may contain a sequence of NULL terminated
+  // compatible strings so check each one
+  //
+  for (Compatible = NodeType; Compatible < NodeType + Size && *Compatible;
+   Compatible += 1 + AsciiStrLen (Compatible)) {
+
+CONST PROPERTY *CompProp;
+
+for (CompProp = CompatibleProperties; CompProp->Compatible[0]; CompProp++) 
{
+  if (AsciiStrCmp (CompProp->Compatible, Compatible) == 0) {
+return CompProp->Type;
+  }
+}
+  }
+  return PropertyTypeUnknown;
+}
+
+EFI_STATUS
+EFIAPI
+InitializeVirtFdtDxe (
+  IN EFI_HANDLE   ImageHandle,
+  IN EFI_SYSTEM_TABLE *SystemTable
+  )
+{
+  VOID *DeviceTreeBase;
+  INT32Node, Prev;
+  EFI_STATUS   Status;
+
+  DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeBaseAddress);
+  ASSERT (DeviceTreeBase != NULL);
+
+  if (fdt_check_header (DeviceTreeBase) != 0) {
+DEBUG ((EFI_D_ERROR, "%a: No DTB found @ 0x%p\n",
+   __FUNCTION__, DeviceTreeBase));
+return EFI_NOT_FOUND;
+  }
+
+  Status = gBS->InstallConfigurationTable (&gFdtTableGuid, DeviceTreeBase);
+  ASSERT_EFI_ERROR (Status);
+
+  DEBUG ((EFI_D_INFO, "%a: DTB @ 0x%p\n", __FUNCTION__, DeviceTreeBase));
+
+  //
+  // Now enumerate the nodes and install peripherals that we are interested in,
+  // i.e., GIC, RTC and virtio MMIO nodes
+  //
+  for (Prev = 0;; Prev = Node) {
+CONST CHAR8*Type;
+INT32  Len;
+PROPERTY_TYPE  PropType;
+CONST VOID *RegProp;
+VIRTIO_TRANSPORT_DEVICE_PATH   *DevicePath;
+EFI_HANDLE Handle;
+UINT64 RegBase;
+UINT64 DistBase, CpuBase;
+CONST INTERRUPT_PROP   *InterruptProp;
+INT32  SecIntrNum, IntrNum, VirtIntrNum, 
HypIntrNum;
+CONST CHAR8*Ps

[edk2] [PATCH v6 14/23] ArmVirtualizationPkg: introduce PCDs for device tree base address

2014-09-03 Thread Ard Biesheuvel
Introduce gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeBaseAddress and
PcdDeviceTreeInitialBaseAddress, which will be used by virtual machine ports
that discover the system configuration from a flattened device tree DTB image.

The latter is FixedPcd only, and should contain the initial offset of the DTB,
the former may be declared as dynamic, and updated at runtime if the DTB is
relocated before the DXE phase.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---

Moved to ArmVirtualizationPkg from ArmPkg in v5 and earlier.

 .../ArmVirtualizationPkg/ArmVirtualizationPkg.dec  | 46 ++
 1 file changed, 46 insertions(+)
 create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec

diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec 
b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec
new file mode 100644
index ..8d51182d716b
--- /dev/null
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec
@@ -0,0 +1,46 @@
+#/** @file
+#
+#  Copyright (c) 2014, Linaro Limited. 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.
+#
+#**/
+
+[Defines]
+  DEC_SPECIFICATION  = 0x00010005
+  PACKAGE_NAME   = ArmVirtualizationPkg
+  PACKAGE_GUID   = A0B31216-508E-4025-BEAB-56D836C66F0A
+  PACKAGE_VERSION= 0.1
+
+
+#
+# Include Section - list of Include Paths that are provided by this package.
+#   Comments are used for Keywords and Module Types.
+#
+# Supported Module Types:
+#  BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
+#
+
+[Includes.common]
+  Include# Root include for the package
+
+[Guids.common]
+  gArmVirtualizationTokenSpaceGuid = { 0x0B6F5CA7, 0x4F53, 0x445A, { 0xB7, 
0x6E, 0x2E, 0x36, 0x5B, 0x80, 0x63, 0x66 } }
+
+[PcdsFixedAtBuild]
+  #
+  # This is the physical address where the device tree is expected to be stored
+  # upon first entry into UEFI. This needs to be a FixedAtBuild PCD, so that we
+  # can do a first pass over the device tree in the SEC phase to discover the
+  # UART base address.
+  #
+  
gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x0|UINT64|0x0001
+
+[PcdsDynamic,PcdsFixedAtBuild]
+  
gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeBaseAddress|0x0|UINT64|0x0002
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH v6 02/23] ArmPkg: allow dynamic GIC base addresses

2014-09-03 Thread Ard Biesheuvel
Allow the PCDs gArmTokenSpaceGuid.PcdGicDistributorBase and
gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase to be redeclared
as PcdsDynamic by the platform, so virtual machines can set these
properties during boot. As the PcdGet32() calls now call into the
PCD database, cache the values that are required during the handling
of interrupts.

Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek 
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/ArmPkg.dec | 15 +++--
 ArmPkg/Drivers/ArmGic/ArmGicDxe.inf   |  3 ++-
 ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c | 37 ++-
 ArmPkg/Library/BdsLib/BdsLib.inf  |  2 +-
 4 files changed, 32 insertions(+), 25 deletions(-)

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index b0d5dadcb7c1..45c10cad76d7 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -69,6 +69,14 @@
   # Linux (instead of PSCI)
   gArmTokenSpaceGuid.PcdArmLinuxSpinTable|FALSE|BOOLEAN|0x0033
 
+[PcdsFixedAtBuild.common,PcdsDynamic.common]
+  #
+  # ARM Generic Interrupt Controller
+  #
+  gArmTokenSpaceGuid.PcdGicDistributorBase|0|UINT32|0x000C
+  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0|UINT32|0x000D
+  gArmTokenSpaceGuid.PcdGicSgiIntId|0|UINT32|0x0025
+
 [PcdsFixedAtBuild.common]
   gArmTokenSpaceGuid.PcdTrustzoneSupport|FALSE|BOOLEAN|0x0006
 
@@ -82,13 +90,6 @@
   gArmTokenSpaceGuid.PcdCpuResetAddress|0x|UINT32|0x0005
 
   #
-  # ARM Generic Interrupt Controller
-  #
-  gArmTokenSpaceGuid.PcdGicDistributorBase|0|UINT32|0x000C
-  gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0|UINT32|0x000D
-  gArmTokenSpaceGuid.PcdGicSgiIntId|0|UINT32|0x0025
-
-  #
   # ARM Secure Firmware PCDs
   #
   gArmTokenSpaceGuid.PcdSecureFdBaseAddress|0|UINT32|0x0015
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicDxe.inf 
b/ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
index 68fc640adc63..27303e57925f 100644
--- a/ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
+++ b/ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
@@ -43,12 +43,13 @@
   MemoryAllocationLib
   UefiDriverEntryPoint
   IoLib
+  PcdLib
 
 [Protocols]
   gHardwareInterruptProtocolGuid
   gEfiCpuArchProtocolGuid
 
-[FixedPcd.common]
+[Pcd.common]
   gArmTokenSpaceGuid.PcdGicDistributorBase
   gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase
 
diff --git a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c 
b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c
index 5561de630d6e..3f9e37b5f2d8 100644
--- a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c
+++ b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c
@@ -29,6 +29,9 @@ Abstract:
 
 extern EFI_HARDWARE_INTERRUPT_PROTOCOL gHardwareInterruptV2Protocol;
 
+UINT32 mGicInterruptInterfaceBase;
+UINT32 mGicDistributorBase;
+
 /**
   Enable interrupt source Source.
 
@@ -51,7 +54,7 @@ GicV2EnableInterruptSource (
 return EFI_UNSUPPORTED;
   }
 
-  ArmGicEnableInterrupt (FixedPcdGet32 (PcdGicDistributorBase), Source);
+  ArmGicEnableInterrupt (mGicDistributorBase, Source);
 
   return EFI_SUCCESS;
 }
@@ -78,7 +81,7 @@ GicV2DisableInterruptSource (
 return EFI_UNSUPPORTED;
   }
 
-  ArmGicDisableInterrupt (FixedPcdGet32 (PcdGicDistributorBase), Source);
+  ArmGicDisableInterrupt (mGicDistributorBase, Source);
 
   return EFI_SUCCESS;
 }
@@ -107,7 +110,7 @@ GicV2GetInterruptSourceState (
 return EFI_UNSUPPORTED;
   }
 
-  *InterruptState = ArmGicIsInterruptEnabled (FixedPcdGet32 
(PcdGicDistributorBase), Source);
+  *InterruptState = ArmGicIsInterruptEnabled (mGicDistributorBase, Source);
 
   return EFI_SUCCESS;
 }
@@ -135,7 +138,7 @@ GicV2EndOfInterrupt (
 return EFI_UNSUPPORTED;
   }
 
-  ArmGicV2EndOfInterrupt (FixedPcdGet32 (PcdGicInterruptInterfaceBase), 
Source);
+  ArmGicV2EndOfInterrupt (mGicInterruptInterfaceBase, Source);
   return EFI_SUCCESS;
 }
 
@@ -160,7 +163,7 @@ GicV2IrqInterruptHandler (
   UINT32  GicInterrupt;
   HARDWARE_INTERRUPT_HANDLER  InterruptHandler;
 
-  GicInterrupt = ArmGicV2AcknowledgeInterrupt (FixedPcdGet32 
(PcdGicInterruptInterfaceBase));
+  GicInterrupt = ArmGicV2AcknowledgeInterrupt (mGicInterruptInterfaceBase);
 
   // Special Interrupts (ID1020-ID1023) have an Interrupt ID greater than the 
number of interrupt (ie: Spurious interrupt).
   if ((GicInterrupt & ARM_GIC_ICCIAR_ACKINTID) >= mGicNumInterrupts) {
@@ -216,7 +219,7 @@ GicV2ExitBootServicesEvent (
 
   // Acknowledge all pending interrupts
   do {
-GicInterrupt = ArmGicV2AcknowledgeInterrupt (FixedPcdGet32 
(PcdGicInterruptInterfaceBase));
+GicInterrupt = ArmGicV2AcknowledgeInterrupt (mGicInterruptInterfaceBase);
 
 if ((GicInterrupt & ARM_GIC_ICCIAR_ACKINTID) < mGicNumInterrupts) {
   GicV2EndOfInterrupt (&gHardwareInterruptV2Protocol, GicInterrupt);
@@ -224,10 +227,10 @@ GicV2ExitBootServicesEvent (
   } while (!ARM_GIC_IS_SPECIAL_INTERRUPTS (GicInterrupt));
 
   // Disable Gic Interface
-  ArmGicV2DisableInterruptInterface (FixedPcdGet32 
(PcdGicInterruptInterfaceBase));
+  ArmGicV2Disabl

[edk2] [PATCH v6 05/23] ArmPkg: rename ArmArchTimerLib.h to ArmArchTimer.h

2014-09-03 Thread Ard Biesheuvel
The ArmArchTimerLib.h include file is not directly related to the TimerLib
instance ArmArchTimerLib, so the name is confusing. Rename to ArmArchTimer.h
instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c | 2 +-
 ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c | 2 +-
 ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c | 2 +-
 ArmPkg/Drivers/TimerDxe/TimerDxe.c | 2 +-
 ArmPkg/Include/Library/{ArmArchTimerLib.h => ArmArchTimer.h}   | 6 +++---
 ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c   | 2 +-
 ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c   | 2 +-
 ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c   | 2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)
 rename ArmPkg/Include/Library/{ArmArchTimerLib.h => ArmArchTimer.h} (88%)

diff --git a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c 
b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c
index 2e62a4f7742f..585695a7dd5c 100644
--- a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c
+++ b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c 
b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c
index 99ee51fb6e2d..97f1ced41362 100644
--- a/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c
+++ b/ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c 
b/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c
index 3c85da616e94..3e7fa124ce48 100644
--- a/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c
+++ b/ArmPkg/Drivers/ArmCpuLib/ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c
@@ -14,7 +14,7 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c 
b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
index 329b085ec464..40ccf161be63 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
diff --git a/ArmPkg/Include/Library/ArmArchTimerLib.h 
b/ArmPkg/Include/Library/ArmArchTimer.h
similarity index 88%
rename from ArmPkg/Include/Library/ArmArchTimerLib.h
rename to ArmPkg/Include/Library/ArmArchTimer.h
index 1ecada383b29..eb7e87d3c4fc 100644
--- a/ArmPkg/Include/Library/ArmArchTimerLib.h
+++ b/ArmPkg/Include/Library/ArmArchTimer.h
@@ -12,8 +12,8 @@
 
 **/
 
-#ifndef __ARM_ARCH_TIMER_LIB_H__
-#define __ARM_ARCH_TIMER_LIB_H__
+#ifndef __ARM_ARCH_TIMER_H__
+#define __ARM_ARCH_TIMER_H__
 
 #define ARM_ARCH_TIMER_ENABLE   (1 << 0)
 #define ARM_ARCH_TIMER_IMASK(1 << 1)
@@ -112,4 +112,4 @@ ArmArchTimerSetCompareVal (
   IN   UINT64   Val
   );
 
-#endif // __ARM_ARCH_TIMER_LIB_H__
+#endif // __ARM_ARCH_TIMER_H__
diff --git a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c 
b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
index 4fe7cb8d648f..ec4c39dbc989 100644
--- a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
+++ b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
@@ -20,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #define TICKS_PER_MICRO_SEC (PcdGet32 (PcdArmArchTimerFreqInHz)/100U)
 
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c 
b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c
index fa4f7c741b15..6a461eb2e43e 100644
--- a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c
+++ b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c
@@ -21,7 +21,7 @@
 #include 
 #include "AArch64Lib.h"
 #include "ArmLibPrivate.h"
-#include 
+#include 
 
 VOID
 EFIAPI
diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c 
b/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c
index 79083f56b708..bebdafce7dba 100644
--- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c
+++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c
@@ -21,7 +21,7 @@
 #include 
 #include "ArmV7Lib.h"
 #include "ArmLibPrivate.h"
-#include 
+#include 
 
 VOID
 EFIAPI
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH v6 09/23] ArmPkg/TimerDxe: respect layering of ARM timer libraries

2014-09-03 Thread Ard Biesheuvel
Replace direct calls to the physical timer system registers with calls into
ArmArchTimer.h functions so we can swap in the virtual timer later. Also,
register the virt and hyp timer interrupts at init time.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/Drivers/TimerDxe/TimerDxe.c   | 18 --
 ArmPkg/Drivers/TimerDxe/TimerDxe.inf |  2 ++
 ArmPkg/Include/Library/ArmArchTimer.h|  6 ++
 ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c | 12 
 ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c | 12 
 5 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c 
b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
index 40ccf161be63..6c4494ed4ce6 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
@@ -163,10 +163,10 @@ TimerDriverSetTimerPeriod (
 
 gBS->RestoreTPL (OriginalTPL);
 
-// Get value of the current physical timer
-CounterValue = ArmReadCntPct ();
+// Get value of the current timer
+CounterValue = ArmArchTimerGetSystemCount ();
 // Set the interrupt in Current Time + mTimerTick
-ArmWriteCntpCval (CounterValue + mTimerTicks);
+ArmArchTimerSetCompareVal (CounterValue + mTimerTicks);
 
 // Enable the timer
 ArmArchTimerEnableTimer ();
@@ -321,9 +321,9 @@ TimerInterruptHandler (
 //
 
 // Get current counter value
-CurrentValue = ArmReadCntPct ();
+CurrentValue = ArmArchTimerGetSystemCount ();
 // Get the counter value to compare with
-CompareValue = ArmReadCntpCval ();
+CompareValue = ArmArchTimerGetCompareVal ();
 
 // This loop is needed in case we missed interrupts (eg: case when the 
interrupt handling
 // has taken longer than mTickPeriod).
@@ -335,7 +335,7 @@ TimerInterruptHandler (
 } while (CompareValue < CurrentValue);
 
 // Set next compare value
-ArmWriteCntpCval (CompareValue);
+ArmArchTimerSetCompareVal (CompareValue);
   }
 
   // Enable timer interrupts
@@ -390,6 +390,12 @@ TimerInitialize (
   // Note: Because it is not possible to determine the security state of the
   // CPU dynamically, we just install interrupt handler for both sec and 
non-sec
   // timer PPI
+  Status = gInterrupt->RegisterInterruptSource (gInterrupt, PcdGet32 
(PcdArmArchTimerVirtIntrNum), TimerInterruptHandler);
+  ASSERT_EFI_ERROR (Status);
+
+  Status = gInterrupt->RegisterInterruptSource (gInterrupt, PcdGet32 
(PcdArmArchTimerHypIntrNum), TimerInterruptHandler);
+  ASSERT_EFI_ERROR (Status);
+
   Status = gInterrupt->RegisterInterruptSource (gInterrupt, PcdGet32 
(PcdArmArchTimerSecIntrNum), TimerInterruptHandler);
   ASSERT_EFI_ERROR (Status);
 
diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.inf 
b/ArmPkg/Drivers/TimerDxe/TimerDxe.inf
index 50477ba42a7a..161d286d9c57 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.inf
@@ -52,6 +52,8 @@
   gEmbeddedTokenSpaceGuid.PcdTimerPeriod
   gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
   gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum
+  gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
   gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz
 
 [Depex]
diff --git a/ArmPkg/Include/Library/ArmArchTimer.h 
b/ArmPkg/Include/Library/ArmArchTimer.h
index eb7e87d3c4fc..c41b53ee4143 100644
--- a/ArmPkg/Include/Library/ArmArchTimer.h
+++ b/ArmPkg/Include/Library/ArmArchTimer.h
@@ -106,6 +106,12 @@ ArmArchTimerSetTimerCtrlReg (
   UINTN Val
   );
 
+UINT64
+EFIAPI
+ArmArchTimerGetCompareVal (
+  VOID
+  );
+
 VOID
 EFIAPI
 ArmArchTimerSetCompareVal (
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c 
b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c
index 6a461eb2e43e..66a979f7046a 100644
--- a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c
+++ b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c
@@ -265,6 +265,18 @@ ArmArchTimerSetTimerCtrlReg (
   ArmArchTimerWriteReg (CntpCtl, (VOID *)&Val);
 }
 
+UINT64
+EFIAPI
+ArmArchTimerGetCompareVal (
+VOID
+)
+{
+  UINT64  Val;
+  ArmArchTimerReadReg (CntpCval, (VOID *)&Val);
+
+  return Val;
+}
+
 VOID
 EFIAPI
 ArmArchTimerSetCompareVal (
diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c 
b/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c
index bebdafce7dba..836c27329eca 100644
--- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c
+++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c
@@ -265,6 +265,18 @@ ArmArchTimerSetTimerCtrlReg (
   ArmArchTimerWriteReg (CntpCtl, (VOID *)&Val);
 }
 
+UINT64
+EFIAPI
+ArmArchTimerGetCompareVal (
+VOID
+)
+{
+  UINT64  Val;
+  ArmArchTimerReadReg (CntpCval, (VOID *)&Val);
+
+  return Val;
+}
+
 VOID
 EFIAPI
 ArmArchTimerSetCompareVal (
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/

[edk2] [PATCH v6 11/23] ArmPkg, ArmPlatformPkg: allow dynamic PCDs for memory base and size

2014-09-03 Thread Ard Biesheuvel
This changes the definition and a bunch of references to
gArmTokenSpaceGuid.PcdSystemMemoryBase and
gArmTokenSpaceGuid.PcdSystemMemorySize so they can be declared as dynamic PCDs
by the platform. Also, move the non-SEC call to
ArmPlatformInitializeSystemMemory() earlier, so a platform has a chance to set
these PCDs before they are first referenced.

The purpose is allowing dynamically instantiated virtual machines to declare
the system memory by passing a device tree.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek 
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/ArmPkg.dec| 12 ++--
 ArmPkg/Library/BdsLib/BdsLib.inf |  3 ++-
 .../PrePi/PrePiArmPlatformGlobalVariableLib.inf  |  7 ---
 ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf|  6 --
 ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c| 16 
 ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf  |  6 --
 ArmPlatformPkg/PrePi/PeiUniCore.inf  |  6 --
 7 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index e9b33b63343a..ab0f603fd43a 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -113,12 +113,6 @@
   gArmTokenSpaceGuid.PcdHypFvBaseAddress|0|UINT32|0x003C
   gArmTokenSpaceGuid.PcdHypFvSize|0|UINT32|0x003D
 
-  # System Memory (DRAM): These PCDs define the region of in-built system 
memory
-  # Some platforms can get DRAM extensions, these additional regions will be 
declared
-  # to UEFI by ArmPlatformLib
-  gArmTokenSpaceGuid.PcdSystemMemoryBase|0|UINT64|0x0029
-  gArmTokenSpaceGuid.PcdSystemMemorySize|0|UINT64|0x002A
-
   # Use ClusterId + CoreId to identify the PrimaryCore
   gArmTokenSpaceGuid.PcdArmPrimaryCoreMask|0xF03|UINT32|0x0031
   # The Primary Core is ClusterId[0] & CoreId[0]
@@ -140,6 +134,12 @@
 
 
 [PcdsFixedAtBuild.common,PcdsDynamic.common]
+  # System Memory (DRAM): These PCDs define the region of in-built system 
memory
+  # Some platforms can get DRAM extensions, these additional regions will be 
declared
+  # to UEFI by ArmPlatformLib
+  gArmTokenSpaceGuid.PcdSystemMemoryBase|0|UINT64|0x0029
+  gArmTokenSpaceGuid.PcdSystemMemorySize|0|UINT64|0x002A
+
   #
   # ARM Architectural Timer
   #
diff --git a/ArmPkg/Library/BdsLib/BdsLib.inf b/ArmPkg/Library/BdsLib/BdsLib.inf
index 3e1ae8914abf..7302d6ab1b1c 100644
--- a/ArmPkg/Library/BdsLib/BdsLib.inf
+++ b/ArmPkg/Library/BdsLib/BdsLib.inf
@@ -77,10 +77,11 @@
 [FeaturePcd]
   gArmTokenSpaceGuid.PcdArmLinuxSpinTable
 
-[FixedPcd]
+[Pcd]
   gArmTokenSpaceGuid.PcdSystemMemoryBase
   gArmTokenSpaceGuid.PcdSystemMemorySize
 
+[FixedPcd]
   gArmTokenSpaceGuid.PcdArmMachineType
   gArmTokenSpaceGuid.PcdArmLinuxFdtMaxOffset
   gArmTokenSpaceGuid.PcdArmLinuxFdtAlignment
diff --git 
a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
 
b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
index 5d3a93fb7207..596f5595412e 100644
--- 
a/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
+++ 
b/ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib/PrePi/PrePiArmPlatformGlobalVariableLib.inf
@@ -37,9 +37,10 @@
   gArmTokenSpaceGuid.PcdFdBaseAddress
   gArmTokenSpaceGuid.PcdFdSize
 
-  gArmTokenSpaceGuid.PcdSystemMemoryBase
-  gArmTokenSpaceGuid.PcdSystemMemorySize
-
   gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize
   gArmPlatformTokenSpaceGuid.PcdPeiGlobalVariableSize
 
+[Pcd]
+  gArmTokenSpaceGuid.PcdSystemMemoryBase
+  gArmTokenSpaceGuid.PcdSystemMemorySize
+
diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf 
b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
index 4b21caa0279e..441f8848e7d9 100755
--- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
+++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
@@ -48,8 +48,6 @@
   gArmTokenSpaceGuid.PcdFdBaseAddress
   gArmTokenSpaceGuid.PcdFdSize
 
-  gArmTokenSpaceGuid.PcdSystemMemoryBase
-  gArmTokenSpaceGuid.PcdSystemMemorySize
   gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
 
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
@@ -62,5 +60,9 @@
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData
 
+[Pcd]
+  gArmTokenSpaceGuid.PcdSystemMemoryBase
+  gArmTokenSpaceGuid.PcdSystemMemorySize
+   
 [depex]
   TRUE
diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c 
b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c
index 4821fdc2fa89..587c4b5ce3a3 100755
--- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c
+++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.c
@@ -103,14 +103,6 @@ InitializeMemory (
 
   DEBUG ((EFI_D_ERROR, "Memory Init PEIM Loaded\n"));
 
-  // Ensure PcdSystemMemorySize has been set
-  ASSERT (FixedPcdGet64 (PcdSystemMemorySize) != 0);
-
-  

[edk2] [PATCH v6 04/23] ArmPkg: add ArmPsciResetSystemLib

2014-09-03 Thread Ard Biesheuvel
This implementation of EfiResetSystemLib uses ARM PSCI calls to perform
reboot and poweroff, using either HVC or SMC calls.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/ArmPkg.dec  |   8 ++
 .../ArmPsciResetSystemLib/ArmPsciResetSystemLib.c  | 114 +
 .../ArmPsciResetSystemLib.inf  |  41 
 3 files changed, 163 insertions(+)
 create mode 100644 ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
 create mode 100644 
ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index 45c10cad76d7..e9b33b63343a 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -151,6 +151,14 @@
   gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum|26|UINT32|0x0040
   gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|27|UINT32|0x0041
 
+  #
+  # ARM PSCI function invocations can be done either through hypervisor
+  # calls (HVC) or secure monitor calls (SMC).
+  # PcdArmPsciMethod == 1 : use HVC
+  # PcdArmPsciMethod == 2 : use SMC
+  #
+  gArmTokenSpaceGuid.PcdArmPsciMethod|0|UINT32|0x0042
+
 [PcdsFixedAtBuild.ARM]
   #
   # ARM Security Extension
diff --git a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c 
b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
new file mode 100644
index ..b9409328a18a
--- /dev/null
+++ b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
@@ -0,0 +1,114 @@
+/** @file
+  Support ResetSystem Runtime call using PSCI hvc calls
+
+  Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+  Copyright (c) 2013, ARM Ltd. All rights reserved.
+  Copyright (c) 2014, Linaro Ltd. 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.
+
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define PSCI_0_2_FN_BASE   0x8400
+#define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n))
+#define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8)
+#define PSCI_0_2_FN_SYSTEM_RESET   PSCI_0_2_FN(9)
+
+/**
+  Resets the entire platform.
+
+  @param  ResetType The type of reset to perform.
+  @param  ResetStatus   The status code for the reset.
+  @param  DataSize  The size, in bytes, of WatchdogData.
+  @param  ResetData For a ResetType of EfiResetCold, EfiResetWarm, 
or
+EfiResetShutdown the data buffer starts with a 
Null-terminated
+Unicode string, optionally followed by 
additional binary data.
+
+**/
+EFI_STATUS
+EFIAPI
+LibResetSystem (
+  IN EFI_RESET_TYPE   ResetType,
+  IN EFI_STATUS   ResetStatus,
+  IN UINTNDataSize,
+  IN CHAR16   *ResetData OPTIONAL
+  )
+{
+  ARM_SMC_ARGS ArmSmcArgs;
+  ARM_HVC_ARGS ArmHvcArgs;
+
+  switch (ResetType) {
+
+  case EfiResetPlatformSpecific:
+// Map the platform specific reset as reboot
+  case EfiResetWarm:
+// Map a warm reset into a cold reset
+  case EfiResetCold:
+// Send a PSCI 0.2 SYSTEM_RESET command
+ArmSmcArgs.Arg0 = PSCI_0_2_FN_SYSTEM_RESET;
+ArmHvcArgs.Arg0 = PSCI_0_2_FN_SYSTEM_RESET;
+break;
+  case EfiResetShutdown:
+// Send a PSCI 0.2 SYSTEM_OFF command
+ArmSmcArgs.Arg0 = PSCI_0_2_FN_SYSTEM_OFF;
+ArmHvcArgs.Arg0 = PSCI_0_2_FN_SYSTEM_OFF;
+break;
+
+  default:
+ASSERT (FALSE);
+return EFI_UNSUPPORTED;
+  }
+
+  switch (PcdGet32 (PcdArmPsciMethod)) {
+
+  case 1:
+ArmCallHvc (&ArmHvcArgs);
+break;
+
+  case 2:
+ArmCallSmc (&ArmSmcArgs);
+break;
+
+  default:
+DEBUG ((EFI_D_ERROR, "%a: no PSCI method defined\n", __FUNCTION__));
+return EFI_UNSUPPORTED;
+  }
+
+  // We should never be here
+  DEBUG ((EFI_D_ERROR, "%a: PSCI Reset failed\n", __FUNCTION__));
+  CpuDeadLoop ();
+  return EFI_UNSUPPORTED;
+}
+
+/**
+  Initialize any infrastructure required for LibResetSystem () to function.
+
+  @param  ImageHandle   The firmware allocated handle for the EFI image.
+  @param  SystemTable   A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+LibInitializeResetSystem (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  return EFI_SUCCESS;
+}
diff --git a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf 
b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
new file mode 100644
index ..ee690d1360b7
--- /dev/null
+++ b/ArmPkg/Library/ArmPs

[edk2] [PATCH v6 16/23] ArmVirtualizationPkg: add private UefiBootServicesTableLib implementation

2014-09-03 Thread Ard Biesheuvel
In order to support a dynamically discovered base address for the serial port,
we need to break the dependency cycle between DebugLib depending on
SerialPortLib depending on PcdLib depending on UefiBootServicesTableLib,
which completes the cycle by depending on DebugLib.

Instead, supply a private implementation whose ASSERTs have been defused, so
that we can drop the dependency on DebugLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 .../ArmVirtualizationUefiBootServicesTableLib.c| 65 ++
 .../ArmVirtualizationUefiBootServicesTableLib.inf  | 34 +++
 2 files changed, 99 insertions(+)
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.c
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.inf

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.c
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.c
new file mode 100644
index ..bbe171e4544d
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.c
@@ -0,0 +1,65 @@
+/** @file
+  This library retrieves the EFI_BOOT_SERVICES pointer from EFI system table in
+  library's constructor. This version has no dependency on DebugLib
+
+  Copyright (c) 2006 - 2008, 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.
+
+**/
+
+
+#include 
+
+#include 
+
+EFI_HANDLE gImageHandle = NULL;
+EFI_SYSTEM_TABLE   *gST = NULL;
+EFI_BOOT_SERVICES  *gBS = NULL;
+
+#define ASSERT(x)
+
+/**
+  The constructor function caches the pointer of Boot Services Table.
+
+  The constructor function caches the pointer of Boot Services Table through 
System Table.
+  It will always return EFI_SUCCESS.
+
+  @param  ImageHandle   The firmware allocated handle for the EFI image.
+  @param  SystemTable   A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+UefiBootServicesTableLibConstructor (
+  IN EFI_HANDLEImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  //
+  // Cache the Image Handle
+  //
+  gImageHandle = ImageHandle;
+  ASSERT (gImageHandle != NULL);
+
+  //
+  // Cache pointer to the EFI System Table
+  //
+  gST = SystemTable;
+  ASSERT (gST != NULL);
+
+  //
+  // Cache pointer to the EFI Boot Services Table
+  //
+  gBS = SystemTable->BootServices;
+  ASSERT (gBS != NULL);
+
+  return EFI_SUCCESS;
+}
diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.inf
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.inf
new file mode 100644
index ..53923bac4962
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationUefiBootServicesTableLib/ArmVirtualizationUefiBootServicesTableLib.inf
@@ -0,0 +1,34 @@
+## @file
+# UEFI Boot Services Table Library implementation for ArmVirtualizationPkg
+#
+# Copyright (c) 2007 - 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.
+#
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = ArmVirtualizationUefiBootServicesTableLib
+  FILE_GUID  = C32831C9-E611-43ED-B812-FC3EBC8DCE99
+  MODULE_TYPE= UEFI_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = UefiBootServicesTableLib|DXE_CORE 
DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION 
UEFI_DRIVER SMM_CORE
+
+  CONSTRUCTOR= UefiBootServicesTableLibConstructor
+
+#
+#  VALID_ARCHITECTURES   = IA32 X64 IPF EBC
+#
+
+[Sources]
+  ArmVirtualizationUefiB

[edk2] [PATCH v6 22/23] ArmVirtualizationPkg: add driver for QEMU's NOR flash

2014-09-03 Thread Ard Biesheuvel
This adds an implementation of NorFlashPlatformLib that exposes the
two 64 MB NOR flash banks that are provided by QEMU's mach-virt
emulation both in 32-bit and 64-bit mode.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek 
Signed-off-by: Ard Biesheuvel 
---

Retained the 'Reviewed-by: Laszlo Ersek ' as the only change
is removing a duplicated (so identical) typedef of NOR_FLASH_DESCRIPTION.


 .../Library/NorFlashQemuLib/NorFlashQemuLib.c  | 56 ++
 .../Library/NorFlashQemuLib/NorFlashQemuLib.inf| 35 ++
 2 files changed, 91 insertions(+)
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c
 create mode 100644 
ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf

diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c
new file mode 100644
index ..79040232e843
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.c
@@ -0,0 +1,56 @@
+/** @file
+
+ Copyright (c) 2014, Linaro Ltd. 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.
+
+ **/
+
+#ifndef _NORFLASHQEMULIB_H_
+#define _NORFLASHQEMULIB_H_
+
+#include 
+#include 
+
+EFI_STATUS
+NorFlashPlatformInitialization (
+  VOID
+  )
+{
+  return EFI_SUCCESS;
+}
+
+NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
+  {
+QEMU_NOR0_BASE,
+QEMU_NOR0_BASE,
+QEMU_NOR0_SIZE,
+QEMU_NOR_BSIZE,
+{0xF9B94AE2, 0x8BA6, 0x409B, {0x9D, 0x56, 0xB9, 0xB4, 0x17, 0xF5, 0x3C, 
0xB3}}
+  }, {
+QEMU_NOR1_BASE,
+QEMU_NOR1_BASE,
+QEMU_NOR1_SIZE,
+QEMU_NOR_BSIZE,
+{0x8047DB4B, 0x7E9C, 0x4C0C, {0x8E, 0xBC, 0xDF, 0xBB, 0xAA, 0xCA, 0xCE, 
0x8F}}
+  }
+};
+
+EFI_STATUS
+NorFlashPlatformGetDevices (
+  OUT NOR_FLASH_DESCRIPTION   **NorFlashDescriptions,
+  OUT UINT32  *Count
+  )
+{
+  *NorFlashDescriptions = mNorFlashDevices;
+  *Count = sizeof (mNorFlashDevices) / sizeof (mNorFlashDevices[0]);
+  return EFI_SUCCESS;
+}
+
+#endif /* _NORFLASHPLATFORMLIB_H_ */
diff --git 
a/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf
 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf
new file mode 100644
index ..bb767d7806a9
--- /dev/null
+++ 
b/ArmPlatformPkg/ArmVirtualizationPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf
@@ -0,0 +1,35 @@
+#/** @file
+#
+#  Component description file for NorFlashQemuLib module
+#
+#  Copyright (c) 2014, Linaro Ltd. 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.
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = NorFlashQemuLib
+  FILE_GUID  = 339B7829-4C5F-4EFC-B2DD-5050E530DECE
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = NorFlashPlatformLib
+
+[Sources.common]
+  NorFlashQemuLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  ArmPlatformPkg/ArmPlatformPkg.dec
+
+[LibraryClasses]
+  BaseLib
+  DebugLib
+  IoLib
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH v6 12/23] ArmPlatformPkg: separate PlatformPei and PlatformPeiLib

2014-09-03 Thread Ard Biesheuvel
This separates PlatformPei and PlatformPeiLib so the latter can be
overridden by a specific platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek 
Signed-off-by: Ard Biesheuvel 
---
 ArmPlatformPkg/PlatformPei/PlatformPeim.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ArmPlatformPkg/PlatformPei/PlatformPeim.inf 
b/ArmPlatformPkg/PlatformPei/PlatformPeim.inf
index 8ed44e7e395f..3822b093503b 100755
--- a/ArmPlatformPkg/PlatformPei/PlatformPeim.inf
+++ b/ArmPlatformPkg/PlatformPei/PlatformPeim.inf
@@ -29,7 +29,6 @@
 
 [Sources]
   PlatformPeim.c
-  PlatformPeiLib.c
 
 [Packages]
   MdePkg/MdePkg.dec
@@ -43,6 +42,7 @@
   DebugLib
   HobLib
   ArmPlatformLib
+  PlatformPeiLib
 
 [Ppis]
   gEfiPeiMasterBootModePpiGuid  # PPI ALWAYS_PRODUCED
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH v6 13/23] EmbeddedPkg: split off FDT loading functionality from FdtLib

2014-09-03 Thread Ard Biesheuvel
Split off the recently added functionality to load device tree images and
install them as configuration tables, as it introduces a dependency on
UefiBootServicesTableLib, preventing FdtLib from being used during SEC and
PEI phases.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 EmbeddedPkg/Include/FdtLoadLib.h   | 51 ++
 EmbeddedPkg/Include/libfdt_env.h   | 31 -
 EmbeddedPkg/Library/FdtLib/FdtLib.inf  | 13 --
 .../{FdtLib => FdtLoadLib}/FdtConfigurationTable.c |  2 +-
 EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf  | 44 +++
 5 files changed, 96 insertions(+), 45 deletions(-)
 create mode 100644 EmbeddedPkg/Include/FdtLoadLib.h
 rename EmbeddedPkg/Library/{FdtLib => FdtLoadLib}/FdtConfigurationTable.c (96%)
 create mode 100644 EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf

diff --git a/EmbeddedPkg/Include/FdtLoadLib.h b/EmbeddedPkg/Include/FdtLoadLib.h
new file mode 100644
index ..b5f6dfc8fbc6
--- /dev/null
+++ b/EmbeddedPkg/Include/FdtLoadLib.h
@@ -0,0 +1,51 @@
+/** @file
+*
+*  Copyright (c) 2011-2014, ARM Limited. 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.
+*
+**/
+
+#ifndef _FDTLOADLIB_ENV_H
+#define _FDTLOADLIB_ENV_H
+
+#include 
+#include 
+
+/**
+  Load and Install FDT from Semihosting
+
+  @param Filename   Name of the file to load from semihosting
+
+  @return EFI_SUCCESS   Fdt Blob was successfully installed into the 
configuration table
+from semihosting
+  @return EFI_NOT_FOUND Fail to locate the file in semihosting
+  @return EFI_OUT_OF_RESOURCES  Fail to allocate memory to contain the blob
+**/
+EFI_STATUS
+InstallFdtFromSemihosting (
+  IN  CONST CHAR16*   FileName
+  );
+
+/**
+  Load and Install FDT from Firmware Volume
+
+  @param Filename   Guid of the FDT blob to load from firmware volume
+
+  @return EFI_SUCCESS   Fdt Blob was successfully installed into the 
configuration table
+from firmware volume
+  @return EFI_NOT_FOUND Failed to locate the file in firmware volume
+  @return EFI_OUT_OF_RESOURCES  Failed to allocate memory to contain the blob
+**/
+EFI_STATUS
+InstallFdtFromFv (
+  IN  CONST EFI_GUID *FileName
+  );
+
+#endif
diff --git a/EmbeddedPkg/Include/libfdt_env.h b/EmbeddedPkg/Include/libfdt_env.h
index c4dc83c02494..3e24db94098c 100644
--- a/EmbeddedPkg/Include/libfdt_env.h
+++ b/EmbeddedPkg/Include/libfdt_env.h
@@ -15,7 +15,6 @@
 #ifndef _LIBFDT_ENV_H
 #define _LIBFDT_ENV_H
 
-#include 
 #include 
 #include 
 
@@ -79,34 +78,4 @@ static inline char *strchr(const char *s, int c) {
   return AsciiStrStr (s, pattern);
 }
 
-/**
-  Load and Install FDT from Semihosting
-
-  @param Filename   Name of the file to load from semihosting
-
-  @return EFI_SUCCESS   Fdt Blob was successfully installed into the 
configuration table
-from semihosting
-  @return EFI_NOT_FOUND Fail to locate the file in semihosting
-  @return EFI_OUT_OF_RESOURCES  Fail to allocate memory to contain the blob
-**/
-EFI_STATUS
-InstallFdtFromSemihosting (
-  IN  CONST CHAR16*   FileName
-  );
-
-/**
-  Load and Install FDT from Firmware Volume
-
-  @param Filename   Guid of the FDT blob to load from firmware volume
-
-  @return EFI_SUCCESS   Fdt Blob was successfully installed into the 
configuration table
-from firmware volume
-  @return EFI_NOT_FOUND Failed to locate the file in firmware volume
-  @return EFI_OUT_OF_RESOURCES  Failed to allocate memory to contain the blob
-**/
-EFI_STATUS
-InstallFdtFromFv (
-  IN  CONST EFI_GUID *FileName
-  );
-
 #endif /* _LIBFDT_ENV_H */
diff --git a/EmbeddedPkg/Library/FdtLib/FdtLib.inf 
b/EmbeddedPkg/Library/FdtLib/FdtLib.inf
index d18caa67ea3f..f3da231143a0 100644
--- a/EmbeddedPkg/Library/FdtLib/FdtLib.inf
+++ b/EmbeddedPkg/Library/FdtLib/FdtLib.inf
@@ -26,7 +26,6 @@
 #
 
 [Sources]
-  FdtConfigurationTable.c
   fdt_ro.c
   fdt_rw.c
   fdt_strerror.c
@@ -37,15 +36,3 @@
 [Packages]
   MdePkg/MdePkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
-
-[LibraryClasses]
-  UefiBootServicesTableLib
-
-[Protocols]
-  gEfiDevicePathProtocolGuid
-  gEfiSimpleFileSystemProtocolGuid
-  gEfiFirmwareVolume2ProtocolGuid
-
-[Guids]
-  gEfiFileInfoGuid
-  gFdtTableGuid
diff --git a/EmbeddedPkg/Library/FdtLib/FdtConfigurationTable.c 
b/EmbeddedPkg/Library/FdtLoadLib/FdtConfigurationTable.c
similarity index 96%
rename from EmbeddedPkg/Library/Fdt

[edk2] [PATCH v6 06/23] ArmPkg: add ArmGenericTimerCounterLib interface

2014-09-03 Thread Ard Biesheuvel
This introduces ArmGenericTimerCounterLib by adding the include file
ArmPkg/Include/Library/ArmGenericTimerCounterLib.h.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/Include/Library/ArmGenericTimerCounterLib.h | 85 ++
 1 file changed, 85 insertions(+)
 create mode 100644 ArmPkg/Include/Library/ArmGenericTimerCounterLib.h

diff --git a/ArmPkg/Include/Library/ArmGenericTimerCounterLib.h 
b/ArmPkg/Include/Library/ArmGenericTimerCounterLib.h
new file mode 100644
index ..6717ae370057
--- /dev/null
+++ b/ArmPkg/Include/Library/ArmGenericTimerCounterLib.h
@@ -0,0 +1,85 @@
+/** @file
+
+  Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
+  Copyright (c) 2014, Linaro Ltd. 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.
+
+**/
+
+#ifndef __ARM_GENERIC_TIMER_COUNTER_LIB_H__
+#define __ARM_GENERIC_TIMER_COUNTER_LIB_H__
+
+VOID
+EFIAPI
+ArmArchTimerEnableTimer (
+  VOID
+  );
+
+VOID
+EFIAPI
+ArmArchTimerDisableTimer (
+  VOID
+  );
+
+VOID
+EFIAPI
+ArmArchTimerSetTimerFreq (
+  IN   UINTN  FreqInHz
+  );
+
+UINTN
+EFIAPI
+ArmArchTimerGetTimerFreq (
+  VOID
+  );
+
+VOID
+EFIAPI
+ArmArchTimerSetTimerVal (
+  IN   UINTN   Val
+  );
+
+UINTN
+EFIAPI
+ArmArchTimerGetTimerVal (
+  VOID
+  );
+
+UINT64
+EFIAPI
+ArmArchTimerGetSystemCount (
+  VOID
+  );
+
+UINTN
+EFIAPI
+ArmArchTimerGetTimerCtrlReg (
+  VOID
+  );
+
+VOID
+EFIAPI
+ArmArchTimerSetTimerCtrlReg (
+  UINTN Val
+  );
+
+UINT64
+EFIAPI
+ArmArchTimerGetCompareVal (
+  VOID
+  );
+
+VOID
+EFIAPI
+ArmArchTimerSetCompareVal (
+  IN   UINT64   Val
+  );
+
+#endif
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH v6 03/23] ArmPkg: add ArmHvcLib

2014-09-03 Thread Ard Biesheuvel
This is a utility library closely modeled after ArmSmcLib, that allows
hypervisor call (HVC) instructions to be issued from C code.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/Include/Library/ArmHvcLib.h| 42 ++
 ArmPkg/Library/ArmHvcLib/AArch64/ArmHvc.S | 38 +++
 ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.S | 43 +++
 ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.asm   | 43 +++
 ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf| 32 +++
 5 files changed, 198 insertions(+)
 create mode 100644 ArmPkg/Include/Library/ArmHvcLib.h
 create mode 100644 ArmPkg/Library/ArmHvcLib/AArch64/ArmHvc.S
 create mode 100644 ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.S
 create mode 100644 ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.asm
 create mode 100644 ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf

diff --git a/ArmPkg/Include/Library/ArmHvcLib.h 
b/ArmPkg/Include/Library/ArmHvcLib.h
new file mode 100644
index ..b5c3d81cdf3d
--- /dev/null
+++ b/ArmPkg/Include/Library/ArmHvcLib.h
@@ -0,0 +1,42 @@
+/** @file
+*
+*  Copyright (c) 2012-2014, ARM Limited. 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.
+*
+**/
+
+#ifndef __ARM_HVC_LIB__
+#define __ARM_HVC_LIB__
+
+/**
+ * The size of the HVC arguments are different between AArch64 and AArch32.
+ * The native size is used for the arguments.
+ */
+typedef struct {
+  UINTN  Arg0;
+  UINTN  Arg1;
+  UINTN  Arg2;
+  UINTN  Arg3;
+} ARM_HVC_ARGS;
+
+/**
+  Trigger an HVC call
+
+  HVC calls can take up to 4 arguments and return up to 4 return values.
+  Therefore, the 4 first fields in the ARM_HVC_ARGS structure are used
+  for both input and output values.
+
+**/
+VOID
+ArmCallHvc (
+  IN OUT ARM_HVC_ARGS *Args
+  );
+
+#endif
diff --git a/ArmPkg/Library/ArmHvcLib/AArch64/ArmHvc.S 
b/ArmPkg/Library/ArmHvcLib/AArch64/ArmHvc.S
new file mode 100644
index ..156e5554cf5b
--- /dev/null
+++ b/ArmPkg/Library/ArmHvcLib/AArch64/ArmHvc.S
@@ -0,0 +1,38 @@
+//
+//  Copyright (c) 2012-2014, ARM Limited. All rights reserved.
+//  Copyright (c) 2014, Linaro Limited. 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.
+//
+//
+
+.text
+.align 3
+
+GCC_ASM_EXPORT(ArmCallHvc)
+
+ASM_PFX(ArmCallHvc):
+  // Push x0 on the stack
+  str   x0, [sp, #-8]!
+
+  // Load the HVC arguments values into the appropriate registers
+  ldp   x2, x3, [x0, #16]
+  ldp   x0, x1, [x0, #0]
+
+  hvc   #0
+
+  // Pop the ARM_HVC_ARGS structure address from the stack into x9
+  ldr   x9, [sp], #8
+
+  // Store the HVC returned values into the appropriate registers
+  // A HVC call can return up to 4 values
+  stp   x2, x3, [x9, #16]
+  stp   x0, x1, [x9, #0]
+
+  ret
diff --git a/ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.S 
b/ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.S
new file mode 100644
index ..e48f2ebc2032
--- /dev/null
+++ b/ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.S
@@ -0,0 +1,43 @@
+//
+//  Copyright (c) 2012-2014, ARM Limited. All rights reserved.
+//  Copyright (c) 2014, Linaro Limited. 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.
+//
+//
+
+.text
+.align 3
+.arch_extension virt
+
+GCC_ASM_EXPORT(ArmCallHvc)
+
+ASM_PFX(ArmCallHvc):
+// r0 will be popped just after the HVC call
+push{r0}
+
+// Load the HVC arguments values into the appropriate registers
+ldr r3, [r0, #12]
+ldr r2, [r0, #8]
+ldr r1, [r0, #4]
+ldr r0, [r0, #0]
+
+hvc #0
+
+// Pop the ARM_HVC_ARGS structure address from the stack into ip
+pop {ip}
+
+// Load the HVC returned values into the appropriate registers
+// A HVC call can return up to 4 values
+str r3, [ip, #12]
+str r

[edk2] [PATCH v6 15/23] ArmVirtualizationPkg: add Include/ArmPlatform.h

2014-09-03 Thread Ard Biesheuvel
This include file contains platform specific defines, and is shared by
various modules.

Contributed-under: TianoCore Contribution Agreement 1.0
Acked-by: Laszlo Ersek 
Signed-off-by: Ard Biesheuvel 
---
 .../ArmVirtualizationPkg/Include/ArmPlatform.h | 33 ++
 1 file changed, 33 insertions(+)
 create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Include/ArmPlatform.h

diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Include/ArmPlatform.h 
b/ArmPlatformPkg/ArmVirtualizationPkg/Include/ArmPlatform.h
new file mode 100644
index ..10936ec41143
--- /dev/null
+++ b/ArmPlatformPkg/ArmVirtualizationPkg/Include/ArmPlatform.h
@@ -0,0 +1,33 @@
+/** @file
+*  Header defining platform constants (Base addresses, sizes, flags)
+*
+*  Copyright (c) 2011, ARM Limited. All rights reserved.
+*  Copyright (c) 2014, Linaro Limited
+*
+*  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.
+*
+**/
+
+#ifndef __ARM_VIRT_H__
+#define __ARM_VIRT_H__
+
+//
+// We don't care about this value, but the PL031 driver depends on the macro
+// to exist: it will pass it on to our ArmPlatformSysConfigLib:ConfigGet()
+// function, which just returns EFI_UNSUPPORTED.
+//
+#define SYS_CFG_RTC   0x0
+
+#define QEMU_NOR_BSIZESIZE_256KB
+#define QEMU_NOR0_BASE0x0
+#define QEMU_NOR0_SIZESIZE_64MB
+#define QEMU_NOR1_BASE0x0400
+#define QEMU_NOR1_SIZESIZE_64MB
+
+#endif
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH v6 01/23] ArmPkg: allow dynamically discovered timer interrupts

2014-09-03 Thread Ard Biesheuvel
To support booting on virtual machines whose interrupt routing is
discovered from the device tree, allow the interrupt numbers to
be redeclared as PcdsDynamic by the platform .dsc

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/ArmPkg.dec | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec
index a8ca28fccc82..b0d5dadcb7c1 100644
--- a/ArmPkg/ArmPkg.dec
+++ b/ArmPkg/ArmPkg.dec
@@ -137,6 +137,8 @@
   # Maximum file size for TFTP servers that do not support 'tsize' extension
   gArmTokenSpaceGuid.PcdMaxTftpFileSize|0x0100|UINT32|0x
 
+
+[PcdsFixedAtBuild.common,PcdsDynamic.common]
   #
   # ARM Architectural Timer
   #
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [PATCH v6 00/23] add support for AArch64 QEMU/KVM

2014-09-03 Thread Ard Biesheuvel
This is v6 of the series that adds a platform config to support QEMU based
virtual machines, either in TCG or KVM mode. These virtual machines declare
their platform configuration by passing a device tree which needs to be parsed
by Tianocore, rather than relying on hardcoded peripherals.

Currently, the only assumptions made with respect to the platform config are:
- at least 1 MB of DRAM at 0x4000_, containing the device tree blob
- device tree addresses and address range sizes encoded in 64-bit
  (#address-cells = 2 and #size-cells = 2)
- NOR flash at 0x0 (2 x 64 MB)
- Cortex-A15 CPU (if built for 32-bit ARM)

Peripherals detected at runtime:
- PL011 UART
- GIC interrupt controller
- timer interrupt line
- PL031 RTC
- system memory size
- virtio MMIO transports

There are some dependencies on QEMU and KVM changes that are not yet upstream:
- QEMU: 'hw/arm/virt: Provide flash devices for boot ROMs'
- QEMU: copy DTB to base of DRAM if no -kernel option is passed
- KVM: 'KVM: Introduce gfn_to_hva_memslot_prot'
- KVM: 'arm/arm64: KVM: Support KVM_CAP_READONLY_MEM'
- KVM: 'arm/arm64: KVM: Complete WFI/WFE instructions'

The code was tested in TCG mode on x64_64 (AArch64, ARM) and in TCG and KVM mode
on a ARMv8 Foundation Model emulator (AArch64 only)

Changes since v4/v5:
- *lots* of changes due to now properly performed rebase on edk2-github/master,
  details of changes are below the commit log of each patch
- support for dynamic PL011 base address, causing some fallout and a couple of
  additional patches
- refactored private ResetSystemLib into a generic ArmPsciResetSystemLib
- refactored timer libraries
- whitespace fixes, unused functions removed, etc.

Changes since v3:
- lots of minor style changes, added ASSERT()s, etc.
- added support for 32-bit ARM, the code can now be built with '-t ARM' instead
  of '-t AARCH64' and it will work with QEMU mach-virt/cortex-a15
- eliminate AArch64 references where not appropriate
- added 32-bit ARM .S alternatives where appropriate
- refactor into separate patches for all of the modules that make up the 
  QEMU mach-virt platform implementation
- move everything under ArmPlatformPkg/ArmVirtualizationPkg
- eliminate references to KVM where plain QEMU suffices

Changes since v2:
- fixed *lots* of EDK2 Style Guide violations
- use EFI_D_ERROR only where appropriate
- use ASSERT()s to ensure we are running with at least 128 MB and not executing
  from shadowed NOR flash, and relocate the DTB device tree image earlier so
  we can be confident it does not get clobbered inadvertently
- handle 32-bit PCDs that may get initialized from 64-bit DT nodes more
  consistently, and don't abort the DT traversal if virtio transports fail to
  install

Changes since v1:
- rebased onto upstream GitHub tianocore/edk2.git (421ccda307)
- moved primary FV 0x1000 bytes into flash image, and added jump to it at 0x0
- dropped patch to allow FVs at physical offset 0x0
- dropped patch introducing device config table GUID, and used the upstream one
  instead (EmbeddedPkg/Include/Guid/Fdt.h)
- added 'Contributed-under:' lines to commit logs
- style fixes: remove redundant '== TRUE', add space between function and (
- updated/removed comments related to arch timer PCD and arch timer imask
- use feature PCD to define whether to use the virtual timer


Ard Biesheuvel (23):
  ArmPkg: allow dynamically discovered timer interrupts
  ArmPkg: allow dynamic GIC base addresses
  ArmPkg: add ArmHvcLib
  ArmPkg: add ArmPsciResetSystemLib
  ArmPkg: rename ArmArchTimerLib.h to ArmArchTimer.h
  ArmPkg: add ArmGenericTimerCounterLib interface
  ArmPkg: add ArmGenericTimerCounterLib implementation using physical
timer
  ArmPkg: add ArmGenericTimerCounterLib implementation using virtual
timer
  ArmPkg/TimerDxe: respect layering of ARM timer libraries
  ArmPkg: move TimerDxe and ArmArchTimerLib to new
ArmGenericTimerCounterLib
  ArmPkg,ArmPlatformPkg: allow dynamic PCDs for memory base and size
  ArmPlatformPkg: separate PlatformPei and PlatformPeiLib
  EmbeddedPkg: split off FDT loading functionality from FdtLib
  ArmVirtualizationPkg: introduce PCDs for device tree base address
  ArmVirtualizationPkg: add Include/ArmPlatform.h
  ArmVirtualizationPkg: add private UefiBootServicesTableLib
implementation
  ArmVirtualizationPkg: add device tree based PL011 SerialPortLib
  ArmVirtualizationPkg: add VirtFdtDxe driver
  ArmVirtualizationPkg: add ArmVirtualizationPlatformLib library
  ArmVirtualizationPkg: add ArmVirtualizationPlatformSysConfigLib
library
  ArmVirtualizationPkg: add PlatformPeiLib library
  ArmVirtualizationPkg: add driver for QEMU's NOR flash
  ArmVirtualizationPkg: add ArmVirtualizationQemu platform

 ArmPkg/ArmPkg.dec  |  37 ++-
 .../ArmCpuLib/ArmCortexA15Lib/ArmCortexA15Lib.c|   2 +-
 .../ArmCpuLib/ArmCortexA5xLib/ArmCortexA5xLib.c|   2 +-
 .../ArmCortexAEMv8Lib/ArmCortexAEMv8Lib.c  |   2 +-
 ArmPkg/Drivers/ArmGic/ArmGicDxe.inf

[edk2] [PATCH v6 10/23] ArmPkg: move TimerDxe and ArmArchTimerLib to new ArmGenericTimerCounterLib

2014-09-03 Thread Ard Biesheuvel
Update TimerDxe and ArmArchTimerLib to use ArmGenericTimerCounterLib, and update
all platforms to select the physical counter instance they have been using
implicitly all along.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 ArmPkg/Drivers/TimerDxe/TimerDxe.c |   1 +
 ArmPkg/Drivers/TimerDxe/TimerDxe.inf   |   1 +
 ArmPkg/Include/Library/ArmArchTimer.h  |  66 
 ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c   |   2 +-
 ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf |   1 +
 ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c   | 119 -
 ArmPkg/Library/ArmLib/ArmV7/ArmV7ArchTimer.c   | 119 -
 .../ArmRealViewEbPkg/ArmRealViewEb.dsc.inc |   1 +
 ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc  |   1 +
 9 files changed, 6 insertions(+), 305 deletions(-)

diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.c 
b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
index 6c4494ed4ce6..99a8665afa3f 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.c
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/ArmPkg/Drivers/TimerDxe/TimerDxe.inf 
b/ArmPkg/Drivers/TimerDxe/TimerDxe.inf
index 161d286d9c57..9e9768fbb567 100644
--- a/ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+++ b/ArmPkg/Drivers/TimerDxe/TimerDxe.inf
@@ -41,6 +41,7 @@
   DebugLib
   UefiDriverEntryPoint
   IoLib
+  ArmGenericTimerCounterLib
 
 [Guids]
 
diff --git a/ArmPkg/Include/Library/ArmArchTimer.h 
b/ArmPkg/Include/Library/ArmArchTimer.h
index c41b53ee4143..876c1f65c525 100644
--- a/ArmPkg/Include/Library/ArmArchTimer.h
+++ b/ArmPkg/Include/Library/ArmArchTimer.h
@@ -52,70 +52,4 @@ ArmArchTimerWriteReg (
   IN   VOID  *SrcBuf
   );
 
-VOID
-EFIAPI
-ArmArchTimerEnableTimer (
-  VOID
-  );
-
-VOID
-EFIAPI
-ArmArchTimerDisableTimer (
-  VOID
-  );
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerFreq (
-  IN   UINTN  FreqInHz
-  );
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerFreq (
-  VOID
-  );
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerVal (
-  IN   UINTN   Val
-  );
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerVal (
-  VOID
-  );
-
-UINT64
-EFIAPI
-ArmArchTimerGetSystemCount (
-  VOID
-  );
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerCtrlReg (
-  VOID
-  );
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerCtrlReg (
-  UINTN Val
-  );
-
-UINT64
-EFIAPI
-ArmArchTimerGetCompareVal (
-  VOID
-  );
-
-VOID
-EFIAPI
-ArmArchTimerSetCompareVal (
-  IN   UINT64   Val
-  );
-
 #endif // __ARM_ARCH_TIMER_H__
diff --git a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c 
b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
index ec4c39dbc989..137491187f14 100644
--- a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
+++ b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.c
@@ -20,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #define TICKS_PER_MICRO_SEC (PcdGet32 (PcdArmArchTimerFreqInHz)/100U)
 
diff --git a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf 
b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
index ecdf0837f121..03a4b1efa657 100644
--- a/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
+++ b/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
@@ -32,6 +32,7 @@
   DebugLib
   ArmLib
   BaseLib
+  ArmGenericTimerCounterLib
 
 [Pcd]
   gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c 
b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c
index 66a979f7046a..63ce1978c091 100644
--- a/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c
+++ b/ArmPkg/Library/ArmLib/AArch64/AArch64ArchTimer.c
@@ -166,122 +166,3 @@ ArmArchTimerWriteReg (
 ASSERT (0);
   }
 }
-
-VOID
-EFIAPI
-ArmArchTimerEnableTimer (
-VOID
-)
-{
-  UINTN TimerCtrlReg;
-
-  ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
-  TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;
-  ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
-}
-
-VOID
-EFIAPI
-ArmArchTimerDisableTimer (
-VOID
-)
-{
-  UINTN TimerCtrlReg;
-
-  ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
-  TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;
-  ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
-}
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerFreq (
-IN   UINTN  FreqInHz
-)
-{
-  ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz);
-}
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerFreq (
-VOID
-)
-{
-  UINTN ArchTimerFreq = 0;
-  ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);
-  return ArchTimerFreq;
-}
-
-UINTN
-EFIAPI
-ArmArchTimerGetTimerVal (
-VOID
-)
-{
-  UINTN ArchTimerVal;
-  ArmArchTimerReadReg (CntpTval, (VOID *)&ArchTimerVal);
-  return ArchTimerVal;
-}
-
-
-VOID
-EFIAPI
-ArmArchTimerSetTimerVal (
-IN   UINTN   Val
-)
-{
-  ArmArchTimerWriteReg (CntpTval, (VOID *)&Val);
-}
-
-UINT64
-EFIAPI
-ArmArchTimerGetSystemCount (
-VOID
-)
-{
-  UINT64 SystemCount;
-  ArmArchTimerReadReg (CntPct, (VOID *)&SystemCount);
-  return 

[edk2] [PATCH v6 07/23] ArmPkg: add ArmGenericTimerCounterLib implementation using physical timer

2014-09-03 Thread Ard Biesheuvel
This adds an implementation of ArmGenericTimerCounterLib using the physical
architected generic timer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 .../ArmGenericTimerPhyCounterLib.c | 139 +
 .../ArmGenericTimerPhyCounterLib.inf   |  33 +
 2 files changed, 172 insertions(+)
 create mode 100644 
ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c
 create mode 100644 
ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf

diff --git 
a/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c 
b/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c
new file mode 100644
index ..568b8f55b164
--- /dev/null
+++ b/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c
@@ -0,0 +1,139 @@
+/** @file
+
+  Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
+  Copyright (c) 2014, Linaro Ltd. 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.
+
+**/
+
+#include 
+#include 
+
+VOID
+EFIAPI
+ArmArchTimerEnableTimer (
+VOID
+)
+{
+  UINTN TimerCtrlReg;
+
+  ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
+  TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;
+  ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
+}
+
+VOID
+EFIAPI
+ArmArchTimerDisableTimer (
+VOID
+)
+{
+  UINTN TimerCtrlReg;
+
+  ArmArchTimerReadReg (CntpCtl, (VOID *)&TimerCtrlReg);
+  TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;
+  ArmArchTimerWriteReg (CntpCtl, (VOID *)&TimerCtrlReg);
+}
+
+VOID
+EFIAPI
+ArmArchTimerSetTimerFreq (
+IN   UINTN  FreqInHz
+)
+{
+  ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz);
+}
+
+UINTN
+EFIAPI
+ArmArchTimerGetTimerFreq (
+VOID
+)
+{
+  UINTN ArchTimerFreq = 0;
+  ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);
+  return ArchTimerFreq;
+}
+
+UINTN
+EFIAPI
+ArmArchTimerGetTimerVal (
+VOID
+)
+{
+  UINTN ArchTimerVal;
+  ArmArchTimerReadReg (CntpTval, (VOID *)&ArchTimerVal);
+
+  return ArchTimerVal;
+}
+
+
+VOID
+EFIAPI
+ArmArchTimerSetTimerVal (
+IN   UINTN   Val
+)
+{
+  ArmArchTimerWriteReg (CntpTval, (VOID *)&Val);
+}
+
+UINT64
+EFIAPI
+ArmArchTimerGetSystemCount (
+VOID
+)
+{
+  UINT64 SystemCount;
+  ArmArchTimerReadReg (CntPct, (VOID *)&SystemCount);
+
+  return SystemCount;
+}
+
+UINTN
+EFIAPI
+ArmArchTimerGetTimerCtrlReg (
+VOID
+)
+{
+  UINTN  Val;
+  ArmArchTimerReadReg (CntpCtl, (VOID *)&Val);
+
+  return Val;
+}
+
+VOID
+EFIAPI
+ArmArchTimerSetTimerCtrlReg (
+UINTN Val
+)
+{
+  ArmArchTimerWriteReg (CntpCtl, (VOID *)&Val);
+}
+
+UINT64
+EFIAPI
+ArmArchTimerGetCompareVal (
+VOID
+)
+{
+  UINT64  Val;
+  ArmArchTimerReadReg (CntpCval, (VOID *)&Val);
+
+  return Val;
+}
+
+VOID
+EFIAPI
+ArmArchTimerSetCompareVal (
+IN   UINT64   Val
+)
+{
+  ArmArchTimerWriteReg (CntpCval, (VOID *)&Val);
+}
diff --git 
a/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf 
b/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
new file mode 100644
index ..c962925cfa39
--- /dev/null
+++ 
b/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
@@ -0,0 +1,33 @@
+#/** @file
+#  Implement ArmGenericTimerCounterLib using the physical timer
+#
+#  Copyright (c) 2014, Linaro Ltd. 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.
+#
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = ArmGenericTimerPhyCounterLib
+  FILE_GUID  = 7A07E61D-9967-407F-AE85-2EB0B50BEF2C
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = ArmGenericTimerCounterLib
+
+[Sources]
+  ArmGenericTimerPhyCounterLib.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  ArmPkg/ArmPkg.dec
+
+[LibraryClasses]
+  ArmLib
+  BaseLib
-- 
1.8.3.2


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel

[edk2] [PATCH v6 08/23] ArmPkg: add ArmGenericTimerCounterLib implementation using virtual timer

2014-09-03 Thread Ard Biesheuvel
This adds an implementation of ArmGenericTimerCounterLib using the virtual
architected generic timer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel 
---
 .../ArmGenericTimerVirtCounterLib.c| 150 +
 .../ArmGenericTimerVirtCounterLib.inf  |  33 +
 2 files changed, 183 insertions(+)
 create mode 100644 
ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c
 create mode 100644 
ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.inf

diff --git 
a/ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c 
b/ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c
new file mode 100644
index ..a3828f6dff0f
--- /dev/null
+++ 
b/ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.c
@@ -0,0 +1,150 @@
+/** @file
+
+  Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
+  Copyright (c) 2014, Linaro Ltd. 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.
+
+**/
+
+#include 
+#include 
+
+VOID
+EFIAPI
+ArmArchTimerEnableTimer (
+VOID
+)
+{
+  UINTN TimerCtrlReg;
+
+  ArmArchTimerReadReg (CntvCtl, (VOID *)&TimerCtrlReg);
+  TimerCtrlReg |= ARM_ARCH_TIMER_ENABLE;
+
+  //
+  // When running under KVM, we need to unmask the interrupt on the timer side
+  // as KVM will mask it when servicing the interrupt at the hypervisor level
+  // and delivering the virtual timer interrupt to the guest. Otherwise, the
+  // interrupt will fire again, trapping into the hypervisor again, etc. etc.
+  // This is scheduled to be fixed on the KVM side, but there is no harm in
+  // leaving this in once KVM gets fixed.
+  //
+  TimerCtrlReg &= ~ARM_ARCH_TIMER_IMASK;
+  ArmArchTimerWriteReg (CntvCtl, (VOID *)&TimerCtrlReg);
+}
+
+VOID
+EFIAPI
+ArmArchTimerDisableTimer (
+VOID
+)
+{
+  UINTN TimerCtrlReg;
+
+  ArmArchTimerReadReg (CntvCtl, (VOID *)&TimerCtrlReg);
+  TimerCtrlReg &= ~ARM_ARCH_TIMER_ENABLE;
+  ArmArchTimerWriteReg (CntvCtl, (VOID *)&TimerCtrlReg);
+}
+
+VOID
+EFIAPI
+ArmArchTimerSetTimerFreq (
+IN   UINTN  FreqInHz
+)
+{
+  ArmArchTimerWriteReg (CntFrq, (VOID *)&FreqInHz);
+}
+
+UINTN
+EFIAPI
+ArmArchTimerGetTimerFreq (
+VOID
+)
+{
+  UINTN ArchTimerFreq = 0;
+  ArmArchTimerReadReg (CntFrq, (VOID *)&ArchTimerFreq);
+  return ArchTimerFreq;
+}
+
+UINTN
+EFIAPI
+ArmArchTimerGetTimerVal (
+VOID
+)
+{
+  UINTN ArchTimerVal;
+  ArmArchTimerReadReg (CntvTval, (VOID *)&ArchTimerVal);
+
+  return ArchTimerVal;
+}
+
+
+VOID
+EFIAPI
+ArmArchTimerSetTimerVal (
+IN   UINTN   Val
+)
+{
+  ArmArchTimerWriteReg (CntvTval, (VOID *)&Val);
+}
+
+UINT64
+EFIAPI
+ArmArchTimerGetSystemCount (
+VOID
+)
+{
+  UINT64 SystemCount;
+  ArmArchTimerReadReg (CntvCt, (VOID *)&SystemCount);
+
+  return SystemCount;
+}
+
+UINTN
+EFIAPI
+ArmArchTimerGetTimerCtrlReg (
+VOID
+)
+{
+  UINTN  Val;
+
+  ArmArchTimerReadReg (CntvCtl, (VOID *)&Val);
+
+  return Val;
+}
+
+VOID
+EFIAPI
+ArmArchTimerSetTimerCtrlReg (
+UINTN Val
+)
+{
+  ArmArchTimerWriteReg (CntvCtl, (VOID *)&Val);
+}
+
+UINT64
+EFIAPI
+ArmArchTimerGetCompareVal (
+VOID
+)
+{
+  UINT64  Val;
+  ArmArchTimerReadReg (CntvCval, (VOID *)&Val);
+
+  return Val;
+}
+
+VOID
+EFIAPI
+ArmArchTimerSetCompareVal (
+IN   UINT64   Val
+)
+{
+  ArmArchTimerWriteReg (CntvCval, (VOID *)&Val);
+}
diff --git 
a/ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.inf
 
b/ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.inf
new file mode 100644
index ..f2c015de3cce
--- /dev/null
+++ 
b/ArmPkg/Library/ArmGenericTimerVirtCounterLib/ArmGenericTimerVirtCounterLib.inf
@@ -0,0 +1,33 @@
+#/** @file
+#  Implement ArmGenericTimerCounterLib using the virtual timer
+#
+#  Copyright (c) 2014, Linaro Ltd. 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.
+#
+#
+#**/
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = ArmGenericTimerVirtCounterLib
+  FILE_GUID  = 3C0D77CC-4F27-49C8-B25C-2D01D81ED4D8
+  MODULE_TYPE  

Re: [edk2] Warning C4244 causes build failure with older Microsoft compilers

2014-09-03 Thread Gao, Liming
Scott:
  1. Could we enable this option in GCC to make it same to Microsoft?

  2. Seemly, there is the warning C4344 problem in older Microsoft compilers. 
But, this warning can detect the real case.  Now, there are few failure cases. 
How about fix them all? 

Thanks
Liming
-Original Message-
From: Scott Duplichan [mailto:sc...@notabs.org] 
Sent: Wednesday, September 03, 2014 12:40 PM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] Warning C4244 causes build failure with older Microsoft 
compilers

EDK2 builds with 'warning level 4' when using Microsoft tools. For the most 
part, that enables desirable warnings similar to those provided by gcc -Wall. 
There is one major difference though, Microsoft warning level
4 warns about the routine practice of assigning a larger size integer to a 
smaller size integer. The Microsoft warning looks like:

warning C4244: conversion from 'UINT32' to 'UINT8', possible loss of data

Gcc has a warning option that is similar to Microsoft C4244: -WConversion But 
the gcc option -Wall does _not_ enable -Wconversion. In fact, gcc option 
-Wextra doesn't even enable -Wconversion. That suggests that -Wconversion is a 
specialty warning not suitable for general use. EDK2 gcc builds do not enable 
-Wconversion.

I think Microsoft warning C4244 (and similar) should be removed from
EDK2 so that Microsoft warning settings are more consistent with gcc warning 
settings. But that might be a difficult change to push through.
While it would be interesting to see what others think, completely removing 
Microsoft Warning C4244 is a discussion for another day.

The immediate problem should be a lot easier to get agreement on. The problem 
is that warning C4244 is buggy/imperfect in older Microsoft compilers (DDK3790, 
VS2003, VS2005). As a result, some builds fail with those compilers, but pass 
with newer ones. Here are examples:

OvmfPkg\Library\LoadLinuxLib\Linux.c(387)
OvmfPkg\Library\LoadLinuxLib\Linux.c(388)
OvmfPkg\VirtioBlkDxe\VirtioBlk.c(773)
OvmfPkg\VirtioBlkDxe\VirtioBlk.c(774)
OvmfPkg\VirtioNetDxe\DriverBinding.c(132)
OvmfPkg\VirtioScsiDxe\VirtioScsi.c(751)
StdLib\BsdSocketLib\res_mkupdate.c(186)

Here are code snippets that demonstrate the warning C4344 problem with older 
Microsoft compilers:

#if defined (__GNUC__)
#include 
#else
#define uint16_t unsigned __int16
#define uint32_t unsigned __int32
#define uint64_t unsigned __int64
#endif
char test1 (int x) {return !x;}
char test2 (int x) {return x == 1;}
char test3 (int x) {return x & 1;}
uint32_t test4 (uint64_t x) {return x >> 32;} uint32_t test5 (uint64_t x) 
{return x && 0x;} enum {a=1, b=2}; uint16_t test6 (int x) {return x ? a 
: b;}

/*
W A R N I N G   C O U N T S
Tool chain   test1  test2  test3  test4  test5  test6
DDK3790 /W41  1  1  1  0  1
VS2003  /W41  1  1  1  0  1
VS2005  /W41  1  1  1  0  0
VS2008  /W40  0  0  0  0  0
VS2010  /W40  0  0  0  0  0
VS2012  /W40  0  0  0  0  0
VS2013  /W40  0  0  0  0  0

With VS2008 and newer, Microsoft compilers eliminate several causes of unwanted 
warnings.

If others agree, I can make a BaseTools\Conf\tools_def.template patch to 
disable warning C4244 for DDK3790, VS2003, and VS2005.

Thanks,
Scott




--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] TCG Physical Presence equates

2014-09-03 Thread Anbazhagan, Baraneedharan
Physical Presence Interface section of below MSFT link indicates that it's 
based on TCG specification. In the current code TrEEHaveValidTpmRequest & 
HaveValidTpmRequest filters the commands accordingly. Thanks.

-Baranee

From: Dong, Guo [mailto:guo.d...@intel.com]
Sent: Tuesday, September 02, 2014 10:32 PM
To: edk2-devel@lists.sourceforge.net
Subject: Re: [edk2] TCG Physical Presence equates

Hi Baranee,

PhysicalPresenceData.h is based on TCG specification and used for TPM1.2.
TrEEPhysicalPresenceData.h is based on MSFT specification 
(http://msdn.microsoft.com/en-us/library/windows/hardware/jj923067.aspx) and 
used for TPM2.0.
So it is not necessary to put them together.

Thanks,
Guo

From: Anbazhagan, Baraneedharan [mailto:anbazha...@hp.com]
Sent: Wednesday, September 03, 2014 4:21 AM
To: edk2-devel@lists.sourceforge.net
Subject: [edk2] TCG Physical Presence equates

SecurityPkg maintainers,
Can we have a common header file based on TCG PPI specification for both TPM1.2 
and TPM2 instead of defining equates in PhysicalPresenceData.h and 
TrEEPhysicalPresenceData.h?

-Baranee

CONFIDENTIALITY NOTICE: The information contained in this e-mail and any 
accompanying documents may contain information which is HP confidential or 
otherwise protected from disclosure. This transmission may also be protected by 
the attorney-client privilege, the attorney work-product privilege, or both. If 
you are not the intended recipient of this message, or if this message has been 
addressed to you in error, please immediately alert the sender by reply e-mail 
and then delete this message, including any attachments. Any dissemination, 
distribution or other use of the contents of this message by anyone other than 
the intended recipient is strictly prohibited.

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] [BaseTools] [UPT] Replace os.linesep with '\r\n' when generating UNI files.

2014-09-03 Thread Gao, Liming
Hess:
  The patch is good.  Reviewed-by: Gao, Liming 

From: Chen, Hesheng
Sent: Wednesday, September 03, 2014 4:01 PM
To: Gao, Liming; edk2-devel@lists.sourceforge.net
Subject: [edk2] [BaseTools] [UPT] Replace os.linesep with '\r\n' when 
generating UNI files.

Hello Liming,
Could you help review this patch? Thank you

BaseTools/UPT: Replace os.linesep with '\r\n' when generating UNI files.

Replace os.linesep with '\r\n' when generating UNI files to make sure all files 
are under DOS format.


Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Hess Chen mailto:hesheng.c...@intel.com>>
Best Regards,
Chen, Hess
Intel China Software Center
Tel: +86-21-6116-6740
Email: hesheng.c...@intel.com

--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [BaseTools] [UPT] Replace os.linesep with '\r\n' when generating UNI files.

2014-09-03 Thread Chen, Hesheng
Hello Liming,
Could you help review this patch? Thank you

BaseTools/UPT: Replace os.linesep with '\r\n' when generating UNI files.

Replace os.linesep with '\r\n' when generating UNI files to make sure all files 
are under DOS format.


Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Hess Chen mailto:hesheng.c...@intel.com>>
Best Regards,
Chen, Hess
Intel China Software Center
Tel: +86-21-6116-6740
Email: hesheng.c...@intel.com



upt.patch
Description: upt.patch
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


Re: [edk2] Warning C4244 causes build failure with older Microsoft compilers

2014-09-03 Thread Laszlo Ersek
On 09/03/14 06:39, Scott Duplichan wrote:
> EDK2 builds with 'warning level 4' when using Microsoft tools. For the
> most part, that enables desirable warnings similar to those provided by
> gcc -Wall. There is one major difference though, Microsoft warning level
> 4 warns about the routine practice of assigning a larger size integer to
> a smaller size integer. The Microsoft warning looks like:
> 
> warning C4244: conversion from 'UINT32' to 'UINT8', possible loss of data
> 
> Gcc has a warning option that is similar to Microsoft C4244: -WConversion
> But the gcc option -Wall does _not_ enable -Wconversion. In fact, gcc
> option -Wextra doesn't even enable -Wconversion. That suggests that
> -Wconversion is a specialty warning not suitable for general use. EDK2
> gcc builds do not enable -Wconversion.
> 
> I think Microsoft warning C4244 (and similar) should be removed from
> EDK2 so that Microsoft warning settings are more consistent with gcc
> warning settings. But that might be a difficult change to push through.
> While it would be interesting to see what others think, completely
> removing Microsoft Warning C4244 is a discussion for another day.
> 
> The immediate problem should be a lot easier to get agreement on. The
> problem is that warning C4244 is buggy/imperfect in older Microsoft
> compilers (DDK3790, VS2003, VS2005). As a result, some builds fail
> with those compilers, but pass with newer ones. Here are examples:
> 
> OvmfPkg\Library\LoadLinuxLib\Linux.c(387)
> OvmfPkg\Library\LoadLinuxLib\Linux.c(388)
> OvmfPkg\VirtioBlkDxe\VirtioBlk.c(773)
> OvmfPkg\VirtioBlkDxe\VirtioBlk.c(774)
> OvmfPkg\VirtioNetDxe\DriverBinding.c(132)
> OvmfPkg\VirtioScsiDxe\VirtioScsi.c(751)
> StdLib\BsdSocketLib\res_mkupdate.c(186)
> 
> Here are code snippets that demonstrate the warning C4344 problem 
> with older Microsoft compilers:
> 
> #if defined (__GNUC__)
> #include 
> #else
> #define uint16_t unsigned __int16
> #define uint32_t unsigned __int32
> #define uint64_t unsigned __int64
> #endif
> char test1 (int x) {return !x;}
> char test2 (int x) {return x == 1;}
> char test3 (int x) {return x & 1;}
> uint32_t test4 (uint64_t x) {return x >> 32;}
> uint32_t test5 (uint64_t x) {return x && 0x;}

You wanted to write "&" rather than "&&", but this mistake only makes
your point more clear. :)

> enum {a=1, b=2}; uint16_t test6 (int x) {return x ? a : b;}
> 
> /*
> W A R N I N G   C O U N T S
> Tool chain   test1  test2  test3  test4  test5  test6
> DDK3790 /W41  1  1  1  0  1
> VS2003  /W41  1  1  1  0  1
> VS2005  /W41  1  1  1  0  0
> VS2008  /W40  0  0  0  0  0
> VS2010  /W40  0  0  0  0  0
> VS2012  /W40  0  0  0  0  0
> VS2013  /W40  0  0  0  0  0
> 
> With VS2008 and newer, Microsoft compilers eliminate several
> causes of unwanted warnings.
> 
> If others agree, I can make a BaseTools\Conf\tools_def.template patch to
> disable warning C4244 for DDK3790, VS2003, and VS2005.

I'd appreciate if such a patch was applied.

Thanks
Laszlo


--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel


[edk2] [BaseTools] [Patch] Update AutoGen to copy binary files to output directory only when the binary module is a library

2014-09-03 Thread Chen, Hesheng
Hello All,
Could you help review this patch? Thank you

BaseTools/AutoGen: Remove redundant copy action for binary module

Remove redundant copy action for binary module to copy binary files to output 
directory only when the binary module is a library


Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Hess Chen mailto:hesheng.c...@intel.com>>
Best Regards,
Chen, Hess
Intel China Software Center
Tel: +86-21-6116-6740
Email: hesheng.c...@intel.com



AutoGen.py.patch
Description: AutoGen.py.patch
--
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/___
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel