diff mbox series

[2/2] fwts-test: add regression tests for CEDT

Message ID 20221011082653.41440-2-ivan.hu@canonical.com
State Accepted
Headers show
Series [1/2] acpi: cedt: add tests for ACPI CEDT table (mantis 2076) | expand

Commit Message

ivanhu Oct. 11, 2022, 8:26 a.m. UTC
Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 Makefile.am                           |  2 +
 fwts-test/cedt-0001/acpidump-0001.log | 36 +++++++++++
 fwts-test/cedt-0001/acpidump-0002.log | 40 ++++++++++++
 fwts-test/cedt-0001/cedt-0001.log     | 54 ++++++++++++++++
 fwts-test/cedt-0001/cedt-0002.log     | 92 +++++++++++++++++++++++++++
 fwts-test/cedt-0001/test-0001.sh      | 23 +++++++
 fwts-test/cedt-0001/test-0002.sh      | 23 +++++++
 7 files changed, 270 insertions(+)
 create mode 100644 fwts-test/cedt-0001/acpidump-0001.log
 create mode 100644 fwts-test/cedt-0001/acpidump-0002.log
 create mode 100644 fwts-test/cedt-0001/cedt-0001.log
 create mode 100644 fwts-test/cedt-0001/cedt-0002.log
 create mode 100755 fwts-test/cedt-0001/test-0001.sh
 create mode 100755 fwts-test/cedt-0001/test-0002.sh
diff mbox series

Patch

diff --git a/Makefile.am b/Makefile.am
index 7f121ed5..06cd282c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,6 +96,8 @@  TESTS = fwts-test/acpidump-0001/test-0001.sh \
 	fwts-test/bgrt-0001/test-0002.sh \
 	fwts-test/boot-0001/test-0001.sh \
 	fwts-test/boot-0001/test-0002.sh \
+	fwts-test/cedt-0001/test-0001.sh \
+	fwts-test/cedt-0001/test-0002.sh \
 	fwts-test/checksum-0001/test-0001.sh \
 	fwts-test/checksum-0001/test-0003.sh \
 	fwts-test/checksum-0001/test-0004.sh \
diff --git a/fwts-test/cedt-0001/acpidump-0001.log b/fwts-test/cedt-0001/acpidump-0001.log
new file mode 100644
index 00000000..a09ee9e0
--- /dev/null
+++ b/fwts-test/cedt-0001/acpidump-0001.log
@@ -0,0 +1,36 @@ 
+FACS @ 0x00000000
+  0000: 46 41 43 53 40 00 00 00 00 00 00 00 00 00 00 00  FACS@...........
+  0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+
+FACP @ 0x00000000
+  0000: 46 41 43 50 f4 00 00 00 03 f9 41 4d 44 20 20 20  FACP......AMD   
+  0010: 47 55 41 4d 20 20 20 20 00 00 04 06 41 4d 44 20  GUAM    ....AMD 
+  0020: 40 42 0f 00 c0 2f e9 af 92 47 e8 af 00 02 09 00  @B.../...G......
+  0030: b0 00 00 00 f0 f1 00 00 00 80 00 00 00 00 00 00  ................
+  0040: 04 80 00 00 00 00 00 00 00 82 00 00 08 80 00 00  ................
+  0050: 20 80 00 00 00 00 00 00 04 02 01 04 08 00 00 00   ...............
+  0060: 65 00 e9 03 00 00 00 00 01 00 0d 00 32 00 00 00  e...........2...
+  0070: a5 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0080: 00 00 00 00 c0 2f e9 af 00 00 00 00 92 47 e8 af  ...../.......G..
+  0090: 00 00 00 00 01 20 00 00 00 80 00 00 00 00 00 00  ..... ..........
+  00a0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  ................
+  00b0: 04 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  00c0: 00 00 00 00 01 08 00 00 00 82 00 00 00 00 00 00  ................
+  00d0: 01 20 00 00 08 80 00 00 00 00 00 00 01 40 00 00  . ...........@..
+  00e0: 20 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ...............
+  00f0: 00 00 00 00                                      ....
+
+CEDT @ 0x0000000000000000
+  0000: 43 45 44 54 94 00 00 00 01 87 49 4e 54 45 4c 20  CEDT......INTEL 
+  0010: 54 45 4d 50 4c 41 54 45 00 00 00 00 49 4e 54 4c  TEMPLATE....INTL
+  0020: 17 12 21 20 00 00 20 00 00 5e ba 00 00 00 00 00  ..! .. ..^......
+  0030: 00 00 00 00 00 10 00 00 00 00 00 00 00 20 00 00  ............. ..
+  0040: 00 00 00 00 01 00 28 00 00 00 00 00 00 00 00 00  ......(.........
+  0050: 00 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00  ................
+  0060: 03 00 00 00 06 00 01 00 00 5e ba 00 02 00 18 00  .....^...^......
+  0070: 00 00 03 02 01 02 03 04 05 06 07 08 01 02 03 04  ................
+  0080: 05 06 07 08 03 00 10 00 01 09 00 00 00 00 00 00  ................
+  0090: 01 00 00 00                                      ....
diff --git a/fwts-test/cedt-0001/acpidump-0002.log b/fwts-test/cedt-0001/acpidump-0002.log
new file mode 100644
index 00000000..61519efe
--- /dev/null
+++ b/fwts-test/cedt-0001/acpidump-0002.log
@@ -0,0 +1,40 @@ 
+FACS @ 0x00000000
+  0000: 46 41 43 53 40 00 00 00 00 00 00 00 00 00 00 00  FACS@...........
+  0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+
+FACP @ 0x00000000
+  0000: 46 41 43 50 f4 00 00 00 03 f9 41 4d 44 20 20 20  FACP......AMD   
+  0010: 47 55 41 4d 20 20 20 20 00 00 04 06 41 4d 44 20  GUAM    ....AMD 
+  0020: 40 42 0f 00 c0 2f e9 af 92 47 e8 af 00 02 09 00  @B.../...G......
+  0030: b0 00 00 00 f0 f1 00 00 00 80 00 00 00 00 00 00  ................
+  0040: 04 80 00 00 00 00 00 00 00 82 00 00 08 80 00 00  ................
+  0050: 20 80 00 00 00 00 00 00 04 02 01 04 08 00 00 00   ...............
+  0060: 65 00 e9 03 00 00 00 00 01 00 0d 00 32 00 00 00  e...........2...
+  0070: a5 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0080: 00 00 00 00 c0 2f e9 af 00 00 00 00 92 47 e8 af  ...../.......G..
+  0090: 00 00 00 00 01 20 00 00 00 80 00 00 00 00 00 00  ..... ..........
+  00a0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  ................
+  00b0: 04 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  00c0: 00 00 00 00 01 08 00 00 00 82 00 00 00 00 00 00  ................
+  00d0: 01 20 00 00 08 80 00 00 00 00 00 00 01 40 00 00  . ...........@..
+  00e0: 20 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ...............
+  00f0: 00 00 00 00                                      ....
+
+CEDT @ 0x0000000000000000
+  0000: 43 45 44 54 d4 00 00 00 01 87 49 4e 54 45 4c 20  CEDT......INTEL 
+  0010: 54 45 4d 50 4c 41 54 45 00 00 00 00 49 4e 54 4c  TEMPLATE....INTL
+  0020: 17 12 21 20 00 00 20 00 00 5e ba 00 00 00 00 00  ..! .. ..^......
+  0030: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00  ............. ..
+  0040: 00 00 00 00 00 00 20 00 00 5e ba 00 01 00 00 00  ..! .. ..^......
+  0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00  ............. ..
+  0060: 00 00 00 00 00 00 20 00 00 5e ba 00 02 00 00 00  ..! .. ..^......
+  0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00  ............. ..
+  0080: 00 00 00 00 01 00 28 00 01 00 00 00 00 00 00 00  ......(.........
+  0090: 00 01 00 00 00 00 00 00 00 01 00 00 00 00 02 00  ................
+  00a0: 03 00 00 00 06 01 01 00 00 5e ba 00 02 00 18 00  .....^...^......
+  00b0: 01 00 03 02 01 02 03 04 05 06 07 08 01 02 03 04  ................
+  00c0: 05 06 07 08 03 00 10 00 00 00 09 01 02 00 00 00  ................
+  00d0: 01 00 00 00                                      ....
diff --git a/fwts-test/cedt-0001/cedt-0001.log b/fwts-test/cedt-0001/cedt-0001.log
new file mode 100644
index 00000000..3aa609a7
--- /dev/null
+++ b/fwts-test/cedt-0001/cedt-0001.log
@@ -0,0 +1,54 @@ 
+cedt            cedt: CEDT CXL Early Discovery Table test
+cedt            ----------------------------------------------------------
+cedt            Test 1 of 1: Validate CEDT table.
+cedt            CEDT CXL Early Discovery Table:
+cedt              CXL Host Bridge Structure (CHBS):
+cedt                Type:                           0x00
+cedt                Reserved:                       0x00
+cedt                Record Length:                  0x0020
+cedt                UID:                            0x00ba5e00
+cedt                CXL Version:                    0x00000000
+cedt                Reserved:                       0x00000000
+cedt                Base:                           0x0000000000001000
+cedt                Length:                         0x0000000000002000
+cedt            
+cedt              CXL Fixed Memory Window Structure (CFMWS):
+cedt                Type:                           0x01
+cedt                Reserved:                       0x00
+cedt                Record Length:                  0x0028
+cedt                Reserved:                       0x00000000
+cedt                Base HPA:                       0x0000010000000000
+cedt                Window Size:                    0x0000010000000000
+cedt                ENIW:                           0x00
+cedt                Interleave Arithmetic:          0x00
+cedt                Reserved:                       0x0000
+cedt                HBIG:                           0x00000003
+cedt                Window Restrictions:            0x0006
+cedt                QTG ID:                         0x0001
+cedt                Interleave Target List
+cedt            
+cedt              CXL XOR Interleave Math Structure (CXIMS):
+cedt                Type:                           0x02
+cedt                Reserved:                       0x00
+cedt                Record Length:                  0x0018
+cedt                Reserved:                       0x0000
+cedt                HBIG:                           0x03
+cedt                Number of Bitmap Entries(NIB):  0x02
+cedt                XORMAP List                     0x0807060504030201
+cedt                XORMAP List                     0x0807060504030201
+cedt            
+cedt              RCEC Downstream Port Association Structure (RDPAS):
+cedt                Type:                           0x03
+cedt                Reserved:                       0x00
+cedt                Record Length:                  0x0010
+cedt                RCEC Segment Number             0x0901
+cedt                RCEC BDF:                       0x0000
+cedt                Protocol Type:                  0x00
+cedt                Base Address                    0x0000000001000000
+cedt            
+cedt            PASSED: Test 1, No issues found in CEDT table.
+cedt            
+cedt            ==========================================================
+cedt            1 passed, 0 failed, 0 warning, 0 aborted, 0 skipped, 0
+cedt            info only.
+cedt            ==========================================================
diff --git a/fwts-test/cedt-0001/cedt-0002.log b/fwts-test/cedt-0001/cedt-0002.log
new file mode 100644
index 00000000..4706f058
--- /dev/null
+++ b/fwts-test/cedt-0001/cedt-0002.log
@@ -0,0 +1,92 @@ 
+cedt            cedt: CEDT CXL Early Discovery Table test
+cedt            ----------------------------------------------------------
+cedt            Test 1 of 1: Validate CEDT table.
+cedt            CEDT CXL Early Discovery Table:
+cedt              CXL Host Bridge Structure (CHBS):
+cedt                Type:                           0x00
+cedt                Reserved:                       0x00
+cedt                Record Length:                  0x0020
+cedt                UID:                            0x00ba5e00
+cedt                CXL Version:                    0x00000000
+cedt                Reserved:                       0x00000001
+cedt                Base:                           0x0000000000000000
+cedt                Length:                         0x0000000000010000
+cedt            FAILED [MEDIUM] CEDTReservedNonZero: Test 1, CEDT Reserved
+cedt            field must be zero, got 0x00000001 instead
+cedt            FAILED [HIGH] CEDTBadCHBSLength: Test 1, CEDT CHBS Length
+cedt            must be 0x2000, got 0x10000 instead
+cedt            
+cedt              CXL Host Bridge Structure (CHBS):
+cedt                Type:                           0x00
+cedt                Reserved:                       0x00
+cedt                Record Length:                  0x0020
+cedt                UID:                            0x00ba5e00
+cedt                CXL Version:                    0x00000001
+cedt                Reserved:                       0x00000000
+cedt                Base:                           0x0000000000000000
+cedt                Length:                         0x0000000000002000
+cedt            FAILED [HIGH] CEDTBadCHBSLength: Test 1, CEDT CHBS Length
+cedt            must be 0x10000, got 0x2000 instead
+cedt            
+cedt              CXL Host Bridge Structure (CHBS):
+cedt                Type:                           0x00
+cedt                Reserved:                       0x00
+cedt                Record Length:                  0x0020
+cedt                UID:                            0x00ba5e00
+cedt                CXL Version:                    0x00000002
+cedt                Reserved:                       0x00000000
+cedt                Base:                           0x0000000000000000
+cedt                Length:                         0x0000000000002000
+cedt            FAILED [HIGH] CEDTBadCXLVersion: Test 1, CXL Version must
+cedt            have the value with 0 or 1, got 0x2 instead
+cedt            
+cedt              CXL Fixed Memory Window Structure (CFMWS):
+cedt                Type:                           0x01
+cedt                Reserved:                       0x00
+cedt                Record Length:                  0x0028
+cedt                Reserved:                       0x00000001
+cedt                Base HPA:                       0x0000010000000000
+cedt                Window Size:                    0x0000010000000000
+cedt                ENIW:                           0x00
+cedt                Interleave Arithmetic:          0x00
+cedt                Reserved:                       0x0002
+cedt                HBIG:                           0x00000003
+cedt                Window Restrictions:            0x0106
+cedt                QTG ID:                         0x0001
+cedt                Interleave Target List
+cedt            FAILED [MEDIUM] CEDTReservedNonZero: Test 1, CEDT Reserved
+cedt            field must be zero, got 0x00000001 instead
+cedt            FAILED [MEDIUM] CEDTReservedNonZero: Test 1, CEDT Reserved
+cedt            field must be zero, got 0x0002 instead
+cedt            FAILED [HIGH] CEDTReservedBitsNonZero: Test 1, CEDT Window
+cedt            Restrictions Bits [15..5] must be zero, got 0x0106 instead
+cedt            
+cedt              CXL XOR Interleave Math Structure (CXIMS):
+cedt                Type:                           0x02
+cedt                Reserved:                       0x00
+cedt                Record Length:                  0x0018
+cedt                Reserved:                       0x0001
+cedt                HBIG:                           0x03
+cedt                Number of Bitmap Entries(NIB):  0x02
+cedt                XORMAP List                     0x0807060504030201
+cedt                XORMAP List                     0x0807060504030201
+cedt            FAILED [MEDIUM] CEDTReservedNonZero: Test 1, CEDT Reserved
+cedt            field must be zero, got 0x0001 instead
+cedt            
+cedt              RCEC Downstream Port Association Structure (RDPAS):
+cedt                Type:                           0x03
+cedt                Reserved:                       0x00
+cedt                Record Length:                  0x0010
+cedt                RCEC Segment Number             0x0000
+cedt                RCEC BDF:                       0x0109
+cedt                Protocol Type:                  0x02
+cedt                Base Address                    0x0000000001000000
+cedt            FAILED [HIGH] CEDTBadProtocolType: Test 1, CEDT CFMWS
+cedt            protocol type must have the value with 0 or 1, got 0x02
+cedt            instead
+cedt            
+cedt            
+cedt            ==========================================================
+cedt            0 passed, 9 failed, 0 warning, 0 aborted, 0 skipped, 0
+cedt            info only.
+cedt            ==========================================================
diff --git a/fwts-test/cedt-0001/test-0001.sh b/fwts-test/cedt-0001/test-0001.sh
new file mode 100755
index 00000000..393ac88b
--- /dev/null
+++ b/fwts-test/cedt-0001/test-0001.sh
@@ -0,0 +1,23 @@ 
+#!/bin/bash
+#
+TEST="Test acpitables against CEDT"
+NAME=test-0001.sh
+TMPLOG=$TMP/cedt.log.$$
+
+$FWTS --show-tests | grep cedt > /dev/null
+if [ $? -eq 1 ]; then
+	echo SKIP: $TEST, $NAME
+	exit 77
+fi
+
+$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/cedt-0001/acpidump-0001.log cedt - | cut -c7- | grep "^cedt" > $TMPLOG
+diff $TMPLOG $FWTSTESTDIR/cedt-0001/cedt-0001.log >> $FAILURE_LOG
+ret=$?
+if [ $ret -eq 0 ]; then
+	echo PASSED: $TEST, $NAME
+else
+	echo FAILED: $TEST, $NAME
+fi
+
+rm $TMPLOG
+exit $ret
diff --git a/fwts-test/cedt-0001/test-0002.sh b/fwts-test/cedt-0001/test-0002.sh
new file mode 100755
index 00000000..1bf7c7c6
--- /dev/null
+++ b/fwts-test/cedt-0001/test-0002.sh
@@ -0,0 +1,23 @@ 
+#!/bin/bash
+#
+TEST="Test acpitables against CEDT"
+NAME=test-0001.sh
+TMPLOG=$TMP/cedt.log.$$
+
+$FWTS --show-tests | grep cedt > /dev/null
+if [ $? -eq 1 ]; then
+	echo SKIP: $TEST, $NAME
+	exit 77
+fi
+
+$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/cedt-0001/acpidump-0002.log cedt - | cut -c7- | grep "^cedt" > $TMPLOG
+diff $TMPLOG $FWTSTESTDIR/cedt-0001/cedt-0002.log >> $FAILURE_LOG
+ret=$?
+if [ $ret -eq 0 ]; then
+	echo PASSED: $TEST, $NAME
+else
+	echo FAILED: $TEST, $NAME
+fi
+
+rm $TMPLOG
+exit $ret