aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/Makefile.inc2
-rw-r--r--hw/prd.c13
-rw-r--r--hw/psi.c3
-rw-r--r--hw/sbe-p9.c61
-rw-r--r--include/opal-api.h4
-rw-r--r--include/sbe-p9.h34
-rw-r--r--include/skiboot.h1
7 files changed, 116 insertions, 2 deletions
diff --git a/hw/Makefile.inc b/hw/Makefile.inc
index 97080aa..a9df78b 100644
--- a/hw/Makefile.inc
+++ b/hw/Makefile.inc
@@ -7,7 +7,7 @@ HW_OBJS += p7ioc.o p7ioc-inits.o p7ioc-phb.o
HW_OBJS += phb3.o sfc-ctrl.o fake-rtc.o bt.o p8-i2c.o prd.o
HW_OBJS += dts.o lpc-rtc.o npu.o npu-hw-procedures.o xive.o phb4.o
HW_OBJS += fake-nvram.o lpc-mbox.o npu2.o npu2-hw-procedures.o
-HW_OBJS += phys-map.o
+HW_OBJS += phys-map.o sbe-p9.o
HW=hw/built-in.o
# FIXME hack this for now
diff --git a/hw/prd.c b/hw/prd.c
index 96dc862..d076c19 100644
--- a/hw/prd.c
+++ b/hw/prd.c
@@ -28,6 +28,7 @@ enum events {
EVENT_ATTN = 1 << 0,
EVENT_OCC_ERROR = 1 << 1,
EVENT_OCC_RESET = 1 << 2,
+ EVENT_SBE_PASSTHROUGH = 1 << 3,
};
static uint8_t events[MAX_CHIPS];
@@ -109,6 +110,10 @@ static void prd_msg_consumed(void *data)
break;
case OPAL_PRD_MSG_TYPE_FIRMWARE_RESPONSE:
break;
+ case OPAL_PRD_MSG_TYPE_SBE_PASSTHROUGH:
+ proc = msg->sbe_passthrough.chip;
+ event = EVENT_SBE_PASSTHROUGH;
+ break;
default:
prlog(PR_ERR, "PRD: invalid msg consumed, type: 0x%x\n",
msg->hdr.type);
@@ -180,6 +185,9 @@ static void send_next_pending_event(void)
prd_msg->hdr.type = OPAL_PRD_MSG_TYPE_OCC_RESET;
prd_msg->occ_reset.chip = proc;
occ_msg_queue_occ_reset();
+ } else if (event & EVENT_SBE_PASSTHROUGH) {
+ prd_msg->hdr.type = OPAL_PRD_MSG_TYPE_SBE_PASSTHROUGH;
+ prd_msg->sbe_passthrough.chip = proc;
}
/*
@@ -266,6 +274,11 @@ void prd_occ_reset(uint32_t proc)
prd_event(proc, EVENT_OCC_RESET);
}
+void prd_sbe_passthrough(uint32_t proc)
+{
+ prd_event(proc, EVENT_SBE_PASSTHROUGH);
+}
+
/* incoming message handlers */
static int prd_msg_handle_attn_ack(struct opal_prd_msg *msg)
{
diff --git a/hw/psi.c b/hw/psi.c
index cc7db44..ccc3578 100644
--- a/hw/psi.c
+++ b/hw/psi.c
@@ -33,6 +33,7 @@
#include <platform.h>
#include <errorlog.h>
#include <xive.h>
+#include <sbe-p9.h>
static LIST_HEAD(psis);
static u64 psi_link_timer;
@@ -603,7 +604,7 @@ static void psihb_p9_interrupt(struct irq_source *is, uint32_t isn)
printf("PSI: DIO irq received\n");
break;
case P9_PSI_IRQ_PSU:
- printf("PSI: PSU irq received\n");
+ sbe_interrupt(psi->chip_id);
break;
}
}
diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c
new file mode 100644
index 0000000..c9c3feb
--- /dev/null
+++ b/hw/sbe-p9.c
@@ -0,0 +1,61 @@
+/* Copyright 2017 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define pr_fmt(fmt) "SBE: " fmt
+
+#include <chip.h>
+#include <errorlog.h>
+#include <lock.h>
+#include <opal.h>
+#include <sbe-p9.h>
+#include <skiboot.h>
+#include <timebase.h>
+#include <timer.h>
+#include <trace.h>
+#include <xscom.h>
+
+void sbe_interrupt(uint32_t chip_id)
+{
+ int rc;
+ u64 data;
+ struct proc_chip *chip;
+
+ chip = get_chip(chip_id);
+ if (chip == NULL)
+ return;
+
+ /* Read doorbell register */
+ rc = xscom_read(chip_id, PSU_HOST_DOORBELL_REG_RW, &data);
+ if (rc) {
+ prlog(PR_ERR, "Failed to read SBE to Host doorbell register "
+ "[chip id = %x]\n", chip_id);
+ goto clr_interrupt;
+ }
+
+ /* SBE passtrhough command, call prd handler */
+ if (data & SBE_HOST_PASSTHROUGH) {
+ prd_sbe_passthrough(chip_id);
+ }
+
+clr_interrupt:
+ /* Clears all the bits */
+ rc = xscom_write(chip_id, PSU_HOST_DOORBELL_REG_AND,
+ SBE_HOST_RESPONSE_CLEAR);
+ if (rc) {
+ prlog(PR_ERR, "Failed to clear SBE to Host doorbell "
+ "register [chip id = %x]\n", chip_id);
+ }
+}
diff --git a/include/opal-api.h b/include/opal-api.h
index 4d5b1eb..37af5f7 100644
--- a/include/opal-api.h
+++ b/include/opal-api.h
@@ -1032,6 +1032,7 @@ enum opal_prd_msg_type {
OPAL_PRD_MSG_TYPE_FIRMWARE_REQUEST, /* HBRT --> OPAL */
OPAL_PRD_MSG_TYPE_FIRMWARE_RESPONSE, /* HBRT <-- OPAL */
OPAL_PRD_MSG_TYPE_FIRMWARE_NOTIFY, /* HBRT <-- OPAL */
+ OPAL_PRD_MSG_TYPE_SBE_PASSTHROUGH, /* HBRT <-- OPAL */
};
struct opal_prd_msg_header {
@@ -1076,6 +1077,9 @@ struct opal_prd_msg {
__be64 len;
char data[];
} fw_notify;
+ struct {
+ __be64 chip;
+ } sbe_passthrough;
};
};
diff --git a/include/sbe-p9.h b/include/sbe-p9.h
new file mode 100644
index 0000000..cca2100
--- /dev/null
+++ b/include/sbe-p9.h
@@ -0,0 +1,34 @@
+/* Copyright 2017 IBM Corp.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __SBE_P9_H
+#define __SBE_P9_H
+
+#include <bitutils.h>
+#include <ccan/list/list.h>
+#include <ccan/short_types/short_types.h>
+
+#define PSU_HOST_DOORBELL_REG_RW 0x000D0063
+#define PSU_HOST_DOORBELL_REG_AND 0x000D0064
+#define PSU_HOST_DOORBELL_REG_OR 0x000D0065
+
+#define SBE_HOST_PASSTHROUGH PPC_BIT(4)
+#define SBE_HOST_RESPONSE_CLEAR 0x00
+
+/* SBE interrupt */
+extern void sbe_interrupt(uint32_t chip_id);
+
+#endif /* __SBE_P9_H */
diff --git a/include/skiboot.h b/include/skiboot.h
index 5c8b0c8..5790f7e 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -277,6 +277,7 @@ extern void occ_pnor_set_owner(enum pnor_owner owner);
extern void prd_psi_interrupt(uint32_t proc);
extern void prd_tmgt_interrupt(uint32_t proc);
extern void prd_occ_reset(uint32_t proc);
+extern void prd_sbe_passthrough(uint32_t proc);
extern void prd_init(void);
extern void prd_register_reserved_memory(void);