These are templates for PCIe Capabilities. They are designed to be applied
on a group. For convenience there exists a template
defining_xyz_capability for each capability xyz which defines a group
xyz with the xyz_capability applied. Most templates only define the
registers with their standard access restrictions. If additional behavior is
needed, the user of the template must implement this manually.
Each capability template uses the following parameters:
base: Base address of the capability headernext_ptr: Value of the next_ptr field in the capability headerpm_capabilityexp_capabilityParameters:
has_hotplug_capable_slot: Device has a native PCIe Hot-Plug capable slot.
This param will set the has_hotplug_capable in the instantiated
exp_slot template, default falsehas_attention_button_slot: Attention button present in slot. This param
will set the has_attention_button in the instantiated exp_slot
template, default falsehas_links: Presence of links registers, default
has_hotplug_capable_slothas_slots: Presence of slots registers, default
has_hotplug_capable_slothas_root: Presence of root registers, default falsedp_type: Device/port type, as indicated in exp.capability.dpt register field, default PCIE_DP_Type_EPcap_version: Version of this capability structure, as indicated in exp.capability.cv register field, default 2imn: The MSI/MSI-X vector used for the interrupt message generated in
association with any of the status bits of this Capability structure,
default 0exp_linkParameters:
dll_link_active_reporting: Link supports DLL Link Active Reporting, default falsemax_link_speed: Max link speed provided as a value of the
pcie_link_speed_t enum, default PCIE_Link_Speed_Undefinedmax_link_width: Max link width provided as a value of the
pcie_link_width_t enum, PCIE_Link_Width_Undefinedlink_bandwidth_notifications: Support Link Bandwidth Notifications,
default ((dp_type == PCIE_DP_Type_DP) || (dp_type == PCIE_DP_Type_RP))set_link_training_target(map_target_t *target)Sets the default link training target when do_link_training() is called
with NULL.
do_link_training(map_target_t *target)Initiates link training by sending a link training transaction to either
the to the target set with set_link_training_target(). Returns true if
link negotiation was deemed successful. Will set the status.ls and
status.nlw fields if the negotiation was successful. Negotiation can only
be successful if both the initiator and the link training target has the
params max_link_speed and max_link_width in their respective link groups
set. do_link_training will by default only send a link training
transaction to device 0. This method can be overridden for custom
functionality where support for bifurcation might for instance be
necessary.
get_target_link_speed() -> (pcie_link_speed_t)Returns the target link speed. This would be the maximum link speed if there is no target link speed.
get_max_link_width() -> (pcie_link_width_t)Returns the maximum link width
set_link_attributes(pcie_link_speed_t speed, pcie_link_width_t width)Sets the status.ls and status.nlw fields.
exp_slotParameters:
is_hotplug_capable: Slot is native PCIe Hot-Plug capable, default falsehas_power_indicator: Slot has a power indicator, default falsehas_power_controller: Slot has a power controller, default falsehas_mrl_sensor: Slot has an MRL sensor, default falsehas_command_completions: Slot sends command completed notifications, default falsepresence_change_event(pcie_hotplug_pd_t state) -> (bool)Sets the presence detect state field to state. If the state has
changed, also sets the presence detect changed field and notifies
software if applicable. Returns true if event was registered
mrl_sensor_event(pcie_hotplug_mrl_t state) -> (bool)Sets the MRL sensor state field to state. If the state has changed,
also sets the MRL sensor changed field and notifies software if
applicable. Returns true if event was registered
data_link_layer_event(bool is_active) -> (bool)Sets the Data Link Layer Link Active in the link status register to
is_active. If this field changes value, also sets the Data Link Layer
state changed field in the slot status register and notifies software if
applicable. Returns true if event was registered
power_fault_event() -> (bool)Sets the Power Fault Detected field and notifies software if applicable. Returns true if event was registered
attention_button_event() -> (bool)Sets the Attention Button Pressed field and notifies software if applicable. Returns true if event was registered
hotplug_event_enabled(int type) -> (bool)Returns true if slot has Hot-Plug event types of type type enabled. The
available types are param:s defined in this file that have the prefix
SLOT_ and LINK_.
hotplug_capable(int type)Returns true if the slot is capable of handling Hot-Plug events of type
type. The available types are param:s defined in this file that have
the prefix SLOT_ and LINK_.
vpd_capabilitymsi_capabilityParameters:
is_64bit_capable: Support 64-bit addresses, i.e. address register is
8 bytes instead of 4.is_pvm_capable: Support Per-Vector-Masking, i.e. the mask register is
present.is_emd_capable: Support extended message data, i.e. the data register
is 8 bytes instead of 4.num_vectors: The number of interrupt vectors supported.signal_all_pending()Signals all pending MSI's
raise(uint8 i)Raises MSI i if capable and enabled, and signals it if not masked
lower(uint8 i)Lowers MSI i
msix_capabilityParameters:
table_offset_bir: Initial value of the Table Offset/BIR register (at
offset 0x4 in the MSI-X capability structure).pba_offset_bir: Initial value of the PBA Offset/BIR register (at
offset 0x8 in the MSI-X capability structure).data_bank: The bank which holds the Table and Pending Bits data, which
must use the template msix_tablenum_vectors: Number of interrupt vectors supported.raise(uint16 i)Raises MSI-X i if enabled, and signals it if not masked
lower(uint16 i)Lowers MSI-X i
ssid_capabilityaf_capabilityea_capabilityfpb_capabilityFields and access restrictions to be added upon request.
null_capability