aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Custodio <Pedro.Krewinkelcustodio@arm.com>2018-08-14 16:29:24 +0100
committerronald-cron-arm <39518861+ronald-cron-arm@users.noreply.github.com>2019-01-08 17:14:25 +0000
commitc5c4eec25b45dcd3212186abad78e1b642b21a2d (patch)
tree3389ef8525ed930edd63e16609d38790bc9da5a7
parent3064c5411946bceaa71e912920bfed3a9991f32e (diff)
module: PCID support
Change-Id: I32066b1df94a76320923ea46c9307a4133a9acdf Signed-off-by: Elieva Pignat <Elieva.Pignat@arm.com> Signed-off-by: Chris Kay <chris.kay@arm.com>
-rw-r--r--module/pcid/include/mod_pcid.h70
-rw-r--r--module/pcid/src/Makefile11
-rw-r--r--module/pcid/src/mod_pcid.c35
3 files changed, 116 insertions, 0 deletions
diff --git a/module/pcid/include/mod_pcid.h b/module/pcid/include/mod_pcid.h
new file mode 100644
index 00000000..3e1492a8
--- /dev/null
+++ b/module/pcid/include/mod_pcid.h
@@ -0,0 +1,70 @@
+/*
+ * Arm SCP/MCP Software
+ * Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef MOD_PCID_H
+#define MOD_PCID_H
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <fwk_macros.h>
+
+/*!
+ * \addtogroup GroupModules Modules
+ * @{
+ */
+
+/*!
+ * \defgroup GroupModulePCID PCID
+ *
+ * \brief Module used to check the peripheral and component IDs.
+ *
+ * @{
+ */
+
+/*!
+ * \brief PID and CID registers.
+ */
+struct mod_pcid_registers {
+ FWK_R uint32_t PID4; /*!< Peripheral ID 4 */
+ FWK_R uint32_t PID5; /*!< Peripheral ID 5 */
+ FWK_R uint32_t PID6; /*!< Peripheral ID 6 */
+ FWK_R uint32_t PID7; /*!< Peripheral ID 7 */
+ FWK_R uint32_t PID0; /*!< Peripheral ID 0 */
+ FWK_R uint32_t PID1; /*!< Peripheral ID 1 */
+ FWK_R uint32_t PID2; /*!< Peripheral ID 2 */
+ FWK_R uint32_t PID3; /*!< Peripheral ID 3 */
+ FWK_R uint32_t CID0; /*!< Component ID 0 */
+ FWK_R uint32_t CID1; /*!< Component ID 1 */
+ FWK_R uint32_t CID2; /*!< Component ID 2 */
+ FWK_R uint32_t CID3; /*!< Component ID 3 */
+};
+
+/*!
+ * \brief Check peripheral and component id registers against expected values.
+ *
+ * \param registers Pointer to set of PCID registers to check.
+ * \param expected Pointer to set of PCID Registers that denote the expected
+ * values.
+ *
+ * \pre \p registers must not be NULL
+ * \pre \p expected must not be NULL
+ *
+ * \retval true All the registers have the expected values.
+ * \retval false One or more registers do not have the expected values.
+ */
+bool mod_pcid_check_registers(const struct mod_pcid_registers *registers,
+ const struct mod_pcid_registers *expected);
+
+/*!
+ * @}
+ */
+
+/*!
+ * @}
+ */
+
+#endif /* MOD_PCID_H */
diff --git a/module/pcid/src/Makefile b/module/pcid/src/Makefile
new file mode 100644
index 00000000..178e9717
--- /dev/null
+++ b/module/pcid/src/Makefile
@@ -0,0 +1,11 @@
+#
+# Arm SCP/MCP Software
+# Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+BS_LIB_NAME := PCID
+BS_LIB_SOURCES := mod_pcid.c
+
+include $(BS_DIR)/lib.mk
diff --git a/module/pcid/src/mod_pcid.c b/module/pcid/src/mod_pcid.c
new file mode 100644
index 00000000..c6b8e4cf
--- /dev/null
+++ b/module/pcid/src/mod_pcid.c
@@ -0,0 +1,35 @@
+/*
+ * Arm SCP/MCP Software
+ * Copyright (c) 2018-2019, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <stdbool.h>
+#include <string.h>
+#include <fwk_assert.h>
+#include <fwk_module.h>
+#include <mod_pcid.h>
+
+bool mod_pcid_check_registers(const struct mod_pcid_registers *registers,
+ const struct mod_pcid_registers *expected)
+{
+ assert(registers != NULL);
+ assert(expected != NULL);
+
+ return !memcmp(registers, expected, sizeof(*registers));
+}
+
+static int pcid_init(fwk_id_t module_id,
+ unsigned int element_count,
+ const void *data)
+{
+ return FWK_SUCCESS;
+}
+
+const struct fwk_module_config config_pcid = { 0 };
+const struct fwk_module module_pcid = {
+ .name = "PCID",
+ .type = FWK_MODULE_TYPE_SERVICE,
+ .init = pcid_init,
+};