mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 04:33:55 +00:00
doc: remove the vboot module design example from sw_design_guidelines.rst
Since de-privilege boot mode is removed and vboot module is completely rewritten. Tracked-On: #5197 Signed-off-by: Zide Chen <zide.chen@intel.com>
This commit is contained in:
parent
e46c5ac350
commit
456dd43187
Binary file not shown.
Before Width: | Height: | Size: 28 KiB |
@ -590,104 +590,6 @@ The following table shows some use cases of module level configuration design:
|
|||||||
configuration is dereferenced after it has been instantiated.
|
configuration is dereferenced after it has been instantiated.
|
||||||
|
|
||||||
|
|
||||||
Examples
|
|
||||||
========
|
|
||||||
|
|
||||||
Take the module for parsing boot information as an example to illustrate the
|
|
||||||
idea of module level configuration design.
|
|
||||||
|
|
||||||
.. figure:: images/boot_information_parsing_module.png
|
|
||||||
:align: center
|
|
||||||
:scale: 70 %
|
|
||||||
:name: boot_information_parsing_module
|
|
||||||
|
|
||||||
Boot Information Parsing Module
|
|
||||||
|
|
||||||
|
|
||||||
As shown in the source code below, 'struct firmware_operations' is an operations
|
|
||||||
data structure that contains a set of function pointers.
|
|
||||||
Different firmware may have different implementations:
|
|
||||||
|
|
||||||
- 'firmware_uefi_ops' is for UEFI platform;
|
|
||||||
- 'firmware_sbl_ops' is for SBL platform.
|
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: c
|
|
||||||
|
|
||||||
struct firmware_operations {
|
|
||||||
void (*init)(void);
|
|
||||||
uint64_t (*get_ap_trampoline)(void);
|
|
||||||
void *(*get_rsdp)(void);
|
|
||||||
void (*init_irq)(void);
|
|
||||||
int32_t (*init_vm_boot_info)(struct acrn_vm *vm);
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct firmware_operations firmware_uefi_ops = {
|
|
||||||
.init = uefi_init,
|
|
||||||
.get_ap_trampoline = uefi_get_ap_trampoline,
|
|
||||||
.get_rsdp = uefi_get_rsdp,
|
|
||||||
.init_irq = uefi_init_irq,
|
|
||||||
.init_vm_boot_info = uefi_init_vm_boot_info,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct firmware_operations firmware_sbl_ops = {
|
|
||||||
.init = sbl_init,
|
|
||||||
.get_ap_trampoline = sbl_get_ap_trampoline,
|
|
||||||
.get_rsdp = sbl_get_rsdp,
|
|
||||||
.init_irq = sbl_init_irq,
|
|
||||||
.init_vm_boot_info = sbl_init_vm_boot_info,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
'firmware_ops' is the operations set that is dereferenced and takes effect.
|
|
||||||
|
|
||||||
'init_firmware_operations' is called when the hypervisor is in DETECT mode and
|
|
||||||
'firmware_ops' is instantiated here to either 'firmware_uefi_ops' or
|
|
||||||
'firmware_sbl_ops' depending on the platform.
|
|
||||||
|
|
||||||
.. note:: All the other exported interfaces using 'firmware_ops' shall be called
|
|
||||||
after the instantiation.
|
|
||||||
|
|
||||||
|
|
||||||
.. code-block:: c
|
|
||||||
|
|
||||||
static struct firmware_operations *firmware_ops;
|
|
||||||
|
|
||||||
struct firmware_operations* uefi_get_firmware_operations(void)
|
|
||||||
{
|
|
||||||
return &firmware_uefi_ops;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct firmware_operations* sbl_get_firmware_operations(void)
|
|
||||||
{
|
|
||||||
return &firmware_sbl_ops;
|
|
||||||
}
|
|
||||||
|
|
||||||
void init_firmware_operations(void)
|
|
||||||
{
|
|
||||||
if (is_firmware_sbl()) {
|
|
||||||
firmware_ops = sbl_get_firmware_operations();
|
|
||||||
} else {
|
|
||||||
firmware_ops = uefi_get_firmware_operations();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
For example, when the hypervisor needs to initialize the VM boot information,
|
|
||||||
it calls 'firmware_init_vm_boot_info' and 'firmware_ops->init_vm_boot_info' is
|
|
||||||
dereferenced here with correct API being called.
|
|
||||||
|
|
||||||
.. code-block:: c
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @pre firmware_ops->init_vm_boot_info != NULL
|
|
||||||
*/
|
|
||||||
int32_t firmware_init_vm_boot_info(struct acrn_vm *vm)
|
|
||||||
{
|
|
||||||
return firmware_ops->init_vm_boot_info(vm);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
References
|
References
|
||||||
**********
|
**********
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user