aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>2013-06-05 14:52:20 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-06-20 03:05:02 -0400
commita5e4797b0f46819a74a7233825137ed5d2f51b51 (patch)
tree2b7df1fd50f6b046a259eb21d046c70dbb70a1d2
parentf33f748c964f6a6ee272b1c794b52f54f4da1d04 (diff)
powerpc/pseries: Read common partition via pstore
This patch exploits pstore subsystem to read details of common partition in NVRAM to a separate file in /dev/pstore. For instance, common partition details will be stored in a file named [common-nvram-6]. Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com> Reviewed-by: Jim Keniston <jkenisto@us.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c17
-rw-r--r--fs/pstore/inode.c3
-rw-r--r--include/linux/pstore.h1
3 files changed, 20 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index f7392f6ea7b3..14cc486709f6 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -138,10 +138,17 @@ static struct nvram_os_partition of_config_partition = {
138 .os_partition = false 138 .os_partition = false
139}; 139};
140 140
141static struct nvram_os_partition common_partition = {
142 .name = "common",
143 .index = -1,
144 .os_partition = false
145};
146
141static enum pstore_type_id nvram_type_ids[] = { 147static enum pstore_type_id nvram_type_ids[] = {
142 PSTORE_TYPE_DMESG, 148 PSTORE_TYPE_DMESG,
143 PSTORE_TYPE_PPC_RTAS, 149 PSTORE_TYPE_PPC_RTAS,
144 PSTORE_TYPE_PPC_OF, 150 PSTORE_TYPE_PPC_OF,
151 PSTORE_TYPE_PPC_COMMON,
145 -1 152 -1
146}; 153};
147static int read_type; 154static int read_type;
@@ -530,7 +537,7 @@ static int nvram_pstore_write(enum pstore_type_id type,
530} 537}
531 538
532/* 539/*
533 * Reads the oops/panic report, rtas and of-config partition. 540 * Reads the oops/panic report, rtas, of-config and common partition.
534 * Returns the length of the data we read from each partition. 541 * Returns the length of the data we read from each partition.
535 * Returns 0 if we've been called before. 542 * Returns 0 if we've been called before.
536 */ 543 */
@@ -566,6 +573,14 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
566 time->tv_sec = 0; 573 time->tv_sec = 0;
567 time->tv_nsec = 0; 574 time->tv_nsec = 0;
568 break; 575 break;
576 case PSTORE_TYPE_PPC_COMMON:
577 sig = NVRAM_SIG_SYS;
578 part = &common_partition;
579 *type = PSTORE_TYPE_PPC_COMMON;
580 *id = PSTORE_TYPE_PPC_COMMON;
581 time->tv_sec = 0;
582 time->tv_nsec = 0;
583 break;
569 default: 584 default:
570 return 0; 585 return 0;
571 } 586 }
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 73148aef9e31..08c3d76b24ca 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -330,6 +330,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
330 case PSTORE_TYPE_PPC_OF: 330 case PSTORE_TYPE_PPC_OF:
331 sprintf(name, "powerpc-ofw-%s-%lld", psname, id); 331 sprintf(name, "powerpc-ofw-%s-%lld", psname, id);
332 break; 332 break;
333 case PSTORE_TYPE_PPC_COMMON:
334 sprintf(name, "powerpc-common-%s-%lld", psname, id);
335 break;
333 case PSTORE_TYPE_UNKNOWN: 336 case PSTORE_TYPE_UNKNOWN:
334 sprintf(name, "unknown-%s-%lld", psname, id); 337 sprintf(name, "unknown-%s-%lld", psname, id);
335 break; 338 break;
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 615dc18638b8..656699fcc7d7 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -38,6 +38,7 @@ enum pstore_type_id {
38 /* PPC64 partition types */ 38 /* PPC64 partition types */
39 PSTORE_TYPE_PPC_RTAS = 4, 39 PSTORE_TYPE_PPC_RTAS = 4,
40 PSTORE_TYPE_PPC_OF = 5, 40 PSTORE_TYPE_PPC_OF = 5,
41 PSTORE_TYPE_PPC_COMMON = 6,
41 PSTORE_TYPE_UNKNOWN = 255 42 PSTORE_TYPE_UNKNOWN = 255
42}; 43};
43 44