xref: /openbmc/phosphor-mboxd/mboxd_msg.h (revision 30bcf84c932a579532e5f8417af549494e11b6e9)
1 /* SPDX-License-Identifier: Apache-2.0 */
2 /* Copyright (C) 2018 IBM Corp. */
3 
4 #ifndef MBOXD_MSG_H
5 #define MBOXD_MSG_H
6 
7 #include "common.h"
8 #include "mbox.h"
9 
10 /* Estimate as to how long (milliseconds) it takes to access a MB from flash */
11 #define FLASH_ACCESS_MS_PER_MB		8000
12 
13 #define NO_BMC_EVENT			false
14 #define SET_BMC_EVENT			true
15 
16 struct mbox_msg {
17 	uint8_t command;
18 	uint8_t seq;
19 	uint8_t args[MBOX_ARGS_BYTES];
20 	uint8_t response;
21 };
22 
23 union mbox_regs {
24 	uint8_t raw[MBOX_REG_BYTES];
25 	struct mbox_msg msg;
26 };
27 
28 int set_bmc_events(struct mbox_context *context, uint8_t bmc_event,
29 		   bool write_back);
30 int clr_bmc_events(struct mbox_context *context, uint8_t bmc_event,
31 		   bool write_back);
32 int dispatch_mbox(struct mbox_context *context);
33 int init_mbox_dev(struct mbox_context *context);
34 void free_mbox_dev(struct mbox_context *context);
35 
36 #endif /* MBOXD_MSG_H */
37