mirror of https://github.com/ipxe/ipxe.git
Code in place to use a hypothetical SCSI interface.
parent
f2fa390ae6
commit
edd1b173a7
|
@ -589,6 +589,11 @@ struct iscsi_session {
|
||||||
* Set to NULL when command is complete.
|
* Set to NULL when command is complete.
|
||||||
*/
|
*/
|
||||||
struct scsi_command *command;
|
struct scsi_command *command;
|
||||||
|
/** SCSI command return code
|
||||||
|
*
|
||||||
|
* Set to -EINPROGRESS while command is processing.
|
||||||
|
*/
|
||||||
|
int rc;
|
||||||
/** Instant return code
|
/** Instant return code
|
||||||
*
|
*
|
||||||
* Set to a non-zero value if all requests should return
|
* Set to a non-zero value if all requests should return
|
||||||
|
|
|
@ -165,11 +165,8 @@ static void iscsi_scsi_done ( struct iscsi_session *iscsi, int rc ) {
|
||||||
|
|
||||||
assert ( iscsi->tx_state == ISCSI_TX_IDLE );
|
assert ( iscsi->tx_state == ISCSI_TX_IDLE );
|
||||||
|
|
||||||
/* Clear current SCSI command */
|
|
||||||
iscsi->command = NULL;
|
iscsi->command = NULL;
|
||||||
|
iscsi->rc = rc;
|
||||||
/* Mark asynchronous operation as complete */
|
|
||||||
async_done ( &iscsi->async, rc );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -1281,20 +1278,32 @@ static int iscsi_scsi_issue ( struct scsi_interface *scsi,
|
||||||
container_of ( scsi, struct iscsi_session, scsi );
|
container_of ( scsi, struct iscsi_session, scsi );
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
/* Record SCSI command */
|
||||||
|
iscsi->command = command;
|
||||||
|
|
||||||
/* Abort immediately if we have a recorded permanent failure */
|
/* Abort immediately if we have a recorded permanent failure */
|
||||||
if ( iscsi->instant_rc )
|
if ( iscsi->instant_rc ) {
|
||||||
return iscsi->instant_rc;
|
rc = iscsi->instant_rc;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* Issue command or open connection as appropriate */
|
/* Issue command or open connection as appropriate */
|
||||||
if ( iscsi->status ) {
|
if ( iscsi->status ) {
|
||||||
iscsi_start_command ( iscsi );
|
iscsi_start_command ( iscsi );
|
||||||
} else {
|
} else {
|
||||||
if ( ( rc = iscsi_open_connection ( iscsi ) ) != 0 )
|
if ( ( rc = iscsi_open_connection ( iscsi ) ) != 0 )
|
||||||
return rc;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
/* Wait for command to complete */
|
||||||
|
iscsi->rc = -EINPROGRESS;
|
||||||
|
while ( iscsi->rc == -EINPROGRESS )
|
||||||
|
step();
|
||||||
|
rc = iscsi->rc;
|
||||||
|
|
||||||
|
done:
|
||||||
|
iscsi->command = NULL;
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1311,6 +1320,12 @@ static void iscsi_scsi_detach ( struct scsi_interface *scsi, int rc ) {
|
||||||
process_del ( &iscsi->process );
|
process_del ( &iscsi->process );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** iSCSI SCSI operations */
|
||||||
|
struct scsi_operations iscsi_scsi_operations = {
|
||||||
|
.detach = iscsi_scsi_detach,
|
||||||
|
.issue = iscsi_scsi_issue,
|
||||||
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Instantiator
|
* Instantiator
|
||||||
|
|
Loading…
Reference in New Issue