RZT Flexible Software Package Documentation  Release v2.2.0

 
PCI Interface

Detailed Description

Interface for PCI communications.

Summary

The PCI interface provides common APIs for PCI HAL drivers. The PCI interface supports the following features:

Data Structures

struct  pci_configuration_register_init_t
 
struct  pci_configuration_register_transfer_t
 
struct  pci_io_register_transfer_t
 
struct  pci_message_transfer_t
 
struct  pci_status_t
 
struct  pci_callback_args_t
 
struct  pci_cfg_t
 
struct  pci_api_t
 
struct  pci_instance_t
 

Typedefs

typedef void pci_ctrl_t
 

Enumerations

enum  pci_event_t
 
enum  pci_configuration_write_type_t
 
enum  pci_configuration_read_type_t
 
enum  pci_link_speed_t
 
enum  pci_ltssm_state_t
 

Data Structure Documentation

◆ pci_configuration_register_init_t

struct pci_configuration_register_init_t

Structure to define a PCI configuration register.

Data Fields
uint32_t register_number Configuration register number to be initialized.
uint32_t init_value Configuration register initial value to be initialized.
uint32_t init_value_mask Configuration register initial value mask to be initialized.

◆ pci_configuration_register_transfer_t

struct pci_configuration_register_transfer_t

Structure to define a CfgRd/CfgWr request transfer.

◆ pci_io_register_transfer_t

struct pci_io_register_transfer_t

Structure to define a IORd/IOWr request transfer.

Data Fields
uint32_t address I/O address.

◆ pci_message_transfer_t

struct pci_message_transfer_t

Structure to define a PCI Express Msg/MsgD request transfer.

Data Fields
union pci_message_transfer_t __unnamed__
union pci_message_transfer_t __unnamed__
uint32_t header_3rd Message 3rd header.
uint32_t header_4th Message 4th header.
uint32_t data Message data for MsgD request.

◆ pci_status_t

struct pci_status_t

PCI Express status

Data Fields
bool is_link_up Current link up state.
pci_ltssm_state_t ltssm_state Current LTSSM state.

◆ pci_callback_args_t

struct pci_callback_args_t

Common callback parameter definition

Data Fields
pci_event_t event Event code.
uint32_t data1 Data when event interrupt occurred.
uint32_t data2 Data when event interrupt occurred.
uint32_t data3 Data when event interrupt occurred.
void const * p_context Context provided to user during callback.

◆ pci_cfg_t

struct pci_cfg_t

User configuration structure, used in open function

Data Fields

uint8_t channel
 Channel number to be used.
 
uint8_t function
 PCI function number to be used.
 
void const * p_configuration_register_header
 PCI configuration register.
 
pci_configuration_register_init_t const * p_configuration_register_init_list
 
uint32_t configuration_register_init_list_length
 Length of configuration register list initialized in pci_api_t::open.
 
IRQn_Type inta_irq
 INTA interrupt number.
 
uint8_t inta_ipl
 INTA interrupt priority.
 
IRQn_Type intb_irq
 INTB interrupt number.
 
uint8_t intb_ipl
 INTB interrupt priority.
 
IRQn_Type intc_irq
 INTC interrupt number.
 
uint8_t intc_ipl
 INTC interrupt priority.
 
IRQn_Type intd_irq
 INTD interrupt number.
 
uint8_t intd_ipl
 INTD interrupt priority.
 
IRQn_Type msi_irq
 MSI interrupt number.
 
uint8_t msi_ipl
 MSI interrupt priority.
 
void const * p_context
 User defined context passed to callback function.
 
void const * p_extend
 Extended PCI hardware dependent configuration.
 
void(* p_callback )(pci_callback_args_t *p_args)
 

Field Documentation

◆ p_configuration_register_init_list

pci_configuration_register_init_t const* pci_cfg_t::p_configuration_register_init_list

List of configuration registers initialized in pci_api_t::open.

◆ p_callback

void(* pci_cfg_t::p_callback) (pci_callback_args_t *p_args)

Callback provided when a PCI ISR occurs. Set to NULL for no CPU interrupt.

◆ pci_api_t

struct pci_api_t

PCI driver structure. General PCI functions implemented at the HAL layer will follow this API.

Data Fields

fsp_err_t(* open )(pci_ctrl_t *const p_ctrl, pci_cfg_t const *const p_cfg)
 
fsp_err_t(* selfConfigurationRegisterGet )(pci_ctrl_t *const p_ctrl, uint32_t register_number, uint32_t *p_data)
 
fsp_err_t(* selfConfigurationRegisterSet )(pci_ctrl_t *const p_ctrl, uint32_t register_number, uint32_t data)
 
fsp_err_t(* configurationRegisterWrite )(pci_ctrl_t *const p_ctrl, pci_configuration_write_type_t transaction_type, pci_configuration_register_transfer_t *const p_transfer)
 
fsp_err_t(* configurationRegisterRead )(pci_ctrl_t *const p_ctrl, pci_configuration_read_type_t transaction_type, pci_configuration_register_transfer_t *const p_transfer)
 
fsp_err_t(* iORegisterWrite )(pci_ctrl_t *const p_ctrl, pci_io_register_transfer_t *const p_transfer)
 
fsp_err_t(* iORegisterRead )(pci_ctrl_t *const p_ctrl, pci_io_register_transfer_t *const p_transfer)
 
fsp_err_t(* messageWrite )(pci_ctrl_t *const p_ctrl, pci_message_transfer_t *const p_transfer, bool with_data)
 
fsp_err_t(* messageRead )(pci_ctrl_t *const p_ctrl, pci_message_transfer_t *const p_transfer)
 
fsp_err_t(* intxAssert )(pci_ctrl_t *const p_ctrl)
 
fsp_err_t(* intxDeassert )(pci_ctrl_t *const p_ctrl)
 
fsp_err_t(* linkStatusGet )(pci_ctrl_t *const p_ctrl, pci_status_t *const p_status)
 
fsp_err_t(* linkWidthChange )(pci_ctrl_t *const p_ctrl, uint32_t link_width, uint32_t option)
 
fsp_err_t(* linkSpeedChange )(pci_ctrl_t *const p_ctrl, pci_link_speed_t link_speed, uint32_t option)
 
fsp_err_t(* linkEqualizationRequest )(pci_ctrl_t *const p_ctrl)
 
fsp_err_t(* callbackSet )(pci_ctrl_t *const p_ctrl, void(*p_callback)(pci_callback_args_t *), void const *const p_context, pci_callback_args_t *const p_callback_memory)
 
fsp_err_t(* close )(pci_ctrl_t *const p_ctrl)
 

Field Documentation

◆ open

fsp_err_t(* pci_api_t::open) (pci_ctrl_t *const p_ctrl, pci_cfg_t const *const p_cfg)

Open function for PCI device.

Parameters
[in,out]p_ctrlPointer to the PCI control block. Must be declared by user. Value set here.
[in]p_cfgPointer to PCI configuration structure. All elements of this structure must be set by user.

◆ selfConfigurationRegisterGet

fsp_err_t(* pci_api_t::selfConfigurationRegisterGet) (pci_ctrl_t *const p_ctrl, uint32_t register_number, uint32_t *p_data)

Get the self PCI configuration register value.

Parameters
[in,out]p_ctrlPointer to the PCI control block.
[in]register_numberRegister number of the configuration register.
[out]p_dataMemory address to return data.

◆ selfConfigurationRegisterSet

fsp_err_t(* pci_api_t::selfConfigurationRegisterSet) (pci_ctrl_t *const p_ctrl, uint32_t register_number, uint32_t data)

Set the self PCI configuration register value.

Parameters
[in,out]p_ctrlPointer to the PCI control block.
[in]register_numberRegister number of the configuration register.
[in]dataValue to set.

◆ configurationRegisterWrite

fsp_err_t(* pci_api_t::configurationRegisterWrite) (pci_ctrl_t *const p_ctrl, pci_configuration_write_type_t transaction_type, pci_configuration_register_transfer_t *const p_transfer)

Issue Configuration Write Type 0/1 Request (CfgWr 0/1).

Parameters
[in]p_ctrlPointer to the PCI control block.
[in]transaction_typeWhether issue CfgWr0 or CfgWr1
[in]p_transferPointer for data to send.

◆ configurationRegisterRead

fsp_err_t(* pci_api_t::configurationRegisterRead) (pci_ctrl_t *const p_ctrl, pci_configuration_read_type_t transaction_type, pci_configuration_register_transfer_t *const p_transfer)

Issue Configuration Read Type 0/1 Request (CfgRd 0/1).

Parameters
[in]p_ctrlPointer to the PCI control block.
[in]transaction_typeWhether issue CfgRd0 or CfgRd1
[in]p_transferPointer for store receive data.

◆ iORegisterWrite

fsp_err_t(* pci_api_t::iORegisterWrite) (pci_ctrl_t *const p_ctrl, pci_io_register_transfer_t *const p_transfer)

Issue I/O Write Request (IOWr).

Parameters
[in]p_ctrlPointer to the PCI control block.
[in]p_transferPointer for data to send.

◆ iORegisterRead

fsp_err_t(* pci_api_t::iORegisterRead) (pci_ctrl_t *const p_ctrl, pci_io_register_transfer_t *const p_transfer)

Issue I/O Read Request (IORd).

Parameters
[in]p_ctrlPointer to the PCI control block.
[in]p_transferPointer for store receive I/O data.

◆ messageWrite

fsp_err_t(* pci_api_t::messageWrite) (pci_ctrl_t *const p_ctrl, pci_message_transfer_t *const p_transfer, bool with_data)

PCI Express issue Message Request (Msg) / Message Request with data payload (MsgD).

Parameters
[in]p_ctrlPointer to the PCI control block.
[in]p_transferPointer for message data to send.
[in]with_dataWeather issue Meg or MsgD request.

◆ messageRead

fsp_err_t(* pci_api_t::messageRead) (pci_ctrl_t *const p_ctrl, pci_message_transfer_t *const p_transfer)

PCI Express read Message Request.

Parameters
[in]p_ctrlPointer to the PCI control block.
[in]p_transferPointer for store receive message data.

◆ intxAssert

fsp_err_t(* pci_api_t::intxAssert) (pci_ctrl_t *const p_ctrl)

Assert INTx interrupt.

Parameters
[in]p_ctrlPointer to the PCI control block.

◆ intxDeassert

fsp_err_t(* pci_api_t::intxDeassert) (pci_ctrl_t *const p_ctrl)

Deassert INTx interrupt.

Parameters
[in]p_ctrlPointer to the PCI control block.

◆ linkStatusGet

fsp_err_t(* pci_api_t::linkStatusGet) (pci_ctrl_t *const p_ctrl, pci_status_t *const p_status)

Get PCI Express link information.

Parameters
[in,out]p_ctrlPointer to the PCI control block.
[out]p_statusMemory address to return data.

◆ linkWidthChange

fsp_err_t(* pci_api_t::linkWidthChange) (pci_ctrl_t *const p_ctrl, uint32_t link_width, uint32_t option)

PCI Express link width change.

Parameters
[in]p_ctrlPointer to the PCI control block.
[in]link_widthLink width to change.
[in]optionOption when link width to change.

◆ linkSpeedChange

fsp_err_t(* pci_api_t::linkSpeedChange) (pci_ctrl_t *const p_ctrl, pci_link_speed_t link_speed, uint32_t option)

PCI Express link speed change.

Parameters
[in]p_ctrlPointer to the PCI control block.
[in]link_speedLink speed to change.
[in]optionOption when link speed to change.

◆ linkEqualizationRequest

fsp_err_t(* pci_api_t::linkEqualizationRequest) (pci_ctrl_t *const p_ctrl)

PCI Express send link equalization.

Parameters
[in]p_ctrlPointer to the PCI control block.

◆ callbackSet

fsp_err_t(* pci_api_t::callbackSet) (pci_ctrl_t *const p_ctrl, void(*p_callback)(pci_callback_args_t *), void const *const p_context, pci_callback_args_t *const p_callback_memory)

Specify callback function and optional context pointer and working memory pointer.

Parameters
[in]p_ctrlControl block set in pci_api_t::open call.
[in]p_callbackCallback function to register
[in]p_contextPointer to send to callback function
[in]p_working_memoryPointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback.

◆ close

fsp_err_t(* pci_api_t::close) (pci_ctrl_t *const p_ctrl)

Close function for PCI device.

Parameters
[in]p_ctrlPointer to the PCI control block.

◆ pci_instance_t

struct pci_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
pci_ctrl_t * p_ctrl Pointer to the control structure for this instance.
pci_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
pci_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ pci_ctrl_t

typedef void pci_ctrl_t

PCI control block. Allocate an instance specific control block to pass into the PCI API calls.

Enumeration Type Documentation

◆ pci_event_t

PCI events.

Enumerator
PCI_EVENT_INTA_INTERRUPT 

INTA interrupt.

PCI_EVENT_INTB_INTERRUPT 

INTB interrupt.

PCI_EVENT_INTC_INTERRUPT 

INTC interrupt.

PCI_EVENT_INTD_INTERRUPT 

INTD interrupt.

PCI_EVENT_MSI_INTERRUPT 

MSI interrupt.

PCI_EVENT_MESSAGE_RECEIVE 

Message receive.

PCI_EVENT_CORRECTABLE_ERROR 

Correctable error.

PCI_EVENT_UNCORRECTABLE_ERROR_NON_FATAL 

Non fatal error.

PCI_EVENT_UNCORRECTABLE_ERROR_FATAL 

Fatal error.

PCI_EVENT_FUNCTION_LEVEL_RESET 

Function level reset.

PCI_EVENT_LINK_EQUALIZATION_REQUEST 

Link equalization request.

PCI_EVENT_LINK_WIDTH_CHANGE 

Link width change.

PCI_EVENT_EVENT 

Event interrupt.

PCI_EVENT_D3_EVENT 

Non-D0 state transition request receive.

PCI_EVENT_PME_TURN_OFF_RCV_EVENT 

PME_Turn_Off message receive.

PCI_EVENT_PME_STATUS_CLEAR 

PME_STATUS clear output.

PCI_EVENT_PM_PME_RECEIVE 

PM_PME message receive interrupt.

PCI_EVENT_POWEROFF_L2 

POWEROFF indication on L2.

◆ pci_configuration_write_type_t

PCI Configuration Write Type 0/1

Enumerator
PCI_CONFIGURATION_WRITE_TYPE_0 

Configuration Write Type 0 (CfgWr0)

PCI_CONFIGURATION_WRITE_TYPE_1 

Configuration Write Type 1 (CfgWr1)

◆ pci_configuration_read_type_t

PCI Configuration Read Type 0/1

Enumerator
PCI_CONFIGURATION_READ_TYPE_0 

Configuration Read Type 0 (CfgRd0)

PCI_CONFIGURATION_READ_TYPE_1 

Configuration Read Type 1 (CfgRd1)

◆ pci_link_speed_t

PCI Express link speed

Enumerator
PCI_LINK_SPEED_2_5_GTS 

2.5 GT/s PCI Express link

PCI_LINK_SPEED_5_0_GTS 

5.0 GT/s PCI Express link

PCI_LINK_SPEED_8_0_GTS 

8.0 GT/s PCI Express link

PCI_LINK_SPEED_16_0_GTS 

16.0 GT/s PCI Express link

◆ pci_ltssm_state_t

PCI Express LTSSM state.

Enumerator
PCI_LTSSM_STATE_DETECT 

LTSSM detect state.

PCI_LTSSM_STATE_POLLING 

LTSSM polling state.

PCI_LTSSM_STATE_CONFIG 

LTSSM configuration state.

PCI_LTSSM_STATE_L0 

LTSSM L0 state.

PCI_LTSSM_STATE_L1 

LTSSM L1 state.

PCI_LTSSM_STATE_L2 

LTSSM L2 state.

PCI_LTSSM_STATE_RECOVERY 

LTSSM recovery state.

PCI_LTSSM_STATE_DISABLE 

LTSSM disable state.

PCI_LTSSM_STATE_LOOPBACK 

LTSSM loopback state.