| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2010, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bafl.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/3 $ |
|---|
| 12 | * $brcm_Date: 10/19/10 5:00p $ |
|---|
| 13 | * |
|---|
| 14 | * [File Description:] |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/afl/bafl.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/3 10/19/10 5:00p davidp |
|---|
| 21 | * SW7425-16: Change BAFL_SectionInfo to specify start address, not |
|---|
| 22 | * offset. |
|---|
| 23 | * |
|---|
| 24 | * Hydra_Software_Devel/2 10/7/10 3:54p davidp |
|---|
| 25 | * SW7425-1: Change datatype of load info StartAddress to void *. |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/1 8/27/10 4:33p davidp |
|---|
| 28 | * SW7425-1: Merge from branch. |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/SW7425-1/2 8/18/10 4:54p davidp |
|---|
| 31 | * SW7425-1: Add initial version of Broadcom ARC Firmware Loader. |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/SW7425-1/1 7/14/10 4:30p nilesh |
|---|
| 34 | * SW7425-1: Added AFL commonutil |
|---|
| 35 | * |
|---|
| 36 | ***************************************************************************/ |
|---|
| 37 | |
|---|
| 38 | /* BAFL Broadcom ARC Firmware Loader. |
|---|
| 39 | * |
|---|
| 40 | * This module loads an optimized ELF image into memory for ARC processors. |
|---|
| 41 | * An ELF image has been previousely been processed to remove unneeded |
|---|
| 42 | * symbol tables abd other ELF tables that are not needed. |
|---|
| 43 | * |
|---|
| 44 | * The format of the resultant ELF files is as follows. |
|---|
| 45 | * |
|---|
| 46 | *------------------------------ |
|---|
| 47 | * ELF Header | |
|---|
| 48 | *------------------------------ |
|---|
| 49 | * Section Header | |
|---|
| 50 | *------------------------------ |
|---|
| 51 | * Section Header | |
|---|
| 52 | *------------------------------ |
|---|
| 53 | * Section Header | |
|---|
| 54 | *------------------------------ |
|---|
| 55 | * Section Header | |
|---|
| 56 | *------------------------------ |
|---|
| 57 | * Section Header | |
|---|
| 58 | *------------------------------ |
|---|
| 59 | * Section Header | |
|---|
| 60 | *------------------------------ |
|---|
| 61 | * Section Header | |
|---|
| 62 | *------------------------------ |
|---|
| 63 | * . |
|---|
| 64 | * . |
|---|
| 65 | * . |
|---|
| 66 | *------------------------------ |
|---|
| 67 | * Section Header | |
|---|
| 68 | *------------------------------ |
|---|
| 69 | * Section Data | |
|---|
| 70 | *------------------------------ |
|---|
| 71 | * Section Data | |
|---|
| 72 | *------------------------------ |
|---|
| 73 | * Section Data | |
|---|
| 74 | *------------------------------ |
|---|
| 75 | * Section Data | |
|---|
| 76 | *------------------------------ |
|---|
| 77 | * Section Data | |
|---|
| 78 | *------------------------------ |
|---|
| 79 | * Section Data | |
|---|
| 80 | *------------------------------ |
|---|
| 81 | * Section Data | |
|---|
| 82 | *------------------------------ |
|---|
| 83 | * . |
|---|
| 84 | * . |
|---|
| 85 | * . |
|---|
| 86 | *------------------------------ |
|---|
| 87 | * Section Data | |
|---|
| 88 | *------------------------------ |
|---|
| 89 | * |
|---|
| 90 | * The format of the ELF image must be in this format for the BAFL_Load routine |
|---|
| 91 | * to read the image linearly using the BIMG interface. This will prevent |
|---|
| 92 | * multiple copies from being perform which will result in a shorter load |
|---|
| 93 | * time. |
|---|
| 94 | */ |
|---|
| 95 | |
|---|
| 96 | #ifndef BAFL_H_ |
|---|
| 97 | #define BAFL_H_ |
|---|
| 98 | |
|---|
| 99 | #include "bimg.h" |
|---|
| 100 | |
|---|
| 101 | /*************************************************************************** |
|---|
| 102 | Summary: |
|---|
| 103 | Enum used to specify ARC core boot mode. |
|---|
| 104 | |
|---|
| 105 | Description: |
|---|
| 106 | This enum is used to determine if an ARC core boot is the result of a |
|---|
| 107 | "normal" bootup sequence or the result of a watchdog restart. The host |
|---|
| 108 | may want to have a different boot/authentication sequence depending on |
|---|
| 109 | the purpose of the reboot. E.g. in watchdog mode, the security processor |
|---|
| 110 | itself may not need re-configuration but the ARC itself may still need to |
|---|
| 111 | be booted. |
|---|
| 112 | |
|---|
| 113 | ****************************************************************************/ |
|---|
| 114 | |
|---|
| 115 | /* |
|---|
| 116 | * BAFL_SectionInfo - indicates the virtual address and size of the ARC FW section |
|---|
| 117 | */ |
|---|
| 118 | typedef struct BAFL_SectionInfo |
|---|
| 119 | { |
|---|
| 120 | void *pStartAddress; /* virtual address of start of section */ |
|---|
| 121 | uint32_t uiSize; /* Size of section. "0" size indicates not present. */ |
|---|
| 122 | } BAFL_SectionInfo; |
|---|
| 123 | |
|---|
| 124 | /* |
|---|
| 125 | * BAFL_BootInfo - provides the application's optional boot callback information |
|---|
| 126 | * about the ARC whose FW has just been loaded. |
|---|
| 127 | */ |
|---|
| 128 | typedef struct BAFL_FirmwareLoadInfo |
|---|
| 129 | { |
|---|
| 130 | BAFL_SectionInfo stCode; |
|---|
| 131 | BAFL_SectionInfo stData; |
|---|
| 132 | } BAFL_FirmwareLoadInfo; |
|---|
| 133 | |
|---|
| 134 | typedef enum BAFL_BootMode |
|---|
| 135 | { |
|---|
| 136 | BAFL_BootMode_eNormal = 0, /* Normal boot */ |
|---|
| 137 | BAFL_BootMode_eWatchdog, /* Watchdog reboot */ |
|---|
| 138 | BAFL_BootMode_eMaxModes |
|---|
| 139 | } BAFL_BootMode; |
|---|
| 140 | |
|---|
| 141 | typedef struct BAFL_FirmwareInfo |
|---|
| 142 | { |
|---|
| 143 | uint32_t uiArcInstance; /* ARC identifier */ |
|---|
| 144 | BAFL_SectionInfo stCode; /* Code section info */ |
|---|
| 145 | struct BAFL_FirmwareInfo *pNext; |
|---|
| 146 | } BAFL_FirmwareInfo; |
|---|
| 147 | |
|---|
| 148 | /* |
|---|
| 149 | * BAFL_BootInfo - returned in the ARC Boot Callback. |
|---|
| 150 | * Contains information pertaining to the boot type and code location for each ARC. |
|---|
| 151 | */ |
|---|
| 152 | typedef struct BAFL_BootInfo |
|---|
| 153 | { |
|---|
| 154 | BAFL_BootMode eMode; /* ARC Boot mode */ |
|---|
| 155 | BAFL_FirmwareInfo *pstArc; |
|---|
| 156 | } BAFL_BootInfo; |
|---|
| 157 | |
|---|
| 158 | BERR_Code |
|---|
| 159 | BAFL_Load( |
|---|
| 160 | const BIMG_Interface *pImgInterface, |
|---|
| 161 | void **pImageContext, |
|---|
| 162 | uint32_t uiInstance, |
|---|
| 163 | void *pStartAddress, /* Virtual Address */ |
|---|
| 164 | size_t uiSize, |
|---|
| 165 | bool bDataOnly, |
|---|
| 166 | BAFL_FirmwareLoadInfo *pstFWLoadInfo |
|---|
| 167 | ); |
|---|
| 168 | |
|---|
| 169 | #endif /* BAFL_H_ */ |
|---|