Deleted Added
full compact
scsi_pt.c (198382) scsi_pt.c (220644)
1/*-
2 * Implementation of SCSI Processor Target Peripheral driver for CAM.
3 *
4 * Copyright (c) 1998 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

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

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
29#include <sys/cdefs.h>
1/*-
2 * Implementation of SCSI Processor Target Peripheral driver for CAM.
3 *
4 * Copyright (c) 1998 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

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

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
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_pt.c 198382 2009-10-23 08:27:55Z mav $");
30__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_pt.c 220644 2011-04-14 21:25:32Z mav $");
31
32#include <sys/param.h>
33#include <sys/queue.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/types.h>
37#include <sys/bio.h>
38#include <sys/devicestat.h>

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

247 }
248}
249
250static cam_status
251ptctor(struct cam_periph *periph, void *arg)
252{
253 struct pt_softc *softc;
254 struct ccb_getdev *cgd;
31
32#include <sys/param.h>
33#include <sys/queue.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/types.h>
37#include <sys/bio.h>
38#include <sys/devicestat.h>

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

247 }
248}
249
250static cam_status
251ptctor(struct cam_periph *periph, void *arg)
252{
253 struct pt_softc *softc;
254 struct ccb_getdev *cgd;
255 struct ccb_pathinq cpi;
255
256 cgd = (struct ccb_getdev *)arg;
257 if (periph == NULL) {
258 printf("ptregister: periph was NULL!!\n");
259 return(CAM_REQ_CMP_ERR);
260 }
261
262 if (cgd == NULL) {

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

275 bzero(softc, sizeof(*softc));
276 LIST_INIT(&softc->pending_ccbs);
277 softc->state = PT_STATE_NORMAL;
278 bioq_init(&softc->bio_queue);
279
280 softc->io_timeout = SCSI_PT_DEFAULT_TIMEOUT * 1000;
281
282 periph->softc = softc;
256
257 cgd = (struct ccb_getdev *)arg;
258 if (periph == NULL) {
259 printf("ptregister: periph was NULL!!\n");
260 return(CAM_REQ_CMP_ERR);
261 }
262
263 if (cgd == NULL) {

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

276 bzero(softc, sizeof(*softc));
277 LIST_INIT(&softc->pending_ccbs);
278 softc->state = PT_STATE_NORMAL;
279 bioq_init(&softc->bio_queue);
280
281 softc->io_timeout = SCSI_PT_DEFAULT_TIMEOUT * 1000;
282
283 periph->softc = softc;
283
284
285 bzero(&cpi, sizeof(cpi));
286 xpt_setup_ccb(&cpi.ccb_h, periph->path, CAM_PRIORITY_NORMAL);
287 cpi.ccb_h.func_code = XPT_PATH_INQ;
288 xpt_action((union ccb *)&cpi);
289
284 cam_periph_unlock(periph);
285 softc->device_stats = devstat_new_entry("pt",
286 periph->unit_number, 0,
287 DEVSTAT_NO_BLOCKSIZE,
290 cam_periph_unlock(periph);
291 softc->device_stats = devstat_new_entry("pt",
292 periph->unit_number, 0,
293 DEVSTAT_NO_BLOCKSIZE,
288 SID_TYPE(&cgd->inq_data) | DEVSTAT_TYPE_IF_SCSI,
294 SID_TYPE(&cgd->inq_data) |
295 XPORT_DEVSTAT_TYPE(cpi.transport),
289 DEVSTAT_PRIORITY_OTHER);
290
291 softc->dev = make_dev(&pt_cdevsw, periph->unit_number, UID_ROOT,
292 GID_OPERATOR, 0600, "%s%d", periph->periph_name,
293 periph->unit_number);
294 cam_periph_lock(periph);
295 softc->dev->si_drv1 = periph;
296

--- 344 unchanged lines hidden ---
296 DEVSTAT_PRIORITY_OTHER);
297
298 softc->dev = make_dev(&pt_cdevsw, periph->unit_number, UID_ROOT,
299 GID_OPERATOR, 0600, "%s%d", periph->periph_name,
300 periph->unit_number);
301 cam_periph_lock(periph);
302 softc->dev->si_drv1 = periph;
303

--- 344 unchanged lines hidden ---