devices: mark device MMIO declarations to boot/pinned sections

This adds to the macros for device MMIO declaration so they can
be put into  boot or pinned linker sections as needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-03-17 13:29:13 -07:00 committed by Kumar Gala
parent 0a45691aeb
commit af20208cd9

View File

@ -16,6 +16,7 @@
#define ZEPHYR_INCLUDE_SYS_DEVICE_MMIO_H
#include <toolchain/common.h>
#include <linker/sections.h>
/**
* @defgroup device-mmio Device memory-mapped IO management
@ -81,6 +82,7 @@ struct z_device_mmio_rom {
* @param flags Caching mode and access flags, see K_MEM_CACHE_* and
* K_MEM_PERM_* macros
*/
__boot_func
static inline void device_map(mm_reg_t *virt_addr, uintptr_t phys_addr,
size_t size, uint32_t flags)
{
@ -539,11 +541,14 @@ struct z_device_mmio_rom {
*/
#ifdef DEVICE_MMIO_IS_IN_RAM
#define DEVICE_MMIO_TOPLEVEL(name, node_id) \
__pinned_bss \
mm_reg_t Z_TOPLEVEL_RAM_NAME(name); \
__pinned_rodata \
const struct z_device_mmio_rom Z_TOPLEVEL_ROM_NAME(name) = \
Z_DEVICE_MMIO_ROM_INITIALIZER(node_id)
#else
#define DEVICE_MMIO_TOPLEVEL(name, node_id) \
__pinned_rodata \
const struct z_device_mmio_rom Z_TOPLEVEL_ROM_NAME(name) = \
Z_DEVICE_MMIO_ROM_INITIALIZER(node_id)
#endif /* DEVICE_MMIO_IS_IN_RAM */
@ -587,11 +592,14 @@ struct z_device_mmio_rom {
*/
#ifdef DEVICE_MMIO_IS_IN_RAM
#define DEVICE_MMIO_TOPLEVEL_STATIC(name, node_id) \
__pinned_bss \
static mm_reg_t Z_TOPLEVEL_RAM_NAME(name); \
__pinned_rodata \
static const struct z_device_mmio_rom Z_TOPLEVEL_ROM_NAME(name) = \
Z_DEVICE_MMIO_ROM_INITIALIZER(node_id)
#else
#define DEVICE_MMIO_TOPLEVEL_STATIC(name, node_id) \
__pinned_rodata \
static const struct z_device_mmio_rom Z_TOPLEVEL_ROM_NAME(name) = \
Z_DEVICE_MMIO_ROM_INITIALIZER(node_id)
#endif /* DEVICE_MMIO_IS_IN_RAM */