]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - include/asm-arm/arch-rpc/uncompress.h
Merge branch 'header-move' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemo...
[mirror_ubuntu-focal-kernel.git] / include / asm-arm / arch-rpc / uncompress.h
CommitLineData
1da177e4
LT
1/*
2 * linux/include/asm-arm/arch-rpc/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 *)SCREEN_START)
11
be509729 12#include <asm/arch/hardware.h>
1da177e4 13#include <asm/io.h>
e16edefe
AH
14#include <asm/setup.h>
15#include <asm/page.h>
1da177e4 16
e16edefe
AH
17int video_size_row;
18unsigned char bytes_per_char_h;
1da177e4
LT
19extern unsigned long con_charconvtable[256];
20
21struct param_struct {
22 unsigned long page_size;
23 unsigned long nr_pages;
24 unsigned long ramdisk_size;
25 unsigned long mountrootrdonly;
26 unsigned long rootdev;
27 unsigned long video_num_cols;
28 unsigned long video_num_rows;
29 unsigned long video_x;
30 unsigned long video_y;
31 unsigned long memc_control_reg;
32 unsigned char sounddefault;
33 unsigned char adfsdrives;
34 unsigned char bytes_per_char_h;
35 unsigned char bytes_per_char_v;
36 unsigned long unused[256/4-11];
37};
38
39static const unsigned long palette_4[16] = {
40 0x00000000,
41 0x000000cc,
42 0x0000cc00, /* Green */
43 0x0000cccc, /* Yellow */
44 0x00cc0000, /* Blue */
45 0x00cc00cc, /* Magenta */
46 0x00cccc00, /* Cyan */
47 0x00cccccc, /* White */
48 0x00000000,
49 0x000000ff,
50 0x0000ff00,
51 0x0000ffff,
52 0x00ff0000,
53 0x00ff00ff,
54 0x00ffff00,
55 0x00ffffff
56};
57
58#define palette_setpixel(p) *(unsigned long *)(IO_START+0x00400000) = 0x10000000|((p) & 255)
59#define palette_write(v) *(unsigned long *)(IO_START+0x00400000) = 0x00000000|((v) & 0x00ffffff)
60
61/*
62 * params_phys is a linker defined symbol - see
63 * arch/arm/boot/compressed/Makefile
64 */
65extern __attribute__((pure)) struct param_struct *params(void);
66#define params (params())
67
68#ifndef STANDALONE_DEBUG
e16edefe
AH
69static unsigned long video_num_cols;
70static unsigned long video_num_rows;
71static unsigned long video_x;
72static unsigned long video_y;
73static unsigned char bytes_per_char_v;
74static int white;
75
1da177e4
LT
76/*
77 * This does not append a newline
78 */
a081568d 79static void putc(int c)
1da177e4
LT
80{
81 extern void ll_write_char(char *, char c, char white);
82 int x,y;
1da177e4
LT
83 char *ptr;
84
e16edefe
AH
85 x = video_x;
86 y = video_y;
1da177e4 87
a081568d 88 if (c == '\n') {
e16edefe 89 if (++y >= video_num_rows)
a081568d
RK
90 y--;
91 } else if (c == '\r') {
92 x = 0;
93 } else {
e16edefe 94 ptr = VIDMEM + ((y*video_num_cols*bytes_per_char_v+x)*bytes_per_char_h);
a081568d 95 ll_write_char(ptr, c, white);
e16edefe 96 if (++x >= video_num_cols) {
1da177e4 97 x = 0;
e16edefe 98 if ( ++y >= video_num_rows ) {
1da177e4
LT
99 y--;
100 }
1da177e4
LT
101 }
102 }
103
e16edefe
AH
104 video_x = x;
105 video_y = y;
1da177e4
LT
106}
107
a081568d
RK
108static inline void flush(void)
109{
110}
111
1da177e4
LT
112static void error(char *x);
113
114/*
115 * Setup for decompression
116 */
117static void arch_decomp_setup(void)
118{
119 int i;
e16edefe
AH
120 struct tag *t = (struct tag *)params;
121 unsigned int nr_pages = 0, page_size = PAGE_SIZE;
122
123 if (t->hdr.tag == ATAG_CORE)
124 {
125 for (; t->hdr.size; t = tag_next(t))
126 {
127 if (t->hdr.tag == ATAG_VIDEOTEXT)
128 {
129 video_num_rows = t->u.videotext.video_lines;
130 video_num_cols = t->u.videotext.video_cols;
131 bytes_per_char_h = t->u.videotext.video_points;
132 bytes_per_char_v = t->u.videotext.video_points;
133 video_x = t->u.videotext.x;
134 video_y = t->u.videotext.y;
135 }
136
137 if (t->hdr.tag == ATAG_MEM)
138 {
139 page_size = PAGE_SIZE;
140 nr_pages += (t->u.mem.size / PAGE_SIZE);
141 }
142 }
143 }
144 else
145 {
146 nr_pages = params->nr_pages;
147 page_size = params->page_size;
148 video_num_rows = params->video_num_rows;
149 video_num_cols = params->video_num_cols;
150 video_x = params->video_x;
151 video_y = params->video_y;
152 bytes_per_char_h = params->bytes_per_char_h;
153 bytes_per_char_v = params->bytes_per_char_v;
154 }
155
156 video_size_row = video_num_cols * bytes_per_char_h;
1da177e4 157
1da177e4
LT
158 if (bytes_per_char_h == 4)
159 for (i = 0; i < 256; i++)
160 con_charconvtable[i] =
161 (i & 128 ? 1 << 0 : 0) |
162 (i & 64 ? 1 << 4 : 0) |
163 (i & 32 ? 1 << 8 : 0) |
164 (i & 16 ? 1 << 12 : 0) |
165 (i & 8 ? 1 << 16 : 0) |
166 (i & 4 ? 1 << 20 : 0) |
167 (i & 2 ? 1 << 24 : 0) |
168 (i & 1 ? 1 << 28 : 0);
169 else
170 for (i = 0; i < 16; i++)
171 con_charconvtable[i] =
172 (i & 8 ? 1 << 0 : 0) |
173 (i & 4 ? 1 << 8 : 0) |
174 (i & 2 ? 1 << 16 : 0) |
175 (i & 1 ? 1 << 24 : 0);
176
177
178 palette_setpixel(0);
179 if (bytes_per_char_h == 1) {
180 palette_write (0);
181 palette_write (0x00ffffff);
182 for (i = 2; i < 256; i++)
183 palette_write (0);
184 white = 1;
185 } else {
186 for (i = 0; i < 256; i++)
187 palette_write (i < 16 ? palette_4[i] : 0);
188 white = 7;
189 }
190
e16edefe 191 if (nr_pages * page_size < 4096*1024) error("<4M of mem\n");
1da177e4
LT
192}
193#endif
194
195/*
196 * nothing to do
197 */
198#define arch_decomp_wdog()