@@ -1234,66 +1234,87 @@ fn prepare_bhd_directory_contents<'a>(
1234
1234
}
1235
1235
let source = entry. source ;
1236
1236
let blob_slot_settings = entry. target . blob ;
1237
- let flash_location =
1238
- blob_slot_settings. as_ref ( ) . and_then ( |x| x. flash_location )
1237
+ let flash_location = blob_slot_settings
1238
+ . as_ref ( )
1239
+ . and_then ( |x| x. flash_location )
1239
1240
// AMD sometimes uses target.flash_location=Some(0) together
1240
1241
// with Implied to mean "No flash location".
1241
1242
// Ignore that (definitely do not allocate that on the flash).
1242
- . filter ( |& loc| !( matches ! ( source, SerdeBhdSource :: Implied ) && loc == 0 ) ) ;
1243
+ . filter ( |& loc| {
1244
+ !( matches ! ( source, SerdeBhdSource :: Implied ) && loc == 0 )
1245
+ } ) ;
1243
1246
1244
1247
// done by try_from: raw_entry.set_destination_location(ram_destination_address);
1245
1248
// done by try_from: raw_entry.set_size(size);
1246
1249
match source {
1247
- SerdeBhdSource :: Implied => {
1248
- match entry. target . attrs . type_ {
1249
- BhdDirectoryEntryType :: Apob => {
1250
- assert ! ( flash_location. is_none( ) , "You specified a
1250
+ SerdeBhdSource :: Implied => match entry. target . attrs . type_ {
1251
+ BhdDirectoryEntryType :: Apob => {
1252
+ assert ! (
1253
+ flash_location. is_none( ) ,
1254
+ "You specified a
1251
1255
fixed flash location for {typ} but it has
1252
1256
an Implied source. What does that mean?" ,
1253
- typ = entry. target. attrs. type_) ;
1254
- custom_apob = Some ( raw_entry. destination_location ( )
1255
- . expect ( "destination address" ) ) ;
1256
- raw_entry. set_size ( Some ( 0 ) ) ;
1257
- vec ! [ ( raw_entry, None , None ) ]
1258
- }
1259
- BhdDirectoryEntryType :: ApobNvCopy => {
1260
- assert ! ( raw_entry. destination_location( ) . is_none( ) ,
1261
- "You specified a fixed RAM location for
1257
+ typ = entry. target. attrs. type_
1258
+ ) ;
1259
+ custom_apob = Some (
1260
+ raw_entry
1261
+ . destination_location ( )
1262
+ . expect ( "destination address" ) ,
1263
+ ) ;
1264
+ raw_entry. set_size ( Some ( 0 ) ) ;
1265
+ vec ! [ ( raw_entry, None , None ) ]
1266
+ }
1267
+ BhdDirectoryEntryType :: ApobNvCopy => {
1268
+ assert ! (
1269
+ raw_entry. destination_location( ) . is_none( ) ,
1270
+ "You specified a fixed RAM location for
1262
1271
{typ}. What does that mean?" ,
1263
- typ = entry. target. attrs. type_) ;
1264
- assert ! ( flash_location. is_some( ) , "You did not
1272
+ typ = entry. target. attrs. type_
1273
+ ) ;
1274
+ assert ! (
1275
+ flash_location. is_some( ) ,
1276
+ "You did not
1265
1277
specify a flash location for {typ}." ,
1266
- typ = entry. target. attrs. type_) ;
1267
- assert_ne ! ( raw_entry. size( ) , Some ( 0 ) , "You did not
1278
+ typ = entry. target. attrs. type_
1279
+ ) ;
1280
+ assert_ne ! (
1281
+ raw_entry. size( ) ,
1282
+ Some ( 0 ) ,
1283
+ "You did not
1268
1284
specify a size for {typ}." ,
1269
- typ = entry. target. attrs. type_) ;
1270
- vec ! [ ( raw_entry, None , None ) ]
1271
- }
1272
- _ => {
1273
- panic ! ( "Implied source is only supported for Apob
1285
+ typ = entry. target. attrs. type_
1286
+ ) ;
1287
+ vec ! [ ( raw_entry, None , None ) ]
1288
+ }
1289
+ _ => {
1290
+ panic ! (
1291
+ "Implied source is only supported for Apob
1274
1292
and ApobNvCopy, not {typ}. Are you sure you
1275
1293
want to do that?" ,
1276
- typ = entry. target. attrs. type_) ;
1277
- }
1294
+ typ = entry. target. attrs. type_
1295
+ ) ;
1278
1296
}
1279
-
1280
- }
1297
+ } ,
1281
1298
SerdeBhdSource :: BlobFile ( blob_filename) => {
1282
- assert_ne ! ( entry. target. attrs. type_, BhdDirectoryEntryType :: Apob ,
1283
- "You specified a Blob for Apob? What does that mean?" ) ;
1299
+ assert_ne ! (
1300
+ entry. target. attrs. type_,
1301
+ BhdDirectoryEntryType :: Apob ,
1302
+ "You specified a Blob for Apob? What does that mean?"
1303
+ ) ;
1284
1304
let blob_filename = resolve_blob ( blob_filename) . unwrap ( ) ;
1285
1305
let body = std:: fs:: read ( blob_filename) . unwrap ( ) ;
1286
1306
raw_entry. set_size ( Some ( body. len ( ) . try_into ( ) . unwrap ( ) ) ) ;
1287
1307
vec ! [ ( raw_entry, flash_location, Some ( body) ) ]
1288
1308
}
1289
1309
SerdeBhdSource :: ApcbJson ( apcb) => {
1290
- assert ! ( generate_is_context_valid( processor_generation, & apcb) ) ;
1310
+ assert ! ( generate_is_context_valid(
1311
+ processor_generation,
1312
+ & apcb
1313
+ ) ) ;
1291
1314
// Note: We need to do this
1292
1315
// manually because validation
1293
1316
// needs ABL_VERSION.
1294
- apcb. validate ( None )
1295
- . map_err ( apcb_to_io_error)
1296
- . unwrap ( ) ;
1317
+ apcb. validate ( None ) . map_err ( apcb_to_io_error) . unwrap ( ) ;
1297
1318
let buf =
1298
1319
apcb. save_no_inc ( ) . map_err ( apcb_to_io_error) . unwrap ( ) ;
1299
1320
let bufref = buf. as_ref ( ) ;
0 commit comments