2 *-----------------------------------------------------------------------------
5 *-----------------------------------------------------------------------------
6 * Copyright (c) 2002-2010, Intel Corporation.
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 *-----------------------------------------------------------------------------
29 *-----------------------------------------------------------------------------
32 /* copied from napa */
36 #include "../cmn/pwr_dispatch.h"
40 * @addtogroup state_group
44 static int pwr_query_full_plb(unsigned int power_state);
45 static int pwr_set_plb(igd_context_t *context, unsigned int power_state);
46 static int pwr_init_plb(igd_context_t *context);
48 pwr_dispatch_t pwr_dispatch_plb = {
55 * This function returns "0" for all ACPI system states.
57 * @param power_state the requested power state
61 static int pwr_query_full_plb(unsigned int power_state)
62 { /* pwr_query_full */
63 switch( power_state ) {
65 case IGD_ADAPTERPOWERSTATE_ON:
66 case IGD_ADAPTERPOWERSTATE_STANDBY:
67 case IGD_ADAPTERPOWERSTATE_OFF:
68 case IGD_ADAPTERPOWERSTATE_SUSPEND:
69 case IGD_ADAPTERPOWERSTATE_HIBERNATE:
74 } /* pwr_query_full */
79 * @param power_state the requested power state
83 static int pwr_set_plb(igd_context_t *context, unsigned int power_state)
87 mmio = context->device_context.virt_mmadr;
89 switch (power_state) {
90 case IGD_POWERSTATE_D0:
92 case IGD_POWERSTATE_D1:
94 case IGD_POWERSTATE_D2:
96 case IGD_POWERSTATE_D3:
111 static int pwr_init_plb(igd_context_t *context)
115 mmio = context->device_context.virt_mmadr;
117 /* Reset CLKGATECTL and CLKGATECTLOVR */
118 EMGD_WRITE32(0x1111111, mmio + PSB_CR_CLKGATECTL);
119 EMGD_WRITE32(0, mmio + PSB_CR_CLKGATECTL + 8);