VirtualBox

source: vbox/trunk/src/VBox/Additions/solaris/Mouse/testcase/solaris.h@ 69496

Last change on this file since 69496 was 69496, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.8 KB
Line 
1/* $Id: solaris.h 69496 2017-10-28 14:55:58Z vboxsync $ */
2/** @file
3 * VBoxGuest - Guest Additions Driver for Solaris - testcase stubs.
4 */
5
6/*
7 * Copyright (C) 2012-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef ___VBoxGuestTestCaseSolaris_h
28#define ___VBoxGuestTestCaseSolaris_h
29
30#include <iprt/assert.h>
31#include <iprt/string.h> /* RT_ZERO */
32#ifdef RT_OS_WINDOWS
33# include <iprt/win/winsock2.h> /* struct timeval */
34#endif
35#include <errno.h>
36#include <time.h> /* struct timeval */
37
38/* Overrides */
39#define dev_t unsigned
40
41/* Constants */
42#define DDI_FAILURE (-1)
43#define DDI_SUCCESS (0)
44
45#define MODMAXNAMELEN 32
46#define MODMAXLINKINFOLEN 32
47#define MODMAXLINK 10
48
49#define MOD_NOAUTOUNLOAD 0x1
50
51#define M_DATA 0x00
52#define M_BREAK 0x08
53#define M_PASSFP 0x09
54#define M_EVENT 0x0a
55#define M_SIG 0x0b
56#define M_DELAY 0x0c
57#define M_CTL 0x0d
58#define M_IOCTL 0x0e
59#define M_SETOPTS 0x10
60#define M_RSE 0x11
61
62#define M_IOCACK 0x81
63#define M_IOCNAK 0x82
64#define M_PCPROTO 0x83
65#define M_PCSIG 0x84
66#define M_READ 0x85
67#define M_FLUSH 0x86
68#define M_STOP 0x87
69#define M_START 0x88
70#define M_HANGUP 0x89
71#define M_ERROR 0x8a
72#define M_COPYIN 0x8b
73#define M_COPYOUT 0x8c
74#define M_IOCDATA 0x8d
75#define M_PCRSE 0x8e
76#define M_STOPI 0x8f
77#define M_STARTI 0x90
78#define M_PCEVENT 0x91
79#define M_UNHANGUP 0x92
80#define M_CMD 0x93
81
82#define BPRI_LO 1
83#define BPRI_MED 2
84#define BPRI_HI 3
85
86#define FLUSHALL 1
87#define FLUSHDATA 0
88
89#define TRANSPARENT (unsigned int)(-1)
90
91#define FLUSHR 0x01
92#define FLUSHW 0x02
93
94#define MSIOC ('m'<<8)
95#define MSIOGETPARMS (MSIOC|1)
96#define MSIOSETPARMS (MSIOC|2)
97#define MSIOBUTTONS (MSIOC|3)
98#define MSIOSRESOLUTION (MSIOC|4)
99
100#define VUIOC ('v'<<8)
101#define VUIDSFORMAT (VUIOC|1)
102#define VUIDGFORMAT (VUIOC|2)
103#define VUID_NATIVE 0
104#define VUID_FIRM_EVENT 1
105
106#define VUIDSADDR (VUIOC|3)
107#define VUIDGADDR (VUIOC|4)
108
109#define VUID_WHEEL_MAX_COUNT 256
110#define VUIDGWHEELCOUNT (VUIOC|15)
111#define VUIDGWHEELINFO (VUIOC|16)
112#define VUIDGWHEELSTATE (VUIOC|17)
113#define VUIDSWHEELSTATE (VUIOC|18)
114
115#define DDI_DEVICE_ATTR_V0 0x0001
116#define DDI_DEVICE_ATTR_V1 0x0002
117
118#define DDI_NEVERSWAP_ACC 0x00
119#define DDI_STRUCTURE_LE_ACC 0x01
120#define DDI_STRUCTURE_BE_ACC 0x02
121
122#define DDI_STRICTORDER_ACC 0x00
123#define DDI_UNORDERED_OK_ACC 0x01
124#define DDI_MERGING_OK_ACC 0x02
125#define DDI_LOADCACHING_OK_ACC 0x03
126#define DDI_STORECACHING_OK_ACC 0x04
127
128/** @todo fix this */
129#define DDI_DEFAULT_ACC DDI_STRICTORDER_ACC
130
131#define DDI_INTR_CLAIMED 1
132#define DDI_INTR_UNCLAIMED 0
133
134#define DDI_INTR_TYPE_FIXED 0x1
135#define DDI_INTR_TYPE_MSI 0x2
136#define DDI_INTR_TYPE_MSIX 0x4
137
138#define LOC_FIRST_DELTA 32640
139#define LOC_X_DELTA 32640
140#define LOC_Y_DELTA 32641
141#define LOC_LAST_DELTA 32641
142#define LOC_FIRST_ABSOLUTE 32642
143#define LOC_X_ABSOLUTE 32642
144#define LOC_Y_ABSOLUTE 32643
145#define LOC_LAST_ABSOLUTE 32643
146
147#define FE_PAIR_NONE 0
148#define FE_PAIR_SET 1
149#define FE_PAIR_DELTA 2
150#define FE_PAIR_ABSOLUTE 3
151
152typedef struct __ldi_handle *ldi_handle_t;
153
154typedef enum
155{
156 DDI_INFO_DEVT2DEVINFO = 0,
157 DDI_INFO_DEVT2INSTANCE = 1
158} ddi_info_cmd_t;
159
160typedef enum
161{
162 DDI_ATTACH = 0,
163 DDI_RESUME = 1,
164 DDI_PM_RESUME = 2
165} ddi_attach_cmd_t;
166
167typedef enum
168{
169 DDI_DETACH = 0,
170 DDI_SUSPEND = 1,
171 DDI_PM_SUSPEND = 2,
172 DDI_HOTPLUG_DETACH = 3
173} ddi_detach_cmd_t;
174
175/* Simple types */
176
177typedef struct cred *cred_t;
178typedef struct dev_info *dev_info_t;
179typedef struct __ddi_acc_handle * ddi_acc_handle_t;
180typedef struct __ddi_intr_handle *ddi_intr_handle_t;
181typedef struct mutex *kmutex_t;
182typedef unsigned int uint_t;
183typedef unsigned short ushort_t;
184typedef unsigned char uchar_t;
185
186/* Structures */
187
188struct modspecific_info {
189 char msi_linkinfo[MODMAXLINKINFOLEN];
190 int msi_p0;
191};
192
193struct modinfo {
194 int mi_info;
195 int mi_state;
196 int mi_id;
197 int mi_nextid;
198 char *mi_base; /* Was caddr_t. */
199 size_t mi_size;
200 int mi_rev;
201 int mi_loadcnt;
202 char mi_name[MODMAXNAMELEN];
203 struct modspecific_info mi_msinfo[MODMAXLINK];
204};
205
206typedef struct queue
207{
208 struct qinit *q_qinfo;
209 struct msgb *q_first;
210 struct msgb *q_last;
211 struct queue *q_next;
212 void *q_ptr;
213 size_t q_count;
214 uint_t q_flag;
215 ssize_t q_minpsz;
216 ssize_t q_maxpsz;
217 size_t q_hiwat;
218 size_t q_lowat;
219} queue_t;
220
221typedef struct msgb
222{
223 struct msgb *b_next;
224 struct msgb *b_prev;
225 struct msgb *b_cont;
226 unsigned char *b_rptr;
227 unsigned char *b_wptr;
228 struct datab *b_datap;
229 unsigned char b_band;
230 unsigned short b_flag;
231} mblk_t;
232
233typedef struct datab
234{
235 unsigned char *db_base;
236 unsigned char *db_lim;
237 unsigned char db_ref;
238 unsigned char db_type;
239} dblk_t;
240
241struct iocblk
242{
243 int ioc_cmd;
244 cred_t *ioc_cr;
245 uint_t ioc_id;
246 uint_t ioc_flag;
247 size_t ioc_count;
248 int ioc_rval;
249 int ioc_error;
250#if defined(RT_ARCH_AMD64) /* Actually this should be LP64. */
251 int dummy; /* For simplicity, to ensure the structure size matches
252 struct copyreq. */
253#endif
254};
255
256struct copyreq
257{
258 int cq_cmd;
259 cred_t *cq_cr;
260 uint_t cq_id;
261 uint_t cq_flag;
262 mblk_t *cq_private;
263 char *cq_addr; /* Was caddr_t. */
264 size_t cq_size;
265};
266
267struct copyresp
268{
269 int cp_cmd;
270 cred_t *cp_cr;
271 uint_t cp_id;
272 uint_t cp_flag;
273 mblk_t *cp_private;
274 char *cp_rval; /* Was caddr_t. */
275};
276
277typedef struct modctl
278{
279 /* ... */
280 char mod_loadflags;
281 /* ... */
282} modctl_t;
283
284typedef struct {
285 int jitter_thresh;
286 int speed_law;
287 int speed_limit;
288} Ms_parms;
289
290typedef struct {
291 int height;
292 int width;
293} Ms_screen_resolution;
294
295typedef struct vuid_addr_probe {
296 short base;
297 union
298 {
299 short next;
300 short current;
301 } data;
302} Vuid_addr_probe;
303
304typedef struct ddi_device_acc_attr
305{
306 ushort_t devacc_attr_version;
307 uchar_t devacc_attr_endian_flags;
308 uchar_t devacc_attr_dataorder;
309 uchar_t devacc_attr_access;
310} ddi_device_acc_attr_t;
311
312typedef struct firm_event
313{
314 ushort_t id;
315 uchar_t pair_type;
316 uchar_t pair;
317 int value;
318 struct timeval time;
319} Firm_event;
320
321/* Prototypes */
322
323#define _init vboxguestSolarisInit
324extern int vboxguestSolarisInit(void);
325#define _fini vboxguestSolarisFini
326extern int vboxguestSolarisFini(void);
327#define _info vboxguestSolarisInfo
328extern int vboxguestSolarisInfo(struct modinfo *pModInfo);
329
330/* Simple API stubs */
331
332#define cmn_err(...) do {} while(0)
333#define mod_remove(...) 0
334#define mod_info(...) 0
335#define RTR0Init(...) VINF_SUCCESS
336#define RTR0Term(...) do {} while(0)
337#define RTR0AssertPanicSystem(...) do {} while(0)
338#define RTLogCreate(...) VINF_SUCCESS
339#define RTLogRelSetDefaultInstance(...) do {} while(0)
340#define RTLogDestroy(...) do {} while(0)
341#if 0
342#define VBoxGuestCreateKernelSession(...) VINF_SUCCESS
343#define VBoxGuestCreateUserSession(...) VINF_SUCCESS
344#define VBoxGuestCloseSession(...) do {} while(0)
345#define VBoxGuestInitDevExt(...) VINF_SUCCESS
346#define VBoxGuestDeleteDevExt(...) do {} while(0)
347#define VBoxGuestCommonIOCtl(...) VINF_SUCCESS
348#define VBoxGuestCommonISR(...) true
349#define VbglR0GRAlloc(...) VINF_SUCCESS
350#define VbglR0GRPerform(...) VINF_SUCCESS
351#define VbglR0GRFree(...) do {} while(0)
352#endif
353#define VbglR0InitClient(...) VINF_SUCCESS
354#define vbglDriverOpen(...) VINF_SUCCESS
355#define vbglDriverClose(...) do {} while(0)
356#define vbglDriverIOCtl(...) VINF_SUCCESS
357#define qprocson(...) do {} while(0)
358#define qprocsoff(...) do {} while(0)
359#define flushq(...) do {} while(0)
360#define putnext(...) do {} while(0)
361#define ddi_get_instance(...) 0
362#define pci_config_setup(...) DDI_SUCCESS
363#define pci_config_teardown(...) do {} while(0)
364#define ddi_regs_map_setup(...) DDI_SUCCESS
365#define ddi_regs_map_free(...) do {} while(0)
366#define ddi_dev_regsize(...) DDI_SUCCESS
367#define ddi_create_minor_node(...) DDI_SUCCESS
368#define ddi_remove_minor_node(...) do {} while(0)
369#define ddi_intr_get_supported_types(...) DDI_SUCCESS
370#define ddi_intr_get_nintrs(...) DDI_SUCCESS
371#define ddi_intr_get_navail(...) DDI_SUCCESS
372#define ddi_intr_alloc(...) DDI_SUCCESS
373#define ddi_intr_free(...) do {} while(0)
374#define ddi_intr_get_pri(...) DDI_SUCCESS
375#define ddi_intr_enable(...) DDI_SUCCESS
376#define ddi_intr_disable(...) DDI_SUCCESS
377#define ddi_intr_add_handler(...) DDI_SUCCESS
378#define ddi_intr_remove_handler(...) DDI_SUCCESS
379#define mutex_init(...) do {} while(0)
380#define mutex_destroy(...) do {} while(0)
381#define mutex_enter(...) do {} while(0)
382#define mutex_exit(...) do {} while(0)
383#define uniqtime32(...) do {} while(0)
384#define canput(...) true
385#define putbq(...) do {} while(0)
386
387/* Externally defined helpers. */
388
389/** Flags set in the struct mblk b_flag member for verification purposes.
390 * @{ */
391/** miocpullup was called for this message. */
392#define F_TEST_PULLUP 1
393/** @} */
394
395extern void miocack(queue_t *pWriteQueue, mblk_t *pMBlk, int cbData, int rc);
396extern void miocnak(queue_t *pWriteQueue, mblk_t *pMBlk, int cbData, int iErr);
397extern int miocpullup(mblk_t *pMBlk, size_t cbMsg);
398extern void mcopyin(mblk_t *pMBlk, void *pvState, size_t cbData, void *pvUser);
399extern void mcopyout(mblk_t *pMBlk, void *pvState, size_t cbData, void *pvUser,
400 mblk_t *pMBlkData);
401extern void qreply(queue_t *pQueue, mblk_t *pMBlk);
402extern mblk_t *allocb(size_t cb, uint_t cPrio);
403extern void freemsg(mblk_t *pMsg);
404
405/* API stubs with simple logic */
406
407static modctl_t s_ModCtl;
408static void **s_pvLinkage;
409
410static inline modctl_t *mod_getctl(void **linkage)
411{
412 s_pvLinkage = linkage;
413 return s_pvLinkage ? &s_ModCtl : NULL;
414}
415
416#define mod_install(linkage) (s_pvLinkage && ((linkage) == s_pvLinkage) ? 0 : EINVAL)
417#define QREADR 0x00000010
418#define OTHERQ(q) ((q)->q_flag & QREADR ? (q) + 1 : (q) - 1)
419#define WR(q) ((q)->q_flag & QREADR ? (q) + 1 : (q))
420#define RD(q) ((q)->q_flag & QREADR ? (q) : (q) - 1)
421
422
423/* Basic initialisation of a queue structure pair for testing. */
424static inline void doInitQueues(queue_t aQueues[2])
425{
426 aQueues[0].q_flag = QREADR;
427}
428
429static inline dev_t makedevice(unsigned cMajor, unsigned cMinor)
430{
431 return cMajor * 4096 + cMinor;
432}
433
434static inline unsigned getmajor(dev_t device)
435{
436 return device / 4096;
437}
438
439/* API stubs with controllable logic */
440
441#endif /* ___VBoxGuestTestCaseSolaris_h */
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