VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmqueue.h@ 93593

Last change on this file since 93593 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 6.6 KB
Line 
1/** @file
2 * PDM - Pluggable Device Manager, Queues.
3 */
4
5/*
6 * Copyright (C) 2006-2022 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef VBOX_INCLUDED_vmm_pdmqueue_h
27#define VBOX_INCLUDED_vmm_pdmqueue_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <VBox/types.h>
33
34RT_C_DECLS_BEGIN
35
36/** @defgroup grp_pdm_queue The PDM Queues API
37 * @ingroup grp_pdm
38 * @{
39 */
40
41/** PDM queue handle. */
42typedef uint64_t PDMQUEUEHANDLE;
43/** NIL PDM queue handle. */
44#define NIL_PDMQUEUEHANDLE UINT64_MAX
45
46/** Pointer to a PDM queue. */
47typedef struct PDMQUEUE *PPDMQUEUE;
48
49/** Pointer to a PDM queue item core. */
50typedef struct PDMQUEUEITEMCORE *PPDMQUEUEITEMCORE;
51
52/**
53 * PDM queue item core.
54 */
55typedef struct PDMQUEUEITEMCORE
56{
57 /** Pointer to the next item in the pending list - R3 Pointer. */
58 R3PTRTYPE(PPDMQUEUEITEMCORE) pNextR3;
59 /** Pointer to the next item in the pending list - R0 Pointer. */
60 R0PTRTYPE(PPDMQUEUEITEMCORE) pNextR0;
61} PDMQUEUEITEMCORE;
62
63
64/**
65 * Queue consumer callback for devices.
66 *
67 * @returns Success indicator.
68 * If false the item will not be removed and the flushing will stop.
69 * @param pDevIns The device instance.
70 * @param pItem The item to consume. Upon return this item will be freed.
71 * @remarks The device critical section will NOT be entered before calling the
72 * callback. No locks will be held, but for now it's safe to assume
73 * that only one EMT will do queue callbacks at any one time.
74 */
75typedef DECLCALLBACKTYPE(bool, FNPDMQUEUEDEV,(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem));
76/** Pointer to a FNPDMQUEUEDEV(). */
77typedef FNPDMQUEUEDEV *PFNPDMQUEUEDEV;
78
79/**
80 * Queue consumer callback for USB devices.
81 *
82 * @returns Success indicator.
83 * If false the item will not be removed and the flushing will stop.
84 * @param pUsbIns The USB device instance.
85 * @param pItem The item to consume. Upon return this item will be freed.
86 * @remarks No locks will be held, but for now it's safe to assume that only one
87 * EMT will do queue callbacks at any one time.
88 */
89typedef DECLCALLBACKTYPE(bool, FNPDMQUEUEUSB,(PPDMUSBINS pUsbIns, PPDMQUEUEITEMCORE pItem));
90/** Pointer to a FNPDMQUEUEUSB(). */
91typedef FNPDMQUEUEUSB *PFNPDMQUEUEUSB;
92
93/**
94 * Queue consumer callback for drivers.
95 *
96 * @returns Success indicator.
97 * If false the item will not be removed and the flushing will stop.
98 * @param pDrvIns The driver instance.
99 * @param pItem The item to consume. Upon return this item will be freed.
100 * @remarks No locks will be held, but for now it's safe to assume that only one
101 * EMT will do queue callbacks at any one time.
102 */
103typedef DECLCALLBACKTYPE(bool, FNPDMQUEUEDRV,(PPDMDRVINS pDrvIns, PPDMQUEUEITEMCORE pItem));
104/** Pointer to a FNPDMQUEUEDRV(). */
105typedef FNPDMQUEUEDRV *PFNPDMQUEUEDRV;
106
107/**
108 * Queue consumer callback for internal component.
109 *
110 * @returns Success indicator.
111 * If false the item will not be removed and the flushing will stop.
112 * @param pVM The cross context VM structure.
113 * @param pItem The item to consume. Upon return this item will be freed.
114 * @remarks No locks will be held, but for now it's safe to assume that only one
115 * EMT will do queue callbacks at any one time.
116 */
117typedef DECLCALLBACKTYPE(bool, FNPDMQUEUEINT,(PVM pVM, PPDMQUEUEITEMCORE pItem));
118/** Pointer to a FNPDMQUEUEINT(). */
119typedef FNPDMQUEUEINT *PFNPDMQUEUEINT;
120
121/**
122 * Queue consumer callback for external component.
123 *
124 * @returns Success indicator.
125 * If false the item will not be removed and the flushing will stop.
126 * @param pvUser User argument.
127 * @param pItem The item to consume. Upon return this item will be freed.
128 * @remarks No locks will be held, but for now it's safe to assume that only one
129 * EMT will do queue callbacks at any one time.
130 */
131typedef DECLCALLBACKTYPE(bool, FNPDMQUEUEEXT,(void *pvUser, PPDMQUEUEITEMCORE pItem));
132/** Pointer to a FNPDMQUEUEEXT(). */
133typedef FNPDMQUEUEEXT *PFNPDMQUEUEEXT;
134
135#ifdef VBOX_IN_VMM
136VMMR3_INT_DECL(int) PDMR3QueueCreateDevice(PVM pVM, PPDMDEVINS pDevIns, size_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
137 PFNPDMQUEUEDEV pfnCallback, bool fRZEnabled, const char *pszName, PPDMQUEUE *ppQueue);
138VMMR3_INT_DECL(int) PDMR3QueueCreateDriver(PVM pVM, PPDMDRVINS pDrvIns, size_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
139 PFNPDMQUEUEDRV pfnCallback, const char *pszName, PPDMQUEUE *ppQueue);
140VMMR3_INT_DECL(int) PDMR3QueueCreateInternal(PVM pVM, size_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
141 PFNPDMQUEUEINT pfnCallback, bool fGCEnabled, const char *pszName, PPDMQUEUE *ppQueue);
142VMMR3_INT_DECL(int) PDMR3QueueCreateExternal(PVM pVM, size_t cbItem, uint32_t cItems, uint32_t cMilliesInterval,
143 PFNPDMQUEUEEXT pfnCallback, void *pvUser, const char *pszName, PPDMQUEUE *ppQueue);
144VMMR3_INT_DECL(int) PDMR3QueueDestroy(PPDMQUEUE pQueue);
145VMMR3_INT_DECL(int) PDMR3QueueDestroyDevice(PVM pVM, PPDMDEVINS pDevIns);
146VMMR3_INT_DECL(int) PDMR3QueueDestroyDriver(PVM pVM, PPDMDRVINS pDrvIns);
147VMMR3_INT_DECL(void) PDMR3QueueFlushAll(PVM pVM);
148#endif /* VBOX_IN_VMM */
149
150VMMDECL(PPDMQUEUEITEMCORE) PDMQueueAlloc(PPDMQUEUE pQueue);
151VMMDECL(void) PDMQueueInsert(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem);
152VMMDECL(void) PDMQueueInsertEx(PPDMQUEUE pQueue, PPDMQUEUEITEMCORE pItem, uint64_t NanoMaxDelay);
153VMMDECL(R0PTRTYPE(PPDMQUEUE)) PDMQueueR0Ptr(PPDMQUEUE pQueue);
154VMMDECL(bool) PDMQueueFlushIfNecessary(PPDMQUEUE pQueue);
155
156/** @} */
157
158RT_C_DECLS_END
159
160#endif /* !VBOX_INCLUDED_vmm_pdmqueue_h */
161
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette