1998-12-27 21:47:14 +00:00
|
|
|
/*
|
2001-01-24 08:41:52 +00:00
|
|
|
* Copyright (c) 1997, 2001 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
|
|
|
* $FreeBSD$
|
|
|
|
*
|
2001-01-24 08:41:52 +00:00
|
|
|
* last edit-date: [Wed Jan 24 09:30:19 2001]
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "opt_i4b.h"
|
1999-12-14 20:48:35 +00:00
|
|
|
|
1998-12-27 21:47:14 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <net/if.h>
|
|
|
|
|
|
|
|
#include <machine/i4b_ioctl.h>
|
|
|
|
|
2000-10-09 13:29:00 +00:00
|
|
|
#include <i4b/layer1/isic/i4b_isic.h>
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
#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
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_16:
|
1998-12-27 21:47:14 +00:00
|
|
|
ret = isic_probe_s016(dev);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
1999-03-07 16:08:20 +00:00
|
|
|
#ifdef TEL_S0_8
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_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
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_PCC16:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_probe_Epcc16(dev);
|
1999-03-07 16:08:20 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TEL_S0_16_3
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_16_3:
|
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
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_AVMA1:
|
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
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_USRTA:
|
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
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_ITKIX1:
|
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
|
|
|
|
2001-01-24 08:41:52 +00:00
|
|
|
switch(sc->sc_cardtyp)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
#ifdef TEL_S0_16
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_16:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_attach_s016(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TEL_S0_8
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_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
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_PCC16:
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = isic_attach_Epcc16(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TEL_S0_16_3
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_16_3:
|
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
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_AVMA1:
|
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
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_USRTA:
|
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
|
2001-01-24 08:41:52 +00:00
|
|
|
case CARD_TYPEP_ITKIX1:
|
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
|
|
|
}
|