]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/pci/pcie_port.h
qapi: Define PCIe link speed and width properties
[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"
bc20ba98 26
bcb75750
AF
27#define TYPE_PCIE_PORT "pcie-port"
28#define PCIE_PORT(obj) OBJECT_CHECK(PCIEPort, (obj), TYPE_PCIE_PORT)
29
bc20ba98 30struct PCIEPort {
bcb75750
AF
31 /*< private >*/
32 PCIBridge parent_obj;
33 /*< public >*/
bc20ba98
IY
34
35 /* pci express switch port */
36 uint8_t port;
37};
38
39void pcie_port_init_reg(PCIDevice *d);
40
bcb75750
AF
41#define TYPE_PCIE_SLOT "pcie-slot"
42#define PCIE_SLOT(obj) OBJECT_CHECK(PCIESlot, (obj), TYPE_PCIE_SLOT)
43
bc20ba98 44struct PCIESlot {
bcb75750
AF
45 /*< private >*/
46 PCIEPort parent_obj;
47 /*< public >*/
bc20ba98
IY
48
49 /* pci express switch port with slot */
50 uint8_t chassis;
51 uint16_t slot;
52 QLIST_ENTRY(PCIESlot) next;
53};
54
55void pcie_chassis_create(uint8_t chassis_number);
bc20ba98
IY
56PCIESlot *pcie_chassis_find_slot(uint8_t chassis, uint16_t slot);
57int pcie_chassis_add_slot(struct PCIESlot *slot);
58void pcie_chassis_del_slot(PCIESlot *s);
59
9d5154d7
MA
60#define TYPE_PCIE_ROOT_PORT "pcie-root-port-base"
61#define PCIE_ROOT_PORT_CLASS(klass) \
62 OBJECT_CLASS_CHECK(PCIERootPortClass, (klass), TYPE_PCIE_ROOT_PORT)
63#define PCIE_ROOT_PORT_GET_CLASS(obj) \
64 OBJECT_GET_CLASS(PCIERootPortClass, (obj), TYPE_PCIE_ROOT_PORT)
65
66typedef struct PCIERootPortClass {
67 PCIDeviceClass parent_class;
226263fb 68 DeviceRealize parent_realize;
9d5154d7
MA
69
70 uint8_t (*aer_vector)(const PCIDevice *dev);
71 int (*interrupts_init)(PCIDevice *dev, Error **errp);
72 void (*interrupts_uninit)(PCIDevice *dev);
73
74 int exp_offset;
75 int aer_offset;
76 int ssvid_offset;
77 int ssid;
78} PCIERootPortClass;
79
bc20ba98 80#endif /* QEMU_PCIE_PORT_H */