RapidIO Subsystem Guide

Author:

Matt Porter

Introduction

RapidIO is a high speed switched fabric interconnect with features aimedat the embedded market. RapidIO provides support for memory-mapped I/Oas well as message-based transactions over the switched fabric network.RapidIO has a standardized discovery mechanism not unlike the PCI busstandard that allows simple detection of devices in a network.

This documentation is provided for developers intending to supportRapidIO on new architectures, write new drivers, or to understand thesubsystem internals.

Known Bugs and Limitations

Bugs

None. ;)

Limitations

  1. Access/management of RapidIO memory regions is not supported

  2. Multiple host enumeration is not supported

RapidIO driver interface

Drivers are provided a set of calls in order to interface with thesubsystem to gather info on devices, request/map memory regionresources, and manage mailboxes/doorbells.

Functions

intrio_local_read_config_32(structrio_mport*port,u32offset,u32*data)

Read 32 bits from local configuration space

Parameters

structrio_mport*port

Master port

u32offset

Offset into local configuration space

u32*data

Pointer to read data into

Description

Reads 32 bits of data from the specified offset within the localdevice’s configuration space.

intrio_local_write_config_32(structrio_mport*port,u32offset,u32data)

Write 32 bits to local configuration space

Parameters

structrio_mport*port

Master port

u32offset

Offset into local configuration space

u32data

Data to be written

Description

Writes 32 bits of data to the specified offset within the localdevice’s configuration space.

intrio_local_read_config_16(structrio_mport*port,u32offset,u16*data)

Read 16 bits from local configuration space

Parameters

structrio_mport*port

Master port

u32offset

Offset into local configuration space

u16*data

Pointer to read data into

Description

Reads 16 bits of data from the specified offset within the localdevice’s configuration space.

intrio_local_write_config_16(structrio_mport*port,u32offset,u16data)

Write 16 bits to local configuration space

Parameters

structrio_mport*port

Master port

u32offset

Offset into local configuration space

u16data

Data to be written

Description

Writes 16 bits of data to the specified offset within the localdevice’s configuration space.

intrio_local_read_config_8(structrio_mport*port,u32offset,u8*data)

Read 8 bits from local configuration space

Parameters

structrio_mport*port

Master port

u32offset

Offset into local configuration space

u8*data

Pointer to read data into

Description

Reads 8 bits of data from the specified offset within the localdevice’s configuration space.

intrio_local_write_config_8(structrio_mport*port,u32offset,u8data)

Write 8 bits to local configuration space

Parameters

structrio_mport*port

Master port

u32offset

Offset into local configuration space

u8data

Data to be written

Description

Writes 8 bits of data to the specified offset within the localdevice’s configuration space.

intrio_read_config_32(structrio_dev*rdev,u32offset,u32*data)

Read 32 bits from configuration space

Parameters

structrio_dev*rdev

RIO device

u32offset

Offset into device configuration space

u32*data

Pointer to read data into

Description

Reads 32 bits of data from the specified offset within theRIO device’s configuration space.

intrio_write_config_32(structrio_dev*rdev,u32offset,u32data)

Write 32 bits to configuration space

Parameters

structrio_dev*rdev

RIO device

u32offset

Offset into device configuration space

u32data

Data to be written

Description

Writes 32 bits of data to the specified offset within theRIO device’s configuration space.

intrio_read_config_16(structrio_dev*rdev,u32offset,u16*data)

Read 16 bits from configuration space

Parameters

structrio_dev*rdev

RIO device

u32offset

Offset into device configuration space

u16*data

Pointer to read data into

Description

Reads 16 bits of data from the specified offset within theRIO device’s configuration space.

intrio_write_config_16(structrio_dev*rdev,u32offset,u16data)

Write 16 bits to configuration space

Parameters

structrio_dev*rdev

RIO device

u32offset

Offset into device configuration space

u16data

Data to be written

Description

Writes 16 bits of data to the specified offset within theRIO device’s configuration space.

intrio_read_config_8(structrio_dev*rdev,u32offset,u8*data)

Read 8 bits from configuration space

Parameters

structrio_dev*rdev

RIO device

u32offset

Offset into device configuration space

u8*data

Pointer to read data into

Description

Reads 8 bits of data from the specified offset within theRIO device’s configuration space.

intrio_write_config_8(structrio_dev*rdev,u32offset,u8data)

Write 8 bits to configuration space

Parameters

structrio_dev*rdev

RIO device

u32offset

Offset into device configuration space

u8data

Data to be written

Description

Writes 8 bits of data to the specified offset within theRIO device’s configuration space.

intrio_send_doorbell(structrio_dev*rdev,u16data)

Send a doorbell message to a device

Parameters

structrio_dev*rdev

RIO device

u16data

Doorbell message data

Description

Send a doorbell message to a RIO device. The doorbell messagehas a 16-bit info field provided by thedata argument.

voidrio_init_mbox_res(structresource*res,intstart,intend)

Initialize a RIO mailbox resource

Parameters

structresource*res

resource struct

intstart

start of mailbox range

intend

end of mailbox range

Description

This function is used to initialize the fields of a resourcefor use as a mailbox resource. It initializes a range ofmailboxes using the start and end arguments.

voidrio_init_dbell_res(structresource*res,u16start,u16end)

Initialize a RIO doorbell resource

Parameters

structresource*res

resource struct

u16start

start of doorbell range

u16end

end of doorbell range

Description

This function is used to initialize the fields of a resourcefor use as a doorbell resource. It initializes a range ofdoorbell messages using the start and end arguments.

RIO_DEVICE

RIO_DEVICE(dev,ven)

macro used to describe a specific RIO device

Parameters

dev

the 16 bit RIO device ID

ven

the 16 bit RIO vendor ID

Description

This macro is used to create astructrio_device_id that matches aspecific device. The assembly vendor and assembly device fieldswill be set toRIO_ANY_ID.

intrio_add_outb_message(structrio_mport*mport,structrio_dev*rdev,intmbox,void*buffer,size_tlen)

Add RIO message to an outbound mailbox queue

Parameters

structrio_mport*mport

RIO master port containing the outbound queue

structrio_dev*rdev

RIO device the message is be sent to

intmbox

The outbound mailbox queue

void*buffer

Pointer to the message buffer

size_tlen

Length of the message buffer

Description

Adds a RIO message buffer to an outbound mailbox queue fortransmission. Returns 0 on success.

intrio_add_inb_buffer(structrio_mport*mport,intmbox,void*buffer)

Add buffer to an inbound mailbox queue

Parameters

structrio_mport*mport

Master port containing the inbound mailbox

intmbox

The inbound mailbox number

void*buffer

Pointer to the message buffer

Description

Adds a buffer to an inbound mailbox queue for reception. Returns0 on success.

void*rio_get_inb_message(structrio_mport*mport,intmbox)

Get A RIO message from an inbound mailbox queue

Parameters

structrio_mport*mport

Master port containing the inbound mailbox

intmbox

The inbound mailbox number

Description

Get a RIO message from an inbound mailbox queue. Returns 0 on success.

constchar*rio_name(structrio_dev*rdev)

Get the unique RIO device identifier

Parameters

structrio_dev*rdev

RIO device

Description

Get the unique RIO device identifier. Returns the deviceidentifier string.

void*rio_get_drvdata(structrio_dev*rdev)

Get RIO driver specific data

Parameters

structrio_dev*rdev

RIO device

Description

Get RIO driver specific data. Returns a pointer to thedriver specific data.

voidrio_set_drvdata(structrio_dev*rdev,void*data)

Set RIO driver specific data

Parameters

structrio_dev*rdev

RIO device

void*data

Pointer to driver specific data

Description

Set RIO driver specific data. devicestructdriver data pointeris set to thedata argument.

structrio_dev*rio_dev_get(structrio_dev*rdev)

Increments the reference count of the RIO device structure

Parameters

structrio_dev*rdev

RIO device being referenced

Description

Each live reference to a device should be refcounted.

Drivers for RIO devices should normally record such references intheirprobe() methods, when they bind to a device, and releasethem by callingrio_dev_put(), in theirdisconnect() methods.

voidrio_dev_put(structrio_dev*rdev)

Release a use of the RIO device structure

Parameters

structrio_dev*rdev

RIO device being disconnected

Description

Must be called when a user of a device is finished with it.When the last user of the device calls this function, thememory of the device is freed.

intrio_register_driver(structrio_driver*rdrv)

register a new RIO driver

Parameters

structrio_driver*rdrv

the RIO driver structure to register

Description

Adds astructrio_driver to the list of registered drivers.Returns a negative value on error, otherwise 0. If no erroroccurred, the driver remains registered even if no devicewas claimed during registration.

voidrio_unregister_driver(structrio_driver*rdrv)

unregister a RIO driver

Parameters

structrio_driver*rdrv

the RIO driver structure to unregister

Description

Deletes thestructrio_driver from the list of registered RIOdrivers, gives it a chance to clean up by calling itsremove()function for each device it was responsible for, and marks thosedevices as driverless.

u16rio_local_get_device_id(structrio_mport*port)

Get the base/extended device id for a port

Parameters

structrio_mport*port

RIO master port from which to get the deviceid

Description

Reads the base/extended device id from the local deviceimplementing the master port. Returns the 8/16-bit deviceid.

intrio_query_mport(structrio_mport*port,structrio_mport_attr*mport_attr)

Query mport device attributes

Parameters

structrio_mport*port

mport device to query

structrio_mport_attr*mport_attr

mport attributes data structure

Description

Returns attributes of specified mport through thepointer to attributes data structure.

structrio_net*rio_alloc_net(structrio_mport*mport)

Allocate and initialize a new RIO network data structure

Parameters

structrio_mport*mport

Master port associated with the RIO network

Description

Allocates a RIO network structure, initializes per-networklist heads, and adds the associated master port to thenetwork list of associated master ports. Returns aRIO network pointer on success orNULL on failure.

voidrio_local_set_device_id(structrio_mport*port,u16did)

Set the base/extended device id for a port

Parameters

structrio_mport*port

RIO master port

u16did

Device ID value to be written

Description

Writes the base/extended device id from a device.

intrio_add_device(structrio_dev*rdev)

Adds a RIO device to the device model

Parameters

structrio_dev*rdev

RIO device

Description

Adds the RIO device to the global device list and adds the RIOdevice to the RIO device list. Creates the generic sysfs nodesfor an RIO device.

intrio_request_inb_mbox(structrio_mport*mport,void*dev_id,intmbox,intentries,void(*minb)(structrio_mport*mport,void*dev_id,intmbox,intslot))

request inbound mailbox service

Parameters

structrio_mport*mport

RIO master port from which to allocate the mailbox resource

void*dev_id

Device specific pointer to pass on event

intmbox

Mailbox number to claim

intentries

Number of entries in inbound mailbox queue

void(*minb)(structrio_mport*mport,void*dev_id,intmbox,intslot)

Callback to execute when inbound message is received

Description

Requests ownership of an inbound mailbox resource and bindsa callback function to the resource. Returns0 on success.

intrio_release_inb_mbox(structrio_mport*mport,intmbox)

release inbound mailbox message service

Parameters

structrio_mport*mport

RIO master port from which to release the mailbox resource

intmbox

Mailbox number to release

Description

Releases ownership of an inbound mailbox resource. Returns 0if the request has been satisfied.

intrio_request_outb_mbox(structrio_mport*mport,void*dev_id,intmbox,intentries,void(*moutb)(structrio_mport*mport,void*dev_id,intmbox,intslot))

request outbound mailbox service

Parameters

structrio_mport*mport

RIO master port from which to allocate the mailbox resource

void*dev_id

Device specific pointer to pass on event

intmbox

Mailbox number to claim

intentries

Number of entries in outbound mailbox queue

void(*moutb)(structrio_mport*mport,void*dev_id,intmbox,intslot)

Callback to execute when outbound message is sent

Description

Requests ownership of an outbound mailbox resource and bindsa callback function to the resource. Returns 0 on success.

intrio_release_outb_mbox(structrio_mport*mport,intmbox)

release outbound mailbox message service

Parameters

structrio_mport*mport

RIO master port from which to release the mailbox resource

intmbox

Mailbox number to release

Description

Releases ownership of an inbound mailbox resource. Returns 0if the request has been satisfied.

intrio_request_inb_dbell(structrio_mport*mport,void*dev_id,u16start,u16end,void(*dinb)(structrio_mport*mport,void*dev_id,u16src,u16dst,u16info))

request inbound doorbell message service

Parameters

structrio_mport*mport

RIO master port from which to allocate the doorbell resource

void*dev_id

Device specific pointer to pass on event

u16start

Doorbell info range start

u16end

Doorbell info range end

void(*dinb)(structrio_mport*mport,void*dev_id,u16src,u16dst,u16info)

Callback to execute when doorbell is received

Description

Requests ownership of an inbound doorbell resource and bindsa callback function to the resource. Returns 0 if the requesthas been satisfied.

intrio_release_inb_dbell(structrio_mport*mport,u16start,u16end)

release inbound doorbell message service

Parameters

structrio_mport*mport

RIO master port from which to release the doorbell resource

u16start

Doorbell info range start

u16end

Doorbell info range end

Description

Releases ownership of an inbound doorbell resource and removescallback from the doorbell event list. Returns 0 if the requesthas been satisfied.

structresource*rio_request_outb_dbell(structrio_dev*rdev,u16start,u16end)

request outbound doorbell message range

Parameters

structrio_dev*rdev

RIO device from which to allocate the doorbell resource

u16start

Doorbell message range start

u16end

Doorbell message range end

Description

Requests ownership of a doorbell message range. Returns a resourceif the request has been satisfied orNULL on failure.

intrio_release_outb_dbell(structrio_dev*rdev,structresource*res)

release outbound doorbell message range

Parameters

structrio_dev*rdev

RIO device from which to release the doorbell resource

structresource*res

Doorbell resource to be freed

Description

Releases ownership of a doorbell message range. Returns 0 if therequest has been satisfied.

intrio_add_mport_pw_handler(structrio_mport*mport,void*context,int(*pwcback)(structrio_mport*mport,void*context,unionrio_pw_msg*msg,intstep))

add port-write message handler into the list of mport specific pw handlers

Parameters

structrio_mport*mport

RIO master port to bind the portwrite callback

void*context

Handler specific context to pass on event

int(*pwcback)(structrio_mport*mport,void*context,unionrio_pw_msg*msg,intstep)

Callback to execute when portwrite is received

Description

Returns 0 if the request has been satisfied.

intrio_del_mport_pw_handler(structrio_mport*mport,void*context,int(*pwcback)(structrio_mport*mport,void*context,unionrio_pw_msg*msg,intstep))

remove port-write message handler from the list of mport specific pw handlers

Parameters

structrio_mport*mport

RIO master port to bind the portwrite callback

void*context

Registered handler specific context to pass on event

int(*pwcback)(structrio_mport*mport,void*context,unionrio_pw_msg*msg,intstep)

Registered callback function

Description

Returns 0 if the request has been satisfied.

intrio_request_inb_pwrite(structrio_dev*rdev,int(*pwcback)(structrio_dev*rdev,unionrio_pw_msg*msg,intstep))

request inbound port-write message service for specific RapidIO device

Parameters

structrio_dev*rdev

RIO device to which register inbound port-write callback routine

int(*pwcback)(structrio_dev*rdev,unionrio_pw_msg*msg,intstep)

Callback routine to execute when port-write is received

Description

Binds a port-write callback function to the RapidIO device.Returns 0 if the request has been satisfied.

intrio_release_inb_pwrite(structrio_dev*rdev)

release inbound port-write message service associated with specific RapidIO device

Parameters

structrio_dev*rdev

RIO device which registered for inbound port-write callback

Description

Removes callback from the rio_dev structure. Returns 0 if the requesthas been satisfied.

voidrio_pw_enable(structrio_mport*mport,intenable)

Enables/disables port-write handling by a master port

Parameters

structrio_mport*mport

Master port associated with port-write handling

intenable

1=enable, 0=disable

intrio_map_inb_region(structrio_mport*mport,dma_addr_tlocal,u64rbase,u32size,u32rflags)
  • Map inbound memory region.

Parameters

structrio_mport*mport

Master port.

dma_addr_tlocal

physical address of memory region to be mapped

u64rbase

RIO base address assigned to this window

u32size

Size of the memory region

u32rflags

Flags for mapping.

Return

0 -- Success.

Description

This function will create the mapping from RIO space to local memory.

voidrio_unmap_inb_region(structrio_mport*mport,dma_addr_tlstart)
  • Unmap the inbound memory region

Parameters

structrio_mport*mport

Master port

dma_addr_tlstart

physical address of memory region to be unmapped

intrio_map_outb_region(structrio_mport*mport,u16destid,u64rbase,u32size,u32rflags,dma_addr_t*local)
  • Map outbound memory region.

Parameters

structrio_mport*mport

Master port.

u16destid

destination id window points to

u64rbase

RIO base address window translates to

u32size

Size of the memory region

u32rflags

Flags for mapping.

dma_addr_t*local

physical address of memory region mapped

Return

0 -- Success.

Description

This function will create the mapping from RIO space to local memory.

voidrio_unmap_outb_region(structrio_mport*mport,u16destid,u64rstart)
  • Unmap the inbound memory region

Parameters

structrio_mport*mport

Master port

u16destid

destination id mapping points to

u64rstart

RIO base address window translates to

u32rio_mport_get_physefb(structrio_mport*port,intlocal,u16destid,u8hopcount,u32*rmap)

Helper function that returns register offset for Physical Layer Extended Features Block.

Parameters

structrio_mport*port

Master port to issue transaction

intlocal

Indicate a local master port or remote device access

u16destid

Destination ID of the device

u8hopcount

Number of switch hops to the device

u32*rmap

pointer to location to store register map type info

structrio_dev*rio_get_comptag(u32comp_tag,structrio_dev*from)

Begin or continue searching for a RIO device by component tag

Parameters

u32comp_tag

RIO component tag to match

structrio_dev*from

Previous RIO device found in search, orNULL for new search

Description

Iterates through the list of known RIO devices. If a RIO device isfound with a matchingcomp_tag, a pointer to its devicestructure is returned. Otherwise,NULL is returned. A new searchis initiated by passingNULL to thefrom argument. Otherwise, iffrom is notNULL, searches continue from next device on the globallist.

intrio_set_port_lockout(structrio_dev*rdev,u32pnum,intlock)

Sets/clears LOCKOUT bit (RIO EM 1.3) for a switch port.

Parameters

structrio_dev*rdev

Pointer to RIO device control structure

u32pnum

Switch port number to set LOCKOUT bit

intlock

Operation : set (=1) or clear (=0)

intrio_enable_rx_tx_port(structrio_mport*port,intlocal,u16destid,u8hopcount,u8port_num)

enable input receiver and output transmitter of given port

Parameters

structrio_mport*port

Master port associated with the RIO network

intlocal

local=1 select local port otherwise a far device is reached

u16destid

Destination ID of the device to check host bit

u8hopcount

Number of hops to reach the target

u8port_num

Port (-number on switch) to enable on a far end device

Description

Returns 0 or 1 from on General Control Command and Status Register(EXT_PTR+0x3C)

intrio_mport_chk_dev_access(structrio_mport*mport,u16destid,u8hopcount)

Validate access to the specified device.

Parameters

structrio_mport*mport

Master port to send transactions

u16destid

Device destination ID in network

u8hopcount

Number of hops into the network

intrio_inb_pwrite_handler(structrio_mport*mport,unionrio_pw_msg*pw_msg)

inbound port-write message handler

Parameters

structrio_mport*mport

mport device associated with port-write

unionrio_pw_msg*pw_msg

pointer to inbound port-write message

Description

Processes an inbound port-write message. Returns 0 if the requesthas been satisfied.

u32rio_mport_get_efb(structrio_mport*port,intlocal,u16destid,u8hopcount,u32from)

get pointer to next extended features block

Parameters

structrio_mport*port

Master port to issue transaction

intlocal

Indicate a local master port or remote device access

u16destid

Destination ID of the device

u8hopcount

Number of switch hops to the device

u32from

Offset of current Extended Feature block header (if 0 startsfrom ExtFeaturePtr)

u32rio_mport_get_feature(structrio_mport*port,intlocal,u16destid,u8hopcount,intftr)

query for devices’ extended features

Parameters

structrio_mport*port

Master port to issue transaction

intlocal

Indicate a local master port or remote device access

u16destid

Destination ID of the device

u8hopcount

Number of switch hops to the device

intftr

Extended feature code

Description

Tell if a device supports a given RapidIO capability.Returns the offset of the requested extended featureblock within the device’s RIO configuration space or0 in case the device does not support it.

intrio_lock_device(structrio_mport*port,u16destid,u8hopcount,intwait_ms)

Acquires host device lock for specified device

Parameters

structrio_mport*port

Master port to send transaction

u16destid

Destination ID for device/switch

u8hopcount

Hopcount to reach switch

intwait_ms

Max wait time in msec (0 = no timeout)

Description

Attepts to acquire host device lock for specified deviceReturns 0 if device lock acquired or EINVAL if timeout expires.

intrio_unlock_device(structrio_mport*port,u16destid,u8hopcount)

Releases host device lock for specified device

Parameters

structrio_mport*port

Master port to send transaction

u16destid

Destination ID for device/switch

u8hopcount

Hopcount to reach switch

Description

Returns 0 if device lock released or EINVAL if fails.

intrio_route_add_entry(structrio_dev*rdev,u16table,u16route_destid,u8route_port,intlock)

Add a route entry to a switch routing table

Parameters

structrio_dev*rdev

RIO device

u16table

Routing table ID

u16route_destid

Destination ID to be routed

u8route_port

Port number to be routed

intlock

apply a hardware lock on switch device flag (1=lock, 0=no_lock)

Description

If available calls the switch specificadd_entry() method to add a routeentry into a switch routing table. Otherwise uses standard RT update methodas defined by RapidIO specification. A specific routing table can be selectedusing thetable argument if a switch has per port routing tables orthe standard (or global) table may be used by passingRIO_GLOBAL_TABLE intable.

Returns0 on success or-EINVAL on failure.

intrio_route_get_entry(structrio_dev*rdev,u16table,u16route_destid,u8*route_port,intlock)

Read an entry from a switch routing table

Parameters

structrio_dev*rdev

RIO device

u16table

Routing table ID

u16route_destid

Destination ID to be routed

u8*route_port

Pointer to read port number into

intlock

apply a hardware lock on switch device flag (1=lock, 0=no_lock)

Description

If available calls the switch specificget_entry() method to fetch a routeentry from a switch routing table. Otherwise uses standard RT read methodas defined by RapidIO specification. A specific routing table can be selectedusing thetable argument if a switch has per port routing tables orthe standard (or global) table may be used by passingRIO_GLOBAL_TABLE intable.

Returns0 on success or-EINVAL on failure.

intrio_route_clr_table(structrio_dev*rdev,u16table,intlock)

Clear a switch routing table

Parameters

structrio_dev*rdev

RIO device

u16table

Routing table ID

intlock

apply a hardware lock on switch device flag (1=lock, 0=no_lock)

Description

If available calls the switch specificclr_table() method to clear a switchrouting table. Otherwise uses standard RT write method as defined by RapidIOspecification. A specific routing table can be selected using thetableargument if a switch has per port routing tables or the standard (or global)table may be used by passingRIO_GLOBAL_TABLE intable.

Returns0 on success or-EINVAL on failure.

structdma_chan*rio_request_mport_dma(structrio_mport*mport)

request RapidIO capable DMA channel associated with specified local RapidIO mport device.

Parameters

structrio_mport*mport

RIO mport to perform DMA data transfers

Description

Returns pointer to allocated DMA channel or NULL if failed.

voidrio_release_dma(structdma_chan*dchan)

release specified DMA channel

Parameters

structdma_chan*dchan

DMA channel to release

structdma_async_tx_descriptor*rio_dma_prep_xfer(structdma_chan*dchan,u16destid,structrio_dma_data*data,enumdma_transfer_directiondirection,unsignedlongflags)

RapidIO specific wrapper for device_prep_slave_sg callback defined by DMAENGINE.

Parameters

structdma_chan*dchan

DMA channel to configure

u16destid

target RapidIO device destination ID

structrio_dma_data*data

RIO specific data descriptor

enumdma_transfer_directiondirection

DMA data transfer direction (TO or FROM the device)

unsignedlongflags

dmaengine defined flags

Description

Initializes RapidIO capable DMA channel for the specified data transfer.Uses DMA channel private extension to pass information related to remotetarget RIO device.

Return

pointer to DMA transaction descriptor if successful,error-valued pointer or NULL if failed.

intrio_register_scan(intmport_id,structrio_scan*scan_ops)

enumeration/discovery method registration interface

Parameters

intmport_id

mport device ID for which fabric scan routine has to be set(RIO_MPORT_ANY = set for all available mports)

structrio_scan*scan_ops

enumeration/discovery operations structure

Description

Registers enumeration/discovery operations with RapidIO subsystem andattaches it to the specified mport device (or all available mportsif RIO_MPORT_ANY is specified).

Returns error if the mport already has an enumerator attached to it.In case of RIO_MPORT_ANY skips mports with valid scan routines (no error).

Internals

This chapter contains the autogenerated documentation of the RapidIOsubsystem.

Structures

structrio_switch

RIO switch info

Definition:

struct rio_switch {    struct list_head node;    u8 *route_table;    u32 port_ok;    struct rio_switch_ops *ops;    spinlock_t lock;    struct rio_dev *nextdev[];};

Members

node

Node in global list of switches

route_table

Copy of switch routing table

port_ok

Status of each port (one bit per port) - OK=1 or UNINIT=0

ops

pointer to switch-specific operations

lock

lock to serialize operations updates

nextdev

Array of per-port pointers to the next attached device

structrio_switch_ops

Per-switch operations

Definition:

struct rio_switch_ops {    struct module *owner;    int (*add_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, u16 table, u16 route_destid, u8 route_port);    int (*get_entry) (struct rio_mport *mport, u16 destid, u8 hopcount, u16 table, u16 route_destid, u8 *route_port);    int (*clr_table) (struct rio_mport *mport, u16 destid, u8 hopcount, u16 table);    int (*set_domain) (struct rio_mport *mport, u16 destid, u8 hopcount, u8 sw_domain);    int (*get_domain) (struct rio_mport *mport, u16 destid, u8 hopcount, u8 *sw_domain);    int (*em_init) (struct rio_dev *dev);    int (*em_handle) (struct rio_dev *dev, u8 swport);};

Members

owner

The module owner of this structure

add_entry

Callback for switch-specific route add function

get_entry

Callback for switch-specific route get function

clr_table

Callback for switch-specific clear route table function

set_domain

Callback for switch-specific domain setting function

get_domain

Callback for switch-specific domain get function

em_init

Callback for switch-specific error management init function

em_handle

Callback for switch-specific error management handler function

Description

Defines the operations that are necessary to initialize/controla particular RIO switch device.

structrio_dev

RIO device info

Definition:

struct rio_dev {    struct list_head global_list;    struct list_head net_list;    struct rio_net *net;    bool do_enum;    u16 did;    u16 vid;    u32 device_rev;    u16 asm_did;    u16 asm_vid;    u16 asm_rev;    u16 efptr;    u32 pef;    u32 swpinfo;    u32 src_ops;    u32 dst_ops;    u32 comp_tag;    u32 phys_efptr;    u32 phys_rmap;    u32 em_efptr;    u64 dma_mask;    struct rio_driver *driver;    struct device dev;    struct resource riores[RIO_MAX_DEV_RESOURCES];    int (*pwcback) (struct rio_dev *rdev, union rio_pw_msg *msg, int step);    u16 destid;    u8 hopcount;    struct rio_dev *prev;    atomic_t state;    struct rio_switch rswitch[];};

Members

global_list

Node in list of all RIO devices

net_list

Node in list of RIO devices in a network

net

Network this device is a part of

do_enum

Enumeration flag

did

Device ID

vid

Vendor ID

device_rev

Device revision

asm_did

Assembly device ID

asm_vid

Assembly vendor ID

asm_rev

Assembly revision

efptr

Extended feature pointer

pef

Processing element features

swpinfo

Switch port info

src_ops

Source operation capabilities

dst_ops

Destination operation capabilities

comp_tag

RIO component tag

phys_efptr

RIO device extended features pointer

phys_rmap

LP-Serial Register Map Type (1 or 2)

em_efptr

RIO Error Management features pointer

dma_mask

Mask of bits of RIO address this device implements

driver

Driver claiming this device

dev

Device model device

riores

RIO resources this device owns

pwcback

port-write callback function for this device

destid

Network destination ID (or associated destid for switch)

hopcount

Hopcount to this device

prev

Previous RIO device connected to the current one

state

device state

rswitch

structrio_switch (if valid for this device)

structrio_msg

RIO message event

Definition:

struct rio_msg {    struct resource *res;    void (*mcback) (struct rio_mport * mport, void *dev_id, int mbox, int slot);};

Members

res

Mailbox resource

mcback

Message event callback

structrio_dbell

RIO doorbell event

Definition:

struct rio_dbell {    struct list_head node;    struct resource *res;    void (*dinb) (struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info);    void *dev_id;};

Members

node

Node in list of doorbell events

res

Doorbell resource

dinb

Doorbell event callback

dev_id

Device specific pointer to pass on event

structrio_mport

RIO master port info

Definition:

struct rio_mport {    struct list_head dbells;    struct list_head pwrites;    struct list_head node;    struct list_head nnode;    struct rio_net *net;    struct mutex lock;    struct resource iores;    struct resource riores[RIO_MAX_MPORT_RESOURCES];    struct rio_msg inb_msg[RIO_MAX_MBOX];    struct rio_msg outb_msg[RIO_MAX_MBOX];    int host_deviceid;    struct rio_ops *ops;    unsigned char id;    unsigned char index;    unsigned int sys_size;    u32 phys_efptr;    u32 phys_rmap;    unsigned char name[RIO_MAX_MPORT_NAME];    struct device dev;    void *priv;#ifdef CONFIG_RAPIDIO_DMA_ENGINE;    struct dma_device       dma;#endif;    struct rio_scan *nscan;    atomic_t state;    unsigned int pwe_refcnt;};

Members

dbells

List of doorbell events

pwrites

List of portwrite events

node

Node in global list of master ports

nnode

Node in network list of master ports

net

RIO net this mport is attached to

lock

lock to synchronize lists manipulations

iores

I/O mem resource that this master port interface owns

riores

RIO resources that this master port interfaces owns

inb_msg

RIO inbound message event descriptors

outb_msg

RIO outbound message event descriptors

host_deviceid

Host device ID associated with this master port

ops

configuration space functions

id

Port ID, unique among all ports

index

Port index, unique among all port interfaces of the same type

sys_size

RapidIO common transport system size

phys_efptr

RIO port extended features pointer

phys_rmap

LP-Serial EFB Register Mapping type (1 or 2).

name

Port name string

dev

device structure associated with an mport

priv

Master port private data

dma

DMA device associated with mport

nscan

RapidIO network enumeration/discovery operations

state

mport device state

pwe_refcnt

port-write enable ref counter to track enable/disable requests

structrio_net

RIO network info

Definition:

struct rio_net {    struct list_head node;    struct list_head devices;    struct list_head switches;    struct list_head mports;    struct rio_mport *hport;    unsigned char id;    struct device dev;    void *enum_data;    void (*release)(struct rio_net *net);};

Members

node

Node in global list of RIO networks

devices

List of devices in this network

switches

List of switches in this network

mports

List of master ports accessing this network

hport

Default port for accessing this network

id

RIO network ID

dev

Device object

enum_data

private data specific to a network enumerator

release

enumerator-specific release callback

structrio_mport_attr

RIO mport device attributes

Definition:

struct rio_mport_attr {    int flags;    int link_speed;    int link_width;    int dma_max_sge;    int dma_max_size;    int dma_align;};

Members

flags

mport device capability flags

link_speed

SRIO link speed value (as defined by RapidIO specification)

link_width

SRIO link width value (as defined by RapidIO specification)

dma_max_sge

number of SG list entries that can be handled by DMA channel(s)

dma_max_size

max number of bytes in single DMA transfer (SG entry)

dma_align

alignment shift for DMA operations (as for other DMA operations)

structrio_ops

Low-level RIO configuration space operations

Definition:

struct rio_ops {    int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, u32 *data);    int (*lcwrite) (struct rio_mport *mport, int index, u32 offset, int len, u32 data);    int (*cread) (struct rio_mport *mport, int index, u16 destid, u8 hopcount, u32 offset, int len, u32 *data);    int (*cwrite) (struct rio_mport *mport, int index, u16 destid, u8 hopcount, u32 offset, int len, u32 data);    int (*dsend) (struct rio_mport *mport, int index, u16 destid, u16 data);    int (*pwenable) (struct rio_mport *mport, int enable);    int (*open_outb_mbox)(struct rio_mport *mport, void *dev_id, int mbox, int entries);    void (*close_outb_mbox)(struct rio_mport *mport, int mbox);    int (*open_inb_mbox)(struct rio_mport *mport, void *dev_id, int mbox, int entries);    void (*close_inb_mbox)(struct rio_mport *mport, int mbox);    int (*add_outb_message)(struct rio_mport *mport, struct rio_dev *rdev, int mbox, void *buffer, size_t len);    int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);    void *(*get_inb_message)(struct rio_mport *mport, int mbox);    int (*map_inb)(struct rio_mport *mport, dma_addr_t lstart, u64 rstart, u64 size, u32 flags);    void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart);    int (*query_mport)(struct rio_mport *mport, struct rio_mport_attr *attr);    int (*map_outb)(struct rio_mport *mport, u16 destid, u64 rstart, u32 size, u32 flags, dma_addr_t *laddr);    void (*unmap_outb)(struct rio_mport *mport, u16 destid, u64 rstart);};

Members

lcread

Callback to perform local (master port) read of config space.

lcwrite

Callback to perform local (master port) write of config space.

cread

Callback to perform network read of config space.

cwrite

Callback to perform network write of config space.

dsend

Callback to send a doorbell message.

pwenable

Callback to enable/disable port-write message handling.

open_outb_mbox

Callback to initialize outbound mailbox.

close_outb_mbox

Callback to shut down outbound mailbox.

open_inb_mbox

Callback to initialize inbound mailbox.

close_inb_mbox

Callback to shut down inbound mailbox.

add_outb_message

Callback to add a message to an outbound mailbox queue.

add_inb_buffer

Callback to add a buffer to an inbound mailbox queue.

get_inb_message

Callback to get a message from an inbound mailbox queue.

map_inb

Callback to map RapidIO address region into local memory space.

unmap_inb

Callback to unmap RapidIO address region mapped withmap_inb().

query_mport

Callback to query mport device attributes.

map_outb

Callback to map outbound address region into local memory space.

unmap_outb

Callback to unmap outbound RapidIO address region.

structrio_driver

RIO driver info

Definition:

struct rio_driver {    struct list_head node;    char *name;    const struct rio_device_id *id_table;    int (*probe) (struct rio_dev * dev, const struct rio_device_id * id);    void (*remove) (struct rio_dev * dev);    void (*shutdown)(struct rio_dev *dev);    int (*suspend) (struct rio_dev * dev, u32 state);    int (*resume) (struct rio_dev * dev);    int (*enable_wake) (struct rio_dev * dev, u32 state, int enable);    struct device_driver driver;};

Members

node

Node in list of drivers

name

RIO driver name

id_table

RIO device ids to be associated with this driver

probe

RIO device inserted

remove

RIO device removed

shutdown

shutdown notification callback

suspend

RIO device suspended

resume

RIO device awakened

enable_wake

RIO device enable wake event

driver

LDM driver struct

Description

Provides info on a RIO device driver for insertion/removal andpower management purposes.

structrio_scan

RIO enumeration and discovery operations

Definition:

struct rio_scan {    struct module *owner;    int (*enumerate)(struct rio_mport *mport, u32 flags);    int (*discover)(struct rio_mport *mport, u32 flags);};

Members

owner

The module owner of this structure

enumerate

Callback to perform RapidIO fabric enumeration.

discover

Callback to perform RapidIO fabric discovery.

structrio_scan_node

list node to register RapidIO enumeration and discovery methods with RapidIO core.

Definition:

struct rio_scan_node {    int mport_id;    struct list_head node;    struct rio_scan *ops;};

Members

mport_id

ID of an mport (net) serviced by this enumerator

node

node in global list of registered enumerators

ops

RIO enumeration and discovery operations

Enumeration and Discovery

u16rio_destid_alloc(structrio_net*net)

Allocate next available destID for given network

Parameters

structrio_net*net

RIO network

Description

Returns next available device destination ID for the specified RIO network.Marks allocated ID as one in use.Returns RIO_INVALID_DESTID if new destID is not available.

intrio_destid_reserve(structrio_net*net,u16destid)

Reserve the specified destID

Parameters

structrio_net*net

RIO network

u16destid

destID to reserve

Description

Tries to reserve the specified destID.Returns 0 if successful.

voidrio_destid_free(structrio_net*net,u16destid)

free a previously allocated destID

Parameters

structrio_net*net

RIO network

u16destid

destID to free

Description

Makes the specified destID available for use.

u16rio_destid_first(structrio_net*net)

return first destID in use

Parameters

structrio_net*net

RIO network

u16rio_destid_next(structrio_net*net,u16from)

return next destID in use

Parameters

structrio_net*net

RIO network

u16from

destination ID from which search shall continue

u16rio_get_device_id(structrio_mport*port,u16destid,u8hopcount)

Get the base/extended device id for a device

Parameters

structrio_mport*port

RIO master port

u16destid

Destination ID of device

u8hopcount

Hopcount to device

Description

Reads the base/extended device id from a device. Returns the8/16-bit device ID.

voidrio_set_device_id(structrio_mport*port,u16destid,u8hopcount,u16did)

Set the base/extended device id for a device

Parameters

structrio_mport*port

RIO master port

u16destid

Destination ID of device

u8hopcount

Hopcount to device

u16did

Device ID value to be written

Description

Writes the base/extended device id from a device.

intrio_clear_locks(structrio_net*net)

Release all host locks and signal enumeration complete

Parameters

structrio_net*net

RIO network to run on

Description

Marks the component tag CSR on each device with the enumerationcomplete flag. When complete, it then release the host locks oneach device. Returns 0 on success or-EINVAL on failure.

intrio_enum_host(structrio_mport*port)

Set host lock and initialize host destination ID

Parameters

structrio_mport*port

Master port to issue transaction

Description

Sets the local host master port lock and destination ID registerwith the host device ID value. The host device ID value is providedby the platform. Returns0 on success or-1 on failure.

intrio_device_has_destid(structrio_mport*port,intsrc_ops,intdst_ops)

Test if a device contains a destination ID register

Parameters

structrio_mport*port

Master port to issue transaction

intsrc_ops

RIO device source operations

intdst_ops

RIO device destination operations

Description

Checks the providedsrc_ops anddst_ops for the necessary transactioncapabilities that indicate whether or not a device will implement adestination ID register. Returns 1 if true or 0 if false.

voidrio_release_dev(structdevice*dev)

Frees a RIO device struct

Parameters

structdevice*dev

LDM device associated with a RIO device struct

Description

Gets the RIO devicestructassociated a RIO device struct.The RIO devicestructis freed.

intrio_is_switch(structrio_dev*rdev)

Tests if a RIO device has switch capabilities

Parameters

structrio_dev*rdev

RIO device

Description

Gets the RIO device Processing Element Features registercontents and tests for switch capabilities. Returns 1 ifthe device is a switch or 0 if it is not a switch.The RIO devicestructis freed.

structrio_dev*rio_setup_device(structrio_net*net,structrio_mport*port,u16destid,u8hopcount,intdo_enum)

Allocates and sets up a RIO device

Parameters

structrio_net*net

RIO network

structrio_mport*port

Master port to send transactions

u16destid

Current destination ID

u8hopcount

Current hopcount

intdo_enum

Enumeration/Discovery mode flag

Description

Allocates a RIO device and configures fields based on configurationspace contents. If device has a destination ID register, a destinationID is either assigned in enumeration mode or read from configurationspace in discovery mode. If the device has switch capabilities, thena switch is allocated and configured appropriately. Returns a pointerto a RIO device on success or NULL on failure.

intrio_sport_is_active(structrio_dev*rdev,intsp)

Tests if a switch port has an active connection.

Parameters

structrio_dev*rdev

RapidIO device object

intsp

Switch port number

Description

Reads the port error status CSR for a particular switch port todetermine if the port has an active link. ReturnsRIO_PORT_N_ERR_STS_PORT_OK if the port is active or0 if it isinactive.

u16rio_get_host_deviceid_lock(structrio_mport*port,u8hopcount)

Reads the Host Device ID Lock CSR on a device

Parameters

structrio_mport*port

Master port to send transaction

u8hopcount

Number of hops to the device

Description

Used during enumeration to read the Host Device ID Lock CSR on aRIO device. Returns the value of the lock register.

intrio_enum_peer(structrio_net*net,structrio_mport*port,u8hopcount,structrio_dev*prev,intprev_port)

Recursively enumerate a RIO network through a master port

Parameters

structrio_net*net

RIO network being enumerated

structrio_mport*port

Master port to send transactions

u8hopcount

Number of hops into the network

structrio_dev*prev

Previous RIO device connected to the enumerated one

intprev_port

Port on previous RIO device

Description

Recursively enumerates a RIO network. Transactions are sent via themaster port passed inport.

intrio_enum_complete(structrio_mport*port)

Tests if enumeration of a network is complete

Parameters

structrio_mport*port

Master port to send transaction

Description

Tests the PGCCSR discovered bit for non-zero value (enumerationcomplete flag). Return1 if enumeration is complete or0 ifenumeration is incomplete.

intrio_disc_peer(structrio_net*net,structrio_mport*port,u16destid,u8hopcount,structrio_dev*prev,intprev_port)

Recursively discovers a RIO network through a master port

Parameters

structrio_net*net

RIO network being discovered

structrio_mport*port

Master port to send transactions

u16destid

Current destination ID in network

u8hopcount

Number of hops into the network

structrio_dev*prev

previous rio_dev

intprev_port

previous port number

Description

Recursively discovers a RIO network. Transactions are sent via themaster port passed inport.

intrio_mport_is_active(structrio_mport*port)

Tests if master port link is active

Parameters

structrio_mport*port

Master port to test

Description

Reads the port error status CSR for the master port todetermine if the port has an active link. ReturnsRIO_PORT_N_ERR_STS_PORT_OK if the master port is activeor0 if it is inactive.

voidrio_update_route_tables(structrio_net*net)

Updates route tables in switches

Parameters

structrio_net*net

RIO network to run update on

Description

For each enumerated device, ensure that each switch in a systemhas correct routing entries. Add routes for devices that whereunknown during the first enumeration pass through the switch.

voidrio_init_em(structrio_dev*rdev)

Initializes RIO Error Management (for switches)

Parameters

structrio_dev*rdev

RIO device

Description

For each enumerated switch, call device-specific error managementinitialization routine (if supplied by the switch driver).

intrio_enum_mport(structrio_mport*mport,u32flags)

Start enumeration through a master port

Parameters

structrio_mport*mport

Master port to send transactions

u32flags

Enumeration control flags

Description

Starts the enumeration process. If somebody has enumerated ourmaster port device, then give up. If not and we have an activelink, then start recursive peer enumeration. Returns0 ifenumeration succeeds or-EBUSY if enumeration fails.

voidrio_build_route_tables(structrio_net*net)

Generate route tables from switch route entries

Parameters

structrio_net*net

RIO network to run route tables scan on

Description

For each switch device, generate a route table by copying existingroute entries from the switch.

intrio_disc_mport(structrio_mport*mport,u32flags)

Start discovery through a master port

Parameters

structrio_mport*mport

Master port to send transactions

u32flags

discovery control flags

Description

Starts the discovery process. If we have an active link,then wait for the signal that enumeration is complete (if waitis allowed).When enumeration completion is signaled, start recursivepeer discovery. Returns0 if discovery succeeds or-EBUSYon failure.

intrio_basic_attach(void)

Parameters

void

no arguments

Description

When this enumeration/discovery method is loaded as a module this functionregisters its specific enumeration and discover routines for all availableRapidIO mport devices. The “scan” command line parameter controls ability ofthe module to start RapidIO enumeration/discovery automatically.

Returns 0 for success or -EIO if unable to register itself.

This enumeration/discovery method cannot be unloaded and therefore does notprovide a matching cleanup_module routine.

Driver functionality

intrio_setup_inb_dbell(structrio_mport*mport,void*dev_id,structresource*res,void(*dinb)(structrio_mport*mport,void*dev_id,u16src,u16dst,u16info))

bind inbound doorbell callback

Parameters

structrio_mport*mport

RIO master port to bind the doorbell callback

void*dev_id

Device specific pointer to pass on event

structresource*res

Doorbell message resource

void(*dinb)(structrio_mport*mport,void*dev_id,u16src,u16dst,u16info)

Callback to execute when doorbell is received

Description

Adds a doorbell resource/callback pair into a port’sdoorbell event list. Returns 0 if the request has beensatisfied.

intrio_chk_dev_route(structrio_dev*rdev,structrio_dev**nrdev,int*npnum)

Validate route to the specified device.

Parameters

structrio_dev*rdev

RIO device failed to respond

structrio_dev**nrdev

Last active device on the route to rdev

int*npnum

nrdev’s port number on the route to rdev

Description

Follows a route to the specified RIO device to determine the last availabledevice (and corresponding RIO port) on the route.

intrio_chk_dev_access(structrio_dev*rdev)

Validate access to the specified device.

Parameters

structrio_dev*rdev

Pointer to RIO device control structure

intrio_get_input_status(structrio_dev*rdev,intpnum,u32*lnkresp)

Sends a Link-Request/Input-Status control symbol and returns link-response (if requested).

Parameters

structrio_dev*rdev

RIO devive to issue Input-status command

intpnum

Device port number to issue the command

u32*lnkresp

Response from a link partner

intrio_clr_err_stopped(structrio_dev*rdev,u32pnum,u32err_status)

Clears port Error-stopped states.

Parameters

structrio_dev*rdev

Pointer to RIO device control structure

u32pnum

Switch port number to clear errors

u32err_status

port error status (if 0 reads register from device)

Description

TODO: Currently this routine is not compatible with recovery processspecified for idt_gen3 RapidIO switch devices. It has to be reviewedto implement universal recovery process that is compatible full rangeoff available devices.IDT gen3 switch driver now implements HW-specific error handler thatissues soft port reset to the port to reset ERR_STOP bits and ackIDs.

intrio_std_route_add_entry(structrio_mport*mport,u16destid,u8hopcount,u16table,u16route_destid,u8route_port)

Add switch route table entry using standard registers defined in RIO specification rev.1.3

Parameters

structrio_mport*mport

Master port to issue transaction

u16destid

Destination ID of the device

u8hopcount

Number of switch hops to the device

u16table

routing table ID (global or port-specific)

u16route_destid

destID entry in the RT

u8route_port

destination port for specified destID

intrio_std_route_get_entry(structrio_mport*mport,u16destid,u8hopcount,u16table,u16route_destid,u8*route_port)

Read switch route table entry (port number) associated with specified destID using standard registers defined in RIO specification rev.1.3

Parameters

structrio_mport*mport

Master port to issue transaction

u16destid

Destination ID of the device

u8hopcount

Number of switch hops to the device

u16table

routing table ID (global or port-specific)

u16route_destid

destID entry in the RT

u8*route_port

returned destination port for specified destID

intrio_std_route_clr_table(structrio_mport*mport,u16destid,u8hopcount,u16table)

Clear swotch route table using standard registers defined in RIO specification rev.1.3.

Parameters

structrio_mport*mport

Master port to issue transaction

u16destid

Destination ID of the device

u8hopcount

Number of switch hops to the device

u16table

routing table ID (global or port-specific)

intrio_mport_scan(intmport_id)

execute enumeration/discovery on the specified mport

Parameters

intmport_id

number (ID) of mport device

RIO_LOP_READ

RIO_LOP_READ(size,type,len)

Generate rio_local_read_config_* functions

Parameters

size

Size of configuration space read (8, 16, 32 bits)

type

C type of value argument

len

Length of configuration space read (1, 2, 4 bytes)

Description

Generates rio_local_read_config_* functions used to accessconfiguration space registers on the local device.

RIO_LOP_WRITE

RIO_LOP_WRITE(size,type,len)

Generate rio_local_write_config_* functions

Parameters

size

Size of configuration space write (8, 16, 32 bits)

type

C type of value argument

len

Length of configuration space write (1, 2, 4 bytes)

Description

Generates rio_local_write_config_* functions used to accessconfiguration space registers on the local device.

RIO_OP_READ

RIO_OP_READ(size,type,len)

Generate rio_mport_read_config_* functions

Parameters

size

Size of configuration space read (8, 16, 32 bits)

type

C type of value argument

len

Length of configuration space read (1, 2, 4 bytes)

Description

Generates rio_mport_read_config_* functions used to accessconfiguration space registers on the local device.

RIO_OP_WRITE

RIO_OP_WRITE(size,type,len)

Generate rio_mport_write_config_* functions

Parameters

size

Size of configuration space write (8, 16, 32 bits)

type

C type of value argument

len

Length of configuration space write (1, 2, 4 bytes)

Description

Generates rio_mport_write_config_* functions used to accessconfiguration space registers on the local device.

Device model support

conststructrio_device_id*rio_match_device(conststructrio_device_id*id,conststructrio_dev*rdev)

Tell if a RIO device has a matching RIO device id structure

Parameters

conststructrio_device_id*id

the RIO device id structure to match against

conststructrio_dev*rdev

the RIO device structure to match against

Description

Used from driver probe and bus matching to check whether a RIO devicematches a device id structure provided by a RIO driver. Returns thematchingstructrio_device_id orNULL if there is no match.

intrio_device_probe(structdevice*dev)

Tell if a RIO device structure has a matching RIO device id structure

Parameters

structdevice*dev

the RIO device structure to match against

Description

return 0 and set rio_dev->driver when drv claims rio_dev, else error

voidrio_device_remove(structdevice*dev)

Remove a RIO device from the system

Parameters

structdevice*dev

the RIO device structure to match against

Description

Remove a RIO device from the system. If it has an associateddriver, then run the driverremove() method. Then updatethe reference count.

intrio_match_bus(structdevice*dev,conststructdevice_driver*drv)

Tell if a RIO device structure has a matching RIO driver device id structure

Parameters

structdevice*dev

the standard device structure to match against

conststructdevice_driver*drv

the standard driver structure containing the ids to match against

Description

Used by a driver to check whether a RIO device present in thesystem is in its list of supported devices. Returns 1 ifthere is a matchingstructrio_device_id or 0 if there isno match.

intrio_bus_init(void)

Register the RapidIO bus with the device model

Parameters

void

no arguments

Description

Registers the RIO mport device class and RIO bus type with the Linuxdevice model.

PPC32 support

intfsl_local_config_read(structrio_mport*mport,intindex,u32offset,intlen,u32*data)

Generate a MPC85xx local config space read

Parameters

structrio_mport*mport

RapidIO master port info

intindex

ID of RapdiIO interface

u32offset

Offset into configuration space

intlen

Length (in bytes) of the maintenance transaction

u32*data

Value to be read into

Description

Generates a MPC85xx local configuration space read. Returns0 onsuccess or-EINVAL on failure.

intfsl_local_config_write(structrio_mport*mport,intindex,u32offset,intlen,u32data)

Generate a MPC85xx local config space write

Parameters

structrio_mport*mport

RapidIO master port info

intindex

ID of RapdiIO interface

u32offset

Offset into configuration space

intlen

Length (in bytes) of the maintenance transaction

u32data

Value to be written

Description

Generates a MPC85xx local configuration space write. Returns0 onsuccess or-EINVAL on failure.

intfsl_rio_config_read(structrio_mport*mport,intindex,u16destid,u8hopcount,u32offset,intlen,u32*val)

Generate a MPC85xx read maintenance transaction

Parameters

structrio_mport*mport

RapidIO master port info

intindex

ID of RapdiIO interface

u16destid

Destination ID of transaction

u8hopcount

Number of hops to target device

u32offset

Offset into configuration space

intlen

Length (in bytes) of the maintenance transaction

u32*val

Location to be read into

Description

Generates a MPC85xx read maintenance transaction. Returns0 onsuccess or-EINVAL on failure.

intfsl_rio_config_write(structrio_mport*mport,intindex,u16destid,u8hopcount,u32offset,intlen,u32val)

Generate a MPC85xx write maintenance transaction

Parameters

structrio_mport*mport

RapidIO master port info

intindex

ID of RapdiIO interface

u16destid

Destination ID of transaction

u8hopcount

Number of hops to target device

u32offset

Offset into configuration space

intlen

Length (in bytes) of the maintenance transaction

u32val

Value to be written

Description

Generates an MPC85xx write maintenance transaction. Returns0 onsuccess or-EINVAL on failure.

intfsl_rio_setup(structplatform_device*dev)

Setup Freescale PowerPC RapidIO interface

Parameters

structplatform_device*dev

platform_device pointer

Description

Initializes MPC85xx RapidIO hardware interface, configuresmaster port with system-specific info, and registers themaster port with the RapidIO subsystem.

Credits

The following people have contributed to the RapidIO subsystem directlyor indirectly:

  1. Matt Portermporter@kernel.crashing.org

  2. Randy Vinsonrvinson@mvista.com

  3. Dan Malekdan@embeddedalley.com

The following people have contributed to this document:

  1. Matt Portermporter@kernel.crashing.org