diff -Naur fwts-0.23.13/debian/changelog fwts-0.23.23/debian/changelog --- fwts-0.23.13/debian/changelog 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/debian/changelog 2011-08-31 16:09:22.000000000 +0000 @@ -1,3 +1,141 @@ +fwts (0.23.23) oneiric; urgency=low + + * cmos: cmosdump: fix floppy disk info + * cmos: cmosdump: fix register 0x0b dump (LP: #837969) + + -- Colin King Wed, 31 Aug 2011 17:07:34 +0100 + +fwts (0.23.22) oneiric; urgency=low + + * declare various private variables and functions static (LP: #837215) + * bios: multiproc: make mpdump_get_apic_id static + * bios: multiproc: remove redundant mpcheck_get_apic_id() + * cpu: virt: make cpu_has_vmx static + * acpi: lid: make lid_*() static + * acpi: ac_adapter: make ac_adapter_check_field static + * acpi: powerbutton: make power_button_check_field static + * acpi: brightness: make *_setting static + * cpu: virt: make cpu_has_svm, vt_locked_by_bios static + * lib: framework: make init funcs static + * acpi: wmi: make wmi_wdg_flags_to_text() static + * bios: mtrr: rename fwts_virt_cpuinfo to fwts_cpuinfo + * acpi: acpidump: make table_vec static + * cpu: msr: make cpuinfo static + * acpi: ac_adapter: make ac_adapterdir static + * acpi: lid: make liddir static + * acpi: powerbutton: make power_buttondir static + * bios: mtrr: remove redundant mtrr_resource + * acpi: acpidump: fix typo 'Sealed Case' + * cpu: msr: drop TSC_AUX and SMBASE tests (LP: #834591) + + -- Colin King Tue, 30 Aug 2011 09:18:53 +0100 + +fwts (0.23.21) oneiric; urgency=low + + * acpi: acpitables: remove false positive warnings (LP: #833644) + * acpi: method: don't run mobile platform tests on servers (LP: #834554) + * bios: mpcheck: check uniqueness of CPU APIC IDs (LP: #834504) + * acpi: cstates: drop experimental status of the test. + + -- Colin King Fri, 26 Aug 2011 11:05:19 +0100 + +fwts (0.23.20) oneiric; urgency=low + + * hpet: hpet_check: get HPET base on newer kernel logs (LP: #832273) + + -- Colin King Tue, 23 Aug 2011 19:56:23 +0100 + +fwts (0.23.19) oneiric; urgency=low + + * apci: fan: use newer thermal interface, test fans on loaded CPU (LP: #831905) + + -- Colin King Tue, 23 Aug 2011 12:12:12 +0100 + +fwts (0.23.18) oneiric; urgency=low + + * lib: acpica: ensure table pointers are NULL when table input is corrupt (LP: #826774) + + -- Colin King Mon, 15 Aug 2011 15:33:30 +0100 + +fwts (0.23.17) oneiric; urgency=low + + * acpi: method: tidy up source. + * acpi: acpitables: tidy up source. + * acpi: wmi: tidy up source. + * acpi: wakealarm: tidy up source. + * acpi: syntaxcheck: tidy up source. + * acpi: s4: tidy up source. + * acpi: s3power: tidy up source. + * acpi: s3: tidy up source. + * acpi: powerbutton: tidy up source. + * acpi: osilinux: tidy up source. + * acpi: mcfg: tidy up source. + * acpi: lid: fix failure format string (LP: #826676) + * acpi: klog: tidy up source. + * acpi: fan: tidy up source. + * acpi: fadt: tidy up source. + * acpi: dmar: tidy up source. + * acpi: cstates: tidy up source. + * acpi: common: tidy up source. + * acpi: checksum: tidy up source. + * acpi: battery: tidy up source. + * acpi: apicinstance: tidy up source. + * acpi: acpiinfo: tidy up source. + * acpi: ac_adapter: tidy up source. + + -- Colin King Mon, 15 Aug 2011 12:11:12 +0100 + +fwts (0.23.16) oneiric; urgency=low + + * cpu: virt: tidy up sources. + * cpu: nx: tidy up source. + * cpu: msr: tidy up source. + * cpu: microcode: tidy up source. + * cpu: maxfreq: tidy up source. + * cpu: cpufreq: tidy up source. + * hotkey: hotkey: tidy up source. + * dmi: dmi_decode: fix failure format string (LP: #826418) + * kernel: version: tidy up source. + * kernel: oops: tidy up source. + * cmos: cmosdump: tidy up source. + * apic: apicedge: tidy up source. + * pci: maxreadreq: tidy up source. + * pci: crs: tidy up source. + + -- Colin King Sun, 14 Aug 2011 21:04:00 +0100 + +fwts (0.23.15) oneiric; urgency=low + + * lib: fwts_framework: helper macros: use fmt arg + * bios: os2gap: add more failure info. + * bios: smbios: tidy up source. + * bios: romdump: tidy up source. + * bios: os2gap: fix failure format string (LP: #825945) + * bios: mtrr: tidy up source. + * bios: memmapdump: tidy up source. + * bios: hdaaudio: tidy up source. + * bios: ebda_region: tidy up source. + * bios: ebdadump: tidy up source. + * bios: bios_info: tidy up source. + * bios: bios32: tidy up source. + * bios: mpcheck: tidy up source. + + -- Colin King Sat, 13 Aug 2011 21:33:00 +0100 + +fwts (0.23.14) oneiric; urgency=low + + * lib: fwts_acpi_tables: make acpidump parsing more resiliant to bad data. + * lib: fwts_acpi_tables: read in data correctly (LP: #818042) + * acpi: checksum: handle RSDP. + * lib: fwts_acpi_tables.h: add fwts_acpi_checksum + * lib: fwts_acpi_tables: name RSD PTR to RSDP. + * lib: fwts_acpi_tables: handle ACPI 1.0 sized RSDP + * lib: fwts_acpi: rsdp requires a 64 bit xsdt + * acpi: syntaxcheck: log errors as per-test failures and include unique error code in error. + * acpi: acpitables: add more advice, deprecate FACS test, it was nonsense. + + -- Colin King Fri, 29 Jul 2011 17:28:00 +0100 + fwts (0.23.13) oneiric; urgency=low * lib + method test: better handling of object eval errors. (LP: #816877) diff -Naur fwts-0.23.13/src/acpi/ac_adapter/ac_adapter.c fwts-0.23.23/src/acpi/ac_adapter/ac_adapter.c --- fwts-0.23.13/src/acpi/ac_adapter/ac_adapter.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/ac_adapter/ac_adapter.c 2011-08-31 16:09:22.000000000 +0000 @@ -29,14 +29,16 @@ #include #include -DIR *ac_adapterdir; +static DIR *ac_adapterdir; #define AC_ADAPTER_PATH "/proc/acpi/ac_adapter" static int ac_adapter_init(fwts_framework *fw) { if (!(ac_adapterdir = opendir(AC_ADAPTER_PATH))) { - fwts_failed(fw, LOG_LEVEL_LOW, "NoACAdapterEntry", "No %s directory available: cannot test.", AC_ADAPTER_PATH); + fwts_failed(fw, LOG_LEVEL_LOW, "NoACAdapterEntry", + "No %s directory available: cannot test.", + AC_ADAPTER_PATH); return FWTS_ERROR; } @@ -51,7 +53,7 @@ return FWTS_OK; } -void ac_adapter_check_field(char *field, char *contents, int *matching, int *not_matching) +static void ac_adapter_check_field(char *field, char *contents, int *matching, int *not_matching) { struct dirent *entry; @@ -62,7 +64,8 @@ char path[PATH_MAX]; char *data; - snprintf(path, sizeof(path), AC_ADAPTER_PATH "/%s/%s", entry->d_name, field); + snprintf(path, sizeof(path), AC_ADAPTER_PATH "/%s/%s", + entry->d_name, field); if ((data = fwts_get(path)) != NULL) { if (strstr(data, contents)) (*matching)++; @@ -82,7 +85,8 @@ ac_adapter_check_field("state", "state:", &matching, ¬_matching); if ((matching == 0) || (not_matching > 0)) - fwts_failed(fw, LOG_LEVEL_LOW, "NoACAdapterState", "Failed to detect any state in the ac_adapter state info."); + fwts_failed(fw, LOG_LEVEL_LOW, "NoACAdapterState", + "Failed to detect any state in the ac_adapter state info."); else fwts_passed(fw, "Detected a state in the ac_adapter state info."); @@ -100,7 +104,8 @@ ac_adapter_check_field("state", "on-line", &matching, ¬_matching); if ((matching == 0) || (not_matching > 0)) - fwts_failed(fw, LOG_LEVEL_HIGH, "NoACAdapterOnLine", "Failed to detect an ac_adapter on-line state."); + fwts_failed(fw, LOG_LEVEL_HIGH, "NoACAdapterOnLine", + "Failed to detect an ac_adapter on-line state."); else fwts_passed(fw, "Detected ac_adapter on-line state."); @@ -132,7 +137,8 @@ if ((buffer = fwts_acpi_event_read(fd, &len, 1)) != NULL) { if (strstr(buffer, "ac_adapter")) { events++; - ac_adapter_check_field("state", "off-line", &matching, ¬_matching); + ac_adapter_check_field("state", "off-line", + &matching, ¬_matching); break; } free(buffer); @@ -140,10 +146,12 @@ fwts_printf(fw, "Waiting %2.2d/20\r", 20-i); } if (events == 0) - fwts_failed(fw, LOG_LEVEL_HIGH, "NoACAdapterEventsOff", "Did not detect any ACPI ac-adapter events while waiting for power to be disconnected."); + fwts_failed(fw, LOG_LEVEL_HIGH, "NoACAdapterEventsOff", + "Did not detect any ACPI ac-adapter events while waiting for power to be disconnected."); else if ((matching == 0) || (not_matching > 0)) - fwts_failed(fw, LOG_LEVEL_HIGH, "NoACAdapterOffline", "Could not detect ac_adapter off-line state."); + fwts_failed(fw, LOG_LEVEL_HIGH, "NoACAdapterOffline", + "Could not detect ac_adapter off-line state."); else fwts_passed(fw, "Detected ac_adapter off-line state."); @@ -158,7 +166,8 @@ events++; if (strstr(buffer, "ac_adapter")) { events++; - ac_adapter_check_field("state", "on-line", &matching, ¬_matching); + ac_adapter_check_field("state", "on-line", + &matching, ¬_matching); break; } free(buffer); @@ -166,10 +175,12 @@ fwts_printf(fw, "Waiting %2.2d/20\r", 20-i); } if (events == 0) - fwts_failed(fw, LOG_LEVEL_HIGH, "NoACAdapterEventsOn", "Did not detect any ACPI ac-adapter events while waiting for power to be re-connected."); + fwts_failed(fw, LOG_LEVEL_HIGH, "NoACAdapterEventsOn", + "Did not detect any ACPI ac-adapter events while waiting for power to be re-connected."); else if ((matching == 0) || (not_matching > 0)) - fwts_failed(fw, LOG_LEVEL_HIGH, "NoACAdapterOnline", "Could not detect ac_adapter on-line state."); + fwts_failed(fw, LOG_LEVEL_HIGH, "NoACAdapterOnline", + "Could not detect ac_adapter on-line state."); else fwts_passed(fw, "Detected ac_adapter on-line state."); diff -Naur fwts-0.23.13/src/acpi/acpidump/acpidump.c fwts-0.23.23/src/acpi/acpidump/acpidump.c --- fwts-0.23.13/src/acpi/acpidump/acpidump.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/acpi/acpidump/acpidump.c 2011-08-31 16:09:22.000000000 +0000 @@ -561,7 +561,7 @@ FIELD_BITF(" 32 bit PM timer (V1)", fwts_acpi_table_fadt, flags, 1, 8), FIELD_BITF(" Docking Capability (V1)", fwts_acpi_table_fadt, flags, 1, 9), FIELD_BITF(" Reset Register Supported (V2)", fwts_acpi_table_fadt, flags, 1, 10), - FIELD_BITF(" Selead Case (V3)", fwts_acpi_table_fadt, flags, 1, 11), + FIELD_BITF(" Sealed Case (V3)", fwts_acpi_table_fadt, flags, 1, 11), FIELD_BITF(" Headless, No Video (V3)", fwts_acpi_table_fadt, flags, 1, 12), FIELD_BITF(" Use native instr. after SLP_TYPx (V3)", fwts_acpi_table_fadt, flags, 1, 13), FIELD_BITF(" PCI_EXP_WAK bits supported (V4)", fwts_acpi_table_fadt, flags, 1, 14), @@ -983,7 +983,7 @@ #define acpidump_hest acpi_dump_raw_table #define acpidump_msct acpi_dump_raw_table -acpidump_table_vec table_vec[] = { +static acpidump_table_vec table_vec[] = { { "APIC", acpidump_madt, 1 }, { "BERT", acpidump_bert, 1 }, { "BOOT", acpidump_boot, 1 }, diff -Naur fwts-0.23.13/src/acpi/acpiinfo/acpiinfo.c fwts-0.23.23/src/acpi/acpiinfo/acpiinfo.c --- fwts-0.23.13/src/acpi/acpiinfo/acpiinfo.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/acpiinfo/acpiinfo.c 2011-08-31 16:09:22.000000000 +0000 @@ -30,13 +30,15 @@ #include #include -static void acpiinfo_check(fwts_framework *fw, char *line, int repeated, char *prevline, void *private, int *errors) +static void acpiinfo_check(fwts_framework *fw, char *line, + int repeated, char *prevline, void *private, int *errors) { if (strstr(line, "ACPI: Subsystem revision")!=NULL) { char *version = strstr(line,"sion "); if (version) { version+=5; - fwts_log_info(fw, "Linux ACPI interpreter version %s.", version); + fwts_log_info(fw, "Linux ACPI interpreter version %s.", + version); } } @@ -46,117 +48,143 @@ vendor="Microsoft"; if (strstr(line,"INTL")) vendor="Intel"; - fwts_log_info(fw,"DSDT was compiled by the %s AML compiler.", vendor); + fwts_log_info(fw,"DSDT was compiled by the %s AML compiler.", + vendor); } if (strstr(line, "Disabling IRQ")!=NULL && prevline && strstr(prevline,"acpi_irq")) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "ACPIIRQStuck", "ACPI interrupt got stuck: level triggered?"); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "ACPIIRQStuck", + "ACPI interrupt got stuck: level triggered?"); fwts_tag_failed(fw, FWTS_TAG_BIOS_IRQ); fwts_log_info_verbatum(fw,"%s", line); } if (prevline && strstr(prevline, "*** Error: Return object type is incorrect")) { - fwts_failed(fw, LOG_LEVEL_HIGH, "BadObjectReturn", "Return object type is incorrect: %s.", line); + fwts_failed(fw, LOG_LEVEL_HIGH, "BadObjectReturn", + "Return object type is incorrect: %s.", line); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); fwts_log_info_verbatum(fw,"%s", line); } if (strstr(line,"ACPI: acpi_ec_space_handler: bit_width is 32, should be")) { - fwts_failed(fw, LOG_LEVEL_LOW, "ECBitWidth", "Embedded controller bit_width is incorrect: %s.", line); + fwts_failed(fw, LOG_LEVEL_LOW, "ECBitWidth", + "Embedded controller bit_width is incorrect: %s.", + line); fwts_tag_failed(fw, FWTS_TAG_EMBEDDED_CONTROLLER); fwts_log_info_verbatum(fw,"%s", line); } if (strstr(line,"acpi_ec_space_handler: bit_width should be")) { - fwts_failed(fw, LOG_LEVEL_LOW, "ECBitWidth2", "Embedded controller bit_width is incorrect: %s.", line); + fwts_failed(fw, LOG_LEVEL_LOW, "ECBitWidth2", + "Embedded controller bit_width is incorrect: %s.", + line); fwts_tag_failed(fw, FWTS_TAG_EMBEDDED_CONTROLLER); fwts_log_info_verbatum(fw,"%s", line); } if (strstr(line,"Warning: acpi_table_parse(ACPI_SRAT) returned 0!")) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoSRAT", "SRAT table cannot be found"); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoSRAT", + "SRAT table cannot be found"); fwts_tag_failed(fw, FWTS_TAG_ACPI); fwts_log_info_verbatum(fw,"%s", line); } if (strstr(line,"Warning: acpi_table_parse(ACPI_SLIT) returned 0!")) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoSLIT", "SLIT table cannot be found"); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoSLIT", + "SLIT table cannot be found"); fwts_tag_failed(fw, FWTS_TAG_ACPI); fwts_log_info_verbatum(fw,"%s", line); } - + if (strstr(line, "WARNING: No sibling found for CPU")) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUHyperthreading", "Hyperthreading CPU enumeration fails."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUHyperthreading", + "Hyperthreading CPU enumeration fails."); fwts_log_info_verbatum(fw,"%s", line); } - if (prevline && strstr(line, ">>> ERROR: Invalid checksum") && strlen(prevline)>11) { + if (prevline && strstr(line, ">>> ERROR: Invalid checksum") && + strlen(prevline)>11) { char tmp[4096]; + strncpy(tmp, prevline, sizeof(tmp)); tmp[11] = '\0'; - fwts_failed(fw, LOG_LEVEL_HIGH, "InvalidTableChecksum", "ACPI table %s has an invalid checksum.", tmp+6); + fwts_failed(fw, LOG_LEVEL_HIGH, "InvalidTableChecksum", + "ACPI table %s has an invalid checksum.", tmp+6); fwts_tag_failed(fw, FWTS_TAG_ACPI_TABLE_CHECKSUM); fwts_log_info_verbatum(fw,"%s", line); } if (strstr(line, "MP-BIOS bug: 8254 timer not connected to IO-APIC")) { - fwts_failed(fw, LOG_LEVEL_HIGH, "8254NotConnected", "8254 timer not connected to IO-APIC: %s.", line); + fwts_failed(fw, LOG_LEVEL_HIGH, "8254NotConnected", + "8254 timer not connected to IO-APIC: %s.", line); fwts_tag_failed(fw, FWTS_TAG_ACPI_APIC); fwts_log_info_verbatum(fw,"%s", line); } - if (strstr(line, "ACPI: PCI Interrupt Link") && strstr(line, " disabled and referenced, BIOS bug.")) { + if (strstr(line, "ACPI: PCI Interrupt Link") && + strstr(line, " disabled and referenced, BIOS bug.")) { fwts_failed(fw, LOG_LEVEL_HIGH, "PCIInterruptLink", "%s", line); fwts_tag_failed(fw, FWTS_TAG_BIOS_IRQ); fwts_log_info_verbatum(fw,"%s", line); } - if (strstr(line, "*** Warning Inconsistent FADT length") && strstr(line, "using FADT V1.0 portion of table")) { - fwts_failed(fw, LOG_LEVEL_HIGH, "FADTRevsion", "FADT table claims to be of higher revision than it is."); + if (strstr(line, "*** Warning Inconsistent FADT length") && + strstr(line, "using FADT V1.0 portion of table")) { + fwts_failed(fw, LOG_LEVEL_HIGH, "FADTRevsion", + "FADT table claims to be of higher revision than it is."); fwts_tag_failed(fw, FWTS_TAG_ACPI_INVALID_TABLE); fwts_log_info_verbatum(fw,"%s", line); } if (strstr(line, "thermal_get_trip_point: Invalid active threshold")) { - fwts_failed(fw, LOG_LEVEL_CRITICAL, "_AC0TripPoint", "_AC0 thermal trip point is invalid."); + fwts_failed(fw, LOG_LEVEL_CRITICAL, "_AC0TripPoint", + "_AC0 thermal trip point is invalid."); fwts_tag_failed(fw, FWTS_TAG_ACPI_THERMAL); fwts_log_info_verbatum(fw,"%s", line); } if (strstr(line, "MMCONFIG has no entries")) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MCFGNoEntries", "The MCFG table has no entries!"); + fwts_failed(fw, LOG_LEVEL_HIGH, "MCFGNoEntries", + "The MCFG table has no entries!"); fwts_tag_failed(fw, FWTS_TAG_ACPI_INVALID_TABLE); fwts_log_info_verbatum(fw,"%s", line); } if (strstr(line, "MMCONFIG not in low 4GB of memory")) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MCFGEntriesTooHigh", "The MCFG table entries are not in the lower 4Gb of RAM."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "MCFGEntriesTooHigh", + "The MCFG table entries are not in the lower 4Gb of RAM."); fwts_tag_failed(fw, FWTS_TAG_BIOS_MMCONFIG); fwts_log_info_verbatum(fw,"%s", line); } - if (strstr(line, "pcie_portdrv_probe->Dev") && strstr(line, "has invalid IRQ. Check vendor BIOS")) { - fwts_failed(fw, LOG_LEVEL_HIGH, "PCIExpressInvalidIRQ", "PCI Express port driver reports an invalid IRQ."); + if (strstr(line, "pcie_portdrv_probe->Dev") && + strstr(line, "has invalid IRQ. Check vendor BIOS")) { + fwts_failed(fw, LOG_LEVEL_HIGH, "PCIExpressInvalidIRQ", + "PCI Express port driver reports an invalid IRQ."); fwts_tag_failed(fw, FWTS_TAG_BIOS_IRQ); fwts_log_info_verbatum(fw,"%s", line); } - + if (strstr(line, "OCHI: BIOS handoff failed (BIOS bug")) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "OHCIEmulation", "OHCI BIOS emulation handoff failed."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "OHCIEmulation", + "OHCI BIOS emulation handoff failed."); fwts_tag_failed(fw, FWTS_TAG_BIOS); fwts_log_info_verbatum(fw,"%s", line); - fwts_advice(fw, "Generally this means that the EHCI driver was unable to take " - "control of the USB controller away from the BIOS. " - "Disabling USB legacy mode in the BIOS may help."); + fwts_advice(fw, + "Generally this means that the EHCI driver was unable " + "to take control of the USB controller away from the " + "BIOS. Disabling USB legacy mode in the BIOS may help."); } if (strstr(line, "EHCI: BIOS handoff failed (BIOS bug")) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "EHCIEmulation", "EHCI BIOS emulation handoff failed."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "EHCIEmulation", + "EHCI BIOS emulation handoff failed."); fwts_tag_failed(fw, FWTS_TAG_BIOS); fwts_log_info_verbatum(fw,"%s", line); - fwts_advice(fw, "Generally this means that the EHCI driver was unable to take " - "control of the USB controller away from the BIOS. " - "Disabling USB legacy mode in the BIOS may help."); + fwts_advice(fw, + "Generally this means that the EHCI driver was unable " + "to take control of the USB controller away from the " + "BIOS. Disabling USB legacy mode in the BIOS may help."); } } @@ -184,12 +212,13 @@ } static int acpiinfo_test1(fwts_framework *fw) -{ +{ int errors = 0; - fwts_log_info(fw, "This test checks the output of the in-kernel ACPI CA against common " - "error messages that indicate a bad interaction with the bios, including " - "those that point at AML syntax errors."); + fwts_log_info(fw, + "This test checks the output of the in-kernel ACPI CA against " + "common error messages that indicate a bad interaction with " + "the bios, including those that point at AML syntax errors."); if (fwts_klog_scan(fw, klog, acpiinfo_check, NULL, NULL, &errors)) { fwts_log_error(fw, "failed to scan kernel log."); @@ -211,7 +240,7 @@ static fwts_framework_ops acpiinfo_ops = { .description = "General ACPI information check.", - .init = acpiinfo_init, + .init = acpiinfo_init, .deinit = acpiinfo_deinit, .minor_tests = acpiinfo_tests }; diff -Naur fwts-0.23.13/src/acpi/acpitables/acpitables.c fwts-0.23.23/src/acpi/acpitables/acpitables.c --- fwts-0.23.13/src/acpi/acpitables/acpitables.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/acpitables/acpitables.c 2011-08-31 16:09:22.000000000 +0000 @@ -32,35 +32,19 @@ (ecdt->ec_control.address_space_id != 1)) fwts_failed(fw, LOG_LEVEL_MEDIUM, "ECDTECCtrlAddrSpaceID", "ECDT EC_CONTROL address space id = %hhu, " "should be 0 or 1 (System I/O Space or System Memory Space)", - ecdt->ec_control.address_space_id); + ecdt->ec_control.address_space_id); + fwts_advice(fw, "The ECDT EC_CONTROL address space id was invalid, however the kernel ACPI EC driver " + "will just assume it an I/O port address. This will not affect " + "the system behaviour and can probably be ignored."); if ((ecdt->ec_data.address_space_id != 0) && (ecdt->ec_data.address_space_id != 1)) fwts_failed(fw, LOG_LEVEL_MEDIUM, "ECDTECDataAddrSpaceID", "ECDT EC_CONTROL address space id = %hhu, " "should be 0 or 1 (System I/O Space or System Memory Space)", - ecdt->ec_data.address_space_id); -} - -static void acpi_table_check_facs(fwts_framework *fw, fwts_acpi_table_info *table) -{ - fwts_acpi_table_facs *facs = (fwts_acpi_table_facs*)table->data; - - if (table->length < 24) { - if ((facs->flags & 2) == 0) { - if (facs->firmware_waking_vector == 0) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "FACS32BitExec", "FACS: flags indicate 32 bit execution environment " - "but the 32 bit Firmware Waking Vector is set to zero."); - } else { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "FACS64BitExec", "FACS: flags indicate a 64 bit execution environment " - "but the FACS table is not long enough to support 64 bit " - "X Firmware Waking Vector."); - } - } - else { - if ((facs->flags & 2) && (facs->x_firmware_waking_vector == 0)) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "FACT64BitExecWakingVectorZero", "FACS: Flags indicate a 64 bit execution environment " - "but the 64 bit X Firmware Waking Vector is set to zero."); - } + ecdt->ec_data.address_space_id); + fwts_advice(fw, "The ECDT EC_DATA address space id was invalid, however the kernel ACPI EC driver " + "will just assume it an I/O port address. This will not affect " + "the system behaviour and can probably be ignored."); } static void acpi_table_check_hpet(fwts_framework *fw, fwts_acpi_table_info *table) @@ -69,9 +53,15 @@ if (hpet->base_address.address == 0) fwts_failed(fw, LOG_LEVEL_MEDIUM, "HPETBaseZero", "HPET base is 0x000000000000, which is invalid."); - - if (((hpet->event_timer_block_id >> 16) & 0xffff) == 0) + + if (((hpet->event_timer_block_id >> 16) & 0xffff) == 0) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "HPETVendorIdZero", "HPET PCI Vendor ID is 0x0000, which is invalid."); + fwts_advice(fw, "The HPET specification (http://www.intel.com/hardwaredesign/hpetspec_1.pdf) describes " + "the HPET table in section 3.2.4 'The ACPI 2.0 HPET Description Table (HPET)'. The top " + "16 bits of the Event Timer Block ID specify the Vendor ID and this should not be zero. " + "This won't affect the kernel behaviour, but should be fixed as it is an undefined ID value."); + } + } static void acpi_table_check_fadt(fwts_framework *fw, fwts_acpi_table_info *table) @@ -81,19 +71,35 @@ if (fadt->firmware_control == 0) { if (table->length >= 140) { if (fadt->x_firmware_ctrl == 0) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTFACSZero", "FADT 32 bit FIRMWARE_CONTROL and 64 bit X_FIRMWARE_CONTROL (FACS address) are null."); + fwts_failed(fw, LOG_LEVEL_CRITICAL, "FADTFACSZero", "FADT 32 bit FIRMWARE_CONTROL and 64 bit X_FIRMWARE_CONTROL (FACS address) are null."); + fwts_advice(fw, "The 32 bit FIRMWARE_CTRL or 64 bit X_FIRMWARE_CTRL should point to a valid " + "Firmware ACPI Control Structure (FACS). This is a firmware bug and needs to be fixed."); } - } else + } else { fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADT32BitFACSNull", "FADT 32 bit FIRMWARE_CONTROL is null."); + fwts_advice(fw, "The ACPI version 1.0 FADT has a NULL FIRMWARE_CTRL and it needs to be defined " + "to point to a valid Firmware ACPI Control Structure (FACS). This is a firmware " + "bug and needs to be fixed."); + } } else { if (table->length >= 140) { if (fadt->x_firmware_ctrl != 0) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADT32And64BothDefined", "FADT 32 bit FIRMWARE_CONTROL is non-zero, and X_FIRMWARE_CONTROL is also non-zero. " "Section 5.2.9 of the ACPI specification states that if the FIRMWARE_CONTROL is non-zero " "then X_FIRMWARE_CONTROL must be set to zero."); + fwts_advice(fw, "The FADT FIRMWARE_CTRL is a 32 bit pointer that points to the physical memory address " + "of the Firmware ACPI Control Structure (FACS). There is also an extended 64 bit version " + "of this, the X_FIRMWARE_CTRL pointer that also can point to the FACS. Section 5.2.9 of " + "the ACPI specification states that if the X_FIRMWARE_CTRL field contains a non zero value " + "then the FIRMWARE_CTRL field *must* be zero. This error is also detected by the Linux kernel. " + "If FIRMWARE_CTRL and X_FIRMWARE_CTRL are defined, then the kernel just uses the 64 bit version of " + "the pointer."); if (((uint64_t)fadt->firmware_control != fadt->x_firmware_ctrl)) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "FwCtrl32and64Differ", "FIRMWARE_CONTROL is 0x%x and differs from X_FIRMWARE_CONTROL 0x%llx", (unsigned int)fadt->firmware_control, (unsigned long long int)fadt->x_firmware_ctrl); + fwts_advice(fw, "One would expect the 32 bit FIRMWARE_CTRL and 64 bit X_FIRMWARE_CTRL " + "pointers to point to the same FACS, however they don't which is clearly ambiguous and wrong. " + "The kernel works around this by using the 64 bit X_FIRMWARE_CTRL pointer to the FACS. "); } } } @@ -102,14 +108,18 @@ if (fadt->dsdt == 0) fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTDSTNull", "FADT DSDT address is null."); if (table->length >= 148) { - if (fadt->x_dsdt == 0) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTXDSTKNull", "FADT X_DSDT address is null."); - else if ((uint64_t)fadt->dsdt != fadt->x_dsdt) + if (fadt->x_dsdt == 0) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTXDSTDNull", "FADT X_DSDT address is null."); + fwts_advice(fw, "An ACPI 2.0 FADT is being used however the 64 bit X_DSDT is null." + "The kernel will fall back to using the 32 bit DSDT pointer instead."); + } else if ((uint64_t)fadt->dsdt != fadt->x_dsdt) fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADT32And64Mismatch", "FADT 32 bit DSDT (0x%x) does not point to same physical address as 64 bit X_DSDT (0x%llx).", (unsigned int)fadt->dsdt, (unsigned long long int)fadt->x_dsdt); + fwts_advice(fw, "One would expect the 32 bit DSDT and 64 bit X_DSDT " + "pointers to point to the same DSDT, however they don't which is clearly ambiguous and wrong. " + "The kernel works around this by using the 64 bit X_DSDT pointer to the DSDT. "); } - if (fadt->sci_int == 0) fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTSCIIRQZero", "FADT SCI Interrupt is 0x00, should be defined."); if (fadt->smi_cmd == 0) { @@ -119,23 +129,59 @@ (fadt->pstate_cnt == 0) && (fadt->cst_cnt == 0)) fwts_warning(fw, "FADT SMI_CMD is 0x00, system appears to not support System Management mode."); - else + else { fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTSMICMDZero", "FADT SMI_CMD is 0x00, however, one or more of ACPI_ENABLE, ACPI_DISABLE, " "S4BIOS_REQ, PSTATE_CNT and CST_CNT are defined which means SMI_CMD should be " "defined otherwise SMI commands cannot be sent."); + fwts_advice(fw, "The configuration seems to suggest that SMI command should be defined to " + "allow the kernel to trigger system managment interrupts via the SMD_CMD port. " + "The fact that SMD_CMD is zero which is invalid means that SMIs are not possible " + "through the normal ACPI mechanisms. This means some firmware based machine " + "specific functions will not work."); + } } - - if (fadt->pm_tmr_len != 4) + + if (fadt->pm_tmr_len != 4) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTBadPMTMRLEN", "FADT PM_TMR_LEN is %hhu, should be 4.", fadt->pm_tmr_len); - if (fadt->gpe0_blk_len & 1) + fwts_advice(fw, "FADT field PM_TMR_LEN defines the number of bytes decoded by PM_TMR_BLK. " + "This fields value must be 4. If it is not the correct size then the kernel " + "will not request a region for the pm timer block. "); + } + if (fadt->gpe0_blk_len & 1) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTBadGPEBLKLEN", "FADT GPE0_BLK_LEN is %hhu, should a multiple of 2.", (int)fadt->gpe0_blk_len); - if (fadt->gpe1_blk_len & 1) + fwts_advice(fw, "The FADT GPE_BLK_LEN should be a multiple of 2. Because it isn't, the ACPI driver will " + "not map in the GPE0 region. This could mean that General Purpose Events will not " + "function correctly (for example lid or ac-power events)."); + } + if (fadt->gpe1_blk_len & 1) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTBadGPE1BLKLEN", "FADT GPE1_BLK_LEN is %hhu, should a multiple of 2.", fadt->gpe1_blk_len); - if (fadt->p_lvl2_lat > 100) + fwts_advice(fw, "The FADT GPE_BLK_LEN should be a multiple of 2. Because it isn't, the ACPI driver will " + "not map in the GPE1 region. This could mean that General Purpose Events will not " + "function correctly (for example lid or ac-power events)."); + } + /* + * Bug LP: /833644 + * + * Remove these tests, really need to put more intelligence into it + * perhaps in the cstates test rather than here. For the moment we + * shall remove this warning as it's giving users false alarms + * See: https://bugs.launchpad.net/ubuntu/+source/fwts/+bug/833644 + */ + /* + if (fadt->p_lvl2_lat > 100) { fwts_warning(fw, "FADT P_LVL2_LAT is %hu, a value > 100 indicates a system not to support a C2 state.", fadt->p_lvl2_lat); - if (fadt->p_lvl3_lat > 1000) + fwts_advice(fw, "The FADT P_LVL2_LAT setting specifies the C2 latency in microseconds. The ACPI specification " + "states that a value > 100 indicates that C2 is not supported and hence the " + "ACPI processor idle routine will not use C2 power states."); + } + if (fadt->p_lvl3_lat > 1000) { fwts_warning(fw, "FADT P_LVL3_LAT is %hu, a value > 1000 indicates a system not to support a C3 state.", fadt->p_lvl3_lat); + fwts_advice(fw, "The FADT P_LVL2_LAT setting specifies the C3 latency in microseconds. The ACPI specification " + "states that a value > 1000 indicates that C3 is not supported and hence the " + "ACPI processor idle routine will not use C3 power states."); + } + */ /* if (fadt->day_alrm == 0) fwts_warning(fw, "FADT DAY_ALRM is zero, OS will not be able to program day of month alarm."); @@ -152,7 +198,8 @@ fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTBadRESETREG", "FADT RESET_REG was %hhu, must be System I/O space, System Memory space " "or PCI configuration spaces.", fadt->reset_reg.address_space_id); - + fwts_advice(fw, "If the FADT RESET_REG address space ID is not set correctly then ACPI writes " + "to this register *may* nor work correctly, meaning a reboot via this mechanism may not work."); if ((fadt->reset_value == 0) && (fadt->reset_reg.address != 0)) fwts_warning(fw, "FADT RESET_VALUE is zero, which may be incorrect, it is usually non-zero."); } @@ -168,11 +215,16 @@ if (isalnum(rsdp->oem_id[i])) passed++; } - if (!passed) + if (!passed) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "RSDPBadOEMId", "RSDP: oem_id does not contain any alpha numeric characters."); + fwts_advice(fw, "The RSDP OEM Id is non-conforming, but this will not affect the system behaviour. However " + "this should be fixed if possible to make the firmware ACPI complaint."); + } - if (rsdp->revision > 2) + if (rsdp->revision > 2) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "RSDPBadRevisionId", "RSDP: revision is %hhu, expected value less than 2.", rsdp->revision); + fwts_advice(fw, "A RSDP revision number greater than 2 probably won't cause any system problems."); + } } static void acpi_table_check_rsdt(fwts_framework *fw, fwts_acpi_table_info *table) @@ -183,25 +235,35 @@ n = (table->length - sizeof(fwts_acpi_table_header)) / sizeof(uint32_t); for (i=0; ientries[i] == 0) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "RSDTEntryNull", "RSDT Entry %d is null, should not be non-zero.", i); + if (rsdt->entries[i] == 0) { + fwts_failed(fw, LOG_LEVEL_HIGH, "RSDTEntryNull", "RSDT Entry %d is null, should not be non-zero.", i); + fwts_advice(fw, "A RSDT pointer is null and therefore erroneously points to an invalid 32 bit " + "ACPI table header. At worse this will cause the kernel to oops, at best the kernel " + "may ignore this. However, it should be fixed where possible."); + } } } static void acpi_table_check_sbst(fwts_framework *fw, fwts_acpi_table_info *table) { fwts_acpi_table_sbst *sbst = (fwts_acpi_table_sbst*)table->data; - - if (sbst->critical_energy_level > sbst->low_energy_level) + + if (sbst->critical_energy_level > sbst->low_energy_level) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "SBSTEnergyLevel1", "SBST Critical Energy Level (%u) is greater than the Low Energy Level (%u).", sbst->critical_energy_level, sbst->low_energy_level); + fwts_advice(fw, "This could affect system behaviour based on incorrect smart battery information. This should be fixed."); + } - if (sbst->low_energy_level > sbst->warning_energy_level) + if (sbst->low_energy_level > sbst->warning_energy_level) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "SBSTEnergeyLevel2", "SBST Low Energy Energy Level (%u) is greater than the Warning Energy Level (%u).", sbst->low_energy_level, sbst->warning_energy_level); + fwts_advice(fw, "This could affect system behaviour based on incorrect smart battery information. This should be fixed."); + } - if (sbst->warning_energy_level == 0) + if (sbst->warning_energy_level == 0) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "SBSTEnergyLevelZero", "SBST Warning Energy Level is zero, which is probably too low."); + fwts_advice(fw, "This could affect system behaviour based on incorrect smart battery information. This should be fixed."); + } } static void acpi_table_check_xsdt(fwts_framework *fw, fwts_acpi_table_info *table) @@ -212,8 +274,12 @@ n = (table->length - sizeof(fwts_acpi_table_header)) / sizeof(uint64_t); for (i=0; ientries[i] == 0) + if (xsdt->entries[i] == 0) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "XSDTEntryNull", "XSDT Entry %d is null, should not be non-zero.", i); + fwts_advice(fw, "A XSDT pointer is null and therefore erroneously points to an invalid 64 bit " + "ACPI table header. At worse this will cause the kernel to oops, at best the kernel " + "may ignore this. However, it should be fixed where possible."); + } } } @@ -223,14 +289,14 @@ const void *data = table->data; int length = table->length; int i = 0; - + if (madt->flags & 0xfffffffe) fwts_failed(fw, LOG_LEVEL_MEDIUM, "MADTFlagsNonZero", "MADT flags field, bits 1..31 are reserved and should be zero, but are set as: %lx.\n", (unsigned long int)madt->flags); - data += sizeof(fwts_acpi_table_madt); + data += sizeof(fwts_acpi_table_madt); length -= sizeof(fwts_acpi_table_madt); - + while (length > (int)sizeof(fwts_acpi_madt_sub_table_header)) { int skip = 0; i++; @@ -238,7 +304,7 @@ data += sizeof(fwts_acpi_madt_sub_table_header); length -= sizeof(fwts_acpi_madt_sub_table_header); - + switch (hdr->type) { case 0: { fwts_acpi_madt_processor_local_apic *lapic = (fwts_acpi_madt_processor_local_apic *)data; @@ -337,6 +403,7 @@ static void acpi_table_check_mcfg(fwts_framework *fw, fwts_acpi_table_info *table) { + /* FIXME */ /*fwts_acpi_table_mcfg *mcfg = (fwts_acpi_table_mcfg*)table->data;*/ } @@ -351,7 +418,6 @@ { "APIC", acpi_table_check_madt }, { "ECDT", acpi_table_check_ecdt }, { "FACP", acpi_table_check_fadt }, - { "FACS", acpi_table_check_facs }, { "HPET", acpi_table_check_hpet }, { "MCFG", acpi_table_check_mcfg }, { "RSDT", acpi_table_check_rsdt }, diff -Naur fwts-0.23.13/src/acpi/apicinstance/apicinstance.c fwts-0.23.23/src/acpi/apicinstance/apicinstance.c --- fwts-0.23.13/src/acpi/apicinstance/apicinstance.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/apicinstance/apicinstance.c 2011-08-31 16:09:22.000000000 +0000 @@ -35,10 +35,12 @@ if (table == NULL) break; - + if (strcmp(table->name, "APIC") == 0) { fwts_log_info(fw, "Found APIC/MADT table %s @ %llx, length 0x%d\n", - table->name, (unsigned long long)table->addr, (int)table->length); + table->name, + (unsigned long long)table->addr, + (int)table->length); if (count == 0) first_madt_table = table; else { @@ -54,10 +56,14 @@ if (count > 1) { char buffer[32]; - fwts_failed(fw, LOG_LEVEL_HIGH, "MultipleAPICMADT", "Found %d APIC/MADT tables, the kernel expects just one.", count); + fwts_failed(fw, LOG_LEVEL_HIGH, "MultipleAPICMADT", + "Found %d APIC/MADT tables, the kernel expects just one.", + count); fwts_tag_failed(fw, FWTS_TAG_ACPI_INVALID_TABLE); snprintf(buffer, sizeof(buffer), " (or up to %d)", count); - fwts_log_advice(fw, "If you find any APIC issues, perhaps try using acpi_apic_instance=2%s.", + fwts_log_advice(fw, + "If you find any APIC issues, perhaps try using " + "acpi_apic_instance=2%s.", count > 2 ? buffer : ""); } else fwts_passed(fw, "Found %d APIC/MADT table(s), as expected.", count); diff -Naur fwts-0.23.13/src/acpi/battery/battery.c fwts-0.23.23/src/acpi/battery/battery.c --- fwts-0.23.13/src/acpi/battery/battery.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/battery/battery.c 2011-08-31 16:09:22.000000000 +0000 @@ -54,14 +54,15 @@ if (!dir) return 0; - + snprintf(path, sizeof(path), "%s/state", dir); if ((file = fopen(path, "r")) == NULL) return 0; - + while (fgets(buffer, 4095, file) != NULL) { - if (strstr(buffer,"remaining capacity:") && strlen(buffer)>25) { - value = strtoull(buffer+25, NULL, 10); + if (strstr(buffer,"remaining capacity:") && + strlen(buffer)>25) { + value = strtoull(buffer+25, NULL, 10); break; } } @@ -118,13 +119,16 @@ fwts_gpe_free(gpes_end, gpe_count); if (events == 0) - fwts_failed(fw, LOG_LEVEL_HIGH, "BatteryNoEvents", "Did not detect any ACPI battery events."); + fwts_failed(fw, LOG_LEVEL_HIGH, "BatteryNoEvents", + "Did not detect any ACPI battery events."); else fwts_passed(fw, "Detected ACPI battery events."); if (matching == 0) - fwts_failed(fw, LOG_LEVEL_HIGH, "BatteryNoEvents", "Could not detect ACPI events for battery %s.", name); + fwts_failed(fw, LOG_LEVEL_HIGH, "BatteryNoEvents", + "Could not detect ACPI events for battery %s.", name); else - fwts_passed(fw, "Detected ACPI event for battery %s.", name); + fwts_passed(fw, "Detected ACPI event for battery %s.", + name); return FWTS_OK; } @@ -145,11 +149,12 @@ if (new_value>initial_value) { fwts_passed(fw, "Battery %s charge is incrementing as expected.", name); return; - } + } fwts_printf(fw, "Waiting %3.3d/120\r", 120-i); sleep(1); } - fwts_failed(fw, LOG_LEVEL_MEDIUM, "BatteryNotCharging", "Battery %s claims it's charging but no charge is added", name); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "BatteryNotCharging", + "Battery %s claims it's charging but no charge is added", name); } static void check_discharging(fwts_framework *fw, char *dir, char *name) @@ -171,12 +176,14 @@ fwts_passed(fw, "Battery %s charge is decrementing as expected.", name); fwts_cpu_consume_complete(); return; - } + } fwts_printf(fw, "Waiting %3.3d/120\r", 120-i); sleep(1); } fwts_cpu_consume_complete(); - fwts_failed(fw, LOG_LEVEL_MEDIUM, "BatteryNotDischarging", "Battery %s claims it is discharging but no charge is used.", name); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "BatteryNotDischarging", + "Battery %s claims it is discharging but no charge is used.", + name); } @@ -196,7 +203,8 @@ snprintf(path, sizeof(path), "%s/state", dir); if ((file = fopen(path, "r")) == NULL) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "BatteryNoState", "Battery present but undersupported - no state present."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "BatteryNoState", + "Battery present but undersupported - no state present."); return; } @@ -270,7 +278,8 @@ if (entry && strlen(entry->d_name)>2) { char batpath[2048]; - snprintf(batpath, sizeof(batpath), "/proc/acpi/battery/%s", entry->d_name); + snprintf(batpath, sizeof(batpath), + "/proc/acpi/battery/%s", entry->d_name); do_battery_test(fw, batpath, entry->d_name); battdir++; } diff -Naur fwts-0.23.13/src/acpi/brightness/brightness.c fwts-0.23.23/src/acpi/brightness/brightness.c --- fwts-0.23.13/src/acpi/brightness/brightness.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/brightness/brightness.c 2011-08-31 16:09:22.000000000 +0000 @@ -53,7 +53,7 @@ return FWTS_OK; } -int get_setting(char *entry_name, char *setting, int *value) +static int get_setting(char *entry_name, char *setting, int *value) { char path[PATH_MAX]; FILE *fp; @@ -72,7 +72,7 @@ return FWTS_OK; } -int set_setting(char *entry_name, char *setting, int value) +static int set_setting(char *entry_name, char *setting, int value) { char path[PATH_MAX]; FILE *fp; diff -Naur fwts-0.23.13/src/acpi/checksum/checksum.c fwts-0.23.23/src/acpi/checksum/checksum.c --- fwts-0.23.13/src/acpi/checksum/checksum.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/checksum/checksum.c 2011-08-31 16:09:22.000000000 +0000 @@ -22,17 +22,63 @@ #include #include #include +#include #include "fwts.h" +static void checksum_rsdp(fwts_framework *fw, fwts_acpi_table_info *table) +{ + uint8_t checksum; + fwts_acpi_table_rsdp *rsdp = (fwts_acpi_table_rsdp*)table->data; + + if (table->length < 20) { + fwts_failed(fw, LOG_LEVEL_HIGH, "ACPITableCheckSumShortRSDP", + "RSDP was expected to be at least 20 bytes long, got a shorted size of %d bytes.", + (int)table->length); + /* Won't test on a short RSDP */ + return; + } + + /* Version 1.0 RSDP checksum, always applies */ + checksum = fwts_acpi_checksum(table->data, 20); + if (checksum != 0) + fwts_failed(fw, LOG_LEVEL_HIGH, "ACPITableChecksumRSDP", + "RSDP has incorrect checksum, expected 0x%x, got 0x%x.", + 256-checksum, rsdp->checksum); + else + fwts_passed(fw, "Table RSDP has correct checksum 0x%x.", rsdp->checksum); + + /* Version 2.0 RSP or more. Note ACPI 1.0 is indicated by a zero version number */ + if (rsdp->revision > 0) { + if (table->length < sizeof(fwts_acpi_table_rsdp)) { + fwts_failed(fw, LOG_LEVEL_HIGH, + "ACPITableCheckSumShortRSDP", + "RSDP was expected to be %d bytes long, got a shorted size of %d bytes.", + (int)sizeof(fwts_acpi_table_rsdp), (int)table->length); + /* Won't test on a short RSDP */ + return; + } + checksum = fwts_acpi_checksum(table->data, sizeof(fwts_acpi_table_rsdp)); + if (checksum != 0) + fwts_failed(fw, LOG_LEVEL_HIGH, + "ACPITableChecksumRSDP", + "RSDP has incorrect extended checksum, expected 0x%x, got 0x%x.", rsdp->extended_checksum, checksum); + else + fwts_passed(fw, "Table RSDP has correct extended checksum 0x%x.", rsdp->extended_checksum); + + } + +} + static int checksum_scan_tables(fwts_framework *fw) { int i; for (i=0;; i++) { fwts_acpi_table_info *table; - int j; - + fwts_acpi_table_header *hdr; + uint8_t checksum; + if (fwts_acpi_get_table(fw, i, &table) != FWTS_OK) { fwts_aborted(fw, "Cannot load ACPI tables."); return FWTS_ABORTED; @@ -40,22 +86,23 @@ if (table == NULL) break; - if (strcmp("RSDP", table->name) == 0) + hdr = (fwts_acpi_table_header*)table->data; + + if (strcmp("RSDP", table->name) == 0) { + checksum_rsdp(fw, table); continue; + } + if (strcmp("FACS", table->name) == 0) continue; - fwts_acpi_table_header *hdr = (fwts_acpi_table_header*)table->data; - uint8_t *data = (uint8_t*) table->data; - uint8_t checksum = 0; - - for (j=0; jlength; j++) - checksum += data[j]; - + checksum = fwts_acpi_checksum(table->data, table->length); if (checksum == 0) fwts_passed(fw, "Table %s has correct checksum 0x%x.", table->name, hdr->checksum); else { - fwts_failed(fw, LOG_LEVEL_LOW, "ACPITableChecksum", "Table %s has incorrect checksum, expected 0x%x, got 0x%x.", table->name, 256-checksum, hdr->checksum); + fwts_failed(fw, LOG_LEVEL_LOW, "ACPITableChecksum", + "Table %s has incorrect checksum, expected 0x%x, got 0x%x.", + table->name, 256-checksum, hdr->checksum); } fwts_tag_failed(fw, FWTS_TAG_ACPI_TABLE_CHECKSUM); } return FWTS_OK; diff -Naur fwts-0.23.13/src/acpi/common/common.c fwts-0.23.23/src/acpi/common/common.c --- fwts-0.23.13/src/acpi/common/common.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/acpi/common/common.c 2011-08-31 16:09:22.000000000 +0000 @@ -54,7 +54,7 @@ } static int dmesg_common_test1(fwts_framework *fw) -{ +{ int errors = 0; if (fwts_klog_common_check(fw, NULL, klog, &errors)) { @@ -78,7 +78,7 @@ static fwts_framework_ops dmesg_common_ops = { .description = "General dmesg common errors check.", - .init = dmesg_common_init, + .init = dmesg_common_init, .deinit = dmesg_common_deinit, .minor_tests = dmesg_common_tests }; diff -Naur fwts-0.23.13/src/acpi/cstates/cstates.c fwts-0.23.23/src/acpi/cstates/cstates.c --- fwts-0.23.13/src/acpi/cstates/cstates.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/cstates/cstates.c 2011-08-31 16:09:22.000000000 +0000 @@ -67,7 +67,7 @@ current = time(NULL); do { - double A, B; + double A, B; int i; A = 1.234567; B = 3.121213; @@ -114,22 +114,27 @@ int count; int len; - snprintf(filename, sizeof(filename), "%s/%s/name", path, entry->d_name); + snprintf(filename, sizeof(filename), "%s/%s/name", + path, entry->d_name); if ((data = fwts_get(filename)) == NULL) break; - /* Names can be Cx\n, or ATM-Cx\n, or SNB-Cx\n, where x is the C state number */ + /* + * Names can be Cx\n, or ATM-Cx\n, or SNB-Cx\n, + * where x is the C state number + */ len = strlen(data); if ((len > 2) && (data[len-3] == 'C')) nr = strtoull(data+len-2, NULL, 10); free(data); - snprintf(filename, sizeof(filename), "%s/%s/usage", path, entry->d_name); + snprintf(filename, sizeof(filename), "%s/%s/usage", + path, entry->d_name); if ((data = fwts_get(filename)) == NULL) break; count = strtoull(data, NULL, 10); free(data); - + if ((nr>=0) && (nr < MAX_CSTATE)) state->counts[nr] = count; @@ -154,10 +159,11 @@ for (i=0; (i < TOTAL_WAIT_TIME) && keepgoing; i++) { int j; - + snprintf(buffer, sizeof(buffer),"(CPU %d of %d)", nth+1, cpus); fwts_progress_message(fw, - 100 * (i+ (TOTAL_WAIT_TIME*nth))/(cpus * TOTAL_WAIT_TIME), buffer); + 100 * (i+ (TOTAL_WAIT_TIME*nth))/ + (cpus * TOTAL_WAIT_TIME), buffer); if ((i & 7) < 4) sleep(1); @@ -196,7 +202,8 @@ strcat(buffer, tmp); } } - fwts_passed(fw, "Processor %i has reached all C-states: %s", cpu, buffer); + fwts_passed(fw, "Processor %i has reached all C-states: %s", + cpu, buffer); } count = 0; @@ -206,9 +213,11 @@ if (statecount == -1) statecount = count; - + if (statecount != count) - fwts_failed(fw, LOG_LEVEL_HIGH, "CPUNoCState", "Processor %i is expected to have %i C-states but has %i.", cpu, statecount, count); + fwts_failed(fw, LOG_LEVEL_HIGH, "CPUNoCState", + "Processor %i is expected to have %i C-states but has %i.", + cpu, statecount, count); else if (firstcpu == -1) firstcpu = cpu; @@ -223,11 +232,14 @@ int cpus; int i; - fwts_log_info(fw, "This test checks if all processors have the same number of C-states, " - "if the C-state counter works and if C-state transitions happen."); + fwts_log_info(fw, + "This test checks if all processors have the same number of " + "C-states, if the C-state counter works and if C-state " + "transitions happen."); if ((dir = opendir(PROCESSOR_PATH)) == NULL) { - fwts_failed(fw, LOG_LEVEL_HIGH, "CPUNoSysMounted", "Cannot open %s: /sys not mounted?", PROCESSOR_PATH); + fwts_failed(fw, LOG_LEVEL_HIGH, "CPUNoSysMounted", + "Cannot open %s: /sys not mounted?", PROCESSOR_PATH); return FWTS_ERROR; } @@ -243,12 +255,13 @@ for (i=0;(entry = readdir(dir)) != NULL;) { if (entry && - (strlen(entry->d_name)>3) && + (strlen(entry->d_name)>3) && (strncmp(entry->d_name, "cpu", 3) == 0) && (isdigit(entry->d_name[3]))) { char cpupath[PATH_MAX]; - snprintf(cpupath, sizeof(cpupath), "%s/%s/cpuidle", PROCESSOR_PATH, entry->d_name); + snprintf(cpupath, sizeof(cpupath), "%s/%s/cpuidle", + PROCESSOR_PATH, entry->d_name); do_cpu(fw, i++, cpus, strtoul(entry->d_name+3, NULL, 10), cpupath); } } @@ -268,6 +281,6 @@ .minor_tests = cstates_tests }; -FWTS_REGISTER(cstates, &cstates_ops, FWTS_TEST_ANYTIME, FWTS_BATCH_EXPERIMENTAL); +FWTS_REGISTER(cstates, &cstates_ops, FWTS_TEST_ANYTIME, FWTS_BATCH); #endif diff -Naur fwts-0.23.13/src/acpi/dmar/dmar.c fwts-0.23.23/src/acpi/dmar/dmar.c --- fwts-0.23.13/src/acpi/dmar/dmar.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/dmar/dmar.c 2011-08-31 16:09:22.000000000 +0000 @@ -108,7 +108,9 @@ char configs[64]; size_t count; - snprintf(path, sizeof(path), "/sys/bus/pci/devices/%04x:%02x:%02x.%d/config", seg, bus, dev, fn); + snprintf(path, sizeof(path), + "/sys/bus/pci/devices/%04x:%02x:%02x.%d/config", + seg, bus, dev, fn); if ((file = fopen(path, "r")) == NULL) return -1; @@ -125,7 +127,8 @@ return 1; } -static int acpi_parse_one_dev_scope(fwts_framework *fw, struct acpi_dev_scope *scope, int seg) +static int acpi_parse_one_dev_scope(fwts_framework *fw, + struct acpi_dev_scope *scope, int seg) { struct acpi_pci_path *path; int count; @@ -134,7 +137,8 @@ int dev_type; if (scope->length < MIN_SCOPE_LEN) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "InvalidDevScope", "Invalid device scope entry."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "InvalidDevScope", + "Invalid device scope entry."); return FWTS_ERROR; } @@ -170,7 +174,8 @@ if ((scope->dev_type == ACPI_DEV_ENDPOINT && dev_type > 0) || (scope->dev_type == ACPI_DEV_P2PBRIDGE && dev_type == 0)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "DevScopeTypeNoMatch", "Device scope type not match."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "DevScopeTypeNoMatch", + "Device scope type not match."); return FWTS_ERROR; } return FWTS_OK; @@ -179,7 +184,8 @@ return FWTS_ERROR; } -static int acpi_parse_dev_scope(fwts_framework *fw, void *start, void *end, int seg) +static int acpi_parse_dev_scope(fwts_framework *fw, + void *start, void *end, int seg) { struct acpi_dev_scope *scope; int ret; @@ -194,18 +200,21 @@ return FWTS_OK; } -static int acpi_parse_one_drhd(fwts_framework *fw, struct acpi_dmar_entry_header *header) +static int acpi_parse_one_drhd(fwts_framework *fw, + struct acpi_dmar_entry_header *header) { static int include_all; struct acpi_table_drhd *drhd = (struct acpi_table_drhd*)header; if (drhd->address & MASK_4K) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "InvalidDRHDRegAddr", "Invalid drhd register address."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "InvalidDRHDRegAddr", + "Invalid drhd register address."); return FWTS_ERROR; } if (drhd->flags & 1) { if (include_all == 1) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MultipleDRHDSFlag", "Multiple drhds have include_all flag set."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "MultipleDRHDSFlag", + "Multiple drhds have include_all flag set."); return FWTS_ERROR; } include_all = 1; @@ -216,14 +225,16 @@ return FWTS_OK; } -static int acpi_parse_one_rmrr(fwts_framework *fw, struct acpi_dmar_entry_header *header) +static int acpi_parse_one_rmrr(fwts_framework *fw, + struct acpi_dmar_entry_header *header) { struct acpi_table_rmrr *rmrr = (struct acpi_table_rmrr *)header; if ((rmrr->base_address & MASK_4K) || (rmrr->end_address < rmrr->base_address) || ((rmrr->end_address - rmrr->base_address + 1) & MASK_4K)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "InvalidRMRRRangeAddr", "Invalid rmrr range address."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "InvalidRMRRRangeAddr", + "Invalid rmrr range address."); return FWTS_ERROR; } return acpi_parse_dev_scope(fw, (void *)(rmrr + 1), @@ -237,7 +248,6 @@ fwts_acpi_table_info *table; int failed = 0; - if (fwts_acpi_find_table(fw, "DMAR", 0, &table) != FWTS_OK) { fwts_log_error(fw, "Cannot load ACPI table."); return FWTS_ERROR; @@ -249,13 +259,14 @@ table_ptr = (uint8_t*)table->data; if (table->length <= DMAR_HEADER_SIZE) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "InvalidDMAR", "Invalid DMAR ACPI table."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "InvalidDMAR", + "Invalid DMAR ACPI table."); fwts_tag_failed(fw, FWTS_TAG_ACPI_INVALID_TABLE); return FWTS_ERROR; } header = (struct acpi_dmar_entry_header *)(table_ptr+DMAR_HEADER_SIZE); - while ((unsigned long)header < (unsigned long)(table_ptr + table->length)) { + while ((unsigned long)header < (unsigned long)(table_ptr + table->length)) { if ((header->type == ACPI_DMAR_DRHD) && (acpi_parse_one_drhd(fw, header) != FWTS_OK)) { failed++; @@ -275,10 +286,12 @@ return FWTS_OK; } -static void acpiinfo_check(fwts_framework *fw, char *line, int repeated, char *prevline, void *private, int *errors) +static void acpiinfo_check(fwts_framework *fw, + char *line, int repeated, char *prevline, void *private, int *errors) { if (strstr(line, "DMAR:[fault reason")) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "DMARError", "Found DMAR error: %s", line); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "DMARError", + "Found DMAR error: %s", line); } static int dmar_test1(fwts_framework *fw) diff -Naur fwts-0.23.13/src/acpi/fadt/fadt.c fwts-0.23.23/src/acpi/fadt/fadt.c --- fwts-0.23.13/src/acpi/fadt/fadt.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/fadt/fadt.c 2011-08-31 16:09:22.000000000 +0000 @@ -64,7 +64,7 @@ fwts_log_info(fw, "FADT Preferred PM Profile: %hhu (%s)\n", fadt->preferred_pm_profile, FWTS_ACPI_FADT_PREFERRED_PM_PROFILE(fadt->preferred_pm_profile)); - + port = fadt->pm1a_cnt_blk; width = fadt->pm1_cnt_len * 8; /* In bits */ @@ -73,19 +73,21 @@ /* Sanity check sizes with extended address variants */ fwts_log_info(fw, "FADT is greater than ACPI version 1.0"); if ((uint64_t)port != fadt->x_pm1a_cnt_blk.address) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTPM1CNTAddrMismatch", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "FADTPM1CNTAddrMismatch", "32 and 64 bit versions of FADT pm1_cnt address do not match (0x%8.8x vs 0x%16.16llx).", port, (unsigned long long int)fadt->x_pm1a_cnt_blk.address); fwts_tag_failed(fw, FWTS_TAG_ACPI_BAD_ADDRESS); } if (width != fadt->x_pm1a_cnt_blk.register_bit_width) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTPM1CNTSizeMismatch", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "FADTPM1CNTSizeMismatch", "32 and 64 bit versions of FADT pm1_cnt size do not match (0x%x vs 0x%x).", width, fadt->x_pm1a_cnt_blk.register_bit_width); fwts_tag_failed(fw, FWTS_TAG_ACPI_BAD_ADDRESS); } - port = fadt->x_pm1a_cnt_blk.address; + port = fadt->x_pm1a_cnt_blk.address; width = fadt->x_pm1a_cnt_blk.register_bit_width; } @@ -105,7 +107,9 @@ break; default: ioperm(port, width/8, 0); - fwts_failed(fw, LOG_LEVEL_HIGH, "FADTPM1AInvalidWidth", "FADT pm1a register has invalid bit width of %d.", width); + fwts_failed(fw, LOG_LEVEL_HIGH, "FADTPM1AInvalidWidth", + "FADT pm1a register has invalid bit width of %d.", + width); fwts_tag_failed(fw, FWTS_TAG_ACPI_BAD_LENGTH); return FWTS_OK; } @@ -113,7 +117,8 @@ if (value & 0x01) fwts_passed(fw, "SCI_EN bit in PM1a Control Register Block is enabled."); else { - fwts_failed(fw, LOG_LEVEL_HIGH, "SCI_ENNotEnabled", "SCI_EN bit in PM1a Control Register Block is not enabled."); + fwts_failed(fw, LOG_LEVEL_HIGH, "SCI_ENNotEnabled", + "SCI_EN bit in PM1a Control Register Block is not enabled."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); } diff -Naur fwts-0.23.13/src/acpi/fan/fan.c fwts-0.23.23/src/acpi/fan/fan.c --- fwts-0.23.13/src/acpi/fan/fan.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/fan/fan.c 2011-08-31 16:09:22.000000000 +0000 @@ -32,80 +32,221 @@ #include #include -static void do_fan(fwts_framework *fw, char *dir, char *name) +#define COOLING_DEV "cooling_device" +#define THERMAL_PATH "/sys/class/thermal" + +typedef struct { + char *name; + char *type; + int max_state; + int cur_state; +} fan_info; + +static void free_fan_info(void *ptr) { - FILE *file; - char path[PATH_MAX]; - char buffer[4096]; - char *state = NULL; + fan_info *info = (fan_info*)ptr; - if (!dir) - return; + free(info->name); + free(info->type); + free(info); +} - snprintf(path, sizeof(path), "%s/state", dir); - if ((file = fopen(path, "r")) == NULL) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoFanState", "Fan present but is undersupported - no state present."); - return; - } +static fwts_list *get_fan_info(fwts_framework *fw) +{ + DIR *dir; + struct dirent *entry; + fwts_list *fans; - if (fgets(buffer, sizeof(buffer)-1, file) == NULL) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoFanState", "Fan present but is undersupported - no state present."); - fclose(file); - return; + if ((fans = fwts_list_new()) == NULL) { + fwts_log_error(fw, "Out of memory gathing fan information."); + return NULL; } - fclose(file); - if ((state = strstr(buffer, "status:")) == NULL) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoFanStateStatus", "Fan present but is undersupported - no state present."); - return; - } + if (!(dir = opendir(THERMAL_PATH))) + return fans; - for (state += 8; (*state == ' ') && (*state != '\n'); state++) - ; + do { + entry = readdir(dir); + if (entry && strstr(entry->d_name, COOLING_DEV)) { + char path[PATH_MAX]; + fan_info *info; + char *str; + + info = calloc(1, sizeof(fan_info)); + if (info == NULL) { + fwts_log_error(fw, "Out of memory gathing fan information."); + fwts_list_free(fans, free_fan_info); + return NULL; + } + + if ((info->name = strdup(entry->d_name)) == NULL) { + fwts_log_error(fw, "Out of memory gathing fan information."); + fwts_list_free(fans, free_fan_info); + return NULL; + } + + snprintf(path, sizeof(path), THERMAL_PATH "/%s/type", entry->d_name); + if ((str = fwts_get(path)) == NULL) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoFanType", + "Fan present but has no fan type present."); + } else { + fwts_chop_newline(str); + } + info->type = str; /* NULL is OK */ + + snprintf(path, sizeof(path), THERMAL_PATH "/%s/max_state", entry->d_name); + if ((str = fwts_get(path)) == NULL) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoFanMaxState", + "Fan present but has no max_state present."); + info->max_state = -1; + } else { + info->max_state = atoi(str); + free(str); + } + + snprintf(path, sizeof(path), THERMAL_PATH "/%s/cur_state", entry->d_name); + if ((str = fwts_get(path)) == NULL) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoFanCurState", + "Fan present but has no cur_state present."); + info->cur_state = -1; + } else { + info->cur_state = atoi(str); + free(str); + } - fwts_chop_newline(state); + fwts_list_append(fans, info); + } + } while (entry); - fwts_passed(fw, "Fan %s status is '%s'", name, state); + closedir(dir); + + return fans; } static int fan_test1(fwts_framework *fw) { - DIR *dir; - struct dirent *entry; - int fandir = 0; + fwts_list *fans; + fwts_list_link *item; fwts_log_info(fw, "Test how many fans there are in the system. " "Check for the current status of the fan(s)."); - if (!(dir = opendir("/proc/acpi/fan/"))) { - fwts_skipped(fw, "No fan information present: cannot test."); + if ((fans = get_fan_info(fw)) == NULL) + return FWTS_ERROR; + + if (fwts_list_len(fans) == 0) { + fwts_skipped(fw, "No thermal cooling information present: cannot test."); + fwts_list_free(fans, free_fan_info); return FWTS_SKIP; } - do { - entry = readdir(dir); - if (entry && strlen(entry->d_name)>2) { - char batpath[2048]; + fwts_list_foreach(item, fans) { + fan_info *info = fwts_list_data(fan_info *, item); + if (info->type == NULL) + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoFanType", + "Fan present but has no fan type present."); + if (info->max_state == -1) + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoFanMaxState", + "Fan present but has no max_state present."); + if (info->cur_state == -1) + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoFanCurState", + "Fan present but has no cur_state present."); + + if (info->type && + (info->max_state >= 0) && (info->cur_state >= 0)) + fwts_passed(fw, "Fan %s of type %s has max cooling state %d " + "and current cooling state %d.", + info->name, info->type, info->max_state, info->cur_state); + } - snprintf(batpath, sizeof(batpath), "/proc/acpi/fan/%s", entry->d_name); - do_fan(fw, batpath, entry->d_name); - fandir++; - } - } while (entry); + fwts_list_free(fans, free_fan_info); - closedir(dir); + return FWTS_OK; +} + +static int fan_test2(fwts_framework *fw) +{ + fwts_list *fans1, *fans2; + fwts_list_link *item1, *item2; + bool changed = false; - if (fandir == 0) { - fwts_skipped(fw, "No fan information present: cannot test."); + fwts_log_info(fw, + "Test how many fans there are in the system. " + "Check for the current status of the fan(s)."); + + if ((fans1 = get_fan_info(fw)) == NULL) + return FWTS_ERROR; + + if (fwts_list_len(fans1) == 0) { + fwts_skipped(fw, "No thermal cooling information present: cannot test."); + fwts_list_free(fans1, free_fan_info); return FWTS_SKIP; } + fwts_log_info(fw, "Loading CPUs for 20 seconds to try and get fan speeds to change."); + fwts_cpu_consume(20); + + if ((fans2 = get_fan_info(fw)) == NULL) { + fwts_list_free(fans1, free_fan_info); + return FWTS_ERROR; + } + + if (fwts_list_len(fans2) == 0) { + fwts_skipped(fw, "No thermal cooling information present: cannot test."); + fwts_list_free(fans1, free_fan_info); + fwts_list_free(fans2, free_fan_info); + return FWTS_SKIP; + } + + fwts_list_foreach(item1, fans1) { + fan_info *info1 = fwts_list_data(fan_info *, item1); + fwts_list_foreach(item2, fans2) { + fan_info *info2 = fwts_list_data(fan_info *, item2); + + if (strcmp(info1->type, "Processor") == 0) { + if (strcmp(info1->name, info2->name) == 0) { + if (info2->cur_state < info1->cur_state) { + fwts_failed(fw, LOG_LEVEL_HIGH, "FanCurStateDecreased", + "Fan %s current state decreased from %d to %d " + "while CPUs were busy, expected an increase.", + info1->name, info1->cur_state, info2->cur_state); + changed = true; + } + if (info2->cur_state > info2->cur_state) { + fwts_passed(fw, "Fan %s current state increased from %d to %d " + "while CPUs were busy.", + info1->name, info1->cur_state, info2->cur_state); + changed = true; + } + if (info2->cur_state == info2->cur_state) + fwts_log_info(fw, "Fan %s current state did not change from value %d " + "while CPUs were busy.", + info1->name, info1->cur_state); + } + } + } + } + + if (!changed) { + fwts_advice(fw, + "Did not detect any change in the CPU related thermal cooling device states. " + "It could be that the devices are returning static information back " + "to the driver and/or the fan speed is automatically being " + "controlled by firmware using System Management Mode in which case " + "the kernel interfaces being examined may not work anyway."); + + + } + + fwts_list_free(fans1, free_fan_info); + fwts_list_free(fans2, free_fan_info); return FWTS_OK; } static fwts_framework_minor_test fan_tests[] = { { fan_test1, "Check fan status." }, + { fan_test2, "Load system, check CPU fan status." }, { NULL, NULL} }; diff -Naur fwts-0.23.13/src/acpi/klog/klog.c fwts-0.23.23/src/acpi/klog/klog.c --- fwts-0.23.13/src/acpi/klog/klog.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/acpi/klog/klog.c 2011-08-31 16:09:22.000000000 +0000 @@ -34,7 +34,7 @@ klog = fwts_file_open_and_read(fw->klog); else klog = fwts_klog_read(); - + if (klog == NULL) { fwts_log_error(fw, "Cannot read kernel log."); return FWTS_ERROR; @@ -55,7 +55,7 @@ } static int klog_test1(fwts_framework *fw) -{ +{ int errors = 0; if (fwts_klog_firmware_check(fw, klog_progress, klog, &errors)) { @@ -63,9 +63,10 @@ return FWTS_ERROR; } - if (errors > 0) + if (errors > 0) /* Checks will log errors as failures automatically */ - fwts_log_info(fw, "Found %d unique errors in kernel log.", errors); + fwts_log_info(fw, "Found %d unique errors in kernel log.", + errors); else fwts_passed(fw, "Found no errors in kernel log."); @@ -79,7 +80,7 @@ static fwts_framework_ops klog_ops = { .description = "Scan kernel log for errors and warnings.", - .init = klog_init, + .init = klog_init, .deinit = klog_deinit, .minor_tests = klog_tests }; diff -Naur fwts-0.23.13/src/acpi/lid/lid.c fwts-0.23.23/src/acpi/lid/lid.c --- fwts-0.23.13/src/acpi/lid/lid.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/lid/lid.c 2011-08-31 16:09:22.000000000 +0000 @@ -29,14 +29,15 @@ #include #include -DIR *liddir; +static DIR *liddir; #define LID_PATH "/proc/acpi/button/lid" static int lid_init(fwts_framework *fw) { if (!(liddir = opendir(LID_PATH))) { - fwts_failed(fw, LOG_LEVEL_LOW, "NoLIDPath", "No %s directory available: cannot test.", LID_PATH); + fwts_failed(fw, LOG_LEVEL_LOW, "NoLIDPath", + "No %s directory available: cannot test.", LID_PATH); return FWTS_ERROR; } @@ -51,7 +52,8 @@ return FWTS_OK; } -void lid_check_field(char *field, char *contents, int *matching, int *not_matching) +static void lid_check_field(char *field, + char *contents, int *matching, int *not_matching) { struct dirent *entry; @@ -62,7 +64,8 @@ char path[PATH_MAX]; char *data; - snprintf(path, sizeof(path), LID_PATH "/%s/%s", entry->d_name, field); + snprintf(path, sizeof(path), LID_PATH "/%s/%s", + entry->d_name, field); if ((data = fwts_get(path)) != NULL) { if (strstr(data, contents)) (*matching)++; @@ -74,7 +77,8 @@ } while (entry); } -void lid_check_field_poll(char *field, char *contents, int *matching, int *not_matching) +static void lid_check_field_poll(char *field, + char *contents, int *matching, int *not_matching) { int i; @@ -100,7 +104,8 @@ lid_check_field_poll("info", "Lid Switch", &matching, ¬_matching); if ((matching == 0) || (not_matching > 0)) { - fwts_failed(fw, LOG_LEVEL_LOW, "NoLidSwitch", "Failed to detect a Lid Switch in LID info field."); + fwts_failed(fw, LOG_LEVEL_LOW, "NoLidSwitch", + "Failed to detect a Lid Switch in LID info field."); fwts_tag_failed(fw, FWTS_TAG_ACPI_LID); } else fwts_passed(fw, "Detected a Lid Switch in LID info field."); @@ -119,7 +124,8 @@ lid_check_field_poll("state", "open", &matching, ¬_matching); if ((matching == 0) || (not_matching > 0)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "Detected a closed LID state in %s.", LID_PATH); + fwts_failed(fw, LOG_LEVEL_HIGH, "LidNotOpen", + "Detected a closed LID state in %s.", LID_PATH); fwts_tag_failed(fw, FWTS_TAG_ACPI_LID); } else fwts_passed(fw, "Detected open LID state in %s.", LID_PATH); @@ -173,13 +179,15 @@ fwts_gpe_free(gpes_end, gpe_count); if (events == 0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "NoLidEvents", "Did not detect any ACPI LID events while waiting for to LID %s.", state); + fwts_failed(fw, LOG_LEVEL_HIGH, "NoLidEvents", + "Did not detect any ACPI LID events while waiting for to LID %s.", state); fwts_tag_failed(fw, FWTS_TAG_ACPI_LID); fwts_tag_failed(fw, FWTS_TAG_ACPI_EVENT); } else fwts_passed(fw, "Detected ACPI LID events while waiting for LID to %s.", state); if ((matching == 0) || (not_matching > 0)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "NoLidState", "Could not detect lid %s state in %s.", state, LID_PATH); + fwts_failed(fw, LOG_LEVEL_HIGH, "NoLidState", + "Could not detect lid %s state in %s.", state, LID_PATH); fwts_tag_failed(fw, FWTS_TAG_ACPI_LID); } else fwts_passed(fw, "Detected lid %s state.", state); diff -Naur fwts-0.23.13/src/acpi/mcfg/mcfg.c fwts-0.23.23/src/acpi/mcfg/mcfg.c --- fwts-0.23.13/src/acpi/mcfg/mcfg.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/mcfg/mcfg.c 2011-08-31 16:09:22.000000000 +0000 @@ -55,7 +55,8 @@ space[8], space[9], space[10], space[11], space[12], space[13], space[14], space[15]); - snprintf(command, sizeof(command), "%s -vxxx -s %i:%i", fw->lspci, segment, device); + snprintf(command, sizeof(command), "%s -vxxx -s %i:%i", + fw->lspci, segment, device); if (fwts_pipe_exec(command, &lspci_output) == FWTS_EXEC_ERROR) { fwts_log_warning(fw, "Could not execute %s", command); @@ -70,7 +71,9 @@ if (strncmp(line, "00: ",4)==0) { if (strcmp(&line[4], compare_line)) { fwts_log_info(fw, "%s is read from MMCONFIG, but traditional gives :\n-%s-\n", &line[4], compare_line); - fwts_failed(fw, LOG_LEVEL_MEDIUM, "PCIConfigSpaceBad", "PCI config space appears to not work"); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "PCIConfigSpaceBad", + "PCI config space appears to not work"); } else fwts_passed(fw, "PCI config space verified"); @@ -111,7 +114,7 @@ { int nr, i; const uint8_t *table_ptr; - const uint8_t *table_page; + const uint8_t *table_page; void *mapped_table_page; struct mcfg_entry *table, firstentry; int failed = 0; @@ -124,7 +127,7 @@ page_size = 4096; memory_map_name = fwts_memory_map_name(fw->firmware_type); - + fwts_log_info(fw, "This test tries to validate the MCFG table by comparing the first " "16 bytes in the MMIO mapped config space with the 'traditional' config " @@ -146,21 +149,27 @@ mcfg_size -= 8; /* 8 bytes of padding */ if ((int)mcfg_size<0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MCFGInvalidSize", "Invalid MCFG ACPI table size: got %d bytes expecting more", mcfg_size + 36 + 8); + fwts_failed(fw, LOG_LEVEL_HIGH, "MCFGInvalidSize", + "Invalid MCFG ACPI table size: got %d bytes expecting more", + mcfg_size + 36 + 8); fwts_tag_failed(fw, FWTS_TAG_ACPI_INVALID_TABLE); - fwts_advice(fw, "MCFG table must be least %d bytes (header size) with multiples of %d" - "bytes for each MCFG entry.", 36+8, (int)sizeof(struct mcfg_entry)); + fwts_advice(fw, + "MCFG table must be least %d bytes (header size) with " + "multiples of %d bytes for each MCFG entry.", + 36+8, (int)sizeof(struct mcfg_entry)); return FWTS_ERROR; } nr = mcfg_size / sizeof(struct mcfg_entry); if (!nr) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MCFGNoEntries", "No MCFG ACPI table entries"); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "MCFGNoEntries", + "No MCFG ACPI table entries"); return FWTS_ERROR; } if ((nr * sizeof(struct mcfg_entry)) != mcfg_size) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MCFGInvalidSize2", "MCFG table is not a multiple of record size"); + fwts_failed(fw, LOG_LEVEL_HIGH, "MCFGInvalidSize2", + "MCFG table is not a multiple of record size"); fwts_tag_failed(fw, FWTS_TAG_ACPI_INVALID_TABLE); return FWTS_ERROR; } @@ -171,7 +180,8 @@ table_page = table_ptr = (const uint8_t *)mcfg_table->data; if (table_page == NULL) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MCFGInvalidTable", "Invalid MCFG ACPI table"); + fwts_failed(fw, LOG_LEVEL_HIGH, "MCFGInvalidTable", + "Invalid MCFG ACPI table"); fwts_tag_failed(fw, FWTS_TAG_ACPI_INVALID_TABLE); return FWTS_ERROR; } @@ -182,24 +192,27 @@ firstentry = *table; if (memory_map_list == NULL) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MMapUnreadable", "Cannot check MCFG mmio space against memory map table: could not read memory map table."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "MMapUnreadable", + "Cannot check MCFG mmio space against memory map table: could not read memory map table."); for (i = 0; ilow_address); - if ((memory_map_list != NULL) && (!fwts_memory_map_is_reserved(memory_map_list, table->low_address))) { - + if ((memory_map_list != NULL) && + (!fwts_memory_map_is_reserved(memory_map_list, table->low_address))) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "MCFGMMIONotReserved", "MCFG mmio config space at 0x%x is not reserved in the memory map table", table->low_address); fwts_tag_failed(fw, FWTS_TAG_BIOS); - fwts_advice(fw, "The PCI Express specification states that the PCI Express configuration space should " - "be defined in the MCFG table and *maybe* optionally defined in the %s " - "if ACPI MCFG is present. " - "Linux checks if the region is reserved in the memory map table and will reject the " - "MMCONFIG if there is a discrepency between MCFG and the memory map table for the " - "PCI Express region. [See arch/x86/pci/mmconfig-shared.c pci_mmcfg_reject_broken()]. " - "It is recommended that this is defined in the %s table for Linux.", - memory_map_name, memory_map_name); + fwts_advice(fw, + "The PCI Express specification states that the PCI Express configuration space should " + "be defined in the MCFG table and *maybe* optionally defined in the %s " + "if ACPI MCFG is present. " + "Linux checks if the region is reserved in the memory map table and will reject the " + "MMCONFIG if there is a discrepency between MCFG and the memory map table for the " + "PCI Express region. [See arch/x86/pci/mmconfig-shared.c pci_mmcfg_reject_broken()]. " + "It is recommended that this is defined in the %s table for Linux.", + memory_map_name, memory_map_name); failed++; } @@ -221,7 +234,7 @@ compare_config_space(fw, firstentry.segment, 0, (unsigned char *)mapped_table_page); fwts_munmap(mapped_table_page, page_size); - + return FWTS_OK; } diff -Naur fwts-0.23.13/src/acpi/method/method.c fwts-0.23.23/src/acpi/method/method.c --- fwts-0.23.13/src/acpi/method/method.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/method/method.c 2011-08-31 16:09:22.000000000 +0000 @@ -27,7 +27,7 @@ /* acpica headers */ #include "acpi.h" -/* +/* * ACPI methods + objects used in Linux ACPI driver: * * Name APCI Spec. Tested @@ -148,19 +148,46 @@ #define method_check_type(fw, name, buf, type) \ method_check_type__(fw, name, buf, type, #type) +static bool mobile_platform; + +#define MOBILE_PLATFORM(test) \ + mobile_platform ? test : FWTS_OK + #define method_test_integer(name, type) \ static int method_test ## name(fwts_framework *fw) \ { \ return method_evaluate_method(fw, type, # name, NULL, 0, method_test_integer_return, # name); \ } - typedef void (*method_test_return)(fwts_framework *fw, char *name, ACPI_BUFFER *ret_buff, ACPI_OBJECT *ret_obj, void *private); static fwts_list *methods; static int method_init(fwts_framework *fw) { + fwts_acpi_table_info *info; + int i; + + mobile_platform = false; + + /* Some systems have multiple FADTs, sigh */ + for (i=0; i<256; i++) { + int ret = fwts_acpi_find_table(fw, "FACP", i, &info); + if (ret == FWTS_NULL_POINTER || info == NULL) + break; + fwts_acpi_table_fadt *fadt = (fwts_acpi_table_fadt*)info->data; + if (fadt->preferred_pm_profile == 2) { + mobile_platform = true; + break; + } + } + + if (!mobile_platform) { + fwts_log_info(fw, + "FADT Preferred PM profile indicates this is not a Mobile Platform, " + "skipping Mobile Platform specific tests."); + } + if (fwts_acpica_init(fw) != FWTS_OK) return FWTS_ERROR; @@ -341,7 +368,7 @@ if (check_func != NULL) { ACPI_OBJECT *obj = buf.Pointer; check_func(fw, name, &buf, obj, private); - } + } } if (buf.Length && buf.Pointer) free(buf.Pointer); @@ -397,7 +424,7 @@ */ } } - + if (!found) { if (test_type == METHOD_OPTIONAL) { fwts_skipped(fw, "Optional method %s did not exist.", name); @@ -427,7 +454,7 @@ (*ptr == '_') || (isdigit(*ptr)) || (isupper(*ptr))) ) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MethodIllegalName", "Method %s contains an illegal character: '%c'. This should be corrected.", + fwts_failed(fw, LOG_LEVEL_HIGH, "MethodIllegalName", "Method %s contains an illegal character: '%c'. This should be corrected.", fwts_list_data(char *, item), *ptr); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD); failed++; @@ -524,7 +551,7 @@ (uint32_t)obj->Integer.Value, sbs_info[obj->Integer.Value]); break; - default: + default: fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_SBSReturn", "_SBS returned %d, should be between 0 and 4.", (uint32_t)obj->Integer.Value); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); @@ -537,7 +564,7 @@ static int method_test_SBS(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, "_SBS", NULL, 0, method_test_SBS_return, NULL); + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_SBS", NULL, 0, method_test_SBS_return, NULL)); } @@ -574,49 +601,49 @@ /* Sanity check each field */ /* Power Unit */ - if (obj->Package.Elements[0].Integer.Value > 0x00000002) { + if (obj->Package.Elements[0].Integer.Value > 0x00000002) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_BIFBadUnits", "_BIF: Expected Power Unit (Element 0) to be 0 (mWh) or 1 (mAh), got 0x%8.8x.", (uint32_t)obj->Package.Elements[0].Integer.Value); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); failed++; } /* Design Capacity */ - if (obj->Package.Elements[1].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[1].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIFBadCapacity", "_BIF: Design Capacity (Element 1) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[1].Integer.Value); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); failed++; } /* Last Full Charge Capacity */ - if (obj->Package.Elements[2].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[2].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIFChargeCapacity", "_BIF: Last Full Charge Capacity (Element 2) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[2].Integer.Value); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); failed++; } /* Battery Technology */ - if (obj->Package.Elements[3].Integer.Value > 0x00000002) { + if (obj->Package.Elements[3].Integer.Value > 0x00000002) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_BIFBatTechUnit", "_BIF: Expected Battery Technology Unit (Element 3) to be 0 (Primary) or 1 (Secondary), got 0x%8.8x.", (uint32_t)obj->Package.Elements[3].Integer.Value); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); failed++; } /* Design Voltage */ - if (obj->Package.Elements[4].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[4].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIFDesignVoltage", "_BIF: Design Voltage (Element 4) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[4].Integer.Value); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); failed++; } /* Design capacity warning */ - if (obj->Package.Elements[5].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[5].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIFDesignCapacityE5", "_BIF: Design Capacity Warning (Element 5) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[5].Integer.Value); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); failed++; } /* Design capacity low */ - if (obj->Package.Elements[6].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[6].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIFDesignCapacityE6", "_BIF: Design Capacity Warning (Element 6) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[6].Integer.Value); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); @@ -633,7 +660,7 @@ static int method_test_BIF(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, "_BIF", NULL, 0, method_test_BIF_return, NULL); + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_BIF", NULL, 0, method_test_BIF_return, NULL)); } static void method_test_BIX_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private) @@ -668,7 +695,7 @@ /* Sanity check each field */ /* Power Unit */ - if (obj->Package.Elements[1].Integer.Value > 0x00000002) { + if (obj->Package.Elements[1].Integer.Value > 0x00000002) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_BIXPowerUnit", "_BIX: Expected Power Unit (Element 1) to be 0 (mWh) or 1 (mAh), got 0x%8.8x.", (uint32_t)obj->Package.Elements[1].Integer.Value); @@ -676,7 +703,7 @@ failed++; } /* Design Capacity */ - if (obj->Package.Elements[2].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[2].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIXDesignCapacity", "_BIX: Design Capacity (Element 2) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[2].Integer.Value); @@ -684,7 +711,7 @@ failed++; } /* Last Full Charge Capacity */ - if (obj->Package.Elements[3].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[3].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIXFullChargeCapacity", "_BIX: Last Full Charge Capacity (Element 3) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[3].Integer.Value); @@ -692,7 +719,7 @@ failed++; } /* Battery Technology */ - if (obj->Package.Elements[4].Integer.Value > 0x00000002) { + if (obj->Package.Elements[4].Integer.Value > 0x00000002) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_BIXBatteryTechUnit", "_BIX: Expected Battery Technology Unit (Element 4) to be 0 (Primary) or 1 (Secondary), got 0x%8.8x.", (uint32_t)obj->Package.Elements[4].Integer.Value); @@ -700,7 +727,7 @@ failed++; } /* Design Voltage */ - if (obj->Package.Elements[5].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[5].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIXDesignVoltage", "_BIX: Design Voltage (Element 5) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[5].Integer.Value); @@ -708,7 +735,7 @@ failed++; } /* Design capacity warning */ - if (obj->Package.Elements[6].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[6].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIXDesignCapacityE6", "_BIX: Design Capacity Warning (Element 6) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[6].Integer.Value); @@ -716,7 +743,7 @@ failed++; } /* Design capacity low */ - if (obj->Package.Elements[7].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[7].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIXDesignCapacityE7", "_BIX: Design Capacity Warning (Element 7) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[7].Integer.Value); @@ -724,7 +751,7 @@ failed++; } /* Cycle Count */ - if (obj->Package.Elements[10].Integer.Value > 0x7fffffff) { + if (obj->Package.Elements[10].Integer.Value > 0x7fffffff) { fwts_failed(fw, LOG_LEVEL_LOW, "Method_BIXCyleCount", "_BIX: Cycle Count (Element 10) is unknown: 0x%8.8x.", (uint32_t)obj->Package.Elements[10].Integer.Value); @@ -742,7 +769,7 @@ static int method_test_BIX(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, "_BIX", NULL, 0, method_test_BIX_return, NULL); + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_BIX", NULL, 0, method_test_BIX_return, NULL)); } static int method_test_BMA(fwts_framework *fw) @@ -750,7 +777,7 @@ ACPI_OBJECT arg[1]; arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = 1; - return method_evaluate_method(fw, METHOD_OPTIONAL, "_BMA", arg, 1, method_test_integer_return, NULL); + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_BMA", arg, 1, method_test_integer_return, NULL)); } static int method_test_BMS(fwts_framework *fw) @@ -758,7 +785,7 @@ ACPI_OBJECT arg[1]; arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = 1; - return method_evaluate_method(fw, METHOD_OPTIONAL, "_BMS", arg, 1, method_test_integer_return, NULL); + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_BMS", arg, 1, method_test_integer_return, NULL)); } static void method_test_BST_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private) @@ -787,7 +814,7 @@ /* Sanity check each field */ /* Battery State */ - if (obj->Package.Elements[0].Integer.Value > 0x00000002) { + if (obj->Package.Elements[0].Integer.Value > 0x00000002) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_BSTBadState", "_BST: Expected Battery State (Element 0) to be 0..2, got 0x%8.8x.", (uint32_t)obj->Package.Elements[0].Integer.Value); @@ -808,7 +835,7 @@ static int method_test_BST(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, "_BST", NULL, 0, method_test_BST_return, NULL); + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_BST", NULL, 0, method_test_BST_return, NULL)); } static int method_test_BTP(fwts_framework *fw) @@ -816,14 +843,16 @@ static int values[] = { 0, 1, 100, 200, 0x7fffffff }; int i; - for (i=0;i<5;i++) { - ACPI_OBJECT arg[1]; - arg[0].Type = ACPI_TYPE_INTEGER; - arg[0].Integer.Value = values[i]; - if (method_evaluate_method(fw, METHOD_OPTIONAL, "_BTP", arg, 1, - method_test_NULL_return, NULL) == FWTS_NOT_EXIST) - break; - fwts_log_nl(fw); + if (mobile_platform) { + for (i=0;i<5;i++) { + ACPI_OBJECT arg[1]; + arg[0].Type = ACPI_TYPE_INTEGER; + arg[0].Integer.Value = values[i]; + if (method_evaluate_method(fw, METHOD_OPTIONAL, "_BTP", arg, 1, + method_test_NULL_return, NULL) == FWTS_NOT_EXIST) + break; + fwts_log_nl(fw); + } } return FWTS_OK; } @@ -835,7 +864,7 @@ static int method_test_PCL(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, "_PCL", NULL, 0, method_test_PCL_return, "_PCL"); + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_PCL", NULL, 0, method_test_PCL_return, "_PCL")); } static int method_test_BTM(fwts_framework *fw) @@ -843,14 +872,16 @@ static int values[] = { 0, 1, 100, 200, 0x7fffffff }; int i; - for (i=0;i<5;i++) { - ACPI_OBJECT arg[1]; - arg[0].Type = ACPI_TYPE_INTEGER; - arg[0].Integer.Value = values[i]; - if (method_evaluate_method(fw, METHOD_OPTIONAL, "_BTM", arg, 1, - method_test_NULL_return, NULL) == FWTS_NOT_EXIST) - break; - fwts_log_nl(fw); + if (mobile_platform) { + for (i=0;i<5;i++) { + ACPI_OBJECT arg[1]; + arg[0].Type = ACPI_TYPE_INTEGER; + arg[0].Integer.Value = values[i]; + if (method_evaluate_method(fw, METHOD_OPTIONAL, "_BTM", arg, 1, + method_test_NULL_return, NULL) == FWTS_NOT_EXIST) + break; + fwts_log_nl(fw); + } } return FWTS_OK; } @@ -883,7 +914,7 @@ static int method_test_BMD(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, "_BMD", NULL, 0, method_test_BMD_return, NULL); + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_BMD", NULL, 0, method_test_BMD_return, NULL)); } static int method_test_BMC(fwts_framework *fw) @@ -891,18 +922,20 @@ static int values[] = { 0, 1, 2, 4 }; int i; - for (i=0;i<4;i++) { - ACPI_OBJECT arg[1]; - arg[0].Type = ACPI_TYPE_INTEGER; - arg[0].Integer.Value = values[i]; - if (method_evaluate_method(fw, METHOD_OPTIONAL, "_BMC", arg, 1, - method_test_NULL_return, NULL) == FWTS_NOT_EXIST) - break; - fwts_log_nl(fw); + if (mobile_platform) { + for (i=0;i<4;i++) { + ACPI_OBJECT arg[1]; + arg[0].Type = ACPI_TYPE_INTEGER; + arg[0].Integer.Value = values[i]; + if (method_evaluate_method(fw, METHOD_OPTIONAL, "_BMC", arg, 1, + method_test_NULL_return, NULL) == FWTS_NOT_EXIST) + break; + fwts_log_nl(fw); + } } return FWTS_OK; } - + /* Section 15, Waking and Sleeping */ static int method_test_BFS(fwts_framework *fw) @@ -912,10 +945,10 @@ if (method_exits("_BFS")) { for (i=1; i<6; i++) { ACPI_OBJECT arg[1]; - + arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = i; - + if (method_evaluate_method(fw, METHOD_OPTIONAL, "_BFS", arg, 1, method_test_NULL_return, NULL) == FWTS_NOT_EXIST) break; @@ -962,7 +995,7 @@ if (method_exits("_GTS")) { for (i=1; i<6; i++) { ACPI_OBJECT arg[1]; - + arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = i; @@ -987,12 +1020,12 @@ if (method_exits("_BFS")) { for (i=1; i<6; i++) { ACPI_OBJECT arg[1]; - + arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = i; fwts_log_info(fw, "Test _TTS(%d) Transition To State S%d.", i, i); - + if (method_evaluate_method(fw, METHOD_MANDITORY, "_TTS", arg, 1, method_test_NULL_return, NULL) == FWTS_NOT_EXIST) break; @@ -1024,7 +1057,7 @@ static int method_test ## name(fwts_framework *fw) \ { \ return method_evaluate_method(fw, METHOD_OPTIONAL, # name, NULL, 0, method_test_Sx_return, # name); \ -} +} method_test_Sx(_S0) method_test_Sx(_S1) @@ -1055,7 +1088,7 @@ failed++; } else { - if (obj->Package.Elements[0].Integer.Value > 0x00000002) { + if (obj->Package.Elements[0].Integer.Value > 0x00000002) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_WAKBitField", "_WAK: expecting condition bit-field (element 0) of packages to be in range, got 0x%8.8x.", (uint32_t)obj->Package.Elements[0].Integer.Value); @@ -1077,7 +1110,7 @@ "_WAK method is misinforming the operating system. Currently Linux does not " "check for the return type from _WAK, so it should theoretically not affect the " "operation of suspend/resume."); - + failed++; } } @@ -1120,7 +1153,7 @@ static int method_test_PSR(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_MANDITORY, "_PSR", NULL, 0, method_test_PSR_return, NULL); + return method_evaluate_method(fw, METHOD_OPTIONAL, "_PSR", NULL, 0, method_test_PSR_return, NULL); } static void method_test_PIF_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private) @@ -1128,7 +1161,7 @@ if (method_check_type(fw, name, buf, ACPI_TYPE_PACKAGE) == FWTS_OK) { method_dump_package(fw, obj); - + if (obj->Package.Count != 6) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "Method_PIFElementCount", "_PIF should return package of 6 elements, got %d elements instead.", @@ -1167,7 +1200,7 @@ static int method_test_LID(fwts_framework *fw) { - return method_evaluate_method(fw, METHOD_OPTIONAL, "_LID", NULL, 0, method_test_LID_return, NULL); + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_LID", NULL, 0, method_test_LID_return, NULL)); } /* Section 11.3 Fan Devices */ @@ -1276,7 +1309,7 @@ static int method_test ## name(fwts_framework *fw) \ { \ return method_evaluate_method(fw, type, # name, NULL, 0, method_test_THERM_return, # name); \ -} +} method_test_THERM(_CRT, METHOD_OPTIONAL) method_test_THERM(_HOT, METHOD_OPTIONAL) @@ -1417,20 +1450,29 @@ /* Section 6.5 Other Objects and Control Methods */ -method_test_integer(_BBN, METHOD_OPTIONAL) -method_test_integer(_BDN, METHOD_OPTIONAL) +static int method_test_BBN(fwts_framework *fw) +{ + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_BBN", NULL, 0, method_test_integer_return, "_BBN")); +} + +static int method_test_BDN(fwts_framework *fw) +{ + return MOBILE_PLATFORM(method_evaluate_method(fw, METHOD_OPTIONAL, "_BDN", NULL, 0, method_test_integer_return, "_BDN")); +} static int method_test_DCK(fwts_framework *fw) { int i; - for (i=1;i>0;i--) { /* Dock, Undock */ - ACPI_OBJECT arg[1]; - arg[0].Type = ACPI_TYPE_INTEGER; - arg[0].Integer.Value = i; - if (method_evaluate_method(fw, METHOD_OPTIONAL, "_DCK", arg, 1, method_test_passed_failed_return, "_DCK") != FWTS_OK) - break; - fwts_log_nl(fw); + if (mobile_platform) { + for (i=1;i>0;i--) { /* Dock, Undock */ + ACPI_OBJECT arg[1]; + arg[0].Type = ACPI_TYPE_INTEGER; + arg[0].Integer.Value = i; + if (method_evaluate_method(fw, METHOD_OPTIONAL, "_DCK", arg, 1, method_test_passed_failed_return, "_DCK") != FWTS_OK) + break; + fwts_log_nl(fw); + } } return FWTS_OK; } @@ -1446,7 +1488,7 @@ arg[0].Integer.Value = 1; /* DC timer */ arg[1].Type = ACPI_TYPE_INTEGER; arg[1].Integer.Value = 0; /* wake up instantly */ - + return method_evaluate_method(fw, METHOD_OPTIONAL, "_STP", arg, 2, method_test_passed_failed_return, "_STP"); } @@ -1458,7 +1500,7 @@ arg[0].Integer.Value = 1; /* DC timer */ arg[1].Type = ACPI_TYPE_INTEGER; arg[1].Integer.Value = 100; /* timer value */ - + return method_evaluate_method(fw, METHOD_OPTIONAL, "_STV", arg, 2, method_test_passed_failed_return, "_STV"); } @@ -1468,7 +1510,7 @@ arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = 1; /* DC timer */ - + return method_evaluate_method(fw, METHOD_OPTIONAL, "_TIP", arg, 1, method_test_integer_return, NULL); } @@ -1478,7 +1520,7 @@ arg[0].Type = ACPI_TYPE_INTEGER; arg[0].Integer.Value = 1; /* DC timer */ - + return method_evaluate_method(fw, METHOD_OPTIONAL, "_TIV", arg, 1, method_test_integer_return, NULL); } @@ -1489,9 +1531,9 @@ ACPI_OBJECT arg[1]; arg[0].Type = ACPI_TYPE_INTEGER; - arg[0].Integer.Value = 0 << 2 | 1; + arg[0].Integer.Value = 0 << 2 | 1; /* BIOS should toggle active display, BIOS controls brightness of LCD on AC/DC power changes */ - + return method_evaluate_method(fw, METHOD_OPTIONAL, "_DOS", arg, 1, method_test_NULL_return, NULL); } @@ -1526,7 +1568,7 @@ method_dump_package(fw, obj); for (i=0;iPackage.Count;i++) { - if (obj->Package.Elements[i].Type != ACPI_TYPE_INTEGER) + if (obj->Package.Elements[i].Type != ACPI_TYPE_INTEGER) failed++; else { uint32_t val = obj->Package.Elements[i].Integer.Value; @@ -1557,7 +1599,7 @@ { return method_evaluate_method(fw, METHOD_OPTIONAL, "_DOD", NULL, 0, method_test_DOD_return, NULL); } - + static void method_test_ROM_return(fwts_framework *fw, char *name, ACPI_BUFFER *buf, ACPI_OBJECT *obj, void *private) { method_check_type(fw, name, buf, ACPI_TYPE_BUFFER); @@ -1614,7 +1656,7 @@ method_dump_package(fw, obj); for (i=0;iPackage.Count;i++) { - if (obj->Package.Elements[i].Type != ACPI_TYPE_INTEGER) + if (obj->Package.Elements[i].Type != ACPI_TYPE_INTEGER) failed++; } if (failed) { @@ -1696,7 +1738,7 @@ "Method _DDC returned a buffer of %d items, expected %d.", obj->Buffer.Length, requested); fwts_tag_failed(fw, FWTS_TAG_ACPI_METHOD_RETURN); - } else + } else fwts_passed(fw, "Method _DDC returned a buffer of %d items as expected.", obj->Buffer.Length); break; @@ -1790,7 +1832,7 @@ static int method_test ## name(fwts_framework *fw) \ { \ return method_evaluate_method(fw, METHOD_OPTIONAL, # name, NULL, 0, method_test_NULL_return, # name); \ -} +} method_test_PSx(_PS0) method_test_PSx(_PS1) @@ -1833,7 +1875,7 @@ arg[0].Integer.Value = 1; \ \ return method_evaluate_method(fw, METHOD_OPTIONAL, # name, arg, 1, method_test_NULL_return, # name); \ -} +} method_test_EJx(_EJ0) method_test_EJx(_EJ1) @@ -1878,7 +1920,7 @@ } switch (obj->Type) { case ACPI_TYPE_STRING: - if (obj->String.Pointer) + if (obj->String.Pointer) fwts_passed(fw, "Object _UID returned a string '%s' as expected.", obj->String.Pointer); else { @@ -1955,7 +1997,7 @@ { method_test_PIF, "Check _PIF (Power Source Information) Object." }, /* Section 11.3 Fan Devices */ - + { method_test_FIF, "Check _FIF (Fan Information)." }, /* { method_test_FPS, "Check _FPS (Fan Performance States)." }, */ { method_test_FSL, "Check _FSL (Fan Set Level)." }, @@ -1991,7 +2033,7 @@ { method_test_PXM, "Check _PXM (Proximity)." }, /* Section 6.5 Other Objects and Controls */ - + { method_test_DCK, "Check _DCK (Dock)." }, { method_test_BDN, "Check _BDN (BIOS Dock Name)." }, { method_test_BBN, "Check _BBN (Base Bus Number)." }, @@ -2031,9 +2073,9 @@ /* Section 7.1 */ { method_test_ON, "Check _ON (Set resource on)." }, { method_test_OFF, "Check _OFF (Set resource off)." }, - + /* Appendix B, ACPI Extensions for Display Adapters */ - + { method_test_DOS, "Check _DOS (Enable/Disable Output Switching)." }, { method_test_DOD, "Check _DOD (Enumerate All Devices Attached to Display Adapter)." }, { method_test_ROM, "Check _ROM (Get ROM Data) Object." }, diff -Naur fwts-0.23.13/src/acpi/osilinux/osilinux.c fwts-0.23.23/src/acpi/osilinux/osilinux.c --- fwts-0.23.13/src/acpi/osilinux/osilinux.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/osilinux/osilinux.c 2011-08-31 16:09:22.000000000 +0000 @@ -28,7 +28,7 @@ #include static int osilinux_test1(fwts_framework *fw) -{ +{ fwts_list_link *item; fwts_list_link *dumpitem = NULL; fwts_list* disassembly; @@ -42,7 +42,8 @@ } if (disassembly == NULL) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoDSDT", "Could not read ACPI DSDT table."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoDSDT", + "Could not read ACPI DSDT table."); return FWTS_ERROR; } @@ -66,7 +67,8 @@ depth--; if (dumpdepth != 0 && dumpdepth != depth) { found++; - while (dumpitem != NULL && dumpitem != item->next) { + while (dumpitem != NULL && + dumpitem != item->next) { fwts_log_warning_verbatum(fw, "%s", fwts_text_list_text(dumpitem)); dumpitem = dumpitem->next; } @@ -75,7 +77,8 @@ } } if ((str = strstr(line, "_OSI")) != NULL) { - if (strstr(str + 4, "Linux") || strstr(str + 4, "linux")) + if (strstr(str + 4, "Linux") || + strstr(str + 4, "linux")) dumpdepth = depth; } } diff -Naur fwts-0.23.13/src/acpi/powerbutton/powerbutton.c fwts-0.23.23/src/acpi/powerbutton/powerbutton.c --- fwts-0.23.13/src/acpi/powerbutton/powerbutton.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/powerbutton/powerbutton.c 2011-08-31 16:09:22.000000000 +0000 @@ -29,14 +29,16 @@ #include #include -DIR *power_buttondir; +static DIR *power_buttondir; #define POWER_BUTTON_PATH "/proc/acpi/button/power" static int power_button_init(fwts_framework *fw) { if (!(power_buttondir = opendir(POWER_BUTTON_PATH))) { - fwts_failed(fw, LOG_LEVEL_LOW, "NoButtonPath", "No %s directory available: cannot test.", POWER_BUTTON_PATH); + fwts_failed(fw, LOG_LEVEL_LOW, "NoButtonPath", + "No %s directory available: cannot test.", + POWER_BUTTON_PATH); return FWTS_ERROR; } @@ -51,7 +53,8 @@ return FWTS_OK; } -void power_button_check_field(fwts_framework *fw, char *field, char *contents, int *matching, int *not_matching) +static void power_button_check_field(fwts_framework *fw, + char *field, char *contents, int *matching, int *not_matching) { struct dirent *entry; @@ -62,7 +65,8 @@ char path[PATH_MAX]; char *data; - snprintf(path, sizeof(path), POWER_BUTTON_PATH "/%s/%s", entry->d_name, field); + snprintf(path, sizeof(path), POWER_BUTTON_PATH "/%s/%s", + entry->d_name, field); if ((data = fwts_get(path)) != NULL) { if (strstr(data, contents)) { (*matching)++; @@ -84,7 +88,8 @@ power_button_check_field(fw, "info", "Power Button", &matching, ¬_matching); if ((matching == 0) || (not_matching > 0)) - fwts_failed(fw, LOG_LEVEL_LOW, "NoPowerButtonField", "Failed to detect a Power Button in power button info field."); + fwts_failed(fw, LOG_LEVEL_LOW, "NoPowerButtonField", + "Failed to detect a Power Button in power button info field."); else fwts_passed(fw, "Detected a Power Button in a power button info field."); @@ -119,13 +124,14 @@ fwts_printf(fw, "Waiting %2.2d/20\r", 20-i); } if (matching == 0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "NoPowerButtonEvents", "Did not detect any ACPI power buttons events while waiting for power button to be pressed."); + fwts_failed(fw, LOG_LEVEL_HIGH, "NoPowerButtonEvents", + "Did not detect any ACPI power buttons events while waiting for power button to be pressed."); fwts_tag_failed(fw, FWTS_TAG_ACPI_EVENT); } else { char button[4096]; memset(button, 0, sizeof(button)); sscanf(buffer, "%*s %s", button); - + fwts_passed(fw, "Detected %s power button event.", button); } diff -Naur fwts-0.23.13/src/acpi/s3/s3.c fwts-0.23.23/src/acpi/s3/s3.c --- fwts-0.23.13/src/acpi/s3/s3.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/s3/s3.c 2011-08-31 16:09:22.000000000 +0000 @@ -52,7 +52,8 @@ } if ((ret = fwts_wakealarm_test_firing(fw, 1))) { fwts_log_error(fw, "Cannot automatically wake machine up - aborting S3 test."); - fwts_failed(fw, LOG_LEVEL_MEDIUM, "BadWakeAlarmS3", "Check if wakealarm works reliably for S3 tests."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "BadWakeAlarmS3", + "Check if wakealarm works reliably for S3 tests."); return FWTS_ERROR; } @@ -117,7 +118,7 @@ if (s3_device_check) { int i; - + for (i=0;i 0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "DevConfigDiffAfterS3", "Found %d differences in device configuation during S3 cycle.", differences); + fwts_failed(fw, LOG_LEVEL_HIGH, "DevConfigDiffAfterS3", + "Found %d differences in device configuation during S3 cycle.", differences); (*hw_errors)++; } } if (duration < delay) { (*pm_errors)++; - fwts_failed(fw, LOG_LEVEL_MEDIUM, "ShortSuspend", "Unexpected: S3 slept for %d seconds, less than the expected %d seconds.", duration, delay); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "ShortSuspend", + "Unexpected: S3 slept for %d seconds, less than the expected %d seconds.", duration, delay); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); } fwts_progress_message(fw, percent, "(Checking for errors)"); if (duration > (delay*2)) { int s3_C1E_enabled; (*pm_errors)++; - fwts_failed(fw, LOG_LEVEL_HIGH, "LongSuspend", "Unexpected: S3 much longer than expected (%d seconds).", duration); + fwts_failed(fw, LOG_LEVEL_HIGH, "LongSuspend", + "Unexpected: S3 much longer than expected (%d seconds).", duration); s3_C1E_enabled = fwts_cpu_has_c1e(); if (s3_C1E_enabled == -1) fwts_log_error(fw, "Cannot read C1E bit\n"); else if (s3_C1E_enabled == 1) - fwts_advice(fw, "Detected AMD with C1E enabled. The AMD C1E idle wait can sometimes " - "produce long delays on resume. This is a known issue with the " - "failed delivery of intettupts while in deep C states. " - "If you have a BIOS option to disable C1E please disable this and retry. " - "Alternatively, re-test with the kernel parameter \"idle=mwait\". "); + fwts_advice(fw, + "Detected AMD with C1E enabled. The AMD C1E idle wait can sometimes " + "produce long delays on resume. This is a known issue with the " + "failed delivery of intettupts while in deep C states. " + "If you have a BIOS option to disable C1E please disable this and retry. " + "Alternatively, re-test with the kernel parameter \"idle=mwait\". "); } /* Add in error check for pm-suspend status */ if ((status > 0) && (status < 128)) { (*pm_errors)++; - fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedPreS3", "pm-action failed before trying to put the system " - "in the requested power saving state."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedPreS3", + "pm-action failed before trying to put the system " + "in the requested power saving state."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); } else if (status == 128) { (*pm_errors)++; - fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionPowerStateS3", "pm-action tried to put the machine in the requested " - "power state but failed."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionPowerStateS3", + "pm-action tried to put the machine in the requested " + "power state but failed."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); } else if (status > 128) { (*pm_errors)++; - fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedS3", "pm-action encountered an error and also failed to " - "enter the requested power saving state."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedS3", + "pm-action encountered an error and also failed to " + "enter the requested power saving state."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); } @@ -186,7 +194,8 @@ if ((klog = fwts_klog_read()) == NULL) { fwts_log_error(fw, "Cannot read kernel log."); - fwts_failed(fw, LOG_LEVEL_MEDIUM, "KlogCheckS3", "Unable to check kernel log for S3 suspend/resume test."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "KlogCheckS3", + "Unable to check kernel log for S3 suspend/resume test."); return FWTS_ERROR; } @@ -213,7 +222,7 @@ } static int s3_test_multiple(fwts_framework *fw) -{ +{ int i; int klog_errors = 0; int hw_errors = 0; @@ -251,7 +260,7 @@ fwts_progress_message(fw, percent, buffer); sleep(1); } - + awake_delay += delta; if (awake_delay > (s3_max_delay * 1000)) awake_delay = s3_min_delay * 1000; @@ -282,7 +291,7 @@ if ((klog_errors + pm_errors + hw_errors + klog_oopses) > 0) { - fwts_log_info(fw, "Found %d errors and %d oopses doing %d suspend/resume cycle(s).", + fwts_log_info(fw, "Found %d errors and %d oopses doing %d suspend/resume cycle(s).", klog_errors + pm_errors + hw_errors, klog_oopses, s3_multiple); } else fwts_passed(fw, "Found no errors doing %d suspend/resume cycle(s).", s3_multiple); @@ -316,7 +325,7 @@ fprintf(stderr, "--s3-device-check-delay is %d, it cannot be less than 1 second or more than 1 hour!\n", s3_device_check_delay); return FWTS_ERROR; } - if (s3_min_max_delay & s3_device_check) { + if (s3_min_max_delay & s3_device_check) { fprintf(stderr, "Cannot use --s3-min-delay, --s3-max-delay, --s3-delay-delta as well as --s3-device-check, --s3-device-check-delay.\n"); return FWTS_ERROR; } @@ -329,7 +338,7 @@ case 0: switch (long_index) { case 0: - s3_multiple = atoi(optarg); + s3_multiple = atoi(optarg); break; case 1: s3_min_delay = atoi(optarg); @@ -380,7 +389,7 @@ static fwts_framework_ops s3_ops = { .description = "S3 suspend/resume test.", - .init = s3_init, + .init = s3_init, .minor_tests = s3_tests, .options = s3_options, .options_handler = s3_options_handler, diff -Naur fwts-0.23.13/src/acpi/s3power/s3power.c fwts-0.23.23/src/acpi/s3power/s3power.c --- fwts-0.23.13/src/acpi/s3power/s3power.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/s3power/s3power.c 2011-08-31 16:09:22.000000000 +0000 @@ -57,7 +57,8 @@ char path[PATH_MAX]; char *data; - snprintf(path, sizeof(path), AC_ADAPTER_PATH "/%s/state", entry->d_name); + snprintf(path, sizeof(path), + AC_ADAPTER_PATH "/%s/state", entry->d_name); if ((data = fwts_get(path)) != NULL) { if (strstr(data, "on-line")) *offline = false; @@ -104,7 +105,7 @@ return FWTS_OK; } -static int s3power_get_capacity(fwts_framework *fw, +static int s3power_get_capacity(fwts_framework *fw, const char *file, const char *field, uint32_t *capacity_mAh, @@ -136,7 +137,8 @@ } else { char buffer[4096]; while (fgets(buffer, sizeof(buffer)-1, fp) != NULL) { - if (strstr(buffer, field) && strlen(buffer) > 25) { + if (strstr(buffer, field) && + strlen(buffer) > 25) { sscanf(buffer+25, "%d %s", &val, units); if (strncmp(units, "mAh",3) == 0) { *capacity_mAh += val; @@ -154,19 +156,21 @@ } while (entry); if (n == 0) { - fwts_log_info(fw, "No valid battery information present: cannot test."); + fwts_log_info(fw, "No valid battery information present: cannot test."); return FWTS_ERROR; } return FWTS_OK; } -static int s3power_get_design_capacity(fwts_framework *fw, uint32_t *capacity_mAh, uint32_t *capacity_mWh) +static int s3power_get_design_capacity(fwts_framework *fw, + uint32_t *capacity_mAh, uint32_t *capacity_mWh) { return s3power_get_capacity(fw, "info", "design capacity", capacity_mAh, capacity_mWh); } -static int s3power_get_remaining_capacity(fwts_framework *fw, uint32_t *capacity_mAh, uint32_t *capacity_mWh) +static int s3power_get_remaining_capacity(fwts_framework *fw, + uint32_t *capacity_mAh, uint32_t *capacity_mWh) { return s3power_get_capacity(fw, "state", "remaining capacity", capacity_mAh, capacity_mWh); } @@ -175,7 +179,8 @@ { if (fwts_wakealarm_test_firing(fw, 1) != FWTS_OK) { fwts_log_error(fw, "Cannot automatically wake machine up - aborting S3power test."); - fwts_failed(fw, LOG_LEVEL_MEDIUM, "BadWakeAlarmS3Power", "Wakealarm does not work reliably for s3power test."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "BadWakeAlarmS3Power", + "Wakealarm does not work reliably for s3power test."); return FWTS_ABORTED; } @@ -187,7 +192,9 @@ return FWTS_OK; } -static void s3power_difference(fwts_framework *fw, uint32_t before, uint32_t after, uint32_t battery_capacity, char *units) +static void s3power_difference(fwts_framework *fw, + uint32_t before, uint32_t after, + uint32_t battery_capacity, char *units) { int32_t diff = before - after; float hourly_loss; @@ -205,13 +212,21 @@ battery_capacity, units, duration); if (duration < 24.0) { - fwts_failed(fw, LOG_LEVEL_CRITICAL, "ShortSuspendLife24hrs", "Machine cannot remain suspended for 1 day."); + fwts_failed(fw, LOG_LEVEL_CRITICAL, + "ShortSuspendLife24hrs", + "Machine cannot remain suspended for 1 day."); } else if (duration < 36.0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "ShortSuspendLife36hrs", "Machine cannot remain suspended for 1.5 days."); + fwts_failed(fw, LOG_LEVEL_HIGH, + "ShortSuspendLife36hrs", + "Machine cannot remain suspended for 1.5 days."); } else if (duration < 48.0) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "ShortSuspendLife48hrs", "Machine cannot remain suspended for 2 days."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "ShortSuspendLife48hrs", + "Machine cannot remain suspended for 2 days."); } else if (duration < 60.0) { - fwts_failed(fw, LOG_LEVEL_LOW, "ShortSuspendLife60hrs", "Machine cannot remain suspended for 2.5 days."); + fwts_failed(fw, LOG_LEVEL_LOW, + "ShortSuspendLife60hrs", + "Machine cannot remain suspended for 2.5 days."); } else { fwts_passed(fw, "Machine can remain suspended for %5.2f hours.", duration); } @@ -268,24 +283,30 @@ fwts_log_info(fw, "pm-suspend returned %d after %d seconds.", status, duration); if (duration < s3power_sleep_delay) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "ShortSuspend", "Unexpected: S3 slept for %d seconds, less than the expected %d seconds.", duration, s3power_sleep_delay); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "ShortSuspend", + "Unexpected: S3 slept for %d seconds, less than the expected %d seconds.", + duration, s3power_sleep_delay); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); } if (duration > (s3power_sleep_delay*2)) - fwts_failed(fw, LOG_LEVEL_HIGH, "LongSuspend", "Unexpected: S3 much longer than expected (%d seconds).", duration); + fwts_failed(fw, LOG_LEVEL_HIGH, "LongSuspend", + "Unexpected: S3 much longer than expected (%d seconds).", duration); /* Add in error check for pm-suspend status */ if ((status > 0) && (status < 128)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedPreS3", "pm-action failed before trying to put the system " - "in the requested power saving state."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedPreS3", + "pm-action failed before trying to put the system " + "in the requested power saving state."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); } else if (status == 128) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionPowerStateS3", "pm-action tried to put the machine in the requested " - "power state but failed."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionPowerStateS3", + "pm-action tried to put the machine in the requested " + "power state but failed."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); } else if (status > 128) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedS3", "pm-action encountered an error and also failed to " - "enter the requested power saving state."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedS3", + "pm-action encountered an error and also failed to " + "enter the requested power saving state."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); } @@ -307,7 +328,7 @@ case 0: switch (long_index) { case 0: - s3power_sleep_delay = atoi(optarg); + s3power_sleep_delay = atoi(optarg); break; } } @@ -326,7 +347,7 @@ static fwts_framework_ops s3power_ops = { .description = "S3 power loss during suspend test (takes minimum of 10 minutes to run).", - .init = s3power_init, + .init = s3power_init, .minor_tests = s3power_tests, .options = s3power_options, .options_handler = s3power_options_handler, diff -Naur fwts-0.23.13/src/acpi/s4/s4.c fwts-0.23.23/src/acpi/s4/s4.c --- fwts-0.23.13/src/acpi/s4/s4.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/s4/s4.c 2011-08-31 16:09:22.000000000 +0000 @@ -52,21 +52,24 @@ swap_devs = fwts_file_open_and_read("/proc/swaps"); if (fwts_text_list_strstr(swap_devs, "/dev/") == NULL) { fwts_list_free(swap_devs, free); - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoSwap", "Cannot run hibernate test - machine appears to have NO swap."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoSwap", + "Cannot run hibernate test - machine appears to have NO swap."); return FWTS_ERROR; } fwts_list_free(swap_devs, free); if (fwts_wakealarm_test_firing(fw, 1)) { fwts_log_error(fw, "Cannot automatically wake machine up - aborting S4 test."); - fwts_failed(fw, LOG_LEVEL_MEDIUM, "BadWakeAlarmS4", "Check if wakealarm works reliably for S4 tests."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "BadWakeAlarmS4", + "Check if wakealarm works reliably for S4 tests."); return FWTS_ERROR; } - + return FWTS_OK; } -static void s4_check_log(fwts_framework *fw, fwts_list *klog, int *errors, int *oopses) +static void s4_check_log(fwts_framework *fw, + fwts_list *klog, int *errors, int *oopses) { int error; int oops; @@ -89,14 +92,14 @@ *oopses += oops; } -static int s4_hibernate(fwts_framework *fw, - int *klog_errors, +static int s4_hibernate(fwts_framework *fw, + int *klog_errors, int *hw_errors, int *pm_errors, - int *klog_oopses, - int *failed_alloc_image, + int *klog_oopses, + int *failed_alloc_image, int percent) -{ +{ fwts_list *output; fwts_list *klog; fwts_hwinfo hwinfo1, hwinfo2; @@ -155,7 +158,8 @@ fwts_hwinfo_free(&hwinfo2); if (differences > 0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "DevConfigDiffAfterS4", "Found %d differences in device configuation during S4 cycle.", differences); + fwts_failed(fw, LOG_LEVEL_HIGH, "DevConfigDiffAfterS4", + "Found %d differences in device configuation during S4 cycle.", differences); (*hw_errors)++; } } @@ -166,61 +170,69 @@ fwts_log_error(fw, "S4: hibernate: Cannot read kernel log."); return FWTS_ERROR; } - + s4_check_log(fw, klog, klog_errors, klog_oopses); fwts_progress_message(fw, percent, "(Checking for PM errors)"); /* Add in error check for pm-hibernate status */ if ((status > 0) && (status < 128)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedPreS4", "pm-action failed before trying to put the system " - "in the requested power saving state."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedPreS4", + "pm-action failed before trying to put the system " + "in the requested power saving state."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); (*pm_errors)++; } else if (status == 128) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionPowerStateS4", "pm-action tried to put the machine in the requested " - "power state but failed."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionPowerStateS4", + "pm-action tried to put the machine in the requested " + "power state but failed."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); (*pm_errors)++; } else if (status > 128) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedS4", "pm-action encountered an error and also failed to " - "enter the requested power saving state."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "PMActionFailedS4", + "pm-action encountered an error and also failed to " + "enter the requested power saving state."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); (*pm_errors)++; } if (fwts_klog_regex_find(fw, klog, "Freezing user space processes.*done") < 1) { - fwts_failed(fw, LOG_LEVEL_HIGH, "UserSpaceTaskFreeze", "Failed to freeze user space processes."); + fwts_failed(fw, LOG_LEVEL_HIGH, "UserSpaceTaskFreeze", + "Failed to freeze user space processes."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); (*pm_errors)++; } if (fwts_klog_regex_find(fw, klog, "Freezing remaining freezable tasks.*done") < 1) { - fwts_failed(fw, LOG_LEVEL_HIGH, "KernelTaskFreeze", "Failed to freeze remaining non-user space processes."); + fwts_failed(fw, LOG_LEVEL_HIGH, "KernelTaskFreeze", + "Failed to freeze remaining non-user space processes."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); (*pm_errors)++; } if ((fwts_klog_regex_find(fw, klog, "PM: freeze of devices complete") < 1) && (fwts_klog_regex_find(fw, klog, "PM: late freeze of devices complete") < 1)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "DeviceFreeze", "Failed to freeze devices."); + fwts_failed(fw, LOG_LEVEL_HIGH, "DeviceFreeze", + "Failed to freeze devices."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); (*pm_errors)++; } if (fwts_klog_regex_find(fw, klog, "PM: Allocated.*kbytes") < 1) { - fwts_failed(fw, LOG_LEVEL_HIGH, "HibernateImageAlloc", "Failed to allocate memory for hibernate image."); + fwts_failed(fw, LOG_LEVEL_HIGH, "HibernateImageAlloc", + "Failed to allocate memory for hibernate image."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); *failed_alloc_image = 1; (*pm_errors)++; } if (fwts_klog_regex_find(fw, klog, "PM: Image restored successfully") < 1) { - fwts_failed(fw, LOG_LEVEL_HIGH, "HibernateImageRestore", "Failed to restore hibernate image."); + fwts_failed(fw, LOG_LEVEL_HIGH, "HibernateImageRestore", + "Failed to restore hibernate image."); fwts_tag_failed(fw, FWTS_TAG_POWER_MANAGEMENT); (*pm_errors)++; } - + fwts_klog_free(klog); return FWTS_OK; @@ -250,7 +262,7 @@ fwts_log_info(fw, "S4 cycle %d of %d\n",i+1,s4_multiple); - if (s4_hibernate(fw, + if (s4_hibernate(fw, &klog_errors, &hw_errors, &pm_errors, &klog_oopses, &failed_alloc_image, percent) != FWTS_OK) { fwts_log_error(fw, "Aborting S4 multiple tests."); @@ -266,24 +278,25 @@ if ((!retried) && (tracing_buffer_size > 4096)) { retried = true; - fwts_failed(fw, LOG_LEVEL_MEDIUM, "TracingBufferTooBig", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "TracingBufferTooBig", "/sys/kernel/debug/tracing/buffer_size_kb is set to %d Kbytes which " "may cause hibernate to fail. Programs such as ureadahead may have " "set this enable fast boot and not freed up the tracing buffer.", tracing_buffer_size); - + fwts_log_info(fw, "Setting tracing buffer size to 1K for subsequent tests."); - + fwts_set("1", FWTS_TRACING_BUFFER_SIZE); failed_alloc_image = 0; - - if (s4_hibernate(fw, + + if (s4_hibernate(fw, &klog_errors, &hw_errors, &pm_errors, &klog_oopses, &failed_alloc_image, percent) != FWTS_OK) { fwts_log_error(fw, "Aborting S4 multiple tests."); ret = FWTS_ABORTED; break; }; - + if (failed_alloc_image) { ret = FWTS_ABORTED; break; @@ -299,7 +312,7 @@ tv.tv_sec = 0; tv.tv_usec = (awake_delay % 1000)*1000; select(0, NULL, NULL, NULL, &tv); - + for (i=0; i 0) + + if (klog_oopses > 0) fwts_log_info(fw, "Found %d kernel oopses.", klog_oopses); else fwts_passed(fw, "No kernel oopses detected."); @@ -341,7 +354,8 @@ /* Really passed or failed? */ if ((klog_errors + pm_errors + hw_errors + klog_oopses) > 0) { fwts_log_info(fw, "Found %d errors and %d oopses doing %d hibernate/resume cycle(s).", - klog_errors + pm_errors + hw_errors, klog_oopses, s4_multiple); + klog_errors + pm_errors + hw_errors, + klog_oopses, s4_multiple); } else fwts_passed(fw, "Found no errors and no oopses doing %d hibernate/resume cycle(s).", s4_multiple); @@ -388,7 +402,7 @@ case 0: switch (long_index) { case 0: - s4_multiple = atoi(optarg); + s4_multiple = atoi(optarg); break; case 1: s4_min_delay = atoi(optarg); diff -Naur fwts-0.23.13/src/acpi/syntaxcheck/syntaxcheck.c fwts-0.23.23/src/acpi/syntaxcheck/syntaxcheck.c --- fwts-0.23.13/src/acpi/syntaxcheck/syntaxcheck.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/syntaxcheck/syntaxcheck.c 2011-08-31 16:09:22.000000000 +0000 @@ -54,7 +54,7 @@ static int syntaxcheck_init(fwts_framework *fw) { (void)syntaxcheck_load_advice(fw); - + return FWTS_OK; } @@ -107,10 +107,11 @@ if (i >= error_line + (howmany / 2)) break; if (i > error_line - (howmany / 2)) { - fwts_log_info_verbatum(fw, "%5.5d| %s\n", i, fwts_text_list_text(item)); + fwts_log_info_verbatum(fw, "%5.5d| %s\n", i, + fwts_text_list_text(item)); if (i == error_line) { fwts_log_info_verbatum(fw, " | %*.*s", carat_offset, carat_offset, "^"); - fwts_log_info_verbatum(fw, " | %s %d: %s\n", + fwts_log_info_verbatum(fw, " | %s %d: %s\n", syntaxcheck_error_level(error_code), error_code, error_message); } } @@ -180,7 +181,7 @@ fail_put: json_object_put(syntaxcheck_objs); - + return ret; } @@ -256,18 +257,19 @@ int num; char ch; char *line = fwts_text_list_text(item); - + if ((sscanf(line, "%*s %d%c", &num, &ch) == 2) && ch == ':') { if (item->next != NULL) { char *error_text = fwts_text_list_text(item->next); int iasl_error = (strstr(error_text, "Error") != NULL); int iasl_warning = (strstr(error_text, "Warning") != NULL); int error_code; - + sscanf(error_text, "%*s %d", &error_code); - + /* Valid error or warning, go and report */ if (iasl_error || iasl_warning) { + char label[64]; char *colon = strstr(line, ":"); char *carat = strstr(error_text, "^"); char *ptr; @@ -279,7 +281,7 @@ /* Strip out the ^ from the error message */ for (ptr = error_text; *ptr; ptr++) - if (*ptr == '^') + if (*ptr == '^') *ptr = ' '; /* Look for error message after: "Error: 4042 - " prefix */ @@ -293,8 +295,10 @@ while (*ptr == ' ') ptr++; - syntaxcheck_dump_code(fw, error_code, - carat_offset - colon_offset, ptr, + snprintf(label, sizeof(label), "AMLAssemblerError%d", error_code); + fwts_failed(fw, LOG_LEVEL_HIGH, label, "Assembler error in line %d", num); + syntaxcheck_dump_code(fw, error_code, + carat_offset - colon_offset, ptr, iasl_disassembly, num, 8); syntaxcheck_give_advice(fw, error_code); } @@ -315,11 +319,9 @@ fwts_text_list_free(iasl_errors); if (errors > 0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "AMLReassemblyErrors", - "Table %s (%d) reassembly: Found %d errors, %d warnings.", tablename, which, errors, warnings); + fwts_log_info(fw, "Table %s (%d) reassembly: Found %d errors, %d warnings.", tablename, which, errors, warnings); } else if (warnings > 0) { - fwts_failed(fw, LOG_LEVEL_LOW, "AMLReassembleWarnings", - "Table %s (%d) reassembly: Found 0 errors, %d warnings.", tablename, which, warnings); + fwts_log_info(fw, "Table %s (%d) reassembly: Found 0 errors, %d warnings.", tablename, which, warnings); } else fwts_passed(fw, "%s (%d) reassembly, Found 0 errors, 0 warnings.", tablename, which); diff -Naur fwts-0.23.13/src/acpi/wakealarm/wakealarm.c fwts-0.23.23/src/acpi/wakealarm/wakealarm.c --- fwts-0.23.13/src/acpi/wakealarm/wakealarm.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/wakealarm/wakealarm.c 2011-08-31 16:09:22.000000000 +0000 @@ -36,7 +36,8 @@ if (stat(wkalarm, &buf) == 0) fwts_passed(fw, WAKEALARM " found."); else - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoWakeAlarmTest1", "Could not find " WAKEALARM "."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoWakeAlarmTest1", + "Could not find " WAKEALARM "."); return FWTS_OK; } @@ -45,7 +46,8 @@ { fwts_log_info(fw, "Trigger wakealarm for 1 seconds in the future."); if (fwts_wakealarm_trigger(fw, 1)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "WakeAlarmNotTriggeredTest2", "RTC wakealarm did not trigger."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "WakeAlarmNotTriggeredTest2", + "RTC wakealarm did not trigger."); fwts_tag_failed(fw, FWTS_TAG_BIOS); return FWTS_OK; } @@ -61,17 +63,19 @@ ret = fwts_wakealarm_test_firing(fw, 2); if (ret < 0) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "WakeAlarmNotTriggeredTest3", "Failed to trigger and fire wakealarm."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "WakeAlarmNotTriggeredTest3", + "Failed to trigger and fire wakealarm."); fwts_tag_failed(fw, FWTS_TAG_BIOS); return FWTS_ERROR; /* Really went wrong */ } if (ret == 0) fwts_passed(fw, "RTC wakealarm triggered and fired successfully."); else { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "WakeAlarmNotFiredTest3", "RTC wakealarm was triggered but did not fire."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, "WakeAlarmNotFiredTest3", + "RTC wakealarm was triggered but did not fire."); fwts_tag_failed(fw, FWTS_TAG_BIOS); } - + return FWTS_OK; } @@ -84,12 +88,16 @@ fwts_log_info(fw, "Trigger wakealarm for %d seconds in the future.", i); int ret = fwts_wakealarm_test_firing(fw, i); if (ret < 0) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "WakeAlarmNotTriggeredTest4", "Failed to trigger and fire wakealarm."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "WakeAlarmNotTriggeredTest4", + "Failed to trigger and fire wakealarm."); fwts_tag_failed(fw, FWTS_TAG_BIOS); return FWTS_ERROR; /* Really went wrong */ } if (ret != 0) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "WakeAlarmNotFiredTest4", "RTC wakealarm was triggered but did not fire."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "WakeAlarmNotFiredTest4", + "RTC wakealarm was triggered but did not fire."); fwts_tag_failed(fw, FWTS_TAG_BIOS); failed++; } diff -Naur fwts-0.23.13/src/acpi/wmi/wmi.c fwts-0.23.23/src/acpi/wmi/wmi.c --- fwts-0.23.13/src/acpi/wmi/wmi.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpi/wmi/wmi.c 2011-08-31 16:09:22.000000000 +0000 @@ -47,7 +47,7 @@ typedef struct { uint8_t guid[16]; /* GUID */ union { - uint8_t obj_id[2]; /* Object Identifier */ + uint8_t obj_id[2]; /* Object Identifier */ struct { uint8_t notify_id; /* Notify Identifier */ uint8_t reserved; /* Reserved? */ @@ -80,7 +80,7 @@ static fwts_wmi_known_guid *wmi_find_guid(char *guid) { fwts_wmi_known_guid *info = fwts_wmi_known_guids; - + for (info = fwts_wmi_known_guids; info->guid != NULL; info++) if (strcmp(info->guid, guid) == 0) return info; @@ -93,7 +93,7 @@ str++; \ if (*str == '\0') return; \ -char *wmi_wdg_flags_to_text(const fwts_wmi_flags flags) +static char *wmi_wdg_flags_to_text(const fwts_wmi_flags flags) { static char buffer[256]; @@ -107,7 +107,7 @@ strcat(buffer, "WMI_STRING"); if (flags & FWTS_WMI_EVENT) strcat(buffer, "WMI_EVENT "); - + return buffer; } @@ -131,7 +131,6 @@ guid[8], guid[9], guid[10], guid[11], guid[12], guid[13], guid[14], guid[15]); - known = wmi_find_guid(guidstr); if (info->flags & FWTS_WMI_METHOD) { @@ -139,12 +138,14 @@ } else if (info->flags & FWTS_WMI_EVENT) { fwts_log_info(fw, "Found WMI Event, Notifier ID: 0x%2.2x, GUID: %s, Instance 0x%2.2x", info->notify_id, guidstr, info->instance); if (known == NULL) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "WMIUnknownGUID", "GUID %s is unknown to the kernel, a driver may need to be implemented for this GUID.", guidstr); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "WMIUnknownGUID", + "GUID %s is unknown to the kernel, a driver may need to be implemented for this GUID.", guidstr); *result = true; if (!advice_given) { advice_given = 1; fwts_log_nl(fw); - fwts_log_advice(fw, + fwts_log_advice(fw, "ADVICE: A WMI driver probably needs to be written for this event."); fwts_log_advice(fw, "It can checked for using: wmi_has_guid(\"%s\").", guidstr); @@ -162,7 +163,9 @@ } if (known) { - fwts_passed(fw, "GUID %s is handled by driver %s (Vendor: %s).", guidstr, known->driver, known->vendor); + fwts_passed(fw, + "GUID %s is handled by driver %s (Vendor: %s).", + guidstr, known->driver, known->vendor); *result = true; } @@ -190,7 +193,7 @@ continue; } CONSUME_WHITESPACE(str); - + for (i=0;i<8;i++) { if (strncmp(str, "0x", 2)) break; @@ -202,7 +205,9 @@ str++; data++; if (data > wdg_data + size) { - fwts_failed(fw, LOG_LEVEL_HIGH, "WMI_WDGBufferBad", "_WDG buffer was more than %d bytes long!", size); + fwts_failed(fw, LOG_LEVEL_HIGH, + "WMI_WDGBufferBad", + "_WDG buffer was more than %d bytes long!", size); fwts_tag_failed(fw, FWTS_TAG_ACPI_BAD_LENGTH); return; } @@ -255,7 +260,7 @@ CONSUME_WHITESPACE(str); size = strtoul(str, NULL, 16); - + item = item->next; if (item == NULL) return; @@ -270,7 +275,7 @@ (*count)++ ; wmi_get_wdg_data(fw, item, size, wdg_data); wmi_parse_wdg_data(fw, size, wdg_data, result); - free(wdg_data); + free(wdg_data); } } @@ -281,7 +286,7 @@ int count = 0; int ret; - ret = fwts_iasl_disassemble(fw, table, which, &iasl_output); + ret = fwts_iasl_disassemble(fw, table, which, &iasl_output); if (ret == FWTS_NO_TABLE) /* Nothing more to do */ return ret; if (ret != FWTS_OK) { diff -Naur fwts-0.23.13/src/acpica/fwts_acpica.c fwts-0.23.23/src/acpica/fwts_acpica.c --- fwts-0.23.13/src/acpica/fwts_acpica.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/acpica/fwts_acpica.c 2011-08-31 16:09:22.000000000 +0000 @@ -73,7 +73,7 @@ static ACPI_TABLE_RSDT *fwts_acpica_RSDT; static ACPI_TABLE_RSDP *fwts_acpica_RSDP; static ACPI_TABLE_FADT *fwts_acpica_FADT; -static void * *fwts_acpica_DSDT; +static void *fwts_acpica_DSDT; static fwts_framework *fwts_acpica_fw; /* acpica context copy of fw */ static int fwts_acpica_force_sem_timeout; /* > 0, forces a semaphore timeout */ @@ -480,23 +480,32 @@ if (fwts_acpi_find_table(fw, "DSDT", 0, &tbl) != FWTS_OK) return FWTS_ERROR; if (tbl) { - fwts_acpica_DSDT = tbl->data; + fwts_acpica_DSDT = (void *)tbl->data; fwts_acpica_FADT->Dsdt = ACPI_PTR_TO_PHYSADDR(tbl->data); if (table->length >= 148) fwts_acpica_FADT->XDsdt = ACPI_PTR_TO_PHYSADDR(tbl->data); + } else { + fwts_acpica_DSDT = NULL; + fwts_acpica_FADT->Dsdt = 0; + fwts_acpica_FADT->XDsdt = 0; } if (fwts_acpi_find_table(fw, "FACS", 0, &tbl) != FWTS_OK) return FWTS_ERROR; if (tbl) { + fwts_acpica_FADT->Facs = ACPI_PTR_TO_PHYSADDR(tbl->data); if (table->length >= 140) fwts_acpica_FADT->XFacs = ACPI_PTR_TO_PHYSADDR(tbl->data); - fwts_acpica_FADT->Facs = ACPI_PTR_TO_PHYSADDR(tbl->data); + } else { + fwts_acpica_FADT->Facs = 0; + fwts_acpica_FADT->XFacs = 0; } fwts_acpica_FADT->Header.Checksum = 0; fwts_acpica_FADT->Header.Checksum = (UINT8)-AcpiTbChecksum ((void*)fwts_acpica_FADT, table->length); + } else { + fwts_acpica_FADT = NULL; } /* Clone XSDT, make it point to tables in user address space */ @@ -526,6 +535,8 @@ } fwts_acpica_XSDT->Header.Checksum = 0; fwts_acpica_XSDT->Header.Checksum = (UINT8)-AcpiTbChecksum ((void*)fwts_acpica_XSDT, table->length); + } else { + fwts_acpica_XSDT = NULL; } /* Clone RSDT, make it point to tables in user address space */ @@ -556,6 +567,8 @@ } fwts_acpica_RSDT->Header.Checksum = 0; fwts_acpica_RSDT->Header.Checksum = (UINT8)-AcpiTbChecksum ((void*)fwts_acpica_RSDT, table->length); + } else { + fwts_acpica_RSDT = NULL; } /* Clone RSDP, make it point to tables in user address space */ @@ -569,6 +582,8 @@ fwts_acpica_RSDP->XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR(fwts_acpica_XSDT); fwts_acpica_RSDP->RsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR(fwts_acpica_RSDT); fwts_acpica_RSDP->Checksum = (UINT8)-AcpiTbChecksum ((void*)fwts_acpica_RSDP, ACPI_RSDP_CHECKSUM_LENGTH); + } else { + fwts_acpica_RSDP = NULL; } if (AcpiInitializeTables(Tables, ACPI_MAX_INIT_TABLES, TRUE) != AE_OK) { diff -Naur fwts-0.23.13/src/apic/apicedge/apicedge.c fwts-0.23.23/src/apic/apicedge/apicedge.c --- fwts-0.23.13/src/apic/apicedge/apicedge.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/apic/apicedge/apicedge.c 2011-08-31 16:09:22.000000000 +0000 @@ -39,11 +39,13 @@ */ static int apicedge_test1(fwts_framework *fw) -{ +{ FILE *file; if ((file = fopen("/proc/interrupts", "r")) == NULL) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoProcInterrupts", "Could not open file /proc/interrupts."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "NoProcInterrupts", + "Could not open file /proc/interrupts."); return FWTS_ERROR; } @@ -55,12 +57,12 @@ memset(line, 0, 4096); if (fgets(line, 4095, file) == NULL) break; - + if (! (line[0]==' ' || (line[0]>='0' && line[0]<='9')) ) continue; irq = strtoul(line, &c, 10); - if (c==line) + if (c == line) continue; if (strstr(line, "IO-APIC-edge")) edge = 1; @@ -72,24 +74,26 @@ edge = 1; if (strstr(line, "IO-APIC-level")) edge = 0; - + if (strstr(line,"acpi")) { - if (edge==1) { + if (edge == 1) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "ACPIIRQEdgeTrig", "ACPI Interrupt is incorrectly edge triggered."); fwts_tag_failed(fw, FWTS_TAG_BIOS_IRQ); } - continue; + continue; } - if ((irq<15) && (edge == 0)) { + if ((irq < 15) && (edge == 0)) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "LegacyIRQLevelTrig", "Legacy interrupt %i is incorrectly level triggered.", irq); fwts_tag_failed(fw, FWTS_TAG_BIOS_IRQ); } - if ((irq<15) && (edge == -1)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NonLegacyIRQLevelTrig", "Non-Legacy interrupt %i is incorrectly level triggered.", irq); + if ((irq < 15) && (edge == -1)) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "NonLegacyIRQLevelTrig", + "Non-Legacy interrupt %i is incorrectly level triggered.", irq); fwts_tag_failed(fw, FWTS_TAG_BIOS_IRQ); } } - fclose(file); + fclose(file); if (fwts_tests_passed(fw)) fwts_passed(fw, "Legacy interrupts are edge and PCI interrupts are level triggered."); diff -Naur fwts-0.23.13/src/bios/bios32/bios32.c fwts-0.23.23/src/bios/bios32/bios32.c --- fwts-0.23.13/src/bios/bios32/bios32.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/bios/bios32/bios32.c 2011-08-31 16:09:22.000000000 +0000 @@ -49,12 +49,14 @@ int i; int found = 0; - fwts_log_info(fw, "This test tries to find and sanity check the BIOS32 Service Directory as " - "defined in the Standard BIOS 32-bit Service Directory Proposal, " - "Revision 0.4 May 24, 1993, Phoenix Technologies Ltd and also the " - "PCI BIOS specification."); + fwts_log_info(fw, + "This test tries to find and sanity check the BIOS32 Service " + "Directory as defined in the Standard BIOS 32-bit Service " + "Directory Proposal, Revision 0.4 May 24, 1993, Phoenix " + "Technologies Ltd and also the PCI BIOS specification."); - if ((mem = fwts_mmap(BIOS32_SD_REGION_START, BIOS32_SD_REGION_SIZE)) == FWTS_MAP_FAILED) { + if ((mem = fwts_mmap(BIOS32_SD_REGION_START, + BIOS32_SD_REGION_SIZE)) == FWTS_MAP_FAILED) { fwts_log_error(fw, "Cannot mmap BIOS32 region."); return FWTS_ERROR; } @@ -74,15 +76,21 @@ bios32 = (fwts_bios32_service_directory*)(mem+i); fwts_log_info(fw, "Found BIOS32 Service Directory at 0x%8.8x", BIOS32_SD_REGION_START+i); - fwts_log_info_verbatum(fw, " Signature : %4.4s", bios32->signature); - fwts_log_info_verbatum(fw, " Entry Point: 0x%8.8x", bios32->entry_point); - fwts_log_info_verbatum(fw, " Revsion : 0x%2.2x", bios32->revision_level); - fwts_log_info_verbatum(fw, " Length : 0x%2.2x", bios32->length); - fwts_log_info_verbatum(fw, " Checksum : 0x%2.2x", bios32->checksum); + fwts_log_info_verbatum(fw, " Signature : %4.4s", + bios32->signature); + fwts_log_info_verbatum(fw, " Entry Point: 0x%8.8x", + bios32->entry_point); + fwts_log_info_verbatum(fw, " Revsion : 0x%2.2x", + bios32->revision_level); + fwts_log_info_verbatum(fw, " Length : 0x%2.2x", + bios32->length); + fwts_log_info_verbatum(fw, " Checksum : 0x%2.2x", + bios32->checksum); fwts_log_nl(fw); if (bios32->entry_point >= 0x100000) { - fwts_failed(fw, LOG_LEVEL_HIGH, "BIOS32SrvDirEntryPointHighMem", + fwts_failed(fw, LOG_LEVEL_HIGH, + "BIOS32SrvDirEntryPointHighMem", "Service Directory Entry Point 0x%8.8x is in high memory and cannot be used by the kernel.", bios32->entry_point); fwts_tag_failed(fw, FWTS_TAG_BIOS); @@ -91,7 +99,8 @@ bios32->entry_point); if (bios32->length != 1) { - fwts_failed(fw, LOG_LEVEL_HIGH, "BIOS32SrvDirEntryLength", + fwts_failed(fw, LOG_LEVEL_HIGH, + "BIOS32SrvDirEntryLength", "Service Directory Length is 0x%8.8x, expected 1 (1 x 16 bytes).", bios32->length); fwts_tag_failed(fw, FWTS_TAG_BIOS); @@ -99,7 +108,8 @@ fwts_passed(fw, "Service Directory Length is 1 (1 x 16 bytes) as expected."); if (bios32->revision_level != 0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "BIOS32SrvDirRevision", + fwts_failed(fw, LOG_LEVEL_HIGH, + "BIOS32SrvDirRevision", "Service Directory Revision is 0x%2.2x, only version 0 is supported by the kernel.", bios32->revision_level); fwts_tag_failed(fw, FWTS_TAG_BIOS); @@ -108,11 +118,12 @@ bios32->revision_level); if (checksum != 0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "BIOS32SrvDirCheckSum", "Service Directory checksum failed."); + fwts_failed(fw, LOG_LEVEL_HIGH, + "BIOS32SrvDirCheckSum", + "Service Directory checksum failed."); fwts_tag_failed(fw, FWTS_TAG_BIOS); } else fwts_passed(fw, "Service Directory checksum passed."); - found++; } } @@ -120,8 +131,10 @@ if (found == 0) fwts_log_info(fw, "Could not find BIOS32 Service Directory."); else if (found > 1) { - fwts_failed(fw, LOG_LEVEL_HIGH, "BIOS32MultipleSrvDirInstances", - "Found %d instances of BIOS32 Service Directory, there should only be 1.", found); + fwts_failed(fw, LOG_LEVEL_HIGH, + "BIOS32MultipleSrvDirInstances", + "Found %d instances of BIOS32 Service Directory, there should only be 1.", + found); fwts_tag_failed(fw, FWTS_TAG_BIOS); } diff -Naur fwts-0.23.13/src/bios/bios_info/bios_info.c fwts-0.23.23/src/bios/bios_info/bios_info.c --- fwts-0.23.13/src/bios/bios_info/bios_info.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/bios/bios_info/bios_info.c 2011-08-31 16:09:22.000000000 +0000 @@ -59,9 +59,11 @@ for (i=0; bios_info[i].dmi_field != NULL; i++) { char *data; - snprintf(path, sizeof(path), "/sys/class/dmi/id/%s", bios_info[i].dmi_field); + snprintf(path, sizeof(path), "/sys/class/dmi/id/%s", + bios_info[i].dmi_field); if ((data = fwts_get(path)) != NULL) { - fwts_log_info_verbatum(fw, "%-18.18s: %s", bios_info[i].label, data); + fwts_log_info_verbatum(fw, "%-18.18s: %s", + bios_info[i].label, data); free(data); } } diff -Naur fwts-0.23.13/src/bios/ebda_region/ebda_region.c fwts-0.23.23/src/bios/ebda_region/ebda_region.c --- fwts-0.23.13/src/bios/ebda_region/ebda_region.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/bios/ebda_region/ebda_region.c 2011-08-31 16:09:22.000000000 +0000 @@ -70,9 +70,11 @@ if (memory_map == NULL) return FWTS_ERROR; - fwts_log_info(fw, "The Extended BIOS Data Area (EBDA) is normally located at the end of the " - "low 640K region and is typically 2-4K in size. It should be reserved in " - "the %s table.", memory_map_name); + fwts_log_info(fw, + "The Extended BIOS Data Area (EBDA) is normally located at " + "the end of the low 640K region and is typically 2-4K in " + "size. It should be reserved in the %s table.", + memory_map_name); entry = fwts_memory_map_info(memory_map, (uint64_t)ebda_addr); if ((entry != NULL) && @@ -85,7 +87,10 @@ (unsigned long long int)entry->start_address, (unsigned long long int)entry->end_address); } else { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "EBDAMappedNotReserved", "EBDA region mapped at 0x%lx but not reserved in the %s table.", ebda_addr, memory_map_name); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "EBDAMappedNotReserved", + "EBDA region mapped at 0x%lx but not reserved in the %s table.", + ebda_addr, memory_map_name); fwts_tag_failed(fw, FWTS_TAG_BIOS); } diff -Naur fwts-0.23.13/src/bios/ebdadump/ebdadump.c fwts-0.23.23/src/bios/ebdadump/ebdadump.c --- fwts-0.23.13/src/bios/ebdadump/ebdadump.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/bios/ebdadump/ebdadump.c 2011-08-31 16:09:22.000000000 +0000 @@ -23,7 +23,8 @@ #define BIOS_ROM_START (0x000a0000) -static void ebdadump_data(fwts_framework *fw, uint8_t *data, int offset, int length) +static void ebdadump_data(fwts_framework *fw, + uint8_t *data, int offset, int length) { char buffer[128]; int i; @@ -48,7 +49,7 @@ len = BIOS_ROM_START - ebda_addr; if (ebda_addr > BIOS_ROM_START) { - fwts_log_error(fw, "EBDA start address is greater than the BIOS ROM start address."); + fwts_log_error(fw, "EBDA start address is greater than the BIOS ROM start address."); return FWTS_ERROR; } @@ -57,9 +58,11 @@ return FWTS_ERROR; } - fwts_log_info(fw, "EBDA region: %x..%x (%d bytes)", (unsigned int)ebda_addr, - BIOS_ROM_START, (unsigned int)len); - + fwts_log_info(fw, "EBDA region: %x..%x (%d bytes)", + (unsigned int)ebda_addr, + BIOS_ROM_START, + (unsigned int)len); + ebdadump_data(fw, mem, ebda_addr, len); (void)fwts_munmap(mem, len); diff -Naur fwts-0.23.13/src/bios/hdaaudio/hdaaudio.c fwts-0.23.23/src/bios/hdaaudio/hdaaudio.c --- fwts-0.23.13/src/bios/hdaaudio/hdaaudio.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/bios/hdaaudio/hdaaudio.c 2011-08-31 16:09:22.000000000 +0000 @@ -26,7 +26,8 @@ uint32_t setting; } hda_audio_pin_setting; -static int hda_audio_read_pins(fwts_framework *fw, const char *path, const char *file, fwts_list *settings) +static int hda_audio_read_pins(fwts_framework *fw, const char *path, + const char *file, fwts_list *settings) { FILE *fp; uint16_t pin; @@ -52,11 +53,12 @@ fwts_list_append(settings, pin_setting); } fclose(fp); - + return FWTS_OK; } -static void hda_audio_dump_pins(fwts_framework *fw, const char *config, fwts_list *settings) +static void hda_audio_dump_pins(fwts_framework *fw, const char *config, + fwts_list *settings) { fwts_list_link *item; @@ -65,15 +67,17 @@ fwts_log_info_verbatum(fw, " Pin Setting"); fwts_list_foreach(item, settings) { - hda_audio_pin_setting *pin_setting = fwts_list_data(hda_audio_pin_setting *, item); - + hda_audio_pin_setting *pin_setting = + fwts_list_data(hda_audio_pin_setting *, item); + fwts_log_info_verbatum(fw, " 0x%4.4hx 0x%8.8x", pin_setting->pin, pin_setting->setting); } } else fwts_log_info(fw, "%s: None Defined.", config); } -static void hda_audio_dev_info(fwts_framework *fw, const char *label, const char *path, const char *file) +static void hda_audio_dev_info(fwts_framework *fw, const char *label, + const char *path, const char *file) { char *info; char fullpath[PATH_MAX]; @@ -102,20 +106,26 @@ hda_audio_dev_info(fw, "Subsystem ID", path, "subsystem_id"); hda_audio_dev_info(fw, "Revision ID", path, "revision_id"); - (void)hda_audio_read_pins(fw, path, "init_pin_configs", &init_pin_configs); - (void)hda_audio_read_pins(fw, path, "driver_pin_configs", &driver_pin_configs); - (void)hda_audio_read_pins(fw, path, "user_pin_configs", &user_pin_configs); + (void)hda_audio_read_pins(fw, path, "init_pin_configs", + &init_pin_configs); + (void)hda_audio_read_pins(fw, path, "driver_pin_configs", + &driver_pin_configs); + (void)hda_audio_read_pins(fw, path, "user_pin_configs", + &user_pin_configs); if (fwts_list_len(&init_pin_configs) > 0) - hda_audio_dump_pins(fw, "BIOS pin configurations", &init_pin_configs); + hda_audio_dump_pins(fw, "BIOS pin configurations", + &init_pin_configs); if (fwts_list_len(&driver_pin_configs) > 0) { - hda_audio_dump_pins(fw, "Driver defined pin configurations", &driver_pin_configs); + hda_audio_dump_pins(fw, "Driver defined pin configurations", + &driver_pin_configs); warn++; } - + if (fwts_list_len(&user_pin_configs) > 0) { - hda_audio_dump_pins(fw, "User defined pin configurations", &driver_pin_configs); + hda_audio_dump_pins(fw, "User defined pin configurations", + &driver_pin_configs); warn++; } @@ -143,7 +153,8 @@ while ((directory = readdir(dir)) != NULL) if (strncmp(directory->d_name, "hw", 2) == 0) { char path[PATH_MAX]; - snprintf(path, sizeof(path), "/sys/class/sound/%s", directory->d_name); + snprintf(path, sizeof(path), "/sys/class/sound/%s", + directory->d_name); fwts_log_info(fw, "Checking '%s':", directory->d_name); hda_audio_check_pins(fw, path); fwts_log_nl(fw); diff -Naur fwts-0.23.13/src/bios/memmapdump/memmapdump.c fwts-0.23.23/src/bios/memmapdump/memmapdump.c --- fwts-0.23.13/src/bios/memmapdump/memmapdump.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/bios/memmapdump/memmapdump.c 2011-08-31 16:09:22.000000000 +0000 @@ -25,7 +25,8 @@ { fwts_list *memory_mapdump_memory_map_info; - if ((memory_mapdump_memory_map_info = fwts_memory_map_table_load(fw)) == NULL) { + if ((memory_mapdump_memory_map_info = + fwts_memory_map_table_load(fw)) == NULL) { fwts_log_warning(fw, "Cannot memory map table from /sys/firmware/memmap or kernel log."); return FWTS_ERROR; } diff -Naur fwts-0.23.13/src/bios/mtrr/mtrr.c fwts-0.23.23/src/bios/mtrr/mtrr.c --- fwts-0.23.13/src/bios/mtrr/mtrr.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/bios/mtrr/mtrr.c 2011-08-31 16:09:22.000000000 +0000 @@ -37,9 +37,7 @@ static fwts_list *klog; static fwts_list *mtrr_list; -static fwts_cpuinfo_x86 *fwts_virt_cpuinfo; - - +static fwts_cpuinfo_x86 *fwts_cpuinfo; #define UNCACHED 0x0001 #define WRITE_BACK 0x0002 @@ -58,8 +56,6 @@ uint8_t type; }; -char *mtrr_resource = NULL; - static char *cache_to_string(int type) { static char str[1024]; @@ -88,7 +84,7 @@ struct mtrr_entry *entry; int fd; char line[4096]; - + memset(line, 0, 4096); if ((mtrr_list = fwts_list_new()) == NULL) @@ -133,7 +129,7 @@ entry->type = DISABLED; } - fwts_list_append(mtrr_list, entry); + fwts_list_append(mtrr_list, entry); } } close(fd); @@ -146,7 +142,7 @@ fwts_list_link *item; struct mtrr_entry *entry; int type = 0; - + fwts_list_foreach(item, mtrr_list) { entry = fwts_list_data(struct mtrr_entry*, item); @@ -154,21 +150,23 @@ type |= entry->type; } - /* now to see if there is any part of the range that isn't covered by an mtrr, - since it's UNCACHED if so */ + /* + * now to see if there is any part of the range that isn't + * covered by an mtrr, since it's UNCACHED if so + */ restart: fwts_list_foreach(item, mtrr_list) { entry = fwts_list_data(struct mtrr_entry*, item); if (entry->end >= end && entry->start < end) { end = entry->start; - if (endtype = 0; - uint64_t mask = strtoull(str+5, NULL, 16); + uint64_t mask = + strtoull(str+5, NULL, 16); uint64_t pat = 0x8000000000000000ULL; while ((mask & pat) == 0) { mask |= pat; @@ -218,7 +217,7 @@ mtrr->start = start; mtrr->end = start + ~mask; - + fwts_list_append(mtrr_bios_list, mtrr); } } @@ -243,7 +242,7 @@ if ((mtrr_bios_list = get_klog_bios_mtrr()) == NULL) return FWTS_ERROR; - + snprintf(line, sizeof(line), "%s -v", fw->lspci); fwts_pipe_exec(line, &lspci_output); if (lspci_output == NULL) @@ -298,10 +297,13 @@ if (!found) { fwts_failed(fw, LOG_LEVEL_LOW, "MTRRVGA", "Did not find a BIOS configured MTRR for VGA memory region. "); - fwts_advice(fw, "The VGA memory region does not have a MTRR configured by the BIOS. " - "This means that bootloaders rendering to a framebuffer will be rendering slowly " - "and this will slow the boot speed. " - "It is probably worth asking the BIOS vendor to map in the VGA write-combining region.\n"); + fwts_advice(fw, + "The VGA memory region does not have a MTRR configured " + "by the BIOS. This means that bootloaders rendering to " + "a framebuffer will be rendering slowly and this will " + "slow the boot speed. It is probably worth asking the " + "BIOS vendor to map in the VGA write-combining " + "region."); } fwts_list_free(mtrr_bios_list, free); fwts_list_free(lspci_output, free); @@ -318,7 +320,7 @@ fwts_list_link *item; memset(line,0,4096); - + snprintf(line, sizeof(line), "%s -v -s %s", fw->lspci, device); fwts_pipe_exec(line, &lspci_output); if (lspci_output == NULL) @@ -386,13 +388,16 @@ fwts_chop_newline(buffer); - /* for pci bridges, we note the increased depth and otherwise skip the entry */ + /* + * For pci bridges, we note the increased depth and + * otherwise skip the entry + */ if (strstr(buffer, ": PCI Bus #")) { pcidepth++; continue; } - /* then: check the pci depth */ + /* then: check the pci depth */ for (i=0; i skip */ if (*c==' ') continue; - + start = strtoull(c, NULL, 16); c2 = strchr(c, '-'); if (!c2) continue; c2++; end = strtoull(c2, NULL, 16); - c2 = strstr(c, " : "); if (!c2) @@ -420,18 +424,19 @@ /* exception: 640K - 1Mb range we ignore */ if (start >= 640*1024 && end <= 1024*1024) continue; - + type = cache_types(start, end); guess_cache_type(fw, c2, &type_must, &type_mustnot, start); if ((type & type_mustnot)!=0) { failed++; - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MTRRIncorrectAttr", - "Memory range 0x%llx to 0x%llx (%s) has incorrect attribute%s.", - (unsigned long long int)start, - (unsigned long long int)end, - c2, cache_to_string(type & type_mustnot)); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MTRRIncorrectAttr", + "Memory range 0x%llx to 0x%llx (%s) has incorrect attribute%s.", + (unsigned long long int)start, + (unsigned long long int)end, + c2, cache_to_string(type & type_mustnot)); fwts_tag_failed(fw, FWTS_TAG_BIOS); if (type_must == UNCACHED) skiperror = 1; @@ -443,14 +448,16 @@ } if ((type & type_must)!=type_must && skiperror==0) { failed++; - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MTRRLackingAttr", - "Memory range 0x%llx to 0x%llx (%s) is lacking attribute%s.", - (unsigned long long int)start, - (unsigned long long int)end, - c2, cache_to_string( (type & type_must) ^ type_must)); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MTRRLackingAttr", + "Memory range 0x%llx to 0x%llx (%s) is lacking attribute%s.", + (unsigned long long int)start, + (unsigned long long int)end, + c2, + cache_to_string( (type & type_must) ^ type_must)); fwts_tag_failed(fw, FWTS_TAG_BIOS); } - + } fclose(file); @@ -473,7 +480,9 @@ if (entry->type & DISABLED) fwts_log_info_verbatum(fw, "Reg %hhu: disabled\n", entry->reg); else - fwts_log_info_verbatum(fw, "Reg %hhu: 0x%08llx - 0x%08llx (%6lld %cB) %s \n", entry->reg, + fwts_log_info_verbatum(fw, + "Reg %hhu: 0x%08llx - 0x%08llx (%6lld %cB) %s \n", + entry->reg, (unsigned long long int)entry->start, (unsigned long long int)entry->end, (unsigned long long int)(entry->size >= (1024*1024) ? entry->size / (1024*1024) : (entry->size / 1024)), @@ -498,7 +507,7 @@ return FWTS_ERROR; } - if ((fwts_virt_cpuinfo = fwts_cpu_get_info(0)) == NULL) { + if ((fwts_cpuinfo = fwts_cpu_get_info(0)) == NULL) { fwts_log_error(fw, "Cannot get CPU info"); return FWTS_ERROR; } @@ -512,8 +521,8 @@ { fwts_klog_free(klog); fwts_list_free(mtrr_list, free); - if (fwts_virt_cpuinfo) - fwts_cpu_free_info(fwts_virt_cpuinfo); + if (fwts_cpuinfo) + fwts_cpu_free_info(fwts_cpuinfo); return FWTS_OK; } @@ -545,29 +554,32 @@ } if (failed) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MTRRCPUsMisconfigured", - "It is probable that the BIOS does not set up all the CPUs correctly and " - "the kernel has now corrected this misconfiguration."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MTRRCPUsMisconfigured", + "It is probable that the BIOS does not set up " + "all the CPUs correctly and the kernel has now " + "corrected this misconfiguration."); else fwts_passed(fw, "All processors have the a consistent MTRR setup."); } else fwts_log_error(fw, "No boot dmesg found."); - + return FWTS_OK; } static int mtrr_test3(fwts_framework *fw) { - if (strstr(fwts_virt_cpuinfo->vendor_id, "AMD")) { + if (strstr(fwts_cpuinfo->vendor_id, "AMD")) { if (klog != NULL) { if (fwts_klog_regex_find(fw, klog, "SYSCFG[MtrrFixDramModEn] not cleared by BIOS, clearing this bit") > 0) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MTRRFixDramModEnBit", - "The BIOS is expected to clear MtrrFixDramModEn bit, see for example " - "\"BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD " - "Opteron Processors\" (26094 Rev. 3.30 February 2006), section " - "\"13.2.1.2 SYSCFG Register\": \"The MtrrFixDramModEn bit should be set " - "to 1 during BIOS initalization of the fixed MTRRs, then cleared to " - "0 for operation.\""); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MTRRFixDramModEnBit", + "The BIOS is expected to clear MtrrFixDramModEn bit, see for example " + "\"BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD " + "Opteron Processors\" (26094 Rev. 3.30 February 2006), section " + "\"13.2.1.2 SYSCFG Register\": \"The MtrrFixDramModEn bit should be set " + "to 1 during BIOS initalization of the fixed MTRRs, then cleared to " + "0 for operation.\""); fwts_tag_failed(fw, FWTS_TAG_BIOS); } else { diff -Naur fwts-0.23.13/src/bios/multiproc/mpcheck.c fwts-0.23.23/src/bios/multiproc/mpcheck.c --- fwts-0.23.13/src/bios/multiproc/mpcheck.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/bios/multiproc/mpcheck.c 2011-08-31 16:09:22.000000000 +0000 @@ -22,8 +22,6 @@ static fwts_mp_data mp_data; -static uint8_t last_cpu_apic_id = 0; - static bool mpcheck_find_bus(uint8_t id, int depth) { fwts_list_link *entry; @@ -31,7 +29,7 @@ if (depth > 16) return false; /* too deep? */ - fwts_list_foreach(entry, &mp_data.entries) { + fwts_list_foreach(entry, &mp_data.entries) { uint8_t *data = fwts_list_data(uint8_t *, entry); if (*data == FWTS_MP_BUS_ENTRY) { fwts_mp_bus_entry *bus_entry = @@ -40,7 +38,7 @@ return true; } if (*data == FWTS_MP_BUS_HIERARCHY_ENTRY) { - fwts_mp_bus_hierarchy_entry *bus_hierarchy_entry = + fwts_mp_bus_hierarchy_entry *bus_hierarchy_entry = fwts_list_data(fwts_mp_bus_hierarchy_entry *, entry); if (id == bus_hierarchy_entry->bus_id) return mpcheck_find_bus(bus_hierarchy_entry->parent_bus, depth+1); @@ -54,52 +52,67 @@ { bool failed = false; int n = 0; - fwts_list_link *entry; + fwts_list_link *entry1; int bootstrap_cpu = -1; bool usable_cpu_found = false; - int first_io_apic_id = -1; - - fwts_list_foreach(entry, &mp_data.entries) { - uint8_t *data = fwts_list_data(uint8_t *, entry); - if (*data == FWTS_MP_CPU_ENTRY) { - uint32_t phys_addr = mp_data.phys_addr + ((void *)data - (void *)mp_data.header); - fwts_mp_processor_entry *cpu_entry = - fwts_list_data(fwts_mp_processor_entry *, entry); - if (last_cpu_apic_id < cpu_entry->local_apic_id) - last_cpu_apic_id = cpu_entry->local_apic_id; - - if (first_io_apic_id == -1) { - first_io_apic_id = cpu_entry->local_apic_id; - if (first_io_apic_id != 0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPCPUEntryLAPICId", - "CPU Entry %d (@0x%8.8x) has a Local APIC ID 0x%2.2x and should be 0x00.", n, phys_addr, first_io_apic_id); - failed = true; - } - } else { - if (cpu_entry->local_apic_id != (first_io_apic_id + n)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPCPUEntryLAPICId", - "CPU Entry %d (@0x%8.8x) has a Local APIC ID 0x%2.2x and should be 0x%2.2x.", n, phys_addr, cpu_entry->local_apic_id, first_io_apic_id + n); - failed = true; + fwts_list_foreach(entry1, &mp_data.entries) { + uint8_t *data1 = fwts_list_data(uint8_t *, entry1); + if (*data1 == FWTS_MP_CPU_ENTRY) { + fwts_list_link *entry2; + int m = 0; + + uint32_t phys_addr1 = mp_data.phys_addr + + ((void *)data1 - (void *)mp_data.header); + fwts_mp_processor_entry *cpu_entry1 = + fwts_list_data(fwts_mp_processor_entry *, entry1); + + /* Check Local APIC ID is unique */ + fwts_list_foreach(entry2, &mp_data.entries) { + uint8_t *data2 = fwts_list_data(uint8_t *, entry2); + uint32_t phys_addr2 = mp_data.phys_addr + + ((void *)data2 - (void *)mp_data.header); + + if (*data2 == FWTS_MP_CPU_ENTRY) { + if ((n < m) && (entry2 != entry1)) { + fwts_mp_processor_entry *cpu_entry2 = + fwts_list_data(fwts_mp_processor_entry *, entry2); + + if (cpu_entry1->local_apic_id == cpu_entry2->local_apic_id) { + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPCPUEntryLAPICId", + "CPU Entry %d (@0x%8.8x) and %d (@0x%8.8x) have the same Local APIC ID 0x%2.2x.", + n, phys_addr1, m, phys_addr2, cpu_entry1->local_apic_id); + failed = true; + break; + } + } + m++; } } + /* - if ((cpu_entry->local_apic_version != 0x11) && - (cpu_entry->local_apic_version != 0x14)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPCPUEntryLAPICVersion", - "CPU Entry %d (@0x%8.8x) has an invalid Local APIC Version %2.2x, should be 0x11 or 0x14.", n, phys_addr, cpu_entry->local_apic_version); + if ((cpu_entry1->local_apic_version != 0x11) && + (cpu_entry1->local_apic_version != 0x14)) { + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPCPUEntryLAPICVersion", + "CPU Entry %d (@0x%8.8x) has an invalid Local APIC Version %2.2x, should be 0x11 or 0x14.", + n, phys_addr, + cpu_entry1->local_apic_version); failed = true; } */ - if (cpu_entry->cpu_flags & 1) + if (cpu_entry1->cpu_flags & 1) usable_cpu_found = true; - if ((cpu_entry->cpu_flags >> 1) & 1) { + if ((cpu_entry1->cpu_flags >> 1) & 1) { if (bootstrap_cpu != -1) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPCPUEntryBootCPU", - "CPU Entry %d (@0x%8.8x) is marked as a boot CPU but CPU entry %d is the first boot CPU.", n, phys_addr, bootstrap_cpu); + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPCPUEntryBootCPU", + "CPU Entry %d (@0x%8.8x) is marked as a boot CPU but CPU entry %d is the first boot CPU.", + n, phys_addr1, bootstrap_cpu); failed = true; - } else + } else bootstrap_cpu = n; } n++; @@ -107,8 +120,10 @@ } if (!usable_cpu_found) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPCPUEntryUsable", - "CPU entries 0..%d were not marked as usable. There should be at least one usable CPU.", + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPCPUEntryUsable", + "CPU entries 0..%d were not marked as usable. " + "There should be at least one usable CPU.", n-1); failed = true; } @@ -152,30 +167,39 @@ uint8_t *data = fwts_list_data(uint8_t *, entry); if (*data == FWTS_MP_BUS_ENTRY) { int i; - uint32_t phys_addr = mp_data.phys_addr + ((void *)data - (void *)mp_data.header); + uint32_t phys_addr = mp_data.phys_addr + + ((void *)data - (void *)mp_data.header); fwts_mp_bus_entry *bus_entry = fwts_list_data(fwts_mp_bus_entry *, entry); for (i=0; bus_types[i] != NULL; i++) { - if (strncmp(bus_types[i], (char*)bus_entry->bus_type, strlen(bus_types[i])) == 0) + if (strncmp(bus_types[i], (char*)bus_entry->bus_type, strlen(bus_types[i])) == 0) break; } if (bus_types[i] == NULL) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPBusEntryBusType", + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPBusEntryBusType", "Bus Entry %d (@0x%8.8x) has an unrecognised bus type: %6.6s", n, phys_addr, bus_entry->bus_type); } if (prev_bus_id == -1) { prev_bus_id = bus_entry->bus_id; if (prev_bus_id != 0) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPBusEntryLAPICId", - "Bus Entry %d (@0x%8.8x) has a Local APIC ID 0x%2.2x and should be 0x00.", n, phys_addr, prev_bus_id); + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPBusEntryLAPICId", + "Bus Entry %d (@0x%8.8x) has a Local APIC ID 0x%2.2x and should be 0x00.", + n, phys_addr, + prev_bus_id); failed = true; } } else { if (bus_entry->bus_id < prev_bus_id) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPBusEntryBusId", - "Bus Entry %d (@0x%8.8x) has a Bus ID 0x%2.2x and should be greater than 0x%2.2x.", n, phys_addr, bus_entry->bus_id, prev_bus_id); + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPBusEntryBusId", + "Bus Entry %d (@0x%8.8x) has a Bus ID 0x%2.2x and should be greater than 0x%2.2x.", + n, phys_addr, + bus_entry->bus_id, + prev_bus_id); failed = true; } } @@ -194,7 +218,6 @@ bool enabled = false; int n = 0; fwts_list_link *entry; - int first_io_apic_id = -1; fwts_list_foreach(entry, &mp_data.entries) { uint8_t *data = fwts_list_data(uint8_t *, entry); @@ -204,33 +227,21 @@ if (io_apic_entry->address == 0) { fwts_failed(fw, LOG_LEVEL_HIGH, "MPIOAPICNullAddr", - "IO APIC Entry %d (@0x%8.8x) has an invalid NULL address, should be non-zero.", n, phys_addr); + "IO APIC Entry %d (@0x%8.8x) has an invalid NULL address, should be non-zero.", + n, phys_addr); failed = true; } if (io_apic_entry->flags & 1) { enabled = true; } - if (first_io_apic_id == -1) { - first_io_apic_id = io_apic_entry->id; - if (first_io_apic_id != (last_cpu_apic_id + 1)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPIOAPICId", - "IO APIC Entry %d (@0x%8.8x) has a Local APIC ID 0x%2.2x and should be 0x%2.2x.", n, phys_addr, io_apic_entry->id, last_cpu_apic_id + 1); - failed = true; - } - } else { - if (io_apic_entry->id != (first_io_apic_id + n)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPIOAPICIdSeries", - "IO APIC Entry %d (@0x%8.8x) has a Local APIC ID 0x%2.2x and should be 0x%2.2x than the previous entry.", n, phys_addr, io_apic_entry->id, first_io_apic_id + n); - failed = true; - } - } n++; } } if (!enabled) { fwts_failed(fw, LOG_LEVEL_HIGH, "MPIOAPICEnabled", - "None of the %d IO APIC entries were enabled, at least one must be enabled.", n); + "None of the %d IO APIC entries were enabled, " + "at least one must be enabled.", n); failed = true; } @@ -251,7 +262,7 @@ uint8_t *data = fwts_list_data(uint8_t *, entry); #if 0 if (*data == FWTS_MP_CPU_ENTRY) { - fwts_mp_processor_entry *cpu_entry = + fwts_mp_processor_entry *cpu_entry = fwts_list_data(fwts_mp_processor_entry *, entry); if (id == cpu_entry->local_apic_id) return true; @@ -279,21 +290,28 @@ if (*data == FWTS_MP_IO_INTERRUPT_ENTRY) { fwts_mp_io_interrupt_entry *io_interrupt_entry = fwts_list_data(fwts_mp_io_interrupt_entry *, entry); - + if (io_interrupt_entry->type > 3) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPIOIRQType", - "IO Interrupt Entry %d (@0x%8.8x) has a Type 0x%2.2x and should be 0x00..0x03.", n, phys_addr, io_interrupt_entry->type); + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPIOIRQType", + "IO Interrupt Entry %d (@0x%8.8x) has a Type 0x%2.2x and should be 0x00..0x03.", + n, phys_addr, + io_interrupt_entry->type); failed = true; } if (!mpcheck_find_io_apic(io_interrupt_entry->destination_io_apic_id)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPIOAPICId", - "IO Interrupt Entry %d (@0x%8.8x) has a Destination IO APIC ID 0x%2.2x which has not been defined.", n, phys_addr, io_interrupt_entry->destination_io_apic_id); + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPIOAPICId", + "IO Interrupt Entry %d (@0x%8.8x) has a Destination IO APIC ID 0x%2.2x " + "which has not been defined.", + n, phys_addr, + io_interrupt_entry->destination_io_apic_id); failed = true; } n++; } } - + if (!failed) fwts_passed(fw, "All %d IO Interrupt Entries look sane.", n); @@ -312,23 +330,29 @@ if (*data == FWTS_MP_LOCAL_INTERRUPT_ENTRY) { fwts_mp_local_interrupt_entry *local_interrupt_entry = fwts_list_data(fwts_mp_local_interrupt_entry *, entry); - if (local_interrupt_entry->type > 3) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPLocalIRQType", - "Local Interrupt Entry %d (@0x%8.8x) has a Type 0x%2.2x and should be 0x00..0x03.", n, phys_addr, local_interrupt_entry->type); + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPLocalIRQType", + "Local Interrupt Entry %d (@0x%8.8x) has a Type 0x%2.2x and should be 0x00..0x03.", + n, phys_addr, + local_interrupt_entry->type); failed = true; } #if 0 if (!mpcheck_find_io_apic(local_interrupt_entry->destination_local_apic_id)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "MPLocalIRQDestIRQAPIDId", - "Local Interrupt Entry %d (@0x%8.8x) has a Destination IO APIC ID 0x%2.2x which has not been defined.", n, phys_addr, local_interrupt_entry->destination_local_apic_id); + fwts_failed(fw, LOG_LEVEL_HIGH, + "MPLocalIRQDestIRQAPIDId", + "Local Interrupt Entry %d (@0x%8.8x) has a Destination IO APIC ID 0x%2.2x " + "which has not been defined.", + n, phys_addr, + local_interrupt_entry->destination_local_apic_id); failed = true; } #endif n++; } } - + if (!failed) fwts_passed(fw, "All %d Local Interrupt Entries look sane.", n); @@ -345,28 +369,38 @@ uint8_t *data = fwts_list_data(uint8_t *, entry); if (*data == FWTS_MP_SYS_ADDR_ENTRY) { uint32_t phys_addr = mp_data.phys_addr + ((void *)data - (void *)mp_data.header); - fwts_mp_system_address_space_entry *sys_addr_entry = + fwts_mp_system_address_space_entry *sys_addr_entry = fwts_list_data(fwts_mp_system_address_space_entry *, entry); if (!mpcheck_find_bus(sys_addr_entry->bus_id, 0)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MPSysAddrSpaceBusId", - "System Address Space Mapping Entry %d (@0x%8.8x) has an Bus ID 0x%2.2x that is not defined in any of the Bus Entries.", n, phys_addr, sys_addr_entry->bus_id); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MPSysAddrSpaceBusId", + "System Address Space Mapping Entry %d (@0x%8.8x) has an Bus ID 0x%2.2x " + "that is not defined in any of the Bus Entries.", + n, phys_addr, sys_addr_entry->bus_id); failed = true; } if (sys_addr_entry->address_type > 3) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MPSysAddrSpaceType", - "System Address Space Mapping Entry %d (@0x%8.8x) has an incorrect Address Type: %hhu, should be 0..3.", n, phys_addr, sys_addr_entry->address_type); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MPSysAddrSpaceType", + "System Address Space Mapping Entry %d (@0x%8.8x) has an incorrect " + "Address Type: %hhu, should be 0..3.", + n, phys_addr, + sys_addr_entry->address_type); failed = true; } if (sys_addr_entry->address_length == 0) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MPSysAddrSpaceAddrLength", - "System Address Space Mapping Entry %d (@0x%8.8x) has an zero sized Address Length.", n, phys_addr); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MPSysAddrSpaceAddrLength", + "System Address Space Mapping Entry %d (@0x%8.8x) has a " + "zero sized Address Length.", + n, phys_addr); failed = true; } n++; - } + } } - + if (!failed) fwts_passed(fw, "All %d System Address Space Mapping Entries looks sane.", n); @@ -383,17 +417,21 @@ uint8_t *data = fwts_list_data(uint8_t *, entry); if (*data == FWTS_MP_BUS_HIERARCHY_ENTRY) { uint32_t phys_addr = mp_data.phys_addr + ((void *)data - (void *)mp_data.header); - fwts_mp_bus_hierarchy_entry *bus_hierarchy_entry = + fwts_mp_bus_hierarchy_entry *bus_hierarchy_entry = fwts_list_data(fwts_mp_bus_hierarchy_entry *, entry); if (bus_hierarchy_entry->length != 8) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MPBusHieraracyLength", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MPBusHieraracyLength", "Bus Hierarchy Entry %d (@x%8.8x) length was 0x%2.2x, it should be 0x08.", - n, phys_addr, bus_hierarchy_entry->length); + n, phys_addr, + bus_hierarchy_entry->length); failed = true; } if (!mpcheck_find_bus(bus_hierarchy_entry->parent_bus, 0)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MPBusHierarchyParents", - "Bus Hierarchy Entry %d (@x%8.8x) did not have parents that connected to a top level Bus entry.", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MPBusHierarchyParents", + "Bus Hierarchy Entry %d (@x%8.8x) did not have parents that " + "connected to a top level Bus entry.", n, phys_addr); failed = true; } @@ -421,15 +459,19 @@ fwts_list_data(fwts_mp_compat_bus_address_space_entry*, entry); if (compat_bus_entry->length != 8) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MPCompatBusLength", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MPCompatBusLength", "Compatible Bus Address Space Entry %d (@x%8.8x) length was 0x%2.2x, it should be 0x08.", - n, phys_addr, compat_bus_entry->length); + n, phys_addr, + compat_bus_entry->length); failed = true; } if (compat_bus_entry->range_list > 1) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "MPCompatBusRangeList", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "MPCompatBusRangeList", "Compatible Bus Address Space Entry %d (@x%8.8x) Range List was 0x%2.2x, it should be 0x00 or 0x01.", - n, phys_addr, compat_bus_entry->range_list); + n, phys_addr, + compat_bus_entry->range_list); failed = true; } n++; @@ -444,7 +486,7 @@ static int mpcheck_init(fwts_framework *fw) -{ +{ if (fwts_mp_data_get(&mp_data) != FWTS_OK) { fwts_log_error(fw, "Failed to get _MP_ data from firmware."); return FWTS_SKIP; @@ -457,21 +499,6 @@ return fwts_mp_data_free(&mp_data); } -uint8_t mpcheck_get_apic_id(void *data) -{ - uint8_t *which = (uint8_t*)data; - - if (*which == FWTS_MP_CPU_ENTRY) { - fwts_mp_processor_entry *cpu_entry = (fwts_mp_processor_entry *)data; - return cpu_entry->local_apic_id; - } - if (*which == FWTS_MP_IO_APIC_ENTRY) { - fwts_mp_io_apic_entry *io_apic_entry = (fwts_mp_io_apic_entry *)data; - return io_apic_entry->id; - } - return 0xff; -} - static int mpcheck_test_header(fwts_framework *fw) { bool failed = false; diff -Naur fwts-0.23.13/src/bios/multiproc/mpdump.c fwts-0.23.23/src/bios/multiproc/mpdump.c --- fwts-0.23.13/src/bios/multiproc/mpdump.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/bios/multiproc/mpdump.c 2011-08-31 16:09:22.000000000 +0000 @@ -305,7 +305,7 @@ } } -uint8_t mpdump_get_apic_id(void *data) +static uint8_t mpdump_get_apic_id(void *data) { uint8_t *which = (uint8_t*)data; diff -Naur fwts-0.23.13/src/bios/os2gap/os2gap.c fwts-0.23.23/src/bios/os2gap/os2gap.c --- fwts-0.23.13/src/bios/os2gap/os2gap.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/bios/os2gap/os2gap.c 2011-08-31 16:09:22.000000000 +0000 @@ -49,7 +49,10 @@ static int os2gap_test1(fwts_framework *fw) { if (fwts_memory_map_is_reserved(os2gap_memory_map_info, OS2_GAP_ADDRESS)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "The memory map has OS/2 memory hole at %p..%p.", + fwts_failed(fw, LOG_LEVEL_HIGH, + "OS2Gap", + "The memory map has OS/2 memory hole of %dK at %p..%p.", + OS2_GAP_SIZE / 1024, (void*)OS2_GAP_ADDRESS, (void*)(OS2_GAP_ADDRESS + OS2_GAP_SIZE)); fwts_tag_failed(fw, FWTS_TAG_BIOS); diff -Naur fwts-0.23.13/src/bios/romdump/romdump.c fwts-0.23.23/src/bios/romdump/romdump.c --- fwts-0.23.13/src/bios/romdump/romdump.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/bios/romdump/romdump.c 2011-08-31 16:09:22.000000000 +0000 @@ -29,7 +29,8 @@ #define BIOS_ROM_SIZE (BIOS_ROM_END - BIOS_ROM_START) #define BIOS_ROM_OFFSET (BIOS_ROM_START - BIOS_ROM_REGION_START) -static void romdump_data(fwts_framework *fw, uint8_t *data, int offset, int length) +static void romdump_data(fwts_framework *fw, uint8_t *data, + int offset, int length) { char buffer[128]; int i; @@ -53,15 +54,23 @@ for (i=0; ifirmware_type) { case FWTS_FIRMWARE_BIOS: @@ -128,9 +131,13 @@ uint32_t addr = 0; fwts_smbios_entry entry; - fwts_log_info(fw, "This test tries to find and sanity check the SMBIOS data structures."); + fwts_log_info(fw, + "This test tries to find and sanity check the SMBIOS " + "data structures."); if (fwts_smbios_find_entry(fw, &entry, &addr) != FWTS_OK) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "SMBIOSNoEntryPoint", "Could not find SMBIOS Table Entry Point."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "SMBIOSNoEntryPoint", + "Could not find SMBIOS Table Entry Point."); else { fwts_passed(fw, "Found SMBIOS Table Entry Point at 0x%8.8x", addr); /* TODO: Dump out table */ diff -Naur fwts-0.23.13/src/cmos/cmosdump/cmosdump.c fwts-0.23.23/src/cmos/cmosdump/cmosdump.c --- fwts-0.23.13/src/cmos/cmosdump/cmosdump.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/cmos/cmosdump/cmosdump.c 2011-08-31 16:09:22.000000000 +0000 @@ -22,7 +22,10 @@ #ifdef FWTS_ARCH_INTEL -/* Some CMOS information from http://www-ivs.cs.uni-magdeburg.de/~zbrog/asm/cmos.html */ +/* + * Some CMOS information from + * http://www-ivs.cs.uni-magdeburg.de/~zbrog/asm/cmos.html + */ static int cmosdump_test1(fwts_framework *fw) { @@ -35,7 +38,7 @@ "Memory test pass", "Memory test fail", - "INT 19h reboot", + "INT 19h reboot", "Flush keyboard and jmp via 40h:67h", "Protected mode tests pass", "Protected mode tests fail", @@ -147,165 +150,296 @@ fwts_log_info_verbatum(fw, " RTC hours: %2.2x", data[5]); fwts_log_nl(fw); - fwts_log_info_verbatum(fw, "Status Register A: (CMOS 0x0a): 0x%2.2x", data[10]); - fwts_log_info_verbatum(fw, " Rate freq: %1.1x (%s)", data[10] & 0xf, rate_selection[data[10] & 0xf]); - fwts_log_info_verbatum(fw, " Timer freq divider: %1.1x (%s)", (data[10] >> 4) & 0x7, divider[(data[10] >> 4) & 0x7]); - fwts_log_info_verbatum(fw, " Update in progress: %1.1x", (data[10] >> 7) & 1); - fwts_log_nl(fw); - - fwts_log_info_verbatum(fw, "Status Register B: (CMOS 0x0b): 0x%2.2x", data[11]); - fwts_log_info_verbatum(fw, " Daylight savings: %1.1x (%s)", (data[11] >> 1) & 1, (data[11] >> 1) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " 24 Hour Clock: %1.1x (%s)", (data[11] >> 2) & 1, (data[11] >> 1) & 1 ? "12 Hour" : "24 Hour"); - fwts_log_info_verbatum(fw, " Square Wave: %1.1x (%s)", (data[11] >> 3) & 1, (data[11] >> 2) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " Update ended IRQ: %1.1x (%s)", (data[11] >> 4) & 1, (data[11] >> 3) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " Alarm IRQ: %1.1x (%s)", (data[11] >> 5) & 1, (data[11] >> 5) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " Periodic IRQ: %1.1x (%s)", (data[11] >> 6) & 1, (data[11] >> 6) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " Clock update cycle: %1.1x (%s)", (data[11] >> 7) & 1, (data[11] >> 7) & 1 ? "Abort update in progress" : "Update normally"); - fwts_log_nl(fw); - - fwts_log_info_verbatum(fw, "Status Register C: (CMOS 0x0c): 0x%2.2x", data[12]); - fwts_log_info_verbatum(fw, " UF flag: 0x%1.1x", (data[12] >> 4) & 1); - fwts_log_info_verbatum(fw, " AF flag: 0x%1.1x", (data[12] >> 5) & 1); - fwts_log_info_verbatum(fw, " PF flag: 0x%1.1x", (data[12] >> 6) & 1); - fwts_log_info_verbatum(fw, " IRQF flag: 0x%1.1x", (data[12] >> 7) & 1); - fwts_log_nl(fw); - - fwts_log_info_verbatum(fw, "Status Register D: (CMOS 0x0d): 0x%2.2x", data[13]); - fwts_log_info_verbatum(fw, " Valid CMOS RAM flag: 0x%1.1x (%s)", (data[13] >> 7) & 1, (data[13] >> 7) & 1 ? "Battery Good": "Battery Dead"); - fwts_log_nl(fw); - - fwts_log_info_verbatum(fw, "Diagnostic Status: (CMOS 0x0e): 0x%2.2x", data[14]); - fwts_log_info_verbatum(fw, " CMOS time status: 0x%1.1x (%s)", (data[14] >> 2) & 1, (data[14] >> 2) & 1 ? "Invalid": "Valid"); - fwts_log_info_verbatum(fw, " Fixed disk init: 0x%1.1x (%s)", (data[14] >> 3) & 1, (data[14] >> 3) & 1 ? "Bad": "Good"); - fwts_log_info_verbatum(fw, " Memory size check: 0x%1.1x (%s)", (data[14] >> 4) & 1, (data[14] >> 4) & 1 ? "Bad": "Good"); - fwts_log_info_verbatum(fw, " Config info status: 0x%1.1x (%s)", (data[14] >> 5) & 1, (data[14] >> 5) & 1 ? "Invalid": "Valid"); - fwts_log_info_verbatum(fw, " CMOS checksum status: 0x%1.1x (%s)", (data[14] >> 6) & 1, (data[14] >> 6) & 1 ? "Bad": "Good"); - fwts_log_info_verbatum(fw, " CMOS power loss: 0x%1.1x (%s)", (data[14] >> 7) & 1, (data[14] >> 7) & 1 ? "Lost power": "Not lost power"); - fwts_log_nl(fw); - - fwts_log_info_verbatum(fw, "CMOS Shutdown Status: (CMOS 0x0f): 0x%2.2x (%s)", data[15], - data[15] < 0xb ? cmos_shutdown_status[data[15]] : "Perform power-on reset"); - fwts_log_nl(fw); - - fwts_log_info_verbatum(fw, "Floppy Disk Type: (CMOS 0x10): 0x%2.2x", data[16]); - fwts_log_info_verbatum(fw, " Drive 0: %s", floppy_disk[((data[16] >> 4) & 0xf)]); - fwts_log_info_verbatum(fw, " Drive 1: %s", floppy_disk[((data[16] >> 0) & 0xf)]); + fwts_log_info_verbatum(fw, "Status Register A: (CMOS 0x0a): 0x%2.2x", + data[10]); + fwts_log_info_verbatum(fw, " Rate freq: %1.1x (%s)", + data[10] & 0xf, rate_selection[data[10] & 0xf]); + fwts_log_info_verbatum(fw, " Timer freq divider: %1.1x (%s)", + (data[10] >> 4) & 0x7, divider[(data[10] >> 4) & 0x7]); + fwts_log_info_verbatum(fw, " Update in progress: %1.1x", + (data[10] >> 7) & 1); + fwts_log_nl(fw); + + fwts_log_info_verbatum(fw, "Status Register B: (CMOS 0x0b): 0x%2.2x", + data[11]); + fwts_log_info_verbatum(fw, " Daylight savings: %1.1x (%s)", + data[11] & 1, + data[11] & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " 24 Hour Clock: %1.1x (%s)", + (data[11] >> 1) & 1, + (data[11] >> 1) & 1 ? "24 Hour" : "12 Hour"); + fwts_log_info_verbatum(fw, " Data Mode (DM): %1.1x (%s)", + (data[11] >> 2) & 1, + (data[11] >> 2) & 1 ? "Binary" : "BCD"); + fwts_log_info_verbatum(fw, " Square Wave: %1.1x (%s)", + (data[11] >> 3) & 1, + (data[11] >> 3) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " Update ended IRQ: %1.1x (%s)", + (data[11] >> 4) & 1, + (data[11] >> 4) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " Alarm IRQ: %1.1x (%s)", + (data[11] >> 5) & 1, + (data[11] >> 5) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " Periodic IRQ: %1.1x (%s)", + (data[11] >> 6) & 1, + (data[11] >> 6) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " Clock update cycle: %1.1x (%s)", + (data[11] >> 7) & 1, + (data[11] >> 7) & 1 ? "Abort update in progress" : "Update normally"); + fwts_log_nl(fw); + + fwts_log_info_verbatum(fw, "Status Register C: (CMOS 0x0c): 0x%2.2x", + data[12]); + fwts_log_info_verbatum(fw, " UF flag: 0x%1.1x", + (data[12] >> 4) & 1); + fwts_log_info_verbatum(fw, " AF flag: 0x%1.1x", + (data[12] >> 5) & 1); + fwts_log_info_verbatum(fw, " PF flag: 0x%1.1x", + (data[12] >> 6) & 1); + fwts_log_info_verbatum(fw, " IRQF flag: 0x%1.1x", + (data[12] >> 7) & 1); + fwts_log_nl(fw); + + fwts_log_info_verbatum(fw, "Status Register D: (CMOS 0x0d): 0x%2.2x", + data[13]); + fwts_log_info_verbatum(fw, " Valid CMOS RAM flag: 0x%1.1x (%s)", + (data[13] >> 7) & 1, + (data[13] >> 7) & 1 ? "Battery Good": "Battery Dead"); + fwts_log_nl(fw); + + fwts_log_info_verbatum(fw, "Diagnostic Status: (CMOS 0x0e): 0x%2.2x", + data[14]); + fwts_log_info_verbatum(fw, " CMOS time status: 0x%1.1x (%s)", + (data[14] >> 2) & 1, + (data[14] >> 2) & 1 ? "Invalid": "Valid"); + fwts_log_info_verbatum(fw, " Fixed disk init: 0x%1.1x (%s)", + (data[14] >> 3) & 1, + (data[14] >> 3) & 1 ? "Bad": "Good"); + fwts_log_info_verbatum(fw, " Memory size check: 0x%1.1x (%s)", + (data[14] >> 4) & 1, + (data[14] >> 4) & 1 ? "Bad": "Good"); + fwts_log_info_verbatum(fw, " Config info status: 0x%1.1x (%s)", + (data[14] >> 5) & 1, + (data[14] >> 5) & 1 ? "Invalid": "Valid"); + fwts_log_info_verbatum(fw, " CMOS checksum status: 0x%1.1x (%s)", + (data[14] >> 6) & 1, + (data[14] >> 6) & 1 ? "Bad": "Good"); + fwts_log_info_verbatum(fw, " CMOS power loss: 0x%1.1x (%s)", + (data[14] >> 7) & 1, + (data[14] >> 7) & 1 ? "Lost power": "Not lost power"); + fwts_log_nl(fw); + + fwts_log_info_verbatum(fw, "CMOS Shutdown Status: (CMOS 0x0f): 0x%2.2x (%s)", + data[15], + data[15] < 0xb ? cmos_shutdown_status[data[15]] : "Perform power-on reset"); + fwts_log_nl(fw); + + fwts_log_info_verbatum(fw, "Floppy Disk Type: (CMOS 0x10): 0x%2.2x", + data[16]); + fwts_log_info_verbatum(fw, " Drive 0: %s", + floppy_disk[((data[16] >> 4) & 0xf)]); + fwts_log_info_verbatum(fw, " Drive 1: %s", + floppy_disk[((data[16] >> 0) & 0xf)]); fwts_log_nl(fw); fwts_log_info_verbatum(fw, "Hard Disk Type: (CMOS 0x12, Obsolete): 0x%2.2x", data[18]); - fwts_log_info_verbatum(fw, " Drive 0: %s", hard_disk[((data[18] >> 4) & 0xf)]); - fwts_log_info_verbatum(fw, " Drive 1: %s", hard_disk[((data[18] >> 0) & 0xf)]); - fwts_log_nl(fw); - - fwts_log_info_verbatum(fw, "Installed H/W: (CMOS 0x14): 0x%2.2x", data[20]); - fwts_log_info_verbatum(fw, " Maths Coprocessor: 0x%1.1x (%s)", (data[20] >> 1) & 1, (data[20] >> 1) & 1 ? "Installed": "Not Installed"); - fwts_log_info_verbatum(fw, " Keyboard: 0x%1.1x (%s)", (data[20] >> 2) & 1, (data[20] >> 2) & 1 ? "Installed": "Not Installed"); - fwts_log_info_verbatum(fw, " Display Adaptor: 0x%1.1x (%s)", (data[20] >> 3) & 1, (data[20] >> 3) & 1 ? "Installed": "Not Installed"); - fwts_log_info_verbatum(fw, " Primary Display: 0x%1.1x (%s)", (data[20] >> 4) & 3, primary_display[(data[20] >> 4) & 3]); - fwts_log_info_verbatum(fw, " Floppy Drives: 0x%2.2x (%hhu drive%s)", (data[20] >> 6) & 3, ((data[20] >> 6) & 3) + 1, - ((data[20] >> 6) & 3) + 1 > 1 ? "s" : ""); + fwts_log_info_verbatum(fw, " Drive 0: %s", + hard_disk[((data[18] >> 4) & 0xf)]); + fwts_log_info_verbatum(fw, " Drive 1: %s", + hard_disk[((data[18] >> 0) & 0xf)]); + fwts_log_nl(fw); + + fwts_log_info_verbatum(fw, "Installed H/W: (CMOS 0x14): 0x%2.2x", + data[20]); + fwts_log_info_verbatum(fw, " Maths Coprocessor: 0x%1.1x (%s)", + (data[20] >> 1) & 1, + (data[20] >> 1) & 1 ? "Installed": "Not Installed"); + fwts_log_info_verbatum(fw, " Keyboard: 0x%1.1x (%s)", + (data[20] >> 2) & 1, + (data[20] >> 2) & 1 ? "Installed": "Not Installed"); + fwts_log_info_verbatum(fw, " Display Adaptor: 0x%1.1x (%s)", + (data[20] >> 3) & 1, + (data[20] >> 3) & 1 ? "Installed": "Not Installed"); + fwts_log_info_verbatum(fw, " Primary Display: 0x%1.1x (%s)", + (data[20] >> 4) & 3, + primary_display[(data[20] >> 4) & 3]); + if (data[20] & 1) { + int drives = (data[20] >> 6) & 3; + fwts_log_info_verbatum(fw, " Floppy Drives: 0x%2.2x (%hhu drive%s)", + drives, drives + 1, drives > 0 ? "s" : ""); + } else { + fwts_log_info_verbatum(fw, " Floppy Drives: None."); + } fwts_log_nl(fw); tmp = ((data[22] << 8) | (data[21])); fwts_log_info_verbatum(fw, "Base Mem: (CMOS 0x16):"); - fwts_log_info_verbatum(fw, " 0x%2.2x%2.2x (%luK)", data[22], data[21], tmp); + fwts_log_info_verbatum(fw, " 0x%2.2x%2.2x (%luK)", + data[22], data[21], tmp); fwts_log_nl(fw); tmp = ((data[24] << 8) | (data[25])); fwts_log_info_verbatum(fw, "Extended Mem: (CMOS 0x18):"); - fwts_log_info_verbatum(fw, " 0x%2.2x%2.2x (%luK) %s", data[24], data[23], tmp, tmp > (16 * 1024) ? "[untrustworthy]" : ""); + fwts_log_info_verbatum(fw, " 0x%2.2x%2.2x (%luK) %s", + data[24], data[23], tmp, + tmp > (16 * 1024) ? "[untrustworthy]" : ""); fwts_log_nl(fw); fwts_log_info_verbatum(fw, "Hard Disk Extended Types (CMOS 0x19, 0x1a):"); - fwts_log_info_verbatum(fw, " Hard Disk 0: 0x%2.2x", data[25]); - fwts_log_info_verbatum(fw, " Hard Disk 1: 0x%2.2x", data[26]); + fwts_log_info_verbatum(fw, " Hard Disk 0: 0x%2.2x", + data[25]); + fwts_log_info_verbatum(fw, " Hard Disk 1: 0x%2.2x", + data[26]); fwts_log_nl(fw); - + /* fwts_log_info_verbatum(fw, "Drive C: (CMOS 0x"); - fwts_log_info_verbatum(fw, " Number of Cylinders: 0x%2.2x%2.2x", data[28], data[27]); - fwts_log_info_verbatum(fw, " Number of Heads: 0x%2.2x", data[29]); - fwts_log_info_verbatum(fw, " Number of Sectors: 0x%2.2x", data[35]); - fwts_log_info_verbatum(fw, " Write precomp cylinder: 0x%2.2x%2.2x", data[31], data[30]); - fwts_log_info_verbatum(fw, " Control Byte: 0x%2.2x", data[32]); - fwts_log_info_verbatum(fw, " Landing Zone 0x%2.2x%2.2x", data[34], data[33]); + fwts_log_info_verbatum(fw, " Number of Cylinders: 0x%2.2x%2.2x", + data[28], data[27]); + fwts_log_info_verbatum(fw, " Number of Heads: 0x%2.2x", + data[29]); + fwts_log_info_verbatum(fw, " Number of Sectors: 0x%2.2x", + data[35]); + fwts_log_info_verbatum(fw, " Write precomp cylinder: 0x%2.2x%2.2x", + data[31], data[30]); + fwts_log_info_verbatum(fw, " Control Byte: 0x%2.2x", + data[32]); + fwts_log_info_verbatum(fw, " Landing Zone 0x%2.2x%2.2x", + data[34], data[33]); fwts_log_nl(fw); fwts_log_info_verbatum(fw, "Drive D:"); - fwts_log_info_verbatum(fw, " Number of Cylinders: 0x%2.2x%2.2x", data[37], data[36]); - fwts_log_info_verbatum(fw, " Number of Heads: 0x%2.2x", data[38]); - fwts_log_info_verbatum(fw, " Number of Sectors: 0x%2.2x", data[39]); - fwts_log_info_verbatum(fw, " Write precomp cylinder: 0x%2.2x%2.2x", data[41], data[40]); - fwts_log_info_verbatum(fw, " Control Byte: 0x%2.2x", data[41]); - fwts_log_info_verbatum(fw, " Landing Zone 0x%2.2x%2.2x", data[44], data[43]); + fwts_log_info_verbatum(fw, " Number of Cylinders: 0x%2.2x%2.2x", + data[37], data[36]); + fwts_log_info_verbatum(fw, " Number of Heads: 0x%2.2x", + data[38]); + fwts_log_info_verbatum(fw, " Number of Sectors: 0x%2.2x", + data[39]); + fwts_log_info_verbatum(fw, " Write precomp cylinder: 0x%2.2x%2.2x", + data[41], data[40]); + fwts_log_info_verbatum(fw, " Control Byte: 0x%2.2x", + data[41]); + fwts_log_info_verbatum(fw, " Landing Zone 0x%2.2x%2.2x", + data[44], data[43]); fwts_log_nl(fw); */ - + /* AMI only fwts_log_info_verbatum(fw, "System Operational Flags:"); - fwts_log_info_verbatum(" Turbo switch: 0x%1.1x (%s)", (data[45] >> 0) & 1, (data[45] >> 0) & 1 ? "Yes" : "No"); - fwts_log_info_verbatum(fw, " Fast gate A20 operation 0x%1.1x (%s)", (data[45] >> 1) & 1, (data[45] >> 1) & 1 ? "Yes" : "No"); - fwts_log_info_verbatum(fw, " Internal Cache: 0x%1.1x (%s)", (data[45] >> 2) & 1, (data[45] >> 2) & 1 ? "Yes" : "No"); - fwts_log_info_verbatum(fw, " External Cache: 0x%1.1x (%s)", (data[45] >> 3) & 1, (data[45] >> 3) & 1 ? "Yes" : "No"); - fwts_log_info_verbatum(fw, " Boot CPU speed: 0x%1.1x (%s)", (data[45] >> 4) & 1, (data[45] >> 4) & 1 ? "Yes" : "No"); - fwts_log_info_verbatum(fw, " Boot Sequence: 0x%1.1x (%s)", (data[45] >> 5) & 1, (data[45] >> 5) & 1 ? "Yes" : "No"); - fwts_log_info_verbatum(fw, " Floppy boot seek: 0x%1.1x (%s)", (data[45] >> 6) & 1, (data[45] >> 6) & 1 ? "Yes" : "No"); - fwts_log_info_verbatum(fw, " Weitek CPU: 0x%1.1x (%s)", (data[45] >> 7) & 1, (data[45] >> 7) & 1 ? "Yes" : "No"); + fwts_log_info_verbatum(" Turbo switch: 0x%1.1x (%s)", + (data[45] >> 0) & 1, (data[45] >> 0) & 1 ? "Yes" : "No"); + fwts_log_info_verbatum(fw, " Fast gate A20 operation 0x%1.1x (%s)", + (data[45] >> 1) & 1, (data[45] >> 1) & 1 ? "Yes" : "No"); + fwts_log_info_verbatum(fw, " Internal Cache: 0x%1.1x (%s)", + (data[45] >> 2) & 1, (data[45] >> 2) & 1 ? "Yes" : "No"); + fwts_log_info_verbatum(fw, " External Cache: 0x%1.1x (%s)", + (data[45] >> 3) & 1, (data[45] >> 3) & 1 ? "Yes" : "No"); + fwts_log_info_verbatum(fw, " Boot CPU speed: 0x%1.1x (%s)", + (data[45] >> 4) & 1, (data[45] >> 4) & 1 ? "Yes" : "No"); + fwts_log_info_verbatum(fw, " Boot Sequence: 0x%1.1x (%s)", + (data[45] >> 5) & 1, (data[45] >> 5) & 1 ? "Yes" : "No"); + fwts_log_info_verbatum(fw, " Floppy boot seek: 0x%1.1x (%s)", + (data[45] >> 6) & 1, (data[45] >> 6) & 1 ? "Yes" : "No"); + fwts_log_info_verbatum(fw, " Weitek CPU: 0x%1.1x (%s)", + (data[45] >> 7) & 1, (data[45] >> 7) & 1 ? "Yes" : "No"); fwts_log_nl(fw); */ - fwts_log_info_verbatum(fw, "CMOS Checksum:(CMOS 0x2e):0x%2.2x%2.2x", data[47], data[46]); + fwts_log_info_verbatum(fw, "CMOS Checksum:(CMOS 0x2e):0x%2.2x%2.2x", + data[47], data[46]); fwts_log_nl(fw); - fwts_log_info_verbatum(fw, "Extended Mem: (CMOS 0x30):0x%2.2x%2.2x", data[49], data[48]); + fwts_log_info_verbatum(fw, "Extended Mem: (CMOS 0x30):0x%2.2x%2.2x", + data[49], data[48]); fwts_log_nl(fw); fwts_log_info_verbatum(fw, "Century Date: (CMOS 0x32):%2.2x", data[50]); fwts_log_nl(fw); fwts_log_info_verbatum(fw, "POST Information Flag (CMOS 0x33):"); - fwts_log_info_verbatum(fw, " POST cache test: 0x%1.1x %s", (data[51] >> 0) & 1, (data[51] >> 0) & 1 ? "Failed" : "Passed"); - fwts_log_info_verbatum(fw, " BIOS size: 0x%1.1x %s", (data[51] >> 7) & 1, (data[51] >> 7) & 1 ? "128KB" : "64KB"); + fwts_log_info_verbatum(fw, " POST cache test: 0x%1.1x %s", + (data[51] >> 0) & 1, (data[51] >> 0) & 1 ? "Failed" : "Passed"); + fwts_log_info_verbatum(fw, " BIOS size: 0x%1.1x %s", + (data[51] >> 7) & 1, (data[51] >> 7) & 1 ? "128KB" : "64KB"); fwts_log_nl(fw); /* fwts_log_info_verbatum(fw, "BIOS and Shadow Option flags:"); - fwts_log_info_verbatum(fw, " Password checking: 0x%1.1x %s", (data[52] >> 6) & 1, (data[52] >> 6) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " Boot sector virus prot: 0x%1.1x %s", (data[52] >> 7) & 1, (data[52] >> 7) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " Numeric CPU test: 0x%1.1x %s", (data[53] >> 0) & 1, (data[53] >> 0) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xC000: 0x%1.1x %s", (data[53] >> 2) & 1, (data[53] >> 2) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xC400: 0x%1.1x %s", (data[53] >> 1) & 1, (data[53] >> 1) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xC800: 0x%1.1x %s", (data[52] >> 5) & 1, (data[52] >> 5) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xCC00: 0x%1.1x %s", (data[52] >> 4) & 1, (data[52] >> 4) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xD000: 0x%1.1x %s", (data[52] >> 3) & 1, (data[52] >> 3) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xD400: 0x%1.1x %s", (data[52] >> 2) & 1, (data[52] >> 2) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xD800: 0x%1.1x %s", (data[52] >> 1) & 1, (data[52] >> 1) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xDC00: 0x%1.1x %s", (data[52] >> 0) & 1, (data[52] >> 0) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xE000: 0x%1.1x %s", (data[53] >> 7) & 1, (data[53] >> 7) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xE400: 0x%1.1x %s", (data[53] >> 6) & 1, (data[53] >> 6) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xE800: 0x%1.1x %s", (data[53] >> 5) & 1, (data[53] >> 5) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xEC00: 0x%1.1x %s", (data[53] >> 4) & 1, (data[53] >> 4) & 1 ? "Enabled" : "Disabled"); - fwts_log_info_verbatum(fw, " ROM shadow 0xF000: 0x%1.1x %s", (data[53] >> 3) & 1, (data[53] >> 3) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " Password checking: 0x%1.1x %s", + (data[52] >> 6) & 1, + (data[52] >> 6) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " Boot sector virus prot: 0x%1.1x %s", + (data[52] >> 7) & 1, + (data[52] >> 7) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " Numeric CPU test: 0x%1.1x %s", + (data[53] >> 0) & 1, + (data[53] >> 0) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xC000: 0x%1.1x %s", + (data[53] >> 2) & 1, + (data[53] >> 2) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xC400: 0x%1.1x %s", + (data[53] >> 1) & 1, + (data[53] >> 1) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xC800: 0x%1.1x %s", + (data[52] >> 5) & 1, + (data[52] >> 5) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xCC00: 0x%1.1x %s", + (data[52] >> 4) & 1, + (data[52] >> 4) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xD000: 0x%1.1x %s", + (data[52] >> 3) & 1, + (data[52] >> 3) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xD400: 0x%1.1x %s", + (data[52] >> 2) & 1, + (data[52] >> 2) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xD800: 0x%1.1x %s", + (data[52] >> 1) & 1, + (data[52] >> 1) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xDC00: 0x%1.1x %s", + (data[52] >> 0) & 1, + (data[52] >> 0) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xE000: 0x%1.1x %s", + (data[53] >> 7) & 1, + (data[53] >> 7) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xE400: 0x%1.1x %s", + (data[53] >> 6) & 1, + (data[53] >> 6) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xE800: 0x%1.1x %s", + (data[53] >> 5) & 1, + (data[53] >> 5) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xEC00: 0x%1.1x %s", + (data[53] >> 4) & 1, + (data[53] >> 4) & 1 ? "Enabled" : "Disabled"); + fwts_log_info_verbatum(fw, " ROM shadow 0xF000: 0x%1.1x %s", + (data[53] >> 3) & 1, + (data[53] >> 3) & 1 ? "Enabled" : "Disabled"); fwts_log_nl(fw); */ /* AMI fwts_log_info_verbatum(fw, "Encrypted Password: 0x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x", - data[56], data[57], data[58], data[59], data[60], data[61]); - fwts_log_info_verbatum(fw, "Extended CMOS checksum: 0x%2.2x%2.2x", data[62], data[63]); + data[56], data[57], data[58], data[59], data[60], data[61]); + fwts_log_info_verbatum(fw, "Extended CMOS checksum: 0x%2.2x%2.2x", + data[62], data[63]); - fwts_log_info_verbatum(fw, "Model Number: 0x%2.2x", data[64]); + fwts_log_info_verbatum(fw, "Model Number: 0x%2.2x", + data[64]); fwts_log_info_verbatum(fw, "Serial Number: 0x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x", - data[65], data[66], data[67], data[68], data[69], data[70]); - fwts_log_info_verbatum(fw, "CRC byte: 0x%2.2x", data[71]); - fwts_log_info_verbatum(fw, "Century Byte: 0x%2.2x", data[72]); - fwts_log_info_verbatum(fw, "Date Alarm: 0x%2.2x", data[73]); - fwts_log_info_verbatum(fw, "RTC Address: 0x%2.2x%2.2x", data[79], data[78]); - fwts_log_info_verbatum(fw, "Extended RAM address: 0x%2.2x%2.2x", data[81], data[80]); + data[65], data[66], data[67], data[68], data[69], data[70]); + fwts_log_info_verbatum(fw, "CRC byte: 0x%2.2x", + data[71]); + fwts_log_info_verbatum(fw, "Century Byte: 0x%2.2x", + data[72]); + fwts_log_info_verbatum(fw, "Date Alarm: 0x%2.2x", + data[73]); + fwts_log_info_verbatum(fw, "RTC Address: 0x%2.2x%2.2x", + data[79], data[78]); + fwts_log_info_verbatum(fw, "Extended RAM address: 0x%2.2x%2.2x", + data[81], data[80]); fwts_log_nl(fw); */ fwts_infoonly(fw); - + return FWTS_OK; } diff -Naur fwts-0.23.13/src/cpu/cpufreq/cpufreq.c fwts-0.23.23/src/cpu/cpufreq/cpufreq.c --- fwts-0.23.13/src/cpu/cpufreq/cpufreq.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/cpu/cpufreq/cpufreq.c 2011-08-31 16:09:22.000000000 +0000 @@ -54,7 +54,8 @@ #define GET_PERFORMANCE_MIN (1) #define GET_PERFORMANCE_AVG (2) -static void cpu_mkpath(char *path, const int len, const int cpu, const char *name) +static void cpu_mkpath(char *path, const int len, + const int cpu, const char *name) { snprintf(path, len, "%s/cpu%i/cpufreq/%s", FWTS_CPU_PATH, cpu, name); } @@ -111,8 +112,8 @@ CPU_ZERO(&mask); CPU_SET(cpu, &mask); sched_setaffinity(0, sizeof(mask), &mask); - - set_governor(fw, cpu); + + set_governor(fw, cpu); /* then set the speed */ cpu_mkpath(path, sizeof(path), cpu, "scaling_setspeed"); @@ -143,7 +144,7 @@ current = time(NULL); do { - double A, B; + double A, B; int i; A = 1.234567; B = 3.121213; @@ -161,7 +162,6 @@ B = A * A; A = A - B + sqrt(A); } - loopcount++; } while (current == time(NULL)); @@ -171,7 +171,8 @@ } -static unsigned long get_performance_repeat(fwts_framework *fw, int cpu, unsigned long Hz, int count, int type) +static unsigned long get_performance_repeat(fwts_framework *fw, + int cpu, unsigned long Hz, int count, int type) { int i; @@ -213,7 +214,7 @@ } static char *HzToHuman(unsigned long hz) -{ +{ static char buffer[1024]; memset(buffer, 0, 1024); unsigned long long Hz; @@ -224,10 +225,12 @@ snprintf(buffer, sizeof(buffer), "%9lli", Hz); if (Hz>1000) - snprintf(buffer, sizeof(buffer), "%6lli Mhz", (Hz+500)/1000); + snprintf(buffer, sizeof(buffer), "%6lli Mhz", + (Hz+500)/1000); if (Hz>1500000) - snprintf(buffer, sizeof(buffer), "%6.2f Ghz", (Hz+50000.0)/1000000); + snprintf(buffer, sizeof(buffer), "%6.2f Ghz", + (Hz+50000.0)/1000000); return buffer; @@ -242,7 +245,7 @@ unsigned long value = 0; cpu_mkpath(path, sizeof(path), cpu, "scaling_max_freq"); - + if ((buffer = fwts_get(path)) != NULL) { value = strtoul(buffer, NULL, 10); free(buffer); @@ -280,8 +283,9 @@ fclose(file); if (totaltests==1) - totaltests = (2+count_ints(line)) * sysconf(_SC_NPROCESSORS_CONF) + 2; - + totaltests = (2+count_ints(line)) * + sysconf(_SC_NPROCESSORS_CONF) + 2; + c = line; i = 0; while (c && strlen(c)>1) { @@ -301,7 +305,7 @@ performedtests++; fwts_progress(fw, (75 * performedtests)/totaltests); - i++; + i++; c = c2; } speedcount = i; @@ -309,14 +313,15 @@ fwts_log_info_verbatum(fw, " Frequency | Speed \n-----------+---------\n"); for (i=0; i < speedcount; i++) fwts_log_info_verbatum(fw, "%9s | %5.1f %%\n", HzToHuman(freqs[i].Hz), 100.0*freqs[i].speed/topspeed); - + if (nrspeeds == -1) { fwts_log_info(fw, "%i CPU frequency steps supported", speedcount); nrspeeds = speedcount; } if (nrspeeds != speedcount) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqPStates", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "CPUFreqPStates", "Not all processors support the same number of P states."); if (speedcount<2) @@ -341,12 +346,17 @@ /* now check for 1) increasing HZ and 2) increasing speed */ for (i=0; i freqs[i+1].speed) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSlowerOnCPU", "Supposedly higher frequency is slower on CPU %i!", cpu); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "CPUFreqSlowerOnCPU", + "Supposedly higher frequency is slower on CPU %i!", cpu); if (freqs[i].Hz > get_claimed_hz(cpu) && !warned_PSS) { warned_PSS = 1; - fwts_warning(fw, "Frequency %lu not achievable; _PSS limit of %lu in effect?", freqs[i].Hz, get_claimed_hz(cpu)); + fwts_warning(fw, "Frequency %lu not achievable; _PSS limit of %lu in effect?", + freqs[i].Hz, get_claimed_hz(cpu)); } } } @@ -416,10 +426,10 @@ /* - 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 + * 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) { @@ -457,7 +467,8 @@ GET_PERFORMANCE_MAX) / topspeed; if (lowperf >= highperf) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ALL", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "CPUFreqSW_ALL", "Firmware not implementing hardware " "coordination cleanly. Firmware using SW_ALL " "instead?"); @@ -465,11 +476,11 @@ /* - 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 + * 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) { @@ -519,7 +530,8 @@ GET_PERFORMANCE_MAX) / topspeed; if (lowperf >= highperf) - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ANY", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "CPUFreqSW_ANY", "Firmware not implementing hardware " "coordination cleanly. Firmware using SW_ANY " "instead?."); @@ -550,10 +562,10 @@ } } closedir(dir); - + if (max_cpu == 0) return; /* Single processor machine, no point in checking anything */ - + /* assume that all processors have the same low performance */ low_perf = get_performance(max_cpu); for (i=0; i<= max_cpu; i++) { @@ -564,15 +576,19 @@ high_perf = get_performance(i); performedtests++; fwts_progress(fw, (75 * performedtests)/totaltests); - /* now set all the others to low again; sw_any will cause the core in question - to now also get the low speed, while hardware max will keep the performance + /* + * now set all the others to low again; sw_any will cause + * 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++) if (i!=j) lowest_speed(fw, j); newhigh_perf = get_performance(i); if (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."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "CPUFreqCPUsSetToSW_ANY", + "Processors are set to SW_ANY."); once++; lowest_speed(fw, i); } @@ -601,7 +617,7 @@ " 3) No duplicate frequency values are reported by the BIOS\n" " 4) Is BIOS wrongly doing Sw_All P-state coordination across cores\n" " 5) Is BIOS wrongly doing Sw_Any P-state coordination across cores\n"); - + /* First set all processors to their lowest speed */ if ((dir = opendir(FWTS_CPU_PATH)) == NULL) { diff -Naur fwts-0.23.13/src/cpu/maxfreq/maxfreq.c fwts-0.23.23/src/cpu/maxfreq/maxfreq.c --- fwts-0.23.13/src/cpu/maxfreq/maxfreq.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/cpu/maxfreq/maxfreq.c 2011-08-31 16:09:22.000000000 +0000 @@ -54,7 +54,7 @@ if (!isdigit(*str)) break; - + val = atoi(str); if (val > max) max = val; @@ -77,9 +77,9 @@ int advice = 0; fwts_log_info(fw, - "This test checks the maximum CPU frequency as detected by the kernel for " - "each CPU against maxiumum frequency as specified by the BIOS frequency " - "scaling settings."); + "This test checks the maximum CPU frequency as detected by " + "the kernel for each CPU against maxiumum frequency as " + "specified by the BIOS frequency scaling settings."); cpuinfo = fwts_file_open_and_read(CPU_INFO_PATH); if (cpuinfo == NULL) { @@ -125,9 +125,12 @@ fwts_skipped(fw, "Cannot read CPU frequencies from %s, this generally happens on AMD CPUs, skipping test.", CPU_INFO_PATH); return FWTS_SKIP; } - + if (!(dir = opendir(CPU_FREQ_PATH))) { - fwts_failed(fw, LOG_LEVEL_LOW, "CPUFreqNoPath", "No %s directory available: cannot test.", CPU_FREQ_PATH); + fwts_failed(fw, LOG_LEVEL_LOW, + "CPUFreqNoPath", + "No %s directory available: cannot test.", + CPU_FREQ_PATH); return FWTS_ERROR; } @@ -137,13 +140,17 @@ char path[PATH_MAX]; char *data; - snprintf(path, sizeof(path), CPU_FREQ_PATH "/%s/cpufreq/scaling_available_frequencies", entry->d_name); + snprintf(path, sizeof(path), + CPU_FREQ_PATH "/%s/cpufreq/scaling_available_frequencies", + entry->d_name); if ((data = fwts_get(path)) != NULL) { int maxfreq = maxfreq_max(data); int cpunum = atoi(entry->d_name + 3); if (maxfreq == -1) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqReadFailed", - "Cannot read cpu frequency from %s for CPU %s\n", CPU_FREQ_PATH, entry->d_name); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "CPUFreqReadFailed", + "Cannot read cpu frequency from %s for CPU %s\n", + CPU_FREQ_PATH, entry->d_name); failed++; } else { double maxfreq_ghz = (double)maxfreq/1000000.0; @@ -151,7 +158,9 @@ if (fabs(maxfreq_ghz - cpufreq_ghz) > (maxfreq_ghz * 0.005)) { failed++; - fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSpeedMismatch", + fwts_failed(fw, + LOG_LEVEL_MEDIUM, + "CPUFreqSpeedMismatch", "Maximum scaling frequency %f GHz do not match expected frequency %f GHz\n", maxfreq_ghz, cpufreq_ghz); if (!advice) { @@ -163,7 +172,7 @@ "the ACPI _PSS (Performance Supported States) object. This is described in " "section 8.4.4.2 of the APCI specification.", (double)maxfreq/1000000.0, cpunum, path, - (double)cpufreq[cpunum]/1000000.0); + (double)cpufreq[cpunum]/1000000.0); } else fwts_advice(fw, "See advice for previous CPU."); diff -Naur fwts-0.23.13/src/cpu/microcode/microcode.c fwts-0.23.23/src/cpu/microcode/microcode.c --- fwts-0.23.13/src/cpu/microcode/microcode.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/cpu/microcode/microcode.c 2011-08-31 16:09:22.000000000 +0000 @@ -59,10 +59,13 @@ char *data; fwts_microcode_info *cpu; - snprintf(path, sizeof(path), "/sys/devices/system/cpu/%s/microcode/version", entry->d_name); + snprintf(path, sizeof(path), + "/sys/devices/system/cpu/%s/microcode/version", + entry->d_name); if ((data = fwts_get(path)) == NULL) { if (!warned) { - fwts_failed(fw, LOG_LEVEL_LOW, "MicrocodeVersion", + fwts_failed(fw, LOG_LEVEL_LOW, + "MicrocodeVersion", "The kernel does not export microcode version. " "This test needs a 2.6.19-rc1 kernel or later to function"); warned++; @@ -71,12 +74,10 @@ if ((cpu = (fwts_microcode_info *)calloc(1, sizeof(fwts_microcode_info))) == NULL) { fwts_log_error(fw, "Cannot allocate memory."); break; - } strncpy(cpu->cpu, entry->d_name, 16); - cpu->version = strtoul(data, NULL, 16); + cpu->version = strtoul(data, NULL, 16); free(data); - fwts_list_append(cpus, cpu); } } @@ -104,9 +105,11 @@ (strncmp(entry->d_name,"cpu",3) == 0) && (isdigit(entry->d_name[3]))) { - snprintf(path, sizeof(path), "/sys/devices/system/cpu/%s/microcode/version", entry->d_name); + snprintf(path, sizeof(path), + "/sys/devices/system/cpu/%s/microcode/version", + entry->d_name); if ((data = fwts_get(path)) != NULL) { - version = strtoul(data, NULL, 16); + version = strtoul(data, NULL, 16); free(data); fwts_list_foreach(item, cpus) { fwts_microcode_info *cpu = fwts_list_data(fwts_microcode_info*, item); @@ -115,9 +118,12 @@ passed++; else { failed++; - fwts_failed(fw, LOG_LEVEL_LOW, "MicrocodeOutdated", + fwts_failed(fw, LOG_LEVEL_LOW, + "MicrocodeOutdated", "Cpu %s has outdated microcode (version %x while version %x is available)", - cpu->cpu, cpu->version, version); + cpu->cpu, + cpu->version, + version); } } } @@ -167,7 +173,7 @@ return FWTS_ERROR; } fwts_pipe_close(fd, pid); - + gather_info(fw, &cpus); /* now run the microcode update */ diff -Naur fwts-0.23.13/src/cpu/msr/msr.c fwts-0.23.23/src/cpu/msr/msr.c --- fwts-0.23.13/src/cpu/msr/msr.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/cpu/msr/msr.c 2011-08-31 16:09:22.000000000 +0000 @@ -24,7 +24,7 @@ static int ncpus; static bool intel_cpu; static bool amd_cpu; -fwts_cpuinfo_x86 *cpuinfo; +static fwts_cpuinfo_x86 *cpuinfo; static int msr_init(fwts_framework *fw) { @@ -80,8 +80,8 @@ } return FWTS_OK; } - -static int msr_consistent_check(fwts_framework *fw, + +static int msr_consistent_check(fwts_framework *fw, const fwts_log_level level, const char *msr_name, const uint32_t msr, @@ -89,7 +89,7 @@ const uint64_t mask, const msr_callback_check callback) { - uint64_t *vals; + uint64_t *vals; bool *inconsistent; int inconsistent_count; int cpu; @@ -103,12 +103,12 @@ free(vals); return FWTS_ERROR; } - - if (msr_consistent(msr, shift, mask, + + if (msr_consistent(msr, shift, mask, vals, &inconsistent_count, inconsistent) != FWTS_OK) { //fwts_log_info(fw, "Cannot read MSR %s (0x%x).", msr_name, msr); free(inconsistent); - free(vals); + free(vals); return FWTS_ERROR; } @@ -118,11 +118,11 @@ msr_name, (int)msr, inconsistent_count, ncpus, shift, (unsigned long long)mask); - + for (cpu=1; cpu 0x%llx vs CPU %d -> 0x%llx", - (unsigned long long)vals[0], cpu, + (unsigned long long)vals[0], cpu, (unsigned long long)vals[cpu]); } } else { @@ -137,7 +137,7 @@ free(vals); return FWTS_OK; -} +} static int msr_pstate_ratios(fwts_framework *fw) { @@ -184,7 +184,7 @@ msr_consistent_check(fw, LOG_LEVEL_HIGH, "SMRR_TYPE", 0x1f2, 0, 0x7, NULL); msr_consistent_check(fw, LOG_LEVEL_HIGH, "SMRR_PHYSMASK", 0x1f3, 12, 0xfffff, NULL); msr_consistent_check(fw, LOG_LEVEL_HIGH, "SMRR_VALID", 0x1f3, 11, 0x1, NULL); - + if (fwts_cpu_readmsr(0, 0x1f2, &val) == FWTS_OK) { uint64_t physbase = val & 0xfffff000; uint64_t type = val & 7; @@ -198,7 +198,7 @@ if (fwts_cpu_readmsr(0, 0x1f2, &val) == FWTS_OK) { uint64_t physmask = val & 0xfffff000; uint64_t valid = (val >> 11) & 1; - + if (physmask < 0x80000) { fwts_failed(fw, LOG_LEVEL_HIGH, "MSRSMRRRegion", "SMRR: region needs to be at least 8MB, SMRR_PHYSMASK = %llx.", @@ -269,7 +269,7 @@ //{ "FS_BASE", 0xc0000100, 0, ~0, NULL }, //{ "GS_BASE", 0xc0000101, 0, ~0, NULL }, { "KERNEL_GS_BASE", 0xc0000102, 0, ~0, NULL }, - { "TSC_AUX", 0xc0000103, 0, 0xffffffffULL, NULL }, + //{ "TSC_AUX", 0xc0000103, 0, 0xffffffffULL, NULL }, { "SYSCFG", 0xc0010010, 0, ~0, NULL }, { "IORRBase0", 0xc0010016, 0, ~0, NULL }, { "IORRMask0", 0xc0010017, 0, ~0, NULL }, @@ -284,7 +284,7 @@ { "Processor_Name_String", 0xc0010034, 0, ~0, NULL }, { "Processor_Name_String", 0xc0010035, 0, ~0, NULL }, { "TSC Ratio", 0xc0010104, 0, ~0, NULL }, - { "SMBASE", 0xc0010111, 0, ~0, NULL }, + //{ "SMBASE", 0xc0010111, 0, ~0, NULL }, { "SMM_ADDR", 0xc0010112, 0, ~0, NULL }, { "SMM_MASK", 0xc0010113, 0, ~0, NULL }, { "VM_CR", 0xc0010114, 0, ~0, NULL }, @@ -316,7 +316,7 @@ { "CLOCK_MODULATION", 0x0000019a, 0, 0x1fULL, NULL }, { "THERM_INTERRUPT", 0x0000019b, 0, 0x180801fULL, NULL }, //{ "THERM_STATUS", 0x0000019c, 0, 0x80000fffULL, NULL }, - { "MISC_ENABLE", 0x000001a0, 0, 0x400c51889ULL, NULL }, + { "MISC_ENABLE", 0x000001a0, 0, 0x400c51889ULL, NULL }, { "PACKAGE_THERM_INTERRUPT", 0x000001b2,0, 0x1ffff17ULL, NULL }, { "SMRR_PHYSBASE", 0x000001f2, 0, 0xfffff0ffULL, NULL }, { "SMRR_PHYSMASK", 0x000001f3, 0, 0xfffff800ULL, NULL }, @@ -533,7 +533,7 @@ } } else fwts_skipped(fw, "Non-Intel CPU, test skipped."); - + return FWTS_OK; } @@ -551,7 +551,7 @@ .description = "MSR register tests.", .init = msr_init, .deinit = msr_deinit, - .minor_tests = msr_tests + .minor_tests = msr_tests }; FWTS_REGISTER(msr, &msr_ops, FWTS_TEST_ANYTIME, FWTS_BATCH | FWTS_ROOT_PRIV); diff -Naur fwts-0.23.13/src/cpu/nx/nx.c fwts-0.23.23/src/cpu/nx/nx.c --- fwts-0.23.13/src/cpu/nx/nx.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/cpu/nx/nx.c 2011-08-31 16:09:22.000000000 +0000 @@ -39,7 +39,7 @@ fwts_cpu_free_info(fwts_nx_cpuinfo); return FWTS_OK; } - + if (strstr(fwts_nx_cpuinfo->flags," pae") == NULL) { fwts_passed(fw, "CPU is not PAE capable, so it does not have NX."); fwts_cpu_free_info(fwts_nx_cpuinfo); @@ -48,7 +48,9 @@ if ((fwts_nx_cpuinfo->x86 == -1) || (fwts_nx_cpuinfo->x86_model == -1)) { - fwts_failed(fw, LOG_LEVEL_HIGH, "NXNoCPUModel", "No model or family found for this CPU. Please check /proc/cpuinfo."); + fwts_failed(fw, LOG_LEVEL_HIGH, + "NXNoCPUModel", + "No model or family found for this CPU. Please check /proc/cpuinfo."); fwts_cpu_free_info(fwts_nx_cpuinfo); return FWTS_OK; } @@ -106,7 +108,9 @@ cpu0_has_nx = (strstr(fwts_nx_cpuinfo->flags," nx") != NULL); } else { if (cpu0_has_nx != (strstr(fwts_nx_cpuinfo->flags," nx") != NULL)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NXCPUFlagsInconsistent", "CPU%d has different NX flags to CPU0.", i); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "NXCPUFlagsInconsistent", + "CPU%d has different NX flags to CPU0.", i); failed++; } } @@ -155,7 +159,9 @@ msr_value = val; } else { if ((msr_value & nx_bit) != (val & nx_bit)) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "NXCPUFlagsInconsistent", "CPU%d has different NX flags to CPU0.", i); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "NXCPUFlagsInconsistent", + "CPU%d has different NX flags to CPU0.", i); failed++; } } diff -Naur fwts-0.23.13/src/cpu/virt/virt.c fwts-0.23.23/src/cpu/virt/virt.c --- fwts-0.23.13/src/cpu/virt/virt.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/cpu/virt/virt.c 2011-08-31 16:09:22.000000000 +0000 @@ -73,7 +73,7 @@ return FWTS_OK; } - + static fwts_framework_minor_test virt_tests[] = { { virt_test1, "Check CPU Virtualisation Configuration." }, diff -Naur fwts-0.23.13/src/cpu/virt/virt_svm.c fwts-0.23.23/src/cpu/virt/virt_svm.c --- fwts-0.23.13/src/cpu/virt/virt_svm.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/cpu/virt/virt_svm.c 2011-08-31 16:09:22.000000000 +0000 @@ -41,7 +41,7 @@ extern fwts_cpuinfo_x86 *fwts_virt_cpuinfo; -int cpu_has_svm(void) +static int cpu_has_svm(void) { return (strstr(fwts_virt_cpuinfo->flags, "svm") != NULL); } @@ -51,13 +51,13 @@ return (fwts_virt_cpuinfo->x86 & 0x10); } -int vt_locked_by_bios(void) +static int vt_locked_by_bios(void) { uint64_t msr; - + if (!can_lock_with_msr()) return 0; - + if (fwts_cpu_readmsr(0, MSR_FEATURE_CONTROL, &msr)) return -1; @@ -67,7 +67,7 @@ void virt_check_svm(fwts_framework *fw) { fwts_log_info(fw, "Check SVM Virtualization extensions are set up correctly."); - + if (!cpu_has_svm()) fwts_skipped(fw, "Processor does not support Virtualization extensions, won't test BIOS configuration, skipping test."); else { @@ -77,7 +77,9 @@ fwts_passed(fw, "Virtualization extensions supported and enabled by BIOS."); break; case 1: - fwts_failed(fw, LOG_LEVEL_MEDIUM, "VirtDisabledByBIOS", "Virtualization extensions supported but disabled by BIOS."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "VirtDisabledByBIOS", + "Virtualization extensions supported but disabled by BIOS."); break; default: fwts_log_error(fw, "Virtualization extensions check failed - cannot read msr."); diff -Naur fwts-0.23.13/src/cpu/virt/virt_vmx.c fwts-0.23.23/src/cpu/virt/virt_vmx.c --- fwts-0.23.13/src/cpu/virt/virt_vmx.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/cpu/virt/virt_vmx.c 2011-08-31 16:09:22.000000000 +0000 @@ -49,8 +49,7 @@ extern fwts_cpuinfo_x86 *fwts_virt_cpuinfo; - -int cpu_has_vmx(void) +static int cpu_has_vmx(void) { return (strstr(fwts_virt_cpuinfo->flags, "vmx") != NULL); } @@ -78,7 +77,9 @@ fwts_passed(fw, "Virtualization extensions supported and enabled by BIOS."); break; case 1: - fwts_failed(fw, LOG_LEVEL_MEDIUM, "VirtDisabledByBIOS", "Virtualization extensions supported but disabled by BIOS."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "VirtDisabledByBIOS", + "Virtualization extensions supported but disabled by BIOS."); break; default: fwts_log_error(fw, "Virtualization extensions check failed - cannot read msr."); diff -Naur fwts-0.23.13/src/dmi/dmi_decode/dmi_decode.c fwts-0.23.23/src/dmi/dmi_decode/dmi_decode.c --- fwts-0.23.13/src/dmi/dmi_decode/dmi_decode.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/dmi/dmi_decode/dmi_decode.c 2011-08-31 16:09:22.000000000 +0000 @@ -33,12 +33,13 @@ typedef struct { fwts_log_level level; - char *pat1; - char *pat2; - char *message; + const char *label; + const char *pat1; + const char *pat2; + const char *message; } dmi_pattern; -static char *dmi_types[] = { +static const char *dmi_types[] = { "BIOS", "System", "Base Board", @@ -81,18 +82,82 @@ "Power Supply" }; -static dmi_pattern dmi_patterns[] = { - { LOG_LEVEL_HIGH, "No SMBIOS nor DMI entry point found", NULL, "Check SMBIOS or DMI entry points" }, - { LOG_LEVEL_HIGH, "Wrong DMI structures count", NULL, "DMI structures count" }, - { LOG_LEVEL_HIGH, "Wrong DMI structures length",NULL, "DMI structures length" }, - { LOG_LEVEL_MEDIUM, "", NULL, "Out of spec check" }, - { LOG_LEVEL_MEDIUM, "", NULL, "Bad index check" }, - { LOG_LEVEL_HIGH, "Bad checksum! Please report.", "Bad checksum" }, - { LOG_LEVEL_LOW, "Serial Number:", "0123456789", "Template Serial Number not updated" }, - { LOG_LEVEL_LOW, "Asset Tag", "1234567890", "Template Serial Number not updated" }, - { LOG_LEVEL_LOW, "UUID:", "0A0A0A0A-0A0A-0A0A-0A0A-0A0A0A0A0A0A.", "UUID number not updated" }, - { LOG_LEVEL_LOW, "To Be Filled By O.E.M.", NULL, "Value not updated" }, - { 0, NULL, NULL, NULL } +static const dmi_pattern dmi_patterns[] = { + { + LOG_LEVEL_HIGH, + "NoSMBIOSorDMIentry", + "No SMBIOS nor DMI entry point found", + NULL, + "Check SMBIOS or DMI entry points" + }, + { + LOG_LEVEL_HIGH, + "DMIBadStructCount", + "Wrong DMI structures count", + NULL, + "DMI structures count" + }, + { + LOG_LEVEL_HIGH, + "DMIBadStructLength", + "Wrong DMI structures length", + NULL, + "DMI structures length" + }, + { + LOG_LEVEL_MEDIUM, + "DMIOutOfSpec", + "", + NULL, + "Out of spec check" + }, + { + LOG_LEVEL_MEDIUM, + "DMIBadIndex", + "", + NULL, + "Bad index check" + }, + { + LOG_LEVEL_HIGH, + "DMIChecksum", + "Bad checksum! Please report.", + NULL, + "Bad checksum" + }, + { + LOG_LEVEL_LOW, + "DMISerialNumber", + "Serial Number:", + "0123456789", + "Template Serial Number not updated" + }, + { + LOG_LEVEL_LOW, + "DMIAssetTag", + "Asset Tag", + "1234567890", + "Template Serial Number not updated" + }, + { + LOG_LEVEL_LOW, + "DMIUUID", + "UUID:", + "0A0A0A0A-0A0A-0A0A-0A0A-0A0A0A0A0A0A.", + "UUID number not updated" + }, + { + LOG_LEVEL_LOW, + "DMIBadDefault", + "To Be Filled By O.E.M.", + NULL, + "Value not updated" + }, + { 0, + NULL, + NULL, + NULL + } }; static int dmi_decode_init(fwts_framework *fw) @@ -113,7 +178,8 @@ int dumped = 0; char buffer[PATH_MAX]; - snprintf(buffer, sizeof(buffer), "%s -t %d", fw->dmidecode, type); + snprintf(buffer, sizeof(buffer), "%s -t %d", + fw->dmidecode, type); if (fwts_pipe_exec(buffer, &dmi_text)) { fwts_log_error(fw, "Failed to execute dmidecode."); @@ -137,13 +203,19 @@ (strstr(text, dmi_patterns[i].pat2) != NULL); } if (match) { - fwts_failed(fw, dmi_patterns[i].level, "DMI type %s: %s.", dmi_types[type],dmi_patterns[i].message); + fwts_failed(fw, + dmi_patterns[i].level, + dmi_patterns[i].label, + "DMI type %s: %s.", + dmi_types[type], + dmi_patterns[i].message); fwts_tag_failed(fw, FWTS_TAG_BIOS_DMI); if (!dumped) { fwts_log_info(fw, "DMI table dump:"); fwts_list_link *dump; fwts_list_foreach(dump, dmi_text) - fwts_log_info_verbatum(fw, "%s", fwts_text_list_text(dump)); + fwts_log_info_verbatum(fw, + "%s", fwts_text_list_text(dump)); dumped = 1; } } diff -Naur fwts-0.23.13/src/hotkey/hotkey/hotkey.c fwts-0.23.23/src/hotkey/hotkey/hotkey.c --- fwts-0.23.13/src/hotkey/hotkey/hotkey.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/hotkey/hotkey/hotkey.c 2011-08-31 16:09:22.000000000 +0000 @@ -34,7 +34,8 @@ static char *hotkey_dev; static char *hotkey_keymap; -static int hotkey_check_key(fwts_framework *fw, struct input_event *ev, fwts_list *hotkeys) +static int hotkey_check_key(fwts_framework *fw, + struct input_event *ev, fwts_list *hotkeys) { static int scancode = 0; fwts_list_link *item; @@ -47,10 +48,11 @@ if ((ev->type == EV_KEY) && (ev->value != 0)) { fwts_list_foreach(item, hotkeys) { - fwts_keycode *keycode = fwts_list_data(fwts_keycode*, item); + fwts_keycode *keycode = + fwts_list_data(fwts_keycode*, item); if (keycode->scancode == scancode) { fwts_printf(fw, "Scancode: 0x%2.2x Eventcode 0x%3.3x (%s) '%s'\n", - scancode, ev->code, + scancode, ev->code, keycode->keyname, keycode->keytext); found = 1; break; @@ -76,7 +78,7 @@ fwts_log_error(fw, "Cannot open device %s.", path); return FWTS_ERROR; } - + fwts_printf(fw, "Now press all the hotkeys to see if they can be identified.\n"); fwts_printf(fw, "Press to finish.\n"); @@ -88,7 +90,7 @@ while (do_test) { switch (read(fd, &ev, sizeof(ev))) { case -1: - case 0: + case 0: do_test = 0; break; default: @@ -107,7 +109,7 @@ return FWTS_ERROR; } close(fd); - + return FWTS_OK; } @@ -123,7 +125,8 @@ while ((scan_entry = readdir(scan)) != NULL) { if (strncmp("event", scan_entry->d_name, 5) == 0) { char filename[PATH_MAX]; - snprintf(filename, sizeof(filename), "input/%s", scan_entry->d_name); + snprintf(filename, sizeof(filename), + "input/%s", scan_entry->d_name); dev = strdup(filename); break; } @@ -147,7 +150,8 @@ while ((entry = readdir(dir)) != NULL) { if (strlen(entry->d_name) > 3) { - snprintf(filename, sizeof(filename), "%s/%s", path, entry->d_name); + snprintf(filename, sizeof(filename), "%s/%s", + path, entry->d_name); lstat(filename, &statbuf); if (S_ISDIR(statbuf.st_mode)) { if (!S_ISLNK(statbuf.st_mode)) @@ -165,7 +169,7 @@ } } } - + closedir(dir); return dev; @@ -175,7 +179,7 @@ { fwts_list *output; fwts_list_link *item; - + char buffer[1024]; char *keymap = NULL; diff -Naur fwts-0.23.13/src/hpet/hpet_check/hpet_check.c fwts-0.23.23/src/hpet/hpet_check/hpet_check.c --- fwts-0.23.13/src/hpet/hpet_check/hpet_check.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/hpet/hpet_check/hpet_check.c 2011-08-31 16:09:22.000000000 +0000 @@ -66,7 +66,7 @@ *idx = '\0'; address_base = strtoul(val, NULL, 0x10); - + if (hpet_base_p != 0) { if (hpet_base_p != address_base) fwts_failed(fw, LOG_LEVEL_MEDIUM, "HPETBaseMismatch", @@ -97,9 +97,9 @@ } } if (strstr(fwts_text_list_text(tmp_item), "DWordMemory") != NULL) { - tmp_item = tmp_item->next; + tmp_item = tmp_item->next; if (tmp_item != NULL) { - tmp_item = tmp_item->next; + tmp_item = tmp_item->next; if (tmp_item != NULL) { /* HPET section is found, get base */ hpet_parse_check_base(fw, table, tmp_item); @@ -162,13 +162,26 @@ "IRQ routing and initialization is also verified by the test."); fwts_list_foreach(item, klog) { - if ((strstr(fwts_text_list_text(item), "ACPI: HPET id:")) != NULL) { - char *txt = strstr(fwts_text_list_text(item), "base: "); - if (txt) - hpet_base_p = strtoul(txt+6, NULL, 0x10); - fwts_log_warning(fw, "HPET driver in the kernel is enabled, inaccurate results follow."); - fwts_passed(fw, "Found HPET base %x in kernel log.", (uint32_t)hpet_base_p); - break; + char *text = fwts_text_list_text(item); + /* Old format */ + if (strstr(text, "ACPI: HPET id:") != NULL) { + char *str = strstr(text, "base: "); + if (str) { + hpet_base_p = strtoul(str+6, NULL, 0x10); + fwts_passed(fw, "Found HPET base %x in kernel log.", (uint32_t)hpet_base_p); + break; + } + } + /* New format */ + /* [ 0.277934] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0 */ + if ((strstr(text, "hpet") != NULL) && + (strstr(text, "IRQs") != NULL)) { + char *str = strstr(text, "at MMIO "); + if (str) { + hpet_base_p = strtoul(str+8, NULL, 0x10); + fwts_passed(fw, "Found HPET base %x in kernel log.", (uint32_t)hpet_base_p); + break; + } } } diff -Naur fwts-0.23.13/src/kernel/oops/oops.c fwts-0.23.23/src/kernel/oops/oops.c --- fwts-0.23.13/src/kernel/oops/oops.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/kernel/oops/oops.c 2011-08-31 16:09:22.000000000 +0000 @@ -34,7 +34,7 @@ klog = fwts_file_open_and_read(fw->klog); else klog = fwts_klog_read(); - + if (klog == NULL) { fwts_log_error(fw, "Cannot read kernel log."); return FWTS_ERROR; @@ -50,7 +50,7 @@ } static int oops_test1(fwts_framework *fw) -{ +{ int oopses = 0; if (fwts_oops_check(fw, klog, &oopses) != FWTS_OK) { @@ -58,8 +58,9 @@ return FWTS_ERROR; } - if (oopses > 0) - fwts_failed(fw, LOG_LEVEL_CRITICAL, "KernelOops", "Found %d oopses in kernel log.", oopses); + if (oopses > 0) + fwts_failed(fw, LOG_LEVEL_CRITICAL, + "KernelOops", "Found %d oopses in kernel log.", oopses); else fwts_passed(fw, "Found no oopses in kernel log."); @@ -73,7 +74,7 @@ static fwts_framework_ops oops_ops = { .description = "Scan kernel log for Oopses.", - .init = oops_init, + .init = oops_init, .deinit = oops_deinit, .minor_tests = oops_tests }; diff -Naur fwts-0.23.13/src/kernel/version/version.c fwts-0.23.23/src/kernel/version/version.c --- fwts-0.23.13/src/kernel/version/version.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/kernel/version/version.c 2011-08-31 16:09:22.000000000 +0000 @@ -25,7 +25,8 @@ /* Following is Ubuntu specific, so don't fail */ if ((str = fwts_get("/proc/version_signature")) == NULL) - fwts_warning(fw,"Cannot get version signature info from /proc/version_signature (This is Ubuntu specific, and not necessarily a failure)."); + fwts_warning(fw, + "Cannot get version signature info from /proc/version_signature (This is Ubuntu specific, and not necessarily a failure)."); else { fwts_passed(fw, "Signature: %s", str); free(str); @@ -39,7 +40,9 @@ if ((str = fwts_get("/proc/version")) == NULL) - fwts_failed(fw, LOG_LEVEL_LOW, "KernelProcVersion", "Cannot get version info from /proc/version"); + fwts_failed(fw, LOG_LEVEL_LOW, + "KernelProcVersion", + "Cannot get version info from /proc/version"); else { fwts_passed(fw, "Kernel Version: %s", str); free(str); @@ -53,7 +56,9 @@ if (((str = fwts_get("/sys/module/acpi/parameters/acpica_version")) == NULL) && ((str = fwts_get("/proc/acpi/info")) == NULL)) - fwts_failed(fw, LOG_LEVEL_LOW, "KernelACPIVersion", "Cannot get ACPI version info from /sys/module/acpi/parameters/acpica_version or /proc/acpi/info"); + fwts_failed(fw, LOG_LEVEL_LOW, + "KernelACPIVersion", + "Cannot get ACPI version info from /sys/module/acpi/parameters/acpica_version or /proc/acpi/info"); else { fwts_passed(fw, "ACPI Version: %s", str); free(str); diff -Naur fwts-0.23.13/src/lib/include/fwts_acpi.h fwts-0.23.23/src/lib/include/fwts_acpi.h --- fwts-0.23.13/src/lib/include/fwts_acpi.h 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/lib/include/fwts_acpi.h 2011-08-31 16:09:22.000000000 +0000 @@ -122,7 +122,7 @@ uint8_t revision; uint32_t rsdt_address; uint32_t length; - uint32_t xsdt_address; + uint64_t xsdt_address; uint8_t extended_checksum; uint8_t reserved[3]; } __attribute__ ((packed)) fwts_acpi_table_rsdp; diff -Naur fwts-0.23.13/src/lib/include/fwts_acpi_tables.h fwts-0.23.23/src/lib/include/fwts_acpi_tables.h --- fwts-0.23.13/src/lib/include/fwts_acpi_tables.h 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/lib/include/fwts_acpi_tables.h 2011-08-31 16:09:22.000000000 +0000 @@ -36,5 +36,6 @@ int fwts_acpi_find_table(fwts_framework *fw, const char *name, const int which, fwts_acpi_table_info **info); int fwts_acpi_find_table_by_addr(fwts_framework *fw, const uint64_t addr, fwts_acpi_table_info **info); int fwts_acpi_get_table(fwts_framework *fw, const int index, fwts_acpi_table_info **info); +uint8_t fwts_acpi_checksum(const uint8_t *data, const int length); #endif diff -Naur fwts-0.23.13/src/lib/include/fwts_framework.h fwts-0.23.23/src/lib/include/fwts_framework.h --- fwts-0.23.13/src/lib/include/fwts_framework.h 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/lib/include/fwts_framework.h 2011-08-31 16:09:22.000000000 +0000 @@ -208,18 +208,18 @@ fwts_framework_minor_test_progress(fw, percent, message); /* Helpers to report tests results */ -#define fwts_passed(fw, args...) \ - fwts_framework_log(fw, FWTS_FRAMEWORK_PASSED, NULL, LOG_LEVEL_NONE, &fw->minor_tests.passed, ## args) -#define fwts_failed(fw, level, label, args...) \ - fwts_framework_log(fw, FWTS_FRAMEWORK_FAILED, label, level, &fw->minor_tests.failed, ## args) -#define fwts_warning(fw, args...) \ - fwts_framework_log(fw, FWTS_FRAMEWORK_WARNING, NULL, LOG_LEVEL_MEDIUM, &fw->minor_tests.warning, ## args) -#define fwts_advice(fw, args...) \ - fwts_framework_log(fw, FWTS_FRAMEWORK_ADVICE, NULL, LOG_LEVEL_NONE, NULL, ## args) -#define fwts_skipped(fw, args...) \ - fwts_framework_log(fw, FWTS_FRAMEWORK_SKIPPED, NULL, LOG_LEVEL_MEDIUM, &fw->minor_tests.skipped, ## args) -#define fwts_aborted(fw, args...) \ - fwts_framework_log(fw, FWTS_FRAMEWORK_ABORTED, NULL, LOG_LEVEL_MEDIUM, &fw->minor_tests.aborted, ## args) +#define fwts_passed(fw, fmt, args...) \ + fwts_framework_log(fw, FWTS_FRAMEWORK_PASSED, NULL, LOG_LEVEL_NONE, &fw->minor_tests.passed, fmt, ## args) +#define fwts_failed(fw, level, label, fmt, args...) \ + fwts_framework_log(fw, FWTS_FRAMEWORK_FAILED, label, level, &fw->minor_tests.failed, fmt, ## args) +#define fwts_warning(fw, fmt, args...) \ + fwts_framework_log(fw, FWTS_FRAMEWORK_WARNING, NULL, LOG_LEVEL_MEDIUM, &fw->minor_tests.warning, fmt, ## args) +#define fwts_advice(fw, fmt, args...) \ + fwts_framework_log(fw, FWTS_FRAMEWORK_ADVICE, NULL, LOG_LEVEL_NONE, NULL, fmt, ## args) +#define fwts_skipped(fw, fmt, args...) \ + fwts_framework_log(fw, FWTS_FRAMEWORK_SKIPPED, NULL, LOG_LEVEL_MEDIUM, &fw->minor_tests.skipped, fmt, ## args) +#define fwts_aborted(fw, fmt, args...) \ + fwts_framework_log(fw, FWTS_FRAMEWORK_ABORTED, NULL, LOG_LEVEL_MEDIUM, &fw->minor_tests.aborted, fmt, ## args) #define fwts_infoonly(fw) \ fwts_framework_log(fw, FWTS_FRAMEWORK_INFOONLY, NULL, LOG_LEVEL_NONE, &fw->minor_tests.infoonly, NULL) @@ -260,9 +260,9 @@ #define FWTS_REGISTER(name, ops, priority, flags) \ \ -void name ## init (void) __attribute__ ((constructor)); \ +static void name ## init (void) __attribute__ ((constructor)); \ \ -void name ## init (void) \ +static void name ## init (void) \ { \ fwts_framework_test_add(# name, ops, priority, flags); \ } \ diff -Naur fwts-0.23.13/src/lib/include/fwts_version.h fwts-0.23.23/src/lib/include/fwts_version.h --- fwts-0.23.13/src/lib/include/fwts_version.h 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/lib/include/fwts_version.h 2011-08-31 16:09:22.000000000 +0000 @@ -16,5 +16,5 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -#define FWTS_VERSION "V0.23.13" -#define FWTS_DATE "Wed Jul 27 14:18:47 BST 2011" +#define FWTS_VERSION "V0.23.23" +#define FWTS_DATE "Wed Aug 31 17:08:37 BST 2011" diff -Naur fwts-0.23.13/src/lib/src/fwts_acpi_tables.c fwts-0.23.23/src/lib/src/fwts_acpi_tables.c --- fwts-0.23.13/src/lib/src/fwts_acpi_tables.c 2011-07-18 15:48:33.000000000 +0000 +++ fwts-0.23.23/src/lib/src/fwts_acpi_tables.c 2011-08-31 16:09:22.000000000 +0000 @@ -66,7 +66,7 @@ * fwts_acpi_checksum() * table checksum */ -static uint8_t fwts_acpi_checksum(const uint8_t *data, const int length) +uint8_t fwts_acpi_checksum(const uint8_t *data, const int length) { int i; uint8_t checksum = 0; @@ -96,7 +96,7 @@ rsdp = (fwts_acpi_table_rsdp*)ptr; /* Look for RSD PTR string */ if (strncmp(rsdp->signature, "RSD PTR ",8) == 0) { - int length = (rsdp->revision < 2) ? 20 : 36; + int length = (rsdp->revision < 1) ? 20 : 36; if (fwts_acpi_checksum(ptr, length) == 0) { addr = BIOS_START+(ptr - bios); break; @@ -113,18 +113,24 @@ * given the address of the rsdp, map in the region, copy it and * return the rsdp table. Return NULL if fails. */ -static fwts_acpi_table_rsdp *fwts_acpi_get_rsdp(const uint32_t addr) +static fwts_acpi_table_rsdp *fwts_acpi_get_rsdp(const uint32_t addr, size_t *rsdp_len) { uint8_t *mem; fwts_acpi_table_rsdp *rsdp; + *rsdp_len = 0; - if ((rsdp = (fwts_acpi_table_rsdp*)fwts_low_calloc(1, sizeof(fwts_acpi_table_rsdp))) == NULL) + if ((mem = fwts_mmap(addr, sizeof(fwts_acpi_table_rsdp))) == FWTS_MAP_FAILED) return NULL; - if ((mem = fwts_mmap(addr, sizeof(fwts_acpi_table_rsdp))) == FWTS_MAP_FAILED) + /* Determine original RSDP size from revision. */ + rsdp = (fwts_acpi_table_rsdp*)mem; + *rsdp_len = (rsdp->revision < 1) ? 20 : 36; + + /* Assume version 2.0 size, we don't care about a few bytes over allocation if it's version 1.0 */ + if ((rsdp = (fwts_acpi_table_rsdp*)fwts_low_calloc(1, sizeof(fwts_acpi_table_rsdp))) == NULL) return NULL; - memcpy(rsdp, mem, sizeof(fwts_acpi_table_rsdp)); + memcpy(rsdp, mem, *rsdp_len); (void)fwts_munmap(mem, sizeof(fwts_acpi_table_rsdp)); return rsdp; @@ -250,6 +256,7 @@ fwts_acpi_table_header *header; uint64_t rsdp_addr; + size_t rsdp_len; int num_entries; int i; @@ -259,9 +266,9 @@ return FWTS_ERROR; /* Load and save cached RSDP */ - if ((rsdp = fwts_acpi_get_rsdp(rsdp_addr)) == NULL) + if ((rsdp = fwts_acpi_get_rsdp(rsdp_addr, &rsdp_len)) == NULL) return FWTS_ERROR; - fwts_acpi_add_table("RSDP", rsdp, (uint64_t)rsdp_addr, sizeof(fwts_acpi_table_rsdp)); + fwts_acpi_add_table("RSDP", rsdp, (uint64_t)rsdp_addr, rsdp_len); /* Load any tables from RSDT if it's valid */ if (rsdp->rsdt_address) { @@ -326,17 +333,35 @@ uint8_t data[16]; char buffer[80]; uint8_t *table = NULL; + char *ptr = buffer; size_t len = 0; unsigned long long table_addr; *size = 0; - if (fscanf(fp, "%15s @ 0x%Lx\n", name, &table_addr) < 2) + if (fgets(buffer, sizeof(buffer), fp) == NULL) return NULL; + for (ptr = buffer; *ptr && *ptr != '@'; ptr++) + ; + + if ((*ptr != '@') || ((ptr - buffer) < 5)) + return NULL; /* Bad name? */ + + if (sscanf(ptr, "@ 0x%Lx\n", &table_addr) < 1) + return NULL; + + *(ptr-1) = '\0'; + strcpy(name, buffer); + + /* In fwts RSD PTR is known as the RSDP */ + if (strncmp(name, "RSD PTR", 7) == 0) + strcpy(name, "RSDP"); + /* Pull in 16 bytes at a time */ while (fgets(buffer, sizeof(buffer), fp) ) { int n; + buffer[56] = '\0'; /* truncate */ if ((n = sscanf(buffer," %x: %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx %hhx", &offset, &data[0], &data[1], &data[2], &data[3], @@ -599,7 +624,7 @@ rsdp->revision = 2; rsdp->rsdt_address = (unsigned long)rsdt; rsdp->length = sizeof(fwts_acpi_table_rsdp); - rsdp->xsdt_address = (unsigned long)xsdt; + rsdp->xsdt_address = (uint64_t)(unsigned long)xsdt; rsdp->reserved[0] = 0; rsdp->reserved[1] = 0; rsdp->reserved[2] = 0; diff -Naur fwts-0.23.13/src/pci/crs/crs.c fwts-0.23.23/src/pci/crs/crs.c --- fwts-0.23.13/src/pci/crs/crs.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/pci/crs/crs.c 2011-08-31 16:09:22.000000000 +0000 @@ -36,7 +36,8 @@ } if (dmi_text == NULL) { - fwts_log_error(fw, "Failed to read output from dmidecode (out of memory)."); + fwts_log_error(fw, + "Failed to read output from dmidecode (out of memory)."); return FWTS_ERROR; } @@ -51,7 +52,7 @@ } } fwts_list_free(dmi_text, free); - + return FWTS_OK; } @@ -67,7 +68,7 @@ } if (crs_get_bios_date(fw, &day, &mon, &year) != FWTS_OK) { - fwts_log_error(fw, "Cannot determine age of BIOS."); + fwts_log_error(fw, "Cannot determine age of BIOS."); return FWTS_ERROR; } @@ -76,57 +77,65 @@ return FWTS_ERROR; } - if (fwts_klog_regex_find(fw, klog, "PCI: Ignoring host bridge windows from ACPI;") > 0) { + if (fwts_klog_regex_find(fw, klog, + "PCI: Ignoring host bridge windows from ACPI;") > 0) { if (strstr(cmdline, "pci=nocrs") != NULL) { fwts_skipped(fw, "Kernel was booted with pci=nocrs, Ignoring host bridge windows _CRS settings from ACPI, skipping test."); } else { if (year == 0) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "BIOSTooOld", - "The kernel could not determine the BIOS age " - "and has assumed that your BIOS is too old to correctly " - "specify the host bridge MMIO aperture using _CRS."); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "BIOSTooOld", + "The kernel could not determine the BIOS age " + "and has assumed that your BIOS is too old to correctly " + "specify the host bridge MMIO aperture using _CRS."); fwts_tag_failed(fw, FWTS_TAG_BIOS); fwts_log_advice(fw, "You can override this by booting with \"pci=use_crs\"."); - + } else if (year < 2008) { - fwts_passed(fw, "The kernel has detected an old BIOS (%d/%d/%d) " - "and has assumed that your BIOS is too old to correctly " - "specify the host bridge MMIO aperture using _CRS.", mon, day, year); + fwts_passed(fw, + "The kernel has detected an old BIOS (%d/%d/%d) " + "and has assumed that your BIOS is too old to correctly " + "specify the host bridge MMIO aperture using _CRS.", mon, day, year); fwts_tag_failed(fw, FWTS_TAG_BIOS); fwts_log_advice(fw, "You can override this by booting with \"pci=use_crs\"."); } else { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "HostBridgeWindows", - "The kernel is ignoring host bridge windows from ACPI for some unknown reason. " - "pci=nocrs has not been used as a boot parameter and the BIOS may be recent enough " - "to support this (%d/%d/%d)", mon, day, year); + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "HostBridgeWindows", + "The kernel is ignoring host bridge windows from ACPI for some unknown reason. " + "pci=nocrs has not been used as a boot parameter and the BIOS may be recent enough " + "to support this (%d/%d/%d)", mon, day, year); fwts_tag_failed(fw, FWTS_TAG_BIOS); } } } else if (fwts_klog_regex_find(fw, klog, "PCI: Using host bridge windows from ACPI;") > 0) { if (strstr(cmdline, "pci=use_crs") != NULL) { if (year == 0) { - fwts_failed(fw, LOG_LEVEL_MEDIUM, "BIOSNoReleaseDate", + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "BIOSNoReleaseDate", "The BIOS does not seem to have release date, hence pci=use_crs was required."); fwts_tag_failed(fw, FWTS_TAG_BIOS); } else if (year < 2008) { - fwts_passed(fw, "The BIOS is relatively old (%d/%d/%d) and hence pci=use_crs was required to " - "enable host bridge windows _CRS settings from ACPI.", mon, day, year); + fwts_passed(fw, + "The BIOS is relatively old (%d/%d/%d) and hence pci=use_crs was required to " + "enable host bridge windows _CRS settings from ACPI.", mon, day, year); fwts_tag_failed(fw, FWTS_TAG_BIOS); } else { - fwts_failed(fw, LOG_LEVEL_LOW, "BIOSSupportBridgeWindows", - "Kernel was booted with pci=use_crs but this may be uncessary as " - "the BIOS is new enough to support automatic bridge windows configuring using _CRS from ACPI. " - "However, the workaround may be necessary because _CRS is incorrect or not implemented in the " - "DSDT."); + fwts_failed(fw, LOG_LEVEL_LOW, + "BIOSSupportBridgeWindows", + "Kernel was booted with pci=use_crs but this may be uncessary as " + "the BIOS is new enough to support automatic bridge windows configuring using _CRS from ACPI. " + "However, the workaround may be necessary because _CRS is incorrect or not implemented in the " + "DSDT."); fwts_tag_failed(fw, FWTS_TAG_BIOS); } } else { - fwts_passed(fw, "The kernel has detected a BIOS newer than the end of 2007 (%d/%d/%d) " - "and has assumed that your BIOS can correctly " - "specify the host bridge MMIO aperture using _CRS. If this does not work " - "correctly you can override this by booting with \"pci=nocrs\".", mon, day, year); + fwts_passed(fw, + "The kernel has detected a BIOS newer than the end of 2007 (%d/%d/%d) " + "and has assumed that your BIOS can correctly " + "specify the host bridge MMIO aperture using _CRS. If this does not work " + "correctly you can override this by booting with \"pci=nocrs\".", mon, day, year); } } else { fwts_skipped(fw, "Cannot find host bridge message in kernel log, skipping test."); diff -Naur fwts-0.23.13/src/pci/maxreadreq/maxreadreq.c fwts-0.23.23/src/pci/maxreadreq/maxreadreq.c --- fwts-0.23.13/src/pci/maxreadreq/maxreadreq.c 2011-07-28 15:13:43.000000000 +0000 +++ fwts-0.23.23/src/pci/maxreadreq/maxreadreq.c 2011-08-31 16:09:22.000000000 +0000 @@ -30,7 +30,7 @@ #include #include -/* +/* * This test checks if MaxReadReq is set > 128 for non-internal stuff * A too low value hurts performance */ @@ -51,7 +51,7 @@ fwts_log_error(fw, "Unexpected empty output from lspci -vvv."); return FWTS_ERROR; } - + return FWTS_OK; } @@ -64,7 +64,7 @@ } static int maxreadreq_test1(fwts_framework *fw) -{ +{ int warnings = 0; char current_type[512]; char current_device[512]; @@ -81,40 +81,45 @@ if (line[0]!=' ' && line[0] != '\t' && strlen(line)>8) { if (strlen(line) > 500){ - fwts_log_warning(fw, "Too big pci string would overflow " - "current_device buffer Internal plugin, " - "not a firmware bug."); + fwts_log_warning(fw, + "Too big pci string would overflow " + "current_device buffer Internal " + "plugin, not a firmware bug."); break; } snprintf(current_device, sizeof(current_device), "pci://00:%s", line); strncpy(current_type, line+8, 511); c = strchr(current_type, ':'); - if (c) + if (c) *c='\0'; } /* chipset devices are exempt from this check */ if (strcmp(current_type, "PCI bridge")==0) - continue; + continue; if (strcmp(current_type, "Host bridge")==0) - continue; + continue; if (strcmp(current_type, "System peripheral")==0) - continue; + continue; c = strstr(line, "MaxReadReq "); if (c) { c += 11; val = strtoul(c, NULL, 10); if (val <= 128) { - fwts_log_warning(fw, "MaxReadReq for %s is low (%d) [%s].", current_device, val, current_type); + fwts_log_warning(fw, + "MaxReadReq for %s is low (%d) [%s].", + current_device, val, current_type); warnings++; } } } if (warnings > 0) { - fwts_failed(fw, LOG_LEVEL_LOW, "LowMaxReadReq", "%d devices have low MaxReadReq settings. " - "Firmware may have configured these too low.", - warnings); + fwts_failed(fw, LOG_LEVEL_LOW, + "LowMaxReadReq", + "%d devices have low MaxReadReq settings. " + "Firmware may have configured these too low.", + warnings); fwts_tag_failed(fw, FWTS_TAG_BIOS); } else fwts_passed(fw, "All devices have MaxReadReq set > 128."); @@ -129,7 +134,7 @@ static fwts_framework_ops maxreadreq_ops = { .description = "Checks firmware has set PCI Express MaxReadReq to a higher value on non-motherboard devices.", - .init = maxreadreq_init, + .init = maxreadreq_init, .deinit = maxreadreq_deinit, .minor_tests = maxreadreq_tests };