diff options
author | Nico Huber <nico.h@gmx.de> | 2017-04-14 00:08:18 +0200 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2017-04-18 16:03:32 +0200 |
commit | 7d89ce309781708fcde1619f703d2b3d19970972 (patch) | |
tree | 112f0708fcff96ac924cebea9eb09b48fd409e94 /src/arch | |
parent | eca093ecfe5d6f0af9911a2f43249b8b24eb0729 (diff) |
x86/acpigen: Fix BufferSize of ResourceTemplate
Don't start counting the buffer size amidst the BufferSize field
itself. This should help with a regression introduced in Linux
with [1] which checks the BufferSize field.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=57707a9a778
Change-Id: I7349c8e281c41384491d730dfeac3336f29992f7
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/19284
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/x86/acpigen.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c index d3aaa3d644..59bfee314b 100644 --- a/src/arch/x86/acpigen.c +++ b/src/arch/x86/acpigen.c @@ -862,6 +862,8 @@ void acpigen_write_resourcetemplate_header(void) acpigen_write_len_f(); acpigen_emit_byte(WORD_PREFIX); len_stack[ltop++] = acpigen_get_current(); + /* Add 2 dummy bytes for the ACPI word (keep aligned with + the calclulation in acpigen_write_resourcetemplate() below). */ acpigen_emit_byte(0x00); acpigen_emit_byte(0x00); } @@ -879,7 +881,9 @@ void acpigen_write_resourcetemplate_footer(void) acpigen_emit_byte(0x79); acpigen_emit_byte(0x00); - len = gencurrent - p; + /* Start counting past the 2-bytes length added in + acpigen_write_resourcetemplate() above. */ + len = acpigen_get_current() - (p + 2); /* patch len word */ p[0] = len & 0xff; |