Implemented the PPC specific RTC support. We search for an "rtc"
device in the Open Firmware implementation of boot loader and pass its path to the kernel, where it's opened and used for getting/setting the real time. The expensive atomic_*64() on PPC 32-bit make things a bit more complicated. Moreover, missing 64 bit multiplication and division instructions won't really allow system_time() to be anywhere near as fast as on x86. :-/ git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15837 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -11,6 +11,7 @@ KernelMergeObject boot_platform_openfirmware.o :
|
||||
menu.cpp
|
||||
mmu.cpp
|
||||
network.cpp
|
||||
real_time_clock.cpp
|
||||
start.c
|
||||
support.cpp
|
||||
video.cpp
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2006, Ingo Weinhold <[email protected]>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "real_time_clock.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <boot/kernel_args.h>
|
||||
#include <boot/stage2.h>
|
||||
#include <platform/openfirmware/openfirmware.h>
|
||||
|
||||
#include "devices.h"
|
||||
|
||||
status_t
|
||||
init_real_time_clock(void)
|
||||
{
|
||||
// find RTC
|
||||
int rtcCookie = 0;
|
||||
if (platform_get_next_device(&rtcCookie, 0, "rtc",
|
||||
gKernelArgs.platform_args.rtc_path,
|
||||
sizeof(gKernelArgs.platform_args.rtc_path)) != B_OK) {
|
||||
printf("init_real_time_clock(): Found no RTC device!");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2006, Ingo Weinhold <[email protected]>.
|
||||
* All rights reserved. Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef OPENFIRMWARE_REAL_TIME_CLOCK_H
|
||||
#define OPENFIRMWARE_REAL_TIME_CLOCK_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
status_t init_real_time_clock(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* OPENFIRMWARE_REAL_TIME_CLOCK_H */
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "console.h"
|
||||
#include "machine.h"
|
||||
#include "real_time_clock.h"
|
||||
|
||||
|
||||
#define HEAP_SIZE 65536
|
||||
@@ -148,6 +149,9 @@ start(void *openFirmwareEntry)
|
||||
if (boot_arch_cpu_init() != B_OK)
|
||||
platform_exit();
|
||||
|
||||
if (init_real_time_clock() != B_OK)
|
||||
platform_exit();
|
||||
|
||||
gKernelArgs.platform_args.openfirmware_entry = openFirmwareEntry;
|
||||
|
||||
main(&args);
|
||||
|
||||
Reference in New Issue
Block a user