1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
3 * Copyright(c) 2020 Red Hat, Inc.
9 virtio_negotiate_features(struct virtio_hw *hw, uint64_t host_features)
14 * Limit negotiated features to what the driver, virtqueue, and
17 features = host_features & hw->guest_features;
18 VIRTIO_OPS(hw)->set_features(hw, features);
25 virtio_read_dev_config(struct virtio_hw *hw, size_t offset,
26 void *dst, int length)
28 VIRTIO_OPS(hw)->read_dev_cfg(hw, offset, dst, length);
32 virtio_write_dev_config(struct virtio_hw *hw, size_t offset,
33 const void *src, int length)
35 VIRTIO_OPS(hw)->write_dev_cfg(hw, offset, src, length);
39 virtio_reset(struct virtio_hw *hw)
41 VIRTIO_OPS(hw)->set_status(hw, VIRTIO_CONFIG_STATUS_RESET);
42 /* flush status write */
43 VIRTIO_OPS(hw)->get_status(hw);
47 virtio_reinit_complete(struct virtio_hw *hw)
49 virtio_set_status(hw, VIRTIO_CONFIG_STATUS_DRIVER_OK);
53 virtio_set_status(struct virtio_hw *hw, uint8_t status)
55 if (status != VIRTIO_CONFIG_STATUS_RESET)
56 status |= VIRTIO_OPS(hw)->get_status(hw);
58 VIRTIO_OPS(hw)->set_status(hw, status);
62 virtio_get_status(struct virtio_hw *hw)
64 return VIRTIO_OPS(hw)->get_status(hw);
68 virtio_get_isr(struct virtio_hw *hw)
70 return VIRTIO_OPS(hw)->get_isr(hw);