ea8db81ed3fbc732bb78177564dc57e679580944
[openwrt.git] / target / linux / adm5120 / files-2.6.28 / arch / mips / include / asm / mach-adm5120 / prom / myloader.h
1 /*
2 * Compex's MyLoader specific definitions
3 *
4 * Copyright (C) 2006-2008 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
12 #ifndef _MYLOADER_H_
13 #define _MYLOADER_H_
14
15 /*
16 * Firmware file format:
17 *
18 * <header>
19 * [<block descriptor 0>]
20 * ...
21 * [<block descriptor n>]
22 * <null block descriptor>
23 * [<block data 0>]
24 * ...
25 * [<block data n>]
26 *
27 *
28 */
29
30 /* Myloader specific magic numbers */
31 #define MYLO_MAGIC_FIRMWARE 0x4C594D00
32 #define MYLO_MAGIC_20021103 0x20021103
33 #define MYLO_MAGIC_20021107 0x20021107
34
35 #define MYLO_MAGIC_SYS_PARAMS MYLO_MAGIC_20021107
36 #define MYLO_MAGIC_PARTITIONS MYLO_MAGIC_20021103
37 #define MYLO_MAGIC_BOARD_PARAMS MYLO_MAGIC_20021103
38
39 /*
40 * Addresses of the data structures provided by MyLoader
41 */
42 #define MYLO_MIPS_SYS_PARAMS 0x80000800 /* System Parameters */
43 #define MYLO_MIPS_BOARD_PARAMS 0x80000A00 /* Board Parameters */
44 #define MYLO_MIPS_PARTITIONS 0x80000C00 /* Partition Table */
45 #define MYLO_MIPS_BOOT_PARAMS 0x80000E00 /* Boot Parameters */
46
47 /* Vendor ID's (seems to be same as the PCI vendor ID's) */
48 #define VENID_COMPEX 0x11F6
49
50 /* Devices based on the ADM5120 */
51 #define DEVID_COMPEX_NP27G 0x0078
52 #define DEVID_COMPEX_NP28G 0x044C
53 #define DEVID_COMPEX_NP28GHS 0x044E
54 #define DEVID_COMPEX_WP54Gv1C 0x0514
55 #define DEVID_COMPEX_WP54G 0x0515
56 #define DEVID_COMPEX_WP54AG 0x0546
57 #define DEVID_COMPEX_WPP54AG 0x0550
58 #define DEVID_COMPEX_WPP54G 0x0555
59
60 /* Devices based on the IXP422 */
61 #define DEVID_COMPEX_WP18 0x047E
62 #define DEVID_COMPEX_NP18A 0x0489
63
64 /* Other devices */
65 #define DEVID_COMPEX_NP26G8M 0x03E8
66 #define DEVID_COMPEX_NP26G16M 0x03E9
67
68 struct mylo_fw_header {
69 uint32_t magic; /* must be MYLO_MAGIC_FIRMWARE */
70 uint32_t crc; /* CRC of the whole firmware */
71 uint32_t res0; /* unknown/unused */
72 uint32_t res1; /* unknown/unused */
73 uint16_t vid; /* vendor ID */
74 uint16_t did; /* device ID */
75 uint16_t svid; /* sub vendor ID */
76 uint16_t sdid; /* sub device ID */
77 uint32_t rev; /* device revision */
78 uint32_t fwhi; /* FIXME: firmware version high? */
79 uint32_t fwlo; /* FIXME: firmware version low? */
80 uint32_t flags; /* firmware flags */
81 };
82
83 #define FW_FLAG_BOARD_PARAMS_WP 0x01 /* board parameters are write protected */
84 #define FW_FLAG_BOOT_SECTOR_WE 0x02 /* enable of write boot sectors (below 64K) */
85
86 struct mylo_fw_blockdesc {
87 uint32_t type; /* block type */
88 uint32_t addr; /* relative address to flash start */
89 uint32_t dlen; /* size of block data in bytes */
90 uint32_t blen; /* total size of block in bytes */
91 };
92
93 #define FW_DESC_TYPE_UNUSED 0
94 #define FW_DESC_TYPE_USED 1
95
96 struct mylo_partition {
97 uint16_t flags; /* partition flags */
98 uint16_t type; /* type of the partition */
99 uint32_t addr; /* relative address of the partition from the
100 flash start */
101 uint32_t size; /* size of the partition in bytes */
102 uint32_t param; /* if this is the active partition, the
103 MyLoader load code to this address */
104 };
105
106 #define PARTITION_FLAG_ACTIVE 0x8000 /* this is the active partition,
107 * MyLoader loads firmware from here */
108 #define PARTITION_FLAG_ISRAM 0x2000 /* FIXME: this is a RAM partition? */
109 #define PARTIIION_FLAG_RAMLOAD 0x1000 /* FIXME: load this partition into the RAM? */
110 #define PARTITION_FLAG_PRELOAD 0x0800 /* the partition data preloaded to RAM
111 * before decompression */
112 #define PARTITION_FLAG_HAVEHDR 0x0002 /* the partition data have a header */
113
114 #define PARTITION_TYPE_FREE 0
115 #define PARTITION_TYPE_USED 1
116
117 #define MYLO_MAX_PARTITIONS 8 /* maximum number of partitions in the
118 partition table */
119
120 struct mylo_partition_table {
121 uint32_t magic; /* must be MYLO_MAGIC_PARTITIONS */
122 uint32_t res0; /* unknown/unused */
123 uint32_t res1; /* unknown/unused */
124 uint32_t res2; /* unknown/unused */
125 struct mylo_partition partitions[MYLO_MAX_PARTITIONS];
126 };
127
128 struct mylo_partition_header {
129 uint32_t len; /* length of the partition data */
130 uint32_t crc; /* CRC value of the partition data */
131 };
132
133 struct mylo_system_params {
134 uint32_t magic; /* must be MYLO_MAGIC_SYS_PARAMS */
135 uint32_t res0;
136 uint32_t res1;
137 uint32_t mylo_ver;
138 uint16_t vid; /* Vendor ID */
139 uint16_t did; /* Device ID */
140 uint16_t svid; /* Sub Vendor ID */
141 uint16_t sdid; /* Sub Device ID */
142 uint32_t rev; /* device revision */
143 uint32_t fwhi;
144 uint32_t fwlo;
145 uint32_t tftp_addr;
146 uint32_t prog_start;
147 uint32_t flash_size; /* Size of boot FLASH in bytes */
148 uint32_t dram_size; /* Size of onboard RAM in bytes */
149 };
150
151
152 struct mylo_eth_addr {
153 uint8_t mac[6];
154 uint8_t csum[2];
155 };
156
157 #define MYLO_ETHADDR_COUNT 8 /* maximum number of ethernet address
158 in the board parameters */
159
160 struct mylo_board_params {
161 uint32_t magic; /* must be MYLO_MAGIC_BOARD_PARAMS */
162 uint32_t res0;
163 uint32_t res1;
164 uint32_t res2;
165 struct mylo_eth_addr addr[MYLO_ETHADDR_COUNT];
166 };
167
168 struct myloader_info {
169 u32 vid;
170 u32 did;
171 u32 svid;
172 u32 sdid;
173 uint8_t macs[MYLO_ETHADDR_COUNT][6];
174 };
175
176 extern struct myloader_info myloader_info;
177 extern int myloader_present(void) __init;
178
179 #endif /* _MYLOADER_H_*/
This page took 0.050456 seconds and 3 git commands to generate.