1/* $NetBSD: smc90cx6var.h,v 1.5 2000/03/23 07:01:32 thorpej Exp $ */ 2/* $FreeBSD$ */ 3 4/*- 5 * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation 9 * by Ignatios Souvatzis. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33/* 34 * BAH (SMC 8bit ARCnet chipset) k/dpi 35 * 36 * The SMC 8bit ARCnet chip family uses a register and a memory window, which 37 * we get passed via bus_space_tags and bus_space_handles. 38 * 39 * As the reset functionality differs between the Amiga boards (using the 40 * 90c26 chip) and middle-aged ISA boards (using the 90c56 chip), we have 41 * a sc_reset callback function in the softc, which does a stop function 42 * (reset and leave dead) or a reset function depending on wether the 2nd 43 * parameter is 0 or 1. 44 */ 45 46#ifndef _SMC90CX6VAR_H_ 47#define _SMC90CX6VAR_H_ 48 49#include <sys/callout.h> 50 51struct cm_softc { 52 struct ifnet *sc_ifp; /* Common arcnet structures */ 53 struct mtx sc_mtx; /* sc mutex */ 54 55 int port_rid; /* resource id for port range */ 56 struct resource *port_res; /* resource for port range */ 57 58 int mem_rid; /* resource id for memory range */ 59 struct resource *mem_res; /* resource for memory range */ 60 61 int irq_rid; /* resource id for irq */ 62 struct resource *irq_res; /* resource for irq */ 63 void * irq_handle; /* handle for irq handler */ 64 65 void *sc_rxcookie; /* softcallback cookies */ 66 void *sc_txcookie; 67 struct callout sc_recon_ch; 68 u_long sc_recontime; /* seconds only, I'm lazy */ 69 u_long sc_reconcount; /* for the above */ 70 u_long sc_reconcount_excessive; /* for the above */ 71#define ARC_EXCESSIVE_RECONS 20 72#define ARC_EXCESSIVE_RECONS_REWARN 400 73 struct callout sc_watchdog_timer; 74 int sc_timer; 75 u_char sc_intmask; 76 u_char sc_rx_act; /* 2..3 */ 77 u_char sc_tx_act; /* 0..1 */ 78 u_char sc_rx_fillcount; 79 u_char sc_tx_fillcount; 80 u_char sc_broadcast[2]; /* is it a broadcast packet? */ 81 u_char sc_retransmits[2]; /* unused at the moment */ 82}; 83 84int cm_attach(device_t dev); 85void cmintr(void *); 86void cm_stop_locked(struct cm_softc *sc); 87void cm_release_resources(device_t dev); 88 89extern devclass_t cm_devclass; 90 91#define CM_LOCK(sc) mtx_lock(&(sc)->sc_mtx) 92#define CM_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) 93 94/* short notation */ 95#define GETREG(off) \ 96 bus_space_read_1(rman_get_bustag((sc)->port_res), \ 97 rman_get_bushandle((sc)->port_res), \ 98 (off)) 99#define PUTREG(off, value) \ 100 bus_space_write_1(rman_get_bustag((sc)->port_res), \ 101 rman_get_bushandle((sc)->port_res), \ 102 (off), (value)) 103#define GETMEM(off) \ 104 bus_space_read_1(rman_get_bustag((sc)->mem_res), \ 105 rman_get_bushandle((sc)->mem_res), \ 106 (off)) 107#define PUTMEM(off, value) \ 108 bus_space_write_1(rman_get_bustag((sc)->mem_res), \ 109 rman_get_bushandle((sc)->mem_res), \ 110 (off), (value)) 111 112#endif 113