if_sbnireg.h revision 86752
164562Sgshapiro/* 264562Sgshapiro * Copyright (c) 1997-2001 Granch, Ltd. All rights reserved. 364562Sgshapiro * Author: Denis I.Timofeev <timofeev@granch.ru> 464562Sgshapiro * 564562Sgshapiro * Redistributon and use in source and binary forms, with or without 664562Sgshapiro * modification, are permitted provided that the following conditions 764562Sgshapiro * are met: 864562Sgshapiro * 1. Redistributions of source code must retain the above copyright 964562Sgshapiro * notice unmodified, this list of conditions, and the following 1064562Sgshapiro * disclaimer. 1164562Sgshapiro * 2. Redistributions in binary form must reproduce the above copyright 12132943Sgshapiro * notice, this list of conditions and the following disclaimer in the 13132943Sgshapiro * documentation and/or other materials provided with the distribution. 1464562Sgshapiro * 15157001Sgshapiro * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16157001Sgshapiro * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17157001Sgshapiro * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1890792Sgshapiro * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1990792Sgshapiro * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2090792Sgshapiro * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2164562Sgshapiro * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2290792Sgshapiro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2390792Sgshapiro * LIABILITY, OR TORT (INCLUDING NEIGENCE OR OTHERWISE) ARISING IN ANY WAY 2490792Sgshapiro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2590792Sgshapiro * SUCH DAMAGE. 26132943Sgshapiro * 27132943Sgshapiro * $FreeBSD: head/sys/dev/sbni/if_sbnireg.h 86752 2001-11-21 22:29:35Z fjoe $ 2890792Sgshapiro */ 29132943Sgshapiro 30132943Sgshapiro/* 31132943Sgshapiro * We don't have registered vendor id yet... 3290792Sgshapiro */ 33132943Sgshapiro#define SBNI_PCI_VENDOR 0x55 34132943Sgshapiro#define SBNI_PCI_DEVICE 0x9f 3590792Sgshapiro 36132943Sgshapiro#define ISA_MODE 0x00 37132943Sgshapiro#define PCI_MODE 0x01 38132943Sgshapiro 3964562Sgshapiro#define SBNI_PORTS 4 4064562Sgshapiro 4164562Sgshapiroenum sbni_reg { 4264562Sgshapiro CSR0 = 0, 4364562Sgshapiro CSR1 = 1, 4464562Sgshapiro DAT = 2 4564562Sgshapiro}; 4664562Sgshapiro 47110560Sgshapiro/* CSR0 mapping */ 4864562Sgshapiroenum { 4964562Sgshapiro BU_EMP = 0x02, 5064562Sgshapiro RC_CHK = 0x04, 5164562Sgshapiro CT_ZER = 0x08, 5264562Sgshapiro TR_REQ = 0x10, 5390792Sgshapiro TR_RDY = 0x20, 5490792Sgshapiro EN_INT = 0x40, 5564562Sgshapiro RC_RDY = 0x80 5664562Sgshapiro}; 5764562Sgshapiro 5864562Sgshapiro 5964562Sgshapiro/* CSR1 mapping */ 6064562Sgshapiro#define PR_RES 0x80 6164562Sgshapiro 6273188Sgshapirostruct sbni_csr1 { 6373188Sgshapiro unsigned rxl : 5; 6473188Sgshapiro unsigned rate : 2; 6573188Sgshapiro unsigned : 1; 6664562Sgshapiro}; 6773188Sgshapiro 6864562Sgshapiro 6964562Sgshapiro 7064562Sgshapiro#define FRAME_ACK_MASK (u_int16_t)0x7000 7164562Sgshapiro#define FRAME_LEN_MASK (u_int16_t)0x03FF 7264562Sgshapiro#define FRAME_FIRST (u_int16_t)0x8000 7364562Sgshapiro#define FRAME_RETRY (u_int16_t)0x0800 7464562Sgshapiro 7564562Sgshapiro#define FRAME_SENT_BAD (u_int16_t)0x4000 7664562Sgshapiro#define FRAME_SENT_OK (u_int16_t)0x3000 7780785Sgshapiro 7864562Sgshapiro 7964562Sgshapiroenum { 8064562Sgshapiro FL_WAIT_ACK = 1, 8164562Sgshapiro FL_NEED_RESEND = 2, 8264562Sgshapiro FL_PREV_OK = 4, 8364562Sgshapiro FL_SLOW_MODE = 8 8480785Sgshapiro}; 8564562Sgshapiro 8664562Sgshapiro 8764562Sgshapiroenum { 8864562Sgshapiro DEFAULT_IOBASEADDR = 0x210, 8964562Sgshapiro DEFAULT_INTERRUPTNUMBER = 5, 9064562Sgshapiro DEFAULT_RATE = 0, 9164562Sgshapiro DEFAULT_FRAME_LEN = 1012 9264562Sgshapiro}; 93168515Sgshapiro 94168515Sgshapiro#define DEF_RXL_DELTA -1 9564562Sgshapiro#define DEF_RXL 0xf 96168515Sgshapiro 9790792Sgshapiro#define SBNI_SIG 0x5a 9866494Sgshapiro 9964562Sgshapiro#define SBNI_MIN_LEN (ETHER_MIN_LEN - 4) 10080785Sgshapiro#define SBNI_MAX_FRAME 1023 10164562Sgshapiro 10264562Sgshapiro#define SBNI_HZ 18 /* ticks to wait for pong or packet */ 10390792Sgshapiro /* sbni watchdog called SBNI_HZ times per sec. */ 10480785Sgshapiro 10580785Sgshapiro#define TR_ERROR_COUNT 32 10680785Sgshapiro#define CHANGE_LEVEL_START_TICKS 4 10780785Sgshapiro