hrev53719 adds 1 changeset to branch 'master'
old head: 3c0d65cc3053d382375a364007db5708e074b2cb
new head: 402f5046b08b8c6457d796d725f9bd0c1a08fce5
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=402f5046b08b+%5E3c0d65cc3053
----------------------------------------------------------------------------
402f5046b08b: sparc: boot cpu support
There is no /cpus in the device tree on my machine, the CPUs are instead
directly under the root. So search for them there.
There is also no timebase property, and according to the docs, the
RDTICK instruction just gets CPU clock ticks, so set them to the same
value for now.
The two CPUs in my reference machine are succesfully found now, yay!
Change-Id: I5fbb4cfc98ee3b68cb2aa810816e0054a56d52d0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1483
Reviewed-by: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
[ PulkoMandy <pulkomandy@xxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev53719
Commit: 402f5046b08b8c6457d796d725f9bd0c1a08fce5
URL: https://git.haiku-os.org/haiku/commit/?id=402f5046b08b
Author: PulkoMandy <pulkomandy@xxxxxxxxxxxxx>
Date: Fri May 24 21:12:41 2019 UTC
Committer: Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Fri Jan 17 16:47:41 2020 UTC
----------------------------------------------------------------------------
1 file changed, 6 insertions(+), 22 deletions(-)
.../platform/openfirmware/arch/sparc/cpu.cpp | 28 +++++---------------
----------------------------------------------------------------------------
diff --git a/src/system/boot/platform/openfirmware/arch/sparc/cpu.cpp
b/src/system/boot/platform/openfirmware/arch/sparc/cpu.cpp
index 517c228add..b8fd782078 100644
--- a/src/system/boot/platform/openfirmware/arch/sparc/cpu.cpp
+++ b/src/system/boot/platform/openfirmware/arch/sparc/cpu.cpp
@@ -28,24 +28,16 @@ boot_arch_cpu_init(void)
{
int32 busFrequency = 0;
- int root = of_finddevice("/");
- if (root == OF_FAILED) {
+ intptr_t cpus = of_finddevice("/");
+ if (cpus == OF_FAILED) {
printf("boot_arch_cpu_init(): Failed to open \"/\"!\n");
return B_ERROR;
}
- of_getprop(root, "clock-frequency", &busFrequency, 4);
- // we might find it in /cpus instead
-
- // iterate through the "/cpus" node to find all CPUs
- int cpus = of_finddevice("/cpus");
- if (cpus == OF_FAILED) {
- printf("boot_arch_cpu_init(): Failed to open \"/cpus\"!\n");
- return B_ERROR;
- }
+ of_getprop(cpus, "clock-frequency", &busFrequency, 4);
char cpuPath[256];
- int cookie = 0;
+ intptr_t cookie = 0;
int cpuCount = 0;
while (of_get_next_device(&cookie, cpus, "cpu", cpuPath,
sizeof(cpuPath)) == B_OK) {
@@ -54,7 +46,7 @@ boot_arch_cpu_init(void)
// For the first CPU get the frequencies of CPU, bus, and time
base.
// We assume they are the same for all CPUs.
if (cpuCount == 0) {
- int cpu = of_finddevice(cpuPath);
+ intptr_t cpu = of_finddevice(cpuPath);
if (cpu == OF_FAILED) {
printf("boot_arch_cpu_init: Failed get CPU
device node!\n");
return B_ERROR;
@@ -76,21 +68,13 @@ boot_arch_cpu_init(void)
"frequency!\n");
return B_ERROR;
}
- int32 timeBaseFrequency;
- if (of_getprop(cpu, "timebase-frequency",
&timeBaseFrequency, 4)
- == OF_FAILED) {
- printf("boot_arch_cpu_init: Failed to get time
base "
- "frequency!\n");
- return B_ERROR;
- }
gKernelArgs.arch_args.cpu_frequency = clockFrequency;
gKernelArgs.arch_args.bus_frequency = busFrequency;
- gKernelArgs.arch_args.time_base_frequency =
timeBaseFrequency;
+ gKernelArgs.arch_args.time_base_frequency =
clockFrequency;
TRACE((" CPU clock frequency: %d\n", clockFrequency));
TRACE((" bus clock frequency: %d\n", busFrequency));
- TRACE((" time base frequency: %d\n",
timeBaseFrequency));
}
cpuCount++;