diff options
author | msmith <msmith@FreeBSD.org> | 2001-02-25 22:48:34 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2001-02-25 22:48:34 +0000 |
commit | e5b2c99d71956a1a73efdfbefb3ed19bd7d00d3b (patch) | |
tree | 92c016de15d655b019e93776c4543e7d28f396b8 /sys/dev/mly/mly_pci.c | |
parent | 4e1aac88bdd20610856392647e751f1cd18eef78 (diff) | |
download | FreeBSD-src-e5b2c99d71956a1a73efdfbefb3ed19bd7d00d3b.zip FreeBSD-src-e5b2c99d71956a1a73efdfbefb3ed19bd7d00d3b.tar.gz |
Major update and bugfix for the 'mly' driver.
- Convert to a more efficient queueing implementation.
- Don't allocate command buffers on the fly; simply work from a
static pool.
- Add a control device interface, for later use.
- Handle controller overload better as a consequence of the
improved queue implementation.
- Add support for the XPT_GET_TRAN_SETTINGS ccb, and correctly
set the virtual SCSI channels up for multiple outstanding I/Os.
- Update copyrights for 2001.
- Some whitespace fixes to improve readability.
Due to a misunderstanding on my part, previous versions of the
driver were limited to a single outstanding I/O per virtual drive.
Needless to say, this update improves performance substantially.
Diffstat (limited to 'sys/dev/mly/mly_pci.c')
-rw-r--r-- | sys/dev/mly/mly_pci.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/sys/dev/mly/mly_pci.c b/sys/dev/mly/mly_pci.c index c0dbd45..e890a69 100644 --- a/sys/dev/mly/mly_pci.c +++ b/sys/dev/mly/mly_pci.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000 Michael Smith + * Copyright (c) 2000, 2001 Michael Smith * Copyright (c) 2000 BSDi * All rights reserved. * @@ -46,6 +46,7 @@ #include <pci/pcivar.h> #include <dev/mly/mlyreg.h> +#include <dev/mly/mlyio.h> #include <dev/mly/mlyvar.h> static int mly_pci_probe(device_t dev); @@ -60,7 +61,6 @@ static int mly_sg_map(struct mly_softc *sc); static void mly_sg_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error); static int mly_mmbox_map(struct mly_softc *sc); static void mly_mmbox_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error); -static void mly_free_command_cluster(struct mly_command_cluster *mcc); static device_method_t mly_methods[] = { /* Device interface */ @@ -236,7 +236,7 @@ mly_pci_attach(device_t dev) BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - sizeof(union mly_command_packet) * MLY_CMD_CLUSTERCOUNT, 1, /* maxsize, nsegments */ + sizeof(union mly_command_packet) * MLY_MAXCOMMANDS, 1, /* maxsize, nsegments */ BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ 0, /* flags */ &sc->mly_packet_dmat)) { @@ -515,16 +515,22 @@ mly_mmbox_map_helper(void *arg, bus_dma_segment_t *segs, int nseg, int error) void mly_free(struct mly_softc *sc) { - struct mly_command_cluster *mcc; - + struct mly_command *mc; + debug_called(1); /* detach from CAM */ mly_cam_detach(sc); - /* throw away any command buffers */ - while ((mcc = mly_dequeue_cluster(sc)) != NULL) - mly_free_command_cluster(mcc); + /* throw away command buffer DMA maps */ + while (mly_alloc_command(sc, &mc) == 0) + bus_dmamap_destroy(sc->mly_buffer_dmat, mc->mc_datamap); + + /* release the packet storage */ + if (sc->mly_packet != NULL) { + bus_dmamap_unload(sc->mly_packet_dmat, sc->mly_packetmap); + bus_dmamem_free(sc->mly_packet_dmat, sc->mly_packet, sc->mly_packetmap); + } /* throw away the controllerinfo structure */ if (sc->mly_controllerinfo != NULL) @@ -569,22 +575,3 @@ mly_free(struct mly_softc *sc) bus_release_resource(sc->mly_dev, SYS_RES_MEMORY, sc->mly_regs_rid, sc->mly_regs_resource); } -/******************************************************************************** - * Free a command cluster. - */ -static void -mly_free_command_cluster(struct mly_command_cluster *mcc) -{ - struct mly_softc *sc = mcc->mcc_command[0].mc_sc; - int i; - - debug_called(1); - - for (i = 0; i < MLY_CMD_CLUSTERCOUNT; i++) - bus_dmamap_destroy(sc->mly_buffer_dmat, mcc->mcc_command[i].mc_datamap); - - bus_dmamap_unload(sc->mly_packet_dmat, mcc->mcc_packetmap); - bus_dmamem_free(sc->mly_packet_dmat, mcc->mcc_packet, mcc->mcc_packetmap); - free(mcc, M_DEVBUF); -} - |