|
| 1 | +use axplat::init::InitIf; |
| 2 | + |
| 3 | +struct InitIfImpl; |
| 4 | + |
| 5 | +#[impl_plat_interface] |
| 6 | +impl InitIf for InitIfImpl { |
| 7 | + /// Initializes the platform at the early stage for the primary core. |
| 8 | + /// |
| 9 | + /// This function should be called immediately after the kernel has booted, |
| 10 | + /// and performed earliest platform configuration and initialization (e.g., |
| 11 | + /// early console, clocking). |
| 12 | + /// |
| 13 | + /// # Arguments |
| 14 | + /// |
| 15 | + /// * `cpu_id` is the logical CPU ID (0, 1, ..., N-1, N is the number of CPU |
| 16 | + /// cores on the platform). |
| 17 | + /// * `arg` is passed from the bootloader (typically the device tree blob |
| 18 | + /// address). |
| 19 | + /// |
| 20 | + /// # Before calling this function |
| 21 | + /// |
| 22 | + /// * CPU is booted in the kernel mode. |
| 23 | + /// * Early page table is set up, virtual memory is enabled. |
| 24 | + /// * CPU-local data is initialized. |
| 25 | + /// |
| 26 | + /// # After calling this function |
| 27 | + /// |
| 28 | + /// * Exception & interrupt handlers are set up. |
| 29 | + /// * Early console is initialized. |
| 30 | + /// * Current monotonic time and wall time can be obtained. |
| 31 | + fn init_early(cpu_id: usize, arg: usize) { |
| 32 | + todo!() |
| 33 | + } |
| 34 | + |
| 35 | + /// Initializes the platform at the early stage for secondary cores. |
| 36 | + /// |
| 37 | + /// See [`init_early`] for details. |
| 38 | + fn init_early_secondary(cpu_id: usize) { |
| 39 | + todo!() |
| 40 | + } |
| 41 | + |
| 42 | + /// Initializes the platform at the later stage for the primary core. |
| 43 | + /// |
| 44 | + /// This function should be called after the kernel has done part of its |
| 45 | + /// initialization (e.g, logging, memory management), and finalized the rest of |
| 46 | + /// platform configuration and initialization. |
| 47 | + /// |
| 48 | + /// # Arguments |
| 49 | + /// |
| 50 | + /// * `cpu_id` is the logical CPU ID (0, 1, ..., N-1, N is the number of CPU |
| 51 | + /// cores on the platform). |
| 52 | + /// * `arg` is passed from the bootloader (typically the device tree blob |
| 53 | + /// address). |
| 54 | + /// |
| 55 | + /// # Before calling this function |
| 56 | + /// |
| 57 | + /// * Kernel logging is initialized. |
| 58 | + /// * Fine-grained kernel page table is set up (if applicable). |
| 59 | + /// * Physical memory allocation is initialized (if applicable). |
| 60 | + /// |
| 61 | + /// # After calling this function |
| 62 | + /// |
| 63 | + /// * Interrupt controller is initialized (if applicable). |
| 64 | + /// * Timer interrupts are enabled (if applicable). |
| 65 | + /// * Other platform devices are initialized. |
| 66 | + fn init_later(cpu_id: usize, arg: usize) { |
| 67 | + todo!() |
| 68 | + } |
| 69 | + |
| 70 | + /// Initializes the platform at the later stage for secondary cores. |
| 71 | + /// |
| 72 | + /// See [`init_later`] for details. |
| 73 | + fn init_later_secondary(cpu_id: usize) { |
| 74 | + todo!() |
| 75 | + } |
| 76 | +} |
0 commit comments