Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:58

0001 /* Default VME bridge configuration - note that this file
0002  * is independent of the bridge driver/chip
0003  */
0004 
0005 /*
0006  * Authorship
0007  * ----------
0008  * This software was created by
0009  *     Till Straumann <strauman@slac.stanford.edu>, 3/2002,
0010  *     Stanford Linear Accelerator Center, Stanford University.
0011  *
0012  * Acknowledgement of sponsorship
0013  * ------------------------------
0014  * This software was produced by
0015  *     the Stanford Linear Accelerator Center, Stanford University,
0016  *     under Contract DE-AC03-76SFO0515 with the Department of Energy.
0017  *
0018  * Government disclaimer of liability
0019  * ----------------------------------
0020  * Neither the United States nor the United States Department of Energy,
0021  * nor any of their employees, makes any warranty, express or implied, or
0022  * assumes any legal liability or responsibility for the accuracy,
0023  * completeness, or usefulness of any data, apparatus, product, or process
0024  * disclosed, or represents that its use would not infringe privately owned
0025  * rights.
0026  *
0027  * Stanford disclaimer of liability
0028  * --------------------------------
0029  * Stanford University makes no representations or warranties, express or
0030  * implied, nor assumes any liability for the use of this software.
0031  *
0032  * Stanford disclaimer of copyright
0033  * --------------------------------
0034  * Stanford University, owner of the copyright, hereby disclaims its
0035  * copyright and all other rights in this software.  Hence, anyone may
0036  * freely use it for any purpose without restriction.
0037  *
0038  * Maintenance of notices
0039  * ----------------------
0040  * In the interest of clarity regarding the origin and status of this
0041  * SLAC software, this and all the preceding Stanford University notices
0042  * are to remain affixed to any copy or derivative of this software made
0043  * or distributed by the recipient and are to be affixed to any copy of
0044  * software made or distributed by the recipient that contains a copy or
0045  * derivative of this software.
0046  *
0047  * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
0048  */
0049 
0050 #include <bsp.h>
0051 #include <bsp/VME.h>
0052 #include <bsp/VMEConfig.h>
0053 #ifdef BSP_VME_BAT_IDX
0054 #include <libcpu/bat.h>
0055 #endif
0056 #include <rtems/bspIo.h>
0057 
0058 extern int BSP_VMEInit(void);
0059 extern int BSP_VMEIrqMgrInstall(void);
0060 
0061 /* Use a weak alias for the VME configuration.
0062  * This permits individual applications to override
0063  * this routine.
0064  * They may even create an 'empty'
0065  *
0066  *    void BSP_vme_config(void) {}
0067  *
0068  * which will avoid linking in the Universe driver
0069  * at all :-).
0070  */
0071 
0072 void __BSP_default_vme_config(void);
0073 void BSP_vme_config(void)
0074   __attribute__ (( weak, alias("__BSP_default_vme_config") ));
0075 
0076 void
0077 __BSP_default_vme_config(void)
0078 {
0079 
0080   if ( BSP_VMEInit() ) {
0081     printk("Skipping VME initialization...\n");
0082     return;
0083   }
0084 
0085 #ifdef BSP_VME_BAT_IDX
0086   /* setup a PCI area to map the VME bus */
0087   setdbat(BSP_VME_BAT_IDX,
0088           PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI,
0089           PCI_MEM_BASE + _VME_A32_WIN0_ON_PCI,
0090           0x10000000,
0091           IO_PAGE);
0092 #endif
0093 
0094   /* map VME address ranges */
0095   BSP_VMEOutboundPortCfg(
0096     0,
0097     VME_AM_EXT_SUP_DATA,
0098     _VME_A32_WIN0_ON_VME,
0099     _VME_A32_WIN0_ON_PCI,
0100     0x0e000000);
0101   BSP_VMEOutboundPortCfg(
0102     1,
0103     VME_AM_STD_SUP_DATA,
0104     0x00000000,
0105     _VME_A24_ON_PCI,
0106     0x00ff0000);
0107   BSP_VMEOutboundPortCfg(
0108     2,
0109     VME_AM_SUP_SHORT_IO,
0110     0x00000000,
0111     _VME_A16_ON_PCI,
0112     0x00010000);
0113 
0114 #ifdef _VME_CSR_ON_PCI
0115   /* Map VME64 CSR */
0116   BSP_VMEOutboundPortCfg(
0117           7,
0118           VME_AM_CSR,
0119           0,
0120           _VME_CSR_ON_PCI,
0121           0x01000000);
0122 #endif
0123 
0124 
0125 #ifdef _VME_DRAM_OFFSET
0126   /* map our memory to VME giving the driver a hint that it's ordinary memory
0127    * so they can enable decoupled cycles which should give better performance...
0128    */
0129   BSP_VMEInboundPortCfg(
0130     0,
0131     VME_AM_EXT_SUP_DATA | VME_AM_IS_MEMORY,
0132     _VME_DRAM_OFFSET,
0133     PCI_DRAM_OFFSET,
0134     BSP_mem_size);
0135 #endif
0136 
0137   /* stdio is not yet initialized; the driver will revert to printk */
0138   BSP_VMEOutboundPortsShow(0);
0139   BSP_VMEInboundPortsShow(0);
0140 
0141   BSP_VMEIrqMgrInstall();
0142 }