ar71xx: add some RouterBOOT specific helper functions
[openwrt/openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / routerboot.h
1 /*
2 * RouterBoot definitions
3 *
4 * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 */
10
11 #ifndef _ATH79_ROUTERBOOT_H_
12 #define _ATH79_ROUTERBOOT_H_
13
14 struct rb_info {
15 unsigned int hard_cfg_offs;
16 unsigned int hard_cfg_size;
17 void *hard_cfg_data;
18 unsigned int soft_cfg_offs;
19
20 const char *board_name;
21 u32 hw_options;
22 };
23
24 #ifdef CONFIG_ATH79_ROUTERBOOT
25 const struct rb_info *rb_init_info(void *data, unsigned int size);
26 void *rb_get_wlan_data(void);
27
28 int routerboot_find_tag(u8 *buf, unsigned int buflen, u16 tag_id,
29 u8 **tag_data, u16 *tag_len);
30 int routerboot_find_magic(u8 *buf, unsigned int buflen, u32 *offset, bool hard);
31 #else
32 static inline const struct rb_info *
33 rb_init_info(void *data, unsigned int size)
34 {
35 return NULL;
36 }
37
38 static inline void *rb_get_wlan_data(void)
39 {
40 return NULL;
41 }
42
43 static inline int
44 routerboot_find_tag(u8 *buf, unsigned int buflen, u16 tag_id,
45 u8 **tag_data, u16 *tag_len)
46 {
47 return -ENOENT;
48 }
49
50 static inline int
51 routerboot_find_magic(u8 *buf, unsigned int buflen, u32 *offset, bool hard)
52 {
53 return -ENOENT;
54 }
55 #endif
56
57 #endif /* _ATH79_ROUTERBOOT_H_ */