41121c9d736a2cb16dba7821231689a43d8eba9d
[openwrt.git] / target / linux / adm5120 / files / include / asm-mips / mach-adm5120 / prom / routerboot.h
1 /*
2  *  $Id$
3  *
4  *  Mikrotik's RouterBOOT definitions
5  *
6  *  Copyright (C) 2007 OpenWrt.org
7  *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
8  *
9  *  This program is free software; you can redistribute it and/or
10  *  modify it under the terms of the GNU General Public License
11  *  as published by the Free Software Foundation; either version 2
12  *  of the License, or (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the
21  *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  *  Boston, MA  02110-1301, USA.
23  */
24
25 #ifndef _ROUTERBOOT_H
26 #define _ROUTERBOOT_H
27
28 #define RB_MAC_SIZE             6
29
30 struct rb_bios_settings {
31         u32     hs_offs; /* hard settings offset */
32         u32     hs_size; /* hard settings size */
33         u32     fw_offs; /* firmware offset */
34         u32     ss_offs; /* soft settings offset */
35         u32     ss_size; /* soft settings size */
36 };
37
38 struct rb_hard_settings {
39         char    *name;          /* board name */
40         char    *bios_ver;      /* BIOS version */
41         u32     mem_size;       /* memory size in bytes */
42         u32     mac_count;      /* number of mac addresses */
43         u8      *mac_base;      /* mac address base */
44 };
45
46 /*
47  * Magic numbers
48  */
49 #define RB_MAGIC_HARD   0x64726148 /* "Hard" */
50 #define RB_MAGIC_SOFT   0x74666F53 /* "Soft" */
51 #define RB_MAGIC_DAWN   0x6E776144 /* "Dawn" */
52
53 #define RB_ID_TERMINATOR        0
54
55 /*
56  * ID values for Hardware settings
57  */
58 #define RB_ID_HARD_01           1
59 #define RB_ID_HARD_02           2
60 #define RB_ID_FLASH_INFO        3
61 #define RB_ID_MAC_ADDRESS_PACK  4
62 #define RB_ID_BOARD_NAME        5
63 #define RB_ID_BIOS_VERSION      6
64 #define RB_ID_HARD_07           7
65 #define RB_ID_SDRAM_TIMINGS     8
66 #define RB_ID_DEVICE_TIMINGS    9
67 #define RB_ID_SOFTWARE_ID       10
68 #define RB_ID_SERIAL_NUMBER     11
69 #define RB_ID_HARD_12           12
70 #define RB_ID_MEMORY_SIZE       13
71 #define RB_ID_MAC_ADDRESS_COUNT 14
72
73 /*
74  * ID values for Software settings
75  */
76 #define RB_ID_UART_SPEED        1
77 #define RB_ID_BOOT_DELAY        2
78 #define RB_ID_BOOT_DEVICE       3
79 #define RB_ID_BOOT_KEY          4
80 #define RB_ID_CPU_MODE          5
81 #define RB_ID_FW_VERSION        6
82 #define RB_ID_SOFT_07           7
83 #define RB_ID_SOFT_08           8
84 #define RB_ID_BOOT_PROTOCOL     9
85 #define RB_ID_SOFT_10           10
86 #define RB_ID_SOFT_11           11
87
88 /*
89  * UART_SPEED values
90  */
91 #define RB_UART_SPEED_115200    0
92 #define RB_UART_SPEED_57600     1
93 #define RB_UART_SPEED_38400     2
94 #define RB_UART_SPEED_19200     3
95 #define RB_UART_SPEED_9600      4
96 #define RB_UART_SPEED_4800      5
97 #define RB_UART_SPEED_2400      6
98 #define RB_UART_SPEED_1200      7
99
100 /*
101  * BOOT_DELAY values
102  */
103 #define RB_BOOT_DELAY_0SEC      0
104 #define RB_BOOT_DELAY_1SEC      1
105 #define RB_BOOT_DELAY_2SEC      2
106
107 /*
108  * BOOT_DEVICE values
109  */
110 #define RB_BOOT_DEVICE_ETHER    0
111 #define RB_BOOT_DEVICE_NANDETH  1
112 #define RB_BOOT_DEVICE_ETHONCE  2
113 #define RB_BOOT_DEVICE_NANDONLY 3
114
115 /*
116  * BOOT_KEY values
117  */
118 #define RB_BOOT_KEY_ANY         0
119 #define RB_BOOT_KEY_DEL         1
120
121 /*
122  * CPU_MODE values
123  */
124 #define RB_CPU_MODE_POWERSAVE   0
125 #define RB_CPU_MODE_REGULAR     1
126
127 /*
128  * BOOT_PROTOCOL values
129  */
130 #define RB_BOOT_PROTOCOL_BOOTP  0
131 #define RB_BOOT_PROTOCOL_DHCP   1
132
133 extern int routerboot_present(void) __init;
134 extern char *routerboot_get_boardname(void);
135
136 extern struct rb_hard_settings rb_hs;
137
138 #endif /* _ROUTERBOOT_H */