aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/nvram.c
diff options
context:
space:
mode:
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>2013-06-05 14:51:44 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-06-20 03:04:52 -0400
commit69020eea973d95766e905ee0ce7773e0027377a3 (patch)
treea95233fbe6e307ceb991722a72188428210f9067 /arch/powerpc/platforms/pseries/nvram.c
parentd7563c94f728d8c9228cfddbb044c843b2e243e8 (diff)
powerpc/pseries: Read rtas partition via pstore
This patch set exploits the pstore subsystem to read details of rtas partition in NVRAM to a separate file in /dev/pstore. For instance, rtas details will be stored in a file named [rtas-nvram-4]. 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>
Diffstat (limited to 'arch/powerpc/platforms/pseries/nvram.c')
-rw-r--r--arch/powerpc/platforms/pseries/nvram.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c
index 9edec8ee02ef..78d72f0175ad 100644
--- a/arch/powerpc/platforms/pseries/nvram.c
+++ b/arch/powerpc/platforms/pseries/nvram.c
@@ -131,9 +131,11 @@ static struct z_stream_s stream;
131#ifdef CONFIG_PSTORE 131#ifdef CONFIG_PSTORE
132static enum pstore_type_id nvram_type_ids[] = { 132static enum pstore_type_id nvram_type_ids[] = {
133 PSTORE_TYPE_DMESG, 133 PSTORE_TYPE_DMESG,
134 PSTORE_TYPE_PPC_RTAS,
134 -1 135 -1
135}; 136};
136static int read_type; 137static int read_type;
138static unsigned long last_rtas_event;
137#endif 139#endif
138 140
139static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index) 141static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index)
@@ -297,8 +299,13 @@ int nvram_write_error_log(char * buff, int length,
297{ 299{
298 int rc = nvram_write_os_partition(&rtas_log_partition, buff, length, 300 int rc = nvram_write_os_partition(&rtas_log_partition, buff, length,
299 err_type, error_log_cnt); 301 err_type, error_log_cnt);
300 if (!rc) 302 if (!rc) {
301 last_unread_rtas_event = get_seconds(); 303 last_unread_rtas_event = get_seconds();
304#ifdef CONFIG_PSTORE
305 last_rtas_event = get_seconds();
306#endif
307 }
308
302 return rc; 309 return rc;
303} 310}
304 311
@@ -506,7 +513,7 @@ static int nvram_pstore_write(enum pstore_type_id type,
506} 513}
507 514
508/* 515/*
509 * Reads the oops/panic report. 516 * Reads the oops/panic report and ibm,rtas-log partition.
510 * Returns the length of the data we read from each partition. 517 * Returns the length of the data we read from each partition.
511 * Returns 0 if we've been called before. 518 * Returns 0 if we've been called before.
512 */ 519 */
@@ -526,6 +533,12 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
526 part = &oops_log_partition; 533 part = &oops_log_partition;
527 *type = PSTORE_TYPE_DMESG; 534 *type = PSTORE_TYPE_DMESG;
528 break; 535 break;
536 case PSTORE_TYPE_PPC_RTAS:
537 part = &rtas_log_partition;
538 *type = PSTORE_TYPE_PPC_RTAS;
539 time->tv_sec = last_rtas_event;
540 time->tv_nsec = 0;
541 break;
529 default: 542 default:
530 return 0; 543 return 0;
531 } 544 }
@@ -542,11 +555,17 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
542 555
543 *count = 0; 556 *count = 0;
544 *id = id_no; 557 *id = id_no;
545 oops_hdr = (struct oops_log_info *)buff; 558
546 *buf = buff + sizeof(*oops_hdr); 559 if (nvram_type_ids[read_type] == PSTORE_TYPE_DMESG) {
547 time->tv_sec = oops_hdr->timestamp; 560 oops_hdr = (struct oops_log_info *)buff;
548 time->tv_nsec = 0; 561 *buf = buff + sizeof(*oops_hdr);
549 return oops_hdr->report_length; 562 time->tv_sec = oops_hdr->timestamp;
563 time->tv_nsec = 0;
564 return oops_hdr->report_length;
565 }
566
567 *buf = buff;
568 return part->size;
550} 569}
551 570
552static struct pstore_info nvram_pstore_info = { 571static struct pstore_info nvram_pstore_info = {