VirtualBox

source: vbox/trunk/include/VBox/vmm/pdmpcidevint.h@ 65572

Last change on this file since 65572 was 65101, checked in by vboxsync, 8 years ago

Devices: doxygen fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.6 KB
Line 
1/* $Id: pdmpcidevint.h 65101 2017-01-04 12:07:43Z vboxsync $ */
2/** @file
3 * DevPCI - PDM PCI Internal header - Only for hiding bits of PDMPCIDEV.
4 */
5
6/*
7 * Copyright (C) 2006-2016 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 ___VBox_vmm_pdmpcidevint_h
19#define ___VBox_vmm_pdmpcidevint_h
20
21#include <VBox/vmm/pdmdev.h>
22
23/** @defgroup grp_pdm_pcidev_int The PDM PCI Device Internals
24 * @ingroup grp_pdm_pcidev
25 *
26 * @remarks The PDM PCI device internals are visible to both PDM and the PCI Bus
27 * implementation, thus it lives among the the public headers despite
28 * being rather private and internal.
29 *
30 * @{
31 */
32
33
34/**
35 * PCI I/O region.
36 */
37typedef struct PCIIOREGION
38{
39 /** Current PCI mapping address, 0xffffffff means not mapped. */
40 uint64_t addr;
41 uint64_t size;
42 uint8_t type; /* PCIADDRESSSPACE */
43 uint8_t padding[HC_ARCH_BITS == 32 ? 3 : 7];
44 /** Callback called when the region is mapped. */
45 R3PTRTYPE(PFNPCIIOREGIONMAP) map_func;
46} PCIIOREGION, PCIIORegion;
47/** Pointer to PCI I/O region. */
48typedef PCIIOREGION *PPCIIOREGION;
49
50/**
51 * Callback function for reading from the PCI configuration space.
52 *
53 * @returns The register value.
54 * @param pDevIns Pointer to the device instance of the PCI bus.
55 * @param iBus The bus number this device is on.
56 * @param iDevice The number of the device on the bus.
57 * @param u32Address The configuration space register address. [0..255]
58 * @param cb The register size. [1,2,4]
59 */
60typedef DECLCALLBACK(uint32_t) FNPCIBRIDGECONFIGREAD(PPDMDEVINSR3 pDevIns, uint8_t iBus, uint8_t iDevice, uint32_t u32Address, unsigned cb);
61/** Pointer to a FNPCICONFIGREAD() function. */
62typedef FNPCIBRIDGECONFIGREAD *PFNPCIBRIDGECONFIGREAD;
63/** Pointer to a PFNPCICONFIGREAD. */
64typedef PFNPCIBRIDGECONFIGREAD *PPFNPCIBRIDGECONFIGREAD;
65
66/**
67 * Callback function for writing to the PCI configuration space.
68 *
69 * @param pDevIns Pointer to the device instance of the PCI bus.
70 * @param iBus The bus number this device is on.
71 * @param iDevice The number of the device on the bus.
72 * @param u32Address The configuration space register address. [0..255]
73 * @param u32Value The value that's being written. The number of bits actually used from
74 * this value is determined by the cb parameter.
75 * @param cb The register size. [1,2,4]
76 */
77typedef DECLCALLBACK(void) FNPCIBRIDGECONFIGWRITE(PPDMDEVINSR3 pDevIns, uint8_t iBus, uint8_t iDevice, uint32_t u32Address, uint32_t u32Value, unsigned cb);
78/** Pointer to a FNPCICONFIGWRITE() function. */
79typedef FNPCIBRIDGECONFIGWRITE *PFNPCIBRIDGECONFIGWRITE;
80/** Pointer to a PFNPCICONFIGWRITE. */
81typedef PFNPCIBRIDGECONFIGWRITE *PPFNPCIBRIDGECONFIGWRITE;
82
83/* Forward declaration */
84struct DEVPCIBUS;
85
86enum {
87 /** Flag whether the device is a pci-to-pci bridge.
88 * This is set prior to device registration. */
89 PCIDEV_FLAG_PCI_TO_PCI_BRIDGE = RT_BIT_32(1),
90 /** Flag whether the device is a PCI Express device.
91 * This is set prior to device registration. */
92 PCIDEV_FLAG_PCI_EXPRESS_DEVICE = RT_BIT_32(2),
93 /** Flag whether the device is capable of MSI.
94 * This one is set by MsiInit(). */
95 PCIDEV_FLAG_MSI_CAPABLE = RT_BIT_32(3),
96 /** Flag whether the device is capable of MSI-X.
97 * This one is set by MsixInit(). */
98 PCIDEV_FLAG_MSIX_CAPABLE = RT_BIT_32(4),
99 /** Flag if device represents real physical device in passthrough mode. */
100 PCIDEV_FLAG_PASSTHROUGH = RT_BIT_32(5),
101 /** Flag whether the device is capable of MSI using 64-bit address. */
102 PCIDEV_FLAG_MSI64_CAPABLE = RT_BIT_32(6)
103
104};
105
106
107/**
108 * PDM PCI Device - Internal data.
109 *
110 * @sa PDMPCIDEV
111 */
112typedef struct PDMPCIDEVINT
113{
114 /** @name Owned by PDM.
115 * @remarks The bus may use the device instance pointers.
116 * @{
117 */
118 /** Pointer to the PDM device the PCI device belongs to. (R3 ptr) */
119 PPDMDEVINSR3 pDevInsR3;
120 /** Pointer to the next PDM device associate with the PDM device. (R3 ptr) */
121 R3PTRTYPE(PPDMPCIDEV) pNextR3;
122 /** Pointer to the internal PDM PCI bus for the device. (R3 ptr) */
123 R3PTRTYPE(struct PDMPCIBUS *) pPdmBusR3;
124
125 /** Pointer to the PDM device the PCI device belongs to. (R0 ptr) */
126 PPDMDEVINSR0 pDevInsR0;
127 /** Pointer to the next PDM device associate with the PDM device. (R0 ptr) */
128 R0PTRTYPE(PPDMPCIDEV) pNextR0;
129 /** Pointer to the internal PDM PCI bus for the device. (R0 ptr) */
130 R0PTRTYPE(struct PDMPCIBUS *) pPdmBusR0;
131
132 /** Pointer to the PDM device the PCI device belongs to. (RC ptr) */
133 PPDMDEVINSRC pDevInsRC;
134 /** Pointer to the next PDM device associate with the PDM device. (RC ptr) */
135 RCPTRTYPE(PPDMPCIDEV) pNextRC;
136 /** Pointer to the internal PDM PCI bus for the device. (RC ptr) */
137 RCPTRTYPE(struct PDMPCIBUS *) pPdmBusRC;
138
139 /** The CFGM device configuration index (default, PciDev1..255).
140 * This also works as the internal sub-device ordinal with MMIOEx. */
141 uint8_t idxDevCfg;
142 /** Set if the it can be reassigned to a different PCI device number. */
143 bool fReassignableDevNo;
144 /** Set if the it can be reassigned to a different PCI function number. */
145 bool fReassignableFunNo;
146 /** Alignment padding. */
147 uint8_t bPadding0;
148 /** @} */
149
150 /** @name Owned by the PCI Bus
151 * @remarks PDM will not touch anything here (includes not relocating anything).
152 * @{
153 */
154 /** Pointer to the PCI bus of the device. (R3 ptr) */
155 R3PTRTYPE(struct DEVPCIBUS *) pBusR3;
156 /** Page used for MSI-X state. (R3 ptr) */
157 R3PTRTYPE(void *) pMsixPageR3;
158 /** Read config callback. */
159 R3PTRTYPE(PFNPCICONFIGREAD) pfnConfigRead;
160 /** Write config callback. */
161 R3PTRTYPE(PFNPCICONFIGWRITE) pfnConfigWrite;
162 /** Read config callback for PCI bridges to pass requests
163 * to devices on another bus. */
164 R3PTRTYPE(PFNPCIBRIDGECONFIGREAD) pfnBridgeConfigRead;
165 /** Write config callback for PCI bridges to pass requests
166 * to devices on another bus. */
167 R3PTRTYPE(PFNPCIBRIDGECONFIGWRITE) pfnBridgeConfigWrite;
168
169 /** Pointer to the PCI bus of the device. (R0 ptr) */
170 R0PTRTYPE(struct DEVPCIBUS *) pBusR0;
171 /** Page used for MSI-X state. (R0 ptr) */
172 R0PTRTYPE(void *) pMsixPageR0;
173
174 /** Pointer to the PCI bus of the device. (RC ptr) */
175 RCPTRTYPE(struct DEVPCIBUS *) pBusRC;
176 /** Page used for MSI-X state. (RC ptr) */
177 RCPTRTYPE(void *) pMsixPageRC;
178
179 /** Flags of this PCI device, see PCIDEV_FLAG_XXX constants. */
180 uint32_t fFlags;
181 /** Current state of the IRQ pin of the device. */
182 int32_t uIrqPinState;
183
184 /** Offset of MSI PCI capability in config space, or 0.
185 * @todo fix non-standard naming. */
186 uint8_t u8MsiCapOffset;
187 /** Size of MSI PCI capability in config space, or 0.
188 * @todo fix non-standard naming. */
189 uint8_t u8MsiCapSize;
190 /** Offset of MSI-X PCI capability in config space, or 0.
191 * @todo fix non-standard naming. */
192 uint8_t u8MsixCapOffset;
193 /** Size of MSI-X PCI capability in config space, or 0.
194 * @todo fix non-standard naming. */
195 uint8_t u8MsixCapSize;
196#if HC_ARCH_BITS == 64
197 /** Explicit alignment padding. */
198 uint8_t abPadding1[HC_ARCH_BITS == 32 ? 0 : 4];
199#endif
200
201 /** Pointer to bus specific data. (R3 ptr) */
202 R3PTRTYPE(const void *) pPciBusPtrR3;
203
204 /** I/O regions. */
205 PCIIOREGION aIORegions[VBOX_PCI_NUM_REGIONS];
206 /** @} */
207} PDMPCIDEVINT;
208AssertCompileMemberAlignment(PDMPCIDEVINT, aIORegions, 8);
209AssertCompileSize(PDMPCIDEVINT, HC_ARCH_BITS == 32 ? 264 : 384);
210
211/** Indicate that PDMPCIDEV::Int.s can be declared. */
212#define PDMPCIDEVINT_DECLARED
213
214/** @} */
215
216#endif
217
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