diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 0660bf6..4d10125 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,7 +1,7 @@ # Summary -- [MCU General Specification](./mcu.md) -- [ROM Specification](./rom.md) +- [MCU Specification](./mcu.md) +- [Reference ROM Specification](./rom.md) - [Runtime Specification](./runtime.md) - [PLDM Package](./pldm_package.md) - [Flash Layout](./flash_layout.md) diff --git a/docs/src/images/MCTP_rx_stack.svg b/docs/src/images/MCTP_rx_stack.svg deleted file mode 100755 index 0e7112e..0000000 --- a/docs/src/images/MCTP_rx_stack.svg +++ /dev/null @@ -1,584 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Page-1 - - - - Rectangle.86 - - - - - - - Rectangle.87 - - - - - - - Rectangle.88 - VirtualMCTPDriver - - - - - - - VirtualMCTPDriver - - Rectangle.89 - VirtualMCTPDriver - - - - - - - VirtualMCTPDriver - - Rectangle.90 - VirtualMCTPDriver - - - - - - - VirtualMCTPDriver - - Sheet.6 - - - - Sheet.7 - - - - Sheet.8 - - - - Rectangle.94 - msg buffer - - - - - - - msg buffer - - Rectangle.95 - msg buffer - - - - - - - msg buffer - - Rectangle.96 - msg buffer - - - - - - - msgbuffer - - Rectangle.97 - - - - - - - Rectangle.98 - msg buffer - - - - - - - msg buffer - - Rectangle.99 - - - - - - - Rectangle.100 - msg buffer - - - - - - - msg buffer - - Rectangle.101 - msg buffer - - - - - - - msg buffer - - Sheet.17 - MCTP_SPDM_DRIVER_NUM - - - - MCTP_SPDM_DRIVER_NUM - - Sheet.18 - MCTP_PLDM_DRIVER_NUM - - - - MCTP_PLDM_DRIVER_NUM - - Sheet.19 - MCTP_VENDEF_DRIVER_NUM - - - - MCTP_VENDEF_DRIVER_NUM - - Rectangle.105 - SPDM App - - - - - - - SPDM App - - Rectangle.106 - PLDM App - - - - - - - PLDM App - - Rectangle.107 - Vendor Def Msg App - - - - - - - Vendor Def Msg App - - Rectangle.108 - App buffer - - - - - - - App buffer - - Rectangle.109 - App buffer - - - - - - - App buffer - - Rectangle.110 - App Buffer - - - - - - - App Buffer - - Dynamic connector.114 - - - - Dynamic connector.115 - - - - Sheet.28 - MCTPRxState - - - - MCTPRxState - - Sheet.29 - MCTPRxState - - - - MCTPRxState - - Sheet.30 - MCTPRxState - - - - MCTPRxState - - Sheet.31 - PLDM Receive - - - - PLDM Receive - - Sheet.32 - SPDM Receive - - - - SPDM Receive - - Sheet.33 - Ven Def Receive - - - - Ven Def Receive - - Line-curve connector.122 - take - - - - - - - - - - take - - Line-curve connector.123 - replace - - - - - - - - - - replace - - Sheet.36 -  MuxMCTPDriver - - - -  MuxMCTPDriver - - Sheet.37 - rx pkt_buf - - - - rx pkt_buf - - Rectangle.126 - - - - - - - Sheet.39 - MCTPI3CBinding - - - - MCTPI3CBinding - - Rectangle.132 - - - - - - - Sheet.41 - I3CTarget driver - - - - I3CTarget driver - - Sheet.42 - (MTU size) with MCTPHeader+ Pkt payload - - - - (MTU size)with MCTPHeader+ Pkt payload - - Sheet.43 - PEC checked - - - - PEC checked - - Sheet.44 - - - - Sheet.45 - rx pkt_buf  - - - - rx pkt_buf  - - Rectangle.157 - - - - - - - Sheet.47 - I3C Controller Private Write Transfer to I3C Target - - - - I3C Controller Private Write Transfer to I3C Target - - Sheet.48 - rx pkt_buf  - - - - rx pkt_buf  - - Rectangle.160 - - - - - - - Line-curve connector.161 - set_rx_buffer() - - - - - - - - - - set_rx_buffer() - - Line-curve connector.162 - receive() - - - - - - - - - - receive() - - Line-curve connector.164 - set_rx_buffer() - - - - - - - - - - set_rx_buffer() - - Line-curve connector.166 - receive() - - - - - - - - - - receive() - - Sheet.54 - assemble - - - - - assemble - - Sheet.55 - assemble - - - - - assemble - - Sheet.56 - assemble - - - - - assemble - - Dynamic connector.180 - copy - - - - - copy - - Dynamic connector.181 - copy - - - - - copy - - Dynamic connector.182 - copy - - - - - copy - - diff --git a/docs/src/images/MCTP_tx_stack.svg b/docs/src/images/MCTP_tx_stack.svg deleted file mode 100755 index 934399d..0000000 --- a/docs/src/images/MCTP_tx_stack.svg +++ /dev/null @@ -1,633 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Page-1 - - - - Rectangle.3 - - - - - - - Rectangle.13 - - - - - - - Rectangle.1 - VirtualMCTPDriver - - - - - - - VirtualMCTPDriver - - Rectangle.2 - VirtualMCTPDriver - - - - - - - VirtualMCTPDriver - - Rectangle.5 - VirtualMCTPDriver - - - - - - - VirtualMCTPDriver - - Sheet.6 - - - - Sheet.7 - - - - Sheet.8 - - - - Rectangle.9 - msg buffer - - - - - - - msg buffer - - Rectangle.10 - msg buffer - - - - - - - msg buffer - - Rectangle.11 - msg buffer - - - - - - - msgbuffer - - Rectangle.14 - - - - - - - Rectangle.15 - msg buffer - - - - - - - msg buffer - - Rectangle.16 - - - - - - - Rectangle.17 - msg buffer - - - - - - - msg buffer - - Rectangle.18 - msg buffer - - - - - - - msg buffer - - Sheet.26 - MCTP_SPDM_DRIVER_NUM - - - - MCTP_SPDM_DRIVER_NUM - - Sheet.27 - MCTP_PLDM_DRIVER_NUM - - - - MCTP_PLDM_DRIVER_NUM - - Sheet.28 - MCTP_VENDEF_DRIVER_NUM - - - - MCTP_VENDEF_DRIVER_NUM - - Rectangle.29 - SPDM App - - - - - - - SPDM App - - Rectangle.30 - PLDM App - - - - - - - PLDM App - - Rectangle.31 - Vendor Def Msg App - - - - - - - Vendor Def Msg App - - Rectangle.32 - App buffer - - - - - - - App buffer - - Rectangle.33 - App buffer - - - - - - - App buffer - - Rectangle.34 - App Buffer - - - - - - - App Buffer - - Dynamic connector.39 - - - - Dynamic connector.41 - - - - Sheet.43 - MCTPTxState - - - - MCTPTxState - - Sheet.44 - MCTPTxState - - - - MCTPTxState - - Sheet.45 - MCTPTxState - - - - MCTPTxState - - Sheet.46 - PLDM send - - - - PLDM send - - Sheet.47 - SPDM send - - - - SPDM send - - Sheet.48 - Ven Def Send - - - - Ven Def Send - - Line-curve connector.49 - take - - - - - - - - - - take - - Line-curve connector.50 - replace - - - - - - - - - - replace - - Sheet.53 -  MuxMCTPDriver - - - -  MuxMCTPDriver - - Sheet.55 - tx pkt_buf  - - - - tx pkt_buf  - - Rectangle.57 - - - - - - - Sheet.58 - - - - Sheet.59 - tx pkt_buf  - - - - tx pkt_buf  - - Sheet.60 - MCTPI3CBinding - - - - MCTPI3CBinding - - Line-curve connector.61 - take - - - - - - - - - - take - - Line-curve connector.63 - replace - - - - - - - - - - replace - - Rectangle.64 - - - - - - - Sheet.65 - I3CTarget driver - - - - I3CTarget driver - - Rectangle.66 - - - - - - - Sheet.67 - tx pkt_buf  - - - - tx pkt_buf  - - Rectangle.68 - - - - - - - Sheet.69 - (MTU size) with MCTPHeader+ Pkt payload - - - - (MTU size)with MCTPHeader+ Pkt payload - - Line-curve connector.71 - take - - - - - - - - - - take - - Line-curve connector.72 - replace - - - - - - - - - - replace - - Sheet.75 - PEC added - - - - PEC added - - Sheet.78 - - - - Line-curve connector.80 - tx_pkt send_done() - - - - - - - - - - tx_pkt send_done() - - Line-curve connector.82 - tx_pkt send_done() - - - - - - - - - - tx_pkt send_done() - - Line-curve connector.83 - msg_buffer send_done() - - - - - - - - - - msg_buffersend_done() - - Sheet.150 - - - - Dynamic connector.153 - packetize - - - - - packetize - - Sheet.154 - - - - Sheet.167 - Private Read Transfer from I3C Target to I3C Controller  (IBI... - - - - Private Read Transfer from I3C Target to I3C Controller (IBI or Polling) - - Dynamic connector.174 - copy - - - - - copy - - Dynamic connector.176 - copy - - - - - copy - - Dynamic connector.178 - copy - - - - - copy - - diff --git a/docs/src/images/mctp_stack.svg b/docs/src/images/mctp_stack.svg new file mode 100644 index 0000000..2db8f84 --- /dev/null +++ b/docs/src/images/mctp_stack.svg @@ -0,0 +1,2100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MCTP_Tx_Stack + + + + Rectangle.3 + + + + + + + Rectangle.13 + + + + + + + Rectangle.1 + VirtualMCTPDriver + + + + + + + VirtualMCTPDriver + + Rectangle.2 + VirtualMCTPDriver + + + + + + + VirtualMCTPDriver + + Rectangle.9 + msg buffer + + + + + + + msg buffer + + Rectangle.10 + msg buffer + + + + + + + msg buffer + + Rectangle.17 + msg buffer + + + + + + + msg buffer + + Sheet.26 + MCTP_SPDM_DRIVER_NUM + + + + MCTP_SPDM_DRIVER_NUM + + Sheet.27 + MCTP_PLDM_DRIVER_NUM + + + + MCTP_PLDM_DRIVER_NUM + + Sheet.28 + MCTP_VENDEF_DRIVER_NUM + + + + MCTP_VENDEF_DRIVER_NUM + + Sheet.43 + MCTPTxState + + + + MCTPTxState + + Sheet.44 + MCTPTxState + + + + MCTPTxState + + Sheet.45 + MCTPTxState + + + + MCTPTxState + + Sheet.46 + PLDM send + + + + PLDM send + + Sheet.47 + SPDM send + + + + SPDM send + + Sheet.48 + Ven Def Send + + + + Ven Def Send + + Line-curve connector.49 + take + + + + + + + + + + take + + Line-curve connector.50 + replace + + + + + + + + + + replace + + Sheet.53 +  MuxMCTPDriver + + + +  MuxMCTPDriver + + Sheet.55 + tx pkt_buf  + + + + tx pkt_buf  + + Rectangle.57 + + + + + + + Sheet.58 + + + + Sheet.59 + tx pkt_buf  + + + + tx pkt_buf  + + Sheet.60 +  I3CMCTPDevice + + + +  I3CMCTPDevice + + Line-curve connector.61 + take + + + + + + + + + + take + + Line-curve connector.63 + replace + + + + + + + + + + replace + + Rectangle.188 + + + + + + + Sheet.65 + I3CTarget driver + + + + I3CTarget driver + + Rectangle.66 + PEC + + + + + + + PEC + + Sheet.69 + MTU size with MCTP Header + payload + + + + MTU size with MCTP Header + payload + + Line-curve connector.71 + take + + + + + + + + + + take + + Line-curve connector.72 + replace + + + + + + + + + + replace + + Sheet.78 + + + + Line-curve connector.80 + tx_pkt send_done() + + + + + + + + + + tx_pkt send_done() + + Line-curve connector.82 + tx_pkt send_done() + + + + + + + + + + tx_pkt send_done() + + Line-curve connector.83 + msg_buffer send_done() + + + + + + + + + + msg_buffersend_done() + + Sheet.150 + + + + Dynamic connector.153 + packetize + + + + + packetize + + Sheet.167 + Private Read Transfer from I3C Target to I3C Controller + + + + Private Read Transfer from I3C Target to I3C Controller + + Dynamic connector.174 + copy + + + + + copy + + Dynamic connector.176 + copy + + + + + copy + + Rectangle.183 + + + + + + + Rectangle.184 + msg buffer + + + + + + + msg buffer + + Rectangle.185 + + + + + + + Rectangle.186 + msg buffer + + + + + + + msg buffer + + Sheet.189 + + Rectangle.31 + Vendor Def Msg App + + + + + + + Vendor Def Msg App + + Rectangle.180 + app buffer + + + + + + + app buffer + + + Sheet.190 + + Rectangle.30 + PLDM App + + + + + + + PLDM App + + Rectangle.33 + app buffer + + + + + + + app buffer + + + Sheet.191 + + Rectangle.29 + SPDM App + + + + + + + SPDM App + + Rectangle.181 + app buffer + + + + + + + app buffer + + + Sheet.194 + + Rectangle.5 + VirtualMCTPDriver + + + + + + + VirtualMCTPDriver + + Rectangle.179 + msg buffer + + + + + + + msg buffer + + + Dynamic connector.182 + copy + + + + + copy + + Sheet.201 + tx pkt_buf  + + + + tx pkt_buf  + + Rectangle.202 + PEC + + + + + + + PEC + + diff --git a/docs/src/images/mcu_stack.svg b/docs/src/images/mcu_stack.svg new file mode 100644 index 0000000..5d655d7 --- /dev/null +++ b/docs/src/images/mcu_stack.svg @@ -0,0 +1,2117 @@ + + + + + + + + + + + + + + Page-1 + + + + Sheet.1 + MCU ROM + + + + MCU ROM + + Sheet.2 + Software Emulator + + + + SoftwareEmulator + + Sheet.3 + FPGA + + + + FPGA + + Sheet.7 + TOCK Kernel + + + + TOCK Kernel + + Sheet.8 + UART Driver + + + + UARTDriver + + Sheet.10 + I3C Driver + + + + I3CDriver + + Sheet.11 + SPI Flash Driver (vendor) + + + + SPI FlashDriver(vendor) + + Sheet.12 + Fuse Controller Driver + + + + FuseControllerDriver + + Sheet.13 + Caliptra Mailbox Driver + + + + CaliptraMailboxDriver + + Sheet.14 + SOC Mailbox Driver + + + + SOCMailboxDriver + + Sheet.15 + MCTP + + + + MCTP + + Sheet.18 + PLDM + + + + PLDM + + Sheet.19 + OCP Streaming Boot + + + + OCPStreamingBoot + + Sheet.20 + SPDM IDE TDISP + + + + SPDMIDETDISP + + Sheet.21 + SPI Flash Boot + + + + SPI FlashBoot + + Sheet.23 + Async User Mode System Call Interface + + + + Async User Mode System Call Interface + + Sheet.24 + Image Loading + + + + Image Loading + + Sheet.25 + Attestation + + + + Attestation + + Sheet.26 + Firmware Signing Key Revocation + + + + Firmware Signing KeyRevocation + + Sheet.27 + Anti Rollback Protection + + + + Anti RollbackProtection + + Sheet.28 + Life Cycle Management + + + + Life Cycle Management + + Sheet.29 + Secure Debug Unlock + + + + Secure Debug Unlock + + Sheet.30 + Ownership Transfer + + + + Ownership Transfer + + Sheet.31 + Crypto API + + + + Crypto API + + Sheet.33 + Platform Message Handler + + + + PlatformMessage Handler + + Sheet.34 + SOC Message Handler + + + + SOCMessage Handler + + Sheet.35 + ROT Applications + + + + ROT Applications + + Side brace + Dev Platform + + + + + + + + + + + + + + + + + DevPlatform + + Side brace.37 + ROM + + + + + + + + + + + + + + + + + ROM + + Side brace.38 + Kernel & Drivers + + + + + + + + + + + + + + + + Kernel &Drivers + + Side brace.39 + Sys Calls + + + + + + + + + + + + + + + + + Sys Calls + + Side brace.40 + Stacks + + + + + + + + + + + + + + + + Stacks + + Side brace.41 + API & Services + + + + + + + + + + + + + + + + API &Services + + Side brace.42 + Message Handlers + + + + + + + + + + + + + + + + + MessageHandlers + + Side brace.43 + Apps + + + + + + + + + + + + + + + + + Apps + + Sheet.1000 + RTL Simulator + + + + RTL Simulator + + Sheet.1001 + Certificate Store + + + + CertificateStore + + Sheet.1002 + Key Value Store + + + + Key ValueStore + + Side brace.1003 + MCU SDK + + + + + + + + + + + + + + + + + MCUSDK + + Side brace.1004 + Silicon Vendor Provided + + + + + + + + + + + + + + + + + + SiliconVendorProvided + + Side brace.1005 + Silicon Vendor Provided + + + + + + + + + + + + + + + + + SiliconVendorProvided + + Side brace.1006 + MCU SDK Ref. HW + + + + + + + + + + + + + + + + + + MCU SDKRef. HW + + Sheet.1007 + Silicon Specific Drivers + + + + SiliconSpecificDrivers + + Sheet.1008 + Firmware Update + + + + FirmwareUpdate + + Sheet.1009 + MCTP Driver + + + + MCTPDriver + + Sheet.1010 + IDE & TDISP Driver (Vendor) + + + + IDE & TDISPDriver(Vendor) + + diff --git a/docs/src/mctp.md b/docs/src/mctp.md index d991b73..3ae8c52 100644 --- a/docs/src/mctp.md +++ b/docs/src/mctp.md @@ -9,38 +9,6 @@ MCTP Packets are delivered over physical I3C medium using I3C transfers. Caliptr managed by an external I3C controller. Minimum transmission size is based on the MCTP baseline MTU (for I3C it is 69 bytes: 64 bytes MCTP payload + 4 bytes MCTP header + 1 byte PEC). Larger than the baseline transfer may be possible after discovery and negotiation with the I3C controller. The negotiated MTU size will be queried from the I3C Target peripheral driver by MCTP capsule. -## MCTP Receive sequence - -```mermaid -sequenceDiagram - participant I3CController - participant I3CTarget - participant MCTPI3CBinding - participant MuxMCTPDriver - participant VirtualMCTPDriver - participant Application - loop Assemble packets until eom - I3CController--)I3CTarget: I3C Private Write transfer - I3CTarget->>MCTPI3CBinding: if no rx buffer, call write_expected() callback - MCTPI3CBinding->> MuxMCTPDriver: write_expected() callback - MuxMCTPDriver->>MCTPI3CBinding: set_rx_buffer() with buffer to receive packet - MCTPI3CBinding->> I3CTarget: set_rx_buffer() with buffer to receive the packet - I3CTarget--) I3CController : Send ACK - I3CController--)I3CTarget: MCTP packet - Note over I3CController, I3CTarget: Receive entire MCTP packet
including the PEC until Sr/P. - I3CTarget->> MCTPI3CBinding: receive() to receive the packet - MCTPI3CBinding ->> MCTPI3CBinding: Check the PEC, and pass the packet
with MCTPHeader to Mux MCTP layer - MCTPI3CBinding->>MuxMCTPDriver: receive() to receive the packet - MuxMCTPDriver->>MuxMCTPDriver: Process MCTP transport header on packet,
and assemble if matches any pending Rx states
or handle MCTP control msg. - end - MuxMCTPDriver->>VirtualMCTPDriver: receive() call to receive the assembled message. - VirtualMCTPDriver--)Application: Schedule upcall to receive the request/response. -``` - -The Receive stack is as shown in the picture below: - -![The MCTP Receive stack](images/MCTP_rx_stack.svg) - ## MCTP Send Sequence ```mermaid @@ -83,7 +51,38 @@ sequenceDiagram The send stack is as shown in the picture below: -![The MCTP Send stack](images/MCTP_tx_stack.svg) +![The MCTP Send stack](images/mctp_stack.svg) + + +## MCTP Receive sequence + +```mermaid +sequenceDiagram + participant I3CController + participant I3CTarget + participant MCTPI3CBinding + participant MuxMCTPDriver + participant VirtualMCTPDriver + participant Application + loop Assemble packets until eom + I3CController--)I3CTarget: I3C Private Write transfer + I3CTarget->>MCTPI3CBinding: if no rx buffer, call write_expected() callback + MCTPI3CBinding->> MuxMCTPDriver: write_expected() callback + MuxMCTPDriver->>MCTPI3CBinding: set_rx_buffer() with buffer to receive packet + MCTPI3CBinding->> I3CTarget: set_rx_buffer() with buffer to receive the packet + I3CTarget--) I3CController : Send ACK + I3CController--)I3CTarget: MCTP packet + Note over I3CController, I3CTarget: Receive entire MCTP packet
including the PEC until Sr/P. + I3CTarget->> MCTPI3CBinding: receive() to receive the packet + MCTPI3CBinding ->> MCTPI3CBinding: Check the PEC, and pass the packet
with MCTPHeader to Mux MCTP layer + MCTPI3CBinding->>MuxMCTPDriver: receive() to receive the packet + MuxMCTPDriver->>MuxMCTPDriver: Process MCTP transport header on packet,
and assemble if matches any pending Rx states
or handle MCTP control msg. + end + MuxMCTPDriver->>VirtualMCTPDriver: receive() call to receive the assembled message. + VirtualMCTPDriver--)Application: Schedule upcall to receive the request/response. +``` + +(The receive stack picture is nearly identical to the send stack above.)picture below: ## Syscall Library in userspace diff --git a/docs/src/mcu.md b/docs/src/mcu.md index ba6f794..ed7c2d9 100644 --- a/docs/src/mcu.md +++ b/docs/src/mcu.md @@ -1,5 +1,7 @@ # Caliptra Manufacturer Control Unit (MCU) Firmware and SDK +*Spec revision: 0.3* + The Caliptra MCU firmware is be provided as a reference software development kit (SDK) with a consistent foundation for building a quantum-resilient and standards-compliant Root of Trust (RoT) for SoC implementers. It extends the Caliptra core system to provide the Caliptra Subsystem set of services to the encompassing system. While Caliptra Core provides support for Identity, Secure Boot, Measured Boot, and Attestation, the Caliptra MCU firmware will be responsible for enabling Recovery, RoT Services, and Platform integration support. All SoC RoTs have specific initialization sequences and scenarios that need to be supported beyond standard RoT features. Hence, the MCU firmware will be distributed as Rust SDK with batteries included to build RoT Applications. @@ -10,6 +12,8 @@ The Caliptra MCU SDK is composed of two major parts: **Runtime**: The majority of the MCU firmware SDK is the runtime firmware, which provides the majority of the services after booting. Most of the documentation here consists of the documentation for the runtime. +![MCU Diagram](images/mcu_stack.svg) + ## Principles Caliptra 2.x firmware aspires to be the foundation for the RoT used in SoCs integrating Caliptra. Hence architecture, design and implementation must abide by certain guiding principles. Many of these principles are the founding principles for the Caliptra Project. diff --git a/docs/src/rom.md b/docs/src/rom.md index e4652f0..c767c63 100644 --- a/docs/src/rom.md +++ b/docs/src/rom.md @@ -1,6 +1,6 @@ -# ROM Specification +# Reference ROM Specification -The ROM is executed when the MCU starts. +The reference ROM is executed when the MCU starts. The ROM's main responsibilities to the overall Caliptra subsystem are to: