RTEMS 6.3-rc2
Loading...
Searching...
No Matches
bsp.h
Go to the documentation of this file.
1
9/*
10 * bsp.h -- contain BSP API definition.
11 */
12
13/*
14 * Copyright (C) 1999 Eric Valette. valette@crf.canon.fr
15 *
16 * The license and distribution terms for this file may be
17 * found in the file LICENSE in this distribution or at
18 * http://www.rtems.org/license/LICENSE.
19 *
20 * S. Kate Feng 2003-2007 : Modified it to support the mvme5500 BSP.
21 *
22 * Modified for the 'beatnik' BSP by T. Straumann, 2005-2007.
23 */
24
25#ifndef LIBBSP_BEATNIK_BSP_H
26#define LIBBSP_BEATNIK_BSP_H
27
38#ifndef ASM
39
40#include <bspopts.h>
42
43#include <rtems.h>
44#include <libcpu/io.h>
45#include <bsp/vectors.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/* Board type */
52typedef enum {
53 Unknown = 0,
54 MVME5500,
55 MVME6100
56} BSP_BoardType;
57
58BSP_BoardType BSP_getBoardType(void);
59
60/* Discovery Version */
61
62typedef enum {
63 unknown = 0,
64 GT_64260_A, /* Revision 0x10 */
65 GT_64260_B, /* Revision 0x20 */
66 MV_64360,
67} DiscoveryVersion;
68
69/* Determine the type of discovery chip on this board; info
70 * is cached and repeated calls just return the cached value.
71 *
72 * If a non-zero argument is passed, the routine panics
73 * (rtems_panic) if no recognized bridge is found;
74 */
75DiscoveryVersion BSP_getDiscoveryVersion(int assertion);
76
77/*
78 * confdefs.h overrides for this BSP:
79 * - Interrupt stack space is not minimum if defined.
80 */
81#define BSP_INTERRUPT_STACK_SIZE (16 * 1024)
82
83/*
84 * base address definitions for several devices
85 */
86#define BSP_MV64x60_BASE (0xf1000000)
87#define BSP_MV64x60_DEV1_BASE (0xf1100000)
88#define BSP_UART_IOBASE_COM1 ((BSP_MV64x60_DEV1_BASE)+0x20000)
89#define BSP_UART_IOBASE_COM2 ((BSP_MV64x60_DEV1_BASE)+0x21000)
90#define BSP_UART_USE_SHARED_IRQS
91
92#define BSP_NVRAM_BASE_ADDR (0xf1110000)
93#define BSP_NVRAM_END_ADDR (0xf1117fff)
94#define BSP_NVRAM_RTC_START (0xf1117ff8)
95
96#define BSP_NVRAM_BOOTPARMS_START (0xf1111000)
97#define BSP_NVRAM_BOOTPARMS_END (0xf1111fff)
98
99
100/* This is only active/used during early init. It defines
101 * the hose0 base for the shared/generic pci code.
102 * Our own BSP specific pci initialization will then
103 * override the PCI configuration (see gt_pci_init.c:BSP_pci_initialize)
104 */
105
106#define PCI_CONFIG_ADDR (BSP_MV64x60_BASE + 0xcf8)
107#define PCI_CONFIG_DATA (BSP_MV64x60_BASE + 0xcfc)
108
109/* our wonderful PCI initialization remaps everything to CPU addresses
110 * - before calling BSP_pci_initialize() this is NOT VALID, however
111 * and the deprecated inl()/outl() etc won't work!
112 */
113#define _IO_BASE 0x00000000
114/* wonderful MotLoad has the base address as seen from the
115 * CPU programmed into config space :-)
116 */
117#define PCI_MEM_BASE 0
118#define PCI_MEM_BASE_ADJUSTMENT 0
119#define PCI_DRAM_OFFSET 0
120
121/*
122 * The BSP has PCI devices. Enable support in LibBSD.
123 */
124#define BSP_HAS_PC_PCI
125
126/*
127 * Remap the PCI address space for LibBSD
128 */
129#define RTEMS_BSP_PCI_IO_REGION_BASE 0
130#define RTEMS_BSP_PCI_MEM_REGION_BASE PCI_DRAM_OFFSET
131
132extern void BSP_motload_pci_fixup(void);
133
134/* PCI <-> local address mapping - no sophisticated windows
135 * (i.e., no support for cached regions etc. you read a BAR
136 * from config space and that's 1:1 where the CPU sees it).
137 * Our memory is mapped 1:1 to PCI also.
138 */
139#define BSP_PCI2LOCAL_ADDR(a) ((uint32_t)(a))
140#define BSP_LOCAL2PCI_ADDR(a) ((uint32_t)(a))
141
142#define BSP_CONFIG_NUM_PCI_CACHE_SLOTS 32
143
144#define BSP_CONSOLE_PORT BSP_UART_COM1
145#define BSP_UART_BAUD_BASE 115200
146
147/* I2C Devices */
148/* Note that the i2c addresses stated in the manual are
149 * left-shifted by one bit.
150 */
151#define BSP_VPD_I2C_ADDR (0xA8>>1) /* the VPD EEPROM */
152#define BSP_USR_I2C_ADDR (0xAA>>1) /* the user EEPROM */
153#define BSP_THM_I2C_ADDR (0x90>>1) /* the DS1621 temperature sensor & thermostat */
154
155#define BSP_I2C_BUS_DESCRIPTOR gt64260_i2c_bus_descriptor
156
157#define BSP_I2C_BUS0_NAME "/dev/i2c0"
158
159#define BSP_I2C_VPD_EEPROM_NAME "vpd-eeprom"
160#define BSP_I2C_USR_EEPROM_NAME "usr-eeprom"
161#define BSP_I2C_DS1621_NAME "ds1621"
162#define BSP_I2C_THM_NAME BSP_I2C_DS1621_NAME
163#define BSP_I2C_DS1621_RAW_NAME "ds1621-raw"
164
165#define BSP_I2C_VPD_EEPROM_DEV_NAME (BSP_I2C_BUS0_NAME ", " BSP_I2C_VPD_EEPROM_NAME)
166#define BSP_I2C_USR_EEPROM_DEV_NAME (BSP_I2C_BUS0_NAME ", " BSP_I2C_USR_EEPROM_NAME)
167#define BSP_I2C_DS1621_DEV_NAME (BSP_I2C_BUS0_NAME ", " BSP_I2C_DS1621_NAME)
168#define BSP_I2C_THM_DEV_NAME BSP_I2C_DS1621_DEV_NAME
169#define BSP_I2C_DS1621_RAW_DEV_NAME (BSP_I2C_BUS0_NAME ", " BSP_I2C_DS1621_RAW_NAME)
170
171
172/* Initialize the I2C driver and register all devices
173 * RETURNS 0 on success, -1 on error.
174 *
175 * Access to the VPD and user EEPROMS as well
176 * as the ds1621 temperature sensor is possible
177 * by means of file nodes
178 *
179 * /dev/i2c0.vpd-eeprom (read-only)
180 * /dev/i2c0.usr-eeprom (read-write)
181 * /dev/i2c0.ds1621 (read-only; one byte: board-temp in degC)
182 * /dev/i2c0.ds1621-raw (read-write; transfer bytes to/from the ds1621)
183 */
184int BSP_i2c_initialize(void);
185
186/* Networking; */
187#include <bsp/bsp_bsdnet_attach.h>
188int rtems_em_attach(struct rtems_bsdnet_ifconfig *, int);
189int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int);
190int rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *, int);
191
192/* NOT FOR PUBLIC USE BELOW HERE */
193#define BSP_PCI_HOSE0_MEM_BASE 0x80000000 /* must be aligned to size */
194#define BSP_PCI_HOSE0_MEM_SIZE 0x20000000
195
196#define BSP_PCI_HOSE1_MEM_BASE 0xe0000000
197
198#define BSP_DEV_AND_PCI_IO_BASE 0xf0000000
199#define BSP_DEV_AND_PCI_IO_SIZE 0x10000000
200
201/* maintain coherency between CPU and GT64340 Ethernet
202 * (andpossibly other Discovery components).
203 */
204#define BSP_RW_PAGE_ATTRIBUTES TRIV121_ATTR_M
205
206extern unsigned BSP_pci_hose1_bus_base;
207
208void BSP_pci_initialize(void);
209
210/* Exception Handling */
211
212/* Use a task notepad to attach user exception handler info;
213 * may be changed by application startup code (EPICS uses 11)
214 */
215#define BSP_EXCEPTION_NOTEPAD 14
216
217#ifndef ASM
218
219#define outport_byte(port,value) outb(value,port)
220#define outport_word(port,value) outw(value,port)
221#define outport_long(port,value) outl(value,port)
222
223#define inport_byte(port,value) (value = inb(port))
224#define inport_word(port,value) (value = inw(port))
225#define inport_long(port,value) (value = inl(port))
226/*
227 * Vital Board data Start using DATA RESIDUAL
228 */
229/*
230 * Total memory using RESIDUAL DATA
231 */
232extern unsigned int BSP_mem_size;
233/*
234 * Start of the heap
235 */
236extern unsigned int BSP_heap_start;
237/*
238 * PCI Bus Frequency
239 */
240extern unsigned int BSP_bus_frequency;
241/*
242 * processor clock frequency
243 */
244extern unsigned int BSP_processor_frequency;
245/*
246 * Time base divisior (how many tick for 1 second).
247 */
248extern unsigned int BSP_time_base_divisor;
249
250extern char BSP_productIdent[20];
251extern char BSP_serialNumber[20];
252
253extern char BSP_enetAddr0[7];
254extern char BSP_enetAddr1[7];
255
256/*
257 * The commandline as passed from the bootloader.
258 */
259extern char *BSP_commandline_string;
260
261
262#define BSP_Convert_decrementer( _value ) \
263 ((unsigned long long) ((((unsigned long long)BSP_time_base_divisor) * 1000000ULL) /((unsigned long long) BSP_bus_frequency)) * ((unsigned long long) (_value)))
264
265extern int BSP_disconnect_clock_handler (void);
266extern int BSP_connect_clock_handler (void);
267
268/* clear hostbridge errors
269 *
270 * enableMCP: whether to enable MCP checkstop / machine check interrupts
271 * on the hostbridge and in HID0.
272 *
273 * NOTE: The 5500 and 6100 boards have NO PHYSICAL CONNECTION
274 * to MCP so 'enableMCP' will always fail!
275 *
276 * quiet : be silent
277 *
278 * RETURNS : PCI status (hose 0 in byte 0, host 1 in byte 1) and
279 * VME bridge status (upper 16 bits).
280 * Zero if no errors were found.
281 */
282extern unsigned long _BSP_clear_hostbridge_errors(int enableMCP, int quiet);
283
284/* clear vme bridge errors and return (bridge-dependent) 16-bit status
285 *
286 * quiet : be silent
287 *
288 * RETURNS : 0 if there were no errors, non-zero, bridge-dependent
289 * 16-bit error status on error.
290 *
291 */
292extern unsigned short (*_BSP_clear_vmebridge_errors)(int);
293
294/*
295 * Prototypes for debug helpers
296 */
297void discovery_pic_set_debug_irq(int on);
298void discovery_pic_install_debug_irq(void);
299
300/*
301 * Prototypes for methods called only from .S for dependency tracking
302 */
303char *save_boot_params(
304 void *r3,
305 void *r4,
306 void *r5,
307 char *cmdline_start,
308 char *cmdline_end
309);
310void zero_bss(void);
311
312/*
313 * Prototypes for methods in the BSP that cross file boundaries
314 */
315uint32_t probeMemoryEnd(void);
316
317#endif
318
319#ifdef __cplusplus
320}
321#endif
322
323#endif /* !ASM */
324
327#endif
PowerPC Exceptions API.
This header file provides the default definition of BSP_INITIAL_EXTENSION.
This header file defines the RTEMS Classic API.