Tiny SSDT example 3: Full blown example - RevoGirl/RevoBoot GitHub Wiki

The code snippet below is small (666 bytes of AML code), universal and portable and as such can be used on any system, with any kind of boot loader, but the last part of this example, specifically the use of Method _PTS in this SSDT example, is supported exclusively by RevoBoot.

Please that most of the device removals / renaming of devices in this SSDT example are not required. Not at all. Just examples of how things can be done without having to hack a factory DSDT to pieces. Which not only is a (time consuming) job for people who know what they are doing, but doing it like that. The old fashion way, limits it to one specific board only. The way we do it, the easy way, is not. Or far less.

Disclaimer: You may have to change the used scope names in this example and/or change the _PTS method a little to make it work for your hardware, but that's about as far as things can go wrong.

Another note is that any breakage you may run into, is most likely due to some error in your tiny SSDT. What we did when we ran into this kind of problem was to re-check everything and to fix the error. The golden rule here is to start thinking in namespace trees rather than devices and methods. Also. As a reminder. You can only add new devices and methods. You cannot override existing devices and/or methods!

Scope (\)
{
    External (\_SB.PCI0.HPET.HPTE, IntObj)

    Method (_INI, 0, NotSerialized)				// Adding _INI Method.
    {
        Store (One, \_SB.PCI0.HPET.HPTE)			// Sets the High Precision Timer setting in the UEFI BIOS to Enabled.
    }

    External (AMW0, DeviceObj)

    Scope (AMW0)							// Let's start by removing a device in the factory DSDT.
    {
        Name (_STA, Zero)
    }

    External (OMSC, DeviceObj)

    Scope (OMSC)							// And here another one.
    {
        Name (_STA, Zero)
    }

    Scope (\_SB)							// Changing the scope to the System Bus tree.
    {
        External (RMEM, DeviceObj)

        Scope (RMEM)						// Removing a factory device.
        {
            Name (_STA, Zero)
        }

        External (\_SB.PCI0, DeviceObj)

        Scope (PCI0)						// And over to device PCI0.
        {
            Name (PW94, Package (0x02) { 0x09, 0x04 })

            Device (MCHC)					// Adding a device for Power Management.
            {
                Name (_ADR, Zero)
            }

            Device (HDEF)					// Adding audio device.
            {
                Name (_ADR, 0x001B0000)
                Alias (PW94, _PRW)
            }

            External (P0P1, DeviceObj)

            Scope (P0P1)
            {
                Device (GFX0)				// Giving our GPU device a name. 
                {
                    Name (_SUN, One)		// A simple cosmetic only change.
                    Name (_ADR, Zero)
                }

                Device (HDAU)				// Base for High Definition Audio link. 
                {
                    Name (_ADR, One)
                }
            }

            External (PEX4, DeviceObj)		// Device name may be different in your DSDT!

            Scope (PEX4)
            {
                Device (FRWR)				// Here we give our Firewire device a name.
                {
                    Name (_ADR, Zero)
                }
            }

            External (PEX5, DeviceObj)		// Device name may be different in your DSDT!

            Scope (PEX5)
            {
                Device (GIGE)				// Same kind of deal for Ethernet.
                {
                    Name (_ADR, Zero)
                }
            }

            External (PEX6, DeviceObj)		// Removing an unused device (your setup may still need it).

            Scope (PEX6)
            {
                Name (_STA, Zero)
            }

            External (PEX7, DeviceObj)		// Removing an unused device (your setup may still need it).

            Scope (PEX7)
            {
                Name (_STA, Zero)
            }

            External (SAT0, DeviceObj)		// Removing a SATA device with the wrong name.

            Scope (SAT0)
            {
                Name (_STA, Zero)
            }

            External (SAT1, DeviceObj)		// Removing an unused device.

            Scope (SAT1)
            {
                Name (_STA, Zero)
            }

            Device (SATA)					// Inject new SATA device, one with the correct name.
            {
               Name (_ADR, 0x001F0002)
            }

            External (SBRG, DeviceObj)

            Scope (SBRG)					// Using Scope here since this device is already defined in the namespace!
            {
                External (EC0, DeviceObj)	// Creating a path to the factory EC0 in the namespace

                Scope (EC0)
                {
                    Name (_STA, Zero)		// Removing factory EC0 device
                }

                Device (EC)					// Adding new EC device to the namespace!
                {
                    Name (_HID, EisaId ("PNP0C09"))
                    Name (_CRS, ResourceTemplate ()
                    {
                        IO (Decode16,
                            0x0062,
                            0x0062,
                            0x00,
                            0x01,
                            _Y12)
                        IO (Decode16,
                            0x0066,
                            0x0066,
                            0x00,
                            0x01,
                            _Y13)
                    })
                    CreateWordField (_CRS, \_SB.PCI0.SBRG.EC._Y12._MIN, DPRT)
                    CreateWordField (_CRS, \_SB.PCI0.SBRG.EC._Y13._MIN, CPRT)
                    Name (_GPE, 0x18)
                }

                External (SPKR, DeviceObj)	// Creating a path to the existing device in the namespace.

                Scope (SPKR)				// Let's remove the speaker device (most people won't need it).
                {
                    Name (_STA, Zero)		// Disabling device, by adding a status property with Zero as value.
                }

                External (RMSC, DeviceObj)

                Scope (RMSC)
                {
                    Name (_STA, Zero)
                }
											// Not required. Just another example!  
                External (COPR, DeviceObj)	// Creating a path to the existing device in the namespace

                Scope (COPR)				// Declaring the scope of operation
                {
                    Name (_STA, Zero)		// Disabling factory device
                }

                Device (MATH)				// Adding a new device to the namespace!
                {
                    Name (_HID, EisaId ("PNP0C04"))
                    Name (_CRS, ResourceTemplate () {
                        IO (Decode16,
                            0x00F0,
                            0x00F0,
                            0x00,
                            0x10,
                            )
                        IRQNoFlags ()
                            {13}
                    })
                }

                External (DMAD, DeviceObj)	// Creating a path to DMAD in the namespace

                Scope (DMAD)				// Removing factory timer device
                {
                    Name (_STA, Zero)		// Disabling factory device
                }

                External (TMR, DeviceObj)	// Creating a path to the existing device in the namespace

                Scope (TMR)					// Removing factory timer device
                {
                    Name (_STA, Zero)		// Disabling factory device
                }

                Device (TIMR)				// Adding a new timer device to the namespace
                {
                    Name (_HID, EisaId ("PNP0100"))
                    Name (_CRS, ResourceTemplate ()
                    {
                        IO (Decode16,
                            0x0040,
                            0x0040,
                            0x00,
                            0x04,
                            )
                        IRQNoFlags ()
                            {0}
                    })
                }
											// Let's fix this one (required).
                External (RTC0, DeviceObj)	// Creating a path to the existing device in the namespace.

                Scope (RTC0)				// Declaring the scope of operation.
                {
                    Name (_STA, Zero)		// Disabling factory device, by adding a status property with Zero as value.
                }

                Device (RTC)				// Adding a fixed RTC device to the namespace!
                {
                    Name (_HID, EisaId ("PNP0B00"))
                    Name (_CRS, ResourceTemplate () {
                        IO (Decode16,
                            0x0070,
                            0x0070,
                            0x01,
                            0x08,			// Fix for "RTC: Only single RAM bank (128 bytes)".
                            )
                        IRQNoFlags ()
                            {8}
                    })
                }

                External (SIO1, DeviceObj)

                Scope (SIO1)				// More removals of junk devices (not required).
                {
                    Name (_STA, Zero)
                }

                External (WMI1, DeviceObj)

                Scope (WMI1)
                {
                    Name (_STA, Zero)		// More removals of junk devices (not required).
                }
            }
        }
    }

    External (DBG8, IntObj)
    External (\_SB.SMIC, IntObj)
    External (\_SB.PCI0.SBRG.PS1S, IntObj)
    External (\_SB.PCI0.SBRG.PS1E, IntObj)

    Method (_PTS, 1, NotSerialized)			// This is exclusively supported by RevoBoot v1.0.20 and greater!
    {
        Store (0x90, \_SB.SMIC)
        Store (Arg0, DBG8)

        If (LNotEqual (Arg0, 0x05))
        {
            Store (One, \_SB.PCI0.SBRG.PS1S)
            Store (One, \_SB.PCI0.SBRG.PS1E)
        }
    }
}

Troubleshooting
You may have de-compiled ssdt.aml and run into trouble when you try to compile it again. This can be easily fixed. You have to change two of the "External" declarations in your ssdt.dsl. Make sure it looks like this:

DefinitionBlock ("ssdt.aml", "SSDT", 1, "APPLE ", "general", 0x00001000)
{
    External (DBG8, IntObj)
    External (AR24, IntObj)
    External (WMI1, DeviceObj)
    External (SIO1, DeviceObj)
    External (RTC0, DeviceObj)
    External (TMR, DeviceObj)
    External (DMAD, DeviceObj)
    External (COPR, DeviceObj)
    External (RMSC, DeviceObj)
    External (SPKR, DeviceObj)
    External (EC0, DeviceObj)
    External (SAT1, DeviceObj)
    External (SAT0, DeviceObj)
    External (BR20, DeviceObj)
    External (GBE, DeviceObj)
    External (BR24, DeviceObj)
    External (PEX6, DeviceObj)
    External (P0P1, DeviceObj)
    External (RMEM, DeviceObj)
    External (OMSC, DeviceObj)
    External (AMW0, DeviceObj)
    External (\_SB.SMIC)
    External (\_SB.PCI0, DeviceObj)			// Target #1
    External (\_SB.PCI0.HPET.HPTE, IntObj)
    External (\_SB.PCI0.SBRG, DeviceObj)	// Target #2
    External (\_SB.PCI0.SBRG.PS1E)
    External (\_SB.PCI0.SBRG.PS1S)

    Scope (\)
    { ...

Also check for duplicates and compile again. Should fix this issue. Problem solved.