cx18-scb.h 7.3 KB

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