Statistics
| Branch: | Revision:

root / hw / pci_host.h @ be62a2eb

History | View | Annotate | Download (2.3 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 8a14daa5 Gerd Hoffmann
#include "sysbus.h"
32 8a14daa5 Gerd Hoffmann
33 fb47a2e9 Isaku Yamahata
struct PCIHostState {
34 8a14daa5 Gerd Hoffmann
    SysBusDevice busdev;
35 d0ed8076 Avi Kivity
    MemoryRegion conf_mem;
36 d0ed8076 Avi Kivity
    MemoryRegion data_mem;
37 f81138ce Avi Kivity
    MemoryRegion mmcfg;
38 1e39101c Avi Kivity
    MemoryRegion *address_space;
39 502a5395 pbrook
    uint32_t config_reg;
40 502a5395 pbrook
    PCIBus *bus;
41 fb47a2e9 Isaku Yamahata
};
42 502a5395 pbrook
43 42e4126b Jan Kiszka
/* common internal helpers for PCI/PCIe hosts, cut off overflows */
44 42e4126b Jan Kiszka
void pci_host_config_write_common(PCIDevice *pci_dev, uint32_t addr,
45 42e4126b Jan Kiszka
                                  uint32_t limit, uint32_t val, uint32_t len);
46 42e4126b Jan Kiszka
uint32_t pci_host_config_read_common(PCIDevice *pci_dev, uint32_t addr,
47 42e4126b Jan Kiszka
                                     uint32_t limit, uint32_t len);
48 42e4126b Jan Kiszka
49 b6243d99 Isaku Yamahata
void pci_data_write(PCIBus *s, uint32_t addr, uint32_t val, int len);
50 b6243d99 Isaku Yamahata
uint32_t pci_data_read(PCIBus *s, uint32_t addr, int len);
51 b6243d99 Isaku Yamahata
52 d0ed8076 Avi Kivity
extern const MemoryRegionOps pci_host_conf_le_ops;
53 d0ed8076 Avi Kivity
extern const MemoryRegionOps pci_host_conf_be_ops;
54 d0ed8076 Avi Kivity
extern const MemoryRegionOps pci_host_data_le_ops;
55 d0ed8076 Avi Kivity
extern const MemoryRegionOps pci_host_data_be_ops;
56 502a5395 pbrook
57 4f5e19e6 Isaku Yamahata
#endif /* PCI_HOST_H */