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

Go to the source code of this file.

Detailed Description

This file contains all HAL runtime workaround code. Based on the asic type, asic revision, and range of fw revisions, a particular workaround may be enabled.

A workaround may consist of overriding a particular HAL/SLI4 value that was initialized during ocs_hal_setup() (for example the MAX_QUEUE overrides for mis-reported queue sizes). Or if required, elements of the ocs_hal_workaround_t structure may be set to control specific runtime behavior.

It is intended that the controls in ocs_hal_workaround_t be defined functionally. So we would have the driver look like: "if (hal->workaround.enable_xxx) then ...", rather than what we might previously see as "if this is a BE3, then do xxx"

Definition in file ocs_hal_workaround.c.

Data Structures

struct  hal_workaround_t
 Internal workaround structure instance. More...
 

Macros

#define HAL_FWREV_ZERO   (0)
 
#define HAL_FWREV_MAX   UINT32_MAX
 
#define SLI4_ASIC_TYPE_ANY   0
 
#define SLI4_ASIC_REV_ANY   0
 

Enumerations

enum  hal_workaround_e {
  HAL_WORKAROUND_TEST = 1, HAL_WORKAROUND_DEC_CQ_COUNT, HAL_WORKAROUND_MULTI_PROTOCOL, HAL_WORKAROUND_FORCE_NODIF,
  HAL_WORKAROUND_FW_VERSION_TOO_LOW
}
 Internal definition of workarounds. More...
 

Functions

static uint32_t parse_fw_version (const char *fwrev_string)
 Parse the firmware version (name) More...
 
static int32_t ocs_hal_workaround_match (ocs_hal_t *hal, hal_workaround_t *w)
 Test for a workaround match. More...
 
void ocs_hal_workaround_setup (struct ocs_hal_s *hal)
 Setup HAL runtime workarounds. More...
 

Variables

static hal_workaround_t hal_workarounds []
 

Macro Details

#define HAL_FWREV_MAX   UINT32_MAX

Definition at line 53 of file ocs_hal_workaround.c.

#define HAL_FWREV_ZERO   (0)

Definition at line 52 of file ocs_hal_workaround.c.

#define SLI4_ASIC_REV_ANY   0

Definition at line 56 of file ocs_hal_workaround.c.

#define SLI4_ASIC_TYPE_ANY   0

Definition at line 55 of file ocs_hal_workaround.c.

Enumeration Details

Internal definition of workarounds.

Enumerator
HAL_WORKAROUND_TEST 
HAL_WORKAROUND_DEC_CQ_COUNT 
HAL_WORKAROUND_MULTI_PROTOCOL 
HAL_WORKAROUND_FORCE_NODIF 
HAL_WORKAROUND_FW_VERSION_TOO_LOW 

Definition at line 62 of file ocs_hal_workaround.c.

Function Details

static int32_t ocs_hal_workaround_match ( ocs_hal_t *  hal,
hal_workaround_t *  w 
)
static

Test for a workaround match.

Looks at the asic type, asic revision, and fw revision, and returns TRUE if match.

Parameters
halPointer to the HAL structure
wPointer to a workaround structure entry
Returns
Return TRUE for a match

Definition at line 153 of file ocs_hal_workaround.c.

void ocs_hal_workaround_setup ( struct ocs_hal_s *  hal)

Setup HAL runtime workarounds.

The function is called at the end of ocs_hal_setup() to setup any runtime workarounds based on the HAL/SLI setup.

Parameters
halPointer to HAL structure
Returns
none

Definition at line 173 of file ocs_hal_workaround.c.

static uint32_t parse_fw_version ( const char *  fwrev_string)
static

Parse the firmware version (name)

Parse a string of the form a.b.c.d, returning a uint32_t packed as defined by the HAL_FWREV() macro

Parameters
fwrev_stringpointer to the firmware string
Returns
packed firmware revision value

Definition at line 117 of file ocs_hal_workaround.c.

Variable Details

hal_workaround_t hal_workarounds[]
static
Initial value:
= {
}
#define HAL_FWREV_MAX
#define HAL_FWREV_1(x)
#define SLI4_ASIC_REV_ANY
#define SLI4_ASIC_TYPE_ANY
#define OCS_MIN_FW_VER
#define HAL_FWREV_ZERO
#define HAL_FWREV(a, b, c, d)
pack fw revision values into a single uint32_t

Definition at line 84 of file ocs_hal_workaround.c.