summaryrefslogtreecommitdiff
path: root/hw/spapr_vio.h
blob: 8a000c6fe5e88765b178cc9b78a4dbd6865dfffb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef _HW_SPAPR_VIO_H
#define _HW_SPAPR_VIO_H
/*
 * QEMU sPAPR VIO bus definitions
 *
 * Copyright (c) 2010 David Gibson, IBM Corporation <david@gibson.dropbear.id.au>
 * Based on the s390 virtio bus definitions:
 * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

typedef struct VIOsPAPRDevice {
    DeviceState qdev;
    uint32_t reg;
    qemu_irq qirq;
    uint32_t vio_irq_num;
    target_ulong signal_state;
} VIOsPAPRDevice;

typedef struct VIOsPAPRBus {
    BusState bus;
} VIOsPAPRBus;

typedef struct {
    DeviceInfo qdev;
    const char *dt_name, *dt_type, *dt_compatible;
    target_ulong signal_mask;
    int (*init)(VIOsPAPRDevice *dev);
    void (*hcalls)(VIOsPAPRBus *bus);
    int (*devnode)(VIOsPAPRDevice *dev, void *fdt, int node_off);
} VIOsPAPRDeviceInfo;

extern VIOsPAPRBus *spapr_vio_bus_init(void);
extern VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg);
extern void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info);
extern int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt);

extern int spapr_vio_signal(VIOsPAPRDevice *dev, target_ulong mode);

void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len);
void spapr_vty_create(VIOsPAPRBus *bus,
                      uint32_t reg, CharDriverState *chardev);

#endif /* _HW_SPAPR_VIO_H */