1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * arch/arm/mach-rpc/include/mach/uncompress.h
5 * Copyright (C) 1996 Russell King
7 #define VIDMEM ((char *)SCREEN_START)
10 #include <mach/hardware.h>
11 #include <asm/setup.h>
15 unsigned char bytes_per_char_h;
16 extern unsigned long con_charconvtable[256];
19 unsigned long page_size;
20 unsigned long nr_pages;
21 unsigned long ramdisk_size;
22 unsigned long mountrootrdonly;
23 unsigned long rootdev;
24 unsigned long video_num_cols;
25 unsigned long video_num_rows;
26 unsigned long video_x;
27 unsigned long video_y;
28 unsigned long memc_control_reg;
29 unsigned char sounddefault;
30 unsigned char adfsdrives;
31 unsigned char bytes_per_char_h;
32 unsigned char bytes_per_char_v;
33 unsigned long unused[256/4-11];
36 static const unsigned long palette_4[16] = {
39 0x0000cc00, /* Green */
40 0x0000cccc, /* Yellow */
41 0x00cc0000, /* Blue */
42 0x00cc00cc, /* Magenta */
43 0x00cccc00, /* Cyan */
44 0x00cccccc, /* White */
55 #define palette_setpixel(p) *(unsigned long *)(IO_START+0x00400000) = 0x10000000|((p) & 255)
56 #define palette_write(v) *(unsigned long *)(IO_START+0x00400000) = 0x00000000|((v) & 0x00ffffff)
59 * params_phys is a linker defined symbol - see
60 * arch/arm/boot/compressed/Makefile
62 extern __attribute__((pure)) struct param_struct *params(void);
63 #define params (params())
65 #ifndef STANDALONE_DEBUG
66 unsigned long video_num_cols;
67 unsigned long video_num_rows;
68 unsigned long video_x;
69 unsigned long video_y;
70 unsigned char bytes_per_char_v;
74 * This does not append a newline
76 static inline void putc(int c)
78 extern void ll_write_char(char *, char c, char white);
86 if (++y >= video_num_rows)
88 } else if (c == '\r') {
91 ptr = VIDMEM + ((y*video_num_cols*bytes_per_char_v+x)*bytes_per_char_h);
92 ll_write_char(ptr, c, white);
93 if (++x >= video_num_cols) {
95 if ( ++y >= video_num_rows ) {
105 static inline void flush(void)
110 * Setup for decompression
112 static void arch_decomp_setup(void)
115 struct tag *t = (struct tag *)params;
116 unsigned int nr_pages = 0, page_size = PAGE_SIZE;
118 if (t->hdr.tag == ATAG_CORE)
120 for (; t->hdr.size; t = tag_next(t))
122 if (t->hdr.tag == ATAG_VIDEOTEXT)
124 video_num_rows = t->u.videotext.video_lines;
125 video_num_cols = t->u.videotext.video_cols;
126 bytes_per_char_h = t->u.videotext.video_points;
127 bytes_per_char_v = t->u.videotext.video_points;
128 video_x = t->u.videotext.x;
129 video_y = t->u.videotext.y;
132 if (t->hdr.tag == ATAG_MEM)
134 page_size = PAGE_SIZE;
135 nr_pages += (t->u.mem.size / PAGE_SIZE);
141 nr_pages = params->nr_pages;
142 page_size = params->page_size;
143 video_num_rows = params->video_num_rows;
144 video_num_cols = params->video_num_cols;
145 video_x = params->video_x;
146 video_y = params->video_y;
147 bytes_per_char_h = params->bytes_per_char_h;
148 bytes_per_char_v = params->bytes_per_char_v;
151 video_size_row = video_num_cols * bytes_per_char_h;
153 if (bytes_per_char_h == 4)
154 for (i = 0; i < 256; i++)
155 con_charconvtable[i] =
156 (i & 128 ? 1 << 0 : 0) |
157 (i & 64 ? 1 << 4 : 0) |
158 (i & 32 ? 1 << 8 : 0) |
159 (i & 16 ? 1 << 12 : 0) |
160 (i & 8 ? 1 << 16 : 0) |
161 (i & 4 ? 1 << 20 : 0) |
162 (i & 2 ? 1 << 24 : 0) |
163 (i & 1 ? 1 << 28 : 0);
165 for (i = 0; i < 16; i++)
166 con_charconvtable[i] =
167 (i & 8 ? 1 << 0 : 0) |
168 (i & 4 ? 1 << 8 : 0) |
169 (i & 2 ? 1 << 16 : 0) |
170 (i & 1 ? 1 << 24 : 0);
174 if (bytes_per_char_h == 1) {
176 palette_write (0x00ffffff);
177 for (i = 2; i < 256; i++)
181 for (i = 0; i < 256; i++)
182 palette_write (i < 16 ? palette_4[i] : 0);
186 if (nr_pages * page_size < 4096*1024) error("<4M of mem\n");