Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Geoff Levand and committed by
Paul Mackerras
2a08ea69 63c2f782

+159 -161
+1
arch/powerpc/platforms/ps3/Makefile
··· 1 1 obj-y += setup.o mm.o time.o hvcall.o htab.o repository.o 2 2 obj-y += interrupt.o exports.o os-area.o 3 + obj-y += system-bus.o 3 4 4 5 obj-$(CONFIG_SMP) += smp.o 5 6 obj-$(CONFIG_SPU_BASE) += spu.o
-1
arch/powerpc/platforms/ps3/htab.c
··· 23 23 #include <asm/machdep.h> 24 24 #include <asm/lmb.h> 25 25 #include <asm/udbg.h> 26 - #include <asm/ps3.h> 27 26 #include <asm/lv1call.h> 28 27 29 28 #include "platform.h"
-1
arch/powerpc/platforms/ps3/interrupt.c
··· 24 24 25 25 #include <asm/machdep.h> 26 26 #include <asm/udbg.h> 27 - #include <asm/ps3.h> 28 27 #include <asm/lv1call.h> 29 28 30 29 #include "platform.h"
-1
arch/powerpc/platforms/ps3/mm.c
··· 25 25 #include <asm/firmware.h> 26 26 #include <asm/lmb.h> 27 27 #include <asm/udbg.h> 28 - #include <asm/ps3.h> 29 28 #include <asm/lv1call.h> 30 29 31 30 #include "platform.h"
-1
arch/powerpc/platforms/ps3/os-area.c
··· 22 22 #include <linux/io.h> 23 23 24 24 #include <asm/lmb.h> 25 - #include <asm/ps3.h> 26 25 27 26 #include "platform.h" 28 27
+151
arch/powerpc/platforms/ps3/platform.h
··· 22 22 #define _PS3_PLATFORM_H 23 23 24 24 #include <linux/rtc.h> 25 + #include <scsi/scsi.h> 26 + 27 + #include <asm/ps3.h> 25 28 26 29 /* htab */ 27 30 ··· 67 64 #else 68 65 static inline void ps3_spu_set_platform (void) {} 69 66 #endif 67 + 68 + /* repository bus info */ 69 + 70 + enum ps3_bus_type { 71 + PS3_BUS_TYPE_SB = 4, 72 + PS3_BUS_TYPE_STORAGE = 5, 73 + }; 74 + 75 + enum ps3_dev_type { 76 + PS3_DEV_TYPE_STOR_DISK = TYPE_DISK, /* 0 */ 77 + PS3_DEV_TYPE_SB_GELIC = 3, 78 + PS3_DEV_TYPE_SB_USB = 4, 79 + PS3_DEV_TYPE_STOR_ROM = TYPE_ROM, /* 5 */ 80 + PS3_DEV_TYPE_SB_GPIO = 6, 81 + PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC, /* 14 */ 82 + }; 83 + 84 + int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str, 85 + u64 *value); 86 + int ps3_repository_read_bus_id(unsigned int bus_index, unsigned int *bus_id); 87 + int ps3_repository_read_bus_type(unsigned int bus_index, 88 + enum ps3_bus_type *bus_type); 89 + int ps3_repository_read_bus_num_dev(unsigned int bus_index, 90 + unsigned int *num_dev); 91 + 92 + /* repository bus device info */ 93 + 94 + enum ps3_interrupt_type { 95 + PS3_INTERRUPT_TYPE_EVENT_PORT = 2, 96 + PS3_INTERRUPT_TYPE_SB_OHCI = 3, 97 + PS3_INTERRUPT_TYPE_SB_EHCI = 4, 98 + PS3_INTERRUPT_TYPE_OTHER = 5, 99 + }; 100 + 101 + enum ps3_reg_type { 102 + PS3_REG_TYPE_SB_OHCI = 3, 103 + PS3_REG_TYPE_SB_EHCI = 4, 104 + PS3_REG_TYPE_SB_GPIO = 5, 105 + }; 106 + 107 + int ps3_repository_read_dev_str(unsigned int bus_index, 108 + unsigned int dev_index, const char *dev_str, u64 *value); 109 + int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index, 110 + unsigned int *dev_id); 111 + int ps3_repository_read_dev_type(unsigned int bus_index, 112 + unsigned int dev_index, enum ps3_dev_type *dev_type); 113 + int ps3_repository_read_dev_intr(unsigned int bus_index, 114 + unsigned int dev_index, unsigned int intr_index, 115 + enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id); 116 + int ps3_repository_read_dev_reg_type(unsigned int bus_index, 117 + unsigned int dev_index, unsigned int reg_index, 118 + enum ps3_reg_type *reg_type); 119 + int ps3_repository_read_dev_reg_addr(unsigned int bus_index, 120 + unsigned int dev_index, unsigned int reg_index, u64 *bus_addr, 121 + u64 *len); 122 + int ps3_repository_read_dev_reg(unsigned int bus_index, 123 + unsigned int dev_index, unsigned int reg_index, 124 + enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len); 125 + 126 + /* repository bus enumerators */ 127 + 128 + struct ps3_repository_device { 129 + unsigned int bus_index; 130 + unsigned int dev_index; 131 + struct ps3_device_id did; 132 + }; 133 + 134 + int ps3_repository_find_device(enum ps3_bus_type bus_type, 135 + enum ps3_dev_type dev_type, 136 + const struct ps3_repository_device *start_dev, 137 + struct ps3_repository_device *dev); 138 + static inline int ps3_repository_find_first_device( 139 + enum ps3_bus_type bus_type, enum ps3_dev_type dev_type, 140 + struct ps3_repository_device *dev) 141 + { 142 + return ps3_repository_find_device(bus_type, dev_type, NULL, dev); 143 + } 144 + int ps3_repository_find_interrupt(const struct ps3_repository_device *dev, 145 + enum ps3_interrupt_type intr_type, unsigned int *interrupt_id); 146 + int ps3_repository_find_reg(const struct ps3_repository_device *dev, 147 + enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len); 148 + 149 + /* repository block device info */ 150 + 151 + int ps3_repository_read_stor_dev_port(unsigned int bus_index, 152 + unsigned int dev_index, u64 *port); 153 + int ps3_repository_read_stor_dev_blk_size(unsigned int bus_index, 154 + unsigned int dev_index, u64 *blk_size); 155 + int ps3_repository_read_stor_dev_num_blocks(unsigned int bus_index, 156 + unsigned int dev_index, u64 *num_blocks); 157 + int ps3_repository_read_stor_dev_num_regions(unsigned int bus_index, 158 + unsigned int dev_index, unsigned int *num_regions); 159 + int ps3_repository_read_stor_dev_region_id(unsigned int bus_index, 160 + unsigned int dev_index, unsigned int region_index, 161 + unsigned int *region_id); 162 + int ps3_repository_read_stor_dev_region_size(unsigned int bus_index, 163 + unsigned int dev_index, unsigned int region_index, u64 *region_size); 164 + int ps3_repository_read_stor_dev_region_start(unsigned int bus_index, 165 + unsigned int dev_index, unsigned int region_index, u64 *region_start); 166 + int ps3_repository_read_stor_dev_info(unsigned int bus_index, 167 + unsigned int dev_index, u64 *port, u64 *blk_size, 168 + u64 *num_blocks, unsigned int *num_regions); 169 + int ps3_repository_read_stor_dev_region(unsigned int bus_index, 170 + unsigned int dev_index, unsigned int region_index, 171 + unsigned int *region_id, u64 *region_start, u64 *region_size); 172 + 173 + /* repository pu and memory info */ 174 + 175 + int ps3_repository_read_num_pu(unsigned int *num_pu); 176 + int ps3_repository_read_ppe_id(unsigned int *pu_index, unsigned int *ppe_id); 177 + int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base); 178 + int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size); 179 + int ps3_repository_read_region_total(u64 *region_total); 180 + int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, 181 + u64 *region_total); 182 + 183 + /* repository pme info */ 184 + 185 + int ps3_repository_read_num_be(unsigned int *num_be); 186 + int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id); 187 + int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq); 188 + int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq); 189 + 190 + /* repository 'Other OS' area */ 191 + 192 + int ps3_repository_read_boot_dat_addr(u64 *lpar_addr); 193 + int ps3_repository_read_boot_dat_size(unsigned int *size); 194 + int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size); 195 + 196 + /* repository spu info */ 197 + 198 + /** 199 + * enum spu_resource_type - Type of spu resource. 200 + * @spu_resource_type_shared: Logical spu is shared with other partions. 201 + * @spu_resource_type_exclusive: Logical spu is not shared with other partions. 202 + * 203 + * Returned by ps3_repository_read_spu_resource_id(). 204 + */ 205 + 206 + enum ps3_spu_resource_type { 207 + PS3_SPU_RESOURCE_TYPE_SHARED = 0, 208 + PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL, 209 + }; 210 + 211 + int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved); 212 + int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id); 213 + int ps3_repository_read_spu_resource_id(unsigned int res_index, 214 + enum ps3_spu_resource_type* resource_type, unsigned int *resource_id); 70 215 71 216 #endif
+2 -1
arch/powerpc/platforms/ps3/repository.c
··· 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 21 - #include <asm/ps3.h> 22 21 #include <asm/lv1call.h> 22 + 23 + #include "platform.h" 23 24 24 25 enum ps3_vendor_id { 25 26 PS3_VENDOR_ID_NONE = 0,
-1
arch/powerpc/platforms/ps3/setup.c
··· 32 32 #include <asm/udbg.h> 33 33 #include <asm/prom.h> 34 34 #include <asm/lv1call.h> 35 - #include <asm/ps3.h> 36 35 37 36 #include "platform.h" 38 37
-1
arch/powerpc/platforms/ps3/smp.c
··· 23 23 24 24 #include <asm/machdep.h> 25 25 #include <asm/udbg.h> 26 - #include <asm/ps3.h> 27 26 28 27 #include "platform.h" 29 28
+2 -1
arch/powerpc/platforms/ps3/spu.c
··· 26 26 27 27 #include <asm/spu.h> 28 28 #include <asm/spu_priv1.h> 29 - #include <asm/ps3.h> 30 29 #include <asm/lv1call.h> 30 + 31 + #include "platform.h" 31 32 32 33 /* spu_management_ops */ 33 34
-1
drivers/ps3/Makefile
··· 1 - obj-y += system-bus.o 2 1 obj-$(CONFIG_PS3_VUART) += vuart.o
+3 -2
drivers/ps3/system-bus.c arch/powerpc/platforms/ps3/system-bus.c
··· 25 25 #include <linux/err.h> 26 26 27 27 #include <asm/udbg.h> 28 - #include <asm/ps3.h> 29 28 #include <asm/lv1call.h> 30 29 #include <asm/firmware.h> 30 + 31 + #include "platform.h" 31 32 32 33 #define dump_mmio_region(_a) _dump_mmio_region(_a, __func__, __LINE__) 33 34 static void _dump_mmio_region(const struct ps3_mmio_region* r, ··· 159 158 } 160 159 161 160 struct bus_type ps3_system_bus_type = { 162 - .name = "ps3_system_bus", 161 + .name = "ps3_system_bus", 163 162 .match = ps3_system_bus_match, 164 163 .probe = ps3_system_bus_probe, 165 164 .remove = ps3_system_bus_remove,
-150
include/asm-powerpc/ps3.h
··· 24 24 #include <linux/init.h> 25 25 #include <linux/types.h> 26 26 #include <linux/device.h> 27 - #include <scsi/scsi.h> 28 27 29 28 union ps3_firmware_version { 30 29 u64 raw; ··· 280 281 return ""; 281 282 #endif 282 283 } 283 - 284 - /* repository bus info */ 285 - 286 - enum ps3_bus_type { 287 - PS3_BUS_TYPE_SB = 4, 288 - PS3_BUS_TYPE_STORAGE = 5, 289 - }; 290 - 291 - enum ps3_dev_type { 292 - PS3_DEV_TYPE_STOR_DISK = TYPE_DISK, /* 0 */ 293 - PS3_DEV_TYPE_SB_GELIC = 3, 294 - PS3_DEV_TYPE_SB_USB = 4, 295 - PS3_DEV_TYPE_STOR_ROM = TYPE_ROM, /* 5 */ 296 - PS3_DEV_TYPE_SB_GPIO = 6, 297 - PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC, /* 14 */ 298 - }; 299 - 300 - int ps3_repository_read_bus_str(unsigned int bus_index, const char *bus_str, 301 - u64 *value); 302 - int ps3_repository_read_bus_id(unsigned int bus_index, unsigned int *bus_id); 303 - int ps3_repository_read_bus_type(unsigned int bus_index, 304 - enum ps3_bus_type *bus_type); 305 - int ps3_repository_read_bus_num_dev(unsigned int bus_index, 306 - unsigned int *num_dev); 307 - 308 - /* repository bus device info */ 309 - 310 - enum ps3_interrupt_type { 311 - PS3_INTERRUPT_TYPE_EVENT_PORT = 2, 312 - PS3_INTERRUPT_TYPE_SB_OHCI = 3, 313 - PS3_INTERRUPT_TYPE_SB_EHCI = 4, 314 - PS3_INTERRUPT_TYPE_OTHER = 5, 315 - }; 316 - 317 - enum ps3_reg_type { 318 - PS3_REG_TYPE_SB_OHCI = 3, 319 - PS3_REG_TYPE_SB_EHCI = 4, 320 - PS3_REG_TYPE_SB_GPIO = 5, 321 - }; 322 - 323 - int ps3_repository_read_dev_str(unsigned int bus_index, 324 - unsigned int dev_index, const char *dev_str, u64 *value); 325 - int ps3_repository_read_dev_id(unsigned int bus_index, unsigned int dev_index, 326 - unsigned int *dev_id); 327 - int ps3_repository_read_dev_type(unsigned int bus_index, 328 - unsigned int dev_index, enum ps3_dev_type *dev_type); 329 - int ps3_repository_read_dev_intr(unsigned int bus_index, 330 - unsigned int dev_index, unsigned int intr_index, 331 - enum ps3_interrupt_type *intr_type, unsigned int *interrupt_id); 332 - int ps3_repository_read_dev_reg_type(unsigned int bus_index, 333 - unsigned int dev_index, unsigned int reg_index, 334 - enum ps3_reg_type *reg_type); 335 - int ps3_repository_read_dev_reg_addr(unsigned int bus_index, 336 - unsigned int dev_index, unsigned int reg_index, u64 *bus_addr, 337 - u64 *len); 338 - int ps3_repository_read_dev_reg(unsigned int bus_index, 339 - unsigned int dev_index, unsigned int reg_index, 340 - enum ps3_reg_type *reg_type, u64 *bus_addr, u64 *len); 341 - 342 - /* repository bus enumerators */ 343 - 344 - struct ps3_repository_device { 345 - unsigned int bus_index; 346 - unsigned int dev_index; 347 - struct ps3_device_id did; 348 - }; 349 - 350 - int ps3_repository_find_device(enum ps3_bus_type bus_type, 351 - enum ps3_dev_type dev_type, 352 - const struct ps3_repository_device *start_dev, 353 - struct ps3_repository_device *dev); 354 - static inline int ps3_repository_find_first_device( 355 - enum ps3_bus_type bus_type, enum ps3_dev_type dev_type, 356 - struct ps3_repository_device *dev) 357 - { 358 - return ps3_repository_find_device(bus_type, dev_type, NULL, dev); 359 - } 360 - int ps3_repository_find_interrupt(const struct ps3_repository_device *dev, 361 - enum ps3_interrupt_type intr_type, unsigned int *interrupt_id); 362 - int ps3_repository_find_reg(const struct ps3_repository_device *dev, 363 - enum ps3_reg_type reg_type, u64 *bus_addr, u64 *len); 364 - 365 - /* repository block device info */ 366 - 367 - int ps3_repository_read_stor_dev_port(unsigned int bus_index, 368 - unsigned int dev_index, u64 *port); 369 - int ps3_repository_read_stor_dev_blk_size(unsigned int bus_index, 370 - unsigned int dev_index, u64 *blk_size); 371 - int ps3_repository_read_stor_dev_num_blocks(unsigned int bus_index, 372 - unsigned int dev_index, u64 *num_blocks); 373 - int ps3_repository_read_stor_dev_num_regions(unsigned int bus_index, 374 - unsigned int dev_index, unsigned int *num_regions); 375 - int ps3_repository_read_stor_dev_region_id(unsigned int bus_index, 376 - unsigned int dev_index, unsigned int region_index, 377 - unsigned int *region_id); 378 - int ps3_repository_read_stor_dev_region_size(unsigned int bus_index, 379 - unsigned int dev_index, unsigned int region_index, u64 *region_size); 380 - int ps3_repository_read_stor_dev_region_start(unsigned int bus_index, 381 - unsigned int dev_index, unsigned int region_index, u64 *region_start); 382 - int ps3_repository_read_stor_dev_info(unsigned int bus_index, 383 - unsigned int dev_index, u64 *port, u64 *blk_size, 384 - u64 *num_blocks, unsigned int *num_regions); 385 - int ps3_repository_read_stor_dev_region(unsigned int bus_index, 386 - unsigned int dev_index, unsigned int region_index, 387 - unsigned int *region_id, u64 *region_start, u64 *region_size); 388 - 389 - /* repository pu and memory info */ 390 - 391 - int ps3_repository_read_num_pu(unsigned int *num_pu); 392 - int ps3_repository_read_ppe_id(unsigned int *pu_index, unsigned int *ppe_id); 393 - int ps3_repository_read_rm_base(unsigned int ppe_id, u64 *rm_base); 394 - int ps3_repository_read_rm_size(unsigned int ppe_id, u64 *rm_size); 395 - int ps3_repository_read_region_total(u64 *region_total); 396 - int ps3_repository_read_mm_info(u64 *rm_base, u64 *rm_size, 397 - u64 *region_total); 398 - 399 - /* repository pme info */ 400 - 401 - int ps3_repository_read_num_be(unsigned int *num_be); 402 - int ps3_repository_read_be_node_id(unsigned int be_index, u64 *node_id); 403 - int ps3_repository_read_tb_freq(u64 node_id, u64 *tb_freq); 404 - int ps3_repository_read_be_tb_freq(unsigned int be_index, u64 *tb_freq); 405 - 406 - /* repository 'Other OS' area */ 407 - 408 - int ps3_repository_read_boot_dat_addr(u64 *lpar_addr); 409 - int ps3_repository_read_boot_dat_size(unsigned int *size); 410 - int ps3_repository_read_boot_dat_info(u64 *lpar_addr, unsigned int *size); 411 - 412 - /* repository spu info */ 413 - 414 - /** 415 - * enum spu_resource_type - Type of spu resource. 416 - * @spu_resource_type_shared: Logical spu is shared with other partions. 417 - * @spu_resource_type_exclusive: Logical spu is not shared with other partions. 418 - * 419 - * Returned by ps3_repository_read_spu_resource_id(). 420 - */ 421 - 422 - enum ps3_spu_resource_type { 423 - PS3_SPU_RESOURCE_TYPE_SHARED = 0, 424 - PS3_SPU_RESOURCE_TYPE_EXCLUSIVE = 0x8000000000000000UL, 425 - }; 426 - 427 - int ps3_repository_read_num_spu_reserved(unsigned int *num_spu_reserved); 428 - int ps3_repository_read_num_spu_resource_id(unsigned int *num_resource_id); 429 - int ps3_repository_read_spu_resource_id(unsigned int res_index, 430 - enum ps3_spu_resource_type* resource_type, unsigned int *resource_id); 431 - 432 284 433 285 /* system bus routines */ 434 286