* include/grub/acpi.h (GRUB_ASCII_OPCODE): Add
GRUB_ACPI_OPCODE_STRING_CONST, GRUB_ACPI_OPCODE_BUFFER, GRUB_ACPI_OPCODE_CREATE_WORD_FIELD and GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD. * grub-core/commands/acpihalt.c [GRUB_DSDT_TEST]: Replace include of i18n with gettext no-op. (skip_data_ref_object): Support GRUB_ACPI_OPCODE_BUFFER and GRUB_ACPI_OPCODE_STRING_CONST. (get_sleep_type): Support GRUB_ACPI_OPCODE_CREATE_WORD_FIELD and GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD. Add handling of unknown opcodes.
This commit is contained in:
parent
e5b90c82fe
commit
463dcadca3
3 changed files with 49 additions and 2 deletions
|
@ -33,7 +33,12 @@ typedef uint8_t grub_uint8_t;
|
|||
#endif
|
||||
|
||||
#include <grub/acpi.h>
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/i18n.h>
|
||||
#else
|
||||
#define _(x) x
|
||||
#define N_(x) x
|
||||
#endif
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/misc.h>
|
||||
|
@ -99,6 +104,7 @@ skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
|||
switch (*ptr)
|
||||
{
|
||||
case GRUB_ACPI_OPCODE_PACKAGE:
|
||||
case GRUB_ACPI_OPCODE_BUFFER:
|
||||
return 1 + decode_length (ptr + 1, 0);
|
||||
case GRUB_ACPI_OPCODE_ZERO:
|
||||
case GRUB_ACPI_OPCODE_ONES:
|
||||
|
@ -110,6 +116,14 @@ skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
|||
return 3;
|
||||
case GRUB_ACPI_OPCODE_DWORD_CONST:
|
||||
return 5;
|
||||
case GRUB_ACPI_OPCODE_STRING_CONST:
|
||||
{
|
||||
const grub_uint8_t *ptr0 = ptr;
|
||||
for (ptr++; ptr < end && *ptr; ptr++);
|
||||
if (ptr == end)
|
||||
return 0;
|
||||
return ptr - ptr0 + 1;
|
||||
}
|
||||
default:
|
||||
if (*ptr == '^' || *ptr == '\\' || *ptr == '_'
|
||||
|| (*ptr >= 'A' && *ptr <= 'Z'))
|
||||
|
@ -176,6 +190,17 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
|||
if (!add)
|
||||
return -1;
|
||||
break;
|
||||
case GRUB_ACPI_OPCODE_CREATE_WORD_FIELD:
|
||||
case GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD:
|
||||
{
|
||||
int ll;
|
||||
ptr += 5;
|
||||
ptr += add = skip_data_ref_object (ptr, end);
|
||||
if (!add)
|
||||
return -1;
|
||||
ptr += 4;
|
||||
break;
|
||||
}
|
||||
case GRUB_ACPI_OPCODE_NAME:
|
||||
ptr++;
|
||||
if (memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0)
|
||||
|
@ -224,6 +249,9 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
|||
ptr += decode_length (ptr, 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
grub_printf ("Unknown opcode 0x%x\n", *ptr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue