Move the isa parts to a separate file.

This commit is contained in:
John Hay 2001-04-16 13:20:39 +00:00
parent 24dbea46a9
commit 0d1b4aef96
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75541
6 changed files with 6 additions and 2447 deletions

View File

@ -96,7 +96,7 @@ crypto/des/des_ecb.c optional netsmbcrypto
crypto/des/des_setkey.c optional netsmbcrypto
dev/advansys/adv_isa.c optional adv isa
dev/aic/aic_isa.c optional aic isa
#dev/ar/if_ar_isa.c optional ar isa
dev/ar/if_ar_isa.c optional ar isa
dev/ed/if_ed_isa.c optional ed isa
dev/eisa/eisaconf.c optional eisa
dev/fb/fb.c optional fb

View File

@ -93,7 +93,7 @@ crypto/des/des_ecb.c optional netsmbcrypto
crypto/des/des_setkey.c optional netsmbcrypto
#dev/advansys/adv_isa.c optional adv isa
dev/aic/aic_cbus.c optional aic isa
#dev/ar/if_ar_isa.c optional ar isa
dev/ar/if_ar_isa.c optional ar isa
dev/ct/bshw_machdep.c optional ct
dev/ct/ct.c optional ct
dev/ct/ct_isa.c optional ct isa

View File

@ -62,9 +62,6 @@
#include <machine/bus_memio.h>
#include <sys/rman.h>
#include <isa/isavar.h>
#include "isa_if.h"
#include <net/if.h>
#ifdef NETGRAPH
#include <netgraph/ng_message.h>
@ -181,29 +178,6 @@ static int irqtable[16] = {
7 /* 15 */
};
static int ar_isa_probe (device_t);
static int ar_isa_attach (device_t);
static struct isa_pnp_id ar_ids[] = {
{0, NULL}
};
static device_method_t ar_methods[] = {
DEVMETHOD(device_probe, ar_isa_probe),
DEVMETHOD(device_attach, ar_isa_attach),
DEVMETHOD(device_detach, ar_detach),
{ 0, 0 }
};
static driver_t ar_isa_driver = {
"ar",
ar_methods,
sizeof (struct ar_hardc)
};
devclass_t ar_devclass;
DRIVER_MODULE(if_ar, isa, ar_isa_driver, ar_devclass, 0, 0);
#ifndef NETGRAPH
MODULE_DEPEND(if_ar, sppp, 1, 1, 1);
#else
@ -268,140 +242,6 @@ static struct ng_type typestruct = {
static int ngar_done_init = 0;
#endif /* NETGRAPH */
/*
* Probe to see if it is there.
* Get its information and fill it in.
*/
static int
ar_isa_probe(device_t device)
{
int error;
u_long membase, memsize, port_start, port_count;
error = ISA_PNP_PROBE(device_get_parent(device), device, ar_ids);
if(error == ENXIO || error == 0)
return (error);
if((error = ar_allocate_ioport(device, 0, ARC_IO_SIZ))) {
return (ENXIO);
}
/*
* Now see if the card is realy there.
*
* XXX For now I just check the undocumented ports
* for "570". We will probably have to do more checking.
*/
error = bus_get_resource(device, SYS_RES_IOPORT, 0, &port_start,
&port_count);
if((inb(port_start + AR_ID_5) != '5') ||
(inb(port_start + AR_ID_7) != '7') ||
(inb(port_start + AR_ID_0) != '0')) {
ar_deallocate_resources(device);
return (ENXIO);
}
membase = bus_get_resource_start(device, SYS_RES_MEMORY, 0);
memsize = inb(port_start + AR_REV);
memsize = 1 << ((memsize & AR_WSIZ_MSK) >> AR_WSIZ_SHFT);
memsize *= ARC_WIN_SIZ;
error = bus_set_resource(device, SYS_RES_MEMORY, 0, membase, memsize);
ar_deallocate_resources(device);
return (error);
}
/*
* Malloc memory for the softc structures.
* Reset the card to put it in a known state.
* Register the ports on the adapter.
* Fill in the info for each port.
* Attach each port to sppp and bpf.
*/
static int
ar_isa_attach(device_t device)
{
u_int tmp;
u_long irq, junk;
struct ar_hardc *hc;
hc = (struct ar_hardc *)device_get_softc(device);
if(ar_allocate_ioport(device, 0, ARC_IO_SIZ))
return (ENXIO);
hc->bt = rman_get_bustag(hc->res_ioport);
hc->bh = rman_get_bushandle(hc->res_ioport);
hc->iobase = rman_get_start(hc->res_ioport);
tmp = inb(hc->iobase + AR_BMI);
hc->bustype = tmp & AR_BUS_MSK;
hc->memsize = (tmp & AR_MEM_MSK) >> AR_MEM_SHFT;
hc->memsize = 1 << hc->memsize;
hc->memsize <<= 16;
hc->interface[0] = (tmp & AR_IFACE_MSK);
hc->interface[1] = hc->interface[0];
hc->interface[2] = hc->interface[0];
hc->interface[3] = hc->interface[0];
tmp = inb(hc->iobase + AR_REV);
hc->revision = tmp & AR_REV_MSK;
hc->winsize = 1 << ((tmp & AR_WSIZ_MSK) >> AR_WSIZ_SHFT);
hc->winsize *= ARC_WIN_SIZ;
hc->winmsk = hc->winsize - 1;
hc->numports = inb(hc->iobase + AR_PNUM);
hc->handshake = inb(hc->iobase + AR_HNDSH);
if(ar_allocate_memory(device, 0, hc->winsize))
return (ENXIO);
hc->mem_start = rman_get_virtual(hc->res_memory);
hc->mem_end = hc->mem_start + hc->winsize;
hc->cunit = device_get_unit(device);
switch(hc->interface[0]) {
case AR_IFACE_EIA_232:
printf("ar%d: The EIA 232 interface is not supported.\n",
hc->cunit);
ar_deallocate_resources(device);
return (ENXIO);
case AR_IFACE_V_35:
break;
case AR_IFACE_EIA_530:
printf("ar%d: WARNING: The EIA 530 interface is untested.\n",
hc->cunit);
break;
case AR_IFACE_X_21:
break;
case AR_IFACE_COMBO:
printf("ar%d: WARNING: The COMBO interface is untested.\n",
hc->cunit);
break;
}
/*
* Do a little sanity check.
*/
if((hc->numports > NPORT) || (hc->memsize > (512*1024))) {
ar_deallocate_resources(device);
return (ENXIO);
}
if(ar_allocate_irq(device, 0, 1))
return (ENXIO);
if(bus_get_resource(device, SYS_RES_IRQ, 0, &irq, &junk)) {
ar_deallocate_resources(device);
return (ENXIO);
}
hc->isa_irq = irq;
if(ar_attach(device)) {
ar_deallocate_resources(device);
return (ENXIO);
}
return (0);
}
int
ar_attach(device_t device)
{

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
.PATH: ${.CURDIR}/../../dev/ar
KMOD = if_ar
SRCS = if_ar.c if_ar_pci.c
SRCS = if_ar.c if_ar_isa.c if_ar_pci.c
SRCS += device_if.h bus_if.h pci_if.h isa_if.h opt_netgraph.h
.include <bsd.kmod.mk>

View File

@ -2,7 +2,7 @@
.PATH: ${.CURDIR}/../../../dev/ar
KMOD = ng_sync_ar
SRCS = if_ar.c if_ar_pci.c
SRCS = if_ar.c if_ar_isa.c if_ar_pci.c
SRCS += device_if.h bus_if.h pci_if.h isa_if.h opt_netgraph.h
opt_netgraph.h: