73 #define DATA(...) { __VA_ARGS__ } 76 #define ACPI_TABLE( name, SIGNATURE, DATA ) \ 77 static const uint8_t name ## _data[] = DATA; \ 78 static struct acpi_test_table name = { \ 82 .data = name ## _data, \ 86 #define ACPI_TABLES( name, ... ) \ 87 static struct acpi_test_table * name ## _table[] = \ 89 static struct acpi_test_tables name = { \ 90 .table = name ## _table, \ 91 .count = ( sizeof ( name ## _table ) / \ 92 sizeof ( name ## _table[0] ) ), \ 96 #define ACPI_MAC( name, TABLES, EXPECTED ) \ 97 static struct acpi_mac_test name = { \ 99 .expected = EXPECTED, \ 113 DATA ( 0x53, 0x53, 0x44, 0x54, 0x5d, 0x00, 0x00, 0x00, 0x02,
114 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
116 0x00, 0x49, 0x4e, 0x54, 0x4c, 0x04, 0x06, 0x21, 0x20,
117 0x10, 0x38, 0x5c, 0x5f, 0x53, 0x42, 0x5f, 0x14, 0x08,
118 0x48, 0x57, 0x30, 0x30, 0x08, 0xa4, 0x00, 0x14, 0x1e,
119 0x41, 0x4d, 0x41, 0x43, 0x08, 0x0d, 0x5f, 0x41, 0x55,
120 0x58, 0x4d, 0x41, 0x43, 0x5f, 0x23, 0x35, 0x32, 0x35,
121 0x34, 0x30, 0x30, 0x61, 0x61, 0x62, 0x62, 0x63, 0x63,
122 0x23, 0x00, 0x14, 0x09, 0x48, 0x57, 0x34, 0x32, 0x08,
123 0xa4, 0x0a, 0x2a ) );
130 DATA ( 0x52, 0x54, 0x00, 0xaa, 0xbb, 0xcc ) );
134 DATA ( 0x53, 0x53, 0x44, 0x54, 0x3e, 0x00, 0x00, 0x00, 0x02,
135 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
137 0x00, 0x49, 0x4e, 0x54, 0x4c, 0x04, 0x06, 0x21, 0x20,
138 0x10, 0x19, 0x5c, 0x5f, 0x53, 0x42, 0x5f, 0x14, 0x08,
139 0x48, 0x57, 0x30, 0x30, 0x08, 0xa4, 0x00, 0x14, 0x09,
140 0x48, 0x57, 0x34, 0x32, 0x08, 0xa4, 0x0a, 0x2a ) );
144 DATA ( 0x53, 0x53, 0x44, 0x54, 0x54, 0x00, 0x00, 0x00, 0x02,
145 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
146 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
147 0x00, 0x49, 0x4e, 0x54, 0x4c, 0x04, 0x06, 0x21, 0x20,
148 0x10, 0x2f, 0x5c, 0x5f, 0x53, 0x42, 0x5f, 0x14, 0x1e,
149 0x4d, 0x41, 0x43, 0x41, 0x08, 0x0d, 0x5f, 0x41, 0x55,
150 0x58, 0x4d, 0x41, 0x43, 0x5f, 0x23, 0x35, 0x32, 0x35,
151 0x34, 0x30, 0x30, 0x31, 0x31, 0x32, 0x32, 0x33, 0x33,
152 0x23, 0x00, 0x14, 0x09, 0x48, 0x57, 0x39, 0x39, 0x08,
153 0xa4, 0x0a, 0x63 ) );
156 ACPI_TABLES ( maca_tables, &maca_ssdt1, &maca_ssdt2 );
160 DATA ( 0x52, 0x54, 0x00, 0x11, 0x22, 0x33 ) );
164 DATA ( 0x53, 0x53, 0x44, 0x54, 0x44, 0x00, 0x00, 0x00, 0x02,
165 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
167 0x00, 0x49, 0x4e, 0x54, 0x4c, 0x04, 0x06, 0x21, 0x20,
168 0x10, 0x1f, 0x5c, 0x5f, 0x53, 0x42, 0x5f, 0x14, 0x18,
169 0x52, 0x54, 0x4d, 0x41, 0x08, 0x0d, 0x5f, 0x52, 0x54,
170 0x58, 0x4d, 0x41, 0x43, 0x5f, 0x23, 0x52, 0x54, 0x30,
171 0x30, 0x30, 0x31, 0x23, 0x00 ) );
178 DATA ( 0x52, 0x54, 0x30, 0x30, 0x30, 0x31 ) );
221 const char *file,
unsigned int line ) {
230 okx (
rc == 0, file, line );
238 #define acpi_mac_ok( test ) \ 239 acpi_mac_okx ( test, __FILE__, __LINE__ ) struct arbelprm_rc_send_wqe rc
#define le32_to_cpu(value)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct acpi_test_table ** table
Tables.
An ACPI MAC extraction test.
#define ACPI_MAC(name, TABLES, EXPECTED)
Define an ACPI MAC extraction test.
typeof(acpi_find)
Override ACPI table finder.
struct self_test acpi_test __self_test
ACPI self-test.
Self-test infrastructure.
const char * name
Test set name.
static acpi_find(uint32_t signature, unsigned int index)
Locate ACPI table.
uint8_t mac[ETH_ALEN]
MAC address.
uint8_t expected[ETH_ALEN]
Expected MAC address.
An ACPI test table signature.
uint32_t userptr_t
A pointer to a user buffer.
int acpi_mac(uint8_t *hw_addr)
Extract MAC address from DSDT/SSDT.
#define okx(success, file, line)
Report test result.
unsigned int count
Number of tables.
#define ACPI_TABLES(name,...)
Define an ACPI test table set.
static struct acpi_test_tables * acpi_test_tables
Current ACPI test table set.
union acpi_test_signature signature
Signature.
struct acpi_test_tables * tables
ACPI test table set.
#define acpi_mac_ok(test)
#define UNULL
Equivalent of NULL for user pointers.
userptr_t virt_to_user(volatile const void *addr)
Convert virtual address to user pointer.
#define DATA(...)
Define inline data.
static userptr_t acpi_test_find(uint32_t signature, unsigned int index)
Locate ACPI test table.
u8 signature
CPU signature.
#define ACPI_TABLE(name, SIGNATURE, DATA)
Define an ACPI test table.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
#define NULL
NULL pointer (VOID *)
static void acpi_test_exec(void)
Perform ACPI self-test.
userptr_t(* acpi_finder)(uint32_t signature, unsigned int index)
const void * data
Table content.