Hello community,

here is the log from the commit of package librtas for openSUSE:Factory checked 
in at 2014-11-15 12:06:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/librtas (Old)
 and      /work/SRC/openSUSE:Factory/.librtas.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "librtas"

Changes:
--------
--- /work/SRC/openSUSE:Factory/librtas/librtas.changes  2014-09-10 
17:02:43.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.librtas.new/librtas.changes     2014-11-15 
12:19:34.000000000 +0100
@@ -1,0 +2,6 @@
+Wed Oct 29 12:08:14 UTC 2014 - [email protected]
+
+- version update to 1.3.13
+  see changelog for changes  
+
+-------------------------------------------------------------------

Old:
----
  librtas-1.3.12.tar.gz

New:
----
  librtas-1.3.13.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ librtas.spec ++++++
--- /var/tmp/diff_new_pack.NtkpMd/_old  2014-11-15 12:19:35.000000000 +0100
+++ /var/tmp/diff_new_pack.NtkpMd/_new  2014-11-15 12:19:35.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           librtas
-Version:        1.3.12
+Version:        1.3.13
 Release:        0
 Summary:        Libraries to provide access to RTAS calls and RTAS events
 License:        CPL-1.0

++++++ librtas-1.3.12.tar.gz -> librtas-1.3.13.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librtas-1.3.12/Changelog new/librtas-1.3.13/Changelog
--- old/librtas-1.3.12/Changelog        2014-08-13 20:22:51.000000000 +0200
+++ new/librtas-1.3.13/Changelog        2014-10-23 04:23:41.000000000 +0200
@@ -1,3 +1,72 @@
+Changelog for librtas-1.3.13
+=======================================
+commit 1d54a4a346f9111e1326dfdec756fd78360add42
+Author: Nathan Fontenot <[email protected]>
+Date:   Fri Oct 17 10:18:40 2014 -0400
+
+    When we pass _hi and _lo 32bits of a 64bit value, we
+    should convert the host endian value carefully.
+    
+    i.e,
+            X_hi = htobe32(BITS32_HI(X))
+            X_lo = htobe32(BITS32_LO(X))
+    
+    and not :
+            X_hi = BITS32_HI(htobe64(X))
+    
+    NOTE: This patch is untested, but I believe this patch
+    is good to have than the current faulty conversion.
+    
+    This patch fixes all such occurrences in librtas.
+    
+    Signed-off-by: Suzuki K. Poulose <[email protected]>
+
+commit e5541e1a5c83ce47cc492abcd7343d65763dcefe
+Author: Nathan Fontenot <[email protected]>
+Date:   Fri Oct 17 10:17:28 2014 -0400
+
+    Use rpm macros for standard paths
+    
+    Signed-off-by: Suzuki K. Poulose <[email protected]>
+
+commit 8ef7f827e28e3cd284f6be5686a987786be7502d
+Author: Nathan Fontenot <[email protected]>
+Date:   Fri Oct 17 10:16:16 2014 -0400
+
+    This patch fixes the conversion of args for paltform-dump call.
+    platform dump passes 64bit values as, a pair of 32bit values.
+    val_hi and val_lo. So when we convert a value 'X' to 32bit hi and lo
+    values in BE, we should follow the below approach :
+    
+    X_hi = htobe32(BITS32_HI(X))
+    X_lo = htobe32(BITS32_LO(X))
+    
+    and NOT
+    X_tmp = htobe64(X);
+    X_hi = BITS32_HI(X_tmp), X_lo = BITS32_LO(X_tmp)
+    
+    This patch has been tested with rtas_errd/extract_platdump to retrieve a
+    dump from FSP.
+    
+    Signed-off-by: Suzuki K. Poulose <[email protected]>
+
+commit 52263814c46210b51e564748050299620726dfd1
+Author: Nathan Fontenot <[email protected]>
+Date:   Fri Oct 17 10:12:54 2014 -0400
+
+    Fix LE parsing of SRC/FRU events
+    
+    Signed-off-by: Thomas L Falcon <[email protected]>
+    Signed-off-by: Suzuki K. Poulose <[email protected]>
+
+commit ac0a91d2730740cd279d80ccd4c83b0a04827d1d
+Author: Nathan Fontenot <[email protected]>
+Date:   Fri Oct 17 10:10:29 2014 -0400
+
+    LE Support for SRC/FRU events
+    
+    Signed-off-by: Nathan Fontenot <[email protected]>
+
 Changelog for librtas-1.3.12
 =======================================
 commit 1f045d8df135cfdc232a49f0992ab60913c0b043
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librtas-1.3.12/librtas.spec.in 
new/librtas-1.3.13/librtas.spec.in
--- old/librtas-1.3.12/librtas.spec.in  2014-08-13 20:22:51.000000000 +0200
+++ new/librtas-1.3.13/librtas.spec.in  2014-10-23 04:23:41.000000000 +0200
@@ -1,5 +1,5 @@
 %define name librtas
-%define version 1.3.12
+%define version 1.3.13
 %define release 1
 Summary: Libraries to provide access to RTAS calls and RTAS events.
 Name: %{name}
@@ -34,36 +34,36 @@
 
 %files
 %defattr(-, root, root)
-/usr/share/doc/packages/%{name}/COPYRIGHT
-/usr/share/doc/packages/%{name}/README
-/usr/include/common.h
-/usr/include/librtas.h
-@LIB_DIR@/librtas.so.%{version}
-@LIB_DIR@/libofdt.so
-@LIB_DIR@/librtas.so
-@LIB_DIR@/librtasevent.so
-@LIB_DIR@/librtasevent.so.1
-@LIB_DIR@/librtasevent.so.%{version}
-/usr/include/librtasevent.h
-/usr/include/librtasevent_v4.h
-/usr/include/librtasevent_v6.h
+%{_docdir}/%{name}/COPYRIGHT
+%{_docdir}/%{name}/README
+%{_includedir}/common.h
+%{_includedir}/librtas.h
+%{_libdir}/librtas.so.%{version}
+%{_libdir}/libofdt.so
+%{_libdir}/librtas.so
+%{_libdir}/librtasevent.so
+%{_libdir}/librtasevent.so.1
+%{_libdir}/librtasevent.so.%{version}
+%{_includedir}/librtasevent.h
+%{_includedir}/librtasevent_v4.h
+%{_includedir}/librtasevent_v6.h
 
-@LIB_DIR@/libofdt.so.%{version}
-/usr/include/libofdt.h
+%{_libdir}/libofdt.so.%{version}
+%{_includedir}/libofdt.h
 
 %post
 # Post-install script -------------------------------------------------
-ln -sf @LIB_DIR@/librtas.so.%{version} @LIB_DIR@/librtas.so
-ln -sf @LIB_DIR@/librtas.so.%{version} @LIB_DIR@/librtas.so.1
-ln -sf @LIB_DIR@/librtasevent.so.%{version} @LIB_DIR@/librtasevent.so
-ln -sf @LIB_DIR@/libofdt.so.%{version} @LIB_DIR@/libofdt.so
+ln -sf %{_libdir}/librtas.so.%{version} %{_libdir}/librtas.so
+ln -sf %{_libdir}/librtas.so.%{version} %{_libdir}/librtas.so.1
+ln -sf %{_libdir}/librtasevent.so.%{version} %{_libdir}/librtasevent.so
+ln -sf %{_libdir}/libofdt.so.%{version} %{_libdir}/libofdt.so
 ldconfig
 
 %postun
 # Post-uninstall script -----------------------------------------------
 if [ "$1" = "0" ] ; then        # last uninstall
-    rm -f @LIB_DIR@/librtas.so
-    rm -f @LIB_DIR@/librtasevent.so
-    rm -f @LIB_DIR@/libofdt.so
+    rm -f %{_libdir}/librtas.so
+    rm -f %{_libdir}/librtasevent.so
+    rm -f %{_libdir}/libofdt.so
 fi
 ldconfig
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librtas-1.3.12/librtas_src/syscall_calls.c 
new/librtas-1.3.13/librtas_src/syscall_calls.c
--- old/librtas-1.3.12/librtas_src/syscall_calls.c      2014-08-13 
20:22:51.000000000 +0200
+++ new/librtas-1.3.13/librtas_src/syscall_calls.c      2014-10-23 
04:23:41.000000000 +0200
@@ -532,8 +532,8 @@
 
        do {
                rc = sc_rtas_call(token, 4, 2, htobe32(config_addr),
-                                 BITS32_HI(htobe64(phb_id)),
-                                 BITS32_LO(htobe64(phb_id)),
+                                 htobe32(BITS32_HI(phb_id)),
+                                 htobe32(BITS32_LO(phb_id)),
                                  htobe32(func), &status, &be_info);
                if (rc)
                        break;
@@ -930,6 +930,7 @@
        uint32_t kernbuf_pa = 0;
        uint32_t next_hi, next_lo;
        uint32_t bytes_hi, bytes_lo;
+       uint32_t dump_tag_hi, dump_tag_lo;
        void *kernbuf;
        int status;
        int rc;
@@ -939,22 +940,29 @@
                if (rc)
                        return rc;
        }
-
-       *seq_next = htobe64(sequence);
-       do {
-               sequence = *seq_next;
-               rc = sc_rtas_call(token, 6, 5, BITS32_HI(htobe64(dump_tag)),
-                                 BITS32_LO(htobe64(dump_tag)),
-                                 BITS32_HI(sequence),
-                                 BITS32_LO(sequence),
+       /*
+        * Converting a 64bit host value to 32bit BE, _hi and _lo
+        * pair is tricky: we should convert the _hi and _lo 32bits
+        * of the 64bit host value.
+        */
+       dump_tag_hi = htobe32(BITS32_HI(dump_tag));
+       dump_tag_lo = htobe32(BITS32_LO(dump_tag));
+
+       next_hi = htobe32(BITS32_HI(sequence));
+       next_lo = htobe32(BITS32_LO(sequence));
+
+       do {
+               rc = sc_rtas_call(token, 6, 5, dump_tag_hi,
+                                 dump_tag_lo,
+                                 next_hi,
+                                 next_lo,
                                  htobe32(kernbuf_pa), htobe32(length),
                                  &status, &next_hi, &next_lo, &bytes_hi,
                                  &bytes_lo);
                if (rc < 0)
                        break;
-               
-               *seq_next = BITS64(next_hi, next_lo);
-               dbg1("%s: seq_next = 0x%llx\n", __FUNCTION__, *seq_next);
+               sequence = BITS64(be32toh(next_hi), be32toh(next_lo));
+               dbg1("%s: seq_next = 0x%llx\n", __FUNCTION__, sequence);
 
                rc = handle_delay(status, &elapsed);
        } while (rc == CALL_AGAIN);
@@ -965,9 +973,10 @@
        if (kernbuf)
                (void)sc_free_rmo_buffer(kernbuf, kernbuf_pa, length);
 
+       *seq_next = sequence;
+       bytes_hi = be32toh(bytes_hi);
+       bytes_lo = be32toh(bytes_lo);
        *bytes_ret = BITS64(bytes_hi, bytes_lo);
-       *seq_next = be64toh(*seq_next);
-       *bytes_ret = be64toh(*bytes_ret);
 
        dbg1("(0x%llx, 0x%llx, %p, %d, %p, %p) = %d, 0x%llx, 0x%llx\n",
             dump_tag, sequence, buffer, length, seq_next, bytes_ret,
@@ -996,8 +1005,8 @@
 
        do {
                rc = sc_rtas_call(token, 3, 3, htobe32(cfg_addr),
-                                 BITS32_HI(htobe64(phbid)),
-                                 BITS32_LO(htobe64(phbid)), &status,
+                                 htobe32(BITS32_HI(phbid)),
+                                 htobe32(BITS32_LO(phbid)), &status,
                                  state, eeh);
                if (rc)
                        return rc;
@@ -1114,8 +1123,8 @@
 
        do {
                rc = sc_rtas_call(token, 4, 1, htobe32(cfg_addr),
-                                 BITS32_HI(htobe64(phbid)),
-                                 BITS32_LO(htobe64(phbid)),
+                                 htobe32(BITS32_HI(phbid)),
+                                 htobe32(BITS32_LO(phbid)),
                                  htobe32(function), &status);
                if (rc)
                        return rc;
@@ -1312,8 +1321,8 @@
        int rc;
 
        do {
-               rc = sc_rtas_call(token, 2, 1, BITS32_HI(htobe64(streamid)),
-                                 BITS32_LO(htobe64(streamid)), &status);
+               rc = sc_rtas_call(token, 2, 1, htobe32(BITS32_HI(streamid)),
+                                 htobe32(BITS32_LO(streamid)), &status);
                if (rc)
                        return rc;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librtas-1.3.12/librtasevent_src/get_rtas_event.c 
new/librtas-1.3.13/librtasevent_src/get_rtas_event.c
--- old/librtas-1.3.12/librtasevent_src/get_rtas_event.c        2014-08-13 
20:22:51.000000000 +0200
+++ new/librtas-1.3.13/librtasevent_src/get_rtas_event.c        2014-10-23 
04:23:41.000000000 +0200
@@ -336,12 +336,7 @@
 
             case RTAS_PSRC_SCN:
             case RTAS_SSRC_SCN:
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-               fprintf(stderr, "Parsing RTAS SRC Sections on little endian not 
supported\n");
-               rc = -1;
-#else
                 rc = parse_src_scn(re);
-#endif
                 break;
 
            case RTAS_HP_SCN:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librtas-1.3.12/librtasevent_src/librtasevent_v6.h 
new/librtas-1.3.13/librtasevent_src/librtasevent_v6.h
--- old/librtas-1.3.12/librtasevent_src/librtasevent_v6.h       2014-08-13 
20:22:51.000000000 +0200
+++ new/librtas-1.3.13/librtasevent_src/librtasevent_v6.h       2014-10-23 
04:23:41.000000000 +0200
@@ -267,9 +267,15 @@
 struct rtas_fru_hdr {
     struct rtas_fru_hdr *next;
     char        id[2];
+    uint32_t    length;
+    uint32_t    flags;
+};
+
+struct rtas_fru_hdr_raw {
+    char        id[2];
     uint32_t    length:8;
     uint32_t    flags:8;
-};
+}__attribute__((__packed__));
 
 #define RE_FRU_HDR_SZ           4
 #define RE_FRU_HDR_OFFSET(x)    ((char *)(x) + sizeof(struct rtas_fru_hdr *))
@@ -307,6 +313,16 @@
     char serial_no[13];
 };
 
+struct rtas_fru_id_scn_raw {
+    struct rtas_fru_hdr_raw fruhdr;
+
+    /* The following fields may not be present */
+    char part_no[8];
+    char procedure_id[8];
+    char ccin[5];
+    char serial_no[13];
+}__attribute__((__packed__));
+
 /**
  * @struct rtas_fru_pe_scn
  * @brief contents of the FRU Power Enclosure Substructure
@@ -317,11 +333,22 @@
     char pce_name[32];
 };
 
+struct rtas_fru_pe_scn_raw {
+    struct rtas_fru_hdr_raw fruhdr;
+    struct rtas_mtms pce_mtms;
+    char pce_name[32];
+}__attribute__((__packed__));
+
 /**
  * @struct fru_mru
  * @brief FRU MR Description structs
  */
 struct fru_mru {
+    char        priority;
+    uint32_t    id;
+};
+
+struct fru_mru_raw {
     uint32_t    /* reserved */:24;
     char        priority;
     uint32_t    id;
@@ -339,18 +366,24 @@
     uint32_t    /* reserved */:32;
     struct fru_mru  mrus[15];
 };
+
+struct rtas_fru_mr_scn_raw {
+    struct rtas_fru_hdr_raw fruhdr;
+    uint32_t    /* reserved */:32;
+    struct fru_mru_raw  mrus[15];
+};
     
 /**
  * @struct rtas_v6_fru_scn
  * @brief RTAS version 6 FRU callout section
  */
 struct rtas_fru_scn {
-    uint32_t    length:8;               /**< call-out length */
-    uint32_t    type:4;                 /**< callout type */
-    uint32_t    fru_id_included:1;      /**< fru id subsection included */
-    uint32_t    fru_subscn_included:3;
+    uint32_t    length;               /**< call-out length */
+    uint32_t    type;                 /**< callout type */
+    uint32_t    fru_id_included;      /**< fru id subsection included */
+    uint32_t    fru_subscn_included;
 
-    char       priority;               /**< fru priority */
+    char       priority;             /**< fru priority */
 #define RTAS_FRU_PRIORITY_HIGH      'H'
 #define RTAS_FRU_PRIORITY_MEDIUM    'M'
 #define RTAS_FRU_PRIORITY_MEDIUM_A  'A'
@@ -358,12 +391,20 @@
 #define RTAS_FRU_PRIORITY_MEDIUM_C  'C'
 #define RTAS_FRU_PRIORITY_LOW       'L'
 
-    uint32_t    loc_code_length:8;      /**< location field length */
-    char        loc_code[80];           /**< location code */
+    uint32_t    loc_code_length;      /**< location field length */
+    char        loc_code[80];         /**< location code */
     struct rtas_fru_scn *next;
     struct rtas_fru_hdr *subscns;
 };
 
+struct rtas_fru_scn_raw {
+    uint32_t    length:8;
+    uint32_t   data1:8;
+    char       priority;
+    uint32_t    loc_code_length:8;
+    char        loc_code[80];
+};
+
 #define RE_FRU_SCN_SZ       4
 
 /**
@@ -372,31 +413,54 @@
  */
 struct rtas_src_scn {
     struct scn_header shdr;
-    struct rtas_v6_hdr_raw v6hdr;
+    struct rtas_v6_hdr v6hdr;
 
-    uint32_t    version:8;          /**< SRC version */ 
-    char        src_platform_data[7];   /**< platform specific data */
+    uint32_t    version;              /**< SRC version */ 
+    char        src_platform_data[7]; /**< platform specific data */
 #define src_subscns_included(src)    ((src)->src_platform_data[0] & 0x01)
 
-    uint32_t    ext_refcode2:32;    /**< extended reference code word 2 */
-    uint32_t    ext_refcode3:32;    /**< extended reference code word 3 */
-    uint32_t    ext_refcode4:32;    /**< extended reference code word 4 */
-    uint32_t    ext_refcode5:32;    /**< extended reference code word 5 */
-
-    uint32_t    ext_refcode6:32;    /**< extended reference code word 6 */
-    uint32_t    ext_refcode7:32;    /**< extended reference code word 7 */
-    uint32_t    ext_refcode8:32;    /**< extended reference code word 8 */
-    uint32_t    ext_refcode9:32;    /**< extended reference code word 9 */
+    uint32_t    ext_refcode2;         /**< extended reference code word 2 */
+    uint32_t    ext_refcode3;         /**< extended reference code word 3 */
+    uint32_t    ext_refcode4;         /**< extended reference code word 4 */
+    uint32_t    ext_refcode5;         /**< extended reference code word 5 */
+
+    uint32_t    ext_refcode6;         /**< extended reference code word 6 */
+    uint32_t    ext_refcode7;         /**< extended reference code word 7 */
+    uint32_t    ext_refcode8;         /**< extended reference code word 8 */
+    uint32_t    ext_refcode9;         /**< extended reference code word 9 */
 
-    char        primary_refcode[36];/**< primary reference code */
+    char        primary_refcode[36];  /**< primary reference code */
     
-    uint32_t    subscn_id:8;               /**< sub-section id (0xC0) */
-    uint32_t    subscn_platform_data:8;    /**< platform specific data */
-    uint32_t    subscn_length:16;   /**< sub-section length */
+    uint32_t    subscn_id;           /**< sub-section id (0xC0) */
+    uint32_t    subscn_platform_data; /**< platform specific data */
+    uint32_t    subscn_length;        /**< sub-section length */
 
     struct rtas_fru_scn *fru_scns;
 };
 
+struct rtas_src_scn_raw {
+    struct rtas_v6_hdr_raw v6hdr;
+
+    uint32_t    version:8;
+    char        src_platform_data[7];
+
+    uint32_t    ext_refcode2:32;
+    uint32_t    ext_refcode3:32;
+    uint32_t    ext_refcode4:32;
+    uint32_t    ext_refcode5:32;
+
+    uint32_t    ext_refcode6:32;
+    uint32_t    ext_refcode7:32;
+    uint32_t    ext_refcode8:32;
+    uint32_t    ext_refcode9:32;
+
+    char        primary_refcode[36];
+    
+    uint32_t    subscn_id:8;
+    uint32_t    subscn_platform_data:8;
+    uint32_t    subscn_length:16;
+};
+
 #define RE_SRC_SCN_SZ       80
 #define RE_SRC_SUBSCN_SZ    4
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/librtas-1.3.12/librtasevent_src/rtas_srcfru.c 
new/librtas-1.3.13/librtasevent_src/rtas_srcfru.c
--- old/librtas-1.3.12/librtasevent_src/rtas_srcfru.c   2014-08-13 
20:22:51.000000000 +0200
+++ new/librtas-1.3.13/librtasevent_src/rtas_srcfru.c   2014-10-23 
04:23:41.000000000 +0200
@@ -19,6 +19,23 @@
 #include "rtas_src_codes.c"
 
 /**
+ * parse_fru_hdr
+ * @brief Parse the ontents of a FRU header
+ *
+ * @param fru_hdr rtas_fru_hdr pointer
+ * @param fru_hdr_raw rtas_fru_hdr_raw pointer
+ */
+static void parse_fru_hdr(struct rtas_fru_hdr *fru_hdr,
+                         struct rtas_fru_hdr_raw *fru_hdr_raw)
+{
+    fru_hdr->id[0] = fru_hdr_raw->id[0];
+    fru_hdr->id[1] = fru_hdr_raw->id[1];
+
+    fru_hdr->length = fru_hdr_raw->length;
+    fru_hdr->flags = fru_hdr_raw->flags;
+}
+
+/**
  * parse_fru_id_scn
  * @brief Parse a FRU Identity Substructure
  *
@@ -29,6 +46,7 @@
 parse_fru_id_scn(struct rtas_event *re)
 {
     struct rtas_fru_id_scn *fru_id;
+    struct rtas_fru_id_scn_raw *fru_id_raw;
 
     fru_id = malloc(sizeof(*fru_id));
     if (fru_id == NULL) {
@@ -37,7 +55,10 @@
     }
 
     memset(fru_id, 0, sizeof(*fru_id));
-    rtas_copy(RE_FRU_HDR_OFFSET(fru_id), re, RE_FRU_HDR_SZ);
+
+    fru_id_raw = (struct rtas_fru_id_scn_raw *)(re->buffer + re->offset);
+    parse_fru_hdr(&fru_id->fruhdr, &fru_id_raw->fruhdr);
+    re->offset += RE_FRU_HDR_SZ;
 
     if (fruid_has_part_no(fru_id)) {
         strcpy(fru_id->part_no, RE_EVENT_OFFSET(re));
@@ -73,6 +94,7 @@
 parse_fru_pe_scn(struct rtas_event *re)
 {
     struct rtas_fru_pe_scn *fru_pe;
+    struct rtas_fru_pe_scn_raw *fru_pe_raw;
     uint32_t scn_sz;
     char *data;
 
@@ -83,7 +105,9 @@
     }
 
     memset(fru_pe, 0, sizeof(*fru_pe));
-    rtas_copy(RE_FRU_HDR_OFFSET(fru_pe), re, RE_FRU_HDR_SZ);
+    fru_pe_raw = (struct rtas_fru_pe_scn_raw *)(re->buffer + re->offset);
+    parse_fru_hdr(&fru_pe->fruhdr, &fru_pe_raw->fruhdr);
+    re->offset += RE_FRU_HDR_SZ;
 
     scn_sz = fru_pe->fruhdr.length;
     data = (char *)fru_pe + sizeof(fru_pe->fruhdr);
@@ -104,8 +128,8 @@
 parse_fru_mr_scn(struct rtas_event *re)
 {
     struct rtas_fru_mr_scn *fru_mr;
-    uint32_t scn_sz;
-    char *data;
+    struct rtas_fru_mr_scn_raw *fru_mr_raw;
+    int i, mrus_sz, num_mrus;
 
     fru_mr = malloc(sizeof(*fru_mr));
     if (fru_mr == NULL) {
@@ -114,16 +138,39 @@
     }
 
     memset(fru_mr, 0, sizeof(*fru_mr));
-    rtas_copy(RE_FRU_HDR_OFFSET(fru_mr), re, RE_FRU_HDR_SZ);
+    fru_mr_raw = (struct rtas_fru_mr_scn_raw *)(re->buffer + re->offset);
+    parse_fru_hdr(&fru_mr->fruhdr, &fru_mr_raw->fruhdr);
+    re->offset += RE_FRU_HDR_SZ;
 
-    scn_sz = fru_mr->fruhdr.length;
-    data = (char *)fru_mr + sizeof(fru_mr->fruhdr);
-    
-    rtas_copy(data, re, scn_sz - RE_FRU_HDR_SZ);
+    mrus_sz = fru_mr->fruhdr.length - RE_FRU_HDR_SZ - sizeof(uint32_t);
+    num_mrus = mrus_sz / sizeof(struct fru_mru_raw);
 
+    for (i = 0; i < num_mrus; i++) {
+       fru_mr->mrus[i].priority = fru_mr_raw->mrus[i].priority;
+       fru_mr->mrus[i].id = be32toh(fru_mr_raw->mrus[i].id);
+    }
+
+    re->offset += mrus_sz + sizeof(uint32_t) /* reserved piece */; 
     return (struct rtas_fru_hdr *)fru_mr;
 }
 
+void parse_fru_scn(struct rtas_event *re, struct rtas_fru_scn *fru,
+                  struct rtas_fru_scn_raw *rawfru)
+{
+    fru->length = rawfru->length;
+
+    fru->type = (rawfru->data1 & 0xf0) >> 4;
+    fru->fru_id_included = (rawfru->data1 & 0x08) >> 3;
+    fru->fru_subscn_included = rawfru->data1 & 0x07;
+
+    fru->priority = rawfru->priority;
+    fru->loc_code_length = rawfru->loc_code_length;
+    re->offset += RE_FRU_SCN_SZ;
+
+    memcpy(fru->loc_code, rawfru->loc_code, fru->loc_code_length);
+    re->offset += fru->loc_code_length;
+}
+
 /**
  * parse_v6_src_scn
  * @brief parse a version 6 rtas SRC section
@@ -136,25 +183,55 @@
 parse_src_scn(struct rtas_event *re)
 {
     struct rtas_src_scn *src;
+    struct rtas_src_scn_raw *src_raw;
     struct rtas_fru_scn *fru, *last_fru;
     int total_len, srcsub_len;
-
     src = malloc(sizeof(*src));
     if (src == NULL) {
         errno = ENOMEM;
         return 1;
     }
+
+    src_raw = malloc(sizeof(*src_raw));
+    if (src_raw == NULL) {
+        errno = ENOMEM;
+        return 1;
+    }
            
     memset(src, 0, sizeof(*src));
+    memset(src_raw, 0, sizeof(*src_raw));
     src->shdr.raw_offset = re->offset;
 
-    rtas_copy(RE_SHDR_OFFSET(src), re, RE_SRC_SCN_SZ);
-    add_re_scn(re, src, re_scn_id(&src->v6hdr));
+    rtas_copy(src_raw, re, RE_SRC_SCN_SZ);
+    parse_v6_hdr(&src->v6hdr, &src_raw->v6hdr);
+
+    src->version = src_raw->version;
+    memcpy(&src->src_platform_data, &src_raw->src_platform_data,
+          sizeof(src->src_platform_data));
+
+    src->ext_refcode2 = be32toh(src_raw->ext_refcode2);
+    src->ext_refcode3 = be32toh(src_raw->ext_refcode3);
+    src->ext_refcode4 = be32toh(src_raw->ext_refcode4);
+    src->ext_refcode5 = be32toh(src_raw->ext_refcode5);
+    
+    src->ext_refcode6 = be32toh(src_raw->ext_refcode6);
+    src->ext_refcode7 = be32toh(src_raw->ext_refcode7);
+    src->ext_refcode8 = be32toh(src_raw->ext_refcode8);
+    src->ext_refcode9 = be32toh(src_raw->ext_refcode9);
+
+    memcpy(&src->primary_refcode, &src_raw->primary_refcode,
+          sizeof(src->primary_refcode));
 
-    if (! src_subscns_included(src))
+    add_re_scn(re, src, re_scn_id(&src_raw->v6hdr));
+
+    if (!src_subscns_included(src))
         return 0;
 
-    rtas_copy(RE_SHDR_OFFSET(src) + RE_SRC_SCN_SZ + 4, re, RE_SRC_SUBSCN_SZ);
+    rtas_copy( (char *) src_raw + RE_SRC_SCN_SZ + 4, re, RE_SRC_SUBSCN_SZ);
+
+    src->subscn_id = src_raw->subscn_id;
+    src->subscn_platform_data = src_raw->subscn_platform_data;
+    src->subscn_length = be16toh(src_raw->subscn_length);
 
     srcsub_len = src->subscn_length * 4; /*get number of bytes */
     total_len = RE_SRC_SUBSCN_SZ;
@@ -164,7 +241,7 @@
     do {
        uint32_t fru_len, fru_end;
        struct rtas_fru_hdr *last_fruhdr = NULL;
-       
+       struct rtas_fru_scn_raw *rawfru;
         fru = malloc(sizeof(*fru));
         if (fru == NULL) {
             cleanup_rtas_event(re);
@@ -173,12 +250,9 @@
         }
 
         memset(fru, 0, sizeof(*fru));
-        
-        /* First the fixed part of the fru */
-        rtas_copy(fru, re, RE_FRU_SCN_SZ);
-        
-        /* Then the variable length location string */
-        rtas_copy(fru->loc_code, re, fru->loc_code_length);
+
+       rawfru = (struct rtas_fru_scn_raw *)(re->buffer + re->offset);
+       parse_fru_scn(re, fru, rawfru);
 
        fru_len = RE_FRU_SCN_SZ + fru->loc_code_length;
         fru_end = re->offset + fru->length - fru_len;

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to