SAM Device Modules

This document describes some of the SAM device modules that are available under the SAM source workspace and are included in official SAM package releases.

Programming Model

All modules reside in the SAM workspace under modules. Each module is in a separate subdirectory. modules/Makefile builds all modules.

Common code is placed in modules/common. This code is compiled into each module separately. This allows for preprocessor macros to be expanded uniquely in each module.

Create a new module by copying 'sample' (for PCI devices) or 'example' (for any other type) to a new subdirectory. Do not copy the SCCS subdirectory.
Edit the Makefile to change the module name and list of files. Make sure the SCCS Id keywords are correct. For example, replace the comment lines as shown below:


      @(#)sample_mod.cc 1.4 04/08/05


with


      @(#)SAM-modules.html 1.1 05/07/26

The modules/Makefile will compile any subdirectory with a Makefile in it.

Modules

common
This is code that is included in all modules. It is not compiled separately. It provides the following:
     arg.cc   utilities for parsing the sysconf command line arguments
     module.cc   the base class for all modules
     pci_dev.cc   the base class for all PCI devices
     include/*.h   header files for common code
sample
This is a sample PCI device. Use it as a template for new PCI devices. It also has some functionality. It can be configured to map PCI memory
spaces. It can also run a periodic timer which shows the simulator MIPs rate.
example
This is a simple module which can be used as a template for non-device modules.
(Use "sample" for PCI devices.)
examplec
This is the same as "example", but it demonstrates how to wrap C code.
ll
This is the local loopback filesystem driver.
parrot
This is a loopback pseudo device invented by the ASIC system verification team as a target for testing PCI Express. It can be a useful example to study because it uses every PCI function there is.
pci_bus
This is the PCI Bus model. It sits between the host bridge (for example, schizo) and PCI devices (for example, sample).
pcie_bus
This is the PCI Express Bus model. It is the same code as "pci_bus", except that #ifdef PCI_EXPRESS is true.
sbbc
This is a Serengeti controller device. It is the interface between service processor, console, and Sparc.
schizo
This is the Serengeti PCI host bridge. It supports two independent PCI busses, denoted as leaf A and leaf B.
(Note that each leaf starts with PCI bus 0. It is a mistake, as in the old Blaze schizo, to think of leaf B as bus 1.)
serial
This is the serial device model.
sgc
This is the Serengeti Console model. It provides services required for OBP.

Sample Configuration File

sysconf -p $HOME/blaze/blaze-conf/modules/64opt
sysconf sgc sgc0
#
sysconf schizo  schizo24
#
sysconf pci_bus schizo24A    bridge=schizo24
#
sysconf pci_bus schizo24B    bridge=schizo24
sysconf sample  sample24B1   bus=schizo24B dev=1 fun=0 mem32_base=0x08000000 mem32_size=0x2000 -d1
sysconf sbbc    sbbc24B      bus=schizo24B dev=4 fun=0
#
sysconf schizo  schizo25
#
sysconf pci_bus schizo25A    bridge=schizo25
sysconf sample  sample25A    bus=schizo25A dev=1 mem32_base=0x00100000 mem32_size=0x2000 cycle=50000000 -d2
#
sysconf pci_bus schizo25B    bridge=schizo25
sysconf sample  sample25B2   bus=schizo25B dev=2 fun=0 mem32_base=0x08000000 mem32_size=0x2000 -d1
#
sysconf schizo  schizo30
#
sysconf pci_bus schizo30A    bridge=schizo30
#
sysconf pci_bus schizo30B    bridge=schizo30
sysconf sample  sample30B1   bus=schizo30B dev=1 fun=0 mem32_base=0x08000000 mem32_size=0x2000
sysconf sbbc    sbbc30B      bus=schizo30B dev=4 fun=0
#
##sysconf schizo schizo31
###
##sysconf pci_bus schizo31A bridge=schizo31
###
##sysconf pci_bus schizo31B bridge=schizo31
##sysconf sample sample31B2 bus=schizo31B dev=2 fun=0 mem32_base=0x08000000 mem32_size=0x2000