Stefan Reinauer | 8e07382 | 2012-04-04 00:07:22 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2009 coresystems GmbH |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Stefan Reinauer | 8e07382 | 2012-04-04 00:07:22 +0200 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | /* Intel Cougar Point USB support */ |
| 18 | |
| 19 | // EHCI Controller 0:1d.0 |
| 20 | |
| 21 | Device (EHC1) |
| 22 | { |
| 23 | Name(_ADR, 0x001d0000) |
| 24 | |
| 25 | Name (_PRW, Package(){ 13, 4 }) // Power Resources for Wake |
| 26 | |
| 27 | // Leave USB ports on for to allow Wake from USB |
| 28 | |
| 29 | Method(_S3D,0) // Highest D State in S3 State |
| 30 | { |
| 31 | Return (2) |
| 32 | } |
| 33 | |
| 34 | Method(_S4D,0) // Highest D State in S4 State |
| 35 | { |
| 36 | Return (2) |
| 37 | } |
| 38 | |
| 39 | Device (HUB7) |
| 40 | { |
| 41 | Name (_ADR, 0x00000000) |
| 42 | |
Matt DeVillier | fa2df2a | 2017-04-17 18:00:25 -0500 | [diff] [blame] | 43 | |
| 44 | // GPLD: Generate Port Location Data (PLD) |
| 45 | Method (GPLD, 1, Serialized) |
| 46 | { |
| 47 | |
| 48 | Name (PCKG, Package (0x01) |
| 49 | { |
| 50 | Buffer (0x10) {} |
| 51 | }) |
| 52 | |
| 53 | // REV: Revision 0x02 for ACPI 5.0 |
| 54 | CreateField (DerefOf (Index (PCKG, Zero)), Zero, 0x07, REV) |
| 55 | Store (0x02, REV) |
| 56 | |
| 57 | // VISI: Port visibility to user per port |
| 58 | CreateField (DerefOf (Index (PCKG, Zero)), 0x40, One, VISI) |
| 59 | Store (Arg0, VISI) |
| 60 | |
| 61 | Return (PCKG) |
Elyes HAOUAS | 88607a4 | 2018-10-05 10:36:45 +0200 | [diff] [blame^] | 62 | } |
Matt DeVillier | fa2df2a | 2017-04-17 18:00:25 -0500 | [diff] [blame] | 63 | |
Stefan Reinauer | 8e07382 | 2012-04-04 00:07:22 +0200 | [diff] [blame] | 64 | // How many are there? |
| 65 | Device (PRT1) { Name (_ADR, 1) } // USB Port 0 |
| 66 | Device (PRT2) { Name (_ADR, 2) } // USB Port 1 |
| 67 | Device (PRT3) { Name (_ADR, 3) } // USB Port 2 |
| 68 | Device (PRT4) { Name (_ADR, 4) } // USB Port 3 |
| 69 | Device (PRT5) { Name (_ADR, 5) } // USB Port 4 |
| 70 | Device (PRT6) { Name (_ADR, 6) } // USB Port 5 |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | // EHCI #2 Controller 0:1a.0 |
| 75 | |
| 76 | Device (EHC2) |
| 77 | { |
| 78 | Name(_ADR, 0x001a0000) |
| 79 | |
| 80 | Name (_PRW, Package(){ 13, 4 }) // Power Resources for Wake |
| 81 | |
| 82 | // Leave USB ports on for to allow Wake from USB |
| 83 | |
| 84 | Method(_S3D,0) // Highest D State in S3 State |
| 85 | { |
| 86 | Return (2) |
| 87 | } |
| 88 | |
| 89 | Method(_S4D,0) // Highest D State in S4 State |
| 90 | { |
| 91 | Return (2) |
| 92 | } |
| 93 | |
| 94 | Device (HUB7) |
| 95 | { |
| 96 | Name (_ADR, 0x00000000) |
| 97 | |
Matt DeVillier | fa2df2a | 2017-04-17 18:00:25 -0500 | [diff] [blame] | 98 | // GPLD: Generate Port Location Data (PLD) |
| 99 | Method (GPLD, 1, Serialized) |
| 100 | { |
| 101 | Name (PCKG, Package (0x01) |
| 102 | { |
| 103 | Buffer (0x10) {} |
| 104 | }) |
| 105 | |
| 106 | // REV: Revision 0x02 for ACPI 5.0 |
| 107 | CreateField (DerefOf (Index (PCKG, Zero)), Zero, 0x07, REV) |
| 108 | Store (0x02, REV) |
| 109 | |
| 110 | // VISI: Port visibility to user per port |
| 111 | CreateField (DerefOf (Index (PCKG, Zero)), 0x40, One, VISI) |
| 112 | Store (Arg0, VISI) |
| 113 | |
| 114 | Return (PCKG) |
Elyes HAOUAS | 88607a4 | 2018-10-05 10:36:45 +0200 | [diff] [blame^] | 115 | } |
Matt DeVillier | fa2df2a | 2017-04-17 18:00:25 -0500 | [diff] [blame] | 116 | |
Stefan Reinauer | 8e07382 | 2012-04-04 00:07:22 +0200 | [diff] [blame] | 117 | // How many are there? |
| 118 | Device (PRT1) { Name (_ADR, 1) } // USB Port 0 |
| 119 | Device (PRT2) { Name (_ADR, 2) } // USB Port 1 |
| 120 | Device (PRT3) { Name (_ADR, 3) } // USB Port 2 |
| 121 | Device (PRT4) { Name (_ADR, 4) } // USB Port 3 |
| 122 | Device (PRT5) { Name (_ADR, 5) } // USB Port 4 |
| 123 | Device (PRT6) { Name (_ADR, 6) } // USB Port 5 |
| 124 | } |
| 125 | } |
| 126 | |
Marc Jones | e7ae96f | 2012-11-13 15:07:45 -0700 | [diff] [blame] | 127 | Device (XHC) |
| 128 | { |
| 129 | Name(_ADR, 0x00140000) |
| 130 | OperationRegion(XDEV, PCI_Config, 0, 256) |
| 131 | Field(XDEV, DWordAcc, NoLock, Preserve) |
| 132 | { |
| 133 | Offset(0xD0), |
| 134 | X2PR, 32, // XUSB2PR |
| 135 | PRM2, 32, // XUSB2PRM |
| 136 | SSEN, 32, // USB3_PSSEN |
| 137 | RPM3, 32, // USB3PRM |
| 138 | XPRT, 32, // XHCI Ports |
| 139 | } |
| 140 | |
| 141 | Name (_PRW, Package(){ 13, 4 }) // Power Resources for Wake |
| 142 | |
Martin Roth | a34b5bc | 2018-05-06 21:06:18 -0500 | [diff] [blame] | 143 | Method(POSC,2,Serialized) |
Marc Jones | e7ae96f | 2012-11-13 15:07:45 -0700 | [diff] [blame] | 144 | { |
Martin Roth | a34b5bc | 2018-05-06 21:06:18 -0500 | [diff] [blame] | 145 | /* |
| 146 | * Arg0 - An Integer containing a count of entries in Arg3 |
| 147 | * Arg1 - A Buffer containing a list of DWORD capabilities |
| 148 | */ |
| 149 | |
Marc Jones | e7ae96f | 2012-11-13 15:07:45 -0700 | [diff] [blame] | 150 | // Create DWord field from the Capabilities Buffer |
Martin Roth | a34b5bc | 2018-05-06 21:06:18 -0500 | [diff] [blame] | 151 | CreateDWordField(Arg1,0,CDW1) |
Marc Jones | e7ae96f | 2012-11-13 15:07:45 -0700 | [diff] [blame] | 152 | |
| 153 | // Check revision |
Martin Roth | a34b5bc | 2018-05-06 21:06:18 -0500 | [diff] [blame] | 154 | If(LNotEqual(Arg0,One)) { |
Marc Jones | e7ae96f | 2012-11-13 15:07:45 -0700 | [diff] [blame] | 155 | // Set unknown revision bit |
| 156 | Or(CDW1,0x8,CDW1) |
| 157 | } |
| 158 | |
| 159 | // Set failure if xHCI is disabled by coreboot |
| 160 | If(LEqual(XHCI, 0)) { |
| 161 | Or(CDW1,0x2,CDW1) |
| 162 | } |
| 163 | |
| 164 | // Query flag clear and xHCI in auto mode |
| 165 | If(LAnd(LNot(And(CDW1,0x1)),LOr(LEqual(XHCI ,2), LEqual(XHCI ,3)))) { |
| 166 | Store ("XHCI Switch", Debug) |
| 167 | Store(Zero, Local0) |
| 168 | And(XPRT, 0x3, Local0) |
| 169 | If(LOr(LEqual(Local0, 0), LEqual(Local0, 1))) { |
| 170 | Store(0xF, Local1) |
| 171 | } |
| 172 | ElseIf(LEqual(Local0, 2)) { |
| 173 | Store(0x3, Local1) |
| 174 | } |
| 175 | ElseIf(LEqual(Local0, 3)) { |
| 176 | Store(Zero, Local1) |
| 177 | } |
| 178 | And(RPM3, 0xFFFFFFF0, Local0) |
| 179 | Or(Local0, Local1, RPM3) |
| 180 | And(PRM2, 0xFFFFFFF0, Local0) |
| 181 | Or(Local0, Local1, PRM2) |
| 182 | And(SSEN, 0xFFFFFFF0, Local0) |
| 183 | Or(Local0, Local1, SSEN) |
| 184 | And(X2PR, 0xFFFFFFF0, Local0) |
| 185 | Or(Local0, Local1, X2PR) |
| 186 | } |
Martin Roth | a34b5bc | 2018-05-06 21:06:18 -0500 | [diff] [blame] | 187 | Return(Arg1) |
Marc Jones | e7ae96f | 2012-11-13 15:07:45 -0700 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | // Leave USB ports on for to allow Wake from USB |
| 191 | Method(_S3D,0) // Highest D State in S3 State |
| 192 | { |
| 193 | Return (2) |
| 194 | } |
| 195 | |
| 196 | Method(_S4D,0) // Highest D State in S4 State |
| 197 | { |
| 198 | Return (2) |
| 199 | } |
| 200 | } |