Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / drivers / scsi / isci / remote_node_context.h
index bc7914b..41580ad 100644 (file)
@@ -64,8 +64,7 @@
  *
  */
 
-#include "sci_base_state.h"
-#include "sci_base_state_machine.h"
+#include "isci.h"
 
 /**
  *
 #define SCU_HARDWARE_SUSPENSION  (0)
 #define SCI_SOFTWARE_SUSPENSION  (1)
 
-struct scic_sds_request;
-struct scic_sds_remote_device;
-struct scic_sds_remote_node_context;
+struct isci_request;
+struct isci_remote_device;
+struct sci_remote_node_context;
 
 typedef void (*scics_sds_remote_node_context_callback)(void *);
 
-typedef enum sci_status (*scic_sds_remote_node_context_operation)(
-       struct scic_sds_remote_node_context *sci_rnc,
-       scics_sds_remote_node_context_callback callback,
-       void *callback_parameter
-       );
-
-typedef enum sci_status (*scic_sds_remote_node_context_suspend_operation)(
-       struct scic_sds_remote_node_context *sci_rnc,
-       u32 suspension_type,
-       scics_sds_remote_node_context_callback callback,
-       void *callback_parameter
-       );
-
-typedef enum sci_status (*scic_sds_remote_node_context_io_request)(
-       struct scic_sds_remote_node_context *sci_rnc,
-       struct scic_sds_request *sci_req
-       );
-
-typedef enum sci_status (*scic_sds_remote_node_context_event_handler)(
-       struct scic_sds_remote_node_context *sci_rnc,
-       u32 event_code
-       );
-
-struct scic_sds_remote_node_context_handlers {
-       /**
-        * This handle is invoked to stop the RNC.  The callback is invoked when after
-        * the hardware notification that the RNC has been invalidated.
-        */
-       scic_sds_remote_node_context_operation destruct_handler;
-
-       /**
-        * This handler is invoked when there is a request to suspend  the RNC.  The
-        * callback is invoked after the hardware notification that the remote node is
-        * suspended.
-        */
-       scic_sds_remote_node_context_suspend_operation suspend_handler;
-
-       /**
-        * This handler is invoked when there is a request to resume the RNC.  The
-        * callback is invoked when after the RNC has reached the ready state.
-        */
-       scic_sds_remote_node_context_operation resume_handler;
-
-       /**
-        * This handler is invoked when there is a request to start an io request
-        * operation.
-        */
-       scic_sds_remote_node_context_io_request start_io_handler;
-
-       /**
-        * This handler is invoked when there is a request to start a task request
-        * operation.
-        */
-       scic_sds_remote_node_context_io_request start_task_handler;
-
-       /**
-        * This handler is invoked where there is an RNC event that must be processed.
-        */
-       scic_sds_remote_node_context_event_handler event_handler;
-
-};
-
 /**
  * This is the enumeration of the remote node context states.
  */
@@ -155,45 +92,45 @@ enum scis_sds_remote_node_context_states {
         * This state is the initial state for a remote node context.  On a resume
         * request the remote node context will transition to the posting state.
         */
-       SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE,
+       SCI_RNC_INITIAL,
 
        /**
         * This is a transition state that posts the RNi to the hardware. Once the RNC
         * is posted the remote node context will be made ready.
         */
-       SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE,
+       SCI_RNC_POSTING,
 
        /**
         * This is a transition state that will post an RNC invalidate to the
         * hardware.  Once the invalidate is complete the remote node context will
         * transition to the posting state.
         */
-       SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE,
+       SCI_RNC_INVALIDATING,
 
        /**
         * This is a transition state that will post an RNC resume to the hardare.
         * Once the event notification of resume complete is received the remote node
         * context will transition to the ready state.
         */
-       SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE,
+       SCI_RNC_RESUMING,
 
        /**
         * This is the state that the remote node context must be in to accept io
         * request operations.
         */
-       SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE,
+       SCI_RNC_READY,
 
        /**
         * This is the state that the remote node context transitions to when it gets
         * a TX suspend notification from the hardware.
         */
-       SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE,
+       SCI_RNC_TX_SUSPENDED,
 
        /**
         * This is the state that the remote node context transitions to when it gets
         * a TX RX suspend notification from the hardware.
         */
-       SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE,
+       SCI_RNC_TX_RX_SUSPENDED,
 
        /**
         * This state is a wait state for the remote node context that waits for a
@@ -201,10 +138,7 @@ enum scis_sds_remote_node_context_states {
         * there is a request to supend the remote node context or when there is a TC
         * completion where the remote node will be suspended by the hardware.
         */
-       SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE,
-
-       SCIC_SDS_REMOTE_NODE_CONTEXT_MAX_STATES
-
+       SCI_RNC_AWAIT_SUSPENSION
 };
 
 /**
@@ -213,19 +147,19 @@ enum scis_sds_remote_node_context_states {
  * This enumeration is used to define the end destination state for the remote
  * node context.
  */
-enum scic_sds_remote_node_context_destination_state {
+enum sci_remote_node_context_destination_state {
        SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED,
        SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY,
        SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL
 };
 
 /**
- * struct scic_sds_remote_node_context - This structure contains the data
+ * struct sci_remote_node_context - This structure contains the data
  *    associated with the remote node context object.  The remote node context
  *    (RNC) object models the the remote device information necessary to manage
  *    the silicon RNC.
  */
-struct scic_sds_remote_node_context {
+struct sci_remote_node_context {
        /**
         * This field indicates the remote node index (RNI) associated with
         * this RNC.
@@ -243,7 +177,7 @@ struct scic_sds_remote_node_context {
         * state.  This can cause an automatic resume on receiving a suspension
         * notification.
         */
-       enum scic_sds_remote_node_context_destination_state destination_state;
+       enum sci_remote_node_context_destination_state destination_state;
 
        /**
         * This field contains the callback function that the user requested to be
@@ -260,37 +194,31 @@ struct scic_sds_remote_node_context {
        /**
         * This field contains the data for the object's state machine.
         */
-       struct sci_base_state_machine state_machine;
-
-       struct scic_sds_remote_node_context_handlers *state_handlers;
+       struct sci_base_state_machine sm;
 };
 
-void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context *rnc,
+void sci_remote_node_context_construct(struct sci_remote_node_context *rnc,
                                            u16 remote_node_index);
 
 
-bool scic_sds_remote_node_context_is_ready(
-       struct scic_sds_remote_node_context *sci_rnc);
-
-#define scic_sds_remote_node_context_get_remote_node_index(rcn)        \
-       ((rnc)->remote_node_index)
-
-#define scic_sds_remote_node_context_event_handler(rnc, event_code) \
-       ((rnc)->state_handlers->event_handler(rnc, event_code))
-
-#define scic_sds_remote_node_context_resume(rnc, callback, parameter) \
-       ((rnc)->state_handlers->resume_handler(rnc, callback, parameter))
-
-#define scic_sds_remote_node_context_suspend(rnc, suspend_type, callback, parameter) \
-       ((rnc)->state_handlers->suspend_handler(rnc, suspend_type, callback, parameter))
-
-#define scic_sds_remote_node_context_destruct(rnc, callback, parameter)        \
-       ((rnc)->state_handlers->destruct_handler(rnc, callback, parameter))
-
-#define scic_sds_remote_node_context_start_io(rnc, request) \
-       ((rnc)->state_handlers->start_io_handler(rnc, request))
-
-#define scic_sds_remote_node_context_start_task(rnc, task) \
-       ((rnc)->state_handlers->start_task_handler(rnc, task))
+bool sci_remote_node_context_is_ready(
+       struct sci_remote_node_context *sci_rnc);
+
+enum sci_status sci_remote_node_context_event_handler(struct sci_remote_node_context *sci_rnc,
+                                                          u32 event_code);
+enum sci_status sci_remote_node_context_destruct(struct sci_remote_node_context *sci_rnc,
+                                                     scics_sds_remote_node_context_callback callback,
+                                                     void *callback_parameter);
+enum sci_status sci_remote_node_context_suspend(struct sci_remote_node_context *sci_rnc,
+                                                    u32 suspend_type,
+                                                    scics_sds_remote_node_context_callback cb_fn,
+                                                    void *cb_p);
+enum sci_status sci_remote_node_context_resume(struct sci_remote_node_context *sci_rnc,
+                                                   scics_sds_remote_node_context_callback cb_fn,
+                                                   void *cb_p);
+enum sci_status sci_remote_node_context_start_task(struct sci_remote_node_context *sci_rnc,
+                                                       struct isci_request *ireq);
+enum sci_status sci_remote_node_context_start_io(struct sci_remote_node_context *sci_rnc,
+                                                     struct isci_request *ireq);
 
 #endif  /* _SCIC_SDS_REMOTE_NODE_CONTEXT_H_ */