Skip to content

Commit 22c78c6

Browse files
committed
Docs: add bypass and axi filtering sections
Signed-off-by: Karol Gugala <[email protected]>
1 parent 266deb4 commit 22c78c6

File tree

6 files changed

+109
-7
lines changed

6 files changed

+109
-7
lines changed

doc/source/axi_id_filtering.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# AXI Transaction ID Filtering
2+
3+
In order to facilitate constraining the recovery core's accessibility, the I3C core implements an AXI transaction ID filtering mechanism.
4+
5+
Transaction IDs are passed using the `aruser` and `awuser` signals.
6+
7+
The ID filtering logic is optional and depends on the `AXI_ID_FILTERING` macro definition.
8+
9+
Recovery core configuration includes a parameter denoting the `NUM_PRIV_IDS` - number of privileged IDs that are granted read and write access when the filtering mechanism is enabled.
10+
11+
Having `AXI_ID_FILTERING` defined requires `NUM_PRIV_IDS` to be greater than 0. This is verified with an assertion.
12+
13+
Undefined `AXI_ID_FILTERING` and non-zero `NUM_PRIV_IDS` are considered a legal configuration and causes the ID filtering logic **to not be included** in the design.
14+
15+
The filtering mechanism is controlled via:
16+
17+
* `disable_axi_filtering_i` recovery core port to disable the filtering mechanism
18+
* `1'b0` - enable AXI filtering
19+
* `1'b1` - disable AXI filtering
20+
* `[0:AXI_ID_WIDTH-1] priv_ids_i [0:NUM_PRIV_IDS-1]` recovery core port containing privileged IDs
21+
* Each privileged ID should be of width `AXI_ID_WIDTH` passed at `priv_ids_i[k]` for each **k** in **{0 … NUM_PRIV_IDS - 1}**
22+
* All `NUM_PRIV_IDS` entries are expected to be set to valid privileged IDs
23+
24+
When the filtering is enabled, any transaction attempt outside of the privileged IDs will be met with a `SLVERR` (`0b10`) error on the respective AXI response channel.
25+
26+
The above-mentioned `disable_axi_filtering_i` and `priv_ids_i` ports will not be included in the design if `AXI_ID_FILTERING` is not defined.
27+

doc/source/axi_recovery_flow.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# AXI driven Caliptra recovery flow
2+
3+
This chapter discusses the implementation of AXI based recovery flow, which is an alternative to the standard I3C based flow (see {doc}`recovery_flow`).
4+
This feature allows driving the recovery data from within the SoC integrating the I3C core over the AXI bus, bypassing I3C communication.
5+
6+
## AXI Recovery flow implementation
7+
8+
The AXI recovery flow reuses the logic already present in the I3C core used in the Caliptra-SS design, with a runtime option essentially bypassing most of the I3C core communication logic (including the I3C recovery flow logic).
9+
10+
The loopback functionality is configurable via a CSR, with the I3C mode set as the default.
11+
12+
Recovery CSRs are accessible from the internal AXI bus.
13+
The transactions to the core may be filtered using the AXI ID field (see {doc}`axi_id_filtering`)
14+
15+
The logic is implemented so that the recovery firmware in the Caliptra RoT ROM can operate without any changes.
16+
17+
### AXI-based recovery procedure
18+
19+
The Caliptra MCU RISC-V core is responsible for driving the data copied from an external memory (e.g. QSPI interface) to the recovery FIFOs.
20+
The ROM running on the MCU core monitors the recovery block registers and performs the recovery flow.
21+
During the boot procedure the ROM will have to follow the following procedure:
22+
23+
1. Set the I3C block to the "direct AXI" mode
24+
2. Poll the `DEVICE_STATUS` register and wait for the recovery to be enabled by the Caliptra core
25+
3. Read the `RECOVERY_STATUS` register and check if the recovery flow started
26+
4. Write to the `RECOVERY_CONTROL` register to set the recovery image configuration
27+
5. Write to the `INDIRECT_FIFO_CTRL` register to set the recovery image size
28+
6. Push the recovery image to the recovery interface FIFOs:
29+
30+
a. Read the `INDIRECT_FIFO_STATUS` register to determine remaining space in the indirect FIFO
31+
b. If the indirect FIFO is not full, write a chunk of data to the `INDIRECT_FIFO_DATA` register
32+
c. The above steps should be repeated until the whole recovery image is written to the FIFO
33+
34+
7. Activate the new image by writing to the `RECOVERY_CTRL` register
35+
8. Read the `RECOVERY_STATUS` register to ensure the image has been activated
36+
37+
The recovery image will be written in chunks with length equal to or less than `Max transfer size` defined in the `INDIRECT_FIFO_STATUS` register.
38+
Once the last data chunk is written to the FIFO, the Caliptra MCU ROM will write a CSR in the Secure Firmware Recovery register file indicating the transfer is complete.
39+
40+
## Recovery Handler bypass
41+
42+
In the regular (I3C) mode of the core, the Recovery Handler strongly relies on communication with the I3C Core internal logic by interfacing with TTI Queues.
43+
The bypass implementation modifies the I3C Core logic to allow direct access over the AXI bus to the structures specified by the OCP Secure Firmware Recovery for compliance with the [Caliptra Subsystem Recovery Sequence](https://github.com/chipsalliance/Caliptra/blob/main/doc/Caliptra.md#caliptra-subsystem-recovery-interface-hardware).
44+
45+
The default design of the Recovery Handler includes many blocks specifically designed to translate I3C bus traffic into recovery messages.
46+
It also automatically responds to the I3C commands by writing transaction descriptors and data for the TTI Queues.
47+
Such a recovery flow is presented in the diagram below.
48+
49+
:::{figure-md} recovery_handler
50+
![](img/recovery_handler_flow.png)
51+
52+
Recovery Handler in the I3C Core
53+
:::
54+
55+
In order enable an alternative recovery mechanism while reusing the existing logic and keeping compliance with Caliptra, the I3C core provides a custom bypass feature allowing direct communication with the Recovery Handler via the AXI bus.
56+
The bypass disables the I3C communication logic.
57+
Data is routed from the TTI TX Queue to the Recovery Executor block, and written directly to the Indirect Data FIFO.
58+
The Caliptra ROM can access the data from the Indirect FIFO over the AXI bus (the same way it does in the regular I3C recovery flow).
59+
Data flow in bypass mode, marked with green arrows, is depicted in the diagram below.
60+
61+
:::{figure-md} recovery_handler_with_bypass
62+
![](img/recovery_handler_with_bypass.png)
63+
64+
Recovery Handler with the I3C Core logic bypass
65+
:::
66+
67+
## Secure Firmware Recovery CSRs
68+
69+
With the bypass feature enabled, the FIFO status CSRs in the Secure Firmware Recovery CSR file will be updated by the Recovery Handler module.
70+
However, some registers like e.g. `INDIRECT_FIFO_CTRL` which are updated by I3C commands in a standard recovery flow, will have to be accessed and configured properly from the software running on the Caliptra MCU via the AXI bus.
71+
All configurable registers are writable from software, read only registers provide status information about Recovery Handler internals, e.g. details about size and fill level of the Indirect FIFO.
569 KB
Loading
674 KB
Loading

doc/source/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ phy
99
dv
1010
ext_cap
1111
recovery_flow
12+
axi_id_filtering
13+
axi_recovery_flow
1214
registers
1315
```

doc/source/introduction.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ The implementation follows the Errata 01 for MIPI I3C Basic Specification Versio
88

99
This documentation comprises the following chapters:
1010

11-
* [I3C core overview](overview.md) - summarizes the main notions of the project
12-
* [I3C Common Command Codes (CCC)](ccc.md)
13-
* [Physical Layer](phy.md) - provides a description of the I3C PHY Layer logic
14-
* [Design Verification](dv.md) - describes verification tooling and testplans
15-
* [Specification for I3C Vendor-Specific Extended Capabilities](ext_cap.md) - provides a description of Target Transaction Interface
16-
* [Recovery flow](recovery_flow.md) - describes the Recovery mode workflow
17-
* [Register descriptions](registers.md) - provides auto-generated register descriptions
11+
* {doc}`overview` - summarizes the main notions of the project
12+
* {doc}`ccc` - provides an overview of the CCCs implemented by the core
13+
* {doc}`phy` - provides a description of the I3C PHY Layer logic
14+
* {doc}`dv` - describes verification tooling and testplans
15+
* {doc}`ext_cap` - provides a description of Target Transaction Interface
16+
* {doc}`i3c_recovery_flow` - describes the I3C-based Recovery mode workflow
17+
* {doc}`axi_id_filtering` - provides information about the AXI transactions filtering feature
18+
* {doc}`axi_recovery_flow` - describes the alternative, optional, recovery flow where the recovery data is transferred to the core over the AXI bus
19+
* {doc}`registers` - provides auto-generated register descriptions

0 commit comments

Comments
 (0)