Deleted Added
full compact
scsi_da.c (49856) scsi_da.c (50107)
1/*
2 * Implementation of SCSI Direct Access Peripheral driver for CAM.
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*
2 * Implementation of SCSI Direct Access Peripheral driver for CAM.
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: scsi_da.c,v 1.32 1999/08/14 11:40:31 phk Exp $
28 * $Id: scsi_da.c,v 1.33 1999/08/15 23:34:40 mjacob Exp $
29 */
30
31#include "opt_hw_wdog.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/buf.h>
37#include <sys/devicestat.h>
38#include <sys/dkbad.h>
39#include <sys/disklabel.h>
40#include <sys/diskslice.h>
29 */
30
31#include "opt_hw_wdog.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/buf.h>
37#include <sys/devicestat.h>
38#include <sys/dkbad.h>
39#include <sys/disklabel.h>
40#include <sys/diskslice.h>
41#include <sys/eventhandler.h>
41#include <sys/malloc.h>
42#include <sys/conf.h>
43#include <sys/cons.h>
44
45#include <machine/md_var.h>
46
47#include <vm/vm.h>
48#include <vm/vm_prot.h>

--- 144 unchanged lines hidden (view full) ---

193static void dadone(struct cam_periph *periph,
194 union ccb *done_ccb);
195static int daerror(union ccb *ccb, u_int32_t cam_flags,
196 u_int32_t sense_flags);
197static void daprevent(struct cam_periph *periph, int action);
198static void dasetgeom(struct cam_periph *periph,
199 struct scsi_read_capacity_data * rdcap);
200static timeout_t dasendorderedtag;
42#include <sys/malloc.h>
43#include <sys/conf.h>
44#include <sys/cons.h>
45
46#include <machine/md_var.h>
47
48#include <vm/vm.h>
49#include <vm/vm_prot.h>

--- 144 unchanged lines hidden (view full) ---

194static void dadone(struct cam_periph *periph,
195 union ccb *done_ccb);
196static int daerror(union ccb *ccb, u_int32_t cam_flags,
197 u_int32_t sense_flags);
198static void daprevent(struct cam_periph *periph, int action);
199static void dasetgeom(struct cam_periph *periph,
200 struct scsi_read_capacity_data * rdcap);
201static timeout_t dasendorderedtag;
201static void dashutdown(int howto, void *arg);
202static void dashutdown(void *arg, int howto);
202
203#ifndef DA_DEFAULT_TIMEOUT
204#define DA_DEFAULT_TIMEOUT 60 /* Timeout in seconds */
205#endif
206
207/*
208 * DA_ORDEREDTAG_INTERVAL determines how often, relative
209 * to the default timeout, we check to see whether an ordered

--- 600 unchanged lines hidden (view full) ---

810 status = csa.ccb_h.status;
811 xpt_free_path(path);
812 }
813
814 if (status != CAM_REQ_CMP) {
815 printf("da: Failed to attach master async callback "
816 "due to status 0x%x!\n", status);
817 } else {
203
204#ifndef DA_DEFAULT_TIMEOUT
205#define DA_DEFAULT_TIMEOUT 60 /* Timeout in seconds */
206#endif
207
208/*
209 * DA_ORDEREDTAG_INTERVAL determines how often, relative
210 * to the default timeout, we check to see whether an ordered

--- 600 unchanged lines hidden (view full) ---

811 status = csa.ccb_h.status;
812 xpt_free_path(path);
813 }
814
815 if (status != CAM_REQ_CMP) {
816 printf("da: Failed to attach master async callback "
817 "due to status 0x%x!\n", status);
818 } else {
818 int err;
819
820 /* If we were successfull, register our devsw */
821 cdevsw_add(&da_cdevsw);
822
823 /*
824 * Schedule a periodic event to occasioanly send an
825 * ordered tag to a device.
826 */
827 timeout(dasendorderedtag, NULL,
828 (DA_DEFAULT_TIMEOUT * hz) / DA_ORDEREDTAG_INTERVAL);
829
819
820 /* If we were successfull, register our devsw */
821 cdevsw_add(&da_cdevsw);
822
823 /*
824 * Schedule a periodic event to occasioanly send an
825 * ordered tag to a device.
826 */
827 timeout(dasendorderedtag, NULL,
828 (DA_DEFAULT_TIMEOUT * hz) / DA_ORDEREDTAG_INTERVAL);
829
830 if ((err = at_shutdown(dashutdown, NULL,
831 SHUTDOWN_POST_SYNC)) != 0)
832 printf("dainit: at_shutdown returned %d!\n", err);
830 /* Register our shutdown event handler */
831 if ((EVENTHANDLER_REGISTER(shutdown_post_sync, dashutdown,
832 NULL, SHUTDOWN_PRI_DEFAULT)) == NULL)
833 printf("dainit: shutdown event registration failed!\n");
833 }
834}
835
836static void
837daoninvalidate(struct cam_periph *periph)
838{
839 int s;
840 struct da_softc *softc;

--- 707 unchanged lines hidden (view full) ---

1548 (DA_DEFAULT_TIMEOUT * hz) / DA_ORDEREDTAG_INTERVAL);
1549}
1550
1551/*
1552 * Step through all DA peripheral drivers, and if the device is still open,
1553 * sync the disk cache to physical media.
1554 */
1555static void
834 }
835}
836
837static void
838daoninvalidate(struct cam_periph *periph)
839{
840 int s;
841 struct da_softc *softc;

--- 707 unchanged lines hidden (view full) ---

1549 (DA_DEFAULT_TIMEOUT * hz) / DA_ORDEREDTAG_INTERVAL);
1550}
1551
1552/*
1553 * Step through all DA peripheral drivers, and if the device is still open,
1554 * sync the disk cache to physical media.
1555 */
1556static void
1556dashutdown(int howto, void *arg)
1557dashutdown(void * arg, int howto)
1557{
1558 struct cam_periph *periph;
1559 struct da_softc *softc;
1560
1561 for (periph = TAILQ_FIRST(&dadriver.units); periph != NULL;
1562 periph = TAILQ_NEXT(periph, unit_links)) {
1563 union ccb ccb;
1564 softc = (struct da_softc *)periph->softc;

--- 52 unchanged lines hidden ---
1558{
1559 struct cam_periph *periph;
1560 struct da_softc *softc;
1561
1562 for (periph = TAILQ_FIRST(&dadriver.units); periph != NULL;
1563 periph = TAILQ_NEXT(periph, unit_links)) {
1564 union ccb ccb;
1565 softc = (struct da_softc *)periph->softc;

--- 52 unchanged lines hidden ---