johnnynunez / Xiaomi-Mi-Air

Xiaomi Mi Air 13.3" 2018
397 stars 117 forks source link

BIOS patches? #88

Closed yllwfsh closed 4 years ago

yllwfsh commented 4 years ago

Regarding: https://github.com/johnnync13/Xiaomi-Mi-Air/commit/94455a1c88fc69f11362166995397c7d27c4d71b

I had no idea! That's very interesting. My laptop seems to boot fine with opencore without any mods though...

Can you teach us how to patch the BIOS and/or provide some scripts?

Thanks!

yllwfsh commented 4 years ago

I did a bit more research about the MSR 0xE2 / CFG-Lock problem and if BIOS patching is necessary.

First of all my MSR 0xE2 is really locked: IMG_6332

These are my relevant OC config.plist values: Screenshot 2020-02-14 at 10 16 44

After a quick test with Cinebench and Intel Power Gadget open it seems that native CPU power management is working: Screenshot 2020-02-14 at 10 12 08 Screenshot 2020-02-14 at 10 13 03

Also no problems with sleep/wake, all my devices are working.

@johnnync13 What's your opinion on this? Still necessary to patch BIOS? What would i gain in features?

johnnynunez commented 4 years ago

It works better than you !! And it is to safety and easy

gmallios commented 4 years ago

I think with Locked MSR and Clover/OC you use a community made frequency table which does not fully utilize native power management and you lose performance and/or battery life. I think there is a MSR Unlock script from Cr0wTom but we need to test it. ( https://github.com/Cr0wTom/Mi-Notebook-Pro-Mods )

yllwfsh commented 4 years ago

Ok sounds plausible but I cannot risk testing it at the moment on one of my main working machines. Anyone else volunteering? ;)

Btw, these Cr0wTom scripts are for the Notebook Pro, they might not work with the Notebook Air BIOS (plus several versions going around) ...

gmallios commented 4 years ago

I think @johnnync13 knows exactly which patches work and i'm willing to test them. I had terrible battery life on macOS ( 3-4 hours max ) and that's the reason i switched back to windows. I hope we can figure it out.

johnnynunez commented 4 years ago

No use script of Xiaomi laptop pro. Every laptop is different

gmallios commented 4 years ago

I used the CFG unlock and DVMT patches on my Xiaomi Mi Air 13.3(2018) as i found its motherboard is the same (Timi1703) with the Xiaomi Pro one and all went fine.

timmmmmmmmm commented 4 years ago

I'm happy to be the second person to test the Cr0wTom patches @0x47726567 mentioned. Would there be any effects on how Windows runs? And most importantly @0x47726567, to which BIOS version did you apply the patches?

gmallios commented 4 years ago

I forgot to mention that i used daliansky's BIOS patches because Cr0wTom's didn't work for me(there was a missing file?).I'm using XMAKB3M0P0100B bios. Also, I haven't noticed any difference on Windows yet and i didn't expect anything to change in Windows.

johnnynunez commented 4 years ago

In hackintool you have a test if you CFG Lock is unlocked and more parameters

johnnynunez commented 4 years ago

if you follow open core tutorial to unlock cfg it's easy...

johnnynunez commented 4 years ago

Anyone send me backup Bios P100C? I do script to add folder OpenCore shell

johnnynunez commented 4 years ago

https://khronokernel-2.gitbook.io/opencore-vanilla-desktop-guide/post-install/post-install/msr-lock

johnnynunez commented 4 years ago

I have great news! https://github.com/johnnync13/Xiaomi-Notebook-Air-1Gen/issues/47

johnnynunez commented 4 years ago

@yllwfsh @0x47726567 @elGiank @timmmmmmmmm anyone have the latest exe bios p100d?

yllwfsh commented 4 years ago

No sorry. I bricked my laptop once with a flash to version 120C 🤦‍♂️ so I never touched the BIOS again haha. Currently on version 100B

johnnynunez commented 4 years ago

@yllwfsh here is all laptops bios https://drive.google.com/drive/folders/1RIqdN3C9UDBN0KPwazyaerW1bEApivqN

johnnynunez commented 4 years ago

@yllwfsh with this version, can you send me a backup?

johnnynunez commented 4 years ago

I have been able to extract bios. setup_var 0x3C 0x00 to unlock CFG Lock. I will upload Excel with all Xiaomi laptops variables to unlock cfg and more things like enable speedshift, unlock mc lock etc Setup.txt

johnnynunez commented 4 years ago

@yllwfsh tutorial uploaded!!!!

yllwfsh commented 4 years ago

@johnnync13 Thx! I'm sorry i was not quick enough to respond yesterday. I'll have to make some time to try your instructions but it looks very simple so should be no issue!

johnnynunez commented 4 years ago

@yllwfsh I finished the tutorial. See on bios folder

yllwfsh commented 4 years ago

@johnnync13 Where did that latest BIOS version come from? Is there any improvements for the laptop? I'm really scared to update, afraid to brick my laptop again. I guess i'll try the cfg-lock first on my current BIOS.

johnnynunez commented 4 years ago

@yllwfsh I always have the BIOS updated to the latest version

yllwfsh commented 4 years ago

Strange: When I try the Mod Grub Shell and enter setup_var 0x3C (without value to read the current state), I get 0x00 (disabled). But the verifyMSr2.efi says locked. What am I doing wrong?

yllwfsh commented 4 years ago

setup_var also tells me "expected a different size of the Setup value (got 1800 bytes) Continue with care..."

Is that the same for you?

yllwfsh commented 4 years ago

If you like here is my BIOS backup (made with flashrom in Linux): backup_XMAKB3M0P100B.bin.zip

gmallios commented 4 years ago

@yllwfsh In case i brick my laptop, how did u un-brick it?

yllwfsh commented 4 years ago

@yllwfsh In case i brick my laptop, how did u un-brick it?

You won't like the answer ;)

Normally you have to use an EEPROM programmer and open the laptop to program the EEPROM directly...

In my case it didn't work and I had to use Xiaomi Warranty when I was on a business trip in China. I told them the laptop got bricked with a firmware update. They fixed it in the end...

I was lucky.

yllwfsh commented 4 years ago

@johnnync13 (See my posts above for more info and my BIOS backup) I finally worked up the courage to just try it and typed setup_var 0x3C 0x00 and it gave me the following error:

error: can't set variable using efi (error: 0x000000000000008)

QQQQQQQQiu commented 4 years ago

@johnnync13 (See my posts above for more info and my BIOS backup) I finally worked up the courage to just try it and typed setup_var 0x3C 0x00 and it gave me the following error:

error: can't set variable using efi (error: 0x000000000000008)

I also got this error

johnnynunez commented 4 years ago

@yllwfsh @lang-ji have you tried to modify bios lock and bios guard before to change CFG Lock?

yllwfsh commented 4 years ago

@yllwfsh @lang-ji have you tried to modify bios lock and bios guard before to change CFG Lock?

No, didn't know I had to. I might give it a try later

johnnynunez commented 4 years ago

@yllwfsh I will see if the Xiaomi pro has the same values from mi air to use recoding scripts..

QQQQQQQQiu commented 4 years ago

@yllwfsh @ lang-ji在更改CFG锁之前,您是否尝试过修改BIOS锁和BIOS保护?

![Uploading image.png…]()

@yllwfsh I will see if the Xiaomi pro has the same values from mi air to use recoding scripts..

@yllwfsh @lang-ji have you tried to modify bios lock and bios guard before to change CFG Lock?

No, didn't know I had to. I might give it a try later

@yllwfsh @lang-ji have you tried to modify bios lock and bios guard before to change CFG Lock?

cut

ohhh.. Looks like it's already 0x00

yllwfsh commented 4 years ago

ohhh..Looks like it's already 0x00

No it's not reading the proper value or it can't read the bios at all... See you got an error on the last line

johnnynunez commented 4 years ago

@yllwfsh I upload another grub shell. Try this too

yakuri354 commented 4 years ago

I have this error too

yllwfsh commented 4 years ago

@yllwfsh I upload another grub shell. Try this too

No change. I've included a screenshot: image

Especially the readout for value 0xEC is weird: it says 0x02, but that's not possible, it should be 0 or 1. Maybe it's reading the wrong part of the BIOS for the settings?

yllwfsh commented 4 years ago

Here's my version of setup.txt extracted from my BIOS dump btw:

setup.txt

johnnynunez commented 4 years ago

I'm good news! The values from Xiaomi Mi air are the same from Xiaomi Pro

Screenshot 2020-04-03 at 16 27 37
yllwfsh commented 4 years ago

I'm good news! The values from Xiaomi Mi air are the same from Xiaomi Pro

Screenshot 2020-04-03 at 16 27 37

So we can just use daliansky's BIOS scripts then?

johnnynunez commented 4 years ago

@yllwfsh I modified shell to do a bypass. You can try 6 and 8 options Scripts.zip

johnnynunez commented 4 years ago

@yllwfsh any news?

gmallios commented 4 years ago

I'm good news! The values from Xiaomi Mi air are the same from Xiaomi Pro

Screenshot 2020-04-03 at 16 27 37

So we can just use daliansky's BIOS scripts then?

Yup as i reported i used those patches and they worked. It was kinda risky though as i thought it was just a rebrand of the air series( i think they use both the Timi 1703 board )

johnnynunez commented 4 years ago

@0x47726567 I fix coffee lake gaming with the same error, and CFG Lock now is unlocked

johnnynunez commented 4 years ago

you should use the last release OC https://github.com/johnnync13/Xiaomi-Mi-Air/releases/tag/v7.0.3

yllwfsh commented 4 years ago

@yllwfsh any news?

Thx for asking! Took a little time, had to find my Windows SSD and install it. Ran the scripts and everything is unlocked now! (Unlocked CFG Lock, SpeedShift, Voltage)

yllwfsh commented 4 years ago

@johnnync13 Do you know anything about raising the TDP limit of 15W? In Windows with Intel XTU I cannot really change the limit. It works for a few seconds 25-30W and then the laptop kicks the CPU down to 15W...

johnnynunez commented 4 years ago

The scripts on Xiaomi pro, I think that works on macOS