d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/*
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * CDDL HEADER START
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw *
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * The contents of this file are subject to the terms of the
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Common Development and Distribution License (the "License").
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * You may not use this file except in compliance with the License.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw *
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * or http://www.opensolaris.org/os/licensing.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * See the License for the specific language governing permissions
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * and limitations under the License.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw *
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * When distributing Covered Code, include this CDDL HEADER in each
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * If applicable, add the following below this CDDL HEADER, with the
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * fields enclosed by brackets "[]" replaced with your own identifying
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * information: Portions Copyright [yyyy] [name of copyright owner]
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw *
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * CDDL HEADER END
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/*
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Use is subject to license terms.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/*
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * This file is part of the Chelsio T1 Ethernet driver.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw *
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Copyright (C) 2003-2005 Chelsio Communications. All rights reserved.
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#ifndef _CHELSIO_OSDEP_H
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define _CHELSIO_OSDEP_H
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#pragma ident "%Z%%M% %I% %E% SMI"
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#ifdef __cplusplus
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwextern "C" {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#endif
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/*
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw * Solaris includes
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define BIG_ENDIAN 4321
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define LITTLE_ENDIAN 1234
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#if defined(__sparc)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define BYTE_ORDER BIG_ENDIAN
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#else
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define BYTE_ORDER LITTLE_ENDIAN
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#endif
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/types.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/systm.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/param.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/kmem.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/stropts.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/cmn_err.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/varargs.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/stream.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/ddi.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/dlpi.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/ethernet.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include <sys/gld.h>
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include "ostypes.h"
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include "oschtoe.h"
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include "ch_compat.h"
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#include "ch.h"
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define FILE_IDENT(a) static char *id = a
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define ETH_ALEN 6
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwtypedef struct ch peobj;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwtypedef uint32_t u_int32_t;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwtypedef uint16_t u_int16_t;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwtypedef kstat_t *p_kstat_t;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define os_printf printf
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define memcpy(dst, src, cnt) bcopy((src), (dst), (cnt))
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define adapter_name(chp) (chp->ch_name)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwtypedef struct ch adapter_t;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define DELAY_US(x) DELAY(x)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define DELAY_MS(x) DELAY(1000*(x))
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define TPI_LOCK(obj) mutex_enter(&obj->ch_lock);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define TPI_UNLOCK(obj) mutex_exit(&obj->ch_lock);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define MAC_LOCK(lock) mutex_enter(&(lock))
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define MAC_UNLOCK(lock) mutex_exit(&(lock))
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define __tpi_read tpi_read
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define __tpi_write tpi_write
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwstruct t1_rx_mode {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw struct ch *chp;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw struct ch_mc *mc;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw};
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define t1_rx_mode_promisc(rmp) (rmp->chp->ch_flags & PEPROMISC)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define t1_rx_mode_allmulti(rmp) (rmp->chp->ch_flags & PEALLMULTI)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define t1_rx_mode_mc_cnt(rmp) (rmp->chp->ch_mc_cnt)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwuint8_t *t1_get_next_mcaddr(struct t1_rx_mode *);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define __devinit
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwvoid t1_os_elmer0_ext_intr(adapter_t *adapter);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwvoid t1_os_link_changed(ch_t *adapter, int port_id, int link_status,
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw int speed, int duplex, int fc);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define CH_DBG(fmt, ...)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define CH_MSG(fmt, ...)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define t1_os_set_hw_addr(a, b, c) memcpy(a->port[b].enaddr, c, ETH_ALEN)
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw/* kludge for now */
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define port_name(adapter, i) "chxge"
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define SPINLOCK kmutex_t
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define SPIN_LOCK_INIT(x) mutex_init(&(x), NULL, MUTEX_DRIVER, NULL);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#undef SPIN_LOCK
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define SPIN_LOCK(x) mutex_enter(&(x))
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define SPIN_UNLOCK(x) mutex_exit(&(x))
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define SPIN_TRYLOCK(x) mutex_tryenter(&(x))
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#define SPIN_LOCK_DESTROY(x) mutex_destroy(&(x))
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwtypedef struct ch_cyclic_s {
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw timeout_id_t timer;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw void (*func)(void *);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw void *arg;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw clock_t period;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw} ch_cyclic_t, *p_ch_cyclic_t;
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwvoid ch_init_cyclic(void *, p_ch_cyclic_t, void (*)(void *), void *);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwvoid ch_start_cyclic(p_ch_cyclic_t, unsigned long);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwvoid ch_stop_cyclic(p_ch_cyclic_t);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xwvoid ch_cyclic(p_ch_cyclic_t);
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#ifdef __cplusplus
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw}
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#endif
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw
d39a76e7b087a3d0927cbe6898dc0a6770fa6c68xw#endif /* _CHELSIO_OSDEP_H */