6
6
//! - [`EFIImageHandle64Tag`]
7
7
//! - [`EFIBootServicesNotExitedTag`]
8
8
9
- use crate :: TagTypeId ;
9
+ use crate :: tag :: TagHeader ;
10
10
use crate :: { Tag , TagTrait , TagType } ;
11
11
use core:: mem:: size_of;
12
12
13
13
/// EFI system table in 32 bit mode tag.
14
14
#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
15
15
#[ repr( C ) ]
16
16
pub struct EFISdt32Tag {
17
- typ : TagTypeId ,
18
- size : u32 ,
17
+ header : TagHeader ,
19
18
pointer : u32 ,
20
19
}
21
20
22
21
impl EFISdt32Tag {
23
22
/// Create a new tag to pass the EFI32 System Table pointer.
24
23
pub fn new ( pointer : u32 ) -> Self {
25
24
Self {
26
- typ : Self :: ID . into ( ) ,
27
- size : size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ,
25
+ header : TagHeader :: new ( Self :: ID , size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ) ,
28
26
pointer,
29
27
}
30
28
}
@@ -45,17 +43,15 @@ impl TagTrait for EFISdt32Tag {
45
43
#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
46
44
#[ repr( C ) ]
47
45
pub struct EFISdt64Tag {
48
- typ : TagTypeId ,
49
- size : u32 ,
46
+ header : TagHeader ,
50
47
pointer : u64 ,
51
48
}
52
49
53
50
impl EFISdt64Tag {
54
51
/// Create a new tag to pass the EFI64 System Table pointer.
55
52
pub fn new ( pointer : u64 ) -> Self {
56
53
Self {
57
- typ : Self :: ID . into ( ) ,
58
- size : size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ,
54
+ header : TagHeader :: new ( Self :: ID , size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ) ,
59
55
pointer,
60
56
}
61
57
}
@@ -77,17 +73,15 @@ impl TagTrait for EFISdt64Tag {
77
73
#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
78
74
#[ repr( C ) ]
79
75
pub struct EFIImageHandle32Tag {
80
- typ : TagTypeId ,
81
- size : u32 ,
76
+ header : TagHeader ,
82
77
pointer : u32 ,
83
78
}
84
79
85
80
impl EFIImageHandle32Tag {
86
81
#[ cfg( feature = "builder" ) ]
87
82
pub fn new ( pointer : u32 ) -> Self {
88
83
Self {
89
- typ : Self :: ID . into ( ) ,
90
- size : size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ,
84
+ header : TagHeader :: new ( Self :: ID , size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ) ,
91
85
pointer,
92
86
}
93
87
}
@@ -109,17 +103,15 @@ impl TagTrait for EFIImageHandle32Tag {
109
103
#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
110
104
#[ repr( C ) ]
111
105
pub struct EFIImageHandle64Tag {
112
- typ : TagTypeId ,
113
- size : u32 ,
106
+ header : TagHeader ,
114
107
pointer : u64 ,
115
108
}
116
109
117
110
impl EFIImageHandle64Tag {
118
111
#[ cfg( feature = "builder" ) ]
119
112
pub fn new ( pointer : u64 ) -> Self {
120
113
Self {
121
- typ : Self :: ID . into ( ) ,
122
- size : size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ,
114
+ header : TagHeader :: new ( Self :: ID , size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ) ,
123
115
pointer,
124
116
}
125
117
}
@@ -140,8 +132,7 @@ impl TagTrait for EFIImageHandle64Tag {
140
132
#[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
141
133
#[ repr( C ) ]
142
134
pub struct EFIBootServicesNotExitedTag {
143
- typ : TagTypeId ,
144
- size : u32 ,
135
+ header : TagHeader ,
145
136
}
146
137
147
138
impl EFIBootServicesNotExitedTag {
@@ -155,8 +146,7 @@ impl EFIBootServicesNotExitedTag {
155
146
impl Default for EFIBootServicesNotExitedTag {
156
147
fn default ( ) -> Self {
157
148
Self {
158
- typ : TagType :: EfiBs . into ( ) ,
159
- size : core:: mem:: size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ,
149
+ header : TagHeader :: new ( Self :: ID , size_of :: < Self > ( ) . try_into ( ) . unwrap ( ) ) ,
160
150
}
161
151
}
162
152
}
0 commit comments