aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2017-05-26 14:37:05 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-06-08 17:24:10 +1000
commita0811f87b84e71c7314d0fd92c34e9715b400817 (patch)
tree4787af3a3f2dcf3f3267b3ed056a8d7ed5f992fb /hw
parent9e888546f1ec322ac74b1e58b670d294ae3ea4fc (diff)
downloadskiboot-a0811f87b84e71c7314d0fd92c34e9715b400817.zip
skiboot-a0811f87b84e71c7314d0fd92c34e9715b400817.tar.gz
skiboot-a0811f87b84e71c7314d0fd92c34e9715b400817.tar.bz2
SBE: Add passthrough command support
SBE sends passthrough command. We have to capture this interrupt and send event to HBRT via opal-prd (user space daemon). This patch adds minimal SBE code to capture SBE interrupt and send event to opal-prd. Next patch will add opal-prd (user space) support. CC: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-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
4 files changed, 77 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);
+ }
+}