virtio_bus_if.m revision 275728
1132451Sroberto#-
2132451Sroberto# Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org>
3285612Sdelphij# All rights reserved.
4285612Sdelphij#
5285612Sdelphij# Redistribution and use in source and binary forms, with or without
6285612Sdelphij# modification, are permitted provided that the following conditions
7285612Sdelphij# are met:
8285612Sdelphij# 1. Redistributions of source code must retain the above copyright
9285612Sdelphij#    notice, this list of conditions and the following disclaimer.
10285612Sdelphij# 2. Redistributions in binary form must reproduce the above copyright
11285612Sdelphij#    notice, this list of conditions and the following disclaimer in the
12285612Sdelphij#    documentation and/or other materials provided with the distribution.
13285612Sdelphij#
14285612Sdelphij# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15285612Sdelphij# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16285612Sdelphij# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17285612Sdelphij# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18285612Sdelphij# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19285612Sdelphij# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20285612Sdelphij# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21285612Sdelphij# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22285612Sdelphij# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23285612Sdelphij# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24285612Sdelphij# SUCH DAMAGE.
25285612Sdelphij#
26285612Sdelphij# $FreeBSD: head/sys/dev/virtio/virtio_bus_if.m 275728 2014-12-12 11:19:10Z br $
27285612Sdelphij
28285612Sdelphij#include <sys/bus.h>
29285612Sdelphij#include <machine/bus.h>
30285612Sdelphij
31285612SdelphijINTERFACE virtio_bus;
32285612Sdelphij
33285612SdelphijHEADER {
34285612Sdelphijstruct vq_alloc_info;
35285612Sdelphij};
36285612Sdelphij
37285612SdelphijMETHOD uint64_t negotiate_features {
38285612Sdelphij	device_t	dev;
39285612Sdelphij	uint64_t	child_features;
40285612Sdelphij};
41285612Sdelphij
42285612SdelphijMETHOD int with_feature {
43285612Sdelphij	device_t	dev;
44285612Sdelphij	uint64_t	feature;
45285612Sdelphij};
46285612Sdelphij
47285612SdelphijMETHOD int alloc_virtqueues {
48285612Sdelphij	device_t	dev;
49285612Sdelphij	int		flags;
50285612Sdelphij	int		nvqs;
51285612Sdelphij	struct vq_alloc_info *info;
52285612Sdelphij};
53285612Sdelphij
54285612SdelphijMETHOD int setup_intr {
55285612Sdelphij	device_t	dev;
56285612Sdelphij	enum intr_type	type;
57285612Sdelphij};
58285612Sdelphij
59285612SdelphijMETHOD void stop {
60285612Sdelphij	device_t	dev;
61285612Sdelphij};
62285612Sdelphij
63285612SdelphijMETHOD int reinit {
64285612Sdelphij	device_t	dev;
65285612Sdelphij	uint64_t	features;
66285612Sdelphij};
67285612Sdelphij
68285612SdelphijMETHOD void reinit_complete {
69285612Sdelphij	device_t	dev;
70285612Sdelphij};
71285612Sdelphij
72285612SdelphijMETHOD void notify_vq {
73285612Sdelphij	device_t	dev;
74285612Sdelphij	uint16_t	queue;
75285612Sdelphij};
76285612Sdelphij
77285612SdelphijMETHOD void read_device_config {
78285612Sdelphij	device_t	dev;
79285612Sdelphij	bus_size_t	offset;
80285612Sdelphij	void		*dst;
81285612Sdelphij	int		len;
82285612Sdelphij};
83285612Sdelphij
84285612SdelphijMETHOD void write_device_config {
85285612Sdelphij	device_t	dev;
86285612Sdelphij	bus_size_t	offset;
87285612Sdelphij	void		*src;
88285612Sdelphij	int		len;
89285612Sdelphij};
90285612Sdelphij
91285612SdelphijMETHOD void poll {
92285612Sdelphij	device_t	dev;
93285612Sdelphij};
94
95