Merge tag 'ti-v2020.07-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
[oweals/u-boot.git] / arch / x86 / lib / bios.c
index 1d75cfc263c383eb64a98d4d9b894ff031dd8736..3ab432e2623c437488a8516ba06f546e134e903e 100644 (file)
@@ -1,13 +1,14 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * From Coreboot file device/oprom/realmode/x86.c
  *
  * Copyright (C) 2007 Advanced Micro Devices, Inc.
  * Copyright (C) 2009-2010 coresystems GmbH
- *
- * SPDX-License-Identifier:    GPL-2.0
  */
 #include <common.h>
 #include <bios_emul.h>
+#include <irq_func.h>
+#include <log.h>
 #include <vbe.h>
 #include <linux/linkage.h>
 #include <asm/cache.h>
@@ -157,7 +158,7 @@ static void setup_realmode_idt(void)
         for (i = 0; i < 256; i++) {
                idts[i].cs = 0;
                idts[i].offset = 0x1000 + (i * __idt_handler_size);
-               write_idt_stub((void *)((u32)idts[i].offset), i);
+               write_idt_stub((void *)((ulong)idts[i].offset), i);
        }
 
        /*
@@ -185,6 +186,7 @@ static void setup_realmode_idt(void)
        write_idt_stub((void *)0xffe6e, 0x1a);
 }
 
+#ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
 static u8 vbe_get_mode_info(struct vbe_mode_info *mi)
 {
        u16 buffer_seg;
@@ -227,7 +229,7 @@ static void vbe_set_graphics(int vesa_mode, struct vbe_mode_info *mode_info)
        mode_info->video_mode = (1 << 14) | vesa_mode;
        vbe_get_mode_info(mode_info);
 
-       framebuffer = (unsigned char *)mode_info->vesa.phys_base_ptr;
+       framebuffer = (unsigned char *)(ulong)mode_info->vesa.phys_base_ptr;
        debug("VBE: resolution:  %dx%d@%d\n",
              le16_to_cpu(mode_info->vesa.x_resolution),
              le16_to_cpu(mode_info->vesa.y_resolution),
@@ -241,10 +243,12 @@ static void vbe_set_graphics(int vesa_mode, struct vbe_mode_info *mode_info)
        mode_info->video_mode &= 0x3ff;
        vbe_set_mode(mode_info);
 }
+#endif /* CONFIG_FRAMEBUFFER_SET_VESA_MODE */
 
-void bios_run_on_x86(pci_dev_t pcidev, unsigned long addr, int vesa_mode,
+void bios_run_on_x86(struct udevice *dev, unsigned long addr, int vesa_mode,
                     struct vbe_mode_info *mode_info)
 {
+       pci_dev_t pcidev = dm_pci_get_bdf(dev);
        u32 num_dev;
 
        num_dev = PCI_BUS(pcidev) << 8 | PCI_DEV(pcidev) << 3 |
@@ -272,8 +276,10 @@ void bios_run_on_x86(pci_dev_t pcidev, unsigned long addr, int vesa_mode,
                      0x0);
        debug("done\n");
 
+#ifdef CONFIG_FRAMEBUFFER_SET_VESA_MODE
        if (vesa_mode != -1)
                vbe_set_graphics(vesa_mode, mode_info);
+#endif
 }
 
 asmlinkage int interrupt_handler(u32 intnumber, u32 gsfs, u32 dses,