Changeset 6d3ff66f in rtems


Ignore:
Timestamp:
Nov 4, 2005, 8:10:42 AM (14 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
784e792
Parents:
818fbd83
Message:

2005-11-03 Till Straumann <strauman@…>

  • shared/vme/README, shared/vme/vme_universe.c: New files.
  • Makefile.am, motorola_powerpc/Makefile.am, mvme5500/vme/vmeconfig.c, shared/vme/VME.h, shared/vme/VMEConfig.h, shared/vme/vmeconfig.c: Several VME related upgrades and fixes, hopefully addressing PR#835: Separated API, API-implementation by a specific VME bridge driver and BSP-specific configuration of the driver into different files, describing their purpose in a README. All of these changes use the upgraded vmeUniverse.c driver.
Location:
c/src/lib/libbsp/powerpc
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/Makefile.am

    r818fbd83 r6d3ff66f  
    6464## shared/vme
    6565EXTRA_DIST += shared/vme/vmeconfig.c shared/vme/VMEConfig.h shared/vme/VME.h
     66        shared/vme/README shared/vme/vme_universe.c
    6667
    6768include $(top_srcdir)/../../../automake/subdirs.am
  • c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am

    r818fbd83 r6d3ff66f  
    139139vme_rel_SOURCES = ../../shared/vmeUniverse/vmeUniverse.c \
    140140    ../../shared/vmeUniverse/vmeUniverse.h \
     141    ../../shared/vmeUniverse/vme_am_defs.h \
    141142    ../../powerpc/shared/vme/vmeconfig.c \
     143    ../../powerpc/shared/vme/vme_universe.c \
    142144    ../../powerpc/shared/vme/VMEConfig.h ../../powerpc/shared/vme/VME.h
    143145vme_rel_CPPFLAGS = $(AM_CPPFLAGS)
     
    261263PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/vmeUniverse.h
    262264
     265$(PROJECT_INCLUDE)/bsp/vme_am_defs.h: ../../shared/vmeUniverse/vme_am_defs.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     266        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/vme_am_defs.h
     267PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/vme_am_defs.h
     268
    263269$(PROJECT_INCLUDE)/bsp/VMEConfig.h: ../../powerpc/shared/vme/VMEConfig.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    264270        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/VMEConfig.h
  • c/src/lib/libbsp/powerpc/mvme5500/vme/vmeconfig.c

    r818fbd83 r6d3ff66f  
    7777
    7878  /* install the VME insterrupt manager */
    79   vmeUniverseInstallIrqMgr(0,12,1,13);   
     79  vmeUniverseInstallIrqMgr(0,64+12,1,64+13);   
    8080  if (vmeUniverse0PciIrqLine<0)
    8181        BSP_panic("Unable to get interrupt line info from PCI config");
  • c/src/lib/libbsp/powerpc/shared/vme/VME.h

    r818fbd83 r6d3ff66f  
    1 #ifndef RTEMS_BSP_VME_UNIVERSE_H
    2 #define RTEMS_BSP_VME_UNIVERSE_H
     1#ifndef RTEMS_BSP_VME_API_H
     2#define RTEMS_BSP_VME_API_H
    33/* $Id$ */
    44
     
    66/* Author: Till Straumann, <strauman@slac.stanford.edu> */
    77
    8 /* pull in bsp.h */
    9 #include <bsp.h>
    10 /* our VME bridge */
    11 #include <bsp/vmeUniverse.h>
    12 /* our address space configuration */
    13 #include <bsp/VMEConfig.h>
     8#include <stdio.h>
     9
     10/* address modifiers & friends */
     11#include <bsp/vme_am_defs.h>
    1412
    1513/* VME related declarations */
    16 /* how to map a VME address to the CPU local bus.
    17  * Note that this traverses two bridges:
    18  * the grackle and the universe. For the
    19  * Universe, there is a lookup procedure while
    20  * we assume a 1:1 mapping for the grackle...
     14
     15/*
     16 * BSP-specific configuration routine; sets up
     17 * VME windows and installs the VME interrupt manager.
    2118 */
    22 
    23 /* NOTE about the fast mapping macros:
    24  * using these macros is only safe if the user app
    25  * does _NOT_ change the universe mappings!
    26  * While changing the PCI windows probably doesn't
    27  * make much sense (involves changing the MMU/DBATs as well),
    28  * The user might wish to change the VME address
    29  * layout, i.e. by remapping _VME_A32_WIN0_ON_VME
    30  * and _VME_DRAM_OFFSET...
    31  * Hence, using the A24 and A16 macros is probably safe.
    32  */
    33 
    34 #define BSP_vme_init() \
    35         vmeUniverseInit
     19void BSP_vme_config() __attribute__((weak));
    3620
    3721/* translate through host bridge and vme master window of vme bridge */
    38 static inline int
    39 BSP_vme2local_adrs(unsigned am, unsigned long vmeaddr, unsigned long *plocaladdr)
    40 {
    41 int rval=vmeUniverseXlateAddr(1,0,am,vmeaddr,plocaladdr);
    42         *plocaladdr+=PCI_MEM_BASE;
    43         return rval;
    44 }
     22int
     23BSP_vme2local_adrs(unsigned long am, unsigned long vmeaddr, unsigned long *plocaladdr);
    4524
    46 /* when using this macro, the universe setup MUST NOT BE
    47  * CHANGED by the application...
    48  */
    49 #define BSP_vme2local_A32_fast(vmeaddr) \
    50         ((vmeaddr)-_VME_A32_WIN0_ON_VME + _VME_A32_WIN0_ON_PCI + PCI_MEM_BASE)
    51 #define BSP_vme2local_A24_fast(vmeaddr) \
    52         (((vmeaddr)&0x7ffffff)+_VME_A24_ON_PCI + PCI_MEM_BASE)
    53 #define BSP_vme2local_A16_fast(vmeaddr) \
    54         (((vmeaddr)&0xffff)+_VME_A16_ON_PCI + PCI_MEM_BASE)
    55 
    56 /* how a CPU address is mapped to the VME bus (if at all)
    57  */
    58 static inline int
    59 BSP_local2vme_adrs(unsigned am, unsigned long localaddr, unsigned long *pvmeaddr)
    60 {
    61 return vmeUniverseXlateAddr(0, 0, am,localaddr+PCI_DRAM_OFFSET,pvmeaddr);
    62 }
    63 
    64 #define BSP_localdram2vme_fast(localaddr) \
    65         ((localaddr)+_VME_DRAM_OFFSET)
     25/* how a CPU address is mapped to the VME bus (if at all) */
     26int
     27BSP_local2vme_adrs(unsigned long am, unsigned long localaddr, unsigned long *pvmeaddr);
    6628
    6729/* interrupt handlers and levels */
    6830typedef void (*BSP_VME_ISR_t)(void *usrArg, unsigned long vector);
    6931
    70 #define BSP_installVME_isr(vector, handler, arg) \
    71         vmeUniverseInstallISR(vector, handler, arg)
    72 
    73 #define BSP_removeVME_isr(vector, handler, arg) \
    74         vmeUniverseRemoveISR(vector, handler, arg)
     32int
     33BSP_installVME_isr(unsigned long vector, BSP_VME_ISR_t handler, void *arg);
     34int
     35BSP_removeVME_isr(unsigned long vector, BSP_VME_ISR_t handler, void *arg);
    7536
    7637/* retrieve the currently installed ISR for a given vector */
    77 #define BSP_getVME_isr(vector, parg) \
    78     vmeUniverseISRGet(vector, parg)
     38BSP_VME_ISR_t
     39BSP_getVME_isr(unsigned long vector, void **parg);
    7940
    80 #define BSP_enableVME_int_lvl(level) \
    81         vmeUniverseIntEnable(level)
     41int
     42BSP_enableVME_int_lvl(unsigned int level);
    8243
    83 #define BSP_disableVME_int_lvl(level) \
    84         vmeUniverseIntDisable(level)
     44int
     45BSP_disableVME_int_lvl(unsigned int level);
    8546
    86 /* Tell the interrupt manager that the universe driver
    87  * already called openpic_eoi() and that this step hence
    88  * must be omitted.
    89  */
    90 #define BSP_PCI_VME_DRIVER_DOES_EOI
    91 extern int _BSP_vme_bridge_irq;
    92 /* don't reference vmeUniverse0PciIrqLine directly here - leave it up to
    93  * bspstart() to set BSP_vme_bridge_irq. That way, we can generate variants
    94  * of the BSP with / without the universe driver...
    95  */
    96 #define BSP_PCI_VME_BRIDGE_IRQ _BSP_vme_bridge_irq
     47int
     48BSP_VMEOutboundPortCfg(
     49        unsigned long port,
     50        unsigned long address_space,
     51        unsigned long vme_address,
     52        unsigned long pci_address,
     53        unsigned long size);
     54
     55int
     56BSP_VMEInboundPortCfg(
     57        unsigned long port,
     58        unsigned long address_space,
     59        unsigned long vme_address,
     60        unsigned long pci_address,
     61        unsigned long size);
     62
     63void
     64BSP_VMEOutboundPortsShow(FILE *f);
     65
     66void
     67BSP_VMEInboundPortsShow(FILE *f);
    9768
    9869#endif
  • c/src/lib/libbsp/powerpc/shared/vme/VMEConfig.h

    r818fbd83 r6d3ff66f  
    1111 * hardcoded window lengths that match this
    1212 * layout:
     13 *
     14 * BSP_VME_BAT_IDX defines
     15 * which BAT to use for mapping the VME bus.
     16 * If this is undefined, no extra BAT will be
     17 * configured and VME has to share the available
     18 * PCI address space with PCI devices.
    1319 */
     20
    1421#if defined(mvme2100)
    1522#define _VME_A32_WIN0_ON_PCI    0x90000000
    1623#define _VME_A24_ON_PCI                 0x9f000000
    1724#define _VME_A16_ON_PCI                 0x9fff0000
     25#define BSP_VME_BAT_IDX                 1
    1826#else
    1927#define _VME_A32_WIN0_ON_PCI    0x10000000
    2028#define _VME_A24_ON_PCI                 0x1f000000
    2129#define _VME_A16_ON_PCI                 0x1fff0000
     30#define BSP_VME_BAT_IDX                 0
    2231#endif
    2332
     
    3342#define _VME_DRAM_OFFSET                0xc0000000
    3443
     44/* Tell the interrupt manager that the universe driver
     45 * already called openpic_eoi() and that this step hence
     46 * must be omitted.
     47 */
     48
     49#define BSP_PCI_VME_DRIVER_DOES_EOI
     50/* don't reference vmeUniverse0PciIrqLine directly here - leave it up to
     51 * bspstart() to set BSP_vme_bridge_irq. That way, we can generate variants
     52 * of the BSP with / without the universe driver...
     53 */
     54extern int _BSP_vme_bridge_irq;
     55
     56extern int BSP_VMEInit();
     57extern int BSP_VMEIrqMgrInstall();
     58
     59#include <bsp/motorola.h>
     60#include <bsp/pci.h>
     61
     62#define BSP_VME_UNIVERSE_INSTALL_IRQ_MGR                                                \
     63do {                                                                                                                    \
     64int              bus, dev, i = 0, j;                                                    \
     65const struct _int_map  *bspmap;                                                                 \
     66  /* install the VME interrupt manager;                                                 \
     67   * if there's a bsp route map, use it to                                              \
     68   * configure additional lines...                                                              \
     69   */                                                                                                                   \
     70  if (0 == pci_find_device(0x10e3, 0x0000, 0, &bus, &dev, &i)){ \
     71        if ( (bspmap = motorolaIntMap(currentBoard)) ) {                        \
     72        for ( i=0; bspmap[i].bus >= 0; i++ ) {                                          \
     73          if ( bspmap[i].bus == bus && bspmap[i].slot == dev ) {        \
     74                int pins[5], names[4];                                                                  \
     75                /* found it; use info here...                   */              \
     76                /* copy up to 4 entries; terminated with -1 pin */              \
     77                for ( j=0;                                                                                              \
     78                      j<5 && (pins[j]=bspmap[i].pin_route[j].pin-1)>=0; \
     79                      j++) {                                                                                    \
     80                        names[j] = bspmap[i].pin_route[j].int_name[0];          \
     81                }                                                                                                               \
     82                pins[4] = -1;                                                                                   \
     83                if ( 0 == vmeUniverseInstallIrqMgrAlt(                                  \
     84                                1, /* shared IRQs */                                                    \
     85                                pins[0], names[0],                                                              \
     86                                pins[1], names[1],                                                              \
     87                                pins[2], names[2],                                                              \
     88                                pins[3], names[3],                                                              \
     89                                -1) ) {                                                                                 \
     90                  i = -1;                                                                                               \
     91                  break;                                                                                                \
     92                }                                                                                                               \
     93          }                                                                                                                     \
     94        }                                                                                                                       \
     95    }                                                                                                                   \
     96        if ( i >= 0 )                                                                                           \
     97          vmeUniverseInstallIrqMgrAlt(1,0,-1,-1);                                       \
     98  }                                                                                                                             \
     99} while (0)
     100
    35101#endif
  • c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c

    r818fbd83 r6d3ff66f  
    11/* $Id$ */
    22
    3 /* Standard VME bridge configuration for VGM type boards */
     3/* Default VME bridge configuration - note that this file
     4 * is independent of the bridge driver/chip
     5 */
    46
    57/* Author: Till Straumann <strauman@slac.stanford.edu>, 3/2002 */
     
    79#include <bsp.h>
    810#include <bsp/VME.h>
    9 #include <bsp/irq.h>
     11#include <bsp/VMEConfig.h>
    1012#include <libcpu/bat.h>
    11 #include <libcpu/spr.h>
    12 #include <bsp/motorola.h>
     13#include <rtems/bspIo.h>
    1314
    1415/* Use a weak alias for the VME configuration.
     
    2526void BSP_vme_config(void) __attribute__ (( weak, alias("__BSP_default_vme_config") ));
    2627
    27 SPR_RO(DBAT0U)
    28 
    2928void
    3029__BSP_default_vme_config(void)
    3130{
    32 union {
    33         struct _BATU    bat;
    34         unsigned long   batbits;
    35 } dbat0u;
    3631
    37   vmeUniverseInit();
    38   vmeUniverseReset();
    39   /* setup a PCI area to map the VME bus */
    40 
    41   dbat0u.batbits = _read_DBAT0U();
    42 
    43   /* if we have page tables, BAT0 is available */
    44   if (dbat0u.bat.vs || dbat0u.bat.vp) {
    45         printk("WARNING: BAT0 is taken (no pagetables?); "
    46                "VME bridge must share PCI range for VME access\n"
    47                "Skipping VME initialization...\n");
     32  if ( BSP_VMEInit() ) {
     33        printk("Skipping VME initialization...\n");
    4834        return;
    4935  }
    5036
    51   setdbat(0,
     37#ifdef BSP_VME_BAT_IDX
     38  /* setup a PCI area to map the VME bus */
     39  setdbat(BSP_VME_BAT_IDX,
    5240                  PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI,
    5341                  PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI,
    5442                  0x10000000,
    5543                  IO_PAGE);
     44#endif
    5645
    5746  /* map VME address ranges */
    58   vmeUniverseMasterPortCfg(
     47  BSP_VMEOutboundPortCfg(
    5948        0,
    6049        VME_AM_EXT_SUP_DATA,
     
    6251        _VME_A32_WIN0_ON_PCI,
    6352        0x0F000000);
    64   vmeUniverseMasterPortCfg(
     53  BSP_VMEOutboundPortCfg(
    6554        1,
    6655        VME_AM_STD_SUP_DATA,
     
    6857        _VME_A24_ON_PCI,
    6958        0x00ff0000);
    70   vmeUniverseMasterPortCfg(
     59  BSP_VMEOutboundPortCfg(
    7160        2,
    7261        VME_AM_SUP_SHORT_IO,
     
    7766#ifdef _VME_DRAM_OFFSET
    7867  /* map our memory to VME */
    79   vmeUniverseSlavePortCfg(
     68  BSP_VMEInboundPortCfg(
    8069        0,
    8170        VME_AM_EXT_SUP_DATA,
     
    8372        PCI_DRAM_OFFSET,
    8473        BSP_mem_size);
    85 
    86   /* make sure the host bridge PCI master is enabled */
    87   vmeUniverseWriteReg(
    88         vmeUniverseReadReg(UNIV_REGOFF_PCI_CSR) | UNIV_PCI_CSR_BM,
    89         UNIV_REGOFF_PCI_CSR);
    9074#endif
    9175
    9276  /* stdio is not yet initialized; the driver will revert to printk */
    93   vmeUniverseMasterPortsShow(0);
    94   vmeUniverseSlavePortsShow(0);
     77  BSP_VMEOutboundPortsShow(0);
     78  BSP_VMEInboundPortsShow(0);
    9579
    96   /* install the VME insterrupt manager */
    97   vmeUniverseInstallIrqMgr(0,5,1,6);
    98   if (vmeUniverse0PciIrqLine<0)
    99         BSP_panic("Unable to get interrupt line info from PCI config");
    100   _BSP_vme_bridge_irq=BSP_PCI_IRQ_LOWEST_OFFSET+vmeUniverse0PciIrqLine;
     80  BSP_VMEIrqMgrInstall();
    10181}
Note: See TracChangeset for help on using the changeset viewer.