platform.h 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. #if !defined(_PS3_PLATFORM_H)
  21. #define _PS3_PLATFORM_H
  22. #include <linux/rtc.h>
  23. #include <scsi/scsi.h>
  24. #include <asm/ps3.h>
  25. /* htab */
  26. void __init ps3_hpte_init(unsigned long htab_size);
  27. void __init ps3_map_htab(void);
  28. /* mm */
  29. void __init ps3_mm_init(void);
  30. void __init ps3_mm_vas_create(unsigned long* htab_size);
  31. void ps3_mm_vas_destroy(void);
  32. void ps3_mm_shutdown(void);
  33. /* irq */
  34. void ps3_init_IRQ(void);
  35. void ps3_shutdown_IRQ(int cpu);
  36. void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq);
  37. void __init ps3_register_ipi_irq(unsigned int cpu, unsigned int virq);
  38. /* smp */
  39. void smp_init_ps3(void);
  40. #ifdef CONFIG_SMP
  41. void ps3_smp_cleanup_cpu(int cpu);
  42. #else
  43. static inline void ps3_smp_cleanup_cpu(int cpu) { }
  44. #endif
  45. /* time */
  46. void __init ps3_calibrate_decr(void);
  47. unsigned long __init ps3_get_boot_time(void);
  48. void ps3_get_rtc_time(struct rtc_time *time);
  49. int ps3_set_rtc_time(struct rtc_time *time);
  50. /* os area */
  51. void __init ps3_os_area_save_params(void);
  52. void __init ps3_os_area_init(void);
  53. /* spu */
  54. #if defined(CONFIG_SPU_BASE)
  55. void ps3_spu_set_platform (void);
  56. #else
  57. static inline void ps3_spu_set_platform (void) {}
  58. #endif
  59. /* repository bus info */
  60. enum ps3_bus_type {
  61. PS3_BUS_TYPE_SB = 4,
  62. PS3_BUS_TYPE_STORAGE = 5,
  63. };
  64. enum ps3_dev_type {
  65. PS3_DEV_TYPE_STOR_DISK = TYPE_DISK, /* 0 */
  66. PS3_DEV_TYPE_SB_GELIC = 3,
  67. PS3_DEV_TYPE_SB_USB = 4,
  68. PS3_DEV_TYPE_STOR_ROM = TYPE_ROM, /* 5 */
  69. PS3_DEV_TYPE_SB_GPIO = 6,
  70. PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC, /* 14 */
  71. };
  72. int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str,
  73. u64 *value);
  74. int ps3_repository_read_bus_id(unsigned int bus_index, u64 *bus_id);
  75. int ps3_repository_read_bus_type(unsigned int bus_index,
  76. enum ps3_bus_type *bus_type);
  77. int ps3_repository_read_bus_num_dev(unsigned int bus_index,
  78. unsigned int *num_dev);
  79. /* repository bus device info */
  80. enum ps3_interrupt_type {
  81. PS3_INTERRUPT_TYPE_EVENT_PORT = 2,
  82. PS3_INTERRUPT_TYPE_SB_OHCI = 3,
  83. PS3_INTERRUPT_TYPE_SB_EHCI = 4,
  84. PS3_INTERRUPT_TYPE_OTHER = 5,
  85. };
  86. enum ps3_reg_type {
  87. PS3_REG_TYPE_SB_OHCI = 3,
  88. PS3_REG_TYPE_SB_EHCI = 4,
  89. PS3_REG_TYPE_SB_GPIO = 5,
  90. };
  91. int ps3_repository_read_dev_str(unsigned int bus_index,
  92. unsigned int dev_index, const char *dev_str, u64 *value);
  93. int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index,
  94. u64 *dev_id);
  95. int ps3_repository_read_dev_type(unsigned int bus_index,
  96. unsigned int dev_index, enum ps3_dev_type *dev_type);
  97. int ps3_repository_read_dev_intr(unsigned int bus_index,
  98. unsigned int dev_index, unsigned int intr_index,
  99. enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id);
  100. int ps3_repository_read_dev_reg_type(unsigned int bus_index,
  101. unsigned int dev_index, unsigned int reg_index,
  102. enum ps3_reg_type *reg_type);
  103. int ps3_repository_read_dev_reg_addr(unsigned int bus_index,
  104. unsigned int dev_index, unsigned int reg_index, u64 *bus_addr,
  105. u64 *len);
  106. int ps3_repository_read_dev_reg(unsigned int bus_index,
  107. unsigned int dev_index, unsigned int reg_index,
  108. enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len);
  109. /* repository bus enumerators */
  110. struct ps3_repository_device {
  111. unsigned int bus_index;
  112. unsigned int dev_index;
  113. enum ps3_bus_type bus_type;
  114. enum ps3_dev_type dev_type;
  115. u64 bus_id;
  116. u64 dev_id;
  117. };
  118. int ps3_repository_find_device(struct ps3_repository_device *repo);
  119. int ps3_repository_find_device_by_id(struct ps3_repository_device *repo,
  120. u64 bus_id, u64 dev_id);
  121. int ps3_repository_find_devices(enum ps3_bus_type bus_type,
  122. int (*callback)(const struct ps3_repository_device *repo));
  123. int ps3_repository_find_bus(enum ps3_bus_type bus_type, unsigned int from,
  124. unsigned int *bus_index);
  125. int ps3_repository_find_interrupt(const struct ps3_repository_device *repo,
  126. enum ps3_interrupt_type intr_type, unsigned int *interrupt_id);
  127. int ps3_repository_find_reg(const struct ps3_repository_device *repo,
  128. enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len);
  129. /* repository block device info */
  130. int ps3_repository_read_stor_dev_port(unsigned int bus_index,
  131. unsigned int dev_index, u64 *port);
  132. int ps3_repository_read_stor_dev_blk_size(unsigned int bus_index,
  133. unsigned int dev_index, u64 *blk_size);
  134. int ps3_repository_read_stor_dev_num_blocks(unsigned int bus_index,
  135. unsigned int dev_index, u64 *num_blocks);
  136. int ps3_repository_read_stor_dev_num_regions(unsigned int bus_index,
  137. unsigned int dev_index, unsigned int *num_regions);
  138. int ps3_repository_read_stor_dev_region_id(unsigned int bus_index,
  139. unsigned int dev_index, unsigned int region_index,
  140. unsigned int *region_id);
  141. int ps3_repository_read_stor_dev_region_size(unsigned int bus_index,
  142. unsigned int dev_index, unsigned int region_index, u64 *region_size);
  143. int ps3_repository_read_stor_dev_region_start(unsigned int bus_index,
  144. unsigned int dev_index, unsigned int region_index, u64 *region_start);
  145. int ps3_repository_read_stor_dev_info(unsigned int bus_index,
  146. unsigned int dev_index, u64 *port, u64 *blk_size,
  147. u64 *num_blocks, unsigned int *num_regions);
  148. int ps3_repository_read_stor_dev_region(unsigned int bus_index,
  149. unsigned int dev_index, unsigned int region_index,
  150. unsigned int *region_id, u64 *region_start, u64 *region_size);
  151. /* repository logical pu and memory info */
  152. int ps3_repository_read_num_pu(u64 *num_pu);
  153. int ps3_repository_read_pu_id(unsigned int pu_index, u64 *pu_id);
  154. int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base);
  155. int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size);
  156. int ps3_repository_read_region_total(u64 *region_total);
  157. int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size,
  158. u64 *region_total);
  159. int ps3_repository_read_highmem_region_count(unsigned int *region_count);
  160. int ps3_repository_read_highmem_base(unsigned int region_index,
  161. u64 *highmem_base);
  162. int ps3_repository_read_highmem_size(unsigned int region_index,
  163. u64 *highmem_size);
  164. int ps3_repository_read_highmem_info(unsigned int region_index,
  165. u64 *highmem_base, u64 *highmem_size);
  166. #if defined (CONFIG_PS3_REPOSITORY_WRITE)
  167. int ps3_repository_write_highmem_region_count(unsigned int region_count);
  168. int ps3_repository_write_highmem_base(unsigned int region_index,
  169. u64 highmem_base);
  170. int ps3_repository_write_highmem_size(unsigned int region_index,
  171. u64 highmem_size);
  172. int ps3_repository_write_highmem_info(unsigned int region_index,
  173. u64 highmem_base, u64 highmem_size);
  174. int ps3_repository_delete_highmem_info(unsigned int region_index);
  175. #else
  176. static inline int ps3_repository_write_highmem_region_count(
  177. unsigned int region_count) {return 0;}
  178. static inline int ps3_repository_write_highmem_base(unsigned int region_index,
  179. u64 highmem_base) {return 0;}
  180. static inline int ps3_repository_write_highmem_size(unsigned int region_index,
  181. u64 highmem_size) {return 0;}
  182. static inline int ps3_repository_write_highmem_info(unsigned int region_index,
  183. u64 highmem_base, u64 highmem_size) {return 0;}
  184. static inline int ps3_repository_delete_highmem_info(unsigned int region_index)
  185. {return 0;}
  186. #endif
  187. /* repository pme info */
  188. int ps3_repository_read_num_be(unsigned int *num_be);
  189. int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id);
  190. int ps3_repository_read_be_id(u64 node_id, u64 *be_id);
  191. int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq);
  192. int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq);
  193. /* repository performance monitor info */
  194. int ps3_repository_read_lpm_privileges(unsigned int be_index, u64 *lpar,
  195. u64 *rights);
  196. /* repository 'Other OS' area */
  197. int ps3_repository_read_boot_dat_addr(u64 *lpar_addr);
  198. int ps3_repository_read_boot_dat_size(unsigned int *size);
  199. int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size);
  200. /* repository spu info */
  201. /**
  202. * enum spu_resource_type - Type of spu resource.
  203. * @spu_resource_type_shared: Logical spu is shared with other partions.
  204. * @spu_resource_type_exclusive: Logical spu is not shared with other partions.
  205. *
  206. * Returned by ps3_repository_read_spu_resource_id().
  207. */
  208. enum ps3_spu_resource_type {
  209. PS3_SPU_RESOURCE_TYPE_SHARED = 0,
  210. PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL,
  211. };
  212. int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved);
  213. int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id);
  214. int ps3_repository_read_spu_resource_id(unsigned int res_index,
  215. enum ps3_spu_resource_type* resource_type, unsigned int *resource_id);
  216. /* repository vuart info */
  217. int ps3_repository_read_vuart_av_port(unsigned int *port);
  218. int ps3_repository_read_vuart_sysmgr_port(unsigned int *port);
  219. #endif