1 /*
2  * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef STANDALONE_SMM_VARIABLE_SERVICE_CONTEXT_H
8 #define STANDALONE_SMM_VARIABLE_SERVICE_CONTEXT_H
9 
10 #include <stddef.h>
11 #include <stdint.h>
12 #include <service/locator/standalone/standalone_service_context.h>
13 #include <service/uefi/smm_variable/provider/smm_variable_provider.h>
14 #include <service/secure_storage/backend/secure_storage_client/secure_storage_client.h>
15 #include <service/secure_storage/backend/mock_store/mock_store.h>
16 
17 class smm_variable_service_context : public standalone_service_context
18 {
19 public:
20 	smm_variable_service_context(const char *sn);
21 	virtual ~smm_variable_service_context();
22 
23 private:
24 
25 	void do_init();
26 	void do_deinit();
27 
28 	static const size_t MAX_VARIABLES = 40;
29 
30 	/* Use an RPC buffer size that is typical for MM Communicate */
31 	static const size_t RPC_BUFFER_SIZE = 64 * 1024;
32 
33 	struct smm_variable_provider m_smm_variable_provider;
34 	struct secure_storage_client m_persistent_store_client;
35 	struct mock_store m_volatile_store;
36 	struct service_context *m_storage_service_context;
37 	struct service_context *m_crypto_service_context;
38 	struct rpc_caller_session *m_storage_session;
39 	struct rpc_caller_session *m_crypto_session;
40 };
41 
42 #endif /* STANDALONE_SMM_VARIABLE_SERVICE_CONTEXT_H */
43