| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
|
| 3 |
/* Include in each PCIe Root Port device */ |
| 4 |
|
| 5 |
/* lowest D-state supported by |
| 6 |
* PCIe root port during S0 state |
| 7 |
*/ |
| 8 |
Name (_S0W, 4) |
| 9 |
|
| 10 |
Name (PDST, 0) /* present Detect status */ |
| 11 |
|
| 12 |
/* Dynamic Opregion needed to access registers |
| 13 |
* when the controller is in D3 cold |
| 14 |
*/ |
| 15 |
OperationRegion (PX01, PCI_Config, 0x00, 0xFF) |
| 16 |
Field (PX01, AnyAcc, NoLock, Preserve) |
| 17 |
{ |
| 18 |
Offset(0x5A), |
| 19 |
, 6, |
| 20 |
PDS, 1, /* 6, Presence detect Change */ |
| 21 |
Offset(0xE2), /* RPPGEN - Root Port Power Gating Enable */ |
| 22 |
, 2, |
| 23 |
L23E, 1, /* 2, L23_Rdy Entry Request (L23ER) */ |
| 24 |
L23R, 1, /* 3, L23_Rdy to Detect Transition (L23R2DT) */ |
| 25 |
Offset(0xF4), /* BLKPLLEN */ |
| 26 |
, 10, |
| 27 |
BPLL, 1, |
| 28 |
} |
| 29 |
|
| 30 |
OperationRegion (PX02, PCI_Config, 0x338, 0x4) |
| 31 |
Field (PX02, AnyAcc, NoLock, Preserve) |
| 32 |
{ |
| 33 |
, 26, |
| 34 |
BDQA, 1 /* BLKDQDA */ |
| 35 |
} |
| 36 |
|
| 37 |
PowerResource (PXP, 0, 0) |
| 38 |
{ |
| 39 |
/* Define the PowerResource for PCIe slot */ |
| 40 |
Method (_STA, 0, Serialized) |
| 41 |
{ |
| 42 |
PDST = PDS |
| 43 |
If (PDS == 1) { |
| 44 |
Return (0xf) |
| 45 |
} Else { |
| 46 |
Return (0) |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
Method (_ON, 0, Serialized) |
| 51 |
{ |
| 52 |
If (PDST == 1 && \PRT0 != 0) { |
| 53 |
/* Enter this condition if device |
| 54 |
* is connected |
| 55 |
*/ |
| 56 |
|
| 57 |
/* De-assert PERST */ |
| 58 |
\_SB.PCI0.PRDA (\PRT0) |
| 59 |
|
| 60 |
BDQA = 0 /* Set BLKDQDA to 0 */ |
| 61 |
BPLL = 0 /* Set BLKPLLEN to 0 */ |
| 62 |
|
| 63 |
/* Set L23_Rdy to Detect Transition |
| 64 |
* (L23R2DT) |
| 65 |
*/ |
| 66 |
L23R = 1 |
| 67 |
Sleep (16) |
| 68 |
Local0 = 0 |
| 69 |
|
| 70 |
/* Delay for transition Detect |
| 71 |
* and link to train |
| 72 |
*/ |
| 73 |
While (L23R) { |
| 74 |
If (Local0 > 4) { |
| 75 |
Break |
| 76 |
} |
| 77 |
Sleep (16) |
| 78 |
Local0++ |
| 79 |
} |
| 80 |
} /* End PDS condition check */ |
| 81 |
} |
| 82 |
|
| 83 |
Method (_OFF, 0, Serialized) |
| 84 |
{ |
| 85 |
/* Set L23_Rdy Entry Request (L23ER) */ |
| 86 |
If (PDST == 1 && \PRT0 != 0) { |
| 87 |
/* enter this condition if device |
| 88 |
* is connected |
| 89 |
*/ |
| 90 |
L23E = 1 |
| 91 |
Sleep (16) |
| 92 |
Local0 = 0 |
| 93 |
While (L23E) { |
| 94 |
If (Local0 > 4) { |
| 95 |
Break |
| 96 |
} |
| 97 |
Sleep (16) |
| 98 |
Local0++ |
| 99 |
} |
| 100 |
BDQA = 1 /* Set BLKDQDA to 1 */ |
| 101 |
BPLL = 1 /* Set BLKPLLEN to 1 */ |
| 102 |
|
| 103 |
/* Assert PERST */ |
| 104 |
\_SB.PCI0.PRAS (\PRT0) |
| 105 |
} /* End PDS condition check */ |
| 106 |
} /* End of Method_OFF */ |
| 107 |
} /* End PXP */ |
| 108 |
|
| 109 |
Name(_PR0, Package() { PXP }) |
| 110 |
Name(_PR3, Package() { PXP }) |