bug fix for determining the Link status speed/width & Link Cap speed/width #1147
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.
Description
To determine the byte offset for the Capabilities: Express (v2) Endpoint register based on the provided PCIe configuration dump, you'll need to follow the PCIe specification for parsing the configuration space, focusing on finding the correct capability structure within it. Here's a step-by-step guide to do this:
Start from the PCI Configuration Space: The dump you've provided looks like the content of the PCI Express (PCIe) configuration space. This space contains a variety of information including device capabilities, status, and control settings.
Identify the PCI Express Capability: Capabilities in PCI configuration space start at byte 0x34 (the Capabilities Pointer field in the standard PCI Configuration space), which points to the first capability structure in a linked list. Each capability has a format that includes an ID, a pointer to the next capability (if any), and then the capability-specific data.
Look for the Express Capability ID: PCI Express capabilities have a specific Capability ID, which is 0x10 for the PCIe base specification. You'll need to follow the capability pointers starting from the pointer at 0x34 until you find a capability with the ID 0x10.
Parse Through the Configuration Dump: Starting from the offset given by the Capabilities Pointer at 0x34, you'll parse through the linked list of capabilities. Each entry in this list has at least two bytes: the first byte is the Capability ID, and the second byte is the pointer to the next capability (relative to the start of the configuration space).