]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/bios_emulator/biosemu.c
gpio: am43xx: expand gpio support
[karo-tx-uboot.git] / drivers / bios_emulator / biosemu.c
index 4c3aedf4130796f5f166e2fb6d21f212e67159ea..9d4f07c074d33d1e3ad52a5a09164822188004a9 100644 (file)
@@ -3,7 +3,7 @@
 *                       BIOS emulator and interface
 *                     to Realmode X86 Emulator Library
 *
-*  Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+*  Copyright (C) 2007 Freescale Semiconductor, Inc.
 *  Jason Jin <Jason.jin@freescale.com>
 *
 *              Copyright (C) 1996-1999 SciTech Software, Inc.
 *
 ****************************************************************************/
 
-#include "biosemui.h"
 #include <malloc.h>
-
-#if defined(CONFIG_BIOSEMU)
+#include <common.h>
+#include "biosemui.h"
 
 BE_sysEnv _BE_env = {{0}};
-static X86EMU_memFuncs _BE_mem __attribute__((section(".got2"))) = {
+static X86EMU_memFuncs _BE_mem __attribute__((section(GOT2_TYPE))) = {
        BE_rdb,
        BE_rdw,
        BE_rdl,
@@ -60,7 +59,7 @@ static X86EMU_memFuncs _BE_mem __attribute__((section(".got2"))) = {
        BE_wrl,
        };
 
-static X86EMU_pioFuncs _BE_pio __attribute__((section(".got2"))) = {
+static X86EMU_pioFuncs _BE_pio __attribute__((section(GOT2_TYPE))) = {
        BE_inb,
        BE_inw,
        BE_inl,
@@ -94,7 +93,7 @@ int X86API BE_init(u32 debugFlags, int memSize, BE_VGAInfo * info, int shared)
                return 0;
        }
 
-       M.mem_base = (unsigned long)malloc(memSize);
+       M.mem_base = malloc(memSize);
 
        if (M.mem_base == NULL){
                printf("Biosemu:Out of memory!");
@@ -104,7 +103,7 @@ int X86API BE_init(u32 debugFlags, int memSize, BE_VGAInfo * info, int shared)
 
        _BE_env.emulateVGA = 0;
        _BE_env.busmem_base = (unsigned long)malloc(128 * 1024);
-       if (_BE_env.busmem_base == NULL){
+       if ((void *)_BE_env.busmem_base == NULL){
                printf("Biosemu:Out of memory!");
                return 0;
        }
@@ -145,7 +144,8 @@ void X86API BE_setVGA(BE_VGAInfo * info)
                _BE_env.biosmem_base = _BE_env.busmem_base + 0x20000;
                _BE_env.biosmem_limit = 0xC7FFF;
        }
-       if (*((u32 *) info->LowMem) == 0)
+       if ((info->LowMem[0] == 0) && (info->LowMem[1] == 0) &&
+           (info->LowMem[2] == 0) && (info->LowMem[3] == 0))
                _BE_bios_init((u32 *) info->LowMem);
        memcpy((u8 *) M.mem_base, info->LowMem, sizeof(info->LowMem));
 }
@@ -228,7 +228,7 @@ Cleans up and exits the emulator.
 void X86API BE_exit(void)
 {
        free(M.mem_base);
-       free(_BE_env.busmem_base);
+       free((void *)_BE_env.busmem_base);
 }
 
 /****************************************************************************
@@ -370,4 +370,3 @@ int X86API BE_int86x(int intno, RMREGS * in, RMREGS * out, RMSREGS * sregs)
        sregs->gs = M.x86.R_GS;
        return out->x.ax;
 }
-#endif