Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker: introduce boot and pinned regions #34717

Merged
merged 19 commits into from
May 10, 2021
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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>
  • Loading branch information
dcpleung committed May 10, 2021
commit 842acb76b3e2945e6629553b1ed61997ad78a316
8 changes: 8 additions & 0 deletions include/sys/device_mmio.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define ZEPHYR_INCLUDE_SYS_DEVICE_MMIO_H

#include <toolchain/common.h>
#include <linker/sections.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #41555 I'm moving this #include before the previous one to fix a BUILD_ASSERT redefinition


/**
* @defgroup device-mmio Device memory-mapped IO management
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down