Statistics
| Branch: | Revision:

root / hw / spapr_pci.h @ 3204db98

History | View | Annotate | Download (1.8 kB)

1 3384f95c David Gibson
/*
2 3384f95c David Gibson
 * QEMU SPAPR PCI BUS definitions
3 3384f95c David Gibson
 *
4 3384f95c David Gibson
 * Copyright (c) 2011 Alexey Kardashevskiy <aik@au1.ibm.com>
5 3384f95c David Gibson
 *
6 3384f95c David Gibson
 * This library is free software; you can redistribute it and/or
7 3384f95c David Gibson
 * modify it under the terms of the GNU Lesser General Public
8 3384f95c David Gibson
 * License as published by the Free Software Foundation; either
9 3384f95c David Gibson
 * version 2 of the License, or (at your option) any later version.
10 3384f95c David Gibson
 *
11 3384f95c David Gibson
 * This library is distributed in the hope that it will be useful,
12 3384f95c David Gibson
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 3384f95c David Gibson
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 3384f95c David Gibson
 * Lesser General Public License for more details.
15 3384f95c David Gibson
 *
16 3384f95c David Gibson
 * You should have received a copy of the GNU Lesser General Public
17 3384f95c David Gibson
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 3384f95c David Gibson
 */
19 3384f95c David Gibson
#if !defined(__HW_SPAPR_H__)
20 3384f95c David Gibson
#error Please include spapr.h before this file!
21 3384f95c David Gibson
#endif
22 3384f95c David Gibson
23 3384f95c David Gibson
#if !defined(__HW_SPAPR_PCI_H__)
24 3384f95c David Gibson
#define __HW_SPAPR_PCI_H__
25 3384f95c David Gibson
26 3384f95c David Gibson
#include "hw/pci_host.h"
27 3384f95c David Gibson
#include "hw/xics.h"
28 3384f95c David Gibson
29 3384f95c David Gibson
#define SPAPR_PCI_NUM_LSI   16
30 3384f95c David Gibson
31 3384f95c David Gibson
typedef struct sPAPRPHBState {
32 3384f95c David Gibson
    SysBusDevice busdev;
33 3384f95c David Gibson
    PCIHostState host_state;
34 3384f95c David Gibson
35 3384f95c David Gibson
    uint64_t buid;
36 3384f95c David Gibson
37 3384f95c David Gibson
    MemoryRegion memspace, iospace;
38 3384f95c David Gibson
    target_phys_addr_t mem_win_addr, io_win_addr;
39 3384f95c David Gibson
    MemoryRegion memwindow, iowindow;
40 3384f95c David Gibson
41 3384f95c David Gibson
    struct {
42 3384f95c David Gibson
        uint32_t dt_irq;
43 3384f95c David Gibson
        qemu_irq qirq;
44 3384f95c David Gibson
    } lsi_table[SPAPR_PCI_NUM_LSI];
45 3384f95c David Gibson
46 3384f95c David Gibson
    QLIST_ENTRY(sPAPRPHBState) list;
47 3384f95c David Gibson
} sPAPRPHBState;
48 3384f95c David Gibson
49 3384f95c David Gibson
#define SPAPR_PCI_MEM_WIN_BUS_OFFSET 0x80000000ULL
50 3384f95c David Gibson
#define SPAPR_PCI_IO_WIN_SIZE        0x10000
51 3384f95c David Gibson
52 3384f95c David Gibson
void spapr_create_phb(sPAPREnvironment *spapr,
53 3384f95c David Gibson
                      const char *busname, uint64_t buid,
54 3384f95c David Gibson
                      uint64_t mem_win_addr, uint64_t mem_win_size,
55 3384f95c David Gibson
                      uint64_t io_win_addr);
56 3384f95c David Gibson
57 3384f95c David Gibson
int spapr_populate_pci_devices(sPAPRPHBState *phb,
58 3384f95c David Gibson
                               uint32_t xics_phandle,
59 3384f95c David Gibson
                               void *fdt);
60 3384f95c David Gibson
61 3384f95c David Gibson
#endif /* __HW_SPAPR_PCI_H__ */