Commit | Line | Data |
---|---|---|
f58a9d17 GL |
1 | /* |
2 | * PS3 platform declarations. | |
3 | * | |
4 | * Copyright (C) 2006 Sony Computer Entertainment Inc. | |
5 | * Copyright 2006 Sony Corp. | |
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; version 2 of the License. | |
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 02111-1307 USA | |
19 | */ | |
20 | ||
21 | #if !defined(_ASM_POWERPC_PS3_H) | |
22 | #define _ASM_POWERPC_PS3_H | |
23 | ||
f58a9d17 GL |
24 | #include <linux/init.h> |
25 | #include <linux/types.h> | |
26 | #include <linux/device.h> | |
781749a4 | 27 | #include "cell-pmu.h" |
f58a9d17 | 28 | |
66b44954 GL |
29 | union ps3_firmware_version { |
30 | u64 raw; | |
31 | struct { | |
32 | u16 pad; | |
33 | u16 major; | |
34 | u16 minor; | |
35 | u16 rev; | |
36 | }; | |
37 | }; | |
38 | ||
1322810c MM |
39 | void ps3_get_firmware_version(union ps3_firmware_version *v); |
40 | int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev); | |
66b44954 | 41 | |
098e2744 GU |
42 | /* 'Other OS' area */ |
43 | ||
44 | enum ps3_param_av_multi_out { | |
45 | PS3_PARAM_AV_MULTI_OUT_NTSC = 0, | |
46 | PS3_PARAM_AV_MULTI_OUT_PAL_RGB = 1, | |
47 | PS3_PARAM_AV_MULTI_OUT_PAL_YCBCR = 2, | |
48 | PS3_PARAM_AV_MULTI_OUT_SECAM = 3, | |
49 | }; | |
50 | ||
51 | enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void); | |
52 | ||
f58a9d17 GL |
53 | /* dma routines */ |
54 | ||
55 | enum ps3_dma_page_size { | |
56 | PS3_DMA_4K = 12U, | |
57 | PS3_DMA_64K = 16U, | |
58 | PS3_DMA_1M = 20U, | |
59 | PS3_DMA_16M = 24U, | |
60 | }; | |
61 | ||
62 | enum ps3_dma_region_type { | |
63 | PS3_DMA_OTHER = 0, | |
64 | PS3_DMA_INTERNAL = 2, | |
65 | }; | |
66 | ||
6bb5cf10 GL |
67 | struct ps3_dma_region_ops; |
68 | ||
f58a9d17 GL |
69 | /** |
70 | * struct ps3_dma_region - A per device dma state variables structure | |
71 | * @did: The HV device id. | |
72 | * @page_size: The ioc pagesize. | |
73 | * @region_type: The HV region type. | |
74 | * @bus_addr: The 'translated' bus address of the region. | |
75 | * @len: The length in bytes of the region. | |
6bb5cf10 GL |
76 | * @offset: The offset from the start of memory of the region. |
77 | * @ioid: The IOID of the device who owns this region | |
f58a9d17 | 78 | * @chunk_list: Opaque variable used by the ioc page manager. |
6bb5cf10 | 79 | * @region_ops: struct ps3_dma_region_ops - dma region operations |
f58a9d17 GL |
80 | */ |
81 | ||
82 | struct ps3_dma_region { | |
6bb5cf10 GL |
83 | struct ps3_system_bus_device *dev; |
84 | /* device variables */ | |
85 | const struct ps3_dma_region_ops *region_ops; | |
86 | unsigned char ioid; | |
f58a9d17 GL |
87 | enum ps3_dma_page_size page_size; |
88 | enum ps3_dma_region_type region_type; | |
f58a9d17 | 89 | unsigned long len; |
6bb5cf10 GL |
90 | unsigned long offset; |
91 | ||
92 | /* driver variables (set by ps3_dma_region_create) */ | |
93 | unsigned long bus_addr; | |
f58a9d17 GL |
94 | struct { |
95 | spinlock_t lock; | |
96 | struct list_head head; | |
97 | } chunk_list; | |
98 | }; | |
99 | ||
6bb5cf10 GL |
100 | struct ps3_dma_region_ops { |
101 | int (*create)(struct ps3_dma_region *); | |
102 | int (*free)(struct ps3_dma_region *); | |
103 | int (*map)(struct ps3_dma_region *, | |
104 | unsigned long virt_addr, | |
105 | unsigned long len, | |
106 | unsigned long *bus_addr, | |
107 | u64 iopte_pp); | |
108 | int (*unmap)(struct ps3_dma_region *, | |
109 | unsigned long bus_addr, | |
110 | unsigned long len); | |
111 | }; | |
f58a9d17 GL |
112 | /** |
113 | * struct ps3_dma_region_init - Helper to initialize structure variables | |
114 | * | |
115 | * Helper to properly initialize variables prior to calling | |
116 | * ps3_system_bus_device_register. | |
117 | */ | |
118 | ||
6bb5cf10 GL |
119 | struct ps3_system_bus_device; |
120 | ||
121 | int ps3_dma_region_init(struct ps3_system_bus_device *dev, | |
122 | struct ps3_dma_region *r, enum ps3_dma_page_size page_size, | |
123 | enum ps3_dma_region_type region_type, void *addr, unsigned long len); | |
f58a9d17 GL |
124 | int ps3_dma_region_create(struct ps3_dma_region *r); |
125 | int ps3_dma_region_free(struct ps3_dma_region *r); | |
126 | int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, | |
6bb5cf10 GL |
127 | unsigned long len, unsigned long *bus_addr, |
128 | u64 iopte_pp); | |
f58a9d17 GL |
129 | int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr, |
130 | unsigned long len); | |
131 | ||
132 | /* mmio routines */ | |
133 | ||
134 | enum ps3_mmio_page_size { | |
135 | PS3_MMIO_4K = 12U, | |
136 | PS3_MMIO_64K = 16U | |
137 | }; | |
138 | ||
6bb5cf10 | 139 | struct ps3_mmio_region_ops; |
f58a9d17 GL |
140 | /** |
141 | * struct ps3_mmio_region - a per device mmio state variables structure | |
142 | * | |
143 | * Current systems can be supported with a single region per device. | |
144 | */ | |
145 | ||
146 | struct ps3_mmio_region { | |
6bb5cf10 GL |
147 | struct ps3_system_bus_device *dev; |
148 | const struct ps3_mmio_region_ops *mmio_ops; | |
f58a9d17 GL |
149 | unsigned long bus_addr; |
150 | unsigned long len; | |
151 | enum ps3_mmio_page_size page_size; | |
152 | unsigned long lpar_addr; | |
153 | }; | |
154 | ||
6bb5cf10 GL |
155 | struct ps3_mmio_region_ops { |
156 | int (*create)(struct ps3_mmio_region *); | |
157 | int (*free)(struct ps3_mmio_region *); | |
158 | }; | |
f58a9d17 GL |
159 | /** |
160 | * struct ps3_mmio_region_init - Helper to initialize structure variables | |
161 | * | |
162 | * Helper to properly initialize variables prior to calling | |
163 | * ps3_system_bus_device_register. | |
164 | */ | |
165 | ||
6bb5cf10 GL |
166 | int ps3_mmio_region_init(struct ps3_system_bus_device *dev, |
167 | struct ps3_mmio_region *r, unsigned long bus_addr, unsigned long len, | |
168 | enum ps3_mmio_page_size page_size); | |
f58a9d17 GL |
169 | int ps3_mmio_region_create(struct ps3_mmio_region *r); |
170 | int ps3_free_mmio_region(struct ps3_mmio_region *r); | |
171 | unsigned long ps3_mm_phys_to_lpar(unsigned long phys_addr); | |
172 | ||
173 | /* inrerrupt routines */ | |
174 | ||
861be32c GL |
175 | enum ps3_cpu_binding { |
176 | PS3_BINDING_CPU_ANY = -1, | |
177 | PS3_BINDING_CPU_0 = 0, | |
178 | PS3_BINDING_CPU_1 = 1, | |
179 | }; | |
180 | ||
dc4f60c2 GL |
181 | int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet, |
182 | unsigned int *virq); | |
183 | int ps3_irq_plug_destroy(unsigned int virq); | |
184 | int ps3_event_receive_port_setup(enum ps3_cpu_binding cpu, unsigned int *virq); | |
185 | int ps3_event_receive_port_destroy(unsigned int virq); | |
f58a9d17 | 186 | int ps3_send_event_locally(unsigned int virq); |
dc4f60c2 GL |
187 | |
188 | int ps3_io_irq_setup(enum ps3_cpu_binding cpu, unsigned int interrupt_id, | |
861be32c | 189 | unsigned int *virq); |
dc4f60c2 GL |
190 | int ps3_io_irq_destroy(unsigned int virq); |
191 | int ps3_vuart_irq_setup(enum ps3_cpu_binding cpu, void* virt_addr_bmp, | |
f58a9d17 | 192 | unsigned int *virq); |
dc4f60c2 GL |
193 | int ps3_vuart_irq_destroy(unsigned int virq); |
194 | int ps3_spe_irq_setup(enum ps3_cpu_binding cpu, unsigned long spe_id, | |
861be32c | 195 | unsigned int class, unsigned int *virq); |
dc4f60c2 GL |
196 | int ps3_spe_irq_destroy(unsigned int virq); |
197 | ||
6bb5cf10 GL |
198 | int ps3_sb_event_receive_port_setup(struct ps3_system_bus_device *dev, |
199 | enum ps3_cpu_binding cpu, unsigned int *virq); | |
200 | int ps3_sb_event_receive_port_destroy(struct ps3_system_bus_device *dev, | |
201 | unsigned int virq); | |
f58a9d17 GL |
202 | |
203 | /* lv1 result codes */ | |
204 | ||
205 | enum lv1_result { | |
206 | LV1_SUCCESS = 0, | |
207 | /* not used -1 */ | |
208 | LV1_RESOURCE_SHORTAGE = -2, | |
209 | LV1_NO_PRIVILEGE = -3, | |
210 | LV1_DENIED_BY_POLICY = -4, | |
211 | LV1_ACCESS_VIOLATION = -5, | |
212 | LV1_NO_ENTRY = -6, | |
213 | LV1_DUPLICATE_ENTRY = -7, | |
214 | LV1_TYPE_MISMATCH = -8, | |
215 | LV1_BUSY = -9, | |
216 | LV1_EMPTY = -10, | |
217 | LV1_WRONG_STATE = -11, | |
218 | /* not used -12 */ | |
219 | LV1_NO_MATCH = -13, | |
220 | LV1_ALREADY_CONNECTED = -14, | |
221 | LV1_UNSUPPORTED_PARAMETER_VALUE = -15, | |
222 | LV1_CONDITION_NOT_SATISFIED = -16, | |
223 | LV1_ILLEGAL_PARAMETER_VALUE = -17, | |
224 | LV1_BAD_OPTION = -18, | |
225 | LV1_IMPLEMENTATION_LIMITATION = -19, | |
226 | LV1_NOT_IMPLEMENTED = -20, | |
227 | LV1_INVALID_CLASS_ID = -21, | |
228 | LV1_CONSTRAINT_NOT_SATISFIED = -22, | |
229 | LV1_ALIGNMENT_ERROR = -23, | |
06462d92 GU |
230 | LV1_HARDWARE_ERROR = -24, |
231 | LV1_INVALID_DATA_FORMAT = -25, | |
232 | LV1_INVALID_OPERATION = -26, | |
f58a9d17 GL |
233 | LV1_INTERNAL_ERROR = -32768, |
234 | }; | |
235 | ||
236 | static inline const char* ps3_result(int result) | |
237 | { | |
238 | #if defined(DEBUG) | |
239 | switch (result) { | |
240 | case LV1_SUCCESS: | |
241 | return "LV1_SUCCESS (0)"; | |
242 | case -1: | |
243 | return "** unknown result ** (-1)"; | |
244 | case LV1_RESOURCE_SHORTAGE: | |
245 | return "LV1_RESOURCE_SHORTAGE (-2)"; | |
246 | case LV1_NO_PRIVILEGE: | |
247 | return "LV1_NO_PRIVILEGE (-3)"; | |
248 | case LV1_DENIED_BY_POLICY: | |
249 | return "LV1_DENIED_BY_POLICY (-4)"; | |
250 | case LV1_ACCESS_VIOLATION: | |
251 | return "LV1_ACCESS_VIOLATION (-5)"; | |
252 | case LV1_NO_ENTRY: | |
253 | return "LV1_NO_ENTRY (-6)"; | |
254 | case LV1_DUPLICATE_ENTRY: | |
255 | return "LV1_DUPLICATE_ENTRY (-7)"; | |
256 | case LV1_TYPE_MISMATCH: | |
257 | return "LV1_TYPE_MISMATCH (-8)"; | |
258 | case LV1_BUSY: | |
259 | return "LV1_BUSY (-9)"; | |
260 | case LV1_EMPTY: | |
261 | return "LV1_EMPTY (-10)"; | |
262 | case LV1_WRONG_STATE: | |
263 | return "LV1_WRONG_STATE (-11)"; | |
264 | case -12: | |
265 | return "** unknown result ** (-12)"; | |
266 | case LV1_NO_MATCH: | |
267 | return "LV1_NO_MATCH (-13)"; | |
268 | case LV1_ALREADY_CONNECTED: | |
269 | return "LV1_ALREADY_CONNECTED (-14)"; | |
270 | case LV1_UNSUPPORTED_PARAMETER_VALUE: | |
271 | return "LV1_UNSUPPORTED_PARAMETER_VALUE (-15)"; | |
272 | case LV1_CONDITION_NOT_SATISFIED: | |
273 | return "LV1_CONDITION_NOT_SATISFIED (-16)"; | |
274 | case LV1_ILLEGAL_PARAMETER_VALUE: | |
275 | return "LV1_ILLEGAL_PARAMETER_VALUE (-17)"; | |
276 | case LV1_BAD_OPTION: | |
277 | return "LV1_BAD_OPTION (-18)"; | |
278 | case LV1_IMPLEMENTATION_LIMITATION: | |
279 | return "LV1_IMPLEMENTATION_LIMITATION (-19)"; | |
280 | case LV1_NOT_IMPLEMENTED: | |
281 | return "LV1_NOT_IMPLEMENTED (-20)"; | |
282 | case LV1_INVALID_CLASS_ID: | |
283 | return "LV1_INVALID_CLASS_ID (-21)"; | |
284 | case LV1_CONSTRAINT_NOT_SATISFIED: | |
285 | return "LV1_CONSTRAINT_NOT_SATISFIED (-22)"; | |
286 | case LV1_ALIGNMENT_ERROR: | |
287 | return "LV1_ALIGNMENT_ERROR (-23)"; | |
06462d92 GU |
288 | case LV1_HARDWARE_ERROR: |
289 | return "LV1_HARDWARE_ERROR (-24)"; | |
290 | case LV1_INVALID_DATA_FORMAT: | |
291 | return "LV1_INVALID_DATA_FORMAT (-25)"; | |
292 | case LV1_INVALID_OPERATION: | |
293 | return "LV1_INVALID_OPERATION (-26)"; | |
f58a9d17 GL |
294 | case LV1_INTERNAL_ERROR: |
295 | return "LV1_INTERNAL_ERROR (-32768)"; | |
296 | default: | |
297 | BUG(); | |
298 | return "** unknown result **"; | |
299 | }; | |
300 | #else | |
301 | return ""; | |
302 | #endif | |
303 | } | |
304 | ||
a3d4d643 GL |
305 | /* system bus routines */ |
306 | ||
307 | enum ps3_match_id { | |
6bb5cf10 GL |
308 | PS3_MATCH_ID_EHCI = 1, |
309 | PS3_MATCH_ID_OHCI = 2, | |
310 | PS3_MATCH_ID_GELIC = 3, | |
311 | PS3_MATCH_ID_AV_SETTINGS = 4, | |
312 | PS3_MATCH_ID_SYSTEM_MANAGER = 5, | |
313 | PS3_MATCH_ID_STOR_DISK = 6, | |
314 | PS3_MATCH_ID_STOR_ROM = 7, | |
315 | PS3_MATCH_ID_STOR_FLASH = 8, | |
316 | PS3_MATCH_ID_SOUND = 9, | |
317 | PS3_MATCH_ID_GRAPHICS = 10, | |
ed757002 | 318 | PS3_MATCH_ID_LPM = 11, |
6bb5cf10 GL |
319 | }; |
320 | ||
321 | #define PS3_MODULE_ALIAS_EHCI "ps3:1" | |
322 | #define PS3_MODULE_ALIAS_OHCI "ps3:2" | |
323 | #define PS3_MODULE_ALIAS_GELIC "ps3:3" | |
324 | #define PS3_MODULE_ALIAS_AV_SETTINGS "ps3:4" | |
325 | #define PS3_MODULE_ALIAS_SYSTEM_MANAGER "ps3:5" | |
326 | #define PS3_MODULE_ALIAS_STOR_DISK "ps3:6" | |
327 | #define PS3_MODULE_ALIAS_STOR_ROM "ps3:7" | |
328 | #define PS3_MODULE_ALIAS_STOR_FLASH "ps3:8" | |
329 | #define PS3_MODULE_ALIAS_SOUND "ps3:9" | |
330 | #define PS3_MODULE_ALIAS_GRAPHICS "ps3:10" | |
ed757002 | 331 | #define PS3_MODULE_ALIAS_LPM "ps3:11" |
6bb5cf10 GL |
332 | |
333 | enum ps3_system_bus_device_type { | |
334 | PS3_DEVICE_TYPE_IOC0 = 1, | |
335 | PS3_DEVICE_TYPE_SB, | |
336 | PS3_DEVICE_TYPE_VUART, | |
ed757002 | 337 | PS3_DEVICE_TYPE_LPM, |
a3d4d643 GL |
338 | }; |
339 | ||
340 | /** | |
341 | * struct ps3_system_bus_device - a device on the system bus | |
342 | */ | |
343 | ||
344 | struct ps3_system_bus_device { | |
345 | enum ps3_match_id match_id; | |
6bb5cf10 GL |
346 | enum ps3_system_bus_device_type dev_type; |
347 | ||
034e0ab5 GU |
348 | u64 bus_id; /* SB */ |
349 | u64 dev_id; /* SB */ | |
6bb5cf10 GL |
350 | unsigned int interrupt_id; /* SB */ |
351 | struct ps3_dma_region *d_region; /* SB, IOC0 */ | |
352 | struct ps3_mmio_region *m_region; /* SB, IOC0*/ | |
353 | unsigned int port_number; /* VUART */ | |
ed757002 GL |
354 | struct { /* LPM */ |
355 | u64 node_id; | |
356 | u64 pu_id; | |
357 | u64 rights; | |
358 | } lpm; | |
6bb5cf10 GL |
359 | |
360 | /* struct iommu_table *iommu_table; -- waiting for BenH's cleanups */ | |
a3d4d643 | 361 | struct device core; |
6bb5cf10 | 362 | void *driver_priv; /* private driver variables */ |
a3d4d643 GL |
363 | }; |
364 | ||
6bb5cf10 GL |
365 | int ps3_open_hv_device(struct ps3_system_bus_device *dev); |
366 | int ps3_close_hv_device(struct ps3_system_bus_device *dev); | |
367 | ||
a3d4d643 GL |
368 | /** |
369 | * struct ps3_system_bus_driver - a driver for a device on the system bus | |
370 | */ | |
371 | ||
372 | struct ps3_system_bus_driver { | |
373 | enum ps3_match_id match_id; | |
374 | struct device_driver core; | |
375 | int (*probe)(struct ps3_system_bus_device *); | |
376 | int (*remove)(struct ps3_system_bus_device *); | |
6bb5cf10 | 377 | int (*shutdown)(struct ps3_system_bus_device *); |
a3d4d643 GL |
378 | /* int (*suspend)(struct ps3_system_bus_device *, pm_message_t); */ |
379 | /* int (*resume)(struct ps3_system_bus_device *); */ | |
380 | }; | |
381 | ||
382 | int ps3_system_bus_device_register(struct ps3_system_bus_device *dev); | |
383 | int ps3_system_bus_driver_register(struct ps3_system_bus_driver *drv); | |
384 | void ps3_system_bus_driver_unregister(struct ps3_system_bus_driver *drv); | |
6bb5cf10 GL |
385 | |
386 | static inline struct ps3_system_bus_driver *ps3_drv_to_system_bus_drv( | |
a3d4d643 GL |
387 | struct device_driver *_drv) |
388 | { | |
389 | return container_of(_drv, struct ps3_system_bus_driver, core); | |
390 | } | |
6bb5cf10 | 391 | static inline struct ps3_system_bus_device *ps3_dev_to_system_bus_dev( |
a3d4d643 GL |
392 | struct device *_dev) |
393 | { | |
394 | return container_of(_dev, struct ps3_system_bus_device, core); | |
395 | } | |
6bb5cf10 GL |
396 | static inline struct ps3_system_bus_driver * |
397 | ps3_system_bus_dev_to_system_bus_drv(struct ps3_system_bus_device *_dev) | |
398 | { | |
399 | BUG_ON(!_dev); | |
400 | BUG_ON(!_dev->core.driver); | |
401 | return ps3_drv_to_system_bus_drv(_dev->core.driver); | |
402 | } | |
a3d4d643 GL |
403 | |
404 | /** | |
405 | * ps3_system_bus_set_drvdata - | |
406 | * @dev: device structure | |
407 | * @data: Data to set | |
408 | */ | |
409 | ||
410 | static inline void ps3_system_bus_set_driver_data( | |
411 | struct ps3_system_bus_device *dev, void *data) | |
412 | { | |
413 | dev->core.driver_data = data; | |
414 | } | |
415 | static inline void *ps3_system_bus_get_driver_data( | |
416 | struct ps3_system_bus_device *dev) | |
417 | { | |
418 | return dev->core.driver_data; | |
419 | } | |
420 | ||
421 | /* These two need global scope for get_dma_ops(). */ | |
422 | ||
423 | extern struct bus_type ps3_system_bus_type; | |
424 | ||
fde5efd0 GL |
425 | /* system manager */ |
426 | ||
66c63b84 GL |
427 | struct ps3_sys_manager_ops { |
428 | struct ps3_system_bus_device *dev; | |
429 | void (*power_off)(struct ps3_system_bus_device *dev); | |
430 | void (*restart)(struct ps3_system_bus_device *dev); | |
431 | }; | |
432 | ||
433 | void ps3_sys_manager_register_ops(const struct ps3_sys_manager_ops *ops); | |
ca052f79 GU |
434 | void __noreturn ps3_sys_manager_power_off(void); |
435 | void __noreturn ps3_sys_manager_restart(void); | |
436 | void __noreturn ps3_sys_manager_halt(void); | |
1c43d265 GL |
437 | int ps3_sys_manager_get_wol(void); |
438 | void ps3_sys_manager_set_wol(int state); | |
fde5efd0 | 439 | |
fbdb3e5b GU |
440 | struct ps3_prealloc { |
441 | const char *name; | |
442 | void *address; | |
443 | unsigned long size; | |
444 | unsigned long align; | |
445 | }; | |
446 | ||
447 | extern struct ps3_prealloc ps3fb_videomemory; | |
32d73318 | 448 | extern struct ps3_prealloc ps3flash_bounce_buffer; |
fbdb3e5b | 449 | |
781749a4 TY |
450 | /* logical performance monitor */ |
451 | ||
452 | /** | |
453 | * enum ps3_lpm_rights - Rigths granted by the system policy module. | |
454 | * | |
455 | * @PS3_LPM_RIGHTS_USE_LPM: The right to use the lpm. | |
456 | * @PS3_LPM_RIGHTS_USE_TB: The right to use the internal trace buffer. | |
457 | */ | |
458 | ||
459 | enum ps3_lpm_rights { | |
460 | PS3_LPM_RIGHTS_USE_LPM = 0x001, | |
461 | PS3_LPM_RIGHTS_USE_TB = 0x100, | |
462 | }; | |
463 | ||
464 | /** | |
465 | * enum ps3_lpm_tb_type - Type of trace buffer lv1 should use. | |
466 | * | |
467 | * @PS3_LPM_TB_TYPE_NONE: Do not use a trace buffer. | |
468 | * @PS3_LPM_RIGHTS_USE_TB: Use the lv1 internal trace buffer. Must have | |
469 | * rights @PS3_LPM_RIGHTS_USE_TB. | |
470 | */ | |
471 | ||
472 | enum ps3_lpm_tb_type { | |
473 | PS3_LPM_TB_TYPE_NONE = 0, | |
474 | PS3_LPM_TB_TYPE_INTERNAL = 1, | |
475 | }; | |
476 | ||
477 | int ps3_lpm_open(enum ps3_lpm_tb_type tb_type, void *tb_cache, | |
478 | u64 tb_cache_size); | |
479 | int ps3_lpm_close(void); | |
480 | int ps3_lpm_copy_tb(unsigned long offset, void *buf, unsigned long count, | |
481 | unsigned long *bytes_copied); | |
482 | int ps3_lpm_copy_tb_to_user(unsigned long offset, void __user *buf, | |
483 | unsigned long count, unsigned long *bytes_copied); | |
484 | void ps3_set_bookmark(u64 bookmark); | |
485 | void ps3_set_pm_bookmark(u64 tag, u64 incident, u64 th_id); | |
486 | int ps3_set_signal(u64 rtas_signal_group, u8 signal_bit, u16 sub_unit, | |
487 | u8 bus_word); | |
488 | ||
489 | u32 ps3_read_phys_ctr(u32 cpu, u32 phys_ctr); | |
490 | void ps3_write_phys_ctr(u32 cpu, u32 phys_ctr, u32 val); | |
491 | u32 ps3_read_ctr(u32 cpu, u32 ctr); | |
492 | void ps3_write_ctr(u32 cpu, u32 ctr, u32 val); | |
493 | ||
494 | u32 ps3_read_pm07_control(u32 cpu, u32 ctr); | |
495 | void ps3_write_pm07_control(u32 cpu, u32 ctr, u32 val); | |
496 | u32 ps3_read_pm(u32 cpu, enum pm_reg_name reg); | |
497 | void ps3_write_pm(u32 cpu, enum pm_reg_name reg, u32 val); | |
498 | ||
499 | u32 ps3_get_ctr_size(u32 cpu, u32 phys_ctr); | |
500 | void ps3_set_ctr_size(u32 cpu, u32 phys_ctr, u32 ctr_size); | |
501 | ||
502 | void ps3_enable_pm(u32 cpu); | |
503 | void ps3_disable_pm(u32 cpu); | |
504 | void ps3_enable_pm_interrupts(u32 cpu, u32 thread, u32 mask); | |
505 | void ps3_disable_pm_interrupts(u32 cpu); | |
506 | ||
507 | u32 ps3_get_and_clear_pm_interrupts(u32 cpu); | |
508 | void ps3_sync_irq(int node); | |
509 | u32 ps3_get_hw_thread_id(int cpu); | |
510 | u64 ps3_get_spe_id(void *arg); | |
66c63b84 | 511 | |
f58a9d17 | 512 | #endif |