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 Express 11/10
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)

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)

mmap(9E)

open(9E)

power(9E)

print(9E)

probe(9E)

prop_op(9E)

put(9E)

quiesce(9E)

read(9E)

segmap(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_setup_pkt

, tran_teardown_pkt

, tran_pkt_constructor

, tran_pkt_destructor

- SCSI HBA packet allocation and deallocation

Synopsis

#include <sys/scsi/scsi.h>

struct scsi_pkt *prefix_tran_setup_pkt(struct scsi_pkt *pkt,
     int (*callback) (caddr_t), caddr_t arg);
void prefix_tran_teardown_pkt(struct scsi_pkt *pkt);
int prefix_tran_pkt_constructor(struct scsi_pkt *pkt,
     scsi_hba_tran_t *tranp, int kmflags);
void prefix_tran_pkt_destructor(struct scsi_pkt *pkt,
     struct scsi_hba_tran_t *tranp);

Interface Level

Solaris architecture specific (Solaris DDI).

Parameters

pkt

Pointer to the scsi_pkt(9S) structure.

flags

Flags for associating DMA resources with the packet.

callback

Pointer to either NULL_FUNC or SLEEP_FUNC.

arg

Always NULL.

kmflags

Either KM_SLEEP or KM_NOSLEEP.

Description

The tran_setup_pkt() and tran_destroy_pkt() vectors in the scsi_hba_tran(9S) structure are alternatives to the tran_init_pkt() and tran_destroy_pkt() entry points. They are initialized during the HBA driver's attach(9E) and they are used when a target driver calls scsi_init_pkt(9F) and scsi_destroy_pkt(9F).

tran_setup_pkt( )

The tran_setup_pkt() vector is the entry point into the HBA which is used to initialize HBA specific information in a scsi_pkt structure on behalf of a SCSI target driver. All fields documented in scsi_pkt(9S) are initialized.

If the HBA driver chose not to preallocate memory for pkt_cdbp and/or pkt_scbp, it must allocate the requested memory at this time and point pkt_cdbp and pkt_scbp to the allocated memory.

An HBA driver which provides a tran_setup_pkt entry point inspects the pkt_numcookies and pkt_cookies fields at tran_start time to set up the transfer. If pkt_numcookies is zero, there are no DMA resources associated with this packet. If pkt_numcookies is not zero, it indicates the number of DMA cookies that pkt_cookies points to.

The pkt_tgtlen field contains the length of the packet private area pointed to by pkt_private, allocated on behalf of the SCSI target driver.

The pkt_scblen field contains the length of the SCSI status completion block pointed to by pkt_scbp. If the status length is greater than or equal to sizeof (struct scsi_arq_status) and the auto_rqsensecapability has been set, automatic request sense (ARS) is enabled for this packet. If the status lengthislessthansizeof (struct scsi_arq_status), automatic request sense should be disabled for this pkt if the HBA driver is capable of disabling ARQ on a per-packet basis.

The pkt_cdblen field contains the length of the SCSI command descriptor block.

The callback argument indicates what the allocator routines should do when resources are not available:

NULL_FUNC

Do not wait for resources. Return a NULL pointer.

SLEEP_FUNC

Wait indefinitely for resources.

tran_teardown_pkt( )

The tran_teardown_pkt() is the entry point into the HBA that must free all of the resources that were allocated to the scsi_pkt(9S) structure during tran_setup_pkt().

tran_pkt_constructor( ) tran_pkt_destructor( )

When using tran_pkt_setup() and tran_pkt_teardown(), tran_pkt_constructor() and tran_pkt_destructor() are additional optional entry points that perform the actions of a constructor and destructor. The constructor is called after the following fields in the scsi_pkt structure have been initialized:

Allocating and freeing a DMA handle are examples of something that could be done in the constructor and destructor. See kmem_cache_create(9F) for additional restrictions on what actions can be performed in a constructor and destructor.

HBA drivers that implement tran_setup_pkt() must signal scsi_pkt(9S) completion by calling scsi_hba_pkt_comp(9F). Direct use of the scsi_pkt pkt_comp field is not permitted and results in undefined behavior.

Return Values

tran_setup_pkt() must return zero on success, and -1 on failure.

See Also

attach(9E), tran_sync_pkt(9E), bioerror(9F), ddi_dma_buf_bind_handle(9F), kmem_cache_create(9F), scsi_alloc_consistent_buf(9F), scsi_destroy_pkt(9F), scsi_hba_attach(9F), scsi_hba_pkt_alloc(9F), scsi_hba_pkt_comp(9F), scsi_hba_pkt_free(9F), scsi_init_pkt(9F), buf(9S), scsi_address(9S), scsi_hba_tran(9S), scsi_pkt(9S)

Writing Device Drivers