Statistics
| Branch: | Revision:

root / hw / spapr_pci.h @ 37952117

History | View | Annotate | Download (1.9 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 7fb0bd34 David Gibson
#include "hw/pci.h"
27 3384f95c David Gibson
#include "hw/pci_host.h"
28 3384f95c David Gibson
#include "hw/xics.h"
29 3384f95c David Gibson
30 3384f95c David Gibson
typedef struct sPAPRPHBState {
31 3384f95c David Gibson
    SysBusDevice busdev;
32 3384f95c David Gibson
    PCIHostState host_state;
33 3384f95c David Gibson
34 3384f95c David Gibson
    uint64_t buid;
35 298a9710 David Gibson
    char *busname;
36 298a9710 David Gibson
    char *dtbusname;
37 3384f95c David Gibson
38 3384f95c David Gibson
    MemoryRegion memspace, iospace;
39 298a9710 David Gibson
    target_phys_addr_t mem_win_addr, mem_win_size, io_win_addr, io_win_size;
40 3384f95c David Gibson
    MemoryRegion memwindow, iowindow;
41 edded454 David Gibson
    DMAContext *dma;
42 3384f95c David Gibson
43 3384f95c David Gibson
    struct {
44 3384f95c David Gibson
        uint32_t dt_irq;
45 3384f95c David Gibson
        qemu_irq qirq;
46 7fb0bd34 David Gibson
    } lsi_table[PCI_NUM_PINS];
47 3384f95c David Gibson
48 3384f95c David Gibson
    QLIST_ENTRY(sPAPRPHBState) list;
49 3384f95c David Gibson
} sPAPRPHBState;
50 3384f95c David Gibson
51 3384f95c David Gibson
#define SPAPR_PCI_MEM_WIN_BUS_OFFSET 0x80000000ULL
52 3384f95c David Gibson
#define SPAPR_PCI_IO_WIN_SIZE        0x10000
53 3384f95c David Gibson
54 3384f95c David Gibson
void spapr_create_phb(sPAPREnvironment *spapr,
55 3384f95c David Gibson
                      const char *busname, uint64_t buid,
56 3384f95c David Gibson
                      uint64_t mem_win_addr, uint64_t mem_win_size,
57 3384f95c David Gibson
                      uint64_t io_win_addr);
58 3384f95c David Gibson
59 3384f95c David Gibson
int spapr_populate_pci_devices(sPAPRPHBState *phb,
60 3384f95c David Gibson
                               uint32_t xics_phandle,
61 3384f95c David Gibson
                               void *fdt);
62 3384f95c David Gibson
63 3384f95c David Gibson
#endif /* __HW_SPAPR_PCI_H__ */