blob: 29866f02f0187292568df3438ffeefbcb5850610 [file] [log] [blame]
Hans Verkuil1c1e45d2008-04-28 20:24:33 -03001/*
2 * cx18 System Control Block initialization
3 *
4 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 * 02111-1307 USA
20 */
21
22#ifndef CX18_SCB_H
23#define CX18_SCB_H
24
25#include "cx18-mailbox.h"
26
27/* NOTE: All ACK interrupts are in the SW2 register. All non-ACK interrupts
28 are in the SW1 register. */
29
30#define IRQ_APU_TO_CPU 0x00000001
31#define IRQ_CPU_TO_APU_ACK 0x00000001
32#define IRQ_HPU_TO_CPU 0x00000002
33#define IRQ_CPU_TO_HPU_ACK 0x00000002
34#define IRQ_PPU_TO_CPU 0x00000004
35#define IRQ_CPU_TO_PPU_ACK 0x00000004
36#define IRQ_EPU_TO_CPU 0x00000008
37#define IRQ_CPU_TO_EPU_ACK 0x00000008
38
39#define IRQ_CPU_TO_APU 0x00000010
40#define IRQ_APU_TO_CPU_ACK 0x00000010
41#define IRQ_HPU_TO_APU 0x00000020
42#define IRQ_APU_TO_HPU_ACK 0x00000020
43#define IRQ_PPU_TO_APU 0x00000040
44#define IRQ_APU_TO_PPU_ACK 0x00000040
45#define IRQ_EPU_TO_APU 0x00000080
46#define IRQ_APU_TO_EPU_ACK 0x00000080
47
48#define IRQ_CPU_TO_HPU 0x00000100
49#define IRQ_HPU_TO_CPU_ACK 0x00000100
50#define IRQ_APU_TO_HPU 0x00000200
51#define IRQ_HPU_TO_APU_ACK 0x00000200
52#define IRQ_PPU_TO_HPU 0x00000400
53#define IRQ_HPU_TO_PPU_ACK 0x00000400
54#define IRQ_EPU_TO_HPU 0x00000800
55#define IRQ_HPU_TO_EPU_ACK 0x00000800
56
57#define IRQ_CPU_TO_PPU 0x00001000
58#define IRQ_PPU_TO_CPU_ACK 0x00001000
59#define IRQ_APU_TO_PPU 0x00002000
60#define IRQ_PPU_TO_APU_ACK 0x00002000
61#define IRQ_HPU_TO_PPU 0x00004000
62#define IRQ_PPU_TO_HPU_ACK 0x00004000
63#define IRQ_EPU_TO_PPU 0x00008000
64#define IRQ_PPU_TO_EPU_ACK 0x00008000
65
66#define IRQ_CPU_TO_EPU 0x00010000
67#define IRQ_EPU_TO_CPU_ACK 0x00010000
68#define IRQ_APU_TO_EPU 0x00020000
69#define IRQ_EPU_TO_APU_ACK 0x00020000
70#define IRQ_HPU_TO_EPU 0x00040000
71#define IRQ_EPU_TO_HPU_ACK 0x00040000
72#define IRQ_PPU_TO_EPU 0x00080000
73#define IRQ_EPU_TO_PPU_ACK 0x00080000
74
75#define SCB_OFFSET 0xDC0000
76
77/* If Firmware uses fixed memory map, it shall not allocate the area
78 between SCB_OFFSET and SCB_OFFSET+SCB_RESERVED_SIZE-1 inclusive */
79#define SCB_RESERVED_SIZE 0x10000
80
81
82/* This structure is used by EPU to provide memory descriptors in its memory */
83struct cx18_mdl {
84 u32 paddr; /* Physical address of a buffer segment */
85 u32 length; /* Length of the buffer segment */
86};
87
Hans Verkuil1c1e45d2008-04-28 20:24:33 -030088struct cx18_scb {
89 /* These fields form the System Control Block which is used at boot time
90 for localizing the IPC data as well as the code positions for all
91 processors. The offsets are from the start of this struct. */
92
93 /* Offset where to find the Inter-Processor Communication data */
94 u32 ipc_offset;
95 u32 reserved01[7];
96 /* Offset where to find the start of the CPU code */
97 u32 cpu_code_offset;
98 u32 reserved02[3];
99 /* Offset where to find the start of the APU code */
100 u32 apu_code_offset;
101 u32 reserved03[3];
102 /* Offset where to find the start of the HPU code */
103 u32 hpu_code_offset;
104 u32 reserved04[3];
105 /* Offset where to find the start of the PPU code */
106 u32 ppu_code_offset;
107 u32 reserved05[3];
108
109 /* These fields form Inter-Processor Communication data which is used
110 by all processors to locate the information needed for communicating
111 with other processors */
112
113 /* Fields for CPU: */
114
115 /* bit 0: 1/0 processor ready/not ready. Set other bits to 0. */
116 u32 cpu_state;
117 u32 reserved1[7];
118 /* Offset to the mailbox used for sending commands from APU to CPU */
119 u32 apu2cpu_mb_offset;
120 /* Value to write to register SW1 register set (0xC7003100) after the
121 command is ready */
122 u32 apu2cpu_irq;
123 /* Value to write to register SW2 register set (0xC7003140) after the
124 command is cleared */
Andy Walls465f8a82008-11-04 22:02:23 -0300125 u32 cpu2apu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300126 u32 reserved2[13];
127
128 u32 hpu2cpu_mb_offset;
129 u32 hpu2cpu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300130 u32 cpu2hpu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300131 u32 reserved3[13];
132
133 u32 ppu2cpu_mb_offset;
134 u32 ppu2cpu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300135 u32 cpu2ppu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300136 u32 reserved4[13];
137
138 u32 epu2cpu_mb_offset;
139 u32 epu2cpu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300140 u32 cpu2epu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300141 u32 reserved5[13];
142 u32 reserved6[8];
143
144 /* Fields for APU: */
145
146 u32 apu_state;
147 u32 reserved11[7];
148 u32 cpu2apu_mb_offset;
149 u32 cpu2apu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300150 u32 apu2cpu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300151 u32 reserved12[13];
152
153 u32 hpu2apu_mb_offset;
154 u32 hpu2apu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300155 u32 apu2hpu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300156 u32 reserved13[13];
157
158 u32 ppu2apu_mb_offset;
159 u32 ppu2apu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300160 u32 apu2ppu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300161 u32 reserved14[13];
162
163 u32 epu2apu_mb_offset;
164 u32 epu2apu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300165 u32 apu2epu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300166 u32 reserved15[13];
167 u32 reserved16[8];
168
169 /* Fields for HPU: */
170
171 u32 hpu_state;
172 u32 reserved21[7];
173 u32 cpu2hpu_mb_offset;
174 u32 cpu2hpu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300175 u32 hpu2cpu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300176 u32 reserved22[13];
177
178 u32 apu2hpu_mb_offset;
179 u32 apu2hpu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300180 u32 hpu2apu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300181 u32 reserved23[13];
182
183 u32 ppu2hpu_mb_offset;
184 u32 ppu2hpu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300185 u32 hpu2ppu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300186 u32 reserved24[13];
187
188 u32 epu2hpu_mb_offset;
189 u32 epu2hpu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300190 u32 hpu2epu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300191 u32 reserved25[13];
192 u32 reserved26[8];
193
194 /* Fields for PPU: */
195
196 u32 ppu_state;
197 u32 reserved31[7];
198 u32 cpu2ppu_mb_offset;
199 u32 cpu2ppu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300200 u32 ppu2cpu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300201 u32 reserved32[13];
202
203 u32 apu2ppu_mb_offset;
204 u32 apu2ppu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300205 u32 ppu2apu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300206 u32 reserved33[13];
207
208 u32 hpu2ppu_mb_offset;
209 u32 hpu2ppu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300210 u32 ppu2hpu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300211 u32 reserved34[13];
212
213 u32 epu2ppu_mb_offset;
214 u32 epu2ppu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300215 u32 ppu2epu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300216 u32 reserved35[13];
217 u32 reserved36[8];
218
219 /* Fields for EPU: */
220
221 u32 epu_state;
222 u32 reserved41[7];
223 u32 cpu2epu_mb_offset;
224 u32 cpu2epu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300225 u32 epu2cpu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300226 u32 reserved42[13];
227
228 u32 apu2epu_mb_offset;
229 u32 apu2epu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300230 u32 epu2apu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300231 u32 reserved43[13];
232
233 u32 hpu2epu_mb_offset;
234 u32 hpu2epu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300235 u32 epu2hpu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300236 u32 reserved44[13];
237
238 u32 ppu2epu_mb_offset;
239 u32 ppu2epu_irq;
Andy Walls465f8a82008-11-04 22:02:23 -0300240 u32 epu2ppu_irq_ack;
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300241 u32 reserved45[13];
242 u32 reserved46[8];
243
244 u32 semaphores[8]; /* Semaphores */
245
246 u32 reserved50[32]; /* Reserved for future use */
247
248 struct cx18_mailbox apu2cpu_mb;
249 struct cx18_mailbox hpu2cpu_mb;
250 struct cx18_mailbox ppu2cpu_mb;
251 struct cx18_mailbox epu2cpu_mb;
252
253 struct cx18_mailbox cpu2apu_mb;
254 struct cx18_mailbox hpu2apu_mb;
255 struct cx18_mailbox ppu2apu_mb;
256 struct cx18_mailbox epu2apu_mb;
257
258 struct cx18_mailbox cpu2hpu_mb;
259 struct cx18_mailbox apu2hpu_mb;
260 struct cx18_mailbox ppu2hpu_mb;
261 struct cx18_mailbox epu2hpu_mb;
262
263 struct cx18_mailbox cpu2ppu_mb;
264 struct cx18_mailbox apu2ppu_mb;
265 struct cx18_mailbox hpu2ppu_mb;
266 struct cx18_mailbox epu2ppu_mb;
267
268 struct cx18_mailbox cpu2epu_mb;
269 struct cx18_mailbox apu2epu_mb;
270 struct cx18_mailbox hpu2epu_mb;
271 struct cx18_mailbox ppu2epu_mb;
272
Andy Wallsee2d64f2008-11-16 01:38:19 -0300273 struct cx18_mdl_ack cpu_mdl_ack[CX18_MAX_STREAMS][CX18_MAX_MDL_ACKS];
Hans Verkuil1c1e45d2008-04-28 20:24:33 -0300274 struct cx18_mdl cpu_mdl[1];
275};
276
277void cx18_init_scb(struct cx18 *cx);
278
279#endif