Changeset 13107
- Timestamp:
- 10/19/09 16:46:20 (1 month ago)
- Files:
-
- ar5315_microredboot/microredboot/CHANGELOG (modified) (1 diff)
- ar5315_microredboot/microredboot/boot/src/Makefile (modified) (3 diffs)
- ar5315_microredboot/microredboot/boot/src/arch/ar2315.c (modified) (1 diff)
- ar5315_microredboot/microredboot/boot/src/arch/ar5312.c (modified) (1 diff)
- ar5315_microredboot/microredboot/boot/src/arch/ar7100.c (modified) (2 diffs)
- ar5315_microredboot/microredboot/boot/src/arch/ar7100_sio.h (modified) (2 diffs)
- ar5315_microredboot/microredboot/boot/src/arch/ar7100_soc.h (modified) (11 diffs)
- ar5315_microredboot/microredboot/boot/src/arch/head-ar7100.S (modified) (4 diffs)
- ar5315_microredboot/microredboot/boot/src/lib/LzmaDecode.c (modified) (1 diff)
- ar5315_microredboot/microredboot/boot/src/lib/LzmaDecode.h (modified) (1 diff)
- ar5315_microredboot/microredboot/boot/src/lib/elf.h (modified) (21 diffs)
- ar5315_microredboot/microredboot/boot/src/lib/fis.c (modified) (3 diffs)
- ar5315_microredboot/microredboot/boot/src/misc_lzma.c (modified) (2 diffs)
- ar5315_microredboot/microredboot/boot/src/ramconfig.h (modified) (1 diff)
- ar5315_microredboot/microredboot/build_targets.sh (modified) (1 diff)
- ar5315_microredboot/microredboot/ecos/packages/devs/eth/mips/ar7100/current/src/vsc8601_phy.c (modified) (1 diff)
- ar5315_microredboot/microredboot/ecos/packages/hal/mips/ar7100/current/src/ar7100_serial.c (modified) (1 diff)
- ar5315_microredboot/microredboot/ecos/packages/hal/mips/pb44/current/cdl/hal_mips_pb44.cdl (modified) (1 diff)
- ar5315_microredboot/microredboot/ecos/packages/hal/mips/pb44/current/include/pkgconf/mlt_mips_pb44_ram.ldi (modified) (1 diff)
- ar5315_microredboot/microredboot/ecos/packages/hal/mips/pb44/current/misc/redboot_RAM.ecm (modified) (3 diffs)
- ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/fwupgrade_senao.c (modified) (3 diffs)
- ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/fwupgrade_ubnt.c (modified) (2 diffs)
- ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/fwupgrade_wili.c (modified) (2 diffs)
- ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_server.c (modified) (1 diff)
- ar5315_microredboot/microredboot/images_default/redboot_ap48_16M_4M_kendin.rom (modified) (previous)
- ar5315_microredboot/microredboot/images_default/redboot_ap48_16M_4M_marvell.rom (modified) (previous)
- ar5315_microredboot/microredboot/images_default/redboot_ap48_32M_4M_marvell.rom (modified) (previous)
- ar5315_microredboot/microredboot/images_default/redboot_ap48_32M_8M_icplus.rom (modified) (previous)
- ar5315_microredboot/microredboot/images_default/redboot_ap48_32M_8M_kendin.rom (modified) (previous)
- ar5315_microredboot/microredboot/makefile (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ar5315_microredboot/microredboot/CHANGELOG
r13097 r13107 1 19.10.09 2 * added pb44 compile target and added some changes to the stub. ar7100 remains untested, dont flash it 3 1 4 16.10.09 2 5 * added some ar7100 specific functions to decompression stub. still alot todo ar5315_microredboot/microredboot/boot/src/Makefile
r13099 r13107 24 24 # and eventually executed. It will be in kseg0. 25 25 # 26 27 REWRITE_REVISION_H1 := $(shell echo -n '\#define SVN_REVISION "' > revision.h) 28 REWRITE_REVISION_H2 := $(shell svnversion -n ../ >> revision.h) 29 REWRITE_REVISION_H3 := $(shell echo '"' >> revision.h) 30 31 26 32 CC = /xfs/toolchains/staging_dir_mips/bin/mips-linux-gcc 27 33 LD = /xfs/toolchains/staging_dir_mips/bin/mips-linux-ld … … 29 35 #LD = /home/seg/DEV/broadcom/ar5315_microredboot/microredboot/tools/ecos_build/gnutools/mipsisa32-elf/bin/mipsisa32-elf-ld 30 36 OBJCOPY = /xfs/toolchains/staging_dir_mips/bin/mips-linux-objcopy 31 CFLAGS = -Os -G 0 -mabi=32 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding - march=mips32 -Iinclude -Iarch -Ilib -I. -Iinclude/asm-mips/mach-atheros -Iinclude/asm/mach-generic -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__ -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32 -D__KERNEL__37 CFLAGS = -Os -G 0 -mabi=32 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -Iinclude -Iarch -Ilib -I. -Iinclude/asm-mips/mach-atheros -Iinclude/asm/mach-generic -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__ -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32 -D__KERNEL__ 32 38 CFLAGS+= -DCONFIG_MIPS_L1_CACHE_SHIFT=5 -DCONFIG_PAGE_SIZE_4KB -DCONFIG_32BIT -DCONFIG_BOOTLOADER 33 AFLAGS = -D__ASSEMBLY__ -G 0 -mabi=32 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding - march=mips32 -Iinclude -I. -Iinclude/asm-mips/mach-atheros -Iinclude/asm/mach-generic -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__ -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS3239 AFLAGS = -D__ASSEMBLY__ -G 0 -mabi=32 -mno-abicalls -fno-pic -pipe -msoft-float -ffreestanding -Iinclude -I. -Iinclude/asm-mips/mach-atheros -Iinclude/asm/mach-generic -DMIPSEB -D_MIPSEB -D__MIPSEB -D__MIPSEB__ -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32 34 40 AFLAGS+= -DCONFIG_MIPS_L1_CACHE_SHIFT=5 -DCONFIG_PAGE_SIZE_4KB -DCONFIG_32BIT -DCONFIG_BOOTLOADER 41 42 ifeq ($(PLATFORM),pb42) 43 CFLAGS+=-march=mips32r2 44 AFLAGS+=-march=mips32r2 45 else 46 CFLAGS+=-march=mips32 47 AFLAGS+=-march=mips32 48 endif 35 49 ifeq ($(PLATFORM),ap51) 36 50 CFLAGS+= -DHAVE_ap51 … … 68 82 #endif 69 83 ZRELADDR = 0x80000400 # 0x80002000 84 ifeq ($(PLATFORM),pb42) 70 85 BOOTBASE = 0xbfc00000 71 86 else 87 BOOTBASE = 0xbf000000 88 endif 72 89 73 90 ar5315_microredboot/microredboot/boot/src/arch/ar2315.c
r12370 r13107 348 348 349 349 } 350 351 static const char *get_system_type(void) 352 { 353 return "2315/6/7/8"; 354 } ar5315_microredboot/microredboot/boot/src/arch/ar5312.c
r13090 r13107 304 304 305 305 } 306 307 static const char *get_system_type(void) 308 { 309 return "5312"; 310 } ar5315_microredboot/microredboot/boot/src/arch/ar7100.c
r13099 r13107 97 97 #define STM_16MB_SECTOR_SIZE STM_M25P128_SECTOR_SIZE 98 98 99 #define AR7100_SPI_FS AR7100_SPI_BASE+0x0100 #define AR7100_SPI_CLOCK AR7100_SPI_BASE+0x4101 #define AR7100_SPI_WRITE AR7100_SPI_BASE+0x8102 #define AR7100_SPI_READ AR7100_SPI_BASE+0x0103 #define AR7100_SPI_RD_STATUS AR7100_SPI_BASE+0xc104 105 #define AR7100_SPI_CS_DIS 0x70000106 #define AR7100_SPI_CE_LOW 0x60000107 #define AR7100_SPI_CE_HIGH 0x60100108 109 #define AR7100_SPI_CMD_WREN 0x06110 #define AR7100_SPI_CMD_RD_STATUS 0x05111 #define AR7100_SPI_CMD_FAST_READ 0x0b112 #define AR7100_SPI_CMD_PAGE_PROG 0x02113 #define AR7100_SPI_CMD_SECTOR_ERASE 0xd8114 115 #define AR7100_SPI_SECTOR_SIZE (1024*64)116 #define AR7100_SPI_PAGE_SIZE 256117 118 99 #define display(_x) ar7100_reg_wr_nf(0x18040008, (_x)) 119 100 … … 281 262 282 263 } 264 265 static const char *get_system_type(void) 266 { 267 char *chip; 268 u32 id; 269 u32 rev; 270 id = ar7100_reg_rd(AR7100_REV_ID) & AR7100_REV_ID_MASK; 271 rev = (id >> REV_ID_REVISION_SHIFT) & REV_ID_REVISION_MASK; 272 switch (id & AR7100_REV_ID_CHIP_MASK) { 273 case AR7100_REV_ID_AR7130: 274 chip = "7130"; 275 break; 276 case AR7100_REV_ID_AR7141: 277 chip = "7141"; 278 break; 279 case AR7100_REV_ID_AR7161: 280 chip = "7161"; 281 break; 282 case AR7100_REV_ID_AR9130: 283 chip = "9130"; 284 break; 285 case AR7100_REV_ID_AR9132: 286 chip = "9132"; 287 break; 288 case AR7240_REV_1_0: 289 case AR7240_REV_1_1: 290 case AR7240_REV_1_2: 291 chip = "7240"; 292 break; 293 default: 294 chip = "71xx"; 295 } 296 return chip; 297 } ar5315_microredboot/microredboot/boot/src/arch/ar7100_sio.h
r13098 r13107 35 35 * Register offsets from base address (in 32b words). 36 36 */ 37 #define RBR 0x00 /* receiver buffer register */38 #define THR 0x00 /* transmit holding register */39 #define DLL 0x00 /* divisor latch */40 #define IER 0x01 /* interrupt enable register */41 #define DLM 0x01 /* divisor latch(MS) */42 #define IIR 0x02 /* interrupt identification register */43 #define FCR 0x02 /* FIFO control register */44 #define LCR 0x03 /* line control register */45 #define MCR 0x04 /* modem control register */46 #define LSR 0x05 /* line status register */47 #define MSR 0x06 /* modem status register */48 #define SCR 0x07 /* scratch register */37 #define RBR 0x00 /* receiver buffer register */ 38 #define THR 0x00 /* transmit holding register */ 39 #define DLL 0x00 /* divisor latch */ 40 #define IER 0x01 /* interrupt enable register */ 41 #define DLM 0x01 /* divisor latch(MS) */ 42 #define IIR 0x02 /* interrupt identification register */ 43 #define FCR 0x02 /* FIFO control register */ 44 #define LCR 0x03 /* line control register */ 45 #define MCR 0x04 /* modem control register */ 46 #define LSR 0x05 /* line status register */ 47 #define MSR 0x06 /* modem status register */ 48 #define SCR 0x07 /* scratch register */ 49 49 50 50 /* 51 51 * Line Control Register 52 52 */ 53 #define CHAR_LEN_5 0x00 /* 5bits data size */54 #define CHAR_LEN_6 0x01 /* 6bits data size */55 #define CHAR_LEN_7 0x02 /* 7bits data size */56 #define CHAR_LEN_8 0x03 /* 8bits data size */57 #define LCR_STB 0x04 /* 2 stop bits */58 #define ONE_STOP 0x00 /* one stop bit */59 #define LCR_PEN 0x08 /* parity enable */60 #define PARITY_NONE 0x00 /* parity disable */61 #define LCR_EPS 0x10 /* even parity select */62 #define LCR_SP 0x20 /* stick parity select */63 #define LCR_SBRK 0x40 /* break control bit */64 #define LCR_DLAB 0x80 /* divisor latch access enable */53 #define CHAR_LEN_5 0x00 /* 5bits data size */ 54 #define CHAR_LEN_6 0x01 /* 6bits data size */ 55 #define CHAR_LEN_7 0x02 /* 7bits data size */ 56 #define CHAR_LEN_8 0x03 /* 8bits data size */ 57 #define LCR_STB 0x04 /* 2 stop bits */ 58 #define ONE_STOP 0x00 /* one stop bit */ 59 #define LCR_PEN 0x08 /* parity enable */ 60 #define PARITY_NONE 0x00 /* parity disable */ 61 #define LCR_EPS 0x10 /* even parity select */ 62 #define LCR_SP 0x20 /* stick parity select */ 63 #define LCR_SBRK 0x40 /* break control bit */ 64 #define LCR_DLAB 0x80 /* divisor latch access enable */ 65 65 66 66 /* 67 67 * Line Status Register 68 68 */ 69 #define LSR_DR 0x01 /* data ready */70 #define LSR_OE 0x02 /* overrun error */71 #define LSR_PE 0x04 /* parity error */72 #define LSR_FE 0x08 /* framing error */73 #define LSR_BI 0x10 /* break interrupt */74 #define LSR_THRE 0x20 /* transmit holding register empty */75 #define LSR_TEMT 0x40 /* transmitter empty */76 #define LSR_FERR 0x80 /* in fifo mode, set when PE,FE or BI error */69 #define LSR_DR 0x01 /* data ready */ 70 #define LSR_OE 0x02 /* overrun error */ 71 #define LSR_PE 0x04 /* parity error */ 72 #define LSR_FE 0x08 /* framing error */ 73 #define LSR_BI 0x10 /* break interrupt */ 74 #define LSR_THRE 0x20 /* transmit holding register empty */ 75 #define LSR_TEMT 0x40 /* transmitter empty */ 76 #define LSR_FERR 0x80 /* in fifo mode, set when PE,FE or BI error */ 77 77 78 78 /* 79 79 * Interrupt Identification Register 80 80 */ 81 #define IIR_IP 0x01 /* no pending interrupts */81 #define IIR_IP 0x01 /* no pending interrupts */ 82 82 #define IIR_ID 0x0e 83 #define IIR_RLS 0x06 /* received line status */84 #define IIR_RDA 0x04 /* received data available */85 #define IIR_THRE 0x02 /* transmit holding register empty */86 #define IIR_MSTAT 0x00 /* modem status */87 #define IIR_TIMEOUT 0x0c /* char receiv tiemout */83 #define IIR_RLS 0x06 /* received line status */ 84 #define IIR_RDA 0x04 /* received data available */ 85 #define IIR_THRE 0x02 /* transmit holding register empty */ 86 #define IIR_MSTAT 0x00 /* modem status */ 87 #define IIR_TIMEOUT 0x0c /* char receiv tiemout */ 88 88 89 89 /* 90 90 * Interrupt Enable Register 91 91 */ 92 #define IER_ERDAI 0x01 /* received data avail. & timeout int */93 #define IER_ETHREI 0x02 /* transmitter holding register empty int */94 #define IER_ELSI 0x04 /* receiver line status int enable */95 #define IER_EMSI 0x08 /* modem status int enable */92 #define IER_ERDAI 0x01 /* received data avail. & timeout int */ 93 #define IER_ETHREI 0x02 /* transmitter holding register empty int */ 94 #define IER_ELSI 0x04 /* receiver line status int enable */ 95 #define IER_EMSI 0x08 /* modem status int enable */ 96 96 97 97 /* 98 98 * Modem Control Register 99 99 */ 100 #define MCR_DTR 0x01 /* dtr output */101 #define MCR_RTS 0x02 /* rts output */102 #define MCR_OUT1 0x04 /* output #1 */103 #define MCR_OUT2 0x08 /* output #2 */104 #define MCR_LOOP 0x10 /* loopback enable */100 #define MCR_DTR 0x01 /* dtr output */ 101 #define MCR_RTS 0x02 /* rts output */ 102 #define MCR_OUT1 0x04 /* output #1 */ 103 #define MCR_OUT2 0x08 /* output #2 */ 104 #define MCR_LOOP 0x10 /* loopback enable */ 105 105 106 106 /* 107 107 * Modem Status Register 108 108 */ 109 #define MSR_DCTS 0x01 /* cts change */110 #define MSR_DDSR 0x02 /* dsr change */111 #define MSR_TERI 0x04 /* ring indicator change */112 #define MSR_DDCD 0x08 /* data carrier indicator change */113 #define MSR_CTS 0x10 /* complement of cts */114 #define MSR_DSR 0x20 /* complement of dsr */115 #define MSR_RI 0x40 /* complement of ring signal */116 #define MSR_DCD 0x80 /* complement of dcd */109 #define MSR_DCTS 0x01 /* cts change */ 110 #define MSR_DDSR 0x02 /* dsr change */ 111 #define MSR_TERI 0x04 /* ring indicator change */ 112 #define MSR_DDCD 0x08 /* data carrier indicator change */ 113 #define MSR_CTS 0x10 /* complement of cts */ 114 #define MSR_DSR 0x20 /* complement of dsr */ 115 #define MSR_RI 0x40 /* complement of ring signal */ 116 #define MSR_DCD 0x80 /* complement of dcd */ 117 117 118 118 /* 119 119 * FIFO Control Register 120 120 */ 121 #define FCR_EN 0x01 /* enable xmit and rcvr */122 #define FCR_RXCLR 0x02 /* clears rcvr fifo */123 #define FCR_TXCLR 0x04 /* clears xmit fifo */124 #define FCR_DMA 0x08 /* dma */125 #define FCR_RXTRIG_1 0x00 /* rcvr fifo trigger at 1 byte */126 #define FCR_RXTRIG_4 0x40 /* rcvr fifo trigger at 4 bytes */127 #define FCR_RXTRIG_8 0x80 /* rcvr fifo trigger at 8 bytes */128 #define FCR_RXTRIG_14 0xc0 /* rcvr fifo trigger at X4 bytes */121 #define FCR_EN 0x01 /* enable xmit and rcvr */ 122 #define FCR_RXCLR 0x02 /* clears rcvr fifo */ 123 #define FCR_TXCLR 0x04 /* clears xmit fifo */ 124 #define FCR_DMA 0x08 /* dma */ 125 #define FCR_RXTRIG_1 0x00 /* rcvr fifo trigger at 1 byte */ 126 #define FCR_RXTRIG_4 0x40 /* rcvr fifo trigger at 4 bytes */ 127 #define FCR_RXTRIG_8 0x80 /* rcvr fifo trigger at 8 bytes */ 128 #define FCR_RXTRIG_14 0xc0 /* rcvr fifo trigger at X4 bytes */ 129 129 130 130 #define FIFO_DEPTH 16 … … 134 134 #define UARTDMA_ALIGN _CACHE_ALIGN_SIZE 135 135 136 137 #endif /* __INCar7100Sioh */ 136 #endif /* __INCar7100Sioh */ ar5315_microredboot/microredboot/boot/src/arch/ar7100_soc.h
r13098 r13107 5 5 * Address map 6 6 */ 7 #define AR7100_PCI_MEM_BASE 0x10000000 /* 128M */8 #define AR7100_APB_BASE 0x18000000 /* 384M */9 #define AR7100_GE0_BASE 0x19000000 /* 16M */10 #define AR7100_GE1_BASE 0x1a000000 /* 16M */11 #define AR7100_USB_EHCI_BASE 0x1b000000 7 #define AR7100_PCI_MEM_BASE 0x10000000 /* 128M */ 8 #define AR7100_APB_BASE 0x18000000 /* 384M */ 9 #define AR7100_GE0_BASE 0x19000000 /* 16M */ 10 #define AR7100_GE1_BASE 0x1a000000 /* 16M */ 11 #define AR7100_USB_EHCI_BASE 0x1b000000 12 12 #define AR7100_USB_OHCI_BASE 0x1c000000 13 13 #define AR7100_SPI_BASE 0x1f000000 … … 54 54 #define AR7100_DDR_CONFIG2_BL8 (8 << 0) 55 55 56 #define AR7100_DDR_CONFIG2_BT_IL (1 << 4) 56 #define AR7100_DDR_CONFIG2_BT_IL (1 << 4) 57 57 #define AR7100_DDR_CONFIG2_CNTL_OE_EN (1 << 5) 58 58 #define AR7100_DDR_CONFIG2_PHASE_SEL (1 << 6) … … 62 62 #define AR7100_DDR_CONFIG2_TRTP_SHIFT 17 63 63 #define AR7100_DDR_CONFIG2_TWTR_SHIFT 21 64 #define AR7100_DDR_CONFIG2_HALF_WIDTH_L (1 << 31) 64 #define AR7100_DDR_CONFIG2_HALF_WIDTH_L (1 << 31) 65 65 66 66 #define AR7100_DDR_TAP_DEFAULT 0x18 … … 69 69 * PLL 70 70 */ 71 #define AR7100_CPU_PLL_CONFIG AR7100_PLL_BASE 71 #define AR7100_CPU_PLL_CONFIG AR7100_PLL_BASE 72 72 73 73 /* Legacy */ … … 107 107 #define PLL_CONFIG_SW_UPDATE_MASK (1 << 31) 108 108 109 #define REV_ID_REVISION_MASK 0x3 110 #define REV_ID_REVISION_SHIFT 2 109 111 110 112 /* These are values used in platform.inc to select PLL settings */ 111 113 112 114 #define AR7100_REV_ID (AR7100_RESET_BASE + 0x90) 115 #define AR7100_REV_ID_CHIP_MASK 0xf3 113 116 #define AR7100_REV_ID_MASK 0xff 114 117 #define AR7100_REV_ID_AR7130 0xa0 115 118 #define AR7100_REV_ID_AR7141 0xa1 116 119 #define AR7100_REV_ID_AR7161 0xa2 120 #define AR7100_REV_ID_AR9130 0xb0 121 #define AR7100_REV_ID_AR9132 0xb1 122 #define AR7240_REV_1_0 0xc0 123 #define AR7240_REV_1_1 0xc1 124 #define AR7240_REV_1_2 0xc2 117 125 118 126 #define AR7100_PLL_USE_REV_ID 0 … … 125 133 #define AR7100_PLL_600_300_150 7 126 134 #define AR7100_PLL_680_340_170 8 135 #define AR7100_PLL_350_350_175 9 136 127 137 /* "Secret values", for debug only */ 128 138 #define AR7100_PLL_720_360_180 30 129 139 #define AR7100_PLL_800_400_200 31 140 130 141 /* 131 142 * PLL block … … 168 179 * PCI block 169 180 */ 170 #define AR7100_PCI_WINDOW 0x8000000 /* 128MB */181 #define AR7100_PCI_WINDOW 0x8000000 /* 128MB */ 171 182 #define AR7100_PCI_WINDOW0_OFFSET AR7100_DDR_CTL_BASE+0x7c 172 183 #define AR7100_PCI_WINDOW1_OFFSET AR7100_DDR_CTL_BASE+0x80 … … 186 197 #define AR7100_PCI_WINDOW6_VAL 0x16000000 187 198 #define AR7100_PCI_WINDOW7_VAL 0x07000000 188 189 199 190 200 /* … … 323 333 #define PISR_DEV2 PIMR_DEV2 324 334 #define PISR_CORE PIMR_CORE 325 326 335 327 336 #define AR7100_GPIO_COUNT 16 … … 366 375 #ifndef __ASSEMBLER__ 367 376 typedef enum { 368 AR7100_DDR_16B_LOW,369 AR7100_DDR_16B_HIGH,370 AR7100_DDR_32B,371 } ar7100_ddr_width_t;377 AR7100_DDR_16B_LOW, 378 AR7100_DDR_16B_HIGH, 379 AR7100_DDR_32B, 380 } ar7100_ddr_width_t; 372 381 373 382 #define KSEG1ADDR(_addr) (CYGARC_UNCACHED_ADDRESS(_addr)) … … 413 422 }while(0); 414 423 415 #endif /*__ASSEMBLY*/424 #endif /*__ASSEMBLY*/ 416 425 417 426 #endif ar5315_microredboot/microredboot/boot/src/arch/head-ar7100.S
r13101 r13107 392 392 nop 393 393 394 1: li t0, AR7240_REV_1_0 395 bne t0, t1, 1f 396 li t1, AR7100_PLL_350_350_175 397 b 2f 398 nop 399 400 1: li t0, AR7240_REV_1_1 401 bne t0, t1, 1f 402 li t1, AR7100_PLL_400_400_200 403 b 2f 404 nop 405 394 406 1: li t1, AR7100_PLL_300_300_150 395 407 … … 416 428 417 429 __AR7100_init: 418 lar t0, rel_start 419 li t1, 0xff3fffff 420 and t0, t0, t1 421 j t0 422 nop 430 /* 431 * Clearing CP0 registers - This is generally required for the MIPS-24k 432 * core used by Atheros. 433 */ 434 mtc0 zero, $0 435 mtc0 zero, $1 436 mtc0 zero, $2 437 mtc0 zero, $3 438 mtc0 zero, $4 439 mtc0 zero, $5 440 mtc0 zero, $6 441 mtc0 zero, $7 442 mtc0 zero, $8 443 mtc0 zero, $9 444 mtc0 zero, $10 445 mtc0 zero, $11 446 li t0, 0x10000004 447 mtc0 t0, $12 448 mtc0 zero, $13 449 mtc0 zero, $14 450 mtc0 zero, $15 451 mtc0 zero, $16 452 mtc0 zero, $17 453 mtc0 zero, $18 454 mtc0 zero, $19 455 mtc0 zero, $20 456 mtc0 zero, $21 457 mtc0 zero, $22 458 mtc0 zero, $23 459 mtc0 zero, $24 460 mtc0 zero, $25 461 mtc0 zero, $26 462 mtc0 zero, $27 463 mtc0 zero, $28 464 465 /* 466 ** Clear watch registers. 467 */ 468 469 mtc0 zero, CP0_WATCHLO 470 mtc0 zero, CP0_WATCHHI 471 472 /* STATUS register */ 473 mfc0 k0, CP0_STATUS 474 li k1, ~ST0_IE 475 and k0, k1 476 mtc0 zero, CP0_CAUSE 477 mtc0 k0, CP0_STATUS 478 479 /* CAUSE register */ 480 mtc0 zero, CP0_CAUSE 481 482 /* Init Timer */ 483 mtc0 zero, CP0_COUNT 484 mtc0 zero, CP0_COMPARE 485 486 /* CONFIG0 register */ 487 li t0, CONF_CM_UNCACHED 488 mtc0 t0, CP0_CONFIG 489 490 491 /* Initialize any external memory. 492 */ 493 #if defined(AR7100) || defined(AR7240) 494 la t0, rel_start 495 j t0 496 nop 497 #endif 423 498 424 499 rel_start: … … 440 515 li t2, AR7100_PLL_400_400_200 441 516 beq t1, t2, pll_400_400_200 517 nop 518 li t2, AR7100_PLL_350_350_175 519 beq t1, t2, pll_350_350_175 442 520 nop 443 521 li t2, AR7100_PLL_333_333_166 … … 506 584 b got_setting 507 585 nop 586 587 pll_350_350_175: 588 589 li t0, (0x2 << PLL_CONFIG_CPU_DIV_SHIFT) 590 li t1, (0x0 << PLL_CONFIG_DDR_DIV_SHIFT) 591 li t2, (0x0 << PLL_CONFIG_AHB_DIV_SHIFT) 592 li t3, (0x23 << PLL_CONFIG_PLL_FB_SHIFT) 593 li t4, (0x2 << PLL_CONFIG_PLL_LOOP_BW_SHIFT) 594 li t5, (0x0 << PLL_CONFIG_PLL_DIVOUT_SHIFT) 595 b got_setting 596 nop 597 508 598 509 599 pll_333_333_166: ar5315_microredboot/microredboot/boot/src/lib/LzmaDecode.c
r12551 r13107 168 168 #ifdef _LZMA_LOC_OPT 169 169 CProb *prob = probs + mi; 170 RC_GET_BIT2(prob, mi,;, symbol |= (1 << i)) 170 RC_GET_BIT2(prob, mi,; 171 , symbol |= (1 << i)) 171 172 #else 172 173 int bit = RangeDecoderBitDecode(probs + mi, rd); ar5315_microredboot/microredboot/boot/src/lib/LzmaDecode.h
r13100 r13107 22 22 #ifndef __LZMADECODE_H 23 23 #define __LZMADECODE_H 24 25 24 26 25 /* #define _LZMA_IN_CB */ ar5315_microredboot/microredboot/boot/src/lib/elf.h
r12429 r13107 87 87 //========================================================================== 88 88 89 90 89 // ------------------------------------------------------------------------- 91 90 // Basic types: … … 102 101 typedef cyg_uint16 Elf32_Half; 103 102 typedef cyg_uint32 Elf32_Word; 104 typedef cyg_int32 Elf32_Sword;103 typedef cyg_int32 Elf32_Sword; 105 104 106 105 typedef cyg_uint64 Elf64_Addr; … … 108 107 typedef cyg_uint16 Elf64_Half; 109 108 typedef cyg_uint32 Elf64_Word; 110 typedef cyg_int32 Elf64_Sword;109 typedef cyg_int32 Elf64_Sword; 111 110 typedef cyg_uint64 Elf64_Xword; 112 typedef cyg_int64 Elf64_Sxword;111 typedef cyg_int64 Elf64_Sxword; 113 112 114 113 // ------------------------------------------------------------------------- … … 118 117 119 118 typedef struct { 120 unsigned chare_ident[EI_NIDENT];121 Elf32_Halfe_type;122 Elf32_Halfe_machine;123 Elf32_Worde_version;124 Elf32_Addre_entry;125 Elf32_Offe_phoff;126 Elf32_Offe_shoff;127 Elf32_Worde_flags;128 Elf32_Halfe_ehsize;129 Elf32_Halfe_phentsize;130 Elf32_Halfe_phnum;131 Elf32_Halfe_shentsize;132 Elf32_Halfe_shnum;133 Elf32_Halfe_shtrndx;119 unsigned char e_ident[EI_NIDENT]; 120 Elf32_Half e_type; 121 Elf32_Half e_machine; 122 Elf32_Word e_version; 123 Elf32_Addr e_entry; 124 Elf32_Off e_phoff; 125 Elf32_Off e_shoff; 126 Elf32_Word e_flags; 127 Elf32_Half e_ehsize; 128 Elf32_Half e_phentsize; 129 Elf32_Half e_phnum; 130 Elf32_Half e_shentsize; 131 Elf32_Half e_shnum; 132 Elf32_Half e_shtrndx; 134 133 } Elf32_Ehdr; 135 134 136 135 typedef struct { 137 unsigned chare_ident[EI_NIDENT];138 Elf64_Halfe_type;139 Elf64_Halfe_machine;140 Elf64_Worde_version;141 Elf64_Addre_entry;142 Elf64_Offe_phoff;143 Elf64_Offe_shoff;144 Elf64_Worde_flags;145 Elf64_Halfe_ehsize;146 Elf64_Halfe_phentsize;147 Elf64_Halfe_phnum;148 Elf64_Halfe_shentsize;149 Elf64_Halfe_shnum;150 Elf64_Halfe_shtrndx;136 unsigned char e_ident[EI_NIDENT]; 137 Elf64_Half e_type; 138 Elf64_Half e_machine; 139 Elf64_Word e_version; 140 Elf64_Addr e_entry; 141 Elf64_Off e_phoff; 142 Elf64_Off e_shoff; 143 Elf64_Word e_flags; 144 Elf64_Half e_ehsize; 145 Elf64_Half e_phentsize; 146 Elf64_Half e_phnum; 147 Elf64_Half e_shentsize; 148 Elf64_Half e_shnum; 149 Elf64_Half e_shtrndx; 151 150 } Elf64_Ehdr; 152 151 … … 154 153 /* e_ident[] identification indexes */ 155 154 156 #define EI_MAG0 0 /* file ID */157 #define EI_MAG1 1 /* file ID */158 #define EI_MAG2 2 /* file ID */159 #define EI_MAG3 3 /* file ID */160 #define EI_CLASS 4 /* file class */161 #define EI_DATA 5 /* data encoding */162 #define EI_VERSION 6 /* ELF header version */163 #define EI_OSABI 7 /* Operating system/ABI identification */164 #define EI_ABIVERSION 8 /* ABI version */165 #define EI_PAD 9 /* start of pad bytes */155 #define EI_MAG0 0 /* file ID */ 156 #define EI_MAG1 1 /* file ID */ 157 #define EI_MAG2 2 /* file ID */ 158 #define EI_MAG3 3 /* file ID */ 159 #define EI_CLASS 4 /* file class */ 160 #define EI_DATA 5 /* data encoding */ 161 #define EI_VERSION 6 /* ELF header version */ 162 #define EI_OSABI 7 /* Operating system/ABI identification */ 163 #define EI_ABIVERSION 8 /* ABI version */ 164 #define EI_PAD 9 /* start of pad bytes */ 166 165 167 166 // ------------------------------------------------------------------------- 168 167 /* e_ident[] magic number */ 169 168 170 #define ELFMAG0 0x7f /* e_ident[EI_MAG0] */171 #define ELFMAG1 'E' /* e_ident[EI_MAG1] */172 #define ELFMAG2 'L' /* e_ident[EI_MAG2] */173 #define ELFMAG3 'F' /* e_ident[EI_MAG3] */174 #define ELFMAG "\177ELF" /* magic */175 #define SELFMAG 4 /* size of magic */169 #define ELFMAG0 0x7f /* e_ident[EI_MAG0] */ 170 #define ELFMAG1 'E' /* e_ident[EI_MAG1] */ 171 #define ELFMAG2 'L' /* e_ident[EI_MAG2] */ 172 #define ELFMAG3 'F' /* e_ident[EI_MAG3] */ 173 #define ELFMAG "\177ELF" /* magic */ 174 #define SELFMAG 4 /* size of magic */ 176 175 177 176 // ------------------------------------------------------------------------- 178 177 /* e_ident[] file class */ 179 178 180 #define ELFCLASSNONE 0 /* invalid */181 #define ELFCLASS32 1 /* 32-bit objs */182 #define ELFCLASS64 2 /* 64-bit objs */183 #define ELFCLASSNUM 3 /* number of classes */179 #define ELFCLASSNONE 0 /* invalid */ 180 #define ELFCLASS32 1 /* 32-bit objs */ 181 #define ELFCLASS64 2 /* 64-bit objs */ 182 #define ELFCLASSNUM 3 /* number of classes */ 184 183 185 184 // ------------------------------------------------------------------------- 186 185 /* e_ident[] data encoding */ 187 186 188 #define ELFDATANONE 0 /* invalid */189 #define ELFDATA2LSB 1 /* Little-Endian */190 #define ELFDATA2MSB 2 /* Big-Endian */191 #define ELFDATANUM 3 /* number of data encode defines */187 #define ELFDATANONE 0 /* invalid */ 188 #define ELFDATA2LSB 1 /* Little-Endian */ 189 #define ELFDATA2MSB 2 /* Big-Endian */ 190 #define ELFDATANUM 3 /* number of data encode defines */ 192 191 193 192 // ------------------------------------------------------------------------- … … 202 201 /* e_type */ 203 202 204 #define ET_NONE 0 /* No file type */205 #define ET_REL 1 /* relocatable file */206 #define ET_EXEC 2 /* executable file */207 #define ET_DYN 3 /* shared object file */208 #define ET_CORE 4 /* core file */209 #define ET_NUM 5 /* number of types */210 #define ET_LOOS 0xfe00 /* Operating system-specific */211 #define ET_HIOS 0xfeff /* Operating system-specific */212 #define ET_LOPROC 0xff00 /* reserved range for processor */213 #define ET_HIPROC 0xffff /* specific e_type */203 #define ET_NONE 0 /* No file type */ 204 #define ET_REL 1 /* relocatable file */ 205 #define ET_EXEC 2 /* executable file */ 206 #define ET_DYN 3 /* shared object file */ 207 #define ET_CORE 4 /* core file */ 208 #define ET_NUM 5 /* number of types */ 209 #define ET_LOOS 0xfe00 /* Operating system-specific */ 210 #define ET_HIOS 0xfeff /* Operating system-specific */ 211 #define ET_LOPROC 0xff00 /* reserved range for processor */ 212 #define ET_HIPROC 0xffff /* specific e_type */ 214 213 215 214 // ------------------------------------------------------------------------- … … 218 217 // extra values from binutils elf/common.h. 219 218 220 #define EM_NONE 0 // No machine221 #define EM_M32 1 // AT&T WE 32100222 #define EM_SPARC 2 // SPARC223 #define EM_386 3 // Intel 80386224 #define EM_68K 4 // Motorola 68000225 #define EM_88K 5 // Motorola 88000226 #define EM_860 7 // Intel 80860227 #define EM_MIPS 8 // MIPS I Architecture228 #define EM_S370 9 // IBM System/370 Processor229 #define EM_MIPS_RS3_LE 10 // MIPS RS3000 Little-endian230 #define EM_PARISC 15 // Hewlett-Packard PA-RISC231 #define EM_VPP500 17 // Fujitsu VPP500232 #define EM_SPARC32PLUS 18 // Enhanced instruction set SPARC233 #define EM_960 19 // Intel 80960234 #define EM_PPC 20 // PowerPC235 #define EM_PPC64 21 // 64-bit PowerPC236 #define EM_V800 36 // NEC V800237 #define EM_FR20 37 // Fujitsu FR20238 #define EM_RH32 38 // TRW RH-32239 #define EM_RCE 39 // Motorola RCE240 #define EM_ARM 40 // Advanced RISC Machines ARM241 #define EM_ALPHA 41 // Digital Alpha242 #define EM_SH 42 // Hitachi SH243 #define EM_SPARCV9 43 // SPARC Version 9244 #define EM_TRICORE 44 // Siemens Tricore embedded processor245 #define EM_ARC 45 // Argonaut RISC Core, Argonaut Technologies Inc.246 #define EM_H8_300 46 // Hitachi H8/300247 #define EM_H8_300H 47 // Hitachi H8/300H248 #define EM_H8S 48 // Hitachi H8S249 #define EM_H8_500 49 // Hitachi H8/500250 #define EM_IA_64 50 // Intel IA-64 processor architecture251 #define EM_MIPS_X 51 // Stanford MIPS-X252 #define EM_COLDFIRE 52 // Motorola ColdFire253 #define EM_68HC12 53 // Motorola M68HC12254 #define EM_MMA 54 // Fujitsu MMA Multimedia Accelerator255 #define EM_PCP 55 // Siemens PCP256 #define EM_NCPU 56 // Sony nCPU embedded RISC processor257 #define EM_NDR1 57 // Denso NDR1 microprocessor258 #define EM_STARCORE 58 // Motorola Star*Core processor259 #define EM_ME16 59 // Toyota ME16 processor260 #define EM_ST100 60 // STMicroelectronics ST100 processor261 #define EM_TINYJ 61 // Advanced Logic Corp. TinyJ embedded processor family262 #define EM_FX66 66 // Siemens FX66 microcontroller263 #define EM_ST9PLUS 67 // STMicroelectronics ST9+ 8/16 bit microcontroller264 #define EM_ST7 68 // STMicroelectronics ST7 8-bit microcontroller265 #define EM_68HC16 69 // Motorola MC68HC16 Microcontroller266 #define EM_68HC11 70 // Motorola MC68HC11 Microcontroller267 #define EM_68HC08 71 // Motorola MC68HC08 Microcontroller268 #define EM_68HC05 72 // Motorola MC68HC05 Microcontroller269 #define EM_SVX 73 // Silicon Graphics SVx270 #define EM_ST19 74 // STMicroelectronics ST19 8-bit microcontroller271 #define EM_VAX 75 // Digital VAX272 #define EM_CRIS 76 // Axis Communications 32-bit embedded processor273 #define EM_JAVELIN 77 // Infineon Technologies 32-bit embedded processor274 #define EM_FIREPATH 78 // Element 14 64-bit DSP Processor275 #define EM_ZSP 79 // LSI Logic 16-bit DSP Processor276 #define EM_MMIX 80 // Donald Knuth's educational 64-bit processor277 #define EM_HUANY 81 // Harvard University machine-independent object files278 #define EM_PRISM 82 // SiTera Prism219 #define EM_NONE 0 // No machine 220 #define EM_M32 1 // AT&T WE 32100 221 #define EM_SPARC 2 // SPARC 222 #define EM_386 3 // Intel 80386 223 #define EM_68K 4 // Motorola 68000 224 #define EM_88K 5 // Motorola 88000 225 #define EM_860 7 // Intel 80860 226 #define EM_MIPS 8 // MIPS I Architecture 227 #define EM_S370 9 // IBM System/370 Processor 228 #define EM_MIPS_RS3_LE 10 // MIPS RS3000 Little-endian 229 #define EM_PARISC 15 // Hewlett-Packard PA-RISC 230 #define EM_VPP500 17 // Fujitsu VPP500 231 #define EM_SPARC32PLUS 18 // Enhanced instruction set SPARC 232 #define EM_960 19 // Intel 80960 233 #define EM_PPC 20 // PowerPC 234 #define EM_PPC64 21 // 64-bit PowerPC 235 #define EM_V800 36 // NEC V800 236 #define EM_FR20 37 // Fujitsu FR20 237 #define EM_RH32 38 // TRW RH-32 238 #define EM_RCE 39 // Motorola RCE 239 #define EM_ARM 40 // Advanced RISC Machines ARM 240 #define EM_ALPHA 41 // Digital Alpha 241 #define EM_SH 42 // Hitachi SH 242 #define EM_SPARCV9 43 // SPARC Version 9 243 #define EM_TRICORE 44 // Siemens Tricore embedded processor 244 #define EM_ARC 45 // Argonaut RISC Core, Argonaut Technologies Inc. 245 #define EM_H8_300 46 // Hitachi H8/300 246 #define EM_H8_300H 47 // Hitachi H8/300H 247 #define EM_H8S 48 // Hitachi H8S 248 #define EM_H8_500 49 // Hitachi H8/500 249 #define EM_IA_64 50 // Intel IA-64 processor architecture 250 #define EM_MIPS_X 51 // Stanford MIPS-X 251 #define EM_COLDFIRE 52 // Motorola ColdFire 252 #define EM_68HC12 53 // Motorola M68HC12 253 #define EM_MMA 54 // Fujitsu MMA Multimedia Accelerator 254 #define EM_PCP 55 // Siemens PCP 255 #define EM_NCPU 56 // Sony nCPU embedded RISC processor 256 #define EM_NDR1 57 // Denso NDR1 microprocessor 257 #define EM_STARCORE 58 // Motorola Star*Core processor 258 #define EM_ME16 59 // Toyota ME16 processor 259 #define EM_ST100 60 // STMicroelectronics ST100 processor 260 #define EM_TINYJ 61 // Advanced Logic Corp. TinyJ embedded processor family 261 #define EM_FX66 66 // Siemens FX66 microcontroller 262 #define EM_ST9PLUS 67 // STMicroelectronics ST9+ 8/16 bit microcontroller 263 #define EM_ST7 68 // STMicroelectronics ST7 8-bit microcontroller 264 #define EM_68HC16 69 // Motorola MC68HC16 Microcontroller 265 #define EM_68HC11 70 // Motorola MC68HC11 Microcontroller 266 #define EM_68HC08 71 // Motorola MC68HC08 Microcontroller 267 #define EM_68HC05 72 // Motorola MC68HC05 Microcontroller 268 #define EM_SVX 73 // Silicon Graphics SVx 269 #define EM_ST19 74 // STMicroelectronics ST19 8-bit microcontroller 270 #define EM_VAX 75 // Digital VAX 271 #define EM_CRIS 76 // Axis Communications 32-bit embedded processor 272 #define EM_JAVELIN 77 // Infineon Technologies 32-bit embedded processor 273 #define EM_FIREPATH 78 // Element 14 64-bit DSP Processor 274 #define EM_ZSP 79 // LSI Logic 16-bit DSP Processor 275 #define EM_MMIX 80 // Donald Knuth's educational 64-bit processor 276 #define EM_HUANY 81 // Harvard University machine-independent object files 277 #define EM_PRISM 82 // SiTera Prism 279 278 280 279 /* Cygnus PowerPC ELF backend. Written in the absence of an ABI. */ … … 321 320 /* Version */ 322 321 323 #define EV_NONE 0 /* Invalid */324 #define EV_CURRENT 1 /* Current */325 #define EV_NUM 2 /* number of versions */322 #define EV_NONE 0 /* Invalid */ 323 #define EV_CURRENT 1 /* Current */ 324 #define EV_NUM 2 /* number of versions */ 326 325 327 326 // ------------------------------------------------------------------------- … … 329 328 330 329 typedef struct { 331 Elf32_Word sh_name;/* name - index into section header332 string table section */333 Elf32_Word sh_type;/* type */334 Elf32_Word sh_flags;/* flags */335 Elf32_Addr sh_addr;/* address */336 Elf32_Off sh_offset;/* file offset */337 Elf32_Word sh_size;/* section size */338 Elf32_Word sh_link;/* section header table index link */339 Elf32_Word sh_info;/* extra information */340 Elf32_Word sh_addralign;/* address alignment */341 Elf32_Word sh_entsize;/* section entry size */330 Elf32_Word sh_name; /* name - index into section header 331 string table section */ 332 Elf32_Word sh_type; /* type */ 333 Elf32_Word sh_flags; /* flags */ 334 Elf32_Addr sh_addr; /* address */ 335 Elf32_Off sh_offset; /* file offset */ 336 Elf32_Word sh_size; /* section size */ 337 Elf32_Word sh_link; /* section header table index link */ 338 Elf32_Word sh_info; /* extra information */ 339 Elf32_Word sh_addralign; /* address alignment */ 340 Elf32_Word sh_entsize; /* section entry size */ 342 341 } Elf32_Shdr; 343 342 344 343 typedef struct { 345 Elf64_Word sh_name;/* section name */346 Elf64_Word sh_type;/* section type */347 Elf64_Xword sh_flags;/* section flags */348 Elf64_Addr sh_addr;/* virtual address */349 Elf64_Off sh_offset;/* file offset */350 Elf64_Xword sh_size;/* section size */351 Elf64_Word sh_link;/* link to another */352 Elf64_Word sh_info;/* misc info */353 Elf64_Xword sh_addralign;/* memory alignment */354 Elf64_Xword sh_entsize;/* table entry size */344 Elf64_Word sh_name; /* section name */ 345 Elf64_Word sh_type; /* section type */ 346 Elf64_Xword sh_flags; /* section flags */ 347 Elf64_Addr sh_addr; /* virtual address */ 348 Elf64_Off sh_offset; /* file offset */ 349 Elf64_Xword sh_size; /* section size */ 350 Elf64_Word sh_link; /* link to another */ 351 Elf64_Word sh_info; /* misc info */ 352 Elf64_Xword sh_addralign; /* memory alignment */ 353 Elf64_Xword sh_entsize; /* table entry size */ 355 354 } Elf64_Shdr; 356 355 … … 358 357 /* Special Section Indexes */ 359 358 360 #define SHN_UNDEF 0 /* undefined */361 #define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */362 #define SHN_LOPROC 0xff00 /* reserved range for processor */363 #define SHN_HIPROC 0xff1f /* specific section indexes */364 #define SHN_LOOS 0xff20 /* reserved range for operating */365 #define SHN_HIOS 0xff3f /* system specific section indexes */366 #define SHN_ABS 0xfff1 /* absolute value */367 #define SHN_COMMON 0xfff2 /* common symbol */368 #define SHN_XINDEX 0xffff /* escape value for oversize index */369 #define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */359 #define SHN_UNDEF 0 /* undefined */ 360 #define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */ 361 #define SHN_LOPROC 0xff00 /* reserved range for processor */ 362 #define SHN_HIPROC 0xff1f /* specific section indexes */ 363 #define SHN_LOOS 0xff20 /* reserved range for operating */ 364 #define SHN_HIOS 0xff3f /* system specific section indexes */ 365 #define SHN_ABS 0xfff1 /* absolute value */ 366 #define SHN_COMMON 0xfff2 /* common symbol */ 367 #define SHN_XINDEX 0xffff /* escape value for oversize index */ 368 #define SHN_HIRESERVE 0xffff /* upper bounds of reserved indexes */ 370 369 371 370 // ------------------------------------------------------------------------- 372 371 /* sh_type */ 373 372 374 #define SHT_NULL 0 /* inactive */375 #define SHT_PROGBITS 1 /* program defined information */376 #define SHT_SYMTAB 2 /* symbol table section */377 #define SHT_STRTAB 3 /* string table section */378 #define SHT_RELA 4 /* relocation section with addends*/379 #define SHT_HASH 5 /* symbol hash table section */380 #define SHT_DYNAMIC 6 /* dynamic section */381 #define SHT_NOTE 7 /* note section */382 #define SHT_NOBITS 8 /* no space section */383 #define SHT_REL 9 /* relation section without addends */384 #define SHT_SHLIB 10 /* reserved - purpose unknown */385 #define SHT_DYNSYM 11 /* dynamic symbol table section */386 #define SHT_INIT_ARRAY 14 /* init procedure array */387 #define SHT_FINI_ARRAY 15 /* fini procedure array */388 #define SHT_PREINIT_ARRAY 16 /* preinit procedure array */389 #define SHT_GROUP 17 /* section group */390 #define SHT_SYMTAB_SHNDX 18 /* oversize index table */391 #define SHT_NUM 19 /* number of section types */392 #define SHT_LOOS 0x60000000 /* reserved range for O/S */393 #define SHT_HIOS 0x6fffffff /* specific section header types */394 #define SHT_LOPROC 0x70000000 /* reserved range for processor */395 #define SHT_HIPROC 0x7fffffff /* specific section header types */396 #define SHT_LOUSER 0x80000000 /* reserved range for application */397 #define SHT_HIUSER 0xffffffff /* specific indexes */373 #define SHT_NULL 0 /* inactive */ 374 #define SHT_PROGBITS 1 /* program defined information */ 375 #define SHT_SYMTAB 2 /* symbol table section */ 376 #define SHT_STRTAB 3 /* string table section */ 377 #define SHT_RELA 4 /* relocation section with addends */ 378 #define SHT_HASH 5 /* symbol hash table section */ 379 #define SHT_DYNAMIC 6 /* dynamic section */ 380 #define SHT_NOTE 7 /* note section */ 381 #define SHT_NOBITS 8 /* no space section */ 382 #define SHT_REL 9 /* relation section without addends */ 383 #define SHT_SHLIB 10 /* reserved - purpose unknown */ 384 #define SHT_DYNSYM 11 /* dynamic symbol table section */ 385 #define SHT_INIT_ARRAY 14 /* init procedure array */ 386 #define SHT_FINI_ARRAY 15 /* fini procedure array */ 387 #define SHT_PREINIT_ARRAY 16 /* preinit procedure array */ 388 #define SHT_GROUP 17 /* section group */ 389 #define SHT_SYMTAB_SHNDX 18 /* oversize index table */ 390 #define SHT_NUM 19 /* number of section types */ 391 #define SHT_LOOS 0x60000000 /* reserved range for O/S */ 392 #define SHT_HIOS 0x6fffffff /* specific section header types */ 393 #define SHT_LOPROC 0x70000000 /* reserved range for processor */ 394 #define SHT_HIPROC 0x7fffffff /* specific section header types */ 395 #define SHT_LOUSER 0x80000000 /* reserved range for application */ 396 #define SHT_HIUSER 0xffffffff /* specific indexes */ 398 397 399 398 // ------------------------------------------------------------------------- 400 399 /* Section names */ 401 400 402 #define ELF_BSS ".bss" /* uninitialized data */403 #define ELF_DATA ".data" /* initialized data */404 #define ELF_DEBUG ".debug" /* debug */405 #define ELF_DYNAMIC ".dynamic" /* dynamic linking information */406 #define ELF_DYNSTR ".dynstr" /* dynamic string table */407 #define ELF_DYNSYM ".dynsym" /* dynamic symbol table */408 #define ELF_FINI ".fini" /* termination code */409 #define ELF_GOT ".got" /* global offset table */410 #define ELF_HASH ".hash" /* symbol hash table */411 #define ELF_INIT ".init" /* initialization code */412 #define ELF_REL_DATA ".rel.data" /* relocation data */413 #define ELF_REL_FINI ".rel.fini" /* relocation termination code */414 #define ELF_REL_INIT ".rel.init" /* relocation initialization code */415 #define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */416 #define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */417 #define ELF_REL_TEXT ".rel.text" /* relocation code */418 #define ELF_RODATA ".rodata" /* read-only data */419 #define ELF_SHSTRTAB ".shstrtab" /* section header string table */420 #define ELF_STRTAB ".strtab" /* string table */421 #define ELF_SYMTAB ".symtab" /* symbol table */422 #define ELF_TEXT ".text" /* code */401 #define ELF_BSS ".bss" /* uninitialized data */ 402 #define ELF_DATA ".data" /* initialized data */ 403 #define ELF_DEBUG ".debug" /* debug */ 404 #define ELF_DYNAMIC ".dynamic" /* dynamic linking information */ 405 #define ELF_DYNSTR ".dynstr" /* dynamic string table */ 406 #define ELF_DYNSYM ".dynsym" /* dynamic symbol table */ 407 #define ELF_FINI ".fini" /* termination code */ 408 #define ELF_GOT ".got" /* global offset table */ 409 #define ELF_HASH ".hash" /* symbol hash table */ 410 #define ELF_INIT ".init" /* initialization code */ 411 #define ELF_REL_DATA ".rel.data" /* relocation data */ 412 #define ELF_REL_FINI ".rel.fini" /* relocation termination code */ 413 #define ELF_REL_INIT ".rel.init" /* relocation initialization code */ 414 #define ELF_REL_DYN ".rel.dyn" /* relocaltion dynamic link info */ 415 #define ELF_REL_RODATA ".rel.rodata" /* relocation read-only data */ 416 #define ELF_REL_TEXT ".rel.text" /* relocation code */ 417 #define ELF_RODATA ".rodata" /* read-only data */ 418 #define ELF_SHSTRTAB ".shstrtab" /* section header string table */ 419 #define ELF_STRTAB ".strtab" /* string table */ 420 #define ELF_SYMTAB ".symtab" /* symbol table */ 421 #define ELF_TEXT ".text" /* code */ 423 422 424 423 // ------------------------------------------------------------------------- 425 424 /* Section Attribute Flags - sh_flags */ 426 425 427 #define SHF_WRITE 0x001 /* Writable */428 #define SHF_ALLOC 0x002 /* occupies memory */429 #define SHF_EXECINSTR 0x004 /* executable */430 #define SHF_MERGE 0x010 /* merge data */431 #define SHF_STRINGS 0x020 /* contains strings */432 #define SHF_INFO_LINK 0x040 /* link in sh_info field */433 #define SHF_LINK_ORDER 0x080 /* preserve link order */434 #define SHF_OS_NONCONFORMING 0x100 /* special OS-specific */435 /* processing needed */436 #define SHF_GROUP 0x200 /* member of group */437 #define SHF_MASKOS 0x0ff00000 /* reserved bits for OS */438 /* specific section attributes */439 #define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */440 /* specific section attributes */426 #define SHF_WRITE 0x001 /* Writable */ 427 #define SHF_ALLOC 0x002 /* occupies memory */ 428 #define SHF_EXECINSTR 0x004 /* executable */ 429 #define SHF_MERGE 0x010 /* merge data */ 430 #define SHF_STRINGS 0x020 /* contains strings */ 431 #define SHF_INFO_LINK 0x040 /* link in sh_info field */ 432 #define SHF_LINK_ORDER 0x080 /* preserve link order */ 433 #define SHF_OS_NONCONFORMING 0x100 /* special OS-specific */ 434 /* processing needed */ 435 #define SHF_GROUP 0x200 /* member of group */ 436 #define SHF_MASKOS 0x0ff00000 /* reserved bits for OS */ 437 /* specific section attributes */ 438 #define SHF_MASKPROC 0xf0000000 /* reserved bits for processor */ 439 /* specific section attributes */ 441 440 442 441 // ------------------------------------------------------------------------- … … 444 443 445 444 typedef struct { 446 Elf32_Word st_name;/* name - index into string table */447 Elf32_Addr st_value;/* symbol value */448 Elf32_Word st_size;/* symbol size */449 unsigned char st_info;/* type and binding */450 unsigned char st_other;/* visibility */451 Elf32_Half st_shndx;/* section header index */445 Elf32_Word st_name; /* name - index into string table */ 446 Elf32_Addr st_value; /* symbol value */ 447 Elf32_Word st_size; /* symbol size */ 448 unsigned char st_info; /* type and binding */ 449 unsigned char st_other; /* visibility */ 450 Elf32_Half st_shndx; /* section header index */ 452 451 } Elf32_Sym; 453 452 454 453 typedef struct { 455 Elf64_Word st_name;/* Symbol name index in str table */456 unsigned char st_info;/* type / binding attrs */457 unsigned char st_other;/* visibility */458 Elf64_Half st_shndx;/* section index of symbol */459 Elf64_Addr st_value;/* value of symbol */460 Elf64_Xword st_size;/* size of symbol */454 Elf64_Word st_name; /* Symbol name index in str table */ 455 unsigned char st_info; /* type / binding attrs */ 456 unsigned char st_other; /* visibility */ 457 Elf64_Half st_shndx; /* section index of symbol */ 458 Elf64_Addr st_value; /* value of symbol */ 459 Elf64_Xword st_size; /* size of symbol */ 461 460 } Elf64_Sym; 462 461 … … 464 463 /* Symbol table index */ 465 464 466 #define STN_UNDEF 0 /* undefined */465 #define STN_UNDEF 0 /* undefined */ 467 466 468 467 /* Extract symbol info - st_info */ … … 481 480 /* Symbol Binding - ELF32_ST_BIND - st_info */ 482 481 483 #define STB_LOCAL 0 /* Local symbol */484 #define STB_GLOBAL 1 /* Global symbol */485 #define STB_WEAK 2 /* like global - lower precedence */486 #define STB_NUM 3 /* number of symbol bindings */487 #define STB_LOOS 10 /* reserved range for OS */488 #define STB_HIOS 12 /* specific symbol bindings */489 #define STB_LOPROC 13 /* reserved range for processor */490 #define STB_HIPROC 15 /* specific symbol bindings */482 #define STB_LOCAL 0 /* Local symbol */ 483 #define STB_GLOBAL 1 /* Global symbol */ 484 #define STB_WEAK 2 /* like global - lower precedence */ 485 #define STB_NUM 3 /* number of symbol bindings */ 486 #define STB_LOOS 10 /* reserved range for OS */ 487 #define STB_HIOS 12 /* specific symbol bindings */ 488 #define STB_LOPROC 13 /* reserved range for processor */ 489 #define STB_HIPROC 15 /* specific symbol bindings */ 491 490 492 491 // ------------------------------------------------------------------------- 493 492 /* Symbol type - ELF32_ST_TYPE - st_info */ 494 493 495 #define STT_NOTYPE 0 /* not specified */496 #define STT_OBJECT 1 /* data object */497 #define STT_FUNC 2 /* function */498 #define STT_SECTION 3 /* section */499 #define STT_FILE 4 /* file */500 #define STT_COMMON 5 /* common block */501 #define STT_NUM 6 /* number of symbol types */502 #define STT_LOOS 10 /* reserved range for OS */503 #define STT_HIOS 12 /* specific symbol types */504 #define STT_LOPROC 13 /* reserved range for processor */505 #define STT_HIPROC 15 /* specific symbol types */494 #define STT_NOTYPE 0 /* not specified */ 495 #define STT_OBJECT 1 /* data object */ 496 #define STT_FUNC 2 /* function */ 497 #define STT_SECTION 3 /* section */ 498 #define STT_FILE 4 /* file */ 499 #define STT_COMMON 5 /* common block */ 500 #define STT_NUM 6 /* number of symbol types */ 501 #define STT_LOOS 10 /* reserved range for OS */ 502 #define STT_HIOS 12 /* specific symbol types */ 503 #define STT_LOPROC 13 /* reserved range for processor */ 504 #define STT_HIPROC 15 /* specific symbol types */ 506 505 507 506 // ------------------------------------------------------------------------- 508 507 // symbol visibility in st_other 509 508 510 #define STV_DEFAULT 0 /* default to binding type */511 #define STV_INTERNAL 1 /* processor specific */512 #define STV_HIDDEN 2 /* invisible */513 #define STV_PROTECTED 3 /* non-premptable */509 #define STV_DEFAULT 0 /* default to binding type */ 510 #define STV_INTERNAL 1 /* processor specific */ 511 #define STV_HIDDEN 2 /* invisible */ 512 #define STV_PROTECTED 3 /* non-premptable */ 514 513 515 514 // ------------------------------------------------------------------------- … … 517 516 518 517 /* Relocation entry with implicit addend */ 519 typedef struct 520 { 521 Elf32_Addr r_offset; /* offset of relocation */ 522 Elf32_Word r_info; /* symbol table index and type */ 518 typedef struct { 519 Elf32_Addr r_offset; /* offset of relocation */ 520 Elf32_Word r_info; /* symbol table index and type */ 523 521 } Elf32_Rel; 524 522 525 523 /* Relocation entry with explicit addend */ 526 typedef struct 527 { 528 Elf32_Addr r_offset; /* offset of relocation */ 529 Elf32_Word r_info; /* symbol table index and type */ 530 Elf32_Sword r_addend; 524 typedef struct { 525 Elf32_Addr r_offset; /* offset of relocation */ 526 Elf32_Word r_info; /* symbol table index and type */ 527 Elf32_Sword r_addend; 531 528 } Elf32_Rela; 532 529 … … 540 537 541 538 typedef struct { 542 Elf64_Addr r_offset;/* where to do it */543 Elf64_Xword r_info;/* index & type of relocation */539 Elf64_Addr r_offset; /* where to do it */ 540 Elf64_Xword r_info; /* index & type of relocation */ 544 541 } Elf64_Rel; 545 542 546 543 typedef struct { 547 Elf64_Addr r_offset;/* where to do it */548 Elf64_Xword r_info;/* index & type of relocation */549 Elf64_Sxword r_addend;/* adjustment value */544 Elf64_Addr r_offset; /* where to do it */ 545 Elf64_Xword r_info; /* index & type of relocation */ 546 Elf64_Sxword r_addend; /* adjustment value */ 550 547 } Elf64_RelA; 551 548 … … 558 555 559 556 typedef struct { 560 Elf32_Word p_type;/* segment type */561 Elf32_Off p_offset;/* segment offset */562 Elf32_Addr p_vaddr;/* virtual address of segment */563 Elf32_Addr p_paddr;/* physical address - ignored? */564 Elf32_Word p_filesz;/* number of bytes in file for seg. */565 Elf32_Word p_memsz;/* number of bytes in mem. for seg. */566 Elf32_Word p_flags;/* flags */567 Elf32_Word p_align;/* memory alignment */557 Elf32_Word p_type; /* segment type */ 558 Elf32_Off p_offset; /* segment offset */ 559 Elf32_Addr p_vaddr; /* virtual address of segment */ 560 Elf32_Addr p_paddr; /* physical address - ignored? */ 561 Elf32_Word p_filesz; /* number of bytes in file for seg. */ 562 Elf32_Word p_memsz; /* number of bytes in mem. for seg. */ 563 Elf32_Word p_flags; /* flags */ 564 Elf32_Word p_align; /* memory alignment */ 568 565 } Elf32_Phdr; 569 566 570 567 typedef struct { 571 Elf64_Word p_type;/* entry type */572 Elf64_Word p_flags;/* flags */573 Elf64_Off p_offset;/* offset */574 Elf64_Addr p_vaddr;/* virtual address */575 Elf64_Addr p_paddr;/* physical address */576 Elf64_Xword p_filesz;/* file size */577 Elf64_Xword p_memsz;/* memory size */578 Elf64_Xword p_align;/* memory & file alignment */568 Elf64_Word p_type; /* entry type */ 569 Elf64_Word p_flags; /* flags */ 570 Elf64_Off p_offset; /* offset */ 571 Elf64_Addr p_vaddr; /* virtual address */ 572 Elf64_Addr p_paddr; /* physical address */ 573 Elf64_Xword p_filesz; /* file size */ 574 Elf64_Xword p_memsz; /* memory size */ 575 Elf64_Xword p_align; /* memory & file alignment */ 579 576 } Elf64_Phdr; 580 577 … … 582 579 /* Segment types - p_type */ 583 580 584 #define PT_NULL 0 /* unused */585 #define PT_LOAD 1 /* loadable segment */586 #define PT_DYNAMIC 2 /* dynamic linking section */587 #define PT_INTERP 3 /* the RTLD */588 #define PT_NOTE 4 /* auxiliary information */589 #define PT_SHLIB 5 /* reserved - purpose undefined */590 #define PT_PHDR 6 /* program header */591 #define PT_NUM 7 /* Number of segment types */592 #define PT_LOOS 0x60000000 /* reserved range for OS */593 #define PT_HIOS 0x6fffffff /* specific segment types */594 #define PT_LOPROC 0x70000000 /* reserved range for processor */595 #define PT_HIPROC 0x7fffffff /* specific segment types */581 #define PT_NULL 0 /* unused */ 582 #define PT_LOAD 1 /* loadable segment */ 583 #define PT_DYNAMIC 2 /* dynamic linking section */ 584 #define PT_INTERP 3 /* the RTLD */ 585 #define PT_NOTE 4 /* auxiliary information */ 586 #define PT_SHLIB 5 /* reserved - purpose undefined */ 587 #define PT_PHDR 6 /* program header */ 588 #define PT_NUM 7 /* Number of segment types */ 589 #define PT_LOOS 0x60000000 /* reserved range for OS */ 590 #define PT_HIOS 0x6fffffff /* specific segment types */ 591 #define PT_LOPROC 0x70000000 /* reserved range for processor */ 592 #define PT_HIPROC 0x7fffffff /* specific segment types */ 596 593 597 594 // ------------------------------------------------------------------------- 598 595 /* Segment flags - p_flags */ 599 596 600 #define PF_X 0x1 /* Executable */601 #define PF_W 0x2 /* Writable */602 #define PF_R 0x4 /* Readable */603 #define PF_MASKOS 0x0ff00000 /* reserved bits for OS */604 /* specific segment flags */605 #define PF_MASKPROC 0xf0000000 /* reserved bits for processor */606 /* specific segment flags */597 #define PF_X 0x1 /* Executable */ 598 #define PF_W 0x2 /* Writable */ 599 #define PF_R 0x4 /* Readable */ 600 #define PF_MASKOS 0x0ff00000 /* reserved bits for OS */ 601 /* specific segment flags */ 602 #define PF_MASKPROC 0xf0000000 /* reserved bits for processor */ 603 /* specific segment flags */ 607 604 608 605 // ------------------------------------------------------------------------- … … 610 607 611 608 typedef struct { 612 Elf32_Sword d_tag;/* controls meaning of d_val */613 union {614 Elf32_Word d_val;/* Multiple meanings - see d_tag */615 Elf32_Addr d_ptr;/* program virtual address */616 } d_un;609 Elf32_Sword d_tag; /* controls meaning of d_val */ 610 union { 611 Elf32_Word d_val; /* Multiple meanings - see d_tag */ 612 Elf32_Addr d_ptr; /* program virtual address */ 613 } d_un; 617 614 } Elf32_Dyn; 618 615 619 extern Elf32_Dyn _DYNAMIC[];/* XXX not 64-bit clean */620 621 typedef struct { 622 Elf64_Sxword d_tag;/* controls meaning of d_val */623 union {624 Elf64_Xwordd_val;625 Elf64_Addrd_ptr;626 } d_un;616 extern Elf32_Dyn _DYNAMIC[]; /* XXX not 64-bit clean */ 617 618 typedef struct { 619 Elf64_Sxword d_tag; /* controls meaning of d_val */ 620 union { 621 Elf64_Xword d_val; 622 Elf64_Addr d_ptr; 623 } d_un; 627 624 } Elf64_Dyn; 628 625 … … 630 627 /* Dynamic Array Tags - d_tag */ 631 628 632 #define DT_NULL 0 /* marks end of _DYNAMIC array */633 #define DT_NEEDED 1 /* string table offset of needed lib */634 #define DT_PLTRELSZ 2 /* size of relocation entries in PLT */635 #define DT_PLTGOT 3 /* address PLT/GOT */636 #define DT_HASH 4 /* address of symbol hash table */637 #define DT_STRTAB 5 /* address of string table */638 #define DT_SYMTAB 6 /* address of symbol table */639 #define DT_RELA 7 /* address of relocation table */640 #define DT_RELASZ 8 /* size of relocation table */641 #define DT_RELAENT 9 /* size of relocation entry */642 #define DT_STRSZ 10 /* size of string table */643 #define DT_SYMENT 11 /* size of symbol table entry */644 #define DT_INIT 12 /* address of initialization func. */645 #define DT_FINI 13 /* address of termination function */646 #define DT_SONAME 14 /* string table offset of shared obj */647 #define DT_RPATH 15 /* string table offset of library648 search path */649 #define DT_SYMBOLIC 16 /* start sym search in shared obj. */650 #define DT_REL 17 /* address of rel. tbl. w addends */651 #define DT_RELSZ 18 /* size of DT_REL relocation table */652 #define DT_RELENT 19 /* size of DT_REL relocation entry */653 #define DT_PLTREL 20 /* PLT referenced relocation entry */654 #define DT_DEBUG 21 /* bugger */655 #define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */656 #define DT_JMPREL 23 /* add. of PLT's relocation entries */657 #define DT_BIND_NOW 24 /* Bind now regardless of env setting */658 #define DT_INIT_ARRAY 25 /* init array address */659 #define DT_FINI_ARRAY 26 /* fini array address */660 #define DT_INIT_ARRAYSZ 27 /* init array size */661 #define DT_FINI_ARRAYSZ 28 /* fini array size */662 #define DT_RUNPATH 29 /* library search path */663 #define DT_FLAGS 30 /* flags */664 #define DT_ENCODING 32 /* encoding rules start here */665 #define DT_PREINIT_ARRAY 32 /* preinit array address */666 #define DT_PREINIT_ARRAYSZ 33 /* preinit array size */667 #define DT_NUM 26 /* Number used. */668 #define DT_LOOS 0x60000000 /* reserved range for OS */669 #define DT_HIOS 0x6fffffff /* specific dynamic array tags */670 #define DT_LOPROC 0x70000000 /* reserved range for processor */671 #define DT_HIPROC 0x7fffffff /* specific dynamic array tags */629 #define DT_NULL 0 /* marks end of _DYNAMIC array */ 630 #define DT_NEEDED 1 /* string table offset of needed lib */ 631 #define DT_PLTRELSZ 2 /* size of relocation entries in PLT */ 632 #define DT_PLTGOT 3 /* address PLT/GOT */ 633 #define DT_HASH 4 /* address of symbol hash table */ 634 #define DT_STRTAB 5 /* address of string table */ 635 #define DT_SYMTAB 6 /* address of symbol table */ 636 #define DT_RELA 7 /* address of relocation table */ 637 #define DT_RELASZ 8 /* size of relocation table */ 638 #define DT_RELAENT 9 /* size of relocation entry */ 639 #define DT_STRSZ 10 /* size of string table */ 640 #define DT_SYMENT 11 /* size of symbol table entry */ 641 #define DT_INIT 12 /* address of initialization func. */ 642 #define DT_FINI 13 /* address of termination function */ 643 #define DT_SONAME 14 /* string table offset of shared obj */ 644 #define DT_RPATH 15 /* string table offset of library 645 search path */ 646 #define DT_SYMBOLIC 16 /* start sym search in shared obj. */ 647 #define DT_REL 17 /* address of rel. tbl. w addends */ 648 #define DT_RELSZ 18 /* size of DT_REL relocation table */ 649 #define DT_RELENT 19 /* size of DT_REL relocation entry */ 650 #define DT_PLTREL 20 /* PLT referenced relocation entry */ 651 #define DT_DEBUG 21 /* bugger */ 652 #define DT_TEXTREL 22 /* Allow rel. mod. to unwritable seg */ 653 #define DT_JMPREL 23 /* add. of PLT's relocation entries */ 654 #define DT_BIND_NOW 24 /* Bind now regardless of env setting */ 655 #define DT_INIT_ARRAY 25 /* init array address */ 656 #define DT_FINI_ARRAY 26 /* fini array address */ 657 #define DT_INIT_ARRAYSZ 27 /* init array size */ 658 #define DT_FINI_ARRAYSZ 28 /* fini array size */ 659 #define DT_RUNPATH 29 /* library search path */ 660 #define DT_FLAGS 30 /* flags */ 661 #define DT_ENCODING 32 /* encoding rules start here */ 662 #define DT_PREINIT_ARRAY 32 /* preinit array address */ 663 #define DT_PREINIT_ARRAYSZ 33 /* preinit array size */ 664 #define DT_NUM 26 /* Number used. */ 665 #define DT_LOOS 0x60000000 /* reserved range for OS */ 666 #define DT_HIOS 0x6fffffff /* specific dynamic array tags */ 667 #define DT_LOPROC 0x70000000 /* reserved range for processor */ 668 #define DT_HIPROC 0x7fffffff /* specific dynamic array tags */ 672 669 673 670 // ------------------------------------------------------------------------- 674 671 // Values for DT_FLAGS entry 675 672 676 #define DF_ORIGIN 0x1 /* Uses $ORIGIN substitution string */677 #define DF_SYMBOLIC 0x2 /* search for symbols here first */678 #define DF_TEXTREL 0x4 /* text may be relocatable */679 #define DF_BIND_NOW 0x8 /* bind references now, dammit */673 #define DF_ORIGIN 0x1 /* Uses $ORIGIN substitution string */ 674 #define DF_SYMBOLIC 0x2 /* search for symbols here first */ 675 #define DF_TEXTREL 0x4 /* text may be relocatable */ 676 #define DF_BIND_NOW 0x8 /* bind references now, dammit */ 680 677 681 678 // ------------------------------------------------------------------------- … … 683 680 684 681 typedef struct { 685 Elf32_Word namesz;686 Elf32_Word descsz;687 Elf32_Word type;682 Elf32_Word namesz; 683 Elf32_Word descsz; 684 Elf32_Word type; 688 685 } Elf32_Note; 689 686 690 687 typedef struct { 691 Elf64_Word namesz;692 Elf64_Word descsz;693 Elf64_Word type;688 Elf64_Word namesz; 689 Elf64_Word descsz; 690 Elf64_Word type; 694 691 } Elf64_Note; 695 692 … … 699 696 700 697 typedef struct { 701 Elf32_Word nbucket;/* number of buckets */702 Elf32_Word nchain;/* number of chains */703 704 /* The buckets follow this structure in memory and the chains705 follow those. */698 Elf32_Word nbucket; /* number of buckets */ 699 Elf32_Word nchain; /* number of chains */ 700 701 /* The buckets follow this structure in memory and the chains 702 follow those. */ 706 703 } Elf_Hash; 707 704 708 705 // ------------------------------------------------------------------------- 709 #endif // ifndef CYGONCE_REDBOOT_ELF_H706 #endif // ifndef CYGONCE_REDBOOT_ELF_H 710 707 // EOF elf.h ar5315_microredboot/microredboot/boot/src/lib/fis.c
r13101 r13107 24 24 unsigned int copy = highoffset; 25 25 int c = SCANCOUNT; 26 while ((c--) >0) {26 while ((c--) > 0) { 27 27 highoffset -= erasesize; 28 28 unsigned char *p = (unsigned char *)highoffset; … … 30 30 return highoffset; 31 31 } 32 return copy - erasesize; // default offset, if not found32 return copy - erasesize; // default offset, if not found 33 33 } 34 34 … … 72 72 count++; 73 73 } 74 printf("no bootable image found, try default location 0x%08X\n",flashbase+0x10000); 74 printf("no bootable image found, try default location 0x%08X\n", 75 flashbase + 0x10000); 75 76 bootoffset = 0x80041000; 76 77 output_data = (uch *) 0x80041000; 77 return flashbase +0x10000; //first available address after bootloader78 return flashbase + 0x10000; //first available address after bootloader 78 79 } ar5315_microredboot/microredboot/boot/src/misc_lzma.c
r13100 r13107 20 20 #include <asm/uaccess.h> 21 21 #include "ramconfig.h" 22 #include "revision.h" 22 23 #ifdef AR7100 23 24 #define inline … … 311 312 /* initialize clock */ 312 313 HAL_CLOCK_INITIALIZE(RTC_PERIOD); 313 printf("MicroRedBoot v1.4, (c) 2009 DD-WRT.COM (%s )\n", __DATE__);314 printf("MicroRedBoot v1.4, (c) 2009 DD-WRT.COM (%s REVISION %s)\n", __DATE__,SVN_REVISION); 314 315 printf("keep the reset button pushed to enter redboot!\n"); 315 #ifdef AR7100 316 printf("CPU Type: AR7100\n"); 317 #elif AR5312 318 printf("CPU Type: AR5312\n"); 319 #else 320 printf("CPU Type: AR5315\n"); 321 #endif 316 printf("CPU Type: Atheros AR%s\n",get_system_type()); 322 317 printf("CPU Clock: %dMhz\n", cpu_frequency() / 1000000); 323 318 nvram_init(); ar5315_microredboot/microredboot/boot/src/ramconfig.h
r13097 r13107 1 1 #define RAM_SIZE 0x2000000 2 #define AR 710012 #define AR5312 1 3 3 #define RESETBUTTON 0x06 4 #define RESETBUTTON 0x18 ar5315_microredboot/microredboot/build_targets.sh
r13090 r13107 63 63 cp images/*.rom images_default 64 64 65 rm -f images/* 66 make pb44 RESETBUTTON=0x18 FIS=0 67 mkdir images_default 68 cp images/*.rom images_default 69 70 rm -f images/* 71 make pb42 RESETBUTTON=0x18 FIS=0 72 mkdir images_default 73 cp images/*.rom images_default 74 65 75 66 76 cp -rv images_senao /GruppenLW/releases/images ar5315_microredboot/microredboot/ecos/packages/devs/eth/mips/ar7100/current/src/vsc8601_phy.c
r13097 r13107 42 42 #endif 43 43 44 #include "ag7100_phy.h" 44 45 #include "vsc8601_phy.h" 45 46 ar5315_microredboot/microredboot/ecos/packages/hal/mips/ar7100/current/src/ar7100_serial.c
r13095 r13107 234 234 235 235 // Set baud rate. 236 cyg_hal_plf_serial_set_baud(port, hal_ar7100_sys_frequency() / (16 * 237 CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD)); 236 cyg_hal_plf_serial_set_baud(port, hal_ar7100_sys_frequency() / (16 * CYGNUM_HAL_VIRTUAL_VECTOR_CHANNELS_DEFAULT_BAUD)); 238 237 239 238 // Enable and clear FIFO ar5315_microredboot/microredboot/ecos/packages/hal/mips/pb44/current/cdl/hal_mips_pb44.cdl
r13095 r13107 195 195 display "Linked entry address" 196 196 flavor data 197 default_value 0x800 10000197 default_value 0x80000000 198 198 description "Text segment load address." 199 199 } ar5315_microredboot/microredboot/ecos/packages/hal/mips/pb44/current/include/pkgconf/mlt_mips_pb44_ram.ldi
r13095 r13107 11 11 { 12 12 SECTIONS_BEGIN 13 SECTION_rom_vectors (ram, CYGNUM_RAM_ENTRY, LMA_EQ_VMA)13 SECTION_rom_vectors (ram, 0x80000400, LMA_EQ_VMA) 14 14 SECTION_ROMISC (ram, ALIGN (0x4), LMA_EQ_VMA) 15 15 SECTION_RELOCS (ram, ALIGN (0x4), LMA_EQ_VMA) ar5315_microredboot/microredboot/ecos/packages/hal/mips/pb44/current/misc/redboot_RAM.ecm
r13095 r13107 21 21 package -template CYGPKG_LIBC_STRING current ; 22 22 package CYGPKG_MEMALLOC current ; 23 package CYGPKG_COMPRESS_ZLIB current ;24 23 package CYGPKG_COMPRESS_7ZIP current ; 25 24 package CYGPKG_IO_ETH_DRIVERS current ; 26 package CYGPKG_IO_FILEIO current ;27 25 package CYGPKG_IO_FLASH current ; 28 26 package CYGPKG_DEVS_FLASH_AR7100 current ; … … 81 79 82 80 cdl_option CYGBLD_REDBOOT_MIN_IMAGE_SIZE { 83 inferred_value 0x 4000081 inferred_value 0x10000 84 82 }; 85 83 … … 123 121 inferred_value 1 <cyg/fileio/dirent.h> 124 122 }; 125 126 cdl_option CYGBLD_ISO_OPEN_MAX_HEADER {127 inferred_value 1 <cyg/fileio/limits.h>128 };129 130 cdl_option CYGBLD_ISO_NAME_MAX_HEADER {131 inferred_value 1 <cyg/fileio/limits.h>132 };133 134 cdl_option CYGPKG_IO_FILEIO_INODE {135 inferred_value 1136 };ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/fwupgrade_senao.c
r13090 r13107 1 1 2 /* 2 3 firmware upgrade code for senao webflash images … … 8 9 #include <flash_config.h> 9 10 #include "fwupgrade.h" 11 #ifndef CYGPKG_HAL_MIPS_AR7100 10 12 11 13 /* some variables from flash.c */ … … 100 102 return 0; 101 103 } 104 #endif ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/fwupgrade_ubnt.c
r13090 r13107 74 74 diag_printf 75 75 ("UBNT_FW: cannot upgrade, wrong target platform. only ar2313 is valid"); 76 return -1; 77 } 78 #endif 79 #if defined(CYGPKG_HAL_MIPS_AR7100) 80 if (strncmp((unsigned char *)&header->version[4], "ar7100", 6) && strncmp((unsigned char *)&header->version[6], "ar7100pro", 9)) { 81 diag_printf 82 ("UBNT_FW: cannot upgrade, wrong target platform. only ar7100 (RouterStation) or ar7100pro (RouterStation PRO) is valid"); 76 83 return -1; 77 84 } … … 164 171 unsigned int base = ntohl(fwp->header->baseaddr); 165 172 /* convert flash mappings to fit to the current bootloader flash mapping which might be incompatible */ 173 #if defined(CYGPKG_HAL_MIPS_AR7100) 174 if ((base & 0xbf00000) == 0xbf00000) { 175 base ^= 0xbf00000; // for AR7100 176 } 177 #else 166 178 if ((base & 0xbfc00000) == 0xbfc00000) { 167 base ^= 0xbfc00000; 179 base ^= 0xbfc00000;// mips mapping 168 180 } else if ((base & 0xbe00000) == 0xbe00000) { 169 base ^= 0xbe00000; 181 base ^= 0xbe00000; // for AR5312 170 182 } else if ((base & 0xa800000) == 0xa800000) { 171 base ^= 0xa800000; 172 } 183 base ^= 0xa800000; // for AR5315 8 MB mapping 184 } 185 #endif 173 186 base |= CYGNUM_FLASH_BASE; 174 187 if ((stat = ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/fwupgrade_wili.c
r13090 r13107 8 8 #include <flash_config.h> 9 9 #include "fwupgrade_wili.h" 10 #ifndef CYGPKG_HAL_MIPS_AR7100 10 11 11 12 /* some variables from flash.c */ … … 278 279 return 0; 279 280 } 281 #endif ar5315_microredboot/microredboot/ecos/packages/redboot/current/src/net/tftp_server.c
r13090 r13107 101 101 {.name = "DD-WRT",.fw_check_image = fw_check_image_ddwrt}, 102 102 {.name = "UBIQUITI",.fw_check_image = fw_check_image_ubnt}, 103 #ifndef CYGPKG_HAL_MIPS_AR7100 103 104 {.name = "WILIGEAR",.fw_check_image = fw_check_image_wili}, 104 105 {.name = "SENAO",.fw_check_image = fw_check_image_senao}, 106 #endif 105 107 }; 106 108 ar5315_microredboot/microredboot/makefile
r13097 r13107 135 135 $(PLATFORM_BLD_CUST) 136 136 $(PLATFORM_RAM_BUILD) 137 cp redboot/pb42/ram/install/bin/redboot.rom images/redboot_pb42_32M_8M_kendin.rom 138 cp redboot/pb42/ram/install/bin/redboot.img images/redboot_pb42_32M_8M_kendin.elf 137 cp redboot/pb42/ram/install/bin/redboot.rom images/redboot_pb42_32M_8M_admtek.rom 138 # cp redboot/pb42/ram/install/bin/redboot.img images/redboot_pb42_32M_8M_admtek.elf 139 140 141 pb44: BOARD_TYPE=pb44 142 pb44: 143 # RAM version 144 $(PLATFORM_RAM_START) \ 145 ecosconfig import $(ECOS_REPOSITORY)/hal/mips/pb44/current/misc/redboot_RAM.ecm; \ 146 ecosconfig import $(REDBOOT_DIR)/options/eth_ar7100/vsc8601_phy; \ 147 ecosconfig tree; \ 148 $(PLATFORM_BLD_CUST) 149 $(PLATFORM_RAM_BUILD) 150 cp redboot/pb44/ram/install/bin/redboot.rom images/redboot_pb44_32M_8M_vsc8601.rom 151 # cp redboot/pb44/ram/install/bin/redboot.img images/redboot_pb42_32M_8M_kendin.elf 152 139 153 140 154 #
