Shutdown using ACPI.
* grub-core/Makefile.core.def (halt): Add commands/acpihalt.c on i386-pc. * grub-core/commands/acpihalt.c: New file. * grub-core/commands/i386/pc/halt.c (grub_cmd_halt): Call grub_acpi_halt. * include/grub/acpi.h (grub_acpi_fadt): New member pm1a. (grub_acpi_halt): New proto. (GRUB_ACPI_SLP_EN): New const. (GRUB_ACPI_SLP_TYP_OFFSET): Likewise. (GRUB_ACPI_OPCODE_*): New enum. (GRUB_ACPI_EXTOPCODE_*): Likewise.
This commit is contained in:
commit
4df7996d87
5 changed files with 310 additions and 2 deletions
|
@ -60,10 +60,12 @@ struct grub_acpi_fadt
|
|||
struct grub_acpi_table_header hdr;
|
||||
grub_uint32_t facs_addr;
|
||||
grub_uint32_t dsdt_addr;
|
||||
grub_uint8_t somefields1[88];
|
||||
grub_uint8_t somefields1[20];
|
||||
grub_uint32_t pm1a;
|
||||
grub_uint8_t somefields2[64];
|
||||
grub_uint64_t facs_xaddr;
|
||||
grub_uint64_t dsdt_xaddr;
|
||||
grub_uint8_t somefields2[96];
|
||||
grub_uint8_t somefields3[96];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#define GRUB_ACPI_MADT_SIGNATURE "APIC"
|
||||
|
@ -145,4 +147,25 @@ grub_uint8_t grub_byte_checksum (void *base, grub_size_t size);
|
|||
|
||||
grub_err_t grub_acpi_create_ebda (void);
|
||||
|
||||
void grub_acpi_halt (void);
|
||||
|
||||
#define GRUB_ACPI_SLP_EN (1 << 13)
|
||||
#define GRUB_ACPI_SLP_TYP_OFFSET 10
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_ACPI_OPCODE_ZERO = 0, GRUB_ACPI_OPCODE_ONE = 1,
|
||||
GRUB_ACPI_OPCODE_NAME = 8, GRUB_ACPI_OPCODE_BYTE_CONST = 0x0a,
|
||||
GRUB_ACPI_OPCODE_WORD_CONST = 0x0b, GRUB_ACPI_OPCODE_DWORD_CONST = 0x0c,
|
||||
GRUB_ACPI_OPCODE_SCOPE = 0x10, GRUB_ACPI_OPCODE_PACKAGE = 0x12,
|
||||
GRUB_ACPI_OPCODE_METHOD = 0x14, GRUB_ACPI_OPCODE_EXTOP = 0x5b,
|
||||
GRUB_ACPI_OPCODE_IF = 0xa0, GRUB_ACPI_OPCODE_ONES = 0xff
|
||||
};
|
||||
enum
|
||||
{
|
||||
GRUB_ACPI_EXTOPCODE_MUTEX = 0x01,
|
||||
GRUB_ACPI_EXTOPCODE_OPERATION_REGION = 0x80,
|
||||
GRUB_ACPI_EXTOPCODE_FIELD_OP = 0x81
|
||||
};
|
||||
|
||||
#endif /* ! GRUB_ACPI_HEADER */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue