Files
OpenCellular/include/link_defs.h
Vincent Palatin b42dd73603 core: add chip-specific memory regions definition mechanism
When a chip has special/non-contiguous SRAM physical memory region,
rather than extending the generic linker file ad nauseam, define a
mechanism to declare a chip specific list of those regions.

To do so, a chip must declare the CONFIG_CHIP_MEMORY_REGIONS
configuration and have a memory_regions.inc with the list of regions.

The special-purpose preprocessed chip/<chip_name>/memory_regions.inc
file has one region declaration per line using the following macro:
REGION(name, attributes, start_address, size)

Each region will get a proper MEMORY entry and a section in the linker
file.
the __SECTION(region_name) helper is provided as a convenience to
declare variable in a specific region.

Note: those 'special' regions are NOT cleared at startup contrary to
.bss.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:67081508
TEST=on ZerbleBarn, along with the following CLs, run the firmware with
large arrays in special AHB memory regions.

Change-Id: I3f156ef6e5feb4a6a0b2ae2468bae8a20483f17c
Reviewed-on: https://chromium-review.googlesource.com/946368
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-03-05 23:48:28 -08:00

115 lines
4.2 KiB
C

/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Symbols from linker definitions
*/
#ifndef __CROS_EC_LINK_DEFS_H
#define __CROS_EC_LINK_DEFS_H
#include "console.h"
#include "hooks.h"
#include "host_command.h"
#include "mkbp_event.h"
#include "task.h"
#include "test_util.h"
/* Console commands */
extern const struct console_command __cmds[];
extern const struct console_command __cmds_end[];
/* Extension commands. */
extern const void *__extension_cmds;
extern const void *__extension_cmds_end;
/* Hooks */
extern const struct hook_data __hooks_init[];
extern const struct hook_data __hooks_init_end[];
extern const struct hook_data __hooks_pre_freq_change[];
extern const struct hook_data __hooks_pre_freq_change_end[];
extern const struct hook_data __hooks_freq_change[];
extern const struct hook_data __hooks_freq_change_end[];
extern const struct hook_data __hooks_sysjump[];
extern const struct hook_data __hooks_sysjump_end[];
extern const struct hook_data __hooks_chipset_pre_init[];
extern const struct hook_data __hooks_chipset_pre_init_end[];
extern const struct hook_data __hooks_chipset_startup[];
extern const struct hook_data __hooks_chipset_startup_end[];
extern const struct hook_data __hooks_chipset_resume[];
extern const struct hook_data __hooks_chipset_resume_end[];
extern const struct hook_data __hooks_chipset_suspend[];
extern const struct hook_data __hooks_chipset_suspend_end[];
extern const struct hook_data __hooks_chipset_shutdown[];
extern const struct hook_data __hooks_chipset_shutdown_end[];
extern const struct hook_data __hooks_chipset_reset[];
extern const struct hook_data __hooks_chipset_reset_end[];
extern const struct hook_data __hooks_ac_change[];
extern const struct hook_data __hooks_ac_change_end[];
extern const struct hook_data __hooks_lid_change[];
extern const struct hook_data __hooks_lid_change_end[];
extern const struct hook_data __hooks_tablet_mode_change[];
extern const struct hook_data __hooks_tablet_mode_change_end[];
extern const struct hook_data __hooks_pwrbtn_change[];
extern const struct hook_data __hooks_pwrbtn_change_end[];
extern const struct hook_data __hooks_battery_soc_change[];
extern const struct hook_data __hooks_battery_soc_change_end[];
#ifdef CONFIG_CASE_CLOSED_DEBUG_V1
extern const struct hook_data __hooks_ccd_change[];
extern const struct hook_data __hooks_ccd_change_end[];
#endif
#ifdef CONFIG_USB_SUSPEND
extern const struct hook_data __hooks_usb_change[];
extern const struct hook_data __hooks_usb_change_end[];
#endif
extern const struct hook_data __hooks_tick[];
extern const struct hook_data __hooks_tick_end[];
extern const struct hook_data __hooks_second[];
extern const struct hook_data __hooks_second_end[];
/* Deferrable functions and firing times*/
extern const struct deferred_data __deferred_funcs[];
extern const struct deferred_data __deferred_funcs_end[];
extern uint64_t __deferred_until[];
extern uint64_t __deferred_until_end[];
/* I2C fake devices for unit testing */
extern const struct test_i2c_xfer __test_i2c_xfer[];
extern const struct test_i2c_xfer __test_i2c_xfer_end[];
/* Host commands */
extern const struct host_command __hcmds[];
extern const struct host_command __hcmds_end[];
/* MKBP events */
extern const struct mkbp_event_source __mkbp_evt_srcs[];
extern const struct mkbp_event_source __mkbp_evt_srcs_end[];
/* IRQs (interrupt handlers) */
extern const struct irq_priority __irqprio[];
extern const struct irq_priority __irqprio_end[];
extern const void *__irqhandler[];
/* Shared memory buffer. Use via shared_mem.h interface. */
extern uint8_t __shared_mem_buf[];
/* Image sections used by the TPM2 library */
extern uint8_t *__bss_libtpm2_start;
extern uint8_t *__bss_libtpm2_end;
extern uint8_t *__data_libtpm2_start;
extern uint8_t *__data_libtpm2_end;
/* Image sections. */
extern const void *__ro_end;
extern const void *__data_start;
extern const void *__data_end;
/* Helper for special chip-specific memory sections */
#ifdef CONFIG_CHIP_MEMORY_REGIONS
#define __SECTION(name) __attribute__((section("." STRINGIFY(name) ".50_auto")))
#else
#define __SECTION(name)
#endif /* CONFIG_MEMORY_REGIONS */
#endif /* __CROS_EC_LINK_DEFS_H */