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