diff options
-rw-r--r-- | arch/powerpc/platforms/pseries/nvram.c | 33 | ||||
-rw-r--r-- | fs/pstore/inode.c | 3 | ||||
-rw-r--r-- | include/linux/pstore.h | 2 |
3 files changed, 31 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 |
132 | static enum pstore_type_id nvram_type_ids[] = { | 132 | static 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 | }; |
136 | static int read_type; | 137 | static int read_type; |
138 | static unsigned long last_rtas_event; | ||
137 | #endif | 139 | #endif |
138 | 140 | ||
139 | static ssize_t pSeries_nvram_read(char *buf, size_t count, loff_t *index) | 141 | static 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 | ||
552 | static struct pstore_info nvram_pstore_info = { | 571 | static struct pstore_info nvram_pstore_info = { |
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index e4bcb2cf055a..ec24f9ceb5ed 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c | |||
@@ -324,6 +324,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count, | |||
324 | case PSTORE_TYPE_MCE: | 324 | case PSTORE_TYPE_MCE: |
325 | sprintf(name, "mce-%s-%lld", psname, id); | 325 | sprintf(name, "mce-%s-%lld", psname, id); |
326 | break; | 326 | break; |
327 | case PSTORE_TYPE_PPC_RTAS: | ||
328 | sprintf(name, "rtas-%s-%lld", psname, id); | ||
329 | break; | ||
327 | case PSTORE_TYPE_UNKNOWN: | 330 | case PSTORE_TYPE_UNKNOWN: |
328 | sprintf(name, "unknown-%s-%lld", psname, id); | 331 | sprintf(name, "unknown-%s-%lld", psname, id); |
329 | break; | 332 | break; |
diff --git a/include/linux/pstore.h b/include/linux/pstore.h index 75d01760c911..d7a8fe938c0f 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h | |||
@@ -35,6 +35,8 @@ enum pstore_type_id { | |||
35 | PSTORE_TYPE_MCE = 1, | 35 | PSTORE_TYPE_MCE = 1, |
36 | PSTORE_TYPE_CONSOLE = 2, | 36 | PSTORE_TYPE_CONSOLE = 2, |
37 | PSTORE_TYPE_FTRACE = 3, | 37 | PSTORE_TYPE_FTRACE = 3, |
38 | /* PPC64 partition types */ | ||
39 | PSTORE_TYPE_PPC_RTAS = 4, | ||
38 | PSTORE_TYPE_UNKNOWN = 255 | 40 | PSTORE_TYPE_UNKNOWN = 255 |
39 | }; | 41 | }; |
40 | 42 | ||