Statistics
| Branch: | Revision:

root / hw / s390-virtio-bus.h @ 43ad7e3e

History | View | Annotate | Download (2.4 kB)

1 f3304eea Alexander Graf
/*
2 f3304eea Alexander Graf
 * QEMU S390x VirtIO BUS definitions
3 f3304eea Alexander Graf
 *
4 f3304eea Alexander Graf
 * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
5 f3304eea Alexander Graf
 *
6 f3304eea Alexander Graf
 * This library is free software; you can redistribute it and/or
7 f3304eea Alexander Graf
 * modify it under the terms of the GNU Lesser General Public
8 f3304eea Alexander Graf
 * License as published by the Free Software Foundation; either
9 f3304eea Alexander Graf
 * version 2 of the License, or (at your option) any later version.
10 f3304eea Alexander Graf
 *
11 f3304eea Alexander Graf
 * This library is distributed in the hope that it will be useful,
12 f3304eea Alexander Graf
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 f3304eea Alexander Graf
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 f3304eea Alexander Graf
 * Lesser General Public License for more details.
15 f3304eea Alexander Graf
 *
16 f3304eea Alexander Graf
 * You should have received a copy of the GNU Lesser General Public
17 f3304eea Alexander Graf
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 f3304eea Alexander Graf
 */
19 f3304eea Alexander Graf
20 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_TYPE                0        /* 8 bits */
21 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_NUM_VQ                1        /* 8 bits */
22 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_FEATURE_LEN        2        /* 8 bits */
23 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_CONFIG_LEN        3        /* 8 bits */
24 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_STATUS                4        /* 8 bits */
25 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_CONFIG                5        /* dynamic */
26 f3304eea Alexander Graf
27 f3304eea Alexander Graf
#define VIRTIO_VQCONFIG_OFFS_TOKEN        0        /* 64 bits */
28 f3304eea Alexander Graf
#define VIRTIO_VQCONFIG_OFFS_ADDRESS        8        /* 64 bits */
29 f3304eea Alexander Graf
#define VIRTIO_VQCONFIG_OFFS_NUM        16        /* 16 bits */
30 f3304eea Alexander Graf
#define VIRTIO_VQCONFIG_LEN                24
31 f3304eea Alexander Graf
32 f3304eea Alexander Graf
#define VIRTIO_RING_LEN                        (TARGET_PAGE_SIZE * 3)
33 f3304eea Alexander Graf
#define S390_DEVICE_PAGES                256
34 f3304eea Alexander Graf
35 f3304eea Alexander Graf
typedef struct VirtIOS390Device {
36 f3304eea Alexander Graf
    DeviceState qdev;
37 f3304eea Alexander Graf
    ram_addr_t dev_offs;
38 f3304eea Alexander Graf
    ram_addr_t feat_offs;
39 f3304eea Alexander Graf
    uint8_t feat_len;
40 f3304eea Alexander Graf
    VirtIODevice *vdev;
41 428c149b Christoph Hellwig
    BlockConf block;
42 f3304eea Alexander Graf
    NICConf nic;
43 8172539d Michael S. Tsirkin
    uint32_t host_features;
44 98b19252 Amit Shah
    /* Max. number of ports we can have for a the virtio-serial device */
45 98b19252 Amit Shah
    uint32_t max_virtserial_ports;
46 f0c07c7c Alex Williamson
    virtio_net_conf net;
47 f3304eea Alexander Graf
} VirtIOS390Device;
48 f3304eea Alexander Graf
49 f3304eea Alexander Graf
typedef struct VirtIOS390Bus {
50 f3304eea Alexander Graf
    BusState bus;
51 f3304eea Alexander Graf
52 f3304eea Alexander Graf
    VirtIOS390Device *console;
53 f3304eea Alexander Graf
    ram_addr_t dev_page;
54 f3304eea Alexander Graf
    ram_addr_t dev_offs;
55 f3304eea Alexander Graf
    ram_addr_t next_ring;
56 f3304eea Alexander Graf
} VirtIOS390Bus;
57 f3304eea Alexander Graf
58 f3304eea Alexander Graf
59 f3304eea Alexander Graf
extern void s390_virtio_device_update_status(VirtIOS390Device *dev);
60 f3304eea Alexander Graf
61 f3304eea Alexander Graf
extern VirtIOS390Device *s390_virtio_bus_console(VirtIOS390Bus *bus);
62 f3304eea Alexander Graf
extern VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size);
63 f3304eea Alexander Graf
64 f3304eea Alexander Graf
extern VirtIOS390Device *s390_virtio_bus_find_vring(VirtIOS390Bus *bus,
65 f3304eea Alexander Graf
                                                    ram_addr_t mem,
66 f3304eea Alexander Graf
                                                    int *vq_num);
67 f3304eea Alexander Graf
extern VirtIOS390Device *s390_virtio_bus_find_mem(VirtIOS390Bus *bus,
68 f3304eea Alexander Graf
                                                  ram_addr_t mem);
69 baf0b55a Alexander Graf
extern void s390_virtio_device_sync(VirtIOS390Device *dev);