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
);
26 void * (*realloc
)(void *ptr
, unsigned long size
);
29 extern struct platform_ops platform_ops
;
31 /* Device Tree operations */
33 void * (*finddevice
)(const char *name
);
34 int (*getprop
)(const void *phandle
, const char *name
, void *buf
,
36 int (*setprop
)(const void *phandle
, const char *name
,
37 const void *buf
, const int buflen
);
38 unsigned long (*finalize
)(void);
40 extern struct dt_ops dt_ops
;
42 /* Console operations */
45 void (*write
)(char *buf
, int len
);
46 void (*edit_cmdline
)(char *buf
, int len
);
50 extern struct console_ops console_ops
;
52 /* Serial console operations */
53 struct serial_console_data
{
55 void (*putc
)(unsigned char c
);
56 unsigned char (*getc
)(void);
61 int platform_init(void *promptr
, char *dt_blob_start
, char *dt_blob_end
);
62 int ft_init(void *dt_blob
, unsigned int max_size
, unsigned int max_find_device
);
63 int serial_console_init(void);
64 int ns16550_console_init(void *devp
, struct serial_console_data
*scdp
);
65 void *simple_alloc_init(char *base
, u32 heap_size
, u32 granularity
,
69 static inline void *finddevice(const char *name
)
71 return (dt_ops
.finddevice
) ? dt_ops
.finddevice(name
) : NULL
;
74 static inline int getprop(void *devp
, const char *name
, void *buf
, int buflen
)
76 return (dt_ops
.getprop
) ? dt_ops
.getprop(devp
, name
, buf
, buflen
) : -1;
79 static inline int setprop(void *devp
, const char *name
, void *buf
, int buflen
)
81 return (dt_ops
.setprop
) ? dt_ops
.setprop(devp
, name
, buf
, buflen
) : -1;
84 static inline void *malloc(u32 size
)
86 return (platform_ops
.malloc
) ? platform_ops
.malloc(size
) : NULL
;
89 static inline void free(void *ptr
)
91 if (platform_ops
.free
)
92 platform_ops
.free(ptr
);
95 static inline void exit(void)
97 if (platform_ops
.exit
)
102 #endif /* _PPC_BOOT_OPS_H_ */