Quellcode durchsuchen

Update private SBI function to K210 implementation

luojia65 vor 4 Jahren
Ursprung
Commit
61e2ce18b0
1 geänderte Dateien mit 38 neuen und 0 gelöschten Zeilen
  1. 38 0
      platform/k210/README.md

+ 38 - 0
platform/k210/README.md

@@ -3,6 +3,8 @@
 Kendryte K210 is a dual-core RISC-V RV64GC chip with hardware accelerated AI peripheral.
 According to its manual, K210 is taped out in TSMC 7nm and can speed up to 400MHz.
 
+## Implementation details
+
 The K210 SoC implements version 1.9.1 of RISC-V's privileged specification.
 This version differents from latest version (by current version 1.11) in the following aspects:
 
@@ -20,3 +22,39 @@ Machine external handler and timer set calls is modified to meet the requirement
 interrupt handlers.
 
 If there are mistakes or missing features in current support module, we welcome further contributions!
+
+## Private SBI functions
+
+To solve the issue 3 in previous section, RustSBI's current implementation includes a RustSBI specific
+SBI call as a function. 
+
+The K210 supervisor-level external interrupt handler register function is declared as:
+
+```rust
+fn sbi_rustsbi_k210_sext(phys_addr: usize) -> SbiRet;
+```
+
+This function registers a device interrupt handler to machine level environment. 
+On any machine-level external interrupt, the RustSBI's K210 environment would call the function provided.
+
+The function's physical address shall be stored in register `a0` before calling this function.
+RustSBI will regard `a0` as a function wiout any parameters and any return values, or a `phys_addr: fn()`.
+
+This function will always return `SbiRet` value of `SBI_SUCCESS`.
+
+### Function Listing
+
+According to RISC-V SBI specification:
+
+> Firmware Code Base Specific SBI Extension Space, Extension Ids 0x0A000000 through 0x0AFFFFFF
+> 
+> Low bits is SBI implementation ID. The firmware code base SBI extension is the additional SBI extensions to SBI
+> implementation. That provides the firmware code base specific SBI functions which are defined in the external
+> firmware specification.
+
+Since RustSBI has the implementation ID 4, its specific SBI extension is `0x0A000004`. We add a function
+to this specific SBI extension.
+
+| Function Name | Function ID | Extension ID |
+|:-----|:----|:----|
+| sbi_rustsbi_k210_sext | 0x210 | 0x0A000004 |