Capabilities templates Simics Commands
PCIe Modeling Library  /  DML template reference  / 

Extended Capabilities templates

These are templates for PCIe Extended 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 extended capability template uses the following parameters:

Advanced Error Reporting (AER) Capability registers

Uses the following parameters:

Virtual Channel (VC) Capability registers

Device Serial Number (DSN) Capability registers

Device Power Budgeting (DPB) Capability registers

Uses the following parameters:

Root Complex Event Collector Endpoint Association (RCECEA) Capability registers

Uses the following parameters:

Multi-Function Virtual Channel (MFVC) Capability registers

RCRB Header (RCRB) Capability registers

Vendor-Specific Extended Capability (VSEC) registers

Access Control Services (ACS) Capability registers

Alternate Routing ID (ARI) Capability registers

Address Translation Service (ATS) Capability registers

This is a partially functional template; the user must implement the method invalidate_received.

Methods

invalidate_received(transaction_t *t, uint64 addr) -> (bool)

Called by the standard PCIe templates when an ATS Invalidate message is received. The default implementation logs an unimpl message and returns false, indicating a 'Completer Abort'.

translation_request(unint64 addr, pcie_ats_translation_completion_entry_t *entries, int nbr_entries, const pcie_pasid_info_t *pasid, bool no_write, bool cxl_src)-> (pcie_error_t, int)

Issue a translation request to Translation Agent (TA). Set pasid to NULL to exclude the pcie_pasid atom in the transaction. Returns error status and number of valid completion entries the TA has filled in.

translation_request_custom(unint64 addr, pcie_ats_translation_completion_entry_t *entries, int nbr_entries, const pcie_pasid_info_t *pasid, bool no_write, bool cxl_src, atom_t *extra_atoms)-> (pcie_error_t, int)

A variant of translation_request() that allows the user to add custom atoms to the transaction. The extra_atoms parameter is a list of atoms to be added to the transaction. The list must be terminated with ATOM_list_end(0).

translation_size_to_entries(uint64 size) -> (uint64)

Calculates the maximum number of translation completion entries required for TA to cover the requested translation of size.

get_translation_range(pcie_ats_translation_completion_entry_t entry) -> (uint64, uint64)

Decodes the completion entry and returns the translated address and the size of the translated region.

get_invalidation_range(pcie_ats_invalidate_request_payload_t payload) -> (uint64, uint64)

Decodes the invalidation request message and returns the untranslated address and the size of the untranslated region.

invalidate_complete(uint64 destination_id, uint32 itag_vector) -> (pcie_error_t)

Sends the invalidation message to TA found at B:D:F destination_id. Returns PCIE_Error_No_Error on success.

memory_read_buf(buffer_t buf, uint64 addr, pcie_at_t at, const pcie_pasid_info_t *pasid) -> (pcie_error_t)

Performs an ATS Translated/Untranslated Memory Read. The input argument at specifies which AT type. Input argument pasid contains PASID, set to NULL to exclude the pcie_pasid atom in the transaction. Returns a pcie_error_t. Requires that an upstream_target is defined. Should only be used with at set to: PCIE_AT_Untranslated or PCIE_AT_Translated.

memory_read_custom(buffer_t buf, uint64 addr, pcie_at_t at, const pcie_pasid_info_t *pasid, atom_t *extra_atoms) -> (pcie_error_t)

A variant of memory_read_buf() that allows the user to add custom atoms to the transaction. The extra_atoms parameter is a list of atoms to be added to the transaction. The list must be terminated with ATOM_list_end(0).

memory_write_bytes(bytes_t bytes, uint64 addr, pcie_at_t at, const pcie_pasid_info_t *pasid) -> (pcie_error_t)

Performs an ATS Translated/Untranslated Memory Write. The input argument at specifies which AT type. Input argument pasid contains PASID, set to NULL to exclude the pcie_pasid atom in the transaction. Returns a pcie_error_t. Requires that an upstream_target is defined. Should only be used with at set to: PCIE_AT_Untranslated or PCIE_AT_Translated.

memory_write_custom(bytes_t bytes, uint64 addr, pcie_at_t at, const pcie_pasid_info_t *pasid, atom_t *extra_atoms) -> (pcie_error_t)

A variant of memory_write_bytes() that allows the user to add custom atoms to the transaction. The extra_atoms parameter is a list of atoms to be added to the transaction. The list must be terminated with ATOM_list_end(0).

Multicast (MC) Capability registers

Page Request Service (PRS) Capability registers

page_request(pcie_prs_page_request_t request, const pcie_pasid_info_t *pasid) -> (pcie_error_t)

Sends a Page Request message. Input argument pasid contains PASID, set to NULL to exclude the pcie_pasid atom in the transaction.

send_stop_marker(const pcie_pasid_info_t *pasid) -> (pcie_error_t)

Sends a stop marker message upstream. Input argument pasid contains PASID, set to NULL to exclude the pcie_pasid atom from the transaction.

page_response_received(transaction_t *t, uint64 addr) -> (bool)

Called by the standard PCIe templates when a Page Response message is received. The default implementation logs an unimpl message and returns false.

Resizable BAR (RBAR) Capability registers

The standard PCIe templates for Base Address Registers automatically find and use the size configured in instances of this template, when enabled.

Uses the following parameters:

VF Resizable BAR (VFRBAR) Capability registers

This template works just like the Resizable Bar (RBAR) template, but is detected and used by the standard PCIe templates for Virtual Function Base Address Registers instead.

Dynamic Power Allocation (DPA) Capability registers

Uses the following parameters:

Transaction Processing Hints (TPH) Requester Extended Capability registers

Uses the following parameters:

Latency Tolerance Reporting (LTR) Capability registers

Secondary PCI Express (SPE) Capability registers

Uses the following parameters:

PASID Extended Capability Structure registers

verify_pasid(pcie_pasid_info_t pasid) -> (bool)

Verifies that the PASID capability is configured correctly to support the contents of the pasid argument. If the check fails it is considered a modelling error. Returns true on success.

verify_pasid_with_at(pcie_pasid_info_t pasid, pcie_at_t at) -> (bool)

Verifies that the PASID capability is configured correctly to support the contents of the pasid argument and the type of argument at. If the check fails is considered a modelling error. Returns true on success.

LN Requester Extended Capability registers

Downstream Port Containment (DPC) Extended Capability registers

Uses the following parameters:

L1 PM Substates Extended Capability registers

Fields to be added upon request.

Precision Time Management (PTM) Capability registers

Fields to be added upon request

M-PCIe Extended Capability registers

FRS Queueing Extended Capability registers

Fields to be added upon request

Readiness Time Reporting Extended Capability registers

Fields to be added upon request

Physical Layer 16.0 GT/s Extended Capability registers

Uses the following parameters:

Lane Margining at the Receiver Extended Capability registers

Uses the following parameters:

Physical Layer 32.0 GT/s Extended Capability registers

Uses the following parameters:

Physical Layer 64.0 GT/s Extended Capability registers

Uses the following parameters:

Designated Vendor-Specific Extended Capability (DVSEC) registers

Hierarchy ID Extended Capability registers

Native PCIe Enclosure Management (NPEM) Extended Capability registers

Alternate Protocol Extended Capability registers

Fields to be added upon request

System Firmware Intermediary (SFI) Extended Capability registers

Fields and access restrictions to be added upon request

Single Root I/O Virtualization (SR-IOV) Extended Capability registers

This is a partially functional template; users must implement the methods get_offset and get_stride, create an array of DML-objects that simulate the configuration header for each virtual function, and add instances of the vf_base_address template for each VF BAR that is implemented by the physical function.

Uses the following parameters:

Methods

Device 3 Extended Capability registers

Flit Logging Extended Capability registers

Flit Performance Measurement Extended Capability registers

Uses the following parameters:

Flit Error Injection Extended Capability registers

Shadow Functions Extended Capability registers

Uses the following parameters:

Data Object Exchange Extended Capability registers

Uses the following parameters:

Methods

DOE Templates

The doe_protocol template should be used to define user-defined DOE protocols. These should be added to a doe_capability instance accordingly. The way this is done is by adding them to the protocols group in the doe_capability. Example:

template doe_custom_protocol is doe_protocol {
    param vendor_id = 0x1234;
    param data_object_type = 0;

    shared method handle_request(const uint32 *req, uint18 req_len) {
        return 0;
    }
}

bank pcie_config {
    ...
    is defining_doe_capability;
    group doe {
        group protocols {
            group custom_protocol is doe_custom_protocol;
        }
    }
    ...
}

Methods

The implementation of this abstract method should handle a DOE request for the implemented protocol. This method must at some point (or schedule an event that at some point) call the method response_ready(res, res_len) ( or response_error() which is defined in the instantiating template doe_capability. This should be done when the response has been written to the mailbox fifo. The call should contain the length of the response.

@param[in] res The request buffer
@param[in] req_len The length of the request

Integrity and Data Encryption Extended Capability registers

Null Extended Capability registers

Virtual Function Type 0 Bank

Can be used to implement Virtual Functions, used by SR-IOV capability. Inherits the config_bank template. Note that this template must use the vf_base_address template to implement its Base Address Registers.

Virtual Function Base Address

Can be used to implement Base Address Registers in the SR-IOV capability header. Inherits the template memory_base_address. Expects the parameter map_obj to be an array of mappable objects, one for each Virtual Function.

Capabilities templates Simics Commands