/* * Copyright (c) 2011-2015, Emulex * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * */ #ifndef ELXU_DWNLD_H_ #define ELXU_DWNLD_H_ #include #include "elxu_ufi.h" /* Endian macros are all based on whether two bytes or four bytes are swapped */ #define SWAP_2BYTES(x) ((((x) & 0xFF00 ) >> 8) | (((x) & 0x00FF ) << 8)) #define SWAP_4BYTES(x) (SWAP_2BYTES(((x) & 0xFFFF0000) >> 16) | (SWAP_2BYTES((x) & 0xFFFF) << 16)) enum { FW_FILE_DOWNLOAD = 1, FW_FILE_DISPLAY_INFO, FW_FILE_VERIFY, FW_FILE_UPLOAD_DUMP }; typedef enum { UNKNOWN, SKYHAWK_UFI, LANCER, PRISM } fFormat_t; typedef struct Dwnld_File_Descriptor { int fd; char file_name[128]; uint8_t *mem_p; int len; struct stat st; #define HBA_FILE_LANCER 1 #define HBA_FILE_SKYHAWK 2 #define HBA_FILE_PRISM 3 int hba_file_type; /* Skyhawk, Lancer,Prism */ #define FILE_TYPE_UFI 1 #define FILE_TYPE_GRP 2 int file_type; ufi_file_header_t ufi_hdr; ufi_image_header_t img_hdr; flash_directory_t *ufi_flash_hdr; int num_tbl_elements; } dwnld_file_desc_t; void display_ufi_flash_directory(dwnld_file_desc_t *fdesc); void init_image_table(dwnld_file_desc_t *fdesc); extern int file_handler (elxu_device_t *device_p, char const *file_name_p, int download_flag); extern int hba_dump_upload (elxu_device_t *device_p, char const *file_name_p); #endif /* ELXU_DWNLD_H_ */