grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix ACPI halt for certain DSDTs


From: Valentin Dornauer
Subject: [PATCH] Fix ACPI halt for certain DSDTs
Date: Tue, 1 Jul 2014 01:55:22 +0200

Hello!

GRUB2 currently seems to be unable to shut down my Fujitsu Lifebook
E744 laptop using ACPI. After some debugging, I nailed the problem
down to two problems within GRUB’s ‘acpihalt’ command. Please see
the attached patch for my solution.


Without this patch I get the following:
  grub> halt
  Unknown opcode 0x6
  Unknown opcode 0x12
  ACPI shutdown failed
  [.. Laptop hangs indefinitely ..]

With debugging enabled:
  grub> set debug=acpi
  grub> halt
  commands/i386/pc/acpi.c:56: Looking for RSDP. Scanning EBDA
  commands/i386/pc/acpi.c:70: Looking for RSDP. Scanning BIOS
  [. . .]
  commands/acpihalt.c:195: Opcode 0x8
  commands/acpihalt.c:196: Tell 1c0d
  commands/acpihalt.c:105: data type = 0x11
  commands/acpihalt.c:195: Opcode 0x6
  commands/acpihalt.c:196: Tell 1c1c
  Unknown opcode 0x6
  commands/acpihalt.c:380: SSDT = 0xdcffd000
  commands/acpihalt.c:195: Opcode 0x10
  commands/acpihalt.c:196: Tell 24
  [. . .]
  commands/acpihalt.c:195: Opcode 0x8
  commands/acpihalt.c:196: Tell 98
  commands/acpihalt.c:105: data type = 0x12
  commands/acpihalt.c:195: Opcode 0x12
  commands/acpihalt.c:196: Tell 2b1
  Unknown opcode 0x12
  commands/acpihalt.c:380: SSDT = 0xdcfe6000
  commands/acpihalt.c:195: Opcode 0x10
  commands/acpihalt.c:196: Tell 24
  [. . .]
  commands/acpihalt.c:195: Opcode 0x14
  commands/acpihalt.c:196: Tell aa2
  commands/acpihalt.c:386: SLP_TYP = -2, port = 0x1804
  ACPI shutdown failed

With the attached patch, GRUB successfully finds SLP_TYP (7, for
the laptop model mentioned above) and turns off the laptop.


The patch actually fixes two problems: first, the laptop's SSDT
contains an AliasOp (which consists of two NameStrings), which was
unknown to GRUB. Simply skip them when they're encountered.

The second problem was more subtle: the function that parses extended
opcodes, skip_ext_op(), does not treat the OpRegionOp correctly.
According to the ACPI spec, the 3rd and 4th parameters are actually
TermArgs, which are more complex than what skip_data_ref_object()
is designed to handle. Here's the snipped from the decompiled AML
that triggered the problem:

  OperationRegion (MBAR, SystemMemory, Add (ShiftLeft (\_SB.PCI0.MHBR, 0x0F), 
0x5000), 0x1000)
  Field (MBAR, ByteAcc, NoLock, Preserve)
  {
              Offset (0x938),
      PWRU,   4,
              Offset (0x9A0),
      PPL1,   15,
      PL1E,   1,
      CLP1,   1
  }


The whole ACPI thing still confuses me and I'm beginning to understand
why everyone seems to hate ACPI, so if I got anything wrong, please
feel free to correct me.

- Valentin

Attachment: 0001-Fix-ACPI-halt-for-certain-DSDTs.patch
Description: Binary data


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


reply via email to

[Prev in Thread] Current Thread [Next in Thread]