blob: d8c8fbea4c860fb21e8a855aeceaba0c69324cca (
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
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Structures and helpers for managing GXP MicroController Unit.
*
* Copyright (C) 2022 Google LLC
*/
#ifndef __GXP_MCU_H__
#define __GXP_MCU_H__
#include <gcip/gcip-mem-pool.h>
#include "gxp-kci.h"
#include "gxp-mcu-firmware.h"
#include "gxp-mcu-telemetry.h"
#include "gxp-uci.h"
struct gxp_dev;
struct gxp_mapped_resource;
struct gxp_mcu {
struct gxp_dev *gxp;
struct gxp_mcu_firmware fw;
/* instruction remapped data region */
struct gcip_mem_pool remap_data_pool;
/* secure region (memory inaccessible by non-secure AP (us)) */
struct gcip_mem_pool remap_secure_pool;
struct gxp_uci uci;
struct gxp_kci kci;
struct gxp_mcu_telemetry_ctx telemetry;
};
/*
* Initializes all fields in @mcu.
*
* Returns 0 on success, a negative errno on failure.
*/
int gxp_mcu_init(struct gxp_dev *gxp, struct gxp_mcu *mcu);
/* cleans up resources in @mcu */
void gxp_mcu_exit(struct gxp_mcu *mcu);
/*
* A wrapper function to allocate memory from @mcu->remap_data_pool.
*
* Returns 0 on success, a negative errno otherwise.
*/
int gxp_mcu_mem_alloc_data(struct gxp_mcu *mcu, struct gxp_mapped_resource *mem, size_t size);
/*
* Free memory allocated by gxp_mcu_mem_alloc_data().
*/
void gxp_mcu_mem_free_data(struct gxp_mcu *mcu, struct gxp_mapped_resource *mem);
/*
* Returns the pointer of `struct gxp_mcu` associated with the GXP device object.
*
* This function is NOT implemented in gxp-mcu.c. Instead, it shall be implemented in
* *-platform.c as a chip-dependent implementation.
*/
struct gxp_mcu *gxp_mcu_of(struct gxp_dev *gxp);
#endif /* __GXP_MCU_H__ */
|