Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  PS3 platform declarations.
0004  *
0005  *  Copyright (C) 2006 Sony Computer Entertainment Inc.
0006  *  Copyright 2006 Sony Corp.
0007  */
0008 
0009 #if !defined(_PS3_PLATFORM_H)
0010 #define _PS3_PLATFORM_H
0011 
0012 #include <linux/rtc.h>
0013 #include <scsi/scsi.h>
0014 
0015 #include <asm/ps3.h>
0016 
0017 /* htab */
0018 
0019 void __init ps3_hpte_init(unsigned long htab_size);
0020 void __init ps3_map_htab(void);
0021 
0022 /* mm */
0023 
0024 void __init ps3_mm_init(void);
0025 void __init ps3_mm_vas_create(unsigned long* htab_size);
0026 void ps3_mm_vas_destroy(void);
0027 void ps3_mm_shutdown(void);
0028 
0029 /* irq */
0030 
0031 void ps3_init_IRQ(void);
0032 void ps3_shutdown_IRQ(int cpu);
0033 void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq);
0034 void __init ps3_register_ipi_irq(unsigned int cpu, unsigned int virq);
0035 
0036 /* smp */
0037 
0038 void __init smp_init_ps3(void);
0039 #ifdef CONFIG_SMP
0040 void ps3_smp_cleanup_cpu(int cpu);
0041 #else
0042 static inline void ps3_smp_cleanup_cpu(int cpu) { }
0043 #endif
0044 
0045 /* time */
0046 
0047 void __init ps3_calibrate_decr(void);
0048 time64_t __init ps3_get_boot_time(void);
0049 void ps3_get_rtc_time(struct rtc_time *time);
0050 int ps3_set_rtc_time(struct rtc_time *time);
0051 
0052 /* os area */
0053 
0054 void __init ps3_os_area_save_params(void);
0055 void __init ps3_os_area_init(void);
0056 
0057 /* spu */
0058 
0059 #if defined(CONFIG_SPU_BASE)
0060 void ps3_spu_set_platform (void);
0061 #else
0062 static inline void ps3_spu_set_platform (void) {}
0063 #endif
0064 
0065 /* repository bus info */
0066 
0067 enum ps3_bus_type {
0068     PS3_BUS_TYPE_SB = 4,
0069     PS3_BUS_TYPE_STORAGE = 5,
0070 };
0071 
0072 enum ps3_dev_type {
0073     PS3_DEV_TYPE_STOR_DISK = TYPE_DISK, /* 0 */
0074     PS3_DEV_TYPE_SB_GELIC = 3,
0075     PS3_DEV_TYPE_SB_USB = 4,
0076     PS3_DEV_TYPE_STOR_ROM = TYPE_ROM,   /* 5 */
0077     PS3_DEV_TYPE_SB_GPIO = 6,
0078     PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC, /* 14 */
0079 };
0080 
0081 int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str,
0082     u64 *value);
0083 int ps3_repository_read_bus_id(unsigned int bus_index, u64 *bus_id);
0084 int ps3_repository_read_bus_type(unsigned int bus_index,
0085     enum ps3_bus_type *bus_type);
0086 int ps3_repository_read_bus_num_dev(unsigned int bus_index,
0087     unsigned int *num_dev);
0088 
0089 /* repository bus device info */
0090 
0091 enum ps3_interrupt_type {
0092     PS3_INTERRUPT_TYPE_EVENT_PORT = 2,
0093     PS3_INTERRUPT_TYPE_SB_OHCI = 3,
0094     PS3_INTERRUPT_TYPE_SB_EHCI = 4,
0095     PS3_INTERRUPT_TYPE_OTHER = 5,
0096 };
0097 
0098 enum ps3_reg_type {
0099     PS3_REG_TYPE_SB_OHCI = 3,
0100     PS3_REG_TYPE_SB_EHCI = 4,
0101     PS3_REG_TYPE_SB_GPIO = 5,
0102 };
0103 
0104 int ps3_repository_read_dev_str(unsigned int bus_index,
0105     unsigned int dev_index, const char *dev_str, u64 *value);
0106 int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index,
0107     u64 *dev_id);
0108 int ps3_repository_read_dev_type(unsigned int bus_index,
0109     unsigned int dev_index, enum ps3_dev_type *dev_type);
0110 int ps3_repository_read_dev_intr(unsigned int bus_index,
0111     unsigned int dev_index, unsigned int intr_index,
0112     enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id);
0113 int ps3_repository_read_dev_reg_type(unsigned int bus_index,
0114     unsigned int dev_index, unsigned int reg_index,
0115     enum ps3_reg_type *reg_type);
0116 int ps3_repository_read_dev_reg_addr(unsigned int bus_index,
0117     unsigned int dev_index, unsigned int reg_index, u64 *bus_addr,
0118     u64 *len);
0119 int ps3_repository_read_dev_reg(unsigned int bus_index,
0120     unsigned int dev_index, unsigned int reg_index,
0121     enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len);
0122 
0123 /* repository bus enumerators */
0124 
0125 struct ps3_repository_device {
0126     unsigned int bus_index;
0127     unsigned int dev_index;
0128     enum ps3_bus_type bus_type;
0129     enum ps3_dev_type dev_type;
0130     u64 bus_id;
0131     u64 dev_id;
0132 };
0133 
0134 int ps3_repository_find_device(struct ps3_repository_device *repo);
0135 int ps3_repository_find_device_by_id(struct ps3_repository_device *repo,
0136                      u64 bus_id, u64 dev_id);
0137 int __init ps3_repository_find_devices(enum ps3_bus_type bus_type,
0138     int (*callback)(const struct ps3_repository_device *repo));
0139 int __init ps3_repository_find_bus(enum ps3_bus_type bus_type, unsigned int from,
0140     unsigned int *bus_index);
0141 int ps3_repository_find_interrupt(const struct ps3_repository_device *repo,
0142     enum ps3_interrupt_type intr_type, unsigned int *interrupt_id);
0143 int ps3_repository_find_reg(const struct ps3_repository_device *repo,
0144     enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len);
0145 
0146 /* repository block device info */
0147 
0148 int ps3_repository_read_stor_dev_port(unsigned int bus_index,
0149     unsigned int dev_index, u64 *port);
0150 int ps3_repository_read_stor_dev_blk_size(unsigned int bus_index,
0151     unsigned int dev_index, u64 *blk_size);
0152 int ps3_repository_read_stor_dev_num_blocks(unsigned int bus_index,
0153     unsigned int dev_index, u64 *num_blocks);
0154 int ps3_repository_read_stor_dev_num_regions(unsigned int bus_index,
0155     unsigned int dev_index, unsigned int *num_regions);
0156 int ps3_repository_read_stor_dev_region_id(unsigned int bus_index,
0157     unsigned int dev_index, unsigned int region_index,
0158     unsigned int *region_id);
0159 int ps3_repository_read_stor_dev_region_size(unsigned int bus_index,
0160     unsigned int dev_index, unsigned int region_index, u64 *region_size);
0161 int ps3_repository_read_stor_dev_region_start(unsigned int bus_index,
0162     unsigned int dev_index, unsigned int region_index, u64 *region_start);
0163 int ps3_repository_read_stor_dev_info(unsigned int bus_index,
0164     unsigned int dev_index, u64 *port, u64 *blk_size,
0165     u64 *num_blocks, unsigned int *num_regions);
0166 int ps3_repository_read_stor_dev_region(unsigned int bus_index,
0167     unsigned int dev_index, unsigned int region_index,
0168     unsigned int *region_id, u64 *region_start, u64 *region_size);
0169 
0170 /* repository logical pu and memory info */
0171 
0172 int ps3_repository_read_num_pu(u64 *num_pu);
0173 int ps3_repository_read_pu_id(unsigned int pu_index, u64 *pu_id);
0174 int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base);
0175 int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size);
0176 int ps3_repository_read_region_total(u64 *region_total);
0177 int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size,
0178     u64 *region_total);
0179 int ps3_repository_read_highmem_region_count(unsigned int *region_count);
0180 int ps3_repository_read_highmem_base(unsigned int region_index,
0181     u64 *highmem_base);
0182 int ps3_repository_read_highmem_size(unsigned int region_index,
0183     u64 *highmem_size);
0184 int ps3_repository_read_highmem_info(unsigned int region_index,
0185     u64 *highmem_base, u64 *highmem_size);
0186 
0187 #if defined (CONFIG_PS3_REPOSITORY_WRITE)
0188 int ps3_repository_write_highmem_region_count(unsigned int region_count);
0189 int ps3_repository_write_highmem_base(unsigned int region_index,
0190     u64 highmem_base);
0191 int ps3_repository_write_highmem_size(unsigned int region_index,
0192     u64 highmem_size);
0193 int ps3_repository_write_highmem_info(unsigned int region_index,
0194     u64 highmem_base, u64 highmem_size);
0195 int ps3_repository_delete_highmem_info(unsigned int region_index);
0196 #else
0197 static inline int ps3_repository_write_highmem_region_count(
0198     unsigned int region_count) {return 0;}
0199 static inline int ps3_repository_write_highmem_base(unsigned int region_index,
0200     u64 highmem_base) {return 0;}
0201 static inline int ps3_repository_write_highmem_size(unsigned int region_index,
0202     u64 highmem_size) {return 0;}
0203 static inline int ps3_repository_write_highmem_info(unsigned int region_index,
0204     u64 highmem_base, u64 highmem_size) {return 0;}
0205 static inline int ps3_repository_delete_highmem_info(unsigned int region_index)
0206     {return 0;}
0207 #endif
0208 
0209 /* repository pme info */
0210 
0211 int ps3_repository_read_num_be(unsigned int *num_be);
0212 int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id);
0213 int ps3_repository_read_be_id(u64 node_id, u64 *be_id);
0214 int __init ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq);
0215 int __init ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq);
0216 
0217 /* repository performance monitor info */
0218 
0219 int ps3_repository_read_lpm_privileges(unsigned int be_index, u64 *lpar,
0220     u64 *rights);
0221 
0222 /* repository 'Other OS' area */
0223 
0224 int ps3_repository_read_boot_dat_addr(u64 *lpar_addr);
0225 int ps3_repository_read_boot_dat_size(unsigned int *size);
0226 int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size);
0227 
0228 /* repository spu info */
0229 
0230 /**
0231  * enum spu_resource_type - Type of spu resource.
0232  * @spu_resource_type_shared: Logical spu is shared with other partions.
0233  * @spu_resource_type_exclusive: Logical spu is not shared with other partions.
0234  *
0235  * Returned by ps3_repository_read_spu_resource_id().
0236  */
0237 
0238 enum ps3_spu_resource_type {
0239     PS3_SPU_RESOURCE_TYPE_SHARED = 0,
0240     PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL,
0241 };
0242 
0243 int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved);
0244 int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id);
0245 int ps3_repository_read_spu_resource_id(unsigned int res_index,
0246     enum ps3_spu_resource_type* resource_type, unsigned int *resource_id);
0247 
0248 /* repository vuart info */
0249 
0250 int __init ps3_repository_read_vuart_av_port(unsigned int *port);
0251 int __init ps3_repository_read_vuart_sysmgr_port(unsigned int *port);
0252 
0253 #endif