xref: /haiku/src/system/boot/platform/u-boot/cpu.cpp (revision 07b33113a3b3a0e3ace703c48d1ac39faad2c6c0)
1 /*
2  * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * calculate_cpu_conversion_factor() was written by Travis Geiselbrecht and
6  * licensed under the NewOS license.
7  */
8 
9 
10 #include "cpu.h"
11 
12 #include <OS.h>
13 #include <boot/platform.h>
14 #include <boot/stdio.h>
15 #include <boot/kernel_args.h>
16 #include <boot/stage2.h>
17 #include <arch/cpu.h>
18 #include <arch_kernel.h>
19 #include <arch_system_info.h>
20 
21 #include <string.h>
22 
23 
24 //#define TRACE_CPU
25 #ifdef TRACE_CPU
26 #	define TRACE(x) dprintf x
27 #else
28 #	define TRACE(x) ;
29 #endif
30 
31 
32 extern "C" void
33 spin(bigtime_t microseconds)
34 {
35 	#warning U-Boot:TODO!!
36 	// TODO: use API if available
37 
38 	for(bigtime_t i=0;i<microseconds;i=i+1)
39 	{
40 		/*
41 		asm volatile ("mov r0,r0");
42 		asm volatile ("mov r0,r0");
43 		*/
44 	}
45 
46 	// fallback to arch-specific code
47 	//arch_spin(microseconds);
48 }
49 
50 
51 extern "C" void
52 cpu_init()
53 {
54 	gKernelArgs.num_cpus = 1;
55 		// this will eventually be corrected later on
56 
57 	if (boot_arch_cpu_init() != B_OK)
58 		panic("You need a 6502 or higher in order to boot!\n");
59 }
60 
61