OMAP: DISPC: Fix to disable also interface clocks. 2nd.
[linux-ginger.git] / arch / ppc / boot / of1275 / call_prom.c
blob9479a3a2b8c7a8ae7eef0dfdd0bd9e6ab2c9f503
1 /*
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.
8 */
10 #include "of1275.h"
11 #include <stdarg.h>
13 int call_prom(const char *service, int nargs, int nret, ...)
15 int i;
16 struct prom_args {
17 const char *service;
18 int nargs;
19 int nret;
20 unsigned int args[12];
21 } args;
22 va_list list;
24 args.service = service;
25 args.nargs = nargs;
26 args.nret = nret;
28 va_start(list, nret);
29 for (i = 0; i < nargs; i++)
30 args.args[i] = va_arg(list, unsigned int);
31 va_end(list);
33 for (i = 0; i < nret; i++)
34 args.args[nargs+i] = 0;
36 if (of_prom_entry(&args) < 0)
37 return -1;
39 return (nret > 0)? args.args[nargs]: 0;
42 int call_prom_ret(const char *service, int nargs, int nret,
43 unsigned int *rets, ...)
45 int i;
46 struct prom_args {
47 const char *service;
48 int nargs;
49 int nret;
50 unsigned int args[12];
51 } args;
52 va_list list;
54 args.service = service;
55 args.nargs = nargs;
56 args.nret = nret;
58 va_start(list, rets);
59 for (i = 0; i < nargs; i++)
60 args.args[i] = va_arg(list, unsigned int);
61 va_end(list);
63 for (i = 0; i < nret; i++)
64 args.args[nargs+i] = 0;
66 if (of_prom_entry(&args) < 0)
67 return -1;
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;