]> git.karo-electronics.de Git - linux-beck.git/commitdiff
powerpc/pseries: Read rtas partition via pstore
authorAruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Wed, 5 Jun 2013 18:51:44 +0000 (00:21 +0530)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 20 Jun 2013 07:04:52 +0000 (17:04 +1000)
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>
arch/powerpc/platforms/pseries/nvram.c
fs/pstore/inode.c
include/linux/pstore.h

index 9edec8ee02ef941b83bf9233edf54778e6087abb..78d72f0175adbcdcf8e353473c5f6e59292bc55c 100644 (file)
@@ -131,9 +131,11 @@ static struct z_stream_s stream;
 #ifdef CONFIG_PSTORE
 static enum pstore_type_id nvram_type_ids[] = {
        PSTORE_TYPE_DMESG,
+       PSTORE_TYPE_PPC_RTAS,
        -1
 };
 static int read_type;
+static unsigned long last_rtas_event;
 #endif
 
 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,
 {
        int rc = nvram_write_os_partition(&rtas_log_partition, buff, length,
                                                err_type, error_log_cnt);
-       if (!rc)
+       if (!rc) {
                last_unread_rtas_event = get_seconds();
+#ifdef CONFIG_PSTORE
+               last_rtas_event = get_seconds();
+#endif
+       }
+
        return rc;
 }
 
@@ -506,7 +513,7 @@ static int nvram_pstore_write(enum pstore_type_id type,
 }
 
 /*
- * Reads the oops/panic report.
+ * Reads the oops/panic report and ibm,rtas-log partition.
  * Returns the length of the data we read from each partition.
  * Returns 0 if we've been called before.
  */
@@ -526,6 +533,12 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
                part = &oops_log_partition;
                *type = PSTORE_TYPE_DMESG;
                break;
+       case PSTORE_TYPE_PPC_RTAS:
+               part = &rtas_log_partition;
+               *type = PSTORE_TYPE_PPC_RTAS;
+               time->tv_sec = last_rtas_event;
+               time->tv_nsec = 0;
+               break;
        default:
                return 0;
        }
@@ -542,11 +555,17 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type,
 
        *count = 0;
        *id = id_no;
-       oops_hdr = (struct oops_log_info *)buff;
-       *buf = buff + sizeof(*oops_hdr);
-       time->tv_sec = oops_hdr->timestamp;
-       time->tv_nsec = 0;
-       return oops_hdr->report_length;
+
+       if (nvram_type_ids[read_type] == PSTORE_TYPE_DMESG) {
+               oops_hdr = (struct oops_log_info *)buff;
+               *buf = buff + sizeof(*oops_hdr);
+               time->tv_sec = oops_hdr->timestamp;
+               time->tv_nsec = 0;
+               return oops_hdr->report_length;
+       }
+
+       *buf = buff;
+       return part->size;
 }
 
 static struct pstore_info nvram_pstore_info = {
index e4bcb2cf055a1dc8f81df7cbb38e8cdab4add0b0..ec24f9ceb5ed24cb8cb41b780c9a73d9e0c57450 100644 (file)
@@ -324,6 +324,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
        case PSTORE_TYPE_MCE:
                sprintf(name, "mce-%s-%lld", psname, id);
                break;
+       case PSTORE_TYPE_PPC_RTAS:
+               sprintf(name, "rtas-%s-%lld", psname, id);
+               break;
        case PSTORE_TYPE_UNKNOWN:
                sprintf(name, "unknown-%s-%lld", psname, id);
                break;
index 75d01760c91197e0a44066773b52af5bc063349b..d7a8fe938c0f56e038f62523f5eda60d123b092f 100644 (file)
@@ -35,6 +35,8 @@ enum pstore_type_id {
        PSTORE_TYPE_MCE         = 1,
        PSTORE_TYPE_CONSOLE     = 2,
        PSTORE_TYPE_FTRACE      = 3,
+       /* PPC64 partition types */
+       PSTORE_TYPE_PPC_RTAS    = 4,
        PSTORE_TYPE_UNKNOWN     = 255
 };