/* * 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_UFI_H_ #define ELXU_UFI_H_ #define LEN_16KB (16*1024) #define LEN_64KB (64 * 1024) #define LEN_128KB (128*1024) #define LEN_256KB (256*1024) #define LEN_512KB (512*1024) #define LEN_1MB (1024*1024) #define LEN_1_5MB (LEN_1MB + LEN_512KB) #define LEN_2MB (2*LEN_1MB) #define LEN_2_5MB (LEN_2MB + LEN_512KB) #define UFI_SIGNATURE_STR "ServerEngines Corporation" typedef struct ufi_file_header { uint8_t signature[52]; // ServerEngines Corp. x.y.aaaa.bb uint32_t ufi_version; uint32_t file_len; //Header bytes + Binary Flash Image bytes. Not dword aligned. uint32_t checksum; uint32_t antidote; uint32_t numOfImgs; uint8_t build_version[24]; // Format 3.x.y.z uint8_t asic_support; uint8_t rsvd[31]; } ufi_file_header_t; #define FLASH_DIRECTORY_ENTRY_VERSION_SIZE 32 typedef struct flash_directory_entry { uint32_t entryType; uint32_t offset; uint32_t maxSize; uint32_t imageSize; uint32_t checkSum; uint32_t entryPoint; uint16_t opType; uint16_t futureUse1; uint32_t futureUse2; uint8_t version[FLASH_DIRECTORY_ENTRY_VERSION_SIZE]; } flash_directory_entry_t; #define NUM_FLASHDIR_ENTRIES 32 // Number of directory entries in a UFI Flash Directory typedef struct ufi_flash_directory { uint8_t signature[32]; // *** SE FLAS H DIRECTORY *** uint32_t formatRevNumber; uint32_t unused_0; uint32_t unused_1; uint32_t numImages; uint8_t UFI_ID_string[128]; // Not used. uint32_t reserved0; uint32_t reserved1; uint32_t reserved2; uint32_t reserved3; flash_directory_entry_t entries[NUM_FLASHDIR_ENTRIES]; } flash_directory_t; /* * UFI Image Header */ typedef struct ufi_image_header { uint32_t imageId; uint32_t imageOffset; uint32_t imageLength; uint32_t imageChecksum; #define FW_VER_LEN 32 uint8_t imageVer[FW_VER_LEN]; } ufi_image_header_t; #define UFI_FILE_HEADER_LENGTH 0xB0 #endif /* ELXU_UFI_H_ */