From 4e134b546a253168f986914ae9c08344d1a75d1a Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Fri, 13 Mar 2020 21:57:03 +0100 Subject: [PATCH] openfirmware: remove real_time_clock. It is used only in the TCP loader to initialize a random TCP source port. Since the RTC device does not exist on sparc, this is not portable. A simple solution is to use a non-random source port, maybe based on the powercycle count or something like that. For now, I don't need the TCP loader, so I'll just disable this. Change-Id: I6e279a77bb90a8b8b989f06dd9fb256156f71635 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1988 Reviewed-by: waddlesplash --- src/system/boot/platform/openfirmware/Jamfile | 1 - .../platform/openfirmware/real_time_clock.cpp | 57 ------------------- .../platform/openfirmware/real_time_clock.h | 24 -------- .../boot/platform/openfirmware/start.cpp | 4 -- 4 files changed, 86 deletions(-) delete mode 100644 src/system/boot/platform/openfirmware/real_time_clock.cpp delete mode 100644 src/system/boot/platform/openfirmware/real_time_clock.h diff --git a/src/system/boot/platform/openfirmware/Jamfile b/src/system/boot/platform/openfirmware/Jamfile index fa03216547..abb425943f 100644 --- a/src/system/boot/platform/openfirmware/Jamfile +++ b/src/system/boot/platform/openfirmware/Jamfile @@ -20,7 +20,6 @@ local platform_src = menu.cpp mmu.cpp network.cpp - real_time_clock.cpp start.cpp support.cpp video.cpp diff --git a/src/system/boot/platform/openfirmware/real_time_clock.cpp b/src/system/boot/platform/openfirmware/real_time_clock.cpp deleted file mode 100644 index fb91a6686b..0000000000 --- a/src/system/boot/platform/openfirmware/real_time_clock.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2006, Ingo Weinhold . - * Copyright 2010, Andreas Färber - * All rights reserved. Distributed under the terms of the MIT License. - */ - - -#include "real_time_clock.h" - -#include - -#include -#include -#include -#include - - -static int sHandle = OF_FAILED; - - -status_t -init_real_time_clock(void) -{ - // find RTC - intptr_t rtcCookie = 0; - if (of_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; - } - - sHandle = of_open(gKernelArgs.platform_args.rtc_path); - if (sHandle == OF_FAILED) { - printf("%s(): Could not open RTC device!\n", __func__); - return B_ERROR; - } - - return B_OK; -} - - -bigtime_t -real_time_clock_usecs(void) -{ - if (sHandle == OF_FAILED) - return OF_FAILED; - int second, minute, hour, day, month, year; - if (of_call_method(sHandle, "get-time", 0, 6, &year, &month, &day, - &hour, &minute, &second) == OF_FAILED) - return OF_FAILED; - int days = day; - // TODO: Apply algorithm from kernel - // to assure monotonically increasing date. - return (((days * 24 + hour) * 60ULL + minute) * 60ULL + second) - * 1000000ULL; -} diff --git a/src/system/boot/platform/openfirmware/real_time_clock.h b/src/system/boot/platform/openfirmware/real_time_clock.h deleted file mode 100644 index 8262be4234..0000000000 --- a/src/system/boot/platform/openfirmware/real_time_clock.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2006, Ingo Weinhold . - * Copyright 2010, Andreas Färber - * All rights reserved. Distributed under the terms of the MIT License. - */ -#ifndef OPENFIRMWARE_REAL_TIME_CLOCK_H -#define OPENFIRMWARE_REAL_TIME_CLOCK_H - - -#include - - -#ifdef __cplusplus -extern "C" { -#endif - -status_t init_real_time_clock(void); -bigtime_t real_time_clock_usecs(void); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif /* OPENFIRMWARE_REAL_TIME_CLOCK_H */ diff --git a/src/system/boot/platform/openfirmware/start.cpp b/src/system/boot/platform/openfirmware/start.cpp index e49398efdd..fb267eff0c 100644 --- a/src/system/boot/platform/openfirmware/start.cpp +++ b/src/system/boot/platform/openfirmware/start.cpp @@ -20,7 +20,6 @@ #include "console.h" #include "machine.h" -#include "real_time_clock.h" #define HEAP_SIZE 65536 @@ -126,9 +125,6 @@ start(void *openFirmwareEntry) if (boot_arch_cpu_init() != B_OK) of_exit(); - if (init_real_time_clock() != B_OK) - of_exit(); - // check for key presses once sBootOptions = 0; int key = console_check_for_key();