Statistics
| Branch: | Revision:

root / hw / spapr_vio.h @ 0201e2da

History | View | Annotate | Download (2 kB)

1 4040ab72 David Gibson
#ifndef _HW_SPAPR_VIO_H
2 4040ab72 David Gibson
#define _HW_SPAPR_VIO_H
3 4040ab72 David Gibson
/*
4 4040ab72 David Gibson
 * QEMU sPAPR VIO bus definitions
5 4040ab72 David Gibson
 *
6 4040ab72 David Gibson
 * Copyright (c) 2010 David Gibson, IBM Corporation <david@gibson.dropbear.id.au>
7 4040ab72 David Gibson
 * Based on the s390 virtio bus definitions:
8 4040ab72 David Gibson
 * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
9 4040ab72 David Gibson
 *
10 4040ab72 David Gibson
 * This library is free software; you can redistribute it and/or
11 4040ab72 David Gibson
 * modify it under the terms of the GNU Lesser General Public
12 4040ab72 David Gibson
 * License as published by the Free Software Foundation; either
13 4040ab72 David Gibson
 * version 2 of the License, or (at your option) any later version.
14 4040ab72 David Gibson
 *
15 4040ab72 David Gibson
 * This library is distributed in the hope that it will be useful,
16 4040ab72 David Gibson
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 4040ab72 David Gibson
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 4040ab72 David Gibson
 * Lesser General Public License for more details.
19 4040ab72 David Gibson
 *
20 4040ab72 David Gibson
 * You should have received a copy of the GNU Lesser General Public
21 4040ab72 David Gibson
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
22 4040ab72 David Gibson
 */
23 4040ab72 David Gibson
24 4040ab72 David Gibson
typedef struct VIOsPAPRDevice {
25 4040ab72 David Gibson
    DeviceState qdev;
26 4040ab72 David Gibson
    uint32_t reg;
27 00dc738d David Gibson
    qemu_irq qirq;
28 00dc738d David Gibson
    uint32_t vio_irq_num;
29 00dc738d David Gibson
    target_ulong signal_state;
30 4040ab72 David Gibson
} VIOsPAPRDevice;
31 4040ab72 David Gibson
32 4040ab72 David Gibson
typedef struct VIOsPAPRBus {
33 4040ab72 David Gibson
    BusState bus;
34 4040ab72 David Gibson
} VIOsPAPRBus;
35 4040ab72 David Gibson
36 4040ab72 David Gibson
typedef struct {
37 4040ab72 David Gibson
    DeviceInfo qdev;
38 4040ab72 David Gibson
    const char *dt_name, *dt_type, *dt_compatible;
39 00dc738d David Gibson
    target_ulong signal_mask;
40 4040ab72 David Gibson
    int (*init)(VIOsPAPRDevice *dev);
41 4040ab72 David Gibson
    void (*hcalls)(VIOsPAPRBus *bus);
42 4040ab72 David Gibson
    int (*devnode)(VIOsPAPRDevice *dev, void *fdt, int node_off);
43 4040ab72 David Gibson
} VIOsPAPRDeviceInfo;
44 4040ab72 David Gibson
45 4040ab72 David Gibson
extern VIOsPAPRBus *spapr_vio_bus_init(void);
46 4040ab72 David Gibson
extern VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg);
47 4040ab72 David Gibson
extern void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info);
48 4040ab72 David Gibson
extern int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt);
49 4040ab72 David Gibson
50 00dc738d David Gibson
extern int spapr_vio_signal(VIOsPAPRDevice *dev, target_ulong mode);
51 00dc738d David Gibson
52 4040ab72 David Gibson
void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len);
53 4040ab72 David Gibson
void spapr_vty_create(VIOsPAPRBus *bus,
54 0201e2da David Gibson
                      uint32_t reg, CharDriverState *chardev,
55 0201e2da David Gibson
                      qemu_irq qirq, uint32_t vio_irq_num);
56 4040ab72 David Gibson
57 4040ab72 David Gibson
#endif /* _HW_SPAPR_VIO_H */