Commit Graph

18 Commits

Author SHA1 Message Date
Michael Chang 0b1bf3932f acpi: Fix gcc9 error -Waddress-of-packed-member
Simply adds the missing packed attribute to 'struct grub_acpi_madt'.

[  233s] ../../grub-core/commands/lsacpi.c: In function 'disp_acpi_xsdt_table':
[  233s] ../../grub-core/commands/lsacpi.c:201:27: error: converting a packed 'struct grub_acpi_table_header' pointer (alignment 1) to a 'struct grub_acpi_madt' pointer (alignment 4) may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  233s]   201 |  disp_madt_table ((struct grub_acpi_madt *) t);
[  233s]       |                           ^~~~~~~~~~~~~~
[  233s] In file included from ../../grub-core/commands/lsacpi.c:23:
[  233s] ../../include/grub/acpi.h:50:8: note: defined here
[  233s]    50 | struct grub_acpi_table_header
[  233s]       |        ^~~~~~~~~~~~~~~~~~~~~~
[  233s] ../../include/grub/acpi.h:90:8: note: defined here
[  233s]    90 | struct grub_acpi_madt
[  233s]       |        ^~~~~~~~~~~~~~
[  233s] ../../grub-core/commands/lsacpi.c: In function 'disp_acpi_rsdt_table':
[  233s] ../../grub-core/commands/lsacpi.c:225:27: error: converting a packed 'struct grub_acpi_table_header' pointer (alignment 1) to a 'struct grub_acpi_madt' pointer (alignment 4) may result in an unaligned pointer value [-Werror=address-of-packed-member]
[  233s]   225 |  disp_madt_table ((struct grub_acpi_madt *) t);
[  233s]       |                           ^~~~~~~~~~~~~~
[  233s] In file included from ../../grub-core/commands/lsacpi.c:23:
[  233s] ../../include/grub/acpi.h:50:8: note: defined here
[  233s]    50 | struct grub_acpi_table_header
[  233s]       |        ^~~~~~~~~~~~~~~~~~~~~~
[  233s] ../../include/grub/acpi.h:90:8: note: defined here
[  233s]    90 | struct grub_acpi_madt
[  233s]       |        ^~~~~~~~~~~~~~

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2019-04-23 11:37:08 +02:00
Vladimir Serbinenko b29638222e Make grub_acpi_find_fadt accessible generically 2016-02-12 11:35:48 +01:00
Andrei Borzenkov aa7bb4607b acpihalt: add GRUB_ACPI_OPCODE_CREATE_DWORD_FIELD (0x8a)
Fixes ACPI halt on ASUSTeK P8B75-V,
Bios: American Megatrends v: 0414 date: 04/24/2012

Reported-By: Goh Lip <g.lip@gmx.com>
2016-01-02 21:33:18 +03:00
Andrei Borzenkov 19554a6034 acpihalt: fix GRUB_DSDT_TEST compilation 2016-01-02 19:02:19 +03:00
Vladimir Serbinenko d43a5ee651 tsc: Use alternative delay sources whenever appropriate.
PIT isn't available on some of new hardware including Hyper-V. So
use pmtimer for calibration. Moreover pmtimer calibration is faster, so
use it on coreboor where booting time is important.

Based on patch by Michael Chang.
2015-11-27 11:39:55 +01:00
Valentin Dornauer 0f1f95c7b7 ACPIhalt: Add more ACPI opcodes.
The AML parser implements only a small subset of possible AML
	opcodes. On the Fujitsu Lifebook E744 this and another bug in
	the parser (incorrect handling of TermArg data types) would lead
	to the laptop not turning off (_S5 not found).

	* grub-core/commands/acpihalt.c: Support OpAlias in the AML parser;
	in skip_ext_op(), handle some Type2Opcodes more correctly (TermArgs
	aren't always simply strings!); Add function to skip TermArgs
	* include/grub/acpi.h: Add new opcodes
2014-09-21 18:58:14 +02:00
Vladimir Serbinenko 7e47e27bd8 Add gcc_struct to all packed structures when compiling with mingw.
Just "packed" doesn't always pack the way we expect.
2013-12-15 14:14:30 +01:00
Vladimir 'phcoder' Serbinenko ce7d92a9f2 Add new defines GRUB_RSDP_SIGNATURE_SIZE and GRUB_RSDP_SIGNATURE. 2013-04-05 10:56:43 +02:00
Colin Watson 33028f4c0b * grub-core/commands/acpihalt.c (skip_ext_op): Add support for
skipping Event, Device, Processor, PowerRes, ThermalZone, and
	  BankField extended opcodes.
	  (get_sleep_type): Add minimal scope handling (just enough to
	  handle setting the scope to the root path).
	  (grub_acpi_halt): Parse any SSDTs as well as the DSDT.
	* include/grub/acpi.h: Add enumeration values for Event, Device,
	  Processor, PowerRes, ThermalZone, and BankField extended opcodes.
2013-03-26 11:29:52 +01:00
Vladimir 'phcoder' Serbinenko 0d5b9c9031 Missing part of last commit 2013-02-01 21:48:01 +01:00
Vladimir 'phcoder' Serbinenko 463dcadca3 * 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.
2012-02-22 16:02:03 +01:00
Vladimir 'phcoder' Serbinenko e19b016b30 * grub-core/commands/acpihalt.c (skip_ext_op): Skip index field op.
* include/grub/acpi.h (GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP): New
	enum value.
2010-10-16 20:01:30 +02:00
Vladimir 'phcoder' Serbinenko c32b51c9f9 Userspace ACPI parser debugging.
* grub-core/commands/acpihalt.c [GRUB_DSDT_TEST]: Include userspace
	headers and add relevant defines. Don't include standard headers.
	(main) [GRUB_DSDT_TEST]: New function.
	* include/grub/acpi.h [GRUB_DSDT_TEST]: Don't include standard headers.
	Don't declare functions.
2010-10-16 19:06:55 +02:00
Vladimir 'phcoder' Serbinenko 4df7996d87 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.
2010-09-11 17:59:14 +02:00
Tristan Gingold 1782b135e5 * commands/lsacpi.c: New file.
* grub-core/Makefile.core.def (lsacpi): New module.
	* include/grub/acpi.h (GRUB_ACPI_FADT_SIGNATURE): New definition.
	(GRUB_ACPI_MADT_SIGNATURE): Likewise.
	(grub_acpi_madt_entry_header): New struct.
	(grub_acpi_madt): Likewise.
	(grub_acpi_madt_entry_interrupt_override): Likewise.
	(grub_acpi_madt_entry_sapic): Likewise.
	(grub_acpi_madt_entry_lsapic): Likewise.
	(grub_acpi_madt_entry_platform_int_source): Likewise.
	* include/grub/types.h (PRIxGRUB_UINT32_T): New definition.
	(PRIuGRUB_UINT32_T): Likewise.
	(PRIxGRUB_UINT64_T): Likewise.

	Also-By: Robert Millan <rmh.grub@aybabtu.com>

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2010-09-01 01:05:32 +02:00
Vladimir 'phcoder' Serbinenko 41cf1ca332 implement ACPI shutdown 2010-05-04 15:53:21 +02:00
fzielcke b39f9d20a9 remove all trailing whitespace 2009-06-10 21:04:23 +00:00
phcoder f8efe3ad2d 2009-05-02 Vladimir Serbinenko <phcoder@gmail.com>
ACPI spoofing

	* commands/acpi.c: new file
	* commands/i386/pc/acpi.c: likewise
	* commands/efi/acpi.c: likewise
	* include/grub/acpi.h: likewise
	* conf/i386-pc.rmk (pkglib_MODULES): added acpi.mod
	(acpi_mod_SOURCES): new variable
	(acpi_mod_CFLAGS): likewise
	(acpi_mod_LDFLAGS): likewise
	* conf/i386-efi.rmk: likewise
	* conf/x86_64-efi.rmk: likewise
2009-05-02 22:31:29 +00:00