diff options
Diffstat (limited to 'include/asm-powerpc/ps3.h')
-rw-r--r-- | include/asm-powerpc/ps3.h | 234 |
1 files changed, 86 insertions, 148 deletions
diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h index 52a69ed0d90a..e5982ad46576 100644 --- a/include/asm-powerpc/ps3.h +++ b/include/asm-powerpc/ps3.h | |||
@@ -21,11 +21,33 @@ | |||
21 | #if !defined(_ASM_POWERPC_PS3_H) | 21 | #if !defined(_ASM_POWERPC_PS3_H) |
22 | #define _ASM_POWERPC_PS3_H | 22 | #define _ASM_POWERPC_PS3_H |
23 | 23 | ||
24 | #include <linux/compiler.h> /* for __deprecated */ | ||
25 | #include <linux/init.h> | 24 | #include <linux/init.h> |
26 | #include <linux/types.h> | 25 | #include <linux/types.h> |
27 | #include <linux/device.h> | 26 | #include <linux/device.h> |
28 | 27 | ||
28 | union ps3_firmware_version { | ||
29 | u64 raw; | ||
30 | struct { | ||
31 | u16 pad; | ||
32 | u16 major; | ||
33 | u16 minor; | ||
34 | u16 rev; | ||
35 | }; | ||
36 | }; | ||
37 | |||
38 | int ps3_get_firmware_version(union ps3_firmware_version *v); | ||
39 | |||
40 | /* 'Other OS' area */ | ||
41 | |||
42 | enum ps3_param_av_multi_out { | ||
43 | PS3_PARAM_AV_MULTI_OUT_NTSC = 0, | ||
44 | PS3_PARAM_AV_MULTI_OUT_PAL_RGB = 1, | ||
45 | PS3_PARAM_AV_MULTI_OUT_PAL_YCBCR = 2, | ||
46 | PS3_PARAM_AV_MULTI_OUT_SECAM = 3, | ||
47 | }; | ||
48 | |||
49 | enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void); | ||
50 | |||
29 | /** | 51 | /** |
30 | * struct ps3_device_id - HV bus device identifier from the system repository | 52 | * struct ps3_device_id - HV bus device identifier from the system repository |
31 | * @bus_id: HV bus id, {1..} (zero invalid) | 53 | * @bus_id: HV bus id, {1..} (zero invalid) |
@@ -139,20 +161,32 @@ unsigned long ps3_mm_phys_to_lpar(unsigned long phys_addr); | |||
139 | 161 | ||
140 | /* inrerrupt routines */ | 162 | /* inrerrupt routines */ |
141 | 163 | ||
142 | int ps3_alloc_io_irq(unsigned int interrupt_id, unsigned int *virq); | 164 | enum ps3_cpu_binding { |
165 | PS3_BINDING_CPU_ANY = -1, | ||
166 | PS3_BINDING_CPU_0 = 0, | ||
167 | PS3_BINDING_CPU_1 = 1, | ||
168 | }; | ||
169 | |||
170 | int ps3_alloc_io_irq(enum ps3_cpu_binding cpu, unsigned int interrupt_id, | ||
171 | unsigned int *virq); | ||
143 | int ps3_free_io_irq(unsigned int virq); | 172 | int ps3_free_io_irq(unsigned int virq); |
144 | int ps3_alloc_event_irq(unsigned int *virq); | 173 | int ps3_alloc_event_irq(enum ps3_cpu_binding cpu, unsigned int *virq); |
145 | int ps3_free_event_irq(unsigned int virq); | 174 | int ps3_free_event_irq(unsigned int virq); |
146 | int ps3_send_event_locally(unsigned int virq); | 175 | int ps3_send_event_locally(unsigned int virq); |
147 | int ps3_connect_event_irq(const struct ps3_device_id *did, | 176 | int ps3_connect_event_irq(enum ps3_cpu_binding cpu, |
148 | unsigned int interrupt_id, unsigned int *virq); | 177 | const struct ps3_device_id *did, unsigned int interrupt_id, |
178 | unsigned int *virq); | ||
149 | int ps3_disconnect_event_irq(const struct ps3_device_id *did, | 179 | int ps3_disconnect_event_irq(const struct ps3_device_id *did, |
150 | unsigned int interrupt_id, unsigned int virq); | 180 | unsigned int interrupt_id, unsigned int virq); |
151 | int ps3_alloc_vuart_irq(void* virt_addr_bmp, unsigned int *virq); | 181 | int ps3_alloc_vuart_irq(enum ps3_cpu_binding cpu, void* virt_addr_bmp, |
152 | int ps3_free_vuart_irq(unsigned int virq); | ||
153 | int ps3_alloc_spe_irq(unsigned long spe_id, unsigned int class, | ||
154 | unsigned int *virq); | 182 | unsigned int *virq); |
183 | int ps3_free_vuart_irq(unsigned int virq); | ||
184 | int ps3_alloc_spe_irq(enum ps3_cpu_binding cpu, unsigned long spe_id, | ||
185 | unsigned int class, unsigned int *virq); | ||
155 | int ps3_free_spe_irq(unsigned int virq); | 186 | int ps3_free_spe_irq(unsigned int virq); |
187 | int ps3_alloc_irq(enum ps3_cpu_binding cpu, unsigned long outlet, | ||
188 | unsigned int *virq); | ||
189 | int ps3_free_irq(unsigned int virq); | ||
156 | 190 | ||
157 | /* lv1 result codes */ | 191 | /* lv1 result codes */ |
158 | 192 | ||
@@ -247,146 +281,6 @@ static inline const char* ps3_result(int result) | |||
247 | #endif | 281 | #endif |
248 | } | 282 | } |
249 | 283 | ||
250 | /* repository bus info */ | ||
251 | |||
252 | enum ps3_bus_type { | ||
253 | PS3_BUS_TYPE_SB = 4, | ||
254 | PS3_BUS_TYPE_STORAGE = 5, | ||
255 | }; | ||
256 | |||
257 | enum ps3_dev_type { | ||
258 | PS3_DEV_TYPE_SB_GELIC = 3, | ||
259 | PS3_DEV_TYPE_SB_USB = 4, | ||
260 | PS3_DEV_TYPE_SB_GPIO = 6, | ||
261 | }; | ||
262 | |||
263 | int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str, | ||
264 | u64 *value); | ||
265 | int ps3_repository_read_bus_id(unsigned int bus_index, unsigned int *bus_id); | ||
266 | int ps3_repository_read_bus_type(unsigned int bus_index, | ||
267 | enum ps3_bus_type *bus_type); | ||
268 | int ps3_repository_read_bus_num_dev(unsigned int bus_index, | ||
269 | unsigned int *num_dev); | ||
270 | |||
271 | /* repository bus device info */ | ||
272 | |||
273 | enum ps3_interrupt_type { | ||
274 | PS3_INTERRUPT_TYPE_EVENT_PORT = 2, | ||
275 | PS3_INTERRUPT_TYPE_SB_OHCI = 3, | ||
276 | PS3_INTERRUPT_TYPE_SB_EHCI = 4, | ||
277 | PS3_INTERRUPT_TYPE_OTHER = 5, | ||
278 | }; | ||
279 | |||
280 | enum ps3_region_type { | ||
281 | PS3_REGION_TYPE_SB_OHCI = 3, | ||
282 | PS3_REGION_TYPE_SB_EHCI = 4, | ||
283 | PS3_REGION_TYPE_SB_GPIO = 5, | ||
284 | }; | ||
285 | |||
286 | int ps3_repository_read_dev_str(unsigned int bus_index, | ||
287 | unsigned int dev_index, const char *dev_str, u64 *value); | ||
288 | int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index, | ||
289 | unsigned int *dev_id); | ||
290 | int ps3_repository_read_dev_type(unsigned int bus_index, | ||
291 | unsigned int dev_index, enum ps3_dev_type *dev_type); | ||
292 | int ps3_repository_read_dev_intr(unsigned int bus_index, | ||
293 | unsigned int dev_index, unsigned int intr_index, | ||
294 | enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id); | ||
295 | int ps3_repository_read_dev_reg_type(unsigned int bus_index, | ||
296 | unsigned int dev_index, unsigned int reg_index, | ||
297 | enum ps3_region_type *reg_type); | ||
298 | int ps3_repository_read_dev_reg_addr(unsigned int bus_index, | ||
299 | unsigned int dev_index, unsigned int reg_index, u64 *bus_addr, | ||
300 | u64 *len); | ||
301 | int ps3_repository_read_dev_reg(unsigned int bus_index, | ||
302 | unsigned int dev_index, unsigned int reg_index, | ||
303 | enum ps3_region_type *reg_type, u64 *bus_addr, u64 *len); | ||
304 | |||
305 | /* repository bus enumerators */ | ||
306 | |||
307 | struct ps3_repository_device { | ||
308 | unsigned int bus_index; | ||
309 | unsigned int dev_index; | ||
310 | struct ps3_device_id did; | ||
311 | }; | ||
312 | |||
313 | int ps3_repository_find_device(enum ps3_bus_type bus_type, | ||
314 | enum ps3_dev_type dev_type, | ||
315 | const struct ps3_repository_device *start_dev, | ||
316 | struct ps3_repository_device *dev); | ||
317 | static inline int ps3_repository_find_first_device( | ||
318 | enum ps3_bus_type bus_type, enum ps3_dev_type dev_type, | ||
319 | struct ps3_repository_device *dev) | ||
320 | { | ||
321 | return ps3_repository_find_device(bus_type, dev_type, NULL, dev); | ||
322 | } | ||
323 | int ps3_repository_find_interrupt(const struct ps3_repository_device *dev, | ||
324 | enum ps3_interrupt_type intr_type, unsigned int *interrupt_id); | ||
325 | int ps3_repository_find_region(const struct ps3_repository_device *dev, | ||
326 | enum ps3_region_type reg_type, u64 *bus_addr, u64 *len); | ||
327 | |||
328 | /* repository block device info */ | ||
329 | |||
330 | int ps3_repository_read_dev_port(unsigned int bus_index, | ||
331 | unsigned int dev_index, u64 *port); | ||
332 | int ps3_repository_read_dev_blk_size(unsigned int bus_index, | ||
333 | unsigned int dev_index, u64 *blk_size); | ||
334 | int ps3_repository_read_dev_num_blocks(unsigned int bus_index, | ||
335 | unsigned int dev_index, u64 *num_blocks); | ||
336 | int ps3_repository_read_dev_num_regions(unsigned int bus_index, | ||
337 | unsigned int dev_index, unsigned int *num_regions); | ||
338 | int ps3_repository_read_dev_region_id(unsigned int bus_index, | ||
339 | unsigned int dev_index, unsigned int region_index, | ||
340 | unsigned int *region_id); | ||
341 | int ps3_repository_read_dev_region_size(unsigned int bus_index, | ||
342 | unsigned int dev_index, unsigned int region_index, u64 *region_size); | ||
343 | int ps3_repository_read_dev_region_start(unsigned int bus_index, | ||
344 | unsigned int dev_index, unsigned int region_index, u64 *region_start); | ||
345 | |||
346 | /* repository pu and memory info */ | ||
347 | |||
348 | int ps3_repository_read_num_pu(unsigned int *num_pu); | ||
349 | int ps3_repository_read_ppe_id(unsigned int *pu_index, unsigned int *ppe_id); | ||
350 | int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base); | ||
351 | int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size); | ||
352 | int ps3_repository_read_region_total(u64 *region_total); | ||
353 | int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, | ||
354 | u64 *region_total); | ||
355 | |||
356 | /* repository pme info */ | ||
357 | |||
358 | int ps3_repository_read_num_be(unsigned int *num_be); | ||
359 | int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id); | ||
360 | int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq); | ||
361 | int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq); | ||
362 | |||
363 | /* repository 'Other OS' area */ | ||
364 | |||
365 | int ps3_repository_read_boot_dat_addr(u64 *lpar_addr); | ||
366 | int ps3_repository_read_boot_dat_size(unsigned int *size); | ||
367 | int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size); | ||
368 | |||
369 | /* repository spu info */ | ||
370 | |||
371 | /** | ||
372 | * enum spu_resource_type - Type of spu resource. | ||
373 | * @spu_resource_type_shared: Logical spu is shared with other partions. | ||
374 | * @spu_resource_type_exclusive: Logical spu is not shared with other partions. | ||
375 | * | ||
376 | * Returned by ps3_repository_read_spu_resource_id(). | ||
377 | */ | ||
378 | |||
379 | enum ps3_spu_resource_type { | ||
380 | PS3_SPU_RESOURCE_TYPE_SHARED = 0, | ||
381 | PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL, | ||
382 | }; | ||
383 | |||
384 | int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved); | ||
385 | int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id); | ||
386 | int ps3_repository_read_spu_resource_id(unsigned int res_index, | ||
387 | enum ps3_spu_resource_type* resource_type, unsigned int *resource_id); | ||
388 | |||
389 | |||
390 | /* system bus routines */ | 284 | /* system bus routines */ |
391 | 285 | ||
392 | enum ps3_match_id { | 286 | enum ps3_match_id { |
@@ -459,4 +353,48 @@ static inline void *ps3_system_bus_get_driver_data( | |||
459 | 353 | ||
460 | extern struct bus_type ps3_system_bus_type; | 354 | extern struct bus_type ps3_system_bus_type; |
461 | 355 | ||
356 | /* vuart routines */ | ||
357 | |||
358 | struct ps3_vuart_stats { | ||
359 | unsigned long bytes_written; | ||
360 | unsigned long bytes_read; | ||
361 | unsigned long tx_interrupts; | ||
362 | unsigned long rx_interrupts; | ||
363 | unsigned long disconnect_interrupts; | ||
364 | }; | ||
365 | |||
366 | /** | ||
367 | * struct ps3_vuart_port_device - a device on a vuart port | ||
368 | */ | ||
369 | |||
370 | struct ps3_vuart_port_device { | ||
371 | enum ps3_match_id match_id; | ||
372 | struct device core; | ||
373 | |||
374 | /* private driver variables */ | ||
375 | unsigned int port_number; | ||
376 | u64 interrupt_mask; | ||
377 | struct { | ||
378 | spinlock_t lock; | ||
379 | struct list_head head; | ||
380 | } tx_list; | ||
381 | struct { | ||
382 | unsigned long bytes_held; | ||
383 | spinlock_t lock; | ||
384 | struct list_head head; | ||
385 | } rx_list; | ||
386 | struct ps3_vuart_stats stats; | ||
387 | }; | ||
388 | |||
389 | int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev); | ||
390 | |||
391 | struct ps3_prealloc { | ||
392 | const char *name; | ||
393 | void *address; | ||
394 | unsigned long size; | ||
395 | unsigned long align; | ||
396 | }; | ||
397 | |||
398 | extern struct ps3_prealloc ps3fb_videomemory; | ||
399 | |||
462 | #endif | 400 | #endif |