master
json 318 lines 8.84 KB
Raw
1 # -*- Mode: Python -*-
2 # vim: filetype=python
3 #
4 # This work is licensed under the terms of the GNU GPL, version 2 or later.
5 # See the COPYING file in the top-level directory.
6 # SPDX-License-Identifier: GPL-2.0-or-later
7
8 ##
9 # ***
10 # PCI
11 # ***
12 ##
13
14 ##
15 # @PciMemoryRange:
16 #
17 # A PCI device memory region
18 #
19 # @base: the starting address (guest physical)
20 #
21 # @limit: the ending address (guest physical)
22 #
23 # Since: 0.14
24 ##
25 { 'struct': 'PciMemoryRange', 'data': {'base': 'int', 'limit': 'int'} }
26
27 ##
28 # @PciMemoryRegion:
29 #
30 # Information about a PCI device I/O region.
31 #
32 # @bar: the index of the Base Address Register for this region
33 #
34 # @type:
35 # - 'io' if the region is a PIO region
36 # - 'memory' if the region is a MMIO region
37 #
38 # @address: memory address
39 #
40 # @size: memory size
41 #
42 # @prefetch: if @type is 'memory', true if the memory is prefetchable
43 #
44 # @mem_type_64: if @type is 'memory', true if the BAR is 64-bit
45 #
46 # Since: 0.14
47 ##
48 { 'struct': 'PciMemoryRegion',
49 'data': {'bar': 'int', 'type': 'str', 'address': 'int', 'size': 'int',
50 '*prefetch': 'bool', '*mem_type_64': 'bool' } }
51
52 ##
53 # @PciBusInfo:
54 #
55 # Information about a bus of a PCI Bridge device
56 #
57 # @number: primary bus interface number. This should be the number of
58 # the bus the device resides on.
59 #
60 # @secondary: secondary bus interface number. This is the number of
61 # the main bus for the bridge
62 #
63 # @subordinate: This is the highest number bus that resides below the
64 # bridge.
65 #
66 # @io_range: The PIO range for all devices on this bridge
67 #
68 # @memory_range: The MMIO range for all devices on this bridge
69 #
70 # @prefetchable_range: The range of prefetchable MMIO for all devices
71 # on this bridge
72 #
73 # Since: 2.4
74 ##
75 { 'struct': 'PciBusInfo',
76 'data': {'number': 'int', 'secondary': 'int', 'subordinate': 'int',
77 'io_range': 'PciMemoryRange',
78 'memory_range': 'PciMemoryRange',
79 'prefetchable_range': 'PciMemoryRange' } }
80
81 ##
82 # @PciBridgeInfo:
83 #
84 # Information about a PCI Bridge device
85 #
86 # @bus: information about the bus the device resides on
87 #
88 # @devices: a list of `PciDeviceInfo` for each device on this bridge
89 #
90 # Since: 0.14
91 ##
92 { 'struct': 'PciBridgeInfo',
93 'data': {'bus': 'PciBusInfo', '*devices': ['PciDeviceInfo']} }
94
95 ##
96 # @PciDeviceClass:
97 #
98 # Information about the Class of a PCI device
99 #
100 # @desc: a string description of the device's class (not stable, and
101 # should only be treated as informational)
102 #
103 # @class: the class code of the device
104 #
105 # Since: 2.4
106 ##
107 { 'struct': 'PciDeviceClass',
108 'data': {'*desc': 'str', 'class': 'int'} }
109
110 ##
111 # @PciDeviceId:
112 #
113 # Information about the Id of a PCI device
114 #
115 # @device: the PCI device id
116 #
117 # @vendor: the PCI vendor id
118 #
119 # @subsystem: the PCI subsystem id (since 3.1)
120 #
121 # @subsystem-vendor: the PCI subsystem vendor id (since 3.1)
122 #
123 # Since: 2.4
124 ##
125 { 'struct': 'PciDeviceId',
126 'data': {'device': 'int', 'vendor': 'int', '*subsystem': 'int',
127 '*subsystem-vendor': 'int'} }
128
129 ##
130 # @PciDeviceInfo:
131 #
132 # Information about a PCI device
133 #
134 # @bus: the bus number of the device
135 #
136 # @slot: the slot the device is located in
137 #
138 # @function: the function of the slot used by the device
139 #
140 # @class_info: the class of the device
141 #
142 # @id: the PCI device id
143 #
144 # @irq: if an IRQ is assigned to the device, the IRQ number
145 #
146 # @irq_pin: the IRQ pin, zero means no IRQ (since 5.1)
147 #
148 # @qdev_id: the device name of the PCI device
149 #
150 # @pci_bridge: if the device is a PCI bridge, the bridge information
151 #
152 # @regions: a list of the PCI I/O regions associated with the device
153 #
154 # Since: 0.14
155 ##
156 { 'struct': 'PciDeviceInfo',
157 'data': {'bus': 'int', 'slot': 'int', 'function': 'int',
158 'class_info': 'PciDeviceClass', 'id': 'PciDeviceId',
159 '*irq': 'int', 'irq_pin': 'int', 'qdev_id': 'str',
160 '*pci_bridge': 'PciBridgeInfo', 'regions': ['PciMemoryRegion'] }}
161
162 ##
163 # @PciInfo:
164 #
165 # Information about a PCI bus
166 #
167 # @bus: the bus index
168 #
169 # @devices: a list of devices on this bus
170 #
171 # Since: 0.14
172 ##
173 { 'struct': 'PciInfo', 'data': {'bus': 'int', 'devices': ['PciDeviceInfo']} }
174
175 ##
176 # @query-pci:
177 #
178 # Return information about the PCI bus topology of the guest.
179 #
180 # Returns: a list of info for each PCI bus. Each bus is
181 # represented by a json-object, which has a key with a json-array
182 # of all PCI devices attached to it. Each device is represented
183 # by a json-object.
184 #
185 # Since: 0.14
186 #
187 # .. qmp-example::
188 #
189 # -> { "execute": "query-pci" }
190 # <- { "return": [
191 # {
192 # "bus": 0,
193 # "devices": [
194 # {
195 # "bus": 0,
196 # "qdev_id": "",
197 # "slot": 0,
198 # "class_info": {
199 # "class": 1536,
200 # "desc": "Host bridge"
201 # },
202 # "id": {
203 # "device": 32902,
204 # "vendor": 4663
205 # },
206 # "function": 0,
207 # "regions": [
208 # ]
209 # },
210 # {
211 # "bus": 0,
212 # "qdev_id": "",
213 # "slot": 1,
214 # "class_info": {
215 # "class": 1537,
216 # "desc": "ISA bridge"
217 # },
218 # "id": {
219 # "device": 32902,
220 # "vendor": 28672
221 # },
222 # "function": 0,
223 # "regions": [
224 # ]
225 # },
226 # {
227 # "bus": 0,
228 # "qdev_id": "",
229 # "slot": 1,
230 # "class_info": {
231 # "class": 257,
232 # "desc": "IDE controller"
233 # },
234 # "id": {
235 # "device": 32902,
236 # "vendor": 28688
237 # },
238 # "function": 1,
239 # "regions": [
240 # {
241 # "bar": 4,
242 # "size": 16,
243 # "address": 49152,
244 # "type": "io"
245 # }
246 # ]
247 # },
248 # {
249 # "bus": 0,
250 # "qdev_id": "",
251 # "slot": 2,
252 # "class_info": {
253 # "class": 768,
254 # "desc": "VGA controller"
255 # },
256 # "id": {
257 # "device": 4115,
258 # "vendor": 184
259 # },
260 # "function": 0,
261 # "regions": [
262 # {
263 # "prefetch": true,
264 # "mem_type_64": false,
265 # "bar": 0,
266 # "size": 33554432,
267 # "address": 4026531840,
268 # "type": "memory"
269 # },
270 # {
271 # "prefetch": false,
272 # "mem_type_64": false,
273 # "bar": 1,
274 # "size": 4096,
275 # "address": 4060086272,
276 # "type": "memory"
277 # },
278 # {
279 # "prefetch": false,
280 # "mem_type_64": false,
281 # "bar": 6,
282 # "size": 65536,
283 # "address": -1,
284 # "type": "memory"
285 # }
286 # ]
287 # },
288 # {
289 # "bus": 0,
290 # "qdev_id": "",
291 # "irq": 11,
292 # "slot": 4,
293 # "class_info": {
294 # "class": 1280,
295 # "desc": "RAM controller"
296 # },
297 # "id": {
298 # "device": 6900,
299 # "vendor": 4098
300 # },
301 # "function": 0,
302 # "regions": [
303 # {
304 # "bar": 0,
305 # "size": 32,
306 # "address": 49280,
307 # "type": "io"
308 # }
309 # ]
310 # }
311 # ]
312 # }
313 # ]
314 # }
315 #
316 # This example has been shortened as the real response is too long.
317 ##
318 { 'command': 'query-pci', 'returns': ['PciInfo'] }