quark_se: Add shared GDT in RAM memory to linker

A new shared memory has been added to the QMSI bootloader in order to
store the GDT in RAM reliably.

Add this new entry to the QUARK SE C1000 linker script and new kconfig
options:

 * CONFIG_BSP_SHARED_GDT_RAM_ADDR to set the address location
   of the GDT in RAM.

 * CONFIG_BSP_SHARED_GDT_RAM_SIZE to set the size used by the
   GDT in RAM.

Additionally, both BSP_SHARED_RAM_ADDR and BSP_SHARED_RAM_SIZE have been
renamed to BSP_SHARED_RESTORE_INFO_RAM_ADDR and
BSP_SHARED_RESTORE_INFO_SIZE respectively, in order to better resemble
what these options are for. All these configs are available
unconditionally.

Change-Id: I07ee8b440d4a3f5e9bdeb62441ff6a7bd6d4c153
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Bartlomiej Majka <bartlomiejx.majka@intel.com>
This commit is contained in:
Jesus Sanchez-Palencia 2017-01-05 15:33:57 -08:00 committed by Anas Nashif
commit bcee91d70e
4 changed files with 41 additions and 12 deletions

View file

@ -75,20 +75,32 @@ config QUARK_SE_IPM_CONSOLE_RING_BUF_SIZE32
endif endif
endif endif
config BSP_SHARED_RAM_ADDR config BSP_SHARED_RESTORE_INFO_RAM_ADDR
hex "Address of the shared RAM with the QMSI Bootloader" hex "Address of the restore information in RAM shared with the QMSI Bootloader"
depends on SYS_POWER_DEEP_SLEEP
default 0xA8013FDC default 0xA8013FDC
help help
Address of the memory shared between the BSP and the Bootloader in order Address of the memory shared between the BSP and the Bootloader in order
to store restore information. to store restore information.
config BSP_SHARED_RAM_SIZE config BSP_SHARED_RESTORE_INFO_SIZE
hex "Size of the shared RAM with the QMSI Bootloader" hex "Size of the restore information in RAM shared with the QMSI Bootloader"
depends on SYS_POWER_DEEP_SLEEP
default 0x4 default 0x4
help help
Size of the memory shared between the BSP and the Bootloader in order Size of the memory shared between the BSP and the Bootloader in order
to store restore information. to store restore information.
config BSP_SHARED_GDT_RAM_ADDR
hex "Address of the GDT in RAM shared with the QMSI Bootloader"
default 0xA8013FE0
help
Address of the memory shared between the BSP and the Bootloader in order
to store the GDT.
config BSP_SHARED_GDT_RAM_SIZE
hex "Size of the GDT in RAM shared with the QMSI Bootloader"
default 0x20
help
Size of the memory shared between the BSP and the Bootloader in order
to store the GDT.
endif #SOC_QUARK_SE_C1000_X86 endif #SOC_QUARK_SE_C1000_X86

View file

@ -23,10 +23,22 @@
#define PHYS_LOAD_ADDR CONFIG_PHYS_RAM_ADDR #define PHYS_LOAD_ADDR CONFIG_PHYS_RAM_ADDR
#endif /* CONFIG_XIP */ #endif /* CONFIG_XIP */
/* total shared RAM size (restore info + gdt) */
#define BSP_SHARED_RAM_SIZE \
CONFIG_BSP_SHARED_GDT_RAM_SIZE+CONFIG_BSP_SHARED_RESTORE_INFO_SIZE
/*
* When DEEP_SLEEP is not enabled, the shared memory can be re-used after boot.
* Since the memory regions area are at fixed address locations, only the
* contiguous unused memory located at the end of RAM should be made available.
*/
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP #ifdef CONFIG_SYS_POWER_DEEP_SLEEP
#define PHYS_RAM_SIZE CONFIG_RAM_SIZE*1K - CONFIG_BSP_SHARED_RAM_SIZE #define PHYS_RAM_SIZE CONFIG_RAM_SIZE*1K - BSP_SHARED_RAM_SIZE
#else /* !CONFIG_SYS_POWER_DEEP_SLEEP */ #else
#ifdef CONFIG_SET_GDT
#define PHYS_RAM_SIZE CONFIG_RAM_SIZE*1K #define PHYS_RAM_SIZE CONFIG_RAM_SIZE*1K
#else
#define PHYS_RAM_SIZE CONFIG_RAM_SIZE*1K - CONFIG_BSP_SHARED_GDT_RAM_SIZE
#endif
#endif #endif
MEMORY MEMORY
@ -38,9 +50,13 @@ MEMORY
RAM (wx) : ORIGIN = PHYS_LOAD_ADDR, LENGTH = PHYS_RAM_SIZE RAM (wx) : ORIGIN = PHYS_LOAD_ADDR, LENGTH = PHYS_RAM_SIZE
#endif /* CONFIG_XIP */ #endif /* CONFIG_XIP */
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP #ifdef CONFIG_SYS_POWER_DEEP_SLEEP
BSP_SHARED_RAM (rw) : ORIGIN = CONFIG_BSP_SHARED_RAM_ADDR, BSP_SHARED_RAM (rw) : ORIGIN = CONFIG_BSP_SHARED_RESTORE_INFO_RAM_ADDR,
LENGTH = CONFIG_BSP_SHARED_RAM_SIZE LENGTH = CONFIG_BSP_SHARED_RESTORE_INFO_SIZE
#endif /* CONFIG_SYS_POWER_DEEP_SLEEP */ #endif /* CONFIG_SYS_POWER_DEEP_SLEEP */
#ifndef CONFIG_SET_GDT
BSP_SHARED_GDT_RAM (rw) : ORIGIN = CONFIG_BSP_SHARED_GDT_RAM_ADDR,
LENGTH = CONFIG_BSP_SHARED_GDT_RAM_SIZE
#endif /* !CONFIG_SET_GDT */
/* /*
* It doesn't matter where this region goes as it is stripped from the * It doesn't matter where this region goes as it is stripped from the

View file

@ -26,7 +26,8 @@ extern void _power_restore_cpu_context(void);
extern void _power_soc_deep_sleep(void); extern void _power_soc_deep_sleep(void);
#if (defined(CONFIG_SYS_POWER_DEEP_SLEEP)) #if (defined(CONFIG_SYS_POWER_DEEP_SLEEP))
static uint32_t *__x86_restore_info = (uint32_t *)CONFIG_BSP_SHARED_RAM_ADDR; static uint32_t *__x86_restore_info =
(uint32_t *)CONFIG_BSP_SHARED_RESTORE_INFO_RAM_ADDR;
static void _deep_sleep(enum power_states state) static void _deep_sleep(enum power_states state)
{ {

View file

@ -73,7 +73,7 @@ SECTION_FUNC(TEXT, _power_soc_deep_sleep)
* a supported feature in Quark SE boards and to be used at one's own risk. * a supported feature in Quark SE boards and to be used at one's own risk.
*/ */
SECTION_FUNC(TEXT, _sys_soc_resume_from_deep_sleep) SECTION_FUNC(TEXT, _sys_soc_resume_from_deep_sleep)
movl $CONFIG_BSP_SHARED_RAM_ADDR, %eax movl $CONFIG_BSP_SHARED_RESTORE_INFO_RAM_ADDR, %eax
cmpl $_power_restore_cpu_context, (%eax) cmpl $_power_restore_cpu_context, (%eax)
je _power_restore_cpu_context je _power_restore_cpu_context
ret ret