usb: obmf: update wire protocol to OBMF-ICP v1.0.0 RC1 - #579
Open
minying0829 wants to merge 1 commit into
Open
Conversation
Update the driver to match the finalized v1.0.0 RC1 wire format, which is not backward compatible with the earlier v0.9 draft. Common Header (4 bytes, was 5): - Drop the per-message Channel Type byte; the type is already known from the channel that was discovered on Channel 0, so it no longer needs to be repeated on every transfer. - Merge RqResp and Status into a single byte (status_rqresp): RqResp is now bit 7, Status is bits [6:0] (previously RqResp was bit 0 and Status was bits [7:1]). - Update obmf_send_request()/obmf_send_response() and every caller (GPIO, I2C, I2C target, I3C, IPMI, OEM, serial, SPI, MMIO, IO) to drop the now-removed channel_type argument. MMIO Sub-Header (1 byte, was 2): - Drop the Tag byte; MMIO requests/responses are no longer tagged. - Widen the Short Read/Write Size field from u8 to u16, so transfers up to 65535 bytes can be described in one sub-header (driver still caps buffers at 256 bytes). - obmf-mmio-misc.c and obmf-transport.c updated to match: drop dev_req_tag / mhdr->tag handling, parse the new 2-byte size field. IO channel tagging: - The IO channel (type 09h) keeps its own 2-byte sub-header with a Tag byte, so rename the shared struct obmf_channel fields "tag" / "dev_tag" to "io_tag" / "io_dev_tag" to make clear they are IO-only now that MMIO no longer uses tags. - obmf-transport.c: split the combined MMIO/CONFIG/IO tag-checking and dev-request dispatch paths into a tagged IO path and an untagged MMIO/CONFIG path. SPI response sub-header (3 bytes, was 4): - Drop the reserved byte after the command echo; ReadDataSize now starts right after cmd_echo. Introduce OBMF_SPI_RESP_SUBHDR_SIZE and use it everywhere instead of hardcoded offsets. Discovery / Channel 0 (spec §4.13): - Register map offsets shift down since DEVICE_ROLE is no longer a global Channel 0 field (it moved to a per-channel field instead); update all OBMF_DISC_* offsets accordingly and drop the global device_role read/log. - Read each channel's MAX_REQUEST_PAYLOAD_SIZE and MAX_RESPONSE_PAYLOAD_SIZE during discovery and cache them in struct obmf_channel. - Add CONFIG_STATUS, CHANNEL_STATUS health, and CHANNEL_CONTROL bit definitions used by the new config layout, and bump OBMF_MIN_SPEC_VERSION to v1.0.0. - Raise the Short Read fast-path threshold from 255 to 256 bytes to match the widened MMIO size field. IO port range enforcement (obmf-io-misc.c): - Add support for reading the channel's IO_RANGE_CFG configuration data (transaction types supported + enabled port ranges) from Channel 0 during registration. - Enforce the configured transaction-type and port-range restrictions in the ioctl path, returning -EOPNOTSUPP / -EPERM for disallowed transactions or ports. If the configuration data is unavailable, fall back to permissive mode (unchanged behavior). No functional change is intended for I2C, I3C, GPIO, serial, IPMI, or OEM channel payload formats beyond the header adjustments above. Upstream-Status: Pending [Not submitted to upstream yet] Signed-off-by: Mia Lin <mimi05633@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update the driver to match the finalized v1.0.0 RC1 wire format, which is not backward compatible with the earlier v0.9 draft.
Common Header (4 bytes, was 5):
MMIO Sub-Header (1 byte, was 2):
IO channel tagging:
SPI response sub-header (3 bytes, was 4):
Discovery / Channel 0 (spec §4.13):
IO port range enforcement (obmf-io-misc.c):
No functional change is intended for I2C, I3C, GPIO, serial, IPMI, or OEM channel payload formats beyond the header adjustments above.
Upstream-Status: Pending [Not submitted to upstream yet]