From 9a713d9417fb71a8679d792eb174b3cee59dbda7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sat, 22 Sep 2012 20:45:25 +0200 Subject: [PATCH] U-Boot: PPC: stub out OF calls * For now this allows linking the kernel and the pci bus manager. * Could later on be turned into a wrapper to FDT methods since the concepts are similar. --- src/system/kernel/platform/u-boot/Jamfile | 1 + .../kernel/platform/u-boot/openfirmware.cpp | 224 ++++++++++++++++++ 2 files changed, 225 insertions(+) create mode 100644 src/system/kernel/platform/u-boot/openfirmware.cpp diff --git a/src/system/kernel/platform/u-boot/Jamfile b/src/system/kernel/platform/u-boot/Jamfile index d29857ba59..d1845da417 100644 --- a/src/system/kernel/platform/u-boot/Jamfile +++ b/src/system/kernel/platform/u-boot/Jamfile @@ -5,4 +5,5 @@ SubDirC++Flags $(TARGET_KERNEL_PIC_CCFLAGS) ; KernelMergeObject kernel_platform_u-boot.o : platform.cpp + openfirmware.cpp ; diff --git a/src/system/kernel/platform/u-boot/openfirmware.cpp b/src/system/kernel/platform/u-boot/openfirmware.cpp new file mode 100644 index 0000000000..5ee024cd1b --- /dev/null +++ b/src/system/kernel/platform/u-boot/openfirmware.cpp @@ -0,0 +1,224 @@ +/* + * Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +#include +#include + +#include + + +// FIXME: HACK: until we support multiple platforms at once in the kernel. + +int gChosen; + + +status_t +of_init(int (*openFirmwareEntry)(void *)) +{ + gChosen = of_finddevice("/chosen"); + if (gChosen == OF_FAILED) + return B_ERROR; + + return B_OK; +} + + +int +of_call_client_function(const char *method, int numArgs, int numReturns, ...) +{ + return OF_FAILED; +} + + +int +of_interpret(const char *command, int numArgs, int numReturns, ...) +{ + return OF_FAILED; +} + + +int +of_call_method(int handle, const char *method, int numArgs, int numReturns, ...) +{ + return OF_FAILED; +} + + +int +of_finddevice(const char *device) +{ + return OF_FAILED; +} + + +status_t +of_get_next_device(int *_cookie, int root, const char *type, char *path, + size_t pathSize) +{ + return B_ERROR; +} + + +/** Returns the first child of the given node + */ + +int +of_child(int node) +{ + return OF_FAILED; +} + + +/** Returns the next sibling of the given node + */ + +int +of_peer(int node) +{ + return OF_FAILED; +} + + +/** Returns the parent of the given node + */ + +int +of_parent(int node) +{ + return OF_FAILED; +} + + +int +of_instance_to_path(int instance, char *pathBuffer, int bufferSize) +{ + return OF_FAILED; +} + + +int +of_instance_to_package(int instance) +{ + return OF_FAILED; +} + + +int +of_getprop(int package, const char *property, void *buffer, int bufferSize) +{ + return OF_FAILED; +} + + +int +of_setprop(int package, const char *property, const void *buffer, int bufferSize) +{ + return OF_FAILED; +} + + +int +of_getproplen(int package, const char *property) +{ + return OF_FAILED; +} + + +int +of_nextprop(int package, const char *previousProperty, char *nextProperty) +{ + return OF_FAILED; +} + + +int +of_package_to_path(int package, char *pathBuffer, int bufferSize) +{ + return OF_FAILED; +} + + +// I/O functions + + +int +of_open(const char *nodeName) +{ + return OF_FAILED; +} + + +void +of_close(int handle) +{ +} + + +int +of_read(int handle, void *buffer, int bufferSize) +{ + return OF_FAILED; +} + + +int +of_write(int handle, const void *buffer, int bufferSize) +{ + return OF_FAILED; +} + + +int +of_seek(int handle, long long pos) +{ + return OF_FAILED; +} + + +// memory functions + + +int +of_release(void *virtualAddress, int size) +{ + return OF_FAILED; +} + + +void * +of_claim(void *virtualAddress, int size, int align) +{ + return NULL; +} + + +// misc functions + + +/** tests if the given service is missing + */ + +int +of_test(const char *service) +{ + return OF_FAILED; +} + + +/** Returns the millisecond counter + */ + +int +of_milliseconds(void) +{ + return OF_FAILED; +} + + +void +of_exit(void) +{ +} +