Jump to content

DSDT editor and patcher


oldnapalm
 Share

999 posts in this topic

Recommended Posts

I hit on that idea, but thanks for help. Are you sure a commented out section is not required for something, what is FPED?

In (one of) your SSDT table(s) you'll find something like this:

        Name (SSDT, Package (0x0C)
       {
           "[color="#0000FF"]CPU0IST[/color] ", 
           [color="#FF0000"]0x8B7F9918[/color], 
           [color="#2E8B57"]0x00000439[/color], 
           "APIST   ", 
           0x8B7F8C18, 
           0x000003A4, 
           "CPU0CST ", 
           0x8B7F7798, 
           0x000006E5, 
           "APCST   ", 
           0x8B7F6D98, 
           0x00000119
       })

Then boot into a Linux LiveCD and enter the following terminal command:

 

acpidump -a 0x8B7F9918 -l 0x0439 > cpu0ist

 

To get what you are looking for (repeat for all tables). And yes the names and addresses will be different (again. It's just an example),

 

Update: Got it. Had to ask someone I know who knows this stuff, but here it is:

	Method (FPED, 0, NotSerialized)
{
	OperationRegion (IGDM, SystemMemory, ASLB, 0x2000)
	Field (IGDM, AnyAcc, NoLock, Preserve)
	{
					Offset (0x1C04), 
			DDCH,   1024
	}
}

This way you can define new values that may overlap with already defined areas, like in the example below:

                OperationRegion (IGDM, SystemMemory, ASLB, 0x2000)
               Field (IGDM, AnyAcc, NoLock, Preserve)
               {
                   SIGN,   128, 
                   SIZE,   32, 
                   OVER,   32, 
                   SVER,   256, 
                   VVER,   128, 
                   GVER,   128, 
                   MBOX,   32, 

...

                   PFMB,   32, 
                   CCDV,   32, 
                   PCFT,   32, 
                           Offset (0x400), 
                   GVD1,   49152, 
                   PHED,   32, 
                           [color="#FF0000"][b]Offset (0x1C04), 
                   DDCH,   1024,[/b][/color]
                   BDDC,   2048
               }

DDCH can't really be inserted here, on that exact spot, simply because it overlaps BDDC (in part). And they add it by calling Method FPED (in _INI () when available) with:

				Method (_INI, 0, Serialized)
			{
				If (CondRefOf (FPED))
				{
					FPED ()
				}
			}

In short: When you have values that need to overlap... use this. It is a bit complicated to explain, but you may finds additional info / clues in the ACPI specification.

 

Anyway. I hope this helps you to understand what it does, and to fix the errors in your DSDT.

Link to comment
Share on other sites

A little help with some script differences for Mobo Gigabyte GA-G41M-ES2L. I have two DSDTs but they are suppose to be from the same motherboard. There is some slight chance that his has a difference Bios in in that regard it could change things?

 

The main difference is 3 sections, one is the OperationRegion just after the Header and processor section, the HPET and EHC1 sections.

 

 

Operation Region Difference:

 

My DSDT:

 

    Name (FLAG, Zero)
   Name (STAT, Zero)
   OperationRegion (SMOD, SystemMemory, 0x000FF840, One)
   Field (SMOD, ByteAcc, NoLock, Preserve)
   {
           ,   7, 
       SUSF,   1
   }

   OperationRegion (LBOC, SystemMemory, 0x000FF820, 0x02)
   Field (LBOC, ByteAcc, NoLock, Preserve)
   {
       UBMC,   1, 
               Offset (0x02)
   }

   OperationRegion (DEBG, SystemIO, 0x80, One)
   Field (DEBG, ByteAcc, NoLock, Preserve)
   {
       DBG1,   8
   }

   OperationRegion (PMRS, SystemIO, 0x0430, 0x13)
   Field (PMRS, ByteAcc, NoLock, Preserve)
   {
           ,   4, 
       SLPE,   1
   }

   OperationRegion (RCRB, SystemMemory, 0xFED1C000, 0x4000)
   Field (RCRB, DWordAcc, Lock, Preserve)
   {
               Offset (0x3404), 
           ,   7, 
       HPTF,   1
   }

 

 

His DSDT:

 

 

    Name (FLAG, Zero)
   Name (STAT, Zero)
   OperationRegion (SMOD, SystemMemory, 0x000FF840, One)
   Field (SMOD, ByteAcc, NoLock, Preserve)
   {
           ,   7, 
       SUSF,   1
   }

   OperationRegion (DEBG, SystemIO, 0x80, One)
   Field (DEBG, ByteAcc, NoLock, Preserve)
   {
       DBG1,   8
   }

   OperationRegion (PMRS, SystemIO, 0x0430, 0x13)
   Field (PMRS, ByteAcc, NoLock, Preserve)
   {
           ,   4, 
       SLPE,   1
   }

   OperationRegion (RCRB, SystemMemory, 0xFED1C000, 0x4000)
   Field (RCRB, DWordAcc, Lock, Preserve)
   {
               Offset (0x3404), 
           ,   7, 
       HPTF,   1
   }

 

 

My DSDT HPET Script:

 

                Device (HPET)
               {
                   Name (_HID, EisaId ("PNP0103"))
                   Name (ATT3, ResourceTemplate ()
                   {
                       IRQNoFlags ()
                           {0}
                       IRQNoFlags ()
                           {8}
                       Memory32Fixed (ReadWrite,
                           0xFED00000,         // Address Base
                           0x00000400,         // Address Length
                           )
                   })
                   Name (ATT4, ResourceTemplate ()
                   {
                       IRQNoFlags ()
                           {0}
                       IRQNoFlags ()
                           {8}
                       Memory32Fixed (ReadWrite,
                           0xFED00000,         // Address Base
                           0x00000400,         // Address Length
                           )
                   })
                   Method (_STA, 0, NotSerialized)
                   {
                       If (LGreaterEqual (OSFX, 0x03))
                       {
                           If (HPTF)
                           {
                               Return (0x0F)
                           }
                           Else
                           {
                               Return (Zero)
                           }
                       }
                       Else
                       {
                           Return (Zero)
                       }
                   }

                   Method (_CRS, 0, NotSerialized)
                   {
                       If (LGreaterEqual (OSFX, 0x03))
                       {
                           If (HPTF)
                           {
                               Return (ATT3)
                           }
                           Else
                           {
                               Return (ATT4)
                           }
                       }
                       Else
                       {
                           Return (ATT4)
                       }
                   }
               }

 

 

His HPET Script:

 

                Device (HPET)
               {
                   Name (_HID, EisaId ("PNP0103"))
                   Name (ATT3, ResourceTemplate ()
                   {
                       IRQNoFlags ()
                           {0}
                       IRQNoFlags ()
                           {8}
                       Memory32Fixed (ReadWrite,
                           0xFED00000,         // Address Base
                           0x00000400,         // Address Length
                           )
                   })
                   Name (ATT4, ResourceTemplate ()
                   {
                       IRQNoFlags ()
                           {0}
                       IRQNoFlags ()
                           {8}
                       Memory32Fixed (ReadWrite,
                           0xFED00000,         // Address Base
                           0x00000400,         // Address Length
                           )
                   })
                   Method (_STA, 0, NotSerialized)
                   {
                       Return (0x0F)
                   }

                   Method (_CRS, 0, NotSerialized)
                   {
                       Return (ATT3)
                   }
               }

 

 

Notice the IRQ's are scripted twice for HPET?

 

 

 

 

His EHC1:

 

            Device (EHC1)
           {
               Name (_ADR, 0x001D0007)
               OperationRegion (PMCS, PCI_Config, 0x54, 0x02)
               Field (PMCS, WordAcc, NoLock, Preserve)
               {
                       ,   15, 
                   PMES,   1
               }

               OperationRegion (PWCR, PCI_Config, 0x62, 0x02)
               Field (PWCR, AnyAcc, NoLock, Preserve)
               {
                   URE2,   9
               }

               Method (_PSW, 1, NotSerialized)
               {
                   If (LEqual (Arg0, Zero))
                   {
                       Store (Zero, URE2)
                   }

                   If (LEqual (Arg0, One))
                   {
                       Store (0x01FF, URE2)
                   }
               }

               Name (_PRW, Package (0x02)
               {
                   0x0D, 
                   0x03
               })
               Method (_DSM, 4, NotSerialized)
               {
                   Store (Package (0x06)
                       {
                           "device-id", 
                           Buffer (0x04)
                           {
                               0x3A, 0x3A, 0x00, 0x00
                           }, 

                           "AAPL,clock-id", 
                           Buffer (One)
                           {
                               0x01
                           }, 

                           "device_type", 
                           Buffer (0x05)
                           {
                               "EHCI"
                           }
                       }, Local0)
                   DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                   Return (Local0)
               }
           }

 

 

 

My EHC1:

 

            Device (EHC1)
           {
               Name (_ADR, 0x001D0007)
               Method (_S3D, 0, NotSerialized)
               {
                   If (LEqual (OSFL, 0x02))
                   {
                       Return (0x02)
                   }

                   Return (0x03)
               }

               Name (_PRW, Package (0x02)
               {
                   0x0D, 
                   0x03
               })
               Method (_DSM, 4, NotSerialized)
               {
                   Store (Package (0x06)
                       {
                           "device-id", 
                           Buffer (0x04)
                           {
                               0x3A, 0x3A, 0x00, 0x00
                           }, 

                           "AAPL,clock-id", 
                           Buffer (One)
                           {
                               0x01
                           }, 

                           "device_type", 
                           Buffer (0x05)
                           {
                               "EHCI"
                           }
                       }, Local0)
                   DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                   Return (Local0)
               }
           }

           Name (NATA, Package (0x01)
           {
               0x001F0001
           })

 

As you can also see below this part is missing from his:

 

            Name (NATA, Package (0x01)
           {
               0x001F0001
           })

 

Mine is missing the operatingRegion sections and method _PSW. His is missing Method (_S3D, 0, NotSerialized)

 

 

 

Here is a better way of viewing it with this neat program I have. A GUI diff.

 

post-135888-1288224910_thumb.png

 

post-135888-1288224895_thumb.png

 

post-135888-1288224904_thumb.png

Link to comment
Share on other sites

I don't understand your question.

 

You are comparing two modified DSDTs, they are probably not originals. For example, in HPET, there's no need to have ATT3 and ATT4 if they are identical (usually one has IRQs and other doesn't) or if one is never used.

Link to comment
Share on other sites

@oSxFr33k,

 

If both DSDT come from similar motherboard, check whether both motherboard have same BIOS version or not. It is not possible if both motherboard have same BIOS version but have different DSDT. I bet both motherboard have different BIOS version.

Link to comment
Share on other sites

@oldnapalm and @kizwan,

 

I am waiting for the user to get back to me.

 

I had to use his HPET script. The extra script in my HPET, the ATT3 and ATT4 caused a kernel panic. It said that CPU2 had no HPET assigned to it. The ATT3 and ATT4 was not added. That is a clean DSDT extract using Ubuntu Live CD.

 

I just added the 2nd IRQ section to make it look like his HPET script is all. The kernel panic is gone now that I removed the extra script.

 

So basically what I am asking is leave my original operating region alone, from the above examples and don't remove the extra section I have in my original DSDT extract from Ubuntu Live CD? Same question with EHC1, just add the method section and leave everything else alone?

 

 

Here is my original untouched DSDT HPET and USBE(EHC1) sections below:

 

 

VANILLA HPET:

 

                Device (HPET)
               {
                   Name (_HID, EisaId ("PNP0103"))
                   Name (ATT3, ResourceTemplate ()
                   {
                       IRQNoFlags ()
                           {0}
                       IRQNoFlags ()
                           {8}
                       Memory32Fixed (ReadWrite,
                           0xFED00000,         // Address Base
                           0x00000400,         // Address Length
                           )
                   })
                   Name (ATT4, ResourceTemplate ()
                   {
                   })
                   Method (_STA, 0, NotSerialized)
                   {
                       If (LGreaterEqual (OSFX, 0x03))
                       {
                           If (HPTF)
                           {
                               Return (0x0F)
                           }
                           Else
                           {
                               Return (0x00)
                           }
                       }
                       Else
                       {
                           Return (0x00)
                       }
                   }

                   Method (_CRS, 0, NotSerialized)
                   {
                       If (LGreaterEqual (OSFX, 0x03))
                       {
                           If (HPTF)
                           {
                               Return (ATT3)
                           }
                           Else
                           {
                               Return (ATT4)
                           }
                       }
                       Else
                       {
                           Return (ATT4)
                       }
                   }
               }

 

VANILLA USBE (EHC1):

 

            Device (USBE)
           {
               Name (_ADR, 0x001D0007)
               Method (_S3D, 0, NotSerialized)
               {
                   If (LEqual (OSFL, 0x02))
                   {
                       Return (0x02)
                   }

                   Return (0x03)
               }

               Name (_PRW, Package (0x02)
               {
                   0x0D, 
                   0x03
               })
           }

           Name (NATA, Package (0x01)
           {
               0x001F0001
           })

Link to comment
Share on other sites

So basically what I am asking is leave my original operating region alone, from the above examples and don't remove the extra section I have in my original DSDT extract from Ubuntu Live CD? Same question with EHC1, just add the method section and leave everything else alone?

Whatever you do, it is unnecessary to remove anything from your DSDT unless it caused problem. Like you did to HPET code is necessary to fix the KP problem.

Link to comment
Share on other sites

For HPET fix you could use the patch included with the editor (HPET.txt), load the patch and check the "before" and "after" tabs in the preview window, look what it does with methods _STA and _CRS in device HPET (removes the conditions and adds a fixed return value).

Link to comment
Share on other sites

Does Mac OS boot without a dsdt.aml file? (using original DSDT from BIOS)

Can you attach your original DSDT and the fixed/recompiled one? What message do you see in verbose boot before it locks?

Maybe you need another patch, or fix the errors another way.

 

Speaking of unpatched DSDTs, I noticed a distinct lack of DSDTs for G41-based mobos (in fact, a lack of ASUS DSDTs for non-Core-i mobos in general), so I'm attaching a pulled unpatched DSDT extraction from my freshly-update ASUS P5G41-M LX2/GB (I updated it to the current 0501 BIOS two hours ago).

P5G41MLX2A.zip

Link to comment
Share on other sites

Whatever you do, it is unnecessary to remove anything from your DSDT unless it caused problem. Like you did to HPET code is necessary to fix the KP problem.

I think that you have this backwards: It is pointless to have unused code in your DSDT, stuff that wont ever be useful to OS X. This only slows down your boot time, and clogs memory that could otherwise be used in a much more meaningful way. This unused code confuses people, like we see displayed here time after time.

 

Example: My desktop DSDT is only 2KB, but it used to be over 45KB. Go figure!

 

Just my $2 cent

Link to comment
Share on other sites

I think that you have this backwards: It is pointless to have unused code in your DSDT, stuff that wont ever be useful to OS X. This only slows down your boot time, and clogs memory that could otherwise be used in a much more meaningful way. This unused code confuses people, like we see displayed here time after time.

 

Example: My desktop DSDT is only 2KB, but it used to be over 45KB. Go figure!

 

Just my $2 cent

As long it doesn't cause any problem I don't see why people need to do extra work just to cleanup unused code. Everyone have their own preferences & I think you should respect that.

Link to comment
Share on other sites

As long it doesn't cause any problem I don't see why people need to do extra work just to cleanup unused code. Everyone have their own preferences & I think you should respect that.

This has nothing to do with (lack of) respect. You simply fail to understand why people prune unused code from their DSDT, and that itself cannot be a justification to say that it is unnecessary (speaking about respect here). I mean; I already gave you two reasons, but you simply stepped over it so I'll add three more:

 

1) Doing cleanups helps you to understand how things work i.e. it has an educational character.

2) The in BIOS boot loader Revolution requires you to port the smallest DSDT possible.

3) It's sort of a sport to get the smallest possible DSDT for your hack.

 

Hey. To each his own of course, but please don't refute other peoples hard work... simply because you fail to see their reasoning behind it. I however do understand your point of view. It is perfectly clear to me. We just disagree on it. That's all.

 

@MaLd0n: I bet that it was much larger when you started to work on it :)

 

Cheers,

 

Sam.

Link to comment
Share on other sites

Hey. To each his own of course, but please don't refute other peoples hard work... simply because you fail to see their reasoning behind it. I however do understand your point of view. It is perfectly clear to me. We just disagree on it. That's all.

It is false to say I refute other peoples hard work. It just doesn't make sense. I can say the same thing to you too though.

 

I helped a lot of people. I gave my opinion where & when it is necessary. If they can't or don't want to accept...hey...no problem. It is up to them. I believe they can make their own judgment/decision. I will say no more about this. I came here to discuss & help other people & will continue doing so in the future.

Link to comment
Share on other sites

Luckily for us Apple users... Apple invests heavily in it. Just like Google and a number of other companies. And all this just to scrape off a few extra seconds. 1000+ engineers are working on it as we speak. But hey, you're here 3+ years and made lots of comments. Helped lots of people. Which is great of course (respect) but that doesn't stop other people from wanting it.

 

And when people say that they come here to discuss (something / their point of view or whatever) and then run and point a finger when the first person disagrees with them, then that's not a real discussion now it is.

 

To me the smaller the DSDT the easier it is to locate something, and to understand what it does. The less confusion the better I would say. Should I be using a 2KB fully working DSDT over a 45KB+ DSDT filled with junk? I don't think so. That would be silly, in my personal point of view, but I let people decide for them selfs, and this without telling them what is or isn't necessary. Especially when it is a proven fact that it can help. No matter how small and silly it may look to other people.

 

No. It's not 'required' to cleanup your DSDT (to get OS X up and running) but it is also not 'unnecessary labor' like some people here seem to think.

 

Also. Can we please stop with this silly post count and being here longer thing?

 

Thank you.

Link to comment
Share on other sites

@STLVNUB,

 

Thank you for your kind word. I really appreciated it. :( Yes, that is the most important here, kind word. Anyway this is hobby, do you agree? I didn't come here to work because I already spent on it half of my day, in 5 days a week. Everyone have their own ways when it come to learn (new) things. I believe, it is unnecessary to be rude when expressing an opinion like some people here.

Link to comment
Share on other sites

Sorry, but cleanups in your DSDT is on-topic talk. Let's take one example from my desktop DSDT:

            Device (SATA)
           {
               Name (_ADR, 0x001F0002)
               Name (^NATA, Package (0x01)
               {
                   0x001F0002
               })
               Name (\FZTF, Buffer (0x07)
               {
                   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF5
               })
               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 (CHN0)
               {
                   Name (_ADR, Zero)
                   Method (_GTM, 0, NotSerialized)
                   {
                       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 (CHN1)
               {
                   Name (_ADR, One)
                   Method (_GTM, 0, NotSerialized)
                   {
                       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 (Concatenate (RETB, FZTF))
               }
           } // End of: Device (SATA)

LOL This DSDT block is so long that I even had to split it up, simply because this forum can't handle it.

            Device (SAT1)
           {
               Name (_ADR, 0x001F0005)
               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 (CHN0)
               {
                   Name (_ADR, Zero)
                   Method (_GTM, 0, NotSerialized)
                   {
                       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 (CHN1)
               {
                   Name (_ADR, One)
                   Method (_GTM, 0, NotSerialized)
                   {
                       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 (Concatenate (RETB, FZTF))
               }
           } // End of: Device (SAT1)

That's a whopping 54,265 bytes of DSDT code. Waiting to be eliminated with a simple script in the DSDT Editor. I hope to have illustrated, clearly, why people like me do think that stuff like this is important.

 

@Kizwan: I don't understand why you think that I was rude. That was most certainly not my intention, but hey if that's how you read my opinion (a honest one) then I want to apologize for being misunderstood. Because that's all to it. Nothing more.

Link to comment
Share on other sites

Sorry, but cleanups in your DSDT is on-topic talk. Let's take one example from my desktop DSDT:

 

That's a whopping 54,265 bytes of DSDT code. Waiting to be eliminated with a simple script in the DSDT Editor. I hope to have illustrated, clearly, why people like me do think that stuff like this is important.

 

@Kizwan: I don't understand why you think that I was rude. That was most certainly not my intention, but hey if that's how you read my opinion (a honest one) then I want to apologize for being misunderstood. Because that's all to it. Nothing more.

 

I concur. Now, would you clean mine up whenever you have the time? Frankly, while I have edited my DSDT.aml code, it is all giberrish to me. I simply fear removing something essential to the OS X functionality. Thank You in advance.

 

It's actually Brett Whinnen's DSDT.aml

 

http://www.insanelymac.com/forum/index.php...p;#entry1441681

 

DSDT.aml.zip

Link to comment
Share on other sites

@dutchhockeypro,

 

Very good. Your new post is more relaxing to read. I understand your point of view much better this way. It doesn't mean I don't understood you from your old posts but to be honest I'm not a fan to the way you addressing your opinion. That's all. I like to read constructive & educational post. I don't have problem if you or other people have different opinion about modifying/fixing the DSDT. We're allowed to agree & disagree. I hope you understand people like me won't touch existing code unless it cause problem to OSX. The problem include kernel panic, slow boot, etc. Some of us use modified DSDT not just on OSX but on windows & linux too. Usually when modifying DSDT, I referred to two documents at least, ACPI specification & Apple DSDT. I cleanup my DSDT based on these two documents. I did the same thing to other people DSDT whenever I got a request from them. My DSDTs already gone through many modification (it is much easier if we have the target machine since we can play around & try many modification/approach). I already lost track how many, maybe hundreds. LOL. Again, we have different opinion on this matter but it shouldn't be a problem because we shared common goal which is to improve the OSX performance & compatibility on our non-apple computer.

Link to comment
Share on other sites

I concur. Now, would you clean mine up whenever you have the time? Frankly, while I have edited my DSDT.aml code, it is all giberrish to me. I simply fear removing something essential to the OS X functionality. Thank You in advance.

 

It's actually Brett Whinnen's DSDT.aml

 

http://www.insanelymac.com/forum/index.php...p;#entry1441681

 

DSDT.aml.zip

 

+1

 

Hey, I would also like to start cleaning mine dsdt which is 53KB at the moment. I have applied 2 patches via this editor and now I can run OSX with only fakesmc kext, all the things are working.

 

But since here was so much talk about cleaning, I would like to see how to approach this? I have 10+ years experience with computers (working as IT admin) but I have never get myself into coding or understanding computer languages, so when looking all the code inside editor I fell lost and I dont know how to start.

 

So I would kindly ask for some steps on how to start with this dsdt cleaning?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...