SlideShare a Scribd company logo
1 of 16
Download to read offline
ACPI and FreeBSD

Nate Lawson
nate@root.org


Bay Area FreeBSD Users’ Group
May 3, 2006
Overview

• Introduction
   – PC platform and architecture
   – ACPI
• FreeBSD ACPI support
• Challenges and issues
• How you can help
How I got here

• Background in security and cryptography
• Worked on storage security in my day job
   – Built a Fibre Channel encryptor
   – Built a parallel SCSI encryptor
   – Tired of starting anew each time, wrote and committed a SCSI
     target driver framework
• But my laptop wasn’t working so well
• Began working on ACPI in my spare time
   – 4 years later, here I am
PC platform (classic)

       AGP
                 Video
                                              Floppy        Serial
                                Ether   USB
CPU
              Northbridge       Southbridge
                                               Super I/O
                (MCH)              (ICH)
CPU
                                 PCI    ATA
                                                       EC
                 RAM
                                              LPC
      FSB
                         Proprietary
                         (Hypertransport,
                         V-link, etc.)
PC platform (AMD/PCI Express)

        PCIe
                  Video
                                                Floppy        Serial
                                 Ether   USB
  CPU
               Northbridge        Southbridge
                                                 Super I/O
                 (MCH)               (ICH)
  CPU
                                  PCI    ATA
                                                         EC
                  GigE
RAM                          PCIe or
                             CSA
Legacy boot process

• CPU RESET pin triggered, jumps to boot vector
  – Real mode, low memory, etc., just like old DOS days
• BIOS decompressed from flash, executed
  –   Self-tests
  –   Code copied into SMRAM and SMM enabled
  –   Initializes built-in devices and cards in slots
  –   Devices set to initial power states
  –   Finds other CPUs
  –   Sets up RAM tables for OS (e.g., MPtable)
• Loads boot sector and jumps to it
Power management
• Enumerate devices, including hotplug events
   – Location
   – Resources
   – State (on/off/missing)
• Suspend system
   – RAM
   – Disk
   – Power-off
• Power down/up devices based on system activity
   – CPU
   – Internal chipset devices
   – External devices on a bus
• Thermal management
   – Fans
   – Passive cooling
Legacy power management (APM)
• BIOS handles all PM, began with the 386SL
• System management interrupt (SMI) is regularly triggered by device
  activity
• BIOS code running from SMM performs power activity
   – Powers down idle devices
   – Implements suspend/resume
   – Controls device state
• Problems
   – No OS visibility of what BIOS is doing (“but I don’t want it powered down
     now”)
   – Duplicated effort in maintaining large, platform-specific codebase
   – Buggy, especially 32-bit entry points
   – PC-centric (i386 only)
ACPI
• OS and BIOS now share power management
   – OS: policy, drivers, and a few hooks
   – BIOS: delivers the SMI (now SCI) to the OS and provides tables that
     describe what the OS can do
• History
   – Appeared in 1998, not really implemented until 1999
   – Microsoft implementation significantly different from the standard before
     Windows XP (2001)
   – Spec is updated after major platforms ship with the new features
• Problems
   – Platform-specific ACPI devices (acpi_ibm, acpi_toshiba, …) create
     duplicated effort
   – Buggy, especially BIOS interface
   – PC-centric (i386, amd64, ia64)
ACPI operation
• BIOS creates tables on boot
   –   Table of contents (RSDT/XSDT), pointed to by RSDP
   –   DSDT: AML bytecode and device tree
   –   MADT: APIC table for SMP and interrupt routing
   –   FADT: fixed features, superceded by DSDT in many cases
• OS finds tables in memory and activates ACPI
   – Writes special value to SMM code which enables ACPI mode
     and the SCI in particular
   – SCI and SMI are shared, BIOS handles SMI transparently
• OS enumerates devices and config
   – Walks device tree from DSDT
   – Powers up any device the BIOS left off
   – Allocates resources and attaches drivers
AML operation
• DSDT consists of bytecode
• Bytecode describes regions (IO ports, memory-mapped devices),
  objects (containers), methods, and opcodes
• Example:
       OperationRegion (SCPP, SystemIO, 0xB2, 0x01)
       Field (SCPP, ByteAcc, NoLock, Preserve)
       {
           SMIP,   8
       }

       Method (_SB.PCI0._INI, 0, NotSerialized)
       {
           If (STRC (_OS, quot;Microsoft Windowsquot;)) {
               Store (0x56, SMIP)
       }



• OS AML interpreter runs the requested method by interpreting the
  code and reading/writing to memory as it directs
ACPI operation (suspend)

• User presses “sleep” button
• Super I/O gets interrupt on GPIO pin
• EC function raises the SMI/SCI interrupt
• OS EC driver queries EC for event type (sleep pressed)
• OS delivers Notify event to the button driver
• Button driver calls OS-specific GoToSleep function
• OS walks device tree, saving state
• OS executes AML bytecode for requested sleep
  operation (say, _S3)
• Sequence of IO writes causes chipset to enter S3 (STR)
ACPI operation (resume)

• User presses “wake” button
• Super I/O gets interrupt on GPIO pin
• EC raises the SMI/SCI interrupt and signals chipset to
  wake
• BIOS resumes any devices it manages and jumps to OS
  wake vector
• OS walks device tree, restoring state
• OS executes AML bytecode for resume (_WAK)
• OS continues execution of processes
ACPI operation (probe)

• Device tree example:
 Device (PCI0)           Internal PCI   Device (PWRB)   ACPI power button
         Device (USB0)   USB ports      Device (FAN)    ACPI fan
         Device (USB1)                  Device (PCI0)
         Device (USBE)                          Device (LNKA)    PCI irq link
         Device (ICHX)   ATA on-board           Device (LNKB)
                 Device (PRIM)                  ...
                     Device (MAST)              Device (PX40)    Super I/O
                     Device (SLAV)                      Device (SYSR)    IO port resources
                 Device (SECN)                          Device (PIC)     Legacy irq control
                     Device (MAST)                      Device (RTC)     Real-time clock
                     Device (SLAV)                      Device (SPKR)    BIOS speaker
         Device (IDE1)   ATA (dock)                     Device (COPR)    FPU
                 Device (PRIM)                          Device (FDC0)    Floppy
                     Device (DRV0)                      Device (UAR1)    Serial 1
                     Device (DRV1)                      Device (UAR2)    Serial 2
                 Device (SECD)                          Device (IRDA)    Infrared (serial)
                     Device (DRV0)                      Device (LPT1)    Parallel
                     Device (DRV1)                      Device (ECP1)    Parallel (ECP access)
                                                        Device (PS2M)    PS/2 mouse
                                                        Device (PS2K)    PS/2 keyboard
 Continued                                              Device (PSMR)
                                                        Device (PMIO)
FreeBSD history
•   1999
     – First implemented by dfr@
•   2000 - 2001
     – Moved to Intel ACPI-CA interpreter
     – Battery, suspend/resume, and core driver brought in (msmith@, iwasaki@,
       takawata@)
•   2002 - 2003
     – New imports, EC updates, _PxD device power states
     – I stepped too close to the sucking vortex
•   2004
     – rman support
•   2005
     – cpufreq framework implemented
     – CPU-specific drivers for SpeedStep (new, ICH), Powernow, P4TCC, throttling
•   2006
     – acpi_dock (iwasaki@ returns!)
To be continued…

More Related Content

What's hot

Useful USB Gadgets on Linux
Useful USB Gadgets on LinuxUseful USB Gadgets on Linux
Useful USB Gadgets on LinuxGary Bisson
 
Project ACRN system debug
Project ACRN system debugProject ACRN system debug
Project ACRN system debugProject ACRN
 
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203Linaro
 
Redteaming HID attacks
Redteaming HID attacksRedteaming HID attacks
Redteaming HID attacksJuan Espin
 
Project ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introductionProject ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introductionProject ACRN
 
Kernel Features for Reducing Power Consumption on Embedded Devices
Kernel Features for Reducing Power Consumption on Embedded DevicesKernel Features for Reducing Power Consumption on Embedded Devices
Kernel Features for Reducing Power Consumption on Embedded DevicesRyo Jin
 
SR-IOV: The Key Enabling Technology for Fully Virtualized HPC Clusters
SR-IOV: The Key Enabling Technology for Fully Virtualized HPC ClustersSR-IOV: The Key Enabling Technology for Fully Virtualized HPC Clusters
SR-IOV: The Key Enabling Technology for Fully Virtualized HPC ClustersGlenn K. Lockwood
 
Note - (EDK2) Acpi Tables Compile and Install
Note - (EDK2) Acpi Tables Compile and InstallNote - (EDK2) Acpi Tables Compile and Install
Note - (EDK2) Acpi Tables Compile and Installboyw165
 
Debugging linux kernel tools and techniques
Debugging linux kernel tools and  techniquesDebugging linux kernel tools and  techniques
Debugging linux kernel tools and techniquesSatpal Parmar
 
Nvidia’s tegra line of processors for mobile devices2 2
Nvidia’s tegra line of processors for mobile devices2 2Nvidia’s tegra line of processors for mobile devices2 2
Nvidia’s tegra line of processors for mobile devices2 2Sukul Yarraguntla
 
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introductionACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introductionProject ACRN
 
Q2.12: Idling ARMs in a busy world: Linux Power Management for ARM Multiclust...
Q2.12: Idling ARMs in a busy world: Linux Power Management for ARM Multiclust...Q2.12: Idling ARMs in a busy world: Linux Power Management for ARM Multiclust...
Q2.12: Idling ARMs in a busy world: Linux Power Management for ARM Multiclust...Linaro
 
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enablingACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enablingProject ACRN
 
Translation Cache Policies for Dynamic Binary Translation
Translation Cache Policies for Dynamic Binary TranslationTranslation Cache Policies for Dynamic Binary Translation
Translation Cache Policies for Dynamic Binary TranslationSaber Ferjani
 
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...Project ACRN
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Linaro
 

What's hot (20)

Useful USB Gadgets on Linux
Useful USB Gadgets on LinuxUseful USB Gadgets on Linux
Useful USB Gadgets on Linux
 
Project ACRN system debug
Project ACRN system debugProject ACRN system debug
Project ACRN system debug
 
Linux Usb overview
Linux Usb  overviewLinux Usb  overview
Linux Usb overview
 
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
Reliability, Availability, and Serviceability (RAS) on ARM64 status - SFO17-203
 
Redteaming HID attacks
Redteaming HID attacksRedteaming HID attacks
Redteaming HID attacks
 
Project ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introductionProject ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introduction
 
Kernel Features for Reducing Power Consumption on Embedded Devices
Kernel Features for Reducing Power Consumption on Embedded DevicesKernel Features for Reducing Power Consumption on Embedded Devices
Kernel Features for Reducing Power Consumption on Embedded Devices
 
SR-IOV: The Key Enabling Technology for Fully Virtualized HPC Clusters
SR-IOV: The Key Enabling Technology for Fully Virtualized HPC ClustersSR-IOV: The Key Enabling Technology for Fully Virtualized HPC Clusters
SR-IOV: The Key Enabling Technology for Fully Virtualized HPC Clusters
 
Note - (EDK2) Acpi Tables Compile and Install
Note - (EDK2) Acpi Tables Compile and InstallNote - (EDK2) Acpi Tables Compile and Install
Note - (EDK2) Acpi Tables Compile and Install
 
Debugging linux kernel tools and techniques
Debugging linux kernel tools and  techniquesDebugging linux kernel tools and  techniques
Debugging linux kernel tools and techniques
 
Nvidia’s tegra line of processors for mobile devices2 2
Nvidia’s tegra line of processors for mobile devices2 2Nvidia’s tegra line of processors for mobile devices2 2
Nvidia’s tegra line of processors for mobile devices2 2
 
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introductionACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
 
Q2.12: Idling ARMs in a busy world: Linux Power Management for ARM Multiclust...
Q2.12: Idling ARMs in a busy world: Linux Power Management for ARM Multiclust...Q2.12: Idling ARMs in a busy world: Linux Power Management for ARM Multiclust...
Q2.12: Idling ARMs in a busy world: Linux Power Management for ARM Multiclust...
 
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enablingACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
 
Translation Cache Policies for Dynamic Binary Translation
Translation Cache Policies for Dynamic Binary TranslationTranslation Cache Policies for Dynamic Binary Translation
Translation Cache Policies for Dynamic Binary Translation
 
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
 
Agnostic Device Drivers
Agnostic Device DriversAgnostic Device Drivers
Agnostic Device Drivers
 
FPGA Configuration
FPGA ConfigurationFPGA Configuration
FPGA Configuration
 
SR-IOV Introduce
SR-IOV IntroduceSR-IOV Introduce
SR-IOV Introduce
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
 

Viewers also liked

Using FreeBSD to Design a Secure Digital Cinema Server (Usenix 2004)
Using FreeBSD to Design a Secure Digital Cinema Server (Usenix 2004)Using FreeBSD to Design a Secure Digital Cinema Server (Usenix 2004)
Using FreeBSD to Design a Secure Digital Cinema Server (Usenix 2004)Nate Lawson
 
Crypto Strikes Back! (Google 2009)
Crypto Strikes Back! (Google 2009)Crypto Strikes Back! (Google 2009)
Crypto Strikes Back! (Google 2009)Nate Lawson
 
Foundations of Platform Security
Foundations of Platform SecurityFoundations of Platform Security
Foundations of Platform SecurityNate Lawson
 
Copy Protection Wars: Analyzing Retro and Modern Schemes (RSA 2007)
Copy Protection Wars: Analyzing Retro and Modern Schemes (RSA 2007)Copy Protection Wars: Analyzing Retro and Modern Schemes (RSA 2007)
Copy Protection Wars: Analyzing Retro and Modern Schemes (RSA 2007)Nate Lawson
 
When Crypto Attacks! (Yahoo 2009)
When Crypto Attacks! (Yahoo 2009)When Crypto Attacks! (Yahoo 2009)
When Crypto Attacks! (Yahoo 2009)Nate Lawson
 
Highway to Hell: Hacking Toll Systems (Blackhat 2008)
Highway to Hell: Hacking Toll Systems (Blackhat 2008)Highway to Hell: Hacking Toll Systems (Blackhat 2008)
Highway to Hell: Hacking Toll Systems (Blackhat 2008)Nate Lawson
 
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Nate Lawson
 
Designing and Attacking DRM (RSA 2008)
Designing and Attacking DRM (RSA 2008)Designing and Attacking DRM (RSA 2008)
Designing and Attacking DRM (RSA 2008)Nate Lawson
 
TLS Optimization
TLS OptimizationTLS Optimization
TLS OptimizationNate Lawson
 
TLS/SSL MAC security flaw
TLS/SSL MAC security flawTLS/SSL MAC security flaw
TLS/SSL MAC security flawNate Lawson
 
TLS/SSL Protocol Design 201006
TLS/SSL Protocol Design 201006TLS/SSL Protocol Design 201006
TLS/SSL Protocol Design 201006Nate Lawson
 
TLS/SSL Protocol Design
TLS/SSL Protocol DesignTLS/SSL Protocol Design
TLS/SSL Protocol DesignNate Lawson
 

Viewers also liked (12)

Using FreeBSD to Design a Secure Digital Cinema Server (Usenix 2004)
Using FreeBSD to Design a Secure Digital Cinema Server (Usenix 2004)Using FreeBSD to Design a Secure Digital Cinema Server (Usenix 2004)
Using FreeBSD to Design a Secure Digital Cinema Server (Usenix 2004)
 
Crypto Strikes Back! (Google 2009)
Crypto Strikes Back! (Google 2009)Crypto Strikes Back! (Google 2009)
Crypto Strikes Back! (Google 2009)
 
Foundations of Platform Security
Foundations of Platform SecurityFoundations of Platform Security
Foundations of Platform Security
 
Copy Protection Wars: Analyzing Retro and Modern Schemes (RSA 2007)
Copy Protection Wars: Analyzing Retro and Modern Schemes (RSA 2007)Copy Protection Wars: Analyzing Retro and Modern Schemes (RSA 2007)
Copy Protection Wars: Analyzing Retro and Modern Schemes (RSA 2007)
 
When Crypto Attacks! (Yahoo 2009)
When Crypto Attacks! (Yahoo 2009)When Crypto Attacks! (Yahoo 2009)
When Crypto Attacks! (Yahoo 2009)
 
Highway to Hell: Hacking Toll Systems (Blackhat 2008)
Highway to Hell: Hacking Toll Systems (Blackhat 2008)Highway to Hell: Hacking Toll Systems (Blackhat 2008)
Highway to Hell: Hacking Toll Systems (Blackhat 2008)
 
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
 
Designing and Attacking DRM (RSA 2008)
Designing and Attacking DRM (RSA 2008)Designing and Attacking DRM (RSA 2008)
Designing and Attacking DRM (RSA 2008)
 
TLS Optimization
TLS OptimizationTLS Optimization
TLS Optimization
 
TLS/SSL MAC security flaw
TLS/SSL MAC security flawTLS/SSL MAC security flaw
TLS/SSL MAC security flaw
 
TLS/SSL Protocol Design 201006
TLS/SSL Protocol Design 201006TLS/SSL Protocol Design 201006
TLS/SSL Protocol Design 201006
 
TLS/SSL Protocol Design
TLS/SSL Protocol DesignTLS/SSL Protocol Design
TLS/SSL Protocol Design
 

Similar to ACPI and FreeBSD (Part 1)

Project ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN
 
[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practicalMoabi.com
 
emips_overview_apr08
emips_overview_apr08emips_overview_apr08
emips_overview_apr08Neil Pittman
 
Computerhardware 130909042641-
Computerhardware 130909042641-Computerhardware 130909042641-
Computerhardware 130909042641-zeyneptsd
 
Computer Components
Computer ComponentsComputer Components
Computer ComponentsBeth Sockman
 
07. Mainboard (System Board, Motherboard)
07. Mainboard (System Board, Motherboard)07. Mainboard (System Board, Motherboard)
07. Mainboard (System Board, Motherboard)Akhila Dakshina
 
[Hackito2012] Hardware backdooring is practical
[Hackito2012] Hardware backdooring is practical[Hackito2012] Hardware backdooring is practical
[Hackito2012] Hardware backdooring is practicalMoabi.com
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequenceHoucheng Lin
 
Nd0201 systemcomponents internal
Nd0201 systemcomponents internalNd0201 systemcomponents internal
Nd0201 systemcomponents internalPanzer944
 
Hardware backdooring is practical : slides
Hardware backdooring is practical : slidesHardware backdooring is practical : slides
Hardware backdooring is practical : slidesMoabi.com
 
00 Hardware Of Personal Computer V1 1
00 Hardware Of Personal Computer V1 100 Hardware Of Personal Computer V1 1
00 Hardware Of Personal Computer V1 1Rajan Das
 
Chapter 6 input output
Chapter 6 input outputChapter 6 input output
Chapter 6 input outputrisal07
 
Raspberry Pi tutorial
Raspberry Pi tutorialRaspberry Pi tutorial
Raspberry Pi tutorial艾鍗科技
 
PLNOG 13: P. Kupisiewicz, O. Pelerin: Make IOS-XE Troubleshooting Easy – Pack...
PLNOG 13: P. Kupisiewicz, O. Pelerin: Make IOS-XE Troubleshooting Easy – Pack...PLNOG 13: P. Kupisiewicz, O. Pelerin: Make IOS-XE Troubleshooting Easy – Pack...
PLNOG 13: P. Kupisiewicz, O. Pelerin: Make IOS-XE Troubleshooting Easy – Pack...PROIDEA
 
PIC Introduction and explained in detailed
PIC Introduction and explained in detailedPIC Introduction and explained in detailed
PIC Introduction and explained in detailedAnkita Tiwari
 

Similar to ACPI and FreeBSD (Part 1) (20)

1. hardware basics
1. hardware basics1. hardware basics
1. hardware basics
 
101 1.1 hardware settings
101 1.1 hardware settings101 1.1 hardware settings
101 1.1 hardware settings
 
Project ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOS
 
[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical
 
emips_overview_apr08
emips_overview_apr08emips_overview_apr08
emips_overview_apr08
 
XS Boston 2008 Self IO Emulation
XS Boston 2008 Self IO EmulationXS Boston 2008 Self IO Emulation
XS Boston 2008 Self IO Emulation
 
Computerhardware 130909042641-
Computerhardware 130909042641-Computerhardware 130909042641-
Computerhardware 130909042641-
 
Computer Components
Computer ComponentsComputer Components
Computer Components
 
07. Mainboard (System Board, Motherboard)
07. Mainboard (System Board, Motherboard)07. Mainboard (System Board, Motherboard)
07. Mainboard (System Board, Motherboard)
 
[Hackito2012] Hardware backdooring is practical
[Hackito2012] Hardware backdooring is practical[Hackito2012] Hardware backdooring is practical
[Hackito2012] Hardware backdooring is practical
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
 
Nd0201 systemcomponents internal
Nd0201 systemcomponents internalNd0201 systemcomponents internal
Nd0201 systemcomponents internal
 
Hardware backdooring is practical : slides
Hardware backdooring is practical : slidesHardware backdooring is practical : slides
Hardware backdooring is practical : slides
 
00 Hardware Of Personal Computer V1 1
00 Hardware Of Personal Computer V1 100 Hardware Of Personal Computer V1 1
00 Hardware Of Personal Computer V1 1
 
Mother board
Mother boardMother board
Mother board
 
Chap1 chipset
Chap1 chipsetChap1 chipset
Chap1 chipset
 
Chapter 6 input output
Chapter 6 input outputChapter 6 input output
Chapter 6 input output
 
Raspberry Pi tutorial
Raspberry Pi tutorialRaspberry Pi tutorial
Raspberry Pi tutorial
 
PLNOG 13: P. Kupisiewicz, O. Pelerin: Make IOS-XE Troubleshooting Easy – Pack...
PLNOG 13: P. Kupisiewicz, O. Pelerin: Make IOS-XE Troubleshooting Easy – Pack...PLNOG 13: P. Kupisiewicz, O. Pelerin: Make IOS-XE Troubleshooting Easy – Pack...
PLNOG 13: P. Kupisiewicz, O. Pelerin: Make IOS-XE Troubleshooting Easy – Pack...
 
PIC Introduction and explained in detailed
PIC Introduction and explained in detailedPIC Introduction and explained in detailed
PIC Introduction and explained in detailed
 

Recently uploaded

The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceIES VE
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringWSO2
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseWSO2
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingWSO2
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 

Recently uploaded (20)

The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 

ACPI and FreeBSD (Part 1)

  • 1. ACPI and FreeBSD Nate Lawson nate@root.org Bay Area FreeBSD Users’ Group May 3, 2006
  • 2. Overview • Introduction – PC platform and architecture – ACPI • FreeBSD ACPI support • Challenges and issues • How you can help
  • 3. How I got here • Background in security and cryptography • Worked on storage security in my day job – Built a Fibre Channel encryptor – Built a parallel SCSI encryptor – Tired of starting anew each time, wrote and committed a SCSI target driver framework • But my laptop wasn’t working so well • Began working on ACPI in my spare time – 4 years later, here I am
  • 4. PC platform (classic) AGP Video Floppy Serial Ether USB CPU Northbridge Southbridge Super I/O (MCH) (ICH) CPU PCI ATA EC RAM LPC FSB Proprietary (Hypertransport, V-link, etc.)
  • 5. PC platform (AMD/PCI Express) PCIe Video Floppy Serial Ether USB CPU Northbridge Southbridge Super I/O (MCH) (ICH) CPU PCI ATA EC GigE RAM PCIe or CSA
  • 6. Legacy boot process • CPU RESET pin triggered, jumps to boot vector – Real mode, low memory, etc., just like old DOS days • BIOS decompressed from flash, executed – Self-tests – Code copied into SMRAM and SMM enabled – Initializes built-in devices and cards in slots – Devices set to initial power states – Finds other CPUs – Sets up RAM tables for OS (e.g., MPtable) • Loads boot sector and jumps to it
  • 7. Power management • Enumerate devices, including hotplug events – Location – Resources – State (on/off/missing) • Suspend system – RAM – Disk – Power-off • Power down/up devices based on system activity – CPU – Internal chipset devices – External devices on a bus • Thermal management – Fans – Passive cooling
  • 8. Legacy power management (APM) • BIOS handles all PM, began with the 386SL • System management interrupt (SMI) is regularly triggered by device activity • BIOS code running from SMM performs power activity – Powers down idle devices – Implements suspend/resume – Controls device state • Problems – No OS visibility of what BIOS is doing (“but I don’t want it powered down now”) – Duplicated effort in maintaining large, platform-specific codebase – Buggy, especially 32-bit entry points – PC-centric (i386 only)
  • 9. ACPI • OS and BIOS now share power management – OS: policy, drivers, and a few hooks – BIOS: delivers the SMI (now SCI) to the OS and provides tables that describe what the OS can do • History – Appeared in 1998, not really implemented until 1999 – Microsoft implementation significantly different from the standard before Windows XP (2001) – Spec is updated after major platforms ship with the new features • Problems – Platform-specific ACPI devices (acpi_ibm, acpi_toshiba, …) create duplicated effort – Buggy, especially BIOS interface – PC-centric (i386, amd64, ia64)
  • 10. ACPI operation • BIOS creates tables on boot – Table of contents (RSDT/XSDT), pointed to by RSDP – DSDT: AML bytecode and device tree – MADT: APIC table for SMP and interrupt routing – FADT: fixed features, superceded by DSDT in many cases • OS finds tables in memory and activates ACPI – Writes special value to SMM code which enables ACPI mode and the SCI in particular – SCI and SMI are shared, BIOS handles SMI transparently • OS enumerates devices and config – Walks device tree from DSDT – Powers up any device the BIOS left off – Allocates resources and attaches drivers
  • 11. AML operation • DSDT consists of bytecode • Bytecode describes regions (IO ports, memory-mapped devices), objects (containers), methods, and opcodes • Example: OperationRegion (SCPP, SystemIO, 0xB2, 0x01) Field (SCPP, ByteAcc, NoLock, Preserve) { SMIP, 8 } Method (_SB.PCI0._INI, 0, NotSerialized) { If (STRC (_OS, quot;Microsoft Windowsquot;)) { Store (0x56, SMIP) } • OS AML interpreter runs the requested method by interpreting the code and reading/writing to memory as it directs
  • 12. ACPI operation (suspend) • User presses “sleep” button • Super I/O gets interrupt on GPIO pin • EC function raises the SMI/SCI interrupt • OS EC driver queries EC for event type (sleep pressed) • OS delivers Notify event to the button driver • Button driver calls OS-specific GoToSleep function • OS walks device tree, saving state • OS executes AML bytecode for requested sleep operation (say, _S3) • Sequence of IO writes causes chipset to enter S3 (STR)
  • 13. ACPI operation (resume) • User presses “wake” button • Super I/O gets interrupt on GPIO pin • EC raises the SMI/SCI interrupt and signals chipset to wake • BIOS resumes any devices it manages and jumps to OS wake vector • OS walks device tree, restoring state • OS executes AML bytecode for resume (_WAK) • OS continues execution of processes
  • 14. ACPI operation (probe) • Device tree example: Device (PCI0) Internal PCI Device (PWRB) ACPI power button Device (USB0) USB ports Device (FAN) ACPI fan Device (USB1) Device (PCI0) Device (USBE) Device (LNKA) PCI irq link Device (ICHX) ATA on-board Device (LNKB) Device (PRIM) ... Device (MAST) Device (PX40) Super I/O Device (SLAV) Device (SYSR) IO port resources Device (SECN) Device (PIC) Legacy irq control Device (MAST) Device (RTC) Real-time clock Device (SLAV) Device (SPKR) BIOS speaker Device (IDE1) ATA (dock) Device (COPR) FPU Device (PRIM) Device (FDC0) Floppy Device (DRV0) Device (UAR1) Serial 1 Device (DRV1) Device (UAR2) Serial 2 Device (SECD) Device (IRDA) Infrared (serial) Device (DRV0) Device (LPT1) Parallel Device (DRV1) Device (ECP1) Parallel (ECP access) Device (PS2M) PS/2 mouse Device (PS2K) PS/2 keyboard Continued Device (PSMR) Device (PMIO)
  • 15. FreeBSD history • 1999 – First implemented by dfr@ • 2000 - 2001 – Moved to Intel ACPI-CA interpreter – Battery, suspend/resume, and core driver brought in (msmith@, iwasaki@, takawata@) • 2002 - 2003 – New imports, EC updates, _PxD device power states – I stepped too close to the sucking vortex • 2004 – rman support • 2005 – cpufreq framework implemented – CPU-specific drivers for SpeedStep (new, ICH), Powernow, P4TCC, throttling • 2006 – acpi_dock (iwasaki@ returns!)