|
| 1 | +.. _apl-boot-rom: |
| 2 | + |
| 3 | +Apollo Lake Boot ROM |
| 4 | +#################### |
| 5 | + |
| 6 | +Progress of the boot process is reflected by the status information updated by |
| 7 | +the ROM in an SRAM area called *FW Registers*. It is available to the host |
| 8 | +driver through a memory window. |
| 9 | + |
| 10 | +ROM FW Registers |
| 11 | +**************** |
| 12 | + |
| 13 | +This SRAM area updated by the ROM during the boot process is available via |
| 14 | +memory window #0, the limit is set to 4K. |
| 15 | + |
| 16 | +Offset 0x00 |
| 17 | + FwStatus - Current ROM status |
| 18 | + |
| 19 | +Offset 0x04 |
| 20 | + ErrorCode - Last ROM error code |
| 21 | + |
| 22 | +Offset 0x08 |
| 23 | + FwPwrStatus - Current DSP clock status (ToBeVerified on APL/CNL) |
| 24 | + |
| 25 | +FwStatus |
| 26 | +======== |
| 27 | + |
| 28 | +The FwStatus register contains current FW status, initialized to 0 on the DSP |
| 29 | +startup. |
| 30 | + |
| 31 | +The ErrorCode register is updated by ROM when *FwStatus* ``running`` bit is |
| 32 | +set to “halted on critical error”, initialized to 0 (`ADSP_SUCCESS`) on the |
| 33 | +DSP startup. |
| 34 | + |
| 35 | +Once Base FW is being executed, *ErrorCode* is updated every time some error is |
| 36 | +detected while calling internal API components. Some of the error codes might be |
| 37 | +helpful for driver writers hence documented in this specification. |
| 38 | + |
| 39 | +.. code-block:: c |
| 40 | +
|
| 41 | + union fw_status_reg |
| 42 | + { |
| 43 | + int32_t full; |
| 44 | + struct Bits |
| 45 | + { |
| 46 | + uint32_t state : 24; |
| 47 | + uint32_t wait_state : 4; |
| 48 | + uint32_t module : 3; |
| 49 | + uint32_t running : 1; |
| 50 | + } bits; |
| 51 | + }; |
| 52 | +
|
| 53 | +running |
| 54 | + This field is used to report current FW running state. |
| 55 | + 0 – running, |
| 56 | + 1 – halted. |
| 57 | + When FW reports halted state, ErrorCode register contains error |
| 58 | + code. |
| 59 | + |
| 60 | +module |
| 61 | + This field is used to report FW module (that indicates boot phase |
| 62 | + component/module in this context, not a processing module) that is being |
| 63 | + executed. |
| 64 | + |
| 65 | +wait_state |
| 66 | + This field is updated to non-zero code of operation when ROM is waiting |
| 67 | + for completion of that operation. |
| 68 | + |
| 69 | +state |
| 70 | + This field is used to report phase of the FW module that is being executed. |
| 71 | + When FW switches to another module (reported by Module field) this value |
| 72 | + may get started again from 0, so it is Module context sensitive. |
| 73 | + |
| 74 | +.. uml:: images/apl-rom-flow.pu |
| 75 | + :caption: APL ROM Boot Sequence |
| 76 | + |
| 77 | +.. code-block:: c |
| 78 | + :caption: APL ROM Wait States |
| 79 | +
|
| 80 | + // Waiting for IPC busy bit to be set |
| 81 | + #define WAIT_FOR_IPC_BUSY 0x1 |
| 82 | + // Waiting for IPC done bit to be set |
| 83 | + #define WAIT_FOR_IPC_DONE 0x2 |
| 84 | + // Waiting for L2$ invalidation to be ack'ed |
| 85 | + #define WAIT_FOR_CACHE_INVALIDATION 0x3 |
| 86 | + // Waiting for DMA buffer to be filled |
| 87 | + #define WAIT_FOR_DMA_BUFFER_FULL 0x5 |
| 88 | +
|
| 89 | +.. code-block:: c |
| 90 | + :caption: APL ROM Status Codes |
| 91 | +
|
| 92 | + #define FSR_ROM_INIT 0x0 |
| 93 | + #define FSR_ROM_INIT_DONE 0x1 |
| 94 | + #define FSR_ROM_CSE_MANIFEST_LOADED 0x2 |
| 95 | + #define FSR_ROM_FW_MANIFEST_LOADED 0x3 |
| 96 | + #define FSR_ROM_FW_FW_LOADED 0x4 |
| 97 | + #define FSR_ROM_FW_ENTERED 0x5 |
| 98 | + #define FSR_ROM_VERIFY_FEATURE_MASK 0x6 |
| 99 | + #define FSR_ROM_GET_LOAD_OFFSET 0x7 |
| 100 | + #define FSR_ROM_BASEFW_CSE_IMR_REQUEST 0x10 |
| 101 | + #define FSR_ROM_BASEFW_CSE_IMR_GRANTED 0x11 |
| 102 | + #define FSR_ROM_BASEFW_CSE_VALIDATE_IMAGE_REQUEST 0x12 |
| 103 | + #define FSR_ROM_BASEFW_CSE_IMAGE_VALIDATED 0x13 |
| 104 | +
|
| 105 | +.. code-block:: c |
| 106 | + :caption: APL ROM Error Codes |
| 107 | +
|
| 108 | + #define ADSP_UNHANDLED_INTERRUPT 0xBEE00000 |
| 109 | +
|
| 110 | + // Memory hole/ECC error |
| 111 | + // Status bits are provided: |
| 112 | + // [0] - L2 SRAM ECC error |
| 113 | + // [1] - L2 memory hole error |
| 114 | + #define ADSP_MEMORY_HOLE_ECC 0xECC00000 |
| 115 | + #define ADSP_USER_EXCEPTION 0xBEEF0000 |
| 116 | + #define ADSP_KERNEL_EXCEPTION 0xCAFE0000 |
| 117 | +
|
| 118 | + // Other critical error |
| 119 | + #define ADSP_FAILURE 6 |
| 120 | + // FW image does not match the feature mask read from HW register. |
| 121 | + #define ADSP_INVALID_FEAT_MASK 20 |
| 122 | + // Invalid parameter |
| 123 | + #define ADSP_INVALID_PARAM 21 |
| 124 | + // CSE responded with error on an IPC request |
| 125 | + #define ADSP_CSE_ERROR 40 |
| 126 | + // Invalid IPC response sent back by CSE. |
| 127 | + #define ADSP_CSE_WRONG_RESPONSE 41 |
| 128 | + // Size of IMR assigned by CSE is too small to load FW Image. |
| 129 | + #define ADSP_IMR_TOO_SMALL 42 |
| 130 | + // Base FW module not found in FW Image. |
| 131 | + #define ADSP_BASE_FW_NOT_FOUND 43 |
| 132 | + // CSE responded with error on FW image validation request. |
| 133 | + #define ADSP_CSE_VALIDATION_FAILED 44 |
| 134 | + // IPC communication failed with fatal error. |
| 135 | + #define ADSP_IPC_FATAL_ERROR 45 |
| 136 | + // L2 cache command failed. |
| 137 | + #define ADSP_L2_CACHE_ERROR 46 |
| 138 | + // Load offset set in FW Image Manifest is too small. |
| 139 | + #define ADSP_LOAD_OFFSET_TOO_SMALL 47 |
| 140 | +
|
| 141 | +ROM -> FW Transition |
| 142 | +==================== |
| 143 | + |
| 144 | +Once APL ROM jumps to the entry point of the first module in the main binary, |
| 145 | +the memory and caches are in the following state: |
| 146 | + |
| 147 | +* L2$ is turned on, so the FW boot procedure may either execute via L2 |
| 148 | + cacheable address space or directly via L2 uncacheable alias. |
| 149 | + |
| 150 | +* HPSRAM areas allocated by the ROM listed in the next table. |
| 151 | + |
| 152 | +APL ROM HPSRAM Allocation |
| 153 | +========================= |
| 154 | + |
| 155 | ++---------------------+------------+--------------+ |
| 156 | +| Area | Base Addr | Size | |
| 157 | ++=====================+============+==============+ |
| 158 | +| Code load buffer | 0xBE008000 | 0x8000 (32K) | |
| 159 | ++---------------------+------------+--------------+ |
| 160 | +| BSS (inc. stack) | 0xBE010000 | 0x8000 (32K) | |
| 161 | ++---------------------+------------+--------------+ |
| 162 | +| FW Registers | 0xBE01E000 | 0x800 (2K) | |
| 163 | ++---------------------+------------+--------------+ |
0 commit comments