blob: 124927cdb420c623f8014292beb30c73128e0607 [file] [log] [blame]
Andrew Jeffery4fe996c2018-02-27 12:16:48 +10301/* SPDX-License-Identifier: Apache-2.0 */
2/* Copyright (C) 2018 IBM Corp. */
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +11003
4#ifndef MBOXD_MSG_H
5#define MBOXD_MSG_H
6
Suraj Jitindar Singh5a3a0662017-04-27 11:55:26 +10007#include "common.h"
Andrew Jefferycc0bd3c2018-03-22 16:47:56 +10308#include "mbox.h"
Suraj Jitindar Singh5a3a0662017-04-27 11:55:26 +10009
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
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110015
16struct mbox_msg {
17 uint8_t command;
18 uint8_t seq;
19 uint8_t args[MBOX_ARGS_BYTES];
20 uint8_t response;
21};
22
23union mbox_regs {
Andrew Jeffery738c1cd2018-03-22 16:45:05 +103024 uint8_t raw[MBOX_REG_BYTES];
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110025 struct mbox_msg msg;
26};
27
28int set_bmc_events(struct mbox_context *context, uint8_t bmc_event,
29 bool write_back);
30int clr_bmc_events(struct mbox_context *context, uint8_t bmc_event,
31 bool write_back);
32int dispatch_mbox(struct mbox_context *context);
33int init_mbox_dev(struct mbox_context *context);
34void free_mbox_dev(struct mbox_context *context);
35
36#endif /* MBOXD_MSG_H */