2 * Copyright (C) 2018 Marvell International Ltd.
4 * SPDX-License-Identifier: BSD-3-Clause
5 * https://spdx.org/licenses
10 #include <arch_helpers.h>
11 #include <lib/psci/psci.h>
13 #include <marvell_pm.h>
15 /* Standard ARM platforms are expected to export plat_arm_psci_pm_ops */
16 extern const plat_psci_ops_t plat_arm_psci_pm_ops
;
18 /*****************************************************************************
19 * Private function to program the mailbox for a cpu before it is released
20 * from reset. This function assumes that the mail box base is within
21 * the MARVELL_SHARED_RAM region
22 *****************************************************************************
24 void marvell_program_mailbox(uintptr_t address
)
26 uintptr_t *mailbox
= (void *)PLAT_MARVELL_MAILBOX_BASE
;
29 * Ensure that the PLAT_MARVELL_MAILBOX_BASE is within
30 * MARVELL_SHARED_RAM region.
32 assert((PLAT_MARVELL_MAILBOX_BASE
>= MARVELL_SHARED_RAM_BASE
) &&
33 ((PLAT_MARVELL_MAILBOX_BASE
+ sizeof(*mailbox
)) <=
34 (MARVELL_SHARED_RAM_BASE
+ MARVELL_SHARED_RAM_SIZE
)));
36 mailbox
[MBOX_IDX_MAGIC
] = MVEBU_MAILBOX_MAGIC_NUM
;
37 mailbox
[MBOX_IDX_SEC_ADDR
] = address
;
39 /* Flush data cache if the mail box shared RAM is cached */
40 #if PLAT_MARVELL_SHARED_RAM_CACHED
41 flush_dcache_range((uintptr_t)PLAT_MARVELL_MAILBOX_BASE
+
43 2 * sizeof(uint64_t));
47 /*****************************************************************************
48 * The ARM Standard platform definition of platform porting API
49 * `plat_setup_psci_ops`.
50 *****************************************************************************
52 int plat_setup_psci_ops(uintptr_t sec_entrypoint
,
53 const plat_psci_ops_t
**psci_ops
)
55 *psci_ops
= &plat_arm_psci_pm_ops
;
57 /* Setup mailbox with entry point. */
58 marvell_program_mailbox(sec_entrypoint
);