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