summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/include
diff options
context:
space:
mode:
authorMahantesh Kumbar <mkumbar@nvidia.com>2017-04-21 07:19:12 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-03 02:36:07 -0400
commitf30a685f48768b784fb92652d945f43a289e13c4 (patch)
tree85f262b0f58901c9d3fe173880c2f1fbd51b6c59 /drivers/gpu/nvgpu/include
parent0a141c90af622bf2981fe7abbee9b1657ff1eea6 (diff)
gpu: nvgpu: interface layer for falcon
- struct nvgpu_falcon to hold properties of falcon controller - falcon controller interface layer which establish access to required falcon controller HAL based on struct nvgpu_falcon member flcn_id & flcn_base parameter. - each falcon nvgpu_falcon struct initialized during init with id, base-address along with other properties at HAL. - Added defines related to flacon controller. Change-Id: Ia7777c01ecc542150ddd72f8603b7b4475522b58 Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-on: http://git-master/r/1467523 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/falcon.h190
1 files changed, 190 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/falcon.h b/drivers/gpu/nvgpu/include/nvgpu/falcon.h
new file mode 100644
index 00000000..17b811dd
--- /dev/null
+++ b/drivers/gpu/nvgpu/include/nvgpu/falcon.h
@@ -0,0 +1,190 @@
1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#ifndef __FALCON_H__
15#define __FALCON_H__
16
17/*
18 * Falcon Id Defines
19 */
20#define FALCON_ID_PMU (0)
21#define FALCON_ID_FECS (2)
22#define FALCON_ID_GPCCS (3)
23#define FALCON_ID_SEC2 (7)
24
25/*
26 * Falcon Base address Defines
27 */
28#define FALCON_PWR_BASE 0x0010a000
29#define FALCON_SEC_BASE 0x00087000
30#define FALCON_FECS_BASE 0x00409000
31#define FALCON_GPCCS_BASE 0x0041a000
32
33/* Falcon Register index */
34#define FALCON_REG_R0 (0)
35#define FALCON_REG_R1 (1)
36#define FALCON_REG_R2 (2)
37#define FALCON_REG_R3 (3)
38#define FALCON_REG_R4 (4)
39#define FALCON_REG_R5 (5)
40#define FALCON_REG_R6 (6)
41#define FALCON_REG_R7 (7)
42#define FALCON_REG_R8 (8)
43#define FALCON_REG_R9 (9)
44#define FALCON_REG_R10 (10)
45#define FALCON_REG_R11 (11)
46#define FALCON_REG_R12 (12)
47#define FALCON_REG_R13 (13)
48#define FALCON_REG_R14 (14)
49#define FALCON_REG_R15 (15)
50#define FALCON_REG_IV0 (16)
51#define FALCON_REG_IV1 (17)
52#define FALCON_REG_UNDEFINED (18)
53#define FALCON_REG_EV (19)
54#define FALCON_REG_SP (20)
55#define FALCON_REG_PC (21)
56#define FALCON_REG_IMB (22)
57#define FALCON_REG_DMB (23)
58#define FALCON_REG_CSW (24)
59#define FALCON_REG_CCR (25)
60#define FALCON_REG_SEC (26)
61#define FALCON_REG_CTX (27)
62#define FALCON_REG_EXCI (28)
63#define FALCON_REG_RSVD0 (29)
64#define FALCON_REG_RSVD1 (30)
65#define FALCON_REG_RSVD2 (31)
66#define FALCON_REG_SIZE (32)
67
68/*
69 * Falcon HWCFG request read types defines
70 */
71enum flcn_hwcfg_read {
72 FALCON_IMEM_SIZE = 0,
73 FALCON_DMEM_SIZE,
74 FALCON_CORE_REV,
75 FALCON_SECURITY_MODEL,
76 FLACON_MAILBOX_COUNT
77};
78
79/*
80 * Falcon HWCFG request write types defines
81 */
82enum flcn_hwcfg_write {
83 FALCON_STARTCPU = 0,
84 FALCON_STARTCPU_SECURE,
85 FALCON_BOOTVEC,
86 FALCON_ITF_EN
87};
88
89/*
90 * Falcon sub unit Id Defines
91 */
92enum flcn_unit_status {
93 IS_FALCON_IN_RESET = 0x0,
94 IS_FALCON_CPU_HALTED,
95 IS_FALCON_IDLE,
96 IS_FALCON_MEM_SURBBING_DONE
97};
98
99#define FALCON_MEM_SCRUBBING_TIMEOUT_MAX 1000
100#define FALCON_MEM_SCRUBBING_TIMEOUT_DEFAULT 10
101
102enum flcn_dma_dir {
103 DMA_TO_FB = 0,
104 DMA_FROM_FB
105};
106
107enum flcn_mem_type {
108 MEM_DMEM = 0,
109 MEM_IMEM
110};
111
112struct nvgpu_falcon_dma_info {
113 u32 fb_base;
114 u32 fb_off;
115 u32 flcn_mem_off;
116 u32 size_in_bytes;
117 enum flcn_dma_dir dir;
118 u32 ctx_dma;
119 enum flcn_mem_type flcn_mem;
120 u32 is_wait_complete;
121};
122
123struct gk20a;
124struct nvgpu_falcon;
125
126struct nvgpu_falcon_version_ops {
127 void (*start_cpu_secure)(struct nvgpu_falcon *flcn);
128 void (*write_dmatrfbase)(struct nvgpu_falcon *flcn, u32 addr);
129};
130
131struct nvgpu_falcon_ops {
132 void (*reset)(struct nvgpu_falcon *flcn, bool enable);
133 void (*enable_irq)(struct nvgpu_falcon *flcn, bool enable);
134 void (*fbif_transcfg)(struct nvgpu_falcon *flcn);
135 u32 (*read_hwcfg)(struct nvgpu_falcon *flcn,
136 enum flcn_hwcfg_read cfg_type);
137 void (*write_hwcfg)(struct nvgpu_falcon *flcn,
138 enum flcn_hwcfg_write cfg_type, u32 cfg_data);
139 bool (*get_unit_status)(struct nvgpu_falcon *flcn,
140 enum flcn_unit_status unit_id);
141 int (*copy_from_dmem)(struct nvgpu_falcon *flcn, u32 src, u8 *dst,
142 u32 size, u8 port);
143 int (*copy_to_dmem)(struct nvgpu_falcon *flcn, u32 dst, u8 *src,
144 u32 size, u8 port);
145 int (*copy_from_imem)(struct nvgpu_falcon *flcn, u32 src, u8 *dst,
146 u32 size, u8 port);
147 int (*copy_to_imem)(struct nvgpu_falcon *flcn, u32 dst, u8 *src,
148 u32 size, u8 port);
149 int (*dma_copy)(struct nvgpu_falcon *flcn,
150 struct nvgpu_falcon_dma_info *dma_info);
151 u32 (*mailbox_read)(struct nvgpu_falcon *flcn, u32 mailbox_index);
152 void (*mailbox_write)(struct nvgpu_falcon *flcn, u32 mailbox_index,
153 u32 data);
154 void (*dump_falcon_stats)(struct nvgpu_falcon *flcn);
155};
156
157struct nvgpu_falcon {
158 struct gk20a *g;
159 u32 flcn_id;
160 u32 flcn_base;
161 u32 flcn_core_rev;
162 bool isr_enabled;
163 struct nvgpu_mutex isr_mutex;
164 struct nvgpu_mutex copy_lock;
165 struct nvgpu_falcon_ops flcn_ops;
166 struct nvgpu_falcon_version_ops flcn_vops;
167};
168
169int nvgpu_flcn_wait_idle(struct nvgpu_falcon *flcn);
170int nvgpu_flcn_enable_hw(struct nvgpu_falcon *flcn, bool enable);
171int nvgpu_flcn_reset(struct nvgpu_falcon *flcn);
172void nvgpu_flcn_enable_irq(struct nvgpu_falcon *flcn, bool enable);
173void nvgpu_flcn_fbif_transcfg(struct nvgpu_falcon *flcn);
174bool nvgpu_flcn_get_unit_status(struct nvgpu_falcon *flcn,
175 enum flcn_unit_status unit_id);
176int nvgpu_flcn_copy_from_mem(struct nvgpu_falcon *flcn,
177 enum flcn_mem_type mem_type, u32 src, u8 *dst, u32 size, u8 port);
178int nvgpu_flcn_copy_to_mem(struct nvgpu_falcon *flcn,
179 enum flcn_mem_type mem_type, u32 dst, u8 *src, u32 size, u8 port);
180int nvgpu_flcn_dma_copy(struct nvgpu_falcon *flcn,
181 struct nvgpu_falcon_dma_info *dma_info);
182u32 nvgpu_flcn_mailbox_read(struct nvgpu_falcon *flcn, u32 mailbox_index);
183void nvgpu_flcn_mailbox_write(struct nvgpu_falcon *flcn, u32 mailbox_index,
184 u32 data);
185void nvgpu_flcn_dump_stats(struct nvgpu_falcon *flcn);
186
187void nvgpu_flcn_sw_init(struct gk20a *g, u32 flcn_id);
188
189
190#endif /* __FALCON_H__ */