189099Sfjoe/* $NetBSD: smc90cx6var.h,v 1.5 2000/03/23 07:01:32 thorpej Exp $ */ 289099Sfjoe/* $FreeBSD$ */ 389099Sfjoe 489099Sfjoe/*- 589099Sfjoe * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. 689099Sfjoe * All rights reserved. 789099Sfjoe * 889099Sfjoe * This code is derived from software contributed to The NetBSD Foundation 989099Sfjoe * by Ignatios Souvatzis. 1089099Sfjoe * 1189099Sfjoe * Redistribution and use in source and binary forms, with or without 1289099Sfjoe * modification, are permitted provided that the following conditions 1389099Sfjoe * are met: 1489099Sfjoe * 1. Redistributions of source code must retain the above copyright 1589099Sfjoe * notice, this list of conditions and the following disclaimer. 1689099Sfjoe * 2. Redistributions in binary form must reproduce the above copyright 1789099Sfjoe * notice, this list of conditions and the following disclaimer in the 1889099Sfjoe * documentation and/or other materials provided with the distribution. 1989099Sfjoe * 2089099Sfjoe * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 2189099Sfjoe * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2289099Sfjoe * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2389099Sfjoe * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2489099Sfjoe * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2589099Sfjoe * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2689099Sfjoe * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2789099Sfjoe * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2889099Sfjoe * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2989099Sfjoe * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3089099Sfjoe * POSSIBILITY OF SUCH DAMAGE. 3189099Sfjoe */ 3289099Sfjoe 3389099Sfjoe/* 3489099Sfjoe * BAH (SMC 8bit ARCnet chipset) k/dpi 3589099Sfjoe * 3689099Sfjoe * The SMC 8bit ARCnet chip family uses a register and a memory window, which 3789099Sfjoe * we get passed via bus_space_tags and bus_space_handles. 3889099Sfjoe * 3989099Sfjoe * As the reset functionality differs between the Amiga boards (using the 4089099Sfjoe * 90c26 chip) and middle-aged ISA boards (using the 90c56 chip), we have 4189099Sfjoe * a sc_reset callback function in the softc, which does a stop function 4289099Sfjoe * (reset and leave dead) or a reset function depending on wether the 2nd 4389099Sfjoe * parameter is 0 or 1. 4489099Sfjoe */ 4589099Sfjoe 4689099Sfjoe#ifndef _SMC90CX6VAR_H_ 4789099Sfjoe#define _SMC90CX6VAR_H_ 4889099Sfjoe 4989099Sfjoe#include <sys/callout.h> 5089099Sfjoe 5189099Sfjoestruct cm_softc { 52147256Sbrooks struct ifnet *sc_ifp; /* Common arcnet structures */ 53159529Sfjoe struct mtx sc_mtx; /* sc mutex */ 5489099Sfjoe 5589099Sfjoe int port_rid; /* resource id for port range */ 5689099Sfjoe struct resource *port_res; /* resource for port range */ 5789099Sfjoe 5889099Sfjoe int mem_rid; /* resource id for memory range */ 5989099Sfjoe struct resource *mem_res; /* resource for memory range */ 6089099Sfjoe 6189099Sfjoe int irq_rid; /* resource id for irq */ 6289099Sfjoe struct resource *irq_res; /* resource for irq */ 6389099Sfjoe void * irq_handle; /* handle for irq handler */ 6489099Sfjoe 6589099Sfjoe void *sc_rxcookie; /* softcallback cookies */ 6689099Sfjoe void *sc_txcookie; 6789099Sfjoe struct callout sc_recon_ch; 6889099Sfjoe u_long sc_recontime; /* seconds only, I'm lazy */ 6989099Sfjoe u_long sc_reconcount; /* for the above */ 7089099Sfjoe u_long sc_reconcount_excessive; /* for the above */ 7189099Sfjoe#define ARC_EXCESSIVE_RECONS 20 7289099Sfjoe#define ARC_EXCESSIVE_RECONS_REWARN 400 73199559Sjhb struct callout sc_watchdog_timer; 74199559Sjhb int sc_timer; 7589099Sfjoe u_char sc_intmask; 7689099Sfjoe u_char sc_rx_act; /* 2..3 */ 7789099Sfjoe u_char sc_tx_act; /* 0..1 */ 7889099Sfjoe u_char sc_rx_fillcount; 7989099Sfjoe u_char sc_tx_fillcount; 8089099Sfjoe u_char sc_broadcast[2]; /* is it a broadcast packet? */ 8189099Sfjoe u_char sc_retransmits[2]; /* unused at the moment */ 8289099Sfjoe}; 8389099Sfjoe 84121816Sbrooksint cm_attach(device_t dev); 8592739Salfredvoid cmintr(void *); 86159529Sfjoevoid cm_stop_locked(struct cm_softc *sc); 8792739Salfredvoid cm_release_resources(device_t dev); 8889099Sfjoe 8989099Sfjoeextern devclass_t cm_devclass; 9089099Sfjoe 91159529Sfjoe#define CM_LOCK(sc) mtx_lock(&(sc)->sc_mtx) 92159529Sfjoe#define CM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) 93159529Sfjoe 94159529Sfjoe/* short notation */ 95159529Sfjoe#define GETREG(off) \ 96159529Sfjoe bus_space_read_1(rman_get_bustag((sc)->port_res), \ 97159529Sfjoe rman_get_bushandle((sc)->port_res), \ 98159529Sfjoe (off)) 99159529Sfjoe#define PUTREG(off, value) \ 100159529Sfjoe bus_space_write_1(rman_get_bustag((sc)->port_res), \ 101159529Sfjoe rman_get_bushandle((sc)->port_res), \ 102159529Sfjoe (off), (value)) 103159529Sfjoe#define GETMEM(off) \ 104159529Sfjoe bus_space_read_1(rman_get_bustag((sc)->mem_res), \ 105159529Sfjoe rman_get_bushandle((sc)->mem_res), \ 106159529Sfjoe (off)) 107159529Sfjoe#define PUTMEM(off, value) \ 108159529Sfjoe bus_space_write_1(rman_get_bustag((sc)->mem_res), \ 109159529Sfjoe rman_get_bushandle((sc)->mem_res), \ 110159529Sfjoe (off), (value)) 111159529Sfjoe 11289099Sfjoe#endif 113