]>
Commit | Line | Data |
---|---|---|
4d8fde11 AG |
1 | /* |
2 | * QEMU Generic PCI Express Bridge Emulation | |
3 | * | |
4 | * Copyright (C) 2015 Alexander Graf <agraf@suse.de> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
e361a772 TH |
16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, see <http://www.gnu.org/licenses/> | |
4d8fde11 AG |
18 | */ |
19 | ||
20 | #ifndef HW_GPEX_H | |
21 | #define HW_GPEX_H | |
22 | ||
5b85eabe | 23 | #include "exec/hwaddr.h" |
4d8fde11 | 24 | #include "hw/sysbus.h" |
edf5ca5d | 25 | #include "hw/pci/pci_device.h" |
4d8fde11 | 26 | #include "hw/pci/pcie_host.h" |
db1015e9 | 27 | #include "qom/object.h" |
4d8fde11 AG |
28 | |
29 | #define TYPE_GPEX_HOST "gpex-pcihost" | |
8063396b | 30 | OBJECT_DECLARE_SIMPLE_TYPE(GPEXHost, GPEX_HOST) |
4d8fde11 AG |
31 | |
32 | #define TYPE_GPEX_ROOT_DEVICE "gpex-root" | |
8063396b | 33 | OBJECT_DECLARE_SIMPLE_TYPE(GPEXRootState, GPEX_ROOT_DEVICE) |
4d8fde11 | 34 | |
db1015e9 | 35 | struct GPEXRootState { |
4d8fde11 AG |
36 | /*< private >*/ |
37 | PCIDevice parent_obj; | |
38 | /*< public >*/ | |
db1015e9 | 39 | }; |
4d8fde11 | 40 | |
8f6a4874 S |
41 | struct GPEXConfig { |
42 | MemMapEntry ecam; | |
43 | MemMapEntry mmio32; | |
44 | MemMapEntry mmio64; | |
45 | MemMapEntry pio; | |
46 | int irq; | |
47 | PCIBus *bus; | |
48 | }; | |
49 | ||
ff871d04 | 50 | typedef struct GPEXIrq GPEXIrq; |
db1015e9 | 51 | struct GPEXHost { |
4d8fde11 AG |
52 | /*< private >*/ |
53 | PCIExpressHost parent_obj; | |
54 | /*< public >*/ | |
55 | ||
56 | GPEXRootState gpex_root; | |
57 | ||
58 | MemoryRegion io_ioport; | |
59 | MemoryRegion io_mmio; | |
a6091108 PM |
60 | MemoryRegion io_ioport_window; |
61 | MemoryRegion io_mmio_window; | |
ff871d04 AG |
62 | GPEXIrq *irq; |
63 | uint8_t num_irqs; | |
a6091108 PM |
64 | |
65 | bool allow_unmapped_accesses; | |
4d8fde11 | 66 | |
8f6a4874 | 67 | struct GPEXConfig gpex_cfg; |
5b85eabe GH |
68 | }; |
69 | ||
70bfdce6 PS |
70 | int gpex_set_irq_num(GPEXHost *s, int index, int gsi); |
71 | ||
5b85eabe | 72 | void acpi_dsdt_add_gpex(Aml *scope, struct GPEXConfig *cfg); |
8f6a4874 S |
73 | void acpi_dsdt_add_gpex_host(Aml *scope, uint32_t irq); |
74 | ||
75 | #define PCI_HOST_PIO_BASE "x-pio-base" | |
76 | #define PCI_HOST_PIO_SIZE "x-pio-size" | |
77 | #define PCI_HOST_ECAM_BASE "x-ecam-base" | |
78 | #define PCI_HOST_ECAM_SIZE "x-ecam-size" | |
79 | #define PCI_HOST_BELOW_4G_MMIO_BASE "x-below-4g-mmio-base" | |
80 | #define PCI_HOST_BELOW_4G_MMIO_SIZE "x-below-4g-mmio-size" | |
81 | #define PCI_HOST_ABOVE_4G_MMIO_BASE "x-above-4g-mmio-base" | |
82 | #define PCI_HOST_ABOVE_4G_MMIO_SIZE "x-above-4g-mmio-size" | |
5b85eabe | 83 | |
4d8fde11 | 84 | #endif /* HW_GPEX_H */ |