]>
Commit | Line | Data |
---|---|---|
f3304eea AG |
1 | /* |
2 | * QEMU S390x VirtIO BUS definitions | |
3 | * | |
4 | * Copyright (c) 2009 Alexander Graf <[email protected]> | |
5 | * | |
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. | |
10 | * | |
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. | |
15 | * | |
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/>. | |
18 | */ | |
19 | ||
6c33286a AG |
20 | #include "virtio-net.h" |
21 | ||
f3304eea AG |
22 | #define VIRTIO_DEV_OFFS_TYPE 0 /* 8 bits */ |
23 | #define VIRTIO_DEV_OFFS_NUM_VQ 1 /* 8 bits */ | |
24 | #define VIRTIO_DEV_OFFS_FEATURE_LEN 2 /* 8 bits */ | |
25 | #define VIRTIO_DEV_OFFS_CONFIG_LEN 3 /* 8 bits */ | |
26 | #define VIRTIO_DEV_OFFS_STATUS 4 /* 8 bits */ | |
27 | #define VIRTIO_DEV_OFFS_CONFIG 5 /* dynamic */ | |
28 | ||
29 | #define VIRTIO_VQCONFIG_OFFS_TOKEN 0 /* 64 bits */ | |
30 | #define VIRTIO_VQCONFIG_OFFS_ADDRESS 8 /* 64 bits */ | |
31 | #define VIRTIO_VQCONFIG_OFFS_NUM 16 /* 16 bits */ | |
32 | #define VIRTIO_VQCONFIG_LEN 24 | |
33 | ||
34 | #define VIRTIO_RING_LEN (TARGET_PAGE_SIZE * 3) | |
35 | #define S390_DEVICE_PAGES 256 | |
36 | ||
37 | typedef struct VirtIOS390Device { | |
38 | DeviceState qdev; | |
39 | ram_addr_t dev_offs; | |
40 | ram_addr_t feat_offs; | |
41 | uint8_t feat_len; | |
42 | VirtIODevice *vdev; | |
428c149b | 43 | BlockConf block; |
f3304eea | 44 | NICConf nic; |
8172539d | 45 | uint32_t host_features; |
98b19252 AS |
46 | /* Max. number of ports we can have for a the virtio-serial device */ |
47 | uint32_t max_virtserial_ports; | |
f0c07c7c | 48 | virtio_net_conf net; |
f3304eea AG |
49 | } VirtIOS390Device; |
50 | ||
51 | typedef struct VirtIOS390Bus { | |
52 | BusState bus; | |
53 | ||
54 | VirtIOS390Device *console; | |
55 | ram_addr_t dev_page; | |
56 | ram_addr_t dev_offs; | |
57 | ram_addr_t next_ring; | |
58 | } VirtIOS390Bus; | |
59 | ||
60 | ||
64b85a8f | 61 | void s390_virtio_device_update_status(VirtIOS390Device *dev); |
f3304eea | 62 | |
64b85a8f BS |
63 | VirtIOS390Device *s390_virtio_bus_console(VirtIOS390Bus *bus); |
64 | VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size); | |
f3304eea | 65 | |
64b85a8f BS |
66 | VirtIOS390Device *s390_virtio_bus_find_vring(VirtIOS390Bus *bus, |
67 | ram_addr_t mem, int *vq_num); | |
68 | VirtIOS390Device *s390_virtio_bus_find_mem(VirtIOS390Bus *bus, ram_addr_t mem); | |
69 | void s390_virtio_device_sync(VirtIOS390Device *dev); |