@@ -201,24 +201,6 @@ const BOARD_VERSION_NPC_DB: [i32; BOARD_VERSION_COUNT] = [
201201 100 , 311 , 521 , 721 , 931 , 1131 , 1341 , 1551 , 1751 , 1961 , 2171 , 2370 , 2580 , 2780 , 2990 , 3200 ,
202202] ;
203203
204- pub fn has_mec ( ) -> bool {
205- let platform = smbios:: get_platform ( ) . unwrap ( ) ;
206- if let Platform :: GenericFramework ( _, _, has_mec) = platform {
207- return has_mec;
208- }
209-
210- // TODO: Should turn this around
211- !matches ! (
212- smbios:: get_platform( ) . unwrap( ) ,
213- Platform :: Framework13Amd7080
214- | Platform :: Framework16Amd7080
215- | Platform :: IntelCoreUltra1
216- | Platform :: Framework13AmdAi300
217- | Platform :: Framework12IntelGen13
218- | Platform :: FrameworkDesktopAmdAiMax300
219- )
220- }
221-
222204pub trait CrosEcDriver {
223205 fn read_memory ( & self , offset : u16 , length : u16 ) -> Option < Vec < u8 > > ;
224206 fn send_command ( & self , command : u16 , command_version : u8 , data : & [ u8 ] ) -> EcResult < Vec < u8 > > ;
@@ -953,30 +935,25 @@ impl CrosEc {
953935 // Everything before is probably a header.
954936 // TODO: I don't think there are magic bytes on zephyr firmware
955937 //
956- if has_mec ( ) {
957- println ! ( " Check MCHP magic byte at start of firmware code." ) ;
958- // Make sure we can read at an offset and with arbitrary length
959- let data = self . read_ec_flash ( FLASH_PROGRAM_OFFSET , 16 ) . unwrap ( ) ;
960- debug ! ( "Expecting beginning with 50 48 43 4D ('PHCM' in ASCII)" ) ;
961- debug ! ( "{:02X?}" , data) ;
962- println ! (
963- " {:02X?} ASCII:{:?}" ,
964- & data[ ..4 ] ,
965- core:: str :: from_utf8( & data[ ..4 ] )
966- ) ;
967-
968- if data[ 0 ..4 ] != [ 0x50 , 0x48 , 0x43 , 0x4D ] {
969- println ! ( " INVALID: {:02X?}" , & data[ 0 ..3 ] ) ;
970- res = Err ( EcError :: DeviceError ( format ! (
971- "INVALID: {:02X?}" ,
972- & data[ 0 ..3 ]
973- ) ) ) ;
974- }
938+ debug ! ( " Check MCHP magic bytes at start of firmware code." ) ;
939+ // Make sure we can read at an offset and with arbitrary length
940+ let data = self . read_ec_flash ( FLASH_PROGRAM_OFFSET , 16 ) . unwrap ( ) ;
941+ debug ! ( "Expecting beginning with 50 48 43 4D ('PHCM' in ASCII)" ) ;
942+ debug ! ( "{:02X?}" , data) ;
943+ debug ! (
944+ " {:02X?} ASCII:{:?}" ,
945+ & data[ ..4 ] ,
946+ core:: str :: from_utf8( & data[ ..4 ] )
947+ ) ;
948+
949+ let has_mec = data[ 0 ..4 ] == [ 0x50 , 0x48 , 0x43 , 0x4D ] ;
950+ if has_mec {
951+ debug ! ( " Found MCHP magic bytes at start of firmware code." ) ;
975952 }
976953
977954 // ===== Test 4 =====
978955 println ! ( " Read flash flags" ) ;
979- let data = if has_mec ( ) {
956+ let data = if has_mec {
980957 self . read_ec_flash ( MEC_FLASH_FLAGS , 0x80 ) . unwrap ( )
981958 } else {
982959 self . read_ec_flash ( NPC_FLASH_FLAGS , 0x80 ) . unwrap ( )
0 commit comments