Date post: | 29-Nov-2014 |
Category: |
Technology |
Upload: | heiko-joerg-schick |
View: | 1,383 times |
Download: | 3 times |
Heiko J Schick <[email protected]> 04/09/23 © 2004 IBM Corporation
Agnostic Device Drivers (ADD)
Concept, Design, and Implementation of a Slimline Boot Firmware for Linux on Power Architecture
IBM Deutschland Entwicklung GmbHSchoenaicherstr. 22071032 Boeblingen
Agnostic Device Drivers
© 2004 IBM Corporation2 Heiko J Schick <[email protected]> 04/09/23
Contents
1. Open Firmware Standard
2. Existing Hardware Abstraction Concepts
3. Agnostic Device Drivers (ADD)
4. Further Opportunities
Agnostic Device Drivers
© 2004 IBM Corporation3 Heiko J Schick <[email protected]> 04/09/23
Is Hardware Abstraction necessary?
Agnostic Device Drivers
© 2004 IBM Corporation4 Heiko J Schick <[email protected]> 04/09/23
Open Firmware Standard
IEEE StandardIEEE Std. 1275-1994 Standard for Boot (Initialization Configuration) Firmware
– Device Interface
– User Interface
– Client Interface
Device-Tree
Operating System
Open Firmware
Low-LevelFirmware
Hardware Hardware
Operating System
BOOT-TIME RUN-TIME
Device-Tree
Agnostic Device Drivers
© 2004 IBM Corporation5 Heiko J Schick <[email protected]> 04/09/23
Existing Hardware Abstraction Concepts(based on Open Firmware)
Operating System
Open Firmware
Low-LevelFirmware
Hardware Hardware
Operating System
BOOT-TIME RUN-TIME
RTAS
Device-TreeRTAS
Open Firmware
Device-Tree
Operating System
Low-LevelFirmware
Hardware Hardware
Operating System
BOOT-TIME RUN-TIME
PE
PE Platform Expert
Platform Expert Code
PEC
PED Platform Expert Data
PED
PEC
PE PEC
PED
Common Hardware Reference Platform: Apple:
Agnostic Device Drivers
© 2004 IBM Corporation6 Heiko J Schick <[email protected]> 04/09/23
Comparison
RTAS Platform Expert
Performance: - ++
Flexibility: - +/-
Packaging: - --
High-Level Language Facilities:
- -
Agnostic Device Drivers
© 2004 IBM Corporation7 Heiko J Schick <[email protected]> 04/09/23
Agnostic Device Drivers (ADD)– Concept and Basics
Operating System
Open Firmware
Low-LevelFirmware
Hardware Hardware
Operating System
BOOT-TIME RUN-TIME
Device-TreeByte-Code
Device-TreeByte-Code
1
ADD -Virtual
Machine
Byte-Code
2
I2CGPIO
3
Agnostic Device Drivers
© 2004 IBM Corporation8 Heiko J Schick <[email protected]> 04/09/23
Agnostic Device Drivers (ADD)– Packaging Options
1: ADD byte-code program taken from Device-Tree– Packaged with the Firmware Code.
– Additional Device-Tree properties can include control or execution information.
2: ADD byte-code program inserted during run-time (via user transaction)– Fast development of ADD byte-code
programs.
– Flexible packaging.
Operating System
Open Firmware
Low-LevelFirmware
Hardware Hardware
Operating System
BOOT-TIME RUN-TIME
AgnosticDeviceDrivers
Front-End1
2
Byte-Code
Byte-Code
Agnostic Device Drivers
© 2004 IBM Corporation9 Heiko J Schick <[email protected]> 04/09/23
Agnostic Device Drivers (ADD)– Virtual Machine
Front-End:Loads Byte-Code (from different sources)
Virtual Machine:Executes ADD Byte-Code
Back-End:Implements I2C and GPIO Binding to the Operating System
Virtual MachineFront-End
ADD byte-code over
Device Driver
ADD byte-code over
Device-Tree
InnerInterpreter
OuterInterpreter
Data Stack
Return Stack Build-InTokens
VendorTokens
LocalTokens
Doers(for Constants,Variables, etc.)
Back-End
Byte-CodeVerifier I2C
Interface
GPIOInterface
Token-Tables
PowerManagment
Agnostic Device Drivers
© 2004 IBM Corporation10 Heiko J Schick <[email protected]> 04/09/23
Agnostic Device Drivers (ADD)– Functionality
Small footprint virtual machine
Controlling of low-bandwidth devices (e.g. I2C or GPIO) is possible
Controlling of the policy and the logic of a device is possible
– Control Structures
– Defining Words
Extended Debug Facilities
– Virtual Machine runs in hosted mode
– Virtual Machine runs as kernel thread (root user can interrupt it)
– I2C Drivers can debugged via I2C Emulation Host Adapter
– Rebooting during development is not necessary
– Single execution is not difficult to implement
Agnostic Device Drivers
© 2004 IBM Corporation11 Heiko J Schick <[email protected]> 04/09/23
Agnostic Device Drivers (ADD)– Summary
RTAS Platform Expert Agnostic Device Drivers
Performance: - ++ ++
Flexibility: - - ++
Packaging: - -- ++
High-Level Language Facilities:
- - ++
Agnostic Device Drivers
© 2004 IBM Corporation12 Heiko J Schick <[email protected]> 04/09/23
Questions ???
Agnostic Device Drivers
© 2004 IBM Corporation13 Heiko J Schick <[email protected]> 04/09/23
Further Opportunities
Real-Time / Performance– ADD is an asynchronous interface / hardware abstraction.
– Functionality can implemented as primitive (for real-time applications).
Scheduling– Scheduling (once, every 5 sec., etc.) can controlled via a Device-Tree property.
– Thread Support is not difficult to implement (instruction pointer and token-table pointer must saved).
Multi-OS– Only vendor token-table entries changed.
ADD Virtual Machine can integrated into the firmware– ADD driver could then used in the firmware and the operating system.
Extended Debug Facilities– Realizes fast program development and debugging.
Agnostic Device Drivers
© 2004 IBM Corporation14 Heiko J Schick <[email protected]> 04/09/23
Agnostic Device Drivers (ADD)– Example: Byte Code
FMT CHKSUM LENGTH0xF1
0xCA 0x05 0x77 0x6F 0x72 0x6C 0x64 0x08
0x00 0xB7 0x12 0x05 0x68 0x65 0x6C 0x6C
0xC20x330x67 0x90 0xA5 0x08 0x00 0x00
add-version1headers
external: world " hello" type 0 exit ;
headers
world
add-end
Header
Defining Words
Local ADD Byte-Code Numbers
Functions
Strings
Agnostic Device Drivers
© 2004 IBM Corporation15 Heiko J Schick <[email protected]> 04/09/23
Agnostic Device Drivers (ADD)– Example: Linux Kernel I2C Interface
I2C algorithm driver used by the I2C bus driver to talk to the I2C bus.
I2C chip driver controls the process of talking to an individual I2C device that lives on an I2C bus.
Adapters /Bus Driver Chip DriverChip DriverChip Driver
AlgorithmDriver
I2C over Parallel PortApple KeywestAMD 8111...
LM75 Temperature SensorEEPROM
i2c_smbus_read_bytei2c_smbus_write_bytei2c_smbus_read_byte_datai2c_smbus_write_byte_datai2c_smbus_read_word_datai2c_smbus_write_word_datai2c_smbus_read_block_datai2c_smbus_write_block_datai2c_smbus_read_i2c_block_datai2c_smbus_write_i2c_block_data
i2c-newi2c-deletei2c-pingi2c-b@i2c-w@i2c-l@i2c-b!i2c-w!i2c-l!
Linux Kernel 2.6 ADD Byte-Code
AgnosticDevice Driver
Agnostic Device Drivers
© 2004 IBM Corporation16 Heiko J Schick <[email protected]> 04/09/23
Overview of available Options – CHRP (Common Hardware Reference Platform)
Based on Open Firmware
RTAS(Run-Time Abstraction Service)Hides machine dependent operations behind a machine independent interface, which the operating system can call synchronous.
System Firmware =LLFW + Open Firmware + RTAS
Operating System
Open Firmware
Low-LevelFirmware
Hardware Hardware
Operating System
BOOT-TIME RUN-TIME
RTAS
Agnostic Device Drivers
© 2004 IBM Corporation17 Heiko J Schick <[email protected]> 04/09/23
Overview of available Options – RPA (RISC Platform Architecture)
Based on CHRP
Hypervisor– partitions machine resources
– enables multiple operating systems
– space for hardware dependent patches
– only one Hypervisor instance exitsfor all operating systems
Partition Firmware =Open Firmware + RTAS
Hypervisor
OperatingSystem
(A)
OpenFirmware
Low-LevelFirmware
Hardware Hardware
Operating System(A)
BOOT-TIME RUN-TIME
RTAS
OpenFirmware
OperatingSystem
(B)
Hypervisor
Operating System(B)
RTAS
Hypervisor
Agnostic Device Drivers
© 2004 IBM Corporation18 Heiko J Schick <[email protected]> 04/09/23
LinuxBIOS
Hardware
Bootstrap / Startup Code
LinuxBIOS
Linux
ADLO
Linux
Bochs Bios
Boot Manager
Operating System(Win2k, BSD, Linux)
ELF Loader ELF Loader
Boot Manageror OpenBIOS
Linux Kernel(over Ethernet or
raw disk i/o)
Linux
Linux Kernel
ELF Loader
Linux Kernel
Linux Kernel
ELF Loader
kexec, LOBOS,2 kernel monte
T
T
O
T
T
T
O optional
T transient
Agnostic Device Drivers
© 2004 IBM Corporation19 Heiko J Schick <[email protected]> 04/09/23
OpenBIOS
MaintainerStefan Reinauer and Patrick Mauritz
Main GoalTo get a 100% compliant Open Firmware boot firmware.
Current FunctionOpenBIOS could be executed under a boot manager or LinuxBIOS.
File System SupportSupport adopted from Grub and libhfs.
PPC SupportRudimentary available from the Mac-On-Linux project.
Operating System
OpenBIOS(100% Open Firmware compliant)
Low-LevelFirmware
Hardware Hardware
Operating System
BOOT-TIME RUN-TIME
Agnostic Device Drivers
© 2004 IBM Corporation20 Heiko J Schick <[email protected]> 04/09/23
Complete Boot Process- Phase 1
Phase 1Service Processor
Phase 2Low-Level Firmwareand Open Firmware
Time
IBM JS20 specificHardware initialization
Processor StartupSequence andinitialization of
Processors in SMP Mode
U3 (Memory controller)initialization, inclusive
setup of theElastic Interface
C Program-Code
PPC 970 PPC 970
U3
AMD 8131AMD 8111SIO
PC87417
GbitBCM5704S
Memory
IDE
IDE
Flash
ServiceProcessor
H8 C
Agnostic Device Drivers
© 2004 IBM Corporation21 Heiko J Schick <[email protected]> 04/09/23
Complete Boot Process - Phase 2
Phase 2Low-Level Firmwareand Open Firmware
Phase 3Linux Boot-Process
ClientInterface
Time
createDevice-Tree
I/O setup andinitialization
Configurationsetup
Boot Deviceconfiguration
Network
Harddisk
initiatesOS Boot
C Program-Code
PPC 970 PPC 970
U3
AMD 8131AMD 8111SIO
PC87417
GbitBCM5704S
Memory
IDE
IDE
Flash
ServiceProcessor
H8 C
Agnostic Device Drivers
© 2004 IBM Corporation22 Heiko J Schick <[email protected]> 04/09/23
Complete Boot Process - Phase 3
Phase 2Low-Level Firmwareand Open Firmware
Phase 3Linux Boot-Process
ClientInterface
initiatesOS Boot
Low-LevelSetup
copyDevice-Tree
relocate LinuxKernel from
higher to lowerMemory
(OF is notlonger
available)
Time
Initiate runtimeroutines
C Program-Code
PPC 970 PPC 970
U3
AMD 8131AMD 8111SIO
PC87417
GbitBCM5704S
Memory
IDE
IDE
Flash
ServiceProcessor
H8 C