net: sun8i_emac: Use consistent clock bitfield definitions
[oweals/u-boot.git] / drivers / bios_emulator / bios.c
index 7aa1bfb2eb60e639b57758f0fee3cf39151451d3..77c7f94bc63e1998f959f8c3bdf6ad6c46ef70c1 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.
 *
 * Description:  Module implementing the BIOS specific functions.
 *
-*              Jason ported this file to u-boot to run the ATI video card
-*              video BIOS.
+*              Jason ported this file to u-boot to run the ATI video card
+*              video BIOS.
 *
 ****************************************************************************/
 
+#define __io
+#include <common.h>
+#include <asm/io.h>
 #include "biosemui.h"
 
-#if defined(CONFIG_BIOSEMU)
 /*----------------------------- Implementation ----------------------------*/
 
 /****************************************************************************
@@ -82,14 +84,14 @@ static void X86API int42(int intno)
                        PM_outpb(0x3c2, PM_inpb(0x3cc) & (u8) ~ 0x02);
                        return;
                }
-#ifdef  DEBUG
+#ifdef CONFIG_X86EMU_DEBUG
                else {
                        printf("int42: unknown function AH=0x12, BL=0x32, AL=%#02x\n",
                             M.x86.R_AL);
                }
 #endif
        }
-#ifdef  DEBUG
+#ifdef CONFIG_X86EMU_DEBUG
        else {
                printf("int42: unknown function AH=%#02x, AL=%#02x, BL=%#02x\n",
                     M.x86.R_AH, M.x86.R_AL, M.x86.R_BL);
@@ -183,12 +185,21 @@ static void X86API int1A(int unused)
        case 0xB103:            /* Find PCI class code */
                M.x86.R_AH = DEVICE_NOT_FOUND;
 #ifdef __KERNEL__
+#ifdef CONFIG_DM_PCI
+               dm_pci_read_config8(_BE_env.vgaInfo.pcidev, PCI_CLASS_PROG,
+                                   &interface);
+               dm_pci_read_config8(_BE_env.vgaInfo.pcidev, PCI_CLASS_DEVICE,
+                                   &subclass);
+               dm_pci_read_config8(_BE_env.vgaInfo.pcidev,
+                                   PCI_CLASS_DEVICE + 1, &baseclass);
+#else
                pci_read_config_byte(_BE_env.vgaInfo.pcidev, PCI_CLASS_PROG,
                                     &interface);
                pci_read_config_byte(_BE_env.vgaInfo.pcidev, PCI_CLASS_DEVICE,
                                     &subclass);
                pci_read_config_byte(_BE_env.vgaInfo.pcidev,
                                     PCI_CLASS_DEVICE + 1, &baseclass);
+#endif
                if (M.x86.R_CL == interface && M.x86.R_CH == subclass
                    && (u8) (M.x86.R_ECX >> 16) == baseclass) {
 #else
@@ -207,8 +218,13 @@ static void X86API int1A(int unused)
                if (M.x86.R_BX == pciSlot) {
                        M.x86.R_AH = SUCCESSFUL;
 #ifdef __KERNEL__
+# ifdef CONFIG_DM_PCI
+                       dm_pci_read_config8(_BE_env.vgaInfo.pcidev, M.x86.R_DI,
+                                           &M.x86.R_CL);
+# else
                        pci_read_config_byte(_BE_env.vgaInfo.pcidev, M.x86.R_DI,
                                             &M.x86.R_CL);
+# endif
 #else
                        M.x86.R_CL =
                            (u8) PCI_accessReg(M.x86.R_DI, 0, PCI_READ_BYTE,
@@ -222,8 +238,13 @@ static void X86API int1A(int unused)
                if (M.x86.R_BX == pciSlot) {
                        M.x86.R_AH = SUCCESSFUL;
 #ifdef __KERNEL__
+# ifdef CONFIG_DM_PCI
+                       dm_pci_read_config16(_BE_env.vgaInfo.pcidev, M.x86.R_DI,
+                                            &M.x86.R_CX);
+# else
                        pci_read_config_word(_BE_env.vgaInfo.pcidev, M.x86.R_DI,
                                             &M.x86.R_CX);
+# endif
 #else
                        M.x86.R_CX =
                            (u16) PCI_accessReg(M.x86.R_DI, 0, PCI_READ_WORD,
@@ -237,8 +258,13 @@ static void X86API int1A(int unused)
                if (M.x86.R_BX == pciSlot) {
                        M.x86.R_AH = SUCCESSFUL;
 #ifdef __KERNEL__
+# ifdef CONFIG_DM_PCI
+                       dm_pci_read_config32(_BE_env.vgaInfo.pcidev,
+                                            M.x86.R_DI, &M.x86.R_ECX);
+# else
                        pci_read_config_dword(_BE_env.vgaInfo.pcidev,
                                              M.x86.R_DI, &M.x86.R_ECX);
+# endif
 #else
                        M.x86.R_ECX =
                            (u32) PCI_accessReg(M.x86.R_DI, 0, PCI_READ_DWORD,
@@ -252,8 +278,13 @@ static void X86API int1A(int unused)
                if (M.x86.R_BX == pciSlot) {
                        M.x86.R_AH = SUCCESSFUL;
 #ifdef __KERNEL__
+# ifdef CONFIG_DM_PCI
+                       dm_pci_write_config8(_BE_env.vgaInfo.pcidev,
+                                            M.x86.R_DI, M.x86.R_CL);
+# else
                        pci_write_config_byte(_BE_env.vgaInfo.pcidev,
                                              M.x86.R_DI, M.x86.R_CL);
+# endif
 #else
                        PCI_accessReg(M.x86.R_DI, M.x86.R_CL, PCI_WRITE_BYTE,
                                      _BE_env.vgaInfo.pciInfo);
@@ -266,8 +297,13 @@ static void X86API int1A(int unused)
                if (M.x86.R_BX == pciSlot) {
                        M.x86.R_AH = SUCCESSFUL;
 #ifdef __KERNEL__
+# ifdef CONFIG_DM_PCI
+                       dm_pci_write_config32(_BE_env.vgaInfo.pcidev,
+                                             M.x86.R_DI, M.x86.R_CX);
+# else
                        pci_write_config_word(_BE_env.vgaInfo.pcidev,
                                              M.x86.R_DI, M.x86.R_CX);
+# endif
 #else
                        PCI_accessReg(M.x86.R_DI, M.x86.R_CX, PCI_WRITE_WORD,
                                      _BE_env.vgaInfo.pciInfo);
@@ -280,8 +316,13 @@ static void X86API int1A(int unused)
                if (M.x86.R_BX == pciSlot) {
                        M.x86.R_AH = SUCCESSFUL;
 #ifdef __KERNEL__
+# ifdef CONFIG_DM_PCI
+                       dm_pci_write_config32(_BE_env.vgaInfo.pcidev,
+                                             M.x86.R_DI, M.x86.R_ECX);
+# else
                        pci_write_config_dword(_BE_env.vgaInfo.pcidev,
                                               M.x86.R_DI, M.x86.R_ECX);
+# endif
 #else
                        PCI_accessReg(M.x86.R_DI, M.x86.R_ECX, PCI_WRITE_DWORD,
                                      _BE_env.vgaInfo.pciInfo);
@@ -320,4 +361,3 @@ void _BE_bios_init(u32 * intrTab)
        bios_intr_tab[0x6D] = int10;
        X86EMU_setupIntrFuncs(bios_intr_tab);
 }
-#endif