mboxd: Refactor and rename mbox.h to mboxd.h
Refine the purpose of the header file to represent what's required for
the daemon itself, not its constituent pieces. Rather, split those
definitions out to their respective header files and include them as
necessary.
Finally the header file is renamed to better reflect its purpose.
Change-Id: I48c409f57d96c844589cd865b24f197477dfe87c
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/transport_mbox.h b/transport_mbox.h
index c9d494d..b55da5e 100644
--- a/transport_mbox.h
+++ b/transport_mbox.h
@@ -4,8 +4,52 @@
#ifndef MBOXD_MSG_H
#define MBOXD_MSG_H
-#include "common.h"
-#include "mbox.h"
+#include <stdint.h>
+
+struct mbox_context;
+
+/* Command Values */
+#define MBOX_C_RESET_STATE 0x01
+#define MBOX_C_GET_MBOX_INFO 0x02
+#define MBOX_C_GET_FLASH_INFO 0x03
+#define MBOX_C_READ_WINDOW 0x04
+#define MBOX_C_CLOSE_WINDOW 0x05
+#define MBOX_C_WRITE_WINDOW 0x06
+#define MBOX_C_WRITE_DIRTY 0x07
+#define MBOX_C_WRITE_FLUSH 0x08
+#define MBOX_C_ACK 0x09
+#define MBOX_C_WRITE_ERASE 0x0a
+#define NUM_MBOX_CMDS MBOX_C_WRITE_ERASE
+
+/* Response Values */
+#define MBOX_R_SUCCESS 0x01
+#define MBOX_R_PARAM_ERROR 0x02
+#define MBOX_R_WRITE_ERROR 0x03
+#define MBOX_R_SYSTEM_ERROR 0x04
+#define MBOX_R_TIMEOUT 0x05
+#define MBOX_R_BUSY 0x06
+#define MBOX_R_WINDOW_ERROR 0x07
+#define MBOX_R_SEQ_ERROR 0x08
+
+/* MBOX Registers */
+#define MBOX_HOST_PATH "/dev/aspeed-mbox"
+#define MBOX_HOST_TIMEOUT_SEC 1
+#define MBOX_ARGS_BYTES 11
+#define MBOX_REG_BYTES 16
+#define MBOX_HOST_EVENT 14
+#define MBOX_BMC_EVENT 15
+
+struct mbox_msg {
+ uint8_t command;
+ uint8_t seq;
+ uint8_t args[MBOX_ARGS_BYTES];
+ uint8_t response;
+};
+
+union mbox_regs {
+ uint8_t raw[MBOX_REG_BYTES];
+ struct mbox_msg msg;
+};
int transport_mbox_dispatch(struct mbox_context *context);
int transport_mbox_init(struct mbox_context *context);