aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Grimm <grimm@linux.vnet.ibm.com>2014-09-29 23:51:35 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-09-30 14:45:48 +1000
commitf68bd30f5bc58a21533d834b315f880bfb54e0db (patch)
tree53f349a7e2bff9475cbaad2d8091f8eb37eb5d0b
parent8b925076b139a973b25ef88d3d701a810b38f1c0 (diff)
downloadskiboot-f68bd30f5bc58a21533d834b315f880bfb54e0db.zip
skiboot-f68bd30f5bc58a21533d834b315f880bfb54e0db.tar.gz
skiboot-f68bd30f5bc58a21533d834b315f880bfb54e0db.tar.bz2
phb3/capi: Add two new modes to opal_pci_set_phb_capi_mode
For user initiated capp recovery, provide a mode to turn snoops off. The perst alone does not turn snoops off and we need to do this as part of the capp recovery procedure before reinitializing the phb. A second mode turns snoops back on after recovery. The driver needs to do this after it reinitializes the PSL otherwise tlbies could come in before the psl is initialized. Also write 0 to capp error status and control as part of the recovery procedure. Put modes as flag defines in opal.h so the driver can pick them up. Add a dt property "ibm,capi-modes" which tells the driver which modes sapphire supports. For backwards compatibility with older opals. Also, the driver can disable reset in sysfs if not supported. Move the mode checking into phb3.c so it's all in one place. Signed-off-by: Ryan Grimm <grimm@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--core/pci-opal.c15
-rw-r--r--hw/phb3.c36
-rw-r--r--include/opal.h5
3 files changed, 44 insertions, 12 deletions
diff --git a/core/pci-opal.c b/core/pci-opal.c
index 2048d7f..47c9377 100644
--- a/core/pci-opal.c
+++ b/core/pci-opal.c
@@ -703,15 +703,10 @@ static int64_t opal_pci_set_phb_capi_mode(uint64_t phb_id, uint64_t mode, uint64
return OPAL_PARAMETER;
if (!phb->ops->set_capi_mode)
return OPAL_UNSUPPORTED;
- if (mode == 1) {
- phb->ops->lock(phb);
- rc = phb->ops->set_capi_mode(phb, mode, pe_number);
- phb->ops->unlock(phb);
- return rc;
- }
- if (mode == 0) {
- /* FIXME add support for PCI mode*/
- }
- return OPAL_UNSUPPORTED;
+
+ phb->ops->lock(phb);
+ rc = phb->ops->set_capi_mode(phb, mode, pe_number);
+ phb->ops->unlock(phb);
+ return rc;
}
opal_call(OPAL_PCI_SET_PHB_CAPI_MODE, opal_pci_set_phb_capi_mode, 3);
diff --git a/hw/phb3.c b/hw/phb3.c
index fec2071..3c03c20 100644
--- a/hw/phb3.c
+++ b/hw/phb3.c
@@ -2916,8 +2916,37 @@ static int64_t phb3_set_capi_mode(struct phb *phb, uint64_t mode,
uint64_t reg;
int i;
- if (mode != 1)
- return OPAL_PARAMETER;
+ xscom_read(p->chip_id, CAPP_ERR_STATUS_CTRL, &reg);
+ if ((reg & PPC_BIT(5))) {
+ PHBERR(p, "CAPP recovery failed (%016llx)\n", reg);
+ return OPAL_HARDWARE;
+ } else if ((reg & PPC_BIT(0)) && (!(reg & PPC_BIT(1)))) {
+ PHBDBG(p, "CAPP recovery in progress\n");
+ return OPAL_BUSY;
+ }
+
+ if (mode == OPAL_PHB_MODE_PCIE)
+ return OPAL_UNSUPPORTED;
+
+ if (mode == OPAL_PHB_MODE_SNOOP_OFF) {
+ xscom_write(p->chip_id, SNOOP_CAPI_CONFIG, 0x0000000000000000);
+ return OPAL_SUCCESS;
+ }
+
+ if (mode == OPAL_PHB_MODE_SNOOP_ON) {
+ xscom_write(p->chip_id, CAPP_ERR_STATUS_CTRL, 0x0000000000000000);
+ xscom_write(p->chip_id, SNOOP_CAPI_CONFIG, 0xA1F0000000000000);
+ return OPAL_SUCCESS;
+ }
+
+ if (mode != OPAL_PHB_MODE_CAPI)
+ return OPAL_UNSUPPORTED;
+
+ xscom_read(p->chip_id, 0x9013c03, &reg);
+ if (reg & PPC_BIT(0)) {
+ PHBDBG(p, "Already in CAPP mode\n");
+ return OPAL_SUCCESS;
+ }
if (!p->capp_ucode_loaded) {
PHBERR(p, "capp ucode not loaded into capp unit\n");
@@ -4087,6 +4116,9 @@ static void phb3_probe_pbcq(struct dt_node *pbcq)
}
max_link_speed = dt_prop_get_u32_def(pbcq, "ibm,max-link-speed", 3);
dt_add_property_cells(np, "ibm,max-link-speed", max_link_speed);
+ dt_add_property_cells(np, "ibm,capi-modes", OPAL_PHB_MODE_CAPI |
+ OPAL_PHB_MODE_SNOOP_ON |
+ OPAL_PHB_MODE_SNOOP_OFF);
add_chip_dev_associativity(np);
}
diff --git a/include/opal.h b/include/opal.h
index 99a3335..7046fb2 100644
--- a/include/opal.h
+++ b/include/opal.h
@@ -871,6 +871,11 @@ struct opal_sg_list {
#define OPAL_DUMP_REGION_OS_START 0x80
#define OPAL_DUMP_REGION_OS_END 0xFF
+/* CAPI flags */
+#define OPAL_PHB_MODE_PCIE 0x00000000
+#define OPAL_PHB_MODE_CAPI 0x00000001
+#define OPAL_PHB_MODE_SNOOP_OFF 0x00000002
+#define OPAL_PHB_MODE_SNOOP_ON 0x00000004
/****** Internal **********/
#include <skiboot.h>