JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 9: DDI and DKI Driver Entry Points     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

Driver Entry Points

aread(9E)

attach(9E)

audio_engine_channels(9E)

audio_engine_chinfo(9E)

audio_engine_close(9E)

audio_engine_count(9E)

audio_engine_format(9E)

audio_engine_open(9E)

audio_engine_playahead(9E)

audio_engine_qlen(9E)

audio_engine_rate(9E)

audio_engine_start(9E)

audio_engine_stop(9E)

audio_engine_sync(9E)

awrite(9E)

chpoll(9E)

close(9E)

csx_event_handler(9E)

detach(9E)

devmap(9E)

devmap_access(9E)

devmap_contextmgt(9E)

devmap_dup(9E)

devmap_map(9E)

devmap_unmap(9E)

dump(9E)

_fini(9E)

getinfo(9E)

gld(9E)

gldm_get_stats(9E)

gldm_intr(9E)

gldm_ioctl(9E)

gldm_reset(9E)

gldm_send(9E)

gldm_set_mac_addr(9E)

gldm_set_multicast(9E)

gldm_set_promiscuous(9E)

gldm_start(9E)

gldm_stop(9E)

identify(9E)

_info(9E)

_init(9E)

ioctl(9E)

ks_snapshot(9E)

ks_update(9E)

mac(9E)

mac_capab_rings(9E)

mac_group_info(9E)

mac_ring_info(9E)

mc_getcapab(9E)

mc_getprop(9E)

mc_getstat(9E)

mc_ioctl(9E)

mc_multicst(9E)

mc_propinfo(9E)

mc_setpromisc(9E)

mc_setprop(9E)

mc_start(9E)

mc_stop(9E)

mc_tx(9E)

mc_unicst(9E)

mgi_addmac(9E)

mgi_add_vlanfilter(9E)

mgi_getsriov_info(9E)

mgi_remmac(9E)

mgi_rem_vlanfliter(9E)

mgi_setmtu(9E)

mgi_start(9E)

mgi_stop(9E)

mmap(9E)

mr_gaddring(9E)

mr_gget(9E)

mr_gremring(9E)

mri_intr_disable(9E)

mri_intr_enable(9E)

mri_poll(9E)

mri_start(9E)

mri_stat(9E)

mri_stop(9E)

mri_tx(9E)

mr_rget(9E)

open(9E)

power(9E)

print(9E)

probe(9E)

prop_op(9E)

put(9E)

quiesce(9E)

read(9E)

segmap(9E)

sofop_accepted(9E)

sofop_attach_active(9E)

sofop_attach_passive(9E)

sofop_bind(9E)

sofop_connect(9E)

sofop_data_in(9E)

sofop_data_in_proc(9E)

sofop_data_out(9E)

sofop_detach(9E)

sofop_getpeername(9E)

sofop_getsockname(9E)

sofop_getsockopt(9E)

sofop_listen(9E)

sofop_notify(9E)

sofop_setsockopt(9E)

sofop_shutdown(9E)

srv(9E)

strategy(9E)

tran_abort(9E)

tran_bus_reset(9E)

tran_destroy_pkt(9E)

tran_dmafree(9E)

tran_getcap(9E)

tran_init_pkt(9E)

tran_pkt_constructor(9E)

tran_pkt_destructor(9E)

tran_quiesce(9E)

tran_reset(9E)

tran_reset_notify(9E)

tran_setcap(9E)

tran_setup_pkt(9E)

tran_start(9E)

tran_sync_pkt(9E)

tran_teardown_pkt(9E)

tran_tgt_free(9E)

tran_tgt_init(9E)

tran_tgt_probe(9E)

tran_unquiesce(9E)

write(9E)

tran_start

- request to transport a SCSI command

Synopsis

#include <sys/scsi/scsi.h>

int prefixtran_start(struct scsi_address *ap,
     struct scsi_pkt *pkt);

Interface Level

Solaris architecture specific (Solaris DDI).

Parameters

pkt

Pointer to the scsi_pkt(9S) structure that is about to be transferred.

ap

Pointer to a scsi_address(9S) structure.

Description

The tran_start() vector in the scsi_hba_tran(9S) structure must be initialized during the HBA driver's attach(9E) to point to an HBA entry point to be called when a target driver calls scsi_transport(9F).

tran_start() must perform the necessary operations on the HBA hardware to transport the SCSI command in the pkt structure to the target/logical unit device specified in the ap structure.

If the flag FLAG_NOINTR is set in pkt_flags in pkt, tran_start() should not return until the command has been completed. The command completion callback pkt_comp in pkt must not be called for commands with FLAG_NOINTR set, since the return is made directly to the function invoking scsi_transport(9F).

When the flag FLAG_NOINTR is not set, tran_start() must queue the command for execution on the hardware and return immediately. The member pkt_comp in pkt indicates a callback routine to be called upon command completion.

Refer to scsi_pkt(9S) for other bits in pkt_flags for which the HBA driver may need to adjust how the command is managed.

If the auto_rqsense capability has been set, and the status length allocated in tran_init_pkt(9E) is greater than or equal to sizeof(struct scsi_arq_status), automatic request sense is enabled for this pkt. If the command terminates with a Check Condition, the HBA driver must arrange for a Request Sense command to be transported to that target/logical unit, and the members of the scsi_arq_status structure pointed to by pkt_scbp updated with the results of this Request Sense command before the HBA driver completes the command pointed by pkt.

The member pkt_time in pkt is the maximum number of seconds in which the command should complete. Timeout starts when the command is transmitted on the SCSI bus. A pkt_time of 0 means no timeout should be performed.

For a command which has timed out, the HBA driver must perform some recovery operation to clear the command in the target, typically an Abort message, or a Device or Bus Reset. The pkt_reason member of the timed out pkt should be set to CMD_TIMEOUT, and pkt_statistics OR'ed with STAT_TIMEOUT. If the HBA driver can successfully recover from the timeout, pkt_statistics must also be OR'ed with one of STAT_ABORTED, STAT_BUS_RESET, or STAT_DEV_RESET, as appropriate. This informs the target driver that timeout recovery has already been successfully accomplished for the timed out command. The pkt_comp completion callback, if not NULL, must also be called at the conclusion of the timeout recovery.

If the timeout recovery was accomplished with an Abort Tag message, only the timed out packet is affected, and the packet must be returned with pkt_statistics OR'ed with STAT_ABORTED and STAT_TIMEOUT.

If the timeout recovery was accomplished with an Abort message, all commands active in that target are affected. All corresponding packets must be returned with pkt_reason, CMD_TIMEOUT, and pkt_statistics OR'ed with STAT_TIMEOUT and STAT_ABORTED.

If the timeout recovery was accomplished with a Device Reset, all packets corresponding to commands active in the target must be returned in the transport layer for this target. Packets corresponding to commands active in the target must be returned returned with pkt_reason set to CMD_TIMEOUT, and pkt_statistics OR'ed with STAT_DEV_RESET and STAT_TIMEOUT. Currently inactive packets queued for the device should be returned with pkt_reason set to CMD_RESET and pkt_statistics OR'ed with STAT_ABORTED.

If the timeout recovery was accomplished with a Bus Reset, all packets corresponding to commands active in the target must be returned in the transport layer. Packets corresponding to commands active in the target must be returned with pkt_reason set to CMD_TIMEOUT and pkt_statistics OR'ed with STAT_TIMEOUT and STAT_BUS_RESET. All queued packets for other targets on this bus must be returned with pkt_reason set to CMD_RESET and pkt_statistics OR'ed with STAT_ABORTED.

Note that after either a Device Reset or a Bus Reset, the HBA driver must enforce a reset delay time of 'scsi-reset-delay' milliseconds, during which time no commands should be sent to that device, or any device on the bus, respectively.

tran_start() should initialize the following members in pkt to 0. Upon command completion, the HBA driver should ensure that the values in these members are updated to accurately reflect the states through which the command transitioned while in the transport layer.

pkt_resid

For commands with data transfer, this member must be updated to indicate the residual of the data transferred.

pkt_reason

The reason for the command completion. This field should be set to CMD_CMPLT at the beginning of tran_start(), then updated if the command ever transitions to an abnormal termination state. To avoid losing information, do not set pkt_reason to any other error state unless it still has its original CMD_CMPLT value.

pkt_statistics

Bit field of transport-related statistics.

pkt_state

Bit field with the major states through which a SCSI command can transition. Note: The members listed above, and pkt_hba_private member, are the only fields in the scsi_pkt(9S) structure which may be modified by the transport layer.

Return Values

tran_start() must return:

TRAN_ACCEPT

The packet was accepted by the transport layer.

TRAN_BUSY

The packet could not be accepted because there was already a packet in progress for this target/logical unit, the HBA queue was full, or the target device queue was full.

TRAN_BADPKT

The DMA count in the packet exceeded the DMA engine's maximum DMA size, or the packet could not be accepted for other reasons.

TRAN_FATAL_ERROR

A fatal error has occurred in the HBA.

Context

The tran_start() function can be called from user or interrupt context. This requirement comes from scsi_transport().

See Also

attach(9E), tran_init_pkt(9E), scsi_hba_attach(9F), scsi_transport(9F), scsi_address(9S), scsi_arq_status(9S), scsi_hba_tran(9S), scsi_pkt(9S)

Writing Device Drivers