1/* 2 * BK Id: SCCS/s.of1275.h 1.6 05/18/01 15:16:42 cort 3 */ 4/* 6.3.2.1 Client interface */ 5 6 7typedef struct _of_test_service { 8 const char *service; 9 int n_args; 10 int n_returns; 11 /*in*/ 12 const char *name; 13 /*out*/ 14 int missing; 15} of_test_service; 16 17int of_test(const char *name, int *missing); 18 19 20/* 6.3.2.2 Device tree */ 21 22 23typedef struct _of_peer_service { 24 const char *service; 25 int n_args; 26 int n_returns; 27 /*in*/ 28 int phandle; 29 /*out*/ 30 int sibling_phandle; 31} of_peer_service; 32 33int of_peer(int phandle, int *sibling_phandle); 34 35 36typedef struct _of_child_service { 37 const char *service; 38 int n_args; 39 int n_returns; 40 /*in*/ 41 int phandle; 42 /*out*/ 43 int child_phandle; 44} of_child_service; 45 46int of_child(int phandle, int *child_phandle); 47 48 49typedef struct _of_parent_service { 50 const char *service; 51 int n_args; 52 int n_returns; 53 /*in*/ 54 int phandle; 55 /*out*/ 56 int parent_phandle; 57} of_parent_service; 58 59int of_child(int phandle, int *parent_phandle); 60 61 62typedef struct _of_instance_to_package_service { 63 const char *service; 64 int n_args; 65 int n_returns; 66 /*in*/ 67 int ihandle; 68 /*out*/ 69 int phandle; 70} of_instance_to_package_service; 71 72int of_instance_to_package(int ihandle, int *phandle); 73 74 75typedef struct _of_getproplen_service { 76 const char *service; 77 int n_args; 78 int n_returns; 79 /*in*/ 80 int phandle; 81 const char *name; 82 /*out*/ 83 int proplen; 84} of_getproplen_service; 85 86int of_getproplen(int phandle, const char *name, int *proplen); 87 88 89typedef struct _of_getprop_service { 90 const char *service; 91 int n_args; 92 int n_returns; 93 /*in*/ 94 int phandle; 95 const char *name; 96 void *buf; 97 int buflen; 98 /*out*/ 99 int size; 100} of_getprop_service; 101 102int of_getprop(int phandle, const char *name, void *buf, int buflen, 103 int *size); 104 105 106typedef struct _of_nextprop_service { 107 const char *service; 108 int n_args; 109 int n_returns; 110 /*in*/ 111 int phandle; 112 const char *previous; 113 void *buf; 114 /*out*/ 115 int flag; 116} of_nextprop_service; 117 118int of_nextprop(int phandle, const char *previous, void *buf, int *flag); 119 120 121typedef struct _of_setprop_service { 122 const char *service; 123 int n_args; 124 int n_returns; 125 /*in*/ 126 int phandle; 127 const char *name; 128 void *buf; 129 int len; 130 /*out*/ 131 int size; 132} of_setprop_service; 133 134int of_setprop(int phandle, const char *name, void *buf, int len, int *size); 135 136 137typedef struct _of_canon_service { 138 const char *service; 139 int n_args; 140 int n_returns; 141 /*in*/ 142 const char *device_specifier; 143 void *buf; 144 int buflen; 145 /*out*/ 146 int length; 147} of_canon_service; 148 149int of_canon(const char *device_specifier, void *buf, int buflen, int *length); 150 151 152typedef struct _of_finddevice_service { 153 const char *service; 154 int n_args; 155 int n_returns; 156 /*in*/ 157 const char *device_specifier; 158 /*out*/ 159 int phandle; 160} of_finddevice_service; 161 162int of_finddevice(const char *device_specifier, int *phandle); 163 164 165typedef struct _of_instance_to_path_service { 166 const char *service; 167 int n_args; 168 int n_returns; 169 /*in*/ 170 int ihandle; 171 void *buf; 172 int buflen; 173 /*out*/ 174 int length; 175} of_instance_to_path_service; 176 177int of_instance_to_path(int ihandle, void *buf, int buflen, int *length); 178 179 180typedef struct _of_package_to_path_service { 181 const char *service; 182 int n_args; 183 int n_returns; 184 /*in*/ 185 int phandle; 186 void *buf; 187 int buflen; 188 /*out*/ 189 int length; 190} of_package_to_path_service; 191 192int of_package_to_path(int phandle, void *buf, int buflen, int *length); 193 194 195typedef struct _of_call_method_service { 196 const char *service; 197 int n_args; 198 int n_returns; 199 /*in*/ 200 const char *method; 201 int ihandle; 202 /*...*/ 203 int args[0]; 204} of_call_method_service; 205 206int of_call_method(const char *method, int ihandle, ...); 207 208 209/* 6.3.2.3 Device I/O */ 210 211 212typedef struct _of_open_service { 213 const char *service; 214 int n_args; 215 int n_returns; 216 /*in*/ 217 const char *device_specifier; 218 /*out*/ 219 int ihandle; 220} of_open_service; 221 222int of_open(const char *device_specifier, 223 int *ihandle); 224 225 226typedef struct _of_close_service { 227 const char *service; 228 int n_args; 229 int n_returns; 230 /*in*/ 231 int ihandle; 232 /*out*/ 233} of_close_service; 234 235int of_close(int ihandle); 236 237 238typedef struct _of_read_service { 239 const char *service; 240 int n_args; 241 int n_returns; 242 /*in*/ 243 int ihandle; 244 void *addr; 245 int len; 246 /*out*/ 247 int actual; 248} of_read_service; 249 250int of_read(int ihandle, void *addr, int len, int *actual); 251 252 253typedef struct _of_write_service { 254 const char *service; 255 int n_args; 256 int n_returns; 257 /*in*/ 258 int ihandle; 259 void *addr; 260 int len; 261 /*out*/ 262 int actual; 263} of_write_service; 264 265int of_write(int ihandle, void *addr, int len, int *actual); 266 267 268typedef struct _of_seek_service { 269 const char *service; 270 int n_args; 271 int n_returns; 272 /*in*/ 273 int ihandle; 274 int pos_hi; 275 int pos_lo; 276 /*out*/ 277 int status; 278} of_seek_service; 279 280int of_seek(int ihandle, int pos_hi, int pos_lo, int *status); 281 282 283/* 6.3.2.4 Memory */ 284 285 286typedef struct _of_claim_service { 287 const char *service; 288 int n_args; 289 int n_returns; 290 /*in*/ 291 void *virt; 292 int size; 293 int align; 294 /*out*/ 295 void *baseaddr; 296} of_claim_service; 297 298int of_claim(void *virt, int size, int align, void **baseaddr); 299 300 301typedef struct _of_release_service { 302 const char *service; 303 int n_args; 304 int n_returns; 305 /*in*/ 306 void *virt; 307 int size; 308 int align; 309 /*out*/ 310} of_release_service; 311 312int of_release(void *virt, int size); 313 314 315/* 6.3.2.5 Control transfer */ 316 317 318typedef struct _of_boot_service { 319 const char *service; 320 int n_args; 321 int n_returns; 322 /*in*/ 323 const char *bootspec; 324 /*out*/ 325} of_boot_service; 326 327int of_boot(const char *bootspec); 328 329 330typedef struct _of_enter_service { 331 const char *service; 332 int n_args; 333 int n_returns; 334 /*in*/ 335 /*out*/ 336} of_enter_service; 337 338int of_enter(void); 339 340 341typedef struct _of_exit_service { 342 const char *service; 343 int n_args; 344 int n_returns; 345 /*in*/ 346 /*out*/ 347} of_exit_service; 348 349int of_exit(void); 350 351 352typedef struct _of_chain_service { 353 const char *service; 354 int n_args; 355 int n_returns; 356 /*in*/ 357 void *virt; 358 int size; 359 void *entry; 360 void *args; 361 int len; 362 /*out*/ 363} of_chain_service; 364 365int of_chain(void *virt, int size, void *entry, void *args, int len); 366 367 368/* 6.3.2.6 User interface */ 369 370 371typedef struct _of_interpret_service { 372 const char *service; 373 int n_args; 374 int n_returns; 375 /*in*/ 376 const char *cmd; 377 int args[0]; 378 /*...*/ 379 /*out*/ 380 /*...*/ 381} of_interpret_service; 382 383int of_interpret(const char *arg, ...); 384 385 386typedef struct _of_set_callback_service { 387 const char *service; 388 int n_args; 389 int n_returns; 390 /*in*/ 391 void *newfunc; 392 /*out*/ 393 void *oldfunc; 394} of_set_callback_service; 395 396int of_set_callback(void *newfunc, void **oldfunc); 397 398 399typedef struct _of_set_symbol_lookup_service { 400 const char *service; 401 int n_args; 402 int n_returns; 403 /*in*/ 404 void *sym_to_value; 405 void *value_to_sym; 406 /*out*/ 407} of_set_symbol_lookup_service; 408 409int of_set_symbol_lookup(void *sym_to_value, void *value_to_sym); 410 411 412/* 6.3.2.7 Time */ 413 414 415typedef struct _of_milliseconds_service { 416 const char *service; 417 int n_args; 418 int n_returns; 419 /*in*/ 420 /*out*/ 421 int ms; 422} of_milliseconds_service; 423 424int of_milliseconds(int *ms); 425