Re: [U-Boot] [PATCH] x86: enable cpu-specific functions for x86_64 target

2018-05-30 Thread Ivan Gorinov
On Sat, May 26, 2018 at 06:53:40PM -0600, Simon Glass wrote: > Hi Ivan, > > On 25 May 2018 at 16:00, Ivan Gorinov wrote: > > Add __weak prefix to the following functions to allow override: > > misc_init_r(), checkcpu(), print_cpuinfo(). > > > > Signed-off-by: Iv

[U-Boot] [PATCH v2] x86: use EFI calling convention for efi_main on x86_64

2018-05-30 Thread Ivan Gorinov
Save efi_main() arguments in the startup code on x86_64; use EFI calling convention for _relocate() on x86_64; remove unused _relocate() arguments; consistently use EFI calling convention for efi_main() everywhere. Signed-off-by: Ivan Gorinov --- arch/x86/lib/crt0_x86_64_efi.S | 21

[U-Boot] [PATCH] x86: Add 64-bit setjmp/longjmp implementation

2018-05-30 Thread Ivan Gorinov
Add setjmp/longjmp functions for x86_64, based on existing 32-bit implementation. Signed-off-by: Ivan Gorinov --- arch/x86/cpu/x86_64/setjmp.S | 56 +++ arch/x86/cpu/x86_64/setjmp.c | 19 --- arch/x86/include/asm/setjmp.h | 17

[U-Boot] [PATCH v3] x86: use EFI calling convention for efi_main on x86_64

2018-05-31 Thread Ivan Gorinov
convention for efi_main() everywhere. v3: Updated patch description. v2: Added EFIABI to _relocate() declaration. Ivan Gorinov (1): x86: use EFI calling convention for efi_main on x86_64 arch/x86/lib/crt0_x86_64_efi.S | 21 ++--- arch/x86/lib/reloc_x86_64_efi.c | 3

[U-Boot] [PATCH v3] x86: use EFI calling convention for efi_main on x86_64

2018-05-31 Thread Ivan Gorinov
convention for efi_main() everywhere. Signed-off-by: Ivan Gorinov --- arch/x86/lib/crt0_x86_64_efi.S | 21 ++--- arch/x86/lib/reloc_x86_64_efi.c | 3 +-- lib/efi/efi_app.c | 3 ++- lib/efi/efi_stub.c | 3 ++- 4 files changed, 15 insertions(+), 15

Re: [U-Boot] [PATCH v2] x86: use EFI calling convention for efi_main on x86_64

2018-05-31 Thread Ivan Gorinov
On Thu, May 31, 2018 at 11:26:50AM +0300, Andy Shevchenko wrote: > > Save efi_main() arguments in the startup code on x86_64; > > use EFI calling convention for _relocate() on x86_64; > > remove unused _relocate() arguments; > > consistently use EFI calling convention for efi_main() everywhere. >

Re: [U-Boot] [PATCH] x86: Add 64-bit setjmp/longjmp implementation

2018-06-05 Thread Ivan Gorinov
On Sun, Jun 03, 2018 at 02:06:47PM +0200, Alexander Graf wrote: > On 02.06.18 20:44, Heinrich Schuchardt wrote: > > On 05/31/2018 12:50 AM, Ivan Gorinov wrote: > >> Add setjmp/longjmp functions for x86_64, > >> based on existing 32-bit implementation. > > &

[U-Boot] [PATCH v2] x86: Add 64-bit setjmp/longjmp implementation

2018-06-06 Thread Ivan Gorinov
Add setjmp/longjmp functions for x86_64. The FPU control word and MXCSR control bits are preserved across calls. v2: Added the FPU control word and MXCSR to jmp_buf; Using ENTRY/ENDPROC macros. Ivan Gorinov (1): x86: Add 64-bit setjmp/longjmp implementation arch/x86/cpu/x86_64/setjmp.S

[U-Boot] [PATCH v2] x86: Add 64-bit setjmp/longjmp implementation

2018-06-06 Thread Ivan Gorinov
Add setjmp/longjmp functions for x86_64. The FPU control word and MXCSR control bits are preserved across calls. Signed-off-by: Ivan Gorinov --- arch/x86/cpu/x86_64/setjmp.S | 66 +++ arch/x86/cpu/x86_64/setjmp.c | 19 - arch/x86/include/asm

[U-Boot] [PATCH v4 0/4] x86: use EFI calling convention for efi_main on x86_64

2018-06-12 Thread Ivan Gorinov
convention for efi_main() everywhere. v4: Keeping .exit label in x86_64 startup code; Also removed the unused _relocate() arguments for arm, x86, riscv. v3: Updated patch description. v2: Added EFIABI to _relocate() declaration. Ivan Gorinov (4): x86: use EFI calling convention for

[U-Boot] [PATCH v4 1/4] x86: use EFI calling convention for efi_main on x86_64

2018-06-12 Thread Ivan Gorinov
convention for efi_main() everywhere. Signed-off-by: Ivan Gorinov --- arch/x86/lib/crt0_x86_64_efi.S | 21 ++--- arch/x86/lib/reloc_x86_64_efi.c | 3 +-- lib/efi/efi_app.c | 3 ++- lib/efi/efi_stub.c | 3 ++- 4 files changed, 15 insertions(+), 15

[U-Boot] [PATCH v4 2/4] arm: Remove unused _relocate arguments

2018-06-12 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/arm/lib/crt0_aarch64_efi.S | 2 -- arch/arm/lib/crt0_arm_efi.S | 2 -- arch/arm/lib/reloc_aarch64_efi.c | 3 +-- arch/arm/lib/reloc_arm_efi.c | 3 +-- 4 files changed, 2 insertions

[U-Boot] [PATCH v4 3/4] x86: Remove unused _relocate arguments

2018-06-12 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/x86/lib/reloc_ia32_efi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/lib/reloc_ia32_efi.c b/arch/x86/lib/reloc_ia32_efi.c index e838af3..49a0b94 100644 --- a

[U-Boot] [PATCH v4 4/4] riscv: Remove unused _relocate arguments

2018-06-12 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/riscv/lib/reloc_riscv_efi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/riscv/lib/reloc_riscv_efi.c b/arch/riscv/lib/reloc_riscv_efi.c index 8b4b2b1..51b7520 100644

[U-Boot] [PATCH v5] x86: use EFI calling convention for efi_main on x86_64

2018-06-13 Thread Ivan Gorinov
: Keeping .exit label in x86_64 startup code; Also removed the unused _relocate() arguments for arm, x86, riscv. v3: Updated patch description. v2: Added EFIABI to _relocate() declaration. Ivan Gorinov (1): x86: use EFI calling convention for efi_main on x86_64 arch/x86/lib/crt0_x86_64_efi.S

[U-Boot] [PATCH v5] x86: use EFI calling convention for efi_main on x86_64

2018-06-13 Thread Ivan Gorinov
calling convention in lib/efi. Save efi_main() arguments in the startup code on x86_64; use EFI calling convention for _relocate() on x86_64; consistently use EFI calling convention for efi_main() everywhere. Signed-off-by: Ivan Gorinov --- arch/x86/lib/crt0_x86_64_efi.S | 24

Re: [U-Boot] [PATCH v2] x86: Add 64-bit setjmp/longjmp implementation

2018-06-13 Thread Ivan Gorinov
On Tue, Jun 12, 2018 at 05:57:34PM +0200, Heinrich Schuchardt wrote: > On 06/06/2018 08:28 PM, Ivan Gorinov wrote: > > Add setjmp/longjmp functions for x86_64. > > The FPU control word and MXCSR control bits are preserved across calls. > > With this patch > >

Re: [U-Boot] [PATCH v2] x86: Add 64-bit setjmp/longjmp implementation

2018-06-14 Thread Ivan Gorinov
On Wed, Jun 13, 2018 at 05:36:26PM -0700, Ivan Gorinov wrote: > > But bootefi selftest with your patch leads to an immediate reset of the > > qemu-x86_64 board. > > Reproduced the qemu-x86_64 reset. > The "info registers" command shows CR0.MP = 0. > Setting it i

[U-Boot] [PATCH v2] x86: Use microcode update from device tree for all processors

2018-06-15 Thread Ivan Gorinov
Device Tree, use the same data block for the other processors. v2: Corrected the order of included header files Ivan Gorinov (1): x86: Use microcode update from device tree for all processors arch/x86/cpu/i386/cpu.c | 3 ++- arch/x86/cpu/intel_common/car.S | 2 ++ arch

[U-Boot] [PATCH v2] x86: Use microcode update from device tree for all processors

2018-06-15 Thread Ivan Gorinov
Device Tree, use the same data block for the other processors. Signed-off-by: Ivan Gorinov --- arch/x86/cpu/i386/cpu.c | 3 ++- arch/x86/cpu/intel_common/car.S | 2 ++ arch/x86/cpu/intel_common/microcode.c | 10 +++--- arch/x86/include/asm/microcode.h | 1 + arch

[U-Boot] [PATCH v3] x86: Add 64-bit setjmp/longjmp implementation

2018-06-19 Thread Ivan Gorinov
Add setjmp/longjmp functions for x86_64. Signed-off-by: Ivan Gorinov --- arch/x86/cpu/x86_64/setjmp.S | 49 +++ arch/x86/cpu/x86_64/setjmp.c | 19 - arch/x86/include/asm/setjmp.h | 17 +++ 3 files changed, 66 insertions

[U-Boot] [PATCH v3] x86: Add 64-bit setjmp/longjmp implementation

2018-06-19 Thread Ivan Gorinov
Add setjmp/longjmp functions for x86_64. v3: Removed the FPU control word and MXCSR; Corrected SPDX License Identifier. v2: Added the FPU control word and MXCSR to jmp_buf; Using ENTRY/ENDPROC macros. Ivan Gorinov (1): x86: Add 64-bit setjmp/longjmp implementation arch/x86/cpu

[U-Boot] [PATCH] x86: fix broken qemu and edison builds

2018-06-21 Thread Ivan Gorinov
Commit 2407183f98cf130b008125ef1718ccf89a192998 breaks the qemu-x86 and edison builds. Move ucode_base and ucode_size into common startup code, except for configs with FSP. Signed-off-by: Ivan Gorinov --- arch/x86/cpu/intel_common/car.S | 10 -- arch/x86/cpu/start.S| 10

[U-Boot] [PATCH v2 0/3] Remove unused _relocate arguments

2018-06-25 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). v2: Separated the changes in efi_main() arguments and calling convention. Ivan Gorinov (3): x86: Remove unused _relocate arguments arm: Remove unused _relocate arguments riscv: Remove unused _relocate arguments arch/arm/lib

[U-Boot] [PATCH v2 1/3] x86: Remove unused _relocate arguments

2018-06-25 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/x86/lib/crt0_x86_64_efi.S | 3 --- arch/x86/lib/reloc_ia32_efi.c | 3 +-- arch/x86/lib/reloc_x86_64_efi.c | 3 +-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/x86/lib

[U-Boot] [PATCH v2 3/3] riscv: Remove unused _relocate arguments

2018-06-25 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/riscv/lib/reloc_riscv_efi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/riscv/lib/reloc_riscv_efi.c b/arch/riscv/lib/reloc_riscv_efi.c index 8b4b2b1..2fbbfcb 100644

[U-Boot] [PATCH v2 2/3] arm: Remove unused _relocate arguments

2018-06-25 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/arm/lib/crt0_aarch64_efi.S | 2 -- arch/arm/lib/crt0_arm_efi.S | 2 -- arch/arm/lib/reloc_aarch64_efi.c | 3 +-- arch/arm/lib/reloc_arm_efi.c | 3 +-- 4 files changed, 2 insertions

[U-Boot] [PATCH v3 0/3] Remove unused _relocate arguments

2018-06-27 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). v3: Rebased on u-boot/master v2: Separated the changes in efi_main() arguments and calling convention. Ivan Gorinov (3): x86: Remove unused _relocate arguments arm: Remove unused _relocate arguments riscv: Remove unused

[U-Boot] [PATCH v3 2/3] arm: Remove unused _relocate arguments

2018-06-27 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/arm/lib/crt0_aarch64_efi.S | 2 -- arch/arm/lib/crt0_arm_efi.S | 2 -- arch/arm/lib/reloc_aarch64_efi.c | 3 +-- arch/arm/lib/reloc_arm_efi.c | 3 +-- 4 files changed, 2 insertions

[U-Boot] [PATCH v3 1/3] x86: Remove unused _relocate arguments

2018-06-27 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/x86/lib/crt0_x86_64_efi.S | 3 --- arch/x86/lib/reloc_ia32_efi.c | 3 +-- arch/x86/lib/reloc_x86_64_efi.c | 3 +-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/x86/lib

[U-Boot] [PATCH v3 3/3] riscv: Remove unused _relocate arguments

2018-06-27 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/riscv/lib/reloc_riscv_efi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/riscv/lib/reloc_riscv_efi.c b/arch/riscv/lib/reloc_riscv_efi.c index 8b4b2b1..2fbbfcb 100644

Re: [U-Boot] [PATCH v3] x86: Use microcode update from device tree for all processors

2018-06-28 Thread Ivan Gorinov
On Tue, Jun 26, 2018 at 03:47:49PM +0800, Bin Meng wrote: > Hi Ivan, > > On Fri, Jun 22, 2018 at 12:13 PM, Bin Meng wrote: > > Hi Ivan, > > > > On Fri, Jun 22, 2018 at 12:16 PM, Bin Meng wrote: > >> From: Ivan Gorinov > >> > >> Built withou

Re: [U-Boot] [PATCH v3 0/3] Remove unused _relocate arguments

2018-06-28 Thread Ivan Gorinov
On Thu, Jun 28, 2018 at 03:57:24PM +0800, Bin Meng wrote: > Hi Ivan, > > On Wed, Jun 27, 2018 at 11:41 PM, Ivan Gorinov wrote: > > EFI image handle and system table are not used in _relocate(). > > > > v3: > > Rebased on u-boot/master > > > >

[U-Boot] [PATCH v4 0/3] Remove unused _relocate arguments

2018-06-28 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). v4: Consistently use EFIABI for _relocate() everywhere. v3: Use EFIABI for _relocate() on x86; Rebased on u-boot/master. v2: Separated the changes in efi_main() arguments and calling convention. Ivan Gorinov (3): x86

[U-Boot] [PATCH v4 1/3] x86: Remove unused _relocate arguments

2018-06-28 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/x86/lib/crt0_x86_64_efi.S | 3 --- arch/x86/lib/reloc_ia32_efi.c | 3 +-- arch/x86/lib/reloc_x86_64_efi.c | 3 +-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/x86/lib

[U-Boot] [PATCH v4 2/3] arm: Remove unused _relocate arguments

2018-06-28 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/arm/lib/crt0_aarch64_efi.S | 2 -- arch/arm/lib/crt0_arm_efi.S | 2 -- arch/arm/lib/reloc_aarch64_efi.c | 3 +-- arch/arm/lib/reloc_arm_efi.c | 3 +-- 4 files changed, 2 insertions

[U-Boot] [PATCH v4 3/3] riscv: Remove unused _relocate arguments

2018-06-28 Thread Ivan Gorinov
EFI image handle and system table are not used in _relocate(). Signed-off-by: Ivan Gorinov --- arch/riscv/lib/reloc_riscv_efi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/riscv/lib/reloc_riscv_efi.c b/arch/riscv/lib/reloc_riscv_efi.c index 8b4b2b1..c1039dd 100644

[U-Boot] [PATCH] efi_loader: Allow width smaller than buffer stride in efi_gop Blt()

2018-03-13 Thread Ivan Gorinov
Current implementation of Blt() in EFI_GRAPHICS_OUTPUT_PROTOCOL assumes the memory buffer stride (number of bytes in a row) always matches the rectangle Width, ignoring non-zero Delta. Signed-off-by: Ivan Gorinov --- lib/efi_loader/efi_gop.c | 10 -- 1 file changed, 8 insertions(+), 2

Re: [U-Boot] efi_loader: Allow width smaller than buffer stride in efi_gop Blt()

2018-03-14 Thread Ivan Gorinov
On Wed, 2018-03-14 at 18:21 +0100, Heinrich Schuchardt wrote: @@ -87,7 +93,7 @@ efi_status_t EFIAPI gop_blt(struct efi_gop *this, void > > *buffer, > >   for (i = 0; i < height; i++) { > >   u32 *dest = fb + ((i + dy)  * line_len32) + > >  

Re: [U-Boot] [PATCH 1/1] efi_loader: correctly support parameter delta in Blt

2018-03-15 Thread Ivan Gorinov
On Thu, 2018-03-15 at 11:19 +0100, Alexander Graf wrote: > In the Blt service of the EFI_GRAPHICS_OUTPUT_PROTOCOL the parameter delta > > is measured in bytes and not in pixels. > > > > The coding only supports delta being a multiple of four. The UEFI > > specification does not explicitly require

[U-Boot] [PATCH] x86: zImage: pass device tree setup data to the kernel

2018-03-15 Thread Ivan Gorinov
Make a copy of DTB data with setup_data header and insert new item into the the setup data linked list. Signed-off-by: Ivan Gorinov --- arch/x86/include/asm/bootparam.h | 1 + arch/x86/lib/zimage.c| 32 2 files changed, 33 insertions(+) diff --git

[U-Boot] [PATCH v2] x86: zImage: pass device tree setup data to the kernel

2018-03-16 Thread Ivan Gorinov
On x86 platforms, U-Boot does not provide Device Tree data to the kernel. This prevents the kernel from using the same hardware description. Make a copy of DTB data with setup_data header and insert new item into the the setup data linked list. Signed-off-by: Ivan Gorinov --- arch/x86/include

Re: [U-Boot] [PATCH v2] x86: zImage: pass device tree setup data to the kernel

2018-03-16 Thread Ivan Gorinov
On Fri, 2018-03-16 at 19:52 +0200, Andy Shevchenko wrote: > On x86 platforms, U-Boot does not provide Device Tree data to the > > kernel. > > This prevents the kernel from using the same hardware description. > > > > Make a copy of DTB data with setup_data header and insert new item > > into the t

[U-Boot] [PATCH v3] x86: zImage: pass device tree setup data to the kernel

2018-03-16 Thread Ivan Gorinov
On x86 platforms, U-Boot does not provide Device Tree data to the kernel. This prevents the kernel from using the same hardware description. Make a copy of DTB data with setup_data header and insert new item into the the setup data linked list. Signed-off-by: Ivan Gorinov --- arch/x86/include

[U-Boot] [PATCH v3] x86: zImage: Pass working device tree data to the kernel

2018-03-26 Thread Ivan Gorinov
On x86 platforms, U-Boot does not pass Device Tree data to the kernel. This prevents the kernel from using FDT loaded by U-Boot. Read the working FDT address from the "fdtaddr" environment variable and add a copy of the FDT data to the kernel setup_data list. Signed-off-by: Iv

[U-Boot] [PATCH] timer: Add High Precision Event Timers (HPET) support

2018-03-28 Thread Ivan Gorinov
the tick timer in the Device Tree "chosen" node: /include/ "hpet.dtsi" chosen { tick-timer = "/hpet0"; }; Signed-off-by: Ivan Gorinov --- arch/Kconfig | 2 +- arch/x86/dts/hpet.dtsi | 7 ++ drivers/timer/Kconfig | 6 ++ dr

Re: [U-Boot] [PATCH] timer: Add High Precision Event Timers (HPET) support

2018-03-29 Thread Ivan Gorinov
On Thu, Mar 29, 2018 at 01:52:10PM +0300, Andy Shevchenko wrote: > On Wed, 2018-03-28 at 17:58 -0700, Ivan Gorinov wrote: > > Adding HPET as an alternative timer for x86 (default is TSC). > > HPET main counter has constant clock frequency, calibration is not > > required.

[U-Boot] [PATCH v2] timer: add High Precision Event Timers (HPET) support

2018-03-29 Thread Ivan Gorinov
Adding HPET as an alternative timer for x86 (default is TSC). HPET counter has constant frequency and does not need calibration. This change also makes TSC timer driver optional on x86. If X86_TSC is disabled, early timer functions are provided by HPET. Signed-off-by: Ivan Gorinov --- arch

Re: [U-Boot] [PATCH] timer: Add High Precision Event Timers (HPET) support

2018-03-30 Thread Ivan Gorinov
On Fri, Mar 30, 2018 at 10:42:57PM +0300, Andy Shevchenko wrote: > On Fri, Mar 30, 2018 at 1:39 AM, Simon Glass wrote: > > On 29 March 2018 at 18:52, Andy Shevchenko > > wrote: > > >> First question is how this will work in case of Broadwell and Ivybridge > >> that have something to do with HPET

Re: [U-Boot] [PATCH v2] timer: add High Precision Event Timers (HPET) support

2018-03-30 Thread Ivan Gorinov
On Fri, Mar 30, 2018 at 10:46:40PM +0300, Andy Shevchenko wrote: > > + writel(0, regs + HPET_MAIN_COUNT_L); > > + writel(0, regs + HPET_MAIN_COUNT_H); > > Can we use writeq() here? I don't see readq/writeq defined for x86, even x86_64. > > + tl = readl(regs + HPET_MAIN

[U-Boot] [PATCH v3] timer: Add High Precision Event Timers (HPET) support

2018-03-30 Thread Ivan Gorinov
-specific configuration. v2: Moved duplicated code to static functions. Ivan Gorinov (1): timer: Add High Precision Event Timers (HPET) support arch/Kconfig | 2 +- arch/x86/Kconfig | 21 + arch/x86/dts/hpet.dtsi | 7 ++ drivers/timer/Kconfig | 9

[U-Boot] [PATCH v3] timer: Add High Precision Event Timers (HPET) support

2018-03-30 Thread Ivan Gorinov
the Device Tree "chosen" node: /include/ "hpet.dtsi" ... chosen { tick-timer = "/hpet"; }; Signed-off-by: Ivan Gorinov --- arch/Kconfig | 2 +- arch/x86/Kconfig | 21 + arch/x86/dts/hpet.dtsi | 7 ++ dr

Re: [U-Boot] [PATCH v2] timer: add High Precision Event Timers (HPET) support

2018-04-02 Thread Ivan Gorinov
On Sat, Mar 31, 2018 at 06:31:03AM -0600, Andy Shevchenko wrote: > >> > + tl = readl(regs + HPET_MAIN_COUNT_L); > >> > + th = readl(regs + HPET_MAIN_COUNT_H); > >> > >> Ditto. > > > > If readq() is defined as two read operations in 32-bit code, main counter > > rollover

Re: [U-Boot] [PATCH v2] timer: add High Precision Event Timers (HPET) support

2018-04-03 Thread Ivan Gorinov
On Tue, Apr 03, 2018 at 06:17:42AM -0600, Andy Shevchenko wrote: > >> > If readq() is defined as two read operations in 32-bit code, main counter > >> > rollover (low part overflow, high part increment) can happen between > >> > them. > >> And how this contradicts ther current code? > > It just do

Re: [U-Boot] [PATCH v2] timer: add High Precision Event Timers (HPET) support

2018-04-03 Thread Ivan Gorinov
On Wed, Apr 04, 2018 at 12:15:24PM +0800, Bin Meng wrote: > > Doesn't readX/writeX imply a single I/O operation? > > It may be misleading to define it as two. > > > > Assuming MMX or SSE2 to be supported by all x86 processors, 64-bit I/O > > registers can be accessed as a single operation even in 3

[U-Boot] [PATCH] efi_loader: Check machine type in the image header

2018-04-04 Thread Ivan Gorinov
Check FileHeader.Machine to make sure the EFI executable image is built for the same architecture. After this change, 32-bit U-Boot on x86 will print an error message instead of loading an x86_64 image and crashing. Signed-off-by: Ivan Gorinov --- include/pe.h | 1 + lib

[U-Boot] [PATCH] x86: Use microcode update from device tree for all processors

2018-04-04 Thread Ivan Gorinov
The microcode update data block encoded in Device Tree is used by the bootstrap processor (BSP) but not passed to the other CPUs (AP). If the bootstrap processor successfully performs a microcode update from Device Tree, use the same data block for the other processors. Signed-off-by: Ivan

[U-Boot] [PATCH v2] efi_loader: Check machine type in the image header

2018-04-05 Thread Ivan Gorinov
Check FileHeader.Machine to make sure the EFI executable image is built for the same architecture. For example, 32-bit U-Boot on x86 will print an error message instead of loading an x86_64 image and crashing. Signed-off-by: Ivan Gorinov --- include/pe.h | 24

[U-Boot] [PATCH v3] efi_loader: Check machine type in the image header

2018-04-05 Thread Ivan Gorinov
Check FileHeader.Machine to make sure the EFI executable image is built for the same architecture. For example, 32-bit U-Boot on x86 will print an error message instead of loading an x86_64 image and crashing. Signed-off-by: Ivan Gorinov --- include/pe.h | 4 +++ lib

[U-Boot] [PATCH v4] timer: Add High Precision Event Timers (HPET) support

2018-04-06 Thread Ivan Gorinov
access. v3: Added early timer choice in x86-specific configuration. v2: Moved duplicated code to static functions. Ivan Gorinov (1): timer: Add High Precision Event Timers (HPET) support arch/Kconfig | 2 +- arch/x86/Kconfig | 21 ++ arch/x86/dts/hpet.dtsi

[U-Boot] [PATCH v4] timer: Add High Precision Event Timers (HPET) support

2018-04-06 Thread Ivan Gorinov
the Device Tree "chosen" node: /include/ "hpet.dtsi" ... chosen { tick-timer = "/hpet"; }; Signed-off-by: Ivan Gorinov --- arch/Kconfig | 2 +- arch/x86/Kconfig | 21 ++ arch/x86/dts/hpet.dtsi | 7 ++ dr

[U-Boot] [PATCH v5 0/2] timer: Add High Precision Event Timers (HPET) support

2018-04-06 Thread Ivan Gorinov
() definitions. v4: Using 64-bit pointer for main counter access. v3: Added early timer choice in x86-specific configuration. v2: Moved duplicated code to static functions. Ivan Gorinov (2): x86: Add 64-bit memory-mapped I/O functions timer: Add High Precision Event Timers (HPET) support

[U-Boot] [PATCH v5 1/2] x86: Add 64-bit memory-mapped I/O functions

2018-04-06 Thread Ivan Gorinov
Add readq() and writeq() definitions for x86. Please note: in 32-bit code readq/writeq will generate two 32-bit memory access instructions instead of one atomic 64-bit operation. Signed-off-by: Ivan Gorinov --- arch/x86/include/asm/io.h | 16 ++-- 1 file changed, 10 insertions

[U-Boot] [PATCH v5 2/2] timer: Add High Precision Event Timers (HPET) support

2018-04-06 Thread Ivan Gorinov
the Device Tree "chosen" node: /include/ "hpet.dtsi" ... chosen { tick-timer = "/hpet"; }; Signed-off-by: Ivan Gorinov --- arch/Kconfig | 2 +- arch/x86/Kconfig | 21 ++ arch/x86/dts/hpet.dtsi | 7 ++ dr

[U-Boot] [PATCH v6] x86: Add 64-bit memory-mapped I/O functions

2018-04-06 Thread Ivan Gorinov
Add readq() and writeq() definitions for x86. Please note: in 32-bit code readq/writeq will generate two 32-bit memory access instructions instead of one atomic 64-bit operation. Signed-off-by: Ivan Gorinov --- arch/x86/include/asm/io.h | 4 1 file changed, 4 insertions(+) diff --git a

[U-Boot] [PATCH v6 0/2] timer: Add High Precision Event Timers (HPET) support

2018-04-12 Thread Ivan Gorinov
to use instead of early timer in the code that specifically needs TSC. v5: Using readq() and writeq() for main counter access. v3: Added early timer choice in x86 Kconfig. Ivan Gorinov (2): x86: Add TSC-specific timer functions timer: Add High Precision Event Timers (HPET) support

[U-Boot] [PATCH v6 2/2] timer: Add High Precision Event Timers (HPET) support

2018-04-12 Thread Ivan Gorinov
"hpet.dtsi" ... chosen { tick-timer = "/hpet"; }; Signed-off-by: Ivan Gorinov --- arch/Kconfig | 1 + arch/x86/Kconfig | 21 + arch/x86/dts/hpet.dtsi | 7 ++ common/Kconfig | 1 + drivers/timer/Kconfig |

[U-Boot] [PATCH v6 1/2] x86: Add TSC-specific timer functions

2018-04-12 Thread Ivan Gorinov
. Signed-off-by: Ivan Gorinov --- arch/x86/cpu/coreboot/timestamp.c | 2 +- arch/x86/cpu/quark/mrc_util.c | 13 ++--- arch/x86/include/asm/u-boot-x86.h | 2 +- drivers/timer/tsc_timer.c | 33 - 4 files changed, 32 insertions(+), 18 deletions(-) diff

Re: [U-Boot] [PATCH] x86: Use microcode update from device tree for all processors

2018-04-17 Thread Ivan Gorinov
On Thu, Apr 05, 2018 at 09:31:34AM -0600, Bin Meng wrote: > > The microcode update data block encoded in Device Tree is used by > > the bootstrap processor (BSP) but not passed to the other CPUs (AP). > > I don't understand what the bug is here. The AP microcode update is > done in sipi_vector.S.

Re: [U-Boot] [PATCH] x86: Use microcode update from device tree for all processors

2018-04-18 Thread Ivan Gorinov
Hi Bin, On Wed, Apr 18, 2018 at 06:48:59AM -0600, Bin Meng wrote: > >> I don't understand what the bug is here. The AP microcode update is > >> done in sipi_vector.S. > > > > I have found how it works. When a ROM image is built, the binman tool > > looks for symbol '_dt_ucode_base_size' and update

Re: [U-Boot] [PATCH] x86: Use microcode update from device tree for all processors

2018-04-20 Thread Ivan Gorinov
Hi Bin, On Wed, Apr 18, 2018 at 07:05:28PM -0600, Bin Meng wrote: > >> > > >> > If there is no ROM image, ucode_base and ucode_size are not initialized > >> > and > >> > the microcode update data from DTB applied by microcode_update_intel() > >> > to the > >> > bootstrap CPU is not used by the m

Re: [U-Boot] [PATCH v6 1/2] x86: Add TSC-specific timer functions

2018-04-20 Thread Ivan Gorinov
On Fri, Apr 20, 2018 at 06:25:08AM -0600, Andy Shevchenko wrote: > > Coreboot timestamp functions and Quark memory reference code use > > get_tbclk() to get TSC frequency. This will not work if another > > early timer is selected. > > > > Add tsc_rate_mhz() function and use it in the code that spe

Re: [U-Boot] [PATCH v6 1/2] x86: Add TSC-specific timer functions

2018-04-23 Thread Ivan Gorinov
ntly selected early timer. > > > > Signed-off-by: Ivan Gorinov > > --- > > arch/x86/cpu/coreboot/timestamp.c | 2 +- > > arch/x86/cpu/quark/mrc_util.c | 13 ++--- > > arch/x86/include/asm/u-boot-x86.h | 2 +- > > drivers/timer/tsc_timer.c

[U-Boot] [PATCH] efi_loader: correctly apply relocations from the .reloc section

2018-05-02 Thread Ivan Gorinov
Instead of difference between preferred and actual image base, the actual base is added to the fields specified in the .reloc section. Use ImageBase from PE optional header to compute the delta, exit early if the image is loaded at the preferred address. Signed-off-by: Ivan Gorinov --- lib

[U-Boot] [PATCH] efi_loader: fix off-by-one bug in efi_get_variable

2018-05-08 Thread Ivan Gorinov
efi_get_variable() always stores an extra zero byte after the output data. When the returned data size matches the output buffer size, the extra zero byte is stored past the end of the output buffer. Signed-off-by: Ivan Gorinov --- lib/efi_loader/efi_variable.c | 4 ++-- 1 file changed, 2

[U-Boot] [PATCH v2] efi_loader: fix off-by-one bug in efi_get_variable

2018-05-09 Thread Ivan Gorinov
efi_get_variable() always stores an extra zero byte after the output data. When the returned data size matches the output buffer size, the extra zero byte is stored past the end of the output buffer. Signed-off-by: Ivan Gorinov --- lib/efi_loader/efi_variable.c | 64

[U-Boot] [PATCH v3] efi_loader: fix off-by-one bug in efi_get_variable

2018-05-11 Thread Ivan Gorinov
efi_get_variable() always stores an extra zero byte after the output data. When the returned data size matches the output buffer size, the extra zero byte is stored past the end of the output buffer. Signed-off-by: Ivan Gorinov --- lib/efi_loader/efi_variable.c | 40

Re: [U-Boot] [PATCH v3] efi_loader: fix off-by-one bug in efi_get_variable

2018-05-11 Thread Ivan Gorinov
On Fri, May 11, 2018 at 08:18:27PM +0200, Heinrich Schuchardt wrote: > On 05/11/2018 07:54 PM, Ivan Gorinov wrote: > > efi_get_variable() always stores an extra zero byte after the output data. > > When the returned data size matches the output buffer size, the extra zero > >

[U-Boot] [PATCH v4] efi_loader: fix off-by-one bug in efi_get_variable

2018-05-11 Thread Ivan Gorinov
efi_get_variable() always stores an extra zero byte after the output data. When the returned data size matches the output buffer size, the extra zero byte is stored past the end of the output buffer. Signed-off-by: Ivan Gorinov --- lib/efi_loader/efi_variable.c | 40

[U-Boot] [PATCH] efi_selftest: check for buffer overflow in efi_get_variable

2018-05-24 Thread Ivan Gorinov
Check if GetVariable writes past the end of the output data buffer. Signed-off-by: Ivan Gorinov --- lib/efi_selftest/efi_selftest_variables.c | 16 1 file changed, 16 insertions(+) diff --git a/lib/efi_selftest/efi_selftest_variables.c b/lib/efi_selftest

[U-Boot] [PATCH v2] efi_selftest: check for buffer overflow in efi_get_variable

2018-05-25 Thread Ivan Gorinov
Allocate a buffer on the stack instead of an array of uninitialized pointers; check if GetVariable writes past the end of the buffer. Signed-off-by: Ivan Gorinov --- lib/efi_selftest/efi_selftest_variables.c | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a

[U-Boot] [PATCH] x86: use EFI calling convention for efi_main on x86_64

2018-05-25 Thread Ivan Gorinov
Save the arguments passed in %rcx and %rdx for efi_main() on x86_64; consistently use EFI calling convention for efi_main(). Signed-off-by: Ivan Gorinov --- arch/x86/lib/crt0_x86_64_efi.S | 8 lib/efi/efi_app.c | 3 ++- lib/efi/efi_stub.c | 3 ++- 3 files

[U-Boot] [PATCH] x86: enable cpu-specific functions for x86_64 target

2018-05-25 Thread Ivan Gorinov
Add __weak prefix to the following functions to allow override: misc_init_r(), checkcpu(), print_cpuinfo(). Signed-off-by: Ivan Gorinov --- arch/x86/cpu/x86_64/cpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c