1 | /** @file
|
---|
2 | *
|
---|
3 | * vboxadd -- VirtualBox Guest Additions for Linux
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef VBOXMOD_H
|
---|
23 | #define VBOXMOD_H
|
---|
24 |
|
---|
25 | #include <VBox/VBoxGuest.h>
|
---|
26 | #include <VBox/VBoxGuestLib.h>
|
---|
27 | #include <iprt/asm.h>
|
---|
28 |
|
---|
29 | typedef struct VBoxDevice VBoxDevice;
|
---|
30 | struct VBoxDevice
|
---|
31 | {
|
---|
32 | /** the device name */
|
---|
33 | char name[128];
|
---|
34 | /** file node minor code */
|
---|
35 | unsigned minor;
|
---|
36 | /** IRQ number */
|
---|
37 | unsigned irq;
|
---|
38 | /** first IO port */
|
---|
39 | unsigned short io_port;
|
---|
40 | /** physical address of device memory */
|
---|
41 | uint32_t vmmdevmem;
|
---|
42 | /** size of adapter memory */
|
---|
43 | size_t vmmdevmem_size;
|
---|
44 |
|
---|
45 | /** kernel space mapping of the adapter memory */
|
---|
46 | VMMDevMemory *pVMMDevMemory;
|
---|
47 | /** current pending events mask */
|
---|
48 | uint32_t u32Events;
|
---|
49 | /** request structure to acknowledge events in ISR */
|
---|
50 | VMMDevEvents *irqAckRequest;
|
---|
51 | /** start of the hypervisor window */
|
---|
52 | void *hypervisorStart;
|
---|
53 | /** size of the hypervisor window in bytes */
|
---|
54 | uint32_t hypervisorSize;
|
---|
55 | /** event synchronization */
|
---|
56 | wait_queue_head_t eventq;
|
---|
57 | /** number of times the guest has interrupted the event loop -
|
---|
58 | implemented as a counter to prevent one waiter swallowing the
|
---|
59 | event. */
|
---|
60 | uint32_t u32GuestInterruptions;
|
---|
61 | /** Queue structure */
|
---|
62 | struct fasync_struct *async_queue;
|
---|
63 | };
|
---|
64 |
|
---|
65 | extern int vboxadd_verbosity;
|
---|
66 |
|
---|
67 | #define wlog(...) printk (KERN_WARNING "vboxadd: " __VA_ARGS__)
|
---|
68 | #define ilog(...) printk (KERN_INFO "vboxadd: " __VA_ARGS__)
|
---|
69 | #define dlog(...) printk (KERN_DEBUG "vboxadd: " __VA_ARGS__)
|
---|
70 | #define elog(...) printk (KERN_ERR "vboxadd: " __VA_ARGS__)
|
---|
71 |
|
---|
72 | #define vlog(n, ...) \
|
---|
73 | if (n >= vboxadd_verbosity) printk (KERN_DEBUG "vboxadd: " __VA_ARGS__)
|
---|
74 |
|
---|
75 | extern int vboxadd_cmc_init (void);
|
---|
76 | extern void vboxadd_cmc_fini (void);
|
---|
77 | DECLVBGL (int) vboxadd_cmc_call (void *opaque, uint32_t func, void *data);
|
---|
78 |
|
---|
79 | #if 0
|
---|
80 | /**
|
---|
81 | * This IOCTL wrapper allows the guest to make an HGCM call from user space. The
|
---|
82 | * OS-independant part of the Guest Additions already contain code for making an
|
---|
83 | * HGCM call from the guest, but this code assumes that the call is made from the
|
---|
84 | * kernel's address space. So before calling it, we have to copy all parameters
|
---|
85 | * to the HGCM call from user space to kernel space and reconstruct the structures
|
---|
86 | * passed to the call (which include pointers to other memory) inside the kernel's
|
---|
87 | * address space.
|
---|
88 | *
|
---|
89 | * @returns 0 on success or Linux error code on failure
|
---|
90 | * @param arg User space pointer to the call data structure
|
---|
91 | */
|
---|
92 | extern int vbox_ioctl_hgcm_call(unsigned long arg, VBoxDevice *vboxDev);
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * This call is similar to vbox_ioctl_hgcm_call, but for the _TIMEOUT variant
|
---|
96 | * of the ioctl.
|
---|
97 | *
|
---|
98 | * @returns 0 on success or Linux error code on failure
|
---|
99 | * @param arg User space pointer to the call data structure
|
---|
100 | */
|
---|
101 | extern int vbox_ioctl_hgcm_call_timeout(unsigned long arg, VBoxDevice *vboxDev);
|
---|
102 | #endif
|
---|
103 |
|
---|
104 | #endif /* !VBOXMOD_H */
|
---|