Remove Micro Channel Architecture support. Of the commonly available
machines, only a few 486 machines that used it, and those haven't had enough memory to run FreeBSD for quite some time (often limited to 16MB). Not to be confused with the Machine Check Architecture, which is still very much alive and used (and untouched by this commit). No Objection From: arch@
This commit is contained in:
parent
bde1425228
commit
5e19920be6
@ -74,10 +74,6 @@ locations and attaches to the first unattached card it finds.
|
||||
The possible
|
||||
port addresses for this card are 0x330, 0x334, 0x230, 0x234, 0x130, and
|
||||
0x134.
|
||||
.Pp
|
||||
The AHA-1640 is an MCA bus card.
|
||||
Since the MCA bus is a self-identifying bus, no setting of hints is
|
||||
required.
|
||||
.Sh HARDWARE
|
||||
The
|
||||
.Nm
|
||||
|
@ -204,19 +204,6 @@ bus Ethernet adapters.
|
||||
.\" .It
|
||||
.\" .Tn DEC DE422
|
||||
.\" .El
|
||||
.\" .Ss MCA
|
||||
.\" The
|
||||
.\" .Tn MCA
|
||||
.\" bus Ethernet cards supported by the
|
||||
.\" .Nm
|
||||
.\" driver are:
|
||||
.\" .Pp
|
||||
.\" .Bl -bullet -compact
|
||||
.\" .It
|
||||
.\" .Tn SKNET Personal MC2
|
||||
.\" .It
|
||||
.\" .Tn SKNET MC2+
|
||||
.\" .El
|
||||
.Ss PCI
|
||||
The
|
||||
.Tn PCI
|
||||
|
@ -95,8 +95,6 @@ driver supports Ethernet adapters based on the
|
||||
.It
|
||||
3Com 3C509B-TP, 3C509B-BNC, 3C509B-Combo, 3C509B-TPO, 3C509B-TPC ISA
|
||||
.It
|
||||
3Com 3C529, 3C529-TP MCA
|
||||
.It
|
||||
3Com 3C562/3C563 PCMCIA
|
||||
.It
|
||||
3Com 3C574, 3C574TX, 3C574-TX, 3CCFE574BT, 3CXFE574BT, 3C3FE574BT PCMCIA
|
||||
|
@ -694,7 +694,6 @@ dev/agp/agp.c optional agp pci
|
||||
dev/agp/agp_if.m optional agp pci
|
||||
dev/aha/aha.c optional aha
|
||||
dev/aha/aha_isa.c optional aha isa
|
||||
dev/aha/aha_mca.c optional aha mca
|
||||
dev/ahb/ahb.c optional ahb eisa
|
||||
dev/ahci/ahci.c optional ahci
|
||||
dev/ahci/ahciem.c optional ahci
|
||||
@ -1265,7 +1264,6 @@ dev/bnxt/if_bnxt.c optional bnxt iflib pci
|
||||
dev/buslogic/bt.c optional bt
|
||||
dev/buslogic/bt_eisa.c optional bt eisa
|
||||
dev/buslogic/bt_isa.c optional bt isa
|
||||
dev/buslogic/bt_mca.c optional bt mca
|
||||
dev/buslogic/bt_pci.c optional bt pci
|
||||
dev/bwi/bwimac.c optional bwi
|
||||
dev/bwi/bwiphy.c optional bwi
|
||||
@ -1609,7 +1607,6 @@ dev/en/midway.c optional en
|
||||
dev/ep/if_ep.c optional ep
|
||||
dev/ep/if_ep_eisa.c optional ep eisa
|
||||
dev/ep/if_ep_isa.c optional ep isa
|
||||
dev/ep/if_ep_mca.c optional ep mca
|
||||
dev/ep/if_ep_pccard.c optional ep pccard
|
||||
dev/esp/esp_pci.c optional esp pci
|
||||
dev/esp/ncr53c9x.c optional esp
|
||||
@ -2176,7 +2173,6 @@ dev/malo/if_malo.c optional malo
|
||||
dev/malo/if_malohal.c optional malo
|
||||
dev/malo/if_malo_pci.c optional malo pci
|
||||
dev/mc146818/mc146818.c optional mc146818
|
||||
dev/mca/mca_bus.c optional mca
|
||||
dev/md/md.c optional md
|
||||
dev/mdio/mdio_if.m optional miiproxy | mdio
|
||||
dev/mdio/mdio.c optional miiproxy | mdio
|
||||
|
@ -474,7 +474,6 @@ acpi_wakedata.h optional acpi \
|
||||
clean "acpi_wakedata.h"
|
||||
#
|
||||
i386/bios/apm.c optional apm
|
||||
i386/bios/mca_machdep.c optional mca
|
||||
i386/bios/smapi.c optional smapi
|
||||
i386/bios/smapi_bios.S optional smapi
|
||||
i386/cloudabi32/cloudabi32_sysvec.c optional compat_cloudabi32
|
||||
|
@ -723,7 +723,6 @@ ISAPNP opt_isa.h
|
||||
# various 'device presence' options.
|
||||
DEV_BPF opt_bpf.h
|
||||
DEV_CARP opt_carp.h
|
||||
DEV_MCA opt_mca.h
|
||||
DEV_NETMAP opt_global.h
|
||||
DEV_PCI opt_pci.h
|
||||
DEV_PF opt_pf.h
|
||||
|
@ -1,231 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Based on aha_isa.c
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
#include <dev/mca/mca_busreg.h>
|
||||
#include <dev/mca/mca_busvar.h>
|
||||
|
||||
#include <dev/aha/ahareg.h>
|
||||
|
||||
static struct mca_ident aha_mca_devs[] = {
|
||||
{ 0x0f1f, "Adaptec AHA-1640 SCSI Adapter" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
#define AHA_MCA_IOPORT_POS MCA_ADP_POS(MCA_POS1)
|
||||
# define AHA_MCA_IOPORT_MASK1 0x07
|
||||
# define AHA_MCA_IOPORT_MASK2 0xc0
|
||||
# define AHA_MCA_IOPORT_SIZE 0x03
|
||||
# define AHA_MCA_IOPORT(pos) (0x30 + \
|
||||
(((uint32_t)pos & \
|
||||
AHA_MCA_IOPORT_MASK1) << 8) + \
|
||||
(((uint32_t)pos & \
|
||||
AHA_MCA_IOPORT_MASK2) >> 4))
|
||||
|
||||
#define AHA_MCA_DRQ_POS MCA_ADP_POS(MCA_POS3)
|
||||
# define AHA_MCA_DRQ_MASK 0x0f
|
||||
# define AHA_MCA_DRQ(pos) (pos & AHA_MCA_DRQ_MASK)
|
||||
|
||||
#define AHA_MCA_IRQ_POS MCA_ADP_POS(MCA_POS2)
|
||||
# define AHA_MCA_IRQ_MASK 0x07
|
||||
# define AHA_MCA_IRQ(pos) ((pos & AHA_MCA_IRQ_MASK) + 8)
|
||||
|
||||
/*
|
||||
* Not needed as the board knows its config
|
||||
* internally and the ID will be fetched
|
||||
* via AOP_INQUIRE_SETUP_INFO command.
|
||||
*/
|
||||
#define AHA_MCA_SCSIID_POS MCA_ADP_POS(MCA_POS2)
|
||||
#define AHA_MCA_SCSIID_MASK 0xe0
|
||||
#define AHA_MCA_SCSIID(pos) ((pos & AHA_MCA_SCSIID_MASK) >> 5)
|
||||
|
||||
static int
|
||||
aha_mca_probe (device_t dev)
|
||||
{
|
||||
const char * desc;
|
||||
mca_id_t id = mca_get_id(dev);
|
||||
uint32_t iobase = 0;
|
||||
uint32_t iosize = 0;
|
||||
uint8_t drq = 0;
|
||||
uint8_t irq = 0;
|
||||
uint8_t pos;
|
||||
|
||||
desc = mca_match_id(id, aha_mca_devs);
|
||||
if (!desc)
|
||||
return (ENXIO);
|
||||
device_set_desc(dev, desc);
|
||||
|
||||
pos = mca_pos_read(dev, AHA_MCA_IOPORT_POS);
|
||||
iobase = AHA_MCA_IOPORT(pos);
|
||||
iosize = AHA_MCA_IOPORT_SIZE;
|
||||
|
||||
pos = mca_pos_read(dev, AHA_MCA_DRQ_POS);
|
||||
drq = AHA_MCA_DRQ(pos);
|
||||
|
||||
pos = mca_pos_read(dev, AHA_MCA_IRQ_POS);
|
||||
irq = AHA_MCA_IRQ(pos);
|
||||
|
||||
mca_add_iospace(dev, iobase, iosize);
|
||||
mca_add_drq(dev, drq);
|
||||
mca_add_irq(dev, irq);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
aha_mca_attach (device_t dev)
|
||||
{
|
||||
struct aha_softc * sc = device_get_softc(dev);
|
||||
int error = ENOMEM;
|
||||
|
||||
sc->portrid = 0;
|
||||
sc->port = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &sc->portrid,
|
||||
RF_ACTIVE);
|
||||
if (sc->port == NULL) {
|
||||
device_printf(dev, "No I/O space?!\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
sc->irqrid = 0;
|
||||
sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irqrid,
|
||||
RF_ACTIVE);
|
||||
if (sc->irq == NULL) {
|
||||
device_printf(dev, "No IRQ?!\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
sc->drqrid = 0;
|
||||
sc->drq = bus_alloc_resource_any(dev, SYS_RES_DRQ, &sc->drqrid,
|
||||
RF_ACTIVE);
|
||||
if (sc->drq == NULL) {
|
||||
device_printf(dev, "No DRQ?!\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
aha_alloc(sc);
|
||||
error = aha_probe(sc);
|
||||
if (error) {
|
||||
device_printf(dev, "aha_probe() failed!\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
error = aha_fetch_adapter_info(sc);
|
||||
if (error) {
|
||||
device_printf(dev, "aha_fetch_adapter_info() failed!\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
isa_dmacascade(rman_get_start(sc->drq));
|
||||
|
||||
error = bus_dma_tag_create(
|
||||
/* parent */ bus_get_dma_tag(dev),
|
||||
/* alignemnt */ 1,
|
||||
/* boundary */ 0,
|
||||
/* lowaddr */ BUS_SPACE_MAXADDR_24BIT,
|
||||
/* highaddr */ BUS_SPACE_MAXADDR,
|
||||
/* filter */ NULL,
|
||||
/* filterarg */ NULL,
|
||||
/* maxsize */ BUS_SPACE_MAXSIZE_24BIT,
|
||||
/* nsegments */ ~0,
|
||||
/* maxsegsz */ BUS_SPACE_MAXSIZE_24BIT,
|
||||
/* flags */ 0,
|
||||
/* lockfunc */ NULL,
|
||||
/* lockarg */ NULL,
|
||||
&sc->parent_dmat);
|
||||
if (error) {
|
||||
device_printf(dev, "bus_dma_tag_create() failed!\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
error = aha_init(sc);
|
||||
if (error) {
|
||||
device_printf(dev, "aha_init() failed\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
error = aha_attach(sc);
|
||||
if (error) {
|
||||
device_printf(dev, "aha_attach() failed\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
error = bus_setup_intr(dev, sc->irq, INTR_TYPE_CAM | INTR_ENTROPY |
|
||||
INTR_MPSAFE, NULL, aha_intr, sc, &sc->ih);
|
||||
if (error) {
|
||||
device_printf(dev, "Unable to register interrupt handler\n");
|
||||
aha_detach(sc);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
bad:
|
||||
aha_free(sc);
|
||||
bus_free_resource(dev, SYS_RES_IOPORT, sc->port);
|
||||
bus_free_resource(dev, SYS_RES_IRQ, sc->irq);
|
||||
bus_free_resource(dev, SYS_RES_DRQ, sc->drq);
|
||||
return (error);
|
||||
}
|
||||
|
||||
static device_method_t aha_mca_methods[] = {
|
||||
DEVMETHOD(device_probe, aha_mca_probe),
|
||||
DEVMETHOD(device_attach, aha_mca_attach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t aha_mca_driver = {
|
||||
"aha",
|
||||
aha_mca_methods,
|
||||
1,
|
||||
/*
|
||||
sizeof(struct aha_softc *),
|
||||
*/
|
||||
};
|
||||
|
||||
static devclass_t aha_devclass;
|
||||
|
||||
DRIVER_MODULE(aha, mca, aha_mca_driver, aha_devclass, 0, 0);
|
||||
MODULE_DEPEND(aha, mca, 1, 1, 1);
|
@ -1,341 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Written using the bt_isa/bt_pci code as a reference.
|
||||
*
|
||||
* Thanks to Andy Farkas <andyf@speednet.com.au> for
|
||||
* testing and feedback.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/md_var.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <dev/mca/mca_busreg.h>
|
||||
#include <dev/mca/mca_busvar.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
#include <dev/buslogic/btreg.h>
|
||||
|
||||
#include <cam/scsi/scsi_all.h>
|
||||
|
||||
static struct mca_ident bt_mca_devs[] = {
|
||||
{ 0x0708, "BusLogic 32 Bit Bus Master MCA-to-SCSI Host Adapter" },
|
||||
{ 0x0708, "BusTek BT-640A Micro Channel to SCSI Host Adapter" },
|
||||
{ 0x0708, "Storage Dimensions SDC3211B 32-bit SCSI Host Adapter" },
|
||||
{ 0x0709, "Storage Dimensions SDC3211F 32-bit FAST SCSI Host Adapter" },
|
||||
{ 0, NULL },
|
||||
};
|
||||
|
||||
#define BT_MCA_IOPORT_POS1 MCA_ADP_POS(MCA_POS0)
|
||||
#define BT_MCA_IOPORT_POS2 MCA_ADP_POS(MCA_POS1)
|
||||
#define BT_MCA_IOPORT_MASK1 0x10
|
||||
#define BT_MCA_IOPORT_MASK2 0x03
|
||||
#define BT_MCA_IOPORT_SIZE 0x03
|
||||
#define BT_MCA_IOPORT(pos) (0x30 + \
|
||||
(((u_int32_t)pos &\
|
||||
BT_MCA_IOPORT_MASK2) << 8) + \
|
||||
(((u_int32_t)pos &\
|
||||
BT_MCA_IOPORT_MASK1) >> 2))
|
||||
|
||||
#define BT_MCA_IRQ_POS MCA_ADP_POS(MCA_POS0)
|
||||
#define BT_MCA_IRQ_MASK 0x0e
|
||||
#define BT_MCA_IRQ(pos) (((pos & BT_MCA_IRQ_MASK) >> 1) + 8)
|
||||
|
||||
#define BT_MCA_DRQ_POS MCA_ADP_POS(MCA_POS3)
|
||||
#define BT_MCA_DRQ_MASK 0x0f
|
||||
#define BT_MCA_DRQ(pos) (pos & BT_MCA_DRQ_MASK)
|
||||
|
||||
#define BT_MCA_SCSIID_POS MCA_ADP_POS(MCA_POS2)
|
||||
#define BT_MCA_SCSIID_MASK 0xe0
|
||||
#define BT_MCA_SCSIID(pos) ((pos & BT_MCA_SCSIID_MASK) >> 5)
|
||||
|
||||
static bus_dma_filter_t btvlbouncefilter;
|
||||
static bus_dmamap_callback_t btmapsensebuffers;
|
||||
|
||||
static void
|
||||
bt_mca_release_resources (device_t dev)
|
||||
{
|
||||
struct bt_softc * bt = device_get_softc(dev);
|
||||
|
||||
if (bt->port)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->port);
|
||||
if (bt->irq)
|
||||
bus_release_resource(dev, SYS_RES_IRQ, 0, bt->irq);
|
||||
if (bt->drq)
|
||||
bus_release_resource(dev, SYS_RES_DRQ, 0, bt->drq);
|
||||
|
||||
bt_free_softc(dev);
|
||||
}
|
||||
|
||||
#define BT_MCA_PROBE 0
|
||||
#define BT_MCA_ATTACH 1
|
||||
|
||||
static int
|
||||
bt_mca_alloc_resources(device_t dev, int mode)
|
||||
{
|
||||
struct resource * io = NULL;
|
||||
struct resource * irq = NULL;
|
||||
struct resource * drq = NULL;
|
||||
int rid;
|
||||
|
||||
rid = 0;
|
||||
io = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE);
|
||||
if (io == NULL) {
|
||||
printf("bt_mca_alloc_resources() failed to allocate IOPORT\n");
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
if (mode == BT_MCA_ATTACH) {
|
||||
|
||||
rid = 0;
|
||||
irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
|
||||
if (irq == NULL) {
|
||||
printf("bt_mca_alloc_resources() failed to allocate IRQ\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
rid = 0;
|
||||
drq = bus_alloc_resource_any(dev, SYS_RES_DRQ, &rid, RF_ACTIVE);
|
||||
if (drq == NULL) {
|
||||
printf("bt_mca_alloc_resources() failed to allocate DRQ\n");
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
|
||||
bt_init_softc(dev, io, irq, drq);
|
||||
|
||||
return (0);
|
||||
bad:
|
||||
bt_mca_release_resources(dev);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
static int
|
||||
bt_mca_probe (device_t dev)
|
||||
{
|
||||
const char * desc;
|
||||
mca_id_t id = mca_get_id(dev);
|
||||
struct bt_probe_info info;
|
||||
u_int32_t iobase = 0;
|
||||
u_int32_t iosize = 0;
|
||||
u_int8_t drq = 0;
|
||||
u_int8_t irq = 0;
|
||||
u_int8_t pos;
|
||||
int result;
|
||||
|
||||
desc = mca_match_id(id, bt_mca_devs);
|
||||
if (!desc)
|
||||
return (ENXIO);
|
||||
device_set_desc(dev, desc);
|
||||
|
||||
pos = (mca_pos_read(dev, BT_MCA_IOPORT_POS1) & BT_MCA_IOPORT_MASK1) |
|
||||
(mca_pos_read(dev, BT_MCA_IOPORT_POS2) & BT_MCA_IOPORT_MASK2);
|
||||
iobase = BT_MCA_IOPORT(pos);
|
||||
iosize = BT_MCA_IOPORT_SIZE;
|
||||
|
||||
pos = mca_pos_read(dev, BT_MCA_DRQ_POS);
|
||||
drq = BT_MCA_DRQ(pos);
|
||||
|
||||
pos = mca_pos_read(dev, BT_MCA_IRQ_POS);
|
||||
irq = BT_MCA_IRQ(pos);
|
||||
|
||||
bt_mark_probed_iop(iobase);
|
||||
|
||||
mca_add_iospace(dev, iobase, iosize);
|
||||
|
||||
/* And allocate them */
|
||||
bt_mca_alloc_resources(dev, BT_MCA_PROBE);
|
||||
|
||||
if (bt_port_probe(dev, &info) != 0) {
|
||||
printf("bt_mca_probe: Probe failed for "
|
||||
"card at slot %d\n", mca_get_slot(dev) + 1);
|
||||
result = ENXIO;
|
||||
} else {
|
||||
mca_add_drq(dev, drq);
|
||||
mca_add_irq(dev, irq);
|
||||
result = BUS_PROBE_DEFAULT;
|
||||
}
|
||||
bt_mca_release_resources(dev);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
static int
|
||||
bt_mca_attach (device_t dev)
|
||||
{
|
||||
struct bt_softc * bt = device_get_softc(dev);
|
||||
int error = 0;
|
||||
|
||||
/* Allocate resources */
|
||||
if ((error = bt_mca_alloc_resources(dev, BT_MCA_ATTACH))) {
|
||||
device_printf(dev, "Unable to allocate resources in bt_mca_attach()\n");
|
||||
return (error);
|
||||
}
|
||||
|
||||
isa_dmacascade(rman_get_start(bt->drq));
|
||||
|
||||
/* Allocate a dmatag for our CCB DMA maps */
|
||||
if (bus_dma_tag_create( /* parent */ NULL,
|
||||
/* alignemnt */ 1,
|
||||
/* boundary */ 0,
|
||||
/* lowaddr */ BUS_SPACE_MAXADDR_24BIT,
|
||||
/* highaddr */ BUS_SPACE_MAXADDR,
|
||||
/* filter */ btvlbouncefilter,
|
||||
/* filterarg */ bt,
|
||||
/* maxsize */ BUS_SPACE_MAXSIZE_32BIT,
|
||||
/* nsegments */ ~0,
|
||||
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
|
||||
/* flags */ 0,
|
||||
/* lockfunc */ NULL,
|
||||
/* lockarg */ NULL,
|
||||
&bt->parent_dmat) != 0) {
|
||||
bt_mca_release_resources(dev);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
if (bt_init(dev)) {
|
||||
bt_mca_release_resources(dev);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
/* DMA tag for our sense buffers */
|
||||
if (bus_dma_tag_create( /* parent */ bt->parent_dmat,
|
||||
/* alignment */ 1,
|
||||
/* boundary */ 0,
|
||||
/* lowaddr */ BUS_SPACE_MAXADDR,
|
||||
/* highaddr */ BUS_SPACE_MAXADDR,
|
||||
/* filter */ NULL,
|
||||
/* filterarg */ NULL,
|
||||
/* maxsize */ bt->max_ccbs *
|
||||
sizeof(struct scsi_sense_data),
|
||||
/* nsegments */ 1,
|
||||
/* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT,
|
||||
/* flags */ 0,
|
||||
/* lockfunc */ NULL,
|
||||
/* lockarg */ NULL,
|
||||
&bt->sense_dmat) != 0) {
|
||||
bt_mca_release_resources(dev);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
bt->init_level++;
|
||||
|
||||
/* Allocation of sense buffers */
|
||||
if (bus_dmamem_alloc(bt->sense_dmat,
|
||||
(void **)&bt->sense_buffers,
|
||||
BUS_DMA_NOWAIT, &bt->sense_dmamap) != 0) {
|
||||
bt_mca_release_resources(dev);
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
||||
bt->init_level++;
|
||||
|
||||
/* And permanently map them */
|
||||
bus_dmamap_load(bt->sense_dmat, bt->sense_dmamap,
|
||||
bt->sense_buffers,
|
||||
bt->max_ccbs * sizeof(*bt->sense_buffers),
|
||||
btmapsensebuffers, bt, /*flags*/0);
|
||||
|
||||
bt->init_level++;
|
||||
|
||||
if ((error = bt_attach(dev))) {
|
||||
bt_mca_release_resources(dev);
|
||||
return (error);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* This code should be shared with the ISA
|
||||
* stubs as its exactly the same.
|
||||
*/
|
||||
|
||||
#define BIOS_MAP_SIZE (16 * 1024)
|
||||
|
||||
static int
|
||||
btvlbouncefilter(void *arg, bus_addr_t addr)
|
||||
{
|
||||
struct bt_softc *bt;
|
||||
|
||||
bt = (struct bt_softc *)arg;
|
||||
|
||||
addr &= BUS_SPACE_MAXADDR_24BIT;
|
||||
|
||||
if (addr == 0
|
||||
|| (addr >= bt->bios_addr
|
||||
&& addr < (bt->bios_addr + BIOS_MAP_SIZE)))
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
btmapsensebuffers(void *arg, bus_dma_segment_t *segs, int nseg, int error)
|
||||
{
|
||||
struct bt_softc* bt;
|
||||
|
||||
bt = (struct bt_softc*)arg;
|
||||
bt->sense_buffers_physbase = segs->ds_addr;
|
||||
}
|
||||
|
||||
static device_method_t bt_mca_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, bt_mca_probe),
|
||||
DEVMETHOD(device_attach, bt_mca_attach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t bt_mca_driver = {
|
||||
"bt",
|
||||
bt_mca_methods,
|
||||
sizeof(struct bt_softc),
|
||||
};
|
||||
|
||||
static devclass_t bt_devclass;
|
||||
|
||||
DRIVER_MODULE(bt, mca, bt_mca_driver, bt_devclass, 0, 0);
|
||||
MODULE_DEPEND(bt, mca, 1, 1, 1);
|
@ -1,161 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <dev/mca/mca_busreg.h>
|
||||
#include <dev/mca/mca_busvar.h>
|
||||
|
||||
#include <dev/ep/if_epreg.h>
|
||||
#include <dev/ep/if_epvar.h>
|
||||
|
||||
#define EP_MCA_627C 0x627C
|
||||
#define EP_MCA_627D 0x627D
|
||||
#define EP_MCA_62DB 0x62db
|
||||
#define EP_MCA_62F6 0x62f6
|
||||
#define EP_MCA_62F7 0x62f7
|
||||
|
||||
static struct mca_ident ep_mca_devs[] = {
|
||||
{EP_MCA_627C, "3Com 3C529 Network Adapter"},
|
||||
{EP_MCA_627D, "3Com 3C529-TP Network Adapter"},
|
||||
|
||||
/*
|
||||
* These are from the linux 3c509 driver.
|
||||
* I have not seen the ADFs for them and have
|
||||
* not tested or even seen the hardware.
|
||||
* Someone with the ADFs should replace the names with
|
||||
* whatever is in the AdapterName field of the ADF.
|
||||
* (and fix the media setup for the cards as well.)
|
||||
*/
|
||||
{EP_MCA_62DB, "3Com 3c529 EtherLink III (test mode)"},
|
||||
{EP_MCA_62F6, "3Com 3c529 EtherLink III (TP or coax)"},
|
||||
{EP_MCA_62F7, "3Com 3c529 EtherLink III (TP)"},
|
||||
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
#define EP_MCA_IOPORT_POS MCA_ADP_POS(MCA_POS2)
|
||||
#define EP_MCA_IOPORT_MASK 0xfc
|
||||
#define EP_MCA_IOPORT_SIZE EP_IOSIZE
|
||||
#define EP_MCA_IOPORT(pos) ((((uint32_t)pos & EP_MCA_IOPORT_MASK) \
|
||||
| 0x02) << 8)
|
||||
|
||||
#define EP_MCA_IRQ_POS MCA_ADP_POS(MCA_POS3)
|
||||
#define EP_MCA_IRQ_MASK 0x0f
|
||||
#define EP_MCA_IRQ(pos) (pos & EP_MCA_IRQ_MASK)
|
||||
|
||||
#define EP_MCA_MEDIA_POS MCA_ADP_POS(MCA_POS2)
|
||||
#define EP_MCA_MEDIA_MASK 0x03
|
||||
#define EP_MCA_MEDIA(pos) (pos & EP_MCA_MEDIA_MASK)
|
||||
|
||||
static int
|
||||
ep_mca_probe(device_t dev)
|
||||
{
|
||||
const char *desc;
|
||||
uint32_t iobase = 0;
|
||||
uint8_t irq = 0;
|
||||
uint8_t pos;
|
||||
|
||||
desc = mca_match_id(mca_get_id(dev), ep_mca_devs);
|
||||
if (!desc)
|
||||
return (ENXIO);
|
||||
device_set_desc(dev, desc);
|
||||
|
||||
pos = mca_pos_read(dev, EP_MCA_IOPORT_POS);
|
||||
iobase = EP_MCA_IOPORT(pos);
|
||||
|
||||
pos = mca_pos_read(dev, EP_MCA_IRQ_POS);
|
||||
irq = EP_MCA_IRQ(pos);
|
||||
|
||||
mca_add_iospace(dev, iobase, EP_MCA_IOPORT_SIZE);
|
||||
mca_add_irq(dev, irq);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
ep_mca_attach(device_t dev)
|
||||
{
|
||||
struct ep_softc *sc = device_get_softc(dev);
|
||||
int error = 0;
|
||||
|
||||
if ((error = ep_alloc(dev)))
|
||||
goto bad;
|
||||
sc->stat = F_ACCESS_32_BITS;
|
||||
|
||||
ep_get_media(sc);
|
||||
|
||||
GO_WINDOW(sc, 0);
|
||||
SET_IRQ(sc, rman_get_start(sc->irq));
|
||||
|
||||
if ((error = ep_attach(sc)))
|
||||
goto bad;
|
||||
if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, NULL, ep_intr,
|
||||
sc, &sc->ep_intrhand))) {
|
||||
device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
return (0);
|
||||
bad:
|
||||
ep_free(dev);
|
||||
return (error);
|
||||
}
|
||||
|
||||
static device_method_t ep_mca_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, ep_mca_probe),
|
||||
DEVMETHOD(device_attach, ep_mca_attach),
|
||||
DEVMETHOD(device_detach, ep_detach),
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t ep_mca_driver = {
|
||||
"ep",
|
||||
ep_mca_methods,
|
||||
sizeof(struct ep_softc),
|
||||
};
|
||||
|
||||
static devclass_t ep_devclass;
|
||||
|
||||
DRIVER_MODULE(ep, mca, ep_mca_driver, ep_devclass, 0, 0);
|
@ -1,533 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* References:
|
||||
* The CMU Mach3 microkernel
|
||||
* NetBSD MCA patches by Scott Telford
|
||||
* Linux MCA code.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/limits.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <dev/mca/mca_busreg.h>
|
||||
#include <dev/mca/mca_busvar.h>
|
||||
|
||||
#include <sys/interrupt.h>
|
||||
|
||||
#define MAX_COL 79
|
||||
|
||||
static void mca_reg_print (device_t, char *, char *, int *);
|
||||
|
||||
struct mca_device {
|
||||
struct resource_list rl; /* Resources */
|
||||
|
||||
mca_id_t id;
|
||||
u_int8_t slot;
|
||||
u_int8_t enabled;
|
||||
u_int8_t pos[8]; /* Programable Option Select Regs. */
|
||||
};
|
||||
|
||||
/* Not supposed to use this function! */
|
||||
void
|
||||
mca_pos_set (device_t dev, u_int8_t reg, u_int8_t data)
|
||||
{
|
||||
struct mca_device * m_dev = device_get_ivars(dev);
|
||||
u_int8_t slot = mca_get_slot(dev);
|
||||
|
||||
if ((slot > MCA_MAX_ADAPTERS) || (reg > MCA_POS7))
|
||||
return;
|
||||
|
||||
/* Disable motherboard setup */
|
||||
outb(MCA_MB_SETUP_REG, MCA_MB_SETUP_DIS);
|
||||
|
||||
/* Select adapter setup regs */
|
||||
outb(MCA_ADAP_SETUP_REG, ((slot & 0x0f) | MCA_ADAP_SET));
|
||||
|
||||
/* Write the register */
|
||||
outb(MCA_POS_REG(reg), data);
|
||||
|
||||
/* Disable adapter setup */
|
||||
outb(MCA_ADAP_SETUP_REG, MCA_ADAP_SETUP_DIS);
|
||||
|
||||
/* Update the IVAR copy */
|
||||
m_dev->pos[reg] = data;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
u_int8_t
|
||||
mca_pos_get (device_t dev, u_int8_t reg)
|
||||
{
|
||||
u_int8_t slot = mca_get_slot(dev);
|
||||
u_int8_t data = 0;
|
||||
|
||||
if ((slot > MCA_MAX_ADAPTERS) || (reg > MCA_POS7))
|
||||
return (0);
|
||||
|
||||
/* Disable motherboard setup */
|
||||
outb(MCA_MB_SETUP_REG, MCA_MB_SETUP_DIS);
|
||||
|
||||
switch (slot) {
|
||||
case MCA_MB_SCSI_SLOT:
|
||||
|
||||
/* Disable adapter setup */
|
||||
outb(MCA_ADAP_SETUP_REG, MCA_ADAP_SETUP_DIS);
|
||||
|
||||
/* Select motherboard video setup regs */
|
||||
outb(MCA_MB_SETUP_REG, MCA_MB_SETUP_SCSI);
|
||||
|
||||
/* read the register */
|
||||
data = inb(MCA_POS_REG(reg));
|
||||
|
||||
/* Disable motherboard setup */
|
||||
outb(MCA_MB_SETUP_REG, MCA_MB_SETUP_DIS);
|
||||
|
||||
break;
|
||||
case MCA_MB_VIDEO_SLOT:
|
||||
/* Disable adapter setup */
|
||||
outb(MCA_ADAP_SETUP_REG, MCA_ADAP_SETUP_DIS);
|
||||
|
||||
/* Select motherboard scsi setup regs */
|
||||
outb(MCA_MB_SETUP_REG, MCA_MB_SETUP_VIDEO);
|
||||
|
||||
/* read the register */
|
||||
data = inb(MCA_POS_REG(reg));
|
||||
|
||||
/* Disable motherboard setup */
|
||||
outb(MCA_MB_SETUP_REG, MCA_MB_SETUP_DIS);
|
||||
break;
|
||||
default:
|
||||
|
||||
/* Select adapter setup regs */
|
||||
outb(MCA_ADAP_SETUP_REG,
|
||||
((slot & 0x0f) | MCA_ADAP_SET));
|
||||
|
||||
/* read the register */
|
||||
data = inb(MCA_POS_REG(reg));
|
||||
|
||||
/* Disable adapter setup */
|
||||
outb(MCA_ADAP_SETUP_REG, MCA_ADAP_SETUP_DIS);
|
||||
break;
|
||||
}
|
||||
|
||||
return (data);
|
||||
}
|
||||
|
||||
const char *
|
||||
mca_match_id (u_int16_t id, struct mca_ident *mca_devs)
|
||||
{
|
||||
struct mca_ident * m = mca_devs;
|
||||
while(m->name != NULL) {
|
||||
if (id == m->id)
|
||||
return (m->name);
|
||||
m++;
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
u_int8_t
|
||||
mca_pos_read (device_t dev, u_int8_t reg)
|
||||
{
|
||||
struct mca_device * m_dev = device_get_ivars(dev);
|
||||
|
||||
if (reg > MCA_POS7)
|
||||
return (0);
|
||||
|
||||
return (m_dev->pos[reg]);
|
||||
}
|
||||
|
||||
void
|
||||
mca_add_irq (dev, irq)
|
||||
device_t dev;
|
||||
int irq;
|
||||
{
|
||||
struct mca_device * m_dev = device_get_ivars(dev);
|
||||
int rid = 0;
|
||||
|
||||
while (resource_list_find(&(m_dev->rl), SYS_RES_IRQ, rid)) rid++;
|
||||
resource_list_add(&(m_dev->rl), SYS_RES_IRQ, rid, irq, irq, 1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
mca_add_drq (dev, drq)
|
||||
device_t dev;
|
||||
int drq;
|
||||
{
|
||||
struct mca_device * m_dev = device_get_ivars(dev);
|
||||
int rid = 0;
|
||||
|
||||
while (resource_list_find(&(m_dev->rl), SYS_RES_DRQ, rid)) rid++;
|
||||
resource_list_add(&(m_dev->rl), SYS_RES_DRQ, rid, drq, drq, 1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
mca_add_mspace (dev, mbase, msize)
|
||||
device_t dev;
|
||||
u_long mbase;
|
||||
u_long msize;
|
||||
{
|
||||
struct mca_device * m_dev = device_get_ivars(dev);
|
||||
int rid = 0;
|
||||
|
||||
while (resource_list_find(&(m_dev->rl), SYS_RES_MEMORY, rid)) rid++;
|
||||
resource_list_add(&(m_dev->rl), SYS_RES_MEMORY, rid,
|
||||
mbase, (mbase + msize), msize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
mca_add_iospace (dev, iobase, iosize)
|
||||
device_t dev;
|
||||
u_long iobase;
|
||||
u_long iosize;
|
||||
{
|
||||
struct mca_device * m_dev = device_get_ivars(dev);
|
||||
int rid = 0;
|
||||
|
||||
while (resource_list_find(&(m_dev->rl), SYS_RES_IOPORT, rid)) rid++;
|
||||
resource_list_add(&(m_dev->rl), SYS_RES_IOPORT, rid,
|
||||
iobase, (iobase + iosize), iosize);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
mca_probe (device_t dev)
|
||||
{
|
||||
device_t child;
|
||||
struct mca_device * m_dev = NULL;
|
||||
int devices_found = 0;
|
||||
u_int8_t slot;
|
||||
u_int8_t reg;
|
||||
|
||||
device_set_desc(dev, "MCA bus");
|
||||
|
||||
/* Disable adapter setup */
|
||||
outb(MCA_ADAP_SETUP_REG, MCA_ADAP_SETUP_DIS);
|
||||
/* Disable motherboard setup */
|
||||
outb(MCA_MB_SETUP_REG, MCA_MB_SETUP_DIS);
|
||||
|
||||
if (bootverbose) {
|
||||
printf("POS REG 00 01 02 03 04 05 06 07\n");
|
||||
printf("-----------------------------------\n");
|
||||
}
|
||||
|
||||
for (slot = 0; slot < MCA_MAX_SLOTS; slot++) {
|
||||
|
||||
if (!m_dev) {
|
||||
m_dev = (struct mca_device *)malloc(sizeof(*m_dev),
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
if (!m_dev) {
|
||||
device_printf(dev, "cannot malloc mca_device");
|
||||
break;
|
||||
}
|
||||
}
|
||||
bzero(m_dev, sizeof(*m_dev));
|
||||
|
||||
/* Select adapter setup regs */
|
||||
outb(MCA_ADAP_SETUP_REG, ((slot & 0x0f) | MCA_ADAP_SET));
|
||||
|
||||
/* Read the POS registers */
|
||||
for (reg = MCA_POS0; reg <= MCA_POS7; reg++) {
|
||||
m_dev->pos[reg] = inb(MCA_POS_REG(reg));
|
||||
}
|
||||
|
||||
/* Disable adapter setup */
|
||||
outb(MCA_ADAP_SETUP_REG, MCA_ADAP_SETUP_DIS);
|
||||
|
||||
if (bootverbose) {
|
||||
printf("mca slot %d:", slot + 1);
|
||||
for (reg = MCA_POS0; reg <= MCA_POS7; reg++) {
|
||||
printf(" %02x", m_dev->pos[reg]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
m_dev->id = (u_int16_t)m_dev->pos[MCA_POS0] |
|
||||
((u_int16_t)m_dev->pos[MCA_POS1] << 8);
|
||||
|
||||
if (m_dev->id == 0xffff) {
|
||||
continue;
|
||||
}
|
||||
|
||||
devices_found++;
|
||||
|
||||
m_dev->enabled = (m_dev->pos[MCA_POS2] & MCA_POS2_ENABLE);
|
||||
m_dev->slot = slot;
|
||||
|
||||
resource_list_init(&(m_dev->rl));
|
||||
|
||||
child = device_add_child(dev, NULL, -1);
|
||||
device_set_ivars(child, m_dev);
|
||||
|
||||
m_dev = NULL;
|
||||
}
|
||||
|
||||
if (m_dev) {
|
||||
free(m_dev, M_DEVBUF);
|
||||
}
|
||||
|
||||
return (devices_found ? 0 : ENXIO);
|
||||
}
|
||||
|
||||
static void
|
||||
mca_reg_print (dev, string, separator, column)
|
||||
device_t dev;
|
||||
char * string;
|
||||
char * separator;
|
||||
int * column;
|
||||
{
|
||||
int length = strlen(string);
|
||||
|
||||
length += (separator ? 2 : 1);
|
||||
|
||||
if (((*column) + length) >= MAX_COL) {
|
||||
printf("\n");
|
||||
(*column) = 0;
|
||||
} else if ((*column) != 0) {
|
||||
if (separator) {
|
||||
printf("%c", *separator);
|
||||
(*column)++;
|
||||
}
|
||||
printf(" ");
|
||||
(*column)++;
|
||||
}
|
||||
|
||||
if ((*column) == 0) {
|
||||
(*column) += device_printf(dev, "%s", string);
|
||||
} else {
|
||||
(*column) += printf("%s", string);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
mca_print_child (device_t dev, device_t child)
|
||||
{
|
||||
char buf[MAX_COL+1];
|
||||
struct mca_device * m_dev = device_get_ivars(child);
|
||||
int rid;
|
||||
struct resource_list_entry * rle;
|
||||
char separator = ',';
|
||||
int column = 0;
|
||||
int retval = 0;
|
||||
|
||||
if (device_get_desc(child)) {
|
||||
snprintf(buf, sizeof(buf), "<%s>", device_get_desc(child));
|
||||
mca_reg_print(child, buf, NULL, &column);
|
||||
}
|
||||
|
||||
rid = 0;
|
||||
while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_IOPORT, rid++))) {
|
||||
if (rle->count == 1) {
|
||||
snprintf(buf, sizeof(buf), "%s%jx",
|
||||
((rid == 1) ? "io 0x" : "0x"),
|
||||
rle->start);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "%s%jx-0x%jx",
|
||||
((rid == 1) ? "io 0x" : "0x"),
|
||||
rle->start,
|
||||
(rle->start + rle->count));
|
||||
}
|
||||
mca_reg_print(child, buf,
|
||||
((rid == 2) ? &separator : NULL), &column);
|
||||
}
|
||||
|
||||
rid = 0;
|
||||
while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_MEMORY, rid++))) {
|
||||
if (rle->count == 1) {
|
||||
snprintf(buf, sizeof(buf), "%s%jx",
|
||||
((rid == 1) ? "mem 0x" : "0x"),
|
||||
rle->start);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "%s%jx-0x%jx",
|
||||
((rid == 1) ? "mem 0x" : "0x"),
|
||||
rle->start,
|
||||
(rle->start + rle->count));
|
||||
}
|
||||
mca_reg_print(child, buf,
|
||||
((rid == 2) ? &separator : NULL), &column);
|
||||
}
|
||||
|
||||
rid = 0;
|
||||
while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_IRQ, rid++))) {
|
||||
snprintf(buf, sizeof(buf), "irq %jd", rle->start);
|
||||
mca_reg_print(child, buf,
|
||||
((rid == 1) ? &separator : NULL), &column);
|
||||
}
|
||||
|
||||
rid = 0;
|
||||
while ((rle = resource_list_find(&(m_dev->rl), SYS_RES_DRQ, rid++))) {
|
||||
snprintf(buf, sizeof(buf), "drq %jx", rle->start);
|
||||
mca_reg_print(child, buf,
|
||||
((rid == 1) ? &separator : NULL), &column);
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "on %s id %04x slot %d\n",
|
||||
device_get_nameunit(dev),
|
||||
mca_get_id(child), mca_get_slot(child)+1);
|
||||
mca_reg_print(child, buf, NULL, &column);
|
||||
|
||||
return (retval);
|
||||
}
|
||||
|
||||
static void
|
||||
mca_probe_nomatch (device_t dev, device_t child)
|
||||
{
|
||||
mca_id_t mca_id = mca_get_id(child);
|
||||
u_int8_t slot = mca_get_slot(child);
|
||||
u_int8_t enabled = mca_get_enabled(child);
|
||||
|
||||
device_printf(dev, "unknown card (id 0x%04x, %s) at slot %d\n",
|
||||
mca_id,
|
||||
(enabled ? "enabled" : "disabled"),
|
||||
slot + 1);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
mca_read_ivar (device_t dev, device_t child, int which, uintptr_t * result)
|
||||
{
|
||||
struct mca_device * m_dev = device_get_ivars(child);
|
||||
|
||||
switch (which) {
|
||||
case MCA_IVAR_SLOT:
|
||||
*result = m_dev->slot;
|
||||
break;
|
||||
case MCA_IVAR_ID:
|
||||
*result = m_dev->id;
|
||||
break;
|
||||
case MCA_IVAR_ENABLED:
|
||||
*result = m_dev->enabled;
|
||||
break;
|
||||
default:
|
||||
return (ENOENT);
|
||||
break;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
static struct resource *
|
||||
mca_alloc_resource (device_t dev, device_t child, int type, int *rid,
|
||||
rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
|
||||
{
|
||||
struct mca_device * m_dev = device_get_ivars(child);
|
||||
struct resource_list_entry * rle;
|
||||
int isdefault;
|
||||
int passthrough;
|
||||
|
||||
isdefault = RMAN_IS_DEFAULT_RANGE(start, end);
|
||||
passthrough = (device_get_parent(child) != dev);
|
||||
|
||||
if (!passthrough && !isdefault) {
|
||||
rle = resource_list_find(&(m_dev->rl), type, *rid);
|
||||
if (!rle) {
|
||||
resource_list_add(&(m_dev->rl), type, *rid,
|
||||
start, end, count);
|
||||
}
|
||||
}
|
||||
|
||||
if (type == SYS_RES_IRQ) {
|
||||
flags |= RF_SHAREABLE;
|
||||
}
|
||||
|
||||
return (resource_list_alloc(&(m_dev->rl), dev, child, type, rid,
|
||||
start, end, count, flags));
|
||||
}
|
||||
|
||||
static struct resource_list *
|
||||
mca_get_resource_list (device_t dev, device_t child)
|
||||
{
|
||||
struct mca_device * m_dev = device_get_ivars(child);
|
||||
struct resource_list * rl = &m_dev->rl;
|
||||
|
||||
if (!rl)
|
||||
return (NULL);
|
||||
|
||||
return (rl);
|
||||
}
|
||||
|
||||
static device_method_t mca_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, mca_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
DEVMETHOD(device_suspend, bus_generic_suspend),
|
||||
DEVMETHOD(device_resume, bus_generic_resume),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, mca_print_child),
|
||||
DEVMETHOD(bus_probe_nomatch, mca_probe_nomatch),
|
||||
DEVMETHOD(bus_read_ivar, mca_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, bus_generic_write_ivar),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
DEVMETHOD(bus_get_resource_list,mca_get_resource_list),
|
||||
DEVMETHOD(bus_alloc_resource, mca_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource),
|
||||
DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource),
|
||||
DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource),
|
||||
DEVMETHOD(bus_delete_resource, bus_generic_rl_delete_resource),
|
||||
DEVMETHOD(bus_activate_resource,bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t mca_driver = {
|
||||
"mca",
|
||||
mca_methods,
|
||||
1, /* no softc */
|
||||
};
|
||||
|
||||
static devclass_t mca_devclass;
|
||||
|
||||
DRIVER_MODULE(mca, legacy, mca_driver, mca_devclass, 0, 0);
|
@ -1,84 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Standardized MCA configuration information
|
||||
*/
|
||||
|
||||
#define MCA_MAX_SLOTS 8 /* max number of slots per bus */
|
||||
#define MCA_MB_SCSI_SLOT 8
|
||||
#define MCA_MB_VIDEO_SLOT 9
|
||||
#define MCA_MAX_ADAPTERS 9
|
||||
|
||||
/*
|
||||
* When an ADF file talks about a POS register
|
||||
* its not talking about the same index we are
|
||||
* so provide this to convert ADF pos register
|
||||
* offsets to our register offsets. (Since
|
||||
* to us, POS0 and POS1 are just 2 more registers
|
||||
*/
|
||||
|
||||
#define MCA_ADP_POS(pos) (pos + 2)
|
||||
|
||||
#define MCA_POS0 0 /* low byte of board ID */
|
||||
#define MCA_POS1 1 /* high byte of board ID */
|
||||
#define MCA_POS2 2
|
||||
# define MCA_POS2_ENABLE 0x01 /* POS2, hi => adapter enabled */
|
||||
#define MCA_POS3 3
|
||||
#define MCA_POS4 4
|
||||
#define MCA_POS5 5
|
||||
# define MCA_POS5_CHCK_STAT 0x40 /* lo => CHCK status available */
|
||||
# define MCA_POS5_CHCK 0x80 /* lo => adapter CHCK signal */
|
||||
#define MCA_POS6 6 /* low byte of CHCK status */
|
||||
#define MCA_POS7 7 /* high byte of CHCK status */
|
||||
|
||||
/*
|
||||
* MCA register addresses for IBM PS/2
|
||||
*/
|
||||
|
||||
#define MCA_SYS_CTL_A_REG 0x92 /* PS/2 System Control Port A */
|
||||
#define MCA_SYS_CTL_B_REG 0x60 /* PS/2 System Control Port B */
|
||||
#define MCA_ARB_REG 0x90 /* MCA Arbitration port */
|
||||
#define MCA_CSF_REG 0x91 /* MCA Card Select Feedback */
|
||||
|
||||
/*
|
||||
* 0x96, 0x97 POS Registers
|
||||
* 0x100 - 0x107 POS Registers
|
||||
*/
|
||||
|
||||
#define MCA_MB_SETUP_REG 0x94 /* Motherboard setup register */
|
||||
# define MCA_MB_SETUP_DIS 0xff /* Disable motherboard setup */
|
||||
# define MCA_MB_SETUP_VIDEO 0xdf
|
||||
# define MCA_MB_SETUP_SCSI 0xf7 /* Pri. SCSI setup reg */
|
||||
# define MCA_MB_SETUP_SCSI_ALT 0xfd /* Alt. SCSI setup reg */
|
||||
|
||||
#define MCA_ADAP_SETUP_REG 0x96 /* Adapter setup register */
|
||||
# define MCA_ADAP_SETUP_DIS 0x0 /* Disable adapter setup */
|
||||
# define MCA_ADAP_SET 0x08 /* Adapter setup mode */
|
||||
# define MCA_ADAP_CHR 0x80 /* Adapter channel reset */
|
||||
#define MCA_POS_REG(n) (0x100+(n)) /* POS registers 0-7 */
|
@ -1,70 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
typedef u_int16_t mca_id_t;
|
||||
|
||||
struct mca_ident {
|
||||
mca_id_t id;
|
||||
char *name;
|
||||
};
|
||||
|
||||
const char * mca_match_id (u_int16_t, struct mca_ident *);
|
||||
|
||||
/*
|
||||
* Simplified accessors for isa devices
|
||||
*/
|
||||
|
||||
enum mca_device_ivars {
|
||||
MCA_IVAR_SLOT,
|
||||
MCA_IVAR_ID,
|
||||
MCA_IVAR_ENABLED,
|
||||
};
|
||||
|
||||
#define MCA_ACCESSOR(A, B, T) \
|
||||
\
|
||||
static __inline T mca_get_ ## A(device_t dev) \
|
||||
{ \
|
||||
uintptr_t v; \
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, MCA_IVAR_ ## B, &v); \
|
||||
return (T) v; \
|
||||
}
|
||||
|
||||
MCA_ACCESSOR(slot, SLOT, int)
|
||||
MCA_ACCESSOR(id, ID, mca_id_t)
|
||||
MCA_ACCESSOR(enabled, ENABLED, int)
|
||||
|
||||
/* don't use these! */
|
||||
void mca_pos_set (device_t, u_int8_t, u_int8_t);
|
||||
u_int8_t mca_pos_get (device_t, u_int8_t);
|
||||
|
||||
u_int8_t mca_pos_read (device_t, u_int8_t);
|
||||
|
||||
void mca_add_irq (device_t, int);
|
||||
void mca_add_drq (device_t, int);
|
||||
void mca_add_iospace (device_t, u_long, u_long);
|
||||
void mca_add_mspace (device_t, u_long, u_long);
|
@ -1,160 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/vm86.h>
|
||||
#include <machine/pc/bios.h>
|
||||
#include <machine/cpufunc.h>
|
||||
|
||||
#include <dev/mca/mca_busreg.h>
|
||||
#include <i386/bios/mca_machdep.h>
|
||||
|
||||
/* Global MCA bus flag */
|
||||
int MCA_system = 0;
|
||||
|
||||
/* System Configuration Block */
|
||||
struct sys_config {
|
||||
u_int16_t count;
|
||||
u_int8_t model;
|
||||
u_int8_t submodel;
|
||||
u_int8_t bios_rev;
|
||||
u_int8_t feature;
|
||||
#define FEATURE_MCAISA 0x01 /* Machine contains both MCA and ISA bus*/
|
||||
#define FEATURE_MCABUS 0x02 /* MicroChannel Architecture */
|
||||
#define FEATURE_EBDA 0x04 /* Extended BIOS data area allocated */
|
||||
#define FEATURE_WAITEV 0x08 /* Wait for external event is supported */
|
||||
#define FEATURE_KBDINT 0x10 /* Keyboard intercept called by Int 09h */
|
||||
#define FEATURE_RTC 0x20 /* Real-time clock present */
|
||||
#define FEATURE_IC2 0x40 /* Second interrupt chip present */
|
||||
#define FEATURE_DMA3 0x80 /* DMA channel 3 used by hard disk BIOS */
|
||||
u_int8_t pad[3];
|
||||
} __packed;
|
||||
|
||||
/* Function Prototypes */
|
||||
static void bios_mcabus_present (void *);
|
||||
SYSINIT(mca_present, SI_SUB_CPU, SI_ORDER_ANY, bios_mcabus_present, NULL);
|
||||
|
||||
/* Functions */
|
||||
static void
|
||||
bios_mcabus_present(void * dummy)
|
||||
{
|
||||
struct vm86frame vmf;
|
||||
struct sys_config * scp;
|
||||
vm_offset_t paddr;
|
||||
|
||||
bzero(&vmf, sizeof(struct vm86frame));
|
||||
|
||||
vmf.vmf_ah = 0xc0;
|
||||
if (vm86_intcall(0x15, &vmf)) {
|
||||
if (bootverbose) {
|
||||
printf("BIOS SDT: INT call failed.\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ((vmf.vmf_ah != 0) && (vmf.vmf_flags & 0x01)) {
|
||||
if (bootverbose) {
|
||||
printf("BIOS SDT: Not supported. Not PS/2?\n");
|
||||
printf("BIOS SDT: AH 0x%02x, Flags 0x%04x\n",
|
||||
vmf.vmf_ah, vmf.vmf_flags);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
paddr = vmf.vmf_es;
|
||||
paddr = (paddr << 4) + vmf.vmf_bx;
|
||||
scp = (struct sys_config *)BIOS_PADDRTOVADDR(paddr);
|
||||
|
||||
if (bootverbose) {
|
||||
printf("BIOS SDT: model 0x%02x, submodel 0x%02x, bios_rev 0x%02x\n",
|
||||
scp->model, scp->submodel, scp->bios_rev);
|
||||
printf("BIOS SDT: features 0x%b\n", scp->feature,
|
||||
"\20"
|
||||
"\01MCA+ISA"
|
||||
"\02MCA"
|
||||
"\03EBDA"
|
||||
"\04WAITEV"
|
||||
"\05KBDINT"
|
||||
"\06RTC"
|
||||
"\07IC2"
|
||||
"\08DMA3"
|
||||
"\n");
|
||||
}
|
||||
|
||||
MCA_system = ((scp->feature & FEATURE_MCABUS) ? 1 : 0);
|
||||
|
||||
if (MCA_system)
|
||||
printf("MicroChannel Architecture System detected.\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
mca_bus_nmi (void)
|
||||
{
|
||||
int slot;
|
||||
int retval = 0;
|
||||
int pos5 = 0;
|
||||
|
||||
/* Disable motherboard setup */
|
||||
outb(MCA_MB_SETUP_REG, MCA_MB_SETUP_DIS);
|
||||
|
||||
/* For each slot */
|
||||
for (slot = 0; slot < MCA_MAX_SLOTS; slot++) {
|
||||
|
||||
/* Select the slot */
|
||||
outb(MCA_ADAP_SETUP_REG, slot | MCA_ADAP_SET);
|
||||
pos5 = inb(MCA_POS_REG(MCA_POS5));
|
||||
|
||||
/* If Adapter Check is low */
|
||||
if ((pos5 & MCA_POS5_CHCK) == 0) {
|
||||
retval++;
|
||||
|
||||
/* If Adapter Check Status is available */
|
||||
if ((pos5 & MCA_POS5_CHCK_STAT) == 0) {
|
||||
printf("MCA NMI: slot %d, POS6=0x%02x, POS7=0x%02x\n",
|
||||
slot+1,
|
||||
inb( MCA_POS_REG(MCA_POS6) ),
|
||||
inb( MCA_POS_REG(MCA_POS7) ));
|
||||
} else {
|
||||
printf("MCA NMI: slot %d\n", slot+1);
|
||||
}
|
||||
}
|
||||
/* Disable adapter setup */
|
||||
outb(MCA_ADAP_SETUP_REG, MCA_ADAP_SETUP_DIS);
|
||||
}
|
||||
|
||||
return (retval);
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Matthew N. Dodd <winter@jurai.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
extern int MCA_system;
|
||||
|
||||
extern int mca_bus_nmi (void);
|
@ -352,15 +352,6 @@ device eisa
|
||||
# thus you need to bump this figure to 12 for them.
|
||||
options EISA_SLOTS=12
|
||||
|
||||
#
|
||||
# MCA bus:
|
||||
#
|
||||
# The MCA bus device is `mca'. It provides auto-detection and
|
||||
# configuration support for all devices on the MCA bus.
|
||||
# No hints are required for MCA.
|
||||
|
||||
device mca
|
||||
|
||||
#
|
||||
# AGP GART support
|
||||
device agp
|
||||
|
@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_auto_eoi.h"
|
||||
#include "opt_isa.h"
|
||||
#include "opt_mca.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -54,9 +53,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <x86/isa/icu.h>
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
#ifdef DEV_MCA
|
||||
#include <i386/bios/mca_machdep.h>
|
||||
#endif
|
||||
|
||||
#ifdef __amd64__
|
||||
#define SDT_ATPIC SDT_SYSIGT
|
||||
@ -356,13 +352,7 @@ i8259_init(struct atpic *pic, int slave)
|
||||
|
||||
/* Reset the PIC and program with next four bytes. */
|
||||
spinlock_enter();
|
||||
#ifdef DEV_MCA
|
||||
/* MCA uses level triggered interrupts. */
|
||||
if (MCA_system)
|
||||
outb(pic->at_ioaddr, ICW1_RESET | ICW1_IC4 | ICW1_LTIM);
|
||||
else
|
||||
#endif
|
||||
outb(pic->at_ioaddr, ICW1_RESET | ICW1_IC4);
|
||||
outb(pic->at_ioaddr, ICW1_RESET | ICW1_IC4);
|
||||
imr_addr = pic->at_ioaddr + ICU_IMR_OFFSET;
|
||||
|
||||
/* Start vector. */
|
||||
@ -419,14 +409,6 @@ atpic_startup(void)
|
||||
ai->at_irq, ai->at_intr, SDT_ATPIC, SEL_KPL, GSEL_ATPIC);
|
||||
}
|
||||
|
||||
#ifdef DEV_MCA
|
||||
/* For MCA systems, all interrupts are level triggered. */
|
||||
if (MCA_system)
|
||||
for (i = 0, ai = atintrs; i < NUM_ISA_IRQS; i++, ai++)
|
||||
ai->at_trigger = INTR_TRIGGER_LEVEL;
|
||||
else
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Look for an ELCR. If we find one, update the trigger modes.
|
||||
* If we don't find one, assume that IRQs 0, 1, 2, and 13 are
|
||||
|
@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_clock.h"
|
||||
#include "opt_isa.h"
|
||||
#include "opt_mca.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -73,10 +72,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <isa/isavar.h>
|
||||
#endif
|
||||
|
||||
#ifdef DEV_MCA
|
||||
#include <i386/bios/mca_machdep.h>
|
||||
#endif
|
||||
|
||||
int clkintr_pending;
|
||||
#ifndef TIMER_FREQ
|
||||
#define TIMER_FREQ 1193182
|
||||
@ -153,11 +148,6 @@ clkintr(void *arg)
|
||||
if (sc->et.et_active && sc->mode != MODE_STOP)
|
||||
sc->et.et_event_cb(&sc->et, sc->et.et_arg);
|
||||
|
||||
#ifdef DEV_MCA
|
||||
/* Reset clock interrupt by asserting bit 7 of port 0x61 */
|
||||
if (MCA_system)
|
||||
outb(0x61, inb(0x61) | 0x80);
|
||||
#endif
|
||||
return (FILTER_HANDLED);
|
||||
}
|
||||
|
||||
|
@ -35,18 +35,12 @@
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "opt_mca.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/md_var.h>
|
||||
|
||||
#ifdef DEV_MCA
|
||||
#include <i386/bios/mca_machdep.h>
|
||||
#endif
|
||||
|
||||
#define NMI_PARITY (1 << 7)
|
||||
#define NMI_IOCHAN (1 << 6)
|
||||
#define ENMI_WATCHDOG (1 << 7)
|
||||
@ -65,10 +59,6 @@ isa_nmi(int cd)
|
||||
int eisa_port = inb(0x461);
|
||||
|
||||
log(LOG_CRIT, "NMI ISA %x, EISA %x\n", isa_port, eisa_port);
|
||||
#ifdef DEV_MCA
|
||||
if (MCA_system && mca_bus_nmi())
|
||||
return(0);
|
||||
#endif
|
||||
|
||||
if (isa_port & NMI_PARITY) {
|
||||
log(LOG_CRIT, "RAM parity error, likely hardware failure.");
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
#ifdef __i386__
|
||||
#include "opt_eisa.h"
|
||||
#include "opt_mca.h"
|
||||
#endif
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
@ -51,10 +50,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/rman.h>
|
||||
#include <sys/smp.h>
|
||||
|
||||
#ifdef DEV_MCA
|
||||
#include <i386/bios/mca_machdep.h>
|
||||
#endif
|
||||
|
||||
#include <machine/clock.h>
|
||||
#include <machine/resource.h>
|
||||
#include <x86/legacyvar.h>
|
||||
@ -143,14 +138,6 @@ legacy_attach(device_t dev)
|
||||
panic("legacy_attach eisa");
|
||||
device_probe_and_attach(child);
|
||||
}
|
||||
#endif
|
||||
#ifdef DEV_MCA
|
||||
if (MCA_system && !devclass_get_device(devclass_find("mca"), 0)) {
|
||||
child = BUS_ADD_CHILD(dev, 0, "mca", 0);
|
||||
if (child == 0)
|
||||
panic("legacy_probe mca");
|
||||
device_probe_and_attach(child);
|
||||
}
|
||||
#endif
|
||||
if (!devclass_get_device(devclass_find("isa"), 0)) {
|
||||
child = BUS_ADD_CHILD(dev, 0, "isa", 0);
|
||||
|
@ -1,21 +0,0 @@
|
||||
# Doxyfile 1.5.2
|
||||
|
||||
# $FreeBSD$
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "FreeBSD kernel MCA device code"
|
||||
OUTPUT_DIRECTORY = $(DOXYGEN_DEST_PATH)/dev_mca/
|
||||
EXTRACT_ALL = YES # for undocumented src, no warnings enabled
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = $(DOXYGEN_SRC_PATH)/dev/mca/ \
|
||||
$(NOTREVIEWED)
|
||||
|
||||
GENERATE_TAGFILE = dev_mca/dev_mca.tag
|
||||
|
||||
@INCLUDE_PATH = $(DOXYGEN_INCLUDE_PATH)
|
||||
@INCLUDE = common-Doxyfile
|
||||
|
Loading…
Reference in New Issue
Block a user