aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.main4
-rw-r--r--external/opal-prd/opal-prd.c52
-rw-r--r--extract-gcov.c31
-rw-r--r--hw/fsp/fsp.c22
-rw-r--r--include/fsp.h1
-rw-r--r--platforms/ibm-fsp/common.c1
6 files changed, 100 insertions, 11 deletions
diff --git a/Makefile.main b/Makefile.main
index 094a8fc..ea5fc8e 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -210,8 +210,8 @@ include $(shell find $(SRC)/* -name Makefile.check)
extract-gcov: extract-gcov.c
$(call Q, HOSTCC ,$(HOSTCC) $(HOSTCFLAGS) \
-DTARGET__GNUC__=`echo '__GNUC__'|$(CC) -E -|grep -v '^#'` \
- -DTARGET__GNUC_MINOR__=`echo '__GNUC__'|$(CC) -E -|grep -v '^#'` \
- -O0 -g -I$(SRC) -o $@ $<,$<)
+ -DTARGET__GNUC_MINOR__=`echo '__GNUC_MINOR__'|$(CC) -E -|grep -v '^#'` \
+ -Wpadded -O0 -g -I$(SRC) -o $@ $<,$<)
coverage-report: skiboot.info
genhtml --branch-coverage -q -o $@ $<
diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c
index 0004b3d..115443c 100644
--- a/external/opal-prd/opal-prd.c
+++ b/external/opal-prd/opal-prd.c
@@ -1032,6 +1032,52 @@ out_free:
return rc;
}
+bool find_string(const char *buffer, size_t len, const char *s)
+{
+ const char *c, *end;
+
+ if (!buffer)
+ return false;
+ c = buffer;
+ end = c + len;
+
+ while (c < end) {
+ if (!strcasecmp(s, c))
+ return true;
+ c += strlen(c) + 1;
+ }
+ return false;
+}
+
+static int is_prd_supported(void)
+{
+ char *path;
+ int rc;
+ int len;
+ char *buf;
+
+ rc = asprintf(&path, "%s/ibm,opal/diagnostics/compatible",
+ devicetree_base);
+ if (rc < 0) {
+ pr_log(LOG_ERR, "FW: error creating 'compatible' node path: %m");
+ return -1;
+ }
+
+ rc = open_and_read(path, (void *) &buf, &len);
+ if (rc)
+ goto out_free;
+
+ if (buf[len - 1] != '\0')
+ pr_log(LOG_INFO, "FW: node %s is not nul-terminated", path);
+
+ rc = find_string(buf, len, "ibm,opal-prd") ? 0 : -1;
+
+ free(buf);
+out_free:
+ free(path);
+ return rc;
+}
+
static int prd_init(struct opal_prd_ctx *ctx)
{
int rc;
@@ -1963,6 +2009,12 @@ int main(int argc, char *argv[])
action = ACTION_RUN_DAEMON;
}
+ if (is_prd_supported() < 0) {
+ pr_log(LOG_ERR, "CTRL: PowerNV OPAL runtime diagnostic "
+ "is not supported on this system");
+ return -1;
+ }
+
switch (action) {
case ACTION_RUN_DAEMON:
rc = run_prd_daemon(ctx);
diff --git a/extract-gcov.c b/extract-gcov.c
index c9b82f3..a9298fa 100644
--- a/extract-gcov.c
+++ b/extract-gcov.c
@@ -30,39 +30,48 @@
#include <errno.h>
#include <string.h>
-typedef unsigned int gcov_unsigned_int;
+typedef u32 gcov_unsigned_int;
/* You will need to pass -DTARGET__GNUC__=blah when building */
+#if TARGET__GNUC__ >= 5 && TARGET__GNUC_MINOR__ >= 1
+#define GCOV_COUNTERS 10
+#else
#if TARGET__GNUC__ >= 4 && TARGET__GNUC_MINOR__ >= 9
#define GCOV_COUNTERS 9
#else
#define GCOV_COUNTERS 8
-#endif
+#endif /* GCC 4.9 */
+#endif /* GCC 5.1 */
typedef u64 gcov_type;
struct gcov_info
{
gcov_unsigned_int version;
+ u32 _padding;
struct gcov_info *next;
gcov_unsigned_int stamp;
+ u32 _padding2;
const char *filename;
- void (*merge[GCOV_COUNTERS])(gcov_type *, unsigned int);
+ u64 merge[GCOV_COUNTERS];
unsigned int n_functions;
+ u32 _padding3;
struct gcov_fn_info **functions;
};
struct gcov_ctr_info {
gcov_unsigned_int num;
+ u32 _padding;
gcov_type *values;
-};
+}__attribute__((packed));
struct gcov_fn_info {
const struct gcov_info *key;
unsigned int ident;
unsigned int lineno_checksum;
unsigned int cfg_checksum;
+ u32 _padding;
// struct gcov_ctr_info ctrs[0];
-};
+} __attribute__((packed));
/* We have a list of all gcov info set up at startup */
@@ -137,7 +146,8 @@ static void write_gcda(char *addr, struct gcov_info* gi)
write_u32(fd, be32toh(gi->version));
write_u32(fd, be32toh(gi->stamp));
- //printf("nfunctions: %d \n", be32toh(gi->n_functions));
+ printf("version: %x\tstamp: %d\n", be32toh(gi->version), be32toh(gi->stamp));
+ printf("nfunctions: %d \n", be32toh(gi->n_functions));
for(fn = 0; fn < be32toh(gi->n_functions); fn++) {
functions = (struct gcov_fn_info**)
@@ -146,6 +156,8 @@ static void write_gcda(char *addr, struct gcov_info* gi)
fn_info = (struct gcov_fn_info*)
SKIBOOT_ADDR(addr, functions[fn]);
+ printf("function: %p\n", (void*)be64toh((u64)functions[fn]));
+
write_u32(fd, GCOV_TAG_FUNCTION);
write_u32(fd, GCOV_TAG_FUNCTION_LENGTH);
write_u32(fd, be32toh(fn_info->ident));
@@ -161,9 +173,8 @@ static void write_gcda(char *addr, struct gcov_info* gi)
write_u32(fd, (GCOV_TAG_FOR_COUNTER(ctr)));
write_u32(fd, be32toh(ctr_info->num)*2);
- /* printf(" ctr %d gcov_ctr_info->num %u\n",
- * ctr, be32toh(ctr_info->num));
- */
+ printf(" ctr %d gcov_ctr_info->num %u\n",
+ ctr, be32toh(ctr_info->num));
for(cv = 0; cv < be32toh(ctr_info->num); cv++) {
gcov_type *ctrv = (gcov_type *)
@@ -192,6 +203,8 @@ int main(int argc, char *argv[])
sizeof(struct gcov_ctr_info),
sizeof(struct gcov_fn_info),
sizeof(struct gcov_info));
+ printf("TARGET GNUC: %d.%d\n", TARGET__GNUC__, TARGET__GNUC_MINOR__);
+ printf("GCOV_COUNTERS: %d\n", GCOV_COUNTERS);
if (argc < 3) {
fprintf(stderr, "Usage:\n"
diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c
index b53c3f0..220b97e 100644
--- a/hw/fsp/fsp.c
+++ b/hw/fsp/fsp.c
@@ -569,6 +569,28 @@ static void fsp_start_rr(struct fsp *fsp)
*/
}
+/*
+ * Called on normal/quick shutdown to give up the PSI link
+ */
+void fsp_reset_links(void)
+{
+ struct fsp *fsp = fsp_get_active();
+ struct fsp_iopath *iop;
+
+ if (!fsp)
+ return;
+
+ /* Already in one of the error states? */
+ if (fsp_in_hir(fsp) || fsp_in_reset(fsp))
+ return;
+
+ iop = &fsp->iopath[fsp->active_iopath];
+ prlog(PR_NOTICE, "FSP #%d: Host initiated shutdown."
+ " Giving up the PSI link\n", fsp->index);
+ psi_disable_link(iop->psi);
+ return;
+}
+
static void fsp_trace_event(struct fsp *fsp, u32 evt,
u32 data0, u32 data1, u32 data2, u32 data3)
{
diff --git a/include/fsp.h b/include/fsp.h
index a61bd58..7ea162d 100644
--- a/include/fsp.h
+++ b/include/fsp.h
@@ -802,6 +802,7 @@ extern void fsp_ipmi_init(void);
/* Reset/Reload */
extern void fsp_reinit_fsp(void);
extern void fsp_trigger_reset(void);
+extern void fsp_reset_links(void);
/* FSP memory errors */
extern void fsp_memory_err_init(void);
diff --git a/platforms/ibm-fsp/common.c b/platforms/ibm-fsp/common.c
index 59a890b..dc3a002 100644
--- a/platforms/ibm-fsp/common.c
+++ b/platforms/ibm-fsp/common.c
@@ -222,6 +222,7 @@ int64_t ibm_fsp_cec_power_down(uint64_t request)
if (fsp_sync_msg(fsp_mkmsg(FSP_CMD_POWERDOWN_NORM, 1, request), true))
return OPAL_INTERNAL_ERROR;
+ fsp_reset_links();
return OPAL_SUCCESS;
}