1998-12-27 21:47:14 +00:00
|
|
|
/*
|
1999-03-07 16:08:20 +00:00
|
|
|
* Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* i4b_isic_isa.c - ISA bus interface
|
|
|
|
* ==================================
|
|
|
|
*
|
1999-12-14 20:48:35 +00:00
|
|
|
* $Id: i4b_isic_isa.c,v 1.4 1999/12/13 21:25:26 hm Exp $
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
1999-12-14 20:48:35 +00:00
|
|
|
* $FreeBSD$
|
|
|
|
*
|
|
|
|
* last edit-date: [Mon Dec 13 22:01:39 1999]
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "isic.h"
|
|
|
|
#include "opt_i4b.h"
|
1999-12-14 20:48:35 +00:00
|
|
|
|
1998-12-27 21:47:14 +00:00
|
|
|
#if NISIC > 0
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/ioccom.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/mbuf.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <net/if.h>
|
|
|
|
|
|
|
|
#include <machine/clock.h>
|
|
|
|
|
|
|
|
#include <machine/i4b_debug.h>
|
|
|
|
#include <machine/i4b_ioctl.h>
|
|
|
|
#include <machine/i4b_trace.h>
|
|
|
|
|
|
|
|
#include <i4b/layer1/i4b_l1.h>
|
|
|
|
#include <i4b/layer1/i4b_ipac.h>
|
|
|
|
#include <i4b/layer1/i4b_isac.h>
|
|
|
|
#include <i4b/layer1/i4b_hscx.h>
|
|
|
|
|
|
|
|
#include <i4b/include/i4b_l1l2.h>
|
|
|
|
#include <i4b/include/i4b_mbuf.h>
|
|
|
|
#include <i4b/include/i4b_global.h>
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <isa/isavar.h>
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
struct l1_softc l1_sc[ISIC_MAXUNIT];
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
static int isic_isa_probe(device_t dev);
|
|
|
|
static int isic_isa_attach(device_t dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
static device_method_t isic_methods[] = {
|
|
|
|
DEVMETHOD(device_probe, isic_isa_probe),
|
|
|
|
DEVMETHOD(device_attach, isic_isa_attach),
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
static driver_t isic_driver = {
|
1998-12-27 21:47:14 +00:00
|
|
|
"isic",
|
1999-12-14 20:48:35 +00:00
|
|
|
isic_methods,
|
1998-12-27 21:47:14 +00:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
static devclass_t isic_devclass;
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
DRIVER_MODULE(isic, isa, isic_driver, isic_devclass, 0, 0);
|
1998-12-27 21:47:14 +00:00
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
1999-12-14 20:48:35 +00:00
|
|
|
* probe for ISA non-PnP cards
|
1998-12-27 21:47:14 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
static int
|
1999-12-14 20:48:35 +00:00
|
|
|
isic_isa_probe(device_t dev)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
int ret = ENXIO;
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
if(isa_get_vendorid(dev)) /* no PnP probes here */
|
|
|
|
return ENXIO;
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
switch(device_get_flags(dev))
|
|
|
|
{
|
1998-12-27 21:47:14 +00:00
|
|
|
#ifdef TEL_S0_16
|
|
|
|
case FLAG_TELES_S0_16:
|
|
|
|
ret = isic_probe_s016(dev);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
1999-03-07 16:08:20 +00:00
|
|
|
#ifdef TEL_S0_8
|
|
|
|
case FLAG_TELES_S0_8:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_probe_s08(dev);
|
1999-03-07 16:08:20 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
#ifdef ELSA_PCC16
|
|
|
|
case FLAG_ELSA_PCC16:
|
|
|
|
ret = isic_probe_Epcc16(dev);
|
1999-03-07 16:08:20 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TEL_S0_16_3
|
|
|
|
case FLAG_TELES_S0_163:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_probe_s0163(dev);
|
1999-03-07 16:08:20 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef AVM_A1
|
|
|
|
case FLAG_AVM_A1:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_probe_avma1(dev);
|
1999-03-07 16:08:20 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USR_STI
|
|
|
|
case FLAG_USR_ISDN_TA_INT:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_probe_usrtai(dev);
|
1999-03-07 16:08:20 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ITKIX1
|
|
|
|
case FLAG_ITK_IX1:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_probe_itkix1(dev);
|
1999-05-20 10:14:57 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
1999-03-07 16:08:20 +00:00
|
|
|
default:
|
1999-12-14 20:48:35 +00:00
|
|
|
printf("isic%d: probe, unknown flag: %d\n",
|
|
|
|
device_get_unit(dev), device_get_flags(dev));
|
1999-03-07 16:08:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return(ret);
|
|
|
|
}
|
1998-12-27 21:47:14 +00:00
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
1999-12-14 20:48:35 +00:00
|
|
|
* attach for ISA non-PnP cards
|
1998-12-27 21:47:14 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
1999-12-14 20:48:35 +00:00
|
|
|
static int
|
|
|
|
isic_isa_attach(device_t dev)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
int ret = ENXIO;
|
1999-08-06 14:05:10 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
struct l1_softc *sc = &l1_sc[device_get_unit(dev)];
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
sc->sc_unit = device_get_unit(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
|
|
|
|
/* card dependent setup */
|
1999-12-14 20:48:35 +00:00
|
|
|
|
|
|
|
switch(sc->sc_flags)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
#ifdef TEL_S0_16
|
|
|
|
case FLAG_TELES_S0_16:
|
|
|
|
ret = isic_attach_s016(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TEL_S0_8
|
|
|
|
case FLAG_TELES_S0_8:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_attach_s08(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
#ifdef ELSA_PCC16
|
|
|
|
case FLAG_ELSA_PCC16:
|
|
|
|
ret = isic_attach_Epcc16(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TEL_S0_16_3
|
|
|
|
case FLAG_TELES_S0_163:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_attach_s0163(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef AVM_A1
|
|
|
|
case FLAG_AVM_A1:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_attach_avma1(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USR_STI
|
|
|
|
case FLAG_USR_ISDN_TA_INT:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_attach_usrtai(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ITKIX1
|
|
|
|
case FLAG_ITK_IX1:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_attach_itkix1(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
1999-12-14 20:48:35 +00:00
|
|
|
printf("isic%d: attach, unknown flag: %d\n",
|
|
|
|
device_get_unit(dev), device_get_flags(dev));
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
if(ret)
|
|
|
|
return(ret);
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_attach_common(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
return(ret);
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
#endif /* NISIC > 0 */
|