platform.h 8.6 KB

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