Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
elxu_dwnld.c File Reference
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#include <unistd.h>
#include <memory.h>
#include <errno.h>
#include <sys/times.h>
#include <sys/ioctl.h>
#include <time.h>
#include <elxu_sli4.h>
#include <elxu_device.h>
#include <elxu_sky.h>
#include <elxu_ufi.h>
#include <elxu_dwnld.h>
#include <elxu_common.h>
#include <elxu_mgmt.h>
#include <ocs_ioctl.h>

Go to the source code of this file.

Macros

#define FW_UPDATE_RESTRICTED   -14
 
#define UNSUPPORTED_FW_IMAGE   -13
 
#define PATTERN_SIZE   16
 

Functions

static uint16_t get_op_type (uint8_t entry_type)
 Determine mailbox op_type from UFI entry_type. More...
 
static off_t find_ufi_dir (int fd)
 
static fFormat_t retrieve_file_format (uint8_t *buf_p, int len)
 Returns the file type. More...
 
static int file_handler_init (const char *filename_p, dwnld_file_desc_t *fdesc_p)
 Initializes files descriptor structure. More...
 
static void display_ufi_header (ufi_file_header_t *ufi_hdr_p)
 Displays content of UFI file header structure. More...
 
void display_ufi_flash_directory (dwnld_file_desc_t *fdesc)
 Displays content of UFI flash directory header. More...
 
static void display_ufi_image_hdr (ufi_image_header_t *img_hdr_p)
 Displays content of UFI image header structure. More...
 
static int download_skyhawk_image (elxu_device_t *device_p, dwnld_file_desc_t *fdsc_p)
 Skyhawk firmware download. More...
 
static int download_lancer_object_file (elxu_device_t *device_p, const char *object_p, dwnld_file_desc_t *fdsc_p)
 Lancer file object. More...
 
static int download_lancer_image (elxu_device_t *device_p, dwnld_file_desc_t *fdsc_p)
 Lancer firmware download. More...
 
static int download_handler (elxu_device_t *device_p, dwnld_file_desc_t *fdsc_p)
 Firmware download. More...
 
static int hba_image_section_fw_verify (elxu_device_t *device_p, dwnld_file_desc_t *fdsc_p)
 flash and file data comparison functionality. More...
 
int file_handler (elxu_device_t *device_p, char const *file_name_p, int action)
 File manipulating functionality. More...
 

Macro Details

#define FW_UPDATE_RESTRICTED   -14

Definition at line 58 of file elxu_dwnld.c.

#define PATTERN_SIZE   16

Definition at line 922 of file elxu_dwnld.c.

#define UNSUPPORTED_FW_IMAGE   -13

Definition at line 59 of file elxu_dwnld.c.

Function Details

void display_ufi_flash_directory ( dwnld_file_desc_t *  fdesc)

Displays content of UFI flash directory header.

This function is in part used for debugging and determining what sections exist in a given UFI file

Parameters
flash_dirUFI flash directory structure pointer.

Definition at line 309 of file elxu_dwnld.c.

static void display_ufi_header ( ufi_file_header_t *  ufi_hdr_p)
static

Displays content of UFI file header structure.

The function parses and displays the content of the UFI file header structure.

Parameters
ufi_hdr_pUFI header structure pointer.

Definition at line 261 of file elxu_dwnld.c.

static void display_ufi_image_hdr ( ufi_image_header_t *  img_hdr_p)
static

Displays content of UFI image header structure.

The function displays the content of the UFI image header structure.

Parameters
ufi_hdr_pUFI image header structure pointer.

Definition at line 362 of file elxu_dwnld.c.

static int download_handler ( elxu_device_t *  device_p,
dwnld_file_desc_t *  fdsc_p 
)
static

Firmware download.

Based on the file type, download the firmware to an appropriate HBA.

Parameters
device_pA pointer to HBA structure descriptor.
fdsc_pA pointer to a file descriptor structure.
Returns
Returns 0 on success, non-zero on failure.

Definition at line 685 of file elxu_dwnld.c.

static int download_lancer_image ( elxu_device_t *  device_p,
dwnld_file_desc_t *  fdsc_p 
)
static

Lancer firmware download.

Donwloads the grp file into HBA.

Parameters
device_pA pointer to HBA structure descriptor.
fdsc_pA pointer to a file descriptor structure.

Definition at line 651 of file elxu_dwnld.c.

static int download_lancer_object_file ( elxu_device_t *  device_p,
const char *  object_p,
dwnld_file_desc_t *  fdsc_p 
)
static

Lancer file object.

Downloads the Lancer file object into specified HBA object directory (object).

Parameters
device_pA pointer to HBA structure descriptor.
object_pAn lancer object type
fdsc_pA pointer to a file descriptor structure.

Definition at line 577 of file elxu_dwnld.c.

static int download_skyhawk_image ( elxu_device_t *  device_p,
dwnld_file_desc_t *  fdsc_p 
)
static

Skyhawk firmware download.

Skyhawk UFI file is read into memory and it is forwarded to the HBA in segments.

Parameters
device_pA pointer to HBA structure descriptor.
fdsc_pA pointer to a file descriptor structure.

Definition at line 384 of file elxu_dwnld.c.

int file_handler ( elxu_device_t *  device_p,
char const *  file_name_p,
int  action 
)

File manipulating functionality.

This functionality is called by a CLI to request a particular file manipulation operation.

Parameters
device_pThe pointer to the HBA descriptor structure.
memFdsc_pThe pointer to the memory file descriptor structure.
actionThe requested action.

Definition at line 966 of file elxu_dwnld.c.

static int file_handler_init ( const char *  filename_p,
dwnld_file_desc_t *  fdesc_p 
)
static

Initializes files descriptor structure.

Initializes the file descriptor structure.

Parameters
file_name_pfilename information
fdsc_pa file descriptor pointer

Definition at line 125 of file elxu_dwnld.c.

static off_t find_ufi_dir ( int  fd)
static

Definition at line 924 of file elxu_dwnld.c.

static uint16_t get_op_type ( uint8_t  entry_type)
static

Determine mailbox op_type from UFI entry_type.

Description
Each firmware section in a UFI directory has an entry type that describes what type of entry it it. Newer UFI files also have an op_type field that specify which op_type argument should be passed in the COMMON_WRITE_FLASHROM mailbox comman. Older UFI files don't have the op_type present in the directory and it must be determined from the entry_type. This function returns an op_type based on the entry_type.
Parameters
entry_typeThe entry type to look up.
Returns
Returns the op_type that corresponds to the given entry type, or 0xffff if no match is found.

Definition at line 893 of file elxu_dwnld.c.

static int hba_image_section_fw_verify ( elxu_device_t *  device_p,
dwnld_file_desc_t *  fdsc_p 
)
static

flash and file data comparison functionality.

Compare flash with the UFI or Bin file data.

Parameters
device_pThe pointer to the HBA descriptor structure.
memFdsc_pThe pointer to the memory file descriptor structure.

Definition at line 739 of file elxu_dwnld.c.

static fFormat_t retrieve_file_format ( uint8_t *  buf_p,
int  len 
)
static

Returns the file type.

This function returns the type of the file - Skyhawk UFI or Lancer object file.

Parameters
buf_ppointer to the memory holding an initial file data
lenthe data length

Definition at line 73 of file elxu_dwnld.c.