From a1be9784b89388f2c83e5d60d3a45b89136a8fea Mon Sep 17 00:00:00 2001 From: Min M Xu Date: Wed, 31 Jul 2024 01:31:06 -0400 Subject: [PATCH] Support DOE Discovery Version DOE Discovery Version is first introduced in PCIE Spec 6.1 Section 6.30.1.1. After libspdm support this feature, spdm-emu shall be updated as well. Signed-off-by: Min M Xu --- include/library/pci_doe_requester_lib.h | 3 ++- library/pci_doe_requester_lib/pci_doe_req_discovery.c | 4 +++- .../spdm_device_attester_pci_doe.c | 3 ++- .../spdm_device_validator_pci_doe.c | 3 ++- spdm_emu/spdm_requester_emu/spdm_requester_pci_doe.c | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/library/pci_doe_requester_lib.h b/include/library/pci_doe_requester_lib.h index 887ce66..398f4a2 100644 --- a/include/library/pci_doe_requester_lib.h +++ b/include/library/pci_doe_requester_lib.h @@ -11,7 +11,8 @@ libspdm_return_t pci_doe_discovery (const void *pci_doe_context, pci_doe_data_object_protocol_t *data_object_protocol, - size_t *data_object_protocol_size); + size_t *data_object_protocol_size, + uint8_t version); /* external provided function */ diff --git a/library/pci_doe_requester_lib/pci_doe_req_discovery.c b/library/pci_doe_requester_lib/pci_doe_req_discovery.c index b7fa2bd..9bc8919 100644 --- a/library/pci_doe_requester_lib/pci_doe_req_discovery.c +++ b/library/pci_doe_requester_lib/pci_doe_req_discovery.c @@ -34,7 +34,8 @@ typedef struct { libspdm_return_t pci_doe_discovery (const void *pci_doe_context, pci_doe_data_object_protocol_t *data_object_protocol, - size_t *data_object_protocol_size) + size_t *data_object_protocol_size, + uint8_t version) { doe_discovery_request_mine_t doe_request; doe_discovery_response_mine_t doe_response; @@ -52,6 +53,7 @@ libspdm_return_t pci_doe_discovery (const void *pci_doe_context, doe_request.doe_header.data_object_type = PCI_DOE_DATA_OBJECT_TYPE_DOE_DISCOVERY; doe_request.doe_header.length = sizeof(doe_discovery_request_mine_t) / sizeof(uint32_t); doe_request.doe_discovery_request.index = 0; + doe_request.doe_discovery_request.version = version; do { if (total_index < diff --git a/spdm_emu/spdm_device_attester_sample/spdm_device_attester_pci_doe.c b/spdm_emu/spdm_device_attester_sample/spdm_device_attester_pci_doe.c index a6e4e42..0b1ac73 100644 --- a/spdm_emu/spdm_device_attester_sample/spdm_device_attester_pci_doe.c +++ b/spdm_emu/spdm_device_attester_sample/spdm_device_attester_pci_doe.c @@ -7,6 +7,7 @@ #include "spdm_device_attester_sample.h" void *m_pci_doe_context; +#define DOE_DISCOVERY_VERSION 0 libspdm_return_t pci_doe_init_request() { @@ -17,7 +18,7 @@ libspdm_return_t pci_doe_init_request() data_object_protocol_size = sizeof(data_object_protocol); status = - pci_doe_discovery (m_pci_doe_context, data_object_protocol, &data_object_protocol_size); + pci_doe_discovery (m_pci_doe_context, data_object_protocol, &data_object_protocol_size, DOE_DISCOVERY_VERSION); if (LIBSPDM_STATUS_IS_ERROR(status)) { return status; } diff --git a/spdm_emu/spdm_device_validator_sample/spdm_device_validator_pci_doe.c b/spdm_emu/spdm_device_validator_sample/spdm_device_validator_pci_doe.c index 7f2a131..59c9d96 100644 --- a/spdm_emu/spdm_device_validator_sample/spdm_device_validator_pci_doe.c +++ b/spdm_emu/spdm_device_validator_sample/spdm_device_validator_pci_doe.c @@ -7,6 +7,7 @@ #include "spdm_device_validator_sample.h" void *m_pci_doe_context; +#define DOE_DISCOVERY_VERSION 0 libspdm_return_t pci_doe_init_request() { @@ -17,7 +18,7 @@ libspdm_return_t pci_doe_init_request() data_object_protocol_size = sizeof(data_object_protocol); status = - pci_doe_discovery (m_pci_doe_context, data_object_protocol, &data_object_protocol_size); + pci_doe_discovery (m_pci_doe_context, data_object_protocol, &data_object_protocol_size, DOE_DISCOVERY_VERSION); if (LIBSPDM_STATUS_IS_ERROR(status)) { return status; } diff --git a/spdm_emu/spdm_requester_emu/spdm_requester_pci_doe.c b/spdm_emu/spdm_requester_emu/spdm_requester_pci_doe.c index 7596e2f..1feae7e 100644 --- a/spdm_emu/spdm_requester_emu/spdm_requester_pci_doe.c +++ b/spdm_emu/spdm_requester_emu/spdm_requester_pci_doe.c @@ -7,6 +7,7 @@ #include "spdm_requester_emu.h" void *m_pci_doe_context; +#define DOE_DISCOVERY_VERSION 0 libspdm_return_t pci_doe_init_requester() { @@ -17,7 +18,7 @@ libspdm_return_t pci_doe_init_requester() data_object_protocol_size = sizeof(data_object_protocol); status = - pci_doe_discovery (m_pci_doe_context, data_object_protocol, &data_object_protocol_size); + pci_doe_discovery (m_pci_doe_context, data_object_protocol, &data_object_protocol_size, DOE_DISCOVERY_VERSION); if (LIBSPDM_STATUS_IS_ERROR(status)) { return status; }