1 /*- 2 * Copyright (c) 2018 VMware, Inc. 3 * 4 * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) 5 */ 6 7 /* Driver for VMware Virtual Machine Communication Interface (VMCI) device. */ 8 9 #ifndef _VMCI_H_ 10 #define _VMCI_H_ 11 12 #include <sys/param.h> 13 #include <sys/lock.h> 14 #include <sys/mutex.h> 15 #include <sys/systm.h> 16 #include <sys/taskqueue.h> 17 18 #include <machine/bus.h> 19 20 #include "vmci_datagram.h" 21 #include "vmci_kernel_if.h" 22 23 /* VMCI device vendor and device ID */ 24 #define VMCI_VMWARE_VENDOR_ID 0x15AD 25 #define VMCI_VMWARE_DEVICE_ID 0x0740 26 27 #define VMCI_VERSION 1 28 29 struct vmci_dma_alloc { 30 bus_dma_tag_t dma_tag; 31 caddr_t dma_vaddr; 32 bus_addr_t dma_paddr; 33 bus_dmamap_t dma_map; 34 bus_size_t dma_size; 35 }; 36 37 struct vmci_interrupt { 38 struct resource *vmci_irq; 39 int vmci_rid; 40 void *vmci_handler; 41 }; 42 43 struct vmci_softc { 44 device_t vmci_dev; 45 46 struct mtx vmci_spinlock; 47 48 struct resource *vmci_res0; 49 bus_space_tag_t vmci_iot0; 50 bus_space_handle_t vmci_ioh0; 51 unsigned int vmci_ioaddr; 52 struct resource *vmci_res1; 53 bus_space_tag_t vmci_iot1; 54 bus_space_handle_t vmci_ioh1; 55 56 struct vmci_dma_alloc vmci_notifications_bitmap; 57 58 int vmci_num_intr; 59 vmci_intr_type vmci_intr_type; 60 struct vmci_interrupt vmci_intrs[VMCI_MAX_INTRS]; 61 struct task vmci_interrupt_dq_task; 62 struct task vmci_interrupt_bm_task; 63 64 struct task vmci_delayed_work_task; 65 struct mtx vmci_delayed_work_lock; 66 vmci_list(vmci_delayed_work_info) vmci_delayed_work_infos; 67 68 unsigned int capabilities; 69 }; 70 71 int vmci_dma_malloc(bus_size_t size, bus_size_t align, 72 struct vmci_dma_alloc *dma); 73 void vmci_dma_free(struct vmci_dma_alloc *); 74 int vmci_schedule_delayed_work_fn(vmci_work_fn *work_fn, void *data); 75 76 #endif /* !_VMCI_H_ */ 77