projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use the generic GPIO api for bcm947xx and ar7 (for now), thanks to Gabor Juhos
[openwrt.git]
/
target
/
linux
/
adm5120-2.6
/
image
/
lzma-loader
/
src
/
decompress.c
diff --git
a/target/linux/adm5120-2.6/image/lzma-loader/src/decompress.c
b/target/linux/adm5120-2.6/image/lzma-loader/src/decompress.c
index
b0ed2fc
..
ec63ccb
100644
(file)
--- a/
target/linux/adm5120-2.6/image/lzma-loader/src/decompress.c
+++ b/
target/linux/adm5120-2.6/image/lzma-loader/src/decompress.c
@@
-30,6
+30,9
@@
* 24-Apr-2005 Oleg I. Vdovikin
* reordered functions using lds script, removed forward decl
*
* 24-Apr-2005 Oleg I. Vdovikin
* reordered functions using lds script, removed forward decl
*
+ * 24-Mar-2007 Gabor Juhos
+ * pass original values of the a0,a1,a2,a3 registers to the kernel
+ *
*/
#include "LzmaDecode.h"
*/
#include "LzmaDecode.h"
@@
-93,6
+96,9
@@
extern unsigned char workspace[];
unsigned int offset;
unsigned char *data;
unsigned int offset;
unsigned char *data;
+typedef void (*kernel_entry)(unsigned long reg_a0, unsigned long reg_a1,
+ unsigned long reg_a2, unsigned long reg_a3);
+
/* flash access should be aligned, so wrapper is used */
/* read byte from the flash, all accesses are 32-bit aligned */
static int read_byte(void *object, unsigned char **buffer, UInt32 *bufferSize)
/* flash access should be aligned, so wrapper is used */
/* read byte from the flash, all accesses are 32-bit aligned */
static int read_byte(void *object, unsigned char **buffer, UInt32 *bufferSize)
@@
-103,10
+109,10
@@
static int read_byte(void *object, unsigned char **buffer, UInt32 *bufferSize)
val = *(unsigned int *)data;
data += 4;
}
val = *(unsigned int *)data;
data += 4;
}
-
+
*bufferSize = 1;
*buffer = ((unsigned char *)&val) + (offset++ & 3);
*bufferSize = 1;
*buffer = ((unsigned char *)&val) + (offset++ & 3);
-
+
return LZMA_RESULT_OK;
}
return LZMA_RESULT_OK;
}
@@
-114,12
+120,16
@@
static __inline__ unsigned char get_byte(void)
{
unsigned char *buffer;
UInt32 fake;
{
unsigned char *buffer;
UInt32 fake;
-
+
return read_byte(0, &buffer, &fake), *buffer;
}
return read_byte(0, &buffer, &fake), *buffer;
}
+int uart_write_str(char * str);
+
/* should be the first function */
/* should be the first function */
-void entry(unsigned long icache_size, unsigned long icache_lsize,
+void decompress_entry(unsigned long reg_a0, unsigned long reg_a1,
+ unsigned long reg_a2, unsigned long reg_a3,
+ unsigned long icache_size, unsigned long icache_lsize,
unsigned long dcache_size, unsigned long dcache_lsize)
{
unsigned int i; /* temp value */
unsigned long dcache_size, unsigned long dcache_lsize)
{
unsigned int i; /* temp value */
@@
-132,13
+142,13
@@
void entry(unsigned long icache_size, unsigned long icache_lsize,
callback.Read = read_byte;
uart_write_str("decompress kernel ... ");
callback.Read = read_byte;
uart_write_str("decompress kernel ... ");
-
+
/* look for trx header, 32-bit data access */
for (data = ((unsigned char *) KSEG1ADDR(BCM4710_FLASH));
((struct trx_header *)data)->magic != TRX_MAGIC; data += 65536);
/* compressed kernel is in the partition 0 or 1 */
/* look for trx header, 32-bit data access */
for (data = ((unsigned char *) KSEG1ADDR(BCM4710_FLASH));
((struct trx_header *)data)->magic != TRX_MAGIC; data += 65536);
/* compressed kernel is in the partition 0 or 1 */
- if (((struct trx_header *)data)->offsets[1] > 65536)
+ if (((struct trx_header *)data)->offsets[1] > 65536)
data += ((struct trx_header *)data)->offsets[0];
else
data += ((struct trx_header *)data)->offsets[1];
data += ((struct trx_header *)data)->offsets[0];
else
data += ((struct trx_header *)data)->offsets[1];
@@
-161,7
+171,7
@@
void entry(unsigned long icache_size, unsigned long icache_lsize,
((unsigned int)get_byte() << 24);
/* skip rest of the header (upper half of uncompressed size) */
((unsigned int)get_byte() << 24);
/* skip rest of the header (upper half of uncompressed size) */
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
get_byte();
/* decompress kernel */
get_byte();
/* decompress kernel */
@@
-173,18
+183,18
@@
void entry(unsigned long icache_size, unsigned long icache_lsize,
/* Jump to load address */
uart_write_str("ok\r\n");
/* Jump to load address */
uart_write_str("ok\r\n");
- ((
void (*)(void)) LOADADDR)(
);
+ ((
kernel_entry) LOADADDR)(reg_a0, reg_a1, reg_a2, reg_a3
);
}
uart_write_str("failed\r\n");
while (1 );
}
/* *********************************************************************
}
uart_write_str("failed\r\n");
while (1 );
}
/* *********************************************************************
- *
+ *
* ADM5120 UART driver File: dev_adm_uart.c
* ADM5120 UART driver File: dev_adm_uart.c
- *
+ *
* This is a console device driver for an ADM5120 UART
* This is a console device driver for an ADM5120 UART
- *
+ *
*********************************************************************
*
* Copyright 2006
*********************************************************************
*
* Copyright 2006
@@
-218,7
+228,7
@@
int uart_write_hex(int val)
{
int i;
int tmp;
{
int i;
int tmp;
-
+
uart_write_str("0x");
for ( i=0 ; i<8 ; i++ ) {
tmp = (val >> ((7-i) * 4 )) & 0xf;
uart_write_str("0x");
for ( i=0 ; i<8 ; i++ ) {
tmp = (val >> ((7-i) * 4 )) & 0xf;
This page took
0.022271 seconds
and
4
git commands to generate.