File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "encoding/json"
5+ "flag"
6+ "fmt"
7+ "io/ioutil"
8+ "log"
9+
10+ amd "github.com/linuxboot/fiano/pkg/amd/manifest"
11+ )
12+
13+ const (
14+ // This needed a look at the image; how can we fully automate it?
15+ mapping = 0xff000000
16+ )
17+
18+ // this is only for Go - would be 5 lines inline in JS, thanks...
19+ type dummyFirmware struct {
20+ image []byte
21+ }
22+
23+ func (f dummyFirmware ) ImageBytes () []byte {
24+ return f .image
25+ }
26+
27+ func (f dummyFirmware ) PhysAddrToOffset (physAddr uint64 ) uint64 {
28+ return physAddr - mapping
29+ }
30+
31+ func (f dummyFirmware ) OffsetToPhysAddr (offset uint64 ) uint64 {
32+ return offset + mapping
33+ }
34+
35+ func main () {
36+ flag .Parse ()
37+ args := flag .Args ()
38+
39+ var path string
40+ var amdfw dummyFirmware
41+
42+ if len (args ) > 0 {
43+ path = args [0 ]
44+ data , err := ioutil .ReadFile (path )
45+ if err != nil {
46+ log .Fatal (err )
47+ }
48+ amdfw .image = data
49+ fw , err := amd .NewAMDFirmware (amdfw )
50+ if err != nil {
51+ log .Fatal (err )
52+ }
53+ a := fw .PSPFirmware ()
54+ j , err := json .MarshalIndent (a , "" , " " )
55+ if err != nil {
56+ log .Fatal (err )
57+ }
58+ fmt .Printf (string (j ))
59+ }
60+ }
You can’t perform that action at this time.
0 commit comments