1 /*
2  *   Creation Date: <2002/10/03 21:07:27 samuel>
3  *   Time-stamp: <2003/10/22 22:45:26 samuel>
4  *
5  *	<prom.h>
6  *
7  *	device tree interface
8  *
9  *   Copyright (C) 2002, 2003 Samuel Rydh (samuel@ibrium.se)
10  *
11  *   This program is free software; you can redistribute it and/or
12  *   modify it under the terms of the GNU General Public License
13  *   as published by the Free Software Foundation
14  *
15  */
16 
17 #ifndef _H_PROM
18 #define _H_PROM
19 
20 /* Note 1: MOL uses -1 as the invalid phandle while OpenFirmware uses 0 as the
21  * invalid phandle (it is also the root node).
22  *
23  * Note 2: phandles might be negative. For instance, phandles originating from
24  * a real Open Firmware tree might look like 0xff123000 (a ROM address)...
25  */
26 
27 typedef enum { kGetRootPhandle=0 } mol_phandle_t;	/* must promote to int */
28 
29 extern int			prom_close( void );
30 
31 extern mol_phandle_t		prom_peer( mol_phandle_t phandle );
32 extern mol_phandle_t		prom_child( mol_phandle_t phandle );
33 extern mol_phandle_t		prom_parent( mol_phandle_t phandle );
34 extern int			prom_package_to_path( mol_phandle_t phandle, char *buf, long buflen );
35 extern int			prom_get_prop_len( mol_phandle_t phandle, const char *name );
36 extern int			prom_get_prop( mol_phandle_t phandle, const char *name, char *buf, long buflen );
37 extern int			prom_get_prop_by_path( const char *path, const char *name, char *buf, long buflen );
38 extern int			prom_next_prop( mol_phandle_t phandle, const char *prev, char *buf );
39 extern int			prom_set_prop( mol_phandle_t phandle, const char *name, char *buf, long buflen );
40 extern mol_phandle_t		prom_create_node( const char *path );
41 extern mol_phandle_t		prom_find_device( const char *path );
42 
43 extern mol_phandle_t		prom_find_device_type( const char *type, int index );
44 
45 extern int			prom_change_phandle( mol_phandle_t old_ph, mol_phandle_t new_ph );
46 
47 #endif   /* _H_PROM */
48