2
2
use crate :: builder:: traits:: StructAsBytes ;
3
3
use crate :: {
4
4
BasicMemoryInfoTag , BootInformationInner , BootLoaderNameTag , CommandLineTag , EFISdt32 ,
5
- EFISdt64 , ElfSectionsTag , EndTag , FramebufferTag , MemoryMapTag , ModuleTag ,
5
+ EFISdt64 , ElfSectionsTag , EndTag , FramebufferTag , MemoryMapTag , ModuleTag , SmbiosTag ,
6
6
} ;
7
7
8
8
use alloc:: boxed:: Box ;
@@ -23,6 +23,7 @@ pub struct Multiboot2InformationBuilder {
23
23
module_tags : Vec < Box < ModuleTag > > ,
24
24
efisdt32 : Option < EFISdt32 > ,
25
25
efisdt64 : Option < EFISdt64 > ,
26
+ smbios_tags : Vec < Box < SmbiosTag > > ,
26
27
}
27
28
28
29
impl Multiboot2InformationBuilder {
@@ -37,6 +38,7 @@ impl Multiboot2InformationBuilder {
37
38
framebuffer_tag : None ,
38
39
memory_map_tag : None ,
39
40
module_tags : Vec :: new ( ) ,
41
+ smbios_tags : Vec :: new ( ) ,
40
42
}
41
43
}
42
44
@@ -88,6 +90,9 @@ impl Multiboot2InformationBuilder {
88
90
for tag in & self . module_tags {
89
91
len += Self :: size_or_up_aligned ( tag. byte_size ( ) )
90
92
}
93
+ for tag in & self . smbios_tags {
94
+ len += Self :: size_or_up_aligned ( tag. byte_size ( ) )
95
+ }
91
96
// only here size_or_up_aligned is not important, because it is the last tag
92
97
len += size_of :: < EndTag > ( ) ;
93
98
len
@@ -145,6 +150,9 @@ impl Multiboot2InformationBuilder {
145
150
for tag in self . module_tags {
146
151
Self :: build_add_bytes ( & mut data, & tag. struct_as_bytes ( ) , false )
147
152
}
153
+ for tag in self . smbios_tags {
154
+ Self :: build_add_bytes ( & mut data, & tag. struct_as_bytes ( ) , false )
155
+ }
148
156
149
157
Self :: build_add_bytes ( & mut data, & EndTag :: default ( ) . struct_as_bytes ( ) , true ) ;
150
158
@@ -186,6 +194,10 @@ impl Multiboot2InformationBuilder {
186
194
pub fn add_module_tag ( & mut self , module_tag : Box < ModuleTag > ) {
187
195
self . module_tags . push ( module_tag) ;
188
196
}
197
+
198
+ pub fn add_smbios_tag ( & mut self , smbios_tag : Box < SmbiosTag > ) {
199
+ self . smbios_tags . push ( smbios_tag) ;
200
+ }
189
201
}
190
202
191
203
#[ cfg( test) ]
0 commit comments