Jump to content

DSDT editor and patcher


oldnapalm
 Share

999 posts in this topic

Recommended Posts

:D

Device (SATA)
           {
               Name (_ADR, 0x001F0002)
               Method (_DSM, 4, NotSerialized)
               {
                   Store (Package (0x02)
                       {
                           "device-id", 
                           Buffer (0x04)
                           {
                               0x22, 0x3A, 0x00, 0x00
                           }
                       }, Local0)
                   DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                   Return (Local0)
               }
           }

Link to comment
Share on other sites

Waiting to be eliminated with a simple script in the DSDT Editor.

 

Is there really a simple method of scraping out an unused code? Now that would be the ultimate DSDT Editor, that would somehow translate the code of devices and list them in simple view and you could simply delete out the stuff you dont need.

 

Since it seams you know alot about this, would you mind telling which line code corresponds to PCIE lanes in DSDT? I found a cleaned up version of mine DSDT, but the user has deleted one of the PCIE slots which he didnt use.

 

I have attached bot DSDTs, mine has all the things working, the micro one is missing the PCIE. I have been comparing both in Editor but I cant find which line of code I need to copy over to micro to enable the second PCIE.

DSDT_my.dsl.zip

DSDT_micro.dsl.zip

Link to comment
Share on other sites

Is there really a simple method of scraping out an unused code? Now that would be the ultimate DSDT Editor, that would somehow translate the code of devices and list them in simple view and you could simply delete out the stuff you dont need.

Sorry. There is no simple way yet. At least not to my knowledge. The best way for now is to look at other peoples work. Which is clearly what the guy did with the attached "micro" DSDT (based on Master Chief's work). Too bad your guy didn't complete his work. Still room for improvements.

 

Since it seams you know alot about this, would you mind telling which line code corresponds to PCIE lanes in DSDT? I found a cleaned up version of mine DSDT, but the user has deleted one of the PCIE slots which he didnt use.

Oh he ripped out a number of things alright, like: PPBn, RP05, RP06, P0P4 and P0P5. Which is exactly what Chief did when he introduced his extremely_insane DSDT. The main problem however is that it... well you already run into it. It breaks stuff.

 

BTW: He also renamed MCDP to DTGP which is plain wrong (and I'm not even talking about credits here) because the two methods are not inter-operable. Your turn to correct this when you're at it.

 

I have attached bot DSDTs, mine has all the things working, the micro one is missing the PCIE. I have been comparing both in Editor but I cant find which line of code I need to copy over to micro to enable the second PCIE.

Here's a TIP: Use diff -uw my_dsdt.dsl stripped_dsdt.dsl next time. That will show you what changed.

 

And by the time you reach ~8KB of DSL code (to get the 2KB AML file you want) you nailed it. Good luck!

 

Here are a few links, that might be helpful to you:

http://www.insanelymac.com/forum/index.php...t&p=1280888

http://www.insanelymac.com/forum/index.php?showtopic=192518

http://www.insanelymac.com/forum/index.php?showtopic=62111

 

@MaLd0n: That's more like it. I however don't use DTGP anymore (too many arguments). And line madness would make me use Unicode instead of the buffer :P

 

p.s. I barely have time enough to maintain my own hack, and learn new stuff, so I cannot help other people. Sorry.

Link to comment
Share on other sites

Thanks for the info. I thought that this would be too much for me. For the time I would need to put into this I rather buy myself a MacPro, but till then I will stay with my "big" DSDT as it has everything working (sleep, auto-sleep, quick shutdown, restart and restart after sleep, speedstep, fully working AD2000b audio, fw) with only one kext (fakesmc)

Link to comment
Share on other sites

@El Coniglio & @oldnapalm,

 

Good job as usual. Because this is the best DSDT editor, I already introduced this application on another forum (outside OSX community). There are a lot of people out there modifying their DSDT for windows & linux. Usually they focused on fan control, cpu speedstep & undervolting. Of course this is outside DSDT editor objective but because of the structure view, it would be excellent editor for all people.

 

These are my request for next release (not critical):-

- Remark (involved _T_0 & _T_1): Use of compiler reserved name (_T_0)

Name (_T_0, Zero)
  Fix: Name (T_0, Zero)

- Warning: Possible operator timeout is ignored

Acquire (MUTE, 0x03E8)
  Fix: Acquire (MUTE, 0xFFFF)

- Warning: Result is not used, operator has no effect

And (CTRL, 0x1E)
  Fix: And (CTRL, 0x1E, CTRL)

Link to comment
Share on other sites

WoW

 

Great Job

:(

 

 

@El Coniglio & @oldnapalm,

 

Good job as usual. Because this is the best DSDT editor, I already introduced this application on another forum (outside OSX community). There are a lot of people out there modifying their DSDT for windows & linux. Usually they focused on fan control, cpu speedstep & undervolting. Of course this is outside DSDT editor objective but because of the structure view, it would be excellent editor for all people.

 

These are my request for next release (not critical):-

- Remark (involved _T_0 & _T_1): Use of compiler reserved name (_T_0)

Name (_T_0, Zero)
  Fix: Name (T_0, Zero)

- Warning: Possible operator timeout is ignored

Acquire (MUTE, 0x03E8)
  Fix: Acquire (MUTE, 0xFFFF)

 

- Warning: Result is not used, operator has no effect

And (CTRL, 0x1E)
  Fix: And (CTRL, 0x1E, CTRL)

 

Hi kizwan

 

it should work

hope so

 

into_all all code_regex _T_0 replaceall_matched begin T_0 end

 

into_all all code_regex (Acquire\s\(MUTE,\s0x)....\)
replace_matched
begin
%1FFFF)
end

 

into_all all code_regex And\s\(CTRL,\s0x1E\) replaceall_matched
begin
And (CTRL, 0x1E, CTRL)
end

 

1 and 2 have in the topic

the latter not

work well

Link to comment
Share on other sites

Is there a script to change this:

			Method (_PRT, 0, NotSerialized)
		{
			If (PICM)
			{
				Return (AR00)
			}

			Return (PR00)
		}

into this one liner:

			Alias (AR00, _PRT)

And remove all blocks like this one:

        Name (PR00, Package (0x2A)
       {
           Package (0x04)
           {
               0x0001FFFF, 
               Zero, 
               LNKA, 
               Zero
           },

           ...
       }

Where (nn) in ARnn and PRnn can be anything. This way people could start doing some automated cleanups (based on MC's work). Is this a good idea?

 

Additional requests:

I would love to see a (Perl) script for reformatting the IRQ routing tables. They currently look like this:

        Name (AR07, Package (0x04)
       {
           Package (0x04)
           {
               0xFFFF, 
               Zero, 
               Zero, 
               0x13
           }, 

           Package (0x04)
           {
               0xFFFF, 
               One, 
               Zero, 
               0x10
           }, 

           Package (0x04)
           {
               0xFFFF, 
               0x02, 
               Zero, 
               0x11
           }, 

           Package (0x04)
           {
               0xFFFF, 
               0x03, 
               Zero, 
               0x12
           }
       })

Which i way too long for my taste. I want it the way MC did it aka:

		Name (AR07, Package (0x04)
	{
		Package (0x04) { 0xFFFF, Zero, Zero, 0x13 }, 
		Package (0x04) { 0xFFFF, One,  Zero, 0x10 }, 
		Package (0x04) { 0xFFFF, 0x02, Zero, 0x11 }, 
		Package (0x04) { 0xFFFF, 0x03, Zero, 0x12 }
	})

Saving me a bunch of lines. Can this be done?

 

I also want this:

					Method (_STA, 0, NotSerialized)
				{
					Return (0x0F)
				}

To be changed into this one liner:

					Name (_PS0, 0x0F)

Because that saves me additional bytes of AML code.

Link to comment
Share on other sites

Anyone with more experience than me, i've done simple hacks to my dsdt. I just can't work out the nvidia hack, I can't figure out where to paste the new code, i have no pegp, agp or igp. please help! if sonmeone could just paste in the code then I can fill in the nvcap and cosmetics!!

 

grpahicsenabler is working but my desktop picture is patchy at 1366x768 native, I'm sure this just needs the correct dsdt info for display

 

cheers

DSDT.aml_2.zip

Link to comment
Share on other sites

@dutchhockeypro

 

For the next release el coniglio will implement "Name" as a tree node, so you will be able to do that kind of changes.

 

 

@surfstu

 

Look in IORegistryExplorer where to insert the patch (P0P2@1 in the example)

ioreg.png

If you can't change resolutions in system preferences, most likely GraphicsEnabler didn't work, or kext NVDAResman is not working.

Link to comment
Share on other sites

If you can't change resolutions in system preferences, most likely GraphicsEnabler didn't work, or kext NVDAResman is not working.

Or it failed to retrieve correct EDID value from the monitor. If it is true, surfstu can try display override to inject correct EDID value for the monitor.

 

Hi kizwan

 

it should work

hope so

 

into_all all code_regex _T_0 replaceall_matched begin T_0 end

 

into_all all code_regex (Acquire\s\(MUTE,\s0x)....\)
replace_matched
begin
%1FFFF)
end

 

into_all all code_regex And\s\(CTRL,\s0x1E\) replaceall_matched
begin
And (CTRL, 0x1E, CTRL)
end

@MaLd0n,

 

Thank you for the patch script. :D However, if I'm not asking too much, since it is common warning & remark messages we got when compiling DSDT, I would like to see it can be fix when pressing the fix button.

Link to comment
Share on other sites

However, if I'm not asking too much, since it is common warning & remark messages we got when compiling DSDT, I would like to see it can be fix when pressing the fix button.

It can be easily implemented as an 'auto-fix', but I asked oldnapalm if fixing warnings and remark would make any difference, he stated "no". Do you agree? Do fixing (as when adding useless returns just to remove the compiler message) have a chance to mess something up in some cases?

Link to comment
Share on other sites

It can be easily implemented as an 'auto-fix', but I asked oldnapalm if fixing warnings and remark would make any difference, he stated "no". Do you agree? Do fixing (as when adding useless returns just to remove the compiler message) have a chance to mess something up in some cases?

Even though it doesn't make any differences, I still think it is nice to add it to auto-fix. Fixing something useless, for example adding return code just to satisfy the compiler won't cause any problem. I haven't found any problem yet because of it (fixing something useless). Anyway, to be honest, "useless" is not precise word here. Just because we don't completely understand it, it doesn't mean it is useless. Not before it proved useless. :D

 

Anyway, this is my personal opinion. Just saying out loud here. :wacko:

Link to comment
Share on other sites

@oldnapalm: Good news!

Actually there's a problem with this change, the existing patches which use code_regex to patch "Name" will have to be rewritten. The packs organized by Maldon would require changes to work with the new version. I was thinking about the packs including only the name of generic patches, so it would be easy to update all packs when generic patches need changes.

 

@el coniglio

 

About fixing warnings and remarks, if it's simple to implement and doesn't cause problems, why not doing it, even if it's not needed? I think many people will like it.

Link to comment
Share on other sites

@el coniglio

 

About fixing warnings and remarks, if it's simple to implement and doesn't cause problems, why not doing it, even if it's not needed? I think many people will like it.

 

Yep

\õ>

 

Seria Legal ;)

Link to comment
Share on other sites

@oldnapalm

 

thanks for the reply, think you may have misunderstood me, or maybe it was I who did not explain too well

 

my laptop screen max resolution is 1366x768 but i can change this in display preferences, qe/ci works so i think graphicsenabler is working. however i'm sure the screen is patchy or pixelated, i can see the screen fine but i know it is not perfect. i wandered if a dsdt edit for graphics would help osx know which display i'm using

post-375704-1288914335_thumb.png

 

and my dsdt is

 

:(DSDT.aml.zip

 

@kizwan

 

still learning, thanks for reply - I looked at display overide. Is it necessary to have IODisplayEDID in ioreg?

 

does mac osx need this?

 

cheers stuart

Link to comment
Share on other sites

You should add the method _DSM in device VGA (inside PCI0 - P0P2)

 

Example (nVidia GeForce 9800 GTX)

# Insert method _DSM into device VGA
#
into method label _DSM parent_label VGA remove_entry;
into device label VGA parent_adr 0x00010000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
   Store (Package (0x18)\n
       {\n
           "@0,compatible", \n
           Buffer (0x0B)\n
           {\n
               "NVDA,NVMac"\n
           }, \n
           "@0,device_type", \n
           Buffer (0x08)\n
           {\n
               "display"\n
           }, \n
           "@0,name", \n
           Buffer (0x0F)\n
           {\n
               "NVDA,Display-A"\n
           }, \n
           "@1,compatible", \n
           Buffer (0x0B)\n
           {\n
               "NVDA,NVMac"\n
           }, \n
           "@1,device_type", \n
           Buffer (0x08)\n
           {\n
               "display"\n
           }, \n
           "@1,name", \n
           Buffer (0x0F)\n
           {\n
               "NVDA,Display-B"\n
           }, \n
           "NVCAP", \n
           Buffer (0x14)\n
           {\n
               /* 0000 */    0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, \n
               /* 0008 */    0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, \n
               /* 0010 */    0x00, 0x00, 0x00, 0x00\n
           }, \n
           "NVPM", \n
           Buffer (0x1C)\n
           {\n
               /* 0000 */    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \n
               /* 0008 */    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \n
               /* 0010 */    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \n
               /* 0018 */    0x00, 0x00, 0x00, 0x00\n
           }, \n
           "VRAM,totalsize", \n
           Buffer (0x04)\n
           {\n
               0x00, 0x00, 0x00, 0x20\n
           }, \n
           "device_type", \n
           Buffer (0x0C)\n
           {\n
               "NVDA,Parent"\n
           }, \n
           "model", \n
           Buffer (0x18)\n
           {\n
               "nVidia GeForce 9800 GTX"\n
           }, \n
           "rom-revision", \n
           Buffer (0x26)\n
           {\n
               "nVidia GeForce 9800 GTX OpenGL Engine"\n
           }\n
       }, Local0)\n
   DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
   Return (Local0)\n
}
end

Link to comment
Share on other sites

@kizwan

 

still learning, thanks for reply - I looked at display overide. Is it necessary to have IODisplayEDID in ioreg?

 

does mac osx need this?

Yes. If you look in Apple IOReg (MacBook, iMac, etc), you can see IODisplayEDID. What do you see in AppleDisplay?

Link to comment
Share on other sites

...

# Insert method _DSM into device VGA
#
into method label _DSM parent_label VGA remove_entry;
into device label VGA parent_adr 0x00010000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
   Store (Package (0x18)\n
       {\n
           "@0,compatible", \n
           Buffer (0x0B)\n
           {\n
               "NVDA,NVMac"\n
           }, \n
           "@0,device_type", \n
           Buffer (0x08)\n
           {\n
               "display"\n
           }, \n
           "@0,name", \n
           Buffer (0x0F)\n
           {\n
               "NVDA,Display-A"\n
           }, \n
           "@1,compatible", \n
           Buffer (0x0B)\n
           {\n
               "NVDA,NVMac"\n
           }, \n
           "@1,device_type", \n
           Buffer (0x08)\n
           {\n
               "display"\n
           }, \n
           "@1,name", \n
           Buffer (0x0F)\n
           {\n
               "NVDA,Display-B"\n
           }, \n
           "NVCAP", \n
           Buffer (0x14)\n
           {\n
               /* 0000 */    0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, \n
               /* 0008 */    0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, \n
               /* 0010 */    0x00, 0x00, 0x00, 0x00\n
           }, \n
           "NVPM", \n
           Buffer (0x1C)\n
           {\n
               /* 0000 */    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \n
               /* 0008 */    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \n
               /* 0010 */    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \n
               /* 0018 */    0x00, 0x00, 0x00, 0x00\n
           }, \n
           "VRAM,totalsize", \n
           Buffer (0x04)\n
           {\n
               0x00, 0x00, 0x00, 0x20\n
           }, \n
           "device_type", \n
           Buffer (0x0C)\n
           {\n
               "NVDA,Parent"\n
           }, \n
           "model", \n
           Buffer (0x18)\n
           {\n
               "nVidia GeForce 9800 GTX"\n
           }, \n
           "rom-revision", \n
           Buffer (0x26)\n
           {\n
               "nVidia GeForce 9800 GTX OpenGL Engine"\n
           }\n
       }, Local0)\n
   DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))\n
   Return (Local0)\n
}
end

Do you have a Perl script to transform DSL blocks, or are you doing everything by hand when you make these scripts? If yes; care to share it? If not... time to write a simple Perl script maybe?

Link to comment
Share on other sites

@El Coniglio & @oldnapalm

 

I notice that the patches directory is missing a few patch!

 

Remove Devices

HID/CID

Rename Devices

SBus

Shutdown

EHCI

 

 

i have attach a few to add to the program.

_T_x_rename.txt

Buffer_Fix.txt

Invalid_Length_of_min_max_flags.txt

Operator_Timeout.txt

Mac_devices.txt

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...