xref: /openbmc/phosphor-mboxd/mboxd_msg.h (revision 943aba060f143667d502792f11e95f42bc7da346)
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 int set_bmc_events(struct mbox_context *context, uint8_t bmc_event,
17 		   bool write_back);
18 int clr_bmc_events(struct mbox_context *context, uint8_t bmc_event,
19 		   bool write_back);
20 int dispatch_mbox(struct mbox_context *context);
21 int init_mbox_dev(struct mbox_context *context);
22 void free_mbox_dev(struct mbox_context *context);
23 
24 /* Command handlers */
25 int mbox_handle_reset(struct mbox_context *context,
26 			     union mbox_regs *req, struct mbox_msg *resp);
27 int mbox_handle_mbox_info(struct mbox_context *context,
28 				 union mbox_regs *req, struct mbox_msg *resp);
29 int mbox_handle_flash_info(struct mbox_context *context,
30 				  union mbox_regs *req, struct mbox_msg *resp);
31 int mbox_handle_read_window(struct mbox_context *context,
32 				   union mbox_regs *req, struct mbox_msg *resp);
33 int mbox_handle_close_window(struct mbox_context *context,
34 				    union mbox_regs *req, struct mbox_msg *resp);
35 int mbox_handle_write_window(struct mbox_context *context,
36 				    union mbox_regs *req, struct mbox_msg *resp);
37 int mbox_handle_dirty_window(struct mbox_context *context,
38 				    union mbox_regs *req, struct mbox_msg *resp);
39 int mbox_handle_flush_window(struct mbox_context *context,
40 				    union mbox_regs *req, struct mbox_msg *resp);
41 int mbox_handle_ack(struct mbox_context *context, union mbox_regs *req,
42 			   struct mbox_msg *resp);
43 int mbox_handle_erase_window(struct mbox_context *context,
44 				    union mbox_regs *req, struct mbox_msg *resp);
45 
46 #endif /* MBOXD_MSG_H */
47