[POWERPC] PS3: Move system bus to platform directory

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>
This commit is contained in:
Geoff Levand 2007-01-30 15:20:27 -08:00 committed by Paul Mackerras
parent 63c2f782e8
commit 2a08ea69a3
13 changed files with 159 additions and 161 deletions

View 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

View 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"

View File

@ -24,7 +24,6 @@
#include <asm/machdep.h>
#include <asm/udbg.h>
#include <asm/ps3.h>
#include <asm/lv1call.h>
#include "platform.h"

View 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"

View File

@ -22,7 +22,6 @@
#include <linux/io.h>
#include <asm/lmb.h>
#include <asm/ps3.h>
#include "platform.h"

View 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

View File

@ -18,9 +18,10 @@
* 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,

View File

@ -32,7 +32,6 @@
#include <asm/udbg.h>
#include <asm/prom.h>
#include <asm/lv1call.h>
#include <asm/ps3.h>
#include "platform.h"

View File

@ -23,7 +23,6 @@
#include <asm/machdep.h>
#include <asm/udbg.h>
#include <asm/ps3.h>
#include "platform.h"

View File

@ -26,9 +26,10 @@
#include <asm/spu.h>
#include <asm/spu_priv1.h>
#include <asm/ps3.h>
#include <asm/lv1call.h>
#include "platform.h"
/* spu_management_ops */
/**

View File

@ -25,10 +25,11 @@
#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,

View File

@ -1,2 +1 @@
obj-y += system-bus.o
obj-$(CONFIG_PS3_VUART) += vuart.o

View 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 {