Set default console to virtio on S390x
[qemu.git] / hw / s390-virtio-bus.h
blobef3671421a572551ae865e7caf7ba852b3a6420f
1 /*
2 * QEMU S390x VirtIO BUS definitions
4 * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 #define VIRTIO_DEV_OFFS_TYPE 0 /* 8 bits */
21 #define VIRTIO_DEV_OFFS_NUM_VQ 1 /* 8 bits */
22 #define VIRTIO_DEV_OFFS_FEATURE_LEN 2 /* 8 bits */
23 #define VIRTIO_DEV_OFFS_CONFIG_LEN 3 /* 8 bits */
24 #define VIRTIO_DEV_OFFS_STATUS 4 /* 8 bits */
25 #define VIRTIO_DEV_OFFS_CONFIG 5 /* dynamic */
27 #define VIRTIO_VQCONFIG_OFFS_TOKEN 0 /* 64 bits */
28 #define VIRTIO_VQCONFIG_OFFS_ADDRESS 8 /* 64 bits */
29 #define VIRTIO_VQCONFIG_OFFS_NUM 16 /* 16 bits */
30 #define VIRTIO_VQCONFIG_LEN 24
32 #define VIRTIO_RING_LEN (TARGET_PAGE_SIZE * 3)
33 #define S390_DEVICE_PAGES 256
35 typedef struct VirtIOS390Device {
36 DeviceState qdev;
37 ram_addr_t dev_offs;
38 ram_addr_t feat_offs;
39 uint8_t feat_len;
40 VirtIODevice *vdev;
41 DriveInfo *dinfo;
42 NICConf nic;
43 } VirtIOS390Device;
45 typedef struct VirtIOS390Bus {
46 BusState bus;
48 VirtIOS390Device *console;
49 ram_addr_t dev_page;
50 ram_addr_t dev_offs;
51 ram_addr_t next_ring;
52 } VirtIOS390Bus;
55 extern void s390_virtio_device_update_status(VirtIOS390Device *dev);
57 extern VirtIOS390Device *s390_virtio_bus_console(VirtIOS390Bus *bus);
58 extern VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size);
60 extern VirtIOS390Device *s390_virtio_bus_find_vring(VirtIOS390Bus *bus,
61 ram_addr_t mem,
62 int *vq_num);
63 extern VirtIOS390Device *s390_virtio_bus_find_mem(VirtIOS390Bus *bus,
64 ram_addr_t mem);