1227652Sgrehan#-
2252707Sbryanv# Copyright (c) 2011, Bryan Venteicher <bryanv@FreeBSD.org>
3227652Sgrehan# All rights reserved.
4227652Sgrehan#
5227652Sgrehan# Redistribution and use in source and binary forms, with or without
6227652Sgrehan# modification, are permitted provided that the following conditions
7227652Sgrehan# are met:
8227652Sgrehan# 1. Redistributions of source code must retain the above copyright
9227652Sgrehan#    notice, this list of conditions and the following disclaimer.
10227652Sgrehan# 2. Redistributions in binary form must reproduce the above copyright
11227652Sgrehan#    notice, this list of conditions and the following disclaimer in the
12227652Sgrehan#    documentation and/or other materials provided with the distribution.
13227652Sgrehan#
14227652Sgrehan# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15227652Sgrehan# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16227652Sgrehan# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17227652Sgrehan# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18227652Sgrehan# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19227652Sgrehan# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20227652Sgrehan# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21227652Sgrehan# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22227652Sgrehan# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23227652Sgrehan# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24227652Sgrehan# SUCH DAMAGE.
25227652Sgrehan#
26227652Sgrehan# $FreeBSD$
27227652Sgrehan
28227652Sgrehan#include <sys/bus.h>
29227652Sgrehan#include <machine/bus.h>
30227652Sgrehan
31227652SgrehanINTERFACE virtio_bus;
32227652Sgrehan
33227652SgrehanHEADER {
34227652Sgrehanstruct vq_alloc_info;
35227652Sgrehan};
36227652Sgrehan
37227652SgrehanMETHOD uint64_t negotiate_features {
38227652Sgrehan	device_t	dev;
39227652Sgrehan	uint64_t	child_features;
40227652Sgrehan};
41227652Sgrehan
42227652SgrehanMETHOD int with_feature {
43227652Sgrehan	device_t	dev;
44227652Sgrehan	uint64_t	feature;
45227652Sgrehan};
46227652Sgrehan
47227652SgrehanMETHOD int alloc_virtqueues {
48227652Sgrehan	device_t	dev;
49227652Sgrehan	int		flags;
50227652Sgrehan	int		nvqs;
51227652Sgrehan	struct vq_alloc_info *info;
52227652Sgrehan};
53227652Sgrehan
54227652SgrehanMETHOD int setup_intr {
55227652Sgrehan	device_t	dev;
56227652Sgrehan	enum intr_type	type;
57227652Sgrehan};
58227652Sgrehan
59227652SgrehanMETHOD void stop {
60227652Sgrehan	device_t	dev;
61227652Sgrehan};
62227652Sgrehan
63227652SgrehanMETHOD int reinit {
64227652Sgrehan	device_t	dev;
65227652Sgrehan	uint64_t	features;
66227652Sgrehan};
67227652Sgrehan
68227652SgrehanMETHOD void reinit_complete {
69227652Sgrehan	device_t	dev;
70227652Sgrehan};
71227652Sgrehan
72227652SgrehanMETHOD void notify_vq {
73227652Sgrehan	device_t	dev;
74227652Sgrehan	uint16_t	queue;
75227652Sgrehan};
76227652Sgrehan
77227652SgrehanMETHOD void read_device_config {
78227652Sgrehan	device_t	dev;
79227652Sgrehan	bus_size_t	offset;
80227652Sgrehan	void		*dst;
81227652Sgrehan	int		len;
82227652Sgrehan};
83227652Sgrehan
84227652SgrehanMETHOD void write_device_config {
85227652Sgrehan	device_t	dev;
86227652Sgrehan	bus_size_t	offset;
87227652Sgrehan	void		*src;
88227652Sgrehan	int		len;
89227652Sgrehan};
90