Contribute
Register

Successfully patched Z170X-UD5 TH CFG Lock (MSR Ex02)

Status
Not open for further replies.
Cheers. I can change if you want but it will take some minutes.
 
The command is working. "setup_var_3 0x537" didn't give what you expected "0x1 (or 0x01) is locked, 0x0 (or 0x00) is unlocked".
It gave the same message as the first one Iv'e tried see attached picture:

Wait, doesn't the last line of your picture says offset 0x537 is 0x00?
 
Yep. I see that now. I will run VerifyMSRE2 once again. Hang on!
 
Funny still locked with value 0x00?
 
Offset is now set to 0x00 with your suggested command but when checking with VerifyMSRE2.efi the register is still locked and stuck at boot.
All this is with the new 3003 bios. With the old bios,1202 everything is working and the register is unlocked. Can you have any info from my old firmware?
I have a setting in booth the old and the new to disable MSR Lock Control but that is for MSR 3Ah,MSR 0E2h and CSR 80h. this is of course set as disabled.
 
000
 
Last edited:
How to change hidden CFG Lock setting

I'm going to clarify the procedure how to figure out the offset for CFG Lock setting and how to apply needed change in BIOS.

Please note, it's not exactly patching the BIOS. It's about changing it's hidden variables.



View attachment 367163

If you don't have needed tools, then for first you should acquire these tools. Needed tools are UEFITool and IFR-Extractor. Also you need GRUB Shell to change settings.

Shortly about setup_var
UEFI documentation ((U)EFI = (Unified) Extensible Firmware Interface):


EFI variables can be read and modified in Linux, which is done trough the sys pseudo-filesystem, where EFI varies are mounted at /sys/firmware/efi/efivars. Some GRUB versions supports modifying EFI variable storage space (VSS) via command setup_var, which can take up to two arguments, a variable identifier/offset (0xDF etc) and a value to write to this variable (0x1 etc).

Command setup_var in the modified GRUB can change settings which are stored in the "Setup-{guid}" efivar and with setup_var_2(setup_var_3 settings which are stored in the "Config-{guid}" efivar.

Usage of setup_var
To read current configuration:
Code:
setup_var 0xDF
To write setting
Code:
setup_var 0xDF 0x00

Download tools:
Download BIOS or save it to the disk from BIOS GUI
  • Download BIOS from Gigabyte website (22g) or
  • save it to the disk from your BIOS settings GUI (FAT16 or FAT32 drive is needed for that)
Extract CFG Lock related block from BIOS

Code:
cd ~/Desktop
mkdir cfglockfix
curl -L http://download.gigabyte.eu/FileList/BIOS/mb_bios_ga-z170x-ud5-th_f22g.zip -o bios.zip -s
unzip -a bios.zip
rm autoexec.bat
rm Efiflash.exe
rm bios.zip
curl -L https://github.com/LongSoft/UEFITool/releases/download/t20181011/UEFITool_NE_A52_mac.zip -o uefitool.zip -s
unzip -a uefitool.zip
rm uefitool.zip
curl -L https://github.com/LongSoft/Universal-IFR-Extractor/releases/download/v0.3.5/ifrextract_v0.3.5.osx.zip -o ifextract.zip -s
unzip -a ifextract.zip
rm ifextract.zip
./UEFITool.app/Contents/MacOS/UEFITool ~/Desktop/cfglockfix/Z17XU5TH.22g

Now we should have UEFITool opened with with BIOS image Z17XU5TH.22g.
Then we press CMD+F and and select text and type CFG Lock and press OK.

View attachment 363796
View attachment 363795

Then we have to double click on search result, which leads as to the section containing CFG Lock setting.
Then we right click on selected block and select extract body and safe it as PE32Section.efi and quit UEFITool.

View attachment 363797
View attachment 363798

Then we run following command on terminal

Code:
./ifrextract PE32Section.efi PE32Section.txt

We should have now text file which reveals offset for CFG Lock setting.

View attachment 363801

Code:
0x33377     Form: View/Configure CPU Lock Options, FormId: 0x2734 {01 86 34 27 11 07}
0x3337D         One Of: CFG Lock, VarStoreInfo (VarOffset/VarName): 0x4EF, VarStore: 0x1, QuestionId: 0x24C, Size: 1, Min: 0x0, Max 0x1, Step: 0x0 {05 91 B4 08 B5 08 4C 02 01 00 EF 04 10 10 00 01 00}
0x3338E             One Of Option: Disabled, Value (8 bit): 0x0 {09 07 04 00 00 00 00}
0x33395             One Of Option: Enabled, Value (8 bit): 0x1 (default) {09 07 03 00 30 00 01}
0x3339C         End One Of {29 02}
0x3339E         One Of: Overclocking Lock, VarStoreInfo (VarOffset/VarName): 0x59E, VarStore: 0x1, QuestionId: 0x24D, Size: 1, Min: 0x0, Max 0x1, Step: 0x0 {05 91 B0 08 B1 08 4D 02 01 00 9E 05 10 10 00 01 00}
0x333AF             One Of Option: Disabled, Value (8 bit): 0x0 (default) {09 07 04 00 30 00 00}
0x333B6             One Of Option: Enabled, Value (8 bit): 0x1 {09 07 03 00 00 00 01}
0x333BD         End One Of {29 02}
0x333BF     End Form {29 02}

The line we are interested about is:

One Of: CFG Lock, VarStoreInfo (VarOffset/VarName): 0x4EF, VarStore: 0x1,...​

0x4EF is offset and 0x1 is default setting.

We have figured out the command to use with modified GRUB Shell for motherboard Z170X-UD5 TH BIOS version f22g:

Code:
setup_var 0x4EF 0x00

Seems that for various Z170X-UD5 TH BIOS versions (F20 and newer) offset is 0x4EF:



Didn't check older versions.

How to create bootable USB for GRUB shell

1 . Make bootable USB stick for Grub Shell
Inject USB stick into USB port and follow next steps... Be very careful, that you dont erase your system or other important disks accidentally.

a. Mac Instuctions
  1. Open Disk Utility
  2. Select your USB drive (Entire drive, not partition)
  3. Click Partition
  4. Choose GUID scheme, FAT format and any name you like.

View attachment 367157

b. Linux Instructions
If for some case Mac instructions doesn't suit you, you can create bootable USB on Linux Terminal easily too. Run lsblk --fs to detect your USB device, for example /dev/sdc or /dev/sda etc. Terminal commands below are for USB device /dev/sdc, use your own device instead of that.

Code:
lsblk --fs
sudo parted -s /dev/sdc print
sudo wipefs -a /dev/sdc
sudo parted -s /dev/sdc print
sudo parted /dev/sdc help mktable
sudo parted /dev/sdc mktable msdos
sudo parted /dev/sdc help mkpart
sudo parted /dev/sdc mkpart primary fat32 0% 100%
sudo mkfs.fat -F 32 /dev/sdc1
sudo parted /dev/sdc set 1 boot on
lsblk --fs

2. Download and put Grub Shell on usb
  • Download Grub Shell from grub-mod-setup_var
  • Extract it into ~/Downloads folder
  • Rename it from modGRUBShell.efi to bootx64.efi
  • Copy bootx64.efi into USB disk
Code:
cd /Volumes/NO\ NAME
ls
mkdir -p /Volumes/NO\ NAME/EFI/BOOT
cp -iR ~/Downloads/bootx64.efi /Volumes/NO\ NAME/EFI/BOOT/bootx64.efi

View attachment 367158

3. Make changes
  • Reboot from USB disk / Press F12 key for boot options
  • Change settings
Make sure that you have UEFI boot enabled

View attachment 367160

Press F12 key for boot options

View attachment 367159

On GRUB shell you can now use setup_var or setup_var_2 or setup_var_3 commands.

View attachment 367161

To check variable just enter setup_var <offset> for example:
Code:
setup_var 0x4EF
or
Code:
setup_var_3 0x4EF

NB! On some BIOS you might find this useful, use setup_var_3 instead of setup_var. Read more on grub-mod-setup_var

Code:
setup_var_3 0x4EF 0x00
THis is a fgreat post

But also, for Gigabyte Owners (like the one z370n wifi) keep in mind that you also need to do the same thing for 2 settings:

0x5A4 is CFG Lock option in BIOS (0x5A4 is the address in bios 14a of GA z370n)
0x507 is System Time and Alarm Source option (0x507 is the address in bios 14a of GA z370n)
 
Thank you! That is an interesting thread.
while looking at the bios F22g has anyone figured out if there is an entry for the Thunderbolt GPI03 Force PWR?

This is necessary for the Thunderbolt hot plug.
 
Thank you! That is an interesting thread.
while looking at the bios F22g has anyone figured out if there is an entry for the Thunderbolt GPI03 Force PWR?

This is necessary for the Thunderbolt hot plug.

yes, it’s offset 0x461 on bios F22g, but that alone will not hot swap thunderbolt. Ultimately you need to flash the rom on the thunderbolt controller chip on the motherboard for the most Mac-like experience. With an SSDT only you can enable hot-swap but it will lock up the thunderbolt bus if devices are present at boot. There is a whole discussion about it, I’ll find it and add it to this post.

Here:

 
Status
Not open for further replies.
Back
Top