vpo.c (170872) | vpo.c (184130) |
---|---|
1/*- 2 * Copyright (c) 1997, 1998, 1999 Nicolas Souchu 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997, 1998, 1999 Nicolas Souchu 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/ppbus/vpo.c 170872 2007-06-17 05:55:54Z scottl $"); | 29__FBSDID("$FreeBSD: head/sys/dev/ppbus/vpo.c 184130 2008-10-21 18:30:10Z jhb $"); |
30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/module.h> 34#include <sys/bus.h> 35#include <sys/lock.h> 36#include <sys/mutex.h> 37#include <sys/malloc.h> --- 20 unchanged lines hidden (view full) --- 58 59struct vpo_sense { 60 struct scsi_sense cmd; 61 unsigned int stat; 62 unsigned int count; 63}; 64 65struct vpo_data { | 30 31#include <sys/param.h> 32#include <sys/systm.h> 33#include <sys/module.h> 34#include <sys/bus.h> 35#include <sys/lock.h> 36#include <sys/mutex.h> 37#include <sys/malloc.h> --- 20 unchanged lines hidden (view full) --- 58 59struct vpo_sense { 60 struct scsi_sense cmd; 61 unsigned int stat; 62 unsigned int count; 63}; 64 65struct vpo_data { |
66 unsigned short vpo_unit; 67 | 66 device_t vpo_dev; |
68 int vpo_stat; 69 int vpo_count; 70 int vpo_error; 71 72 int vpo_isplus; 73 74 struct cam_sim *sim; 75 --- 13 unchanged lines hidden (view full) --- 89static void vpo_cam_rescan(struct vpo_data *vpo); 90 91static void 92vpo_identify(driver_t *driver, device_t parent) 93{ 94 95 device_t dev; 96 | 67 int vpo_stat; 68 int vpo_count; 69 int vpo_error; 70 71 int vpo_isplus; 72 73 struct cam_sim *sim; 74 --- 13 unchanged lines hidden (view full) --- 88static void vpo_cam_rescan(struct vpo_data *vpo); 89 90static void 91vpo_identify(driver_t *driver, device_t parent) 92{ 93 94 device_t dev; 95 |
97 dev = device_find_child(parent, "vpo", 0); | 96 dev = device_find_child(parent, "vpo", -1); |
98 if (!dev) 99 BUS_ADD_CHILD(parent, 0, "vpo", -1); 100} 101 102/* 103 * vpo_probe() 104 */ 105static int 106vpo_probe(device_t dev) 107{ 108 struct vpo_data *vpo; 109 int error; 110 111 vpo = DEVTOSOFTC(dev); | 97 if (!dev) 98 BUS_ADD_CHILD(parent, 0, "vpo", -1); 99} 100 101/* 102 * vpo_probe() 103 */ 104static int 105vpo_probe(device_t dev) 106{ 107 struct vpo_data *vpo; 108 int error; 109 110 vpo = DEVTOSOFTC(dev); |
111 vpo->vpo_dev = dev; |
|
112 | 112 |
113 /* vpo dependent initialisation */ 114 vpo->vpo_unit = device_get_unit(dev); 115 116 /* low level probe */ 117 vpoio_set_unit(&vpo->vpo_io, vpo->vpo_unit); 118 | |
119 /* check ZIP before ZIP+ or imm_probe() will send controls to 120 * the printer or whatelse connected to the port */ 121 if ((error = vpoio_probe(dev, &vpo->vpo_io)) == 0) { 122 vpo->vpo_isplus = 0; 123 device_set_desc(dev, 124 "Iomega VPI0 Parallel to SCSI interface"); 125 } else if ((error = imm_probe(dev, &vpo->vpo_io)) == 0) { 126 vpo->vpo_isplus = 1; --- 125 unchanged lines hidden (view full) --- 252 /* connection to ppbus interrupted */ 253 csio->ccb_h.status = CAM_CMD_TIMEOUT; 254 goto error; 255 } 256 257 /* if a timeout occured, no sense */ 258 if (vpo->vpo_error) { 259 if (vpo->vpo_error != VP0_ESELECT_TIMEOUT) | 113 /* check ZIP before ZIP+ or imm_probe() will send controls to 114 * the printer or whatelse connected to the port */ 115 if ((error = vpoio_probe(dev, &vpo->vpo_io)) == 0) { 116 vpo->vpo_isplus = 0; 117 device_set_desc(dev, 118 "Iomega VPI0 Parallel to SCSI interface"); 119 } else if ((error = imm_probe(dev, &vpo->vpo_io)) == 0) { 120 vpo->vpo_isplus = 1; --- 125 unchanged lines hidden (view full) --- 246 /* connection to ppbus interrupted */ 247 csio->ccb_h.status = CAM_CMD_TIMEOUT; 248 goto error; 249 } 250 251 /* if a timeout occured, no sense */ 252 if (vpo->vpo_error) { 253 if (vpo->vpo_error != VP0_ESELECT_TIMEOUT) |
260 printf("vpo%d: VP0 error/timeout (%d)\n", 261 vpo->vpo_unit, vpo->vpo_error); | 254 device_printf(vpo->vpo_dev, "VP0 error/timeout (%d)\n", 255 vpo->vpo_error); |
262 263 csio->ccb_h.status = CAM_CMD_TIMEOUT; 264 goto error; 265 } 266 267 /* check scsi status */ 268 if (vpo->vpo_stat != SCSI_STATUS_OK) { 269 csio->scsi_status = vpo->vpo_stat; --- 73 unchanged lines hidden (view full) --- 343 switch (ccb->ccb_h.func_code) { 344 case XPT_SCSI_IO: 345 { 346 struct ccb_scsiio *csio; 347 348 csio = &ccb->csio; 349 350#ifdef VP0_DEBUG | 256 257 csio->ccb_h.status = CAM_CMD_TIMEOUT; 258 goto error; 259 } 260 261 /* check scsi status */ 262 if (vpo->vpo_stat != SCSI_STATUS_OK) { 263 csio->scsi_status = vpo->vpo_stat; --- 73 unchanged lines hidden (view full) --- 337 switch (ccb->ccb_h.func_code) { 338 case XPT_SCSI_IO: 339 { 340 struct ccb_scsiio *csio; 341 342 csio = &ccb->csio; 343 344#ifdef VP0_DEBUG |
351 printf("vpo%d: XPT_SCSI_IO (0x%x) request\n", 352 vpo->vpo_unit, csio->cdb_io.cdb_bytes[0]); | 345 device_printf(vpo->vpo_dev, "XPT_SCSI_IO (0x%x) request\n", 346 csio->cdb_io.cdb_bytes[0]); |
353#endif 354 355 vpo_intr(vpo, csio); 356 357 xpt_done(ccb); 358 359 break; 360 } 361 case XPT_CALC_GEOMETRY: 362 { 363 struct ccb_calc_geometry *ccg; 364 365 ccg = &ccb->ccg; 366 367#ifdef VP0_DEBUG | 347#endif 348 349 vpo_intr(vpo, csio); 350 351 xpt_done(ccb); 352 353 break; 354 } 355 case XPT_CALC_GEOMETRY: 356 { 357 struct ccb_calc_geometry *ccg; 358 359 ccg = &ccb->ccg; 360 361#ifdef VP0_DEBUG |
368 printf("vpo%d: XPT_CALC_GEOMETRY (bs=%d,vs=%jd,c=%d,h=%d,spt=%d) request\n", 369 vpo->vpo_unit, | 362 device_printf(vpo->vpo_dev, "XPT_CALC_GEOMETRY (bs=%d,vs=%jd,c=%d,h=%d,spt=%d) request\n", |
370 ccg->block_size, 371 (intmax_t)ccg->volume_size, 372 ccg->cylinders, 373 ccg->heads, 374 ccg->secs_per_track); 375#endif 376 377 ccg->heads = 64; --- 4 unchanged lines hidden (view full) --- 382 ccb->ccb_h.status = CAM_REQ_CMP; 383 xpt_done(ccb); 384 break; 385 } 386 case XPT_RESET_BUS: /* Reset the specified SCSI bus */ 387 { 388 389#ifdef VP0_DEBUG | 363 ccg->block_size, 364 (intmax_t)ccg->volume_size, 365 ccg->cylinders, 366 ccg->heads, 367 ccg->secs_per_track); 368#endif 369 370 ccg->heads = 64; --- 4 unchanged lines hidden (view full) --- 375 ccb->ccb_h.status = CAM_REQ_CMP; 376 xpt_done(ccb); 377 break; 378 } 379 case XPT_RESET_BUS: /* Reset the specified SCSI bus */ 380 { 381 382#ifdef VP0_DEBUG |
390 printf("vpo%d: XPT_RESET_BUS request\n", vpo->vpo_unit); | 383 device_printf(vpo->vpo_dev, "XPT_RESET_BUS request\n"); |
391#endif 392 393 if (vpo->vpo_isplus) { 394 if (imm_reset_bus(&vpo->vpo_io)) { 395 ccb->ccb_h.status = CAM_REQ_CMP_ERR; 396 xpt_done(ccb); 397 return; 398 } --- 9 unchanged lines hidden (view full) --- 408 xpt_done(ccb); 409 break; 410 } 411 case XPT_PATH_INQ: /* Path routing inquiry */ 412 { 413 struct ccb_pathinq *cpi = &ccb->cpi; 414 415#ifdef VP0_DEBUG | 384#endif 385 386 if (vpo->vpo_isplus) { 387 if (imm_reset_bus(&vpo->vpo_io)) { 388 ccb->ccb_h.status = CAM_REQ_CMP_ERR; 389 xpt_done(ccb); 390 return; 391 } --- 9 unchanged lines hidden (view full) --- 401 xpt_done(ccb); 402 break; 403 } 404 case XPT_PATH_INQ: /* Path routing inquiry */ 405 { 406 struct ccb_pathinq *cpi = &ccb->cpi; 407 408#ifdef VP0_DEBUG |
416 printf("vpo%d: XPT_PATH_INQ request\n", vpo->vpo_unit); | 409 device_printf(vpo->vpo_dev, "XPT_PATH_INQ request\n"); |
417#endif 418 cpi->version_num = 1; /* XXX??? */ 419 cpi->hba_inquiry = 0; 420 cpi->target_sprt = 0; 421 cpi->hba_misc = 0; 422 cpi->hba_eng_cnt = 0; 423 cpi->max_target = 7; 424 cpi->max_lun = 0; --- 47 unchanged lines hidden --- | 410#endif 411 cpi->version_num = 1; /* XXX??? */ 412 cpi->hba_inquiry = 0; 413 cpi->target_sprt = 0; 414 cpi->hba_misc = 0; 415 cpi->hba_eng_cnt = 0; 416 cpi->max_target = 7; 417 cpi->max_lun = 0; --- 47 unchanged lines hidden --- |