@@ -115,6 +115,7 @@ impl TryFromSerdeDirectoryEntryWithContext<SerdePspDirectoryEntry>
115
115
#[ non_exhaustive]
116
116
pub enum SerdePspEntrySourceValue {
117
117
PspSoftFuseChain ( PspSoftFuseChain ) ,
118
+ Unknown ( u64 ) ,
118
119
}
119
120
120
121
impl SerdePspEntrySourceValue {
@@ -123,21 +124,25 @@ impl SerdePspEntrySourceValue {
123
124
PspDirectoryEntryType :: PspSoftFuseChain => {
124
125
Ok ( Self :: PspSoftFuseChain ( PspSoftFuseChain :: from ( value) ) )
125
126
}
126
- _ => Err ( Error :: PspEntrySourceUnknown ( typ ) ) ,
127
+ _ => Ok ( SerdePspEntrySourceValue :: Unknown ( value ) ) ,
127
128
}
128
129
}
129
130
130
131
pub fn to_u64 (
131
132
& self ,
132
133
typ_or_err : std:: result:: Result < PspDirectoryEntryType , amd_efs:: Error > ,
133
134
) -> Result < u64 > {
134
- let typ = typ_or_err. unwrap ( ) ;
135
- match typ {
136
- PspDirectoryEntryType :: PspSoftFuseChain => match self {
137
- Self :: PspSoftFuseChain ( x) => Ok ( u64:: from ( * x) ) ,
135
+ if let SerdePspEntrySourceValue :: Unknown ( x) = self {
136
+ Ok ( * x)
137
+ } else {
138
+ let typ = typ_or_err. unwrap ( ) ;
139
+ match typ {
140
+ PspDirectoryEntryType :: PspSoftFuseChain => match self {
141
+ Self :: PspSoftFuseChain ( x) => Ok ( u64:: from ( * x) ) ,
142
+ _ => Err ( Error :: PspEntrySourceUnknown ( typ) ) ,
143
+ } ,
138
144
_ => Err ( Error :: PspEntrySourceUnknown ( typ) ) ,
139
- } ,
140
- _ => Err ( Error :: PspEntrySourceUnknown ( typ) ) ,
145
+ }
141
146
}
142
147
}
143
148
}
@@ -146,15 +151,14 @@ impl<'de> serde::Deserialize<'de> for SerdePspEntrySourceValue {
146
151
fn deserialize < D : serde:: Deserializer < ' de > > (
147
152
deserializer : D ,
148
153
) -> std:: result:: Result < Self , D :: Error > {
149
- // rest delegate to PspSoftFuseChain, if that makes sense.
150
154
struct ModeVisitor ;
151
155
impl < ' de > serde:: de:: Visitor < ' de > for ModeVisitor {
152
156
type Value = SerdePspEntrySourceValue ;
153
157
fn expecting (
154
158
& self ,
155
159
formatter : & mut core:: fmt:: Formatter < ' _ > ,
156
160
) -> core:: fmt:: Result {
157
- formatter. write_str ( "'Disabled', 'Enabled', 0 or 1 " )
161
+ formatter. write_str ( "dict " )
158
162
}
159
163
fn visit_map < A > (
160
164
self ,
@@ -169,7 +173,6 @@ impl<'de> serde::Deserialize<'de> for SerdePspEntrySourceValue {
169
173
) ?;
170
174
Ok ( SerdePspEntrySourceValue :: PspSoftFuseChain ( chain) )
171
175
}
172
-
173
176
fn visit_i64 < E : serde:: de:: Error > (
174
177
self ,
175
178
value : i64 ,
0 commit comments