Virtual Serial Ports

We have created a patch for SCC Linux and the crbif driver (running on the MCPC) that provides virtual serial ports to each SCC core. You can download it here:

Component Link
Patches compatible with sccKit 1.3.0 (marcbug svn rev 153)
crbif crbif153_vuart.diff
Linux (no serial console) linux153_vuart_noconsole.diff
Linux (with serial console) linux153_vuart_console.diff
Linux (command line for serial console) linux153_vuart_console_cmd.bin
crbif 1.1.3 (complete) crbif-dkms-1.1.3-tty.tar.bz2

The patched crbif driver emulates 4 standard 16550A UARTs on default I/O addresses (0x3f8, 0x2f8, 0x3e8, 0x2e8), independent for each SCC core (192 devices total). These UARTs are connected to corresponding character devices on the MCPC, similar to a real setup of two machines connected by a null-modem cable. Standard programs for accessing serial ports (like minicom) can be used on the MCPC to exchange data with SCC cores.

Using our virtual serial ports requires recompiling both the crbif driver and SCC Linux. Currently, only the versions compatible with sccKit 1.3.0 are supported. We kindly ask users of newer versions to wait until corresponding sources are published, so we have a chance to change our patches accordingly.

Installation

You need to install modified versions of both the crbif driver and SCC Linux for the serial ports to work.

Recompiling crbif.ko with UART support

To create the modified driver, follow these steps:
  1. Checkout the crbif sources that are compatible to the patch file. For example, crbif153_vuart.diff (the patch file for revision 153 of crbif from sccKit 1.3.0) can be used with the sources at revision 153 from the marcbug svn. Therefore, to check out these sources, use the following command:

    # svn checkout http://marcbug.scc-dc.com/svn/repository/trunk/mcpc_driver@153

    For sccKit 1.4.0/crbif 1.1.3 only: the sources were not present in the public svn at the time this site was created, so we decided to post them here completely. If you are using sccKit 1.4.0, download this version, untar and compile.
  2. Place the patch file in the mcpc_driver directory, then apply it as follows:

    # cd mcpc_driver
    # patch -u -i crbif153_vuart.diff

  3. Compile the driver:

    # make crbif.ko

Before you can load the new driver, you need to close sccKit or any other program that accesses /dev/crbif0rb0. Afterwards, issue the following commands:

# sudo rmmod crbif
# sudo insmod crbif.ko

You may also choose to replace the Intel-provided crbif driver with the recompiled one, thus allowing it to get loaded automatically after booting the MCPC. To do so, replace the corresponding binary under /var/lib/dkms/crbif-dkms/. For example, if you are using driver version 1.1.0 on an x86-64 MCPC with Linux kernel release 2.6.36-rc8-edac-2 (as returned by uname -r), you will find the driver binary in /var/lib/dkms/crbif-dkms/1.1.0/2.6.36-rc8-edac-2/x86_64/module/crbif.ko.

Building SCC Linux with UART support

We provide two patches for SCC Linux, depending on whether you need support for a root console via the serial port. When using the *_noconsole.diff patch, each core gets 4 serial ports, but none of them will function as a root console. In contrast, the *_console.diff patch also provides 4 serial ports, but opens a root console on the first one.
  1. Download SCC Linux sources as described in the document How to build SCC Linux on the MARC website.
  2. Place the patch file corresponding to the SVN revision into the sandbox directory. cd into the sandbox directory, then apply the patch by executing a command like patch -u -i linux153_vuart_noconsole.diff.
  3. If you used the *_console.diff patch, replace the file in linuxkernel/images/commandline.bin by the corresponding modified one (e.g., linux153_vuart_console_cmd.bin for SVN revision 153).
  4. Build the Linux image as described in How to build SCC Linux.

Using serial ports

When starting the modified SCC Linux while the patched crbif driver is loaded on the MCPC, each core recognizes four serial ports. All 192 ports are independently connected to character devices on the MCPC.

Serial ports on SCC cores use the names /dev/ttyS0 to /dev/ttyS3, corresponding virtual devices on the MCPC use names like /dev/crbif0rb0c0ttyS0. The number after crbif0rb0c specifies the target SCC core, the remainder of the name is identical to the device name from SCC Linux. For example, /dev/ttyS1 (DOS name COM2) of SCC core 30 is connected to the device /dev/crbif0rb0c30ttyS1 on the MCPC.

Devices on both SCC Linux and the MCPC can be used just like real hardware serial ports; e.g., input and output streams of programs can be redirected to them. To write the list of files in the root directory to the serial port, you can use the command ls / -lisa > /dev/ttyS0 on an SCC Linux core. If you have cat /dev/crbif0rb0c0ttyS0 running on the MCPC, it will receive the data sent to the port (this example is for core 0).

Please note that we currently simulate a null-modem connection without flow control, so data may be lost if the receiving side is too slow in reading from its port. However, we never experienced this during our experiments.

Contact

Please feel free to contact us (Jan-Arne Sobania, Peter Tröger) if you need help or have suggestions for further updates.