[PATCH 2/2] nfit: remove broken NFITBadLineOffsetAlignment check

Robert Elliott elliott at hpe.com
Fri Jul 6 14:42:55 UTC 2018


Remove the NFITBadLineOffsetAlignment check.

Entries in the ACPI NFIT Interleave structure are in units of
the line size, not values required to be multiples of the line
size.  So, the test fails incorrectly with these errors:
  NFIT Subtable:
    Type:                                   0x0002
    Length:                                 0x0050
    Interleave Structure Index:             0x000c
    Reserved:                               0x0000
    Number of Lines Described:              0x00000010
    Line Size:                              0x00000100
    Line Offset:                            0x00000000
    Line Offset:                            0x00000001
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x00000001 instead
    Line Offset:                            0x00000002
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x00000002 instead
    Line Offset:                            0x00000003
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x00000003 instead
    Line Offset:                            0x00000004
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x00000004 instead
    Line Offset:                            0x00000005
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x00000005 instead
    Line Offset:                            0x00000006
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x00000006 instead
    Line Offset:                            0x00000007
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x00000007 instead
    Line Offset:                            0x00000008
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x00000008 instead
    Line Offset:                            0x00000009
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x00000009 instead
    Line Offset:                            0x0000000a
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x0000000a instead
    Line Offset:                            0x0000000b
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x0000000b instead
    Line Offset:                            0x0000000c
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x0000000c instead
    Line Offset:                            0x0000000d
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x0000000d instead
    Line Offset:                            0x0000000e
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x0000000e instead
    Line Offset:                            0x0000000f
FAILED [HIGH] NFITBadLineOffsetAlignment: Test 1, NFIT Line Offset must be aligned nfit_struct->line_size, got 0x0000000f instead

Instead, print the full SPA address offset alongside the Line Offset
(by multiplying by the Line Size).

  NFIT Subtable:
    Type:                                   0x0002
    Length:                                 0x0050
    Interleave Structure Index:             0x000c
    Reserved:                               0x0000
    Number of Lines Described:              0x00000010
    Line Size:                              0x00000100
    Line Offset:                            0x00000000, SPA 0x0000000000000000
    Line Offset:                            0x00000001, SPA 0x0000000000000100
    Line Offset:                            0x00000002, SPA 0x0000000000000200
    Line Offset:                            0x00000003, SPA 0x0000000000000300
    Line Offset:                            0x00000004, SPA 0x0000000000000400
    Line Offset:                            0x00000005, SPA 0x0000000000000500
    Line Offset:                            0x00000006, SPA 0x0000000000000600
    Line Offset:                            0x00000007, SPA 0x0000000000000700
    Line Offset:                            0x00000008, SPA 0x0000000000000800
    Line Offset:                            0x00000009, SPA 0x0000000000000900
    Line Offset:                            0x0000000a, SPA 0x0000000000000a00
    Line Offset:                            0x0000000b, SPA 0x0000000000000b00
    Line Offset:                            0x0000000c, SPA 0x0000000000000c00
    Line Offset:                            0x0000000d, SPA 0x0000000000000d00
    Line Offset:                            0x0000000e, SPA 0x0000000000000e00
    Line Offset:                            0x0000000f, SPA 0x0000000000000f00

Fixes: d11965d8346b9525 ("add ACPI NFIT test")
Signed-off-by: Robert Elliott <elliott at hpe.com>
---
 src/acpi/nfit/nfit.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/acpi/nfit/nfit.c b/src/acpi/nfit/nfit.c
index 99231501..961e5f28 100644
--- a/src/acpi/nfit/nfit.c
+++ b/src/acpi/nfit/nfit.c
@@ -250,15 +250,11 @@ static int nfit_test1(fwts_framework *fw)
 				break;
 			}
 
-			for (i = 0; i < nfit_struct->line_count; i++) {
-				fwts_log_info_verbatim(fw, "    Line Offset:                            0x%8.8"  PRIx32, nfit_struct->line_offset[i]);
-
-				if (nfit_struct->line_offset[i] % nfit_struct->line_size)
-					fwts_failed(fw, LOG_LEVEL_HIGH,
-						"NFITBadLineOffsetAlignment",
-						"NFIT Line Offset must be aligned nfit_struct->line_size, got "
-						"0x%8.8" PRIx32 " instead", nfit_struct->line_offset[i]);
-			}
+			for (i = 0; i < nfit_struct->line_count; i++)
+				fwts_log_info_verbatim(fw,
+					"    Line Offset:                            0x%8.8" PRIx32 ", SPA 0x%16.16" PRIx64,
+					nfit_struct->line_offset[i],
+					(uint64_t) nfit_struct->line_offset[i] * nfit_struct->line_size);
 
 			if (nfit_struct->reserved != 0)
 				reserved_passed = nfit_struct->reserved;
-- 
2.14.3




More information about the fwts-devel mailing list