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