[POWERPC] PS3: Move system bus to platform directory
authorGeoff Levand <geoffrey.levand@am.sony.com>
Tue, 30 Jan 2007 23:20:27 +0000 (15:20 -0800)
committerPaul Mackerras <paulus@samba.org>
Wed, 7 Feb 2007 03:03:19 +0000 (14:03 +1100)
Move the PS3 system bus routines from drivers/ps3 to
arch/powerpc/platforms/ps3.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
13 files changed:
arch/powerpc/platforms/ps3/Makefile
arch/powerpc/platforms/ps3/htab.c
arch/powerpc/platforms/ps3/interrupt.c
arch/powerpc/platforms/ps3/mm.c
arch/powerpc/platforms/ps3/os-area.c
arch/powerpc/platforms/ps3/platform.h
arch/powerpc/platforms/ps3/repository.c
arch/powerpc/platforms/ps3/setup.c
arch/powerpc/platforms/ps3/smp.c
arch/powerpc/platforms/ps3/spu.c
arch/powerpc/platforms/ps3/system-bus.c [moved from drivers/ps3/system-bus.c with 99% similarity]
drivers/ps3/Makefile
include/asm-powerpc/ps3.h

index 1994904..a0048fc 100644 (file)
@@ -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
index 8fe1769..a4b5a1b 100644 (file)
@@ -23,7 +23,6 @@
 #include <asm/machdep.h>
 #include <asm/lmb.h>
 #include <asm/udbg.h>
-#include <asm/ps3.h>
 #include <asm/lv1call.h>
 
 #include "platform.h"
index 95b128b..bb17283 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <asm/machdep.h>
 #include <asm/udbg.h>
-#include <asm/ps3.h>
 #include <asm/lv1call.h>
 
 #include "platform.h"
index 49c0d01..42354de 100644 (file)
@@ -25,7 +25,6 @@
 #include <asm/firmware.h>
 #include <asm/lmb.h>
 #include <asm/udbg.h>
-#include <asm/ps3.h>
 #include <asm/lv1call.h>
 
 #include "platform.h"
index 6d0d2ac..5c3da08 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/io.h>
 
 #include <asm/lmb.h>
-#include <asm/ps3.h>
 
 #include "platform.h"
 
index 23b111b..ca04f03 100644 (file)
@@ -22,6 +22,9 @@
 #define _PS3_PLATFORM_H
 
 #include <linux/rtc.h>
+#include <scsi/scsi.h>
+
+#include <asm/ps3.h>
 
 /* 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
index 2416bfa..ae586a0 100644 (file)
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <asm/ps3.h>
 #include <asm/lv1call.h>
 
+#include "platform.h"
+
 enum ps3_vendor_id {
        PS3_VENDOR_ID_NONE = 0,
        PS3_VENDOR_ID_SONY = 0x8000000000000000UL,
index cb91a81..e62505e 100644 (file)
@@ -32,7 +32,6 @@
 #include <asm/udbg.h>
 #include <asm/prom.h>
 #include <asm/lv1call.h>
-#include <asm/ps3.h>
 
 #include "platform.h"
 
index bde71b0..6fb8879 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <asm/machdep.h>
 #include <asm/udbg.h>
-#include <asm/ps3.h>
 
 #include "platform.h"
 
index 9f6edc5..d192972 100644 (file)
 
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
-#include <asm/ps3.h>
 #include <asm/lv1call.h>
 
+#include "platform.h"
+
 /* spu_management_ops */
 
 /**
similarity index 99%
rename from drivers/ps3/system-bus.c
rename to arch/powerpc/platforms/ps3/system-bus.c
index 468bdbc..9f2c6a9 100644 (file)
 #include <linux/err.h>
 
 #include <asm/udbg.h>
-#include <asm/ps3.h>
 #include <asm/lv1call.h>
 #include <asm/firmware.h>
 
+#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,
index 8433eb7..d547cf5 100644 (file)
@@ -1,2 +1 @@
-obj-y += system-bus.o
 obj-$(CONFIG_PS3_VUART) += vuart.o
index 59ae9d7..873aab0 100644 (file)
@@ -24,7 +24,6 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/device.h>
-#include <scsi/scsi.h>
 
 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 {