[PATCH] Bootloader OF Changes for 2.5

Leigh Brown leigh at solinno.co.uk
Thu Aug 15 23:12:39 EST 2002


Hi,

Tom asked for my OF changes to be ported to 2.5 - so here they are.  I
have made a couple of changes but nothing too major.  The only thing I
am not sure about is the correct way to include the of1275 directory in
the Makefile structure.  I've changed the way I did from last time because
it required all the source files to be listed as dependencies in the
arch/ppc/boot/Makefile, which is naff.

To recap, the point of this patch is to allow me to start using OF
functions in the PReP boot loader again, but in such a way that each boot
loader only includes the code for the functions it uses, to minimize its
size.

The next step will be to start using the OF functions in the PReP boot
loader.

Cheers,

Leigh.
-------------- next part --------------
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/Makefile linuxppc_2_5-local/arch/ppc/boot/Makefile
--- linuxppc_2_5/arch/ppc/boot/Makefile	Wed Aug 14 09:50:00 2002
+++ linuxppc_2_5-local/arch/ppc/boot/Makefile	Thu Aug 15 09:16:42 2002
@@ -47,6 +47,9 @@
 # These are the subdirs we want to use
 BOOTDIRS			= $(filter-out $(NONBOOT), $(subdir-y))
 
+makeof1275:
+	$(MAKE) -C of1275
+
 # This will make the tools we need.  We do it like this to ensure that we use
 # HOSTCC. -- Tom
 maketools:
@@ -55,7 +58,7 @@
 # The targets all boards support for boot images.
 BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
 
-$(BOOT_TARGETS): vmapus lib/zlib.a images/vmlinux.gz maketools
+$(BOOT_TARGETS): vmapus lib/zlib.a images/vmlinux.gz makeof1275 maketools
 ifneq ($(BOOTDIRS),)
 	for d in $(BOOTDIRS); do $(MAKE) -C $$d $@; done
 endif
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/include/of1275.h linuxppc_2_5-local/arch/ppc/boot/include/of1275.h
--- linuxppc_2_5/arch/ppc/boot/include/of1275.h	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/include/of1275.h	Thu Aug 15 11:37:25 2002
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+typedef void *prom_handle;
+typedef void *ihandle;
+typedef void *phandle;
+typedef int (*prom_entry)(void *);
+
+#define OF_INVALID_HANDLE	((prom_handle)-1UL)
+
+extern prom_entry of_prom_entry;
+
+/* function declarations */
+
+void *	claim(unsigned int virt, unsigned int size, unsigned int align);
+void	enter(void);
+void	exit(void);
+phandle	finddevice(const char *name);
+int	getprop(phandle node, const char *name, void *buf, int buflen);
+void	ofinit(prom_entry entry);
+int	ofstdio(ihandle *stdin, ihandle *stdout, ihandle *stderr);
+int	read(ihandle instance, void *buf, int buflen);
+void	release(void *virt, unsigned int size);
+int	write(ihandle instance, void *buf, int buflen);
+
+/* inlines */
+
+extern inline void pause(void)
+{
+	enter();
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/Makefile linuxppc_2_5-local/arch/ppc/boot/of1275/Makefile
--- linuxppc_2_5/arch/ppc/boot/of1275/Makefile	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/Makefile	Thu Aug 15 09:13:43 2002
@@ -0,0 +1,10 @@
+#
+# Makefile of1275 stuff
+#
+
+L_TARGET := of1275.a
+
+obj-y := claim.o enter.o exit.o finddevice.o getprop.o ofinit.o	\
+	 ofstdio.o read.o release.o write.o
+
+include $(TOPDIR)/Rules.make
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/claim.c linuxppc_2_5-local/arch/ppc/boot/of1275/claim.c
--- linuxppc_2_5/arch/ppc/boot/of1275/claim.c	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/claim.c	Thu Aug 15 11:36:21 2002
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "of1275.h"
+
+void *
+claim(unsigned int virt, unsigned int size, unsigned int align)
+{
+    struct prom_args {
+	char *service;
+	int nargs;
+	int nret;
+	unsigned int virt;
+	unsigned int size;
+	unsigned int align;
+	void *ret;
+    } args;
+
+    args.service = "claim";
+    args.nargs = 3;
+    args.nret = 1;
+    args.virt = virt;
+    args.size = size;
+    args.align = align;
+    (*of_prom_entry)(&args);
+    return args.ret;
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/enter.c linuxppc_2_5-local/arch/ppc/boot/of1275/enter.c
--- linuxppc_2_5/arch/ppc/boot/of1275/enter.c	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/enter.c	Thu Aug 15 11:36:23 2002
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "of1275.h"
+
+void
+enter(void)
+{
+    struct prom_args {
+	char *service;
+    } args;
+
+    args.service = "enter";
+    (*of_prom_entry)(&args);
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/exit.c linuxppc_2_5-local/arch/ppc/boot/of1275/exit.c
--- linuxppc_2_5/arch/ppc/boot/of1275/exit.c	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/exit.c	Thu Aug 15 11:36:25 2002
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "of1275.h"
+
+void
+exit(void)
+{
+    struct prom_args {
+	char *service;
+    } args;
+
+    for (;;) {
+	args.service = "exit";
+	(*of_prom_entry)(&args);
+    }
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/finddevice.c linuxppc_2_5-local/arch/ppc/boot/of1275/finddevice.c
--- linuxppc_2_5/arch/ppc/boot/of1275/finddevice.c	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/finddevice.c	Thu Aug 15 11:36:27 2002
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "of1275.h"
+
+phandle
+finddevice(const char *name)
+{
+    struct prom_args {
+	char *service;
+	int nargs;
+	int nret;
+	const char *devspec;
+	phandle device;
+    } args;
+
+    args.service = "finddevice";
+    args.nargs = 1;
+    args.nret = 1;
+    args.devspec = name;
+    args.device = OF_INVALID_HANDLE;
+    (*of_prom_entry)(&args);
+    return args.device;
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/getprop.c linuxppc_2_5-local/arch/ppc/boot/of1275/getprop.c
--- linuxppc_2_5/arch/ppc/boot/of1275/getprop.c	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/getprop.c	Thu Aug 15 11:36:29 2002
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "of1275.h"
+
+int
+getprop(phandle node, const char *name, void *buf, int buflen)
+{
+    struct prom_args {
+	char *service;
+	int nargs;
+	int nret;
+	phandle node;
+	const char *name;
+	void *buf;
+	int buflen;
+	int size;
+    } args;
+
+    args.service = "getprop";
+    args.nargs = 4;
+    args.nret = 1;
+    args.node = node;
+    args.name = name;
+    args.buf = buf;
+    args.buflen = buflen;
+    args.size = -1;
+    (*of_prom_entry)(&args);
+    return args.size;
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/ofinit.c linuxppc_2_5-local/arch/ppc/boot/of1275/ofinit.c
--- linuxppc_2_5/arch/ppc/boot/of1275/ofinit.c	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/ofinit.c	Thu Aug 15 11:36:32 2002
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "of1275.h"
+
+prom_entry of_prom_entry;
+
+void
+ofinit(prom_entry prom_ptr)
+{
+    of_prom_entry = prom_ptr;
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/ofstdio.c linuxppc_2_5-local/arch/ppc/boot/of1275/ofstdio.c
--- linuxppc_2_5/arch/ppc/boot/of1275/ofstdio.c	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/ofstdio.c	Thu Aug 15 11:36:34 2002
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "of1275.h"
+
+int
+ofstdio(ihandle *stdin, ihandle *stdout, ihandle *stderr)
+{
+    ihandle in, out;
+    phandle chosen;
+   
+    if ((chosen = finddevice("/chosen")) == OF_INVALID_HANDLE)
+	goto err;
+    if (getprop(chosen, "stdout", &out, sizeof(out)) != 4)
+	goto err;
+    if (getprop(chosen, "stdin", &in, sizeof(in)) != 4)
+	goto err;
+
+    *stdin  = in;
+    *stdout = out;
+    *stderr = out;
+    return 0;
+err:
+    return -1;
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/read.c linuxppc_2_5-local/arch/ppc/boot/of1275/read.c
--- linuxppc_2_5/arch/ppc/boot/of1275/read.c	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/read.c	Thu Aug 15 11:36:36 2002
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "of1275.h"
+
+int
+read(ihandle instance, void *buf, int buflen)
+{
+    struct prom_args {
+	char *service;
+	int nargs;
+	int nret;
+	ihandle instance;
+	void *buf;
+	int buflen;
+	int actual;
+    } args;
+
+    args.service = "read";
+    args.nargs = 3;
+    args.nret = 1;
+    args.instance = instance;
+    args.buf = buf;
+    args.buflen = buflen;
+    args.actual = -1;
+    (*of_prom_entry)(&args);
+    return args.actual;
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/release.c linuxppc_2_5-local/arch/ppc/boot/of1275/release.c
--- linuxppc_2_5/arch/ppc/boot/of1275/release.c	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/release.c	Thu Aug 15 11:36:54 2002
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "of1275.h"
+
+void
+release(void *virt, unsigned int size)
+{
+    struct prom_args {
+	char *service;
+	int nargs;
+	int nret;
+	void *virt;
+	unsigned int size;
+    } args;
+
+    args.service = "release";
+    args.nargs = 2;
+    args.nret = 0;
+    args.virt = virt;
+    args.size = size;
+    (*of_prom_entry)(&args);
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/of1275/write.c linuxppc_2_5-local/arch/ppc/boot/of1275/write.c
--- linuxppc_2_5/arch/ppc/boot/of1275/write.c	Thu Jan  1 01:00:00 1970
+++ linuxppc_2_5-local/arch/ppc/boot/of1275/write.c	Thu Aug 15 11:36:57 2002
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) Paul Mackerras 1997.
+ * Copyright (C) Leigh Brown 2002.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include "of1275.h"
+
+int
+write(ihandle instance, void *buf, int buflen)
+{
+    struct prom_args {
+	char *service;
+	int nargs;
+	int nret;
+	ihandle instance;
+	void *buf;
+	int buflen;
+	int actual;
+    } args;
+
+    args.service = "write";
+    args.nargs = 3;
+    args.nret = 1;
+    args.instance = instance;
+    args.buf = buf;
+    args.buflen = buflen;
+    args.actual = -1;
+    (*of_prom_entry)(&args);
+    return args.actual;
+}
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/openfirmware/Makefile linuxppc_2_5-local/arch/ppc/boot/openfirmware/Makefile
--- linuxppc_2_5/arch/ppc/boot/openfirmware/Makefile	Wed Aug 14 09:49:32 2002
+++ linuxppc_2_5-local/arch/ppc/boot/openfirmware/Makefile	Wed Aug 14 17:22:52 2002
@@ -23,7 +23,7 @@
 NEWWORLDOBJS = ../common/crt0.o $(COMMONOBJS) newworldmain.o
 
 EXTRA_TARGETS	:= $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS)
-LIBS = $(TOPDIR)/lib/lib.a ../lib/zlib.a
+LIBS = $(TOPDIR)/lib/lib.a ../lib/zlib.a ../of1275/of1275.a
 
 ADDNOTE := ../utils/addnote
 MKNOTE := ../utils/mknote
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/openfirmware/chrpmain.c linuxppc_2_5-local/arch/ppc/boot/openfirmware/chrpmain.c
--- linuxppc_2_5/arch/ppc/boot/openfirmware/chrpmain.c	Wed Aug 14 09:48:47 2002
+++ linuxppc_2_5-local/arch/ppc/boot/openfirmware/chrpmain.c	Wed Aug 14 17:23:53 2002
@@ -10,6 +10,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 #include "nonstdio.h"
+#include "of1275.h"
 #include <asm/processor.h>
 #include <asm/page.h>
 
@@ -18,15 +19,11 @@
 extern char __ramdisk_begin, __ramdisk_end;
 extern char _start, _end;
 
-extern int getprop(void *, const char *, void *, int);
 extern unsigned int heap_max;
-extern void claim(unsigned int virt, unsigned int size, unsigned int align);
-extern void *finddevice(const char *);
 extern void flush_cache(void *, unsigned long);
 extern void gunzip(void *, int, unsigned char *, int *);
 extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
 		unsigned int progend);
-extern void pause(void);
 
 char *avail_ram;
 char *begin_avail, *end_avail;
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/openfirmware/coffmain.c linuxppc_2_5-local/arch/ppc/boot/openfirmware/coffmain.c
--- linuxppc_2_5/arch/ppc/boot/openfirmware/coffmain.c	Wed Aug 14 09:48:45 2002
+++ linuxppc_2_5-local/arch/ppc/boot/openfirmware/coffmain.c	Wed Aug 14 17:24:17 2002
@@ -13,6 +13,7 @@
 #include <asm/page.h>
 
 #include "nonstdio.h"
+#include "of1275.h"
 #include "zlib.h"
 
 /* Passed from the linker */
@@ -20,17 +21,13 @@
 extern char __ramdisk_begin[], __ramdisk_end;
 extern char _start, _end;
 
-extern char *claim(unsigned, unsigned, unsigned);
 extern char image_data[], initrd_data[];
 extern int initrd_len, image_len;
-extern int getprop(void *, const char *, void *, int);
 extern unsigned int heap_max;
-extern void *finddevice(const char *);
 extern void flush_cache(void *start, unsigned int len);
 extern void gunzip(void *, int, unsigned char *, int *);
 extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
 		unsigned int progend);
-extern void pause(void);
 extern void setup_bats(unsigned long start);
 
 char *avail_ram;
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/openfirmware/common.c linuxppc_2_5-local/arch/ppc/boot/openfirmware/common.c
--- linuxppc_2_5/arch/ppc/boot/openfirmware/common.c	Wed Aug 14 09:49:43 2002
+++ linuxppc_2_5-local/arch/ppc/boot/openfirmware/common.c	Wed Aug 14 17:25:15 2002
@@ -11,6 +11,7 @@
 
 #include "zlib.h"
 #include "nonstdio.h"
+#include "of1275.h"
 #include <asm/bootinfo.h>
 #include <asm/page.h>
 
@@ -20,8 +21,6 @@
 extern int strcmp(const char *s1, const char *s2);
 extern char *avail_ram, *avail_high;
 extern char *end_avail;
-extern void claim(unsigned int virt, unsigned int size, unsigned int align);
-extern void pause(void);
 
 unsigned int heap_use, heap_max;
 
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/openfirmware/newworldmain.c linuxppc_2_5-local/arch/ppc/boot/openfirmware/newworldmain.c
--- linuxppc_2_5/arch/ppc/boot/openfirmware/newworldmain.c	Wed Aug 14 09:48:43 2002
+++ linuxppc_2_5-local/arch/ppc/boot/openfirmware/newworldmain.c	Wed Aug 14 17:24:38 2002
@@ -10,6 +10,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 #include "nonstdio.h"
+#include "of1275.h"
 #include <asm/processor.h>
 #include <asm/page.h>
 
@@ -18,16 +19,11 @@
 extern char __ramdisk_begin[], __ramdisk_end;
 extern char _start, _end;
 
-extern int getprop(void *, const char *, void *, int);
 extern unsigned int heap_max;
-extern void *claim(unsigned int virt, unsigned int size, unsigned int align);
-extern void *finddevice(const char *);
 extern void flush_cache(void *start, unsigned int len);
 extern void gunzip(void *, int, unsigned char *, int *);
 extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
 		unsigned int progend);
-extern void pause(void);
-extern void release(void *ptr, unsigned int len);
 
 char *avail_ram;
 char *begin_avail, *end_avail;
diff -urN -x config -X /home/leigh/.diffex linuxppc_2_5/arch/ppc/boot/openfirmware/start.c linuxppc_2_5-local/arch/ppc/boot/openfirmware/start.c
--- linuxppc_2_5/arch/ppc/boot/openfirmware/start.c	Wed Aug 14 09:49:32 2002
+++ linuxppc_2_5-local/arch/ppc/boot/openfirmware/start.c	Thu Aug 15 08:44:10 2002
@@ -10,33 +10,22 @@
  * 2 of the License, or (at your option) any later version.
  */
 #include <stdarg.h>
+#include "of1275.h"
 
 extern int strlen(const char *s);
 extern void boot(int a1, int a2, void *prom);
 
-int (*prom)(void *);
+phandle stdin;
+phandle stdout;
+phandle stderr;
 
-void *chosen_handle;
-void *stdin;
-void *stdout;
-void *stderr;
-
-void exit(void);
-void *finddevice(const char *name);
-int getprop(void *phandle, const char *name, void *buf, int buflen);
 void printk(char *fmt, ...);
 
 void
 start(int a1, int a2, void *promptr)
 {
-    prom = (int (*)(void *)) promptr;
-    chosen_handle = finddevice("/chosen");
-    if (chosen_handle == (void *) -1)
-	exit();
-    if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
-	exit();
-    stderr = stdout;
-    if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
+    ofinit(promptr);
+    if (ofstdio(&stdin, &stdout, &stderr))
 	exit();
 
     boot(a1, a2, promptr);
@@ -44,30 +33,6 @@
 	exit();
 }
 
-int
-write(void *handle, void *ptr, int nb)
-{
-    struct prom_args {
-	char *service;
-	int nargs;
-	int nret;
-	void *ihandle;
-	void *addr;
-	int len;
-	int actual;
-    } args;
-
-    args.service = "write";
-    args.nargs = 3;
-    args.nret = 1;
-    args.ihandle = handle;
-    args.addr = ptr;
-    args.len = nb;
-    args.actual = -1;
-    (*prom)(&args);
-    return args.actual;
-}
-
 int writestring(void *f, char *ptr, int nb)
 {
 	int w = 0, i;
@@ -88,142 +53,6 @@
 }
 
 int
-read(void *handle, void *ptr, int nb)
-{
-    struct prom_args {
-	char *service;
-	int nargs;
-	int nret;
-	void *ihandle;
-	void *addr;
-	int len;
-	int actual;
-    } args;
-
-    args.service = "read";
-    args.nargs = 3;
-    args.nret = 1;
-    args.ihandle = handle;
-    args.addr = ptr;
-    args.len = nb;
-    args.actual = -1;
-    (*prom)(&args);
-    return args.actual;
-}
-
-void
-exit(void)
-{
-    struct prom_args {
-	char *service;
-    } args;
-
-    for (;;) {
-	args.service = "exit";
-	(*prom)(&args);
-    }
-}
-
-void
-pause(void)
-{
-    struct prom_args {
-	char *service;
-    } args;
-
-    args.service = "enter";
-    (*prom)(&args);
-}
-
-void *
-finddevice(const char *name)
-{
-    struct prom_args {
-	char *service;
-	int nargs;
-	int nret;
-	const char *devspec;
-	void *phandle;
-    } args;
-
-    args.service = "finddevice";
-    args.nargs = 1;
-    args.nret = 1;
-    args.devspec = name;
-    args.phandle = (void *) -1;
-    (*prom)(&args);
-    return args.phandle;
-}
-
-void *
-claim(unsigned int virt, unsigned int size, unsigned int align)
-{
-    struct prom_args {
-	char *service;
-	int nargs;
-	int nret;
-	unsigned int virt;
-	unsigned int size;
-	unsigned int align;
-	void *ret;
-    } args;
-
-    args.service = "claim";
-    args.nargs = 3;
-    args.nret = 1;
-    args.virt = virt;
-    args.size = size;
-    args.align = align;
-    (*prom)(&args);
-    return args.ret;
-}
-
-void
-release(void *virt, unsigned int size)
-{
-    struct prom_args {
-	char *service;
-	int nargs;
-	int nret;
-	void *virt;
-	unsigned int size;
-    } args;
-
-    args.service = "release";
-    args.nargs = 2;
-    args.nret = 0;
-    args.virt = virt;
-    args.size = size;
-    (*prom)(&args);
-}
-
-int
-getprop(void *phandle, const char *name, void *buf, int buflen)
-{
-    struct prom_args {
-	char *service;
-	int nargs;
-	int nret;
-	void *phandle;
-	const char *name;
-	void *buf;
-	int buflen;
-	int size;
-    } args;
-
-    args.service = "getprop";
-    args.nargs = 4;
-    args.nret = 1;
-    args.phandle = phandle;
-    args.name = name;
-    args.buf = buf;
-    args.buflen = buflen;
-    args.size = -1;
-    (*prom)(&args);
-    return args.size;
-}
-
-int
 putc(int c, void *f)
 {
     char ch = c;


More information about the Linuxppc-dev mailing list