1 | /** @file
|
---|
2 | * PDM - Pluggable Device Manager, raw PCI Devices. (VMM)
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2010-2011 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_rawpci_h
|
---|
27 | #define ___VBox_rawpci_h
|
---|
28 |
|
---|
29 | #include <iprt/types.h>
|
---|
30 |
|
---|
31 |
|
---|
32 | RT_C_DECLS_BEGIN
|
---|
33 |
|
---|
34 | /** Parameters buffer for PCIRAWR0_DO_GET_REGION_INFO call */
|
---|
35 | typedef struct
|
---|
36 | {
|
---|
37 | /* in */
|
---|
38 | int32_t iRegion;
|
---|
39 | /* out */
|
---|
40 | RTHCPHYS RegionStart;
|
---|
41 | uint64_t u64RegionSize;
|
---|
42 | bool fPresent;
|
---|
43 | bool fMmio;
|
---|
44 | } PCIRAWREQGETREGIONINFO;
|
---|
45 |
|
---|
46 | /** Parameters buffer for PCIRAWR0_DO_MAP_REGION call. */
|
---|
47 | typedef struct
|
---|
48 | {
|
---|
49 | /* in */
|
---|
50 | RTHCPHYS StartAddress;
|
---|
51 | uint64_t iRegionSize;
|
---|
52 | uint32_t fFlags;
|
---|
53 | /* out */
|
---|
54 | RTR3PTR pvAddressR3;
|
---|
55 | RTR0PTR pvAddressR0;
|
---|
56 | } PCIRAWREQMAPREGION;
|
---|
57 |
|
---|
58 | /** Parameters buffer for PCIRAWR0_DO_UNMAP_REGION call. */
|
---|
59 | typedef struct
|
---|
60 | {
|
---|
61 | /* in */
|
---|
62 | RTR3PTR pvAddressR3;
|
---|
63 | RTR0PTR pvAddressR0;
|
---|
64 | } PCIRAWREQUNMAPREGION;
|
---|
65 |
|
---|
66 | /** Parameters buffer for PCIRAWR0_DO_PIO_WRITE call. */
|
---|
67 | typedef struct
|
---|
68 | {
|
---|
69 | /* in */
|
---|
70 | uint16_t iPort;
|
---|
71 | uint16_t cb;
|
---|
72 | uint32_t iValue;
|
---|
73 | } PCIRAWREQPIOWRITE;
|
---|
74 |
|
---|
75 | /** Parameters buffer for PCIRAWR0_DO_PIO_READ call. */
|
---|
76 | typedef struct
|
---|
77 | {
|
---|
78 | /* in */
|
---|
79 | uint16_t iPort;
|
---|
80 | uint16_t cb;
|
---|
81 | /* out */
|
---|
82 | uint32_t iValue;
|
---|
83 | } PCIRAWREQPIOREAD;
|
---|
84 |
|
---|
85 | /** Memory operand. */
|
---|
86 | typedef struct
|
---|
87 | {
|
---|
88 | union
|
---|
89 | {
|
---|
90 | uint8_t u8;
|
---|
91 | uint16_t u16;
|
---|
92 | uint32_t u32;
|
---|
93 | uint64_t u64;
|
---|
94 | } u;
|
---|
95 | uint8_t cb;
|
---|
96 | } PCIRAWMEMLOC;
|
---|
97 |
|
---|
98 | /** Parameters buffer for PCIRAWR0_DO_MMIO_WRITE call. */
|
---|
99 | typedef struct
|
---|
100 | {
|
---|
101 | /* in */
|
---|
102 | RTGCPHYS Address;
|
---|
103 | PCIRAWMEMLOC Value;
|
---|
104 | } PCIRAWREQMMIOWRITE;
|
---|
105 |
|
---|
106 | /** Parameters buffer for PCIRAWR0_DO_MMIO_READ call. */
|
---|
107 | typedef struct
|
---|
108 | {
|
---|
109 | /* in */
|
---|
110 | RTGCPHYS Address;
|
---|
111 | /* inout (Value.cb is in) */
|
---|
112 | PCIRAWMEMLOC Value;
|
---|
113 | } PCIRAWREQMMIOREAD;
|
---|
114 |
|
---|
115 | /* Parameters buffer for PCIRAWR0_DO_PCICFG_WRITE call. */
|
---|
116 | typedef struct
|
---|
117 | {
|
---|
118 | /* in */
|
---|
119 | uint32_t iOffset;
|
---|
120 | PCIRAWMEMLOC Value;
|
---|
121 | } PCIRAWREQPCICFGWRITE;
|
---|
122 |
|
---|
123 | /** Parameters buffer for PCIRAWR0_DO_PCICFG_READ call. */
|
---|
124 | typedef struct
|
---|
125 | {
|
---|
126 | /* in */
|
---|
127 | uint32_t iOffset;
|
---|
128 | /* inout (Value.cb is in) */
|
---|
129 | PCIRAWMEMLOC Value;
|
---|
130 | } PCIRAWREQPCICFGREAD;
|
---|
131 |
|
---|
132 | /**
|
---|
133 | * Request buffer use for communication with the driver.
|
---|
134 | */
|
---|
135 | typedef struct PCIRAWSENDREQ
|
---|
136 | {
|
---|
137 | /** The request header. */
|
---|
138 | SUPVMMR0REQHDR Hdr;
|
---|
139 | /** Alternative to passing the taking the session from the VM handle.
|
---|
140 | * Either use this member or use the VM handle, don't do both.
|
---|
141 | */
|
---|
142 | PSUPDRVSESSION pSession;
|
---|
143 | /** Request type. */
|
---|
144 | int32_t iRequest;
|
---|
145 | /** Host device request targetted to. */
|
---|
146 | uint32_t TargetDevice;
|
---|
147 | /** Call parameters. */
|
---|
148 | union
|
---|
149 | {
|
---|
150 | PCIRAWREQGETREGIONINFO aGetRegionInfo;
|
---|
151 | PCIRAWREQMAPREGION aMapRegion;
|
---|
152 | PCIRAWREQUNMAPREGION aUnmapRegion;
|
---|
153 | PCIRAWREQPIOWRITE aPioWrite;
|
---|
154 | PCIRAWREQPIOREAD aPioRead;
|
---|
155 | PCIRAWREQMMIOWRITE aMmioWrite;
|
---|
156 | PCIRAWREQMMIOREAD aMmioRead;
|
---|
157 | PCIRAWREQPCICFGWRITE aPciCfgWrite;
|
---|
158 | PCIRAWREQPCICFGREAD aPciCfgRead;
|
---|
159 | } u;
|
---|
160 | } PCIRAWSENDREQ;
|
---|
161 | typedef PCIRAWSENDREQ *PPCIRAWSENDREQ;
|
---|
162 |
|
---|
163 |
|
---|
164 | /**
|
---|
165 | * Operations performed by the driver.
|
---|
166 | */
|
---|
167 | typedef enum PCIRAWR0OPERATION
|
---|
168 | {
|
---|
169 | /* Get PCI region info. */
|
---|
170 | PCIRAWR0_DO_GET_REGION_INFO,
|
---|
171 | /* Map PCI region into VM address space. */
|
---|
172 | PCIRAWR0_DO_MAP_REGION,
|
---|
173 | /* Unmap PCI region from VM address space. */
|
---|
174 | PCIRAWR0_DO_UNMAP_REGION,
|
---|
175 | /* Perform PIO write. */
|
---|
176 | PCIRAWR0_DO_PIO_WRITE,
|
---|
177 | /* Perform PIO read. */
|
---|
178 | PCIRAWR0_DO_PIO_READ,
|
---|
179 | /* Perform MMIO write. */
|
---|
180 | PCIRAWR0_DO_MMIO_WRITE,
|
---|
181 | /* Perform MMIO read. */
|
---|
182 | PCIRAWR0_DO_MMIO_READ,
|
---|
183 | /* Perform PCI config write. */
|
---|
184 | PCIRAWR0_DO_PCICFG_WRITE,
|
---|
185 | /* Perform PCI config read. */
|
---|
186 | PCIRAWR0_DO_PCICFG_READ,
|
---|
187 | /** The usual 32-bit type blow up. */
|
---|
188 | PCIRAWR0_DO_32BIT_HACK = 0x7fffffff
|
---|
189 | } PCIRAWR0OPERATION;
|
---|
190 |
|
---|
191 | RT_C_DECLS_END
|
---|
192 |
|
---|
193 | #endif
|
---|