Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 MSI Micro-Star International. 2 Advanced Configuration and Power Interface Reporter :Wequalwu ACPI.

Similar presentations

Presentation on theme: "1 MSI Micro-Star International. 2 Advanced Configuration and Power Interface Reporter :Wequalwu ACPI."— Presentation transcript:

1 1 MSI Micro-Star International

2 2 Advanced Configuration and Power Interface Reporter :Wequalwu ACPI

3 3 Contents  ACPI Overview  ASL (ACPI Source Language)  ACPI Implementer in AWARD BIOS

4 4 History of Power Management SL technology First seen on the 386SL and still included in all of today’s Pentium and Pentium II processors Operating system had no idea of what the power management BIOS was up to. Advanced Power Management Intel & Microsoft co-developed OS and power management BIOS could now talk to each other No cooperation among system components Add-on components do not participate in power management ACPI (Advanced Configuration and Power Interface) Intel, Toshiba and Microsoft Open industry, all encompassing, PC hardware, operating system and peripheral device interface specifications Primary goal is to let O.S. manage all power activity

5 5 ACPI Introduction 1. industry common interfaces 2. The key element in Operating System-directed configuration and Power Management (OSPM). 3. stretch the limits of current Plug and Play interfaces. 4. more robust, and potentially more efficient manner. 5. collection of power management BIOS code, Advanced Power Management (APM) application programming interfaces (APIs, PNPBIOS APIs, Multiprocessor Specification (MPS) 6. suitable to all classes of computers including (but not limited to) desktop, mobile, workstation, and server machines

6 6 Principal Goals 1. ACPI provides OSPM with direct and exclusive control over the power management and motherboard device configuration functions of a computer. OS plays a central role and uses global information to optimize system behavior. ACPI is the key element in OSPM 2. Enable all computer systems to implement motherboard configuration and power management functions 3. Enhance power management functionality and robustness. 4. Facilitate and accelerate industry-wide implementation of power management. 5. Create a robust interface for configuring motherboard devices.

7 7  System power management  Device power management  Processor power management  Plug and Play  System Events  Battery management  Thermal management  Embedded Controller  SMBus Controller ACPI Function

8 8 Seven Operation Region Types 0 – SystemMemory 1 – SystemIO 2 – PCI_Config 3 – EmbeddedControl 4 – SMBus 5 – CMOS 6 – PCIBARTarget

9 9 OSPM/ACPI Global System

10 10 ACPI run-time components  ACPI Tables  Describe the interfaces to the hardware.  ACPI Registers  The constrained part of the hardware interface, described (at least in location) by the ACPI System Description Tables.  ACPI BIOS  ACPI system firmware.The firmwares boots the machine and compatible with ACPI spec.

11 11 Global System States G Working (System Operational) G Sleeping - no user threads, system looks off G2/S5 --Soft Off G Mechanical off (Physical off switch) Device Power States D3 - Off - Power off to device D2 - Less power than D1 (Depends on device) D1 - Less power than D0 (Depends on Device) D0 - Fully-On Processor Power States C0 - Full power, instructions execute C1 - Processor stopped C2 - Processor stopped, less power than C1 C3 - Processor stopped, caches ignore snoops Sleeping States S0 - system Working S1 - Low Latency Sleeping State - Processor Context Maintained S2 - Low Latency Sleeping State - Processor Context Not Maintained S3 - Low Latency Sleeping State - DRAM still maintained S4 - Lowest power longest wake-up - DRAM not maintained S5 - Soft Off State ACPI Power States

12 12 System Power States

13 13 OSPM Implementations 1.Use system address map reporting interfaces. (int15h,e820h) 2.Find and consume the ACPI System Description Tables. 3.Interpret ACPI machine language (AML). 4.Enumerate and configure motherboard devices described in the ACPI Namespace. 5.Interface with the power management timer. 6.Interface with the real-time clock wake alarm. 7.Enter ACPI mode (on legacy hardware systems). 8.Implement device power management policy. 9.Implement power resource management. 10.Implement processor power states in the scheduler idle handlers. 11.Control processor and device performance states. 12.Implement the ACPI thermal model. 13.Support the ACPI Event programming model including handling SCI interrupts, managing fixed events, general-purpose events, embedded controller interrupts, and dynamic device support. 14.Support acquisition and release of the Global Lock. 15.Use the reset register to reset the system. 16.Provide APIs to influence power management policy. 17.Implement driver support for ACPI-defined devices. 18.Implement APIs supporting the system indicators. 19.Support all system states S1–S5.

14 14  Fixed Hardware Programming Model  Performance sensitive features  Features that drivers require during wake  Features that enable catastrophic OS software failure recovery  CPU clock control  Power management timer  Fixed hardware registers  Generic Hardware Programming Model  OEM-provided AML code ACPI Hardware

15 15 Generic Hardware Feature Model

16 16 Global States and Their Transitions

17 17 Register model  Fixed hardware registers and Generic hardware registers  System I/O  System memory  PCI configuration  SMBus  Embedded controller  Functional Fixed Hardware

18 18

19 19

20 20 Example: PM1

21 21

22 22 ACPI uses tables to describe system information, features, and methods for controlling features. ACPI Software  RSDT--Root System Description Table.  XSDT--Extended System Description Table.  FADT--Fixed ACPI Description Table.  DSDT--Differentiated System Description Table.  FACS--Firmware ACPI Control Structure.  SSDT--Secondary System Description Table.  ……

23 23 RSD PTRRSDT(XSDT) FADT DBGP BOOT FACS DSDT System Description Table Architecture F000:xxxxTop Memory RSD PTR:Root System Description Pointer RSDT:Root System Description Table FADT:Fixed ACPI Description Table FACS:Fimware ACPI Control Structure DSDT:Differentiated System Description table SSDT:Secondary System Description Table Simple boot flag SSDT APIC MP(APIC)

24 24

25 25 ;Build RSD PTRtable ALIGN16 PublicRSD_PTR RSD_PTR:db"RSD PTR “;RSD PTR Signature RSD_CKSM:db0;Checksum, fill in at POST …… RSDT_Ptr:db4 dup (?);RSDT physical address, fill in at POST RSDPTRLengthEQU($-RSD_PTR) W6555 Acpi.asm

26 26 ……

27 27 ;RSDT table RSDTtable: db"RSDT";Signaturedb4 dup (?) …… db4 dup (?);Pointer of FACP table ifdefSIMPLE_BOOT_SUPPORT db4 dup (?); Pointer of BOOT table endif;SIMPLE_BOOT_SUPPORT ifdef Debug_port_table ;R09 db 4 dup (?) ;R09 Pointer of DBGP table endif ;Debug_port_table ;R09 W6555 Acpitbl.asm

28 28

29 29 Fixed ACPI Description Table (FADT) FADT defines various fixed hardware ACPI information vital to an ACPI-compatible OS, such as the base address for the following hardware registers blocks: PM1a_EVT_BLK, PM1b_EVT_BLK, PM1a_CNT_BLK, PM1b_CNT_BLK……

30 30 ……

31 31 FACPtable: db"FACP" ;Signature …… db4 dup (?);Pointer of FACS table db4 dup (?);Pointer of DSDT table …… ddPM1a_EVT_BLK ddPM1b_EVT_BLK …… ddGPE0_BLK ddGPE1_BLK dbPM1_EVT_LEN …… W6555 Acpitbl.asm

32 32 Firmware ACPI Control Structure (FACS) FACS is a structure in read/write memory that the BIOS reserves for ACPI usage.  Hardware Signature  Used in waking from S4 state  Firmware_waking_Vector  Physical memory address of an OS wake function  Global_lock

33 33 ;FACS Table FACStable: db"FACS" ;Signature ddFACSLength;Length dd0;Hardware Signature dd0;Firmware Waking Vector dd0;Global Lock ddFACSFlag db40 dup (0);Reserved FACSLength EQU ($-FACStable) W6555 Acpitbl.asm

34 34 Differentiated System Description Table (DSDT) DSDT is part of the system fixed description.  Table header  Data in Definition Block

35 35

36 36 ASL (ACPI Source Language)  ASL Name define  All name are a fixed 32 bits.  First byte is ‘A’-’Z’,’_’  Inclusive of ‘A’-’Z’,’0’-’9’,’_’  Name begin with ’_’ are reserved  Name proceeded with ‘\’ refer to the root  Name proceeded with ‘^’ refer to the parent

37 37 ASL Language Grammer  Multiple blanks are the same as one. Blank, (, ), ‘,’ and newline are all token separators.  // marks the beginning of a comment, which continues from the // to the end of the line.  /* marks the beginning of a comment, which continues from the /* to the next */.  “” surround an ASCII string.  Single quotes (‘ ’)Indicate constant characters.‘A’  Numeric constants can be written in three ways: ordinary decimal, octal (using 0ddd) or hexadecimal, using the notation 0xdd.  Nothing indicates an empty item. For example, { Nothing } is equivalent to {}.

38 38 ASL Data TypeDescription [Uninitialized]No assigned type or value. This is the type of all control method LocalX variables and unused ArgX variables at the beginning of method execution, as well as all uninitialized Package elements. Uninitialized objects must be initialized (via Store or CopyObject) before they may be used as source operands in ASL expressions. BufferAn array of bytes. Uninitialized elements are zero by default. Buffer FieldPortion of a buffer created using CreateBitField, CreateByteField, CreateWordField, CreateQWordField, CreateField, or returned by the Index operator. DDB HandleDefinition block handle returned by the Load operator Debug ObjectDebug output object. Formats an object and prints it to the system debug port. Has no effect if debugging is not active. DeviceDevice or bus object EventEvent synchronization object Field Unit (within an Operation Region) Portion of an address space, bit-aligned and of one-bit granularity. Created using Field, BankField, or IndexField. IntegerAn n-bit little-endian unsigned integer. In ACPI 1.0 this was at least 32-bits. In ACPI 2.0 this is at least 64.bits. Integer ConstantCreated by the ASL terms “Zero”, “One”, “Ones”, and “Revision”. MethodControl Method (Executable AML function) MutexMutex synchronization object Object ReferenceReference to an object created using the RefOf operator Operation RegionOperation Region (A region within an Address Space) PackageCollection of ASL objects with a fixed number of elements (up to 255). Power ResourcePower Resource description object ProcessorProcessor description object StringNull-terminated ASCII string with up to 200 characters. Thermal ZoneThermal Zone description object

39 39 ASL Language and Terms DefinitionBlock( AMLFileName,//StringData TableSignature,//StringData ComplianceRevision,//ByteConst OEMID,//StringData TableID,//StringData OEMRevision//DWordConst ) { ObjectList }

40 40 DefinitionBlock ( "DSDT.AML", "DSDT", 0x01, "INTELR",//OEMID "AWRDACPI", 0x1000 ) {// Start of ASL File Scope(\_PR) { Processor(\_PR.CPU0, 1,//processor number 0x4010,//System IO address of Pblk Registers 0x06//length in bytes of PBlk ) {} } …… Name(\_S0,Package(){0,0,0,0}) //R36 …… } W6555 Dsdt.asl HEADHEAD BODYBODY

41 41 Example // Define a control method power button Device(\_SB.PWRB){ //_SB System bus scope Name(_HID, EISAID(“PNP0C0C”))//_HID hardware ID Name(_PRW,Package(){0, 0x4})//_PRW power resource for wake } OperationRegion(\Pho, SystemIO, 0x200, 0x1) Field(\Pho, ByteAcc, NoLock, WriteAsZeros){ PBP, 1, // sleep/off request PBW, 1 // wakeup request } // end of power button device object //_Lxx /_Exx Control method executed as a result of a GPE Scope(\_GPE){ // Root level event handlers//general-purpose event. Method(_L00){ // uses bit 0 of GP0_STS register If(PBP){ Store(One, PBP) // clear power button status Notify(\_SB.PWRB, 0x80) // Notify OS of event } IF(PBW){ Store(One, PBW) Notify(\_SB.PWRB, 0x2) } } // end of _L00 handler } // end of \_GPE scope

42 42 _PTS_GTS _WAK_BFS WakeSleep Prepare To SleepGoing To Sleep System WakeBack From Sleep

43 43 ACPI In BIOS


45 45

46 46 ACPI Name space A hierarchical tree structure in OS-controlled memory that contains named objects. These objects may be data objects, control method objects, bus/device package objects, and so on. The OS dynamically changes the contents of the namespace at run-time by loading and/or unloading definition blocks from the ACPI Tables that reside in the ACPI BIOS. All the information in the ACPI Namespace comes from the Differentiated System Description Table (DSDT), which contains the Differentiated Definition Block, and one or more other definition blocks. For all Definition Blocks, the system maintains a single hierarchical namespace that it uses to refer to objects. All Definition Blocks load into the same namespace.

47 47 Example ACPI NameSpace

48 48

49 49

50 50 \_SB PWRB _HID _STA SLPB _HID _STA _PRW PCI0 _HID _ADR _UID _S3D _STA _CRS PICM APIC _PRT PX40 _ADR USB0 USB1 USB2 USB3 PX43 _ADR SMBB MODM PMIO _CRS \_PR \_S0 \_S1 \_S4 \_S5 \_PTS \_WAK \_SI _MSG _SST \_GPE _L05 _L03 _L04 _L0B _L08 _L1B _L0C _L0D \_SB W6555 Dsdt.asx

51 51 Boot Vector SLP_TYP=S3 ? Initialize CPU Init memory controller Enable Memory Init chipset S4BIOS ? Restore Memory Image Initialize CPU Enable Memory POST … ACPI NVS ACPI Reclaim ACPI Tables … Boot OS Loader Call Waking Vector Yes No Yes No BIOS Initialization Non-Volatile-Sleeping Memory(NVS)

52 52 SETUP ACPI TABLE ACPI memory range type:  ACPI Reclaim Memory  Be free when finish using ACPI table  ACPI Non-Volatile-Sleeping Memory(NVS)  Reserved by BIOS

53 53 Setup ACPI Table Process of Setup ACPI Table  Determine the size and address of the physical memory.  Allocate the ACPI Reserved area at top of memory for ACPI NVS and ACPI Reclaim memory areas.  Fix up the ACPI table pointers with address values.  Copy FACS into NVS;copy RSET,RACP,DSDT into ACPI Reclaim memory area;copy RSD pointer into E000:F000 memory segment.

54 54

55 55 ifdefACPI_Support cmpdword ptr ACPI_TABLE_FLAG[bp],0 jzshort No_ACPI_table movdi,(ACPITBL_Expand_Address+1)*4 callPOST_decompress extrnSetupACPI:near callSetupACPI;call to setup ACPI table No_ACPI_table: endif;ACPI_Support W6555 E8post.asm

56 56 callSetRealModeLimit;Enter big real mode F000_Call F000_Shadow_W;Set F000 shadow to writeable callGetACPIReclaimArea;Return EAX=physical address of reclaim memory area callMoveACPIToReclaim;Move RSDT, FACP, DSDT tables to reclaim area callGetACPINVSArea;Return EAX=physical address of ACPI NVS area callMoveACPItoNVS;Move FACS table to NVS area. callFillACPIAddress;Fill in the pointers for all tables callFillACPIChecksum;Fill in check sum for all tables callSetRealModelimit;Leave big real mode W6555 acpi.asm

57 57  BOOTROM.ASM  Detected system sleep resume state  Enable ACPI I/O space  Turn_On_ACPI_IO(chiprun.asm )  ACPI.ASM  Move codes to the top of memory,filled in all pointers,checksum.  ACPI Patch (Ct_parse_AML)  Replacesuspendtype PROC  ModifySuspendType PROC  ReplaceAML_String PROC  ACPITBL.ASM  All ACPI Tables puts here.

58 58  E0post.ASM POST code 067h  Setup INT15h function E820h – memory report  ACPI table address & size  E8post.ASM POST code 089h - SetupACPI  ACPI Table initialize  AML initialize  Dynamically modify ACPI tables and AML

59 59 ACPI_ENABLE (0A1h) out SMI_CMD,0A1H Enable SCI to transfer to ACPI mode. Save some chipset configuration. ACPI_DISABLE (0A0h) out SMI_CMD,0A0H Disable SCI to transfer to Legacy mode. Restore original chipset configuration. S4BIOS_REQ (0A4h) out SMI_CMD,0A4H Save system context to heardisk and put system state to S4.

60 60 Questions  How does OS get SCI information?  Is ACPI table dynamical created by BIOS Post?  Can modify ACPI table in OS?

61 61 THE END Thank you

Download ppt "1 MSI Micro-Star International. 2 Advanced Configuration and Power Interface Reporter :Wequalwu ACPI."

Similar presentations

Ads by Google