FreeBSD/sys/cam/ata/ata_xpt.c
/*
 * Handle any per-device event notifications that require action by the XPT.
 */
Handle any per-device event notifications that require action by the XPT.
Handle any per - device event notifications that require action by the XPT .
static void
ata_dev_async(u_int32_t async_code, struct cam_eb *bus, struct cam_et *target,
	      struct cam_ed *device, void *async_arg)
{
	cam_status status;
	struct cam_path newpath;
	if (target->target_id == CAM_TARGET_WILDCARD
	 || device->lun_id == CAM_LUN_WILDCARD)
		return;
	if ((async_code == AC_SENT_BDR)
	 || (async_code == AC_BUS_RESET)
	 || (async_code == AC_INQ_CHANGED))
		status = xpt_compile_path(&newpath, NULL,
					  bus->path_id,
					  target->target_id,
					  device->lun_id);
	else
		status = CAM_REQ_CMP_ERR;
	if (status == CAM_REQ_CMP) {
		if (async_code == AC_INQ_CHANGED) {
			ata_scan_lun(newpath.periph, &newpath,
				     CAM_EXPECT_INQ_CHANGE, NULL);
		} else {
			ata_scan_lun(newpath.periph, &newpath,
				     0, NULL);
		}
		xpt_release_path(&newpath);
	} else if (async_code == AC_LOST_DEVICE &&
	    (device->flags & CAM_DEV_UNCONFIGURED) == 0) {
		device->flags |= CAM_DEV_UNCONFIGURED;
		xpt_release_device(device);
	} else if (async_code == AC_TRANSFER_NEG) {
		struct ccb_trans_settings *settings;
		struct cam_path path;
		settings = (struct ccb_trans_settings *)async_arg;
		xpt_compile_path(&path, NULL, bus->path_id, target->target_id,
				 device->lun_id);
		ata_set_transfer_settings(settings, &path,
					  TRUE);
		xpt_release_path(&path);
	}
}
static void ata_dev_async ( u_int32_t async_code , struct cam_eb * bus , struct cam_et * target , struct cam_ed * device , void * async_arg ) { cam_status status ; struct cam_path newpath ; if ( target -> target_id == CAM_TARGET_WILDCARD || device -> lun_id == CAM_LUN_WILDCARD ) return ; if ( ( async_code == AC_SENT_BDR ) || ( async_code == AC_BUS_RESET ) || ( async_code == AC_INQ_CHANGED ) ) status = xpt_compile_path ( & newpath , NULL , bus -> path_id , target -> target_id , device -> lun_id ) ; else status = CAM_REQ_CMP_ERR ; if ( status == CAM_REQ_CMP ) { if ( async_code == AC_INQ_CHANGED ) { ata_scan_lun ( newpath . periph , & newpath , CAM_EXPECT_INQ_CHANGE , NULL ) ; } else { ata_scan_lun ( newpath . periph , & newpath , 0 , NULL ) ; } xpt_release_path ( & newpath ) ; } else if ( async_code == AC_LOST_DEVICE && ( device -> flags & CAM_DEV_UNCONFIGURED ) == 0 ) { device -> flags |= CAM_DEV_UNCONFIGURED ; xpt_release_device ( device ) ; } else if ( async_code == AC_TRANSFER_NEG ) { struct ccb_trans_settings * settings ; struct cam_path path ; settings = ( struct ccb_trans_settings * ) async_arg ; xpt_compile_path ( & path , NULL , bus -> path_id , target -> target_id , device -> lun_id ) ; ata_set_transfer_settings ( settings , & path , TRUE ) ; xpt_release_path ( & path ) ; } }
Handle any per-device event notifications that require action by the XPT.
Handle any per - device event notifications that require action by the XPT .
/*
	 * We only need to handle events for real devices.
	 */ /*
	 * We need our own path with wildcards expanded to
	 * handle certain types of events.
	 */ /*
			 * We've sent a start unit command, or
			 * something similar to a device that
			 * may have caused its inquiry data to
			 * change. So we re-scan the device to
			 * refresh the inquiry data for it.
			 */ /* We need to reinitialize device after reset. */ /*async_update*/