@@ -49,6 +49,37 @@ static void mb2_mods_to_mbi(struct acrn_multiboot_info *mbi,
49
49
mbi -> mi_flags |= MULTIBOOT_INFO_HAS_MODS ;
50
50
}
51
51
52
+ /**
53
+ * @pre mbi != NULL && mb2_tag_efi64 != 0
54
+ */
55
+ static void mb2_efi64_to_mbi (struct acrn_multiboot_info * mbi , struct multiboot2_tag_efi64 * mb2_tag_efi64 )
56
+ {
57
+ mbi -> mi_efi_info .efi_systab = (uint32_t )(uint64_t )mb2_tag_efi64 -> pointer ;
58
+ mbi -> mi_efi_info .efi_loader_signature = (uint32_t )(uint64_t )efiloader_sig ;
59
+ mbi -> mi_flags |= MULTIBOOT_INFO_HAS_EFI64 ;
60
+ }
61
+
62
+ /**
63
+ * @pre mbi != NULL && mb2_tag_efimmap != 0
64
+ */
65
+ static int32_t mb2_efimmap_to_mbi (struct acrn_multiboot_info * mbi , struct multiboot2_tag_efi_mmap * mb2_tag_efimmap )
66
+ {
67
+ int32_t ret = 0 ;
68
+
69
+ mbi -> mi_efi_info .efi_memdesc_size = mb2_tag_efimmap -> descr_size ;
70
+ mbi -> mi_efi_info .efi_memdesc_version = mb2_tag_efimmap -> descr_vers ;
71
+ mbi -> mi_efi_info .efi_memmap = (uint32_t )(uint64_t )mb2_tag_efimmap -> efi_mmap ;
72
+ mbi -> mi_efi_info .efi_memmap_size = mb2_tag_efimmap -> size - 16U ;
73
+ mbi -> mi_efi_info .efi_memmap_hi = (uint32_t )(((uint64_t )mb2_tag_efimmap -> efi_mmap ) >> 32U );
74
+ if (mbi -> mi_efi_info .efi_memmap_hi != 0U ) {
75
+ pr_err ("the efi mmap address should be less than 4G!" );
76
+ ret = - EINVAL ;
77
+ } else {
78
+ mbi -> mi_flags |= MULTIBOOT_INFO_HAS_EFI64 ;
79
+ }
80
+ return ret ;
81
+ }
82
+
52
83
/**
53
84
* @pre mbi != NULL && mb2_info != NULL
54
85
*/
@@ -84,6 +115,12 @@ int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info)
84
115
case MULTIBOOT2_TAG_TYPE_ACPI_NEW :
85
116
mbi -> mi_acpi_rsdp = ((struct multiboot2_tag_new_acpi * )mb2_tag )-> rsdp ;
86
117
break ;
118
+ case MULTIBOOT2_TAG_TYPE_EFI64 :
119
+ mb2_efi64_to_mbi (mbi , (struct multiboot2_tag_efi64 * )mb2_tag );
120
+ break ;
121
+ case MULTIBOOT2_TAG_TYPE_EFI_MMAP :
122
+ ret = mb2_efimmap_to_mbi (mbi , (struct multiboot2_tag_efi_mmap * )mb2_tag );
123
+ break ;
87
124
default :
88
125
if (mb2_tag -> type <= MULTIBOOT2_TAG_TYPE_LOAD_BASE_ADDR ) {
89
126
pr_warn ("unhandled multiboot2 tag type: %d" , mb2_tag -> type );
@@ -104,5 +141,8 @@ int32_t multiboot2_to_acrn_mbi(struct acrn_multiboot_info *mbi, void *mb2_info)
104
141
mb2_tag = (struct multiboot2_tag * )((uint8_t * )mb2_tag
105
142
+ ((mb2_tag -> size + (MULTIBOOT2_INFO_ALIGN - 1U )) & ~(MULTIBOOT2_INFO_ALIGN - 1U )));
106
143
}
144
+ if ((mbi -> mi_flags & (MULTIBOOT_INFO_HAS_EFI64 | MULTIBOOT_INFO_HAS_EFI_MMAP )) == 0U ) {
145
+ pr_err ("no multiboot2 uefi info found!" );
146
+ }
107
147
return ret ;
108
148
}
0 commit comments