Statistics
| Branch: | Revision:

root / hw / s390-virtio-bus.h @ 4ff658fb

History | View | Annotate | Download (2.3 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 6c33286a Alexander Graf
#include "virtio-net.h"
21 6be9b414 Alexander Graf
#include "virtio-serial.h"
22 6c33286a Alexander Graf
23 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_TYPE                0        /* 8 bits */
24 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_NUM_VQ                1        /* 8 bits */
25 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_FEATURE_LEN        2        /* 8 bits */
26 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_CONFIG_LEN        3        /* 8 bits */
27 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_STATUS                4        /* 8 bits */
28 f3304eea Alexander Graf
#define VIRTIO_DEV_OFFS_CONFIG                5        /* dynamic */
29 f3304eea Alexander Graf
30 f3304eea Alexander Graf
#define VIRTIO_VQCONFIG_OFFS_TOKEN        0        /* 64 bits */
31 f3304eea Alexander Graf
#define VIRTIO_VQCONFIG_OFFS_ADDRESS        8        /* 64 bits */
32 f3304eea Alexander Graf
#define VIRTIO_VQCONFIG_OFFS_NUM        16        /* 16 bits */
33 f3304eea Alexander Graf
#define VIRTIO_VQCONFIG_LEN                24
34 f3304eea Alexander Graf
35 f3304eea Alexander Graf
#define VIRTIO_RING_LEN                        (TARGET_PAGE_SIZE * 3)
36 d1ff903c Alexander Graf
#define S390_DEVICE_PAGES                512
37 f3304eea Alexander Graf
38 f3304eea Alexander Graf
typedef struct VirtIOS390Device {
39 f3304eea Alexander Graf
    DeviceState qdev;
40 f3304eea Alexander Graf
    ram_addr_t dev_offs;
41 f3304eea Alexander Graf
    ram_addr_t feat_offs;
42 f3304eea Alexander Graf
    uint8_t feat_len;
43 f3304eea Alexander Graf
    VirtIODevice *vdev;
44 428c149b Christoph Hellwig
    BlockConf block;
45 f3304eea Alexander Graf
    NICConf nic;
46 8172539d Michael S. Tsirkin
    uint32_t host_features;
47 6be9b414 Alexander Graf
    virtio_serial_conf serial;
48 f0c07c7c Alex Williamson
    virtio_net_conf net;
49 f3304eea Alexander Graf
} VirtIOS390Device;
50 f3304eea Alexander Graf
51 f3304eea Alexander Graf
typedef struct VirtIOS390Bus {
52 f3304eea Alexander Graf
    BusState bus;
53 f3304eea Alexander Graf
54 f3304eea Alexander Graf
    VirtIOS390Device *console;
55 f3304eea Alexander Graf
    ram_addr_t dev_page;
56 f3304eea Alexander Graf
    ram_addr_t dev_offs;
57 f3304eea Alexander Graf
    ram_addr_t next_ring;
58 f3304eea Alexander Graf
} VirtIOS390Bus;
59 f3304eea Alexander Graf
60 f3304eea Alexander Graf
61 64b85a8f Blue Swirl
void s390_virtio_device_update_status(VirtIOS390Device *dev);
62 f3304eea Alexander Graf
63 64b85a8f Blue Swirl
VirtIOS390Device *s390_virtio_bus_console(VirtIOS390Bus *bus);
64 64b85a8f Blue Swirl
VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size);
65 f3304eea Alexander Graf
66 64b85a8f Blue Swirl
VirtIOS390Device *s390_virtio_bus_find_vring(VirtIOS390Bus *bus,
67 64b85a8f Blue Swirl
                                             ram_addr_t mem, int *vq_num);
68 64b85a8f Blue Swirl
VirtIOS390Device *s390_virtio_bus_find_mem(VirtIOS390Bus *bus, ram_addr_t mem);
69 64b85a8f Blue Swirl
void s390_virtio_device_sync(VirtIOS390Device *dev);