History log of /haiku/src/system/boot/platform/openfirmware/real_time_clock.cpp
Revision Date Author Comments
# e050005a 22-Dec-2020 Adrien Destugues <pulkomandy@pulkomandy.tk>

Revert "openfirmware: remove real_time_clock."

This reverts commit 4e134b546a253168f986914ae9c08344d1a75d1a.

It breaks bootloader build on powerpc.


# d5cd4a9d 03-Apr-2019 PulkoMandy <pulkomandy@pulkomandy.tk>

openfirmware: adjust for 64bit

Sparcv9 runs Openboot in 64 bit mode, which means the cell size is
64bit. Use intptr_t where appropriate to make the open firmware calls
work.

Beware, some values are still 32bit, this matters for example for
of_getprop, if you get 32bits into a 64bit variables it will be in the
MSB of it (big endian only weakness...) and confuse things. See for
example in console.cpp, where the input and output handles are retrieved
as 32bit values. It seems wise to check the expected size when using
of_getprop in these cases, instead of just checking for errors.

Change-Id: Ie72ebc4afe7c6d7602a47478f0bfb6b8247004b8
Reviewed-on: https://review.haiku-os.org/c/1369
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 58b1d460 31-Aug-2010 Andreas Färber <andreas.faerber@web.de>

boot_loader_openfirmware: Implement real_time_clock_usecs()

Partially revert r38465 and move the code from system_time() into a new
real_time_clock_usecs() function. The system_time() implementation was correct
in relying on of_milliseconds(), as pointed out by Axel. Add the correct
function for the desired functionality.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38481 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 56f837e2 30-Aug-2010 Andreas Färber <andreas.faerber@web.de>

boot_loader_openfirmware: Fix system_time()

system_time() was based on of_milliseconds(), which returns the number of
milliseconds since power-on. This would produce very similar or identical
results for subsequent boots due to limited clock resolution; therefore it
was unsuited as PRNG seed, e.g., for TCP ports.

Try to inquire the RTC device node with get-time to return an improved time
value, if possible.

Closes ticket #6061.

Changes from proposed patch:
* Obtain the RTC handle once and reuse it for each inquiry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38465 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 884432c2 24-Aug-2010 Andreas Färber <andreas.faerber@web.de>

boot_loader_openfirmware: Fix style issues

Adjust initializers.
Respect 80-column limit and adjust copyright notice.
Reorder some header groups. Enforce line spacing.

No functional changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38343 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 04ec719a 26-Jun-2010 Andreas Färber <andreas.faerber@web.de>

Convert line endings to LF

In r33670 the svn:eol-style property was dropped, which took care of
locally converting the line endings to the user's native style.
While most files use Unix-style LF line endings, some files have
Windows-style CR LF line endings.

Assure that the following r37262 directories use Unix-style line endings:

src/system/boot/
src/system/boot/arch/
src/system/boot/arch/ppc/
src/system/boot/loader/
src/system/boot/loader/net/
src/system/boot/platform/
src/system/boot/platform/openfirmware/
src/system/boot/platform/openfirmware/arch/
src/system/boot/platform/openfirmware/arch/ppc/
src/system/kernel/
src/system/kernel/arch/
src/system/kernel/arch/ppc/
src/system/kernel/platform/
src/system/kernel/platform/openfirmware/
headers/private/kernel/
headers/private/kernel/arch/
headers/private/kernel/arch/ppc/
headers/private/kernel/platform/
headers/private/kernel/platform/openfirmware/
headers/private/kernel/boot/
headers/private/kernel/boot/net/
headers/private/kernel/boot/platform/
headers/private/kernel/boot/platform/openfirmware/

This avoids patches containing irrelevant lines unintentionally converted.

No functional changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37265 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f602da2b 26-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

* Turned the kernel platform support from a library into an object.
* Moved the Open Firmware function platform_get_next_device() from
the boot loader into the kernel (renamed to of_get_next_device()).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16101 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e55e1a0e 03-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 58b1d4608a2c5d6658fb4510061d7503e6c33219 31-Aug-2010 Andreas Färber <andreas.faerber@web.de>

boot_loader_openfirmware: Implement real_time_clock_usecs()

Partially revert r38465 and move the code from system_time() into a new
real_time_clock_usecs() function. The system_time() implementation was correct
in relying on of_milliseconds(), as pointed out by Axel. Add the correct
function for the desired functionality.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38481 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 56f837e265f8569acf2a1e26bb0b1c00f46b06ff 30-Aug-2010 Andreas Färber <andreas.faerber@web.de>

boot_loader_openfirmware: Fix system_time()

system_time() was based on of_milliseconds(), which returns the number of
milliseconds since power-on. This would produce very similar or identical
results for subsequent boots due to limited clock resolution; therefore it
was unsuited as PRNG seed, e.g., for TCP ports.

Try to inquire the RTC device node with get-time to return an improved time
value, if possible.

Closes ticket #6061.

Changes from proposed patch:
* Obtain the RTC handle once and reuse it for each inquiry.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38465 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 884432c2da9fbeb1f5e4e4a48ce271b8ad7ee204 24-Aug-2010 Andreas Färber <andreas.faerber@web.de>

boot_loader_openfirmware: Fix style issues

Adjust initializers.
Respect 80-column limit and adjust copyright notice.
Reorder some header groups. Enforce line spacing.

No functional changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38343 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 04ec719a7040836b0860309cdf002a2cd156f913 26-Jun-2010 Andreas Färber <andreas.faerber@web.de>

Convert line endings to LF

In r33670 the svn:eol-style property was dropped, which took care of
locally converting the line endings to the user's native style.
While most files use Unix-style LF line endings, some files have
Windows-style CR LF line endings.

Assure that the following r37262 directories use Unix-style line endings:

src/system/boot/
src/system/boot/arch/
src/system/boot/arch/ppc/
src/system/boot/loader/
src/system/boot/loader/net/
src/system/boot/platform/
src/system/boot/platform/openfirmware/
src/system/boot/platform/openfirmware/arch/
src/system/boot/platform/openfirmware/arch/ppc/
src/system/kernel/
src/system/kernel/arch/
src/system/kernel/arch/ppc/
src/system/kernel/platform/
src/system/kernel/platform/openfirmware/
headers/private/kernel/
headers/private/kernel/arch/
headers/private/kernel/arch/ppc/
headers/private/kernel/platform/
headers/private/kernel/platform/openfirmware/
headers/private/kernel/boot/
headers/private/kernel/boot/net/
headers/private/kernel/boot/platform/
headers/private/kernel/boot/platform/openfirmware/

This avoids patches containing irrelevant lines unintentionally converted.

No functional changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37265 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f602da2b72be9c948e694de0d89b1bc823b0f106 26-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

* Turned the kernel platform support from a library into an object.
* Moved the Open Firmware function platform_get_next_device() from
the boot loader into the kernel (renamed to of_get_next_device()).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16101 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e55e1a0e666da61eb901533dae4af2ec44d216d8 03-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

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