2 # Copyright (c) 2016 Alexander Motin <mav@FreeBSD.org>
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
14 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #include <machine/bus.h>
56 typedef void (*ntb_db_callback)(void *data, uint32_t vector);
57 typedef void (*ntb_event_callback)(void *data);
59 ntb_event_callback link_event;
60 ntb_db_callback db_event;
64 METHOD bool link_is_up {
66 enum ntb_speed *speed;
67 enum ntb_width *width;
70 METHOD int link_enable {
76 METHOD int link_disable {
80 METHOD bool link_enabled {
87 const struct ntb_ctx_ops *ctx_ops;
90 METHOD void * get_ctx {
92 const struct ntb_ctx_ops **ctx_ops;
95 METHOD void clear_ctx {
99 METHOD uint8_t mw_count {
103 METHOD int mw_get_range {
114 METHOD int mw_set_trans {
121 METHOD int mw_clear_trans {
126 METHOD int mw_get_wc {
132 METHOD int mw_set_wc {
138 METHOD uint8_t spad_count {
142 METHOD void spad_clear {
146 METHOD int spad_write {
152 METHOD int spad_read {
158 METHOD int peer_spad_write {
164 METHOD int peer_spad_read {
170 METHOD uint64_t db_valid_mask {
174 METHOD int db_vector_count {
178 METHOD uint64_t db_vector_mask {
183 METHOD int peer_db_addr {
189 METHOD void db_clear {
194 METHOD void db_clear_mask {
199 METHOD uint64_t db_read {
203 METHOD void db_set_mask {
208 METHOD void peer_db_set {