forked from microsoft/WSL2-Linux-Kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a RapidIO subsystem to the kernel. RIO is a switched fabric interconnect used in higher-end embedded applications. The curious can look at the specs over at http://www.rapidio.org The core code implements enumeration/discovery, management of devices/resources, and interfaces for RIO drivers. There's a lot more to do to take advantages of all the hardware features. However, this should provide a good base for folks with RIO hardware to start contributing. Signed-off-by: Matt Porter <mporter@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
- Loading branch information
Matt Porter
authored and
Linus Torvalds
committed
Nov 7, 2005
1 parent
d217d54
commit 394b701
Showing
12 changed files
with
1,393 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | ||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ | ||
<!ENTITY rapidio SYSTEM "rapidio.xml"> | ||
]> | ||
|
||
<book id="RapidIO-Guide"> | ||
<bookinfo> | ||
<title>RapidIO Subsystem Guide</title> | ||
|
||
<authorgroup> | ||
<author> | ||
<firstname>Matt</firstname> | ||
<surname>Porter</surname> | ||
<affiliation> | ||
<address> | ||
<email>mporter@kernel.crashing.org</email> | ||
<email>mporter@mvista.com</email> | ||
</address> | ||
</affiliation> | ||
</author> | ||
</authorgroup> | ||
|
||
<copyright> | ||
<year>2005</year> | ||
<holder>MontaVista Software, Inc.</holder> | ||
</copyright> | ||
|
||
<legalnotice> | ||
<para> | ||
This documentation is free software; you can redistribute | ||
it and/or modify it under the terms of the GNU General Public | ||
License version 2 as published by the Free Software Foundation. | ||
</para> | ||
|
||
<para> | ||
This program is distributed in the hope that it will be | ||
useful, but WITHOUT ANY WARRANTY; without even the implied | ||
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
See the GNU General Public License for more details. | ||
</para> | ||
|
||
<para> | ||
You should have received a copy of the GNU General Public | ||
License along with this program; if not, write to the Free | ||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
MA 02111-1307 USA | ||
</para> | ||
|
||
<para> | ||
For more details see the file COPYING in the source | ||
distribution of Linux. | ||
</para> | ||
</legalnotice> | ||
</bookinfo> | ||
|
||
<toc></toc> | ||
|
||
<chapter id="intro"> | ||
<title>Introduction</title> | ||
<para> | ||
RapidIO is a high speed switched fabric interconnect with | ||
features aimed at the embedded market. RapidIO provides | ||
support for memory-mapped I/O as well as message-based | ||
transactions over the switched fabric network. RapidIO has | ||
a standardized discovery mechanism not unlike the PCI bus | ||
standard that allows simple detection of devices in a | ||
network. | ||
</para> | ||
<para> | ||
This documentation is provided for developers intending | ||
to support RapidIO on new architectures, write new drivers, | ||
or to understand the subsystem internals. | ||
</para> | ||
</chapter> | ||
|
||
<chapter id="bugs"> | ||
<title>Known Bugs and Limitations</title> | ||
|
||
<sect1> | ||
<title>Bugs</title> | ||
<para>None. ;)</para> | ||
</sect1> | ||
<sect1> | ||
<title>Limitations</title> | ||
<para> | ||
<orderedlist> | ||
<listitem><para>Access/management of RapidIO memory regions is not supported</para></listitem> | ||
<listitem><para>Multiple host enumeration is not supported</para></listitem> | ||
</orderedlist> | ||
</para> | ||
</sect1> | ||
</chapter> | ||
|
||
<chapter id="drivers"> | ||
<title>RapidIO driver interface</title> | ||
<para> | ||
Drivers are provided a set of calls in order | ||
to interface with the subsystem to gather info | ||
on devices, request/map memory region resources, | ||
and manage mailboxes/doorbells. | ||
</para> | ||
<sect1> | ||
<title>Functions</title> | ||
!Iinclude/linux/rio_drv.h | ||
!Edrivers/rapidio/rio-driver.c | ||
!Edrivers/rapidio/rio.c | ||
</sect1> | ||
</chapter> | ||
|
||
<chapter id="internals"> | ||
<title>Internals</title> | ||
|
||
<para> | ||
This chapter contains the autogenerated documentation of the RapidIO | ||
subsystem. | ||
</para> | ||
|
||
<sect1><title>Structures</title> | ||
!Iinclude/linux/rio.h | ||
</sect1> | ||
<sect1><title>Enumeration and Discovery</title> | ||
!Idrivers/rapidio/rio-scan.c | ||
</sect1> | ||
<sect1><title>Driver functionality</title> | ||
!Idrivers/rapidio/rio.c | ||
!Idrivers/rapidio/rio-access.c | ||
</sect1> | ||
<sect1><title>Device model support</title> | ||
!Idrivers/rapidio/rio-driver.c | ||
</sect1> | ||
<sect1><title>Sysfs support</title> | ||
!Idrivers/rapidio/rio-sysfs.c | ||
</sect1> | ||
<sect1><title>PPC32 support</title> | ||
!Iarch/ppc/kernel/rio.c | ||
!Earch/ppc/syslib/ppc85xx_rio.c | ||
!Iarch/ppc/syslib/ppc85xx_rio.c | ||
</sect1> | ||
</chapter> | ||
|
||
<chapter id="credits"> | ||
<title>Credits</title> | ||
<para> | ||
The following people have contributed to the RapidIO | ||
subsystem directly or indirectly: | ||
<orderedlist> | ||
<listitem><para>Matt Porter<email>mporter@kernel.crashing.org</email></para></listitem> | ||
<listitem><para>Randy Vinson<email>rvinson@mvista.com</email></para></listitem> | ||
<listitem><para>Dan Malek<email>dan@embeddedalley.com</email></para></listitem> | ||
</orderedlist> | ||
</para> | ||
<para> | ||
The following people have contributed to this document: | ||
<orderedlist> | ||
<listitem><para>Matt Porter<email>mporter@kernel.crashing.org</email></para></listitem> | ||
</orderedlist> | ||
</para> | ||
</chapter> | ||
</book> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# | ||
# RapidIO configuration | ||
# | ||
config RAPIDIO_8_BIT_TRANSPORT | ||
bool "8-bit transport addressing" | ||
depends on RAPIDIO | ||
---help--- | ||
By default, the kernel assumes a 16-bit addressed RapidIO | ||
network. By selecting this option, the kernel will support | ||
an 8-bit addressed network. | ||
|
||
config RAPIDIO_DISC_TIMEOUT | ||
int "Discovery timeout duration (seconds)" | ||
depends on RAPIDIO | ||
default "30" | ||
---help--- | ||
Amount of time a discovery node waits for a host to complete | ||
enumeration beforing giving up. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# | ||
# Makefile for RapidIO interconnect services | ||
# | ||
obj-y += rio.o rio-access.o rio-driver.o rio-scan.o rio-sysfs.o | ||
|
||
obj-$(CONFIG_RAPIDIO) += switches/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
/* | ||
* RapidIO configuration space access support | ||
* | ||
* Copyright 2005 MontaVista Software, Inc. | ||
* Matt Porter <mporter@kernel.crashing.org> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. | ||
*/ | ||
|
||
#include <linux/rio.h> | ||
#include <linux/module.h> | ||
|
||
/* | ||
* These interrupt-safe spinlocks protect all accesses to RIO | ||
* configuration space and doorbell access. | ||
*/ | ||
static spinlock_t rio_config_lock = SPIN_LOCK_UNLOCKED; | ||
static spinlock_t rio_doorbell_lock = SPIN_LOCK_UNLOCKED; | ||
|
||
/* | ||
* Wrappers for all RIO configuration access functions. They just check | ||
* alignment, do locking and call the low-level functions pointed to | ||
* by rio_mport->ops. | ||
*/ | ||
|
||
#define RIO_8_BAD 0 | ||
#define RIO_16_BAD (offset & 1) | ||
#define RIO_32_BAD (offset & 3) | ||
|
||
/** | ||
* RIO_LOP_READ - Generate rio_local_read_config_* functions | ||
* @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) | ||
* | ||
* Generates rio_local_read_config_* functions used to access | ||
* configuration space registers on the local device. | ||
*/ | ||
#define RIO_LOP_READ(size,type,len) \ | ||
int __rio_local_read_config_##size \ | ||
(struct rio_mport *mport, u32 offset, type *value) \ | ||
{ \ | ||
int res; \ | ||
unsigned long flags; \ | ||
u32 data = 0; \ | ||
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \ | ||
spin_lock_irqsave(&rio_config_lock, flags); \ | ||
res = mport->ops->lcread(mport->id, offset, len, &data); \ | ||
*value = (type)data; \ | ||
spin_unlock_irqrestore(&rio_config_lock, flags); \ | ||
return res; \ | ||
} | ||
|
||
/** | ||
* RIO_LOP_WRITE - Generate rio_local_write_config_* functions | ||
* @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) | ||
* | ||
* Generates rio_local_write_config_* functions used to access | ||
* configuration space registers on the local device. | ||
*/ | ||
#define RIO_LOP_WRITE(size,type,len) \ | ||
int __rio_local_write_config_##size \ | ||
(struct rio_mport *mport, u32 offset, type value) \ | ||
{ \ | ||
int res; \ | ||
unsigned long flags; \ | ||
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \ | ||
spin_lock_irqsave(&rio_config_lock, flags); \ | ||
res = mport->ops->lcwrite(mport->id, offset, len, value); \ | ||
spin_unlock_irqrestore(&rio_config_lock, flags); \ | ||
return res; \ | ||
} | ||
|
||
RIO_LOP_READ(8, u8, 1) | ||
RIO_LOP_READ(16, u16, 2) | ||
RIO_LOP_READ(32, u32, 4) | ||
RIO_LOP_WRITE(8, u8, 1) | ||
RIO_LOP_WRITE(16, u16, 2) | ||
RIO_LOP_WRITE(32, u32, 4) | ||
|
||
EXPORT_SYMBOL_GPL(__rio_local_read_config_8); | ||
EXPORT_SYMBOL_GPL(__rio_local_read_config_16); | ||
EXPORT_SYMBOL_GPL(__rio_local_read_config_32); | ||
EXPORT_SYMBOL_GPL(__rio_local_write_config_8); | ||
EXPORT_SYMBOL_GPL(__rio_local_write_config_16); | ||
EXPORT_SYMBOL_GPL(__rio_local_write_config_32); | ||
|
||
/** | ||
* RIO_OP_READ - Generate rio_mport_read_config_* functions | ||
* @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) | ||
* | ||
* Generates rio_mport_read_config_* functions used to access | ||
* configuration space registers on the local device. | ||
*/ | ||
#define RIO_OP_READ(size,type,len) \ | ||
int rio_mport_read_config_##size \ | ||
(struct rio_mport *mport, u16 destid, u8 hopcount, u32 offset, type *value) \ | ||
{ \ | ||
int res; \ | ||
unsigned long flags; \ | ||
u32 data = 0; \ | ||
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \ | ||
spin_lock_irqsave(&rio_config_lock, flags); \ | ||
res = mport->ops->cread(mport->id, destid, hopcount, offset, len, &data); \ | ||
*value = (type)data; \ | ||
spin_unlock_irqrestore(&rio_config_lock, flags); \ | ||
return res; \ | ||
} | ||
|
||
/** | ||
* RIO_OP_WRITE - Generate rio_mport_write_config_* functions | ||
* @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) | ||
* | ||
* Generates rio_mport_write_config_* functions used to access | ||
* configuration space registers on the local device. | ||
*/ | ||
#define RIO_OP_WRITE(size,type,len) \ | ||
int rio_mport_write_config_##size \ | ||
(struct rio_mport *mport, u16 destid, u8 hopcount, u32 offset, type value) \ | ||
{ \ | ||
int res; \ | ||
unsigned long flags; \ | ||
if (RIO_##size##_BAD) return RIO_BAD_SIZE; \ | ||
spin_lock_irqsave(&rio_config_lock, flags); \ | ||
res = mport->ops->cwrite(mport->id, destid, hopcount, offset, len, value); \ | ||
spin_unlock_irqrestore(&rio_config_lock, flags); \ | ||
return res; \ | ||
} | ||
|
||
RIO_OP_READ(8, u8, 1) | ||
RIO_OP_READ(16, u16, 2) | ||
RIO_OP_READ(32, u32, 4) | ||
RIO_OP_WRITE(8, u8, 1) | ||
RIO_OP_WRITE(16, u16, 2) | ||
RIO_OP_WRITE(32, u32, 4) | ||
|
||
EXPORT_SYMBOL_GPL(rio_mport_read_config_8); | ||
EXPORT_SYMBOL_GPL(rio_mport_read_config_16); | ||
EXPORT_SYMBOL_GPL(rio_mport_read_config_32); | ||
EXPORT_SYMBOL_GPL(rio_mport_write_config_8); | ||
EXPORT_SYMBOL_GPL(rio_mport_write_config_16); | ||
EXPORT_SYMBOL_GPL(rio_mport_write_config_32); | ||
|
||
/** | ||
* rio_mport_send_doorbell - Send a doorbell message | ||
* | ||
* @mport: RIO master port | ||
* @destid: RIO device destination ID | ||
* @data: Doorbell message data | ||
* | ||
* Send a doorbell message to a RIO device. The doorbell message | ||
* has a 16-bit info field provided by the data argument. | ||
*/ | ||
int rio_mport_send_doorbell(struct rio_mport *mport, u16 destid, u16 data) | ||
{ | ||
int res; | ||
unsigned long flags; | ||
|
||
spin_lock_irqsave(&rio_doorbell_lock, flags); | ||
res = mport->ops->dsend(mport->id, destid, data); | ||
spin_unlock_irqrestore(&rio_doorbell_lock, flags); | ||
|
||
return res; | ||
} | ||
|
||
EXPORT_SYMBOL_GPL(rio_mport_send_doorbell); |
Oops, something went wrong.