2 * Global definition of all the bootwrapper operations.
4 * Author: Mark A. Greer <mgreer@mvista.com>
6 * 2006 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
11 #ifndef _PPC_BOOT_OPS_H_
12 #define _PPC_BOOT_OPS_H_
16 #define COMMAND_LINE_SIZE 512
17 #define MAX_PATH_LEN 256
18 #define MAX_PROP_LEN 256 /* What should this be? */
20 /* Platform specific operations */
23 void (*image_hdr)(const void *);
24 void * (*malloc)(u32 size);
25 void (*free)(void *ptr, u32 size);
28 extern struct platform_ops platform_ops;
30 /* Device Tree operations */
32 void * (*finddevice)(const char *name);
33 int (*getprop)(const void *node, const char *name, void *buf,
35 int (*setprop)(const void *node, const char *name,
36 const void *buf, const int buflen);
37 u64 (*translate_addr)(const char *path, const u32 *in_addr,
39 unsigned long (*ft_addr)(void);
41 extern struct dt_ops dt_ops;
43 /* Console operations */
46 void (*write)(char *buf, int len);
47 void (*edit_cmdline)(char *buf, int len);
51 extern struct console_ops console_ops;
53 /* Serial console operations */
54 struct serial_console_data {
56 void (*putc)(unsigned char c);
57 unsigned char (*getc)(void);
62 extern int platform_init(void *promptr);
63 extern void simple_alloc_init(void);
64 extern void ft_init(void *dt_blob);
65 extern int serial_console_init(void);
67 static inline void *finddevice(const char *name)
69 return (dt_ops.finddevice) ? dt_ops.finddevice(name) : NULL;
72 static inline int getprop(void *devp, const char *name, void *buf, int buflen)
74 return (dt_ops.getprop) ? dt_ops.getprop(devp, name, buf, buflen) : -1;
77 static inline int setprop(void *devp, const char *name, void *buf, int buflen)
79 return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1;
82 static inline void *malloc(u32 size)
84 return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL;
87 static inline void free(void *ptr, u32 size)
89 if (platform_ops.free)
90 platform_ops.free(ptr, size);
93 static inline void exit(void)
95 if (platform_ops.exit)
100 #endif /* _PPC_BOOT_OPS_H_ */