VirtualBox

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

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

PCI: more raw and 64-bit BARs coding

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1/* $Id: VBoxPciInternal.h 36153 2011-03-03 16:14:59Z 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} VBOXRAWPCIINS;
68
69/**
70 * The global data of the VBox PCI driver.
71 *
72 * This contains the bit required for communicating with support driver, VBoxDrv
73 * (start out as SupDrv).
74 */
75typedef struct VBOXRAWPCIGLOBALS
76{
77 /** Mutex protecting the list of instances and state changes. */
78 RTSEMFASTMUTEX hFastMtx;
79
80 /** Pointer to a list of instance data. */
81 PVBOXRAWPCIINS pInstanceHead;
82
83 /** The raw PCI interface factory. */
84 RAWPCIFACTORY RawPciFactory;
85 /** The SUPDRV component factory registration. */
86 SUPDRVFACTORY SupDrvFactory;
87 /** The number of current factory references. */
88 int32_t volatile cFactoryRefs;
89 /** Whether the IDC connection is open or not.
90 * This is only for cleaning up correctly after the separate IDC init on Windows. */
91 bool fIDCOpen;
92 /** The SUPDRV IDC handle (opaque struct). */
93 SUPDRVIDCHANDLE SupDrvIDC;
94#ifdef RT_OS_LINUX
95 struct module * pciStubModule;
96#endif
97
98} VBOXRAWPCIGLOBALS;
99
100DECLHIDDEN(int) vboxPciInit(PVBOXRAWPCIGLOBALS pGlobals);
101DECLHIDDEN(void) vboxPciShutdown(PVBOXRAWPCIGLOBALS pGlobals);
102
103DECLHIDDEN(int) vboxPciOsDevInit (PVBOXRAWPCIINS pIns, uint32_t fFlags);
104DECLHIDDEN(int) vboxPciOsDevDeinit(PVBOXRAWPCIINS pIns, uint32_t fFlags);
105DECLHIDDEN(int) vboxPciOsDevGetRegionInfo(PVBOXRAWPCIINS pIns,
106 int32_t iRegion,
107 RTHCPHYS *pRegionStart,
108 uint64_t *pu64RegionSize,
109 bool *pfPresent,
110 uint32_t *pfFlags);
111DECLHIDDEN(int) vboxPciOsDevMapRegion(PVBOXRAWPCIINS pIns,
112 int32_t iRegion,
113 RTHCPHYS pRegionStart,
114 uint64_t u64RegionSize,
115 uint32_t fFlags,
116 RTR0PTR *pRegionBase);
117DECLHIDDEN(int) vboxPciOsDevUnmapRegion(PVBOXRAWPCIINS pIns,
118 int32_t iRegion,
119 RTHCPHYS RegionStart,
120 uint64_t u64RegionSize,
121 RTR0PTR RegionBase);
122DECLHIDDEN(int) vboxPciOsDevPciCfgWrite(PVBOXRAWPCIINS pIns, uint32_t Register, PCIRAWMEMLOC *pValue);
123DECLHIDDEN(int) vboxPciOsDevPciCfgRead (PVBOXRAWPCIINS pIns, uint32_t Register, PCIRAWMEMLOC *pValue);
124
125RT_C_DECLS_END
126
127#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