# What's CFG-Lock?

Most motherboard vendors lock the MSR 0xE2 register, this is known as CFG-Lock, vendors might add an option to disable CFG-Lock within the UEFI menu, but it is not always the case. The XNU kernel requires access to this register for full CPU power management, Apple firmwares clearly has the register unlocked. Without it, we need some OpenCore kernel patches (setting AppleCpuPmCfgLock and AppleXcpmCfgLock quirks to TRUE, both enabled by default from the source files) to boot. It might be an unstable solution depending on the machine and will most likely lead to semi-working power management. It is highly recommended to unlock write access to the register.

Following dreamwhite's guide (opens new window) you find

CFG Lock, VarStoreInfo (VarOffset/VarName): 0x5BD

0x5BD is the offset of CFG Lock boolean bit. This offset is motherboard specific! Do not attempt to use it with another computer rather than a Dell G7 7588

Setting this variable value with 0x00 the CFG Lock will be disabled, granting access to MSR 0xE2 registry.

# Set CFG-Lock to 0x00

We will pretty much modify a UEFI setting but from a terminal because no such option is provided in the UEFI GUI, to accomplish so, booting a custom shell is required, it is included as an OpenCore tool, so there is no need to create a boot entry for it. Reboot to OpenCore picker and use the keys to select modGRUBShell.efi (driver for the shell we need to launch) and press enter to boot to the shell.

When ready to input commands type setup_var 0x5BD 0x00 and press return. For any other laptop model, replace 0x5BD with your motherboard specific offset.

The output should be:

Looking for Setup variables...
var name: Setup, var size: 12, var guid: ec87d643-eba4-4bb5 - a1-e5-3f-3e-36-b2-0d-a9

--> GUID does not match expected GUID, taking it nevertheless...
expected a different size of the Setup variable (got 5799 (0x16a7) bytes). Continue with care...
successfully obtained "Setup" variable from VSS (got 5799 (0x16a7) bytes).
offset 0x5bd is: 0x01
setting offset 0x5bd to 0x00
grub> _

An alternative way to unlock it and might be easier for everyone because the user only needs to input a single key. This is achieved is using Brumbaers CFG Unlock tool, for this, pick CFGUnlock.efi at the OpenCore picker and you will be shown this text:

Brumbaers CFG Unlock
1. 05 05BD 0001 /CFG Lock/ VarStore Name: Setup

Exactly 1 CFG Variable found: CFG Lock
In VarStore "Setup" GUID: EC87D643-EBA4-4BB5 - A1-E5-3F-3E-36-B2-0D-A9 Offset: 05BD Size: 1

Variable read: value 1
Do you want to toggle the value y/n ?

After the above message is displayed, press the key "y" to let the tool know you want to change the binary value from 1 to 0 and it will then display

Done. You will have to reboot for the change to take effect.

The End. Press a key.

Now you can either hold the power button to force a shutdown which is easier or you can press a key to be taken to the OpenCore picker and find the shutdown, then simply restart.

# Cleaning up

You should now have CFG-Lock disabled and can set to false both, AppleCpuPmCfgLock and AppleXcpmCfgLock kernel quirks in the OpenCore config.plist file. We can also get rid of the tools used in the CFG-Lock section, for that open the OpenCore configuration file config.plist with a plist editor like PlistEdit Pro and Navigate to Misc/Boot and find the child key HideAuxiliary, set it to Yes/True/1 depending on the software you use to edit the file. Aditionally, if you only have one operating system, if you want to hide the OpenCore picker and set the child key ShowPicker to No/False/0.

# Can't boot macOS?

Being unable to boot by only modifying the above kernel quirks it must be due to a XNU kernel panic because without the above quirks, it tries to write MSR 0xE2, yet; it cannot (that means cfg-lock has not been successfully disabled).

You could also verify the above by launching VerifyMsrE2.efi tool included with OpenCore. and checking the last line it outputs, if everything was correct, it will show:

This firmware has UNLOCKED MSR 0xE2 register!
  • CFG-Lock will re-enable every time you update the firmware or reset it's settings so re-run setup_var 0x5BD 0x00.