VirtualBox

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

Last change on this file since 76748 was 76563, checked in by vboxsync, 6 years ago

Additions: Use GA_INCLUDED_ and variations_ as header guard prefixes with scm.

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