2006 Sony Computer Entertainment Inc.
Copyright © 2006 Sony Corp.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".
PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE
DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF
SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.
This document illustrates overview of PS3 Linux kernel and it's device drivers.
Linux kernel is running on the top of hypervisor. Devices and other system resources are virtualized and Linux device drivers are created/modified so that they can work with virtualized devices. Fig 1 illustrates structure of Linux Kernel and device drivers.
Fig. 1 Structure of PS3 Linux kernel
Linux kernel can access some devices directly (e.g. USB host controller). Other devices are virtualized by hypervisor and device service is provided via hypervisor call. For example, storage service hypervisor calls are available. See following sections for detail.
PS3 storage devices includes HDD, Blu-ray Disc drive (BD drive) and flash ROM. These devices are connected via CBE’s companion chip. Accessing these devices is performed by dedicated hypervisor calls. These hypervisor calls consist of simple straightforward methods: open, close, read, write, ioctl.Most of all methods are asynchronous, that is, methods will return immediately after call, and then the caller must wait for its completion via other method. These completions are notified by virtualized interrupts. The status of results of these asynchronous methods can be retrieved via the specific hypervisor call. Since the BD drive is basically ATAPI device, Linux can issue ATAPI commands by ioctl. Some of ATAPI commands have been rejected by the hypervisor call because of security issues.
PS3 Linux storage driver is implemented just like the usb storage driver does. That is, the driver behaves as SCSI host controller driver and the storage devices themselves are as SCSI devices. So the HDD is accessed as SCSI disk, like /dev/sda. Because PS3 HDD and flash ROM is not actually SCSI devices, responses of SCSI commands are synthesized by this driver.
Device detection by the hypervisor is asynchronous, that is, there is chance that the hypervisor puts device information after guest OS starts. So guest OSes should wait for hypervisor’s device detection is done. That can be achieved by waiting for special virtual interrupts to notify the completion of hypervisor’s device detection. See the source of the driver to know the details
PS3 Audio hardware can be divided into two part; front end part and back end part.
The front end part is PS3 audio chip itself, the back end consists HDMI driver chip, digital to analog converter for AV Multi interface, Optical Digital Out (IEC60958/SPDIF) device and base clock generators for 44.1KHz/48KHz audio clocks. Front end chip can be controlled by guest OSes through conventional register access. To gain the access of these registers the guest OS must issue dedicated hypervisor and then ioremap. The front end chip has simple structure, which reads(DMAs) PCM data into its buffer and put them out with specified clock and format. No special hardware to support to decode compressed audio, like MP3, is equipped. Unlike AC97, the front end chip does not have volume control. Guest OSes should modify supplying digital PCM audio data into the chip if it wants to volume control.
The back end audio devices are completely controlled by called ‘AV setting driver’. Setting up sample frequency and data format consistently between backend and front end is the role of the AV setting driver. Since the AV setting driver resides behind hypervisor, guest OS should use virtual UART to communicate with it.
The Linux driver for this audio is composed under ALSA driver framework, not OSS.
PS3 has a powerful graphic processing unit with high speed host connection. The GPU is connected to both HDMI and AV multi interface. Although the GPU is connected directly to CBE, no direct access by guest OSes to the GPU is allowed currently. Video mode/format setting is also the role of AV setting driver. PS3 Linux fb driver calls AV setting driver to setup video modes.
Currently X server uses virtual frame buffer to render its image. No hardware acceleration is supported under Linux. See the description above section.
PS3 has built-in giga bit ethernet controller. Unlike conventional PC’s ethernet controllers, it is not PCI device. It is connected to companion chip directly. To access or setup the chip, guest OSes should use dedicated hypervisor call. This controller has its dedicated DMA controller, thus transfer data is automatically sent/received without PPE interventions. There is also dedicated hypervisor call to set up DMAC.
VLAN framework is internally used for the built-in controller. Therefore, conventional VLAN can’t be used. PROMISC network mode is not supported with this controller.
PS3 equips industry standard USB EHCI host controller and its companion OHCI host controllers. Although most USB host controllers are PCI devices, PS3 USB host controller exists in the companion chip. The PCI probe routines of Linux are modified so that PS3 USB host controller can imitate PCI device. After initialization, all operational registers of USB host controllers are directly accessed by PPE, so no modification to original Linux USB host controller driver is needed. PS3 has internal high speed USB hub. The USB ports of PS3 front panel is connected to the hub, not to USB host controller directly. This PCI probe modification would be change later to get better device driver maintainer acceptance.
PS3 game pad has both USB mode and Bluetooth mode.Enabling each mode depends on the timing of pressing PS button, which resides in the center of the pad.
In USB mode, although it almost conforms to USB HID specification, it requires special USB request to enable sending HID data (reports). The generic USB HID driver is modified to support this. Because it is just HID device, information of the device is retrieved by standard HID device node, like /dev/input/js0, /dev/input/event0 and so on. Bluetooth mode is not supported by Linux.
Built-in memory card reader/writer supports Memory Stick, CompactFlash and SD. The controller is a high speed USB device and conforms to USB Mass storage specification. The generic usb mass storage driver of Linux can support this device with no modification. It is connected to root port of the EHCI controller. Because each card slot behaves logical unit (LUN), Linux driver can support these slots simultaneously.
PS3 has built in USB Bluetooth host controller which conforms to Bluetooth host controller interface specification, so generic hci_usb Linux driver can handle the host controller. The controller is high speed USB device and connected to directly internal EHCI root port.
Paring between Bluetooth device and host is maintained per OS basis. That is, paring information at Linux does not propagate Game OS, and vice versa.
Built-in real time clock keeps the wall clock time for PS3 system. Like PC, it is backed up by battery, so it ticks time even if external power is out. RTC value can be retrieved by a hypervisor call, but be never set. PS3 RTC monotonically increases and never rolls back.
PS3 Linux RTC driver supports the standard RTC userland interface /dev/rtc, so that you can use hwclock command to set the difference.
The Linux kernel can be compiled as follows:
$ tar jxf linux-20061110.tar.bz2
$ cd linux-20061110
$ cp arch/powerpc/configs/ps3pf_defconfig .config
$ makeThis generates a kernel image file named vmlinux.
Work is ongoing to improve Linux kernel support for the PS3 by dedicated staff. One goal is to prepare the core platform support, and if possible some key drivers, for submission to kernel maintainers for inclusion in the official kernel.org linux-2.6.20 kernel. A follow up is planned with more drivers for linux-2.6.21.
Since the release of the linux-2.6.16 PS3 support to Linux distributors for use in PS3 release day distributions, there has been continuous work to cleanup the source code, with significant parts completely re-worked to properly interface with appropriate kernel infrastructures. Most Linux kernel development is still toward the core platform support, but the effort is now shifting to prepare device drivers. The plan for drivers is to bring up support for devices in two stages. The first stage is to modify the existing linux-2.6.16 drivers to work with the latest kernel. The second is to re-work the drivers to be acceptable to driver maintainers for inclusion in the official kernel.
Following the public release of the PS3 game console, Linux kernel maintenance for the PS3 will continue publicly. Source code and technical information will be available for public download by Linux enthusiasts.