xref: /aosp_15_r20/external/coreboot/src/device/oprom/yabel/compat/of.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /******************************************************************************
2  * Copyright (c) 2004, 2008 IBM Corporation
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * Redistributions of source code must retain the above copyright
11  *   notice, this list of conditions and the following disclaimer.
12  *
13  * Redistributions in binary form must reproduce the above copyright
14  *   notice, this list of conditions and the following disclaimer
15  *   in the documentation and/or other materials provided with the
16  *   distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * Contributors:
31  *     IBM Corporation - initial implementation
32  *****************************************************************************/
33 
34 #ifndef OF_H
35 #define OF_H
36 #define p32 int
37 #define p32cast (int) (unsigned long) (void *)
38 
39 #define phandle_t p32
40 #define ihandle_t p32
41 
42 typedef struct
43 {
44 	unsigned int serv;
45 	int nargs;
46 	int nrets;
47 	unsigned int args[16];
48 } of_arg_t;
49 
50 phandle_t of_finddevice (const char *);
51 phandle_t of_peer(phandle_t);
52 phandle_t of_child(phandle_t);
53 phandle_t of_parent(phandle_t);
54 int of_getprop(phandle_t, const char *, void *, int);
55 void *of_call_method_3(const char *, ihandle_t, int);
56 
57 ihandle_t of_open(const char *);
58 void of_close(ihandle_t);
59 int of_read(ihandle_t, void *, int);
60 int of_write(ihandle_t, void *, int);
61 int of_seek(ihandle_t, int, int);
62 
63 void *of_claim(void *, unsigned int, unsigned int);
64 void of_release(void *, unsigned int);
65 
66 int of_yield(void);
67 void *of_set_callback(void *);
68 
69 int vpd_read(unsigned int, unsigned int, char *);
70 int vpd_write(unsigned int, unsigned int, char *);
71 int write_mm_log(char *, unsigned int, unsigned short);
72 
73 #endif
74