diff mbox

Since aspm is a test, move it out of the fwts core library

Message ID 1326897245-9472-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Jan. 18, 2012, 2:34 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 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

Comments

Keng-Yu Lin Jan. 19, 2012, 9:40 a.m. UTC | #1
On Wed, Jan 18, 2012 at 10:34 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  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 <stdlib.h>
> -#include <stdio.h>
> -#include <errno.h>
> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <sys/wait.h>
> -#include <unistd.h>
> -#include <string.h>
> -#include <fcntl.h>
> -#include <limits.h>
> -#include <linux/pci.h>
> -
> -#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 <stdlib.h>
> +#include <stdio.h>
> +#include <errno.h>
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <sys/wait.h>
> +#include <unistd.h>
> +#include <string.h>
> +#include <fcntl.h>
> +#include <limits.h>
> +#include <linux/pci.h>
> +
> +#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);
> --
> 1.7.8.3

Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung Jan. 19, 2012, 10:35 a.m. UTC | #2
On 01/18/2012 10:34 PM, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> Signed-off-by: Colin Ian King<colin.king@canonical.com>
> ---
>   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<stdlib.h>
> -#include<stdio.h>
> -#include<errno.h>
> -#include<sys/types.h>
> -#include<sys/stat.h>
> -#include<sys/wait.h>
> -#include<unistd.h>
> -#include<string.h>
> -#include<fcntl.h>
> -#include<limits.h>
> -#include<linux/pci.h>
> -
> -#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<stdlib.h>
> +#include<stdio.h>
> +#include<errno.h>
> +#include<sys/types.h>
> +#include<sys/stat.h>
> +#include<sys/wait.h>
> +#include<unistd.h>
> +#include<string.h>
> +#include<fcntl.h>
> +#include<limits.h>
> +#include<linux/pci.h>
> +
> +#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);
Acked-by: Alex Hung <alex.hung@canonical.com>
diff mbox

Patch

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 <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <linux/pci.h>
-
-#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 <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <string.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <linux/pci.h>
+
+#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);