- Split the parser code into several packages to make its testing of its functions more convenient and detailed. This also makes embedding the parser in third-party applications more flexible - there is no need to use all the functionality of the parser. - Clean up code and remove unnecessary objects to make intelp2m simpler and more readable. - Change the common macro format to be consistent with the new parser. - Rename the results directory containing gpio.h to output to avoid confusion with the generator package directory. - At the moment there is no mechanism for setting the Ownership flag. This will be added in later versions. Tests: - make test = PASS - gpio.h for Apollo Lake before and after the patch is the same Change-Id: I9a29322dd31faf9ae100165f08f207360cbf9f80 Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/70543 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com>
58 lines
1.3 KiB
Go
58 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"time"
|
|
|
|
"review.coreboot.org/coreboot.git/util/intelp2m/cli"
|
|
"review.coreboot.org/coreboot.git/util/intelp2m/config/p2m"
|
|
"review.coreboot.org/coreboot.git/util/intelp2m/generator"
|
|
"review.coreboot.org/coreboot.git/util/intelp2m/generator/header"
|
|
"review.coreboot.org/coreboot.git/util/intelp2m/generator/printer"
|
|
"review.coreboot.org/coreboot.git/util/intelp2m/logs"
|
|
"review.coreboot.org/coreboot.git/util/intelp2m/parser"
|
|
)
|
|
|
|
// Version is injected into main during project build
|
|
var Version string = "Unknown"
|
|
|
|
// main
|
|
func main() {
|
|
p2m.Config.Version = Version
|
|
|
|
cli.ParseOptions()
|
|
|
|
if file, err := logs.Init(); err != nil {
|
|
fmt.Printf("logs init error: %v\n", err)
|
|
os.Exit(1)
|
|
} else {
|
|
defer file.Close()
|
|
}
|
|
|
|
year, month, day := time.Now().Date()
|
|
hour, min, sec := time.Now().Clock()
|
|
logs.Infof("%d-%d-%d %d:%d:%d", year, month, day, hour, min, sec)
|
|
logs.Infof("============ start ============")
|
|
|
|
entries, err := parser.Run()
|
|
if err != nil {
|
|
fmt.Print("failed to run parser")
|
|
os.Exit(1)
|
|
}
|
|
|
|
lines, err := generator.Run(entries)
|
|
if err != nil {
|
|
fmt.Print("failed to run generator")
|
|
os.Exit(1)
|
|
}
|
|
lines = header.Add(lines)
|
|
|
|
if err := printer.Do(lines); err != nil {
|
|
fmt.Print("printer error")
|
|
os.Exit(1)
|
|
}
|
|
|
|
logs.Infof("========== completed ==========")
|
|
os.Exit(0)
|
|
}
|