1 // SPDX-License-Identifier: GPL-2.0-only
3 * PS3 device registration routines.
5 * Copyright (C) 2007 Sony Computer Entertainment Inc.
6 * Copyright 2007 Sony Corp.
9 #include <linux/delay.h>
10 #include <linux/freezer.h>
11 #include <linux/kernel.h>
12 #include <linux/kthread.h>
13 #include <linux/init.h>
14 #include <linux/slab.h>
15 #include <linux/reboot.h>
16 #include <linux/rcuwait.h>
18 #include <asm/firmware.h>
19 #include <asm/lv1call.h>
20 #include <asm/ps3stor.h>
24 static int __init
ps3_register_lpm_devices(void)
29 struct ps3_system_bus_device
*dev
;
31 pr_debug(" -> %s:%d\n", __func__
, __LINE__
);
33 dev
= kzalloc(sizeof(*dev
), GFP_KERNEL
);
37 dev
->match_id
= PS3_MATCH_ID_LPM
;
38 dev
->dev_type
= PS3_DEVICE_TYPE_LPM
;
40 /* The current lpm driver only supports a single BE processor. */
42 result
= ps3_repository_read_be_node_id(0, &dev
->lpm
.node_id
);
45 pr_debug("%s:%d: ps3_repository_read_be_node_id failed \n",
50 result
= ps3_repository_read_lpm_privileges(dev
->lpm
.node_id
, &tmp1
,
54 pr_debug("%s:%d: ps3_repository_read_lpm_privileges failed\n",
59 lv1_get_logical_partition_id(&tmp2
);
62 pr_debug("%s:%d: wrong lpar\n",
68 if (!(dev
->lpm
.rights
& PS3_LPM_RIGHTS_USE_LPM
)) {
69 pr_debug("%s:%d: don't have rights to use lpm\n",
75 pr_debug("%s:%d: pu_id %llu, rights %llu(%llxh)\n",
76 __func__
, __LINE__
, dev
->lpm
.pu_id
, dev
->lpm
.rights
,
79 result
= ps3_repository_read_pu_id(0, &dev
->lpm
.pu_id
);
82 pr_debug("%s:%d: ps3_repository_read_pu_id failed \n",
87 result
= ps3_system_bus_device_register(dev
);
90 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
95 pr_debug(" <- %s:%d\n", __func__
, __LINE__
);
103 pr_debug(" <- %s:%d: failed\n", __func__
, __LINE__
);
108 * ps3_setup_gelic_device - Setup and register a gelic device instance.
110 * Allocates memory for a struct ps3_system_bus_device instance, initialises the
111 * structure members, and registers the device instance with the system bus.
114 static int __init
ps3_setup_gelic_device(
115 const struct ps3_repository_device
*repo
)
119 struct ps3_system_bus_device dev
;
120 struct ps3_dma_region d_region
;
123 pr_debug(" -> %s:%d\n", __func__
, __LINE__
);
125 BUG_ON(repo
->bus_type
!= PS3_BUS_TYPE_SB
);
126 BUG_ON(repo
->dev_type
!= PS3_DEV_TYPE_SB_GELIC
);
128 p
= kzalloc(sizeof(struct layout
), GFP_KERNEL
);
135 p
->dev
.match_id
= PS3_MATCH_ID_GELIC
;
136 p
->dev
.dev_type
= PS3_DEVICE_TYPE_SB
;
137 p
->dev
.bus_id
= repo
->bus_id
;
138 p
->dev
.dev_id
= repo
->dev_id
;
139 p
->dev
.d_region
= &p
->d_region
;
141 result
= ps3_repository_find_interrupt(repo
,
142 PS3_INTERRUPT_TYPE_EVENT_PORT
, &p
->dev
.interrupt_id
);
145 pr_debug("%s:%d ps3_repository_find_interrupt failed\n",
147 goto fail_find_interrupt
;
150 BUG_ON(p
->dev
.interrupt_id
!= 0);
152 result
= ps3_dma_region_init(&p
->dev
, p
->dev
.d_region
, PS3_DMA_64K
,
153 PS3_DMA_OTHER
, NULL
, 0);
156 pr_debug("%s:%d ps3_dma_region_init failed\n",
161 result
= ps3_system_bus_device_register(&p
->dev
);
164 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
166 goto fail_device_register
;
169 pr_debug(" <- %s:%d\n", __func__
, __LINE__
);
172 fail_device_register
:
177 pr_debug(" <- %s:%d: fail.\n", __func__
, __LINE__
);
181 static int __init
ps3_setup_uhc_device(
182 const struct ps3_repository_device
*repo
, enum ps3_match_id match_id
,
183 enum ps3_interrupt_type interrupt_type
, enum ps3_reg_type reg_type
)
187 struct ps3_system_bus_device dev
;
188 struct ps3_dma_region d_region
;
189 struct ps3_mmio_region m_region
;
194 pr_debug(" -> %s:%d\n", __func__
, __LINE__
);
196 BUG_ON(repo
->bus_type
!= PS3_BUS_TYPE_SB
);
197 BUG_ON(repo
->dev_type
!= PS3_DEV_TYPE_SB_USB
);
199 p
= kzalloc(sizeof(struct layout
), GFP_KERNEL
);
206 p
->dev
.match_id
= match_id
;
207 p
->dev
.dev_type
= PS3_DEVICE_TYPE_SB
;
208 p
->dev
.bus_id
= repo
->bus_id
;
209 p
->dev
.dev_id
= repo
->dev_id
;
210 p
->dev
.d_region
= &p
->d_region
;
211 p
->dev
.m_region
= &p
->m_region
;
213 result
= ps3_repository_find_interrupt(repo
,
214 interrupt_type
, &p
->dev
.interrupt_id
);
217 pr_debug("%s:%d ps3_repository_find_interrupt failed\n",
219 goto fail_find_interrupt
;
222 result
= ps3_repository_find_reg(repo
, reg_type
,
226 pr_debug("%s:%d ps3_repository_find_reg failed\n",
231 result
= ps3_dma_region_init(&p
->dev
, p
->dev
.d_region
, PS3_DMA_64K
,
232 PS3_DMA_INTERNAL
, NULL
, 0);
235 pr_debug("%s:%d ps3_dma_region_init failed\n",
240 result
= ps3_mmio_region_init(&p
->dev
, p
->dev
.m_region
, bus_addr
, len
,
244 pr_debug("%s:%d ps3_mmio_region_init failed\n",
249 result
= ps3_system_bus_device_register(&p
->dev
);
252 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
254 goto fail_device_register
;
257 pr_debug(" <- %s:%d\n", __func__
, __LINE__
);
260 fail_device_register
:
267 pr_debug(" <- %s:%d: fail.\n", __func__
, __LINE__
);
271 static int __init
ps3_setup_ehci_device(
272 const struct ps3_repository_device
*repo
)
274 return ps3_setup_uhc_device(repo
, PS3_MATCH_ID_EHCI
,
275 PS3_INTERRUPT_TYPE_SB_EHCI
, PS3_REG_TYPE_SB_EHCI
);
278 static int __init
ps3_setup_ohci_device(
279 const struct ps3_repository_device
*repo
)
281 return ps3_setup_uhc_device(repo
, PS3_MATCH_ID_OHCI
,
282 PS3_INTERRUPT_TYPE_SB_OHCI
, PS3_REG_TYPE_SB_OHCI
);
285 static int __init
ps3_setup_vuart_device(enum ps3_match_id match_id
,
286 unsigned int port_number
)
290 struct ps3_system_bus_device dev
;
293 pr_debug(" -> %s:%d: match_id %u, port %u\n", __func__
, __LINE__
,
294 match_id
, port_number
);
296 p
= kzalloc(sizeof(struct layout
), GFP_KERNEL
);
301 p
->dev
.match_id
= match_id
;
302 p
->dev
.dev_type
= PS3_DEVICE_TYPE_VUART
;
303 p
->dev
.port_number
= port_number
;
305 result
= ps3_system_bus_device_register(&p
->dev
);
308 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
310 goto fail_device_register
;
312 pr_debug(" <- %s:%d\n", __func__
, __LINE__
);
315 fail_device_register
:
317 pr_debug(" <- %s:%d fail\n", __func__
, __LINE__
);
321 static int ps3_setup_storage_dev(const struct ps3_repository_device
*repo
,
322 enum ps3_match_id match_id
)
325 struct ps3_storage_device
*p
;
326 u64 port
, blk_size
, num_blocks
;
327 unsigned int num_regions
, i
;
329 pr_debug(" -> %s:%u: match_id %u\n", __func__
, __LINE__
, match_id
);
331 result
= ps3_repository_read_stor_dev_info(repo
->bus_index
,
332 repo
->dev_index
, &port
,
333 &blk_size
, &num_blocks
,
336 printk(KERN_ERR
"%s:%u: _read_stor_dev_info failed %d\n",
337 __func__
, __LINE__
, result
);
341 pr_debug("%s:%u: (%u:%u:%u): port %llu blk_size %llu num_blocks %llu "
342 "num_regions %u\n", __func__
, __LINE__
, repo
->bus_index
,
343 repo
->dev_index
, repo
->dev_type
, port
, blk_size
, num_blocks
,
346 p
= kzalloc(struct_size(p
, regions
, num_regions
), GFP_KERNEL
);
352 p
->sbd
.match_id
= match_id
;
353 p
->sbd
.dev_type
= PS3_DEVICE_TYPE_SB
;
354 p
->sbd
.bus_id
= repo
->bus_id
;
355 p
->sbd
.dev_id
= repo
->dev_id
;
356 p
->sbd
.d_region
= &p
->dma_region
;
357 p
->blk_size
= blk_size
;
358 p
->num_regions
= num_regions
;
360 result
= ps3_repository_find_interrupt(repo
,
361 PS3_INTERRUPT_TYPE_EVENT_PORT
,
362 &p
->sbd
.interrupt_id
);
364 printk(KERN_ERR
"%s:%u: find_interrupt failed %d\n", __func__
,
367 goto fail_find_interrupt
;
370 for (i
= 0; i
< num_regions
; i
++) {
374 result
= ps3_repository_read_stor_dev_region(repo
->bus_index
,
380 "%s:%u: read_stor_dev_region failed %d\n",
381 __func__
, __LINE__
, result
);
383 goto fail_read_region
;
385 pr_debug("%s:%u: region %u: id %u start %llu size %llu\n",
386 __func__
, __LINE__
, i
, id
, start
, size
);
388 p
->regions
[i
].id
= id
;
389 p
->regions
[i
].start
= start
;
390 p
->regions
[i
].size
= size
;
393 result
= ps3_system_bus_device_register(&p
->sbd
);
395 pr_debug("%s:%u ps3_system_bus_device_register failed\n",
397 goto fail_device_register
;
400 pr_debug(" <- %s:%u\n", __func__
, __LINE__
);
403 fail_device_register
:
408 pr_debug(" <- %s:%u: fail.\n", __func__
, __LINE__
);
412 static int __init
ps3_register_vuart_devices(void)
415 unsigned int port_number
;
417 pr_debug(" -> %s:%d\n", __func__
, __LINE__
);
419 result
= ps3_repository_read_vuart_av_port(&port_number
);
421 port_number
= 0; /* av default */
423 result
= ps3_setup_vuart_device(PS3_MATCH_ID_AV_SETTINGS
, port_number
);
426 result
= ps3_repository_read_vuart_sysmgr_port(&port_number
);
428 port_number
= 2; /* sysmgr default */
430 result
= ps3_setup_vuart_device(PS3_MATCH_ID_SYSTEM_MANAGER
,
434 pr_debug(" <- %s:%d\n", __func__
, __LINE__
);
438 static int __init
ps3_register_sound_devices(void)
442 struct ps3_system_bus_device dev
;
443 struct ps3_dma_region d_region
;
444 struct ps3_mmio_region m_region
;
447 pr_debug(" -> %s:%d\n", __func__
, __LINE__
);
449 p
= kzalloc(sizeof(*p
), GFP_KERNEL
);
453 p
->dev
.match_id
= PS3_MATCH_ID_SOUND
;
454 p
->dev
.dev_type
= PS3_DEVICE_TYPE_IOC0
;
455 p
->dev
.d_region
= &p
->d_region
;
456 p
->dev
.m_region
= &p
->m_region
;
458 result
= ps3_system_bus_device_register(&p
->dev
);
461 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
463 goto fail_device_register
;
465 pr_debug(" <- %s:%d\n", __func__
, __LINE__
);
468 fail_device_register
:
470 pr_debug(" <- %s:%d failed\n", __func__
, __LINE__
);
474 static int __init
ps3_register_graphics_devices(void)
478 struct ps3_system_bus_device dev
;
481 pr_debug(" -> %s:%d\n", __func__
, __LINE__
);
483 p
= kzalloc(sizeof(struct layout
), GFP_KERNEL
);
488 p
->dev
.match_id
= PS3_MATCH_ID_GPU
;
489 p
->dev
.match_sub_id
= PS3_MATCH_SUB_ID_GPU_FB
;
490 p
->dev
.dev_type
= PS3_DEVICE_TYPE_IOC0
;
492 result
= ps3_system_bus_device_register(&p
->dev
);
495 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
497 goto fail_device_register
;
500 pr_debug(" <- %s:%d\n", __func__
, __LINE__
);
503 fail_device_register
:
505 pr_debug(" <- %s:%d failed\n", __func__
, __LINE__
);
509 static int __init
ps3_register_ramdisk_device(void)
513 struct ps3_system_bus_device dev
;
516 pr_debug(" -> %s:%d\n", __func__
, __LINE__
);
518 p
= kzalloc(sizeof(struct layout
), GFP_KERNEL
);
523 p
->dev
.match_id
= PS3_MATCH_ID_GPU
;
524 p
->dev
.match_sub_id
= PS3_MATCH_SUB_ID_GPU_RAMDISK
;
525 p
->dev
.dev_type
= PS3_DEVICE_TYPE_IOC0
;
527 result
= ps3_system_bus_device_register(&p
->dev
);
530 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
532 goto fail_device_register
;
535 pr_debug(" <- %s:%d\n", __func__
, __LINE__
);
538 fail_device_register
:
540 pr_debug(" <- %s:%d failed\n", __func__
, __LINE__
);
545 * ps3_setup_dynamic_device - Setup a dynamic device from the repository
548 static int ps3_setup_dynamic_device(const struct ps3_repository_device
*repo
)
552 switch (repo
->dev_type
) {
553 case PS3_DEV_TYPE_STOR_DISK
:
554 result
= ps3_setup_storage_dev(repo
, PS3_MATCH_ID_STOR_DISK
);
556 /* Some devices are not accessible from the Other OS lpar. */
557 if (result
== -ENODEV
) {
559 pr_debug("%s:%u: not accessible\n", __func__
,
564 pr_debug("%s:%u ps3_setup_storage_dev failed\n",
568 case PS3_DEV_TYPE_STOR_ROM
:
569 result
= ps3_setup_storage_dev(repo
, PS3_MATCH_ID_STOR_ROM
);
571 pr_debug("%s:%u ps3_setup_storage_dev failed\n",
575 case PS3_DEV_TYPE_STOR_FLASH
:
576 result
= ps3_setup_storage_dev(repo
, PS3_MATCH_ID_STOR_FLASH
);
578 pr_debug("%s:%u ps3_setup_storage_dev failed\n",
584 pr_debug("%s:%u: unsupported dev_type %u\n", __func__
, __LINE__
,
592 * ps3_setup_static_device - Setup a static device from the repository
595 static int __init
ps3_setup_static_device(const struct ps3_repository_device
*repo
)
599 switch (repo
->dev_type
) {
600 case PS3_DEV_TYPE_SB_GELIC
:
601 result
= ps3_setup_gelic_device(repo
);
603 pr_debug("%s:%d ps3_setup_gelic_device failed\n",
607 case PS3_DEV_TYPE_SB_USB
:
609 /* Each USB device has both an EHCI and an OHCI HC */
611 result
= ps3_setup_ehci_device(repo
);
614 pr_debug("%s:%d ps3_setup_ehci_device failed\n",
618 result
= ps3_setup_ohci_device(repo
);
621 pr_debug("%s:%d ps3_setup_ohci_device failed\n",
627 return ps3_setup_dynamic_device(repo
);
633 static void ps3_find_and_add_device(u64 bus_id
, u64 dev_id
)
635 struct ps3_repository_device repo
;
637 unsigned int retries
;
641 * On some firmware versions (e.g. 1.90), the device may not show up
642 * in the repository immediately
644 for (retries
= 0; retries
< 10; retries
++) {
645 res
= ps3_repository_find_device_by_id(&repo
, bus_id
, dev_id
);
649 rem
= msleep_interruptible(100);
653 pr_warn("%s:%u: device %llu:%llu not found\n",
654 __func__
, __LINE__
, bus_id
, dev_id
);
659 pr_debug("%s:%u: device %llu:%llu found after %u retries\n",
660 __func__
, __LINE__
, bus_id
, dev_id
, retries
);
662 ps3_setup_dynamic_device(&repo
);
666 #define PS3_NOTIFICATION_DEV_ID ULONG_MAX
667 #define PS3_NOTIFICATION_INTERRUPT_ID 0
669 struct ps3_notification_device
{
670 struct ps3_system_bus_device sbd
;
678 enum ps3_notify_type
{
679 notify_device_ready
= 0,
680 notify_region_probe
= 1,
681 notify_region_update
= 2,
684 struct ps3_notify_cmd
{
685 u64 operation_code
; /* must be zero */
686 u64 event_mask
; /* OR of 1UL << enum ps3_notify_type */
689 struct ps3_notify_event
{
690 u64 event_type
; /* enum ps3_notify_type */
697 static irqreturn_t
ps3_notification_interrupt(int irq
, void *data
)
699 struct ps3_notification_device
*dev
= data
;
703 spin_lock(&dev
->lock
);
704 res
= lv1_storage_get_async_status(PS3_NOTIFICATION_DEV_ID
, &tag
,
707 pr_err("%s:%u: tag mismatch, got %llx, expected %llx\n",
708 __func__
, __LINE__
, tag
, dev
->tag
);
711 pr_err("%s:%u: res %d status 0x%llx\n", __func__
, __LINE__
, res
,
714 pr_debug("%s:%u: completed, status 0x%llx\n", __func__
,
716 dev
->lv1_status
= status
;
718 rcuwait_wake_up(&dev
->wait
);
720 spin_unlock(&dev
->lock
);
724 static int ps3_notification_read_write(struct ps3_notification_device
*dev
,
727 const char *op
= write
? "write" : "read";
731 spin_lock_irqsave(&dev
->lock
, flags
);
732 res
= write
? lv1_storage_write(dev
->sbd
.dev_id
, 0, 0, 1, 0, lpar
,
734 : lv1_storage_read(dev
->sbd
.dev_id
, 0, 0, 1, 0, lpar
,
737 spin_unlock_irqrestore(&dev
->lock
, flags
);
739 pr_err("%s:%u: %s failed %d\n", __func__
, __LINE__
, op
, res
);
742 pr_debug("%s:%u: notification %s issued\n", __func__
, __LINE__
, op
);
744 rcuwait_wait_event(&dev
->wait
, dev
->done
|| kthread_should_stop(), TASK_IDLE
);
746 if (kthread_should_stop())
749 if (dev
->lv1_status
) {
750 pr_err("%s:%u: %s not completed, status 0x%llx\n", __func__
,
751 __LINE__
, op
, dev
->lv1_status
);
754 pr_debug("%s:%u: notification %s completed\n", __func__
, __LINE__
, op
);
759 static struct task_struct
*probe_task
;
762 * ps3_probe_thread - Background repository probing at system startup.
764 * This implementation only supports background probing on a single bus.
765 * It uses the hypervisor's storage device notification mechanism to wait until
766 * a storage device is ready. The device notification mechanism uses a
767 * pseudo device to asynchronously notify the guest when storage devices become
768 * ready. The notification device has a block size of 512 bytes.
771 static int ps3_probe_thread(void *data
)
774 struct ps3_notification_device dev
;
777 struct ps3_notify_cmd
*notify_cmd
;
778 struct ps3_notify_event
*notify_event
;
783 pr_debug(" -> %s:%u: kthread started\n", __func__
, __LINE__
);
785 local
= kzalloc(sizeof(*local
), GFP_KERNEL
);
789 lpar
= ps3_mm_phys_to_lpar(__pa(&local
->buf
));
790 notify_cmd
= (struct ps3_notify_cmd
*)&local
->buf
;
791 notify_event
= (struct ps3_notify_event
*)&local
->buf
;
793 /* dummy system bus device */
794 local
->dev
.sbd
.bus_id
= (u64
)data
;
795 local
->dev
.sbd
.dev_id
= PS3_NOTIFICATION_DEV_ID
;
796 local
->dev
.sbd
.interrupt_id
= PS3_NOTIFICATION_INTERRUPT_ID
;
798 res
= lv1_open_device(local
->dev
.sbd
.bus_id
, local
->dev
.sbd
.dev_id
, 0);
800 pr_err("%s:%u: lv1_open_device failed %s\n", __func__
,
801 __LINE__
, ps3_result(res
));
805 res
= ps3_sb_event_receive_port_setup(&local
->dev
.sbd
,
806 PS3_BINDING_CPU_ANY
, &irq
);
808 pr_err("%s:%u: ps3_sb_event_receive_port_setup failed %d\n",
809 __func__
, __LINE__
, res
);
810 goto fail_close_device
;
813 spin_lock_init(&local
->dev
.lock
);
814 rcuwait_init(&local
->dev
.wait
);
816 res
= request_irq(irq
, ps3_notification_interrupt
, 0,
817 "ps3_notification", &local
->dev
);
819 pr_err("%s:%u: request_irq failed %d\n", __func__
, __LINE__
,
821 goto fail_sb_event_receive_port_destroy
;
824 /* Setup and write the request for device notification. */
825 notify_cmd
->operation_code
= 0; /* must be zero */
826 notify_cmd
->event_mask
= 1UL << notify_region_probe
;
828 res
= ps3_notification_read_write(&local
->dev
, lpar
, 1);
833 /* Loop here processing the requested notification events. */
837 memset(notify_event
, 0, sizeof(*notify_event
));
839 res
= ps3_notification_read_write(&local
->dev
, lpar
, 0);
843 pr_debug("%s:%u: notify event type 0x%llx bus id %llu dev id %llu"
844 " type %llu port %llu\n", __func__
, __LINE__
,
845 notify_event
->event_type
, notify_event
->bus_id
,
846 notify_event
->dev_id
, notify_event
->dev_type
,
847 notify_event
->dev_port
);
849 if (notify_event
->event_type
!= notify_region_probe
||
850 notify_event
->bus_id
!= local
->dev
.sbd
.bus_id
) {
851 pr_warn("%s:%u: bad notify_event: event %llu, dev_id %llu, dev_type %llu\n",
852 __func__
, __LINE__
, notify_event
->event_type
,
853 notify_event
->dev_id
, notify_event
->dev_type
);
857 ps3_find_and_add_device(local
->dev
.sbd
.bus_id
,
858 notify_event
->dev_id
);
860 } while (!kthread_should_stop());
863 free_irq(irq
, &local
->dev
);
864 fail_sb_event_receive_port_destroy
:
865 ps3_sb_event_receive_port_destroy(&local
->dev
.sbd
, irq
);
867 lv1_close_device(local
->dev
.sbd
.bus_id
, local
->dev
.sbd
.dev_id
);
873 pr_debug(" <- %s:%u: kthread finished\n", __func__
, __LINE__
);
879 * ps3_stop_probe_thread - Stops the background probe thread.
883 static int ps3_stop_probe_thread(struct notifier_block
*nb
, unsigned long code
,
887 kthread_stop(probe_task
);
891 static struct notifier_block nb
= {
892 .notifier_call
= ps3_stop_probe_thread
896 * ps3_start_probe_thread - Starts the background probe thread.
900 static int __init
ps3_start_probe_thread(enum ps3_bus_type bus_type
)
903 struct task_struct
*task
;
904 struct ps3_repository_device repo
;
906 pr_debug(" -> %s:%d\n", __func__
, __LINE__
);
908 memset(&repo
, 0, sizeof(repo
));
910 repo
.bus_type
= bus_type
;
912 result
= ps3_repository_find_bus(repo
.bus_type
, 0, &repo
.bus_index
);
915 printk(KERN_ERR
"%s: Cannot find bus (%d)\n", __func__
, result
);
919 result
= ps3_repository_read_bus_id(repo
.bus_index
, &repo
.bus_id
);
922 printk(KERN_ERR
"%s: read_bus_id failed %d\n", __func__
,
927 task
= kthread_run(ps3_probe_thread
, (void *)repo
.bus_id
,
928 "ps3-probe-%u", bus_type
);
931 result
= PTR_ERR(task
);
932 printk(KERN_ERR
"%s: kthread_run failed %d\n", __func__
,
938 register_reboot_notifier(&nb
);
940 pr_debug(" <- %s:%d\n", __func__
, __LINE__
);
945 * ps3_register_devices - Probe the system and register devices found.
947 * A device_initcall() routine.
950 static int __init
ps3_register_devices(void)
954 if (!firmware_has_feature(FW_FEATURE_PS3_LV1
))
957 pr_debug(" -> %s:%d\n", __func__
, __LINE__
);
959 /* ps3_repository_dump_bus_info(); */
961 result
= ps3_start_probe_thread(PS3_BUS_TYPE_STORAGE
);
963 ps3_register_vuart_devices();
965 ps3_register_graphics_devices();
967 ps3_repository_find_devices(PS3_BUS_TYPE_SB
, ps3_setup_static_device
);
969 ps3_register_sound_devices();
971 ps3_register_lpm_devices();
973 ps3_register_ramdisk_device();
975 pr_debug(" <- %s:%d\n", __func__
, __LINE__
);
979 device_initcall(ps3_register_devices
);