Jump to content

Enable IOPCIFamily to set tolerance latency for PCI devices


syscl
 Share

9 posts in this topic

Recommended Posts

Hello, recently I am trying to figure out what cause the data lose during sleep on XPS 13 9350. Thus a lot friends help me and they lent their new MacBookPro for me to dump some information from their laptops.

By comparing the ioreg from their laptops, I found some properties that we miss to inject for our computers. One property I noticed is reg-ltrovr.

This property lies in Device(RP01), Device(RP02), Device(RP03), Device(RP04), ... Device(RP13), ... When we inject "reg-ltrovr" as _DSM method, IOPCIFamily.kext will set latency tolerance offset for each of the latency tolerance devices. This could fix some potential issues(still need to explore more evidence).Here's the patch I wrote for my XPS 13 9350, you can tune it if you have more than 13 RP0X devices

#Created by syscl 
#syscl_ltrovr
#Inject reg-ltrovr for IOPCIFamily::setLatencyTolerance setting ltrOffset for PCI devices successfully (c) syscl
#Tune it if you need
#RP01
#Remove _DSM just in case
into method label _DSM parent_adr 0x001C0000 remove_entry;
into method label XDSM parent_adr 0x001C0000 remove_entry;

#Now inject property: setLantencyTolerance for RP01 credit syscl
into device name_adr 0x001C0000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP02
into method label _DSM parent_adr 0x001C0001 remove_entry;
into method label XDSM parent_adr 0x001C0001 remove_entry;

#Now inject property: setLantencyTolerance for RP02 credit syscl
into device name_adr 0x001C0001 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP03
into method label _DSM parent_adr 0x001C0002 remove_entry;
into method label XDSM parent_adr 0x001C0002 remove_entry;

#Now inject property: setLantencyTolerance for RP03 credit syscl
into device name_adr 0x001C0002 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP04
into method label _DSM parent_adr 0x001C0003 remove_entry;
into method label XDSM parent_adr 0x001C0003 remove_entry;

#Now inject property: setLantencyTolerance for RP04 credit syscl
into device name_adr 0x001C0003 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP05
into method label _DSM parent_adr 0x001C0004 remove_entry;
into method label XDSM parent_adr 0x001C0004 remove_entry;

#Now inject property: setLantencyTolerance for RP05 credit syscl
into device name_adr 0x001C0004 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP06
into method label _DSM parent_adr 0x001C0005 remove_entry;
into method label XDSM parent_adr 0x001C0005 remove_entry;

#Now inject property: setLantencyTolerance for RP06 credit syscl
into device name_adr 0x001C0005 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP07
into method label _DSM parent_adr 0x001C0006 remove_entry;
into method label XDSM parent_adr 0x001C0006 remove_entry;

#Now inject property: setLantencyTolerance for RP07 credit syscl
into device name_adr 0x001C0006 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP08
into method label _DSM parent_adr 0x001C0007 remove_entry;
into method label XDSM parent_adr 0x001C0007 remove_entry;

#Now inject property: setLantencyTolerance for RP08 credit syscl
into device name_adr 0x001C0007 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP09
into method label _DSM parent_adr 0x001D0000 remove_entry;
into method label XDSM parent_adr 0x001D0000 remove_entry;

#Now inject property: setLantencyTolerance for RP09 credit syscl
into device name_adr 0x001D0000 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP10
into method label _DSM parent_adr 0x001D0001 remove_entry;
into method label XDSM parent_adr 0x001D0001 remove_entry;

#Now inject property: setLantencyTolerance for RP10 credit syscl
into device name_adr 0x001D0001 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP11
into method label _DSM parent_adr 0x001D0002 remove_entry;
into method label XDSM parent_adr 0x001D0002 remove_entry;

#Now inject property: setLantencyTolerance for RP11 credit syscl
into device name_adr 0x001D0002 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP12
into method label _DSM parent_adr 0x001D0003 remove_entry;
into method label XDSM parent_adr 0x001D0003 remove_entry;

#Now inject property: setLantencyTolerance for RP12 credit syscl
into device name_adr 0x001D0003 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

#RP13
into method label _DSM parent_adr 0x001D0004 remove_entry;
into method label XDSM parent_adr 0x001D0004 remove_entry;

#Now inject property: setLantencyTolerance for RP13 credit syscl
into device name_adr 0x001D0004 insert
begin
Method (_DSM, 4, NotSerialized)\n
{\n
	If (LEqual (Arg2, Zero))\n
	{\n
		Return (Buffer (One)\n
		{\n
			0x03\n                                           
		})\n
	}\n
	Return (Package (0x02)\n
	{\n
		"reg-ltrovr", \n
		Buffer (0x08)\n
		{\n
			0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00\n
		}\n
	})\n
}\n
end;

Once you finished inject this property successfully, ioreg will give the following result
post-950366-0-37671300-1485410326_thumb.png

Good luck,

syscl

  • Like 5
Link to comment
Share on other sites

Thanks syscl.

Does this can be inject with clover?

 

 

从我的 iPhone 发送,使用 Tapatalk

Give me one second, I will refine it. You can inject it through SSDT as well. I've tested SSDT method to inject as well. 

 

Edited: refine, the patches in #0 can be applied in more general cases now. 

 

syscl

  • Like 1
Link to comment
Share on other sites

This patch it's only for new Hardware? E.g: Skylake and above?

 

I have only 8 RP0x entries...

Hi @Allan, this patch can be applied to other platform as well. I saw MacBookAir6,2 has this property as well[see evidence here].

 

8 RP0x is OK, I just added more RP0X devices for more general cases. You can just apply it and see if this patch work or not.

 

Thank you,

syscl

  • Like 1
Link to comment
Share on other sites

good

 

i checked skylake mbp13,1's  ioreg

like you said, there is reg-ltrovr

 

i applied this in my laptop

post-980913-0-57757600-1486017956_thumb.png

 

thank you

 

add.

i remove "reg-ltrovr"

because

after wakeup, wifi device load is slow. also cause system unstable. i exprienced force reboot.
  • Like 1
Link to comment
Share on other sites

 

good
 
i checked skylake mbp13,1's  ioreg
like you said, there is reg-ltrovr
 
i applied this in my laptop
 
thank you
 
add.
i remove "reg-ltrovr"
because
after wakeup, wifi device load is slow. also cause system unstable. i exprienced force reboot.

 

Thank you @Sherlock, thank you for your report about this important issue.

 

Actually not only MBP13,1 has reg-ltrovr, but also MacBookAir6,2 has. Thus, I think this property must be included early than we imagine.

 

I will test this property on Dell Precision M3800 as well.

 

Thank you,

syscl

Link to comment
Share on other sites

  • 1 month later...

Thank you @Sherlock, thank you for your report about this important issue.

 

Actually not only MBP13,1 has reg-ltrovr, but also MacBookAir6,2 has. Thus, I think this property must be included early than we imagine.

 

I will test this property on Dell Precision M3800 as well.

 

Thank you,

syscl

 

Hi,

Why not to use original code?:

/*** Our _DSM if exists ***/
Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x04) /* increased by 2 */
                        {
                            "built-in",
                            Buffer (One)
                            {
                                Zero
                            },
                            /*
                             *
                             *
*********** new code *********/
                            "reg-ltrovr",
                             Buffer (0x08)
                             {
                                 /* 0000 */    0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                             }
/*****************************/
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }

Older systems (chipsets) may not support Latency Tolerance Reporting (LTR) mechanism.

Ref. e.g. IOPCIFamily-196.35-chipset-3400-chipset-datasheet200-series-chipset-pch-datasheet-vol-1 and 200-series-chipset-pch-datasheet-vol-2.

  • Like 1
Link to comment
Share on other sites

Hi,

Why not to use original code?:

/*** Our _DSM if exists ***/
Method (_DSM, 4, NotSerialized)
                {
                    Store (Package (0x04) /* increased by 2 */
                        {
                            "built-in",
                            Buffer (One)
                            {
                                Zero
                            },
                            /*
                             *
                             *
*********** new code *********/
                            "reg-ltrovr",
                             Buffer (0x08)
                             {
                                 /* 0000 */    0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                             }
/*****************************/
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }

Older systems (chipsets) may not support Latency Tolerance Reporting (LTR) mechanism.

Ref. e.g. IOPCIFamily-196.35-chipset-3400-chipset-datasheet200-series-chipset-pch-datasheet-vol-1 and 200-series-chipset-pch-datasheet-vol-2.

Thank you,

 

Do you mean use original DTGP method? 

 

syscl

Link to comment
Share on other sites

 Share

×
×
  • Create New...