blob: a40bfd1f5e4245d9c8c3a7b2023189bf3fe8a90f [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
Andrew Jeffery55f4d6f2018-08-06 12:26:44 +09304#ifndef DBUS_H
5#define DBUS_H
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +11006
Andrew Jeffery68023072018-08-06 10:08:11 +09307#include <stdint.h>
8#include <stddef.h>
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +11009
Andrew Jeffery68023072018-08-06 10:08:11 +093010/*
11 * "mbox" will become an inappropriate name for the protocol/daemon, so claim a
12 * different name on the public interface.
13 *
14 * "hiomapd" expands to "Host I/O Map Daemon"
15 *
16 * TODO: The Great Rename
17 */
18#define MBOX_DBUS_NAME "xyz.openbmc_project.Hiomapd"
19#define MBOX_DBUS_OBJECT "/xyz/openbmc_project/Hiomapd"
20#define MBOX_DBUS_CONTROL_IFACE "xyz.openbmc_project.Hiomapd.Control"
21#define MBOX_DBUS_PROTOCOL_IFACE "xyz.openbmc_project.Hiomapd.Protocol"
22
23/* Legacy interface */
24#define MBOX_DBUS_LEGACY_NAME "org.openbmc.mboxd"
25#define MBOX_DBUS_LEGACY_OBJECT "/org/openbmc/mboxd"
26
27/* Command IDs (Legacy interface) */
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110028#define DBUS_C_PING 0x00
29#define DBUS_C_DAEMON_STATE 0x01
30#define DBUS_C_RESET 0x02
31#define DBUS_C_SUSPEND 0x03
32#define DBUS_C_RESUME 0x04
33#define DBUS_C_MODIFIED 0x05
34#define DBUS_C_KILL 0x06
35#define DBUS_C_LPC_STATE 0x07
36#define NUM_DBUS_CMDS (DBUS_C_LPC_STATE + 1)
37
38/* Command Args */
39/* Resume */
40#define RESUME_NUM_ARGS 1
41#define RESUME_NOT_MODIFIED 0x00
42#define RESUME_FLASH_MODIFIED 0x01
43
Andrew Jeffery68023072018-08-06 10:08:11 +093044/* Return Values (Legacy interface) */
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110045#define DBUS_SUCCESS 0x00 /* Command Succeded */
46#define E_DBUS_INTERNAL 0x01 /* Internal DBUS Error */
47#define E_DBUS_INVAL 0x02 /* Invalid Command */
48#define E_DBUS_REJECTED 0x03 /* Daemon Rejected Request */
49#define E_DBUS_HARDWARE 0x04 /* BMC Hardware Error */
Suraj Jitindar Singhddf0edb2017-03-28 10:50:40 +110050#define E_DBUS_NO_MEM 0x05 /* Failed Memory Allocation */
Suraj Jitindar Singhe39c9162017-03-28 10:47:43 +110051
52/* Response Args */
53/* Status */
54#define DAEMON_STATE_NUM_ARGS 1
55#define DAEMON_STATE_ACTIVE 0x00 /* Daemon Active */
56#define DAEMON_STATE_SUSPENDED 0x01 /* Daemon Suspended */
57/* LPC State */
58#define LPC_STATE_NUM_ARGS 1
59#define LPC_STATE_INVALID 0x00 /* Invalid State */
60#define LPC_STATE_FLASH 0x01 /* LPC Maps Flash Directly */
61#define LPC_STATE_MEM 0x02 /* LPC Maps Memory */
62
63struct mbox_dbus_msg {
64 uint8_t cmd;
65 size_t num_args;
66 uint8_t *args;
67};
68
69#endif /* MBOX_DBUS_H */