[Skiboot] [PATCH 2/2] occ: Inform OCC of BMC PNOR ownership requests
Jeremy Kerr
jk at ozlabs.org
Fri Feb 27 21:18:19 AEDT 2015
We need to pass the PNOR access status to the OCCs, as they may write to
the PNOR in the event of a checkstop.
Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
---
hw/ipmi/ipmi-sel.c | 3 +++
hw/occ.c | 28 ++++++++++++++++++++++++++++
include/skiboot.h | 7 +++++++
3 files changed, 38 insertions(+)
diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c
index c86c2c9..8851dc3 100644
--- a/hw/ipmi/ipmi-sel.c
+++ b/hw/ipmi/ipmi-sel.c
@@ -195,6 +195,8 @@ static void sel_pnor(uint8_t access)
case REQUEST_PNOR:
prlog(PR_NOTICE, "IPMI: PNOR access requested\n");
granted = flash_reserve();
+ if (granted)
+ occ_pnor_set_owner(PNOR_OWNER_EXTERNAL);
/* Ack the request */
msg = ipmi_mkmsg_simple(IPMI_PNOR_ACCESS_STATUS, &granted, 1);
@@ -203,6 +205,7 @@ static void sel_pnor(uint8_t access)
case RELEASE_PNOR:
prlog(PR_NOTICE, "IPMI: PNOR access released\n");
flash_release();
+ occ_pnor_set_owner(PNOR_OWNER_HOST);
break;
default:
prlog(PR_ERR, "IPMI: invalid PNOR access requested: %02x\n",
diff --git a/hw/occ.c b/hw/occ.c
index 8eb6469..657f2ad 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -537,6 +537,34 @@ static void occ_do_reset(u8 scope, u32 dbob_id, u32 seq_id)
}
}
+#define PV_OCC_GP0 0x01000000
+#define PV_OCC_GP0_AND 0x01000004
+#define PV_OCC_GP0_OR 0x01000005
+#define PV_OCC_GP0_PNOR_OWNER PPC_BIT(18) /* 1 = OCC / Host, 0 = BMC */
+
+static void occ_pnor_set_one_owner(uint32_t chip_id, enum pnor_owner owner)
+{
+ uint64_t reg, mask;
+
+ if (owner == PNOR_OWNER_HOST) {
+ reg = PV_OCC_GP0_OR;
+ mask = PV_OCC_GP0_PNOR_OWNER;
+ } else {
+ reg = PV_OCC_GP0_AND;
+ mask = ~PV_OCC_GP0_PNOR_OWNER;
+ }
+
+ xscom_write(chip_id, reg, mask);
+}
+
+void occ_pnor_set_owner(enum pnor_owner owner)
+{
+ struct proc_chip *chip;
+
+ for_each_chip(chip)
+ occ_pnor_set_one_owner(chip->id, owner);
+}
+
static bool fsp_occ_msg(u32 cmd_sub_mod, struct fsp_msg *msg)
{
u32 dbob_id, seq_id;
diff --git a/include/skiboot.h b/include/skiboot.h
index beaa7db..0fe50e9 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -221,6 +221,13 @@ extern void occ_send_dummy_interrupt(void);
/* OCC load support */
extern void occ_poke_load_queue(void);
+/* OCC/Host PNOR ownership */
+enum pnor_owner {
+ PNOR_OWNER_HOST,
+ PNOR_OWNER_EXTERNAL,
+};
+extern void occ_pnor_set_owner(enum pnor_owner owner);
+
/* PRD */
extern void prd_psi_interrupt(uint32_t proc);
extern void prd_tmgt_interrupt(uint32_t proc);
More information about the Skiboot
mailing list