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 int port_number {
68 METHOD int peer_port_count {
72 METHOD int peer_port_number {
77 METHOD int peer_port_idx {
82 METHOD bool link_is_up {
84 enum ntb_speed *speed;
85 enum ntb_width *width;
88 METHOD int link_enable {
94 METHOD int link_disable {
98 METHOD bool link_enabled {
105 const struct ntb_ctx_ops *ctx_ops;
108 METHOD void * get_ctx {
110 const struct ntb_ctx_ops **ctx_ops;
113 METHOD void clear_ctx {
117 METHOD uint8_t mw_count {
121 METHOD int mw_get_range {
132 METHOD int mw_set_trans {
139 METHOD int mw_clear_trans {
144 METHOD int mw_get_wc {
150 METHOD int mw_set_wc {
156 METHOD uint8_t spad_count {
160 METHOD void spad_clear {
164 METHOD int spad_write {
170 METHOD int spad_read {
176 METHOD int peer_spad_write {
182 METHOD int peer_spad_read {
188 METHOD uint64_t db_valid_mask {
192 METHOD int db_vector_count {
196 METHOD uint64_t db_vector_mask {
201 METHOD int peer_db_addr {
207 METHOD void db_clear {
212 METHOD void db_clear_mask {
217 METHOD uint64_t db_read {
221 METHOD void db_set_mask {
226 METHOD void peer_db_set {