ReactOS 0.4.15-dev-8096-ga0eec98
virtio_pci_common.h
Go to the documentation of this file.
1#ifndef _DRIVERS_VIRTIO_VIRTIO_PCI_COMMON_H
2#define _DRIVERS_VIRTIO_VIRTIO_PCI_COMMON_H
3/*
4 * Virtio PCI driver - APIs for common functionality for all device versions
5 *
6 * Copyright IBM Corp. 2007
7 * Copyright Red Hat, Inc. 2014
8 *
9 * Authors:
10 * Anthony Liguori <aliguori@us.ibm.com>
11 * Rusty Russell <rusty@rustcorp.com.au>
12 * Michael S. Tsirkin <mst@redhat.com>
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met :
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and / or other materials provided with the distribution.
22 * 3. Neither the names of the copyright holders nor the names of their contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#define ioread8(vdev, addr) \
39 vdev->system->vdev_read_byte((ULONG_PTR)(addr))
40#define ioread16(vdev, addr) \
41 vdev->system->vdev_read_word((ULONG_PTR)(addr))
42#define ioread32(vdev, addr) \
43 vdev->system->vdev_read_dword((ULONG_PTR)(addr))
44#define iowrite8(vdev, val, addr) \
45 vdev->system->vdev_write_byte((ULONG_PTR)(addr), val)
46#define iowrite16(vdev, val, addr) \
47 vdev->system->vdev_write_word((ULONG_PTR)(addr), val)
48#define iowrite32(vdev, val, addr) \
49 vdev->system->vdev_write_dword((ULONG_PTR)(addr), val)
50#define iowrite64_twopart(vdev, val, lo_addr, hi_addr) \
51 vdev->system->vdev_write_dword((ULONG_PTR)(lo_addr), (u32)(val)); \
52 vdev->system->vdev_write_dword((ULONG_PTR)(hi_addr), (val) >> 32)
53
54#define mem_alloc_contiguous_pages(vdev, size) \
55 vdev->system->mem_alloc_contiguous_pages(vdev->DeviceContext, size)
56#define mem_free_contiguous_pages(vdev, virt) \
57 vdev->system->mem_free_contiguous_pages(vdev->DeviceContext, virt)
58#define mem_get_physical_address(vdev, virt) \
59 vdev->system->mem_get_physical_address(vdev->DeviceContext, virt)
60#define mem_alloc_nonpaged_block(vdev, size) \
61 vdev->system->mem_alloc_nonpaged_block(vdev->DeviceContext, size)
62#define mem_free_nonpaged_block(vdev, addr) \
63 vdev->system->mem_free_nonpaged_block(vdev->DeviceContext, addr)
64
65#define pci_read_config_byte(vdev, where, bVal) \
66 vdev->system->pci_read_config_byte(vdev->DeviceContext, where, bVal)
67#define pci_read_config_word(vdev, where, wVal) \
68 vdev->system->pci_read_config_word(vdev->DeviceContext, where, wVal)
69#define pci_read_config_dword(vdev, where, dwVal) \
70 vdev->system->pci_read_config_dword(vdev->DeviceContext, where, dwVal)
71
72#define pci_get_resource_len(vdev, bar) \
73 vdev->system->pci_get_resource_len(vdev->DeviceContext, bar)
74#define pci_map_address_range(vdev, bar, offset, maxlen) \
75 vdev->system->pci_map_address_range(vdev->DeviceContext, bar, offset, maxlen)
76
77#define vdev_get_msix_vector(vdev, queue) \
78 vdev->system->vdev_get_msix_vector(vdev->DeviceContext, queue)
79#define vdev_sleep(vdev, msecs) \
80 vdev->system->vdev_sleep(vdev->DeviceContext, msecs)
81
82/* the notify function used when creating a virt queue */
83void vp_notify(struct virtqueue *vq);
84
87
88#endif
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS vio_modern_initialize(VirtIODevice *vdev)
void vp_notify(struct virtqueue *vq)
NTSTATUS vio_legacy_initialize(VirtIODevice *vdev)