Skip to content

Commit a0cfa7e

Browse files
RcColesDavid Hu
authored and
David Hu
committed
RSS: Add SIC MPC
Change-Id: Ie2e0be4f9e3cb72a457425566eec07d49015f5a6 Signed-off-by: Raef Coles <[email protected]>
1 parent 76a5b10 commit a0cfa7e

File tree

8 files changed

+187
-8
lines changed

8 files changed

+187
-8
lines changed

platform/ext/target/arm/rss/common/cmsis_drivers/Driver_MPC.c

Lines changed: 141 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016-2022 Arm Limited. All rights reserved.
2+
* Copyright (c) 2016-2023 Arm Limited. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -342,3 +342,143 @@ ARM_DRIVER_MPC Driver_VM1_MPC = {
342342
.LockDown = VM1_MPC_LockDown,
343343
};
344344
#endif /* RTE_VM1_MPC */
345+
346+
#if (RTE_SIC_MPC)
347+
/* Ranges controlled by this SIC_MPC */
348+
static const struct mpc_sie_memory_range_t MPC_SIC_RANGE_S = {
349+
.base = MPC_SIC_RANGE_BASE_S,
350+
.limit = MPC_SIC_RANGE_LIMIT_S,
351+
.range_offset = 0,
352+
.attr = MPC_SIE_SEC_ATTR_SECURE
353+
};
354+
355+
static const struct mpc_sie_memory_range_t MPC_SIC_RANGE_NS = {
356+
.base = MPC_SIC_RANGE_BASE_NS,
357+
.limit = MPC_SIC_RANGE_LIMIT_NS,
358+
.range_offset = 0,
359+
.attr = MPC_SIE_SEC_ATTR_NONSECURE
360+
};
361+
362+
#define MPC_SIC_RANGE_LIST_LEN 2u
363+
static const struct mpc_sie_memory_range_t*
364+
MPC_SIC_RANGE_LIST[MPC_SIC_RANGE_LIST_LEN] = {
365+
&MPC_SIC_RANGE_S,
366+
&MPC_SIC_RANGE_NS
367+
};
368+
369+
/* SIC_MPC Driver wrapper functions */
370+
static int32_t SIC_MPC_Initialize(void)
371+
{
372+
enum mpc_sie_error_t ret;
373+
374+
ret = mpc_sie_init(&MPC_SIC_DEV,
375+
MPC_SIC_RANGE_LIST,
376+
MPC_SIC_RANGE_LIST_LEN);
377+
378+
return error_trans(ret);
379+
}
380+
381+
static int32_t SIC_MPC_Uninitialize(void)
382+
{
383+
/* Nothing to be done */
384+
return ARM_DRIVER_OK;
385+
}
386+
387+
static int32_t SIC_MPC_GetBlockSize(uint32_t *blk_size)
388+
{
389+
enum mpc_sie_error_t ret;
390+
391+
ret = mpc_sie_get_block_size(&MPC_SIC_DEV, blk_size);
392+
393+
return error_trans(ret);
394+
}
395+
396+
static int32_t SIC_MPC_GetCtrlConfig(uint32_t *ctrl_val)
397+
{
398+
enum mpc_sie_error_t ret;
399+
400+
ret = mpc_sie_get_ctrl(&MPC_SIC_DEV, ctrl_val);
401+
402+
return error_trans(ret);
403+
}
404+
405+
static int32_t SIC_MPC_SetCtrlConfig(uint32_t ctrl)
406+
{
407+
enum mpc_sie_error_t ret;
408+
409+
ret = mpc_sie_set_ctrl(&MPC_SIC_DEV, ctrl);
410+
411+
return error_trans(ret);
412+
}
413+
414+
static int32_t SIC_MPC_GetRegionConfig(uintptr_t base,
415+
uintptr_t limit,
416+
ARM_MPC_SEC_ATTR *attr)
417+
{
418+
enum mpc_sie_error_t ret;
419+
420+
ret = mpc_sie_get_region_config(&MPC_SIC_DEV, base, limit,
421+
(enum mpc_sie_sec_attr_t*)attr);
422+
423+
return error_trans(ret);
424+
}
425+
426+
static int32_t SIC_MPC_ConfigRegion(uintptr_t base,
427+
uintptr_t limit,
428+
ARM_MPC_SEC_ATTR attr)
429+
{
430+
enum mpc_sie_error_t ret;
431+
432+
ret = mpc_sie_config_region(&MPC_SIC_DEV, base, limit,
433+
(enum mpc_sie_sec_attr_t)attr);
434+
435+
return error_trans(ret);
436+
}
437+
438+
static int32_t SIC_MPC_EnableInterrupt(void)
439+
{
440+
enum mpc_sie_error_t ret;
441+
442+
ret = mpc_sie_irq_enable(&MPC_SIC_DEV);
443+
444+
return error_trans(ret);
445+
}
446+
447+
static void SIC_MPC_DisableInterrupt(void)
448+
{
449+
mpc_sie_irq_disable(&MPC_SIC_DEV);
450+
}
451+
452+
453+
static void SIC_MPC_ClearInterrupt(void)
454+
{
455+
mpc_sie_clear_irq(&MPC_SIC_DEV);
456+
}
457+
458+
static uint32_t SIC_MPC_InterruptState(void)
459+
{
460+
return mpc_sie_irq_state(&MPC_SIC_DEV);
461+
}
462+
463+
static int32_t SIC_MPC_LockDown(void)
464+
{
465+
return mpc_sie_lock_down(&MPC_SIC_DEV);
466+
}
467+
468+
/* SIC_MPC Driver CMSIS access structure */
469+
ARM_DRIVER_MPC Driver_SIC_MPC = {
470+
.GetVersion = ARM_MPC_GetVersion,
471+
.Initialize = SIC_MPC_Initialize,
472+
.Uninitialize = SIC_MPC_Uninitialize,
473+
.GetBlockSize = SIC_MPC_GetBlockSize,
474+
.GetCtrlConfig = SIC_MPC_GetCtrlConfig,
475+
.SetCtrlConfig = SIC_MPC_SetCtrlConfig,
476+
.ConfigRegion = SIC_MPC_ConfigRegion,
477+
.GetRegionConfig = SIC_MPC_GetRegionConfig,
478+
.EnableInterrupt = SIC_MPC_EnableInterrupt,
479+
.DisableInterrupt = SIC_MPC_DisableInterrupt,
480+
.ClearInterrupt = SIC_MPC_ClearInterrupt,
481+
.InterruptState = SIC_MPC_InterruptState,
482+
.LockDown = SIC_MPC_LockDown,
483+
};
484+
#endif /* RTE_SIC_MPC */

platform/ext/target/arm/rss/common/cmsis_drivers/config/RTE_Device.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2022 Arm Limited. All rights reserved.
2+
* Copyright (c) 2019-2023 Arm Limited. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,12 @@
3131
// <i> Configuration settings for Driver_VM1_MPC in component ::Drivers:MPC
3232
#define RTE_VM1_MPC 1
3333

34+
// <q> MPC (Memory Protection Controller) [Driver_SIC_MPC]
35+
// <i> Configuration settings for Driver_SIC_MPC in component ::Drivers:MPC
36+
#ifdef RSS_XIP
37+
#define RTE_SIC_MPC 1
38+
#endif /* RSS_XIP */
39+
3440
// <q> PPC (Peripheral Protection Controller) [PPC_RSS_MAIN0]
3541
// <i> Configuration settings for Driver_PPC_RSS_MAIN0 in component ::Drivers:PPC
3642
#define RTE_PPC_RSS_MAIN0 1

platform/ext/target/arm/rss/common/cmsis_drivers/config/cmsis_driver_config.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2022 Arm Limited. All rights reserved.
2+
* Copyright (c) 2019-2023 Arm Limited. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,9 @@
2727

2828
#define MPC_VM0_DEV MPC_VM0_DEV_S
2929
#define MPC_VM1_DEV MPC_VM1_DEV_S
30+
#ifdef RSS_XIP
31+
#define MPC_SIC_DEV MPC_SIC_DEV_S
32+
#endif /* RSS_XIP */
3033

3134
#define PPC_RSS_MAIN0_DEV PPC_RSS_MAIN0_DEV_S
3235
#define PPC_RSS_MAIN_EXP0_DEV PPC_RSS_MAIN_EXP0_DEV_S

platform/ext/target/arm/rss/common/device/config/device_cfg.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2022 Arm Limited. All rights reserved.
2+
* Copyright (c) 2019-2023 Arm Limited. All rights reserved.
33
*
44
* Licensed under the Apache License Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,6 +29,9 @@
2929
/* ARM Memory Protection Controller (MPC) */
3030
#define MPC_VM0_S
3131
#define MPC_VM1_S
32+
#ifdef RSS_XIP
33+
#define MPC_SIC_S
34+
#endif /* RSS_XIP */
3235

3336
/* ARM Peripheral Protection Controllers (PPC) */
3437
#define PPC_RSS_MAIN0_S

platform/ext/target/arm/rss/common/device/include/device_definition.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2022 Arm Limited. All rights reserved.
2+
* Copyright (c) 2019-2023 Arm Limited. All rights reserved.
33
*
44
* Licensed under the Apache License Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -181,6 +181,11 @@ extern struct mpc_sie_dev_t MPC_VM0_DEV_S;
181181
extern struct mpc_sie_dev_t MPC_VM1_DEV_S;
182182
#endif
183183

184+
#ifdef MPC_SIC_S
185+
#include "mpc_sie_drv.h"
186+
extern struct mpc_sie_dev_t MPC_SIC_DEV_S;
187+
#endif
188+
184189
/* Message Handling Units (MHU) */
185190
#ifdef MHU_AP_TO_RSS
186191
#include "mhu_v2_x.h"

platform/ext/target/arm/rss/common/device/source/device_definition.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2022 Arm Limited. All rights reserved.
2+
* Copyright (c) 2019-2023 Arm Limited. All rights reserved.
33
*
44
* Licensed under the Apache License Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -440,6 +440,18 @@ struct mpc_sie_dev_t MPC_VM1_DEV_S = {
440440
&(MPC_VM1_DEV_DATA_S)};
441441
#endif
442442

443+
#ifdef MPC_SIC_S
444+
static const struct mpc_sie_dev_cfg_t MPC_SIC_DEV_CFG_S = {
445+
.base = MPC_SIC_BASE_S};
446+
static struct mpc_sie_dev_data_t MPC_SIC_DEV_DATA_S = {
447+
.range_list = 0,
448+
.nbr_of_ranges = 0,
449+
.is_initialized = false };
450+
struct mpc_sie_dev_t MPC_SIC_DEV_S = {
451+
&(MPC_SIC_DEV_CFG_S),
452+
&(MPC_SIC_DEV_DATA_S)};
453+
#endif
454+
443455
/* Message Handling Units (MHU) */
444456
#ifdef MHU_AP_TO_RSS
445457
struct mhu_v2_x_dev_t MHU_AP_TO_RSS_DEV = {

platform/ext/target/arm/rss/common/partition/platform_base_address.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2022 Arm Limited
2+
* Copyright (c) 2019-2023 Arm Limited
33
*
44
* Licensed under the Apache License Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -93,6 +93,7 @@
9393
#define GPIO1_CMSDK_BASE_S 0x50101000 /* GPIO 1 Secure base address */
9494
#define SIC_BASE_S 0x50140000 /* SIC Secure base address */
9595
#define ATU_BASE_S 0x50150000 /* ATU Secure base address */
96+
#define MPC_SIC_BASE_S 0x50151000 /* SIC Memory Protection Controller Secure base address */
9697
#define SYSCNTR_CNTRL_BASE_S 0x5015A000 /* System Counter Control Secure base address */
9798
#define SYSCNTR_READ_BASE_S 0x5015B000 /* System Counter Read Secure base address */
9899
#define MHU0_SENDER_BASE_S 0x50160000 /* Combined MHU 0 Sender Secure base address */
@@ -173,4 +174,12 @@
173174
#define MPC_VM1_RANGE_LIMIT_S (VM1_BASE_S + VM1_SIZE-1)
174175
#define MPC_VM1_RANGE_OFFSET_S (0x0)
175176

177+
/* SIC -- 1 MiB */
178+
#define MPC_SIC_RANGE_BASE_NS (SIC_HOST_BASE_NS)
179+
#define MPC_SIC_RANGE_LIMIT_NS (SIC_HOST_BASE_NS + SIC_MAPPABLE_SIZE-1)
180+
#define MPC_SIC_RANGE_OFFSET_NS (0x0)
181+
#define MPC_SIC_RANGE_BASE_S (SIC_HOST_BASE_S)
182+
#define MPC_SIC_RANGE_LIMIT_S (SIC_HOST_BASE_S + SIC_MAPPABLE_SIZE-1)
183+
#define MPC_SIC_RANGE_OFFSET_S (0x0)
184+
176185
#endif /* __PLATFORM_BASE_ADDRESS_H__ */

platform/ext/target/arm/rss/common/target_cfg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019-2022 Arm Limited. All rights reserved.
2+
* Copyright (c) 2019-2023 Arm Limited. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -92,6 +92,7 @@ const struct dma350_remap_list_t dma350_address_remap = {
9292
/* Import MPC drivers */
9393
extern ARM_DRIVER_MPC Driver_VM0_MPC;
9494
extern ARM_DRIVER_MPC Driver_VM1_MPC;
95+
extern ARM_DRIVER_MPC Driver_SIC_MPC;
9596

9697
/* Import PPC drivers */
9798
extern DRIVER_PPC_RSS Driver_PPC_RSS_MAIN0;

0 commit comments

Comments
 (0)