diff --git a/arch/powerpc/platforms/ps3/Makefile b/arch/powerpc/platforms/ps3/Makefile index 1994904f580f5eacb1c196f7f4380d757ffe587e..a0048fcf0866160c48a5e42ea5cff8558324ccc5 100644 --- a/arch/powerpc/platforms/ps3/Makefile +++ b/arch/powerpc/platforms/ps3/Makefile @@ -1,5 +1,6 @@ obj-y += setup.o mm.o time.o hvcall.o htab.o repository.o obj-y += interrupt.o exports.o os-area.o +obj-y += system-bus.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_SPU_BASE) += spu.o diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c index 8fe1769655a326c558b206f7c63a591b23baf76f..a4b5a1bc60f4aa6c5a2c441dff52629a3e2da3bb 100644 --- a/arch/powerpc/platforms/ps3/htab.c +++ b/arch/powerpc/platforms/ps3/htab.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include "platform.h" diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c index 95b128ba9087101a71602a7dab85dc118c5b63e3..bb17283275aa7122aaa4c13d6cd7df99cba968f1 100644 --- a/arch/powerpc/platforms/ps3/interrupt.c +++ b/arch/powerpc/platforms/ps3/interrupt.c @@ -24,7 +24,6 @@ #include #include -#include #include #include "platform.h" diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c index 49c0d010d491d761940bcbcb339f5d3c757cfb2c..42354de3f557e41e16202580181ab6dc160c79a8 100644 --- a/arch/powerpc/platforms/ps3/mm.c +++ b/arch/powerpc/platforms/ps3/mm.c @@ -25,7 +25,6 @@ #include #include #include -#include #include #include "platform.h" diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c index 6d0d2ac39bd8e66a4421032f9459b8acfaf4f0d0..5c3da08bc0c4cac0935379c7d40107ec21fcf69e 100644 --- a/arch/powerpc/platforms/ps3/os-area.c +++ b/arch/powerpc/platforms/ps3/os-area.c @@ -22,7 +22,6 @@ #include #include -#include #include "platform.h" diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h index 23b111bea9d04be32e9da274ae35b930ea18e346..ca04f03305c76751307389bc94329c936a98872d 100644 --- a/arch/powerpc/platforms/ps3/platform.h +++ b/arch/powerpc/platforms/ps3/platform.h @@ -22,6 +22,9 @@ #define _PS3_PLATFORM_H #include +#include + +#include /* htab */ @@ -65,4 +68,152 @@ void ps3_spu_set_platform (void); static inline void ps3_spu_set_platform (void) {} #endif +/* repository bus info */ + +enum ps3_bus_type { + PS3_BUS_TYPE_SB = 4, + PS3_BUS_TYPE_STORAGE = 5, +}; + +enum ps3_dev_type { + PS3_DEV_TYPE_STOR_DISK = TYPE_DISK, /* 0 */ + PS3_DEV_TYPE_SB_GELIC = 3, + PS3_DEV_TYPE_SB_USB = 4, + PS3_DEV_TYPE_STOR_ROM = TYPE_ROM, /* 5 */ + PS3_DEV_TYPE_SB_GPIO = 6, + PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC, /* 14 */ +}; + +int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str, + u64 *value); +int ps3_repository_read_bus_id(unsigned int bus_index, unsigned int *bus_id); +int ps3_repository_read_bus_type(unsigned int bus_index, + enum ps3_bus_type *bus_type); +int ps3_repository_read_bus_num_dev(unsigned int bus_index, + unsigned int *num_dev); + +/* repository bus device info */ + +enum ps3_interrupt_type { + PS3_INTERRUPT_TYPE_EVENT_PORT = 2, + PS3_INTERRUPT_TYPE_SB_OHCI = 3, + PS3_INTERRUPT_TYPE_SB_EHCI = 4, + PS3_INTERRUPT_TYPE_OTHER = 5, +}; + +enum ps3_reg_type { + PS3_REG_TYPE_SB_OHCI = 3, + PS3_REG_TYPE_SB_EHCI = 4, + PS3_REG_TYPE_SB_GPIO = 5, +}; + +int ps3_repository_read_dev_str(unsigned int bus_index, + unsigned int dev_index, const char *dev_str, u64 *value); +int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index, + unsigned int *dev_id); +int ps3_repository_read_dev_type(unsigned int bus_index, + unsigned int dev_index, enum ps3_dev_type *dev_type); +int ps3_repository_read_dev_intr(unsigned int bus_index, + unsigned int dev_index, unsigned int intr_index, + enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id); +int ps3_repository_read_dev_reg_type(unsigned int bus_index, + unsigned int dev_index, unsigned int reg_index, + enum ps3_reg_type *reg_type); +int ps3_repository_read_dev_reg_addr(unsigned int bus_index, + unsigned int dev_index, unsigned int reg_index, u64 *bus_addr, + u64 *len); +int ps3_repository_read_dev_reg(unsigned int bus_index, + unsigned int dev_index, unsigned int reg_index, + enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len); + +/* repository bus enumerators */ + +struct ps3_repository_device { + unsigned int bus_index; + unsigned int dev_index; + struct ps3_device_id did; +}; + +int ps3_repository_find_device(enum ps3_bus_type bus_type, + enum ps3_dev_type dev_type, + const struct ps3_repository_device *start_dev, + struct ps3_repository_device *dev); +static inline int ps3_repository_find_first_device( + enum ps3_bus_type bus_type, enum ps3_dev_type dev_type, + struct ps3_repository_device *dev) +{ + return ps3_repository_find_device(bus_type, dev_type, NULL, dev); +} +int ps3_repository_find_interrupt(const struct ps3_repository_device *dev, + enum ps3_interrupt_type intr_type, unsigned int *interrupt_id); +int ps3_repository_find_reg(const struct ps3_repository_device *dev, + enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len); + +/* repository block device info */ + +int ps3_repository_read_stor_dev_port(unsigned int bus_index, + unsigned int dev_index, u64 *port); +int ps3_repository_read_stor_dev_blk_size(unsigned int bus_index, + unsigned int dev_index, u64 *blk_size); +int ps3_repository_read_stor_dev_num_blocks(unsigned int bus_index, + unsigned int dev_index, u64 *num_blocks); +int ps3_repository_read_stor_dev_num_regions(unsigned int bus_index, + unsigned int dev_index, unsigned int *num_regions); +int ps3_repository_read_stor_dev_region_id(unsigned int bus_index, + unsigned int dev_index, unsigned int region_index, + unsigned int *region_id); +int ps3_repository_read_stor_dev_region_size(unsigned int bus_index, + unsigned int dev_index, unsigned int region_index, u64 *region_size); +int ps3_repository_read_stor_dev_region_start(unsigned int bus_index, + unsigned int dev_index, unsigned int region_index, u64 *region_start); +int ps3_repository_read_stor_dev_info(unsigned int bus_index, + unsigned int dev_index, u64 *port, u64 *blk_size, + u64 *num_blocks, unsigned int *num_regions); +int ps3_repository_read_stor_dev_region(unsigned int bus_index, + unsigned int dev_index, unsigned int region_index, + unsigned int *region_id, u64 *region_start, u64 *region_size); + +/* repository pu and memory info */ + +int ps3_repository_read_num_pu(unsigned int *num_pu); +int ps3_repository_read_ppe_id(unsigned int *pu_index, unsigned int *ppe_id); +int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base); +int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size); +int ps3_repository_read_region_total(u64 *region_total); +int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, + u64 *region_total); + +/* repository pme info */ + +int ps3_repository_read_num_be(unsigned int *num_be); +int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id); +int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq); +int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq); + +/* repository 'Other OS' area */ + +int ps3_repository_read_boot_dat_addr(u64 *lpar_addr); +int ps3_repository_read_boot_dat_size(unsigned int *size); +int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size); + +/* repository spu info */ + +/** + * enum spu_resource_type - Type of spu resource. + * @spu_resource_type_shared: Logical spu is shared with other partions. + * @spu_resource_type_exclusive: Logical spu is not shared with other partions. + * + * Returned by ps3_repository_read_spu_resource_id(). + */ + +enum ps3_spu_resource_type { + PS3_SPU_RESOURCE_TYPE_SHARED = 0, + PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL, +}; + +int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved); +int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id); +int ps3_repository_read_spu_resource_id(unsigned int res_index, + enum ps3_spu_resource_type* resource_type, unsigned int *resource_id); + #endif diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c index 2416bfadec9e33f5ace3331227f319c0adb38b30..ae586a0e5d3f9c75771058b7c22b9279fc8cb237 100644 --- a/arch/powerpc/platforms/ps3/repository.c +++ b/arch/powerpc/platforms/ps3/repository.c @@ -18,9 +18,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include +#include "platform.h" + enum ps3_vendor_id { PS3_VENDOR_ID_NONE = 0, PS3_VENDOR_ID_SONY = 0x8000000000000000UL, diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c index cb91a81352bfbdaae4003e30113a4ec7e0bcd6cf..e62505e1881300e17d5581cde9c0ebc018c56188 100644 --- a/arch/powerpc/platforms/ps3/setup.c +++ b/arch/powerpc/platforms/ps3/setup.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "platform.h" diff --git a/arch/powerpc/platforms/ps3/smp.c b/arch/powerpc/platforms/ps3/smp.c index bde71b0572bd58f4260684c7ad3ec985d1fc5463..6fb887961a6d16128dfb203b9e5b18a5dbfc686d 100644 --- a/arch/powerpc/platforms/ps3/smp.c +++ b/arch/powerpc/platforms/ps3/smp.c @@ -23,7 +23,6 @@ #include #include -#include #include "platform.h" diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c index 9f6edc58568df495ca57c576678b5572f2b84ae6..d1929721b0e47be7d868b64e07443190605616f3 100644 --- a/arch/powerpc/platforms/ps3/spu.c +++ b/arch/powerpc/platforms/ps3/spu.c @@ -26,9 +26,10 @@ #include #include -#include #include +#include "platform.h" + /* spu_management_ops */ /** diff --git a/drivers/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c similarity index 99% rename from drivers/ps3/system-bus.c rename to arch/powerpc/platforms/ps3/system-bus.c index 468bdbcc722cfa44371df6c7f5d4d0af4ffffdb7..9f2c6a909e4dacabf7ef6ebe2b698e03ccbf5263 100644 --- a/drivers/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c @@ -25,10 +25,11 @@ #include #include -#include #include #include +#include "platform.h" + #define dump_mmio_region(_a) _dump_mmio_region(_a, __func__, __LINE__) static void _dump_mmio_region(const struct ps3_mmio_region* r, const char* func, int line) @@ -158,7 +159,7 @@ static int ps3_system_bus_remove(struct device *_dev) } struct bus_type ps3_system_bus_type = { - .name = "ps3_system_bus", + .name = "ps3_system_bus", .match = ps3_system_bus_match, .probe = ps3_system_bus_probe, .remove = ps3_system_bus_remove, diff --git a/drivers/ps3/Makefile b/drivers/ps3/Makefile index 8433eb7562cb2c9ceb77e365564e12de90bae8d9..d547cf50ca9dc913a51a0ae2ba52f1e2e2509dd0 100644 --- a/drivers/ps3/Makefile +++ b/drivers/ps3/Makefile @@ -1,2 +1 @@ -obj-y += system-bus.o obj-$(CONFIG_PS3_VUART) += vuart.o diff --git a/include/asm-powerpc/ps3.h b/include/asm-powerpc/ps3.h index 59ae9d7bf6a71589564bff0b4eba66a21def5f92..873aab042c70d40e634050d03c6e3ac46862b4c6 100644 --- a/include/asm-powerpc/ps3.h +++ b/include/asm-powerpc/ps3.h @@ -24,7 +24,6 @@ #include #include #include -#include union ps3_firmware_version { u64 raw; @@ -282,155 +281,6 @@ static inline const char* ps3_result(int result) #endif } -/* repository bus info */ - -enum ps3_bus_type { - PS3_BUS_TYPE_SB = 4, - PS3_BUS_TYPE_STORAGE = 5, -}; - -enum ps3_dev_type { - PS3_DEV_TYPE_STOR_DISK = TYPE_DISK, /* 0 */ - PS3_DEV_TYPE_SB_GELIC = 3, - PS3_DEV_TYPE_SB_USB = 4, - PS3_DEV_TYPE_STOR_ROM = TYPE_ROM, /* 5 */ - PS3_DEV_TYPE_SB_GPIO = 6, - PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC, /* 14 */ -}; - -int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str, - u64 *value); -int ps3_repository_read_bus_id(unsigned int bus_index, unsigned int *bus_id); -int ps3_repository_read_bus_type(unsigned int bus_index, - enum ps3_bus_type *bus_type); -int ps3_repository_read_bus_num_dev(unsigned int bus_index, - unsigned int *num_dev); - -/* repository bus device info */ - -enum ps3_interrupt_type { - PS3_INTERRUPT_TYPE_EVENT_PORT = 2, - PS3_INTERRUPT_TYPE_SB_OHCI = 3, - PS3_INTERRUPT_TYPE_SB_EHCI = 4, - PS3_INTERRUPT_TYPE_OTHER = 5, -}; - -enum ps3_reg_type { - PS3_REG_TYPE_SB_OHCI = 3, - PS3_REG_TYPE_SB_EHCI = 4, - PS3_REG_TYPE_SB_GPIO = 5, -}; - -int ps3_repository_read_dev_str(unsigned int bus_index, - unsigned int dev_index, const char *dev_str, u64 *value); -int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index, - unsigned int *dev_id); -int ps3_repository_read_dev_type(unsigned int bus_index, - unsigned int dev_index, enum ps3_dev_type *dev_type); -int ps3_repository_read_dev_intr(unsigned int bus_index, - unsigned int dev_index, unsigned int intr_index, - enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id); -int ps3_repository_read_dev_reg_type(unsigned int bus_index, - unsigned int dev_index, unsigned int reg_index, - enum ps3_reg_type *reg_type); -int ps3_repository_read_dev_reg_addr(unsigned int bus_index, - unsigned int dev_index, unsigned int reg_index, u64 *bus_addr, - u64 *len); -int ps3_repository_read_dev_reg(unsigned int bus_index, - unsigned int dev_index, unsigned int reg_index, - enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len); - -/* repository bus enumerators */ - -struct ps3_repository_device { - unsigned int bus_index; - unsigned int dev_index; - struct ps3_device_id did; -}; - -int ps3_repository_find_device(enum ps3_bus_type bus_type, - enum ps3_dev_type dev_type, - const struct ps3_repository_device *start_dev, - struct ps3_repository_device *dev); -static inline int ps3_repository_find_first_device( - enum ps3_bus_type bus_type, enum ps3_dev_type dev_type, - struct ps3_repository_device *dev) -{ - return ps3_repository_find_device(bus_type, dev_type, NULL, dev); -} -int ps3_repository_find_interrupt(const struct ps3_repository_device *dev, - enum ps3_interrupt_type intr_type, unsigned int *interrupt_id); -int ps3_repository_find_reg(const struct ps3_repository_device *dev, - enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len); - -/* repository block device info */ - -int ps3_repository_read_stor_dev_port(unsigned int bus_index, - unsigned int dev_index, u64 *port); -int ps3_repository_read_stor_dev_blk_size(unsigned int bus_index, - unsigned int dev_index, u64 *blk_size); -int ps3_repository_read_stor_dev_num_blocks(unsigned int bus_index, - unsigned int dev_index, u64 *num_blocks); -int ps3_repository_read_stor_dev_num_regions(unsigned int bus_index, - unsigned int dev_index, unsigned int *num_regions); -int ps3_repository_read_stor_dev_region_id(unsigned int bus_index, - unsigned int dev_index, unsigned int region_index, - unsigned int *region_id); -int ps3_repository_read_stor_dev_region_size(unsigned int bus_index, - unsigned int dev_index, unsigned int region_index, u64 *region_size); -int ps3_repository_read_stor_dev_region_start(unsigned int bus_index, - unsigned int dev_index, unsigned int region_index, u64 *region_start); -int ps3_repository_read_stor_dev_info(unsigned int bus_index, - unsigned int dev_index, u64 *port, u64 *blk_size, - u64 *num_blocks, unsigned int *num_regions); -int ps3_repository_read_stor_dev_region(unsigned int bus_index, - unsigned int dev_index, unsigned int region_index, - unsigned int *region_id, u64 *region_start, u64 *region_size); - -/* repository pu and memory info */ - -int ps3_repository_read_num_pu(unsigned int *num_pu); -int ps3_repository_read_ppe_id(unsigned int *pu_index, unsigned int *ppe_id); -int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base); -int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size); -int ps3_repository_read_region_total(u64 *region_total); -int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, - u64 *region_total); - -/* repository pme info */ - -int ps3_repository_read_num_be(unsigned int *num_be); -int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id); -int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq); -int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq); - -/* repository 'Other OS' area */ - -int ps3_repository_read_boot_dat_addr(u64 *lpar_addr); -int ps3_repository_read_boot_dat_size(unsigned int *size); -int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size); - -/* repository spu info */ - -/** - * enum spu_resource_type - Type of spu resource. - * @spu_resource_type_shared: Logical spu is shared with other partions. - * @spu_resource_type_exclusive: Logical spu is not shared with other partions. - * - * Returned by ps3_repository_read_spu_resource_id(). - */ - -enum ps3_spu_resource_type { - PS3_SPU_RESOURCE_TYPE_SHARED = 0, - PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL, -}; - -int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved); -int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id); -int ps3_repository_read_spu_resource_id(unsigned int res_index, - enum ps3_spu_resource_type* resource_type, unsigned int *resource_id); - - /* system bus routines */ enum ps3_match_id {