From 445f419304d5497beb22d6743439f9c753e771f3 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Mon, 15 Oct 2018 22:32:13 +0300 Subject: [PATCH] dm: mei: add virtio configuration The virtio has two virtio queues, TX and RX. TX have two segment buffers one for header and one for data. The virtio_mei declares host buffer of size 128 slots, each slot is a 4 bytes value. For synchronization hw_ready and host_reset configuration flags are used that emulates mei reset flow. And last fw status registers must be also readable via virtio mei device. Tracked-On: #1536 Signed-off-by: Tomas Winkler Acked-by: Wang, Yu1 --- devicemodel/hw/pci/virtio/virtio_mei.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/devicemodel/hw/pci/virtio/virtio_mei.c b/devicemodel/hw/pci/virtio/virtio_mei.c index ade0cd9c6..7513517a5 100644 --- a/devicemodel/hw/pci/virtio/virtio_mei.c +++ b/devicemodel/hw/pci/virtio/virtio_mei.c @@ -153,6 +153,32 @@ refcnt_put(const struct refcnt *ref) ref->destroy(ref); } +#define MEI_FW_STATUS_MAX 6 + +#define VMEI_VQ_NUM 2 +#define VMEI_RXQ 0 +#define VMEI_TXQ 1 +#define VMEI_RX_SEGS 1 +#define VMEI_TX_SEGS 2 + +/* + * MEI HW max support FIFO depth is 128 + * We might support larger depth, which need change MEI driver + */ + +#define VMEI_BUF_DEPTH 128 +#define VMEI_SLOT_SZ 4 +#define VMEI_BUF_SZ (VMEI_BUF_DEPTH * VMEI_SLOT_SZ) +#define VMEI_RING_SZ 64 + +struct mei_virtio_cfg { + uint32_t buf_depth; + uint8_t hw_ready; + uint8_t host_reset; + uint8_t reserved[2]; + uint32_t fw_status[MEI_FW_STATUS_MAX]; +} __attribute__((packed)); + static int mei_sysfs_read_property_file(const char *fname, char *buf, size_t sz) { int fd;