Lines Matching +full:device +full:- +full:sram
1 // SPDX-License-Identifier: GPL-2.0-only
3 * SRAM protect-exec region helper functions
5 * Copyright (C) 2017 Texas Instruments Incorporated - https://www.ti.com/
9 #include <linux/device.h>
12 #include <linux/sram.h>
17 #include "sram.h"
22 int sram_check_protect_exec(struct sram_dev *sram, struct sram_reserve *block, in sram_check_protect_exec() argument
25 unsigned long base = (unsigned long)part->base; in sram_check_protect_exec()
26 unsigned long end = base + block->size; in sram_check_protect_exec()
29 dev_err(sram->dev, in sram_check_protect_exec()
30 "SRAM pool marked with 'protect-exec' is not page aligned and will not be created.\n"); in sram_check_protect_exec()
31 return -ENOMEM; in sram_check_protect_exec()
40 list_add_tail(&part->list, &exec_pool_list); in sram_add_protect_exec()
47 * sram_exec_copy - copy data to a protected executable region of sram
49 * @pool: struct gen_pool retrieved that is part of this sram
57 * This helper function allows sram driver to act as central control location
58 * of 'protect-exec' pools which are normal sram pools but are always set
59 * read-only and executable except when copying data to them, at which point
60 * they are set to read-write non-executable, to make sure no memory is
61 * writeable and executable at the same time. This region must be page-aligned
84 if (p->pool == pool) in sram_exec_copy()
95 base = (unsigned long)part->base; in sram_exec_copy()
98 mutex_lock(&part->lock); in sram_exec_copy()
113 mutex_unlock(&part->lock); in sram_exec_copy()
118 mutex_unlock(&part->lock); in sram_exec_copy()