Statistics
| Branch: | Revision:

root / include / hw / pci / pci_host.h @ f487b677

History | View | Annotate | Download (2.4 kB)

1 502a5395 pbrook
/*
2 502a5395 pbrook
 * QEMU Common PCI Host bridge configuration data space access routines.
3 502a5395 pbrook
 *
4 502a5395 pbrook
 * Copyright (c) 2006 Fabrice Bellard
5 5fafdf24 ths
 *
6 502a5395 pbrook
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 502a5395 pbrook
 * of this software and associated documentation files (the "Software"), to deal
8 502a5395 pbrook
 * in the Software without restriction, including without limitation the rights
9 502a5395 pbrook
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 502a5395 pbrook
 * copies of the Software, and to permit persons to whom the Software is
11 502a5395 pbrook
 * furnished to do so, subject to the following conditions:
12 502a5395 pbrook
 *
13 502a5395 pbrook
 * The above copyright notice and this permission notice shall be included in
14 502a5395 pbrook
 * all copies or substantial portions of the Software.
15 502a5395 pbrook
 *
16 502a5395 pbrook
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 502a5395 pbrook
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 502a5395 pbrook
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 502a5395 pbrook
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 502a5395 pbrook
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 502a5395 pbrook
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 502a5395 pbrook
 * THE SOFTWARE.
23 502a5395 pbrook
 */
24 502a5395 pbrook
25 502a5395 pbrook
/* Worker routines for a PCI host controller that uses an {address,data}
26 502a5395 pbrook
   register pair to access PCI configuration space.  */
27 502a5395 pbrook
28 4f5e19e6 Isaku Yamahata
#ifndef PCI_HOST_H
29 4f5e19e6 Isaku Yamahata
#define PCI_HOST_H
30 8026037b blueswir1
31 c759b24f Michael S. Tsirkin
#include "hw/sysbus.h"
32 8a14daa5 Gerd Hoffmann
33 b44ff9d4 Andreas Färber
#define TYPE_PCI_HOST_BRIDGE "pci-host-bridge"
34 b44ff9d4 Andreas Färber
#define PCI_HOST_BRIDGE(obj) \
35 b44ff9d4 Andreas Färber
    OBJECT_CHECK(PCIHostState, (obj), TYPE_PCI_HOST_BRIDGE)
36 b44ff9d4 Andreas Färber
37 fb47a2e9 Isaku Yamahata
struct PCIHostState {
38 8a14daa5 Gerd Hoffmann
    SysBusDevice busdev;
39 b44ff9d4 Andreas Färber
40 d0ed8076 Avi Kivity
    MemoryRegion conf_mem;
41 d0ed8076 Avi Kivity
    MemoryRegion data_mem;
42 f81138ce Avi Kivity
    MemoryRegion mmcfg;
43 502a5395 pbrook
    uint32_t config_reg;
44 502a5395 pbrook
    PCIBus *bus;
45 fb47a2e9 Isaku Yamahata
};
46 502a5395 pbrook
47 42e4126b Jan Kiszka
/* common internal helpers for PCI/PCIe hosts, cut off overflows */
48 42e4126b Jan Kiszka
void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
49 42e4126b Jan Kiszka
                                  uint32_t limit, uint32_t val, uint32_t len);
50 42e4126b Jan Kiszka
uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
51 42e4126b Jan Kiszka
                                     uint32_t limit, uint32_t len);
52 42e4126b Jan Kiszka
53 b6243d99 Isaku Yamahata
void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len);
54 b6243d99 Isaku Yamahata
uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len);
55 b6243d99 Isaku Yamahata
56 d0ed8076 Avi Kivity
extern const MemoryRegionOps pci_host_conf_le_ops;
57 d0ed8076 Avi Kivity
extern const MemoryRegionOps pci_host_conf_be_ops;
58 d0ed8076 Avi Kivity
extern const MemoryRegionOps pci_host_data_le_ops;
59 d0ed8076 Avi Kivity
extern const MemoryRegionOps pci_host_data_be_ops;
60 502a5395 pbrook
61 4f5e19e6 Isaku Yamahata
#endif /* PCI_HOST_H */