Path: blob/master/arch/powerpc/platforms/ps3/platform.h
10818 views
/*1* PS3 platform declarations.2*3* Copyright (C) 2006 Sony Computer Entertainment Inc.4* Copyright 2006 Sony Corp.5*6* This program is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License as published by8* the Free Software Foundation; version 2 of the License.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18*/1920#if !defined(_PS3_PLATFORM_H)21#define _PS3_PLATFORM_H2223#include <linux/rtc.h>24#include <scsi/scsi.h>2526#include <asm/ps3.h>2728/* htab */2930void __init ps3_hpte_init(unsigned long htab_size);31void __init ps3_map_htab(void);3233/* mm */3435void __init ps3_mm_init(void);36void __init ps3_mm_vas_create(unsigned long* htab_size);37void ps3_mm_vas_destroy(void);38void ps3_mm_shutdown(void);3940/* irq */4142void ps3_init_IRQ(void);43void ps3_shutdown_IRQ(int cpu);44void __init ps3_register_ipi_debug_brk(unsigned int cpu, unsigned int virq);4546/* smp */4748void smp_init_ps3(void);49#ifdef CONFIG_SMP50void ps3_smp_cleanup_cpu(int cpu);51#else52static inline void ps3_smp_cleanup_cpu(int cpu) { }53#endif5455/* time */5657void __init ps3_calibrate_decr(void);58unsigned long __init ps3_get_boot_time(void);59void ps3_get_rtc_time(struct rtc_time *time);60int ps3_set_rtc_time(struct rtc_time *time);6162/* os area */6364void __init ps3_os_area_save_params(void);65void __init ps3_os_area_init(void);6667/* spu */6869#if defined(CONFIG_SPU_BASE)70void ps3_spu_set_platform (void);71#else72static inline void ps3_spu_set_platform (void) {}73#endif7475/* repository bus info */7677enum ps3_bus_type {78PS3_BUS_TYPE_SB = 4,79PS3_BUS_TYPE_STORAGE = 5,80};8182enum ps3_dev_type {83PS3_DEV_TYPE_STOR_DISK = TYPE_DISK, /* 0 */84PS3_DEV_TYPE_SB_GELIC = 3,85PS3_DEV_TYPE_SB_USB = 4,86PS3_DEV_TYPE_STOR_ROM = TYPE_ROM, /* 5 */87PS3_DEV_TYPE_SB_GPIO = 6,88PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC, /* 14 */89};9091int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str,92u64 *value);93int ps3_repository_read_bus_id(unsigned int bus_index, u64 *bus_id);94int ps3_repository_read_bus_type(unsigned int bus_index,95enum ps3_bus_type *bus_type);96int ps3_repository_read_bus_num_dev(unsigned int bus_index,97unsigned int *num_dev);9899/* repository bus device info */100101enum ps3_interrupt_type {102PS3_INTERRUPT_TYPE_EVENT_PORT = 2,103PS3_INTERRUPT_TYPE_SB_OHCI = 3,104PS3_INTERRUPT_TYPE_SB_EHCI = 4,105PS3_INTERRUPT_TYPE_OTHER = 5,106};107108enum ps3_reg_type {109PS3_REG_TYPE_SB_OHCI = 3,110PS3_REG_TYPE_SB_EHCI = 4,111PS3_REG_TYPE_SB_GPIO = 5,112};113114int ps3_repository_read_dev_str(unsigned int bus_index,115unsigned int dev_index, const char *dev_str, u64 *value);116int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index,117u64 *dev_id);118int ps3_repository_read_dev_type(unsigned int bus_index,119unsigned int dev_index, enum ps3_dev_type *dev_type);120int ps3_repository_read_dev_intr(unsigned int bus_index,121unsigned int dev_index, unsigned int intr_index,122enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id);123int ps3_repository_read_dev_reg_type(unsigned int bus_index,124unsigned int dev_index, unsigned int reg_index,125enum ps3_reg_type *reg_type);126int ps3_repository_read_dev_reg_addr(unsigned int bus_index,127unsigned int dev_index, unsigned int reg_index, u64 *bus_addr,128u64 *len);129int ps3_repository_read_dev_reg(unsigned int bus_index,130unsigned int dev_index, unsigned int reg_index,131enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len);132133/* repository bus enumerators */134135struct ps3_repository_device {136unsigned int bus_index;137unsigned int dev_index;138enum ps3_bus_type bus_type;139enum ps3_dev_type dev_type;140u64 bus_id;141u64 dev_id;142};143144int ps3_repository_find_device(struct ps3_repository_device *repo);145int ps3_repository_find_device_by_id(struct ps3_repository_device *repo,146u64 bus_id, u64 dev_id);147int ps3_repository_find_devices(enum ps3_bus_type bus_type,148int (*callback)(const struct ps3_repository_device *repo));149int ps3_repository_find_bus(enum ps3_bus_type bus_type, unsigned int from,150unsigned int *bus_index);151int ps3_repository_find_interrupt(const struct ps3_repository_device *repo,152enum ps3_interrupt_type intr_type, unsigned int *interrupt_id);153int ps3_repository_find_reg(const struct ps3_repository_device *repo,154enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len);155156/* repository block device info */157158int ps3_repository_read_stor_dev_port(unsigned int bus_index,159unsigned int dev_index, u64 *port);160int ps3_repository_read_stor_dev_blk_size(unsigned int bus_index,161unsigned int dev_index, u64 *blk_size);162int ps3_repository_read_stor_dev_num_blocks(unsigned int bus_index,163unsigned int dev_index, u64 *num_blocks);164int ps3_repository_read_stor_dev_num_regions(unsigned int bus_index,165unsigned int dev_index, unsigned int *num_regions);166int ps3_repository_read_stor_dev_region_id(unsigned int bus_index,167unsigned int dev_index, unsigned int region_index,168unsigned int *region_id);169int ps3_repository_read_stor_dev_region_size(unsigned int bus_index,170unsigned int dev_index, unsigned int region_index, u64 *region_size);171int ps3_repository_read_stor_dev_region_start(unsigned int bus_index,172unsigned int dev_index, unsigned int region_index, u64 *region_start);173int ps3_repository_read_stor_dev_info(unsigned int bus_index,174unsigned int dev_index, u64 *port, u64 *blk_size,175u64 *num_blocks, unsigned int *num_regions);176int ps3_repository_read_stor_dev_region(unsigned int bus_index,177unsigned int dev_index, unsigned int region_index,178unsigned int *region_id, u64 *region_start, u64 *region_size);179180/* repository logical pu and memory info */181182int ps3_repository_read_num_pu(u64 *num_pu);183int ps3_repository_read_pu_id(unsigned int pu_index, u64 *pu_id);184int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base);185int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size);186int ps3_repository_read_region_total(u64 *region_total);187int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size,188u64 *region_total);189190/* repository pme info */191192int ps3_repository_read_num_be(unsigned int *num_be);193int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id);194int ps3_repository_read_be_id(u64 node_id, u64 *be_id);195int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq);196int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq);197198/* repository performance monitor info */199200int ps3_repository_read_lpm_privileges(unsigned int be_index, u64 *lpar,201u64 *rights);202203/* repository 'Other OS' area */204205int ps3_repository_read_boot_dat_addr(u64 *lpar_addr);206int ps3_repository_read_boot_dat_size(unsigned int *size);207int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size);208209/* repository spu info */210211/**212* enum spu_resource_type - Type of spu resource.213* @spu_resource_type_shared: Logical spu is shared with other partions.214* @spu_resource_type_exclusive: Logical spu is not shared with other partions.215*216* Returned by ps3_repository_read_spu_resource_id().217*/218219enum ps3_spu_resource_type {220PS3_SPU_RESOURCE_TYPE_SHARED = 0,221PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL,222};223224int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved);225int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id);226int ps3_repository_read_spu_resource_id(unsigned int res_index,227enum ps3_spu_resource_type* resource_type, unsigned int *resource_id);228229/* repository vuart info */230231int ps3_repository_read_vuart_av_port(unsigned int *port);232int ps3_repository_read_vuart_sysmgr_port(unsigned int *port);233234#endif235236237