Corrected the name of the operating system.
Automatic whitespace cleanup too. No functional changes.
This commit is contained in:
@@ -1,55 +1,55 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <[email protected]>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef _DEVICE_INFO_H_
|
||||
#ifndef _DEVICE_INFO_H_
|
||||
#define _DEVICE_INFO_H_
|
||||
|
||||
#ifndef _SCSI_COMMANDS_H_
|
||||
#include "scsi_commands.h"
|
||||
#endif /*_SCSI_COMMANDS_H_*/
|
||||
#endif /*_SCSI_COMMANDS_H_*/
|
||||
|
||||
#ifndef _PROTO_MODULE_H_
|
||||
#ifndef _PROTO_MODULE_H_
|
||||
#include "proto_module.h"
|
||||
#endif /* _PROTO_MODULE_H_ */
|
||||
#endif /* _PROTO_MODULE_H_ */
|
||||
|
||||
typedef struct _usb_device_info{
|
||||
uint8 dev_num; /**/
|
||||
const usb_device device; /**/
|
||||
uint16 interface; /**/
|
||||
uint8 max_lun; /**/
|
||||
|
||||
|
||||
uint32 properties;
|
||||
|
||||
|
||||
usb_pipe pipe_in; /**/
|
||||
usb_pipe pipe_out; /**/
|
||||
usb_pipe pipe_intr; /**/
|
||||
|
||||
|
||||
sem_id lock_sem; /**/
|
||||
sem_id trans_sem; /**/
|
||||
uint32 tag; /**/
|
||||
status_t status; /**/
|
||||
|
||||
|
||||
bigtime_t trans_timeout;
|
||||
usb_module_info *usb_m;
|
||||
|
||||
|
||||
void *data; /**/
|
||||
int actual_len; /**/
|
||||
|
||||
|
||||
protocol_module_info *protocol_m;
|
||||
char *protocol_m_path;
|
||||
|
||||
|
||||
transform_module_info *transform_m;
|
||||
char *transform_m_path;
|
||||
|
||||
|
||||
bool b_trace;
|
||||
void (*trace)(bool b_force, const char *fmt, ...);
|
||||
void (*trace_bytes)(const char *prefix, const uint8 *bytes, size_t bytes_len);
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <[email protected]>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include "usb_scsi.h"
|
||||
#include "usb_scsi.h"
|
||||
|
||||
#include <strings.h>
|
||||
#include "device_info.h"
|
||||
#include "tracing.h"
|
||||
#include "device_info.h"
|
||||
#include "tracing.h"
|
||||
|
||||
#include "fake_device.h"
|
||||
|
||||
@@ -38,7 +38,7 @@ void fake_inquiry_request(usb_device_info *udi, CCB_SCSIIO *ccbio)
|
||||
if(ccbio->cam_dxfer_len >= 0x24){
|
||||
strncpy(&data[8], "USB SCSI", INQ_VENDOR_LEN);
|
||||
strncpy(&data[16], "Reserved", INQ_PRODUCT_LEN);
|
||||
strncpy(&data[32], "N/A", INQ_REVISION_LEN);
|
||||
strncpy(&data[32], "N/A", INQ_REVISION_LEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,8 +62,8 @@ void fake_test_unit_ready_request(CCB_SCSIIO *ccbio)
|
||||
\fn:fake_scsi_io
|
||||
\param ccbio: ????
|
||||
\return: ???
|
||||
|
||||
xpt_scsi_io - handle XPT_SCSI_IO sim action
|
||||
|
||||
xpt_scsi_io - handle XPT_SCSI_IO sim action
|
||||
*/
|
||||
status_t fake_scsi_io(CCB_SCSIIO *ccbio)
|
||||
{
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <[email protected]>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef _FAKE_DEVICE_H_
|
||||
#ifndef _FAKE_DEVICE_H_
|
||||
#define _FAKE_DEVICE_H_
|
||||
|
||||
void fake_inquiry_request(usb_device_info *udi, CCB_SCSIIO *ccbio);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <[email protected]>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** bulk-only protocol specific implementation */
|
||||
|
||||
@@ -17,15 +17,15 @@
|
||||
* http://www.usb.org/developers/data/devclass/usbmassover_11.pdf [1]
|
||||
* http://www.usb.org/developers/data/devclass/usbmassbulk_10.pdf [2]
|
||||
*/
|
||||
#include "usb_scsi.h"
|
||||
#include "usb_scsi.h"
|
||||
|
||||
#include "device_info.h"
|
||||
#include "device_info.h"
|
||||
|
||||
#include "proto_module.h"
|
||||
#include "proto_common.h"
|
||||
#include "proto_bulk.h"
|
||||
#include "proto_module.h"
|
||||
#include "proto_common.h"
|
||||
#include "proto_bulk.h"
|
||||
|
||||
#include "usb_defs.h"
|
||||
#include "usb_defs.h"
|
||||
|
||||
#include <string.h> /* strncpy */
|
||||
|
||||
@@ -83,7 +83,7 @@ void trace_CBW(usb_device_info *udi, const usb_mass_CBW *cbw)
|
||||
PTRACE(udi, "\nCBW:{'%s'; tag:%d; data_len:%d; flags:0x%02x; lun:%d; cdb_len:%d;}\n",
|
||||
buf, cbw->tag, cbw->data_transfer_len,
|
||||
cbw->flags, cbw->lun, cbw->cdb_len);
|
||||
udi->trace_bytes("CDB:\n", cbw->CDB, CBW_CDB_LENGTH);
|
||||
udi->trace_bytes("CDB:\n", cbw->CDB, CBW_CDB_LENGTH);
|
||||
}
|
||||
|
||||
void trace_CSW(usb_device_info *udi, const usb_mass_CSW *csw)
|
||||
@@ -97,8 +97,8 @@ void trace_CSW(usb_device_info *udi, const usb_mass_CSW *csw)
|
||||
/**
|
||||
\fn:get_max_luns
|
||||
\param udi: device for wich max LUN info is requested
|
||||
\return:always B_OK - if info was not retrieved max LUN is defaulted to 0
|
||||
|
||||
\return:always B_OK - if info was not retrieved max LUN is defaulted to 0
|
||||
|
||||
tries to retrieve the maximal Logical Unit Number supported by
|
||||
this device. If device doesn't support GET_MAX_LUN request - single LUN is
|
||||
assumed. ([2] 3.2)
|
||||
@@ -123,7 +123,7 @@ get_max_luns(usb_device_info *udi)
|
||||
"Assuming single LUN available.\n", udi->dev_num, status);
|
||||
}
|
||||
udi->max_lun = 0;
|
||||
status = B_OK;
|
||||
status = B_OK;
|
||||
} /* else - all is OK - max luns info readed */
|
||||
}
|
||||
return status;
|
||||
@@ -135,7 +135,7 @@ get_max_luns(usb_device_info *udi)
|
||||
\param len: length of data buffer
|
||||
\param b_in: is "true" if input (device->host) data transfer, "false" otherwise
|
||||
\return: status of operation.
|
||||
|
||||
|
||||
performs queue_bulk USB request for corresponding pipe and handle timeout of this
|
||||
operation.
|
||||
*/
|
||||
@@ -159,10 +159,10 @@ queue_bulk(usb_device_info *udi, void* buffer, size_t len, bool b_in)
|
||||
/**
|
||||
\fn:check_CSW
|
||||
\param udi:corresponding device info
|
||||
\param csw: CSW to be checked for validity and meaningfullness
|
||||
\param csw: CSW to be checked for validity and meaningfullness
|
||||
\param transfer_len: data transferred during operation, which is checked for status
|
||||
\return: "true" if CSW valid and meanigfull, "false" otherwise
|
||||
|
||||
|
||||
checks CSW for validity and meaningfullness as required by USB mass strorge
|
||||
BulkOnly specification ([2] 6.3)
|
||||
*/
|
||||
@@ -199,7 +199,7 @@ check_CSW(usb_device_info *udi, usb_mass_CSW* csw, int transfer_len)
|
||||
break;/* failed */
|
||||
}
|
||||
is_valid = true;
|
||||
}while(false);
|
||||
}while(false);
|
||||
return is_valid;
|
||||
}
|
||||
/**
|
||||
@@ -208,7 +208,7 @@ check_CSW(usb_device_info *udi, usb_mass_CSW* csw, int transfer_len)
|
||||
\param csw: buffer for CSW data
|
||||
\param transfer_len: data transferred during operation, which is checked for status
|
||||
\return: success status code
|
||||
|
||||
|
||||
reads CSW from device as proposed in ([2] 5.3.3; Figure 2.).
|
||||
*/
|
||||
static status_t
|
||||
@@ -216,8 +216,8 @@ read_status(usb_device_info *udi, usb_mass_CSW* csw, int transfer_len)
|
||||
{
|
||||
status_t status = B_ERROR;
|
||||
int try = 0;
|
||||
do{
|
||||
status = queue_bulk(udi, csw, CSW_LENGTH, true);
|
||||
do{
|
||||
status = queue_bulk(udi, csw, CSW_LENGTH, true);
|
||||
if(0 == try){
|
||||
if(B_OK != status || B_OK != udi->status){
|
||||
status = (*udi->usb_m->clear_feature)(udi->pipe_in, USB_FEATURE_ENDPOINT_HALT);
|
||||
@@ -243,7 +243,7 @@ read_status(usb_device_info *udi, usb_mass_CSW* csw, int transfer_len)
|
||||
(*udi->protocol_m->reset)(udi);
|
||||
status = B_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
trace_CSW(udi, csw);
|
||||
break; /* CSW was read successfully */
|
||||
}while(try++ < 2);
|
||||
@@ -256,7 +256,7 @@ read_status(usb_device_info *udi, usb_mass_CSW* csw, int transfer_len)
|
||||
\fn:bulk_only_initialize
|
||||
\param udi: device on wich we should perform initialization
|
||||
\return:error code if initialization failed or B_OK if it passed
|
||||
|
||||
|
||||
initialize procedure for bulk only protocol devices.
|
||||
*/
|
||||
status_t
|
||||
@@ -270,7 +270,7 @@ bulk_only_initialize(usb_device_info *udi)
|
||||
\fn:bulk_only_reset
|
||||
\param udi: device on wich we should perform reset
|
||||
\return:error code if reset failed or B_OK if it passed
|
||||
|
||||
|
||||
reset procedure for bulk only protocol devices. Tries to send
|
||||
BulkOnlyReset USB request and clear USB_FEATURE_ENDPOINT_HALT features on
|
||||
input and output pipes. ([2] 3.1)
|
||||
@@ -295,13 +295,13 @@ bulk_only_reset(usb_device_info *udi)
|
||||
USB_FEATURE_ENDPOINT_HALT)))
|
||||
{
|
||||
PTRACE_ALWAYS(udi, "bulk_only_reset: clear_feature on pipe_out failed: %08x\n", status);
|
||||
}
|
||||
}
|
||||
PTRACE(udi, "bulk_only_reset:%08x\n", status);
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
\fn:bulk_only_transfer
|
||||
\param udi: corresponding device
|
||||
\param udi: corresponding device
|
||||
\param cmd: SCSI command to be performed on USB device
|
||||
\param cmdlen: length of SCSI command
|
||||
\param data_sg: io vectors array with data to transfer
|
||||
@@ -311,7 +311,7 @@ bulk_only_reset(usb_device_info *udi)
|
||||
\param ccbio: CCB_SCSIIO struct for original SCSI command
|
||||
\param cb: callback to handle of final stage of command performing (autosense \
|
||||
request etc.)
|
||||
|
||||
|
||||
transfer procedure for bulk-only protocol. Performs SCSI command on USB device
|
||||
[2]
|
||||
*/
|
||||
@@ -352,7 +352,7 @@ bulk_only_transfer(usb_device_info *udi, uint8 *cmd, uint8 cmdlen, //sg_buffer
|
||||
command_status = B_CMD_WIRE_FAILED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* get status of command */
|
||||
status = read_status(udi, &csw, transfer_len);
|
||||
if(B_OK != status){
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <[email protected]>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** bulk-only protocol "standard" procedures */
|
||||
|
||||
|
||||
#ifndef _PROTO_BULK_H_
|
||||
#ifndef _PROTO_BULK_H_
|
||||
#define _PROTO_BULK_H_
|
||||
|
||||
#ifndef _PROTO_MODULE_H_
|
||||
#ifndef _PROTO_MODULE_H_
|
||||
#include "proto_module.h"
|
||||
#endif /* _PROTO_MODULE_H_ */
|
||||
#endif /* _PROTO_MODULE_H_ */
|
||||
|
||||
extern protocol_module_info bulk_only_protocol_m;
|
||||
|
||||
#endif /*_PROTO_BULK_H_*/
|
||||
#endif /*_PROTO_BULK_H_*/
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <[email protected]>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/* References:
|
||||
* USB Mass Storage Class specifications:
|
||||
@@ -19,17 +19,17 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "usb_scsi.h"
|
||||
#include "usb_scsi.h"
|
||||
|
||||
#include "device_info.h"
|
||||
#include "device_info.h"
|
||||
|
||||
#include "proto_module.h"
|
||||
#include "proto_module.h"
|
||||
#include "proto_common.h"
|
||||
#include "proto_cbi.h"
|
||||
#include "proto_cbi.h"
|
||||
|
||||
#include "usb_defs.h"
|
||||
#include "usb_defs.h"
|
||||
|
||||
#define USB_REQ_CBI_ADSC 0x00
|
||||
#define USB_REQ_CBI_ADSC 0x00
|
||||
|
||||
|
||||
typedef struct _usb_mass_CBI_CB{
|
||||
@@ -38,8 +38,8 @@ typedef struct _usb_mass_CBI_CB{
|
||||
uint8 padding[14];
|
||||
} usb_mass_CBI_CB;
|
||||
|
||||
#define CDB_LEN 16
|
||||
#define CDB_RESET_LEN 12
|
||||
#define CDB_LEN 16
|
||||
#define CDB_RESET_LEN 12
|
||||
|
||||
//typedef uint8 usb_mass_CDB[CDB_LEN];
|
||||
|
||||
@@ -81,7 +81,7 @@ static void cbi_transfer(usb_device_info *udi, uint8 *cmd, uint8 cmdlen, //sg_bu
|
||||
void trace_CDB(usb_device_info *udi, const usb_mass_CBI_CB *cb, int len)
|
||||
{
|
||||
PTRACE(udi, "CB:{op:0x%02x; op2:0x%02x;}\n", cb->op, cb->op2);
|
||||
udi->trace_bytes(" padding:", cb->padding, len - 2);
|
||||
udi->trace_bytes(" padding:", cb->padding, len - 2);
|
||||
}
|
||||
|
||||
static status_t
|
||||
@@ -143,7 +143,7 @@ parse_status(usb_device_info *udi, usb_mass_CBI_IDB *idb)
|
||||
break;
|
||||
}
|
||||
} /* else ?? */
|
||||
}
|
||||
}
|
||||
return command_status;
|
||||
}
|
||||
|
||||
@@ -153,14 +153,14 @@ parse_status(usb_device_info *udi, usb_mass_CBI_IDB *idb)
|
||||
\fn:
|
||||
\param udi: ???
|
||||
\return:??
|
||||
|
||||
|
||||
??
|
||||
*/
|
||||
status_t
|
||||
cbi_reset(usb_device_info *udi)
|
||||
{
|
||||
status_t status = B_ERROR;
|
||||
//usb_mass_CBI_CB *cb = CB_BUFFER(udi->proto_buf);
|
||||
//usb_mass_CBI_CB *cb = CB_BUFFER(udi->proto_buf);
|
||||
//usb_mass_CDB cdb = {0x1d, 0x04, 0x00};
|
||||
//memset(cdb + 2, 0xff, CDB_RESET_LEN - 2);
|
||||
usb_mass_CBI_CB cb = {
|
||||
@@ -171,7 +171,7 @@ cbi_reset(usb_device_info *udi)
|
||||
status = send_request_adsc(udi, &cb, CDB_RESET_LEN);
|
||||
if(status != B_OK)
|
||||
PTRACE_ALWAYS(udi, "command_block_reset: reset request failed: %08x\n", status);
|
||||
|
||||
|
||||
if(B_OK != (status = (*udi->usb_m->clear_feature)(udi->pipe_in,
|
||||
USB_FEATURE_ENDPOINT_HALT)))
|
||||
PTRACE_ALWAYS(udi, "command_block_reset: clear_feature on pipe_in failed: %08x\n", status);
|
||||
@@ -201,7 +201,7 @@ cbi_initialize(usb_device_info *udi)
|
||||
\param cmd: ???
|
||||
\param cmdlen: ???
|
||||
\return:???
|
||||
|
||||
|
||||
???
|
||||
*/
|
||||
void
|
||||
@@ -225,7 +225,7 @@ cbi_transfer(usb_device_info *udi, uint8 *cmd, uint8 cmdlen,
|
||||
(*udi->protocol_m->reset)(udi);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(transfer_len != 0){
|
||||
status = process_data_io(udi, sg_data, sg_count, dir);
|
||||
if(status != B_OK){
|
||||
@@ -233,8 +233,8 @@ cbi_transfer(usb_device_info *udi, uint8 *cmd, uint8 cmdlen,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(PROTO(udi->properties) == PROTO_CBI){
|
||||
|
||||
if(PROTO(udi->properties) == PROTO_CBI){
|
||||
status = request_interrupt(udi, &idb);
|
||||
PTRACE(udi, "cbi_transfer:request interrupt: %08x(%08x)\n", status, udi->status);
|
||||
if(status != B_OK){
|
||||
@@ -246,9 +246,9 @@ cbi_transfer(usb_device_info *udi, uint8 *cmd, uint8 cmdlen,
|
||||
command_status = parse_status(udi, &idb);
|
||||
} else { /* PROP_CB ???*/
|
||||
command_status = B_CMD_UNKNOWN;
|
||||
}
|
||||
}
|
||||
residue = 0; /* DEBUG!!!!!!!!!*/
|
||||
}while(false);
|
||||
}while(false);
|
||||
cb(udi, ccbio, residue, command_status);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <[email protected]>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef _PROTO_CBI_H_
|
||||
#ifndef _PROTO_CBI_H_
|
||||
#define _PROTO_CBI_H_
|
||||
|
||||
#ifndef _PROTO_MODULE_H_
|
||||
#ifndef _PROTO_MODULE_H_
|
||||
#include "proto_module.h"
|
||||
#endif /* _PROTO_MODULE_H_ */
|
||||
|
||||
#endif /* _PROTO_MODULE_H_ */
|
||||
|
||||
extern protocol_module_info cbi_protocol_m;
|
||||
|
||||
#endif /*_PROTO_CBI_H_*/
|
||||
#endif /*_PROTO_CBI_H_*/
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <[email protected]>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#include "usb_scsi.h"
|
||||
|
||||
#include "device_info.h"
|
||||
#include "proto_common.h"
|
||||
#include "tracing.h"
|
||||
#include "usb_defs.h"
|
||||
#include "scsi_commands.h"
|
||||
|
||||
#include "device_info.h"
|
||||
#include "proto_common.h"
|
||||
#include "tracing.h"
|
||||
#include "usb_defs.h"
|
||||
#include "scsi_commands.h"
|
||||
|
||||
/**
|
||||
\fn:bulk_callback
|
||||
@@ -27,7 +27,7 @@
|
||||
\param data:???
|
||||
\param actual_len:???
|
||||
\return:???
|
||||
|
||||
|
||||
???
|
||||
*/
|
||||
void bulk_callback(void *cookie, status_t status, void* data, uint32 actual_len)
|
||||
@@ -40,14 +40,14 @@ void bulk_callback(void *cookie, status_t status, void* data, uint32 actual_len)
|
||||
udi->actual_len = actual_len;
|
||||
if(udi->status != B_CANCELED)
|
||||
release_sem(udi->trans_sem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\fn:exec_io
|
||||
\param udi: ???
|
||||
\return:???
|
||||
|
||||
|
||||
???
|
||||
*/
|
||||
status_t process_data_io(usb_device_info *udi, //sg_buffer *sgb,
|
||||
@@ -64,15 +64,15 @@ status_t process_data_io(usb_device_info *udi, //sg_buffer *sgb,
|
||||
if(udi->status == B_DEV_STALLED){
|
||||
status_t st=(*udi->usb_m->clear_feature)(pipe, USB_FEATURE_ENDPOINT_HALT);
|
||||
TRACE_ALWAYS("clear_on_STALL:%08x\n",st);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
TRACE_ALWAYS("process_data_io:acquire_sem failed:%08x\n", status);
|
||||
TRACE_ALWAYS("process_data_io:acquire_sem failed:%08x\n", status);
|
||||
(*udi->usb_m->cancel_queued_transfers)(pipe);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TRACE_ALWAYS("process_data_io:queue_bulk_v failed:%08x\n", status);
|
||||
}
|
||||
TRACE_DATA_IO("process_data_io:processed:%d;status:%08x\n", udi->actual_len, status);
|
||||
TRACE_DATA_IO("process_data_io:processed:%d;status:%08x\n", udi->actual_len, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void sense_callback(struct _usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
{
|
||||
ccbio->cam_sense_resid = residue;
|
||||
switch(status){
|
||||
case B_CMD_UNKNOWN:
|
||||
case B_CMD_UNKNOWN:
|
||||
case B_CMD_FAILED:
|
||||
case B_OK:{
|
||||
bool b_own_data = (ccbio->cam_sense_ptr == NULL);
|
||||
@@ -147,7 +147,7 @@ void sense_callback(struct _usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
// ccbio->cam_ch.cam_status = CAM_REQ_CMP_ERR /*| CAM_AUTOSNS_VALID*/;
|
||||
// ccbio->cam_scsi_status = SCSI_STATUS_CHECK_CONDITION;
|
||||
TRACE("sense_callback: sense still not handled...\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef _PROTO_COMMON_H_
|
||||
#ifndef _PROTO_COMMON_H_
|
||||
#define _PROTO_COMMON_H_
|
||||
|
||||
#ifndef _DEVICE_INFO_H_
|
||||
@@ -18,9 +18,9 @@
|
||||
#endif /* _DEVICE_INFO_H_ */
|
||||
|
||||
void bulk_callback(void *cookie, status_t status, void* data, uint32 actual_len);
|
||||
|
||||
|
||||
status_t process_data_io(usb_device_info *udi, iovec *sg_data, int32 sg_count/*sg_buffer *sgb*/, EDirection dir);
|
||||
|
||||
|
||||
void transfer_callback(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
int32 residue, status_t status);
|
||||
void sense_callback(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef _PROTO_MODULE_H_
|
||||
#ifndef _PROTO_MODULE_H_
|
||||
#define _PROTO_MODULE_H_
|
||||
|
||||
#ifndef _MODULE_H
|
||||
@@ -22,7 +22,7 @@
|
||||
#endif / *_SG_BUFFER_H_*/
|
||||
|
||||
enum {
|
||||
/* B_OK */ /* JFYI:command is OK */
|
||||
/* B_OK */ /* JFYI:command is OK */
|
||||
B_CMD_FAILED = B_ERRORS_END + 1, /* command failed */
|
||||
B_CMD_WIRE_FAILED, /* device problems */
|
||||
B_CMD_UNKNOWN, /* command state unknown */
|
||||
@@ -43,9 +43,9 @@ typedef void (*ud_transfer_callback)(struct _usb_device_info *udi,
|
||||
|
||||
typedef struct {
|
||||
module_info module;
|
||||
|
||||
status_t (*init)(struct _usb_device_info *udi);
|
||||
status_t (*reset)(struct _usb_device_info *udi);
|
||||
|
||||
status_t (*init)(struct _usb_device_info *udi);
|
||||
status_t (*reset)(struct _usb_device_info *udi);
|
||||
void (*transfer)(struct _usb_device_info *udi,
|
||||
uint8 *cmd, uint8 cmdlen,
|
||||
//sg_buffer *sgb,
|
||||
@@ -54,7 +54,7 @@ typedef struct {
|
||||
int32 transfer_len,
|
||||
EDirection dir,
|
||||
CCB_SCSIIO *ccbio,
|
||||
ud_transfer_callback cb);
|
||||
ud_transfer_callback cb);
|
||||
} protocol_module_info;
|
||||
|
||||
|
||||
@@ -63,10 +63,10 @@ typedef struct {
|
||||
|
||||
status_t (*transform)(struct _usb_device_info *udi,
|
||||
uint8 *cmd, uint8 len,
|
||||
uint8 **rcmd, uint8 *rlen);
|
||||
uint8 **rcmd, uint8 *rlen);
|
||||
} transform_module_info;
|
||||
|
||||
#define MODULE_PREFIX "generic/usb_scsi_extensions/"
|
||||
#define MODULE_PREFIX "generic/usb_scsi_extensions/"
|
||||
#define PROTOCOL_SUFFIX "/protocol/v1"
|
||||
#define TRANSFORM_SUFFIX "/transform/v1"
|
||||
#define PROTOCOL_MODULE_MASK MODULE_PREFIX"%s"PROTOCOL_SUFFIX
|
||||
@@ -74,13 +74,13 @@ typedef struct {
|
||||
|
||||
/**
|
||||
\define:_TRACE_ALWAYS
|
||||
trace always - used mainly for error messages
|
||||
trace always - used mainly for error messages
|
||||
*/
|
||||
#define PTRACE_ALWAYS(__udi, __x...) \
|
||||
{ /*if(__udi->b_trace)*/ __udi->trace(true, __x); }
|
||||
/**
|
||||
\define:TRACE
|
||||
trace only if logging is activated
|
||||
trace only if logging is activated
|
||||
*/
|
||||
#define PTRACE(__udi, __x...) \
|
||||
{ if(__udi->b_trace) __udi->trace(false, __x); }
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** driver settings support implementation */
|
||||
|
||||
#include "usb_scsi.h"
|
||||
#include "settings.h"
|
||||
//#include "proto_common.h"
|
||||
//#include "proto_common.h"
|
||||
|
||||
#include <stdlib.h> /* strtoul */
|
||||
#include <strings.h> /* strncpy */
|
||||
@@ -37,46 +37,46 @@ bool b_ignore_sysinit2 = false;
|
||||
settings_keys array.
|
||||
*/
|
||||
enum SKKeys{
|
||||
skkVendor = 0,
|
||||
skkDevice,
|
||||
// skkName,
|
||||
// skkTransport,
|
||||
skkProtocol,
|
||||
skkCommandSet,
|
||||
skkFakeInq,
|
||||
skk6ByteCmd,
|
||||
skkVendor = 0,
|
||||
skkDevice,
|
||||
// skkName,
|
||||
// skkTransport,
|
||||
skkProtocol,
|
||||
skkCommandSet,
|
||||
skkFakeInq,
|
||||
skk6ByteCmd,
|
||||
skkTransTU,
|
||||
skkNoTU,
|
||||
skkNoGetMaxLUN,
|
||||
skkNoPreventMedia,
|
||||
skkUseModeSense10,
|
||||
skkForceReadOnly,
|
||||
skkProtoBulk,
|
||||
skkProtoCB,
|
||||
skkNoGetMaxLUN,
|
||||
skkNoPreventMedia,
|
||||
skkUseModeSense10,
|
||||
skkForceReadOnly,
|
||||
skkProtoBulk,
|
||||
skkProtoCB,
|
||||
skkProtoCBI,
|
||||
// skkProtoFreecom,
|
||||
skkCmdSetSCSI,
|
||||
skkCmdSetUFI,
|
||||
skkCmdSetATAPI,
|
||||
skkCmdSetRBC,
|
||||
skkCmdSetQIC157,
|
||||
|
||||
skkCmdSetSCSI,
|
||||
skkCmdSetUFI,
|
||||
skkCmdSetATAPI,
|
||||
skkCmdSetRBC,
|
||||
skkCmdSetQIC157,
|
||||
|
||||
skkKeysCount,
|
||||
// skkTransportBase = skkSubClassSCSI,
|
||||
skkProtoBegin = skkProtoBulk,
|
||||
skkProtoEnd = skkProtoCBI,
|
||||
skkCmdSetBegin = skkCmdSetSCSI,
|
||||
skkCmdSetEnd = skkCmdSetQIC157,
|
||||
// skkTransportBase = skkSubClassSCSI,
|
||||
skkProtoBegin = skkProtoBulk,
|
||||
skkProtoEnd = skkProtoCBI,
|
||||
skkCmdSetBegin = skkCmdSetSCSI,
|
||||
skkCmdSetEnd = skkCmdSetQIC157,
|
||||
};
|
||||
/**
|
||||
helper struct, used in our "quick" search algorithm
|
||||
helper struct, used in our "quick" search algorithm
|
||||
*/
|
||||
struct _settings_key{
|
||||
union _hash{
|
||||
char name[32];
|
||||
uint16 key;
|
||||
}hash;
|
||||
uint32 property;
|
||||
uint32 property;
|
||||
}settings_keys[] = { /**< array of keys, used in our settings files */
|
||||
{{"vendor" }, 0}, /* MUST BE SYNCHRONISED WITH skk*** indexes!!! */
|
||||
{{"device" }, 0},
|
||||
@@ -105,7 +105,7 @@ struct _settings_key{
|
||||
/**
|
||||
\define:SK_EQUAL
|
||||
checks is the __name parameter correspond to value, pointed by __id index
|
||||
in settings_keys array. The magic of our "quick" search algorithm =-))
|
||||
in settings_keys array. The magic of our "quick" search algorithm =-))
|
||||
*/
|
||||
#define CAST_SK(__name) (*(uint16 *)(__name))
|
||||
#define SK_EQUAL(__name, __id) ((CAST_SK(__name) == (settings_keys[__id].hash.key)) && \
|
||||
@@ -114,7 +114,7 @@ struct _settings_key{
|
||||
\fn:load_module_settings
|
||||
loads driver settings from extarnal settings file through BeOS driver
|
||||
settings API. Called on initialization of the module
|
||||
*/
|
||||
*/
|
||||
void load_module_settings(void)
|
||||
{
|
||||
void *sh = load_driver_settings(MODULE_NAME);
|
||||
@@ -128,25 +128,25 @@ void load_module_settings(void)
|
||||
b_ignore_sysinit2 = get_driver_boolean_parameter(sh, "ignore_sysinit2",
|
||||
b_ignore_sysinit2, false);
|
||||
if(reserved_devices > MAX_DEVICES_COUNT)
|
||||
reserved_devices = MAX_DEVICES_COUNT;
|
||||
reserved_devices = MAX_DEVICES_COUNT;
|
||||
if(reserved_luns > MAX_LUNS_COUNT)
|
||||
reserved_luns = MAX_LUNS_COUNT;
|
||||
b_reservation_on = (reserved_devices != 0);
|
||||
|
||||
|
||||
unload_driver_settings(sh);
|
||||
} else {
|
||||
TRACE("settings:load:file '%s' was not found. Using default setting...\n",
|
||||
MODULE_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
\fn:strncpy_value
|
||||
\param to: buffer for copied string
|
||||
\param dp: driver_parameter, from wich copied string come
|
||||
\param size: maximal size of copied string
|
||||
\param size: maximal size of copied string
|
||||
copies a string, containing value[0] of this parameter, from driver_parameter,
|
||||
pointed by dp, to buffer pointed by to. Semantic of this function is similar
|
||||
to standard strncpy() one.
|
||||
to standard strncpy() one.
|
||||
*/
|
||||
/*static void
|
||||
strncpy_value(char *to, driver_parameter *dp, size_t size)
|
||||
@@ -162,7 +162,7 @@ strncpy_value(char *to, driver_parameter *dp, size_t size)
|
||||
\return: a bitmasked value from PROP_-defined flags for USB subclass and \
|
||||
protocol
|
||||
parse the transport driver_parameter for known USB subclasses, protocols and
|
||||
compose a bitmasked value from those settings
|
||||
compose a bitmasked value from those settings
|
||||
*/
|
||||
static uint32
|
||||
parse_transport(driver_parameter *dp, int skkBase, int skkEnd,
|
||||
@@ -185,14 +185,14 @@ parse_transport(driver_parameter *dp, int skkBase, int skkEnd,
|
||||
if(dp->value_count > 1){
|
||||
TRACE("settings:parse_transport:accept '%s', ignore extra...\n", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
\fn:lookup_device_info
|
||||
\param product_id: product id of device to be checked for private settings
|
||||
\param dp: driver_parameter, containing device information
|
||||
\param udd: on return contains name,protocol etc. information about device
|
||||
\param udd: on return contains name,protocol etc. information about device
|
||||
\return: "true" if private settings for device found - "false" otherwise
|
||||
looks through device parameter, pointed by dp, obtains the name and other
|
||||
parameters of private device settings if available
|
||||
@@ -218,12 +218,12 @@ lookup_device_info(uint16 product_id, driver_parameter *dp,
|
||||
} else*/
|
||||
if(SK_EQUAL(dp->parameters[prm].name, skkProtocol)){
|
||||
uds->properties |= parse_transport(&dp->parameters[prm],
|
||||
skkProtoBegin, skkProtoEnd,
|
||||
skkProtoBegin, skkProtoEnd,
|
||||
PROTO_VENDOR, uds->vendor_protocol);
|
||||
} else
|
||||
if(SK_EQUAL(dp->parameters[prm].name, skkCommandSet)){
|
||||
uds->properties |= parse_transport(&dp->parameters[prm],
|
||||
skkCmdSetBegin, skkCmdSetEnd,
|
||||
skkCmdSetBegin, skkCmdSetEnd,
|
||||
CMDSET_VENDOR, uds->vendor_commandset);
|
||||
} else
|
||||
if(SK_EQUAL(dp->parameters[prm].name, skkFakeInq)){
|
||||
@@ -234,10 +234,10 @@ lookup_device_info(uint16 product_id, driver_parameter *dp,
|
||||
} else
|
||||
if(SK_EQUAL(dp->parameters[prm].name, skkTransTU)){
|
||||
uds->properties |= FIX_TRANS_TEST_UNIT;
|
||||
} else
|
||||
} else
|
||||
if(SK_EQUAL(dp->parameters[prm].name, skkNoTU)){
|
||||
uds->properties |= FIX_NO_TEST_UNIT;
|
||||
} else
|
||||
} else
|
||||
if(SK_EQUAL(dp->parameters[prm].name, skkNoPreventMedia)){
|
||||
uds->properties |= FIX_NO_PREVENT_MEDIA;
|
||||
} else
|
||||
@@ -276,7 +276,7 @@ lookup_vendor_info(uint16 vendor_id, uint16 product_id,
|
||||
driver_parameter *dp, usb_device_settings *uds)
|
||||
{
|
||||
bool b_found = false;
|
||||
if(dp && dp->value_count > 0 && dp->values[0]){
|
||||
if(dp && dp->value_count > 0 && dp->values[0]){
|
||||
uint16 id = strtoul(dp->values[0], NULL, 0) & 0xffff;
|
||||
if(vendor_id == id){
|
||||
int i = 0;
|
||||
@@ -302,7 +302,7 @@ lookup_vendor_info(uint16 vendor_id, uint16 product_id,
|
||||
\param udd: on return contains name,protocol etc. information about device
|
||||
\return: "true" if private settings for device found - "false" otherwise
|
||||
looks through driver settings file for private device description and load it
|
||||
if available into struct pointed by udd
|
||||
if available into struct pointed by udd
|
||||
*/
|
||||
bool lookup_device_settings(const usb_device_descriptor *udd,
|
||||
usb_device_settings *uds)
|
||||
@@ -322,10 +322,10 @@ bool lookup_device_settings(const usb_device_descriptor *udd,
|
||||
if(b_found){
|
||||
uds->vendor_id = udd->vendor_id;
|
||||
break; //we've got it - stop enumeration.
|
||||
}
|
||||
}
|
||||
}
|
||||
} /*for(...) - enumerate "root" parameters*/
|
||||
} /* if(ds) */
|
||||
} /* if(ds) */
|
||||
unload_driver_settings(sh);
|
||||
} /* if(sh) */
|
||||
if(b_found){
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** driver settings support definitions */
|
||||
|
||||
#ifndef _USB_SCSI_SETTINGS_H_
|
||||
#ifndef _USB_SCSI_SETTINGS_H_
|
||||
#define _USB_SCSI_SETTINGS_H_
|
||||
|
||||
void load_module_settings(void);
|
||||
@@ -31,8 +31,8 @@ bool lookup_device_settings(const usb_device_descriptor *udd,
|
||||
|
||||
extern int reserved_devices;
|
||||
extern int reserved_luns;
|
||||
extern bool b_reservation_on;
|
||||
extern bool b_reservation_on;
|
||||
extern bool b_ignore_sysinit2;
|
||||
|
||||
#endif /*_USB_SCSI_SETTINGS_H_*/
|
||||
#endif /*_USB_SCSI_SETTINGS_H_*/
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** handling SCSI data-buffer (both usual "plain" and scatter/gather ones) */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "usb_scsi.h"
|
||||
#include "usb_scsi.h"
|
||||
|
||||
#include <malloc.h>
|
||||
#include "tracing.h"
|
||||
#include "tracing.h"
|
||||
#include "sg_buffer.h"
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ realloc_sg_buffer(sg_buffer *sgb, size_t size)
|
||||
status_t
|
||||
sg_access_byte(sg_buffer *sgb, off_t offset, uchar *byte, bool b_set)
|
||||
{
|
||||
status_t status = B_ERROR;
|
||||
status_t status = B_ERROR;
|
||||
int i = 0;
|
||||
for(; i < sgb->count; i++){
|
||||
if(offset >= sgb->piov[i].iov_len){
|
||||
@@ -101,7 +101,7 @@ sg_memcpy(sg_buffer *d_sgb, off_t d_offset,
|
||||
sg_buffer *s_sgb, off_t s_offset, size_t size)
|
||||
{
|
||||
status_t status = B_NO_INIT;
|
||||
while(0 != d_sgb && 0 != s_sgb){
|
||||
while(0 != d_sgb && 0 != s_sgb){
|
||||
uchar *d_ptr = 0;
|
||||
uchar *s_ptr = 0;
|
||||
status = B_ERROR;
|
||||
@@ -166,7 +166,7 @@ sg_buffer_len(sg_buffer *sgb, size_t *size)
|
||||
{
|
||||
status_t status = B_NO_INIT;
|
||||
if(0!=sgb && 0!=size){
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
*size = 0;
|
||||
for(; i < sgb->count; i++){
|
||||
*size += sgb->piov[i].iov_len;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** handling SCSI data-buffer (both usual "plain" and scatter/gather ones) */
|
||||
|
||||
#ifndef _SG_BUFFER_H_
|
||||
|
||||
#ifndef _SG_BUFFER_H_
|
||||
#define _SG_BUFFER_H_
|
||||
|
||||
#ifndef _IOVEC_H
|
||||
@@ -40,5 +40,5 @@ status_t sg_memcpy(sg_buffer *dest_sgb, off_t dest_offset,
|
||||
sg_buffer *src_sgb, off_t src_offset, size_t size);
|
||||
void free_sg_buffer(sg_buffer *sgb);
|
||||
|
||||
#endif /*_SG_BUFFER_H_*/
|
||||
#endif /*_SG_BUFFER_H_*/
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** tracing support implementation */
|
||||
|
||||
@@ -18,15 +18,15 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h> /* posix file i/o - create, write, close */
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <driver_settings.h>
|
||||
#include <string.h>
|
||||
#include <driver_settings.h>
|
||||
|
||||
/** private log path name */
|
||||
static const char *private_log_path = "/var/log/"MODULE_NAME".log";
|
||||
|
||||
static const char *log_port_name = MODULE_NAME"-logging";
|
||||
|
||||
#ifdef BUILD_LOG_DAEMON
|
||||
#ifdef BUILD_LOG_DAEMON
|
||||
|
||||
int main(int argc, char**argv)
|
||||
{
|
||||
@@ -45,10 +45,10 @@ int main(int argc, char**argv)
|
||||
FILE *f = fopen(private_log_path, "a");
|
||||
fwrite(buffer, sz, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ int main(int argc, char**argv)
|
||||
|
||||
/** is activity logging on or off? */
|
||||
#if DEBUG
|
||||
bool b_log = true;
|
||||
bool b_log = true;
|
||||
#else
|
||||
bool b_log = false;
|
||||
#endif
|
||||
@@ -79,7 +79,7 @@ static bool b_log_time = false;
|
||||
/** log thread id from wich logging performed */
|
||||
static bool b_log_thid = false;
|
||||
/** log thread name from wich logging performed */
|
||||
static bool b_log_thname = false;
|
||||
static bool b_log_thname = false;
|
||||
/** semaphore id used to synchronizing logging requests */
|
||||
//static sem_id loglock;
|
||||
/** log result of READ_CAPACITY command */
|
||||
@@ -118,11 +118,11 @@ load_log_settings(void *sh)
|
||||
b_log_data_processing =
|
||||
get_driver_boolean_parameter(sh, "debug_trace_data_io",
|
||||
b_log_data_processing, false);
|
||||
b_log_sense_data =
|
||||
b_log_sense_data =
|
||||
get_driver_boolean_parameter(sh, "debug_trace_sense_data",
|
||||
b_log_sense_data, false);
|
||||
b_log_capacity = get_driver_boolean_parameter(sh, "debug_trace_capacity",
|
||||
b_log_capacity, false);
|
||||
b_log_capacity, false);
|
||||
if(!b_log_file){ /* some information is already in system log entries */
|
||||
b_log_thid = false;
|
||||
b_log_thname = false;
|
||||
@@ -144,7 +144,7 @@ create_log(void)
|
||||
|
||||
/**
|
||||
\fn: usb_scsi_trace
|
||||
\param b_force: if true - output message ignoring current logging state
|
||||
\param b_force: if true - output message ignoring current logging state
|
||||
\param fmt: format string used in message formatting
|
||||
\param ...: variable argument used in message formatting
|
||||
formats and traces messages to current debug output target.
|
||||
@@ -267,13 +267,13 @@ usb_scsi_trace_CCB_SCSIIO(const CCB_SCSIIO *ccbio)
|
||||
ccbio->cam_vu_flags,
|
||||
ccbio->cam_tag_action);
|
||||
|
||||
usb_scsi_trace_bytes("CDB_UN:\n", ccbio->cam_cdb_io.cam_cdb_bytes, IOCDBLEN);
|
||||
usb_scsi_trace_bytes("CDB_UN:\n", ccbio->cam_cdb_io.cam_cdb_bytes, IOCDBLEN);
|
||||
}
|
||||
/**
|
||||
\fn: usb_scsi_command_trace
|
||||
\param b_hlight: highlight command and prefix it with spec. charachter
|
||||
\param cmd: array of bytes to be traced. typically pointer SCSI command buffer
|
||||
\param cmdlen: size of buffer in cmd parameter
|
||||
\param cmdlen: size of buffer in cmd parameter
|
||||
traces SCSI commands into debug output target.can highlight and prefix the
|
||||
text with special charachter and color for two different types
|
||||
of commands.
|
||||
@@ -294,7 +294,7 @@ usb_scsi_trace_command(bool b_hlight, const uint8 *cmd, size_t cmdlen)
|
||||
/**
|
||||
\fn:usb_scsi_bytes_trace
|
||||
\param bytes:array of bytes to be traced.
|
||||
\param bytes_len: size of buffer in bytes parameter
|
||||
\param bytes_len: size of buffer in bytes parameter
|
||||
traces buffer bytes one by one into debug output target.
|
||||
*/
|
||||
void
|
||||
@@ -319,7 +319,7 @@ usb_scsi_trace_bytes(const char *prefix, const uint8 *bytes, size_t bytes_len)
|
||||
} else {
|
||||
TRACE_ALWAYS("usb_scsi_trace_bytes:error allocate "
|
||||
"memory for tracing %d bytes\n", len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void usb_scsi_trace_sgb(const char *prefix, sg_buffer *sgb)
|
||||
@@ -360,8 +360,8 @@ void usb_scsi_trace_SG(iovec *sg, int count)
|
||||
char sg_mask[] = "SG:{%s}\n";
|
||||
char truncTail[] = "<TRUNC>";
|
||||
size_t trunc_count = min(count, 0x20); /* length watchdog */
|
||||
size_t len = sizeof(sg_mask) + sizeof(truncTail) + trunc_count * 16;
|
||||
char *pbuf = (char *)malloc(len + 1);
|
||||
size_t len = sizeof(sg_mask) + sizeof(truncTail) + trunc_count * 16;
|
||||
char *pbuf = (char *)malloc(len + 1);
|
||||
if(pbuf){
|
||||
int i = 0;
|
||||
char *p = pbuf;
|
||||
@@ -372,13 +372,13 @@ void usb_scsi_trace_SG(iovec *sg, int count)
|
||||
/* user should be informed about truncation too*/
|
||||
if(trunc_count < count)
|
||||
strcpy(p, truncTail);
|
||||
|
||||
|
||||
TRACE(sg_mask, pbuf);
|
||||
free(pbuf);
|
||||
} else {
|
||||
TRACE_ALWAYS("usb_scsi_trace_SG:error allocate "
|
||||
"memory for tracing %d SG entries\n", trunc_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* BUILD_LOG_DAEMON */
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** tracing support definitions */
|
||||
|
||||
#ifndef _USB_SCSI_TRACING_H_
|
||||
#ifndef _USB_SCSI_TRACING_H_
|
||||
#define _USB_SCSI_TRACING_H_
|
||||
|
||||
#ifndef _SG_BUFFER_H_
|
||||
#include "sg_buffer.h"
|
||||
#endif /*_SG_BUFFER_H_*/
|
||||
|
||||
|
||||
void load_log_settings(void *sh);
|
||||
void create_log(void);
|
||||
void usb_scsi_trace(bool b_force, const char *fmt, ...);
|
||||
@@ -32,13 +32,13 @@ void usb_scsi_trace_CCB_SCSIIO(const CCB_SCSIIO *ccbio);
|
||||
/* ---------------------- Generic tracing --------------------------------------- */
|
||||
/**
|
||||
\define:TRACE_ALWAYS
|
||||
trace always - used mainly for error messages
|
||||
trace always - used mainly for error messages
|
||||
*/
|
||||
#define TRACE_ALWAYS(x...) \
|
||||
usb_scsi_trace(true, x)
|
||||
/**
|
||||
\define:TRACE
|
||||
trace only if logging is activated
|
||||
trace only if logging is activated
|
||||
*/
|
||||
#define TRACE(x...) \
|
||||
usb_scsi_trace(false, x)
|
||||
@@ -48,7 +48,7 @@ extern bool b_log_scsi_cmd;
|
||||
void usb_scsi_trace_command(bool b_hlight, const uint8 *cmd, size_t cmdlen);
|
||||
/**
|
||||
\define:TRACE_SCSI_COMMAND
|
||||
trace SCSI command
|
||||
trace SCSI command
|
||||
*/
|
||||
#define TRACE_SCSI_COMMAND(cmd, cmdlen)\
|
||||
{ if(b_log_scsi_cmd) usb_scsi_trace_command(false, cmd, cmdlen); }
|
||||
@@ -89,7 +89,7 @@ extern bool b_log_sense_data;
|
||||
trace the information REQUEST SENSE data.
|
||||
*/
|
||||
#define TRACE_SENSE_DATA(data, len)\
|
||||
{ if(b_log_sense_data) usb_scsi_trace_bytes("SENSE:", data, len); }
|
||||
{ if(b_log_sense_data) usb_scsi_trace_bytes("SENSE:", data, len); }
|
||||
#define TRACE_MODE_SENSE_DATA(prefix, data, len)\
|
||||
{ if(b_log_sense_data) usb_scsi_trace_bytes(prefix, data, len); }
|
||||
#define TRACE_MODE_SENSE_SGB(prefix, data)\
|
||||
@@ -99,5 +99,5 @@ extern bool b_log_capacity;
|
||||
#define TRACE_CAPACITY(prefix, data)\
|
||||
{ if(b_log_capacity) usb_scsi_trace_sgb(prefix, data); }
|
||||
|
||||
#endif /*_USB_SCSI_TRACING_H_*/
|
||||
#endif /*_USB_SCSI_TRACING_H_*/
|
||||
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** decalration of SCSI commands transformation procedures */
|
||||
|
||||
#ifndef _TRANSFORM_PROCS_H_
|
||||
#ifndef _TRANSFORM_PROCS_H_
|
||||
#define _TRANSFORM_PROCS_H_
|
||||
|
||||
#ifndef _PROTO_MODULE_H_
|
||||
#ifndef _PROTO_MODULE_H_
|
||||
#include "proto_module.h"
|
||||
#endif /* _PROTO_MODULE_H_ */
|
||||
#endif /* _PROTO_MODULE_H_ */
|
||||
/* transforms SCSI commands */
|
||||
extern transform_module_info scsi_transform_m;
|
||||
/* transforms RBC commands */
|
||||
@@ -28,4 +28,4 @@ extern transform_module_info ufi_transform_m;
|
||||
extern transform_module_info atapi_transform_m;
|
||||
/* transforms QIC-157 commands */
|
||||
extern transform_module_info qic157_transform_m;
|
||||
#endif /*_TRANSFORM_PROCS_H_*/
|
||||
#endif /*_TRANSFORM_PROCS_H_*/
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** definitions that should be in system headers but ... */
|
||||
|
||||
#ifndef _USB_DEFS_H_
|
||||
#ifndef _USB_DEFS_H_
|
||||
#define _USB_DEFS_H_
|
||||
|
||||
// TODO: Shouldn't it be declared in system USB headers?
|
||||
#define USB_EP_ATTR_CONTROL 0x00
|
||||
#define USB_EP_ATTR_ISOCHRONOUS 0x01
|
||||
#define USB_EP_ATTR_BULK 0x02
|
||||
#define USB_EP_ATTR_INTERRUPT 0x03
|
||||
#define USB_EP_ATTR_MASK 0x03
|
||||
#define USB_EP_ATTR_BULK 0x02
|
||||
#define USB_EP_ATTR_INTERRUPT 0x03
|
||||
#define USB_EP_ATTR_MASK 0x03
|
||||
|
||||
#define USB_EP_ADDR_DIR_IN 0x80
|
||||
#define USB_EP_ADDR_DIR_OUT 0x00
|
||||
@@ -42,5 +42,5 @@
|
||||
//TODO: And this was in old v3 stack what now ???
|
||||
#define B_DEV_STALLED 0x8000a015 /* some "forgotten" error */
|
||||
|
||||
#endif /*_USB_DEFS_H_*/
|
||||
#endif /*_USB_DEFS_H_*/
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** Main part of USB SIM implementation */
|
||||
|
||||
#include "usb_scsi.h"
|
||||
#include "usb_scsi.h"
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <module.h>
|
||||
@@ -21,22 +21,22 @@
|
||||
#include <stdio.h>
|
||||
#include <device_manager.h>
|
||||
#include <bus/SCSI.h>
|
||||
#include "device_info.h"
|
||||
#include "settings.h"
|
||||
#include "transform_procs.h"
|
||||
#include "tracing.h"
|
||||
#include "scsi_commands.h"
|
||||
#include "device_info.h"
|
||||
#include "settings.h"
|
||||
#include "transform_procs.h"
|
||||
#include "tracing.h"
|
||||
#include "scsi_commands.h"
|
||||
#include "proto_common.h"
|
||||
#include "proto_bulk.h"
|
||||
#include "proto_cbi.h"
|
||||
#include "usb_defs.h"
|
||||
#include "fake_device.h"
|
||||
#include "sg_buffer.h"
|
||||
#include "proto_bulk.h"
|
||||
#include "proto_cbi.h"
|
||||
#include "usb_defs.h"
|
||||
#include "fake_device.h"
|
||||
#include "sg_buffer.h"
|
||||
|
||||
|
||||
#if 0
|
||||
status_t device_added(const usb_device device, void **cookie);
|
||||
|
||||
|
||||
status_t device_removed(void *cookie);
|
||||
|
||||
static long sim_action(CCB_HEADER *ccbh);
|
||||
@@ -55,11 +55,11 @@ static long sim_init();
|
||||
|
||||
static long path_id = -1;
|
||||
static int32 load_count = 0;
|
||||
|
||||
|
||||
static char sim_vendor_name[] = "Haiku"; /* who wrote this driver */
|
||||
static char hba_vendor_name[] = "USB"; /* who made the hardware */
|
||||
static char controller_family[] = "USB SCSI"; /* what family of products */
|
||||
|
||||
|
||||
struct usb_support_descriptor supported_devices[] = {
|
||||
{0, 0, 0, 0, 0}
|
||||
};
|
||||
@@ -69,7 +69,7 @@ struct usb_support_descriptor supported_devices[] = {
|
||||
usb_device_info *usb_devices[MAX_DEVICES_COUNT];
|
||||
/* main devices table locking semaphore */
|
||||
sem_id usb_serial_lock = -1;
|
||||
|
||||
|
||||
usb_module_info *usb;
|
||||
static cam_for_sim_module_info *cam;
|
||||
|
||||
@@ -95,7 +95,7 @@ static status_t xpt_extended_path_inquiry(CCB_EXTENDED_PATHINQ *ccbep);
|
||||
\param uii:???
|
||||
\param pproperties:???
|
||||
\return:B_BAD_TYPE , B_ENTRY_NOT_FOUND, B_OK
|
||||
|
||||
|
||||
??
|
||||
*/
|
||||
status_t get_interface_properties(usb_interface_info *uii, uint32 *pproperties)
|
||||
@@ -105,12 +105,12 @@ status_t get_interface_properties(usb_interface_info *uii, uint32 *pproperties)
|
||||
status = B_OK;
|
||||
switch(uii->descr->interface_subclass){
|
||||
case USB_DEV_SUBCLASS_RBC: *pproperties |= CMDSET_RBC; break;
|
||||
case USB_DEV_SUBCLASS_UFI: *pproperties |= CMDSET_UFI; break;
|
||||
case USB_DEV_SUBCLASS_SFF8020I:
|
||||
case USB_DEV_SUBCLASS_UFI: *pproperties |= CMDSET_UFI; break;
|
||||
case USB_DEV_SUBCLASS_SFF8020I:
|
||||
case USB_DEV_SUBCLASS_SFF8070I: *pproperties |= CMDSET_ATAPI; break;
|
||||
case USB_DEV_SUBCLASS_SCSI: *pproperties |= CMDSET_SCSI; break;
|
||||
case USB_DEV_SUBCLASS_QIC157: *pproperties |= CMDSET_QIC157; break;
|
||||
default:
|
||||
default:
|
||||
TRACE_ALWAYS("get_interface_properties:unknown USB subclass:%02x\n",
|
||||
uii->descr->interface_subclass);
|
||||
/*status = B_ENTRY_NOT_FOUND;*/ /*B_BAD_TYPE assumed*/
|
||||
@@ -120,7 +120,7 @@ status_t get_interface_properties(usb_interface_info *uii, uint32 *pproperties)
|
||||
case USB_DEV_PROTOCOL_CBI: *pproperties |= PROTO_CBI; break;
|
||||
case USB_DEV_PROTOCOL_CB: *pproperties |= PROTO_CB; break;
|
||||
case USB_DEV_PROTOCOL_BULK: *pproperties |= PROTO_BULK_ONLY; break;
|
||||
default:
|
||||
default:
|
||||
TRACE_ALWAYS("get_interface_properties:unknown USB protocol:%02x\n",
|
||||
uii->descr->interface_protocol);
|
||||
/*status = B_ENTRY_NOT_FOUND;*/ /*B_BAD_TYPE assumed*/
|
||||
@@ -134,7 +134,7 @@ status_t get_interface_properties(usb_interface_info *uii, uint32 *pproperties)
|
||||
}
|
||||
/**
|
||||
\fn:
|
||||
|
||||
|
||||
*/
|
||||
status_t load_vendor_module(char **path, const char *path_mask,
|
||||
const char *prop, module_info **mi)
|
||||
@@ -154,7 +154,7 @@ status_t load_vendor_module(char **path, const char *path_mask,
|
||||
}
|
||||
/**
|
||||
\fn:
|
||||
|
||||
|
||||
*/
|
||||
status_t setup_transport_modules(usb_device_info *udi,
|
||||
usb_device_settings *uds)
|
||||
@@ -286,7 +286,7 @@ status_t setup_endpoints(usb_interface_info *uii, usb_device_info *udi)
|
||||
\param device:???
|
||||
\param ppudi:???
|
||||
\return:???
|
||||
|
||||
|
||||
???
|
||||
*/
|
||||
status_t allocate_resources(usb_device_info *udi)
|
||||
@@ -310,11 +310,11 @@ status_t allocate_resources(usb_device_info *udi)
|
||||
udi->dev_num = dev;
|
||||
release_sem(udi->lock_sem);
|
||||
status = B_OK;
|
||||
}else
|
||||
}else
|
||||
status = udi->trans_sem;
|
||||
} else
|
||||
} else
|
||||
status = udi->lock_sem;
|
||||
|
||||
|
||||
if(status != B_OK){
|
||||
TRACE_ALWAYS("allocate_resources:error:%s", strerror(status));
|
||||
if(udi->lock_sem >= 0)
|
||||
@@ -333,7 +333,7 @@ status_t allocate_resources(usb_device_info *udi)
|
||||
}
|
||||
/**
|
||||
\fn:
|
||||
|
||||
|
||||
*/
|
||||
void release_resources(usb_device_info *udi)
|
||||
{
|
||||
@@ -352,7 +352,7 @@ void release_resources(usb_device_info *udi)
|
||||
\param device:??
|
||||
\param cookie:??
|
||||
\return:??
|
||||
|
||||
|
||||
??
|
||||
*/
|
||||
status_t device_added(const usb_device device, void **cookie){
|
||||
@@ -364,10 +364,10 @@ status_t device_added(const usb_device device, void **cookie){
|
||||
const usb_device_descriptor *udd = (*usb->get_device_descriptor)(device);
|
||||
usb_device_info *udi = (usb_device_info *)malloc(sizeof(usb_device_info));
|
||||
TRACE("device_added: probing canidate: "
|
||||
"%04x/%04x %02d/%02d/%02d\n",
|
||||
"%04x/%04x %02d/%02d/%02d\n",
|
||||
udd->vendor_id, udd->product_id,
|
||||
udd->device_class,
|
||||
udd->device_subclass,
|
||||
udd->device_class,
|
||||
udd->device_subclass,
|
||||
udd->device_protocol);
|
||||
if(udi){
|
||||
status = B_NO_INIT;
|
||||
@@ -405,7 +405,7 @@ status_t device_added(const usb_device device, void **cookie){
|
||||
if( B_OK == setup_transport_modules(udi, &ud_settings)){
|
||||
break;
|
||||
} /* else - no break - fall through */
|
||||
default:
|
||||
default:
|
||||
continue; /* skip to next interface */
|
||||
}
|
||||
if(alt != 0){ /*TODO: are we need this ???*/
|
||||
@@ -413,7 +413,7 @@ status_t device_added(const usb_device device, void **cookie){
|
||||
TRACE_ALWAYS("device_added:setting alt interface failed:%s",
|
||||
strerror(status));
|
||||
goto Failed;/* Break - is it right?*/
|
||||
}
|
||||
}
|
||||
}
|
||||
if((*usb->get_configuration)(device) != uci){
|
||||
if((status = (*usb->set_configuration)(device, uci)) != B_OK){
|
||||
@@ -421,7 +421,7 @@ status_t device_added(const usb_device device, void **cookie){
|
||||
(*usb->get_configuration)(device), uci);
|
||||
TRACE_ALWAYS("device_added:setting configuration failed:%s\n",
|
||||
strerror(status));
|
||||
|
||||
|
||||
goto Failed;/* Break - is it right?*/
|
||||
}
|
||||
}
|
||||
@@ -432,7 +432,7 @@ status_t device_added(const usb_device device, void **cookie){
|
||||
udi->b_trace = b_log_protocol;
|
||||
udi->trace = usb_scsi_trace;
|
||||
udi->trace_bytes = usb_scsi_trace_bytes;
|
||||
udi->trans_timeout = TRANS_TIMEOUT;
|
||||
udi->trans_timeout = TRANS_TIMEOUT;
|
||||
udi->usb_m = usb;
|
||||
udi->not_ready_luns = 0xff; /*assume all LUNs initially not ready */
|
||||
if((status = (*udi->protocol_m->init)(udi)) == B_OK){
|
||||
@@ -440,7 +440,7 @@ status_t device_added(const usb_device device, void **cookie){
|
||||
*cookie = udi;
|
||||
b_found = true; /* we have found something useful - time to go out! */
|
||||
break; /* ... now break alternatives iteration.*/
|
||||
} else {
|
||||
} else {
|
||||
release_resources(udi);
|
||||
}
|
||||
}
|
||||
@@ -457,26 +457,26 @@ status_t device_added(const usb_device device, void **cookie){
|
||||
if(status != B_OK){
|
||||
TRACE("device_added: probing failed (%s) for: %04x/%04x\n",
|
||||
strerror(status), udd->vendor_id, udd->product_id);
|
||||
}
|
||||
Failed:
|
||||
}
|
||||
Failed:
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
\fn:device_removed
|
||||
\param cookie:???
|
||||
\return:???
|
||||
|
||||
|
||||
???
|
||||
*/
|
||||
status_t device_removed(void *cookie)
|
||||
{
|
||||
status_t status = B_OK;
|
||||
usb_device_info *udi = (usb_device_info *)cookie;
|
||||
acquire_sem(udi->lock_sem); /* wait for possible I/O operation complete */
|
||||
acquire_sem(udi->lock_sem); /* wait for possible I/O operation complete */
|
||||
release_resources(udi);
|
||||
/* no corresponding call of release_sem(udi->lock_sem);
|
||||
- semaphore was deleted in release_resources, any waiting thread
|
||||
was failed with BAD_SEM_ID.
|
||||
was failed with BAD_SEM_ID.
|
||||
*/
|
||||
TRACE_ALWAYS("device_removed[%d]:All The Best !!!\n", udi->dev_num);
|
||||
free(udi);
|
||||
@@ -486,7 +486,7 @@ status_t device_removed(void *cookie)
|
||||
/**
|
||||
\fn:sim_init
|
||||
\return: ???
|
||||
|
||||
|
||||
called on SIM init
|
||||
*/
|
||||
static long sim_init(void)
|
||||
@@ -506,7 +506,7 @@ pre_check_scsi_io_request(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
uint8 target_lun = ccbio->cam_ch.cam_target_lun;
|
||||
*ret_status = B_OK;
|
||||
/* handle reserved device and luns entries */
|
||||
if(b_reservation_on && udi == NULL &&
|
||||
if(b_reservation_on && udi == NULL &&
|
||||
target_id < reserved_devices &&
|
||||
target_lun < reserved_luns)
|
||||
{
|
||||
@@ -535,7 +535,7 @@ pre_check_scsi_io_request(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
memset(&udi->autosense_data, 0, sizeof(udi->autosense_data));
|
||||
} else {
|
||||
memset(ccbio->cam_sense_ptr, 0, ccbio->cam_sense_len);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
@@ -547,7 +547,7 @@ pre_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
{
|
||||
uint8 target_lun = ccbio->cam_ch.cam_target_lun;
|
||||
*ret_status = B_OK;
|
||||
udi->trans_timeout = TRANS_TIMEOUT;
|
||||
udi->trans_timeout = TRANS_TIMEOUT;
|
||||
switch(command->opcode){
|
||||
case MODE_SELECT_6:
|
||||
case MODE_SENSE_6:{
|
||||
@@ -572,18 +572,18 @@ pre_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
}
|
||||
TRACE_MODE_SENSE_SGB("MODE SELECT 6:", &sgb_sense_6);
|
||||
if(B_OK != sg_memcpy(sgb, 1, &sgb_sense_6, 0, 3) ||
|
||||
B_OK != sg_memcpy(sgb, 7, &sgb_sense_6, 3, 1) ||
|
||||
B_OK != sg_memcpy(sgb, 7, &sgb_sense_6, 3, 1) ||
|
||||
B_OK != sg_memcpy(sgb, 8, &sgb_sense_6, 4, ccbio->cam_dxfer_len - sizeof(scsi_mode_param_header_6)))
|
||||
{
|
||||
/* In case of error TRACE-ing was already performed in sg_ functions */
|
||||
goto set_REQ_INVALID_and_return;
|
||||
}
|
||||
TRACE_MODE_SENSE_SGB("MODE SELECT 10:", sgb);
|
||||
}
|
||||
}
|
||||
} /*else {
|
||||
if(b_select){ / * trace data if configured in settings * /
|
||||
TRACE_MODE_SENSE_DATA("MODE_SELECT:", ccbio->cam_data_ptr, ccbio->cam_dxfer_len);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}break;
|
||||
case INQUIRY: /* fake INQUIRY request */
|
||||
@@ -605,7 +605,7 @@ pre_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
set_REQ_CMP_and_return:
|
||||
ccbio->cam_ch.cam_status = CAM_REQ_CMP;
|
||||
return false;//*ret_status = B_OK;
|
||||
@@ -625,11 +625,11 @@ post_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
bool b_cmd_ok = (ccbio->cam_ch.cam_status == CAM_REQ_CMP);
|
||||
uint8 target_lun = ccbio->cam_ch.cam_target_lun;
|
||||
switch(command->opcode){
|
||||
case READ_6:
|
||||
case READ_6:
|
||||
case WRITE_6:
|
||||
#if 0
|
||||
#if 0
|
||||
/* Disabled - single problem can switch to 6-bytes mode. If device doesn't
|
||||
support 6-bytes command all goes totally wrong. That's bad. */
|
||||
support 6-bytes command all goes totally wrong. That's bad. */
|
||||
if(!b_cmd_ok && !HAS_FEATURES(udi->descr.properties, PROP_FORCE_RW_TO_6)){
|
||||
TRACE("post_handle_features:READ(10)/WRITE(10) failed - retry 6-byte one\n");
|
||||
udi->descr.properties |= PROP_FORCE_RW_TO_6;
|
||||
@@ -668,13 +668,13 @@ post_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
}
|
||||
TRACE_MODE_SENSE_SGB("MODE SENSE 10:", sgb);
|
||||
if( B_OK != sg_memcpy(&sgb_sense_6, 0, sgb, 1, 3) ||
|
||||
B_OK != sg_memcpy(&sgb_sense_6, 3, sgb, 7, 1) ||
|
||||
B_OK != sg_memcpy(&sgb_sense_6, 3, sgb, 7, 1) ||
|
||||
B_OK != sg_memcpy(&sgb_sense_6, 4, sgb, 8, ccbio->cam_dxfer_len - sizeof(scsi_mode_param_header_6)))
|
||||
{
|
||||
/* In case of error TRACE-ing was already performed in sg_ functions */
|
||||
TRACE_ALWAYS("MODE_SENSE 10->6 conversion failed\n");
|
||||
goto set_REQ_INVALID_and_return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* set write-protected flag if required by user */
|
||||
if(HAS_FIXES(udi->properties, FIX_FORCE_READ_ONLY)){
|
||||
@@ -719,14 +719,14 @@ post_handle_features(usb_device_info *udi, CCB_SCSIIO *ccbio,
|
||||
set_REQ_INVALID_and_return:
|
||||
ccbio->cam_ch.cam_status = CAM_REQ_INVALID;
|
||||
*ret_status = B_BAD_VALUE;
|
||||
return false; /* do not retry - fatal error */
|
||||
return false; /* do not retry - fatal error */
|
||||
}
|
||||
/**
|
||||
\fn:xpt_scsi_io
|
||||
\param ccbio: ????
|
||||
\return: ???
|
||||
|
||||
xpt_scsi_io - handle XPT_SCSI_IO sim action
|
||||
|
||||
xpt_scsi_io - handle XPT_SCSI_IO sim action
|
||||
*/
|
||||
status_t xpt_scsi_io(CCB_SCSIIO *ccbio)
|
||||
{
|
||||
@@ -743,12 +743,12 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio)
|
||||
}
|
||||
|
||||
#if 0 /* activate if you need detailed logging of CCB_SCSI request*/
|
||||
usb_scsi_trace_CCB_SCSIIO(ccbio);
|
||||
usb_scsi_trace_CCB_SCSIIO(ccbio);
|
||||
#endif
|
||||
|
||||
|
||||
/* acquire semaphore - avoid re-enters */
|
||||
/* if((status = acquire_sem_etc(udi->lock_sem, 1,
|
||||
/* if((status = acquire_sem_etc(udi->lock_sem, 1,
|
||||
B_RELATIVE_TIMEOUT,
|
||||
udi->trans_timeout)) != B_OK) */
|
||||
// TRACE_ALWAYS("sem before acq:%08x\n",udi->lock_sem);
|
||||
@@ -756,14 +756,14 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio)
|
||||
/* disabled - CAM_BUSY flag is not recognized by BeOS ... :-(
|
||||
if(status == B_WOULD_BLOCK){
|
||||
TRACE("locked sema bypass OK\n");
|
||||
ccbio->cam_ch.cam_status = CAM_BUSY;
|
||||
ccbio->cam_ch.cam_status = CAM_BUSY;
|
||||
return B_OK;
|
||||
}*/
|
||||
}*/
|
||||
TRACE("xpt_scsi_io:acquire_sem_etc() failed:%08x\n", status);
|
||||
ccbio->cam_ch.cam_status = CAM_DEV_NOT_THERE;
|
||||
return B_DEV_BAD_DRIVE_NUM;
|
||||
}
|
||||
/* set the command data pointer */
|
||||
/* set the command data pointer */
|
||||
if(ccbio->cam_ch.cam_flags & CAM_CDB_POINTER){
|
||||
cmd = ccbio->cam_cdb_io.cam_cdb_ptr;
|
||||
}else{
|
||||
@@ -773,7 +773,7 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio)
|
||||
*_handle_features() functions! Twice reallocation is also not awaited!
|
||||
Note this on refactoring!!! */
|
||||
/*TODO returns!*/
|
||||
init_sg_buffer(&sgb, ccbio);
|
||||
init_sg_buffer(&sgb, ccbio);
|
||||
do{ /* <-- will be repeated if 6-byte RW/MS commands failed */
|
||||
uint8 *rcmd;
|
||||
uint8 rcmdlen;
|
||||
@@ -801,11 +801,11 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio)
|
||||
case CAM_DIR_OUT: dir = eDirOut; break;
|
||||
default: dir = eDirNone; break;
|
||||
}
|
||||
|
||||
|
||||
TRACE_DATA_IO_SG(sgb.piov, sgb.count);
|
||||
|
||||
|
||||
/*TODO: return!*/
|
||||
sg_buffer_len(&sgb, &transfer_len);
|
||||
sg_buffer_len(&sgb, &transfer_len);
|
||||
/* transfer command to device. SCSI status will be handled in callback */
|
||||
(*udi->protocol_m->transfer)(udi, rcmd, rcmdlen, sgb.piov, sgb.count,
|
||||
transfer_len/*ccbio->cam_dxfer_len*/,
|
||||
@@ -820,26 +820,26 @@ status_t xpt_scsi_io(CCB_SCSIIO *ccbio)
|
||||
\fn:xpt_path_inquiry
|
||||
\param ccbp:
|
||||
\return:
|
||||
|
||||
xpt_path_inquiry - handle XPT_PATH_INQ sim action
|
||||
|
||||
xpt_path_inquiry - handle XPT_PATH_INQ sim action
|
||||
*/
|
||||
status_t xpt_path_inquiry(CCB_PATHINQ *ccbp)
|
||||
{
|
||||
status_t status = B_OK;
|
||||
|
||||
|
||||
ccbp->cam_version_num = SIM_VERSION;
|
||||
ccbp->cam_target_sprt = 0;
|
||||
ccbp->cam_hba_eng_cnt = 0;
|
||||
memset (ccbp->cam_vuhba_flags, 0, VUHBA);
|
||||
ccbp->cam_sim_priv = SIM_PRIV;
|
||||
ccbp->cam_async_flags = 0;
|
||||
ccbp->cam_initiator_id = CONTROLLER_SCSI_ID;
|
||||
ccbp->cam_initiator_id = CONTROLLER_SCSI_ID;
|
||||
ccbp->cam_hba_inquiry = CONTROLLER_SCSI_BUS; /* Narrow SCSI bus */
|
||||
ccbp->cam_hba_misc = PIM_NOINQUIRY;
|
||||
ccbp->cam_osd_usage = 0;
|
||||
/* There should be special handling of path_id == 0xff
|
||||
but looks like it's not used by BeOS now */
|
||||
/*ccbp->cam_hpath_id = path_id;*/
|
||||
/*ccbp->cam_hpath_id = path_id;*/
|
||||
strncpy(ccbp->cam_sim_vid, sim_vendor_name, SIM_ID);
|
||||
strncpy(ccbp->cam_hba_vid, hba_vendor_name, HBA_ID);
|
||||
ccbp->cam_ch.cam_status = CAM_REQ_CMP;
|
||||
@@ -849,13 +849,13 @@ status_t xpt_path_inquiry(CCB_PATHINQ *ccbp)
|
||||
\fn:xpt_extended_path_inquiry
|
||||
\param ccbep: ???
|
||||
\return:???
|
||||
|
||||
xpt_extended_path_inquiry - handle XPT_EXTENDED_PATH_INQ sim action
|
||||
|
||||
xpt_extended_path_inquiry - handle XPT_EXTENDED_PATH_INQ sim action
|
||||
*/
|
||||
status_t xpt_extended_path_inquiry(CCB_EXTENDED_PATHINQ *ccbep)
|
||||
{
|
||||
status_t status = B_OK;
|
||||
xpt_path_inquiry((CCB_PATHINQ *)ccbep);
|
||||
xpt_path_inquiry((CCB_PATHINQ *)ccbep);
|
||||
sprintf(ccbep->cam_sim_version, "%d.0", SIM_VERSION);
|
||||
sprintf(ccbep->cam_hba_version, "%d.0", HBA_VERSION);
|
||||
strncpy(ccbep->cam_controller_family, controller_family, FAM_ID);
|
||||
@@ -866,7 +866,7 @@ status_t xpt_extended_path_inquiry(CCB_EXTENDED_PATHINQ *ccbep)
|
||||
\fn:sim_action
|
||||
\param ccbh: ????
|
||||
\return: ????
|
||||
|
||||
|
||||
This fucntion performs SCSI interface module actions -
|
||||
calls corresponding xpt_* - functions.
|
||||
*/
|
||||
@@ -904,9 +904,9 @@ static long sim_action(CCB_HEADER *ccbh)
|
||||
\param op: operation to be performed on this module
|
||||
\param ...: possible additional arguments
|
||||
\return: B_OK on success, error status on failure
|
||||
|
||||
|
||||
This function deals with standard module operations. Currently, the only
|
||||
two things that entails are initialization and uninitialization.
|
||||
two things that entails are initialization and uninitialization.
|
||||
- get the SCSI Bus Manager Module and USB Manager Module
|
||||
- put them when we're finished
|
||||
*/
|
||||
@@ -920,15 +920,15 @@ static status_t std_ops(int32 op, ...)
|
||||
TRACE_ALWAYS("std_ops: B_MODULE_INIT called!\n");
|
||||
/* if(0 == atomic_add(&load_count, 1)){
|
||||
thread_info tinfo = {0}; */
|
||||
load_module_settings();
|
||||
load_module_settings();
|
||||
/* get_thread_info(find_thread(0), &tinfo);
|
||||
if(!b_ignore_sysinit2 || (0 != strcmp(tinfo.name, "sysinit2"))){
|
||||
create_log();
|
||||
if(get_module(B_USB_MODULE_NAME, (module_info **)&usb) == B_OK){
|
||||
if(get_module(B_CAM_FOR_SIM_MODULE_NAME, (module_info **)&cam) == B_OK){
|
||||
create_log();
|
||||
if(get_module(B_USB_MODULE_NAME, (module_info **)&usb) == B_OK){
|
||||
if(get_module(B_CAM_FOR_SIM_MODULE_NAME, (module_info **)&cam) == B_OK){
|
||||
for(i = 0; i < MAX_DEVICES_COUNT; i++)
|
||||
usb_devices[i] = NULL;
|
||||
|
||||
usb_devices[i] = NULL;
|
||||
|
||||
if((*usb->register_driver)(MODULE_NAME, supported_devices, SIZEOF(supported_devices), "usb_dsk") == B_OK){
|
||||
if((*usb->install_notify)(MODULE_NAME, ¬ify_hooks) == B_OK){
|
||||
entry.sim_init = sim_init;
|
||||
@@ -936,9 +936,9 @@ static status_t std_ops(int32 op, ...)
|
||||
path_id =(*cam->xpt_bus_register)(&entry);
|
||||
usb_serial_lock = create_sem(1, MODULE_NAME"_devices_table_lock");
|
||||
status = B_OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
put_module(B_CAM_FOR_SIM_MODULE_NAME);
|
||||
}
|
||||
put_module(B_USB_MODULE_NAME);
|
||||
@@ -948,7 +948,7 @@ static status_t std_ops(int32 op, ...)
|
||||
}
|
||||
} else {
|
||||
atomic_add(&load_count, -1);
|
||||
}*/
|
||||
}*/
|
||||
break;
|
||||
case B_MODULE_UNINIT:
|
||||
TRACE_ALWAYS("std_ops: B_MODULE_UNINIT called!\n");
|
||||
@@ -961,7 +961,7 @@ static status_t std_ops(int32 op, ...)
|
||||
}
|
||||
delete_sem(usb_serial_lock);
|
||||
put_module(B_USB_MODULE_NAME);
|
||||
put_module(B_CAM_FOR_SIM_MODULE_NAME);
|
||||
put_module(B_CAM_FOR_SIM_MODULE_NAME);
|
||||
} else {
|
||||
atomic_add(&load_count, 1);
|
||||
}*/
|
||||
@@ -971,12 +971,12 @@ static status_t std_ops(int32 op, ...)
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
*/
|
||||
static float
|
||||
static float
|
||||
supports_device(device_node_handle parent, bool *_noConnection)
|
||||
{
|
||||
TRACE_ALWAYS("supports_device\n");
|
||||
@@ -984,7 +984,7 @@ supports_device(device_node_handle parent, bool *_noConnection)
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
@@ -997,7 +997,7 @@ register_device(device_node_handle parent)
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
@@ -1010,7 +1010,7 @@ init_module(device_node_handle node, void *user_cookie, void **_cookie)
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
@@ -1023,7 +1023,7 @@ uninit_module(void *cookie)
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* TODO
|
||||
*/
|
||||
@@ -1034,7 +1034,7 @@ device_removed(device_node_handle node, void *cookie)
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* TODO
|
||||
*/
|
||||
@@ -1045,7 +1045,7 @@ device_cleanup(device_node_handle node)
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* TODO
|
||||
*/
|
||||
@@ -1056,7 +1056,7 @@ get_supported_paths(const char ***_busses, const char ***_devices)
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* TODO
|
||||
*/
|
||||
@@ -1067,7 +1067,7 @@ scsi_io( scsi_sim_cookie cookie, scsi_ccb *ccb )
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
@@ -1080,7 +1080,7 @@ abort( scsi_sim_cookie cookie, scsi_ccb *ccb_to_abort )
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
@@ -1093,7 +1093,7 @@ reset_device( scsi_sim_cookie cookie, uchar target_id, uchar target_lun )
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
@@ -1106,7 +1106,7 @@ term_io( scsi_sim_cookie cookie, scsi_ccb *ccb_to_terminate )
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
@@ -1119,7 +1119,7 @@ path_inquiry( scsi_sim_cookie cookie, scsi_path_inquiry *inquiry_data )
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
@@ -1132,7 +1132,7 @@ scan_bus( scsi_sim_cookie cookie )
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
@@ -1145,7 +1145,7 @@ reset_bus( scsi_sim_cookie cookie )
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* TODO
|
||||
*/
|
||||
@@ -1156,7 +1156,7 @@ get_restrictions(scsi_sim_cookie cookie, uchar target_id, bool *is_atapi, bool *
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn:
|
||||
* \fn:
|
||||
* \param :
|
||||
* \return:
|
||||
* TODO
|
||||
@@ -1173,41 +1173,41 @@ module_ioctl(scsi_sim_cookie cookie, uint8 targetID, uint32 op, void *buffer, si
|
||||
Declare our module_info so we can be loaded as a kernel module
|
||||
*/
|
||||
static scsi_sim_interface usb_scsi_sim = {
|
||||
{ //driver_module_info
|
||||
{ //driver_module_info
|
||||
{ // module_info
|
||||
"busses/scsi/usb/device_v1", // is device_v1 really required? or v1 is enough?
|
||||
0,
|
||||
0,
|
||||
&std_ops
|
||||
},
|
||||
|
||||
|
||||
supports_device,
|
||||
register_device,
|
||||
|
||||
init_module, // init_driver,
|
||||
init_module, // init_driver,
|
||||
uninit_module, // uninit_driver,
|
||||
|
||||
|
||||
device_removed,
|
||||
device_cleanup,
|
||||
|
||||
get_supported_paths,
|
||||
},
|
||||
|
||||
|
||||
scsi_io,
|
||||
abort,
|
||||
reset_device,
|
||||
term_io,
|
||||
|
||||
|
||||
path_inquiry,
|
||||
scan_bus,
|
||||
reset_bus,
|
||||
|
||||
|
||||
get_restrictions,
|
||||
|
||||
module_ioctl //ioctl
|
||||
|
||||
module_ioctl //ioctl
|
||||
};
|
||||
|
||||
/**
|
||||
Export module_info-s list
|
||||
Export module_info-s list
|
||||
*/
|
||||
_EXPORT module_info *modules[] = {
|
||||
(module_info *) &usb_scsi_sim,
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/**
|
||||
*
|
||||
* TODO: description
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku OS.
|
||||
*
|
||||
* This file is a part of USB SCSI CAM for Haiku.
|
||||
* May be used under terms of the MIT License
|
||||
*
|
||||
* Author(s):
|
||||
* Siarzhuk Zharski <imker@gmx.li>
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
#ifndef _USB_SCSI_H_
|
||||
#ifndef _USB_SCSI_H_
|
||||
#define _USB_SCSI_H_
|
||||
|
||||
#ifndef _OS_H
|
||||
@@ -26,7 +26,7 @@
|
||||
#endif /*_CAM_H*/
|
||||
|
||||
#define MODULE_NAME "usb_scsi"
|
||||
|
||||
|
||||
#define CONTROLLER_SCSI_BUS 0x00 /* Narrow SCSI bus. Use PI_* to alter this*/
|
||||
#define MAX_DEVICES_COUNT 0x07 /* simulate Narrow SCSI bus - 8 devices*/
|
||||
#define CONTROLLER_SCSI_ID 0x07 /* "controller" SCSI ID */
|
||||
@@ -42,7 +42,7 @@
|
||||
#define PROTO_MASK 0x0000000f
|
||||
|
||||
#define PROTO(__value) ((__value) & PROTO_MASK)
|
||||
|
||||
|
||||
/* command set definitions - are not bitmasks */
|
||||
#define CMDSET_NONE 0x00000000
|
||||
#define CMDSET_SCSI 0x00000010
|
||||
@@ -59,7 +59,7 @@
|
||||
#define HAS_SET(__mask, __flag) \
|
||||
(((__mask) & __flag) == (__flag))
|
||||
|
||||
/* fixes - bitmasked */
|
||||
/* fixes - bitmasked */
|
||||
#define FIX_NO_GETMAXLUN 0x00000100
|
||||
#define FIX_FORCE_RW_TO_6 0x00000200
|
||||
#define FIX_NO_TEST_UNIT 0x00000400
|
||||
|
||||
Reference in New Issue
Block a user