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
29 #include <machine/bus.h>
55 typedef void (*ntb_db_callback)(void *data, uint32_t vector);
56 typedef void (*ntb_event_callback)(void *data);
58 ntb_event_callback link_event;
59 ntb_db_callback db_event;
63 METHOD int port_number {
67 METHOD int peer_port_count {
71 METHOD int peer_port_number {
76 METHOD int peer_port_idx {
81 METHOD bool link_is_up {
83 enum ntb_speed *speed;
84 enum ntb_width *width;
87 METHOD int link_enable {
93 METHOD int link_disable {
97 METHOD bool link_enabled {
104 const struct ntb_ctx_ops *ctx_ops;
107 METHOD void * get_ctx {
109 const struct ntb_ctx_ops **ctx_ops;
112 METHOD void clear_ctx {
116 METHOD uint8_t mw_count {
120 METHOD int mw_get_range {
131 METHOD int mw_set_trans {
138 METHOD int mw_clear_trans {
143 METHOD int mw_get_wc {
149 METHOD int mw_set_wc {
155 METHOD uint8_t spad_count {
159 METHOD void spad_clear {
163 METHOD int spad_write {
169 METHOD int spad_read {
175 METHOD int peer_spad_write {
181 METHOD int peer_spad_read {
187 METHOD uint64_t db_valid_mask {
191 METHOD int db_vector_count {
195 METHOD uint64_t db_vector_mask {
200 METHOD int peer_db_addr {
206 METHOD void db_clear {
211 METHOD void db_clear_mask {
216 METHOD uint64_t db_read {
220 METHOD void db_set_mask {
225 METHOD void peer_db_set {