Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_hal.c File Reference
#include "ocs.h"
#include "ocs_os.h"
#include "ocs_hal.h"
#include "ocs_hal_queues.h"
#include "ocs_ras.h"

Go to the source code of this file.

Detailed Description

Defines and implements the Hardware Abstraction Layer (HAL). All interaction with the hardware is performed through the HAL, which abstracts the details of the underlying SLI-4 implementation.

Definition in file ocs_hal.c.

Data Structures

struct  ocs_hal_fw_write_cb_arg_t
 
struct  ocs_hal_sfp_cb_arg_t
 
struct  ocs_hal_temp_cb_arg_t
 
struct  ocs_hal_link_stat_cb_arg_t
 
struct  ocs_hal_host_stat_cb_arg_t
 
struct  ocs_hal_parity_stat_cb_arg_t
 
struct  ocs_hal_dump_get_cb_arg_t
 
struct  ocs_hal_dump_clear_cb_arg_t
 
struct  ocs_hal_fw_dump_location_results_t
 
struct  ocs_hal_linkcfg_map_t
 HAL link configuration enum to the CLP string value mapping. More...
 
struct  ocs_hal_skyhawk_linkcfg_map_t
 HAL link configuration enum to Skyhawk link config ID mapping. More...
 
struct  ocs_hal_linkcfg_cb_arg_t
 Link configuration callback argument. More...
 
struct  ocs_hal_clp_cb_arg_t
 Callback argument structure for the DMTF CLP commands. More...
 
struct  ocs_hal_get_port_protocol_cb_arg_t
 
struct  ocs_hal_set_port_protocol_cb_arg_t
 
struct  ocs_hal_get_profile_list_cb_arg_t
 
struct  ocs_hal_get_active_profile_cb_arg_t
 
struct  ocs_hal_get_nvparms_cb_arg_t
 
struct  ocs_hal_set_nvparms_cb_arg_t
 
struct  ocs_hal_set_active_profile_cb_arg_t
 
struct  ocs_hal_async_call_ctx_t
 HAL async call context structure. More...
 

Macros

#define OCS_HAL_READ_FCF_SIZE   4096
 
#define OCS_HAL_DEFAULT_AUTO_XFER_RDY_IOS   256
 
#define OCS_HAL_WQ_TIMER_PERIOD_MS   500
 
#define OCS_HAL_TOW_BLK_SIZE_DEFAULT   0 /* 512 bytes */
 
#define OCS_HAL_TOW_REF_TAG_LBA_DEFAULT   TRUE
 
#define OCS_HAL_TOW_APP_TAG_VALID_DEFAULT   FALSE
 
#define OCS_HAL_TOW_APP_TAG_VALUE_DEFAULT   0
 
#define OCS_HAL_REQUE_XRI_REGTAG   65534
 
#define OCS_HAL_DMTF_CLP_CMD_MAX   256
 
#define OCS_HAL_DMTF_CLP_RSP_MAX   256
 
#define OCS_TARGET_WRITE_SKIPS   2
 
#define OCS_TARGET_READ_SKIPS   2
 

Typedefs

typedef void(* ocs_hal_dmtf_clp_cb_t )(ocs_hal_t *hal, int32_t status, uint32_t result_len, void *arg)
 

Functions

static void ocs_hal_queue_hash_add (ocs_queue_hash_t *hash, uint16_t id, uint16_t index)
 Update the queue hash with the ID and index. More...
 
static void ocs_hal_adjust_wqs (ocs_hal_t *hal)
 Adjust the number of WQs and CQs within the HAL. More...
 
static uint32_t ocs_hal_get_num_chutes (ocs_hal_t *hal)
 Determine the number of chutes on the device. More...
 
static int32_t ocs_hal_cb_link (void *ctx, void *e)
 Callback function for the SLI link events. More...
 
static int32_t ocs_hal_cb_fip (void *, void *)
 
static int32_t ocs_hal_command_process (ocs_hal_t *, int32_t, uint8_t *, size_t)
 
static int32_t ocs_hal_mq_process (ocs_hal_t *hal, int32_t status, sli4_queue_t *mq)
 Process entries on the given mailbox queue. More...
 
static int32_t ocs_hal_cb_read_fcf (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Callback function for the FCOE_READ_FCF_TABLE command. More...
 
static int32_t ocs_hal_cb_node_attach (ocs_hal_t *, int32_t, uint8_t *, void *)
 
static int32_t ocs_hal_cb_node_free (ocs_hal_t *, int32_t, uint8_t *, void *)
 
static int32_t ocs_hal_cb_unreg_rpi_all (ocs_hal_t *, int32_t, uint8_t *, void *)
 
static ocs_hal_rtn_e ocs_hal_setup_io (ocs_hal_t *hal)
 Initialize the pool of HAL IO objects. More...
 
static ocs_hal_rtn_e ocs_hal_init_io (ocs_hal_t *)
 
static int32_t ocs_hal_command_cancel (ocs_hal_t *)
 
static void ocs_hal_io_quarantine (ocs_hal_t *hal, hal_wq_t *wq, ocs_hal_io_t *io)
 Quaratine an IO by taking a reference count and adding it to the quarantine list. When the IO is popped from the list then the count is released and the IO MAY be freed depending on whether it is still referenced by the IO. More...
 
static void ocs_hal_io_restore_sgl (ocs_hal_t *, ocs_hal_io_t *)
 
static int32_t ocs_hal_io_ini_sge (ocs_hal_t *, ocs_hal_io_t *, ocs_dma_t *, uint32_t, ocs_dma_t *)
 
static ocs_hal_rtn_e ocs_hal_firmware_write_lancer (ocs_hal_t *hal, ocs_dma_t *dma, uint32_t size, uint32_t offset, int last, ocs_hal_fw_cb_t cb, void *arg)
 Write a portion of a firmware image to the Emulex XE201 ASIC (Lancer). More...
 
static int32_t ocs_hal_cb_fw_write (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the WRITE OBJECT command completes. More...
 
static int32_t ocs_hal_cb_sfp (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the READ_TRANSCEIVER_DATA command completes. More...
 
static int32_t ocs_hal_cb_temp (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the DUMP command completes. More...
 
static int32_t ocs_hal_cb_link_stat (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the READ_LINK_STAT command completes. More...
 
static int32_t ocs_hal_cb_host_stat (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the READ_STATUS command completes. More...
 
static void ocs_hal_dmtf_clp_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the DMTF CLP command completes. More...
 
static int32_t ocs_hal_clp_resp_get_value (ocs_hal_t *hal, const char *keyword, char *value, uint32_t value_len, const char *resp, uint32_t resp_len)
 Parse the CLP result and get the value corresponding to the given keyword. More...
 
static ocs_hal_rtn_e ocs_hal_exec_dmtf_clp_cmd (ocs_hal_t *hal, ocs_dma_t *dma_cmd, ocs_dma_t *dma_resp, uint32_t opts, ocs_hal_dmtf_clp_cb_t cb, void *arg)
 Execute the DMTF CLP command. More...
 
static void ocs_hal_linkcfg_dmtf_clp_cb (ocs_hal_t *hal, int32_t status, uint32_t result_len, void *arg)
 Get the link configuration callback. More...
 
static int32_t __ocs_read_topology_cb (ocs_hal_t *, int32_t, uint8_t *, void *)
 
static int32_t __ocs_read_fec_cb (ocs_hal_t *, int32_t, uint8_t *, void *)
 
static void __ocs_hal_read_lmt_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 callback function to read link module type More...
 
static ocs_hal_rtn_e ocs_hal_get_linkcfg (ocs_hal_t *hal, uint32_t opts, ocs_hal_port_control_cb_t cb, void *arg)
 Get link configuration. More...
 
static ocs_hal_rtn_e ocs_hal_get_linkcfg_lancer (ocs_hal_t *hal, uint32_t opts, ocs_hal_port_control_cb_t cb, void *arg)
 Get link configuration for a Lancer. More...
 
static ocs_hal_rtn_e ocs_hal_get_linkcfg_skyhawk (ocs_hal_t *hal, uint32_t opts, ocs_hal_port_control_cb_t cb, void *arg)
 Get link configuration for a Skyhawk. More...
 
static ocs_hal_rtn_e ocs_hal_set_linkcfg (ocs_hal_t *hal, ocs_hal_linkcfg_e value, uint32_t opts, ocs_hal_port_control_cb_t cb, void *arg)
 Set link configuration. More...
 
static ocs_hal_rtn_e ocs_hal_set_linkcfg_lancer (ocs_hal_t *hal, ocs_hal_linkcfg_e value, uint32_t opts, ocs_hal_port_control_cb_t cb, void *arg)
 Set link configuration for Lancer. More...
 
static ocs_hal_rtn_e ocs_hal_set_linkcfg_skyhawk (ocs_hal_t *hal, ocs_hal_linkcfg_e value, uint32_t opts, ocs_hal_port_control_cb_t cb, void *arg)
 Set link configuration for a Skyhawk. More...
 
static void ocs_hal_init_linkcfg_cb (int32_t status, uintptr_t value, void *arg)
 Callback function for getting linkcfg during HAL initialization. More...
 
static ocs_hal_rtn_e ocs_hal_set_eth_license (ocs_hal_t *hal, uint32_t license)
 Set the Ethernet license. More...
 
static ocs_hal_rtn_e ocs_hal_set_dif_seed (ocs_hal_t *hal)
 Sets the DIF seed value. More...
 
static ocs_hal_rtn_e ocs_hal_set_dif_mode (ocs_hal_t *hal)
 Sets the DIF mode value. More...
 
static void ocs_hal_io_free_internal (void *arg)
 Free a previously-allocated HAL IO object. Called when IO refcount goes to zero (host-owned IOs only). More...
 
static void ocs_hal_io_free_port_owned (void *arg)
 Free a HAL IO object associated with a port-owned XRI. More...
 
static ocs_hal_rtn_e ocs_hal_config_axr_t10pi (ocs_hal_t *hal)
 Set configuration parameters for AXR T10 PI feature. More...
 
static ocs_hal_rtn_e ocs_hal_config_tow_t10pi (ocs_hal_t *hal)
 Set configuration parameters for TOW T10 PI feature. More...
 
static ocs_hal_rtn_e ocs_hal_config_set_fdt_xfer_hint (ocs_hal_t *hal, uint32_t fdt_xfer_hint)
 Set FTD transfer hint feature. More...
 
static void ocs_hal_wq_process_abort (void *arg, uint8_t *cqe, int32_t status)
 Process WQ completions for abort requests. More...
 
static int32_t ocs_hal_config_mrq (ocs_hal_t *hal, uint8_t mode, uint16_t vlanid, uint16_t fcf_index)
 Configure Multi-RQ. More...
 
static ocs_hal_rtn_e ocs_hal_config_watchdog_timer (ocs_hal_t *hal)
 Set configuration parameters for watchdog timer feature. More...
 
static ocs_hal_rtn_e ocs_hal_config_sli_port_health_check (ocs_hal_t *hal, uint8_t query, uint8_t enable)
 enable sli port health check More...
 
static ocs_hal_rtn_e ocs_hal_config_fec (ocs_hal_t *hal, uint8_t enable)
 configure fec (enable/disable) on physical port More...
 
static ocs_hal_rtn_e ocs_hal_config_fw_ag_rsp (ocs_hal_t *hal, uint8_t enable)
 Enable/disable firmware path to send auto-good response. More...
 
static ocs_hal_rtn_e ocs_hal_config_sliport_pause (ocs_hal_t *hal, uint8_t enable)
 
static int32_t ocs_hal_domain_add (ocs_hal_t *, ocs_domain_t *)
 
static int32_t ocs_hal_domain_del (ocs_hal_t *, ocs_domain_t *)
 
static void * __ocs_hal_port_alloc_init (ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 
static void * __ocs_hal_port_alloc_read_sparm64 (ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 
static void * __ocs_hal_port_alloc_init_vpi (ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 
static void * __ocs_hal_port_done (ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 
static void * __ocs_hal_port_free_unreg_vpi (ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 
static void * __ocs_hal_domain_init (ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 
static void * __ocs_hal_domain_alloc_reg_fcfi (ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 
static void * __ocs_hal_domain_alloc_init_vfi (ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 
static void * __ocs_hal_domain_free_unreg_vfi (ocs_sm_ctx_t *, ocs_sm_event_t, void *)
 
static void * __ocs_hal_domain_free_unreg_fcfi (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static int32_t __ocs_hal_domain_cb (ocs_hal_t *, int32_t, uint8_t *, void *)
 
static int32_t __ocs_hal_port_cb (ocs_hal_t *, int32_t, uint8_t *, void *)
 
static int32_t __ocs_hal_port_realloc_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 
static void ocs_hal_check_sec_hio_list (ocs_hal_t *hal)
 Check to see if there are any BZ 161832 workaround waiting IOs. More...
 
static void target_wqe_timer_cb (void *arg)
 
static void shutdown_target_wqe_timer (ocs_hal_t *hal)
 
static ocs_hal_rtn_e ocs_hal_config_fw_diagnostic_logging (ocs_hal_t *hal, int32_t log_size, int32_t log_level)
 Set configuration parameters for adapter firmware diagnostic logging (RAS) feature. More...
 
static ocs_hal_rtn_e ocs_hal_teardown_fw_diagnostic_logging (ocs_hal_t *hal)
 If required disable firmware diagnostic logging (RAS) and then free resources. More...
 
static void ocs_hal_log_sli4_rsp_hdr (ocs_hal_t *hal, sli4_res_hdr_t *hdr)
 
static ocs_hal_rtn_e ocs_hal_init_tow_esoc (ocs_hal_t *hal, uint32_t tow_feature)
 
static ocs_hal_rtn_e ocs_hal_init_tow (ocs_hal_t *hal, uint32_t tow_feature)
 
static ocs_hal_rtn_e ocs_hal_init_tow_t10pi (ocs_hal_t *hal)
 
static ocs_hal_rtn_e ocs_hal_init_tow_feature (ocs_hal_t *hal)
 Initialize TOW feature for AXR/FB. More...
 
static void ocs_hal_add_io_timed_wqe (ocs_hal_t *hal, ocs_hal_io_t *io)
 
static void ocs_hal_remove_io_timed_wqe (ocs_hal_t *hal, ocs_hal_io_t *io)
 
static uint8_t ocs_hal_iotype_is_originator (uint16_t io_type)
 
static uint8_t ocs_hal_wcqe_abort_needed (uint16_t status, uint8_t ext, uint8_t xb)
 
static ocs_hal_rtn_e ocs_hal_link_event_init (ocs_hal_t *hal)
 
static ocs_hal_rtn_e ocs_hal_read_max_dump_size (ocs_hal_t *hal)
 Read the max dump size for this port. More...
 
static void ocs_hal_sli_queue_free (ocs_hal_t *hal)
 
static ocs_hal_rtn_e ocs_hal_sli_queue_alloc (ocs_hal_t *hal)
 
static void ocs_hal_queue_hash_free (ocs_hal_t *hal)
 
static ocs_hal_rtn_e ocs_hal_queue_hash_alloc (ocs_hal_t *hal)
 
ocs_hal_rtn_e ocs_hal_setup (ocs_hal_t *hal, ocs_os_handle_t os, sli4_port_type_e port_type)
 Set up the Hardware Abstraction Layer module. More...
 
ocs_hal_rtn_e ocs_hal_init (ocs_hal_t *hal)
 Allocate memory structures to prepare for the device operation. More...
 
ocs_hal_rtn_e ocs_hal_teardown (ocs_hal_t *hal)
 Tear down the Hardware Abstraction Layer module. More...
 
static ocs_hal_rtn_e ocs_hal_sli_reset (ocs_hal_t *hal, ocs_hal_reset_e reset, ocs_hal_state_e prev_state)
 
ocs_hal_rtn_e ocs_hal_port_migration (ocs_hal_t *hal)
 
ocs_hal_rtn_e ocs_hal_reset (ocs_hal_t *hal, ocs_hal_reset_e reset)
 
int32_t ocs_hal_get_num_eq (ocs_hal_t *hal)
 
static int32_t ocs_hal_get_fw_timed_out (ocs_hal_t *hal)
 
ocs_hal_rtn_e ocs_hal_get (ocs_hal_t *hal, ocs_hal_property_e prop, uint32_t *value)
 
void * ocs_hal_get_ptr (ocs_hal_t *hal, ocs_hal_property_e prop)
 
ocs_hal_rtn_e ocs_hal_set (ocs_hal_t *hal, ocs_hal_property_e prop, uint32_t value)
 
ocs_hal_rtn_e ocs_hal_set_ptr (ocs_hal_t *hal, ocs_hal_property_e prop, void *value)
 
int32_t ocs_hal_event_check (ocs_hal_t *hal, uint32_t vector)
 Check for the events associated with the interrupt vector. More...
 
void ocs_hal_unsol_process_bounce (void *arg)
 
int32_t ocs_hal_process (ocs_hal_t *hal, uint32_t vector, uint32_t max_isr_time_msec)
 
int32_t ocs_hal_eq_process (ocs_hal_t *hal, hal_eq_t *eq, uint32_t max_isr_time_msec)
 Process events associated with an EQ. More...
 
static ocs_hal_rtn_e ocs_hal_bmbx_command (ocs_hal_t *hal, uint8_t *cmd)
 
static int32_t ocs_hal_cmd_submit_pending (ocs_hal_t *hal)
 Submit queued (pending) mbx commands. More...
 
ocs_hal_rtn_e ocs_hal_command (ocs_hal_t *hal, uint8_t *cmd, uint32_t opts, void *cb, void *arg)
 Issue a SLI command. More...
 
ocs_hal_rtn_e ocs_hal_callback (ocs_hal_t *hal, ocs_hal_callback_e which, void *func, void *arg)
 Register a callback for the given event. More...
 
ocs_hal_rtn_e ocs_hal_port_alloc (ocs_hal_t *hal, ocs_sli_port_t *sport, ocs_domain_t *domain, uint8_t *wwpn)
 Allocate a port object. More...
 
ocs_hal_rtn_e ocs_hal_port_attach (ocs_hal_t *hal, ocs_sli_port_t *sport, uint32_t fc_id)
 Attach a physical/virtual SLI port to a domain. More...
 
static int32_t ocs_hal_cb_port_control (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the port control command completes. More...
 
ocs_hal_rtn_e ocs_hal_port_control (ocs_hal_t *hal, ocs_hal_port_e ctrl, uintptr_t value, ocs_hal_port_control_cb_t cb, void *arg)
 Control a port (initialize, shutdown, or set link configuration). More...
 
ocs_hal_rtn_e ocs_hal_port_free (ocs_hal_t *hal, ocs_sli_port_t *sport)
 Free port resources. More...
 
ocs_hal_rtn_e ocs_hal_domain_alloc (ocs_hal_t *hal, ocs_domain_t *domain, uint32_t fcf, uint32_t vlan)
 Allocate a fabric domain object. More...
 
ocs_hal_rtn_e ocs_hal_domain_attach (ocs_hal_t *hal, ocs_domain_t *domain, uint32_t fc_id)
 Attach a SLI port to a domain. More...
 
ocs_hal_rtn_e ocs_hal_domain_free (ocs_hal_t *hal, ocs_domain_t *domain)
 Free a fabric domain object. More...
 
ocs_hal_rtn_e ocs_hal_domain_force_free (ocs_hal_t *hal, ocs_domain_t *domain)
 Free a fabric domain object. More...
 
ocs_hal_rtn_e ocs_hal_node_alloc (ocs_hal_t *hal, ocs_remote_node_t *rnode, uint32_t fc_addr, ocs_sli_port_t *sport)
 Allocate a remote node object. More...
 
ocs_hal_rtn_e ocs_hal_node_attach (ocs_hal_t *hal, ocs_remote_node_t *rnode, ocs_dma_t *sparms)
 Update a remote node object with the remote port's service parameters. More...
 
ocs_hal_rtn_e ocs_hal_node_free_resources (ocs_hal_t *hal, ocs_remote_node_t *rnode)
 Free a remote node resource. More...
 
ocs_hal_rtn_e ocs_hal_node_detach (ocs_hal_t *hal, ocs_remote_node_t *rnode)
 Free a remote node object. More...
 
ocs_hal_rtn_e ocs_hal_unreg_rpi_all (ocs_hal_t *hal, ocs_sport_t *sport)
 Free all remote node objects. More...
 
ocs_hal_rtn_e ocs_hal_node_group_alloc (ocs_hal_t *hal, ocs_remote_node_group_t *ngroup)
 
ocs_hal_rtn_e ocs_hal_node_group_attach (ocs_hal_t *hal, ocs_remote_node_group_t *ngroup, ocs_remote_node_t *rnode)
 
ocs_hal_rtn_e ocs_hal_node_group_free (ocs_hal_t *hal, ocs_remote_node_group_t *ngroup)
 
static void ocs_hal_init_free_io (ocs_hal_io_t *io)
 Initialize IO fields on each free call. More...
 
static ocs_hal_io_t * _ocs_hal_io_alloc (ocs_hal_t *hal)
 Lockless allocate a HAL IO object. More...
 
ocs_hal_io_t * ocs_hal_io_alloc (ocs_hal_t *hal)
 Allocate a HAL IO object. More...
 
ocs_hal_io_t * ocs_hal_io_activate_port_owned (ocs_hal_t *hal, ocs_hal_io_t *io)
 Allocate/Activate a port owned HAL IO object. More...
 
static void ocs_hal_io_free_move_correct_list (ocs_hal_t *hal, ocs_hal_io_t *io)
 When an IO is freed, depending on the exchange busy flag, and other workarounds, move it to the correct list. More...
 
static void ocs_hal_io_free_common (ocs_hal_t *hal, ocs_hal_io_t *io)
 Free a HAL IO object. Perform cleanup common to port and host-owned IOs. More...
 
int32_t ocs_hal_io_free (ocs_hal_t *hal, ocs_hal_io_t *io)
 Free a previously-allocated HAL IO object. More...
 
uint8_t ocs_hal_io_inuse (ocs_hal_t *hal, ocs_hal_io_t *io)
 Check if given HAL IO is in-use. More...
 
static int32_t _hal_wq_write (hal_wq_t *wq, ocs_hal_wqe_t *wqe)
 Write a HAL IO to a work queue. More...
 
int32_t hal_wq_write (hal_wq_t *wq, ocs_hal_wqe_t *wqe)
 Write a HAL IO to a work queue. More...
 
static void hal_wq_submit_pending (hal_wq_t *wq, uint32_t update_free_count)
 Update free count and submit any pending HAL IOs. More...
 
ocs_hal_rtn_e ocs_hal_srrs_send (ocs_hal_t *hal, ocs_hal_io_type_e type, ocs_hal_io_t *io, ocs_dma_t *send, uint32_t len, ocs_dma_t *receive, ocs_remote_node_t *rnode, ocs_hal_io_param_t *iparam, ocs_hal_srrs_cb_t cb, void *arg)
 Send a Single Request/Response Sequence (SRRS). More...
 
ocs_hal_rtn_e ocs_hal_io_send (ocs_hal_t *hal, ocs_hal_io_type_e type, ocs_hal_io_t *io, uint32_t len, ocs_hal_io_param_t *iparam, ocs_remote_node_t *rnode, void *cb, void *arg)
 Send a read, write, or response IO. More...
 
ocs_hal_rtn_e ocs_hal_send_frame (ocs_hal_t *hal, fc_header_le_t *hdr, uint8_t sof, uint8_t eof, ocs_dma_t *payload, ocs_hal_send_frame_context_t *ctx, void(*callback)(void *arg, uint8_t *cqe, int32_t status), void *arg)
 Send a raw frame. More...
 
ocs_hal_rtn_e ocs_hal_io_register_sgl (ocs_hal_t *hal, ocs_hal_io_t *io, ocs_dma_t *sgl, uint32_t sgl_count)
 
ocs_hal_rtn_e ocs_hal_io_init_sges (ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_io_type_e type)
 Initialize the scatter gather list entries of an IO. More...
 
ocs_hal_rtn_e ocs_hal_io_add_seed_sge (ocs_hal_t *hal, ocs_hal_io_t *io, ocs_hal_dif_info_t *dif_info)
 Add a T10 PI seed scatter gather list entry. More...
 
static ocs_hal_rtn_e ocs_hal_io_overflow_sgl (ocs_hal_t *hal, ocs_hal_io_t *io)
 
ocs_hal_rtn_e ocs_hal_io_add_sge (ocs_hal_t *hal, ocs_hal_io_t *io, uintptr_t addr, uint32_t length)
 Add a scatter gather list entry to an IO. More...
 
ocs_hal_rtn_e ocs_hal_io_add_dif_sge (ocs_hal_t *hal, ocs_hal_io_t *io, uintptr_t addr)
 Add a T10 DIF scatter gather list entry to an IO. More...
 
ocs_hal_rtn_e ocs_hal_io_abort (ocs_hal_t *hal, ocs_hal_io_t *io_to_abort, uint32_t send_abts, void *cb, void *arg)
 Abort a previously-started IO. More...
 
int32_t ocs_hal_io_get_xid (ocs_hal_t *hal, ocs_hal_io_t *io)
 Return the OX_ID/RX_ID of the IO. More...
 
ocs_hal_rtn_e ocs_hal_firmware_write (ocs_hal_t *hal, ocs_dma_t *dma, uint32_t size, uint32_t offset, int last, ocs_hal_fw_cb_t cb, void *arg)
 Write a portion of a firmware image to the device. More...
 
ocs_hal_rtn_e ocs_hal_get_sfp (ocs_hal_t *hal, uint16_t page, ocs_hal_sfp_cb_t cb, void *arg)
 Function to retrieve the SFP information. More...
 
ocs_hal_rtn_e ocs_hal_get_temperature (ocs_hal_t *hal, ocs_hal_temp_cb_t cb, void *arg)
 Function to retrieve the temperature information. More...
 
ocs_hal_rtn_e ocs_hal_get_link_stats (ocs_hal_t *hal, uint8_t req_ext_counters, uint8_t clear_overflow_flags, uint8_t clear_all_counters, ocs_hal_link_stat_cb_t cb, void *arg)
 Function to retrieve the link statistics. More...
 
ocs_hal_rtn_e ocs_hal_get_host_stats (ocs_hal_t *hal, uint8_t cc, ocs_hal_host_stat_cb_t cb, void *arg)
 Function to retrieve the link and host statistics. More...
 
static ocs_hal_linkcfg_e ocs_hal_linkcfg_from_clp (const char *clp_str)
 Helper function for getting the HAL linkcfg enum from the CLP string value. More...
 
static const char * ocs_hal_clp_from_linkcfg (ocs_hal_linkcfg_e linkcfg)
 Helper function for getting the CLP string value from the HAL linkcfg enum. More...
 
static uint32_t ocs_hal_config_id_from_linkcfg (ocs_hal_linkcfg_e linkcfg)
 Helper function for getting a Skyhawk link config ID from the HAL linkcfg enum. More...
 
static ocs_hal_linkcfg_e ocs_hal_linkcfg_from_config_id (const uint32_t config_id)
 Helper function for getting the HAL linkcfg enum from a Skyhawk config ID. More...
 
static void ocs_hal_set_active_link_config_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Callback for ocs_hal_set_linkcfg_skyhawk. More...
 
static void ocs_hal_get_active_link_config_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Get the link configuration callback. More...
 
static void ocs_hal_watchdog_timer_cb (void *arg)
 
static void ocs_hal_cb_cfg_watchdog (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 
static void ocs_hal_cb_itcm_parity_stats (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 
ocs_hal_rtn_e ocs_hal_get_itcm_parity_stats (ocs_hal_t *hal, bool clear_stats, ocs_hal_parity_stat_cb_t cb, void *arg)
 
static void ocs_hal_generic_mbx_command_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 
static ocs_hal_rtn_e ocs_hal_exec_mbx_command_generic_results (ocs_hal_t *hal, uint8_t *req_rsp_buf, bool handle_sli4_rsp, int timeout_usecs)
 Issue a blocking hal command that has generic response handling in callback handler. More...
 
ocs_hal_rtn_e ocs_hal_set_trunk_mode (ocs_hal_t *hal, uint32_t trunk_mode)
 Set trunking mode. More...
 
ocs_hal_rtn_e ocs_hal_get_trunk_info (ocs_hal_t *hal, uint32_t *trunk_info)
 Get trunking mode information. More...
 
int ocs_hal_stop_fw_diagnostic_logging (ocs_hal_t *hal)
 Stop firmware diagnostic logging (RAS). More...
 
static void ocs_hal_parse_pause_errx_pairs (ocs_hal_t *hal)
 
static ocs_hal_rtn_e ocs_hal_set_dump_location (ocs_hal_t *hal, uint32_t num_buffers, ocs_dma_t *dump_buffers, uint8_t fdb)
 Set the Lancer dump location. More...
 
void ocs_hal_free_dump_to_host_buffers (ocs_hal_t *hal)
 
static int32_t ocs_fw_dump_buffer_alloc (ocs_t *ocs, uint8_t dump_level)
 
static ocs_hal_rtn_e ocs_hal_alloc_set_dump_buffers (ocs_hal_t *hal, uint8_t dump_level)
 
ocs_hal_rtn_e ocs_hal_set_dump_to_host_buffers (ocs_hal_t *hal)
 Allocates dump dma buffers, if not already allocated. Set the Lancer dump location. More...
 
ocs_hal_rtn_e ocs_hal_set_loopback_mode (ocs_hal_t *hal, uint32_t type)
 Set the Lancer dump location. More...
 
ocs_hal_rtn_e ocs_hal_run_biu_diag (ocs_hal_t *hal, void *tx_buff, size_t tx_buff_len, void *rx_buff, size_t rx_buff_len)
 Run Diagnostic PCI Loopback test. More...
 
ocs_hal_rtn_e ocs_hal_clear_dump_location (ocs_hal_t *hal)
 Clear the Lancer dump location. More...
 
ocs_hal_rtn_e ocs_hal_raise_ue (ocs_hal_t *hal, uint8_t dump)
 Cause chip to enter an unrecoverable error state. More...
 
static int32_t ocs_hal_cb_dump_get (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the OBJECT_GET command completes. More...
 
ocs_hal_rtn_e ocs_hal_dump_get (ocs_hal_t *hal, ocs_dma_t *dma, uint32_t size, uint32_t offset, ocs_hal_dump_get_cb_t cb, void *arg)
 Read a dump image to the host. More...
 
static int32_t ocs_hal_cb_dump_clear (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the OBJECT_DELETE command completes. More...
 
ocs_hal_rtn_e ocs_hal_dump_clear (ocs_hal_t *hal, ocs_hal_dump_clear_cb_t cb, void *arg)
 Clear a dump image from the device. More...
 
static int32_t ocs_hal_get_port_protocol_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called for the completion of get_port_profile for a user request. More...
 
ocs_hal_rtn_e ocs_hal_get_port_protocol (ocs_hal_t *hal, uint32_t pci_func, ocs_get_port_protocol_cb_t cb, void *ul_arg)
 Get the current port protocol. More...
 
static int32_t ocs_hal_set_port_protocol_cb2 (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called for the completion of set_port_profile for a user request. More...
 
static int32_t ocs_hal_set_port_protocol_cb1 (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called for the completion of set_port_profile for a user request. More...
 
ocs_hal_rtn_e ocs_hal_set_port_protocol (ocs_hal_t *hal, ocs_hal_port_protocol_e new_protocol, uint32_t pci_func, ocs_set_port_protocol_cb_t cb, void *ul_arg)
 Set the port protocol. More...
 
static int32_t ocs_hal_get_profile_list_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called for the completion of get_profile_list for a user request. More...
 
ocs_hal_rtn_e ocs_hal_get_profile_list (ocs_hal_t *hal, ocs_get_profile_list_cb_t cb, void *ul_arg)
 Get a list of available profiles. More...
 
static int32_t ocs_hal_get_active_profile_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called for the completion of get_active_profile for a user request. More...
 
int32_t ocs_hal_get_active_profile (ocs_hal_t *hal, ocs_get_active_profile_cb_t cb, void *ul_arg)
 Get the currently active profile. More...
 
static int32_t ocs_hal_get_nvparms_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called for the completion of get_nvparms for a user request. More...
 
int32_t ocs_hal_get_nvparms (ocs_hal_t *hal, ocs_get_nvparms_cb_t cb, void *ul_arg)
 Read non-volatile parms. More...
 
static int32_t ocs_hal_set_nvparms_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called for the completion of set_nvparms for a user request. More...
 
int32_t ocs_hal_set_nvparms (ocs_hal_t *hal, ocs_set_nvparms_cb_t cb, uint8_t *wwpn, uint8_t *wwnn, uint8_t hard_alpa, uint32_t preferred_d_id, void *ul_arg)
 Write non-volatile parms. More...
 
uint32_t ocs_hal_io_get_count (ocs_hal_t *hal, ocs_hal_io_count_type_e io_count_type)
 Called to obtain the count for the specified type. More...
 
uint32_t ocs_hal_rpi_active_count (ocs_hal_t *hal)
 Called to obtain active RPI count. More...
 
uint32_t ocs_hal_get_rqes_produced_count (ocs_hal_t *hal)
 Called to obtain the count of produced RQs. More...
 
static int32_t ocs_hal_set_active_profile_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called for the completion of set_active_profile for a user request. More...
 
int32_t ocs_hal_set_active_profile (ocs_hal_t *hal, ocs_set_active_profile_cb_t cb, uint32_t profile_id, void *ul_arg)
 Set the currently active profile. More...
 
int32_t ocs_hal_queue_hash_find (ocs_queue_hash_t *hash, uint16_t id)
 Find index given queue ID. More...
 
ocs_domain_t * ocs_hal_domain_get (ocs_hal_t *hal, uint16_t fcfi)
 
static ocs_domain_t * ocs_hal_domain_get_indexed (ocs_hal_t *hal, uint16_t fcf_index)
 
void ocs_hal_cq_process (ocs_hal_t *hal, hal_cq_t *cq, uint32_t cq_process_limit)
 Process entries on the given completion queue. More...
 
void ocs_hal_wq_process (ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe, int32_t status, uint16_t rid)
 Process WQ completion queue entries. More...
 
static void ocs_hal_wq_process_io (void *arg, uint8_t *cqe, int32_t status)
 Process WQ completions for IO requests. More...
 
void ocs_hal_xabt_process (ocs_hal_t *hal, hal_cq_t *cq, uint8_t *cqe, uint16_t rid)
 Process XABT completions. More...
 
static ocs_hal_rtn_e ocs_hal_read_fcf (ocs_hal_t *hal, uint32_t index)
 Read a FCF table entry. More...
 
static int32_t ocs_hal_read_lmt (ocs_hal_t *hal)
 function to read link module type More...
 
int32_t ocs_hal_flush (ocs_hal_t *hal)
 
ocs_hal_io_t * ocs_hal_io_lookup (ocs_hal_t *hal, uint32_t xri)
 Find IO given indicator (xri). More...
 
static void ocs_hal_io_cancel_cleanup (ocs_hal_t *hal, ocs_hal_io_t *io)
 Issue any pending callbacks for an IO and remove off the timer and pending lists. More...
 
int32_t ocs_hal_io_cancel (ocs_hal_t *hal)
 
static int32_t __ocs_hal_port_common (const char *funcname, ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_port_free_report_fail (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_port_freed (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_port_attach_report_fail (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_port_free_nop (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_port_attached (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_port_attach_reg_vpi (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_port_allocated (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_port_alloc_report_fail (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static int32_t __ocs_hal_domain_common (const char *funcname, ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_domain_alloc_report_fail (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_domain_attached (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_domain_attach_report_fail (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_domain_attach_reg_vfi (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_domain_allocated (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_domain_alloc_read_sparm64 (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_domain_free_report_fail (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_domain_freed (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static void * __ocs_hal_domain_free_redisc_fcf (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *data)
 
static int32_t target_wqe_timer_nop_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 
uint8_t ocs_hal_is_io_port_owned (ocs_hal_t *hal, ocs_hal_io_t *io)
 Determine if HAL IO is owned by the port. More...
 
uint8_t ocs_hal_is_xri_port_owned (ocs_hal_t *hal, uint32_t xri)
 Return TRUE if exchange is port-owned. More...
 
static void ocs_hal_reclaim_xri (ocs_hal_t *hal, uint16_t xri_base, uint16_t xri_count)
 Returns an XRI from the port owned list to the host. More...
 
static int32_t ocs_hal_cb_post_xri (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the POST_XRI command completes. More...
 
static ocs_hal_rtn_e ocs_hal_post_xri (ocs_hal_t *hal, uint32_t xri_start, uint32_t num_to_post)
 Issues a mailbox command to move XRIs from the host-controlled pool to the port. More...
 
uint32_t ocs_hal_xri_move_to_port_owned (ocs_hal_t *hal, uint32_t num_xri)
 Move XRIs from the host-controlled pool to the port. More...
 
static int32_t ocs_hal_cb_release_xri (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 Called when the RELEASE_XRI command completes. More...
 
ocs_hal_rtn_e ocs_hal_xri_move_to_host_owned (ocs_hal_t *hal, uint8_t num_xri)
 Move XRIs from the port-controlled pool to the host. More...
 
static void ocs_hal_rx_buffer_free (ocs_hal_t *hal, ocs_hal_rq_buffer_t **rq_buf, uint32_t count)
 Free an ocs_hal_rx_buffer_t array. More...
 
static ocs_hal_rq_buffer_t ** ocs_hal_rx_buffer_alloc (ocs_hal_t *hal, uint32_t rqindex, uint32_t count, uint32_t size)
 Allocate an ocs_hal_rx_buffer_t array. More...
 
ocs_hal_rtn_e ocs_hal_rx_allocate (ocs_hal_t *hal)
 Allocate the RQ data buffers. More...
 
ocs_hal_rtn_e ocs_hal_rx_post (ocs_hal_t *hal)
 Post the RQ data buffers to the chip. More...
 
void ocs_hal_rx_free (ocs_hal_t *hal)
 Free the RQ data buffers. More...
 
static void ocs_hal_async_cb (ocs_hal_t *hal, int32_t status, uint8_t *mqe, void *arg)
 HAL async callback handler. More...
 
int32_t ocs_hal_async_call (ocs_hal_t *hal, ocs_hal_async_cb_t callback, void *arg)
 Make an async callback using NOP mailbox command. More...
 
ocs_hal_rtn_e ocs_hal_reqtag_init (ocs_hal_t *hal)
 Initialize the reqtag pool. More...
 
hal_wq_callback_t * ocs_hal_reqtag_alloc (ocs_hal_t *hal, void(*callback)(void *arg, uint8_t *cqe, int32_t status), void *arg)
 Allocate a WQ request tag. More...
 
void ocs_hal_reqtag_free (ocs_hal_t *hal, hal_wq_callback_t *wqcb)
 Free a WQ request tag. More...
 
hal_wq_callback_t * ocs_hal_reqtag_get_instance (ocs_hal_t *hal, uint32_t instance_index)
 Return WQ request tag by index. More...
 
void ocs_hal_reqtag_reset (ocs_hal_t *hal)
 Reset the WQ request tag pool. More...
 
void _ocs_hal_assert (const char *cond, const char *filename, int linenum)
 Handle HAL assertion. More...
 
void _ocs_hal_verify (const char *cond, const char *filename, int linenum)
 Handle HAL verify. More...
 
static void ocs_hal_wq_handle_bad_reque_xri (void *arg, uint8_t *cqe, int32_t status)
 
int32_t ocs_hal_reque_xri (ocs_hal_t *hal, ocs_hal_io_t *io)
 Reque XRI. More...
 
int ocs_hal_can_accept_wqes (struct ocs_hal_io_s *hio)
 Validate HAL IO state to make sure HAL can accept and post wqe to SLI. More...
 

Variables

ocs_hal_global_t hal_global
 
static ocs_hal_linkcfg_map_t linkcfg_map []
 Mapping from the HAL linkcfg enum to the CLP command value string. More...
 
static
ocs_hal_skyhawk_linkcfg_map_t 
skyhawk_linkcfg_map []
 Mapping from the HAL linkcfg enum to the Skyhawk link config IDs. More...
 

Macro Details

#define OCS_HAL_DEFAULT_AUTO_XFER_RDY_IOS   256

Definition at line 57 of file ocs_hal.c.

#define OCS_HAL_DMTF_CLP_CMD_MAX   256

Definition at line 74 of file ocs_hal.c.

#define OCS_HAL_DMTF_CLP_RSP_MAX   256

Definition at line 75 of file ocs_hal.c.

#define OCS_HAL_READ_FCF_SIZE   4096

Definition at line 56 of file ocs_hal.c.

#define OCS_HAL_REQUE_XRI_REGTAG   65534

Definition at line 71 of file ocs_hal.c.

#define OCS_HAL_TOW_APP_TAG_VALID_DEFAULT   FALSE

Definition at line 63 of file ocs_hal.c.

#define OCS_HAL_TOW_APP_TAG_VALUE_DEFAULT   0

Definition at line 64 of file ocs_hal.c.

#define OCS_HAL_TOW_BLK_SIZE_DEFAULT   0 /* 512 bytes */

Definition at line 61 of file ocs_hal.c.

#define OCS_HAL_TOW_REF_TAG_LBA_DEFAULT   TRUE

Definition at line 62 of file ocs_hal.c.

#define OCS_HAL_WQ_TIMER_PERIOD_MS   500

Definition at line 58 of file ocs_hal.c.

#define OCS_TARGET_READ_SKIPS   2
#define OCS_TARGET_WRITE_SKIPS   2

Type Details

typedef void(* ocs_hal_dmtf_clp_cb_t)(ocs_hal_t *hal, int32_t status, uint32_t result_len, void *arg)

Definition at line 105 of file ocs_hal.c.

Function Details

static void * __ocs_hal_domain_alloc_init_vfi ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12277 of file ocs_hal.c.

static void* __ocs_hal_domain_alloc_read_sparm64 ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12238 of file ocs_hal.c.

static void * __ocs_hal_domain_alloc_reg_fcfi ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12315 of file ocs_hal.c.

static void* __ocs_hal_domain_alloc_report_fail ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12047 of file ocs_hal.c.

static void* __ocs_hal_domain_allocated ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12196 of file ocs_hal.c.

static void* __ocs_hal_domain_attach_reg_vfi ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12159 of file ocs_hal.c.

static void* __ocs_hal_domain_attach_report_fail ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12118 of file ocs_hal.c.

static void* __ocs_hal_domain_attached ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12086 of file ocs_hal.c.

static int32_t __ocs_hal_domain_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 12662 of file ocs_hal.c.

static int32_t __ocs_hal_domain_common ( const char *  funcname,
ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12026 of file ocs_hal.c.

static void* __ocs_hal_domain_free_redisc_fcf ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12512 of file ocs_hal.c.

static void* __ocs_hal_domain_free_report_fail ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12434 of file ocs_hal.c.

static void * __ocs_hal_domain_free_unreg_fcfi ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12552 of file ocs_hal.c.

static void * __ocs_hal_domain_free_unreg_vfi ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12604 of file ocs_hal.c.

static void* __ocs_hal_domain_freed ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12471 of file ocs_hal.c.

static void * __ocs_hal_domain_init ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 12405 of file ocs_hal.c.

static void * __ocs_hal_port_alloc_init ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11895 of file ocs_hal.c.

static void * __ocs_hal_port_alloc_init_vpi ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11924 of file ocs_hal.c.

static void * __ocs_hal_port_alloc_read_sparm64 ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11832 of file ocs_hal.c.

static void* __ocs_hal_port_alloc_report_fail ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11794 of file ocs_hal.c.

static void* __ocs_hal_port_allocated ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11740 of file ocs_hal.c.

static void* __ocs_hal_port_attach_reg_vpi ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11674 of file ocs_hal.c.

static void* __ocs_hal_port_attach_report_fail ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11530 of file ocs_hal.c.

static void* __ocs_hal_port_attached ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11641 of file ocs_hal.c.

static int32_t __ocs_hal_port_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 11975 of file ocs_hal.c.

static int32_t __ocs_hal_port_common ( const char *  funcname,
ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11446 of file ocs_hal.c.

static void * __ocs_hal_port_done ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11712 of file ocs_hal.c.

static void* __ocs_hal_port_free_nop ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11613 of file ocs_hal.c.

static void* __ocs_hal_port_free_report_fail ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11473 of file ocs_hal.c.

static void * __ocs_hal_port_free_unreg_vpi ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11567 of file ocs_hal.c.

static void* __ocs_hal_port_freed ( ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  data 
)
static

Definition at line 11498 of file ocs_hal.c.

static int32_t __ocs_hal_port_realloc_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 11992 of file ocs_hal.c.

void __ocs_hal_read_lmt_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

callback function to read link module type

Parameters
ctxHardware context pointer
MQEcompletion status
MQEdata buffer
optionalargument
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 10638 of file ocs_hal.c.

static int32_t __ocs_read_fec_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 11361 of file ocs_hal.c.

static int32_t __ocs_read_topology_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 11374 of file ocs_hal.c.

static int32_t _hal_wq_write ( hal_wq_t *  wq,
ocs_hal_wqe_t *  wqe 
)
static

Write a HAL IO to a work queue.

Description
A HAL IO is written to a work queue.
Parameters
wqPointer to work queue.
wqePointer to WQ entry.


Note: Assumes the SLI-4 queue lock is held.

Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 4048 of file ocs_hal.c.

void _ocs_hal_assert ( const char *  cond,
const char *  filename,
int  linenum 
)

Handle HAL assertion.

HAL assert, display diagnostic message, and abort.

Parameters
condstring describing failing assertion condition
filenamefile name
linenumline number
Returns
none

Definition at line 13483 of file ocs_hal.c.

void _ocs_hal_verify ( const char *  cond,
const char *  filename,
int  linenum 
)

Handle HAL verify.

HAL verify, display diagnostic message, dump stack and return.

Parameters
condstring describing failing verify condition
filenamefile name
linenumline number
Returns
none

Definition at line 13502 of file ocs_hal.c.

static void hal_wq_submit_pending ( hal_wq_t *  wq,
uint32_t  update_free_count 
)
static

Update free count and submit any pending HAL IOs.

Description
The WQ free count is updated, and any pending HAL IOs are submitted that will fit in the queue.
Parameters
wqPointer to work queue.
update_free_countValue added to WQs free count.
Returns
None.

Definition at line 4141 of file ocs_hal.c.

int32_t hal_wq_write ( hal_wq_t *  wq,
ocs_hal_wqe_t *  wqe 
)

Write a HAL IO to a work queue.

Description
A HAL IO is written to a work queue.
Parameters
wqPointer to work queue.
wqePointer to WQE entry.


Note: Takes the SLI-4 queue lock.

Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 4092 of file ocs_hal.c.

static int32_t ocs_fw_dump_buffer_alloc ( ocs_t *  ocs,
uint8_t  dump_level 
)
static

Definition at line 7604 of file ocs_hal.c.

static void ocs_hal_add_io_timed_wqe ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)
inlinestatic

Definition at line 298 of file ocs_hal.c.

static void ocs_hal_adjust_wqs ( ocs_hal_t *  hal)
static

Adjust the number of WQs and CQs within the HAL.

Description
Calculates the number of WQs and associated CQs needed in the HAL based on the number of IOs. Calculates the starting CQ index for each WQ, RQ and MQ.
Parameters
halHardware context allocated by the caller.

Definition at line 10368 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_alloc_set_dump_buffers ( ocs_hal_t *  hal,
uint8_t  dump_level 
)
static

Definition at line 7674 of file ocs_hal.c.

int32_t ocs_hal_async_call ( ocs_hal_t *  hal,
ocs_hal_async_cb_t  callback,
void *  arg 
)

Make an async callback using NOP mailbox command.

Description
Post a NOP mailbox command; the callback with argument is invoked upon completion while in the event processing context.
Parameters
halPointer to HAL object.
callbackPointer to callback function.
argCaller-provided callback.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 13316 of file ocs_hal.c.

static void ocs_hal_async_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

HAL async callback handler.

Description
This function is called when the NOP mailbox command completes. The callback stored in the requesting context is invoked.
Parameters
halPointer to HAL object.
statusCompletion status.
mqePointer to mailbox completion queue entry.
argCaller-provided argument.
Returns
None.

Definition at line 13275 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_bmbx_command ( ocs_hal_t *  hal,
uint8_t *  cmd 
)
static

Definition at line 2644 of file ocs_hal.c.

int ocs_hal_can_accept_wqes ( struct ocs_hal_io_s *  hio)

Validate HAL IO state to make sure HAL can accept and post wqe to SLI.

Definition at line 13588 of file ocs_hal.c.

static void ocs_hal_cb_cfg_watchdog ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 6736 of file ocs_hal.c.

static int32_t ocs_hal_cb_dump_clear ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the OBJECT_DELETE command completes.

Description
Free the mailbox that was malloc'd by ocs_hal_dump_clear(), then call the callback and pass the status.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done. The callback function prototype is void cb(int32_t status, void *arg).
Returns
Returns 0.

Definition at line 8315 of file ocs_hal.c.

static int32_t ocs_hal_cb_dump_get ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the OBJECT_GET command completes.

Description
Get the number of bytes actually written out of the response, free the mailbox that was malloc'd by ocs_hal_dump_get(), then call the callback and pass the status and bytes read.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done. The callback function prototype is void cb(int32_t status, uint32_t bytes_read).
Returns
Returns 0.

Definition at line 8193 of file ocs_hal.c.

static int32_t ocs_hal_cb_fip ( void *  ctx,
void *  e 
)
static

Definition at line 10790 of file ocs_hal.c.

static int32_t ocs_hal_cb_fw_write ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the WRITE OBJECT command completes.

Description
Get the number of bytes actually written out of the response, free the mailbox that was malloc'd by ocs_hal_firmware_write(), then call the callback and pass the status and bytes written.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done. The callback function prototype is void cb(int32_t status, uint32_t bytes_written).
Returns
Returns 0.

Definition at line 5659 of file ocs_hal.c.

static int32_t ocs_hal_cb_host_stat ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the READ_STATUS command completes.

Description
Get the counters out of the response, free the mailbox that was malloc'd by ocs_hal_get_host_stats(), then call the callback and pass the status and data.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done. The callback function prototype is defined by ocs_hal_host_stat_cb_t.
Returns
Returns 0.

Definition at line 6096 of file ocs_hal.c.

static void ocs_hal_cb_itcm_parity_stats ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 6793 of file ocs_hal.c.

static int32_t ocs_hal_cb_link ( void *  ctx,
void *  e 
)
static

Callback function for the SLI link events.

Description
This function allocates memory which must be freed in its callback.
Parameters
ctxHardware context pointer (that is, ocs_hal_t *).
eEvent structure pointer (that is, sli4_link_event_t *).
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 10696 of file ocs_hal.c.

static int32_t ocs_hal_cb_link_stat ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the READ_LINK_STAT command completes.

Description
Get the counters out of the response, free the mailbox that was malloc'd by ocs_hal_get_link_stats(), then call the callback and pass the status and data.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done. The callback function prototype is defined by ocs_hal_link_stat_cb_t.
Returns
Returns 0.

Definition at line 5964 of file ocs_hal.c.

static int32_t ocs_hal_cb_node_attach ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 10863 of file ocs_hal.c.

static int32_t ocs_hal_cb_node_free ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 10886 of file ocs_hal.c.

static int32_t ocs_hal_cb_port_control ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the port control command completes.

Description
We only need to free the mailbox command buffer.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done.
Returns
Returns 0.

Definition at line 3011 of file ocs_hal.c.

static int32_t ocs_hal_cb_post_xri ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the POST_XRI command completes.

Description
Free the mailbox command buffer and reclaim the XRIs on failure.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done.
Returns
Returns 0.

Definition at line 12863 of file ocs_hal.c.

static int32_t ocs_hal_cb_read_fcf ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Callback function for the FCOE_READ_FCF_TABLE command.

Description
Note that the caller has allocated:
  • DMA memory to hold the table contents
  • DMA memory structure
  • Command/results buffer
Each of these must be freed here.
Parameters
halHardware context.
statusHardware status.
mqePointer to the mailbox command/results buffer.
argPointer to the DMA memory structure.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 10557 of file ocs_hal.c.

static int32_t ocs_hal_cb_release_xri ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the RELEASE_XRI command completes.

Description
Move the IOs back to the free pool on success.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done.
Returns
Returns 0.

Definition at line 12991 of file ocs_hal.c.

static int32_t ocs_hal_cb_sfp ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the READ_TRANSCEIVER_DATA command completes.

Description
Get the number of bytes read out of the response, free the mailbox that was malloc'd by ocs_hal_get_sfp(), then call the callback and pass the status and bytes written.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done. The callback function prototype is void cb(int32_t status, uint32_t bytes_written, uint32_t *data, void *arg).
Returns
Returns 0.

Definition at line 5710 of file ocs_hal.c.

static int32_t ocs_hal_cb_temp ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the DUMP command completes.

Description
Get the temperature data out of the response, free the mailbox that was malloc'd by ocs_hal_get_temperature(), then call the callback and pass the status and data.
Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback function that signals the caller that the command is done. The callback function prototype is defined by ocs_hal_temp_cb_t.
Returns
Returns 0.

Definition at line 5863 of file ocs_hal.c.

static int32_t ocs_hal_cb_unreg_rpi_all ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 10931 of file ocs_hal.c.

static void ocs_hal_check_sec_hio_list ( ocs_hal_t *  hal)
static

Check to see if there are any BZ 161832 workaround waiting IOs.

Description
Checks hal->sec_hio_wait_list, if an IO is waiting for a HAL IO, then try to allocate a secondary HAL io, and dispatch it.


Note: hal->io_lock MUST be taken when called.

Parameters
halpointer to HAL object
Returns
none

Definition at line 4179 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_clear_dump_location ( ocs_hal_t *  hal)

Clear the Lancer dump location.

Description
This function clears existsing DMA buffer set previously while setting dump location
Parameters
halHardware context.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7980 of file ocs_hal.c.

static const char* ocs_hal_clp_from_linkcfg ( ocs_hal_linkcfg_e  linkcfg)
static

Helper function for getting the CLP string value from the HAL linkcfg enum.

Parameters
linkcfgHAL linkcfg enum.
Returns
Returns the OEMELX_LinkConfig CLP string value corresponding to given linkcfg.

Definition at line 6212 of file ocs_hal.c.

static int32_t ocs_hal_clp_resp_get_value ( ocs_hal_t *  hal,
const char *  keyword,
char *  value,
uint32_t  value_len,
const char *  resp,
uint32_t  resp_len 
)
static

Parse the CLP result and get the value corresponding to the given keyword.

Parameters
halHardware context.
keywordCLP keyword for which the value is returned.
valueLocation to which the resulting value is copied.
value_lenLength of the value parameter.
respPointer to the response buffer that is searched for the keyword and value.
resp_lenLength of response buffer passed in.
Returns
Returns the number of bytes written to the value buffer on success, or a negative vaue on failure.

Definition at line 8104 of file ocs_hal.c.

static int32_t ocs_hal_cmd_submit_pending ( ocs_hal_t *  hal)
static

Submit queued (pending) mbx commands.

Description
Submit queued mailbox commands. — Assumes that hal->cmd_lock is held —
Parameters
halHardware context.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 2686 of file ocs_hal.c.

static int32_t ocs_hal_command_cancel ( ocs_hal_t *  hal)
static

Definition at line 11177 of file ocs_hal.c.

static int32_t ocs_hal_command_process ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
size_t  size 
)
static

There is no point in logging the entire MQE because the FW can potentially clear the mailbox area when the cmd completes. So, just log the mbox hdr.

Definition at line 10427 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_config_axr_t10pi ( ocs_hal_t *  hal)
static

Set configuration parameters for AXR T10 PI feature.

Parameters
halHardware context.
bufPointer to a mailbox buffer area.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7165 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_config_fec ( ocs_hal_t *  hal,
uint8_t  enable 
)
static

configure fec (enable/disable) on physical port

  - supported only for FC at present
Parameters
halHardware context.
enableif 1: enable 0: disable
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7254 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_config_fw_ag_rsp ( ocs_hal_t *  hal,
uint8_t  enable 
)
static

Enable/disable firmware path to send auto-good response.

  • In G5/G6, The auto response mechanism does not clear the param field in FCP/NVMe frames. This in turn causes performance issues with certain initiators. This is a firmware workaround to force parameter field to zero
Parameters
halHardware context.
enableif 1: enable 0: disable
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7293 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_config_fw_diagnostic_logging ( ocs_hal_t *  hal,
int32_t  log_size,
int32_t  log_level 
)
static

Set configuration parameters for adapter firmware diagnostic logging (RAS) feature.

Parameters
halHardware context.
log_sizeHost buffer size shared with the firmware to write logs.
log_levelFirmware log level. Valid range is - 0 (least verbose) to 4 (most verbose).
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7063 of file ocs_hal.c.

static uint32_t ocs_hal_config_id_from_linkcfg ( ocs_hal_linkcfg_e  linkcfg)
static

Helper function for getting a Skyhawk link config ID from the HAL linkcfg enum.

Parameters
linkcfgHAL linkcfg enum.
Returns
Returns the Skyhawk link config ID corresponding to given linkcfg.

Definition at line 6233 of file ocs_hal.c.

static int32_t ocs_hal_config_mrq ( ocs_hal_t *  hal,
uint8_t  mode,
uint16_t  vlanid,
uint16_t  fcf_index 
)
static

Configure Multi-RQ.

Parameters
halHardware context allocated by the caller.
mode1 to set MRQ filters and 0 to set FCFI index
vlanidvalid in mode 0
fcf_indexvalid in mode 0
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 1321 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_config_set_fdt_xfer_hint ( ocs_hal_t *  hal,
uint32_t  fdt_xfer_hint 
)
static

Set FTD transfer hint feature.

Parameters
halHardware context.
fdt_xfer_hintsize in bytes where read requests are segmented.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7410 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_config_sli_port_health_check ( ocs_hal_t *  hal,
uint8_t  query,
uint8_t  enable 
)
static

enable sli port health check

Parameters
halHardware context.
bufPointer to a mailbox buffer area.
querycurrent status of the health check feature enabled/disabled
enableif 1: enable 0: disable
bufPointer to a mailbox buffer area.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7219 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_config_sliport_pause ( ocs_hal_t *  hal,
uint8_t  enable 
)
static

Definition at line 7376 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_config_tow_t10pi ( ocs_hal_t *  hal)
static

Set configuration parameters for TOW T10 PI feature.

Parameters
halHardware context.
bufPointer to a mailbox buffer area.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7131 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_config_watchdog_timer ( ocs_hal_t *  hal)
static

Set configuration parameters for watchdog timer feature.

Parameters
halHardware context.
timeoutTimeout for watchdog timer in seconds
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6774 of file ocs_hal.c.

void ocs_hal_cq_process ( ocs_hal_t *  hal,
hal_cq_t *  cq,
uint32_t  cq_process_limit 
)

Process entries on the given completion queue.

Parameters
halHardware context.
cqPointer to the HAL completion queue object.
Returns
None.

Definition at line 9783 of file ocs_hal.c.

static void ocs_hal_dmtf_clp_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called when the DMTF CLP command completes.

Parameters
halHardware context.
statusStatus field from the mbox completion.
mqeMailbox response structure.
argPointer to a callback argument.
Returns
None.

Definition at line 8029 of file ocs_hal.c.

static int32_t ocs_hal_domain_add ( ocs_hal_t *  hal,
ocs_domain_t *  domain 
)
static

Definition at line 9587 of file ocs_hal.c.

static int32_t ocs_hal_domain_del ( ocs_hal_t *  hal,
ocs_domain_t *  domain 
)
static

Definition at line 9635 of file ocs_hal.c.

ocs_domain_t* ocs_hal_domain_get ( ocs_hal_t *  hal,
uint16_t  fcfi 
)

Definition at line 9692 of file ocs_hal.c.

static ocs_domain_t* ocs_hal_domain_get_indexed ( ocs_hal_t *  hal,
uint16_t  fcf_index 
)
static

Definition at line 9710 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_dump_clear ( ocs_hal_t *  hal,
ocs_hal_dump_clear_cb_t  cb,
void *  arg 
)

Clear a dump image from the device.

Description
Creates a SLI_CONFIG mailbox command, fills it with the correct values to clear the dump, then sends the command with ocs_hal_command(). On completion, the callback function ocs_hal_cb_dump_clear() gets called to free the mailbox and to signal the caller that the write has completed.
Parameters
halHardware context.
cbPointer to a callback function that is called when the command completes. The callback function prototype is void cb(int32_t status, uint32_t bytes_written, void *arg).
argPointer to be passed to the callback function.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 8354 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_dump_get ( ocs_hal_t *  hal,
ocs_dma_t *  dma,
uint32_t  size,
uint32_t  offset,
ocs_hal_dump_get_cb_t  cb,
void *  arg 
)

Read a dump image to the host.

Description
Creates a SLI_CONFIG mailbox command, fills in the correct values to read a dump image chunk, then sends the command with the ocs_hal_command(). On completion, the callback function ocs_hal_cb_dump_get() gets called to free the mailbox and signal the caller that the read has completed.
Parameters
halHardware context.
dmaDMA structure to transfer the dump chunk into.
sizeSize of the dump chunk.
offsetOffset, in bytes, from the beginning of the dump.
cbPointer to a callback function that is called when the command completes. The callback function prototype is void cb(int32_t status, uint32_t bytes_read, uint8_t eof, void *arg).
argPointer to be passed to the callback function.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 8246 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_exec_dmtf_clp_cmd ( ocs_hal_t *  hal,
ocs_dma_t *  dma_cmd,
ocs_dma_t *  dma_resp,
uint32_t  opts,
ocs_hal_dmtf_clp_cb_t  cb,
void *  arg 
)
static

Execute the DMTF CLP command.

Parameters
halHardware context.
dma_cmdDMA buffer containing the CLP command.
dma_respDMA buffer that will contain the response (if successful).
optsMailbox command options (such as OCS_CMD_NOWAIT and POLL).
cbCallback function.
argCallback argument.
Returns
Returns the number of bytes written to the response buffer on success, or a negative value if failed.

Definition at line 7929 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_exec_mbx_command_generic_results ( ocs_hal_t *  hal,
uint8_t *  req_rsp_buf,
bool  handle_sli4_rsp,
int  timeout_usecs 
)
static

Issue a blocking hal command that has generic response handling in callback handler.

Parameters
hal,:Hardware context.
req_rsp_buf,:The command request and response buffer
handle_sli4_rsp,:command response has sli header
timeout_usecs,:Semphore wait timeout
Returns
Returns OCS_HAL_RTN_SUCCESS on success. OCS_HAL_RTN_ERROR on timeout or failure

Definition at line 6896 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_firmware_write ( ocs_hal_t *  hal,
ocs_dma_t *  dma,
uint32_t  size,
uint32_t  offset,
int  last,
ocs_hal_fw_cb_t  cb,
void *  arg 
)

Write a portion of a firmware image to the device.

Description
Calls the correct firmware write function based on the device type.
Parameters
halHardware context.
dmaDMA structure containing the firmware image chunk.
sizeSize of the firmware image chunk.
offsetOffset, in bytes, from the beginning of the firmware image.
lastTrue if this is the last chunk of the image. Causes the image to be committed to flash.
cbPointer to a callback function that is called when the command completes. The callback function prototype is void cb(int32_t status, uint32_t bytes_written, void *arg).
argPointer to be passed to the callback function.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 5569 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_firmware_write_lancer ( ocs_hal_t *  hal,
ocs_dma_t *  dma,
uint32_t  size,
uint32_t  offset,
int  last,
ocs_hal_fw_cb_t  cb,
void *  arg 
)
static

Write a portion of a firmware image to the Emulex XE201 ASIC (Lancer).

Description
Creates a SLI_CONFIG mailbox command, fills it with the correct values to write a firmware image chunk, and then sends the command with ocs_hal_command(). On completion, the callback function ocs_hal_fw_write_cb() gets called to free the mailbox and to signal the caller that the write has completed.
Parameters
halHardware context.
dmaDMA structure containing the firmware image chunk.
sizeSize of the firmware image chunk.
offsetOffset, in bytes, from the beginning of the firmware image.
lastTrue if this is the last chunk of the image. Causes the image to be committed to flash.
cbPointer to a callback function that is called when the command completes. The callback function prototype is void cb(int32_t status, uint32_t bytes_written, void *arg).
argPointer to be passed to the callback function.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 5602 of file ocs_hal.c.

int32_t ocs_hal_flush ( ocs_hal_t *  hal)

Definition at line 11164 of file ocs_hal.c.

void ocs_hal_free_dump_to_host_buffers ( ocs_hal_t *  hal)

Definition at line 7561 of file ocs_hal.c.

static void ocs_hal_generic_mbx_command_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 6856 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_get ( ocs_hal_t *  hal,
ocs_hal_property_e  prop,
uint32_t *  value 
)

If auto recovery is enabled, SLIPort flag will be cleared by the set_dump_location mbox cmd in the hal reset path. So, we have to rely on OCS dump_state flag to validate the presence of FW dumps.

Check only for FDD, and return if a dump exists on this PCI func. This can even return the presence of CLD on PCI func 0 since we really don't care about the type of dump that exists in OCS buffers.

Definition at line 1840 of file ocs_hal.c.

static void ocs_hal_get_active_link_config_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Get the link configuration callback.

Parameters
halHardware context.
statusStatus from the RECONFIG_GET_LINK_INFO command.
mqeMailbox response structure.
argPointer to a callback argument.
Returns
none

Definition at line 6574 of file ocs_hal.c.

static int32_t ocs_hal_get_active_profile_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called for the completion of get_active_profile for a user request.

Parameters
halHardware context.
statusThe status from the MQE
mqePointer to mailbox command buffer.
argPointer to a callback argument.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 9022 of file ocs_hal.c.

static int32_t ocs_hal_get_fw_timed_out ( ocs_hal_t *  hal)
static

Definition at line 1829 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_get_host_stats ( ocs_hal_t *  hal,
uint8_t  cc,
ocs_hal_host_stat_cb_t  cb,
void *  arg 
)

Function to retrieve the link and host statistics.

Parameters
halHardware context.
ccclear counters, if TRUE all counters will be cleared.
cbFunction call upon completion of receiving the data.
argArgument to pass to pointer fc hosts statistics structure.
Returns
Returns OCS_HAL_RTN_SUCCESS, OCS_HAL_RTN_ERROR, or OCS_HAL_RTN_NO_MEMORY.

Definition at line 6044 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_get_itcm_parity_stats ( ocs_hal_t *  hal,
bool  clear_stats,
ocs_hal_parity_stat_cb_t  cb,
void *  arg 
)

Definition at line 6823 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_get_link_stats ( ocs_hal_t *  hal,
uint8_t  req_ext_counters,
uint8_t  clear_overflow_flags,
uint8_t  clear_all_counters,
ocs_hal_link_stat_cb_t  cb,
void *  arg 
)

Function to retrieve the link statistics.

Parameters
halHardware context.
req_ext_countersIf TRUE, then the extended counters will be requested.
clear_overflow_flagsIf TRUE, then overflow flags will be cleared.
clear_all_countersIf TRUE, the counters will be cleared.
cbFunction call upon completion of sending the data (may be NULL).
argArgument to pass to IO completion function.
Returns
Returns OCS_HAL_RTN_SUCCESS, OCS_HAL_RTN_ERROR, or OCS_HAL_RTN_NO_MEMORY.

Definition at line 5909 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_get_linkcfg ( ocs_hal_t *  hal,
uint32_t  opts,
ocs_hal_port_control_cb_t  cb,
void *  arg 
)
static

Get link configuration.

Parameters
halHardware context.
optsMailbox command options (OCS_CMD_NOWAIT/POLL).
cbCallback function to invoke following mbx command.
argCallback argument.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6478 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_get_linkcfg_lancer ( ocs_hal_t *  hal,
uint32_t  opts,
ocs_hal_port_control_cb_t  cb,
void *  arg 
)
static

Get link configuration for a Lancer.

Parameters
halHardware context.
optsMailbox command options (OCS_CMD_NOWAIT/POLL).
cbCallback function to invoke following mbx command.
argCallback argument.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6508 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_get_linkcfg_skyhawk ( ocs_hal_t *  hal,
uint32_t  opts,
ocs_hal_port_control_cb_t  cb,
void *  arg 
)
static

Get link configuration for a Skyhawk.

Parameters
halHardware context.
optsMailbox command options (OCS_CMD_NOWAIT/POLL).
cbCallback function to invoke following mbx command.
argCallback argument.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6620 of file ocs_hal.c.

static uint32_t ocs_hal_get_num_chutes ( ocs_hal_t *  hal)
static

Determine the number of chutes on the device.

Description
Some devices require queue resources allocated per protocol processor (chute). This function returns the number of chutes on this device.
Parameters
halHardware context allocated by the caller.
Returns
Returns the number of chutes on the device for protocol.

Definition at line 377 of file ocs_hal.c.

int32_t ocs_hal_get_num_eq ( ocs_hal_t *  hal)

Definition at line 1823 of file ocs_hal.c.

static int32_t ocs_hal_get_nvparms_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called for the completion of get_nvparms for a user request.

Parameters
halHardware context.
statusThe status from the MQE.
mqePointer to mailbox command buffer.
argPointer to a callback argument.
Returns
0 on success, non-zero otherwise

Definition at line 9134 of file ocs_hal.c.

static int32_t ocs_hal_get_port_protocol_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called for the completion of get_port_profile for a user request.

Parameters
halHardware context.
statusThe status from the MQE.
mqePointer to mailbox command buffer.
argPointer to a callback argument.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 8416 of file ocs_hal.c.

static int32_t ocs_hal_get_profile_list_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called for the completion of get_profile_list for a user request.

Description
This function is called when the COMMMON_GET_PROFILE_LIST mailbox completes. The response will be in ctx->non_embedded_mem.virt. This function parses the response and creates a ocs_hal_profile_list, then calls the mgmt_cb callback function and passes that list to it.
Parameters
halHardware context.
statusThe status from the MQE
mqePointer to mailbox command buffer.
argPointer to a callback argument.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 8880 of file ocs_hal.c.

void* ocs_hal_get_ptr ( ocs_hal_t *  hal,
ocs_hal_property_e  prop 
)

Definition at line 2175 of file ocs_hal.c.

uint32_t ocs_hal_get_rqes_produced_count ( ocs_hal_t *  hal)

Called to obtain the count of produced RQs.

Parameters
halHardware context.
Returns
Returns the number of RQs produced.

Definition at line 9396 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_get_temperature ( ocs_hal_t *  hal,
ocs_hal_temp_cb_t  cb,
void *  arg 
)

Function to retrieve the temperature information.

Parameters
halHardware context.
cbFunction call upon completion of sending the data (may be NULL).
argArgument to pass to IO completion function.
Returns
Returns OCS_HAL_RTN_SUCCESS, OCS_HAL_RTN_ERROR, or OCS_HAL_RTN_NO_MEMORY.

Definition at line 5814 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_get_trunk_info ( ocs_hal_t *  hal,
uint32_t *  trunk_info 
)

Get trunking mode information.

Parameters
halHardware context.
trunk_infoPlaceholder to return trunk config info
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6987 of file ocs_hal.c.

static void ocs_hal_init_free_io ( ocs_hal_io_t *  io)
inlinestatic

Initialize IO fields on each free call.


Note: This is done on each free call (as opposed to each alloc call) because port-owned XRIs are not allocated with ocs_hal_io_alloc() but are freed with this function.

Parameters
ioPointer to HAL IO.

Definition at line 3775 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_init_io ( ocs_hal_t *  hal)
static

Definition at line 11086 of file ocs_hal.c.

static void ocs_hal_init_linkcfg_cb ( int32_t  status,
uintptr_t  value,
void *  arg 
)
static

Callback function for getting linkcfg during HAL initialization.

Parameters
statusStatus of the linkcfg get operation.
valueLink configuration enum to which the link configuration is set.
argCallback argument (ocs_hal_t *).
Returns
None.

Definition at line 1422 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_init_tow ( ocs_hal_t *  hal,
uint32_t  tow_feature 
)
static

Definition at line 212 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_init_tow_esoc ( ocs_hal_t *  hal,
uint32_t  tow_feature 
)
static

Definition at line 177 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_init_tow_feature ( ocs_hal_t *  hal)
static

Initialize TOW feature for AXR/FB.

Definition at line 262 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_init_tow_t10pi ( ocs_hal_t *  hal)
static

Definition at line 240 of file ocs_hal.c.

int32_t ocs_hal_io_cancel ( ocs_hal_t *  hal)

Definition at line 11262 of file ocs_hal.c.

static void ocs_hal_io_cancel_cleanup ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)
static

Issue any pending callbacks for an IO and remove off the timer and pending lists.

Parameters
halHal context.
ioPointer to the IO to cleanup.

Definition at line 11227 of file ocs_hal.c.

uint32_t ocs_hal_io_get_count ( ocs_hal_t *  hal,
ocs_hal_io_count_type_e  io_count_type 
)

Called to obtain the count for the specified type.

Parameters
halHardware context.
io_count_typeIO count type (inuse, free, wait_free).
Returns
Returns the number of IOs on the specified list type.

Definition at line 9325 of file ocs_hal.c.

static int32_t ocs_hal_io_ini_sge ( ocs_hal_t *  hal,
ocs_hal_io_t *  io,
ocs_dma_t *  cmnd,
uint32_t  cmnd_size,
ocs_dma_t *  rsp 
)
static

Definition at line 11333 of file ocs_hal.c.

ocs_hal_io_t* ocs_hal_io_lookup ( ocs_hal_t *  hal,
uint32_t  xri 
)

Find IO given indicator (xri).

Parameters
halHal context.
indicatorIndicator (xri) to look for.
Returns
Returns io if found, NULL otherwise.

Definition at line 11213 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_io_overflow_sgl ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)
static

Definition at line 5131 of file ocs_hal.c.

static void ocs_hal_io_quarantine ( ocs_hal_t *  hal,
hal_wq_t *  wq,
ocs_hal_io_t *  io 
)
static

Quaratine an IO by taking a reference count and adding it to the quarantine list. When the IO is popped from the list then the count is released and the IO MAY be freed depending on whether it is still referenced by the IO.

   @n @b Note: BZ 160124 - If this is a target write or an initiator read using
   DIF, then we must add the XRI to a quarantine list until we receive
   4 more completions of this same type.
Parameters
halHardware context.
wqPointer to the WQ associated with the IO object to quarantine.
ioPointer to the io object to quarantine.

Definition at line 9742 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_io_register_sgl ( ocs_hal_t *  hal,
ocs_hal_io_t *  io,
ocs_dma_t *  sgl,
uint32_t  sgl_count 
)

Definition at line 4867 of file ocs_hal.c.

static void ocs_hal_io_restore_sgl ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)
static

Definition at line 4881 of file ocs_hal.c.

static uint8_t ocs_hal_iotype_is_originator ( uint16_t  io_type)
static

Definition at line 328 of file ocs_hal.c.

uint8_t ocs_hal_is_io_port_owned ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)

Determine if HAL IO is owned by the port.

Description
Determines if the given HAL IO has been posted to the chip.
Parameters
halHardware context allocated by the caller.
ioHAL IO.
Returns
Returns TRUE if given HAL IO is port-owned.

Definition at line 12789 of file ocs_hal.c.

uint8_t ocs_hal_is_xri_port_owned ( ocs_hal_t *  hal,
uint32_t  xri 
)

Return TRUE if exchange is port-owned.

Description
Test to see if the xri is a port-owned xri.
Parameters
halHardware context.
xriExchange indicator.
Returns
Returns TRUE if XRI is a port owned XRI.

Definition at line 12808 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_link_event_init ( ocs_hal_t *  hal)
static

Definition at line 390 of file ocs_hal.c.

static void ocs_hal_linkcfg_dmtf_clp_cb ( ocs_hal_t *  hal,
int32_t  status,
uint32_t  result_len,
void *  arg 
)
static

Get the link configuration callback.

Parameters
halHardware context.
statusStatus from the DMTF CLP command.
result_lenLength, in bytes, of the DMTF CLP result.
argPointer to a callback argument.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7444 of file ocs_hal.c.

static ocs_hal_linkcfg_e ocs_hal_linkcfg_from_clp ( const char *  clp_str)
static

Helper function for getting the HAL linkcfg enum from the CLP string value.

Parameters
clp_strCLP string value from OEMELX_LinkConfig.
Returns
Returns the HAL linkcfg enum corresponding to clp_str.

Definition at line 6191 of file ocs_hal.c.

static ocs_hal_linkcfg_e ocs_hal_linkcfg_from_config_id ( const uint32_t  config_id)
static

Helper function for getting the HAL linkcfg enum from a Skyhawk config ID.

Parameters
config_idSkyhawk link config ID.
Returns
Returns the HAL linkcfg enum corresponding to config_id.

Definition at line 6253 of file ocs_hal.c.

static void ocs_hal_log_sli4_rsp_hdr ( ocs_hal_t *  hal,
sli4_res_hdr_t *  hdr 
)
static

Definition at line 169 of file ocs_hal.c.

static int32_t ocs_hal_mq_process ( ocs_hal_t *  hal,
int32_t  status,
sli4_queue_t *  mq 
)
static

Process entries on the given mailbox queue.

Parameters
halHardware context.
statusCQE status.
mqPointer to the mailbox queue object.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 10476 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_node_group_alloc ( ocs_hal_t *  hal,
ocs_remote_node_group_t *  ngroup 
)

Definition at line 3694 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_node_group_attach ( ocs_hal_t *  hal,
ocs_remote_node_group_t *  ngroup,
ocs_remote_node_t *  rnode 
)

Definition at line 3714 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_node_group_free ( ocs_hal_t *  hal,
ocs_remote_node_group_t *  ngroup 
)

Definition at line 3743 of file ocs_hal.c.

static void ocs_hal_parse_pause_errx_pairs ( ocs_hal_t *  hal)
static

Definition at line 7318 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_port_migration ( ocs_hal_t *  hal)

Definition at line 1657 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_post_xri ( ocs_hal_t *  hal,
uint32_t  xri_start,
uint32_t  num_to_post 
)
static

Issues a mailbox command to move XRIs from the host-controlled pool to the port.

Parameters
halHardware context.
xri_startThe starting XRI to post.
num_to_postThe number of XRIs to post.
Returns
Returns OCS_HAL_RTN_NO_MEMORY, OCS_HAL_RTN_ERROR, or OCS_HAL_RTN_SUCCESS.

Definition at line 12889 of file ocs_hal.c.

int32_t ocs_hal_process ( ocs_hal_t *  hal,
uint32_t  vector,
uint32_t  max_isr_time_msec 
)

Definition at line 2530 of file ocs_hal.c.

static void ocs_hal_queue_hash_add ( ocs_queue_hash_t *  hash,
uint16_t  id,
uint16_t  index 
)
static

Update the queue hash with the ID and index.

Parameters
hashPointer to hash table.
idID that was created.
indexThe index into the hash object.

Definition at line 9537 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_queue_hash_alloc ( ocs_hal_t *  hal)
static

Definition at line 562 of file ocs_hal.c.

int32_t ocs_hal_queue_hash_find ( ocs_queue_hash_t *  hash,
uint16_t  id 
)

Find index given queue ID.

Parameters
hashPointer to hash table.
idID to find.
Returns
Returns the index into the HAL cq array or -1 if not found.

Definition at line 9564 of file ocs_hal.c.

static void ocs_hal_queue_hash_free ( ocs_hal_t *  hal)
static

Definition at line 543 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_raise_ue ( ocs_hal_t *  hal,
uint8_t  dump 
)

Cause chip to enter an unrecoverable error state.

Description
Cause chip to enter an unrecoverable error state. This is used when detecting unexpected FW behavior so that the FW can be halted from the driver as soon as the error is detected.
Parameters
halHardware context.
dumpGenerate dump as part of reset.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 8161 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_read_fcf ( ocs_hal_t *  hal,
uint32_t  index 
)
static

Read a FCF table entry.

Parameters
halHardware context.
indexTable index to read. Use SLI4_FCOE_FCF_TABLE_FIRST for the first read and the next_index field from the FCOE_READ_FCF_TABLE command for subsequent reads.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 10498 of file ocs_hal.c.

static int32_t ocs_hal_read_lmt ( ocs_hal_t *  hal)
static

function to read link module type

Description
This function allocates memory which must be freed in its callback.
Parameters
ctxHardware context pointer
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 10664 of file ocs_hal.c.

static void ocs_hal_reclaim_xri ( ocs_hal_t *  hal,
uint16_t  xri_base,
uint16_t  xri_count 
)
static

Returns an XRI from the port owned list to the host.

Description
Used when the POST_XRI command fails as well as when the RELEASE_XRI completes.
Parameters
halHardware context.
xri_baseThe starting XRI number.
xri_countThe number of XRIs to free from the base.

Definition at line 12825 of file ocs_hal.c.

static void ocs_hal_remove_io_timed_wqe ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)
inlinestatic

Definition at line 313 of file ocs_hal.c.

hal_wq_callback_t* ocs_hal_reqtag_alloc ( ocs_hal_t *  hal,
void(*)(void *arg, uint8_t *cqe, int32_t status)  callback,
void *  arg 
)

Allocate a WQ request tag.

Allocate and populate a WQ request tag from the WQ request tag pool.

Parameters
halPointer to HAL object.
callbackCallback function.
argPointer to callback argument.
Returns
Returns pointer to allocated WQ request tag, or NULL if object cannot be allocated.

Definition at line 13380 of file ocs_hal.c.

void ocs_hal_reqtag_free ( ocs_hal_t *  hal,
hal_wq_callback_t *  wqcb 
)

Free a WQ request tag.

Free the passed in WQ request tag.

Parameters
halPointer to HAL object.
wqcbPointer to WQ request tag object to free.
Returns
None.

Definition at line 13406 of file ocs_hal.c.

hal_wq_callback_t* ocs_hal_reqtag_get_instance ( ocs_hal_t *  hal,
uint32_t  instance_index 
)

Return WQ request tag by index.

Description
Return pointer to WQ request tag object given an index.
Parameters
halPointer to HAL object.
instance_indexIndex of WQ request tag to return.
Returns
Pointer to WQ request tag, or NULL.

Definition at line 13426 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_reqtag_init ( ocs_hal_t *  hal)

Initialize the reqtag pool.

Description
The WQ request tag pool is initialized.
Parameters
halPointer to HAL object.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 13355 of file ocs_hal.c.

void ocs_hal_reqtag_reset ( ocs_hal_t *  hal)

Reset the WQ request tag pool.

Description
Reset the WQ request tag pool, returning all to the free list.
Parameters
halpointer to HAL object.
Returns
None.

Definition at line 13448 of file ocs_hal.c.

int32_t ocs_hal_reque_xri ( ocs_hal_t *  hal,
ocs_hal_io_t *  io 
)

Reque XRI.

Description
Reque XRI
Parameters
halPointer to HAL object.
ioPointer to HAL IO
Returns
Return 0 if successful else returns -1

Definition at line 13528 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_reset ( ocs_hal_t *  hal,
ocs_hal_reset_e  reset 
)

Definition at line 1670 of file ocs_hal.c.

uint32_t ocs_hal_rpi_active_count ( ocs_hal_t *  hal)

Called to obtain active RPI count.

Parameters
halHardware context.
Returns
Returns the number of RPIs on the specified list type.

Definition at line 9371 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_run_biu_diag ( ocs_hal_t *  hal,
void *  tx_buff,
size_t  tx_buff_len,
void *  rx_buff,
size_t  rx_buff_len 
)

Run Diagnostic PCI Loopback test.

Description
This will run PCI loopback tests
Parameters
halHardware context.
TXDMA buffer address
TXDMA buffer size
RXDMA buffer address
RXDMA buffer size
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7801 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_rx_allocate ( ocs_hal_t *  hal)

Allocate the RQ data buffers.

Parameters
halPointer to HAL object.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 13129 of file ocs_hal.c.

static ocs_hal_rq_buffer_t** ocs_hal_rx_buffer_alloc ( ocs_hal_t *  hal,
uint32_t  rqindex,
uint32_t  count,
uint32_t  size 
)
static

Allocate an ocs_hal_rx_buffer_t array.

Description
An ocs_hal_rx_buffer_t array is allocated, along with the required DMA memory.
Parameters
halPointer to HAL object.
rqindexRQ index for this buffer.
countCount of buffers in array.
sizeSize of buffer.
Returns
Returns the pointer to the allocated ocs_hal_rq_buffer_t array.

Definition at line 13086 of file ocs_hal.c.

static void ocs_hal_rx_buffer_free ( ocs_hal_t *  hal,
ocs_hal_rq_buffer_t **  rq_buf,
uint32_t  count 
)
static

Free an ocs_hal_rx_buffer_t array.

Description
The ocs_hal_rx_buffer_t array is freed, along with allocated DMA memory.
Parameters
halPointer to HAL object.
rq_bufPointer to ocs_hal_rx_buffer_t array.
countCount of buffers in array.
Returns
None.

Definition at line 13056 of file ocs_hal.c.

void ocs_hal_rx_free ( ocs_hal_t *  hal)

Free the RQ data buffers.

Parameters
halPointer to HAL object.

Definition at line 13231 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_rx_post ( ocs_hal_t *  hal)

Post the RQ data buffers to the chip.

Parameters
halPointer to HAL object.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 13186 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_send_frame ( ocs_hal_t *  hal,
fc_header_le_t *  hdr,
uint8_t  sof,
uint8_t  eof,
ocs_dma_t *  payload,
ocs_hal_send_frame_context_t *  ctx,
void(*)(void *arg, uint8_t *cqe, int32_t status)  callback,
void *  arg 
)

Send a raw frame.

Description
Using the SEND_FRAME_WQE, a frame consisting of header and payload is sent.
Parameters
halPointer to HAL object.
hdrPointer to a little endian formatted FC header.
sofValue to use as the frame SOF.
eofValue to use as the frame EOF.
payloadPointer to payload DMA buffer.
ctxPointer to caller provided send frame context.
callbackCallback function.
argCallback function argument.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 4817 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_set ( ocs_hal_t *  hal,
ocs_hal_property_e  prop,
uint32_t  value 
)

Definition at line 2214 of file ocs_hal.c.

static void ocs_hal_set_active_link_config_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Callback for ocs_hal_set_linkcfg_skyhawk.

Parameters
halHardware context.
statusStatus from the RECONFIG_GET_LINK_INFO command.
mqeMailbox response structure.
argPointer to a callback argument.
Returns
none

Definition at line 6388 of file ocs_hal.c.

static int32_t ocs_hal_set_active_profile_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called for the completion of set_active_profile for a user request.

Parameters
halHardware context.
statusThe status from the MQE
mqePointer to mailbox command buffer.
argPointer to a callback argument.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 9433 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_set_dif_mode ( ocs_hal_t *  hal)
static

Sets the DIF mode value.

Parameters
halHardware context.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6705 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_set_dif_seed ( ocs_hal_t *  hal)
static

Sets the DIF seed value.

Parameters
halHardware context.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6676 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_set_dump_location ( ocs_hal_t *  hal,
uint32_t  num_buffers,
ocs_dma_t *  dump_buffers,
uint8_t  fdb 
)
static

Set the Lancer dump location.

Description
This function tells a Lancer chip to use a specific DMA buffer as a dump location rather than the internal flash.
Parameters
halHardware context.
num_buffersThe number of DMA buffers to hold the dump (1..n).
dump_buffersDMA buffers to hold the dump. function specific dump
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

If a single buffer is used, then it may be passed as is to the chip. For multiple buffers, we must allocate an SGL list and then pass the address of the list to the chip.

Definition at line 7497 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_set_dump_to_host_buffers ( ocs_hal_t *  hal)

Allocates dump dma buffers, if not already allocated. Set the Lancer dump location.

Description
This function tells a Lancer chip to use a specific DMA buffer as a dump location rather than the internal flash.
Parameters
halHardware context.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Make sure the FW is new enough to support this command. If the FW is too old, the FW will UE.

Definition at line 7721 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_set_eth_license ( ocs_hal_t *  hal,
uint32_t  license 
)
static

Set the Ethernet license.

Description
This function sends the appropriate mailbox command (DMTF CLP) to set the Ethernet license to the given license value. Since it is used during the time of ocs_hal_init(), the mailbox command is sent via polling (the BMBX route).
Parameters
halHardware context.
license32-bit license value.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7864 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_set_linkcfg ( ocs_hal_t *  hal,
ocs_hal_linkcfg_e  value,
uint32_t  opts,
ocs_hal_port_control_cb_t  cb,
void *  arg 
)
static

Set link configuration.

Parameters
halHardware context.
valueLink configuration enum to which the link configuration is set.
optsMailbox command options (OCS_CMD_NOWAIT/POLL).
cbCallback function to invoke following mbx command.
argCallback argument.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6290 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_set_linkcfg_lancer ( ocs_hal_t *  hal,
ocs_hal_linkcfg_e  value,
uint32_t  opts,
ocs_hal_port_control_cb_t  cb,
void *  arg 
)
static

Set link configuration for Lancer.

Parameters
halHardware context.
valueLink configuration enum to which the link configuration is set.
optsMailbox command options (OCS_CMD_NOWAIT/POLL).
cbCallback function to invoke following mbx command.
argCallback argument.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6321 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_set_linkcfg_skyhawk ( ocs_hal_t *  hal,
ocs_hal_linkcfg_e  value,
uint32_t  opts,
ocs_hal_port_control_cb_t  cb,
void *  arg 
)
static

Set link configuration for a Skyhawk.

Parameters
halHardware context.
valueLink configuration enum to which the link configuration is set.
optsMailbox command options (OCS_CMD_NOWAIT/POLL).
cbCallback function to invoke following mbx command.
argCallback argument.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6421 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_set_loopback_mode ( ocs_hal_t *  hal,
uint32_t  type 
)

Set the Lancer dump location.

Description
This function set link loopback mode
Parameters
halHardware context.
typeloopback type to be set
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7772 of file ocs_hal.c.

static int32_t ocs_hal_set_nvparms_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called for the completion of set_nvparms for a user request.

Parameters
halHardware context.
statusThe status from the MQE.
mqePointer to mailbox command buffer.
argPointer to a callback argument.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 9230 of file ocs_hal.c.

static int32_t ocs_hal_set_port_protocol_cb1 ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called for the completion of set_port_profile for a user request.

Description
This is the first of two callbacks for the set_port_protocol function. The set operation is a read-modify-write. This callback is called when the read completes (GET_PROFILE_CONFG). It will updated the resource descriptors, then queue the write (SET_PROFILE_CONFIG).

On entry there are three memory areas that were allocated by ocs_hal_set_port_protocol. If a failure is detected in this function those need to be freed. If this function succeeds it allocates three more areas.

Parameters
halHardware context.
statusThe status from the MQE
mqePointer to mailbox command buffer.
argPointer to a callback argument.
Returns
Returns 0 on success, or a non-zero value otherwise.

Allocate memory for the descriptors we're going to send. i.e. one for each PCI descriptor plus one ISAP descriptor.

Loop over all descriptors. If the descriptor is a PCIe descriptor, copy it to the SET_PROFILE_CONFIG command to be written back. If it's the descriptor that we're trying to change, set its pf_type as well.

This is the PCIe descriptor for this OCS instance. Update it with the new pf_type.

Definition at line 8635 of file ocs_hal.c.

static int32_t ocs_hal_set_port_protocol_cb2 ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Called for the completion of set_port_profile for a user request.

Description
This is the second of two callbacks for the set_port_protocol function. The set operation is a read-modify-write. This callback is called when the write (SET_PROFILE_CONFIG) completes.
Parameters
halHardware context.
statusThe status from the MQE.
mqePointer to mailbox command buffer.
argPointer to a callback argument.
Returns
0 on success, non-zero otherwise

Definition at line 8577 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_set_ptr ( ocs_hal_t *  hal,
ocs_hal_property_e  prop,
void *  value 
)

Definition at line 2437 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_set_trunk_mode ( ocs_hal_t *  hal,
uint32_t  trunk_mode 
)

Set trunking mode.

Parameters
halHardware context.
trunk_modeTrunk mode to set
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 6951 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_setup_io ( ocs_hal_t *  hal)
static

Initialize the pool of HAL IO objects.

Parameters
halHardware context.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 10973 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_sli_queue_alloc ( ocs_hal_t *  hal)
static

Definition at line 491 of file ocs_hal.c.

static void ocs_hal_sli_queue_free ( ocs_hal_t *  hal)
static

Definition at line 460 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_sli_reset ( ocs_hal_t *  hal,
ocs_hal_reset_e  reset,
ocs_hal_state_e  prev_state 
)
static

Definition at line 1618 of file ocs_hal.c.

int ocs_hal_stop_fw_diagnostic_logging ( ocs_hal_t *  hal)

Stop firmware diagnostic logging (RAS).

Parameters
halHardware context.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7016 of file ocs_hal.c.

static ocs_hal_rtn_e ocs_hal_teardown_fw_diagnostic_logging ( ocs_hal_t *  hal)
static

If required disable firmware diagnostic logging (RAS) and then free resources.

Parameters
halHardware context.
Returns
Returns OCS_HAL_RTN_SUCCESS on success.

Definition at line 7047 of file ocs_hal.c.

void ocs_hal_unsol_process_bounce ( void *  arg)

Definition at line 2518 of file ocs_hal.c.

static void ocs_hal_watchdog_timer_cb ( void *  arg)
static

Definition at line 6728 of file ocs_hal.c.

static uint8_t ocs_hal_wcqe_abort_needed ( uint16_t  status,
uint8_t  ext,
uint8_t  xb 
)
static

Definition at line 342 of file ocs_hal.c.

static void ocs_hal_wq_handle_bad_reque_xri ( void *  arg,
uint8_t *  cqe,
int32_t  status 
)
static

Definition at line 13509 of file ocs_hal.c.

void ocs_hal_wq_process ( ocs_hal_t *  hal,
hal_cq_t *  cq,
uint8_t *  cqe,
int32_t  status,
uint16_t  rid 
)

Process WQ completion queue entries.

Parameters
halHardware context.
cqPointer to the HAL completion queue object.
cqePointer to WQ completion queue.
statusCompletion status.
ridResource ID (IO tag).
Returns
none

Definition at line 9898 of file ocs_hal.c.

static void ocs_hal_wq_process_abort ( void *  arg,
uint8_t *  cqe,
int32_t  status 
)
static

Process WQ completions for abort requests.

Parameters
argGeneric callback argument.
cqePointer to completion queue entry.
statusCompletion status.
Returns
None.

Definition at line 10201 of file ocs_hal.c.

static void ocs_hal_wq_process_io ( void *  arg,
uint8_t *  cqe,
int32_t  status 
)
static

Process WQ completions for IO requests.

Parameters
argGeneric callback argument
cqePointer to completion queue entry
statusCompletion status
Description

Note: Regarding io->reqtag, the reqtag is assigned once when HAL IOs are initialized in ocs_hal_setup_io(), and don't need to be returned to the hal->wq_reqtag_pool.
Returns
None.

Definition at line 9933 of file ocs_hal.c.

void ocs_hal_xabt_process ( ocs_hal_t *  hal,
hal_cq_t *  cq,
uint8_t *  cqe,
uint16_t  rid 
)

Process XABT completions.

Parameters
halHardware context.
cqPointer to the HAL completion queue object.
cqePointer to WQ completion queue.
ridResource ID (IO tag).
Returns
None.

Definition at line 10284 of file ocs_hal.c.

ocs_hal_rtn_e ocs_hal_xri_move_to_host_owned ( ocs_hal_t *  hal,
uint8_t  num_xri 
)

Move XRIs from the port-controlled pool to the host.

Requests XRIs from the FW to return to the host-owned pool.

Parameters
halHardware context.
num_xriThe number of XRIs being requested to moved from the chip.
Returns
Returns 0 for success, or a negative error code value for failure.

Definition at line 13022 of file ocs_hal.c.

uint32_t ocs_hal_xri_move_to_port_owned ( ocs_hal_t *  hal,
uint32_t  num_xri 
)

Move XRIs from the host-controlled pool to the port.

Description
Removes IOs from the free list and moves them to the port.
Parameters
halHardware context.
num_xriThe number of XRIs being requested to move to the chip.
Returns
Returns the number of XRIs that were moved.

Definition at line 12921 of file ocs_hal.c.

static void shutdown_target_wqe_timer ( ocs_hal_t *  hal)
static

Definition at line 12750 of file ocs_hal.c.

static void target_wqe_timer_cb ( void *  arg)
static

Definition at line 12735 of file ocs_hal.c.

static int32_t target_wqe_timer_nop_cb ( ocs_hal_t *  hal,
int32_t  status,
uint8_t *  mqe,
void *  arg 
)
static

Definition at line 12679 of file ocs_hal.c.

Variable Details

ocs_hal_global_t hal_global

Definition at line 78 of file ocs_hal.c.

ocs_hal_linkcfg_map_t linkcfg_map[]
static
Initial value:

Mapping from the HAL linkcfg enum to the CLP command value string.

Definition at line 6153 of file ocs_hal.c.

ocs_hal_skyhawk_linkcfg_map_t skyhawk_linkcfg_map[]
static
Initial value:

Mapping from the HAL linkcfg enum to the Skyhawk link config IDs.

Definition at line 6177 of file ocs_hal.c.