diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2006-07-31 10:03:23 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2006-07-31 10:03:23 +0000 |
commit | 097e169c59af11b67cb06f25efafbdc754d7761e (patch) | |
tree | 36d7093dda153e71a104682c4a787d09aafd0675 | |
parent | 4462b7f4737cfb3a63be94af6d93a27126344906 (diff) |
hook arc up to the scsi midlayer
-rw-r--r-- | sys/dev/pci/arc.c | 42 | ||||
-rw-r--r-- | sys/dev/pci/files.pci | 4 |
2 files changed, 43 insertions, 3 deletions
diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c index c0eeacd0bc5..6f0bea2442a 100644 --- a/sys/dev/pci/arc.c +++ b/sys/dev/pci/arc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc.c,v 1.4 2006/07/31 08:22:04 dlg Exp $ */ +/* $OpenBSD: arc.c,v 1.5 2006/07/31 10:03:22 dlg Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -18,6 +18,7 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/buf.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/device.h> @@ -169,6 +170,9 @@ struct arc_sge { u_int32_t sge_hi_addr; } __packed; +#define ARC_MAX_TARGET 16 +#define ARC_MAX_LUN 8 + int arc_match(struct device *, void *, void *); void arc_attach(struct device *, struct device *, void *); int arc_detach(struct device *, int); @@ -208,6 +212,18 @@ struct cfdriver arc_cd = { NULL, "arc", DV_DULL }; +/* interface for scsi midlayer to talk to */ +int arc_scsi_cmd(struct scsi_xfer *); +void arc_minphys(struct buf *bp); + +struct scsi_adapter arc_switch = { + arc_scsi_cmd, arc_minphys, NULL, NULL, NULL +}; + +struct scsi_device arc_dev = { + NULL, NULL, NULL, NULL +}; + /* code to deal with getting bits in and out of the bus space */ u_int32_t arc_read(struct arc_softc *, bus_size_t); void arc_read_region(struct arc_softc *, bus_size_t, @@ -288,6 +304,15 @@ arc_attach(struct device *parent, struct device *self, void *aux) return; } + sc->sc_link.device = &arc_dev; + sc->sc_link.adapter = &arc_switch; + sc->sc_link.adapter_softc = sc; + sc->sc_link.adapter_target = ARC_MAX_TARGET; + sc->sc_link.adapter_buswidth = ARC_MAX_TARGET; + sc->sc_link.openings = sc->sc_req_count / ARC_MAX_TARGET; + + config_found(self, &sc->sc_link, scsiprint); + return; } @@ -307,6 +332,21 @@ arc_intr(void *arg) return (0); } +int +arc_scsi_cmd(struct scsi_xfer *xs) +{ + xs->error = XS_DRIVER_STUFFUP; + scsi_done(xs); + return (COMPLETE); +} + +void +arc_minphys(struct buf *bp) +{ + if (bp->b_bcount > MAXPHYS) + bp->b_bcount = MAXPHYS; + minphys(bp); +} int arc_map_pci_resources(struct arc_softc *sc, struct pci_attach_args *pa) diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci index 8ad0c052100..eebbda8ce90 100644 --- a/sys/dev/pci/files.pci +++ b/sys/dev/pci/files.pci @@ -1,4 +1,4 @@ -# $OpenBSD: files.pci,v 1.211 2006/07/29 05:08:41 dlg Exp $ +# $OpenBSD: files.pci,v 1.212 2006/07/31 10:03:22 dlg Exp $ # $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $ # # Config file and device description for machine-independent PCI code. @@ -75,7 +75,7 @@ attach twe at pci with twe_pci file dev/pci/twe_pci.c twe_pci # Areca RAID Controllers -device arc +device arc: scsi attach arc at pci file dev/pci/arc.c arc |