Author: fireball
Date: Sat Jun 2 01:28:56 2007
New Revision: 26963
URL:
http://svn.reactos.org/svn/reactos?rev=26963&view=rev
Log:
- Fix some warnings in FirmWorks's OFW library.
- Add a preliminary cut ofw_setup() function, which prevented ofwprintf() from working.
- Add an of_call.h (hand-generated for now) with prototypes of all OFW calls.
Added:
branches/olpc/boot/freeldr/freeldr/include/arch/i386/of_call.h
Modified:
branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/1275.h
branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/lib.c
branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/printf.c
Modified: branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/1275.h
URL:
http://svn.reactos.org/svn/reactos/branches/olpc/boot/freeldr/freeldr/arch/…
==============================================================================
--- branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/1275.h (original)
+++ branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/1275.h Sat Jun 2 01:28:56 2007
@@ -2,13 +2,13 @@
#include "types.h"
-typedef long phandle;
-typedef long ihandle;
+#include "arch/i386/of_call.h"
typedef struct {
long hi, lo;
long size;
} reg;
+
#ifdef putchar
# undef putchar
@@ -16,6 +16,9 @@
#ifdef puts
# undef puts
#endif
+
+VOID
+putchar(char c);
typedef enum {
NOALLOC,
Modified: branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/lib.c
URL:
http://svn.reactos.org/svn/reactos/branches/olpc/boot/freeldr/freeldr/arch/…
==============================================================================
--- branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/lib.c (original)
+++ branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/lib.c Sat Jun 2 01:28:56 2007
@@ -63,6 +63,36 @@
*q = '\0';
}
+
+int
+ofw_setup()
+{
+ static char *argv[8];
+ phandle ph;
+ char *argstr;
+ int i;
+
+ if ((ph = OFFinddevice("/chosen")) == -1)
+ abort() ;
+ stdin->id = get_int_prop(ph, "stdin");
+ stdout->id = get_int_prop(ph, "stdout");
+
+ argv[0] = get_str_prop(ph, "bootpath", ALLOC);
+ argstr = get_str_prop(ph, "bootargs", ALLOC);
+
+ for (i = 1; i < 8;) {
+ if (*argstr == '\0')
+ break;
+ argv[i++] = argstr;
+ while (*argstr != ' ' && *argstr != '\0')
+ ++argstr;
+ if (*argstr == '\0')
+ break;
+ *argstr++ = '\0';
+ }
+ parse_homedir(argv[0]);
+}
+
FILE *
fopen (char *name, char *mode)
Modified: branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/printf.c
URL:
http://svn.reactos.org/svn/reactos/branches/olpc/boot/freeldr/freeldr/arch/…
==============================================================================
--- branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/printf.c (original)
+++ branches/olpc/boot/freeldr/freeldr/arch/i386/ofw/printf.c Sat Jun 2 01:28:56 2007
@@ -5,6 +5,8 @@
#include "1275.h"
#include <stdarg.h>
+
+void* memset (void*, int, size_t);
int
atoi(char *s)
@@ -99,7 +101,7 @@
n += printbase(x, 10);
break;
case 'c':
- c = va_arg(args, char);
+ c = va_arg(args, /*char*/int);
putchar(c);
n++;
break;
Added: branches/olpc/boot/freeldr/freeldr/include/arch/i386/of_call.h
URL:
http://svn.reactos.org/svn/reactos/branches/olpc/boot/freeldr/freeldr/inclu…
==============================================================================
--- branches/olpc/boot/freeldr/freeldr/include/arch/i386/of_call.h (added)
+++ branches/olpc/boot/freeldr/freeldr/include/arch/i386/of_call.h Sat Jun 2 01:28:56
2007
@@ -1,0 +1,123 @@
+/* Prototypes of implemented OFW functions */
+
+typedef long phandle;
+typedef long ihandle;
+
+phandle
+OFPeer(phandle device_id);
+
+phandle
+OFChild(phandle device_id);
+
+phandle
+OFParent(phandle device_id);
+
+long
+OFGetproplen(
+ phandle device_id,
+ char *name
+ );
+
+long
+OFGetprop(
+ phandle device_id,
+ char *name,
+ char *buf,
+ ULONG buflen
+ );
+
+long
+OFNextprop(
+ phandle device_id,
+ char *name,
+ char *buf
+ );
+
+long
+OFSetprop(
+ phandle device_id,
+ char *name,
+ char *buf,
+ ULONG buflen
+ );
+
+phandle
+OFFinddevice( char *devicename);
+
+ihandle
+OFOpen( char *devicename);
+
+void
+OFClose(ihandle id);
+
+long
+OFRead(
+ ihandle instance_id,
+ char *addr,
+ ULONG len
+ );
+
+long
+OFWrite(
+ ihandle instance_id,
+ char *addr,
+ ULONG len
+ );
+
+long
+OFSeek(
+ ihandle instance_id,
+ ULONG poshi,
+ ULONG poslo
+ );
+
+ULONG
+OFClaim(
+ char *addr,
+ ULONG size,
+ ULONG align
+ );
+
+VOID
+OFRelease(
+ char *addr,
+ ULONG size
+ );
+
+long
+OFPackageToPath(
+ phandle device_id,
+ char *addr,
+ ULONG buflen
+ );
+
+phandle
+OFInstanceToPackage(ihandle ih);
+
+long
+OFCallMethod(
+ char *method,
+ ihandle id,
+ ULONG arg
+ );
+
+long
+OFInterpret0(
+ char *cmd
+ );
+
+ULONG
+OFMilliseconds( VOID );
+
+void (*OFSetCallback(void (*func)(void)))(void);
+
+long
+OFBoot(
+ char *bootspec
+ );
+
+VOID
+OFEnter( VOID );
+
+VOID
+OFExit( VOID );