Rev 4347 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4347 | Rev 4348 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | */ |
33 | */ |
34 | 34 | ||
35 | #include <config.h> |
35 | #include <config.h> |
36 | #include <arch.h> |
36 | #include <arch.h> |
37 | #include <arch/boot/boot.h> |
37 | #include <arch/boot/boot.h> |
38 | #include <arch/drivers/cuda.h> |
38 | #include <genarch/drivers/via-cuda/cuda.h> |
39 | #include <arch/interrupt.h> |
39 | #include <arch/interrupt.h> |
40 | #include <genarch/fb/fb.h> |
40 | #include <genarch/fb/fb.h> |
41 | #include <genarch/fb/visuals.h> |
41 | #include <genarch/fb/visuals.h> |
42 | #include <userspace.h> |
42 | #include <userspace.h> |
43 | #include <proc/uarg.h> |
43 | #include <proc/uarg.h> |
44 | #include <console/console.h> |
44 | #include <console/console.h> |
45 | #include <ddi/irq.h> |
45 | #include <ddi/irq.h> |
46 | #include <arch/drivers/pic.h> |
46 | #include <arch/drivers/pic.h> |
- | 47 | #include <align.h> |
|
47 | #include <macros.h> |
48 | #include <macros.h> |
48 | #include <string.h> |
49 | #include <string.h> |
49 | 50 | ||
50 | #define IRQ_COUNT 64 |
51 | #define IRQ_COUNT 64 |
- | 52 | #define IRQ_CUDA 10 |
|
51 | 53 | ||
52 | bootinfo_t bootinfo; |
54 | bootinfo_t bootinfo; |
53 | 55 | ||
54 | /** Performs ppc32-specific initialization before main_bsp() is called. */ |
56 | /** Performs ppc32-specific initialization before main_bsp() is called. */ |
55 | void arch_pre_main(void) |
57 | void arch_pre_main(void) |
Line 59... | Line 61... | ||
59 | uint32_t i; |
61 | uint32_t i; |
60 | 62 | ||
61 | for (i = 0; i < min3(bootinfo.taskmap.count, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); i++) { |
63 | for (i = 0; i < min3(bootinfo.taskmap.count, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); i++) { |
62 | init.tasks[i].addr = PA2KA(bootinfo.taskmap.tasks[i].addr); |
64 | init.tasks[i].addr = PA2KA(bootinfo.taskmap.tasks[i].addr); |
63 | init.tasks[i].size = bootinfo.taskmap.tasks[i].size; |
65 | init.tasks[i].size = bootinfo.taskmap.tasks[i].size; |
64 | strncpy(init.tasks[i].name, bootinfo.taskmap.tasks[i].name, |
66 | str_cpy(init.tasks[i].name, CONFIG_TASK_NAME_BUFLEN, |
65 | CONFIG_TASK_NAME_BUFLEN); |
67 | bootinfo.taskmap.tasks[i].name); |
66 | } |
68 | } |
67 | } |
69 | } |
68 | 70 | ||
69 | void arch_pre_mm_init(void) |
71 | void arch_pre_mm_init(void) |
70 | { |
72 | { |
Line 115... | Line 117... | ||
115 | /* Initialize IRQ routing */ |
117 | /* Initialize IRQ routing */ |
116 | irq_init(IRQ_COUNT, IRQ_COUNT); |
118 | irq_init(IRQ_COUNT, IRQ_COUNT); |
117 | 119 | ||
118 | if (bootinfo.macio.addr) { |
120 | if (bootinfo.macio.addr) { |
119 | /* Initialize PIC */ |
121 | /* Initialize PIC */ |
- | 122 | cir_t cir; |
|
- | 123 | void *cir_arg; |
|
120 | pic_init(bootinfo.macio.addr, PAGE_SIZE); |
124 | pic_init(bootinfo.macio.addr, PAGE_SIZE, &cir, &cir_arg); |
- | 125 | ||
- | 126 | #ifdef CONFIG_VIA_CUDA |
|
- | 127 | uintptr_t pa = bootinfo.macio.addr + 0x16000; |
|
- | 128 | uintptr_t aligned_addr = ALIGN_DOWN(pa, PAGE_SIZE); |
|
- | 129 | size_t offset = pa - aligned_addr; |
|
- | 130 | size_t size = 2 * PAGE_SIZE; |
|
- | 131 | ||
- | 132 | cuda_t *cuda = (cuda_t *) |
|
- | 133 | (hw_map(aligned_addr, offset + size) + offset); |
|
121 | 134 | ||
122 | /* Initialize I/O controller */ |
135 | /* Initialize I/O controller */ |
- | 136 | cuda_instance_t *cuda_instance = |
|
123 | cuda_init(bootinfo.macio.addr + 0x16000, 2 * PAGE_SIZE); |
137 | cuda_init(cuda, IRQ_CUDA, cir, cir_arg); |
- | 138 | if (cuda_instance) { |
|
- | 139 | indev_t *sink = stdin_wire(); |
|
- | 140 | cuda_wire(cuda_instance, sink); |
|
- | 141 | } |
|
- | 142 | #endif |
|
124 | } |
143 | } |
125 | 144 | ||
126 | /* Merge all zones to 1 big zone */ |
145 | /* Merge all zones to 1 big zone */ |
127 | zone_merge_all(); |
146 | zone_merge_all(); |
128 | } |
147 | } |
Line 184... | Line 203... | ||
184 | void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller) |
203 | void *arch_construct_function(fncptr_t *fptr, void *addr, void *caller) |
185 | { |
204 | { |
186 | return addr; |
205 | return addr; |
187 | } |
206 | } |
188 | 207 | ||
- | 208 | void arch_reboot(void) |
|
- | 209 | { |
|
- | 210 | // TODO |
|
- | 211 | while (1); |
|
- | 212 | } |
|
- | 213 | ||
189 | /** @} |
214 | /** @} |
190 | */ |
215 | */ |