Introduce virtio-gpio protocol headers from Linux kernel. (work in progress, not mainlined yet)
Signed-off-by: Enrico Weigelt, metux IT consult <i...@metux.net> --- include/standard-headers/linux/virtio_gpio.h | 39 ++++++++++++++++++++++++++++ include/standard-headers/linux/virtio_ids.h | 1 + 2 files changed, 40 insertions(+) create mode 100644 include/standard-headers/linux/virtio_gpio.h diff --git a/include/standard-headers/linux/virtio_gpio.h b/include/standard-headers/linux/virtio_gpio.h new file mode 100644 index 0000000000..d1db0ef1fe --- /dev/null +++ b/include/standard-headers/linux/virtio_gpio.h @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#ifndef _LINUX_VIRTIO_GPIO_H +#define _LINUX_VIRTIO_GPIO_H + +#include <linux/types.h> + +enum virtio_gpio_event_type { + // requests from quest to host + VIRTIO_GPIO_EV_GUEST_REQUEST = 0x01, // ->request() + VIRTIO_GPIO_EV_GUEST_DIRECTION_INPUT = 0x02, // ->direction_input() + VIRTIO_GPIO_EV_GUEST_DIRECTION_OUTPUT = 0x03, // ->direction_output() + VIRTIO_GPIO_EV_GUEST_GET_DIRECTION = 0x04, // ->get_direction() + VIRTIO_GPIO_EV_GUEST_GET_VALUE = 0x05, // ->get_value() + VIRTIO_GPIO_EV_GUEST_SET_VALUE = 0x06, // ->set_value() + + // messages from host to guest + VIRTIO_GPIO_EV_HOST_LEVEL = 0x11, // gpio state changed + + /* mask bit set on host->guest reply */ + VIRTIO_GPIO_EV_REPLY = 0xF000, +}; + +struct virtio_gpio_config { + __u8 version; + __u8 reserved0; + __u16 num_gpios; + __u32 names_size; + __u8 reserved1[24]; + __u8 name[32]; +}; + +struct virtio_gpio_event { + __le16 type; + __le16 pin; + __le32 value; +}; + +#endif /* _LINUX_VIRTIO_GPIO_H */ diff --git a/include/standard-headers/linux/virtio_ids.h b/include/standard-headers/linux/virtio_ids.h index b052355ac7..053fe59c73 100644 --- a/include/standard-headers/linux/virtio_ids.h +++ b/include/standard-headers/linux/virtio_ids.h @@ -48,5 +48,6 @@ #define VIRTIO_ID_FS 26 /* virtio filesystem */ #define VIRTIO_ID_PMEM 27 /* virtio pmem */ #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */ +#define VIRTIO_ID_GPIO 30 /* virtio GPIO */ #endif /* _LINUX_VIRTIO_IDS_H */ -- 2.11.0