1 | /* |
---|
2 | * Copyright (C) 1999 Eric Valette. valette@crf.canon.fr |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * http://www.rtems.org/license/LICENSE. |
---|
7 | * |
---|
8 | * (C) S. Kate Feng 2003-2007 : Modified it to support the mvme5500 BSP. |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef LIBBSP_POWERPC_MVME5500_BSP_H |
---|
12 | #define LIBBSP_POWERPC_MVME5500_BSP_H |
---|
13 | |
---|
14 | #ifndef ASM |
---|
15 | |
---|
16 | #include <bspopts.h> |
---|
17 | #include <bsp/default-initial-extension.h> |
---|
18 | |
---|
19 | #include <rtems.h> |
---|
20 | #include <libcpu/io.h> |
---|
21 | #include <bsp/vectors.h> |
---|
22 | |
---|
23 | /* Board type */ |
---|
24 | typedef enum { |
---|
25 | undefined = 0, |
---|
26 | MVME5500, |
---|
27 | MVME6100 |
---|
28 | } BSP_BoardTypes; |
---|
29 | |
---|
30 | BSP_BoardTypes BSP_getBoardType(void); |
---|
31 | |
---|
32 | /* Board type */ |
---|
33 | typedef enum { |
---|
34 | Undefined, |
---|
35 | UNIVERSE2, |
---|
36 | TSI148, |
---|
37 | } BSP_VMEchipTypes; |
---|
38 | |
---|
39 | BSP_VMEchipTypes BSP_getVMEchipType(void); |
---|
40 | |
---|
41 | /* The version of Discovery system controller */ |
---|
42 | |
---|
43 | typedef enum { |
---|
44 | notdefined, |
---|
45 | GT64260A, |
---|
46 | GT64260B, |
---|
47 | MV64360, |
---|
48 | } DiscoveryChipVersion; |
---|
49 | |
---|
50 | DiscoveryChipVersion BSP_getDiscoveryChipVersion(void); |
---|
51 | |
---|
52 | #define _256M 0x10000000 |
---|
53 | #define _512M 0x20000000 |
---|
54 | |
---|
55 | #define GT64x60_REG_BASE 0xf1000000 /* Base of GT64260 Reg Space */ |
---|
56 | #define GT64x60_REG_SPACE_SIZE 0x10000 /* 64Kb Internal Reg Space */ |
---|
57 | |
---|
58 | #define GT64x60_DEV1_BASE 0xf1100000 /* Device bank1(chip select 1) base |
---|
59 | */ |
---|
60 | #define GT64260_DEV1_SIZE 0x00100000 /* Device bank size */ |
---|
61 | |
---|
62 | /* fundamental addresses for this BSP (PREPxxx are from libcpu/io.h) */ |
---|
63 | #define _IO_BASE GT64x60_REG_BASE |
---|
64 | |
---|
65 | #define BSP_NVRAM_BASE_ADDR 0xf1110000 |
---|
66 | |
---|
67 | #define BSP_RTC_INTA_REG 0x7ff0 |
---|
68 | #define BSP_RTC_SECOND 0x7ff2 |
---|
69 | #define BSP_RTC_MINUTE 0x7ff3 |
---|
70 | #define BSP_RTC_HOUR 0x7ff4 |
---|
71 | #define BSP_RTC_DATE 0x7ff5 |
---|
72 | #define BSP_RTC_INTERRUPTS 0x7ff6 |
---|
73 | #define BSP_RTC_WATCHDOG 0x7ff7 |
---|
74 | |
---|
75 | /* PCI0 Domain I/O space */ |
---|
76 | #define PCI0_IO_BASE 0xf0000000 |
---|
77 | #define PCI1_IO_BASE 0xf0800000 |
---|
78 | |
---|
79 | /* PCI 0 memory space as seen from the CPU */ |
---|
80 | #define PCI0_MEM_BASE 0x80000000 |
---|
81 | #define PCI_MEM_BASE 0 /* glue for vmeUniverse */ |
---|
82 | #define PCI_MEM_BASE_ADJUSTMENT 0 |
---|
83 | |
---|
84 | /* address of our ram on the PCI bus */ |
---|
85 | #define PCI_DRAM_OFFSET 0 |
---|
86 | |
---|
87 | /* PCI 1 memory space as seen from the CPU */ |
---|
88 | #define PCI1_MEM_BASE 0xe0000000 |
---|
89 | #define PCI1_MEM_SIZE 0x10000000 |
---|
90 | |
---|
91 | /* Needed for hot adding via PMCspan on the PCI0 local bus. |
---|
92 | * This is board dependent, only because mvme5500 |
---|
93 | * supports hot adding and has more than one local PCI |
---|
94 | * bus. |
---|
95 | */ |
---|
96 | #define BSP_MAX_PCI_BUS_ON_PCI0 8 |
---|
97 | #define BSP_MAX_PCI_BUS_ON_PCI1 2 |
---|
98 | #define BSP_MAX_PCI_BUS (BSP_MAX_PCI_BUS_ON_PCI0+BSP_MAX_PCI_BUS_ON_PCI1) |
---|
99 | |
---|
100 | |
---|
101 | /* The glues to Till's vmeUniverse, although the name does not |
---|
102 | * actually reflect the relevant architect of the MVME5500. |
---|
103 | */ |
---|
104 | #define BSP_PCI_IRQ0 BSP_GPP_IRQ_LOWEST_OFFSET |
---|
105 | |
---|
106 | /* |
---|
107 | * confdefs.h overrides for this BSP: |
---|
108 | * - Interrupt stack space is not minimum if defined. |
---|
109 | */ |
---|
110 | #define BSP_INTERRUPT_STACK_SIZE (16 * 1024) /* <skf> 2/09 wants it to be adjustable by BSP */ |
---|
111 | |
---|
112 | /* uart.c uses out_8 instead of outb */ |
---|
113 | #define BSP_UART_IOBASE_COM1 GT64x60_DEV1_BASE + 0x20000 |
---|
114 | #define BSP_UART_IOBASE_COM2 GT64x60_DEV1_BASE + 0x21000 |
---|
115 | |
---|
116 | #define BSP_CONSOLE_PORT BSP_UART_COM1 /* console */ |
---|
117 | #define BSP_UART_BAUD_BASE 115200 |
---|
118 | |
---|
119 | /* |
---|
120 | * Total memory using RESIDUAL DATA |
---|
121 | */ |
---|
122 | extern unsigned int BSP_mem_size; |
---|
123 | /* |
---|
124 | * PCI Bus Frequency |
---|
125 | */ |
---|
126 | extern unsigned int BSP_bus_frequency; |
---|
127 | /* |
---|
128 | * processor clock frequency |
---|
129 | */ |
---|
130 | extern unsigned int BSP_processor_frequency; |
---|
131 | /* |
---|
132 | * Time base divisior (how many tick for 1 second). |
---|
133 | */ |
---|
134 | extern unsigned int BSP_time_base_divisor; |
---|
135 | |
---|
136 | #define BSP_Convert_decrementer( _value ) \ |
---|
137 | ((unsigned long long) ((((unsigned long long)BSP_time_base_divisor) * 1000000ULL) /((unsigned long long) BSP_bus_frequency)) * ((unsigned long long) (_value))) |
---|
138 | |
---|
139 | extern void bsp_reset(void); |
---|
140 | /* extern int printk(const char *, ...) __attribute__((format(printf, 1, 2))); */ |
---|
141 | extern int BSP_disconnect_clock_handler(void); |
---|
142 | extern int BSP_connect_clock_handler(void); |
---|
143 | |
---|
144 | unsigned long _BSP_clear_hostbridge_errors(int enableMCP, int quiet); |
---|
145 | |
---|
146 | /* |
---|
147 | * Prototypes for methods called only from .S for dependency tracking |
---|
148 | */ |
---|
149 | char *save_boot_params( |
---|
150 | void *r3, |
---|
151 | void *r4, |
---|
152 | void *r5, |
---|
153 | char *cmdline_start, |
---|
154 | char *cmdline_end |
---|
155 | ); |
---|
156 | void zero_bss(void); |
---|
157 | |
---|
158 | /* |
---|
159 | * Prototypes for methods in the BSP that cross file boundaries |
---|
160 | */ |
---|
161 | uint32_t probeMemoryEnd(void); |
---|
162 | void pci_interface(void); |
---|
163 | void BSP_printPicIsrTbl(void); |
---|
164 | int I2Cread_eeprom( |
---|
165 | unsigned char I2cBusAddr, |
---|
166 | uint32_t devA2A1A0, |
---|
167 | uint32_t AddrBytes, |
---|
168 | unsigned char *pBuff, |
---|
169 | uint32_t numBytes |
---|
170 | ); |
---|
171 | |
---|
172 | #if 0 |
---|
173 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "gt1" |
---|
174 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_GT64260eth_driver_attach |
---|
175 | #else |
---|
176 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "wmG1" |
---|
177 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_i82544EI_driver_attach |
---|
178 | #endif |
---|
179 | |
---|
180 | extern int RTEMS_BSP_NETWORK_DRIVER_ATTACH(); |
---|
181 | |
---|
182 | #define gccMemBar() RTEMS_COMPILER_MEMORY_BARRIER() |
---|
183 | |
---|
184 | static inline void lwmemBar(void) |
---|
185 | { |
---|
186 | __asm__ volatile("lwsync":::"memory"); |
---|
187 | } |
---|
188 | |
---|
189 | static inline void io_flush(void) |
---|
190 | { |
---|
191 | __asm__ volatile("isync":::"memory"); |
---|
192 | } |
---|
193 | |
---|
194 | static inline void memBar(void) |
---|
195 | { |
---|
196 | __asm__ volatile("sync":::"memory"); |
---|
197 | } |
---|
198 | |
---|
199 | static inline void ioBar(void) |
---|
200 | { |
---|
201 | __asm__ volatile("eieio":::"memory"); |
---|
202 | } |
---|
203 | |
---|
204 | #endif |
---|
205 | |
---|
206 | #endif /* !ASM */ |
---|