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