Path: blob/master/arch/arm/mach-rpc/include/mach/uncompress.h
15162 views
/*1* arch/arm/mach-rpc/include/mach/uncompress.h2*3* Copyright (C) 1996 Russell King4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License version 2 as7* published by the Free Software Foundation.8*/9#define VIDMEM ((char *)SCREEN_START)1011#include <linux/io.h>12#include <mach/hardware.h>13#include <asm/setup.h>14#include <asm/page.h>1516int video_size_row;17unsigned char bytes_per_char_h;18extern unsigned long con_charconvtable[256];1920struct param_struct {21unsigned long page_size;22unsigned long nr_pages;23unsigned long ramdisk_size;24unsigned long mountrootrdonly;25unsigned long rootdev;26unsigned long video_num_cols;27unsigned long video_num_rows;28unsigned long video_x;29unsigned long video_y;30unsigned long memc_control_reg;31unsigned char sounddefault;32unsigned char adfsdrives;33unsigned char bytes_per_char_h;34unsigned char bytes_per_char_v;35unsigned long unused[256/4-11];36};3738static const unsigned long palette_4[16] = {390x00000000,400x000000cc,410x0000cc00, /* Green */420x0000cccc, /* Yellow */430x00cc0000, /* Blue */440x00cc00cc, /* Magenta */450x00cccc00, /* Cyan */460x00cccccc, /* White */470x00000000,480x000000ff,490x0000ff00,500x0000ffff,510x00ff0000,520x00ff00ff,530x00ffff00,540x00ffffff55};5657#define palette_setpixel(p) *(unsigned long *)(IO_START+0x00400000) = 0x10000000|((p) & 255)58#define palette_write(v) *(unsigned long *)(IO_START+0x00400000) = 0x00000000|((v) & 0x00ffffff)5960/*61* params_phys is a linker defined symbol - see62* arch/arm/boot/compressed/Makefile63*/64extern __attribute__((pure)) struct param_struct *params(void);65#define params (params())6667#ifndef STANDALONE_DEBUG68unsigned long video_num_cols;69unsigned long video_num_rows;70unsigned long video_x;71unsigned long video_y;72unsigned char bytes_per_char_v;73int white;7475/*76* This does not append a newline77*/78static void putc(int c)79{80extern void ll_write_char(char *, char c, char white);81int x,y;82char *ptr;8384x = video_x;85y = video_y;8687if (c == '\n') {88if (++y >= video_num_rows)89y--;90} else if (c == '\r') {91x = 0;92} else {93ptr = VIDMEM + ((y*video_num_cols*bytes_per_char_v+x)*bytes_per_char_h);94ll_write_char(ptr, c, white);95if (++x >= video_num_cols) {96x = 0;97if ( ++y >= video_num_rows ) {98y--;99}100}101}102103video_x = x;104video_y = y;105}106107static inline void flush(void)108{109}110111/*112* Setup for decompression113*/114static void arch_decomp_setup(void)115{116int i;117struct tag *t = (struct tag *)params;118unsigned int nr_pages = 0, page_size = PAGE_SIZE;119120if (t->hdr.tag == ATAG_CORE)121{122for (; t->hdr.size; t = tag_next(t))123{124if (t->hdr.tag == ATAG_VIDEOTEXT)125{126video_num_rows = t->u.videotext.video_lines;127video_num_cols = t->u.videotext.video_cols;128bytes_per_char_h = t->u.videotext.video_points;129bytes_per_char_v = t->u.videotext.video_points;130video_x = t->u.videotext.x;131video_y = t->u.videotext.y;132}133134if (t->hdr.tag == ATAG_MEM)135{136page_size = PAGE_SIZE;137nr_pages += (t->u.mem.size / PAGE_SIZE);138}139}140}141else142{143nr_pages = params->nr_pages;144page_size = params->page_size;145video_num_rows = params->video_num_rows;146video_num_cols = params->video_num_cols;147video_x = params->video_x;148video_y = params->video_y;149bytes_per_char_h = params->bytes_per_char_h;150bytes_per_char_v = params->bytes_per_char_v;151}152153video_size_row = video_num_cols * bytes_per_char_h;154155if (bytes_per_char_h == 4)156for (i = 0; i < 256; i++)157con_charconvtable[i] =158(i & 128 ? 1 << 0 : 0) |159(i & 64 ? 1 << 4 : 0) |160(i & 32 ? 1 << 8 : 0) |161(i & 16 ? 1 << 12 : 0) |162(i & 8 ? 1 << 16 : 0) |163(i & 4 ? 1 << 20 : 0) |164(i & 2 ? 1 << 24 : 0) |165(i & 1 ? 1 << 28 : 0);166else167for (i = 0; i < 16; i++)168con_charconvtable[i] =169(i & 8 ? 1 << 0 : 0) |170(i & 4 ? 1 << 8 : 0) |171(i & 2 ? 1 << 16 : 0) |172(i & 1 ? 1 << 24 : 0);173174175palette_setpixel(0);176if (bytes_per_char_h == 1) {177palette_write (0);178palette_write (0x00ffffff);179for (i = 2; i < 256; i++)180palette_write (0);181white = 1;182} else {183for (i = 0; i < 256; i++)184palette_write (i < 16 ? palette_4[i] : 0);185white = 7;186}187188if (nr_pages * page_size < 4096*1024) error("<4M of mem\n");189}190#endif191192/*193* nothing to do194*/195#define arch_decomp_wdog()196197198