aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gud/MobiCoreDriver/public/mcKernelApi.h
blob: e496851558f35b98cbec1472b89ee07c9f0124bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/** @addtogroup MCD_MCDIMPL_KMOD
 * @{
 * Interface to Mobicore Driver Kernel Module inside Kernel.
 *
 * <!-- Copyright Giesecke & Devrient GmbH 2010-2012 -->
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef _MOBICORE_KERNELMODULE_API_H_
#define _MOBICORE_KERNELMODULE_API_H_

struct mcInstance;

/**
 * Initialize a new mobicore API instance object
 *
 * @return Instance or NULL if no allocation was possible.
 */
struct mcInstance *mobicore_open(
	void
);

/**
 * Release a mobicore instance object and all objects related to it
 * @param pInstance instance
 * @return 0 if Ok or -E ERROR
 */
int mobicore_release(
	struct mcInstance	*pInstance
);

/**
 * Free a WSM buffer allocated with mobicore_allocate_wsm
 * @param pInstance
 * @param handle		handle of the buffer
 *
 * @return 0 if no error
 *
 */
int mobicore_allocate_wsm(
	struct mcInstance	*pInstance,
	unsigned long		requestedSize,
	uint32_t		*pHandle,
	void			**pKernelVirtAddr,
	void			**pPhysAddr
);

/**
 * Free a WSM buffer allocated with mobicore_allocate_wsm
 * @param pInstance
 * @param handle		handle of the buffer
 *
 * @return 0 if no error
 *
 */
int mobicore_free(
	struct mcInstance	*pInstance,
	uint32_t		handle
);

/**
 * Map a virtual memory buffer structure to Mobicore
 * @param pInstance
 * @param addr		address of the buffer(NB it must be kernel virtual!)
 * @param len		buffer length
 * @param pHandle	pointer to handle
 * @param physWsmL2Table	pointer to physical L2 table(?)
 *
 * @return 0 if no error
 *
 */
int mobicore_map_vmem(
	struct mcInstance	*pInstance,
	void			*addr,
	uint32_t		len,
	uint32_t		*pHandle,
	void			**physWsmL2Table
);

/**
 * Unmap a virtual memory buffer from mobicore
 * @param pInstance
 * @param handle
 *
 * @return 0 if no error
 *
 */
int mobicore_unmap_vmem(
	struct mcInstance	*pInstance,
	uint32_t		handle
);
#endif /* _MOBICORE_KERNELMODULE_API_H_ */
/** @} */