Lines Matching defs:emul64
47 #include <sys/emul64.h>
99 static void emul64_i_initcap(struct emul64 *emul64);
101 static void emul64_i_log(struct emul64 *emul64, int level, char *fmt, ...);
102 static int emul64_get_tgtrange(struct emul64 *,
106 static int emul64_write_off(struct emul64 *,
109 static int emul64_write_on(struct emul64 *,
120 extern emul64_tgt_t *find_tgt(struct emul64 *, ushort_t, ushort_t);
155 * of CPUs on the system, but this can be overridden in emul64.conf.
210 "emul64 SCSI Host Bus Adapter", /* module name */
225 ret = ddi_soft_state_init(&emul64_state, sizeof (struct emul64),
285 struct emul64 *foo;
311 * Attach an instance of an emul64 host adapter. Allocate data structures,
312 * initialize the emul64 and we're on the air.
319 struct emul64 *emul64;
338 emul64 = TRAN2EMUL64(tran);
344 "emul64%d: Cmd != DDI_ATTACH/DDI_RESUME", instance);
349 * Allocate emul64 data structure.
353 "emul64%d: Failed to alloc soft state",
358 emul64 = (struct emul64 *)ddi_get_soft_state(emul64_state, instance);
359 if (emul64 == (struct emul64 *)NULL) {
360 emul64_i_log(NULL, CE_WARN, "emul64%d: Bad soft state",
372 cmn_err(CE_WARN, "emul64: scsi_hba_tran_alloc failed\n");
376 emul64->emul64_tran = tran;
377 emul64->emul64_dip = dip;
379 tran->tran_hba_private = emul64;
404 cmn_err(CE_WARN, "emul64: scsi_hba_attach failed\n");
408 emul64->emul64_initiator_id = 2;
413 emul64->emul64_scsi_options =
416 EMUL64_DEBUG(emul64, SCSI_DEBUG, "emul64 scsi-options=%x",
417 emul64->emul64_scsi_options);
420 /* mutexes to protect the emul64 request and response queue */
421 mutex_init(EMUL64_REQ_MUTEX(emul64), NULL, MUTEX_DRIVER,
422 emul64->emul64_iblock);
423 mutex_init(EMUL64_RESP_MUTEX(emul64), NULL, MUTEX_DRIVER,
424 emul64->emul64_iblock);
428 EMUL64_MUTEX_ENTER(emul64);
433 emul64_i_initcap(emul64);
435 EMUL64_MUTEX_EXIT(emul64);
439 emul64->emul64_taskq = taskq_create("emul64_comp",
445 emul64_i_log(NULL, CE_WARN, "emul64%d: Unable to attach", instance);
448 mutex_destroy(EMUL64_REQ_MUTEX(emul64));
449 mutex_destroy(EMUL64_RESP_MUTEX(emul64));
462 struct emul64 *emul64;
473 emul64 = TRAN2EMUL64(tran);
475 if (!emul64) {
479 EMUL64_DEBUG(emul64, SCSI_DEBUG, "emul64_detach: cmd = %d", cmd);
483 EMUL64_MUTEX_ENTER(emul64);
485 taskq_destroy(emul64->emul64_taskq);
488 scsi_hba_tran_free(emul64->emul64_tran);
491 EMUL64_MUTEX_EXIT(emul64);
493 mutex_destroy(EMUL64_REQ_MUTEX(emul64));
494 mutex_destroy(EMUL64_RESP_MUTEX(emul64));
497 EMUL64_DEBUG(emul64, SCSI_DEBUG, "emul64_detach: done");
521 struct emul64 *emul64;
532 emul64 = TRAN2EMUL64(tran);
533 EMUL64_MUTEX_ENTER(emul64);
540 tgt = find_tgt(emul64, sd->sd_address.a_target, sd->sd_address.a_lun);
554 cmn_err(CE_WARN, "emul64: %s property does not have 2 "
566 cmn_err(CE_WARN, "emul64: didn't get prop '%s'", geo);
570 cmn_err(CE_WARN, "emul64: property %s does not have 6 "
587 sizeof (emul64->emul64_tgt->emul64_tgt_inq));
591 * emul64.conf. They are followed by the low order 4 bytes. Not
612 tgt->emul64_tgt_next = emul64->emul64_tgt;
613 emul64->emul64_tgt = tgt;
616 out: EMUL64_MUTEX_EXIT(emul64);
635 emul64_i_initcap(struct emul64 *emul64)
643 emul64->emul64_cap[i] = cap;
644 emul64->emul64_synch[i] = synch;
646 EMUL64_DEBUG(emul64, SCSI_DEBUG, "default cap = 0x%x", cap);
662 struct emul64 *emul64 = ADDR2EMUL64(ap);
672 EMUL64_MUTEX_ENTER(emul64);
700 rval = emul64->emul64_initiator_id;
716 EMUL64_MUTEX_EXIT(emul64);
736 struct emul64 *emul64 = ADDR2EMUL64(ap);
746 EMUL64_MUTEX_ENTER(emul64);
779 emul64->nt_total_sectors[ap->a_target][ap->a_lun] = value;
791 EMUL64_MUTEX_EXIT(emul64);
813 struct emul64 *emul64 = ADDR2EMUL64(ap);
822 pkt = scsi_hba_pkt_alloc(emul64->emul64_dip, ap, cmdlen,
841 sp->cmd_emul64 = emul64;
943 struct emul64 *emul64 = ADDR2EMUL64(ap);
947 mutex_enter(EMUL64_REQ_MUTEX(emul64));
949 p = emul64->emul64_reset_notify_listf;
961 emul64->emul64_reset_notify_listf = p->next;
975 p->next = emul64->emul64_reset_notify_listf;
976 emul64->emul64_reset_notify_listf = p;
980 mutex_exit(EMUL64_REQ_MUTEX(emul64));
988 * Return Values : TRAN_FATAL_ERROR - emul64 has been shutdown
990 * TRAN_ACCEPT - pkt has been submitted to emul64
1002 struct emul64 *emul64 = ADDR2EMUL64(ap);
1006 ASSERT(mutex_owned(EMUL64_REQ_MUTEX(emul64)) == 0 || ddi_in_panic());
1007 ASSERT(mutex_owned(EMUL64_RESP_MUTEX(emul64)) == 0 || ddi_in_panic());
1009 EMUL64_DEBUG2(emul64, SCSI_DEBUG, "emul64_scsi_start %x", sp);
1043 dispatched = taskq_dispatch(emul64->emul64_taskq,
1053 (void) taskq_dispatch(emul64->emul64_taskq,
1059 ASSERT(mutex_owned(EMUL64_REQ_MUTEX(emul64)) == 0 || ddi_in_panic());
1060 ASSERT(mutex_owned(EMUL64_RESP_MUTEX(emul64)) == 0 || ddi_in_panic());
1148 emul64_error_inject_req(struct emul64 *emul64, intptr_t arg)
1160 cmn_err(CE_WARN, "emul64: ioctl - inj copyin failed\n");
1164 EMUL64_MUTEX_ENTER(emul64);
1165 tgt = find_tgt(emul64, error_inj_req.eccd_target,
1167 EMUL64_MUTEX_EXIT(emul64);
1204 "emul64: sense data copy in failed\n");
1294 cmn_err(CE_WARN, "emul64: unrecognized G4 service "
1319 cmn_err(CE_WARN, "emul64: unrecognized "
1371 emul64_get_tgtrange(struct emul64 *emul64,
1377 cmn_err(CE_WARN, "emul64: ioctl - copy in failed\n");
1380 EMUL64_MUTEX_ENTER(emul64);
1381 *tgtp = find_tgt(emul64, tgtr->emul64_target, tgtr->emul64_lun);
1382 EMUL64_MUTEX_EXIT(emul64);
1384 cmn_err(CE_WARN, "emul64: ioctl - no target for %d,%d on %d",
1386 ddi_get_instance(emul64->emul64_dip));
1400 struct emul64 *emul64;
1407 emul64 = (struct emul64 *)ddi_get_soft_state(emul64_state, instance);
1408 if (emul64 == NULL) {
1409 cmn_err(CE_WARN, "emul64: ioctl - no softstate for %d\n",
1416 rv = emul64_get_tgtrange(emul64, arg, &tgt, &tgtr);
1418 rv = emul64_write_off(emul64, tgt, &tgtr);
1422 rv = emul64_get_tgtrange(emul64, arg, &tgt, &tgtr);
1424 rv = emul64_write_on(emul64, tgt, &tgtr);
1428 rv = emul64_get_tgtrange(emul64, arg, &tgt, &tgtr);
1436 rv = emul64_error_inject_req(emul64, arg);
1447 emul64_write_off(struct emul64 *emul64,
1476 cmn_err(CE_WARN, "emul64: EMUL64_WRITE_OFF 0x%llx,0x%"
1490 emul64_write_on(struct emul64 *emul64,
1512 cmn_err(CE_WARN, "emul64: EMUL64_WRITE_ON 0x%llx,0x%lx "
1526 cmn_err(CE_WARN, "emul64: EMUL64_WRITE_ON 0x%llx,0x%lx "
1605 emul64_i_log(struct emul64 *emul64, int level, char *fmt, ...)
1614 scsi_log(emul64 ? emul64->emul64_dip : NULL,
1615 "emul64", level, "%s\n", buf);
1625 struct emul64 *emul64 = ADDR2EMUL64(ap);
1632 (void) snprintf(buf, sizeof (buf), "emul64%d: <%d,%d> ",
1633 ddi_get_instance(emul64->emul64_dip),