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_platform.h>
16#include <arch/system_info.h>
17#include <boot/kernel_args.h>
18
19
20static uint64 sCPUClockFrequency;
21static uint64 sBusClockFrequency;
22static uint16 sCPURevision;
23
24
25void
26arch_fill_topology_node(cpu_topology_node_info* node, int32 cpu)
27{
28	switch (node->type) {
29		case B_TOPOLOGY_ROOT:
30			node->data.root.platform = B_CPU_M68K;
31			break;
32
33		case B_TOPOLOGY_PACKAGE:
34			node->data.package.vendor = B_CPU_VENDOR_MOTOROLA;
35			node->data.package.cache_line_size = CACHE_LINE_SIZE;
36			break;
37
38		case B_TOPOLOGY_CORE:
39			node->data.core.model = sCPURevision;
40			node->data.core.default_frequency = sCPUClockFrequency;
41			break;
42
43		default:
44			break;
45	}
46}
47
48
49status_t
50arch_system_info_init(struct kernel_args *args)
51{
52	sCPUClockFrequency = args->arch_args.cpu_frequency;
53	sBusClockFrequency = args->arch_args.bus_frequency; // not reported anymore?
54
55	sCPURevision = args->arch_args.cpu_type; //TODO:is it what we want?
56#warning M68K: use 060 PCR[15:8]
57
58	return B_OK;
59}
60
61
62status_t
63arch_get_frequency(uint64 *frequency, int32 cpu)
64{
65	*frequency = sCPUClockFrequency;
66	return B_OK;
67}
68