it8xxx2/linker: append h2ram_pool section at the end of used memory

Since __sha256_ram_block section must in the first 4KB,
h2ram_pool section is no longer included first inside the
RAMABLE_REGION.
Append h2ram_pool section at the end of used memory, so gap
due to alignment is still available for newly added variables.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
This commit is contained in:
Dino Li 2023-08-25 14:59:34 +08:00 committed by Carles Cufí
commit 003e0be6fb
4 changed files with 17 additions and 27 deletions

View file

@ -204,7 +204,7 @@ static const struct ec2i_t pmc2_settings[] = {
* This feature allows host access EC's memory directly by eSPI I/O cycles. * This feature allows host access EC's memory directly by eSPI I/O cycles.
* Mapping range is 4K bytes and base address is adjustable. * Mapping range is 4K bytes and base address is adjustable.
* Eg. the I/O cycle 800h~8ffh from host can be mapped to x800h~x8ffh. * Eg. the I/O cycle 800h~8ffh from host can be mapped to x800h~x8ffh.
* Linker script of h2ram.ld will make the pool 4K aligned. * Linker script will make the pool 4K aligned.
*/ */
#define IT8XXX2_ESPI_H2RAM_POOL_SIZE_MAX 0x1000 #define IT8XXX2_ESPI_H2RAM_POOL_SIZE_MAX 0x1000
#define IT8XXX2_ESPI_H2RAM_OFFSET_MASK GENMASK(5, 0) #define IT8XXX2_ESPI_H2RAM_OFFSET_MASK GENMASK(5, 0)

View file

@ -3,10 +3,3 @@ zephyr_sources(
) )
zephyr_library_sources_ifndef(CONFIG_RISCV_ISA_EXT_M __arithmetic.S) zephyr_library_sources_ifndef(CONFIG_RISCV_ISA_EXT_M __arithmetic.S)
zephyr_sources_ifdef(CONFIG_SOC_IT8XXX2_USE_ILM ilm.c) zephyr_sources_ifdef(CONFIG_SOC_IT8XXX2_USE_ILM ilm.c)
# IMPORTANT:
# The h2ram section must be first added to RAM_SECTIONS to avoid gap.
zephyr_linker_sources_ifdef(CONFIG_ESPI_IT8XXX2
RAM_SECTIONS
h2ram.ld
)

View file

@ -1,19 +0,0 @@
/*
* Copyright (c) 2022 ITE Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
SECTION_PROLOGUE(.h2ram_pool, (NOLOAD),)
{
/*
* Ensure this section is 4k-byte aligned.
* NOTE: This won't cause gap if this is included first inside
* the RAMABLE_REGION. Because RAM base is 4k-byte aligned.
*/
. = ALIGN(0x1000);
_h2ram_pool_start = .;
KEEP(*(.h2ram_pool))
_h2ram_pool_end = .;
} GROUP_LINK_IN(RAMABLE_REGION)
_h2ram_pool_size = ABSOLUTE(_h2ram_pool_end - _h2ram_pool_start);

View file

@ -356,6 +356,22 @@ SECTIONS
__data_region_end = .; __data_region_end = .;
SECTION_DATA_PROLOGUE(.h2ram_pool,(NOLOAD),)
{
/*
* Since __sha256_ram_block section must in the first 4KB,
* h2ram_pool section is no longer included first inside the
* RAMABLE_REGION.
* Append h2ram_pool section at the end of used memory, so gap
* due to alignment is still available for newly added variables
*/
. = ALIGN(0x1000);
_h2ram_pool_start = .;
KEEP(*(.h2ram_pool))
_h2ram_pool_end = .;
} GROUP_DATA_LINK_IN(RAMABLE_REGION, RAMABLE_REGION)
_h2ram_pool_size = ABSOLUTE(_h2ram_pool_end - _h2ram_pool_start);
__kernel_ram_end = .; __kernel_ram_end = .;
__kernel_ram_size = __kernel_ram_end - __kernel_ram_start; __kernel_ram_size = __kernel_ram_end - __kernel_ram_start;