From alex.hung at canonical.com Wed May 6 03:35:00 2015 From: alex.hung at canonical.com (Alex Hung) Date: Wed, 6 May 2015 11:35:00 +0800 Subject: [PATCH] acpi: method: update method list according to Table 5-162 in ACPI 6 Message-ID: <1430883300-16643-1-git-send-email-alex.hung@canonical.com> Note: _CR3 is not listed in Table 5-162. That requires fixing in next ACPI version Signed-off-by: Alex Hung --- src/acpi/method/method.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index cc1ed33..cb8c083 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -57,14 +57,16 @@ * _BMS 10.2.2.5 Y * _BQC B.6.4 Y * _BST 10.2.2.6 Y - * _BTM 10.2.2.8 Y - * _BTP 10.2.2.7 Y + * _BTH 10.2.2.7 N + * _BTM 10.2.2.9 Y + * _BTP 10.2.2.8 Y * _CBA PCI f/w spec Y * _CCA 6.2.17 Y * _CDM 6.2.1 Y * _CID 6.1.2 Y * _CLS 6.1.3 N requires PCI SIG class info * _CPC 8.4.5 Y + * _CR3 11.5.4 N * _CRS 6.2.2 Y * _CRT 11.4.4 Y * _CSD 8.4.2.2 Y @@ -124,12 +126,14 @@ * _Lxx 5.6.4.1 n/a * _LCK 6.3.4 Y * _LID 9.4.1 Y + * _LPI 8.4.4.3 N * _MAT 6.2.9 N * _MBM 9.12.2.1 Y * _MLS 6.1.7 Y * _MSG 9.1.2 Y * _MSM 9.12.2.2 N - * _NTT 11.4.7 Y + * _MTL 11.4.8 N + * _NTT 11.4.9 Y * _OFF 7.1.2 Y * _ON_ 7.1.3 Y * _OS 5.7.3 N @@ -139,7 +143,7 @@ * _PAI 10.4.4 n/a * _PCL 10.3.2 Y * _PCT 8.4.4.1 Y - * _PDC 8.4.1 N + * _PDC 8.4.1 deprecated * _PDL 8.4.4.6 Y * _PIC 5.8.1 Y * _PIF 10.3.3 Y @@ -156,8 +160,9 @@ * _PR3 7.2.11 Y * _PRE 7.2.12 Y * _PRL 10.3.4 Y - * _PRT 6.2.12 N + * _PRR 7.3.26 N * _PRS 6.2.11 Y + * _PRT 6.2.12 N * _PRW 7.2.11 Y * _PS0 7.2.2 Y * _PS1 7.2.3 Y @@ -177,10 +182,12 @@ * _PUR 8.5.11 Y * _PXM 6.2.13 Y * _Qxx 5.6.4.1 n/a + * _RDI 8.5 N * _REG 6.5.4 n/a * _REV 5.7.4 n/a * _RMV 6.3.6 Y * _ROM B.4.3 Y + * _RST 7.3.25 N * _RTV 11.4.10 Y * _S0_ 7.3.4.1 Y * _S1_ 7.3.4.2 Y @@ -221,6 +228,7 @@ * _TC1 11.4.12 Y * _TC2 11.4.13 Y * _TDL 8.4.3.5 Y + * _TFP 11.4.16 N * _TIP 9.18.9 Y * _TIV 9.18.10 Y * _TMP 11.4.14 Y @@ -228,6 +236,7 @@ * _TPT 11.4.15 Y * _TRT 11.4.16 Y * _TSD 8.4.3.4 Y + * _TSN 11.4.20 N * _TSP 11.4.17 Y * _TSS 8.4.3.2 Y * _TST 11.4.18 Y -- 1.9.1 From alex.hung at canonical.com Wed May 6 03:47:43 2015 From: alex.hung at canonical.com (Alex Hung) Date: Wed, 06 May 2015 11:47:43 +0800 Subject: ACK: [PATCH] acpi: spcr: remove unnecessary include files and fix ARM build issue In-Reply-To: <1430383022-23263-1-git-send-email-colin.king@canonical.com> References: <1430383022-23263-1-git-send-email-colin.king@canonical.com> Message-ID: <55498EDF.6090206@canonical.com> On 04/30/2015 04:37 PM, Colin King wrote: > From: Colin Ian King > > Fix build error, is not needed and causes build error on > ARM64: > > acpi/spcr/spcr.c:27:20: fatal error: sys/io.h: No such file or directory > #include > > ..and remove two more sys include files that are not required too. > > Signed-off-by: Colin Ian King > --- > src/acpi/spcr/spcr.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c > index 930168e..7012e43 100644 > --- a/src/acpi/spcr/spcr.c > +++ b/src/acpi/spcr/spcr.c > @@ -22,9 +22,6 @@ > > #include > #include > -#include > -#include > -#include > #include > #include > #include > Acked-by: Alex Hung From alex.hung at canonical.com Wed May 6 03:47:56 2015 From: alex.hung at canonical.com (Alex Hung) Date: Wed, 06 May 2015 11:47:56 +0800 Subject: ACK: [PATCH] pci: maxreadreq: skip test if /sys/bus/pci/devices is not available In-Reply-To: <1430384613-24388-1-git-send-email-colin.king@canonical.com> References: <1430384613-24388-1-git-send-email-colin.king@canonical.com> Message-ID: <55498EEC.8030101@canonical.com> On 04/30/2015 05:03 PM, Colin King wrote: > From: Colin Ian King > > Rather than exiting with an error we should skip this test if > /sys/bus/pci/devices does not exit, for example, on an ARM64 in a VM. > > Signed-off-by: Colin Ian King > --- > src/pci/maxreadreq/maxreadreq.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/src/pci/maxreadreq/maxreadreq.c b/src/pci/maxreadreq/maxreadreq.c > index 93745a4..ea9db36 100644 > --- a/src/pci/maxreadreq/maxreadreq.c > +++ b/src/pci/maxreadreq/maxreadreq.c > @@ -32,6 +32,16 @@ > #include > #include > > +static int maxreadreq_init(fwts_framework *fw) > +{ > + if (access(FWTS_PCI_DEV_PATH, R_OK) < 0) { > + fwts_log_info(fw, "Could not access %s, skipping test", > + FWTS_PCI_DEV_PATH); > + return FWTS_SKIP; > + } > + return FWTS_OK; > +} > + > /* > * This test checks if MaxReadReq is set > 128 for non-internal stuff > * A too low value hurts performance > @@ -141,6 +151,7 @@ static fwts_framework_minor_test maxreadreq_tests[] = { > }; > > static fwts_framework_ops maxreadreq_ops = { > + .init = maxreadreq_init, > .description = "Test firmware has set PCI Express MaxReadReq to a higher value on non-motherboard devices.", > .minor_tests = maxreadreq_tests > }; > Acked-by: Alex Hung From alex.hung at canonical.com Wed May 6 03:52:56 2015 From: alex.hung at canonical.com (Alex Hung) Date: Wed, 06 May 2015 11:52:56 +0800 Subject: ACK: [PATCH] acpi: spcr: issue a passed message if SPCR test passes In-Reply-To: <1430385430-24917-1-git-send-email-colin.king@canonical.com> References: <1430385430-24917-1-git-send-email-colin.king@canonical.com> Message-ID: <55499018.9030707@canonical.com> On 04/30/2015 05:17 PM, Colin King wrote: > From: Colin Ian King > > Forgot to give postive passed feedback if SPCR test actually passes. > Verified this now on an example ACPI table from an ARM 64 platform. > > Signed-off-by: Colin Ian King > --- > src/acpi/spcr/spcr.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c > index 7012e43..9fc7655 100644 > --- a/src/acpi/spcr/spcr.c > +++ b/src/acpi/spcr/spcr.c > @@ -55,6 +55,7 @@ static int spcr_test1(fwts_framework *fw) > char *str; > bool reserved = false; > bool pci = true; > + bool passed = true; > > /* Assuming revision 2 */ > switch (spcr->interface_type) { > @@ -80,6 +81,7 @@ static int spcr_test1(fwts_framework *fw) > > fwts_log_info_verbatum(fw, "Serial Interface: %s", str); > if (reserved) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRInterfaceReserved", > "SPCR Serial interface type 0x%2.2" PRIx8 > @@ -89,6 +91,7 @@ static int spcr_test1(fwts_framework *fw) > if ((spcr->reserved1[0] | > spcr->reserved1[1] | > spcr->reserved1[2])) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_LOW, > "SPCRReservedNonZero", > "SPCR reserved field must be zero, got " > @@ -99,11 +102,13 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->interrupt_type == 0) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRUnknownInterruptType", > "SPCR interrupt type field is zero, expecting support bits to be set"); > } > if (spcr->interrupt_type & 0xf0) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRIllegalReservedInterruptType", > "SPCR interrupt type reserved bits are non-zero zero, got 0x%" PRIx8, > @@ -118,6 +123,7 @@ static int spcr_test1(fwts_framework *fw) > case 14 ... 15: > break; > default: > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRIllegalIRQ", > "SPCR PC-AT compatible IRQ 0x%" PRIx8 " is invalid", spcr->irq); > @@ -145,6 +151,7 @@ static int spcr_test1(fwts_framework *fw) > } > fwts_log_info_verbatum(fw, "Baud Rate: %s", str); > if (reserved) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRBaudRateReserved", > "SPCR Serial baud rate type 0x%2.2" PRIx8 > @@ -152,6 +159,7 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->parity & ~1) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRParityReserved", > "SPCR parity reserved bits 1..7 are non-zero, value is 0x%2.2" PRIx8, > @@ -160,6 +168,7 @@ static int spcr_test1(fwts_framework *fw) > > /* Stop bit *really* is bit 1 according to the spec */ > if (spcr->parity & ~2) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRStopBitReserved", > "SPCR stop bit reserved bits 0,2..7 are non-zero, value is 0x%2.2" PRIx8, > @@ -167,6 +176,7 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->flow_control & ~7) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRFlowControlReserved", > "SPCR flow control reserved bits 3..7 are non-zero, value is 0x%2.2" PRIx8, > @@ -193,6 +203,7 @@ static int spcr_test1(fwts_framework *fw) > } > fwts_log_info_verbatum(fw, "Terminal Type: %s", str); > if (reserved) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRTerminalTypeReserved", > "SPCR terminal type type 0x%2.2" PRIx8 > @@ -200,6 +211,7 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->reserved2) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_LOW, > "SPCRReservedNonZero", > "SPCR reserved field must be zero, got " > @@ -217,6 +229,7 @@ static int spcr_test1(fwts_framework *fw) > /* Now validate all pci specific fields if not-PCI enabled */ > if (pci) { > if (spcr->pci_device_id == 0xffff) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRPciDeviceID", > "SPCR PCI device ID is 0x%4.4" PRIx16 > @@ -224,6 +237,7 @@ static int spcr_test1(fwts_framework *fw) > spcr->pci_device_id); > } > if (spcr->pci_vendor_id == 0xffff) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRPciVendorID", > "SPCR PCI vendor ID is 0x%4.4" PRIx16 > @@ -231,6 +245,7 @@ static int spcr_test1(fwts_framework *fw) > spcr->pci_vendor_id); > } > if ((spcr->pci_flags & 1) == 0) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRPciFlagsBit0", > "SPCR PCI flags compatibility bit 0 is %" PRIx32 > @@ -240,6 +255,7 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->pci_flags & 0xfffe) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRPciFlags", > "SPCR PCI flags reserved bits 1-31 are %" PRIx32 > @@ -248,12 +264,16 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->reserved3) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_LOW, > "SPCRReservedNonZero", > "SPCR reserved field must be zero, got " > "0x%2.2" PRIx8 " instead", spcr->reserved3); > } > > + if (passed) > + fwts_passed(fw, "No issues found in SPCR table."); > + > return FWTS_OK; > } > > Acked-by: Alex Hung -- Cheers, Alex Hung From alex.hung at canonical.com Wed May 6 03:53:10 2015 From: alex.hung at canonical.com (Alex Hung) Date: Wed, 06 May 2015 11:53:10 +0800 Subject: ACK: [PATCH] doc: fwts manual: update list of contributors at end of the manual In-Reply-To: <1430388363-26309-1-git-send-email-colin.king@canonical.com> References: <1430388363-26309-1-git-send-email-colin.king@canonical.com> Message-ID: <55499026.4000105@canonical.com> On 04/30/2015 06:06 PM, Colin King wrote: > From: Colin Ian King > > We need to update the names of contributors as the list is a little > out of date. > > Signed-off-by: Colin Ian King > --- > doc/fwts.1 | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/doc/fwts.1 b/doc/fwts.1 > index 4c22abe..aacd39e 100644 > --- a/doc/fwts.1 > +++ b/doc/fwts.1 > @@ -2,7 +2,7 @@ > .\" First parameter, NAME, should be all caps > .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection > .\" other parameters are allowed: see man(7), man(1) > -.TH FWTS 1 "5 February, 2015" > +.TH FWTS 1 "30 April, 2015" > .\" Please adjust this date whenever revising the manpage. > .\" > .\" Some roff macros, for reference: > @@ -391,9 +391,10 @@ sudo fwts s3 \-\-s3\-multiple=100 \-\-s3\-min\-delay=1 \-\-s3\-max\-delay=10 \-\ > fwts was originally written by Colin King with much of the original test > code derived from the Intel Linux Firmware test kit. Many thanks also for > contributions (in alpabetical order) from AceLan Kao, Alberto Milone, > -Alex Hung, Chris Van Hoof, Ivan Hu, Jeremy Kerr, Kamal Mostafa, > -Keng-Yu Lin, Matt Flemimg, Naresh Bhat, Robert Hooker, Seth Forshee, > -Yang Kun and Zhang Rui. > +Alex Hung, Chris Van Hoof, Fu Wei, Heyi Guo, Ivan Hu, Jeremy Kerr, > +Kamal Mostafa, Keng-Yu Lin, Matt Flemimg, Naresh Bhat, Phidias Chiang, > +Pradeep Gaddam, Ricardo Neri, Robert Hooker, Seth Forshee, > +Yang Kun, Yi Li and Zhang Rui. > .PP > This manual page was written by Colin King for the Ubuntu project > (but may be used by others). > Acked-by: Alex Hung From colin.king at canonical.com Wed May 6 08:36:23 2015 From: colin.king at canonical.com (Colin King) Date: Wed, 6 May 2015 09:36:23 +0100 Subject: [PATCH] lib: fwts_alloc: provide fallback low memory allocator strategy (LP: #1452168) Message-ID: <1430901383-7080-1-git-send-email-colin.king@canonical.com> From: Colin Ian King The fwts low memory allocator made some assumptions that /proc/self/maps was always available for parsing to gain some smarts on how to do a 32 bit memory allocation. Apparently some platforms this is not available or can't be parsed or just does not provide enough free memory slots so this fails. Instead, we need to have a fall-back dumb low memory allocator scheme that walks through memory trying to find free regions using mincore() to do the probing. Thanks to Suravee Suthikulpanit for finding, debugging and testing this fix. Tested-by: Suravee Suthikulpanit Signed-off-by: Colin Ian King --- src/lib/src/fwts_alloc.c | 85 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 11 deletions(-) diff --git a/src/lib/src/fwts_alloc.c b/src/lib/src/fwts_alloc.c index 9bac784..89aaa34 100644 --- a/src/lib/src/fwts_alloc.c +++ b/src/lib/src/fwts_alloc.c @@ -22,13 +22,14 @@ #include #include #include +#include -#include "fwts_alloc.h" +#include "fwts.h" /* * We implement a low memory allocator to allow us to allocate * memory < 2G limit for the ACPICA table handling. On 64 bit - * machines we habe to ensure that cached copies of ACPI tables + * machines we have to ensure that cached copies of ACPI tables * have addresses that can be addressed by the legacy 32 bit * ACPI table pointers. * @@ -47,11 +48,61 @@ typedef struct { unsigned int magic; } fwts_mmap_header; -#define CHUNK_SIZE (8192) /* page plus loads of slack */ +/* + * CHUNK_SIZE controls the gap between mappings. This creates gaps + * between each low memory allocation so that we have some chance + * of catching memory accesses that fall off the mapping. Without + * a gap, memory mappings potentially become contiguous and hence + * memory access errors are harder to catch. This is wasteful + * in terms of address space, but fwts doesn't do too many low memory + * mappings since they are just used for cached copies of ACPI tables. + */ +#define CHUNK_SIZE (64*1024) + #define LIMIT_2GB (0x80000000ULL) #define LIMIT_START (0x00010000ULL) -#ifndef MAP_32BIT +/* + * fwts_low_mmap_walkdown() + * try to allocate a free space under the 2GB limit by + * walking down memory in CHUNK_SIZE steps for an unmapped region + */ +static void *fwts_low_mmap_walkdown(const size_t requested_size) +{ + void *addr; + size_t page_size = fwts_page_size(); + size_t sz = (requested_size + page_size) & ~(page_size - 1); + size_t pages = sz / page_size; + unsigned char vec[pages]; + static void *last_addr = (void *)LIMIT_2GB; + + if (requested_size == 0) /* Illegal */ + return MAP_FAILED; + + for (addr = last_addr - sz; addr > (void *)LIMIT_START; addr -= CHUNK_SIZE) { + void *mapping; + + /* Already mapped? */ + if (mincore(addr, pages, vec) == 0) + continue; + + /* Not mapped but mincore returned something unexpected? */ + if (errno != ENOMEM) + continue; + + mapping = mmap(addr, requested_size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, -1, 0); + if (mapping != MAP_FAILED) { + last_addr = mapping; + return mapping; + } + } + /* We've scanned all of memory, give up on subsequent calls */ + last_addr = (void *)LIMIT_START; + + return MAP_FAILED; +} + /* * fwts_low_mmap() * try to find a free space under the 2GB limit and mmap it. @@ -71,13 +122,16 @@ static void *fwts_low_mmap(const size_t requested_size) if (requested_size == 0) /* Illegal */ return MAP_FAILED; + /* + * If we can't access our own mappings then find a + * free page by just walking down memory + */ if ((fp = fopen("/proc/self/maps", "r")) == NULL) - return MAP_FAILED; + return fwts_low_mmap_walkdown(requested_size); while (fgets(buffer, sizeof(buffer), fp) != NULL) { sscanf(buffer, "%p-%p %*s %*x %*s %*u %1023s", &addr_start, &addr_end, pathname); - /* * Try and allocate under first mmap'd address space */ @@ -111,6 +165,7 @@ static void *fwts_low_mmap(const size_t requested_size) (last_addr_end < (void*)LIMIT_2GB)) { if (((uint8_t *)addr_start - (uint8_t *)last_addr_end) > (ptrdiff_t)requested_size) { void *addr = last_addr_end; + ret = mmap(addr, requested_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, -1, 0); if (ret != MAP_FAILED) @@ -133,9 +188,15 @@ static void *fwts_low_mmap(const size_t requested_size) } fclose(fp); + /* + * The "intelligent" memory hole finding strategy failed, + * so try walking down memory instead. + */ + if (ret == MAP_FAILED) + ret = fwts_low_mmap_walkdown(requested_size); + return ret; } -#endif /* * fwts_low_calloc() @@ -147,7 +208,7 @@ static void *fwts_low_mmap(const size_t requested_size) void *fwts_low_calloc(const size_t nmemb, const size_t size) { size_t n = nmemb * size; - void *ret; + void *ret = MAP_FAILED; fwts_mmap_header *hdr; n += sizeof(fwts_mmap_header); @@ -161,11 +222,13 @@ void *fwts_low_calloc(const size_t nmemb, const size_t size) /* 32 bit mmap by default */ ret = mmap(NULL, n, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - } else { - /* We don't have a native MAP_32BIT, so bodge our own */ - ret = fwts_low_mmap(n); } #endif + /* 32 bit mmap failed, so bodge our own 32 bit mmap */ + if (ret == MAP_FAILED) + ret = fwts_low_mmap(n); + + /* OK, really can't mmap, give up */ if (ret == MAP_FAILED) return NULL; -- 2.1.4 From ivan.hu at canonical.com Fri May 8 03:46:27 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 08 May 2015 11:46:27 +0800 Subject: ACK: [PATCH 1/4] lib: fwts_acpi_tables: print correct pathname on error In-Reply-To: <1429790258-19416-2-git-send-email-colin.king@canonical.com> References: <1429790258-19416-1-git-send-email-colin.king@canonical.com> <1429790258-19416-2-git-send-email-colin.king@canonical.com> Message-ID: <554C3193.8060809@canonical.com> On 2015?04?23? 19:57, Colin King wrote: > From: Colin Ian King > > The acpi_table_path should be printed rather than the fw->acpi_table_path > pathname on an error. > > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_acpi_tables.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c > index d3ef6cd..08230f8 100644 > --- a/src/lib/src/fwts_acpi_tables.c > +++ b/src/lib/src/fwts_acpi_tables.c > @@ -697,7 +697,7 @@ static int fwts_acpi_load_tables_from_file_generic( > */ > if ((*count = scandir(acpi_table_path, &dir_entries, 0, alphasort)) < 0) { > fwts_log_error(fw, "Cannot open directory '%s' to read ACPI tables.", > - fw->acpi_table_path); > + acpi_table_path); > return FWTS_ERROR; > } > Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 8 03:46:45 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 08 May 2015 11:46:45 +0800 Subject: ACK: [PATCH 2/4] lib: fwts_acpi_tables: set count correctly on error In-Reply-To: <1429790258-19416-3-git-send-email-colin.king@canonical.com> References: <1429790258-19416-1-git-send-email-colin.king@canonical.com> <1429790258-19416-3-git-send-email-colin.king@canonical.com> Message-ID: <554C31A5.7050502@canonical.com> On 2015?04?23? 19:57, Colin King wrote: > From: Colin Ian King > > On a scandir failure count is -1 and should be in set to zero. > Also, remove the error message since the failure to get ACPI tables > is reported by all the callers to fwts_acpi_load_tables_from_file_generic > so the error message is unnecessary. > > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_acpi_tables.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c > index 08230f8..24a724e 100644 > --- a/src/lib/src/fwts_acpi_tables.c > +++ b/src/lib/src/fwts_acpi_tables.c > @@ -696,8 +696,7 @@ static int fwts_acpi_load_tables_from_file_generic( > * in some form of deterministic order > */ > if ((*count = scandir(acpi_table_path, &dir_entries, 0, alphasort)) < 0) { > - fwts_log_error(fw, "Cannot open directory '%s' to read ACPI tables.", > - acpi_table_path); > + *count = 0; > return FWTS_ERROR; > } > Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 8 03:47:05 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 08 May 2015 11:47:05 +0800 Subject: ACK: [PATCH 3/4] lib: fwts_acpi_tables: only attempt to open a dumpfile if name is defined In-Reply-To: <1429790258-19416-4-git-send-email-colin.king@canonical.com> References: <1429790258-19416-1-git-send-email-colin.king@canonical.com> <1429790258-19416-4-git-send-email-colin.king@canonical.com> Message-ID: <554C31B9.1020003@canonical.com> On 2015?04?23? 19:57, Colin King wrote: > From: Colin Ian King > > fwts_acpi_load_tables_from_acpidump should only attempt to open an ACPI > dumpfile if the fw->acpi_table_acpidump_file is actually defined > > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_acpi_tables.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c > index 24a724e..81fb096 100644 > --- a/src/lib/src/fwts_acpi_tables.c > +++ b/src/lib/src/fwts_acpi_tables.c > @@ -618,6 +618,9 @@ static int fwts_acpi_load_tables_from_acpidump(fwts_framework *fw) > { > FILE *fp; > > + if (!fw->acpi_table_acpidump_file) > + return FWTS_ERROR; > + > if ((fp = fopen(fw->acpi_table_acpidump_file, "r")) == NULL) { > fwts_log_error(fw, "Cannot open '%s' to read ACPI tables.", > fw->acpi_table_acpidump_file); Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 8 03:47:22 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 08 May 2015 11:47:22 +0800 Subject: ACK: [PATCH 4/4] pci: aspm: check that a table exists, fixes segv on arm64 In-Reply-To: <1429790258-19416-5-git-send-email-colin.king@canonical.com> References: <1429790258-19416-1-git-send-email-colin.king@canonical.com> <1429790258-19416-5-git-send-email-colin.king@canonical.com> Message-ID: <554C31CA.5090805@canonical.com> On 2015?04?23? 19:57, Colin King wrote: > From: Colin Ian King > > A recently tested ARM64 platform did not load a FACP causing the > table to be null and a null pointer deference occurred. Fix this > by checking for a null before proceeding with the test. > > Signed-off-by: Colin Ian King > --- > src/pci/aspm/aspm.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/src/pci/aspm/aspm.c b/src/pci/aspm/aspm.c > index 0851c22..8d431b1 100644 > --- a/src/pci/aspm/aspm.c > +++ b/src/pci/aspm/aspm.c > @@ -56,6 +56,8 @@ static int facp_get_aspm_control(fwts_framework *fw) > if (fwts_acpi_find_table(fw, "FACP", 0, &table) != FWTS_OK) { > return FWTS_ERROR; > } > + if (table == NULL) > + return FWTS_ERROR; > fadt = (fwts_acpi_table_fadt*)table->data; > > if ((fadt->iapc_boot_arch & FWTS_FACP_IAPC_BOOT_ARCH_PCIE_ASPM_CONTROLS) == 0) { Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 8 03:47:43 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 08 May 2015 11:47:43 +0800 Subject: ACK: [PATCH] lib: fwts_smbios: only scan memory for DMI table if x86 In-Reply-To: <1429799692-28438-1-git-send-email-colin.king@canonical.com> References: <1429799692-28438-1-git-send-email-colin.king@canonical.com> Message-ID: <554C31DF.5070404@canonical.com> On 2015?04?23? 22:34, Colin King wrote: > From: Colin Ian King > > The SMBIOS data should only be scanned for on x86 systems as the > location of the tables is well known to be between 0x000e0000 and > 0x000fffff for this architecture. > > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_smbios.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_smbios.c b/src/lib/src/fwts_smbios.c > index 5f67de3..cd537de 100644 > --- a/src/lib/src/fwts_smbios.c > +++ b/src/lib/src/fwts_smbios.c > @@ -41,6 +41,7 @@ static void *fwts_smbios_find_entry_uefi(fwts_framework *fw, fwts_smbios_entry * > return addr; > } > > +#if defined(FWTS_ARCH_INTEL) > /* > * fwts_smbios_find_entry_bios() > * find SMBIOS structure table entry by scanning memory > @@ -87,6 +88,7 @@ static void *fwts_smbios_find_entry_bios(fwts_framework *fw, fwts_smbios_entry * > > return addr; > } > +#endif > > /* > * fwts_smbios_find_entry() > @@ -102,7 +104,8 @@ void *fwts_smbios_find_entry(fwts_framework *fw, > > /* Check EFI first */ > if ((addr = fwts_smbios_find_entry_uefi(fw, entry, type)) == NULL) { > - /* Failed? then scan memory */ > +#if defined(FWTS_ARCH_INTEL) > + /* Failed? then scan x86 memory for SMBIOS tag */ > addr = fwts_smbios_find_entry_bios(fw, entry, type); > if (addr) { > switch (*type) { > @@ -118,6 +121,9 @@ void *fwts_smbios_find_entry(fwts_framework *fw, > break; > } > } > +#else > + (void)version; > +#endif > } > return addr; > } Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 8 04:02:56 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 08 May 2015 12:02:56 +0800 Subject: ACK: [PATCH] dmi: dmicheck: add 4 new DMI chassis types In-Reply-To: <1429799724-28514-1-git-send-email-colin.king@canonical.com> References: <1429799724-28514-1-git-send-email-colin.king@canonical.com> Message-ID: <554C3570.50505@canonical.com> On 2015?04?23? 22:35, Colin King wrote: > From: Colin Ian King > > Keep chassis types sync'd with DMI spec 3.0.0 (DSP0134, 2015-02-12). > Also fix typo on one of the constants: > FWTS_SMBIOS_CHASSIS_BLASE_ENCLOSURE -> > FWTS_SMBIOS_CHASSIS_BLADE_ENCLOSURE > > Signed-off-by: Colin Ian King > --- > src/dmi/dmicheck/dmicheck.c | 5 ++++- > src/lib/include/fwts_smbios.h | 5 ++++- > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/src/dmi/dmicheck/dmicheck.c b/src/dmi/dmicheck/dmicheck.c > index ace7b9e..5fabca0 100644 > --- a/src/dmi/dmicheck/dmicheck.c > +++ b/src/dmi/dmicheck/dmicheck.c > @@ -236,7 +236,10 @@ static const fwts_chassis_type_map fwts_dmi_chassis_type[] = { > { "Compact PCI", FWTS_SMBIOS_CHASSIS_COMPACT_PCI, CHASSIS_OTHER }, > { "Advanced TCA", FWTS_SMBIOS_CHASSIS_ADVANCED_TCA, CHASSIS_OTHER }, > { "Blade", FWTS_SMBIOS_CHASSIS_BLADE, CHASSIS_SERVER }, > - { "Enclosure", FWTS_SMBIOS_CHASSIS_BLASE_ENCLOSURE, CHASSIS_SERVER } > + { "Enclosure", FWTS_SMBIOS_CHASSIS_BLADE_ENCLOSURE, CHASSIS_SERVER }, > + { "Tablet", FWTS_SMBIOS_CHASSIS_TABLET, CHASSIS_MOBILE }, > + { "Convertible", FWTS_SMBIOS_CHASSIS_CONVERTIBLE, CHASSIS_MOBILE }, > + { "Detachable", FWTS_SMBIOS_CHASSIS_DETACHABLE, CHASSIS_MOBILE }, > }; > > static const fwts_chassis_type_map fwts_acpi_pm_profile_type[] = { > diff --git a/src/lib/include/fwts_smbios.h b/src/lib/include/fwts_smbios.h > index 7fc84e6..0d929b8 100644 > --- a/src/lib/include/fwts_smbios.h > +++ b/src/lib/include/fwts_smbios.h > @@ -56,7 +56,10 @@ > #define FWTS_SMBIOS_CHASSIS_COMPACT_PCI (0x1A) > #define FWTS_SMBIOS_CHASSIS_ADVANCED_TCA (0x1B) > #define FWTS_SMBIOS_CHASSIS_BLADE (0x1C) > -#define FWTS_SMBIOS_CHASSIS_BLASE_ENCLOSURE (0x1D) > +#define FWTS_SMBIOS_CHASSIS_BLADE_ENCLOSURE (0x1D) > +#define FWTS_SMBIOS_CHASSIS_TABLET (0x1E) > +#define FWTS_SMBIOS_CHASSIS_CONVERTIBLE (0x1F) > +#define FWTS_SMBIOS_CHASSIS_DETACHABLE (0x20) > > typedef enum { > FWTS_SMBIOS_UNKNOWN = -1, Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 8 04:04:29 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 08 May 2015 12:04:29 +0800 Subject: ACK: [PATCH] acpi: spcr: remove unnecessary include files and fix ARM build issue In-Reply-To: <1430383022-23263-1-git-send-email-colin.king@canonical.com> References: <1430383022-23263-1-git-send-email-colin.king@canonical.com> Message-ID: <554C35CD.7050200@canonical.com> On 2015?04?30? 16:37, Colin King wrote: > From: Colin Ian King > > Fix build error, is not needed and causes build error on > ARM64: > > acpi/spcr/spcr.c:27:20: fatal error: sys/io.h: No such file or directory > #include > > ..and remove two more sys include files that are not required too. > > Signed-off-by: Colin Ian King > --- > src/acpi/spcr/spcr.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c > index 930168e..7012e43 100644 > --- a/src/acpi/spcr/spcr.c > +++ b/src/acpi/spcr/spcr.c > @@ -22,9 +22,6 @@ > > #include > #include > -#include > -#include > -#include > #include > #include > #include Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 8 04:05:54 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 08 May 2015 12:05:54 +0800 Subject: ACK: [PATCH] pci: maxreadreq: skip test if /sys/bus/pci/devices is not available In-Reply-To: <1430384613-24388-1-git-send-email-colin.king@canonical.com> References: <1430384613-24388-1-git-send-email-colin.king@canonical.com> Message-ID: <554C3622.9010503@canonical.com> On 2015?04?30? 17:03, Colin King wrote: > From: Colin Ian King > > Rather than exiting with an error we should skip this test if > /sys/bus/pci/devices does not exit, for example, on an ARM64 in a VM. > > Signed-off-by: Colin Ian King > --- > src/pci/maxreadreq/maxreadreq.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/src/pci/maxreadreq/maxreadreq.c b/src/pci/maxreadreq/maxreadreq.c > index 93745a4..ea9db36 100644 > --- a/src/pci/maxreadreq/maxreadreq.c > +++ b/src/pci/maxreadreq/maxreadreq.c > @@ -32,6 +32,16 @@ > #include > #include > > +static int maxreadreq_init(fwts_framework *fw) > +{ > + if (access(FWTS_PCI_DEV_PATH, R_OK) < 0) { > + fwts_log_info(fw, "Could not access %s, skipping test", > + FWTS_PCI_DEV_PATH); > + return FWTS_SKIP; > + } > + return FWTS_OK; > +} > + > /* > * This test checks if MaxReadReq is set > 128 for non-internal stuff > * A too low value hurts performance > @@ -141,6 +151,7 @@ static fwts_framework_minor_test maxreadreq_tests[] = { > }; > > static fwts_framework_ops maxreadreq_ops = { > + .init = maxreadreq_init, > .description = "Test firmware has set PCI Express MaxReadReq to a higher value on non-motherboard devices.", > .minor_tests = maxreadreq_tests > }; Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 8 04:07:48 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 08 May 2015 12:07:48 +0800 Subject: ACK: [PATCH] acpi: spcr: issue a passed message if SPCR test passes In-Reply-To: <1430385430-24917-1-git-send-email-colin.king@canonical.com> References: <1430385430-24917-1-git-send-email-colin.king@canonical.com> Message-ID: <554C3694.3060504@canonical.com> On 2015?04?30? 17:17, Colin King wrote: > From: Colin Ian King > > Forgot to give postive passed feedback if SPCR test actually passes. > Verified this now on an example ACPI table from an ARM 64 platform. > > Signed-off-by: Colin Ian King > --- > src/acpi/spcr/spcr.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c > index 7012e43..9fc7655 100644 > --- a/src/acpi/spcr/spcr.c > +++ b/src/acpi/spcr/spcr.c > @@ -55,6 +55,7 @@ static int spcr_test1(fwts_framework *fw) > char *str; > bool reserved = false; > bool pci = true; > + bool passed = true; > > /* Assuming revision 2 */ > switch (spcr->interface_type) { > @@ -80,6 +81,7 @@ static int spcr_test1(fwts_framework *fw) > > fwts_log_info_verbatum(fw, "Serial Interface: %s", str); > if (reserved) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRInterfaceReserved", > "SPCR Serial interface type 0x%2.2" PRIx8 > @@ -89,6 +91,7 @@ static int spcr_test1(fwts_framework *fw) > if ((spcr->reserved1[0] | > spcr->reserved1[1] | > spcr->reserved1[2])) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_LOW, > "SPCRReservedNonZero", > "SPCR reserved field must be zero, got " > @@ -99,11 +102,13 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->interrupt_type == 0) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRUnknownInterruptType", > "SPCR interrupt type field is zero, expecting support bits to be set"); > } > if (spcr->interrupt_type & 0xf0) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRIllegalReservedInterruptType", > "SPCR interrupt type reserved bits are non-zero zero, got 0x%" PRIx8, > @@ -118,6 +123,7 @@ static int spcr_test1(fwts_framework *fw) > case 14 ... 15: > break; > default: > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRIllegalIRQ", > "SPCR PC-AT compatible IRQ 0x%" PRIx8 " is invalid", spcr->irq); > @@ -145,6 +151,7 @@ static int spcr_test1(fwts_framework *fw) > } > fwts_log_info_verbatum(fw, "Baud Rate: %s", str); > if (reserved) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRBaudRateReserved", > "SPCR Serial baud rate type 0x%2.2" PRIx8 > @@ -152,6 +159,7 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->parity & ~1) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRParityReserved", > "SPCR parity reserved bits 1..7 are non-zero, value is 0x%2.2" PRIx8, > @@ -160,6 +168,7 @@ static int spcr_test1(fwts_framework *fw) > > /* Stop bit *really* is bit 1 according to the spec */ > if (spcr->parity & ~2) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRStopBitReserved", > "SPCR stop bit reserved bits 0,2..7 are non-zero, value is 0x%2.2" PRIx8, > @@ -167,6 +176,7 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->flow_control & ~7) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRFlowControlReserved", > "SPCR flow control reserved bits 3..7 are non-zero, value is 0x%2.2" PRIx8, > @@ -193,6 +203,7 @@ static int spcr_test1(fwts_framework *fw) > } > fwts_log_info_verbatum(fw, "Terminal Type: %s", str); > if (reserved) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRTerminalTypeReserved", > "SPCR terminal type type 0x%2.2" PRIx8 > @@ -200,6 +211,7 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->reserved2) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_LOW, > "SPCRReservedNonZero", > "SPCR reserved field must be zero, got " > @@ -217,6 +229,7 @@ static int spcr_test1(fwts_framework *fw) > /* Now validate all pci specific fields if not-PCI enabled */ > if (pci) { > if (spcr->pci_device_id == 0xffff) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRPciDeviceID", > "SPCR PCI device ID is 0x%4.4" PRIx16 > @@ -224,6 +237,7 @@ static int spcr_test1(fwts_framework *fw) > spcr->pci_device_id); > } > if (spcr->pci_vendor_id == 0xffff) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRPciVendorID", > "SPCR PCI vendor ID is 0x%4.4" PRIx16 > @@ -231,6 +245,7 @@ static int spcr_test1(fwts_framework *fw) > spcr->pci_vendor_id); > } > if ((spcr->pci_flags & 1) == 0) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRPciFlagsBit0", > "SPCR PCI flags compatibility bit 0 is %" PRIx32 > @@ -240,6 +255,7 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->pci_flags & 0xfffe) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_HIGH, > "SPCRPciFlags", > "SPCR PCI flags reserved bits 1-31 are %" PRIx32 > @@ -248,12 +264,16 @@ static int spcr_test1(fwts_framework *fw) > } > > if (spcr->reserved3) { > + passed = false; > fwts_failed(fw, LOG_LEVEL_LOW, > "SPCRReservedNonZero", > "SPCR reserved field must be zero, got " > "0x%2.2" PRIx8 " instead", spcr->reserved3); > } > > + if (passed) > + fwts_passed(fw, "No issues found in SPCR table."); > + > return FWTS_OK; > } > Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 8 04:08:27 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 08 May 2015 12:08:27 +0800 Subject: ACK: [PATCH] doc: fwts manual: update list of contributors at end of the manual In-Reply-To: <1430388363-26309-1-git-send-email-colin.king@canonical.com> References: <1430388363-26309-1-git-send-email-colin.king@canonical.com> Message-ID: <554C36BB.2050308@canonical.com> On 2015?04?30? 18:06, Colin King wrote: > From: Colin Ian King > > We need to update the names of contributors as the list is a little > out of date. > > Signed-off-by: Colin Ian King > --- > doc/fwts.1 | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/doc/fwts.1 b/doc/fwts.1 > index 4c22abe..aacd39e 100644 > --- a/doc/fwts.1 > +++ b/doc/fwts.1 > @@ -2,7 +2,7 @@ > .\" First parameter, NAME, should be all caps > .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection > .\" other parameters are allowed: see man(7), man(1) > -.TH FWTS 1 "5 February, 2015" > +.TH FWTS 1 "30 April, 2015" > .\" Please adjust this date whenever revising the manpage. > .\" > .\" Some roff macros, for reference: > @@ -391,9 +391,10 @@ sudo fwts s3 \-\-s3\-multiple=100 \-\-s3\-min\-delay=1 \-\-s3\-max\-delay=10 \-\ > fwts was originally written by Colin King with much of the original test > code derived from the Intel Linux Firmware test kit. Many thanks also for > contributions (in alpabetical order) from AceLan Kao, Alberto Milone, > -Alex Hung, Chris Van Hoof, Ivan Hu, Jeremy Kerr, Kamal Mostafa, > -Keng-Yu Lin, Matt Flemimg, Naresh Bhat, Robert Hooker, Seth Forshee, > -Yang Kun and Zhang Rui. > +Alex Hung, Chris Van Hoof, Fu Wei, Heyi Guo, Ivan Hu, Jeremy Kerr, > +Kamal Mostafa, Keng-Yu Lin, Matt Flemimg, Naresh Bhat, Phidias Chiang, > +Pradeep Gaddam, Ricardo Neri, Robert Hooker, Seth Forshee, > +Yang Kun, Yi Li and Zhang Rui. > .PP > This manual page was written by Colin King for the Ubuntu project > (but may be used by others). Acked-by: Ivan Hu From colin.king at canonical.com Fri May 8 08:59:18 2015 From: colin.king at canonical.com (Colin King) Date: Fri, 8 May 2015 09:59:18 +0100 Subject: [PATCH] fwts-test: arg-help-0001: modify regex to match upper/lower case version Message-ID: <1431075558-29179-1-git-send-email-colin.king@canonical.com> From: Colin Ian King It seems that this test breaks if we have a lowercase version tag, such as v15.03.01 that slipped into the previous release. While we should probably not allow lower case version tags it does seem sensible to make the test more flexible to also match lower case version tags just in case this happens again in the future. Signed-off-by: Colin Ian King --- fwts-test/arg-help-0001/test-0001.sh | 6 +++--- fwts-test/arg-help-0001/test-0002.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fwts-test/arg-help-0001/test-0001.sh b/fwts-test/arg-help-0001/test-0001.sh index 4be4705..38b3dbb 100755 --- a/fwts-test/arg-help-0001/test-0001.sh +++ b/fwts-test/arg-help-0001/test-0001.sh @@ -23,8 +23,8 @@ if [ $? -eq 1 ]; then echo SKIP: $TEST, $NAME exit 77 fi -$FWTS -h | grep -v "Show version" | grep -v "Usage" | sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG -sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0001.log > $TMP/help.log.$$.orig +$FWTS -h | grep -v "Show version" | grep -v "Usage" | sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG +sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0001.log > $TMP/help.log.$$.orig diff $TMPLOG $TMP/help.log.$$.orig >> $FAILURE_LOG ret=$? if [ $ret -eq 0 ]; then @@ -35,5 +35,5 @@ fi stty cols 80 2> /dev/null tset 2> /dev/null -rm $TMPLOG +#rm $TMPLOG exit $ret diff --git a/fwts-test/arg-help-0001/test-0002.sh b/fwts-test/arg-help-0001/test-0002.sh index fffef38..81f2ee6 100755 --- a/fwts-test/arg-help-0001/test-0002.sh +++ b/fwts-test/arg-help-0001/test-0002.sh @@ -24,8 +24,8 @@ if [ $? -eq 1 ]; then exit 77 fi -$FWTS --help | grep -v "Show version" | grep -v "Usage" | sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG -sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0002.log > $TMP/help.log.$$.orig +$FWTS --help | grep -v "Show version" | grep -v "Usage" | sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG +sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0002.log > $TMP/help.log.$$.orig diff $TMPLOG $TMP/help.log.$$.orig >> $FAILURE_LOG ret=$? if [ $ret -eq 0 ]; then -- 2.1.4 From jk at ozlabs.org Wed May 13 03:30:54 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Wed, 13 May 2015 11:30:54 +0800 Subject: [PATCH 0/6] [v4] Introduce firmware features In-Reply-To: <1431487854.933351.312647407751.0.gpush@pablo> Message-ID: <1431487854.933351.312647407751.0.gpush@pablo> [I've recently had a chance to update these onto current fwts head. Otherwise, this is simply a resend of my previous series] I've been playing with FWTS on a non-ACPI machine, and got a lot of aborts due to there not being various ACPI-specific bits of functionality present. It seems appropriate to define a new type for this firmware, but I don't want to add type checks all over the existing fwts tests. Rather than checking the type of firmware (and only running ACPI tests when we know that the firmware is of type UEFI or BIOS), I'd like to use more-flexible features instead; this way, each test can check if required features are available, rather than assuming that $type firmware has $feature_set. Currently, we just key the feature set off the firmware type, but we could do something more flexible in future. I've only defined an ACPI feature for now. Patches 5 and onwards are a basic usage of these features; we skip the batch tests that require ACPI if the firmware doesn't have the FWTS_FW_FEATURE_ACPI feature. Then, we introduce a firmware type with a different feature-set. Cheers, Jeremy v2: - Put a feature bitmask in the test defintion, rather than relying on ops.init callbacks to do feature detection. - Add example usage with new firmware & feature types v3: - rework based on fwts list reviews v4: - rebase on current FWTS head --- Jeremy Kerr (6): fwts: Add fwts_firmware_has_features fwts: Only run firmware detection once fwts: Allow tests to be conditional on available features fwts: Print names of missing features, rather than a cryptic bitmask fwts: Add FWTS_FW_FEATURE_DEVICETREE fwts: Add OPAL firmware type From jk at ozlabs.org Wed May 13 03:30:54 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Wed, 13 May 2015 11:30:54 +0800 Subject: [PATCH 3/6] fwts: Allow tests to be conditional on available features In-Reply-To: <1431487854.933351.312647407751.0.gpush@pablo> Message-ID: <1431487854.934591.543923150572.3.gpush@pablo> Add a .fw_features member to struct fwts_framework_test, and update the registration macros to allow tests to only be run if specified features are present. Signed-off-by: Jeremy Kerr Acked-by: Colin Ian King Acked-by: Alex Hung --- src/lib/include/fwts_framework.h | 28 ++++++++++++++++------------ src/lib/src/fwts_framework.c | 14 +++++++++++++- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h index fdd2b05..40554a6 100644 --- a/src/lib/include/fwts_framework.h +++ b/src/lib/include/fwts_framework.h @@ -176,12 +176,14 @@ typedef struct fwts_framework_test { fwts_framework_ops *ops; fwts_priority priority; fwts_framework_flags flags; + int fw_features; fwts_results results; /* Per test results */ bool was_run; + } fwts_framework_test; int fwts_framework_args(const int argc, char **argv); -void fwts_framework_test_add(const char *name, fwts_framework_ops *ops, const fwts_priority priority, const fwts_framework_flags flags); +void fwts_framework_test_add(const char *name, fwts_framework_ops *ops, const fwts_priority priority, const fwts_framework_flags flags, int fw_features); int fwts_framework_compare_test_name(void *, void *); void fwts_framework_show_version(FILE *fp, const char *name); @@ -256,16 +258,18 @@ static inline int fwts_tests_passed(const fwts_framework *fw) #define FWTS_ASSERT(e, m) \ enum { FWTS_CONCAT_EXPAND(FWTS_ASSERT_ ## m ## _in_line_, __LINE__) = 1 / !!(e) } -#define FWTS_REGISTER(name, ops, priority, flags) \ -/* Ensure name is not too long */ \ -FWTS_ASSERT(FWTS_ARRAY_LEN(name) < 16, \ - fwts_register_name_too_long); \ - \ -static void __test_init (void) __attribute__ ((constructor)); \ - \ -static void __test_init (void) \ -{ \ - fwts_framework_test_add(name, ops, priority, flags); \ +#define FWTS_REGISTER_FEATURES(name, ops, priority, flags, features) \ +/* Ensure name is not too long */ \ +FWTS_ASSERT(FWTS_ARRAY_LEN(name) < 16, \ + fwts_register_name_too_long); \ + \ +static void __test_init (void) __attribute__ ((constructor)); \ + \ +static void __test_init (void) \ +{ \ + fwts_framework_test_add(name, ops, priority, flags, features); \ } - + +#define FWTS_REGISTER(name, ops, priority, flags) \ + FWTS_REGISTER_FEATURES(name, ops, priority, flags, 0) #endif diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index d9896b4..83e626d 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -138,7 +138,8 @@ void fwts_framework_test_add( const char *name, fwts_framework_ops *ops, const fwts_priority priority, - const fwts_framework_flags flags) + const fwts_framework_flags flags, + int fw_features) { fwts_framework_test *new_test; @@ -164,6 +165,7 @@ void fwts_framework_test_add( new_test->ops = ops; new_test->priority = priority; new_test->flags = flags; + new_test->fw_features = fw_features; /* Add test, sorted on run order priority */ fwts_list_add_ordered(&fwts_framework_test_list, new_test, fwts_framework_compare_priority); @@ -565,6 +567,16 @@ static int fwts_framework_run_test(fwts_framework *fw, fwts_framework_test *test fwts_framework_minor_test_progress(fw, 0, ""); + if (!fwts_firmware_has_features(test->fw_features)) { + int missing = test->fw_features & ~fwts_firmware_features(); + fwts_log_info(fw, "Test skipped, missing features 0x%08x", + missing); + fw->current_major_test->results.skipped += + test->ops->total_tests; + fw->total.skipped += test->ops->total_tests; + goto done; + } + if ((test->flags & FWTS_FLAG_ROOT_PRIV) && (fwts_check_root_euid(fw, true) != FWTS_OK)) { fwts_log_error(fw, "Aborted test, insufficient privilege."); From jk at ozlabs.org Wed May 13 03:30:54 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Wed, 13 May 2015 11:30:54 +0800 Subject: [PATCH 4/6] fwts: Print names of missing features, rather than a cryptic bitmask In-Reply-To: <1431487854.933351.312647407751.0.gpush@pablo> Message-ID: <1431487854.934902.505273996197.4.gpush@pablo> This change adds a function to return a comma-separated list of features in a bitmask, which we use when printing missing firmware features when we skip a test. Signed-off-by: Jeremy Kerr Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- src/lib/include/fwts_firmware.h | 6 ++-- src/lib/src/fwts_firmware.c | 48 ++++++++++++++++++++++++++++++++ src/lib/src/fwts_framework.c | 4 +- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/lib/include/fwts_firmware.h b/src/lib/include/fwts_firmware.h index 0ef9cdf..221ee67 100644 --- a/src/lib/include/fwts_firmware.h +++ b/src/lib/include/fwts_firmware.h @@ -29,13 +29,15 @@ enum firmware_type { }; enum firmware_feature { - FWTS_FW_FEATURE_ACPI = 1 << 0, + FWTS_FW_FEATURE_ACPI = 0x1, + FWTS_FW_FEATURE_ALL = FWTS_FW_FEATURE_ACPI }; int fwts_firmware_detect(void); int fwts_firmware_features(void); +const char *fwts_firmware_feature_string(const int features); -static inline bool fwts_firmware_has_features(int features) +static inline bool fwts_firmware_has_features(const int features) { return (fwts_firmware_features() & features) == features; } diff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c index 57e78b6..0582e3a 100644 --- a/src/lib/src/fwts_firmware.c +++ b/src/lib/src/fwts_firmware.c @@ -26,6 +26,13 @@ static enum firmware_type firmware_type; static bool firmware_type_valid; +static struct { + enum firmware_feature feature; + const char name[16]; +} feature_names[] = { + { FWTS_FW_FEATURE_ACPI, "ACPI" }, +}; + /* * fwts_memory_map_entry_compare() * callback used to sort memory_map entries on start address @@ -64,3 +71,44 @@ int fwts_firmware_features(void) return features; } + +const char *fwts_firmware_feature_string(const int features) +{ + const int n = FWTS_ARRAY_LEN(feature_names); + const char sep[] = ", "; + static char str[50]; + size_t len; + char *p; + int i; + + /* ensure we have enough space in str to store n names, plus n-1 + * separators, plus a trailing nul */ + FWTS_ASSERT((n * (sizeof(feature_names[0].name) - 1)) + + ((n-1) * (sizeof(sep) - 1)) + 1 < + sizeof(str), str_too_small); + + /* ensure we have a name defined for all features */ + FWTS_ASSERT(((1 << n) - 1) == FWTS_FW_FEATURE_ALL, + invalid_feature_names); + + for (p = str, i = 0; i < n; i++) { + + if (!(features & feature_names[i].feature)) + continue; + + /* if this isn't the first feature, add a separator */ + if (p != str) { + len = sizeof(sep) - 1; + memcpy(p, sep, len); + p += len; + } + + len = strlen(feature_names[i].name); + memcpy(p, feature_names[i].name, len); + p += len; + } + + *p = '\0'; + + return str; +} diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index 83e626d..190fc52 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -569,8 +569,8 @@ static int fwts_framework_run_test(fwts_framework *fw, fwts_framework_test *test if (!fwts_firmware_has_features(test->fw_features)) { int missing = test->fw_features & ~fwts_firmware_features(); - fwts_log_info(fw, "Test skipped, missing features 0x%08x", - missing); + fwts_log_info(fw, "Test skipped, missing features: %s", + fwts_firmware_feature_string(missing)); fw->current_major_test->results.skipped += test->ops->total_tests; fw->total.skipped += test->ops->total_tests; From jk at ozlabs.org Wed May 13 03:30:54 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Wed, 13 May 2015 11:30:54 +0800 Subject: [PATCH 2/6] fwts: Only run firmware detection once In-Reply-To: <1431487854.933351.312647407751.0.gpush@pablo> Message-ID: <1431487854.934203.871424952788.2.gpush@pablo> Store the discovered value in a static var, and return this value on subsequent invocations of fwts_firmware_detect. Signed-off-by: Jeremy Kerr Acked-by: Colin Ian King Acked-by: Alex Hung --- src/lib/include/fwts_firmware.h | 2 +- src/lib/src/fwts_firmware.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/lib/include/fwts_firmware.h b/src/lib/include/fwts_firmware.h index e4d4fa5..0ef9cdf 100644 --- a/src/lib/include/fwts_firmware.h +++ b/src/lib/include/fwts_firmware.h @@ -21,7 +21,7 @@ #include -enum { +enum firmware_type { FWTS_FIRMWARE_UNKNOWN = 0, FWTS_FIRMWARE_BIOS = 1, FWTS_FIRMWARE_UEFI = 2, diff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c index 8e5c04e..57e78b6 100644 --- a/src/lib/src/fwts_firmware.c +++ b/src/lib/src/fwts_firmware.c @@ -23,6 +23,9 @@ #include "fwts.h" +static enum firmware_type firmware_type; +static bool firmware_type_valid; + /* * fwts_memory_map_entry_compare() * callback used to sort memory_map entries on start address @@ -31,10 +34,18 @@ int fwts_firmware_detect(void) { struct stat statbuf; - if (stat("/sys/firmware/efi", &statbuf)) - return FWTS_FIRMWARE_BIOS; /* No UEFI, Assume BIOS */ - else - return FWTS_FIRMWARE_UEFI; + if (firmware_type_valid) + return firmware_type; + + if (stat("/sys/firmware/efi", &statbuf)) { + /* No UEFI, Assume BIOS */ + firmware_type = FWTS_FIRMWARE_BIOS; + } else { + firmware_type = FWTS_FIRMWARE_UEFI; + } + + firmware_type_valid = true; + return firmware_type; } int fwts_firmware_features(void) From jk at ozlabs.org Wed May 13 03:30:54 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Wed, 13 May 2015 11:30:54 +0800 Subject: [PATCH 5/6] fwts: Add FWTS_FW_FEATURE_DEVICETREE In-Reply-To: <1431487854.933351.312647407751.0.gpush@pablo> Message-ID: <1431487854.935280.506871217429.5.gpush@pablo> This feature indicates the presence of a device-tree. Signed-off-by: Jeremy Kerr Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- src/lib/include/fwts_firmware.h | 4 +++- src/lib/src/fwts_firmware.c | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/include/fwts_firmware.h b/src/lib/include/fwts_firmware.h index 221ee67..cc3cccf 100644 --- a/src/lib/include/fwts_firmware.h +++ b/src/lib/include/fwts_firmware.h @@ -30,7 +30,9 @@ enum firmware_type { enum firmware_feature { FWTS_FW_FEATURE_ACPI = 0x1, - FWTS_FW_FEATURE_ALL = FWTS_FW_FEATURE_ACPI + FWTS_FW_FEATURE_DEVICETREE = 0x2, + FWTS_FW_FEATURE_ALL = FWTS_FW_FEATURE_ACPI | + FWTS_FW_FEATURE_DEVICETREE }; int fwts_firmware_detect(void); diff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c index 0582e3a..db7e9cc 100644 --- a/src/lib/src/fwts_firmware.c +++ b/src/lib/src/fwts_firmware.c @@ -31,6 +31,7 @@ static struct { const char name[16]; } feature_names[] = { { FWTS_FW_FEATURE_ACPI, "ACPI" }, + { FWTS_FW_FEATURE_DEVICETREE, "devicetree" }, }; /* From jk at ozlabs.org Wed May 13 03:30:54 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Wed, 13 May 2015 11:30:54 +0800 Subject: [PATCH 1/6] fwts: Add fwts_firmware_has_features In-Reply-To: <1431487854.933351.312647407751.0.gpush@pablo> Message-ID: <1431487854.933780.294183739058.1.gpush@pablo> Add a function to indicate whether a firmware has a particular feature mask. This can be used by tests to skip running on firmware without certain features. Signed-off-by: Jeremy Kerr Acked-by: Colin Ian King Acked-by: Alex Hung --- src/lib/include/fwts_firmware.h | 12 ++++++++++++ src/lib/src/fwts_firmware.c | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/lib/include/fwts_firmware.h b/src/lib/include/fwts_firmware.h index 739babd..e4d4fa5 100644 --- a/src/lib/include/fwts_firmware.h +++ b/src/lib/include/fwts_firmware.h @@ -19,6 +19,8 @@ #ifndef __FWTS_FIRMWARE_H__ #define __FWTS_FIRMWARE_H__ +#include + enum { FWTS_FIRMWARE_UNKNOWN = 0, FWTS_FIRMWARE_BIOS = 1, @@ -26,6 +28,16 @@ enum { FWTS_FIRMWARE_OTHER = 100 }; +enum firmware_feature { + FWTS_FW_FEATURE_ACPI = 1 << 0, +}; + int fwts_firmware_detect(void); +int fwts_firmware_features(void); + +static inline bool fwts_firmware_has_features(int features) +{ + return (fwts_firmware_features() & features) == features; +} #endif diff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c index 543e9ba..8e5c04e 100644 --- a/src/lib/src/fwts_firmware.c +++ b/src/lib/src/fwts_firmware.c @@ -36,3 +36,20 @@ int fwts_firmware_detect(void) else return FWTS_FIRMWARE_UEFI; } + +int fwts_firmware_features(void) +{ + int features = 0; + + /* we just have static feature definitions for now */ + switch (fwts_firmware_detect()) { + case FWTS_FIRMWARE_BIOS: + case FWTS_FIRMWARE_UEFI: + features = FWTS_FW_FEATURE_ACPI; + break; + default: + break; + } + + return features; +} From jk at ozlabs.org Wed May 13 03:30:54 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Wed, 13 May 2015 11:30:54 +0800 Subject: [PATCH 6/6] fwts: Add OPAL firmware type In-Reply-To: <1431487854.933351.312647407751.0.gpush@pablo> Message-ID: <1431487854.935600.135100293821.6.gpush@pablo> Signed-off-by: Jeremy Kerr Acked-by: Colin Ian King Acked-by: Alex Hung --- src/lib/include/fwts_firmware.h | 1 + src/lib/src/fwts_firmware.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/lib/include/fwts_firmware.h b/src/lib/include/fwts_firmware.h index cc3cccf..26ff460 100644 --- a/src/lib/include/fwts_firmware.h +++ b/src/lib/include/fwts_firmware.h @@ -25,6 +25,7 @@ enum firmware_type { FWTS_FIRMWARE_UNKNOWN = 0, FWTS_FIRMWARE_BIOS = 1, FWTS_FIRMWARE_UEFI = 2, + FWTS_FIRMWARE_OPAL = 3, FWTS_FIRMWARE_OTHER = 100 }; diff --git a/src/lib/src/fwts_firmware.c b/src/lib/src/fwts_firmware.c index db7e9cc..c939b68 100644 --- a/src/lib/src/fwts_firmware.c +++ b/src/lib/src/fwts_firmware.c @@ -45,11 +45,14 @@ int fwts_firmware_detect(void) if (firmware_type_valid) return firmware_type; - if (stat("/sys/firmware/efi", &statbuf)) { - /* No UEFI, Assume BIOS */ - firmware_type = FWTS_FIRMWARE_BIOS; - } else { + if (!stat("/sys/firmware/efi", &statbuf)) { firmware_type = FWTS_FIRMWARE_UEFI; + + } else if (!stat("/sys/firmware/opal", &statbuf)) { + firmware_type = FWTS_FIRMWARE_OPAL; + + } else { + firmware_type = FWTS_FIRMWARE_BIOS; } firmware_type_valid = true; @@ -66,6 +69,9 @@ int fwts_firmware_features(void) case FWTS_FIRMWARE_UEFI: features = FWTS_FW_FEATURE_ACPI; break; + case FWTS_FIRMWARE_OPAL: + features = FWTS_FW_FEATURE_DEVICETREE; + break; default: break; } From alex.hung at canonical.com Wed May 13 03:52:13 2015 From: alex.hung at canonical.com (Alex Hung) Date: Wed, 13 May 2015 11:52:13 +0800 Subject: ACK: [PATCH] fwts-test: arg-help-0001: modify regex to match upper/lower case version In-Reply-To: <1431075558-29179-1-git-send-email-colin.king@canonical.com> References: <1431075558-29179-1-git-send-email-colin.king@canonical.com> Message-ID: <5552CA6D.7050301@canonical.com> On 05/08/2015 04:59 PM, Colin King wrote: > From: Colin Ian King > > It seems that this test breaks if we have a lowercase version tag, > such as v15.03.01 that slipped into the previous release. While we should > probably not allow lower case version tags it does seem sensible to make > the test more flexible to also match lower case version tags just in > case this happens again in the future. > > Signed-off-by: Colin Ian King > --- > fwts-test/arg-help-0001/test-0001.sh | 6 +++--- > fwts-test/arg-help-0001/test-0002.sh | 4 ++-- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fwts-test/arg-help-0001/test-0001.sh b/fwts-test/arg-help-0001/test-0001.sh > index 4be4705..38b3dbb 100755 > --- a/fwts-test/arg-help-0001/test-0001.sh > +++ b/fwts-test/arg-help-0001/test-0001.sh > @@ -23,8 +23,8 @@ if [ $? -eq 1 ]; then > echo SKIP: $TEST, $NAME > exit 77 > fi > -$FWTS -h | grep -v "Show version" | grep -v "Usage" | sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG > -sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0001.log > $TMP/help.log.$$.orig > +$FWTS -h | grep -v "Show version" | grep -v "Usage" | sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG > +sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0001.log > $TMP/help.log.$$.orig > diff $TMPLOG $TMP/help.log.$$.orig >> $FAILURE_LOG > ret=$? > if [ $ret -eq 0 ]; then > @@ -35,5 +35,5 @@ fi > stty cols 80 2> /dev/null > tset 2> /dev/null > > -rm $TMPLOG > +#rm $TMPLOG > exit $ret > diff --git a/fwts-test/arg-help-0001/test-0002.sh b/fwts-test/arg-help-0001/test-0002.sh > index fffef38..81f2ee6 100755 > --- a/fwts-test/arg-help-0001/test-0002.sh > +++ b/fwts-test/arg-help-0001/test-0002.sh > @@ -24,8 +24,8 @@ if [ $? -eq 1 ]; then > exit 77 > fi > > -$FWTS --help | grep -v "Show version" | grep -v "Usage" | sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG > -sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0002.log > $TMP/help.log.$$.orig > +$FWTS --help | grep -v "Show version" | grep -v "Usage" | sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG > +sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0002.log > $TMP/help.log.$$.orig > diff $TMPLOG $TMP/help.log.$$.orig >> $FAILURE_LOG > ret=$? > if [ $ret -eq 0 ]; then > QAcked-by: Alex Hung From alex.hung at canonical.com Wed May 13 03:53:30 2015 From: alex.hung at canonical.com (Alex Hung) Date: Wed, 13 May 2015 11:53:30 +0800 Subject: ACK: [PATCH] lib: fwts_alloc: provide fallback low memory allocator strategy (LP: #1452168) In-Reply-To: <1430901383-7080-1-git-send-email-colin.king@canonical.com> References: <1430901383-7080-1-git-send-email-colin.king@canonical.com> Message-ID: <5552CABA.7070908@canonical.com> On 05/06/2015 04:36 PM, Colin King wrote: > From: Colin Ian King > > The fwts low memory allocator made some assumptions that > /proc/self/maps was always available for parsing to gain > some smarts on how to do a 32 bit memory allocation. > Apparently some platforms this is not available or can't > be parsed or just does not provide enough free memory > slots so this fails. > > Instead, we need to have a fall-back dumb low memory > allocator scheme that walks through memory trying to find > free regions using mincore() to do the probing. > > Thanks to Suravee Suthikulpanit for finding, debugging and testing > this fix. > > Tested-by: Suravee Suthikulpanit > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_alloc.c | 85 +++++++++++++++++++++++++++++++++++++++++------- > 1 file changed, 74 insertions(+), 11 deletions(-) > > diff --git a/src/lib/src/fwts_alloc.c b/src/lib/src/fwts_alloc.c > index 9bac784..89aaa34 100644 > --- a/src/lib/src/fwts_alloc.c > +++ b/src/lib/src/fwts_alloc.c > @@ -22,13 +22,14 @@ > #include > #include > #include > +#include > > -#include "fwts_alloc.h" > +#include "fwts.h" > > /* > * We implement a low memory allocator to allow us to allocate > * memory < 2G limit for the ACPICA table handling. On 64 bit > - * machines we habe to ensure that cached copies of ACPI tables > + * machines we have to ensure that cached copies of ACPI tables > * have addresses that can be addressed by the legacy 32 bit > * ACPI table pointers. > * > @@ -47,11 +48,61 @@ typedef struct { > unsigned int magic; > } fwts_mmap_header; > > -#define CHUNK_SIZE (8192) /* page plus loads of slack */ > +/* > + * CHUNK_SIZE controls the gap between mappings. This creates gaps > + * between each low memory allocation so that we have some chance > + * of catching memory accesses that fall off the mapping. Without > + * a gap, memory mappings potentially become contiguous and hence > + * memory access errors are harder to catch. This is wasteful > + * in terms of address space, but fwts doesn't do too many low memory > + * mappings since they are just used for cached copies of ACPI tables. > + */ > +#define CHUNK_SIZE (64*1024) > + > #define LIMIT_2GB (0x80000000ULL) > #define LIMIT_START (0x00010000ULL) > > -#ifndef MAP_32BIT > +/* > + * fwts_low_mmap_walkdown() > + * try to allocate a free space under the 2GB limit by > + * walking down memory in CHUNK_SIZE steps for an unmapped region > + */ > +static void *fwts_low_mmap_walkdown(const size_t requested_size) > +{ > + void *addr; > + size_t page_size = fwts_page_size(); > + size_t sz = (requested_size + page_size) & ~(page_size - 1); > + size_t pages = sz / page_size; > + unsigned char vec[pages]; > + static void *last_addr = (void *)LIMIT_2GB; > + > + if (requested_size == 0) /* Illegal */ > + return MAP_FAILED; > + > + for (addr = last_addr - sz; addr > (void *)LIMIT_START; addr -= CHUNK_SIZE) { > + void *mapping; > + > + /* Already mapped? */ > + if (mincore(addr, pages, vec) == 0) > + continue; > + > + /* Not mapped but mincore returned something unexpected? */ > + if (errno != ENOMEM) > + continue; > + > + mapping = mmap(addr, requested_size, PROT_READ | PROT_WRITE, > + MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, -1, 0); > + if (mapping != MAP_FAILED) { > + last_addr = mapping; > + return mapping; > + } > + } > + /* We've scanned all of memory, give up on subsequent calls */ > + last_addr = (void *)LIMIT_START; > + > + return MAP_FAILED; > +} > + > /* > * fwts_low_mmap() > * try to find a free space under the 2GB limit and mmap it. > @@ -71,13 +122,16 @@ static void *fwts_low_mmap(const size_t requested_size) > if (requested_size == 0) /* Illegal */ > return MAP_FAILED; > > + /* > + * If we can't access our own mappings then find a > + * free page by just walking down memory > + */ > if ((fp = fopen("/proc/self/maps", "r")) == NULL) > - return MAP_FAILED; > + return fwts_low_mmap_walkdown(requested_size); > > while (fgets(buffer, sizeof(buffer), fp) != NULL) { > sscanf(buffer, "%p-%p %*s %*x %*s %*u %1023s", > &addr_start, &addr_end, pathname); > - > /* > * Try and allocate under first mmap'd address space > */ > @@ -111,6 +165,7 @@ static void *fwts_low_mmap(const size_t requested_size) > (last_addr_end < (void*)LIMIT_2GB)) { > if (((uint8_t *)addr_start - (uint8_t *)last_addr_end) > (ptrdiff_t)requested_size) { > void *addr = last_addr_end; > + > ret = mmap(addr, requested_size, PROT_READ | PROT_WRITE, > MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, -1, 0); > if (ret != MAP_FAILED) > @@ -133,9 +188,15 @@ static void *fwts_low_mmap(const size_t requested_size) > } > fclose(fp); > > + /* > + * The "intelligent" memory hole finding strategy failed, > + * so try walking down memory instead. > + */ > + if (ret == MAP_FAILED) > + ret = fwts_low_mmap_walkdown(requested_size); > + > return ret; > } > -#endif > > /* > * fwts_low_calloc() > @@ -147,7 +208,7 @@ static void *fwts_low_mmap(const size_t requested_size) > void *fwts_low_calloc(const size_t nmemb, const size_t size) > { > size_t n = nmemb * size; > - void *ret; > + void *ret = MAP_FAILED; > fwts_mmap_header *hdr; > > n += sizeof(fwts_mmap_header); > @@ -161,11 +222,13 @@ void *fwts_low_calloc(const size_t nmemb, const size_t size) > /* 32 bit mmap by default */ > ret = mmap(NULL, n, PROT_READ | PROT_WRITE, > MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); > - } else { > - /* We don't have a native MAP_32BIT, so bodge our own */ > - ret = fwts_low_mmap(n); > } > #endif > + /* 32 bit mmap failed, so bodge our own 32 bit mmap */ > + if (ret == MAP_FAILED) > + ret = fwts_low_mmap(n); > + > + /* OK, really can't mmap, give up */ > if (ret == MAP_FAILED) > return NULL; > > Acked-by: Alex Hung From ivan.hu at canonical.com Thu May 14 04:36:43 2015 From: ivan.hu at canonical.com (ivanhu) Date: Thu, 14 May 2015 12:36:43 +0800 Subject: ACK: [PATCH] fwts-test: arg-help-0001: modify regex to match upper/lower case version In-Reply-To: <1431075558-29179-1-git-send-email-colin.king@canonical.com> References: <1431075558-29179-1-git-send-email-colin.king@canonical.com> Message-ID: <5554265B.8080909@canonical.com> On 2015?05?08? 16:59, Colin King wrote: > From: Colin Ian King > > It seems that this test breaks if we have a lowercase version tag, > such as v15.03.01 that slipped into the previous release. While we should > probably not allow lower case version tags it does seem sensible to make > the test more flexible to also match lower case version tags just in > case this happens again in the future. > > Signed-off-by: Colin Ian King > --- > fwts-test/arg-help-0001/test-0001.sh | 6 +++--- > fwts-test/arg-help-0001/test-0002.sh | 4 ++-- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/fwts-test/arg-help-0001/test-0001.sh b/fwts-test/arg-help-0001/test-0001.sh > index 4be4705..38b3dbb 100755 > --- a/fwts-test/arg-help-0001/test-0001.sh > +++ b/fwts-test/arg-help-0001/test-0001.sh > @@ -23,8 +23,8 @@ if [ $? -eq 1 ]; then > echo SKIP: $TEST, $NAME > exit 77 > fi > -$FWTS -h | grep -v "Show version" | grep -v "Usage" | sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG > -sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0001.log > $TMP/help.log.$$.orig > +$FWTS -h | grep -v "Show version" | grep -v "Usage" | sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG > +sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0001.log > $TMP/help.log.$$.orig > diff $TMPLOG $TMP/help.log.$$.orig >> $FAILURE_LOG > ret=$? > if [ $ret -eq 0 ]; then > @@ -35,5 +35,5 @@ fi > stty cols 80 2> /dev/null > tset 2> /dev/null > > -rm $TMPLOG > +#rm $TMPLOG > exit $ret > diff --git a/fwts-test/arg-help-0001/test-0002.sh b/fwts-test/arg-help-0001/test-0002.sh > index fffef38..81f2ee6 100755 > --- a/fwts-test/arg-help-0001/test-0002.sh > +++ b/fwts-test/arg-help-0001/test-0002.sh > @@ -24,8 +24,8 @@ if [ $? -eq 1 ]; then > exit 77 > fi > > -$FWTS --help | grep -v "Show version" | grep -v "Usage" | sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG > -sed s/\(V[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0002.log > $TMP/help.log.$$.orig > +$FWTS --help | grep -v "Show version" | grep -v "Usage" | sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ > $TMPLOG > +sed s/\([Vv][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\)/\(Vxx\.xx\.xx\)/ < $FWTSTESTDIR/arg-help-0001/arg-help-0002.log > $TMP/help.log.$$.orig > diff $TMPLOG $TMP/help.log.$$.orig >> $FAILURE_LOG > ret=$? > if [ $ret -eq 0 ]; then Acked-by: Ivan Hu From ivan.hu at canonical.com Thu May 14 05:43:45 2015 From: ivan.hu at canonical.com (ivanhu) Date: Thu, 14 May 2015 13:43:45 +0800 Subject: ACK: [PATCH] acpi: method: update method list according to Table 5-162 in ACPI 6 In-Reply-To: <1430883300-16643-1-git-send-email-alex.hung@canonical.com> References: <1430883300-16643-1-git-send-email-alex.hung@canonical.com> Message-ID: <55543611.1020405@canonical.com> On 2015?05?06? 11:35, Alex Hung wrote: > Note: _CR3 is not listed in Table 5-162. That requires fixing > in next ACPI version > > Signed-off-by: Alex Hung > --- > src/acpi/method/method.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index cc1ed33..cb8c083 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -57,14 +57,16 @@ > * _BMS 10.2.2.5 Y > * _BQC B.6.4 Y > * _BST 10.2.2.6 Y > - * _BTM 10.2.2.8 Y > - * _BTP 10.2.2.7 Y > + * _BTH 10.2.2.7 N > + * _BTM 10.2.2.9 Y > + * _BTP 10.2.2.8 Y > * _CBA PCI f/w spec Y > * _CCA 6.2.17 Y > * _CDM 6.2.1 Y > * _CID 6.1.2 Y > * _CLS 6.1.3 N requires PCI SIG class info > * _CPC 8.4.5 Y > + * _CR3 11.5.4 N > * _CRS 6.2.2 Y > * _CRT 11.4.4 Y > * _CSD 8.4.2.2 Y > @@ -124,12 +126,14 @@ > * _Lxx 5.6.4.1 n/a > * _LCK 6.3.4 Y > * _LID 9.4.1 Y > + * _LPI 8.4.4.3 N > * _MAT 6.2.9 N > * _MBM 9.12.2.1 Y > * _MLS 6.1.7 Y > * _MSG 9.1.2 Y > * _MSM 9.12.2.2 N > - * _NTT 11.4.7 Y > + * _MTL 11.4.8 N > + * _NTT 11.4.9 Y > * _OFF 7.1.2 Y > * _ON_ 7.1.3 Y > * _OS 5.7.3 N > @@ -139,7 +143,7 @@ > * _PAI 10.4.4 n/a > * _PCL 10.3.2 Y > * _PCT 8.4.4.1 Y > - * _PDC 8.4.1 N > + * _PDC 8.4.1 deprecated > * _PDL 8.4.4.6 Y > * _PIC 5.8.1 Y > * _PIF 10.3.3 Y > @@ -156,8 +160,9 @@ > * _PR3 7.2.11 Y > * _PRE 7.2.12 Y > * _PRL 10.3.4 Y > - * _PRT 6.2.12 N > + * _PRR 7.3.26 N > * _PRS 6.2.11 Y > + * _PRT 6.2.12 N > * _PRW 7.2.11 Y > * _PS0 7.2.2 Y > * _PS1 7.2.3 Y > @@ -177,10 +182,12 @@ > * _PUR 8.5.11 Y > * _PXM 6.2.13 Y > * _Qxx 5.6.4.1 n/a > + * _RDI 8.5 N > * _REG 6.5.4 n/a > * _REV 5.7.4 n/a > * _RMV 6.3.6 Y > * _ROM B.4.3 Y > + * _RST 7.3.25 N > * _RTV 11.4.10 Y > * _S0_ 7.3.4.1 Y > * _S1_ 7.3.4.2 Y > @@ -221,6 +228,7 @@ > * _TC1 11.4.12 Y > * _TC2 11.4.13 Y > * _TDL 8.4.3.5 Y > + * _TFP 11.4.16 N > * _TIP 9.18.9 Y > * _TIV 9.18.10 Y > * _TMP 11.4.14 Y > @@ -228,6 +236,7 @@ > * _TPT 11.4.15 Y > * _TRT 11.4.16 Y > * _TSD 8.4.3.4 Y > + * _TSN 11.4.20 N > * _TSP 11.4.17 Y > * _TSS 8.4.3.2 Y > * _TST 11.4.18 Y Acked-by: Ivan Hu From colin.king at canonical.com Thu May 14 11:33:01 2015 From: colin.king at canonical.com (Colin King) Date: Thu, 14 May 2015 12:33:01 +0100 Subject: [PATCH] bios: mtrr: fix memory leak on mtrr entries Message-ID: <1431603181-7915-1-git-send-email-colin.king@canonical.com> From: Colin Ian King CoverityScan picked up a memory leak on the allocated entries that don't get added to the mttr entry list when they fail specific filtering criteria. Signed-off-by: Colin Ian King --- src/bios/mtrr/mtrr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c index 8bec28b..c86090f 100644 --- a/src/bios/mtrr/mtrr.c +++ b/src/bios/mtrr/mtrr.c @@ -119,18 +119,24 @@ static int get_mtrrs(void) */ /* Get register, in decimal */ - if (strncmp(line, "reg", 3)) + if (strncmp(line, "reg", 3)) { + free(entry); continue; + } entry->reg = strtoul(line + 3, NULL, 10); /* Get base, in hex */ - if ((ptr1 = strstr(line, "base=0x")) == NULL) + if ((ptr1 = strstr(line, "base=0x")) == NULL) { + free(entry); continue; + } entry->start = strtoull(ptr1 + 5, NULL, 16); /* Get size, in decimal */ - if ((ptr1 = strstr(line, "size=")) == NULL) + if ((ptr1 = strstr(line, "size=")) == NULL) { + free(entry); continue; + } entry->size = strtoull(ptr1 + 5, &ptr2, 10); if (ptr2 && (*ptr2 == 'm')) -- 2.1.4 From colin.king at canonical.com Thu May 14 11:33:17 2015 From: colin.king at canonical.com (Colin King) Date: Thu, 14 May 2015 12:33:17 +0100 Subject: [PATCH] hotkey: only process reads of hotkey events that are at least the correct length Message-ID: <1431603197-7965-1-git-send-email-colin.king@canonical.com> From: Colin Ian King Coverity Scan found an issue where the comparison to the event structure was incorrect when reads were too short in size. Signed-off-by: Colin Ian King --- src/hotkey/hotkey/hotkey.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/hotkey/hotkey/hotkey.c b/src/hotkey/hotkey/hotkey.c index 6e40df1..28d3ef1 100644 --- a/src/hotkey/hotkey/hotkey.c +++ b/src/hotkey/hotkey/hotkey.c @@ -90,20 +90,20 @@ static int hotkey_test(fwts_framework *fw, char *dev, fwts_list *hotkeys) } while (do_test) { - switch (read(fd, &ev, sizeof(ev))) { - case -1: - case 0: + ssize_t ret = read(fd, &ev, sizeof(ev)); + + if (ret < (ssize_t)sizeof(ev)) { do_test = 0; break; - default: - if ((ev.type == EV_KEY) && - (ev.code == KEY_ESC) && - (ev.value == 0)) - do_test = 0; - else - hotkey_check_key(fw, &ev, hotkeys); - break; } + + if ((ev.type == EV_KEY) && + (ev.code == KEY_ESC) && + (ev.value == 0)) + do_test = 0; + else + hotkey_check_key(fw, &ev, hotkeys); + break; } if (ioctl(fd, EVIOCGRAB, (void*)0)) { /* Release */ -- 2.1.4 From colin.king at canonical.com Thu May 14 11:33:26 2015 From: colin.king at canonical.com (Colin King) Date: Thu, 14 May 2015 12:33:26 +0100 Subject: [PATCH] lib: fwts_args: use strncpy instead of strcpy Message-ID: <1431603206-8013-1-git-send-email-colin.king@canonical.com> From: Colin Ian King Coverity Scan was flagging up the use of strcpy and of a potential buffer overrun, so use strncpy instead. Signed-off-by: Colin Ian King --- src/lib/src/fwts_args.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c index 86e0d4b..5dc9261 100644 --- a/src/lib/src/fwts_args.c +++ b/src/lib/src/fwts_args.c @@ -299,8 +299,8 @@ void fwts_args_show_options(void) } } } - strcat(ptr, "--"); - strcat(ptr, option->long_name); + strncat(ptr, "--", ptr - buffer - 1); + strncat(ptr, option->long_name, ptr - buffer - 3); fwts_args_show_option(width, buffer, option->explanation); } -- 2.1.4 From colin.king at canonical.com Fri May 15 10:35:31 2015 From: colin.king at canonical.com (Colin King) Date: Fri, 15 May 2015 11:35:31 +0100 Subject: [PATCH] uefi: uefirtvariable: fix incorrect buffer size being passed Message-ID: <1431686131-12311-1-git-send-email-colin.king@canonical.com> From: Colin Ian King The existing code passes the size of name, which turns out to be a 4 or 8 depending on a 32 or 64 bit machine because name is a pointer and not a buffer. Fix this by making name a variable sized array; this also allows us to remove the complexity of allocation failure handling too. Signed-off-by: Colin Ian King --- src/uefi/uefirtvariable/uefirtvariable.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c index 0617ff4..e59e005 100644 --- a/src/uefi/uefirtvariable/uefirtvariable.c +++ b/src/uefi/uefirtvariable/uefirtvariable.c @@ -633,7 +633,6 @@ static int getnextvariable_test3(fwts_framework *fw) uint64_t maxvariablenamesize = variablenamesize; uint16_t *variablename; EFI_GUID vendorguid; - char *name; int ret; variablename = malloc(sizeof(uint16_t) * variablenamesize); @@ -730,17 +729,13 @@ static int getnextvariable_test3(fwts_framework *fw) item->hash = hash_func(variablename, variablenamesize); if (bucket_insert(item)) { - name = malloc(variablenamesize * sizeof(char)); - if (name) { - fwts_uefi_str16_to_str(name, sizeof(name), variablename); - fwts_failed(fw, LOG_LEVEL_HIGH, - "UEFIRuntimeGetNextVariableName", - "Duplicate variable name %s found.", name); - free(name); - } else - fwts_failed(fw, LOG_LEVEL_HIGH, - "UEFIRuntimeGetNextVariableName", - "Duplicate variable name found (too long name)."); + char name[variablenamesize]; + + fwts_uefi_str16_to_str(name, sizeof(name), variablename); + fwts_failed(fw, LOG_LEVEL_HIGH, + "UEFIRuntimeGetNextVariableName", + "Duplicate variable name %s found.", name); + free(item->name); free(item->guid); free(item); -- 2.1.4 From colin.king at canonical.com Fri May 15 10:36:02 2015 From: colin.king at canonical.com (Colin King) Date: Fri, 15 May 2015 11:36:02 +0100 Subject: [PATCH] lib: fwts_acpi_tables: enforce stricter table loading checks Message-ID: <1431686162-12479-1-git-send-email-colin.king@canonical.com> From: Colin Ian King Coverty Scan is warning that malicious or malformed tables being read in from file could cause problems with the low 32 bit allocator. Add some stricter checking of the size of the buffer being read and also the total ACPI table size. ACPI stipulates that the table size is a 32 bit integer (which is huge), but we need to keep to that maximum upper limit to be in spec. Signed-off-by: Colin Ian King --- src/lib/src/fwts_acpi_tables.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c index 81fb096..cca1135 100644 --- a/src/lib/src/fwts_acpi_tables.c +++ b/src/lib/src/fwts_acpi_tables.c @@ -667,6 +667,10 @@ static uint8_t *fwts_acpi_load_table_from_file(const int fd, size_t *length) } continue; } + if (n > (ssize_t)sizeof(buffer)) + goto too_big; /* Unlikely */ + if (size + n > 0xffffffff) + goto too_big; /* Very unlikely */ if ((tmp = (uint8_t*)fwts_low_realloc(ptr, size + n + 1)) == NULL) { free(ptr); @@ -678,6 +682,11 @@ static uint8_t *fwts_acpi_load_table_from_file(const int fd, size_t *length) } *length = size; return ptr; + +too_big: + free(ptr); + *length = 0; + return NULL; } /* -- 2.1.4 From colin.king at canonical.com Fri May 15 10:36:24 2015 From: colin.king at canonical.com (Colin King) Date: Fri, 15 May 2015 11:36:24 +0100 Subject: [PATCH] lib: acpica: explicitly set buffer to NULL to remove cppcheck warning Message-ID: <1431686184-12609-1-git-send-email-colin.king@canonical.com> From: Colin Ian King cppcheck isn't quite so smart as CoverityScan so it continues to complain about a potential free issue as a false positive. I've taken the liberty to explicity set buffer to NULL to make the code clearer and this helps cppcheck to understand the flow of control better. Signed-off-by: Colin Ian King --- src/acpica/fwts_acpica.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c index 4a6baf6..9bfd0ae 100644 --- a/src/acpica/fwts_acpica.c +++ b/src/acpica/fwts_acpica.c @@ -452,8 +452,10 @@ void fwts_acpica_vprintf(const char *fmt, va_list args) buffer = malloc(buffer_len); if (buffer) strcpy(buffer, tmp); - else + else { + buffer = NULL; buffer_len = 0; + } } else { char *new_buf; @@ -464,11 +466,12 @@ void fwts_acpica_vprintf(const char *fmt, va_list args) strcat(buffer, tmp); } else { free(buffer); + buffer = NULL; buffer_len = 0; } } - if (buffer_len && index(buffer, '\n') != NULL) { + if (buffer && index(buffer, '\n') != NULL) { fwts_log_info(fwts_acpica_fw, "%s", buffer); free(buffer); buffer_len = 0; -- 2.1.4 From colin.king at canonical.com Fri May 15 10:36:46 2015 From: colin.king at canonical.com (Colin King) Date: Fri, 15 May 2015 11:36:46 +0100 Subject: [PATCH] acpi: battery: clean up source, no functional change Message-ID: <1431686206-12752-1-git-send-email-colin.king@canonical.com> From: Colin Ian King cppcheck was complaining about being able to reduce the scope of new_variable: [src/acpi/battery/battery.c:157]: (style) The scope of the variable 'new_value' can be reduced. ..so move the declaration. Also re-format the spacing in an ancient for loop Signed-off-by: Colin Ian King --- src/acpi/battery/battery.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/acpi/battery/battery.c b/src/acpi/battery/battery.c index d216b32..bd4e257 100644 --- a/src/acpi/battery/battery.c +++ b/src/acpi/battery/battery.c @@ -154,14 +154,15 @@ static void check_discharging(fwts_framework *fw, int index, char *name) { int i; /* when we get here we KNOW the state is "discharging" */ - uint32_t initial_value, new_value; + uint32_t initial_value; fwts_printf(fw, "==== Waiting to see if battery '%s' discharges ====\n", name); fwts_cpu_consume_start(); initial_value = get_full(fw, index); - for (i=0; i<=120; i++) { - new_value = get_full(fw, index); + for (i = 0; i <= 120; i++) { + uint32_t new_value = get_full(fw, index); + if (new_value From: Colin Ian King cppcheck is being a bit overly zealous: [src/acpica/source/compiler/fwts_iasl_interface.c:114]: (error) Return value of allocation function freopen is not stored. ..but we may as well assign a file pointer to the freopen() call and explicitly close it before calling _exit() just to make things a little clearer to cppcheck Signed-off-by: Colin Ian King --- src/acpica/source/compiler/fwts_iasl_interface.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/acpica/source/compiler/fwts_iasl_interface.c b/src/acpica/source/compiler/fwts_iasl_interface.c index 56dc76e..68338c9 100644 --- a/src/acpica/source/compiler/fwts_iasl_interface.c +++ b/src/acpica/source/compiler/fwts_iasl_interface.c @@ -71,13 +71,13 @@ int fwts_iasl_disassemble_aml( { pid_t pid; int status, i; + FILE *fp; pid = fork(); switch (pid) { case -1: return -1; case 0: - /* Child */ init_asl_core(); @@ -111,9 +111,10 @@ int fwts_iasl_disassemble_aml( } /* Throw away noisy errors */ - if (freopen("/dev/null", "w", stderr) != NULL) + if ((fp = freopen("/dev/null", "w", stderr)) != NULL) { AslDoOneFile((char *)tables[which]); - + fclose(fp); + } _exit(0); break; default: -- 2.1.4 From colin.king at canonical.com Fri May 15 10:37:26 2015 From: colin.king at canonical.com (Colin King) Date: Fri, 15 May 2015 11:37:26 +0100 Subject: [PATCH] lib: fwts_pipe: clean up static analyzer warning on freopen Message-ID: <1431686246-13001-1-git-send-email-colin.king@canonical.com> From: Colin Ian King cppcheck is being a bit overly zealous: [src/lib/src/fwts_pipeio.c:64]: (error) Return value of allocation function freopen is not stored. (error) Return value of allocation function freopen is not stored. ..but we may as well assign a file pointer to the freopen() call and explicitly close it before calling _exit() just to make things a little clearer to cppcheck Signed-off-by: Colin Ian King --- src/lib/src/fwts_pipeio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c index b5d7fee..94edb16 100644 --- a/src/lib/src/fwts_pipeio.c +++ b/src/lib/src/fwts_pipeio.c @@ -48,6 +48,7 @@ int fwts_pipe_open(const char *command, pid_t *childpid) { int pipefds[2]; pid_t pid; + FILE *fp; if (pipe(pipefds) < 0) return -1; @@ -61,7 +62,7 @@ int fwts_pipe_open(const char *command, pid_t *childpid) return -1; case 0: /* Child */ - if (freopen("/dev/null", "w", stderr) == NULL) { + if ((fp = freopen("/dev/null", "w", stderr)) == NULL) { fprintf(stderr, "Cannot redirect stderr\n"); } if (pipefds[0] != STDOUT_FILENO) { @@ -70,6 +71,8 @@ int fwts_pipe_open(const char *command, pid_t *childpid) } close(pipefds[0]); execl(_PATH_BSHELL, "sh", "-c", command, NULL); + if (fp) + fclose(fp); _exit(FWTS_EXEC_ERROR); default: /* Parent */ -- 2.1.4 From colin.king at canonical.com Sun May 17 16:37:39 2015 From: colin.king at canonical.com (Colin King) Date: Sun, 17 May 2015 17:37:39 +0100 Subject: [PATCH] ACPICA: Update version to 20150515 (LP: #1455946) Message-ID: <1431880659-8497-1-git-send-email-colin.king@canonical.com> From: Colin Ian King Update to ACPICA 20150515, for changes since the previous release incorporated in fwts please refer to the follwing: https://lists.acpica.org/pipermail/devel/2015-May/000707.html Signed-off-by: Colin Ian King --- src/acpica/Makefile.am | 1 + src/acpica/source/common/adisasm.c | 17 +- src/acpica/source/common/ahpredef.c | 11 +- src/acpica/source/common/ahtable.c | 222 ++++++ src/acpica/source/common/dmextern.c | 14 +- src/acpica/source/common/dmtable.c | 260 ++++--- src/acpica/source/common/dmtbdump.c | 736 ++++++++++++++++++- src/acpica/source/common/dmtbinfo.c | 486 +++++++++++- src/acpica/source/compiler/aslascii.c | 38 +- src/acpica/source/compiler/aslcompiler.h | 1 - src/acpica/source/compiler/aslcompiler.l | 15 +- src/acpica/source/compiler/asldefine.h | 2 +- src/acpica/source/compiler/aslfiles.c | 32 +- src/acpica/source/compiler/aslmessages.c | 5 +- src/acpica/source/compiler/aslmessages.h | 1 + src/acpica/source/compiler/aslprepkg.c | 56 +- src/acpica/source/compiler/aslstartup.c | 4 +- src/acpica/source/compiler/aslutils.c | 22 +- src/acpica/source/compiler/dtcompile.c | 75 +- src/acpica/source/compiler/dtcompiler.h | 36 +- src/acpica/source/compiler/dtio.c | 12 +- src/acpica/source/compiler/dtsubtable.c | 5 + src/acpica/source/compiler/dttable.c | 815 ++++++++++++++++++++- src/acpica/source/compiler/dttemplate.c | 8 +- src/acpica/source/compiler/dttemplate.h | 265 +++++-- src/acpica/source/compiler/dtutils.c | 7 + src/acpica/source/compiler/preprocess.h | 10 +- src/acpica/source/compiler/prscan.c | 185 ++++- src/acpica/source/compiler/prutils.c | 29 +- src/acpica/source/components/debugger/dbfileio.c | 18 +- src/acpica/source/components/debugger/dbinput.c | 2 +- src/acpica/source/components/dispatcher/dsmethod.c | 6 +- src/acpica/source/components/hardware/hwpci.c | 9 +- src/acpica/source/components/namespace/nsprepkg.c | 13 + src/acpica/source/components/namespace/nsrepair.c | 2 +- src/acpica/source/components/parser/psopinfo.c | 3 - src/acpica/source/components/utilities/utfileio.c | 9 +- src/acpica/source/components/utilities/uthex.c | 4 +- src/acpica/source/components/utilities/utxferror.c | 12 +- src/acpica/source/include/acdebug.h | 3 +- src/acpica/source/include/acdisasm.h | 81 +- src/acpica/source/include/aclocal.h | 19 + src/acpica/source/include/acparser.h | 3 + src/acpica/source/include/acpixf.h | 2 +- src/acpica/source/include/acpredef.h | 44 +- src/acpica/source/include/actbl.h | 17 +- src/acpica/source/include/actbl1.h | 207 +++++- src/acpica/source/include/actbl2.h | 174 ++++- src/acpica/source/include/actbl3.h | 104 ++- src/acpica/source/include/actypes.h | 1 + src/acpica/source/include/acutils.h | 2 +- src/acpica/source/include/platform/acenv.h | 3 + src/acpica/source/include/platform/acenvex.h | 3 + 53 files changed, 3720 insertions(+), 391 deletions(-) create mode 100644 src/acpica/source/common/ahtable.c diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am index 80e6bc3..66bc1af 100644 --- a/src/acpica/Makefile.am +++ b/src/acpica/Makefile.am @@ -246,6 +246,7 @@ libfwtsacpica_la_SOURCES = \ source/common/acgetline.c \ source/common/ahids.c \ source/common/cmfsize.c \ + source/common/ahtable.c \ source/common/ahuuids.c \ source/tools/acpiexec/aeinitfile.c \ source/tools/acpiexec/aehandlers.c \ diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c index 53abd15..8ee9ccc 100644 --- a/src/acpica/source/common/adisasm.c +++ b/src/acpica/source/common/adisasm.c @@ -286,6 +286,7 @@ AdAmlDisassemble ( char **OutFilename) { ACPI_STATUS Status; + ACPI_STATUS GlobalStatus = AE_OK; char *DisasmFilename = NULL; char *ExternalFilename; ACPI_EXTERNAL_FILE *ExternalFileList = AcpiGbl_ExternalFileList; @@ -301,7 +302,7 @@ AdAmlDisassemble ( */ if (Filename) { - Status = AcpiDbGetTableFromFile (Filename, &Table); + Status = AcpiDbGetTableFromFile (Filename, &Table, FALSE); if (ACPI_FAILURE (Status)) { return (Status); @@ -322,9 +323,16 @@ AdAmlDisassemble ( continue; } - Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable); + Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable, TRUE); if (ACPI_FAILURE (Status)) { + if (Status == AE_TYPE) + { + ExternalFileList = ExternalFileList->Next; + GlobalStatus = AE_TYPE; + Status = AE_OK; + continue; + } return (Status); } @@ -354,6 +362,11 @@ AdAmlDisassemble ( ExternalFileList = ExternalFileList->Next; } + if (ACPI_FAILURE (GlobalStatus)) + { + return (GlobalStatus); + } + /* Clear external list generated by Scope in external tables */ if (AcpiGbl_ExternalFileList) diff --git a/src/acpica/source/common/ahpredef.c b/src/acpica/source/common/ahpredef.c index 57e7279..27c28f1 100644 --- a/src/acpica/source/common/ahpredef.c +++ b/src/acpica/source/common/ahpredef.c @@ -166,6 +166,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_BMS", "Battery Measurement Sampling Time", "Sets the battery measurement sampling time"), AH_PREDEF ("_BQC", "Brightness Query Current", "Returns the current display brightness level"), AH_PREDEF ("_BST", "Battery Status", "Returns a Control Method Battery status block"), + AH_PREDEF ("_BTH", "Battery Throttle Limit", "Thermal limit for charging and discharging"), AH_PREDEF ("_BTM", "Battery Time", "Returns the battery runtime"), AH_PREDEF ("_BTP", "Battery Trip Point", "Sets a Control Method Battery trip point"), AH_PREDEF ("_CBA", "Configuration Base Address", "Sets the base address for a PCI Express host bridge"), @@ -174,6 +175,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_CID", "Compatible ID", "Returns a device's Plug and Play Compatible ID list"), AH_PREDEF ("_CLS", "Class Code", "Returns PCI class code and subclass"), AH_PREDEF ("_CPC", "Continuous Performance Control", "Returns a list of performance control interfaces"), + AH_PREDEF ("_CR3", "Warm/Standby Temperature", "Temperature for a fast low power state"), AH_PREDEF ("_CRS", "Current Resource Settings", "Returns the current resource settings for a device"), AH_PREDEF ("_CRT", "Critical Temperature", "Returns the shutdown critical temperature"), AH_PREDEF ("_CSD", "C-State Dependencies", "Returns a list of C-state dependencies"), @@ -247,6 +249,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_LIN", "Lines In Use", "Handshake lines, Resource Descriptor field"), AH_PREDEF ("_LL_", "Low Level", "Interrupt polarity, Resource Descriptor field"), AH_PREDEF ("_LPD", "Low Power Dependencies", "Returns a list of dependencies for low power idle entry"), + AH_PREDEF ("_LPI", "Low Power Idle States", "Returns a list of supported low power idle states"), AH_PREDEF ("_MAF", "Maximum Address Fixed", "Resource Descriptor field"), AH_PREDEF ("_MAT", "Multiple APIC Table Entry", "Returns a list of MADT APIC structure entries"), AH_PREDEF ("_MAX", "Maximum Base Address", "Resource Descriptor field"), @@ -258,6 +261,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_MOD", "Mode", "Interrupt mode, Resource Descriptor field"), AH_PREDEF ("_MSG", "Message", "Sets the system message waiting status indicator"), AH_PREDEF ("_MSM", "Memory Set Monitoring", "Sets bandwidth monitoring parameters for a memory device"), + AH_PREDEF ("_MTL", "Minimum Throttle Limit", "Returns the minimum throttle limit for a thermal zone"), AH_PREDEF ("_MTP", "Memory Type", "Resource Descriptor field"), AH_PREDEF ("_NTT", "Notification Temperature Threshold", "Returns a threshold for device temperature change that requires platform notification"), AH_PREDEF ("_OFF", "Power Off", "Sets a power resource to the off state"), @@ -281,7 +285,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_PMD", "Power Metered Devices", "Returns a list of devices that are measured by the power meter device"), AH_PREDEF ("_PMM", "Power Meter Measurement", "Returns the current value of the Power Meter"), AH_PREDEF ("_POL", "Polarity", "Interrupt polarity, Resource Descriptor field"), - AH_PREDEF ("_PPC", "Performance Present Capabilites", "Returns a list of the performance states currently supported by the platform"), + AH_PREDEF ("_PPC", "Performance Present Capabilities", "Returns a list of the performance states currently supported by the platform"), AH_PREDEF ("_PPE", "Polling for Platform Error", "Returns the polling interval to retrieve Corrected Platform Error information"), AH_PREDEF ("_PPI", "Pin Configuration", "Resource Descriptor field"), AH_PREDEF ("_PR", "Processor", "Predefined scope for processor objects"), @@ -291,6 +295,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_PR3", "Power Resources for D3hot", "Returns a list of dependent power resources to enter state D3hot"), AH_PREDEF ("_PRE", "Power Resources for Enumeration", "Returns a list of dependent power resources to enumerate devices on a bus"), AH_PREDEF ("_PRL", "Power Source Redundancy List", "Returns a list of power source devices in the same redundancy grouping"), + AH_PREDEF ("_PRR", "Power Resource for Reset", "Execute a reset on a device"), AH_PREDEF ("_PRS", "Possible Resource Settings", "Returns a list of a device's possible resource settings"), AH_PREDEF ("_PRT", "PCI Routing Table", "Returns a list of PCI interrupt mappings"), AH_PREDEF ("_PRW", "Power Resources for Wake", "Returns a list of dependent power resources for waking"), @@ -314,10 +319,12 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_Qxx", "EC Query", "Embedded Controller query and SMBus Alarm control method"), AH_PREDEF ("_RBO", "Register Bit Offset", "Resource Descriptor field"), AH_PREDEF ("_RBW", "Register Bit Width", "Resource Descriptor field"), + AH_PREDEF ("_RDI", "Resource Dependencies for Idle", "Returns a list of dependencies for idle states"), AH_PREDEF ("_REG", "Region Availability", "Inform AML code of an operation region availability change"), AH_PREDEF ("_REV", "Supported ACPI Revision", "Returns the revision of the ACPI specification that is implemented"), AH_PREDEF ("_RMV", "Removal Status", "Returns a device's removal ability status (docking)"), AH_PREDEF ("_RNG", "Range", "Memory range type, Resource Descriptor field"), + AH_PREDEF ("_RST", "Device Reset", "Executes a reset on a device"), AH_PREDEF ("_ROM", "Read-Only Memory", "Returns a copy of the ROM data for a display device"), AH_PREDEF ("_RT_", "Resource Type", "Resource Descriptor field"), AH_PREDEF ("_RTV", "Relative Temperature Values", "Returns temperature value information"), @@ -368,6 +375,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_TC1", "Thermal Constant 1", "Returns TC1 for the passive cooling formula"), AH_PREDEF ("_TC2", "Thermal Constant 2", "Returns TC2 for the passive cooling formula"), AH_PREDEF ("_TDL", "T-State Depth Limit", "Returns the _TSS entry number of the lowest power throttling state"), + AH_PREDEF ("_TFP", "Thermal Fast Sampling Period", "Returns the sampling period for passive cooling"), AH_PREDEF ("_TIP", "Expired Timer Wake Policy", "Returns timer policies of the wake alarm device"), AH_PREDEF ("_TIV", "Timer Values", "Returns remaining time of the wake alarm device"), AH_PREDEF ("_TMP", "Temperature", "Returns a thermal zone's current temperature"), @@ -378,6 +386,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_TRT", "Thermal Relationship Table", "Returns thermal relationships between platform devices"), AH_PREDEF ("_TSD", "Throttling State Dependencies", "Returns a list of T-state dependencies"), AH_PREDEF ("_TSF", "Type-Specific Flags", "Resource Descriptor field"), + AH_PREDEF ("_TSN", "Thermal Sensor Device", "Returns a reference to a thermal sensor"), AH_PREDEF ("_TSP", "Thermal Sampling Period", "Returns the thermal sampling period for passive cooling"), AH_PREDEF ("_TSS", "Throttling Supported States", "Returns supported throttling state information"), AH_PREDEF ("_TST", "Temperature Sensor Threshold", "Returns the minimum separation for a device's temperature trip points"), diff --git a/src/acpica/source/common/ahtable.c b/src/acpica/source/common/ahtable.c new file mode 100644 index 0000000..e5e065d --- /dev/null +++ b/src/acpica/source/common/ahtable.c @@ -0,0 +1,222 @@ +/****************************************************************************** + * + * Module Name: ahtable - Table of known ACPI tables with descriptions + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" + + +/* Local prototypes */ + +const AH_TABLE * +AcpiAhGetTableInfo ( + char *Signature); + +extern const AH_TABLE AcpiSupportedTables[]; + + +/******************************************************************************* + * + * FUNCTION: AcpiAhGetTableInfo + * + * PARAMETERS: Signature - ACPI signature (4 chars) to match + * + * RETURN: Pointer to a valid AH_TABLE. Null if no match found. + * + * DESCRIPTION: Find a match in the "help" table of supported ACPI tables + * + ******************************************************************************/ + +const AH_TABLE * +AcpiAhGetTableInfo ( + char *Signature) +{ + const AH_TABLE *Info; + + + for (Info = AcpiSupportedTables; Info->Signature; Info++) + { + if (ACPI_COMPARE_NAME (Signature, Info->Signature)) + { + return (Info); + } + } + + return (NULL); +} + + +/* + * Note: Any tables added here should be duplicated within AcpiDmTableData + * in the file common/dmtable.c + */ +const AH_TABLE AcpiSupportedTables[] = +{ + {ACPI_SIG_ASF, "Alert Standard Format table"}, + {ACPI_SIG_BERT, "Boot Error Record Table"}, + {ACPI_SIG_BGRT, "Boot Graphics Resource Table"}, + {ACPI_SIG_BOOT, "Simple Boot Flag Table"}, + {ACPI_SIG_CPEP, "Corrected Platform Error Polling table"}, + {ACPI_SIG_CSRT, "Core System Resource Table"}, + {ACPI_SIG_DBG2, "Debug Port table type 2"}, + {ACPI_SIG_DBGP, "Debug Port table"}, + {ACPI_SIG_DMAR, "DMA Remapping table"}, + {ACPI_SIG_DRTM, "Dynamic Root of Trust for Measurement table"}, + {ACPI_SIG_DSDT, "Differentiated System Description Table (AML table)"}, + {ACPI_SIG_ECDT, "Embedded Controller Boot Resources Table"}, + {ACPI_SIG_EINJ, "Error Injection table"}, + {ACPI_SIG_ERST, "Error Record Serialization Table"}, + {ACPI_SIG_FACS, "Firmware ACPI Control Structure"}, + {ACPI_SIG_FADT, "Fixed ACPI Description Table (FADT)"}, + {ACPI_SIG_FPDT, "Firmware Performance Data Table"}, + {ACPI_SIG_GTDT, "Generic Timer Description Table"}, + {ACPI_SIG_HEST, "Hardware Error Source Table"}, + {ACPI_SIG_HPET, "High Precision Event Timer table"}, + {ACPI_SIG_IORT, "IO Remapping Table"}, + {ACPI_SIG_IVRS, "I/O Virtualization Reporting Structure"}, + {ACPI_SIG_LPIT, "Low Power Idle Table"}, + {ACPI_SIG_MADT, "Multiple APIC Description Table (MADT)"}, + {ACPI_SIG_MCFG, "Memory Mapped Configuration table"}, + {ACPI_SIG_MCHI, "Management Controller Host Interface table"}, + {ACPI_SIG_MPST, "Memory Power State Table"}, + {ACPI_SIG_MSCT, "Maximum System Characteristics Table"}, + {ACPI_SIG_MSDM, "Microsoft Data Management table"}, + {ACPI_SIG_MTMR, "MID Timer Table"}, + {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, + {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, + {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, + {ACPI_RSDP_NAME,"Root System Description Pointer"}, + {ACPI_SIG_RSDT, "Root System Description Table"}, + {ACPI_SIG_S3PT, "S3 Performance Table"}, + {ACPI_SIG_SBST, "Smart Battery Specification Table"}, + {ACPI_SIG_SLIC, "Software Licensing Description Table"}, + {ACPI_SIG_SLIT, "System Locality Information Table"}, + {ACPI_SIG_SPCR, "Serial Port Console Redirection table"}, + {ACPI_SIG_SPMI, "Server Platform Management Interface table"}, + {ACPI_SIG_SRAT, "System Resource Affinity Table"}, + {ACPI_SIG_SSDT, "Secondary System Description Table (AML table)"}, + {ACPI_SIG_STAO, "Status Override table"}, + {ACPI_SIG_TCPA, "Trusted Computing Platform Alliance table"}, + {ACPI_SIG_TPM2, "Trusted Platform Module hardware interface table"}, + {ACPI_SIG_UEFI, "UEFI Boot Optimization Table"}, + {ACPI_SIG_VRTC, "Virtual Real-Time Clock Table"}, + {ACPI_SIG_WAET, "Windows ACPI Emulated Devices Table"}, + {ACPI_SIG_WDAT, "Watchdog Action Table"}, + {ACPI_SIG_WDDT, "Watchdog Description Table"}, + {ACPI_SIG_WDRT, "Watchdog Resource Table"}, + {ACPI_SIG_WPBT, "Windows Platform Binary Table"}, + {ACPI_SIG_XENV, "Xen Environment table"}, + {ACPI_SIG_XSDT, "Extended System Description Table"}, + {NULL, NULL} +}; diff --git a/src/acpica/source/common/dmextern.c b/src/acpica/source/common/dmextern.c index 72397f0..dc3c8b4 100644 --- a/src/acpica/source/common/dmextern.c +++ b/src/acpica/source/common/dmextern.c @@ -1358,7 +1358,9 @@ AcpiDmUnresolvedWarning ( " * compile because the disassembler did not know how many arguments\n" " * to assign to these methods. To specify the tables needed to resolve\n" " * external control method references, the -e option can be used to\n" - " * specify the filenames. Example iASL invocations:\n" + " * specify the filenames. Note: SSDTs can be dynamically loaded at\n" + " * runtime and may or may not be available via the host OS.\n" + " * Example iASL invocations:\n" " * iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" " * iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" " * iasl -e ssdt*.aml -d dsdt.aml\n" @@ -1386,7 +1388,8 @@ AcpiDmUnresolvedWarning ( " * ACPI tables may be required to properly disassemble the code. This\n" " * resulting disassembler output file may not compile because the\n" " * disassembler did not know how many arguments to assign to the\n" - " * unresolved methods.\n" + " * unresolved methods. Note: SSDTs can be dynamically loaded at\n" + " * runtime and may or may not be available via the host OS.\n" " *\n" " * If necessary, the -fe option can be used to specify a file containing\n" " * control method external declarations with the associated method\n" @@ -1417,7 +1420,9 @@ AcpiDmUnresolvedWarning ( "compile because the disassembler did not know how many arguments\n" "to assign to these methods. To specify the tables needed to resolve\n" "external control method references, the -e option can be used to\n" - "specify the filenames. Example iASL invocations:\n" + "specify the filenames. Note: SSDTs can be dynamically loaded at\n" + "runtime and may or may not be available via the host OS.\n" + "Example iASL invocations:\n" " iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" " iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" " iasl -e ssdt*.aml -d dsdt.aml\n" @@ -1440,7 +1445,8 @@ AcpiDmUnresolvedWarning ( "ACPI tables may be required to properly disassemble the code. The\n" "resulting disassembler output file may not compile because the\n" "disassembler did not know how many arguments to assign to the\n" - "unresolved methods.\n" + "unresolved methods. Note: SSDTs can be dynamically loaded at\n" + "runtime and may or may not be available via the host OS.\n" "\n" "If necessary, the -fe option can be used to specify a file containing\n" "control method external declarations with the associated method\n" diff --git a/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c index ca165df..6397abe 100644 --- a/src/acpica/source/common/dmtable.c +++ b/src/acpica/source/common/dmtable.c @@ -125,6 +125,11 @@ #define _COMPONENT ACPI_CA_DISASSEMBLER ACPI_MODULE_NAME ("dmtable") +const AH_TABLE * +AcpiAhGetTableInfo ( + char *Signature); + + /* Local Prototypes */ static void @@ -150,7 +155,7 @@ static const char *AcpiDmAsfSubnames[] = "ASF Remote Control", "ASF RMCP Boot Options", "ASF Address", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmDmarSubnames[] = @@ -160,7 +165,7 @@ static const char *AcpiDmDmarSubnames[] = "Root Port ATS Capability", "Remapping Hardware Static Affinity", "ACPI Namespace Device Declaration", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmDmarScope[] = @@ -248,7 +253,7 @@ static const char *AcpiDmGtdtSubnames[] = { "Generic Timer Block", "Generic Watchdog Timer", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmHestSubnames[] = @@ -263,7 +268,7 @@ static const char *AcpiDmHestSubnames[] = "PCI Express AER (AER Endpoint)", "PCI Express/PCI-X Bridge AER", "Generic Hardware Error Source", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmHestNotifySubnames[] = @@ -295,14 +300,27 @@ static const char *AcpiDmMadtSubnames[] = "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */ "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */ "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */ - "Unknown SubTable Type" /* Reserved */ + "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */ + "Unknown Subtable Type" /* Reserved */ +}; + +static const char *AcpiDmNfitSubnames[] = +{ + "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */ + "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */ + "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */ + "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */ + "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */ + "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */ + "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmPcctSubnames[] = { "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */ - "HW-Reduced Communications Subspace", - "Unknown SubTable Type" /* Reserved */ + "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmPmttSubnames[] = @@ -310,7 +328,7 @@ static const char *AcpiDmPmttSubnames[] = "Socket", /* ACPI_PMTT_TYPE_SOCKET */ "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */ "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmSratSubnames[] = @@ -319,21 +337,20 @@ static const char *AcpiDmSratSubnames[] = "Memory Affinity", "Processor Local x2APIC Affinity", "GICC Affinity", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmIvrsSubnames[] = { "Hardware Definition Block", "Memory Definition Block", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; static const char *AcpiDmLpitSubnames[] = { "Native C-state Idle Structure", - "Simple I/O Idle Structure", - "Unknown SubTable Type" /* Reserved */ + "Unknown Subtable Type" /* Reserved */ }; #define ACPI_FADT_PM_RESERVED 9 @@ -376,56 +393,65 @@ static const char *AcpiDmGasAccessWidth[] = * handler. This table must be NULL terminated. RSDP and FACS are * special-cased elsewhere. * + * Note: Any tables added here should be duplicated within AcpiSupportedTables + * in the file common/ahtable.c + * ******************************************************************************/ -ACPI_DMTABLE_DATA AcpiDmTableData[] = +const ACPI_DMTABLE_DATA AcpiDmTableData[] = { - {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"}, - {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"}, - {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"}, - {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"}, - {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"}, - {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt, "Core System Resource Table"}, - {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2, "Debug Port table type 2"}, - {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"}, - {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"}, - {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"}, - {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"}, - {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"}, - {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table (FADT)"}, - {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"}, - {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt, "Generic Timer Description Table"}, - {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"}, - {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"}, - {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"}, - {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit, "Low Power Idle Table"}, - {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table (MADT)"}, - {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"}, - {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"}, - {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"}, - {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"}, - {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm, "Microsoft Data Management table"}, - {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr, "MID Timer Table"}, - {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct, "Platform Communications Channel Table"}, - {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"}, - {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"}, - {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt, "S3 Performance Table"}, - {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"}, - {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic, "Software Licensing Description Table"}, - {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"}, - {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"}, - {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"}, - {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"}, - {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"}, - {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2, "Trusted Platform Module hardware interface table"}, - {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"}, - {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc, "Virtual Real-Time Clock Table"}, - {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"}, - {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"}, - {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"}, - {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt, "Watchdog Resource Table"}, - {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt, "Extended System Description Table"}, - {NULL, NULL, NULL, NULL, NULL, NULL} + {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf}, + {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert}, + {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt}, + {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot}, + {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep}, + {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt}, + {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2}, + {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp}, + {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar}, + {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm}, + {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt}, + {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj}, + {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst}, + {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt}, + {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt}, + {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt}, + {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest}, + {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet}, + {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort}, + {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs}, + {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit}, + {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt}, + {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg}, + {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi}, + {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst}, + {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct}, + {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm}, + {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr}, + {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, + {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, + {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, + {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, + {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, + {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, + {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic}, + {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit}, + {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr}, + {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi}, + {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, + {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, + {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa}, + {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2}, + {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, + {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc}, + {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, + {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat}, + {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt}, + {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt}, + {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt}, + {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv}, + {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt}, + {NULL, NULL, NULL, NULL, NULL} }; @@ -479,18 +505,18 @@ AcpiDmGenerateChecksum ( * ******************************************************************************/ -ACPI_DMTABLE_DATA * +const ACPI_DMTABLE_DATA * AcpiDmGetTableData ( char *Signature) { - ACPI_DMTABLE_DATA *TableData; + const ACPI_DMTABLE_DATA *Info; - for (TableData = AcpiDmTableData; TableData->Signature; TableData++) + for (Info = AcpiDmTableData; Info->Signature; Info++) { - if (ACPI_COMPARE_NAME (Signature, TableData->Signature)) + if (ACPI_COMPARE_NAME (Signature, Info->Signature)) { - return (TableData); + return (Info); } } @@ -516,7 +542,7 @@ AcpiDmDumpDataTable ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_DMTABLE_DATA *TableData; + const ACPI_DMTABLE_DATA *TableData; UINT32 Length; @@ -630,7 +656,6 @@ AcpiDmDumpDataTable ( * PARAMETERS: Offset - Current byte offset, from table start * ByteLength - Length of the field in bytes, 0 for flags * Name - Name of this field - * Value - Optional value, displayed on left of ':' * * RETURN: None * @@ -764,7 +789,7 @@ AcpiDmDumpTable ( UINT16 Temp16; UINT32 Temp32; UINT64 Value; - ACPI_DMTABLE_DATA *TableData; + const AH_TABLE *TableData; const char *Name; BOOLEAN LastOutputBlankLine = FALSE; char RepairedName[8]; @@ -787,13 +812,24 @@ AcpiDmDumpTable ( Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset); CurrentOffset = TableOffset + Info->Offset; - /* Check for beyond EOT or beyond subtable end */ + /* Check for beyond subtable end or (worse) beyond EOT */ + + if (SubtableLength && (Info->Offset >= SubtableLength)) + { + AcpiOsPrintf ( + "/**** ACPI subtable terminates early - " + "may be older version (dump table) */\n"); - if ((CurrentOffset >= TableLength) || - (SubtableLength && (Info->Offset >= SubtableLength))) + /* Move on to next subtable */ + + return (AE_OK); + } + + if (CurrentOffset >= TableLength) { AcpiOsPrintf ( - "**** ACPI table terminates in the middle of a data structure! (dump table)\n"); + "/**** ACPI table terminates " + "in the middle of a data structure! (dump table) */\n"); return (AE_BAD_DATA); } @@ -826,6 +862,7 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: case ACPI_DMT_HEST: + case ACPI_DMT_NFIT: ByteLength = 2; break; @@ -882,6 +919,7 @@ AcpiDmDumpTable ( ByteLength = 128; break; + case ACPI_DMT_UNICODE: case ACPI_DMT_BUFFER: case ACPI_DMT_RAW_BUFFER: @@ -913,16 +951,39 @@ AcpiDmDumpTable ( ByteLength = sizeof (ACPI_HEST_NOTIFY); break; + case ACPI_DMT_IORTMEM: + + if (!LastOutputBlankLine) + { + LastOutputBlankLine = FALSE; + } + ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS); + break; + default: ByteLength = 0; break; } + /* Check if we are beyond a subtable, or (worse) beyond EOT */ + if (CurrentOffset + ByteLength > TableLength) { + if (SubtableLength) + { + AcpiOsPrintf ( + "/**** ACPI subtable terminates early - " + "may be older version (dump table) */\n"); + + /* Move on to next subtable */ + + return (AE_OK); + } + AcpiOsPrintf ( - "**** ACPI table terminates in the middle of a data structure!\n"); + "/**** ACPI table terminates " + "in the middle of a data structure! */\n"); return (AE_BAD_DATA); } @@ -1052,10 +1113,10 @@ AcpiDmDumpTable ( AcpiDmCheckAscii (Target, RepairedName, 4); AcpiOsPrintf ("\"%.4s\" ", RepairedName); - TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target)); + TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target)); if (TableData) { - AcpiOsPrintf (STRING_FORMAT, TableData->Name); + AcpiOsPrintf (STRING_FORMAT, TableData->Description); } else { @@ -1281,6 +1342,16 @@ AcpiDmDumpTable ( AcpiDmHestNotifySubnames[Temp8]); break; + case ACPI_DMT_IORTMEM: + + AcpiOsPrintf (STRING_FORMAT, + "IORT Memory Access Properties"); + + AcpiDmDumpTable (TableLength, CurrentOffset, Target, + sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc); + LastOutputBlankLine = TRUE; + break; + case ACPI_DMT_MADT: /* MADT subtable types */ @@ -1295,6 +1366,20 @@ AcpiDmDumpTable ( AcpiDmMadtSubnames[Temp8]); break; + case ACPI_DMT_NFIT: + + /* NFIT subtable types */ + + Temp16 = ACPI_GET16 (Target); + if (Temp16 > ACPI_NFIT_TYPE_RESERVED) + { + Temp16 = ACPI_NFIT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), + AcpiDmNfitSubnames[Temp16]); + break; + case ACPI_DMT_PCCT: /* PCCT subtable types */ @@ -1323,16 +1408,27 @@ AcpiDmDumpTable ( AcpiDmPmttSubnames[Temp8]); break; + case ACPI_DMT_UNICODE: + + if (ByteLength == 0) + { + AcpiOsPrintf ("/* Zero-length Data */\n"); + break; + } + + AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength); + break; + case ACPI_DMT_RAW_BUFFER: - /* - * Currently only used for SLIC table - */ - AcpiOsPrintf ("/* Proprietary data structure */ "); - AcpiDmDumpBuffer (Table, sizeof (ACPI_TABLE_HEADER), - ByteLength, sizeof (ACPI_TABLE_HEADER), - "Licensing Data", TRUE); - AcpiOsPrintf ("\n"); + if (ByteLength == 0) + { + AcpiOsPrintf ("/* Zero-length Data */\n"); + break; + } + + AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength, + CurrentOffset, NULL); break; case ACPI_DMT_SRAT: diff --git a/src/acpica/source/common/dmtbdump.c b/src/acpica/source/common/dmtbdump.c index a12020b..9196dbb 100644 --- a/src/acpica/source/common/dmtbdump.c +++ b/src/acpica/source/common/dmtbdump.c @@ -142,7 +142,6 @@ AcpiDmValidateFadtLength ( * AbsoluteOffset - Offset of buffer in the main ACPI table * Header - Name of the buffer field (printed on the * first line only.) - * MultiLine - TRUE if a large, multi-line buffer * * RETURN: None * @@ -157,8 +156,7 @@ AcpiDmDumpBuffer ( UINT32 BufferOffset, UINT32 Length, UINT32 AbsoluteOffset, - char *Header, - BOOLEAN MultiLine) + char *Header) { UINT8 *Buffer; UINT32 i; @@ -176,18 +174,11 @@ AcpiDmDumpBuffer ( { if (!(i % 16)) { - if (MultiLine) - { - /* Insert a backslash - line continuation character */ + /* Insert a backslash - line continuation character */ - AcpiOsPrintf ("\\\n "); - } - else + if (Length > 16) { - AcpiOsPrintf ("\n"); - AcpiDmLineHeader (AbsoluteOffset, - ((Length - i) > 16) ? 16 : (Length - i), Header); - Header = NULL; + AcpiOsPrintf ("\\\n "); } } @@ -203,6 +194,74 @@ AcpiDmDumpBuffer ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpUnicode + * + * PARAMETERS: Table - ACPI Table or subtable + * BufferOffset - Offset of buffer from Table above + * ByteLength - Length of the buffer + * + * RETURN: None + * + * DESCRIPTION: Validate and dump the contents of a buffer that contains + * unicode data. The output is a standard ASCII string. If it + * appears that the data is not unicode, the buffer is dumped + * as hex characters. + * + ******************************************************************************/ + +void +AcpiDmDumpUnicode ( + void *Table, + UINT32 BufferOffset, + UINT32 ByteLength) +{ + UINT8 *Buffer; + UINT32 Length; + UINT32 i; + + + Buffer = ((UINT8 *) Table) + BufferOffset; + Length = ByteLength - 2; /* Last two bytes are the null terminator */ + + /* Ensure all low bytes are entirely printable ASCII */ + + for (i = 0; i < Length; i += 2) + { + if (!ACPI_IS_PRINT (Buffer[i])) + { + goto DumpRawBuffer; + } + } + + /* Ensure all high bytes are zero */ + + for (i = 1; i < Length; i += 2) + { + if (Buffer[i]) + { + goto DumpRawBuffer; + } + } + + /* Dump the buffer as a normal string */ + + AcpiOsPrintf ("\""); + for (i = 0; i < Length; i += 2) + { + AcpiOsPrintf ("%c", Buffer[i]); + } + AcpiOsPrintf ("\"\n"); + return; + +DumpRawBuffer: + AcpiDmDumpBuffer (Table, BufferOffset, ByteLength, + BufferOffset, NULL); + AcpiOsPrintf ("\n"); +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpRsdp * * PARAMETERS: Table - A RSDP @@ -385,6 +444,13 @@ AcpiDmDumpFadt ( { AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5); } + + /* Check for FADT revision 6 fields and up (ACPI 6.0+) */ + + if (Table->Length > ACPI_FADT_V3_SIZE) + { + AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6); + } } /* Validate various fields in the FADT, including length */ @@ -765,10 +831,17 @@ AcpiDmDumpCsrt ( /* Resource-specific info buffer */ InfoLength = SubSubTable->Length - SubSubOffset; - - AcpiDmDumpBuffer (SubSubTable, SubSubOffset, InfoLength, - Offset + SubOffset + SubSubOffset, "ResourceInfo", FALSE); - SubSubOffset += InfoLength; + if (InfoLength) + { + Status = AcpiDmDumpTable (Length, + Offset + SubOffset + SubSubOffset, Table, + InfoLength, AcpiDmTableInfoCsrt2a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubSubOffset += InfoLength; + } /* Point to next sub-subtable */ @@ -886,8 +959,13 @@ AcpiDmDumpDbg2 ( if (SubTable->OemDataOffset) { - AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength, - Offset + SubTable->OemDataOffset, "OEM Data", FALSE); + Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset, + Table, SubTable->OemDataLength, + AcpiDmTableInfoDbg2OemData); + if (ACPI_FAILURE (Status)) + { + return; + } } /* Point to next subtable */ @@ -912,7 +990,6 @@ AcpiDmDumpDbg2 ( * ******************************************************************************/ - void AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table) @@ -1057,6 +1134,120 @@ NextSubtable: /******************************************************************************* * + * FUNCTION: AcpiDmDumpDrtm + * + * PARAMETERS: Table - A DRTM table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a DRTM. + * + ******************************************************************************/ + +void +AcpiDmDumpDrtm ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Offset; + ACPI_DRTM_VTABLE_LIST *DrtmVtl; + ACPI_DRTM_RESOURCE_LIST *DrtmRl; + ACPI_DRTM_DPS_ID *DrtmDps; + UINT32 Count; + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, + AcpiDmTableInfoDrtm); + if (ACPI_FAILURE (Status)) + { + return; + } + + Offset = sizeof (ACPI_TABLE_DRTM); + + /* Sub-tables */ + + /* Dump ValidatedTable length */ + + DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset); + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, + DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables), + AcpiDmTableInfoDrtm0); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables); + + /* Dump Validated table addresses */ + + Count = 0; + while ((Offset < Table->Length) && + (DrtmVtl->ValidatedTableCount > Count)) + { + Status = AcpiDmDumpTable (Table->Length, Offset, + ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64), + AcpiDmTableInfoDrtm0a); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset += sizeof (UINT64); + Count++; + } + + /* Dump ResourceList length */ + + DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset); + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, + DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources), + AcpiDmTableInfoDrtm1); + if (ACPI_FAILURE (Status)) + { + return; + } + + Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources); + + /* Dump the Resource List */ + + Count = 0; + while ((Offset < Table->Length) && + (DrtmRl->ResourceCount > Count)) + { + Status = AcpiDmDumpTable (Table->Length, Offset, + ACPI_ADD_PTR (void, Table, Offset), + sizeof (ACPI_DRTM_RESOURCE), + AcpiDmTableInfoDrtm1a); + if (ACPI_FAILURE (Status)) + { + return; + } + + Offset += sizeof (ACPI_DRTM_RESOURCE); + Count++; + } + + /* Dump DPS */ + + DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset); + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, + DrtmDps, sizeof (ACPI_DRTM_DPS_ID), + AcpiDmTableInfoDrtm2); + if (ACPI_FAILURE (Status)) + { + return; + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpEinj * * PARAMETERS: Table - A EINJ table @@ -1501,6 +1692,230 @@ AcpiDmDumpHest ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpIort + * + * PARAMETERS: Table - A IORT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a IORT + * + ******************************************************************************/ + +void +AcpiDmDumpIort ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_TABLE_IORT *Iort; + ACPI_IORT_NODE *IortNode; + ACPI_IORT_ITS_GROUP *IortItsGroup = NULL; + ACPI_IORT_SMMU *IortSmmu = NULL; + UINT32 Offset; + UINT32 NodeOffset; + UINT32 Length; + ACPI_DMTABLE_INFO *InfoTable; + char *String; + UINT32 i; + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort); + if (ACPI_FAILURE (Status)) + { + return; + } + + Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table); + Offset = sizeof (ACPI_TABLE_IORT); + + /* Dump the OptionalPadding (optional) */ + + if (Iort->NodeOffset > Offset) + { + Status = AcpiDmDumpTable (Table->Length, Offset, Table, + Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad); + if (ACPI_FAILURE (Status)) + { + return; + } + } + + Offset = Iort->NodeOffset; + while (Offset < Table->Length) + { + /* Common subtable header */ + + IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset); + AcpiOsPrintf ("\n"); + Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); + Status = AcpiDmDumpTable (Table->Length, Offset, + IortNode, Length, AcpiDmTableInfoIortHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + NodeOffset = Length; + + switch (IortNode->Type) + { + case ACPI_IORT_NODE_ITS_GROUP: + + InfoTable = AcpiDmTableInfoIort0; + Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers); + IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset); + break; + + case ACPI_IORT_NODE_NAMED_COMPONENT: + + InfoTable = AcpiDmTableInfoIort1; + Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName); + String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length); + Length += ACPI_STRLEN (String) + 1; + break; + + case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: + + InfoTable = AcpiDmTableInfoIort2; + Length = IortNode->Length - NodeOffset; + break; + + case ACPI_IORT_NODE_SMMU: + + InfoTable = AcpiDmTableInfoIort3; + Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts); + IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset); + break; + + default: + + AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n", + IortNode->Type); + + /* Attempt to continue */ + + if (!IortNode->Length) + { + AcpiOsPrintf ("Invalid zero length IORT node\n"); + return; + } + goto NextSubTable; + } + + /* Dump the node subtable header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + NodeOffset += Length; + + /* Dump the node specific data */ + + switch (IortNode->Type) + { + case ACPI_IORT_NODE_ITS_GROUP: + + /* Validate IortItsGroup to avoid compiler warnings */ + + if (IortItsGroup) + { + for (i = 0; i < IortItsGroup->ItsCount; i++) + { + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + 4, AcpiDmTableInfoIort0a); + NodeOffset += 4; + } + } + break; + + case ACPI_IORT_NODE_NAMED_COMPONENT: + + /* Dump the Padding (optional) */ + + if (IortNode->Length > NodeOffset) + { + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, + Table, IortNode->Length - NodeOffset, + AcpiDmTableInfoIort1a); + if (ACPI_FAILURE (Status)) + { + return; + } + } + break; + + case ACPI_IORT_NODE_SMMU: + + AcpiOsPrintf ("\n"); + + /* Validate IortSmmu to avoid compiler warnings */ + + if (IortSmmu) + { + Length = 2 * sizeof (UINT64); + NodeOffset = IortSmmu->GlobalInterruptOffset; + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + Length, AcpiDmTableInfoIort3a); + + NodeOffset = IortSmmu->ContextInterruptOffset; + for (i = 0; i < IortSmmu->ContextInterruptCount; i++) + { + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + 8, AcpiDmTableInfoIort3b); + NodeOffset += 8; + } + + NodeOffset = IortSmmu->PmuInterruptOffset; + for (i = 0; i < IortSmmu->PmuInterruptCount; i++) + { + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + 8, AcpiDmTableInfoIort3c); + NodeOffset += 8; + } + } + break; + + default: + + break; + } + + /* Dump the ID mappings */ + + NodeOffset = IortNode->MappingOffset; + for (i = 0; i < IortNode->MappingCount; i++) + { + AcpiOsPrintf ("\n"); + Length = sizeof (ACPI_IORT_ID_MAPPING); + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + Length, AcpiDmTableInfoIortMap); + NodeOffset += Length; + } + +NextSubTable: + /* Point to next node subtable */ + + Offset += IortNode->Length; + IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpIvrs * * PARAMETERS: Table - A IVRS table @@ -1726,12 +2141,6 @@ AcpiDmDumpLpit ( SubTableLength = sizeof (ACPI_LPIT_NATIVE); break; - case ACPI_LPIT_TYPE_SIMPLE_IO: - - InfoTable = AcpiDmTableInfoLpit1; - SubTableLength = sizeof (ACPI_LPIT_IO); - break; - default: /* Cannot continue on unknown type - no length */ @@ -1880,6 +2289,11 @@ AcpiDmDumpMadt ( InfoTable = AcpiDmTableInfoMadt14; break; + case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: + + InfoTable = AcpiDmTableInfoMadt15; + break; + default: AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", SubTable->Type); @@ -2218,6 +2632,180 @@ AcpiDmDumpMtmr ( /******************************************************************************* * + * FUNCTION: AcpiDmDumpNfit + * + * PARAMETERS: Table - A NFIT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of an NFIT. + * + ******************************************************************************/ + +void +AcpiDmDumpNfit ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_NFIT); + UINT32 FieldOffset = 0; + UINT32 Length; + ACPI_NFIT_HEADER *SubTable; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_NFIT_INTERLEAVE *Interleave = NULL; + ACPI_NFIT_SMBIOS *SmbiosInfo = NULL; + ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL; + UINT32 i; + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Subtables */ + + SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* NFIT subtable header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoNfitHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (SubTable->Type) + { + case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: + + InfoTable = AcpiDmTableInfoNfit0; + break; + + case ACPI_NFIT_TYPE_MEMORY_MAP: + + InfoTable = AcpiDmTableInfoNfit1; + break; + + case ACPI_NFIT_TYPE_INTERLEAVE: + + /* Has a variable number of 32-bit values at the end */ + + InfoTable = AcpiDmTableInfoNfit2; + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, SubTable); + FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE); + break; + + case ACPI_NFIT_TYPE_SMBIOS: + + SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, SubTable); + InfoTable = AcpiDmTableInfoNfit3; + break; + + case ACPI_NFIT_TYPE_CONTROL_REGION: + + InfoTable = AcpiDmTableInfoNfit4; + break; + + case ACPI_NFIT_TYPE_DATA_REGION: + + InfoTable = AcpiDmTableInfoNfit5; + break; + + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + + /* Has a variable number of 64-bit addresses at the end */ + + InfoTable = AcpiDmTableInfoNfit6; + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, SubTable); + FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64); + break; + + default: + AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n", SubTable->Type); + + /* Attempt to continue */ + + if (!SubTable->Length) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; + } + goto NextSubTable; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Per-subtable variable-length fields */ + + switch (SubTable->Type) + { + case ACPI_NFIT_TYPE_INTERLEAVE: + + for (i = 0; i < Interleave->LineCount; i++) + { + Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, + &Interleave->LineOffset[i], + sizeof (UINT32), AcpiDmTableInfoNfit2a); + FieldOffset += sizeof (UINT32); + } + break; + + case ACPI_NFIT_TYPE_SMBIOS: + + Length = SubTable->Length - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8); + if (Length) + { + Status = AcpiDmDumpTable (Table->Length, + sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8), + SmbiosInfo, + Length, AcpiDmTableInfoNfit3a); + if (ACPI_FAILURE (Status)) + { + return; + } + } + + break; + + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + + for (i = 0; i < Hint->HintCount; i++) + { + Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, + &Hint->HintAddress[i], + sizeof (UINT64), AcpiDmTableInfoNfit6a); + FieldOffset += sizeof (UINT64); + } + break; + + default: + break; + } + +NextSubTable: + /* Point to next subtable */ + + Offset += SubTable->Length; + SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, SubTable, SubTable->Length); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpPcct * * PARAMETERS: Table - A PCCT table @@ -2792,6 +3380,56 @@ NextSubTable: /******************************************************************************* * + * FUNCTION: AcpiDmDumpStao + * + * PARAMETERS: Table - A STAO table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a STAO. This is a variable-length + * table that contains an open-ended number of ASCII strings + * at the end of the table. + * + ******************************************************************************/ + +void +AcpiDmDumpStao ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + char *Namepath; + UINT32 Length = Table->Length; + UINT32 StringLength; + UINT32 Offset = sizeof (ACPI_TABLE_STAO); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* The rest of the table consists of Namepath strings */ + + while (Offset < Table->Length) + { + Namepath = ACPI_ADD_PTR (char, Table, Offset); + StringLength = ACPI_STRLEN (Namepath) + 1; + + AcpiDmLineHeader (Offset, StringLength, "Namestring"); + AcpiOsPrintf ("\"%s\"\n", Namepath); + + /* Point to next namepath */ + + Offset += StringLength; + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpVrtc * * PARAMETERS: Table - A VRTC table @@ -2892,3 +3530,49 @@ AcpiDmDumpWdat ( SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY)); } } + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpWpbt + * + * PARAMETERS: Table - A WPBT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a WPBT. This table type consists + * of an open-ended arguments buffer at the end of the table. + * + ******************************************************************************/ + +void +AcpiDmDumpWpbt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_TABLE_WPBT *SubTable; + UINT32 Length = Table->Length; + UINT16 ArgumentsLength; + + + /* Dump the main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Extract the arguments buffer length from the main table */ + + SubTable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table); + ArgumentsLength = SubTable->ArgumentsLength; + + /* Dump the arguments buffer */ + + AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength, + AcpiDmTableInfoWpbt0); + if (ACPI_FAILURE (Status)) + { + return; + } +} diff --git a/src/acpica/source/common/dmtbinfo.c b/src/acpica/source/common/dmtbinfo.c index 0405462..41e4d6a 100644 --- a/src/acpica/source/common/dmtbinfo.c +++ b/src/acpica/source/common/dmtbinfo.c @@ -168,12 +168,14 @@ #define ACPI_GTDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_GTDT,f) #define ACPI_HEST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HEST,f) #define ACPI_HPET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HPET,f) +#define ACPI_IORT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_IORT,f) #define ACPI_IVRS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_IVRS,f) #define ACPI_MADT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MADT,f) #define ACPI_MCFG_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MCFG,f) #define ACPI_MCHI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MCHI,f) #define ACPI_MPST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MPST,f) #define ACPI_MSCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MSCT,f) +#define ACPI_NFIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_NFIT,f) #define ACPI_PCCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PCCT,f) #define ACPI_PMTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PMTT,f) #define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f) @@ -182,6 +184,7 @@ #define ACPI_SPCR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPCR,f) #define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f) #define ACPI_SRAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f) +#define ACPI_STAO_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_STAO,f) #define ACPI_TCPA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA,f) #define ACPI_TPM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM2,f) #define ACPI_UEFI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f) @@ -189,6 +192,8 @@ #define ACPI_WDAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDAT,f) #define ACPI_WDDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDDT,f) #define ACPI_WDRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDRT,f) +#define ACPI_WPBT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WPBT,f) +#define ACPI_XENV_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_XENV,f) /* Subtables */ @@ -210,6 +215,10 @@ #define ACPI_DMAR2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_ATSR,f) #define ACPI_DMAR3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_RHSA,f) #define ACPI_DMAR4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_ANDD,f) +#define ACPI_DRTM0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST,f) +#define ACPI_DRTM1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST,f) +#define ACPI_DRTM1a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_RESOURCE,f) +#define ACPI_DRTM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_DPS_ID,f) #define ACPI_EINJ0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f) #define ACPI_ERST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f) #define ACPI_FPDTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_HEADER,f) @@ -228,6 +237,13 @@ #define ACPI_HEST9_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC,f) #define ACPI_HESTN_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) #define ACPI_HESTB_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) +#define ACPI_IORT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ITS_GROUP,f) +#define ACPI_IORT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT,f) +#define ACPI_IORT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ROOT_COMPLEX,f) +#define ACPI_IORT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_SMMU,f) +#define ACPI_IORTA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_MEMORY_ACCESS,f) +#define ACPI_IORTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NODE,f) +#define ACPI_IORTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ID_MAPPING,f) #define ACPI_IVRSH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HEADER,f) #define ACPI_IVRS0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f) #define ACPI_IVRS1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) @@ -237,7 +253,6 @@ #define ACPI_IVRS8C_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8C,f) #define ACPI_LPITH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_HEADER,f) #define ACPI_LPIT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_NATIVE,f) -#define ACPI_LPIT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_IO,f) #define ACPI_MADT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f) #define ACPI_MADT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_IO_APIC,f) #define ACPI_MADT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f) @@ -253,6 +268,7 @@ #define ACPI_MADT12_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_DISTRIBUTOR,f) #define ACPI_MADT13_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_MSI_FRAME,f) #define ACPI_MADT14_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_REDISTRIBUTOR,f) +#define ACPI_MADT15_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_TRANSLATOR,f) #define ACPI_MADTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_MCFG0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) #define ACPI_MPST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_NODE,f) @@ -262,6 +278,14 @@ #define ACPI_MPST2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_DATA,f) #define ACPI_MSCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) #define ACPI_MTMR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MTMR_ENTRY,f) +#define ACPI_NFITH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_HEADER,f) +#define ACPI_NFIT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_SYSTEM_ADDRESS,f) +#define ACPI_NFIT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_MEMORY_MAP,f) +#define ACPI_NFIT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_INTERLEAVE,f) +#define ACPI_NFIT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_SMBIOS,f) +#define ACPI_NFIT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_CONTROL_REGION,f) +#define ACPI_NFIT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_DATA_REGION,f) +#define ACPI_NFIT6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_FLUSH_ADDRESS,f) #define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f) #define ACPI_PCCT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED,f) #define ACPI_PMTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f) @@ -288,6 +312,8 @@ /* Flags */ +#define ACPI_DRTM_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_DRTM,f,o) +#define ACPI_DRTM1a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_DRTM_RESOURCE,f,o) #define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FADT,f,o) #define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FACS,f,o) #define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o) @@ -298,6 +324,9 @@ #define ACPI_GTDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_GTDT,f,o) #define ACPI_GTDT0a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_TIMER_ENTRY,f,o) #define ACPI_GTDT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_WATCHDOG,f,o) +#define ACPI_IORT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU,f,o) +#define ACPI_IORTA_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_MEMORY_ACCESS,f,o) +#define ACPI_IORTM_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_ID_MAPPING,f,o) #define ACPI_LPITH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_LPIT_HEADER,f,o) #define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o) #define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o) @@ -312,6 +341,9 @@ #define ACPI_MADT13_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GENERIC_MSI_FRAME,f,o) #define ACPI_MPST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MPST_POWER_NODE,f,o) #define ACPI_MPST2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MPST_POWER_DATA,f,o) +#define ACPI_NFIT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_SYSTEM_ADDRESS,f,o) +#define ACPI_NFIT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_MEMORY_MAP,f,o) +#define ACPI_NFIT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_CONTROL_REGION,f,o) #define ACPI_PCCT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_PCCT,f,o) #define ACPI_PCCT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED,f,o) #define ACPI_PMTTH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PMTT_HEADER,f,o) @@ -562,6 +594,14 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[] = ACPI_DMT_TERMINATOR }; +/* ACPI 6.0 Extensions (FADT version 6) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoFadt6[] = +{ + {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (HypervisorId), "Hypervisor ID", 0}, + ACPI_DMT_TERMINATOR +}; + /* * Remaining tables are not consumed directly by the ACPICA subsystem @@ -752,7 +792,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] = ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[] = { - {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (Length), "Length", 0}, + {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (Length), "Length", DT_LENGTH}, {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (VendorId), "Vendor ID", 0}, {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (SubvendorId), "Subvendor ID", 0}, {ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (DeviceId), "Device ID", 0}, @@ -787,13 +827,19 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[] = ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2[] = { - {ACPI_DMT_UINT32, ACPI_CSRT2_OFFSET (Length), "Length", 0}, + {ACPI_DMT_UINT32, ACPI_CSRT2_OFFSET (Length), "Length", DT_LENGTH}, {ACPI_DMT_UINT16, ACPI_CSRT2_OFFSET (Type), "Type", 0}, {ACPI_DMT_UINT16, ACPI_CSRT2_OFFSET (Subtype), "Subtype", 0}, {ACPI_DMT_UINT32, ACPI_CSRT2_OFFSET (Uid), "UID", 0}, ACPI_DMT_TERMINATOR }; +ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2a[] = +{ + {ACPI_DMT_RAW_BUFFER, 0, "ResourceInfo", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + /******************************************************************************* * @@ -849,7 +895,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Name[] = ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2OemData[] = { - {ACPI_DMT_BUFFER, 0, "OEM Data", DT_OPTIONAL}, + {ACPI_DMT_RAW_BUFFER, 0, "OEM Data", DT_OPTIONAL}, ACPI_DMT_TERMINATOR }; @@ -967,7 +1013,54 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar4[] = ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm[] = { + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (EntryBaseAddress), "Entry Base Address", 0}, + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (EntryLength), "Entry Length", 0}, + {ACPI_DMT_UINT32, ACPI_DRTM_OFFSET (EntryAddress32), "Entry 32", 0}, + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (EntryAddress64), "Entry 64", 0}, + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (ExitAddress), "Exit Address", 0}, + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (LogAreaAddress), "Log Area Start", 0}, + {ACPI_DMT_UINT32, ACPI_DRTM_OFFSET (LogAreaLength), "Log Area Length", 0}, + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (ArchDependentAddress), "Arch Dependent Address", 0}, + {ACPI_DMT_UINT32, ACPI_DRTM_OFFSET (Flags), "Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_DRTM_FLAG_OFFSET (Flags, 0), "Namespace in TCB", 0}, + {ACPI_DMT_FLAG1, ACPI_DRTM_FLAG_OFFSET (Flags, 0), "Gap Code on S3 Resume", 0}, + {ACPI_DMT_FLAG2, ACPI_DRTM_FLAG_OFFSET (Flags, 0), "Gap Code on DLME_Exit", 0}, + {ACPI_DMT_FLAG3, ACPI_DRTM_FLAG_OFFSET (Flags, 0), "PCR_Authorities Changed", 0}, + ACPI_DMT_TERMINATOR +}; +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm0[] = +{ + {ACPI_DMT_UINT32, ACPI_DRTM0_OFFSET (ValidatedTableCount), "Validated Table Count", DT_COUNT}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm0a[] = +{ + {ACPI_DMT_UINT64, 0, "Table Address", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm1[] = +{ + {ACPI_DMT_UINT32, ACPI_DRTM1_OFFSET (ResourceCount), "Resource Count", DT_COUNT}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm1a[] = +{ + {ACPI_DMT_UINT56, ACPI_DRTM1a_OFFSET (Size[0]), "Size", DT_OPTIONAL}, + {ACPI_DMT_UINT8, ACPI_DRTM1a_OFFSET (Type), "Type", 0}, + {ACPI_DMT_FLAG0, ACPI_DRTM1a_FLAG_OFFSET (Type, 0), "Resource Type", 0}, + {ACPI_DMT_FLAG7, ACPI_DRTM1a_FLAG_OFFSET (Type, 0), "Protections", 0}, + {ACPI_DMT_UINT64, ACPI_DRTM1a_OFFSET (Address), "Address", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm2[] = +{ + {ACPI_DMT_UINT32, ACPI_DRTM2_OFFSET (DpsIdLength), "DLME Platform Id Length", DT_COUNT}, + {ACPI_DMT_BUF16, ACPI_DRTM2_OFFSET (DpsId), "DLME Platform Id", DT_COUNT}, ACPI_DMT_TERMINATOR }; @@ -1374,6 +1467,148 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] = /******************************************************************************* * + * IORT - IO Remapping Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIort[] = +{ + {ACPI_DMT_UINT32, ACPI_IORT_OFFSET (NodeCount), "Node Count", 0}, + {ACPI_DMT_UINT32, ACPI_IORT_OFFSET (NodeOffset), "Node Offset", 0}, + {ACPI_DMT_UINT32, ACPI_IORT_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Optional padding field */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIortPad[] = +{ + {ACPI_DMT_RAW_BUFFER, 0, "Optional Padding", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +/* Common Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIortHdr[] = +{ + {ACPI_DMT_UINT8, ACPI_IORTH_OFFSET (Type), "Type", 0}, + {ACPI_DMT_UINT16, ACPI_IORTH_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT8, ACPI_IORTH_OFFSET (Revision), "Revision", 0}, + {ACPI_DMT_UINT32, ACPI_IORTH_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_IORTH_OFFSET (MappingCount), "Mapping Count", 0}, + {ACPI_DMT_UINT32, ACPI_IORTH_OFFSET (MappingOffset), "Mapping Offset", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoIortMap[] = +{ + {ACPI_DMT_UINT32, ACPI_IORTM_OFFSET (InputBase), "Input base", DT_OPTIONAL}, + {ACPI_DMT_UINT32, ACPI_IORTM_OFFSET (IdCount), "ID Count", 0}, + {ACPI_DMT_UINT32, ACPI_IORTM_OFFSET (OutputBase), "Output Base", 0}, + {ACPI_DMT_UINT32, ACPI_IORTM_OFFSET (OutputReference), "Output Reference", 0}, + {ACPI_DMT_UINT32, ACPI_IORTM_OFFSET (Flags), "Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_IORTM_FLAG_OFFSET (Flags, 0), "Single Mapping", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoIortAcc[] = +{ + {ACPI_DMT_UINT32, ACPI_IORTA_OFFSET (CacheCoherency), "Cache Coherency", 0}, + {ACPI_DMT_UINT8, ACPI_IORTA_OFFSET (Hints), "Hints (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_IORTA_FLAG_OFFSET (Hints, 0), "Transient", 0}, + {ACPI_DMT_FLAG1, ACPI_IORTA_FLAG_OFFSET (Hints, 0), "Write Allocate", 0}, + {ACPI_DMT_FLAG2, ACPI_IORTA_FLAG_OFFSET (Hints, 0), "Read Allocate", 0}, + {ACPI_DMT_FLAG3, ACPI_IORTA_FLAG_OFFSET (Hints, 0), "Override", 0}, + {ACPI_DMT_UINT16, ACPI_IORTA_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_IORTA_OFFSET (MemoryFlags), "Memory Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_IORTA_FLAG_OFFSET (MemoryFlags, 0), "Coherency", 0}, + {ACPI_DMT_FLAG1, ACPI_IORTA_FLAG_OFFSET (MemoryFlags, 0), "Device Attribute", 0}, + ACPI_DMT_TERMINATOR +}; + +/* IORT subtables */ + +/* 0x00: ITS Group */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIort0[] = +{ + {ACPI_DMT_UINT32, ACPI_IORT0_OFFSET (ItsCount), "ItsCount", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoIort0a[] = +{ + {ACPI_DMT_UINT32, 0, "Identifiers", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +/* 0x01: Named Component */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIort1[] = +{ + {ACPI_DMT_UINT32, ACPI_IORT1_OFFSET (NodeFlags), "Node Flags", 0}, + {ACPI_DMT_IORTMEM, ACPI_IORT1_OFFSET (MemoryProperties), "Memory Properties", 0}, + {ACPI_DMT_UINT8, ACPI_IORT1_OFFSET (MemoryAddressLimit), "Memory Size Limit", 0}, + {ACPI_DMT_STRING, ACPI_IORT1_OFFSET (DeviceName[0]), "Device Name", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoIort1a[] = +{ + {ACPI_DMT_RAW_BUFFER, 0, "Padding", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +/* 0x02: PCI Root Complex */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIort2[] = +{ + {ACPI_DMT_IORTMEM, ACPI_IORT2_OFFSET (MemoryProperties), "Memory Properties", 0}, + {ACPI_DMT_UINT32, ACPI_IORT2_OFFSET (AtsAttribute), "ATS Attribute", 0}, + {ACPI_DMT_UINT32, ACPI_IORT2_OFFSET (PciSegmentNumber), "PCI Segment Number", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 0x03: SMMUv1/2 */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIort3[] = +{ + {ACPI_DMT_UINT64, ACPI_IORT3_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT64, ACPI_IORT3_OFFSET (Span), "Span", 0}, + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (Model), "Model", 0}, + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (Flags), "Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_IORT3_FLAG_OFFSET (Flags, 0), "DVM Supported", 0}, + {ACPI_DMT_FLAG1, ACPI_IORT3_FLAG_OFFSET (Flags, 0), "Coherent Walk", 0}, + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (GlobalInterruptOffset), "Global Interrupt Offset", 0}, + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (ContextInterruptCount), "Context Interrupt Count", 0}, + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (ContextInterruptOffset), "Context Interrupt Offset", 0}, + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (PmuInterruptCount), "PMU Interrupt Count", 0}, + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (PmuInterruptOffset), "PMU Interrupt Offset", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoIort3a[] = +{ + {ACPI_DMT_UINT64, 0, "SMMU_NSgIrpt Interrupt", 0}, + {ACPI_DMT_UINT64, 0, "SMMU_NSgCfgIrpt Interrupt", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoIort3b[] = +{ + {ACPI_DMT_UINT64, 0, "Context Interrupt", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoIort3c[] = +{ + {ACPI_DMT_UINT64, 0, "PMU Interrupt", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * * IVRS - I/O Virtualization Reporting Structure * ******************************************************************************/ @@ -1504,22 +1739,6 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoLpit0[] = ACPI_DMT_TERMINATOR }; -/* 1: Simple I/O */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoLpit1[] = -{ - {ACPI_DMT_GAS, ACPI_LPIT1_OFFSET (EntryTrigger), "Entry Trigger", 0}, - {ACPI_DMT_UINT32, ACPI_LPIT1_OFFSET (TriggerAction), "Trigger Action", 0}, - {ACPI_DMT_UINT64, ACPI_LPIT1_OFFSET (TriggerValue), "Trigger Value", 0}, - {ACPI_DMT_UINT64, ACPI_LPIT1_OFFSET (TriggerMask), "Trigger Mask", 0}, - {ACPI_DMT_GAS, ACPI_LPIT1_OFFSET (MinimumIdleState), "Minimum Idle State", 0}, - {ACPI_DMT_UINT32, ACPI_LPIT1_OFFSET (Residency), "Residency", 0}, - {ACPI_DMT_UINT32, ACPI_LPIT1_OFFSET (Latency), "Latency", 0}, - {ACPI_DMT_GAS, ACPI_LPIT1_OFFSET (ResidencyCounter), "Residency Counter", 0}, - {ACPI_DMT_UINT64, ACPI_LPIT1_OFFSET (CounterFrequency), "Counter Frequency", 0}, - ACPI_DMT_TERMINATOR -}; - /******************************************************************************* * @@ -1701,6 +1920,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[] = {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (VgicInterrupt), "Virtual GIC Interrupt", 0}, {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (GicrBaseAddress), "Redistributor Base Address", 0}, {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (ArmMpidr), "ARM MPIDR", 0}, + {ACPI_DMT_UINT8, ACPI_MADT11_OFFSET (EfficiencyClass), "Efficiency Class", 0}, + {ACPI_DMT_UINT24, ACPI_MADT11_OFFSET (Reserved2[0]), "Reserved", 0}, ACPI_DMT_TERMINATOR }; @@ -1712,7 +1933,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[] = {ACPI_DMT_UINT32, ACPI_MADT12_OFFSET (GicId), "Local GIC Hardware ID", 0}, {ACPI_DMT_UINT64, ACPI_MADT12_OFFSET (BaseAddress), "Base Address", 0}, {ACPI_DMT_UINT32, ACPI_MADT12_OFFSET (GlobalIrqBase), "Interrupt Base", 0}, - {ACPI_DMT_UINT32, ACPI_MADT12_OFFSET (Reserved2), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_MADT12_OFFSET (Version), "Version", 0}, + {ACPI_DMT_UINT24, ACPI_MADT12_OFFSET (Reserved2[0]), "Reserved", 0}, ACPI_DMT_TERMINATOR }; @@ -1740,6 +1962,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt14[] = ACPI_DMT_TERMINATOR }; +/* 15: Generic Translator (ACPI 6.0) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoMadt15[] = +{ + {ACPI_DMT_UINT16, ACPI_MADT15_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_MADT15_OFFSET (TranslationId), "Translation ID", 0}, + {ACPI_DMT_UINT64, ACPI_MADT15_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT32, ACPI_MADT15_OFFSET (Reserved2), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; /******************************************************************************* * @@ -1922,6 +2154,156 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr0[] = /******************************************************************************* * + * NFIT - NVDIMM Firmware Interface Table and Subtables - (ACPI 6.0) + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit[] = +{ + {ACPI_DMT_UINT32, ACPI_NFIT_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Common Subtable header */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfitHdr[] = +{ + {ACPI_DMT_NFIT, ACPI_NFITH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT16, ACPI_NFITH_OFFSET (Length), "Length", DT_LENGTH}, + ACPI_DMT_TERMINATOR +}; + +/* 0: System Physical Address Range Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit0[] = +{ + {ACPI_DMT_UINT16, ACPI_NFIT0_OFFSET (RangeIndex), "Range Index", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_NFIT0_FLAG_OFFSET (Flags,0), "Add/Online Operation Only", 0}, + {ACPI_DMT_FLAG1, ACPI_NFIT0_FLAG_OFFSET (Flags,0), "Proximity Domain Valid", 0}, + {ACPI_DMT_UINT32, ACPI_NFIT0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_NFIT0_OFFSET (ProximityDomain), "Proximity Domain", 0}, + {ACPI_DMT_UUID, ACPI_NFIT0_OFFSET (RangeGuid[0]), "Address Range GUID", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT0_OFFSET (Address), "Address Range Base", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT0_OFFSET (Length), "Address Range Length", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT0_OFFSET (MemoryMapping), "Memory Map Attribute", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 1: Memory Device to System Address Range Map Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit1[] = +{ + {ACPI_DMT_UINT32, ACPI_NFIT1_OFFSET (DeviceHandle), "Device Handle", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (PhysicalId), "Physical Id", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (RegionId), "Region Id", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (RangeIndex), "Range Index", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (RegionIndex), "Control Region Index", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT1_OFFSET (RegionSize), "Region Size", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT1_OFFSET (RegionOffset), "Region Offset", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT1_OFFSET (Address), "Address Region Base", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (InterleaveIndex), "Interleave Index", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (InterleaveWays), "Interleave Ways", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (Flags), "Flags", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Save to device failed", 0}, + {ACPI_DMT_FLAG1, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Restore from device failed", 0}, + {ACPI_DMT_FLAG2, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Platform flush failed", 0}, + {ACPI_DMT_FLAG3, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Device not armed", 0}, + {ACPI_DMT_FLAG4, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Health events observed", 0}, + {ACPI_DMT_FLAG5, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Health events enabled", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 2: Interleave Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit2[] = +{ + {ACPI_DMT_UINT16, ACPI_NFIT2_OFFSET (InterleaveIndex), "Interleave Index", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT2_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_NFIT2_OFFSET (LineCount), "Line Count", 0}, + {ACPI_DMT_UINT32, ACPI_NFIT2_OFFSET (LineSize), "Line Size", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit2a[] = +{ + {ACPI_DMT_UINT32, 0, "Line Offset", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +/* 3: SMBIOS Management Information Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit3[] = +{ + {ACPI_DMT_UINT32, ACPI_NFIT3_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit3a[] = +{ + {ACPI_DMT_RAW_BUFFER, 0, "SMBIOS Table Entries", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +/* 4: NVDIMM Control Region Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit4[] = +{ + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (RegionIndex), "Region Index", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (VendorId), "Vendor Id", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (DeviceId), "Device Id", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (RevisionId), "Revision Id", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (SubsystemVendorId), "Subsystem Vendor Id", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (SubsystemDeviceId), "Subsystem Device Id", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (SubsystemRevisionId), "Subsystem Revision Id", 0}, + {ACPI_DMT_UINT48, ACPI_NFIT4_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_NFIT4_OFFSET (SerialNumber), "Serial Number", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (Code), "Code", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (Windows), "Window Count", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT4_OFFSET (WindowSize), "Window Size", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT4_OFFSET (CommandOffset), "Command Offset", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT4_OFFSET (CommandSize), "Command Size", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT4_OFFSET (StatusOffset), "Status Offset", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT4_OFFSET (StatusSize), "Status Size", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (Flags), "Flags", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_NFIT4_FLAG_OFFSET (Flags,0), "Windows buffered", 0}, + {ACPI_DMT_UINT48, ACPI_NFIT4_OFFSET (Reserved1[0]), "Reserved1", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 5: NVDIMM Block Data Window Region Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit5[] = +{ + {ACPI_DMT_UINT16, ACPI_NFIT5_OFFSET (RegionIndex), "Region Index", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT5_OFFSET (Windows), "Window Count", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT5_OFFSET (Offset), "Offset", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT5_OFFSET (Size), "Size", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT5_OFFSET (Capacity), "Capacity", 0}, + {ACPI_DMT_UINT64, ACPI_NFIT5_OFFSET (StartAddress), "Start Address", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 6: Flush Hint Address Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6[] = +{ + {ACPI_DMT_UINT32, ACPI_NFIT6_OFFSET (DeviceHandle), "Device Handle", 0}, + {ACPI_DMT_UINT16, ACPI_NFIT6_OFFSET (HintCount), "Hint Count", 0}, + {ACPI_DMT_UINT48, ACPI_NFIT6_OFFSET (Reserved[0]), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[] = +{ + {ACPI_DMT_UINT64, 0, "Hint Address", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * * PCCT - Platform Communications Channel Table (ACPI 5.0) * ******************************************************************************/ @@ -2282,6 +2664,25 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[] = /******************************************************************************* * + * STAO - Status Override Table (_STA override) - ACPI 6.0 + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoStao[] = +{ + {ACPI_DMT_UINT8, ACPI_STAO_OFFSET (IgnoreUart), "Ignore UART", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[] = +{ + {ACPI_DMT_STRING, 0, "Namepath", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * * TCPA - Trusted Computing Platform Alliance table * ******************************************************************************/ @@ -2460,6 +2861,49 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] = ACPI_DMT_TERMINATOR }; + +/******************************************************************************* + * + * WPBT - Windows Platform Environment Table (ACPI 6.0) + * Version 1 + * + * Conforms to "Windows Platform Binary Table (WPBT)" 29 November 2011 + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt[] = +{ + {ACPI_DMT_UINT32, ACPI_WPBT_OFFSET (HandoffSize), "Handoff Size", 0}, + {ACPI_DMT_UINT64, ACPI_WPBT_OFFSET (HandoffAddress), "Handoff Address", 0}, + {ACPI_DMT_UINT8, ACPI_WPBT_OFFSET (Layout), "Layout", 0}, + {ACPI_DMT_UINT8, ACPI_WPBT_OFFSET (Type), "Type", 0}, + {ACPI_DMT_UINT16, ACPI_WPBT_OFFSET (ArgumentsLength), "Arguments Length", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt0[] = +{ + {ACPI_DMT_UNICODE, sizeof (ACPI_TABLE_WPBT), "Command-line Arguments", 0}, + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * + * XENV - Xen Environment table (ACPI 6.0) + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoXenv[] = +{ + {ACPI_DMT_UINT64, ACPI_XENV_OFFSET (GrantTableAddress), "Grant Table Address", 0}, + {ACPI_DMT_UINT64, ACPI_XENV_OFFSET (GrantTableSize), "Grant Table Size", 0}, + {ACPI_DMT_UINT32, ACPI_XENV_OFFSET (EventInterrupt), "Event Interrupt", 0}, + {ACPI_DMT_UINT8, ACPI_XENV_OFFSET (EventFlags), "Event Flags", 0}, + ACPI_DMT_TERMINATOR +}; + + /*! [Begin] no source code translation */ /* diff --git a/src/acpica/source/compiler/aslascii.c b/src/acpica/source/compiler/aslascii.c index 9a4e127..b858a38 100644 --- a/src/acpica/source/compiler/aslascii.c +++ b/src/acpica/source/compiler/aslascii.c @@ -220,8 +220,7 @@ FlCheckForAcpiTable ( * * FUNCTION: FlCheckForAscii * - * PARAMETERS: Handle - Open input file - * Filename - Input filename + * PARAMETERS: Filename - Full input filename * DisplayErrors - TRUE if error messages desired * * RETURN: Status @@ -237,7 +236,6 @@ FlCheckForAcpiTable ( ACPI_STATUS FlCheckForAscii ( - FILE *Handle, char *Filename, BOOLEAN DisplayErrors) { @@ -245,7 +243,12 @@ FlCheckForAscii ( ACPI_SIZE BadBytes = 0; BOOLEAN OpeningComment = FALSE; ASL_FILE_STATUS Status; + FILE *Handle; + + + /* Open file in text mode so file offset is always accurate */ + Handle = fopen (Filename, "rb"); Status.Line = 1; Status.Offset = 0; @@ -286,16 +289,30 @@ FlCheckForAscii ( if ((BadBytes < 10) && (DisplayErrors)) { AcpiOsPrintf ( - "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n", + "Found non-ASCII character in source text: " + "0x%2.2X in line %u, file offset 0x%2.2X\n", Byte, Status.Line, Status.Offset); } + BadBytes++; + } + /* Ensure character is either printable or a "space" char */ + + else if (!ACPI_IS_PRINT (Byte) && !ACPI_IS_SPACE (Byte)) + { + if ((BadBytes < 10) && (DisplayErrors)) + { + AcpiOsPrintf ( + "Found invalid character in source text: " + "0x%2.2X in line %u, file offset 0x%2.2X\n", + Byte, Status.Line, Status.Offset); + } BadBytes++; } - /* Update line counter */ + /* Update line counter as necessary */ - else if (Byte == 0x0A) + if (Byte == 0x0A) { Status.Line++; } @@ -303,9 +320,7 @@ FlCheckForAscii ( Status.Offset++; } - /* Seek back to the beginning of the source file */ - - fseek (Handle, 0, SEEK_SET); + fclose (Handle); /* Were there any non-ASCII characters in the file? */ @@ -314,8 +329,8 @@ FlCheckForAscii ( if (DisplayErrors) { AcpiOsPrintf ( - "%u non-ASCII characters found in input source text, could be a binary file\n", - BadBytes); + "Total %u invalid characters found in input source text, " + "could be a binary file\n", BadBytes); AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, Filename); } @@ -358,6 +373,7 @@ FlConsumeAnsiComment ( { if (Byte == '/') { + Status->Offset++; return; } diff --git a/src/acpica/source/compiler/aslcompiler.h b/src/acpica/source/compiler/aslcompiler.h index 68042b2..5c78095 100644 --- a/src/acpica/source/compiler/aslcompiler.h +++ b/src/acpica/source/compiler/aslcompiler.h @@ -244,7 +244,6 @@ FlCheckForAcpiTable ( ACPI_STATUS FlCheckForAscii ( - FILE *Handle, char *Filename, BOOLEAN DisplayErrors); diff --git a/src/acpica/source/compiler/aslcompiler.l b/src/acpica/source/compiler/aslcompiler.l index 53332d8..56df646 100644 --- a/src/acpica/source/compiler/aslcompiler.l +++ b/src/acpica/source/compiler/aslcompiler.l @@ -781,9 +781,18 @@ NamePathTail [.]{NameSeg} return (PARSEOP_NAMESTRING); } . { count (1); - sprintf (MsgBuffer, - "Invalid character (0x%2.2X), expecting ASL keyword or name", - *AslCompilertext); + if (ACPI_IS_PRINT (*AslCompilertext)) + { + sprintf (MsgBuffer, + "Invalid character (%c), expecting ASL keyword or name", + *AslCompilertext); + } + else + { + sprintf (MsgBuffer, + "Invalid character (0x%2.2X), expecting ASL keyword or name", + *AslCompilertext); + } AslCompilererror (MsgBuffer);} <> { if (AslPopInputFileStack ()) diff --git a/src/acpica/source/compiler/asldefine.h b/src/acpica/source/compiler/asldefine.h index 57f2ef4..7d34da8 100644 --- a/src/acpica/source/compiler/asldefine.h +++ b/src/acpica/source/compiler/asldefine.h @@ -125,7 +125,7 @@ #define ASL_INVOCATION_NAME "iasl" #define ASL_CREATOR_ID "INTL" -#define ASL_COMPLIANCE "Supports ACPI Specification Revision 5.1" +#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.0" /* Configuration constants */ diff --git a/src/acpica/source/compiler/aslfiles.c b/src/acpica/source/compiler/aslfiles.c index 39f6319..7443776 100644 --- a/src/acpica/source/compiler/aslfiles.c +++ b/src/acpica/source/compiler/aslfiles.c @@ -121,9 +121,10 @@ /* Local prototypes */ -FILE * +static FILE * FlOpenIncludeWithPrefix ( char *PrefixDir, + ACPI_PARSE_OBJECT *Op, char *Filename); @@ -366,9 +367,10 @@ ConvertBackslashes: * ******************************************************************************/ -FILE * +static FILE * FlOpenIncludeWithPrefix ( char *PrefixDir, + ACPI_PARSE_OBJECT *Op, char *Filename) { FILE *IncludeFile; @@ -392,6 +394,26 @@ FlOpenIncludeWithPrefix ( return (NULL); } +#ifdef _MUST_HANDLE_COMMENTS + /* + * Check entire include file for any # preprocessor directives. + * This is because there may be some confusion between the #include + * preprocessor directive and the ASL Include statement. + */ + while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, IncludeFile)) + { + if (Gbl_CurrentLineBuffer[0] == '#') + { + AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE, + Op, "use #include instead"); + } + } +#endif + + /* Must seek back to the start of the file */ + + fseek (IncludeFile, 0, SEEK_SET); + /* Push the include file on the open input file stack */ AslPushInputFileStack (IncludeFile, Pathname); @@ -448,7 +470,7 @@ FlOpenIncludeFile ( (Op->Asl.Value.String[0] == '\\') || (Op->Asl.Value.String[1] == ':')) { - IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String); + IncludeFile = FlOpenIncludeWithPrefix ("", Op, Op->Asl.Value.String); if (!IncludeFile) { goto ErrorExit; @@ -464,7 +486,7 @@ FlOpenIncludeFile ( * * Construct the file pathname from the global directory name. */ - IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String); + IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op, Op->Asl.Value.String); if (IncludeFile) { return; @@ -477,7 +499,7 @@ FlOpenIncludeFile ( NextDir = Gbl_IncludeDirList; while (NextDir) { - IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String); + IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op, Op->Asl.Value.String); if (IncludeFile) { return; diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c index 4ea71de..6e332f1 100644 --- a/src/acpica/source/compiler/aslmessages.c +++ b/src/acpica/source/compiler/aslmessages.c @@ -342,7 +342,8 @@ const char *AslPreprocessorMsgs [] = /* ASL_MSG_TOO_MANY_ARGUMENTS */ "Too many macro arguments", /* ASL_MSG_UNKNOWN_DIRECTIVE */ "Unknown directive", /* ASL_MSG_UNKNOWN_PRAGMA */ "Unknown pragma", -/* ASL_MSG_WARNING_DIRECTIVE */ "#warning" +/* ASL_MSG_WARNING_DIRECTIVE */ "#warning", +/* ASL_MSG_INCLUDE_FILE */ "Found a # preprocessor directive in ASL Include() file" }; @@ -403,7 +404,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs)) { - return ("[Unknown Preprocesor exception ID]"); + return ("[Unknown Preprocessor exception ID]"); } } diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h index 12fe9d9..7501bbb 100644 --- a/src/acpica/source/compiler/aslmessages.h +++ b/src/acpica/source/compiler/aslmessages.h @@ -339,6 +339,7 @@ typedef enum ASL_MSG_UNKNOWN_DIRECTIVE, ASL_MSG_UNKNOWN_PRAGMA, ASL_MSG_WARNING_DIRECTIVE, + ASL_MSG_INCLUDE_FILE } ASL_MESSAGE_IDS; diff --git a/src/acpica/source/compiler/aslprepkg.c b/src/acpica/source/compiler/aslprepkg.c index 6b27e91..6a74e88 100644 --- a/src/acpica/source/compiler/aslprepkg.c +++ b/src/acpica/source/compiler/aslprepkg.c @@ -223,6 +223,7 @@ ApCheckPackage ( case ACPI_PTYPE2_FIXED: case ACPI_PTYPE2_MIN: case ACPI_PTYPE2_FIX_VAR: + case ACPI_PTYPE2_VAR_VAR: default: break; @@ -396,6 +397,32 @@ ApCheckPackage ( break; + case ACPI_PTYPE2_VAR_VAR: + + /* Check for minimum size (ints at beginning + 1 subpackage) */ + + ExpectedCount = Package->RetInfo4.Count1 + 1; + if (Count < ExpectedCount) + { + goto PackageTooSmall; + } + + /* Check the non-package elements at beginning of main package */ + + for (i = 0; i < Package->RetInfo4.Count1; ++i) + { + Status = ApCheckObjectType (Predefined->Info.Name, Op, + Package->RetInfo4.ObjectType1, i); + Op = Op->Asl.Next; + } + + /* Examine the variable-length list of subpackages */ + + ApCheckPackageList (Predefined->Info.Name, Op, + Package, Package->RetInfo4.Count1, Count); + + break; + case ACPI_PTYPE2: case ACPI_PTYPE2_FIXED: case ACPI_PTYPE2_MIN: @@ -499,6 +526,7 @@ ApCheckPackageElements ( * ACPI_PTYPE2_MIN * ACPI_PTYPE2_COUNT * ACPI_PTYPE2_FIX_VAR + * ACPI_PTYPE2_VAR_VAR * ******************************************************************************/ @@ -545,9 +573,12 @@ ApCheckPackageList ( Count = (UINT32) Op->Asl.Value.Integer; Op = Op->Asl.Next; - /* The subpackage must have at least one element */ - - if (!Count) + /* + * Most subpackage must have at least one element, with + * only rare exceptions. (_RDI) + */ + if (!Count && + (Package->RetInfo.Type != ACPI_PTYPE2_VAR_VAR)) { ApZeroLengthPackage (PredefinedName, SubPackageOp); goto NextSubpackage; @@ -605,6 +636,25 @@ ApCheckPackageList ( Count - Package->RetInfo.Count1); break; + case ACPI_PTYPE2_VAR_VAR: + /* + * Must have at least the minimum number elements. + * A zero PkgCount means the number of elements is variable. + */ + ExpectedCount = Package->RetInfo4.PkgCount; + if (ExpectedCount && (Count < ExpectedCount)) + { + ApPackageTooSmall (PredefinedName, SubPackageOp, + Count, 1); + break; + } + + ApCheckPackageElements (PredefinedName, Op, + Package->RetInfo4.SubObjectTypes, + Package->RetInfo4.PkgCount, + 0, 0); + break; + case ACPI_PTYPE2_FIXED: /* Each subpackage has a fixed length */ diff --git a/src/acpica/source/compiler/aslstartup.c b/src/acpica/source/compiler/aslstartup.c index 9e6d7b3..5cc0959 100644 --- a/src/acpica/source/compiler/aslstartup.c +++ b/src/acpica/source/compiler/aslstartup.c @@ -231,10 +231,10 @@ AslDetectSourceFileType ( /* Check for 100% ASCII source file (comments are ignored) */ - Status = FlCheckForAscii (Info->Handle, Info->Filename, TRUE); + Status = FlCheckForAscii (Info->Filename, TRUE); if (ACPI_FAILURE (Status)) { - printf ("Non-ascii input file - %s\n", Info->Filename); + printf ("Invalid characters in input file - %s\n", Info->Filename); if (!Gbl_IgnoreErrors) { diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c index 843c097..a5e53c7 100644 --- a/src/acpica/source/compiler/aslutils.c +++ b/src/acpica/source/compiler/aslutils.c @@ -149,13 +149,11 @@ UtAttachNameseg ( * ******************************************************************************/ -#define ACPI_TABLE_HELP_FORMAT "%8u) %s %s\n" - void UtDisplaySupportedTables ( void) { - ACPI_DMTABLE_DATA *TableData; + const AH_TABLE *TableData; UINT32 i; @@ -163,20 +161,14 @@ UtDisplaySupportedTables ( " (Compiler, Disassembler, Template Generator)\n\n", ACPI_CA_VERSION); - /* Special tables */ - - printf (" Special tables and AML tables:\n"); - printf (ACPI_TABLE_HELP_FORMAT, 1, ACPI_RSDP_NAME, "Root System Description Pointer"); - printf (ACPI_TABLE_HELP_FORMAT, 2, ACPI_SIG_FACS, "Firmware ACPI Control Structure"); - printf (ACPI_TABLE_HELP_FORMAT, 3, ACPI_SIG_DSDT, "Differentiated System Description Table"); - printf (ACPI_TABLE_HELP_FORMAT, 4, ACPI_SIG_SSDT, "Secondary System Description Table"); - - /* All data tables with common table header */ + /* All ACPI tables with the common table header */ - printf ("\n Standard ACPI data tables:\n"); - for (TableData = AcpiDmTableData, i = 5; TableData->Signature; TableData++, i++) + printf ("\n Supported ACPI tables:\n"); + for (TableData = AcpiSupportedTables, i = 1; + TableData->Signature; TableData++, i++) { - printf (ACPI_TABLE_HELP_FORMAT, i, TableData->Signature, TableData->Name); + printf ("%8u) %s %s\n", i, + TableData->Signature, TableData->Description); } } diff --git a/src/acpica/source/compiler/dtcompile.c b/src/acpica/source/compiler/dtcompile.c index 105151f..5c75f4b 100644 --- a/src/acpica/source/compiler/dtcompile.c +++ b/src/acpica/source/compiler/dtcompile.c @@ -355,7 +355,7 @@ static ACPI_STATUS DtCompileDataTable ( DT_FIELD **FieldList) { - ACPI_DMTABLE_DATA *TableData; + const ACPI_DMTABLE_DATA *TableData; DT_SUBTABLE *Subtable; char *Signature; ACPI_TABLE_HEADER *AcpiTableHeader; @@ -430,7 +430,7 @@ DtCompileDataTable ( TableData = AcpiDmGetTableData (Signature); if (!TableData || Gbl_CompileGeneric) { - DtCompileGeneric ((void **) FieldList); + DtCompileGeneric ((void **) FieldList, NULL, NULL); goto FinishHeader; } @@ -508,14 +508,14 @@ DtCompileTable ( DT_FIELD *LocalField; UINT32 Length; DT_SUBTABLE *Subtable; - DT_SUBTABLE *InlineSubtable; + DT_SUBTABLE *InlineSubtable = NULL; UINT32 FieldLength = 0; UINT8 FieldType; UINT8 *Buffer; UINT8 *FlagBuffer = NULL; char *String; UINT32 CurrentFlagByteOffset = 0; - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; if (!Field || !*Field) @@ -551,6 +551,7 @@ DtCompileTable ( Buffer = Subtable->Buffer; LocalField = *Field; + Subtable->Name = LocalField->Name; /* * Main loop walks the info table for this ACPI table or subtable @@ -627,15 +628,32 @@ DtCompileTable ( */ *Field = LocalField; - if (Info->Opcode == ACPI_DMT_GAS) + switch (Info->Opcode) { + case ACPI_DMT_GAS: + Status = DtCompileTable (Field, AcpiDmTableInfoGas, &InlineSubtable, TRUE); - } - else - { + break; + + case ACPI_DMT_HESTNTFY: + Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify, &InlineSubtable, TRUE); + break; + + case ACPI_DMT_IORTMEM: + + Status = DtCompileTable (Field, AcpiDmTableInfoIortAcc, + &InlineSubtable, TRUE); + break; + + default: + sprintf (MsgBuffer, "Invalid DMT opcode: 0x%.2X", + Info->Opcode); + DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); + Status = AE_BAD_DATA; + break; } if (ACPI_FAILURE (Status)) @@ -672,7 +690,6 @@ DtCompileTable ( Subtable->LengthField = Buffer; Subtable->SizeOfLengthField = FieldLength; } - break; } @@ -688,3 +705,43 @@ Error: ACPI_FREE (Subtable); return (Status); } + + +/****************************************************************************** + * + * FUNCTION: DtCompilePadding + * + * PARAMETERS: Length - Padding field size + * RetSubtable - Compile result of table + * + * RETURN: Status + * + * DESCRIPTION: Compile a subtable for padding purpose + * + *****************************************************************************/ + +ACPI_STATUS +DtCompilePadding ( + UINT32 Length, + DT_SUBTABLE **RetSubtable) +{ + DT_SUBTABLE *Subtable; + /* UINT8 *Buffer; */ + char *String; + + + Subtable = UtSubtableCacheCalloc (); + + if (Length > 0) + { + String = UtStringCacheCalloc (Length); + Subtable->Buffer = ACPI_CAST_PTR (UINT8, String); + } + + Subtable->Length = Length; + Subtable->TotalLength = Length; + /* Buffer = Subtable->Buffer; */ + + *RetSubtable = Subtable; + return (AE_OK); +} diff --git a/src/acpica/source/compiler/dtcompiler.h b/src/acpica/source/compiler/dtcompiler.h index e063770..499a2ad 100644 --- a/src/acpica/source/compiler/dtcompiler.h +++ b/src/acpica/source/compiler/dtcompiler.h @@ -187,6 +187,7 @@ typedef struct dt_subtable struct dt_subtable *StackTop; UINT8 *Buffer; UINT8 *LengthField; + char *Name; UINT32 Length; UINT32 TotalLength; UINT32 SizeOfLengthField; @@ -242,6 +243,11 @@ DtCompileTable ( DT_SUBTABLE **RetSubtable, BOOLEAN Required); +ACPI_STATUS +DtCompilePadding ( + UINT32 Length, + DT_SUBTABLE **RetSubtable); + /* dtio - binary and text input/output */ @@ -501,6 +507,10 @@ DtCompileDmar ( void **PFieldList); ACPI_STATUS +DtCompileDrtm ( + void **PFieldList); + +ACPI_STATUS DtCompileEinj ( void **PFieldList); @@ -525,6 +535,10 @@ DtCompileHest ( void **PFieldList); ACPI_STATUS +DtCompileIort ( + void **PFieldList); + +ACPI_STATUS DtCompileIvrs ( void **PFieldList); @@ -553,6 +567,10 @@ DtCompileMtmr ( void **PFieldList); ACPI_STATUS +DtCompileNfit ( + void **PFieldList); + +ACPI_STATUS DtCompilePmtt ( void **PFieldList); @@ -581,6 +599,10 @@ DtCompileSrat ( void **PFieldList); ACPI_STATUS +DtCompileStao ( + void **PFieldList); + +ACPI_STATUS DtCompileUefi ( void **PFieldList); @@ -593,12 +615,18 @@ DtCompileWdat ( void **PFieldList); ACPI_STATUS +DtCompileWpbt ( + void **PFieldList); + +ACPI_STATUS DtCompileXsdt ( void **PFieldList); ACPI_STATUS DtCompileGeneric ( - void **PFieldList); + void **PFieldList, + char *TermFieldName, + UINT32 *PFieldLength); ACPI_DMTABLE_INFO * DtGetGenericTableInfo ( @@ -615,6 +643,7 @@ extern const unsigned char TemplateCsrt[]; extern const unsigned char TemplateDbg2[]; extern const unsigned char TemplateDbgp[]; extern const unsigned char TemplateDmar[]; +extern const unsigned char TemplateDrtm[]; extern const unsigned char TemplateEcdt[]; extern const unsigned char TemplateEinj[]; extern const unsigned char TemplateErst[]; @@ -623,6 +652,7 @@ extern const unsigned char TemplateFpdt[]; extern const unsigned char TemplateGtdt[]; extern const unsigned char TemplateHest[]; extern const unsigned char TemplateHpet[]; +extern const unsigned char TemplateIort[]; extern const unsigned char TemplateIvrs[]; extern const unsigned char TemplateLpit[]; extern const unsigned char TemplateMadt[]; @@ -632,6 +662,7 @@ extern const unsigned char TemplateMpst[]; extern const unsigned char TemplateMsct[]; extern const unsigned char TemplateMsdm[]; extern const unsigned char TemplateMtmr[]; +extern const unsigned char TemplateNfit[]; extern const unsigned char TemplatePcct[]; extern const unsigned char TemplatePmtt[]; extern const unsigned char TemplateRsdt[]; @@ -642,6 +673,7 @@ extern const unsigned char TemplateSlit[]; extern const unsigned char TemplateSpcr[]; extern const unsigned char TemplateSpmi[]; extern const unsigned char TemplateSrat[]; +extern const unsigned char TemplateStao[]; extern const unsigned char TemplateTcpa[]; extern const unsigned char TemplateTpm2[]; extern const unsigned char TemplateUefi[]; @@ -650,6 +682,8 @@ extern const unsigned char TemplateWaet[]; extern const unsigned char TemplateWdat[]; extern const unsigned char TemplateWddt[]; extern const unsigned char TemplateWdrt[]; +extern const unsigned char TemplateWpbt[]; +extern const unsigned char TemplateXenv[]; extern const unsigned char TemplateXsdt[]; #endif diff --git a/src/acpica/source/compiler/dtio.c b/src/acpica/source/compiler/dtio.c index 111a6fa..9b044ee 100644 --- a/src/acpica/source/compiler/dtio.c +++ b/src/acpica/source/compiler/dtio.c @@ -1050,8 +1050,8 @@ DtDumpSubtableInfo ( { DbgPrint (ASL_DEBUG_OUTPUT, - "[%.04X] %.08X %.08X %.08X %.08X %.08X %p %p %p\n", - Subtable->Depth, Subtable->Length, Subtable->TotalLength, + "[%.04X] %24s %.08X %.08X %.08X %.08X %.08X %p %p %p\n", + Subtable->Depth, Subtable->Name, Subtable->Length, Subtable->TotalLength, Subtable->SizeOfLengthField, Subtable->Flags, Subtable, Subtable->Parent, Subtable->Child, Subtable->Peer); } @@ -1064,8 +1064,8 @@ DtDumpSubtableTree ( { DbgPrint (ASL_DEBUG_OUTPUT, - "[%.04X] %*s%08X (%.02X) - (%.02X)\n", - Subtable->Depth, (4 * Subtable->Depth), " ", + "[%.04X] %24s %*s%08X (%.02X) - (%.02X)\n", + Subtable->Depth, Subtable->Name, (4 * Subtable->Depth), " ", Subtable, Subtable->Length, Subtable->TotalLength); } @@ -1096,12 +1096,12 @@ DtDumpSubtableList ( DbgPrint (ASL_DEBUG_OUTPUT, "Subtable Info:\n" - "Depth Length TotalLen LenSize Flags " + "Depth Name Length TotalLen LenSize Flags " "This Parent Child Peer\n\n"); DtWalkTableTree (Gbl_RootTable, DtDumpSubtableInfo, NULL, NULL); DbgPrint (ASL_DEBUG_OUTPUT, - "\nSubtable Tree: (Depth, Subtable, Length, TotalLength)\n\n"); + "\nSubtable Tree: (Depth, Name, Subtable, Length, TotalLength)\n\n"); DtWalkTableTree (Gbl_RootTable, DtDumpSubtableTree, NULL, NULL); DbgPrint (ASL_DEBUG_OUTPUT, "\n"); diff --git a/src/acpica/source/compiler/dtsubtable.c b/src/acpica/source/compiler/dtsubtable.c index a35792d..2461cc2 100644 --- a/src/acpica/source/compiler/dtsubtable.c +++ b/src/acpica/source/compiler/dtsubtable.c @@ -393,6 +393,11 @@ DtGetSubtableLength ( Step = 9; break; + case ACPI_DMT_IORTMEM: + + Step = 10; + break; + default: Step = 1; diff --git a/src/acpica/source/compiler/dttable.c b/src/acpica/source/compiler/dttable.c index 85ffdad..db9ac24 100644 --- a/src/acpica/source/compiler/dttable.c +++ b/src/acpica/source/compiler/dttable.c @@ -137,12 +137,6 @@ static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] = }; -/* TBD: move to acmacros.h */ - -#define ACPI_SUB_PTR(t, a, b) \ - ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b))) - - /* Local prototypes */ static ACPI_STATUS @@ -526,6 +520,7 @@ DtCompileCsrt ( /* Subtables (Resource Groups) */ + ParentTable = DtPeekSubtable (); while (*PFieldList) { /* Resource group subtable */ @@ -549,9 +544,9 @@ DtCompileCsrt ( DescriptorCount = (GroupLength / sizeof (ACPI_CSRT_DESCRIPTOR)); - ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); /* Shared info subtable (One per resource group) */ @@ -562,26 +557,44 @@ DtCompileCsrt ( return (Status); } - ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); /* Sub-Subtables (Resource Descriptors) */ while (*PFieldList && DescriptorCount) { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2, &Subtable, TRUE); if (ACPI_FAILURE (Status)) { return (Status); } + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); ParentTable = DtPeekSubtable (); - DtInsertSubtable (ParentTable, Subtable); + if (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + } + } + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + DescriptorCount--; } DtPopSubtable (); + ParentTable = DtPeekSubtable (); } return (Status); @@ -900,6 +913,135 @@ DtCompileDmar ( /****************************************************************************** * + * FUNCTION: DtCompileDrtm + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile DRTM. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileDrtm ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + UINT32 Count; + /* ACPI_TABLE_DRTM *Drtm; */ + ACPI_DRTM_VTABLE_LIST *DrtmVtl; + ACPI_DRTM_RESOURCE_LIST *DrtmRl; + /* ACPI_DRTM_DPS_ID *DrtmDps; */ + + + ParentTable = DtPeekSubtable (); + + /* Compile DRTM header */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + + /* + * Using ACPI_SUB_PTR, We needn't define a seperate structure. Care + * should be taken to avoid accessing ACPI_TABLE_HADER fields. + */ +#if 0 + Drtm = ACPI_SUB_PTR (ACPI_TABLE_DRTM, + Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); +#endif + /* Compile VTL */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + DrtmVtl = ACPI_CAST_PTR (ACPI_DRTM_VTABLE_LIST, Subtable->Buffer); + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + Count = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + DrtmVtl->ValidatedTableCount = Count; + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + + /* Compile RL */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + DrtmRl = ACPI_CAST_PTR (ACPI_DRTM_RESOURCE_LIST, Subtable->Buffer); + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + Count = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + DrtmRl->ResourceCount = Count; + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + + /* Compile DPS */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + /* DrtmDps = ACPI_CAST_PTR (ACPI_DRTM_DPS_ID, Subtable->Buffer);*/ + + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileEinj * * PARAMETERS: List - Current field list pointer @@ -1018,6 +1160,18 @@ DtCompileFadt ( DtInsertSubtable (ParentTable, Subtable); } + + if (Revision >= 6) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt6, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + } } return (AE_OK); @@ -1357,6 +1511,309 @@ DtCompileHest ( /****************************************************************************** * + * FUNCTION: DtCompileIort + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile IORT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileIort ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_TABLE_IORT *Iort; + ACPI_IORT_NODE *IortNode; + ACPI_IORT_ITS_GROUP *IortItsGroup; + ACPI_IORT_SMMU *IortSmmu; + UINT32 NodeNumber; + UINT32 NodeLength; + UINT32 IdMappingNumber; + UINT32 ItsNumber; + UINT32 ContextIrptNumber; + UINT32 PmuIrptNumber; + UINT32 PaddingLength; + + + ParentTable = DtPeekSubtable (); + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + + /* + * Using ACPI_SUB_PTR, We needn't define a seperate structure. Care + * should be taken to avoid accessing ACPI_TABLE_HADER fields. + */ + Iort = ACPI_SUB_PTR (ACPI_TABLE_IORT, + Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); + + /* + * OptionalPadding - Variable-length data + * (Optional, size = OffsetToNodes - sizeof (ACPI_TABLE_IORT)) + * Optionally allows the generic data types to be used for filling + * this field. + */ + Iort->NodeOffset = sizeof (ACPI_TABLE_IORT); + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + Iort->NodeOffset += Subtable->Length; + } + else + { + Status = DtCompileGeneric (ACPI_CAST_PTR (void *, PFieldList), + AcpiDmTableInfoIortHdr[0].Name, &PaddingLength); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + Iort->NodeOffset += PaddingLength; + } + + NodeNumber = 0; + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + IortNode = ACPI_CAST_PTR (ACPI_IORT_NODE, Subtable->Buffer); + NodeLength = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); + + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); + + switch (IortNode->Type) + { + case ACPI_IORT_NODE_ITS_GROUP: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + IortItsGroup = ACPI_CAST_PTR (ACPI_IORT_ITS_GROUP, Subtable->Buffer); + NodeLength += Subtable->Length; + + ItsNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + ItsNumber++; + } + + IortItsGroup->ItsCount = ItsNumber; + break; + + case ACPI_IORT_NODE_NAMED_COMPONENT: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + + /* + * Padding - Variable-length data + * Optionally allows the offset of the ID mappings to be used + * for filling this field. + */ + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + } + else + { + if (NodeLength > IortNode->MappingOffset) + { + return (AE_BAD_DATA); + } + if (NodeLength < IortNode->MappingOffset) + { + Status = DtCompilePadding ( + IortNode->MappingOffset - NodeLength, + &Subtable); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength = IortNode->MappingOffset; + } + } + break; + + case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + break; + + case ACPI_IORT_NODE_SMMU: + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + IortSmmu = ACPI_CAST_PTR (ACPI_IORT_SMMU, Subtable->Buffer); + NodeLength += Subtable->Length; + + /* Compile global interrupt array */ + + IortSmmu->GlobalInterruptOffset = NodeLength; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + + /* Compile context interrupt array */ + + ContextIrptNumber = 0; + IortSmmu->ContextInterruptOffset = NodeLength; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + ContextIrptNumber++; + } + IortSmmu->ContextInterruptCount = ContextIrptNumber; + + /* Compile PMU interrupt array */ + + PmuIrptNumber = 0; + IortSmmu->PmuInterruptOffset = NodeLength; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += Subtable->Length; + PmuIrptNumber++; + } + IortSmmu->PmuInterruptCount = PmuIrptNumber; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IORT"); + return (AE_ERROR); + } + + /* Compile Array of ID mappings */ + + IortNode->MappingOffset = NodeLength; + IdMappingNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortMap, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + NodeLength += sizeof (ACPI_IORT_ID_MAPPING); + IdMappingNumber++; + } + IortNode->MappingCount = IdMappingNumber; + + /* + * Node length can be determined by DT_LENGTH option + * IortNode->Length = NodeLength; + */ + DtPopSubtable (); + ParentTable = DtPeekSubtable (); + NodeNumber++; + } + Iort->NodeCount = NodeNumber; + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileIvrs * * PARAMETERS: List - Current field list pointer @@ -1559,11 +2016,6 @@ DtCompileLpit ( InfoTable = AcpiDmTableInfoLpit0; break; - case ACPI_LPIT_TYPE_SIMPLE_IO: - - InfoTable = AcpiDmTableInfoLpit1; - break; - default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "LPIT"); @@ -1715,6 +2167,11 @@ DtCompileMadt ( InfoTable = AcpiDmTableInfoMadt14; break; + case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: + + InfoTable = AcpiDmTableInfoMadt15; + break; + default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT"); @@ -1950,6 +2407,201 @@ DtCompileMtmr ( /****************************************************************************** * + * FUNCTION: DtCompileNfit + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile NFIT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileNfit ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_NFIT_HEADER *NfitHeader; + ACPI_DMTABLE_INFO *InfoTable; + UINT32 Count; + ACPI_NFIT_INTERLEAVE *Interleave = NULL; + ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL; + + /* Main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + /* Subtables */ + + while (*PFieldList) + { + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfitHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer); + + switch (NfitHeader->Type) + { + case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: + + InfoTable = AcpiDmTableInfoNfit0; + break; + + case ACPI_NFIT_TYPE_MEMORY_MAP: + + InfoTable = AcpiDmTableInfoNfit1; + break; + + case ACPI_NFIT_TYPE_INTERLEAVE: + + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable->Buffer); + InfoTable = AcpiDmTableInfoNfit2; + break; + + case ACPI_NFIT_TYPE_SMBIOS: + + InfoTable = AcpiDmTableInfoNfit3; + break; + + case ACPI_NFIT_TYPE_CONTROL_REGION: + + InfoTable = AcpiDmTableInfoNfit4; + break; + + case ACPI_NFIT_TYPE_DATA_REGION: + + InfoTable = AcpiDmTableInfoNfit5; + break; + + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable->Buffer); + InfoTable = AcpiDmTableInfoNfit6; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPopSubtable (); + + switch (NfitHeader->Type) + { + case ACPI_NFIT_TYPE_INTERLEAVE: + + Count = 0; + DtPushSubtable (Subtable); + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit2a, + &Subtable, FALSE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + DtPopSubtable (); + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + + Interleave->LineCount = Count; + DtPopSubtable (); + break; + + case ACPI_NFIT_TYPE_SMBIOS: + + if (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit3a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + } + } + break; + + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + + Count = 0; + DtPushSubtable (Subtable); + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit6a, + &Subtable, FALSE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + DtPopSubtable (); + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + + Hint->HintCount = (UINT16) Count; + DtPopSubtable (); + break; + + default: + break; + } + } + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompilePcct * * PARAMETERS: List - Current field list pointer @@ -1973,6 +2625,8 @@ DtCompilePcct ( ACPI_DMTABLE_INFO *InfoTable; + /* Main table */ + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcct, &Subtable, TRUE); if (ACPI_FAILURE (Status)) @@ -1983,6 +2637,8 @@ DtCompilePcct ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); + /* Subtables */ + while (*PFieldList) { SubtableStart = *PFieldList; @@ -2485,6 +3141,59 @@ DtCompileSrat ( /****************************************************************************** * + * FUNCTION: DtCompileStao + * + * PARAMETERS: PFieldList - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile STAO. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileStao ( + void **List) +{ + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_STATUS Status; + + + /* Compile the main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoStao, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* Compile each ASCII namestring as a subtable */ + + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoStaoStr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + } + + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtGetGenericTableInfo * * PARAMETERS: Name - Generic type name @@ -2575,7 +3284,7 @@ DtCompileUefi ( * operators may be used. */ - DtCompileGeneric ((void **) PFieldList); + DtCompileGeneric ((void **) PFieldList, NULL, NULL); return (AE_OK); } @@ -2633,6 +3342,63 @@ DtCompileWdat ( /****************************************************************************** * + * FUNCTION: DtCompileWpbt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile WPBT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileWpbt ( + void **List) +{ + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_TABLE_WPBT *Table; + ACPI_STATUS Status; + UINT16 Length; + + + /* Compile the main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* Compile the argument list subtable */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Extract the length of the Arguments buffer, insert into main table */ + + Length = (UINT16) Subtable->TotalLength; + Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer); + Table->ArgumentsLength = Length; + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + return (AE_OK); +} + + +/****************************************************************************** + * * FUNCTION: DtCompileXsdt * * PARAMETERS: List - Current field list pointer @@ -2652,6 +3418,7 @@ DtCompileXsdt ( DT_FIELD *FieldList = *(DT_FIELD **) List; UINT64 Address; + ParentTable = DtPeekSubtable (); while (FieldList) @@ -2672,6 +3439,8 @@ DtCompileXsdt ( * FUNCTION: DtCompileGeneric * * PARAMETERS: List - Current field list pointer + * Name - Field name to end generic compiling + * Length - Compiled table length to return * * RETURN: Status * @@ -2681,7 +3450,9 @@ DtCompileXsdt ( ACPI_STATUS DtCompileGeneric ( - void **List) + void **List, + char *Name, + UINT32 *Length) { ACPI_STATUS Status; DT_SUBTABLE *Subtable; @@ -2704,8 +3475,16 @@ DtCompileGeneric ( /* Now we can actually compile the parse tree */ + if (*Length) + { + *Length = 0; + } while (*PFieldList) { + if (Name && !ACPI_STRCMP ((*PFieldList)->Name, Name)) + { + break; + } Info = DtGetGenericTableInfo ((*PFieldList)->Name); if (!Info) { @@ -2723,6 +3502,10 @@ DtCompileGeneric ( if (ACPI_SUCCESS (Status)) { DtInsertSubtable (ParentTable, Subtable); + if (Length) + { + *Length += Subtable->Length; + } } else { diff --git a/src/acpica/source/compiler/dttemplate.c b/src/acpica/source/compiler/dttemplate.c index b3f32b8..809ca61 100644 --- a/src/acpica/source/compiler/dttemplate.c +++ b/src/acpica/source/compiler/dttemplate.c @@ -131,7 +131,7 @@ AcpiUtIsSpecialTable ( static ACPI_STATUS DtCreateOneTemplate ( char *Signature, - ACPI_DMTABLE_DATA *TableData); + const ACPI_DMTABLE_DATA *TableData); static ACPI_STATUS DtCreateAllTemplates ( @@ -184,7 +184,7 @@ ACPI_STATUS DtCreateTemplates ( char *Signature) { - ACPI_DMTABLE_DATA *TableData; + const ACPI_DMTABLE_DATA *TableData; ACPI_STATUS Status; @@ -285,7 +285,7 @@ static ACPI_STATUS DtCreateAllTemplates ( void) { - ACPI_DMTABLE_DATA *TableData; + const ACPI_DMTABLE_DATA *TableData; ACPI_STATUS Status; @@ -364,7 +364,7 @@ DtCreateAllTemplates ( static ACPI_STATUS DtCreateOneTemplate ( char *Signature, - ACPI_DMTABLE_DATA *TableData) + const ACPI_DMTABLE_DATA *TableData) { char *DisasmFilename; FILE *File; diff --git a/src/acpica/source/compiler/dttemplate.h b/src/acpica/source/compiler/dttemplate.h index d7b84b1..22eb736 100644 --- a/src/acpica/source/compiler/dttemplate.h +++ b/src/acpica/source/compiler/dttemplate.h @@ -306,6 +306,29 @@ const unsigned char TemplateDmar[] = 0x00,0x00,0x00,0x00 /* 00000088 "...." */ }; +const unsigned char TemplateDrtm[] = +{ + 0x44,0x52,0x54,0x4D,0x94,0x00,0x00,0x00, /* 00000000 "DRTM...." */ + 0x01,0xB9,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000068 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ + 0x00,0x00,0x00,0x00 /* 00000090 "...." */ +}; + const unsigned char TemplateEcdt[] = { 0x45,0x43,0x44,0x54,0x42,0x00,0x00,0x00, /* 00000000 "ECDTB..." */ @@ -451,11 +474,11 @@ const unsigned char TemplateFacs[] = const unsigned char TemplateFadt[] = { - 0x46,0x41,0x43,0x50,0x0C,0x01,0x00,0x00, /* 00000000 "FACP...." */ - 0x05,0x64,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".dINTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x46,0x41,0x43,0x50,0x14,0x01,0x00,0x00, /* 00000000 "FACP...." */ + 0x06,0x8A,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x15,0x11,0x13,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x10,0x04,0x15,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ @@ -484,7 +507,8 @@ const unsigned char TemplateFadt[] = 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 000000F0 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ 0x01,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000100 "........" */ - 0x00,0x00,0x00,0x00 /* 00000108 "...." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */ + 0x00,0x00,0x00,0x00 /* 00000110 "...." */ }; const unsigned char TemplateFpdt[] = @@ -610,6 +634,44 @@ const unsigned char TemplateHpet[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000030 "........" */ }; +const unsigned char TemplateIort[] = +{ + 0x49,0x4F,0x52,0x54,0x0C,0x01,0x00,0x00, /* 00000000 "IORT...." */ + 0x00,0xBC,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x10,0x04,0x15,0x20,0x04,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "4......." */ + 0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00, /* 00000030 ".....,.." */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000038 "........" */ + 0x18,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x30,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 ".0......" */ + 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00, /* 00000068 "....0..." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x5C,0x5F,0x53, /* 00000078 ".....\_S" */ + 0x42,0x2E,0x50,0x43,0x49,0x30,0x2E,0x44, /* 00000080 "B.PCI0.D" */ + 0x45,0x56,0x30,0x00,0x00,0x00,0x00,0x00, /* 00000088 "EV0....." */ + 0x02,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 ". ......" */ + 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00, /* 00000098 ".... ..." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */ + 0x03,0x5C,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 ".\......" */ + 0x00,0x00,0x00,0x00,0x5C,0x00,0x00,0x00, /* 000000B8 "....\..." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "........" */ + 0x3C,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000D8 "<......." */ + 0x4C,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000E0 "L......." */ + 0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "T......." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */ + 0x00,0x00,0x00,0x00 /* 00000108 "...." */ +}; + const unsigned char TemplateIvrs[] = { 0x49,0x56,0x52,0x53,0xBC,0x00,0x00,0x00, /* 00000000 "IVRS...." */ @@ -640,73 +702,75 @@ const unsigned char TemplateIvrs[] = const unsigned char TemplateLpit[] = { - 0x4C,0x50,0x49,0x54,0xB4,0x00,0x00,0x00, /* 00000000 "LPIT...." */ - 0x01,0x20,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ". INTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x4C,0x50,0x49,0x54,0x94,0x00,0x00,0x00, /* 00000000 "LPIT...." */ + 0x00,0xD8,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x25,0x03,0x14,0x20,0x00,0x00,0x00,0x00, /* 00000020 "%.. ...." */ + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "8......." */ - 0x00,0x00,0x00,0x00,0x7F,0x01,0x02,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ - 0x00,0x20,0x00,0x03,0x00,0x00,0x00,0x00, /* 00000048 ". ......" */ + 0x7F,0x40,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 ". at ......" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ - 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000058 "........" */ - 0x58,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000060 "X......." */ - 0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 00000068 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "8......." */ + 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 00000068 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ - 0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 00000088 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */ - 0x00,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */ - 0x00,0x00,0x00,0x00 /* 000000B0 "...." */ + 0x7F,0x40,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 ". at ......" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ + 0x00,0x00,0x00,0x00 /* 00000090 "...." */ }; -/* MADT with ACPI 5.1 subtables */ +/* MADT with ACPI 6.0 subtables */ const unsigned char TemplateMadt[] = { - 0x41,0x50,0x49,0x43,0x2a,0x01,0x00,0x00, /* 00000000 "APIC*..." */ - 0x04,0x34,0x49,0x4e,0x54,0x45,0x4c,0x20, /* 00000008 ".4INTEL " */ - 0x54,0x45,0x4d,0x50,0x4c,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ - 0x01,0x00,0x00,0x00,0x49,0x4e,0x54,0x4c, /* 00000018 "....INTL" */ - 0x24,0x04,0x14,0x20,0x00,0x00,0x00,0x00, /* 00000020 "$.. ...." */ + 0x41,0x50,0x49,0x43,0x5A,0x01,0x00,0x00, /* 00000000 "APICZ..." */ + 0x03,0xEA,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x01,0x00,0x00,0x00,0x00,0x08,0x00,0x00, /* 00000028 "........" */ - 0x01,0x00,0x00,0x00,0x01,0x0c,0x01,0x00, /* 00000030 "........" */ + 0x01,0x00,0x00,0x00,0x01,0x0C,0x01,0x00, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ - 0x02,0x0a,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ - 0x00,0x00,0x03,0x08,0x0d,0x00,0x01,0x00, /* 00000048 "........" */ + 0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x03,0x08,0x0D,0x00,0x01,0x00, /* 00000048 "........" */ 0x00,0x00,0x04,0x06,0x00,0x05,0x00,0x01, /* 00000050 "........" */ - 0x05,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x05,0x0C,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ 0x00,0x00,0x00,0x00,0x06,0x10,0x00,0x00, /* 00000060 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ 0x00,0x00,0x00,0x00,0x07,0x16,0x00,0x00, /* 00000070 "........" */ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000078 "........" */ - 0x00,0x00,0x00,0x00,0x5c,0x43,0x50,0x55, /* 00000080 "....\CPU" */ + 0x00,0x00,0x00,0x00,0x5C,0x43,0x50,0x55, /* 00000080 "....\CPU" */ 0x30,0x00,0x08,0x10,0x05,0x00,0x00,0x00, /* 00000088 "0......." */ 0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00, /* 00000090 "........" */ 0x00,0x00,0x09,0x10,0x00,0x00,0x00,0x00, /* 00000098 "........" */ - 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000a0 "........" */ - 0x00,0x00,0x0a,0x0c,0x05,0x00,0x00,0x00, /* 000000a8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x4c, /* 000000b0 ".......L" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000b8 "........" */ - 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000c0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000c8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000d0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000d8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000e0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000e8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000f0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000f8 "........" */ - 0x00,0x00,0x0e,0x10,0x00,0x00,0x00,0x00, /* 00000100 "........" */ + 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ + 0x00,0x00,0x0A,0x0C,0x05,0x00,0x00,0x00, /* 000000A8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x50, /* 000000B0 ".......P" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */ + 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18, /* 00000100 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */ - 0x00,0x00,0x0c,0x18,0x00,0x00,0x00,0x00, /* 00000110 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */ + 0x00,0x00,0x01,0x00,0x00,0x00,0x0D,0x18, /* 00000118 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */ - 0x00,0x00 /* 00000128 ".. " */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00, /* 00000128 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x10, /* 00000130 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x14, /* 00000140 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000148 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000150 "........" */ + 0x00,0x00 /* 00000158 ".." */ }; const unsigned char TemplateMcfg[] = @@ -800,6 +864,56 @@ const unsigned char TemplateMsct[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000088 "........" */ }; +const unsigned char TemplateNfit[] = +{ + 0x4E,0x46,0x49,0x54,0x70,0x01,0x00,0x00, /* 00000000 "NFITp..." */ + 0x01,0x53,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".SINTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x00,0x00,0x38,0x00,0x01,0x00,0x00,0x00, /* 00000028 "..8....." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ + 0x30,0x05,0xAF,0x91,0x86,0x5D,0x0E,0x47, /* 00000038 "0....].G" */ + 0xA6,0xB0,0x0A,0x2D,0xB9,0x40,0x82,0x49, /* 00000040 "...-. at .I" */ + 0x00,0x00,0x00,0x7C,0x03,0x00,0x00,0x00, /* 00000048 "...|...." */ + 0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x00,0x30,0x00,0x01,0x00,0x00,0x00, /* 00000060 "..0....." */ + 0x04,0x00,0x00,0x00,0x01,0x00,0x01,0x00, /* 00000068 "........" */ + 0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00, /* 00000070 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ + 0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x01,0x00,0x03,0x00,0x2A,0x00,0x00,0x00, /* 00000088 "....*..." */ + 0x02,0x00,0x20,0x00,0x01,0x00,0x00,0x00, /* 00000090 ".. ....." */ + 0x04,0x00,0x00,0x00,0x00,0x01,0x00,0x00, /* 00000098 "........" */ + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, /* 000000A0 "........" */ + 0x06,0x00,0x00,0x00,0x09,0x00,0x00,0x00, /* 000000A8 "........" */ + 0x03,0x00,0x28,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "..(....." */ + 0xB4,0x13,0x5D,0x40,0x91,0x0B,0x29,0x93, /* 000000B8 "..]@..)." */ + 0x67,0xE8,0x23,0x4C,0x00,0x00,0x00,0x88, /* 000000C0 "g.#L...." */ + 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77, /* 000000C8 ".."3DUfw" */ + 0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, /* 000000D0 "........" */ + 0x04,0x00,0x50,0x00,0x01,0x00,0x86,0x80, /* 000000D8 "..P....." */ + 0x17,0x20,0x01,0x00,0x86,0x80,0x17,0x20, /* 000000E0 ". ..... " */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */ + 0x89,0x00,0x54,0x76,0x01,0x03,0x00,0x01, /* 000000F0 "..Tv...." */ + 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 ". ......" */ + 0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */ + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */ + 0x00,0x10,0x80,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */ + 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */ + 0x05,0x00,0x28,0x00,0x01,0x00,0x00,0x01, /* 00000128 "..(....." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */ + 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 ". ......" */ + 0x00,0x00,0x00,0xE0,0x0F,0x00,0x00,0x00, /* 00000140 "........" */ + 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00, /* 00000148 "........" */ + 0x06,0x00,0x20,0x00,0x01,0x00,0x00,0x00, /* 00000150 ".. ....." */ + 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */ + 0x00,0x00,0x00,0x18,0x04,0x00,0x00,0x00, /* 00000160 "........" */ + 0x00,0x00,0x00,0x18,0x06,0x00,0x00,0x00 /* 00000168 "........" */ +}; + const unsigned char TemplateMtmr[] = { 0x4D,0x54,0x4D,0x52,0x4C,0x00,0x00,0x00, /* 00000000 "MTMRL..." */ @@ -1071,6 +1185,26 @@ const unsigned char TemplateSrat[] = 0x00,0x00 /* 00000090 ".." */ }; +const unsigned char TemplateStao[] = +{ + 0x53,0x54,0x41,0x4F,0x7E,0x00,0x00,0x00, /* 00000000 "STAO~..." */ + 0x01,0x7F,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x10,0x04,0x15,0x20,0x01,0x5C,0x5F,0x53, /* 00000020 "... .\_S" */ + 0x42,0x30,0x2E,0x42,0x55,0x53,0x30,0x2E, /* 00000028 "B0.BUS0." */ + 0x44,0x45,0x56,0x31,0x00,0x5C,0x5F,0x53, /* 00000030 "DEV1.\_S" */ + 0x42,0x30,0x2E,0x42,0x55,0x53,0x30,0x2E, /* 00000038 "B0.BUS0." */ + 0x44,0x45,0x56,0x32,0x00,0x5C,0x5F,0x53, /* 00000040 "DEV2.\_S" */ + 0x42,0x30,0x2E,0x42,0x55,0x53,0x31,0x2E, /* 00000048 "B0.BUS1." */ + 0x44,0x45,0x56,0x31,0x2E,0x44,0x45,0x56, /* 00000050 "DEV1.DEV" */ + 0x32,0x00,0x5C,0x5F,0x53,0x42,0x30,0x2E, /* 00000058 "2.\_SB0." */ + 0x42,0x55,0x53,0x31,0x2E,0x44,0x45,0x56, /* 00000060 "BUS1.DEV" */ + 0x32,0x2E,0x44,0x45,0x56,0x32,0x00,0x5C, /* 00000068 "2.DEV2.\" */ + 0x55,0x53,0x42,0x31,0x2E,0x48,0x55,0x42, /* 00000070 "USB1.HUB" */ + 0x31,0x2E,0x50,0x54,0x31,0x00 /* 00000078 "1.PT1." */ +}; + const unsigned char TemplateTcpa[] = { 0x54,0x43,0x50,0x41,0x32,0x00,0x00,0x00, /* 00000000 "TCPA2..." */ @@ -1167,6 +1301,41 @@ const unsigned char TemplateWdrt[] = 0x00,0x00,0x00,0x00,0xFF,0xFF,0x00 /* 00000040 "......." */ }; +const unsigned char TemplateWpbt[] = +{ + 0x57,0x50,0x42,0x54,0x98,0x00,0x00,0x00, /* 00000000 "WPBT...." */ + 0x01,0x83,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x10,0x04,0x15,0x20,0x78,0x56,0x34,0x12, /* 00000020 "... xV4." */ + 0x00,0x00,0x00,0xBB,0x00,0x00,0x00,0xAA, /* 00000028 "........" */ + 0x33,0x88,0x64,0x00,0x34,0x00,0x20,0x00, /* 00000030 "3.d.4. ." */ + 0x73,0x00,0x63,0x00,0x6F,0x00,0x72,0x00, /* 00000038 "s.c.o.r." */ + 0x65,0x00,0x20,0x00,0x61,0x00,0x6E,0x00, /* 00000040 "e. .a.n." */ + 0x64,0x00,0x20,0x00,0x37,0x00,0x20,0x00, /* 00000048 "d. .7. ." */ + 0x79,0x00,0x65,0x00,0x61,0x00,0x72,0x00, /* 00000050 "y.e.a.r." */ + 0x73,0x00,0x20,0x00,0x61,0x00,0x67,0x00, /* 00000058 "s. .a.g." */ + 0x6F,0x00,0x20,0x00,0x6F,0x00,0x75,0x00, /* 00000060 "o. .o.u." */ + 0x72,0x00,0x20,0x00,0x66,0x00,0x61,0x00, /* 00000068 "r. .f.a." */ + 0x74,0x00,0x68,0x00,0x65,0x00,0x72,0x00, /* 00000070 "t.h.e.r." */ + 0x73,0x00,0x20,0x00,0x62,0x00,0x72,0x00, /* 00000078 "s. .b.r." */ + 0x6F,0x00,0x75,0x00,0x67,0x00,0x68,0x00, /* 00000080 "o.u.g.h." */ + 0x74,0x00,0x20,0x00,0x66,0x00,0x6F,0x00, /* 00000088 "t. .f.o." */ + 0x72,0x00,0x74,0x00,0x68,0x00,0x00,0x00 /* 00000090 "r.t.h..." */ +}; + +const unsigned char TemplateXenv[] = +{ + 0x58,0x45,0x4E,0x56,0x39,0x00,0x00,0x00, /* 00000000 "XENV9..." */ + 0x01,0x3A,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".:INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x10, /* 00000020 "... ...." */ + 0x00,0x00,0x00,0x0A,0x00,0x20,0x00,0x00, /* 00000028 "..... .." */ + 0x00,0x00,0x00,0x0B,0x25,0x00,0xBB,0xAA, /* 00000030 "....%..." */ + 0x03 /* 00000038 "." */ +}; + const unsigned char TemplateXsdt[] = { 0x58,0x53,0x44,0x54,0x64,0x00,0x00,0x00, /* 00000000 "XSDTd..." */ diff --git a/src/acpica/source/compiler/dtutils.c b/src/acpica/source/compiler/dtutils.c index 4b795c0..658cde6 100644 --- a/src/acpica/source/compiler/dtutils.c +++ b/src/acpica/source/compiler/dtutils.c @@ -448,6 +448,7 @@ DtGetFieldType ( case ACPI_DMT_GAS: case ACPI_DMT_HESTNTFY: + case ACPI_DMT_IORTMEM: Type = DT_FIELD_TYPE_INLINE_SUBTABLE; break; @@ -592,6 +593,7 @@ DtGetFieldLength ( case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: case ACPI_DMT_HEST: + case ACPI_DMT_NFIT: case ACPI_DMT_PCI_PATH: ByteLength = 2; @@ -659,6 +661,11 @@ DtGetFieldLength ( ByteLength = sizeof (ACPI_HEST_NOTIFY); break; + case ACPI_DMT_IORTMEM: + + ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS); + break; + case ACPI_DMT_BUFFER: case ACPI_DMT_RAW_BUFFER: diff --git a/src/acpica/source/compiler/preprocess.h b/src/acpica/source/compiler/preprocess.h index 998a25a..39b35e8 100644 --- a/src/acpica/source/compiler/preprocess.h +++ b/src/acpica/source/compiler/preprocess.h @@ -339,14 +339,18 @@ PrReplaceData ( char *BufferToAdd, UINT32 LengthToAdd); -void +FILE * PrOpenIncludeFile ( - char *Filename); + char *Filename, + char *OpenMode, + char **FullPathname); FILE * PrOpenIncludeWithPrefix ( char *PrefixDir, - char *Filename); + char *Filename, + char *OpenMode, + char **FullPathname); void PrPushInputFileStack ( diff --git a/src/acpica/source/compiler/prscan.c b/src/acpica/source/compiler/prscan.c index d52a45e..cafcea5 100644 --- a/src/acpica/source/compiler/prscan.c +++ b/src/acpica/source/compiler/prscan.c @@ -157,28 +157,42 @@ PrDbgPrint ( char *Action, char *DirectiveName); +static void +PrDoIncludeBuffer ( + char *Pathname, + char *BufferName); + +static void +PrDoIncludeFile ( + char *Pathname); + /* * Supported preprocessor directives + * Each entry is of the form "Name, ArgumentCount" */ static const PR_DIRECTIVE_INFO Gbl_DirectiveInfo[] = { - {"define", 1}, - {"elif", 0}, /* Converted to #else..#if internally */ - {"else", 0}, - {"endif", 0}, - {"error", 1}, - {"if", 1}, - {"ifdef", 1}, - {"ifndef", 1}, - {"include", 0}, /* Argument is not standard format, so 0 */ - {"line", 1}, - {"pragma", 1}, - {"undef", 1}, - {"warning", 1}, - {NULL, 0} + {"define", 1}, + {"elif", 0}, /* Converted to #else..#if internally */ + {"else", 0}, + {"endif", 0}, + {"error", 1}, + {"if", 1}, + {"ifdef", 1}, + {"ifndef", 1}, + {"include", 0}, /* Argument is not standard format, so just use 0 here */ + {"includebuffer", 0}, /* Argument is not standard format, so just use 0 here */ + {"line", 1}, + {"loadbuffer", 0}, + {"pragma", 1}, + {"undef", 1}, + {"warning", 1}, + {NULL, 0} }; +/* This table must match ordering of above table exactly */ + enum Gbl_DirectiveIndexes { PR_DIRECTIVE_DEFINE = 0, @@ -190,6 +204,7 @@ enum Gbl_DirectiveIndexes PR_DIRECTIVE_IFDEF, PR_DIRECTIVE_IFNDEF, PR_DIRECTIVE_INCLUDE, + PR_DIRECTIVE_INCLUDEBUFFER, PR_DIRECTIVE_LINE, PR_DIRECTIVE_PRAGMA, PR_DIRECTIVE_UNDEF, @@ -454,13 +469,6 @@ PrPreprocessInputFile ( Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, &Next); } -#if 0 -/* Line prefix */ - FlPrintFile (ASL_FILE_PREPROCESSOR, "/* %14s %.5u i:%.5u */ ", - Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_CurrentLineNumber, Gbl_PreprocessorLineNumber); -#endif - /* * Emit a #line directive if necessary, to keep the line numbers in * the (.i) file synchronized with the original source code file, so @@ -505,7 +513,7 @@ PrDoDirective ( char **Next) { char *Token = Gbl_MainTokenBuffer; - char *Token2; + char *Token2 = NULL; char *End; UINT64 Value; ACPI_SIZE TokenOffset; @@ -524,7 +532,7 @@ PrDoDirective ( PrError (ASL_ERROR, ASL_MSG_UNKNOWN_DIRECTIVE, THIS_TOKEN_OFFSET (DirectiveToken)); - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "#%s: Unknown directive\n", Gbl_CurrentLineNumber, DirectiveToken); return; @@ -611,7 +619,7 @@ PrDoDirective ( /* Most directives have at least one argument */ - if (Gbl_DirectiveInfo[Directive].ArgCount == 1) + if (Gbl_DirectiveInfo[Directive].ArgCount >= 1) { Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); if (!Token) @@ -620,6 +628,15 @@ PrDoDirective ( } } + if (Gbl_DirectiveInfo[Directive].ArgCount >= 2) + { + Token2 = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); + if (!Token2) + { + goto SyntaxError; + } + } + /* * At this point, if we are ignoring the current code block, * do not process any more directives (i.e., ignore them also.) @@ -671,7 +688,7 @@ PrDoDirective ( Gbl_IgnoringThisCodeBlock = TRUE; } - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Resolved #if: %8.8X%8.8X %s\n", Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value), Gbl_IgnoringThisCodeBlock ? "" : ""); @@ -744,7 +761,7 @@ PrDoDirective ( Token2 = ""; } #endif - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "New #define: %s->%s\n", Gbl_CurrentLineNumber, Token, Token2); @@ -772,11 +789,32 @@ PrDoDirective ( goto SyntaxError; } - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Start #include file \"%s\"\n", Gbl_CurrentLineNumber, Token, Gbl_CurrentLineNumber); - PrOpenIncludeFile (Token); + PrDoIncludeFile (Token); + break; + + case PR_DIRECTIVE_INCLUDEBUFFER: + + Token = PrGetNextToken (NULL, " \"<>", Next); + if (!Token) + { + goto SyntaxError; + } + + Token2 = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); + if (!Token2) + { + goto SyntaxError; + } + + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID + "Start #includebuffer input from file \"%s\", buffer name %s\n", + Gbl_CurrentLineNumber, Token, Token2); + + PrDoIncludeBuffer (Token, Token2); break; case PR_DIRECTIVE_LINE: @@ -790,7 +828,7 @@ PrDoDirective ( return; } - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "User #line invocation %s\n", Gbl_CurrentLineNumber, Token); @@ -840,7 +878,7 @@ PrDoDirective ( case PR_DIRECTIVE_UNDEF: - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "#undef: %s\n", Gbl_CurrentLineNumber, Token); PrRemoveDefine (Token); @@ -855,7 +893,7 @@ PrDoDirective ( default: /* Should never get here */ - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID "Unrecognized directive: %u\n", Gbl_CurrentLineNumber, Directive); break; @@ -1026,9 +1064,92 @@ PrDbgPrint ( { DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] " - "%*s %s #%s, Depth %u\n", + "%*s %s #%s, IfDepth %u\n", Gbl_CurrentLineNumber, Gbl_IfDepth, Gbl_IgnoringThisCodeBlock ? "I" : "E", Gbl_IfDepth * 4, " ", Action, DirectiveName, Gbl_IfDepth); } + + +/******************************************************************************* + * + * FUNCTION: PrDoIncludeFile + * + * PARAMETERS: Pathname - Name of the input file + * + * RETURN: None. + * + * DESCRIPTION: Open an include file, from #include. + * + ******************************************************************************/ + +static void +PrDoIncludeFile ( + char *Pathname) +{ + char *FullPathname; + + + (void) PrOpenIncludeFile (Pathname, "r", &FullPathname); +} + + +/******************************************************************************* + * + * FUNCTION: PrDoIncludeBuffer + * + * PARAMETERS: Pathname - Name of the input binary file + * BufferName - ACPI namepath of the buffer + * + * RETURN: None. + * + * DESCRIPTION: Create an ACPI buffer object from a binary file. The contents + * of the file are emitted into the buffer object as ascii + * hex data. From #includebuffer. + * + ******************************************************************************/ + +static void +PrDoIncludeBuffer ( + char *Pathname, + char *BufferName) +{ + char *FullPathname; + FILE *BinaryBufferFile; + UINT32 i = 0; + UINT8 c; + + + BinaryBufferFile = PrOpenIncludeFile (Pathname, "rb", &FullPathname); + if (!BinaryBufferFile) + { + return; + } + + /* Emit "Name (XXXX, Buffer() {" header */ + + FlPrintFile (ASL_FILE_PREPROCESSOR, "Name (%s, Buffer()\n{", BufferName); + + /* Dump the entire file in ascii hex format */ + + while (fread (&c, 1, 1, BinaryBufferFile)) + { + if (!(i % 8)) + { + FlPrintFile (ASL_FILE_PREPROCESSOR, "\n ", c); + } + + FlPrintFile (ASL_FILE_PREPROCESSOR, " 0x%2.2X,", c); + i++; + } + + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID + "#includebuffer: read %u bytes from %s\n", + Gbl_CurrentLineNumber, i, FullPathname); + + /* Close the Name() operator */ + + FlPrintFile (ASL_FILE_PREPROCESSOR, "\n})\n", BufferName); + fclose (BinaryBufferFile); +} diff --git a/src/acpica/source/compiler/prutils.c b/src/acpica/source/compiler/prutils.c index 10d65a5..329f6d0 100644 --- a/src/acpica/source/compiler/prutils.c +++ b/src/acpica/source/compiler/prutils.c @@ -310,9 +310,11 @@ PrReplaceData ( * ******************************************************************************/ -void +FILE * PrOpenIncludeFile ( - char *Filename) + char *Filename, + char *OpenMode, + char **FullPathname) { FILE *IncludeFile; ASL_INCLUDE_DIR *NextDir; @@ -329,12 +331,13 @@ PrOpenIncludeFile ( (Filename[0] == '\\') || (Filename[1] == ':')) { - IncludeFile = PrOpenIncludeWithPrefix ("", Filename); + IncludeFile = PrOpenIncludeWithPrefix ( + "", Filename, OpenMode, FullPathname); if (!IncludeFile) { goto ErrorExit; } - return; + return (IncludeFile); } /* @@ -345,10 +348,11 @@ PrOpenIncludeFile ( * * Construct the file pathname from the global directory name. */ - IncludeFile = PrOpenIncludeWithPrefix (Gbl_DirectoryPath, Filename); + IncludeFile = PrOpenIncludeWithPrefix ( + Gbl_DirectoryPath, Filename, OpenMode, FullPathname); if (IncludeFile) { - return; + return (IncludeFile); } /* @@ -358,10 +362,11 @@ PrOpenIncludeFile ( NextDir = Gbl_IncludeDirList; while (NextDir) { - IncludeFile = PrOpenIncludeWithPrefix (NextDir->Dir, Filename); + IncludeFile = PrOpenIncludeWithPrefix ( + NextDir->Dir, Filename, OpenMode, FullPathname); if (IncludeFile) { - return; + return (IncludeFile); } NextDir = NextDir->Next; @@ -372,6 +377,7 @@ PrOpenIncludeFile ( ErrorExit: sprintf (Gbl_MainTokenBuffer, "%s, %s", Filename, strerror (errno)); PrError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, 0); + return (NULL); } @@ -392,7 +398,9 @@ ErrorExit: FILE * PrOpenIncludeWithPrefix ( char *PrefixDir, - char *Filename) + char *Filename, + char *OpenMode, + char **FullPathname) { FILE *IncludeFile; char *Pathname; @@ -408,7 +416,7 @@ PrOpenIncludeWithPrefix ( /* Attempt to open the file, push if successful */ - IncludeFile = fopen (Pathname, "r"); + IncludeFile = fopen (Pathname, OpenMode); if (!IncludeFile) { fprintf (stderr, "Could not open include file %s\n", Pathname); @@ -418,6 +426,7 @@ PrOpenIncludeWithPrefix ( /* Push the include file on the open input file stack */ PrPushInputFileStack (IncludeFile, Pathname); + *FullPathname = Pathname; return (IncludeFile); } diff --git a/src/acpica/source/components/debugger/dbfileio.c b/src/acpica/source/components/debugger/dbfileio.c index 768d87c..dc55c6e 100644 --- a/src/acpica/source/components/debugger/dbfileio.c +++ b/src/acpica/source/components/debugger/dbfileio.c @@ -288,7 +288,8 @@ AeLocalLoadTable ( ACPI_STATUS AcpiDbGetTableFromFile ( char *Filename, - ACPI_TABLE_HEADER **ReturnTable) + ACPI_TABLE_HEADER **ReturnTable, + BOOLEAN MustBeAmlFile) { #ifdef ACPI_APPLICATION ACPI_STATUS Status; @@ -302,9 +303,18 @@ AcpiDbGetTableFromFile ( return (Status); } -#ifdef ACPI_DATA_TABLE_DISASSEMBLY - IsAmlTable = AcpiUtIsAmlTable (Table); -#endif + if (MustBeAmlFile) + { + IsAmlTable = AcpiUtIsAmlTable (Table); + if (!IsAmlTable) + { + ACPI_EXCEPTION ((AE_INFO, AE_OK, + "Input for -e is not an AML table: " + "\"%4.4s\" (must be DSDT/SSDT)", + Table->Signature)); + return (AE_TYPE); + } + } if (IsAmlTable) { diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c index fe34a90..573f384 100644 --- a/src/acpica/source/components/debugger/dbinput.c +++ b/src/acpica/source/components/debugger/dbinput.c @@ -1041,7 +1041,7 @@ AcpiDbCommandDispatch ( case CMD_LOAD: - Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL); + Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL, FALSE); break; case CMD_LOCKS: diff --git a/src/acpica/source/components/dispatcher/dsmethod.c b/src/acpica/source/components/dispatcher/dsmethod.c index 43ee55d..2e37795 100644 --- a/src/acpica/source/components/dispatcher/dsmethod.c +++ b/src/acpica/source/components/dispatcher/dsmethod.c @@ -195,6 +195,7 @@ AcpiDsAutoSerializeMethod ( WalkState = AcpiDsCreateWalkState (Node->OwnerId, NULL, NULL, NULL); if (!WalkState) { + AcpiPsFreeOp (Op); return_ACPI_STATUS (AE_NO_MEMORY); } @@ -203,6 +204,7 @@ AcpiDsAutoSerializeMethod ( if (ACPI_FAILURE (Status)) { AcpiDsDeleteWalkState (WalkState); + AcpiPsFreeOp (Op); return_ACPI_STATUS (Status); } @@ -211,10 +213,6 @@ AcpiDsAutoSerializeMethod ( /* Parse the method, scan for creation of named objects */ Status = AcpiPsParseAml (WalkState); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } AcpiPsDeleteParseTree (Op); return_ACPI_STATUS (Status); diff --git a/src/acpica/source/components/hardware/hwpci.c b/src/acpica/source/components/hardware/hwpci.c index da7674c..0d07fe1 100644 --- a/src/acpica/source/components/hardware/hwpci.c +++ b/src/acpica/source/components/hardware/hwpci.c @@ -212,7 +212,7 @@ AcpiHwDerivePciId ( ACPI_HANDLE PciRegion) { ACPI_STATUS Status; - ACPI_PCI_DEVICE *ListHead = NULL; + ACPI_PCI_DEVICE *ListHead; ACPI_FUNCTION_TRACE (HwDerivePciId); @@ -270,7 +270,6 @@ AcpiHwBuildPciList ( ACPI_HANDLE ParentDevice; ACPI_STATUS Status; ACPI_PCI_DEVICE *ListElement; - ACPI_PCI_DEVICE *ListHead = NULL; /* @@ -278,6 +277,7 @@ AcpiHwBuildPciList ( * a list of device nodes. Loop will exit when either the PCI device is * found, or the root of the namespace is reached. */ + *ReturnListHead = NULL; CurrentDevice = PciRegion; while (1) { @@ -294,7 +294,6 @@ AcpiHwBuildPciList ( if (ParentDevice == RootPciDevice) { - *ReturnListHead = ListHead; return (AE_OK); } @@ -309,9 +308,9 @@ AcpiHwBuildPciList ( /* Put new element at the head of the list */ - ListElement->Next = ListHead; + ListElement->Next = *ReturnListHead; ListElement->Device = ParentDevice; - ListHead = ListElement; + *ReturnListHead = ListElement; CurrentDevice = ParentDevice; } diff --git a/src/acpica/source/components/namespace/nsprepkg.c b/src/acpica/source/components/namespace/nsprepkg.c index 085ccd2..627ee3e 100644 --- a/src/acpica/source/components/namespace/nsprepkg.c +++ b/src/acpica/source/components/namespace/nsprepkg.c @@ -393,6 +393,13 @@ AcpiNsCheckPackage ( Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; + case ACPI_PTYPE2_VAR_VAR: + /* + * Returns a variable list of packages, each with a variable list + * of objects. + */ + break; + case ACPI_PTYPE2_UUID_PAIR: /* The package must contain pairs of (UUID + type) */ @@ -562,6 +569,12 @@ AcpiNsCheckPackageList ( } break; + case ACPI_PTYPE2_VAR_VAR: + /* + * Each subpackage has a fixed or variable number of elements + */ + break; + case ACPI_PTYPE2_FIXED: /* Each subpackage has a fixed length */ diff --git a/src/acpica/source/components/namespace/nsrepair.c b/src/acpica/source/components/namespace/nsrepair.c index 736933a..fbb9c7e 100644 --- a/src/acpica/source/components/namespace/nsrepair.c +++ b/src/acpica/source/components/namespace/nsrepair.c @@ -595,10 +595,10 @@ AcpiNsRemoveNullElements ( case ACPI_PTYPE2_MIN: case ACPI_PTYPE2_REV_FIXED: case ACPI_PTYPE2_FIX_VAR: - break; default: + case ACPI_PTYPE2_VAR_VAR: case ACPI_PTYPE1_FIXED: case ACPI_PTYPE1_OPTION: return; diff --git a/src/acpica/source/components/parser/psopinfo.c b/src/acpica/source/components/parser/psopinfo.c index e0fbd89..4a26ae7 100644 --- a/src/acpica/source/components/parser/psopinfo.c +++ b/src/acpica/source/components/parser/psopinfo.c @@ -124,9 +124,6 @@ ACPI_MODULE_NAME ("psopinfo") -extern const UINT8 AcpiGbl_ShortOpIndex[]; -extern const UINT8 AcpiGbl_LongOpIndex[]; - static const UINT8 AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6}; diff --git a/src/acpica/source/components/utilities/utfileio.c b/src/acpica/source/components/utilities/utfileio.c index e24e81f..5b78379 100644 --- a/src/acpica/source/components/utilities/utfileio.c +++ b/src/acpica/source/components/utilities/utfileio.c @@ -300,11 +300,8 @@ AcpiUtReadTable ( TableHeader.Length, FileSize); #ifdef ACPI_ASL_COMPILER - Status = FlCheckForAscii (fp, NULL, FALSE); - if (ACPI_SUCCESS (Status)) - { - AcpiOsPrintf ("File appears to be ASCII only, must be binary\n"); - } + AcpiOsPrintf ("File is corrupt or is ASCII text -- " + "it must be a binary file\n"); #endif return (AE_BAD_HEADER); } @@ -416,7 +413,7 @@ AcpiUtReadTableFromFile ( /* Get the entire file */ - fprintf (stderr, "Loading Acpi table from file %10s - Length %.8u (%06X)\n", + fprintf (stderr, "Reading ACPI table from file %10s - Length %.8u (0x%06X)\n", Filename, FileSize, FileSize); Status = AcpiUtReadTable (File, Table, &TableLength); diff --git a/src/acpica/source/components/utilities/uthex.c b/src/acpica/source/components/utilities/uthex.c index 500ab40..c652f6a 100644 --- a/src/acpica/source/components/utilities/uthex.c +++ b/src/acpica/source/components/utilities/uthex.c @@ -154,9 +154,9 @@ AcpiUtHexToAsciiChar ( /******************************************************************************* * - * FUNCTION: AcpiUtHexCharToValue + * FUNCTION: AcpiUtAsciiCharToHex * - * PARAMETERS: AsciiChar - Hex character in Ascii + * PARAMETERS: HexChar - Hex character in Ascii * * RETURN: The binary value of the ascii/hex character * diff --git a/src/acpica/source/components/utilities/utxferror.c b/src/acpica/source/components/utilities/utxferror.c index bdbab99..b62e5df 100644 --- a/src/acpica/source/components/utilities/utxferror.c +++ b/src/acpica/source/components/utilities/utxferror.c @@ -195,8 +195,18 @@ AcpiException ( ACPI_MSG_REDIRECT_BEGIN; - AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status)); + /* For AE_OK, just print the message */ + + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf (ACPI_MSG_EXCEPTION); + + } + else + { + AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status)); + } va_start (ArgList, Format); AcpiOsVprintf (Format, ArgList); ACPI_MSG_SUFFIX; diff --git a/src/acpica/source/include/acdebug.h b/src/acpica/source/include/acdebug.h index 3c823e8..2d91725 100644 --- a/src/acpica/source/include/acdebug.h +++ b/src/acpica/source/include/acdebug.h @@ -447,7 +447,8 @@ AcpiDbLoadAcpiTable ( ACPI_STATUS AcpiDbGetTableFromFile ( char *Filename, - ACPI_TABLE_HEADER **Table); + ACPI_TABLE_HEADER **Table, + BOOLEAN MustBeAmlTable); /* diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h index 5776d5d..30fbece 100644 --- a/src/acpica/source/include/acdisasm.h +++ b/src/acpica/source/include/acdisasm.h @@ -132,7 +132,7 @@ #define ACPI_RAW_TABLE_DATA_HEADER "Raw Table Data" -typedef const struct acpi_dmtable_info +typedef struct acpi_dmtable_info { UINT8 Opcode; UINT16 Offset; @@ -220,9 +220,11 @@ typedef enum ACPI_DMT_HEST, ACPI_DMT_HESTNTFY, ACPI_DMT_HESTNTYP, + ACPI_DMT_IORTMEM, ACPI_DMT_IVRS, ACPI_DMT_LPIT, ACPI_DMT_MADT, + ACPI_DMT_NFIT, ACPI_DMT_PCCT, ACPI_DMT_PMTT, ACPI_DMT_SLIC, @@ -250,7 +252,6 @@ typedef struct acpi_dmtable_data ACPI_DMTABLE_HANDLER TableHandler; ACPI_CMTABLE_HANDLER CmTableHandler; const unsigned char *Template; - char *Name; } ACPI_DMTABLE_DATA; @@ -318,6 +319,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2a[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Device[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Addr[]; @@ -334,6 +336,11 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar4[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm0a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm1a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[]; @@ -344,6 +351,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt6[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdtHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt0[]; @@ -369,6 +377,20 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpitHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort0a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort1a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3b[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3c[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortAcc[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortMap[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortPad[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[]; @@ -393,6 +415,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt13[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt14[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt15[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[]; @@ -407,6 +430,18 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfitHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit2a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit3[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit3a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit4[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit5[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1[]; @@ -434,6 +469,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoStao[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[]; @@ -444,14 +481,17 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWddt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoXenv[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2]; - /* - * dmtable + * dmtable and ahtable */ -extern ACPI_DMTABLE_DATA AcpiDmTableData[]; +extern const ACPI_DMTABLE_DATA AcpiDmTableData[]; +extern const AH_TABLE AcpiSupportedTables[]; UINT8 AcpiDmGenerateChecksum ( @@ -459,7 +499,7 @@ AcpiDmGenerateChecksum ( UINT32 Length, UINT8 OriginalChecksum); -ACPI_DMTABLE_DATA * +const ACPI_DMTABLE_DATA * AcpiDmGetTableData ( char *Signature); @@ -498,8 +538,13 @@ AcpiDmDumpBuffer ( UINT32 BufferOffset, UINT32 Length, UINT32 AbsoluteOffset, - char *Header, - BOOLEAN MultiLine); + char *Header); + +void +AcpiDmDumpUnicode ( + void *Table, + UINT32 BufferOffset, + UINT32 ByteLength); void AcpiDmDumpAsf ( @@ -522,6 +567,10 @@ AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpDrtm ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpEinj ( ACPI_TABLE_HEADER *Table); @@ -546,6 +595,10 @@ AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpIort ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpIvrs ( ACPI_TABLE_HEADER *Table); @@ -574,6 +627,10 @@ AcpiDmDumpMtmr ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpNfit ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpPcct ( ACPI_TABLE_HEADER *Table); @@ -606,6 +663,10 @@ AcpiDmDumpSrat ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpStao ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpVrtc ( ACPI_TABLE_HEADER *Table); @@ -614,6 +675,10 @@ AcpiDmDumpWdat ( ACPI_TABLE_HEADER *Table); void +AcpiDmDumpWpbt ( + ACPI_TABLE_HEADER *Table); + +void AcpiDmDumpXsdt ( ACPI_TABLE_HEADER *Table); diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h index 9e0d08d..dc7a2eb 100644 --- a/src/acpica/source/include/aclocal.h +++ b/src/acpica/source/include/aclocal.h @@ -473,12 +473,24 @@ typedef struct acpi_package_info3 } ACPI_PACKAGE_INFO3; +typedef struct acpi_package_info4 +{ + UINT8 Type; + UINT8 ObjectType1; + UINT8 Count1; + UINT8 SubObjectTypes; + UINT8 PkgCount; + UINT16 Reserved; + +} ACPI_PACKAGE_INFO4; + typedef union acpi_predefined_info { ACPI_NAME_INFO Info; ACPI_PACKAGE_INFO RetInfo; ACPI_PACKAGE_INFO2 RetInfo2; ACPI_PACKAGE_INFO3 RetInfo3; + ACPI_PACKAGE_INFO4 RetInfo4; } ACPI_PREDEFINED_INFO; @@ -1443,4 +1455,11 @@ typedef struct ah_uuid } AH_UUID; +typedef struct ah_table +{ + char *Signature; + char *Description; + +} AH_TABLE; + #endif /* __ACLOCAL_H__ */ diff --git a/src/acpica/source/include/acparser.h b/src/acpica/source/include/acparser.h index abbde50..e4fc0c7 100644 --- a/src/acpica/source/include/acparser.h +++ b/src/acpica/source/include/acparser.h @@ -144,6 +144,9 @@ * *****************************************************************************/ +extern const UINT8 AcpiGbl_ShortOpIndex[]; +extern const UINT8 AcpiGbl_LongOpIndex[]; + /* * psxface - Parser external interfaces diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h index 74de05e..93d4284 100644 --- a/src/acpica/source/include/acpixf.h +++ b/src/acpica/source/include/acpixf.h @@ -118,7 +118,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20150410 +#define ACPI_CA_VERSION 0x20150515 #include "acconfig.h" #include "actypes.h" diff --git a/src/acpica/source/include/acpredef.h b/src/acpica/source/include/acpredef.h index b03f64b..37f0244 100644 --- a/src/acpica/source/include/acpredef.h +++ b/src/acpica/source/include/acpredef.h @@ -178,6 +178,11 @@ * count = 0 (optional) * (Used for _DLM) * + * ACPI_PTYPE2_VAR_VAR: Variable number of subpackages, each of either a + * constant or variable length. The subpackages are preceded by a + * constant number of objects. + * (Used for _LPI, _RDI) + * * ACPI_PTYPE2_UUID_PAIR: Each subpackage is preceded by a UUID Buffer. The UUID * defines the format of the package. Zero-length parent package is * allowed. @@ -197,7 +202,8 @@ enum AcpiReturnPackageTypes ACPI_PTYPE2_MIN = 8, ACPI_PTYPE2_REV_FIXED = 9, ACPI_PTYPE2_FIX_VAR = 10, - ACPI_PTYPE2_UUID_PAIR = 11 + ACPI_PTYPE2_VAR_VAR = 11, + ACPI_PTYPE2_UUID_PAIR = 12 }; @@ -249,7 +255,7 @@ enum AcpiReturnPackageTypes * These are the names that can actually be evaluated via AcpiEvaluateObject. * Not present in this table are the following: * - * 1) Predefined/Reserved names that are never evaluated via + * 1) Predefined/Reserved names that are not usually evaluated via * AcpiEvaluateObject: * _Lxx and _Exx GPE methods * _Qxx EC methods @@ -435,6 +441,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), + {{"_BTH", METHOD_1ARGS (ACPI_TYPE_INTEGER), /* ACPI 6.0 */ + METHOD_NO_RETURN_VALUE}}, + {{"_BTM", METHOD_1ARGS (ACPI_TYPE_INTEGER), METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, @@ -462,6 +471,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Bufs) */ PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0,0,0,0), + {{"_CR3", METHOD_0ARGS, /* ACPI 6.0 */ + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + {{"_CRS", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, @@ -515,7 +527,7 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_DOS", METHOD_1ARGS (ACPI_TYPE_INTEGER), METHOD_NO_RETURN_VALUE}}, - {{"_DSD", METHOD_0ARGS, + {{"_DSD", METHOD_0ARGS, /* ACPI 6.0 */ METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Buf, 1 Pkg */ PACKAGE_INFO (ACPI_PTYPE2_UUID_PAIR, ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_PACKAGE, 1,0), @@ -669,6 +681,11 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Int) */ PACKAGE_INFO (ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 2,0,0,0), + {{"_LPI", METHOD_0ARGS, /* ACPI 6.0 */ + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (3 Int, n Pkg (10 Int/Buf) */ + PACKAGE_INFO (ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 3, + ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER | ACPI_RTYPE_STRING, 10,0), + {{"_MAT", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, @@ -686,6 +703,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_MSM", METHOD_4ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + {{"_MTL", METHOD_0ARGS, /* ACPI 6.0 */ + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + {{"_NTT", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, @@ -773,6 +793,10 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + {{"_PRR", METHOD_0ARGS, /* ACPI 6.0 */ + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Ref) */ + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_REFERENCE, 1,0,0,0), + {{"_PRS", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, @@ -850,6 +874,11 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_PXM", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + {{"_RDI", METHOD_0ARGS, /* ACPI 6.0 */ + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int, n Pkg (m Ref)) */ + PACKAGE_INFO (ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 1, + ACPI_RTYPE_REFERENCE,0,0), + {{"_REG", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), METHOD_NO_RETURN_VALUE}}, @@ -862,6 +891,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_ROM", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + {{"_RST", METHOD_0ARGS, /* ACPI 6.0 */ + METHOD_NO_RETURN_VALUE}}, + {{"_RTV", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, @@ -988,6 +1020,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_TDL", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + {{"_TFP", METHOD_0ARGS, /* ACPI 6.0 */ + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + {{"_TIP", METHOD_1ARGS (ACPI_TYPE_INTEGER), METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, @@ -1011,6 +1046,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int with count */ PACKAGE_INFO (ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0,0,0), + {{"_TSN", METHOD_0ARGS, /* ACPI 6.0 */ + METHOD_RETURNS (ACPI_RTYPE_REFERENCE)}}, + {{"_TSP", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, diff --git a/src/acpica/source/include/actbl.h b/src/acpica/source/include/actbl.h index 68bbed4..f3cf709 100644 --- a/src/acpica/source/include/actbl.h +++ b/src/acpica/source/include/actbl.h @@ -382,6 +382,7 @@ typedef struct acpi_table_fadt ACPI_GENERIC_ADDRESS XGpe1Block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ ACPI_GENERIC_ADDRESS SleepControl; /* 64-bit Sleep Control register (ACPI 5.0) */ ACPI_GENERIC_ADDRESS SleepStatus; /* 64-bit Sleep Status register (ACPI 5.0) */ + UINT64 HypervisorId; /* Hypervisor Vendor ID (ACPI 6.0) */ } ACPI_TABLE_FADT; @@ -441,7 +442,7 @@ enum AcpiPreferredPmProfiles PM_TABLET = 8 }; -/* Values for SleepStatus and SleepControl registers (V5 FADT) */ +/* Values for SleepStatus and SleepControl registers (V5+ FADT) */ #define ACPI_X_WAKE_STATUS 0x80 #define ACPI_X_SLEEP_TYPE_MASK 0x1C @@ -506,15 +507,17 @@ typedef struct acpi_table_desc * FADT is the bottom line as to what the version really is. * * For reference, the values below are as follows: - * FADT V1 size: 0x074 - * FADT V2 size: 0x084 - * FADT V3 size: 0x0F4 - * FADT V4 size: 0x0F4 - * FADT V5 size: 0x10C + * FADT V1 size: 0x074 + * FADT V2 size: 0x084 + * FADT V3 size: 0x0F4 + * FADT V4 size: 0x0F4 + * FADT V5 size: 0x10C + * FADT V6 size: 0x114 */ #define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4) #define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (MinorRevision) + 1) #define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl)) -#define ACPI_FADT_V5_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) +#define ACPI_FADT_V5_SIZE (UINT32) (ACPI_FADT_OFFSET (HypervisorId)) +#define ACPI_FADT_V6_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) #endif /* __ACTBL_H__ */ diff --git a/src/acpica/source/include/actbl1.h b/src/acpica/source/include/actbl1.h index 2c8b0ed..1c508a0 100644 --- a/src/acpica/source/include/actbl1.h +++ b/src/acpica/source/include/actbl1.h @@ -145,6 +145,7 @@ #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ +#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */ /* @@ -849,7 +850,8 @@ enum AcpiMadtType ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13, ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14, - ACPI_MADT_TYPE_RESERVED = 15 /* 15 and greater are reserved */ + ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15, + ACPI_MADT_TYPE_RESERVED = 16 /* 16 and greater are reserved */ }; @@ -1004,7 +1006,7 @@ typedef struct acpi_madt_local_x2apic_nmi } ACPI_MADT_LOCAL_X2APIC_NMI; -/* 11: Generic Interrupt (ACPI 5.0) */ +/* 11: Generic Interrupt (ACPI 5.0 + ACPI 6.0 changes) */ typedef struct acpi_madt_generic_interrupt { @@ -1022,6 +1024,8 @@ typedef struct acpi_madt_generic_interrupt UINT32 VgicInterrupt; UINT64 GicrBaseAddress; UINT64 ArmMpidr; + UINT8 EfficiencyClass; + UINT8 Reserved2[3]; } ACPI_MADT_GENERIC_INTERRUPT; @@ -1032,7 +1036,7 @@ typedef struct acpi_madt_generic_interrupt #define ACPI_MADT_VGIC_IRQ_MODE (1<<2) /* 02: VGIC Maintenance Interrupt mode */ -/* 12: Generic Distributor (ACPI 5.0) */ +/* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */ typedef struct acpi_madt_generic_distributor { @@ -1041,7 +1045,8 @@ typedef struct acpi_madt_generic_distributor UINT32 GicId; UINT64 BaseAddress; UINT32 GlobalIrqBase; - UINT32 Reserved2; /* Reserved - must be zero */ + UINT8 Version; + UINT8 Reserved2[3]; /* Reserved - must be zero */ } ACPI_MADT_GENERIC_DISTRIBUTOR; @@ -1077,6 +1082,19 @@ typedef struct acpi_madt_generic_redistributor } ACPI_MADT_GENERIC_REDISTRIBUTOR; +/* 15: Generic Translator (ACPI 6.0) */ + +typedef struct acpi_madt_generic_translator +{ + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; /* reserved - must be zero */ + UINT32 TranslationId; + UINT64 BaseAddress; + UINT32 Reserved2; + +} ACPI_MADT_GENERIC_TRANSLATOR; + + /* * Common flags fields for MADT subtables */ @@ -1137,6 +1155,186 @@ typedef struct acpi_msct_proximity /******************************************************************************* * + * NFIT - NVDIMM Interface Table (ACPI 6.0) + * Version 1 + * + ******************************************************************************/ + +typedef struct acpi_table_nfit +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 Reserved; /* Reserved, must be zero */ + +} ACPI_TABLE_NFIT; + +/* Subtable header for NFIT */ + +typedef struct acpi_nfit_header +{ + UINT16 Type; + UINT16 Length; + +} ACPI_NFIT_HEADER; + + +/* Values for subtable type in ACPI_NFIT_HEADER */ + +enum AcpiNfitType +{ + ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0, + ACPI_NFIT_TYPE_MEMORY_MAP = 1, + ACPI_NFIT_TYPE_INTERLEAVE = 2, + ACPI_NFIT_TYPE_SMBIOS = 3, + ACPI_NFIT_TYPE_CONTROL_REGION = 4, + ACPI_NFIT_TYPE_DATA_REGION = 5, + ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6, + ACPI_NFIT_TYPE_RESERVED = 7 /* 7 and greater are reserved */ +}; + +/* + * NFIT Subtables + */ + +/* 0: System Physical Address Range Structure */ + +typedef struct acpi_nfit_system_address +{ + ACPI_NFIT_HEADER Header; + UINT16 RangeIndex; + UINT16 Flags; + UINT32 Reserved; /* Reseved, must be zero */ + UINT32 ProximityDomain; + UINT8 RangeGuid[16]; + UINT64 Address; + UINT64 Length; + UINT64 MemoryMapping; + +} ACPI_NFIT_SYSTEM_ADDRESS; + +/* Flags */ + +#define ACPI_NFIT_ADD_ONLINE_ONLY (1) /* 00: Add/Online Operation Only */ +#define ACPI_NFIT_PROXIMITY_VALID (1<<1) /* 01: Proximity Domain Valid */ + +/* Range Type GUIDs appear in the include/acuuid.h file */ + + +/* 1: Memory Device to System Address Range Map Structure */ + +typedef struct acpi_nfit_memory_map +{ + ACPI_NFIT_HEADER Header; + UINT32 DeviceHandle; + UINT16 PhysicalId; + UINT16 RegionId; + UINT16 RangeIndex; + UINT16 RegionIndex; + UINT64 RegionSize; + UINT64 RegionOffset; + UINT64 Address; + UINT16 InterleaveIndex; + UINT16 InterleaveWays; + UINT16 Flags; + UINT16 Reserved; /* Reserved, must be zero */ + +} ACPI_NFIT_MEMORY_MAP; + +/* Flags */ + +#define ACPI_NFIT_MEM_SAVE_FAILED (1) /* 00: Last SAVE to Memory Device failed */ +#define ACPI_NFIT_MEM_RESTORE_FAILED (1<<1) /* 01: Last RESTORE from Memory Device failed */ +#define ACPI_NFIT_MEM_FLUSH_FAILED (1<<2) /* 02: Platform flush failed */ +#define ACPI_NFIT_MEM_ARMED (1<<3) /* 03: Memory Device observed to be not armed */ +#define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */ +#define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */ + + +/* 2: Interleave Structure */ + +typedef struct acpi_nfit_interleave +{ + ACPI_NFIT_HEADER Header; + UINT16 InterleaveIndex; + UINT16 Reserved; /* Reserved, must be zero */ + UINT32 LineCount; + UINT32 LineSize; + UINT32 LineOffset[1]; /* Variable length */ + +} ACPI_NFIT_INTERLEAVE; + + +/* 3: SMBIOS Management Information Structure */ + +typedef struct acpi_nfit_smbios +{ + ACPI_NFIT_HEADER Header; + UINT32 Reserved; /* Reserved, must be zero */ + UINT8 Data[1]; /* Variable length */ + +} ACPI_NFIT_SMBIOS; + + +/* 4: NVDIMM Control Region Structure */ + +typedef struct acpi_nfit_control_region +{ + ACPI_NFIT_HEADER Header; + UINT16 RegionIndex; + UINT16 VendorId; + UINT16 DeviceId; + UINT16 RevisionId; + UINT16 SubsystemVendorId; + UINT16 SubsystemDeviceId; + UINT16 SubsystemRevisionId; + UINT8 Reserved[6]; /* Reserved, must be zero */ + UINT32 SerialNumber; + UINT16 Code; + UINT16 Windows; + UINT64 WindowSize; + UINT64 CommandOffset; + UINT64 CommandSize; + UINT64 StatusOffset; + UINT64 StatusSize; + UINT16 Flags; + UINT8 Reserved1[6]; /* Reserved, must be zero */ + +} ACPI_NFIT_CONTROL_REGION; + +/* Flags */ + +#define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */ + + +/* 5: NVDIMM Block Data Window Region Structure */ + +typedef struct acpi_nfit_data_region +{ + ACPI_NFIT_HEADER Header; + UINT16 RegionIndex; + UINT16 Windows; + UINT64 Offset; + UINT64 Size; + UINT64 Capacity; + UINT64 StartAddress; + +} ACPI_NFIT_DATA_REGION; + + +/* 6: Flush Hint Address Structure */ + +typedef struct acpi_nfit_flush_address +{ + ACPI_NFIT_HEADER Header; + UINT32 DeviceHandle; + UINT16 HintCount; + UINT8 Reserved[6]; /* Reserved, must be zero */ + UINT64 HintAddress[1]; /* Variable length */ + +} ACPI_NFIT_FLUSH_ADDRESS; + + +/******************************************************************************* + * * SBST - Smart Battery Specification Table * Version 1 * @@ -1274,6 +1472,7 @@ typedef struct acpi_srat_gicc_affinity #define ACPI_SRAT_GICC_ENABLED (1) /* 00: Use affinity structure */ + /* Reset to default packing */ #pragma pack() diff --git a/src/acpica/source/include/actbl2.h b/src/acpica/source/include/actbl2.h index df0cfb1..acc0b5f 100644 --- a/src/acpica/source/include/actbl2.h +++ b/src/acpica/source/include/actbl2.h @@ -143,6 +143,7 @@ #define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ #define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ +#define ACPI_SIG_IORT "IORT" /* IO Remapping Table */ #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ #define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */ #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ @@ -824,6 +825,156 @@ typedef struct acpi_ibft_target /******************************************************************************* * + * IORT - IO Remapping Table + * + * Conforms to "IO Remapping Table System Software on ARM Platforms", + * Document number: ARM DEN 0049A, 2015 + * + ******************************************************************************/ + +typedef struct acpi_table_iort +{ + ACPI_TABLE_HEADER Header; + UINT32 NodeCount; + UINT32 NodeOffset; + UINT32 Reserved; + +} ACPI_TABLE_IORT; + + +/* + * IORT subtables + */ +typedef struct acpi_iort_node +{ + UINT8 Type; + UINT16 Length; + UINT8 Revision; + UINT32 Reserved; + UINT32 MappingCount; + UINT32 MappingOffset; + char NodeData[1]; + +} ACPI_IORT_NODE; + +/* Values for subtable Type above */ + +enum AcpiIortNodeType +{ + ACPI_IORT_NODE_ITS_GROUP = 0x00, + ACPI_IORT_NODE_NAMED_COMPONENT = 0x01, + ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02, + ACPI_IORT_NODE_SMMU = 0x03 +}; + + +typedef struct acpi_iort_id_mapping +{ + UINT32 InputBase; /* Lowest value in input range */ + UINT32 IdCount; /* Number of IDs */ + UINT32 OutputBase; /* Lowest value in output range */ + UINT32 OutputReference; /* A reference to the output node */ + UINT32 Flags; + +} ACPI_IORT_ID_MAPPING; + +/* Masks for Flags field above for IORT subtable */ + +#define ACPI_IORT_ID_SINGLE_MAPPING (1) + + +typedef struct acpi_iort_memory_access +{ + UINT32 CacheCoherency; + UINT8 Hints; + UINT16 Reserved; + UINT8 MemoryFlags; + +} ACPI_IORT_MEMORY_ACCESS; + +/* Values for CacheCoherency field above */ + +#define ACPI_IORT_NODE_COHERENT 0x00000001 /* The device node is fully coherent */ +#define ACPI_IORT_NODE_NOT_COHERENT 0x00000000 /* The device node is not coherent */ + +/* Masks for Hints field above */ + +#define ACPI_IORT_HT_TRANSIENT (1) +#define ACPI_IORT_HT_WRITE (1<<1) +#define ACPI_IORT_HT_READ (1<<2) +#define ACPI_IORT_HT_OVERRIDE (1<<3) + +/* Masks for MemoryFlags field above */ + +#define ACPI_IORT_MF_COHERENCY (1) +#define ACPI_IORT_MF_ATTRIBUTES (1<<1) + + +/* + * IORT node specific subtables + */ +typedef struct acpi_iort_its_group +{ + UINT32 ItsCount; + UINT32 Identifiers[1]; /* GIC ITS identifier arrary */ + +} ACPI_IORT_ITS_GROUP; + + +typedef struct acpi_iort_named_component +{ + UINT32 NodeFlags; + UINT64 MemoryProperties; /* Memory access properties */ + UINT8 MemoryAddressLimit; /* Memory address size limit */ + char DeviceName[1]; /* Path of namespace object */ + +} ACPI_IORT_NAMED_COMPONENT; + + +typedef struct acpi_iort_root_complex +{ + UINT64 MemoryProperties; /* Memory access properties */ + UINT32 AtsAttribute; + UINT32 PciSegmentNumber; + +} ACPI_IORT_ROOT_COMPLEX; + +/* Values for AtsAttribute field above */ + +#define ACPI_IORT_ATS_SUPPORTED 0x00000001 /* The root complex supports ATS */ +#define ACPI_IORT_ATS_UNSUPPORTED 0x00000000 /* The root complex doesn't support ATS */ + + +typedef struct acpi_iort_smmu +{ + UINT64 BaseAddress; /* SMMU base address */ + UINT64 Span; /* Length of memory range */ + UINT32 Model; + UINT32 Flags; + UINT32 GlobalInterruptOffset; + UINT32 ContextInterruptCount; + UINT32 ContextInterruptOffset; + UINT32 PmuInterruptCount; + UINT32 PmuInterruptOffset; + UINT64 Interrupts[1]; /* Interrupt array */ + +} ACPI_IORT_SMMU; + +/* Values for Model field above */ + +#define ACPI_IORT_SMMU_V1 0x00000000 /* Generic SMMUv1 */ +#define ACPI_IORT_SMMU_V2 0x00000001 /* Generic SMMUv2 */ +#define ACPI_IORT_SMMU_CORELINK_MMU400 0x00000002 /* ARM Corelink MMU-400 */ +#define ACPI_IORT_SMMU_CORELINK_MMU500 0x00000003 /* ARM Corelink MMU-500 */ + +/* Masks for Flags field above */ + +#define ACPI_IORT_SMMU_DVM_SUPPORTED (1) +#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1) + + +/******************************************************************************* + * * IVRS - I/O Virtualization Reporting Structure * Version 1 * @@ -1024,7 +1175,7 @@ typedef struct acpi_ivrs_memory * * LPIT - Low Power Idle Table * - * Conforms to "ACPI Low Power Idle Table (LPIT) and _LPD Proposal (DRAFT)" + * Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014. * ******************************************************************************/ @@ -1052,8 +1203,7 @@ typedef struct acpi_lpit_header enum AcpiLpitType { ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00, - ACPI_LPIT_TYPE_SIMPLE_IO = 0x01, - ACPI_LPIT_TYPE_RESERVED = 0x02 /* 2 and above are reserved */ + ACPI_LPIT_TYPE_RESERVED = 0x01 /* 1 and above are reserved */ }; /* Masks for Flags field above */ @@ -1079,24 +1229,6 @@ typedef struct acpi_lpit_native } ACPI_LPIT_NATIVE; -/* 0x01: Simple I/O based LPI structure */ - -typedef struct acpi_lpit_io -{ - ACPI_LPIT_HEADER Header; - ACPI_GENERIC_ADDRESS EntryTrigger; - UINT32 TriggerAction; - UINT64 TriggerValue; - UINT64 TriggerMask; - ACPI_GENERIC_ADDRESS MinimumIdleState; - UINT32 Residency; - UINT32 Latency; - ACPI_GENERIC_ADDRESS ResidencyCounter; - UINT64 CounterFrequency; - -} ACPI_LPIT_IO; - - /******************************************************************************* * * MCFG - PCI Memory Mapped Configuration table and subtable diff --git a/src/acpica/source/include/actbl3.h b/src/acpica/source/include/actbl3.h index b4ce8af..88ac753 100644 --- a/src/acpica/source/include/actbl3.h +++ b/src/acpica/source/include/actbl3.h @@ -142,7 +142,10 @@ #define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */ #define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */ #define ACPI_SIG_RASF "RASF" /* RAS Feature table */ +#define ACPI_SIG_STAO "STAO" /* Status Override table */ #define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */ +#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ +#define ACPI_SIG_XENV "XENV" /* Xen Environment table */ #define ACPI_SIG_S3PT "S3PT" /* S3 Performance (sub)Table */ #define ACPI_SIG_PCCS "PCC" /* PCC Shared Memory Region */ @@ -151,7 +154,6 @@ #define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */ #define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ -#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ /* * All tables must be byte-packed to match the ACPI specification, since @@ -195,6 +197,8 @@ typedef struct acpi_table_bgrt /******************************************************************************* * * DRTM - Dynamic Root of Trust for Measurement table + * Conforms to "TCG D-RTM Architecture" June 17 2013, Version 1.0.0 + * Table version 1 * ******************************************************************************/ @@ -213,29 +217,50 @@ typedef struct acpi_table_drtm } ACPI_TABLE_DRTM; -/* 1) Validated Tables List */ +/* Flag Definitions for above */ + +#define ACPI_DRTM_ACCESS_ALLOWED (1) +#define ACPI_DRTM_ENABLE_GAP_CODE (1<<1) +#define ACPI_DRTM_INCOMPLETE_MEASUREMENTS (1<<2) +#define ACPI_DRTM_AUTHORITY_ORDER (1<<3) -typedef struct acpi_drtm_vtl_list + +/* 1) Validated Tables List (64-bit addresses) */ + +typedef struct acpi_drtm_vtable_list { - UINT32 ValidatedTableListCount; + UINT32 ValidatedTableCount; + UINT64 ValidatedTables[1]; + +} ACPI_DRTM_VTABLE_LIST; -} ACPI_DRTM_VTL_LIST; +/* 2) Resources List (of Resource Descriptors) */ -/* 2) Resources List */ +/* Resource Descriptor */ + +typedef struct acpi_drtm_resource +{ + UINT8 Size[7]; + UINT8 Type; + UINT64 Address; + +} ACPI_DRTM_RESOURCE; typedef struct acpi_drtm_resource_list { - UINT32 ResourceListCount; + UINT32 ResourceCount; + ACPI_DRTM_RESOURCE Resources[1]; } ACPI_DRTM_RESOURCE_LIST; /* 3) Platform-specific Identifiers List */ -typedef struct acpi_drtm_id_list +typedef struct acpi_drtm_dps_id { - UINT32 IdListCount; + UINT32 DpsIdLength; + UINT8 DpsId[16]; -} ACPI_DRTM_ID_LIST; +} ACPI_DRTM_DPS_ID; /******************************************************************************* @@ -877,6 +902,24 @@ enum AcpiRasfStatus /******************************************************************************* * + * STAO - Status Override Table (_STA override) - ACPI 6.0 + * Version 1 + * + * Conforms to "ACPI Specification for Status Override Table" + * 6 January 2015 + * + ******************************************************************************/ + +typedef struct acpi_table_stao +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 IgnoreUart; + +} ACPI_TABLE_STAO; + + +/******************************************************************************* + * * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table * Version 3 * @@ -910,6 +953,47 @@ typedef struct acpi_tpm2_control } ACPI_TPM2_CONTROL; +/******************************************************************************* + * + * WPBT - Windows Platform Environment Table (ACPI 6.0) + * Version 1 + * + * Conforms to "Windows Platform Binary Table (WPBT)" 29 November 2011 + * + ******************************************************************************/ + +typedef struct acpi_table_wpbt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 HandoffSize; + UINT64 HandoffAddress; + UINT8 Layout; + UINT8 Type; + UINT16 ArgumentsLength; + +} ACPI_TABLE_WPBT; + + +/******************************************************************************* + * + * XENV - Xen Environment Table (ACPI 6.0) + * Version 1 + * + * Conforms to "ACPI Specification for Xen Environment Table" 4 January 2015 + * + ******************************************************************************/ + +typedef struct acpi_table_xenv +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT64 GrantTableAddress; + UINT64 GrantTableSize; + UINT32 EventInterrupt; + UINT8 EventFlags; + +} ACPI_TABLE_XENV; + + /* Reset to default packing */ #pragma pack() diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h index 2c7d1bb..98fcf48 100644 --- a/src/acpica/source/include/actypes.h +++ b/src/acpica/source/include/actypes.h @@ -610,6 +610,7 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (p)) #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (ACPI_UINTPTR_T) (p)) #define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b))) +#define ACPI_SUB_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b))) #define ACPI_PTR_DIFF(a, b) (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b))) /* Pointer/Integer type conversions */ diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h index 2b3dad4..93edeee 100644 --- a/src/acpica/source/include/acutils.h +++ b/src/acpica/source/include/acutils.h @@ -411,7 +411,7 @@ extern const UINT8 _acpi_ctype[]; #define _ACPI_DI 0x04 /* '0'-'9' */ #define _ACPI_LO 0x02 /* 'a'-'z' */ #define _ACPI_PU 0x10 /* punctuation */ -#define _ACPI_SP 0x08 /* space */ +#define _ACPI_SP 0x08 /* space, tab, CR, LF, VT, FF */ #define _ACPI_UP 0x01 /* 'A'-'Z' */ #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ diff --git a/src/acpica/source/include/platform/acenv.h b/src/acpica/source/include/platform/acenv.h index 83ac402..f596d8c 100644 --- a/src/acpica/source/include/platform/acenv.h +++ b/src/acpica/source/include/platform/acenv.h @@ -247,6 +247,9 @@ #elif defined(_APPLE) || defined(__APPLE__) #include "acmacosx.h" +#elif defined(__DragonFly__) +#include "acdragonfly.h" + #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include "acfreebsd.h" diff --git a/src/acpica/source/include/platform/acenvex.h b/src/acpica/source/include/platform/acenvex.h index 6c59337..26467b9 100644 --- a/src/acpica/source/include/platform/acenvex.h +++ b/src/acpica/source/include/platform/acenvex.h @@ -128,6 +128,9 @@ #if defined(_LINUX) || defined(__linux__) #include "aclinuxex.h" +#elif defined(__DragonFly__) +#include "acdragonflyex.h" + #endif /*! [End] no source code translation !*/ -- 2.1.4 From colin.king at canonical.com Wed May 20 09:11:02 2015 From: colin.king at canonical.com (Colin Ian King) Date: Wed, 20 May 2015 10:11:02 +0100 Subject: New fwts-dicuss mailing list Message-ID: <555C4FA6.3050808@canonical.com> == Announcement == A new fwts-discuss at lists.ubuntu.com has been created for general Firmware Test Suite related discussions. Email from other related firmware projects may be cross-posted to this as long as they are vaguely related to fwts. From jk at ozlabs.org Thu May 21 07:15:07 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 15:15:07 +0800 Subject: [PATCH 2/3] fwts: Add file_open_and_read_binary In-Reply-To: <1432192507.646890.191605150773.1.gpush@pablo> Message-ID: <1432192507.647307.559425639333.2.gpush@pablo> Add a function to open and read a binary file in a single chunk. Signed-off-by: Jeremy Kerr --- src/lib/include/fwts_fileio.h | 1 src/lib/src/fwts_fileio.c | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/lib/include/fwts_fileio.h b/src/lib/include/fwts_fileio.h index 33b727b..e9fdced 100644 --- a/src/lib/include/fwts_fileio.h +++ b/src/lib/include/fwts_fileio.h @@ -24,5 +24,6 @@ fwts_list* fwts_file_read(FILE *fp); fwts_list* fwts_file_open_and_read(const char *file); +int fwts_file_open_and_read_binary(const char *file, char **buf, size_t *len); #endif diff --git a/src/lib/src/fwts_fileio.c b/src/lib/src/fwts_fileio.c index ca99631..5875a32 100644 --- a/src/lib/src/fwts_fileio.c +++ b/src/lib/src/fwts_fileio.c @@ -17,6 +17,7 @@ * */ +#include #include #include #include @@ -61,3 +62,47 @@ fwts_list* fwts_file_open_and_read(const char *file) return list; } + +int fwts_file_open_and_read_binary(const char *file, char **buf, size_t *len) +{ + size_t tmplen; + char *tmpbuf; + long pos; + FILE *fp; + int rc; + + if ((fp = fopen(file, "rb")) == NULL) + return FWTS_ERROR; + + rc = fseek(fp, 0, SEEK_END); + if (rc) { + rc = FWTS_ERROR; + goto out; + } + + pos = ftell(fp); + if (pos < 0) { + rc = FWTS_ERROR; + goto out; + } + + rewind(fp); + + tmpbuf = malloc(pos); + assert(tmpbuf); + + tmplen = fread(tmpbuf, 1, pos, fp); + if (tmplen != (size_t)pos) { + free(tmpbuf); + rc = FWTS_ERROR; + goto out; + } + + rc = FWTS_OK; + *buf = tmpbuf; + *len = tmplen; + +out: + fclose(fp); + return rc; +} From jk at ozlabs.org Thu May 21 07:15:07 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 15:15:07 +0800 Subject: [PATCH 3/3] devicetree/dt_sysinfo: Add device tree system information tests In-Reply-To: <1432192507.646890.191605150773.1.gpush@pablo> Message-ID: <1432192507.647628.90360957379.3.gpush@pablo> Check that we have some basic system identifier properties. Signed-off-by: Jeremy Kerr --- src/Makefile.am | 1 src/devicetree/dt_sysinfo/dt_sysinfo.c | 137 +++++++++++++++++++++++++ 2 files changed, 138 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index 4a2622b..c0a8104 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -79,6 +79,7 @@ fwts_SOURCES = main.c \ cpu/msr/msr.c \ cpu/microcode/microcode.c \ devicetree/dtc/dtc.c \ + devicetree/dt_sysinfo/dt_sysinfo.c \ dmi/dmicheck/dmicheck.c \ hotkey/hotkey/hotkey.c \ hpet/hpet_check/hpet_check.c \ diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c new file mode 100644 index 0000000..aa5514c --- /dev/null +++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2014 Jeremy Kerr + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + * + */ + +#define _GNU_SOURCE +#include +#include +#include + +#include "fwts.h" + +static const char *devicetree_path = "/proc/device-tree"; + +static int read_property(const char *name, char **buf, size_t *len) +{ + char *path; + int rc; + + rc = asprintf(&path, "%s/%s", devicetree_path, name); + assert(rc > 0); + + rc = fwts_file_open_and_read_binary(path, buf, len); + free(path); + + return rc; +} + +static int check_property_printable(fwts_framework *fw, const char *name, + char *buf, size_t len) +{ + bool printable = true; + unsigned int i; + int rc; + + /* we need at least one character plus a nul */ + if (len < 2) { + fwts_failed(fw, LOG_LEVEL_LOW, "DTPrintablePropertyShort", + "property %s is too short", name); + rc = FWTS_ERROR; + goto out; + } + + /* check all characters are printable */ + for (i = 0; i < len - 1; i++) { + printable = printable && isprint(buf[i]); + if (!printable) + break; + } + + if (!printable) { + fwts_failed(fw, LOG_LEVEL_LOW, "DTPrintablePropertyInvalid", + "property %s contains unprintable characters", + name); + rc = FWTS_ERROR; + goto out; + } + + /* check for a trailing nul */ + if (buf[len-1] != '\0') { + fwts_failed(fw, LOG_LEVEL_LOW, "DTPrintablePropertyNoNul", + "property %s isn't nul-terminated", name); + rc = FWTS_ERROR; + } + + rc = FWTS_OK; + +out: + return rc; +} + +static int dt_sysinfo_check_property(fwts_framework *fw, const char *name) +{ + size_t len; + char *buf; + int rc; + + rc = read_property(name, &buf, &len); + if (rc != FWTS_OK) { + fwts_failed(fw, LOG_LEVEL_LOW, "DTSyinfoPropertyMissing", + "property %s is missing", name); + return rc; + } + + rc = check_property_printable(fw, name, buf, len); + free(buf); + + if (rc == FWTS_OK) + fwts_passed(fw, "Sysinfo property %s is valid", name); + + return rc; +} + +static int dt_sysinfo_check_vendor(fwts_framework *fw) +{ + return dt_sysinfo_check_property(fw, "vendor"); +} + +static int dt_sysinfo_check_model(fwts_framework *fw) +{ + return dt_sysinfo_check_property(fw, "model"); +} + +static int dt_sysinfo_check_name(fwts_framework *fw) +{ + return dt_sysinfo_check_property(fw, "name"); +} + +static fwts_framework_minor_test dt_sysinfo_tests[] = { + { dt_sysinfo_check_name, "Check name property" }, + { dt_sysinfo_check_vendor, "Check vendor property" }, + { dt_sysinfo_check_model, "Check model property" }, + { NULL, NULL }, +}; + +static fwts_framework_ops dt_sysinfo_ops = { + .description = "Device tree system information test", + .minor_tests = dt_sysinfo_tests, +}; + +FWTS_REGISTER_FEATURES("dt_sysinfo", &dt_sysinfo_ops, FWTS_TEST_ANYTIME, + FWTS_FLAG_BATCH, FWTS_FW_FEATURE_DEVICETREE); From jk at ozlabs.org Thu May 21 07:15:07 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 15:15:07 +0800 Subject: [PATCH 1/3] devicetree/dtc: Add initial device tree test Message-ID: <1432192507.646890.191605150773.1.gpush@pablo> Check that we can compile the device tree with dtc. Signed-off-by: Jeremy Kerr --- src/Makefile.am | 1 src/devicetree/dtc/dtc.c | 76 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/src/Makefile.am b/src/Makefile.am index 62c63ef..4a2622b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -78,6 +78,7 @@ fwts_SOURCES = main.c \ cpu/nx/nx.c \ cpu/msr/msr.c \ cpu/microcode/microcode.c \ + devicetree/dtc/dtc.c \ dmi/dmicheck/dmicheck.c \ hotkey/hotkey/hotkey.c \ hpet/hpet_check/hpet_check.c \ diff --git a/src/devicetree/dtc/dtc.c b/src/devicetree/dtc/dtc.c new file mode 100644 index 0000000..c1420dc --- /dev/null +++ b/src/devicetree/dtc/dtc.c @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2014 Jeremy Kerr + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + * + */ + +#define _GNU_SOURCE +#include +#include + +#include "fwts.h" + +static const char *devicetree_path = "/proc/device-tree"; + +static int dtc_check_valid(fwts_framework *fw) +{ + int rc, status; + char *command; + + rc = asprintf(&command, "dtc -I fs -o /dev/null %s", devicetree_path); + assert(rc > 0); + + rc = fwts_exec(command, &status); + free(command); + + if (rc != FWTS_OK || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { + fwts_failed(fw, LOG_LEVEL_HIGH, "DeviceTreeDtcParseFail", + "dtc reports device tree errors"); + return FWTS_ERROR; + } + + fwts_passed(fw, "dtc test passed"); + return FWTS_OK; +} + +static int dtc_init(fwts_framework *fw) +{ + int rc, status; + + rc = fwts_exec("echo '/dts-v1/; / { };' | dtc -o /dev/null", &status); + + if (rc != FWTS_OK || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { + fwts_aborted(fw, "Failed to run dtc"); + return FWTS_ABORTED; + } + + return FWTS_OK; +} + +static fwts_framework_minor_test dtc_tests[] = { + { dtc_check_valid, "Check device tree validity with dtc" }, + { NULL, NULL }, +}; + +static fwts_framework_ops dtc_ops = { + .description = "Device tree compilation test", + .minor_tests = dtc_tests, + .init = dtc_init, +}; + +FWTS_REGISTER_FEATURES("dtc", &dtc_ops, FWTS_TEST_ANYTIME, + FWTS_FLAG_BATCH, FWTS_FW_FEATURE_DEVICETREE); From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 01/11] cpu/cpufreq: Don't reparse cpu information In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.810604.396494529489.1.gpush@pablo> Currently, we do a whole lot of scanning the /sys/devices/system/cpu directory to parse cpu information, multiple times. This change does a parse once on ->init, and populates a structure of cpu info. The tests then query this structure instead of reparsing /sys. We remove the unnecessary sched_setaffinity when we change a core's cpu_frequency. Signed-off-by: Jeremy Kerr --- src/cpu/cpufreq/cpufreq.c | 561 +++++++++++++++----------------------- 1 file changed, 226 insertions(+), 335 deletions(-) diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c index ff3d112..9315d18 100644 --- a/src/cpu/cpufreq/cpufreq.c +++ b/src/cpu/cpufreq/cpufreq.c @@ -48,17 +48,32 @@ typedef struct { uint64_t speed; } fwts_cpu_freq; +struct cpu { + int idx; + char sysfs_path[PATH_MAX]; + bool online; + + int n_freqs; + fwts_cpu_freq freqs[MAX_FREQS]; + + /* saved state */ + char *orig_governor; + uint64_t orig_frequency; +}; + +static struct cpu *cpus; +static int num_cpus; static int number_of_speeds = -1; static int total_tests = 1; static int performed_tests = 0; static bool no_cpufreq = false; static uint64_t top_speed = 0; -static int num_cpus; #define GET_PERFORMANCE_MAX (0) #define GET_PERFORMANCE_MIN (1) #define GET_PERFORMANCE_AVG (2) + #define MAX_ABSOLUTE_ERROR 20.0 /* In Hz */ #define MAX_RELATIVE_ERROR 0.0025 /* as fraction */ @@ -90,65 +105,56 @@ static int hz_almost_equal(const uint64_t a, const uint64_t b) static inline void cpu_mkpath( char *const path, const int len, - const int cpu, + const struct cpu *cpu, const char *const name) { - snprintf(path, len, "%s/cpu%i/cpufreq/%s", FWTS_CPU_PATH, cpu, name); + snprintf(path, len, "%s/%s/cpufreq/%s", FWTS_CPU_PATH, + cpu->sysfs_path, name); } -static void set_governor(fwts_framework *fw, const int cpu) +static void cpu_set_governor(fwts_framework *fw, struct cpu *cpu, + const char *governor) { char path[PATH_MAX]; + int rc; cpu_mkpath(path, sizeof(path), cpu, "scaling_governor"); - - if (fwts_set("userspace", path) != FWTS_OK) { - if (!no_cpufreq) { - fwts_warning(fw, - "Cannot set CPU scaling governor to userspace scaling."); - no_cpufreq = true; - } + rc = fwts_set(governor, path); + if (rc != FWTS_OK && !no_cpufreq) { + fwts_warning(fw, "Cannot set CPU governor to %s.", governor); + no_cpufreq = true; } } -#ifdef FWTS_ARCH_INTEL -static int cpu_exists(const int cpu) +static void cpu_set_frequency(fwts_framework *fw, struct cpu *cpu, + uint64_t freq_hz) { char path[PATH_MAX]; + char buffer[64]; + int rc; - cpu_mkpath(path, sizeof(path), cpu, "scaling_governor"); - return !access(path, R_OK); + cpu_mkpath(path, sizeof(path), cpu, "scaling_setspeed"); + snprintf(buffer, sizeof(buffer), "%" PRIu64 , freq_hz); + rc = fwts_set(buffer, path); + if (rc != FWTS_OK) + fwts_warning(fw, "Cannot set CPU frequency to %s.", buffer); } -#endif -static void set_HZ(fwts_framework *fw, const int cpu, const uint64_t Hz) +static void cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu) { - cpu_set_t mask, oldset; - char path[PATH_MAX]; - char buffer[64]; - - /* First, go to the right cpu */ - - sched_getaffinity(0, sizeof(oldset), &oldset); - - CPU_ZERO(&mask); - CPU_SET(cpu, &mask); - sched_setaffinity(0, sizeof(mask), &mask); - - set_governor(fw, cpu); - - /* then set the speed */ - cpu_mkpath(path, sizeof(path), cpu, "scaling_setspeed"); - snprintf(buffer, sizeof(buffer), "%" PRIu64 , Hz); - fwts_set(buffer, path); + cpu_set_frequency(fw, cpu, cpu->freqs[0].Hz); +} - sched_setaffinity(0, sizeof(oldset), &oldset); +static void cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu) +{ + cpu_set_frequency(fw, cpu, cpu->freqs[cpu->n_freqs-1].Hz); } + #ifdef FWTS_ARCH_INTEL static int get_performance_repeat( fwts_framework *fw, - const int cpu, + struct cpu *cpu, const int count, const int type, uint64_t *retval) @@ -163,7 +169,7 @@ static int get_performance_repeat( for (i = 0; i < count; i++) { uint64_t temp; - if (fwts_cpu_performance(fw, cpu, &temp) != FWTS_OK) + if (fwts_cpu_performance(fw, cpu->idx, &temp) != FWTS_OK) return FWTS_ERROR; if (temp) { @@ -217,7 +223,7 @@ static char *hz_to_human(const uint64_t hz) } } -static uint64_t get_claimed_hz(const int cpu) +static uint64_t get_claimed_hz(struct cpu *cpu) { char path[PATH_MAX]; char *buffer; @@ -232,7 +238,7 @@ static uint64_t get_claimed_hz(const int cpu) return value; } -static uint64_t get_bios_limit(const int cpu) +static uint64_t get_bios_limit(struct cpu *cpu) { char path[PATH_MAX]; char *buffer; @@ -247,71 +253,20 @@ static uint64_t get_bios_limit(const int cpu) return value; } -static int cpu_freq_compare(const void *v1, const void *v2) +static void do_cpu(fwts_framework *fw, struct cpu *cpu) { - const fwts_cpu_freq *cpu_freq1 = (fwts_cpu_freq *)v1; - const fwts_cpu_freq *cpu_freq2 = (fwts_cpu_freq *)v2; - - /* - * Some _PSS states can be the same or very nearly - * the same when Turbo mode is available, - * so if they are we also differentiate the two by - * the speed to get a fully sorted ordering - */ - if (hz_almost_equal(cpu_freq1->Hz, cpu_freq2->Hz)) - return cpu_freq1->speed - cpu_freq2->speed; - else - return cpu_freq1->Hz - cpu_freq2->Hz; -} - -static int read_freqs_available(const int cpu, fwts_cpu_freq *freqs) -{ - char path[PATH_MAX]; - char line[4096]; - FILE *file; - char *c, *c2; - int i = 0; - - memset(line, 0, sizeof(line)); - cpu_mkpath(path, sizeof(path), cpu, "scaling_available_frequencies"); - if ((file = fopen(path, "r")) == NULL) - return 0; - c = fgets(line, 4095, file); - fclose(file); - if (!c) - return 0; - - while ((i < MAX_FREQS) && c && strlen(c) > 1) { - c2 = strchr(c, ' '); - if (c2) { - *c2 = 0; - c2++; - } else - c2 = NULL; - - freqs[i].Hz = strtoull(c, NULL, 10); - c = c2; - i++; - } - return i; -} - -static void do_cpu(fwts_framework *fw, const int cpu) -{ - fwts_cpu_freq freqs[MAX_FREQS]; - int i, speedcount; + int i; static int warned = 0; bool warned_PSS = false; - uint64_t cpu_top_speed = 1; + uint64_t cpu_top_perf = 0; int claimed_hz_too_low = 0; int bios_limit_too_low = 0; const uint64_t claimed_hz = get_claimed_hz(cpu); const uint64_t bios_limit = get_bios_limit(cpu); - memset(freqs, 0, sizeof(freqs)); - set_governor(fw, cpu); + cpu_set_governor(fw, cpu, "userspace"); - if ((speedcount = read_freqs_available(cpu, freqs)) == 0) { + if (cpu->n_freqs == 0) { if (!no_cpufreq) { char path[PATH_MAX]; char *driver; @@ -330,30 +285,32 @@ static void do_cpu(fwts_framework *fw, const int cpu) return; } if (total_tests == 1) - total_tests = ((2 + speedcount) * num_cpus) + 4; + total_tests = ((2 + cpu->n_freqs) * num_cpus) + 2; - for (i = 0; i < speedcount; i++) { - set_HZ(fw, cpu, freqs[i].Hz); + for (i = 0; i < cpu->n_freqs; i++) { + cpu_set_frequency(fw, cpu, cpu->freqs[i].Hz); - if ((claimed_hz != 0) && (claimed_hz < freqs[i].Hz)) + if ((claimed_hz != 0) && (claimed_hz < cpu->freqs[i].Hz)) claimed_hz_too_low++; - if ((bios_limit != 0) && (bios_limit < freqs[i].Hz)) + if ((bios_limit != 0) && (bios_limit < cpu->freqs[i].Hz)) bios_limit_too_low++; - if (fwts_cpu_performance(fw, cpu, &freqs[i].speed) != FWTS_OK) { + if (fwts_cpu_performance(fw, cpu->idx, &cpu->freqs[i].speed) + != FWTS_OK) { fwts_log_error(fw, "Failed to get CPU performance for " - "CPU frequency %" PRIu64 " Hz.", freqs[i].Hz); - freqs[i].speed = 0; + "CPU frequency %" PRId64 " Hz.", + cpu->freqs[i].Hz); + cpu->freqs[i].speed = 0; } - if (freqs[i].speed > cpu_top_speed) - cpu_top_speed = freqs[i].speed; + if (cpu->freqs[i].speed > cpu_top_perf) + cpu_top_perf = cpu->freqs[i].speed; performed_tests++; fwts_progress(fw, 100 * performed_tests/total_tests); } - if (cpu_top_speed > top_speed) - top_speed = cpu_top_speed; + if (cpu_top_perf > top_speed) + top_speed = cpu_top_perf; if (claimed_hz_too_low) { char path[PATH_MAX]; @@ -363,7 +320,8 @@ static void do_cpu(fwts_framework *fw, const int cpu) "There were %d CPU frequencies larger than the _PSS " "maximum CPU frequency of %s for CPU %d. Has %s " "been set too low?", - claimed_hz_too_low, hz_to_human(claimed_hz), cpu, path); + claimed_hz_too_low, hz_to_human(claimed_hz), + cpu->idx, path); } if (bios_limit_too_low) { @@ -373,137 +331,72 @@ static void do_cpu(fwts_framework *fw, const int cpu) fwts_warning(fw, "The CPU frequency BIOS limit %s for CPU %d was set to %s " "which is lower than some of the ACPI scaling frequencies.", - path, cpu, hz_to_human(bios_limit)); + path, cpu->idx, hz_to_human(bios_limit)); } if (claimed_hz_too_low || bios_limit_too_low) fwts_log_nl(fw); - fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", cpu, speedcount); + fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", + cpu->idx, cpu->n_freqs); fwts_log_info_verbatum(fw, " Frequency | Relative Speed | Bogo loops"); fwts_log_info_verbatum(fw, "-----------+----------------+-----------"); - for (i = 0; i < speedcount; i++) { + for (i = 0; i < cpu->n_freqs; i++) { char *turbo = ""; #ifdef FWTS_ARCH_INTEL - if ((i == 0) && (speedcount > 1) && - (hz_almost_equal(freqs[i].Hz, freqs[i + 1].Hz))) + if ((i == 0) && (cpu->n_freqs > 1) && + (hz_almost_equal(cpu->freqs[i].Hz, cpu->freqs[i + 1].Hz))) turbo = " (Turbo Boost)"; #endif - - fwts_log_info_verbatum(fw, "%10s | %5.1f %% | %9" PRIu64 "%s", - hz_to_human(freqs[i].Hz), - 100.0 * freqs[i].speed/cpu_top_speed, - freqs[i].speed, - turbo); + fwts_log_info_verbatum(fw, "%10s | %5.1f %% | %9" PRIu64 + "%s", + hz_to_human(cpu->freqs[i].Hz), + 100.0 * cpu->freqs[i].speed / cpu_top_perf, + cpu->freqs[i].speed, turbo); } if (number_of_speeds == -1) - number_of_speeds = speedcount; + number_of_speeds = cpu->n_freqs; fwts_log_nl(fw); - if (number_of_speeds != speedcount) + if (number_of_speeds != cpu->n_freqs) fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqPStates", "Not all processors support the same number of P states."); - if (speedcount < 2) + if (cpu->n_freqs < 2) return; - /* Sort the frequencies */ - qsort(freqs, speedcount, sizeof(fwts_cpu_freq), cpu_freq_compare); - /* now check for 1) increasing HZ and 2) increasing speed */ - for (i = 0; i < speedcount-1; i++) { - if (freqs[i].Hz == freqs[i+1].Hz && !warned++) + for (i = 0; i < cpu->n_freqs - 1; i++) { + if (cpu->freqs[i].Hz == cpu->freqs[i+1].Hz && !warned++) fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqDupFreq", "Duplicate frequency reported."); - if (freqs[i].speed > freqs[i+1].speed) + if (cpu->freqs[i].speed > cpu->freqs[i+1].speed) fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSlowerOnCPU", "Supposedly higher frequency %s is slower (%" PRIu64 " bogo loops) than frequency %s (%" PRIu64 " bogo loops) on CPU %i.", - hz_to_human(freqs[i+1].Hz), freqs[i+1].speed, - hz_to_human(freqs[i].Hz), freqs[i].speed, - cpu); + hz_to_human(cpu->freqs[i+1].Hz), + cpu->freqs[i+1].speed, + hz_to_human(cpu->freqs[i].Hz), + cpu->freqs[i].speed, + cpu->idx); - if ((freqs[i].Hz > claimed_hz) && !warned_PSS) { + if ((cpu->freqs[i].Hz > claimed_hz) && !warned_PSS) { warned_PSS = true; fwts_warning(fw, "Frequency %" PRIu64 - " not achievable; _PSS limit of %" PRIu64 " in effect?", - freqs[i].Hz, claimed_hz); + " not achievable; _PSS limit of %" PRIu64 + " in effect?", + cpu->freqs[i].Hz, claimed_hz); } } } -static void lowest_speed(fwts_framework *fw, const int cpu) -{ - char path[PATH_MAX]; - char *line; - char *c, *c2; - uint64_t lowspeed = 0; - - cpu_mkpath(path, sizeof(path), cpu, "scaling_available_frequencies"); - if ((line = fwts_get(path)) == NULL) - return; - - c = line; - while (c && strlen(c) > 1) { - uint64_t Hz; - - c2 = strchr(c, ' '); - if (c2) { - *c2 = 0; - c2++; - } else - c2 = NULL; - - Hz = strtoull(c, NULL, 10); - if (Hz < lowspeed || lowspeed == 0) - lowspeed = Hz; - c = c2; - } - free(line); - - set_HZ(fw, cpu, lowspeed); -} - -static void highest_speed(fwts_framework *fw, const int cpu) -{ - char path[PATH_MAX]; - char *line; - char *c, *c2; - unsigned long highspeed=0; - - cpu_mkpath(path, sizeof(path), cpu, "scaling_available_frequencies"); - if ((line = fwts_get(path)) == NULL) - return; - - c = line; - while (c && strlen(c) > 1) { - uint64_t Hz; - - c2 = strchr(c, ' '); - if (c2) { - *c2=0; - c2++; - } else - c2 = NULL; - - Hz = strtoull(c, NULL, 10); - if (Hz > highspeed || highspeed == 0) - highspeed = Hz; - c = c2; - } - free(line); - - set_HZ(fw, cpu, highspeed); -} - - #ifdef FWTS_ARCH_INTEL /* * 4) Is BIOS wrongly doing Sw_All P-state coordination across cpus @@ -513,45 +406,22 @@ static void highest_speed(fwts_framework *fw, const int cpu) */ static void do_sw_all_test(fwts_framework *fw) { - DIR *dir; - struct dirent *entry; uint64_t highperf, lowperf; - int first_cpu_index = -1; - int cpu; - int ret; - - if ((dir = opendir(FWTS_CPU_PATH)) == NULL) { - fwts_log_error(fw, "FATAL: cpufreq: sysfs not mounted."); - return; - } - - while ((entry = readdir(dir)) != NULL) { - if (entry && strlen(entry->d_name) > 3) { - cpu = strtoul(entry->d_name + 3, NULL, 10); - if (first_cpu_index == -1) - first_cpu_index = cpu; - - lowest_speed(fw, cpu); - } - } - closedir(dir); + int i; /* All CPUs at the lowest frequency */ - ret = get_performance_repeat(fw, first_cpu_index, 5, GET_PERFORMANCE_MIN, &lowperf); - performed_tests++; - fwts_progress(fw, 100 * performed_tests/total_tests); - if (ret != FWTS_OK) { + for (i = 0; i < num_cpus; i++) + cpu_set_lowest_frequency(fw, &cpus[i]); + + if (get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MIN, &lowperf) != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALLGetPerf", "Failed to get CPU performance."); return; } lowperf = (lowperf * 100) / top_speed; - highest_speed(fw, first_cpu_index); - ret = get_performance_repeat(fw, first_cpu_index, 5, GET_PERFORMANCE_MAX, &highperf); - performed_tests++; - fwts_progress(fw, 100 * performed_tests/total_tests); - if (ret != FWTS_OK) { + cpu_set_highest_frequency(fw, &cpus[0]); + if (get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MAX, &highperf) != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALLGetPerf", "Failed to get CPU performance."); return; @@ -576,57 +446,32 @@ static void do_sw_all_test(fwts_framework *fw) */ static void do_sw_any_test(fwts_framework *fw) { - DIR *dir; - struct dirent *entry; uint64_t highperf, lowperf; - int first_cpu_index = -1; - int cpu; - int ret; + int i, rc; - if ((dir = opendir(FWTS_CPU_PATH)) == NULL) { - fwts_log_error(fw, "FATAL: cpufreq: sysfs not mounted."); - return; - } - - while ((entry = readdir(dir)) != NULL) { - if (entry && strlen(entry->d_name) > 3) { - cpu = strtoul(entry->d_name + 3, NULL, 10); - if (first_cpu_index == -1) - first_cpu_index = cpu; - - lowest_speed(fw, cpu); - } - } - rewinddir(dir); + for (i = 0; i < num_cpus; i++) + cpu_set_lowest_frequency(fw, &cpus[i]); /* All CPUs at the lowest frequency */ - ret = get_performance_repeat(fw, first_cpu_index, 5, GET_PERFORMANCE_MIN, &lowperf); - performed_tests++; - fwts_progress(fw, 100 * performed_tests/total_tests); - if (ret != FWTS_OK) { + rc = get_performance_repeat(fw, &cpus[0], 5, + GET_PERFORMANCE_MIN, &lowperf); + + if (rc != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ANYGetPerf", "Failed to get CPU performance."); - closedir(dir); return; } + lowperf = (100 * lowperf) / top_speed; - highest_speed(fw, first_cpu_index); + cpu_set_highest_frequency(fw, &cpus[0]); - while ((entry = readdir(dir)) != NULL) { - if (entry && strlen(entry->d_name) > 3) { - cpu = strtoul(entry->d_name + 3, NULL, 10); - if (cpu == first_cpu_index) - continue; - lowest_speed(fw, cpu); - } - } - closedir(dir); + for (i = 0; i < num_cpus; i++) + cpu_set_lowest_frequency(fw, &cpus[i]); - ret = get_performance_repeat(fw, first_cpu_index, 5, GET_PERFORMANCE_MAX, &highperf); - performed_tests++; - fwts_progress(fw, 100 * performed_tests/total_tests); - if (ret != FWTS_OK) { + rc = get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MAX, + &highperf); + if (rc != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ANYGetPerf", "Failed to get CPU performance."); return; @@ -643,46 +488,34 @@ static void do_sw_any_test(fwts_framework *fw) static void check_sw_any(fwts_framework *fw) { - DIR *dir; - struct dirent *entry; uint64_t low_perf, high_perf, newhigh_perf; static int once = 0; - int max_cpu = 0, i, j; - int cpu; + int i, j; - /* First set all processors to their lowest speed */ - if ((dir = opendir(FWTS_CPU_PATH)) == NULL) { - fwts_log_error(fw, "FATAL: cpufreq: sysfs not mounted."); + /* Single processor machine, no point in checking anything */ + if (num_cpus < 2) return; - } - while ((entry = readdir(dir)) != NULL) { - if (entry && strlen(entry->d_name) > 3) { - cpu = strtoul(entry->d_name + 3, NULL, 10); - lowest_speed(fw, cpu); - if (cpu > max_cpu) - max_cpu = cpu; - } - } - closedir(dir); - - if (max_cpu == 0) - return; /* Single processor machine, no point in checking anything */ + /* First set all processors to their lowest speed */ + for (i = 0; i < num_cpus; i++) + cpu_set_lowest_frequency(fw, &cpus[i]); /* assume that all processors have the same low performance */ - if (fwts_cpu_performance(fw, max_cpu, &low_perf) != FWTS_OK) { + if (fwts_cpu_performance(fw, cpus[0].idx, &low_perf) != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqCPsSetToSW_ANYGetPerf", "Cannot get CPU performance."); return; } - for (i = 0; i <= max_cpu; i++) { - highest_speed(fw, i); - if (!cpu_exists(i)) + for (i = 0; i <= num_cpus; i++) { + struct cpu *cpu = &cpus[i]; + + cpu_set_highest_frequency(fw, cpu); + if (!cpu->online) continue; - if (fwts_cpu_performance(fw, i, &high_perf) != FWTS_OK) { + if (fwts_cpu_performance(fw, cpu->idx, &high_perf) != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqCPsSetToSW_ANYGetPerf", "Cannot get CPU performance."); @@ -695,10 +528,11 @@ static void check_sw_any(fwts_framework *fw) * the core in question to now also get the low speed, while * hardware max will keep the performance */ - for (j = 0; j <= max_cpu; j++) + for (j = 0; j < num_cpus; j++) if (i != j) - lowest_speed(fw, j); - if (fwts_cpu_performance(fw, i, &newhigh_perf) != FWTS_OK) { + cpu_set_lowest_frequency(fw, &cpus[j]); + if (fwts_cpu_performance(fw, cpu->idx, &newhigh_perf) + != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqCPsSetToSW_ANYGetPerf", "Cannot get CPU performance."); @@ -711,7 +545,7 @@ static void check_sw_any(fwts_framework *fw) "CPUFreqCPUsSetToSW_ANY", "Processors are set to SW_ANY."); once++; - lowest_speed(fw, i); + cpu_set_lowest_frequency(fw, cpu); } performed_tests++; fwts_progress(fw, 100 * performed_tests/total_tests); @@ -723,9 +557,7 @@ static void check_sw_any(fwts_framework *fw) static int cpufreq_test1(fwts_framework *fw) { - DIR *dir; - struct dirent *entry; - int cpu; + int i; #ifdef FWTS_ARCH_INTEL fwts_log_info(fw, @@ -750,42 +582,21 @@ static int cpufreq_test1(fwts_framework *fw) #endif fwts_log_nl(fw); - /* First set all processors to their lowest speed */ - if ((dir = opendir(FWTS_CPU_PATH)) == NULL) { - fwts_log_error(fw, "FATAL: cpufreq: sysfs not mounted\n"); - return FWTS_ERROR; - } - - while ((entry = readdir(dir)) != NULL) { - if (entry && strlen(entry->d_name) > 3 && isdigit(entry->d_name[3])) { - cpu = strtoul(entry->d_name + 3, NULL, 10); - lowest_speed(fw, cpu); - } - } - rewinddir(dir); + for (i = 0; i < num_cpus; i++) + cpu_set_lowest_frequency(fw, &cpus[i]); /* then do the benchmark */ - - while ((entry = readdir(dir)) != NULL) { - if (entry && strlen(entry->d_name) > 3 && isdigit(entry->d_name[3])) { - cpu = strtoul(entry->d_name + 3, NULL, 10); - do_cpu(fw, cpu); - lowest_speed(fw, cpu); - if (no_cpufreq) - break; - } + for (i = 0; i < num_cpus; i++) { + do_cpu(fw, &cpus[i]); + cpu_set_lowest_frequency(fw, &cpus[i]); + if (no_cpufreq) + break; } - rewinddir(dir); /* set everything back to the highest speed again */ + for (i = 0; i < num_cpus; i++) + cpu_set_highest_frequency(fw, &cpus[i]); - while ((entry = readdir(dir)) != NULL) { - if (entry && strlen(entry->d_name) > 3 && isdigit(entry->d_name[3])) { - cpu = strtoul(entry->d_name + 3, NULL, 10); - highest_speed(fw, cpu); - } - } - closedir(dir); #ifdef FWTS_ARCH_INTEL if (!no_cpufreq) @@ -808,12 +619,91 @@ static int cpufreq_test1(fwts_framework *fw) return FWTS_OK; } -static int cpufreq_init(fwts_framework *fw) +static int cpu_freq_compare(const void *v1, const void *v2) +{ + const fwts_cpu_freq *f1 = v1; + const fwts_cpu_freq *f2 = v2; + return f1->Hz - f2->Hz; +} + +static int parse_cpu_info(struct cpu *cpu, struct dirent *dir) +{ + char *end, path[PATH_MAX+1], *str, *tmp, *tok; + int i; + + strcpy(cpu->sysfs_path, dir->d_name); + cpu->idx = strtoul(cpu->sysfs_path + strlen("cpu"), &end, 10); + cpu->online = true; + + cpu_mkpath(path, sizeof(path), cpu, "scaling_governor"); + cpu->orig_governor = fwts_get(path); + + if (cpu->orig_governor && !strcmp(cpu->orig_governor, "userspace")) { + cpu_mkpath(path, sizeof(path), cpu, "scaling_setspeed"); + tmp = fwts_get(path); + cpu->orig_frequency = strtoull(tmp, NULL, 10); + free(tmp); + } + + /* parse available frequencies */ + cpu_mkpath(path, sizeof(path), cpu, "scaling_available_frequencies"); + str = fwts_get(path); + + for (tmp = str, i = 0; ; tmp = NULL) { + tok = strtok(tmp, " "); + if (!tok) + break; + if (!isdigit(tok[0])) + continue; + cpu->freqs[i++].Hz = strtoull(tok, NULL, 10); + } + + free(str); + + cpu->n_freqs = i; + qsort(cpu->freqs, cpu->n_freqs, sizeof(cpu->freqs[0]), + cpu_freq_compare); + + return FWTS_OK; +} + +static int is_cpu_dir(const struct dirent *dir) { - if ((num_cpus = fwts_cpu_enumerate()) == FWTS_ERROR) { - fwts_warning(fw, "Cannot determine number of CPUS, defaulting to 1."); - num_cpus = 1; + return strncmp(dir->d_name, "cpu", 3) == 0 && + isdigit(dir->d_name[3]); +} + +static int cpufreq_init(fwts_framework *fw __attribute__((unused))) +{ + struct dirent **dirs; + int i; + + num_cpus = scandir(FWTS_CPU_PATH, &dirs, is_cpu_dir, versionsort); + cpus = calloc(num_cpus, sizeof(*cpus)); + + for (i = 0; i < num_cpus; i++) + parse_cpu_info(&cpus[i], dirs[i]); + + return FWTS_OK; +} + +static int cpufreq_deinit(fwts_framework *fw) +{ + int i; + + for (i = 0; i < num_cpus; i++) { + struct cpu *cpu = &cpus[i]; + + if (cpu->orig_governor) { + cpu_set_governor(fw, cpu, cpu->orig_governor); + free(cpu->orig_governor); + } + + if (cpu->orig_frequency) + cpu_set_frequency(fw, cpu, cpu->orig_frequency); } + free(cpus); + return FWTS_OK; } @@ -828,6 +718,7 @@ static fwts_framework_minor_test cpufreq_tests[] = { static fwts_framework_ops cpufreq_ops = { .init = cpufreq_init, + .deinit = cpufreq_deinit, .description = "CPU frequency scaling tests.", .minor_tests = cpufreq_tests }; From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 07/11] cpu/cpufreq: Always check that cpufreq changes have taken In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.812460.10563272713.7.gpush@pablo> This change adds checks for cpu_set_governor and cpu_set_frequency, and aborts (or fails) tests where this is needed. Signed-off-by: Jeremy Kerr --- src/cpu/cpufreq/cpufreq.c | 80 ++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 19 deletions(-) diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c index cd55eb5..979a9e1 100644 --- a/src/cpu/cpufreq/cpufreq.c +++ b/src/cpu/cpufreq/cpufreq.c @@ -63,7 +63,7 @@ struct cpu { static struct cpu *cpus; static int num_cpus; -static bool no_cpufreq = false; +static bool cpufreq_settable = true; #define GET_PERFORMANCE_MAX (0) #define GET_PERFORMANCE_MIN (1) @@ -83,24 +83,33 @@ static inline void cpu_mkpath( cpu->sysfs_path, name); } -static void cpu_set_governor(fwts_framework *fw, struct cpu *cpu, +static int cpu_set_governor(fwts_framework *fw, struct cpu *cpu, const char *governor) { - char path[PATH_MAX]; + char path[PATH_MAX], *tmp; int rc; cpu_mkpath(path, sizeof(path), cpu, "scaling_governor"); rc = fwts_set(governor, path); - if (rc != FWTS_OK && !no_cpufreq) { - fwts_warning(fw, "Cannot set CPU governor to %s.", governor); - no_cpufreq = true; - } + if (rc != FWTS_OK) + goto out; + + tmp = fwts_get(path); + rc = tmp && !strncmp(tmp, governor, strlen(governor)) + ? FWTS_OK : FWTS_ERROR; + free(tmp); + +out: + if (rc != FWTS_OK) + fwts_warning(fw, "Cannot set CPU %d governor to %s.", + cpu->idx, governor); + return rc; } -static void cpu_set_frequency(fwts_framework *fw, struct cpu *cpu, +static int cpu_set_frequency(fwts_framework *fw, struct cpu *cpu, uint64_t freq_hz) { - char path[PATH_MAX]; + char path[PATH_MAX], *tmp; char buffer[64]; int rc; @@ -108,17 +117,28 @@ static void cpu_set_frequency(fwts_framework *fw, struct cpu *cpu, snprintf(buffer, sizeof(buffer), "%" PRIu64 , freq_hz); rc = fwts_set(buffer, path); if (rc != FWTS_OK) - fwts_warning(fw, "Cannot set CPU frequency to %s.", buffer); + goto out; + + tmp = fwts_get(path); + rc = tmp && !strncmp(tmp, buffer, strlen(buffer)) + ? FWTS_OK : FWTS_ERROR; + free(tmp); + +out: + if (rc != FWTS_OK) + fwts_warning(fw, "Cannot set CPU %d frequency to %s.", + cpu->idx, buffer); + return rc; } -static void cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu) +static int cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu) { - cpu_set_frequency(fw, cpu, cpu->freqs[0].Hz); + return cpu_set_frequency(fw, cpu, cpu->freqs[0].Hz); } -static void cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu) +static int cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu) { - cpu_set_frequency(fw, cpu, cpu->freqs[cpu->n_freqs-1].Hz); + return cpu_set_frequency(fw, cpu, cpu->freqs[cpu->n_freqs-1].Hz); } @@ -320,10 +340,20 @@ static int cpufreq_test_cpu_performance(fwts_framework *fw) n_online_cpus = 0; - for (i = 0; i < num_cpus; i++) { - cpu_set_lowest_frequency(fw, &cpus[i]); + + for (i = 0; cpufreq_settable && i < num_cpus; i++) { if (cpus[i].online) n_online_cpus++; + rc = cpu_set_lowest_frequency(fw, &cpus[i]); + if (rc != FWTS_OK) + cpufreq_settable = false; + } + + if (!cpufreq_settable) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "CPUFreqSetFailed", + "Can't set CPU frequencies"); + return FWTS_OK; } /* then do the benchmark */ @@ -356,6 +386,11 @@ static int sw_tests_possible(fwts_framework *fw) return FWTS_SKIP; #endif + if (!cpufreq_settable) { + fwts_skipped(fw, "Can't set CPU frequencies"); + return FWTS_SKIP; + } + /* count the number of CPUs online now */ for (i = 0; i < num_cpus; i++) if (cpus[i].online) @@ -736,7 +771,7 @@ static int is_cpu_dir(const struct dirent *dir) static int cpufreq_init(fwts_framework *fw __attribute__((unused))) { struct dirent **dirs; - int i; + int i, rc; num_cpus = scandir(FWTS_CPU_PATH, &dirs, is_cpu_dir, versionsort); cpus = calloc(num_cpus, sizeof(*cpus)); @@ -745,8 +780,15 @@ static int cpufreq_init(fwts_framework *fw __attribute__((unused))) parse_cpu_info(&cpus[i], dirs[i]); /* all test require a userspace governor */ - for (i = 0; i < num_cpus; i++) - cpu_set_governor(fw, &cpus[i], "userspace"); + for (i = 0; i < num_cpus; i++) { + rc = cpu_set_governor(fw, &cpus[i], "userspace"); + if (rc != FWTS_OK) { + fwts_log_warning(fw, "Failed to intialise cpufreq " + "to set CPU speed"); + cpufreq_settable = false; + break; + } + } return FWTS_OK; } From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 00/11] CPU frequency test improvements In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.809946.751063732393.0.gpush@pablo> These changes rework the CPU frequency tests, mainly for compatiblity with non-x86 machines. Patches 1-6 factor out the tests into smaller units, so that we can selectively enable or disable functionality that's specific to ACPI-based frequency control, and do a little rework to have a consistent 1 pass/fail per test run. Patch 7 is a simple check for the consistency of frequency changes. Patches 8-10 implement Linux perf support for the test benchmarks, so that we have meaningful results in the benchmark sets, across different platforms. Patch 11 makes the tests a little more usable on large machines. Questions / comments most welcome. Cheers, Jeremy --- Jeremy Kerr (11): cpu/cpufreq: Don't reparse cpu information cpu/cpufreq: hz_almost_equal is unused if !FWTS_ARCH_INTEL cpu/cpufreq: Add a separate cpufreq consistency test cpu/cpufreq: Add test for duplicate entries in cpufreq tables cpu/cpufreq: Do bios limit and claimed max checks as separate tests cpu/cpufreq: Refactor CPU performance tests cpu/cpufreq: Always check that cpufreq changes have taken fwts: Use linux perf counters for cpu benchmarking fwts: Use gettimeofday for cpu benchmark fwts: scale cpu benchmark results to one second cpu/cpufreq: Only run performance tests on master threads From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 11/11] cpu/cpufreq: Only run performance tests on master threads In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.812895.725561201452.11.gpush@pablo> On a (single-socket) openpower machine, the cpufreq tests take nearly an hour: $ time sudo ./src/fwts cpufreq Running 1 tests, results appended to results.log Test: CPU frequency scaling tests. CPU frequency performance tests. 1 passed real 58m43.334s user 58m40.118s sys 0m0.366s This is because we have 44 possible frequencies: $ wc -w scaling_available_frequencies 44 scaling_available_frequencies on 80 cpus: $ getconf _NPROCESSORS_ONLN 80 That's a total of 3520 individual benchmarks, at one second per test. However, those 80 cpus that linux reports are acually threads: 8 threads per core, on a 10 core system. Because each of these threads is on the same core, they share the same cpufreq control: $ ls -ld cpu{0..7}/cpufreq drwxr-xr-x 3 root root 0 May 21 03:06 cpu0/cpufreq lrwxrwxrwx 1 root root 0 May 21 01:29 cpu1/cpufreq -> ../cpu0/cpufreq lrwxrwxrwx 1 root root 0 May 21 01:29 cpu2/cpufreq -> ../cpu0/cpufreq lrwxrwxrwx 1 root root 0 May 21 01:29 cpu3/cpufreq -> ../cpu0/cpufreq lrwxrwxrwx 1 root root 0 May 21 01:29 cpu4/cpufreq -> ../cpu0/cpufreq lrwxrwxrwx 1 root root 0 May 21 01:29 cpu5/cpufreq -> ../cpu0/cpufreq lrwxrwxrwx 1 root root 0 May 21 01:29 cpu6/cpufreq -> ../cpu0/cpufreq lrwxrwxrwx 1 root root 0 May 21 01:29 cpu7/cpufreq -> ../cpu0/cpufreq So, rather than running the exact same test 8 times over on each core, this change only runs the cpufreq test on the 'master' threads. Signed-off-by: Jeremy Kerr --- src/cpu/cpufreq/cpufreq.c | 43 +++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c index e409375..c6d6a9d 100644 --- a/src/cpu/cpufreq/cpufreq.c +++ b/src/cpu/cpufreq/cpufreq.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,7 @@ struct cpu { int idx; char sysfs_path[PATH_MAX]; bool online; + bool master; int n_freqs; fwts_cpu_freq freqs[MAX_FREQS]; @@ -79,8 +81,10 @@ static inline void cpu_mkpath( const struct cpu *cpu, const char *const name) { - snprintf(path, len, "%s/%s/cpufreq/%s", FWTS_CPU_PATH, - cpu->sysfs_path, name); + snprintf(path, len, "%s/%s/cpufreq%s%s", FWTS_CPU_PATH, + cpu->sysfs_path, + name ? "/" : "", + name ?: ""); } static int cpu_set_governor(fwts_framework *fw, struct cpu *cpu, @@ -348,15 +352,16 @@ static int test_one_cpu_performance(fwts_framework *fw, struct cpu *cpu, static int cpufreq_test_cpu_performance(fwts_framework *fw) { - int n_online_cpus, i, c, rc; + int n_master_cpus, i, c, rc; bool ok = true; - n_online_cpus = 0; + n_master_cpus = 0; for (i = 0; cpufreq_settable && i < num_cpus; i++) { - if (cpus[i].online) - n_online_cpus++; + if (!(cpus[i].online && cpus[i].master)) + continue; + n_master_cpus++; rc = cpu_set_lowest_frequency(fw, &cpus[i]); if (rc != FWTS_OK) cpufreq_settable = false; @@ -371,10 +376,10 @@ static int cpufreq_test_cpu_performance(fwts_framework *fw) /* then do the benchmark */ for (i = 0, c = 0; i < num_cpus; i++) { - if (!cpus[i].online) + if (!(cpus[i].online && cpus[i].master)) continue; - rc = test_one_cpu_performance(fw, &cpus[i], c++, n_online_cpus); + rc = test_one_cpu_performance(fw, &cpus[i], c++, n_master_cpus); if (rc != FWTS_OK) ok = false; @@ -738,15 +743,29 @@ static int cpu_freq_compare(const void *v1, const void *v2) return f1->Hz - f2->Hz; } -static int parse_cpu_info(struct cpu *cpu, struct dirent *dir) +static int parse_cpu_info(fwts_framework *fw, + struct cpu *cpu, struct dirent *dir) { char *end, path[PATH_MAX+1], *str, *tmp, *tok; - int i; + struct stat statbuf; + int i, rc; strcpy(cpu->sysfs_path, dir->d_name); cpu->idx = strtoul(cpu->sysfs_path + strlen("cpu"), &end, 10); cpu->online = true; + /* check if this is the master of a group of CPUs; we only + * need to do perf checks on those that are the master */ + cpu_mkpath(path, sizeof(path), cpu, NULL); + rc = lstat(path, &statbuf); + if (rc) { + fwts_log_warning(fw, "Can't stat cpufreq info!"); + return FWTS_ERROR; + } + + /* non-master CPUs will have a link, not a dir */ + cpu->master = S_ISDIR(statbuf.st_mode); + cpu_mkpath(path, sizeof(path), cpu, "scaling_governor"); cpu->orig_governor = fwts_get(path); @@ -785,7 +804,7 @@ static int is_cpu_dir(const struct dirent *dir) isdigit(dir->d_name[3]); } -static int cpufreq_init(fwts_framework *fw __attribute__((unused))) +static int cpufreq_init(fwts_framework *fw) { struct dirent **dirs; int i, rc; @@ -794,7 +813,7 @@ static int cpufreq_init(fwts_framework *fw __attribute__((unused))) cpus = calloc(num_cpus, sizeof(*cpus)); for (i = 0; i < num_cpus; i++) - parse_cpu_info(&cpus[i], dirs[i]); + parse_cpu_info(fw, &cpus[i], dirs[i]); /* all test require a userspace governor */ for (i = 0; i < num_cpus; i++) { From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 03/11] cpu/cpufreq: Add a separate cpufreq consistency test In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.811223.440643202583.3.gpush@pablo> Add a separate test to check that cpufreq tables are consistent across processors, instead of the current check included in the do_cpu path. Signed-off-by: Jeremy Kerr --- src/cpu/cpufreq/cpufreq.c | 68 +++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c index 93260b3..517c750 100644 --- a/src/cpu/cpufreq/cpufreq.c +++ b/src/cpu/cpufreq/cpufreq.c @@ -356,16 +356,8 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) cpu->freqs[i].speed, turbo); } - if (number_of_speeds == -1) - number_of_speeds = cpu->n_freqs; - fwts_log_nl(fw); - if (number_of_speeds != cpu->n_freqs) - fwts_failed(fw, LOG_LEVEL_MEDIUM, - "CPUFreqPStates", - "Not all processors support the same number of P states."); - if (cpu->n_freqs < 2) return; @@ -620,6 +612,65 @@ static int cpufreq_test1(fwts_framework *fw) return FWTS_OK; } +static int cpufreq_compare_freqs(fwts_framework *fw, struct cpu *c1, + struct cpu *c2) +{ + int i; + + if (c1->n_freqs != c2->n_freqs) { + fwts_log_warning(fw, "cpu %d has %d freqs, cpu %d has %d freqs", + c1->idx, c1->n_freqs, + c2->idx, c2->n_freqs); + return FWTS_ERROR; + } + + for (i = 0; i < c1->n_freqs; i++) { + if (c1->freqs[i].Hz != c2->freqs[i].Hz) { + fwts_log_warning(fw, "freq entry %d: " + "cpu %d is %" PRId64 ", " + "cpu %d is %" PRId64, i, + c1->idx, c1->freqs[i].Hz, + c2->idx, c2->freqs[i].Hz); + return FWTS_ERROR; + } + } + + return FWTS_OK; +} + +static int cpufreq_test_consistency(fwts_framework *fw) +{ + struct cpu *cpu, *cpu0; + bool consistent = true; + int i; + + if (num_cpus < 2) { + fwts_skipped(fw, "Test skipped, only one processor present"); + return FWTS_SKIP; + } + + cpu0 = &cpus[0]; + + for (i = 1; i < num_cpus; i++) { + cpu = &cpus[i]; + if (cpufreq_compare_freqs(fw, cpu0, cpu) != FWTS_OK) { + consistent = false; + fwts_log_error(fw, + "cpu %d has an inconsistent frequency table", + cpu->idx); + } + } + + if (!consistent) + fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqInconsistent", + "inconsistencies found in CPU " + "frequency tables"); + else + fwts_passed(fw, "CPU frequency tables are consistent"); + + return FWTS_OK; +} + static int cpu_freq_compare(const void *v1, const void *v2) { const fwts_cpu_freq *f1 = v1; @@ -709,6 +760,7 @@ static int cpufreq_deinit(fwts_framework *fw) } static fwts_framework_minor_test cpufreq_tests[] = { + { cpufreq_test_consistency, "CPU frequency table consistency" }, #ifdef FWTS_ARCH_INTEL { cpufreq_test1, "CPU P-State tests." }, #else From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 02/11] cpu/cpufreq: hz_almost_equal is unused if !FWTS_ARCH_INTEL In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.810919.781168126277.2.gpush@pablo> ... so move it to an #ifdef-ed block. Signed-off-by: Jeremy Kerr --- src/cpu/cpufreq/cpufreq.c | 51 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c index 9315d18..93260b3 100644 --- a/src/cpu/cpufreq/cpufreq.c +++ b/src/cpu/cpufreq/cpufreq.c @@ -77,31 +77,6 @@ static uint64_t top_speed = 0; #define MAX_ABSOLUTE_ERROR 20.0 /* In Hz */ #define MAX_RELATIVE_ERROR 0.0025 /* as fraction */ -/* - * hz_almost_equal() - * used to compare CPU _PSS levels, are they almost - * equal? E.g. within MAX_ABSOLUTE_ERROR Hz difference - * between each other, or a relative difference of - * MAX_RELATIVE_ERROR. If they are, then they are deemed - * almost equal. - */ -static int hz_almost_equal(const uint64_t a, const uint64_t b) -{ - double da = (double)a, db = (double)b; - double relative_error, abs_diff = fabs(da - db); - - if (a == b) - return true; - if (abs_diff < MAX_ABSOLUTE_ERROR) - return true; - if (db > da) - relative_error = abs_diff / db; - else - relative_error = abs_diff / da; - - return relative_error <= MAX_RELATIVE_ERROR; -} - static inline void cpu_mkpath( char *const path, const int len, @@ -203,6 +178,32 @@ static int get_performance_repeat( } return FWTS_OK; } + +/* + * hz_almost_equal() + * used to compare CPU _PSS levels, are they almost + * equal? E.g. within MAX_ABSOLUTE_ERROR Hz difference + * between each other, or a relative difference of + * MAX_RELATIVE_ERROR. If they are, then they are deemed + * almost equal. + */ +static int hz_almost_equal(const uint64_t a, const uint64_t b) +{ + double da = (double)a, db = (double)b; + double relative_error, abs_diff = fabs(da - db); + + if (a == b) + return true; + if (abs_diff < MAX_ABSOLUTE_ERROR) + return true; + if (db > da) + relative_error = abs_diff / db; + else + relative_error = abs_diff / da; + + return relative_error <= MAX_RELATIVE_ERROR; +} + #endif static char *hz_to_human(const uint64_t hz) From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 10/11] fwts: scale cpu benchmark results to one second In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.812790.959200306661.10.gpush@pablo> Signed-off-by: Jeremy Kerr --- src/lib/src/fwts_cpu.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c index 743de63..d7793b7 100644 --- a/src/lib/src/fwts_cpu.c +++ b/src/lib/src/fwts_cpu.c @@ -378,6 +378,7 @@ int fwts_cpu_benchmark( fwts_cpu_benchmark_result tmp; cpu_set_t mask, oldset; int perfctr, ncpus, rc; + double duration_sec; static bool warned; bool perf_ok; @@ -445,12 +446,15 @@ int fwts_cpu_benchmark( return FWTS_ERROR; } + duration_sec = duration.tv_sec + + ((1.0 * duration.tv_usec) / 1000000.0); + + tmp.loops = (1.0 * tmp.loops) / duration_sec; + if (perf_ok) { rc = perf_read_counter(perfctr, &perfctr_result); if (rc == FWTS_OK) { - tmp.cycles = perfctr_result / - ((1.0 * duration.tv_usec / 1000000) + - duration.tv_sec); + tmp.cycles = (1.0 * perfctr_result) / duration_sec; tmp.cycles_valid = true; } else { fwts_log_warning(fw, "failed to read perf counters"); From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 06/11] cpu/cpufreq: Refactor CPU performance tests In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.812207.327248641665.6.gpush@pablo> This change is a refactor of the CPU performance tests, in a few ways: Rather than combining the SW_ANY and SW_ALL tests along with the actual performance comparison, we move them to their own minor tests. We make the tests run-time conditional on sw_tests_possible, rather than using compile-time switching in multiple places. We only do one fwts_passed/fwts_failed per test. Doing this multiple times per test gives us inconsistent counts in the results log. We remove the global performance measurements, as we only need to compare results within a CPU. Signed-off-by: Jeremy Kerr --- src/cpu/cpufreq/cpufreq.c | 332 +++++++++++++++----------------------- 1 file changed, 136 insertions(+), 196 deletions(-) diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c index 0b4d8a7..cd55eb5 100644 --- a/src/cpu/cpufreq/cpufreq.c +++ b/src/cpu/cpufreq/cpufreq.c @@ -63,11 +63,7 @@ struct cpu { static struct cpu *cpus; static int num_cpus; -static int number_of_speeds = -1; -static int total_tests = 1; -static int performed_tests = 0; static bool no_cpufreq = false; -static uint64_t top_speed = 0; #define GET_PERFORMANCE_MAX (0) #define GET_PERFORMANCE_MIN (1) @@ -126,7 +122,6 @@ static void cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu) } -#ifdef FWTS_ARCH_INTEL static int get_performance_repeat( fwts_framework *fw, struct cpu *cpu, @@ -179,6 +174,7 @@ static int get_performance_repeat( return FWTS_OK; } +#ifdef FWTS_ARCH_INTEL /* * hz_almost_equal() * used to compare CPU _PSS levels, are they almost @@ -203,7 +199,6 @@ static int hz_almost_equal(const uint64_t a, const uint64_t b) return relative_error <= MAX_RELATIVE_ERROR; } - #endif static char *hz_to_human(const uint64_t hz) @@ -254,34 +249,11 @@ static uint64_t get_bios_limit(struct cpu *cpu) return value; } -static void do_cpu(fwts_framework *fw, struct cpu *cpu) +static int test_one_cpu_performance(fwts_framework *fw, struct cpu *cpu, + int cpu_idx, int n_online_cpus) { - int i; - static int warned = 0; uint64_t cpu_top_perf = 0; - - cpu_set_governor(fw, cpu, "userspace"); - - if (cpu->n_freqs == 0) { - if (!no_cpufreq) { - char path[PATH_MAX]; - char *driver; - - no_cpufreq = true; - fwts_warning(fw, "CPU frequency scaling not supported."); - - cpu_mkpath(path, sizeof(path), cpu, "scaling_driver"); - driver = fwts_get(path); - if (driver) { - fwts_advice(fw, "Scaling driver '%s' is enabled and this " - "does not seem to allow CPU frequency scaling.", driver); - free(driver); - } - } - return; - } - if (total_tests == 1) - total_tests = ((2 + cpu->n_freqs) * num_cpus) + 2; + int i; for (i = 0; i < cpu->n_freqs; i++) { cpu_set_frequency(fw, cpu, cpu->freqs[i].Hz); @@ -296,13 +268,10 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) if (cpu->freqs[i].speed > cpu_top_perf) cpu_top_perf = cpu->freqs[i].speed; - performed_tests++; - fwts_progress(fw, 100 * performed_tests/total_tests); + fwts_progress(fw, (100 * ((cpu_idx * cpu->n_freqs) + i)) / + (n_online_cpus * cpu->n_freqs)); } - if (cpu_top_perf > top_speed) - top_speed = cpu_top_perf; - fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", cpu->idx, cpu->n_freqs); fwts_log_info_verbatum(fw, " Frequency | Relative Speed | Bogo loops"); @@ -323,41 +292,102 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) fwts_log_nl(fw); - if (cpu->n_freqs < 2) - return; - - /* now check for 1) increasing HZ and 2) increasing speed */ + /* now check for increasing performance */ for (i = 0; i < cpu->n_freqs - 1; i++) { - if (cpu->freqs[i].Hz == cpu->freqs[i+1].Hz && !warned++) - fwts_failed(fw, LOG_LEVEL_MEDIUM, - "CPUFreqDupFreq", - "Duplicate frequency reported."); - if (cpu->freqs[i].speed > cpu->freqs[i+1].speed) - fwts_failed(fw, LOG_LEVEL_MEDIUM, - "CPUFreqSlowerOnCPU", - "Supposedly higher frequency %s is slower (%" PRIu64 - " bogo loops) than frequency %s (%" PRIu64 - " bogo loops) on CPU %i.", - hz_to_human(cpu->freqs[i+1].Hz), - cpu->freqs[i+1].speed, - hz_to_human(cpu->freqs[i].Hz), - cpu->freqs[i].speed, - cpu->idx); + if (cpu->freqs[i].speed <= cpu->freqs[i+1].speed) + continue; + + fwts_log_warning(fw, + "Supposedly higher frequency %s is slower (%" PRIu64 + " bogo loops) than frequency %s (%" PRIu64 + " bogo loops) on CPU %i.", + hz_to_human(cpu->freqs[i+1].Hz), + cpu->freqs[i+1].speed, + hz_to_human(cpu->freqs[i].Hz), + cpu->freqs[i].speed, + cpu->idx); + return FWTS_ERROR; } + + fwts_log_info(fw, "CPU %d performance scaling OK", cpu->idx); + return FWTS_OK; } +static int cpufreq_test_cpu_performance(fwts_framework *fw) +{ + int n_online_cpus, i, c, rc; + bool ok = true; + + n_online_cpus = 0; + + for (i = 0; i < num_cpus; i++) { + cpu_set_lowest_frequency(fw, &cpus[i]); + if (cpus[i].online) + n_online_cpus++; + } + + /* then do the benchmark */ + for (i = 0, c = 0; i < num_cpus; i++) { + if (!cpus[i].online) + continue; + + rc = test_one_cpu_performance(fw, &cpus[i], c++, n_online_cpus); + if (rc != FWTS_OK) + ok = false; + + cpu_set_lowest_frequency(fw, &cpus[i]); + } + + if (ok) + fwts_passed(fw, "CPU performance scaling OK"); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "CPUFreqSlowerOnCPU", + "CPU frequencies do not refelect actual performance"); + return FWTS_OK; +} + +static int sw_tests_possible(fwts_framework *fw) +{ + int i, online_cpus = 0; + +#ifndef FWTS_ARCH_INTEL + fwts_skipped(fw, "Platform doesn't perform SW_ cpu frequency control"); + return FWTS_SKIP; +#endif + + /* count the number of CPUs online now */ + for (i = 0; i < num_cpus; i++) + if (cpus[i].online) + online_cpus++; + + if (online_cpus < 2) { + fwts_skipped(fw, "Machine only has one CPU online"); + return FWTS_SKIP; + } + + if (cpus[0].n_freqs < 2) { + fwts_skipped(fw, "No frequency changes possible"); + return FWTS_SKIP; + } + + return FWTS_OK; +} -#ifdef FWTS_ARCH_INTEL /* * 4) Is BIOS wrongly doing Sw_All P-state coordination across cpus * - Change frequency on all CPU to the lowest value * - Change frequency on one particular CPU to the highest * - If BIOS is doing Sw_All, the last high freq request will not work */ -static void do_sw_all_test(fwts_framework *fw) +static int cpufreq_test_sw_all(fwts_framework *fw) { uint64_t highperf, lowperf; - int i; + int i, rc; + + rc = sw_tests_possible(fw); + if (rc != FWTS_OK) + return rc; /* All CPUs at the lowest frequency */ for (i = 0; i < num_cpus; i++) @@ -366,85 +396,47 @@ static void do_sw_all_test(fwts_framework *fw) if (get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MIN, &lowperf) != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALLGetPerf", "Failed to get CPU performance."); - return; + return FWTS_ERROR; } - lowperf = (lowperf * 100) / top_speed; cpu_set_highest_frequency(fw, &cpus[0]); if (get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MAX, &highperf) != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALLGetPerf", "Failed to get CPU performance."); - return; + return FWTS_ERROR; } - highperf = (highperf * 100) / top_speed; - if (lowperf >= highperf) + if (lowperf >= highperf) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALL", "Firmware not implementing hardware " "coordination cleanly. Firmware using SW_ALL " "instead?"); + return FWTS_ERROR; + } + + fwts_passed(fw, "Firmware SW_ALL OK"); + return FWTS_OK; } -/* - * 5) Is BIOS wrongly doing Sw_Any P-state coordination across cpus - * - Change frequency on all CPU to the lowest value - * - Change frequency on one particular CPU to the highest - * - Change frequency on all CPU to the lowest value - * - If BIOS is doing Sw_Any, the high freq request will not work - */ -static void do_sw_any_test(fwts_framework *fw) +static int cpufreq_test_sw_any(fwts_framework *fw) { - uint64_t highperf, lowperf; - int i, rc; - - for (i = 0; i < num_cpus; i++) - cpu_set_lowest_frequency(fw, &cpus[i]); - - /* All CPUs at the lowest frequency */ - rc = get_performance_repeat(fw, &cpus[0], 5, - GET_PERFORMANCE_MIN, &lowperf); - - if (rc != FWTS_OK) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ANYGetPerf", - "Failed to get CPU performance."); - return; - } - - lowperf = (100 * lowperf) / top_speed; + uint64_t low_perf, high_perf, newhigh_perf; + int i, j, rc, n_tests, performed_tests; + bool ok; - cpu_set_highest_frequency(fw, &cpus[0]); + rc = sw_tests_possible(fw); + if (rc != FWTS_OK) + return rc; + n_tests = performed_tests = 0; for (i = 0; i < num_cpus; i++) - cpu_set_lowest_frequency(fw, &cpus[i]); + if (cpus[i].online) + n_tests++; - rc = get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MAX, - &highperf); - if (rc != FWTS_OK) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ANYGetPerf", - "Failed to get CPU performance."); - return; - } - highperf = (100 * highperf) / top_speed; - - if (lowperf >= highperf) - fwts_failed(fw, LOG_LEVEL_MEDIUM, - "CPUFreqSW_ANY", - "Firmware not implementing hardware " - "coordination cleanly. Firmware using SW_ANY " - "instead?."); -} - -static void check_sw_any(fwts_framework *fw) -{ - uint64_t low_perf, high_perf, newhigh_perf; - static int once = 0; - int i, j; - - /* Single processor machine, no point in checking anything */ - if (num_cpus < 2) - return; + /* we do two performance measurements per cpu */ + n_tests *= 2; /* First set all processors to their lowest speed */ for (i = 0; i < num_cpus; i++) @@ -455,12 +447,17 @@ static void check_sw_any(fwts_framework *fw) fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqCPsSetToSW_ANYGetPerf", "Cannot get CPU performance."); - return; + return FWTS_ERROR; } + ok = true; + for (i = 0; i <= num_cpus; i++) { struct cpu *cpu = &cpus[i]; + if (!cpu->online) + continue; + cpu_set_highest_frequency(fw, cpu); if (!cpu->online) continue; @@ -469,10 +466,11 @@ static void check_sw_any(fwts_framework *fw) fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqCPsSetToSW_ANYGetPerf", "Cannot get CPU performance."); - return; + return FWTS_ERROR; } + performed_tests++; - fwts_progress(fw, 100 * performed_tests/total_tests); + fwts_progress(fw, 100 * performed_tests/n_tests); /* * now set all the others to low again; sw_any will cause * the core in question to now also get the low speed, while @@ -486,85 +484,25 @@ static void check_sw_any(fwts_framework *fw) fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqCPsSetToSW_ANYGetPerf", "Cannot get CPU performance."); - return; + return FWTS_ERROR; } if ((high_perf > newhigh_perf) && (high_perf - newhigh_perf > (high_perf - low_perf)/4) && - (once == 0) && (high_perf - low_perf > 20)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, - "CPUFreqCPUsSetToSW_ANY", - "Processors are set to SW_ANY."); - once++; + (high_perf - low_perf > 20)) { cpu_set_lowest_frequency(fw, cpu); + ok = false; } performed_tests++; - fwts_progress(fw, 100 * performed_tests/total_tests); - } - if (!once) - fwts_passed(fw, "P-state coordination under hardware control."); -} -#endif - -static int cpufreq_test1(fwts_framework *fw) -{ - int i; - -#ifdef FWTS_ARCH_INTEL - fwts_log_info(fw, - "For each processor in the system, this test steps through the " - "various frequency states (P-states) that the BIOS advertises " - "for the processor. For each processor/frequency combination, " - "a quick performance value is measured. The test then validates that:"); - fwts_log_info_verbatum(fw, " 1. Each processor has the same number of frequency states."); - fwts_log_info_verbatum(fw, " 2. Higher advertised frequencies have a higher performance."); - fwts_log_info_verbatum(fw, " 3. No duplicate frequency values are reported by the BIOS."); - fwts_log_info_verbatum(fw, " 4. BIOS doing Sw_All P-state coordination across cores."); - fwts_log_info_verbatum(fw, " 5. BIOS doing Sw_Any P-state coordination across cores."); -#else - fwts_log_info(fw, - "For each processor in the system, this test steps through the " - "various frequency states that the CPU supports. " - "For each processor/frequency combination, " - "a quick performance value is measured. The test then validates that:"); - fwts_log_info_verbatum(fw, " 1. Each processor has the same number of frequency states."); - fwts_log_info_verbatum(fw, " 2. Higher advertised frequencies have a higher performance."); - fwts_log_info_verbatum(fw, " 3. No duplicate frequency values exist."); -#endif - fwts_log_nl(fw); - - for (i = 0; i < num_cpus; i++) - cpu_set_lowest_frequency(fw, &cpus[i]); - - /* then do the benchmark */ - for (i = 0; i < num_cpus; i++) { - do_cpu(fw, &cpus[i]); - cpu_set_lowest_frequency(fw, &cpus[i]); - if (no_cpufreq) - break; + fwts_progress(fw, 100 * performed_tests/n_tests); } - /* set everything back to the highest speed again */ - for (i = 0; i < num_cpus; i++) - cpu_set_highest_frequency(fw, &cpus[i]); - - -#ifdef FWTS_ARCH_INTEL - if (!no_cpufreq) - check_sw_any(fw); - - /* - * Check for more than one CPU and more than one frequency and - * then do the benchmark set 2 - */ - if (num_cpus > 1 && number_of_speeds > 1) { - do_sw_all_test(fw); - do_sw_any_test(fw); - } else if (number_of_speeds > 1) { - performed_tests += 4; - fwts_progress(fw, 100 * performed_tests/total_tests); - } -#endif - fwts_progress(fw, 100); + if (!ok) + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "CPUFreqCPUsSetToSW_ANY", + "Processors are set to SW_ANY."); + else + fwts_passed(fw, "P-state coordination " + "under hardware control."); return FWTS_OK; } @@ -806,6 +744,10 @@ static int cpufreq_init(fwts_framework *fw __attribute__((unused))) for (i = 0; i < num_cpus; i++) parse_cpu_info(&cpus[i], dirs[i]); + /* all test require a userspace governor */ + for (i = 0; i < num_cpus; i++) + cpu_set_governor(fw, &cpus[i], "userspace"); + return FWTS_OK; } @@ -834,11 +776,9 @@ static fwts_framework_minor_test cpufreq_tests[] = { { cpufreq_test_duplicates, "CPU frequency table duplicates" }, { cpufreq_test_bios_limits, "CPU frequency firmware limits" }, { cpufreq_test_claimed_max, "CPU frequency claimed maximum" }, -#ifdef FWTS_ARCH_INTEL - { cpufreq_test1, "CPU P-State tests." }, -#else - { cpufreq_test1, "CPU Frequency tests." }, -#endif + { cpufreq_test_sw_any, "CPU frequency SW_ANY control" }, + { cpufreq_test_sw_all, "CPU frequency SW_ALL control" }, + { cpufreq_test_cpu_performance, "CPU frequency performance tests." }, { NULL, NULL } }; From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 04/11] cpu/cpufreq: Add test for duplicate entries in cpufreq tables In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.811513.383103853996.4.gpush@pablo> Signed-off-by: Jeremy Kerr --- src/cpu/cpufreq/cpufreq.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c index 517c750..4adb58c 100644 --- a/src/cpu/cpufreq/cpufreq.c +++ b/src/cpu/cpufreq/cpufreq.c @@ -671,6 +671,41 @@ static int cpufreq_test_consistency(fwts_framework *fw) return FWTS_OK; } +static int cpufreq_test_duplicates(fwts_framework *fw) +{ + struct cpu *cpu0 = &cpus[0]; + bool dup = false; + uint64_t freq; + int i; + + /* the frequency list is sorted, so we can do this in one pass */ + for (i = 0; i < cpu0->n_freqs - 1; i++) { + + freq = cpu0->freqs[i].Hz; + + if (cpu0->freqs[i+1].Hz != freq) + continue; + + dup = true; + fwts_log_error(fw, "duplicate cpu frequency %" PRIx64, + freq); + + /* don't report further duplicates for this entry */ + for (i++; i < cpu0->n_freqs - 1; i++) + if (cpu0->freqs[i].Hz != freq) + break; + } + + if (dup) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqDuplicate", + "duplicates found in CPU frequency table"); + } else { + fwts_passed(fw, "No duplicates in CPU frequency table"); + } + + return FWTS_OK; +} + static int cpu_freq_compare(const void *v1, const void *v2) { const fwts_cpu_freq *f1 = v1; @@ -761,6 +796,7 @@ static int cpufreq_deinit(fwts_framework *fw) static fwts_framework_minor_test cpufreq_tests[] = { { cpufreq_test_consistency, "CPU frequency table consistency" }, + { cpufreq_test_duplicates, "CPU frequency table duplicates" }, #ifdef FWTS_ARCH_INTEL { cpufreq_test1, "CPU P-State tests." }, #else From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 05/11] cpu/cpufreq: Do bios limit and claimed max checks as separate tests In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.811825.922596791728.5.gpush@pablo> Rather than combining the bios limit and claimed max tests into the do_cpu tests, separate them out into individual tests. Signed-off-by: Jeremy Kerr --- src/cpu/cpufreq/cpufreq.c | 123 ++++++++++++++++++++++++-------------- 1 file changed, 80 insertions(+), 43 deletions(-) diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c index 4adb58c..0b4d8a7 100644 --- a/src/cpu/cpufreq/cpufreq.c +++ b/src/cpu/cpufreq/cpufreq.c @@ -258,12 +258,7 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) { int i; static int warned = 0; - bool warned_PSS = false; uint64_t cpu_top_perf = 0; - int claimed_hz_too_low = 0; - int bios_limit_too_low = 0; - const uint64_t claimed_hz = get_claimed_hz(cpu); - const uint64_t bios_limit = get_bios_limit(cpu); cpu_set_governor(fw, cpu, "userspace"); @@ -291,11 +286,6 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) for (i = 0; i < cpu->n_freqs; i++) { cpu_set_frequency(fw, cpu, cpu->freqs[i].Hz); - if ((claimed_hz != 0) && (claimed_hz < cpu->freqs[i].Hz)) - claimed_hz_too_low++; - if ((bios_limit != 0) && (bios_limit < cpu->freqs[i].Hz)) - bios_limit_too_low++; - if (fwts_cpu_performance(fw, cpu->idx, &cpu->freqs[i].speed) != FWTS_OK) { fwts_log_error(fw, "Failed to get CPU performance for " @@ -313,31 +303,6 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) if (cpu_top_perf > top_speed) top_speed = cpu_top_perf; - if (claimed_hz_too_low) { - char path[PATH_MAX]; - - cpu_mkpath(path, sizeof(path), cpu, "scaling_max_freq"); - fwts_warning(fw, - "There were %d CPU frequencies larger than the _PSS " - "maximum CPU frequency of %s for CPU %d. Has %s " - "been set too low?", - claimed_hz_too_low, hz_to_human(claimed_hz), - cpu->idx, path); - } - - if (bios_limit_too_low) { - char path[PATH_MAX]; - - cpu_mkpath(path, sizeof(path), cpu, "bios_limit"); - fwts_warning(fw, - "The CPU frequency BIOS limit %s for CPU %d was set to %s " - "which is lower than some of the ACPI scaling frequencies.", - path, cpu->idx, hz_to_human(bios_limit)); - } - - if (claimed_hz_too_low || bios_limit_too_low) - fwts_log_nl(fw); - fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", cpu->idx, cpu->n_freqs); fwts_log_info_verbatum(fw, " Frequency | Relative Speed | Bogo loops"); @@ -378,14 +343,6 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) hz_to_human(cpu->freqs[i].Hz), cpu->freqs[i].speed, cpu->idx); - - if ((cpu->freqs[i].Hz > claimed_hz) && !warned_PSS) { - warned_PSS = true; - fwts_warning(fw, "Frequency %" PRIu64 - " not achievable; _PSS limit of %" PRIu64 - " in effect?", - cpu->freqs[i].Hz, claimed_hz); - } } } @@ -706,6 +663,84 @@ static int cpufreq_test_duplicates(fwts_framework *fw) return FWTS_OK; } +static int cpufreq_test_bios_limits(fwts_framework *fw) +{ + bool ok, present; + int i; + + present = false; + ok = true; + + for (i = 0; i < num_cpus; i++) { + struct cpu *cpu = &cpus[i]; + uint64_t bios_limit; + + bios_limit = get_bios_limit(cpu); + + if (!bios_limit) + continue; + + present = true; + + if (bios_limit < cpu->freqs[cpu->n_freqs-1].Hz) { + ok = false; + fwts_warning(fw, "cpu %d has bios limit of %" PRId64 + ", lower than max freq of %" + PRId64, cpu->idx, bios_limit, + cpu->freqs[cpu->n_freqs-1].Hz); + } + } + + if (!present) + fwts_passed(fw, "No BIOS limits imposed"); + else if (ok) + fwts_passed(fw, "CPU BIOS limit OK"); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqBIOSLimit", + "CPU BIOS limit is set too low"); + + return FWTS_OK; +} + +static int cpufreq_test_claimed_max(fwts_framework *fw) +{ + bool ok, present; + int i; + + present = false; + ok = true; + + for (i = 0; i < num_cpus; i++) { + struct cpu *cpu = &cpus[i]; + uint64_t max; + + max = get_claimed_hz(cpu); + + if (!max) + continue; + + present = true; + + if (max > cpu->freqs[cpu->n_freqs-1].Hz) { + ok = false; + fwts_warning(fw, "cpu %d has claimed frequency of %" + PRId64 ", higher than max freq of %" + PRId64, cpu->idx, max, + cpu->freqs[cpu->n_freqs-1].Hz); + } + } + + if (!present) + fwts_passed(fw, "No max frequencies present"); + else if (ok) + fwts_passed(fw, "CPU max frequencies OK"); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqClaimedMax", + "CPU max frequency is unreachable"); + + return FWTS_OK; +} + static int cpu_freq_compare(const void *v1, const void *v2) { const fwts_cpu_freq *f1 = v1; @@ -797,6 +832,8 @@ static int cpufreq_deinit(fwts_framework *fw) static fwts_framework_minor_test cpufreq_tests[] = { { cpufreq_test_consistency, "CPU frequency table consistency" }, { cpufreq_test_duplicates, "CPU frequency table duplicates" }, + { cpufreq_test_bios_limits, "CPU frequency firmware limits" }, + { cpufreq_test_claimed_max, "CPU frequency claimed maximum" }, #ifdef FWTS_ARCH_INTEL { cpufreq_test1, "CPU P-State tests." }, #else From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 08/11] fwts: Use linux perf counters for cpu benchmarking In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.812594.793229923225.8.gpush@pablo> Currently, we use a loop counter to measure cpu performance. There are a couple of drawbacks of this: 1) the numbers are fairly arbitrary, and don't reflect any external values; and 2) the results are subject to peturbation from other tasks. This change uses the linux perf counters to measure actual CPU cycles, where available. This means we get numbers that are meaningful, and will we'll get the performance value even if our process has been scheduled off the CPU. Now, the new results should match the actual cpu frequencies: CPU 0: 16 CPU frequency steps supported. Frequency | Relative Speed | Cycles | Bogo loops -----------+----------------+------------+----------- 1.200 GHz | 36.5 % | 1197262295 | 114643 1.300 GHz | 39.5 % | 1297048295 | 124214 1.400 GHz | 42.6 % | 1396813066 | 133889 1.500 GHz | 45.6 % | 1496592732 | 143456 1.600 GHz | 48.6 % | 1596393751 | 150124 1.700 GHz | 51.7 % | 1696137977 | 162350 1.800 GHz | 54.7 % | 1795918438 | 172071 1.900 GHz | 57.8 % | 1895685372 | 181249 2.000 GHz | 60.8 % | 1995453204 | 191176 2.100 GHz | 63.8 % | 2095225345 | 200753 2.200 GHz | 66.9 % | 2194993645 | 210282 2.300 GHz | 69.9 % | 2294780535 | 219945 2.400 GHz | 73.0 % | 2394544770 | 229664 2.500 GHz | 76.0 % | 2494315101 | 239121 2.600 GHz | 79.0 % | 2594055116 | 248536 2.601 GHz | 100.0 % | 3281891417 | 314546 CPU 0 performance scaling OK Because we still want benchmarks to work when perf counters are not available, we still measure the loop count. This means we need to represent test results as a struct, with cycles and loops members. When tests need a scalar performance value, fwts_cpu_benchmark_get_best_result will return the most accurate result measured. Signed-off-by: Jeremy Kerr --- src/acpi/cstates/cstates.c | 4 - src/cpu/cpufreq/cpufreq.c | 63 +++++++++++++-------- src/lib/include/fwts_cpu.h | 11 +++ src/lib/src/fwts_cpu.c | 107 ++++++++++++++++++++++++++++++++++--- 4 files changed, 153 insertions(+), 32 deletions(-) diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c index b58f15c..42c634c 100644 --- a/src/acpi/cstates/cstates.c +++ b/src/acpi/cstates/cstates.c @@ -133,9 +133,9 @@ static void do_cpu(fwts_framework *fw, int nth, int cpus, int cpu, char *path) if ((i & 7) < 4) sleep(1); else { - uint64_t loop_count; + fwts_cpu_benchmark_result result; - if (fwts_cpu_performance(fw, cpu, &loop_count) != FWTS_OK) { + if (fwts_cpu_benchmark(fw, cpu, &result) != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_HIGH, "CPUFailedPerformance", "Could not determine the CPU performance, this " "may be due to not being able to get or set the " diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c index 979a9e1..e409375 100644 --- a/src/cpu/cpufreq/cpufreq.c +++ b/src/cpu/cpufreq/cpufreq.c @@ -45,7 +45,7 @@ typedef struct { uint64_t Hz; - uint64_t speed; + fwts_cpu_benchmark_result perf; } fwts_cpu_freq; struct cpu { @@ -149,6 +149,7 @@ static int get_performance_repeat( const int type, uint64_t *retval) { + fwts_cpu_benchmark_result result; int i; uint64_t max = 0; @@ -159,9 +160,10 @@ static int get_performance_repeat( for (i = 0; i < count; i++) { uint64_t temp; - if (fwts_cpu_performance(fw, cpu->idx, &temp) != FWTS_OK) + if (fwts_cpu_benchmark(fw, cpu->idx, &result) != FWTS_OK) return FWTS_ERROR; + temp = fwts_cpu_benchmark_best_result(&result); if (temp) { if (temp < min) min = temp; @@ -276,17 +278,19 @@ static int test_one_cpu_performance(fwts_framework *fw, struct cpu *cpu, int i; for (i = 0; i < cpu->n_freqs; i++) { + uint64_t perf; + cpu_set_frequency(fw, cpu, cpu->freqs[i].Hz); - if (fwts_cpu_performance(fw, cpu->idx, &cpu->freqs[i].speed) + if (fwts_cpu_benchmark(fw, cpu->idx, &cpu->freqs[i].perf) != FWTS_OK) { fwts_log_error(fw, "Failed to get CPU performance for " "CPU frequency %" PRId64 " Hz.", cpu->freqs[i].Hz); - cpu->freqs[i].speed = 0; } - if (cpu->freqs[i].speed > cpu_top_perf) - cpu_top_perf = cpu->freqs[i].speed; + perf = fwts_cpu_benchmark_best_result(&cpu->freqs[i].perf); + if (perf > cpu_top_perf) + cpu_top_perf = perf; fwts_progress(fw, (100 * ((cpu_idx * cpu->n_freqs) + i)) / (n_online_cpus * cpu->n_freqs)); @@ -294,37 +298,46 @@ static int test_one_cpu_performance(fwts_framework *fw, struct cpu *cpu, fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", cpu->idx, cpu->n_freqs); - fwts_log_info_verbatum(fw, " Frequency | Relative Speed | Bogo loops"); - fwts_log_info_verbatum(fw, "-----------+----------------+-----------"); + fwts_log_info_verbatum(fw, + " Frequency | Relative Speed | Cycles | Bogo loops"); + fwts_log_info_verbatum(fw, + "-----------+----------------+------------+-----------"); for (i = 0; i < cpu->n_freqs; i++) { char *turbo = ""; #ifdef FWTS_ARCH_INTEL if ((i == 0) && (cpu->n_freqs > 1) && - (hz_almost_equal(cpu->freqs[i].Hz, cpu->freqs[i + 1].Hz))) + (hz_almost_equal(cpu->freqs[i].Hz, cpu->freqs[i + 1].Hz))) turbo = " (Turbo Boost)"; #endif - fwts_log_info_verbatum(fw, "%10s | %5.1f %% | %9" PRIu64 - "%s", + uint64_t perf = fwts_cpu_benchmark_best_result( + &cpu->freqs[i].perf); + fwts_log_info_verbatum(fw, + "%10s | %5.1f %% " + "| %10" PRIu64 " | %9" PRIu64 "%s", hz_to_human(cpu->freqs[i].Hz), - 100.0 * cpu->freqs[i].speed / cpu_top_perf, - cpu->freqs[i].speed, turbo); + 100.0 * perf / cpu_top_perf, + cpu->freqs[i].perf.cycles, + cpu->freqs[i].perf.loops, + turbo); } fwts_log_nl(fw); /* now check for increasing performance */ for (i = 0; i < cpu->n_freqs - 1; i++) { - if (cpu->freqs[i].speed <= cpu->freqs[i+1].speed) + uint64_t perf, last_perf; + + last_perf = fwts_cpu_benchmark_best_result(&cpu->freqs[i].perf); + perf = fwts_cpu_benchmark_best_result(&cpu->freqs[i+1].perf); + if (last_perf <= perf) continue; fwts_log_warning(fw, "Supposedly higher frequency %s is slower (%" PRIu64 - " bogo loops) than frequency %s (%" PRIu64 - " bogo loops) on CPU %i.", - hz_to_human(cpu->freqs[i+1].Hz), - cpu->freqs[i+1].speed, - hz_to_human(cpu->freqs[i].Hz), - cpu->freqs[i].speed, + ") than frequency %s (%" PRIu64 + ") on CPU %i.", + hz_to_human(cpu->freqs[i+1].Hz), perf, + hz_to_human(cpu->freqs[i].Hz), last_perf, cpu->idx); return FWTS_ERROR; } @@ -459,6 +472,7 @@ static int cpufreq_test_sw_any(fwts_framework *fw) { uint64_t low_perf, high_perf, newhigh_perf; int i, j, rc, n_tests, performed_tests; + fwts_cpu_benchmark_result result; bool ok; rc = sw_tests_possible(fw); @@ -478,12 +492,13 @@ static int cpufreq_test_sw_any(fwts_framework *fw) cpu_set_lowest_frequency(fw, &cpus[i]); /* assume that all processors have the same low performance */ - if (fwts_cpu_performance(fw, cpus[0].idx, &low_perf) != FWTS_OK) { + if (fwts_cpu_benchmark(fw, cpus[0].idx, &result) != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqCPsSetToSW_ANYGetPerf", "Cannot get CPU performance."); return FWTS_ERROR; } + low_perf = fwts_cpu_benchmark_best_result(&result); ok = true; @@ -497,12 +512,13 @@ static int cpufreq_test_sw_any(fwts_framework *fw) if (!cpu->online) continue; - if (fwts_cpu_performance(fw, cpu->idx, &high_perf) != FWTS_OK) { + if (fwts_cpu_benchmark(fw, cpu->idx, &result) != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqCPsSetToSW_ANYGetPerf", "Cannot get CPU performance."); return FWTS_ERROR; } + high_perf = fwts_cpu_benchmark_best_result(&result); performed_tests++; fwts_progress(fw, 100 * performed_tests/n_tests); @@ -514,13 +530,14 @@ static int cpufreq_test_sw_any(fwts_framework *fw) for (j = 0; j < num_cpus; j++) if (i != j) cpu_set_lowest_frequency(fw, &cpus[j]); - if (fwts_cpu_performance(fw, cpu->idx, &newhigh_perf) + if (fwts_cpu_benchmark(fw, cpu->idx, &result) != FWTS_OK) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqCPsSetToSW_ANYGetPerf", "Cannot get CPU performance."); return FWTS_ERROR; } + newhigh_perf = fwts_cpu_benchmark_best_result(&result); if ((high_perf > newhigh_perf) && (high_perf - newhigh_perf > (high_perf - low_perf)/4) && (high_perf - low_perf > 20)) { diff --git a/src/lib/include/fwts_cpu.h b/src/lib/include/fwts_cpu.h index b132697..7162316 100644 --- a/src/lib/include/fwts_cpu.h +++ b/src/lib/include/fwts_cpu.h @@ -33,6 +33,12 @@ typedef struct cpuinfo_x86 { char *flags; /* String containing flags */ } fwts_cpuinfo_x86; +typedef struct cpu_benchmark_result { + bool cycles_valid; + uint64_t loops; + uint64_t cycles; +} fwts_cpu_benchmark_result; + int fwts_cpu_readmsr(const int cpu, const uint32_t reg, uint64_t *val); int fwts_cpu_is_Intel(bool *is_intel); @@ -46,6 +52,9 @@ int fwts_cpu_enumerate(void); int fwts_cpu_consume(const int seconds); int fwts_cpu_consume_start(void); void fwts_cpu_consume_complete(void); -int fwts_cpu_performance(fwts_framework *fw, const int cpu, uint64_t *loop_count); +int fwts_cpu_benchmark(fwts_framework *fw, const int cpu, + fwts_cpu_benchmark_result *result); + +uint64_t fwts_cpu_benchmark_best_result(fwts_cpu_benchmark_result *res); #endif diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c index 75b1100..a7cfd3d 100644 --- a/src/lib/src/fwts_cpu.c +++ b/src/lib/src/fwts_cpu.c @@ -26,8 +26,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -35,6 +37,8 @@ #include #include +#include + #include "fwts_types.h" #include "fwts_cpu.h" #include "fwts_pipeio.h" @@ -312,20 +316,73 @@ static void fwts_cpu_burn_cycles(void) } } +static int perf_setup_counter(int cpu) +{ + struct perf_event_attr attr; + int fd; + + memset(&attr, 0, sizeof(attr)); + attr.type = PERF_TYPE_HARDWARE; + attr.config = PERF_COUNT_HW_CPU_CYCLES; + attr.disabled = 1; + attr.size = sizeof(attr); + + fd = syscall(__NR_perf_event_open, &attr, -1, cpu, -1, 0); + return fd; +} + +static int perf_start_counter(int fd) +{ + int rc; + + rc = ioctl(fd, PERF_EVENT_IOC_ENABLE); + return rc == 0 ? FWTS_OK : FWTS_ERROR; +} + +static int perf_stop_counter(int fd) +{ + int rc; + + rc = ioctl(fd, PERF_EVENT_IOC_DISABLE); + return rc == 0 ? FWTS_OK : FWTS_ERROR; +} + +static int perf_read_counter(int fd, unsigned long long *result) +{ + unsigned long long buf; + int rc; + + rc = read(fd, &buf, sizeof(buf)); + if (rc == sizeof(buf)) { + *result = buf; + rc = FWTS_OK; + } else { + rc = FWTS_ERROR; + } + + close(fd); + return rc; +} + /* - * fwts_cpu_performance() + * fwts_cpu_benchmark() * */ -int fwts_cpu_performance( +int fwts_cpu_benchmark( fwts_framework *fw, const int cpu, /* CPU we want to measure performance */ - uint64_t *loop_count) /* Returned measure of bogo compute power */ + fwts_cpu_benchmark_result *result) { + unsigned long long perfctr_result; + fwts_cpu_benchmark_result tmp; cpu_set_t mask, oldset; + int perfctr, ncpus, rc; + static bool warned; time_t current; - int ncpus = fwts_cpu_enumerate(); + bool perf_ok; - *loop_count = 0; + ncpus = fwts_cpu_enumerate(); + memset(&tmp, 0, sizeof(tmp)); if (ncpus == FWTS_ERROR) return FWTS_ERROR; @@ -333,6 +390,20 @@ int fwts_cpu_performance( if (cpu < 0 || cpu > ncpus) return FWTS_ERROR; + /* setup perf counter */ + perf_ok = true; + perfctr = perf_setup_counter(cpu); + if (perfctr < 0) { + if (!warned) { + fwts_log_warning(fw, "Can't use linux performance " + "counters (perf), falling back to " + "relative measurements"); + warned = true; + } + perf_ok = false; + } + + /* Pin to the specified CPU */ if (sched_getaffinity(0, sizeof(oldset), &oldset) < 0) { @@ -352,6 +423,9 @@ int fwts_cpu_performance( while (current == time(NULL)) sched_yield(); + if (perf_ok) + perf_start_counter(perfctr); + current = time(NULL); /* @@ -360,17 +434,38 @@ int fwts_cpu_performance( */ do { fwts_cpu_burn_cycles(); - (*loop_count)++; + tmp.loops++; } while (current == time(NULL)); + if (perf_ok) + perf_stop_counter(perfctr); + if (sched_setaffinity(0, sizeof(oldset), &oldset) < 0) { fwts_log_error(fw, "Cannot restore old CPU affinity settings."); return FWTS_ERROR; } + if (perf_ok) { + rc = perf_read_counter(perfctr, &perfctr_result); + if (rc == FWTS_OK) { + tmp.cycles = perfctr_result; + tmp.cycles_valid = true; + } else { + fwts_log_warning(fw, "failed to read perf counters"); + } + + } + + *result = tmp; + return FWTS_OK; } +uint64_t fwts_cpu_benchmark_best_result(fwts_cpu_benchmark_result *res) +{ + return res->cycles_valid ? res->cycles : res->loops; +} + /* * fwts_cpu_consume_cycles() * eat up CPU cycles From jk at ozlabs.org Thu May 21 09:34:27 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Thu, 21 May 2015 17:34:27 +0800 Subject: [PATCH 09/11] fwts: Use gettimeofday for cpu benchmark In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <1432200867.812695.718003224529.9.gpush@pablo> Currently, we use time() to measure out one second of time for a CPU benchmark. This means we have to wait around one second for a new time value before performing the test, and means we have to assume that we've been running for about one second. This change uses gettimeofday() instead; this way, we don't need to wait before starting a test, and get millisecond resolution when calculating the performance value. Signed-off-by: Jeremy Kerr --- src/lib/src/fwts_cpu.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c index a7cfd3d..743de63 100644 --- a/src/lib/src/fwts_cpu.c +++ b/src/lib/src/fwts_cpu.c @@ -31,11 +31,11 @@ #include #include #include +#include #include #include #include #include -#include #include @@ -373,12 +373,12 @@ int fwts_cpu_benchmark( const int cpu, /* CPU we want to measure performance */ fwts_cpu_benchmark_result *result) { + struct timeval start, end, duration; unsigned long long perfctr_result; fwts_cpu_benchmark_result tmp; cpu_set_t mask, oldset; int perfctr, ncpus, rc; static bool warned; - time_t current; bool perf_ok; ncpus = fwts_cpu_enumerate(); @@ -418,24 +418,24 @@ int fwts_cpu_benchmark( return FWTS_ERROR; } - /* Wait until we get a new second */ - current = time(NULL); - while (current == time(NULL)) - sched_yield(); - if (perf_ok) perf_start_counter(perfctr); - - current = time(NULL); + gettimeofday(&start, NULL); /* * And burn some CPU cycles and get a bogo-compute like * loop count measure of CPU performance. */ - do { + for (;;) { fwts_cpu_burn_cycles(); + tmp.loops++; - } while (current == time(NULL)); + + gettimeofday(&end, NULL); + timersub(&end, &start, &duration); + if (duration.tv_sec >= 1) + break; + } if (perf_ok) perf_stop_counter(perfctr); @@ -448,7 +448,9 @@ int fwts_cpu_benchmark( if (perf_ok) { rc = perf_read_counter(perfctr, &perfctr_result); if (rc == FWTS_OK) { - tmp.cycles = perfctr_result; + tmp.cycles = perfctr_result / + ((1.0 * duration.tv_usec / 1000000) + + duration.tv_sec); tmp.cycles_valid = true; } else { fwts_log_warning(fw, "failed to read perf counters"); From colin.king at canonical.com Thu May 21 16:58:07 2015 From: colin.king at canonical.com (Colin Ian King) Date: Thu, 21 May 2015 17:58:07 +0100 Subject: [PATCH 1/3] devicetree/dtc: Add initial device tree test In-Reply-To: <1432192507.646890.191605150773.1.gpush@pablo> References: <1432192507.646890.191605150773.1.gpush@pablo> Message-ID: <555E0E9F.9010905@canonical.com> Thanks Jeremy, I'm on vacation for a few days, so I will give these a thorough review middle of next week. Just one question, what is the expected behaviour if dtc is not installed. Also, I think the device-tree-compiler package should be added to the debian control Colin On 21/05/15 08:15, Jeremy Kerr wrote: > Check that we can compile the device tree with dtc. > > Signed-off-by: Jeremy Kerr > > --- > src/Makefile.am | 1 > src/devicetree/dtc/dtc.c | 76 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 77 insertions(+) > > diff --git a/src/Makefile.am b/src/Makefile.am > index 62c63ef..4a2622b 100644 > --- a/src/Makefile.am > +++ b/src/Makefile.am > @@ -78,6 +78,7 @@ fwts_SOURCES = main.c \ > cpu/nx/nx.c \ > cpu/msr/msr.c \ > cpu/microcode/microcode.c \ > + devicetree/dtc/dtc.c \ > dmi/dmicheck/dmicheck.c \ > hotkey/hotkey/hotkey.c \ > hpet/hpet_check/hpet_check.c \ > diff --git a/src/devicetree/dtc/dtc.c b/src/devicetree/dtc/dtc.c > new file mode 100644 > index 0000000..c1420dc > --- /dev/null > +++ b/src/devicetree/dtc/dtc.c > @@ -0,0 +1,76 @@ > +/* > + * Copyright (C) 2014 Jeremy Kerr > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version 2 > + * of the License, or (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > + * 02110-1301, USA. > + * > + */ > + > +#define _GNU_SOURCE > +#include > +#include > + > +#include "fwts.h" > + > +static const char *devicetree_path = "/proc/device-tree"; > + > +static int dtc_check_valid(fwts_framework *fw) > +{ > + int rc, status; > + char *command; > + > + rc = asprintf(&command, "dtc -I fs -o /dev/null %s", devicetree_path); > + assert(rc > 0); > + > + rc = fwts_exec(command, &status); > + free(command); > + > + if (rc != FWTS_OK || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { > + fwts_failed(fw, LOG_LEVEL_HIGH, "DeviceTreeDtcParseFail", > + "dtc reports device tree errors"); > + return FWTS_ERROR; > + } > + > + fwts_passed(fw, "dtc test passed"); > + return FWTS_OK; > +} > + > +static int dtc_init(fwts_framework *fw) > +{ > + int rc, status; > + > + rc = fwts_exec("echo '/dts-v1/; / { };' | dtc -o /dev/null", &status); > + > + if (rc != FWTS_OK || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { > + fwts_aborted(fw, "Failed to run dtc"); > + return FWTS_ABORTED; > + } > + > + return FWTS_OK; > +} > + > +static fwts_framework_minor_test dtc_tests[] = { > + { dtc_check_valid, "Check device tree validity with dtc" }, > + { NULL, NULL }, > +}; > + > +static fwts_framework_ops dtc_ops = { > + .description = "Device tree compilation test", > + .minor_tests = dtc_tests, > + .init = dtc_init, > +}; > + > +FWTS_REGISTER_FEATURES("dtc", &dtc_ops, FWTS_TEST_ANYTIME, > + FWTS_FLAG_BATCH, FWTS_FW_FEATURE_DEVICETREE); > From alex.hung at canonical.com Thu May 21 22:49:50 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 21 May 2015 15:49:50 -0700 Subject: ACK: [PATCH] bios: mtrr: fix memory leak on mtrr entries In-Reply-To: <1431603181-7915-1-git-send-email-colin.king@canonical.com> References: <1431603181-7915-1-git-send-email-colin.king@canonical.com> Message-ID: <555E610E.7020703@canonical.com> On 05/14/2015 04:33 AM, Colin King wrote: > From: Colin Ian King > > CoverityScan picked up a memory leak on the allocated entries that > don't get added to the mttr entry list when they fail specific > filtering criteria. > > Signed-off-by: Colin Ian King > --- > src/bios/mtrr/mtrr.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c > index 8bec28b..c86090f 100644 > --- a/src/bios/mtrr/mtrr.c > +++ b/src/bios/mtrr/mtrr.c > @@ -119,18 +119,24 @@ static int get_mtrrs(void) > */ > > /* Get register, in decimal */ > - if (strncmp(line, "reg", 3)) > + if (strncmp(line, "reg", 3)) { > + free(entry); > continue; > + } > entry->reg = strtoul(line + 3, NULL, 10); > > /* Get base, in hex */ > - if ((ptr1 = strstr(line, "base=0x")) == NULL) > + if ((ptr1 = strstr(line, "base=0x")) == NULL) { > + free(entry); > continue; > + } > entry->start = strtoull(ptr1 + 5, NULL, 16); > > /* Get size, in decimal */ > - if ((ptr1 = strstr(line, "size=")) == NULL) > + if ((ptr1 = strstr(line, "size=")) == NULL) { > + free(entry); > continue; > + } > > entry->size = strtoull(ptr1 + 5, &ptr2, 10); > if (ptr2 && (*ptr2 == 'm')) > Acked-by: Alex Hung From alex.hung at canonical.com Thu May 21 22:52:31 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 21 May 2015 15:52:31 -0700 Subject: ACK: [PATCH] hotkey: only process reads of hotkey events that are at least the correct length In-Reply-To: <1431603197-7965-1-git-send-email-colin.king@canonical.com> References: <1431603197-7965-1-git-send-email-colin.king@canonical.com> Message-ID: <555E61AF.8070105@canonical.com> On 05/14/2015 04:33 AM, Colin King wrote: > From: Colin Ian King > > Coverity Scan found an issue where the comparison to the event structure was > incorrect when reads were too short in size. > > Signed-off-by: Colin Ian King > --- > src/hotkey/hotkey/hotkey.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/src/hotkey/hotkey/hotkey.c b/src/hotkey/hotkey/hotkey.c > index 6e40df1..28d3ef1 100644 > --- a/src/hotkey/hotkey/hotkey.c > +++ b/src/hotkey/hotkey/hotkey.c > @@ -90,20 +90,20 @@ static int hotkey_test(fwts_framework *fw, char *dev, fwts_list *hotkeys) > } > > while (do_test) { > - switch (read(fd, &ev, sizeof(ev))) { > - case -1: > - case 0: > + ssize_t ret = read(fd, &ev, sizeof(ev)); > + > + if (ret < (ssize_t)sizeof(ev)) { > do_test = 0; > break; > - default: > - if ((ev.type == EV_KEY) && > - (ev.code == KEY_ESC) && > - (ev.value == 0)) > - do_test = 0; > - else > - hotkey_check_key(fw, &ev, hotkeys); > - break; > } > + > + if ((ev.type == EV_KEY) && > + (ev.code == KEY_ESC) && > + (ev.value == 0)) > + do_test = 0; > + else > + hotkey_check_key(fw, &ev, hotkeys); > + break; > } > > if (ioctl(fd, EVIOCGRAB, (void*)0)) { /* Release */ > Acked-by: Alex Hung From alex.hung at canonical.com Thu May 21 22:55:08 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 21 May 2015 15:55:08 -0700 Subject: ACK: [PATCH] lib: fwts_args: use strncpy instead of strcpy In-Reply-To: <1431603206-8013-1-git-send-email-colin.king@canonical.com> References: <1431603206-8013-1-git-send-email-colin.king@canonical.com> Message-ID: <555E624C.1040808@canonical.com> On 05/14/2015 04:33 AM, Colin King wrote: > From: Colin Ian King > > Coverity Scan was flagging up the use of strcpy and of a potential > buffer overrun, so use strncpy instead. > > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_args.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c > index 86e0d4b..5dc9261 100644 > --- a/src/lib/src/fwts_args.c > +++ b/src/lib/src/fwts_args.c > @@ -299,8 +299,8 @@ void fwts_args_show_options(void) > } > } > } > - strcat(ptr, "--"); > - strcat(ptr, option->long_name); > + strncat(ptr, "--", ptr - buffer - 1); > + strncat(ptr, option->long_name, ptr - buffer - 3); > > fwts_args_show_option(width, buffer, option->explanation); > } > Acked-by: Alex Hung From alex.hung at canonical.com Thu May 21 22:59:38 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 21 May 2015 15:59:38 -0700 Subject: ACK: [PATCH] uefi: uefirtvariable: fix incorrect buffer size being passed In-Reply-To: <1431686131-12311-1-git-send-email-colin.king@canonical.com> References: <1431686131-12311-1-git-send-email-colin.king@canonical.com> Message-ID: <555E635A.1010609@canonical.com> On 05/15/2015 03:35 AM, Colin King wrote: > From: Colin Ian King > > The existing code passes the size of name, which turns out to be a 4 or > 8 depending on a 32 or 64 bit machine because name is a pointer and not > a buffer. Fix this by making name a variable sized array; this also > allows us to remove the complexity of allocation failure handling too. > > Signed-off-by: Colin Ian King > --- > src/uefi/uefirtvariable/uefirtvariable.c | 19 +++++++------------ > 1 file changed, 7 insertions(+), 12 deletions(-) > > diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c > index 0617ff4..e59e005 100644 > --- a/src/uefi/uefirtvariable/uefirtvariable.c > +++ b/src/uefi/uefirtvariable/uefirtvariable.c > @@ -633,7 +633,6 @@ static int getnextvariable_test3(fwts_framework *fw) > uint64_t maxvariablenamesize = variablenamesize; > uint16_t *variablename; > EFI_GUID vendorguid; > - char *name; > int ret; > > variablename = malloc(sizeof(uint16_t) * variablenamesize); > @@ -730,17 +729,13 @@ static int getnextvariable_test3(fwts_framework *fw) > item->hash = hash_func(variablename, variablenamesize); > > if (bucket_insert(item)) { > - name = malloc(variablenamesize * sizeof(char)); > - if (name) { > - fwts_uefi_str16_to_str(name, sizeof(name), variablename); > - fwts_failed(fw, LOG_LEVEL_HIGH, > - "UEFIRuntimeGetNextVariableName", > - "Duplicate variable name %s found.", name); > - free(name); > - } else > - fwts_failed(fw, LOG_LEVEL_HIGH, > - "UEFIRuntimeGetNextVariableName", > - "Duplicate variable name found (too long name)."); > + char name[variablenamesize]; > + > + fwts_uefi_str16_to_str(name, sizeof(name), variablename); > + fwts_failed(fw, LOG_LEVEL_HIGH, > + "UEFIRuntimeGetNextVariableName", > + "Duplicate variable name %s found.", name); > + > free(item->name); > free(item->guid); > free(item); > Acked-by: Alex Hung From alex.hung at canonical.com Thu May 21 23:04:01 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 21 May 2015 16:04:01 -0700 Subject: ACK: [PATCH] lib: fwts_acpi_tables: enforce stricter table loading checks In-Reply-To: <1431686162-12479-1-git-send-email-colin.king@canonical.com> References: <1431686162-12479-1-git-send-email-colin.king@canonical.com> Message-ID: <555E6461.4050907@canonical.com> On 05/15/2015 03:36 AM, Colin King wrote: > From: Colin Ian King > > Coverty Scan is warning that malicious or malformed tables being read in > from file could cause problems with the low 32 bit allocator. Add some > stricter checking of the size of the buffer being read and also the total > ACPI table size. ACPI stipulates that the table size is a 32 bit integer > (which is huge), but we need to keep to that maximum upper limit to be > in spec. > > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_acpi_tables.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c > index 81fb096..cca1135 100644 > --- a/src/lib/src/fwts_acpi_tables.c > +++ b/src/lib/src/fwts_acpi_tables.c > @@ -667,6 +667,10 @@ static uint8_t *fwts_acpi_load_table_from_file(const int fd, size_t *length) > } > continue; > } > + if (n > (ssize_t)sizeof(buffer)) > + goto too_big; /* Unlikely */ > + if (size + n > 0xffffffff) > + goto too_big; /* Very unlikely */ > > if ((tmp = (uint8_t*)fwts_low_realloc(ptr, size + n + 1)) == NULL) { > free(ptr); > @@ -678,6 +682,11 @@ static uint8_t *fwts_acpi_load_table_from_file(const int fd, size_t *length) > } > *length = size; > return ptr; > + > +too_big: > + free(ptr); > + *length = 0; > + return NULL; > } > > /* > Acked-by: Alex Hung From alex.hung at canonical.com Thu May 21 23:07:23 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 21 May 2015 16:07:23 -0700 Subject: ACK: [PATCH] lib: acpica: explicitly set buffer to NULL to remove cppcheck warning In-Reply-To: <1431686184-12609-1-git-send-email-colin.king@canonical.com> References: <1431686184-12609-1-git-send-email-colin.king@canonical.com> Message-ID: <555E652B.8040506@canonical.com> On 05/15/2015 03:36 AM, Colin King wrote: > From: Colin Ian King > > cppcheck isn't quite so smart as CoverityScan so it continues to complain > about a potential free issue as a false positive. I've taken the liberty > to explicity set buffer to NULL to make the code clearer and this helps > cppcheck to understand the flow of control better. > > Signed-off-by: Colin Ian King > --- > src/acpica/fwts_acpica.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c > index 4a6baf6..9bfd0ae 100644 > --- a/src/acpica/fwts_acpica.c > +++ b/src/acpica/fwts_acpica.c > @@ -452,8 +452,10 @@ void fwts_acpica_vprintf(const char *fmt, va_list args) > buffer = malloc(buffer_len); > if (buffer) > strcpy(buffer, tmp); > - else > + else { > + buffer = NULL; > buffer_len = 0; > + } > } else { > char *new_buf; > > @@ -464,11 +466,12 @@ void fwts_acpica_vprintf(const char *fmt, va_list args) > strcat(buffer, tmp); > } else { > free(buffer); > + buffer = NULL; > buffer_len = 0; > } > } > > - if (buffer_len && index(buffer, '\n') != NULL) { > + if (buffer && index(buffer, '\n') != NULL) { > fwts_log_info(fwts_acpica_fw, "%s", buffer); > free(buffer); > buffer_len = 0; > Acked-by: Alex Hung From alex.hung at canonical.com Thu May 21 23:07:38 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 21 May 2015 16:07:38 -0700 Subject: ACK: [PATCH] acpi: battery: clean up source, no functional change In-Reply-To: <1431686206-12752-1-git-send-email-colin.king@canonical.com> References: <1431686206-12752-1-git-send-email-colin.king@canonical.com> Message-ID: <555E653A.4030404@canonical.com> On 05/15/2015 03:36 AM, Colin King wrote: > From: Colin Ian King > > cppcheck was complaining about being able to reduce the scope > of new_variable: > > [src/acpi/battery/battery.c:157]: (style) The scope of the > variable 'new_value' can be reduced. > > ..so move the declaration. Also re-format the spacing in > an ancient for loop > > Signed-off-by: Colin Ian King > --- > src/acpi/battery/battery.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/acpi/battery/battery.c b/src/acpi/battery/battery.c > index d216b32..bd4e257 100644 > --- a/src/acpi/battery/battery.c > +++ b/src/acpi/battery/battery.c > @@ -154,14 +154,15 @@ static void check_discharging(fwts_framework *fw, int index, char *name) > { > int i; > /* when we get here we KNOW the state is "discharging" */ > - uint32_t initial_value, new_value; > + uint32_t initial_value; > > fwts_printf(fw, "==== Waiting to see if battery '%s' discharges ====\n", name); > fwts_cpu_consume_start(); > > initial_value = get_full(fw, index); > - for (i=0; i<=120; i++) { > - new_value = get_full(fw, index); > + for (i = 0; i <= 120; i++) { > + uint32_t new_value = get_full(fw, index); > + > if (new_value fwts_passed(fw, "Battery %s charge is decrementing as expected.", name); > fwts_cpu_consume_complete(); > Acked-by: Alex Hung From alex.hung at canonical.com Thu May 21 23:20:46 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 21 May 2015 16:20:46 -0700 Subject: ACK: [PATCH] acpica: fwts_iasl_interface: clean up static analyzer warning on freopen In-Reply-To: <1431686236-12917-1-git-send-email-colin.king@canonical.com> References: <1431686236-12917-1-git-send-email-colin.king@canonical.com> Message-ID: <555E684E.8090504@canonical.com> On 05/15/2015 03:37 AM, Colin King wrote: > From: Colin Ian King > > cppcheck is being a bit overly zealous: > > [src/acpica/source/compiler/fwts_iasl_interface.c:114]: > (error) Return value of allocation function freopen is not stored. > > ..but we may as well assign a file pointer to the freopen() call and > explicitly close it before calling _exit() just to make things a little > clearer to cppcheck > > Signed-off-by: Colin Ian King > --- > src/acpica/source/compiler/fwts_iasl_interface.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/acpica/source/compiler/fwts_iasl_interface.c b/src/acpica/source/compiler/fwts_iasl_interface.c > index 56dc76e..68338c9 100644 > --- a/src/acpica/source/compiler/fwts_iasl_interface.c > +++ b/src/acpica/source/compiler/fwts_iasl_interface.c > @@ -71,13 +71,13 @@ int fwts_iasl_disassemble_aml( > { > pid_t pid; > int status, i; > + FILE *fp; > > pid = fork(); > switch (pid) { > case -1: > return -1; > case 0: > - > /* Child */ > init_asl_core(); > > @@ -111,9 +111,10 @@ int fwts_iasl_disassemble_aml( > } > > /* Throw away noisy errors */ > - if (freopen("/dev/null", "w", stderr) != NULL) > + if ((fp = freopen("/dev/null", "w", stderr)) != NULL) { > AslDoOneFile((char *)tables[which]); > - > + fclose(fp); > + } > _exit(0); > break; > default: > Acked-by: Alex Hung From alex.hung at canonical.com Thu May 21 23:21:00 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 21 May 2015 16:21:00 -0700 Subject: ACK: [PATCH] lib: fwts_pipe: clean up static analyzer warning on freopen In-Reply-To: <1431686246-13001-1-git-send-email-colin.king@canonical.com> References: <1431686246-13001-1-git-send-email-colin.king@canonical.com> Message-ID: <555E685C.9030803@canonical.com> On 05/15/2015 03:37 AM, Colin King wrote: > From: Colin Ian King > > cppcheck is being a bit overly zealous: > > [src/lib/src/fwts_pipeio.c:64]: (error) Return value of allocation function freopen is not stored. > (error) Return value of allocation function freopen is not stored. > > ..but we may as well assign a file pointer to the freopen() call and > explicitly close it before calling _exit() just to make things a little > clearer to cppcheck > > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_pipeio.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c > index b5d7fee..94edb16 100644 > --- a/src/lib/src/fwts_pipeio.c > +++ b/src/lib/src/fwts_pipeio.c > @@ -48,6 +48,7 @@ int fwts_pipe_open(const char *command, pid_t *childpid) > { > int pipefds[2]; > pid_t pid; > + FILE *fp; > > if (pipe(pipefds) < 0) > return -1; > @@ -61,7 +62,7 @@ int fwts_pipe_open(const char *command, pid_t *childpid) > return -1; > case 0: > /* Child */ > - if (freopen("/dev/null", "w", stderr) == NULL) { > + if ((fp = freopen("/dev/null", "w", stderr)) == NULL) { > fprintf(stderr, "Cannot redirect stderr\n"); > } > if (pipefds[0] != STDOUT_FILENO) { > @@ -70,6 +71,8 @@ int fwts_pipe_open(const char *command, pid_t *childpid) > } > close(pipefds[0]); > execl(_PATH_BSHELL, "sh", "-c", command, NULL); > + if (fp) > + fclose(fp); > _exit(FWTS_EXEC_ERROR); > default: > /* Parent */ > Acked-by: Alex Hung From alex.hung at canonical.com Thu May 21 23:21:39 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 21 May 2015 16:21:39 -0700 Subject: ACK: [PATCH] ACPICA: Update version to 20150515 (LP: #1455946) In-Reply-To: <1431880659-8497-1-git-send-email-colin.king@canonical.com> References: <1431880659-8497-1-git-send-email-colin.king@canonical.com> Message-ID: <555E6883.40708@canonical.com> On 05/17/2015 09:37 AM, Colin King wrote: > From: Colin Ian King > > Update to ACPICA 20150515, for changes since the previous > release incorporated in fwts please refer to the follwing: > > https://lists.acpica.org/pipermail/devel/2015-May/000707.html > > Signed-off-by: Colin Ian King > --- Acked-by: Alex Hung From jk at ozlabs.org Fri May 22 02:29:32 2015 From: jk at ozlabs.org (Jeremy Kerr) Date: Fri, 22 May 2015 10:29:32 +0800 Subject: [PATCH 1/3] devicetree/dtc: Add initial device tree test In-Reply-To: <555E0E9F.9010905@canonical.com> References: <1432192507.646890.191605150773.1.gpush@pablo> <555E0E9F.9010905@canonical.com> Message-ID: <555E948C.3030600@ozlabs.org> Hi Colin, > I'm on vacation for a few days, so I will give these a thorough review > middle of next week. Great, thanks. Enjoy the vacation! > Just one question, what is the expected behaviour if dtc is not > installed. Also, I think the device-tree-compiler package should be > added to the debian control At present, we just abort from the ->init, we could skip instead if that's cleaner. However, since this test depends on FWTS_FW_FEATURE_DEVICETREE, that'll only happen on dt-based machines. If we do add it to the debian/control dependencies, we might just want that for the powerpc and ppc64el architectures (and maybe ARM?). No use pulling it in for x86. Cheers, Jeremy From colin.king at canonical.com Tue May 26 08:45:30 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 09:45:30 +0100 Subject: [PATCH 1/3] devicetree/dtc: Add initial device tree test In-Reply-To: <1432192507.646890.191605150773.1.gpush@pablo> References: <1432192507.646890.191605150773.1.gpush@pablo> Message-ID: <556432AA.1080002@canonical.com> On 21/05/15 08:15, Jeremy Kerr wrote: > Check that we can compile the device tree with dtc. > > Signed-off-by: Jeremy Kerr > > --- > src/Makefile.am | 1 > src/devicetree/dtc/dtc.c | 76 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 77 insertions(+) > > diff --git a/src/Makefile.am b/src/Makefile.am > index 62c63ef..4a2622b 100644 > --- a/src/Makefile.am > +++ b/src/Makefile.am > @@ -78,6 +78,7 @@ fwts_SOURCES = main.c \ > cpu/nx/nx.c \ > cpu/msr/msr.c \ > cpu/microcode/microcode.c \ > + devicetree/dtc/dtc.c \ > dmi/dmicheck/dmicheck.c \ > hotkey/hotkey/hotkey.c \ > hpet/hpet_check/hpet_check.c \ > diff --git a/src/devicetree/dtc/dtc.c b/src/devicetree/dtc/dtc.c > new file mode 100644 > index 0000000..c1420dc > --- /dev/null > +++ b/src/devicetree/dtc/dtc.c > @@ -0,0 +1,76 @@ > +/* > + * Copyright (C) 2014 Jeremy Kerr > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version 2 > + * of the License, or (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > + * 02110-1301, USA. > + * > + */ > + > +#define _GNU_SOURCE > +#include > +#include > + > +#include "fwts.h" > + > +static const char *devicetree_path = "/proc/device-tree"; > + > +static int dtc_check_valid(fwts_framework *fw) > +{ > + int rc, status; > + char *command; > + > + rc = asprintf(&command, "dtc -I fs -o /dev/null %s", devicetree_path); > + assert(rc > 0); I'd prefer not to have asserts, any unexpected errors should be reported via fwts_error() > + > + rc = fwts_exec(command, &status); > + free(command); > + > + if (rc != FWTS_OK || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { > + fwts_failed(fw, LOG_LEVEL_HIGH, "DeviceTreeDtcParseFail", > + "dtc reports device tree errors"); > + return FWTS_ERROR; > + } Is it possible to log the device tree errors in the fwts log, that would be useful rather than just a failure message. > + > + fwts_passed(fw, "dtc test passed"); > + return FWTS_OK; > +} > + > +static int dtc_init(fwts_framework *fw) > +{ > + int rc, status; > + > + rc = fwts_exec("echo '/dts-v1/; / { };' | dtc -o /dev/null", &status); if dtc is a required tool, then it needs to be added into the Debian dependencies > + > + if (rc != FWTS_OK || !WIFEXITED(status) || WEXITSTATUS(status) != 0) { > + fwts_aborted(fw, "Failed to run dtc"); > + return FWTS_ABORTED; > + } > + > + return FWTS_OK; > +} > + > +static fwts_framework_minor_test dtc_tests[] = { > + { dtc_check_valid, "Check device tree validity with dtc" }, > + { NULL, NULL }, > +}; > + > +static fwts_framework_ops dtc_ops = { > + .description = "Device tree compilation test", > + .minor_tests = dtc_tests, > + .init = dtc_init, > +}; > + > +FWTS_REGISTER_FEATURES("dtc", &dtc_ops, FWTS_TEST_ANYTIME, > + FWTS_FLAG_BATCH, FWTS_FW_FEATURE_DEVICETREE); > From colin.king at canonical.com Tue May 26 08:49:04 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 09:49:04 +0100 Subject: [PATCH 2/3] fwts: Add file_open_and_read_binary In-Reply-To: <1432192507.647307.559425639333.2.gpush@pablo> References: <1432192507.647307.559425639333.2.gpush@pablo> Message-ID: <55643380.4070001@canonical.com> On 21/05/15 08:15, Jeremy Kerr wrote: > Add a function to open and read a binary file in a single chunk. > > Signed-off-by: Jeremy Kerr > > --- > src/lib/include/fwts_fileio.h | 1 > src/lib/src/fwts_fileio.c | 45 ++++++++++++++++++++++++++++++++++ > 2 files changed, 46 insertions(+) > > diff --git a/src/lib/include/fwts_fileio.h b/src/lib/include/fwts_fileio.h > index 33b727b..e9fdced 100644 > --- a/src/lib/include/fwts_fileio.h > +++ b/src/lib/include/fwts_fileio.h > @@ -24,5 +24,6 @@ > > fwts_list* fwts_file_read(FILE *fp); > fwts_list* fwts_file_open_and_read(const char *file); > +int fwts_file_open_and_read_binary(const char *file, char **buf, size_t *len); > > #endif > diff --git a/src/lib/src/fwts_fileio.c b/src/lib/src/fwts_fileio.c > index ca99631..5875a32 100644 > --- a/src/lib/src/fwts_fileio.c > +++ b/src/lib/src/fwts_fileio.c > @@ -17,6 +17,7 @@ > * > */ > > +#include > #include > #include > #include > @@ -61,3 +62,47 @@ fwts_list* fwts_file_open_and_read(const char *file) > > return list; > } > + > +int fwts_file_open_and_read_binary(const char *file, char **buf, size_t *len) > +{ > + size_t tmplen; > + char *tmpbuf; > + long pos; > + FILE *fp; > + int rc; > + > + if ((fp = fopen(file, "rb")) == NULL) > + return FWTS_ERROR; > + > + rc = fseek(fp, 0, SEEK_END); > + if (rc) { > + rc = FWTS_ERROR; > + goto out; > + } > + > + pos = ftell(fp); > + if (pos < 0) { > + rc = FWTS_ERROR; > + goto out; > + } > + > + rewind(fp); > + > + tmpbuf = malloc(pos); > + assert(tmpbuf); .. as before, I'd prefer not to have asserts > + > + tmplen = fread(tmpbuf, 1, pos, fp); > + if (tmplen != (size_t)pos) { > + free(tmpbuf); > + rc = FWTS_ERROR; > + goto out; > + } > + > + rc = FWTS_OK; > + *buf = tmpbuf; > + *len = tmplen; > + > +out: > + fclose(fp); > + return rc; > +} > From colin.king at canonical.com Tue May 26 08:50:58 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 09:50:58 +0100 Subject: [PATCH 3/3] devicetree/dt_sysinfo: Add device tree system information tests In-Reply-To: <1432192507.647628.90360957379.3.gpush@pablo> References: <1432192507.647628.90360957379.3.gpush@pablo> Message-ID: <556433F2.5070200@canonical.com> On 21/05/15 08:15, Jeremy Kerr wrote: > Check that we have some basic system identifier properties. > > Signed-off-by: Jeremy Kerr > > --- > src/Makefile.am | 1 > src/devicetree/dt_sysinfo/dt_sysinfo.c | 137 +++++++++++++++++++++++++ > 2 files changed, 138 insertions(+) > > diff --git a/src/Makefile.am b/src/Makefile.am > index 4a2622b..c0a8104 100644 > --- a/src/Makefile.am > +++ b/src/Makefile.am > @@ -79,6 +79,7 @@ fwts_SOURCES = main.c \ > cpu/msr/msr.c \ > cpu/microcode/microcode.c \ > devicetree/dtc/dtc.c \ > + devicetree/dt_sysinfo/dt_sysinfo.c \ > dmi/dmicheck/dmicheck.c \ > hotkey/hotkey/hotkey.c \ > hpet/hpet_check/hpet_check.c \ > diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c > new file mode 100644 > index 0000000..aa5514c > --- /dev/null > +++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c > @@ -0,0 +1,137 @@ > +/* > + * Copyright (C) 2014 Jeremy Kerr > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version 2 > + * of the License, or (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > + * 02110-1301, USA. > + * > + */ > + > +#define _GNU_SOURCE > +#include > +#include > +#include > + > +#include "fwts.h" > + > +static const char *devicetree_path = "/proc/device-tree"; > + > +static int read_property(const char *name, char **buf, size_t *len) > +{ > + char *path; > + int rc; > + > + rc = asprintf(&path, "%s/%s", devicetree_path, name); > + assert(rc > 0); ..and same here about asserts. > + > + rc = fwts_file_open_and_read_binary(path, buf, len); > + free(path); > + > + return rc; > +} > + > +static int check_property_printable(fwts_framework *fw, const char *name, > + char *buf, size_t len) > +{ > + bool printable = true; > + unsigned int i; > + int rc; > + > + /* we need at least one character plus a nul */ > + if (len < 2) { > + fwts_failed(fw, LOG_LEVEL_LOW, "DTPrintablePropertyShort", > + "property %s is too short", name); > + rc = FWTS_ERROR; > + goto out; > + } > + > + /* check all characters are printable */ > + for (i = 0; i < len - 1; i++) { > + printable = printable && isprint(buf[i]); > + if (!printable) > + break; > + } > + > + if (!printable) { > + fwts_failed(fw, LOG_LEVEL_LOW, "DTPrintablePropertyInvalid", > + "property %s contains unprintable characters", > + name); > + rc = FWTS_ERROR; > + goto out; > + } > + > + /* check for a trailing nul */ > + if (buf[len-1] != '\0') { > + fwts_failed(fw, LOG_LEVEL_LOW, "DTPrintablePropertyNoNul", > + "property %s isn't nul-terminated", name); > + rc = FWTS_ERROR; > + } > + > + rc = FWTS_OK; > + > +out: > + return rc; > +} > + > +static int dt_sysinfo_check_property(fwts_framework *fw, const char *name) > +{ > + size_t len; > + char *buf; > + int rc; > + > + rc = read_property(name, &buf, &len); > + if (rc != FWTS_OK) { > + fwts_failed(fw, LOG_LEVEL_LOW, "DTSyinfoPropertyMissing", > + "property %s is missing", name); > + return rc; > + } > + > + rc = check_property_printable(fw, name, buf, len); > + free(buf); > + > + if (rc == FWTS_OK) > + fwts_passed(fw, "Sysinfo property %s is valid", name); > + > + return rc; > +} > + > +static int dt_sysinfo_check_vendor(fwts_framework *fw) > +{ > + return dt_sysinfo_check_property(fw, "vendor"); > +} > + > +static int dt_sysinfo_check_model(fwts_framework *fw) > +{ > + return dt_sysinfo_check_property(fw, "model"); > +} > + > +static int dt_sysinfo_check_name(fwts_framework *fw) > +{ > + return dt_sysinfo_check_property(fw, "name"); > +} > + > +static fwts_framework_minor_test dt_sysinfo_tests[] = { > + { dt_sysinfo_check_name, "Check name property" }, > + { dt_sysinfo_check_vendor, "Check vendor property" }, > + { dt_sysinfo_check_model, "Check model property" }, > + { NULL, NULL }, > +}; > + > +static fwts_framework_ops dt_sysinfo_ops = { > + .description = "Device tree system information test", > + .minor_tests = dt_sysinfo_tests, > +}; > + > +FWTS_REGISTER_FEATURES("dt_sysinfo", &dt_sysinfo_ops, FWTS_TEST_ANYTIME, > + FWTS_FLAG_BATCH, FWTS_FW_FEATURE_DEVICETREE); > From colin.king at canonical.com Tue May 26 08:56:50 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 09:56:50 +0100 Subject: [PATCH 00/11] CPU frequency test improvements In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> References: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <55643552.5080108@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > These changes rework the CPU frequency tests, mainly for compatiblity with > non-x86 machines. > > Patches 1-6 factor out the tests into smaller units, so that we can > selectively enable or disable functionality that's specific to ACPI-based > frequency control, and do a little rework to have a consistent 1 pass/fail > per test run. > > Patch 7 is a simple check for the consistency of frequency changes. > > Patches 8-10 implement Linux perf support for the test benchmarks, so > that we have meaningful results in the benchmark sets, across different > platforms. The perf feature is an improvement, however, fwts does run on a variety of kernels, so perf may not be enabled. Can we keep the older bogo ops code for systems that don't have perf enabled? > > Patch 11 makes the tests a little more usable on large machines. > > Questions / comments most welcome. > > Cheers, > > Jeremy > > --- > Jeremy Kerr (11): > cpu/cpufreq: Don't reparse cpu information > cpu/cpufreq: hz_almost_equal is unused if !FWTS_ARCH_INTEL > cpu/cpufreq: Add a separate cpufreq consistency test > cpu/cpufreq: Add test for duplicate entries in cpufreq tables > cpu/cpufreq: Do bios limit and claimed max checks as separate tests > cpu/cpufreq: Refactor CPU performance tests > cpu/cpufreq: Always check that cpufreq changes have taken > fwts: Use linux perf counters for cpu benchmarking > fwts: Use gettimeofday for cpu benchmark > fwts: scale cpu benchmark results to one second > cpu/cpufreq: Only run performance tests on master threads > > From colin.king at canonical.com Tue May 26 09:17:55 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:17:55 +0100 Subject: [PATCH 3/3] devicetree/dt_sysinfo: Add device tree system information tests In-Reply-To: <1432192507.647628.90360957379.3.gpush@pablo> References: <1432192507.647628.90360957379.3.gpush@pablo> Message-ID: <55643A43.1080508@canonical.com> On 21/05/15 08:15, Jeremy Kerr wrote: > Check that we have some basic system identifier properties. > > Signed-off-by: Jeremy Kerr > > --- > src/Makefile.am | 1 > src/devicetree/dt_sysinfo/dt_sysinfo.c | 137 +++++++++++++++++++++++++ > 2 files changed, 138 insertions(+) > > diff --git a/src/Makefile.am b/src/Makefile.am > index 4a2622b..c0a8104 100644 > --- a/src/Makefile.am > +++ b/src/Makefile.am > @@ -79,6 +79,7 @@ fwts_SOURCES = main.c \ > cpu/msr/msr.c \ > cpu/microcode/microcode.c \ > devicetree/dtc/dtc.c \ > + devicetree/dt_sysinfo/dt_sysinfo.c \ > dmi/dmicheck/dmicheck.c \ > hotkey/hotkey/hotkey.c \ > hpet/hpet_check/hpet_check.c \ > diff --git a/src/devicetree/dt_sysinfo/dt_sysinfo.c b/src/devicetree/dt_sysinfo/dt_sysinfo.c > new file mode 100644 > index 0000000..aa5514c > --- /dev/null > +++ b/src/devicetree/dt_sysinfo/dt_sysinfo.c > @@ -0,0 +1,137 @@ > +/* > + * Copyright (C) 2014 Jeremy Kerr > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version 2 > + * of the License, or (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > + * 02110-1301, USA. > + * > + */ > + > +#define _GNU_SOURCE > +#include > +#include > +#include > + > +#include "fwts.h" > + > +static const char *devicetree_path = "/proc/device-tree"; > + > +static int read_property(const char *name, char **buf, size_t *len) > +{ > + char *path; > + int rc; > + > + rc = asprintf(&path, "%s/%s", devicetree_path, name); > + assert(rc > 0); > + > + rc = fwts_file_open_and_read_binary(path, buf, len); > + free(path); > + > + return rc; > +} > + > +static int check_property_printable(fwts_framework *fw, const char *name, > + char *buf, size_t len) > +{ > + bool printable = true; > + unsigned int i; > + int rc; > + > + /* we need at least one character plus a nul */ > + if (len < 2) { > + fwts_failed(fw, LOG_LEVEL_LOW, "DTPrintablePropertyShort", > + "property %s is too short", name); > + rc = FWTS_ERROR; > + goto out; > + } > + > + /* check all characters are printable */ > + for (i = 0; i < len - 1; i++) { > + printable = printable && isprint(buf[i]); > + if (!printable) > + break; > + } > + > + if (!printable) { > + fwts_failed(fw, LOG_LEVEL_LOW, "DTPrintablePropertyInvalid", > + "property %s contains unprintable characters", > + name); > + rc = FWTS_ERROR; > + goto out; > + } > + > + /* check for a trailing nul */ > + if (buf[len-1] != '\0') { > + fwts_failed(fw, LOG_LEVEL_LOW, "DTPrintablePropertyNoNul", > + "property %s isn't nul-terminated", name); > + rc = FWTS_ERROR; CoverityScan spotted an issue above ^ Assigning value "FWTS_ERROR" to "rc" here, but that stored value is overwritten before it can be used > + } > + > + rc = FWTS_OK; > + > +out: > + return rc; > +} > + > +static int dt_sysinfo_check_property(fwts_framework *fw, const char *name) > +{ > + size_t len; > + char *buf; > + int rc; > + > + rc = read_property(name, &buf, &len); > + if (rc != FWTS_OK) { > + fwts_failed(fw, LOG_LEVEL_LOW, "DTSyinfoPropertyMissing", > + "property %s is missing", name); > + return rc; > + } > + > + rc = check_property_printable(fw, name, buf, len); > + free(buf); > + > + if (rc == FWTS_OK) > + fwts_passed(fw, "Sysinfo property %s is valid", name); > + > + return rc; > +} > + > +static int dt_sysinfo_check_vendor(fwts_framework *fw) > +{ > + return dt_sysinfo_check_property(fw, "vendor"); > +} > + > +static int dt_sysinfo_check_model(fwts_framework *fw) > +{ > + return dt_sysinfo_check_property(fw, "model"); > +} > + > +static int dt_sysinfo_check_name(fwts_framework *fw) > +{ > + return dt_sysinfo_check_property(fw, "name"); > +} > + > +static fwts_framework_minor_test dt_sysinfo_tests[] = { > + { dt_sysinfo_check_name, "Check name property" }, > + { dt_sysinfo_check_vendor, "Check vendor property" }, > + { dt_sysinfo_check_model, "Check model property" }, > + { NULL, NULL }, > +}; > + > +static fwts_framework_ops dt_sysinfo_ops = { > + .description = "Device tree system information test", > + .minor_tests = dt_sysinfo_tests, > +}; > + > +FWTS_REGISTER_FEATURES("dt_sysinfo", &dt_sysinfo_ops, FWTS_TEST_ANYTIME, > + FWTS_FLAG_BATCH, FWTS_FW_FEATURE_DEVICETREE); > From colin.king at canonical.com Tue May 26 09:19:28 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:19:28 +0100 Subject: ACK: [PATCH 01/11] cpu/cpufreq: Don't reparse cpu information In-Reply-To: <1432200867.810604.396494529489.1.gpush@pablo> References: <1432200867.810604.396494529489.1.gpush@pablo> Message-ID: <55643AA0.30802@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > Currently, we do a whole lot of scanning the /sys/devices/system/cpu > directory to parse cpu information, multiple times. > > This change does a parse once on ->init, and populates a structure of > cpu info. The tests then query this structure instead of reparsing /sys. > > We remove the unnecessary sched_setaffinity when we change a core's > cpu_frequency. > > Signed-off-by: Jeremy Kerr > > --- > src/cpu/cpufreq/cpufreq.c | 561 +++++++++++++++----------------------- > 1 file changed, 226 insertions(+), 335 deletions(-) > > diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c > index ff3d112..9315d18 100644 > --- a/src/cpu/cpufreq/cpufreq.c > +++ b/src/cpu/cpufreq/cpufreq.c > @@ -48,17 +48,32 @@ typedef struct { > uint64_t speed; > } fwts_cpu_freq; > > +struct cpu { > + int idx; > + char sysfs_path[PATH_MAX]; > + bool online; > + > + int n_freqs; > + fwts_cpu_freq freqs[MAX_FREQS]; > + > + /* saved state */ > + char *orig_governor; > + uint64_t orig_frequency; > +}; > + > +static struct cpu *cpus; > +static int num_cpus; > static int number_of_speeds = -1; > static int total_tests = 1; > static int performed_tests = 0; > static bool no_cpufreq = false; > static uint64_t top_speed = 0; > -static int num_cpus; > > #define GET_PERFORMANCE_MAX (0) > #define GET_PERFORMANCE_MIN (1) > #define GET_PERFORMANCE_AVG (2) > > + > #define MAX_ABSOLUTE_ERROR 20.0 /* In Hz */ > #define MAX_RELATIVE_ERROR 0.0025 /* as fraction */ > > @@ -90,65 +105,56 @@ static int hz_almost_equal(const uint64_t a, const uint64_t b) > static inline void cpu_mkpath( > char *const path, > const int len, > - const int cpu, > + const struct cpu *cpu, > const char *const name) > { > - snprintf(path, len, "%s/cpu%i/cpufreq/%s", FWTS_CPU_PATH, cpu, name); > + snprintf(path, len, "%s/%s/cpufreq/%s", FWTS_CPU_PATH, > + cpu->sysfs_path, name); > } > > -static void set_governor(fwts_framework *fw, const int cpu) > +static void cpu_set_governor(fwts_framework *fw, struct cpu *cpu, > + const char *governor) > { > char path[PATH_MAX]; > + int rc; > > cpu_mkpath(path, sizeof(path), cpu, "scaling_governor"); > - > - if (fwts_set("userspace", path) != FWTS_OK) { > - if (!no_cpufreq) { > - fwts_warning(fw, > - "Cannot set CPU scaling governor to userspace scaling."); > - no_cpufreq = true; > - } > + rc = fwts_set(governor, path); > + if (rc != FWTS_OK && !no_cpufreq) { > + fwts_warning(fw, "Cannot set CPU governor to %s.", governor); > + no_cpufreq = true; > } > } > > -#ifdef FWTS_ARCH_INTEL > -static int cpu_exists(const int cpu) > +static void cpu_set_frequency(fwts_framework *fw, struct cpu *cpu, > + uint64_t freq_hz) > { > char path[PATH_MAX]; > + char buffer[64]; > + int rc; > > - cpu_mkpath(path, sizeof(path), cpu, "scaling_governor"); > - return !access(path, R_OK); > + cpu_mkpath(path, sizeof(path), cpu, "scaling_setspeed"); > + snprintf(buffer, sizeof(buffer), "%" PRIu64 , freq_hz); > + rc = fwts_set(buffer, path); > + if (rc != FWTS_OK) > + fwts_warning(fw, "Cannot set CPU frequency to %s.", buffer); > } > -#endif > > -static void set_HZ(fwts_framework *fw, const int cpu, const uint64_t Hz) > +static void cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu) > { > - cpu_set_t mask, oldset; > - char path[PATH_MAX]; > - char buffer[64]; > - > - /* First, go to the right cpu */ > - > - sched_getaffinity(0, sizeof(oldset), &oldset); > - > - CPU_ZERO(&mask); > - CPU_SET(cpu, &mask); > - sched_setaffinity(0, sizeof(mask), &mask); > - > - set_governor(fw, cpu); > - > - /* then set the speed */ > - cpu_mkpath(path, sizeof(path), cpu, "scaling_setspeed"); > - snprintf(buffer, sizeof(buffer), "%" PRIu64 , Hz); > - fwts_set(buffer, path); > + cpu_set_frequency(fw, cpu, cpu->freqs[0].Hz); > +} > > - sched_setaffinity(0, sizeof(oldset), &oldset); > +static void cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu) > +{ > + cpu_set_frequency(fw, cpu, cpu->freqs[cpu->n_freqs-1].Hz); > } > > + > #ifdef FWTS_ARCH_INTEL > static int get_performance_repeat( > fwts_framework *fw, > - const int cpu, > + struct cpu *cpu, > const int count, > const int type, > uint64_t *retval) > @@ -163,7 +169,7 @@ static int get_performance_repeat( > for (i = 0; i < count; i++) { > uint64_t temp; > > - if (fwts_cpu_performance(fw, cpu, &temp) != FWTS_OK) > + if (fwts_cpu_performance(fw, cpu->idx, &temp) != FWTS_OK) > return FWTS_ERROR; > > if (temp) { > @@ -217,7 +223,7 @@ static char *hz_to_human(const uint64_t hz) > } > } > > -static uint64_t get_claimed_hz(const int cpu) > +static uint64_t get_claimed_hz(struct cpu *cpu) > { > char path[PATH_MAX]; > char *buffer; > @@ -232,7 +238,7 @@ static uint64_t get_claimed_hz(const int cpu) > return value; > } > > -static uint64_t get_bios_limit(const int cpu) > +static uint64_t get_bios_limit(struct cpu *cpu) > { > char path[PATH_MAX]; > char *buffer; > @@ -247,71 +253,20 @@ static uint64_t get_bios_limit(const int cpu) > return value; > } > > -static int cpu_freq_compare(const void *v1, const void *v2) > +static void do_cpu(fwts_framework *fw, struct cpu *cpu) > { > - const fwts_cpu_freq *cpu_freq1 = (fwts_cpu_freq *)v1; > - const fwts_cpu_freq *cpu_freq2 = (fwts_cpu_freq *)v2; > - > - /* > - * Some _PSS states can be the same or very nearly > - * the same when Turbo mode is available, > - * so if they are we also differentiate the two by > - * the speed to get a fully sorted ordering > - */ > - if (hz_almost_equal(cpu_freq1->Hz, cpu_freq2->Hz)) > - return cpu_freq1->speed - cpu_freq2->speed; > - else > - return cpu_freq1->Hz - cpu_freq2->Hz; > -} > - > -static int read_freqs_available(const int cpu, fwts_cpu_freq *freqs) > -{ > - char path[PATH_MAX]; > - char line[4096]; > - FILE *file; > - char *c, *c2; > - int i = 0; > - > - memset(line, 0, sizeof(line)); > - cpu_mkpath(path, sizeof(path), cpu, "scaling_available_frequencies"); > - if ((file = fopen(path, "r")) == NULL) > - return 0; > - c = fgets(line, 4095, file); > - fclose(file); > - if (!c) > - return 0; > - > - while ((i < MAX_FREQS) && c && strlen(c) > 1) { > - c2 = strchr(c, ' '); > - if (c2) { > - *c2 = 0; > - c2++; > - } else > - c2 = NULL; > - > - freqs[i].Hz = strtoull(c, NULL, 10); > - c = c2; > - i++; > - } > - return i; > -} > - > -static void do_cpu(fwts_framework *fw, const int cpu) > -{ > - fwts_cpu_freq freqs[MAX_FREQS]; > - int i, speedcount; > + int i; > static int warned = 0; > bool warned_PSS = false; > - uint64_t cpu_top_speed = 1; > + uint64_t cpu_top_perf = 0; > int claimed_hz_too_low = 0; > int bios_limit_too_low = 0; > const uint64_t claimed_hz = get_claimed_hz(cpu); > const uint64_t bios_limit = get_bios_limit(cpu); > > - memset(freqs, 0, sizeof(freqs)); > - set_governor(fw, cpu); > + cpu_set_governor(fw, cpu, "userspace"); > > - if ((speedcount = read_freqs_available(cpu, freqs)) == 0) { > + if (cpu->n_freqs == 0) { > if (!no_cpufreq) { > char path[PATH_MAX]; > char *driver; > @@ -330,30 +285,32 @@ static void do_cpu(fwts_framework *fw, const int cpu) > return; > } > if (total_tests == 1) > - total_tests = ((2 + speedcount) * num_cpus) + 4; > + total_tests = ((2 + cpu->n_freqs) * num_cpus) + 2; > > - for (i = 0; i < speedcount; i++) { > - set_HZ(fw, cpu, freqs[i].Hz); > + for (i = 0; i < cpu->n_freqs; i++) { > + cpu_set_frequency(fw, cpu, cpu->freqs[i].Hz); > > - if ((claimed_hz != 0) && (claimed_hz < freqs[i].Hz)) > + if ((claimed_hz != 0) && (claimed_hz < cpu->freqs[i].Hz)) > claimed_hz_too_low++; > - if ((bios_limit != 0) && (bios_limit < freqs[i].Hz)) > + if ((bios_limit != 0) && (bios_limit < cpu->freqs[i].Hz)) > bios_limit_too_low++; > > - if (fwts_cpu_performance(fw, cpu, &freqs[i].speed) != FWTS_OK) { > + if (fwts_cpu_performance(fw, cpu->idx, &cpu->freqs[i].speed) > + != FWTS_OK) { > fwts_log_error(fw, "Failed to get CPU performance for " > - "CPU frequency %" PRIu64 " Hz.", freqs[i].Hz); > - freqs[i].speed = 0; > + "CPU frequency %" PRId64 " Hz.", > + cpu->freqs[i].Hz); > + cpu->freqs[i].speed = 0; > } > - if (freqs[i].speed > cpu_top_speed) > - cpu_top_speed = freqs[i].speed; > + if (cpu->freqs[i].speed > cpu_top_perf) > + cpu_top_perf = cpu->freqs[i].speed; > > performed_tests++; > fwts_progress(fw, 100 * performed_tests/total_tests); > } > > - if (cpu_top_speed > top_speed) > - top_speed = cpu_top_speed; > + if (cpu_top_perf > top_speed) > + top_speed = cpu_top_perf; > > if (claimed_hz_too_low) { > char path[PATH_MAX]; > @@ -363,7 +320,8 @@ static void do_cpu(fwts_framework *fw, const int cpu) > "There were %d CPU frequencies larger than the _PSS " > "maximum CPU frequency of %s for CPU %d. Has %s " > "been set too low?", > - claimed_hz_too_low, hz_to_human(claimed_hz), cpu, path); > + claimed_hz_too_low, hz_to_human(claimed_hz), > + cpu->idx, path); > } > > if (bios_limit_too_low) { > @@ -373,137 +331,72 @@ static void do_cpu(fwts_framework *fw, const int cpu) > fwts_warning(fw, > "The CPU frequency BIOS limit %s for CPU %d was set to %s " > "which is lower than some of the ACPI scaling frequencies.", > - path, cpu, hz_to_human(bios_limit)); > + path, cpu->idx, hz_to_human(bios_limit)); > } > > if (claimed_hz_too_low || bios_limit_too_low) > fwts_log_nl(fw); > > - fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", cpu, speedcount); > + fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", > + cpu->idx, cpu->n_freqs); > fwts_log_info_verbatum(fw, " Frequency | Relative Speed | Bogo loops"); > fwts_log_info_verbatum(fw, "-----------+----------------+-----------"); > - for (i = 0; i < speedcount; i++) { > + for (i = 0; i < cpu->n_freqs; i++) { > char *turbo = ""; > #ifdef FWTS_ARCH_INTEL > - if ((i == 0) && (speedcount > 1) && > - (hz_almost_equal(freqs[i].Hz, freqs[i + 1].Hz))) > + if ((i == 0) && (cpu->n_freqs > 1) && > + (hz_almost_equal(cpu->freqs[i].Hz, cpu->freqs[i + 1].Hz))) > turbo = " (Turbo Boost)"; > #endif > - > - fwts_log_info_verbatum(fw, "%10s | %5.1f %% | %9" PRIu64 "%s", > - hz_to_human(freqs[i].Hz), > - 100.0 * freqs[i].speed/cpu_top_speed, > - freqs[i].speed, > - turbo); > + fwts_log_info_verbatum(fw, "%10s | %5.1f %% | %9" PRIu64 > + "%s", > + hz_to_human(cpu->freqs[i].Hz), > + 100.0 * cpu->freqs[i].speed / cpu_top_perf, > + cpu->freqs[i].speed, turbo); > } > > if (number_of_speeds == -1) > - number_of_speeds = speedcount; > + number_of_speeds = cpu->n_freqs; > > fwts_log_nl(fw); > > - if (number_of_speeds != speedcount) > + if (number_of_speeds != cpu->n_freqs) > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqPStates", > "Not all processors support the same number of P states."); > > - if (speedcount < 2) > + if (cpu->n_freqs < 2) > return; > > - /* Sort the frequencies */ > - qsort(freqs, speedcount, sizeof(fwts_cpu_freq), cpu_freq_compare); > - > /* now check for 1) increasing HZ and 2) increasing speed */ > - for (i = 0; i < speedcount-1; i++) { > - if (freqs[i].Hz == freqs[i+1].Hz && !warned++) > + for (i = 0; i < cpu->n_freqs - 1; i++) { > + if (cpu->freqs[i].Hz == cpu->freqs[i+1].Hz && !warned++) > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqDupFreq", > "Duplicate frequency reported."); > - if (freqs[i].speed > freqs[i+1].speed) > + if (cpu->freqs[i].speed > cpu->freqs[i+1].speed) > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqSlowerOnCPU", > "Supposedly higher frequency %s is slower (%" PRIu64 > " bogo loops) than frequency %s (%" PRIu64 > " bogo loops) on CPU %i.", > - hz_to_human(freqs[i+1].Hz), freqs[i+1].speed, > - hz_to_human(freqs[i].Hz), freqs[i].speed, > - cpu); > + hz_to_human(cpu->freqs[i+1].Hz), > + cpu->freqs[i+1].speed, > + hz_to_human(cpu->freqs[i].Hz), > + cpu->freqs[i].speed, > + cpu->idx); > > - if ((freqs[i].Hz > claimed_hz) && !warned_PSS) { > + if ((cpu->freqs[i].Hz > claimed_hz) && !warned_PSS) { > warned_PSS = true; > fwts_warning(fw, "Frequency %" PRIu64 > - " not achievable; _PSS limit of %" PRIu64 " in effect?", > - freqs[i].Hz, claimed_hz); > + " not achievable; _PSS limit of %" PRIu64 > + " in effect?", > + cpu->freqs[i].Hz, claimed_hz); > } > } > } > > > -static void lowest_speed(fwts_framework *fw, const int cpu) > -{ > - char path[PATH_MAX]; > - char *line; > - char *c, *c2; > - uint64_t lowspeed = 0; > - > - cpu_mkpath(path, sizeof(path), cpu, "scaling_available_frequencies"); > - if ((line = fwts_get(path)) == NULL) > - return; > - > - c = line; > - while (c && strlen(c) > 1) { > - uint64_t Hz; > - > - c2 = strchr(c, ' '); > - if (c2) { > - *c2 = 0; > - c2++; > - } else > - c2 = NULL; > - > - Hz = strtoull(c, NULL, 10); > - if (Hz < lowspeed || lowspeed == 0) > - lowspeed = Hz; > - c = c2; > - } > - free(line); > - > - set_HZ(fw, cpu, lowspeed); > -} > - > -static void highest_speed(fwts_framework *fw, const int cpu) > -{ > - char path[PATH_MAX]; > - char *line; > - char *c, *c2; > - unsigned long highspeed=0; > - > - cpu_mkpath(path, sizeof(path), cpu, "scaling_available_frequencies"); > - if ((line = fwts_get(path)) == NULL) > - return; > - > - c = line; > - while (c && strlen(c) > 1) { > - uint64_t Hz; > - > - c2 = strchr(c, ' '); > - if (c2) { > - *c2=0; > - c2++; > - } else > - c2 = NULL; > - > - Hz = strtoull(c, NULL, 10); > - if (Hz > highspeed || highspeed == 0) > - highspeed = Hz; > - c = c2; > - } > - free(line); > - > - set_HZ(fw, cpu, highspeed); > -} > - > - > #ifdef FWTS_ARCH_INTEL > /* > * 4) Is BIOS wrongly doing Sw_All P-state coordination across cpus > @@ -513,45 +406,22 @@ static void highest_speed(fwts_framework *fw, const int cpu) > */ > static void do_sw_all_test(fwts_framework *fw) > { > - DIR *dir; > - struct dirent *entry; > uint64_t highperf, lowperf; > - int first_cpu_index = -1; > - int cpu; > - int ret; > - > - if ((dir = opendir(FWTS_CPU_PATH)) == NULL) { > - fwts_log_error(fw, "FATAL: cpufreq: sysfs not mounted."); > - return; > - } > - > - while ((entry = readdir(dir)) != NULL) { > - if (entry && strlen(entry->d_name) > 3) { > - cpu = strtoul(entry->d_name + 3, NULL, 10); > - if (first_cpu_index == -1) > - first_cpu_index = cpu; > - > - lowest_speed(fw, cpu); > - } > - } > - closedir(dir); > + int i; > > /* All CPUs at the lowest frequency */ > - ret = get_performance_repeat(fw, first_cpu_index, 5, GET_PERFORMANCE_MIN, &lowperf); > - performed_tests++; > - fwts_progress(fw, 100 * performed_tests/total_tests); > - if (ret != FWTS_OK) { > + for (i = 0; i < num_cpus; i++) > + cpu_set_lowest_frequency(fw, &cpus[i]); > + > + if (get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MIN, &lowperf) != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALLGetPerf", > "Failed to get CPU performance."); > return; > } > lowperf = (lowperf * 100) / top_speed; > > - highest_speed(fw, first_cpu_index); > - ret = get_performance_repeat(fw, first_cpu_index, 5, GET_PERFORMANCE_MAX, &highperf); > - performed_tests++; > - fwts_progress(fw, 100 * performed_tests/total_tests); > - if (ret != FWTS_OK) { > + cpu_set_highest_frequency(fw, &cpus[0]); > + if (get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MAX, &highperf) != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALLGetPerf", > "Failed to get CPU performance."); > return; > @@ -576,57 +446,32 @@ static void do_sw_all_test(fwts_framework *fw) > */ > static void do_sw_any_test(fwts_framework *fw) > { > - DIR *dir; > - struct dirent *entry; > uint64_t highperf, lowperf; > - int first_cpu_index = -1; > - int cpu; > - int ret; > + int i, rc; > > - if ((dir = opendir(FWTS_CPU_PATH)) == NULL) { > - fwts_log_error(fw, "FATAL: cpufreq: sysfs not mounted."); > - return; > - } > - > - while ((entry = readdir(dir)) != NULL) { > - if (entry && strlen(entry->d_name) > 3) { > - cpu = strtoul(entry->d_name + 3, NULL, 10); > - if (first_cpu_index == -1) > - first_cpu_index = cpu; > - > - lowest_speed(fw, cpu); > - } > - } > - rewinddir(dir); > + for (i = 0; i < num_cpus; i++) > + cpu_set_lowest_frequency(fw, &cpus[i]); > > /* All CPUs at the lowest frequency */ > - ret = get_performance_repeat(fw, first_cpu_index, 5, GET_PERFORMANCE_MIN, &lowperf); > - performed_tests++; > - fwts_progress(fw, 100 * performed_tests/total_tests); > - if (ret != FWTS_OK) { > + rc = get_performance_repeat(fw, &cpus[0], 5, > + GET_PERFORMANCE_MIN, &lowperf); > + > + if (rc != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ANYGetPerf", > "Failed to get CPU performance."); > - closedir(dir); > return; > } > + > lowperf = (100 * lowperf) / top_speed; > > - highest_speed(fw, first_cpu_index); > + cpu_set_highest_frequency(fw, &cpus[0]); > > - while ((entry = readdir(dir)) != NULL) { > - if (entry && strlen(entry->d_name) > 3) { > - cpu = strtoul(entry->d_name + 3, NULL, 10); > - if (cpu == first_cpu_index) > - continue; > - lowest_speed(fw, cpu); > - } > - } > - closedir(dir); > + for (i = 0; i < num_cpus; i++) > + cpu_set_lowest_frequency(fw, &cpus[i]); > > - ret = get_performance_repeat(fw, first_cpu_index, 5, GET_PERFORMANCE_MAX, &highperf); > - performed_tests++; > - fwts_progress(fw, 100 * performed_tests/total_tests); > - if (ret != FWTS_OK) { > + rc = get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MAX, > + &highperf); > + if (rc != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ANYGetPerf", > "Failed to get CPU performance."); > return; > @@ -643,46 +488,34 @@ static void do_sw_any_test(fwts_framework *fw) > > static void check_sw_any(fwts_framework *fw) > { > - DIR *dir; > - struct dirent *entry; > uint64_t low_perf, high_perf, newhigh_perf; > static int once = 0; > - int max_cpu = 0, i, j; > - int cpu; > + int i, j; > > - /* First set all processors to their lowest speed */ > - if ((dir = opendir(FWTS_CPU_PATH)) == NULL) { > - fwts_log_error(fw, "FATAL: cpufreq: sysfs not mounted."); > + /* Single processor machine, no point in checking anything */ > + if (num_cpus < 2) > return; > - } > > - while ((entry = readdir(dir)) != NULL) { > - if (entry && strlen(entry->d_name) > 3) { > - cpu = strtoul(entry->d_name + 3, NULL, 10); > - lowest_speed(fw, cpu); > - if (cpu > max_cpu) > - max_cpu = cpu; > - } > - } > - closedir(dir); > - > - if (max_cpu == 0) > - return; /* Single processor machine, no point in checking anything */ > + /* First set all processors to their lowest speed */ > + for (i = 0; i < num_cpus; i++) > + cpu_set_lowest_frequency(fw, &cpus[i]); > > /* assume that all processors have the same low performance */ > - if (fwts_cpu_performance(fw, max_cpu, &low_perf) != FWTS_OK) { > + if (fwts_cpu_performance(fw, cpus[0].idx, &low_perf) != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqCPsSetToSW_ANYGetPerf", > "Cannot get CPU performance."); > return; > } > > - for (i = 0; i <= max_cpu; i++) { > - highest_speed(fw, i); > - if (!cpu_exists(i)) > + for (i = 0; i <= num_cpus; i++) { > + struct cpu *cpu = &cpus[i]; > + > + cpu_set_highest_frequency(fw, cpu); > + if (!cpu->online) > continue; > > - if (fwts_cpu_performance(fw, i, &high_perf) != FWTS_OK) { > + if (fwts_cpu_performance(fw, cpu->idx, &high_perf) != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqCPsSetToSW_ANYGetPerf", > "Cannot get CPU performance."); > @@ -695,10 +528,11 @@ static void check_sw_any(fwts_framework *fw) > * the core in question to now also get the low speed, while > * hardware max will keep the performance > */ > - for (j = 0; j <= max_cpu; j++) > + for (j = 0; j < num_cpus; j++) > if (i != j) > - lowest_speed(fw, j); > - if (fwts_cpu_performance(fw, i, &newhigh_perf) != FWTS_OK) { > + cpu_set_lowest_frequency(fw, &cpus[j]); > + if (fwts_cpu_performance(fw, cpu->idx, &newhigh_perf) > + != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqCPsSetToSW_ANYGetPerf", > "Cannot get CPU performance."); > @@ -711,7 +545,7 @@ static void check_sw_any(fwts_framework *fw) > "CPUFreqCPUsSetToSW_ANY", > "Processors are set to SW_ANY."); > once++; > - lowest_speed(fw, i); > + cpu_set_lowest_frequency(fw, cpu); > } > performed_tests++; > fwts_progress(fw, 100 * performed_tests/total_tests); > @@ -723,9 +557,7 @@ static void check_sw_any(fwts_framework *fw) > > static int cpufreq_test1(fwts_framework *fw) > { > - DIR *dir; > - struct dirent *entry; > - int cpu; > + int i; > > #ifdef FWTS_ARCH_INTEL > fwts_log_info(fw, > @@ -750,42 +582,21 @@ static int cpufreq_test1(fwts_framework *fw) > #endif > fwts_log_nl(fw); > > - /* First set all processors to their lowest speed */ > - if ((dir = opendir(FWTS_CPU_PATH)) == NULL) { > - fwts_log_error(fw, "FATAL: cpufreq: sysfs not mounted\n"); > - return FWTS_ERROR; > - } > - > - while ((entry = readdir(dir)) != NULL) { > - if (entry && strlen(entry->d_name) > 3 && isdigit(entry->d_name[3])) { > - cpu = strtoul(entry->d_name + 3, NULL, 10); > - lowest_speed(fw, cpu); > - } > - } > - rewinddir(dir); > + for (i = 0; i < num_cpus; i++) > + cpu_set_lowest_frequency(fw, &cpus[i]); > > /* then do the benchmark */ > - > - while ((entry = readdir(dir)) != NULL) { > - if (entry && strlen(entry->d_name) > 3 && isdigit(entry->d_name[3])) { > - cpu = strtoul(entry->d_name + 3, NULL, 10); > - do_cpu(fw, cpu); > - lowest_speed(fw, cpu); > - if (no_cpufreq) > - break; > - } > + for (i = 0; i < num_cpus; i++) { > + do_cpu(fw, &cpus[i]); > + cpu_set_lowest_frequency(fw, &cpus[i]); > + if (no_cpufreq) > + break; > } > - rewinddir(dir); > > /* set everything back to the highest speed again */ > + for (i = 0; i < num_cpus; i++) > + cpu_set_highest_frequency(fw, &cpus[i]); > > - while ((entry = readdir(dir)) != NULL) { > - if (entry && strlen(entry->d_name) > 3 && isdigit(entry->d_name[3])) { > - cpu = strtoul(entry->d_name + 3, NULL, 10); > - highest_speed(fw, cpu); > - } > - } > - closedir(dir); > > #ifdef FWTS_ARCH_INTEL > if (!no_cpufreq) > @@ -808,12 +619,91 @@ static int cpufreq_test1(fwts_framework *fw) > return FWTS_OK; > } > > -static int cpufreq_init(fwts_framework *fw) > +static int cpu_freq_compare(const void *v1, const void *v2) > +{ > + const fwts_cpu_freq *f1 = v1; > + const fwts_cpu_freq *f2 = v2; > + return f1->Hz - f2->Hz; > +} > + > +static int parse_cpu_info(struct cpu *cpu, struct dirent *dir) > +{ > + char *end, path[PATH_MAX+1], *str, *tmp, *tok; > + int i; > + > + strcpy(cpu->sysfs_path, dir->d_name); > + cpu->idx = strtoul(cpu->sysfs_path + strlen("cpu"), &end, 10); > + cpu->online = true; > + > + cpu_mkpath(path, sizeof(path), cpu, "scaling_governor"); > + cpu->orig_governor = fwts_get(path); > + > + if (cpu->orig_governor && !strcmp(cpu->orig_governor, "userspace")) { > + cpu_mkpath(path, sizeof(path), cpu, "scaling_setspeed"); > + tmp = fwts_get(path); > + cpu->orig_frequency = strtoull(tmp, NULL, 10); > + free(tmp); > + } > + > + /* parse available frequencies */ > + cpu_mkpath(path, sizeof(path), cpu, "scaling_available_frequencies"); > + str = fwts_get(path); > + > + for (tmp = str, i = 0; ; tmp = NULL) { > + tok = strtok(tmp, " "); > + if (!tok) > + break; > + if (!isdigit(tok[0])) > + continue; > + cpu->freqs[i++].Hz = strtoull(tok, NULL, 10); > + } > + > + free(str); > + > + cpu->n_freqs = i; > + qsort(cpu->freqs, cpu->n_freqs, sizeof(cpu->freqs[0]), > + cpu_freq_compare); > + > + return FWTS_OK; > +} > + > +static int is_cpu_dir(const struct dirent *dir) > { > - if ((num_cpus = fwts_cpu_enumerate()) == FWTS_ERROR) { > - fwts_warning(fw, "Cannot determine number of CPUS, defaulting to 1."); > - num_cpus = 1; > + return strncmp(dir->d_name, "cpu", 3) == 0 && > + isdigit(dir->d_name[3]); > +} > + > +static int cpufreq_init(fwts_framework *fw __attribute__((unused))) > +{ > + struct dirent **dirs; > + int i; > + > + num_cpus = scandir(FWTS_CPU_PATH, &dirs, is_cpu_dir, versionsort); > + cpus = calloc(num_cpus, sizeof(*cpus)); > + > + for (i = 0; i < num_cpus; i++) > + parse_cpu_info(&cpus[i], dirs[i]); > + > + return FWTS_OK; > +} > + > +static int cpufreq_deinit(fwts_framework *fw) > +{ > + int i; > + > + for (i = 0; i < num_cpus; i++) { > + struct cpu *cpu = &cpus[i]; > + > + if (cpu->orig_governor) { > + cpu_set_governor(fw, cpu, cpu->orig_governor); > + free(cpu->orig_governor); > + } > + > + if (cpu->orig_frequency) > + cpu_set_frequency(fw, cpu, cpu->orig_frequency); > } > + free(cpus); > + > return FWTS_OK; > } > > @@ -828,6 +718,7 @@ static fwts_framework_minor_test cpufreq_tests[] = { > > static fwts_framework_ops cpufreq_ops = { > .init = cpufreq_init, > + .deinit = cpufreq_deinit, > .description = "CPU frequency scaling tests.", > .minor_tests = cpufreq_tests > }; > Acked-by: Colin Ian King From colin.king at canonical.com Tue May 26 09:20:24 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:20:24 +0100 Subject: ACK: [PATCH 02/11] cpu/cpufreq: hz_almost_equal is unused if !FWTS_ARCH_INTEL In-Reply-To: <1432200867.810919.781168126277.2.gpush@pablo> References: <1432200867.810919.781168126277.2.gpush@pablo> Message-ID: <55643AD8.1050808@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > ... so move it to an #ifdef-ed block. > > Signed-off-by: Jeremy Kerr > > --- > src/cpu/cpufreq/cpufreq.c | 51 +++++++++++++++++++------------------- > 1 file changed, 26 insertions(+), 25 deletions(-) > > diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c > index 9315d18..93260b3 100644 > --- a/src/cpu/cpufreq/cpufreq.c > +++ b/src/cpu/cpufreq/cpufreq.c > @@ -77,31 +77,6 @@ static uint64_t top_speed = 0; > #define MAX_ABSOLUTE_ERROR 20.0 /* In Hz */ > #define MAX_RELATIVE_ERROR 0.0025 /* as fraction */ > > -/* > - * hz_almost_equal() > - * used to compare CPU _PSS levels, are they almost > - * equal? E.g. within MAX_ABSOLUTE_ERROR Hz difference > - * between each other, or a relative difference of > - * MAX_RELATIVE_ERROR. If they are, then they are deemed > - * almost equal. > - */ > -static int hz_almost_equal(const uint64_t a, const uint64_t b) > -{ > - double da = (double)a, db = (double)b; > - double relative_error, abs_diff = fabs(da - db); > - > - if (a == b) > - return true; > - if (abs_diff < MAX_ABSOLUTE_ERROR) > - return true; > - if (db > da) > - relative_error = abs_diff / db; > - else > - relative_error = abs_diff / da; > - > - return relative_error <= MAX_RELATIVE_ERROR; > -} > - > static inline void cpu_mkpath( > char *const path, > const int len, > @@ -203,6 +178,32 @@ static int get_performance_repeat( > } > return FWTS_OK; > } > + > +/* > + * hz_almost_equal() > + * used to compare CPU _PSS levels, are they almost > + * equal? E.g. within MAX_ABSOLUTE_ERROR Hz difference > + * between each other, or a relative difference of > + * MAX_RELATIVE_ERROR. If they are, then they are deemed > + * almost equal. > + */ > +static int hz_almost_equal(const uint64_t a, const uint64_t b) > +{ > + double da = (double)a, db = (double)b; > + double relative_error, abs_diff = fabs(da - db); > + > + if (a == b) > + return true; > + if (abs_diff < MAX_ABSOLUTE_ERROR) > + return true; > + if (db > da) > + relative_error = abs_diff / db; > + else > + relative_error = abs_diff / da; > + > + return relative_error <= MAX_RELATIVE_ERROR; > +} > + > #endif > > static char *hz_to_human(const uint64_t hz) > Acked-by: Colin Ian King From colin.king at canonical.com Tue May 26 09:22:25 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:22:25 +0100 Subject: ACK: [PATCH 03/11] cpu/cpufreq: Add a separate cpufreq consistency test In-Reply-To: <1432200867.811223.440643202583.3.gpush@pablo> References: <1432200867.811223.440643202583.3.gpush@pablo> Message-ID: <55643B51.3060006@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > Add a separate test to check that cpufreq tables are consistent across > processors, instead of the current check included in the do_cpu path. > > Signed-off-by: Jeremy Kerr > > --- > src/cpu/cpufreq/cpufreq.c | 68 +++++++++++++++++++++++++++++++++----- > 1 file changed, 60 insertions(+), 8 deletions(-) > > diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c > index 93260b3..517c750 100644 > --- a/src/cpu/cpufreq/cpufreq.c > +++ b/src/cpu/cpufreq/cpufreq.c > @@ -356,16 +356,8 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) > cpu->freqs[i].speed, turbo); > } > > - if (number_of_speeds == -1) > - number_of_speeds = cpu->n_freqs; > - > fwts_log_nl(fw); > > - if (number_of_speeds != cpu->n_freqs) > - fwts_failed(fw, LOG_LEVEL_MEDIUM, > - "CPUFreqPStates", > - "Not all processors support the same number of P states."); > - > if (cpu->n_freqs < 2) > return; > > @@ -620,6 +612,65 @@ static int cpufreq_test1(fwts_framework *fw) > return FWTS_OK; > } > > +static int cpufreq_compare_freqs(fwts_framework *fw, struct cpu *c1, > + struct cpu *c2) > +{ > + int i; > + > + if (c1->n_freqs != c2->n_freqs) { > + fwts_log_warning(fw, "cpu %d has %d freqs, cpu %d has %d freqs", > + c1->idx, c1->n_freqs, > + c2->idx, c2->n_freqs); > + return FWTS_ERROR; > + } > + > + for (i = 0; i < c1->n_freqs; i++) { > + if (c1->freqs[i].Hz != c2->freqs[i].Hz) { > + fwts_log_warning(fw, "freq entry %d: " > + "cpu %d is %" PRId64 ", " > + "cpu %d is %" PRId64, i, > + c1->idx, c1->freqs[i].Hz, > + c2->idx, c2->freqs[i].Hz); > + return FWTS_ERROR; > + } > + } > + > + return FWTS_OK; > +} > + > +static int cpufreq_test_consistency(fwts_framework *fw) > +{ > + struct cpu *cpu, *cpu0; > + bool consistent = true; > + int i; > + > + if (num_cpus < 2) { > + fwts_skipped(fw, "Test skipped, only one processor present"); > + return FWTS_SKIP; > + } > + > + cpu0 = &cpus[0]; > + > + for (i = 1; i < num_cpus; i++) { > + cpu = &cpus[i]; > + if (cpufreq_compare_freqs(fw, cpu0, cpu) != FWTS_OK) { > + consistent = false; > + fwts_log_error(fw, > + "cpu %d has an inconsistent frequency table", > + cpu->idx); > + } > + } > + > + if (!consistent) > + fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqInconsistent", > + "inconsistencies found in CPU " > + "frequency tables"); > + else > + fwts_passed(fw, "CPU frequency tables are consistent"); > + > + return FWTS_OK; > +} > + > static int cpu_freq_compare(const void *v1, const void *v2) > { > const fwts_cpu_freq *f1 = v1; > @@ -709,6 +760,7 @@ static int cpufreq_deinit(fwts_framework *fw) > } > > static fwts_framework_minor_test cpufreq_tests[] = { > + { cpufreq_test_consistency, "CPU frequency table consistency" }, > #ifdef FWTS_ARCH_INTEL > { cpufreq_test1, "CPU P-State tests." }, > #else > This is a good idea. Like it. Acked-by: Colin Ian King From colin.king at canonical.com Tue May 26 09:23:44 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:23:44 +0100 Subject: ACK: [PATCH 04/11] cpu/cpufreq: Add test for duplicate entries in cpufreq tables In-Reply-To: <1432200867.811513.383103853996.4.gpush@pablo> References: <1432200867.811513.383103853996.4.gpush@pablo> Message-ID: <55643BA0.4070109@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > Signed-off-by: Jeremy Kerr > > --- > src/cpu/cpufreq/cpufreq.c | 36 ++++++++++++++++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c > index 517c750..4adb58c 100644 > --- a/src/cpu/cpufreq/cpufreq.c > +++ b/src/cpu/cpufreq/cpufreq.c > @@ -671,6 +671,41 @@ static int cpufreq_test_consistency(fwts_framework *fw) > return FWTS_OK; > } > > +static int cpufreq_test_duplicates(fwts_framework *fw) > +{ > + struct cpu *cpu0 = &cpus[0]; > + bool dup = false; > + uint64_t freq; > + int i; > + > + /* the frequency list is sorted, so we can do this in one pass */ > + for (i = 0; i < cpu0->n_freqs - 1; i++) { > + > + freq = cpu0->freqs[i].Hz; > + > + if (cpu0->freqs[i+1].Hz != freq) > + continue; > + > + dup = true; > + fwts_log_error(fw, "duplicate cpu frequency %" PRIx64, > + freq); > + > + /* don't report further duplicates for this entry */ > + for (i++; i < cpu0->n_freqs - 1; i++) > + if (cpu0->freqs[i].Hz != freq) > + break; > + } > + > + if (dup) { > + fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqDuplicate", > + "duplicates found in CPU frequency table"); > + } else { > + fwts_passed(fw, "No duplicates in CPU frequency table"); > + } > + > + return FWTS_OK; > +} > + > static int cpu_freq_compare(const void *v1, const void *v2) > { > const fwts_cpu_freq *f1 = v1; > @@ -761,6 +796,7 @@ static int cpufreq_deinit(fwts_framework *fw) > > static fwts_framework_minor_test cpufreq_tests[] = { > { cpufreq_test_consistency, "CPU frequency table consistency" }, > + { cpufreq_test_duplicates, "CPU frequency table duplicates" }, > #ifdef FWTS_ARCH_INTEL > { cpufreq_test1, "CPU P-State tests." }, > #else > Again, nice idea, this is good to add this sanity check like this. Acked-by: Colin Ian King From colin.king at canonical.com Tue May 26 09:24:52 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:24:52 +0100 Subject: ACK: [PATCH 05/11] cpu/cpufreq: Do bios limit and claimed max checks as separate tests In-Reply-To: <1432200867.811825.922596791728.5.gpush@pablo> References: <1432200867.811825.922596791728.5.gpush@pablo> Message-ID: <55643BE4.7060507@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > Rather than combining the bios limit and claimed max tests into the > do_cpu tests, separate them out into individual tests. > > Signed-off-by: Jeremy Kerr > > --- > src/cpu/cpufreq/cpufreq.c | 123 ++++++++++++++++++++++++-------------- > 1 file changed, 80 insertions(+), 43 deletions(-) > > diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c > index 4adb58c..0b4d8a7 100644 > --- a/src/cpu/cpufreq/cpufreq.c > +++ b/src/cpu/cpufreq/cpufreq.c > @@ -258,12 +258,7 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) > { > int i; > static int warned = 0; > - bool warned_PSS = false; > uint64_t cpu_top_perf = 0; > - int claimed_hz_too_low = 0; > - int bios_limit_too_low = 0; > - const uint64_t claimed_hz = get_claimed_hz(cpu); > - const uint64_t bios_limit = get_bios_limit(cpu); > > cpu_set_governor(fw, cpu, "userspace"); > > @@ -291,11 +286,6 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) > for (i = 0; i < cpu->n_freqs; i++) { > cpu_set_frequency(fw, cpu, cpu->freqs[i].Hz); > > - if ((claimed_hz != 0) && (claimed_hz < cpu->freqs[i].Hz)) > - claimed_hz_too_low++; > - if ((bios_limit != 0) && (bios_limit < cpu->freqs[i].Hz)) > - bios_limit_too_low++; > - > if (fwts_cpu_performance(fw, cpu->idx, &cpu->freqs[i].speed) > != FWTS_OK) { > fwts_log_error(fw, "Failed to get CPU performance for " > @@ -313,31 +303,6 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) > if (cpu_top_perf > top_speed) > top_speed = cpu_top_perf; > > - if (claimed_hz_too_low) { > - char path[PATH_MAX]; > - > - cpu_mkpath(path, sizeof(path), cpu, "scaling_max_freq"); > - fwts_warning(fw, > - "There were %d CPU frequencies larger than the _PSS " > - "maximum CPU frequency of %s for CPU %d. Has %s " > - "been set too low?", > - claimed_hz_too_low, hz_to_human(claimed_hz), > - cpu->idx, path); > - } > - > - if (bios_limit_too_low) { > - char path[PATH_MAX]; > - > - cpu_mkpath(path, sizeof(path), cpu, "bios_limit"); > - fwts_warning(fw, > - "The CPU frequency BIOS limit %s for CPU %d was set to %s " > - "which is lower than some of the ACPI scaling frequencies.", > - path, cpu->idx, hz_to_human(bios_limit)); > - } > - > - if (claimed_hz_too_low || bios_limit_too_low) > - fwts_log_nl(fw); > - > fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", > cpu->idx, cpu->n_freqs); > fwts_log_info_verbatum(fw, " Frequency | Relative Speed | Bogo loops"); > @@ -378,14 +343,6 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) > hz_to_human(cpu->freqs[i].Hz), > cpu->freqs[i].speed, > cpu->idx); > - > - if ((cpu->freqs[i].Hz > claimed_hz) && !warned_PSS) { > - warned_PSS = true; > - fwts_warning(fw, "Frequency %" PRIu64 > - " not achievable; _PSS limit of %" PRIu64 > - " in effect?", > - cpu->freqs[i].Hz, claimed_hz); > - } > } > } > > @@ -706,6 +663,84 @@ static int cpufreq_test_duplicates(fwts_framework *fw) > return FWTS_OK; > } > > +static int cpufreq_test_bios_limits(fwts_framework *fw) > +{ > + bool ok, present; > + int i; > + > + present = false; > + ok = true; > + > + for (i = 0; i < num_cpus; i++) { > + struct cpu *cpu = &cpus[i]; > + uint64_t bios_limit; > + > + bios_limit = get_bios_limit(cpu); > + > + if (!bios_limit) > + continue; > + > + present = true; > + > + if (bios_limit < cpu->freqs[cpu->n_freqs-1].Hz) { > + ok = false; > + fwts_warning(fw, "cpu %d has bios limit of %" PRId64 > + ", lower than max freq of %" > + PRId64, cpu->idx, bios_limit, > + cpu->freqs[cpu->n_freqs-1].Hz); > + } > + } > + > + if (!present) > + fwts_passed(fw, "No BIOS limits imposed"); > + else if (ok) > + fwts_passed(fw, "CPU BIOS limit OK"); > + else > + fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqBIOSLimit", > + "CPU BIOS limit is set too low"); > + > + return FWTS_OK; > +} > + > +static int cpufreq_test_claimed_max(fwts_framework *fw) > +{ > + bool ok, present; > + int i; > + > + present = false; > + ok = true; > + > + for (i = 0; i < num_cpus; i++) { > + struct cpu *cpu = &cpus[i]; > + uint64_t max; > + > + max = get_claimed_hz(cpu); > + > + if (!max) > + continue; > + > + present = true; > + > + if (max > cpu->freqs[cpu->n_freqs-1].Hz) { > + ok = false; > + fwts_warning(fw, "cpu %d has claimed frequency of %" > + PRId64 ", higher than max freq of %" > + PRId64, cpu->idx, max, > + cpu->freqs[cpu->n_freqs-1].Hz); > + } > + } > + > + if (!present) > + fwts_passed(fw, "No max frequencies present"); > + else if (ok) > + fwts_passed(fw, "CPU max frequencies OK"); > + else > + fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqClaimedMax", > + "CPU max frequency is unreachable"); > + > + return FWTS_OK; > +} > + > static int cpu_freq_compare(const void *v1, const void *v2) > { > const fwts_cpu_freq *f1 = v1; > @@ -797,6 +832,8 @@ static int cpufreq_deinit(fwts_framework *fw) > static fwts_framework_minor_test cpufreq_tests[] = { > { cpufreq_test_consistency, "CPU frequency table consistency" }, > { cpufreq_test_duplicates, "CPU frequency table duplicates" }, > + { cpufreq_test_bios_limits, "CPU frequency firmware limits" }, > + { cpufreq_test_claimed_max, "CPU frequency claimed maximum" }, > #ifdef FWTS_ARCH_INTEL > { cpufreq_test1, "CPU P-State tests." }, > #else > Again, good idea. Acked-by: Colin Ian King From colin.king at canonical.com Tue May 26 09:30:12 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:30:12 +0100 Subject: ACK: [PATCH 06/11] cpu/cpufreq: Refactor CPU performance tests In-Reply-To: <1432200867.812207.327248641665.6.gpush@pablo> References: <1432200867.812207.327248641665.6.gpush@pablo> Message-ID: <55643D24.6050708@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > This change is a refactor of the CPU performance tests, in a few ways: > > Rather than combining the SW_ANY and SW_ALL tests along with the actual > performance comparison, we move them to their own minor tests. We make > the tests run-time conditional on sw_tests_possible, rather than using > compile-time switching in multiple places. > > We only do one fwts_passed/fwts_failed per test. Doing this multiple > times per test gives us inconsistent counts in the results log. > > We remove the global performance measurements, as we only need to > compare results within a CPU. > > Signed-off-by: Jeremy Kerr > > --- > src/cpu/cpufreq/cpufreq.c | 332 +++++++++++++++----------------------- > 1 file changed, 136 insertions(+), 196 deletions(-) > > diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c > index 0b4d8a7..cd55eb5 100644 > --- a/src/cpu/cpufreq/cpufreq.c > +++ b/src/cpu/cpufreq/cpufreq.c > @@ -63,11 +63,7 @@ struct cpu { > > static struct cpu *cpus; > static int num_cpus; > -static int number_of_speeds = -1; > -static int total_tests = 1; > -static int performed_tests = 0; > static bool no_cpufreq = false; > -static uint64_t top_speed = 0; > > #define GET_PERFORMANCE_MAX (0) > #define GET_PERFORMANCE_MIN (1) > @@ -126,7 +122,6 @@ static void cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu) > } > > > -#ifdef FWTS_ARCH_INTEL > static int get_performance_repeat( > fwts_framework *fw, > struct cpu *cpu, > @@ -179,6 +174,7 @@ static int get_performance_repeat( > return FWTS_OK; > } > > +#ifdef FWTS_ARCH_INTEL > /* > * hz_almost_equal() > * used to compare CPU _PSS levels, are they almost > @@ -203,7 +199,6 @@ static int hz_almost_equal(const uint64_t a, const uint64_t b) > > return relative_error <= MAX_RELATIVE_ERROR; > } > - > #endif > > static char *hz_to_human(const uint64_t hz) > @@ -254,34 +249,11 @@ static uint64_t get_bios_limit(struct cpu *cpu) > return value; > } > > -static void do_cpu(fwts_framework *fw, struct cpu *cpu) > +static int test_one_cpu_performance(fwts_framework *fw, struct cpu *cpu, > + int cpu_idx, int n_online_cpus) > { > - int i; > - static int warned = 0; > uint64_t cpu_top_perf = 0; > - > - cpu_set_governor(fw, cpu, "userspace"); > - > - if (cpu->n_freqs == 0) { > - if (!no_cpufreq) { > - char path[PATH_MAX]; > - char *driver; > - > - no_cpufreq = true; > - fwts_warning(fw, "CPU frequency scaling not supported."); > - > - cpu_mkpath(path, sizeof(path), cpu, "scaling_driver"); > - driver = fwts_get(path); > - if (driver) { > - fwts_advice(fw, "Scaling driver '%s' is enabled and this " > - "does not seem to allow CPU frequency scaling.", driver); > - free(driver); > - } > - } > - return; > - } > - if (total_tests == 1) > - total_tests = ((2 + cpu->n_freqs) * num_cpus) + 2; > + int i; > > for (i = 0; i < cpu->n_freqs; i++) { > cpu_set_frequency(fw, cpu, cpu->freqs[i].Hz); > @@ -296,13 +268,10 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) > if (cpu->freqs[i].speed > cpu_top_perf) > cpu_top_perf = cpu->freqs[i].speed; > > - performed_tests++; > - fwts_progress(fw, 100 * performed_tests/total_tests); > + fwts_progress(fw, (100 * ((cpu_idx * cpu->n_freqs) + i)) / > + (n_online_cpus * cpu->n_freqs)); > } > > - if (cpu_top_perf > top_speed) > - top_speed = cpu_top_perf; > - > fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", > cpu->idx, cpu->n_freqs); > fwts_log_info_verbatum(fw, " Frequency | Relative Speed | Bogo loops"); > @@ -323,41 +292,102 @@ static void do_cpu(fwts_framework *fw, struct cpu *cpu) > > fwts_log_nl(fw); > > - if (cpu->n_freqs < 2) > - return; > - > - /* now check for 1) increasing HZ and 2) increasing speed */ > + /* now check for increasing performance */ > for (i = 0; i < cpu->n_freqs - 1; i++) { > - if (cpu->freqs[i].Hz == cpu->freqs[i+1].Hz && !warned++) > - fwts_failed(fw, LOG_LEVEL_MEDIUM, > - "CPUFreqDupFreq", > - "Duplicate frequency reported."); > - if (cpu->freqs[i].speed > cpu->freqs[i+1].speed) > - fwts_failed(fw, LOG_LEVEL_MEDIUM, > - "CPUFreqSlowerOnCPU", > - "Supposedly higher frequency %s is slower (%" PRIu64 > - " bogo loops) than frequency %s (%" PRIu64 > - " bogo loops) on CPU %i.", > - hz_to_human(cpu->freqs[i+1].Hz), > - cpu->freqs[i+1].speed, > - hz_to_human(cpu->freqs[i].Hz), > - cpu->freqs[i].speed, > - cpu->idx); > + if (cpu->freqs[i].speed <= cpu->freqs[i+1].speed) > + continue; > + > + fwts_log_warning(fw, > + "Supposedly higher frequency %s is slower (%" PRIu64 > + " bogo loops) than frequency %s (%" PRIu64 > + " bogo loops) on CPU %i.", > + hz_to_human(cpu->freqs[i+1].Hz), > + cpu->freqs[i+1].speed, > + hz_to_human(cpu->freqs[i].Hz), > + cpu->freqs[i].speed, > + cpu->idx); > + return FWTS_ERROR; > } > + > + fwts_log_info(fw, "CPU %d performance scaling OK", cpu->idx); > + return FWTS_OK; > } > > +static int cpufreq_test_cpu_performance(fwts_framework *fw) > +{ > + int n_online_cpus, i, c, rc; > + bool ok = true; > + > + n_online_cpus = 0; > + > + for (i = 0; i < num_cpus; i++) { > + cpu_set_lowest_frequency(fw, &cpus[i]); > + if (cpus[i].online) > + n_online_cpus++; > + } > + > + /* then do the benchmark */ > + for (i = 0, c = 0; i < num_cpus; i++) { > + if (!cpus[i].online) > + continue; > + > + rc = test_one_cpu_performance(fw, &cpus[i], c++, n_online_cpus); > + if (rc != FWTS_OK) > + ok = false; > + > + cpu_set_lowest_frequency(fw, &cpus[i]); > + } > + > + if (ok) > + fwts_passed(fw, "CPU performance scaling OK"); > + else > + fwts_failed(fw, LOG_LEVEL_MEDIUM, > + "CPUFreqSlowerOnCPU", > + "CPU frequencies do not refelect actual performance"); > + return FWTS_OK; > +} > + > +static int sw_tests_possible(fwts_framework *fw) > +{ > + int i, online_cpus = 0; > + > +#ifndef FWTS_ARCH_INTEL > + fwts_skipped(fw, "Platform doesn't perform SW_ cpu frequency control"); > + return FWTS_SKIP; > +#endif > + > + /* count the number of CPUs online now */ > + for (i = 0; i < num_cpus; i++) > + if (cpus[i].online) > + online_cpus++; > + > + if (online_cpus < 2) { > + fwts_skipped(fw, "Machine only has one CPU online"); > + return FWTS_SKIP; > + } > + > + if (cpus[0].n_freqs < 2) { > + fwts_skipped(fw, "No frequency changes possible"); > + return FWTS_SKIP; > + } > + > + return FWTS_OK; > +} > > -#ifdef FWTS_ARCH_INTEL > /* > * 4) Is BIOS wrongly doing Sw_All P-state coordination across cpus > * - Change frequency on all CPU to the lowest value > * - Change frequency on one particular CPU to the highest > * - If BIOS is doing Sw_All, the last high freq request will not work > */ > -static void do_sw_all_test(fwts_framework *fw) > +static int cpufreq_test_sw_all(fwts_framework *fw) > { > uint64_t highperf, lowperf; > - int i; > + int i, rc; > + > + rc = sw_tests_possible(fw); > + if (rc != FWTS_OK) > + return rc; > > /* All CPUs at the lowest frequency */ > for (i = 0; i < num_cpus; i++) > @@ -366,85 +396,47 @@ static void do_sw_all_test(fwts_framework *fw) > if (get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MIN, &lowperf) != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALLGetPerf", > "Failed to get CPU performance."); > - return; > + return FWTS_ERROR; > } > - lowperf = (lowperf * 100) / top_speed; > > cpu_set_highest_frequency(fw, &cpus[0]); > if (get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MAX, &highperf) != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALLGetPerf", > "Failed to get CPU performance."); > - return; > + return FWTS_ERROR; > } > - highperf = (highperf * 100) / top_speed; > > - if (lowperf >= highperf) > + if (lowperf >= highperf) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqSW_ALL", > "Firmware not implementing hardware " > "coordination cleanly. Firmware using SW_ALL " > "instead?"); > + return FWTS_ERROR; > + } > + > + fwts_passed(fw, "Firmware SW_ALL OK"); > + return FWTS_OK; > } > > > -/* > - * 5) Is BIOS wrongly doing Sw_Any P-state coordination across cpus > - * - Change frequency on all CPU to the lowest value > - * - Change frequency on one particular CPU to the highest > - * - Change frequency on all CPU to the lowest value > - * - If BIOS is doing Sw_Any, the high freq request will not work > - */ > -static void do_sw_any_test(fwts_framework *fw) > +static int cpufreq_test_sw_any(fwts_framework *fw) > { > - uint64_t highperf, lowperf; > - int i, rc; > - > - for (i = 0; i < num_cpus; i++) > - cpu_set_lowest_frequency(fw, &cpus[i]); > - > - /* All CPUs at the lowest frequency */ > - rc = get_performance_repeat(fw, &cpus[0], 5, > - GET_PERFORMANCE_MIN, &lowperf); > - > - if (rc != FWTS_OK) { > - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ANYGetPerf", > - "Failed to get CPU performance."); > - return; > - } > - > - lowperf = (100 * lowperf) / top_speed; > + uint64_t low_perf, high_perf, newhigh_perf; > + int i, j, rc, n_tests, performed_tests; > + bool ok; > > - cpu_set_highest_frequency(fw, &cpus[0]); > + rc = sw_tests_possible(fw); > + if (rc != FWTS_OK) > + return rc; > > + n_tests = performed_tests = 0; > for (i = 0; i < num_cpus; i++) > - cpu_set_lowest_frequency(fw, &cpus[i]); > + if (cpus[i].online) > + n_tests++; > > - rc = get_performance_repeat(fw, &cpus[0], 5, GET_PERFORMANCE_MAX, > - &highperf); > - if (rc != FWTS_OK) { > - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ANYGetPerf", > - "Failed to get CPU performance."); > - return; > - } > - highperf = (100 * highperf) / top_speed; > - > - if (lowperf >= highperf) > - fwts_failed(fw, LOG_LEVEL_MEDIUM, > - "CPUFreqSW_ANY", > - "Firmware not implementing hardware " > - "coordination cleanly. Firmware using SW_ANY " > - "instead?."); > -} > - > -static void check_sw_any(fwts_framework *fw) > -{ > - uint64_t low_perf, high_perf, newhigh_perf; > - static int once = 0; > - int i, j; > - > - /* Single processor machine, no point in checking anything */ > - if (num_cpus < 2) > - return; > + /* we do two performance measurements per cpu */ > + n_tests *= 2; > > /* First set all processors to their lowest speed */ > for (i = 0; i < num_cpus; i++) > @@ -455,12 +447,17 @@ static void check_sw_any(fwts_framework *fw) > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqCPsSetToSW_ANYGetPerf", > "Cannot get CPU performance."); > - return; > + return FWTS_ERROR; > } > > + ok = true; > + > for (i = 0; i <= num_cpus; i++) { > struct cpu *cpu = &cpus[i]; > > + if (!cpu->online) > + continue; > + > cpu_set_highest_frequency(fw, cpu); > if (!cpu->online) > continue; > @@ -469,10 +466,11 @@ static void check_sw_any(fwts_framework *fw) > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqCPsSetToSW_ANYGetPerf", > "Cannot get CPU performance."); > - return; > + return FWTS_ERROR; > } > + > performed_tests++; > - fwts_progress(fw, 100 * performed_tests/total_tests); > + fwts_progress(fw, 100 * performed_tests/n_tests); > /* > * now set all the others to low again; sw_any will cause > * the core in question to now also get the low speed, while > @@ -486,85 +484,25 @@ static void check_sw_any(fwts_framework *fw) > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqCPsSetToSW_ANYGetPerf", > "Cannot get CPU performance."); > - return; > + return FWTS_ERROR; > } > if ((high_perf > newhigh_perf) && > (high_perf - newhigh_perf > (high_perf - low_perf)/4) && > - (once == 0) && (high_perf - low_perf > 20)) { > - fwts_failed(fw, LOG_LEVEL_MEDIUM, > - "CPUFreqCPUsSetToSW_ANY", > - "Processors are set to SW_ANY."); > - once++; > + (high_perf - low_perf > 20)) { > cpu_set_lowest_frequency(fw, cpu); > + ok = false; > } > performed_tests++; > - fwts_progress(fw, 100 * performed_tests/total_tests); > - } > - if (!once) > - fwts_passed(fw, "P-state coordination under hardware control."); > -} > -#endif > - > -static int cpufreq_test1(fwts_framework *fw) > -{ > - int i; > - > -#ifdef FWTS_ARCH_INTEL > - fwts_log_info(fw, > - "For each processor in the system, this test steps through the " > - "various frequency states (P-states) that the BIOS advertises " > - "for the processor. For each processor/frequency combination, " > - "a quick performance value is measured. The test then validates that:"); > - fwts_log_info_verbatum(fw, " 1. Each processor has the same number of frequency states."); > - fwts_log_info_verbatum(fw, " 2. Higher advertised frequencies have a higher performance."); > - fwts_log_info_verbatum(fw, " 3. No duplicate frequency values are reported by the BIOS."); > - fwts_log_info_verbatum(fw, " 4. BIOS doing Sw_All P-state coordination across cores."); > - fwts_log_info_verbatum(fw, " 5. BIOS doing Sw_Any P-state coordination across cores."); > -#else > - fwts_log_info(fw, > - "For each processor in the system, this test steps through the " > - "various frequency states that the CPU supports. " > - "For each processor/frequency combination, " > - "a quick performance value is measured. The test then validates that:"); > - fwts_log_info_verbatum(fw, " 1. Each processor has the same number of frequency states."); > - fwts_log_info_verbatum(fw, " 2. Higher advertised frequencies have a higher performance."); > - fwts_log_info_verbatum(fw, " 3. No duplicate frequency values exist."); > -#endif > - fwts_log_nl(fw); > - > - for (i = 0; i < num_cpus; i++) > - cpu_set_lowest_frequency(fw, &cpus[i]); > - > - /* then do the benchmark */ > - for (i = 0; i < num_cpus; i++) { > - do_cpu(fw, &cpus[i]); > - cpu_set_lowest_frequency(fw, &cpus[i]); > - if (no_cpufreq) > - break; > + fwts_progress(fw, 100 * performed_tests/n_tests); > } > > - /* set everything back to the highest speed again */ > - for (i = 0; i < num_cpus; i++) > - cpu_set_highest_frequency(fw, &cpus[i]); > - > - > -#ifdef FWTS_ARCH_INTEL > - if (!no_cpufreq) > - check_sw_any(fw); > - > - /* > - * Check for more than one CPU and more than one frequency and > - * then do the benchmark set 2 > - */ > - if (num_cpus > 1 && number_of_speeds > 1) { > - do_sw_all_test(fw); > - do_sw_any_test(fw); > - } else if (number_of_speeds > 1) { > - performed_tests += 4; > - fwts_progress(fw, 100 * performed_tests/total_tests); > - } > -#endif > - fwts_progress(fw, 100); > + if (!ok) > + fwts_failed(fw, LOG_LEVEL_MEDIUM, > + "CPUFreqCPUsSetToSW_ANY", > + "Processors are set to SW_ANY."); > + else > + fwts_passed(fw, "P-state coordination " > + "under hardware control."); > > return FWTS_OK; > } > @@ -806,6 +744,10 @@ static int cpufreq_init(fwts_framework *fw __attribute__((unused))) > for (i = 0; i < num_cpus; i++) > parse_cpu_info(&cpus[i], dirs[i]); > > + /* all test require a userspace governor */ > + for (i = 0; i < num_cpus; i++) > + cpu_set_governor(fw, &cpus[i], "userspace"); > + > return FWTS_OK; > } > > @@ -834,11 +776,9 @@ static fwts_framework_minor_test cpufreq_tests[] = { > { cpufreq_test_duplicates, "CPU frequency table duplicates" }, > { cpufreq_test_bios_limits, "CPU frequency firmware limits" }, > { cpufreq_test_claimed_max, "CPU frequency claimed maximum" }, > -#ifdef FWTS_ARCH_INTEL > - { cpufreq_test1, "CPU P-State tests." }, > -#else > - { cpufreq_test1, "CPU Frequency tests." }, > -#endif > + { cpufreq_test_sw_any, "CPU frequency SW_ANY control" }, > + { cpufreq_test_sw_all, "CPU frequency SW_ALL control" }, > + { cpufreq_test_cpu_performance, "CPU frequency performance tests." }, > { NULL, NULL } > }; > > Acked-by: Colin Ian King From colin.king at canonical.com Tue May 26 09:35:56 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:35:56 +0100 Subject: [PATCH 00/11] CPU frequency test improvements In-Reply-To: <1432200867.809946.751063732393.0.gpush@pablo> References: <1432200867.809946.751063732393.0.gpush@pablo> Message-ID: <55643E7C.5080205@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > These changes rework the CPU frequency tests, mainly for compatiblity with > non-x86 machines. > > Patches 1-6 factor out the tests into smaller units, so that we can > selectively enable or disable functionality that's specific to ACPI-based > frequency control, and do a little rework to have a consistent 1 pass/fail > per test run. > > Patch 7 is a simple check for the consistency of frequency changes. > > Patches 8-10 implement Linux perf support for the test benchmarks, so > that we have meaningful results in the benchmark sets, across different > platforms. > > Patch 11 makes the tests a little more usable on large machines. > > Questions / comments most welcome. > > Cheers, Thanks Jeremy, cpufreq did require some attention, it has been rather crufty for a while, so these patches are most welcome. I ran the cpu freq changes through CoverityScan and it picked up two potential issues, see the attached log. I am a little concerned about using perf by default, can we add some extra checks to see if perf is available and if not, fall back to the older cruft bogo ops metrics, as some kernels may not have perf enabled. Colin > > > Jeremy > > --- > Jeremy Kerr (11): > cpu/cpufreq: Don't reparse cpu information > cpu/cpufreq: hz_almost_equal is unused if !FWTS_ARCH_INTEL > cpu/cpufreq: Add a separate cpufreq consistency test > cpu/cpufreq: Add test for duplicate entries in cpufreq tables > cpu/cpufreq: Do bios limit and claimed max checks as separate tests > cpu/cpufreq: Refactor CPU performance tests > cpu/cpufreq: Always check that cpufreq changes have taken > fwts: Use linux perf counters for cpu benchmarking > fwts: Use gettimeofday for cpu benchmark > fwts: scale cpu benchmark results to one second > cpu/cpufreq: Only run performance tests on master threads > > -------------- next part -------------- New defect(s) Reported-by: Coverity Scan Showing 2 of 2 defect(s) ** CID 1299399: (DIVIDE_BY_ZERO) /src/cpu/cpufreq/cpufreq.c: 529 in cpufreq_test_sw_any() /src/cpu/cpufreq/cpufreq.c: 553 in cpufreq_test_sw_any() ________________________________________________________________________________________________________ *** CID 1299399: (DIVIDE_BY_ZERO) /src/cpu/cpufreq/cpufreq.c: 529 in cpufreq_test_sw_any() 523 "Cannot get CPU performance."); 524 return FWTS_ERROR; 525 } 526 high_perf = fwts_cpu_benchmark_best_result(&result); 527 528 performed_tests++; >>> CID 1299399: (DIVIDE_BY_ZERO) >>> In expression "100 * performed_tests / n_tests", division by expression "n_tests" which may be zero has undefined behavior. 529 fwts_progress(fw, 100 * performed_tests/n_tests); 530 /* 531 * now set all the others to low again; sw_any will cause 532 * the core in question to now also get the low speed, while 533 * hardware max will keep the performance 534 */ /src/cpu/cpufreq/cpufreq.c: 553 in cpufreq_test_sw_any() 547 (high_perf - newhigh_perf > (high_perf - low_perf)/4) && 548 (high_perf - low_perf > 20)) { 549 cpu_set_lowest_frequency(fw, cpu); 550 ok = false; 551 } 552 performed_tests++; >>> CID 1299399: (DIVIDE_BY_ZERO) >>> In expression "100 * performed_tests / n_tests", division by expression "n_tests" which may be zero has undefined behavior. 553 fwts_progress(fw, 100 * performed_tests/n_tests); 554 } 555 556 if (!ok) 557 fwts_failed(fw, LOG_LEVEL_MEDIUM, 558 "CPUFreqCPUsSetToSW_ANY", From colin.king at canonical.com Tue May 26 09:37:44 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:37:44 +0100 Subject: ACK: [PATCH 07/11] cpu/cpufreq: Always check that cpufreq changes have taken In-Reply-To: <1432200867.812460.10563272713.7.gpush@pablo> References: <1432200867.812460.10563272713.7.gpush@pablo> Message-ID: <55643EE8.5070207@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > This change adds checks for cpu_set_governor and cpu_set_frequency, and > aborts (or fails) tests where this is needed. > > Signed-off-by: Jeremy Kerr > > --- > src/cpu/cpufreq/cpufreq.c | 80 ++++++++++++++++++++++++++++---------- > 1 file changed, 61 insertions(+), 19 deletions(-) > > diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c > index cd55eb5..979a9e1 100644 > --- a/src/cpu/cpufreq/cpufreq.c > +++ b/src/cpu/cpufreq/cpufreq.c > @@ -63,7 +63,7 @@ struct cpu { > > static struct cpu *cpus; > static int num_cpus; > -static bool no_cpufreq = false; > +static bool cpufreq_settable = true; > > #define GET_PERFORMANCE_MAX (0) > #define GET_PERFORMANCE_MIN (1) > @@ -83,24 +83,33 @@ static inline void cpu_mkpath( > cpu->sysfs_path, name); > } > > -static void cpu_set_governor(fwts_framework *fw, struct cpu *cpu, > +static int cpu_set_governor(fwts_framework *fw, struct cpu *cpu, > const char *governor) > { > - char path[PATH_MAX]; > + char path[PATH_MAX], *tmp; > int rc; > > cpu_mkpath(path, sizeof(path), cpu, "scaling_governor"); > rc = fwts_set(governor, path); > - if (rc != FWTS_OK && !no_cpufreq) { > - fwts_warning(fw, "Cannot set CPU governor to %s.", governor); > - no_cpufreq = true; > - } > + if (rc != FWTS_OK) > + goto out; > + > + tmp = fwts_get(path); > + rc = tmp && !strncmp(tmp, governor, strlen(governor)) > + ? FWTS_OK : FWTS_ERROR; > + free(tmp); > + > +out: > + if (rc != FWTS_OK) > + fwts_warning(fw, "Cannot set CPU %d governor to %s.", > + cpu->idx, governor); > + return rc; > } > > -static void cpu_set_frequency(fwts_framework *fw, struct cpu *cpu, > +static int cpu_set_frequency(fwts_framework *fw, struct cpu *cpu, > uint64_t freq_hz) > { > - char path[PATH_MAX]; > + char path[PATH_MAX], *tmp; > char buffer[64]; > int rc; > > @@ -108,17 +117,28 @@ static void cpu_set_frequency(fwts_framework *fw, struct cpu *cpu, > snprintf(buffer, sizeof(buffer), "%" PRIu64 , freq_hz); > rc = fwts_set(buffer, path); > if (rc != FWTS_OK) > - fwts_warning(fw, "Cannot set CPU frequency to %s.", buffer); > + goto out; > + > + tmp = fwts_get(path); > + rc = tmp && !strncmp(tmp, buffer, strlen(buffer)) > + ? FWTS_OK : FWTS_ERROR; > + free(tmp); > + > +out: > + if (rc != FWTS_OK) > + fwts_warning(fw, "Cannot set CPU %d frequency to %s.", > + cpu->idx, buffer); > + return rc; > } > > -static void cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu) > +static int cpu_set_lowest_frequency(fwts_framework *fw, struct cpu *cpu) > { > - cpu_set_frequency(fw, cpu, cpu->freqs[0].Hz); > + return cpu_set_frequency(fw, cpu, cpu->freqs[0].Hz); > } > > -static void cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu) > +static int cpu_set_highest_frequency(fwts_framework *fw, struct cpu *cpu) > { > - cpu_set_frequency(fw, cpu, cpu->freqs[cpu->n_freqs-1].Hz); > + return cpu_set_frequency(fw, cpu, cpu->freqs[cpu->n_freqs-1].Hz); > } > > > @@ -320,10 +340,20 @@ static int cpufreq_test_cpu_performance(fwts_framework *fw) > > n_online_cpus = 0; > > - for (i = 0; i < num_cpus; i++) { > - cpu_set_lowest_frequency(fw, &cpus[i]); > + > + for (i = 0; cpufreq_settable && i < num_cpus; i++) { > if (cpus[i].online) > n_online_cpus++; > + rc = cpu_set_lowest_frequency(fw, &cpus[i]); > + if (rc != FWTS_OK) > + cpufreq_settable = false; > + } > + > + if (!cpufreq_settable) { > + fwts_failed(fw, LOG_LEVEL_MEDIUM, > + "CPUFreqSetFailed", > + "Can't set CPU frequencies"); > + return FWTS_OK; > } > > /* then do the benchmark */ > @@ -356,6 +386,11 @@ static int sw_tests_possible(fwts_framework *fw) > return FWTS_SKIP; > #endif > > + if (!cpufreq_settable) { > + fwts_skipped(fw, "Can't set CPU frequencies"); > + return FWTS_SKIP; > + } > + > /* count the number of CPUs online now */ > for (i = 0; i < num_cpus; i++) > if (cpus[i].online) > @@ -736,7 +771,7 @@ static int is_cpu_dir(const struct dirent *dir) > static int cpufreq_init(fwts_framework *fw __attribute__((unused))) > { > struct dirent **dirs; > - int i; > + int i, rc; > > num_cpus = scandir(FWTS_CPU_PATH, &dirs, is_cpu_dir, versionsort); > cpus = calloc(num_cpus, sizeof(*cpus)); > @@ -745,8 +780,15 @@ static int cpufreq_init(fwts_framework *fw __attribute__((unused))) > parse_cpu_info(&cpus[i], dirs[i]); > > /* all test require a userspace governor */ > - for (i = 0; i < num_cpus; i++) > - cpu_set_governor(fw, &cpus[i], "userspace"); > + for (i = 0; i < num_cpus; i++) { > + rc = cpu_set_governor(fw, &cpus[i], "userspace"); > + if (rc != FWTS_OK) { > + fwts_log_warning(fw, "Failed to intialise cpufreq " > + "to set CPU speed"); > + cpufreq_settable = false; > + break; > + } > + } > > return FWTS_OK; > } > Acked-by: Colin Ian King From colin.king at canonical.com Tue May 26 09:39:05 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:39:05 +0100 Subject: [PATCH 00/11] CPU frequency test improvements In-Reply-To: <55643552.5080108@canonical.com> References: <1432200867.809946.751063732393.0.gpush@pablo> <55643552.5080108@canonical.com> Message-ID: <55643F39.6060903@canonical.com> On 26/05/15 09:56, Colin Ian King wrote: > On 21/05/15 10:34, Jeremy Kerr wrote: >> These changes rework the CPU frequency tests, mainly for compatiblity with >> non-x86 machines. >> >> Patches 1-6 factor out the tests into smaller units, so that we can >> selectively enable or disable functionality that's specific to ACPI-based >> frequency control, and do a little rework to have a consistent 1 pass/fail >> per test run. >> >> Patch 7 is a simple check for the consistency of frequency changes. >> >> Patches 8-10 implement Linux perf support for the test benchmarks, so >> that we have meaningful results in the benchmark sets, across different >> platforms. > > The perf feature is an improvement, however, fwts does run on a variety > of kernels, so perf may not be enabled. Can we keep the older bogo ops > code for systems that don't have perf enabled? My mistake, I just seen that it does this. Nice one :-) Colin > >> >> Patch 11 makes the tests a little more usable on large machines. >> >> Questions / comments most welcome. >> >> Cheers, >> >> Jeremy >> >> --- >> Jeremy Kerr (11): >> cpu/cpufreq: Don't reparse cpu information >> cpu/cpufreq: hz_almost_equal is unused if !FWTS_ARCH_INTEL >> cpu/cpufreq: Add a separate cpufreq consistency test >> cpu/cpufreq: Add test for duplicate entries in cpufreq tables >> cpu/cpufreq: Do bios limit and claimed max checks as separate tests >> cpu/cpufreq: Refactor CPU performance tests >> cpu/cpufreq: Always check that cpufreq changes have taken >> fwts: Use linux perf counters for cpu benchmarking >> fwts: Use gettimeofday for cpu benchmark >> fwts: scale cpu benchmark results to one second >> cpu/cpufreq: Only run performance tests on master threads >> >> > From colin.king at canonical.com Tue May 26 09:40:48 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:40:48 +0100 Subject: ACK: [PATCH 08/11] fwts: Use linux perf counters for cpu benchmarking In-Reply-To: <1432200867.812594.793229923225.8.gpush@pablo> References: <1432200867.812594.793229923225.8.gpush@pablo> Message-ID: <55643FA0.8030702@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > Currently, we use a loop counter to measure cpu performance. There are a > couple of drawbacks of this: > > 1) the numbers are fairly arbitrary, and don't reflect any external > values; and > > 2) the results are subject to peturbation from other tasks. > > This change uses the linux perf counters to measure actual CPU cycles, > where available. This means we get numbers that are meaningful, and will > we'll get the performance value even if our process has been scheduled > off the CPU. > > Now, the new results should match the actual cpu frequencies: > > CPU 0: 16 CPU frequency steps supported. > Frequency | Relative Speed | Cycles | Bogo loops > -----------+----------------+------------+----------- > 1.200 GHz | 36.5 % | 1197262295 | 114643 > 1.300 GHz | 39.5 % | 1297048295 | 124214 > 1.400 GHz | 42.6 % | 1396813066 | 133889 > 1.500 GHz | 45.6 % | 1496592732 | 143456 > 1.600 GHz | 48.6 % | 1596393751 | 150124 > 1.700 GHz | 51.7 % | 1696137977 | 162350 > 1.800 GHz | 54.7 % | 1795918438 | 172071 > 1.900 GHz | 57.8 % | 1895685372 | 181249 > 2.000 GHz | 60.8 % | 1995453204 | 191176 > 2.100 GHz | 63.8 % | 2095225345 | 200753 > 2.200 GHz | 66.9 % | 2194993645 | 210282 > 2.300 GHz | 69.9 % | 2294780535 | 219945 > 2.400 GHz | 73.0 % | 2394544770 | 229664 > 2.500 GHz | 76.0 % | 2494315101 | 239121 > 2.600 GHz | 79.0 % | 2594055116 | 248536 > 2.601 GHz | 100.0 % | 3281891417 | 314546 > > CPU 0 performance scaling OK > > Because we still want benchmarks to work when perf counters are not > available, we still measure the loop count. This means we need to > represent test results as a struct, with cycles and loops members. > > When tests need a scalar performance value, > fwts_cpu_benchmark_get_best_result will return the most accurate result > measured. > > Signed-off-by: Jeremy Kerr > > --- > src/acpi/cstates/cstates.c | 4 - > src/cpu/cpufreq/cpufreq.c | 63 +++++++++++++-------- > src/lib/include/fwts_cpu.h | 11 +++ > src/lib/src/fwts_cpu.c | 107 ++++++++++++++++++++++++++++++++++--- > 4 files changed, 153 insertions(+), 32 deletions(-) > > diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c > index b58f15c..42c634c 100644 > --- a/src/acpi/cstates/cstates.c > +++ b/src/acpi/cstates/cstates.c > @@ -133,9 +133,9 @@ static void do_cpu(fwts_framework *fw, int nth, int cpus, int cpu, char *path) > if ((i & 7) < 4) > sleep(1); > else { > - uint64_t loop_count; > + fwts_cpu_benchmark_result result; > > - if (fwts_cpu_performance(fw, cpu, &loop_count) != FWTS_OK) { > + if (fwts_cpu_benchmark(fw, cpu, &result) != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_HIGH, "CPUFailedPerformance", > "Could not determine the CPU performance, this " > "may be due to not being able to get or set the " > diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c > index 979a9e1..e409375 100644 > --- a/src/cpu/cpufreq/cpufreq.c > +++ b/src/cpu/cpufreq/cpufreq.c > @@ -45,7 +45,7 @@ > > typedef struct { > uint64_t Hz; > - uint64_t speed; > + fwts_cpu_benchmark_result perf; > } fwts_cpu_freq; > > struct cpu { > @@ -149,6 +149,7 @@ static int get_performance_repeat( > const int type, > uint64_t *retval) > { > + fwts_cpu_benchmark_result result; > int i; > > uint64_t max = 0; > @@ -159,9 +160,10 @@ static int get_performance_repeat( > for (i = 0; i < count; i++) { > uint64_t temp; > > - if (fwts_cpu_performance(fw, cpu->idx, &temp) != FWTS_OK) > + if (fwts_cpu_benchmark(fw, cpu->idx, &result) != FWTS_OK) > return FWTS_ERROR; > > + temp = fwts_cpu_benchmark_best_result(&result); > if (temp) { > if (temp < min) > min = temp; > @@ -276,17 +278,19 @@ static int test_one_cpu_performance(fwts_framework *fw, struct cpu *cpu, > int i; > > for (i = 0; i < cpu->n_freqs; i++) { > + uint64_t perf; > + > cpu_set_frequency(fw, cpu, cpu->freqs[i].Hz); > > - if (fwts_cpu_performance(fw, cpu->idx, &cpu->freqs[i].speed) > + if (fwts_cpu_benchmark(fw, cpu->idx, &cpu->freqs[i].perf) > != FWTS_OK) { > fwts_log_error(fw, "Failed to get CPU performance for " > "CPU frequency %" PRId64 " Hz.", > cpu->freqs[i].Hz); > - cpu->freqs[i].speed = 0; > } > - if (cpu->freqs[i].speed > cpu_top_perf) > - cpu_top_perf = cpu->freqs[i].speed; > + perf = fwts_cpu_benchmark_best_result(&cpu->freqs[i].perf); > + if (perf > cpu_top_perf) > + cpu_top_perf = perf; > > fwts_progress(fw, (100 * ((cpu_idx * cpu->n_freqs) + i)) / > (n_online_cpus * cpu->n_freqs)); > @@ -294,37 +298,46 @@ static int test_one_cpu_performance(fwts_framework *fw, struct cpu *cpu, > > fwts_log_info(fw, "CPU %d: %i CPU frequency steps supported.", > cpu->idx, cpu->n_freqs); > - fwts_log_info_verbatum(fw, " Frequency | Relative Speed | Bogo loops"); > - fwts_log_info_verbatum(fw, "-----------+----------------+-----------"); > + fwts_log_info_verbatum(fw, > + " Frequency | Relative Speed | Cycles | Bogo loops"); > + fwts_log_info_verbatum(fw, > + "-----------+----------------+------------+-----------"); > for (i = 0; i < cpu->n_freqs; i++) { > char *turbo = ""; > #ifdef FWTS_ARCH_INTEL > if ((i == 0) && (cpu->n_freqs > 1) && > - (hz_almost_equal(cpu->freqs[i].Hz, cpu->freqs[i + 1].Hz))) > + (hz_almost_equal(cpu->freqs[i].Hz, cpu->freqs[i + 1].Hz))) > turbo = " (Turbo Boost)"; > #endif > - fwts_log_info_verbatum(fw, "%10s | %5.1f %% | %9" PRIu64 > - "%s", > + uint64_t perf = fwts_cpu_benchmark_best_result( > + &cpu->freqs[i].perf); > + fwts_log_info_verbatum(fw, > + "%10s | %5.1f %% " > + "| %10" PRIu64 " | %9" PRIu64 "%s", > hz_to_human(cpu->freqs[i].Hz), > - 100.0 * cpu->freqs[i].speed / cpu_top_perf, > - cpu->freqs[i].speed, turbo); > + 100.0 * perf / cpu_top_perf, > + cpu->freqs[i].perf.cycles, > + cpu->freqs[i].perf.loops, > + turbo); > } > > fwts_log_nl(fw); > > /* now check for increasing performance */ > for (i = 0; i < cpu->n_freqs - 1; i++) { > - if (cpu->freqs[i].speed <= cpu->freqs[i+1].speed) > + uint64_t perf, last_perf; > + > + last_perf = fwts_cpu_benchmark_best_result(&cpu->freqs[i].perf); > + perf = fwts_cpu_benchmark_best_result(&cpu->freqs[i+1].perf); > + if (last_perf <= perf) > continue; > > fwts_log_warning(fw, > "Supposedly higher frequency %s is slower (%" PRIu64 > - " bogo loops) than frequency %s (%" PRIu64 > - " bogo loops) on CPU %i.", > - hz_to_human(cpu->freqs[i+1].Hz), > - cpu->freqs[i+1].speed, > - hz_to_human(cpu->freqs[i].Hz), > - cpu->freqs[i].speed, > + ") than frequency %s (%" PRIu64 > + ") on CPU %i.", > + hz_to_human(cpu->freqs[i+1].Hz), perf, > + hz_to_human(cpu->freqs[i].Hz), last_perf, > cpu->idx); > return FWTS_ERROR; > } > @@ -459,6 +472,7 @@ static int cpufreq_test_sw_any(fwts_framework *fw) > { > uint64_t low_perf, high_perf, newhigh_perf; > int i, j, rc, n_tests, performed_tests; > + fwts_cpu_benchmark_result result; > bool ok; > > rc = sw_tests_possible(fw); > @@ -478,12 +492,13 @@ static int cpufreq_test_sw_any(fwts_framework *fw) > cpu_set_lowest_frequency(fw, &cpus[i]); > > /* assume that all processors have the same low performance */ > - if (fwts_cpu_performance(fw, cpus[0].idx, &low_perf) != FWTS_OK) { > + if (fwts_cpu_benchmark(fw, cpus[0].idx, &result) != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqCPsSetToSW_ANYGetPerf", > "Cannot get CPU performance."); > return FWTS_ERROR; > } > + low_perf = fwts_cpu_benchmark_best_result(&result); > > ok = true; > > @@ -497,12 +512,13 @@ static int cpufreq_test_sw_any(fwts_framework *fw) > if (!cpu->online) > continue; > > - if (fwts_cpu_performance(fw, cpu->idx, &high_perf) != FWTS_OK) { > + if (fwts_cpu_benchmark(fw, cpu->idx, &result) != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqCPsSetToSW_ANYGetPerf", > "Cannot get CPU performance."); > return FWTS_ERROR; > } > + high_perf = fwts_cpu_benchmark_best_result(&result); > > performed_tests++; > fwts_progress(fw, 100 * performed_tests/n_tests); > @@ -514,13 +530,14 @@ static int cpufreq_test_sw_any(fwts_framework *fw) > for (j = 0; j < num_cpus; j++) > if (i != j) > cpu_set_lowest_frequency(fw, &cpus[j]); > - if (fwts_cpu_performance(fw, cpu->idx, &newhigh_perf) > + if (fwts_cpu_benchmark(fw, cpu->idx, &result) > != FWTS_OK) { > fwts_failed(fw, LOG_LEVEL_MEDIUM, > "CPUFreqCPsSetToSW_ANYGetPerf", > "Cannot get CPU performance."); > return FWTS_ERROR; > } > + newhigh_perf = fwts_cpu_benchmark_best_result(&result); > if ((high_perf > newhigh_perf) && > (high_perf - newhigh_perf > (high_perf - low_perf)/4) && > (high_perf - low_perf > 20)) { > diff --git a/src/lib/include/fwts_cpu.h b/src/lib/include/fwts_cpu.h > index b132697..7162316 100644 > --- a/src/lib/include/fwts_cpu.h > +++ b/src/lib/include/fwts_cpu.h > @@ -33,6 +33,12 @@ typedef struct cpuinfo_x86 { > char *flags; /* String containing flags */ > } fwts_cpuinfo_x86; > > +typedef struct cpu_benchmark_result { > + bool cycles_valid; > + uint64_t loops; > + uint64_t cycles; > +} fwts_cpu_benchmark_result; > + > int fwts_cpu_readmsr(const int cpu, const uint32_t reg, uint64_t *val); > > int fwts_cpu_is_Intel(bool *is_intel); > @@ -46,6 +52,9 @@ int fwts_cpu_enumerate(void); > int fwts_cpu_consume(const int seconds); > int fwts_cpu_consume_start(void); > void fwts_cpu_consume_complete(void); > -int fwts_cpu_performance(fwts_framework *fw, const int cpu, uint64_t *loop_count); > +int fwts_cpu_benchmark(fwts_framework *fw, const int cpu, > + fwts_cpu_benchmark_result *result); > + > +uint64_t fwts_cpu_benchmark_best_result(fwts_cpu_benchmark_result *res); > > #endif > diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c > index 75b1100..a7cfd3d 100644 > --- a/src/lib/src/fwts_cpu.c > +++ b/src/lib/src/fwts_cpu.c > @@ -26,8 +26,10 @@ > #include > #include > #include > +#include > #include > #include > +#include > #include > #include > #include > @@ -35,6 +37,8 @@ > #include > #include > > +#include > + > #include "fwts_types.h" > #include "fwts_cpu.h" > #include "fwts_pipeio.h" > @@ -312,20 +316,73 @@ static void fwts_cpu_burn_cycles(void) > } > } > > +static int perf_setup_counter(int cpu) > +{ > + struct perf_event_attr attr; > + int fd; > + > + memset(&attr, 0, sizeof(attr)); > + attr.type = PERF_TYPE_HARDWARE; > + attr.config = PERF_COUNT_HW_CPU_CYCLES; > + attr.disabled = 1; > + attr.size = sizeof(attr); > + > + fd = syscall(__NR_perf_event_open, &attr, -1, cpu, -1, 0); > + return fd; > +} > + > +static int perf_start_counter(int fd) > +{ > + int rc; > + > + rc = ioctl(fd, PERF_EVENT_IOC_ENABLE); > + return rc == 0 ? FWTS_OK : FWTS_ERROR; > +} > + > +static int perf_stop_counter(int fd) > +{ > + int rc; > + > + rc = ioctl(fd, PERF_EVENT_IOC_DISABLE); > + return rc == 0 ? FWTS_OK : FWTS_ERROR; > +} > + > +static int perf_read_counter(int fd, unsigned long long *result) > +{ > + unsigned long long buf; > + int rc; > + > + rc = read(fd, &buf, sizeof(buf)); > + if (rc == sizeof(buf)) { > + *result = buf; > + rc = FWTS_OK; > + } else { > + rc = FWTS_ERROR; > + } > + > + close(fd); > + return rc; > +} > + > /* > - * fwts_cpu_performance() > + * fwts_cpu_benchmark() > * > */ > -int fwts_cpu_performance( > +int fwts_cpu_benchmark( > fwts_framework *fw, > const int cpu, /* CPU we want to measure performance */ > - uint64_t *loop_count) /* Returned measure of bogo compute power */ > + fwts_cpu_benchmark_result *result) > { > + unsigned long long perfctr_result; > + fwts_cpu_benchmark_result tmp; > cpu_set_t mask, oldset; > + int perfctr, ncpus, rc; > + static bool warned; > time_t current; > - int ncpus = fwts_cpu_enumerate(); > + bool perf_ok; > > - *loop_count = 0; > + ncpus = fwts_cpu_enumerate(); > + memset(&tmp, 0, sizeof(tmp)); > > if (ncpus == FWTS_ERROR) > return FWTS_ERROR; > @@ -333,6 +390,20 @@ int fwts_cpu_performance( > if (cpu < 0 || cpu > ncpus) > return FWTS_ERROR; > > + /* setup perf counter */ > + perf_ok = true; > + perfctr = perf_setup_counter(cpu); > + if (perfctr < 0) { > + if (!warned) { > + fwts_log_warning(fw, "Can't use linux performance " > + "counters (perf), falling back to " > + "relative measurements"); > + warned = true; > + } > + perf_ok = false; > + } > + > + > /* Pin to the specified CPU */ > > if (sched_getaffinity(0, sizeof(oldset), &oldset) < 0) { > @@ -352,6 +423,9 @@ int fwts_cpu_performance( > while (current == time(NULL)) > sched_yield(); > > + if (perf_ok) > + perf_start_counter(perfctr); > + > current = time(NULL); > > /* > @@ -360,17 +434,38 @@ int fwts_cpu_performance( > */ > do { > fwts_cpu_burn_cycles(); > - (*loop_count)++; > + tmp.loops++; > } while (current == time(NULL)); > > + if (perf_ok) > + perf_stop_counter(perfctr); > + > if (sched_setaffinity(0, sizeof(oldset), &oldset) < 0) { > fwts_log_error(fw, "Cannot restore old CPU affinity settings."); > return FWTS_ERROR; > } > > + if (perf_ok) { > + rc = perf_read_counter(perfctr, &perfctr_result); > + if (rc == FWTS_OK) { > + tmp.cycles = perfctr_result; > + tmp.cycles_valid = true; > + } else { > + fwts_log_warning(fw, "failed to read perf counters"); > + } > + > + } > + > + *result = tmp; > + > return FWTS_OK; > } > > +uint64_t fwts_cpu_benchmark_best_result(fwts_cpu_benchmark_result *res) > +{ > + return res->cycles_valid ? res->cycles : res->loops; > +} > + > /* > * fwts_cpu_consume_cycles() > * eat up CPU cycles > Acked-by: Colin Ian King References: <1432200867.812695.718003224529.9.gpush@pablo> Message-ID: <55643FF1.8000500@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > Currently, we use time() to measure out one second of time for a CPU > benchmark. This means we have to wait around one second for a new time > value before performing the test, and means we have to assume that we've > been running for about one second. > > This change uses gettimeofday() instead; this way, we don't need to wait > before starting a test, and get millisecond resolution when calculating > the performance value. > > Signed-off-by: Jeremy Kerr > > --- > src/lib/src/fwts_cpu.c | 26 ++++++++++++++------------ > 1 file changed, 14 insertions(+), 12 deletions(-) > > diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c > index a7cfd3d..743de63 100644 > --- a/src/lib/src/fwts_cpu.c > +++ b/src/lib/src/fwts_cpu.c > @@ -31,11 +31,11 @@ > #include > #include > #include > +#include > #include > #include > #include > #include > -#include > > #include > > @@ -373,12 +373,12 @@ int fwts_cpu_benchmark( > const int cpu, /* CPU we want to measure performance */ > fwts_cpu_benchmark_result *result) > { > + struct timeval start, end, duration; > unsigned long long perfctr_result; > fwts_cpu_benchmark_result tmp; > cpu_set_t mask, oldset; > int perfctr, ncpus, rc; > static bool warned; > - time_t current; > bool perf_ok; > > ncpus = fwts_cpu_enumerate(); > @@ -418,24 +418,24 @@ int fwts_cpu_benchmark( > return FWTS_ERROR; > } > > - /* Wait until we get a new second */ > - current = time(NULL); > - while (current == time(NULL)) > - sched_yield(); > - > if (perf_ok) > perf_start_counter(perfctr); > - > - current = time(NULL); > + gettimeofday(&start, NULL); > > /* > * And burn some CPU cycles and get a bogo-compute like > * loop count measure of CPU performance. > */ > - do { > + for (;;) { > fwts_cpu_burn_cycles(); > + > tmp.loops++; > - } while (current == time(NULL)); > + > + gettimeofday(&end, NULL); > + timersub(&end, &start, &duration); > + if (duration.tv_sec >= 1) > + break; > + } > > if (perf_ok) > perf_stop_counter(perfctr); > @@ -448,7 +448,9 @@ int fwts_cpu_benchmark( > if (perf_ok) { > rc = perf_read_counter(perfctr, &perfctr_result); > if (rc == FWTS_OK) { > - tmp.cycles = perfctr_result; > + tmp.cycles = perfctr_result / > + ((1.0 * duration.tv_usec / 1000000) + > + duration.tv_sec); > tmp.cycles_valid = true; > } else { > fwts_log_warning(fw, "failed to read perf counters"); > Good improvement. Acked-by: Colin Ian King From colin.king at canonical.com Tue May 26 09:42:59 2015 From: colin.king at canonical.com (Colin Ian King) Date: Tue, 26 May 2015 10:42:59 +0100 Subject: ACK: [PATCH 10/11] fwts: scale cpu benchmark results to one second In-Reply-To: <1432200867.812790.959200306661.10.gpush@pablo> References: <1432200867.812790.959200306661.10.gpush@pablo> Message-ID: <55644023.4090300@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > Signed-off-by: Jeremy Kerr > > --- > src/lib/src/fwts_cpu.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/src/lib/src/fwts_cpu.c b/src/lib/src/fwts_cpu.c > index 743de63..d7793b7 100644 > --- a/src/lib/src/fwts_cpu.c > +++ b/src/lib/src/fwts_cpu.c > @@ -378,6 +378,7 @@ int fwts_cpu_benchmark( > fwts_cpu_benchmark_result tmp; > cpu_set_t mask, oldset; > int perfctr, ncpus, rc; > + double duration_sec; > static bool warned; > bool perf_ok; > > @@ -445,12 +446,15 @@ int fwts_cpu_benchmark( > return FWTS_ERROR; > } > > + duration_sec = duration.tv_sec + > + ((1.0 * duration.tv_usec) / 1000000.0); > + > + tmp.loops = (1.0 * tmp.loops) / duration_sec; > + > if (perf_ok) { > rc = perf_read_counter(perfctr, &perfctr_result); > if (rc == FWTS_OK) { > - tmp.cycles = perfctr_result / > - ((1.0 * duration.tv_usec / 1000000) + > - duration.tv_sec); > + tmp.cycles = (1.0 * perfctr_result) / duration_sec; > tmp.cycles_valid = true; > } else { > fwts_log_warning(fw, "failed to read perf counters"); > Acked-by: Colin Ian King References: <1432200867.812895.725561201452.11.gpush@pablo> Message-ID: <5564409C.3010900@canonical.com> On 21/05/15 10:34, Jeremy Kerr wrote: > On a (single-socket) openpower machine, the cpufreq tests take nearly an > hour: > > $ time sudo ./src/fwts cpufreq > Running 1 tests, results appended to results.log > Test: CPU frequency scaling tests. > CPU frequency performance tests. 1 passed > > real 58m43.334s > user 58m40.118s > sys 0m0.366s > > This is because we have 44 possible frequencies: > > $ wc -w scaling_available_frequencies > 44 scaling_available_frequencies > > on 80 cpus: > > $ getconf _NPROCESSORS_ONLN > 80 > > That's a total of 3520 individual benchmarks, at one second per test. > > However, those 80 cpus that linux reports are acually threads: 8 threads > per core, on a 10 core system. Because each of these threads is on the > same core, they share the same cpufreq control: > > $ ls -ld cpu{0..7}/cpufreq > drwxr-xr-x 3 root root 0 May 21 03:06 cpu0/cpufreq > lrwxrwxrwx 1 root root 0 May 21 01:29 cpu1/cpufreq -> ../cpu0/cpufreq > lrwxrwxrwx 1 root root 0 May 21 01:29 cpu2/cpufreq -> ../cpu0/cpufreq > lrwxrwxrwx 1 root root 0 May 21 01:29 cpu3/cpufreq -> ../cpu0/cpufreq > lrwxrwxrwx 1 root root 0 May 21 01:29 cpu4/cpufreq -> ../cpu0/cpufreq > lrwxrwxrwx 1 root root 0 May 21 01:29 cpu5/cpufreq -> ../cpu0/cpufreq > lrwxrwxrwx 1 root root 0 May 21 01:29 cpu6/cpufreq -> ../cpu0/cpufreq > lrwxrwxrwx 1 root root 0 May 21 01:29 cpu7/cpufreq -> ../cpu0/cpufreq > > So, rather than running the exact same test 8 times over on each core, > this change only runs the cpufreq test on the 'master' threads. > > Signed-off-by: Jeremy Kerr > > --- > src/cpu/cpufreq/cpufreq.c | 43 +++++++++++++++++++++++++++----------- > 1 file changed, 31 insertions(+), 12 deletions(-) > > diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c > index e409375..c6d6a9d 100644 > --- a/src/cpu/cpufreq/cpufreq.c > +++ b/src/cpu/cpufreq/cpufreq.c > @@ -29,6 +29,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -52,6 +53,7 @@ struct cpu { > int idx; > char sysfs_path[PATH_MAX]; > bool online; > + bool master; > > int n_freqs; > fwts_cpu_freq freqs[MAX_FREQS]; > @@ -79,8 +81,10 @@ static inline void cpu_mkpath( > const struct cpu *cpu, > const char *const name) > { > - snprintf(path, len, "%s/%s/cpufreq/%s", FWTS_CPU_PATH, > - cpu->sysfs_path, name); > + snprintf(path, len, "%s/%s/cpufreq%s%s", FWTS_CPU_PATH, > + cpu->sysfs_path, > + name ? "/" : "", > + name ?: ""); > } > > static int cpu_set_governor(fwts_framework *fw, struct cpu *cpu, > @@ -348,15 +352,16 @@ static int test_one_cpu_performance(fwts_framework *fw, struct cpu *cpu, > > static int cpufreq_test_cpu_performance(fwts_framework *fw) > { > - int n_online_cpus, i, c, rc; > + int n_master_cpus, i, c, rc; > bool ok = true; > > - n_online_cpus = 0; > + n_master_cpus = 0; > > > for (i = 0; cpufreq_settable && i < num_cpus; i++) { > - if (cpus[i].online) > - n_online_cpus++; > + if (!(cpus[i].online && cpus[i].master)) > + continue; > + n_master_cpus++; > rc = cpu_set_lowest_frequency(fw, &cpus[i]); > if (rc != FWTS_OK) > cpufreq_settable = false; > @@ -371,10 +376,10 @@ static int cpufreq_test_cpu_performance(fwts_framework *fw) > > /* then do the benchmark */ > for (i = 0, c = 0; i < num_cpus; i++) { > - if (!cpus[i].online) > + if (!(cpus[i].online && cpus[i].master)) > continue; > > - rc = test_one_cpu_performance(fw, &cpus[i], c++, n_online_cpus); > + rc = test_one_cpu_performance(fw, &cpus[i], c++, n_master_cpus); > if (rc != FWTS_OK) > ok = false; > > @@ -738,15 +743,29 @@ static int cpu_freq_compare(const void *v1, const void *v2) > return f1->Hz - f2->Hz; > } > > -static int parse_cpu_info(struct cpu *cpu, struct dirent *dir) > +static int parse_cpu_info(fwts_framework *fw, > + struct cpu *cpu, struct dirent *dir) > { > char *end, path[PATH_MAX+1], *str, *tmp, *tok; > - int i; > + struct stat statbuf; > + int i, rc; > > strcpy(cpu->sysfs_path, dir->d_name); > cpu->idx = strtoul(cpu->sysfs_path + strlen("cpu"), &end, 10); > cpu->online = true; > > + /* check if this is the master of a group of CPUs; we only > + * need to do perf checks on those that are the master */ > + cpu_mkpath(path, sizeof(path), cpu, NULL); > + rc = lstat(path, &statbuf); > + if (rc) { > + fwts_log_warning(fw, "Can't stat cpufreq info!"); > + return FWTS_ERROR; > + } > + > + /* non-master CPUs will have a link, not a dir */ > + cpu->master = S_ISDIR(statbuf.st_mode); > + > cpu_mkpath(path, sizeof(path), cpu, "scaling_governor"); > cpu->orig_governor = fwts_get(path); > > @@ -785,7 +804,7 @@ static int is_cpu_dir(const struct dirent *dir) > isdigit(dir->d_name[3]); > } > > -static int cpufreq_init(fwts_framework *fw __attribute__((unused))) > +static int cpufreq_init(fwts_framework *fw) > { > struct dirent **dirs; > int i, rc; > @@ -794,7 +813,7 @@ static int cpufreq_init(fwts_framework *fw __attribute__((unused))) > cpus = calloc(num_cpus, sizeof(*cpus)); > > for (i = 0; i < num_cpus; i++) > - parse_cpu_info(&cpus[i], dirs[i]); > + parse_cpu_info(fw, &cpus[i], dirs[i]); > > /* all test require a userspace governor */ > for (i = 0; i < num_cpus; i++) { > I like this optimisation step. Great idea! Acked-by: Colin Ian King From alex.hung at canonical.com Wed May 27 09:46:29 2015 From: alex.hung at canonical.com (Alex Hung) Date: Wed, 27 May 2015 17:46:29 +0800 Subject: [PATCH 1/3] lib: acpi: add an acpi category Message-ID: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> Signed-off-by: Alex Hung --- src/lib/src/fwts_framework.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index 190fc52..2753d54 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -47,9 +47,11 @@ typedef struct { FWTS_FLAG_POWER_STATES | \ FWTS_FLAG_UTILS | \ FWTS_FLAG_UNSAFE | \ - FWTS_FLAG_TEST_UEFI) + FWTS_FLAG_TEST_UEFI | \ + FWTS_FLAG_TEST_ACPI) static fwts_categories categories[] = { + { "ACPI", FWTS_FLAG_TEST_ACPI }, { "Batch", FWTS_FLAG_BATCH }, { "Interactive", FWTS_FLAG_INTERACTIVE }, { "Batch Experimental", FWTS_FLAG_BATCH_EXPERIMENTAL }, @@ -104,6 +106,7 @@ static fwts_option fwts_framework_options[] = { { "rsdp", "R:", 1, "Specify the physical address of the ACPI RSDP." }, { "pm-method", "", 1, "Select the power method to use. Accepted values are \"logind\", \"pm-utils\", \"sysfs\""}, { "show-tests-categories","", 0, "Show tests and associated categories." }, + { "acpi", "", 0, "Run ACPI tests." }, { NULL, NULL, 0, NULL } }; @@ -1226,6 +1229,9 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar case 39: /* --show-tests-categories */ fw->flags |= FWTS_FLAG_SHOW_TESTS_CATEGORIES; break; + case 40: /* --acpi */ + fw->flags |= FWTS_FLAG_TEST_ACPI; + break; } break; case 'a': /* --all */ -- 1.9.1 From alex.hung at canonical.com Wed May 27 09:46:30 2015 From: alex.hung at canonical.com (Alex Hung) Date: Wed, 27 May 2015 17:46:30 +0800 Subject: [PATCH 2/3] acpi: add tests to acpi category In-Reply-To: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> References: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> Message-ID: <1432719991-3047-2-git-send-email-alex.hung@canonical.com> Signed-off-by: Alex Hung --- src/acpi/acpitables/acpitables.c | 2 +- src/acpi/apicinstance/apicinstance.c | 2 +- src/acpi/checksum/checksum.c | 2 +- src/acpi/cstates/cstates.c | 2 +- src/acpi/dmar/dmar.c | 2 +- src/acpi/fadt/fadt.c | 2 +- src/acpi/mcfg/mcfg.c | 2 +- src/acpi/method/method.c | 2 +- src/acpi/spcr/spcr.c | 2 +- src/hpet/hpet_check/hpet_check.c | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c index 52b6659..1d3eb0c 100644 --- a/src/acpi/acpitables/acpitables.c +++ b/src/acpi/acpitables/acpitables.c @@ -859,4 +859,4 @@ static fwts_framework_ops acpi_table_check_ops = { .minor_tests = acpi_table_check_tests }; -FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) diff --git a/src/acpi/apicinstance/apicinstance.c b/src/acpi/apicinstance/apicinstance.c index 5a4d5a2..095c2ae 100644 --- a/src/acpi/apicinstance/apicinstance.c +++ b/src/acpi/apicinstance/apicinstance.c @@ -82,6 +82,6 @@ static fwts_framework_ops apicinstance_ops = { .minor_tests = apicinstance_tests }; -FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/checksum/checksum.c b/src/acpi/checksum/checksum.c index ed98e66..a649231 100644 --- a/src/acpi/checksum/checksum.c +++ b/src/acpi/checksum/checksum.c @@ -155,4 +155,4 @@ static fwts_framework_ops checksum_ops = { .minor_tests = checksum_tests }; -FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c index b58f15c..291ac21 100644 --- a/src/acpi/cstates/cstates.c +++ b/src/acpi/cstates/cstates.c @@ -254,6 +254,6 @@ static fwts_framework_ops cstates_ops = { .minor_tests = cstates_tests }; -FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c index 918768f..afd0327 100644 --- a/src/acpi/dmar/dmar.c +++ b/src/acpi/dmar/dmar.c @@ -334,6 +334,6 @@ static fwts_framework_ops dmar_ops = { .minor_tests = dmar_tests }; -FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c index 8f3abea..af0b192 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -194,6 +194,6 @@ static fwts_framework_ops fadt_ops = { .minor_tests = fadt_tests }; -FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) +FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/mcfg/mcfg.c b/src/acpi/mcfg/mcfg.c index 6748378..83f8d6f 100644 --- a/src/acpi/mcfg/mcfg.c +++ b/src/acpi/mcfg/mcfg.c @@ -259,6 +259,6 @@ static fwts_framework_ops mcfg_ops = { .minor_tests = mcfg_tests }; -FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) +FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index cc1ed33..ccd6c8a 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -6363,4 +6363,4 @@ static fwts_framework_ops method_ops = { .minor_tests = method_tests }; -FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c index 9fc7655..8eedb16 100644 --- a/src/acpi/spcr/spcr.c +++ b/src/acpi/spcr/spcr.c @@ -288,4 +288,4 @@ static fwts_framework_ops spcr_ops = { .minor_tests = spcr_tests }; -FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) +FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c index 6679c81..7699bb2 100644 --- a/src/hpet/hpet_check/hpet_check.c +++ b/src/hpet/hpet_check/hpet_check.c @@ -438,6 +438,6 @@ static fwts_framework_ops hpet_check_ops = { }; FWTS_REGISTER("hpet_check", &hpet_check_ops, FWTS_TEST_ANYTIME, - FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) + FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) #endif -- 1.9.1 From alex.hung at canonical.com Wed May 27 09:46:31 2015 From: alex.hung at canonical.com (Alex Hung) Date: Wed, 27 May 2015 17:46:31 +0800 Subject: [PATCH 3/3] live-image/fwts-frontend-text: add a selection of acpi and uefi tests In-Reply-To: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> References: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> Message-ID: <1432719991-3047-3-git-send-email-alex.hung@canonical.com> This is to avoid to generate too much noise when members of UEFI forum are only interested in ACPI and UEFI but not other tests. Signed-off-by: Alex Hung --- live-image/fwts-frontend-text | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text index 0b506ab..3796043 100755 --- a/live-image/fwts-frontend-text +++ b/live-image/fwts-frontend-text @@ -235,10 +235,11 @@ do dialog --help-button --backtitle "$FWTS" --title "Select Tests" --radiolist \ "This will run a suite of firmware tests that will check the BIOS and ACPI tables. It can also find issues that can cause Linux problems.\n\n\ The default below is to run just all the Batch Tests, but you can select more tests below if required.\n\nPlease select below (using cursor up/down and space) and press enter to continue:" \ - 18 70 4 \ + 19 70 5 \ 1 "All Batch Tests" on \ - 2 "Select Individual Tests" off \ - 3 "Abort Testing" off \ + 2 "ACPI and UEFI Tests" off \ + 3 "Select Individual Tests" off \ + 4 "Abort Testing" off \ 2> $OPTIONS case $? in @@ -250,9 +251,13 @@ The default below is to run just all the Batch Tests, but you can select more te done_tests_finish ;; '2') - select_tests + do_test "--acpi --uefi" 'Running ACPI and UEFI Tests' + done_tests_finish ;; '3') + select_tests + ;; + '4') no_tests_finish ;; esac -- 1.9.1 From colin.king at canonical.com Wed May 27 10:10:10 2015 From: colin.king at canonical.com (Colin Ian King) Date: Wed, 27 May 2015 11:10:10 +0100 Subject: [PATCH 3/3] live-image/fwts-frontend-text: add a selection of acpi and uefi tests In-Reply-To: <1432719991-3047-3-git-send-email-alex.hung@canonical.com> References: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> <1432719991-3047-3-git-send-email-alex.hung@canonical.com> Message-ID: <55659802.3050608@canonical.com> On 27/05/15 10:46, Alex Hung wrote: > This is to avoid to generate too much noise when members of UEFI > forum are only interested in ACPI and UEFI but not other tests. > > Signed-off-by: Alex Hung > --- > live-image/fwts-frontend-text | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text > index 0b506ab..3796043 100755 > --- a/live-image/fwts-frontend-text > +++ b/live-image/fwts-frontend-text > @@ -235,10 +235,11 @@ do > dialog --help-button --backtitle "$FWTS" --title "Select Tests" --radiolist \ > "This will run a suite of firmware tests that will check the BIOS and ACPI tables. It can also find issues that can cause Linux problems.\n\n\ > The default below is to run just all the Batch Tests, but you can select more tests below if required.\n\nPlease select below (using cursor up/down and space) and press enter to continue:" \ > - 18 70 4 \ > + 19 70 5 \ > 1 "All Batch Tests" on \ > - 2 "Select Individual Tests" off \ > - 3 "Abort Testing" off \ > + 2 "ACPI and UEFI Tests" off \ Do we want instead: 2 "ACPI tests" off \ 3 "UEFI tests" off \ so users can chose one or both of these rather than "ACPI and UEFI". > + 3 "Select Individual Tests" off \ > + 4 "Abort Testing" off \ > 2> $OPTIONS > > case $? in > @@ -250,9 +251,13 @@ The default below is to run just all the Batch Tests, but you can select more te > done_tests_finish > ;; > '2') > - select_tests > + do_test "--acpi --uefi" 'Running ACPI and UEFI Tests' > + done_tests_finish > ;; > '3') > + select_tests > + ;; > + '4') > no_tests_finish > ;; > esac > From alex.hung at canonical.com Thu May 28 07:00:54 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 28 May 2015 15:00:54 +0800 Subject: [PATCH 3/3] live-image/fwts-frontend-text: add a selection of acpi and uefi tests In-Reply-To: <55659802.3050608@canonical.com> References: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> <1432719991-3047-3-git-send-email-alex.hung@canonical.com> <55659802.3050608@canonical.com> Message-ID: That's a good idea. I will send out V2 shortly. On Wed, May 27, 2015 at 6:10 PM, Colin Ian King wrote: > On 27/05/15 10:46, Alex Hung wrote: >> This is to avoid to generate too much noise when members of UEFI >> forum are only interested in ACPI and UEFI but not other tests. >> >> Signed-off-by: Alex Hung >> --- >> live-image/fwts-frontend-text | 13 +++++++++---- >> 1 file changed, 9 insertions(+), 4 deletions(-) >> >> diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text >> index 0b506ab..3796043 100755 >> --- a/live-image/fwts-frontend-text >> +++ b/live-image/fwts-frontend-text >> @@ -235,10 +235,11 @@ do >> dialog --help-button --backtitle "$FWTS" --title "Select Tests" --radiolist \ >> "This will run a suite of firmware tests that will check the BIOS and ACPI tables. It can also find issues that can cause Linux problems.\n\n\ >> The default below is to run just all the Batch Tests, but you can select more tests below if required.\n\nPlease select below (using cursor up/down and space) and press enter to continue:" \ >> - 18 70 4 \ >> + 19 70 5 \ >> 1 "All Batch Tests" on \ >> - 2 "Select Individual Tests" off \ >> - 3 "Abort Testing" off \ >> + 2 "ACPI and UEFI Tests" off \ > > Do we want instead: > 2 "ACPI tests" off \ > 3 "UEFI tests" off \ > > so users can chose one or both of these rather than "ACPI and UEFI". > >> + 3 "Select Individual Tests" off \ >> + 4 "Abort Testing" off \ >> 2> $OPTIONS >> >> case $? in >> @@ -250,9 +251,13 @@ The default below is to run just all the Batch Tests, but you can select more te >> done_tests_finish >> ;; >> '2') >> - select_tests >> + do_test "--acpi --uefi" 'Running ACPI and UEFI Tests' >> + done_tests_finish >> ;; >> '3') >> + select_tests >> + ;; >> + '4') >> no_tests_finish >> ;; >> esac >> > > > -- > fwts-devel mailing list > fwts-devel at lists.ubuntu.com > Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel -- Cheers, Alex Hung From alex.hung at canonical.com Thu May 28 08:08:11 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 28 May 2015 16:08:11 +0800 Subject: [PATCH v2] live-image/fwts-frontend-text: add selections of acpi and uefi tests Message-ID: <1432800491-3430-1-git-send-email-alex.hung@canonical.com> This is to avoid too much noise when members of UEFI forum who may be interested in only ACPI and UEFI but no others. Signed-off-by: Alex Hung --- live-image/fwts-frontend-text | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text index 0b506ab..3119895 100755 --- a/live-image/fwts-frontend-text +++ b/live-image/fwts-frontend-text @@ -235,10 +235,12 @@ do dialog --help-button --backtitle "$FWTS" --title "Select Tests" --radiolist \ "This will run a suite of firmware tests that will check the BIOS and ACPI tables. It can also find issues that can cause Linux problems.\n\n\ The default below is to run just all the Batch Tests, but you can select more tests below if required.\n\nPlease select below (using cursor up/down and space) and press enter to continue:" \ - 18 70 4 \ + 20 70 6 \ 1 "All Batch Tests" on \ - 2 "Select Individual Tests" off \ - 3 "Abort Testing" off \ + 2 "ACPI Tests" off \ + 3 "UEFI Tests" off \ + 4 "Select Individual Tests" off \ + 5 "Abort Testing" off \ 2> $OPTIONS case $? in @@ -250,9 +252,17 @@ The default below is to run just all the Batch Tests, but you can select more te done_tests_finish ;; '2') - select_tests + do_test "--acpi" 'Running ACPI Tests' + done_tests_finish ;; '3') + do_test "--uefi" 'Running UEFI Tests' + done_tests_finish + ;; + '4') + select_tests + ;; + '5') no_tests_finish ;; esac -- 1.9.1 From colin.king at canonical.com Thu May 28 09:09:13 2015 From: colin.king at canonical.com (Colin Ian King) Date: Thu, 28 May 2015 10:09:13 +0100 Subject: [PATCH 2/3] acpi: add tests to acpi category In-Reply-To: <1432719991-3047-2-git-send-email-alex.hung@canonical.com> References: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> <1432719991-3047-2-git-send-email-alex.hung@canonical.com> Message-ID: <5566DB39.3000402@canonical.com> On 27/05/15 10:46, Alex Hung wrote: > Signed-off-by: Alex Hung > --- > src/acpi/acpitables/acpitables.c | 2 +- > src/acpi/apicinstance/apicinstance.c | 2 +- > src/acpi/checksum/checksum.c | 2 +- > src/acpi/cstates/cstates.c | 2 +- > src/acpi/dmar/dmar.c | 2 +- > src/acpi/fadt/fadt.c | 2 +- > src/acpi/mcfg/mcfg.c | 2 +- > src/acpi/method/method.c | 2 +- > src/acpi/spcr/spcr.c | 2 +- > src/hpet/hpet_check/hpet_check.c | 2 +- > 10 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c > index 52b6659..1d3eb0c 100644 > --- a/src/acpi/acpitables/acpitables.c > +++ b/src/acpi/acpitables/acpitables.c > @@ -859,4 +859,4 @@ static fwts_framework_ops acpi_table_check_ops = { > .minor_tests = acpi_table_check_tests > }; > > -FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/apicinstance/apicinstance.c b/src/acpi/apicinstance/apicinstance.c > index 5a4d5a2..095c2ae 100644 > --- a/src/acpi/apicinstance/apicinstance.c > +++ b/src/acpi/apicinstance/apicinstance.c > @@ -82,6 +82,6 @@ static fwts_framework_ops apicinstance_ops = { > .minor_tests = apicinstance_tests > }; > > -FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/checksum/checksum.c b/src/acpi/checksum/checksum.c > index ed98e66..a649231 100644 > --- a/src/acpi/checksum/checksum.c > +++ b/src/acpi/checksum/checksum.c > @@ -155,4 +155,4 @@ static fwts_framework_ops checksum_ops = { > .minor_tests = checksum_tests > }; > > -FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c > index b58f15c..291ac21 100644 > --- a/src/acpi/cstates/cstates.c > +++ b/src/acpi/cstates/cstates.c > @@ -254,6 +254,6 @@ static fwts_framework_ops cstates_ops = { > .minor_tests = cstates_tests > }; > > -FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c > index 918768f..afd0327 100644 > --- a/src/acpi/dmar/dmar.c > +++ b/src/acpi/dmar/dmar.c > @@ -334,6 +334,6 @@ static fwts_framework_ops dmar_ops = { > .minor_tests = dmar_tests > }; > > -FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c > index 8f3abea..af0b192 100644 > --- a/src/acpi/fadt/fadt.c > +++ b/src/acpi/fadt/fadt.c > @@ -194,6 +194,6 @@ static fwts_framework_ops fadt_ops = { > .minor_tests = fadt_tests > }; > > -FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/mcfg/mcfg.c b/src/acpi/mcfg/mcfg.c > index 6748378..83f8d6f 100644 > --- a/src/acpi/mcfg/mcfg.c > +++ b/src/acpi/mcfg/mcfg.c > @@ -259,6 +259,6 @@ static fwts_framework_ops mcfg_ops = { > .minor_tests = mcfg_tests > }; > > -FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index cc1ed33..ccd6c8a 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -6363,4 +6363,4 @@ static fwts_framework_ops method_ops = { > .minor_tests = method_tests > }; > > -FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c > index 9fc7655..8eedb16 100644 > --- a/src/acpi/spcr/spcr.c > +++ b/src/acpi/spcr/spcr.c > @@ -288,4 +288,4 @@ static fwts_framework_ops spcr_ops = { > .minor_tests = spcr_tests > }; > > -FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c > index 6679c81..7699bb2 100644 > --- a/src/hpet/hpet_check/hpet_check.c > +++ b/src/hpet/hpet_check/hpet_check.c > @@ -438,6 +438,6 @@ static fwts_framework_ops hpet_check_ops = { > }; > > FWTS_REGISTER("hpet_check", &hpet_check_ops, FWTS_TEST_ANYTIME, > - FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > + FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif > I think we're also missing syntaxcheck, acpiinfo, osilinux, pcc, and maybe wmi too since this is buried in ACPI From alex.hung at canonical.com Thu May 28 09:27:00 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 28 May 2015 17:27:00 +0800 Subject: [PATCH 2/3] acpi: add tests to acpi category In-Reply-To: <5566DB39.3000402@canonical.com> References: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> <1432719991-3047-2-git-send-email-alex.hung@canonical.com> <5566DB39.3000402@canonical.com> Message-ID: The purpose was just to do enough but not generate false positives or don't-care. I syntaxcheck can rely on iasl's disassemable function and it can generate false positive acpiinfo is information but not a test. osilinux generates warning but not failures. There were discussion on awsg mailing list on _OSI. The use of _OSI is not faulty but everybody probably knows _OSI("Linux") will not work by now. I didn't WMI as it is actually not defined in ACPI. I agree it should be included on my second thought. I will add v2 to include pcc and wmi On Thu, May 28, 2015 at 5:09 PM, Colin Ian King wrote: > On 27/05/15 10:46, Alex Hung wrote: >> Signed-off-by: Alex Hung >> --- >> src/acpi/acpitables/acpitables.c | 2 +- >> src/acpi/apicinstance/apicinstance.c | 2 +- >> src/acpi/checksum/checksum.c | 2 +- >> src/acpi/cstates/cstates.c | 2 +- >> src/acpi/dmar/dmar.c | 2 +- >> src/acpi/fadt/fadt.c | 2 +- >> src/acpi/mcfg/mcfg.c | 2 +- >> src/acpi/method/method.c | 2 +- >> src/acpi/spcr/spcr.c | 2 +- >> src/hpet/hpet_check/hpet_check.c | 2 +- >> 10 files changed, 10 insertions(+), 10 deletions(-) >> >> diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c >> index 52b6659..1d3eb0c 100644 >> --- a/src/acpi/acpitables/acpitables.c >> +++ b/src/acpi/acpitables/acpitables.c >> @@ -859,4 +859,4 @@ static fwts_framework_ops acpi_table_check_ops = { >> .minor_tests = acpi_table_check_tests >> }; >> >> -FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) >> +FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) >> diff --git a/src/acpi/apicinstance/apicinstance.c b/src/acpi/apicinstance/apicinstance.c >> index 5a4d5a2..095c2ae 100644 >> --- a/src/acpi/apicinstance/apicinstance.c >> +++ b/src/acpi/apicinstance/apicinstance.c >> @@ -82,6 +82,6 @@ static fwts_framework_ops apicinstance_ops = { >> .minor_tests = apicinstance_tests >> }; >> >> -FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) >> +FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) >> >> #endif >> diff --git a/src/acpi/checksum/checksum.c b/src/acpi/checksum/checksum.c >> index ed98e66..a649231 100644 >> --- a/src/acpi/checksum/checksum.c >> +++ b/src/acpi/checksum/checksum.c >> @@ -155,4 +155,4 @@ static fwts_framework_ops checksum_ops = { >> .minor_tests = checksum_tests >> }; >> >> -FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) >> +FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) >> diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c >> index b58f15c..291ac21 100644 >> --- a/src/acpi/cstates/cstates.c >> +++ b/src/acpi/cstates/cstates.c >> @@ -254,6 +254,6 @@ static fwts_framework_ops cstates_ops = { >> .minor_tests = cstates_tests >> }; >> >> -FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) >> +FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) >> >> #endif >> diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c >> index 918768f..afd0327 100644 >> --- a/src/acpi/dmar/dmar.c >> +++ b/src/acpi/dmar/dmar.c >> @@ -334,6 +334,6 @@ static fwts_framework_ops dmar_ops = { >> .minor_tests = dmar_tests >> }; >> >> -FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) >> +FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) >> >> #endif >> diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c >> index 8f3abea..af0b192 100644 >> --- a/src/acpi/fadt/fadt.c >> +++ b/src/acpi/fadt/fadt.c >> @@ -194,6 +194,6 @@ static fwts_framework_ops fadt_ops = { >> .minor_tests = fadt_tests >> }; >> >> -FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) >> +FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) >> >> #endif >> diff --git a/src/acpi/mcfg/mcfg.c b/src/acpi/mcfg/mcfg.c >> index 6748378..83f8d6f 100644 >> --- a/src/acpi/mcfg/mcfg.c >> +++ b/src/acpi/mcfg/mcfg.c >> @@ -259,6 +259,6 @@ static fwts_framework_ops mcfg_ops = { >> .minor_tests = mcfg_tests >> }; >> >> -FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) >> +FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) >> >> #endif >> diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c >> index cc1ed33..ccd6c8a 100644 >> --- a/src/acpi/method/method.c >> +++ b/src/acpi/method/method.c >> @@ -6363,4 +6363,4 @@ static fwts_framework_ops method_ops = { >> .minor_tests = method_tests >> }; >> >> -FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) >> +FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) >> diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c >> index 9fc7655..8eedb16 100644 >> --- a/src/acpi/spcr/spcr.c >> +++ b/src/acpi/spcr/spcr.c >> @@ -288,4 +288,4 @@ static fwts_framework_ops spcr_ops = { >> .minor_tests = spcr_tests >> }; >> >> -FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) >> +FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) >> diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c >> index 6679c81..7699bb2 100644 >> --- a/src/hpet/hpet_check/hpet_check.c >> +++ b/src/hpet/hpet_check/hpet_check.c >> @@ -438,6 +438,6 @@ static fwts_framework_ops hpet_check_ops = { >> }; >> >> FWTS_REGISTER("hpet_check", &hpet_check_ops, FWTS_TEST_ANYTIME, >> - FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) >> + FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) >> >> #endif >> > > I think we're also missing > > syntaxcheck, acpiinfo, osilinux, pcc, > > and maybe wmi too since this is buried in ACPI > > -- > fwts-devel mailing list > fwts-devel at lists.ubuntu.com > Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel -- Cheers, Alex Hung From alex.hung at canonical.com Thu May 28 10:09:52 2015 From: alex.hung at canonical.com (Alex Hung) Date: Thu, 28 May 2015 18:09:52 +0800 Subject: [PATCH v2] acpi: add tests to acpi category Message-ID: <1432807792-6576-1-git-send-email-alex.hung@canonical.com> --- src/acpi/acpiinfo/acpiinfo.c | 2 +- src/acpi/acpitables/acpitables.c | 2 +- src/acpi/apicinstance/apicinstance.c | 2 +- src/acpi/checksum/checksum.c | 2 +- src/acpi/cstates/cstates.c | 2 +- src/acpi/dmar/dmar.c | 2 +- src/acpi/fadt/fadt.c | 2 +- src/acpi/mcfg/mcfg.c | 2 +- src/acpi/method/method.c | 2 +- src/acpi/pcc/pcc.c | 2 +- src/acpi/spcr/spcr.c | 2 +- src/acpi/wmi/wmi.c | 2 +- src/hpet/hpet_check/hpet_check.c | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/acpi/acpiinfo/acpiinfo.c b/src/acpi/acpiinfo/acpiinfo.c index ce37972..c80b621 100644 --- a/src/acpi/acpiinfo/acpiinfo.c +++ b/src/acpi/acpiinfo/acpiinfo.c @@ -149,4 +149,4 @@ static fwts_framework_ops acpiinfo_ops = { .minor_tests = acpiinfo_tests }; -FWTS_REGISTER("acpiinfo", &acpiinfo_ops, FWTS_TEST_EARLY, FWTS_FLAG_BATCH) +FWTS_REGISTER("acpiinfo", &acpiinfo_ops, FWTS_TEST_EARLY, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c index 52b6659..1d3eb0c 100644 --- a/src/acpi/acpitables/acpitables.c +++ b/src/acpi/acpitables/acpitables.c @@ -859,4 +859,4 @@ static fwts_framework_ops acpi_table_check_ops = { .minor_tests = acpi_table_check_tests }; -FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) diff --git a/src/acpi/apicinstance/apicinstance.c b/src/acpi/apicinstance/apicinstance.c index 5a4d5a2..095c2ae 100644 --- a/src/acpi/apicinstance/apicinstance.c +++ b/src/acpi/apicinstance/apicinstance.c @@ -82,6 +82,6 @@ static fwts_framework_ops apicinstance_ops = { .minor_tests = apicinstance_tests }; -FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/checksum/checksum.c b/src/acpi/checksum/checksum.c index ed98e66..a649231 100644 --- a/src/acpi/checksum/checksum.c +++ b/src/acpi/checksum/checksum.c @@ -155,4 +155,4 @@ static fwts_framework_ops checksum_ops = { .minor_tests = checksum_tests }; -FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c index b58f15c..291ac21 100644 --- a/src/acpi/cstates/cstates.c +++ b/src/acpi/cstates/cstates.c @@ -254,6 +254,6 @@ static fwts_framework_ops cstates_ops = { .minor_tests = cstates_tests }; -FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c index 918768f..afd0327 100644 --- a/src/acpi/dmar/dmar.c +++ b/src/acpi/dmar/dmar.c @@ -334,6 +334,6 @@ static fwts_framework_ops dmar_ops = { .minor_tests = dmar_tests }; -FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c index 8f3abea..af0b192 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -194,6 +194,6 @@ static fwts_framework_ops fadt_ops = { .minor_tests = fadt_tests }; -FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) +FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/mcfg/mcfg.c b/src/acpi/mcfg/mcfg.c index 6748378..83f8d6f 100644 --- a/src/acpi/mcfg/mcfg.c +++ b/src/acpi/mcfg/mcfg.c @@ -259,6 +259,6 @@ static fwts_framework_ops mcfg_ops = { .minor_tests = mcfg_tests }; -FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) +FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index cc1ed33..ccd6c8a 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -6363,4 +6363,4 @@ static fwts_framework_ops method_ops = { .minor_tests = method_tests }; -FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) diff --git a/src/acpi/pcc/pcc.c b/src/acpi/pcc/pcc.c index 8cf2288..da66aec 100644 --- a/src/acpi/pcc/pcc.c +++ b/src/acpi/pcc/pcc.c @@ -464,6 +464,6 @@ static fwts_framework_ops pcc_ops = { .minor_tests = pcc_tests }; -FWTS_REGISTER("pcc", &pcc_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("pcc", &pcc_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c index 9fc7655..8eedb16 100644 --- a/src/acpi/spcr/spcr.c +++ b/src/acpi/spcr/spcr.c @@ -288,4 +288,4 @@ static fwts_framework_ops spcr_ops = { .minor_tests = spcr_tests }; -FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) +FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c index 188db08..22dc7b1 100644 --- a/src/acpi/wmi/wmi.c +++ b/src/acpi/wmi/wmi.c @@ -410,6 +410,6 @@ static fwts_framework_ops wmi_ops = { .minor_tests = wmi_tests }; -FWTS_REGISTER("wmi", &wmi_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) +FWTS_REGISTER("wmi", &wmi_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) #endif diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c index 6679c81..7699bb2 100644 --- a/src/hpet/hpet_check/hpet_check.c +++ b/src/hpet/hpet_check/hpet_check.c @@ -438,6 +438,6 @@ static fwts_framework_ops hpet_check_ops = { }; FWTS_REGISTER("hpet_check", &hpet_check_ops, FWTS_TEST_ANYTIME, - FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) + FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) #endif -- 1.9.1 From colin.king at canonical.com Thu May 28 10:23:51 2015 From: colin.king at canonical.com (Colin Ian King) Date: Thu, 28 May 2015 11:23:51 +0100 Subject: ACK [PATCH v2] acpi: add tests to acpi category In-Reply-To: <1432807792-6576-1-git-send-email-alex.hung@canonical.com> References: <1432807792-6576-1-git-send-email-alex.hung@canonical.com> Message-ID: <5566ECB7.8080904@canonical.com> On 28/05/15 11:09, Alex Hung wrote: > --- > src/acpi/acpiinfo/acpiinfo.c | 2 +- > src/acpi/acpitables/acpitables.c | 2 +- > src/acpi/apicinstance/apicinstance.c | 2 +- > src/acpi/checksum/checksum.c | 2 +- > src/acpi/cstates/cstates.c | 2 +- > src/acpi/dmar/dmar.c | 2 +- > src/acpi/fadt/fadt.c | 2 +- > src/acpi/mcfg/mcfg.c | 2 +- > src/acpi/method/method.c | 2 +- > src/acpi/pcc/pcc.c | 2 +- > src/acpi/spcr/spcr.c | 2 +- > src/acpi/wmi/wmi.c | 2 +- > src/hpet/hpet_check/hpet_check.c | 2 +- > 13 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/src/acpi/acpiinfo/acpiinfo.c b/src/acpi/acpiinfo/acpiinfo.c > index ce37972..c80b621 100644 > --- a/src/acpi/acpiinfo/acpiinfo.c > +++ b/src/acpi/acpiinfo/acpiinfo.c > @@ -149,4 +149,4 @@ static fwts_framework_ops acpiinfo_ops = { > .minor_tests = acpiinfo_tests > }; > > -FWTS_REGISTER("acpiinfo", &acpiinfo_ops, FWTS_TEST_EARLY, FWTS_FLAG_BATCH) > +FWTS_REGISTER("acpiinfo", &acpiinfo_ops, FWTS_TEST_EARLY, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c > index 52b6659..1d3eb0c 100644 > --- a/src/acpi/acpitables/acpitables.c > +++ b/src/acpi/acpitables/acpitables.c > @@ -859,4 +859,4 @@ static fwts_framework_ops acpi_table_check_ops = { > .minor_tests = acpi_table_check_tests > }; > > -FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/apicinstance/apicinstance.c b/src/acpi/apicinstance/apicinstance.c > index 5a4d5a2..095c2ae 100644 > --- a/src/acpi/apicinstance/apicinstance.c > +++ b/src/acpi/apicinstance/apicinstance.c > @@ -82,6 +82,6 @@ static fwts_framework_ops apicinstance_ops = { > .minor_tests = apicinstance_tests > }; > > -FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/checksum/checksum.c b/src/acpi/checksum/checksum.c > index ed98e66..a649231 100644 > --- a/src/acpi/checksum/checksum.c > +++ b/src/acpi/checksum/checksum.c > @@ -155,4 +155,4 @@ static fwts_framework_ops checksum_ops = { > .minor_tests = checksum_tests > }; > > -FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c > index b58f15c..291ac21 100644 > --- a/src/acpi/cstates/cstates.c > +++ b/src/acpi/cstates/cstates.c > @@ -254,6 +254,6 @@ static fwts_framework_ops cstates_ops = { > .minor_tests = cstates_tests > }; > > -FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c > index 918768f..afd0327 100644 > --- a/src/acpi/dmar/dmar.c > +++ b/src/acpi/dmar/dmar.c > @@ -334,6 +334,6 @@ static fwts_framework_ops dmar_ops = { > .minor_tests = dmar_tests > }; > > -FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c > index 8f3abea..af0b192 100644 > --- a/src/acpi/fadt/fadt.c > +++ b/src/acpi/fadt/fadt.c > @@ -194,6 +194,6 @@ static fwts_framework_ops fadt_ops = { > .minor_tests = fadt_tests > }; > > -FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/mcfg/mcfg.c b/src/acpi/mcfg/mcfg.c > index 6748378..83f8d6f 100644 > --- a/src/acpi/mcfg/mcfg.c > +++ b/src/acpi/mcfg/mcfg.c > @@ -259,6 +259,6 @@ static fwts_framework_ops mcfg_ops = { > .minor_tests = mcfg_tests > }; > > -FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index cc1ed33..ccd6c8a 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -6363,4 +6363,4 @@ static fwts_framework_ops method_ops = { > .minor_tests = method_tests > }; > > -FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/pcc/pcc.c b/src/acpi/pcc/pcc.c > index 8cf2288..da66aec 100644 > --- a/src/acpi/pcc/pcc.c > +++ b/src/acpi/pcc/pcc.c > @@ -464,6 +464,6 @@ static fwts_framework_ops pcc_ops = { > .minor_tests = pcc_tests > }; > > -FWTS_REGISTER("pcc", &pcc_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("pcc", &pcc_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c > index 9fc7655..8eedb16 100644 > --- a/src/acpi/spcr/spcr.c > +++ b/src/acpi/spcr/spcr.c > @@ -288,4 +288,4 @@ static fwts_framework_ops spcr_ops = { > .minor_tests = spcr_tests > }; > > -FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c > index 188db08..22dc7b1 100644 > --- a/src/acpi/wmi/wmi.c > +++ b/src/acpi/wmi/wmi.c > @@ -410,6 +410,6 @@ static fwts_framework_ops wmi_ops = { > .minor_tests = wmi_tests > }; > > -FWTS_REGISTER("wmi", &wmi_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("wmi", &wmi_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c > index 6679c81..7699bb2 100644 > --- a/src/hpet/hpet_check/hpet_check.c > +++ b/src/hpet/hpet_check/hpet_check.c > @@ -438,6 +438,6 @@ static fwts_framework_ops hpet_check_ops = { > }; > > FWTS_REGISTER("hpet_check", &hpet_check_ops, FWTS_TEST_ANYTIME, > - FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > + FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif > Acked-by: Colin Ian King From ivan.hu at canonical.com Fri May 29 06:46:15 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 14:46:15 +0800 Subject: ACK: [PATCH] lib: fwts_alloc: provide fallback low memory allocator strategy (LP: #1452168) In-Reply-To: <1430901383-7080-1-git-send-email-colin.king@canonical.com> References: <1430901383-7080-1-git-send-email-colin.king@canonical.com> Message-ID: <55680B37.2030408@canonical.com> On 2015?05?06? 16:36, Colin King wrote: > From: Colin Ian King > > The fwts low memory allocator made some assumptions that > /proc/self/maps was always available for parsing to gain > some smarts on how to do a 32 bit memory allocation. > Apparently some platforms this is not available or can't > be parsed or just does not provide enough free memory > slots so this fails. > > Instead, we need to have a fall-back dumb low memory > allocator scheme that walks through memory trying to find > free regions using mincore() to do the probing. > > Thanks to Suravee Suthikulpanit for finding, debugging and testing > this fix. > > Tested-by: Suravee Suthikulpanit > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_alloc.c | 85 +++++++++++++++++++++++++++++++++++++++++------- > 1 file changed, 74 insertions(+), 11 deletions(-) > > diff --git a/src/lib/src/fwts_alloc.c b/src/lib/src/fwts_alloc.c > index 9bac784..89aaa34 100644 > --- a/src/lib/src/fwts_alloc.c > +++ b/src/lib/src/fwts_alloc.c > @@ -22,13 +22,14 @@ > #include > #include > #include > +#include > > -#include "fwts_alloc.h" > +#include "fwts.h" > > /* > * We implement a low memory allocator to allow us to allocate > * memory < 2G limit for the ACPICA table handling. On 64 bit > - * machines we habe to ensure that cached copies of ACPI tables > + * machines we have to ensure that cached copies of ACPI tables > * have addresses that can be addressed by the legacy 32 bit > * ACPI table pointers. > * > @@ -47,11 +48,61 @@ typedef struct { > unsigned int magic; > } fwts_mmap_header; > > -#define CHUNK_SIZE (8192) /* page plus loads of slack */ > +/* > + * CHUNK_SIZE controls the gap between mappings. This creates gaps > + * between each low memory allocation so that we have some chance > + * of catching memory accesses that fall off the mapping. Without > + * a gap, memory mappings potentially become contiguous and hence > + * memory access errors are harder to catch. This is wasteful > + * in terms of address space, but fwts doesn't do too many low memory > + * mappings since they are just used for cached copies of ACPI tables. > + */ > +#define CHUNK_SIZE (64*1024) > + > #define LIMIT_2GB (0x80000000ULL) > #define LIMIT_START (0x00010000ULL) > > -#ifndef MAP_32BIT > +/* > + * fwts_low_mmap_walkdown() > + * try to allocate a free space under the 2GB limit by > + * walking down memory in CHUNK_SIZE steps for an unmapped region > + */ > +static void *fwts_low_mmap_walkdown(const size_t requested_size) > +{ > + void *addr; > + size_t page_size = fwts_page_size(); > + size_t sz = (requested_size + page_size) & ~(page_size - 1); > + size_t pages = sz / page_size; > + unsigned char vec[pages]; > + static void *last_addr = (void *)LIMIT_2GB; > + > + if (requested_size == 0) /* Illegal */ > + return MAP_FAILED; > + > + for (addr = last_addr - sz; addr > (void *)LIMIT_START; addr -= CHUNK_SIZE) { > + void *mapping; > + > + /* Already mapped? */ > + if (mincore(addr, pages, vec) == 0) > + continue; > + > + /* Not mapped but mincore returned something unexpected? */ > + if (errno != ENOMEM) > + continue; > + > + mapping = mmap(addr, requested_size, PROT_READ | PROT_WRITE, > + MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, -1, 0); > + if (mapping != MAP_FAILED) { > + last_addr = mapping; > + return mapping; > + } > + } > + /* We've scanned all of memory, give up on subsequent calls */ > + last_addr = (void *)LIMIT_START; > + > + return MAP_FAILED; > +} > + > /* > * fwts_low_mmap() > * try to find a free space under the 2GB limit and mmap it. > @@ -71,13 +122,16 @@ static void *fwts_low_mmap(const size_t requested_size) > if (requested_size == 0) /* Illegal */ > return MAP_FAILED; > > + /* > + * If we can't access our own mappings then find a > + * free page by just walking down memory > + */ > if ((fp = fopen("/proc/self/maps", "r")) == NULL) > - return MAP_FAILED; > + return fwts_low_mmap_walkdown(requested_size); > > while (fgets(buffer, sizeof(buffer), fp) != NULL) { > sscanf(buffer, "%p-%p %*s %*x %*s %*u %1023s", > &addr_start, &addr_end, pathname); > - > /* > * Try and allocate under first mmap'd address space > */ > @@ -111,6 +165,7 @@ static void *fwts_low_mmap(const size_t requested_size) > (last_addr_end < (void*)LIMIT_2GB)) { > if (((uint8_t *)addr_start - (uint8_t *)last_addr_end) > (ptrdiff_t)requested_size) { > void *addr = last_addr_end; > + > ret = mmap(addr, requested_size, PROT_READ | PROT_WRITE, > MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, -1, 0); > if (ret != MAP_FAILED) > @@ -133,9 +188,15 @@ static void *fwts_low_mmap(const size_t requested_size) > } > fclose(fp); > > + /* > + * The "intelligent" memory hole finding strategy failed, > + * so try walking down memory instead. > + */ > + if (ret == MAP_FAILED) > + ret = fwts_low_mmap_walkdown(requested_size); > + > return ret; > } > -#endif > > /* > * fwts_low_calloc() > @@ -147,7 +208,7 @@ static void *fwts_low_mmap(const size_t requested_size) > void *fwts_low_calloc(const size_t nmemb, const size_t size) > { > size_t n = nmemb * size; > - void *ret; > + void *ret = MAP_FAILED; > fwts_mmap_header *hdr; > > n += sizeof(fwts_mmap_header); > @@ -161,11 +222,13 @@ void *fwts_low_calloc(const size_t nmemb, const size_t size) > /* 32 bit mmap by default */ > ret = mmap(NULL, n, PROT_READ | PROT_WRITE, > MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); > - } else { > - /* We don't have a native MAP_32BIT, so bodge our own */ > - ret = fwts_low_mmap(n); > } > #endif > + /* 32 bit mmap failed, so bodge our own 32 bit mmap */ > + if (ret == MAP_FAILED) > + ret = fwts_low_mmap(n); > + > + /* OK, really can't mmap, give up */ > if (ret == MAP_FAILED) > return NULL; > Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 06:47:12 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 14:47:12 +0800 Subject: ACK: [PATCH] bios: mtrr: fix memory leak on mtrr entries In-Reply-To: <1431603181-7915-1-git-send-email-colin.king@canonical.com> References: <1431603181-7915-1-git-send-email-colin.king@canonical.com> Message-ID: <55680B70.6070202@canonical.com> On 2015?05?14? 19:33, Colin King wrote: > From: Colin Ian King > > CoverityScan picked up a memory leak on the allocated entries that > don't get added to the mttr entry list when they fail specific > filtering criteria. > > Signed-off-by: Colin Ian King > --- > src/bios/mtrr/mtrr.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c > index 8bec28b..c86090f 100644 > --- a/src/bios/mtrr/mtrr.c > +++ b/src/bios/mtrr/mtrr.c > @@ -119,18 +119,24 @@ static int get_mtrrs(void) > */ > > /* Get register, in decimal */ > - if (strncmp(line, "reg", 3)) > + if (strncmp(line, "reg", 3)) { > + free(entry); > continue; > + } > entry->reg = strtoul(line + 3, NULL, 10); > > /* Get base, in hex */ > - if ((ptr1 = strstr(line, "base=0x")) == NULL) > + if ((ptr1 = strstr(line, "base=0x")) == NULL) { > + free(entry); > continue; > + } > entry->start = strtoull(ptr1 + 5, NULL, 16); > > /* Get size, in decimal */ > - if ((ptr1 = strstr(line, "size=")) == NULL) > + if ((ptr1 = strstr(line, "size=")) == NULL) { > + free(entry); > continue; > + } > > entry->size = strtoull(ptr1 + 5, &ptr2, 10); > if (ptr2 && (*ptr2 == 'm')) Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 06:48:27 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 14:48:27 +0800 Subject: ACK: [PATCH] hotkey: only process reads of hotkey events that are at least the correct length In-Reply-To: <1431603197-7965-1-git-send-email-colin.king@canonical.com> References: <1431603197-7965-1-git-send-email-colin.king@canonical.com> Message-ID: <55680BBB.9090007@canonical.com> On 2015?05?14? 19:33, Colin King wrote: > From: Colin Ian King > > Coverity Scan found an issue where the comparison to the event structure was > incorrect when reads were too short in size. > > Signed-off-by: Colin Ian King > --- > src/hotkey/hotkey/hotkey.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/src/hotkey/hotkey/hotkey.c b/src/hotkey/hotkey/hotkey.c > index 6e40df1..28d3ef1 100644 > --- a/src/hotkey/hotkey/hotkey.c > +++ b/src/hotkey/hotkey/hotkey.c > @@ -90,20 +90,20 @@ static int hotkey_test(fwts_framework *fw, char *dev, fwts_list *hotkeys) > } > > while (do_test) { > - switch (read(fd, &ev, sizeof(ev))) { > - case -1: > - case 0: > + ssize_t ret = read(fd, &ev, sizeof(ev)); > + > + if (ret < (ssize_t)sizeof(ev)) { > do_test = 0; > break; > - default: > - if ((ev.type == EV_KEY) && > - (ev.code == KEY_ESC) && > - (ev.value == 0)) > - do_test = 0; > - else > - hotkey_check_key(fw, &ev, hotkeys); > - break; > } > + > + if ((ev.type == EV_KEY) && > + (ev.code == KEY_ESC) && > + (ev.value == 0)) > + do_test = 0; > + else > + hotkey_check_key(fw, &ev, hotkeys); > + break; > } > > if (ioctl(fd, EVIOCGRAB, (void*)0)) { /* Release */ Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 06:49:20 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 14:49:20 +0800 Subject: ACK: [PATCH] lib: fwts_args: use strncpy instead of strcpy In-Reply-To: <1431603206-8013-1-git-send-email-colin.king@canonical.com> References: <1431603206-8013-1-git-send-email-colin.king@canonical.com> Message-ID: <55680BF0.4020005@canonical.com> On 2015?05?14? 19:33, Colin King wrote: > From: Colin Ian King > > Coverity Scan was flagging up the use of strcpy and of a potential > buffer overrun, so use strncpy instead. > > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_args.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/lib/src/fwts_args.c b/src/lib/src/fwts_args.c > index 86e0d4b..5dc9261 100644 > --- a/src/lib/src/fwts_args.c > +++ b/src/lib/src/fwts_args.c > @@ -299,8 +299,8 @@ void fwts_args_show_options(void) > } > } > } > - strcat(ptr, "--"); > - strcat(ptr, option->long_name); > + strncat(ptr, "--", ptr - buffer - 1); > + strncat(ptr, option->long_name, ptr - buffer - 3); > > fwts_args_show_option(width, buffer, option->explanation); > } Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 06:54:23 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 14:54:23 +0800 Subject: ACK: [PATCH] uefi: uefirtvariable: fix incorrect buffer size being passed In-Reply-To: <1431686131-12311-1-git-send-email-colin.king@canonical.com> References: <1431686131-12311-1-git-send-email-colin.king@canonical.com> Message-ID: <55680D1F.5050103@canonical.com> On 2015?05?15? 18:35, Colin King wrote: > From: Colin Ian King > > The existing code passes the size of name, which turns out to be a 4 or > 8 depending on a 32 or 64 bit machine because name is a pointer and not > a buffer. Fix this by making name a variable sized array; this also > allows us to remove the complexity of allocation failure handling too. > > Signed-off-by: Colin Ian King > --- > src/uefi/uefirtvariable/uefirtvariable.c | 19 +++++++------------ > 1 file changed, 7 insertions(+), 12 deletions(-) > > diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c > index 0617ff4..e59e005 100644 > --- a/src/uefi/uefirtvariable/uefirtvariable.c > +++ b/src/uefi/uefirtvariable/uefirtvariable.c > @@ -633,7 +633,6 @@ static int getnextvariable_test3(fwts_framework *fw) > uint64_t maxvariablenamesize = variablenamesize; > uint16_t *variablename; > EFI_GUID vendorguid; > - char *name; > int ret; > > variablename = malloc(sizeof(uint16_t) * variablenamesize); > @@ -730,17 +729,13 @@ static int getnextvariable_test3(fwts_framework *fw) > item->hash = hash_func(variablename, variablenamesize); > > if (bucket_insert(item)) { > - name = malloc(variablenamesize * sizeof(char)); > - if (name) { > - fwts_uefi_str16_to_str(name, sizeof(name), variablename); > - fwts_failed(fw, LOG_LEVEL_HIGH, > - "UEFIRuntimeGetNextVariableName", > - "Duplicate variable name %s found.", name); > - free(name); > - } else > - fwts_failed(fw, LOG_LEVEL_HIGH, > - "UEFIRuntimeGetNextVariableName", > - "Duplicate variable name found (too long name)."); > + char name[variablenamesize]; > + > + fwts_uefi_str16_to_str(name, sizeof(name), variablename); > + fwts_failed(fw, LOG_LEVEL_HIGH, > + "UEFIRuntimeGetNextVariableName", > + "Duplicate variable name %s found.", name); > + > free(item->name); > free(item->guid); > free(item); Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 06:58:45 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 14:58:45 +0800 Subject: ACK: [PATCH] lib: fwts_acpi_tables: enforce stricter table loading checks In-Reply-To: <1431686162-12479-1-git-send-email-colin.king@canonical.com> References: <1431686162-12479-1-git-send-email-colin.king@canonical.com> Message-ID: <55680E25.9030605@canonical.com> On 2015?05?15? 18:36, Colin King wrote: > From: Colin Ian King > > Coverty Scan is warning that malicious or malformed tables being read in > from file could cause problems with the low 32 bit allocator. Add some > stricter checking of the size of the buffer being read and also the total > ACPI table size. ACPI stipulates that the table size is a 32 bit integer > (which is huge), but we need to keep to that maximum upper limit to be > in spec. > > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_acpi_tables.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c > index 81fb096..cca1135 100644 > --- a/src/lib/src/fwts_acpi_tables.c > +++ b/src/lib/src/fwts_acpi_tables.c > @@ -667,6 +667,10 @@ static uint8_t *fwts_acpi_load_table_from_file(const int fd, size_t *length) > } > continue; > } > + if (n > (ssize_t)sizeof(buffer)) > + goto too_big; /* Unlikely */ > + if (size + n > 0xffffffff) > + goto too_big; /* Very unlikely */ > > if ((tmp = (uint8_t*)fwts_low_realloc(ptr, size + n + 1)) == NULL) { > free(ptr); > @@ -678,6 +682,11 @@ static uint8_t *fwts_acpi_load_table_from_file(const int fd, size_t *length) > } > *length = size; > return ptr; > + > +too_big: > + free(ptr); > + *length = 0; > + return NULL; > } > > /* Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 07:00:34 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 15:00:34 +0800 Subject: ACK: [PATCH] lib: acpica: explicitly set buffer to NULL to remove cppcheck warning In-Reply-To: <1431686184-12609-1-git-send-email-colin.king@canonical.com> References: <1431686184-12609-1-git-send-email-colin.king@canonical.com> Message-ID: <55680E92.3050601@canonical.com> On 2015?05?15? 18:36, Colin King wrote: > From: Colin Ian King > > cppcheck isn't quite so smart as CoverityScan so it continues to complain > about a potential free issue as a false positive. I've taken the liberty > to explicity set buffer to NULL to make the code clearer and this helps > cppcheck to understand the flow of control better. > > Signed-off-by: Colin Ian King > --- > src/acpica/fwts_acpica.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c > index 4a6baf6..9bfd0ae 100644 > --- a/src/acpica/fwts_acpica.c > +++ b/src/acpica/fwts_acpica.c > @@ -452,8 +452,10 @@ void fwts_acpica_vprintf(const char *fmt, va_list args) > buffer = malloc(buffer_len); > if (buffer) > strcpy(buffer, tmp); > - else > + else { > + buffer = NULL; > buffer_len = 0; > + } > } else { > char *new_buf; > > @@ -464,11 +466,12 @@ void fwts_acpica_vprintf(const char *fmt, va_list args) > strcat(buffer, tmp); > } else { > free(buffer); > + buffer = NULL; > buffer_len = 0; > } > } > > - if (buffer_len && index(buffer, '\n') != NULL) { > + if (buffer && index(buffer, '\n') != NULL) { > fwts_log_info(fwts_acpica_fw, "%s", buffer); > free(buffer); > buffer_len = 0; Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 07:01:45 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 15:01:45 +0800 Subject: ACK: [PATCH] acpi: battery: clean up source, no functional change In-Reply-To: <1431686206-12752-1-git-send-email-colin.king@canonical.com> References: <1431686206-12752-1-git-send-email-colin.king@canonical.com> Message-ID: <55680ED9.70203@canonical.com> On 2015?05?15? 18:36, Colin King wrote: > From: Colin Ian King > > cppcheck was complaining about being able to reduce the scope > of new_variable: > > [src/acpi/battery/battery.c:157]: (style) The scope of the > variable 'new_value' can be reduced. > > ..so move the declaration. Also re-format the spacing in > an ancient for loop > > Signed-off-by: Colin Ian King > --- > src/acpi/battery/battery.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/acpi/battery/battery.c b/src/acpi/battery/battery.c > index d216b32..bd4e257 100644 > --- a/src/acpi/battery/battery.c > +++ b/src/acpi/battery/battery.c > @@ -154,14 +154,15 @@ static void check_discharging(fwts_framework *fw, int index, char *name) > { > int i; > /* when we get here we KNOW the state is "discharging" */ > - uint32_t initial_value, new_value; > + uint32_t initial_value; > > fwts_printf(fw, "==== Waiting to see if battery '%s' discharges ====\n", name); > fwts_cpu_consume_start(); > > initial_value = get_full(fw, index); > - for (i=0; i<=120; i++) { > - new_value = get_full(fw, index); > + for (i = 0; i <= 120; i++) { > + uint32_t new_value = get_full(fw, index); > + > if (new_value fwts_passed(fw, "Battery %s charge is decrementing as expected.", name); > fwts_cpu_consume_complete(); Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 07:05:04 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 15:05:04 +0800 Subject: ACK: [PATCH] acpica: fwts_iasl_interface: clean up static analyzer warning on freopen In-Reply-To: <1431686236-12917-1-git-send-email-colin.king@canonical.com> References: <1431686236-12917-1-git-send-email-colin.king@canonical.com> Message-ID: <55680FA0.9010202@canonical.com> On 2015?05?15? 18:37, Colin King wrote: > From: Colin Ian King > > cppcheck is being a bit overly zealous: > > [src/acpica/source/compiler/fwts_iasl_interface.c:114]: > (error) Return value of allocation function freopen is not stored. > > ..but we may as well assign a file pointer to the freopen() call and > explicitly close it before calling _exit() just to make things a little > clearer to cppcheck > > Signed-off-by: Colin Ian King > --- > src/acpica/source/compiler/fwts_iasl_interface.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/acpica/source/compiler/fwts_iasl_interface.c b/src/acpica/source/compiler/fwts_iasl_interface.c > index 56dc76e..68338c9 100644 > --- a/src/acpica/source/compiler/fwts_iasl_interface.c > +++ b/src/acpica/source/compiler/fwts_iasl_interface.c > @@ -71,13 +71,13 @@ int fwts_iasl_disassemble_aml( > { > pid_t pid; > int status, i; > + FILE *fp; > > pid = fork(); > switch (pid) { > case -1: > return -1; > case 0: > - > /* Child */ > init_asl_core(); > > @@ -111,9 +111,10 @@ int fwts_iasl_disassemble_aml( > } > > /* Throw away noisy errors */ > - if (freopen("/dev/null", "w", stderr) != NULL) > + if ((fp = freopen("/dev/null", "w", stderr)) != NULL) { > AslDoOneFile((char *)tables[which]); > - > + fclose(fp); > + } > _exit(0); > break; > default: Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 07:06:06 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 15:06:06 +0800 Subject: ACK: [PATCH] ACPICA: Update version to 20150515 (LP: #1455946) In-Reply-To: <1431880659-8497-1-git-send-email-colin.king@canonical.com> References: <1431880659-8497-1-git-send-email-colin.king@canonical.com> Message-ID: <55680FDE.3070700@canonical.com> On 2015?05?18? 00:37, Colin King wrote: > From: Colin Ian King > > Update to ACPICA 20150515, for changes since the previous > release incorporated in fwts please refer to the follwing: > > https://lists.acpica.org/pipermail/devel/2015-May/000707.html > > Signed-off-by: Colin Ian King > --- > src/acpica/Makefile.am | 1 + > src/acpica/source/common/adisasm.c | 17 +- > src/acpica/source/common/ahpredef.c | 11 +- > src/acpica/source/common/ahtable.c | 222 ++++++ > src/acpica/source/common/dmextern.c | 14 +- > src/acpica/source/common/dmtable.c | 260 ++++--- > src/acpica/source/common/dmtbdump.c | 736 ++++++++++++++++++- > src/acpica/source/common/dmtbinfo.c | 486 +++++++++++- > src/acpica/source/compiler/aslascii.c | 38 +- > src/acpica/source/compiler/aslcompiler.h | 1 - > src/acpica/source/compiler/aslcompiler.l | 15 +- > src/acpica/source/compiler/asldefine.h | 2 +- > src/acpica/source/compiler/aslfiles.c | 32 +- > src/acpica/source/compiler/aslmessages.c | 5 +- > src/acpica/source/compiler/aslmessages.h | 1 + > src/acpica/source/compiler/aslprepkg.c | 56 +- > src/acpica/source/compiler/aslstartup.c | 4 +- > src/acpica/source/compiler/aslutils.c | 22 +- > src/acpica/source/compiler/dtcompile.c | 75 +- > src/acpica/source/compiler/dtcompiler.h | 36 +- > src/acpica/source/compiler/dtio.c | 12 +- > src/acpica/source/compiler/dtsubtable.c | 5 + > src/acpica/source/compiler/dttable.c | 815 ++++++++++++++++++++- > src/acpica/source/compiler/dttemplate.c | 8 +- > src/acpica/source/compiler/dttemplate.h | 265 +++++-- > src/acpica/source/compiler/dtutils.c | 7 + > src/acpica/source/compiler/preprocess.h | 10 +- > src/acpica/source/compiler/prscan.c | 185 ++++- > src/acpica/source/compiler/prutils.c | 29 +- > src/acpica/source/components/debugger/dbfileio.c | 18 +- > src/acpica/source/components/debugger/dbinput.c | 2 +- > src/acpica/source/components/dispatcher/dsmethod.c | 6 +- > src/acpica/source/components/hardware/hwpci.c | 9 +- > src/acpica/source/components/namespace/nsprepkg.c | 13 + > src/acpica/source/components/namespace/nsrepair.c | 2 +- > src/acpica/source/components/parser/psopinfo.c | 3 - > src/acpica/source/components/utilities/utfileio.c | 9 +- > src/acpica/source/components/utilities/uthex.c | 4 +- > src/acpica/source/components/utilities/utxferror.c | 12 +- > src/acpica/source/include/acdebug.h | 3 +- > src/acpica/source/include/acdisasm.h | 81 +- > src/acpica/source/include/aclocal.h | 19 + > src/acpica/source/include/acparser.h | 3 + > src/acpica/source/include/acpixf.h | 2 +- > src/acpica/source/include/acpredef.h | 44 +- > src/acpica/source/include/actbl.h | 17 +- > src/acpica/source/include/actbl1.h | 207 +++++- > src/acpica/source/include/actbl2.h | 174 ++++- > src/acpica/source/include/actbl3.h | 104 ++- > src/acpica/source/include/actypes.h | 1 + > src/acpica/source/include/acutils.h | 2 +- > src/acpica/source/include/platform/acenv.h | 3 + > src/acpica/source/include/platform/acenvex.h | 3 + > 53 files changed, 3720 insertions(+), 391 deletions(-) > create mode 100644 src/acpica/source/common/ahtable.c > > diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am > index 80e6bc3..66bc1af 100644 > --- a/src/acpica/Makefile.am > +++ b/src/acpica/Makefile.am > @@ -246,6 +246,7 @@ libfwtsacpica_la_SOURCES = \ > source/common/acgetline.c \ > source/common/ahids.c \ > source/common/cmfsize.c \ > + source/common/ahtable.c \ > source/common/ahuuids.c \ > source/tools/acpiexec/aeinitfile.c \ > source/tools/acpiexec/aehandlers.c \ > diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c > index 53abd15..8ee9ccc 100644 > --- a/src/acpica/source/common/adisasm.c > +++ b/src/acpica/source/common/adisasm.c > @@ -286,6 +286,7 @@ AdAmlDisassemble ( > char **OutFilename) > { > ACPI_STATUS Status; > + ACPI_STATUS GlobalStatus = AE_OK; > char *DisasmFilename = NULL; > char *ExternalFilename; > ACPI_EXTERNAL_FILE *ExternalFileList = AcpiGbl_ExternalFileList; > @@ -301,7 +302,7 @@ AdAmlDisassemble ( > */ > if (Filename) > { > - Status = AcpiDbGetTableFromFile (Filename, &Table); > + Status = AcpiDbGetTableFromFile (Filename, &Table, FALSE); > if (ACPI_FAILURE (Status)) > { > return (Status); > @@ -322,9 +323,16 @@ AdAmlDisassemble ( > continue; > } > > - Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable); > + Status = AcpiDbGetTableFromFile (ExternalFilename, &ExternalTable, TRUE); > if (ACPI_FAILURE (Status)) > { > + if (Status == AE_TYPE) > + { > + ExternalFileList = ExternalFileList->Next; > + GlobalStatus = AE_TYPE; > + Status = AE_OK; > + continue; > + } > return (Status); > } > > @@ -354,6 +362,11 @@ AdAmlDisassemble ( > ExternalFileList = ExternalFileList->Next; > } > > + if (ACPI_FAILURE (GlobalStatus)) > + { > + return (GlobalStatus); > + } > + > /* Clear external list generated by Scope in external tables */ > > if (AcpiGbl_ExternalFileList) > diff --git a/src/acpica/source/common/ahpredef.c b/src/acpica/source/common/ahpredef.c > index 57e7279..27c28f1 100644 > --- a/src/acpica/source/common/ahpredef.c > +++ b/src/acpica/source/common/ahpredef.c > @@ -166,6 +166,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = > AH_PREDEF ("_BMS", "Battery Measurement Sampling Time", "Sets the battery measurement sampling time"), > AH_PREDEF ("_BQC", "Brightness Query Current", "Returns the current display brightness level"), > AH_PREDEF ("_BST", "Battery Status", "Returns a Control Method Battery status block"), > + AH_PREDEF ("_BTH", "Battery Throttle Limit", "Thermal limit for charging and discharging"), > AH_PREDEF ("_BTM", "Battery Time", "Returns the battery runtime"), > AH_PREDEF ("_BTP", "Battery Trip Point", "Sets a Control Method Battery trip point"), > AH_PREDEF ("_CBA", "Configuration Base Address", "Sets the base address for a PCI Express host bridge"), > @@ -174,6 +175,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = > AH_PREDEF ("_CID", "Compatible ID", "Returns a device's Plug and Play Compatible ID list"), > AH_PREDEF ("_CLS", "Class Code", "Returns PCI class code and subclass"), > AH_PREDEF ("_CPC", "Continuous Performance Control", "Returns a list of performance control interfaces"), > + AH_PREDEF ("_CR3", "Warm/Standby Temperature", "Temperature for a fast low power state"), > AH_PREDEF ("_CRS", "Current Resource Settings", "Returns the current resource settings for a device"), > AH_PREDEF ("_CRT", "Critical Temperature", "Returns the shutdown critical temperature"), > AH_PREDEF ("_CSD", "C-State Dependencies", "Returns a list of C-state dependencies"), > @@ -247,6 +249,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = > AH_PREDEF ("_LIN", "Lines In Use", "Handshake lines, Resource Descriptor field"), > AH_PREDEF ("_LL_", "Low Level", "Interrupt polarity, Resource Descriptor field"), > AH_PREDEF ("_LPD", "Low Power Dependencies", "Returns a list of dependencies for low power idle entry"), > + AH_PREDEF ("_LPI", "Low Power Idle States", "Returns a list of supported low power idle states"), > AH_PREDEF ("_MAF", "Maximum Address Fixed", "Resource Descriptor field"), > AH_PREDEF ("_MAT", "Multiple APIC Table Entry", "Returns a list of MADT APIC structure entries"), > AH_PREDEF ("_MAX", "Maximum Base Address", "Resource Descriptor field"), > @@ -258,6 +261,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = > AH_PREDEF ("_MOD", "Mode", "Interrupt mode, Resource Descriptor field"), > AH_PREDEF ("_MSG", "Message", "Sets the system message waiting status indicator"), > AH_PREDEF ("_MSM", "Memory Set Monitoring", "Sets bandwidth monitoring parameters for a memory device"), > + AH_PREDEF ("_MTL", "Minimum Throttle Limit", "Returns the minimum throttle limit for a thermal zone"), > AH_PREDEF ("_MTP", "Memory Type", "Resource Descriptor field"), > AH_PREDEF ("_NTT", "Notification Temperature Threshold", "Returns a threshold for device temperature change that requires platform notification"), > AH_PREDEF ("_OFF", "Power Off", "Sets a power resource to the off state"), > @@ -281,7 +285,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = > AH_PREDEF ("_PMD", "Power Metered Devices", "Returns a list of devices that are measured by the power meter device"), > AH_PREDEF ("_PMM", "Power Meter Measurement", "Returns the current value of the Power Meter"), > AH_PREDEF ("_POL", "Polarity", "Interrupt polarity, Resource Descriptor field"), > - AH_PREDEF ("_PPC", "Performance Present Capabilites", "Returns a list of the performance states currently supported by the platform"), > + AH_PREDEF ("_PPC", "Performance Present Capabilities", "Returns a list of the performance states currently supported by the platform"), > AH_PREDEF ("_PPE", "Polling for Platform Error", "Returns the polling interval to retrieve Corrected Platform Error information"), > AH_PREDEF ("_PPI", "Pin Configuration", "Resource Descriptor field"), > AH_PREDEF ("_PR", "Processor", "Predefined scope for processor objects"), > @@ -291,6 +295,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = > AH_PREDEF ("_PR3", "Power Resources for D3hot", "Returns a list of dependent power resources to enter state D3hot"), > AH_PREDEF ("_PRE", "Power Resources for Enumeration", "Returns a list of dependent power resources to enumerate devices on a bus"), > AH_PREDEF ("_PRL", "Power Source Redundancy List", "Returns a list of power source devices in the same redundancy grouping"), > + AH_PREDEF ("_PRR", "Power Resource for Reset", "Execute a reset on a device"), > AH_PREDEF ("_PRS", "Possible Resource Settings", "Returns a list of a device's possible resource settings"), > AH_PREDEF ("_PRT", "PCI Routing Table", "Returns a list of PCI interrupt mappings"), > AH_PREDEF ("_PRW", "Power Resources for Wake", "Returns a list of dependent power resources for waking"), > @@ -314,10 +319,12 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = > AH_PREDEF ("_Qxx", "EC Query", "Embedded Controller query and SMBus Alarm control method"), > AH_PREDEF ("_RBO", "Register Bit Offset", "Resource Descriptor field"), > AH_PREDEF ("_RBW", "Register Bit Width", "Resource Descriptor field"), > + AH_PREDEF ("_RDI", "Resource Dependencies for Idle", "Returns a list of dependencies for idle states"), > AH_PREDEF ("_REG", "Region Availability", "Inform AML code of an operation region availability change"), > AH_PREDEF ("_REV", "Supported ACPI Revision", "Returns the revision of the ACPI specification that is implemented"), > AH_PREDEF ("_RMV", "Removal Status", "Returns a device's removal ability status (docking)"), > AH_PREDEF ("_RNG", "Range", "Memory range type, Resource Descriptor field"), > + AH_PREDEF ("_RST", "Device Reset", "Executes a reset on a device"), > AH_PREDEF ("_ROM", "Read-Only Memory", "Returns a copy of the ROM data for a display device"), > AH_PREDEF ("_RT_", "Resource Type", "Resource Descriptor field"), > AH_PREDEF ("_RTV", "Relative Temperature Values", "Returns temperature value information"), > @@ -368,6 +375,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = > AH_PREDEF ("_TC1", "Thermal Constant 1", "Returns TC1 for the passive cooling formula"), > AH_PREDEF ("_TC2", "Thermal Constant 2", "Returns TC2 for the passive cooling formula"), > AH_PREDEF ("_TDL", "T-State Depth Limit", "Returns the _TSS entry number of the lowest power throttling state"), > + AH_PREDEF ("_TFP", "Thermal Fast Sampling Period", "Returns the sampling period for passive cooling"), > AH_PREDEF ("_TIP", "Expired Timer Wake Policy", "Returns timer policies of the wake alarm device"), > AH_PREDEF ("_TIV", "Timer Values", "Returns remaining time of the wake alarm device"), > AH_PREDEF ("_TMP", "Temperature", "Returns a thermal zone's current temperature"), > @@ -378,6 +386,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = > AH_PREDEF ("_TRT", "Thermal Relationship Table", "Returns thermal relationships between platform devices"), > AH_PREDEF ("_TSD", "Throttling State Dependencies", "Returns a list of T-state dependencies"), > AH_PREDEF ("_TSF", "Type-Specific Flags", "Resource Descriptor field"), > + AH_PREDEF ("_TSN", "Thermal Sensor Device", "Returns a reference to a thermal sensor"), > AH_PREDEF ("_TSP", "Thermal Sampling Period", "Returns the thermal sampling period for passive cooling"), > AH_PREDEF ("_TSS", "Throttling Supported States", "Returns supported throttling state information"), > AH_PREDEF ("_TST", "Temperature Sensor Threshold", "Returns the minimum separation for a device's temperature trip points"), > diff --git a/src/acpica/source/common/ahtable.c b/src/acpica/source/common/ahtable.c > new file mode 100644 > index 0000000..e5e065d > --- /dev/null > +++ b/src/acpica/source/common/ahtable.c > @@ -0,0 +1,222 @@ > +/****************************************************************************** > + * > + * Module Name: ahtable - Table of known ACPI tables with descriptions > + * > + *****************************************************************************/ > + > +/****************************************************************************** > + * > + * 1. Copyright Notice > + * > + * Some or all of this work - Copyright (c) 1999 - 2015, Intel Corp. > + * All rights reserved. > + * > + * 2. License > + * > + * 2.1. This is your license from Intel Corp. under its intellectual property > + * rights. You may have additional license terms from the party that provided > + * you this software, covering your right to use that party's intellectual > + * property rights. > + * > + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a > + * copy of the source code appearing in this file ("Covered Code") an > + * irrevocable, perpetual, worldwide license under Intel's copyrights in the > + * base code distributed originally by Intel ("Original Intel Code") to copy, > + * make derivatives, distribute, use and display any portion of the Covered > + * Code in any form, with the right to sublicense such rights; and > + * > + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent > + * license (with the right to sublicense), under only those claims of Intel > + * patents that are infringed by the Original Intel Code, to make, use, sell, > + * offer to sell, and import the Covered Code and derivative works thereof > + * solely to the minimum extent necessary to exercise the above copyright > + * license, and in no event shall the patent license extend to any additions > + * to or modifications of the Original Intel Code. No other license or right > + * is granted directly or by implication, estoppel or otherwise; > + * > + * The above copyright and patent license is granted only if the following > + * conditions are met: > + * > + * 3. Conditions > + * > + * 3.1. Redistribution of Source with Rights to Further Distribute Source. > + * Redistribution of source code of any substantial portion of the Covered > + * Code or modification with rights to further distribute source must include > + * the above Copyright Notice, the above License, this list of Conditions, > + * and the following Disclaimer and Export Compliance provision. In addition, > + * Licensee must cause all Covered Code to which Licensee contributes to > + * contain a file documenting the changes Licensee made to create that Covered > + * Code and the date of any change. Licensee must include in that file the > + * documentation of any changes made by any predecessor Licensee. Licensee > + * must include a prominent statement that the modification is derived, > + * directly or indirectly, from Original Intel Code. > + * > + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. > + * Redistribution of source code of any substantial portion of the Covered > + * Code or modification without rights to further distribute source must > + * include the following Disclaimer and Export Compliance provision in the > + * documentation and/or other materials provided with distribution. In > + * addition, Licensee may not authorize further sublicense of source of any > + * portion of the Covered Code, and must include terms to the effect that the > + * license from Licensee to its licensee is limited to the intellectual > + * property embodied in the software Licensee provides to its licensee, and > + * not to intellectual property embodied in modifications its licensee may > + * make. > + * > + * 3.3. Redistribution of Executable. Redistribution in executable form of any > + * substantial portion of the Covered Code or modification must reproduce the > + * above Copyright Notice, and the following Disclaimer and Export Compliance > + * provision in the documentation and/or other materials provided with the > + * distribution. > + * > + * 3.4. Intel retains all right, title, and interest in and to the Original > + * Intel Code. > + * > + * 3.5. Neither the name Intel nor any other trademark owned or controlled by > + * Intel shall be used in advertising or otherwise to promote the sale, use or > + * other dealings in products derived from or relating to the Covered Code > + * without prior written authorization from Intel. > + * > + * 4. Disclaimer and Export Compliance > + * > + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED > + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE > + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, > + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY > + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY > + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A > + * PARTICULAR PURPOSE. > + * > + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES > + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR > + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, > + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY > + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL > + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS > + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY > + * LIMITED REMEDY. > + * > + * 4.3. Licensee shall not export, either directly or indirectly, any of this > + * software or system incorporating such software without first obtaining any > + * required license or other approval from the U. S. Department of Commerce or > + * any other agency or department of the United States Government. In the > + * event Licensee exports any such software from the United States or > + * re-exports any such software from a foreign destination, Licensee shall > + * ensure that the distribution and export/re-export of the software is in > + * compliance with all laws, regulations, orders, or other restrictions of the > + * U.S. Export Administration Regulations. Licensee agrees that neither it nor > + * any of its subsidiaries will export/re-export any technical data, process, > + * software, or service, directly or indirectly, to any country for which the > + * United States government or any agency thereof requires an export license, > + * other governmental approval, or letter of assurance, without first obtaining > + * such license, approval or letter. > + * > + *****************************************************************************/ > + > +#include "acpi.h" > +#include "accommon.h" > + > + > +/* Local prototypes */ > + > +const AH_TABLE * > +AcpiAhGetTableInfo ( > + char *Signature); > + > +extern const AH_TABLE AcpiSupportedTables[]; > + > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiAhGetTableInfo > + * > + * PARAMETERS: Signature - ACPI signature (4 chars) to match > + * > + * RETURN: Pointer to a valid AH_TABLE. Null if no match found. > + * > + * DESCRIPTION: Find a match in the "help" table of supported ACPI tables > + * > + ******************************************************************************/ > + > +const AH_TABLE * > +AcpiAhGetTableInfo ( > + char *Signature) > +{ > + const AH_TABLE *Info; > + > + > + for (Info = AcpiSupportedTables; Info->Signature; Info++) > + { > + if (ACPI_COMPARE_NAME (Signature, Info->Signature)) > + { > + return (Info); > + } > + } > + > + return (NULL); > +} > + > + > +/* > + * Note: Any tables added here should be duplicated within AcpiDmTableData > + * in the file common/dmtable.c > + */ > +const AH_TABLE AcpiSupportedTables[] = > +{ > + {ACPI_SIG_ASF, "Alert Standard Format table"}, > + {ACPI_SIG_BERT, "Boot Error Record Table"}, > + {ACPI_SIG_BGRT, "Boot Graphics Resource Table"}, > + {ACPI_SIG_BOOT, "Simple Boot Flag Table"}, > + {ACPI_SIG_CPEP, "Corrected Platform Error Polling table"}, > + {ACPI_SIG_CSRT, "Core System Resource Table"}, > + {ACPI_SIG_DBG2, "Debug Port table type 2"}, > + {ACPI_SIG_DBGP, "Debug Port table"}, > + {ACPI_SIG_DMAR, "DMA Remapping table"}, > + {ACPI_SIG_DRTM, "Dynamic Root of Trust for Measurement table"}, > + {ACPI_SIG_DSDT, "Differentiated System Description Table (AML table)"}, > + {ACPI_SIG_ECDT, "Embedded Controller Boot Resources Table"}, > + {ACPI_SIG_EINJ, "Error Injection table"}, > + {ACPI_SIG_ERST, "Error Record Serialization Table"}, > + {ACPI_SIG_FACS, "Firmware ACPI Control Structure"}, > + {ACPI_SIG_FADT, "Fixed ACPI Description Table (FADT)"}, > + {ACPI_SIG_FPDT, "Firmware Performance Data Table"}, > + {ACPI_SIG_GTDT, "Generic Timer Description Table"}, > + {ACPI_SIG_HEST, "Hardware Error Source Table"}, > + {ACPI_SIG_HPET, "High Precision Event Timer table"}, > + {ACPI_SIG_IORT, "IO Remapping Table"}, > + {ACPI_SIG_IVRS, "I/O Virtualization Reporting Structure"}, > + {ACPI_SIG_LPIT, "Low Power Idle Table"}, > + {ACPI_SIG_MADT, "Multiple APIC Description Table (MADT)"}, > + {ACPI_SIG_MCFG, "Memory Mapped Configuration table"}, > + {ACPI_SIG_MCHI, "Management Controller Host Interface table"}, > + {ACPI_SIG_MPST, "Memory Power State Table"}, > + {ACPI_SIG_MSCT, "Maximum System Characteristics Table"}, > + {ACPI_SIG_MSDM, "Microsoft Data Management table"}, > + {ACPI_SIG_MTMR, "MID Timer Table"}, > + {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, > + {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, > + {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, > + {ACPI_RSDP_NAME,"Root System Description Pointer"}, > + {ACPI_SIG_RSDT, "Root System Description Table"}, > + {ACPI_SIG_S3PT, "S3 Performance Table"}, > + {ACPI_SIG_SBST, "Smart Battery Specification Table"}, > + {ACPI_SIG_SLIC, "Software Licensing Description Table"}, > + {ACPI_SIG_SLIT, "System Locality Information Table"}, > + {ACPI_SIG_SPCR, "Serial Port Console Redirection table"}, > + {ACPI_SIG_SPMI, "Server Platform Management Interface table"}, > + {ACPI_SIG_SRAT, "System Resource Affinity Table"}, > + {ACPI_SIG_SSDT, "Secondary System Description Table (AML table)"}, > + {ACPI_SIG_STAO, "Status Override table"}, > + {ACPI_SIG_TCPA, "Trusted Computing Platform Alliance table"}, > + {ACPI_SIG_TPM2, "Trusted Platform Module hardware interface table"}, > + {ACPI_SIG_UEFI, "UEFI Boot Optimization Table"}, > + {ACPI_SIG_VRTC, "Virtual Real-Time Clock Table"}, > + {ACPI_SIG_WAET, "Windows ACPI Emulated Devices Table"}, > + {ACPI_SIG_WDAT, "Watchdog Action Table"}, > + {ACPI_SIG_WDDT, "Watchdog Description Table"}, > + {ACPI_SIG_WDRT, "Watchdog Resource Table"}, > + {ACPI_SIG_WPBT, "Windows Platform Binary Table"}, > + {ACPI_SIG_XENV, "Xen Environment table"}, > + {ACPI_SIG_XSDT, "Extended System Description Table"}, > + {NULL, NULL} > +}; > diff --git a/src/acpica/source/common/dmextern.c b/src/acpica/source/common/dmextern.c > index 72397f0..dc3c8b4 100644 > --- a/src/acpica/source/common/dmextern.c > +++ b/src/acpica/source/common/dmextern.c > @@ -1358,7 +1358,9 @@ AcpiDmUnresolvedWarning ( > " * compile because the disassembler did not know how many arguments\n" > " * to assign to these methods. To specify the tables needed to resolve\n" > " * external control method references, the -e option can be used to\n" > - " * specify the filenames. Example iASL invocations:\n" > + " * specify the filenames. Note: SSDTs can be dynamically loaded at\n" > + " * runtime and may or may not be available via the host OS.\n" > + " * Example iASL invocations:\n" > " * iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" > " * iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" > " * iasl -e ssdt*.aml -d dsdt.aml\n" > @@ -1386,7 +1388,8 @@ AcpiDmUnresolvedWarning ( > " * ACPI tables may be required to properly disassemble the code. This\n" > " * resulting disassembler output file may not compile because the\n" > " * disassembler did not know how many arguments to assign to the\n" > - " * unresolved methods.\n" > + " * unresolved methods. Note: SSDTs can be dynamically loaded at\n" > + " * runtime and may or may not be available via the host OS.\n" > " *\n" > " * If necessary, the -fe option can be used to specify a file containing\n" > " * control method external declarations with the associated method\n" > @@ -1417,7 +1420,9 @@ AcpiDmUnresolvedWarning ( > "compile because the disassembler did not know how many arguments\n" > "to assign to these methods. To specify the tables needed to resolve\n" > "external control method references, the -e option can be used to\n" > - "specify the filenames. Example iASL invocations:\n" > + "specify the filenames. Note: SSDTs can be dynamically loaded at\n" > + "runtime and may or may not be available via the host OS.\n" > + "Example iASL invocations:\n" > " iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" > " iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" > " iasl -e ssdt*.aml -d dsdt.aml\n" > @@ -1440,7 +1445,8 @@ AcpiDmUnresolvedWarning ( > "ACPI tables may be required to properly disassemble the code. The\n" > "resulting disassembler output file may not compile because the\n" > "disassembler did not know how many arguments to assign to the\n" > - "unresolved methods.\n" > + "unresolved methods. Note: SSDTs can be dynamically loaded at\n" > + "runtime and may or may not be available via the host OS.\n" > "\n" > "If necessary, the -fe option can be used to specify a file containing\n" > "control method external declarations with the associated method\n" > diff --git a/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c > index ca165df..6397abe 100644 > --- a/src/acpica/source/common/dmtable.c > +++ b/src/acpica/source/common/dmtable.c > @@ -125,6 +125,11 @@ > #define _COMPONENT ACPI_CA_DISASSEMBLER > ACPI_MODULE_NAME ("dmtable") > > +const AH_TABLE * > +AcpiAhGetTableInfo ( > + char *Signature); > + > + > /* Local Prototypes */ > > static void > @@ -150,7 +155,7 @@ static const char *AcpiDmAsfSubnames[] = > "ASF Remote Control", > "ASF RMCP Boot Options", > "ASF Address", > - "Unknown SubTable Type" /* Reserved */ > + "Unknown Subtable Type" /* Reserved */ > }; > > static const char *AcpiDmDmarSubnames[] = > @@ -160,7 +165,7 @@ static const char *AcpiDmDmarSubnames[] = > "Root Port ATS Capability", > "Remapping Hardware Static Affinity", > "ACPI Namespace Device Declaration", > - "Unknown SubTable Type" /* Reserved */ > + "Unknown Subtable Type" /* Reserved */ > }; > > static const char *AcpiDmDmarScope[] = > @@ -248,7 +253,7 @@ static const char *AcpiDmGtdtSubnames[] = > { > "Generic Timer Block", > "Generic Watchdog Timer", > - "Unknown SubTable Type" /* Reserved */ > + "Unknown Subtable Type" /* Reserved */ > }; > > static const char *AcpiDmHestSubnames[] = > @@ -263,7 +268,7 @@ static const char *AcpiDmHestSubnames[] = > "PCI Express AER (AER Endpoint)", > "PCI Express/PCI-X Bridge AER", > "Generic Hardware Error Source", > - "Unknown SubTable Type" /* Reserved */ > + "Unknown Subtable Type" /* Reserved */ > }; > > static const char *AcpiDmHestNotifySubnames[] = > @@ -295,14 +300,27 @@ static const char *AcpiDmMadtSubnames[] = > "Generic Interrupt Distributor", /* ACPI_MADT_GENERIC_DISTRIBUTOR */ > "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */ > "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */ > - "Unknown SubTable Type" /* Reserved */ > + "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */ > + "Unknown Subtable Type" /* Reserved */ > +}; > + > +static const char *AcpiDmNfitSubnames[] = > +{ > + "System Physical Address Range", /* ACPI_NFIT_TYPE_SYSTEM_ADDRESS */ > + "Memory Range Map", /* ACPI_NFIT_TYPE_MEMORY_MAP */ > + "Interleave Info", /* ACPI_NFIT_TYPE_INTERLEAVE */ > + "SMBIOS Information", /* ACPI_NFIT_TYPE_SMBIOS */ > + "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */ > + "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */ > + "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */ > + "Unknown Subtable Type" /* Reserved */ > }; > > static const char *AcpiDmPcctSubnames[] = > { > "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */ > - "HW-Reduced Communications Subspace", > - "Unknown SubTable Type" /* Reserved */ > + "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */ > + "Unknown Subtable Type" /* Reserved */ > }; > > static const char *AcpiDmPmttSubnames[] = > @@ -310,7 +328,7 @@ static const char *AcpiDmPmttSubnames[] = > "Socket", /* ACPI_PMTT_TYPE_SOCKET */ > "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */ > "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ > - "Unknown SubTable Type" /* Reserved */ > + "Unknown Subtable Type" /* Reserved */ > }; > > static const char *AcpiDmSratSubnames[] = > @@ -319,21 +337,20 @@ static const char *AcpiDmSratSubnames[] = > "Memory Affinity", > "Processor Local x2APIC Affinity", > "GICC Affinity", > - "Unknown SubTable Type" /* Reserved */ > + "Unknown Subtable Type" /* Reserved */ > }; > > static const char *AcpiDmIvrsSubnames[] = > { > "Hardware Definition Block", > "Memory Definition Block", > - "Unknown SubTable Type" /* Reserved */ > + "Unknown Subtable Type" /* Reserved */ > }; > > static const char *AcpiDmLpitSubnames[] = > { > "Native C-state Idle Structure", > - "Simple I/O Idle Structure", > - "Unknown SubTable Type" /* Reserved */ > + "Unknown Subtable Type" /* Reserved */ > }; > > #define ACPI_FADT_PM_RESERVED 9 > @@ -376,56 +393,65 @@ static const char *AcpiDmGasAccessWidth[] = > * handler. This table must be NULL terminated. RSDP and FACS are > * special-cased elsewhere. > * > + * Note: Any tables added here should be duplicated within AcpiSupportedTables > + * in the file common/ahtable.c > + * > ******************************************************************************/ > > -ACPI_DMTABLE_DATA AcpiDmTableData[] = > +const ACPI_DMTABLE_DATA AcpiDmTableData[] = > { > - {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"}, > - {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"}, > - {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt, "Boot Graphics Resource Table"}, > - {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"}, > - {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"}, > - {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt, "Core System Resource Table"}, > - {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2, "Debug Port table type 2"}, > - {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"}, > - {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"}, > - {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"}, > - {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"}, > - {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"}, > - {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table (FADT)"}, > - {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt, "Firmware Performance Data Table"}, > - {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt, "Generic Timer Description Table"}, > - {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"}, > - {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"}, > - {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"}, > - {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit, "Low Power Idle Table"}, > - {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table (MADT)"}, > - {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"}, > - {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"}, > - {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst, "Memory Power State Table"}, > - {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"}, > - {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm, "Microsoft Data Management table"}, > - {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr, "MID Timer Table"}, > - {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct, "Platform Communications Channel Table"}, > - {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt, "Platform Memory Topology Table"}, > - {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"}, > - {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt, "S3 Performance Table"}, > - {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"}, > - {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic, "Software Licensing Description Table"}, > - {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"}, > - {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"}, > - {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"}, > - {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"}, > - {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"}, > - {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2, "Trusted Platform Module hardware interface table"}, > - {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi, "UEFI Boot Optimization Table"}, > - {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc, "Virtual Real-Time Clock Table"}, > - {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"}, > - {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"}, > - {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"}, > - {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt, "Watchdog Resource Table"}, > - {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt, "Extended System Description Table"}, > - {NULL, NULL, NULL, NULL, NULL, NULL} > + {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf}, > + {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert}, > + {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt}, > + {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot}, > + {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep}, > + {ACPI_SIG_CSRT, NULL, AcpiDmDumpCsrt, DtCompileCsrt, TemplateCsrt}, > + {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2, AcpiDmDumpDbg2, DtCompileDbg2, TemplateDbg2}, > + {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp}, > + {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar}, > + {ACPI_SIG_DRTM, NULL, AcpiDmDumpDrtm, DtCompileDrtm, TemplateDrtm}, > + {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt}, > + {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj}, > + {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst}, > + {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt}, > + {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt}, > + {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt}, > + {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest}, > + {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet}, > + {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort}, > + {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs}, > + {ACPI_SIG_LPIT, NULL, AcpiDmDumpLpit, DtCompileLpit, TemplateLpit}, > + {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt}, > + {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg}, > + {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi}, > + {ACPI_SIG_MPST, AcpiDmTableInfoMpst, AcpiDmDumpMpst, DtCompileMpst, TemplateMpst}, > + {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct}, > + {ACPI_SIG_MSDM, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateMsdm}, > + {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr}, > + {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, > + {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, > + {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, > + {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, > + {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, > + {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, > + {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic}, > + {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit}, > + {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr}, > + {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi}, > + {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, > + {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, > + {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa}, > + {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2}, > + {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, > + {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc}, > + {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, > + {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat}, > + {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt}, > + {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt}, > + {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt}, > + {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv}, > + {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt}, > + {NULL, NULL, NULL, NULL, NULL} > }; > > > @@ -479,18 +505,18 @@ AcpiDmGenerateChecksum ( > * > ******************************************************************************/ > > -ACPI_DMTABLE_DATA * > +const ACPI_DMTABLE_DATA * > AcpiDmGetTableData ( > char *Signature) > { > - ACPI_DMTABLE_DATA *TableData; > + const ACPI_DMTABLE_DATA *Info; > > > - for (TableData = AcpiDmTableData; TableData->Signature; TableData++) > + for (Info = AcpiDmTableData; Info->Signature; Info++) > { > - if (ACPI_COMPARE_NAME (Signature, TableData->Signature)) > + if (ACPI_COMPARE_NAME (Signature, Info->Signature)) > { > - return (TableData); > + return (Info); > } > } > > @@ -516,7 +542,7 @@ AcpiDmDumpDataTable ( > ACPI_TABLE_HEADER *Table) > { > ACPI_STATUS Status; > - ACPI_DMTABLE_DATA *TableData; > + const ACPI_DMTABLE_DATA *TableData; > UINT32 Length; > > > @@ -630,7 +656,6 @@ AcpiDmDumpDataTable ( > * PARAMETERS: Offset - Current byte offset, from table start > * ByteLength - Length of the field in bytes, 0 for flags > * Name - Name of this field > - * Value - Optional value, displayed on left of ':' > * > * RETURN: None > * > @@ -764,7 +789,7 @@ AcpiDmDumpTable ( > UINT16 Temp16; > UINT32 Temp32; > UINT64 Value; > - ACPI_DMTABLE_DATA *TableData; > + const AH_TABLE *TableData; > const char *Name; > BOOLEAN LastOutputBlankLine = FALSE; > char RepairedName[8]; > @@ -787,13 +812,24 @@ AcpiDmDumpTable ( > Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset); > CurrentOffset = TableOffset + Info->Offset; > > - /* Check for beyond EOT or beyond subtable end */ > + /* Check for beyond subtable end or (worse) beyond EOT */ > + > + if (SubtableLength && (Info->Offset >= SubtableLength)) > + { > + AcpiOsPrintf ( > + "/**** ACPI subtable terminates early - " > + "may be older version (dump table) */\n"); > > - if ((CurrentOffset >= TableLength) || > - (SubtableLength && (Info->Offset >= SubtableLength))) > + /* Move on to next subtable */ > + > + return (AE_OK); > + } > + > + if (CurrentOffset >= TableLength) > { > AcpiOsPrintf ( > - "**** ACPI table terminates in the middle of a data structure! (dump table)\n"); > + "/**** ACPI table terminates " > + "in the middle of a data structure! (dump table) */\n"); > return (AE_BAD_DATA); > } > > @@ -826,6 +862,7 @@ AcpiDmDumpTable ( > case ACPI_DMT_UINT16: > case ACPI_DMT_DMAR: > case ACPI_DMT_HEST: > + case ACPI_DMT_NFIT: > > ByteLength = 2; > break; > @@ -882,6 +919,7 @@ AcpiDmDumpTable ( > ByteLength = 128; > break; > > + case ACPI_DMT_UNICODE: > case ACPI_DMT_BUFFER: > case ACPI_DMT_RAW_BUFFER: > > @@ -913,16 +951,39 @@ AcpiDmDumpTable ( > ByteLength = sizeof (ACPI_HEST_NOTIFY); > break; > > + case ACPI_DMT_IORTMEM: > + > + if (!LastOutputBlankLine) > + { > + LastOutputBlankLine = FALSE; > + } > + ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS); > + break; > + > default: > > ByteLength = 0; > break; > } > > + /* Check if we are beyond a subtable, or (worse) beyond EOT */ > + > if (CurrentOffset + ByteLength > TableLength) > { > + if (SubtableLength) > + { > + AcpiOsPrintf ( > + "/**** ACPI subtable terminates early - " > + "may be older version (dump table) */\n"); > + > + /* Move on to next subtable */ > + > + return (AE_OK); > + } > + > AcpiOsPrintf ( > - "**** ACPI table terminates in the middle of a data structure!\n"); > + "/**** ACPI table terminates " > + "in the middle of a data structure! */\n"); > return (AE_BAD_DATA); > } > > @@ -1052,10 +1113,10 @@ AcpiDmDumpTable ( > > AcpiDmCheckAscii (Target, RepairedName, 4); > AcpiOsPrintf ("\"%.4s\" ", RepairedName); > - TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target)); > + TableData = AcpiAhGetTableInfo (ACPI_CAST_PTR (char, Target)); > if (TableData) > { > - AcpiOsPrintf (STRING_FORMAT, TableData->Name); > + AcpiOsPrintf (STRING_FORMAT, TableData->Description); > } > else > { > @@ -1281,6 +1342,16 @@ AcpiDmDumpTable ( > AcpiDmHestNotifySubnames[Temp8]); > break; > > + case ACPI_DMT_IORTMEM: > + > + AcpiOsPrintf (STRING_FORMAT, > + "IORT Memory Access Properties"); > + > + AcpiDmDumpTable (TableLength, CurrentOffset, Target, > + sizeof (ACPI_IORT_MEMORY_ACCESS), AcpiDmTableInfoIortAcc); > + LastOutputBlankLine = TRUE; > + break; > + > case ACPI_DMT_MADT: > > /* MADT subtable types */ > @@ -1295,6 +1366,20 @@ AcpiDmDumpTable ( > AcpiDmMadtSubnames[Temp8]); > break; > > + case ACPI_DMT_NFIT: > + > + /* NFIT subtable types */ > + > + Temp16 = ACPI_GET16 (Target); > + if (Temp16 > ACPI_NFIT_TYPE_RESERVED) > + { > + Temp16 = ACPI_NFIT_TYPE_RESERVED; > + } > + > + AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target), > + AcpiDmNfitSubnames[Temp16]); > + break; > + > case ACPI_DMT_PCCT: > > /* PCCT subtable types */ > @@ -1323,16 +1408,27 @@ AcpiDmDumpTable ( > AcpiDmPmttSubnames[Temp8]); > break; > > + case ACPI_DMT_UNICODE: > + > + if (ByteLength == 0) > + { > + AcpiOsPrintf ("/* Zero-length Data */\n"); > + break; > + } > + > + AcpiDmDumpUnicode (Table, CurrentOffset, ByteLength); > + break; > + > case ACPI_DMT_RAW_BUFFER: > - /* > - * Currently only used for SLIC table > - */ > - AcpiOsPrintf ("/* Proprietary data structure */ "); > > - AcpiDmDumpBuffer (Table, sizeof (ACPI_TABLE_HEADER), > - ByteLength, sizeof (ACPI_TABLE_HEADER), > - "Licensing Data", TRUE); > - AcpiOsPrintf ("\n"); > + if (ByteLength == 0) > + { > + AcpiOsPrintf ("/* Zero-length Data */\n"); > + break; > + } > + > + AcpiDmDumpBuffer (Table, CurrentOffset, ByteLength, > + CurrentOffset, NULL); > break; > > case ACPI_DMT_SRAT: > diff --git a/src/acpica/source/common/dmtbdump.c b/src/acpica/source/common/dmtbdump.c > index a12020b..9196dbb 100644 > --- a/src/acpica/source/common/dmtbdump.c > +++ b/src/acpica/source/common/dmtbdump.c > @@ -142,7 +142,6 @@ AcpiDmValidateFadtLength ( > * AbsoluteOffset - Offset of buffer in the main ACPI table > * Header - Name of the buffer field (printed on the > * first line only.) > - * MultiLine - TRUE if a large, multi-line buffer > * > * RETURN: None > * > @@ -157,8 +156,7 @@ AcpiDmDumpBuffer ( > UINT32 BufferOffset, > UINT32 Length, > UINT32 AbsoluteOffset, > - char *Header, > - BOOLEAN MultiLine) > + char *Header) > { > UINT8 *Buffer; > UINT32 i; > @@ -176,18 +174,11 @@ AcpiDmDumpBuffer ( > { > if (!(i % 16)) > { > - if (MultiLine) > - { > - /* Insert a backslash - line continuation character */ > + /* Insert a backslash - line continuation character */ > > - AcpiOsPrintf ("\\\n "); > - } > - else > + if (Length > 16) > { > - AcpiOsPrintf ("\n"); > - AcpiDmLineHeader (AbsoluteOffset, > - ((Length - i) > 16) ? 16 : (Length - i), Header); > - Header = NULL; > + AcpiOsPrintf ("\\\n "); > } > } > > @@ -203,6 +194,74 @@ AcpiDmDumpBuffer ( > > /******************************************************************************* > * > + * FUNCTION: AcpiDmDumpUnicode > + * > + * PARAMETERS: Table - ACPI Table or subtable > + * BufferOffset - Offset of buffer from Table above > + * ByteLength - Length of the buffer > + * > + * RETURN: None > + * > + * DESCRIPTION: Validate and dump the contents of a buffer that contains > + * unicode data. The output is a standard ASCII string. If it > + * appears that the data is not unicode, the buffer is dumped > + * as hex characters. > + * > + ******************************************************************************/ > + > +void > +AcpiDmDumpUnicode ( > + void *Table, > + UINT32 BufferOffset, > + UINT32 ByteLength) > +{ > + UINT8 *Buffer; > + UINT32 Length; > + UINT32 i; > + > + > + Buffer = ((UINT8 *) Table) + BufferOffset; > + Length = ByteLength - 2; /* Last two bytes are the null terminator */ > + > + /* Ensure all low bytes are entirely printable ASCII */ > + > + for (i = 0; i < Length; i += 2) > + { > + if (!ACPI_IS_PRINT (Buffer[i])) > + { > + goto DumpRawBuffer; > + } > + } > + > + /* Ensure all high bytes are zero */ > + > + for (i = 1; i < Length; i += 2) > + { > + if (Buffer[i]) > + { > + goto DumpRawBuffer; > + } > + } > + > + /* Dump the buffer as a normal string */ > + > + AcpiOsPrintf ("\""); > + for (i = 0; i < Length; i += 2) > + { > + AcpiOsPrintf ("%c", Buffer[i]); > + } > + AcpiOsPrintf ("\"\n"); > + return; > + > +DumpRawBuffer: > + AcpiDmDumpBuffer (Table, BufferOffset, ByteLength, > + BufferOffset, NULL); > + AcpiOsPrintf ("\n"); > +} > + > + > +/******************************************************************************* > + * > * FUNCTION: AcpiDmDumpRsdp > * > * PARAMETERS: Table - A RSDP > @@ -385,6 +444,13 @@ AcpiDmDumpFadt ( > { > AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt5); > } > + > + /* Check for FADT revision 6 fields and up (ACPI 6.0+) */ > + > + if (Table->Length > ACPI_FADT_V3_SIZE) > + { > + AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt6); > + } > } > > /* Validate various fields in the FADT, including length */ > @@ -765,10 +831,17 @@ AcpiDmDumpCsrt ( > /* Resource-specific info buffer */ > > InfoLength = SubSubTable->Length - SubSubOffset; > - > - AcpiDmDumpBuffer (SubSubTable, SubSubOffset, InfoLength, > - Offset + SubOffset + SubSubOffset, "ResourceInfo", FALSE); > - SubSubOffset += InfoLength; > + if (InfoLength) > + { > + Status = AcpiDmDumpTable (Length, > + Offset + SubOffset + SubSubOffset, Table, > + InfoLength, AcpiDmTableInfoCsrt2a); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + SubSubOffset += InfoLength; > + } > > /* Point to next sub-subtable */ > > @@ -886,8 +959,13 @@ AcpiDmDumpDbg2 ( > > if (SubTable->OemDataOffset) > { > - AcpiDmDumpBuffer (SubTable, SubTable->OemDataOffset, SubTable->OemDataLength, > - Offset + SubTable->OemDataOffset, "OEM Data", FALSE); > + Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset, > + Table, SubTable->OemDataLength, > + AcpiDmTableInfoDbg2OemData); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > } > > /* Point to next subtable */ > @@ -912,7 +990,6 @@ AcpiDmDumpDbg2 ( > * > ******************************************************************************/ > > - > void > AcpiDmDumpDmar ( > ACPI_TABLE_HEADER *Table) > @@ -1057,6 +1134,120 @@ NextSubtable: > > /******************************************************************************* > * > + * FUNCTION: AcpiDmDumpDrtm > + * > + * PARAMETERS: Table - A DRTM table > + * > + * RETURN: None > + * > + * DESCRIPTION: Format the contents of a DRTM. > + * > + ******************************************************************************/ > + > +void > +AcpiDmDumpDrtm ( > + ACPI_TABLE_HEADER *Table) > +{ > + ACPI_STATUS Status; > + UINT32 Offset; > + ACPI_DRTM_VTABLE_LIST *DrtmVtl; > + ACPI_DRTM_RESOURCE_LIST *DrtmRl; > + ACPI_DRTM_DPS_ID *DrtmDps; > + UINT32 Count; > + > + > + /* Main table */ > + > + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, > + AcpiDmTableInfoDrtm); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + Offset = sizeof (ACPI_TABLE_DRTM); > + > + /* Sub-tables */ > + > + /* Dump ValidatedTable length */ > + > + DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset); > + AcpiOsPrintf ("\n"); > + Status = AcpiDmDumpTable (Table->Length, Offset, > + DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables), > + AcpiDmTableInfoDrtm0); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + Offset += ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables); > + > + /* Dump Validated table addresses */ > + > + Count = 0; > + while ((Offset < Table->Length) && > + (DrtmVtl->ValidatedTableCount > Count)) > + { > + Status = AcpiDmDumpTable (Table->Length, Offset, > + ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64), > + AcpiDmTableInfoDrtm0a); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + Offset += sizeof (UINT64); > + Count++; > + } > + > + /* Dump ResourceList length */ > + > + DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset); > + AcpiOsPrintf ("\n"); > + Status = AcpiDmDumpTable (Table->Length, Offset, > + DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources), > + AcpiDmTableInfoDrtm1); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + Offset += ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources); > + > + /* Dump the Resource List */ > + > + Count = 0; > + while ((Offset < Table->Length) && > + (DrtmRl->ResourceCount > Count)) > + { > + Status = AcpiDmDumpTable (Table->Length, Offset, > + ACPI_ADD_PTR (void, Table, Offset), > + sizeof (ACPI_DRTM_RESOURCE), > + AcpiDmTableInfoDrtm1a); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + Offset += sizeof (ACPI_DRTM_RESOURCE); > + Count++; > + } > + > + /* Dump DPS */ > + > + DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset); > + AcpiOsPrintf ("\n"); > + Status = AcpiDmDumpTable (Table->Length, Offset, > + DrtmDps, sizeof (ACPI_DRTM_DPS_ID), > + AcpiDmTableInfoDrtm2); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > +} > + > + > +/******************************************************************************* > + * > * FUNCTION: AcpiDmDumpEinj > * > * PARAMETERS: Table - A EINJ table > @@ -1501,6 +1692,230 @@ AcpiDmDumpHest ( > > /******************************************************************************* > * > + * FUNCTION: AcpiDmDumpIort > + * > + * PARAMETERS: Table - A IORT table > + * > + * RETURN: None > + * > + * DESCRIPTION: Format the contents of a IORT > + * > + ******************************************************************************/ > + > +void > +AcpiDmDumpIort ( > + ACPI_TABLE_HEADER *Table) > +{ > + ACPI_STATUS Status; > + ACPI_TABLE_IORT *Iort; > + ACPI_IORT_NODE *IortNode; > + ACPI_IORT_ITS_GROUP *IortItsGroup = NULL; > + ACPI_IORT_SMMU *IortSmmu = NULL; > + UINT32 Offset; > + UINT32 NodeOffset; > + UINT32 Length; > + ACPI_DMTABLE_INFO *InfoTable; > + char *String; > + UINT32 i; > + > + > + /* Main table */ > + > + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + Iort = ACPI_CAST_PTR (ACPI_TABLE_IORT, Table); > + Offset = sizeof (ACPI_TABLE_IORT); > + > + /* Dump the OptionalPadding (optional) */ > + > + if (Iort->NodeOffset > Offset) > + { > + Status = AcpiDmDumpTable (Table->Length, Offset, Table, > + Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + } > + > + Offset = Iort->NodeOffset; > + while (Offset < Table->Length) > + { > + /* Common subtable header */ > + > + IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset); > + AcpiOsPrintf ("\n"); > + Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); > + Status = AcpiDmDumpTable (Table->Length, Offset, > + IortNode, Length, AcpiDmTableInfoIortHdr); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + NodeOffset = Length; > + > + switch (IortNode->Type) > + { > + case ACPI_IORT_NODE_ITS_GROUP: > + > + InfoTable = AcpiDmTableInfoIort0; > + Length = ACPI_OFFSET (ACPI_IORT_ITS_GROUP, Identifiers); > + IortItsGroup = ACPI_ADD_PTR (ACPI_IORT_ITS_GROUP, IortNode, NodeOffset); > + break; > + > + case ACPI_IORT_NODE_NAMED_COMPONENT: > + > + InfoTable = AcpiDmTableInfoIort1; > + Length = ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT, DeviceName); > + String = ACPI_ADD_PTR (char, IortNode, NodeOffset + Length); > + Length += ACPI_STRLEN (String) + 1; > + break; > + > + case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: > + > + InfoTable = AcpiDmTableInfoIort2; > + Length = IortNode->Length - NodeOffset; > + break; > + > + case ACPI_IORT_NODE_SMMU: > + > + InfoTable = AcpiDmTableInfoIort3; > + Length = ACPI_OFFSET (ACPI_IORT_SMMU, Interrupts); > + IortSmmu = ACPI_ADD_PTR (ACPI_IORT_SMMU, IortNode, NodeOffset); > + break; > + > + default: > + > + AcpiOsPrintf ("\n**** Unknown IORT node type 0x%X\n", > + IortNode->Type); > + > + /* Attempt to continue */ > + > + if (!IortNode->Length) > + { > + AcpiOsPrintf ("Invalid zero length IORT node\n"); > + return; > + } > + goto NextSubTable; > + } > + > + /* Dump the node subtable header */ > + > + AcpiOsPrintf ("\n"); > + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), > + Length, InfoTable); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + NodeOffset += Length; > + > + /* Dump the node specific data */ > + > + switch (IortNode->Type) > + { > + case ACPI_IORT_NODE_ITS_GROUP: > + > + /* Validate IortItsGroup to avoid compiler warnings */ > + > + if (IortItsGroup) > + { > + for (i = 0; i < IortItsGroup->ItsCount; i++) > + { > + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), > + 4, AcpiDmTableInfoIort0a); > + NodeOffset += 4; > + } > + } > + break; > + > + case ACPI_IORT_NODE_NAMED_COMPONENT: > + > + /* Dump the Padding (optional) */ > + > + if (IortNode->Length > NodeOffset) > + { > + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > + Table, IortNode->Length - NodeOffset, > + AcpiDmTableInfoIort1a); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + } > + break; > + > + case ACPI_IORT_NODE_SMMU: > + > + AcpiOsPrintf ("\n"); > + > + /* Validate IortSmmu to avoid compiler warnings */ > + > + if (IortSmmu) > + { > + Length = 2 * sizeof (UINT64); > + NodeOffset = IortSmmu->GlobalInterruptOffset; > + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), > + Length, AcpiDmTableInfoIort3a); > + > + NodeOffset = IortSmmu->ContextInterruptOffset; > + for (i = 0; i < IortSmmu->ContextInterruptCount; i++) > + { > + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), > + 8, AcpiDmTableInfoIort3b); > + NodeOffset += 8; > + } > + > + NodeOffset = IortSmmu->PmuInterruptOffset; > + for (i = 0; i < IortSmmu->PmuInterruptCount; i++) > + { > + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), > + 8, AcpiDmTableInfoIort3c); > + NodeOffset += 8; > + } > + } > + break; > + > + default: > + > + break; > + } > + > + /* Dump the ID mappings */ > + > + NodeOffset = IortNode->MappingOffset; > + for (i = 0; i < IortNode->MappingCount; i++) > + { > + AcpiOsPrintf ("\n"); > + Length = sizeof (ACPI_IORT_ID_MAPPING); > + Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, > + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), > + Length, AcpiDmTableInfoIortMap); > + NodeOffset += Length; > + } > + > +NextSubTable: > + /* Point to next node subtable */ > + > + Offset += IortNode->Length; > + IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length); > + } > +} > + > + > +/******************************************************************************* > + * > * FUNCTION: AcpiDmDumpIvrs > * > * PARAMETERS: Table - A IVRS table > @@ -1726,12 +2141,6 @@ AcpiDmDumpLpit ( > SubTableLength = sizeof (ACPI_LPIT_NATIVE); > break; > > - case ACPI_LPIT_TYPE_SIMPLE_IO: > - > - InfoTable = AcpiDmTableInfoLpit1; > - SubTableLength = sizeof (ACPI_LPIT_IO); > - break; > - > default: > > /* Cannot continue on unknown type - no length */ > @@ -1880,6 +2289,11 @@ AcpiDmDumpMadt ( > InfoTable = AcpiDmTableInfoMadt14; > break; > > + case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: > + > + InfoTable = AcpiDmTableInfoMadt15; > + break; > + > default: > > AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", SubTable->Type); > @@ -2218,6 +2632,180 @@ AcpiDmDumpMtmr ( > > /******************************************************************************* > * > + * FUNCTION: AcpiDmDumpNfit > + * > + * PARAMETERS: Table - A NFIT table > + * > + * RETURN: None > + * > + * DESCRIPTION: Format the contents of an NFIT. > + * > + ******************************************************************************/ > + > +void > +AcpiDmDumpNfit ( > + ACPI_TABLE_HEADER *Table) > +{ > + ACPI_STATUS Status; > + UINT32 Offset = sizeof (ACPI_TABLE_NFIT); > + UINT32 FieldOffset = 0; > + UINT32 Length; > + ACPI_NFIT_HEADER *SubTable; > + ACPI_DMTABLE_INFO *InfoTable; > + ACPI_NFIT_INTERLEAVE *Interleave = NULL; > + ACPI_NFIT_SMBIOS *SmbiosInfo = NULL; > + ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL; > + UINT32 i; > + > + > + /* Main table */ > + > + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + /* Subtables */ > + > + SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset); > + while (Offset < Table->Length) > + { > + /* NFIT subtable header */ > + > + AcpiOsPrintf ("\n"); > + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, > + SubTable->Length, AcpiDmTableInfoNfitHdr); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + switch (SubTable->Type) > + { > + case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: > + > + InfoTable = AcpiDmTableInfoNfit0; > + break; > + > + case ACPI_NFIT_TYPE_MEMORY_MAP: > + > + InfoTable = AcpiDmTableInfoNfit1; > + break; > + > + case ACPI_NFIT_TYPE_INTERLEAVE: > + > + /* Has a variable number of 32-bit values at the end */ > + > + InfoTable = AcpiDmTableInfoNfit2; > + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, SubTable); > + FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE); > + break; > + > + case ACPI_NFIT_TYPE_SMBIOS: > + > + SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, SubTable); > + InfoTable = AcpiDmTableInfoNfit3; > + break; > + > + case ACPI_NFIT_TYPE_CONTROL_REGION: > + > + InfoTable = AcpiDmTableInfoNfit4; > + break; > + > + case ACPI_NFIT_TYPE_DATA_REGION: > + > + InfoTable = AcpiDmTableInfoNfit5; > + break; > + > + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: > + > + /* Has a variable number of 64-bit addresses at the end */ > + > + InfoTable = AcpiDmTableInfoNfit6; > + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, SubTable); > + FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64); > + break; > + > + default: > + AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n", SubTable->Type); > + > + /* Attempt to continue */ > + > + if (!SubTable->Length) > + { > + AcpiOsPrintf ("Invalid zero length subtable\n"); > + return; > + } > + goto NextSubTable; > + } > + > + AcpiOsPrintf ("\n"); > + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, > + SubTable->Length, InfoTable); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + /* Per-subtable variable-length fields */ > + > + switch (SubTable->Type) > + { > + case ACPI_NFIT_TYPE_INTERLEAVE: > + > + for (i = 0; i < Interleave->LineCount; i++) > + { > + Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, > + &Interleave->LineOffset[i], > + sizeof (UINT32), AcpiDmTableInfoNfit2a); > + FieldOffset += sizeof (UINT32); > + } > + break; > + > + case ACPI_NFIT_TYPE_SMBIOS: > + > + Length = SubTable->Length - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8); > + if (Length) > + { > + Status = AcpiDmDumpTable (Table->Length, > + sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8), > + SmbiosInfo, > + Length, AcpiDmTableInfoNfit3a); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + } > + > + break; > + > + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: > + > + for (i = 0; i < Hint->HintCount; i++) > + { > + Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, > + &Hint->HintAddress[i], > + sizeof (UINT64), AcpiDmTableInfoNfit6a); > + FieldOffset += sizeof (UINT64); > + } > + break; > + > + default: > + break; > + } > + > +NextSubTable: > + /* Point to next subtable */ > + > + Offset += SubTable->Length; > + SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, SubTable, SubTable->Length); > + } > +} > + > + > +/******************************************************************************* > + * > * FUNCTION: AcpiDmDumpPcct > * > * PARAMETERS: Table - A PCCT table > @@ -2792,6 +3380,56 @@ NextSubTable: > > /******************************************************************************* > * > + * FUNCTION: AcpiDmDumpStao > + * > + * PARAMETERS: Table - A STAO table > + * > + * RETURN: None > + * > + * DESCRIPTION: Format the contents of a STAO. This is a variable-length > + * table that contains an open-ended number of ASCII strings > + * at the end of the table. > + * > + ******************************************************************************/ > + > +void > +AcpiDmDumpStao ( > + ACPI_TABLE_HEADER *Table) > +{ > + ACPI_STATUS Status; > + char *Namepath; > + UINT32 Length = Table->Length; > + UINT32 StringLength; > + UINT32 Offset = sizeof (ACPI_TABLE_STAO); > + > + > + /* Main table */ > + > + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + /* The rest of the table consists of Namepath strings */ > + > + while (Offset < Table->Length) > + { > + Namepath = ACPI_ADD_PTR (char, Table, Offset); > + StringLength = ACPI_STRLEN (Namepath) + 1; > + > + AcpiDmLineHeader (Offset, StringLength, "Namestring"); > + AcpiOsPrintf ("\"%s\"\n", Namepath); > + > + /* Point to next namepath */ > + > + Offset += StringLength; > + } > +} > + > + > +/******************************************************************************* > + * > * FUNCTION: AcpiDmDumpVrtc > * > * PARAMETERS: Table - A VRTC table > @@ -2892,3 +3530,49 @@ AcpiDmDumpWdat ( > SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, sizeof (ACPI_WDAT_ENTRY)); > } > } > + > +/******************************************************************************* > + * > + * FUNCTION: AcpiDmDumpWpbt > + * > + * PARAMETERS: Table - A WPBT table > + * > + * RETURN: None > + * > + * DESCRIPTION: Format the contents of a WPBT. This table type consists > + * of an open-ended arguments buffer at the end of the table. > + * > + ******************************************************************************/ > + > +void > +AcpiDmDumpWpbt ( > + ACPI_TABLE_HEADER *Table) > +{ > + ACPI_STATUS Status; > + ACPI_TABLE_WPBT *SubTable; > + UINT32 Length = Table->Length; > + UINT16 ArgumentsLength; > + > + > + /* Dump the main table */ > + > + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > + > + /* Extract the arguments buffer length from the main table */ > + > + SubTable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table); > + ArgumentsLength = SubTable->ArgumentsLength; > + > + /* Dump the arguments buffer */ > + > + AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength, > + AcpiDmTableInfoWpbt0); > + if (ACPI_FAILURE (Status)) > + { > + return; > + } > +} > diff --git a/src/acpica/source/common/dmtbinfo.c b/src/acpica/source/common/dmtbinfo.c > index 0405462..41e4d6a 100644 > --- a/src/acpica/source/common/dmtbinfo.c > +++ b/src/acpica/source/common/dmtbinfo.c > @@ -168,12 +168,14 @@ > #define ACPI_GTDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_GTDT,f) > #define ACPI_HEST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HEST,f) > #define ACPI_HPET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HPET,f) > +#define ACPI_IORT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_IORT,f) > #define ACPI_IVRS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_IVRS,f) > #define ACPI_MADT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MADT,f) > #define ACPI_MCFG_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MCFG,f) > #define ACPI_MCHI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MCHI,f) > #define ACPI_MPST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MPST,f) > #define ACPI_MSCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MSCT,f) > +#define ACPI_NFIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_NFIT,f) > #define ACPI_PCCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PCCT,f) > #define ACPI_PMTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PMTT,f) > #define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f) > @@ -182,6 +184,7 @@ > #define ACPI_SPCR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPCR,f) > #define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f) > #define ACPI_SRAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f) > +#define ACPI_STAO_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_STAO,f) > #define ACPI_TCPA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA,f) > #define ACPI_TPM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM2,f) > #define ACPI_UEFI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f) > @@ -189,6 +192,8 @@ > #define ACPI_WDAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDAT,f) > #define ACPI_WDDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDDT,f) > #define ACPI_WDRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDRT,f) > +#define ACPI_WPBT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WPBT,f) > +#define ACPI_XENV_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_XENV,f) > > /* Subtables */ > > @@ -210,6 +215,10 @@ > #define ACPI_DMAR2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_ATSR,f) > #define ACPI_DMAR3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_RHSA,f) > #define ACPI_DMAR4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DMAR_ANDD,f) > +#define ACPI_DRTM0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST,f) > +#define ACPI_DRTM1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST,f) > +#define ACPI_DRTM1a_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_RESOURCE,f) > +#define ACPI_DRTM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_DRTM_DPS_ID,f) > #define ACPI_EINJ0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f) > #define ACPI_ERST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WHEA_HEADER,f) > #define ACPI_FPDTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_HEADER,f) > @@ -228,6 +237,13 @@ > #define ACPI_HEST9_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC,f) > #define ACPI_HESTN_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) > #define ACPI_HESTB_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) > +#define ACPI_IORT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ITS_GROUP,f) > +#define ACPI_IORT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT,f) > +#define ACPI_IORT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ROOT_COMPLEX,f) > +#define ACPI_IORT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_SMMU,f) > +#define ACPI_IORTA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_MEMORY_ACCESS,f) > +#define ACPI_IORTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NODE,f) > +#define ACPI_IORTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ID_MAPPING,f) > #define ACPI_IVRSH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HEADER,f) > #define ACPI_IVRS0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f) > #define ACPI_IVRS1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) > @@ -237,7 +253,6 @@ > #define ACPI_IVRS8C_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8C,f) > #define ACPI_LPITH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_HEADER,f) > #define ACPI_LPIT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_NATIVE,f) > -#define ACPI_LPIT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_LPIT_IO,f) > #define ACPI_MADT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f) > #define ACPI_MADT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_IO_APIC,f) > #define ACPI_MADT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f) > @@ -253,6 +268,7 @@ > #define ACPI_MADT12_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_DISTRIBUTOR,f) > #define ACPI_MADT13_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_MSI_FRAME,f) > #define ACPI_MADT14_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_REDISTRIBUTOR,f) > +#define ACPI_MADT15_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MADT_GENERIC_TRANSLATOR,f) > #define ACPI_MADTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) > #define ACPI_MCFG0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) > #define ACPI_MPST0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_NODE,f) > @@ -262,6 +278,14 @@ > #define ACPI_MPST2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MPST_POWER_DATA,f) > #define ACPI_MSCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) > #define ACPI_MTMR0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_MTMR_ENTRY,f) > +#define ACPI_NFITH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_HEADER,f) > +#define ACPI_NFIT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_SYSTEM_ADDRESS,f) > +#define ACPI_NFIT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_MEMORY_MAP,f) > +#define ACPI_NFIT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_INTERLEAVE,f) > +#define ACPI_NFIT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_SMBIOS,f) > +#define ACPI_NFIT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_CONTROL_REGION,f) > +#define ACPI_NFIT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_DATA_REGION,f) > +#define ACPI_NFIT6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_FLUSH_ADDRESS,f) > #define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f) > #define ACPI_PCCT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED,f) > #define ACPI_PMTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f) > @@ -288,6 +312,8 @@ > > /* Flags */ > > +#define ACPI_DRTM_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_DRTM,f,o) > +#define ACPI_DRTM1a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_DRTM_RESOURCE,f,o) > #define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FADT,f,o) > #define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FACS,f,o) > #define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o) > @@ -298,6 +324,9 @@ > #define ACPI_GTDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_GTDT,f,o) > #define ACPI_GTDT0a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_TIMER_ENTRY,f,o) > #define ACPI_GTDT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_WATCHDOG,f,o) > +#define ACPI_IORT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU,f,o) > +#define ACPI_IORTA_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_MEMORY_ACCESS,f,o) > +#define ACPI_IORTM_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_ID_MAPPING,f,o) > #define ACPI_LPITH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_LPIT_HEADER,f,o) > #define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o) > #define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o) > @@ -312,6 +341,9 @@ > #define ACPI_MADT13_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_GENERIC_MSI_FRAME,f,o) > #define ACPI_MPST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MPST_POWER_NODE,f,o) > #define ACPI_MPST2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MPST_POWER_DATA,f,o) > +#define ACPI_NFIT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_SYSTEM_ADDRESS,f,o) > +#define ACPI_NFIT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_MEMORY_MAP,f,o) > +#define ACPI_NFIT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_CONTROL_REGION,f,o) > #define ACPI_PCCT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_PCCT,f,o) > #define ACPI_PCCT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED,f,o) > #define ACPI_PMTTH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PMTT_HEADER,f,o) > @@ -562,6 +594,14 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[] = > ACPI_DMT_TERMINATOR > }; > > +/* ACPI 6.0 Extensions (FADT version 6) */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoFadt6[] = > +{ > + {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (HypervisorId), "Hypervisor ID", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > > /* > * Remaining tables are not consumed directly by the ACPICA subsystem > @@ -752,7 +792,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] = > > ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[] = > { > - {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (Length), "Length", 0}, > + {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (Length), "Length", DT_LENGTH}, > {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (VendorId), "Vendor ID", 0}, > {ACPI_DMT_UINT32, ACPI_CSRT0_OFFSET (SubvendorId), "Subvendor ID", 0}, > {ACPI_DMT_UINT16, ACPI_CSRT0_OFFSET (DeviceId), "Device ID", 0}, > @@ -787,13 +827,19 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[] = > > ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2[] = > { > - {ACPI_DMT_UINT32, ACPI_CSRT2_OFFSET (Length), "Length", 0}, > + {ACPI_DMT_UINT32, ACPI_CSRT2_OFFSET (Length), "Length", DT_LENGTH}, > {ACPI_DMT_UINT16, ACPI_CSRT2_OFFSET (Type), "Type", 0}, > {ACPI_DMT_UINT16, ACPI_CSRT2_OFFSET (Subtype), "Subtype", 0}, > {ACPI_DMT_UINT32, ACPI_CSRT2_OFFSET (Uid), "UID", 0}, > ACPI_DMT_TERMINATOR > }; > > +ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2a[] = > +{ > + {ACPI_DMT_RAW_BUFFER, 0, "ResourceInfo", DT_OPTIONAL}, > + ACPI_DMT_TERMINATOR > +}; > + > > /******************************************************************************* > * > @@ -849,7 +895,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Name[] = > > ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2OemData[] = > { > - {ACPI_DMT_BUFFER, 0, "OEM Data", DT_OPTIONAL}, > + {ACPI_DMT_RAW_BUFFER, 0, "OEM Data", DT_OPTIONAL}, > ACPI_DMT_TERMINATOR > }; > > @@ -967,7 +1013,54 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar4[] = > > ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm[] = > { > + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (EntryBaseAddress), "Entry Base Address", 0}, > + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (EntryLength), "Entry Length", 0}, > + {ACPI_DMT_UINT32, ACPI_DRTM_OFFSET (EntryAddress32), "Entry 32", 0}, > + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (EntryAddress64), "Entry 64", 0}, > + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (ExitAddress), "Exit Address", 0}, > + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (LogAreaAddress), "Log Area Start", 0}, > + {ACPI_DMT_UINT32, ACPI_DRTM_OFFSET (LogAreaLength), "Log Area Length", 0}, > + {ACPI_DMT_UINT64, ACPI_DRTM_OFFSET (ArchDependentAddress), "Arch Dependent Address", 0}, > + {ACPI_DMT_UINT32, ACPI_DRTM_OFFSET (Flags), "Flags (decoded below)", 0}, > + {ACPI_DMT_FLAG0, ACPI_DRTM_FLAG_OFFSET (Flags, 0), "Namespace in TCB", 0}, > + {ACPI_DMT_FLAG1, ACPI_DRTM_FLAG_OFFSET (Flags, 0), "Gap Code on S3 Resume", 0}, > + {ACPI_DMT_FLAG2, ACPI_DRTM_FLAG_OFFSET (Flags, 0), "Gap Code on DLME_Exit", 0}, > + {ACPI_DMT_FLAG3, ACPI_DRTM_FLAG_OFFSET (Flags, 0), "PCR_Authorities Changed", 0}, > + ACPI_DMT_TERMINATOR > +}; > > +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm0[] = > +{ > + {ACPI_DMT_UINT32, ACPI_DRTM0_OFFSET (ValidatedTableCount), "Validated Table Count", DT_COUNT}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm0a[] = > +{ > + {ACPI_DMT_UINT64, 0, "Table Address", DT_OPTIONAL}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm1[] = > +{ > + {ACPI_DMT_UINT32, ACPI_DRTM1_OFFSET (ResourceCount), "Resource Count", DT_COUNT}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm1a[] = > +{ > + {ACPI_DMT_UINT56, ACPI_DRTM1a_OFFSET (Size[0]), "Size", DT_OPTIONAL}, > + {ACPI_DMT_UINT8, ACPI_DRTM1a_OFFSET (Type), "Type", 0}, > + {ACPI_DMT_FLAG0, ACPI_DRTM1a_FLAG_OFFSET (Type, 0), "Resource Type", 0}, > + {ACPI_DMT_FLAG7, ACPI_DRTM1a_FLAG_OFFSET (Type, 0), "Protections", 0}, > + {ACPI_DMT_UINT64, ACPI_DRTM1a_OFFSET (Address), "Address", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm2[] = > +{ > + {ACPI_DMT_UINT32, ACPI_DRTM2_OFFSET (DpsIdLength), "DLME Platform Id Length", DT_COUNT}, > + {ACPI_DMT_BUF16, ACPI_DRTM2_OFFSET (DpsId), "DLME Platform Id", DT_COUNT}, > ACPI_DMT_TERMINATOR > }; > > @@ -1374,6 +1467,148 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] = > > /******************************************************************************* > * > + * IORT - IO Remapping Table > + * > + ******************************************************************************/ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIort[] = > +{ > + {ACPI_DMT_UINT32, ACPI_IORT_OFFSET (NodeCount), "Node Count", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT_OFFSET (NodeOffset), "Node Offset", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT_OFFSET (Reserved), "Reserved", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* Optional padding field */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIortPad[] = > +{ > + {ACPI_DMT_RAW_BUFFER, 0, "Optional Padding", DT_OPTIONAL}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* Common Subtable header (one per Subtable) */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIortHdr[] = > +{ > + {ACPI_DMT_UINT8, ACPI_IORTH_OFFSET (Type), "Type", 0}, > + {ACPI_DMT_UINT16, ACPI_IORTH_OFFSET (Length), "Length", DT_LENGTH}, > + {ACPI_DMT_UINT8, ACPI_IORTH_OFFSET (Revision), "Revision", 0}, > + {ACPI_DMT_UINT32, ACPI_IORTH_OFFSET (Reserved), "Reserved", 0}, > + {ACPI_DMT_UINT32, ACPI_IORTH_OFFSET (MappingCount), "Mapping Count", 0}, > + {ACPI_DMT_UINT32, ACPI_IORTH_OFFSET (MappingOffset), "Mapping Offset", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIortMap[] = > +{ > + {ACPI_DMT_UINT32, ACPI_IORTM_OFFSET (InputBase), "Input base", DT_OPTIONAL}, > + {ACPI_DMT_UINT32, ACPI_IORTM_OFFSET (IdCount), "ID Count", 0}, > + {ACPI_DMT_UINT32, ACPI_IORTM_OFFSET (OutputBase), "Output Base", 0}, > + {ACPI_DMT_UINT32, ACPI_IORTM_OFFSET (OutputReference), "Output Reference", 0}, > + {ACPI_DMT_UINT32, ACPI_IORTM_OFFSET (Flags), "Flags (decoded below)", 0}, > + {ACPI_DMT_FLAG0, ACPI_IORTM_FLAG_OFFSET (Flags, 0), "Single Mapping", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIortAcc[] = > +{ > + {ACPI_DMT_UINT32, ACPI_IORTA_OFFSET (CacheCoherency), "Cache Coherency", 0}, > + {ACPI_DMT_UINT8, ACPI_IORTA_OFFSET (Hints), "Hints (decoded below)", 0}, > + {ACPI_DMT_FLAG0, ACPI_IORTA_FLAG_OFFSET (Hints, 0), "Transient", 0}, > + {ACPI_DMT_FLAG1, ACPI_IORTA_FLAG_OFFSET (Hints, 0), "Write Allocate", 0}, > + {ACPI_DMT_FLAG2, ACPI_IORTA_FLAG_OFFSET (Hints, 0), "Read Allocate", 0}, > + {ACPI_DMT_FLAG3, ACPI_IORTA_FLAG_OFFSET (Hints, 0), "Override", 0}, > + {ACPI_DMT_UINT16, ACPI_IORTA_OFFSET (Reserved), "Reserved", 0}, > + {ACPI_DMT_UINT8, ACPI_IORTA_OFFSET (MemoryFlags), "Memory Flags (decoded below)", 0}, > + {ACPI_DMT_FLAG0, ACPI_IORTA_FLAG_OFFSET (MemoryFlags, 0), "Coherency", 0}, > + {ACPI_DMT_FLAG1, ACPI_IORTA_FLAG_OFFSET (MemoryFlags, 0), "Device Attribute", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* IORT subtables */ > + > +/* 0x00: ITS Group */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIort0[] = > +{ > + {ACPI_DMT_UINT32, ACPI_IORT0_OFFSET (ItsCount), "ItsCount", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIort0a[] = > +{ > + {ACPI_DMT_UINT32, 0, "Identifiers", DT_OPTIONAL}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* 0x01: Named Component */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIort1[] = > +{ > + {ACPI_DMT_UINT32, ACPI_IORT1_OFFSET (NodeFlags), "Node Flags", 0}, > + {ACPI_DMT_IORTMEM, ACPI_IORT1_OFFSET (MemoryProperties), "Memory Properties", 0}, > + {ACPI_DMT_UINT8, ACPI_IORT1_OFFSET (MemoryAddressLimit), "Memory Size Limit", 0}, > + {ACPI_DMT_STRING, ACPI_IORT1_OFFSET (DeviceName[0]), "Device Name", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIort1a[] = > +{ > + {ACPI_DMT_RAW_BUFFER, 0, "Padding", DT_OPTIONAL}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* 0x02: PCI Root Complex */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIort2[] = > +{ > + {ACPI_DMT_IORTMEM, ACPI_IORT2_OFFSET (MemoryProperties), "Memory Properties", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT2_OFFSET (AtsAttribute), "ATS Attribute", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT2_OFFSET (PciSegmentNumber), "PCI Segment Number", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* 0x03: SMMUv1/2 */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIort3[] = > +{ > + {ACPI_DMT_UINT64, ACPI_IORT3_OFFSET (BaseAddress), "Base Address", 0}, > + {ACPI_DMT_UINT64, ACPI_IORT3_OFFSET (Span), "Span", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (Model), "Model", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (Flags), "Flags (decoded below)", 0}, > + {ACPI_DMT_FLAG0, ACPI_IORT3_FLAG_OFFSET (Flags, 0), "DVM Supported", 0}, > + {ACPI_DMT_FLAG1, ACPI_IORT3_FLAG_OFFSET (Flags, 0), "Coherent Walk", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (GlobalInterruptOffset), "Global Interrupt Offset", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (ContextInterruptCount), "Context Interrupt Count", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (ContextInterruptOffset), "Context Interrupt Offset", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (PmuInterruptCount), "PMU Interrupt Count", 0}, > + {ACPI_DMT_UINT32, ACPI_IORT3_OFFSET (PmuInterruptOffset), "PMU Interrupt Offset", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIort3a[] = > +{ > + {ACPI_DMT_UINT64, 0, "SMMU_NSgIrpt Interrupt", 0}, > + {ACPI_DMT_UINT64, 0, "SMMU_NSgCfgIrpt Interrupt", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIort3b[] = > +{ > + {ACPI_DMT_UINT64, 0, "Context Interrupt", DT_OPTIONAL}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoIort3c[] = > +{ > + {ACPI_DMT_UINT64, 0, "PMU Interrupt", DT_OPTIONAL}, > + ACPI_DMT_TERMINATOR > +}; > + > + > +/******************************************************************************* > + * > * IVRS - I/O Virtualization Reporting Structure > * > ******************************************************************************/ > @@ -1504,22 +1739,6 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoLpit0[] = > ACPI_DMT_TERMINATOR > }; > > -/* 1: Simple I/O */ > - > -ACPI_DMTABLE_INFO AcpiDmTableInfoLpit1[] = > -{ > - {ACPI_DMT_GAS, ACPI_LPIT1_OFFSET (EntryTrigger), "Entry Trigger", 0}, > - {ACPI_DMT_UINT32, ACPI_LPIT1_OFFSET (TriggerAction), "Trigger Action", 0}, > - {ACPI_DMT_UINT64, ACPI_LPIT1_OFFSET (TriggerValue), "Trigger Value", 0}, > - {ACPI_DMT_UINT64, ACPI_LPIT1_OFFSET (TriggerMask), "Trigger Mask", 0}, > - {ACPI_DMT_GAS, ACPI_LPIT1_OFFSET (MinimumIdleState), "Minimum Idle State", 0}, > - {ACPI_DMT_UINT32, ACPI_LPIT1_OFFSET (Residency), "Residency", 0}, > - {ACPI_DMT_UINT32, ACPI_LPIT1_OFFSET (Latency), "Latency", 0}, > - {ACPI_DMT_GAS, ACPI_LPIT1_OFFSET (ResidencyCounter), "Residency Counter", 0}, > - {ACPI_DMT_UINT64, ACPI_LPIT1_OFFSET (CounterFrequency), "Counter Frequency", 0}, > - ACPI_DMT_TERMINATOR > -}; > - > > /******************************************************************************* > * > @@ -1701,6 +1920,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[] = > {ACPI_DMT_UINT32, ACPI_MADT11_OFFSET (VgicInterrupt), "Virtual GIC Interrupt", 0}, > {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (GicrBaseAddress), "Redistributor Base Address", 0}, > {ACPI_DMT_UINT64, ACPI_MADT11_OFFSET (ArmMpidr), "ARM MPIDR", 0}, > + {ACPI_DMT_UINT8, ACPI_MADT11_OFFSET (EfficiencyClass), "Efficiency Class", 0}, > + {ACPI_DMT_UINT24, ACPI_MADT11_OFFSET (Reserved2[0]), "Reserved", 0}, > ACPI_DMT_TERMINATOR > }; > > @@ -1712,7 +1933,8 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[] = > {ACPI_DMT_UINT32, ACPI_MADT12_OFFSET (GicId), "Local GIC Hardware ID", 0}, > {ACPI_DMT_UINT64, ACPI_MADT12_OFFSET (BaseAddress), "Base Address", 0}, > {ACPI_DMT_UINT32, ACPI_MADT12_OFFSET (GlobalIrqBase), "Interrupt Base", 0}, > - {ACPI_DMT_UINT32, ACPI_MADT12_OFFSET (Reserved2), "Reserved", 0}, > + {ACPI_DMT_UINT8, ACPI_MADT12_OFFSET (Version), "Version", 0}, > + {ACPI_DMT_UINT24, ACPI_MADT12_OFFSET (Reserved2[0]), "Reserved", 0}, > ACPI_DMT_TERMINATOR > }; > > @@ -1740,6 +1962,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt14[] = > ACPI_DMT_TERMINATOR > }; > > +/* 15: Generic Translator (ACPI 6.0) */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoMadt15[] = > +{ > + {ACPI_DMT_UINT16, ACPI_MADT15_OFFSET (Reserved), "Reserved", 0}, > + {ACPI_DMT_UINT32, ACPI_MADT15_OFFSET (TranslationId), "Translation ID", 0}, > + {ACPI_DMT_UINT64, ACPI_MADT15_OFFSET (BaseAddress), "Base Address", 0}, > + {ACPI_DMT_UINT32, ACPI_MADT15_OFFSET (Reserved2), "Reserved", 0}, > + ACPI_DMT_TERMINATOR > +}; > > /******************************************************************************* > * > @@ -1922,6 +2154,156 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr0[] = > > /******************************************************************************* > * > + * NFIT - NVDIMM Firmware Interface Table and Subtables - (ACPI 6.0) > + * > + ******************************************************************************/ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit[] = > +{ > + {ACPI_DMT_UINT32, ACPI_NFIT_OFFSET (Reserved), "Reserved", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* Common Subtable header */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfitHdr[] = > +{ > + {ACPI_DMT_NFIT, ACPI_NFITH_OFFSET (Type), "Subtable Type", 0}, > + {ACPI_DMT_UINT16, ACPI_NFITH_OFFSET (Length), "Length", DT_LENGTH}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* 0: System Physical Address Range Structure */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit0[] = > +{ > + {ACPI_DMT_UINT16, ACPI_NFIT0_OFFSET (RangeIndex), "Range Index", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, > + {ACPI_DMT_FLAG0, ACPI_NFIT0_FLAG_OFFSET (Flags,0), "Add/Online Operation Only", 0}, > + {ACPI_DMT_FLAG1, ACPI_NFIT0_FLAG_OFFSET (Flags,0), "Proximity Domain Valid", 0}, > + {ACPI_DMT_UINT32, ACPI_NFIT0_OFFSET (Reserved), "Reserved", 0}, > + {ACPI_DMT_UINT32, ACPI_NFIT0_OFFSET (ProximityDomain), "Proximity Domain", 0}, > + {ACPI_DMT_UUID, ACPI_NFIT0_OFFSET (RangeGuid[0]), "Address Range GUID", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT0_OFFSET (Address), "Address Range Base", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT0_OFFSET (Length), "Address Range Length", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT0_OFFSET (MemoryMapping), "Memory Map Attribute", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* 1: Memory Device to System Address Range Map Structure */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit1[] = > +{ > + {ACPI_DMT_UINT32, ACPI_NFIT1_OFFSET (DeviceHandle), "Device Handle", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (PhysicalId), "Physical Id", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (RegionId), "Region Id", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (RangeIndex), "Range Index", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (RegionIndex), "Control Region Index", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT1_OFFSET (RegionSize), "Region Size", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT1_OFFSET (RegionOffset), "Region Offset", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT1_OFFSET (Address), "Address Region Base", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (InterleaveIndex), "Interleave Index", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (InterleaveWays), "Interleave Ways", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (Flags), "Flags", DT_FLAG}, > + {ACPI_DMT_FLAG0, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Save to device failed", 0}, > + {ACPI_DMT_FLAG1, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Restore from device failed", 0}, > + {ACPI_DMT_FLAG2, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Platform flush failed", 0}, > + {ACPI_DMT_FLAG3, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Device not armed", 0}, > + {ACPI_DMT_FLAG4, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Health events observed", 0}, > + {ACPI_DMT_FLAG5, ACPI_NFIT1_FLAG_OFFSET (Flags,0), "Health events enabled", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT1_OFFSET (Reserved), "Reserved", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* 2: Interleave Structure */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit2[] = > +{ > + {ACPI_DMT_UINT16, ACPI_NFIT2_OFFSET (InterleaveIndex), "Interleave Index", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT2_OFFSET (Reserved), "Reserved", 0}, > + {ACPI_DMT_UINT32, ACPI_NFIT2_OFFSET (LineCount), "Line Count", 0}, > + {ACPI_DMT_UINT32, ACPI_NFIT2_OFFSET (LineSize), "Line Size", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit2a[] = > +{ > + {ACPI_DMT_UINT32, 0, "Line Offset", DT_OPTIONAL}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* 3: SMBIOS Management Information Structure */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit3[] = > +{ > + {ACPI_DMT_UINT32, ACPI_NFIT3_OFFSET (Reserved), "Reserved", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit3a[] = > +{ > + {ACPI_DMT_RAW_BUFFER, 0, "SMBIOS Table Entries", DT_OPTIONAL}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* 4: NVDIMM Control Region Structure */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit4[] = > +{ > + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (RegionIndex), "Region Index", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (VendorId), "Vendor Id", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (DeviceId), "Device Id", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (RevisionId), "Revision Id", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (SubsystemVendorId), "Subsystem Vendor Id", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (SubsystemDeviceId), "Subsystem Device Id", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (SubsystemRevisionId), "Subsystem Revision Id", 0}, > + {ACPI_DMT_UINT48, ACPI_NFIT4_OFFSET (Reserved[0]), "Reserved", 0}, > + {ACPI_DMT_UINT32, ACPI_NFIT4_OFFSET (SerialNumber), "Serial Number", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (Code), "Code", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (Windows), "Window Count", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT4_OFFSET (WindowSize), "Window Size", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT4_OFFSET (CommandOffset), "Command Offset", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT4_OFFSET (CommandSize), "Command Size", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT4_OFFSET (StatusOffset), "Status Offset", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT4_OFFSET (StatusSize), "Status Size", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT4_OFFSET (Flags), "Flags", DT_FLAG}, > + {ACPI_DMT_FLAG0, ACPI_NFIT4_FLAG_OFFSET (Flags,0), "Windows buffered", 0}, > + {ACPI_DMT_UINT48, ACPI_NFIT4_OFFSET (Reserved1[0]), "Reserved1", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* 5: NVDIMM Block Data Window Region Structure */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit5[] = > +{ > + {ACPI_DMT_UINT16, ACPI_NFIT5_OFFSET (RegionIndex), "Region Index", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT5_OFFSET (Windows), "Window Count", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT5_OFFSET (Offset), "Offset", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT5_OFFSET (Size), "Size", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT5_OFFSET (Capacity), "Capacity", 0}, > + {ACPI_DMT_UINT64, ACPI_NFIT5_OFFSET (StartAddress), "Start Address", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +/* 6: Flush Hint Address Structure */ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6[] = > +{ > + {ACPI_DMT_UINT32, ACPI_NFIT6_OFFSET (DeviceHandle), "Device Handle", 0}, > + {ACPI_DMT_UINT16, ACPI_NFIT6_OFFSET (HintCount), "Hint Count", 0}, > + {ACPI_DMT_UINT48, ACPI_NFIT6_OFFSET (Reserved[0]), "Reserved", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[] = > +{ > + {ACPI_DMT_UINT64, 0, "Hint Address", DT_OPTIONAL}, > + ACPI_DMT_TERMINATOR > +}; > + > + > +/******************************************************************************* > + * > * PCCT - Platform Communications Channel Table (ACPI 5.0) > * > ******************************************************************************/ > @@ -2282,6 +2664,25 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[] = > > /******************************************************************************* > * > + * STAO - Status Override Table (_STA override) - ACPI 6.0 > + * > + ******************************************************************************/ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoStao[] = > +{ > + {ACPI_DMT_UINT8, ACPI_STAO_OFFSET (IgnoreUart), "Ignore UART", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[] = > +{ > + {ACPI_DMT_STRING, 0, "Namepath", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > + > +/******************************************************************************* > + * > * TCPA - Trusted Computing Platform Alliance table > * > ******************************************************************************/ > @@ -2460,6 +2861,49 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] = > ACPI_DMT_TERMINATOR > }; > > + > +/******************************************************************************* > + * > + * WPBT - Windows Platform Environment Table (ACPI 6.0) > + * Version 1 > + * > + * Conforms to "Windows Platform Binary Table (WPBT)" 29 November 2011 > + * > + ******************************************************************************/ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt[] = > +{ > + {ACPI_DMT_UINT32, ACPI_WPBT_OFFSET (HandoffSize), "Handoff Size", 0}, > + {ACPI_DMT_UINT64, ACPI_WPBT_OFFSET (HandoffAddress), "Handoff Address", 0}, > + {ACPI_DMT_UINT8, ACPI_WPBT_OFFSET (Layout), "Layout", 0}, > + {ACPI_DMT_UINT8, ACPI_WPBT_OFFSET (Type), "Type", 0}, > + {ACPI_DMT_UINT16, ACPI_WPBT_OFFSET (ArgumentsLength), "Arguments Length", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt0[] = > +{ > + {ACPI_DMT_UNICODE, sizeof (ACPI_TABLE_WPBT), "Command-line Arguments", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > + > +/******************************************************************************* > + * > + * XENV - Xen Environment table (ACPI 6.0) > + * > + ******************************************************************************/ > + > +ACPI_DMTABLE_INFO AcpiDmTableInfoXenv[] = > +{ > + {ACPI_DMT_UINT64, ACPI_XENV_OFFSET (GrantTableAddress), "Grant Table Address", 0}, > + {ACPI_DMT_UINT64, ACPI_XENV_OFFSET (GrantTableSize), "Grant Table Size", 0}, > + {ACPI_DMT_UINT32, ACPI_XENV_OFFSET (EventInterrupt), "Event Interrupt", 0}, > + {ACPI_DMT_UINT8, ACPI_XENV_OFFSET (EventFlags), "Event Flags", 0}, > + ACPI_DMT_TERMINATOR > +}; > + > + > /*! [Begin] no source code translation */ > > /* > diff --git a/src/acpica/source/compiler/aslascii.c b/src/acpica/source/compiler/aslascii.c > index 9a4e127..b858a38 100644 > --- a/src/acpica/source/compiler/aslascii.c > +++ b/src/acpica/source/compiler/aslascii.c > @@ -220,8 +220,7 @@ FlCheckForAcpiTable ( > * > * FUNCTION: FlCheckForAscii > * > - * PARAMETERS: Handle - Open input file > - * Filename - Input filename > + * PARAMETERS: Filename - Full input filename > * DisplayErrors - TRUE if error messages desired > * > * RETURN: Status > @@ -237,7 +236,6 @@ FlCheckForAcpiTable ( > > ACPI_STATUS > FlCheckForAscii ( > - FILE *Handle, > char *Filename, > BOOLEAN DisplayErrors) > { > @@ -245,7 +243,12 @@ FlCheckForAscii ( > ACPI_SIZE BadBytes = 0; > BOOLEAN OpeningComment = FALSE; > ASL_FILE_STATUS Status; > + FILE *Handle; > + > + > + /* Open file in text mode so file offset is always accurate */ > > + Handle = fopen (Filename, "rb"); > > Status.Line = 1; > Status.Offset = 0; > @@ -286,16 +289,30 @@ FlCheckForAscii ( > if ((BadBytes < 10) && (DisplayErrors)) > { > AcpiOsPrintf ( > - "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n", > + "Found non-ASCII character in source text: " > + "0x%2.2X in line %u, file offset 0x%2.2X\n", > Byte, Status.Line, Status.Offset); > } > + BadBytes++; > + } > > + /* Ensure character is either printable or a "space" char */ > + > + else if (!ACPI_IS_PRINT (Byte) && !ACPI_IS_SPACE (Byte)) > + { > + if ((BadBytes < 10) && (DisplayErrors)) > + { > + AcpiOsPrintf ( > + "Found invalid character in source text: " > + "0x%2.2X in line %u, file offset 0x%2.2X\n", > + Byte, Status.Line, Status.Offset); > + } > BadBytes++; > } > > - /* Update line counter */ > + /* Update line counter as necessary */ > > - else if (Byte == 0x0A) > + if (Byte == 0x0A) > { > Status.Line++; > } > @@ -303,9 +320,7 @@ FlCheckForAscii ( > Status.Offset++; > } > > - /* Seek back to the beginning of the source file */ > - > - fseek (Handle, 0, SEEK_SET); > + fclose (Handle); > > /* Were there any non-ASCII characters in the file? */ > > @@ -314,8 +329,8 @@ FlCheckForAscii ( > if (DisplayErrors) > { > AcpiOsPrintf ( > - "%u non-ASCII characters found in input source text, could be a binary file\n", > - BadBytes); > + "Total %u invalid characters found in input source text, " > + "could be a binary file\n", BadBytes); > AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, Filename); > } > > @@ -358,6 +373,7 @@ FlConsumeAnsiComment ( > { > if (Byte == '/') > { > + Status->Offset++; > return; > } > > diff --git a/src/acpica/source/compiler/aslcompiler.h b/src/acpica/source/compiler/aslcompiler.h > index 68042b2..5c78095 100644 > --- a/src/acpica/source/compiler/aslcompiler.h > +++ b/src/acpica/source/compiler/aslcompiler.h > @@ -244,7 +244,6 @@ FlCheckForAcpiTable ( > > ACPI_STATUS > FlCheckForAscii ( > - FILE *Handle, > char *Filename, > BOOLEAN DisplayErrors); > > diff --git a/src/acpica/source/compiler/aslcompiler.l b/src/acpica/source/compiler/aslcompiler.l > index 53332d8..56df646 100644 > --- a/src/acpica/source/compiler/aslcompiler.l > +++ b/src/acpica/source/compiler/aslcompiler.l > @@ -781,9 +781,18 @@ NamePathTail [.]{NameSeg} > return (PARSEOP_NAMESTRING); } > > . { count (1); > - sprintf (MsgBuffer, > - "Invalid character (0x%2.2X), expecting ASL keyword or name", > - *AslCompilertext); > + if (ACPI_IS_PRINT (*AslCompilertext)) > + { > + sprintf (MsgBuffer, > + "Invalid character (%c), expecting ASL keyword or name", > + *AslCompilertext); > + } > + else > + { > + sprintf (MsgBuffer, > + "Invalid character (0x%2.2X), expecting ASL keyword or name", > + *AslCompilertext); > + } > AslCompilererror (MsgBuffer);} > > <> { if (AslPopInputFileStack ()) > diff --git a/src/acpica/source/compiler/asldefine.h b/src/acpica/source/compiler/asldefine.h > index 57f2ef4..7d34da8 100644 > --- a/src/acpica/source/compiler/asldefine.h > +++ b/src/acpica/source/compiler/asldefine.h > @@ -125,7 +125,7 @@ > #define ASL_INVOCATION_NAME "iasl" > #define ASL_CREATOR_ID "INTL" > > -#define ASL_COMPLIANCE "Supports ACPI Specification Revision 5.1" > +#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.0" > > > /* Configuration constants */ > diff --git a/src/acpica/source/compiler/aslfiles.c b/src/acpica/source/compiler/aslfiles.c > index 39f6319..7443776 100644 > --- a/src/acpica/source/compiler/aslfiles.c > +++ b/src/acpica/source/compiler/aslfiles.c > @@ -121,9 +121,10 @@ > > /* Local prototypes */ > > -FILE * > +static FILE * > FlOpenIncludeWithPrefix ( > char *PrefixDir, > + ACPI_PARSE_OBJECT *Op, > char *Filename); > > > @@ -366,9 +367,10 @@ ConvertBackslashes: > * > ******************************************************************************/ > > -FILE * > +static FILE * > FlOpenIncludeWithPrefix ( > char *PrefixDir, > + ACPI_PARSE_OBJECT *Op, > char *Filename) > { > FILE *IncludeFile; > @@ -392,6 +394,26 @@ FlOpenIncludeWithPrefix ( > return (NULL); > } > > +#ifdef _MUST_HANDLE_COMMENTS > + /* > + * Check entire include file for any # preprocessor directives. > + * This is because there may be some confusion between the #include > + * preprocessor directive and the ASL Include statement. > + */ > + while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, IncludeFile)) > + { > + if (Gbl_CurrentLineBuffer[0] == '#') > + { > + AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE, > + Op, "use #include instead"); > + } > + } > +#endif > + > + /* Must seek back to the start of the file */ > + > + fseek (IncludeFile, 0, SEEK_SET); > + > /* Push the include file on the open input file stack */ > > AslPushInputFileStack (IncludeFile, Pathname); > @@ -448,7 +470,7 @@ FlOpenIncludeFile ( > (Op->Asl.Value.String[0] == '\\') || > (Op->Asl.Value.String[1] == ':')) > { > - IncludeFile = FlOpenIncludeWithPrefix ("", Op->Asl.Value.String); > + IncludeFile = FlOpenIncludeWithPrefix ("", Op, Op->Asl.Value.String); > if (!IncludeFile) > { > goto ErrorExit; > @@ -464,7 +486,7 @@ FlOpenIncludeFile ( > * > * Construct the file pathname from the global directory name. > */ > - IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op->Asl.Value.String); > + IncludeFile = FlOpenIncludeWithPrefix (Gbl_DirectoryPath, Op, Op->Asl.Value.String); > if (IncludeFile) > { > return; > @@ -477,7 +499,7 @@ FlOpenIncludeFile ( > NextDir = Gbl_IncludeDirList; > while (NextDir) > { > - IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op->Asl.Value.String); > + IncludeFile = FlOpenIncludeWithPrefix (NextDir->Dir, Op, Op->Asl.Value.String); > if (IncludeFile) > { > return; > diff --git a/src/acpica/source/compiler/aslmessages.c b/src/acpica/source/compiler/aslmessages.c > index 4ea71de..6e332f1 100644 > --- a/src/acpica/source/compiler/aslmessages.c > +++ b/src/acpica/source/compiler/aslmessages.c > @@ -342,7 +342,8 @@ const char *AslPreprocessorMsgs [] = > /* ASL_MSG_TOO_MANY_ARGUMENTS */ "Too many macro arguments", > /* ASL_MSG_UNKNOWN_DIRECTIVE */ "Unknown directive", > /* ASL_MSG_UNKNOWN_PRAGMA */ "Unknown pragma", > -/* ASL_MSG_WARNING_DIRECTIVE */ "#warning" > +/* ASL_MSG_WARNING_DIRECTIVE */ "#warning", > +/* ASL_MSG_INCLUDE_FILE */ "Found a # preprocessor directive in ASL Include() file" > }; > > > @@ -403,7 +404,7 @@ AeDecodeMessageId ( > > if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs)) > { > - return ("[Unknown Preprocesor exception ID]"); > + return ("[Unknown Preprocessor exception ID]"); > } > } > > diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h > index 12fe9d9..7501bbb 100644 > --- a/src/acpica/source/compiler/aslmessages.h > +++ b/src/acpica/source/compiler/aslmessages.h > @@ -339,6 +339,7 @@ typedef enum > ASL_MSG_UNKNOWN_DIRECTIVE, > ASL_MSG_UNKNOWN_PRAGMA, > ASL_MSG_WARNING_DIRECTIVE, > + ASL_MSG_INCLUDE_FILE > > } ASL_MESSAGE_IDS; > > diff --git a/src/acpica/source/compiler/aslprepkg.c b/src/acpica/source/compiler/aslprepkg.c > index 6b27e91..6a74e88 100644 > --- a/src/acpica/source/compiler/aslprepkg.c > +++ b/src/acpica/source/compiler/aslprepkg.c > @@ -223,6 +223,7 @@ ApCheckPackage ( > case ACPI_PTYPE2_FIXED: > case ACPI_PTYPE2_MIN: > case ACPI_PTYPE2_FIX_VAR: > + case ACPI_PTYPE2_VAR_VAR: > default: > > break; > @@ -396,6 +397,32 @@ ApCheckPackage ( > > break; > > + case ACPI_PTYPE2_VAR_VAR: > + > + /* Check for minimum size (ints at beginning + 1 subpackage) */ > + > + ExpectedCount = Package->RetInfo4.Count1 + 1; > + if (Count < ExpectedCount) > + { > + goto PackageTooSmall; > + } > + > + /* Check the non-package elements at beginning of main package */ > + > + for (i = 0; i < Package->RetInfo4.Count1; ++i) > + { > + Status = ApCheckObjectType (Predefined->Info.Name, Op, > + Package->RetInfo4.ObjectType1, i); > + Op = Op->Asl.Next; > + } > + > + /* Examine the variable-length list of subpackages */ > + > + ApCheckPackageList (Predefined->Info.Name, Op, > + Package, Package->RetInfo4.Count1, Count); > + > + break; > + > case ACPI_PTYPE2: > case ACPI_PTYPE2_FIXED: > case ACPI_PTYPE2_MIN: > @@ -499,6 +526,7 @@ ApCheckPackageElements ( > * ACPI_PTYPE2_MIN > * ACPI_PTYPE2_COUNT > * ACPI_PTYPE2_FIX_VAR > + * ACPI_PTYPE2_VAR_VAR > * > ******************************************************************************/ > > @@ -545,9 +573,12 @@ ApCheckPackageList ( > Count = (UINT32) Op->Asl.Value.Integer; > Op = Op->Asl.Next; > > - /* The subpackage must have at least one element */ > - > - if (!Count) > + /* > + * Most subpackage must have at least one element, with > + * only rare exceptions. (_RDI) > + */ > + if (!Count && > + (Package->RetInfo.Type != ACPI_PTYPE2_VAR_VAR)) > { > ApZeroLengthPackage (PredefinedName, SubPackageOp); > goto NextSubpackage; > @@ -605,6 +636,25 @@ ApCheckPackageList ( > Count - Package->RetInfo.Count1); > break; > > + case ACPI_PTYPE2_VAR_VAR: > + /* > + * Must have at least the minimum number elements. > + * A zero PkgCount means the number of elements is variable. > + */ > + ExpectedCount = Package->RetInfo4.PkgCount; > + if (ExpectedCount && (Count < ExpectedCount)) > + { > + ApPackageTooSmall (PredefinedName, SubPackageOp, > + Count, 1); > + break; > + } > + > + ApCheckPackageElements (PredefinedName, Op, > + Package->RetInfo4.SubObjectTypes, > + Package->RetInfo4.PkgCount, > + 0, 0); > + break; > + > case ACPI_PTYPE2_FIXED: > > /* Each subpackage has a fixed length */ > diff --git a/src/acpica/source/compiler/aslstartup.c b/src/acpica/source/compiler/aslstartup.c > index 9e6d7b3..5cc0959 100644 > --- a/src/acpica/source/compiler/aslstartup.c > +++ b/src/acpica/source/compiler/aslstartup.c > @@ -231,10 +231,10 @@ AslDetectSourceFileType ( > > /* Check for 100% ASCII source file (comments are ignored) */ > > - Status = FlCheckForAscii (Info->Handle, Info->Filename, TRUE); > + Status = FlCheckForAscii (Info->Filename, TRUE); > if (ACPI_FAILURE (Status)) > { > - printf ("Non-ascii input file - %s\n", Info->Filename); > + printf ("Invalid characters in input file - %s\n", Info->Filename); > > if (!Gbl_IgnoreErrors) > { > diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c > index 843c097..a5e53c7 100644 > --- a/src/acpica/source/compiler/aslutils.c > +++ b/src/acpica/source/compiler/aslutils.c > @@ -149,13 +149,11 @@ UtAttachNameseg ( > * > ******************************************************************************/ > > -#define ACPI_TABLE_HELP_FORMAT "%8u) %s %s\n" > - > void > UtDisplaySupportedTables ( > void) > { > - ACPI_DMTABLE_DATA *TableData; > + const AH_TABLE *TableData; > UINT32 i; > > > @@ -163,20 +161,14 @@ UtDisplaySupportedTables ( > " (Compiler, Disassembler, Template Generator)\n\n", > ACPI_CA_VERSION); > > - /* Special tables */ > - > - printf (" Special tables and AML tables:\n"); > - printf (ACPI_TABLE_HELP_FORMAT, 1, ACPI_RSDP_NAME, "Root System Description Pointer"); > - printf (ACPI_TABLE_HELP_FORMAT, 2, ACPI_SIG_FACS, "Firmware ACPI Control Structure"); > - printf (ACPI_TABLE_HELP_FORMAT, 3, ACPI_SIG_DSDT, "Differentiated System Description Table"); > - printf (ACPI_TABLE_HELP_FORMAT, 4, ACPI_SIG_SSDT, "Secondary System Description Table"); > - > - /* All data tables with common table header */ > + /* All ACPI tables with the common table header */ > > - printf ("\n Standard ACPI data tables:\n"); > - for (TableData = AcpiDmTableData, i = 5; TableData->Signature; TableData++, i++) > + printf ("\n Supported ACPI tables:\n"); > + for (TableData = AcpiSupportedTables, i = 1; > + TableData->Signature; TableData++, i++) > { > - printf (ACPI_TABLE_HELP_FORMAT, i, TableData->Signature, TableData->Name); > + printf ("%8u) %s %s\n", i, > + TableData->Signature, TableData->Description); > } > } > > diff --git a/src/acpica/source/compiler/dtcompile.c b/src/acpica/source/compiler/dtcompile.c > index 105151f..5c75f4b 100644 > --- a/src/acpica/source/compiler/dtcompile.c > +++ b/src/acpica/source/compiler/dtcompile.c > @@ -355,7 +355,7 @@ static ACPI_STATUS > DtCompileDataTable ( > DT_FIELD **FieldList) > { > - ACPI_DMTABLE_DATA *TableData; > + const ACPI_DMTABLE_DATA *TableData; > DT_SUBTABLE *Subtable; > char *Signature; > ACPI_TABLE_HEADER *AcpiTableHeader; > @@ -430,7 +430,7 @@ DtCompileDataTable ( > TableData = AcpiDmGetTableData (Signature); > if (!TableData || Gbl_CompileGeneric) > { > - DtCompileGeneric ((void **) FieldList); > + DtCompileGeneric ((void **) FieldList, NULL, NULL); > goto FinishHeader; > } > > @@ -508,14 +508,14 @@ DtCompileTable ( > DT_FIELD *LocalField; > UINT32 Length; > DT_SUBTABLE *Subtable; > - DT_SUBTABLE *InlineSubtable; > + DT_SUBTABLE *InlineSubtable = NULL; > UINT32 FieldLength = 0; > UINT8 FieldType; > UINT8 *Buffer; > UINT8 *FlagBuffer = NULL; > char *String; > UINT32 CurrentFlagByteOffset = 0; > - ACPI_STATUS Status; > + ACPI_STATUS Status = AE_OK; > > > if (!Field || !*Field) > @@ -551,6 +551,7 @@ DtCompileTable ( > Buffer = Subtable->Buffer; > > LocalField = *Field; > + Subtable->Name = LocalField->Name; > > /* > * Main loop walks the info table for this ACPI table or subtable > @@ -627,15 +628,32 @@ DtCompileTable ( > */ > *Field = LocalField; > > - if (Info->Opcode == ACPI_DMT_GAS) > + switch (Info->Opcode) > { > + case ACPI_DMT_GAS: > + > Status = DtCompileTable (Field, AcpiDmTableInfoGas, > &InlineSubtable, TRUE); > - } > - else > - { > + break; > + > + case ACPI_DMT_HESTNTFY: > + > Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify, > &InlineSubtable, TRUE); > + break; > + > + case ACPI_DMT_IORTMEM: > + > + Status = DtCompileTable (Field, AcpiDmTableInfoIortAcc, > + &InlineSubtable, TRUE); > + break; > + > + default: > + sprintf (MsgBuffer, "Invalid DMT opcode: 0x%.2X", > + Info->Opcode); > + DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer); > + Status = AE_BAD_DATA; > + break; > } > > if (ACPI_FAILURE (Status)) > @@ -672,7 +690,6 @@ DtCompileTable ( > Subtable->LengthField = Buffer; > Subtable->SizeOfLengthField = FieldLength; > } > - > break; > } > > @@ -688,3 +705,43 @@ Error: > ACPI_FREE (Subtable); > return (Status); > } > + > + > +/****************************************************************************** > + * > + * FUNCTION: DtCompilePadding > + * > + * PARAMETERS: Length - Padding field size > + * RetSubtable - Compile result of table > + * > + * RETURN: Status > + * > + * DESCRIPTION: Compile a subtable for padding purpose > + * > + *****************************************************************************/ > + > +ACPI_STATUS > +DtCompilePadding ( > + UINT32 Length, > + DT_SUBTABLE **RetSubtable) > +{ > + DT_SUBTABLE *Subtable; > + /* UINT8 *Buffer; */ > + char *String; > + > + > + Subtable = UtSubtableCacheCalloc (); > + > + if (Length > 0) > + { > + String = UtStringCacheCalloc (Length); > + Subtable->Buffer = ACPI_CAST_PTR (UINT8, String); > + } > + > + Subtable->Length = Length; > + Subtable->TotalLength = Length; > + /* Buffer = Subtable->Buffer; */ > + > + *RetSubtable = Subtable; > + return (AE_OK); > +} > diff --git a/src/acpica/source/compiler/dtcompiler.h b/src/acpica/source/compiler/dtcompiler.h > index e063770..499a2ad 100644 > --- a/src/acpica/source/compiler/dtcompiler.h > +++ b/src/acpica/source/compiler/dtcompiler.h > @@ -187,6 +187,7 @@ typedef struct dt_subtable > struct dt_subtable *StackTop; > UINT8 *Buffer; > UINT8 *LengthField; > + char *Name; > UINT32 Length; > UINT32 TotalLength; > UINT32 SizeOfLengthField; > @@ -242,6 +243,11 @@ DtCompileTable ( > DT_SUBTABLE **RetSubtable, > BOOLEAN Required); > > +ACPI_STATUS > +DtCompilePadding ( > + UINT32 Length, > + DT_SUBTABLE **RetSubtable); > + > > /* dtio - binary and text input/output */ > > @@ -501,6 +507,10 @@ DtCompileDmar ( > void **PFieldList); > > ACPI_STATUS > +DtCompileDrtm ( > + void **PFieldList); > + > +ACPI_STATUS > DtCompileEinj ( > void **PFieldList); > > @@ -525,6 +535,10 @@ DtCompileHest ( > void **PFieldList); > > ACPI_STATUS > +DtCompileIort ( > + void **PFieldList); > + > +ACPI_STATUS > DtCompileIvrs ( > void **PFieldList); > > @@ -553,6 +567,10 @@ DtCompileMtmr ( > void **PFieldList); > > ACPI_STATUS > +DtCompileNfit ( > + void **PFieldList); > + > +ACPI_STATUS > DtCompilePmtt ( > void **PFieldList); > > @@ -581,6 +599,10 @@ DtCompileSrat ( > void **PFieldList); > > ACPI_STATUS > +DtCompileStao ( > + void **PFieldList); > + > +ACPI_STATUS > DtCompileUefi ( > void **PFieldList); > > @@ -593,12 +615,18 @@ DtCompileWdat ( > void **PFieldList); > > ACPI_STATUS > +DtCompileWpbt ( > + void **PFieldList); > + > +ACPI_STATUS > DtCompileXsdt ( > void **PFieldList); > > ACPI_STATUS > DtCompileGeneric ( > - void **PFieldList); > + void **PFieldList, > + char *TermFieldName, > + UINT32 *PFieldLength); > > ACPI_DMTABLE_INFO * > DtGetGenericTableInfo ( > @@ -615,6 +643,7 @@ extern const unsigned char TemplateCsrt[]; > extern const unsigned char TemplateDbg2[]; > extern const unsigned char TemplateDbgp[]; > extern const unsigned char TemplateDmar[]; > +extern const unsigned char TemplateDrtm[]; > extern const unsigned char TemplateEcdt[]; > extern const unsigned char TemplateEinj[]; > extern const unsigned char TemplateErst[]; > @@ -623,6 +652,7 @@ extern const unsigned char TemplateFpdt[]; > extern const unsigned char TemplateGtdt[]; > extern const unsigned char TemplateHest[]; > extern const unsigned char TemplateHpet[]; > +extern const unsigned char TemplateIort[]; > extern const unsigned char TemplateIvrs[]; > extern const unsigned char TemplateLpit[]; > extern const unsigned char TemplateMadt[]; > @@ -632,6 +662,7 @@ extern const unsigned char TemplateMpst[]; > extern const unsigned char TemplateMsct[]; > extern const unsigned char TemplateMsdm[]; > extern const unsigned char TemplateMtmr[]; > +extern const unsigned char TemplateNfit[]; > extern const unsigned char TemplatePcct[]; > extern const unsigned char TemplatePmtt[]; > extern const unsigned char TemplateRsdt[]; > @@ -642,6 +673,7 @@ extern const unsigned char TemplateSlit[]; > extern const unsigned char TemplateSpcr[]; > extern const unsigned char TemplateSpmi[]; > extern const unsigned char TemplateSrat[]; > +extern const unsigned char TemplateStao[]; > extern const unsigned char TemplateTcpa[]; > extern const unsigned char TemplateTpm2[]; > extern const unsigned char TemplateUefi[]; > @@ -650,6 +682,8 @@ extern const unsigned char TemplateWaet[]; > extern const unsigned char TemplateWdat[]; > extern const unsigned char TemplateWddt[]; > extern const unsigned char TemplateWdrt[]; > +extern const unsigned char TemplateWpbt[]; > +extern const unsigned char TemplateXenv[]; > extern const unsigned char TemplateXsdt[]; > > #endif > diff --git a/src/acpica/source/compiler/dtio.c b/src/acpica/source/compiler/dtio.c > index 111a6fa..9b044ee 100644 > --- a/src/acpica/source/compiler/dtio.c > +++ b/src/acpica/source/compiler/dtio.c > @@ -1050,8 +1050,8 @@ DtDumpSubtableInfo ( > { > > DbgPrint (ASL_DEBUG_OUTPUT, > - "[%.04X] %.08X %.08X %.08X %.08X %.08X %p %p %p\n", > - Subtable->Depth, Subtable->Length, Subtable->TotalLength, > + "[%.04X] %24s %.08X %.08X %.08X %.08X %.08X %p %p %p\n", > + Subtable->Depth, Subtable->Name, Subtable->Length, Subtable->TotalLength, > Subtable->SizeOfLengthField, Subtable->Flags, Subtable, > Subtable->Parent, Subtable->Child, Subtable->Peer); > } > @@ -1064,8 +1064,8 @@ DtDumpSubtableTree ( > { > > DbgPrint (ASL_DEBUG_OUTPUT, > - "[%.04X] %*s%08X (%.02X) - (%.02X)\n", > - Subtable->Depth, (4 * Subtable->Depth), " ", > + "[%.04X] %24s %*s%08X (%.02X) - (%.02X)\n", > + Subtable->Depth, Subtable->Name, (4 * Subtable->Depth), " ", > Subtable, Subtable->Length, Subtable->TotalLength); > } > > @@ -1096,12 +1096,12 @@ DtDumpSubtableList ( > > DbgPrint (ASL_DEBUG_OUTPUT, > "Subtable Info:\n" > - "Depth Length TotalLen LenSize Flags " > + "Depth Name Length TotalLen LenSize Flags " > "This Parent Child Peer\n\n"); > DtWalkTableTree (Gbl_RootTable, DtDumpSubtableInfo, NULL, NULL); > > DbgPrint (ASL_DEBUG_OUTPUT, > - "\nSubtable Tree: (Depth, Subtable, Length, TotalLength)\n\n"); > + "\nSubtable Tree: (Depth, Name, Subtable, Length, TotalLength)\n\n"); > DtWalkTableTree (Gbl_RootTable, DtDumpSubtableTree, NULL, NULL); > > DbgPrint (ASL_DEBUG_OUTPUT, "\n"); > diff --git a/src/acpica/source/compiler/dtsubtable.c b/src/acpica/source/compiler/dtsubtable.c > index a35792d..2461cc2 100644 > --- a/src/acpica/source/compiler/dtsubtable.c > +++ b/src/acpica/source/compiler/dtsubtable.c > @@ -393,6 +393,11 @@ DtGetSubtableLength ( > Step = 9; > break; > > + case ACPI_DMT_IORTMEM: > + > + Step = 10; > + break; > + > default: > > Step = 1; > diff --git a/src/acpica/source/compiler/dttable.c b/src/acpica/source/compiler/dttable.c > index 85ffdad..db9ac24 100644 > --- a/src/acpica/source/compiler/dttable.c > +++ b/src/acpica/source/compiler/dttable.c > @@ -137,12 +137,6 @@ static ACPI_DMTABLE_INFO TableInfoDmarPciPath[] = > }; > > > -/* TBD: move to acmacros.h */ > - > -#define ACPI_SUB_PTR(t, a, b) \ > - ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b))) > - > - > /* Local prototypes */ > > static ACPI_STATUS > @@ -526,6 +520,7 @@ DtCompileCsrt ( > > /* Subtables (Resource Groups) */ > > + ParentTable = DtPeekSubtable (); > while (*PFieldList) > { > /* Resource group subtable */ > @@ -549,9 +544,9 @@ DtCompileCsrt ( > DescriptorCount = (GroupLength / > sizeof (ACPI_CSRT_DESCRIPTOR)); > > - ParentTable = DtPeekSubtable (); > DtInsertSubtable (ParentTable, Subtable); > DtPushSubtable (Subtable); > + ParentTable = DtPeekSubtable (); > > /* Shared info subtable (One per resource group) */ > > @@ -562,26 +557,44 @@ DtCompileCsrt ( > return (Status); > } > > - ParentTable = DtPeekSubtable (); > DtInsertSubtable (ParentTable, Subtable); > > /* Sub-Subtables (Resource Descriptors) */ > > while (*PFieldList && DescriptorCount) > { > + > Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2, > &Subtable, TRUE); > if (ACPI_FAILURE (Status)) > { > return (Status); > } > + DtInsertSubtable (ParentTable, Subtable); > > + DtPushSubtable (Subtable); > ParentTable = DtPeekSubtable (); > - DtInsertSubtable (ParentTable, Subtable); > + if (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2a, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (Subtable) > + { > + DtInsertSubtable (ParentTable, Subtable); > + } > + } > + DtPopSubtable (); > + ParentTable = DtPeekSubtable (); > + > DescriptorCount--; > } > > DtPopSubtable (); > + ParentTable = DtPeekSubtable (); > } > > return (Status); > @@ -900,6 +913,135 @@ DtCompileDmar ( > > /****************************************************************************** > * > + * FUNCTION: DtCompileDrtm > + * > + * PARAMETERS: List - Current field list pointer > + * > + * RETURN: Status > + * > + * DESCRIPTION: Compile DRTM. > + * > + *****************************************************************************/ > + > +ACPI_STATUS > +DtCompileDrtm ( > + void **List) > +{ > + ACPI_STATUS Status; > + DT_SUBTABLE *Subtable; > + DT_SUBTABLE *ParentTable; > + DT_FIELD **PFieldList = (DT_FIELD **) List; > + UINT32 Count; > + /* ACPI_TABLE_DRTM *Drtm; */ > + ACPI_DRTM_VTABLE_LIST *DrtmVtl; > + ACPI_DRTM_RESOURCE_LIST *DrtmRl; > + /* ACPI_DRTM_DPS_ID *DrtmDps; */ > + > + > + ParentTable = DtPeekSubtable (); > + > + /* Compile DRTM header */ > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + > + /* > + * Using ACPI_SUB_PTR, We needn't define a seperate structure. Care > + * should be taken to avoid accessing ACPI_TABLE_HADER fields. > + */ > +#if 0 > + Drtm = ACPI_SUB_PTR (ACPI_TABLE_DRTM, > + Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); > +#endif > + /* Compile VTL */ > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + DrtmVtl = ACPI_CAST_PTR (ACPI_DRTM_VTABLE_LIST, Subtable->Buffer); > + > + DtPushSubtable (Subtable); > + ParentTable = DtPeekSubtable (); > + Count = 0; > + while (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm0a, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (!Subtable) > + { > + break; > + } > + DtInsertSubtable (ParentTable, Subtable); > + Count++; > + } > + DrtmVtl->ValidatedTableCount = Count; > + DtPopSubtable (); > + ParentTable = DtPeekSubtable (); > + > + /* Compile RL */ > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + DrtmRl = ACPI_CAST_PTR (ACPI_DRTM_RESOURCE_LIST, Subtable->Buffer); > + > + DtPushSubtable (Subtable); > + ParentTable = DtPeekSubtable (); > + Count = 0; > + while (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm1a, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (!Subtable) > + { > + break; > + } > + DtInsertSubtable (ParentTable, Subtable); > + Count++; > + } > + DrtmRl->ResourceCount = Count; > + DtPopSubtable (); > + ParentTable = DtPeekSubtable (); > + > + /* Compile DPS */ > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoDrtm2, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + /* DrtmDps = ACPI_CAST_PTR (ACPI_DRTM_DPS_ID, Subtable->Buffer);*/ > + > + > + return (AE_OK); > +} > + > + > +/****************************************************************************** > + * > * FUNCTION: DtCompileEinj > * > * PARAMETERS: List - Current field list pointer > @@ -1018,6 +1160,18 @@ DtCompileFadt ( > > DtInsertSubtable (ParentTable, Subtable); > } > + > + if (Revision >= 6) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt6, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > + DtInsertSubtable (ParentTable, Subtable); > + } > } > > return (AE_OK); > @@ -1357,6 +1511,309 @@ DtCompileHest ( > > /****************************************************************************** > * > + * FUNCTION: DtCompileIort > + * > + * PARAMETERS: List - Current field list pointer > + * > + * RETURN: Status > + * > + * DESCRIPTION: Compile IORT. > + * > + *****************************************************************************/ > + > +ACPI_STATUS > +DtCompileIort ( > + void **List) > +{ > + ACPI_STATUS Status; > + DT_SUBTABLE *Subtable; > + DT_SUBTABLE *ParentTable; > + DT_FIELD **PFieldList = (DT_FIELD **) List; > + DT_FIELD *SubtableStart; > + ACPI_TABLE_IORT *Iort; > + ACPI_IORT_NODE *IortNode; > + ACPI_IORT_ITS_GROUP *IortItsGroup; > + ACPI_IORT_SMMU *IortSmmu; > + UINT32 NodeNumber; > + UINT32 NodeLength; > + UINT32 IdMappingNumber; > + UINT32 ItsNumber; > + UINT32 ContextIrptNumber; > + UINT32 PmuIrptNumber; > + UINT32 PaddingLength; > + > + > + ParentTable = DtPeekSubtable (); > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + > + /* > + * Using ACPI_SUB_PTR, We needn't define a seperate structure. Care > + * should be taken to avoid accessing ACPI_TABLE_HADER fields. > + */ > + Iort = ACPI_SUB_PTR (ACPI_TABLE_IORT, > + Subtable->Buffer, sizeof (ACPI_TABLE_HEADER)); > + > + /* > + * OptionalPadding - Variable-length data > + * (Optional, size = OffsetToNodes - sizeof (ACPI_TABLE_IORT)) > + * Optionally allows the generic data types to be used for filling > + * this field. > + */ > + Iort->NodeOffset = sizeof (ACPI_TABLE_IORT); > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (Subtable) > + { > + DtInsertSubtable (ParentTable, Subtable); > + Iort->NodeOffset += Subtable->Length; > + } > + else > + { > + Status = DtCompileGeneric (ACPI_CAST_PTR (void *, PFieldList), > + AcpiDmTableInfoIortHdr[0].Name, &PaddingLength); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + Iort->NodeOffset += PaddingLength; > + } > + > + NodeNumber = 0; > + while (*PFieldList) > + { > + SubtableStart = *PFieldList; > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortHdr, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + IortNode = ACPI_CAST_PTR (ACPI_IORT_NODE, Subtable->Buffer); > + NodeLength = ACPI_OFFSET (ACPI_IORT_NODE, NodeData); > + > + DtPushSubtable (Subtable); > + ParentTable = DtPeekSubtable (); > + > + switch (IortNode->Type) > + { > + case ACPI_IORT_NODE_ITS_GROUP: > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + IortItsGroup = ACPI_CAST_PTR (ACPI_IORT_ITS_GROUP, Subtable->Buffer); > + NodeLength += Subtable->Length; > + > + ItsNumber = 0; > + while (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort0a, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (!Subtable) > + { > + break; > + } > + DtInsertSubtable (ParentTable, Subtable); > + NodeLength += Subtable->Length; > + ItsNumber++; > + } > + > + IortItsGroup->ItsCount = ItsNumber; > + break; > + > + case ACPI_IORT_NODE_NAMED_COMPONENT: > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + NodeLength += Subtable->Length; > + > + /* > + * Padding - Variable-length data > + * Optionally allows the offset of the ID mappings to be used > + * for filling this field. > + */ > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort1a, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (Subtable) > + { > + DtInsertSubtable (ParentTable, Subtable); > + NodeLength += Subtable->Length; > + } > + else > + { > + if (NodeLength > IortNode->MappingOffset) > + { > + return (AE_BAD_DATA); > + } > + if (NodeLength < IortNode->MappingOffset) > + { > + Status = DtCompilePadding ( > + IortNode->MappingOffset - NodeLength, > + &Subtable); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + NodeLength = IortNode->MappingOffset; > + } > + } > + break; > + > + case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort2, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + NodeLength += Subtable->Length; > + break; > + > + case ACPI_IORT_NODE_SMMU: > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + IortSmmu = ACPI_CAST_PTR (ACPI_IORT_SMMU, Subtable->Buffer); > + NodeLength += Subtable->Length; > + > + /* Compile global interrupt array */ > + > + IortSmmu->GlobalInterruptOffset = NodeLength; > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + DtInsertSubtable (ParentTable, Subtable); > + NodeLength += Subtable->Length; > + > + /* Compile context interrupt array */ > + > + ContextIrptNumber = 0; > + IortSmmu->ContextInterruptOffset = NodeLength; > + while (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (!Subtable) > + { > + break; > + } > + DtInsertSubtable (ParentTable, Subtable); > + NodeLength += Subtable->Length; > + ContextIrptNumber++; > + } > + IortSmmu->ContextInterruptCount = ContextIrptNumber; > + > + /* Compile PMU interrupt array */ > + > + PmuIrptNumber = 0; > + IortSmmu->PmuInterruptOffset = NodeLength; > + while (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (!Subtable) > + { > + break; > + } > + DtInsertSubtable (ParentTable, Subtable); > + NodeLength += Subtable->Length; > + PmuIrptNumber++; > + } > + IortSmmu->PmuInterruptCount = PmuIrptNumber; > + break; > + > + default: > + > + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "IORT"); > + return (AE_ERROR); > + } > + > + /* Compile Array of ID mappings */ > + > + IortNode->MappingOffset = NodeLength; > + IdMappingNumber = 0; > + while (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortMap, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (!Subtable) > + { > + break; > + } > + DtInsertSubtable (ParentTable, Subtable); > + NodeLength += sizeof (ACPI_IORT_ID_MAPPING); > + IdMappingNumber++; > + } > + IortNode->MappingCount = IdMappingNumber; > + > + /* > + * Node length can be determined by DT_LENGTH option > + * IortNode->Length = NodeLength; > + */ > + DtPopSubtable (); > + ParentTable = DtPeekSubtable (); > + NodeNumber++; > + } > + Iort->NodeCount = NodeNumber; > + > + return (AE_OK); > +} > + > + > +/****************************************************************************** > + * > * FUNCTION: DtCompileIvrs > * > * PARAMETERS: List - Current field list pointer > @@ -1559,11 +2016,6 @@ DtCompileLpit ( > InfoTable = AcpiDmTableInfoLpit0; > break; > > - case ACPI_LPIT_TYPE_SIMPLE_IO: > - > - InfoTable = AcpiDmTableInfoLpit1; > - break; > - > default: > > DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "LPIT"); > @@ -1715,6 +2167,11 @@ DtCompileMadt ( > InfoTable = AcpiDmTableInfoMadt14; > break; > > + case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: > + > + InfoTable = AcpiDmTableInfoMadt15; > + break; > + > default: > > DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "MADT"); > @@ -1950,6 +2407,201 @@ DtCompileMtmr ( > > /****************************************************************************** > * > + * FUNCTION: DtCompileNfit > + * > + * PARAMETERS: List - Current field list pointer > + * > + * RETURN: Status > + * > + * DESCRIPTION: Compile NFIT. > + * > + *****************************************************************************/ > + > +ACPI_STATUS > +DtCompileNfit ( > + void **List) > +{ > + ACPI_STATUS Status; > + DT_SUBTABLE *Subtable; > + DT_SUBTABLE *ParentTable; > + DT_FIELD **PFieldList = (DT_FIELD **) List; > + DT_FIELD *SubtableStart; > + ACPI_NFIT_HEADER *NfitHeader; > + ACPI_DMTABLE_INFO *InfoTable; > + UINT32 Count; > + ACPI_NFIT_INTERLEAVE *Interleave = NULL; > + ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL; > + > + /* Main table */ > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + DtPushSubtable (Subtable); > + > + /* Subtables */ > + > + while (*PFieldList) > + { > + SubtableStart = *PFieldList; > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfitHdr, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + DtPushSubtable (Subtable); > + > + NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer); > + > + switch (NfitHeader->Type) > + { > + case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: > + > + InfoTable = AcpiDmTableInfoNfit0; > + break; > + > + case ACPI_NFIT_TYPE_MEMORY_MAP: > + > + InfoTable = AcpiDmTableInfoNfit1; > + break; > + > + case ACPI_NFIT_TYPE_INTERLEAVE: > + > + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable->Buffer); > + InfoTable = AcpiDmTableInfoNfit2; > + break; > + > + case ACPI_NFIT_TYPE_SMBIOS: > + > + InfoTable = AcpiDmTableInfoNfit3; > + break; > + > + case ACPI_NFIT_TYPE_CONTROL_REGION: > + > + InfoTable = AcpiDmTableInfoNfit4; > + break; > + > + case ACPI_NFIT_TYPE_DATA_REGION: > + > + InfoTable = AcpiDmTableInfoNfit5; > + break; > + > + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: > + > + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable->Buffer); > + InfoTable = AcpiDmTableInfoNfit6; > + break; > + > + default: > + > + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT"); > + return (AE_ERROR); > + } > + > + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + DtPopSubtable (); > + > + switch (NfitHeader->Type) > + { > + case ACPI_NFIT_TYPE_INTERLEAVE: > + > + Count = 0; > + DtPushSubtable (Subtable); > + while (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit2a, > + &Subtable, FALSE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (!Subtable) > + { > + DtPopSubtable (); > + break; > + } > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + Count++; > + } > + > + Interleave->LineCount = Count; > + DtPopSubtable (); > + break; > + > + case ACPI_NFIT_TYPE_SMBIOS: > + > + if (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit3a, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (Subtable) > + { > + DtInsertSubtable (ParentTable, Subtable); > + } > + } > + break; > + > + case ACPI_NFIT_TYPE_FLUSH_ADDRESS: > + > + Count = 0; > + DtPushSubtable (Subtable); > + while (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNfit6a, > + &Subtable, FALSE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + if (!Subtable) > + { > + DtPopSubtable (); > + break; > + } > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + Count++; > + } > + > + Hint->HintCount = (UINT16) Count; > + DtPopSubtable (); > + break; > + > + default: > + break; > + } > + } > + > + return (AE_OK); > +} > + > + > +/****************************************************************************** > + * > * FUNCTION: DtCompilePcct > * > * PARAMETERS: List - Current field list pointer > @@ -1973,6 +2625,8 @@ DtCompilePcct ( > ACPI_DMTABLE_INFO *InfoTable; > > > + /* Main table */ > + > Status = DtCompileTable (PFieldList, AcpiDmTableInfoPcct, > &Subtable, TRUE); > if (ACPI_FAILURE (Status)) > @@ -1983,6 +2637,8 @@ DtCompilePcct ( > ParentTable = DtPeekSubtable (); > DtInsertSubtable (ParentTable, Subtable); > > + /* Subtables */ > + > while (*PFieldList) > { > SubtableStart = *PFieldList; > @@ -2485,6 +3141,59 @@ DtCompileSrat ( > > /****************************************************************************** > * > + * FUNCTION: DtCompileStao > + * > + * PARAMETERS: PFieldList - Current field list pointer > + * > + * RETURN: Status > + * > + * DESCRIPTION: Compile STAO. > + * > + *****************************************************************************/ > + > +ACPI_STATUS > +DtCompileStao ( > + void **List) > +{ > + DT_FIELD **PFieldList = (DT_FIELD **) List; > + DT_SUBTABLE *Subtable; > + DT_SUBTABLE *ParentTable; > + ACPI_STATUS Status; > + > + > + /* Compile the main table */ > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoStao, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + > + /* Compile each ASCII namestring as a subtable */ > + > + while (*PFieldList) > + { > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoStaoStr, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + } > + > + return (AE_OK); > +} > + > + > +/****************************************************************************** > + * > * FUNCTION: DtGetGenericTableInfo > * > * PARAMETERS: Name - Generic type name > @@ -2575,7 +3284,7 @@ DtCompileUefi ( > * operators may be used. > */ > > - DtCompileGeneric ((void **) PFieldList); > + DtCompileGeneric ((void **) PFieldList, NULL, NULL); > > return (AE_OK); > } > @@ -2633,6 +3342,63 @@ DtCompileWdat ( > > /****************************************************************************** > * > + * FUNCTION: DtCompileWpbt > + * > + * PARAMETERS: List - Current field list pointer > + * > + * RETURN: Status > + * > + * DESCRIPTION: Compile WPBT. > + * > + *****************************************************************************/ > + > +ACPI_STATUS > +DtCompileWpbt ( > + void **List) > +{ > + DT_FIELD **PFieldList = (DT_FIELD **) List; > + DT_SUBTABLE *Subtable; > + DT_SUBTABLE *ParentTable; > + ACPI_TABLE_WPBT *Table; > + ACPI_STATUS Status; > + UINT16 Length; > + > + > + /* Compile the main table */ > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + > + /* Compile the argument list subtable */ > + > + Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0, > + &Subtable, TRUE); > + if (ACPI_FAILURE (Status)) > + { > + return (Status); > + } > + > + /* Extract the length of the Arguments buffer, insert into main table */ > + > + Length = (UINT16) Subtable->TotalLength; > + Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer); > + Table->ArgumentsLength = Length; > + > + ParentTable = DtPeekSubtable (); > + DtInsertSubtable (ParentTable, Subtable); > + return (AE_OK); > +} > + > + > +/****************************************************************************** > + * > * FUNCTION: DtCompileXsdt > * > * PARAMETERS: List - Current field list pointer > @@ -2652,6 +3418,7 @@ DtCompileXsdt ( > DT_FIELD *FieldList = *(DT_FIELD **) List; > UINT64 Address; > > + > ParentTable = DtPeekSubtable (); > > while (FieldList) > @@ -2672,6 +3439,8 @@ DtCompileXsdt ( > * FUNCTION: DtCompileGeneric > * > * PARAMETERS: List - Current field list pointer > + * Name - Field name to end generic compiling > + * Length - Compiled table length to return > * > * RETURN: Status > * > @@ -2681,7 +3450,9 @@ DtCompileXsdt ( > > ACPI_STATUS > DtCompileGeneric ( > - void **List) > + void **List, > + char *Name, > + UINT32 *Length) > { > ACPI_STATUS Status; > DT_SUBTABLE *Subtable; > @@ -2704,8 +3475,16 @@ DtCompileGeneric ( > > /* Now we can actually compile the parse tree */ > > + if (*Length) > + { > + *Length = 0; > + } > while (*PFieldList) > { > + if (Name && !ACPI_STRCMP ((*PFieldList)->Name, Name)) > + { > + break; > + } > Info = DtGetGenericTableInfo ((*PFieldList)->Name); > if (!Info) > { > @@ -2723,6 +3502,10 @@ DtCompileGeneric ( > if (ACPI_SUCCESS (Status)) > { > DtInsertSubtable (ParentTable, Subtable); > + if (Length) > + { > + *Length += Subtable->Length; > + } > } > else > { > diff --git a/src/acpica/source/compiler/dttemplate.c b/src/acpica/source/compiler/dttemplate.c > index b3f32b8..809ca61 100644 > --- a/src/acpica/source/compiler/dttemplate.c > +++ b/src/acpica/source/compiler/dttemplate.c > @@ -131,7 +131,7 @@ AcpiUtIsSpecialTable ( > static ACPI_STATUS > DtCreateOneTemplate ( > char *Signature, > - ACPI_DMTABLE_DATA *TableData); > + const ACPI_DMTABLE_DATA *TableData); > > static ACPI_STATUS > DtCreateAllTemplates ( > @@ -184,7 +184,7 @@ ACPI_STATUS > DtCreateTemplates ( > char *Signature) > { > - ACPI_DMTABLE_DATA *TableData; > + const ACPI_DMTABLE_DATA *TableData; > ACPI_STATUS Status; > > > @@ -285,7 +285,7 @@ static ACPI_STATUS > DtCreateAllTemplates ( > void) > { > - ACPI_DMTABLE_DATA *TableData; > + const ACPI_DMTABLE_DATA *TableData; > ACPI_STATUS Status; > > > @@ -364,7 +364,7 @@ DtCreateAllTemplates ( > static ACPI_STATUS > DtCreateOneTemplate ( > char *Signature, > - ACPI_DMTABLE_DATA *TableData) > + const ACPI_DMTABLE_DATA *TableData) > { > char *DisasmFilename; > FILE *File; > diff --git a/src/acpica/source/compiler/dttemplate.h b/src/acpica/source/compiler/dttemplate.h > index d7b84b1..22eb736 100644 > --- a/src/acpica/source/compiler/dttemplate.h > +++ b/src/acpica/source/compiler/dttemplate.h > @@ -306,6 +306,29 @@ const unsigned char TemplateDmar[] = > 0x00,0x00,0x00,0x00 /* 00000088 "...." */ > }; > > +const unsigned char TemplateDrtm[] = > +{ > + 0x44,0x52,0x54,0x4D,0x94,0x00,0x00,0x00, /* 00000000 "DRTM...." */ > + 0x01,0xB9,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ > + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ > + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ > + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ > + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */ > + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000068 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ > + 0x00,0x00,0x00,0x00 /* 00000090 "...." */ > +}; > + > const unsigned char TemplateEcdt[] = > { > 0x45,0x43,0x44,0x54,0x42,0x00,0x00,0x00, /* 00000000 "ECDTB..." */ > @@ -451,11 +474,11 @@ const unsigned char TemplateFacs[] = > > const unsigned char TemplateFadt[] = > { > - 0x46,0x41,0x43,0x50,0x0C,0x01,0x00,0x00, /* 00000000 "FACP...." */ > - 0x05,0x64,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".dINTEL " */ > - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ > + 0x46,0x41,0x43,0x50,0x14,0x01,0x00,0x00, /* 00000000 "FACP...." */ > + 0x06,0x8A,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ > + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ > 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ > - 0x15,0x11,0x13,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ > + 0x10,0x04,0x15,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ > 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ > 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ > @@ -484,7 +507,8 @@ const unsigned char TemplateFadt[] = > 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 000000F0 "........" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ > 0x01,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000100 "........" */ > - 0x00,0x00,0x00,0x00 /* 00000108 "...." */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */ > + 0x00,0x00,0x00,0x00 /* 00000110 "...." */ > }; > > const unsigned char TemplateFpdt[] = > @@ -610,6 +634,44 @@ const unsigned char TemplateHpet[] = > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000030 "........" */ > }; > > +const unsigned char TemplateIort[] = > +{ > + 0x49,0x4F,0x52,0x54,0x0C,0x01,0x00,0x00, /* 00000000 "IORT...." */ > + 0x00,0xBC,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ > + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ > + 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ > + 0x10,0x04,0x15,0x20,0x04,0x00,0x00,0x00, /* 00000020 "... ...." */ > + 0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "4......." */ > + 0x00,0x00,0x00,0x00,0x00,0x2C,0x00,0x00, /* 00000030 ".....,.." */ > + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000038 "........" */ > + 0x18,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000040 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ > + 0x01,0x30,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 ".0......" */ > + 0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00, /* 00000068 "....0..." */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x5C,0x5F,0x53, /* 00000078 ".....\_S" */ > + 0x42,0x2E,0x50,0x43,0x49,0x30,0x2E,0x44, /* 00000080 "B.PCI0.D" */ > + 0x45,0x56,0x30,0x00,0x00,0x00,0x00,0x00, /* 00000088 "EV0....." */ > + 0x02,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 ". ......" */ > + 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00, /* 00000098 ".... ..." */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */ > + 0x03,0x5C,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 ".\......" */ > + 0x00,0x00,0x00,0x00,0x5C,0x00,0x00,0x00, /* 000000B8 "....\..." */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "........" */ > + 0x3C,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000D8 "<......." */ > + 0x4C,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000E0 "L......." */ > + 0x54,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "T......." */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */ > + 0x00,0x00,0x00,0x00 /* 00000108 "...." */ > +}; > + > const unsigned char TemplateIvrs[] = > { > 0x49,0x56,0x52,0x53,0xBC,0x00,0x00,0x00, /* 00000000 "IVRS...." */ > @@ -640,73 +702,75 @@ const unsigned char TemplateIvrs[] = > > const unsigned char TemplateLpit[] = > { > - 0x4C,0x50,0x49,0x54,0xB4,0x00,0x00,0x00, /* 00000000 "LPIT...." */ > - 0x01,0x20,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ". INTEL " */ > - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ > + 0x4C,0x50,0x49,0x54,0x94,0x00,0x00,0x00, /* 00000000 "LPIT...." */ > + 0x00,0xD8,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ > + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ > 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ > - 0x25,0x03,0x14,0x20,0x00,0x00,0x00,0x00, /* 00000020 "%.. ...." */ > + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ > 0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "8......." */ > - 0x00,0x00,0x00,0x00,0x7F,0x01,0x02,0x00, /* 00000030 "........" */ > + 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 00000030 "........" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ > - 0x00,0x20,0x00,0x03,0x00,0x00,0x00,0x00, /* 00000048 ". ......" */ > + 0x7F,0x40,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 ". at ......" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ > - 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000058 "........" */ > - 0x58,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000060 "X......." */ > - 0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 00000068 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ > + 0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "8......." */ > + 0x00,0x00,0x00,0x00,0x01,0x08,0x00,0x01, /* 00000068 "........" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ > - 0x00,0x00,0x00,0x00,0x01,0x10,0x00,0x02, /* 00000088 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */ > - 0x00,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */ > - 0x00,0x00,0x00,0x00 /* 000000B0 "...." */ > + 0x7F,0x40,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 ". at ......" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ > + 0x00,0x00,0x00,0x00 /* 00000090 "...." */ > }; > > -/* MADT with ACPI 5.1 subtables */ > +/* MADT with ACPI 6.0 subtables */ > > const unsigned char TemplateMadt[] = > { > - 0x41,0x50,0x49,0x43,0x2a,0x01,0x00,0x00, /* 00000000 "APIC*..." */ > - 0x04,0x34,0x49,0x4e,0x54,0x45,0x4c,0x20, /* 00000008 ".4INTEL " */ > - 0x54,0x45,0x4d,0x50,0x4c,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ > - 0x01,0x00,0x00,0x00,0x49,0x4e,0x54,0x4c, /* 00000018 "....INTL" */ > - 0x24,0x04,0x14,0x20,0x00,0x00,0x00,0x00, /* 00000020 "$.. ...." */ > + 0x41,0x50,0x49,0x43,0x5A,0x01,0x00,0x00, /* 00000000 "APICZ..." */ > + 0x03,0xEA,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ > + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ > + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ > + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ > 0x01,0x00,0x00,0x00,0x00,0x08,0x00,0x00, /* 00000028 "........" */ > - 0x01,0x00,0x00,0x00,0x01,0x0c,0x01,0x00, /* 00000030 "........" */ > + 0x01,0x00,0x00,0x00,0x01,0x0C,0x01,0x00, /* 00000030 "........" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ > - 0x02,0x0a,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ > - 0x00,0x00,0x03,0x08,0x0d,0x00,0x01,0x00, /* 00000048 "........" */ > + 0x02,0x0A,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ > + 0x00,0x00,0x03,0x08,0x0D,0x00,0x01,0x00, /* 00000048 "........" */ > 0x00,0x00,0x04,0x06,0x00,0x05,0x00,0x01, /* 00000050 "........" */ > - 0x05,0x0c,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ > + 0x05,0x0C,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ > 0x00,0x00,0x00,0x00,0x06,0x10,0x00,0x00, /* 00000060 "........" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ > 0x00,0x00,0x00,0x00,0x07,0x16,0x00,0x00, /* 00000070 "........" */ > 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000078 "........" */ > - 0x00,0x00,0x00,0x00,0x5c,0x43,0x50,0x55, /* 00000080 "....\CPU" */ > + 0x00,0x00,0x00,0x00,0x5C,0x43,0x50,0x55, /* 00000080 "....\CPU" */ > 0x30,0x00,0x08,0x10,0x05,0x00,0x00,0x00, /* 00000088 "0......." */ > 0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00, /* 00000090 "........" */ > 0x00,0x00,0x09,0x10,0x00,0x00,0x00,0x00, /* 00000098 "........" */ > - 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000a0 "........" */ > - 0x00,0x00,0x0a,0x0c,0x05,0x00,0x00,0x00, /* 000000a8 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x0b,0x4c, /* 000000b0 ".......L" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000b8 "........" */ > - 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000c0 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000c8 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000d0 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000d8 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000e0 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000e8 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000f0 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000f8 "........" */ > - 0x00,0x00,0x0e,0x10,0x00,0x00,0x00,0x00, /* 00000100 "........" */ > + 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ > + 0x00,0x00,0x0A,0x0C,0x05,0x00,0x00,0x00, /* 000000A8 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x50, /* 000000B0 ".......P" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */ > + 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x18, /* 00000100 "........" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */ > - 0x00,0x00,0x0c,0x18,0x00,0x00,0x00,0x00, /* 00000110 "........" */ > - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */ > + 0x00,0x00,0x01,0x00,0x00,0x00,0x0D,0x18, /* 00000118 "........" */ > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */ > - 0x00,0x00 /* 00000128 ".. " */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00, /* 00000128 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0x10, /* 00000130 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x14, /* 00000140 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000148 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000150 "........" */ > + 0x00,0x00 /* 00000158 ".." */ > }; > > const unsigned char TemplateMcfg[] = > @@ -800,6 +864,56 @@ const unsigned char TemplateMsct[] = > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000088 "........" */ > }; > > +const unsigned char TemplateNfit[] = > +{ > + 0x4E,0x46,0x49,0x54,0x70,0x01,0x00,0x00, /* 00000000 "NFITp..." */ > + 0x01,0x53,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".SINTEL " */ > + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ > + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ > + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ > + 0x00,0x00,0x38,0x00,0x01,0x00,0x00,0x00, /* 00000028 "..8....." */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ > + 0x30,0x05,0xAF,0x91,0x86,0x5D,0x0E,0x47, /* 00000038 "0....].G" */ > + 0xA6,0xB0,0x0A,0x2D,0xB9,0x40,0x82,0x49, /* 00000040 "...-. at .I" */ > + 0x00,0x00,0x00,0x7C,0x03,0x00,0x00,0x00, /* 00000048 "...|...." */ > + 0x00,0x00,0x00,0x0C,0x00,0x00,0x00,0x00, /* 00000050 "........" */ > + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ > + 0x01,0x00,0x30,0x00,0x01,0x00,0x00,0x00, /* 00000060 "..0....." */ > + 0x04,0x00,0x00,0x00,0x01,0x00,0x01,0x00, /* 00000068 "........" */ > + 0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00, /* 00000070 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ > + 0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00, /* 00000080 "........" */ > + 0x01,0x00,0x03,0x00,0x2A,0x00,0x00,0x00, /* 00000088 "....*..." */ > + 0x02,0x00,0x20,0x00,0x01,0x00,0x00,0x00, /* 00000090 ".. ....." */ > + 0x04,0x00,0x00,0x00,0x00,0x01,0x00,0x00, /* 00000098 "........" */ > + 0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00, /* 000000A0 "........" */ > + 0x06,0x00,0x00,0x00,0x09,0x00,0x00,0x00, /* 000000A8 "........" */ > + 0x03,0x00,0x28,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "..(....." */ > + 0xB4,0x13,0x5D,0x40,0x91,0x0B,0x29,0x93, /* 000000B8 "..]@..)." */ > + 0x67,0xE8,0x23,0x4C,0x00,0x00,0x00,0x88, /* 000000C0 "g.#L...." */ > + 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77, /* 000000C8 ".."3DUfw" */ > + 0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF, /* 000000D0 "........" */ > + 0x04,0x00,0x50,0x00,0x01,0x00,0x86,0x80, /* 000000D8 "..P....." */ > + 0x17,0x20,0x01,0x00,0x86,0x80,0x17,0x20, /* 000000E0 ". ..... " */ > + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */ > + 0x89,0x00,0x54,0x76,0x01,0x03,0x00,0x01, /* 000000F0 "..Tv...." */ > + 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 ". ......" */ > + 0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */ > + 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */ > + 0x00,0x10,0x80,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */ > + 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */ > + 0x05,0x00,0x28,0x00,0x01,0x00,0x00,0x01, /* 00000128 "..(....." */ > + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */ > + 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 ". ......" */ > + 0x00,0x00,0x00,0xE0,0x0F,0x00,0x00,0x00, /* 00000140 "........" */ > + 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00, /* 00000148 "........" */ > + 0x06,0x00,0x20,0x00,0x01,0x00,0x00,0x00, /* 00000150 ".. ....." */ > + 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */ > + 0x00,0x00,0x00,0x18,0x04,0x00,0x00,0x00, /* 00000160 "........" */ > + 0x00,0x00,0x00,0x18,0x06,0x00,0x00,0x00 /* 00000168 "........" */ > +}; > + > const unsigned char TemplateMtmr[] = > { > 0x4D,0x54,0x4D,0x52,0x4C,0x00,0x00,0x00, /* 00000000 "MTMRL..." */ > @@ -1071,6 +1185,26 @@ const unsigned char TemplateSrat[] = > 0x00,0x00 /* 00000090 ".." */ > }; > > +const unsigned char TemplateStao[] = > +{ > + 0x53,0x54,0x41,0x4F,0x7E,0x00,0x00,0x00, /* 00000000 "STAO~..." */ > + 0x01,0x7F,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ > + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ > + 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ > + 0x10,0x04,0x15,0x20,0x01,0x5C,0x5F,0x53, /* 00000020 "... .\_S" */ > + 0x42,0x30,0x2E,0x42,0x55,0x53,0x30,0x2E, /* 00000028 "B0.BUS0." */ > + 0x44,0x45,0x56,0x31,0x00,0x5C,0x5F,0x53, /* 00000030 "DEV1.\_S" */ > + 0x42,0x30,0x2E,0x42,0x55,0x53,0x30,0x2E, /* 00000038 "B0.BUS0." */ > + 0x44,0x45,0x56,0x32,0x00,0x5C,0x5F,0x53, /* 00000040 "DEV2.\_S" */ > + 0x42,0x30,0x2E,0x42,0x55,0x53,0x31,0x2E, /* 00000048 "B0.BUS1." */ > + 0x44,0x45,0x56,0x31,0x2E,0x44,0x45,0x56, /* 00000050 "DEV1.DEV" */ > + 0x32,0x00,0x5C,0x5F,0x53,0x42,0x30,0x2E, /* 00000058 "2.\_SB0." */ > + 0x42,0x55,0x53,0x31,0x2E,0x44,0x45,0x56, /* 00000060 "BUS1.DEV" */ > + 0x32,0x2E,0x44,0x45,0x56,0x32,0x00,0x5C, /* 00000068 "2.DEV2.\" */ > + 0x55,0x53,0x42,0x31,0x2E,0x48,0x55,0x42, /* 00000070 "USB1.HUB" */ > + 0x31,0x2E,0x50,0x54,0x31,0x00 /* 00000078 "1.PT1." */ > +}; > + > const unsigned char TemplateTcpa[] = > { > 0x54,0x43,0x50,0x41,0x32,0x00,0x00,0x00, /* 00000000 "TCPA2..." */ > @@ -1167,6 +1301,41 @@ const unsigned char TemplateWdrt[] = > 0x00,0x00,0x00,0x00,0xFF,0xFF,0x00 /* 00000040 "......." */ > }; > > +const unsigned char TemplateWpbt[] = > +{ > + 0x57,0x50,0x42,0x54,0x98,0x00,0x00,0x00, /* 00000000 "WPBT...." */ > + 0x01,0x83,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ > + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ > + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ > + 0x10,0x04,0x15,0x20,0x78,0x56,0x34,0x12, /* 00000020 "... xV4." */ > + 0x00,0x00,0x00,0xBB,0x00,0x00,0x00,0xAA, /* 00000028 "........" */ > + 0x33,0x88,0x64,0x00,0x34,0x00,0x20,0x00, /* 00000030 "3.d.4. ." */ > + 0x73,0x00,0x63,0x00,0x6F,0x00,0x72,0x00, /* 00000038 "s.c.o.r." */ > + 0x65,0x00,0x20,0x00,0x61,0x00,0x6E,0x00, /* 00000040 "e. .a.n." */ > + 0x64,0x00,0x20,0x00,0x37,0x00,0x20,0x00, /* 00000048 "d. .7. ." */ > + 0x79,0x00,0x65,0x00,0x61,0x00,0x72,0x00, /* 00000050 "y.e.a.r." */ > + 0x73,0x00,0x20,0x00,0x61,0x00,0x67,0x00, /* 00000058 "s. .a.g." */ > + 0x6F,0x00,0x20,0x00,0x6F,0x00,0x75,0x00, /* 00000060 "o. .o.u." */ > + 0x72,0x00,0x20,0x00,0x66,0x00,0x61,0x00, /* 00000068 "r. .f.a." */ > + 0x74,0x00,0x68,0x00,0x65,0x00,0x72,0x00, /* 00000070 "t.h.e.r." */ > + 0x73,0x00,0x20,0x00,0x62,0x00,0x72,0x00, /* 00000078 "s. .b.r." */ > + 0x6F,0x00,0x75,0x00,0x67,0x00,0x68,0x00, /* 00000080 "o.u.g.h." */ > + 0x74,0x00,0x20,0x00,0x66,0x00,0x6F,0x00, /* 00000088 "t. .f.o." */ > + 0x72,0x00,0x74,0x00,0x68,0x00,0x00,0x00 /* 00000090 "r.t.h..." */ > +}; > + > +const unsigned char TemplateXenv[] = > +{ > + 0x58,0x45,0x4E,0x56,0x39,0x00,0x00,0x00, /* 00000000 "XENV9..." */ > + 0x01,0x3A,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".:INTEL " */ > + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ > + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ > + 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x10, /* 00000020 "... ...." */ > + 0x00,0x00,0x00,0x0A,0x00,0x20,0x00,0x00, /* 00000028 "..... .." */ > + 0x00,0x00,0x00,0x0B,0x25,0x00,0xBB,0xAA, /* 00000030 "....%..." */ > + 0x03 /* 00000038 "." */ > +}; > + > const unsigned char TemplateXsdt[] = > { > 0x58,0x53,0x44,0x54,0x64,0x00,0x00,0x00, /* 00000000 "XSDTd..." */ > diff --git a/src/acpica/source/compiler/dtutils.c b/src/acpica/source/compiler/dtutils.c > index 4b795c0..658cde6 100644 > --- a/src/acpica/source/compiler/dtutils.c > +++ b/src/acpica/source/compiler/dtutils.c > @@ -448,6 +448,7 @@ DtGetFieldType ( > > case ACPI_DMT_GAS: > case ACPI_DMT_HESTNTFY: > + case ACPI_DMT_IORTMEM: > > Type = DT_FIELD_TYPE_INLINE_SUBTABLE; > break; > @@ -592,6 +593,7 @@ DtGetFieldLength ( > case ACPI_DMT_UINT16: > case ACPI_DMT_DMAR: > case ACPI_DMT_HEST: > + case ACPI_DMT_NFIT: > case ACPI_DMT_PCI_PATH: > > ByteLength = 2; > @@ -659,6 +661,11 @@ DtGetFieldLength ( > ByteLength = sizeof (ACPI_HEST_NOTIFY); > break; > > + case ACPI_DMT_IORTMEM: > + > + ByteLength = sizeof (ACPI_IORT_MEMORY_ACCESS); > + break; > + > case ACPI_DMT_BUFFER: > case ACPI_DMT_RAW_BUFFER: > > diff --git a/src/acpica/source/compiler/preprocess.h b/src/acpica/source/compiler/preprocess.h > index 998a25a..39b35e8 100644 > --- a/src/acpica/source/compiler/preprocess.h > +++ b/src/acpica/source/compiler/preprocess.h > @@ -339,14 +339,18 @@ PrReplaceData ( > char *BufferToAdd, > UINT32 LengthToAdd); > > -void > +FILE * > PrOpenIncludeFile ( > - char *Filename); > + char *Filename, > + char *OpenMode, > + char **FullPathname); > > FILE * > PrOpenIncludeWithPrefix ( > char *PrefixDir, > - char *Filename); > + char *Filename, > + char *OpenMode, > + char **FullPathname); > > void > PrPushInputFileStack ( > diff --git a/src/acpica/source/compiler/prscan.c b/src/acpica/source/compiler/prscan.c > index d52a45e..cafcea5 100644 > --- a/src/acpica/source/compiler/prscan.c > +++ b/src/acpica/source/compiler/prscan.c > @@ -157,28 +157,42 @@ PrDbgPrint ( > char *Action, > char *DirectiveName); > > +static void > +PrDoIncludeBuffer ( > + char *Pathname, > + char *BufferName); > + > +static void > +PrDoIncludeFile ( > + char *Pathname); > + > > /* > * Supported preprocessor directives > + * Each entry is of the form "Name, ArgumentCount" > */ > static const PR_DIRECTIVE_INFO Gbl_DirectiveInfo[] = > { > - {"define", 1}, > - {"elif", 0}, /* Converted to #else..#if internally */ > - {"else", 0}, > - {"endif", 0}, > - {"error", 1}, > - {"if", 1}, > - {"ifdef", 1}, > - {"ifndef", 1}, > - {"include", 0}, /* Argument is not standard format, so 0 */ > - {"line", 1}, > - {"pragma", 1}, > - {"undef", 1}, > - {"warning", 1}, > - {NULL, 0} > + {"define", 1}, > + {"elif", 0}, /* Converted to #else..#if internally */ > + {"else", 0}, > + {"endif", 0}, > + {"error", 1}, > + {"if", 1}, > + {"ifdef", 1}, > + {"ifndef", 1}, > + {"include", 0}, /* Argument is not standard format, so just use 0 here */ > + {"includebuffer", 0}, /* Argument is not standard format, so just use 0 here */ > + {"line", 1}, > + {"loadbuffer", 0}, > + {"pragma", 1}, > + {"undef", 1}, > + {"warning", 1}, > + {NULL, 0} > }; > > +/* This table must match ordering of above table exactly */ > + > enum Gbl_DirectiveIndexes > { > PR_DIRECTIVE_DEFINE = 0, > @@ -190,6 +204,7 @@ enum Gbl_DirectiveIndexes > PR_DIRECTIVE_IFDEF, > PR_DIRECTIVE_IFNDEF, > PR_DIRECTIVE_INCLUDE, > + PR_DIRECTIVE_INCLUDEBUFFER, > PR_DIRECTIVE_LINE, > PR_DIRECTIVE_PRAGMA, > PR_DIRECTIVE_UNDEF, > @@ -454,13 +469,6 @@ PrPreprocessInputFile ( > Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, &Next); > } > > -#if 0 > -/* Line prefix */ > - FlPrintFile (ASL_FILE_PREPROCESSOR, "/* %14s %.5u i:%.5u */ ", > - Gbl_Files[ASL_FILE_INPUT].Filename, > - Gbl_CurrentLineNumber, Gbl_PreprocessorLineNumber); > -#endif > - > /* > * Emit a #line directive if necessary, to keep the line numbers in > * the (.i) file synchronized with the original source code file, so > @@ -505,7 +513,7 @@ PrDoDirective ( > char **Next) > { > char *Token = Gbl_MainTokenBuffer; > - char *Token2; > + char *Token2 = NULL; > char *End; > UINT64 Value; > ACPI_SIZE TokenOffset; > @@ -524,7 +532,7 @@ PrDoDirective ( > PrError (ASL_ERROR, ASL_MSG_UNKNOWN_DIRECTIVE, > THIS_TOKEN_OFFSET (DirectiveToken)); > > - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID > + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID > "#%s: Unknown directive\n", > Gbl_CurrentLineNumber, DirectiveToken); > return; > @@ -611,7 +619,7 @@ PrDoDirective ( > > /* Most directives have at least one argument */ > > - if (Gbl_DirectiveInfo[Directive].ArgCount == 1) > + if (Gbl_DirectiveInfo[Directive].ArgCount >= 1) > { > Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); > if (!Token) > @@ -620,6 +628,15 @@ PrDoDirective ( > } > } > > + if (Gbl_DirectiveInfo[Directive].ArgCount >= 2) > + { > + Token2 = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); > + if (!Token2) > + { > + goto SyntaxError; > + } > + } > + > /* > * At this point, if we are ignoring the current code block, > * do not process any more directives (i.e., ignore them also.) > @@ -671,7 +688,7 @@ PrDoDirective ( > Gbl_IgnoringThisCodeBlock = TRUE; > } > > - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID > + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID > "Resolved #if: %8.8X%8.8X %s\n", > Gbl_CurrentLineNumber, ACPI_FORMAT_UINT64 (Value), > Gbl_IgnoringThisCodeBlock ? "" : ""); > @@ -744,7 +761,7 @@ PrDoDirective ( > Token2 = ""; > } > #endif > - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID > + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID > "New #define: %s->%s\n", > Gbl_CurrentLineNumber, Token, Token2); > > @@ -772,11 +789,32 @@ PrDoDirective ( > goto SyntaxError; > } > > - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID > + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID > "Start #include file \"%s\"\n", Gbl_CurrentLineNumber, > Token, Gbl_CurrentLineNumber); > > - PrOpenIncludeFile (Token); > + PrDoIncludeFile (Token); > + break; > + > + case PR_DIRECTIVE_INCLUDEBUFFER: > + > + Token = PrGetNextToken (NULL, " \"<>", Next); > + if (!Token) > + { > + goto SyntaxError; > + } > + > + Token2 = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, Next); > + if (!Token2) > + { > + goto SyntaxError; > + } > + > + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID > + "Start #includebuffer input from file \"%s\", buffer name %s\n", > + Gbl_CurrentLineNumber, Token, Token2); > + > + PrDoIncludeBuffer (Token, Token2); > break; > > case PR_DIRECTIVE_LINE: > @@ -790,7 +828,7 @@ PrDoDirective ( > return; > } > > - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID > + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID > "User #line invocation %s\n", Gbl_CurrentLineNumber, > Token); > > @@ -840,7 +878,7 @@ PrDoDirective ( > > case PR_DIRECTIVE_UNDEF: > > - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID > + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID > "#undef: %s\n", Gbl_CurrentLineNumber, Token); > > PrRemoveDefine (Token); > @@ -855,7 +893,7 @@ PrDoDirective ( > default: > > /* Should never get here */ > - DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID > + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID > "Unrecognized directive: %u\n", > Gbl_CurrentLineNumber, Directive); > break; > @@ -1026,9 +1064,92 @@ PrDbgPrint ( > { > > DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] " > - "%*s %s #%s, Depth %u\n", > + "%*s %s #%s, IfDepth %u\n", > Gbl_CurrentLineNumber, Gbl_IfDepth, > Gbl_IgnoringThisCodeBlock ? "I" : "E", > Gbl_IfDepth * 4, " ", > Action, DirectiveName, Gbl_IfDepth); > } > + > + > +/******************************************************************************* > + * > + * FUNCTION: PrDoIncludeFile > + * > + * PARAMETERS: Pathname - Name of the input file > + * > + * RETURN: None. > + * > + * DESCRIPTION: Open an include file, from #include. > + * > + ******************************************************************************/ > + > +static void > +PrDoIncludeFile ( > + char *Pathname) > +{ > + char *FullPathname; > + > + > + (void) PrOpenIncludeFile (Pathname, "r", &FullPathname); > +} > + > + > +/******************************************************************************* > + * > + * FUNCTION: PrDoIncludeBuffer > + * > + * PARAMETERS: Pathname - Name of the input binary file > + * BufferName - ACPI namepath of the buffer > + * > + * RETURN: None. > + * > + * DESCRIPTION: Create an ACPI buffer object from a binary file. The contents > + * of the file are emitted into the buffer object as ascii > + * hex data. From #includebuffer. > + * > + ******************************************************************************/ > + > +static void > +PrDoIncludeBuffer ( > + char *Pathname, > + char *BufferName) > +{ > + char *FullPathname; > + FILE *BinaryBufferFile; > + UINT32 i = 0; > + UINT8 c; > + > + > + BinaryBufferFile = PrOpenIncludeFile (Pathname, "rb", &FullPathname); > + if (!BinaryBufferFile) > + { > + return; > + } > + > + /* Emit "Name (XXXX, Buffer() {" header */ > + > + FlPrintFile (ASL_FILE_PREPROCESSOR, "Name (%s, Buffer()\n{", BufferName); > + > + /* Dump the entire file in ascii hex format */ > + > + while (fread (&c, 1, 1, BinaryBufferFile)) > + { > + if (!(i % 8)) > + { > + FlPrintFile (ASL_FILE_PREPROCESSOR, "\n ", c); > + } > + > + FlPrintFile (ASL_FILE_PREPROCESSOR, " 0x%2.2X,", c); > + i++; > + } > + > + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID > + "#includebuffer: read %u bytes from %s\n", > + Gbl_CurrentLineNumber, i, FullPathname); > + > + /* Close the Name() operator */ > + > + FlPrintFile (ASL_FILE_PREPROCESSOR, "\n})\n", BufferName); > + fclose (BinaryBufferFile); > +} > diff --git a/src/acpica/source/compiler/prutils.c b/src/acpica/source/compiler/prutils.c > index 10d65a5..329f6d0 100644 > --- a/src/acpica/source/compiler/prutils.c > +++ b/src/acpica/source/compiler/prutils.c > @@ -310,9 +310,11 @@ PrReplaceData ( > * > ******************************************************************************/ > > -void > +FILE * > PrOpenIncludeFile ( > - char *Filename) > + char *Filename, > + char *OpenMode, > + char **FullPathname) > { > FILE *IncludeFile; > ASL_INCLUDE_DIR *NextDir; > @@ -329,12 +331,13 @@ PrOpenIncludeFile ( > (Filename[0] == '\\') || > (Filename[1] == ':')) > { > - IncludeFile = PrOpenIncludeWithPrefix ("", Filename); > + IncludeFile = PrOpenIncludeWithPrefix ( > + "", Filename, OpenMode, FullPathname); > if (!IncludeFile) > { > goto ErrorExit; > } > - return; > + return (IncludeFile); > } > > /* > @@ -345,10 +348,11 @@ PrOpenIncludeFile ( > * > * Construct the file pathname from the global directory name. > */ > - IncludeFile = PrOpenIncludeWithPrefix (Gbl_DirectoryPath, Filename); > + IncludeFile = PrOpenIncludeWithPrefix ( > + Gbl_DirectoryPath, Filename, OpenMode, FullPathname); > if (IncludeFile) > { > - return; > + return (IncludeFile); > } > > /* > @@ -358,10 +362,11 @@ PrOpenIncludeFile ( > NextDir = Gbl_IncludeDirList; > while (NextDir) > { > - IncludeFile = PrOpenIncludeWithPrefix (NextDir->Dir, Filename); > + IncludeFile = PrOpenIncludeWithPrefix ( > + NextDir->Dir, Filename, OpenMode, FullPathname); > if (IncludeFile) > { > - return; > + return (IncludeFile); > } > > NextDir = NextDir->Next; > @@ -372,6 +377,7 @@ PrOpenIncludeFile ( > ErrorExit: > sprintf (Gbl_MainTokenBuffer, "%s, %s", Filename, strerror (errno)); > PrError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, 0); > + return (NULL); > } > > > @@ -392,7 +398,9 @@ ErrorExit: > FILE * > PrOpenIncludeWithPrefix ( > char *PrefixDir, > - char *Filename) > + char *Filename, > + char *OpenMode, > + char **FullPathname) > { > FILE *IncludeFile; > char *Pathname; > @@ -408,7 +416,7 @@ PrOpenIncludeWithPrefix ( > > /* Attempt to open the file, push if successful */ > > - IncludeFile = fopen (Pathname, "r"); > + IncludeFile = fopen (Pathname, OpenMode); > if (!IncludeFile) > { > fprintf (stderr, "Could not open include file %s\n", Pathname); > @@ -418,6 +426,7 @@ PrOpenIncludeWithPrefix ( > /* Push the include file on the open input file stack */ > > PrPushInputFileStack (IncludeFile, Pathname); > + *FullPathname = Pathname; > return (IncludeFile); > } > > diff --git a/src/acpica/source/components/debugger/dbfileio.c b/src/acpica/source/components/debugger/dbfileio.c > index 768d87c..dc55c6e 100644 > --- a/src/acpica/source/components/debugger/dbfileio.c > +++ b/src/acpica/source/components/debugger/dbfileio.c > @@ -288,7 +288,8 @@ AeLocalLoadTable ( > ACPI_STATUS > AcpiDbGetTableFromFile ( > char *Filename, > - ACPI_TABLE_HEADER **ReturnTable) > + ACPI_TABLE_HEADER **ReturnTable, > + BOOLEAN MustBeAmlFile) > { > #ifdef ACPI_APPLICATION > ACPI_STATUS Status; > @@ -302,9 +303,18 @@ AcpiDbGetTableFromFile ( > return (Status); > } > > -#ifdef ACPI_DATA_TABLE_DISASSEMBLY > - IsAmlTable = AcpiUtIsAmlTable (Table); > -#endif > + if (MustBeAmlFile) > + { > + IsAmlTable = AcpiUtIsAmlTable (Table); > + if (!IsAmlTable) > + { > + ACPI_EXCEPTION ((AE_INFO, AE_OK, > + "Input for -e is not an AML table: " > + "\"%4.4s\" (must be DSDT/SSDT)", > + Table->Signature)); > + return (AE_TYPE); > + } > + } > > if (IsAmlTable) > { > diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c > index fe34a90..573f384 100644 > --- a/src/acpica/source/components/debugger/dbinput.c > +++ b/src/acpica/source/components/debugger/dbinput.c > @@ -1041,7 +1041,7 @@ AcpiDbCommandDispatch ( > > case CMD_LOAD: > > - Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL); > + Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL, FALSE); > break; > > case CMD_LOCKS: > diff --git a/src/acpica/source/components/dispatcher/dsmethod.c b/src/acpica/source/components/dispatcher/dsmethod.c > index 43ee55d..2e37795 100644 > --- a/src/acpica/source/components/dispatcher/dsmethod.c > +++ b/src/acpica/source/components/dispatcher/dsmethod.c > @@ -195,6 +195,7 @@ AcpiDsAutoSerializeMethod ( > WalkState = AcpiDsCreateWalkState (Node->OwnerId, NULL, NULL, NULL); > if (!WalkState) > { > + AcpiPsFreeOp (Op); > return_ACPI_STATUS (AE_NO_MEMORY); > } > > @@ -203,6 +204,7 @@ AcpiDsAutoSerializeMethod ( > if (ACPI_FAILURE (Status)) > { > AcpiDsDeleteWalkState (WalkState); > + AcpiPsFreeOp (Op); > return_ACPI_STATUS (Status); > } > > @@ -211,10 +213,6 @@ AcpiDsAutoSerializeMethod ( > /* Parse the method, scan for creation of named objects */ > > Status = AcpiPsParseAml (WalkState); > - if (ACPI_FAILURE (Status)) > - { > - return_ACPI_STATUS (Status); > - } > > AcpiPsDeleteParseTree (Op); > return_ACPI_STATUS (Status); > diff --git a/src/acpica/source/components/hardware/hwpci.c b/src/acpica/source/components/hardware/hwpci.c > index da7674c..0d07fe1 100644 > --- a/src/acpica/source/components/hardware/hwpci.c > +++ b/src/acpica/source/components/hardware/hwpci.c > @@ -212,7 +212,7 @@ AcpiHwDerivePciId ( > ACPI_HANDLE PciRegion) > { > ACPI_STATUS Status; > - ACPI_PCI_DEVICE *ListHead = NULL; > + ACPI_PCI_DEVICE *ListHead; > > > ACPI_FUNCTION_TRACE (HwDerivePciId); > @@ -270,7 +270,6 @@ AcpiHwBuildPciList ( > ACPI_HANDLE ParentDevice; > ACPI_STATUS Status; > ACPI_PCI_DEVICE *ListElement; > - ACPI_PCI_DEVICE *ListHead = NULL; > > > /* > @@ -278,6 +277,7 @@ AcpiHwBuildPciList ( > * a list of device nodes. Loop will exit when either the PCI device is > * found, or the root of the namespace is reached. > */ > + *ReturnListHead = NULL; > CurrentDevice = PciRegion; > while (1) > { > @@ -294,7 +294,6 @@ AcpiHwBuildPciList ( > > if (ParentDevice == RootPciDevice) > { > - *ReturnListHead = ListHead; > return (AE_OK); > } > > @@ -309,9 +308,9 @@ AcpiHwBuildPciList ( > > /* Put new element at the head of the list */ > > - ListElement->Next = ListHead; > + ListElement->Next = *ReturnListHead; > ListElement->Device = ParentDevice; > - ListHead = ListElement; > + *ReturnListHead = ListElement; > > CurrentDevice = ParentDevice; > } > diff --git a/src/acpica/source/components/namespace/nsprepkg.c b/src/acpica/source/components/namespace/nsprepkg.c > index 085ccd2..627ee3e 100644 > --- a/src/acpica/source/components/namespace/nsprepkg.c > +++ b/src/acpica/source/components/namespace/nsprepkg.c > @@ -393,6 +393,13 @@ AcpiNsCheckPackage ( > Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); > break; > > + case ACPI_PTYPE2_VAR_VAR: > + /* > + * Returns a variable list of packages, each with a variable list > + * of objects. > + */ > + break; > + > case ACPI_PTYPE2_UUID_PAIR: > > /* The package must contain pairs of (UUID + type) */ > @@ -562,6 +569,12 @@ AcpiNsCheckPackageList ( > } > break; > > + case ACPI_PTYPE2_VAR_VAR: > + /* > + * Each subpackage has a fixed or variable number of elements > + */ > + break; > + > case ACPI_PTYPE2_FIXED: > > /* Each subpackage has a fixed length */ > diff --git a/src/acpica/source/components/namespace/nsrepair.c b/src/acpica/source/components/namespace/nsrepair.c > index 736933a..fbb9c7e 100644 > --- a/src/acpica/source/components/namespace/nsrepair.c > +++ b/src/acpica/source/components/namespace/nsrepair.c > @@ -595,10 +595,10 @@ AcpiNsRemoveNullElements ( > case ACPI_PTYPE2_MIN: > case ACPI_PTYPE2_REV_FIXED: > case ACPI_PTYPE2_FIX_VAR: > - > break; > > default: > + case ACPI_PTYPE2_VAR_VAR: > case ACPI_PTYPE1_FIXED: > case ACPI_PTYPE1_OPTION: > return; > diff --git a/src/acpica/source/components/parser/psopinfo.c b/src/acpica/source/components/parser/psopinfo.c > index e0fbd89..4a26ae7 100644 > --- a/src/acpica/source/components/parser/psopinfo.c > +++ b/src/acpica/source/components/parser/psopinfo.c > @@ -124,9 +124,6 @@ > ACPI_MODULE_NAME ("psopinfo") > > > -extern const UINT8 AcpiGbl_ShortOpIndex[]; > -extern const UINT8 AcpiGbl_LongOpIndex[]; > - > static const UINT8 AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6}; > > > diff --git a/src/acpica/source/components/utilities/utfileio.c b/src/acpica/source/components/utilities/utfileio.c > index e24e81f..5b78379 100644 > --- a/src/acpica/source/components/utilities/utfileio.c > +++ b/src/acpica/source/components/utilities/utfileio.c > @@ -300,11 +300,8 @@ AcpiUtReadTable ( > TableHeader.Length, FileSize); > > #ifdef ACPI_ASL_COMPILER > - Status = FlCheckForAscii (fp, NULL, FALSE); > - if (ACPI_SUCCESS (Status)) > - { > - AcpiOsPrintf ("File appears to be ASCII only, must be binary\n"); > - } > + AcpiOsPrintf ("File is corrupt or is ASCII text -- " > + "it must be a binary file\n"); > #endif > return (AE_BAD_HEADER); > } > @@ -416,7 +413,7 @@ AcpiUtReadTableFromFile ( > > /* Get the entire file */ > > - fprintf (stderr, "Loading Acpi table from file %10s - Length %.8u (%06X)\n", > + fprintf (stderr, "Reading ACPI table from file %10s - Length %.8u (0x%06X)\n", > Filename, FileSize, FileSize); > > Status = AcpiUtReadTable (File, Table, &TableLength); > diff --git a/src/acpica/source/components/utilities/uthex.c b/src/acpica/source/components/utilities/uthex.c > index 500ab40..c652f6a 100644 > --- a/src/acpica/source/components/utilities/uthex.c > +++ b/src/acpica/source/components/utilities/uthex.c > @@ -154,9 +154,9 @@ AcpiUtHexToAsciiChar ( > > /******************************************************************************* > * > - * FUNCTION: AcpiUtHexCharToValue > + * FUNCTION: AcpiUtAsciiCharToHex > * > - * PARAMETERS: AsciiChar - Hex character in Ascii > + * PARAMETERS: HexChar - Hex character in Ascii > * > * RETURN: The binary value of the ascii/hex character > * > diff --git a/src/acpica/source/components/utilities/utxferror.c b/src/acpica/source/components/utilities/utxferror.c > index bdbab99..b62e5df 100644 > --- a/src/acpica/source/components/utilities/utxferror.c > +++ b/src/acpica/source/components/utilities/utxferror.c > @@ -195,8 +195,18 @@ AcpiException ( > > > ACPI_MSG_REDIRECT_BEGIN; > - AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status)); > > + /* For AE_OK, just print the message */ > + > + if (ACPI_SUCCESS (Status)) > + { > + AcpiOsPrintf (ACPI_MSG_EXCEPTION); > + > + } > + else > + { > + AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status)); > + } > va_start (ArgList, Format); > AcpiOsVprintf (Format, ArgList); > ACPI_MSG_SUFFIX; > diff --git a/src/acpica/source/include/acdebug.h b/src/acpica/source/include/acdebug.h > index 3c823e8..2d91725 100644 > --- a/src/acpica/source/include/acdebug.h > +++ b/src/acpica/source/include/acdebug.h > @@ -447,7 +447,8 @@ AcpiDbLoadAcpiTable ( > ACPI_STATUS > AcpiDbGetTableFromFile ( > char *Filename, > - ACPI_TABLE_HEADER **Table); > + ACPI_TABLE_HEADER **Table, > + BOOLEAN MustBeAmlTable); > > > /* > diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h > index 5776d5d..30fbece 100644 > --- a/src/acpica/source/include/acdisasm.h > +++ b/src/acpica/source/include/acdisasm.h > @@ -132,7 +132,7 @@ > #define ACPI_RAW_TABLE_DATA_HEADER "Raw Table Data" > > > -typedef const struct acpi_dmtable_info > +typedef struct acpi_dmtable_info > { > UINT8 Opcode; > UINT16 Offset; > @@ -220,9 +220,11 @@ typedef enum > ACPI_DMT_HEST, > ACPI_DMT_HESTNTFY, > ACPI_DMT_HESTNTYP, > + ACPI_DMT_IORTMEM, > ACPI_DMT_IVRS, > ACPI_DMT_LPIT, > ACPI_DMT_MADT, > + ACPI_DMT_NFIT, > ACPI_DMT_PCCT, > ACPI_DMT_PMTT, > ACPI_DMT_SLIC, > @@ -250,7 +252,6 @@ typedef struct acpi_dmtable_data > ACPI_DMTABLE_HANDLER TableHandler; > ACPI_CMTABLE_HANDLER CmTableHandler; > const unsigned char *Template; > - char *Name; > > } ACPI_DMTABLE_DATA; > > @@ -318,6 +319,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt0[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2a[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Device[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbg2Addr[]; > @@ -334,6 +336,11 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar4[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm0[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm0a[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm1[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm1a[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoDrtm2[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[]; > @@ -344,6 +351,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt5[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt6[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdtHdr[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt0[]; > @@ -369,6 +377,20 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpitHdr[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit0[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit1[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort0[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort0a[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort1[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort1a[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort2[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3a[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3b[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort3c[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortAcc[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortHdr[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortMap[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortPad[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[]; > @@ -393,6 +415,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt11[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt12[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt13[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt14[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt15[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[]; > @@ -407,6 +430,18 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoMtmr0[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfitHdr[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit0[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit1[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit2[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit2a[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit3[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit3a[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit4[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit5[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt0[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1[]; > @@ -434,6 +469,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoStao[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[]; > @@ -444,14 +481,17 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoWddt[]; > extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt0[]; > +extern ACPI_DMTABLE_INFO AcpiDmTableInfoXenv[]; > > extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2]; > > - > /* > - * dmtable > + * dmtable and ahtable > */ > -extern ACPI_DMTABLE_DATA AcpiDmTableData[]; > +extern const ACPI_DMTABLE_DATA AcpiDmTableData[]; > +extern const AH_TABLE AcpiSupportedTables[]; > > UINT8 > AcpiDmGenerateChecksum ( > @@ -459,7 +499,7 @@ AcpiDmGenerateChecksum ( > UINT32 Length, > UINT8 OriginalChecksum); > > -ACPI_DMTABLE_DATA * > +const ACPI_DMTABLE_DATA * > AcpiDmGetTableData ( > char *Signature); > > @@ -498,8 +538,13 @@ AcpiDmDumpBuffer ( > UINT32 BufferOffset, > UINT32 Length, > UINT32 AbsoluteOffset, > - char *Header, > - BOOLEAN MultiLine); > + char *Header); > + > +void > +AcpiDmDumpUnicode ( > + void *Table, > + UINT32 BufferOffset, > + UINT32 ByteLength); > > void > AcpiDmDumpAsf ( > @@ -522,6 +567,10 @@ AcpiDmDumpDmar ( > ACPI_TABLE_HEADER *Table); > > void > +AcpiDmDumpDrtm ( > + ACPI_TABLE_HEADER *Table); > + > +void > AcpiDmDumpEinj ( > ACPI_TABLE_HEADER *Table); > > @@ -546,6 +595,10 @@ AcpiDmDumpHest ( > ACPI_TABLE_HEADER *Table); > > void > +AcpiDmDumpIort ( > + ACPI_TABLE_HEADER *Table); > + > +void > AcpiDmDumpIvrs ( > ACPI_TABLE_HEADER *Table); > > @@ -574,6 +627,10 @@ AcpiDmDumpMtmr ( > ACPI_TABLE_HEADER *Table); > > void > +AcpiDmDumpNfit ( > + ACPI_TABLE_HEADER *Table); > + > +void > AcpiDmDumpPcct ( > ACPI_TABLE_HEADER *Table); > > @@ -606,6 +663,10 @@ AcpiDmDumpSrat ( > ACPI_TABLE_HEADER *Table); > > void > +AcpiDmDumpStao ( > + ACPI_TABLE_HEADER *Table); > + > +void > AcpiDmDumpVrtc ( > ACPI_TABLE_HEADER *Table); > > @@ -614,6 +675,10 @@ AcpiDmDumpWdat ( > ACPI_TABLE_HEADER *Table); > > void > +AcpiDmDumpWpbt ( > + ACPI_TABLE_HEADER *Table); > + > +void > AcpiDmDumpXsdt ( > ACPI_TABLE_HEADER *Table); > > diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h > index 9e0d08d..dc7a2eb 100644 > --- a/src/acpica/source/include/aclocal.h > +++ b/src/acpica/source/include/aclocal.h > @@ -473,12 +473,24 @@ typedef struct acpi_package_info3 > > } ACPI_PACKAGE_INFO3; > > +typedef struct acpi_package_info4 > +{ > + UINT8 Type; > + UINT8 ObjectType1; > + UINT8 Count1; > + UINT8 SubObjectTypes; > + UINT8 PkgCount; > + UINT16 Reserved; > + > +} ACPI_PACKAGE_INFO4; > + > typedef union acpi_predefined_info > { > ACPI_NAME_INFO Info; > ACPI_PACKAGE_INFO RetInfo; > ACPI_PACKAGE_INFO2 RetInfo2; > ACPI_PACKAGE_INFO3 RetInfo3; > + ACPI_PACKAGE_INFO4 RetInfo4; > > } ACPI_PREDEFINED_INFO; > > @@ -1443,4 +1455,11 @@ typedef struct ah_uuid > > } AH_UUID; > > +typedef struct ah_table > +{ > + char *Signature; > + char *Description; > + > +} AH_TABLE; > + > #endif /* __ACLOCAL_H__ */ > diff --git a/src/acpica/source/include/acparser.h b/src/acpica/source/include/acparser.h > index abbde50..e4fc0c7 100644 > --- a/src/acpica/source/include/acparser.h > +++ b/src/acpica/source/include/acparser.h > @@ -144,6 +144,9 @@ > * > *****************************************************************************/ > > +extern const UINT8 AcpiGbl_ShortOpIndex[]; > +extern const UINT8 AcpiGbl_LongOpIndex[]; > + > > /* > * psxface - Parser external interfaces > diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h > index 74de05e..93d4284 100644 > --- a/src/acpica/source/include/acpixf.h > +++ b/src/acpica/source/include/acpixf.h > @@ -118,7 +118,7 @@ > > /* Current ACPICA subsystem version in YYYYMMDD format */ > > -#define ACPI_CA_VERSION 0x20150410 > +#define ACPI_CA_VERSION 0x20150515 > > #include "acconfig.h" > #include "actypes.h" > diff --git a/src/acpica/source/include/acpredef.h b/src/acpica/source/include/acpredef.h > index b03f64b..37f0244 100644 > --- a/src/acpica/source/include/acpredef.h > +++ b/src/acpica/source/include/acpredef.h > @@ -178,6 +178,11 @@ > * count = 0 (optional) > * (Used for _DLM) > * > + * ACPI_PTYPE2_VAR_VAR: Variable number of subpackages, each of either a > + * constant or variable length. The subpackages are preceded by a > + * constant number of objects. > + * (Used for _LPI, _RDI) > + * > * ACPI_PTYPE2_UUID_PAIR: Each subpackage is preceded by a UUID Buffer. The UUID > * defines the format of the package. Zero-length parent package is > * allowed. > @@ -197,7 +202,8 @@ enum AcpiReturnPackageTypes > ACPI_PTYPE2_MIN = 8, > ACPI_PTYPE2_REV_FIXED = 9, > ACPI_PTYPE2_FIX_VAR = 10, > - ACPI_PTYPE2_UUID_PAIR = 11 > + ACPI_PTYPE2_VAR_VAR = 11, > + ACPI_PTYPE2_UUID_PAIR = 12 > }; > > > @@ -249,7 +255,7 @@ enum AcpiReturnPackageTypes > * These are the names that can actually be evaluated via AcpiEvaluateObject. > * Not present in this table are the following: > * > - * 1) Predefined/Reserved names that are never evaluated via > + * 1) Predefined/Reserved names that are not usually evaluated via > * AcpiEvaluateObject: > * _Lxx and _Exx GPE methods > * _Qxx EC methods > @@ -435,6 +441,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = > METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */ > PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4,0,0,0), > > + {{"_BTH", METHOD_1ARGS (ACPI_TYPE_INTEGER), /* ACPI 6.0 */ > + METHOD_NO_RETURN_VALUE}}, > + > {{"_BTM", METHOD_1ARGS (ACPI_TYPE_INTEGER), > METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > > @@ -462,6 +471,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = > METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Bufs) */ > PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0,0,0,0), > > + {{"_CR3", METHOD_0ARGS, /* ACPI 6.0 */ > + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > + > {{"_CRS", METHOD_0ARGS, > METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, > > @@ -515,7 +527,7 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = > {{"_DOS", METHOD_1ARGS (ACPI_TYPE_INTEGER), > METHOD_NO_RETURN_VALUE}}, > > - {{"_DSD", METHOD_0ARGS, > + {{"_DSD", METHOD_0ARGS, /* ACPI 6.0 */ > METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Buf, 1 Pkg */ > PACKAGE_INFO (ACPI_PTYPE2_UUID_PAIR, ACPI_RTYPE_BUFFER, 1, ACPI_RTYPE_PACKAGE, 1,0), > > @@ -669,6 +681,11 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = > METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Int) */ > PACKAGE_INFO (ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 2,0,0,0), > > + {{"_LPI", METHOD_0ARGS, /* ACPI 6.0 */ > + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (3 Int, n Pkg (10 Int/Buf) */ > + PACKAGE_INFO (ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 3, > + ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER | ACPI_RTYPE_STRING, 10,0), > + > {{"_MAT", METHOD_0ARGS, > METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, > > @@ -686,6 +703,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = > {{"_MSM", METHOD_4ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), > METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > > + {{"_MTL", METHOD_0ARGS, /* ACPI 6.0 */ > + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > + > {{"_NTT", METHOD_0ARGS, > METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > > @@ -773,6 +793,10 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = > METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ > PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), > > + {{"_PRR", METHOD_0ARGS, /* ACPI 6.0 */ > + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Ref) */ > + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_REFERENCE, 1,0,0,0), > + > {{"_PRS", METHOD_0ARGS, > METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, > > @@ -850,6 +874,11 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = > {{"_PXM", METHOD_0ARGS, > METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > > + {{"_RDI", METHOD_0ARGS, /* ACPI 6.0 */ > + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int, n Pkg (m Ref)) */ > + PACKAGE_INFO (ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 1, > + ACPI_RTYPE_REFERENCE,0,0), > + > {{"_REG", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), > METHOD_NO_RETURN_VALUE}}, > > @@ -862,6 +891,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = > {{"_ROM", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), > METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, > > + {{"_RST", METHOD_0ARGS, /* ACPI 6.0 */ > + METHOD_NO_RETURN_VALUE}}, > + > {{"_RTV", METHOD_0ARGS, > METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > > @@ -988,6 +1020,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = > {{"_TDL", METHOD_0ARGS, > METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > > + {{"_TFP", METHOD_0ARGS, /* ACPI 6.0 */ > + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > + > {{"_TIP", METHOD_1ARGS (ACPI_TYPE_INTEGER), > METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > > @@ -1011,6 +1046,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = > METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int with count */ > PACKAGE_INFO (ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0,0,0), > > + {{"_TSN", METHOD_0ARGS, /* ACPI 6.0 */ > + METHOD_RETURNS (ACPI_RTYPE_REFERENCE)}}, > + > {{"_TSP", METHOD_0ARGS, > METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, > > diff --git a/src/acpica/source/include/actbl.h b/src/acpica/source/include/actbl.h > index 68bbed4..f3cf709 100644 > --- a/src/acpica/source/include/actbl.h > +++ b/src/acpica/source/include/actbl.h > @@ -382,6 +382,7 @@ typedef struct acpi_table_fadt > ACPI_GENERIC_ADDRESS XGpe1Block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ > ACPI_GENERIC_ADDRESS SleepControl; /* 64-bit Sleep Control register (ACPI 5.0) */ > ACPI_GENERIC_ADDRESS SleepStatus; /* 64-bit Sleep Status register (ACPI 5.0) */ > + UINT64 HypervisorId; /* Hypervisor Vendor ID (ACPI 6.0) */ > > } ACPI_TABLE_FADT; > > @@ -441,7 +442,7 @@ enum AcpiPreferredPmProfiles > PM_TABLET = 8 > }; > > -/* Values for SleepStatus and SleepControl registers (V5 FADT) */ > +/* Values for SleepStatus and SleepControl registers (V5+ FADT) */ > > #define ACPI_X_WAKE_STATUS 0x80 > #define ACPI_X_SLEEP_TYPE_MASK 0x1C > @@ -506,15 +507,17 @@ typedef struct acpi_table_desc > * FADT is the bottom line as to what the version really is. > * > * For reference, the values below are as follows: > - * FADT V1 size: 0x074 > - * FADT V2 size: 0x084 > - * FADT V3 size: 0x0F4 > - * FADT V4 size: 0x0F4 > - * FADT V5 size: 0x10C > + * FADT V1 size: 0x074 > + * FADT V2 size: 0x084 > + * FADT V3 size: 0x0F4 > + * FADT V4 size: 0x0F4 > + * FADT V5 size: 0x10C > + * FADT V6 size: 0x114 > */ > #define ACPI_FADT_V1_SIZE (UINT32) (ACPI_FADT_OFFSET (Flags) + 4) > #define ACPI_FADT_V2_SIZE (UINT32) (ACPI_FADT_OFFSET (MinorRevision) + 1) > #define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl)) > -#define ACPI_FADT_V5_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) > +#define ACPI_FADT_V5_SIZE (UINT32) (ACPI_FADT_OFFSET (HypervisorId)) > +#define ACPI_FADT_V6_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) > > #endif /* __ACTBL_H__ */ > diff --git a/src/acpica/source/include/actbl1.h b/src/acpica/source/include/actbl1.h > index 2c8b0ed..1c508a0 100644 > --- a/src/acpica/source/include/actbl1.h > +++ b/src/acpica/source/include/actbl1.h > @@ -145,6 +145,7 @@ > #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ > #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ > #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ > +#define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */ > > > /* > @@ -849,7 +850,8 @@ enum AcpiMadtType > ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, > ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13, > ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14, > - ACPI_MADT_TYPE_RESERVED = 15 /* 15 and greater are reserved */ > + ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15, > + ACPI_MADT_TYPE_RESERVED = 16 /* 16 and greater are reserved */ > }; > > > @@ -1004,7 +1006,7 @@ typedef struct acpi_madt_local_x2apic_nmi > } ACPI_MADT_LOCAL_X2APIC_NMI; > > > -/* 11: Generic Interrupt (ACPI 5.0) */ > +/* 11: Generic Interrupt (ACPI 5.0 + ACPI 6.0 changes) */ > > typedef struct acpi_madt_generic_interrupt > { > @@ -1022,6 +1024,8 @@ typedef struct acpi_madt_generic_interrupt > UINT32 VgicInterrupt; > UINT64 GicrBaseAddress; > UINT64 ArmMpidr; > + UINT8 EfficiencyClass; > + UINT8 Reserved2[3]; > > } ACPI_MADT_GENERIC_INTERRUPT; > > @@ -1032,7 +1036,7 @@ typedef struct acpi_madt_generic_interrupt > #define ACPI_MADT_VGIC_IRQ_MODE (1<<2) /* 02: VGIC Maintenance Interrupt mode */ > > > -/* 12: Generic Distributor (ACPI 5.0) */ > +/* 12: Generic Distributor (ACPI 5.0 + ACPI 6.0 changes) */ > > typedef struct acpi_madt_generic_distributor > { > @@ -1041,7 +1045,8 @@ typedef struct acpi_madt_generic_distributor > UINT32 GicId; > UINT64 BaseAddress; > UINT32 GlobalIrqBase; > - UINT32 Reserved2; /* Reserved - must be zero */ > + UINT8 Version; > + UINT8 Reserved2[3]; /* Reserved - must be zero */ > > } ACPI_MADT_GENERIC_DISTRIBUTOR; > > @@ -1077,6 +1082,19 @@ typedef struct acpi_madt_generic_redistributor > } ACPI_MADT_GENERIC_REDISTRIBUTOR; > > > +/* 15: Generic Translator (ACPI 6.0) */ > + > +typedef struct acpi_madt_generic_translator > +{ > + ACPI_SUBTABLE_HEADER Header; > + UINT16 Reserved; /* reserved - must be zero */ > + UINT32 TranslationId; > + UINT64 BaseAddress; > + UINT32 Reserved2; > + > +} ACPI_MADT_GENERIC_TRANSLATOR; > + > + > /* > * Common flags fields for MADT subtables > */ > @@ -1137,6 +1155,186 @@ typedef struct acpi_msct_proximity > > /******************************************************************************* > * > + * NFIT - NVDIMM Interface Table (ACPI 6.0) > + * Version 1 > + * > + ******************************************************************************/ > + > +typedef struct acpi_table_nfit > +{ > + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ > + UINT32 Reserved; /* Reserved, must be zero */ > + > +} ACPI_TABLE_NFIT; > + > +/* Subtable header for NFIT */ > + > +typedef struct acpi_nfit_header > +{ > + UINT16 Type; > + UINT16 Length; > + > +} ACPI_NFIT_HEADER; > + > + > +/* Values for subtable type in ACPI_NFIT_HEADER */ > + > +enum AcpiNfitType > +{ > + ACPI_NFIT_TYPE_SYSTEM_ADDRESS = 0, > + ACPI_NFIT_TYPE_MEMORY_MAP = 1, > + ACPI_NFIT_TYPE_INTERLEAVE = 2, > + ACPI_NFIT_TYPE_SMBIOS = 3, > + ACPI_NFIT_TYPE_CONTROL_REGION = 4, > + ACPI_NFIT_TYPE_DATA_REGION = 5, > + ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6, > + ACPI_NFIT_TYPE_RESERVED = 7 /* 7 and greater are reserved */ > +}; > + > +/* > + * NFIT Subtables > + */ > + > +/* 0: System Physical Address Range Structure */ > + > +typedef struct acpi_nfit_system_address > +{ > + ACPI_NFIT_HEADER Header; > + UINT16 RangeIndex; > + UINT16 Flags; > + UINT32 Reserved; /* Reseved, must be zero */ > + UINT32 ProximityDomain; > + UINT8 RangeGuid[16]; > + UINT64 Address; > + UINT64 Length; > + UINT64 MemoryMapping; > + > +} ACPI_NFIT_SYSTEM_ADDRESS; > + > +/* Flags */ > + > +#define ACPI_NFIT_ADD_ONLINE_ONLY (1) /* 00: Add/Online Operation Only */ > +#define ACPI_NFIT_PROXIMITY_VALID (1<<1) /* 01: Proximity Domain Valid */ > + > +/* Range Type GUIDs appear in the include/acuuid.h file */ > + > + > +/* 1: Memory Device to System Address Range Map Structure */ > + > +typedef struct acpi_nfit_memory_map > +{ > + ACPI_NFIT_HEADER Header; > + UINT32 DeviceHandle; > + UINT16 PhysicalId; > + UINT16 RegionId; > + UINT16 RangeIndex; > + UINT16 RegionIndex; > + UINT64 RegionSize; > + UINT64 RegionOffset; > + UINT64 Address; > + UINT16 InterleaveIndex; > + UINT16 InterleaveWays; > + UINT16 Flags; > + UINT16 Reserved; /* Reserved, must be zero */ > + > +} ACPI_NFIT_MEMORY_MAP; > + > +/* Flags */ > + > +#define ACPI_NFIT_MEM_SAVE_FAILED (1) /* 00: Last SAVE to Memory Device failed */ > +#define ACPI_NFIT_MEM_RESTORE_FAILED (1<<1) /* 01: Last RESTORE from Memory Device failed */ > +#define ACPI_NFIT_MEM_FLUSH_FAILED (1<<2) /* 02: Platform flush failed */ > +#define ACPI_NFIT_MEM_ARMED (1<<3) /* 03: Memory Device observed to be not armed */ > +#define ACPI_NFIT_MEM_HEALTH_OBSERVED (1<<4) /* 04: Memory Device observed SMART/health events */ > +#define ACPI_NFIT_MEM_HEALTH_ENABLED (1<<5) /* 05: SMART/health events enabled */ > + > + > +/* 2: Interleave Structure */ > + > +typedef struct acpi_nfit_interleave > +{ > + ACPI_NFIT_HEADER Header; > + UINT16 InterleaveIndex; > + UINT16 Reserved; /* Reserved, must be zero */ > + UINT32 LineCount; > + UINT32 LineSize; > + UINT32 LineOffset[1]; /* Variable length */ > + > +} ACPI_NFIT_INTERLEAVE; > + > + > +/* 3: SMBIOS Management Information Structure */ > + > +typedef struct acpi_nfit_smbios > +{ > + ACPI_NFIT_HEADER Header; > + UINT32 Reserved; /* Reserved, must be zero */ > + UINT8 Data[1]; /* Variable length */ > + > +} ACPI_NFIT_SMBIOS; > + > + > +/* 4: NVDIMM Control Region Structure */ > + > +typedef struct acpi_nfit_control_region > +{ > + ACPI_NFIT_HEADER Header; > + UINT16 RegionIndex; > + UINT16 VendorId; > + UINT16 DeviceId; > + UINT16 RevisionId; > + UINT16 SubsystemVendorId; > + UINT16 SubsystemDeviceId; > + UINT16 SubsystemRevisionId; > + UINT8 Reserved[6]; /* Reserved, must be zero */ > + UINT32 SerialNumber; > + UINT16 Code; > + UINT16 Windows; > + UINT64 WindowSize; > + UINT64 CommandOffset; > + UINT64 CommandSize; > + UINT64 StatusOffset; > + UINT64 StatusSize; > + UINT16 Flags; > + UINT8 Reserved1[6]; /* Reserved, must be zero */ > + > +} ACPI_NFIT_CONTROL_REGION; > + > +/* Flags */ > + > +#define ACPI_NFIT_CONTROL_BUFFERED (1) /* Block Data Windows implementation is buffered */ > + > + > +/* 5: NVDIMM Block Data Window Region Structure */ > + > +typedef struct acpi_nfit_data_region > +{ > + ACPI_NFIT_HEADER Header; > + UINT16 RegionIndex; > + UINT16 Windows; > + UINT64 Offset; > + UINT64 Size; > + UINT64 Capacity; > + UINT64 StartAddress; > + > +} ACPI_NFIT_DATA_REGION; > + > + > +/* 6: Flush Hint Address Structure */ > + > +typedef struct acpi_nfit_flush_address > +{ > + ACPI_NFIT_HEADER Header; > + UINT32 DeviceHandle; > + UINT16 HintCount; > + UINT8 Reserved[6]; /* Reserved, must be zero */ > + UINT64 HintAddress[1]; /* Variable length */ > + > +} ACPI_NFIT_FLUSH_ADDRESS; > + > + > +/******************************************************************************* > + * > * SBST - Smart Battery Specification Table > * Version 1 > * > @@ -1274,6 +1472,7 @@ typedef struct acpi_srat_gicc_affinity > > #define ACPI_SRAT_GICC_ENABLED (1) /* 00: Use affinity structure */ > > + > /* Reset to default packing */ > > #pragma pack() > diff --git a/src/acpica/source/include/actbl2.h b/src/acpica/source/include/actbl2.h > index df0cfb1..acc0b5f 100644 > --- a/src/acpica/source/include/actbl2.h > +++ b/src/acpica/source/include/actbl2.h > @@ -143,6 +143,7 @@ > #define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ > #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ > #define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ > +#define ACPI_SIG_IORT "IORT" /* IO Remapping Table */ > #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ > #define ACPI_SIG_LPIT "LPIT" /* Low Power Idle Table */ > #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ > @@ -824,6 +825,156 @@ typedef struct acpi_ibft_target > > /******************************************************************************* > * > + * IORT - IO Remapping Table > + * > + * Conforms to "IO Remapping Table System Software on ARM Platforms", > + * Document number: ARM DEN 0049A, 2015 > + * > + ******************************************************************************/ > + > +typedef struct acpi_table_iort > +{ > + ACPI_TABLE_HEADER Header; > + UINT32 NodeCount; > + UINT32 NodeOffset; > + UINT32 Reserved; > + > +} ACPI_TABLE_IORT; > + > + > +/* > + * IORT subtables > + */ > +typedef struct acpi_iort_node > +{ > + UINT8 Type; > + UINT16 Length; > + UINT8 Revision; > + UINT32 Reserved; > + UINT32 MappingCount; > + UINT32 MappingOffset; > + char NodeData[1]; > + > +} ACPI_IORT_NODE; > + > +/* Values for subtable Type above */ > + > +enum AcpiIortNodeType > +{ > + ACPI_IORT_NODE_ITS_GROUP = 0x00, > + ACPI_IORT_NODE_NAMED_COMPONENT = 0x01, > + ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02, > + ACPI_IORT_NODE_SMMU = 0x03 > +}; > + > + > +typedef struct acpi_iort_id_mapping > +{ > + UINT32 InputBase; /* Lowest value in input range */ > + UINT32 IdCount; /* Number of IDs */ > + UINT32 OutputBase; /* Lowest value in output range */ > + UINT32 OutputReference; /* A reference to the output node */ > + UINT32 Flags; > + > +} ACPI_IORT_ID_MAPPING; > + > +/* Masks for Flags field above for IORT subtable */ > + > +#define ACPI_IORT_ID_SINGLE_MAPPING (1) > + > + > +typedef struct acpi_iort_memory_access > +{ > + UINT32 CacheCoherency; > + UINT8 Hints; > + UINT16 Reserved; > + UINT8 MemoryFlags; > + > +} ACPI_IORT_MEMORY_ACCESS; > + > +/* Values for CacheCoherency field above */ > + > +#define ACPI_IORT_NODE_COHERENT 0x00000001 /* The device node is fully coherent */ > +#define ACPI_IORT_NODE_NOT_COHERENT 0x00000000 /* The device node is not coherent */ > + > +/* Masks for Hints field above */ > + > +#define ACPI_IORT_HT_TRANSIENT (1) > +#define ACPI_IORT_HT_WRITE (1<<1) > +#define ACPI_IORT_HT_READ (1<<2) > +#define ACPI_IORT_HT_OVERRIDE (1<<3) > + > +/* Masks for MemoryFlags field above */ > + > +#define ACPI_IORT_MF_COHERENCY (1) > +#define ACPI_IORT_MF_ATTRIBUTES (1<<1) > + > + > +/* > + * IORT node specific subtables > + */ > +typedef struct acpi_iort_its_group > +{ > + UINT32 ItsCount; > + UINT32 Identifiers[1]; /* GIC ITS identifier arrary */ > + > +} ACPI_IORT_ITS_GROUP; > + > + > +typedef struct acpi_iort_named_component > +{ > + UINT32 NodeFlags; > + UINT64 MemoryProperties; /* Memory access properties */ > + UINT8 MemoryAddressLimit; /* Memory address size limit */ > + char DeviceName[1]; /* Path of namespace object */ > + > +} ACPI_IORT_NAMED_COMPONENT; > + > + > +typedef struct acpi_iort_root_complex > +{ > + UINT64 MemoryProperties; /* Memory access properties */ > + UINT32 AtsAttribute; > + UINT32 PciSegmentNumber; > + > +} ACPI_IORT_ROOT_COMPLEX; > + > +/* Values for AtsAttribute field above */ > + > +#define ACPI_IORT_ATS_SUPPORTED 0x00000001 /* The root complex supports ATS */ > +#define ACPI_IORT_ATS_UNSUPPORTED 0x00000000 /* The root complex doesn't support ATS */ > + > + > +typedef struct acpi_iort_smmu > +{ > + UINT64 BaseAddress; /* SMMU base address */ > + UINT64 Span; /* Length of memory range */ > + UINT32 Model; > + UINT32 Flags; > + UINT32 GlobalInterruptOffset; > + UINT32 ContextInterruptCount; > + UINT32 ContextInterruptOffset; > + UINT32 PmuInterruptCount; > + UINT32 PmuInterruptOffset; > + UINT64 Interrupts[1]; /* Interrupt array */ > + > +} ACPI_IORT_SMMU; > + > +/* Values for Model field above */ > + > +#define ACPI_IORT_SMMU_V1 0x00000000 /* Generic SMMUv1 */ > +#define ACPI_IORT_SMMU_V2 0x00000001 /* Generic SMMUv2 */ > +#define ACPI_IORT_SMMU_CORELINK_MMU400 0x00000002 /* ARM Corelink MMU-400 */ > +#define ACPI_IORT_SMMU_CORELINK_MMU500 0x00000003 /* ARM Corelink MMU-500 */ > + > +/* Masks for Flags field above */ > + > +#define ACPI_IORT_SMMU_DVM_SUPPORTED (1) > +#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1) > + > + > +/******************************************************************************* > + * > * IVRS - I/O Virtualization Reporting Structure > * Version 1 > * > @@ -1024,7 +1175,7 @@ typedef struct acpi_ivrs_memory > * > * LPIT - Low Power Idle Table > * > - * Conforms to "ACPI Low Power Idle Table (LPIT) and _LPD Proposal (DRAFT)" > + * Conforms to "ACPI Low Power Idle Table (LPIT)" July 2014. > * > ******************************************************************************/ > > @@ -1052,8 +1203,7 @@ typedef struct acpi_lpit_header > enum AcpiLpitType > { > ACPI_LPIT_TYPE_NATIVE_CSTATE = 0x00, > - ACPI_LPIT_TYPE_SIMPLE_IO = 0x01, > - ACPI_LPIT_TYPE_RESERVED = 0x02 /* 2 and above are reserved */ > + ACPI_LPIT_TYPE_RESERVED = 0x01 /* 1 and above are reserved */ > }; > > /* Masks for Flags field above */ > @@ -1079,24 +1229,6 @@ typedef struct acpi_lpit_native > } ACPI_LPIT_NATIVE; > > > -/* 0x01: Simple I/O based LPI structure */ > - > -typedef struct acpi_lpit_io > -{ > - ACPI_LPIT_HEADER Header; > - ACPI_GENERIC_ADDRESS EntryTrigger; > - UINT32 TriggerAction; > - UINT64 TriggerValue; > - UINT64 TriggerMask; > - ACPI_GENERIC_ADDRESS MinimumIdleState; > - UINT32 Residency; > - UINT32 Latency; > - ACPI_GENERIC_ADDRESS ResidencyCounter; > - UINT64 CounterFrequency; > - > -} ACPI_LPIT_IO; > - > - > /******************************************************************************* > * > * MCFG - PCI Memory Mapped Configuration table and subtable > diff --git a/src/acpica/source/include/actbl3.h b/src/acpica/source/include/actbl3.h > index b4ce8af..88ac753 100644 > --- a/src/acpica/source/include/actbl3.h > +++ b/src/acpica/source/include/actbl3.h > @@ -142,7 +142,10 @@ > #define ACPI_SIG_PCCT "PCCT" /* Platform Communications Channel Table */ > #define ACPI_SIG_PMTT "PMTT" /* Platform Memory Topology Table */ > #define ACPI_SIG_RASF "RASF" /* RAS Feature table */ > +#define ACPI_SIG_STAO "STAO" /* Status Override table */ > #define ACPI_SIG_TPM2 "TPM2" /* Trusted Platform Module 2.0 H/W interface table */ > +#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ > +#define ACPI_SIG_XENV "XENV" /* Xen Environment table */ > > #define ACPI_SIG_S3PT "S3PT" /* S3 Performance (sub)Table */ > #define ACPI_SIG_PCCS "PCC" /* PCC Shared Memory Region */ > @@ -151,7 +154,6 @@ > > #define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */ > #define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ > -#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ > > /* > * All tables must be byte-packed to match the ACPI specification, since > @@ -195,6 +197,8 @@ typedef struct acpi_table_bgrt > /******************************************************************************* > * > * DRTM - Dynamic Root of Trust for Measurement table > + * Conforms to "TCG D-RTM Architecture" June 17 2013, Version 1.0.0 > + * Table version 1 > * > ******************************************************************************/ > > @@ -213,29 +217,50 @@ typedef struct acpi_table_drtm > > } ACPI_TABLE_DRTM; > > -/* 1) Validated Tables List */ > +/* Flag Definitions for above */ > + > +#define ACPI_DRTM_ACCESS_ALLOWED (1) > +#define ACPI_DRTM_ENABLE_GAP_CODE (1<<1) > +#define ACPI_DRTM_INCOMPLETE_MEASUREMENTS (1<<2) > +#define ACPI_DRTM_AUTHORITY_ORDER (1<<3) > > -typedef struct acpi_drtm_vtl_list > + > +/* 1) Validated Tables List (64-bit addresses) */ > + > +typedef struct acpi_drtm_vtable_list > { > - UINT32 ValidatedTableListCount; > + UINT32 ValidatedTableCount; > + UINT64 ValidatedTables[1]; > + > +} ACPI_DRTM_VTABLE_LIST; > > -} ACPI_DRTM_VTL_LIST; > +/* 2) Resources List (of Resource Descriptors) */ > > -/* 2) Resources List */ > +/* Resource Descriptor */ > + > +typedef struct acpi_drtm_resource > +{ > + UINT8 Size[7]; > + UINT8 Type; > + UINT64 Address; > + > +} ACPI_DRTM_RESOURCE; > > typedef struct acpi_drtm_resource_list > { > - UINT32 ResourceListCount; > + UINT32 ResourceCount; > + ACPI_DRTM_RESOURCE Resources[1]; > > } ACPI_DRTM_RESOURCE_LIST; > > /* 3) Platform-specific Identifiers List */ > > -typedef struct acpi_drtm_id_list > +typedef struct acpi_drtm_dps_id > { > - UINT32 IdListCount; > + UINT32 DpsIdLength; > + UINT8 DpsId[16]; > > -} ACPI_DRTM_ID_LIST; > +} ACPI_DRTM_DPS_ID; > > > /******************************************************************************* > @@ -877,6 +902,24 @@ enum AcpiRasfStatus > > /******************************************************************************* > * > + * STAO - Status Override Table (_STA override) - ACPI 6.0 > + * Version 1 > + * > + * Conforms to "ACPI Specification for Status Override Table" > + * 6 January 2015 > + * > + ******************************************************************************/ > + > +typedef struct acpi_table_stao > +{ > + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ > + UINT8 IgnoreUart; > + > +} ACPI_TABLE_STAO; > + > + > +/******************************************************************************* > + * > * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table > * Version 3 > * > @@ -910,6 +953,47 @@ typedef struct acpi_tpm2_control > } ACPI_TPM2_CONTROL; > > > +/******************************************************************************* > + * > + * WPBT - Windows Platform Environment Table (ACPI 6.0) > + * Version 1 > + * > + * Conforms to "Windows Platform Binary Table (WPBT)" 29 November 2011 > + * > + ******************************************************************************/ > + > +typedef struct acpi_table_wpbt > +{ > + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ > + UINT32 HandoffSize; > + UINT64 HandoffAddress; > + UINT8 Layout; > + UINT8 Type; > + UINT16 ArgumentsLength; > + > +} ACPI_TABLE_WPBT; > + > + > +/******************************************************************************* > + * > + * XENV - Xen Environment Table (ACPI 6.0) > + * Version 1 > + * > + * Conforms to "ACPI Specification for Xen Environment Table" 4 January 2015 > + * > + ******************************************************************************/ > + > +typedef struct acpi_table_xenv > +{ > + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ > + UINT64 GrantTableAddress; > + UINT64 GrantTableSize; > + UINT32 EventInterrupt; > + UINT8 EventFlags; > + > +} ACPI_TABLE_XENV; > + > + > /* Reset to default packing */ > > #pragma pack() > diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h > index 2c7d1bb..98fcf48 100644 > --- a/src/acpica/source/include/actypes.h > +++ b/src/acpica/source/include/actypes.h > @@ -610,6 +610,7 @@ typedef UINT64 ACPI_INTEGER; > #define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (p)) > #define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (ACPI_UINTPTR_T) (p)) > #define ACPI_ADD_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b))) > +#define ACPI_SUB_PTR(t, a, b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b))) > #define ACPI_PTR_DIFF(a, b) (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b))) > > /* Pointer/Integer type conversions */ > diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h > index 2b3dad4..93edeee 100644 > --- a/src/acpica/source/include/acutils.h > +++ b/src/acpica/source/include/acutils.h > @@ -411,7 +411,7 @@ extern const UINT8 _acpi_ctype[]; > #define _ACPI_DI 0x04 /* '0'-'9' */ > #define _ACPI_LO 0x02 /* 'a'-'z' */ > #define _ACPI_PU 0x10 /* punctuation */ > -#define _ACPI_SP 0x08 /* space */ > +#define _ACPI_SP 0x08 /* space, tab, CR, LF, VT, FF */ > #define _ACPI_UP 0x01 /* 'A'-'Z' */ > #define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ > > diff --git a/src/acpica/source/include/platform/acenv.h b/src/acpica/source/include/platform/acenv.h > index 83ac402..f596d8c 100644 > --- a/src/acpica/source/include/platform/acenv.h > +++ b/src/acpica/source/include/platform/acenv.h > @@ -247,6 +247,9 @@ > #elif defined(_APPLE) || defined(__APPLE__) > #include "acmacosx.h" > > +#elif defined(__DragonFly__) > +#include "acdragonfly.h" > + > #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) > #include "acfreebsd.h" > > diff --git a/src/acpica/source/include/platform/acenvex.h b/src/acpica/source/include/platform/acenvex.h > index 6c59337..26467b9 100644 > --- a/src/acpica/source/include/platform/acenvex.h > +++ b/src/acpica/source/include/platform/acenvex.h > @@ -128,6 +128,9 @@ > #if defined(_LINUX) || defined(__linux__) > #include "aclinuxex.h" > > +#elif defined(__DragonFly__) > +#include "acdragonflyex.h" > + > #endif > > /*! [End] no source code translation !*/ Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 07:06:28 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 15:06:28 +0800 Subject: ACK: [PATCH] lib: fwts_pipe: clean up static analyzer warning on freopen In-Reply-To: <1431686246-13001-1-git-send-email-colin.king@canonical.com> References: <1431686246-13001-1-git-send-email-colin.king@canonical.com> Message-ID: <55680FF4.3090402@canonical.com> On 2015?05?15? 18:37, Colin King wrote: > From: Colin Ian King > > cppcheck is being a bit overly zealous: > > [src/lib/src/fwts_pipeio.c:64]: (error) Return value of allocation function freopen is not stored. > (error) Return value of allocation function freopen is not stored. > > ..but we may as well assign a file pointer to the freopen() call and > explicitly close it before calling _exit() just to make things a little > clearer to cppcheck > > Signed-off-by: Colin Ian King > --- > src/lib/src/fwts_pipeio.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c > index b5d7fee..94edb16 100644 > --- a/src/lib/src/fwts_pipeio.c > +++ b/src/lib/src/fwts_pipeio.c > @@ -48,6 +48,7 @@ int fwts_pipe_open(const char *command, pid_t *childpid) > { > int pipefds[2]; > pid_t pid; > + FILE *fp; > > if (pipe(pipefds) < 0) > return -1; > @@ -61,7 +62,7 @@ int fwts_pipe_open(const char *command, pid_t *childpid) > return -1; > case 0: > /* Child */ > - if (freopen("/dev/null", "w", stderr) == NULL) { > + if ((fp = freopen("/dev/null", "w", stderr)) == NULL) { > fprintf(stderr, "Cannot redirect stderr\n"); > } > if (pipefds[0] != STDOUT_FILENO) { > @@ -70,6 +71,8 @@ int fwts_pipe_open(const char *command, pid_t *childpid) > } > close(pipefds[0]); > execl(_PATH_BSHELL, "sh", "-c", command, NULL); > + if (fp) > + fclose(fp); > _exit(FWTS_EXEC_ERROR); > default: > /* Parent */ Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 07:13:15 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 15:13:15 +0800 Subject: ACK: [PATCH 1/3] lib: acpi: add an acpi category In-Reply-To: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> References: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> Message-ID: <5568118B.6090804@canonical.com> On 2015?05?27? 17:46, Alex Hung wrote: > Signed-off-by: Alex Hung > --- > src/lib/src/fwts_framework.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c > index 190fc52..2753d54 100644 > --- a/src/lib/src/fwts_framework.c > +++ b/src/lib/src/fwts_framework.c > @@ -47,9 +47,11 @@ typedef struct { > FWTS_FLAG_POWER_STATES | \ > FWTS_FLAG_UTILS | \ > FWTS_FLAG_UNSAFE | \ > - FWTS_FLAG_TEST_UEFI) > + FWTS_FLAG_TEST_UEFI | \ > + FWTS_FLAG_TEST_ACPI) > > static fwts_categories categories[] = { > + { "ACPI", FWTS_FLAG_TEST_ACPI }, > { "Batch", FWTS_FLAG_BATCH }, > { "Interactive", FWTS_FLAG_INTERACTIVE }, > { "Batch Experimental", FWTS_FLAG_BATCH_EXPERIMENTAL }, > @@ -104,6 +106,7 @@ static fwts_option fwts_framework_options[] = { > { "rsdp", "R:", 1, "Specify the physical address of the ACPI RSDP." }, > { "pm-method", "", 1, "Select the power method to use. Accepted values are \"logind\", \"pm-utils\", \"sysfs\""}, > { "show-tests-categories","", 0, "Show tests and associated categories." }, > + { "acpi", "", 0, "Run ACPI tests." }, > { NULL, NULL, 0, NULL } > }; > > @@ -1226,6 +1229,9 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar > case 39: /* --show-tests-categories */ > fw->flags |= FWTS_FLAG_SHOW_TESTS_CATEGORIES; > break; > + case 40: /* --acpi */ > + fw->flags |= FWTS_FLAG_TEST_ACPI; > + break; > } > break; > case 'a': /* --all */ Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 07:13:33 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 15:13:33 +0800 Subject: ACK: [PATCH 2/3] acpi: add tests to acpi category In-Reply-To: <1432719991-3047-2-git-send-email-alex.hung@canonical.com> References: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> <1432719991-3047-2-git-send-email-alex.hung@canonical.com> Message-ID: <5568119D.8070407@canonical.com> On 2015?05?27? 17:46, Alex Hung wrote: > Signed-off-by: Alex Hung > --- > src/acpi/acpitables/acpitables.c | 2 +- > src/acpi/apicinstance/apicinstance.c | 2 +- > src/acpi/checksum/checksum.c | 2 +- > src/acpi/cstates/cstates.c | 2 +- > src/acpi/dmar/dmar.c | 2 +- > src/acpi/fadt/fadt.c | 2 +- > src/acpi/mcfg/mcfg.c | 2 +- > src/acpi/method/method.c | 2 +- > src/acpi/spcr/spcr.c | 2 +- > src/hpet/hpet_check/hpet_check.c | 2 +- > 10 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c > index 52b6659..1d3eb0c 100644 > --- a/src/acpi/acpitables/acpitables.c > +++ b/src/acpi/acpitables/acpitables.c > @@ -859,4 +859,4 @@ static fwts_framework_ops acpi_table_check_ops = { > .minor_tests = acpi_table_check_tests > }; > > -FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/apicinstance/apicinstance.c b/src/acpi/apicinstance/apicinstance.c > index 5a4d5a2..095c2ae 100644 > --- a/src/acpi/apicinstance/apicinstance.c > +++ b/src/acpi/apicinstance/apicinstance.c > @@ -82,6 +82,6 @@ static fwts_framework_ops apicinstance_ops = { > .minor_tests = apicinstance_tests > }; > > -FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/checksum/checksum.c b/src/acpi/checksum/checksum.c > index ed98e66..a649231 100644 > --- a/src/acpi/checksum/checksum.c > +++ b/src/acpi/checksum/checksum.c > @@ -155,4 +155,4 @@ static fwts_framework_ops checksum_ops = { > .minor_tests = checksum_tests > }; > > -FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c > index b58f15c..291ac21 100644 > --- a/src/acpi/cstates/cstates.c > +++ b/src/acpi/cstates/cstates.c > @@ -254,6 +254,6 @@ static fwts_framework_ops cstates_ops = { > .minor_tests = cstates_tests > }; > > -FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c > index 918768f..afd0327 100644 > --- a/src/acpi/dmar/dmar.c > +++ b/src/acpi/dmar/dmar.c > @@ -334,6 +334,6 @@ static fwts_framework_ops dmar_ops = { > .minor_tests = dmar_tests > }; > > -FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c > index 8f3abea..af0b192 100644 > --- a/src/acpi/fadt/fadt.c > +++ b/src/acpi/fadt/fadt.c > @@ -194,6 +194,6 @@ static fwts_framework_ops fadt_ops = { > .minor_tests = fadt_tests > }; > > -FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/mcfg/mcfg.c b/src/acpi/mcfg/mcfg.c > index 6748378..83f8d6f 100644 > --- a/src/acpi/mcfg/mcfg.c > +++ b/src/acpi/mcfg/mcfg.c > @@ -259,6 +259,6 @@ static fwts_framework_ops mcfg_ops = { > .minor_tests = mcfg_tests > }; > > -FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index cc1ed33..ccd6c8a 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -6363,4 +6363,4 @@ static fwts_framework_ops method_ops = { > .minor_tests = method_tests > }; > > -FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c > index 9fc7655..8eedb16 100644 > --- a/src/acpi/spcr/spcr.c > +++ b/src/acpi/spcr/spcr.c > @@ -288,4 +288,4 @@ static fwts_framework_ops spcr_ops = { > .minor_tests = spcr_tests > }; > > -FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c > index 6679c81..7699bb2 100644 > --- a/src/hpet/hpet_check/hpet_check.c > +++ b/src/hpet/hpet_check/hpet_check.c > @@ -438,6 +438,6 @@ static fwts_framework_ops hpet_check_ops = { > }; > > FWTS_REGISTER("hpet_check", &hpet_check_ops, FWTS_TEST_ANYTIME, > - FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > + FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 07:14:24 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 15:14:24 +0800 Subject: ACK: [PATCH v2] acpi: add tests to acpi category In-Reply-To: <1432807792-6576-1-git-send-email-alex.hung@canonical.com> References: <1432807792-6576-1-git-send-email-alex.hung@canonical.com> Message-ID: <556811D0.5060501@canonical.com> On 2015?05?28? 18:09, Alex Hung wrote: > --- > src/acpi/acpiinfo/acpiinfo.c | 2 +- > src/acpi/acpitables/acpitables.c | 2 +- > src/acpi/apicinstance/apicinstance.c | 2 +- > src/acpi/checksum/checksum.c | 2 +- > src/acpi/cstates/cstates.c | 2 +- > src/acpi/dmar/dmar.c | 2 +- > src/acpi/fadt/fadt.c | 2 +- > src/acpi/mcfg/mcfg.c | 2 +- > src/acpi/method/method.c | 2 +- > src/acpi/pcc/pcc.c | 2 +- > src/acpi/spcr/spcr.c | 2 +- > src/acpi/wmi/wmi.c | 2 +- > src/hpet/hpet_check/hpet_check.c | 2 +- > 13 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/src/acpi/acpiinfo/acpiinfo.c b/src/acpi/acpiinfo/acpiinfo.c > index ce37972..c80b621 100644 > --- a/src/acpi/acpiinfo/acpiinfo.c > +++ b/src/acpi/acpiinfo/acpiinfo.c > @@ -149,4 +149,4 @@ static fwts_framework_ops acpiinfo_ops = { > .minor_tests = acpiinfo_tests > }; > > -FWTS_REGISTER("acpiinfo", &acpiinfo_ops, FWTS_TEST_EARLY, FWTS_FLAG_BATCH) > +FWTS_REGISTER("acpiinfo", &acpiinfo_ops, FWTS_TEST_EARLY, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c > index 52b6659..1d3eb0c 100644 > --- a/src/acpi/acpitables/acpitables.c > +++ b/src/acpi/acpitables/acpitables.c > @@ -859,4 +859,4 @@ static fwts_framework_ops acpi_table_check_ops = { > .minor_tests = acpi_table_check_tests > }; > > -FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("acpitables", &acpi_table_check_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/apicinstance/apicinstance.c b/src/acpi/apicinstance/apicinstance.c > index 5a4d5a2..095c2ae 100644 > --- a/src/acpi/apicinstance/apicinstance.c > +++ b/src/acpi/apicinstance/apicinstance.c > @@ -82,6 +82,6 @@ static fwts_framework_ops apicinstance_ops = { > .minor_tests = apicinstance_tests > }; > > -FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("apicinstance", &apicinstance_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/checksum/checksum.c b/src/acpi/checksum/checksum.c > index ed98e66..a649231 100644 > --- a/src/acpi/checksum/checksum.c > +++ b/src/acpi/checksum/checksum.c > @@ -155,4 +155,4 @@ static fwts_framework_ops checksum_ops = { > .minor_tests = checksum_tests > }; > > -FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("checksum", &checksum_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/cstates/cstates.c b/src/acpi/cstates/cstates.c > index b58f15c..291ac21 100644 > --- a/src/acpi/cstates/cstates.c > +++ b/src/acpi/cstates/cstates.c > @@ -254,6 +254,6 @@ static fwts_framework_ops cstates_ops = { > .minor_tests = cstates_tests > }; > > -FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("cstates", &cstates_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/dmar/dmar.c b/src/acpi/dmar/dmar.c > index 918768f..afd0327 100644 > --- a/src/acpi/dmar/dmar.c > +++ b/src/acpi/dmar/dmar.c > @@ -334,6 +334,6 @@ static fwts_framework_ops dmar_ops = { > .minor_tests = dmar_tests > }; > > -FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("dmar", &dmar_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c > index 8f3abea..af0b192 100644 > --- a/src/acpi/fadt/fadt.c > +++ b/src/acpi/fadt/fadt.c > @@ -194,6 +194,6 @@ static fwts_framework_ops fadt_ops = { > .minor_tests = fadt_tests > }; > > -FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("fadt", &fadt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/mcfg/mcfg.c b/src/acpi/mcfg/mcfg.c > index 6748378..83f8d6f 100644 > --- a/src/acpi/mcfg/mcfg.c > +++ b/src/acpi/mcfg/mcfg.c > @@ -259,6 +259,6 @@ static fwts_framework_ops mcfg_ops = { > .minor_tests = mcfg_tests > }; > > -FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("mcfg", &mcfg_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index cc1ed33..ccd6c8a 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -6363,4 +6363,4 @@ static fwts_framework_ops method_ops = { > .minor_tests = method_tests > }; > > -FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("method", &method_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/pcc/pcc.c b/src/acpi/pcc/pcc.c > index 8cf2288..da66aec 100644 > --- a/src/acpi/pcc/pcc.c > +++ b/src/acpi/pcc/pcc.c > @@ -464,6 +464,6 @@ static fwts_framework_ops pcc_ops = { > .minor_tests = pcc_tests > }; > > -FWTS_REGISTER("pcc", &pcc_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("pcc", &pcc_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/acpi/spcr/spcr.c b/src/acpi/spcr/spcr.c > index 9fc7655..8eedb16 100644 > --- a/src/acpi/spcr/spcr.c > +++ b/src/acpi/spcr/spcr.c > @@ -288,4 +288,4 @@ static fwts_framework_ops spcr_ops = { > .minor_tests = spcr_tests > }; > > -FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > +FWTS_REGISTER("spcr", &spcr_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c > index 188db08..22dc7b1 100644 > --- a/src/acpi/wmi/wmi.c > +++ b/src/acpi/wmi/wmi.c > @@ -410,6 +410,6 @@ static fwts_framework_ops wmi_ops = { > .minor_tests = wmi_tests > }; > > -FWTS_REGISTER("wmi", &wmi_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH) > +FWTS_REGISTER("wmi", &wmi_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) > > #endif > diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c > index 6679c81..7699bb2 100644 > --- a/src/hpet/hpet_check/hpet_check.c > +++ b/src/hpet/hpet_check/hpet_check.c > @@ -438,6 +438,6 @@ static fwts_framework_ops hpet_check_ops = { > }; > > FWTS_REGISTER("hpet_check", &hpet_check_ops, FWTS_TEST_ANYTIME, > - FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV) > + FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV | FWTS_FLAG_TEST_ACPI) > > #endif Acked-by: Ivan Hu From ivan.hu at canonical.com Fri May 29 07:14:50 2015 From: ivan.hu at canonical.com (ivanhu) Date: Fri, 29 May 2015 15:14:50 +0800 Subject: ACK: [PATCH v2] live-image/fwts-frontend-text: add selections of acpi and uefi tests In-Reply-To: <1432800491-3430-1-git-send-email-alex.hung@canonical.com> References: <1432800491-3430-1-git-send-email-alex.hung@canonical.com> Message-ID: <556811EA.3030601@canonical.com> On 2015?05?28? 16:08, Alex Hung wrote: > This is to avoid too much noise when members of UEFI forum > who may be interested in only ACPI and UEFI but no others. > > Signed-off-by: Alex Hung > --- > live-image/fwts-frontend-text | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text > index 0b506ab..3119895 100755 > --- a/live-image/fwts-frontend-text > +++ b/live-image/fwts-frontend-text > @@ -235,10 +235,12 @@ do > dialog --help-button --backtitle "$FWTS" --title "Select Tests" --radiolist \ > "This will run a suite of firmware tests that will check the BIOS and ACPI tables. It can also find issues that can cause Linux problems.\n\n\ > The default below is to run just all the Batch Tests, but you can select more tests below if required.\n\nPlease select below (using cursor up/down and space) and press enter to continue:" \ > - 18 70 4 \ > + 20 70 6 \ > 1 "All Batch Tests" on \ > - 2 "Select Individual Tests" off \ > - 3 "Abort Testing" off \ > + 2 "ACPI Tests" off \ > + 3 "UEFI Tests" off \ > + 4 "Select Individual Tests" off \ > + 5 "Abort Testing" off \ > 2> $OPTIONS > > case $? in > @@ -250,9 +252,17 @@ The default below is to run just all the Batch Tests, but you can select more te > done_tests_finish > ;; > '2') > - select_tests > + do_test "--acpi" 'Running ACPI Tests' > + done_tests_finish > ;; > '3') > + do_test "--uefi" 'Running UEFI Tests' > + done_tests_finish > + ;; > + '4') > + select_tests > + ;; > + '5') > no_tests_finish > ;; > esac Acked-by: Ivan Hu From colin.king at canonical.com Fri May 29 09:38:14 2015 From: colin.king at canonical.com (Colin Ian King) Date: Fri, 29 May 2015 10:38:14 +0100 Subject: ACK: [PATCH] acpi: method: update method list according to Table 5-162 in ACPI 6 In-Reply-To: <1430883300-16643-1-git-send-email-alex.hung@canonical.com> References: <1430883300-16643-1-git-send-email-alex.hung@canonical.com> Message-ID: <55683386.7050206@canonical.com> On 06/05/15 04:35, Alex Hung wrote: > Note: _CR3 is not listed in Table 5-162. That requires fixing > in next ACPI version > > Signed-off-by: Alex Hung > --- > src/acpi/method/method.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index cc1ed33..cb8c083 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -57,14 +57,16 @@ > * _BMS 10.2.2.5 Y > * _BQC B.6.4 Y > * _BST 10.2.2.6 Y > - * _BTM 10.2.2.8 Y > - * _BTP 10.2.2.7 Y > + * _BTH 10.2.2.7 N > + * _BTM 10.2.2.9 Y > + * _BTP 10.2.2.8 Y > * _CBA PCI f/w spec Y > * _CCA 6.2.17 Y > * _CDM 6.2.1 Y > * _CID 6.1.2 Y > * _CLS 6.1.3 N requires PCI SIG class info > * _CPC 8.4.5 Y > + * _CR3 11.5.4 N > * _CRS 6.2.2 Y > * _CRT 11.4.4 Y > * _CSD 8.4.2.2 Y > @@ -124,12 +126,14 @@ > * _Lxx 5.6.4.1 n/a > * _LCK 6.3.4 Y > * _LID 9.4.1 Y > + * _LPI 8.4.4.3 N > * _MAT 6.2.9 N > * _MBM 9.12.2.1 Y > * _MLS 6.1.7 Y > * _MSG 9.1.2 Y > * _MSM 9.12.2.2 N > - * _NTT 11.4.7 Y > + * _MTL 11.4.8 N > + * _NTT 11.4.9 Y > * _OFF 7.1.2 Y > * _ON_ 7.1.3 Y > * _OS 5.7.3 N > @@ -139,7 +143,7 @@ > * _PAI 10.4.4 n/a > * _PCL 10.3.2 Y > * _PCT 8.4.4.1 Y > - * _PDC 8.4.1 N > + * _PDC 8.4.1 deprecated > * _PDL 8.4.4.6 Y > * _PIC 5.8.1 Y > * _PIF 10.3.3 Y > @@ -156,8 +160,9 @@ > * _PR3 7.2.11 Y > * _PRE 7.2.12 Y > * _PRL 10.3.4 Y > - * _PRT 6.2.12 N > + * _PRR 7.3.26 N > * _PRS 6.2.11 Y > + * _PRT 6.2.12 N > * _PRW 7.2.11 Y > * _PS0 7.2.2 Y > * _PS1 7.2.3 Y > @@ -177,10 +182,12 @@ > * _PUR 8.5.11 Y > * _PXM 6.2.13 Y > * _Qxx 5.6.4.1 n/a > + * _RDI 8.5 N > * _REG 6.5.4 n/a > * _REV 5.7.4 n/a > * _RMV 6.3.6 Y > * _ROM B.4.3 Y > + * _RST 7.3.25 N > * _RTV 11.4.10 Y > * _S0_ 7.3.4.1 Y > * _S1_ 7.3.4.2 Y > @@ -221,6 +228,7 @@ > * _TC1 11.4.12 Y > * _TC2 11.4.13 Y > * _TDL 8.4.3.5 Y > + * _TFP 11.4.16 N > * _TIP 9.18.9 Y > * _TIV 9.18.10 Y > * _TMP 11.4.14 Y > @@ -228,6 +236,7 @@ > * _TPT 11.4.15 Y > * _TRT 11.4.16 Y > * _TSD 8.4.3.4 Y > + * _TSN 11.4.20 N > * _TSP 11.4.17 Y > * _TSS 8.4.3.2 Y > * _TST 11.4.18 Y > Looks OK to me. Thanks! Acked-by: Colin Ian King From colin.king at canonical.com Fri May 29 09:40:19 2015 From: colin.king at canonical.com (Colin Ian King) Date: Fri, 29 May 2015 10:40:19 +0100 Subject: ACK: [PATCH 1/3] lib: acpi: add an acpi category In-Reply-To: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> References: <1432719991-3047-1-git-send-email-alex.hung@canonical.com> Message-ID: <55683403.504@canonical.com> On 27/05/15 10:46, Alex Hung wrote: > Signed-off-by: Alex Hung > --- > src/lib/src/fwts_framework.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c > index 190fc52..2753d54 100644 > --- a/src/lib/src/fwts_framework.c > +++ b/src/lib/src/fwts_framework.c > @@ -47,9 +47,11 @@ typedef struct { > FWTS_FLAG_POWER_STATES | \ > FWTS_FLAG_UTILS | \ > FWTS_FLAG_UNSAFE | \ > - FWTS_FLAG_TEST_UEFI) > + FWTS_FLAG_TEST_UEFI | \ > + FWTS_FLAG_TEST_ACPI) > > static fwts_categories categories[] = { > + { "ACPI", FWTS_FLAG_TEST_ACPI }, > { "Batch", FWTS_FLAG_BATCH }, > { "Interactive", FWTS_FLAG_INTERACTIVE }, > { "Batch Experimental", FWTS_FLAG_BATCH_EXPERIMENTAL }, > @@ -104,6 +106,7 @@ static fwts_option fwts_framework_options[] = { > { "rsdp", "R:", 1, "Specify the physical address of the ACPI RSDP." }, > { "pm-method", "", 1, "Select the power method to use. Accepted values are \"logind\", \"pm-utils\", \"sysfs\""}, > { "show-tests-categories","", 0, "Show tests and associated categories." }, > + { "acpi", "", 0, "Run ACPI tests." }, > { NULL, NULL, 0, NULL } > }; > > @@ -1226,6 +1229,9 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar > case 39: /* --show-tests-categories */ > fw->flags |= FWTS_FLAG_SHOW_TESTS_CATEGORIES; > break; > + case 40: /* --acpi */ > + fw->flags |= FWTS_FLAG_TEST_ACPI; > + break; > } > break; > case 'a': /* --all */ > Acked-by: Colin Ian King From colin.king at canonical.com Fri May 29 09:41:48 2015 From: colin.king at canonical.com (Colin Ian King) Date: Fri, 29 May 2015 10:41:48 +0100 Subject: ACK: [PATCH v2] live-image/fwts-frontend-text: add selections of acpi and uefi tests In-Reply-To: <1432800491-3430-1-git-send-email-alex.hung@canonical.com> References: <1432800491-3430-1-git-send-email-alex.hung@canonical.com> Message-ID: <5568345C.9030406@canonical.com> On 28/05/15 09:08, Alex Hung wrote: > This is to avoid too much noise when members of UEFI forum > who may be interested in only ACPI and UEFI but no others. > > Signed-off-by: Alex Hung > --- > live-image/fwts-frontend-text | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text > index 0b506ab..3119895 100755 > --- a/live-image/fwts-frontend-text > +++ b/live-image/fwts-frontend-text > @@ -235,10 +235,12 @@ do > dialog --help-button --backtitle "$FWTS" --title "Select Tests" --radiolist \ > "This will run a suite of firmware tests that will check the BIOS and ACPI tables. It can also find issues that can cause Linux problems.\n\n\ > The default below is to run just all the Batch Tests, but you can select more tests below if required.\n\nPlease select below (using cursor up/down and space) and press enter to continue:" \ > - 18 70 4 \ > + 20 70 6 \ > 1 "All Batch Tests" on \ > - 2 "Select Individual Tests" off \ > - 3 "Abort Testing" off \ > + 2 "ACPI Tests" off \ > + 3 "UEFI Tests" off \ > + 4 "Select Individual Tests" off \ > + 5 "Abort Testing" off \ > 2> $OPTIONS > > case $? in > @@ -250,9 +252,17 @@ The default below is to run just all the Batch Tests, but you can select more te > done_tests_finish > ;; > '2') > - select_tests > + do_test "--acpi" 'Running ACPI Tests' > + done_tests_finish > ;; > '3') > + do_test "--uefi" 'Running UEFI Tests' > + done_tests_finish > + ;; > + '4') > + select_tests > + ;; > + '5') > no_tests_finish > ;; > esac > Acked-by: Colin Ian King From alex.hung at canonical.com Sat May 30 06:31:21 2015 From: alex.hung at canonical.com (Alex Hung) Date: Sat, 30 May 2015 14:31:21 +0800 Subject: [PATCH] fwts-test: Update tests with new acpi category Message-ID: <1432967481-31038-1-git-send-email-alex.hung@canonical.com> Signed-off-by: Alex Hung --- fwts-test/arg-help-0001/arg-help-0001.log | 1 + fwts-test/arg-help-0001/arg-help-0002.log | 1 + fwts-test/arg-help-0001/test-0001.sh | 2 +- .../arg-show-tests-0001/arg-show-tests-0001.log | 15 ++ .../arg-show-tests-full-0001.log | 217 ++++++++++++++++++++- 5 files changed, 234 insertions(+), 2 deletions(-) diff --git a/fwts-test/arg-help-0001/arg-help-0001.log b/fwts-test/arg-help-0001/arg-help-0001.log index 6773a6c..3b79179 100644 --- a/fwts-test/arg-help-0001/arg-help-0001.log +++ b/fwts-test/arg-help-0001/arg-help-0001.log @@ -1,3 +1,4 @@ +--acpi Run ACPI tests. --acpica Enable ACPICA run time options. --acpica-debug Enable ACPICA debug diff --git a/fwts-test/arg-help-0001/arg-help-0002.log b/fwts-test/arg-help-0001/arg-help-0002.log index 6773a6c..3b79179 100644 --- a/fwts-test/arg-help-0001/arg-help-0002.log +++ b/fwts-test/arg-help-0001/arg-help-0002.log @@ -1,3 +1,4 @@ +--acpi Run ACPI tests. --acpica Enable ACPICA run time options. --acpica-debug Enable ACPICA debug diff --git a/fwts-test/arg-help-0001/test-0001.sh b/fwts-test/arg-help-0001/test-0001.sh index 38b3dbb..b06383f 100755 --- a/fwts-test/arg-help-0001/test-0001.sh +++ b/fwts-test/arg-help-0001/test-0001.sh @@ -35,5 +35,5 @@ fi stty cols 80 2> /dev/null tset 2> /dev/null -#rm $TMPLOG +rm $TMPLOG exit $ret diff --git a/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log b/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log index e34af88..8d9b691 100644 --- a/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log +++ b/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log @@ -1,3 +1,18 @@ +ACPI tests: + acpiinfo General ACPI information test. + acpitables ACPI table settings sanity tests. + apicinstance Test for single instance of APIC/MADT table. + checksum ACPI table checksum test. + cstates Processor C state support test. + dmar DMA Remapping (VT-d) test. + fadt FADT SCI_EN enabled tests. + hpet_check HPET configuration tests. + mcfg MCFG PCI Express* memory mapped config space test. + method ACPI DSDT Method Semantic tests. + pcc Processor Clocking Control (PCC) test. + spcr SPCR Serial Port Console Redirection Table test. + wmi Extract and analyse Windows Management Instrumentation (WMI). + Batch tests: acpiinfo General ACPI information test. acpitables ACPI table settings sanity tests. diff --git a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log index b72ee5b..b32cf2e 100644 --- a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log +++ b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log @@ -1,3 +1,218 @@ +ACPI tests: + acpiinfo (3 tests): + Determine Kernel ACPI version. + Determine machine's ACPI version. + Determine AML compiler. + acpitables (2 tests): + Test ACPI tables. + Test ACPI headers. + apicinstance (1 test): + Test for single instance of APIC/MADT table. + checksum (1 test): + ACPI table checksum test. + cstates (1 test): + Test all CPUs C-states. + dmar (1 test): + DMA Remapping test. + fadt (2 tests): + Test FADT SCI_EN bit is enabled. + Test FADT reset register. + hpet_check (4 tests): + Test HPET base in kernel log. + Test HPET base in HPET table. + Test HPET base in DSDT and/or SSDT. + Test HPET configuration. + mcfg (2 tests): + Validate MCFG table. + Validate MCFG PCI config space. + method (180 tests): + Test Method Names. + Test _AEI. + Test _EVT (Event Method). + Test _DLM (Device Lock Mutex). + Test _PIC (Inform AML of Interrupt Model). + Test _CID (Compatible ID). + Test _DDN (DOS Device Name). + Test _HID (Hardware ID). + Test _HRV (Hardware Revision Number). + Test _MLS (Multiple Language String). + Test _PLD (Physical Device Location). + Test _SUB (Subsystem ID). + Test _SUN (Slot User Number). + Test _STR (String). + Test _UID (Unique ID). + Test _CDM (Clock Domain). + Test _CRS (Current Resource Settings). + Test _DSD (Device Specific Data). + Test _DIS (Disable). + Test _DMA (Direct Memory Access). + Test _FIX (Fixed Register Resource Provider). + Test _GSB (Global System Interrupt Base). + Test _HPP (Hot Plug Parameters). + Test _PRS (Possible Resource Settings). + Test _PXM (Proximity). + Test _CCA (Cache Coherency Attribute). + Test _EDL (Eject Device List). + Test _EJD (Ejection Dependent Device). + Test _EJ0 (Eject). + Test _EJ1 (Eject). + Test _EJ2 (Eject). + Test _EJ3 (Eject). + Test _EJ4 (Eject). + Test _LCK (Lock). + Test _RMV (Remove). + Test _STA (Status). + Test _DEP (Operational Region Dependencies). + Test _BDN (BIOS Dock Name). + Test _BBN (Base Bus Number). + Test _DCK (Dock). + Test _INI (Initialize). + Test _GLK (Global Lock). + Test _SEG (Segment). + Test _OFF (Set resource off). + Test _ON (Set resource on). + Test _DSW (Device Sleep Wake). + Test _IRC (In Rush Current). + Test _PRE (Power Resources for Enumeration). + Test _PR0 (Power Resources for D0). + Test _PR1 (Power Resources for D1). + Test _PR2 (Power Resources for D2). + Test _PR3 (Power Resources for D3). + Test _PRW (Power Resources for Wake). + Test _PS0 (Power State 0). + Test _PS1 (Power State 1). + Test _PS2 (Power State 2). + Test _PS3 (Power State 3). + Test _PSC (Power State Current). + Test _PSE (Power State for Enumeration). + Test _PSW (Power State Wake). + Test _S1D (S1 Device State). + Test _S2D (S2 Device State). + Test _S3D (S3 Device State). + Test _S4D (S4 Device State). + Test _S0W (S0 Device Wake State). + Test _S1W (S1 Device Wake State). + Test _S2W (S2 Device Wake State). + Test _S3W (S3 Device Wake State). + Test _S4W (S4 Device Wake State). + Test _S0_ (S0 System State). + Test _S1_ (S1 System State). + Test _S2_ (S2 System State). + Test _S3_ (S3 System State). + Test _S4_ (S4 System State). + Test _S5_ (S5 System State). + Test _SWS (System Wake Source). + Test _PSS (Performance Supported States). + Test _CPC (Continuous Performance Control). + Test _CSD (C State Dependencies). + Test _CST (C States). + Test _PCT (Performance Control). + Test _PDL (P-State Depth Limit). + Test _PPC (Performance Present Capabilities). + Test _PPE (Polling for Platform Error). + Test _PSD (Power State Dependencies). + Test _TDL (T-State Depth Limit). + Test _TPC (Throttling Present Capabilities). + Test _TSD (Throttling State Dependencies). + Test _TSS (Throttling Supported States). + Test _PUR (Processor Utilization Request). + Test _MSG (Message). + Test _SST (System Status). + Test _ALC (Ambient Light Colour Chromaticity). + Test _ALI (Ambient Light Illuminance). + Test _ALT (Ambient Light Temperature). + Test _ALP (Ambient Light Polling). + Test _ALR (Ambient Light Response). + Test _LID (Lid Status). + Test _GTF (Get Task File). + Test _GTM (Get Timing Mode). + Test _MBM (Memory Bandwidth Monitoring Data). + Test _UPC (USB Port Capabilities). + Test _UPD (User Presence Detect). + Test _UPP (User Presence Polling). + Test _GCP (Get Capabilities). + Test _GRT (Get Real Time). + Test _GWS (Get Wake Status). + Test _STP (Set Expired Timer Wake Policy). + Test _STV (Set Timer Value). + Test _TIP (Expired Timer Wake Policy). + Test _TIV (Timer Values). + Test _SBS (Smart Battery Subsystem). + Test _BCT (Battery Charge Time). + Test _BIF (Battery Information). + Test _BIX (Battery Information Extended). + Test _BMA (Battery Measurement Averaging). + Test _BMC (Battery Maintenance Control). + Test _BMD (Battery Maintenance Data). + Test _BMS (Battery Measurement Sampling Time). + Test _BST (Battery Status). + Test _BTP (Battery Trip Point). + Test _BTM (Battery Time). + Test _PCL (Power Consumer List). + Test _PIF (Power Source Information). + Test _PRL (Power Source Redundancy List). + Test _PSR (Power Source). + Test _GAI (Get Averaging Level). + Test _GHL (Get Harware Limit). + Test _PMD (Power Meter Devices). + Test _PMM (Power Meter Measurement). + Test _FIF (Fan Information). + Test _FPS (Fan Performance States). + Test _FSL (Fan Set Level). + Test _FST (Fan Status). + Test _ACx (Active Cooling). + Test _ART (Active Cooling Relationship Table). + Test _CRT (Critical Trip Point). + Test _DTI (Device Temperature Indication). + Test _HOT (Hot Temperature). + Test _NTT (Notification Temp Threshold). + Test _PSL (Passive List). + Test _PSV (Passive Temp). + Test _RTV (Relative Temp Values). + Test _SCP (Set Cooling Policy). + Test _TC1 (Thermal Constant 1). + Test _TC2 (Thermal Constant 2). + Test _TMP (Thermal Zone Current Temp). + Test _TPT (Trip Point Temperature). + Test _TRT (Thermal Relationship Table). + Test _TSP (Thermal Sampling Period). + Test _TST (Temperature Sensor Threshold). + Test _TZD (Thermal Zone Devices). + Test _TZM (Thermal Zone member). + Test _TZP (Thermal Zone Polling). + Test _PTS (Prepare to Sleep). + Test _TTS (Transition to State). + Test _S0 (System S0 State). + Test _S1 (System S1 State). + Test _S2 (System S2 State). + Test _S3 (System S3 State). + Test _S4 (System S4 State). + Test _S5 (System S5 State). + Test _WAK (System Wake). + Test _ADR (Return Unique ID for Device). + Test _BCL (Query List of Brightness Control Levels Supported). + Test _BCM (Set Brightness Level). + Test _BQC (Brightness Query Current Level). + Test _DCS (Return the Status of Output Device). + Test _DDC (Return the EDID for this Device). + Test _DSS (Device Set State). + Test _DGS (Query Graphics State). + Test _DOD (Enumerate All Devices Attached to Display Adapter). + Test _DOS (Enable/Disable Output Switching). + Test _GPD (Get POST Device). + Test _ROM (Get ROM Data). + Test _SPD (Set POST Device). + Test _VPO (Video POST Options). + Test _CBA (Configuration Base Address). + Test _IFT (IPMI Interface Type). + Test _SRV (IPMI Interface Revision). + pcc (1 test): + Processor Clocking Control (PCC) test. + spcr (1 test): + SPCR Serial Port Console Redirection Table test. + wmi (1 test): + Windows Management Instrumentation test. + Batch tests: acpiinfo (3 tests): Determine Kernel ACPI version. @@ -489,4 +704,4 @@ UEFI tests: Test UEFI RT service query variable info interface stress test. Test UEFI RT service get variable interface, invalid parameters. -Total of 403 tests +Total of 603 tests -- 2.1.4 From alex.hung at canonical.com Sat May 30 06:31:39 2015 From: alex.hung at canonical.com (Alex Hung) Date: Sat, 30 May 2015 14:31:39 +0800 Subject: [PATCH] acpi: fwts-tests: Remove redundant tailing space and update fwts-tests Message-ID: <1432967499-31088-1-git-send-email-alex.hung@canonical.com> Signed-off-by: Alex Hung --- .../arg-show-tests-full-0001.log | 16 ++++++++-------- fwts-test/method-0001/method-0001.log | 4 ++-- src/acpi/method/method.c | 4 ++-- src/hpet/hpet_check/hpet_check.c | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log index b32cf2e..bf0fb97 100644 --- a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log +++ b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log @@ -19,8 +19,8 @@ ACPI tests: Test FADT reset register. hpet_check (4 tests): Test HPET base in kernel log. - Test HPET base in HPET table. - Test HPET base in DSDT and/or SSDT. + Test HPET base in HPET table. + Test HPET base in DSDT and/or SSDT. Test HPET configuration. mcfg (2 tests): Validate MCFG table. @@ -121,8 +121,8 @@ ACPI tests: Test _ALC (Ambient Light Colour Chromaticity). Test _ALI (Ambient Light Illuminance). Test _ALT (Ambient Light Temperature). - Test _ALP (Ambient Light Polling). - Test _ALR (Ambient Light Response). + Test _ALP (Ambient Light Polling). + Test _ALR (Ambient Light Response). Test _LID (Lid Status). Test _GTF (Get Task File). Test _GTM (Get Timing Mode). @@ -262,8 +262,8 @@ Batch tests: HDA Audio Pin Configuration test. hpet_check (4 tests): Test HPET base in kernel log. - Test HPET base in HPET table. - Test HPET base in DSDT and/or SSDT. + Test HPET base in HPET table. + Test HPET base in DSDT and/or SSDT. Test HPET configuration. klog (1 test): Kernel log error check. @@ -370,8 +370,8 @@ Batch tests: Test _ALC (Ambient Light Colour Chromaticity). Test _ALI (Ambient Light Illuminance). Test _ALT (Ambient Light Temperature). - Test _ALP (Ambient Light Polling). - Test _ALR (Ambient Light Response). + Test _ALP (Ambient Light Polling). + Test _ALR (Ambient Light Response). Test _LID (Lid Status). Test _GTF (Get Task File). Test _GTM (Get Timing Mode). diff --git a/fwts-test/method-0001/method-0001.log b/fwts-test/method-0001/method-0001.log index 4963154..2c9ffc7 100644 --- a/fwts-test/method-0001/method-0001.log +++ b/fwts-test/method-0001/method-0001.log @@ -641,11 +641,11 @@ method Test 95 of 180: Test _ALT (Ambient Light Temperature). method SKIPPED: Test 95, Skipping test for non-existant object method _ALT. method -method Test 96 of 180: Test _ALP (Ambient Light Polling). +method Test 96 of 180: Test _ALP (Ambient Light Polling). method SKIPPED: Test 96, Skipping test for non-existant object method _ALP. method -method Test 97 of 180: Test _ALR (Ambient Light Response). +method Test 97 of 180: Test _ALR (Ambient Light Response). method SKIPPED: Test 97, Skipping test for non-existant object method _ALR. method diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 828e7aa..c9bf6f9 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -6212,8 +6212,8 @@ static fwts_framework_minor_test method_tests[] = { { method_test_ALC, "Test _ALC (Ambient Light Colour Chromaticity)." }, { method_test_ALI, "Test _ALI (Ambient Light Illuminance)." }, { method_test_ALT, "Test _ALT (Ambient Light Temperature)." }, - { method_test_ALP, "Test _ALP (Ambient Light Polling). "}, - { method_test_ALR, "Test _ALR (Ambient Light Response). "}, + { method_test_ALP, "Test _ALP (Ambient Light Polling)."}, + { method_test_ALR, "Test _ALR (Ambient Light Response)."}, /* Section 9.3 Battery Device */ diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c index 7699bb2..6ccd3b0 100644 --- a/src/hpet/hpet_check/hpet_check.c +++ b/src/hpet/hpet_check/hpet_check.c @@ -424,8 +424,8 @@ static int hpet_check_test4(fwts_framework *fw) static fwts_framework_minor_test hpet_check_tests[] = { { hpet_check_test1, "Test HPET base in kernel log." }, - { hpet_check_test2, "Test HPET base in HPET table. "}, - { hpet_check_test3, "Test HPET base in DSDT and/or SSDT. "}, + { hpet_check_test2, "Test HPET base in HPET table."}, + { hpet_check_test3, "Test HPET base in DSDT and/or SSDT."}, { hpet_check_test4, "Test HPET configuration." }, { NULL, NULL } }; -- 2.1.4 From colin.king at canonical.com Sat May 30 07:55:02 2015 From: colin.king at canonical.com (Colin Ian King) Date: Sat, 30 May 2015 08:55:02 +0100 Subject: ACK: [PATCH] fwts-test: Update tests with new acpi category In-Reply-To: <1432967481-31038-1-git-send-email-alex.hung@canonical.com> References: <1432967481-31038-1-git-send-email-alex.hung@canonical.com> Message-ID: <55696CD6.4030200@canonical.com> On 30/05/15 07:31, Alex Hung wrote: > Signed-off-by: Alex Hung > --- > fwts-test/arg-help-0001/arg-help-0001.log | 1 + > fwts-test/arg-help-0001/arg-help-0002.log | 1 + > fwts-test/arg-help-0001/test-0001.sh | 2 +- > .../arg-show-tests-0001/arg-show-tests-0001.log | 15 ++ > .../arg-show-tests-full-0001.log | 217 ++++++++++++++++++++- > 5 files changed, 234 insertions(+), 2 deletions(-) > > diff --git a/fwts-test/arg-help-0001/arg-help-0001.log b/fwts-test/arg-help-0001/arg-help-0001.log > index 6773a6c..3b79179 100644 > --- a/fwts-test/arg-help-0001/arg-help-0001.log > +++ b/fwts-test/arg-help-0001/arg-help-0001.log > @@ -1,3 +1,4 @@ > +--acpi Run ACPI tests. > --acpica Enable ACPICA run > time options. > --acpica-debug Enable ACPICA debug > diff --git a/fwts-test/arg-help-0001/arg-help-0002.log b/fwts-test/arg-help-0001/arg-help-0002.log > index 6773a6c..3b79179 100644 > --- a/fwts-test/arg-help-0001/arg-help-0002.log > +++ b/fwts-test/arg-help-0001/arg-help-0002.log > @@ -1,3 +1,4 @@ > +--acpi Run ACPI tests. > --acpica Enable ACPICA run > time options. > --acpica-debug Enable ACPICA debug > diff --git a/fwts-test/arg-help-0001/test-0001.sh b/fwts-test/arg-help-0001/test-0001.sh > index 38b3dbb..b06383f 100755 > --- a/fwts-test/arg-help-0001/test-0001.sh > +++ b/fwts-test/arg-help-0001/test-0001.sh > @@ -35,5 +35,5 @@ fi > stty cols 80 2> /dev/null > tset 2> /dev/null > > -#rm $TMPLOG > +rm $TMPLOG > exit $ret > diff --git a/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log b/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log > index e34af88..8d9b691 100644 > --- a/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log > +++ b/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log > @@ -1,3 +1,18 @@ > +ACPI tests: > + acpiinfo General ACPI information test. > + acpitables ACPI table settings sanity tests. > + apicinstance Test for single instance of APIC/MADT table. > + checksum ACPI table checksum test. > + cstates Processor C state support test. > + dmar DMA Remapping (VT-d) test. > + fadt FADT SCI_EN enabled tests. > + hpet_check HPET configuration tests. > + mcfg MCFG PCI Express* memory mapped config space test. > + method ACPI DSDT Method Semantic tests. > + pcc Processor Clocking Control (PCC) test. > + spcr SPCR Serial Port Console Redirection Table test. > + wmi Extract and analyse Windows Management Instrumentation (WMI). > + > Batch tests: > acpiinfo General ACPI information test. > acpitables ACPI table settings sanity tests. > diff --git a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log > index b72ee5b..b32cf2e 100644 > --- a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log > +++ b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log > @@ -1,3 +1,218 @@ > +ACPI tests: > + acpiinfo (3 tests): > + Determine Kernel ACPI version. > + Determine machine's ACPI version. > + Determine AML compiler. > + acpitables (2 tests): > + Test ACPI tables. > + Test ACPI headers. > + apicinstance (1 test): > + Test for single instance of APIC/MADT table. > + checksum (1 test): > + ACPI table checksum test. > + cstates (1 test): > + Test all CPUs C-states. > + dmar (1 test): > + DMA Remapping test. > + fadt (2 tests): > + Test FADT SCI_EN bit is enabled. > + Test FADT reset register. > + hpet_check (4 tests): > + Test HPET base in kernel log. > + Test HPET base in HPET table. > + Test HPET base in DSDT and/or SSDT. > + Test HPET configuration. > + mcfg (2 tests): > + Validate MCFG table. > + Validate MCFG PCI config space. > + method (180 tests): > + Test Method Names. > + Test _AEI. > + Test _EVT (Event Method). > + Test _DLM (Device Lock Mutex). > + Test _PIC (Inform AML of Interrupt Model). > + Test _CID (Compatible ID). > + Test _DDN (DOS Device Name). > + Test _HID (Hardware ID). > + Test _HRV (Hardware Revision Number). > + Test _MLS (Multiple Language String). > + Test _PLD (Physical Device Location). > + Test _SUB (Subsystem ID). > + Test _SUN (Slot User Number). > + Test _STR (String). > + Test _UID (Unique ID). > + Test _CDM (Clock Domain). > + Test _CRS (Current Resource Settings). > + Test _DSD (Device Specific Data). > + Test _DIS (Disable). > + Test _DMA (Direct Memory Access). > + Test _FIX (Fixed Register Resource Provider). > + Test _GSB (Global System Interrupt Base). > + Test _HPP (Hot Plug Parameters). > + Test _PRS (Possible Resource Settings). > + Test _PXM (Proximity). > + Test _CCA (Cache Coherency Attribute). > + Test _EDL (Eject Device List). > + Test _EJD (Ejection Dependent Device). > + Test _EJ0 (Eject). > + Test _EJ1 (Eject). > + Test _EJ2 (Eject). > + Test _EJ3 (Eject). > + Test _EJ4 (Eject). > + Test _LCK (Lock). > + Test _RMV (Remove). > + Test _STA (Status). > + Test _DEP (Operational Region Dependencies). > + Test _BDN (BIOS Dock Name). > + Test _BBN (Base Bus Number). > + Test _DCK (Dock). > + Test _INI (Initialize). > + Test _GLK (Global Lock). > + Test _SEG (Segment). > + Test _OFF (Set resource off). > + Test _ON (Set resource on). > + Test _DSW (Device Sleep Wake). > + Test _IRC (In Rush Current). > + Test _PRE (Power Resources for Enumeration). > + Test _PR0 (Power Resources for D0). > + Test _PR1 (Power Resources for D1). > + Test _PR2 (Power Resources for D2). > + Test _PR3 (Power Resources for D3). > + Test _PRW (Power Resources for Wake). > + Test _PS0 (Power State 0). > + Test _PS1 (Power State 1). > + Test _PS2 (Power State 2). > + Test _PS3 (Power State 3). > + Test _PSC (Power State Current). > + Test _PSE (Power State for Enumeration). > + Test _PSW (Power State Wake). > + Test _S1D (S1 Device State). > + Test _S2D (S2 Device State). > + Test _S3D (S3 Device State). > + Test _S4D (S4 Device State). > + Test _S0W (S0 Device Wake State). > + Test _S1W (S1 Device Wake State). > + Test _S2W (S2 Device Wake State). > + Test _S3W (S3 Device Wake State). > + Test _S4W (S4 Device Wake State). > + Test _S0_ (S0 System State). > + Test _S1_ (S1 System State). > + Test _S2_ (S2 System State). > + Test _S3_ (S3 System State). > + Test _S4_ (S4 System State). > + Test _S5_ (S5 System State). > + Test _SWS (System Wake Source). > + Test _PSS (Performance Supported States). > + Test _CPC (Continuous Performance Control). > + Test _CSD (C State Dependencies). > + Test _CST (C States). > + Test _PCT (Performance Control). > + Test _PDL (P-State Depth Limit). > + Test _PPC (Performance Present Capabilities). > + Test _PPE (Polling for Platform Error). > + Test _PSD (Power State Dependencies). > + Test _TDL (T-State Depth Limit). > + Test _TPC (Throttling Present Capabilities). > + Test _TSD (Throttling State Dependencies). > + Test _TSS (Throttling Supported States). > + Test _PUR (Processor Utilization Request). > + Test _MSG (Message). > + Test _SST (System Status). > + Test _ALC (Ambient Light Colour Chromaticity). > + Test _ALI (Ambient Light Illuminance). > + Test _ALT (Ambient Light Temperature). > + Test _ALP (Ambient Light Polling). > + Test _ALR (Ambient Light Response). > + Test _LID (Lid Status). > + Test _GTF (Get Task File). > + Test _GTM (Get Timing Mode). > + Test _MBM (Memory Bandwidth Monitoring Data). > + Test _UPC (USB Port Capabilities). > + Test _UPD (User Presence Detect). > + Test _UPP (User Presence Polling). > + Test _GCP (Get Capabilities). > + Test _GRT (Get Real Time). > + Test _GWS (Get Wake Status). > + Test _STP (Set Expired Timer Wake Policy). > + Test _STV (Set Timer Value). > + Test _TIP (Expired Timer Wake Policy). > + Test _TIV (Timer Values). > + Test _SBS (Smart Battery Subsystem). > + Test _BCT (Battery Charge Time). > + Test _BIF (Battery Information). > + Test _BIX (Battery Information Extended). > + Test _BMA (Battery Measurement Averaging). > + Test _BMC (Battery Maintenance Control). > + Test _BMD (Battery Maintenance Data). > + Test _BMS (Battery Measurement Sampling Time). > + Test _BST (Battery Status). > + Test _BTP (Battery Trip Point). > + Test _BTM (Battery Time). > + Test _PCL (Power Consumer List). > + Test _PIF (Power Source Information). > + Test _PRL (Power Source Redundancy List). > + Test _PSR (Power Source). > + Test _GAI (Get Averaging Level). > + Test _GHL (Get Harware Limit). > + Test _PMD (Power Meter Devices). > + Test _PMM (Power Meter Measurement). > + Test _FIF (Fan Information). > + Test _FPS (Fan Performance States). > + Test _FSL (Fan Set Level). > + Test _FST (Fan Status). > + Test _ACx (Active Cooling). > + Test _ART (Active Cooling Relationship Table). > + Test _CRT (Critical Trip Point). > + Test _DTI (Device Temperature Indication). > + Test _HOT (Hot Temperature). > + Test _NTT (Notification Temp Threshold). > + Test _PSL (Passive List). > + Test _PSV (Passive Temp). > + Test _RTV (Relative Temp Values). > + Test _SCP (Set Cooling Policy). > + Test _TC1 (Thermal Constant 1). > + Test _TC2 (Thermal Constant 2). > + Test _TMP (Thermal Zone Current Temp). > + Test _TPT (Trip Point Temperature). > + Test _TRT (Thermal Relationship Table). > + Test _TSP (Thermal Sampling Period). > + Test _TST (Temperature Sensor Threshold). > + Test _TZD (Thermal Zone Devices). > + Test _TZM (Thermal Zone member). > + Test _TZP (Thermal Zone Polling). > + Test _PTS (Prepare to Sleep). > + Test _TTS (Transition to State). > + Test _S0 (System S0 State). > + Test _S1 (System S1 State). > + Test _S2 (System S2 State). > + Test _S3 (System S3 State). > + Test _S4 (System S4 State). > + Test _S5 (System S5 State). > + Test _WAK (System Wake). > + Test _ADR (Return Unique ID for Device). > + Test _BCL (Query List of Brightness Control Levels Supported). > + Test _BCM (Set Brightness Level). > + Test _BQC (Brightness Query Current Level).. > + Test _DCS (Return the Status of Output Device). > + Test _DDC (Return the EDID for this Device). > + Test _DSS (Device Set State). > + Test _DGS (Query Graphics State). > + Test _DOD (Enumerate All Devices Attached to Display Adapter). > + Test _DOS (Enable/Disable Output Switching). > + Test _GPD (Get POST Device). > + Test _ROM (Get ROM Data). > + Test _SPD (Set POST Device). > + Test _VPO (Video POST Options). > + Test _CBA (Configuration Base Address). > + Test _IFT (IPMI Interface Type). > + Test _SRV (IPMI Interface Revision). > + pcc (1 test): > + Processor Clocking Control (PCC) test. > + spcr (1 test): > + SPCR Serial Port Console Redirection Table test. > + wmi (1 test): > + Windows Management Instrumentation test. > + > Batch tests: > acpiinfo (3 tests): > Determine Kernel ACPI version. > @@ -489,4 +704,4 @@ UEFI tests: > Test UEFI RT service query variable info interface stress test. > Test UEFI RT service get variable interface, invalid parameters. > > -Total of 403 tests > +Total of 603 tests > Acked-by: Colin Ian King From colin.king at canonical.com Sat May 30 07:55:35 2015 From: colin.king at canonical.com (Colin Ian King) Date: Sat, 30 May 2015 08:55:35 +0100 Subject: ACK: [PATCH] acpi: fwts-tests: Remove redundant tailing space and update fwts-tests In-Reply-To: <1432967499-31088-1-git-send-email-alex.hung@canonical.com> References: <1432967499-31088-1-git-send-email-alex.hung@canonical.com> Message-ID: <55696CF7.9030202@canonical.com> On 30/05/15 07:31, Alex Hung wrote: > Signed-off-by: Alex Hung > --- > .../arg-show-tests-full-0001.log | 16 ++++++++-------- > fwts-test/method-0001/method-0001.log | 4 ++-- > src/acpi/method/method.c | 4 ++-- > src/hpet/hpet_check/hpet_check.c | 4 ++-- > 4 files changed, 14 insertions(+), 14 deletions(-) > > diff --git a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log > index b32cf2e..bf0fb97 100644 > --- a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log > +++ b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log > @@ -19,8 +19,8 @@ ACPI tests: > Test FADT reset register. > hpet_check (4 tests): > Test HPET base in kernel log. > - Test HPET base in HPET table. > - Test HPET base in DSDT and/or SSDT. > + Test HPET base in HPET table. > + Test HPET base in DSDT and/or SSDT. > Test HPET configuration. > mcfg (2 tests): > Validate MCFG table. > @@ -121,8 +121,8 @@ ACPI tests: > Test _ALC (Ambient Light Colour Chromaticity). > Test _ALI (Ambient Light Illuminance). > Test _ALT (Ambient Light Temperature). > - Test _ALP (Ambient Light Polling). > - Test _ALR (Ambient Light Response). > + Test _ALP (Ambient Light Polling). > + Test _ALR (Ambient Light Response). > Test _LID (Lid Status). > Test _GTF (Get Task File). > Test _GTM (Get Timing Mode). > @@ -262,8 +262,8 @@ Batch tests: > HDA Audio Pin Configuration test. > hpet_check (4 tests): > Test HPET base in kernel log. > - Test HPET base in HPET table. > - Test HPET base in DSDT and/or SSDT. > + Test HPET base in HPET table. > + Test HPET base in DSDT and/or SSDT. > Test HPET configuration. > klog (1 test): > Kernel log error check. > @@ -370,8 +370,8 @@ Batch tests: > Test _ALC (Ambient Light Colour Chromaticity). > Test _ALI (Ambient Light Illuminance). > Test _ALT (Ambient Light Temperature). > - Test _ALP (Ambient Light Polling). > - Test _ALR (Ambient Light Response). > + Test _ALP (Ambient Light Polling). > + Test _ALR (Ambient Light Response). > Test _LID (Lid Status). > Test _GTF (Get Task File). > Test _GTM (Get Timing Mode). > diff --git a/fwts-test/method-0001/method-0001.log b/fwts-test/method-0001/method-0001.log > index 4963154..2c9ffc7 100644 > --- a/fwts-test/method-0001/method-0001.log > +++ b/fwts-test/method-0001/method-0001.log > @@ -641,11 +641,11 @@ method Test 95 of 180: Test _ALT (Ambient Light Temperature). > method SKIPPED: Test 95, Skipping test for non-existant object > method _ALT. > method > -method Test 96 of 180: Test _ALP (Ambient Light Polling). > +method Test 96 of 180: Test _ALP (Ambient Light Polling). > method SKIPPED: Test 96, Skipping test for non-existant object > method _ALP. > method > -method Test 97 of 180: Test _ALR (Ambient Light Response). > +method Test 97 of 180: Test _ALR (Ambient Light Response). > method SKIPPED: Test 97, Skipping test for non-existant object > method _ALR. > method > diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c > index 828e7aa..c9bf6f9 100644 > --- a/src/acpi/method/method.c > +++ b/src/acpi/method/method.c > @@ -6212,8 +6212,8 @@ static fwts_framework_minor_test method_tests[] = { > { method_test_ALC, "Test _ALC (Ambient Light Colour Chromaticity)." }, > { method_test_ALI, "Test _ALI (Ambient Light Illuminance)." }, > { method_test_ALT, "Test _ALT (Ambient Light Temperature)." }, > - { method_test_ALP, "Test _ALP (Ambient Light Polling). "}, > - { method_test_ALR, "Test _ALR (Ambient Light Response). "}, > + { method_test_ALP, "Test _ALP (Ambient Light Polling)."}, > + { method_test_ALR, "Test _ALR (Ambient Light Response)."}, > > /* Section 9.3 Battery Device */ > > diff --git a/src/hpet/hpet_check/hpet_check.c b/src/hpet/hpet_check/hpet_check.c > index 7699bb2..6ccd3b0 100644 > --- a/src/hpet/hpet_check/hpet_check.c > +++ b/src/hpet/hpet_check/hpet_check.c > @@ -424,8 +424,8 @@ static int hpet_check_test4(fwts_framework *fw) > > static fwts_framework_minor_test hpet_check_tests[] = { > { hpet_check_test1, "Test HPET base in kernel log." }, > - { hpet_check_test2, "Test HPET base in HPET table. "}, > - { hpet_check_test3, "Test HPET base in DSDT and/or SSDT. "}, > + { hpet_check_test2, "Test HPET base in HPET table."}, > + { hpet_check_test3, "Test HPET base in DSDT and/or SSDT."}, > { hpet_check_test4, "Test HPET configuration." }, > { NULL, NULL } > }; > Thanks for spotting these. Acked-by: Colin Ian King