diff options
Diffstat (limited to 'include/asm-powerpc/ps3.h')
| -rw-r--r-- | include/asm-powerpc/ps3.h | 182 |
1 files changed, 109 insertions, 73 deletions
diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h index 1e04651eedc4..a6f3f5ee7ca7 100644 --- a/include/asm-powerpc/ps3.h +++ b/include/asm-powerpc/ps3.h | |||
| @@ -35,7 +35,8 @@ union ps3_firmware_version { | |||
| 35 | }; | 35 | }; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | int ps3_get_firmware_version(union ps3_firmware_version *v); | 38 | void ps3_get_firmware_version(union ps3_firmware_version *v); |
| 39 | int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev); | ||
| 39 | 40 | ||
| 40 | /* 'Other OS' area */ | 41 | /* 'Other OS' area */ |
| 41 | 42 | ||
| @@ -48,18 +49,6 @@ enum ps3_param_av_multi_out { | |||
| 48 | 49 | ||
| 49 | enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void); | 50 | enum ps3_param_av_multi_out ps3_os_area_get_av_multi_out(void); |
| 50 | 51 | ||
| 51 | /** | ||
| 52 | * struct ps3_device_id - HV bus device identifier from the system repository | ||
| 53 | * @bus_id: HV bus id, {1..} (zero invalid) | ||
| 54 | * @dev_id: HV device id, {0..} | ||
| 55 | */ | ||
| 56 | |||
| 57 | struct ps3_device_id { | ||
| 58 | unsigned int bus_id; | ||
| 59 | unsigned int dev_id; | ||
| 60 | }; | ||
| 61 | |||
| 62 | |||
| 63 | /* dma routines */ | 52 | /* dma routines */ |
| 64 | 53 | ||
| 65 | enum ps3_dma_page_size { | 54 | enum ps3_dma_page_size { |
| @@ -74,6 +63,8 @@ enum ps3_dma_region_type { | |||
| 74 | PS3_DMA_INTERNAL = 2, | 63 | PS3_DMA_INTERNAL = 2, |
| 75 | }; | 64 | }; |
| 76 | 65 | ||
| 66 | struct ps3_dma_region_ops; | ||
| 67 | |||
| 77 | /** | 68 | /** |
| 78 | * struct ps3_dma_region - A per device dma state variables structure | 69 | * struct ps3_dma_region - A per device dma state variables structure |
| 79 | * @did: The HV device id. | 70 | * @did: The HV device id. |
| @@ -81,21 +72,42 @@ enum ps3_dma_region_type { | |||
| 81 | * @region_type: The HV region type. | 72 | * @region_type: The HV region type. |
| 82 | * @bus_addr: The 'translated' bus address of the region. | 73 | * @bus_addr: The 'translated' bus address of the region. |
| 83 | * @len: The length in bytes of the region. | 74 | * @len: The length in bytes of the region. |
| 75 | * @offset: The offset from the start of memory of the region. | ||
| 76 | * @ioid: The IOID of the device who owns this region | ||
| 84 | * @chunk_list: Opaque variable used by the ioc page manager. | 77 | * @chunk_list: Opaque variable used by the ioc page manager. |
| 78 | * @region_ops: struct ps3_dma_region_ops - dma region operations | ||
| 85 | */ | 79 | */ |
| 86 | 80 | ||
| 87 | struct ps3_dma_region { | 81 | struct ps3_dma_region { |
| 88 | struct ps3_device_id did; | 82 | struct ps3_system_bus_device *dev; |
| 83 | /* device variables */ | ||
| 84 | const struct ps3_dma_region_ops *region_ops; | ||
| 85 | unsigned char ioid; | ||
| 89 | enum ps3_dma_page_size page_size; | 86 | enum ps3_dma_page_size page_size; |
| 90 | enum ps3_dma_region_type region_type; | 87 | enum ps3_dma_region_type region_type; |
| 91 | unsigned long bus_addr; | ||
| 92 | unsigned long len; | 88 | unsigned long len; |
| 89 | unsigned long offset; | ||
| 90 | |||
| 91 | /* driver variables (set by ps3_dma_region_create) */ | ||
| 92 | unsigned long bus_addr; | ||
| 93 | struct { | 93 | struct { |
| 94 | spinlock_t lock; | 94 | spinlock_t lock; |
| 95 | struct list_head head; | 95 | struct list_head head; |
| 96 | } chunk_list; | 96 | } chunk_list; |
| 97 | }; | 97 | }; |
| 98 | 98 | ||
| 99 | struct ps3_dma_region_ops { | ||
| 100 | int (*create)(struct ps3_dma_region *); | ||
| 101 | int (*free)(struct ps3_dma_region *); | ||
| 102 | int (*map)(struct ps3_dma_region *, | ||
| 103 | unsigned long virt_addr, | ||
| 104 | unsigned long len, | ||
| 105 | unsigned long *bus_addr, | ||
| 106 | u64 iopte_pp); | ||
| 107 | int (*unmap)(struct ps3_dma_region *, | ||
| 108 | unsigned long bus_addr, | ||
| 109 | unsigned long len); | ||
| 110 | }; | ||
| 99 | /** | 111 | /** |
| 100 | * struct ps3_dma_region_init - Helper to initialize structure variables | 112 | * struct ps3_dma_region_init - Helper to initialize structure variables |
| 101 | * | 113 | * |
| @@ -103,18 +115,16 @@ struct ps3_dma_region { | |||
| 103 | * ps3_system_bus_device_register. | 115 | * ps3_system_bus_device_register. |
| 104 | */ | 116 | */ |
| 105 | 117 | ||
| 106 | static inline void ps3_dma_region_init(struct ps3_dma_region *r, | 118 | struct ps3_system_bus_device; |
| 107 | const struct ps3_device_id* did, enum ps3_dma_page_size page_size, | 119 | |
| 108 | enum ps3_dma_region_type region_type) | 120 | int ps3_dma_region_init(struct ps3_system_bus_device *dev, |
| 109 | { | 121 | struct ps3_dma_region *r, enum ps3_dma_page_size page_size, |
| 110 | r->did = *did; | 122 | enum ps3_dma_region_type region_type, void *addr, unsigned long len); |
| 111 | r->page_size = page_size; | ||
| 112 | r->region_type = region_type; | ||
| 113 | } | ||
| 114 | int ps3_dma_region_create(struct ps3_dma_region *r); | 123 | int ps3_dma_region_create(struct ps3_dma_region *r); |
| 115 | int ps3_dma_region_free(struct ps3_dma_region *r); | 124 | int ps3_dma_region_free(struct ps3_dma_region *r); |
| 116 | int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, | 125 | int ps3_dma_map(struct ps3_dma_region *r, unsigned long virt_addr, |
| 117 | unsigned long len, unsigned long *bus_addr); | 126 | unsigned long len, unsigned long *bus_addr, |
| 127 | u64 iopte_pp); | ||
| 118 | int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr, | 128 | int ps3_dma_unmap(struct ps3_dma_region *r, unsigned long bus_addr, |
| 119 | unsigned long len); | 129 | unsigned long len); |
| 120 | 130 | ||
| @@ -125,6 +135,7 @@ enum ps3_mmio_page_size { | |||
| 125 | PS3_MMIO_64K = 16U | 135 | PS3_MMIO_64K = 16U |
| 126 | }; | 136 | }; |
| 127 | 137 | ||
| 138 | struct ps3_mmio_region_ops; | ||
| 128 | /** | 139 | /** |
| 129 | * struct ps3_mmio_region - a per device mmio state variables structure | 140 | * struct ps3_mmio_region - a per device mmio state variables structure |
| 130 | * | 141 | * |
| @@ -132,13 +143,18 @@ enum ps3_mmio_page_size { | |||
| 132 | */ | 143 | */ |
| 133 | 144 | ||
| 134 | struct ps3_mmio_region { | 145 | struct ps3_mmio_region { |
| 135 | struct ps3_device_id did; | 146 | struct ps3_system_bus_device *dev; |
| 147 | const struct ps3_mmio_region_ops *mmio_ops; | ||
| 136 | unsigned long bus_addr; | 148 | unsigned long bus_addr; |
| 137 | unsigned long len; | 149 | unsigned long len; |
| 138 | enum ps3_mmio_page_size page_size; | 150 | enum ps3_mmio_page_size page_size; |
| 139 | unsigned long lpar_addr; | 151 | unsigned long lpar_addr; |
| 140 | }; | 152 | }; |
| 141 | 153 | ||
| 154 | struct ps3_mmio_region_ops { | ||
| 155 | int (*create)(struct ps3_mmio_region *); | ||
| 156 | int (*free)(struct ps3_mmio_region *); | ||
| 157 | }; | ||
| 142 | /** | 158 | /** |
| 143 | * struct ps3_mmio_region_init - Helper to initialize structure variables | 159 | * struct ps3_mmio_region_init - Helper to initialize structure variables |
| 144 | * | 160 | * |
| @@ -146,15 +162,9 @@ struct ps3_mmio_region { | |||
| 146 | * ps3_system_bus_device_register. | 162 | * ps3_system_bus_device_register. |
| 147 | */ | 163 | */ |
| 148 | 164 | ||
| 149 | static inline void ps3_mmio_region_init(struct ps3_mmio_region *r, | 165 | int ps3_mmio_region_init(struct ps3_system_bus_device *dev, |
| 150 | const struct ps3_device_id* did, unsigned long bus_addr, | 166 | struct ps3_mmio_region *r, unsigned long bus_addr, unsigned long len, |
| 151 | unsigned long len, enum ps3_mmio_page_size page_size) | 167 | enum ps3_mmio_page_size page_size); |
| 152 | { | ||
| 153 | r->did = *did; | ||
| 154 | r->bus_addr = bus_addr; | ||
| 155 | r->len = len; | ||
| 156 | r->page_size = page_size; | ||
| 157 | } | ||
| 158 | int ps3_mmio_region_create(struct ps3_mmio_region *r); | 168 | int ps3_mmio_region_create(struct ps3_mmio_region *r); |
| 159 | int ps3_free_mmio_region(struct ps3_mmio_region *r); | 169 | int ps3_free_mmio_region(struct ps3_mmio_region *r); |
| 160 | unsigned long ps3_mm_phys_to_lpar(unsigned long phys_addr); | 170 | unsigned long ps3_mm_phys_to_lpar(unsigned long phys_addr); |
| @@ -187,11 +197,10 @@ int ps3_spe_irq_setup(enum ps3_cpu_binding cpu, unsigned long spe_id, | |||
| 187 | unsigned int class, unsigned int *virq); | 197 | unsigned int class, unsigned int *virq); |
| 188 | int ps3_spe_irq_destroy(unsigned int virq); | 198 | int ps3_spe_irq_destroy(unsigned int virq); |
| 189 | 199 | ||
| 190 | int ps3_sb_event_receive_port_setup(enum ps3_cpu_binding cpu, | 200 | int ps3_sb_event_receive_port_setup(struct ps3_system_bus_device *dev, |
| 191 | const struct ps3_device_id *did, unsigned int interrupt_id, | 201 | enum ps3_cpu_binding cpu, unsigned int *virq); |
| 192 | unsigned int *virq); | 202 | int ps3_sb_event_receive_port_destroy(struct ps3_system_bus_device *dev, |
| 193 | int ps3_sb_event_receive_port_destroy(const struct ps3_device_id *did, | 203 | unsigned int virq); |
| 194 | unsigned int interrupt_id, unsigned int virq); | ||
| 195 | 204 | ||
| 196 | /* lv1 result codes */ | 205 | /* lv1 result codes */ |
| 197 | 206 | ||
| @@ -289,11 +298,33 @@ static inline const char* ps3_result(int result) | |||
| 289 | /* system bus routines */ | 298 | /* system bus routines */ |
| 290 | 299 | ||
| 291 | enum ps3_match_id { | 300 | enum ps3_match_id { |
| 292 | PS3_MATCH_ID_EHCI = 1, | 301 | PS3_MATCH_ID_EHCI = 1, |
| 293 | PS3_MATCH_ID_OHCI, | 302 | PS3_MATCH_ID_OHCI = 2, |
| 294 | PS3_MATCH_ID_GELIC, | 303 | PS3_MATCH_ID_GELIC = 3, |
| 295 | PS3_MATCH_ID_AV_SETTINGS, | 304 | PS3_MATCH_ID_AV_SETTINGS = 4, |
| 296 | PS3_MATCH_ID_SYSTEM_MANAGER, | 305 | PS3_MATCH_ID_SYSTEM_MANAGER = 5, |
| 306 | PS3_MATCH_ID_STOR_DISK = 6, | ||
| 307 | PS3_MATCH_ID_STOR_ROM = 7, | ||
| 308 | PS3_MATCH_ID_STOR_FLASH = 8, | ||
| 309 | PS3_MATCH_ID_SOUND = 9, | ||
| 310 | PS3_MATCH_ID_GRAPHICS = 10, | ||
| 311 | }; | ||
| 312 | |||
| 313 | #define PS3_MODULE_ALIAS_EHCI "ps3:1" | ||
| 314 | #define PS3_MODULE_ALIAS_OHCI "ps3:2" | ||
| 315 | #define PS3_MODULE_ALIAS_GELIC "ps3:3" | ||
| 316 | #define PS3_MODULE_ALIAS_AV_SETTINGS "ps3:4" | ||
| 317 | #define PS3_MODULE_ALIAS_SYSTEM_MANAGER "ps3:5" | ||
| 318 | #define PS3_MODULE_ALIAS_STOR_DISK "ps3:6" | ||
| 319 | #define PS3_MODULE_ALIAS_STOR_ROM "ps3:7" | ||
| 320 | #define PS3_MODULE_ALIAS_STOR_FLASH "ps3:8" | ||
| 321 | #define PS3_MODULE_ALIAS_SOUND "ps3:9" | ||
| 322 | #define PS3_MODULE_ALIAS_GRAPHICS "ps3:10" | ||
| 323 | |||
| 324 | enum ps3_system_bus_device_type { | ||
| 325 | PS3_DEVICE_TYPE_IOC0 = 1, | ||
| 326 | PS3_DEVICE_TYPE_SB, | ||
| 327 | PS3_DEVICE_TYPE_VUART, | ||
| 297 | }; | 328 | }; |
| 298 | 329 | ||
| 299 | /** | 330 | /** |
| @@ -302,14 +333,23 @@ enum ps3_match_id { | |||
| 302 | 333 | ||
| 303 | struct ps3_system_bus_device { | 334 | struct ps3_system_bus_device { |
| 304 | enum ps3_match_id match_id; | 335 | enum ps3_match_id match_id; |
| 305 | struct ps3_device_id did; | 336 | enum ps3_system_bus_device_type dev_type; |
| 306 | unsigned int interrupt_id; | 337 | |
| 307 | /* struct iommu_table *iommu_table; -- waiting for Ben's cleanups */ | 338 | unsigned int bus_id; /* SB */ |
| 308 | struct ps3_dma_region *d_region; | 339 | unsigned int dev_id; /* SB */ |
| 309 | struct ps3_mmio_region *m_region; | 340 | unsigned int interrupt_id; /* SB */ |
| 341 | struct ps3_dma_region *d_region; /* SB, IOC0 */ | ||
| 342 | struct ps3_mmio_region *m_region; /* SB, IOC0*/ | ||
| 343 | unsigned int port_number; /* VUART */ | ||
| 344 | |||
| 345 | /* struct iommu_table *iommu_table; -- waiting for BenH's cleanups */ | ||
| 310 | struct device core; | 346 | struct device core; |
| 347 | void *driver_priv; /* private driver variables */ | ||
| 311 | }; | 348 | }; |
| 312 | 349 | ||
| 350 | int ps3_open_hv_device(struct ps3_system_bus_device *dev); | ||
| 351 | int ps3_close_hv_device(struct ps3_system_bus_device *dev); | ||
| 352 | |||
| 313 | /** | 353 | /** |
| 314 | * struct ps3_system_bus_driver - a driver for a device on the system bus | 354 | * struct ps3_system_bus_driver - a driver for a device on the system bus |
| 315 | */ | 355 | */ |
| @@ -319,6 +359,7 @@ struct ps3_system_bus_driver { | |||
| 319 | struct device_driver core; | 359 | struct device_driver core; |
| 320 | int (*probe)(struct ps3_system_bus_device *); | 360 | int (*probe)(struct ps3_system_bus_device *); |
| 321 | int (*remove)(struct ps3_system_bus_device *); | 361 | int (*remove)(struct ps3_system_bus_device *); |
| 362 | int (*shutdown)(struct ps3_system_bus_device *); | ||
| 322 | /* int (*suspend)(struct ps3_system_bus_device *, pm_message_t); */ | 363 | /* int (*suspend)(struct ps3_system_bus_device *, pm_message_t); */ |
| 323 | /* int (*resume)(struct ps3_system_bus_device *); */ | 364 | /* int (*resume)(struct ps3_system_bus_device *); */ |
| 324 | }; | 365 | }; |
| @@ -326,16 +367,24 @@ struct ps3_system_bus_driver { | |||
| 326 | int ps3_system_bus_device_register(struct ps3_system_bus_device *dev); | 367 | int ps3_system_bus_device_register(struct ps3_system_bus_device *dev); |
| 327 | int ps3_system_bus_driver_register(struct ps3_system_bus_driver *drv); | 368 | int ps3_system_bus_driver_register(struct ps3_system_bus_driver *drv); |
| 328 | void ps3_system_bus_driver_unregister(struct ps3_system_bus_driver *drv); | 369 | void ps3_system_bus_driver_unregister(struct ps3_system_bus_driver *drv); |
| 329 | static inline struct ps3_system_bus_driver *to_ps3_system_bus_driver( | 370 | |
| 371 | static inline struct ps3_system_bus_driver *ps3_drv_to_system_bus_drv( | ||
| 330 | struct device_driver *_drv) | 372 | struct device_driver *_drv) |
| 331 | { | 373 | { |
| 332 | return container_of(_drv, struct ps3_system_bus_driver, core); | 374 | return container_of(_drv, struct ps3_system_bus_driver, core); |
| 333 | } | 375 | } |
| 334 | static inline struct ps3_system_bus_device *to_ps3_system_bus_device( | 376 | static inline struct ps3_system_bus_device *ps3_dev_to_system_bus_dev( |
| 335 | struct device *_dev) | 377 | struct device *_dev) |
| 336 | { | 378 | { |
| 337 | return container_of(_dev, struct ps3_system_bus_device, core); | 379 | return container_of(_dev, struct ps3_system_bus_device, core); |
| 338 | } | 380 | } |
| 381 | static inline struct ps3_system_bus_driver * | ||
| 382 | ps3_system_bus_dev_to_system_bus_drv(struct ps3_system_bus_device *_dev) | ||
| 383 | { | ||
| 384 | BUG_ON(!_dev); | ||
| 385 | BUG_ON(!_dev->core.driver); | ||
| 386 | return ps3_drv_to_system_bus_drv(_dev->core.driver); | ||
| 387 | } | ||
| 339 | 388 | ||
| 340 | /** | 389 | /** |
| 341 | * ps3_system_bus_set_drvdata - | 390 | * ps3_system_bus_set_drvdata - |
| @@ -358,32 +407,17 @@ static inline void *ps3_system_bus_get_driver_data( | |||
| 358 | 407 | ||
| 359 | extern struct bus_type ps3_system_bus_type; | 408 | extern struct bus_type ps3_system_bus_type; |
| 360 | 409 | ||
| 361 | /* vuart routines */ | 410 | /* system manager */ |
| 362 | |||
| 363 | struct ps3_vuart_port_priv; | ||
| 364 | |||
| 365 | /** | ||
| 366 | * struct ps3_vuart_port_device - a device on a vuart port | ||
| 367 | */ | ||
| 368 | |||
| 369 | struct ps3_vuart_port_device { | ||
| 370 | enum ps3_match_id match_id; | ||
| 371 | struct device core; | ||
| 372 | struct ps3_vuart_port_priv* priv; /* private driver variables */ | ||
| 373 | 411 | ||
| 412 | struct ps3_sys_manager_ops { | ||
| 413 | struct ps3_system_bus_device *dev; | ||
| 414 | void (*power_off)(struct ps3_system_bus_device *dev); | ||
| 415 | void (*restart)(struct ps3_system_bus_device *dev); | ||
| 374 | }; | 416 | }; |
| 375 | 417 | ||
| 376 | int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev); | 418 | void ps3_sys_manager_register_ops(const struct ps3_sys_manager_ops *ops); |
| 377 | |||
| 378 | /* system manager */ | ||
| 379 | |||
| 380 | #ifdef CONFIG_PS3_SYS_MANAGER | ||
| 381 | void ps3_sys_manager_restart(void); | ||
| 382 | void ps3_sys_manager_power_off(void); | 419 | void ps3_sys_manager_power_off(void); |
| 383 | #else | 420 | void ps3_sys_manager_restart(void); |
| 384 | static inline void ps3_sys_manager_restart(void) {} | ||
| 385 | static inline void ps3_sys_manager_power_off(void) {} | ||
| 386 | #endif | ||
| 387 | 421 | ||
| 388 | struct ps3_prealloc { | 422 | struct ps3_prealloc { |
| 389 | const char *name; | 423 | const char *name; |
| @@ -393,5 +427,7 @@ struct ps3_prealloc { | |||
| 393 | }; | 427 | }; |
| 394 | 428 | ||
| 395 | extern struct ps3_prealloc ps3fb_videomemory; | 429 | extern struct ps3_prealloc ps3fb_videomemory; |
| 430 | extern struct ps3_prealloc ps3flash_bounce_buffer; | ||
| 431 | |||
| 396 | 432 | ||
| 397 | #endif | 433 | #endif |
