diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-04-29 21:13:14 +0000 |
---|---|---|
committer | <ralf@linux-mips.org> | 1997-04-29 21:13:14 +0000 |
commit | 19c9bba94152148523ba0f7ef7cffe3d45656b11 (patch) | |
tree | 40b1cb534496a7f1ca0f5c314a523c69f1fee464 /arch/ppc/boot | |
parent | 7206675c40394c78a90e74812bbdbf8cf3cca1be (diff) |
Import of Linux/MIPS 2.1.36
Diffstat (limited to 'arch/ppc/boot')
-rw-r--r-- | arch/ppc/boot/Makefile | 63 | ||||
-rw-r--r-- | arch/ppc/boot/compressed/Makefile | 53 | ||||
-rw-r--r-- | arch/ppc/boot/compressed/head.S | 33 | ||||
-rw-r--r-- | arch/ppc/boot/compressed/misc.c | 430 | ||||
-rw-r--r-- | arch/ppc/boot/compressed/ppc_defs.h | 6 | ||||
-rw-r--r-- | arch/ppc/boot/cortstrip.c | 10 | ||||
-rw-r--r-- | arch/ppc/boot/crypt.h (renamed from arch/ppc/boot/compressed/crypt.h) | 0 | ||||
-rw-r--r-- | arch/ppc/boot/gzip.h (renamed from arch/ppc/boot/compressed/gzip.h) | 0 | ||||
-rw-r--r-- | arch/ppc/boot/head.S | 237 | ||||
-rw-r--r-- | arch/ppc/boot/inflate.c (renamed from arch/ppc/boot/compressed/inflate.c) | 0 | ||||
-rw-r--r-- | arch/ppc/boot/iso_font.h | 257 | ||||
-rw-r--r-- | arch/ppc/boot/lzw.h (renamed from arch/ppc/boot/compressed/lzw.h) | 0 | ||||
-rw-r--r-- | arch/ppc/boot/misc.c | 762 | ||||
-rw-r--r-- | arch/ppc/boot/mk_type41.c | 6 | ||||
-rw-r--r-- | arch/ppc/boot/mkprep.c | 139 | ||||
-rw-r--r-- | arch/ppc/boot/piggyback.c (renamed from arch/ppc/boot/compressed/piggyback.c) | 5 | ||||
-rw-r--r-- | arch/ppc/boot/unzip.c (renamed from arch/ppc/boot/compressed/unzip.c) | 4 | ||||
-rw-r--r-- | arch/ppc/boot/vreset.c | 164 |
18 files changed, 1625 insertions, 544 deletions
diff --git a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile index 1b5056bea..7b4ed71f6 100644 --- a/arch/ppc/boot/Makefile +++ b/arch/ppc/boot/Makefile @@ -20,30 +20,61 @@ .S.o: $(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $< -OBJECTS = head.o main.o -all: linux.boot mkboot +ZLINKFLAGS = -T ../ld.script -Ttext 0x00800000 +GZIP_FLAGS = -9 -linux.boot: $(TOPDIR)/vmlinux mkboot - rsh charon /bin/rm -f /usr/tftpboot/vmlinux - /bin/rm -f /usr/tftpboot/vmlinux - ./mkboot $(TOPDIR)/vmlinux /usr/tftpboot/vmlinux - rcp /usr/tftpboot/vmlinux charon:/usr/tftpboot/vmlinux - sync +SYSTEM = $(TOPDIR)/vmlinux -tImage: mk_type41 $(TOPDIR)/vmlinux mkboot - ./mkboot $(TOPDIR)/vmlinux vmlinux - mk_type41 vmlinux tImage - rm vmlinux +OBJECTS = head.o inflate.o unzip.o misc.o vreset.o + +CFLAGS = -O2 -DSTDC_HEADERS -I$(TOPDIR)/include + +all: $(TOPDIR)/zImage mkboot : cortstrip.c - $(HOSTCC) -o mkboot cortstrip.c + $(HOSTCC) $(CFLAGSINC) -Wl,-static -o mkboot cortstrip.c mk_type41: mk_type41.c - gcc -o mk_type41 mk_type41.c + $(HOSTCC) $(CFLAGSINC) -Wl,-static -o mk_type41 mk_type41.c + +floppy: zImage $(TOPDIR)/vmlinux + dd if=$(TOPDIR)/zImage of=/dev/fd0H1440 bs=64b + +netboot : $(TOPDIR)/vmlinux mkboot + mkboot $(TOPDIR)/vmlinux $(TOPDIR)/netboot +# rcp $(TOPDIR)/netboot charon:/usr/tftpboot/vmlinux + +znetboot : mkboot zvmlinux + mkboot zvmlinux $(TOPDIR)/znetboot + rcp $(TOPDIR)/znetboot charon:/usr/tftpboot/vmlinux + +zImage: mk_type41 zvmlinux +# make znetboot ourselves since using the normal dep +# will rcp it -- Cort + mkboot zvmlinux $(TOPDIR)/znetboot + mk_type41 $(TOPDIR)/znetboot $(TOPDIR)/zImage + +install: zImage + dd if=$(TOPDIR)/zImage of=/dev/sda4 + ln -s /dev/sda4 $(INSTALL_PATH)/vmlinuz + cp $(TOPDIR)/System.map $(INSTALL_PATH)/ + +zvmlinux: $(OBJECTS) $(SYSTEM) piggyback netboot $(TOPDIR)/vmlinux + gzip ${GZIP_FLAGS} <$(TOPDIR)/netboot | ./piggyback | $(AS) -o piggy.o + $(LD) $(ZLINKFLAGS) -o zvmlinux $(OBJECTS) piggy.o + rm -f piggy.o xx_boot + +head.o: head.s + +head.s: head.S $(TOPDIR)/include/linux/tasks.h + $(CPP) -traditional head.S -o head.s + +piggyback: piggyback.c + $(HOSTCC) $(CFLAGS) -o piggyback piggyback.c clean: - rsh charon /bin/rm -f /usr/tftpboot/vmlinux - /bin/rm -f /usr/tftpboot/vmlinux + rm -f piggyback zvmlinux mk_type41 mkprep mkboot + rm -f $(TOPDIR)/{zImage,znetboot,netboot} dep: diff --git a/arch/ppc/boot/compressed/Makefile b/arch/ppc/boot/compressed/Makefile deleted file mode 100644 index 4cd4d1caf..000000000 --- a/arch/ppc/boot/compressed/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -# linux/arch/ppc/boot/compressed/Makefile -# -# create a compressed vmlinux image from the original vmlinux -# - -TOPDIR = ../../../.. -CC = cc.ppc -AS = as.ppc -LD = ld.ppc -ZLINKFLAGS = -T ../../ld.script -Ttext 0x00400000 -HOSTCC = cc -#GZIP_FLAGS = -9 -GZIP_FLAGS = - -HEAD = head.o -SYSTEM = $(TOPDIR)/vmlinux - -OBJECTS = $(HEAD) inflate.o unzip.o misc.o - -CFLAGS = -O2 -DSTDC_HEADERS - -.c.s: - $(CC) $(CFLAGS) -S $< -.s.o: - $(AS) -o $*.o $< -.c.o: - $(CC) $(CFLAGS) -c $< - -all: vmlinux - -vmlinux: $(OBJECTS) $(SYSTEM) piggyback - mkboot $(TOPDIR)/vmlinux xx_boot 0 - gzip ${GZIP_FLAGS} <xx_boot | ./piggyback | $(AS) -o piggy.o - $(LD) $(ZLINKFLAGS) -o vmlinux $(OBJECTS) piggy.o - rm -f piggy.o xx_boot - -vmlinux.no_ramdisk: $(OBJECTS) piggyback - mkboot $(TOPDIR)/vmlinux.no_ramdisk xx_boot 0 - gzip ${GZIP_FLAGS} <xx_boot | ./piggyback | $(AS) -o piggy.o - $(LD) $(ZLINKFLAGS) -o vmlinux.no_ramdisk $(OBJECTS) piggy.o - rm -f piggy.o xx_boot - -head.o: head.s - -head.s: head.S $(TOPDIR)/include/linux/tasks.h - $(CPP) -traditional head.S -o head.s - -piggyback: piggyback.c - $(HOSTCC) $(CFLAGS) -o piggyback piggyback.c - -clean: - rm -f piggyback vmlinux diff --git a/arch/ppc/boot/compressed/head.S b/arch/ppc/boot/compressed/head.S deleted file mode 100644 index 6cd9282a3..000000000 --- a/arch/ppc/boot/compressed/head.S +++ /dev/null @@ -1,33 +0,0 @@ -#include "ppc_defs.h" - - .text -/* - * This code may be executed by a bootstrap process. If so, the - * purpose is to relocate the loaded image to it's final location - * in memory. - * R3: End of image - * R4: Start of image - 0x400 - * - */ - .globl start -start: - addi r4,r4,0x400 /* Point at start of image */ - lis r5,start@h /* Load address */ - ori r5,r5,start@l - subi r4,r4,4 /* Adjust for auto-increment */ - subi r5,r5,4 - subi r3,r3,4 -00: lwzu r0,4(r4) /* Fast move */ - stwu r0,4(r5) - cmp 0,r3,r4 - bne 00b - lis r5,continue@h /* Actual code starts here */ - ori r5,r5,continue@l - mtlr r5 - blr - -continue: - bl decompress_kernel - li r5,0x100 /* Kernel code starts here */ - mtlr r5 - blr diff --git a/arch/ppc/boot/compressed/misc.c b/arch/ppc/boot/compressed/misc.c deleted file mode 100644 index 73f06c2b7..000000000 --- a/arch/ppc/boot/compressed/misc.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * misc.c - * - * This is a collection of several routines from gzip-1.0.3 - * adapted for Linux. - * - * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 - * puts by Nick Holloway 1993 - */ - -#include "gzip.h" -#include "lzw.h" - - -#define EOF -1 - -DECLARE(uch, inbuf, INBUFSIZ); -DECLARE(uch, outbuf, OUTBUFSIZ+OUTBUF_EXTRA); -DECLARE(uch, window, WSIZE); - -unsigned outcnt; -unsigned insize; -unsigned inptr; - -extern char input_data[]; -extern int input_len; - -int input_ptr; - -int method, exit_code, part_nb, last_member; -int test = 0; -int force = 0; -int verbose = 1; -long bytes_in, bytes_out; - -char *output_data; -unsigned long output_ptr; - -extern int end; -long free_mem_ptr = (long)&end; - -int to_stdout = 0; -int hard_math = 0; - -void (*work)(int inf, int outf); -void makecrc(void); - -local int get_method(int); - -char *vidmem = (char *)0xC00B8000; -int lines, cols; -int orig_x, orig_y; - -void puts(const char *); - -void *malloc(int size) -{ - void *p; - - if (size <0) error("Malloc error\n"); - if (free_mem_ptr <= 0) error("Memory error\n"); - - while(1) { - free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ - - p = (void *)free_mem_ptr; - free_mem_ptr += size; - - /* - * The part of the compressed kernel which has already been expanded - * is no longer needed. Therefore we can reuse it for malloc. - * With bigger kernels, this is necessary. - */ - - if (free_mem_ptr < (long)&end) { - if (free_mem_ptr > (long)&input_data[input_ptr]) - error("\nOut of memory\n"); - - return p; - } -#if 0 - if (free_mem_ptr < 0x90000) -#endif - return p; - puts("large kernel, low 1M tight..."); - free_mem_ptr = (long)input_data; - } -} - -void free(void *where) -{ /* Don't care */ -} - -static void scroll() -{ - int i; - - memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 ); - for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 ) - vidmem[i] = ' '; -} - -void puts(const char *s) -{ - int x,y; - char c; - -#if 0 - x = SCREEN_INFO.orig_x; - y = SCREEN_INFO.orig_y; -#else - x = orig_x; - y = orig_y; -#endif - - while ( ( c = *s++ ) != '\0' ) { - if ( c == '\n' ) { - x = 0; - if ( ++y >= lines ) { - scroll(); - y--; - } - } else { - vidmem [ ( x + cols * y ) * 2 ] = c; - if ( ++x >= cols ) { - x = 0; - if ( ++y >= lines ) { - scroll(); - y--; - } - } - } - } - -#if 0 - SCREEN_INFO.orig_x = x; - SCREEN_INFO.orig_y = y; -#else - orig_x = x; - orig_y = y; -#endif -} - -__ptr_t memset(__ptr_t s, int c, size_t n) -{ - int i; - char *ss = (char*)s; - - for (i=0;i<n;i++) ss[i] = c; -} - -__ptr_t memcpy(__ptr_t __dest, __const __ptr_t __src, - size_t __n) -{ - int i; - char *d = (char *)__dest, *s = (char *)__src; - - for (i=0;i<__n;i++) d[i] = s[i]; -} - -int memcmp(__ptr_t __dest, __const __ptr_t __src, - size_t __n) -{ - int i; - char *d = (char *)__dest, *s = (char *)__src; - - for (i=0;i<__n;i++, d++, s++) - { - if (*d != *s) - { - return (*s - *d); - } - } - return (0); -} - -extern ulg crc_32_tab[]; /* crc table, defined below */ - -/* =========================================================================== - * Run a set of bytes through the crc shift register. If s is a NULL - * pointer, then initialize the crc shift register contents instead. - * Return the current crc in either case. - */ -ulg updcrc(s, n) - uch *s; /* pointer to bytes to pump through */ - unsigned n; /* number of bytes in s[] */ -{ - register ulg c; /* temporary variable */ - - static ulg crc = (ulg)0xffffffffL; /* shift register contents */ - - if (s == NULL) { - c = 0xffffffffL; - } else { - c = crc; - while (n--) { - c = crc_32_tab[((int)c ^ (*s++)) & 0xff] ^ (c >> 8); - } - } - crc = c; - return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */ -} - -/* =========================================================================== - * Clear input and output buffers - */ -void clear_bufs() -{ - outcnt = 0; - insize = inptr = 0; - bytes_in = bytes_out = 0L; -} - -/* =========================================================================== - * Fill the input buffer. This is called only when the buffer is empty - * and at least one byte is really needed. - */ -int fill_inbuf() -{ - int len, i; - - /* Read as much as possible */ -puts("*"); - insize = 0; - do { - len = INBUFSIZ-insize; - if (len > (input_len-input_ptr+1)) len=input_len-input_ptr+1; - if (len == 0 || len == EOF) break; - - for (i=0;i<len;i++) inbuf[insize+i] = input_data[input_ptr+i]; - insize += len; - input_ptr += len; - } while (insize < INBUFSIZ); - - if (insize == 0) { - error("unable to fill buffer\n"); - } - bytes_in += (ulg)insize; - inptr = 1; - return inbuf[0]; -} - -/* =========================================================================== - * Write the output window window[0..outcnt-1] and update crc and bytes_out. - * (Used for the decompressed data only.) - */ -void flush_window() -{ - if (outcnt == 0) return; - updcrc(window, outcnt); - - memcpy(&output_data[output_ptr], (char *)window, outcnt); - - bytes_out += (ulg)outcnt; - output_ptr += (ulg)outcnt; - outcnt = 0; -} - -/* - * Code to compute the CRC-32 table. Borrowed from - * gzip-1.0.3/makecrc.c. - */ - -ulg crc_32_tab[256]; - -void -makecrc(void) -{ -/* Not copyrighted 1990 Mark Adler */ - - unsigned long c; /* crc shift register */ - unsigned long e; /* polynomial exclusive-or pattern */ - int i; /* counter for all possible eight bit values */ - int k; /* byte being shifted into crc apparatus */ - - /* terms of polynomial defining this crc (except x^32): */ - static int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* Make exclusive-or pattern from polynomial */ - e = 0; - for (i = 0; i < sizeof(p)/sizeof(int); i++) - e |= 1L << (31 - p[i]); - - crc_32_tab[0] = 0; - - for (i = 1; i < 256; i++) - { - c = 0; - for (k = i | 256; k != 1; k >>= 1) - { - c = c & 1 ? (c >> 1) ^ e : c >> 1; - if (k & 1) - c ^= e; - } - crc_32_tab[i] = c; - } -} - -void error(char *x) -{ - puts("\n\n"); - puts(x); - puts("\n\n -- System halted"); - - while(1); /* Halt */ -} - -#if 0 -#define STACK_SIZE (4096) - -long user_stack [STACK_SIZE]; - -struct { - long * a; - short b; - } stack_start = { & user_stack [STACK_SIZE] , KERNEL_DS }; -#endif - -void decompress_kernel() -{ -#if 0 - if (SCREEN_INFO.orig_video_mode == 7) - vidmem = (char *) 0xb0000; - else - vidmem = (char *) 0xb8000; - - lines = SCREEN_INFO.orig_video_lines; - cols = SCREEN_INFO.orig_video_cols; - - if (EXT_MEM_K < 1024) error("<2M of mem\n"); - output_data = (char *)0x100000; /* Points to 1M */ -#else - output_data = (char *)0x0; /* Points to 0 */ - lines = 25; - cols = 80; - orig_x = 0; - orig_y = 24; -#endif - - output_ptr = 0; - - exit_code = 0; - test = 0; - input_ptr = 0; - part_nb = 0; - - clear_bufs(); - makecrc(); - - puts("Uncompressing Linux..."); - - method = get_method(0); - - work(0, 0); - - puts("done.\n"); - - puts("Now booting the kernel\n"); -} - -/* ======================================================================== - * Check the magic number of the input file and update ofname if an - * original name was given and to_stdout is not set. - * Return the compression method, -1 for error, -2 for warning. - * Set inptr to the offset of the next byte to be processed. - * This function may be called repeatedly for an input file consisting - * of several contiguous gzip'ed members. - * IN assertions: there is at least one remaining compressed member. - * If the member is a zip file, it must be the only one. - */ -local int get_method(in) - int in; /* input file descriptor */ -{ - uch flags; - char magic[2]; /* magic header */ - - magic[0] = (char)get_byte(); - magic[1] = (char)get_byte(); - - method = -1; /* unknown yet */ - part_nb++; /* number of parts in gzip file */ - last_member = 0; - /* assume multiple members in gzip file except for record oriented I/O */ - - if (memcmp(magic, GZIP_MAGIC, 2) == 0 - || memcmp(magic, OLD_GZIP_MAGIC, 2) == 0) { - - work = unzip; - method = (int)get_byte(); - flags = (uch)get_byte(); - if ((flags & ENCRYPTED) != 0) - error("Input is encrypted\n"); - if ((flags & CONTINUATION) != 0) - error("Multi part input\n"); - if ((flags & RESERVED) != 0) { - error("Input has invalid flags\n"); - exit_code = ERROR; - if (force <= 1) return -1; - } - (ulg)get_byte(); /* Get timestamp */ - ((ulg)get_byte()) << 8; - ((ulg)get_byte()) << 16; - ((ulg)get_byte()) << 24; - - (void)get_byte(); /* Ignore extra flags for the moment */ - (void)get_byte(); /* Ignore OS type for the moment */ - - if ((flags & EXTRA_FIELD) != 0) { - unsigned len = (unsigned)get_byte(); - len |= ((unsigned)get_byte())<<8; - while (len--) (void)get_byte(); - } - - /* Get original file name if it was truncated */ - if ((flags & ORIG_NAME) != 0) { - if (to_stdout || part_nb > 1) { - /* Discard the old name */ - while (get_byte() != 0) /* null */ ; - } else { - } /* to_stdout */ - } /* orig_name */ - - /* Discard file comment if any */ - if ((flags & COMMENT) != 0) { - while (get_byte() != 0) /* null */ ; - } - } else - error("unknown compression method"); - return method; -} diff --git a/arch/ppc/boot/compressed/ppc_defs.h b/arch/ppc/boot/compressed/ppc_defs.h deleted file mode 100644 index 2237e9f24..000000000 --- a/arch/ppc/boot/compressed/ppc_defs.h +++ /dev/null @@ -1,6 +0,0 @@ -#define r0 0 -#define r1 1 -#define r2 2 -#define r3 3 -#define r4 4 -#define r5 5 diff --git a/arch/ppc/boot/cortstrip.c b/arch/ppc/boot/cortstrip.c index c671ca349..78856d2bb 100644 --- a/arch/ppc/boot/cortstrip.c +++ b/arch/ppc/boot/cortstrip.c @@ -7,7 +7,7 @@ #define PLACE 65536 /* size of read buffer */ -#define SIZE 0x200000 +#define SIZE 0x100000 /* crude program to strip the elf header to make a bootable image via tftp @@ -20,11 +20,13 @@ int main(int argc, char **argv ) unsigned char data[SIZE]; int i, n, skip; +#if 0 if ( argc != 3 ) { fprintf(stderr,"%s infile outfile\n", argv[0]); exit(-1); } +#endif fd = open(argv[1], O_RDONLY); @@ -49,7 +51,7 @@ int main(int argc, char **argv ) skip = PLACE; #endif i = lseek(fd, skip, SEEK_SET); - printf("lseek'd %d bytes\n", i); + /*printf("lseek'd %d bytes\n", i);*/ if ( i == -1 ) { perror("lseek()"); @@ -57,9 +59,9 @@ int main(int argc, char **argv ) while ( (n = read(fd, data, SIZE)) > 0 ) { - printf("Read %d bytes\n", n); + /*printf("Read %d bytes\n", n);*/ i = write(fdo, data, n); - printf("Wrote %d bytes\n", i); + /*printf("Wrote %d bytes\n", i); */ } diff --git a/arch/ppc/boot/compressed/crypt.h b/arch/ppc/boot/crypt.h index 2a4c203ca..2a4c203ca 100644 --- a/arch/ppc/boot/compressed/crypt.h +++ b/arch/ppc/boot/crypt.h diff --git a/arch/ppc/boot/compressed/gzip.h b/arch/ppc/boot/gzip.h index 2f738b945..2f738b945 100644 --- a/arch/ppc/boot/compressed/gzip.h +++ b/arch/ppc/boot/gzip.h diff --git a/arch/ppc/boot/head.S b/arch/ppc/boot/head.S new file mode 100644 index 000000000..35dacd514 --- /dev/null +++ b/arch/ppc/boot/head.S @@ -0,0 +1,237 @@ +#include "../kernel/ppc_defs.h" +#include "../kernel/ppc_asm.tmpl" + + .text + +/* + * This code is loaded by the ROM loader at some arbitrary location. + * Move it to high memory so that it can load the kernel at 0x0000. + */ + + .globl start +start: + bl start_ +start_: +/* TEMP - No residual data on BeBox (yet) */ +#if 0 +#define IS_BE_BOX 0x42654278 /* 'BeBx' */ + lis r2,IS_BE_BOX>>16 + ori r2,r2,IS_BE_BOX&0xFFFF + cmp 0,r30,r2 + bne notBeBox + li r3,0 +#endif +notBeBox: +/* TEMP */ + mr r11,r3 /* Save pointer to residual data */ + mfmsr r3 /* Turn off interrupts */ + li r4,0 + ori r4,r4,MSR_EE + andc r3,r3,r4 + mtmsr r3 +/* Copy relocation code down to location 0x0100 (where we hope it's safe!) */ + mflr r3 + addi r5,r3,start_ldr-start_ + addi r3,r3,relocate-start_ + li r4,0x0100 + mtctr r4 + subi r3,r3,4 + subi r4,r4,4 +00: lwzu r6,4(r3) + stwu r6,4(r4) + cmp 0,r3,r5 + bne 00b + mflr r21 + mfctr r22 + bl flush_instruction_cache + mtlr r21 + mtctr r22 + bctr /* Jump to code */ +/* Relocate code to final resting spot */ +relocate: + mflr r3 /* Compute code bias */ + subi r3,r3,4 + mr r8,r3 + lis r4,start@h + ori r4,r4,start@l + lis r5,edata@h + ori r5,r5,edata@l + addi r5,r5,3 /* Round up - just in case */ + sub r5,r5,r4 /* Compute # longwords to move */ + srwi r5,r5,2 + mtctr r5 + mr r7,r5 + li r6,0 + subi r3,r3,4 /* Set up for loop */ + subi r4,r4,4 +00: lwzu r5,4(r3) + stwu r5,4(r4) + xor r6,r6,r5 + bdnz 00b + lis r3,start_ldr@h + ori r3,r3,start_ldr@l + mtlr r3 /* Easiest way to do an absolute jump */ + blr +start_ldr: +/* Clear all of BSS */ + lis r3,edata@h + ori r3,r3,edata@l + lis r4,end@h + ori r4,r4,end@l + subi r3,r3,4 + subi r4,r4,4 + li r0,0 +50: stwu r0,4(r3) + cmp 0,r3,r4 + bne 50b +90: mr r9,r1 /* Save old stack pointer (in case it matters) */ + lis r1,.stack@h + ori r1,r1,.stack@l + addi r1,r1,4096*2 + subi r1,r1,256 + li r2,0x000F /* Mask pointer to 16-byte boundary */ + andc r1,r1,r2 +/* Run loader */ + mr r3,r8 /* Load point */ + mr r4,r7 /* Program length */ + mr r5,r6 /* Checksum */ + mr r6,r11 /* Residual data */ + bl decompress_kernel + /*mr r29,r3*/ /* R3 = TotalMemory */ + /*lis r28,hold_residual@h + ori r28,r28,hold_residual@l*/ + /* changed to use r3 (as firmware does) for kernel + as ptr to residual -- Cort*/ + li r5,0x100 /* Kernel code starts here */ + mtlr r5 + blr +hang: + b hang + + .globl _get_SP +_get_SP: + mr r3,r1 + blr + + .globl _get_PVR +_get_PVR: + mfspr r3,PVR + blr + + .globl _get_MSR +_get_MSR: + mfmsr r3 + blr + + .globl _put_MSR +_put_MSR: + sync + mtmsr r3 + blr + + .globl _get_HID0 +_get_HID0: + mfspr r3,HID0 + blr + + .globl _put_HID0 +_put_HID0: + sync + mtspr HID0,r3 + blr + +/* + * This space [buffer] is used to forceably flush the data cache when + * running in copyback mode. This is necessary IFF the data cache could + * contain instructions for which the instruction cache has stale data. + * Since the instruction cache NEVER snoops the data cache, memory must + * be made coherent with the data cache to insure that the instruction + * cache gets a valid instruction stream. Note that this flushing is + * only performed when switching from system to user mode since this is + * the only juncture [as far as the OS goes] where the data cache may + * contain instructions, e.g. after a disk read. + */ +#define NUM_CACHE_LINES 128*8 +#define CACHE_LINE_SIZE 32 +#if 0 +cache_flush_buffer: + .space NUM_CACHE_LINES*CACHE_LINE_SIZE /* CAUTION! these need to match hardware */ +#else +#define cache_flush_buffer 0x1000 +#endif + + +/* + * Flush instruction cache + * *** I'm really paranoid here! + */ +_GLOBAL(flush_instruction_cache) + mflr r5 + bl flush_data_cache + mfspr r3,HID0 /* Caches are controlled by this register */ + li r4,0 + ori r4,r4,(HID0_ICE|HID0_ICFI) + or r3,r3,r4 /* Need to enable+invalidate to clear */ + mtspr HID0,r3 + andc r3,r3,r4 + ori r3,r3,HID0_ICE /* Enable cache */ + mtspr HID0,r3 + mtlr r5 + blr + +/* + * Flush data cache + * *** I'm really paranoid here! + */ +_GLOBAL(flush_data_cache) + lis r3,cache_flush_buffer@h + ori r3,r3,cache_flush_buffer@l + li r4,NUM_CACHE_LINES + mtctr r4 +#if 0 +00: dcbz 0,r3 /* Flush cache line with minimal BUS traffic */ +#else +00: lwz r4,0(r3) +#endif + addi r3,r3,CACHE_LINE_SIZE /* Next line, please */ + bdnz 00b +10: blr + +/* + * Flush a particular page from the DATA cache + * Note: this is necessary because the instruction cache does *not* + * snoop from the data cache. + * void flush_page(void *page) + */ +_GLOBAL(flush_page) + li r4,0x0FFF + andc r3,r3,r4 /* Get page base address */ + li r4,4096/CACHE_LINE_SIZE /* Number of lines in a page */ + mtctr r4 +00: dcbf 0,r3 /* Clear line */ + icbi 0,r3 + addi r3,r3,CACHE_LINE_SIZE + bdnz 00b + blr + +/* + * Execute a [foreign] function + * + * run(p1, p2, cp, ep, entry) + * + */ + .globl run +run: + mtctr r7 /* Entry point */ +#define IS_PreP 0x50726550 /* 'PreP' */ + lis r30,IS_PreP>>16 + ori r30,r30,IS_PreP&0xFFFF + mr 11,r5 + mr 12,r6 + mr r28,r5 + mr r29,r6 + mr 11,r5 + mr 12,r6 + bctr + + .comm .stack,4096*2,4 diff --git a/arch/ppc/boot/compressed/inflate.c b/arch/ppc/boot/inflate.c index 848fef6ae..848fef6ae 100644 --- a/arch/ppc/boot/compressed/inflate.c +++ b/arch/ppc/boot/inflate.c diff --git a/arch/ppc/boot/iso_font.h b/arch/ppc/boot/iso_font.h new file mode 100644 index 000000000..bff050e00 --- /dev/null +++ b/arch/ppc/boot/iso_font.h @@ -0,0 +1,257 @@ +static const unsigned char font[] = { +/* 0x00 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x01 */ 0x00,0x00,0x7E,0x81,0xA5,0x81,0x81,0xBD,0x99,0x81,0x81,0x7E,0x00,0x00,0x00,0x00, +/* 0x02 */ 0x00,0x00,0x7E,0xFF,0xDB,0xFF,0xFF,0xC3,0xC3,0xE7,0xFF,0x7E,0x00,0x00,0x00,0x00, +/* 0x03 */ 0x00,0x00,0x00,0x00,0x6C,0xFE,0xFE,0xFE,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00, +/* 0x04 */ 0x00,0x00,0x00,0x00,0x10,0x38,0x7C,0xFE,0x7C,0x38,0x10,0x00,0x00,0x00,0x00,0x00, +/* 0x05 */ 0x00,0x00,0x00,0x18,0x3C,0x3C,0xE7,0xE7,0xE7,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0x06 */ 0x00,0x00,0x00,0x18,0x3C,0x7E,0xFF,0xFF,0x7E,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0x07 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x08 */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE7,0xC3,0xC3,0xE7,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +/* 0x09 */ 0x00,0x00,0x00,0x00,0x00,0x3C,0x66,0x42,0x42,0x66,0x3C,0x00,0x00,0x00,0x00,0x00, +/* 0x0A */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xC3,0x99,0xBD,0xBD,0x99,0xC3,0xFF,0xFF,0xFF,0xFF,0xFF, +/* 0x0B */ 0x00,0x00,0x3E,0x0E,0x1A,0x32,0x78,0xCC,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00, +/* 0x0C */ 0x00,0x00,0x3C,0x66,0x66,0x66,0x66,0x3C,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00, +/* 0x0D */ 0x00,0x00,0x30,0x38,0x3C,0x36,0x33,0x30,0x30,0x70,0xF0,0xE0,0x00,0x00,0x00,0x00, +/* 0x0E */ 0x00,0x00,0x7F,0x63,0x7F,0x63,0x63,0x63,0x63,0x67,0xE7,0xE6,0xC0,0x00,0x00,0x00, +/* 0x0F */ 0x00,0x00,0x00,0x18,0x18,0xDB,0x3C,0xE7,0x3C,0xDB,0x18,0x18,0x00,0x00,0x00,0x00, +/* 0x10 */ 0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFE,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00, +/* 0x11 */ 0x00,0x02,0x06,0x0E,0x1E,0x3E,0xFE,0x3E,0x1E,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, +/* 0x12 */ 0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00,0x00, +/* 0x13 */ 0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00, +/* 0x14 */ 0x00,0x00,0x7F,0xDB,0xDB,0xDB,0x7B,0x1B,0x1B,0x1B,0x1B,0x1B,0x00,0x00,0x00,0x00, +/* 0x15 */ 0x00,0x7C,0xC6,0x60,0x38,0x6C,0xC6,0xC6,0x6C,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00, +/* 0x16 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0xFE,0xFE,0x00,0x00,0x00,0x00, +/* 0x17 */ 0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x7E,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00, +/* 0x18 */ 0x00,0x00,0x18,0x3C,0x7E,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, +/* 0x19 */ 0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x3C,0x18,0x00,0x00,0x00,0x00, +/* 0x1A */ 0x00,0x00,0x00,0x00,0x00,0x18,0x0C,0xFE,0x0C,0x18,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x1B */ 0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xFE,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x1C */ 0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xC0,0xC0,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x1D */ 0x00,0x00,0x00,0x00,0x00,0x28,0x6C,0xFE,0x6C,0x28,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x1E */ 0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7C,0x7C,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00, +/* 0x1F */ 0x00,0x00,0x00,0x00,0xFE,0xFE,0x7C,0x7C,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00, +/* 0x20 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x21 */ 0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, +/* 0x22 */ 0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x23 */ 0x00,0x00,0x00,0x6C,0x6C,0xFE,0x6C,0x6C,0x6C,0xFE,0x6C,0x6C,0x00,0x00,0x00,0x00, +/* 0x24 */ 0x18,0x18,0x7C,0xC6,0xC2,0xC0,0x7C,0x06,0x06,0x86,0xC6,0x7C,0x18,0x18,0x00,0x00, +/* 0x25 */ 0x00,0x00,0x00,0x00,0xC2,0xC6,0x0C,0x18,0x30,0x60,0xC6,0x86,0x00,0x00,0x00,0x00, +/* 0x26 */ 0x00,0x00,0x38,0x6C,0x6C,0x38,0x76,0xDC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x27 */ 0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x28 */ 0x00,0x00,0x0C,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0C,0x00,0x00,0x00,0x00, +/* 0x29 */ 0x00,0x00,0x30,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x30,0x00,0x00,0x00,0x00, +/* 0x2A */ 0x00,0x00,0x00,0x00,0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x2B */ 0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x2C */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00, +/* 0x2D */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x2E */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, +/* 0x2F */ 0x00,0x00,0x00,0x00,0x02,0x06,0x0C,0x18,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x00, +/* 0x30 */ 0x00,0x00,0x38,0x6C,0xC6,0xC6,0xD6,0xD6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00, +/* 0x31 */ 0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7E,0x00,0x00,0x00,0x00, +/* 0x32 */ 0x00,0x00,0x7C,0xC6,0x06,0x0C,0x18,0x30,0x60,0xC0,0xC6,0xFE,0x00,0x00,0x00,0x00, +/* 0x33 */ 0x00,0x00,0x7C,0xC6,0x06,0x06,0x3C,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x34 */ 0x00,0x00,0x0C,0x1C,0x3C,0x6C,0xCC,0xFE,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00, +/* 0x35 */ 0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xFC,0x06,0x06,0x06,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x36 */ 0x00,0x00,0x38,0x60,0xC0,0xC0,0xFC,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x37 */ 0x00,0x00,0xFE,0xC6,0x06,0x06,0x0C,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00, +/* 0x38 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x39 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x06,0x0C,0x78,0x00,0x00,0x00,0x00, +/* 0x3A */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, +/* 0x3B */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00, +/* 0x3C */ 0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00, +/* 0x3D */ 0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x3E */ 0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00, +/* 0x3F */ 0x00,0x00,0x7C,0xC6,0xC6,0x0C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00, +/* 0x40 */ 0x00,0x00,0x00,0x7C,0xC6,0xC6,0xDE,0xDE,0xDE,0xDC,0xC0,0x7C,0x00,0x00,0x00,0x00, +/* 0x41 */ 0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, +/* 0x42 */ 0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x66,0x66,0x66,0x66,0xFC,0x00,0x00,0x00,0x00, +/* 0x43 */ 0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x00,0x00,0x00,0x00, +/* 0x44 */ 0x00,0x00,0xF8,0x6C,0x66,0x66,0x66,0x66,0x66,0x66,0x6C,0xF8,0x00,0x00,0x00,0x00, +/* 0x45 */ 0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00, +/* 0x46 */ 0x00,0x00,0xFE,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, +/* 0x47 */ 0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xDE,0xC6,0xC6,0x66,0x3A,0x00,0x00,0x00,0x00, +/* 0x48 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, +/* 0x49 */ 0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0x4A */ 0x00,0x00,0x1E,0x0C,0x0C,0x0C,0x0C,0x0C,0xCC,0xCC,0xCC,0x78,0x00,0x00,0x00,0x00, +/* 0x4B */ 0x00,0x00,0xE6,0x66,0x66,0x6C,0x78,0x78,0x6C,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, +/* 0x4C */ 0x00,0x00,0xF0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xFE,0x00,0x00,0x00,0x00, +/* 0x4D */ 0x00,0x00,0xC6,0xEE,0xFE,0xFE,0xD6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, +/* 0x4E */ 0x00,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, +/* 0x4F */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x50 */ 0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, +/* 0x51 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xD6,0xDE,0x7C,0x0C,0x0E,0x00,0x00, +/* 0x52 */ 0x00,0x00,0xFC,0x66,0x66,0x66,0x7C,0x6C,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, +/* 0x53 */ 0x00,0x00,0x7C,0xC6,0xC6,0x60,0x38,0x0C,0x06,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x54 */ 0x00,0x00,0x7E,0x7E,0x5A,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0x55 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x56 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x6C,0x38,0x10,0x00,0x00,0x00,0x00, +/* 0x57 */ 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xD6,0xD6,0xD6,0xFE,0xEE,0x6C,0x00,0x00,0x00,0x00, +/* 0x58 */ 0x00,0x00,0xC6,0xC6,0x6C,0x7C,0x38,0x38,0x7C,0x6C,0xC6,0xC6,0x00,0x00,0x00,0x00, +/* 0x59 */ 0x00,0x00,0x66,0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0x5A */ 0x00,0x00,0xFE,0xC6,0x86,0x0C,0x18,0x30,0x60,0xC2,0xC6,0xFE,0x00,0x00,0x00,0x00, +/* 0x5B */ 0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00, +/* 0x5C */ 0x00,0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x06,0x02,0x00,0x00,0x00,0x00, +/* 0x5D */ 0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00, +/* 0x5E */ 0x10,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x5F */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00, +/* 0x60 */ 0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x61 */ 0x00,0x00,0x00,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x62 */ 0x00,0x00,0xE0,0x60,0x60,0x78,0x6C,0x66,0x66,0x66,0x66,0x7C,0x00,0x00,0x00,0x00, +/* 0x63 */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC0,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x64 */ 0x00,0x00,0x1C,0x0C,0x0C,0x3C,0x6C,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x65 */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xFE,0xC0,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x66 */ 0x00,0x00,0x38,0x6C,0x64,0x60,0xF0,0x60,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, +/* 0x67 */ 0x00,0x00,0x00,0x00,0x00,0x3E,0x66,0x66,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00, +/* 0x68 */ 0x00,0x00,0xE0,0x60,0x60,0x6C,0x76,0x66,0x66,0x66,0x66,0xE6,0x00,0x00,0x00,0x00, +/* 0x69 */ 0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0x6A */ 0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00, +/* 0x6B */ 0x00,0x00,0xE0,0x60,0x60,0x66,0x6C,0x78,0x78,0x6C,0x66,0xE6,0x00,0x00,0x00,0x00, +/* 0x6C */ 0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0x6D */ 0x00,0x00,0x00,0x00,0x00,0x6C,0xFE,0xD6,0xD6,0xD6,0xC6,0xC6,0x00,0x00,0x00,0x00, +/* 0x6E */ 0x00,0x00,0x00,0x00,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, +/* 0x6F */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x70 */ 0x00,0x00,0x00,0x00,0x00,0xFC,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0x60,0xF0,0x00, +/* 0x71 */ 0x00,0x00,0x00,0x00,0x00,0x7E,0xCC,0xCC,0xCC,0xCC,0xCC,0x7C,0x0C,0x0C,0x1E,0x00, +/* 0x72 */ 0x00,0x00,0x00,0x00,0x00,0xDC,0x76,0x66,0x60,0x60,0x60,0xF0,0x00,0x00,0x00,0x00, +/* 0x73 */ 0x00,0x00,0x00,0x00,0x00,0x7C,0xC6,0x60,0x38,0x0C,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x74 */ 0x00,0x00,0x10,0x30,0x30,0xFC,0x30,0x30,0x30,0x30,0x36,0x1C,0x00,0x00,0x00,0x00, +/* 0x75 */ 0x00,0x00,0x00,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x76 */ 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00,0x00,0x00,0x00, +/* 0x77 */ 0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xD6,0xD6,0xD6,0xFE,0x6C,0x00,0x00,0x00,0x00, +/* 0x78 */ 0x00,0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x38,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00, +/* 0x79 */ 0x00,0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0xF8,0x00, +/* 0x7A */ 0x00,0x00,0x00,0x00,0x00,0xFE,0xCC,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, +/* 0x7B */ 0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00, +/* 0x7C */ 0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, +/* 0x7D */ 0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00, +/* 0x7E */ 0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0x7F */ 0x00,0x00,0x00,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xC6,0xFE,0x00,0x00,0x00,0x00,0x00, +/* 0x80 */ 0x00,0x00,0x3C,0x66,0xC2,0xC0,0xC0,0xC0,0xC2,0x66,0x3C,0x0C,0x06,0x7C,0x00,0x00, +/* 0x81 */ 0x00,0x00,0xCC,0x00,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x82 */ 0x00,0x0C,0x18,0x30,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x83 */ 0x00,0x10,0x38,0x6C,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x84 */ 0x00,0x00,0xCC,0x00,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x85 */ 0x00,0x60,0x30,0x18,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x86 */ 0x00,0x38,0x6C,0x38,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x87 */ 0x00,0x00,0x00,0x00,0x3C,0x66,0x60,0x60,0x66,0x3C,0x0C,0x06,0x3C,0x00,0x00,0x00, +/* 0x88 */ 0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x89 */ 0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x8A */ 0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xFE,0xC0,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x8B */ 0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0x8C */ 0x00,0x18,0x3C,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0x8D */ 0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0x8E */ 0x00,0xC6,0x00,0x10,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, +/* 0x8F */ 0x38,0x6C,0x38,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, +/* 0x90 */ 0x18,0x30,0x60,0x00,0xFE,0x66,0x60,0x7C,0x60,0x60,0x66,0xFE,0x00,0x00,0x00,0x00, +/* 0x91 */ 0x00,0x00,0x00,0x00,0x00,0xCC,0x76,0x36,0x7E,0xD8,0xD8,0x6E,0x00,0x00,0x00,0x00, +/* 0x92 */ 0x00,0x00,0x3E,0x6C,0xCC,0xCC,0xFE,0xCC,0xCC,0xCC,0xCC,0xCE,0x00,0x00,0x00,0x00, +/* 0x93 */ 0x00,0x10,0x38,0x6C,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x94 */ 0x00,0x00,0xC6,0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x95 */ 0x00,0x60,0x30,0x18,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x96 */ 0x00,0x30,0x78,0xCC,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x97 */ 0x00,0x60,0x30,0x18,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0x98 */ 0x00,0x00,0xC6,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x0C,0x78,0x00, +/* 0x99 */ 0x00,0xC6,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x9A */ 0x00,0xC6,0x00,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0x9B */ 0x00,0x18,0x18,0x3C,0x66,0x60,0x60,0x60,0x66,0x3C,0x18,0x18,0x00,0x00,0x00,0x00, +/* 0x9C */ 0x00,0x38,0x6C,0x64,0x60,0xF8,0x60,0x60,0x60,0x60,0xE6,0xFC,0x00,0x00,0x00,0x00, +/* 0x9D */ 0x00,0x00,0x66,0x66,0x3C,0x18,0x7E,0x18,0x7E,0x18,0x18,0x18,0x00,0x00,0x00,0x00, +/* 0x9E */ 0x00,0xF8,0xCC,0xCC,0xF8,0xC4,0xCC,0xDE,0xCC,0xCC,0xCC,0xC6,0x00,0x00,0x00,0x00, +/* 0x9F */ 0x00,0x0E,0x1B,0x18,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0x18,0xD8,0x70,0x00,0x00, +/* 0xA0 */ 0x00,0x18,0x30,0x60,0x00,0x78,0x0C,0x7C,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0xA1 */ 0x00,0x0C,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00, +/* 0xA2 */ 0x00,0x18,0x30,0x60,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0xA3 */ 0x00,0x18,0x30,0x60,0x00,0xCC,0xCC,0xCC,0xCC,0xCC,0xCC,0x76,0x00,0x00,0x00,0x00, +/* 0xA4 */ 0x00,0x00,0x76,0xDC,0x00,0xDC,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00, +/* 0xA5 */ 0x76,0xDC,0x00,0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, +/* 0xA6 */ 0x00,0x3C,0x6C,0x6C,0x3E,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xA7 */ 0x00,0x38,0x6C,0x6C,0x38,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xA8 */ 0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xC0,0xC6,0xC6,0x7C,0x00,0x00,0x00,0x00, +/* 0xA9 */ 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00, +/* 0xAA */ 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00, +/* 0xAB */ 0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x60,0xDC,0x86,0x0C,0x18,0x3E,0x00,0x00, +/* 0xAC */ 0x00,0xC0,0xC0,0xC2,0xC6,0xCC,0x18,0x30,0x66,0xCE,0x9E,0x3E,0x06,0x06,0x00,0x00, +/* 0xAD */ 0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3C,0x3C,0x3C,0x18,0x00,0x00,0x00,0x00, +/* 0xAE */ 0x00,0x00,0x00,0x00,0x00,0x36,0x6C,0xD8,0x6C,0x36,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xAF */ 0x00,0x00,0x00,0x00,0x00,0xD8,0x6C,0x36,0x6C,0xD8,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xB0 */ 0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44, +/* 0xB1 */ 0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA,0x55,0xAA, +/* 0xB2 */ 0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77,0xDD,0x77, +/* 0xB3 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xB4 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xB5 */ 0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xB6 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xB7 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xB8 */ 0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xB9 */ 0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xBA */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xBB */ 0x00,0x00,0x00,0x00,0x00,0xFE,0x06,0xF6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xBC */ 0x36,0x36,0x36,0x36,0x36,0xF6,0x06,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xBD */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xBE */ 0x18,0x18,0x18,0x18,0x18,0xF8,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xBF */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xC0 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xC1 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xC2 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xC3 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xC4 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xC5 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xC6 */ 0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xC7 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xC8 */ 0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xC9 */ 0x00,0x00,0x00,0x00,0x00,0x3F,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xCA */ 0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xCB */ 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xCC */ 0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xCD */ 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xCE */ 0x36,0x36,0x36,0x36,0x36,0xF7,0x00,0xF7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xCF */ 0x18,0x18,0x18,0x18,0x18,0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xD0 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xD1 */ 0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xD2 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xD3 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xD4 */ 0x18,0x18,0x18,0x18,0x18,0x1F,0x18,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xD5 */ 0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xD6 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xD7 */ 0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xFF,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36, +/* 0xD8 */ 0x18,0x18,0x18,0x18,0x18,0xFF,0x18,0xFF,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xD9 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xDA */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xDB */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +/* 0xDC */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +/* 0xDD */ 0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0, +/* 0xDE */ 0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F, +/* 0xDF */ 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xE0 */ 0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0xD8,0xD8,0xD8,0xDC,0x76,0x00,0x00,0x00,0x00, +/* 0xE1 */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xFC,0xC6,0xC6,0xC6,0xC6,0xDC,0xC0,0xC0,0x00,0x00, +/* 0xE2 */ 0x00,0x00,0xFE,0xC6,0xC6,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00,0x00,0x00, +/* 0xE3 */ 0x00,0x00,0x00,0x00,0x00,0xFE,0x6C,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00, +/* 0xE4 */ 0x00,0x00,0xFE,0xC6,0x60,0x30,0x18,0x18,0x30,0x60,0xC6,0xFE,0x00,0x00,0x00,0x00, +/* 0xE5 */ 0x00,0x00,0x00,0x00,0x00,0x7E,0xD8,0xD8,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00, +/* 0xE6 */ 0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7C,0x60,0xC0,0x00,0x00,0x00, +/* 0xE7 */ 0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00, +/* 0xE8 */ 0x00,0x00,0x7E,0x18,0x3C,0x66,0x66,0x66,0x66,0x3C,0x18,0x7E,0x00,0x00,0x00,0x00, +/* 0xE9 */ 0x00,0x00,0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x6C,0x38,0x00,0x00,0x00,0x00, +/* 0xEA */ 0x00,0x00,0x38,0x6C,0xC6,0xC6,0xC6,0x6C,0x6C,0x6C,0x6C,0xEE,0x00,0x00,0x00,0x00, +/* 0xEB */ 0x00,0x00,0x1E,0x30,0x18,0x0C,0x3E,0x66,0x66,0x66,0x66,0x3C,0x00,0x00,0x00,0x00, +/* 0xEC */ 0x00,0x00,0x00,0x00,0x00,0x7E,0xDB,0xDB,0xDB,0x7E,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xED */ 0x00,0x00,0x00,0x03,0x06,0x7E,0xDB,0xDB,0xF3,0x7E,0x60,0xC0,0x00,0x00,0x00,0x00, +/* 0xEE */ 0x00,0x00,0x1C,0x30,0x60,0x60,0x7C,0x60,0x60,0x60,0x30,0x1C,0x00,0x00,0x00,0x00, +/* 0xEF */ 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x00,0x00,0x00,0x00, +/* 0xF0 */ 0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, +/* 0xF1 */ 0x00,0x00,0x00,0x00,0x18,0x18,0x7E,0x18,0x18,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, +/* 0xF2 */ 0x00,0x00,0x00,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00,0x7E,0x00,0x00,0x00,0x00, +/* 0xF3 */ 0x00,0x00,0x00,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00,0x7E,0x00,0x00,0x00,0x00, +/* 0xF4 */ 0x00,0x0E,0x1B,0x1B,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, +/* 0xF5 */ 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xD8,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00, +/* 0xF6 */ 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7E,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00, +/* 0xF7 */ 0x00,0x00,0x00,0x00,0x00,0x76,0xDC,0x00,0x76,0xDC,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xF8 */ 0x00,0x38,0x6C,0x6C,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xF9 */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xFA */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xFB */ 0x00,0x0F,0x0C,0x0C,0x0C,0x0C,0x0C,0xEC,0x6C,0x6C,0x3C,0x1C,0x00,0x00,0x00,0x00, +/* 0xFC */ 0x00,0xD8,0x6C,0x6C,0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xFD */ 0x00,0x70,0xD8,0x30,0x60,0xC8,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +/* 0xFE */ 0x00,0x00,0x00,0x00,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x7C,0x00,0x00,0x00,0x00,0x00, +}; diff --git a/arch/ppc/boot/compressed/lzw.h b/arch/ppc/boot/lzw.h index 4e640f5a2..4e640f5a2 100644 --- a/arch/ppc/boot/compressed/lzw.h +++ b/arch/ppc/boot/lzw.h diff --git a/arch/ppc/boot/misc.c b/arch/ppc/boot/misc.c new file mode 100644 index 000000000..0b1638562 --- /dev/null +++ b/arch/ppc/boot/misc.c @@ -0,0 +1,762 @@ +/* + * misc.c + * + * This is a collection of several routines from gzip-1.0.3 + * adapted for Linux. + * + * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 + * puts by Nick Holloway 1993 + * + * Adapted for PowerPC by Gary Thomas + */ + +#include "gzip.h" +#include "lzw.h" +#include "asm/residual.h" + +RESIDUAL hold_residual; +void dump_buf(unsigned char *p, int s); +#define EOF -1 + +DECLARE(uch, inbuf, INBUFSIZ); +DECLARE(uch, outbuf, OUTBUFSIZ+OUTBUF_EXTRA); +DECLARE(uch, window, WSIZE); + +unsigned outcnt; +unsigned insize; +unsigned inptr; + +extern char input_data[]; +extern int input_len; + +int input_ptr; + +int method, exit_code, part_nb, last_member; +int test = 0; +int force = 0; +int verbose = 1; +long bytes_in, bytes_out; + +char *output_data; +unsigned long output_ptr; + +extern int end; +long free_mem_ptr = (long)&end; + +int to_stdout = 0; +int hard_math = 0; + +void (*work)(int inf, int outf); +void makecrc(void); + +local int get_method(int); + +char *vidmem = (char *)0xC00B8000; +int lines, cols; +int orig_x, orig_y; + +void puts(const char *); + +void *malloc(int size) +{ + void *p; + + if (size <0) error("Malloc error\n"); + if (free_mem_ptr <= 0) error("Memory error\n"); + + while(1) { + free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */ + + p = (void *)free_mem_ptr; + free_mem_ptr += size; + + /* + * The part of the compressed kernel which has already been expanded + * is no longer needed. Therefore we can reuse it for malloc. + * With bigger kernels, this is necessary. + */ + + if (free_mem_ptr < (long)&end) { + if (free_mem_ptr > (long)&input_data[input_ptr]) + error("\nOut of memory\n"); + + return p; + } +#if 0 + if (free_mem_ptr < 0x90000) +#endif + return p; + puts("large kernel, low 1M tight..."); + free_mem_ptr = (long)input_data; + } +} + +void free(void *where) +{ /* Don't care */ +} + +static void clear_screen() +{ + int i, j; + for (i = 0; i < lines; i++) { + for (j = 0; j < cols; j++) { + vidmem[((i*cols)+j)*2] = ' '; + vidmem[((i*cols)+j)*2+1] = 0x07; + } + } +} + +static void scroll() +{ + int i; + + memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 ); + for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 ) + vidmem[i] = ' '; +} + +void puts(const char *s) +{ + int x,y; + char c; + + x = orig_x; + y = orig_y; + + while ( ( c = *s++ ) != '\0' ) { + if ( c == '\n' ) { + x = 0; + if ( ++y >= lines ) { + scroll(); + y--; + } + } else { + vidmem [ ( x + cols * y ) * 2 ] = c; + if ( ++x >= cols ) { + x = 0; + if ( ++y >= lines ) { + scroll(); + y--; + } + } + } + } + + orig_x = x; + orig_y = y; +} + +__ptr_t memset(__ptr_t s, int c, size_t n) +{ + int i; + char *ss = (char*)s; + + for (i=0;i<n;i++) ss[i] = c; +} + +__ptr_t memcpy(__ptr_t __dest, __const __ptr_t __src, + size_t __n) +{ + int i; + char *d = (char *)__dest, *s = (char *)__src; + + for (i=0;i<__n;i++) d[i] = s[i]; +} + +int memcmp(__ptr_t __dest, __const __ptr_t __src, + size_t __n) +{ + int i; + char *d = (char *)__dest, *s = (char *)__src; + + for (i=0;i<__n;i++, d++, s++) + { + if (*d != *s) + { + return (*s - *d); + } + } + return (0); +} + +extern ulg crc_32_tab[]; /* crc table, defined below */ + +/* =========================================================================== + * Run a set of bytes through the crc shift register. If s is a NULL + * pointer, then initialize the crc shift register contents instead. + * Return the current crc in either case. + */ +ulg updcrc(s, n) + uch *s; /* pointer to bytes to pump through */ + unsigned n; /* number of bytes in s[] */ +{ + register ulg c; /* temporary variable */ + + static ulg crc = (ulg)0xffffffffL; /* shift register contents */ + + if (s == NULL) { + c = 0xffffffffL; + } else { + c = crc; + while (n--) { + c = crc_32_tab[((int)c ^ (*s++)) & 0xff] ^ (c >> 8); + } + } + crc = c; + return c ^ 0xffffffffL; /* (instead of ~c for 64-bit machines) */ +} + +/* =========================================================================== + * Clear input and output buffers + */ +void clear_bufs() +{ + outcnt = 0; + insize = inptr = 0; + bytes_in = bytes_out = 0L; +} + +/* =========================================================================== + * Fill the input buffer. This is called only when the buffer is empty + * and at least one byte is really needed. + */ +int fill_inbuf() +{ + int len, i; + + /* Read as much as possible */ +puts("*"); + insize = 0; + do { + len = INBUFSIZ-insize; + if (len > (input_len-input_ptr+1)) len=input_len-input_ptr+1; + if (len == 0 || len == EOF) break; + + for (i=0;i<len;i++) inbuf[insize+i] = input_data[input_ptr+i]; + insize += len; + input_ptr += len; + } while (insize < INBUFSIZ); + + if (insize == 0) { + error("unable to fill buffer\n"); + } + bytes_in += (ulg)insize; + inptr = 1; + return inbuf[0]; +} + +/* =========================================================================== + * Write the output window window[0..outcnt-1] and update crc and bytes_out. + * (Used for the decompressed data only.) + */ +void flush_window() +{ + if (outcnt == 0) return; + updcrc(window, outcnt); + + memcpy(&output_data[output_ptr], (char *)window, outcnt); + + bytes_out += (ulg)outcnt; + output_ptr += (ulg)outcnt; + outcnt = 0; +} + +/* + * Code to compute the CRC-32 table. Borrowed from + * gzip-1.0.3/makecrc.c. + */ + +ulg crc_32_tab[256]; + +void +makecrc(void) +{ +/* Not copyrighted 1990 Mark Adler */ + + unsigned long c; /* crc shift register */ + unsigned long e; /* polynomial exclusive-or pattern */ + int i; /* counter for all possible eight bit values */ + int k; /* byte being shifted into crc apparatus */ + + /* terms of polynomial defining this crc (except x^32): */ + static int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* Make exclusive-or pattern from polynomial */ + e = 0; + for (i = 0; i < sizeof(p)/sizeof(int); i++) + e |= 1L << (31 - p[i]); + + crc_32_tab[0] = 0; + + for (i = 1; i < 256; i++) + { + c = 0; + for (k = i | 256; k != 1; k >>= 1) + { + c = c & 1 ? (c >> 1) ^ e : c >> 1; + if (k & 1) + c ^= e; + } + crc_32_tab[i] = c; + } +} + +void error(char *x) +{ + puts("\n\n"); + puts(x); + puts("\n\n -- System halted"); + + while(1); /* Halt */ +} + +unsigned long +decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum, RESIDUAL *residual) +{ + unsigned long TotalMemory; + output_data = (char *)0x0; /* Points to 0 */ + lines = 25; + cols = 80; + orig_x = 0; + orig_y = 24; + + + /* Turn off MMU. Since we are mapped 1-1, this is OK. */ + flush_instruction_cache(); + _put_HID0(_get_HID0() & ~0x0000C000); + _put_MSR(_get_MSR() & ~0x0030); + + vga_init(0xC0000000); + clear_screen(); + + output_ptr = 0; + + exit_code = 0; + test = 0; + input_ptr = 0; + part_nb = 0; + + clear_bufs(); + makecrc(); + + puts("Loaded at "); puthex(load_addr); puts(", "); puthex(num_words); puts(" words"); + puts(", cksum = "); puthex(cksum); puts("\n"); + if (residual) { + _bcopy(residual, &hold_residual, sizeof(hold_residual)); + puts("Residual data at "); puthex(residual); puts("\n"); + show_residual_data(residual); + TotalMemory = residual->TotalMemory; + } else { + TotalMemory = 0x01000000; + } + + puts("Uncompressing Linux..."); + + method = get_method(0); + + work(0, 0); + + puts("done.\n"); + puts("Now booting the kernel\n"); + /*return (TotalMemory);*/ /* Later this can be a pointer to saved residual data */ + return &hold_residual; +} + +show_residual_data(RESIDUAL *res) +{ + puts("Residual data: "); puthex(res->ResidualLength); puts(" bytes\n"); + puts("Total memory: "); puthex(res->TotalMemory); puts("\n"); +#if 0 + puts("Residual structure = "); puthex(sizeof(*res)); puts(" bytes\n"); + dump_buf(&hold_residual, 32); + dump_buf(res, 32); +#endif +} + +#if 0 +verify_ram() +{ + unsigned long loc; + puts("Clearing memory:"); + for (loc = 0; loc <= 0x400000; loc += 4); + { + *(unsigned long *)loc = 0x0; + } + for (loc = 0; loc <= 0x400000; loc += 4); + { + if (*(unsigned long *)loc != 0x0) + { + puts(" - failed at "); + puthex(loc); + puts(": "); + puthex(*(unsigned long *)loc); + while (1); + } + } + puts("0"); + for (loc = 0; loc <= 0x400000; loc += 4); + { + *(unsigned long *)loc = 0xFFFFFFFF; + } + for (loc = 0; loc <= 0x400000; loc += 4); + { + if (*(unsigned long *)loc != 0xFFFFFFFF) + { + puts(" - failed at "); + puthex(loc); + puts(": "); + puthex(*(unsigned long *)loc); + while (1); + } + } + puts("1"); + for (loc = 0; loc <= 0x400000; loc += 4); + { + *(unsigned long *)loc = loc; + } + for (loc = 0; loc <= 0x400000; loc += 4); + { + if (*(unsigned long *)loc != loc) + { + puts(" - failed at "); + puthex(loc); + puts(": "); + puthex(*(unsigned long *)loc); + while (1); + } + } + puts("?"); + for (loc = 0; loc <= 0x400000; loc += 4); + { + *(unsigned long *)loc = 0xDEADB00B; + } + for (loc = 0; loc <= 0x400000; loc += 4); + { + if (*(unsigned long *)loc != 0xDEADB00B) + { + puts(" - failed at "); + puthex(loc); + puts(": "); + puthex(*(unsigned long *)loc); + while (1); + } + } + puts(">"); + for (loc = 0; loc <= 0x400000; loc += 4); + { + *(unsigned long *)loc = 0x0; + } + for (loc = 0; loc <= 0x400000; loc += 4); + { + if (*(unsigned long *)loc != 0x0) + { + puts(" - failed at "); + puthex(loc); + puts(": "); + puthex(*(unsigned long *)loc); + while (1); + } + } + puts("\n"); +} + +do_cksum(unsigned long loc) +{ + unsigned int ptr, cksum; + puts("cksum["); puthex(loc); puts("] = "); + cksum = 0; + for (ptr = loc; ptr < (loc+0x40000); ptr += 4) + { + cksum ^= *(unsigned long *)ptr; + } + puthex(cksum); puts(" "); + cksum = 0; loc += 0x40000; + for (ptr = loc; ptr < (loc+0x40000); ptr += 4) + { + cksum ^= *(unsigned long *)ptr; + } + puthex(cksum); puts(" "); + cksum = 0; loc += 0x40000; + for (ptr = loc; ptr < (loc+0x40000); ptr += 4) + { + cksum ^= *(unsigned long *)ptr; + } + puthex(cksum); puts(" "); + cksum = 0; loc += 0x40000; + for (ptr = loc; ptr < (loc+0x40000); ptr += 4) + { + cksum ^= *(unsigned long *)ptr; + } + puthex(cksum); puts("\n"); +} + +cksum_data() +{ + unsigned int *ptr, len, cksum, cnt; + cksum = cnt = 0; + ptr = input_data; + puts("Checksums: "); + for (len = 0; len < input_len; len += 4) { + cksum ^= *ptr++; + if (len && ((len & 0x0FFF) == 0)) { + if (cnt == 0) { + puts("\n ["); + puthex(ptr-1); + puts("] "); + } + puthex(cksum); + if (++cnt == 6) { + cnt = 0; + } else { + puts(" "); + } + } + } + puts("\n"); + puts("Data cksum = "); puthex(cksum); puts("\n"); +} + +cksum_text() +{ + extern int start, etext; + unsigned int *ptr, len, text_len, cksum, cnt; + cksum = cnt = 0; + ptr = &start; + text_len = (unsigned int)&etext - (unsigned int)&start; + puts("Checksums: "); + for (len = 0; len < text_len; len += 4) { + cksum ^= *ptr++; + if (len && ((len & 0x0FFF) == 0)) { + if (cnt == 0) { + puts("\n ["); + puthex(ptr-1); + puts("] "); + } + puthex(cksum); + if (++cnt == 6) { + cnt = 0; + } else { + puts(" "); + } + } + } + puts("\n"); + puts("TEXT cksum = "); puthex(cksum); puts("\n"); +} + +verify_data(unsigned long load_addr) +{ + extern int start, etext; + unsigned int *orig_ptr, *copy_ptr, len, errors; + errors = 0; + copy_ptr = input_data; + orig_ptr = (unsigned int *)(load_addr + ((unsigned int)input_data - (unsigned int)&start)); + for (len = 0; len < input_len; len += 4) { + if (*copy_ptr++ != *orig_ptr++) { + errors++; + } + } + copy_ptr = input_data; + orig_ptr = (unsigned int *)(load_addr + ((unsigned int)input_data - (unsigned int)&start)); + for (len = 0; len < input_len; len += 4) { + if (*copy_ptr++ != *orig_ptr++) { + dump_buf(copy_ptr-1, 128); + dump_buf(orig_ptr-1, 128); + puts("Total errors = "); puthex(errors*4); puts("\n"); + while (1) ; + } + } +} + +test_data(unsigned long load_addr) +{ + extern int start, etext; + unsigned int *orig_ptr, *copy_ptr, len, errors; + errors = 0; + copy_ptr = input_data; + orig_ptr = (unsigned int *)(load_addr + ((unsigned int)input_data - (unsigned int)&start)); + for (len = 0; len < input_len; len += 4) { + if (*copy_ptr++ != *orig_ptr++) { + errors++; + } + } + return (errors == 0); +} +#endif + +void puthex(unsigned long val) +{ + unsigned char buf[10]; + int i; + for (i = 7; i >= 0; i--) + { + buf[i] = "0123456789ABCDEF"[val & 0x0F]; + val >>= 4; + } + buf[8] = '\0'; + puts(buf); +} + +#if 1 +void puthex2(unsigned long val) +{ + unsigned char buf[4]; + int i; + for (i = 1; i >= 0; i--) + { + buf[i] = "0123456789ABCDEF"[val & 0x0F]; + val >>= 4; + } + buf[2] = '\0'; + puts(buf); +} + +void dump_buf(unsigned char *p, int s) +{ + int i, c; + if ((unsigned int)s > (unsigned int)p) + { + s = (unsigned int)s - (unsigned int)p; + } + while (s > 0) + { + puthex(p); puts(": "); + for (i = 0; i < 16; i++) + { + if (i < s) + { + puthex2(p[i] & 0xFF); + } else + { + puts(" "); + } + if ((i % 2) == 1) puts(" "); + if ((i % 8) == 7) puts(" "); + } + puts(" |"); + for (i = 0; i < 16; i++) + { + char buf[2]; + if (i < s) + { + c = p[i] & 0xFF; + if ((c < 0x20) || (c >= 0x7F)) c = '.'; + } else + { + c = ' '; + } + buf[0] = c; buf[1] = '\0'; + puts(buf); + } + puts("|\n"); + s -= 16; + p += 16; + } +} +#endif + +/* + * PCI/ISA I/O support + */ + +volatile unsigned char *ISA_io = (unsigned char *)0x80000000; +volatile unsigned char *ISA_mem = (unsigned char *)0xC0000000; + +void +outb(int port, char val) +{ + /* Ensure I/O operations complete */ + __asm__ volatile("eieio"); + ISA_io[port] = val; +} + +unsigned char +inb(int port) +{ + /* Ensure I/O operations complete */ + __asm__ volatile("eieio"); + return (ISA_io[port]); +} + +unsigned long +local_to_PCI(unsigned long addr) +{ + return ((addr & 0x7FFFFFFF) | 0x80000000); +} + +/* ======================================================================== + * Check the magic number of the input file and update ofname if an + * original name was given and to_stdout is not set. + * Return the compression method, -1 for error, -2 for warning. + * Set inptr to the offset of the next byte to be processed. + * This function may be called repeatedly for an input file consisting + * of several contiguous gzip'ed members. + * IN assertions: there is at least one remaining compressed member. + * If the member is a zip file, it must be the only one. + */ +local int get_method(in) + int in; /* input file descriptor */ +{ + uch flags; + char magic[2]; /* magic header */ + + magic[0] = (char)get_byte(); + magic[1] = (char)get_byte(); + + method = -1; /* unknown yet */ + part_nb++; /* number of parts in gzip file */ + last_member = 0; + /* assume multiple members in gzip file except for record oriented I/O */ + + if (memcmp(magic, GZIP_MAGIC, 2) == 0 + || memcmp(magic, OLD_GZIP_MAGIC, 2) == 0) { + + work = unzip; + method = (int)get_byte(); + flags = (uch)get_byte(); + if ((flags & ENCRYPTED) != 0) + error("Input is encrypted\n"); + if ((flags & CONTINUATION) != 0) + error("Multi part input\n"); + if ((flags & RESERVED) != 0) { + error("Input has invalid flags\n"); + exit_code = ERROR; + if (force <= 1) return -1; + } + (ulg)get_byte(); /* Get timestamp */ + ((ulg)get_byte()) << 8; + ((ulg)get_byte()) << 16; + ((ulg)get_byte()) << 24; + + (void)get_byte(); /* Ignore extra flags for the moment */ + (void)get_byte(); /* Ignore OS type for the moment */ + + if ((flags & EXTRA_FIELD) != 0) { + unsigned len = (unsigned)get_byte(); + len |= ((unsigned)get_byte())<<8; + while (len--) (void)get_byte(); + } + + /* Get original file name if it was truncated */ + if ((flags & ORIG_NAME) != 0) { + if (to_stdout || part_nb > 1) { + /* Discard the old name */ + while (get_byte() != 0) /* null */ ; + } else { + } /* to_stdout */ + } /* orig_name */ + + /* Discard file comment if any */ + if ((flags & COMMENT) != 0) { + while (get_byte() != 0) /* null */ ; + } + } else + error("unknown compression method"); + return method; +} + +void +_bcopy(char *src, char *dst, int len) +{ + while (len--) *dst++ = *src++; +} diff --git a/arch/ppc/boot/mk_type41.c b/arch/ppc/boot/mk_type41.c index a67bf961b..4e2a7b3aa 100644 --- a/arch/ppc/boot/mk_type41.c +++ b/arch/ppc/boot/mk_type41.c @@ -8,7 +8,11 @@ #include <stdio.h> #include <errno.h> +#ifdef linux +#include <asm/stat.h> +#else #include <sys/stat.h> +#endif _LE(long val, unsigned char *le) { @@ -187,7 +191,7 @@ write_prep_boot_partition(int out_fd) * (2 tracks/cylinder)(18 sectors/tracks)(80 cylinders/diskette) * - unlike the above sector numbers, the beginning sector is zero-based! */ -#if 0 +#if 0 pe->beginning_sector = LeDword(1); #else /* This has to be 0 on the PowerStack? */ diff --git a/arch/ppc/boot/mkprep.c b/arch/ppc/boot/mkprep.c new file mode 100644 index 000000000..a79ad98f2 --- /dev/null +++ b/arch/ppc/boot/mkprep.c @@ -0,0 +1,139 @@ +/* + * This program will make a type 0x41 load image from an + * executable file. Note: assumes that the executable has + * already been "flattened" by 'mkboot'. + * + * usage: mk_type41 flat-file image + */ + +#include <stdio.h> +#include <errno.h> +#ifdef linux +#include <asm/stat.h> +#else +#include <sys/stat.h> +#endif +#include <asm/byteorder.h> /* use same as kernel -- Cort */ + +typedef unsigned long dword_t; +typedef unsigned short word_t; +typedef unsigned char byte_t; +typedef byte_t block_t[512]; +typedef byte_t page_t[4096]; + +_LE(long val, unsigned char *le) +{ + le[0] = val; + le[1] = val >> 8; + le[2] = val >> 16; + le[3] = val >> 24; +} + +/* + * Partition table entry + * - from the PReP spec + */ +typedef struct partition_entry { + byte_t boot_indicator; + byte_t starting_head; + byte_t starting_sector; + byte_t starting_cylinder; + + byte_t system_indicator; + byte_t ending_head; + byte_t ending_sector; + byte_t ending_cylinder; + + dword_t beginning_sector; + dword_t number_of_sectors; +} partition_entry_t; + +#define BootActive 0x80 +#define SystemPrep 0x41 + + +int main(int argc, char *argv[]) +{ + struct stat info; + char buf[8192]; + int in_fd, out_fd,len; + unsigned char block[512]; + partition_entry_t *pe = (partition_entry_t *)&block[0x1BE]; + dword_t *entry = (dword_t *)&block[0x50]; + dword_t *length = (dword_t *)&block[0x51]; + + if (argc != 3) + { + fprintf(stderr, "usage: mk_type41 <boot-file> <image>\n"); + exit(1); + } + if ((in_fd = open(argv[1], 0)) < 0) + { + exit(2); + } + if ((out_fd = creat(argv[2], 0755)) < 0) + { + exit(2); + } + + bzero( &block, sizeof block ); + + + /* + * Magic marker + */ + block[510] = 0x55; + block[511] = 0xAA; + + pe->boot_indicator = BootActive; + pe->system_indicator = SystemPrep; + pe->starting_head = 0; /* zero-based */ + pe->starting_sector = 2; /* one-based */ + pe->starting_cylinder = 0; /* zero-based */ + + pe->ending_head = 1; /* assumes two heads */ + pe->ending_sector = 18; /* assumes 18 sectors/track */ + pe->ending_cylinder = 79; /* assumes 80 cylinders/diskette */ + +#if 0 +#if 0 + pe->beginning_sector = LeDword(1); +#else + /* This has to be 0 on the PowerStack? */ + pe->beginning_sector = LeDword(0); +#endif + pe->number_of_sectors = LeDword(2*18*80-1); +#endif + + if (fstat(in_fd, &info) < 0) + { + exit(4); + } + /* begin execution at 0x400 */ + _LE(0x400,(unsigned char *)entry); + _LE(info.st_size+0x400,length); + + lseek( out_fd, 0, 0 ); + /* write out 1st block */ + write( out_fd, block, sizeof block ); + + /* copy image */ +#if 1 + lseek(out_fd, 0x400, 0); + while ((len = read(in_fd, buf, sizeof(buf))) > 0) + { + if (write(out_fd, buf, len) != len) + { + exit(5); + } + } + if (len < 0) + { + exit(6); + } + close(in_fd); + close(out_fd); +#endif + return 0; +} + diff --git a/arch/ppc/boot/compressed/piggyback.c b/arch/ppc/boot/piggyback.c index ab1502d83..ca9fc2957 100644 --- a/arch/ppc/boot/compressed/piggyback.c +++ b/arch/ppc/boot/piggyback.c @@ -5,6 +5,7 @@ extern long ce_exec_config[]; main(int argc, char *argv[]) { int i, cnt, pos, len; + unsigned int cksum, val; unsigned char *lp; unsigned char buf[8192]; if (argc != 1) @@ -21,6 +22,7 @@ main(int argc, char *argv[]) fprintf(stdout, "\t.globl input_data\n"); fprintf(stdout, "input_data:\n"); pos = 0; + cksum = 0; while ((len = read(0, buf, sizeof(buf))) > 0) { cnt = 0; @@ -33,6 +35,8 @@ main(int argc, char *argv[]) fprintf(stdout, "\t.long\t"); } fprintf(stdout, "0x%02X%02X%02X%02X", lp[0], lp[1], lp[2], lp[3]); + val = *(unsigned long *)lp; + cksum ^= val; lp += 4; if (++cnt == 4) { @@ -54,6 +58,7 @@ main(int argc, char *argv[]) fprintf(stdout, "input_len:\t.long\t0x%x\n", pos); fflush(stdout); fclose(stdout); + fprintf(stderr, "cksum = %x\n", cksum); exit(0); } diff --git a/arch/ppc/boot/compressed/unzip.c b/arch/ppc/boot/unzip.c index d4a6617cd..0c660adcf 100644 --- a/arch/ppc/boot/compressed/unzip.c +++ b/arch/ppc/boot/unzip.c @@ -97,6 +97,7 @@ void unzip(in, out) { ulg orig_crc = 0; /* original crc */ ulg orig_len = 0; /* original uncompressed length */ + ulg _crc, _len; int n; uch buf[EXTHDR]; /* extended local header */ @@ -165,7 +166,8 @@ void unzip(in, out) } /* Validate decompression */ - if (orig_crc != updcrc(outbuf, 0)) { + if (orig_crc != (_crc = updcrc(outbuf, 0))) { + extern char input_data[]; error("crc error"); } if (orig_len != bytes_out) { diff --git a/arch/ppc/boot/vreset.c b/arch/ppc/boot/vreset.c new file mode 100644 index 000000000..7da3670c8 --- /dev/null +++ b/arch/ppc/boot/vreset.c @@ -0,0 +1,164 @@ +/* + * vreset.c + * + * Initialize the VGA control registers to 80x25 text mode. + * + * Adapted from a program by: + * Steve Sellgren + * San Francisco Indigo Company + * sfindigo!sellgren@uunet.uu.net + */ + +unsigned char CRTC[24] = { + 0x5F, 0x4F, 0x50, 0x82, 0x55, 0x81, 0xBF, 0x1F, + 0x00, 0x4F, 0x0D, 0x0E, 0x00, 0x00, 0x00, 0x00, /*0x07, 0x80, */ + 0x9C, 0xAE, 0x8F, 0x28, 0x1F, 0x96, 0xB9, 0xA3}; +unsigned char SEQ[5] = {0x3, 0x0, 0x3, 0x0, 0x2}; +unsigned char GC[9] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0xE, 0x0, 0xFF}; +unsigned char AC[21] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x14, 0x07, + 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x0C, 0x00, 0x0F, 0x08, 0x00}; + +#include "iso_font.h" + +static const unsigned char color_LUT[] = + { + 0x00, 0x00, 0x00, /* 0 - black */ + 0x00, 0x00, 0x2A, /* 1 - blue */ + 0x00, 0x2A, 0x00, /* 2 - green */ + 0x00, 0x2A, 0x2A, /* 3 - cyan */ + 0x2A, 0x00, 0x00, /* 4 - red */ + 0x2A, 0x00, 0x2A, /* 5 - magenta */ + 0x2A, 0x2A, 0x00, /* 6 - brown */ + 0x2A, 0x2A, 0x2A, /* 7 - white */ + 0x00, 0x00, 0x15, /* 8 - gray */ + 0x00, 0x00, 0x3F, /* 9 - light blue */ + 0x00, 0x2A, 0x15, /* 10 - light green */ + 0x00, 0x2A, 0x3F, /* 11 - light cyan */ + 0x2A, 0x00, 0x15, /* 12 - light red */ + 0x2A, 0x00, 0x3F, /* 13 - light magenta */ + 0x2A, 0x2A, 0x15, /* 14 - yellow */ + 0x2A, 0x2A, 0x3F, /* 15 - bright white */ + }; + +static inline +outw(int port, unsigned short val) +{ + outb(port, val >> 8); + outb(port+1, val); +} + +vga_init(unsigned char *ISA_mem) +{ + int i, j; + int value; + unsigned char *font_page = (unsigned char *) &ISA_mem[0xA0000]; + + /* See if VGA already in TEXT mode - exit if so! */ + outb(0x3CE, 0x06); + if ((inb(0x3CF) & 0x01) == 0) return; + + /* From the S3 manual */ + outb(0x46E8, 0x10); /* Put into setup mode */ + outb(0x3C3, 0x10); + outb(0x102, 0x01); /* Enable registers */ + outb(0x46E8, 0x08); /* Enable video */ + outb(0x3C3, 0x08); + outb(0x4AE8, 0x00); + + outb(0x42E8, 0x80); /* Reset graphics engine? */ + + outb(0x3D4, 0x38); /* Unlock all registers */ + outb(0x3D5, 0x48); + outb(0x3D4, 0x39); + outb(0x3D5, 0xA5); + outb(0x3D4, 0x40); + outb(0x3D5, inb(0x3D5)|0x01); + outb(0x3D4, 0x33); + outb(0x3D5, inb(0x3D5)&~0x52); + outb(0x3D4, 0x35); + outb(0x3D5, inb(0x3D5)&~0x30); + outb(0x3D4, 0x3A); + outb(0x3D5, 0x00); + outb(0x3D4, 0x53); + outb(0x3D5, 0x00); + outb(0x3D4, 0x31); + outb(0x3D5, inb(0x3D5)&~0x4B); + outb(0x3D4, 0x58); + outb(0x3D5, 0); + + outb(0x3D4, 0x54); + outb(0x3D5, 0x38); + outb(0x3D4, 0x60); + outb(0x3D5, 0x07); + outb(0x3D4, 0x61); + outb(0x3D5, 0x80); + outb(0x3D4, 0x62); + outb(0x3D5, 0xA1); + outb(0x3D4, 0x69); /* High order bits for cursor address */ + outb(0x3D5, 0); + + outb(0x3D4, 0x32); + outb(0x3D5, inb(0x3D5)&~0x10); + + outb(0x3C2, 0x67); + + /* Initialize DAC */ + outb(0x3C6,0xFF); + inb(0x3C7); + outb(0x3C8,0x00); + inb(0x3C7); + for (i=0; i<sizeof(color_LUT); i++) { + outb(0x3C9, color_LUT[i]); + } + for (i; i<768; i += 3) { + outb(0x3C9, 0x3F); /* White? */ + outb(0x3C9, 0x3F); /* White? */ + outb(0x3C9, 0x3F); /* White? */ + } + + /* Load font */ + NOP(inb(0x3DA)); /* Reset Address/Data FlipFlop for Attribute ctlr */ + outb(0x3C0,0x30); outb(0x3C0, 0x01); /* graphics mode */ + outw(0x3C4, 0x0001); /* reset sequencer */ + outw(0x3C4, 0x0204); /* write to plane 2 */ + outw(0x3C4, 0x0407); /* enable plane graphics */ + outw(0x3C4, 0x0003); /* reset sequencer */ + outw(0x3CE, 0x0402); /* read plane 2 */ + outw(0x3CE, 0x0500); /* write mode 0, read mode 0 */ + outw(0x3CE, 0x0600); /* set graphics */ + for (i = 0; i < sizeof(font); i += 16) { + for (j = 0; j < 16; j++) { + font_page[(2*i)+j] = font[i+j]; + } + } + + for (i = 0; i < 24; i++) { + outb(0x3D4, i); + outb(0x3D5, CRTC[i]); + } + for (i = 0; i < 5; i++) { + outb(0x3C4, i); + outb(0x3C5, SEQ[i]); + } + for (i = 0; i < 9; i++) { + outb(0x3CE, i); + outb(0x3CF, GC[i]); + } + value = inb(0x3DA); /* reset flip-flop */ + for (i = 0; i < 16; i++) { + outb(0x3C0, i); + outb(0x3C0, AC[i]); + } + for (i = 16; i < 21; i++) { + outb(0x3C0, i | 0x20); + outb(0x3C0, AC[i]); + } + outb(0x3C2, 0x23); +} + +static int +NOP(int x) +{ +} |