From patchwork Wed Jan 18 14:34:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 136618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 62E141007D1 for ; Thu, 19 Jan 2012 01:34:10 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RnWaX-00035u-Ig for incoming@patchwork.ozlabs.org; Wed, 18 Jan 2012 14:34:09 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RnWaV-00035S-4P for fwts-devel@lists.ubuntu.com; Wed, 18 Jan 2012 14:34:07 +0000 Received: from cpc19-craw6-2-0-cust5.croy.cable.virginmedia.com ([77.102.228.6] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1RnWaU-0007jK-M5 for fwts-devel@lists.ubuntu.com; Wed, 18 Jan 2012 14:34:07 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] Since aspm is a test, move it out of the fwts core library Date: Wed, 18 Jan 2012 14:34:05 +0000 Message-Id: <1326897245-9472-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.7.8.3 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- src/Makefile.am | 1 + src/Makefile.in | 27 ++++++++++++--- src/lib/include/fwts.h | 1 - src/lib/include/fwts_aspm.h | 28 --------------- src/lib/src/Makefile.am | 3 +- src/lib/src/fwts_aspm.c | 80 ------------------------------------------- src/pci/aspm/aspm.c | 78 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 102 insertions(+), 116 deletions(-) delete mode 100644 src/lib/include/fwts_aspm.h delete mode 100644 src/lib/src/fwts_aspm.c create mode 100644 src/pci/aspm/aspm.c diff --git a/src/Makefile.am b/src/Makefile.am index d307a51..a801805 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -53,6 +53,7 @@ fwts_SOURCES = main.c \ cmos/cmosdump/cmosdump.c \ dmi/dmi_decode/dmi_decode.c \ hpet/hpet_check/hpet_check.c \ + pci/aspm/aspm.c \ pci/crs/crs.c \ pci/maxreadreq/maxreadreq.c \ cpu/virt/virt.c cpu/virt/virt_svm.c cpu/virt/virt_vmx.c \ diff --git a/src/Makefile.in b/src/Makefile.in index 16b97c0..af710ad 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -64,11 +64,12 @@ am_fwts_OBJECTS = main.$(OBJEXT) klog.$(OBJEXT) wakealarm.$(OBJEXT) \ os2gap.$(OBJEXT) memmapdump.$(OBJEXT) mpdump.$(OBJEXT) \ mpcheck.$(OBJEXT) pciirq.$(OBJEXT) pnp.$(OBJEXT) \ smbios.$(OBJEXT) cmosdump.$(OBJEXT) dmi_decode.$(OBJEXT) \ - hpet_check.$(OBJEXT) crs.$(OBJEXT) maxreadreq.$(OBJEXT) \ - virt.$(OBJEXT) virt_svm.$(OBJEXT) virt_vmx.$(OBJEXT) \ - maxfreq.$(OBJEXT) cpufreq.$(OBJEXT) nx.$(OBJEXT) msr.$(OBJEXT) \ - microcode.$(OBJEXT) hotkey.$(OBJEXT) version.$(OBJEXT) \ - oops.$(OBJEXT) csm.$(OBJEXT) uefidump.$(OBJEXT) + hpet_check.$(OBJEXT) aspm.$(OBJEXT) crs.$(OBJEXT) \ + maxreadreq.$(OBJEXT) virt.$(OBJEXT) virt_svm.$(OBJEXT) \ + virt_vmx.$(OBJEXT) maxfreq.$(OBJEXT) cpufreq.$(OBJEXT) \ + nx.$(OBJEXT) msr.$(OBJEXT) microcode.$(OBJEXT) \ + hotkey.$(OBJEXT) version.$(OBJEXT) oops.$(OBJEXT) \ + csm.$(OBJEXT) uefidump.$(OBJEXT) fwts_OBJECTS = $(am_fwts_OBJECTS) fwts_DEPENDENCIES = fwts_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ @@ -325,6 +326,7 @@ fwts_SOURCES = main.c \ cmos/cmosdump/cmosdump.c \ dmi/dmi_decode/dmi_decode.c \ hpet/hpet_check/hpet_check.c \ + pci/aspm/aspm.c \ pci/crs/crs.c \ pci/maxreadreq/maxreadreq.c \ cpu/virt/virt.c cpu/virt/virt_svm.c cpu/virt/virt_vmx.c \ @@ -438,6 +440,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acpitables.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apicedge.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apicinstance.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aspm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/battery.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bios32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bios_info.Po@am__quote@ @@ -1115,6 +1118,20 @@ hpet_check.obj: hpet/hpet_check/hpet_check.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hpet_check.obj `if test -f 'hpet/hpet_check/hpet_check.c'; then $(CYGPATH_W) 'hpet/hpet_check/hpet_check.c'; else $(CYGPATH_W) '$(srcdir)/hpet/hpet_check/hpet_check.c'; fi` +aspm.o: pci/aspm/aspm.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT aspm.o -MD -MP -MF $(DEPDIR)/aspm.Tpo -c -o aspm.o `test -f 'pci/aspm/aspm.c' || echo '$(srcdir)/'`pci/aspm/aspm.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/aspm.Tpo $(DEPDIR)/aspm.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci/aspm/aspm.c' object='aspm.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o aspm.o `test -f 'pci/aspm/aspm.c' || echo '$(srcdir)/'`pci/aspm/aspm.c + +aspm.obj: pci/aspm/aspm.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT aspm.obj -MD -MP -MF $(DEPDIR)/aspm.Tpo -c -o aspm.obj `if test -f 'pci/aspm/aspm.c'; then $(CYGPATH_W) 'pci/aspm/aspm.c'; else $(CYGPATH_W) '$(srcdir)/pci/aspm/aspm.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/aspm.Tpo $(DEPDIR)/aspm.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pci/aspm/aspm.c' object='aspm.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o aspm.obj `if test -f 'pci/aspm/aspm.c'; then $(CYGPATH_W) 'pci/aspm/aspm.c'; else $(CYGPATH_W) '$(srcdir)/pci/aspm/aspm.c'; fi` + crs.o: pci/crs/crs.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crs.o -MD -MP -MF $(DEPDIR)/crs.Tpo -c -o crs.o `test -f 'pci/crs/crs.c' || echo '$(srcdir)/'`pci/crs/crs.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/crs.Tpo $(DEPDIR)/crs.Po diff --git a/src/lib/include/fwts.h b/src/lib/include/fwts.h index abea55a..f5602ea 100644 --- a/src/lib/include/fwts.h +++ b/src/lib/include/fwts.h @@ -75,6 +75,5 @@ #include "fwts_ac_adapter.h" #include "fwts_battery.h" #include "fwts_button.h" -#include "fwts_aspm.h" #endif diff --git a/src/lib/include/fwts_aspm.h b/src/lib/include/fwts_aspm.h deleted file mode 100644 index 91437fa..0000000 --- a/src/lib/include/fwts_aspm.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2011 Canonical - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef __FWTS_ASPM_H__ -#define __FWTS_ASPM_H__ - -#include "fwts_acpi.h" - - -int fwts_aspm_check_configuration(fwts_framework *fw); - -#endif diff --git a/src/lib/src/Makefile.am b/src/lib/src/Makefile.am index d76d4cd..2aac13e 100644 --- a/src/lib/src/Makefile.am +++ b/src/lib/src/Makefile.am @@ -56,5 +56,4 @@ libfwts_la_SOURCES = \ fwts_wakealarm.c \ fwts_ac_adapter.c \ fwts_battery.c \ - fwts_button.c \ - fwts_aspm.c + fwts_button.c diff --git a/src/lib/src/fwts_aspm.c b/src/lib/src/fwts_aspm.c deleted file mode 100644 index 8406f77..0000000 --- a/src/lib/src/fwts_aspm.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2011 Canonical - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "fwts.h" - -int fwts_facp_get_aspm_control(fwts_framework *fw, int *aspm) -{ - fwts_acpi_table_info *table; - fwts_acpi_table_fadt *fadt; - - if (fwts_acpi_find_table(fw, "FACP", 0, &table) != FWTS_OK) { - return FWTS_ERROR; - } - fadt = (fwts_acpi_table_fadt*)table->data; - - if ((fadt->iapc_boot_arch & FWTS_FACP_IAPC_BOOT_ARCH_PCIE_ASPM_CONTROLS) == 0) { - *aspm = 1; - fwts_log_info(fw, "PCIE ASPM is controlled by Linux kernel."); - } else { - *aspm = 0; - fwts_log_info(fw, "PCIE ASPM is not controlled by Linux kernel."); - } - - return FWTS_OK; -} - -int aspm_check_configuration(fwts_framework *fw) -{ - int ret; - int aspm_facp; - - ret = fwts_facp_get_aspm_control(fw, &aspm_facp); - if (ret == FWTS_ERROR) { - fwts_log_info(fw, "No valid FACP information present: cannot test aspm."); - return FWTS_ERROR; - } - - return ret; -} - - -static fwts_framework_minor_test aspm_tests[] = { - { aspm_check_configuration, "PCIe ASPM configuration test." }, - { NULL, NULL } -}; - -static fwts_framework_ops aspm_ops = { - .description = "PCIe ASPM check.", - .minor_tests = aspm_tests -}; - -FWTS_REGISTER(aspm, &aspm_ops, FWTS_TEST_ANYTIME, FWTS_BATCH); - diff --git a/src/pci/aspm/aspm.c b/src/pci/aspm/aspm.c new file mode 100644 index 0000000..c297745 --- /dev/null +++ b/src/pci/aspm/aspm.c @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2011 Canonical + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fwts.h" + +static int facp_get_aspm_control(fwts_framework *fw, int *aspm) +{ + fwts_acpi_table_info *table; + fwts_acpi_table_fadt *fadt; + + if (fwts_acpi_find_table(fw, "FACP", 0, &table) != FWTS_OK) { + return FWTS_ERROR; + } + fadt = (fwts_acpi_table_fadt*)table->data; + + if ((fadt->iapc_boot_arch & FWTS_FACP_IAPC_BOOT_ARCH_PCIE_ASPM_CONTROLS) == 0) { + *aspm = 1; + fwts_log_info(fw, "PCIE ASPM is controlled by Linux kernel."); + } else { + *aspm = 0; + fwts_log_info(fw, "PCIE ASPM is not controlled by Linux kernel."); + } + + return FWTS_OK; +} + +static int aspm_check_configuration(fwts_framework *fw) +{ + int ret; + int aspm_facp; + + ret = facp_get_aspm_control(fw, &aspm_facp); + if (ret == FWTS_ERROR) { + fwts_log_info(fw, "No valid FACP information present: cannot test aspm."); + return FWTS_ERROR; + } + + return ret; +} + +static fwts_framework_minor_test aspm_tests[] = { + { aspm_check_configuration, "PCIe ASPM configuration test." }, + { NULL, NULL } +}; + +static fwts_framework_ops aspm_ops = { + .description = "PCIe ASPM check.", + .minor_tests = aspm_tests +}; + +FWTS_REGISTER(aspm, &aspm_ops, FWTS_TEST_ANYTIME, FWTS_BATCH);