11 #ifndef _PPC_BOOT_OPS_H_
12 #define _PPC_BOOT_OPS_H_
18 #define COMMAND_LINE_SIZE 512
19 #define MAX_PATH_LEN 256
20 #define MAX_PROP_LEN 256
28 void * (*malloc)(
unsigned long size);
30 void * (*realloc)(
void *
ptr,
unsigned long size);
32 void * (*vmlinux_alloc)(
unsigned long size);
38 void * (*finddevice)(
const char *
name);
46 void *(*create_node)(
const void *
parent,
const char *
name);
47 void *(*find_node_by_prop_value)(
const void *
prev,
49 const char *propval,
int proplen);
50 void *(*find_node_by_compatible)(
const void *
prev,
93 unsigned long granularity,
unsigned long max_allocs);
101 static inline void *finddevice(
const char *
name)
106 static inline int getprop(
void *devp,
const char *name,
void *
buf,
int buflen)
111 static inline int setprop(
void *devp,
const char *name,
112 const void *buf,
int buflen)
116 #define setprop_val(devp, name, val) \
118 typeof(val) x = (val); \
119 setprop((devp), (name), &x, sizeof(x)); \
122 static inline int setprop_str(
void *devp,
const char *name,
const char *buf)
130 static inline int del_node(
const void *devp)
135 static inline void *get_parent(
const char *devp)
140 static inline void *create_node(
const void *parent,
const char *name)
146 static inline void *find_node_by_prop_value(
const void *
prev,
147 const char *propname,
148 const char *propval,
int proplen)
157 static inline void *find_node_by_prop_value_str(
const void *prev,
158 const char *propname,
161 return find_node_by_prop_value(prev, propname, propval,
165 static inline void *find_node_by_devtype(
const void *prev,
168 return find_node_by_prop_value_str(prev,
"device_type", type);
171 static inline void *find_node_by_alias(
const char *
alias)
173 void *devp = finddevice(
"/aliases");
178 return finddevice(path);
184 static inline void *find_node_by_compatible(
const void *prev,
199 #define dt_fixup_mac_addresses(...) \
200 __dt_fixup_mac_addresses(0, __VA_ARGS__, NULL)
203 static inline void *find_node_by_linuxphandle(
const u32 linuxphandle)
205 return find_node_by_prop_value(
NULL,
"linux,phandle",
206 (
char *)&linuxphandle,
sizeof(
u32));
209 static inline char *get_path(
const void *
phandle,
char *buf,
int len)
217 static inline void *
malloc(
unsigned long size)
222 static inline void free(
void *
ptr)
228 static inline void exit(
void)
234 #define fatal(args...) { printf(args); exit(); }
237 #define BSS_STACK(size) \
238 static char _bss_stack[size]; \
239 void *_platform_stack_top = _bss_stack + sizeof(_bss_stack);
258 asm (
"cntlzw %0,%1" :
"=r" (
bit) :
"r" (n));