~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-rpc/include/mach/uncompress.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  *  arch/arm/mach-rpc/include/mach/uncompress.h
  4  *
  5  *  Copyright (C) 1996 Russell King
  6  */
  7 #define VIDMEM ((char *)SCREEN_START)
  8  
  9 #include <linux/io.h>
 10 #include <mach/hardware.h>
 11 #include <asm/setup.h>
 12 #include <asm/page.h>
 13 
 14 int video_size_row;
 15 unsigned char bytes_per_char_h;
 16 extern unsigned long con_charconvtable[256];
 17 
 18 struct param_struct {
 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];
 34 };
 35 
 36 static const unsigned long palette_4[16] = {
 37         0x00000000,
 38         0x000000cc,
 39         0x0000cc00,             /* Green   */
 40         0x0000cccc,             /* Yellow  */
 41         0x00cc0000,             /* Blue    */
 42         0x00cc00cc,             /* Magenta */
 43         0x00cccc00,             /* Cyan    */
 44         0x00cccccc,             /* White   */
 45         0x00000000,
 46         0x000000ff,
 47         0x0000ff00,
 48         0x0000ffff,
 49         0x00ff0000,
 50         0x00ff00ff,
 51         0x00ffff00,
 52         0x00ffffff
 53 };
 54 
 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)
 57 
 58 /*
 59  * params_phys is a linker defined symbol - see
 60  * arch/arm/boot/compressed/Makefile
 61  */
 62 extern __attribute__((pure)) struct param_struct *params(void);
 63 #define params (params())
 64 
 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;
 71 int white;
 72 
 73 /*
 74  * This does not append a newline
 75  */
 76 static inline void putc(int c)
 77 {
 78         extern void ll_write_char(char *, char c, char white);
 79         int x,y;
 80         char *ptr;
 81 
 82         x = video_x;
 83         y = video_y;
 84 
 85         if (c == '\n') {
 86                 if (++y >= video_num_rows)
 87                         y--;
 88         } else if (c == '\r') {
 89                 x = 0;
 90         } else {
 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) {
 94                         x = 0;
 95                         if ( ++y >= video_num_rows ) {
 96                                 y--;
 97                         }
 98                 }
 99         }
100 
101         video_x = x;
102         video_y = y;
103 }
104 
105 static inline void flush(void)
106 {
107 }
108 
109 /*
110  * Setup for decompression
111  */
112 static void arch_decomp_setup(void)
113 {
114         int i;
115         struct tag *t = (struct tag *)params;
116         unsigned int nr_pages = 0, page_size = PAGE_SIZE;
117 
118         if (t->hdr.tag == ATAG_CORE) {
119                 for (; t->hdr.size; t = tag_next(t)) {
120                         if (t->hdr.tag == ATAG_VIDEOTEXT) {
121                                 video_num_rows = t->u.videotext.video_lines;
122                                 video_num_cols = t->u.videotext.video_cols;
123                                 video_x = t->u.videotext.x;
124                                 video_y = t->u.videotext.y;
125                         } else if (t->hdr.tag == ATAG_VIDEOLFB) {
126                                 bytes_per_char_h = t->u.videolfb.lfb_depth;
127                                 bytes_per_char_v = 8;
128                         } else if (t->hdr.tag == ATAG_MEM) {
129                                 page_size = PAGE_SIZE;
130                                 nr_pages += (t->u.mem.size / PAGE_SIZE);
131                         }
132                 }
133         } else {
134                 nr_pages = params->nr_pages;
135                 page_size = params->page_size;
136                 video_num_rows = params->video_num_rows;
137                 video_num_cols = params->video_num_cols;
138                 video_x = params->video_x;
139                 video_y = params->video_y;
140                 bytes_per_char_h = params->bytes_per_char_h;
141                 bytes_per_char_v = params->bytes_per_char_v;
142         }
143 
144         video_size_row = video_num_cols * bytes_per_char_h;
145         
146         if (bytes_per_char_h == 4)
147                 for (i = 0; i < 256; i++)
148                         con_charconvtable[i] =
149                                 (i & 128 ? 1 << 0  : 0) |
150                                 (i & 64  ? 1 << 4  : 0) |
151                                 (i & 32  ? 1 << 8  : 0) |
152                                 (i & 16  ? 1 << 12 : 0) |
153                                 (i & 8   ? 1 << 16 : 0) |
154                                 (i & 4   ? 1 << 20 : 0) |
155                                 (i & 2   ? 1 << 24 : 0) |
156                                 (i & 1   ? 1 << 28 : 0);
157         else
158                 for (i = 0; i < 16; i++)
159                         con_charconvtable[i] =
160                                 (i & 8   ? 1 << 0  : 0) |
161                                 (i & 4   ? 1 << 8  : 0) |
162                                 (i & 2   ? 1 << 16 : 0) |
163                                 (i & 1   ? 1 << 24 : 0);
164 
165 
166         palette_setpixel(0);
167         if (bytes_per_char_h == 1) {
168                 palette_write (0);
169                 palette_write (0x00ffffff);
170                 for (i = 2; i < 256; i++)
171                         palette_write (0);
172                 white = 1;
173         } else {
174                 for (i = 0; i < 256; i++)
175                         palette_write (i < 16 ? palette_4[i] : 0);
176                 white = 7;
177         }
178 
179         if (nr_pages * page_size < 4096*1024) error("<4M of mem\n");
180 }
181 #endif
182 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php