RTEMS 6.1-rc7
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
121extern void BSP_motload_pci_fixup(void);
122
123/* PCI <-> local address mapping - no sophisticated windows
124 * (i.e., no support for cached regions etc. you read a BAR
125 * from config space and that's 1:1 where the CPU sees it).
126 * Our memory is mapped 1:1 to PCI also.
127 */
128#define BSP_PCI2LOCAL_ADDR(a) ((uint32_t)(a))
129#define BSP_LOCAL2PCI_ADDR(a) ((uint32_t)(a))
130
131#define BSP_CONFIG_NUM_PCI_CACHE_SLOTS 32
132
133#define BSP_CONSOLE_PORT BSP_UART_COM1
134#define BSP_UART_BAUD_BASE 115200
135
136/* I2C Devices */
137/* Note that the i2c addresses stated in the manual are
138 * left-shifted by one bit.
139 */
140#define BSP_VPD_I2C_ADDR (0xA8>>1) /* the VPD EEPROM */
141#define BSP_USR_I2C_ADDR (0xAA>>1) /* the user EEPROM */
142#define BSP_THM_I2C_ADDR (0x90>>1) /* the DS1621 temperature sensor & thermostat */
143
144#define BSP_I2C_BUS_DESCRIPTOR gt64260_i2c_bus_descriptor
145
146#define BSP_I2C_BUS0_NAME "/dev/i2c0"
147
148#define BSP_I2C_VPD_EEPROM_NAME "vpd-eeprom"
149#define BSP_I2C_USR_EEPROM_NAME "usr-eeprom"
150#define BSP_I2C_DS1621_NAME "ds1621"
151#define BSP_I2C_THM_NAME BSP_I2C_DS1621_NAME
152#define BSP_I2C_DS1621_RAW_NAME "ds1621-raw"
153
154#define BSP_I2C_VPD_EEPROM_DEV_NAME (BSP_I2C_BUS0_NAME ", " BSP_I2C_VPD_EEPROM_NAME)
155#define BSP_I2C_USR_EEPROM_DEV_NAME (BSP_I2C_BUS0_NAME ", " BSP_I2C_USR_EEPROM_NAME)
156#define BSP_I2C_DS1621_DEV_NAME (BSP_I2C_BUS0_NAME ", " BSP_I2C_DS1621_NAME)
157#define BSP_I2C_THM_DEV_NAME BSP_I2C_DS1621_DEV_NAME
158#define BSP_I2C_DS1621_RAW_DEV_NAME (BSP_I2C_BUS0_NAME ", " BSP_I2C_DS1621_RAW_NAME)
159
160
161/* Initialize the I2C driver and register all devices
162 * RETURNS 0 on success, -1 on error.
163 *
164 * Access to the VPD and user EEPROMS as well
165 * as the ds1621 temperature sensor is possible
166 * by means of file nodes
167 *
168 * /dev/i2c0.vpd-eeprom (read-only)
169 * /dev/i2c0.usr-eeprom (read-write)
170 * /dev/i2c0.ds1621 (read-only; one byte: board-temp in degC)
171 * /dev/i2c0.ds1621-raw (read-write; transfer bytes to/from the ds1621)
172 */
173int BSP_i2c_initialize(void);
174
175/* Networking; */
176#include <bsp/bsp_bsdnet_attach.h>
177int rtems_em_attach(struct rtems_bsdnet_ifconfig *, int);
178int rtems_dec21140_driver_attach(struct rtems_bsdnet_ifconfig *, int);
179int rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *, int);
180
181/* NOT FOR PUBLIC USE BELOW HERE */
182#define BSP_PCI_HOSE0_MEM_BASE 0x80000000 /* must be aligned to size */
183#define BSP_PCI_HOSE0_MEM_SIZE 0x20000000
184
185#define BSP_PCI_HOSE1_MEM_BASE 0xe0000000
186
187#define BSP_DEV_AND_PCI_IO_BASE 0xf0000000
188#define BSP_DEV_AND_PCI_IO_SIZE 0x10000000
189
190/* maintain coherency between CPU and GT64340 Ethernet
191 * (andpossibly other Discovery components).
192 */
193#define BSP_RW_PAGE_ATTRIBUTES TRIV121_ATTR_M
194
195extern unsigned BSP_pci_hose1_bus_base;
196
197void BSP_pci_initialize(void);
198
199/* Exception Handling */
200
201/* Use a task notepad to attach user exception handler info;
202 * may be changed by application startup code (EPICS uses 11)
203 */
204#define BSP_EXCEPTION_NOTEPAD 14
205
206#ifndef ASM
207
208#define outport_byte(port,value) outb(value,port)
209#define outport_word(port,value) outw(value,port)
210#define outport_long(port,value) outl(value,port)
211
212#define inport_byte(port,value) (value = inb(port))
213#define inport_word(port,value) (value = inw(port))
214#define inport_long(port,value) (value = inl(port))
215/*
216 * Vital Board data Start using DATA RESIDUAL
217 */
218/*
219 * Total memory using RESIDUAL DATA
220 */
221extern unsigned int BSP_mem_size;
222/*
223 * Start of the heap
224 */
225extern unsigned int BSP_heap_start;
226/*
227 * PCI Bus Frequency
228 */
229extern unsigned int BSP_bus_frequency;
230/*
231 * processor clock frequency
232 */
233extern unsigned int BSP_processor_frequency;
234/*
235 * Time base divisior (how many tick for 1 second).
236 */
237extern unsigned int BSP_time_base_divisor;
238
239extern char BSP_productIdent[20];
240extern char BSP_serialNumber[20];
241
242extern char BSP_enetAddr0[7];
243extern char BSP_enetAddr1[7];
244
245/*
246 * The commandline as passed from the bootloader.
247 */
248extern char *BSP_commandline_string;
249
250
251#define BSP_Convert_decrementer( _value ) \
252 ((unsigned long long) ((((unsigned long long)BSP_time_base_divisor) * 1000000ULL) /((unsigned long long) BSP_bus_frequency)) * ((unsigned long long) (_value)))
253
254extern int BSP_disconnect_clock_handler (void);
255extern int BSP_connect_clock_handler (void);
256
257/* clear hostbridge errors
258 *
259 * enableMCP: whether to enable MCP checkstop / machine check interrupts
260 * on the hostbridge and in HID0.
261 *
262 * NOTE: The 5500 and 6100 boards have NO PHYSICAL CONNECTION
263 * to MCP so 'enableMCP' will always fail!
264 *
265 * quiet : be silent
266 *
267 * RETURNS : PCI status (hose 0 in byte 0, host 1 in byte 1) and
268 * VME bridge status (upper 16 bits).
269 * Zero if no errors were found.
270 */
271extern unsigned long _BSP_clear_hostbridge_errors(int enableMCP, int quiet);
272
273/* clear vme bridge errors and return (bridge-dependent) 16-bit status
274 *
275 * quiet : be silent
276 *
277 * RETURNS : 0 if there were no errors, non-zero, bridge-dependent
278 * 16-bit error status on error.
279 *
280 */
281extern unsigned short (*_BSP_clear_vmebridge_errors)(int);
282
283/*
284 * Prototypes for debug helpers
285 */
286void discovery_pic_set_debug_irq(int on);
287void discovery_pic_install_debug_irq(void);
288
289/*
290 * Prototypes for methods called only from .S for dependency tracking
291 */
292char *save_boot_params(
293 void *r3,
294 void *r4,
295 void *r5,
296 char *cmdline_start,
297 char *cmdline_end
298);
299void zero_bss(void);
300
301/*
302 * Prototypes for methods in the BSP that cross file boundaries
303 */
304uint32_t probeMemoryEnd(void);
305
306#endif
307
308#ifdef __cplusplus
309}
310#endif
311
312#endif /* !ASM */
313
316#endif
PowerPC Exceptions API.
This header file provides the default definition of BSP_INITIAL_EXTENSION.
This header file defines the RTEMS Classic API.