[PATCH 000/111] GRLIB/LEON RTEMS RCC patches
Daniel Hellstrom
daniel at gaisler.com
Thu Feb 26 16:38:02 UTC 2015
Hi,
I have rebased and tested briefly the RTEMS code that we have used on LEON2/3/4
on RTEMS-4.10 during the last couple of years. A couple of years ago most stuff
that did not depend on the PCI and Driver Manager layers were submitted so most
patches are SPARC BSP specific this time. GCC-4.9 compiler warnings fixes are
applied at the end.
The patches are also available in the RCC Git repository
git.rtems.org/danielh/rcc.git under the rcc-1.3-0 branch.
Note that many drivers depend on both libpci and the driver manager. Including
a subset of the major patches will most likely cause a lot of work.
LIBPCI
A PCI library developed according to the PCI 2.2 and later 2.3 standard. The
Library has been used on LEON2 big PCI endian and various LEON3 systems both
big and little endian PCI systems. Located in cpukit/libpci and built only on
sparc targets. It replaces the current RTEMS PCI implementation for SPARC BSP.
Brief documentation is included but no tests. Some "new" features:
* Host driver interface
* Access library: I/O, registers over memory and configuration space accesses
* IRQ library: default IRQ routing, host driver overridable
* PCI Configuration: Builtin, read from PnP (from BIOS) and auto PnP config
where RTEMS is responsible for setting up the PCI configuration.
* Auto config library:
- BAR sorting to shrink PCI address space. May be needed on embeeded systems.
- Multi-bus support (PCI-to-PCI Bridge)
- PCI bus enumreration
- ...
* PCI bus and devices RAM tree that describes the PCI bus set up using the
bus topology discovered.
* PCI command to list current configuration, prints input to builtin
configuration, help debug host driver by doing config space accesses.
The LEON BSP contains four PCI host bridge drivers and their uses:
* AT697-LEON PCI (ATMEL)
* GRLIB PCIF (ACTEL AX designs)
* GRLIB GRPCI (UT699, UT699e, UT700, etc.)
* GRPCI GRPCI2 (most new designs, leon4-n2x, gr740)
TODO:
* LIBPCI tests
* Add custom extension points (callback) on PCI configuration so that user/BSP
can override, add to or skip PCI device configuration performed by auto/read
config libraries.
LIBDRVMGR
A Driver Manager to make driver development easier and adds a platform
independent way of doing device discovery, device driver configuration,
initialization order (4 levels) and other related services like interrupt
support, address translation, system device architecture/topology operations.
Bus drivers are responsible for implementing the bus services and device
drivers (called drivers) to interface to a specific bus type.
The driver manager is enabled using the --enable-drvmgr configuration option.
The LEON2/3/NGMP BSPs support both modes. Not using the driver manager makes
the footprint a minimum. One can still use it but the user is responsible to
initializes it manually from the Init task for example. Enabling it will
initialize it during RTEMS start-up and low-level drivers such as IRQ, Timer
and UART could be implemented using the manager. The BSP will get a init
callback for each level to install services dependent on drivers initialized
in a specific level.
A shell command can be used to list information and presents of buses, devices,
bus drivers, device drivers, bus topology, test translation service etc.
Currently there exists bus drivers for:
* PCI by accessing either PCI PnP via configuration space or PCI bus/device
tree in RAM. (pcibus)
* AMBA PnP (ambapp)
* LEON2 AMBA (leon2_amba)
The ambapp bus model is used by several GRLIB PCI peripherals since the AMBA
PnP bus is accessed over PCI, named AMBA-over-PCI. In this case the on-chip
ambapp drivers can be reused with minor updates on address translation on a
LEON system.
TODO:
* tests.
* port documentation from RCC manuals to RTEMS doc/ directory.
* redesign/simplify the driver registration configuration in drvmgr_confdefs.h.
* a generic bus driver to support a hardcoded setup that can be used for
most systems.
* investigate to use RTEMS objects as devices
* default bus/device tree locking shuold perhaps
DRIVERS
* Updates on existing drivers by converting to use the driver manager + fixes
* New GRLIB/LEON drivers, most using the DrvMgr
TODO:
* find a way to port the existing 250 pages PDF driver manual into a BSP
specific RTEMS document. The manual has been written in docbook.
TEST STATUS
Most of the drivers have been available for several years and received fixes
along the way. They have not been tested on this version of RTEMS yet. I expect
to make fixes as drivers are tested.
The RTEMS tests test the BSP initialization and the Timer and UART drivers
based on the driver manager.
The following is a summary of the test results on the GR712RC in four configs
(single-core, single-core with drvmgr, smp, smp with drvmgr). Most are known
not to work since before and does no not depend on the which configuration
run except spcbssched03 which fails only on SMP.
# Result Test ExecRes ConsoleRes ExitCode1 ExitCode2
# FAIL: ./fstests/fsdosfsname01 OK FAIL 5 0
# FAIL: ./libtests/crypt01 FAIL FAIL N/A N/A
# FAIL: ./psxtests/psx04 OK FAIL 5 0
# FAIL: ./psxtests/psxgetrusage01 OK FAIL 5 0
# FAIL: ./psxtests/psxualarm FAIL FAIL N/A N/A
# FAIL: ./sptests/sp12 OK FAIL 0 25
# FAIL: ./sptests/sp20 OK FAIL 5 6
# FAIL: ./sptests/sp31 OK FAIL 5 20
# FAIL: ./sptests/spcbssched03 OK FAIL 5 0
#
# DISABLED: dl01 dl02
#
# SUMMARY
# Tests failing: 9
# Tests successful: 530
DanielH
---
aclocal/enable-drvmgr.m4 | 12 +
c/src/aclocal/enable-drvmgr.m4 | 12 +
c/src/lib/libbsp/shared/bspdriverlevelhook.c | 16 +
c/src/lib/libbsp/shared/include/bootcard.h | 2 +
c/src/lib/libbsp/sparc/Makefile.am | 137 +-
c/src/lib/libbsp/sparc/erc32/include/bsp.h | 7 +
c/src/lib/libbsp/sparc/leon2/Makefile.am | 154 +-
c/src/lib/libbsp/sparc/leon2/cchip/cchip.c | 375 ---
c/src/lib/libbsp/sparc/leon2/include/at697_pci.h | 26 +
c/src/lib/libbsp/sparc/leon2/include/bsp.h | 19 +
c/src/lib/libbsp/sparc/leon2/include/cchip.h | 42 -
c/src/lib/libbsp/sparc/leon2/include/rasta.h | 132 -
c/src/lib/libbsp/sparc/leon2/pci/at697_pci.c | 659 +++++
c/src/lib/libbsp/sparc/leon2/pci/pci.c | 730 -----
c/src/lib/libbsp/sparc/leon2/preinstall.am | 234 ++-
c/src/lib/libbsp/sparc/leon2/rasta/rasta.c | 386 ---
.../lib/libbsp/sparc/leon2/startup/bsppredriver.c | 70 +
c/src/lib/libbsp/sparc/leon3/Makefile.am | 150 +-
c/src/lib/libbsp/sparc/leon3/amba/amba.c | 74 +-
c/src/lib/libbsp/sparc/leon3/clock/ckinit.c | 21 +-
c/src/lib/libbsp/sparc/leon3/console/console.c | 10 +
.../libbsp/sparc/leon3/console/printk_support.c | 2 +-
c/src/lib/libbsp/sparc/leon3/include/bsp.h | 21 +-
c/src/lib/libbsp/sparc/leon3/include/leon.h | 61 +
c/src/lib/libbsp/sparc/leon3/include/watchdog.h | 49 +
c/src/lib/libbsp/sparc/leon3/pci/pci.c | 613 ----
c/src/lib/libbsp/sparc/leon3/preinstall.am | 197 ++-
.../lib/libbsp/sparc/leon3/startup/bsppredriver.c | 32 +-
c/src/lib/libbsp/sparc/leon3/startup/cpucounter.c | 55 +-
c/src/lib/libbsp/sparc/leon3/timer/watchdog.c | 90 +
c/src/lib/libbsp/sparc/shared/1553/b1553brm.c | 1995 ++++++++------
c/src/lib/libbsp/sparc/shared/1553/b1553brm_pci.c | 135 -
.../lib/libbsp/sparc/shared/1553/b1553brm_rasta.c | 117 -
c/src/lib/libbsp/sparc/shared/1553/b1553rt.c | 856 ++++++
c/src/lib/libbsp/sparc/shared/1553/gr1553b.c | 305 ++
c/src/lib/libbsp/sparc/shared/1553/gr1553bc.c | 1674 +++++++++++
c/src/lib/libbsp/sparc/shared/1553/gr1553bm.c | 519 ++++
c/src/lib/libbsp/sparc/shared/1553/gr1553rt.c | 1262 +++++++++
c/src/lib/libbsp/sparc/shared/amba/ahbstat.c | 206 ++
c/src/lib/libbsp/sparc/shared/amba/ambapp_names.c | 56 +-
c/src/lib/libbsp/sparc/shared/analog/gradcdac.c | 578 ++++
c/src/lib/libbsp/sparc/shared/ascs/grascs.c | 615 +++++
c/src/lib/libbsp/sparc/shared/can/canmux.c | 197 ++
c/src/lib/libbsp/sparc/shared/can/grcan.c | 1747 ++++++------
c/src/lib/libbsp/sparc/shared/can/grcan_rasta.c | 100 -
c/src/lib/libbsp/sparc/shared/can/occan.c | 1184 +++++----
c/src/lib/libbsp/sparc/shared/can/occan_pci.c | 65 -
c/src/lib/libbsp/sparc/shared/can/satcan.c | 714 +++++
c/src/lib/libbsp/sparc/shared/drvmgr/ambapp_bus.c | 749 +++++
.../libbsp/sparc/shared/drvmgr/ambapp_bus_grlib.c | 227 ++
.../libbsp/sparc/shared/drvmgr/ambapp_bus_leon2.c | 265 ++
.../sparc/shared/drvmgr/get_resarray_count.c | 20 +
.../libbsp/sparc/shared/drvmgr/leon2_amba_bus.c | 448 +++
c/src/lib/libbsp/sparc/shared/gpio/gpiolib.c | 271 ++
c/src/lib/libbsp/sparc/shared/gpio/grgpio.c | 449 +++
c/src/lib/libbsp/sparc/shared/i2c/i2cmst.c | 355 ++-
c/src/lib/libbsp/sparc/shared/include/ahbstat.h | 76 +
c/src/lib/libbsp/sparc/shared/include/ambapp_ids.h | 45 +-
.../lib/libbsp/sparc/shared/include/apbuart_cons.h | 16 +
.../lib/libbsp/sparc/shared/include/apbuart_pci.h | 47 -
.../libbsp/sparc/shared/include/apbuart_rasta.h | 47 -
c/src/lib/libbsp/sparc/shared/include/b1553brm.h | 37 +-
.../lib/libbsp/sparc/shared/include/b1553brm_pci.h | 61 -
.../libbsp/sparc/shared/include/b1553brm_rasta.h | 61 -
c/src/lib/libbsp/sparc/shared/include/b1553rt.h | 79 +
c/src/lib/libbsp/sparc/shared/include/canmux.h | 32 +
c/src/lib/libbsp/sparc/shared/include/cons.h | 42 +
.../sparc/shared/include/drvmgr/ambapp_bus.h | 134 +
.../sparc/shared/include/drvmgr/ambapp_bus_grlib.h | 36 +
.../libbsp/sparc/shared/include/drvmgr/bspcommon.h | 28 +
.../sparc/shared/include/drvmgr/leon2_amba_bus.h | 95 +
c/src/lib/libbsp/sparc/shared/include/genirq.h | 107 +
c/src/lib/libbsp/sparc/shared/include/gpiolib.h | 94 +
c/src/lib/libbsp/sparc/shared/include/gptimer.h | 30 +
c/src/lib/libbsp/sparc/shared/include/gr1553b.h | 367 +++
c/src/lib/libbsp/sparc/shared/include/gr1553bc.h | 250 ++
.../libbsp/sparc/shared/include/gr1553bc_list.h | 707 +++++
c/src/lib/libbsp/sparc/shared/include/gr1553bm.h | 204 ++
c/src/lib/libbsp/sparc/shared/include/gr1553rt.h | 434 +++
c/src/lib/libbsp/sparc/shared/include/gr_701.h | 51 +
.../lib/libbsp/sparc/shared/include/gr_leon4_n2x.h | 61 +
.../libbsp/sparc/shared/include/gr_rasta_adcdac.h | 52 +
.../lib/libbsp/sparc/shared/include/gr_rasta_io.h | 52 +
.../sparc/shared/include/gr_rasta_spw_router.h | 48 +
.../libbsp/sparc/shared/include/gr_rasta_tmtc.h | 103 +
.../lib/libbsp/sparc/shared/include/gr_tmtc_1553.h | 55 +
c/src/lib/libbsp/sparc/shared/include/gradcdac.h | 227 ++
c/src/lib/libbsp/sparc/shared/include/grascs.h | 92 +
c/src/lib/libbsp/sparc/shared/include/grcan.h | 19 +-
.../lib/libbsp/sparc/shared/include/grcan_rasta.h | 29 -
c/src/lib/libbsp/sparc/shared/include/grctm.h | 171 ++
c/src/lib/libbsp/sparc/shared/include/greth.h | 146 +
c/src/lib/libbsp/sparc/shared/include/grgpio.h | 25 +
c/src/lib/libbsp/sparc/shared/include/grpci.h | 31 +
c/src/lib/libbsp/sparc/shared/include/grpci2.h | 61 +
c/src/lib/libbsp/sparc/shared/include/grpwm.h | 127 +
c/src/lib/libbsp/sparc/shared/include/grslink.h | 148 +
c/src/lib/libbsp/sparc/shared/include/grspw.h | 57 +-
c/src/lib/libbsp/sparc/shared/include/grspw_pci.h | 53 -
c/src/lib/libbsp/sparc/shared/include/grspw_pkt.h | 671 +++++
.../lib/libbsp/sparc/shared/include/grspw_rasta.h | 53 -
.../lib/libbsp/sparc/shared/include/grspw_router.h | 107 +
c/src/lib/libbsp/sparc/shared/include/grtc.h | 155 ++
c/src/lib/libbsp/sparc/shared/include/grtm.h | 245 ++
c/src/lib/libbsp/sparc/shared/include/i2cmst.h | 24 +-
c/src/lib/libbsp/sparc/shared/include/mctrl.h | 26 +
.../sparc/shared/include/network_interface_add.h | 47 +
c/src/lib/libbsp/sparc/shared/include/occan.h | 13 +-
c/src/lib/libbsp/sparc/shared/include/occan_pci.h | 46 -
c/src/lib/libbsp/sparc/shared/include/pci.h | 56 -
c/src/lib/libbsp/sparc/shared/include/pcif.h | 15 +
c/src/lib/libbsp/sparc/shared/include/satcan.h | 142 +
c/src/lib/libbsp/sparc/shared/include/spictrl.h | 126 +
c/src/lib/libbsp/sparc/shared/include/spwcuc.h | 188 ++
c/src/lib/libbsp/sparc/shared/include/tlib.h | 190 ++
c/src/lib/libbsp/sparc/shared/irq/genirq.c | 246 ++
c/src/lib/libbsp/sparc/shared/mem/mctrl.c | 212 ++
c/src/lib/libbsp/sparc/shared/net/README | 7 +
c/src/lib/libbsp/sparc/shared/net/greth.c | 1483 ++++++++++
.../sparc/shared/net/network_interface_add.c | 62 +
c/src/lib/libbsp/sparc/shared/pci/gr_701.c | 590 ++++
c/src/lib/libbsp/sparc/shared/pci/gr_leon4_n2x.c | 761 +++++
.../lib/libbsp/sparc/shared/pci/gr_rasta_adcdac.c | 665 +++++
c/src/lib/libbsp/sparc/shared/pci/gr_rasta_io.c | 863 ++++++
.../libbsp/sparc/shared/pci/gr_rasta_spw_router.c | 669 +++++
c/src/lib/libbsp/sparc/shared/pci/gr_rasta_tmtc.c | 867 ++++++
c/src/lib/libbsp/sparc/shared/pci/gr_tmtc_1553.c | 569 ++++
c/src/lib/libbsp/sparc/shared/pci/grpci.c | 725 +++++
c/src/lib/libbsp/sparc/shared/pci/grpci2.c | 919 ++++++
.../libbsp/sparc/shared/pci/pci_memreg_sparc_be.c | 27 +
.../libbsp/sparc/shared/pci/pci_memreg_sparc_le.c | 28 +
c/src/lib/libbsp/sparc/shared/pci/pcif.c | 586 ++++
c/src/lib/libbsp/sparc/shared/pci/pcifinddevice.c | 51 -
c/src/lib/libbsp/sparc/shared/pwm/grpwm.c | 853 ++++++
c/src/lib/libbsp/sparc/shared/slink/grslink.c | 661 +++++
c/src/lib/libbsp/sparc/shared/spi/spictrl.c | 1017 +++++++
c/src/lib/libbsp/sparc/shared/spw/grspw.c | 2900 +++++++++++---------
c/src/lib/libbsp/sparc/shared/spw/grspw_pci.c | 132 -
c/src/lib/libbsp/sparc/shared/spw/grspw_pkt.c | 2917 ++++++++++++++++++++
c/src/lib/libbsp/sparc/shared/spw/grspw_rasta.c | 158 --
c/src/lib/libbsp/sparc/shared/spw/grspw_router.c | 561 ++++
c/src/lib/libbsp/sparc/shared/time/grctm.c | 409 +++
c/src/lib/libbsp/sparc/shared/time/spwcuc.c | 369 +++
c/src/lib/libbsp/sparc/shared/timer/gptimer.c | 541 ++++
c/src/lib/libbsp/sparc/shared/timer/tlib.c | 77 +
c/src/lib/libbsp/sparc/shared/timer/tlib_ckinit.c | 283 ++
c/src/lib/libbsp/sparc/shared/tmtc/grtc.c | 1959 +++++++++++++
c/src/lib/libbsp/sparc/shared/tmtc/grtm.c | 1590 +++++++++++
c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c | 690 +++++
c/src/lib/libbsp/sparc/shared/uart/apbuart_pci.c | 44 -
c/src/lib/libbsp/sparc/shared/uart/apbuart_rasta.c | 43 -
c/src/lib/libbsp/sparc/shared/uart/cons.c | 189 ++
c/src/make/configure.ac | 1 +
configure.ac | 1 +
cpukit/Makefile.am | 10 +
cpukit/aclocal/enable-drvmgr.m4 | 12 +
cpukit/configure.ac | 19 +
cpukit/libdrvmgr/Makefile.am | 33 +
cpukit/libdrvmgr/README | 112 +
cpukit/libdrvmgr/drvmgr.c | 643 +++++
cpukit/libdrvmgr/drvmgr.h | 965 +++++++
cpukit/libdrvmgr/drvmgr_by_id.c | 33 +
cpukit/libdrvmgr/drvmgr_by_name.c | 37 +
cpukit/libdrvmgr/drvmgr_confdefs.h | 310 +++
cpukit/libdrvmgr/drvmgr_dev_by_name.c | 34 +
cpukit/libdrvmgr/drvmgr_drvinf.c | 148 +
cpukit/libdrvmgr/drvmgr_for_each_dev.c | 104 +
cpukit/libdrvmgr/drvmgr_for_each_list_dev.c | 44 +
cpukit/libdrvmgr/drvmgr_func.c | 42 +
cpukit/libdrvmgr/drvmgr_func_call.c | 21 +
cpukit/libdrvmgr/drvmgr_init.c | 26 +
cpukit/libdrvmgr/drvmgr_internal.h | 70 +
cpukit/libdrvmgr/drvmgr_list.c | 67 +
cpukit/libdrvmgr/drvmgr_list.h | 79 +
cpukit/libdrvmgr/drvmgr_lock.c | 38 +
cpukit/libdrvmgr/drvmgr_print.c | 457 +++
cpukit/libdrvmgr/drvmgr_res.c | 102 +
cpukit/libdrvmgr/drvmgr_rw.c | 52 +
cpukit/libdrvmgr/drvmgr_translate.c | 149 +
cpukit/libdrvmgr/drvmgr_translate_check.c | 35 +
cpukit/libdrvmgr/drvmgr_unregister.c | 186 ++
cpukit/libmisc/Makefile.am | 3 +-
cpukit/libmisc/shell/main_drvmgr.c | 426 +++
cpukit/libmisc/shell/main_pci.c | 525 ++++
cpukit/libmisc/shell/shellconfig.h | 25 +
cpukit/libpci/CHANGES | 46 +
cpukit/libpci/Makefile.am | 51 +
cpukit/libpci/README | 4 +
cpukit/libpci/pci.h | 375 +++
cpukit/libpci/pci/access.h | 351 +++
cpukit/libpci/pci/cfg.h | 244 ++
cpukit/libpci/pci/cfg_auto.h | 59 +
cpukit/libpci/pci/cfg_peripheral.h | 20 +
cpukit/libpci/pci/cfg_read.h | 22 +
cpukit/libpci/pci/cfg_static.h | 22 +
cpukit/libpci/pci/ids.h | 802 ++++++
cpukit/libpci/pci/ids_extra.h | 21 +
cpukit/libpci/pci/irq.h | 105 +
cpukit/libpci/pci_access.c | 74 +
cpukit/libpci/pci_access_func.c | 73 +
cpukit/libpci/pci_access_io.c | 48 +
cpukit/libpci/pci_access_mem.c | 22 +
cpukit/libpci/pci_access_mem_be.c | 67 +
cpukit/libpci/pci_access_mem_le.c | 66 +
cpukit/libpci/pci_bus.c | 567 ++++
cpukit/libpci/pci_bus.h | 160 ++
cpukit/libpci/pci_cfg.c | 55 +
cpukit/libpci/pci_cfg_auto.c | 1014 +++++++
cpukit/libpci/pci_cfg_peripheral.c | 32 +
cpukit/libpci/pci_cfg_print_code.c | 172 ++
cpukit/libpci/pci_cfg_read.c | 357 +++
cpukit/libpci/pci_cfg_static.c | 157 ++
cpukit/libpci/pci_find.c | 52 +
cpukit/libpci/pci_find_dev.c | 49 +
cpukit/libpci/pci_for_each.c | 62 +
cpukit/libpci/pci_for_each_child.c | 41 +
cpukit/libpci/pci_for_each_dev.c | 18 +
cpukit/libpci/pci_get_dev.c | 36 +
cpukit/libpci/pci_irq.c | 20 +
cpukit/libpci/pci_print.c | 190 ++
cpukit/libpci/preinstall.am | 75 +
cpukit/preinstall.am | 20 +-
cpukit/sapi/include/confdefs.h | 57 +-
cpukit/sapi/src/exinit.c | 63 +
cpukit/sapi/src/io.c | 4 +
cpukit/sapi/src/ioregisterdriver.c | 14 +-
cpukit/wrapup/Makefile.am | 3 +-
doc/ada_user/Makefile.am | 1 +
doc/ada_user/ada_user.texi | 2 +
doc/develenv/direct.t | 3 +
doc/user/Makefile.am | 9 +-
doc/user/c_user.texi | 2 +
doc/user/conf.t | 53 +
doc/user/libpci.t | 409 +++
234 files changed, 54274 insertions(+), 7665 deletions(-)
--
1.7.0.4
More information about the devel
mailing list