4 * Copyright (c) 2010 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
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.
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.
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/>.
21 #ifndef QEMU_PCIE_PORT_H
22 #define QEMU_PCIE_PORT_H
24 #include "hw/pci/pci_bridge.h"
25 #include "hw/pci/pci_bus.h"
27 #define TYPE_PCIE_PORT "pcie-port"
28 #define PCIE_PORT(obj) OBJECT_CHECK(PCIEPort, (obj), TYPE_PCIE_PORT)
35 /* pci express switch port */
39 void pcie_port_init_reg(PCIDevice
*d
);
41 #define TYPE_PCIE_SLOT "pcie-slot"
42 #define PCIE_SLOT(obj) OBJECT_CHECK(PCIESlot, (obj), TYPE_PCIE_SLOT)
49 /* pci express switch port with slot */
53 PCIExpLinkSpeed speed
;
54 PCIExpLinkWidth width
;
56 /* Disable ACS (really for a pcie_root_port) */
59 /* Indicates whether hot-plug is enabled on the slot */
61 QLIST_ENTRY(PCIESlot
) next
;
64 void pcie_chassis_create(uint8_t chassis_number
);
65 PCIESlot
*pcie_chassis_find_slot(uint8_t chassis
, uint16_t slot
);
66 int pcie_chassis_add_slot(struct PCIESlot
*slot
);
67 void pcie_chassis_del_slot(PCIESlot
*s
);
69 #define TYPE_PCIE_ROOT_PORT "pcie-root-port-base"
70 #define PCIE_ROOT_PORT_CLASS(klass) \
71 OBJECT_CLASS_CHECK(PCIERootPortClass, (klass), TYPE_PCIE_ROOT_PORT)
72 #define PCIE_ROOT_PORT_GET_CLASS(obj) \
73 OBJECT_GET_CLASS(PCIERootPortClass, (obj), TYPE_PCIE_ROOT_PORT)
75 typedef struct PCIERootPortClass
{
76 PCIDeviceClass parent_class
;
77 DeviceRealize parent_realize
;
78 DeviceReset parent_reset
;
80 uint8_t (*aer_vector
)(const PCIDevice
*dev
);
81 int (*interrupts_init
)(PCIDevice
*dev
, Error
**errp
);
82 void (*interrupts_uninit
)(PCIDevice
*dev
);
87 int acs_offset
; /* If nonzero, optional ACS capability offset */
91 #endif /* QEMU_PCIE_PORT_H */