diff mbox

acpi: crsdump, prsdump: add support for _PRS dumping (LP: #1265827)

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

Commit Message

Colin Ian King Jan. 3, 2014, 2:59 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Since _PRS dumping is essentially the same as _CRS dumping, add
a new prsdump utility by sharing the same _CRS core code.

This change also includes a minor addition to dump out the IRQ
masks as a list of IRQs.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/Makefile.am            |  1 +
 src/acpi/crsdump/crsdump.c | 47 ++++++++++++++++++++++++++++-----
 src/acpi/crsdump/crsdump.h | 26 ++++++++++++++++++
 src/acpi/crsdump/prsdump.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 133 insertions(+), 7 deletions(-)
 create mode 100644 src/acpi/crsdump/crsdump.h
 create mode 100644 src/acpi/crsdump/prsdump.c

Comments

Alex Hung Jan. 6, 2014, 7:13 a.m. UTC | #1
On 01/03/2014 10:59 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Since _PRS dumping is essentially the same as _CRS dumping, add
> a new prsdump utility by sharing the same _CRS core code.
>
> This change also includes a minor addition to dump out the IRQ
> masks as a list of IRQs.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/Makefile.am            |  1 +
>   src/acpi/crsdump/crsdump.c | 47 ++++++++++++++++++++++++++++-----
>   src/acpi/crsdump/crsdump.h | 26 ++++++++++++++++++
>   src/acpi/crsdump/prsdump.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++
>   4 files changed, 133 insertions(+), 7 deletions(-)
>   create mode 100644 src/acpi/crsdump/crsdump.h
>   create mode 100644 src/acpi/crsdump/prsdump.c
>
> diff --git a/src/Makefile.am b/src/Makefile.am
> index c4a5f40..df685d5 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -30,6 +30,7 @@ fwts_SOURCES = main.c 				\
>   	acpi/brightness/autobrightness.c 	\
>   	acpi/checksum/checksum.c 		\
>   	acpi/crsdump/crsdump.c			\
> +	acpi/crsdump/prsdump.c			\
>   	acpi/cstates/cstates.c 			\
>   	acpi/dmar/dmar.c 			\
>   	acpi/fadt/fadt.c 			\
> diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
> index 334efa8..b1b5209 100644
> --- a/src/acpi/crsdump/crsdump.c
> +++ b/src/acpi/crsdump/crsdump.c
> @@ -27,6 +27,7 @@
>   /* acpica headers */
>   #include "acpi.h"
>   #include "fwts_acpi_object_eval.h"
> +#include "crsdump.h"
>
>   typedef struct {
>   	const char *label;				/* Field label */
> @@ -303,6 +304,31 @@ static const char *crs_pin_configuration(const uint64_t val)
>   }
>
>   /*
> + *  Convert IRQ mask into list of IRQs
> + */
> +static const char *crs_irq_map(const uint64_t val)
> +{
> +	unsigned int i;
> +	static char buf[6 + (32 * 4)];
> +	char tmp[5];
> +	const size_t n = sizeof(buf) - 1;
> +
> +	strncpy(buf, "IRQ:", n);
> +
> +	if (!val) {
> +		strncat(buf, " none", n);
> +	} else {
> +		for (i = 0; i < 32; i++) {
> +			if (val & (1 << i)) {
> +				snprintf(tmp, sizeof(tmp), " %u", i);
> +				strncat(buf, tmp, n);
> +			}
> +		}
> +	}
> +	return buf;
> +}
> +
> +/*
>    *  CRS small resource checks, simple checking
>    */
>   static void crsdump_small_resource_items(
> @@ -345,7 +371,7 @@ static void crsdump_small_resource_items(
>   			};
>
>   			static const crsdump_info info[] = {
> -				CRS_UINT("IRQ Mask",		1, 16),
> +				CRS_UINTX("IRQ Mask",		1, 16, crs_irq_map),
>   				CRS_BITS("Reserved",		3, 128 | 64),
>   				CRS_BITX("Interrupt Sharing",	3, 32 | 16, sharing),
>   				CRS_BITX("Interrupt Polarity",	3, 8, polarity),
> @@ -829,11 +855,13 @@ static void crsdump_large_resource_items(
>   	fwts_log_nl(fw);
>   }
>
> -static int crsdump_test1(fwts_framework *fw)
> +
> +
> +int resource_dump(fwts_framework *fw, const char *objname)
>   {
>   	fwts_list_link	*item;
>   	fwts_list *objects;
> -	const size_t name_len = 4;
> +	const size_t name_len = strlen(objname);
>
>   	if ((objects = fwts_acpi_object_get_names()) == NULL) {
>   		fwts_log_info(fw, "Cannot find any ACPI objects");
> @@ -843,7 +871,7 @@ static int crsdump_test1(fwts_framework *fw)
>   	fwts_list_foreach(item, objects) {
>   		char *name = fwts_list_data(char*, item);
>   		const size_t len = strlen(name);
> -		if (strncmp("_CRS", name + len - name_len, name_len) == 0) {
> +		if (strncmp(objname, name + len - name_len, name_len) == 0) {
>   			ACPI_OBJECT_LIST arg_list;
>   			ACPI_BUFFER buf;
>   			ACPI_OBJECT *obj;
> @@ -857,7 +885,7 @@ static int crsdump_test1(fwts_framework *fw)
>   			if ((ACPI_FAILURE(ret) != AE_OK) || (buf.Pointer == NULL))
>   				continue;
>
> -			/*  Do we have a valid _CRS buffer to dump? */
> +			/*  Do we have a valid resource buffer to dump? */
>   			obj = buf.Pointer;
>   			if ((obj->Type == ACPI_TYPE_BUFFER) &&
>   			    (obj->Buffer.Pointer != NULL) &&
> @@ -875,13 +903,18 @@ static int crsdump_test1(fwts_framework *fw)
>   	return FWTS_OK;
>   }
>
> +static int crsdump_test1(fwts_framework *fw)
> +{
> +	return resource_dump(fw, "_CRS");
> +}
> +
>   static fwts_framework_minor_test crsdump_tests[] = {
> -	{ crsdump_test1, "Dump ACPI _CRS buffers." },
> +	{ crsdump_test1, "Dump ACPI _CRS (Current Resource Settings)." },
>   	{ NULL, NULL }
>   };
>
>   static fwts_framework_ops crsdump_ops = {
> -	.description = "Dump ACPI _CRS buffers.",
> +	.description = "Dump ACPI _CRS resources.",
>   	.init        = crsdump_init,
>   	.deinit      = crsdump_deinit,
>   	.minor_tests = crsdump_tests
> diff --git a/src/acpi/crsdump/crsdump.h b/src/acpi/crsdump/crsdump.h
> new file mode 100644
> index 0000000..ff93dc7
> --- /dev/null
> +++ b/src/acpi/crsdump/crsdump.h
> @@ -0,0 +1,26 @@
> +/*
> + * Copyright (C) 2014 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 __CRSDUMP_H__
> +#define __CRSDUMP_H__
> +
> +#include "fwts.h"
> +
> +extern int resource_dump(fwts_framework *fw, const char *objname);
> +
> +#endif
> diff --git a/src/acpi/crsdump/prsdump.c b/src/acpi/crsdump/prsdump.c
> new file mode 100644
> index 0000000..d1009af
> --- /dev/null
> +++ b/src/acpi/crsdump/prsdump.c
> @@ -0,0 +1,66 @@
> +/*
> + * Copyright (C) 2014 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 "fwts.h"
> +
> +/* acpica headers */
> +#include "acpi.h"
> +#include "fwts_acpi_object_eval.h"
> +#include "crsdump.h"
> +
> +/*
> + *  prsdump_init()
> + *	initialize ACPI
> + */
> +static int prsdump_init(fwts_framework *fw)
> +{
> +	if (fwts_acpi_init(fw) != FWTS_OK) {
> +		fwts_log_error(fw, "Cannot initialise ACPI.");
> +		return FWTS_ERROR;
> +	}
> +
> +	return FWTS_OK;
> +}
> +
> +/*
> + *  prsdump_deinit
> + *	de-intialize ACPI
> + */
> +static int prsdump_deinit(fwts_framework *fw)
> +{
> +	return fwts_acpi_deinit(fw);
> +}
> +
> +static int prsdump_test1(fwts_framework *fw)
> +{
> +	return resource_dump(fw, "_PRS");
> +}
> +
> +static fwts_framework_minor_test prsdump_tests[] = {
> +	{ prsdump_test1, "Dump ACPI _PRS (Possible Resource Settings)." },
> +	{ NULL, NULL }
> +};
> +
> +static fwts_framework_ops prsdump_ops = {
> +	.description = "Dump ACPI _PRS resources.",
> +	.init        = prsdump_init,
> +	.deinit      = prsdump_deinit,
> +	.minor_tests = prsdump_tests
> +};
> +
> +FWTS_REGISTER("prsdump", &prsdump_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_UTILS);
>

Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu Jan. 6, 2014, 8:38 a.m. UTC | #2
On 01/03/2014 10:59 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Since _PRS dumping is essentially the same as _CRS dumping, add
> a new prsdump utility by sharing the same _CRS core code.
>
> This change also includes a minor addition to dump out the IRQ
> masks as a list of IRQs.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/Makefile.am            |  1 +
>   src/acpi/crsdump/crsdump.c | 47 ++++++++++++++++++++++++++++-----
>   src/acpi/crsdump/crsdump.h | 26 ++++++++++++++++++
>   src/acpi/crsdump/prsdump.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++
>   4 files changed, 133 insertions(+), 7 deletions(-)
>   create mode 100644 src/acpi/crsdump/crsdump.h
>   create mode 100644 src/acpi/crsdump/prsdump.c
>
> diff --git a/src/Makefile.am b/src/Makefile.am
> index c4a5f40..df685d5 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -30,6 +30,7 @@ fwts_SOURCES = main.c 				\
>   	acpi/brightness/autobrightness.c 	\
>   	acpi/checksum/checksum.c 		\
>   	acpi/crsdump/crsdump.c			\
> +	acpi/crsdump/prsdump.c			\
>   	acpi/cstates/cstates.c 			\
>   	acpi/dmar/dmar.c 			\
>   	acpi/fadt/fadt.c 			\
> diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
> index 334efa8..b1b5209 100644
> --- a/src/acpi/crsdump/crsdump.c
> +++ b/src/acpi/crsdump/crsdump.c
> @@ -27,6 +27,7 @@
>   /* acpica headers */
>   #include "acpi.h"
>   #include "fwts_acpi_object_eval.h"
> +#include "crsdump.h"
>
>   typedef struct {
>   	const char *label;				/* Field label */
> @@ -303,6 +304,31 @@ static const char *crs_pin_configuration(const uint64_t val)
>   }
>
>   /*
> + *  Convert IRQ mask into list of IRQs
> + */
> +static const char *crs_irq_map(const uint64_t val)
> +{
> +	unsigned int i;
> +	static char buf[6 + (32 * 4)];
> +	char tmp[5];
> +	const size_t n = sizeof(buf) - 1;
> +
> +	strncpy(buf, "IRQ:", n);
> +
> +	if (!val) {
> +		strncat(buf, " none", n);
> +	} else {
> +		for (i = 0; i < 32; i++) {
> +			if (val & (1 << i)) {
> +				snprintf(tmp, sizeof(tmp), " %u", i);
> +				strncat(buf, tmp, n);
> +			}
> +		}
> +	}
> +	return buf;
> +}
> +
> +/*
>    *  CRS small resource checks, simple checking
>    */
>   static void crsdump_small_resource_items(
> @@ -345,7 +371,7 @@ static void crsdump_small_resource_items(
>   			};
>
>   			static const crsdump_info info[] = {
> -				CRS_UINT("IRQ Mask",		1, 16),
> +				CRS_UINTX("IRQ Mask",		1, 16, crs_irq_map),
>   				CRS_BITS("Reserved",		3, 128 | 64),
>   				CRS_BITX("Interrupt Sharing",	3, 32 | 16, sharing),
>   				CRS_BITX("Interrupt Polarity",	3, 8, polarity),
> @@ -829,11 +855,13 @@ static void crsdump_large_resource_items(
>   	fwts_log_nl(fw);
>   }
>
> -static int crsdump_test1(fwts_framework *fw)
> +
> +
> +int resource_dump(fwts_framework *fw, const char *objname)
>   {
>   	fwts_list_link	*item;
>   	fwts_list *objects;
> -	const size_t name_len = 4;
> +	const size_t name_len = strlen(objname);
>
>   	if ((objects = fwts_acpi_object_get_names()) == NULL) {
>   		fwts_log_info(fw, "Cannot find any ACPI objects");
> @@ -843,7 +871,7 @@ static int crsdump_test1(fwts_framework *fw)
>   	fwts_list_foreach(item, objects) {
>   		char *name = fwts_list_data(char*, item);
>   		const size_t len = strlen(name);
> -		if (strncmp("_CRS", name + len - name_len, name_len) == 0) {
> +		if (strncmp(objname, name + len - name_len, name_len) == 0) {
>   			ACPI_OBJECT_LIST arg_list;
>   			ACPI_BUFFER buf;
>   			ACPI_OBJECT *obj;
> @@ -857,7 +885,7 @@ static int crsdump_test1(fwts_framework *fw)
>   			if ((ACPI_FAILURE(ret) != AE_OK) || (buf.Pointer == NULL))
>   				continue;
>
> -			/*  Do we have a valid _CRS buffer to dump? */
> +			/*  Do we have a valid resource buffer to dump? */
>   			obj = buf.Pointer;
>   			if ((obj->Type == ACPI_TYPE_BUFFER) &&
>   			    (obj->Buffer.Pointer != NULL) &&
> @@ -875,13 +903,18 @@ static int crsdump_test1(fwts_framework *fw)
>   	return FWTS_OK;
>   }
>
> +static int crsdump_test1(fwts_framework *fw)
> +{
> +	return resource_dump(fw, "_CRS");
> +}
> +
>   static fwts_framework_minor_test crsdump_tests[] = {
> -	{ crsdump_test1, "Dump ACPI _CRS buffers." },
> +	{ crsdump_test1, "Dump ACPI _CRS (Current Resource Settings)." },
>   	{ NULL, NULL }
>   };
>
>   static fwts_framework_ops crsdump_ops = {
> -	.description = "Dump ACPI _CRS buffers.",
> +	.description = "Dump ACPI _CRS resources.",
>   	.init        = crsdump_init,
>   	.deinit      = crsdump_deinit,
>   	.minor_tests = crsdump_tests
> diff --git a/src/acpi/crsdump/crsdump.h b/src/acpi/crsdump/crsdump.h
> new file mode 100644
> index 0000000..ff93dc7
> --- /dev/null
> +++ b/src/acpi/crsdump/crsdump.h
> @@ -0,0 +1,26 @@
> +/*
> + * Copyright (C) 2014 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 __CRSDUMP_H__
> +#define __CRSDUMP_H__
> +
> +#include "fwts.h"
> +
> +extern int resource_dump(fwts_framework *fw, const char *objname);
> +
> +#endif
> diff --git a/src/acpi/crsdump/prsdump.c b/src/acpi/crsdump/prsdump.c
> new file mode 100644
> index 0000000..d1009af
> --- /dev/null
> +++ b/src/acpi/crsdump/prsdump.c
> @@ -0,0 +1,66 @@
> +/*
> + * Copyright (C) 2014 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 "fwts.h"
> +
> +/* acpica headers */
> +#include "acpi.h"
> +#include "fwts_acpi_object_eval.h"
> +#include "crsdump.h"
> +
> +/*
> + *  prsdump_init()
> + *	initialize ACPI
> + */
> +static int prsdump_init(fwts_framework *fw)
> +{
> +	if (fwts_acpi_init(fw) != FWTS_OK) {
> +		fwts_log_error(fw, "Cannot initialise ACPI.");
> +		return FWTS_ERROR;
> +	}
> +
> +	return FWTS_OK;
> +}
> +
> +/*
> + *  prsdump_deinit
> + *	de-intialize ACPI
> + */
> +static int prsdump_deinit(fwts_framework *fw)
> +{
> +	return fwts_acpi_deinit(fw);
> +}
> +
> +static int prsdump_test1(fwts_framework *fw)
> +{
> +	return resource_dump(fw, "_PRS");
> +}
> +
> +static fwts_framework_minor_test prsdump_tests[] = {
> +	{ prsdump_test1, "Dump ACPI _PRS (Possible Resource Settings)." },
> +	{ NULL, NULL }
> +};
> +
> +static fwts_framework_ops prsdump_ops = {
> +	.description = "Dump ACPI _PRS resources.",
> +	.init        = prsdump_init,
> +	.deinit      = prsdump_deinit,
> +	.minor_tests = prsdump_tests
> +};
> +
> +FWTS_REGISTER("prsdump", &prsdump_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_UTILS);
>


Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox

Patch

diff --git a/src/Makefile.am b/src/Makefile.am
index c4a5f40..df685d5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,6 +30,7 @@  fwts_SOURCES = main.c 				\
 	acpi/brightness/autobrightness.c 	\
 	acpi/checksum/checksum.c 		\
 	acpi/crsdump/crsdump.c			\
+	acpi/crsdump/prsdump.c			\
 	acpi/cstates/cstates.c 			\
 	acpi/dmar/dmar.c 			\
 	acpi/fadt/fadt.c 			\
diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c
index 334efa8..b1b5209 100644
--- a/src/acpi/crsdump/crsdump.c
+++ b/src/acpi/crsdump/crsdump.c
@@ -27,6 +27,7 @@ 
 /* acpica headers */
 #include "acpi.h"
 #include "fwts_acpi_object_eval.h"
+#include "crsdump.h"
 
 typedef struct {
 	const char *label;				/* Field label */
@@ -303,6 +304,31 @@  static const char *crs_pin_configuration(const uint64_t val)
 }
 
 /*
+ *  Convert IRQ mask into list of IRQs
+ */
+static const char *crs_irq_map(const uint64_t val)
+{
+	unsigned int i;
+	static char buf[6 + (32 * 4)];
+	char tmp[5];
+	const size_t n = sizeof(buf) - 1;
+
+	strncpy(buf, "IRQ:", n);
+
+	if (!val) {
+		strncat(buf, " none", n);
+	} else {
+		for (i = 0; i < 32; i++) {
+			if (val & (1 << i)) {
+				snprintf(tmp, sizeof(tmp), " %u", i);
+				strncat(buf, tmp, n);
+			}
+		}
+	}
+	return buf;
+}
+
+/*
  *  CRS small resource checks, simple checking
  */
 static void crsdump_small_resource_items(
@@ -345,7 +371,7 @@  static void crsdump_small_resource_items(
 			};
 
 			static const crsdump_info info[] = {
-				CRS_UINT("IRQ Mask",		1, 16),
+				CRS_UINTX("IRQ Mask",		1, 16, crs_irq_map),
 				CRS_BITS("Reserved",		3, 128 | 64),
 				CRS_BITX("Interrupt Sharing",	3, 32 | 16, sharing),
 				CRS_BITX("Interrupt Polarity",	3, 8, polarity),
@@ -829,11 +855,13 @@  static void crsdump_large_resource_items(
 	fwts_log_nl(fw);
 }
 
-static int crsdump_test1(fwts_framework *fw)
+
+
+int resource_dump(fwts_framework *fw, const char *objname)
 {
 	fwts_list_link	*item;
 	fwts_list *objects;
-	const size_t name_len = 4;
+	const size_t name_len = strlen(objname);
 
 	if ((objects = fwts_acpi_object_get_names()) == NULL) {
 		fwts_log_info(fw, "Cannot find any ACPI objects");
@@ -843,7 +871,7 @@  static int crsdump_test1(fwts_framework *fw)
 	fwts_list_foreach(item, objects) {
 		char *name = fwts_list_data(char*, item);
 		const size_t len = strlen(name);
-		if (strncmp("_CRS", name + len - name_len, name_len) == 0) {
+		if (strncmp(objname, name + len - name_len, name_len) == 0) {
 			ACPI_OBJECT_LIST arg_list;
 			ACPI_BUFFER buf;
 			ACPI_OBJECT *obj;
@@ -857,7 +885,7 @@  static int crsdump_test1(fwts_framework *fw)
 			if ((ACPI_FAILURE(ret) != AE_OK) || (buf.Pointer == NULL))
 				continue;
 
-			/*  Do we have a valid _CRS buffer to dump? */
+			/*  Do we have a valid resource buffer to dump? */
 			obj = buf.Pointer;
 			if ((obj->Type == ACPI_TYPE_BUFFER) &&
 			    (obj->Buffer.Pointer != NULL) &&
@@ -875,13 +903,18 @@  static int crsdump_test1(fwts_framework *fw)
 	return FWTS_OK;
 }
 
+static int crsdump_test1(fwts_framework *fw)
+{
+	return resource_dump(fw, "_CRS");
+}
+
 static fwts_framework_minor_test crsdump_tests[] = {
-	{ crsdump_test1, "Dump ACPI _CRS buffers." },
+	{ crsdump_test1, "Dump ACPI _CRS (Current Resource Settings)." },
 	{ NULL, NULL }
 };
 
 static fwts_framework_ops crsdump_ops = {
-	.description = "Dump ACPI _CRS buffers.",
+	.description = "Dump ACPI _CRS resources.",
 	.init        = crsdump_init,
 	.deinit      = crsdump_deinit,
 	.minor_tests = crsdump_tests
diff --git a/src/acpi/crsdump/crsdump.h b/src/acpi/crsdump/crsdump.h
new file mode 100644
index 0000000..ff93dc7
--- /dev/null
+++ b/src/acpi/crsdump/crsdump.h
@@ -0,0 +1,26 @@ 
+/*
+ * Copyright (C) 2014 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 __CRSDUMP_H__
+#define __CRSDUMP_H__
+
+#include "fwts.h"
+
+extern int resource_dump(fwts_framework *fw, const char *objname);
+
+#endif
diff --git a/src/acpi/crsdump/prsdump.c b/src/acpi/crsdump/prsdump.c
new file mode 100644
index 0000000..d1009af
--- /dev/null
+++ b/src/acpi/crsdump/prsdump.c
@@ -0,0 +1,66 @@ 
+/*
+ * Copyright (C) 2014 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 "fwts.h"
+
+/* acpica headers */
+#include "acpi.h"
+#include "fwts_acpi_object_eval.h"
+#include "crsdump.h"
+
+/*
+ *  prsdump_init()
+ *	initialize ACPI
+ */
+static int prsdump_init(fwts_framework *fw)
+{
+	if (fwts_acpi_init(fw) != FWTS_OK) {
+		fwts_log_error(fw, "Cannot initialise ACPI.");
+		return FWTS_ERROR;
+	}
+
+	return FWTS_OK;
+}
+
+/*
+ *  prsdump_deinit
+ *	de-intialize ACPI
+ */
+static int prsdump_deinit(fwts_framework *fw)
+{
+	return fwts_acpi_deinit(fw);
+}
+
+static int prsdump_test1(fwts_framework *fw)
+{
+	return resource_dump(fw, "_PRS");
+}
+
+static fwts_framework_minor_test prsdump_tests[] = {
+	{ prsdump_test1, "Dump ACPI _PRS (Possible Resource Settings)." },
+	{ NULL, NULL }
+};
+
+static fwts_framework_ops prsdump_ops = {
+	.description = "Dump ACPI _PRS resources.",
+	.init        = prsdump_init,
+	.deinit      = prsdump_deinit,
+	.minor_tests = prsdump_tests
+};
+
+FWTS_REGISTER("prsdump", &prsdump_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_UTILS);