2 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
4 * SPDX-License-Identifier: BSD-3-Clause
10 #include <lib/utils.h>
12 #include "psci_private.h"
14 u_register_t
psci_mem_protect(unsigned int enable
)
18 assert(psci_plat_pm_ops
->read_mem_protect
!= NULL
);
19 assert(psci_plat_pm_ops
->write_mem_protect
!= NULL
);
21 if (psci_plat_pm_ops
->read_mem_protect(&val
) < 0)
22 return (u_register_t
) PSCI_E_NOT_SUPPORTED
;
23 if (psci_plat_pm_ops
->write_mem_protect(enable
) < 0)
24 return (u_register_t
) PSCI_E_NOT_SUPPORTED
;
26 return (val
!= 0) ? 1U : 0U;
29 u_register_t
psci_mem_chk_range(uintptr_t base
, u_register_t length
)
33 assert(psci_plat_pm_ops
->mem_protect_chk
!= NULL
);
35 if ((length
== 0U) || check_uptr_overflow(base
, length
- 1U))
36 return (u_register_t
) PSCI_E_DENIED
;
38 ret
= psci_plat_pm_ops
->mem_protect_chk(base
, length
);
40 (u_register_t
) PSCI_E_DENIED
: (u_register_t
) PSCI_E_SUCCESS
;