Jump to content
500 posts in this topic

Recommended Posts

8 hours ago, Stezza88 said:

 

Have you got a raptor lake A7A0 card too? @jkbuha

Yes, my production XPS 9730 (Raprtor Lake) does have that card. But the test machine I'm compiling this kext on is the XPS 9520 Alder lake, which has the 46A6 card.

 

The reason why I'm using the test machine not the (A7A0) production machine is that repeated resets have corrupted the keychain logins on the 46A6 machine and I dont want to corrupt a production machine atm.

 

With your latest kext, the machine never boots GUI (or even a black screen) because presumably it's looking for the A7A0 ID. I'll play around with the source code to see if I can change the IDs to match 46A6...

I changed r3 to this

static const uint8_t r3[]= {
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
			0x02, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0xc1, 0x02, 0x00, 0x00,
			0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0xc1, 0x02, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

and got kp .. in 0xffffff7f96a490c7 com.xxxxx.driver.AppleIntelTGLGraphicsFramebuffer : __ZN24AppleIntelBaseController35hwCRTCToIODetailedTimingInformationEP21AppleIntelFramebufferP29IODetailedTimingInformationV2 + 0x499

Kernel-2024-11-18-222332.panic

 

Now I add

{"__ZN24AppleIntelBaseController35hwCRTCToIODetailedTimingInformationEP21AppleIntelFramebufferP29IODetailedTimingInformationV2", releaseDoorbell}

trying to resolve..

Edited by Stezza88
5 hours ago, Stezza88 said:

I did this, boot on black screen with square mouse xD (commenting hwConfigureCustomAUX call)

 

image.png.7d6e78db9ff50bd60c84946d1366ee8a.png

x.log 2.53 MB · 0 downloads

 

this setup is you best option. the logs only show wrong pixelclock value (we had 2 patches to try fix this - agdc function and 1 patch with bytes)

the 1st connector is working 

 

if i have to guess from linux log i would try this patch

i tested this and cause it is not my hardware i got port probe errors

image.thumb.png.5672adf1a48fad3f3d382b3e56e161ae.png

 

the issue is when driver reach this log line

 

kernel[0]: (AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 4579 ][setGammaTable       ] (channelCount=3, dataCount=1024, dataWidth=10, data=0xffffff99f7217800) fCRTCIndex=0 syncToVBL=1
 

it just stops there. on a tgl working display this line repeats and ends with

 

kernel[0]: (AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 4579 ][setGammaTable       ] (channelCount=3, dataCount=1024, dataWidth=10, data=0xffffffa9cf282000) fCRTCIndex=0 syncToVBL=0

 

so question is why is this not working on raptor lake

 

try patch this part of code (camellia call). change 0x74, 0x5e to 0xeb, 0x5e so it jumps the call

 

image.thumb.png.4645926d5472df8cd212e5bc925e2a9f.png

 

you can try other things but the start point is a full working log with no hangs or log lines missing

try add missing addresses for adl firmware. they are in your linux logs

disable hwConfigureCustomAU call if it helps - enable hwConfigureCustomAUX() in nblue

 

start from latest nblue source code as i keep updating code

Edited by jalavoui

Added registers

void Gen11::hwInitializeCState()
{
	FunctionCast(hwInitializeCState, callback->ohwInitializeCState)( );
	
	//some adlp addresses
	NBlue::callback->writeReg32(0x8f074,0x86fc0);
	NBlue::callback->writeReg32(0x8f034,0xc003b400);
	NBlue::callback->writeReg32(0x8f004,0x1240108);
	NBlue::callback->writeReg32(0x8f008,0x512050d4);
	NBlue::callback->writeReg32(0x8f03c,0xc003b300);
	NBlue::callback->writeReg32(0x8f00c,0x584c57fc);
	NBlue::callback->writeReg32(0x5f074,0x96fc0);
	NBlue::callback->writeReg32(0x5f034,0xc003df00);
	NBlue::callback->writeReg32(0x5f004,0x214c2114);
	NBlue::callback->writeReg32(0x5f038,0xc003e000);
	NBlue::callback->writeReg32(0x5f008,0x22402208);
	NBlue::callback->writeReg32(0x5f03c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f00c,0x241422fc);
	NBlue::callback->writeReg32(0x5f040,0xc0033100);
	NBlue::callback->writeReg32(0x5f010,0x26f826cc);
	NBlue::callback->writeReg32(0x5f474,0x9efc0);
	NBlue::callback->writeReg32(0x5f434,0xc003df00);
	NBlue::callback->writeReg32(0x5f404,0xa968a930);
	NBlue::callback->writeReg32(0x5f438,0xc003e000);
	NBlue::callback->writeReg32(0x5f408,0xaa5caa24);
	NBlue::callback->writeReg32(0x5f43c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f40c,0xac30ab18);
	NBlue::callback->writeReg32(0x5f440,0xc0033100);
	NBlue::callback->writeReg32(0x5f410,0xaf14aee8);
	NBlue::callback->writeReg32(0x5f874,0x53fc0);
	NBlue::callback->writeReg32(0x5f83c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f80c,0x25202408);
	NBlue::callback->writeReg32(0x5f840,0xc0033100);
	NBlue::callback->writeReg32(0x5f810,0x280427d8);
	NBlue::callback->writeReg32(0x5fc3c,0xc0032c00);
	NBlue::callback->writeReg32(0x5fc0c,0x95209408);
	NBlue::callback->writeReg32(0x5fc40,0xc0033100);
	NBlue::callback->writeReg32(0x5fc10,0x980497d8);
	
	NBlue::callback->writeReg32(0x60400,0x8a000006);
	NBlue::callback->writeReg32(0x60000,0x0a9f09ff);
	NBlue::callback->writeReg32(0x60004,0x0a9f09ff);
	NBlue::callback->writeReg32(0x60008,0x0a4f0a2f);
	NBlue::callback->writeReg32(0x6000c,0x06d5063f);
	NBlue::callback->writeReg32(0x60010,0x06d50000);
	NBlue::callback->writeReg32(0x60014,0x06480642);
	NBlue::callback->writeReg32(0x60028,0x00000000);
	NBlue::callback->writeReg32(0x60030,0x7e5d159e);
	NBlue::callback->writeReg32(0x60034,0x00800000);
	NBlue::callback->writeReg32(0x60040,0x0007c1cd);
	NBlue::callback->writeReg32(0x60044,0x00080000);
	NBlue::callback->writeReg32(0xc7204,0x00000067);
	NBlue::callback->writeReg32(0xc7208,0x07d00001);
	
	NBlue::callback->writeReg32(0x46140,0x10000000);
	NBlue::callback->writeReg32(0x45400,0x00000401);
	NBlue::callback->writeReg32(0x45404,0x00000c03);
	NBlue::callback->writeReg32(0x45408,0x40000000);
	NBlue::callback->writeReg32(0x4540c,0x00000401);
	
	//common
	NBlue::callback->writeReg32(0x45520,2);
	
	hwConfigureCustomAUX(ccont,true);
}

Got finally

(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 4579 ][setGammaTable       ] (channelCount=3, dataCount=1024, dataWidth=10, data=0xffffff99d1044800) fCRTCIndex=0 syncToVBL=1
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 4579 ][setGammaTable       ] (channelCount=3, dataCount=1024, dataWidth=10, data=0xffffff99d1044800) fCRTCIndex=0 syncToVBL=0

Log starts at 11:04:35.394634+0100, boot on black screen with square mouse

x.log kern_gen11.cpp

 

[EDIT] I have obtained only one time this result, at next boot with same configs I've not obtained the second syncToVBL=0 but only one row with syncToVBL=1

Very strange..

Edited by Stezza88

Updated at last version.. sometimes the second call to set gammatable syncToVBL=0 comes Called and sometimes not... this time not.

weird, have tried the different conn patches you proposed to me and the patch to camelia, nothing changed

x.log kern_gen11.cpp

Edited by Stezza88

on linux you will find code like this

 

if (DISPLAY_VER(dev_priv) == 13)

 

os x tgl driver seems to miss those fixes and addresses. until  DISPLAY_VER 12 things kinda work

but for DISPLAY_VER +13 they don't

 

solution is look at linux and try fix tgl os x code

 

but since you still use this bad hack

__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj

 

nvm linux

Edited by jalavoui

Might be lock or signaling mechanism, it literally says doorbell...it's something to do with power states, the function itself could probably just be setting the power well to the expected state. That could be why it bypasses the boot hang.

But you don't have the need of this doorbell.. so in your system the powerwellstate is already configured with the expected state.. and in mine not.. it's strange..

Edited by Stezza88

remove that call to {"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},

and try this patch

 

find

0f 84 1c 01 00 00 48 ff 05 62 20 0d 00 41 f6 c6 04 0f 85 0b 01 00 00

 

rep

48 e9 1c 01 00 00 48 ff 05 62 20 0d 00 41 f6 c6 04 0f 85 0b 01 00 00

 

patch is based on

image.png.d8410d64de0d1dfe00c282a9690df724.png

 

the linux logs are consistent with this settings

image.png.d8eaaa7801b50280a3829af875452645.png

 

image.png.bafc4c3725b18d165356c0a68200f7d4.png

 

image.png.59c9998bfbade9dff2cdf0377a5c2925.png

 

as for the registers that need tobe changed idk. hope someone find them

 

here's the linux log with the card id

image.png.9ed4e7822d7c5de5d1ba2c3e4860fa0a.png

 

+

 

image.png.3f49a7e1a6da698ede0435f6f22c6b2d.png

 

image.png.9faa455942e695d564d87c96183b7da8.png

 

the platform is ALDERLAKE_P but the gpu id is

image.png.84e02b823d5549413345274bab2d6745.png

 

more linux code to check...

Edited by jalavoui
38 minutes ago, jalavoui said:

remove that call to {"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},

and try this patch

 

find

0f 84 1c 01 00 00 48 ff 05 62 20 0d 00 41 f6 c6 04 0f 85 0b 01 00 00

 

rep

48 e9 1c 01 00 00 48 ff 05 62 20 0d 00 41 f6 c6 04 0f 85 0b 01 00 00

 

patch is based on

image.png.d8410d64de0d1dfe00c282a9690df724.png

 

and there's this possibility also

image.png.d8eaaa7801b50280a3829af875452645.png

 

image.png.bafc4c3725b18d165356c0a68200f7d4.png

 

 

 

as for the registers that need tobe changed idk. hope someone find them

 

here's the linux answer

image.png.9ed4e7822d7c5de5d1ba2c3e4860fa0a.png

 

+

 

image.png.3f49a7e1a6da698ede0435f6f22c6b2d.png

 

image.png.9faa455942e695d564d87c96183b7da8.png

 

you can start looking for ALDERLAKE_P linux fixes and display 13 fixes

 

I think i'm unable to do anything of what you say XD i'm an half developer i think

Edited by Stezza88

With my logs i Hope to help you to find a way to make a driver for all of these generations so to be more general purpose possible.. if you create a driver that cover and works for all of these gens i think you can achieve some Money also.. and i think that i've learned few things from you which was important to me..

Edited by Stezza88

hang on boot ? did you remove tgl graph card ids from nblue ? (mean only use card id on tgl frame and leave others empty)

 

looking at linux code better keep

 

{"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},

 

till a better solution come out. i'll test this on tgl maybe not important at framebuffer stage

 

display 13 checks...

linux as lots of code checks like in this sample for display >=13

image.png.d496d60628251bacd9d304c2776ab7bf.png

 

question here is what will need tobe changed in mac os x tgl so it can work ?

 

Edited by jalavoui
  • Like 1

What do you mean for "did you remove tgl graph card ids from nblue ?" I removed all ids in gen7tgl, tglle and put mine 0xA7A08086 in tglle

 

Mmio base means the base where the register locations are starting? And infact my linux syslog confirm that i'm in version >= 13, infact the base is 0x5f000.. or i tell wrong?

//some adlp addresses
	NBlue::callback->writeReg32(0x8f074,0x86fc0);
	NBlue::callback->writeReg32(0x8f034,0xc003b400);
	NBlue::callback->writeReg32(0x8f004,0x1240108);
	NBlue::callback->writeReg32(0x8f008,0x512050d4);
	NBlue::callback->writeReg32(0x8f03c,0xc003b300);
	NBlue::callback->writeReg32(0x8f00c,0x584c57fc);
	NBlue::callback->writeReg32(0x5f074,0x96fc0);
	NBlue::callback->writeReg32(0x5f034,0xc003df00);
	NBlue::callback->writeReg32(0x5f004,0x214c2114);
	NBlue::callback->writeReg32(0x5f038,0xc003e000);
	NBlue::callback->writeReg32(0x5f008,0x22402208);
	NBlue::callback->writeReg32(0x5f03c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f00c,0x241422fc);
	NBlue::callback->writeReg32(0x5f040,0xc0033100);
	NBlue::callback->writeReg32(0x5f010,0x26f826cc);
	NBlue::callback->writeReg32(0x5f474,0x9efc0);
	NBlue::callback->writeReg32(0x5f434,0xc003df00);
	NBlue::callback->writeReg32(0x5f404,0xa968a930);
	NBlue::callback->writeReg32(0x5f438,0xc003e000);
	NBlue::callback->writeReg32(0x5f408,0xaa5caa24);
	NBlue::callback->writeReg32(0x5f43c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f40c,0xac30ab18);
	NBlue::callback->writeReg32(0x5f440,0xc0033100);
	NBlue::callback->writeReg32(0x5f410,0xaf14aee8);
	NBlue::callback->writeReg32(0x5f874,0x53fc0);
	NBlue::callback->writeReg32(0x5f83c,0xc0032c00);
	NBlue::callback->writeReg32(0x5f80c,0x25202408);
	NBlue::callback->writeReg32(0x5f840,0xc0033100);
	NBlue::callback->writeReg32(0x5f810,0x280427d8);
	NBlue::callback->writeReg32(0x5fc3c,0xc0032c00);
	NBlue::callback->writeReg32(0x5fc0c,0x95209408);
	NBlue::callback->writeReg32(0x5fc40,0xc0033100);
	NBlue::callback->writeReg32(0x5fc10,0x980497d8);
	
	NBlue::callback->writeReg32(0x60400,0x8a000006);
	NBlue::callback->writeReg32(0x60000,0x0a9f09ff);
	NBlue::callback->writeReg32(0x60004,0x0a9f09ff);
	NBlue::callback->writeReg32(0x60008,0x0a4f0a2f);
	NBlue::callback->writeReg32(0x6000c,0x06d5063f);
	NBlue::callback->writeReg32(0x60010,0x06d50000);
	NBlue::callback->writeReg32(0x60014,0x06480642);
	NBlue::callback->writeReg32(0x60028,0x00000000);
	NBlue::callback->writeReg32(0x60030,0x7e5d159e);
	NBlue::callback->writeReg32(0x60034,0x00800000);
	NBlue::callback->writeReg32(0x60040,0x0007c1cd);
	NBlue::callback->writeReg32(0x60044,0x00080000);
	NBlue::callback->writeReg32(0xc7204,0x00000067);
	NBlue::callback->writeReg32(0xc7208,0x07d00001);
	
	NBlue::callback->writeReg32(0x46140,0x10000000);
	NBlue::callback->writeReg32(0x45400,0x00000401);
	NBlue::callback->writeReg32(0x45404,0x00000c03);
	NBlue::callback->writeReg32(0x45408,0x40000000);
	NBlue::callback->writeReg32(0x4540c,0x00000401);
Edited by Stezza88

I forgot to uncomment customAUX method, but something is changed in the result, like the scale of the square mouse that now is appropriated.. always boot on black screen

Here calculated current pixelclock etc values are correct

 

(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelController.cpp : 6001 ][hwCRTCToIODetailedTi] pixelClock = 787400000
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelController.cpp : 6096 ][hwCRTCToIODetailedTi] return
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod] Current:
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  active h=2560, v=1600
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  scaled h=0, v=0
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  pixelClock 787400000
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  scalerFlags 0
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  signalConfig 0

 

Adding only

{"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},

kern_gen11.cpp x.log

Edited by Stezza88

Adding some requests to resolve some kp

{"__ZN19AppleIntelPowerWell21hwSetPowerWellStatePGEbj",releaseDoorbell},
{"__ZN24AppleIntelBaseController35hwCRTCToIODetailedTimingInformationEP21AppleIntelFramebufferP29IODetailedTimingInformationV2", releaseDoorbell},
{"__ZN24AppleIntelBaseController15enableVDDForAuxEP14AppleIntelPort", releaseDoorbell},
{"__ZN24AppleIntelBaseController16hwUpdateRegCacheEP21AppleIntelFramebufferP21AppleIntelDisplayPath",releaseDoorbell},

And changing r3 connector 0 to (because if not were booting in a complete black screen)

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00

I have got various call to setgammatable with syncToVBL=0 at the end of the log, but always boot on black screen with square mouse (with appropriate scale an other time)

 

But now I've got a bug on calculated current pixelclock etc values

(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod] Current:
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  active h=1850933354, v=47729463
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  scaled h=-1788460650, v=-129
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  pixelClock -51418302080
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  scalerFlags 0xffffff80
(AppleIntelTGLGraphicsFramebuffer) [IGFB][DEBUG][DISPLAY   ][AppleIntelFB.cpp         : 2675 ][getCurrentDisplayMod]  signalConfig 0x197c4265

Here the driver was running good

Log starts at 21:47:01.698215+0100

kern_gen11.cpp x.log

Edited by Stezza88
×
×
  • Create New...