1139749Simp/*- 286752Sfjoe * Copyright (c) 1997-2001 Granch, Ltd. All rights reserved. 386752Sfjoe * Author: Denis I.Timofeev <timofeev@granch.ru> 486752Sfjoe * 586752Sfjoe * Redistributon and use in source and binary forms, with or without 686752Sfjoe * modification, are permitted provided that the following conditions 786752Sfjoe * are met: 886752Sfjoe * 1. Redistributions of source code must retain the above copyright 986752Sfjoe * notice unmodified, this list of conditions, and the following 1086752Sfjoe * disclaimer. 1186752Sfjoe * 2. Redistributions in binary form must reproduce the above copyright 1286752Sfjoe * notice, this list of conditions and the following disclaimer in the 1386752Sfjoe * documentation and/or other materials provided with the distribution. 1486752Sfjoe * 1586752Sfjoe * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1686752Sfjoe * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1786752Sfjoe * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1886752Sfjoe * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1986752Sfjoe * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2086752Sfjoe * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2186752Sfjoe * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2286752Sfjoe * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2386752Sfjoe * LIABILITY, OR TORT (INCLUDING NEIGENCE OR OTHERWISE) ARISING IN ANY WAY 2486752Sfjoe * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2586752Sfjoe * SUCH DAMAGE. 2686752Sfjoe * 2786752Sfjoe * $FreeBSD$ 2886752Sfjoe */ 2986752Sfjoe 3086752Sfjoe/* 3186752Sfjoe * We don't have registered vendor id yet... 3286752Sfjoe */ 3386752Sfjoe#define SBNI_PCI_VENDOR 0x55 3486752Sfjoe#define SBNI_PCI_DEVICE 0x9f 3586752Sfjoe 3686752Sfjoe#define ISA_MODE 0x00 3786752Sfjoe#define PCI_MODE 0x01 3886752Sfjoe 3986752Sfjoe#define SBNI_PORTS 4 4086752Sfjoe 4186752Sfjoeenum sbni_reg { 4286752Sfjoe CSR0 = 0, 4386752Sfjoe CSR1 = 1, 4486752Sfjoe DAT = 2 4586752Sfjoe}; 4686752Sfjoe 4786752Sfjoe/* CSR0 mapping */ 4886752Sfjoeenum { 4986752Sfjoe BU_EMP = 0x02, 5086752Sfjoe RC_CHK = 0x04, 5186752Sfjoe CT_ZER = 0x08, 5286752Sfjoe TR_REQ = 0x10, 5386752Sfjoe TR_RDY = 0x20, 5486752Sfjoe EN_INT = 0x40, 5586752Sfjoe RC_RDY = 0x80 5686752Sfjoe}; 5786752Sfjoe 5886752Sfjoe 5986752Sfjoe/* CSR1 mapping */ 6086752Sfjoe#define PR_RES 0x80 6186752Sfjoe 6286752Sfjoestruct sbni_csr1 { 6386752Sfjoe unsigned rxl : 5; 6486752Sfjoe unsigned rate : 2; 6586752Sfjoe unsigned : 1; 6686752Sfjoe}; 6786752Sfjoe 6886752Sfjoe 6986752Sfjoe 7086752Sfjoe#define FRAME_ACK_MASK (u_int16_t)0x7000 7186752Sfjoe#define FRAME_LEN_MASK (u_int16_t)0x03FF 7286752Sfjoe#define FRAME_FIRST (u_int16_t)0x8000 7386752Sfjoe#define FRAME_RETRY (u_int16_t)0x0800 7486752Sfjoe 7586752Sfjoe#define FRAME_SENT_BAD (u_int16_t)0x4000 7686752Sfjoe#define FRAME_SENT_OK (u_int16_t)0x3000 7786752Sfjoe 7886752Sfjoe 7986752Sfjoeenum { 8086752Sfjoe FL_WAIT_ACK = 1, 8186752Sfjoe FL_NEED_RESEND = 2, 8286752Sfjoe FL_PREV_OK = 4, 8386752Sfjoe FL_SLOW_MODE = 8 8486752Sfjoe}; 8586752Sfjoe 8686752Sfjoe 8786752Sfjoeenum { 8886752Sfjoe DEFAULT_IOBASEADDR = 0x210, 8986752Sfjoe DEFAULT_INTERRUPTNUMBER = 5, 9086752Sfjoe DEFAULT_RATE = 0, 9186752Sfjoe DEFAULT_FRAME_LEN = 1012 9286752Sfjoe}; 9386752Sfjoe 9486752Sfjoe#define DEF_RXL_DELTA -1 9586752Sfjoe#define DEF_RXL 0xf 9686752Sfjoe 9786752Sfjoe#define SBNI_SIG 0x5a 9886752Sfjoe 9986752Sfjoe#define SBNI_MIN_LEN (ETHER_MIN_LEN - 4) 10086752Sfjoe#define SBNI_MAX_FRAME 1023 10186752Sfjoe 10286752Sfjoe#define SBNI_HZ 18 /* ticks to wait for pong or packet */ 10386752Sfjoe /* sbni watchdog called SBNI_HZ times per sec. */ 10486752Sfjoe 10586752Sfjoe#define TR_ERROR_COUNT 32 10686752Sfjoe#define CHANGE_LEVEL_START_TICKS 4 107