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_
17 #define COMMAND_LINE_SIZE 512
18 #define MAX_PATH_LEN 256
19 #define MAX_PROP_LEN 256 /* What should this be? */
21 /* Platform specific operations */
24 void (*image_hdr)(const void *);
25 void * (*malloc)(u32 size);
26 void (*free)(void *ptr);
27 void * (*realloc)(void *ptr, unsigned long size);
29 void * (*vmlinux_alloc)(unsigned long size);
31 extern struct platform_ops platform_ops;
33 /* Device Tree operations */
35 void * (*finddevice)(const char *name);
36 int (*getprop)(const void *phandle, const char *name, void *buf,
38 int (*setprop)(const void *phandle, const char *name,
39 const void *buf, const int buflen);
40 unsigned long (*finalize)(void);
42 extern struct dt_ops dt_ops;
44 /* Console operations */
47 void (*write)(char *buf, int len);
48 void (*edit_cmdline)(char *buf, int len);
52 extern struct console_ops console_ops;
54 /* Serial console operations */
55 struct serial_console_data {
57 void (*putc)(unsigned char c);
58 unsigned char (*getc)(void);
65 unsigned long initrd_addr, initrd_size;
67 extern struct loader_info loader_info;
70 int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device);
71 int serial_console_init(void);
72 int ns16550_console_init(void *devp, struct serial_console_data *scdp);
73 void *simple_alloc_init(char *base, u32 heap_size, u32 granularity,
77 static inline void *finddevice(const char *name)
79 return (dt_ops.finddevice) ? dt_ops.finddevice(name) : NULL;
82 static inline int getprop(void *devp, const char *name, void *buf, int buflen)
84 return (dt_ops.getprop) ? dt_ops.getprop(devp, name, buf, buflen) : -1;
87 static inline int setprop(void *devp, const char *name, void *buf, int buflen)
89 return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1;
92 static inline void *malloc(u32 size)
94 return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL;
97 static inline void free(void *ptr)
99 if (platform_ops.free)
100 platform_ops.free(ptr);
103 static inline void exit(void)
105 if (platform_ops.exit)
110 #define BSS_STACK(size) \
111 static char _bss_stack[size]; \
112 void *_platform_stack_top = _bss_stack + sizeof(_bss_stack);
114 #endif /* _PPC_BOOT_OPS_H_ */