xref: /openbmc/u-boot/include/hwconfig.h (revision a380279b)
1 /*
2  * An inteface for configuring a hardware via u-boot environment.
3  *
4  * Copyright (c) 2009  MontaVista Software, Inc.
5  *
6  * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  */
13 
14 #ifndef _HWCONFIG_H
15 #define _HWCONFIG_H
16 
17 #include <linux/types.h>
18 #include <asm/errno.h>
19 
20 #ifdef CONFIG_HWCONFIG
21 
22 extern int hwconfig(const char *opt);
23 extern const char *hwconfig_arg(const char *opt, size_t *arglen);
24 extern int hwconfig_arg_cmp(const char *opt, const char *arg);
25 extern int hwconfig_sub(const char *opt, const char *subopt);
26 extern const char *hwconfig_subarg(const char *opt, const char *subopt,
27 				   size_t *subarglen);
28 extern int hwconfig_subarg_cmp(const char *opt, const char *subopt,
29 			       const char *subarg);
30 
31 #else
32 
33 static inline int hwconfig(const char *opt)
34 {
35 	return -ENOSYS;
36 }
37 
38 static inline const char *hwconfig_arg(const char *opt, size_t *arglen)
39 {
40 	*arglen = 0;
41 	return "";
42 }
43 
44 static inline int hwconfig_arg_cmp(const char *opt, const char *arg)
45 {
46 	return -ENOSYS;
47 }
48 
49 static inline int hwconfig_sub(const char *opt, const char *subopt)
50 {
51 	return -ENOSYS;
52 }
53 
54 static inline const char *hwconfig_subarg(const char *opt, const char *subopt,
55 					  size_t *subarglen)
56 {
57 	*subarglen = 0;
58 	return "";
59 }
60 
61 static inline int hwconfig_subarg_cmp(const char *opt, const char *subopt,
62 				      const char *subarg)
63 {
64 	return -ENOSYS;
65 }
66 
67 #endif /* CONFIG_HWCONFIG */
68 
69 #endif /* _HWCONFIG_H */
70