x86: ivybridge: Add graphics support
Subsystems (5)
cover x86: ivybridge: Add graphics support
This series adds a graphics driver and support for execution of the VGA option ROM. This option ROM is required on ivybridge for the graphics to work, at least until someone creates the equivalent source code.
Option ROMs can be run using U-Boot's BIOS emulator, but on x86 it is also possible to run then natively. This is something of a pain to arrange due to all the environment that is required (16-bit to 32-bit calls, etc.) but it can be done, so this series adds that feature too.
Video mode selection is useful as it allows different resolutions to be selected. This series adds support for VESA modes and a way of selecting the mode to use in U-Boot.
These options are enabled for chromebook_link, which now boots to a prompt complete with a functioning LCD. A resolution 0f 1280x1024 is selected by default.
While the Chrome OS EC works correctly, the keyboard does not as yet. Also U-Boot is currently very slow, taking about 2 seconds to boot to a prompt when video is enabled. These problems will be the subject of future work.
Simon Glass (19):
x86: Add a definition of asmlinkage
Introduce a header file for the BIOS emulator
x86: Add GDT descriptors for option ROMs
x86: Add vesa mode configuration options
Add support for Vesa BIOS extensions
x86: Add support for running option ROMs natively
pci: Add general support for execution of video ROMs
x86: video: Add video driver for bare x86 boards
x86: Allow an option ROM to be built into U-Boot
x86: Add initial video device init for Intel GMA
x86: dts: Add video information to the device tree
x86: config: Enable video support for chromebook_link
bios_emulator: Allow x86 to use the emulator
bios_emulator: Add vesa support and allow ROMs to be passed in as data
bios_emulator: Allow a custom interrupt handler to be installed
bios_emulator: Add an option to enable debugging
bios_emulator: Always print errors when opcode decode fails
x86: chromebook_link: Enable the x86 emulator
x86: chromebook_link: Enable the Chrome OS EC
Makefile | 3 + arch/x86/Kconfig | 149 +++++ arch/x86/cpu/cpu.c | 9 +- arch/x86/cpu/ivybridge/Makefile | 1 + arch/x86/cpu/ivybridge/bd82x6x.c | 13 +- arch/x86/cpu/ivybridge/gma.c | 756 ++++++++++++++++++++++++++ arch/x86/cpu/ivybridge/gma.h | 157 ++++++ arch/x86/dts/link.dts | 13 + arch/x86/include/asm/arch-ivybridge/bd82x6x.h | 2 + arch/x86/include/asm/processor.h | 31 +- arch/x86/lib/Makefile | 3 + arch/x86/lib/bios.c | 348 ++++++++++++ arch/x86/lib/bios.h | 98 ++++ arch/x86/lib/bios_asm.S | 281 ++++++++++ arch/x86/lib/bios_interrupts.c | 219 ++++++++ board/google/chromebook_link/link.c | 4 + doc/device-tree-bindings/video/intel-gma.txt | 40 ++ drivers/bios_emulator/Makefile | 2 +- drivers/bios_emulator/atibios.c | 198 +++++-- drivers/bios_emulator/besys.c | 100 ++-- drivers/bios_emulator/bios.c | 4 +- drivers/bios_emulator/biosemui.h | 2 +- drivers/bios_emulator/include/biosemu.h | 53 +- drivers/bios_emulator/include/x86emu.h | 7 +- drivers/bios_emulator/include/x86emu/debug.h | 20 +- drivers/bios_emulator/include/x86emu/regs.h | 2 +- drivers/bios_emulator/x86emu/debug.c | 10 +- drivers/bios_emulator/x86emu/decode.c | 24 +- drivers/bios_emulator/x86emu/ops.c | 58 +- drivers/bios_emulator/x86emu/ops2.c | 4 +- drivers/bios_emulator/x86emu/sys.c | 5 + drivers/pci/Makefile | 2 +- drivers/pci/pci_rom.c | 276 ++++++++++ drivers/video/Makefile | 1 + drivers/video/ati_radeon_fb.c | 2 +- drivers/video/x86_fb.c | 37 ++ include/bios_emul.h | 65 +++ include/common.h | 3 + include/configs/chromebook_link.h | 19 +- include/fdtdec.h | 1 + include/pci_rom.h | 58 ++ include/vbe.h | 103 ++++ include/video_fb.h | 2 +- lib/fdtdec.c | 1 + 44 files changed, 2950 insertions(+), 236 deletions(-) create mode 100644 arch/x86/cpu/ivybridge/gma.c create mode 100644 arch/x86/cpu/ivybridge/gma.h create mode 100644 arch/x86/lib/bios.c create mode 100644 arch/x86/lib/bios.h create mode 100644 arch/x86/lib/bios_asm.S create mode 100644 arch/x86/lib/bios_interrupts.c create mode 100644 doc/device-tree-bindings/video/intel-gma.txt create mode 100644 drivers/pci/pci_rom.c create mode 100644 drivers/video/x86_fb.c create mode 100644 include/bios_emul.h create mode 100644 include/pci_rom.h create mode 100644 include/vbe.h
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 1/19 x86: Add a definition of asmlinkage
This is needed to permit calling C from assembler without too much pain. Add a definition for x86.
---
include/common.h | 3 +++ 1 file changed, 3 insertions(+)
include/common.h +3 -0
@@ -72,6 +72,9 @@ typedef volatile unsigned char vu_char;#ifdef CONFIG_ARM #define asmlinkage/* nothing */ #endif +#ifdef CONFIG_X86 +#define asmlinkage __attribute__((regparm(0))) +#endif #ifdef CONFIG_BLACKFIN #include <asm/blackfin.h> #endif
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 1/19 x86: Add a definition of asmlinkage
Quoted 8 lines · Simon Glass
This is needed to permit calling C from assembler without too much pain. Add a definition for x86.
Signed-off-by Simon Glass <[email protected]>---
include/common.h | 3 +++ 1 file changed, 3 insertions(+)
Applied to u-boot-x86.
PATCH 2/19 Introduce a header file for the BIOS emulator
In reply to Simon GlassWe should have a public header so that users can avoid defining functions themselves.
---
drivers/bios_emulator/include/biosemu.h | 53 ++------------------------------- drivers/video/ati_radeon_fb.c | 2 +- include/bios_emul.h | 43 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 52 deletions(-) create mode 100644 include/bios_emul.h
drivers/bios_emulator/include/biosemu.h +2 -51
@@ -43,6 +43,8 @@#ifndef __BIOSEMU_H#define __BIOSEMU_H +#include <bios_emul.h> +#ifdef __KERNEL__#include "x86emu.h" #else
@@ -55,57 +57,6 @@#pragma pack(1) -#ifndef __KERNEL__ -/**************************************************************************** -REMARKS: -Data structure used to describe the details specific to a particular VGA -controller. This information is used to allow the VGA controller to be -swapped on the fly within the BIOS emulator. - -HEADER: -biosemu.h - -MEMBERS: -pciInfo - PCI device information block for the controller -BIOSImage - Pointer to a read/write copy of the BIOS image -BIOSImageLen - Length of the BIOS image -LowMem - Copy of key low memory areas -****************************************************************************/ -typedef struct { -PCIDeviceInfo *pciInfo; -void *BIOSImage; -ulong BIOSImageLen; -uchar LowMem[1536 ]; -}BE_VGAInfo ; -#else -/**************************************************************************** -REMARKS: -Data structure used to describe the details for the BIOS emulator system -environment as used by the X86 emulator library. - -HEADER: -biosemu.h - -MEMBERS: -vgaInfo - VGA BIOS information structure -biosmem_base - Base of the BIOS image -biosmem_limit - Limit of the BIOS image -busmem_base - Base of the VGA bus memory -****************************************************************************/ -typedef struct { -int function; -int device; -int bus; -u32 VendorID; -u32 DeviceID; -pci_dev_t pcidev; -void *BIOSImage; -u32 BIOSImageLen; -u8 LowMem[1536 ]; -}BE_VGAInfo ; - -#endif /* __KERNEL__ */ -#define CRT_C 24/* 24 CRT Controller Registers */ #define ATT_C 21/* 21 Attribute Controller Registers */ #define GRA_C 9/* 9 Graphics Controller Registers */
drivers/video/ati_radeon_fb.c +1 -1
@@ -19,6 +19,7 @@#include <common.h> #include <command.h> +#include <bios_emul.h> #include <pci.h> #include <asm/processor.h> #include <asm/errno.h>
@@ -549,7 +550,6 @@ void radeon_setmode_9200(int vesa_idx, int bpp) }#include "../bios_emulator/include/biosemu.h" -extern int BootVideoCardBIOS (pci_dev_t pcidev,BE_VGAInfo ** pVGAInfo,int cleanUp);int radeon_probe (struct radeonfb_info *rinfo) {
include/bios_emul.h new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 2/19 Introduce a header file for the BIOS emulator
Quoted 11 lines · Simon Glass
We should have a public header so that users can avoid defining functions themselves.
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/include/biosemu.h | 53 ++------------------------------- drivers/video/ati_radeon_fb.c | 2 +- include/bios_emul.h | 43 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 52 deletions(-) create mode 100644 include/bios_emul.h
Applied to u-boot-x86.
PATCH 3/19 x86: Add GDT descriptors for option ROMs
In reply to Simon GlassOption ROMs require a few additional descriptors. Add these, and remove the enum since we now have to access several descriptors from assembler.
---
arch/x86/cpu/cpu.c | 9 ++++++--- arch/x86/include/asm/processor.h | 31 ++++++++++++------------------- 2 files changed, 18 insertions(+), 22 deletions(-)
arch/x86/cpu/cpu.c +6 -3
@@ -124,7 +124,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries) {struct gdt_ptr gdt; - gdt.len = (num_entries *8 ) -1 ; + gdt.len = (num_entries *X86_GDT_ENTRY_SIZE ) -1 ; gdt.ptr = (u32 )boot_gdt; asmvolatile ("lgdtl %0\n" : :"m" (gdt));
@@ -144,10 +144,13 @@ void setup_gdt(gd_t *id, u64 *gdt_addr) (ulong)&id->arch.gd_addr, 0xfffff);/* 16-bit CS: code, read/execute, 64 kB, base 0 */ - gdt_addr[X86_GDT_ENTRY_16BIT_CS ] =GDT_ENTRY (0x109b ,0 ,0x0ffff ); + gdt_addr[X86_GDT_ENTRY_16BIT_CS ] =GDT_ENTRY (0x009b ,0 ,0x0ffff );/* 16-bit DS: data, read/write, 64 kB, base 0 */ - gdt_addr[X86_GDT_ENTRY_16BIT_DS ] =GDT_ENTRY (0x1093 ,0 ,0x0ffff ); + gdt_addr[X86_GDT_ENTRY_16BIT_DS ] =GDT_ENTRY (0x0093 ,0 ,0x0ffff ); + + gdt_addr[X86_GDT_ENTRY_16BIT_FLAT_CS ] =GDT_ENTRY (0x809b ,0 ,0xfffff ); + gdt_addr[X86_GDT_ENTRY_16BIT_FLAT_DS ] =GDT_ENTRY (0x8093 ,0 ,0xfffff );load_gdt (gdt_addr,X86_GDT_NUM_ENTRIES );load_ds (X86_GDT_ENTRY_32BIT_DS );
arch/x86/include/asm/processor.h +12 -19
@@ -8,25 +8,18 @@#ifndef __ASM_PROCESSOR_H_#define __ASM_PROCESSOR_H_ 1 -#define X86_GDT_ENTRY_SIZE 8 - -#ifndef __ASSEMBLY__ - -enum { -X86_GDT_ENTRY_NULL =0 , -X86_GDT_ENTRY_UNUSED , -X86_GDT_ENTRY_32BIT_CS , -X86_GDT_ENTRY_32BIT_DS , -X86_GDT_ENTRY_32BIT_FS , -X86_GDT_ENTRY_16BIT_CS , -X86_GDT_ENTRY_16BIT_DS , -X86_GDT_NUM_ENTRIES -}; -#else -/* NOTE: If the above enum is modified, this define must be checked */ -#define X86_GDT_ENTRY_32BIT_DS 3 -#define X86_GDT_NUM_ENTRIES 7 -#endif +#define X86_GDT_ENTRY_SIZE 8 + +#define X86_GDT_ENTRY_NULL 0 +#define X86_GDT_ENTRY_UNUSED 1 +#define X86_GDT_ENTRY_32BIT_CS 2 +#define X86_GDT_ENTRY_32BIT_DS 3 +#define X86_GDT_ENTRY_32BIT_FS 4 +#define X86_GDT_ENTRY_16BIT_CS 5 +#define X86_GDT_ENTRY_16BIT_DS 6 +#define X86_GDT_ENTRY_16BIT_FLAT_CS 7 +#define X86_GDT_ENTRY_16BIT_FLAT_DS 8 +#define X86_GDT_NUM_ENTRIES 9#define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE)
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 3/19 x86: Add GDT descriptors for option ROMs
Quoted 9 lines · Simon Glass
Option ROMs require a few additional descriptors. Add these, and remove the enum since we now have to access several descriptors from assembler.
Signed-off-by Simon Glass <[email protected]>---
arch/x86/cpu/cpu.c | 9 ++++++--- arch/x86/include/asm/processor.h | 31 ++++++++++++------------------- 2 files changed, 18 insertions(+), 22 deletions(-)
Applied to u-boot-x86.
PATCH 4/19 x86: Add vesa mode configuration options
In reply to Simon GlassAdd Kconfig options to allow selection of a vesa mode on x86 machines.
---
arch/x86/Kconfig | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+)
arch/x86/Kconfig +149 -0
@@ -83,6 +83,155 @@ config X86_RAMTEST to work correctly. It is not exhaustive but can save time by detecting obvious failures. +config MARK_GRAPHICS_MEM_WRCOMB + bool "Mark graphics memory as write-combining." + default n + help + The graphics performance may increase if the graphics + memory is set as write-combining cache type. This option + enables marking the graphics memory as write-combining. + +menu "Display" + +config FRAMEBUFFER_SET_VESA_MODE + prompt "Set framebuffer graphics resolution" + bool + help + Set VESA/native framebuffer mode (needed for bootsplash and graphical framebuffer console) + +choice + prompt "framebuffer graphics resolution" + default FRAMEBUFFER_VESA_MODE_117 + depends on FRAMEBUFFER_SET_VESA_MODE + help + This option sets the resolution used for the coreboot framebuffer (and + bootsplash screen). + +config FRAMEBUFFER_VESA_MODE_100 + bool "640x400 256-color" + +config FRAMEBUFFER_VESA_MODE_101 + bool "640x480 256-color" + +config FRAMEBUFFER_VESA_MODE_102 + bool "800x600 16-color" + +config FRAMEBUFFER_VESA_MODE_103 + bool "800x600 256-color" + +config FRAMEBUFFER_VESA_MODE_104 + bool "1024x768 16-color" + +config FRAMEBUFFER_VESA_MODE_105 + bool "1024x7686 256-color" + +config FRAMEBUFFER_VESA_MODE_106 + bool "1280x1024 16-color" + +config FRAMEBUFFER_VESA_MODE_107 + bool "1280x1024 256-color" + +config FRAMEBUFFER_VESA_MODE_108 + bool "80x60 text" + +config FRAMEBUFFER_VESA_MODE_109 + bool "132x25 text" + +config FRAMEBUFFER_VESA_MODE_10A + bool "132x43 text" + +config FRAMEBUFFER_VESA_MODE_10B + bool "132x50 text" + +config FRAMEBUFFER_VESA_MODE_10C + bool "132x60 text" + +config FRAMEBUFFER_VESA_MODE_10D + bool "320x200 32k-color (1:5:5:5)" + +config FRAMEBUFFER_VESA_MODE_10E + bool "320x200 64k-color (5:6:5)" + +config FRAMEBUFFER_VESA_MODE_10F + bool "320x200 16.8M-color (8:8:8)" + +config FRAMEBUFFER_VESA_MODE_110 + bool "640x480 32k-color (1:5:5:5)" + +config FRAMEBUFFER_VESA_MODE_111 + bool "640x480 64k-color (5:6:5)" + +config FRAMEBUFFER_VESA_MODE_112 + bool "640x480 16.8M-color (8:8:8)" + +config FRAMEBUFFER_VESA_MODE_113 + bool "800x600 32k-color (1:5:5:5)" + +config FRAMEBUFFER_VESA_MODE_114 + bool "800x600 64k-color (5:6:5)" + +config FRAMEBUFFER_VESA_MODE_115 + bool "800x600 16.8M-color (8:8:8)" + +config FRAMEBUFFER_VESA_MODE_116 + bool "1024x768 32k-color (1:5:5:5)" + +config FRAMEBUFFER_VESA_MODE_117 + bool "1024x768 64k-color (5:6:5)" + +config FRAMEBUFFER_VESA_MODE_118 + bool "1024x768 16.8M-color (8:8:8)" + +config FRAMEBUFFER_VESA_MODE_119 + bool "1280x1024 32k-color (1:5:5:5)" + +config FRAMEBUFFER_VESA_MODE_11A + bool "1280x1024 64k-color (5:6:5)" + +config FRAMEBUFFER_VESA_MODE_11B + bool "1280x1024 16.8M-color (8:8:8)" + +config FRAMEBUFFER_VESA_MODE_USER + bool "Manually select VESA mode" + +endchoice + +# Map the config names to an integer (KB). +config FRAMEBUFFER_VESA_MODE + prompt "VESA mode" if FRAMEBUFFER_VESA_MODE_USER + hex + default 0x100 if FRAMEBUFFER_VESA_MODE_100 + default 0x101 if FRAMEBUFFER_VESA_MODE_101 + default 0x102 if FRAMEBUFFER_VESA_MODE_102 + default 0x103 if FRAMEBUFFER_VESA_MODE_103 + default 0x104 if FRAMEBUFFER_VESA_MODE_104 + default 0x105 if FRAMEBUFFER_VESA_MODE_105 + default 0x106 if FRAMEBUFFER_VESA_MODE_106 + default 0x107 if FRAMEBUFFER_VESA_MODE_107 + default 0x108 if FRAMEBUFFER_VESA_MODE_108 + default 0x109 if FRAMEBUFFER_VESA_MODE_109 + default 0x10A if FRAMEBUFFER_VESA_MODE_10A + default 0x10B if FRAMEBUFFER_VESA_MODE_10B + default 0x10C if FRAMEBUFFER_VESA_MODE_10C + default 0x10D if FRAMEBUFFER_VESA_MODE_10D + default 0x10E if FRAMEBUFFER_VESA_MODE_10E + default 0x10F if FRAMEBUFFER_VESA_MODE_10F + default 0x110 if FRAMEBUFFER_VESA_MODE_110 + default 0x111 if FRAMEBUFFER_VESA_MODE_111 + default 0x112 if FRAMEBUFFER_VESA_MODE_112 + default 0x113 if FRAMEBUFFER_VESA_MODE_113 + default 0x114 if FRAMEBUFFER_VESA_MODE_114 + default 0x115 if FRAMEBUFFER_VESA_MODE_115 + default 0x116 if FRAMEBUFFER_VESA_MODE_116 + default 0x117 if FRAMEBUFFER_VESA_MODE_117 + default 0x118 if FRAMEBUFFER_VESA_MODE_118 + default 0x119 if FRAMEBUFFER_VESA_MODE_119 + default 0x11A if FRAMEBUFFER_VESA_MODE_11A + default 0x11B if FRAMEBUFFER_VESA_MODE_11B + default 0x117 if FRAMEBUFFER_VESA_MODE_USER + +endmenu + source "arch/x86/cpu/ivybridge/Kconfig" source "board/coreboot/coreboot/Kconfig"
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 4/19 x86: Add vesa mode configuration options
Quoted 7 lines · Simon Glass
Add
Kconfigoptions to allow selection of a vesa mode on x86 machines.Signed-off-by Simon Glass <[email protected]>---
arch/x86/Kconfig | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+)
Applied to u-boot-x86.
PATCH 5/19 Add support for Vesa BIOS extensions
In reply to Simon GlassFor option ROMs we can use these extensions to request a particular video mode. Add a header file which defines the binary interface.
---
include/vbe.h | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 include/vbe.h
include/vbe.h new file +103 -0
@@ -0,0 +1,103 @@ +/****************************************************************************** +* Copyright (c) 2004, 2008 IBM Corporation +* Copyright (c) 2009 Pattrick Hueper <[email protected]> +* All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause +* +* Contributors: +* IBM Corporation - initial implementation +*****************************************************************************/ +#ifndef _VBE_H +#define _VBE_H + +/* these structs are for input from and output to OF */ +struct __packed screen_info { +u8 display_type;/* 0=NONE, 1= analog, 2=digital */ +u16 screen_width; +u16 screen_height; +/* bytes per line in framebuffer, may be more than screen_width */ +u16 screen_linebytes; +u8 color_depth;/* color depth in bits per pixel */ +u32 framebuffer_address; +u8 edid_block_zero[128 ]; +}; + +struct __packed screen_info_input { +u8 signature[4 ]; +u16 size_reserved; +u8 monitor_number; +u16 max_screen_width; +u8 color_depth; +}; + +/* these structs only store the required a subset of the VBE-defined fields */ +struct __packed vbe_info { +char signature[4 ]; +u16 version; +u8 *oem_string_ptr; +u32 capabilities; +u16 video_mode_list[256 ]; +u16 total_memory; +}; + +struct __packed vesa_mode_info { +u16 mode_attributes;/* 00 */ +u8 win_a_attributes;/* 02 */ +u8 win_b_attributes;/* 03 */ +u16 win_granularity;/* 04 */ +u16 win_size;/* 06 */ +u16 win_a_segment;/* 08 */ +u16 win_b_segment;/* 0a */ +u32 win_func_ptr;/* 0c */ +u16 bytes_per_scanline;/* 10 */ +u16 x_resolution;/* 12 */ +u16 y_resolution;/* 14 */ +u8 x_charsize;/* 16 */ +u8 y_charsize;/* 17 */ +u8 number_of_planes;/* 18 */ +u8 bits_per_pixel;/* 19 */ +u8 number_of_banks;/* 20 */ +u8 memory_model;/* 21 */ +u8 bank_size;/* 22 */ +u8 number_of_image_pages;/* 23 */ +u8 reserved_page; +u8 red_mask_size; +u8 red_mask_pos; +u8 green_mask_size; +u8 green_mask_pos; +u8 blue_mask_size; +u8 blue_mask_pos; +u8 reserved_mask_size; +u8 reserved_mask_pos; +u8 direct_color_mode_info; +u32 phys_base_ptr; +u32 offscreen_mem_offset; +u16 offscreen_mem_size; +u8 reserved[206 ]; +}; + +struct vbe_mode_info { +u16 video_mode; +bool valid; +union { +struct vesa_mode_info vesa; +u8 mode_info_block[256 ]; + }; +}; + +struct vbe_ddc_info { +u8 port_number;/* i.e. monitor number */ +u8 edid_transfer_time; +u8 ddc_level; +u8 edid_block_zero[128 ]; +}; + +#define VESA_GET_INFO 0x4f00 +#define VESA_GET_MODE_INFO 0x4f01 +#define VESA_SET_MODE 0x4f02 + +struct graphic_device ; +int vbe_get_video_info (struct graphic_device *gdev); + +#endif
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 5/19 Add support for Vesa BIOS extensions
Quoted 9 lines · Simon Glass
For option ROMs we can use these extensions to request a particular video mode. Add a header file which defines the binary interface.
Signed-off-by Simon Glass <[email protected]>---
include/vbe.h | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 include/vbe.h
Applied to u-boot-x86.
PATCH 6/19 x86: Add support for running option ROMs natively
In reply to Simon GlassOn x86 machines we can use an emulator to run option ROMS as with other architectures. But with some additional effort (mostly due to the 16-bit nature of option ROMs) we can run them natively. Add support for this.
---
arch/x86/lib/Makefile | 3 + arch/x86/lib/bios.c | 348 +++++++++++++++++++++++++++++++++++++++++ arch/x86/lib/bios.h | 98 ++++++++++++ arch/x86/lib/bios_asm.S | 281 +++++++++++++++++++++++++++++++++ arch/x86/lib/bios_interrupts.c | 219 ++++++++++++++++++++++++++ 5 files changed, 949 insertions(+) create mode 100644 arch/x86/lib/bios.c create mode 100644 arch/x86/lib/bios.h create mode 100644 arch/x86/lib/bios_asm.S create mode 100644 arch/x86/lib/bios_interrupts.c
arch/x86/lib/Makefile +3 -0
@@ -5,6 +5,9 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-y += bios.o +obj-y += bios_asm.o +obj-y += bios_interrupts.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-y += cmd_boot.o obj-y += gcc.o
arch/x86/lib/bios.c new file +348 -0
348 lines not on this page · raw message
arch/x86/lib/bios.h new file +98 -0
98 lines not on this page · raw message
arch/x86/lib/bios_asm.S new file +281 -0
281 lines not on this page · raw message
arch/x86/lib/bios_interrupts.c new file +219 -0
219 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 6/19 x86: Add support for running option ROMs natively
Quoted 7 lines · Simon Glass
On x86 machines we can use an emulator to run option ROMS as with other architectures. But with some additional effort (mostly due to the 16-bit nature of option ROMs) we can run them natively. Add support for this.
Signed-off-by Simon Glass <[email protected]>---
Quoted 10 lines
arch/x86/lib/Makefile | 3 + arch/x86/lib/bios.c | 348 +++++++++++++++++++++++++++++++++++++++++ arch/x86/lib/bios.h | 98 ++++++++++++ arch/x86/lib/bios_asm.S | 281 +++++++++++++++++++++++++++++++++ arch/x86/lib/bios_interrupts.c | 219 ++++++++++++++++++++++++++ 5 files changed, 949 insertions(+) create mode 100644 arch/x86/lib/bios.c create mode 100644 arch/x86/lib/bios.h create mode 100644 arch/x86/lib/bios_asm.S create mode 100644 arch/x86/lib/bios_interrupts.c
Applied to u-boot-x86.
PATCH 7/19 pci: Add general support for execution of video ROMs
In reply to Simon GlassSome platforms don't have native code for dealing with their video hardware. In some cases they use a binary blob to set it up and perform required actions like setting the video mode. This approach is a hangover from the old PC days where a ROM was provided and executed during startup.
Even now, these ROMs are supplied as a way to set up video. It avoids the code for every video chip needing to be provided in the boot loader. But it makes the video much less flexible - e.g. it is not possible to do anything else while the video init is happening (including waiting hundreds of milliseconds for display panels to start up).
In any case, to deal with this sad state of affairs, provide an API for execution of x86 video ROMs, either natively or through emulation.
---
drivers/pci/Makefile | 2 +- drivers/pci/pci_rom.c | 276 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/bios_emul.h | 14 +++ include/pci_rom.h | 58 +++++++++++ 4 files changed, 349 insertions(+), 1 deletion(-) create mode 100644 drivers/pci/pci_rom.c create mode 100644 include/pci_rom.h
drivers/pci/Makefile +1 -1
@@ -6,7 +6,7 @@ # obj-$(CONFIG_FSL_PCI_INIT) += fsl_pci_init.o -obj-$(CONFIG_PCI) += pci.o pci_auto.o +obj-$(CONFIG_PCI) += pci.o pci_auto.o pci_rom.o obj-$(CONFIG_PCI_INDIRECT_BRIDGE) += pci_indirect.o obj-$(CONFIG_PCI_GT64120) += pci_gt64120.o obj-$(CONFIG_PCI_MSC01) += pci_msc01.o
drivers/pci/pci_rom.c new file +276 -0
276 lines not on this page · raw message
include/bios_emul.h +14 -0
@@ -40,4 +40,18 @@ struct vbe_mode_info;int BootVideoCardBIOS (pci_dev_t pcidev,BE_VGAInfo **pVGAInfo,int cleanUp); +/* Run a BIOS ROM natively (only supported on x86 machines) */ +void bios_run_on_x86 (pci_dev_t pcidev,unsigned long addr,int vesa_mode, +struct vbe_mode_info *mode_info); + +/** +* bios_set_interrupt_handler() - Install an interrupt handler for the BIOS +* +* This installs an interrupt handler that the BIOS will call when needed. +* +* @intnum: Interrupt number to install a handler for +* @int_handler_func: Function to call to handle interrupt +*/ +void bios_set_interrupt_handler (int intnum,int (*int_handler_func)(void )); +#endif
include/pci_rom.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 7/19 pci: Add general support for execution of video ROMs
Quoted 11 lines · Simon Glass
Some platforms don't have native code for dealing with their video hardware. In some cases they use a binary blob to set it up and perform required actions like setting the video mode. This approach is a hangover from the old PC days where a ROM was provided and executed during startup.
Even now, these ROMs are supplied as a way to set up video. It avoids the code for every video chip needing to be provided in the boot loader. But it makes the video much less flexible - e.g. it is not possible to do anything else while the video init is happening (including waiting hundreds of milliseconds for display panels to start up).
Quoted 4 lines
In any case, to deal with this sad state of affairs, provide an API for execution of x86 video ROMs, either natively or through emulation.
Signed-off-by Simon Glass <[email protected]>
Applied to u-boot-x86.
PATCH 8/19 x86: video: Add video driver for bare x86 boards
In reply to Simon GlassAdd a very simple driver which uses vesa to discover the video mode and then provides a frame buffer for use by U-Boot.
---
drivers/video/Makefile | 1 + drivers/video/x86_fb.c | 37 +++++++++++++++++++++++++++++++++++++ include/video_fb.h | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 drivers/video/x86_fb.c
drivers/video/Makefile +1 -0
@@ -41,6 +41,7 @@ obj-$(CONFIG_VIDEO_SM501) += sm501.o obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o obj-$(CONFIG_VIDEO_TEGRA) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o +obj-$(CONFIG_VIDEO_X86) += x86_fb.o obj-$(CONFIG_FORMIKE) += formike.o obj-$(CONFIG_AM335X_LCD) += am335x-fb.o obj-$(CONFIG_VIDEO_PARADE) += parade.o
drivers/video/x86_fb.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* +* Vesa frame buffer driver for x86 +* +* Copyright (C) 2014 Google, Inc +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <video_fb.h> +#include <vbe.h> +#include "videomodes.h" + +/* +* The Graphic Device +*/ +GraphicDevice ctfb; + +void *video_hw_init (void ) +{ +GraphicDevice *gdev = &ctfb; +int bits_per_pixel; + +printf ("Video: " ); +if (vbe_get_video_info (gdev)) { +printf ("No video mode configured\n" ); +return NULL ; + } + + bits_per_pixel = gdev->gdfBytesPP *8 ; +sprintf (gdev->modeIdent,"%dx%dx%d" , gdev->winSizeX, gdev->winSizeY, + bits_per_pixel); +printf ("%s\n" , gdev->modeIdent); + +return (void *)gdev; +}
include/video_fb.h +1 -1
@@ -40,7 +40,7 @@/* Export Graphic Driver Control */ /******************************************************************************/ -typedef struct { +typedef struct graphic_device { unsigned int isaBase; unsigned int pciBase; unsigned int dprBase;
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 8/19 x86: video: Add video driver for bare x86 boards
Hi Simon,
Quoted 11 lines · On Fri, 14 Nov 2014 20:56:34 -0700 Simon Glass <[email protected]> wrote:
Add a very simple driver which uses vesa to discover the video mode and then provides a frame buffer for use by U-Boot.
Signed-off-by Simon Glass <[email protected]>---
drivers/video/Makefile | 1 + drivers/video/x86_fb.c | 37 +++++++++++++++++++++++++++++++++++++ include/video_fb.h | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 drivers/video/x86_fb.c
Thanks,
Anatolij
PATCH 8/19 x86: video: Add video driver for bare x86 boards
Quoted 17 lines · Anatolij Gustschin
Hi Simon,
Quoted 11 lines · On Fri, 14 Nov 2014 20:56:34 -0700 Simon Glass <[email protected]> wrote:
Add a very simple driver which uses vesa to discover the video mode and then provides a frame buffer for use by U-Boot.
Signed-off-by Simon Glass <[email protected]>---
drivers/video/Makefile | 1 + drivers/video/x86_fb.c | 37 +++++++++++++++++++++++++++++++++++++ include/video_fb.h | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 drivers/video/x86_fb.c
Quoted 5 lines
Thanks,
Anatolij
I had to move the video_fh.h change to the previous patch to maintain bisectability.
Applied to u-boot-x86.
PATCH 9/19 x86: Allow an option ROM to be built into U-Boot
In reply to Simon GlassSome x86 machines require a binary blob containing 16-bit initialisation code for their video hardware. Allow this to be built into the x86 ROM so that it is accessible during boot.
---
Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -983,6 +983,9 @@ u-boot.rom: u-boot-x86-16bit.bin u-boot-dtb.bin \ $(objtree)/tools/ifdtool -w \ $(CONFIG_SYS_X86_START16):$(objtree)/u-boot-x86-16bit.bin \ u-boot.tmp + $(objtree)/tools/ifdtool -w \ + $(CONFIG_X86_OPTION_ROM_ADDR):$(srctree)/board/$(BOARDDIR)/$(CONFIG_X86_OPTION_ROM_FILENAME) \ + u-boot.tmp mv u-boot.tmp $@ OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 9/19 x86: Allow an option ROM to be built into U-Boot
Quoted 9 lines · Simon Glass
Some x86 machines require a binary blob containing 16-bit initialisation code for their video hardware. Allow this to be built into the x86 ROM so that it is accessible during boot.
Signed-off-by Simon Glass <[email protected]>---
Makefile | 3 +++ 1 file changed, 3 insertions(+)
Applied to u-boot-x86.
PATCH 10/19 x86: Add initial video device init for Intel GMA
In reply to Simon GlassIntel's Graphics Media Accelerator (GMA) is a generic name for a wide range of video devices. Add code to set up the hardware on ivybridge. Part of the init happens in native code, part of it happens in a 16-bit option ROM for those nostalgic for the 1970s.
---
arch/x86/cpu/ivybridge/Makefile | 1 + arch/x86/cpu/ivybridge/bd82x6x.c | 13 +- arch/x86/cpu/ivybridge/gma.c | 756 ++++++++++++++++++++++++++ arch/x86/cpu/ivybridge/gma.h | 157 ++++++ arch/x86/include/asm/arch-ivybridge/bd82x6x.h | 2 + doc/device-tree-bindings/video/intel-gma.txt | 40 ++ include/fdtdec.h | 1 + lib/fdtdec.c | 1 + 8 files changed, 970 insertions(+), 1 deletion(-) create mode 100644 arch/x86/cpu/ivybridge/gma.c create mode 100644 arch/x86/cpu/ivybridge/gma.h create mode 100644 doc/device-tree-bindings/video/intel-gma.txt
arch/x86/cpu/ivybridge/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-y += car.o obj-y += cpu.o obj-y += early_init.o obj-y += early_me.o +obj-y += gma.o obj-y += lpc.o obj-y += me_status.o obj-y += model_206ax.o
arch/x86/cpu/ivybridge/bd82x6x.c +12 -1
@@ -91,7 +91,8 @@ int bd82x6x_init_pci_devices(void)const void *blob = gd->fdt_blob;struct pci_controller *hose;struct x86_cpu_priv *cpu; -int sata_node; +int sata_node, gma_node; +int ret; hose =pci_bus_to_hose (0 );lpc_enable (PCH_LPC_DEV );
@@ -111,6 +112,16 @@ int bd82x6x_init_pci_devices(void)return -ENOMEM ;model_206ax_init (cpu); + gma_node =fdtdec_next_compatible (blob,0 ,COMPAT_INTEL_GMA ); +if (gma_node <0 ) { +debug ("%s: Cannot find GMA node\n" , __func__); +return -EINVAL ; + } + ret =gma_func0_init (PCH_VIDEO_DEV ,pci_bus_to_hose (0 ), blob, + gma_node); +if (ret) +return ret; +return 0 ; }
arch/x86/cpu/ivybridge/gma.c new file +756 -0
756 lines not on this page · raw message
arch/x86/cpu/ivybridge/gma.h new file +157 -0
157 lines not on this page · raw message
arch/x86/include/asm/arch-ivybridge/bd82x6x.h +2 -0
@@ -13,6 +13,8 @@ void bd82x6x_pci_init(pci_dev_t dev);void bd82x6x_usb_ehci_init (pci_dev_t dev);void bd82x6x_usb_xhci_init (pci_dev_t dev);int bd82x6x_init_pci_devices (void ); +int gma_func0_init (pci_dev_t dev,struct pci_controller *hose, +const void *blob,int node);int bd82x6x_init (void );struct x86_cpu_priv ;
doc/device-tree-bindings/video/intel-gma.txt new file +40 -0
@@ -0,0 +1,40 @@ +Intel GMA Bindings +================== + +This is the Intel Graphics Media Accelerator. This binding supports selection +of display parameters only. + + +Required properties: + - compatible : "intel,gma"; + +Optional properties: + - intel,dp-hotplug : values for digital port hotplug, one cell per value for + ports B, C and D + - intel,panel-port-select : output port to use: 0=LVDS 1=DP_B 2=DP_C 3=DP_D + - intel,panel-power-cycle-delay : T4 time sequence (6 = 500ms) + + The following delays are in units of 0.1ms: + - intel,panel-power-up-delay : T1+T2 time sequence + - intel,panel-power-down-delay : T3 time sequence + - intel,panel-power-backlight-on-delay : T5 time sequence + - intel,panel-power-backlight-off-delay : Tx time sequence + + - intel,cpu-backlight : Value for CPU Backlight PWM + - intel,pch-backlight : Value for PCH Backlight PWM + +Example +------- + +gma { + compatible = "intel,gma"; + intel,dp_hotplug = <0 0 0x06>; + intel,panel-port-select = <1>; + intel,panel-power-cycle-delay = <6>; + intel,panel-power-up-delay = <2000>; + intel,panel-power-down-delay = <500>; + intel,panel-power-backlight-on-delay = <2000>; + intel,panel-power-backlight-off-delay = <2000>; + intel,cpu-backlight = <0x00000200>; + intel,pch-backlight = <0x04000000>; +};
include/fdtdec.h +1 -0
@@ -122,6 +122,7 @@ enum fdt_compat_id {COMPAT_MEMORY_SPD ,/* Memory SPD information */ COMPAT_INTEL_PANTHERPOINT_AHCI ,/* Intel Pantherpoint AHCI */ COMPAT_INTEL_MODEL_206AX ,/* Intel Model 206AX CPU */ +COMPAT_INTEL_GMA ,/* Intel Graphics Media Accelerator */ COMPAT_COUNT, };
lib/fdtdec.c +1 -0
@@ -77,6 +77,7 @@ static const char * const compat_names[COMPAT_COUNT] = {COMPAT (MEMORY_SPD ,"memory-spd" ),COMPAT (INTEL_PANTHERPOINT_AHCI ,"intel,pantherpoint-ahci" ),COMPAT (INTEL_MODEL_206AX ,"intel,model-206ax" ), + COMPAT(INTEL_GMA, "intel,gma"), };const char *fdtdec_get_compatible (enum fdt_compat_id id)
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 10/19 x86: Add initial video device init for Intel GMA
Quoted 8 lines · Simon Glass
Intel's Graphics Media Accelerator (GMA) is a generic name for a wide range of video devices. Add code to set up the hardware on ivybridge. Part of the init happens in native code, part of it happens in a 16-bit option ROM for those nostalgic for the 1970s.
Signed-off-by Simon Glass <[email protected]>---
Quoted 12 lines
arch/x86/cpu/ivybridge/Makefile | 1 + arch/x86/cpu/ivybridge/bd82x6x.c | 13 +- arch/x86/cpu/ivybridge/gma.c | 756 ++++++++++++++++++++++++++ arch/x86/cpu/ivybridge/gma.h | 157 ++++++ arch/x86/include/asm/arch-ivybridge/bd82x6x.h | 2 + doc/device-tree-bindings/video/intel-gma.txt | 40 ++ include/fdtdec.h | 1 + lib/fdtdec.c | 1 + 8 files changed, 970 insertions(+), 1 deletion(-) create mode 100644 arch/x86/cpu/ivybridge/gma.c create mode 100644 arch/x86/cpu/ivybridge/gma.h create mode 100644 doc/device-tree-bindings/video/intel-gma.txt
Applied to u-boot-x86.
PATCH 11/19 x86: dts: Add video information to the device tree
In reply to Simon GlassThis provides panel timing information needed by the video driver.
---
arch/x86/dts/link.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/x86/dts/link.dts +13 -0
@@ -171,6 +171,19 @@ intel,sata-port0-gen3-tx = <0x00880a7f>; }; + gma { + compatible = "intel,gma"; + intel,dp_hotplug = <0 0 0x06>; + intel,panel-port-select = <1>; + intel,panel-power-cycle-delay = <6>; + intel,panel-power-up-delay = <2000>; + intel,panel-power-down-delay = <500>; + intel,panel-power-backlight-on-delay = <2000>; + intel,panel-power-backlight-off-delay = <2000>; + intel,cpu-backlight = <0x00000200>; + intel,pch-backlight = <0x04000000>; + }; + lpc { compatible = "intel,lpc"; #address-cells = <1>;
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 11/19 x86: dts: Add video information to the device tree
Quoted 7 lines · Simon Glass
This provides panel timing information needed by the video driver.
Signed-off-by Simon Glass <[email protected]>---
arch/x86/dts/link.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Applied to u-boot-x86.
PATCH 12/19 x86: config: Enable video support for chromebook_link
In reply to Simon GlassNow that we have the required drivers, enable video support with a suitable option ROM.
---
include/configs/chromebook_link.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
include/configs/chromebook_link.h +3 -7
@@ -39,13 +39,9 @@ {PCI_VENDOR_ID_INTEL , \ PCI_DEVICE_ID_INTEL_PANTHERPOINT_AHCI_MOBILE} -/* -* These common x86 features are not yet supported, but are added in -* follow-on patches in this series. Add undefs here to avoid every patch -* having to put things back into x86-common.h -*/ -#undef CONFIG_VIDEO -#undef CONFIG_CFB_CONSOLE +#define CONFIG_X86_OPTION_ROM_FILENAME pci8086,0166.bin +#define CONFIG_X86_OPTION_ROM_ADDR 0xfff90000 +#define CONFIG_VIDEO_X86 #define CONFIG_PCI_MEM_BUS 0xe0000000#define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 12/19 x86: config: Enable video support for chromebook_link
Quoted 8 lines · Simon Glass
Now that we have the required drivers, enable video support with a suitable option ROM.
Signed-off-by Simon Glass <[email protected]>---
include/configs/chromebook_link.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
Applied to u-boot-x86.
PATCH 13/19 bios_emulator: Allow x86 to use the emulator
In reply to Simon GlassThere is an implicit assumption that x86 machines want to use raw I/O in the BIOS emulator, but this should be selectable. Add an CONFIG_X86EMU_RAW_IO option to control it instead.
Also fix a few bugs which cause warnings on x86 and adjust the Makefile to remove the assumption that only PowerPC uses the emulator.
---
drivers/bios_emulator/Makefile | 2 +- drivers/bios_emulator/besys.c | 32 +++++++++++++++++--------------- drivers/bios_emulator/include/x86emu.h | 4 ++-- drivers/bios_emulator/x86emu/debug.c | 8 +++----- 4 files changed, 23 insertions(+), 23 deletions(-)
drivers/bios_emulator/Makefile +1 -1
@@ -9,4 +9,4 @@ obj-y = atibios.o biosemu.o besys.o bios.o \ $(X86DIR)/debug.o ccflags-y := -I$(srctree)/$(src) -I$(srctree)/$(src)/include \ - -D__PPC__ -D__BIG_ENDIAN__ + $(if $(CONFIG_PPC),-D__PPC__ -D__BIG_ENDIAN__)
drivers/bios_emulator/besys.c +17 -15
@@ -54,7 +54,7 @@/*------------------------- Global Variables ------------------------------*/ -#ifndef __i386__ +#ifndef CONFIG_X86EMU_RAW_IO static char *BE_biosDate ="08/14/99" ;static u8 BE_model =0xFC ;static u8 BE_submodel =0x00 ;
@@ -80,16 +80,18 @@ static u8 *BE_memaddr(u32 addr)if (addr >=0xC0000 && addr <= _BE_env.biosmem_limit) {return (u8 *)(_BE_env.biosmem_base + addr -0xC0000 ); }else if (addr > _BE_env.biosmem_limit && addr <0xD0000 ) { - DB(printf("BE_memaddr: address %#lx may be invalid!\n", addr);) -return M .mem_base; +DB (printf ("BE_memaddr: address %#lx may be invalid!\n" , + (ulong)addr);) +return (u8 *)M .mem_base; }else if (addr >=0xA0000 && addr <=0xBFFFF ) {return (u8 *)(_BE_env.busmem_base + addr -0xA0000 ); } -#ifdef __i386__ +#ifdef CONFIG_X86EMU_RAW_IO else if (addr >= 0xD0000 && addr <= 0xFFFFF) {/* We map the real System BIOS directly on real PC's */ - DB(printf("BE_memaddr: System BIOS address %#lx\n", addr);) -return _BE_env.busmem_base + addr -0xA0000 ; +DB (printf ("BE_memaddr: System BIOS address %#lx\n" , + (ulong)addr);) +return (u8 *)_BE_env.busmem_base + addr -0xA0000 ; }#else else if (addr >= 0xFFFF5 && addr < 0xFFFFE) {
@@ -108,10 +110,10 @@ static u8 *BE_memaddr(u32 addr)#endif else if (addr > M.mem_size - 1) {HALT_SYS (); -return M .mem_base; +return (u8 *)M .mem_base; } -return M .mem_base + addr; +return (u8 *)(M .mem_base + addr); }/****************************************************************************
@@ -230,7 +232,7 @@ void X86API BE_wrl(u32 addr, u32 val) } } -#if defined(DEBUG ) || !defined(__i386__) +#if !defined(CONFIG_X86EMU_RAW_IO )/* For Non-Intel machines we may need to emulate some I/O port accesses that * the BIOS may try to access, such as the PCI config registers.
@@ -560,7 +562,7 @@ u8 X86API BE_inb(X86EMU_pioAddr port) {u8 val =0 ; -#if defined(DEBUG ) || !defined(__i386__) +#if !defined(CONFIG_X86EMU_RAW_IO )if (IS_VGA_PORT (port)){/*seems reading port 0x3c3 return the high 16 bit of io port*/ if (port ==0x3c3 )
@@ -601,7 +603,7 @@ u16 X86API BE_inw(X86EMU_pioAddr port) {u16 val =0 ; -#if defined(DEBUG ) || !defined(__i386__) +#if !defined(CONFIG_X86EMU_RAW_IO )if (IS_PCI_PORT (port)) val =PCI_inp (port,REG_READ_WORD );else if (port <0x100 ) {
@@ -629,7 +631,7 @@ u32 X86API BE_inl(X86EMU_pioAddr port) {u32 val =0 ; -#if defined(DEBUG ) || !defined(__i386__) +#if !defined(CONFIG_X86EMU_RAW_IO )if (IS_PCI_PORT (port)) val =PCI_inp (port,REG_READ_DWORD );else if (port <0x100 ) {
@@ -652,7 +654,7 @@ through to the real hardware if we don't need to special case it.****************************************************************************/ void X86API BE_outb(X86EMU_pioAddr port, u8 val) { -#if defined(DEBUG ) || !defined(__i386__) +#if !defined(CONFIG_X86EMU_RAW_IO )if (IS_VGA_PORT (port))VGA_outpb (port, val);else if (IS_TIMER_PORT (port))
@@ -683,7 +685,7 @@ through to the real hardware if we don't need to special case it.****************************************************************************/ void X86API BE_outw(X86EMU_pioAddr port, u16 val) { -#if defined(DEBUG ) || !defined(__i386__) +#if !defined(CONFIG_X86EMU_RAW_IO )if (IS_VGA_PORT (port)) {VGA_outpb (port, val);VGA_outpb (port +1 , val >>8 );
@@ -710,7 +712,7 @@ through to the real hardware if we don't need to special case it.****************************************************************************/ void X86API BE_outl(X86EMU_pioAddr port, u32 val) { -#if defined(DEBUG ) || !defined(__i386__) +#if !defined(CONFIG_X86EMU_RAW_IO )if (IS_PCI_PORT (port))PCI_outp (port, val,REG_WRITE_DWORD );else if (port <0x100 ) {
drivers/bios_emulator/include/x86emu.h +2 -2
@@ -53,9 +53,9 @@ typedef u16 X86EMU_pioAddr;/*---------------------- Macros and type definitions ----------------------*/ -#if defined (CONFIG_ARM ) +#if defined(CONFIG_ARM )#define GAS_LINE_COMMENT "@" -#elif defined(CONFIG_MIPS ) || defined(CONFIG_PPC ) +#elif defined(CONFIG_MIPS ) || defined(CONFIG_PPC ) || defined(CONFIG_X86 )#define GAS_LINE_COMMENT "#"#elif defined (CONFIG_SH )#define GAS_LINE_COMMENT "!"
drivers/bios_emulator/x86emu/debug.c +3 -5
@@ -211,9 +211,7 @@ void X86EMU_dump_memory(u16 seg, u16 off, u32 amt)u32 start = off &0xfffffff0 ;u32 end = (off +16 ) &0xfffffff0 ;u32 i; -u32 current; - current = start;while (end <= off + amt) {printk ("%04x:%04x " , seg, start);for (i = start; i < off; i++)
@@ -229,7 +227,7 @@ void X86EMU_dump_memory(u16 seg, u16 off, u32 amt)void x86emu_single_step (void ) {char s[1024 ]; -int ps[10 ]; +int ps[10 ];int ntok;int cmd;int done;
@@ -238,8 +236,6 @@ void x86emu_single_step(void)static int breakpoint;static int noDecode =1 ; -char *p; -if (DEBUG_BREAK ()) {if (M .x86.saved_ip != breakpoint) {return ;
@@ -255,6 +251,8 @@ void x86emu_single_step(void) offset =M .x86.saved_ip;while (!done) {printk ("-" ); + ps[1 ] =0 ;/* Avoid dodgy compiler warnings */ + ps[2 ] =0 ; cmd =x86emu_parse_line (s, ps, &ntok);switch (cmd) {case 'u' :
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 13/19 bios_emulator: Allow x86 to use the emulator
Quoted 7 lines · Simon Glass
There is an implicit assumption that x86 machines want to use raw I/O in the BIOS emulator, but this should be selectable. Add an
CONFIG_X86EMU_RAW_IOoption to control it instead.Also fix a few bugs which cause warnings on x86 and adjust the
Makefileto remove the assumption that only PowerPC uses the emulator.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/Makefile | 2 +- drivers/bios_emulator/besys.c | 32 +++++++++++++++++--------------- drivers/bios_emulator/include/x86emu.h | 4 ++-- drivers/bios_emulator/x86emu/debug.c | 8 +++----- 4 files changed, 23 insertions(+), 23 deletions(-)
Applied to u-boot-x86.
PATCH 14/19 bios_emulator: Add vesa support and allow ROMs to be passed in as data
In reply to Simon GlassAs well as locating the ROM on the PCI bus, allow the ROM to be supplied to the emulator. Split the init up a little so that callers can supply their own interrupt routines. Also allow a vesa mode to be provided, to be selected once the BIOS run is complete.
---
drivers/bios_emulator/atibios.c | 198 ++++++++++++++++++++++++++++------------ drivers/bios_emulator/besys.c | 4 +- include/bios_emul.h | 8 ++ 3 files changed, 152 insertions(+), 58 deletions(-)
drivers/bios_emulator/atibios.c +142 -56
@@ -46,8 +46,11 @@* BIOS in u-boot. ****************************************************************************/ #include <common.h> -#include "biosemui.h" +#include <bios_emul.h> +#include <errno.h> #include <malloc.h> +#include <vbe.h> +#include "biosemui.h" /* Length of the BIOS image */ #define MAX_BIOSLEN (128 * 1024L)
@@ -59,17 +62,54 @@ static u32 saveBaseAddress14;static u32 saveBaseAddress18;static u32 saveBaseAddress20; +static void atibios_set_vesa_mode (RMREGS *regs,int vesa_mode, +struct vbe_mode_info *mode_info) +{ +debug ("VBE: Setting VESA mode %#04x\n" , vesa_mode); +/* request linear framebuffer mode */ + vesa_mode |= (1 <<14 ); +/* request clearing of framebuffer */ + vesa_mode &= ~(1 <<15 ); + regs->e.eax =VESA_SET_MODE ; + regs->e.ebx = vesa_mode; +BE_int86 (0x10 , regs, regs); + +int offset =0x2000 ; +void *buffer = (void *)(M .mem_base + offset); + +u16 buffer_seg = (((unsigned long )offset) >>4 ) &0xff00 ; +u16 buffer_adr = ((unsigned long )offset) &0xffff ; + regs->e.eax =VESA_GET_MODE_INFO ; + regs->e.ebx =0 ; + regs->e.ecx = vesa_mode; + regs->e.edx =0 ; + regs->e.esi = buffer_seg; + regs->e.edi = buffer_adr; +BE_int86 (0x10 , regs, regs); +memcpy (mode_info->mode_info_block, buffer, +sizeof (struct vbe_mode_info )); + mode_info->valid = true; + + vesa_mode |= (1 <<14 ); +/* request clearing of framebuffer */ + vesa_mode &= ~(1 <<15 ); + regs->e.eax =VESA_SET_MODE ; + regs->e.ebx = vesa_mode; +BE_int86 (0x10 , regs, regs); +} +/**************************************************************************** PARAMETERS: pcidev - PCI device info for the video card on the bus to boot -VGAInfo - BIOS emulator VGA info structure +vga_info - BIOS emulator VGA info structure REMARKS: This function executes the BIOS POST code on the controller. We assume that at this stage the controller has its I/O and memory space enabled and that all other controllers are in a disabled state. ****************************************************************************/ -static void PCI_doBIOSPOST (pci_dev_t pcidev,BE_VGAInfo * VGAInfo) +static void PCI_doBIOSPOST (pci_dev_t pcidev,BE_VGAInfo *vga_info, +int vesa_mode,struct vbe_mode_info *mode_info) {RMREGS regs;RMSREGS sregs;
@@ -84,13 +124,16 @@ static void PCI_doBIOSPOST(pci_dev_t pcidev, BE_VGAInfo * VGAInfo) ((int )PCI_DEV (pcidev) <<3 ) | (int )PCI_FUNC (pcidev);/*Setup the X86 emulator for the VGA BIOS*/ -BE_setVGA (VGAInfo); +BE_setVGA (vga_info);/*Execute the BIOS POST code*/ BE_callRealMode (0xC000 ,0x0003 , ®s, &sregs);/*Cleanup and exit*/ -BE_getVGA (VGAInfo); +BE_getVGA (vga_info); + +if (vesa_mode !=-1 ) +atibios_set_vesa_mode (®s, vesa_mode, mode_info); }/****************************************************************************
@@ -244,60 +287,61 @@ REMARKS:Loads and POST's the display controllers BIOS, directly from the BIOS image we can extract over the PCI bus. ****************************************************************************/ -static int PCI_postController (pci_dev_t pcidev,BE_VGAInfo * VGAInfo) +static int PCI_postController (pci_dev_t pcidev,uchar *bios_rom,int bios_len, +BE_VGAInfo *vga_info,int vesa_mode, +struct vbe_mode_info *mode_info) { -u32 BIOSImageLen; -uchar *mappedBIOS; -uchar *copyOfBIOS; - -/*Allocate memory to store copy of BIOS from display controller*/ -if ((mappedBIOS =PCI_mapBIOSImage (pcidev)) ==NULL ) { -printf ("videoboot: Video ROM failed to map!\n" ); -return false; - } +u32 bios_image_len; +uchar *mapped_bios; +uchar *copy_of_bios; + +if (bios_rom) { + copy_of_bios = bios_rom; + bios_image_len = bios_len; + }else { +/* +* Allocate memory to store copy of BIOS from display +* controller +*/ + mapped_bios =PCI_mapBIOSImage (pcidev); +if (mapped_bios ==NULL ) { +printf ("videoboot: Video ROM failed to map!\n" ); +return false; + } - BIOSImageLen = mappedBIOS[2 ] *512 ; + bios_image_len = mapped_bios[2 ] *512 ; -if ((copyOfBIOS =malloc (BIOSImageLen)) ==NULL ) { -printf ("videoboot: Out of memory!\n" ); -return false; + copy_of_bios =malloc (bios_image_len); +if (copy_of_bios ==NULL ) { +printf ("videoboot: Out of memory!\n" ); +return false; + } +memcpy (copy_of_bios, mapped_bios, bios_image_len); +PCI_unmapBIOSImage (pcidev, mapped_bios); } -memcpy (copyOfBIOS, mappedBIOS, BIOSImageLen); -PCI_unmapBIOSImage (pcidev, mappedBIOS); - -/*Save information in VGAInfo structure*/ - VGAInfo->function =PCI_FUNC (pcidev); - VGAInfo->device =PCI_DEV (pcidev); - VGAInfo->bus =PCI_BUS (pcidev); - VGAInfo->pcidev = pcidev; - VGAInfo->BIOSImage = copyOfBIOS; - VGAInfo->BIOSImageLen = BIOSImageLen; +/*Save information in vga_info structure*/ + vga_info->function =PCI_FUNC (pcidev); + vga_info->device =PCI_DEV (pcidev); + vga_info->bus =PCI_BUS (pcidev); + vga_info->pcidev = pcidev; + vga_info->BIOSImage = copy_of_bios; + vga_info->BIOSImageLen = bios_image_len;/*Now execute the BIOS POST for the device*/ -if (copyOfBIOS[0 ] !=0x55 || copyOfBIOS[1 ] !=0xAA ) { +if (copy_of_bios[0 ] !=0x55 || copy_of_bios[1 ] !=0xAA ) {printf ("videoboot: Video ROM image is invalid!\n" );return false; } -PCI_doBIOSPOST (pcidev, VGAInfo); +PCI_doBIOSPOST (pcidev, vga_info, vesa_mode, mode_info);/*Reset the size of the BIOS image to the final size*/ - VGAInfo->BIOSImageLen = copyOfBIOS[2 ] *512 ; + vga_info->BIOSImageLen = copy_of_bios[2 ] *512 ;return true; } -/**************************************************************************** -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 - -REMARKS: -Boots the PCI/AGP video card on the bus using the Video ROM BIOS image -and the X86 BIOS emulator module. -****************************************************************************/ -int BootVideoCardBIOS (pci_dev_t pcidev,BE_VGAInfo ** pVGAInfo,int cleanUp) +int biosemu_setup (pci_dev_t pcidev,BE_VGAInfo **vga_infop) {BE_VGAInfo *VGAInfo;
@@ -307,28 +351,70 @@ int BootVideoCardBIOS(pci_dev_t pcidev, BE_VGAInfo ** pVGAInfo, int cleanUp)/*Initialise the x86 BIOS emulator*/ if ((VGAInfo =malloc (sizeof (*VGAInfo))) ==NULL ) {printf ("videoboot: Out of memory!\n" ); -return false; +return -ENOMEM ; }memset (VGAInfo,0 ,sizeof (*VGAInfo));BE_init (0 ,65536 , VGAInfo,0 ); + *vga_infop = VGAInfo; -/*Post all the display controller BIOS'es*/ -if (!PCI_postController (pcidev, VGAInfo)) -return false; +return 0 ; +} -/*Cleanup and exit the emulator if requested. If the BIOS emulator -is needed after booting the card, we will not call BE_exit and -leave it enabled for further use (ie: VESA driver etc). +void biosemu_set_interrupt_handler (int intnum,int (*int_func)(void )) +{ +X86EMU_setupIntrFunc (intnum, (X86EMU_intrFuncs )int_func); +} + +int biosemu_run (pci_dev_t pcidev,uchar *bios_rom,int bios_len, +BE_VGAInfo *vga_info,int clean_up,int vesa_mode, +struct vbe_mode_info *mode_info) +{ +/*Post all the display controller BIOS'es*/ +if (!PCI_postController (pcidev, bios_rom, bios_len, vga_info, + vesa_mode, mode_info)) +return -EINVAL ; + +/* +* Cleanup and exit the emulator if requested. If the BIOS emulator +* is needed after booting the card, we will not call BE_exit and +* leave it enabled for further use (ie: VESA driver etc). */ -if (cleanUp) { +if (clean_up) {BE_exit (); -if (VGAInfo->BIOSImage) -free (VGAInfo->BIOSImage); -free (VGAInfo); - VGAInfo =NULL ; +if (vga_info->BIOSImage) +free (vga_info->BIOSImage); +free (vga_info); + vga_info =NULL ; } -/*Return VGA info pointer if the caller requested it*/ + +return 0 ; +} + +/**************************************************************************** +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 + +REMARKS: +Boots the PCI/AGP video card on the bus using the Video ROM BIOS image +and the X86 BIOS emulator module. +****************************************************************************/ +int BootVideoCardBIOS (pci_dev_t pcidev,BE_VGAInfo **pVGAInfo,int clean_up) +{ +BE_VGAInfo *VGAInfo; +int ret; + + ret =biosemu_setup (pcidev, &VGAInfo); +if (ret) +return false; + ret =biosemu_run (pcidev,NULL ,0 , VGAInfo, clean_up,-1 ,NULL ); +if (ret) +return false; + +/* Return VGA info pointer if the caller requested it*/ if (pVGAInfo) *pVGAInfo = VGAInfo; +return true; }
drivers/bios_emulator/besys.c +2 -2
@@ -713,9 +713,9 @@ through to the real hardware if we don't need to special case it. void X86API BE_outl(X86EMU_pioAddr port, u32 val) {#if !defined(CONFIG_X86EMU_RAW_IO ) -if (IS_PCI_PORT (port)) +if (IS_PCI_PORT (port)) {PCI_outp (port, val,REG_WRITE_DWORD ); -else if (port <0x100 ) { + }else if (port <0x100 ) { DB(printf("WARN: INVALID outl.%04X <- %08X\n", (u16) port,val);)LOG_outpd (port, val); }else
include/bios_emul.h +8 -0
@@ -54,4 +54,12 @@ void bios_run_on_x86(pci_dev_t pcidev, unsigned long addr, int vesa_mode,*/ void bios_set_interrupt_handler (int intnum,int (*int_handler_func)(void )); +void biosemu_set_interrupt_handler (int intnum,int (*int_func)(void )); + +int biosemu_setup (pci_dev_t pcidev,BE_VGAInfo **pVGAInfo); + +int biosemu_run (pci_dev_t pcidev,uchar *bios_rom,int bios_len, +BE_VGAInfo *vga_info,int clean_up,int vesa_mode, +struct vbe_mode_info *mode_info); +#endif
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 14/19 bios_emulator: Add vesa support and allow ROMs to be passed in as data
Quoted 5 lines · Simon Glass
As well as locating the ROM on the PCI bus, allow the ROM to be supplied to the emulator. Split the init up a little so that callers can supply their own interrupt routines. Also allow a vesa mode to be provided, to be selected once the BIOS run is complete.
Quoted 7 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/atibios.c | 198 ++++++++++++++++++++++++++++------------ drivers/bios_emulator/besys.c | 4 +- include/bios_emul.h | 8 ++ 3 files changed, 152 insertions(+), 58 deletions(-)
Applied to u-boot-x86.
PATCH 15/19 bios_emulator: Allow a custom interrupt handler to be installed
In reply to Simon GlassSometime we want to provide an interrupt handler for the ROM, Add a function to allow this.
---
drivers/bios_emulator/include/x86emu.h | 1 + drivers/bios_emulator/x86emu/sys.c | 5 +++++ 2 files changed, 6 insertions(+)
drivers/bios_emulator/include/x86emu.h +1 -0
@@ -153,6 +153,7 @@ extern "C" { /* Use "C" linkage when in C++ mode */void X86EMU_setupMemFuncs (X86EMU_memFuncs * funcs);void X86EMU_setupPioFuncs (X86EMU_pioFuncs * funcs);void X86EMU_setupIntrFuncs (X86EMU_intrFuncs funcs[]); +void X86EMU_setupIntrFunc (int intnum,X86EMU_intrFuncs func);void X86EMU_prepareForInt (int num);/* decode.c */
drivers/bios_emulator/x86emu/sys.c +5 -0
@@ -273,6 +273,11 @@ void X86EMU_setupPioFuncs(X86EMU_pioFuncs * funcs) sys_outl = funcs->outl; } +void X86EMU_setupIntrFunc (int intnum,X86EMU_intrFuncs func) +{ + _X86EMU_intrTab[intnum] = func; +} +/**************************************************************************** PARAMETERS: funcs - New interrupt vector table to make active
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 15/19 bios_emulator: Allow a custom interrupt handler to be installed
Quoted 9 lines · Simon Glass
Sometime we want to provide an interrupt handler for the ROM, Add a function to allow this.
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/include/x86emu.h | 1 + drivers/bios_emulator/x86emu/sys.c | 5 +++++ 2 files changed, 6 insertions(+)
Applied to u-boot-x86.
PATCH 16/19 bios_emulator: Add an option to enable debugging
In reply to Simon GlassAt present there are DEBUG options spread around the place. If you enable one and not another you can end up with an emulator that does not work, since each file can have a different view of what the registers look like. To fix this, create a global CONFIG_X86EMU_DEBUG option that keeps everything consistent.
---
drivers/bios_emulator/besys.c | 64 ++++++++++++++++++++++------ drivers/bios_emulator/bios.c | 4 +- drivers/bios_emulator/biosemui.h | 2 +- drivers/bios_emulator/include/x86emu.h | 2 +- drivers/bios_emulator/include/x86emu/debug.h | 16 +++---- drivers/bios_emulator/include/x86emu/regs.h | 2 +- drivers/bios_emulator/x86emu/debug.c | 2 +- drivers/bios_emulator/x86emu/decode.c | 24 +++++------ drivers/bios_emulator/x86emu/ops.c | 28 ++++++------ 9 files changed, 90 insertions(+), 54 deletions(-)
drivers/bios_emulator/besys.c +50 -14
@@ -60,6 +60,14 @@ static u8 BE_model = 0xFC;static u8 BE_submodel =0x00 ;#endif +#undef DEBUG_IO_ACCESS + +#ifdef DEBUG_IO_ACCESS +#define debug_io (fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#define debug_io(x, b...) +#endif +/*----------------------------- Implementation ----------------------------*/ /****************************************************************************
@@ -96,15 +104,15 @@ static u8 *BE_memaddr(u32 addr)#else else if (addr >= 0xFFFF5 && addr < 0xFFFFE) {/* Return a faked BIOS date string for non-x86 machines */ - DB(printf("BE_memaddr - Returning BIOS date\n");) +debug_io ("BE_memaddr - Returning BIOS date\n" );return (u8 *)(BE_biosDate + addr -0xFFFF5 ); } else if (addr == 0xFFFFE) {/* Return system model identifier for non-x86 machines */ - DB(printf("BE_memaddr - Returning model\n");) +debug_io ("BE_memaddr - Returning model\n" );return &BE_model; } else if (addr == 0xFFFFF) {/* Return system submodel identifier for non-x86 machines */ - DB(printf("BE_memaddr - Returning submodel\n");) +debug_io ("BE_memaddr - Returning submodel\n" );return &BE_submodel; }#endif
@@ -260,6 +268,7 @@ static u8 VGA_inpb (const int port) {u8 val =0xff ; +debug_io ("vga_inb.%04X -> " , (u16 ) port);switch (port) {case 0x3C0 :/* 3C0 has funky characteristics because it can act as either
@@ -583,7 +592,12 @@ u8 X86API BE_inb(X86EMU_pioAddr port) val = LOG_inpb(port); } else#endif + { +debug_io ("inb.%04X -> " , (u16 ) port); val =LOG_inpb (port); +debug_io ("%02X\n" , val); + } +return val; }
@@ -611,7 +625,12 @@ u16 X86API BE_inw(X86EMU_pioAddr port) val = LOG_inpw(port); } else#endif + { +debug_io ("inw.%04X -> " , (u16 ) port); val =LOG_inpw (port); +debug_io ("%04X\n" , val); + } +return val; }
@@ -638,7 +657,12 @@ u32 X86API BE_inl(X86EMU_pioAddr port) val = LOG_inpd(port); } else#endif + { +debug_io ("inl.%04X -> " , (u16 ) port); val =LOG_inpd (port); +debug_io ("%08X\n" , val); + } +return val; }
@@ -670,7 +694,11 @@ void X86API BE_outb(X86EMU_pioAddr port, u8 val) LOG_outpb(port, val); } else#endif + { +debug_io ("outb.%04X <- %02X" , (u16 ) port, val);LOG_outpb (port, val); +debug_io ("\n" ); + } }/****************************************************************************
@@ -686,18 +714,22 @@ through to the real hardware if we don't need to special case it. void X86API BE_outw(X86EMU_pioAddr port, u16 val) {#if !defined(CONFIG_X86EMU_RAW_IO ) -if (IS_VGA_PORT (port)) { -VGA_outpb (port, val); -VGA_outpb (port +1 , val >>8 ); - }else if (IS_PCI_PORT (port)) -PCI_outp (port, val,REG_WRITE_WORD ); -else if (port <0x100 ) { -DB (printf ("WARN: MAybe INVALID outw.%04X <- %04X\n" , (u16 ) port, - val);) -LOG_outpw (port, val); - } else +if (IS_VGA_PORT (port)) { +VGA_outpb (port, val); +VGA_outpb (port +1 , val >>8 ); + }else if (IS_PCI_PORT (port)) { +PCI_outp (port, val,REG_WRITE_WORD ); + }else if (port <0x100 ) { +DB (printf ("WARN: MAybe INVALID outw.%04X <- %04X\n" , (u16 )port, + val);) +LOG_outpw (port, val); + } else#endif -LOG_outpw (port, val); + { +debug_io ("outw.%04X <- %04X" , (u16 ) port, val); +LOG_outpw (port, val); +debug_io ("\n" ); + } }/****************************************************************************
@@ -720,5 +752,9 @@ void X86API BE_outl(X86EMU_pioAddr port, u32 val) LOG_outpd(port, val); } else#endif + { +debug_io ("outl.%04X <- %08X" , (u16 ) port, val);LOG_outpd (port, val); +debug_io ("\n" ); + } }
drivers/bios_emulator/bios.c +2 -2
@@ -84,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);
drivers/bios_emulator/biosemui.h +1 -1
@@ -48,7 +48,7 @@#include <asm/io.h> /*---------------------- Macros and type definitions ----------------------*/ -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG #define DB (x) x#else #define DB (x) do{}while(0);
drivers/bios_emulator/include/x86emu.h +1 -1
@@ -161,7 +161,7 @@ extern "C" { /* Use "C" linkage when in C++ mode */void X86EMU_exec (void );void X86EMU_halt_sys (void ); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG #define HALT_SYS () \ printf("halt_sys: file %s, line %d\n", __FILE__, __LINE__), \ X86EMU_halt_sys()
drivers/bios_emulator/include/x86emu/debug.h +8 -8
@@ -48,7 +48,7 @@#define CHECK_MEM_ACCESS_F 0x4/*using regular linear pointer */ #define CHECK_DATA_ACCESS_F 0x8/*using segment:offset */ -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG # define CHECK_IP_FETCH () (M.x86.check & CHECK_IP_FETCH_F)# define CHECK_SP_ACCESS () (M.x86.check & CHECK_SP_ACCESS_F)# define CHECK_MEM_ACCESS () (M.x86.check & CHECK_MEM_ACCESS_F)
@@ -60,7 +60,7 @@# define CHECK_DATA_ACCESS ()#endif -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG # define DEBUG_INSTRUMENT () (M.x86.debug & DEBUG_INSTRUMENT_F)# define DEBUG_DECODE () (M.x86.debug & DEBUG_DECODE_F)# define DEBUG_TRACE () (M.x86.debug & DEBUG_TRACE_F)
@@ -99,7 +99,7 @@# define DEBUG_DECODE_NOPRINT () 0#endif -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG # define DECODE_PRINTF (x) if (DEBUG_DECODE()) \ x86emu_decode_printf(x)
@@ -129,7 +129,7 @@# define SAVE_IP_CS (x,y)#endif -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG #define TRACE_REGS () \ if (DEBUG_DISASSEMBLE()) { \ x86emu_just_disassemble(); \
@@ -140,7 +140,7 @@# define TRACE_REGS ()#endif -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG # define SINGLE_STEP () if (DEBUG_STEP()) x86emu_single_step()#else # define SINGLE_STEP ()
@@ -150,7 +150,7 @@TRACE_REGS (); \ SINGLE_STEP() -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG # define START_OF_INSTR ()# define END_OF_INSTR () EndOfTheInstructionProcedure: x86emu_end_instr();# define END_OF_INSTR_NO_TRACE () x86emu_end_instr();
@@ -160,7 +160,7 @@# define END_OF_INSTR_NO_TRACE ()#endif -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG # define CALL_TRACE (u,v,w,x,s) \ if (DEBUG_TRACECALLREGS()) \ x86emu_dump_regs(); \
@@ -176,7 +176,7 @@# define RETURN_TRACE (n,u,v)#endif -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG #define DB (x) x#else #define DB (x)
drivers/bios_emulator/include/x86emu/regs.h +1 -1
@@ -282,7 +282,7 @@ typedef struct {u8 intno;volatile int intr;/* mask of pending interrupts */ int debug; -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG int check;u16 saved_ip;u16 saved_cs;
drivers/bios_emulator/x86emu/debug.c +1 -1
@@ -44,7 +44,7 @@/*----------------------------- Implementation ----------------------------*/ -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG static void print_encoded_bytes (u16 s,u16 o);static void print_decoded_instruction (void );
drivers/bios_emulator/x86emu/decode.c +12 -12
@@ -303,7 +303,7 @@ NOTE: Do not inline this function as (*sys_rdX) is already inline!u8 fetch_data_byte (uint offset) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access ((u16 )get_data_segment (), offset);#endif
@@ -322,7 +322,7 @@ NOTE: Do not inline this function as (*sys_rdX) is already inline!u16 fetch_data_word (uint offset) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access ((u16 )get_data_segment (), offset);#endif
@@ -341,7 +341,7 @@ NOTE: Do not inline this function as (*sys_rdX) is already inline!u32 fetch_data_long (uint offset) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access ((u16 )get_data_segment (), offset);#endif
@@ -362,7 +362,7 @@ u8 fetch_data_byte_abs( uint segment, uint offset) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access (segment, offset);#endif
@@ -383,7 +383,7 @@ u16 fetch_data_word_abs( uint segment, uint offset) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access (segment, offset);#endif
@@ -404,7 +404,7 @@ u32 fetch_data_long_abs( uint segment, uint offset) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access (segment, offset);#endif
@@ -426,7 +426,7 @@ void store_data_byte( uint offset, u8 val) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access ((u16 )get_data_segment (), offset);#endif
@@ -448,7 +448,7 @@ void store_data_word( uint offset, u16 val) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access ((u16 )get_data_segment (), offset);#endif
@@ -470,7 +470,7 @@ void store_data_long( uint offset, u32 val) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access ((u16 )get_data_segment (), offset);#endif
@@ -493,7 +493,7 @@ void store_data_byte_abs( uint offset, u8 val) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access (segment, offset);#endif
@@ -516,7 +516,7 @@ void store_data_word_abs( uint offset, u16 val) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access (segment, offset);#endif
@@ -539,7 +539,7 @@ void store_data_long_abs( uint offset, u32 val) { -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (CHECK_DATA_ACCESS ())x86emu_check_data_access (segment, offset);#endif
drivers/bios_emulator/x86emu/ops.c +14 -14
@@ -79,7 +79,7 @@/* constant arrays to do several instructions in just one function */ -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG static char *x86emu_GenOpName[8 ] = {"ADD" ,"OR" ,"ADC" ,"SBB" ,"AND" ,"SUB" ,"XOR" ,"CMP" };#endif
@@ -160,7 +160,7 @@ static u32 (*opcD1_long_operation[])(u32 s, u8 d) = sar_long, }; -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG static char *opF6_names[8 ] = {"TEST\t" ,"" ,"NOT\t" ,"NEG\t" ,"MUL\t" ,"IMUL\t" ,"DIV\t" ,"IDIV\t" };
@@ -1281,7 +1281,7 @@ void x86emuOp_opc80_byte_RM_IMM(u8 X86EMU_UNUSED(op1))*/ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -1359,7 +1359,7 @@ void x86emuOp_opc81_word_RM_IMM(u8 X86EMU_UNUSED(op1))*/ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -1475,7 +1475,7 @@ void x86emuOp_opc82_byte_RM_IMM(u8 X86EMU_UNUSED(op1))*/ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -1551,7 +1551,7 @@ void x86emuOp_opc83_word_RM_IMM(u8 X86EMU_UNUSED(op1))*/ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -3083,7 +3083,7 @@ void x86emuOp_opcC0_byte_RM_MEM(u8 X86EMU_UNUSED(op1))*/ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -3158,7 +3158,7 @@ void x86emuOp_opcC1_word_RM_MEM(u8 X86EMU_UNUSED(op1))*/ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -3630,7 +3630,7 @@ void x86emuOp_opcD0_byte_RM_1(u8 X86EMU_UNUSED(op1))*/ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -3701,7 +3701,7 @@ void x86emuOp_opcD1_word_RM_1(u8 X86EMU_UNUSED(op1))*/ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -3803,7 +3803,7 @@ void x86emuOp_opcD2_byte_RM_CL(u8 X86EMU_UNUSED(op1))*/ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -3876,7 +3876,7 @@ void x86emuOp_opcD3_word_RM_CL(u8 X86EMU_UNUSED(op1))*/ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -4859,7 +4859,7 @@ void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))/* Yet another special case instruction. */ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
@@ -4923,7 +4923,7 @@ void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))/* Yet another special case instruction. */ START_OF_INSTR ();FETCH_DECODE_MODRM (mod, rh, rl); -#ifdef DEBUG +#ifdef CONFIG_X86EMU_DEBUG if (DEBUG_DECODE ()) {/* XXX DECODE_PRINTF may be changed to something more general, so that it is important to leave the strings
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 16/19 bios_emulator: Add an option to enable debugging
Quoted 9 lines · Simon Glass
At present there are DEBUG options spread around the place. If you enable one and not another you can end up with an emulator that does not work, since each file can have a different view of what the registers look like. To fix this, create a global
CONFIG_X86EMU_DEBUGoption that keeps everything consistent.Signed-off-by Simon Glass <[email protected]>---
Quoted 10 lines
drivers/bios_emulator/besys.c | 64 ++++++++++++++++++++++------ drivers/bios_emulator/bios.c | 4 +- drivers/bios_emulator/biosemui.h | 2 +- drivers/bios_emulator/include/x86emu.h | 2 +- drivers/bios_emulator/include/x86emu/debug.h | 16 +++---- drivers/bios_emulator/include/x86emu/regs.h | 2 +- drivers/bios_emulator/x86emu/debug.c | 2 +- drivers/bios_emulator/x86emu/decode.c | 24 +++++------ drivers/bios_emulator/x86emu/ops.c | 28 ++++++------ 9 files changed, 90 insertions(+), 54 deletions(-)
Applied to u-boot-x86.
PATCH 17/19 bios_emulator: Always print errors when opcode decode fails
In reply to Simon GlassThis is a rare event and should not happen. When it does it is confusing to work out why. At least we should print a message.
Adjust the emulator to always print decode errors to the console.
---
drivers/bios_emulator/include/x86emu/debug.h | 6 +++++- drivers/bios_emulator/x86emu/ops.c | 30 ++++++++++++++-------------- drivers/bios_emulator/x86emu/ops2.c | 4 ++-- 3 files changed, 22 insertions(+), 18 deletions(-)
drivers/bios_emulator/include/x86emu/debug.h +5 -1
@@ -99,7 +99,11 @@# define DEBUG_DECODE_NOPRINT () 0#endif -#ifdef CONFIG_X86EMU_DEBUG +# define ERR_PRINTF (x) printf(x) +# define ERR_PRINTF2 (x, y) printf(x, y) + +#ifdef CONFIG_X86EMU_DEBUG103 +# define DECODE_PRINTF (x) if (DEBUG_DECODE()) \ x86emu_decode_printf(x)
drivers/bios_emulator/x86emu/ops.c +15 -15
@@ -179,7 +179,7 @@ void x86emuOp_illegal_op( {START_OF_INSTR ();if (M .x86.R_SP !=0 ) { -DECODE_PRINTF ("ILLEGAL X86 OPCODE\n" ); +ERR_PRINTF ("ILLEGAL X86 OPCODE\n" );TRACE_REGS ();DB (printk ("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n" ,M .x86.R_CS,M .x86.R_IP-1 ,op1));
@@ -2148,7 +2148,7 @@ void x86emuOp_pop_RM(u8 X86EMU_UNUSED(op1))DECODE_PRINTF ("POP\t" );FETCH_DECODE_MODRM (mod, rh, rl);if (rh !=0 ) { -DECODE_PRINTF ("ILLEGAL DECODE OF OPCODE 8F\n" ); +ERR_PRINTF ("ILLEGAL DECODE OF OPCODE 8F\n" );HALT_SYS (); }if (mod <3 ) {
@@ -3347,7 +3347,7 @@ void x86emuOp_mov_byte_RM_IMM(u8 X86EMU_UNUSED(op1))DECODE_PRINTF ("MOV\t" );FETCH_DECODE_MODRM (mod, rh, rl);if (rh !=0 ) { -DECODE_PRINTF ("ILLEGAL DECODE OF OPCODE c6\n" ); +ERR_PRINTF ("ILLEGAL DECODE OF OPCODE c6\n" );HALT_SYS (); }if (mod <3 ) {
@@ -3381,7 +3381,7 @@ void x86emuOp_mov_word_RM_IMM(u8 X86EMU_UNUSED(op1))DECODE_PRINTF ("MOV\t" );FETCH_DECODE_MODRM (mod, rh, rl);if (rh !=0 ) { -DECODE_PRINTF ("ILLEGAL DECODE OF OPCODE 8F\n" ); +ERR_PRINTF ("ILLEGAL DECODE OF OPCODE 8F\n" );HALT_SYS (); }if (mod <3 ) {
@@ -3968,7 +3968,7 @@ void x86emuOp_aam(u8 X86EMU_UNUSED(op1))DECODE_PRINTF ("AAM\n" ); a =fetch_byte_imm ();/* this is a stupid encoding. */ if (a !=10 ) { -DECODE_PRINTF ("ERROR DECODING AAM\n" ); +ERR_PRINTF ("ERROR DECODING AAM\n" );TRACE_REGS ();HALT_SYS (); }
@@ -4443,7 +4443,7 @@ void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))test_byte (destval, srcval);break ;case 1 : -DECODE_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F6\n" ); +ERR_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F6\n" );HALT_SYS ();break ;case 2 :
@@ -4490,7 +4490,7 @@ void x86emuOp_opcF6_byte_RM(u8 X86EMU_UNUSED(op1))test_byte (*destreg, srcval);break ;case 1 : -DECODE_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F6\n" ); +ERR_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F6\n" );HALT_SYS ();break ;case 2 :
@@ -4559,7 +4559,7 @@ void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))test_long (destval, srcval);break ;case 1 : -DECODE_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F7\n" ); +ERR_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F7\n" );HALT_SYS ();break ;case 2 :
@@ -4611,7 +4611,7 @@ void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))test_word (destval, srcval);break ;case 1 : -DECODE_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F7\n" ); +ERR_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F7\n" );HALT_SYS ();break ;case 2 :
@@ -4666,7 +4666,7 @@ void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))test_long (*destreg, srcval);break ;case 1 : -DECODE_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F6\n" ); +ERR_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F6\n" );HALT_SYS ();break ;case 2 :
@@ -4715,7 +4715,7 @@ void x86emuOp_opcF7_word_RM(u8 X86EMU_UNUSED(op1))test_word (*destreg, srcval);break ;case 1 : -DECODE_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F6\n" ); +ERR_PRINTF ("ILLEGAL OP MOD=00 RH=01 OP=F6\n" );HALT_SYS ();break ;case 2 :
@@ -4879,7 +4879,7 @@ void x86emuOp_opcFE_byte_RM(u8 X86EMU_UNUSED(op1))case 5 :case 6 :case 7 : -DECODE_PRINTF2 ("ILLEGAL OP MAJOR OP 0xFE MINOR OP %x \n" , mod); +ERR_PRINTF2 ("ILLEGAL OP MAJOR OP 0xFE MINOR OP %x\n" , mod);HALT_SYS ();break ; }
@@ -4961,7 +4961,7 @@ void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))DECODE_PRINTF ("PUSH\t" );break ;case 7 : -DECODE_PRINTF ("ILLEGAL DECODING OF OPCODE FF\t" ); +ERR_PRINTF ("ILLEGAL DECODING OF OPCODE FF\t" );HALT_SYS ();break ; }
@@ -5092,7 +5092,7 @@ void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))M .x86.R_IP = *destreg;break ;case 3 :/* jmp far ptr ... */ -DECODE_PRINTF ("OPERATION UNDEFINED 0XFF \n" ); +ERR_PRINTF ("OPERATION UNDEFINED 0XFF\n" );TRACE_AND_STEP ();HALT_SYS ();break ;
@@ -5104,7 +5104,7 @@ void x86emuOp_opcFF_word_RM(u8 X86EMU_UNUSED(op1))M .x86.R_IP = (u16) (*destreg);break ;case 5 :/* jmp far ptr ... */ -DECODE_PRINTF ("OPERATION UNDEFINED 0XFF \n" ); +ERR_PRINTF ("OPERATION UNDEFINED 0XFF\n" );TRACE_AND_STEP ();HALT_SYS ();break ;
drivers/bios_emulator/x86emu/ops2.c +2 -2
@@ -58,7 +58,7 @@ void x86emuOp2_illegal_op( u8 op2) {START_OF_INSTR (); -DECODE_PRINTF ("ILLEGAL EXTENDED X86 OPCODE\n" ); +ERR_PRINTF ("ILLEGAL EXTENDED X86 OPCODE\n" );TRACE_REGS ();printk ("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n" ,M .x86.R_CS,M .x86.R_IP-2 ,op2);
@@ -1089,7 +1089,7 @@ void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))DECODE_PRINTF ("BTC\t" );break ;default : -DECODE_PRINTF ("ILLEGAL EXTENDED X86 OPCODE\n" ); +ERR_PRINTF ("ILLEGAL EXTENDED X86 OPCODE\n" );TRACE_REGS ();printk ("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n" ,M .x86.R_CS,M .x86.R_IP-3 ,op2, (mod<<6 )|(rh<<3 )|rl);
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 17/19 bios_emulator: Always print errors when opcode decode fails
Quoted 5 lines · Simon Glass
This is a rare event and should not happen. When it does it is confusing to work out why. At least we should print a message.
Adjust the emulator to always print decode errors to the console.
Quoted 7 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/include/x86emu/debug.h | 6 +++++- drivers/bios_emulator/x86emu/ops.c | 30 ++++++++++++++-------------- drivers/bios_emulator/x86emu/ops2.c | 4 ++-- 3 files changed, 22 insertions(+), 18 deletions(-)
Applied to u-boot-x86.
PATCH 18/19 x86: chromebook_link: Enable the x86 emulator
In reply to Simon GlassEnable this so that it can be used instead of native execution if desired.
---
include/configs/chromebook_link.h | 4 ++++ 1 file changed, 4 insertions(+)
include/configs/chromebook_link.h +4 -0
@@ -58,6 +58,10 @@#define CONFIG_SYS_EARLY_PCI_INIT #define CONFIG_PCI_PNP +#define CONFIG_BIOSEMU +#define VIDEO_IO_OFFSET 0 +#define CONFIG_X86EMU_RAW_IO +#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,vga,serial\0" \ "stdout=vga,serial\0" \ "stderr=vga,serial\0"
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 18/19 x86: chromebook_link: Enable the x86 emulator
Quoted 7 lines · Simon Glass
Enable this so that it can be used instead of native execution if desired.
Signed-off-by Simon Glass <[email protected]>---
include/configs/chromebook_link.h | 4 ++++ 1 file changed, 4 insertions(+)
Applied to u-boot-x86.
PATCH 19/19 x86: chromebook_link: Enable the Chrome OS EC
In reply to Simon GlassEnable the Chrome OS EC so that it can be used from U-Boot.
---
board/google/chromebook_link/link.c | 4 ++++ include/configs/chromebook_link.h | 5 +++++ 2 files changed, 9 insertions(+)
board/google/chromebook_link/link.c +4 -0
@@ -5,10 +5,14 @@*/ #include <common.h> +#include <cros_ec.h> #include <asm/gpio.h> int arch_early_init_r (void ) { +if (cros_ec_board_init ()) +return -1 ; +return 0 ; }
include/configs/chromebook_link.h +5 -0
@@ -62,6 +62,11 @@#define VIDEO_IO_OFFSET 0#define CONFIG_X86EMU_RAW_IO +#define CONFIG_CROS_EC +#define CONFIG_CROS_EC_LPC +#define CONFIG_CMD_CROS_EC +#define CONFIG_ARCH_EARLY_INIT_R +#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,vga,serial\0" \ "stdout=vga,serial\0" \ "stderr=vga,serial\0"
Signature · 1 line
2.1.0.rc2.206.gedb03e5
PATCH 19/19 x86: chromebook_link: Enable the Chrome OS EC
Quoted 8 lines · Simon Glass
Enable the Chrome OS EC so that it can be used from U-Boot.
Signed-off-by Simon Glass <[email protected]>---
board/google/chromebook_link/link.c | 4 ++++ include/configs/chromebook_link.h | 5 +++++ 2 files changed, 9 insertions(+)
Applied to u-boot-x86.