util/autoport: Adapt logmaker for newer ACPI versions

acpidump now creates dumps with 4 spaces instead of 2 in front of the hex dump,
so be a bit smarter about the input with regexp.

Tested with X220 autoport logs: Still creates the same coreboot code.

Change-Id: I8d48c09cdff9432f394b350540ea9765fc942781
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/28054
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
Arthur Heymans 2018-08-12 00:21:08 +02:00 committed by Patrick Georgi
parent b75a08b199
commit 8bd25abc05
1 changed files with 4 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"fmt"
"log"
"os"
"regexp"
"strconv"
"strings"
)
@ -106,11 +107,13 @@ func (l *LogDevReader) GetACPI() (Tables map[string][]byte) {
curTable := ""
for scanner.Scan() {
line := scanner.Text()
/* Only supports ACPI tables up to 0x10000 in size, FIXME if needed */
is_hexline, _ := regexp.MatchString(" *[0-9A-Fa-f]{4}: ", line)
switch {
case len(line) >= 6 && line[5] == '@':
curTable = line[0:4]
Tables[curTable] = make([]byte, 0, 100000)
case len(line) > 7 && line[0:2] == " " && isXDigit(line[2]) && isXDigit(line[3]) && isXDigit(line[4]) && isXDigit(line[5]) && line[6] == ':':
case is_hexline:
Tables[curTable] = l.AssignHexLine(line, Tables[curTable])
}
}