mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00
refactor(stm32mp1): remove unused refcount helper functions
Remove stm32mp_incr_shrefcnt(), stm32mp_decr_shrefcnt(), stm32mp_incr_refcnt() and stm32mp_decr_refcnt() that are unused. The file is then just removed. Change-Id: I09ee23c02317df5d8f71cbc355d3ed4a67ce2749 Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Yann Gautier <yann.gautier@st.com>
This commit is contained in:
parent
356ed96118
commit
e1bfbf8ad3
2 changed files with 0 additions and 75 deletions
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2019, STMicroelectronics - All Rights Reserved
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef STM32MP_SHRES_HELPERS_H
|
||||
#define STM32MP_SHRES_HELPERS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <common/debug.h>
|
||||
|
||||
/*
|
||||
* Shared reference counter: increments by 2 on secure increment
|
||||
* request, decrements by 2 on secure decrement request. Bit #0
|
||||
* is set to 1 on non-secure increment request and reset to 0 on
|
||||
* non-secure decrement request. The counter initializes to
|
||||
* either 0, 1 or 2 upon their expect default state.
|
||||
* Counters saturates once above UINT_MAX / 2.
|
||||
*/
|
||||
#define SHREFCNT_NONSECURE_FLAG 0x1UL
|
||||
#define SHREFCNT_SECURE_STEP 0x2UL
|
||||
#define SHREFCNT_MAX (UINT32_MAX / 2)
|
||||
|
||||
/* Return 1 if refcnt increments from 0, else return 0 */
|
||||
static inline int stm32mp_incr_shrefcnt(unsigned int *refcnt, bool secure)
|
||||
{
|
||||
int rc = !*refcnt;
|
||||
|
||||
if (secure) {
|
||||
*refcnt += SHREFCNT_SECURE_STEP;
|
||||
if (*refcnt >= SHREFCNT_MAX) {
|
||||
panic();
|
||||
}
|
||||
} else {
|
||||
*refcnt |= SHREFCNT_NONSECURE_FLAG;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Return 1 if refcnt decrements to 0, else return 0 */
|
||||
static inline int stm32mp_decr_shrefcnt(unsigned int *refcnt, bool secure)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (secure) {
|
||||
if (*refcnt < SHREFCNT_MAX) {
|
||||
if (*refcnt < SHREFCNT_SECURE_STEP) {
|
||||
panic();
|
||||
}
|
||||
*refcnt -= SHREFCNT_SECURE_STEP;
|
||||
rc = !*refcnt;
|
||||
}
|
||||
} else {
|
||||
rc = (*refcnt == SHREFCNT_NONSECURE_FLAG) ? 1 : 0;
|
||||
*refcnt &= ~SHREFCNT_NONSECURE_FLAG;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static inline int stm32mp_incr_refcnt(unsigned int *refcnt)
|
||||
{
|
||||
return stm32mp_incr_shrefcnt(refcnt, true);
|
||||
}
|
||||
|
||||
static inline int stm32mp_decr_refcnt(unsigned int *refcnt)
|
||||
{
|
||||
return stm32mp_decr_shrefcnt(refcnt, true);
|
||||
}
|
||||
|
||||
#endif /* STM32MP_SHRES_HELPERS_H */
|
|
@ -22,7 +22,6 @@
|
|||
#include <stm32mp_auth.h>
|
||||
#include <stm32mp_common.h>
|
||||
#include <stm32mp_dt.h>
|
||||
#include <stm32mp_shres_helpers.h>
|
||||
#include <stm32mp1_dbgmcu.h>
|
||||
#include <stm32mp1_private.h>
|
||||
#include <stm32mp1_shared_resources.h>
|
||||
|
|
Loading…
Add table
Reference in a new issue