1998-12-27 21:47:14 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1998 Eivind Eklund. All rights reserved.
|
|
|
|
*
|
1999-12-14 20:48:35 +00:00
|
|
|
* Copyright (c) 1998, 1999 German Tischler. All rights reserved.
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
2000-10-09 13:29:00 +00:00
|
|
|
* Copyright (c) 1998, 2000 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.
|
|
|
|
* 3. Neither the name of the author nor the names of any co-contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
* 4. Altered versions must be plainly marked as such, and must not be
|
|
|
|
* misrepresented as being the original software and/or documentation.
|
|
|
|
*
|
|
|
|
* 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_pnp.c - i4b pnp support
|
|
|
|
* --------------------------------
|
|
|
|
*
|
2000-10-09 13:29:00 +00:00
|
|
|
* $Id: i4b_isic_pnp.c,v 1.2 2000/03/09 16:12:51 hm Exp $
|
1999-12-14 20:48:35 +00:00
|
|
|
*
|
1999-08-28 01:08:13 +00:00
|
|
|
* $FreeBSD$
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
2000-10-09 13:29:00 +00:00
|
|
|
* last edit-date: [Thu Mar 9 16:04:10 2000]
|
1998-12-27 21:47:14 +00:00
|
|
|
*
|
|
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#include "isic.h"
|
|
|
|
#include "opt_i4b.h"
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
#if (NISIC > 0)
|
1998-12-27 21:47:14 +00:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.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 <isa/isavar.h>
|
|
|
|
|
1999-08-06 14:05:10 +00:00
|
|
|
#define VID_TEL163PNP 0x10212750 /* Teles 16.3 PnP */
|
|
|
|
#define VID_CREATIXPP 0x0000980e /* Creatix S0/16 P+P */
|
|
|
|
#define VID_DYNALINK 0x88167506 /* Dynalink */
|
|
|
|
#define VID_SEDLBAUER 0x0100274c /* Sedlbauer WinSpeed */
|
|
|
|
#define VID_NICCYGO 0x5001814c /* Neuhaus Niccy GO@ */
|
|
|
|
#define VID_ELSAQS1P 0x33019315 /* ELSA Quickstep1000pro*/
|
|
|
|
#define VID_ITK0025 0x25008b26 /* ITK Ix1 Micro V3 */
|
|
|
|
#define VID_AVMPNP 0x0009cd06 /* AVM Fritz! PnP */
|
|
|
|
#define VID_SIESURF2 0x2000254d /* Siemens I-Surf 2.0 PnP*/
|
|
|
|
#define VID_ASUSCOM_IPAC 0x90167506 /* Asuscom (with IPAC) */
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
static struct isic_pnp_ids {
|
1998-12-27 21:47:14 +00:00
|
|
|
u_long vend_id;
|
|
|
|
char *id_str;
|
1999-12-14 20:48:35 +00:00
|
|
|
} isic_pnp_ids[] = {
|
|
|
|
#if defined(TEL_S0_16_3_P) || defined(CRTX_S0_P)
|
|
|
|
{ VID_TEL163PNP, "Teles S0/16.3 PnP" },
|
|
|
|
{ VID_CREATIXPP, "Creatix S0/16 PnP" },
|
|
|
|
#endif
|
|
|
|
#ifdef DYNALINK
|
1999-08-06 14:05:10 +00:00
|
|
|
{ VID_DYNALINK, "Dynalink IS64PH" },
|
1999-12-14 20:48:35 +00:00
|
|
|
#endif
|
|
|
|
#ifdef SEDLBAUER
|
1999-08-06 14:05:10 +00:00
|
|
|
{ VID_SEDLBAUER, "Sedlbauer WinSpeed" },
|
1999-12-14 20:48:35 +00:00
|
|
|
#endif
|
|
|
|
#ifdef DRN_NGO
|
1999-08-06 14:05:10 +00:00
|
|
|
{ VID_NICCYGO, "Dr.Neuhaus Niccy Go@" },
|
1999-12-14 20:48:35 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ELSA_QS1ISA
|
1999-08-06 14:05:10 +00:00
|
|
|
{ VID_ELSAQS1P, "ELSA QuickStep 1000pro" },
|
1999-12-14 20:48:35 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ITKIX1
|
1999-08-06 14:05:10 +00:00
|
|
|
{ VID_ITK0025, "ITK ix1 Micro V3.0" },
|
1999-12-14 20:48:35 +00:00
|
|
|
#endif
|
|
|
|
#ifdef AVM_PNP
|
1999-08-06 14:05:10 +00:00
|
|
|
{ VID_AVMPNP, "AVM Fritz!Card PnP" },
|
1999-12-14 20:48:35 +00:00
|
|
|
#endif
|
|
|
|
#ifdef SIEMENS_ISURF2
|
1999-08-06 14:05:10 +00:00
|
|
|
{ VID_SIESURF2, "Siemens I-Surf 2.0 PnP" },
|
1999-12-14 20:48:35 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ASUSCOM_IPAC
|
1999-08-06 14:05:10 +00:00
|
|
|
{ VID_ASUSCOM_IPAC, "Asuscom ISDNLink 128 PnP" },
|
1999-12-14 20:48:35 +00:00
|
|
|
#endif
|
|
|
|
{ 0, 0 }
|
1998-12-27 21:47:14 +00:00
|
|
|
};
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
static int isic_pnp_probe(device_t dev);
|
|
|
|
static int isic_pnp_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_pnp_methods[] = {
|
|
|
|
DEVMETHOD(device_probe, isic_pnp_probe),
|
|
|
|
DEVMETHOD(device_attach, isic_pnp_attach),
|
|
|
|
{ 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static driver_t isic_pnp_driver = {
|
|
|
|
"isic",
|
|
|
|
isic_pnp_methods,
|
|
|
|
0,
|
1998-12-27 21:47:14 +00:00
|
|
|
};
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
static devclass_t isic_devclass;
|
|
|
|
|
|
|
|
DRIVER_MODULE(isicpnp, isa, isic_pnp_driver, isic_devclass, 0, 0);
|
1998-12-27 21:47:14 +00:00
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
1999-12-14 20:48:35 +00:00
|
|
|
* probe for ISA PnP cards
|
1998-12-27 21:47:14 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
1999-12-14 20:48:35 +00:00
|
|
|
int
|
|
|
|
isic_pnp_probe(device_t dev)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
struct isic_pnp_ids *ids; /* pnp id's */
|
|
|
|
char *string = NULL; /* the name */
|
|
|
|
u_int32_t vend_id = isa_get_vendorid(dev); /* vendor id */
|
1998-12-27 21:47:14 +00:00
|
|
|
|
|
|
|
/* search table of knowd id's */
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
for(ids = isic_pnp_ids; ids->vend_id != 0; ids++)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
|
|
|
if(vend_id == ids->vend_id)
|
|
|
|
{
|
|
|
|
string = ids->id_str;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-12-14 20:48:35 +00:00
|
|
|
|
|
|
|
if(string) /* set name if we have one */
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
device_set_desc(dev, string); /* set description */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return ENXIO;
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------*
|
1999-12-14 20:48:35 +00:00
|
|
|
* attach for ISA PnP cards
|
1998-12-27 21:47:14 +00:00
|
|
|
*---------------------------------------------------------------------------*/
|
1999-12-14 20:48:35 +00:00
|
|
|
int
|
|
|
|
isic_pnp_attach(device_t dev)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
u_int32_t vend_id = isa_get_vendorid(dev); /* vendor id */
|
|
|
|
unsigned int unit = device_get_unit(dev); /* get unit */
|
|
|
|
const char *name = device_get_desc(dev); /* get description */
|
|
|
|
struct l1_softc *sc = 0; /* softc */
|
|
|
|
void *ih = 0; /* a dummy */
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* see if we are out of bounds */
|
|
|
|
|
|
|
|
if(unit >= ISIC_MAXUNIT)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
printf("isic%d: Error, unit %d >= ISIC_MAXUNIT for %s\n", unit, unit, name);
|
|
|
|
return ENXIO;
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
/* get information structure for this unit */
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
sc = &l1_sc[unit];
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
/* get io_base */
|
|
|
|
if(!(sc->sc_resources.io_base[0] =
|
|
|
|
bus_alloc_resource(dev, SYS_RES_IOPORT,
|
|
|
|
&sc->sc_resources.io_rid[0],
|
|
|
|
0UL, ~0UL, 1, RF_ACTIVE ) ))
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
printf("isic_pnp_attach: Couldn't get my io_base.\n");
|
|
|
|
return ENXIO;
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
/* will not be used for pnp devices */
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
sc->sc_port = rman_get_start(sc->sc_resources.io_base[0]);
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
/* get irq, release io_base if we don't get it */
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
if(!(sc->sc_resources.irq =
|
|
|
|
bus_alloc_resource(dev, SYS_RES_IRQ,
|
|
|
|
&sc->sc_resources.irq_rid,
|
|
|
|
0UL, ~0UL, 1, RF_ACTIVE)))
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
printf("isic%d: Could not get irq.\n",unit);
|
|
|
|
isic_detach_common(dev);
|
|
|
|
return ENXIO;
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
1999-12-14 20:48:35 +00:00
|
|
|
|
|
|
|
/* not needed */
|
|
|
|
sc->sc_irq = rman_get_start(sc->sc_resources.irq);
|
1998-12-27 21:47:14 +00:00
|
|
|
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
/* set flag so we know what this card is */
|
1998-12-27 21:47:14 +00:00
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
ret = ENXIO;
|
|
|
|
|
|
|
|
switch(vend_id)
|
1998-12-27 21:47:14 +00:00
|
|
|
{
|
1999-12-14 20:48:35 +00:00
|
|
|
#if defined(TEL_S0_16_3_P) || defined(CRTX_S0_P)
|
|
|
|
case VID_TEL163PNP:
|
|
|
|
sc->sc_flags = FLAG_TELES_S0_163_PnP;
|
|
|
|
ret = isic_attach_Cs0P(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
case VID_CREATIXPP:
|
|
|
|
sc->sc_flags = FLAG_CREATIX_S0_PnP;
|
|
|
|
ret = isic_attach_Cs0P(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
1999-12-14 20:48:35 +00:00
|
|
|
#ifdef DYNALINK
|
|
|
|
case VID_DYNALINK:
|
|
|
|
sc->sc_flags = FLAG_DYNALINK;
|
|
|
|
ret = isic_attach_Dyn(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef SEDLBAUER
|
1999-12-14 20:48:35 +00:00
|
|
|
case VID_SEDLBAUER:
|
|
|
|
sc->sc_flags = FLAG_SWS;
|
|
|
|
ret = isic_attach_sws(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
1999-12-14 20:48:35 +00:00
|
|
|
#ifdef DRN_NGO
|
|
|
|
case VID_NICCYGO:
|
|
|
|
sc->sc_flags = FLAG_DRN_NGO;
|
|
|
|
ret = isic_attach_drnngo(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef ELSA_QS1ISA
|
1999-12-14 20:48:35 +00:00
|
|
|
case VID_ELSAQS1P:
|
|
|
|
sc->sc_flags = FLAG_ELSA_QS1P_ISA;
|
|
|
|
ret = isic_attach_Eqs1pi(dev);
|
1998-12-27 21:47:14 +00:00
|
|
|
break;
|
|
|
|
#endif
|
1999-08-06 14:05:10 +00:00
|
|
|
#ifdef ITKIX1
|
1999-12-14 20:48:35 +00:00
|
|
|
case VID_ITK0025:
|
|
|
|
sc->sc_flags = FLAG_ITK_IX1;
|
|
|
|
ret = isic_attach_itkix1(dev);
|
1999-08-06 14:05:10 +00:00
|
|
|
break;
|
1999-12-14 20:48:35 +00:00
|
|
|
#endif
|
1999-08-06 14:05:10 +00:00
|
|
|
#ifdef AVM_PNP
|
1999-12-14 20:48:35 +00:00
|
|
|
case VID_AVMPNP:
|
|
|
|
sc->sc_flags = FLAG_AVM_PNP;
|
|
|
|
ret = isic_attach_avm_pnp(dev);
|
1999-08-06 14:05:10 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef SIEMENS_ISURF2
|
1999-12-14 20:48:35 +00:00
|
|
|
case VID_SIESURF2:
|
|
|
|
sc->sc_flags = FLAG_SIEMENS_ISURF2;
|
|
|
|
ret = isic_attach_siemens_isurf(dev);
|
1999-08-06 14:05:10 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef ASUSCOM_IPAC
|
1999-12-14 20:48:35 +00:00
|
|
|
case VID_ASUSCOM_IPAC:
|
|
|
|
sc->sc_flags = FLAG_ASUSCOM_IPAC;
|
|
|
|
ret = isic_attach_asi(dev);
|
1999-08-06 14:05:10 +00:00
|
|
|
break;
|
|
|
|
#endif
|
1998-12-27 21:47:14 +00:00
|
|
|
default:
|
1999-12-14 20:48:35 +00:00
|
|
|
printf("isic%d: Error, no driver for %s\n", unit, name);
|
|
|
|
ret = ENXIO;
|
|
|
|
break;
|
1998-12-27 21:47:14 +00:00
|
|
|
}
|
|
|
|
|
1999-12-14 20:48:35 +00:00
|
|
|
if(ret)
|
|
|
|
{
|
|
|
|
isic_detach_common(dev);
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(isic_attach_common(dev))
|
|
|
|
{
|
|
|
|
/* unset flag */
|
|
|
|
sc->sc_flags = 0;
|
|
|
|
|
|
|
|
/* free irq here, it hasn't been attached yet */
|
|
|
|
bus_release_resource(dev,SYS_RES_IRQ,sc->sc_resources.irq_rid,
|
|
|
|
sc->sc_resources.irq);
|
|
|
|
sc->sc_resources.irq = 0;
|
|
|
|
isic_detach_common(dev);
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* setup intr routine */
|
|
|
|
bus_setup_intr(dev,sc->sc_resources.irq,INTR_TYPE_NET,
|
|
|
|
(void(*)(void*))isicintr,
|
|
|
|
sc,&ih);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* (NISIC > 0) */
|