xref: /qemu/include/hw/pci/pcie_host.h (revision 079e3e7012a0e3ff80b4786e67f5a5d4341dcd51)
1 /*
2  * pcie_host.h
3  *
4  * Copyright (c) 2009 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 PCIE_HOST_H
22 #define PCIE_HOST_H
23 
24 #include "hw/pci/pci_host.h"
25 #include "exec/memory.h"
26 
27 #define TYPE_PCIE_HOST_BRIDGE "pcie-host-bridge"
28 #define PCIE_HOST_BRIDGE(obj) \
29     OBJECT_CHECK(PCIExpressHost, (obj), TYPE_PCIE_HOST_BRIDGE)
30 
31 /* pcie_host::base_addr == PCIE_BASE_ADDR_UNMAPPED when it isn't mapped. */
32 #define PCIE_BASE_ADDR_UNMAPPED  ((hwaddr)-1ULL)
33 
34 struct PCIExpressHost {
35     PCIHostState pci;
36 
37     /* express part */
38 
39     /* base address where MMCONFIG area is mapped. */
40     hwaddr  base_addr;
41 
42     /* the size of MMCONFIG area. It's host bridge dependent */
43     hwaddr  size;
44 
45     /* MMCONFIG mmio area */
46     MemoryRegion mmio;
47 };
48 
49 int pcie_host_init(PCIExpressHost *e);
50 void pcie_host_mmcfg_unmap(PCIExpressHost *e);
51 void pcie_host_mmcfg_map(PCIExpressHost *e, hwaddr addr, uint32_t size);
52 void pcie_host_mmcfg_update(PCIExpressHost *e,
53                             int enable,
54                             hwaddr addr,
55                             uint32_t size);
56 
57 #endif /* PCIE_HOST_H */
58