2 * Copyright (C) 1996-2005 Paul Mackerras.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
13 int call_prom(const char *service
, int nargs
, int nret
, ...)
20 unsigned int args
[12];
24 args
.service
= service
;
29 for (i
= 0; i
< nargs
; i
++)
30 args
.args
[i
] = va_arg(list
, unsigned int);
33 for (i
= 0; i
< nret
; i
++)
34 args
.args
[nargs
+i
] = 0;
36 if (of_prom_entry(&args
) < 0)
39 return (nret
> 0)? args
.args
[nargs
]: 0;
42 int call_prom_ret(const char *service
, int nargs
, int nret
,
43 unsigned int *rets
, ...)
50 unsigned int args
[12];
54 args
.service
= service
;
59 for (i
= 0; i
< nargs
; i
++)
60 args
.args
[i
] = va_arg(list
, unsigned int);
63 for (i
= 0; i
< nret
; i
++)
64 args
.args
[nargs
+i
] = 0;
66 if (of_prom_entry(&args
) < 0)
69 if (rets
!= (void *) 0)
70 for (i
= 1; i
< nret
; ++i
)
71 rets
[i
-1] = args
.args
[nargs
+i
];
73 return (nret
> 0)? args
.args
[nargs
]: 0;