sync with latest
[sdk/emulator/qemu.git] / hw / pcie_port.h
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
24 #include "pci_bridge.h"
25 #include "pci_internals.h"
26
27 struct PCIEPort {
28     PCIBridge   br;
29
30     /* pci express switch port */
31     uint8_t     port;
32 };
33
34 void pcie_port_init_reg(PCIDevice *d);
35
36 struct PCIESlot {
37     PCIEPort    port;
38
39     /* pci express switch port with slot */
40     uint8_t     chassis;
41     uint16_t    slot;
42     QLIST_ENTRY(PCIESlot) next;
43 };
44
45 void pcie_chassis_create(uint8_t chassis_number);
46 void pcie_main_chassis_create(void);
47 PCIESlot *pcie_chassis_find_slot(uint8_t chassis, uint16_t slot);
48 int pcie_chassis_add_slot(struct PCIESlot *slot);
49 void pcie_chassis_del_slot(PCIESlot *s);
50
51 #endif /* QEMU_PCIE_PORT_H */