/****************************************************************************
*
-* Video BOOT Graphics Card POST Module
+* Video BOOT Graphics Card POST Module
*
* ========================================================================
-* Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
+* Copyright (C) 2007 Freescale Semiconductor, Inc.
* Jason Jin <Jason.jin@freescale.com>
*
* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
*
* ========================================================================
*
-* Language: ANSI C
-* Environment: Linux Kernel
-* Developer: Kendall Bennett
+* Language: ANSI C
+* Environment: Linux Kernel
+* Developer: Kendall Bennett
*
-* Description: Module to implement booting PCI/AGP controllers on the
-* bus. We use the x86 real mode emulator to run the BIOS on
-* graphics controllers to bring the cards up.
+* Description: Module to implement booting PCI/AGP controllers on the
+* bus. We use the x86 real mode emulator to run the BIOS on
+* graphics controllers to bring the cards up.
*
-* Note that at present this module does *not* support
-* multiple controllers.
+* Note that at present this module does *not* support
+* multiple controllers.
*
-* The orignal name of this file is warmboot.c.
-* Jason ported this file to u-boot to run the ATI video card
-* BIOS in u-boot.
+* The orignal name of this file is warmboot.c.
+* Jason ported this file to u-boot to run the ATI video card
+* BIOS in u-boot.
****************************************************************************/
#include <common.h>
-
-#ifdef CONFIG_BIOSEMU
-
#include "biosemui.h"
#include <malloc.h>
/* Length of the BIOS image */
-#define MAX_BIOSLEN (128 * 1024L)
-
-/* Define some useful types and macros */
-#define true 1
-#define false 0
+#define MAX_BIOSLEN (128 * 1024L)
/* Place to save PCI BAR's that we change and later restore */
static u32 saveROMBaseAddress;
/****************************************************************************
PARAMETERS:
-pcidev - PCI device info for the video card on the bus to boot
+pcidev - PCI device info for the video card on the bus to boot
VGAInfo - BIOS emulator VGA info structure
REMARKS:
/****************************************************************************
PARAMETERS:
-pcidev - PCI device info for the video card on the bus
-bar - Place to return the base address register offset to use
+pcidev - PCI device info for the video card on the bus
+bar - Place to return the base address register offset to use
RETURNS:
The address to use to map the secondary BIOS (AGP devices)
/****************************************************************************
PARAMETERS:
-pcidev - PCI device info for the video card on the bus
+pcidev - PCI device info for the video card on the bus
RETURNS:
Pointers to the mapped BIOS image
****************************************************************************/
void *PCI_mapBIOSImage(pci_dev_t pcidev)
{
- u32 BIOSImagePhys;
+ u32 BIOSImageBus;
int BIOSImageBAR;
u8 *BIOSImage;
/* Some cards have problems that stop us from being able to read the
BIOS image from the ROM BAR. To fix this we have to do some chipset
specific programming for different cards to solve this problem.
- */
+ */
- if ((BIOSImagePhys = PCI_findBIOSAddr(pcidev, &BIOSImageBAR)) == 0) {
+ BIOSImageBus = PCI_findBIOSAddr(pcidev, &BIOSImageBAR);
+ if (BIOSImageBus == 0) {
printf("Find bios addr error\n");
return NULL;
}
- BIOSImage = (u8 *) BIOSImagePhys;
+ BIOSImage = pci_bus_to_virt(pcidev, BIOSImageBus,
+ PCI_REGION_MEM, 0, MAP_NOCACHE);
/*Change the PCI BAR registers to map it onto the bus.*/
pci_write_config_dword(pcidev, BIOSImageBAR, 0);
- pci_write_config_dword(pcidev, PCI_ROM_ADDRESS, BIOSImagePhys | 0x1);
+ pci_write_config_dword(pcidev, PCI_ROM_ADDRESS, BIOSImageBus | 0x1);
udelay(1);
/****************************************************************************
PARAMETERS:
-pcidev - PCI device info for the video card on the bus
+pcidev - PCI device info for the video card on the bus
REMARKS:
Unmaps the BIOS image for the device and restores framebuffer mappings
/****************************************************************************
PARAMETERS:
-pcidev - PCI device info for the video card on the bus to boot
+pcidev - PCI device info for the video card on the bus to boot
VGAInfo - BIOS emulator VGA info structure
RETURNS:
-True if successfully initialised, false if not.
+true if successfully initialised, false if not.
REMARKS:
Loads and POST's the display controllers BIOS, directly from the BIOS
/****************************************************************************
PARAMETERS:
-pcidev - PCI device info for the video card on the bus to boot
+pcidev - PCI device info for the video card on the bus to boot
pVGAInfo - Place to return VGA info structure is requested
-cleanUp - True to clean up on exit, false to leave emulator active
+cleanUp - true to clean up on exit, false to leave emulator active
REMARKS:
Boots the PCI/AGP video card on the bus using the Video ROM BIOS image
BE_init(0, 65536, VGAInfo, 0);
/*Post all the display controller BIOS'es*/
- PCI_postController(pcidev, VGAInfo);
+ if (!PCI_postController(pcidev, VGAInfo))
+ return false;
/*Cleanup and exit the emulator if requested. If the BIOS emulator
is needed after booting the card, we will not call BE_exit and
*pVGAInfo = VGAInfo;
return true;
}
-
-#endif