Re: [edk2] [PATCH v2] ArmPlatformPkg/PrePeiCore: seed temporary stack before entering PEI core

2017-11-10 Thread Ard Biesheuvel
On 10 November 2017 at 09:29, Laszlo Ersek wrote: > On 11/09/17 22:11, Ard Biesheuvel wrote: >> On 7 November 2017 at 18:13, Ard Biesheuvel >> wrote: >>> On 7 November 2017 at 18:09, Laszlo Ersek wrote: On 11/05/17 17:29,

Re: [edk2] [PATCH v2] ArmPlatformPkg/PrePeiCore: seed temporary stack before entering PEI core

2017-11-10 Thread Laszlo Ersek
On 11/09/17 22:11, Ard Biesheuvel wrote: > On 7 November 2017 at 18:13, Ard Biesheuvel wrote: >> On 7 November 2017 at 18:09, Laszlo Ersek wrote: >>> On 11/05/17 17:29, Ard Biesheuvel wrote: On 5 November 2017 at 16:27, Ard Biesheuvel

Re: [edk2] [PATCH v5] UefiCpuPkg/CpuDxe: Fix multiple entries of RT_CODE in memory map

2017-11-10 Thread Laszlo Ersek
Hi Jian, I'm CC'ing Ard and Matt, and commenting at the bottom. On 11/10/17 02:02, Jian J Wang wrote: >> v5: >>Coding style clean-up > >> v4: >> a. Remove DoUpdate and check attributes mismatch all the time to avoid >>a logic hole >> b. Add warning message if failed to update capability

[edk2] [PATCH edk2-platforms v4 24/34] Silicon/SynQuacer: add description of GPIO block to device tree

2017-11-10 Thread Ard Biesheuvel
Add a description of the SoCs GPIO controller as well as a description of DIP switch block #3, which is wired to GPIOs 0 - 7, both on the evaluation board as well as the Developer Box. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel

[edk2] [PATCH edk2-platforms v4 22/34] Platform/Socionext: add support for Socionext Developer Box rev 0.1

2017-11-10 Thread Ard Biesheuvel
This adds support for the first working sample of the MZSC2AM board, revision 0.1 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm ---

[edk2] [PATCH edk2-platforms v4 31/34] Silicon/Socionext: implement I2C master protocol for SynQuacer I2C

2017-11-10 Thread Ard Biesheuvel
Add a driver that produces the I2C master protocol on top of the I2C controllers that are implemented in the SynQuacer Socionext SoC. Note that this supports two modes simultaneously: I2C controllers that are only usable at boot time, and usable via the I2C protocol stack, and I2C controllers that

[edk2] [PATCH edk2-platforms v4 29/34] Silicon/SynQuacer: implement 'clear NVRAM' feature using a DIP switch

2017-11-10 Thread Ard Biesheuvel
Ordinary computers typically have a physical switch or jumper on the board that allows non-volatile settings to be cleared. Let's implement the same using DIP switch #1 on block #3, and clear the EFI variable store if it is set to ON at boot time. Contributed-under: TianoCore Contribution

[edk2] [PATCH edk2-platforms v4 25/34] Silicon/SynQuacer: add description of EXIU to the device tree

2017-11-10 Thread Ard Biesheuvel
Add a DT node for the external interrupt unit (EXIU), which handles interrupts from GPIO lines. We need OS support for this for things like PHY interrupts and a 'wake' button. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel

[edk2] [PATCH edk2-platforms v4 27/34] Silicon/SynQuacerMemoryInitPeiLib: ignore capsules when clearing NVRAM

2017-11-10 Thread Ard Biesheuvel
In preparation of adding support for setting a DIP switch to clear the EFI variable store, update the early capsule handling logic to take the boot mode into account. This is necessary for two reasons: - we override the boot mode when a capsule is detected, - the capsule detection itself involves

[edk2] [PATCH edk2-platforms v4 26/34] Silicon/SynQuacer: add DT description of the SDHCI controller

2017-11-10 Thread Ard Biesheuvel
Describe the SynQuacer SoC's eMMC controller in DT so the OS can attach to it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi | 26 1 file changed, 26

[edk2] [PATCH edk2-platforms v4 28/34] Silicon/SynQuacer: implement PEIM that exposes GPIO PPI

2017-11-10 Thread Ard Biesheuvel
In order to be able to sample the state of the DIP switches at early boot on the Developer Box platform, implement the GPIO PPI based on the GPIO block that is implemented in the SynQuacer SoC. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel

[edk2] [PATCH edk2-platforms v4 34/34] Platform/SynQuacerEvalBoard: add eMMC driver stack

2017-11-10 Thread Ard Biesheuvel
Add the drivers required to use the onboard eMMC on the SynQuacer Evaluation Board. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- NOTE: this depends on an upstream EDK2 change that is currently still under discussion

[edk2] [PATCH edk2-platforms v4 33/34] Platform/DeveloperBox: add description of power button to DT

2017-11-10 Thread Ard Biesheuvel
Add the power button as a gpio-keys KEY_POWER button, and mark it as a wakeup source so it can be used under the OS both as a 'sleep' and as a 'wake' button. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel ---

[edk2] [RFC PATCH 2/2] MdeModulePkg/SdMmcPciHcDxe: allow HC capabilities to be overridden

2017-11-10 Thread Ard Biesheuvel
Invoke the newly introduced SD/MMC override protocol to override the capabilities register after reading it from the device registers, and to call the pre/post host init and reset hooks at the appropriate times. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel

[edk2] [RFC PATCH 1/2] MdeModulePkg: introduce SD/MMC override protocol

2017-11-10 Thread Ard Biesheuvel
Many ARM based SoCs have integrated SDHCI controllers, and often, these implementations deviate in subtle ways from the pertinent specifications. On the one hand, these deviations are quite easy to work around, but on the other hand, having a collection of SoC specific workarounds in the generic

[edk2] [RFC PATCH 0/2] quirks handling for SDHCI controllers

2017-11-10 Thread Ard Biesheuvel
Many SDHCI implementations exist that are almost spec complicant, and could be driver by the generic SD/MMC host controller driver except for some minimal necessary init time tweaks. Adding such tweaks to the generic driver is undesirable. On the other hand, forking the driver for every platform

Re: [edk2] [PATCH 2/4] OvmfPkg/Sec/Ia32: seed the temporary RAM with PcdInitValueInTempStack

2017-11-10 Thread Ard Biesheuvel
On 10 November 2017 at 15:49, Laszlo Ersek wrote: > This allows the PEI core to report the maximum temporary SEC/PEI stack > usage on the DEBUG_INFO level, in the PeiCheckAndSwitchStack() function > [MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c]: > > * Normal boot: > >> Temp

[edk2] [PATCH edk2-platforms v4 01/34] Silicon/SynQuacer: add package with platform headers

2017-11-10 Thread Ard Biesheuvel
Add a package .DEC description for SynQuacer with an [Includes] section, and add header files containing descriptions of the platform's memory map and PCIe configuration. No code yet. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel

[edk2] [PATCH edk2-platforms v4 08/34] Silicon/SynQuacer: implement PciHostBridgeLib support

2017-11-10 Thread Ard Biesheuvel
Implement the glue library that exposes the PCIe root complexes to the generic PCI host bridge driver. Since that driver is the first one to access the PCI config space, put the low level init code for the RCs into this library's constructor. Contributed-under: TianoCore Contribution Agreement

[edk2] [PATCH edk2-platforms v4 07/34] Silicon/SynQuacer: implement PciSegmentLib to support dual RCs

2017-11-10 Thread Ard Biesheuvel
Having two distinct root complexes is not supported by the standard set of PciLib/PciExpressLib/PciSegmentLib, so let's reimplement one of the latter specifically for this platform (and forget about the others). This also allows us to implement the Synopsys Designware PCIe specific workaround for

[edk2] [PATCH edk2-platforms v4 03/34] Silicon/Socionext: add PlatformPeilib implementation for SynQuacer

2017-11-10 Thread Ard Biesheuvel
Create a specialized PlatformPeiLib implementation that invokes the platform specific firmware interface (currently, just a data structure left in SRAM) to set the ARM standard PcdSystemMemoryBase|Size PCDs, and expose the information via a newly added DramInfo PPI. Contributed-under: TianoCore

[edk2] [PATCH 4/4] OvmfPkg: restore temporary SEC/PEI RAM size to 64KB

2017-11-10 Thread Laszlo Ersek
(1) In the PEI phase, the PCD database is maintained in a GUID HOB. In OVMF, we load the PCD PEIM before any other PEIMs (using APRIORI PEI), so that all other PEIMs can use dynamic PCDs. Consequently, - the PCD GUID HOB is initially allocated from the temporary SEC/PEI heap,

[edk2] [PATCH 3/4] OvmfPkg/Sec/X64: seed the temporary RAM with PcdInitValueInTempStack

2017-11-10 Thread Laszlo Ersek
This allows the PEI core to report the maximum temporary SEC/PEI stack usage on the DEBUG_INFO level, in the PeiCheckAndSwitchStack() function [MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c]: * Normal boot: > Temp Stack : BaseAddress=0x814000 Length=0x4000 > Temp Heap : BaseAddress=0x81

[edk2] [PATCH 2/4] OvmfPkg/Sec/Ia32: seed the temporary RAM with PcdInitValueInTempStack

2017-11-10 Thread Laszlo Ersek
This allows the PEI core to report the maximum temporary SEC/PEI stack usage on the DEBUG_INFO level, in the PeiCheckAndSwitchStack() function [MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c]: * Normal boot: > Temp Stack : BaseAddress=0x814000 Length=0x4000 > Temp Heap : BaseAddress=0x81

[edk2] [PATCH 1/4] OvmfPkg/Sec/Ia32: free up EAX for other uses while setting up the stack

2017-11-10 Thread Laszlo Ersek
Currently EAX is used as an intermediary in setting ESP to SEC_TOP_OF_STACK, and in passing SEC_TOP_OF_STACK to SecCoreStartupWithStack() as the "TopOfCurrentStack" argument. In a later patch we'll use EAX differently, so replace it with EBX under the current use. Cc: Ard Biesheuvel

[edk2] [PATCH edk2-platforms v4 11/34] Platform/SynQuacerEvalBoard: add NETSEC driver

2017-11-10 Thread Ard Biesheuvel
Add the NETSEC driver to the SynQuacerEvalBoard platform. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc | 46

[edk2] [PATCH edk2-platforms v4 14/34] Silicon/Socionext: add driver for SPI NOR flash

2017-11-10 Thread Ard Biesheuvel
From: Pipat Methavanitpong This imports the driver sources provided by Socionext for the FIP006 SPI NOR flash device found on SynQuacer SoCs. It has been slightly tweaked to bring it up to date with the changes made on the EDK2 side since it was forked.

[edk2] [PATCH edk2-platforms v4 09/34] Silicon/SynQuacer: implement EFI_CPU_IO2_PROTOCOL

2017-11-10 Thread Ard Biesheuvel
The SynQuacer SOC has two separate PCIe RCs, which means there is no single value for the translation offset between I/O port accesses and MMIO accesses. So add a special implementation of EFI_CPU_IO2_PROTOCOL that takes the two disjoint I/O windows into account. Contributed-under: TianoCore

[edk2] [PATCH edk2-platforms v4 04/34] Silicon/SynQuacer: implement a platform DXE driver

2017-11-10 Thread Ard Biesheuvel
This implements a driver that will take care of platform specific initialization, such as declaring non-discoverable devices, and installing the device tree blob as a configuration table. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel

[edk2] [PATCH edk2-platforms v4 06/34] Platform: add support for Socionext SynQuacer eval board

2017-11-10 Thread Ard Biesheuvel
This is a barebones port based on the .DSC/.FDF and ArmPlatformLib code provided by Socionext. It can boot into the UiApp menu screen or the UEFI Shell, but lacks support for any peripherals. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel

[edk2] [PATCH edk2-platforms v4 13/34] Silicon/SynQuacer: add NorFlashPlatformLib implementation

2017-11-10 Thread Ard Biesheuvel
Add the platform glue for the NOR flash driver. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c

[edk2] [PATCH edk2-platforms v4 12/34] Silicon/SynQuacer: add device tree support for eval board

2017-11-10 Thread Ard Biesheuvel
Add a device tree description of the SynQuacer SoC, and expose it for the SynQuacerEvalBoard platforms. This includes the menu option in the UEFI boot menu to switch between ACPI and DT. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel

[edk2] [PATCH edk2-platforms v4 16/34] Silicon/SynQuacer: implement PlatformFlashAccessLib

2017-11-10 Thread Ard Biesheuvel
In order to support capsule update, implement PlatformFlashAccessLib that exposes write access to the UEFI NOR partition. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm ---

[edk2] [PATCH edk2-platforms v4 10/34] Platform/SynQuacerEvalBoard: add PCI support

2017-11-10 Thread Ard Biesheuvel
Wire up the various drivers and libraries for the SynQuacerEvalBoard platform. Also enable the usual PCI suspects: XHCI, SATA and NVME, and the various bus, partition and file system drivers that we need to make use of PCIe devices. Given how PCI support enables USB support too, and taking the

[edk2] [PATCH edk2-platforms v4 15/34] Platform/SynQuacer: incorporate NOR flash and variable drivers

2017-11-10 Thread Ard Biesheuvel
Wire up the non-volatile EFI variable store support, by switching from the emulation driver to the real one, and enabling the prerequisite FTW and NOR flash drivers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif

[edk2] [PATCH edk2-platforms v4 05/34] Silicon/SynQuacer: add MemoryInitPeiLib implementation

2017-11-10 Thread Ard Biesheuvel
Implement MemoryInitPeiLib based on the newly added DramInfo PPI, which retrieves the DRAM information from lower level firmware. Note that the firmware volumes in SPI NOR are mapped with different attributes: the FV containing the PEI modules that may execute in place is mapped as uncached

[edk2] [PATCH edk2-platforms v4 17/34] SynQuacer/SynQuacerMemoryInitPeiLib: add capsule support

2017-11-10 Thread Ard Biesheuvel
Add support for dealing with capsules left in memory by the OS before reboot. This needs to be done early, before the memory is reused, which is why the initial handling must reside here. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel

[edk2] [PATCH edk2-platforms v4 20/34] Platform/SynQuacerEvalBoard: add signed capsule update support

2017-11-10 Thread Ard Biesheuvel
Add all the boilerplate to make the SPI NOR image updateable using signed capsules and the FMP protocol. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm ---

[edk2] [PATCH edk2-platforms v4 19/34] Socionext/SynQuacerEvalBoard: switch to execute in place

2017-11-10 Thread Ard Biesheuvel
Now that we switched to PrePeiCore, we can execute the firmware image in place, using a stack and temporary heap in non-secure SRAM. This allows us to query the secure firmware for the size and placement of DRAM, and also allows the use of capsules for firmware update. NOTE: this requires ARM

[edk2] [PATCH edk2-platforms v4 00/34] add support for Socionext SynQuacer

2017-11-10 Thread Ard Biesheuvel
This adds support for the Socionext Synquacer SC2A11 evaluation board and revision 0.1/0.2 of the Developer Box. It implements support for the core peripherals (CPU, GIC, serial), and for the two PCIe RCs present on this board, as well as the NETSEC network controller. The DT description

[edk2] [PATCH edk2-platforms v4 18/34] Socionext/SynQuacerEvalBoard: wire up basic capsule support

2017-11-10 Thread Ard Biesheuvel
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc | 7 ++-

[edk2] [PATCH edk2-platforms v4 21/34] Silicon/SynQuacerPciHostBridgeLib: add workaround to support 32-bit only cards

2017-11-10 Thread Ard Biesheuvel
Implement workaround suggested by Socionext to get legacy endpoints with 32-bit BARs working. This fixes the issue on Developer Box with the onboard ASM1061 SATA controller. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel

[edk2] [PATCH edk2-platforms v4 23/34] Platform/DeveloperBox: add ConsolePrefDxe driver

2017-11-10 Thread Ard Biesheuvel
In order to improve the 'out of the box' experience when booting this system with a monitor and keyboard attached, include the serial console preference driver that prevents the installer GUI to only appear on the serial port in this case. Contributed-under: TianoCore Contribution Agreement 1.1

Re: [edk2] [PATCH 2/4] OvmfPkg/Sec/Ia32: seed the temporary RAM with PcdInitValueInTempStack

2017-11-10 Thread Laszlo Ersek
On 11/10/17 19:11, Laszlo Ersek wrote: > On 11/10/17 16:56, Ard Biesheuvel wrote: >> On 10 November 2017 at 15:49, Laszlo Ersek wrote: >>> This allows the PEI core to report the maximum temporary SEC/PEI stack >>> usage on the DEBUG_INFO level, in the PeiCheckAndSwitchStack()

Re: [edk2] [PATCH 2/4] OvmfPkg/Sec/Ia32: seed the temporary RAM with PcdInitValueInTempStack

2017-11-10 Thread Laszlo Ersek
On 11/10/17 16:56, Ard Biesheuvel wrote: > On 10 November 2017 at 15:49, Laszlo Ersek wrote: >> This allows the PEI core to report the maximum temporary SEC/PEI stack >> usage on the DEBUG_INFO level, in the PeiCheckAndSwitchStack() function >>

[edk2] stdlib broken strncasecmp.c

2017-11-10 Thread David F.
I would submit a patch but over the years of fixes and enhancements, they don't go anywhere. Then a couple years later someone does a half-baked fix and I have to run merge resolution on svn. Anyway, the problem with that is the s1 compare to 0 should be before the s1++ (otherwise it matches when

[edk2] EDK2 build issues

2017-11-10 Thread Aaron Durbin
Hello, Here are some observations I've encountered trying to utilize edk2 for certain builds. Part of the problem seems to be with implicit assumptions in how edk2 is used. I'm trying to build things using edk2 from a clean enviroment on an automated builder. i.e. there isn't a workspace that

Re: [edk2] [PATCH 3/4] UefiCpuPkg/MtrrLib: Update algorithm to calculate optimal settings

2017-11-10 Thread Laszlo Ersek
Hi Ray, On 11/10/17 01:52, Ni, Ruiyu wrote: > > >> -Original Message- >> From: Laszlo Ersek [mailto:ler...@redhat.com] >> Sent: Thursday, November 9, 2017 9:16 PM >> To: Ni, Ruiyu ; Justen, Jordan L >> ; Jeff Fan

[edk2] [PATCH v3 1/3] EmbeddedPkg/RealTimeClockRuntimeDxe: move common functionality into core

2017-11-10 Thread Ard Biesheuvel
RealTimeClockRuntimeDxe defers the hardware/platform specific handling of reading/setting the hardware clock to RealTimeClockLib, but for unknown reasons, it also defers common functionality such as input validation and recording the timezone and DST settings (which are informational only and not

[edk2] [PATCH v3 2/3] ArmPlatformPkg/PL031RealTimeClockLib: remove validation and DST handling

2017-11-10 Thread Ard Biesheuvel
This library, which is intended to encapsulate the hardware specifics of the ARM PL031 RTC, also implements its own input validation routines and record the timezone and DST settings in its own set of EFI variables. This functionality has recently been added to the core driver, so let's remove it

[edk2] [PATCH v3 0/3] ArmPlatformPkg EmbeddedPkg: consolidate shared RTC functionality

2017-11-10 Thread Ard Biesheuvel
This moves input validation and recording of the DST and timezone settings (which cannot usually be done by the hardware) into the core RTC driver in EmbeddedPkg, and removes it from one of the RealTimeClockLib implementations, the one for the ARM PL031. v3: fix leap day assert condition