File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed
Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module github.com/linuxboot/fiano
33go 1.16
44
55require (
6+ github.com/orangecms/PSP-Entry-Types v1.0.1 // indirect
67 github.com/spf13/pflag v1.0.5
78 github.com/u-root/u-root v0.0.0-20210724144310-637617c480d4
89 github.com/ulikunitz/xz v0.5.10
Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
8686github.com/modern-go/reflect2 v1.0.1 /go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0 =
8787github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223 /go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U =
8888github.com/opentracing/opentracing-go v1.0.2 /go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o =
89+ github.com/orangecms/PSP-Entry-Types v1.0.1 h1:CTJ/+esmVshvkpNbOAcdZGf/I/hUh3fo6PUwtBwxmpA =
90+ github.com/orangecms/PSP-Entry-Types v1.0.1 /go.mod h1:gveQh8FM6402D5v+xtvRHYwecihTLmxPQDZJTFjpqSo =
8991github.com/orangecms/go-framebuffer v0.0.0-20200613202404-a0700d90c330 /go.mod h1:3Myb/UszJY32F2G7yGkUtcW/ejHpjlGfYLim7cv2uKA =
9092github.com/pborman/getopt/v2 v2.1.0 /go.mod h1:4NtW75ny4eBw9fO1bhtNdYTlZKYX5/tBLtsOpwKIKd0 =
9193github.com/pelletier/go-toml v1.2.0 /go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic =
Original file line number Diff line number Diff line change 1+ package manifest
2+
3+ import (
4+ "encoding/json"
5+ "fmt"
6+
7+ pspentries "github.com/orangecms/PSP-Entry-Types"
8+ )
9+
10+ var knownTypes = pspentries .Types ()
11+
12+ func (t BIOSDirectoryTableEntryType ) MarshalJSON () ([]byte , error ) {
13+ for _ , knownType := range knownTypes {
14+ if knownType .Type == uint32 (t ) {
15+ name := knownType .Name
16+ if name == "" {
17+ name = knownType .ProposedName
18+ }
19+ if name == "" {
20+ return json .Marshal (fmt .Sprintf ("0x%x" , t ))
21+ }
22+ return json .Marshal (name )
23+ }
24+ }
25+ return json .Marshal (fmt .Sprintf ("0x%x" , t ))
26+ }
27+
28+ /*
29+ TODO: extend information, also for PSPDirectoryTableEntry
30+ func (e BIOSDirectoryTableEntry) MarshalJSON() json.RawMessage {
31+ info := TypeInfo{
32+ Name: name,
33+ Comment: knownType.Comment,
34+ }
35+ entry.TypeInfo = &info
36+ }
37+ */
38+
39+ func (t PSPDirectoryTableEntryType ) MarshalJSON () ([]byte , error ) {
40+ for _ , knownType := range knownTypes {
41+ if knownType .Type == uint32 (t ) {
42+ name := knownType .Name
43+ if name == "" {
44+ name = knownType .ProposedName
45+ }
46+ if name == "" {
47+ return json .Marshal (fmt .Sprintf ("0x%x" , t ))
48+ }
49+ return json .Marshal (name )
50+ }
51+ }
52+ return json .Marshal (fmt .Sprintf ("0x%x" , t ))
53+ }
You can’t perform that action at this time.
0 commit comments