summaryrefslogtreecommitdiff
path: root/src/cpu/amd
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@openbios.org>2006-05-02 12:05:13 +0000
committerStefan Reinauer <stepan@openbios.org>2006-05-02 12:05:13 +0000
commitead73689db79fecc3e17215d100ab52ce4377657 (patch)
treef3decd3d843e222394b848805f0f88f74d153700 /src/cpu/amd
parentd3ba4aaa245b1af50f70443ba01ec0baf883995f (diff)
downloadcoreboot-ead73689db79fecc3e17215d100ab52ce4377657.tar.xz
add automatic payload compression method to LinuxBIOS
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2288 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/cpu/amd')
-rw-r--r--src/cpu/amd/car/copy_and_run.c69
1 files changed, 4 insertions, 65 deletions
diff --git a/src/cpu/amd/car/copy_and_run.c b/src/cpu/amd/car/copy_and_run.c
index 68e9e35482..44c3bf24fc 100644
--- a/src/cpu/amd/car/copy_and_run.c
+++ b/src/cpu/amd/car/copy_and_run.c
@@ -1,31 +1,10 @@
/* by yhlu 6.2005
moved from nrv2v.c and some lines from crt0.S
+ 2006/05/02 - stepan: move nrv2b to an extra file.
*/
-#ifndef ENDIAN
-#define ENDIAN 0
-#endif
-#ifndef BITSIZE
-#define BITSIZE 32
-#endif
-
-#define GETBIT_8(bb, src, ilen) \
- (((bb = bb & 0x7f ? bb*2 : ((unsigned)src[ilen++]*2+1)) >> 8) & 1)
-
-#define GETBIT_LE16(bb, src, ilen) \
- (bb*=2,bb&0xffff ? (bb>>16)&1 : (ilen+=2,((bb=(src[ilen-2]+src[ilen-1]*256u)*2+1)>>16)&1))
-#define GETBIT_LE32(bb, src, ilen) \
- (bc > 0 ? ((bb>>--bc)&1) : (bc=31,\
- bb=*(const uint32_t *)((src)+ilen),ilen+=4,(bb>>31)&1))
-
-#if ENDIAN == 0 && BITSIZE == 8
-#define GETBIT(bb, src, ilen) GETBIT_8(bb, src, ilen)
-#endif
-#if ENDIAN == 0 && BITSIZE == 16
-#define GETBIT(bb, src, ilen) GETBIT_LE16(bb, src, ilen)
-#endif
-#if ENDIAN == 0 && BITSIZE == 32
-#define GETBIT(bb, src, ilen) GETBIT_LE32(bb, src, ilen)
+#if CONFIG_COMPRESS
+#include "lib/nrv2b.c"
#endif
static inline void print_debug_cp_run(const char *strval, uint32_t val)
@@ -66,47 +45,7 @@ static void copy_and_run(void)
print_debug_cp_run("src=",(uint32_t)src);
print_debug_cp_run("dst=",(uint32_t)dst);
- for(;;) {
- unsigned int m_off, m_len;
- while(GETBIT(bb, src, ilen)) {
- dst[olen++] = src[ilen++];
- }
-
- m_off = 1;
- do {
- m_off = m_off*2 + GETBIT(bb, src, ilen);
- } while (!GETBIT(bb, src, ilen));
- if (m_off == 2)
- {
- m_off = last_m_off;
- }
- else
- {
- m_off = (m_off - 3)*256 + src[ilen++];
- if(m_off == 0xffffffffU)
- break;
- last_m_off = ++m_off;
- }
- m_len = GETBIT(bb, src, ilen);
- m_len = m_len*2 + GETBIT(bb, src, ilen);
- if (m_len == 0)
- {
- m_len++;
- do {
- m_len = m_len*2 + GETBIT(bb, src, ilen);
- } while(!GETBIT(bb, src, ilen));
- m_len += 2;
- }
- m_len += (m_off > 0xd00);
- {
- const uint8_t *m_pos;
- m_pos = dst + olen - m_off;
- dst[olen++] = *m_pos++;
- do {
- dst[olen++] = *m_pos++;
- } while(--m_len > 0);
- }
- }
+ unrv2b(src, dst);
#endif
print_debug_cp_run("linxbios_ram.bin length = ", olen);