1 | /* |
---|
2 | * bsp.h -- contain BSP API definition. |
---|
3 | * |
---|
4 | * Copyright (C) 1999 Eric Valette. valette@crf.canon.fr |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in found in the file LICENSE in this distribution or at |
---|
8 | * http://www.rtems.com/license/LICENSE. |
---|
9 | * |
---|
10 | * $Id$ |
---|
11 | */ |
---|
12 | #ifndef _BSP_H |
---|
13 | #define _BSP_H |
---|
14 | |
---|
15 | #include <bspopts.h> |
---|
16 | |
---|
17 | #include <rtems.h> |
---|
18 | #include <rtems/console.h> |
---|
19 | #include <libcpu/io.h> |
---|
20 | #include <rtems/clockdrv.h> |
---|
21 | #include <bsp/vectors.h> |
---|
22 | |
---|
23 | /* |
---|
24 | * confdefs.h overrides for this BSP: |
---|
25 | * - termios serial ports (defaults to 1) |
---|
26 | * - Interrupt stack space is not minimum if defined. |
---|
27 | */ |
---|
28 | |
---|
29 | #if !defined(mvme2100) |
---|
30 | #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 |
---|
31 | #endif |
---|
32 | |
---|
33 | #define CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK |
---|
34 | |
---|
35 | |
---|
36 | /* |
---|
37 | * diagram illustrating the role of the configuration |
---|
38 | * constants |
---|
39 | * PCI_MEM_WIN0: CPU starting addr where PCI memory space is visible |
---|
40 | * PCI_MEM_BASE: CPU address of PCI mem addr. zero. (regardless of this |
---|
41 | * address being 'visible' or not!). |
---|
42 | * _VME_A32_WIN0_ON_PCI: PCI starting addr of the 1st window to VME |
---|
43 | * _VME_A32_WIN0_ON_VME: VME address of that same window |
---|
44 | * |
---|
45 | * AFAIK, only PreP boards have a non-zero PCI_MEM_BASE (i.e., an offset between |
---|
46 | * CPU and PCI addresses). The mvme2300 'ppcbug' firmware configures the PCI |
---|
47 | * bus using PCI base addresses! I.e., drivers need to add PCI_MEM_BASE to |
---|
48 | * the base address read from PCI config.space in order to translate that |
---|
49 | * into a CPU address. |
---|
50 | * |
---|
51 | * NOTE: VME addresses should NEVER be translated using these constants! |
---|
52 | * they are strictly for BSP internal use. Drivers etc. should use |
---|
53 | * the translation routines int VME.h (BSP_vme2local_adrs/BSP_local2vme_adrs). |
---|
54 | * |
---|
55 | * CPU ADDR PCI_ADDR VME ADDR |
---|
56 | * |
---|
57 | * 00000000 XXXXXXXX XXXXXXXX |
---|
58 | * ^ ^ ........ |
---|
59 | * | | |
---|
60 | * | | e.g., RAM XXXXXXXX |
---|
61 | * | | 00000000 |
---|
62 | * | | ......... ^ |
---|
63 | * | | (possible offset | |
---|
64 | * | | between pci and XXXXXXXX | ...... |
---|
65 | * | | cpu addresses) | |
---|
66 | * | v | |
---|
67 | * | PCI_MEM_BASE -------------> 00000000 --------------- | |
---|
68 | * | ........ ........ ^ | |
---|
69 | * | invisible | | |
---|
70 | * | ........ from CPU | | |
---|
71 | * v | | |
---|
72 | * PCI_MEM_WIN0 ============= first visible PCI addr | | |
---|
73 | * | | |
---|
74 | * pci devices pci window | | |
---|
75 | * visible here v v |
---|
76 | * mapped by ========== _VME_A32_WIN0_ON_PCI ======= _VME_A32_WIN0_ON_VME |
---|
77 | * vme window |
---|
78 | * VME devices hostbridge mapped by |
---|
79 | * visible here universe |
---|
80 | * ===================================================== |
---|
81 | * |
---|
82 | */ |
---|
83 | |
---|
84 | /* fundamental addresses for BSP (CHRPxxx and PREPxxx are from libcpu/io.h) */ |
---|
85 | #if defined(mvme2100) |
---|
86 | #define _IO_BASE CHRP_ISA_IO_BASE |
---|
87 | #define _ISA_MEM_BASE CHRP_ISA_MEM_BASE |
---|
88 | /* address of our ram on the PCI bus */ |
---|
89 | #define PCI_DRAM_OFFSET CHRP_PCI_DRAM_OFFSET |
---|
90 | /* offset of pci memory as seen from the CPU */ |
---|
91 | #define PCI_MEM_BASE 0 |
---|
92 | /* where (in CPU addr. space) does the PCI window start */ |
---|
93 | #define PCI_MEM_WIN0 0x80000000 |
---|
94 | |
---|
95 | #else |
---|
96 | #define _IO_BASE PREP_ISA_IO_BASE |
---|
97 | #define _ISA_MEM_BASE PREP_ISA_MEM_BASE |
---|
98 | /* address of our ram on the PCI bus */ |
---|
99 | #define PCI_DRAM_OFFSET PREP_PCI_DRAM_OFFSET |
---|
100 | /* offset of pci memory as seen from the CPU */ |
---|
101 | #define PCI_MEM_BASE PREP_ISA_MEM_BASE |
---|
102 | #define PCI_MEM_WIN0 0 |
---|
103 | #endif |
---|
104 | |
---|
105 | |
---|
106 | /* |
---|
107 | * Base address definitions for several devices |
---|
108 | * |
---|
109 | * MVME2100 is very similar but has fewer devices and uses on-CPU EPIC |
---|
110 | * implementation of OpenPIC controller. It also cannot be probed to |
---|
111 | * find out what it is which is VERY different from other Motorola boards. |
---|
112 | */ |
---|
113 | |
---|
114 | #if defined(mvme2100) |
---|
115 | #define BSP_UART_IOBASE_COM1 ((_IO_BASE)+0x01e10000) |
---|
116 | /* #define BSP_UART_IOBASE_COM1 (0xffe10000) */ |
---|
117 | #define BSP_OPEN_PIC_BASE_OFFSET 0x40000 |
---|
118 | |
---|
119 | #define MVME_HAS_DEC21140 |
---|
120 | #else |
---|
121 | #define BSP_UART_IOBASE_COM1 ((_IO_BASE)+0x3f8) |
---|
122 | #define BSP_UART_IOBASE_COM2 ((_IO_BASE)+0x2f8) |
---|
123 | |
---|
124 | #define BSP_KBD_IOBASE ((_IO_BASE)+0x60) |
---|
125 | #define BSP_VGA_IOBASE ((_IO_BASE)+0x3c0) |
---|
126 | |
---|
127 | #if defined(mvme2300) |
---|
128 | #define MVME_HAS_DEC21140 |
---|
129 | #endif |
---|
130 | #endif |
---|
131 | |
---|
132 | #define BSP_CONSOLE_PORT BSP_UART_COM1 |
---|
133 | #define BSP_UART_BAUD_BASE 115200 |
---|
134 | |
---|
135 | #include <bsp/openpic.h> |
---|
136 | /* BSP_PIC_DO_EOI is optionally used by the 'vmeUniverse' driver |
---|
137 | * to implement VME IRQ priorities in software. |
---|
138 | * Note that this requires support by the interrupt controller |
---|
139 | * driver (cf. libbsp/shared/powerpc/irq/openpic_i8259_irq.c) |
---|
140 | * and the BSP-specific universe initialization/configuration |
---|
141 | * (cf. libbsp/shared/powerpc/vme/VMEConfig.h vme_universe.c) |
---|
142 | * |
---|
143 | * ********* IMPORTANT NOTE ******** |
---|
144 | * When deriving from this file (new BSPs) |
---|
145 | * DO NOT define "BSP_PIC_DO_EOI" if you don't know what |
---|
146 | * you are doing i.e., w/o implementing the required pieces |
---|
147 | * mentioned above. |
---|
148 | * ********* IMPORTANT NOTE ******** |
---|
149 | */ |
---|
150 | #define BSP_PIC_DO_EOI openpic_eoi(0) |
---|
151 | |
---|
152 | #ifndef ASM |
---|
153 | #define outport_byte(port,value) outb(value,port) |
---|
154 | #define outport_word(port,value) outw(value,port) |
---|
155 | #define outport_long(port,value) outl(value,port) |
---|
156 | |
---|
157 | #define inport_byte(port,value) (value = inb(port)) |
---|
158 | #define inport_word(port,value) (value = inw(port)) |
---|
159 | #define inport_long(port,value) (value = inl(port)) |
---|
160 | |
---|
161 | /* |
---|
162 | * Vital Board data Start using DATA RESIDUAL |
---|
163 | */ |
---|
164 | |
---|
165 | /* |
---|
166 | * Total memory using RESIDUAL DATA |
---|
167 | */ |
---|
168 | extern unsigned int BSP_mem_size; |
---|
169 | /* |
---|
170 | * Start of the heap |
---|
171 | */ |
---|
172 | extern unsigned int BSP_heap_start; |
---|
173 | /* |
---|
174 | * PCI Bus Frequency |
---|
175 | */ |
---|
176 | extern unsigned int BSP_bus_frequency; |
---|
177 | /* |
---|
178 | * processor clock frequency |
---|
179 | */ |
---|
180 | extern unsigned int BSP_processor_frequency; |
---|
181 | /* |
---|
182 | * Time base divisior (how many tick for 1 second). |
---|
183 | */ |
---|
184 | extern unsigned int BSP_time_base_divisor; |
---|
185 | |
---|
186 | /* |
---|
187 | * String passed by the bootloader. |
---|
188 | */ |
---|
189 | extern char *BSP_commandline_string; |
---|
190 | |
---|
191 | #define BSP_Convert_decrementer( _value ) \ |
---|
192 | ((unsigned long long) ((((unsigned long long)BSP_time_base_divisor) * 1000000ULL) /((unsigned long long) BSP_bus_frequency)) * ((unsigned long long) (_value))) |
---|
193 | |
---|
194 | extern void BSP_panic(char *s); |
---|
195 | /* extern int printk(const char *, ...) __attribute__((format(printf, 1, 2))); */ |
---|
196 | extern int BSP_disconnect_clock_handler (void); |
---|
197 | extern int BSP_connect_clock_handler (void); |
---|
198 | |
---|
199 | /* clear hostbridge errors |
---|
200 | * |
---|
201 | * NOTE: The routine returns always (-1) if 'enableMCP==1' |
---|
202 | * [semantics needed by libbspExt] if the MCP input is not wired. |
---|
203 | * It returns and clears the error bits of the PCI status register. |
---|
204 | * MCP support is disabled because: |
---|
205 | * a) the 2100 has no raven chip |
---|
206 | * b) the raven (2300) would raise machine check interrupts |
---|
207 | * on PCI config space access to empty slots. |
---|
208 | */ |
---|
209 | extern unsigned long _BSP_clear_hostbridge_errors(int enableMCP, int quiet); |
---|
210 | |
---|
211 | #endif |
---|
212 | |
---|
213 | #endif |
---|