summaryrefslogtreecommitdiffstats
path: root/hw/lpc-mbox.c
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-05-24 16:37:18 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-05-26 15:55:23 +1000
commit3476c6ec24140f538d5555a36afe42c064b13e31 (patch)
treed0e926cd8c361b36edaa35914a2b5aa94f65a5dd /hw/lpc-mbox.c
parent0322cd881ab3fda2b8136d6beb3991fd9d2dc5e7 (diff)
downloadblackbird-skiboot-3476c6ec24140f538d5555a36afe42c064b13e31.tar.gz
blackbird-skiboot-3476c6ec24140f538d5555a36afe42c064b13e31.zip
libflash/mbox-flash: Update to V2 of the protocol
Updated version 2 of the protocol can be found at: https://github.com/openbmc/mboxbridge/blob/master/Documentation/mbox_protocol.md This commit changes mbox-flash such that it will preferentially talk version 2 to any capable daemon but still remain capable of talking to v1 daemons. Version two changes some of the command definitions for increased consistency and usability. Version two includes more attention bits - these are now dealt with at a simple level. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Acked-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/lpc-mbox.c')
-rw-r--r--hw/lpc-mbox.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/hw/lpc-mbox.c b/hw/lpc-mbox.c
index c296a8a9..7a57f1e7 100644
--- a/hw/lpc-mbox.c
+++ b/hw/lpc-mbox.c
@@ -51,9 +51,6 @@
#define MBOX_MAX_QUEUE_LEN 5
-#define BMC_RESET 1
-#define BMC_COMPLETE 2
-
struct mbox {
uint32_t base;
int queue_len;
@@ -62,6 +59,8 @@ struct mbox {
struct timer poller;
void (*callback)(struct bmc_mbox_msg *msg, void *priv);
void *drv_data;
+ void (*attn)(uint8_t bits, void *priv);
+ void *attn_data;
struct lock lock; /* Protect in_flight */
struct bmc_mbox_msg *in_flight;
};
@@ -182,16 +181,15 @@ out_response:
* something to tell us.
*/
if (bmc_mbox_inb(MBOX_STATUS_1) & MBOX_STATUS_1_ATTN) {
- uint8_t action;
+ uint8_t action, all;
/* W1C on that reg */
bmc_mbox_outb(MBOX_STATUS_1_ATTN, MBOX_STATUS_1);
- action = bmc_mbox_inb(MBOX_FLAG_REG);
+ all = action = bmc_mbox_inb(MBOX_FLAG_REG);
prlog(PR_TRACE, "Got a status register interrupt with action 0x%02x\n",
action);
-
- if (action & BMC_RESET) {
+ if (action & MBOX_ATTN_BMC_REBOOT) {
/*
* It's unlikely that something needs to be done at the
* driver level. Let libflash deal with it.
@@ -199,12 +197,23 @@ out_response:
* event.
*/
prlog(PR_WARNING, "BMC reset detected\n");
- action &= ~BMC_RESET;
+ action &= ~MBOX_ATTN_BMC_REBOOT;
}
+ if (action & MBOX_ATTN_BMC_WINDOW_RESET)
+ action &= ~MBOX_ATTN_BMC_WINDOW_RESET;
+
+ if (action & MBOX_ATTN_BMC_FLASH_LOST)
+ action &= ~MBOX_ATTN_BMC_FLASH_LOST;
+
+ if (action & MBOX_ATTN_BMC_DAEMON_READY)
+ action &= ~MBOX_ATTN_BMC_DAEMON_READY;
+
if (action)
prlog(PR_ERR, "Got a status bit set that don't know about: 0x%02x\n",
action);
+
+ mbox.attn(all, mbox.attn_data);
}
schedule_timer(&mbox.poller,
@@ -246,6 +255,19 @@ int bmc_mbox_register_callback(void (*callback)(struct bmc_mbox_msg *msg, void *
return 0;
}
+int bmc_mbox_register_attn(void (*callback)(uint8_t bits, void *priv),
+ void *drv_data)
+{
+ mbox.attn = callback;
+ mbox.attn_data = drv_data;
+ return 0;
+}
+
+uint8_t bmc_mbox_get_attn_reg(void)
+{
+ return bmc_mbox_inb(MBOX_FLAG_REG);
+}
+
void mbox_init(void)
{
const struct dt_property *prop;
OpenPOWER on IntegriCloud