<title>SPARC Architectural Model: Device Modules
</title>
<body bgcolor=
"#FFFFFF" LANG=
"en-US">
<h1> SAM Device Modules
</h1>
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.
<h2>Programming Model
</h2>
All modules reside in the SAM workspace under
<b>modules
</b>.
Each module is in a separate subdirectory.
<b>modules/Makefile
</b> builds all modules.
Common code is placed in
<b>modules/common
</b>.
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
<i>not
</i> copy the SCCS subdirectory.
<br>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
<br> <tt>@(#)sample_mod.cc
1.4 04/
08/
05</tt>
<br> <tt>@(#)SAM-modules.html
1.1 05/
07/
26</tt>
<p>The modules/Makefile will compile any subdirectory with a Makefile in it.
This is code that is included in all modules. It is not compiled separately.
It provides the following:
<td> </td>
<td> utilities for parsing the sysconf command line arguments
</td>
<td> </td>
<td><b>module.cc
</b></td>
<td> the base class for all modules
</td>
<td> </td>
<td><b>pci_dev.cc
</b></td>
<td> the base class for all PCI devices
</td>
<td> </td>
<td><b>include/*.h
</b></td>
<td> header files for common code
</td>
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
<br>spaces.
It can also run a periodic timer which shows the simulator MIPs rate.
This is a simple module which can be used as a template for non-device modules.
<br>(Use
"sample" for PCI devices.)
This is the same as
"example", but it demonstrates how to wrap C code.
This is the local loopback filesystem driver.
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.
This is the PCI Bus model.
It sits between the host bridge (for example, schizo) and PCI devices
This is the PCI Express Bus model.
It is the same code as
"pci_bus", except that
<font size=-
1><tt>#ifdef PCI_EXPRESS
</tt></font> is true.
This is a Serengeti controller device.
It is the interface between service processor, console, and Sparc.
This is the Serengeti PCI host bridge.
It supports two independent PCI busses, denoted as leaf A and leaf B.
<br>(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.)
This is the serial device model.
<h5><a href=
"sgc.html">sgc
</a></h5>
This is the Serengeti Console model.
It provides services required for OBP.
<h2>Sample Configuration File
</h2>
sysconf -p $HOME/blaze/blaze-conf/modules/
64opt
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 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 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