OcAfterBootCompatLib: Add `DisableExternalAppleGpu` quirk to disable external GPUs on real Macs
Help Wanted
This does not work as reported at https://github.com/acidanthera/bugtracker/issues/928#issuecomment-1105446248. At this stage debug printing won't work either, making it harder to trace the correct Status code. One possible strategy suggested by @vit9696 is to brute-force it by DirectResetCold (i.e. check if Status == something, then DirectResetCold). However, this takes time. If someone wants to help with this process, I'd really appreciate.
closes https://github.com/acidanthera/bugtracker/issues/928
TODO:
- [ ] Rebuild pdf after merging
MacBookPro8,2 Testing
Tested using a MacBookPro8,2 (2011 15") unit with commit 98c923c305fd4a5881bfdd47b3e0d9d9e997f580, OpenCore will stall out after executing if (BootCompat->Settings.DisableExternalAppleGpu) {} code block. This is seen after End RandomSeed.
Setting the block to only set the variable still stalls the system in the same way:
if (BootCompat->Settings.DisableExternalAppleGpu) {
DisabledGpu = 1U;
Status = gRT->SetVariable (
L"gpu-power-prefs",
&gApplePersonalizationVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
sizeof (DisabledGpu),
&DisabledGpu
);
}
Image reference for stall:

@PMheart Can put exit status in another var, assuming it is even exiting? And can put something else in another var before setting, and something other else in that var if setting exits, to check that?
@khronokernel - probably a stupid suggestion, but what happens if you remove the EFI_VARIABLE_BOOTSERVICE_ACCESS bit from the mask sent to SetVariable?
This could be replaced by https://github.com/acidanthera/OpenCorePkg/pull/390 if testing works out.
EDIT: The approach was not without any merit - e.g. it allowed setting the variable - but testing did not work out, see discussion on closed PR.
Having gone round the houses, I'm now back to thinking that this commit should have been the right way to do it all along, except that it doesn't work! I'll try to PM yourself, pmheart, and Vit to try to work out what the heck we could try next.
EDIT: Actually, I've thought of one more thing to try, based more on the approach of this commit, before I ping you... so I'll do that.
@PMheart - Hi! Is it worth keeping this PR open, for now, given that there remains an open bugtracker issue on this, plus my own failed attempt to do something similar, throwing up further issues, it seems.