Merge remote-tracking branch 'remotes/nvme/tags/nvme-fixes-20210407-pull-request...
[qemu/ar7.git] / qapi / pci.json
blobee7c659feccfcf10e0651f57fd815d3895e38c24
1 # -*- Mode: Python -*-
2 # vim: filetype=python
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
8 ##
9 # = PCI
13 # @PciMemoryRange:
15 # A PCI device memory region
17 # @base: the starting address (guest physical)
19 # @limit: the ending address (guest physical)
21 # Since: 0.14
23 { 'struct': 'PciMemoryRange', 'data': {'base': 'int', 'limit': 'int'} }
26 # @PciMemoryRegion:
28 # Information about a PCI device I/O region.
30 # @bar: the index of the Base Address Register for this region
32 # @type: - 'io' if the region is a PIO region
33 #        - 'memory' if the region is a MMIO region
35 # @size: memory size
37 # @prefetch: if @type is 'memory', true if the memory is prefetchable
39 # @mem_type_64: if @type is 'memory', true if the BAR is 64-bit
41 # Since: 0.14
43 { 'struct': 'PciMemoryRegion',
44   'data': {'bar': 'int', 'type': 'str', 'address': 'int', 'size': 'int',
45            '*prefetch': 'bool', '*mem_type_64': 'bool' } }
48 # @PciBusInfo:
50 # Information about a bus of a PCI Bridge device
52 # @number: primary bus interface number.  This should be the number of the
53 #          bus the device resides on.
55 # @secondary: secondary bus interface number.  This is the number of the
56 #             main bus for the bridge
58 # @subordinate: This is the highest number bus that resides below the
59 #               bridge.
61 # @io_range: The PIO range for all devices on this bridge
63 # @memory_range: The MMIO range for all devices on this bridge
65 # @prefetchable_range: The range of prefetchable MMIO for all devices on
66 #                      this bridge
68 # Since: 2.4
70 { 'struct': 'PciBusInfo',
71   'data': {'number': 'int', 'secondary': 'int', 'subordinate': 'int',
72            'io_range': 'PciMemoryRange',
73            'memory_range': 'PciMemoryRange',
74            'prefetchable_range': 'PciMemoryRange' } }
77 # @PciBridgeInfo:
79 # Information about a PCI Bridge device
81 # @bus: information about the bus the device resides on
83 # @devices: a list of @PciDeviceInfo for each device on this bridge
85 # Since: 0.14
87 { 'struct': 'PciBridgeInfo',
88   'data': {'bus': 'PciBusInfo', '*devices': ['PciDeviceInfo']} }
91 # @PciDeviceClass:
93 # Information about the Class of a PCI device
95 # @desc: a string description of the device's class
97 # @class: the class code of the device
99 # Since: 2.4
101 { 'struct': 'PciDeviceClass',
102   'data': {'*desc': 'str', 'class': 'int'} }
105 # @PciDeviceId:
107 # Information about the Id of a PCI device
109 # @device: the PCI device id
111 # @vendor: the PCI vendor id
113 # @subsystem: the PCI subsystem id (since 3.1)
115 # @subsystem-vendor: the PCI subsystem vendor id (since 3.1)
117 # Since: 2.4
119 { 'struct': 'PciDeviceId',
120   'data': {'device': 'int', 'vendor': 'int', '*subsystem': 'int',
121             '*subsystem-vendor': 'int'} }
124 # @PciDeviceInfo:
126 # Information about a PCI device
128 # @bus: the bus number of the device
130 # @slot: the slot the device is located in
132 # @function: the function of the slot used by the device
134 # @class_info: the class of the device
136 # @id: the PCI device id
138 # @irq: if an IRQ is assigned to the device, the IRQ number
140 # @irq_pin: the IRQ pin, zero means no IRQ (since 5.1)
142 # @qdev_id: the device name of the PCI device
144 # @pci_bridge: if the device is a PCI bridge, the bridge information
146 # @regions: a list of the PCI I/O regions associated with the device
148 # Notes: the contents of @class_info.desc are not stable and should only be
149 #        treated as informational.
151 # Since: 0.14
153 { 'struct': 'PciDeviceInfo',
154   'data': {'bus': 'int', 'slot': 'int', 'function': 'int',
155            'class_info': 'PciDeviceClass', 'id': 'PciDeviceId',
156            '*irq': 'int', 'irq_pin': 'int', 'qdev_id': 'str',
157            '*pci_bridge': 'PciBridgeInfo', 'regions': ['PciMemoryRegion'] }}
160 # @PciInfo:
162 # Information about a PCI bus
164 # @bus: the bus index
166 # @devices: a list of devices on this bus
168 # Since: 0.14
170 { 'struct': 'PciInfo', 'data': {'bus': 'int', 'devices': ['PciDeviceInfo']} }
173 # @query-pci:
175 # Return information about the PCI bus topology of the guest.
177 # Returns: a list of @PciInfo for each PCI bus. Each bus is
178 #          represented by a json-object, which has a key with a json-array of
179 #          all PCI devices attached to it. Each device is represented by a
180 #          json-object.
182 # Since: 0.14
184 # Example:
186 # -> { "execute": "query-pci" }
187 # <- { "return": [
188 #          {
189 #             "bus": 0,
190 #             "devices": [
191 #                {
192 #                   "bus": 0,
193 #                   "qdev_id": "",
194 #                   "slot": 0,
195 #                   "class_info": {
196 #                      "class": 1536,
197 #                      "desc": "Host bridge"
198 #                   },
199 #                   "id": {
200 #                      "device": 32902,
201 #                      "vendor": 4663
202 #                   },
203 #                   "function": 0,
204 #                   "regions": [
205 #                   ]
206 #                },
207 #                {
208 #                   "bus": 0,
209 #                   "qdev_id": "",
210 #                   "slot": 1,
211 #                   "class_info": {
212 #                      "class": 1537,
213 #                      "desc": "ISA bridge"
214 #                   },
215 #                   "id": {
216 #                      "device": 32902,
217 #                      "vendor": 28672
218 #                   },
219 #                   "function": 0,
220 #                   "regions": [
221 #                   ]
222 #                },
223 #                {
224 #                   "bus": 0,
225 #                   "qdev_id": "",
226 #                   "slot": 1,
227 #                   "class_info": {
228 #                      "class": 257,
229 #                      "desc": "IDE controller"
230 #                   },
231 #                   "id": {
232 #                      "device": 32902,
233 #                      "vendor": 28688
234 #                   },
235 #                   "function": 1,
236 #                   "regions": [
237 #                      {
238 #                         "bar": 4,
239 #                         "size": 16,
240 #                         "address": 49152,
241 #                         "type": "io"
242 #                      }
243 #                   ]
244 #                },
245 #                {
246 #                   "bus": 0,
247 #                   "qdev_id": "",
248 #                   "slot": 2,
249 #                   "class_info": {
250 #                      "class": 768,
251 #                      "desc": "VGA controller"
252 #                   },
253 #                   "id": {
254 #                      "device": 4115,
255 #                      "vendor": 184
256 #                   },
257 #                   "function": 0,
258 #                   "regions": [
259 #                      {
260 #                         "prefetch": true,
261 #                         "mem_type_64": false,
262 #                         "bar": 0,
263 #                         "size": 33554432,
264 #                         "address": 4026531840,
265 #                         "type": "memory"
266 #                      },
267 #                      {
268 #                         "prefetch": false,
269 #                         "mem_type_64": false,
270 #                         "bar": 1,
271 #                         "size": 4096,
272 #                         "address": 4060086272,
273 #                         "type": "memory"
274 #                      },
275 #                      {
276 #                         "prefetch": false,
277 #                         "mem_type_64": false,
278 #                         "bar": 6,
279 #                         "size": 65536,
280 #                         "address": -1,
281 #                         "type": "memory"
282 #                      }
283 #                   ]
284 #                },
285 #                {
286 #                   "bus": 0,
287 #                   "qdev_id": "",
288 #                   "irq": 11,
289 #                   "slot": 4,
290 #                   "class_info": {
291 #                      "class": 1280,
292 #                      "desc": "RAM controller"
293 #                   },
294 #                   "id": {
295 #                      "device": 6900,
296 #                      "vendor": 4098
297 #                   },
298 #                   "function": 0,
299 #                   "regions": [
300 #                      {
301 #                         "bar": 0,
302 #                         "size": 32,
303 #                         "address": 49280,
304 #                         "type": "io"
305 #                      }
306 #                   ]
307 #                }
308 #             ]
309 #          }
310 #       ]
311 #    }
313 # Note: This example has been shortened as the real response is too long.
316 { 'command': 'query-pci', 'returns': ['PciInfo'] }