Agenda acpi support in Windows Vista



Yüklə 459 b.
tarix14.10.2017
ölçüsü459 b.
#4558


ACPI In Windows Vista

  • Allen Marshall Lead Program Manager Windows Core Platform Architecture Microsoft Corporation


Agenda

  • ACPI Support in Windows Vista

    • ACPI Version support
    • Machine Role Flags
    • Screen Brightness
    • _OSI
    • Processor Power Management
    • PCI Express
    • ACPI Driver Interface
  • ACPI Test and Debugging

  • Common ACPI Errors



ACPI Support In Windows Overview

  • Windows Vista requires ACPI

    • Non-ACPI HALs are not available in Windows Vista
    • Legacy power management and BIOS configuration implementations are no longer supported
  • Both ACPI and Windows have seen continual advancements

  • ACPI offers significant system advantages

    • Close platform integration with the operating system
    • Greatly increased reliability, diagnosability
  • Windows ACPI support promotes faster system development

    • Rich ACPI feature support
    • Extensive ACPI debugging support
    • ACPI table overload for rapid system bring-up


ACPI Support In Windows Microsoft ASL compiler update

  • Updated ASL compiler now available

    • Version 3.0.0 released
    • Supports ACPI 2.0, 3.0 objects required for Windows Vista
    • Provides several features to facilitate development and debugging
      • Saves ACPI tables from firmware to disk file
      • Un-assembling AML into ASL
      • Loading ACPI tables from disk, bypassing BIOS ROMs
        • See details later in this presentation
    • Available for download from Windows Hardware and Driver Central (WHDC)
      • http://go.microsoft.com/fwlink/?LinkId=66535


ACPI In Windows Vista ACPI version support

  • Windows Vista supports select objects from ACPI 2.0, 3.0 specifications

    • Windows operating systems typically do not support all features of any one version of the ACPI specification
    • Key elements from ACPI are selected to support development of emerging hardware, e.g.
      • PCI Express
      • Mobile dual core processors
      • High Performance Event Timers (HPET)


ACPI In Windows Vista Using RSDT versus XSDT

  • In Windows Vista, if the RSDP Revision field is > 2

    • Windows will use the XSDT in place of the RSDT
    • Windows will calculate the checksum of the entire RSDP
      • Must match the Extended Checksum field
    • Ensure your XSDT address is valid if you report Revision > 2 in the RSDP
  • Leverage the RSDP to support both older and newer operating systems

    • RSDT can point to tables with older version support
    • XSDT points to newer tables


ACPI In Windows Vista FADT implementation details

  • If the FADT Revision field is > 2, Windows Vista will use the extended 64-bit addresses in the FADT

    • X_FIRMWARE_CTRL and X_DSDT
    • Extended addresses of ACPI fixed hardware
      • X_PM1a_EVT_BLK, etc.
  • DSDT Revision field is used to enable ACPI 2.0 and greater interpreter support

    • A Revision > 1 enables interpreter support for ACPI 2.0 and greater
    • All integers are treated as 64-bit in ASL


ACPI In Windows Vista ACPI interpreter support

  • The Windows Vista AML interpreter features expanded implicit source data type conversion

    • Only enabled for a subset of opcodes
      • Index()
      • Two-operand logical operators
    • Introduction of this change is constrained to limit incompatibilities with existing ASL
    • As a best practice, leverage using explicit conversion functions in your ASL to ensure the type correctness, e.g.
      • ToBuffer()
      • ToInteger()
    • See “Debugging type mismatch warnings” in the Backup section of this presentation


ACPI In Windows Vista Screen brightness

  • Laptop LCD brightness controls today are often implemented with proprietary interfaces

    • SMM, Embedded Controller firmware
    • May required 3rd party driver to enable Fn+n hot keys
      • Breaks on OS upgrade
      • No in-box support after clean OS install
      • Not easily debugged
      • OEM code maintenance burden
  • Leveraging ACPI makes tight integration with the operating system easy

    • Simplifies the implementation
    • Reduces development and support costs
    • Enhances reliability
    • Improves customer experience


ACPI In Windows Vista Screen brightness

  • Windows Vista supports the ACPI Appendix B screen brightness objects

    • _BCL, _BCM
  • Screen brightness levels are controlled via Vista power policy

    • When _BCL, _BCM are present
    • Separate brightness levels for each power policy, and for AC and DC


ACPI In Windows Vista Screen brightness

  • Vista provides a temporary override to control brightness

    • Slider control in Windows Mobility Center
  • WMI interface exposed to control screen brightness

    • Get and set the current brightness level
    • Notification on change events
    • Allows for custom controls
    • For details, refer to the white paper
      • “Integrating with Windows Vista Power Management”


ACPI Support In Windows Machine role flags

  • Windows Vista leverages the FADT Preferred_PM_Profile flags

    • Allows platform firmware to indicate to OSPM if the system is mobile, desktop, server, etc.
    • Enables Windows to accurately determine the default power policy for the system
    • Previous Windows operating systems determine a mobile PC based on the presence of a long-term battery
      • Vista falls back to this if Preferred_PM_Profile is 0


ACPI Support In Windows Machine role flags

  • Used throughout Windows Vista to make mobile versus desktop determination

  • Exposed to application software through new Win32 API

    • PowerDeterminePlatformRole()


ACPI Support In Windows Operating system interface

  • _OSI method can be used to determine the version of Windows running on the system

    • Windows Vista string is: “Windows 2006”
    • OS vendor is the only interface string supported by Windows Vista
    • Windows will return “true” for all OS interface levels supported
    • Other _OSI strings
      • Windows 2000: “Windows 2000”
      • Windows XP RTM: “Windows 2001”
      • Windows XP SP1: “Windows 2001 SP1”
      • Windows XP SP2: “Windows 2001 SP2”
      • Windows Server 2003: “Windows 2001.1”
      • Windows Server 2003 SP1: “Windows 2001.1 SP1”


ACPI In Windows Vista Processor power management

  • ACPI 3.0 domain dependency objects

  • For multi-processor systems, these describe any of the relationships between

    • Physical packages
    • Physical cores
    • Logical cores
  • Describes how OSPM must coordinate state transitions

    • Performance states, idle sleep states, throttle states


ACPI In Windows Vista Processor power management

  • Methods supported

    • _PSD (CPU performance state dependency)
    • _TSD (CPU throttle state dependency)
    • _CSD (CPU idle state dependency)
  • C-states on systems with more than one CPU must be hardware coordinated

    • _CSD must report CoordType 0xFE HW_ALL
    • Otherwise, Vista will disable all C-states deeper than C1


ACPI In Windows Vista Processor power management

  • New ACPI 3.0 throttling controls

    • Expand the control interface beyond P_BLK
      • Allows the use of Functional Fixed Hardware address space
      • Accommodates processor architecture-specific controls
    • Allows dynamic throttle states
    • Objects supported
      • _PTC
      • _TSS
      • _TPC
      • _TDC
      • Notify (cpu, 0x82)


ACPI Support In Windows PCI Express

  • Windows Vista requires _OSC on PCI Express root bridges

    • Enables native OS control of PCI Express features
    • Windows will first evaluate _OSC to query for supported capabilities
    • Evaluate _OSC again to assume control
    • Firmware must grant native OS control of all control field feature bits, otherwise Windows takes control of none
      • ASPM
      • Hot plug
      • Power Management Event (PME)
      • Advanced Error Reporting
    • For details, see
      • CPA070 “PCI Express In Depth for Windows Vista”


ACPI Support In Windows PCI Express errata flags

  • Normally, _OSC should control these features

  • Windows Vista will look for FADT flags to globally disable some PCI Express features

    • Message-signaled interrupts
    • Active State Power Management
  • These flags are intended as a temporary, stop-gap mechanism

    • These features are required per spec


ACPI Support In Windows PCI Express FADT errata flags

  • However, as PCI Express development continues, there are a number of systems that fail to work correctly

    • This necessitates a platform firmware override mechanism
  • The need for these flags will diminish as PCI Express chipset development matures

    • Future versions of Windows may require these flags to be clear


ACPI Support In Windows PCI Express and legacy GPE

  • Don’t assert legacy GPE bits when

    • Windows is granted control of PCI Express PME
      • Firmware must not assert legacy GPE to notify OSPM of device wake
    • Windows is granted control of PCI Express Hot Plug
    • If system wakes from PCI Express device, set PCIEXP_WAKE_STS bit in PM1_STS register
      • Required to accurately notify Windows Vista of platform wake source


ACPI Support In Windows Reporting wake sources

  • It is important that platform firmware correctly reports wake sources

    • ACPI Fixed Feature hardware
    • GPE status bits
    • PCI Express device
  • Ensure your GPE handler issues Notify() on appropriate device

    • Otherwise, Windows may misrepresent the system wake source


ACPI Support In Windows Reporting wake sources

  • Windows Vista will log and display system wake sources

    • Available in the system event log
    • Can be viewed with the power command line tool powercfg.exe


ACPI Support In Windows Reporting wake sources

  • Example – system event log entry



ACPI Support In Windows Reporting wake sources

  • Example – system event log wake details



ACPI Support In Windows Reporting wake sources

  • Carefully handle unattended wake events

  • When a machine wakes due to an PME# event or a remote event, BIOS ASL should not issue a Notify(btn, 0x02) to the fixed feature power button in order to wake the monitor

    • This indicates User Present to Windows
    • The power manager will
      • Turn on the display
      • Exit Away Mode, if enabled
      • Apply the current power policy for system idle timeout
    • This can break power management scenarios
      • Consider a Media PC


ACPI Support in Windows ACPI Driver Interface

  • Currently drivers can call

    • IOCTL_ACPI_EVAL_METHOD
    • IOCTL_ACPI_ASYNC_EVAL_METHOD
  • Requires a handle to device you want to evaluate method for

    • No capability to enumerate or evaluate control methods of child devices
    • Workarounds often involve redundant information in namespace


ACPI Support in Windows ACPI Driver Interface

  • Windows does not allow arbitrary execution of control methods

    • Drivers should not evaluate methods on devices they have no knowledge of
      • Breaks rules of encapsulation
      • Leads to system instability
  • Compromise: Allow control method execution on child devices beneath the device handle opened

    • Device should have knowledge of child devices
    • Allows for cleaner BIOS code in the future
      • No need to duplicate information in namespace


ACPI Support In Windows ACPI Driver Interface

  • New IOCTLs to enumerate and evaluate child device control methods

    • IOCTL_ACPI_EVAL_METHOD_EX
    • IOCTL_ACPI_ASYNC_EVAL_METHOD_EX
  • Take an additional “Name” field

    • Relative in namespace to the device you have a handle to
    • Can be arbitrarily deep
    • Support passing/returning 64-bit integers


ACPI Support In Windows ACPI Driver Interface

  • IOCTL_ACPI_ENUM_CHILDREN

    • Allows enumeration of one level, or multi-level
    • Supports passing in a filter
      • Only return specific children
      • e.g., return only children with _STA method
  • Returns back an array of child nodes

    • Flags indicate if a child has descendent


ACPI Support In Windows ECDT Table

  • ECDT – EC Boot Resource Table

    • Provides processor-relative resources of an Embedded Controller
    • Allows EC op region access before the entire namespace has been evaluated
    • Without this table, EC region space is not available until EC device is enumerated
    • Verify by providing a _REG method under the EC
    • Windows Vista will return 2 when _REV is evaluated
      • Indicates firmware should use ECDT


ACPI Test And Debugging Extracting ACPI tables

  • The Microsoft ASL compiler supports exporting ACPI tables and saving them to a disk file

    • Extracted as ASL
    • Tables may be modified, temporarily re-loaded on a system
      • Facilitates development and debugging
      • Intended only as a firmware development aid – not for deployment!
    • Usage


ACPI Test And Debugging Loading ACPI tables

  • Tables may be loaded from the registry instead of from BIOS ROM

    • Requires the checked version of acpi.sys
    • The table to be overloaded must already be present in the system's BIOS ROM
      • For instance, the DSDT can be overloaded
      • If the machine does not have an SSDT, you cannot force an SSDT to be loaded from this registry override mechanism
    • The table with the highest version number will be loaded
      • The table loaded into the registry for testing must have a higher version number than the same table in the BIOS ROM


Common ACPI Errors BIOS using OS memory

  • Windows Vista validates ACPI memory type definitions

    • Microsoft has seen instances of firmware accessing OS memory
    • This is a fatal error
    • Stop 0xA5 (ACPI_BIOS_ERROR)
      • 0x1000
    • Seen when additional memory added to systems
      • Carefully design for top of memory range


Common ACPI Errors BIOS using OS reclaim memory

  • Windows Vista validates ACPI memory type definitions

    • During development, Microsoft discovered instances of table load from ACPI reclaim memory
      • ACPI reclaim memory is available for OS use after ACPI mode has been enabled
      • Problem is that memory operation region is mapped as ACPI reclaim
      • This is incorrect, per the ACPI specification
      • Load opcode was clarified in ACPI 3.0a
    • Common error in example code for handling processor power management capabilities
      • OEMs and system designers should obtain the latest processor power management ACPI reference code from your processor vendor


Common ACPI Errors GPE index out of range

  • Windows Vista validates the index of general-purpose event bits (GPEs)

    • GPE indexes referenced must be within the length of the GPE register blocks
  • Validation failure results in a fatal system error

    • Stop 0xA5 (ACPI_BIOS_ERROR)
      • Subcode 1 = 0x17 ACPI_INVALID_GPE_INDEX
      • Subcode 2 = GPE bit index specified


Common ACPI Errors Memory corruption during sleep

  • During Vista development, BIOS corruptions of the low 1MB of memory were observed across suspend/ resume transitions

  • BIOS developers need to ensure that their code does not have this issue

    • Detect this problem with Driver Verifier


Common ACPI Errors Memory corruption during sleep

  • This check is automatically enabled on checked builds

    • System checksums low 1 MB of memory before, after suspend/resume
      • Corruption results in stop error 0xC4 DRIVER_VERIFIER_DETECTED_VIOLATION
      • Subcode 0xB7 indicates the BIOS has corrupted low physical memory
      • Parameters 2,3,4: Number of corrupt pages, first corrupt page, last corrupt page


Common ACPI Errors Update table versions

  • Be sure to update OEM Revision field in your table headers

    • Windows applies BIOS work-arounds based on this revision
    • Failure to update this revision may result in loss of functionality
      • Example: BIOS known to have problems with PCI Express ASPM has this feature disabled
      • Updated ACPI BIOS corrects the problem, but fails to update OEM Revision in description header
      • Windows will continue to disable this feature


Call To Action

  • Ensure your systems properly support ACPI for Windows Vista

  • Leverage ACPI in place of proprietary solutions wherever possible

  • Test your ACPI implementations using checked builds or with Driver Verifier enabled

  • Take advantage of Microsoft’s ASL compiler and debugger extensions to facilitate ACPI development



Additional Resources

  • Web Resources

    • White papers, other resources http://www.microsoft.com/whdc/system/ pnppwr/powermgmt/default.mspx
    • Microsoft ACPI Source Language (ASL) Compiler v3.00 http://go.microsoft.com/fwlink/?LinkId=66535
    • ACPI Specification: http://www.acpi.info
  • Related Sessions

    • CPA075 Power Management in Windows Vista
    • CPA060 Kernel Plug and Play Support in Windows Vista
    • CPA070 PCI Express in Depth for Windows Vista and Beyond
  • For questions about ACPI in Windows, contact Microsoft at:



Backup PCI Express FADT override flags



Backup ACPI Debugging

  • Debugging Tools for Windows can be used to debug issues with ASL

  • Microsoft provides a kernel debugger extension that enables AML debugging

    • Included with Debugging Tools for Windows
    • Some commands required the checked acpi.sys


Backup ACPI Debugging – Common Commands

  • !amli find

    • Finds all objects in the ACPI namespace with the specified name
  • !amli dns /s

  • !amli u

    • Unassembles the corresponding ACPI method into ASL opcodes
  • !amli lc

    • Lists all the AML contexts currently inside the interpreter; the running context is denoted with a “*” in the beginning of the entry line
  • !amli ds

    • Displays the interpreter stack in the current running context
  • !nsobj

    • Displays namespace object information


Backup ACPI Debugging – Common Commands

  • !amli ln |

    • Unassembles the nearest method to the specified line
  • !amli set

    • Sets a variety of options related to ACPI debugging, such as turning spew on, break on error, break on namespace loading time, etc.
  • !amli [bp | bl | bc | bd | be]

    • Commands that work with AML Breakpoints functioning exactly like the equivalent commands inside regular kd environment
  • !amli [p | t]

    • Steps/traces over a line of AML code
  • !amli r

    • Displays the current context info, including local variables


Backup ACPI Debugging – Example 1

  • Determine why a device is not wake-capable



Backup ACPI Debugging – Example 1



Backup ACPI Debugging – Example 1



Backup ACPI Debugging – Example 2



Backup ACPI Debugging – Example 2



Backup ACPI Debugging – Example 2



Backup Additional ACPI Debugger extensions

  • !acpicache

    • Displays all of the ACPI tables cached by the hardware application layer (HAL)
  • !acpiinf

    • Displays ACPI information such as the location of system tables and the contents of the ACPI fixed feature hardware
  • !acpiirqarb

    • Displays the contents of the ACPI IRQ arbiter structure
  • !fadt

    • Displays the Fixed ACPI Description Table
  • !mapic

    • Displays an ACPI Multiple APIC Table
  • !rsdt

    • Displays the ACPI Root System Description Table


Backup Debugging type mismatch warnings

  • Enable the AML interpreter to break upon error

    • Type mismatches can be caught this way
      • !amli set errbkon
  • Turn on full AML debugging spew

      • !amli set spewon






Yüklə 459 b.

Dostları ilə paylaş:




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə