diff options
author | Anurag Koul <anurag.koul@arm.com> | 2020-06-03 17:46:52 +0100 |
---|---|---|
committer | jimqui01 <54316584+jimqui01@users.noreply.github.com> | 2020-09-15 17:03:53 +0100 |
commit | c8487ff6a25825ded5c18833b0be56c8cee21f56 (patch) | |
tree | d341179552eb8e7f0ab6ca32e3253c8e9d10e4d0 /product/morello | |
parent | c5b00dbdb30857e2fa6f077e749efa2600719bdb (diff) |
morello: add morello core support functions
Add Morello core support functions for determining core
count, cluster count, multi-chip mode, etc.
Change-Id: I9943f566bf07af403d8e03991fc1d7fa51c96853
Signed-off-by: Anurag Koul <anurag.koul@arm.com>
Diffstat (limited to 'product/morello')
-rw-r--r-- | product/morello/include/morello_core.h | 23 | ||||
-rw-r--r-- | product/morello/src/morello_core.c | 43 |
2 files changed, 66 insertions, 0 deletions
diff --git a/product/morello/include/morello_core.h b/product/morello/include/morello_core.h new file mode 100644 index 00000000..58bffca4 --- /dev/null +++ b/product/morello/include/morello_core.h @@ -0,0 +1,23 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef MORELLO_CORE_H +#define MORELLO_CORE_H + +#include <stdbool.h> +#include <stdint.h> + +#define CORES_PER_CLUSTER 2 +#define NUMBER_OF_CLUSTERS 2 + +unsigned int morello_core_get_core_per_cluster_count(unsigned int cluster); +unsigned int morello_core_get_core_count(void); +unsigned int morello_core_get_cluster_count(void); +bool morello_is_multichip_enabled(void); +uint8_t morello_get_chipid(void); + +#endif /* MORELLO_CORE_H */ diff --git a/product/morello/src/morello_core.c b/product/morello/src/morello_core.c new file mode 100644 index 00000000..b195f0c9 --- /dev/null +++ b/product/morello/src/morello_core.c @@ -0,0 +1,43 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "morello_core.h" +#include "morello_scc_reg.h" +#include "morello_scp_pik.h" + +#include <fwk_assert.h> + +unsigned int morello_core_get_core_per_cluster_count(unsigned int cluster) +{ + assert(cluster < morello_core_get_cluster_count()); + + return CORES_PER_CLUSTER; +} + +unsigned int morello_core_get_core_count(void) +{ + return (NUMBER_OF_CLUSTERS * CORES_PER_CLUSTER); +} + +unsigned int morello_core_get_cluster_count(void) +{ + return NUMBER_OF_CLUSTERS; +} + +bool morello_is_multichip_enabled(void) +{ + return ( + (SCC->PLATFORM_CTRL & SCC_PLATFORM_CTRL_MULTI_CHIP_MODE_MASK) >> + SCC_PLATFORM_CTRL_MULTI_CHIP_MODE_POS); +} + +uint8_t morello_get_chipid(void) +{ + return ((uint8_t)( + (SCC->PLATFORM_CTRL & SCC_PLATFORM_CTRL_CHIPID_MASK) >> + SCC_PLATFORM_CTRL_CHIPID_POS)); +} |