VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/VBoxPci/VBoxPciInternal.h@ 36218

Last change on this file since 36218 was 36218, checked in by vboxsync, 14 years ago

PCI: interrupts work

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/* $Id: VBoxPciInternal.h 36218 2011-03-09 09:32:02Z vboxsync $ */
2/** @file
3 * VBoxPci - PCI driver (Host), Internal Header.
4 */
5
6/*
7 * Copyright (C) 2011 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
18#ifndef ___VBoPciInternal_h___
19#define ___VBoxPciInternal_h___
20
21#include <VBox/sup.h>
22#include <VBox/rawpci.h>
23#include <iprt/semaphore.h>
24#include <iprt/assert.h>
25
26
27RT_C_DECLS_BEGIN
28
29/* Forward declaration. */
30typedef struct VBOXRAWPCIGLOBALS *PVBOXRAWPCIGLOBALS;
31typedef struct VBOXRAWPCIINS *PVBOXRAWPCIINS;
32
33/**
34 * The per-instance data of the VBox raw PCI interface.
35 *
36 * This is data associated with a host PCI card which
37 * the filter driver has been or may be attached to. When possible it is
38 * attached dynamically, but this may not be possible on all OSes so we have
39 * to be flexible about things.
40 *
41 */
42typedef struct VBOXRAWPCIINS
43{
44 /** Pointer to the globals. */
45 PVBOXRAWPCIGLOBALS pGlobals;
46 /** The spinlock protecting the state variables and host interface handle. */
47 RTSPINLOCK hSpinlock;
48 /** Pointer to the next device in the list. */
49 PVBOXRAWPCIINS pNext;
50 /** Reference count. */
51 uint32_t volatile cRefs;
52
53 /* Host PCI address of this device. */
54 uint32_t HostPciAddress;
55
56#ifdef RT_OS_LINUX
57 struct pci_dev * pPciDev;
58#endif
59
60 /** The session this interface is associated with. */
61 PSUPDRVSESSION pSession;
62 /** The SUPR0 object id. */
63 void *pvObj;
64
65 /** Port, given to the outside world. */
66 RAWPCIDEVPORT DevPort;
67
68 PFNRAWPCIISR pfnIrqHandler;
69 void *pIrqContext;
70} VBOXRAWPCIINS;
71
72/**
73 * The global data of the VBox PCI driver.
74 *
75 * This contains the bit required for communicating with support driver, VBoxDrv
76 * (start out as SupDrv).
77 */
78typedef struct VBOXRAWPCIGLOBALS
79{
80 /** Mutex protecting the list of instances and state changes. */
81 RTSEMFASTMUTEX hFastMtx;
82
83 /** Pointer to a list of instance data. */
84 PVBOXRAWPCIINS pInstanceHead;
85
86 /** The raw PCI interface factory. */
87 RAWPCIFACTORY RawPciFactory;
88 /** The SUPDRV component factory registration. */
89 SUPDRVFACTORY SupDrvFactory;
90 /** The number of current factory references. */
91 int32_t volatile cFactoryRefs;
92 /** Whether the IDC connection is open or not.
93 * This is only for cleaning up correctly after the separate IDC init on Windows. */
94 bool fIDCOpen;
95 /** The SUPDRV IDC handle (opaque struct). */
96 SUPDRVIDCHANDLE SupDrvIDC;
97#ifdef RT_OS_LINUX
98 struct module * pciStubModule;
99#endif
100
101} VBOXRAWPCIGLOBALS;
102
103DECLHIDDEN(int) vboxPciInit(PVBOXRAWPCIGLOBALS pGlobals);
104DECLHIDDEN(void) vboxPciShutdown(PVBOXRAWPCIGLOBALS pGlobals);
105
106DECLHIDDEN(int) vboxPciOsDevInit (PVBOXRAWPCIINS pIns, uint32_t fFlags);
107DECLHIDDEN(int) vboxPciOsDevDeinit(PVBOXRAWPCIINS pIns, uint32_t fFlags);
108
109DECLHIDDEN(int) vboxPciOsDevGetRegionInfo(PVBOXRAWPCIINS pIns,
110 int32_t iRegion,
111 RTHCPHYS *pRegionStart,
112 uint64_t *pu64RegionSize,
113 bool *pfPresent,
114 uint32_t *pfFlags);
115DECLHIDDEN(int) vboxPciOsDevMapRegion(PVBOXRAWPCIINS pIns,
116 int32_t iRegion,
117 RTHCPHYS pRegionStart,
118 uint64_t u64RegionSize,
119 uint32_t fFlags,
120 RTR0PTR *pRegionBase);
121DECLHIDDEN(int) vboxPciOsDevUnmapRegion(PVBOXRAWPCIINS pIns,
122 int32_t iRegion,
123 RTHCPHYS RegionStart,
124 uint64_t u64RegionSize,
125 RTR0PTR RegionBase);
126
127DECLHIDDEN(int) vboxPciOsDevPciCfgWrite(PVBOXRAWPCIINS pIns, uint32_t Register, PCIRAWMEMLOC *pValue);
128DECLHIDDEN(int) vboxPciOsDevPciCfgRead (PVBOXRAWPCIINS pIns, uint32_t Register, PCIRAWMEMLOC *pValue);
129
130DECLHIDDEN(int) vboxPciOsDevRegisterIrqHandler (PVBOXRAWPCIINS pIns, PFNRAWPCIISR pfnHandler, void* pIrqContext, int32_t *piHostIrq);
131DECLHIDDEN(int) vboxPciOsDevUnregisterIrqHandler(PVBOXRAWPCIINS pIns, int32_t iHostIrq);
132
133RT_C_DECLS_END
134
135#endif
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