+++ /dev/null
-/*++\r
-\r
-Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-\r
-\r
-Module Name:\r
-\r
- IgdOMOBF.ASL\r
-\r
-Abstract:\r
-\r
- IGD OpRegion/Software SCI Reference Code for the Baytrail Family.\r
- This file contains ASL code with the purpose of handling events\r
- i.e. hotkeys and other system interrupts.\r
-\r
---*/\r
-\r
-\r
-// Notes:\r
-// 1. The following routines are to be called from the appropriate event\r
-// handlers.\r
-// 2. This code cannot comprehend the exact implementation in the OEM's BIOS.\r
-// Therefore, an OEM must call these methods from the existing event\r
-// handler infrastructure. Details on when/why to call each method is\r
-// included in the method header under the "usage" section.\r
-\r
-\r
-/************************************************************************;\r
-;* ACPI Notification Methods\r
-;************************************************************************/\r
-\r
-\r
-/************************************************************************;\r
-;*\r
-;* Name: PDRD\r
-;*\r
-;* Description: Check if the graphics driver is ready to process\r
-;* notifications and video extensions.\r
-;*\r
-;* Usage: This method is to be called prior to performing any\r
-;* notifications or handling video extensions.\r
-;* Ex: If (PDRD()) {Return (FAIL)}\r
-;*\r
-;* Input: None\r
-;*\r
-;* Output: None\r
-;*\r
-;* References: DRDY (Driver ready status), ASLP (Driver recommended\r
-;* sleep timeout value).\r
-;*\r
-;************************************************************************/\r
-\r
-Method(PDRD)\r
-{\r
- If(LNot(DRDY))\r
- {\r
-\r
- // Sleep for ASLP milliseconds if the driver is not ready.\r
-\r
- Sleep(ASLP)\r
- }\r
-\r
- // If DRDY is clear, the driver is not ready. If the return value is\r
- // !=0, do not perform any notifications or video extension handling.\r
-\r
- Return(LNot(DRDY))\r
-}\r
-\r
-\r
-/************************************************************************;\r
-;*\r
-;* Name: PSTS\r
-;*\r
-;* Description: Check if the graphics driver has completed the previous\r
-;* "notify" command.\r
-;*\r
-;* Usage: This method is called before every "notify" command. A\r
-;* "notify" should only be set if the driver has completed the\r
-;* previous command. Else, ignore the event and exit the parent\r
-;* method.\r
-;* Ex: If (PSTS()) {Return (FAIL)}\r
-;*\r
-;* Input: None\r
-;*\r
-;* Output: None\r
-;*\r
-;* References: CSTS (Notification status), ASLP (Driver recommended sleep\r
-;* timeout value).\r
-;*\r
-;************************************************************************/\r
-\r
-Method(PSTS)\r
-{\r
- If(LGreater(CSTS, 2))\r
- {\r
- // Sleep for ASLP milliseconds if the status is not "success,\r
- // failure, or pending"\r
- //\r
- Sleep(ASLP)\r
- }\r
-\r
- Return(LEqual(CSTS, 3)) // Return True if still Dispatched\r
-}\r
-\r
-\r
-/************************************************************************;\r
-;*\r
-;* Name: GNOT\r
-;*\r
-;* Description: Call the appropriate methods to query the graphics driver\r
-;* status. If all methods return success, do a notification of\r
-;* the graphics device.\r
-;*\r
-;* Usage: This method is to be called when a graphics device\r
-;* notification is required (display switch hotkey, etc).\r
-;*\r
-;* Input: Arg0 = Current event type:\r
-;* 1 = display switch\r
-;* 2 = lid\r
-;* 3 = dock\r
-;* Arg1 = Notification type:\r
-;* 0 = Re-enumeration\r
-;* 0x80 = Display switch\r
-;*\r
-;* Output: Returns 0 = success, 1 = failure\r
-;*\r
-;* References: PDRD and PSTS methods. OSYS (OS version)\r
-;*\r
-;************************************************************************/\r
-\r
-Method(GNOT, 2)\r
-{\r
- // Check for 1. Driver loaded, 2. Driver ready.\r
- // If any of these cases is not met, skip this event and return failure.\r
- //\r
- If(PDRD())\r
- {\r
- Return(0x1) // Return failure if driver not loaded.\r
- }\r
-\r
- Store(Arg0, CEVT) // Set up the current event value\r
- Store(3, CSTS) // CSTS=BIOS dispatched an event\r
-\r
- If(LAnd(LEqual(CHPD, 0), LEqual(Arg1, 0))) // Do not re-enum if driver supports hotplug\r
- {\r
- If(LOr(LGreater(OSYS, 2000), LLess(OSYS, 2006)))\r
- {\r
- //\r
- // WINXP requires that the entire PCI Bridge be re-enumerated.\r
- //\r
- Notify(\_SB.PCI0, Arg1)\r
- }\r
- Else\r
- {\r
- //\r
- // Re-enumerate the Graphics Device for non-XP operating systems.\r
- //\r
- Notify(\_SB.PCI0.GFX0, Arg1)\r
- }\r
- }\r
-\r
- Notify(\_SB.PCI0.GFX0,0x80)\r
-\r
-\r
- Return(0x0) // Return success\r
-}\r
-\r
-\r
-/************************************************************************;\r
-;*\r
-;* Name: GHDS\r
-;*\r
-;* Description: Handle a hotkey display switching event (performs a\r
-;* Notify(GFX0, 0).\r
-;*\r
-;* Usage: This method must be called when a hotkey event occurs and the\r
-;* purpose of that hotkey is to do a display switch.\r
-;*\r
-;* Input: Arg0 = Toggle table number.\r
-;*\r
-;* Output: Returns 0 = success, 1 = failure.\r
-;* CEVT and TIDX are indirect outputs.\r
-;*\r
-;* References: TIDX, GNOT\r
-;*\r
-;************************************************************************/\r
-\r
-Method(GHDS, 1)\r
-{\r
- Store(Arg0, TIDX) // Store the table number\r
-\r
- // Call GNOT for CEVT = 1 = hotkey, notify value = 0\r
-\r
- Return(GNOT(1, 0)) // Return stats from GNOT\r
-}\r
-\r
-\r
-/************************************************************************;\r
-;*\r
-;* Name: GLID\r
-;*\r
-;* Description: Handle a lid event (performs the Notify(GFX0, 0), but not the\r
-;* lid notify).\r
-;*\r
-;* Usage: This method must be called when a lid event occurs. A\r
-;* Notify(LID0, 0x80) must follow the call to this method.\r
-;*\r
-;* Input: Arg0 = Lid state:\r
-;* 0 = All closed\r
-;* 1 = internal LFP lid open\r
-;* 2 = external lid open\r
-;* 3 = both external and internal open\r
-;*\r
-;* Output: Returns 0=success, 1=failure.\r
-;* CLID and CEVT are indirect outputs.\r
-;*\r
-;* References: CLID, GNOT\r
-;*\r
-;************************************************************************/\r
-\r
-Method(GLID, 1)\r
-{\r
- Store(Arg0, CLID) // Store the current lid state\r
-\r
- // Call GNOT for CEVT=2=Lid, notify value = 0\r
-\r
- Return(GNOT(2, 0)) // Return stats from GNOT\r
-}\r
-\r
-\r
-/************************************************************************;\r
-;*\r
-;* Name: GDCK\r
-;*\r
-;* Description: Handle a docking event by updating the current docking status\r
-;* and doing a notification.\r
-;*\r
-;* Usage: This method must be called when a docking event occurs.\r
-;*\r
-;* Input: Arg0 = Docking state:\r
-;* 0 = Undocked\r
-;* 1 = Docked\r
-;*\r
-;* Output: Returns 0=success, 1=failure.\r
-;* CDCK and CEVT are indirect outputs.\r
-;*\r
-;* References: CDCK, GNOT\r
-;*\r
-;************************************************************************/\r
-\r
-Method(GDCK, 1)\r
-{\r
- Store(Arg0, CDCK) // Store the current dock state\r
-\r
- // Call GNOT for CEVT=4=Dock, notify value = 0\r
-\r
- Return(GNOT(4, 0)) // Return stats from GNOT\r
-}\r
-\r
-\r
-/************************************************************************;\r
-;* ASLE Interrupt Methods\r
-;************************************************************************/\r
-\r
-\r
-/************************************************************************;\r
-;*\r
-;* Name: PARD\r
-;*\r
-;* Description: Check if the driver is ready to handle ASLE interrupts\r
-;* generate by the system BIOS.\r
-;*\r
-;* Usage: This method must be called before generating each ASLE\r
-;* interrupt.\r
-;*\r
-;* Input: None\r
-;*\r
-;* Output: Returns 0 = success, 1 = failure.\r
-;*\r
-;* References: ARDY (Driver readiness), ASLP (Driver recommended sleep\r
-;* timeout value)\r
-;*\r
-;************************************************************************/\r
-\r
-Method(PARD)\r
-{\r
- If(LNot(ARDY))\r
- {\r
-\r
- // Sleep for ASLP milliseconds if the driver is not ready.\r
-\r
- Sleep(ASLP)\r
- }\r
-\r
- // If ARDY is clear, the driver is not ready. If the return value is\r
- // !=0, do not generate the ASLE interrupt.\r
-\r
- Return(LNot(ARDY))\r
-}\r
-\r
-\r
-/************************************************************************;\r
-;*\r
-;* Name: AINT\r
-;*\r
-;* Description: Call the appropriate methods to generate an ASLE interrupt.\r
-;* This process includes ensuring the graphics driver is ready\r
-;* to process the interrupt, ensuring the driver supports the\r
-;* interrupt of interest, and passing information about the event\r
-;* to the graphics driver.\r
-;*\r
-;* Usage: This method must called to generate an ASLE interrupt.\r
-;*\r
-;* Input: Arg0 = ASLE command function code:\r
-;* 0 = Set ALS illuminance\r
-;* 1 = Set backlight brightness\r
-;* 2 = Do Panel Fitting\r
-;* Arg1 = If Arg0 = 0, current ALS reading:\r
-;* 0 = Reading below sensor range\r
-;* 1-0xFFFE = Current sensor reading\r
-;* 0xFFFF = Reading above sensor range\r
-;* Arg1 = If Arg0 = 1, requested backlight percentage\r
-;*\r
-;* Output: Returns 0 = success, 1 = failure\r
-;*\r
-;* References: PARD method.\r
-;*\r
-;************************************************************************/\r
-\r
-Method(AINT, 2)\r
-{\r
-\r
- // Return failure if the requested feature is not supported by the\r
- // driver.\r
-\r
- If(LNot(And(TCHE, ShiftLeft(1, Arg0))))\r
- {\r
- Return(0x1)\r
- }\r
-\r
- // Return failure if the driver is not ready to handle an ASLE\r
- // interrupt.\r
-\r
- If(PARD())\r
- {\r
- Return(0x1)\r
- }\r
-\r
- // Evaluate the first argument (Panel fitting, backlight brightness, or ALS).\r
-\r
- If(LEqual(Arg0, 2)) // Arg0 = 2, so request a panel fitting mode change.\r
- {\r
- If(CPFM) // If current mode field is non-zero use it.\r
- {\r
- And(CPFM, 0x0F, Local0) // Create variables without reserved\r
- And(EPFM, 0x0F, Local1) // or valid bits.\r
-\r
- If(LEqual(Local0, 1)) // If current mode is centered,\r
- {\r
- If(And(Local1, 6)) // and if stretched is enabled,\r
- {\r
- Store(6, PFIT) // request stretched.\r
- }\r
- Else // Otherwise,\r
- {\r
- If(And(Local1, 8)) // if aspect ratio is enabled,\r
- {\r
- Store(8, PFIT) // request aspect ratio.\r
- }\r
- Else // Only centered mode is enabled\r
- {\r
- Store(1, PFIT) // so request centered. (No change.)\r
- }\r
- }\r
- }\r
- If(LEqual(Local0, 6)) // If current mode is stretched,\r
- {\r
- If(And(Local1, 8)) // and if aspect ratio is enabled,\r
- {\r
- Store(8, PFIT) // request aspect ratio.\r
- }\r
- Else // Otherwise,\r
- {\r
- If(And(Local1, 1)) // if centered is enabled,\r
- {\r
- Store(1, PFIT) // request centered.\r
- }\r
- Else // Only stretched mode is enabled\r
- {\r
- Store(6, PFIT) // so request stretched. (No change.)\r
- }\r
- }\r
- }\r
- If(LEqual(Local0, 8)) // If current mode is aspect ratio,\r
- {\r
- If(And(Local1, 1)) // and if centered is enabled,\r
- {\r
- Store(1, PFIT) // request centered.\r
- }\r
- Else // Otherwise,\r
- {\r
- If(And(Local1, 6)) // if stretched is enabled,\r
- {\r
- Store(6, PFIT) // request stretched.\r
- }\r
- Else // Only aspect ratio mode is enabled\r
- {\r
- Store(8, PFIT) // so request aspect ratio. (No change.)\r
- }\r
- }\r
- }\r
- }\r
-\r
- // The following code for panel fitting (within the Else condition) is retained for backward compatiblity.\r
-\r
- Else // If CFPM field is zero use PFIT and toggle the\r
- {\r
- Xor(PFIT,7,PFIT) // mode setting between stretched and centered only.\r
- }\r
-\r
- Or(PFIT,0x80000000,PFIT) // Set the valid bit for all cases.\r
-\r
- Store(4, ASLC) // Store "Panel fitting event" to ASLC[31:1]\r
- }\r
- Else\r
- {\r
- If(LEqual(Arg0, 1)) // Arg0=1, so set the backlight brightness.\r
- {\r
- Store(Divide(Multiply(Arg1, 255), 100), BCLP) // Convert from percent to 0-255.\r
-\r
- Or(BCLP, 0x80000000, BCLP) // Set the valid bit.\r
-\r
- Store(2, ASLC) // Store "Backlight control event" to ASLC[31:1]\r
- }\r
- Else\r
- {\r
- If(LEqual(Arg0, 0)) // Arg0=0, so set the ALS illuminace\r
- {\r
- Store(Arg1, ALSI)\r
-\r
- Store(1, ASLC) // Store "ALS event" to ASLC[31:1]\r
- }\r
- Else\r
- {\r
- Return(0x1) // Unsupported function\r
- }\r
- }\r
- }\r
-\r
- Store(0x01, ASLE) // Generate ASLE interrupt\r
- Return(0x0) // Return success\r
-}\r
-\r
-\r
-/************************************************************************;\r
-;*\r
-;* Name: SCIP\r
-;*\r
-;* Description: Checks the presence of the OpRegion and SCI\r
-;*\r
-;* Usage: This method is called before other OpRegion methods. The\r
-;* former "GSMI True/False is not always valid. This method\r
-;* checks if the OpRegion Version is non-zero and if non-zero,\r
-;* (present and readable) then checks the GSMI flag.\r
-;*\r
-;* Input: None\r
-;*\r
-;* Output: Boolean True = SCI present.\r
-;*\r
-;* References: None\r
-;*\r
-;************************************************************************/\r
-\r
-Method(SCIP)\r
-{\r
- If(LNotEqual(OVER,0)) // If OpRegion Version not 0.\r
- {\r
- Return(LNot(GSMI)) // Return True if SCI.\r
- }\r
-\r
- Return(0) // Else Return False.\r
-}\r