intel / ipmctl

BSD 3-Clause "New" or "Revised" License
183 stars 62 forks source link

show -system NFIT SPA Range structure is broken #4

Closed RobertCElliott closed 6 years ago

RobertCElliott commented 6 years ago

The SPA Range structure decodes are broken, generally off by 4 bytes:

Type: 0x0
Length: 0x38
TypeEquals: SpaRange
AddressRangeType: 0
SpaRangeDescriptionTableIndex: 0x134fb00
Flags: 0x1
ProximityDomain: 0x0
SystemPhysicalAddressRangeBase: 0x0
SystemPhysicalAddressRangeLength: 0x17740000000
MemoryMappingAttribute: 0x1fc00000

Type: 0x0
Length: 0x38
TypeEquals: SpaRange
AddressRangeType: 0
SpaRangeDescriptionTableIndex: 0x1351b20
Flags: 0x2
ProximityDomain: 0x0
SystemPhysicalAddressRangeBase: 0x0
SystemPhysicalAddressRangeLength: 0x17760000000
MemoryMappingAttribute: 0x1fc00000

Type: 0x0
Length: 0x38
TypeEquals: SpaRange
AddressRangeType: 0
SpaRangeDescriptionTableIndex: 0x1351e70
Flags: 0x3
ProximityDomain: 0x0
SystemPhysicalAddressRangeBase: 0x0
SystemPhysicalAddressRangeLength: 0x17780000000
MemoryMappingAttribute: 0x1fc00000

Correct decode per acpidump -b and iasl -d nfit.dat:

[028h 0040   2]                Subtable Type : 0000 [System Physical Address Range]
[02Ah 0042   2]                       Length : 0038

[02Ch 0044   2]                  Range Index : 0001
[02Eh 0046   2]        Flags (decoded below) : 0000
                   Add/Online Operation Only : 0
                      Proximity Domain Valid : 0
[030h 0048   4]                     Reserved : 00000000
[034h 0052   4]             Proximity Domain : 00000000
[038h 0056  16]           Address Range GUID : 92F701F6-13B4-405D-910B-299367E8234C
[048h 0072   8]           Address Range Base : 0000017740000000
[050h 0080   8]         Address Range Length : 000000001FC00000
[058h 0088   8]         Memory Map Attribute : 0000000000000001

[2A0h 0672   2]                Subtable Type : 0000 [System Physical Address Range]
[2A2h 0674   2]                       Length : 0038

[2A4h 0676   2]                  Range Index : 0002
[2A6h 0678   2]        Flags (decoded below) : 0000
                   Add/Online Operation Only : 0
                      Proximity Domain Valid : 0
[2A8h 0680   4]                     Reserved : 00000000
[2ACh 0684   4]             Proximity Domain : 00000000
[2B0h 0688  16]           Address Range GUID : 92F701F6-13B4-405D-910B-299367E8234C
[2C0h 0704   8]           Address Range Base : 0000017760000000
[2C8h 0712   8]         Address Range Length : 000000001FC00000
[2D0h 0720   8]         Memory Map Attribute : 0000000000000001

[518h 1304   2]                Subtable Type : 0000 [System Physical Address Range]
[51Ah 1306   2]                       Length : 0038

[51Ch 1308   2]                  Range Index : 0003
[51Eh 1310   2]        Flags (decoded below) : 0000
                   Add/Online Operation Only : 0
                      Proximity Domain Valid : 0
[520h 1312   4]                     Reserved : 00000000
[524h 1316   4]             Proximity Domain : 00000000
[528h 1320  16]           Address Range GUID : 92F701F6-13B4-405D-910B-299367E8234C
[538h 1336   8]           Address Range Base : 0000017780000000
[540h 1344   8]         Address Range Length : 000000001FC00000
[548h 1352   8]         Memory Map Attribute : 0000000000000001
juston-li commented 6 years ago

Looks like we tried to print it with %g (GUID) which only works in EFI thus breaking the structure. Looking into a fix, this looks to affect all GUID prints in OS.

juston-li commented 6 years ago

Fix is in https://github.com/intel/ipmctl/commit/c402e4bfc502a21a84164a1d655261d522b0cfad