ReactOS 0.4.16-dev-295-g4aee028
virtio_pci.h File Reference
#include "linux/types.h"
#include "linux/virtio_config.h"
Include dependency graph for virtio_pci.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  virtio_pci_cap
 
struct  virtio_pci_notify_cap
 
struct  virtio_pci_common_cfg
 
struct  virtio_queue_info
 
struct  virtio_system_ops
 
struct  virtio_device_ops
 
struct  virtio_device
 

Macros

#define VIRTIO_PCI_HOST_FEATURES   0
 
#define VIRTIO_PCI_GUEST_FEATURES   4
 
#define VIRTIO_PCI_QUEUE_PFN   8
 
#define VIRTIO_PCI_QUEUE_NUM   12
 
#define VIRTIO_PCI_QUEUE_SEL   14
 
#define VIRTIO_PCI_QUEUE_NOTIFY   16
 
#define VIRTIO_PCI_STATUS   18
 
#define VIRTIO_PCI_ISR   19
 
#define VIRTIO_MSI_CONFIG_VECTOR   20
 
#define VIRTIO_MSI_QUEUE_VECTOR   22
 
#define VIRTIO_PCI_CONFIG_OFF(msix_enabled)   ((msix_enabled) ? 24 : 20)
 
#define VIRTIO_PCI_CONFIG(msix_enabled)   VIRTIO_PCI_CONFIG_OFF(msix_enabled)
 
#define VIRTIO_PCI_QUEUE_ADDR_SHIFT   12
 
#define VIRTIO_PCI_VRING_ALIGN   4096
 
#define VIRTIO_PCI_ISR_CONFIG   0x2
 
#define VIRTIO_MSI_NO_VECTOR   0xffff
 
#define VIRTIO_PCI_CAP_COMMON_CFG   1
 
#define VIRTIO_PCI_CAP_NOTIFY_CFG   2
 
#define VIRTIO_PCI_CAP_ISR_CFG   3
 
#define VIRTIO_PCI_CAP_DEVICE_CFG   4
 
#define VIRTIO_PCI_CAP_PCI_CFG   5
 
#define MAX_QUEUES_PER_DEVICE_DEFAULT   8
 
#define virtio_is_feature_enabled(FeaturesList, Feature)   (!!((FeaturesList) & (1ULL << (Feature))))
 
#define virtio_feature_enable(FeaturesList, Feature)   ((FeaturesList) |= (1ULL << (Feature)))
 
#define virtio_feature_disable(FeaturesList, Feature)   ((FeaturesList) &= ~(1ULL << (Feature)))
 

Typedefs

typedef struct virtio_queue_info VirtIOQueueInfo
 
typedef struct virtio_system_ops VirtIOSystemOps
 
typedef struct virtio_device VirtIODevice
 

Functions

NTSTATUS virtio_device_initialize (VirtIODevice *vdev, const VirtIOSystemOps *pSystemOps, void *DeviceContext, bool msix_used)
 
void virtio_device_shutdown (VirtIODevice *vdev)
 
u8 virtio_get_status (VirtIODevice *vdev)
 
void virtio_set_status (VirtIODevice *vdev, u8 status)
 
void virtio_add_status (VirtIODevice *vdev, u8 status)
 
void virtio_device_reset (VirtIODevice *vdev)
 
void virtio_device_ready (VirtIODevice *vdev)
 
u64 virtio_get_features (VirtIODevice *dev)
 
NTSTATUS virtio_set_features (VirtIODevice *vdev, u64 features)
 
void virtio_get_config (VirtIODevice *vdev, unsigned offset, void *buf, unsigned len)
 
void virtio_set_config (VirtIODevice *vdev, unsigned offset, void *buf, unsigned len)
 
NTSTATUS virtio_query_queue_allocation (VirtIODevice *vdev, unsigned index, unsigned short *pNumEntries, unsigned long *pRingSize, unsigned long *pHeapSize)
 
NTSTATUS virtio_reserve_queue_memory (VirtIODevice *vdev, unsigned nvqs)
 
NTSTATUS virtio_find_queue (VirtIODevice *vdev, unsigned index, struct virtqueue **vq)
 
NTSTATUS virtio_find_queues (VirtIODevice *vdev, unsigned nvqs, struct virtqueue *vqs[])
 
void virtio_delete_queue (struct virtqueue *vq)
 
void virtio_delete_queues (VirtIODevice *vdev)
 
u32 virtio_get_queue_size (struct virtqueue *vq)
 
unsigned long virtio_get_indirect_page_capacity ()
 
static ULONG FORCEINLINE virtio_get_queue_descriptor_size ()
 
u16 virtio_set_config_vector (VirtIODevice *vdev, u16 vector)
 
u16 virtio_set_queue_vector (struct virtqueue *vq, u16 vector)
 
u8 virtio_read_isr_status (VirtIODevice *vdev)
 
int virtio_get_bar_index (PPCI_COMMON_HEADER pPCIHeader, PHYSICAL_ADDRESS BasePA)
 

Macro Definition Documentation

◆ MAX_QUEUES_PER_DEVICE_DEFAULT

#define MAX_QUEUES_PER_DEVICE_DEFAULT   8

Definition at line 156 of file virtio_pci.h.

◆ virtio_feature_disable

#define virtio_feature_disable (   FeaturesList,
  Feature 
)    ((FeaturesList) &= ~(1ULL << (Feature)))

Definition at line 313 of file virtio_pci.h.

◆ virtio_feature_enable

#define virtio_feature_enable (   FeaturesList,
  Feature 
)    ((FeaturesList) |= (1ULL << (Feature)))

Definition at line 312 of file virtio_pci.h.

◆ virtio_is_feature_enabled

#define virtio_is_feature_enabled (   FeaturesList,
  Feature 
)    (!!((FeaturesList) & (1ULL << (Feature))))

Definition at line 311 of file virtio_pci.h.

◆ VIRTIO_MSI_CONFIG_VECTOR

#define VIRTIO_MSI_CONFIG_VECTOR   20

Definition at line 75 of file virtio_pci.h.

◆ VIRTIO_MSI_NO_VECTOR

#define VIRTIO_MSI_NO_VECTOR   0xffff

Definition at line 98 of file virtio_pci.h.

◆ VIRTIO_MSI_QUEUE_VECTOR

#define VIRTIO_MSI_QUEUE_VECTOR   22

Definition at line 77 of file virtio_pci.h.

◆ VIRTIO_PCI_CAP_COMMON_CFG

#define VIRTIO_PCI_CAP_COMMON_CFG   1

Definition at line 103 of file virtio_pci.h.

◆ VIRTIO_PCI_CAP_DEVICE_CFG

#define VIRTIO_PCI_CAP_DEVICE_CFG   4

Definition at line 109 of file virtio_pci.h.

◆ VIRTIO_PCI_CAP_ISR_CFG

#define VIRTIO_PCI_CAP_ISR_CFG   3

Definition at line 107 of file virtio_pci.h.

◆ VIRTIO_PCI_CAP_NOTIFY_CFG

#define VIRTIO_PCI_CAP_NOTIFY_CFG   2

Definition at line 105 of file virtio_pci.h.

◆ VIRTIO_PCI_CAP_PCI_CFG

#define VIRTIO_PCI_CAP_PCI_CFG   5

Definition at line 111 of file virtio_pci.h.

◆ VIRTIO_PCI_CONFIG

#define VIRTIO_PCI_CONFIG (   msix_enabled)    VIRTIO_PCI_CONFIG_OFF(msix_enabled)

Definition at line 83 of file virtio_pci.h.

◆ VIRTIO_PCI_CONFIG_OFF

#define VIRTIO_PCI_CONFIG_OFF (   msix_enabled)    ((msix_enabled) ? 24 : 20)

Definition at line 81 of file virtio_pci.h.

◆ VIRTIO_PCI_GUEST_FEATURES

#define VIRTIO_PCI_GUEST_FEATURES   4

Definition at line 51 of file virtio_pci.h.

◆ VIRTIO_PCI_HOST_FEATURES

#define VIRTIO_PCI_HOST_FEATURES   0

Definition at line 48 of file virtio_pci.h.

◆ VIRTIO_PCI_ISR

#define VIRTIO_PCI_ISR   19

Definition at line 71 of file virtio_pci.h.

◆ VIRTIO_PCI_ISR_CONFIG

#define VIRTIO_PCI_ISR_CONFIG   0x2

Definition at line 96 of file virtio_pci.h.

◆ VIRTIO_PCI_QUEUE_ADDR_SHIFT

#define VIRTIO_PCI_QUEUE_ADDR_SHIFT   12

Definition at line 87 of file virtio_pci.h.

◆ VIRTIO_PCI_QUEUE_NOTIFY

#define VIRTIO_PCI_QUEUE_NOTIFY   16

Definition at line 63 of file virtio_pci.h.

◆ VIRTIO_PCI_QUEUE_NUM

#define VIRTIO_PCI_QUEUE_NUM   12

Definition at line 57 of file virtio_pci.h.

◆ VIRTIO_PCI_QUEUE_PFN

#define VIRTIO_PCI_QUEUE_PFN   8

Definition at line 54 of file virtio_pci.h.

◆ VIRTIO_PCI_QUEUE_SEL

#define VIRTIO_PCI_QUEUE_SEL   14

Definition at line 60 of file virtio_pci.h.

◆ VIRTIO_PCI_STATUS

#define VIRTIO_PCI_STATUS   18

Definition at line 66 of file virtio_pci.h.

◆ VIRTIO_PCI_VRING_ALIGN

#define VIRTIO_PCI_VRING_ALIGN   4096

Definition at line 91 of file virtio_pci.h.

Typedef Documentation

◆ VirtIODevice

Definition at line 199 of file virtio_pci.h.

◆ VirtIOQueueInfo

◆ VirtIOSystemOps

Function Documentation

◆ virtio_add_status()

void virtio_add_status ( VirtIODevice vdev,
u8  status 
)

Definition at line 96 of file VirtIOPCICommon.c.

97{
98 vdev->device->set_status(vdev, (u8)(vdev->device->get_status(vdev) | status));
99}
UCHAR u8
Definition: btrfs.h:12
Definition: ps.c:97
const struct virtio_device_ops * device
Definition: virtio_pci.h:251

Referenced by ParaNdis_FinishInitialization(), ParaNdis_InitializeContext(), ParaNdis_PowerOn(), virtio_device_initialize(), and virtio_set_features().

◆ virtio_delete_queue()

void virtio_delete_queue ( struct virtqueue vq)

Definition at line 311 of file VirtIOPCICommon.c.

312{
313 VirtIODevice *vdev = vq->vdev;
314 unsigned i = vq->index;
315
316 vdev->device->delete_queue(&vdev->info[i]);
317 vdev->info[i].vq = NULL;
318}
#define NULL
Definition: types.h:112
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VirtIOQueueInfo * info
Definition: virtio_pci.h:277
struct virtqueue * vq
Definition: virtio_pci.h:161
unsigned int index
Definition: VirtIO.h:45
VirtIODevice * vdev
Definition: VirtIO.h:44

◆ virtio_delete_queues()

void virtio_delete_queues ( VirtIODevice vdev)

Definition at line 320 of file VirtIOPCICommon.c.

321{
322 struct virtqueue *vq;
323 unsigned i;
324
325 if (vdev->info == NULL)
326 return;
327
328 for (i = 0; i < vdev->maxQueues; i++) {
329 vq = vdev->info[i].vq;
330 if (vq != NULL) {
331 vdev->device->delete_queue(&vdev->info[i]);
332 vdev->info[i].vq = NULL;
333 }
334 }
335}
ULONG maxQueues
Definition: virtio_pci.h:273

Referenced by DeleteNetQueues(), and virtio_find_queues().

◆ virtio_device_initialize()

NTSTATUS virtio_device_initialize ( VirtIODevice vdev,
const VirtIOSystemOps pSystemOps,
void DeviceContext,
bool  msix_used 
)

◆ virtio_device_ready()

void virtio_device_ready ( VirtIODevice vdev)

Definition at line 106 of file VirtIOPCICommon.c.

107{
108 unsigned status = vdev->device->get_status(vdev);
109
111 vdev->device->set_status(vdev, (u8)(status | VIRTIO_CONFIG_S_DRIVER_OK));
112}
#define ASSERT(a)
Definition: mode.c:44
#define VIRTIO_CONFIG_S_DRIVER_OK
Definition: virtio_config.h:39

Referenced by ParaNdis_FinishInitialization(), and ParaNdis_PowerOn().

◆ virtio_device_reset()

void virtio_device_reset ( VirtIODevice vdev)

Definition at line 101 of file VirtIOPCICommon.c.

102{
103 vdev->device->reset(vdev);
104}

Referenced by ParaNdis_ResetVirtIONetDevice(), and virtio_device_initialize().

◆ virtio_device_shutdown()

void virtio_device_shutdown ( VirtIODevice vdev)

Definition at line 77 of file VirtIOPCICommon.c.

78{
79 if (vdev->info &&
80 vdev->info != vdev->inline_info) {
81 mem_free_nonpaged_block(vdev, vdev->info);
82 vdev->info = NULL;
83 }
84}
VirtIOQueueInfo inline_info[MAX_QUEUES_PER_DEVICE_DEFAULT]
Definition: virtio_pci.h:278
#define mem_free_nonpaged_block(vdev, addr)

Referenced by VirtIONetRelease().

◆ virtio_find_queue()

NTSTATUS virtio_find_queue ( VirtIODevice vdev,
unsigned  index,
struct virtqueue **  vq 
)

Definition at line 256 of file VirtIOPCICommon.c.

258{
259 u16 msix_vec = vdev_get_msix_vector(vdev, index);
260 return vp_setup_vq(
261 vq,
262 vdev,
263 index,
264 msix_vec);
265}
static NTSTATUS vp_setup_vq(struct virtqueue **queue, VirtIODevice *vdev, unsigned index, u16 msix_vec)
USHORT u16
Definition: btrfs.h:13
GLuint index
Definition: glext.h:6031
#define vdev_get_msix_vector(vdev, queue)

◆ virtio_find_queues()

NTSTATUS virtio_find_queues ( VirtIODevice vdev,
unsigned  nvqs,
struct virtqueue vqs[] 
)

Definition at line 267 of file VirtIOPCICommon.c.

270{
271 unsigned i;
273 u16 msix_vec;
274
276 if (!NT_SUCCESS(status)) {
277 return status;
278 }
279
280 /* set up the device config interrupt */
281 msix_vec = vdev_get_msix_vector(vdev, -1);
282
283 if (msix_vec != VIRTIO_MSI_NO_VECTOR) {
284 msix_vec = vdev->device->set_config_vector(vdev, msix_vec);
285 /* Verify we had enough resources to assign the vector */
286 if (msix_vec == VIRTIO_MSI_NO_VECTOR) {
288 goto error_find;
289 }
290 }
291
292 /* set up queue interrupts */
293 for (i = 0; i < nvqs; i++) {
294 msix_vec = vdev_get_msix_vector(vdev, i);
296 &vqs[i],
297 vdev,
298 i,
299 msix_vec);
300 if (!NT_SUCCESS(status)) {
301 goto error_find;
302 }
303 }
304 return STATUS_SUCCESS;
305
306error_find:
308 return status;
309}
void virtio_delete_queues(VirtIODevice *vdev)
NTSTATUS virtio_reserve_queue_memory(VirtIODevice *vdev, unsigned nvqs)
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_DEVICE_BUSY
Definition: udferr_usr.h:129
#define VIRTIO_MSI_NO_VECTOR
Definition: virtio_pci.h:98

Referenced by FindNetQueues().

◆ virtio_get_bar_index()

int virtio_get_bar_index ( PPCI_COMMON_HEADER  pPCIHeader,
PHYSICAL_ADDRESS  BasePA 
)

Definition at line 357 of file VirtIOPCICommon.c.

358{
359 int iBar, i;
360
361 /* no point in supporting PCI and CardBus bridges */
362 ASSERT((pPCIHeader->HeaderType & ~PCI_MULTIFUNCTION) == PCI_DEVICE_TYPE);
363
364 for (i = 0; i < PCI_TYPE0_ADDRESSES; i++) {
366 BAR.LowPart = pPCIHeader->u.type0.BaseAddresses[i];
367
368 iBar = i;
369 if (BAR.LowPart & PCI_ADDRESS_IO_SPACE) {
370 /* I/O space */
372 BAR.HighPart = 0;
374 /* memory space 64-bit */
376 BAR.HighPart = pPCIHeader->u.type0.BaseAddresses[++i];
377 } else {
378 /* memory space 32-bit */
380 BAR.HighPart = 0;
381 }
382
383 if (BAR.QuadPart == BasePA.QuadPart) {
384 return iBar;
385 }
386 }
387 return -1;
388}
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
#define PCI_TYPE_64BIT
Definition: iotypes.h:4239
#define PCI_MULTIFUNCTION
Definition: iotypes.h:3604
#define PCI_ADDRESS_IO_ADDRESS_MASK
Definition: iotypes.h:4233
#define PCI_TYPE0_ADDRESSES
Definition: iotypes.h:3500
#define PCI_ADDRESS_IO_SPACE
Definition: iotypes.h:4230
#define PCI_ADDRESS_MEMORY_ADDRESS_MASK
Definition: iotypes.h:4234
#define PCI_ADDRESS_MEMORY_TYPE_MASK
Definition: iotypes.h:4231
#define PCI_DEVICE_TYPE
Definition: iotypes.h:3605

Referenced by GetAdapterResources().

◆ virtio_get_config()

void virtio_get_config ( VirtIODevice vdev,
unsigned  offset,
void buf,
unsigned  len 
)

Definition at line 167 of file VirtIOPCICommon.c.

169{
170 switch (len) {
171 case 1:
172 case 2:
173 case 4:
174 vdev->device->get_config(vdev, offset, buf, len);
175 break;
176 case 8:
177 virtio_cread_many(vdev, offset, buf, 2, sizeof(u32));
178 break;
179 default:
180 virtio_cread_many(vdev, offset, buf, len, 1);
181 break;
182 }
183}
static void virtio_cread_many(VirtIODevice *vdev, unsigned int offset, void *buf, size_t count, size_t bytes)
ULONG32 u32
Definition: btrfs.h:14
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
GLintptr offset
Definition: glext.h:5920

Referenced by ParaNdis_InitializeContext(), and ParaNdis_ReportLinkStatus().

◆ virtio_get_features()

u64 virtio_get_features ( VirtIODevice dev)

Definition at line 114 of file VirtIOPCICommon.c.

115{
116 return vdev->device->get_features(vdev);
117}

Referenced by ParaNdis_InitializeContext(), and ParaNdis_PowerOn().

◆ virtio_get_indirect_page_capacity()

unsigned long virtio_get_indirect_page_capacity ( )

Definition at line 550 of file VirtIORing.c.

551{
552 return PAGE_SIZE / sizeof(struct vring_desc);
553}
#define PAGE_SIZE
Definition: env_spec_w32.h:49

◆ virtio_get_queue_descriptor_size()

static ULONG FORCEINLINE virtio_get_queue_descriptor_size ( )
static

Definition at line 366 of file virtio_pci.h.

367{
368 return sizeof(VirtIOQueueInfo);
369}
struct virtio_queue_info VirtIOQueueInfo

Referenced by virtio_reserve_queue_memory().

◆ virtio_get_queue_size()

u32 virtio_get_queue_size ( struct virtqueue vq)

Definition at line 337 of file VirtIOPCICommon.c.

338{
339 return vq->vdev->info[vq->index].num;
340}

Referenced by PrepareTransmitBuffers().

◆ virtio_get_status()

u8 virtio_get_status ( VirtIODevice vdev)

Definition at line 86 of file VirtIOPCICommon.c.

87{
88 return vdev->device->get_status(vdev);
89}

Referenced by ParaNdis_ResetVirtIONetDevice(), and VirtIODeviceRemoveStatus().

◆ virtio_query_queue_allocation()

NTSTATUS virtio_query_queue_allocation ( VirtIODevice vdev,
unsigned  index,
unsigned short pNumEntries,
unsigned long pRingSize,
unsigned long pHeapSize 
)

Definition at line 215 of file VirtIOPCICommon.c.

220{
221 return vdev->device->query_queue_alloc(vdev, index, pNumEntries, pRingSize, pHeapSize);
222}

◆ virtio_read_isr_status()

u8 virtio_read_isr_status ( VirtIODevice vdev)

Definition at line 352 of file VirtIOPCICommon.c.

353{
354 return ioread8(vdev, vdev->isr);
355}
volatile u8 * isr
Definition: virtio_pci.h:260
#define ioread8(vdev, addr)

Referenced by CheckRunningDpc(), JustForCheckClearInterrupt(), and ParaNdis_OnLegacyInterrupt().

◆ virtio_reserve_queue_memory()

NTSTATUS virtio_reserve_queue_memory ( VirtIODevice vdev,
unsigned  nvqs 
)

Definition at line 224 of file VirtIOPCICommon.c.

225{
226 if (nvqs > vdev->maxQueues) {
227 /* allocate new space for queue infos */
228 void *new_info = mem_alloc_nonpaged_block(vdev, nvqs * virtio_get_queue_descriptor_size());
229 if (!new_info) {
231 }
232
233 if (vdev->info && vdev->info != vdev->inline_info) {
234 mem_free_nonpaged_block(vdev, vdev->info);
235 }
236 vdev->info = new_info;
237 vdev->maxQueues = nvqs;
238 }
239 return STATUS_SUCCESS;
240}
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
static ULONG FORCEINLINE virtio_get_queue_descriptor_size()
Definition: virtio_pci.h:366
#define mem_alloc_nonpaged_block(vdev, size)

Referenced by virtio_find_queues().

◆ virtio_set_config()

void virtio_set_config ( VirtIODevice vdev,
unsigned  offset,
void buf,
unsigned  len 
)

Definition at line 197 of file VirtIOPCICommon.c.

199{
200 switch (len) {
201 case 1:
202 case 2:
203 case 4:
204 vdev->device->set_config(vdev, offset, buf, len);
205 break;
206 case 8:
207 virtio_cwrite_many(vdev, offset, buf, 2, sizeof(u32));
208 break;
209 default:
210 virtio_cwrite_many(vdev, offset, buf, len, 1);
211 break;
212 }
213}
static void virtio_cwrite_many(VirtIODevice *vdev, unsigned int offset, void *buf, size_t count, size_t bytes)

◆ virtio_set_config_vector()

u16 virtio_set_config_vector ( VirtIODevice vdev,
u16  vector 
)

Definition at line 342 of file VirtIOPCICommon.c.

343{
344 return vdev->device->set_config_vector(vdev, vector);
345}

◆ virtio_set_features()

NTSTATUS virtio_set_features ( VirtIODevice vdev,
u64  features 
)

Definition at line 119 of file VirtIOPCICommon.c.

120{
121 unsigned char dev_status;
123
126
127 status = vdev->device->set_features(vdev, features);
128 if (!NT_SUCCESS(status)) {
129 return status;
130 }
131
133 return status;
134 }
135
137 dev_status = vdev->device->get_status(vdev);
138 if (!(dev_status & VIRTIO_CONFIG_S_FEATURES_OK)) {
139 DPrintf(0, "virtio: device refuses features: %x\n", dev_status);
141 }
142 return status;
143}
void virtio_add_status(VirtIODevice *vdev, u8 status)
#define DPrintf(Level, Fmt)
Definition: kdebugprint.h:61
bool event_suppression_enabled
Definition: virtio_pci.h:245
bool packed_ring
Definition: virtio_pci.h:248
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define VIRTIO_F_RING_PACKED
Definition: virtio_config.h:68
#define VIRTIO_CONFIG_S_FEATURES_OK
Definition: virtio_config.h:41
#define VIRTIO_F_VERSION_1
Definition: virtio_config.h:63
#define virtio_is_feature_enabled(FeaturesList, Feature)
Definition: virtio_pci.h:311
#define VIRTIO_RING_F_EVENT_IDX
Definition: virtio_ring.h:45

Referenced by FinalizeFeatures().

◆ virtio_set_queue_vector()

u16 virtio_set_queue_vector ( struct virtqueue vq,
u16  vector 
)

Definition at line 347 of file VirtIOPCICommon.c.

348{
349 return vq->vdev->device->set_queue_vector(vq, vector);
350}

◆ virtio_set_status()

void virtio_set_status ( VirtIODevice vdev,
u8  status 
)

Definition at line 91 of file VirtIOPCICommon.c.

92{
93 vdev->device->set_status(vdev, status);
94}

Referenced by VirtIODeviceRemoveStatus().