Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
add tdisp test in emu.
Browse files Browse the repository at this point in the history
Signed-off-by: Yang, Longlong <[email protected]>
  • Loading branch information
longlongyang committed Nov 5, 2023
1 parent 073fe7c commit 6e7d88a
Show file tree
Hide file tree
Showing 8 changed files with 1,018 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static PCI_TDISP_DEVICE_INTERFACE_REPORT_INSTANCE: OnceCell<PciTdispDeviceInterf
#[allow(clippy::type_complexity)]
pub struct PciTdispDeviceInterfaceReport {
pub pci_tdisp_device_interface_report_cb: fn(
// INT
// IN
vendor_context: usize,
// OUT
negotiated_version: &mut TdispVersion,
Expand Down Expand Up @@ -58,7 +58,7 @@ static UNIMPLETEMTED: PciTdispDeviceInterfaceReport = PciTdispDeviceInterfaceRep
};

pub(crate) fn pci_tdisp_device_interface_report(
// INT
// IN
vendor_context: usize,
// OUT
negotiated_version: &mut TdispVersion,
Expand Down
11 changes: 5 additions & 6 deletions tdisp/src/pci_tdisp_responder/pci_tdisp_rsp_dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use spdmlib::{
},
};

use crate::pci_tdisp::{TdispErrorCode, TdispRequestResponseCode};
use crate::pci_tdisp::{TdispErrorCode, TdispRequestResponseCode, TDISP_PROTOCOL_ID};

use super::{
pci_tdisp_rsp_bind_p2p_stream_request::pci_tdisp_rsp_bind_p2p_stream,
Expand All @@ -31,7 +31,9 @@ pub fn pci_tdisp_rsp_dispatcher(
vendor_context: usize,
vendor_defined_req_payload_struct: &VendorDefinedReqPayloadStruct,
) -> SpdmResult<VendorDefinedRspPayloadStruct> {
if vendor_defined_req_payload_struct.req_length < 3 {
if vendor_defined_req_payload_struct.req_length < 3
|| vendor_defined_req_payload_struct.vendor_defined_req_payload[0] != TDISP_PROTOCOL_ID
{
return Err(SPDM_STATUS_INVALID_MSG_FIELD);
}

Expand Down Expand Up @@ -69,9 +71,6 @@ pub fn pci_tdisp_rsp_dispatcher(
TdispRequestResponseCode::UNBIND_P2P_STREAM_REQUEST => {
pci_tdisp_rsp_unbind_p2p_stream(vendor_context, vendor_defined_req_payload_struct)
}
TdispRequestResponseCode::VDM_REQUEST => {
pci_tdisp_rsp_vdm_response(vendor_context, vendor_defined_req_payload_struct)
}
_ => {
let mut vendor_defined_rsp_payload_struct = VendorDefinedRspPayloadStruct {
rsp_length: 0,
Expand All @@ -90,6 +89,6 @@ pub fn pci_tdisp_rsp_dispatcher(
}
}
} else {
Err(SPDM_STATUS_INVALID_MSG_FIELD)
pci_tdisp_rsp_vdm_response(vendor_context, vendor_defined_req_payload_struct)
}
}
1 change: 1 addition & 0 deletions test/spdm-requester-emu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ edition = "2018"
spdm-emu = { path = "../spdm-emu", default-features = false }
spdmlib = { path = "../../spdmlib", default-features = false }
idekm = { path = "../../idekm", default-features = false }
tdisp = { path = "../../tdisp", default-features = false }
codec = { path = "../../codec" }
mctp_transport = { path = "../../mctp_transport" }
pcidoe_transport = { path = "../../pcidoe_transport" }
Expand Down
Loading

0 comments on commit 6e7d88a

Please sign in to comment.