1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * This file contains the bsp_start() method and support. |
---|
5 | */ |
---|
6 | |
---|
7 | /* |
---|
8 | * COPYRIGHT (c) 1989-2012. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.org/license/LICENSE. |
---|
14 | */ |
---|
15 | |
---|
16 | #include <bsp.h> |
---|
17 | #include <libcpu/isr_entries.h> |
---|
18 | #include <bsp/bootcard.h> |
---|
19 | #include <rtems/pci.h> |
---|
20 | #include <bsp/irq-generic.h> |
---|
21 | #include <bsp/i8259.h> |
---|
22 | |
---|
23 | /* |
---|
24 | * STRUCTURES |
---|
25 | */ |
---|
26 | |
---|
27 | /* Structure filled in by get_mem_info. Only the size field is |
---|
28 | * actually used (to clear bss), so the others aren't even filled in. |
---|
29 | */ |
---|
30 | struct s_mem |
---|
31 | { |
---|
32 | unsigned int size; |
---|
33 | unsigned int icsize; |
---|
34 | unsigned int dcsize; |
---|
35 | }; |
---|
36 | |
---|
37 | |
---|
38 | /* |
---|
39 | * GLOBALS |
---|
40 | */ |
---|
41 | uint32_t bsp_clicks_per_microsecond; |
---|
42 | |
---|
43 | |
---|
44 | /* |
---|
45 | * PROTOTYPES |
---|
46 | */ |
---|
47 | void clear_cache( void *address, size_t n ); |
---|
48 | void get_mem_info( struct s_mem *mem ); |
---|
49 | |
---|
50 | /* |
---|
51 | * EXTERNs |
---|
52 | */ |
---|
53 | extern int RamSize; |
---|
54 | |
---|
55 | /* |
---|
56 | * bsp_start |
---|
57 | * |
---|
58 | * This routine does the bulk of the system initialization. |
---|
59 | */ |
---|
60 | void bsp_start( void ) |
---|
61 | { |
---|
62 | /* uint32_t board_ID = 0x420; */ |
---|
63 | static int j = 1; |
---|
64 | int pci_init_retval; |
---|
65 | |
---|
66 | /* |
---|
67 | * Note: This is the value that works for qemu, and it was |
---|
68 | * unable to be validated on the actual hardware. |
---|
69 | */ |
---|
70 | mips_set_sr( 0x04100000 ); |
---|
71 | |
---|
72 | bsp_interrupt_initialize(); |
---|
73 | |
---|
74 | /* |
---|
75 | * XXX need to figure out a real value. :) |
---|
76 | * This works for the qemu simulation, but timeing may |
---|
77 | * be off for the actual hardware. |
---|
78 | */ |
---|
79 | bsp_clicks_per_microsecond = 100; |
---|
80 | |
---|
81 | #if 1 |
---|
82 | while ( j != 1 ) { |
---|
83 | int i; |
---|
84 | printk ("."); |
---|
85 | for (i=0; i<1000; i++); |
---|
86 | } |
---|
87 | #endif |
---|
88 | |
---|
89 | /* |
---|
90 | * init PCI Bios interface... |
---|
91 | */ |
---|
92 | pci_init_retval = pci_initialize(); |
---|
93 | if (pci_init_retval != PCIB_ERR_SUCCESS) { |
---|
94 | printk("PCI bus: could not initialize PCI BIOS interface\n"); |
---|
95 | } |
---|
96 | |
---|
97 | BSP_i8259s_init(); |
---|
98 | |
---|
99 | } |
---|
100 | |
---|
101 | /* |
---|
102 | * Required routine by some gcc run-times. |
---|
103 | */ |
---|
104 | void clear_cache( void *address, size_t n ) |
---|
105 | { |
---|
106 | } |
---|
107 | |
---|
108 | void get_mem_info( |
---|
109 | struct s_mem *mem |
---|
110 | ) |
---|
111 | { |
---|
112 | mem->size = (int) (&RamSize); /* Normally 128 or 256 MB */ |
---|
113 | } |
---|