]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/bios_emulator/atibios.c
Merge branch 'u-boot-imx/master' into 'u-boot-arm/master'
[karo-tx-uboot.git] / drivers / bios_emulator / atibios.c
index 5f9bd101d6c685cad2c5b8219cdd46361bb5a7a2..3b2ed6e109b645359c0edb9e0fe0f1ddd0b7c507 100644 (file)
 /* Length of the BIOS image */
 #define MAX_BIOSLEN        (128 * 1024L)
 
-/* Define some useful types and macros */
-#define true               1
-#define false              0
-
 /* Place to save PCI BAR's that we change and later restore */
 static u32 saveROMBaseAddress;
 static u32 saveBaseAddress10;
@@ -173,7 +169,7 @@ Maps a pointer to the BIOS image on the graphics card on the PCI bus.
 ****************************************************************************/
 void *PCI_mapBIOSImage(pci_dev_t pcidev)
 {
-       u32 BIOSImagePhys;
+       u32 BIOSImageBus;
        int BIOSImageBAR;
        u8 *BIOSImage;
 
@@ -195,16 +191,18 @@ void *PCI_mapBIOSImage(pci_dev_t pcidev)
         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);
 
@@ -240,7 +238,7 @@ 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
@@ -293,7 +291,7 @@ static int PCI_postController(pci_dev_t pcidev, BE_VGAInfo * VGAInfo)
 PARAMETERS:
 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
@@ -315,7 +313,8 @@ int BootVideoCardBIOS(pci_dev_t pcidev, BE_VGAInfo ** pVGAInfo, int cleanUp)
        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