Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ jobs:
- name: Cache cargo registry and build
uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --all-features --verbose
run: cargo test --all-features --verbose --workspace
19 changes: 18 additions & 1 deletion Cargo.lock

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

23 changes: 20 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@
name = "pldm-lib"
version = "0.1.0"
authors = ["Caliptra contributors", "OpenPRoT contributors"]
edition = "2024"
edition = "2021"

[dependencies]
zerocopy = { version = "0.8.17", features = ["derive"] }
[workspace]
members = [
"pldm-common",
"pldm-interface"
]

[workspace.package]
version = "0.1.0"
authors = ["Caliptra contributors", "OpenPRoT contributors"]
edition = "2021"

[workspace.dependencies]
pldm-common = { path = "pldm-common" }
pldm-interface = { path = "pldm-interface" }
bitfield = "0.14.0"
zerocopy = { version = "0.8.17", features = ["derive"] }

[dependencies]
pldm-common.workspace = true
pldm-interface.workspace = true
12 changes: 12 additions & 0 deletions pldm-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Licensed under the Apache-2.0 license

[package]
name = "pldm-common"
version.workspace = true
edition.workspace = true
authors.workspace = true

[dependencies]
zerocopy.workspace = true
bitfield.workspace = true

File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions pldm-common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2025
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#![no_std]

pub mod codec;
pub mod error;
pub mod message;
pub mod protocol;
pub mod util;
4 changes: 2 additions & 2 deletions src/message/control.rs → pldm-common/src/message/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmControlCmd, PldmMsgHeader, PldmMsgType, PldmSupportedType,
TransferOperationFlag, TransferRespFlag,
InstanceId, PldmControlCmd, PldmMsgHeader, PldmMsgType, PldmSupportedType,
TransferOperationFlag, TransferRespFlag, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::version::{PldmVersion, ProtocolVersionStr, Ver32};
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::FwUpdateCmd;
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::{ComponentActivationMethods, FwUpdateCmd};
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

use crate::codec::{PldmCodec, PldmCodecError};
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::{
ComponentParameterEntry, FirmwareDeviceCapability, FwUpdateCmd, MAX_COMPONENT_COUNT,
PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, PldmFirmwareString,
ComponentParameterEntry, FirmwareDeviceCapability, FwUpdateCmd, PldmFirmwareString,
MAX_COMPONENT_COUNT, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN,
};
use zerocopy::{FromBytes, Immutable, IntoBytes};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.

use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmBaseCompletionCode, PldmMsgHeader, PldmMsgType,
PldmSupportedType, TransferOperationFlag,
InstanceId, PldmBaseCompletionCode, PldmMsgHeader, PldmMsgType, PldmSupportedType,
TransferOperationFlag, PLDM_MSG_HEADER_LEN,
};

use crate::pldm_completion_code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::{FirmwareDeviceState, FwUpdateCmd, UpdateOptionFlags};
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

use crate::codec::{PldmCodec, PldmCodecError};
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
TransferRespFlag,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, TransferRespFlag,
PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::{
ComponentClassification, ComponentResponse, ComponentResponseCode, FwUpdateCmd,
PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, PldmFirmwareString,
PldmFirmwareString, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN,
};
use zerocopy::{FromBytes, Immutable, IntoBytes};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use crate::codec::{PldmCodec, PldmCodecError};
use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::{Descriptor, FwUpdateCmd};
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use crate::codec::{PldmCodec, PldmCodecError, PldmCodecWithLifetime};
use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmBaseCompletionCode, PldmMsgHeader, PldmMsgType,
PldmSupportedType, TransferOperationFlag,
InstanceId, PldmBaseCompletionCode, PldmMsgHeader, PldmMsgType, PldmSupportedType,
TransferOperationFlag, PLDM_MSG_HEADER_LEN,
};

use crate::pldm_completion_code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::FwUpdateCmd;
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use crate::codec::{PldmCodecError, PldmCodecWithLifetime};
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::FwUpdateCmd;
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down Expand Up @@ -65,7 +65,7 @@ pub struct RequestFirmwareDataResponse<'a> {
pub data: &'a [u8],
}

impl<'a> RequestFirmwareDataResponse<'a> {
impl RequestFirmwareDataResponse<'_> {
pub fn new(
instance_id: InstanceId,
completion_code: u8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

use crate::codec::{PldmCodec, PldmCodecError};
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::{
FwUpdateCmd, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, PldmFirmwareString,
FwUpdateCmd, PldmFirmwareString, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN,
};
use zerocopy::{FromBytes, Immutable, IntoBytes};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::FwUpdateCmd;
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

use crate::codec::{PldmCodec, PldmCodecError};
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::{
ComponentClassification, ComponentCompatibilityResponse, ComponentCompatibilityResponseCode,
FwUpdateCmd, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN, PldmFirmwareString, UpdateOptionFlags,
FwUpdateCmd, PldmFirmwareString, UpdateOptionFlags, PLDM_FWUP_IMAGE_SET_VER_STR_MAX_LEN,
};
use zerocopy::{FromBytes, Immutable, IntoBytes};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use crate::error::PldmError;
use crate::protocol::base::{
InstanceId, PLDM_MSG_HEADER_LEN, PldmMsgHeader, PldmMsgType, PldmSupportedType,
InstanceId, PldmMsgHeader, PldmMsgType, PldmSupportedType, PLDM_MSG_HEADER_LEN,
};
use crate::protocol::firmware_update::FwUpdateCmd;
use zerocopy::{FromBytes, Immutable, IntoBytes};
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ impl Descriptor {
/// The blob must start with the first descriptor, but may contain additional data after the last descriptor.
///
/// ```rust
/// use pldm_lib::protocol::firmware_update::{Descriptor, DescriptorType, get_descriptor_length};
/// use crate::pldm_lib::codec::PldmCodec;
/// use pldm_common::protocol::firmware_update::{Descriptor, DescriptorType, get_descriptor_length};
/// use crate::pldm_common::codec::PldmCodec;
///
/// let dsc_0 = Descriptor::new(DescriptorType::PciVendorId, &[0x11, 0x22]).unwrap();
/// let dsc_1 = Descriptor::new(DescriptorType::PciVendorId, &[0x33, 0x44]).unwrap();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions pldm-interface/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Licensed under the Apache-2.0 license

[package]
name = "pldm-interface"
version.workspace = true
edition.workspace = true
authors.workspace = true

[dependencies]
zerocopy.workspace = true
bitfield.workspace = true
pldm-common.workspace = true

Loading
Loading