ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference

 


IOFireWireSBP2LibLoginInterface

Declared In:

Overview

Supplies the login maintenance and Normal Command ORB execution portions of the API.

Discussion

Supplies APIs for login maintenance and command execution. Drivers can use this object to create IOFireWireSBP2LibORBInterface objects and execute them. Solicited and unsolicited status callback routines can be registered and the SBP2 services will notify the driver when the appropriate status arrives. This class also handles login maintenance. Supplies APIs for logging in and logging out and attempts to reconnect to the LUN after bus resets. The base FireWire services deliver bus reset notification via the IOKit message routine. The SBP2 services build on this behavior and deliver reconnectFailed and reconnectComplete through the message routine as well.



Functions

createORB

Creates a new IOFireWireSBP2ORB for this login.

enableUnsolicitedStatus

Enables unsolicited status.

getLoginID

Returns the current login ID.

getMaxCommandBlockSize

Returns the maximum command block size.

getRefCon

Returns the refCon set with setRefCon.

ringDoorbell

Rings the doorbell on the LUN.

setBusyTimeoutRegisterValue

Sets the value to be written to the BUSY_TIMEOUT register.

setFetchAgentResetCallback

Sets the callback to be called when a fetch agent reset completes.

setFetchAgentWriteCallback

Sets the callback to be called when the fetch agent write completes.

setLoginCallback

Sets the callback to be called when a login attempt is complete.

setLoginFlags

Sets login configuration flags.

setLogoutCallback

Sets the callback to be called when a logout attempt is complete.

setMaxPayloadSize

Sets the maximum data transfer length for a normal command ORB.

setPassword

Sets the login password.

setReconnectTime

Sets the desired reconnect duration.

setRefCon

Sets the login refCon.

setStatusNotify

Sets the callback to be called on normal command status.

setUnsolicitedStatusNotify

Sets the callback to be called on normal command status.

submitFetchAgentReset

Resets the LUN's fetch agent.

submitLogin

Attempts to login to the LUN.

submitLogout

Attempts to logout of the LUN.

submitORB

Submits the given orb


createORB


Creates a new IOFireWireSBP2ORB for this login.

IUnknownVTbl** ( *createORB)(
    void *self,
    REFIID iid );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

iid

UUID for the desired type of IOFireWireSBP2LibLoginInterface.

Return Value

Returns a pointer to the new ORB object.

Discussion

Create a new IOFireWireSBP2ORB for this login. It can be configured with it's accessors and executed with submitORB below.


enableUnsolicitedStatus


Enables unsolicited status.

IOReturn ( *enableUnsolicitedStatus)(
    void *self );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

Return Value

Returns kIOReturnSuccess if the status enable write started successfully.

Discussion

After unsolicited is sent the device will not send any additional unsolicited status until a specific register is written. This serves as a sort of flow-control for unsolicited status. After unsolicited status is recieved and processed drivers will want to reenable the delivery of unsolicted status by a call to this method.


getLoginID


Returns the current login ID.

UInt32 ( *getLoginID)(
    void *self);  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

Return Value

Returns a UInt32 containing the current login ID.

Discussion

When we successfully login to a device. The device gives us a unique login id. This is used internally for reconnecting to the device after bus resets and for certain other management ORBs. Most drivers are probably not interested in this value.


getMaxCommandBlockSize


Returns the maximum command block size.

UInt32 ( *getMaxCommandBlockSize)(
    void *self);  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

Return Value

Returns a UInt32 containing the maximum command block size.

Discussion

The device publishes an upper limit on the size of command block that it can accept. That value can be accessed via this method.


getRefCon


Returns the refCon set with setRefCon.

void * ( *getRefCon)(
    void *self);  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

Return Value

Returns the previously stored user defined value.

Discussion

Returns the user defined value previously stored in the login with setRefCon.


ringDoorbell


Rings the doorbell on the LUN.

IOReturn ( *ringDoorbell)(
    void *self );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

Return Value

Returns kIOReturnSuccess if the ring started successfully.

Discussion

Non-immediate appends to the ORB chain may require the fetch agent state machine to be notified of the new ORB's presence. This is accomplished by writing to the so called doorbell register. This method begins one of those writes.


setBusyTimeoutRegisterValue


Sets the value to be written to the BUSY_TIMEOUT register.

IOReturn ( *setBusyTimeoutRegisterValue)(
    void *self,
    UInt32 timeout );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

timeout

desired value of the BUSY_TIMEOUT register.

Discussion

1394-1995 defines a register known as the BUSY_TIMEOUT register. This register controls the busy retry behavior of your device. The initial value for this register is 0x00000000. Which means busied transactions will not be retried. Since most devices want their transactions retired on busy acks, the SBP2 service automatically updates the BUSY_TIMEOUT register with the value specified here whenever necessary. Most drivers should set this value to 0x0000000f.


setFetchAgentResetCallback


Sets the callback to be called when a fetch agent reset completes.

void ( *setFetchAgentResetCallback)(
    void *self,
    void *refCon,
    IOFWSBP2StatusCallback callback );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

refCon

refCon passed to callback.

callback

address of callback method of type FWSBP2FetchAgentWriteCallback.

Discussion

The fetch agent state machine on the device can be reset by a write to a specific register. The SBP2 services offer a utility method to reset the fetch agent. You can register a callback routine here to be notified when this rest write completes.


setFetchAgentWriteCallback


Sets the callback to be called when the fetch agent write completes.

void ( *setFetchAgentWriteCallback)(
    void *self,
    void *refCon,
    IOFWSBP2FetchAgentWriteCallback callback );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

refCon

refCon passed to callback.

callback

address of callback method of type FWSBP2FetchAgentWriteCallback.

Discussion

When an immediate orb is executed with submitORB, it's address is written to a specific address on the device. This address is called the fetch agent. The device the reads that orb from the Mac's memory and executes it. With this call you can register to be called back when this write to the fetch agent completes. The SBP2 services guarantee that the fetch agent write will be complete before status is reported for an ORB, so for most drivers this notification is not required.


setLoginCallback


Sets the callback to be called when a login attempt is complete.

void ( *setLoginCallback)(
    void *self,
    void *refCon,
    IOFWSBP2LoginCallback callback );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

refCon

refCon passed to callback.

callback

address of callback method of type FWSBP2LoginCallback.

Discussion

The supplied callback is called when a login attempt has completed. "status" in the callback's params should be checked to determine the success or failure of the login attempt. The "refCon" field in the params will return the refcon set with setRefCon. If "statusBlock" is non-null then login status was written and it has been supplied here. If the login attempt was successful then the login response will be supplied in the "loginResponse" buffer. Note: all buffers supplied to callbacks are only valid for the duration of the callback. Also, you are not to modify the contents of any supplied buffer.


setLoginFlags


Sets login configuration flags.

void ( *setLoginFlags)(
    void *self,
    UInt32 flags );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

loginFlags

the login configuration flags.

Discussion

Configures the login behavior according to the provided flags. Currently two flags are defined for this API. kFWSBP2ExclusiveLogin sets the exclusive login bit in the login ORB. kFWSBP2DontSynchronizeMgmtAgent allows simultaneous logins or reconnects to LUNs with a common management agent (ie LUNs in the same unit directory).


setLogoutCallback


Sets the callback to be called when a logout attempt is complete.

void ( *setLogoutCallback)(
    void *self,
    void *refCon,
    IOFWSBP2LogoutCallback callback );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

refCon

refCon passed to callback.

callback

address of callback method of type FWSBP2LogoutCallback.

Discussion

The supplied callback is called when a logout attempt has completed. "status" in the callback's params should be checked to determine the success or failure of the logout attempt. The "refCon" field in the params will return the refcon set with setRefCon. If "statusBlock" is non-null then logout status was written and it has been supplied here. Note: all buffers supplied to callbacks are only valid for the duration of the callback. Also, you are not to modify the contents of any supplied buffer.


setMaxPayloadSize


Sets the maximum data transfer length for a normal command ORB.

void ( *setMaxPayloadSize)(
    void *self,
    UInt32 size );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

reconnectTime

The desired maximum payload size in bytes.

Discussion

Sets the maximum data transfer length for a normal command ORB. This value is the maximum for all ORBs sent to this LUN. This can be trimmed further on an ORB by ORB basis, by a similar call in the IOFireWireSBP2ORB itself.


setPassword


Sets the login password.

IOReturn ( *setPassword)(
    void *self,
    void *buffer,
    UInt32 length );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

buf

a pointer to the password buffer.

len

the length in bytes of the password buffer.

Return Value

Returns kIOReturnSuccess on success.

Discussion

Sets the login password using a buffer and a length. An alternate version exists that accepts an IOMemoryDescriptor. If the password length is 8 or less the password is copied directly into the login orb. If the length is greater than 8 the buffer is referenced by address in the login ORB. In this case the buffer is not copied and should remain allocated for the duration of the login attempt.


setReconnectTime


Sets the desired reconnect duration.

void ( *setReconnectTime)(
    void *self,
    UInt32 time );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

reconnectTime

The desired reconnect timeout encoded as 2^reconnectTime seconds.

Discussion

The target and initiator arbitrate the duration of the reconnect timeout. Here the initiator specifies its desired timeout time in 2^reconnectTime seconds. After a successful login the device returns the actual timeout value it wishes to use. This value may be less than the reconnect timeout that the intiator specified if this is all that the device can support.


setRefCon


Sets the login refCon.

void ( *setRefCon)(
    void *self,
    void *refCon );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

refCon

a user defined value.

Discussion

Sets a user defined value on the login that can be retrieved later with the method getRefCon.


setStatusNotify


Sets the callback to be called on normal command status.

void ( *setStatusNotify)(
    void *self,
    void *refCon,
    IOFWSBP2NotifyCallback callback );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

refCon

refCon passed to callback.

callback

Address of callback method of type FWSBP2NotifyCallback.

Discussion

The supplied callback is called when normal command status is recieved, when a normal command times out, or when a normal command is aborted. "notificationEvent" in the callback's params will indicate what happened. It will be set to one of the following values: kFWSBP2NormalCommandReset, kFWSBP2NormalCommandStatus, or kFWSBP2NormalCommandTimeout. If the event type is kFWSBP2NormalCommandTimeout and "len" is non-zero then "message" contains the data written to the status block.


setUnsolicitedStatusNotify


Sets the callback to be called on normal command status.

void ( *setUnsolicitedStatusNotify)(
    void *self,
    void *refCon,
    IOFWSBP2NotifyCallback callback );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

refCon

refCon passed to callback.

callback

address of callback method of type FWSBP2NotifyCallback.

Discussion

The supplied callback is called when unsolicited status is recieved. "notificationEvent" in the callback's params will indicate what happened. In this case it will be set to kFWSBP2UnsolicitedStatus. If "len" is non-zero then "message" contains the data written to the status block. Note: any buffers returned by callbacks are only valid for the duration of the login and should not have their contents modified. The "refCon" field in the callback's params will return the refcon set with setRefCon.


submitFetchAgentReset


Resets the LUN's fetch agent.

IOReturn ( *submitFetchAgentReset)(
    void *self );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

Return Value

Returns kIOReturnSuccess if the reset started successfully.

Discussion

The fetch agent state machine on the device can be reset by a write to a specific register. This reset can be intiated by a call to this method. Notification of the completion of this write can be had by registering a callback with the setFetchAgentResetCallback method.


submitLogin


Attempts to login to the LUN.

IOReturn ( *submitLogin)(
    void *self );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

Return Value

Returns kIOReturnSuccess login has successlly begun.

Discussion

This call begins the login process. The login object should be configured prior to this call. If kIOReturnSuccess is returned from this call then the loginCompletion routine will be called when the login completes (successfully or unsuccesfully).


submitLogout


Attempts to logout of the LUN.

IOReturn ( *submitLogout)(
    void *self );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

Return Value

Returns kIOReturnSuccess if logout has successfully begun.

Discussion

This call begins the logout process. If kIOReturnSuccess is returned from this call then the logoutCompletion routine will be called when the logout completes (successfully or unsuccesfully).


submitORB


Submits the given orb

IOReturn ( *submitORB)(
    void *self,
    IOFireWireSBP2LibORBInterface **orb );  
Parameters
self

Pointer to IOFireWireSBP2LibLoginInterface object.

orb

The orb to be executed.

Return Value

Returns kIOReturnSuccess if the ORB has been started successfully.

Discussion

Starts execution of the given ORB. If the ORB is an immediate ORB it's addresss is written to the fetch agent. If it is a non immediate orb its address is appended to the last orb of the currently processing chain. The doorbell is not rung automatically it must be run manually with the ringDoorbell command described below.


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.

 

Last Updated: 2009-02-23