aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/compressed/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/boot/compressed/misc.c')
-rw-r--r--arch/x86/boot/compressed/misc.c59
1 files changed, 32 insertions, 27 deletions
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 90456cee47c3..bc5553b496f7 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -30,6 +30,7 @@
30#include <asm/io.h> 30#include <asm/io.h>
31#include <asm/page.h> 31#include <asm/page.h>
32#include <asm/boot.h> 32#include <asm/boot.h>
33#include <asm/bootparam.h>
33 34
34/* WARNING!! 35/* WARNING!!
35 * This code is compiled with -fPIC and it is relocated dynamically 36 * This code is compiled with -fPIC and it is relocated dynamically
@@ -187,13 +188,8 @@ static void gzip_release(void **);
187/* 188/*
188 * This is set up by the setup-routine at boot-time 189 * This is set up by the setup-routine at boot-time
189 */ 190 */
190static unsigned char *real_mode; /* Pointer to real-mode data */ 191static struct boot_params *real_mode; /* Pointer to real-mode data */
191 192static int quiet;
192#define RM_EXT_MEM_K (*(unsigned short *)(real_mode + 0x2))
193#ifndef STANDARD_MEMORY_BIOS_CALL
194#define RM_ALT_MEM_K (*(unsigned long *)(real_mode + 0x1e0))
195#endif
196#define RM_SCREEN_INFO (*(struct screen_info *)(real_mode+0))
197 193
198extern unsigned char input_data[]; 194extern unsigned char input_data[];
199extern int input_len; 195extern int input_len;
@@ -206,7 +202,8 @@ static void free(void *where);
206static void *memset(void *s, int c, unsigned n); 202static void *memset(void *s, int c, unsigned n);
207static void *memcpy(void *dest, const void *src, unsigned n); 203static void *memcpy(void *dest, const void *src, unsigned n);
208 204
209static void putstr(const char *); 205static void __putstr(int, const char *);
206#define putstr(__x) __putstr(0, __x)
210 207
211#ifdef CONFIG_X86_64 208#ifdef CONFIG_X86_64
212#define memptr long 209#define memptr long
@@ -221,10 +218,6 @@ static char *vidmem;
221static int vidport; 218static int vidport;
222static int lines, cols; 219static int lines, cols;
223 220
224#ifdef CONFIG_X86_NUMAQ
225void *xquad_portio;
226#endif
227
228#include "../../../../lib/inflate.c" 221#include "../../../../lib/inflate.c"
229 222
230static void *malloc(int size) 223static void *malloc(int size)
@@ -270,18 +263,24 @@ static void scroll(void)
270 vidmem[i] = ' '; 263 vidmem[i] = ' ';
271} 264}
272 265
273static void putstr(const char *s) 266static void __putstr(int error, const char *s)
274{ 267{
275 int x, y, pos; 268 int x, y, pos;
276 char c; 269 char c;
277 270
271#ifndef CONFIG_X86_VERBOSE_BOOTUP
272 if (!error)
273 return;
274#endif
275
278#ifdef CONFIG_X86_32 276#ifdef CONFIG_X86_32
279 if (RM_SCREEN_INFO.orig_video_mode == 0 && lines == 0 && cols == 0) 277 if (real_mode->screen_info.orig_video_mode == 0 &&
278 lines == 0 && cols == 0)
280 return; 279 return;
281#endif 280#endif
282 281
283 x = RM_SCREEN_INFO.orig_x; 282 x = real_mode->screen_info.orig_x;
284 y = RM_SCREEN_INFO.orig_y; 283 y = real_mode->screen_info.orig_y;
285 284
286 while ((c = *s++) != '\0') { 285 while ((c = *s++) != '\0') {
287 if (c == '\n') { 286 if (c == '\n') {
@@ -302,8 +301,8 @@ static void putstr(const char *s)
302 } 301 }
303 } 302 }
304 303
305 RM_SCREEN_INFO.orig_x = x; 304 real_mode->screen_info.orig_x = x;
306 RM_SCREEN_INFO.orig_y = y; 305 real_mode->screen_info.orig_y = y;
307 306
308 pos = (x + cols * y) * 2; /* Update cursor position */ 307 pos = (x + cols * y) * 2; /* Update cursor position */
309 outb(14, vidport); 308 outb(14, vidport);
@@ -366,9 +365,9 @@ static void flush_window(void)
366 365
367static void error(char *x) 366static void error(char *x)
368{ 367{
369 putstr("\n\n"); 368 __putstr(1, "\n\n");
370 putstr(x); 369 __putstr(1, x);
371 putstr("\n\n -- System halted"); 370 __putstr(1, "\n\n -- System halted");
372 371
373 while (1) 372 while (1)
374 asm("hlt"); 373 asm("hlt");
@@ -395,7 +394,8 @@ static void parse_elf(void *output)
395 return; 394 return;
396 } 395 }
397 396
398 putstr("Parsing ELF... "); 397 if (!quiet)
398 putstr("Parsing ELF... ");
399 399
400 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum); 400 phdrs = malloc(sizeof(*phdrs) * ehdr.e_phnum);
401 if (!phdrs) 401 if (!phdrs)
@@ -430,7 +430,10 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
430{ 430{
431 real_mode = rmode; 431 real_mode = rmode;
432 432
433 if (RM_SCREEN_INFO.orig_video_mode == 7) { 433 if (real_mode->hdr.loadflags & QUIET_FLAG)
434 quiet = 1;
435
436 if (real_mode->screen_info.orig_video_mode == 7) {
434 vidmem = (char *) 0xb0000; 437 vidmem = (char *) 0xb0000;
435 vidport = 0x3b4; 438 vidport = 0x3b4;
436 } else { 439 } else {
@@ -438,8 +441,8 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
438 vidport = 0x3d4; 441 vidport = 0x3d4;
439 } 442 }
440 443
441 lines = RM_SCREEN_INFO.orig_video_lines; 444 lines = real_mode->screen_info.orig_video_lines;
442 cols = RM_SCREEN_INFO.orig_video_cols; 445 cols = real_mode->screen_info.orig_video_cols;
443 446
444 window = output; /* Output buffer (Normally at 1M) */ 447 window = output; /* Output buffer (Normally at 1M) */
445 free_mem_ptr = heap; /* Heap */ 448 free_mem_ptr = heap; /* Heap */
@@ -465,9 +468,11 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
465#endif 468#endif
466 469
467 makecrc(); 470 makecrc();
468 putstr("\nDecompressing Linux... "); 471 if (!quiet)
472 putstr("\nDecompressing Linux... ");
469 gunzip(); 473 gunzip();
470 parse_elf(output); 474 parse_elf(output);
471 putstr("done.\nBooting the kernel.\n"); 475 if (!quiet)
476 putstr("done.\nBooting the kernel.\n");
472 return; 477 return;
473} 478}