5a7d06d26e2fc94d851ecd4ce9034ee79cffcbb9
[coreboot.git] / src / arch / ppc / boot / boot.c
1 #include <ip_checksum.h>
2 #include <boot/elf.h>
3 #include <boot/elf_boot.h>
4 #include <string.h>
5 #include <console/console.h>
6
7 extern void flush_dcache(void);
8
9 int elf_check_arch(Elf_ehdr *ehdr)
10 {
11         return (
12                 (ehdr->e_machine == EM_PPC) &&
13                 (ehdr->e_ident[EI_CLASS] == ELFCLASS32) &&
14                 (ehdr->e_ident[EI_DATA] == ELFDATA2MSB) 
15                 );
16         
17 }
18
19 void jmp_to_elf_entry(void *entry, unsigned long buffer)
20 {
21         void (*kernel_entry)(void);       
22
23         kernel_entry = entry;
24
25         /*
26          * Kernel will invalidate and disable dcache immediately on
27          * entry. This is bad if we've been using it, which we
28          * have. Make sure it is flushed to memory.
29          */
30         flush_dcache();
31
32         /* On ppc we don't currently support loading over LinuxBIOS.
33          * So ignore the buffer.
34          */
35
36         /* Jump to kernel */
37         kernel_entry();
38 }