Slimline Open Firmware

37
Open Systems Design and Development 2007-09-24 | Heiko J Schick <[email protected]>, Hartmut Penner <[email protected]>, Otto Wohlmuth <[email protected]> LAB: Slimline Open Firmware Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

description

 

Transcript of Slimline Open Firmware

Page 1: Slimline Open Firmware

Open Systems Design and Development

2007-09-24 | Heiko J Schick <[email protected]>, Hartmut Penner <[email protected]>,

Otto Wohlmuth <[email protected]>

LAB: Slimline Open Firmware

Power Architecture Developer Conference ‘07

© 2007 IBM Corporation

Page 2: Slimline Open Firmware

2

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Who we are …

Heiko J SchickSLOF Developer

Open Systems Firmware Development

Hartmut PennerSLOF Architect

Open Systems Firmware Development

Dr. Otto WohlmuthSLOF Godfather ;-)

Page 3: Slimline Open Firmware

3

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Agenda

Open Firmware: De-Facto Industry Standard

Overview of Existing Firmware Implementations

SLOF Overview and Design Principles

SLOF Assets and Platform Support

SLOF Deep Dive

Outlook

Page 4: Slimline Open Firmware

4

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Open Firmware: De-Fact Industry Standard

Loaded and initiated by Low Level Firmware

IEEE 1275 implementation

– Client Interface

– Interface to the OS

– Device Interface

– Creation of device tree– Initialization of IO devices– Boot loader

– User Interface

– Debug Interface ( UART )– NVRAM manipulation

Operating System

Open Firmware

Low-LevelFirmware

Hardware Hardware

Operating System

BOOT-TIME RUN-TIME

Device-Tree

Page 5: Slimline Open Firmware

5

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

OOverview of Existing Firmware Implementations

Page 6: Slimline Open Firmware

6

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

LinuxBIOS1

HardwareHardwareHardwareHardware

LinuxBIOSLinuxBIOSLinuxBIOSLinuxBIOS

Linux DistributionLinux DistributionLinux DistributionLinux Distribution Linux DistributionLinux DistributionLinux DistributionLinux Distribution

Operating SystemOperating System

(e.g. Windows, Unix, Linux, (e.g. Windows, Unix, Linux, OpenSolaris)OpenSolaris)

Operating SystemOperating System

(e.g. Windows, Unix, Linux, (e.g. Windows, Unix, Linux, OpenSolaris)OpenSolaris)

Operating SystemOperating System

(e.g. Windows CE, (e.g. Windows CE, OpenSolaris, Linux)OpenSolaris, Linux)

Operating SystemOperating System

(e.g. Windows CE, (e.g. Windows CE, OpenSolaris, Linux)OpenSolaris, Linux)

Linux KernelLinux KernelLinux KernelLinux Kernel

ELF LoaderELF LoaderELF LoaderELF Loader

Linux KernelLinux KernelLinux KernelLinux Kernel

Linux KernelLinux KernelLinux KernelLinux Kernel

ELF LoaderELF LoaderELF LoaderELF Loader

kexeckexec

ELF LoaderELF LoaderELF LoaderELF Loader ELF LoaderELF LoaderELF LoaderELF Loader

TT

TT

TT Transient OO Optional

Boot ManagerBoot ManagerBoot ManagerBoot Manager OO

Boot Manager orBoot Manager orOpen FirmwareOpen Firmware

Boot Manager orBoot Manager orOpen FirmwareOpen Firmware

Bochs BIOSBochs BIOSBochs BIOSBochs BIOS

ADLOADLOADLOADLO

Bootstrap / Startup CodeBootstrap / Startup CodeBootstrap / Startup CodeBootstrap / Startup Code

Page 7: Slimline Open Firmware

7

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

LinuxBIOS

Source Code under GPL

RAM controller and memory setup

PCI and HyperTransport scan / setup and device enumeration

ELF Loader

Uses a device tree similar data structure

Plans for version 3:– modular design

– easier build process

– flattened device tree support

– ePAPR compliant

2

Page 8: Slimline Open Firmware

8

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

OpenBIOS

Original project scope was to develop an open source Open Firmware implementation.

Project scope changed from writing a free firmware implementation to present most of the available free and open source Open Firmware implementation (“Umbrella Project”).

Page 9: Slimline Open Firmware

9

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

FirmWorks

FirmWorks Open Firmware is a mature, stable, complete Open Firmware implementation that is based on the de-fact IEEE 1275-1994 standard

Source Code under BSD/MIT (commercial licensing available)

Complete Open Firmware

Extensive debugging support - source and assembly language level

Minimal dependencies on external toolchains

Integrated builder, packager, tokenizer

1

Page 10: Slimline Open Firmware

10

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

FirmWorks

Filesystem support – FAT (R/W), ext2 (R/W), ext3 (RO), ISO9660 (RO), JFFS2 (RO)

Network support – TFTP, TCP/IP, DHCP, DNS, HTTP (client and server), telnet (client and server), IPV6, NFS

USB– OHCI, UHCI, EHCI (USB 2.0), Mass storage - e.g. FLASH keys, Keyboards, Serial ports,

Network interfaces, Hubs

Drivers for many common programming interfaces

Graphical Boot and Administration Menu

Support for System Diagnostics

Support for system admin tasks like installation

2

Page 11: Slimline Open Firmware

11

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Open Hack’Ware

Open Hack’Ware is a free Open Firmware emulator intended to be used on PPC machines

Source Code under GPL

It is not a real Open Firmware as it knows nothing about Forth

Emulates the Open Firmware and RTA interface

Emulates some known “interpret” strings to make it able to launch known operating systems

Currently used as the Qemu-PPC firmware

Page 12: Slimline Open Firmware

12

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Extensible Firmware Interface (EFI)

Industry interface specification for x86 and IA64 systems

Interface for an operating system to interact with firmware attributes

Specified in one location (the UEFI Specification)

– Testable

– Current

– Portable

– Extensible and Flexible

Tiano Core

Source Code under GPL

Page 13: Slimline Open Firmware

13

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

AMD Generic Encapsulated Software Architecture (AGESA)

A Wrapper is the translator between the AMD interface and the Host BIOS interface

AGESA code focuses on AMD specific technology

Each AMD block has its own wrapper and must call out through its wrapper to acquire services

Vendor AM D

W rapper

Illegal calls

Vendor

AM DW rapper

W rapper AM D

Page 14: Slimline Open Firmware

14

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

SSlimline Open Firmware

Page 15: Slimline Open Firmware

15

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

What is SLOF ?!?

SLOF |släp|

noun Computing, Firmware

is initialization and boot source code based on the IEEE-1275 standard (also known as the Open Firmware standard).

Page 16: Slimline Open Firmware

16

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

SLOF Overview

Initialization and Boot Firmware for Cell Broadband Engine™ (Cell/B.E.) and PowerPC

Complete Open Firmware implementation which is based on the de-fact IEEE 1275-1994 standard

Source code unter BSD like license

Small size and footprint

Simplicity and Modularity (easy to use and extend)

Boot time optimized

Focus on minimal time to market

1

Page 17: Slimline Open Firmware

17

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

SLOF Overview

Minimal dependencies on external toolchains

Filesystem support– FAT (RO), ext2 (RO), ISO9660 (RO), ROMFS

Network support– TFTP, DHCP, BOOTP

USB– OHCI, Mass storage – e.g. CDROM and Flash drivers,

Keyboards, Hubs

IPMI Keyboard Controller Style Interface (KCS) support

Display device support via x86 emulator and FCode evaluator

Graphical Boot and Administration Menu

2

Page 18: Slimline Open Firmware

18

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Modular Firmware Design

Operating SystemOperating SystemOperating SystemOperating System

Optional VirtualizationOptional VirtualizationOptional VirtualizationOptional Virtualization

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Secondary Boot Optional Secondary Boot LoaderLoader

Optional Secondary Boot Optional Secondary Boot LoaderLoader

Slimline Open Firmware Slimline Open Firmware Slimline Open Firmware Slimline Open Firmware

Low-level FirmwareLow-level FirmwareLow-level FirmwareLow-level Firmware

Operating SystemOperating SystemOperating SystemOperating System

Optional VirtualizationOptional VirtualizationOptional VirtualizationOptional Virtualization

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

BOOT-TIME RUN-TIME

FirmwareTransient Firmware

Page 19: Slimline Open Firmware

19

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Low-level Firmware

Characteristics

Chip & Board Initialization– Hardware dependent

– Support JS2x and Cell/B.E. workstation

Support of Flash Filesystem– 1st stage execution from ROM

– 2nd stage execution from memory

Interface to Open Firmware (SLOF)– Loads Open Firmware into memory

– Transfer of hardware information (e.g. memory size)

Operating SystemOperating SystemOperating SystemOperating System

Optional VirtualizationOptional VirtualizationOptional VirtualizationOptional Virtualization

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Secondary Boot Optional Secondary Boot LoaderLoader

Optional Secondary Boot Optional Secondary Boot LoaderLoader

Slimline Open Firmware Slimline Open Firmware Slimline Open Firmware Slimline Open Firmware

Low-level FirmwareLow-level FirmwareLow-level FirmwareLow-level Firmware

Page 20: Slimline Open Firmware

20

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Slimline Open Firmware

Characteristics

De-facto industry standard for PowerPC and Cell/B.E.

– IEEE Std. 1275-1994: Standard for Boot (Initialization Configuration) Firmware

– Platform Independent

Fast Firmware and Operating System Bring-Up

– Short boot-time

– Small footprint

Fast Prototyping– Interactive user interface

Open Interface– Extendable & adaptable

Operating SystemOperating SystemOperating SystemOperating System

Optional VirtualizationOptional VirtualizationOptional VirtualizationOptional Virtualization

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Secondary Boot Optional Secondary Boot LoaderLoader

Optional Secondary Boot Optional Secondary Boot LoaderLoader

Slimline Open Firmware Slimline Open Firmware Slimline Open Firmware Slimline Open Firmware

Low-level FirmwareLow-level FirmwareLow-level FirmwareLow-level Firmware

Page 21: Slimline Open Firmware

21

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Secondary Boot Loader

Characteristics

Standard Interface– Uses Open Firmware client interface

SLOF internal secondary boot loader

– C runtime

– Device driver infrastructure (modules)

– Easy device driver adaption

Open Source– Yaboot

– GRUB 2

Operating SystemOperating SystemOperating SystemOperating System

Optional VirtualizationOptional VirtualizationOptional VirtualizationOptional Virtualization

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Secondary Boot Optional Secondary Boot LoaderLoader

Optional Secondary Boot Optional Secondary Boot LoaderLoader

Slimline Open Firmware Slimline Open Firmware Slimline Open Firmware Slimline Open Firmware

Low-level FirmwareLow-level FirmwareLow-level FirmwareLow-level Firmware

Page 22: Slimline Open Firmware

22

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Runtime Abstraction Services

Characteristics

Standard Interface– RTAS ABI from OpenPPR

– Standard interface to none standard devices

Hardware Abstraction– Reduces operating systems adaption

Supported Calls– PCI Configuration Cycles

– Reboot, power-off

– RTC access

– Firmware flash update

Operating SystemOperating SystemOperating SystemOperating System

Optional VirtualizationOptional VirtualizationOptional VirtualizationOptional Virtualization

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Runtime Optional Runtime Abstraction ServicesAbstraction Services

Optional Secondary Boot Optional Secondary Boot LoaderLoader

Optional Secondary Boot Optional Secondary Boot LoaderLoader

Slimline Open Firmware Slimline Open Firmware Slimline Open Firmware Slimline Open Firmware

Low-level FirmwareLow-level FirmwareLow-level FirmwareLow-level Firmware

Page 23: Slimline Open Firmware

23

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

SLOF Platform Support

QS2x (Cell/B.E. based blade servers)

CAB (Cell/B.E. Accelerator Board)

JULI Cluster– Firmware for an IBM JS21 cluster.

– Used to exploit PCI Exress and MSIs.

– Native Linux (no Hypervisor).

XEN on PowerPC

SLOF Open Source (IBM JS20)

Bimini (Power.org 970MP Reference Design and Workstation)  

Cell Accelerator Board

IBM Cell Processor Based Blade QS20

IBM BladeServer JS21

Page 24: Slimline Open Firmware

24

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

SSLOF Deep Dive

Page 25: Slimline Open Firmware

25

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

SLOF Code Structure

Low Level Firmware Layer

CPU Init

Mem Init

I/O MMU I/O Sub

Open Firmware Layer

Slimline Open Firmware Forth Engine

Client Interface

RTAS Framework

Loader Framework

JS21Specific RTAS

Service Nano Kernel JS21 Boot Drivers

Boot Protocol Stacks

Device InterfaceUser InterfaceJS20 Specific Code

& Device Tree

JS21 SpecificPPC64 Platform Common

Operating System

JS20 Specific RTAS

JS20 Boot Drivers

JS21 Specific Forth Code& Device Tree

Mem Init

I/O MMU I/O Sub

JS20 Specific

Boot Devices

BoardSB/H8

BoardSouthbridge

Southbridge

Memory

Page 26: Slimline Open Firmware

26

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

SLOF Filesystem Structure

Modules organized in File System – Load based on name

– Replacement of module possible– Addition of modules possible

Customization of FW– Later Addition to base FW

– Open source hypervisor– Operation system– Device code for specific devices

GbE card initFS Ņpci-dev.4711.0815 Ó

XEN

FS ŅXENÓ

RTAS

FS ŅrtasÓ

OFW

FS ŅofwÓ

LLFW

FS ŅllfwÓ

Page 27: Slimline Open Firmware

27

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

PCI Probe Infrastructure

PCI probe code is responsible to setup all devices on PCI bus– Configuration space (BAR registers, interrupt number)

– Create Open Firmware device tree nodes with all

The interface can be found in the following files:

FilenameInterface

NamePurpose

pci-aliases.fs pci-alias Generate aliases for generic device

pci-interrupt.fspci-get-irq-line Calculate IRQ for device

pci-get-irq-sense Calculate IRQ sense for device

pci-device_<vendorid>_<devid>.fsProvide device specific code (if generic setup is not sufficient)

pci-class_<class>.fsProvide class specific setup (if generic setup is not sufficient)

pci-bridge_<vendorid>_<devid>.fsProvide bridge specific setup (if generic setup is not sufficient)

Page 28: Slimline Open Firmware

28

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Display Device Support

The following options are supported to initialize graphic cards within SLOF:– FCode which is stored in the expansion ROM of the device and executed in the FCode

evaluator.

– VESA BIOS Extension 2.0 which is stored in the expansion ROM of the device and executed via a x86 emulator.

– Manually via device or class code specific PCI setup files.

Tested Graphic Adapter Type of Initialization

XGI Volari XP 10 x86 Emulation

NVIDIA 7x00XX x86 Emulation

NVIDIA 6600 GE FCode evaluation

ATI Technologies Inc. ES1000 Manually via device specific file

Page 29: Slimline Open Firmware

29

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

SLOF Environment

Loader Framework / Service Nano KernelRT

AS

Low Level Firmware

System Hardware

Hypervisor (optional)

PPC64 Linux arch tree BPA Linux arch tree

glibc

GCCPPC64 backend BPA backend

libraries

applications

platform

ecosystem

SLOF

RT

AS

LinuxDeviceDrivers

User

Kernel

Firmware

Page 30: Slimline Open Firmware

30

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

SLOF Structure

Service Nano Kernel

Low Level F irm ware

boot protocol stack

m odule interface

device drivers

System H ardware

SLO F

Client interface

Real T

ime A

bstraction Services

L inux

SLOF

lim-inepenirmware

Page 31: Slimline Open Firmware

31

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Open Firmware Client Interface

Allows client programs to access Open Firmware services

Clients loaded by Open Firmware– Operating system

– Boot loader

IEEE 1275 centric interface– Device tree traversal

– Memory handling

– Console I / 0

Call by name Callbacks possible Boot Time

SLO F

C lientCallback 2

Callback 1

set-ca llback Device T ree

Device I/O

M em ory

Control transfer

User interface

System H ardware

ENTRY

nargs nrets

args rets

nam e\0

word1word2

Page 32: Slimline Open Firmware

32

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Runtime Abstraction Services

Encapsulation of HW specifics into machine-independent interface

– Start and stop Threads in SMP configuration

– Display Status indicators

– System Shutdown

– PCI config cycles

– Serial I/O

Instantiated and relocated by User Users must allocate Memory

Call by name Unidirectional Runtime System H ardware

RTAS

SLOFLINUX

Service A Service B Service C

ENTRY

token

nargs nrets

args re ts

Page 33: Slimline Open Firmware

33

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Service Nano Kernel

Client application which can be called before the operating system is invoked

Framework is written in C to contain more complex applications

Can be used for platform tests and experiments

Contains OFW client interface and RTAS access methods

For SLOF it is only used to implement DHCP, TFTP, and ARP

1

Page 34: Slimline Open Firmware

34

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Service Nano Kernel

Usage of other license device drivers from within SNK client

– Network boot

– DHCP / TFTP / ARB

Classical module interface– Entry point at beginning of each

module

– Exchange of function pointer tables

No inter-linkage C ABI

Call by value Bidirectional Boot time

2SN K

SLO F

D riverTX

RX

Kerne lprint

m s_delay

PCI cfg read

PCI cfg write

Boot c lientread

write

M odule In it

Page 35: Slimline Open Firmware

35

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

OOutlook

Page 36: Slimline Open Firmware

36

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation

Outlook

Integration of x86 BIOS emulator for graphic card support

ePAPR compliant firmware stack using SLOF assets

More platforms …

Page 37: Slimline Open Firmware

37

Open Systems Firmware Development

Slimline Open Firmware | Power Architecture Developer Conference ‘07 © 2007 IBM Corporation