x86: unify headers in arch/x86/boot/compressed/misc_??.c
[sfrench/cifs-2.6.git] / arch / x86 / boot / compressed / misc_64.c
index f932b0e89096afaf0eefdcf723a27d1957c4a3d5..ca760fb69b9519ab1fd1e92a3024e20ac6a28bca 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * misc.c
- * 
- * This is a collection of several routines from gzip-1.0.3 
+ *
+ * This is a collection of several routines from gzip-1.0.3
  * adapted for Linux.
  *
  * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
@@ -9,6 +9,12 @@
  * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
  */
 
+/*
+ * we have to be careful, because no indirections are allowed here, and
+ * paravirt_ops is a kind of one. As it will only run in baremetal anyway,
+ * we just keep it from happening
+ */
+#undef CONFIG_PARAVIRT
 #define _LINUX_STRING_H_ 1
 #define __LINUX_BITMAP_H 1
 
@@ -16,6 +22,7 @@
 #include <linux/screen_info.h>
 #include <asm/io.h>
 #include <asm/page.h>
+#include <asm/boot.h>
 
 /* WARNING!!
  * This code is compiled with -fPIC and it is relocated dynamically
@@ -25,7 +32,7 @@
 
 /*
  * Getting to provable safe in place decompression is hard.
- * Worst case behaviours need to be analized.
+ * Worst case behaviours need to be analyzed.
  * Background information:
  *
  * The file layout is:
  * Adding 32768 instead of 32767 just makes for round numbers.
  * Adding the decompressor_size is necessary as it musht live after all
  * of the data as well.  Last I measured the decompressor is about 14K.
- * 10K of actuall data and 4K of bss.
+ * 10K of actual data and 4K of bss.
  *
  */
 
@@ -254,7 +261,7 @@ static void putstr(const char *s)
                                y--;
                        }
                } else {
-                       vidmem [ ( x + cols * y ) * 2 ] = c; 
+                       vidmem [(x + cols * y) * 2] = c;
                        if ( ++x >= cols ) {
                                x = 0;
                                if ( ++y >= lines ) {
@@ -269,16 +276,16 @@ static void putstr(const char *s)
        RM_SCREEN_INFO.orig_y = y;
 
        pos = (x + cols * y) * 2;       /* Update cursor position */
-       outb_p(14, vidport);
-       outb_p(0xff & (pos >> 9), vidport+1);
-       outb_p(15, vidport);
-       outb_p(0xff & (pos >> 1), vidport+1);
+       outb(14, vidport);
+       outb(0xff & (pos >> 9), vidport+1);
+       outb(15, vidport);
+       outb(0xff & (pos >> 1), vidport+1);
 }
 
 static void* memset(void* s, int c, unsigned n)
 {
        int i;
-       char *ss = (char*)s;
+       char *ss = s;
 
        for (i=0;i<n;i++) ss[i] = c;
        return s;
@@ -287,7 +294,8 @@ static void* memset(void* s, int c, unsigned n)
 static void* memcpy(void* dest, const void* src, unsigned n)
 {
        int i;
-       char *d = (char *)dest, *s = (char *)src;
+       const char *s = src;
+       char *d = dest;
 
        for (i=0;i<n;i++) d[i] = s[i];
        return dest;
@@ -332,11 +340,13 @@ static void error(char *x)
        putstr(x);
        putstr("\n\n -- System halted");
 
-       while(1);       /* Halt */
+       while (1)
+               asm("hlt");
 }
 
 asmlinkage void decompress_kernel(void *rmode, unsigned long heap,
-       uch *input_data, unsigned long input_len, uch *output)
+                                 uch *input_data, unsigned long input_len,
+                                 uch *output)
 {
        real_mode = rmode;
 
@@ -351,8 +361,8 @@ asmlinkage void decompress_kernel(void *rmode, unsigned long heap,
        lines = RM_SCREEN_INFO.orig_video_lines;
        cols = RM_SCREEN_INFO.orig_video_cols;
 
-       window = output;                /* Output buffer (Normally at 1M) */
-       free_mem_ptr     = heap;        /* Heap  */
+       window = output;                /* Output buffer (Normally at 1M) */
+       free_mem_ptr     = heap;        /* Heap */
        free_mem_end_ptr = heap + HEAP_SIZE;
        inbuf  = input_data;            /* Input buffer */
        insize = input_len;
@@ -364,7 +374,7 @@ asmlinkage void decompress_kernel(void *rmode, unsigned long heap,
                error("Destination address too large");
 
        makecrc();
-       putstr(".\nDecompressing Linux...");
+       putstr("\nDecompressing Linux... ");
        gunzip();
        putstr("done.\nBooting the kernel.\n");
        return;