Jump to content

DSDT Code for GeForce: Guide for Dummy

- - - - -

  • Please log in to reply
No replies to this topic

#1
kizwan

kizwan

    InsanelyMac Legend

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 1,422 posts
Now we don't have to use injector (NVdarwin.kext, NVinject.kext or Natit.kext) to be able to use our GeForce graphic card in Mac OS X. This can be done by applying DSDT override on our computer. This workaround should be working for most hardware.

This is the code we need to do the job:-
Method (_DSM, 4, NotSerialized)                    {                        Store (Package (0x16)                        {                            "@0,compatible",                             Buffer (0x0B)                            {                                "NVDA,NVMac"                            },                             "@0,device_type",                             Buffer (0x08)                            {                                "display"                            },                             "@0,name",                             Buffer (0x0F)                            {                                "NVDA,Display-A"                            },                             "@1,compatible",                             Buffer (0x0B)                            {                                "NVDA,NVMac"                            },                             "@1,device_type",                             Buffer (0x08)                            {                                "display"                            },                             "@1,name",                             Buffer (0x0F)                            {                                "NVDA,Display-B"                            },                             "NVCAP",                             Buffer (0x18)                            {                                /* 0000 */    0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,                                /* 0008 */    0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,                                /* 0010 */    0x00, 0x00, 0x00, 0x00                            },                             "VRAM,totalsize",                             Buffer (0x04)                            {                                0x00, 0x00, 0x00, 0x10                            },                             "device_type",                             Buffer (0x0D)                            {                                "NVDA,GeForce"                            },                             "model",                             Buffer (0x17)                            {                                "GeForce Series Primary"                            },                             "rom-revision",                             Buffer (0x06)                            {                                "H2P21"                            }                        }, Local0)                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))                        Return (Local0)                    }
The tricky part is where we need to put this code. Is it in PEGP, GFX0 or VGA function? To know where it should be, please follow this simple step:-
* It is important that your graphic card was working with injector kext.
* IORegistryExplorer is needed. It included with Xcode.
1) While using injector, open IORegistryExplorer & locate entry for your display. Search for PEGP, GFX, or VGA. You should see something like this:-
Posted Image
2) Base on the above screenshot (as an example), it is clearly that the code should be put in VGA function. Please write down all necessary information:-
- NVCAP
- VRAM
3) On the above code, you need to change NVCAP & VRAM value according to your own value. Pay attention, you need to add "0x" to each pair of number (in hex format) & make sure only maximum 8 value per entry. Don't forget to update "Buffer" size for NVCAP section. The calculation is simple, base on the above code, it have 3 entry, so; 3 x 8 = 24 (decimal). Converting to HEX it should be 0x18.
4) Finally (for this example), the code should be placed like this (bolded):-
Method (_DSM, 4, NotSerialized)
{
Store (Package (0x16)
{
"@0,compatible",
Buffer (0x0B)
{
"NVDA,NVMac"
},

"@0,device_type",
Buffer (0x08)
{
"display"
},

"@0,name",
Buffer (0x0F)
{
"NVDA,Display-A"
},

"@1,compatible",
Buffer (0x0B)
{
"NVDA,NVMac"
},

"@1,device_type",
Buffer (0x08)
{
"display"
},

"@1,name",
Buffer (0x0F)
{
"NVDA,Display-B"
},

"NVCAP",
Buffer (0x18)
{
/* 0000 */ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
/* 0008 */ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
/* 0010 */ 0x00, 0x00, 0x00, 0x00
},

"VRAM,totalsize",
Buffer (0x04)
{
0x00, 0x00, 0x00, 0x10
},

"device_type",
Buffer (0x0D)
{
"NVDA,GeForce"
},

"model",
Buffer (0x17)
{
"GeForce Series Primary"
},

"rom-revision",
Buffer (0x06)
{
"H2P21"
}
}, Local0)
DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
Return (Local0)
}

Device (CRT)
{
Name (_ADR, 0x0100)
Method (_DCS, 0, NotSerialized)
{
PHSR (0x25, Zero)
If (And (CSTE, 0x0101))
{
Return (0x1F)
}

Return (0x1D)
}

Method (_DGS, 0, NotSerialized)
{
If (And (NSTE, 0x0101))
{
Return (One)
}

Return (Zero)
}

Method (_DSS, 1, NotSerialized)
{
If (LEqual (And (Arg0, 0xC0000000), 0xC0000000))
{
Store (NSTE, CSTE)
}
}
} _linenums:0'>Device (PEGP) { Name (_ADR, 0x00010000) Device (VGA) { Name (_ADR, Zero) Method (_DOS, 1, NotSerialized) { Store (And (Arg0, 0x03), DSEN) } Method (_DOD, 0, NotSerialized) { If (LEqual (PHSR (0x2C, Zero), 0x03)) { Return (Package (0x04) { 0x00010100, 0x00010200, 0x00010118, 0x00010120 }) } Else { Return (Package (0x04) { 0x00010100, 0x00010200, 0x00010118, 0x00010210 }) } } <strong class='bbc'>Method (_DSM, 4, NotSerialized) { Store (Package (0x16) { "@0,compatible", Buffer (0x0B) { "NVDA,NVMac" }, "@0,device_type", Buffer (0x08) { "display" }, "@0,name", Buffer (0x0F) { "NVDA,Display-A" }, "@1,compatible", Buffer (0x0B) { "NVDA,NVMac" }, "@1,device_type", Buffer (0x08) { "display" }, "@1,name", Buffer (0x0F) { "NVDA,Display-B" }, "NVCAP", Buffer (0x18) { /* 0000 */ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* 0008 */ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, /* 0010 */ 0x00, 0x00, 0x00, 0x00 }, "VRAM,totalsize", Buffer (0x04) { 0x00, 0x00, 0x00, 0x10 }, "device_type", Buffer (0x0D) { "NVDA,GeForce" }, "model", Buffer (0x17) { "GeForce Series Primary" }, "rom-revision", Buffer (0x06) { "H2P21" } }, Local0) DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0)) Return (Local0) }</strong> Device (CRT) { Name (_ADR, 0x0100) Method (_DCS, 0, NotSerialized) { PHSR (0x25, Zero) If (And (CSTE, 0x0101)) { Return (0x1F) } Return (0x1D) } Method (_DGS, 0, NotSerialized) { If (And (NSTE, 0x0101)) { Return (One) } Return (Zero) } Method (_DSS, 1, NotSerialized) { If (LEqual (And (Arg0, 0xC0000000), 0xC0000000)) { Store (NSTE, CSTE) } } }
5) Now you ready to compile working dsdt.aml file & get rid the injector kext for good.
Below code need to be added in the dsdt.dsl too (anywhere as long it is accessible by the above code), otherwise it will failed when we tried to compile the dsdt:-
Method (DTGP, 5, NotSerialized)    {        If (LEqual (Arg0, Buffer (0x10)                {                    /* 0000 */    0xC6, 0xB7, 0xB5, 0xA0, 0x18, 0x13, 0x1C, 0x44,                     /* 0008 */    0xB0, 0xC9, 0xFE, 0x69, 0x5E, 0xAF, 0x94, 0x9B                }))        {            If (LEqual (Arg1, One))            {                If (LEqual (Arg2, Zero))                {                    Store (Buffer (One)                        {                            0x03                        }, Arg4)                    Return (One)                }                If (LEqual (Arg2, One))                {                    Return (One)                }            }        }        Store (Buffer (One)            {                0x00            }, Arg4)        Return (Zero)    }

Hopes this help. Good luck. :dev:

kizwan





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy