blob: 63f928267673b05602e72dc465f7a0a991fdc30c [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
37 /* A classifier for an opaque configuration blob */
38 CONFIG_CLASSIFIER_BLOB
39};
40
41
42/**
43 * \brief Query for a particular configuration object
44 *
45 * \param[in] classifier The class of object
46 * \param[in] name The name of the object
47 * \param[in] instance The instance number
48 * \param[out] data Pointer to client provided buffer for the object
49 * \param[in] data_buf_size Size of the client provided buffer
50 *
51 * \return True if successful
52 */
53bool config_store_query(enum config_classifier classifier,
54 const char *name,
55 unsigned int instance,
56 void *data,
57 size_t data_buf_size);
58
59/**
60 * \brief Add an object to the config store
61 *
62 * \param[in] classifier The class of object
63 * \param[in] name The name of the object
64 * \param[in] instance The instance number
65 * \param[in] data The object data to add
66 * \param[in] data_len The size of the object
67 *
68 * \return True if successful
69 */
70bool config_store_add(enum config_classifier classifier,
71 const char *name,
72 unsigned int instance,
73 const void *data,
74 size_t data_len);
75
76/**
77 * \brief Returns a count of the number of objects of a particular class
78 *
79 * \param[in] classifier The class of object
80 *
81 * \return Count of objects held
82 */
83unsigned int config_store_count(enum config_classifier classifier);
84
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif /* CONFIG_STORE_H */