Device (SATA)
{
Name (_ADR, 0x001F0002)
Name (^NATA, Package (0x01)
{
0x001F0002
})
Name (REGF, One)
Method (_REG, 2, NotSerialized)
{
If (LEqual (Arg0, 0x02))
{
Store (Arg1, REGF)
}
}
Name (TIM0, Package (0x08)
{
Package (0x04)
{
0x78,
0xB4,
0xF0,
0x0384
},
Package (0x04)
{
0x23,
0x21,
0x10,
Zero
},
Package (0x04)
{
0x0B,
0x09,
0x04,
Zero
},
Package (0x06)
{
0x78,
0x5A,
0x3C,
0x28,
0x1E,
0x14
},
Package (0x06)
{
Zero,
One,
0x02,
One,
0x02,
One
},
Package (0x06)
{
Zero,
Zero,
Zero,
One,
One,
One
},
Package (0x04)
{
0x04,
0x03,
0x02,
Zero
},
Package (0x04)
{
0x02,
One,
Zero,
Zero
}
})
Name (TMD0, Buffer (0x14) {})
CreateDWordField (TMD0, Zero, PIO0)
CreateDWordField (TMD0, 0x04, DMA0)
CreateDWordField (TMD0, 0x08, PIO1)
CreateDWordField (TMD0, 0x0C, DMA1)
CreateDWordField (TMD0, 0x10, CHNF)
OperationRegion (CFG2, PCI_Config, 0x40, 0x20)
Field (CFG2, DWordAcc, NoLock, Preserve)
{
PMPT, 4,
PSPT, 4,
PMRI, 6,
Offset (0x02),
SMPT, 4,
SSPT, 4,
SMRI, 6,
Offset (0x04),
PSRI, 4,
SSRI, 4,
Offset (0x08),
PM3E, 1,
PS3E, 1,
SM3E, 1,
SS3E, 1,
Offset (0x0A),
PMUT, 2,
, 2,
PSUT, 2,
Offset (0x0B),
SMUT, 2,
, 2,
SSUT, 2,
Offset (0x0C),
Offset (0x14),
PM6E, 1,
PS6E, 1,
SM6E, 1,
SS6E, 1,
PMCR, 1,
PSCR, 1,
SMCR, 1,
SSCR, 1,
, 4,
PMAE, 1,
PSAE, 1,
SMAE, 1,
SSAE, 1
}
Name (GMPT, Zero)
Name (GMUE, Zero)
Name (GMUT, Zero)
Name (GMCR, Zero)
Name (GSPT, Zero)
Name (GSUE, Zero)
Name (GSUT, Zero)
Name (GSCR, Zero)
Device (PRT0) // DeBilbao, antes era CHN0 para compatibilidad con MacPro
{
Name (_ADR, Zero)
Method (_GTM, 0, NotSerialized)
{
FZHD ()
ShiftLeft (PSCR, One, Local1)
Or (PMCR, Local1, Local0)
ShiftLeft (PMAE, 0x02, Local3)
ShiftLeft (PM6E, One, Local4)
Or (Local3, Local4, Local3)
Or (PM3E, Local3, Local1)
ShiftLeft (PMPT, 0x04, Local3)
Or (Local1, Local3, Local1)
ShiftLeft (PSAE, 0x02, Local3)
ShiftLeft (PS6E, One, Local4)
Or (Local3, Local4, Local3)
Or (PS3E, Local3, Local2)
ShiftLeft (PSPT, 0x04, Local3)
Or (Local2, Local3, Local2)
Return (GTM (PMRI, Local1, PMUT, PSRI, Local2, PSUT, Local0))
}
Method (_STM, 3, NotSerialized)
{
Store (Arg0, Debug)
Store (Arg0, TMD0)
ShiftLeft (PMAE, 0x02, Local3)
ShiftLeft (PM6E, One, Local4)
Or (Local3, Local4, Local3)
Or (PM3E, Local3, Local0)
ShiftLeft (PMPT, 0x04, Local3)
Or (Local0, Local3, Local0)
ShiftLeft (PSAE, 0x02, Local3)
ShiftLeft (PS6E, One, Local4)
Or (Local3, Local4, Local3)
Or (PS3E, Local3, Local1)
ShiftLeft (PSPT, 0x04, Local3)
Or (Local1, Local3, Local1)
Store (PMRI, GMPT)
Store (Local0, GMUE)
Store (PMUT, GMUT)
Store (PMCR, GMCR)
Store (PSRI, GSPT)
Store (Local1, GSUE)
Store (PSUT, GSUT)
Store (PSCR, GSCR)
STM ()
Store (GMPT, PMRI)
Store (GMUE, Local0)
Store (GMUT, PMUT)
Store (GMCR, PMCR)
Store (GSUE, Local1)
Store (GSUT, PSUT)
Store (GSCR, PSCR)
If (And (Local0, One))
{
Store (One, PM3E)
}
Else
{
Store (Zero, PM3E)
}
If (And (Local0, 0x02))
{
Store (One, PM6E)
}
Else
{
Store (Zero, PM6E)
}
If (And (Local0, 0x04))
{
Store (One, PMAE)
}
Else
{
Store (Zero, PMAE)
}
If (And (Local1, One))
{
Store (One, PS3E)
}
Else
{
Store (Zero, PS3E)
}
If (And (Local1, 0x02))
{
Store (One, PS6E)
}
Else
{
Store (Zero, PS6E)
}
If (And (Local1, 0x04))
{
Store (One, PSAE)
}
Else
{
Store (Zero, PSAE)
}
Store (GTF (Zero, Arg1), ATA0)
Store (GTF (One, Arg2), ATA1)
}
Device (DRV0)
{
Name (_ADR, Zero)
Method (_GTF, 0, NotSerialized)
{
Return (RATA (ATA0))
}
}
Device (DRV1)
{
Name (_ADR, One)
Method (_GTF, 0, NotSerialized)
{
Return (RATA (ATA1))
}
}
}
Device (PRT1) // DeBilbao, antes era CHN1 para compatibilidad con MacPro
{
Name (_ADR, One)
Method (_GTM, 0, NotSerialized)
{
FZHD ()
ShiftLeft (SSCR, One, Local1)
Or (SMCR, Local1, Local0)
ShiftLeft (SMAE, 0x02, Local3)
ShiftLeft (SM6E, One, Local4)
Or (Local3, Local4, Local3)
Or (SM3E, Local3, Local1)
ShiftLeft (SMPT, 0x04, Local3)
Or (Local1, Local3, Local1)
ShiftLeft (SSAE, 0x02, Local3)
ShiftLeft (SS6E, One, Local4)
Or (Local3, Local4, Local3)
Or (SS3E, Local3, Local2)
ShiftLeft (SSPT, 0x04, Local3)
Or (Local2, Local3, Local2)
Return (GTM (SMRI, Local1, SMUT, SSRI, Local2, SSUT, Local0))
}
Method (_STM, 3, NotSerialized)
{
Store (Arg0, Debug)
Store (Arg0, TMD0)
ShiftLeft (SMAE, 0x02, Local3)
ShiftLeft (SM6E, One, Local4)
Or (Local3, Local4, Local3)
Or (SM3E, Local3, Local0)
ShiftLeft (SMPT, 0x04, Local3)
Or (Local0, Local3, Local0)
ShiftLeft (SSAE, 0x02, Local3)
ShiftLeft (SS6E, One, Local4)
Or (Local3, Local4, Local3)
Or (SS3E, Local3, Local1)
ShiftLeft (SSPT, 0x04, Local3)
Or (Local1, Local3, Local1)
Store (SMRI, GMPT)
Store (Local0, GMUE)
Store (SMUT, GMUT)
Store (SMCR, GMCR)
Store (SSRI, GSPT)
Store (Local1, GSUE)
Store (SSUT, GSUT)
Store (SSCR, GSCR)
STM ()
Store (GMPT, SMRI)
Store (GMUE, Local0)
Store (GMUT, SMUT)
Store (GMCR, SMCR)
Store (GSUE, Local1)
Store (GSUT, SSUT)
Store (GSCR, SSCR)
If (And (Local0, One))
{
Store (One, SM3E)
}
Else
{
Store (Zero, SM3E)
}
If (And (Local0, 0x02))
{
Store (One, SM6E)
}
Else
{
Store (Zero, SM6E)
}
If (And (Local0, 0x04))
{
Store (One, SMAE)
}
Else
{
Store (Zero, SMAE)
}
If (And (Local1, One))
{
Store (One, SS3E)
}
Else
{
Store (Zero, SS3E)
}
If (And (Local1, 0x02))
{
Store (One, SS6E)
}
Else
{
Store (Zero, SS6E)
}
If (And (Local1, 0x04))
{
Store (One, SSAE)
}
Else
{
Store (Zero, SSAE)
}
Store (GTF (Zero, Arg1), ATA2)
Store (GTF (One, Arg2), ATA3)
}
Device (DRV0)
{
Name (_ADR, Zero)
Method (_GTF, 0, NotSerialized)
{
Return (RATA (ATA2))
}
}
Device (DRV1)
{
Name (_ADR, One)
Method (_GTF, 0, NotSerialized)
{
Return (RATA (ATA3))
}
}
}
Method (GTM, 7, Serialized)
{
Store (Ones, PIO0)
Store (Ones, PIO1)
Store (Ones, DMA0)
Store (Ones, DMA1)
Store (0x10, CHNF)
If (REGF) {}
Else
{
Return (TMD0)
}
If (And (Arg1, 0x20))
{
Or (CHNF, 0x02, CHNF)
}
Store (Match (DerefOf (Index (TIM0, One)), MEQ, Arg0, MTR,
Zero, Zero), Local6)
Store (DerefOf (Index (DerefOf (Index (TIM0, Zero)), Local6)),
Local7)
Store (Local7, DMA0)
Store (Local7, PIO0)
If (And (Arg4, 0x20))
{
Or (CHNF, 0x08, CHNF)
}
Store (Match (DerefOf (Index (TIM0, 0x02)), MEQ, Arg3, MTR,
Zero, Zero), Local6)
Store (DerefOf (Index (DerefOf (Index (TIM0, Zero)), Local6)),
Local7)
Store (Local7, DMA1)
Store (Local7, PIO1)
If (And (Arg1, 0x07))
{
Store (Arg2, Local5)
If (And (Arg1, 0x02))
{
Add (Local5, 0x02, Local5)
}
If (And (Arg1, 0x04))
{
Add (Local5, 0x04, Local5)
}
Store (DerefOf (Index (DerefOf (Index (TIM0, 0x03)), Local5)),
DMA0)
Or (CHNF, One, CHNF)
}
If (And (Arg4, 0x07))
{
Store (Arg5, Local5)
If (And (Arg4, 0x02))
{
Add (Local5, 0x02, Local5)
}
If (And (Arg4, 0x04))
{
Add (Local5, 0x04, Local5)
}
Store (DerefOf (Index (DerefOf (Index (TIM0, 0x03)), Local5)),
DMA1)
Or (CHNF, 0x04, CHNF)
}
Store (TMD0, Debug)
Return (TMD0)
}
Method (STM, 0, Serialized)
{
If (REGF)
{
Store (Zero, GMUE)
Store (Zero, GMUT)
Store (Zero, GSUE)
Store (Zero, GSUT)
If (And (CHNF, One))
{
Store (Match (DerefOf (Index (TIM0, 0x03)), MLE, DMA0, MTR,
Zero, Zero), Local0)
If (LGreater (Local0, 0x05))
{
Store (0x05, Local0)
}
Store (DerefOf (Index (DerefOf (Index (TIM0, 0x04)), Local0)),
GMUT)
Or (GMUE, One, GMUE)
If (LGreater (Local0, 0x02))
{
Or (GMUE, 0x02, GMUE)
}
If (LGreater (Local0, 0x04))
{
And (GMUE, 0xFD, GMUE)
Or (GMUE, 0x04, GMUE)
}
}
Else
{
If (Or (LEqual (PIO0, Ones), LEqual (PIO0, Zero)))
{
If (And (LLess (DMA0, Ones), LGreater (DMA0, Zero)))
{
Store (DMA0, PIO0)
Or (GMUE, 0x80, GMUE)
}
}
}
If (And (CHNF, 0x04))
{
Store (Match (DerefOf (Index (TIM0, 0x03)), MLE, DMA1, MTR,
Zero, Zero), Local0)
If (LGreater (Local0, 0x05))
{
Store (0x05, Local0)
}
Store (DerefOf (Index (DerefOf (Index (TIM0, 0x04)), Local0)),
GSUT)
Or (GSUE, One, GSUE)
If (LGreater (Local0, 0x02))
{
Or (GSUE, 0x02, GSUE)
}
If (LGreater (Local0, 0x04))
{
And (GSUE, 0xFD, GSUE)
Or (GSUE, 0x04, GSUE)
}
}
Else
{
If (Or (LEqual (PIO1, Ones), LEqual (PIO1, Zero)))
{
If (And (LLess (DMA1, Ones), LGreater (DMA1, Zero)))
{
Store (DMA1, PIO1)
Or (GSUE, 0x80, GSUE)
}
}
}
If (And (CHNF, 0x02))
{
Or (GMUE, 0x20, GMUE)
}
If (And (CHNF, 0x08))
{
Or (GSUE, 0x20, GSUE)
}
And (Match (DerefOf (Index (TIM0, Zero)), MGE, PIO0, MTR,
Zero, Zero), 0x07, Local0)
Store (DerefOf (Index (DerefOf (Index (TIM0, One)), Local0)),
Local1)
Store (Local1, GMPT)
If (LLess (Local0, 0x03))
{
Or (GMUE, 0x50, GMUE)
}
And (Match (DerefOf (Index (TIM0, Zero)), MGE, PIO1, MTR,
Zero, Zero), 0x07, Local0)
Store (DerefOf (Index (DerefOf (Index (TIM0, 0x02)), Local0)),
Local1)
Store (Local1, GSPT)
If (LLess (Local0, 0x03))
{
Or (GSUE, 0x50, GSUE)
}
}
}
Name (AT01, Buffer (0x07)
{
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEF
})
Name (AT02, Buffer (0x07)
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90
})
Name (AT03, Buffer (0x07)
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6
})
Name (AT04, Buffer (0x07)
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x91
})
Name (ATA0, Buffer (0x1D) {})
Name (ATA1, Buffer (0x1D) {})
Name (ATA2, Buffer (0x1D) {})
Name (ATA3, Buffer (0x1D) {})
Name (ATAB, Buffer (0x1D) {})
CreateByteField (ATAB, Zero, CMDC)
Method (GTFB, 3, Serialized)
{
Multiply (CMDC, 0x38, Local0)
Add (Local0, 0x08, Local1)
CreateField (ATAB, Local1, 0x38, CMDX)
Multiply (CMDC, 0x07, Local0)
CreateByteField (ATAB, Add (Local0, 0x02), A001)
CreateByteField (ATAB, Add (Local0, 0x06), A005)
Store (Arg0, CMDX)
Store (Arg1, A001)
Store (Arg2, A005)
Increment (CMDC)
}
Method (GTF, 2, Serialized)
{
Store (Arg1, Debug)
Store (Zero, CMDC)
Name (ID49, 0x0C00)
Name (ID59, Zero)
Name (ID53, 0x04)
Name (ID63, 0x0F00)
Name (ID88, 0x0F00)
Name (IRDY, One)
Name (PIOT, Zero)
Name (DMAT, Zero)
If (LEqual (SizeOf (Arg1), 0x0200))
{
CreateWordField (Arg1, 0x62, IW49)
Store (IW49, ID49)
CreateWordField (Arg1, 0x6A, IW53)
Store (IW53, ID53)
CreateWordField (Arg1, 0x7E, IW63)
Store (IW63, ID63)
CreateWordField (Arg1, 0x76, IW59)
Store (IW59, ID59)
CreateWordField (Arg1, 0xB0, IW88)
Store (IW88, ID88)
}
Store (0xA0, Local7)
If (Arg0)
{
Store (0xB0, Local7)
And (CHNF, 0x08, IRDY)
If (And (CHNF, 0x10))
{
Store (PIO1, PIOT)
}
Else
{
Store (PIO0, PIOT)
}
If (And (CHNF, 0x04))
{
If (And (CHNF, 0x10))
{
Store (DMA1, DMAT)
}
Else
{
Store (DMA0, DMAT)
}
}
}
Else
{
And (CHNF, 0x02, IRDY)
Store (PIO0, PIOT)
If (And (CHNF, One))
{
Store (DMA0, DMAT)
}
}
If (LAnd (LAnd (And (ID53, 0x04), And (ID88, 0xFF00
)), DMAT))
{
Store (Match (DerefOf (Index (TIM0, 0x03)), MLE, DMAT, MTR,
Zero, Zero), Local1)
If (LGreater (Local1, 0x05))
{
Store (0x05, Local1)
}
GTFB (AT01, Or (0x40, Local1), Local7)
}
Else
{
If (LAnd (And (ID63, 0xFF00), PIOT))
{
And (Match (DerefOf (Index (TIM0, Zero)), MGE, PIOT, MTR,
Zero, Zero), 0x03, Local0)
Or (0x20, DerefOf (Index (DerefOf (Index (TIM0, 0x07)), Local0
)), Local1)
GTFB (AT01, Local1, Local7)
}
}
If (IRDY)
{
And (Match (DerefOf (Index (TIM0, Zero)), MGE, PIOT, MTR,
Zero, Zero), 0x07, Local0)
Or (0x08, DerefOf (Index (DerefOf (Index (TIM0, 0x06)), Local0
)), Local1)
GTFB (AT01, Local1, Local7)
}
Else
{
If (And (ID49, 0x0400))
{
GTFB (AT01, One, Local7)
}
}
If (LAnd (And (ID59, 0x0100), And (ID59, 0xFF)))
{
GTFB (AT03, And (ID59, 0xFF), Local7)
}
Store (ATAB, Debug)
Return (ATAB)
}
Method (RATA, 1, NotSerialized)
{
CreateByteField (Arg0, Zero, CMDN)
Multiply (CMDN, 0x38, Local0)
CreateField (Arg0, 0x08, Local0, RETB)
Store (RETB, Debug)
Return (RETB)
}
}