Hello community, here is the log from the commit of package librtas for openSUSE:Factory checked in at 2014-03-28 13:56:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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-03-06 12:01:29.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.librtas.new/librtas.changes 2014-03-28 13:56:23.000000000 +0100 @@ -1,0 +2,6 @@ +Tue Mar 25 13:23:54 UTC 2014 - [email protected] + +- version update to 1.3.10 (BNC#870006) + see changelog for change + +------------------------------------------------------------------- Old: ---- librtas-1.3.9.tar.gz New: ---- librtas-1.3.10.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ librtas.spec ++++++ --- /var/tmp/diff_new_pack.7O2lN4/_old 2014-03-28 13:56:24.000000000 +0100 +++ /var/tmp/diff_new_pack.7O2lN4/_new 2014-03-28 13:56:24.000000000 +0100 @@ -18,7 +18,7 @@ Name: librtas BuildRequires: doxygen -Version: 1.3.9 +Version: 1.3.10 Release: 0 BuildRequires: fdupes Summary: Libraries to provide access to RTAS calls and RTAS events ++++++ librtas-1.3.9.tar.gz -> librtas-1.3.10.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/Changelog new/librtas-1.3.10/Changelog --- old/librtas-1.3.9/Changelog 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/Changelog 2014-03-21 21:31:52.000000000 +0100 @@ -1,3 +1,92 @@ +Changelog for librtas-1.3.10 +======================================= +commit e0c097d3e0ab65433d4fdc6e18a820c82d909464 +Author: Nathan Fontenot <[email protected]> +Date: Fri Mar 21 15:28:56 2014 -0500 + + librtasevent: Enable RTAS event parsing on LE systems + + The librtasevent library does not work in LE environments. The + struct's for each rtas event section are defined as a bit field + to match layout of the rtas event. This librtasevent library + currently functions by mapping these structs directly the raw + rtas event that is passed. This works for BE systems because + rtas events are in BE by definition. + + To fix this this patch re-defines the structs that have been + used to just contain an int for each value in the rtas event + sections, then adds a raw version of the struct that we can map + directly onto the passed in rtas event. The raw structs can then + be traversed an we can do any neccessary conversions to LE values + in the structs that are passed back to the user. + + This patch updates most of the v6 rtas event sections, most notably + src/fru sections have not been updated yet. At this time there + are no plans to update pre-v6 rtas events for LE environments. + + Signed-off-by: Nathan Fontenot <[email protected]> + +commit 7eb810757d8573ef47fdc5bd26aa3d9e9afbfd8a +Author: Greg Kurz <[email protected]> +Date: Fri Mar 21 11:49:13 2014 -0500 + + librtas: PCI hotplug support vs little endian + + The goal of this patch is to enable a little endian process to interact + with RTAS which is big endian. The rationale is that librtas assumes + to be passed cpu endian arguments and do the necessary conversions. The + reasons for this choice are: + - many arguments are owned by librtas (status, RMO buffer addresses...) + - nearly all arguments are being used in cpu endian order by librtas: + if they were assumed to be big endian, we would have to byte swap + anyway, resulting in an even bigger patch... + + Of course, all rules have an exception: the RMO buffer content is not + seen by librtas, it is up to the caller (drmgr) to do the conversions. + + It seems that recent kernels don't have the needed procfs files anymore, + so this patch only cares about the rtas() syscall based implementation. + + As requested by Benjamin Herrenschmidt, the byte swapping should be + performed in userland AND be careful about corner cases where non + 32-bit values are being passed: + + http://patchwork.ozlabs.org/patch/327089/ + + We cannot boldly convert all arguments in the sc_rtas_call() function. + + For an example, let's look at sc_suspend_me() where we pass a 64 bit value + split across two arguments. If streamid is ABCDEFGHIJKLMNOP, then it will + be reassembled by the kernel as IJKLMNOPABCDEFGH before being passed to the + host... + + As a consequence, we can only convert well known parameters in the + sc_rtas_call() function: + - token + - number of input arguments + - number of return arguments + - return status (always the first return argument) + + All other values must be converted in the caller. Please note that we + introduce intermediary variables for return values as we do not want + big endian values to be written in memory where the code assumes they + are cpu endian. + + As a starter, we focus on the RTAS calls involved in PCI hotplug. + According to section 13.5.3 of the PAPR+, we have: + - set-power-level + - get-sensor-state + - set-indicator + - ibm,configure-connector (the RMO part is already covered in drmgr) + <disclaimer> + We should cover all the calls, but it requires a huge work and we + only want to enable PCI hotplug here. So yes, all other calls are + still broken in little endian... some more patching will be needed. + </disclaimer> + + Signed-off-by: Greg Kurz <[email protected]> + Reviewed-by: Laurent Dufour <[email protected]> + Changelog for librtas-1.3.9 ======================================= commit 9c5bccb93aa734796df111c2e7c051860b8b30de Files old/librtas-1.3.9/libofdt_src/libofdt.so.1.3.9 and new/librtas-1.3.10/libofdt_src/libofdt.so.1.3.9 differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtas.spec.in new/librtas-1.3.10/librtas.spec.in --- old/librtas-1.3.9/librtas.spec.in 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtas.spec.in 2014-03-21 21:31:52.000000000 +0100 @@ -1,5 +1,5 @@ %define name librtas -%define version 1.3.9 +%define version 1.3.10 %define release 1 Summary: Libraries to provide access to RTAS calls and RTAS events. Name: %{name} Files old/librtas-1.3.9/librtas_src/librtas.so.1.3.9 and new/librtas-1.3.10/librtas_src/librtas.so.1.3.9 differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtas_src/syscall_calls.c new/librtas-1.3.10/librtas_src/syscall_calls.c --- old/librtas-1.3.9/librtas_src/syscall_calls.c 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtas_src/syscall_calls.c 2014-03-21 21:31:52.000000000 +0100 @@ -167,22 +167,30 @@ */ static void display_rtas_buf(struct rtas_args *args, int after) { - int i; + int i, ninputs, nret; if (config.debug < 2) return; + ninputs = be32toh(args->ninputs); + nret = be32toh(args->nret); + + /* It doesn't make sense to byte swap the input and return arguments + * as we don't know here what they really mean (it could be a 64 bit + * value split accross two 32 bit arguments). Printing them as hex + * values is enough for debugging purposes. + */ if (!after) { - printf("RTAS call args.token = %d\n", args->token); - printf("RTAS call args.ninputs = %d\n", args->ninputs); - printf("RTAS call args.nret = %d\n", args->nret); - for (i = 0; i < args->ninputs; i++) - printf("RTAS call input[%d] = 0x%x\n", i, + printf("RTAS call args.token = %d\n", be32toh(args->token)); + printf("RTAS call args.ninputs = %d\n", ninputs); + printf("RTAS call args.nret = %d\n", nret); + for (i = 0; i < ninputs; i++) + printf("RTAS call input[%d] = 0x%x (BE)\n", i, args->args[i]); } else { - for (i = args->ninputs; i < args->ninputs + args->nret; i++) - printf("RTAS call output[%d] = 0x%x\n", - i - args->ninputs, args->args[i]); + for (i = ninputs; i < ninputs + nret; i++) + printf("RTAS call output[%d] = 0x%x (BE)\n", + i - ninputs, args->args[i]); } } @@ -206,9 +214,9 @@ int rc; int i; - args.token = token; - args.ninputs = ninputs; - args.nret = nret; + args.token = htobe32(token); + args.ninputs = htobe32(ninputs); + args.nret = htobe32(nret); va_start(ap, nret); for (i = 0; i < ninputs; i++) @@ -234,7 +242,10 @@ /* Assign rets */ if (nret) { - for (i = 0; i < nret; i++) + /* All RTAS calls return a status in rets[0] */ + *(rets[0]) = be32toh(args.args[ninputs]); + + for (i = 1; i < nret; i++) *(rets[i]) = args.args[ninputs + i]; } @@ -294,7 +305,8 @@ memcpy(kernbuf, workarea, PAGE_SIZE); do { - rc = sc_rtas_call(token, 2, 1, workarea_pa, extent_pa, &status); + rc = sc_rtas_call(token, 2, 1, htobe32(workarea_pa), + htobe32(extent_pa), &status); if (rc < 0) break; @@ -657,17 +669,21 @@ int sc_get_sensor(int token, int sensor, int index, int *state) { uint64_t elapsed = 0; + uint32_t be_state; int status; int rc; do { - rc = sc_rtas_call(token, 2, 2, sensor, index, &status, state); + rc = sc_rtas_call(token, 2, 2, htobe32(sensor), + htobe32(index), &status, &be_state); if (rc) return rc; rc = handle_delay(status, &elapsed); } while (rc == CALL_AGAIN); + *state = be32toh(be_state); + dbg1("(%d, %d, %p) = %d, %d\n", sensor, index, state, rc ? rc : status, *state); return rc ? rc : status; @@ -1078,8 +1094,9 @@ int rc; do { - rc = sc_rtas_call(token, 3, 1, indicator, index, - new_value, &status); + rc = sc_rtas_call(token, 3, 1, htobe32(indicator), + htobe32(index), + htobe32(new_value), &status); if (rc) return rc; @@ -1103,18 +1120,21 @@ int sc_set_power_level(int token, int powerdomain, int level, int *setlevel) { uint64_t elapsed = 0; + uint32_t be_setlevel; int status; int rc; do { - rc = sc_rtas_call(token, 2, 2, powerdomain, level, &status, - setlevel); + rc = sc_rtas_call(token, 2, 2, htobe32(powerdomain), + htobe32(level), &status, &be_setlevel); if (rc) return rc; rc = handle_delay(status, &elapsed); } while (rc == CALL_AGAIN); + *setlevel = be32toh(be_setlevel); + dbg1("(%d, %d, %p) = %d, %d\n", powerdomain, level, setlevel, rc ? rc : status, *setlevel); return rc ? rc : status; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/get_rtas_event.c new/librtas-1.3.10/librtasevent_src/get_rtas_event.c --- old/librtas-1.3.9/librtasevent_src/get_rtas_event.c 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/get_rtas_event.c 2014-03-21 21:31:52.000000000 +0100 @@ -147,7 +147,7 @@ * @return section identifier on success, -1 on failure */ int -re_scn_id(struct rtas_v6_hdr *v6hdr) +re_scn_id(struct rtas_v6_hdr_raw *v6hdr) { if (strncmp(v6hdr->id, RTAS_DUMP_SCN_ID, 2) == 0) return RTAS_DUMP_SCN; @@ -211,6 +211,67 @@ return _get_re_scn(re->event_scns, scn_id); } +/** + * parse_re_hdr + */ +static void parse_re_hdr(struct rtas_event *re, struct rtas_event_hdr *re_hdr) +{ + struct rtas_event_hdr_raw *rawhdr; + + rawhdr = (struct rtas_event_hdr_raw *)(re->buffer + re->offset); + + re_hdr->version = rawhdr->version; + + re_hdr->severity = (rawhdr->data1 & 0xE0) >> 5; + re_hdr->disposition = (rawhdr->data1 & 0x1C) >> 3; + re_hdr->extended = (rawhdr->data1 & 0x04) >> 2; + + re_hdr->initiator = (rawhdr->data2 & 0xF0) >> 4; + re_hdr->target = rawhdr->data2 & 0x0F; + re_hdr->type = rawhdr->type; + + re_hdr->ext_log_length = be32toh(rawhdr->ext_log_length); + + re->offset += RE_EVENT_HDR_SZ; + add_re_scn(re, re_hdr, RTAS_EVENT_HDR); +} + +static void parse_re_exthdr(struct rtas_event *re, + struct rtas_event_exthdr *rex_hdr) +{ + struct rtas_event_exthdr_raw *rawhdr; + + rawhdr = (struct rtas_event_exthdr_raw *)(re->buffer + re->offset); + + rex_hdr->valid = (rawhdr->data1 & 0x80) >> 7; + rex_hdr->unrecoverable = (rawhdr->data1 & 0x40) >> 6; + rex_hdr->recoverable = (rawhdr->data1 & 0x20) >> 5; + rex_hdr->unrecoverable_bypassed = (rawhdr->data1 & 0x10) >> 4; + rex_hdr->predictive = (rawhdr->data1 & 0x08) >> 3; + rex_hdr->newlog = (rawhdr->data1 & 0x04) >> 2; + rex_hdr->bigendian = (rawhdr->data1 & 0x02) >> 1; + + rex_hdr->platform_specific = (rawhdr->data2 & 0x80) >> 7; + rex_hdr->platform_value = rawhdr->data2 & 0x0F; + + rex_hdr->power_pc = (rawhdr->data3 & 0x80) >> 7; + rex_hdr->addr_invalid = (rawhdr->data3 & 0x10) >> 4; + rex_hdr->format_type = rawhdr->data3 & 0x0F; + + rex_hdr->non_hardware = (rawhdr->data4 & 0x80) >> 7; + rex_hdr->hot_plug = (rawhdr->data4 & 0x40) >> 6; + rex_hdr->group_failure = (rawhdr->data4 & 0x20) >> 5; + rex_hdr->residual = (rawhdr->data4 & 0x08) >> 3; + rex_hdr->boot = (rawhdr->data4 & 0x04) >> 2; + rex_hdr->config_change = (rawhdr->data4 & 0x02) >> 1; + rex_hdr->post = rawhdr->data4 & 0x01; + + parse_rtas_time(&rex_hdr->time, &rawhdr->time); + parse_rtas_date(&rex_hdr->date, &rawhdr->date); + + re->offset += RE_EXT_HDR_SZ; + add_re_scn(re, rex_hdr, RTAS_EVENT_EXT_HDR); +} /** * parse_v6_rtas_event @@ -222,7 +283,7 @@ struct rtas_event * parse_v6_rtas_event(struct rtas_event *re) { - struct rtas_v6_hdr *v6hdr; + struct rtas_v6_hdr_raw *v6hdr; char *ibm; ibm = re->buffer + re->offset; @@ -248,7 +309,7 @@ while (re->offset < re->event_length) { int scn_id, rc; - v6hdr = (struct rtas_v6_hdr *)(re->buffer + re->offset); + v6hdr = (struct rtas_v6_hdr_raw *)(re->buffer + re->offset); scn_id = re_scn_id(v6hdr); @@ -275,7 +336,12 @@ 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: @@ -330,8 +396,7 @@ return NULL; } - rtas_copy(RE_SHDR_OFFSET(re_hdr), re, RE_EVENT_HDR_SZ); - add_re_scn(re, re_hdr, RTAS_EVENT_HDR); + parse_re_hdr(re, re_hdr); /* Validate the length of the buffer passed in. */ re->event_length = re_hdr->ext_log_length + RE_EVENT_HDR_SZ; @@ -352,8 +417,7 @@ return NULL; } - rtas_copy(RE_SHDR_OFFSET(rex_hdr), re, RE_EXT_HDR_SZ); - add_re_scn(re, rex_hdr, RTAS_EVENT_EXT_HDR); + parse_re_exthdr(re, rex_hdr); if (re_hdr->version == 6) return parse_v6_rtas_event(re); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/librtasevent.h new/librtas-1.3.10/librtasevent_src/librtasevent.h --- old/librtas-1.3.9/librtasevent_src/librtasevent.h 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/librtasevent.h 2014-03-21 21:31:52.000000000 +0100 @@ -99,6 +99,12 @@ * @brief definition of date format in rtas events */ struct rtas_date { + uint32_t year; + uint32_t month; + uint32_t day; +}; + +struct rtas_date_raw { uint32_t year:16; uint32_t month:8; uint32_t day:8; @@ -109,6 +115,13 @@ * @brief definition of timestamp in rtas events */ struct rtas_time { + uint32_t hour; + uint32_t minutes; + uint32_t seconds; + uint32_t hundredths; +}; + +struct rtas_time_raw { uint32_t hour:8; uint32_t minutes:8; uint32_t seconds:8; @@ -125,8 +138,8 @@ */ struct rtas_event_hdr { struct scn_header shdr; - uint32_t version:8; /**< Architectural version */ - uint32_t severity:3; /**< Severity level of error */ + uint32_t version; /**< Architectural version */ + uint32_t severity; /**< Severity level of error */ #define RTAS_HDR_SEV_NO_ERROR 0 #define RTAS_HDR_SEV_EVENT 1 #define RTAS_HDR_SEV_WARNING 2 @@ -135,14 +148,13 @@ #define RTAS_HDR_SEV_FATAL 5 #define RTAS_HDR_SEV_ALREADY_REPORTED 6 - uint32_t disposition:2; /**< Degree of recovery */ + uint32_t disposition; /**< Degree of recovery */ #define RTAS_HDR_DISP_FULLY_RECOVERED 0 #define RTAS_HDR_DISP_LIMITED_RECOVERY 1 #define RTAS_HDR_DISP_NOT_RECOVERED 2 - uint32_t extended:1; /**< extended log present? */ - uint32_t /* reserved */ :2; - uint32_t initiator:4; /**< Initiator of event */ + uint32_t extended; /**< extended log present? */ + uint32_t initiator; /**< Initiator of event */ #define RTAS_HDR_INIT_UNKNOWN 0 #define RTAS_HDR_INIT_CPU 1 #define RTAS_HDR_INIT_PCI 2 @@ -150,7 +162,7 @@ #define RTAS_HDR_INIT_MEMORY 4 #define RTAS_HDR_INIT_HOT_PLUG 5 - uint32_t target:4; /**< Target of failed operation */ + uint32_t target; /**< Target of failed operation */ #define RTAS_HDR_TARGET_UNKNOWN 0 #define RTAS_HDR_TARGET_CPU 1 #define RTAS_HDR_TARGET_PCI 2 @@ -158,7 +170,7 @@ #define RTAS_HDR_TARGET_MEMORY 4 #define RTAS_HDR_TARGET_HOT_PLUG 5 - uint32_t type:8; /**< General event or error*/ + uint32_t type; /**< General event or error*/ #define RTAS_HDR_TYPE_RETRY 1 #define RTAS_HDR_TYPE_TCE_ERR 2 #define RTAS_HDR_TYPE_INTERN_DEV_FAIL 3 @@ -178,9 +190,17 @@ #define RTAS_HDR_TYPE_DUMP_NOTIFICATION 228 #define RTAS_HDR_TYPE_HOTPLUG 229 - uint32_t ext_log_length:32; /**< length in bytes */ + uint32_t ext_log_length; /**< length in bytes */ }; +struct rtas_event_hdr_raw { + uint32_t version:8; + uint32_t data1:8; + uint32_t data2:8; + uint32_t type:8; + uint32_t ext_log_length; +} __attribute__((__packed__)); + #define RE_EVENT_HDR_SZ 8 /** @@ -189,23 +209,20 @@ */ struct rtas_event_exthdr { struct scn_header shdr; - uint32_t valid:1; - uint32_t unrecoverable:1; - uint32_t recoverable:1; - uint32_t unrecoverable_bypassed:1; - uint32_t predictive:1; - uint32_t newlog:1; - uint32_t bigendian:1; - uint32_t /* reserved */:1; - - uint32_t platform_specific:1; /**< only in version 3+ */ - uint32_t /* reserved */:3; - uint32_t platform_value:4; /**< valid iff platform_specific */ - - uint32_t power_pc:1; - uint32_t /* reserved */:2; - uint32_t addr_invalid:1; - uint32_t format_type:4; + uint32_t valid; + uint32_t unrecoverable; + uint32_t recoverable; + uint32_t unrecoverable_bypassed; + uint32_t predictive; + uint32_t newlog; + uint32_t bigendian; + + uint32_t platform_specific; /**< only in version 3+ */ + uint32_t platform_value; /**< valid iff platform_specific */ + + uint32_t power_pc; + uint32_t addr_invalid; + uint32_t format_type; #define RTAS_EXTHDR_FMT_CPU 1 #define RTAS_EXTHDR_FMT_MEMORY 2 #define RTAS_EXTHDR_FMT_IO 3 @@ -217,20 +234,31 @@ #define RTAS_EXTHDR_FMT_VEND_SPECIFIC_2 15 /* This group is in version 3+ only */ - uint32_t non_hardware:1; /**< Firmware or software is suspect */ - uint32_t hot_plug:1; - uint32_t group_failure:1; - uint32_t /* reserved */:1; - - uint32_t residual:1; /**< Residual error from previous boot */ - uint32_t boot:1; /**< Error during boot */ - uint32_t config_change:1; /**< Configuration chang since last boot */ - uint32_t post:1; + uint32_t non_hardware; /**< Firmware or software is suspect */ + uint32_t hot_plug; + uint32_t group_failure; + + uint32_t residual; /**< Residual error from previous boot */ + uint32_t boot; /**< Error during boot */ + uint32_t config_change; /**< Configuration chang since last boot */ + uint32_t post; struct rtas_time time; /**< Time of error in BCD HHMMSS00 */ struct rtas_date date; /**< Time of error in BCD YYYYMMDD */ }; +struct rtas_event_exthdr_raw { + uint32_t data1:8; + uint32_t data2:8; + uint32_t data3:8; + + /* This group is in version 3+ only */ + uint32_t data4:8; + + struct rtas_time_raw time; + struct rtas_date_raw date; +}__attribute__((__packed__)); + #define RE_EXT_HDR_SZ 12 /** @@ -278,19 +306,25 @@ /* The following represent a version 6 RTAS EPOW event */ struct rtas_v6_hdr v6hdr; - uint32_t _v6_sensor_value:4; - uint32_t _v6_action_code:4; - uint32_t event_modifier:8; /**< EPOW event modifier */ + uint32_t event_modifier; /**< EPOW event modifier */ #define RTAS_EPOW_MOD_NA 0x00 #define RTAS_EPOW_MOD_NORMAL_SHUTDOWN 0x01 #define RTAS_EPOW_MOD_UTILITY_POWER_LOSS 0x02 #define RTAS_EPOW_MOD_CRIT_FUNC_LOSS 0x03 #define RTAS_EPOW_MOD_AMBIENT_TEMP 0x04 - uint32_t /* reserved */ :16; char reason_code[8]; /**< platform specific reason code */ }; +struct rtas_v6_epow_scn_raw { + struct rtas_v6_hdr_raw v6hdr; + + uint32_t data1:8; + uint32_t event_modifier:8; + + char reason_code[8]; +}__attribute__((__packed__)); + /* defines used for copying in data from the RTAS event */ #define RE_EPOW_V6_SCN_SZ 20 @@ -361,17 +395,17 @@ /* The following represents the version 6 rtas event */ struct rtas_v6_hdr v6hdr; - uint32_t event_type:8; /**< I/O event type */ + uint32_t event_type; /**< I/O event type */ #define RTAS_IO_TYPE_DETECTED 0x01 #define RTAS_IO_TYPE_RECOVERED 0x02 #define RTAS_IO_TYPE_EVENT 0x03 #define RTAS_IO_TYPE_RPC_PASS_THRU 0x04 - uint32_t rpc_length:8; /**< RPC field length. The RPC data + uint32_t rpc_length; /**< RPC field length. The RPC data is optional and appears after this structure in the event if present */ - uint32_t scope:8; /**< event scope */ + uint32_t scope; /**< event scope */ #define RTAS_IO_SCOPE_NA 0x00 #define RTAS_IO_SCOPE_RIO_HUB 0x36 #define RTAS_IO_SCOPE_RIO_BRIDGE 0x37 @@ -379,16 +413,28 @@ #define RTAS_IO_SCOPE_EADS_GLOBAL 0x39 #define RTAS_IO_SCOPE_EADS_SLOT 0x3A - uint32_t subtype:8; /**< I/O event sub-type */ + uint32_t subtype; /**< I/O event sub-type */ #define RTAS_IO_SUBTYPE_NA 0x00 #define RTAS_IO_SUBTYPE_REBALANCE 0x01 #define RTAS_IO_SUBTYPE_NODE_ONLINE 0x02 #define RTAS_IO_SUBTYPE_NODE_OFFLINE 0x04 #define RTAS_IO_SUBTYPE_PLAT_DUMP_SZ 0x05 - uint32_t drc_index:32; /**< DRC index */ + uint32_t drc_index; /**< DRC index */ char rpc_data[216]; }; + +struct rtas_v6_io_scn_raw { + struct rtas_v6_hdr_raw v6hdr; + + uint32_t event_type:8; + uint32_t rpc_length:8; + uint32_t scope:8; + uint32_t subtype:8; + + uint32_t drc_index; + char rpc_data[216]; +}__attribute__((__packed__)); #define RE_IO_V6_SCN_OFFSET (RE_SCN_HDR_SZ + RE_V4_SCN_SZ) Files old/librtas-1.3.9/librtasevent_src/librtasevent.so.1.3.9 and new/librtas-1.3.10/librtasevent_src/librtasevent.so.1.3.9 differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/librtasevent_v6.h new/librtas-1.3.10/librtasevent_src/librtasevent_v6.h --- old/librtas-1.3.9/librtasevent_src/librtasevent_v6.h 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/librtasevent_v6.h 2014-03-21 21:31:52.000000000 +0100 @@ -24,12 +24,22 @@ */ struct rtas_v6_hdr { char id[2]; /**< section id */ - uint32_t length:16; /**< section length */ - uint32_t version:8; /**< section version */ - uint32_t subtype:8; /**< section sub-type id */ - uint32_t creator_comp_id:16; /**< component id of section creator */ + uint32_t length; /**< section length */ + uint32_t version; /**< section version */ + uint32_t subtype; /**< section sub-type id */ + uint32_t creator_comp_id; /**< component id of section creator */ }; +struct rtas_v6_hdr_raw { + char id[2]; + uint32_t length:16; + uint32_t version:8; + uint32_t subtype:8; + uint32_t creator_comp_id:16; +}__attribute__((__packed__)); + +#define RTAS_V6_HDR_SIZE 16 + /* defines for the rtas_event_scn id */ #define RTAS_DUMP_SCN_ID "DH" #define RTAS_EPOW_SCN_ID "EP" @@ -56,27 +66,44 @@ struct rtas_date date; struct rtas_time time; - uint32_t /* reserved */:32; - uint32_t /* reserved */:32; - char creator_id; /**< subsystem creator id */ #define RTAS_PH_CREAT_SERVICE_PROC 'E' #define RTAS_PH_CREAT_HYPERVISOR 'H' #define RTAS_PH_CREAT_POWER_CONTROL 'W' #define RTAS_PH_CREAT_PARTITION_FW 'L' + uint32_t scn_count; /**< number of sections in log */ + uint32_t creator_subid_hi; + uint32_t creator_subid_lo; + + uint32_t plid; /**< platform log id */ + uint32_t log_entry_id; /**< Unique log entry id */ + char creator_subid_name[9]; +}; + +struct rtas_priv_hdr_scn_raw { + struct rtas_v6_hdr_raw v6hdr; + + struct rtas_date_raw date; + struct rtas_time_raw time; + + uint32_t /* reserved */:32; + uint32_t /* reserved */:32; + + char creator_id; uint32_t /* reserved */ :16; - uint32_t scn_count:8; /**< number of sections in log */ + uint32_t scn_count:8; + uint32_t /* reserved */ :32; uint32_t creator_subid_hi; uint32_t creator_subid_lo; - uint32_t plid; /**< platform log id */ - uint32_t log_entry_id; /**< Unique log entry id */ + uint32_t plid; + uint32_t log_entry_id; char creator_subid_name[9]; -}; +}__attribute__((__packed__)); /** * @struct rtas_v6_main_b_scn @@ -86,10 +113,10 @@ struct scn_header shdr; struct rtas_v6_hdr v6hdr; - uint32_t subsystem_id:8; /**< subsystem id */ - uint32_t event_data:8; - uint32_t event_severity:8; - uint32_t event_type:8; /**< error/event severity */ + uint32_t subsystem_id; /**< subsystem id */ + uint32_t event_data; + uint32_t event_severity; + uint32_t event_type; /**< error/event severity */ #define RTAS_UH_TYPE_NA 0x00 #define RTAS_UH_TYPE_INFO_ONLY 0x01 #define RTAS_UH_TYPE_DUMP_NOTIFICATION 0x08 @@ -105,19 +132,30 @@ #define RTAS_UH_TYPE_NORMAL_SHUTDOWN 0xD0 #define RTAS_UH_TYPE_ABNORMAL_SHUTDOWN 0xE0 - uint32_t /* reserved */:32; - uint32_t /* reserved */:16; - - uint32_t action:16; /**< erro action code */ + uint32_t action; /**< erro action code */ #define RTAS_UH_ACTION_SERVICE 0x8000 #define RTAS_UH_ACTION_HIDDEN 0x4000 #define RTAS_UH_ACTION_REPORT_EXTERNALLY 0x2000 #define RTAS_UH_ACTION_HMC_ONLY 0x1000 #define RTAS_UH_ACTION_CALL_HOME 0x0800 #define RTAS_UH_ACTION_ISO_INCOMPLETE 0x0400 +}; + +struct rtas_usr_hdr_scn_raw { + struct rtas_v6_hdr_raw v6hdr; + + uint32_t subsystem_id:8; + uint32_t event_data:8; + uint32_t event_severity:8; + uint32_t event_type:8; + + uint32_t /* reserved */:32; + + uint32_t /* reserved */:16; + uint32_t action:16; uint32_t /* reserved */ :32; -}; +}__attribute__((__packed__)); #define RE_USR_HDR_SCN_SZ 24 @@ -142,22 +180,35 @@ #define RTAS_DUMP_SUBTYPE_PARTDUMP 0x06 #define RTAS_DUMP_SUBTYPE_PLATDUMP 0x07 - uint32_t id:32; /**< dump id */ - uint32_t location:1; /**< 0 => dump sent to HMC + uint32_t id; /**< dump id */ + uint32_t location; /**< 0 => dump sent to HMC 1 => dump sent to partition */ - uint32_t fname_type:1; /**< 0 => file name in ASCII + uint32_t fname_type; /**< 0 => file name in ASCII 1 => file name in hex */ - uint32_t size_valid:1; /**< dump size field valid */ + uint32_t size_valid; /**< dump size field valid */ - uint32_t /* reserved */ :5; - uint32_t /* reserved */ :16; - uint32_t id_len:8; /**< OS assigned dump id length */ + uint32_t id_len; /**< OS assigned dump id length */ - uint32_t size_hi:32; /**< dump size (hi-bits) */ - uint32_t size_lo:32; /**< dump size (low bits) */ - char os_id[40]; /**< OS assigned dump id */ + uint32_t size_hi; /**< dump size (hi-bits) */ + uint32_t size_lo; /**< dump size (low bits) */ + char os_id[40]; /**< OS assigned dump id */ }; +struct rtas_dump_scn_raw { + struct rtas_v6_hdr_raw v6hdr; + + uint32_t id; + + uint32_t data1:8; + + uint32_t /* reserved */ :16; + uint32_t id_len:8; + + uint32_t size_hi; + uint32_t size_lo; + char os_id[40]; +}__attribute__((__packed__)); + #define RE_V6_DUMP_SCN_SZ 64 @@ -169,29 +220,44 @@ struct scn_header shdr; struct rtas_v6_hdr v6hdr; - uint32_t resource:8; /**< resource type */ + uint32_t resource; /**< resource type */ #define RTAS_LRI_RES_PROC 0x10 #define RTAS_LRI_RES_SHARED_PROC 0x11 #define RTAS_LRI_RES_MEM_PAGE 0x40 #define RTAS_LRI_RES_MEM_LMB 0x41 - uint32_t /* reserved */ :8; - uint32_t capacity:16; /**< entitled capacity */ + uint32_t capacity; /**< entitled capacity */ union { - uint32_t _lri_cpu_id:32; /**< logical CPU id (type = proc) */ - uint32_t _lri_drc_index:32; /**< DRC index (type = mem LMB) */ - uint32_t _lri_mem_addr_lo; /**< mem logical addr low bits + uint32_t _lri_cpu_id; /**< logical CPU id (type = proc) */ + uint32_t _lri_drc_index; /**< DRC index (type = mem LMB) */ + uint32_t _lri_mem_addr_lo; /**< mem logical addr low bits (type = mem page) */ } _lri_u1; #define lri_cpu_id _lri_u1._lri_cpu_id #define lri_drc_index _lri_u1._lri_drc_index #define lri_mem_addr_lo _lri_u1._lri_mem_addr_lo - uint32_t lri_mem_addr_hi:32; /**< mem logical addr high bits + uint32_t lri_mem_addr_hi; /**< mem logical addr high bits (type = mem page) */ }; +struct rtas_lri_scn_raw { + struct rtas_v6_hdr_raw v6hdr; + + uint32_t resource:8; + uint32_t /* reserved */:8; + uint32_t capacity:16; + + union { + uint32_t _lri_cpu_id:32; + uint32_t _lri_drc_index:32; + uint32_t _lri_mem_addr_lo; + } _lri_u1; + + uint32_t lri_mem_addr_hi; +}__attribute__((__packed__)); + #define RE_LRI_SCN_SZ 20 /** @@ -306,7 +372,7 @@ */ struct rtas_src_scn { struct scn_header shdr; - struct rtas_v6_hdr v6hdr; + struct rtas_v6_hdr_raw v6hdr; uint32_t version:8; /**< SRC version */ char src_platform_data[7]; /**< platform specific data */ @@ -340,7 +406,7 @@ */ struct rtas_mt_scn { struct scn_header shdr; - struct rtas_v6_hdr v6hdr; + struct rtas_v6_hdr_raw v6hdr; struct rtas_mtms mtms; }; @@ -385,6 +451,21 @@ } u1; }; +struct rtas_hotplug_scn_raw { + struct rtas_v6_hdr_raw v6hdr; + + uint32_t type:8; + uint32_t action:8; + uint32_t identifier:8; + uint32_t /* reserved */:8; + + union { + uint32_t drc_index:32; + uint32_t count:32; + char drc_name[1]; + } u1; +}__attribute__((__packed__)); + #define RE_HOTPLUG_SCN_SZ 16 #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/print_rtas_event.c new/librtas-1.3.10/librtasevent_src/print_rtas_event.c --- old/librtas-1.3.9/librtasevent_src/print_rtas_event.c 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/print_rtas_event.c 2014-03-21 21:31:52.000000000 +0100 @@ -248,6 +248,7 @@ case 226: return "Platform Information Event"; case 227: return "Resource Deallocation Event"; case 228: return "Dump Notification Event"; + case 229: return "Hotplug Event"; } return rtas_event_error_type[0]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/rtas_dump.c new/librtas-1.3.10/librtasevent_src/rtas_dump.c --- old/librtas-1.3.9/librtasevent_src/rtas_dump.c 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/rtas_dump.c 2014-03-21 21:31:52.000000000 +0100 @@ -24,6 +24,7 @@ parse_dump_scn(struct rtas_event *re) { struct rtas_dump_scn *dump; + struct rtas_dump_scn_raw *rawhdr; dump = malloc(sizeof(*dump)); if (dump == NULL) { @@ -33,7 +34,22 @@ dump->shdr.raw_offset = re->offset; - rtas_copy(RE_SHDR_OFFSET(dump), re, RE_V6_DUMP_SCN_SZ); + rawhdr = (struct rtas_dump_scn_raw *)(re->buffer + re->offset); + + parse_v6_hdr(&dump->v6hdr, &rawhdr->v6hdr); + dump->id = be32toh(rawhdr->id); + + dump->location = (rawhdr->data1 & 0x80) >> 7; + dump->fname_type = (rawhdr->data1 & 0x40) >> 6; + dump->size_valid = (rawhdr->data1 & 0x20) >> 5; + dump->id_len = rawhdr->id_len; + + dump->size_hi = be32toh(rawhdr->size_hi); + dump->size_lo = be32toh(rawhdr->size_lo); + + memcpy(dump->os_id, rawhdr->os_id, 40); + + re->offset += RE_V6_DUMP_SCN_SZ; add_re_scn(re, dump, RTAS_DUMP_SCN); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/rtas_epow.c new/librtas-1.3.10/librtasevent_src/rtas_epow.c --- old/librtas-1.3.9/librtasevent_src/rtas_epow.c 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/rtas_epow.c 2014-03-21 21:31:52.000000000 +0100 @@ -25,6 +25,7 @@ parse_epow_scn(struct rtas_event *re) { struct rtas_epow_scn *epow; + struct rtas_v6_epow_scn_raw *rawhdr; epow = malloc(sizeof(*epow)); if (epow == NULL) { @@ -39,9 +40,15 @@ if (re->version < 6) { rtas_copy(RE_SHDR_OFFSET(epow), re, RE_V4_SCN_SZ); } else { - rtas_copy(RE_SHDR_OFFSET(epow) + RE_V4_SCN_SZ, re, RE_EPOW_V6_SCN_SZ); - epow->sensor_value = epow->_v6_sensor_value; - epow->action_code = epow->_v6_action_code; + rawhdr = (struct rtas_v6_epow_scn_raw *)(re->buffer + re->offset); + + parse_v6_hdr(&epow->v6hdr, &rawhdr->v6hdr); + epow->sensor_value = (rawhdr->data1 & 0xF0) >> 4; + epow->action_code = rawhdr->data1 & 0x0F; + epow->event_modifier = rawhdr->event_modifier; + + memcpy(epow->reason_code, rawhdr->reason_code, 8); + re->offset += RE_EPOW_V6_SCN_SZ; } add_re_scn(re, epow, RTAS_EPOW_SCN); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/rtas_event.h new/librtas-1.3.10/librtasevent_src/rtas_event.h --- old/librtas-1.3.9/librtasevent_src/rtas_event.h 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/rtas_event.h 2014-03-21 21:31:52.000000000 +0100 @@ -19,6 +19,10 @@ void rtas_copy(void *, struct rtas_event *, uint32_t); /* parse routines */ +void parse_rtas_date(struct rtas_date *, struct rtas_date_raw *); +void parse_rtas_time(struct rtas_time *, struct rtas_time_raw *); +void parse_v6_hdr(struct rtas_v6_hdr *, struct rtas_v6_hdr_raw *); + int parse_priv_hdr_scn(struct rtas_event *); int parse_usr_hdr_scn(struct rtas_event *); int parse_epow_scn(struct rtas_event *); @@ -66,6 +70,6 @@ int rtas_print(char *fmt, ...); struct scn_header * get_re_scn(struct rtas_event *, int); void add_re_scn(struct rtas_event *, void *, int); -int re_scn_id(struct rtas_v6_hdr *); +int re_scn_id(struct rtas_v6_hdr_raw *); #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/rtas_hotplug.c new/librtas-1.3.10/librtasevent_src/rtas_hotplug.c --- old/librtas-1.3.9/librtasevent_src/rtas_hotplug.c 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/rtas_hotplug.c 2014-03-21 21:31:52.000000000 +0100 @@ -24,6 +24,7 @@ parse_hotplug_scn(struct rtas_event *re) { struct rtas_hotplug_scn *hotplug; + struct rtas_hotplug_scn_raw *rawhdr; hotplug = malloc(sizeof(*hotplug)); if (hotplug == NULL) { @@ -33,10 +34,28 @@ hotplug->shdr.raw_offset = re->offset; - rtas_copy(RE_SHDR_OFFSET(hotplug), re, RE_HOTPLUG_SCN_SZ); - add_re_scn(re, hotplug, RTAS_HP_SCN); + rawhdr = (struct rtas_hotplug_scn_raw *)(re->buffer + re->offset); + parse_v6_hdr(&hotplug->v6hdr, &rawhdr->v6hdr); + hotplug->type = rawhdr->type; + hotplug->action = rawhdr->action; + hotplug->identifier = rawhdr->identifier; + + switch (hotplug->identifier) { + case RTAS_HP_ID_DRC_NAME: + /* Need to Fix up */ + break; + case RTAS_HP_ID_DRC_INDEX: + hotplug->u1.drc_index = be32toh(rawhdr->u1.drc_index); + break; + case RTAS_HP_ID_DRC_COUNT: + hotplug->u1.count = be32toh(rawhdr->u1.count); + break; + } + /* TODO: Fixup scn size when drc_name is included */ + re->offset += RE_HOTPLUG_SCN_SZ; + add_re_scn(re, hotplug, RTAS_HP_SCN); return 0; } @@ -54,6 +73,10 @@ return (struct rtas_hotplug_scn *)get_re_scn(re, RTAS_HP_SCN); } +static char *hotplug_types[] = {"", "CPU", "Memory", "Slot", "PHB", "PCI"}; +static char *hotplug_actions[] = {"", "Add", "Remove"}; +static char *hotplug_ids[] = {"", "DRC Name", "DRC Index", "Count"}; + /** * print_re_hotplug_scn * @brief Print the contents of a version 6 Hotplug section @@ -76,11 +99,12 @@ hotplug = (struct rtas_hotplug_scn *)shdr; len += print_v6_hdr("Hotplug section", &hotplug->v6hdr, verbosity); - len += rtas_print(PRNT_FMT_R, "Hotplug Type:", hotplug->type); - - len += rtas_print(PRNT_FMT_R, "Hotplug Action:", hotplug->action); - - len += rtas_print(PRNT_FMT_R, "Hotplug Identifier:", hotplug->identifier); + len += rtas_print(PRNT_FMT" (%s)\n", "Hotplug Type:", hotplug->type, + hotplug_types[hotplug->type]); + len += rtas_print(PRNT_FMT" (%s)\n", "Hotplug Action:", hotplug->action, + hotplug_actions[hotplug->action]); + len += rtas_print(PRNT_FMT" (%s)\n", "Hotplug Identifier:", + hotplug->identifier, hotplug_ids[hotplug->identifier]); if (hotplug->identifier == RTAS_HP_ID_DRC_NAME) { len += rtas_print("%-20s%s", "Hotplug drc_name:", hotplug->u1.drc_name); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/rtas_io.c new/librtas-1.3.10/librtasevent_src/rtas_io.c --- old/librtas-1.3.9/librtasevent_src/rtas_io.c 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/rtas_io.c 2014-03-21 21:31:52.000000000 +0100 @@ -37,13 +37,21 @@ if (re->version < 6) { rtas_copy(RE_SHDR_OFFSET(io), re, RE_V4_SCN_SZ); - } - else { - struct rtas_v6_hdr *v6hdr; + } else { + struct rtas_v6_io_scn_raw *rawhdr; + + rawhdr = (struct rtas_v6_io_scn_raw *)(re->buffer + re->offset); + parse_v6_hdr(&io->v6hdr, &rawhdr->v6hdr); + + io->event_type = rawhdr->event_type; + io->rpc_length = rawhdr->rpc_length; + io->scope = rawhdr->scope; + io->subtype = rawhdr->subtype; - v6hdr = (struct rtas_v6_hdr *)RE_EVENT_OFFSET(re); + io->drc_index = be32toh(rawhdr->drc_index); + memcpy(io->rpc_data, rawhdr->rpc_data, 216); - rtas_copy(RE_SHDR_OFFSET(io) + RE_V4_SCN_SZ, re, v6hdr->length); + re->offset += io->v6hdr.length; } add_re_scn(re, io, RTAS_IO_SCN); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/rtas_lri.c new/librtas-1.3.10/librtasevent_src/rtas_lri.c --- old/librtas-1.3.9/librtasevent_src/rtas_lri.c 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/rtas_lri.c 2014-03-21 21:31:52.000000000 +0100 @@ -24,6 +24,7 @@ parse_lri_scn(struct rtas_event *re) { struct rtas_lri_scn *lri; + struct rtas_lri_scn_raw *rawhdr; lri = malloc(sizeof(*lri)); if (lri == NULL) { @@ -33,7 +34,16 @@ lri->shdr.raw_offset = re->offset; - rtas_copy(RE_SHDR_OFFSET(lri), re, RE_LRI_SCN_SZ); + rawhdr = (struct rtas_lri_scn_raw *)(re->buffer + re->offset); + + parse_v6_hdr(&lri->v6hdr, &rawhdr->v6hdr); + lri->resource = rawhdr->resource; + lri->capacity = be16toh(rawhdr->capacity); + + lri->lri_mem_addr_lo = be32toh(rawhdr->lri_mem_addr_lo); + lri->lri_mem_addr_hi = be32toh(rawhdr->lri_mem_addr_hi); + + re->offset += RE_LRI_SCN_SZ; add_re_scn(re, lri, RTAS_LRI_SCN); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/rtas_srcfru.c new/librtas-1.3.10/librtasevent_src/rtas_srcfru.c --- old/librtas-1.3.9/librtasevent_src/rtas_srcfru.c 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/rtas_srcfru.c 2014-03-21 21:31:52.000000000 +0100 @@ -543,9 +543,11 @@ src = (struct rtas_src_scn *)shdr; if (strncmp(src->v6hdr.id, RTAS_PSRC_SCN_ID, 2) == 0) - len += print_v6_hdr("Primary SRC Section", &src->v6hdr, verbosity); + len += print_v6_hdr("Primary SRC Section", + (struct rtas_v6_hdr *)&src->v6hdr, verbosity); else - len += print_v6_hdr("Secondary SRC Section", &src->v6hdr, verbosity); + len += print_v6_hdr("Secondary SRC Section", + (struct rtas_v6_hdr *)&src->v6hdr, verbosity); if (verbosity >= 2) { len += rtas_print(PRNT_FMT_2"\n", "SRC Version:", src->version, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/librtas-1.3.9/librtasevent_src/rtas_v6_misc.c new/librtas-1.3.10/librtasevent_src/rtas_v6_misc.c --- old/librtas-1.3.9/librtasevent_src/rtas_v6_misc.c 2014-03-03 21:25:01.000000000 +0100 +++ new/librtas-1.3.10/librtasevent_src/rtas_v6_misc.c 2014-03-21 21:31:52.000000000 +0100 @@ -26,6 +26,33 @@ "Aug", "Sep", "", "", "", "", "", "", "Oct", "Nov", "Dec"}; +void parse_rtas_date(struct rtas_date *rtas_date, + struct rtas_date_raw *rawdate) +{ + rtas_date->year = be16toh(rawdate->year); + rtas_date->month = rawdate->month; + rtas_date->day = rawdate->day; +} + +void parse_rtas_time(struct rtas_time *rtas_time, struct rtas_time_raw *rawtime) +{ + rtas_time->hour = rawtime->hour; + rtas_time->minutes = rawtime->minutes; + rtas_time->seconds = rawtime->seconds; + rtas_time->hundredths = rawtime->hundredths; +} + +void parse_v6_hdr(struct rtas_v6_hdr *v6hdr, struct rtas_v6_hdr_raw *rawv6) +{ + v6hdr->id[0] = rawv6->id[0]; + v6hdr->id[1] = rawv6->id[1]; + + v6hdr->length = be16toh(rawv6->length); + v6hdr->version = rawv6->version; + v6hdr->subtype = rawv6->subtype; + v6hdr->creator_comp_id = be16toh(rawv6->creator_comp_id); +} + /** * print_v6_scn_hdr * @brief print the generic version 6 section header @@ -63,6 +90,7 @@ parse_priv_hdr_scn(struct rtas_event *re) { struct rtas_priv_hdr_scn *privhdr; + struct rtas_priv_hdr_scn_raw *rawhdr; privhdr = malloc(sizeof(*privhdr)); if (privhdr == NULL) { @@ -73,10 +101,19 @@ memset(privhdr, 0, sizeof(*privhdr)); privhdr->shdr.raw_offset = re->offset; - /* Copy up through the creator subsection id. Sinc the subsection - * id can be ascii we null terminate it then copy the stuff after it. - */ - rtas_copy(RE_SHDR_OFFSET(privhdr), re, 48); + rawhdr = (struct rtas_priv_hdr_scn_raw *)(re->buffer + re->offset); + parse_v6_hdr(&privhdr->v6hdr, &rawhdr->v6hdr); + parse_rtas_date(&privhdr->date, &rawhdr->date); + parse_rtas_time(&privhdr->time, &rawhdr->time); + + privhdr->creator_id = rawhdr->creator_id; + privhdr->scn_count = rawhdr->scn_count; + + privhdr->creator_subid_hi = be32toh(rawhdr->creator_subid_hi); + privhdr->creator_subid_lo = be32toh(rawhdr->creator_subid_lo); + + privhdr->plid = be32toh(rawhdr->plid); + privhdr->log_entry_id = be32toh(rawhdr->log_entry_id); /* If the creator id is 'E', the the subsystem version is in ascii, * copy this info to a null terminated string. @@ -87,6 +124,7 @@ privhdr->creator_subid_name[8] = '\0'; } + re->offset += 48; add_re_scn(re, privhdr, RTAS_PRIV_HDR_SCN); return 0; } @@ -127,16 +165,11 @@ len += print_v6_hdr("Private Header", &privhdr->v6hdr, verbosity); - if (verbosity < 2) { - len += rtas_print("%-20s%x %s %x\n", "Date:", privhdr->date.day, - months[privhdr->date.month], privhdr->date.year); - len += rtas_print("%-20s%x:%x:%x:%x\n", "Time:", - privhdr->time.hour, privhdr->time.minutes, - privhdr->time.seconds, privhdr->time.hundredths); - } else { - len += rtas_print(PRNT_FMT_2, "Date:", privhdr->date, - "Time:", privhdr->time); - } + len += rtas_print("%-20s%x %s %x\n", "Date:", privhdr->date.day, + months[privhdr->date.month], privhdr->date.year); + len += rtas_print("%-20s%x:%x:%x:%x\n", "Time:", + privhdr->time.hour, privhdr->time.minutes, + privhdr->time.seconds, privhdr->time.hundredths); len += rtas_print("%-20s", "Creator ID:"); switch(privhdr->creator_id) { @@ -196,6 +229,7 @@ parse_usr_hdr_scn(struct rtas_event *re) { struct rtas_usr_hdr_scn *usrhdr; + struct rtas_usr_hdr_scn_raw *rawhdr; usrhdr = malloc(sizeof(*usrhdr)); if (usrhdr == NULL) { @@ -206,7 +240,16 @@ memset(usrhdr, 0, sizeof(*usrhdr)); usrhdr->shdr.raw_offset = re->offset; - rtas_copy(RE_SHDR_OFFSET(usrhdr), re, RE_USR_HDR_SCN_SZ); + rawhdr = (struct rtas_usr_hdr_scn_raw *)(re->buffer + re->offset); + parse_v6_hdr(&usrhdr->v6hdr, &rawhdr->v6hdr); + + usrhdr->subsystem_id = rawhdr->subsystem_id; + usrhdr->event_data = rawhdr->event_data; + usrhdr->event_severity = rawhdr->event_severity; + usrhdr->event_type = rawhdr->event_type; + usrhdr->action = be16toh(rawhdr->action); + + re->offset += RE_USR_HDR_SCN_SZ; add_re_scn(re, usrhdr, RTAS_USR_HDR_SCN); return 0; @@ -521,7 +564,7 @@ memset(mt, 0, sizeof(*mt)); mt->shdr.raw_offset = re->offset; - rtas_copy(RE_SHDR_OFFSET(mt), re, sizeof(struct rtas_v6_hdr)); + rtas_copy(RE_SHDR_OFFSET(mt), re, sizeof(struct rtas_v6_hdr_raw)); parse_mtms(re, &mt->mtms); add_re_scn(re, mt, RTAS_MT_SCN); @@ -563,7 +606,7 @@ mt = (struct rtas_mt_scn *)shdr; - len += print_v6_hdr("Machine Type", &mt->v6hdr, verbosity); + len += print_v6_hdr("Machine Type", (struct rtas_v6_hdr *)&mt->v6hdr, verbosity); len += print_mtms(&mt->mtms); len += rtas_print("\n"); @@ -578,7 +621,7 @@ parse_generic_v6_scn(struct rtas_event *re) { struct rtas_v6_generic *gen; - uint32_t copy_sz = sizeof(struct rtas_v6_hdr); + struct rtas_v6_hdr_raw *rawhdr; gen = malloc(sizeof(*gen)); if (gen == NULL) { @@ -589,10 +632,12 @@ memset(gen, 0, sizeof(*gen)); gen->shdr.raw_offset = re->offset; - rtas_copy(RE_SHDR_OFFSET(gen), re, copy_sz); - - if (gen->v6hdr.length > copy_sz) { - uint32_t data_sz = gen->v6hdr.length - copy_sz; + rawhdr = (struct rtas_v6_hdr_raw *)(re->buffer + re->offset); + parse_v6_hdr(&gen->v6hdr, rawhdr); + re->offset += RTAS_V6_HDR_SIZE; + + if (gen->v6hdr.length > RTAS_V6_HDR_SIZE) { + uint32_t data_sz = gen->v6hdr.length - RTAS_V6_HDR_SIZE; gen->data = malloc(data_sz); if (gen->data == NULL) { errno = ENOMEM; @@ -629,7 +674,7 @@ if (gen->data != NULL) { len += rtas_print("Raw Section Data:\n"); len += print_raw_data(gen->data, - gen->v6hdr.length - sizeof(struct rtas_v6_hdr)); + gen->v6hdr.length - sizeof(struct rtas_v6_hdr_raw)); } len += rtas_print("\n"); -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
