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