xref: /haiku/src/system/kernel/arch/riscv64/arch_system_info.cpp (revision ae5abb58266fba43b3479995388d13e92013e08f)
1 /*
2  * Copyright 2007, Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  * 		François Revol <revol@free.fr>
7  *
8  * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
9  * All rights reserved. Distributed under the terms of the MIT License.
10  */
11 
12 #include <OS.h>
13 
14 #include <arch_cpu.h>
15 #include <arch/system_info.h>
16 #include <boot/kernel_args.h>
17 
18 
19 static uint64 sCPUClockFrequency;
20 static uint64 sBusClockFrequency;
21 static uint16 sCPURevision;
22 
23 
24 void
25 arch_fill_topology_node(cpu_topology_node_info* node, int32 cpu)
26 {
27 	switch (node->type) {
28 		case B_TOPOLOGY_ROOT:
29 			node->data.root.platform = B_CPU_RISC_V;
30 			break;
31 
32 		case B_TOPOLOGY_PACKAGE:
33 			node->data.package.vendor = B_CPU_VENDOR_UNKNOWN;
34 			node->data.package.cache_line_size = CACHE_LINE_SIZE;
35 			break;
36 
37 		case B_TOPOLOGY_CORE:
38 			node->data.core.model = 0;
39 			node->data.core.default_frequency = sCPUClockFrequency;
40 			break;
41 
42 		default:
43 			break;
44 	}
45 }
46 
47 
48 status_t
49 arch_system_info_init(struct kernel_args *args)
50 {
51 	#warning IMPLEMENT arch_system_info_init clock frequency
52 	sCPUClockFrequency = 1000000000;
53 	return B_OK;
54 }
55 
56 
57 status_t
58 arch_get_frequency(uint64 *frequency, int32 cpu)
59 {
60 	*frequency = sCPUClockFrequency;
61 	return B_OK;
62 }
63