d33c34104800ceca93394c213c975f1ce18356bd
[coreboot.git] / src / vendorcode / amd / agesa / f14 / Proc / GNB / PCIe / Family / 0x14 / F14PcieAlib.esl
1 /**
2  * @file
3  *
4  * ALIB ASL library
5  *
6  *
7  *
8  * @xrefitem bom "File Content Label" "Release Content"
9  * @e project:     AGESA
10  * @e sub-project: GNB
11  * @e \$Revision: 31805 $   @e \$Date: 2010-05-21 17:58:16 -0700 (Fri, 21 May 2010) $
12  *
13  */
14 /*
15  *****************************************************************************
16  *
17  * Copyright (c) 2011, Advanced Micro Devices, Inc.
18  * All rights reserved.
19  * 
20  * Redistribution and use in source and binary forms, with or without
21  * modification, are permitted provided that the following conditions are met:
22  *     * Redistributions of source code must retain the above copyright
23  *       notice, this list of conditions and the following disclaimer.
24  *     * Redistributions in binary form must reproduce the above copyright
25  *       notice, this list of conditions and the following disclaimer in the
26  *       documentation and/or other materials provided with the distribution.
27  *     * Neither the name of Advanced Micro Devices, Inc. nor the names of 
28  *       its contributors may be used to endorse or promote products derived 
29  *       from this software without specific prior written permission.
30  * 
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
32  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34  * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
35  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
38  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  * 
42  * ***************************************************************************
43  *
44  */
45
46 DefinitionBlock (
47   "F14PcieAlibSsdt.aml",
48   "SSDT",
49   2,
50   "AMD",
51   "ALIB",
52   0x1
53   )
54 {
55   Scope(\_SB) {
56
57     Name (varMaxPortIndexNumber, 6)
58
59     include ("PcieAlibCore.asl")
60     include ("PcieSmuLibV1.asl")
61     include ("PcieAlibPspp.asl")
62     include ("PcieAlibHotplug.asl")
63
64     /*----------------------------------------------------------------------------------------*/
65     /**
66      *  Activate DPM state
67      *
68      *  Arg0    - 1 - GEN1 2 - GEN2
69      *  Arg1  - 0 (AC)   1 (DC)
70      */
71     Method (procNbLclkDpmActivate, 2, NotSerialized) {
72
73       Store (procSmuRcuRead (0x8490), Local0)
74       // Patch state only if at least one state is enable
75       if (LNotEqual (And (Local0, 0xF0), 0)) {
76         if (LEqual (Arg0, 2)) {
77             //If AC/DC, & Gen2 supported, activate state DPM0 and DPM2,
78             //set SMUx0B_x8490[LclkDpmValid[5, 7] = 1, set SMUx0B_x8490[LclkDpmValid[6]] = 0
79             //This is a battery ¡¥idle¡¦ state along with a ¡¥perf¡¦ state that will be programmed to the max LCLK achievable at the Gen2 VID
80             And (Local0, 0xFFFFFFA0, Local0)
81             Or (Local0, 0xA0, Local0)
82           
83         } else {
84                 if (LEqual (Arg1, 0)) {
85             //If AC, & if only Gen1 supported, activate state DPM0 and DPM1
86             //set SMUx0B_x8490[LclkDpmValid[6, 5]] = 1, set SMUx0B_x8490[LclkDpmValid[7]] = 0
87             And (Local0, 0xFFFFFF60, Local0)
88             Or (Local0, 0x60, Local0)
89           } else {
90                 //If DC mode & Gen1 supported, activate only state DPM0
91                 //set SMUx0B_x8490[LclkDpmValid[7, 6]] = 0, set SMUx0B_x8490[LclkDpmValid[5]] = 1
92             And (Local0, 0xFFFFFF20, Local0)
93             Or (Local0, 0x20, Local0)
94           }
95         }
96         procSmuRcuWrite (0x8490, Local0)
97       }
98     }
99
100     /*----------------------------------------------------------------------------------------*/
101     /**
102      *  Power gate PCIe phy lanes (hotplug support)
103      *
104      *  Arg0 - Start Lane ID
105      *  Arg1 - End Lane ID
106      *  Arg2 - Power ON(1) / OFF(0) 
107      */
108     Method (procPcieLanePowerControl, 3, NotSerialized) {
109        // stub function
110     }
111
112     /*----------------------------------------------------------------------------------------*/
113     /**
114      *  Read RCU register
115      *
116      *  Arg0    - 1 - GEN1 2 - GEN2
117      *  
118      */
119     Method (procPcieAdjustPll, 1, NotSerialized) {
120       //stub function
121     }
122         
123   } //End of Scope(\_SB)
124 }   //End of DefinitionBlock
125
126