Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
rio.c File Reference
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/rio.h>
#include <linux/rio_drv.h>
#include <linux/rio_ids.h>
#include <linux/rio_regs.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include "rio.h"

Go to the source code of this file.

Data Structures

struct  rio_disc_work
 

Functions

u16 rio_local_get_device_id (struct rio_mport *port)
 
int rio_request_inb_mbox (struct rio_mport *mport, void *dev_id, int mbox, int entries, void(*minb)(struct rio_mport *mport, void *dev_id, int mbox, int slot))
 
int rio_release_inb_mbox (struct rio_mport *mport, int mbox)
 
int rio_request_outb_mbox (struct rio_mport *mport, void *dev_id, int mbox, int entries, void(*moutb)(struct rio_mport *mport, void *dev_id, int mbox, int slot))
 
int rio_release_outb_mbox (struct rio_mport *mport, int mbox)
 
int rio_request_inb_dbell (struct rio_mport *mport, void *dev_id, u16 start, u16 end, void(*dinb)(struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info))
 
int rio_release_inb_dbell (struct rio_mport *mport, u16 start, u16 end)
 
struct resourcerio_request_outb_dbell (struct rio_dev *rdev, u16 start, u16 end)
 
int rio_release_outb_dbell (struct rio_dev *rdev, struct resource *res)
 
int rio_request_inb_pwrite (struct rio_dev *rdev, int(*pwcback)(struct rio_dev *rdev, union rio_pw_msg *msg, int step))
 
 EXPORT_SYMBOL_GPL (rio_request_inb_pwrite)
 
int rio_release_inb_pwrite (struct rio_dev *rdev)
 
 EXPORT_SYMBOL_GPL (rio_release_inb_pwrite)
 
int rio_map_inb_region (struct rio_mport *mport, dma_addr_t local, u64 rbase, u32 size, u32 rflags)
 
 EXPORT_SYMBOL_GPL (rio_map_inb_region)
 
void rio_unmap_inb_region (struct rio_mport *mport, dma_addr_t lstart)
 
 EXPORT_SYMBOL_GPL (rio_unmap_inb_region)
 
u32 rio_mport_get_physefb (struct rio_mport *port, int local, u16 destid, u8 hopcount)
 
struct rio_devrio_get_comptag (u32 comp_tag, struct rio_dev *from)
 
int rio_set_port_lockout (struct rio_dev *rdev, u32 pnum, int lock)
 
int rio_mport_chk_dev_access (struct rio_mport *mport, u16 destid, u8 hopcount)
 
int rio_inb_pwrite_handler (union rio_pw_msg *pw_msg)
 
 EXPORT_SYMBOL_GPL (rio_inb_pwrite_handler)
 
u32 rio_mport_get_efb (struct rio_mport *port, int local, u16 destid, u8 hopcount, u32 from)
 
u32 rio_mport_get_feature (struct rio_mport *port, int local, u16 destid, u8 hopcount, int ftr)
 
struct rio_devrio_get_asm (u16 vid, u16 did, u16 asm_vid, u16 asm_did, struct rio_dev *from)
 
struct rio_devrio_get_device (u16 vid, u16 did, struct rio_dev *from)
 
int rio_std_route_add_entry (struct rio_mport *mport, u16 destid, u8 hopcount, u16 table, u16 route_destid, u8 route_port)
 
int rio_std_route_get_entry (struct rio_mport *mport, u16 destid, u8 hopcount, u16 table, u16 route_destid, u8 *route_port)
 
int rio_std_route_clr_table (struct rio_mport *mport, u16 destid, u8 hopcount, u16 table)
 
int __devinit rio_init_mports (void)
 
 device_initcall_sync (rio_init_mports)
 
 __setup ("riohdid=", rio_hdid_setup)
 
int rio_register_mport (struct rio_mport *port)
 
 EXPORT_SYMBOL_GPL (rio_local_get_device_id)
 
 EXPORT_SYMBOL_GPL (rio_get_device)
 
 EXPORT_SYMBOL_GPL (rio_get_asm)
 
 EXPORT_SYMBOL_GPL (rio_request_inb_dbell)
 
 EXPORT_SYMBOL_GPL (rio_release_inb_dbell)
 
 EXPORT_SYMBOL_GPL (rio_request_outb_dbell)
 
 EXPORT_SYMBOL_GPL (rio_release_outb_dbell)
 
 EXPORT_SYMBOL_GPL (rio_request_inb_mbox)
 
 EXPORT_SYMBOL_GPL (rio_release_inb_mbox)
 
 EXPORT_SYMBOL_GPL (rio_request_outb_mbox)
 
 EXPORT_SYMBOL_GPL (rio_release_outb_mbox)
 

Function Documentation

__setup ( )
device_initcall_sync ( rio_init_mports  )
EXPORT_SYMBOL_GPL ( rio_request_inb_pwrite  )
EXPORT_SYMBOL_GPL ( rio_release_inb_pwrite  )
EXPORT_SYMBOL_GPL ( rio_map_inb_region  )
EXPORT_SYMBOL_GPL ( rio_unmap_inb_region  )
EXPORT_SYMBOL_GPL ( rio_inb_pwrite_handler  )
EXPORT_SYMBOL_GPL ( rio_local_get_device_id  )
EXPORT_SYMBOL_GPL ( rio_get_device  )
EXPORT_SYMBOL_GPL ( rio_get_asm  )
EXPORT_SYMBOL_GPL ( rio_request_inb_dbell  )
EXPORT_SYMBOL_GPL ( rio_release_inb_dbell  )
EXPORT_SYMBOL_GPL ( rio_request_outb_dbell  )
EXPORT_SYMBOL_GPL ( rio_release_outb_dbell  )
EXPORT_SYMBOL_GPL ( rio_request_inb_mbox  )
EXPORT_SYMBOL_GPL ( rio_release_inb_mbox  )
EXPORT_SYMBOL_GPL ( rio_request_outb_mbox  )
EXPORT_SYMBOL_GPL ( rio_release_outb_mbox  )
struct rio_dev* rio_get_asm ( u16  vid,
u16  did,
u16  asm_vid,
u16  asm_did,
struct rio_dev from 
)
read

rio_get_asm - Begin or continue searching for a RIO device by vid/did/asm_vid/asm_did : RIO vid to match or RIO_ANY_ID to match all vids : RIO did to match or RIO_ANY_ID to match all dids : RIO asm_vid to match or RIO_ANY_ID to match all asm_vids : RIO asm_did to match or RIO_ANY_ID to match all asm_dids : Previous RIO device found in search, or NULL for new search

Iterates through the list of known RIO devices. If a RIO device is found with a matching , , , , the reference count to the device is incrememted and a pointer to its device structure is returned. Otherwise, NULL is returned. A new search is initiated by passing NULL to the argument. Otherwise, if is not NULL, searches continue from next device on the global list. The reference count for is always decremented if it is not NULL.

Definition at line 1018 of file rio.c.

struct rio_dev* rio_get_comptag ( u32  comp_tag,
struct rio_dev from 
)
read

rio_get_comptag - Begin or continue searching for a RIO device by component tag : RIO component tag to match : Previous RIO device found in search, or NULL for new search

Iterates through the list of known RIO devices. If a RIO device is found with a matching , a pointer to its device structure is returned. Otherwise, NULL is returned. A new search is initiated by passing NULL to the argument. Otherwise, if is not NULL, searches continue from next device on the global list.

Definition at line 505 of file rio.c.

struct rio_dev* rio_get_device ( u16  vid,
u16  did,
struct rio_dev from 
)
read

rio_get_device - Begin or continue searching for a RIO device by vid/did : RIO vid to match or RIO_ANY_ID to match all vids : RIO did to match or RIO_ANY_ID to match all dids : Previous RIO device found in search, or NULL for new search

Iterates through the list of known RIO devices. If a RIO device is found with a matching and , the reference count to the device is incrememted and a pointer to its device structure is returned. Otherwise, NULL is returned. A new search is initiated by passing NULL to the argument. Otherwise, if is not NULL, searches continue from next device on the global list. The reference count for is always decremented if it is not NULL.

Definition at line 1059 of file rio.c.

int rio_inb_pwrite_handler ( union rio_pw_msg pw_msg)

rio_inb_pwrite_handler - process inbound port-write message : pointer to inbound port-write message

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

Definition at line 766 of file rio.c.

int __devinit rio_init_mports ( void  )

Definition at line 1280 of file rio.c.

u16 rio_local_get_device_id ( struct rio_mport port)

rio_local_get_device_id - Get the base/extended device id for a port : RIO master port from which to get the deviceid

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

Definition at line 46 of file rio.c.

int rio_map_inb_region ( struct rio_mport mport,
dma_addr_t  local,
u64  rbase,
u32  size,
u32  rflags 
)

rio_map_inb_region – Map inbound memory region. : Master port. : physical address of memory region to be mapped : RIO base address assigned to this window : Size of the memory region : Flags for mapping.

Return: 0 – Success.

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

Definition at line 413 of file rio.c.

int rio_mport_chk_dev_access ( struct rio_mport mport,
u16  destid,
u8  hopcount 
)

rio_mport_chk_dev_access - Validate access to the specified device. : Master port to send transactions : Device destination ID in network : Number of hops into the network

Definition at line 598 of file rio.c.

u32 rio_mport_get_efb ( struct rio_mport port,
int  local,
u16  destid,
u8  hopcount,
u32  from 
)

rio_mport_get_efb - get pointer to next extended features block : Master port to issue transaction : Indicate a local master port or remote device access : Destination ID of the device : Number of switch hops to the device : Offset of current Extended Feature block header (if 0 starts from ExtFeaturePtr)

Definition at line 922 of file rio.c.

u32 rio_mport_get_feature ( struct rio_mport port,
int  local,
u16  destid,
u8  hopcount,
int  ftr 
)

rio_mport_get_feature - query for devices' extended features : Master port to issue transaction : Indicate a local master port or remote device access : Destination ID of the device : Number of switch hops to the device : Extended feature code

Tell if a device supports a given RapidIO capability. Returns the offset of the requested extended feature block within the device's RIO configuration space or 0 in case the device does not support it. Possible values for :

RIO_EFB_PAR_EP_ID LP/LVDS EP Devices

RIO_EFB_PAR_EP_REC_ID LP/LVDS EP Recovery Devices

RIO_EFB_PAR_EP_FREE_ID LP/LVDS EP Free Devices

RIO_EFB_SER_EP_ID LP/Serial EP Devices

RIO_EFB_SER_EP_REC_ID LP/Serial EP Recovery Devices

RIO_EFB_SER_EP_FREE_ID LP/Serial EP Free Devices

Definition at line 972 of file rio.c.

u32 rio_mport_get_physefb ( struct rio_mport port,
int  local,
u16  destid,
u8  hopcount 
)

rio_mport_get_physefb - Helper function that returns register offset for Physical Layer Extended Features Block. : Master port to issue transaction : Indicate a local master port or remote device access : Destination ID of the device : Number of switch hops to the device

Definition at line 453 of file rio.c.

int rio_register_mport ( struct rio_mport port)

Definition at line 1365 of file rio.c.

int rio_release_inb_dbell ( struct rio_mport mport,
u16  start,
u16  end 
)

rio_release_inb_dbell - release inbound doorbell message service : RIO master port from which to release the doorbell resource : Doorbell info range start : Doorbell info range end

Releases ownership of an inbound doorbell resource and removes callback from the doorbell event list. Returns 0 if the request has been satisfied.

Definition at line 279 of file rio.c.

int rio_release_inb_mbox ( struct rio_mport mport,
int  mbox 
)

rio_release_inb_mbox - release inbound mailbox message service : RIO master port from which to release the mailbox resource : Mailbox number to release

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

Definition at line 113 of file rio.c.

int rio_release_inb_pwrite ( struct rio_dev rdev)

rio_release_inb_pwrite - release inbound port-write message service : RIO device which registered for inbound port-write callback

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

Definition at line 386 of file rio.c.

int rio_release_outb_dbell ( struct rio_dev rdev,
struct resource res 
)

rio_release_outb_dbell - release outbound doorbell message range : RIO device from which to release the doorbell resource : Doorbell resource to be freed

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

Definition at line 346 of file rio.c.

int rio_release_outb_mbox ( struct rio_mport mport,
int  mbox 
)

rio_release_outb_mbox - release outbound mailbox message service : RIO master port from which to release the mailbox resource : Mailbox number to release

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

Definition at line 181 of file rio.c.

int rio_request_inb_dbell ( struct rio_mport mport,
void dev_id,
u16  start,
u16  end,
void(*)(struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info dinb 
)

rio_request_inb_dbell - request inbound doorbell message service : RIO master port from which to allocate the doorbell resource : Device specific pointer to pass on event : Doorbell info range start : Doorbell info range end : Callback to execute when doorbell is received

Requests ownership of an inbound doorbell resource and binds a callback function to the resource. Returns 0 if the request has been satisfied.

Definition at line 238 of file rio.c.

int rio_request_inb_mbox ( struct rio_mport mport,
void dev_id,
int  mbox,
int  entries,
void(*)(struct rio_mport *mport, void *dev_id, int mbox, int slot minb 
)

rio_request_inb_mbox - request inbound mailbox service : RIO master port from which to allocate the mailbox resource : Device specific pointer to pass on event : Mailbox number to claim : Number of entries in inbound mailbox queue : Callback to execute when inbound message is received

Requests ownership of an inbound mailbox resource and binds a callback function to the resource. Returns %0 on success.

Definition at line 66 of file rio.c.

int rio_request_inb_pwrite ( struct rio_dev rdev,
int(*)(struct rio_dev *rdev, union rio_pw_msg *msg, int step pwcback 
)

rio_request_inb_pwrite - request inbound port-write message service : RIO device to which register inbound port-write callback routine : Callback routine to execute when port-write is received

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

Definition at line 363 of file rio.c.

struct resource* rio_request_outb_dbell ( struct rio_dev rdev,
u16  start,
u16  end 
)
read

rio_request_outb_dbell - request outbound doorbell message range : RIO device from which to allocate the doorbell resource : Doorbell message range start : Doorbell message range end

Requests ownership of a doorbell message range. Returns a resource if the request has been satisfied or NULL on failure.

Definition at line 319 of file rio.c.

int rio_request_outb_mbox ( struct rio_mport mport,
void dev_id,
int  mbox,
int  entries,
void(*)(struct rio_mport *mport, void *dev_id, int mbox, int slot moutb 
)

rio_request_outb_mbox - request outbound mailbox service : RIO master port from which to allocate the mailbox resource : Device specific pointer to pass on event : Mailbox number to claim : Number of entries in outbound mailbox queue : Callback to execute when outbound message is sent

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

Definition at line 135 of file rio.c.

int rio_set_port_lockout ( struct rio_dev rdev,
u32  pnum,
int  lock 
)

rio_set_port_lockout - Sets/clears LOCKOUT bit (RIO EM 1.3) for a switch port. : Pointer to RIO device control structure : Switch port number to set LOCKOUT bit : Operation : set (=1) or clear (=0)

Definition at line 531 of file rio.c.

int rio_std_route_add_entry ( struct rio_mport mport,
u16  destid,
u8  hopcount,
u16  table,
u16  route_destid,
u8  route_port 
)

rio_std_route_add_entry - Add switch route table entry using standard registers defined in RIO specification rev.1.3 : Master port to issue transaction : Destination ID of the device : Number of switch hops to the device : routing table ID (global or port-specific) : destID entry in the RT : destination port for specified destID

Definition at line 1074 of file rio.c.

int rio_std_route_clr_table ( struct rio_mport mport,
u16  destid,
u8  hopcount,
u16  table 
)

rio_std_route_clr_table - Clear swotch route table using standard registers defined in RIO specification rev.1.3. : Master port to issue transaction : Destination ID of the device : Number of switch hops to the device : routing table ID (global or port-specific)

Definition at line 1126 of file rio.c.

int rio_std_route_get_entry ( struct rio_mport mport,
u16  destid,
u8  hopcount,
u16  table,
u16  route_destid,
u8 route_port 
)

rio_std_route_get_entry - Read switch route table entry (port number) associated with specified destID using standard registers defined in RIO specification rev.1.3 : Master port to issue transaction : Destination ID of the device : Number of switch hops to the device : routing table ID (global or port-specific) : destID entry in the RT : returned destination port for specified destID

Definition at line 1101 of file rio.c.

void rio_unmap_inb_region ( struct rio_mport mport,
dma_addr_t  lstart 
)

rio_unmap_inb_region – Unmap the inbound memory region : Master port : physical address of memory region to be unmapped

Definition at line 433 of file rio.c.