From 93031595ede1c8a0ee1f7820ab9d719b0e9e51c7 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 16 Jan 2017 07:03:58 -0700 Subject: [PATCH] x86: Add cpu code for x86_64 There is not much needed at present, but set up a separate directory to put this code as it grows. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- arch/x86/cpu/Makefile | 4 +++- arch/x86/cpu/x86_64/Makefile | 6 ++++++ arch/x86/cpu/x86_64/cpu.c | 34 ++++++++++++++++++++++++++++++++ arch/x86/cpu/x86_64/interrupts.c | 29 +++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 arch/x86/cpu/x86_64/Makefile create mode 100644 arch/x86/cpu/x86_64/cpu.c create mode 100644 arch/x86/cpu/x86_64/interrupts.c diff --git a/arch/x86/cpu/Makefile b/arch/x86/cpu/Makefile index 41ad4818b7..7f89ff047f 100644 --- a/arch/x86/cpu/Makefile +++ b/arch/x86/cpu/Makefile @@ -38,6 +38,8 @@ obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_SMP) += sipi_vector.o obj-y += turbo.o -ifeq ($(CONFIG_$(SPL_)X86_64),) +ifeq ($(CONFIG_$(SPL_)X86_64),y) +obj-y += x86_64/ +else obj-y += i386/ endif diff --git a/arch/x86/cpu/x86_64/Makefile b/arch/x86/cpu/x86_64/Makefile new file mode 100644 index 0000000000..4b063862e1 --- /dev/null +++ b/arch/x86/cpu/x86_64/Makefile @@ -0,0 +1,6 @@ +# +# (C) Copyright 2016 Google, Inc +# Written by Simon Glass +# + +obj-y += cpu.o interrupts.o diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c new file mode 100644 index 0000000000..b12eab1cb6 --- /dev/null +++ b/arch/x86/cpu/x86_64/cpu.c @@ -0,0 +1,34 @@ +/* + * (C) Copyright 2016 Google, Inc + * Written by Simon Glass + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include + +int cpu_has_64bit(void) +{ + return true; +} + +void enable_caches(void) +{ + /* Not implemented */ +} + +void disable_caches(void) +{ + /* Not implemented */ +} + +int dcache_status(void) +{ + return true; +} + +int x86_mp_init(void) +{ + /* Not implemented */ + return 0; +} diff --git a/arch/x86/cpu/x86_64/interrupts.c b/arch/x86/cpu/x86_64/interrupts.c new file mode 100644 index 0000000000..3e06173186 --- /dev/null +++ b/arch/x86/cpu/x86_64/interrupts.c @@ -0,0 +1,29 @@ +/* + * (C) Copyright 2016 Google, Inc + * Written by Simon Glass + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +void enable_interrupts(void) +{ + asm("sti\n"); +} + +int disable_interrupts(void) +{ + long flags; + + asm volatile ("pushfq ; popq %0 ; cli\n" : "=g" (flags) : ); + + return flags & X86_EFLAGS_IF; +} + +int interrupt_init(void) +{ + /* Nothing to do - this was already done in SPL */ + return 0; +} -- 2.39.5