2 * Compex's MyLoader specific definitions
4 * Copyright (C) 2006-2008 Gabor Juhos <juhosg@openwrt.org>
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.
16 * Firmware file format:
19 * [<block descriptor 0>]
21 * [<block descriptor n>]
22 * <null block descriptor>
30 /* Myloader specific magic numbers */
31 #define MYLO_MAGIC_FIRMWARE 0x4C594D00
32 #define MYLO_MAGIC_20021103 0x20021103
33 #define MYLO_MAGIC_20021107 0x20021107
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
40 * Addresses of the data structures provided by MyLoader
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 */
47 /* Vendor ID's (seems to be same as the PCI vendor ID's) */
48 #define VENID_COMPEX 0x11F6
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
60 /* Devices based on the IXP422 */
61 #define DEVID_COMPEX_WP18 0x047E
62 #define DEVID_COMPEX_NP18A 0x0489
65 #define DEVID_COMPEX_NP26G8M 0x03E8
66 #define DEVID_COMPEX_NP26G16M 0x03E9
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 */
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) */
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 */
93 #define FW_DESC_TYPE_UNUSED 0
94 #define FW_DESC_TYPE_USED 1
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
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 */
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 */
114 #define PARTITION_TYPE_FREE 0
115 #define PARTITION_TYPE_USED 1
117 #define MYLO_MAX_PARTITIONS 8 /* maximum number of partitions in the
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
];
128 struct mylo_partition_header
{
129 uint32_t len
; /* length of the partition data */
130 uint32_t crc
; /* CRC value of the partition data */
133 struct mylo_system_params
{
134 uint32_t magic
; /* must be MYLO_MAGIC_SYS_PARAMS */
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 */
147 uint32_t flash_size
; /* Size of boot FLASH in bytes */
148 uint32_t dram_size
; /* Size of onboard RAM in bytes */
152 struct mylo_eth_addr
{
157 #define MYLO_ETHADDR_COUNT 8 /* maximum number of ethernet address
158 in the board parameters */
160 struct mylo_board_params
{
161 uint32_t magic
; /* must be MYLO_MAGIC_BOARD_PARAMS */
165 struct mylo_eth_addr addr
[MYLO_ETHADDR_COUNT
];
168 struct myloader_info
{
173 uint8_t macs
[MYLO_ETHADDR_COUNT
][6];
176 extern struct myloader_info myloader_info
;
177 extern int myloader_present(void) __init
;
179 #endif /* _MYLOADER_H_*/