Deleted Added
full compact
scsi_low.c (143839) scsi_low.c (147723)
1/* $NecBSD: scsi_low.c,v 1.24.10.8 2001/06/26 07:39:44 honda Exp $ */
2/* $NetBSD$ */
3
4#include <sys/cdefs.h>
1/* $NecBSD: scsi_low.c,v 1.24.10.8 2001/06/26 07:39:44 honda Exp $ */
2/* $NetBSD$ */
3
4#include <sys/cdefs.h>
5__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_low.c 143839 2005-03-19 06:32:57Z scottl $");
5__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_low.c 147723 2005-07-01 15:21:30Z avatar $");
6
7#define SCSI_LOW_STATICS
8#define SCSI_LOW_DEBUG
9#define SCSI_LOW_NEGOTIATE_BEFORE_SENSE
10#define SCSI_LOW_START_UP_CHECK
11
12/* #define SCSI_LOW_INFO_DETAIL */
13

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

106#endif /* __NetBSD__ */
107
108#ifdef __FreeBSD__
109#include <cam/cam.h>
110#include <cam/cam_ccb.h>
111#include <cam/cam_sim.h>
112#include <cam/cam_debug.h>
113#include <cam/cam_periph.h>
6
7#define SCSI_LOW_STATICS
8#define SCSI_LOW_DEBUG
9#define SCSI_LOW_NEGOTIATE_BEFORE_SENSE
10#define SCSI_LOW_START_UP_CHECK
11
12/* #define SCSI_LOW_INFO_DETAIL */
13

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

106#endif /* __NetBSD__ */
107
108#ifdef __FreeBSD__
109#include <cam/cam.h>
110#include <cam/cam_ccb.h>
111#include <cam/cam_sim.h>
112#include <cam/cam_debug.h>
113#include <cam/cam_periph.h>
114#include <cam/cam_xpt_periph.h>
114
115#include <cam/scsi/scsi_all.h>
116#include <cam/scsi/scsi_message.h>
117
118#include <cam/scsi/scsi_low.h>
119
120#include <sys/cons.h>
121#endif /* __FreeBSD__ */

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

139#define SCSI_LOW_DISK_PARITY 0x00000008
140#define SCSI_LOW_DISK_SYNC 0x00010000
141#define SCSI_LOW_DISK_WIDE_16 0x00020000
142#define SCSI_LOW_DISK_WIDE_32 0x00040000
143#define SCSI_LOW_DISK_WIDE (SCSI_LOW_DISK_WIDE_16 | SCSI_LOW_DISK_WIDE_32)
144#define SCSI_LOW_DISK_LFLAGS 0x0000ffff
145#define SCSI_LOW_DISK_TFLAGS 0xffff0000
146
115
116#include <cam/scsi/scsi_all.h>
117#include <cam/scsi/scsi_message.h>
118
119#include <cam/scsi/scsi_low.h>
120
121#include <sys/cons.h>
122#endif /* __FreeBSD__ */

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

140#define SCSI_LOW_DISK_PARITY 0x00000008
141#define SCSI_LOW_DISK_SYNC 0x00010000
142#define SCSI_LOW_DISK_WIDE_16 0x00020000
143#define SCSI_LOW_DISK_WIDE_32 0x00040000
144#define SCSI_LOW_DISK_WIDE (SCSI_LOW_DISK_WIDE_16 | SCSI_LOW_DISK_WIDE_32)
145#define SCSI_LOW_DISK_LFLAGS 0x0000ffff
146#define SCSI_LOW_DISK_TFLAGS 0xffff0000
147
148MALLOC_DEFINE(M_SCSILOW, "SCSI low", "SCSI low buffers");
149
147/**************************************************************
148 * Declarations
149 **************************************************************/
150/* static */ void scsi_low_info(struct scsi_low_softc *, struct targ_info *, u_char *);
151static void scsi_low_engage(void *);
152static struct slccb *scsi_low_establish_ccb(struct targ_info *, struct lun_info *, scsi_low_tag_t);
153static int scsi_low_done(struct scsi_low_softc *, struct slccb *);
154static int scsi_low_setup_done(struct scsi_low_softc *, struct slccb *);

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

389 return tp->error_code;
390}
391
392#ifdef SCSI_LOW_INTERFACE_XS
393/**************************************************************
394 * SCSI INTERFACE (XS)
395 **************************************************************/
396#define SCSI_LOW_MINPHYS 0x10000
150/**************************************************************
151 * Declarations
152 **************************************************************/
153/* static */ void scsi_low_info(struct scsi_low_softc *, struct targ_info *, u_char *);
154static void scsi_low_engage(void *);
155static struct slccb *scsi_low_establish_ccb(struct targ_info *, struct lun_info *, scsi_low_tag_t);
156static int scsi_low_done(struct scsi_low_softc *, struct slccb *);
157static int scsi_low_setup_done(struct scsi_low_softc *, struct slccb *);

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

392 return tp->error_code;
393}
394
395#ifdef SCSI_LOW_INTERFACE_XS
396/**************************************************************
397 * SCSI INTERFACE (XS)
398 **************************************************************/
399#define SCSI_LOW_MINPHYS 0x10000
397#define SCSI_LOW_MALLOC(size) malloc((size), M_DEVBUF, M_NOWAIT)
398#define SCSI_LOW_FREE(pt) free((pt), M_DEVBUF)
400#define SCSI_LOW_MALLOC(size) malloc((size), M_SCSILOW, M_NOWAIT)
401#define SCSI_LOW_FREE(pt) free((pt), M_SCSILOW)
399#define SCSI_LOW_ALLOC_CCB(flags) scsi_low_get_ccb((flags))
400#define SCSI_LOW_XS_POLL_HZ 1000
401
402static int scsi_low_poll_xs(struct scsi_low_softc *, struct slccb *);
403static void scsi_low_scsi_minphys_xs(struct buf *);
404#ifdef SCSI_LOW_TARGET_OPEN
405static int scsi_low_target_open(struct scsipi_link *, struct cfdata *);
406#endif /* SCSI_LOW_TARGET_OPEN */

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

879#endif /* SCSI_LOW_TARGET_OPEN */
880
881#endif /* SCSI_LOW_INTERFACE_XS */
882
883#ifdef SCSI_LOW_INTERFACE_CAM
884/**************************************************************
885 * SCSI INTERFACE (CAM)
886 **************************************************************/
402#define SCSI_LOW_ALLOC_CCB(flags) scsi_low_get_ccb((flags))
403#define SCSI_LOW_XS_POLL_HZ 1000
404
405static int scsi_low_poll_xs(struct scsi_low_softc *, struct slccb *);
406static void scsi_low_scsi_minphys_xs(struct buf *);
407#ifdef SCSI_LOW_TARGET_OPEN
408static int scsi_low_target_open(struct scsipi_link *, struct cfdata *);
409#endif /* SCSI_LOW_TARGET_OPEN */

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

882#endif /* SCSI_LOW_TARGET_OPEN */
883
884#endif /* SCSI_LOW_INTERFACE_XS */
885
886#ifdef SCSI_LOW_INTERFACE_CAM
887/**************************************************************
888 * SCSI INTERFACE (CAM)
889 **************************************************************/
887#define SCSI_LOW_MALLOC(size) malloc((size), M_DEVBUF, M_NOWAIT)
888#define SCSI_LOW_FREE(pt) free((pt), M_DEVBUF)
890#define SCSI_LOW_MALLOC(size) malloc((size), M_SCSILOW, M_NOWAIT)
891#define SCSI_LOW_FREE(pt) free((pt), M_SCSILOW)
889#define SCSI_LOW_ALLOC_CCB(flags) scsi_low_get_ccb()
890
891static void scsi_low_poll_cam(struct cam_sim *);
892static void scsi_low_cam_rescan_callback(struct cam_periph *, union ccb *);
893static void scsi_low_rescan_bus_cam(struct scsi_low_softc *);
894void scsi_low_scsi_action_cam(struct cam_sim *, union ccb *);
895
896static int scsi_low_attach_cam(struct scsi_low_softc *);

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

950
951static void
952scsi_low_cam_rescan_callback(periph, ccb)
953 struct cam_periph *periph;
954 union ccb *ccb;
955{
956
957 xpt_free_path(ccb->ccb_h.path);
892#define SCSI_LOW_ALLOC_CCB(flags) scsi_low_get_ccb()
893
894static void scsi_low_poll_cam(struct cam_sim *);
895static void scsi_low_cam_rescan_callback(struct cam_periph *, union ccb *);
896static void scsi_low_rescan_bus_cam(struct scsi_low_softc *);
897void scsi_low_scsi_action_cam(struct cam_sim *, union ccb *);
898
899static int scsi_low_attach_cam(struct scsi_low_softc *);

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

953
954static void
955scsi_low_cam_rescan_callback(periph, ccb)
956 struct cam_periph *periph;
957 union ccb *ccb;
958{
959
960 xpt_free_path(ccb->ccb_h.path);
958 free(ccb, M_DEVBUF);
961 xpt_free_ccb(ccb);
959}
960
961static void
962scsi_low_rescan_bus_cam(slp)
963 struct scsi_low_softc *slp;
964{
965 struct cam_path *path;
962}
963
964static void
965scsi_low_rescan_bus_cam(slp)
966 struct scsi_low_softc *slp;
967{
968 struct cam_path *path;
966 union ccb *ccb = malloc(sizeof(union ccb), M_DEVBUF, M_WAITOK);
969 union ccb *ccb = xpt_alloc_ccb();
967 cam_status status;
968
969 bzero(ccb, sizeof(union ccb));
970
971 status = xpt_create_path(&path, xpt_periph,
972 cam_sim_path(slp->sl_si.sim), -1, 0);
973 if (status != CAM_REQ_CMP)
974 return;

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

1407 slp->sl_openings, tagged_openings, devq);
1408
1409 if (slp->sl_si.sim == NULL) {
1410 cam_simq_free(devq);
1411 return ENODEV;
1412 }
1413
1414 if (xpt_bus_register(slp->sl_si.sim, 0) != CAM_SUCCESS) {
970 cam_status status;
971
972 bzero(ccb, sizeof(union ccb));
973
974 status = xpt_create_path(&path, xpt_periph,
975 cam_sim_path(slp->sl_si.sim), -1, 0);
976 if (status != CAM_REQ_CMP)
977 return;

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

1410 slp->sl_openings, tagged_openings, devq);
1411
1412 if (slp->sl_si.sim == NULL) {
1413 cam_simq_free(devq);
1414 return ENODEV;
1415 }
1416
1417 if (xpt_bus_register(slp->sl_si.sim, 0) != CAM_SUCCESS) {
1415 free(slp->sl_si.sim, M_DEVBUF);
1418 free(slp->sl_si.sim, M_SCSILOW);
1416 return ENODEV;
1417 }
1418
1419 if (xpt_create_path(&slp->sl_si.path, /*periph*/NULL,
1420 cam_sim_path(slp->sl_si.sim), CAM_TARGET_WILDCARD,
1421 CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
1422 xpt_bus_deregister(cam_sim_path(slp->sl_si.sim));
1423 cam_sim_free(slp->sl_si.sim, /*free_simq*/TRUE);

--- 3489 unchanged lines hidden ---
1419 return ENODEV;
1420 }
1421
1422 if (xpt_create_path(&slp->sl_si.path, /*periph*/NULL,
1423 cam_sim_path(slp->sl_si.sim), CAM_TARGET_WILDCARD,
1424 CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
1425 xpt_bus_deregister(cam_sim_path(slp->sl_si.sim));
1426 cam_sim_free(slp->sl_si.sim, /*free_simq*/TRUE);

--- 3489 unchanged lines hidden ---