示例#1
0
static void scsis_request_media(SCSIS* scsis)
{
    scsis->need_media = true;
    if (scsis->state == SCSIS_STATE_IDLE)
    {
        if (scsis->io != NULL)
            storage_get_media_descriptor(scsis->storage_descriptor->hal, scsis->storage_descriptor->storage, scsis->storage_descriptor->user, scsis->io);
        else
            scsis_cb_host(scsis, SCSIS_RESPONSE_NEED_IO, 0);
    }
}
示例#2
0
static void scsis_done(SCSIS* scsis, SCSIS_RESPONSE resp)
{
    bool was_ready = false;
#if (SCSI_WRITE_CACHE)
    if (scsis->state == SCSIS_STATE_WRITE && (scsis->count == 0))
        was_ready = true;
#endif //SCSI_WRITE_CACHE
    scsis->state = SCSIS_STATE_IDLE;
    if (scsis->need_media)
        storage_get_media_descriptor(scsis->storage_descriptor->hal, scsis->storage_descriptor->storage, scsis->storage_descriptor->user, scsis->io);
    else
    {
        scsis->io = NULL;
        scsis_cb_host(scsis, SCSIS_RESPONSE_RELEASE_IO, 0);
    }
    //pass already sent on write
    if (!was_ready)
        scsis_cb_host(scsis, resp, 0);
}
示例#3
0
文件: scsi.c 项目: aarzho/mkernel
static inline bool scsi_cmd_read_capacity(SCSI* scsi)
{
	bool res = false;
	if (scsi->cmd.cmd_type == SCSI_CMD_10)
	{
		if (storage_check_media(scsi->storage))
		{
			res = true;
			scsi_fill_capacity_page(scsi);
#if (SCSI_DEBUG_FLOW)
	printf("SCSI: read capacity 0x%08X sectors, sector size: %d\n\r", storage_get_media_descriptor(scsi->storage)->num_sectors,
			 storage_get_device_descriptor(scsi->storage)->sector_size);
#endif
		}
		else
			scsi_error(scsi, SENSE_KEY_NOT_READY, ASQ_MEDIUM_NOT_PRESENT);
	}
	else
		scsi_error(scsi, SENSE_KEY_ILLEGAL_REQUEST, ASQ_CDB_DECRYPTION_ERROR);
	return res;
}