more debug
diff --git a/services/mctp/server/src/main.rs b/services/mctp/server/src/main.rs index cfec577..fd90dc3 100644 --- a/services/mctp/server/src/main.rs +++ b/services/mctp/server/src/main.rs
@@ -690,19 +690,22 @@ Ok((pkt, hdr)) => { i2c_pkt = i2c_pkt.wrapping_add(1); // Log MCTP packet fields: SOM/EOM from flags byte (pkt[3]) - let som = pkt.get(3).map_or(0u8, |b| (b >> 7) & 1); - let eom = pkt.get(3).map_or(0u8, |b| (b >> 6) & 1); - let seq = pkt.get(3).map_or(0u8, |b| (b >> 4) & 0x3); + let flags = pkt.get(3).map_or(0u8, |b| *b); + let som = (flags >> 7) & 1; + let eom = (flags >> 6) & 1; + let seq = (flags >> 4) & 0x3; + let to = (flags >> 3) & 1; + let tag = flags & 0x7; let msg_type = pkt.get(4).map_or(0u8, |b| b & 0x7f); pw_log::info!( "MCTP pkt #{}: src_i2c=0x{:02x} dest_i2c=0x{:02x} bc={} len={} \ - SOM={} EOM={} seq={} msg_type=0x{:02x}", + SOM={} EOM={} seq={} TO={} tag={} msg_type=0x{:02x}", i2c_pkt as u32, hdr.source as u32, hdr.dest as u32, hdr.byte_count as u32, pkt.len() as u32, - som as u32, eom as u32, seq as u32, msg_type as u32, + som as u32, eom as u32, seq as u32, to as u32, tag as u32, msg_type as u32, ); match server.borrow_mut().inbound(pkt) { Ok(Some(cookie)) => { @@ -825,6 +828,7 @@ msg_buf.reset(); match spdm_ctx.requester_process_message(&mut msg_buf) { Ok(_) => { + pw_log::info!("message process ok"); req_recv_ok = req_recv_ok.wrapping_add(1); await_steps = 0; req_state = $next;
diff --git a/target/ast1060-evb/harness/i2c_monitor.py b/target/ast1060-evb/harness/i2c_monitor.py index c247bcb..7a732df 100755 --- a/target/ast1060-evb/harness/i2c_monitor.py +++ b/target/ast1060-evb/harness/i2c_monitor.py
@@ -480,14 +480,20 @@ print("Mode: SPDM (with MCTP and SMBus)") if args.mctp_hide: print(" MCTP layer hidden") + if args.smbus_hide: + print(" Non-MCTP SMBus traffic hidden") elif args.mctp: print("Mode: MCTP (with SMBus)") if args.mctp_no_partial: print(" Hiding partial MCTP fragments") + if args.smbus_hide: + print(" Non-MCTP SMBus traffic hidden") elif args.smbus: print("Mode: SMBus") if args.with_pec: print(" PEC validation enabled") + if args.smbus_hide: + print(" Non-MCTP SMBus traffic hidden") else: print("Mode: Raw I2C") @@ -580,12 +586,14 @@ print(f"[{time_sop_ns:12d} ns] MCTP Parse Error: {e}") elif smbus_result: - # SMBus mode only - print_smbus_message(time_sop_ns, i2c_addr, i2c_rw, smbus_result, raw_data) + # SMBus mode only - skip if smbus_hide is enabled + if not args.smbus_hide: + print_smbus_message(time_sop_ns, i2c_addr, i2c_rw, smbus_result, raw_data) else: - # Not valid SMBus MCTP - print raw - print_raw_i2c(time_sop_ns, i2c_addr, i2c_rw, raw_data, status) + # Not valid SMBus MCTP - skip if smbus_hide is enabled, otherwise print raw + if not args.smbus_hide: + print_raw_i2c(time_sop_ns, i2c_addr, i2c_rw, raw_data, status) else: # Raw I2C mode @@ -706,8 +714,10 @@ %(prog)s # Raw I2C monitoring %(prog)s --smbus --with-pec # SMBus with PEC validation %(prog)s --mctp # MCTP packet monitoring + %(prog)s --mctp --smbus-hide # MCTP only (hide non-MCTP SMBus) %(prog)s --spdm # SPDM message monitoring %(prog)s --spdm --mctp-hide # SPDM only (hide MCTP layer) + %(prog)s --spdm --smbus-hide --mctp-hide # SPDM only (minimal output) %(prog)s --samplerate 5000 --timeout 1000 # Custom sample rate and timeout ''' ) @@ -715,6 +725,8 @@ # Protocol mode arguments parser.add_argument('--smbus', action='store_true', help='Treat all packets as having SMBus header') + parser.add_argument('--smbus-hide', action='store_true', + help='Hide non-MCTP SMBus traffic (requires --smbus or higher)') parser.add_argument('--with-pec', action='store_true', help='Assume PEC is present (requires --smbus)') parser.add_argument('--mctp', action='store_true', @@ -755,6 +767,9 @@ if args.mctp_hide and not args.spdm: parser.error("--mctp-hide requires --spdm") + if args.smbus_hide and not args.smbus: + parser.error("--smbus-hide requires --smbus (or --mctp/--spdm which imply --smbus)") + # Validate configuration arguments if args.samplerate <= 0: parser.error("Sample rate must be positive")
diff --git a/target/ast1060-evb/harness/i2c_responder.py b/target/ast1060-evb/harness/i2c_responder.py index 02227ad..70b3f84 100755 --- a/target/ast1060-evb/harness/i2c_responder.py +++ b/target/ast1060-evb/harness/i2c_responder.py
@@ -304,19 +304,30 @@ args = parser.parse_args() # Default canned response (MCTP SPDM VERSION response) - # Captured from actual Rust responder on I2C bus: - # <0x13:W> 0x26 0x0F 0x0A 0x21 0x01 0x42 0x08 0xD9 0x05 0x10 0x84 0x00 0x00 0x51 + # When using aa_i2c_write(), the Aardvark handles the I2C destination address automatically. + # Format: [CMD][ByteCount][SrcI2C][MCTP_packet...][PEC] # - # Format: [SrcI2C][CMD][ByteCount][DestI2C][MCTP_Ver][DestEID][SrcEID][Flags][MsgType][SPDM][PEC] # Responder (us): EID=0x42, I2C=0x13 # Requester (peer): EID=0x08, I2C=0x10 - # Src I2C: 0x26 = 0x13 << 1 (no read bit in this position) - # Dest I2C: 0x21 = 0x10 << 1 | 1 (read bit set) - # MCTP: Dest EID=0x42, Source EID=0x08 (note: different from expected!) - # PEC=0x51 verified from actual capture + # + # Full frame on wire (with I2C dest prepended by hardware): + # [0x20][0x0F][0x10][0x27][0x01][0x08][0x42][0xD1][0x05][0x10][0x04][0x00][0x00][0x02][0x00][0x12][0x00][0x13][0x00][PEC] + # Dest Cmd BC Src Ver DstEID SrcEID Flags Msg SPDM VERSION response (15-byte MCTP packet) + # + # ByteCount=0x10 (16): includes source I2C byte (0x27) + 15-byte MCTP packet + # Flags=0xD1: SOM=1, EOM=1, Seq=1, TO=0 (requester owns tag), Tag=1 + # SPDM VERSION response payload: + # 0x10 = SPDM version 1.0 (in MCTP header) + # 0x04 = VERSION response code + # 0x00, 0x00 = Reserved + # 0x02, 0x00 = Version count (2 versions) + # 0x12, 0x00 = SPDM version 1.2 + # 0x13, 0x00 = SPDM version 1.3 + # PEC=0x6F calculated over full frame including I2C dest canned_response = [ - 0x26, 0x0F, 0x0A, 0x21, 0x01, 0x42, 0x08, 0xD9, - 0x05, 0x10, 0x84, 0x00, 0x00, 0x51, + 0x0F, 0x10, 0x27, 0x01, 0x08, 0x42, 0xD1, 0x05, + 0x10, 0x04, 0x00, 0x00, 0x02, 0x00, 0x12, 0x00, + 0x13, 0x00, 0x6F, ] # Parse custom response if provided