summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>1999-10-09 06:28:18 +0000
committermdodd <mdodd@FreeBSD.org>1999-10-09 06:28:18 +0000
commit452a78e08bd2d4537c503dbd1663ea0fd9667241 (patch)
treec14be2cb007961d81bc0380bd3028b7f831d521b
parentab7a87c594b1b8c7d30567d8bb3de5e9d898c374 (diff)
downloadFreeBSD-src-452a78e08bd2d4537c503dbd1663ea0fd9667241.zip
FreeBSD-src-452a78e08bd2d4537c503dbd1663ea0fd9667241.tar.gz
Remove old copies. These files now live in src/sys/dev/buslogic
-rw-r--r--sys/i386/eisa/bt_eisa.c348
-rw-r--r--sys/isa/bt_isa.c343
-rw-r--r--sys/pci/bt_pci.c230
3 files changed, 0 insertions, 921 deletions
diff --git a/sys/i386/eisa/bt_eisa.c b/sys/i386/eisa/bt_eisa.c
deleted file mode 100644
index 400b42b..0000000
--- a/sys/i386/eisa/bt_eisa.c
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Product specific probe and attach routines for:
- * Buslogic BT74x SCSI controllers
- *
- * Copyright (c) 1995, 1998, 1999 Justin T. Gibbs
- * 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 immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 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$
- */
-
-#include "eisa.h"
-#if NEISA > 0
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus_pio.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <i386/eisa/eisaconf.h>
-
-#include <dev/buslogic/btreg.h>
-
-#define EISA_DEVICE_ID_BUSLOGIC_74X_B 0x0ab34201
-#define EISA_DEVICE_ID_BUSLOGIC_74X_C 0x0ab34202
-#define EISA_DEVICE_ID_SDC3222F 0x0ab34781
-#define EISA_DEVICE_ID_AMI_4801 0x05a94801
-
-#define BT_IOSIZE 0x04 /* Move to central header */
-#define BT_EISA_IOSIZE 0x100
-#define BT_EISA_SLOT_OFFSET 0xc00
-
-#define EISA_IOCONF 0x08C
-#define PORTADDR 0x07
-#define PORT_330 0x00
-#define PORT_334 0x01
-#define PORT_230 0x02
-#define PORT_234 0x03
-#define PORT_130 0x04
-#define PORT_134 0x05
-#define IRQ_CHANNEL 0xe0
-#define INT_11 0x40
-#define INT_10 0x20
-#define INT_15 0xa0
-#define INT_12 0x60
-#define INT_14 0x80
-#define INT_9 0x00
-
-#define EISA_IRQ_TYPE 0x08D
-#define LEVEL 0x40
-
-/* Definitions for the AMI Series 48 controler */
-#define AMI_EISA_IOSIZE 0x500 /* Two separate ranges?? */
-#define AMI_EISA_SLOT_OFFSET 0x800
-#define AMI_EISA_IOCONF 0x000
-#define AMI_DMA_CHANNEL 0x03
-#define AMI_IRQ_CHANNEL 0x1c
-#define AMI_INT_15 0x14
-#define AMI_INT_14 0x10
-#define AMI_INT_12 0x0c
-#define AMI_INT_11 0x00
-#define AMI_INT_10 0x08
-#define AMI_INT_9 0x04
-#define AMI_BIOS_ADDR 0xe0
-
-#define AMI_EISA_IOCONF1 0x001
-#define AMI_PORTADDR 0x0e
-#define AMI_PORT_334 0x08
-#define AMI_PORT_330 0x00
-#define AMI_PORT_234 0x0c
-#define AMI_PORT_230 0x04
-#define AMI_PORT_134 0x0a
-#define AMI_PORT_130 0x02
-#define AMI_IRQ_LEVEL 0x01
-
-
-#define AMI_MISC2_OPTIONS 0x49E
-#define AMI_ENABLE_ISA_DMA 0x08
-
-static const char *bt_match(eisa_id_t type);
-
-static int
-bt_eisa_alloc_resources(device_t dev)
-{
- struct bt_softc *bt = device_get_softc(dev);
- int rid;
- struct resource *port;
- struct resource *irq;
- int shared;
-
- /*
- * XXX assumes that the iospace ranges are sorted in increasing
- * order.
- */
- rid = 0;
- port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
- 0, ~0, 1, RF_ACTIVE);
- if (!port)
- return (ENOMEM);
-
- bt_init_softc(dev, port, 0, 0);
-
- if (eisa_get_irq(dev) != -1) {
- shared = bt->level_trigger_ints ? RF_SHAREABLE : 0;
- rid = 0;
- irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
- 0, ~0, 1, shared | RF_ACTIVE);
- if (!irq) {
- if (port)
- bus_release_resource(dev, SYS_RES_IOPORT,
- 0, port);
- return (ENOMEM);
- }
- } else
- irq = 0;
- bt->irq = irq;
-
- return (0);
-}
-
-static void
-bt_eisa_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);
- bt_free_softc(dev);
-}
-
-static const char*
-bt_match(eisa_id_t type)
-{
- switch(type) {
- case EISA_DEVICE_ID_BUSLOGIC_74X_B:
- return ("Buslogic 74xB SCSI host adapter");
- break;
- case EISA_DEVICE_ID_BUSLOGIC_74X_C:
- return ("Buslogic 74xC SCSI host adapter");
- break;
- case EISA_DEVICE_ID_SDC3222F:
- return ("Storage Dimensions SDC3222F SCSI host adapter");
- break;
- case EISA_DEVICE_ID_AMI_4801:
- return ("AMI Series 48 SCSI host adapter");
- break;
- default:
- break;
- }
- return (NULL);
-}
-
-static int
-bt_eisa_probe(device_t dev)
-{
- const char *desc;
- u_long iobase;
- struct bt_probe_info info;
- u_long port;
- u_long iosize;
- u_int ioconf;
- int result;
- int shared;
-
- desc = bt_match(eisa_get_id(dev));
- if (!desc)
- return (ENXIO);
- device_set_desc(dev, desc);
-
- iobase = (eisa_get_slot(dev) * EISA_SLOT_SIZE);
- if (eisa_get_id(dev) == EISA_DEVICE_ID_AMI_4801) {
- u_int ioconf1;
-
- iobase += AMI_EISA_SLOT_OFFSET;
- iosize = AMI_EISA_IOSIZE;
- ioconf1 = inb(iobase + AMI_EISA_IOCONF1);
- /* Determine "ISA" I/O port */
- switch (ioconf1 & AMI_PORTADDR) {
- case AMI_PORT_330:
- port = 0x330;
- break;
- case AMI_PORT_334:
- port = 0x334;
- break;
- case AMI_PORT_230:
- port = 0x230;
- break;
- case AMI_PORT_234:
- port = 0x234;
- break;
- case AMI_PORT_134:
- port = 0x134;
- break;
- case AMI_PORT_130:
- port = 0x130;
- break;
- default:
- /* Disabled */
- printf("bt: AMI EISA Adapter at "
- "slot %d has a disabled I/O "
- "port. Cannot attach.\n",
- eisa_get_slot(dev));
- return (ENXIO);
- }
- shared = (inb(iobase + AMI_EISA_IOCONF1) & AMI_IRQ_LEVEL) ?
- EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
- } else {
- iobase += BT_EISA_SLOT_OFFSET;
- iosize = BT_EISA_IOSIZE;
-
- ioconf = inb(iobase + EISA_IOCONF);
- /* Determine "ISA" I/O port */
- switch (ioconf & PORTADDR) {
- case PORT_330:
- port = 0x330;
- break;
- case PORT_334:
- port = 0x334;
- break;
- case PORT_230:
- port = 0x230;
- break;
- case PORT_234:
- port = 0x234;
- break;
- case PORT_130:
- port = 0x130;
- break;
- case PORT_134:
- port = 0x134;
- break;
- default:
- /* Disabled */
- printf("bt: Buslogic EISA Adapter at "
- "slot %d has a disabled I/O "
- "port. Cannot attach.\n",
- eisa_get_slot(dev));
- return (ENXIO);
- }
- shared = (inb(iobase + EISA_IRQ_TYPE) & LEVEL) ?
- EISA_TRIGGER_LEVEL : EISA_TRIGGER_EDGE;
- }
- bt_mark_probed_iop(port);
-
- /* Tell parent where our resources are going to be */
- eisa_add_iospace(dev, iobase, iosize, RESVADDR_NONE);
- eisa_add_iospace(dev, port, BT_IOSIZE, RESVADDR_NONE);
-
- /* And allocate them */
- bt_eisa_alloc_resources(dev);
-
- if (bt_port_probe(dev, &info) != 0) {
- printf("bt_eisa_probe: Probe failed for "
- "card at slot 0x%x\n", eisa_get_slot(dev));
- result = ENXIO;
- } else {
- eisa_add_intr(dev, info.irq, shared);
- result = 0;
- }
- bt_eisa_release_resources(dev);
-
- return (result);
-}
-
-static int
-bt_eisa_attach(device_t dev)
-{
- struct bt_softc *bt = device_get_softc(dev);
-
- /* Allocate resources */
- bt_eisa_alloc_resources(dev);
-
- /* Allocate a dmatag for our SCB DMA maps */
- /* XXX Should be a child of the PCI bus dma tag */
- if (bus_dma_tag_create(/*parent*/NULL, /*alignment*/1, /*boundary*/0,
- /*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
- /*highaddr*/BUS_SPACE_MAXADDR,
- /*filter*/NULL, /*filterarg*/NULL,
- /*maxsize*/BUS_SPACE_MAXSIZE_32BIT,
- /*nsegments*/BUS_SPACE_UNRESTRICTED,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
- /*flags*/0, &bt->parent_dmat) != 0) {
- bt_eisa_release_resources(dev);
- return -1;
- }
-
- /*
- * Now that we know we own the resources we need, do the full
- * card initialization.
- */
- if (bt_probe(dev) || bt_fetch_adapter_info(dev) || bt_init(dev)) {
- bt_eisa_release_resources(dev);
- return -1;
- }
-
- /* Attach sub-devices - always succeeds (sets up intr) */
- bt_attach(dev);
-
- return 0;
-}
-
-static device_method_t bt_eisa_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, bt_eisa_probe),
- DEVMETHOD(device_attach, bt_eisa_attach),
-
- { 0, 0 }
-};
-
-static driver_t bt_eisa_driver = {
- "bt",
- bt_eisa_methods,
- sizeof(struct bt_softc),
-};
-
-static devclass_t bt_devclass;
-
-DRIVER_MODULE(bt, eisa, bt_eisa_driver, bt_devclass, 0, 0);
-
-#endif /* NEISA > 0 */
diff --git a/sys/isa/bt_isa.c b/sys/isa/bt_isa.c
deleted file mode 100644
index b51fe8e..0000000
--- a/sys/isa/bt_isa.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Product specific probe and attach routines for:
- * Buslogic BT-54X and BT-445 cards
- *
- * Copyright (c) 1998, 1999 Justin T. Gibbs
- * 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,
- * without modification, immediately at the beginning of the file.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 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$
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus_pio.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <isa/isavar.h>
-#include <dev/buslogic/btreg.h>
-
-#include <cam/scsi/scsi_all.h>
-
-static bus_dma_filter_t btvlbouncefilter;
-static bus_dmamap_callback_t btmapsensebuffers;
-
-static int
-bt_isa_alloc_resources(device_t dev, u_long portstart, u_long portend)
-{
- int rid;
- struct resource *port;
- struct resource *irq;
- struct resource *drq;
-
- rid = 0;
- port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
- portstart, portend, BT_NREGS, RF_ACTIVE);
- if (!port)
- return (ENOMEM);
-
- if (isa_get_irq(dev) != -1) {
- rid = 0;
- irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
- 0, ~0, 1, RF_ACTIVE);
- if (!irq) {
- if (port)
- bus_release_resource(dev, SYS_RES_IOPORT,
- 0, port);
- return (ENOMEM);
- }
- } else
- irq = 0;
-
- if (isa_get_drq(dev) != -1) {
- rid = 0;
- drq = bus_alloc_resource(dev, SYS_RES_DRQ, &rid,
- 0, ~0, 1, RF_ACTIVE);
- if (!drq) {
- if (port)
- bus_release_resource(dev, SYS_RES_IOPORT,
- 0, port);
- if (irq)
- bus_release_resource(dev, SYS_RES_IRQ,
- 0, irq);
- return (ENOMEM);
- }
- } else
- drq = 0;
-
- bt_init_softc(dev, port, irq, drq);
-
- return (0);
-}
-
-static void
-bt_isa_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);
-}
-
-/*
- * Check if the device can be found at the port given
- * and if so, set it up ready for further work
- * as an argument, takes the isa_device structure from
- * autoconf.c
- */
-static int
-bt_isa_probe(device_t dev)
-{
- /*
- * find unit and check we have that many defined
- */
- int port_index;
- int max_port_index;
-
- /* No pnp support */
- if (isa_get_vendorid(dev))
- return (ENXIO);
-
- port_index = 0;
- max_port_index = BT_NUM_ISAPORTS - 1;
- /*
- * Bound our board search if the user has
- * specified an exact port.
- */
- bt_find_probe_range(isa_get_port(dev), &port_index, &max_port_index);
-
- if (port_index < 0)
- return (ENXIO);
-
- /* Attempt to find an adapter */
- for (;port_index <= max_port_index; port_index++) {
- struct bt_probe_info info;
- u_int ioport;
-
- ioport = bt_iop_from_bio(port_index);
-
- /*
- * Ensure this port has not already been claimed already
- * by a PCI, EISA or ISA adapter.
- */
- if (bt_check_probed_iop(ioport) != 0)
- continue;
-
- /* Initialise the softc for use during probing */
- if (bt_isa_alloc_resources(dev, ioport,
- ioport + BT_NREGS -1) != 0)
- continue;
-
- /* We're going to attempt to probe it now, so mark it probed */
- bt_mark_probed_bio(port_index);
-
- if (bt_port_probe(dev, &info) != 0) {
- if (bootverbose)
- printf("bt_isa_probe: Probe failed at 0x%x\n",
- ioport);
- bt_isa_release_resources(dev);
- continue;
- }
-
- bt_isa_release_resources(dev);
-
- ISA_SET_RESOURCE(device_get_parent(dev), dev,
- SYS_RES_DRQ, 0, info.drq, 1);
- ISA_SET_RESOURCE(device_get_parent(dev), dev,
- SYS_RES_IRQ, 0, info.irq, 1);
-
- return (0);
- }
-
- return (ENXIO);
-}
-
-/*
- * Attach all the sub-devices we can find
- */
-static int
-bt_isa_attach(device_t dev)
-{
- struct bt_softc *bt = device_get_softc(dev);
- bus_dma_filter_t *filter;
- void *filter_arg;
- bus_addr_t lowaddr;
- int error, drq;
-
- /* Initialise softc */
- error = bt_isa_alloc_resources(dev, 0, ~0);
- if (error) {
- device_printf(dev, "can't allocate resources in bt_isa_attach\n");
- return error;
- }
-
- /* Program the DMA channel for external control */
- if ((drq = isa_get_drq(dev)) != -1)
- isa_dmacascade(drq);
-
- /* Allocate our parent dmatag */
- filter = NULL;
- filter_arg = NULL;
- lowaddr = BUS_SPACE_MAXADDR_24BIT;
- if (bt->model[0] == '4') {
- /*
- * This is a VL adapter. Typically, VL devices have access
- * to the full 32bit address space. On BT-445S adapters
- * prior to revision E, there is a hardware bug that causes
- * corruption of transfers to/from addresses in the range of
- * the BIOS modulo 16MB. The only properly functioning
- * BT-445S Host Adapters have firmware version 3.37.
- * If we encounter one of these adapters and the BIOS is
- * installed, install a filter function for our bus_dma_map
- * that will catch these accesses and bounce them to a safe
- * region of memory.
- */
- if (bt->bios_addr != 0
- && strcmp(bt->model, "445S") == 0
- && strcmp(bt->firmware_ver, "3.37") < 0) {
- filter = btvlbouncefilter;
- filter_arg = bt;
- } else {
- lowaddr = BUS_SPACE_MAXADDR_32BIT;
- }
- }
-
- /* XXX Should be a child of the ISA or VL bus dma tag */
- if (bus_dma_tag_create(/*parent*/NULL, /*alignemnt*/1, /*boundary*/0,
- lowaddr, /*highaddr*/BUS_SPACE_MAXADDR,
- filter, filter_arg,
- /*maxsize*/BUS_SPACE_MAXSIZE_32BIT,
- /*nsegments*/BUS_SPACE_UNRESTRICTED,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
- /*flags*/0, &bt->parent_dmat) != 0) {
- bt_isa_release_resources(dev);
- return (ENOMEM);
- }
-
- error = bt_init(dev);
- if (error) {
- bt_isa_release_resources(dev);
- return (ENOMEM);
- }
-
- if (lowaddr != BUS_SPACE_MAXADDR_32BIT) {
- /* DMA tag for our sense buffers */
- if (bus_dma_tag_create(bt->parent_dmat, /*alignment*/1,
- /*boundary*/0,
- /*lowaddr*/BUS_SPACE_MAXADDR,
- /*highaddr*/BUS_SPACE_MAXADDR,
- /*filter*/NULL, /*filterarg*/NULL,
- bt->max_ccbs
- * sizeof(struct scsi_sense_data),
- /*nsegments*/1,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
- /*flags*/0, &bt->sense_dmat) != 0) {
- bt_isa_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_isa_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++;
- }
-
- error = bt_attach(dev);
- if (error) {
- bt_isa_release_resources(dev);
- return (error);
- }
-
- return (0);
-}
-
-#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_isa_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, bt_isa_probe),
- DEVMETHOD(device_attach, bt_isa_attach),
-
- { 0, 0 }
-};
-
-static driver_t bt_isa_driver = {
- "bt",
- bt_isa_methods,
- sizeof(struct bt_softc),
-};
-
-static devclass_t bt_devclass;
-
-DRIVER_MODULE(bt, isa, bt_isa_driver, bt_devclass, 0, 0);
diff --git a/sys/pci/bt_pci.c b/sys/pci/bt_pci.c
deleted file mode 100644
index 154a2f2..0000000
--- a/sys/pci/bt_pci.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Product specific probe and attach routines for:
- * Buslogic BT946, BT948, BT956, BT958 SCSI controllers
- *
- * Copyright (c) 1995, 1997, 1998 Justin T. Gibbs
- * 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,
- * without modification, immediately at the beginning of the file.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 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$
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/bus.h>
-
-#include <pci/pcireg.h>
-#include <pci/pcivar.h>
-
-#include <machine/bus_memio.h>
-#include <machine/bus_pio.h>
-#include <machine/bus.h>
-#include <machine/resource.h>
-#include <sys/rman.h>
-
-#include <dev/buslogic/btreg.h>
-
-#define BT_PCI_IOADDR PCIR_MAPS
-#define BT_PCI_MEMADDR PCIR_MAPS + 4
-
-#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040104Bul
-#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140104Bul
-#define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT 0x8130104Bul
-
-static int
-bt_pci_alloc_resources(device_t dev)
-{
- int command, type = 0, rid, zero;
- struct resource *regs = 0;
- struct resource *irq = 0;
-
- command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/1);
-#if 0
- /* XXX Memory Mapped I/O seems to cause problems */
- if (command & PCIM_CMD_MEMEN) {
- type = SYS_RES_MEMORY;
- rid = BT_PCI_MEMADDR;
- regs = bus_alloc_resource(dev, type, &rid,
- 0, ~0, 1, RF_ACTIVE);
- }
-#else
- if (!regs && (command & PCIM_CMD_PORTEN)) {
- type = SYS_RES_IOPORT;
- rid = BT_PCI_IOADDR;
- regs = bus_alloc_resource(dev, type, &rid,
- 0, ~0, 1, RF_ACTIVE);
- }
-#endif
- if (!regs)
- return (ENOMEM);
-
- zero = 0;
- irq = bus_alloc_resource(dev, SYS_RES_IRQ, &zero,
- 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
- if (!irq) {
- bus_release_resource(dev, type, rid, regs);
- return (ENOMEM);
- }
-
- bt_init_softc(dev, regs, irq, 0);
-
- return (0);
-}
-
-static void
-bt_pci_release_resources(device_t dev)
-{
- struct bt_softc *bt = device_get_softc(dev);
-
- if (bt->port)
- /* XXX can't cope with memory registers anyway */
- bus_release_resource(dev, SYS_RES_IOPORT,
- BT_PCI_IOADDR, bt->port);
- if (bt->irq)
- bus_release_resource(dev, SYS_RES_IRQ, 0, bt->irq);
- bt_free_softc(dev);
-}
-
-static int
-bt_pci_probe(device_t dev)
-{
- switch (pci_get_devid(dev)) {
- case PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER:
- case PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC:
- {
- struct bt_softc *bt = device_get_softc(dev);
- pci_info_data_t pci_info;
- int error;
-
- error = bt_pci_alloc_resources(dev);
- if (error)
- return (error);
-
- /*
- * Determine if an ISA compatible I/O port has been
- * enabled. If so, record the port so it will not
- * be probed by our ISA probe. If the PCI I/O port
- * was not set to the compatibility port, disable it.
- */
- error = bt_cmd(bt, BOP_INQUIRE_PCI_INFO,
- /*param*/NULL, /*paramlen*/0,
- (u_int8_t*)&pci_info, sizeof(pci_info),
- DEFAULT_CMD_TIMEOUT);
- if (error == 0
- && pci_info.io_port < BIO_DISABLED) {
- bt_mark_probed_bio(pci_info.io_port);
- if (bt->bsh != bt_iop_from_bio(pci_info.io_port)) {
- u_int8_t new_addr;
-
- new_addr = BIO_DISABLED;
- bt_cmd(bt, BOP_MODIFY_IO_ADDR,
- /*param*/&new_addr,
- /*paramlen*/1, /*reply_buf*/NULL,
- /*reply_len*/0,
- DEFAULT_CMD_TIMEOUT);
- }
- }
- bt_pci_release_resources(dev);
- device_set_desc(dev, "Buslogic Multi-Master SCSI Host Adapter");
- return (0);
- }
- default:
- break;
- }
-
- return (ENXIO);
-}
-
-static int
-bt_pci_attach(device_t dev)
-{
- struct bt_softc *bt = device_get_softc(dev);
- int opri;
- int error;
-
- /* Initialize softc */
- error = bt_pci_alloc_resources(dev);
- if (error) {
- device_printf(dev, "can't allocate resources in bt_pci_attach\n");
- return error;
- }
-
- /* Allocate a dmatag for our CCB DMA maps */
- /* XXX Should be a child of the PCI bus dma tag */
- if (bus_dma_tag_create(/*parent*/NULL, /*alignemnt*/1, /*boundary*/0,
- /*lowaddr*/BUS_SPACE_MAXADDR_32BIT,
- /*highaddr*/BUS_SPACE_MAXADDR,
- /*filter*/NULL, /*filterarg*/NULL,
- /*maxsize*/BUS_SPACE_MAXSIZE_32BIT,
- /*nsegments*/BUS_SPACE_UNRESTRICTED,
- /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT,
- /*flags*/0, &bt->parent_dmat) != 0) {
- bt_pci_release_resources(dev);
- return (ENOMEM);
- }
-
- /*
- * Protect ourself from spurrious interrupts during
- * intialization and attach. We should really rely
- * on interrupts during attach, but we don't have
- * access to our interrupts during ISA probes, so until
- * that changes, we mask our interrupts during attach
- * too.
- */
- opri = splcam();
-
- if (bt_probe(dev) || bt_fetch_adapter_info(dev) || bt_init(dev)) {
- bt_pci_release_resources(dev);
- splx(opri);
- return (ENXIO);
- }
-
- error = bt_attach(dev);
- splx(opri);
-
- if (error) {
- bt_pci_release_resources(dev);
- return (error);
- }
-
- return (0);
-}
-
-static device_method_t bt_pci_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, bt_pci_probe),
- DEVMETHOD(device_attach, bt_pci_attach),
-
- { 0, 0 }
-};
-
-static driver_t bt_pci_driver = {
- "bt",
- bt_pci_methods,
- sizeof(struct bt_softc),
-};
-
-static devclass_t bt_devclass;
-
-DRIVER_MODULE(bt, pci, bt_pci_driver, bt_devclass, 0, 0);
OpenPOWER on IntegriCloud