From: Paul Mackerras <paulus@samba.org>
To: michael@ellerman.id.au
Cc: linuxppc-dev <Linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH] Start arch/powerpc/boot code reorganization
Date: Tue, 19 Sep 2006 14:29:10 +1000 [thread overview]
Message-ID: <17679.29206.548556.979379@cargo.ozlabs.ibm.com> (raw)
In-Reply-To: <1158639740.32015.114.camel@localhost.localdomain>
Michael Ellerman writes:
> Where do I get ops.h?
Oops... here it is.
Paul.
diff --git /dev/null b/arch/powerpc/boot/ops.h
--- /dev/null 2006-09-18 11:33:23.687982711 +1000
+++ b/arch/powerpc/boot/ops.h 2006-09-19 14:09:38.000000000 +1000
@@ -0,0 +1,100 @@
+/*
+ * Global definition of all the bootwrapper operations.
+ *
+ * Author: Mark A. Greer <mgreer@mvista.com>
+ *
+ * 2006 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+#ifndef _PPC_BOOT_OPS_H_
+#define _PPC_BOOT_OPS_H_
+
+#include "types.h"
+
+#define COMMAND_LINE_SIZE 512
+#define MAX_PATH_LEN 256
+#define MAX_PROP_LEN 256 /* What should this be? */
+
+/* Platform specific operations */
+struct platform_ops {
+ void (*fixups)(void);
+ void * (*malloc)(u32 size);
+ void (*free)(void *ptr, u32 size);
+ void (*exit)(void);
+};
+extern struct platform_ops platform_ops;
+
+/* Device Tree operations */
+struct dt_ops {
+ void * (*finddevice)(const char *name);
+ int (*getprop)(const void *node, const char *name, void *buf,
+ const int buflen);
+ int (*setprop)(const void *node, const char *name,
+ const void *buf, const int buflen);
+ u64 (*translate_addr)(const char *path, const u32 *in_addr,
+ const u32 addr_len);
+ void (*call_kernel)(void *entry_addr, unsigned long a1,
+ unsigned long a2, void *promptr, void *sp);
+};
+extern struct dt_ops dt_ops;
+
+/* Console operations */
+struct console_ops {
+ int (*open)(void);
+ void (*write)(char *buf, int len);
+ void (*edit_cmdline)(char *buf, int len);
+ void (*close)(void);
+ void *data;
+};
+extern struct console_ops console_ops;
+
+/* Serial console operations */
+struct serial_console_data {
+ int (*open)(void);
+ void (*putc)(unsigned char c);
+ unsigned char (*getc)(void);
+ u8 (*tstc)(void);
+ void (*close)(void);
+};
+
+extern int platform_init(void *promptr);
+extern void simple_alloc_init(void);
+extern void ft_init(void *dt_blob);
+extern int serial_console_init(void);
+
+static inline void *finddevice(const char *name)
+{
+ return (dt_ops.finddevice) ? dt_ops.finddevice(name) : NULL;
+}
+
+static inline int getprop(void *devp, const char *name, void *buf, int buflen)
+{
+ return (dt_ops.getprop) ? dt_ops.getprop(devp, name, buf, buflen) : -1;
+}
+
+static inline int setprop(void *devp, const char *name, void *buf, int buflen)
+{
+ return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1;
+}
+
+static inline void *malloc(u32 size)
+{
+ return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL;
+}
+
+static inline void free(void *ptr, u32 size)
+{
+ if (platform_ops.free)
+ platform_ops.free(ptr, size);
+}
+
+static inline void exit(void)
+{
+ if (platform_ops.exit)
+ platform_ops.exit();
+ for(;;);
+}
+
+#endif /* _PPC_BOOT_OPS_H_ */
next prev parent reply other threads:[~2006-09-19 4:29 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-19 3:21 [PATCH] Start arch/powerpc/boot code reorganization Paul Mackerras
2006-09-19 4:22 ` Michael Ellerman
2006-09-19 4:29 ` Paul Mackerras [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-09-19 23:00 Paul Mackerras
2006-09-20 1:20 ` Mark A. Greer
2006-09-20 1:28 ` Mark A. Greer
2006-09-20 20:58 ` Mark A. Greer
2006-09-20 3:10 ` Josh Boyer
2006-09-20 20:23 ` Segher Boessenkool
2006-09-20 21:04 ` Josh Boyer
2006-09-20 21:32 ` Benjamin Herrenschmidt
2006-09-20 21:57 ` Mark A. Greer
2006-09-21 0:07 ` Segher Boessenkool
2006-09-21 13:37 ` Matt Porter
2006-09-21 14:15 ` Jon Loeliger
2006-09-21 14:26 ` Matt Porter
2006-09-21 15:31 ` Segher Boessenkool
2006-09-22 1:24 ` Mark A. Greer
2006-09-22 8:43 ` Segher Boessenkool
2006-09-22 18:59 ` Mark A. Greer
2006-09-22 19:36 ` Sergei Shtylyov
2006-09-22 20:40 ` Mark A. Greer
2006-09-22 20:43 ` Sergei Shtylyov
2006-09-22 20:52 ` Mark A. Greer
2006-09-22 20:56 ` Sergei Shtylyov
2006-09-23 0:57 ` Segher Boessenkool
2006-09-23 15:48 ` Sergei Shtylyov
2006-09-23 0:54 ` Segher Boessenkool
2006-09-23 8:18 ` Mark A. Greer
2006-09-23 10:15 ` Segher Boessenkool
2006-09-25 17:53 ` Mark A. Greer
2006-09-25 23:40 ` Segher Boessenkool
2006-09-25 23:44 ` Segher Boessenkool
2006-09-25 23:46 ` Mark A. Greer
2006-09-28 20:53 ` Sergei Shtylyov
2006-09-30 8:36 ` Segher Boessenkool
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17679.29206.548556.979379@cargo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=Linuxppc-dev@ozlabs.org \
--cc=michael@ellerman.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).