]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/pci/pcie_port.h
Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging
[mirror_qemu.git] / include / hw / pci / pcie_port.h
CommitLineData
bc20ba98
IY
1/*
2 * pcie_port.h
3 *
4 * Copyright (c) 2010 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef QEMU_PCIE_PORT_H
22#define QEMU_PCIE_PORT_H
23
c759b24f 24#include "hw/pci/pci_bridge.h"
06aac7bd 25#include "hw/pci/pci_bus.h"
edf5ca5d 26#include "hw/pci/pci_device.h"
db1015e9 27#include "qom/object.h"
bc20ba98 28
bcb75750 29#define TYPE_PCIE_PORT "pcie-port"
8063396b 30OBJECT_DECLARE_SIMPLE_TYPE(PCIEPort, PCIE_PORT)
bcb75750 31
bc20ba98 32struct PCIEPort {
bcb75750
AF
33 /*< private >*/
34 PCIBridge parent_obj;
35 /*< public >*/
bc20ba98
IY
36
37 /* pci express switch port */
38 uint8_t port;
39};
40
41void pcie_port_init_reg(PCIDevice *d);
42
aa970ed5
JC
43PCIDevice *pcie_find_port_by_pn(PCIBus *bus, uint8_t pn);
44
bcb75750 45#define TYPE_PCIE_SLOT "pcie-slot"
8063396b 46OBJECT_DECLARE_SIMPLE_TYPE(PCIESlot, PCIE_SLOT)
bcb75750 47
bc20ba98 48struct PCIESlot {
bcb75750
AF
49 /*< private >*/
50 PCIEPort parent_obj;
51 /*< public >*/
bc20ba98
IY
52
53 /* pci express switch port with slot */
54 uint8_t chassis;
55 uint16_t slot;
ea8cfdb5
AW
56
57 PCIExpLinkSpeed speed;
58 PCIExpLinkWidth width;
59
a58dfba2
DDAG
60 /* Disable ACS (really for a pcie_root_port) */
61 bool disable_acs;
530a0963 62
3f3cbbb2 63 /* Indicates whether any type of hot-plug is allowed on the slot */
530a0963 64 bool hotplug;
3f3cbbb2 65
1d77e157
IM
66 /* broken ACPI hotplug compat knob to preserve 6.1 ABI intact */
67 bool hide_native_hotplug_cap;
3f3cbbb2 68
bc20ba98
IY
69 QLIST_ENTRY(PCIESlot) next;
70};
71
72void pcie_chassis_create(uint8_t chassis_number);
bc20ba98
IY
73PCIESlot *pcie_chassis_find_slot(uint8_t chassis, uint16_t slot);
74int pcie_chassis_add_slot(struct PCIESlot *slot);
75void pcie_chassis_del_slot(PCIESlot *s);
76
9d5154d7 77#define TYPE_PCIE_ROOT_PORT "pcie-root-port-base"
db1015e9 78typedef struct PCIERootPortClass PCIERootPortClass;
8110fa1d
EH
79DECLARE_CLASS_CHECKERS(PCIERootPortClass, PCIE_ROOT_PORT,
80 TYPE_PCIE_ROOT_PORT)
9d5154d7 81
db1015e9 82struct PCIERootPortClass {
9d5154d7 83 PCIDeviceClass parent_class;
226263fb 84 DeviceRealize parent_realize;
f4c636b0 85 ResettablePhases parent_phases;
9d5154d7
MA
86
87 uint8_t (*aer_vector)(const PCIDevice *dev);
88 int (*interrupts_init)(PCIDevice *dev, Error **errp);
89 void (*interrupts_uninit)(PCIDevice *dev);
90
91 int exp_offset;
92 int aer_offset;
93 int ssvid_offset;
e07fb4b5 94 int acs_offset; /* If nonzero, optional ACS capability offset */
9d5154d7 95 int ssid;
db1015e9 96};
9d5154d7 97
bc20ba98 98#endif /* QEMU_PCIE_PORT_H */