mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-06-03 08:38:48 -04:00
Add Insyde Flash Device Map parser
This commit is contained in:
parent
b98edf6944
commit
58366f48fe
28 changed files with 1361 additions and 230 deletions
|
@ -11,18 +11,11 @@ meta:
|
|||
|
||||
seq:
|
||||
- id: signature
|
||||
type: u4
|
||||
size: 16
|
||||
valid:
|
||||
expr: _ == 0xFFF12B8D or _ == 0x9E58292B
|
||||
- id: signature_main
|
||||
contents: [0x96, 0x76, 0x8B, 0x4C, 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50] # FF12B8D-7696-4C8B-A985-2747075B4F50
|
||||
if: signature == 0xFFF12B8D
|
||||
- id: signature_edk2_working_block
|
||||
contents: [0x68, 0x7C, 0x7D, 0x49, 0x0A, 0xCE, 0x65, 0x00, 0xFD, 0x9F, 0x1B, 0x95] # 9E58292B-7C68-497D-0ACE-6500FD9F1B95
|
||||
if: signature == 0x9E58292B
|
||||
- id: signature_vss2_working_block
|
||||
contents: [0x68, 0x7C, 0x7D, 0x49, 0xA0, 0xCE, 0x65, 0x00, 0xFD, 0x9F, 0x1B, 0x95] # 9E58292B-7C68-497D-A0CE-6500FD9F1B95
|
||||
if: signature == 0x9E58292B
|
||||
expr: _ == [0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C, 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50]
|
||||
or _ == [0x2B, 0x29, 0x58, 0x9E, 0x68, 0x7C, 0x7D, 0x49, 0x0A, 0xCE, 0x65, 0x00, 0xFD, 0x9F, 0x1B, 0x95]
|
||||
or _ == [0x2B, 0x29, 0x58, 0x9E, 0x68, 0x7C, 0x7D, 0x49, 0xA0, 0xCE, 0x65, 0x00, 0xFD, 0x9F, 0x1B, 0x95]
|
||||
- id: crc
|
||||
type: u4
|
||||
- id: state
|
||||
|
|
|
@ -13,7 +13,7 @@ seq:
|
|||
- id: signature
|
||||
type: u4
|
||||
valid:
|
||||
expr: _ == 0xDDCF3616 or _ == 0xDDCF3617 or _ == 0xAAF32C78 # Beginning of known store GUIDs for VSS2
|
||||
expr: _ == 0xDDCF3616 or _ == 0xDDCF3617 or _ == 0xAAF32C78 # Beginning of known store GUIDs for VSS2
|
||||
- id: signature_auth_var_key_db
|
||||
contents: [0x7B, 0x94, 0x9A, 0x43, 0xA1, 0x80, 0x2E, 0x14, 0x4E, 0xC3, 0x77, 0x92] # AAF32C78-947B-439A-A180-2E144EC37792
|
||||
if: signature == 0xAAF32C78
|
||||
|
@ -26,7 +26,7 @@ seq:
|
|||
- id: vss2_size
|
||||
type: u4
|
||||
valid:
|
||||
expr: _ > len_vss2_store_header.as<u4> and _ < 0xFFFFFFFF
|
||||
expr: _ > len_vss2_store_header.as<u4> and _ < 0xFFFFFFFF
|
||||
- id: format
|
||||
type: u1
|
||||
valid:
|
||||
|
@ -40,6 +40,7 @@ seq:
|
|||
- id: body
|
||||
type: vss2_store_body
|
||||
size: vss2_size - len_vss2_store_header
|
||||
|
||||
instances:
|
||||
len_vss2_store_header:
|
||||
value: 7 * sizeof<u4>
|
||||
|
@ -71,7 +72,6 @@ types:
|
|||
- id: reserved
|
||||
type: b25le
|
||||
|
||||
# TODO: check if VSS2 stores can have standard VSS variables
|
||||
vss2_variable:
|
||||
seq:
|
||||
- id: invoke_offset
|
||||
|
@ -82,7 +82,7 @@ types:
|
|||
- id: signature_last
|
||||
type: u1
|
||||
valid:
|
||||
expr: _ == 0x55
|
||||
expr: _ == 0x55
|
||||
if: signature_first == 0xAA
|
||||
- id: state
|
||||
type: u1
|
||||
|
@ -152,7 +152,7 @@ types:
|
|||
len_alignment_padding:
|
||||
value: (((end_offset - offset)+3) & ~3) - (end_offset - offset)
|
||||
len_alignment_padding_auth:
|
||||
value: (((end_offset_auth - offset)+3) & ~3) - (end_offset - offset)
|
||||
value: (((end_offset_auth - offset)+3) & ~3) - (end_offset_auth - offset)
|
||||
is_valid:
|
||||
value: state == 0x7F or state == 0x3F
|
||||
is_auth:
|
||||
|
|
91
common/ksy/insyde_fdm.ksy
Normal file
91
common/ksy/insyde_fdm.ksy
Normal file
|
@ -0,0 +1,91 @@
|
|||
meta:
|
||||
id: insyde_fdm
|
||||
title: Insyde Flash Device
|
||||
application: Insyde-based UEFI firmware
|
||||
file-extension: fdm
|
||||
tags:
|
||||
- firmware
|
||||
license: CC0-1.0
|
||||
ks-version: 0.9
|
||||
endian: le
|
||||
|
||||
seq:
|
||||
- id: signature
|
||||
type: u4
|
||||
valid: 0x4D444648 # HFDM
|
||||
- id: store_size
|
||||
type: u4
|
||||
- id: data_offset
|
||||
type: u4
|
||||
- id: entry_size
|
||||
type: u4
|
||||
- id: entry_format
|
||||
type: u1
|
||||
- id: revision
|
||||
type: u1
|
||||
- id: num_extensions
|
||||
type: u1
|
||||
- id: checksum
|
||||
type: u1
|
||||
- id: fd_base_address
|
||||
type: u8
|
||||
- id: extensions
|
||||
type: fdm_extensions
|
||||
size: num_extensions * sizeof<fdm_extension>
|
||||
if: revision == 3
|
||||
- id: board_ids
|
||||
type: fdm_board_ids
|
||||
if: revision == 3
|
||||
- id: entries
|
||||
type: fdm_entries
|
||||
size: store_size - data_offset
|
||||
|
||||
types:
|
||||
fdm_extensions:
|
||||
seq:
|
||||
- id: extensions
|
||||
type: fdm_extension
|
||||
repeat: eos
|
||||
|
||||
fdm_extension:
|
||||
seq:
|
||||
- id: offset
|
||||
type: u2
|
||||
- id: count
|
||||
type: u2
|
||||
|
||||
fdm_board_ids:
|
||||
seq:
|
||||
- id: region_index
|
||||
type: u4
|
||||
- id: num_board_ids
|
||||
type: u4
|
||||
- id: board_ids
|
||||
type: u8
|
||||
repeat: expr
|
||||
repeat-expr: num_board_ids
|
||||
|
||||
fdm_entries:
|
||||
seq:
|
||||
- id: entries
|
||||
type: fdm_entry
|
||||
repeat: eos
|
||||
|
||||
fdm_entry:
|
||||
seq:
|
||||
- id: guid
|
||||
size: 16
|
||||
- id: region_id
|
||||
size: 16
|
||||
- id: region_offset
|
||||
type: u8
|
||||
- id: region_size
|
||||
type: u8
|
||||
- id: attributes
|
||||
type: u4
|
||||
- id: hash
|
||||
size: _parent._parent.entry_size - 16 - 16 - 8 - 8 - 4
|
||||
instances:
|
||||
region_base:
|
||||
value: _root.fd_base_address.as<u4> + region_offset.as<u4>
|
||||
|
|
@ -15,22 +15,22 @@ seq:
|
|||
valid: 0xEC
|
||||
- id: checksum
|
||||
type: u1
|
||||
- id: size
|
||||
- id: len_evsa_store_header
|
||||
type: u2
|
||||
valid: 20
|
||||
- id: signature
|
||||
type: u4
|
||||
valid: 0x41535645
|
||||
valid: 0x41535645 #EVSA
|
||||
- id: attributes
|
||||
type: u4
|
||||
- id: store_size
|
||||
- id: len_evsa_store
|
||||
type: u4
|
||||
- id: reserved
|
||||
type: u4
|
||||
- id: body
|
||||
type: evsa_body
|
||||
size: store_size - 20
|
||||
|
||||
size: len_evsa_store - len_evsa_store_header
|
||||
|
||||
types:
|
||||
evsa_guid:
|
||||
seq:
|
||||
|
@ -38,14 +38,39 @@ types:
|
|||
type: u2
|
||||
- id: guid
|
||||
size: 16
|
||||
valid:
|
||||
expr: _parent.len_evsa_entry == 22
|
||||
|
||||
evsa_name:
|
||||
seq:
|
||||
- id: var_id
|
||||
type: u2
|
||||
- id: name
|
||||
size: _parent.size - 6
|
||||
size: _parent.len_evsa_entry - 6
|
||||
|
||||
evsa_variable_attributes:
|
||||
seq:
|
||||
- id: non_volatile
|
||||
type: b1le
|
||||
- id: boot_service
|
||||
type: b1le
|
||||
- id: runtime
|
||||
type: b1le
|
||||
- id: hw_error_record
|
||||
type: b1le
|
||||
- id: auth_write
|
||||
type: b1le
|
||||
- id: time_based_auth
|
||||
type: b1le
|
||||
- id: append_write
|
||||
type: b1le
|
||||
- id: reserved
|
||||
type: b21le
|
||||
- id: extended_header
|
||||
type: b1le
|
||||
- id: reserved1
|
||||
type: b3le
|
||||
|
||||
evsa_data:
|
||||
seq:
|
||||
- id: guid_id
|
||||
|
@ -53,33 +78,47 @@ types:
|
|||
- id: var_id
|
||||
type: u2
|
||||
- id: attributes
|
||||
type: evsa_variable_attributes
|
||||
- id: len_data_ext
|
||||
type: u4
|
||||
- id: data_size
|
||||
type: u4
|
||||
if: (attributes & 0x10000000) != 0x10000000
|
||||
if: attributes.extended_header
|
||||
- id: data
|
||||
size: _parent.size - 12
|
||||
if: (attributes & 0x10000000) == 0x10000000
|
||||
size: _parent.len_evsa_entry - 12
|
||||
if: not attributes.extended_header
|
||||
- id: data_ext
|
||||
size: data_size
|
||||
if: (attributes & 0x10000000) != 0x10000000
|
||||
size: len_data_ext
|
||||
if: attributes.extended_header
|
||||
|
||||
evsa_unknown:
|
||||
seq:
|
||||
- id: unknown
|
||||
- id: unknown
|
||||
size: 0
|
||||
|
||||
|
||||
evsa_entry:
|
||||
seq:
|
||||
- id: type
|
||||
- id: entry_type
|
||||
type: u1
|
||||
- id: checksum
|
||||
type: u1
|
||||
- id: size
|
||||
if: entry_type == 0xE1
|
||||
or entry_type == 0xE2
|
||||
or entry_type == 0xE3
|
||||
or entry_type == 0xED
|
||||
or entry_type == 0xEE
|
||||
or entry_type == 0xEF
|
||||
or entry_type == 0x83
|
||||
- id: len_evsa_entry
|
||||
type: u2
|
||||
if: entry_type == 0xE1
|
||||
or entry_type == 0xE2
|
||||
or entry_type == 0xE3
|
||||
or entry_type == 0xED
|
||||
or entry_type == 0xEE
|
||||
or entry_type == 0xEF
|
||||
or entry_type == 0x83
|
||||
- id: body
|
||||
type:
|
||||
switch-on: type
|
||||
switch-on: entry_type
|
||||
cases:
|
||||
0xED: evsa_guid
|
||||
0xE1: evsa_guid
|
||||
|
@ -88,12 +127,21 @@ types:
|
|||
0xEF: evsa_data
|
||||
0xE3: evsa_data
|
||||
0x83: evsa_data
|
||||
_: evsa_unknown
|
||||
_: evsa_unknown
|
||||
|
||||
evsa_body:
|
||||
seq:
|
||||
- id: entries
|
||||
type: evsa_entry
|
||||
repeat: until
|
||||
repeat-until: (_.entry_type != 0xED
|
||||
and _.entry_type != 0xEE
|
||||
and _.entry_type != 0xEF
|
||||
and _.entry_type != 0xE1
|
||||
and _.entry_type != 0xE2
|
||||
and _.entry_type != 0xE3
|
||||
and _.entry_type != 0x83)
|
||||
or _io.eof
|
||||
- id: free_space
|
||||
type: u1
|
||||
repeat: eos
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue