coreboot-kgpe-d16/src/mainboard/lenovo
Evgeny Zinoviev 833e9bad47 sb/intel/bd82x6x: Support ME Soft Temporary Disable Mode
- Add support for ME Soft Temporary Disable Mode. In this mode, ME
  doesn't load its kernel and freezes at Bring UP (BUP) phase. This mode
  is saved in ME NVRAM (and thus will remain for next reboots and
  poweroffs).

- Add support of new CMOS option for Sandy Bridge and Ivy Bridge
  ThinkPads.

HOW TO USE

To disable ME:
1. nvramtool -w me_state=Disabled
2. reboot

To enable it back:
1. nvramtool -w me_state=Normal
2. reboot

To check current status:
intelmetool -m

Tested on ThinkPad X230 and ThinkPad X220.

BACKGROUND

There's no Intel documentation that would explain how this should be
implemented, in public. Working binary sequence for MKHI command to put
ME in Soft Temporary Disable Mode, as well as a way to bring ME out of
it (by writing to H_GS register), was found and published by researchers
from PT Security:

1.  To disable ME, BIOS issues the disable command (before End of Post)
    and reboots. ME is supposed to be disabled on the next boot after
    DID (DRAM Init Done).

    My numerous tests show that issuing the command and rebooting is not
    enough. If we reboot too early, ME will not be disabled. Apparently,
    it is doing something in background after receiving the command. It
    works with a delay of 500-1000 ms.

    I also tried to dump all known (documented) registers, such as GMES
    and HFS, before and during the next 2 seconds after execution of the
    disable command to find a possible indication that something's
    changed in ME and we're ready to reboot. Found nothing
    unfortunately.

2.  To enable ME back, host writes value 0x20000000 to H_GS.

    PT slides don't contain any more information on it, but my tests
    show, that after writing this value, GMES[31:28] is changing from
    0x01 (BUP phase) to 0x03 (Policy Module) to 0x06 (Host
    Communication). Then, after some more time, fw_init_complete bit of
    HFS becomes 1.

    This means that ME starts loading its kernel immediately, without
    reboot.

    On the other hand, Lenovo BIOS clearly perform a reboot after
    enabling it (one reboot after saving the settings, then ThinkPad
    logo appears, and then one more reboot). I'm assuming we have to
    reset too.

Change-Id: Ic01526c9731cbef4e8552bbc352133a2415787c2
Signed-off-by: Evgeny Zinoviev <me@ch1p.io>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/37115
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Nico Huber <nico.h@gmx.de>
2021-02-07 23:06:52 +00:00
..
g505s ACPI: Add top-level ASL 2021-01-27 15:35:13 +00:00
l520 sb/intel/bd82x6x: Support ME Soft Temporary Disable Mode 2021-02-07 23:06:52 +00:00
s230u ACPI: Add top-level ASL 2021-01-27 15:35:13 +00:00
t60 ACPI: Add top-level ASL 2021-01-27 15:35:13 +00:00
t400 sb/intel/i82801ix: Factor out common acpi_fill_madt 2021-02-01 09:04:25 +00:00
t410 ACPI: Add top-level ASL 2021-01-27 15:35:13 +00:00
t420 sb/intel/bd82x6x: Support ME Soft Temporary Disable Mode 2021-02-07 23:06:52 +00:00
t420s sb/intel/bd82x6x: Support ME Soft Temporary Disable Mode 2021-02-07 23:06:52 +00:00
t430 sb/intel/bd82x6x: Support ME Soft Temporary Disable Mode 2021-02-07 23:06:52 +00:00
t430s sb/intel/bd82x6x: Support ME Soft Temporary Disable Mode 2021-02-07 23:06:52 +00:00
t440p ACPI: Add top-level ASL 2021-01-27 15:35:13 +00:00
t520 sb/intel/bd82x6x: Support ME Soft Temporary Disable Mode 2021-02-07 23:06:52 +00:00
t530 sb/intel/bd82x6x: Support ME Soft Temporary Disable Mode 2021-02-07 23:06:52 +00:00
thinkcentre_a58 ACPI: Add top-level ASL 2021-01-27 15:35:13 +00:00
x1_carbon_gen1 ACPI: Add top-level ASL 2021-01-27 15:35:13 +00:00
x60 ACPI: Add top-level ASL 2021-01-27 15:35:13 +00:00
x131e ACPI: Add top-level ASL 2021-01-27 15:35:13 +00:00
x200 sb/intel/i82801ix: Factor out common acpi_fill_madt 2021-02-01 09:04:25 +00:00
x201 ACPI: Add top-level ASL 2021-01-27 15:35:13 +00:00
x220 sb/intel/bd82x6x: Support ME Soft Temporary Disable Mode 2021-02-07 23:06:52 +00:00
x230 sb/intel/bd82x6x: Support ME Soft Temporary Disable Mode 2021-02-07 23:06:52 +00:00
Kconfig mb/*/Kconfig: Factor out MAINBOARD_VENDOR 2020-03-03 10:15:22 +00:00
Kconfig.name