blob: 25744cfc833b8889016b5d925705a963b6967f12 [file] [log] [blame]
Julian Hall7048d302021-06-03 16:07:28 +01001/*
2 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef CONFIG_STORE_H
8#define CONFIG_STORE_H
9
10#include <stdbool.h>
11#include <stddef.h>
12
13/**
14 * Provides a common interface for retrieving configuration
15 * objects. Configuration objects are used at run-time
16 * to configure TS deployments such as a service provider
17 * running within a secure partition.
18 */
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24/**
25 * \brief A classifier for configuration objects
26 *
27 * Used as a label to identifier the general class of a configuartion object.
28 */
29enum config_classifier
30{
31 /* A classifier for a device region that describes a region of IO mapped memory */
32 CONFIG_CLASSIFIER_DEVICE_REGION,
33
34 /* A classifier for a memory region that describes a region of memory */
35 CONFIG_CLASSIFIER_MEMORY_REGION,
36
Balint Dobszay9a747852023-04-18 18:08:49 +020037 /* A classifier to describe a hardware feature's availability */
38 CONFIG_CLASSIFIER_HW_FEATURE,
39
Julian Hall7048d302021-06-03 16:07:28 +010040 /* A classifier for an opaque configuration blob */
41 CONFIG_CLASSIFIER_BLOB
42};
43
44
45/**
46 * \brief Query for a particular configuration object
47 *
48 * \param[in] classifier The class of object
49 * \param[in] name The name of the object
50 * \param[in] instance The instance number
51 * \param[out] data Pointer to client provided buffer for the object
52 * \param[in] data_buf_size Size of the client provided buffer
53 *
54 * \return True if successful
55 */
56bool config_store_query(enum config_classifier classifier,
57 const char *name,
58 unsigned int instance,
59 void *data,
60 size_t data_buf_size);
61
62/**
63 * \brief Add an object to the config store
64 *
65 * \param[in] classifier The class of object
66 * \param[in] name The name of the object
67 * \param[in] instance The instance number
68 * \param[in] data The object data to add
69 * \param[in] data_len The size of the object
70 *
71 * \return True if successful
72 */
73bool config_store_add(enum config_classifier classifier,
74 const char *name,
75 unsigned int instance,
76 const void *data,
77 size_t data_len);
78
79/**
80 * \brief Returns a count of the number of objects of a particular class
81 *
82 * \param[in] classifier The class of object
83 *
84 * \return Count of objects held
85 */
86unsigned int config_store_count(enum config_classifier classifier);
87
88
89#ifdef __cplusplus
90}
91#endif
92
93#endif /* CONFIG_STORE_H */