Linux-2.6.12-rc2
[pandora-kernel.git] / arch / arm26 / boot / compressed / uncompress.h
1 /*
2  *
3  *  Copyright (C) 1996 Russell King
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  */
9 #define VIDMEM ((char *)0x02000000)
10  
11 int video_num_columns, video_num_lines, video_size_row;
12 int white, bytes_per_char_h;
13 extern unsigned long con_charconvtable[256];
14
15 struct param_struct {
16         unsigned long page_size;
17         unsigned long nr_pages;
18         unsigned long ramdisk_size;
19         unsigned long mountrootrdonly;
20         unsigned long rootdev;
21         unsigned long video_num_cols;
22         unsigned long video_num_rows;
23         unsigned long video_x;
24         unsigned long video_y;
25         unsigned long memc_control_reg;
26         unsigned char sounddefault;
27         unsigned char adfsdrives;
28         unsigned char bytes_per_char_h;
29         unsigned char bytes_per_char_v;
30         unsigned long unused[256/4-11];
31 };
32
33 static struct param_struct *params = (struct param_struct *)0x0207c000;
34  
35 /*
36  * This does not append a newline
37  */
38 static void puts(const char *s)
39 {
40         extern void ll_write_char(char *, unsigned long);
41         int x,y;
42         unsigned char c;
43         char *ptr;
44
45         x = params->video_x;
46         y = params->video_y;
47
48         while ( ( c = *(unsigned char *)s++ ) != '\0' ) {
49                 if ( c == '\n' ) {
50                         x = 0;
51                         if ( ++y >= video_num_lines ) {
52                                 y--;
53                         }
54                 } else {
55                         ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h);
56                         ll_write_char(ptr, c|(white<<16));
57                         if ( ++x >= video_num_columns ) {
58                                 x = 0;
59                                 if ( ++y >= video_num_lines ) {
60                                         y--;
61                                 }
62                         }
63                 }
64         }
65
66         params->video_x = x;
67         params->video_y = y;
68 }
69
70 static void error(char *x);
71
72 /*
73  * Setup for decompression
74  */
75 static void arch_decomp_setup(void)
76 {
77         int i;
78         
79         video_num_lines = params->video_num_rows;
80         video_num_columns = params->video_num_cols;
81         bytes_per_char_h = params->bytes_per_char_h;
82         video_size_row = video_num_columns * bytes_per_char_h;
83         if (bytes_per_char_h == 4)
84                 for (i = 0; i < 256; i++)
85                         con_charconvtable[i] =
86                                 (i & 128 ? 1 << 0  : 0) |
87                                 (i & 64  ? 1 << 4  : 0) |
88                                 (i & 32  ? 1 << 8  : 0) |
89                                 (i & 16  ? 1 << 12 : 0) |
90                                 (i & 8   ? 1 << 16 : 0) |
91                                 (i & 4   ? 1 << 20 : 0) |
92                                 (i & 2   ? 1 << 24 : 0) |
93                                 (i & 1   ? 1 << 28 : 0);
94         else
95                 for (i = 0; i < 16; i++)
96                         con_charconvtable[i] =
97                                 (i & 8   ? 1 << 0  : 0) |
98                                 (i & 4   ? 1 << 8  : 0) |
99                                 (i & 2   ? 1 << 16 : 0) |
100                                 (i & 1   ? 1 << 24 : 0);
101
102         white = bytes_per_char_h == 8 ? 0xfc : 7;
103
104         if (params->nr_pages * params->page_size < 4096*1024) error("<4M of mem\n");
105 }
106
107 /*
108  * nothing to do
109  */
110 #define arch_decomp_wdog()