Skip to content

Commit 2196d2a

Browse files
fsammoura1980cfriedt
authored andcommitted
Revert "riscv: pmp: Add helper to write PMP configuration CSRs"
This reverts commit 9482f8d. Signed-off-by: Firas Sammoura <[email protected]>
1 parent f36f8d4 commit 2196d2a

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

arch/riscv/core/pmp.c

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -134,40 +134,6 @@ static inline void z_riscv_pmp_read_config(unsigned long *pmp_cfg, size_t pmp_cf
134134
#endif
135135
}
136136

137-
/**
138-
* @brief Writes the PMP configuration CSRs (pmpcfgX) based on architecture and slot count.
139-
*
140-
* This helper function abstracts the logic required to write the correct Control and Status
141-
* Registers (CSRs)—pmpcfg0, pmpcfg1, etc.—by accounting for whether the system is 32-bit or
142-
* 64-bit and the total number of PMP slots configured. It handles the different register
143-
* packing schemes between RV32 and RV64.
144-
*
145-
* @param pmp_cfg Pointer to the array containing the PMP configuration values to be written
146-
* to the CSRs.
147-
* @param pmp_cfg_size The size of the pmp_cfg array, measured in unsigned long entries.
148-
*/
149-
static inline void z_riscv_pmp_write_config(unsigned long *pmp_cfg, size_t pmp_cfg_size)
150-
{
151-
__ASSERT(pmp_cfg_size == (size_t)(CONFIG_PMP_SLOTS / PMPCFG_STRIDE),
152-
"Invalid PMP config array size");
153-
154-
#ifdef CONFIG_64BIT
155-
/* RV64: pmpcfg0 holds entries 0-7; pmpcfg2 holds entries 8-15. */
156-
csr_write(pmpcfg0, pmp_cfg[0]);
157-
#if CONFIG_PMP_SLOTS > 8
158-
csr_write(pmpcfg2, pmp_cfg[1]);
159-
#endif
160-
#else
161-
/* RV32: Each pmpcfg register holds 4 entries. */
162-
csr_write(pmpcfg0, pmp_cfg[0]);
163-
csr_write(pmpcfg1, pmp_cfg[1]);
164-
#if CONFIG_PMP_SLOTS > 8
165-
csr_write(pmpcfg2, pmp_cfg[2]);
166-
csr_write(pmpcfg3, pmp_cfg[3]);
167-
#endif
168-
#endif
169-
}
170-
171137
/**
172138
* @brief Reads the PMP address CSRs (pmpaddrX) for all configured slots.
173139
*

0 commit comments

Comments
 (0)