]> git.proxmox.com Git - qemu.git/blame - hw/spapr_vio.h
target-arm/neon_helper.c: Use make_float32/float32_val macros
[qemu.git] / hw / spapr_vio.h
CommitLineData
4040ab72
DG
1#ifndef _HW_SPAPR_VIO_H
2#define _HW_SPAPR_VIO_H
3/*
4 * QEMU sPAPR VIO bus definitions
5 *
6 * Copyright (c) 2010 David Gibson, IBM Corporation <david@gibson.dropbear.id.au>
7 * Based on the s390 virtio bus definitions:
8 * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
22 */
23
ee86dfee
DG
24#define SPAPR_VIO_TCE_PAGE_SHIFT 12
25#define SPAPR_VIO_TCE_PAGE_SIZE (1ULL << SPAPR_VIO_TCE_PAGE_SHIFT)
26#define SPAPR_VIO_TCE_PAGE_MASK (SPAPR_VIO_TCE_PAGE_SIZE - 1)
27
28enum VIOsPAPR_TCEAccess {
29 SPAPR_TCE_FAULT = 0,
30 SPAPR_TCE_RO = 1,
31 SPAPR_TCE_WO = 2,
32 SPAPR_TCE_RW = 3,
33};
34
b45d63b6
BH
35struct VIOsPAPRDevice;
36
ee86dfee
DG
37typedef struct VIOsPAPR_RTCE {
38 uint64_t tce;
39} VIOsPAPR_RTCE;
40
b45d63b6
BH
41typedef struct VIOsPAPR_CRQ {
42 uint64_t qladdr;
43 uint32_t qsize;
44 uint32_t qnext;
45 int(*SendFunc)(struct VIOsPAPRDevice *vdev, uint8_t *crq);
46} VIOsPAPR_CRQ;
47
4040ab72
DG
48typedef struct VIOsPAPRDevice {
49 DeviceState qdev;
50 uint32_t reg;
08942ac1
BH
51 uint32_t flags;
52#define VIO_PAPR_FLAG_DMA_BYPASS 0x1
00dc738d
DG
53 qemu_irq qirq;
54 uint32_t vio_irq_num;
55 target_ulong signal_state;
ee86dfee
DG
56 uint32_t rtce_window_size;
57 VIOsPAPR_RTCE *rtce_table;
b45d63b6 58 VIOsPAPR_CRQ crq;
4040ab72
DG
59} VIOsPAPRDevice;
60
61typedef struct VIOsPAPRBus {
62 BusState bus;
63} VIOsPAPRBus;
64
65typedef struct {
66 DeviceInfo qdev;
67 const char *dt_name, *dt_type, *dt_compatible;
00dc738d 68 target_ulong signal_mask;
4040ab72
DG
69 int (*init)(VIOsPAPRDevice *dev);
70 void (*hcalls)(VIOsPAPRBus *bus);
71 int (*devnode)(VIOsPAPRDevice *dev, void *fdt, int node_off);
72} VIOsPAPRDeviceInfo;
73
74extern VIOsPAPRBus *spapr_vio_bus_init(void);
75extern VIOsPAPRDevice *spapr_vio_find_by_reg(VIOsPAPRBus *bus, uint32_t reg);
76extern void spapr_vio_bus_register_withprop(VIOsPAPRDeviceInfo *info);
77extern int spapr_populate_vdevice(VIOsPAPRBus *bus, void *fdt);
78
00dc738d
DG
79extern int spapr_vio_signal(VIOsPAPRDevice *dev, target_ulong mode);
80
ee86dfee
DG
81int spapr_vio_check_tces(VIOsPAPRDevice *dev, target_ulong ioba,
82 target_ulong len,
83 enum VIOsPAPR_TCEAccess access);
84
85int spapr_tce_dma_read(VIOsPAPRDevice *dev, uint64_t taddr,
86 void *buf, uint32_t size);
87int spapr_tce_dma_write(VIOsPAPRDevice *dev, uint64_t taddr,
88 const void *buf, uint32_t size);
89int spapr_tce_dma_zero(VIOsPAPRDevice *dev, uint64_t taddr, uint32_t size);
90void stb_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint8_t val);
91void sth_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint16_t val);
92void stw_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint32_t val);
93void stq_tce(VIOsPAPRDevice *dev, uint64_t taddr, uint64_t val);
94uint64_t ldq_tce(VIOsPAPRDevice *dev, uint64_t taddr);
95
b45d63b6
BH
96int spapr_vio_send_crq(VIOsPAPRDevice *dev, uint8_t *crq);
97
4040ab72
DG
98void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len);
99void spapr_vty_create(VIOsPAPRBus *bus,
0201e2da
DG
100 uint32_t reg, CharDriverState *chardev,
101 qemu_irq qirq, uint32_t vio_irq_num);
4040ab72 102
8d90ad90
DG
103void spapr_vlan_create(VIOsPAPRBus *bus, uint32_t reg, NICInfo *nd,
104 qemu_irq qirq, uint32_t vio_irq_num);
105
6e270446
BH
106void spapr_vscsi_create(VIOsPAPRBus *bus, uint32_t reg,
107 qemu_irq qirq, uint32_t vio_irq_num);
108
08942ac1
BH
109int spapr_tce_set_bypass(uint32_t unit, uint32_t enable);
110void spapr_vio_quiesce(void);
111
4040ab72 112#endif /* _HW_SPAPR_VIO_H */