diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-03 16:41:16 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-04-09 07:09:46 +0200 |
commit | 814eccb4cf0e5433bd884a48dfa8e219bb2d0dd0 (patch) | |
tree | 2e079ca82187e519b3be56eb25057330b8344648 /c/src/lib/libbsp/powerpc | |
parent | bsp: Move umon support to bsps (diff) | |
download | rtems-814eccb4cf0e5433bd884a48dfa8e219bb2d0dd0.tar.bz2 |
bsps: Move VME support to bsps
The VME support is only used by powerpc BSPs.
This patch is a part of the BSP source reorganization.
Update #3285.
Diffstat (limited to 'c/src/lib/libbsp/powerpc')
-rw-r--r-- | c/src/lib/libbsp/powerpc/beatnik/Makefile.am | 8 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am | 10 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/mvme3100/Makefile.am | 10 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/mvme5500/Makefile.am | 6 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/shared/vme/README | 10 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/shared/vme/vme_universe.c | 436 | ||||
-rw-r--r-- | c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c | 142 |
7 files changed, 4 insertions, 618 deletions
diff --git a/c/src/lib/libbsp/powerpc/beatnik/Makefile.am b/c/src/lib/libbsp/powerpc/beatnik/Makefile.am index b47dbf1d2b..608a036350 100644 --- a/c/src/lib/libbsp/powerpc/beatnik/Makefile.am +++ b/c/src/lib/libbsp/powerpc/beatnik/Makefile.am @@ -82,13 +82,6 @@ libbsp_a_SOURCES += ../../powerpc/shared/pci/pci.c \ pci/gt_pci_init.c pci/pci_io_remap.c pci/motload_fixup.c \ ../../powerpc/shared/pci/pcifinddevice.c -#vme -libbsp_a_SOURCES += ../shared/vme/vmeconfig.c \ - ../shared/vme/vme_universe.c \ - ../../shared/vmeUniverse/vmeUniverse.c \ - ../../shared/vmeUniverse/vmeTsi148.c \ - ../../shared/vmeUniverse/bspVmeDmaList.c - #network if HAS_NETWORKING noinst_PROGRAMS += network_support.rel @@ -176,4 +169,5 @@ include $(top_srcdir)/../../../../automake/local.am include $(srcdir)/../../../../../../bsps/shared/shared-sources.am include $(srcdir)/../../../../../../bsps/powerpc/shared/shared-sources.am include $(srcdir)/../../../../../../bsps/powerpc/shared/exceptions-sources.am +include $(srcdir)/../../../../../../bsps/powerpc/shared/vme-sources.am include $(srcdir)/../../../../../../bsps/powerpc/beatnik/headers.am diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am b/c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am index f6b105d996..bc2e4266ac 100644 --- a/c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am +++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/Makefile.am @@ -95,15 +95,6 @@ libbsp_a_SOURCES += ../../powerpc/shared/residual/pnp.h libbsp_a_SOURCES += ../../powerpc/shared/residual/residual.h libbsp_a_SOURCES += ../../powerpc/shared/residual/residual.c -# vme -libbsp_a_SOURCES += ../../shared/vmeUniverse/vmeUniverse.c -libbsp_a_SOURCES += ../../shared/vmeUniverse/bspVmeDmaList.c -libbsp_a_SOURCES += ../../shared/vmeUniverse/vmeUniverse.h -libbsp_a_SOURCES += ../../shared/vmeUniverse/vme_am_defs.h -libbsp_a_SOURCES += ../../shared/vmeUniverse/VME.h -libbsp_a_SOURCES += ../../powerpc/shared/vme/vmeconfig.c -libbsp_a_SOURCES += ../../powerpc/shared/vme/vme_universe.c - if QEMU if HAS_NETWORKING libbsp_a_SOURCES += ../../i386/pc386/ne2000/ne2000.c @@ -128,4 +119,5 @@ include $(srcdir)/../../../../../../bsps/shared/shared-sources.am include $(top_srcdir)/../../../../automake/subdirs.am include $(srcdir)/../../../../../../bsps/powerpc/shared/shared-sources.am include $(srcdir)/../../../../../../bsps/powerpc/shared/exceptions-sources.am +include $(srcdir)/../../../../../../bsps/powerpc/shared/vme-sources.am include $(srcdir)/../../../../../../bsps/powerpc/motorola_powerpc/headers.am diff --git a/c/src/lib/libbsp/powerpc/mvme3100/Makefile.am b/c/src/lib/libbsp/powerpc/mvme3100/Makefile.am index 37362d0cad..337211a084 100644 --- a/c/src/lib/libbsp/powerpc/mvme3100/Makefile.am +++ b/c/src/lib/libbsp/powerpc/mvme3100/Makefile.am @@ -73,15 +73,6 @@ libbsp_a_SOURCES += ../../powerpc/shared/pci/pci.c \ ../../powerpc/shared/pci/generic_clear_hberrs.c \ ../../powerpc/shared/pci/pcifinddevice.c ../../powerpc/shared/pci/pci.h -# vme -libbsp_a_SOURCES += ../../shared/vmeUniverse/vmeTsi148.c \ - ../../shared/vmeUniverse/bspVmeDmaList.c \ - ../../shared/vmeUniverse/vmeTsi148.h \ - ../../shared/vmeUniverse/vme_am_defs.h \ - ../../shared/vmeUniverse/VME.h \ - ../../powerpc/shared/vme/vmeconfig.c \ - ../../powerpc/shared/vme/vme_universe.c - # flash libbsp_a_SOURCES += ../shared/flash/flash.c \ ../shared/flash/spansionFlash.c \ @@ -108,4 +99,5 @@ include $(top_srcdir)/../../../../automake/local.am include $(srcdir)/../../../../../../bsps/shared/shared-sources.am include $(srcdir)/../../../../../../bsps/powerpc/shared/shared-sources.am include $(srcdir)/../../../../../../bsps/powerpc/shared/exceptions-sources.am +include $(srcdir)/../../../../../../bsps/powerpc/shared/vme-sources.am include $(srcdir)/../../../../../../bsps/powerpc/mvme3100/headers.am diff --git a/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am b/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am index 551c7f0a75..42bcd70394 100644 --- a/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am +++ b/c/src/lib/libbsp/powerpc/mvme5500/Makefile.am @@ -52,11 +52,6 @@ libbsp_a_SOURCES += vectors/exceptionhandler.c \ # GT64260 libbsp_a_SOURCES += GT64260/GT64260TWSI.c GT64260/MVME5500I2C.c -# vme -libbsp_a_SOURCES += ../../shared/vmeUniverse/vmeUniverse.c\ - ../shared/vme/vmeconfig.c ../../shared/vmeUniverse/bspVmeDmaList.c\ - ../shared/vme/vme_universe.c - if HAS_NETWORKING network_CPPFLAGS = -D_KERNEL -D__BSD_VISIBLE noinst_PROGRAMS += network.rel @@ -95,4 +90,5 @@ include $(top_srcdir)/../../../../automake/local.am include $(srcdir)/../../../../../../bsps/shared/shared-sources.am include $(srcdir)/../../../../../../bsps/powerpc/shared/shared-sources.am include $(srcdir)/../../../../../../bsps/powerpc/shared/exceptions-sources.am +include $(srcdir)/../../../../../../bsps/powerpc/shared/vme-sources.am include $(srcdir)/../../../../../../bsps/powerpc/mvme5500/headers.am diff --git a/c/src/lib/libbsp/powerpc/shared/vme/README b/c/src/lib/libbsp/powerpc/shared/vme/README deleted file mode 100644 index e2e0020026..0000000000 --- a/c/src/lib/libbsp/powerpc/shared/vme/README +++ /dev/null @@ -1,10 +0,0 @@ -libbsp/shared/vmeUniverse/VME.h: VME API; BSP and bridge-chip independent -VMEConfig.h: defines BSP specific constants for VME configuration -vmeconfig.c configures the VME bridge using the VME.h API calls - and BSP specific constants from VMEConfig.h. - Independent of the bridge chip, however. -vme_universe.c: implements VME.h for the vmeUniverse driver. -vme_universe_dma.c: implements VMEDMA.h for the vmeUniverse driver. - -o other universe BSP --> use its own VMEConfig.h; may reuse vmeconfig.c, vme_universe.c -o other non-universe BSP --> use its own VMEConfig.h and vme_xxx.c; may reuse vmeconfig.c diff --git a/c/src/lib/libbsp/powerpc/shared/vme/vme_universe.c b/c/src/lib/libbsp/powerpc/shared/vme/vme_universe.c deleted file mode 100644 index 158a899b2a..0000000000 --- a/c/src/lib/libbsp/powerpc/shared/vme/vme_universe.c +++ /dev/null @@ -1,436 +0,0 @@ -/* Implementation of the VME.h and VMEDMA.h APIs for the BSP using the - * vmeUniverse/vmeTsi148 drivers - * - * This file is named vme_universe.c for historic reasons. - */ - - -#include <rtems.h> -#include <bsp.h> -#include <bsp/VME.h> -#include <bsp/VMEDMA.h> -#include <bsp/VMEConfig.h> -#include <bsp/irq.h> -#include <stdio.h> - -#define __INSIDE_RTEMS_BSP__ - -#if !defined(_VME_DRIVER_TSI148) && !defined(_VME_DRIVER_UNIVERSE) -#define _VME_DRIVER_UNIVERSE -#endif - -#if defined(_VME_DRIVER_TSI148) -#define _VME_TSI148_DECLARE_SHOW_ROUTINES -#include <bsp/vmeTsi148.h> -#include <bsp/vmeTsi148DMA.h> -#endif - -#if defined(_VME_DRIVER_UNIVERSE) -#define _VME_UNIVERSE_DECLARE_SHOW_ROUTINES -#include <bsp/vmeUniverse.h> -#include <bsp/vmeUniverseDMA.h> -#if !defined(BSP_VME_INSTALL_IRQ_MGR) && defined(BSP_VME_UNIVERSE_INSTALL_IRQ_MGR) -#define BSP_VME_INSTALL_IRQ_MGR BSP_VME_UNIVERSE_INSTALL_IRQ_MGR -#endif -#endif - -#include <bsp/bspVmeDmaList.h> - -/* Wrap BSP VME calls around driver calls - we do this so EPICS doesn't have to - * include bridge-specific headers. This file provides the necessary glue - * to make VME.h and vmeconfig.c independent of the bridge chip. - * - * This file is named 'vme_universe.c' for historical reasons. - */ - -/* - * Authorship - * ---------- - * This software was created by - * Till Straumann <strauman@slac.stanford.edu>, 9/2005, - * Stanford Linear Accelerator Center, Stanford University. - * - * Acknowledgement of sponsorship - * ------------------------------ - * This software was produced by - * the Stanford Linear Accelerator Center, Stanford University, - * under Contract DE-AC03-76SFO0515 with the Department of Energy. - * - * Government disclaimer of liability - * ---------------------------------- - * Neither the United States nor the United States Department of Energy, - * nor any of their employees, makes any warranty, express or implied, or - * assumes any legal liability or responsibility for the accuracy, - * completeness, or usefulness of any data, apparatus, product, or process - * disclosed, or represents that its use would not infringe privately owned - * rights. - * - * Stanford disclaimer of liability - * -------------------------------- - * Stanford University makes no representations or warranties, express or - * implied, nor assumes any liability for the use of this software. - * - * Stanford disclaimer of copyright - * -------------------------------- - * Stanford University, owner of the copyright, hereby disclaims its - * copyright and all other rights in this software. Hence, anyone may - * freely use it for any purpose without restriction. - * - * Maintenance of notices - * ---------------------- - * In the interest of clarity regarding the origin and status of this - * SLAC software, this and all the preceding Stanford University notices - * are to remain affixed to any copy or derivative of this software made - * or distributed by the recipient and are to be affixed to any copy of - * software made or distributed by the recipient that contains a copy or - * derivative of this software. - * - * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03 - */ -typedef struct { - int (*xlate_adrs)(int, int, unsigned long, unsigned long, unsigned long *); - int (*install_isr)(unsigned long, BSP_VME_ISR_t, void *); - int (*remove_isr)(unsigned long, BSP_VME_ISR_t, void *); - BSP_VME_ISR_t (*get_isr)(unsigned long vector, void **); - int (*enable_int_lvl)(unsigned int); - int (*disable_int_lvl)(unsigned int); - int (*outbound_p_cfg)(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); - int (*inbound_p_cfg) (unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); - void (*outbound_p_show)(FILE*); - void (*inbound_p_show) (FILE*); - void (*reset_bus)(void); - int (*install_irq_mgr)(int, int, int, ...); - int irq_mgr_flags; -} VMEOpsRec, *VMEOps; - -/* two separate 'ops' structs for historic reasons */ -typedef struct DmaOpsRec_ { - int (*setup)(int, uint32_t, uint32_t, void *); - int (*start)(int, uint32_t, uint32_t, uint32_t); - uint32_t (*status)(int); - VMEDmaListClass listClass; - int nChannels; - int *vectors; -} DmaOpsRec, *DmaOps; - -#ifdef _VME_DRIVER_UNIVERSE -static VMEOpsRec uniOpsRec = { - xlate_adrs: vmeUniverseXlateAddr, - install_isr: vmeUniverseInstallISR, - remove_isr: vmeUniverseRemoveISR, - get_isr: vmeUniverseISRGet, - enable_int_lvl: vmeUniverseIntEnable, - disable_int_lvl: vmeUniverseIntDisable, - outbound_p_cfg: vmeUniverseMasterPortCfg, - inbound_p_cfg: vmeUniverseSlavePortCfg, - outbound_p_show: vmeUniverseMasterPortsShow, - inbound_p_show: vmeUniverseSlavePortsShow, - reset_bus: vmeUniverseResetBus, - install_irq_mgr: vmeUniverseInstallIrqMgrAlt, - irq_mgr_flags: VMEUNIVERSE_IRQ_MGR_FLAG_SHARED | - VMEUNIVERSE_IRQ_MGR_FLAG_PW_WORKAROUND, -}; - -static int uniVecs[] = { UNIV_DMA_INT_VEC }; - -static DmaOpsRec uniDmaOpsRec = { - setup: vmeUniverseDmaSetup, - start: vmeUniverseDmaStart, - status: vmeUniverseDmaStatus, - listClass: &vmeUniverseDmaListClass, - nChannels: 1, - vectors: uniVecs, -}; -#endif - -#ifdef _VME_DRIVER_TSI148 -static VMEOpsRec tsiOpsRec = { - xlate_adrs: vmeTsi148XlateAddr, - install_isr: vmeTsi148InstallISR, - remove_isr: vmeTsi148RemoveISR, - get_isr: vmeTsi148ISRGet, - enable_int_lvl: vmeTsi148IntEnable, - disable_int_lvl: vmeTsi148IntDisable, - outbound_p_cfg: vmeTsi148OutboundPortCfg, - inbound_p_cfg: vmeTsi148InboundPortCfg, - outbound_p_show: vmeTsi148OutboundPortsShow, - inbound_p_show: vmeTsi148InboundPortsShow, - reset_bus: vmeTsi148ResetBus, - install_irq_mgr: vmeTsi148InstallIrqMgrAlt, - irq_mgr_flags: VMETSI148_IRQ_MGR_FLAG_SHARED, -}; - -static int tsiVecs[] = { - TSI_DMA_INT_VEC, - TSI_DMA1_INT_VEC, -}; - -static DmaOpsRec tsiDmaOpsRec = { - setup: vmeTsi148DmaSetup, - start: vmeTsi148DmaStart, - status: vmeTsi148DmaStatus, - listClass: &vmeTsi148DmaListClass, - nChannels: 2, - vectors: tsiVecs, -}; -#endif - -static VMEOps theOps = 0; -static DmaOps theDmaOps = 0; - -int -BSP_vme2local_adrs(unsigned long am, unsigned long vmeaddr, unsigned long *plocaladdr) -{ -int rval=theOps->xlate_adrs(1,0,am,vmeaddr,plocaladdr); - *plocaladdr+=PCI_MEM_BASE; - return rval; -} - -int -BSP_local2vme_adrs(unsigned long am, unsigned long localaddr, unsigned long *pvmeaddr) -{ - return theOps->xlate_adrs(0, 0, am,localaddr+PCI_DRAM_OFFSET,pvmeaddr); -} - -int -BSP_installVME_isr(unsigned long vector, BSP_VME_ISR_t handler, void *arg) -{ - return theOps->install_isr(vector, handler, arg); -} - -int -BSP_removeVME_isr(unsigned long vector, BSP_VME_ISR_t handler, void *arg) -{ - return theOps->remove_isr(vector, handler, arg); -} - -/* retrieve the currently installed ISR for a given vector */ -BSP_VME_ISR_t -BSP_getVME_isr(unsigned long vector, void **parg) -{ - return theOps->get_isr(vector, parg); -} - -int -BSP_enableVME_int_lvl(unsigned int level) -{ - return theOps->enable_int_lvl(level); -} - -int -BSP_disableVME_int_lvl(unsigned int level) -{ - return theOps->disable_int_lvl(level); -} - -int -BSP_VMEOutboundPortCfg( - unsigned long port, - unsigned long address_space, - unsigned long vme_address, - unsigned long pci_address, - unsigned long size) -{ - return theOps->outbound_p_cfg(port, address_space, vme_address, pci_address, size); -} - -int -BSP_VMEInboundPortCfg( - unsigned long port, - unsigned long address_space, - unsigned long vme_address, - unsigned long pci_address, - unsigned long size) -{ - return theOps->inbound_p_cfg(port, address_space, vme_address, pci_address, size); -} - -void -BSP_VMEOutboundPortsShow(FILE *f) -{ - theOps->outbound_p_show(f); -} - -void -BSP_VMEInboundPortsShow(FILE *f) -{ - theOps->inbound_p_show(f); -} - -void -BSP_VMEResetBus(void) -{ - theOps->reset_bus(); -} - -int -BSP_VMEDmaSetup(int channel, uint32_t bus_mode, uint32_t xfer_mode, void *custom_setup) -{ - return theDmaOps->setup(channel, bus_mode, xfer_mode, custom_setup); -} - -int -BSP_VMEDmaStart(int channel, uint32_t pci_addr, uint32_t vme_addr, uint32_t n_bytes) -{ - return theDmaOps->start(channel, pci_addr, vme_addr, n_bytes); -} - -uint32_t -BSP_VMEDmaStatus(int channel) -{ - return theDmaOps->status(channel); -} - -BSP_VMEDmaListDescriptor -BSP_VMEDmaListDescriptorSetup( - BSP_VMEDmaListDescriptor d, - uint32_t attr_mask, - uint32_t xfer_mode, - uint32_t pci_addr, - uint32_t vme_addr, - uint32_t n_bytes) -{ -VMEDmaListClass pc; - - if ( !d ) { - - pc = theDmaOps->listClass; - - return BSP_VMEDmaListDescriptorNewTool( - pc, - attr_mask, - xfer_mode, - pci_addr, - vme_addr, - n_bytes); - - } - - return BSP_VMEDmaListDescriptorSetupTool(d, attr_mask, xfer_mode, pci_addr, vme_addr, n_bytes); -} - -int -BSP_VMEDmaListStart(int channel, BSP_VMEDmaListDescriptor list) -{ - return BSP_VMEDmaListDescriptorStartTool(0, channel, list); -} - -/* NOT thread safe! */ -int -BSP_VMEDmaInstallISR(int channel, BSP_VMEDmaIRQCallback cb, void *usr_arg) -{ -int vec; -BSP_VME_ISR_t curr; -void *carg; - - if ( channel < 0 || channel >= theDmaOps->nChannels ) - return -1; - - vec = theDmaOps->vectors[channel]; - - curr = BSP_getVME_isr(vec, &carg); - - if ( cb && curr ) { - /* IRQ currently in use */ - return -1; - } - - if ( !cb && !curr ) { - /* Allow uninstall if no handler is currently installed; - * just make sure IRQ is disabled - */ - BSP_disableVME_int_lvl(vec); - return 0; - } - - if ( cb ) { - if ( BSP_installVME_isr(vec, (BSP_VME_ISR_t)cb, usr_arg) ) - return -4; - BSP_enableVME_int_lvl(vec); - } else { - BSP_disableVME_int_lvl(vec); - if ( BSP_removeVME_isr(vec, curr, carg) ) - return -4; - } - return 0; -} - -#if defined(_VME_DRIVER_TSI148) && !defined(VME_CLEAR_BRIDGE_ERRORS) -static unsigned short -tsi_clear_errors(int quiet) -{ -unsigned long v; -unsigned short rval; - v = vmeTsi148ClearVMEBusErrors(0); - - /* return bits 8..23 of VEAT; set bit 15 to make sure rval is nonzero on error */ - rval = v ? ((v>>8) & 0xffff) | (1<<15) : 0; - return rval; -} - -#define VME_CLEAR_BRIDGE_ERRORS tsi_clear_errors -#endif - -extern unsigned short (*_BSP_clear_vmebridge_errors)(int); - -int BSP_VMEInit(void) -{ -#if defined(_VME_DRIVER_UNIVERSE) - if ( 0 == vmeUniverseInit() ) { - theOps = &uniOpsRec; - theDmaOps = &uniDmaOpsRec; - vmeUniverseReset(); - } -#endif -#if defined(_VME_DRIVER_UNIVERSE) && defined(_VME_DRIVER_TSI148) - else -#endif -#if defined(_VME_DRIVER_TSI148) - if ( 0 == vmeTsi148Init() ) { - theOps = &tsiOpsRec; - theDmaOps = &tsiDmaOpsRec; - vmeTsi148Reset(); -#ifdef VME_CLEAR_BRIDGE_ERRORS - { - - _BSP_clear_vmebridge_errors = VME_CLEAR_BRIDGE_ERRORS; - - } -#endif - } -#endif - else - /* maybe no VME at all - or no universe/tsi148 ... */ - return -1; - - return 0; -} - -int BSP_VMEIrqMgrInstall(void) -{ -int err; -#ifndef BSP_VME_INSTALL_IRQ_MGR - /* No map; use first line only and obtain PIC wire from PCI config */ - err = theOps->install_irq_mgr( - theOps->irq_mgr_flags, /* use shared IRQs */ - 0, -1, /* Universe/Tsi148 pin0 -> PIC line from config space */ - -1 /* terminate list */ - ); -#else - BSP_VME_INSTALL_IRQ_MGR(err); -#endif - - if ( err ) - return err; - -/* This feature is only supported by the Universe driver (not Tsi148) */ -#if defined(BSP_PCI_VME_DRIVER_DOES_EOI) && defined(BSP_PIC_DO_EOI) -#ifdef _VME_DRIVER_TSI148 -#error "BSP_PCI_VME_DRIVER_DOES_EOI/BSP_PIC_DO_EOI feature can only be used with vmeUniverse" -#endif - if ( vmeUniverse0PciIrqLine < 0 ) - rtems_panic("Unable to get universe interrupt line info from PCI config"); - _BSP_vme_bridge_irq = vmeUniverse0PciIrqLine; -#endif - return 0; -} diff --git a/c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c b/c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c deleted file mode 100644 index c128d75f3c..0000000000 --- a/c/src/lib/libbsp/powerpc/shared/vme/vmeconfig.c +++ /dev/null @@ -1,142 +0,0 @@ -/* Default VME bridge configuration - note that this file - * is independent of the bridge driver/chip - */ - -/* - * Authorship - * ---------- - * This software was created by - * Till Straumann <strauman@slac.stanford.edu>, 3/2002, - * Stanford Linear Accelerator Center, Stanford University. - * - * Acknowledgement of sponsorship - * ------------------------------ - * This software was produced by - * the Stanford Linear Accelerator Center, Stanford University, - * under Contract DE-AC03-76SFO0515 with the Department of Energy. - * - * Government disclaimer of liability - * ---------------------------------- - * Neither the United States nor the United States Department of Energy, - * nor any of their employees, makes any warranty, express or implied, or - * assumes any legal liability or responsibility for the accuracy, - * completeness, or usefulness of any data, apparatus, product, or process - * disclosed, or represents that its use would not infringe privately owned - * rights. - * - * Stanford disclaimer of liability - * -------------------------------- - * Stanford University makes no representations or warranties, express or - * implied, nor assumes any liability for the use of this software. - * - * Stanford disclaimer of copyright - * -------------------------------- - * Stanford University, owner of the copyright, hereby disclaims its - * copyright and all other rights in this software. Hence, anyone may - * freely use it for any purpose without restriction. - * - * Maintenance of notices - * ---------------------- - * In the interest of clarity regarding the origin and status of this - * SLAC software, this and all the preceding Stanford University notices - * are to remain affixed to any copy or derivative of this software made - * or distributed by the recipient and are to be affixed to any copy of - * software made or distributed by the recipient that contains a copy or - * derivative of this software. - * - * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03 - */ - -#include <bsp.h> -#include <bsp/VME.h> -#include <bsp/VMEConfig.h> -#ifdef BSP_VME_BAT_IDX -#include <libcpu/bat.h> -#endif -#include <rtems/bspIo.h> - -extern int BSP_VMEInit(void); -extern int BSP_VMEIrqMgrInstall(void); - -/* Use a weak alias for the VME configuration. - * This permits individual applications to override - * this routine. - * They may even create an 'empty' - * - * void BSP_vme_config(void) {} - * - * which will avoid linking in the Universe driver - * at all :-). - */ - -void __BSP_default_vme_config(void); -void BSP_vme_config(void) - __attribute__ (( weak, alias("__BSP_default_vme_config") )); - -void -__BSP_default_vme_config(void) -{ - - if ( BSP_VMEInit() ) { - printk("Skipping VME initialization...\n"); - return; - } - -#ifdef BSP_VME_BAT_IDX - /* setup a PCI area to map the VME bus */ - setdbat(BSP_VME_BAT_IDX, - PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI, - PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI, - 0x10000000, - IO_PAGE); -#endif - - /* map VME address ranges */ - BSP_VMEOutboundPortCfg( - 0, - VME_AM_EXT_SUP_DATA, - _VME_A32_WIN0_ON_VME, - _VME_A32_WIN0_ON_PCI, - 0x0e000000); - BSP_VMEOutboundPortCfg( - 1, - VME_AM_STD_SUP_DATA, - 0x00000000, - _VME_A24_ON_PCI, - 0x00ff0000); - BSP_VMEOutboundPortCfg( - 2, - VME_AM_SUP_SHORT_IO, - 0x00000000, - _VME_A16_ON_PCI, - 0x00010000); - -#ifdef _VME_CSR_ON_PCI - /* Map VME64 CSR */ - BSP_VMEOutboundPortCfg( - 7, - VME_AM_CSR, - 0, - _VME_CSR_ON_PCI, - 0x01000000); -#endif - - -#ifdef _VME_DRAM_OFFSET - /* map our memory to VME giving the driver a hint that it's ordinary memory - * so they can enable decoupled cycles which should give better performance... - */ - BSP_VMEInboundPortCfg( - 0, - VME_AM_EXT_SUP_DATA | VME_AM_IS_MEMORY, - _VME_DRAM_OFFSET, - PCI_DRAM_OFFSET, - BSP_mem_size); -#endif - - /* stdio is not yet initialized; the driver will revert to printk */ - BSP_VMEOutboundPortsShow(0); - BSP_VMEInboundPortsShow(0); - - BSP_VMEIrqMgrInstall(); -} |