Back to home page

LXR

 
 

    


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

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSBSPsPowerPCBeatnik
0005  *
0006  * @brief Global BSP definitions.
0007  */
0008 
0009 /*
0010  *  bsp.h  -- contain BSP API definition.
0011  */
0012 
0013 /*
0014  *  Copyright (C) 1999 Eric Valette. valette@crf.canon.fr
0015  *
0016  *  The license and distribution terms for this file may be
0017  *  found in the file LICENSE in this distribution or at
0018  *  http://www.rtems.org/license/LICENSE.
0019  *
0020  *  S. Kate Feng 2003-2007 : Modified it to support the mvme5500 BSP.
0021  *
0022  *  Modified for the 'beatnik' BSP by T. Straumann, 2005-2007.
0023  */
0024 
0025 #ifndef LIBBSP_BEATNIK_BSP_H
0026 #define LIBBSP_BEATNIK_BSP_H
0027 
0028 /**
0029  * @defgroup RTEMSBSPsPowerPCBeatnik Beatnik (MVME5500 and MVME6100)
0030  *
0031  * @ingroup RTEMSBSPsPowerPC
0032  *
0033  * @brief Beatnik (MVME5500 and MVME6100) Board Support Package.
0034  *
0035  * @{
0036  */
0037 
0038 #ifndef ASM
0039 
0040 #include <bspopts.h>
0041 #include <bsp/default-initial-extension.h>
0042 
0043 #include <rtems.h>
0044 #include <libcpu/io.h>
0045 #include <bsp/vectors.h>
0046 
0047 #ifdef __cplusplus
0048 extern "C" {
0049 #endif
0050 
0051 /* Board type */
0052 typedef enum {
0053   Unknown = 0,
0054   MVME5500,
0055   MVME6100
0056 } BSP_BoardType;
0057 
0058 BSP_BoardType BSP_getBoardType(void);
0059 
0060 /* Discovery Version */
0061 
0062 typedef enum {
0063   unknown    = 0,
0064   GT_64260_A,      /* Revision 0x10 */
0065   GT_64260_B,      /* Revision 0x20 */
0066   MV_64360,
0067 } DiscoveryVersion;
0068 
0069 /* Determine the type of discovery chip on this board; info
0070  * is cached and repeated calls just return the cached value.
0071  *
0072  * If a non-zero argument is passed, the routine panics
0073  * (rtems_panic) if no recognized bridge is found;
0074  */
0075 DiscoveryVersion BSP_getDiscoveryVersion(int assertion);
0076 
0077 /*
0078  *  confdefs.h overrides for this BSP:
0079  *   - Interrupt stack space is not minimum if defined.
0080  */
0081 #define BSP_INTERRUPT_STACK_SIZE          (16 * 1024)
0082 
0083 /*
0084  *  base address definitions for several devices
0085  */
0086 #define BSP_MV64x60_BASE        (0xf1000000)
0087 #define BSP_MV64x60_DEV1_BASE   (0xf1100000)
0088 #define BSP_UART_IOBASE_COM1    ((BSP_MV64x60_DEV1_BASE)+0x20000)
0089 #define BSP_UART_IOBASE_COM2    ((BSP_MV64x60_DEV1_BASE)+0x21000)
0090 #define BSP_UART_USE_SHARED_IRQS
0091 
0092 #define BSP_NVRAM_BASE_ADDR      (0xf1110000)
0093 #define BSP_NVRAM_END_ADDR       (0xf1117fff)
0094 #define BSP_NVRAM_RTC_START      (0xf1117ff8)
0095 
0096 #define BSP_NVRAM_BOOTPARMS_START  (0xf1111000)
0097 #define BSP_NVRAM_BOOTPARMS_END    (0xf1111fff)
0098 
0099 
0100 /* This is only active/used during early init. It defines
0101  * the hose0 base for the shared/generic pci code.
0102  * Our own BSP specific pci initialization will then
0103  * override the PCI configuration (see gt_pci_init.c:BSP_pci_initialize)
0104  */
0105 
0106 #define PCI_CONFIG_ADDR        (BSP_MV64x60_BASE + 0xcf8)
0107 #define PCI_CONFIG_DATA        (BSP_MV64x60_BASE + 0xcfc)
0108 
0109 /* our wonderful PCI initialization remaps everything to CPU addresses
0110  * - before calling BSP_pci_initialize() this is NOT VALID, however
0111  * and the deprecated inl()/outl() etc won't work!
0112  */
0113 #define _IO_BASE          0x00000000
0114 /* wonderful MotLoad has the base address as seen from the
0115  * CPU programmed into config space :-)
0116  */
0117 #define PCI_MEM_BASE               0
0118 #define PCI_MEM_BASE_ADJUSTMENT    0
0119 #define PCI_DRAM_OFFSET            0
0120 
0121 extern void BSP_motload_pci_fixup(void);
0122 
0123 /* PCI <-> local address mapping - no sophisticated windows
0124  * (i.e., no support for cached regions etc. you read a BAR
0125  * from config space and that's 1:1 where the CPU sees it).
0126  * Our memory is mapped 1:1 to PCI also.
0127  */
0128 #define BSP_PCI2LOCAL_ADDR(a) ((uint32_t)(a))
0129 #define BSP_LOCAL2PCI_ADDR(a) ((uint32_t)(a))
0130 
0131 #define BSP_CONFIG_NUM_PCI_CACHE_SLOTS  32
0132 
0133 #define BSP_CONSOLE_PORT      BSP_UART_COM1
0134 #define BSP_UART_BAUD_BASE    115200
0135 
0136 /* I2C Devices */
0137 /* Note that the i2c addresses stated in the manual are
0138  * left-shifted by one bit.
0139  */
0140 #define BSP_VPD_I2C_ADDR      (0xA8>>1)    /* the VPD EEPROM  */
0141 #define BSP_USR_I2C_ADDR      (0xAA>>1)    /* the user EEPROM */
0142 #define BSP_THM_I2C_ADDR      (0x90>>1)    /* the DS1621 temperature sensor & thermostat */
0143 
0144 #define BSP_I2C_BUS_DESCRIPTOR    gt64260_i2c_bus_descriptor
0145 
0146 #define BSP_I2C_BUS0_NAME             "/dev/i2c0"
0147 
0148 #define BSP_I2C_VPD_EEPROM_NAME       "vpd-eeprom"
0149 #define BSP_I2C_USR_EEPROM_NAME       "usr-eeprom"
0150 #define BSP_I2C_DS1621_NAME           "ds1621"
0151 #define BSP_I2C_THM_NAME              BSP_I2C_DS1621_NAME
0152 #define BSP_I2C_DS1621_RAW_NAME       "ds1621-raw"
0153 
0154 #define  BSP_I2C_VPD_EEPROM_DEV_NAME      (BSP_I2C_BUS0_NAME ", " BSP_I2C_VPD_EEPROM_NAME)
0155 #define  BSP_I2C_USR_EEPROM_DEV_NAME      (BSP_I2C_BUS0_NAME ", " BSP_I2C_USR_EEPROM_NAME)
0156 #define  BSP_I2C_DS1621_DEV_NAME          (BSP_I2C_BUS0_NAME ", " BSP_I2C_DS1621_NAME)
0157 #define BSP_I2C_THM_DEV_NAME              BSP_I2C_DS1621_DEV_NAME
0158 #define  BSP_I2C_DS1621_RAW_DEV_NAME      (BSP_I2C_BUS0_NAME ", " BSP_I2C_DS1621_RAW_NAME)
0159 
0160 
0161 /* Initialize the I2C driver and register all devices 
0162  * RETURNS 0 on success, -1 on error.
0163  *
0164  * Access to the VPD and user EEPROMS as well
0165  * as the ds1621 temperature sensor is possible
0166  * by means of file nodes
0167  *
0168  *   /dev/i2c0.vpd-eeprom   (read-only)
0169  *   /dev/i2c0.usr-eeprom   (read-write)
0170  *   /dev/i2c0.ds1621       (read-only; one byte: board-temp in degC)
0171  *   /dev/i2c0.ds1621-raw   (read-write; transfer bytes to/from the ds1621)
0172  */
0173 int BSP_i2c_initialize(void);
0174 
0175 /* Networking; */
0176 #include <bsp/bsp_bsdnet_attach.h>
0177 int rtems_em_attach(struct rtems_bsdnet_ifconfig *, int);
0178 int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int);
0179 int rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *, int);
0180 
0181 /* NOT FOR PUBLIC USE BELOW HERE */
0182 #define BSP_PCI_HOSE0_MEM_BASE    0x80000000  /* must be aligned to size */
0183 #define BSP_PCI_HOSE0_MEM_SIZE    0x20000000
0184 
0185 #define BSP_PCI_HOSE1_MEM_BASE    0xe0000000
0186 
0187 #define BSP_DEV_AND_PCI_IO_BASE   0xf0000000
0188 #define BSP_DEV_AND_PCI_IO_SIZE   0x10000000
0189 
0190 /* maintain coherency between CPU and GT64340 Ethernet
0191  * (andpossibly other Discovery components).
0192  */
0193 #define BSP_RW_PAGE_ATTRIBUTES  TRIV121_ATTR_M
0194 
0195 extern unsigned BSP_pci_hose1_bus_base;
0196 
0197 void BSP_pci_initialize(void);
0198 
0199 /* Exception Handling */
0200 
0201 /* Use a task notepad to attach user exception handler info;
0202  * may be changed by application startup code (EPICS uses 11)
0203  */
0204 #define BSP_EXCEPTION_NOTEPAD    14
0205   
0206 #ifndef ASM
0207 
0208 #define outport_byte(port,value) outb(value,port)
0209 #define outport_word(port,value) outw(value,port)
0210 #define outport_long(port,value) outl(value,port)
0211 
0212 #define inport_byte(port,value) (value = inb(port))
0213 #define inport_word(port,value) (value = inw(port))
0214 #define inport_long(port,value) (value = inl(port))
0215 /*
0216  * Vital Board data Start using DATA RESIDUAL
0217  */
0218 /*
0219  * Total memory using RESIDUAL DATA
0220  */
0221 extern unsigned int BSP_mem_size;
0222 /*
0223  * Start of the heap
0224  */
0225 extern unsigned int BSP_heap_start;
0226 /*
0227  * PCI Bus Frequency
0228  */
0229 extern unsigned int BSP_bus_frequency;
0230 /*
0231  * processor clock frequency
0232  */
0233 extern unsigned int BSP_processor_frequency;
0234 /*
0235  * Time base divisior (how many tick for 1 second).
0236  */
0237 extern unsigned int BSP_time_base_divisor;
0238 
0239 extern char BSP_productIdent[20];
0240 extern char BSP_serialNumber[20];
0241 
0242 extern char BSP_enetAddr0[7];
0243 extern char BSP_enetAddr1[7];
0244 
0245 /*
0246  * The commandline as passed from the bootloader.
0247  */
0248 extern char *BSP_commandline_string;
0249 
0250 
0251 #define BSP_Convert_decrementer( _value ) \
0252   ((unsigned long long) ((((unsigned long long)BSP_time_base_divisor) * 1000000ULL) /((unsigned long long) BSP_bus_frequency)) * ((unsigned long long) (_value)))
0253 
0254 extern int BSP_disconnect_clock_handler (void);
0255 extern int BSP_connect_clock_handler (void);
0256 
0257 /* clear hostbridge errors
0258  *
0259  * enableMCP: whether to enable MCP checkstop / machine check interrupts
0260  *            on the hostbridge and in HID0.
0261  *
0262  *            NOTE: The 5500 and 6100 boards have NO PHYSICAL CONNECTION
0263  *                  to MCP so 'enableMCP' will always fail!
0264  *
0265  * quiet    : be silent
0266  *
0267  * RETURNS  : PCI status (hose 0 in byte 0, host 1 in byte 1) and
0268  *            VME bridge status (upper 16 bits).
0269  *            Zero if no errors were found.
0270  */
0271 extern unsigned long _BSP_clear_hostbridge_errors(int enableMCP, int quiet);
0272 
0273 /* clear vme bridge errors and return (bridge-dependent) 16-bit status
0274  *
0275  * quiet    : be silent
0276  *
0277  * RETURNS  : 0 if there were no errors, non-zero, bridge-dependent
0278  *            16-bit error status on error.
0279  *
0280  */
0281 extern unsigned short (*_BSP_clear_vmebridge_errors)(int);
0282 
0283 /*
0284  * Prototypes for debug helpers
0285  */
0286 void discovery_pic_set_debug_irq(int on);
0287 void discovery_pic_install_debug_irq(void);
0288 
0289 /*
0290  * Prototypes for methods called only from .S for dependency tracking
0291  */
0292 char *save_boot_params(
0293   void *r3,
0294   void *r4,
0295   void *r5,
0296   char *cmdline_start,
0297   char *cmdline_end
0298 );
0299 void zero_bss(void);
0300 
0301 /*
0302  * Prototypes for methods in the BSP that cross file boundaries
0303  */
0304 uint32_t probeMemoryEnd(void);
0305 
0306 #endif
0307 
0308 #ifdef __cplusplus
0309 }
0310 #endif
0311 
0312 #endif /* !ASM */
0313 
0314 /** @} */
0315 
0316 #endif