From 959588394d610e8e57370e539e0c14d3781eec99 Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Sun, 27 Oct 2019 19:34:25 +0100 Subject: [PATCH] openfirmware: more fixes for 64bit systems. Gets call-method working for sparc, and fix more places where we accidentally truncate 64bit values or sign-extend 32 bit ones. Change-Id: Ic79c55ffa8d2b475858def1639004412f17dd0c1 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1986 Reviewed-by: Alex von Gluck IV --- headers/private/kernel/platform/openfirmware/openfirmware.h | 2 +- src/system/boot/platform/openfirmware/devices.cpp | 4 ++-- src/system/boot/platform/openfirmware/network.cpp | 6 +++--- src/system/boot/platform/openfirmware/video.cpp | 2 +- src/system/kernel/platform/openfirmware/openfirmware.cpp | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/headers/private/kernel/platform/openfirmware/openfirmware.h b/headers/private/kernel/platform/openfirmware/openfirmware.h index 2ca5212692..e3ccbc68dc 100644 --- a/headers/private/kernel/platform/openfirmware/openfirmware.h +++ b/headers/private/kernel/platform/openfirmware/openfirmware.h @@ -76,7 +76,7 @@ extern intptr_t of_call_client_function(const char *method, intptr_t numArgs, intptr_t numReturns, ...); extern intptr_t of_interpret(const char *command, intptr_t numArgs, intptr_t numReturns, ...); -extern intptr_t of_call_method(intptr_t handle, const char *method, +extern intptr_t of_call_method(uint32_t handle, const char *method, intptr_t numArgs, intptr_t numReturns, ...); extern intptr_t of_test(const char *service); extern intptr_t of_milliseconds(void); diff --git a/src/system/boot/platform/openfirmware/devices.cpp b/src/system/boot/platform/openfirmware/devices.cpp index 507d622d10..c46267604d 100644 --- a/src/system/boot/platform/openfirmware/devices.cpp +++ b/src/system/boot/platform/openfirmware/devices.cpp @@ -39,7 +39,7 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList) return B_ENTRY_NOT_FOUND; printf("boot path = \"%s\"\n", sBootPath); - int node = of_finddevice(sBootPath); + intptr_t node = of_finddevice(sBootPath); if (node != OF_FAILED) { char type[16]; of_getprop(node, "device_type", type, sizeof(type)); @@ -65,7 +65,7 @@ platform_add_boot_device(struct stage2_args *args, NodeList *devicesList) } } if (bootAddress == 0) { - int package = of_finddevice("/options"); + intptr_t package = of_finddevice("/options"); char defaultServerIP[16]; int bytesRead = of_getprop(package, "default-server-ip", defaultServerIP, sizeof(defaultServerIP) - 1); diff --git a/src/system/boot/platform/openfirmware/network.cpp b/src/system/boot/platform/openfirmware/network.cpp index 4320963e6f..be78f2972f 100644 --- a/src/system/boot/platform/openfirmware/network.cpp +++ b/src/system/boot/platform/openfirmware/network.cpp @@ -44,7 +44,7 @@ public: virtual ssize_t Receive(void *buffer, size_t size); private: - int fHandle; + intptr_t fHandle; mac_addr_t fMACAddress; }; @@ -109,7 +109,7 @@ OFEthernetInterface::Init(const char *device, const char *parameters) return B_ERROR; } - int package = of_instance_to_package(fHandle); + intptr_t package = of_instance_to_package(fHandle); // get MAC address int bytesRead = of_getprop(package, "local-mac-address", &fMACAddress, @@ -250,7 +250,7 @@ platform_net_stack_init() *parameters = '\0'; // get device node - int node = of_finddevice(bootPath); + intptr_t node = of_finddevice(bootPath); if (node == OF_FAILED) return B_ERROR; diff --git a/src/system/boot/platform/openfirmware/video.cpp b/src/system/boot/platform/openfirmware/video.cpp index 639723d09b..455f30c816 100644 --- a/src/system/boot/platform/openfirmware/video.cpp +++ b/src/system/boot/platform/openfirmware/video.cpp @@ -115,7 +115,7 @@ platform_init_video(void) { gKernelArgs.frame_buffer.enabled = false; - int screen = of_finddevice("screen"); + intptr_t screen = of_finddevice("screen"); if (screen == OF_FAILED) return B_NO_INIT; edid1_raw edidRaw; diff --git a/src/system/kernel/platform/openfirmware/openfirmware.cpp b/src/system/kernel/platform/openfirmware/openfirmware.cpp index d7d46bb7ee..43e508d239 100644 --- a/src/system/kernel/platform/openfirmware/openfirmware.cpp +++ b/src/system/kernel/platform/openfirmware/openfirmware.cpp @@ -122,7 +122,7 @@ of_interpret(const char *command, intptr_t numArgs, intptr_t numReturns, ...) intptr_t -of_call_method(intptr_t handle, const char *method, intptr_t numArgs, +of_call_method(uint32_t handle, const char *method, intptr_t numArgs, intptr_t numReturns, ...) { struct {