1139749Simp/*- 271316Simp * Copyright (c) 1999 M. Warner Losh <imp@village.org> 371316Simp * All rights reserved. 471316Simp * 571316Simp * Redistribution and use in source and binary forms, with or without 671316Simp * modification, are permitted provided that the following conditions 771316Simp * are met: 871316Simp * 1. Redistributions of source code must retain the above copyright 971316Simp * notice, this list of conditions and the following disclaimer. 1071316Simp * 2. Redistributions in binary form must reproduce the above copyright 1171316Simp * notice, this list of conditions and the following disclaimer in the 1271316Simp * documentation and/or other materials provided with the distribution. 1371316Simp * 1471316Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1571316Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1671316Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1771316Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 1871316Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 1971316Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2071316Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2171316Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2271316Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2371316Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2471316Simp * 2571316Simp * $FreeBSD$ 2671316Simp */ 2771316Simp 2871316Simp#ifndef _IF_CSVAR_H 2971316Simp#define _IF_CSVAR_H 3071316Simp 3171316Simp#include <net/if_arp.h> 3271316Simp#include <net/if_media.h> 3371316Simp 3471316Simp/* 3571316Simp * cs_softc: per line info and status 3671316Simp */ 3771316Simpstruct cs_softc { 38140927Simp /* Ethernet common code */ 39147256Sbrooks struct ifnet *ifp; 40162321Sglebius device_t dev; 4171316Simp 42140927Simp /* Configuration words from EEPROM */ 43140927Simp int auto_neg_cnf; /* AutoNegotitation configuration */ 4471316Simp int adapter_cnf; /* Adapter configuration */ 45140927Simp int isa_config; /* ISA configuration */ 46140927Simp int chip_type; /* Type of chip */ 4771316Simp 48155526Simp u_char enaddr[ETHER_ADDR_LEN]; 49147256Sbrooks 50140927Simp struct ifmedia media; /* Media information */ 5171316Simp 5271316Simp int port_rid; /* resource id for port range */ 5371316Simp struct resource* port_res; /* resource for port range */ 54140927Simp int irq_rid; /* resource id for irq */ 55140927Simp struct resource* irq_res; /* resource for irq */ 56140927Simp void* irq_handle; /* handle for irq handler */ 5771316Simp 58140926Simp int flags; 59140926Simp#define CS_NO_IRQ 0x1 6071316Simp int send_cmd; 61140927Simp int line_ctl; /* */ 62140927Simp int send_underrun; 63140927Simp void *recv_ring; 6471316Simp 65140927Simp unsigned char *buffer; 66140927Simp int buf_len; 67179560Sjhb struct mtx lock; 68179560Sjhb struct callout timer; 69179560Sjhb int tx_timeout; 7071316Simp}; 7171316Simp 72179560Sjhb#define CS_LOCK(sc) mtx_lock(&(sc)->lock) 73179560Sjhb#define CS_UNLOCK(sc) mtx_unlock(&(sc)->lock) 74179560Sjhb#define CS_ASSERT_LOCKED(sc) mtx_assert(&(sc)->lock, MA_OWNED) 75179560Sjhb 7671316Simpint cs_alloc_port(device_t dev, int rid, int size); 77179597Simpint cs_alloc_irq(device_t dev, int rid); 78121816Sbrooksint cs_attach(device_t dev); 7971316Simpint cs_cs89x0_probe(device_t dev); 80140888Simpint cs_detach(device_t dev); 8171316Simpvoid cs_release_resources(device_t dev); 8271316Simp 8371316Simp#endif /* _IF_CSVAR_H */ 84