x86: Add generic VESA video driver
Subsystems (3)
cover x86: Add generic VESA video driver
This series introduces a generic VESA video driver and adjusts the generic PCI ROM support to support it. It also fixes up some problems which prevent this from working on PowerPC at present.
It is now possible to use VESA graphics:
- On PowerPC, using the x86 emulator
- On x86, using either the x86 emulator or native code execution
As it turns out, on the only platform I have tested (link), the x86 emulator is only slightly slower that native code execution (200ms difference). Still, we may as well leave this feature in there.
VGA ROMs are a very old technology but they are still used by modern platforms, including at least link and some Atom designs.
Simon Glass (10):
bios_emulator: Fix an #ifdef typo in the header file
x86: Correct endianness isues in pci_rom
x86: Support ROMs on other archs
bios_emulator: Don't display error when emulator terminates
bios_emulator: Add some VESA interface debugging
x86: pci: Don't stop when we get a vendor/device mismatch
x86: Add a VESA video driver
x86: Drop the x86_fb driver
x86: Access the VGA ROM when needed
RFC: Test code for glacier PCI video support
arch/x86/include/asm/u-boot-x86.h | 2 + drivers/bios_emulator/atibios.c | 161 +++++++++++++++++++++++---- drivers/bios_emulator/include/x86emu/debug.h | 2 +- drivers/bios_emulator/x86emu/ops.c | 2 +- drivers/pci/pci_auto.c | 28 ++++- drivers/pci/pci_rom.c | 40 ++++--- drivers/video/Makefile | 2 +- drivers/video/vesa_fb.c | 64 +++++++++++ drivers/video/x86_fb.c | 38 ------- include/configs/canyonlands.h | 31 ++++++ include/configs/chromebook_link.h | 2 +- include/pci.h | 9 ++ include/pci_rom.h | 1 - include/vbe.h | 9 +- 14 files changed, 312 insertions(+), 79 deletions(-) create mode 100644 drivers/video/vesa_fb.c delete mode 100644 drivers/video/x86_fb.c
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 1/10 bios_emulator: Fix an #ifdef typo in the header file
This stops the debug mode from working properly.
---
drivers/bios_emulator/include/x86emu/debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bios_emulator/include/x86emu/debug.h +1 -1
@@ -102,7 +102,7 @@# define ERR_PRINTF (x) printf(x)# define ERR_PRINTF2 (x, y) printf(x, y) -#ifdef CONFIG_X86EMU_DEBUG103 +#ifdef CONFIG_X86EMU_DEBUG # define DECODE_PRINTF (x) if (DEBUG_DECODE()) \
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 1/10 bios_emulator: Fix an #ifdef typo in the header file
Quoted 13 lines · Simon Glass
This stops the debug mode from working properly.
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/include/x86emu/debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/bios_emulator/include/x86emu/debug.h +0
-0
drivers/bios_emulator/include/x86emu/debug.h
Quoted 9 lines
drivers/bios_emulator/include/x86emu/debug.h +1
-2@@ -102,7 +102,7 @@# define ERR_PRINTF (x) printf(x)# define ERR_PRINTF2 (x, y) printf(x, y) -#ifdef CONFIG_X86EMU_DEBUG103 +#ifdef CONFIG_X86EMU_DEBUG # define DECODE_PRINTF (x) if (DEBUG_DECODE()) \ --
PATCH 1/10 bios_emulator: Fix an #ifdef typo in the header file
Quoted 18 lines · Bin Meng
Quoted 16 lines · Simon Glass
This stops the debug mode from working properly.
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/include/x86emu/debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/bios_emulator/include/x86emu/debug.h +0
-0@@ -102,7 +102,7 @@# define ERR_PRINTF (x) printf(x)# define ERR_PRINTF2 (x, y) printf(x, y)
Quoted 8 lines
drivers/bios_emulator/include/x86emu/debug.h
Quoted 6 lines
drivers/bios_emulator/include/x86emu/debug.h +1
-2-#ifdef CONFIG_X86EMU_DEBUG103 +#ifdef CONFIG_X86EMU_DEBUG # define DECODE_PRINTF (x) if (DEBUG_DECODE()) \ --Reviewed-by Bin Meng <[email protected]>
Applied to u-boot-x86.
PATCH 2/10 x86: Correct endianness isues in pci_rom
In reply to Simon GlassThis code is too x86-dependent at present. Correct it so that it can run on big-endian machines.
---
drivers/pci/pci_rom.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/pci/pci_rom.c +14 -11
@@ -66,6 +66,7 @@ static int pci_rom_probe(pci_dev_t dev, uint class,struct pci_rom_header *rom_header;struct pci_rom_data *rom_data;u16 vendor, device; +u16 rom_vendor, rom_device;u32 vendev;u32 mapped_vendev;u32 rom_address;
@@ -95,25 +96,27 @@ static int pci_rom_probe(pci_dev_t dev, uint class, rom_header = (struct pci_rom_header *)rom_address;debug ("PCI expansion ROM, signature %#04x, INIT size %#04x, data ptr %#04x\n" , -le32_to_cpu (rom_header->signature), - rom_header->size *512 ,le32_to_cpu (rom_header->data)); +le16_to_cpu (rom_header->signature), + rom_header->size *512 ,le16_to_cpu (rom_header->data)); -if (le32_to_cpu (rom_header->signature) !=PCI_ROM_HDR ) { +if (le16_to_cpu (rom_header->signature) !=PCI_ROM_HDR ) {printf ("Incorrect expansion ROM header signature %04x\n" , -le32_to_cpu (rom_header->signature)); +le16_to_cpu (rom_header->signature));return -EINVAL ; } - rom_data = (((void *)rom_header) +le32_to_cpu (rom_header->data)); + rom_data = (((void *)rom_header) +le16_to_cpu (rom_header->data)); + rom_vendor =le16_to_cpu (rom_data->vendor); + rom_device =le16_to_cpu (rom_data->device);debug ("PCI ROM image, vendor ID %04x, device ID %04x,\n" , - rom_data->vendor, rom_data->device); + rom_vendor, rom_device);/* If the device id is mapped, a mismatch is expected */ -if ((vendor != rom_data->vendor || device != rom_data->device) && +if ((vendor != rom_vendor || device != rom_device) && (vendev == mapped_vendev)) {printf ("ID mismatch: vendor ID %04x, device ID %04x\n" , - rom_data->vendor, rom_data->device); + rom_vendor, rom_device);return -EPERM ; }
@@ -144,10 +147,10 @@ int pci_rom_load(uint16_t class, struct pci_rom_header *rom_header, image_size); rom_data = (struct pci_rom_data *)((void *)rom_header + -le32_to_cpu (rom_header->data)); +le16_to_cpu (rom_header->data)); - image_size =le32_to_cpu (rom_data->ilen) *512 ; - }while ((rom_data->type !=0 ) && (rom_data->indicator !=0 )); + image_size =le16_to_cpu (rom_data->ilen) *512 ; + }while ((rom_data->type !=0 ) && (rom_data->indicator ==0 ));if (rom_data->type !=0 )return -EACCES ;
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 2/10 x86: Correct endianness isues in pci_rom
Quoted 62 lines · Simon Glass
This code is too x86-dependent at present. Correct it so that it can run on big-endian machines.
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_rom.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)drivers/pci/pci_rom.c +11
-9@@ -66,6 +66,7 @@ static int pci_rom_probe(pci_dev_t dev, uint class,struct pci_rom_header *rom_header;struct pci_rom_data *rom_data;u16 vendor, device; +u16 rom_vendor, rom_device;u32 vendev;u32 mapped_vendev;u32 rom_address;@@ -95,25 +96,27 @@ static int pci_rom_probe(pci_dev_t dev, uint class, rom_header = (struct pci_rom_header *)rom_address;debug ("PCI expansion ROM, signature %#04x, INIT size %#04x, data ptr %#04x\n" , -le32_to_cpu (rom_header->signature), - rom_header->size *512 ,le32_to_cpu (rom_header->data)); +le16_to_cpu (rom_header->signature), + rom_header->size *512 ,le16_to_cpu (rom_header->data)); -if (le32_to_cpu (rom_header->signature) !=PCI_ROM_HDR ) { +if (le16_to_cpu (rom_header->signature) !=PCI_ROM_HDR ) {printf ("Incorrect expansion ROM header signature %04x\n" , -le32_to_cpu (rom_header->signature)); +le16_to_cpu (rom_header->signature));return -EINVAL ; } - rom_data = (((void *)rom_header) +le32_to_cpu (rom_header->data)); + rom_data = (((void *)rom_header) +le16_to_cpu (rom_header->data)); + rom_vendor =le16_to_cpu (rom_data->vendor); + rom_device =le16_to_cpu (rom_data->device);debug ("PCI ROM image, vendor ID %04x, device ID %04x,\n" , - rom_data->vendor, rom_data->device); + rom_vendor, rom_device);/* If the device id is mapped, a mismatch is expected */ -if ((vendor != rom_data->vendor || device != rom_data->device) && +if ((vendor != rom_vendor || device != rom_device) && (vendev == mapped_vendev)) {printf ("ID mismatch: vendor ID %04x, device ID %04x\n" , - rom_data->vendor, rom_data->device); + rom_vendor, rom_device);return -EPERM ; }@@ -144,10 +147,10 @@ int pci_rom_load(uint16_t class, struct pci_rom_header *rom_header, image_size); rom_data = (struct pci_rom_data *)((void *)rom_header + -le32_to_cpu (rom_header->data));
drivers/pci/pci_rom.c int pci_rom_load(uint16_t class, struct pci_rom_header *rom_header,
Quoted 10 lines
drivers/pci/pci_rom.c +3
-3+ le16_to_cpu(rom_header->data)); - image_size =le32_to_cpu (rom_data->ilen) *512 ; - }while ((rom_data->type !=0 ) && (rom_data->indicator !=0 )); + image_size =le16_to_cpu (rom_data->ilen) *512 ; + }while ((rom_data->type !=0 ) && (rom_data->indicator ==0 ));if (rom_data->type !=0 )return -EACCES ; --
PATCH 2/10 x86: Correct endianness isues in pci_rom
Quoted 9 lines · Bin Meng
Quoted 8 lines · Simon Glass
This code is too x86-dependent at present. Correct it so that it can run on big-endian machines.
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_rom.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
Applied to u-boot-x86.
PATCH 3/10 x86: Support ROMs on other archs
In reply to Simon GlassWe shouldn't assume that the VGA ROM can always be loaded at c0000. This is only true on x86 machines.
---
arch/x86/include/asm/u-boot-x86.h | 2 ++ drivers/pci/pci_rom.c | 6 ++++++ include/pci_rom.h | 1 - 3 files changed, 8 insertions(+), 1 deletion(-)
arch/x86/include/asm/u-boot-x86.h +2 -0
@@ -70,4 +70,6 @@ uint64_t timer_get_tsc(void);void quick_ram_check (void ); +#define PCI_VGA_RAM_IMAGE_START 0xc0000 +#endif /* _U_BOOT_I386_H_ */
drivers/pci/pci_rom.c +6 -0
@@ -157,7 +157,13 @@ int pci_rom_load(uint16_t class, struct pci_rom_header *rom_header, rom_size = rom_header->size *512 ; +#ifdef PCI_VGA_RAM_IMAGE_START target = (void *)PCI_VGA_RAM_IMAGE_START ; +#else + target = (void *)malloc (rom_size); +if (!target) +return -ENOMEM ; +#endif if (target != rom_header) {ulong start =get_timer (0 );
include/pci_rom.h +0 -1
@@ -8,7 +8,6 @@#define _PCI_ROM_H#define PCI_ROM_HDR 0xaa55 -#define PCI_VGA_RAM_IMAGE_START 0xc0000struct pci_rom_header {uint16_t signature;
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 3/10 x86: Support ROMs on other archs
Quoted 45 lines · Simon Glass
We shouldn't assume that the VGA ROM can always be loaded at c0000. This is only true on x86 machines.
Signed-off-by Simon Glass <[email protected]>---
arch/x86/include/asm/u-boot-x86.h | 2 ++ drivers/pci/pci_rom.c | 6 ++++++ include/pci_rom.h | 1 - 3 files changed, 8 insertions(+), 1 deletion(-)arch/x86/include/asm/u-boot-x86.h +2
-0@@ -70,4 +70,6 @@ uint64_t timer_get_tsc(void);void quick_ram_check (void ); +#define PCI_VGA_RAM_IMAGE_START 0xc0000 +#endif /* _U_BOOT_I386_H_ */ drivers/pci/pci_rom.c +6
-0@@ -157,7 +157,13 @@ int pci_rom_load(uint16_t class, struct pci_rom_header *rom_header, rom_size = rom_header->size *512 ; +#ifdef PCI_VGA_RAM_IMAGE_START target = (void *)PCI_VGA_RAM_IMAGE_START ; +#else + target = (void *)malloc (rom_size); +if (!target) +return -ENOMEM ; +#endif if (target != rom_header) {ulong start =get_timer (0 );include/pci_rom.h +0
-0
include/pci_rom.h
Quoted 8 lines
include/pci_rom.h +0
-2@@ -8,7 +8,6 @@#define _PCI_ROM_H#define PCI_ROM_HDR 0xaa55 -#define PCI_VGA_RAM_IMAGE_START 0xc0000struct pci_rom_header {uint16_t signature; --
PATCH 3/10 x86: Support ROMs on other archs
Quoted 11 lines · Bin Meng
Quoted 10 lines · Simon Glass
We shouldn't assume that the VGA ROM can always be loaded at c0000. This is only true on x86 machines.
Signed-off-by Simon Glass <[email protected]>---
arch/x86/include/asm/u-boot-x86.h | 2 ++ drivers/pci/pci_rom.c | 6 ++++++ include/pci_rom.h | 1 - 3 files changed, 8 insertions(+), 1 deletion(-)
Applied to u-boot-x86.
PATCH 4/10 bios_emulator: Don't display error when emulator terminates
In reply to Simon GlassAs it turns out this is a normal condition, so suppress the error.
---
drivers/bios_emulator/x86emu/ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bios_emulator/x86emu/ops.c +1 -1
@@ -179,7 +179,7 @@ void x86emuOp_illegal_op( {START_OF_INSTR ();if (M .x86.R_SP !=0 ) { -ERR_PRINTF ("ILLEGAL X86 OPCODE\n" ); +DB (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));
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 4/10 bios_emulator: Don't display error when emulator terminates
Quoted 8 lines · Simon Glass
As it turns out this is a normal condition, so suppress the error.
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/x86emu/ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-x86.
PATCH 5/10 bios_emulator: Add some VESA interface debugging
In reply to Simon GlassAllow the supported modes to be listed when in debug mode.
---
drivers/bios_emulator/atibios.c | 161 +++++++++++++++++++++++++++++++++++----- include/vbe.h | 9 ++- 2 files changed, 148 insertions(+), 22 deletions(-)
drivers/bios_emulator/atibios.c +141 -20
@@ -62,40 +62,158 @@ 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) +/* Addres im memory of VBE region */ +const int vbe_offset =0x2000 ; + +static const void *bios_ptr (const void *buf,BE_VGAInfo *vga_info, +u32 x86_dword_ptr) +{ +u32 seg_ofs, flat; + + seg_ofs =le32_to_cpu (x86_dword_ptr); + flat = ((seg_ofs &0xffff0000 ) >>12 ) | (seg_ofs &0xffff ); +if (flat >=0xc0000 ) +return vga_info->BIOSImage + flat -0xc0000 ; +else +return buf + (flat - vbe_offset); +} + +static int atibios_debug_mode (BE_VGAInfo *vga_info,RMREGS *regs, +int vesa_mode,struct vbe_mode_info *mode_info) +{ +void *buffer = (void *)(M .mem_base + vbe_offset); +u16 buffer_seg = (((unsigned long )vbe_offset) >>4 ) &0xff00 ; +u16 buffer_adr = ((unsigned long )vbe_offset) &0xffff ; +struct vesa_mode_info *vm; +struct vbe_info *info; +const u16 *modes_bios, *ptr; +u16 *modes; +int size; + +debug ("VBE: Getting information\n" ); + regs->e.eax =VESA_GET_INFO ; + regs->e.esi = buffer_seg; + regs->e.edi = buffer_adr; + info = buffer; +memset (info,'\0' ,sizeof (*info)); +strcpy (info->signature,"VBE2" ); +BE_int86 (0x10 , regs, regs); +if (regs->e.eax !=0x4f ) { +debug ("VESA_GET_INFO: error %x\n" , regs->e.eax); +return -ENOSYS ; + } +debug ("version %x\n" ,le16_to_cpu (info->version)); +debug ("oem '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->oem_string_ptr)); +debug ("vendor '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->vendor_name_ptr)); +debug ("product '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->product_name_ptr)); +debug ("rev '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->product_rev_ptr)); + modes_bios =bios_ptr (buffer, vga_info, info->modes_ptr); +debug ("Modes: " ); +for (ptr = modes_bios; *ptr !=0xffff ; ptr++) +debug ("%x " ,le16_to_cpu (*ptr)); +debug ("\nmemory %dMB\n" ,le16_to_cpu (info->total_memory) >>4 ); + size = (ptr - modes_bios) *sizeof (u16) +2 ; + modes =malloc (size); +if (!modes) +return -ENOMEM ; +memcpy (modes, modes_bios, size); + + regs->e.eax =VESA_GET_CUR_MODE ; +BE_int86 (0x10 , regs, regs); +if (regs->e.eax !=0x4f ) { +debug ("VESA_GET_CUR_MODE: error %x\n" , regs->e.eax); +return -ENOSYS ; + } +debug ("Current mode %x\n" , regs->e.ebx); + +for (ptr = modes; *ptr !=0xffff ; ptr++) { +int mode =le16_to_cpu (*ptr); +bool linear_ok; +int attr; + +break ; +debug ("Mode %x: " , mode); +memset (buffer,'\0' ,sizeof (struct vbe_mode_info )); + regs->e.eax =VESA_GET_MODE_INFO ; + regs->e.ebx =0 ; + regs->e.ecx = mode; + regs->e.edx =0 ; + regs->e.esi = buffer_seg; + regs->e.edi = buffer_adr; +BE_int86 (0x10 , regs, regs); +if (regs->e.eax !=0x4f ) { +debug ("VESA_GET_MODE_INFO: error %x\n" , regs->e.eax); +continue ; + } +memcpy (mode_info->mode_info_block, buffer, +sizeof (struct vesa_mode_info )); + mode_info->valid = true; + vm = &mode_info->vesa; + attr =le16_to_cpu (vm->mode_attributes); + linear_ok = attr &0x80 ; +debug ("res %d x %d, %d bpp, mm %d, (Linear %s, attr %02x)\n" , +le16_to_cpu (vm->x_resolution), +le16_to_cpu (vm->y_resolution), + vm->bits_per_pixel, vm->memory_model, + linear_ok ?"OK" :"not available" , + attr); +debug ("\tRGB pos=%d,%d,%d, size=%d,%d,%d\n" , + vm->red_mask_pos, vm->green_mask_pos, vm->blue_mask_pos, + vm->red_mask_size, vm->green_mask_size, + vm->blue_mask_size); + } + +return 0 ; +} + +static int atibios_set_vesa_mode (RMREGS *regs,int vesa_mode, +struct vbe_mode_info *mode_info) { +void *buffer = (void *)(M .mem_base + vbe_offset); +u16 buffer_seg = (((unsigned long )vbe_offset) >>4 ) &0xff00 ; +u16 buffer_adr = ((unsigned long )vbe_offset) &0xffff ; +struct vesa_mode_info *vm; +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; +/* request linear framebuffer mode and don't clear display */ + regs->e.ebx |= (1 <<14 ) | (1 <<15 );BE_int86 (0x10 , regs, regs); +if (regs->e.eax !=0x4f ) { +debug ("VESA_SET_MODE: error %x\n" , regs->e.eax); +return -ENOSYS ; + } -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 ; +memset (buffer,'\0' ,sizeof (struct vbe_mode_info )); +debug ("VBE: Geting info for VESA mode %#04x\n" , vesa_mode); 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); +if (regs->e.eax !=0x4f ) { +debug ("VESA_GET_MODE_INFO: error %x\n" , regs->e.eax); +return -ENOSYS ; + } +memcpy (mode_info->mode_info_block, buffer, -sizeof (struct vbe_mode_info )); +sizeof (struct vesa_mode_info )); mode_info->valid = true; + mode_info->video_mode = vesa_mode; + vm = &mode_info->vesa; + vm->x_resolution =le16_to_cpu (vm->x_resolution); + vm->y_resolution =le16_to_cpu (vm->y_resolution); + vm->bytes_per_scanline =le16_to_cpu (vm->bytes_per_scanline); + vm->phys_base_ptr =le32_to_cpu (vm->phys_base_ptr); + vm->mode_attributes =le16_to_cpu (vm->mode_attributes); +debug ("VBE: Init complete\n" ); - 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); +return 0 ; }/****************************************************************************
@@ -132,6 +250,9 @@ static void PCI_doBIOSPOST(pci_dev_t pcidev, BE_VGAInfo *vga_info,/*Cleanup and exit*/ BE_getVGA (vga_info); +/* Useful for debugging */ +if (0 ) +atibios_debug_mode (vga_info, ®s, vesa_mode, mode_info);if (vesa_mode !=-1 )atibios_set_vesa_mode (®s, vesa_mode, mode_info); }
include/vbe.h +7 -2
@@ -35,10 +35,14 @@ struct __packed screen_info_input {struct __packed vbe_info {char signature[4 ];u16 version; -u8 *oem_string_ptr; +u32 oem_string_ptr;u32 capabilities; -u16 video_mode_list[256 ]; +u32 modes_ptr;u16 total_memory; +u16 oem_version; +u32 vendor_name_ptr; +u32 product_name_ptr; +u32 product_rev_ptr; };struct __packed vesa_mode_info {
@@ -96,6 +100,7 @@ struct vbe_ddc_info {#define VESA_GET_INFO 0x4f00#define VESA_GET_MODE_INFO 0x4f01#define VESA_SET_MODE 0x4f02 +#define VESA_GET_CUR_MODE 0x4f03struct graphic_device ;int vbe_get_video_info (struct graphic_device *gdev);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 5/10 bios_emulator: Add some VESA interface debugging
Quoted 8 lines · Simon Glass
Allow the supported modes to be listed when in debug mode.
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/atibios.c | 161 +++++++++++++++++++++++++++++++++++----- include/vbe.h | 9 ++- 2 files changed, 148 insertions(+), 22 deletions(-)
Applied to u-boot-x86.
PATCH 5/10 bios_emulator: Add some VESA interface debugging
In reply to Simon GlassQuoted 83 lines · Simon Glass
Allow the supported modes to be listed when in debug mode.
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/atibios.c | 161 +++++++++++++++++++++++++++++++++++----- include/vbe.h | 9 ++- 2 files changed, 148 insertions(+), 22 deletions(-)drivers/bios_emulator/atibios.c +64
-2@@ -62,40 +62,158 @@ 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) +/* Addres im memory of VBE region */ +const int vbe_offset =0x2000 ; + +static const void *bios_ptr (const void *buf,BE_VGAInfo *vga_info, +u32 x86_dword_ptr) +{ +u32 seg_ofs, flat; + + seg_ofs =le32_to_cpu (x86_dword_ptr); + flat = ((seg_ofs &0xffff0000 ) >>12 ) | (seg_ofs &0xffff ); +if (flat >=0xc0000 ) +return vga_info->BIOSImage + flat -0xc0000 ; +else +return buf + (flat - vbe_offset); +} + +static int atibios_debug_mode (BE_VGAInfo *vga_info,RMREGS *regs, +int vesa_mode,struct vbe_mode_info *mode_info) +{ +void *buffer = (void *)(M .mem_base + vbe_offset); +u16 buffer_seg = (((unsigned long )vbe_offset) >>4 ) &0xff00 ; +u16 buffer_adr = ((unsigned long )vbe_offset) &0xffff ; +struct vesa_mode_info *vm; +struct vbe_info *info; +const u16 *modes_bios, *ptr; +u16 *modes; +int size; + +debug ("VBE: Getting information\n" ); + regs->e.eax =VESA_GET_INFO ; + regs->e.esi = buffer_seg; + regs->e.edi = buffer_adr; + info = buffer; +memset (info,'\0' ,sizeof (*info)); +strcpy (info->signature,"VBE2" ); +BE_int86 (0x10 , regs, regs); +if (regs->e.eax !=0x4f ) { +debug ("VESA_GET_INFO: error %x\n" , regs->e.eax); +return -ENOSYS ; + } +debug ("version %x\n" ,le16_to_cpu (info->version)); +debug ("oem '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->oem_string_ptr)); +debug ("vendor '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->vendor_name_ptr)); +debug ("product '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->product_name_ptr)); +debug ("rev '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->product_rev_ptr)); + modes_bios =bios_ptr (buffer, vga_info, info->modes_ptr); +debug ("Modes: " ); +for (ptr = modes_bios; *ptr !=0xffff ; ptr++) +debug ("%x " ,le16_to_cpu (*ptr)); +debug ("\nmemory %dMB\n" ,le16_to_cpu (info->total_memory) >>4 ); + size = (ptr - modes_bios) *sizeof (u16) +2 ; + modes =malloc (size); +if (!modes) +return -ENOMEM ; +memcpy (modes, modes_bios, size); + + regs->e.eax =VESA_GET_CUR_MODE ; +BE_int86 (0x10 , regs, regs); +if (regs->e.eax !=0x4f ) { +debug ("VESA_GET_CUR_MODE: error %x\n" , regs->e.eax);
drivers/bios_emulator/atibios.c static u32 saveBaseAddress14; · line 138
Quoted 10 lines
drivers/bios_emulator/atibios.c +10
-0+return -ENOSYS ; + } +debug ("Current mode %x\n" , regs->e.ebx); + +for (ptr = modes; *ptr !=0xffff ; ptr++) { +int mode =le16_to_cpu (*ptr); +bool linear_ok; +int attr; + +break ;
There is a lot of dead code following. Has this break been left over from debugging? Or should the whole loop be eliminated?
Best regards
Heinrich
Quoted 139 lines
drivers/bios_emulator/atibios.c +67
-18+debug ("Mode %x: " , mode); +memset (buffer,'\0' ,sizeof (struct vbe_mode_info )); + regs->e.eax =VESA_GET_MODE_INFO ; + regs->e.ebx =0 ; + regs->e.ecx = mode; + regs->e.edx =0 ; + regs->e.esi = buffer_seg; + regs->e.edi = buffer_adr; +BE_int86 (0x10 , regs, regs); +if (regs->e.eax !=0x4f ) { +debug ("VESA_GET_MODE_INFO: error %x\n" , regs->e.eax); +continue ; + } +memcpy (mode_info->mode_info_block, buffer, +sizeof (struct vesa_mode_info )); + mode_info->valid = true; + vm = &mode_info->vesa; + attr =le16_to_cpu (vm->mode_attributes); + linear_ok = attr &0x80 ; +debug ("res %d x %d, %d bpp, mm %d, (Linear %s, attr %02x)\n" , +le16_to_cpu (vm->x_resolution), +le16_to_cpu (vm->y_resolution), + vm->bits_per_pixel, vm->memory_model, + linear_ok ?"OK" :"not available" , + attr); +debug ("\tRGB pos=%d,%d,%d, size=%d,%d,%d\n" , + vm->red_mask_pos, vm->green_mask_pos, vm->blue_mask_pos, + vm->red_mask_size, vm->green_mask_size, + vm->blue_mask_size); + } + +return 0 ; +} + +static int atibios_set_vesa_mode (RMREGS *regs,int vesa_mode, +struct vbe_mode_info *mode_info) { +void *buffer = (void *)(M .mem_base + vbe_offset); +u16 buffer_seg = (((unsigned long )vbe_offset) >>4 ) &0xff00 ; +u16 buffer_adr = ((unsigned long )vbe_offset) &0xffff ; +struct vesa_mode_info *vm; +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; +/* request linear framebuffer mode and don't clear display */ + regs->e.ebx |= (1 <<14 ) | (1 <<15 );BE_int86 (0x10 , regs, regs); +if (regs->e.eax !=0x4f ) { +debug ("VESA_SET_MODE: error %x\n" , regs->e.eax); +return -ENOSYS ; + } -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 ; +memset (buffer,'\0' ,sizeof (struct vbe_mode_info )); +debug ("VBE: Geting info for VESA mode %#04x\n" , vesa_mode); 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); +if (regs->e.eax !=0x4f ) { +debug ("VESA_GET_MODE_INFO: error %x\n" , regs->e.eax); +return -ENOSYS ; + } +memcpy (mode_info->mode_info_block, buffer, -sizeof (struct vbe_mode_info )); +sizeof (struct vesa_mode_info )); mode_info->valid = true; + mode_info->video_mode = vesa_mode; + vm = &mode_info->vesa; + vm->x_resolution =le16_to_cpu (vm->x_resolution); + vm->y_resolution =le16_to_cpu (vm->y_resolution); + vm->bytes_per_scanline =le16_to_cpu (vm->bytes_per_scanline); + vm->phys_base_ptr =le32_to_cpu (vm->phys_base_ptr); + vm->mode_attributes =le16_to_cpu (vm->mode_attributes); +debug ("VBE: Init complete\n" ); - 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); +return 0 ; }/**************************************************************************** @@ -132,6 +250,9 @@ static void PCI_doBIOSPOST(pci_dev_t pcidev, BE_VGAInfo *vga_info,/*Cleanup and exit*/ BE_getVGA (vga_info); +/* Useful for debugging */ +if (0 ) +atibios_debug_mode (vga_info, ®s, vesa_mode, mode_info);if (vesa_mode !=-1 )atibios_set_vesa_mode (®s, vesa_mode, mode_info); }include/vbe.h +7
-2@@ -35,10 +35,14 @@ struct __packed screen_info_input {struct __packed vbe_info {char signature[4 ];u16 version; -u8 *oem_string_ptr; +u32 oem_string_ptr;u32 capabilities; -u16 video_mode_list[256 ]; +u32 modes_ptr;u16 total_memory; +u16 oem_version; +u32 vendor_name_ptr; +u32 product_name_ptr; +u32 product_rev_ptr; };struct __packed vesa_mode_info {@@ -96,6 +100,7 @@ struct vbe_ddc_info {#define VESA_GET_INFO 0x4f00#define VESA_GET_MODE_INFO 0x4f01#define VESA_SET_MODE 0x4f02 +#define VESA_GET_CUR_MODE 0x4f03struct graphic_device ;int vbe_get_video_info (struct graphic_device *gdev);
PATCH 5/10 bios_emulator: Add some VESA interface debugging
Hi Heinrich,
Quoted 90 lines · Heinrich Schuchardt
Quoted 88 lines · Simon Glass
Allow the supported modes to be listed when in debug mode.
Signed-off-by Simon Glass <[email protected]>---
drivers/bios_emulator/atibios.c | 161 +++++++++++++++++++++++++++++++++++----- include/vbe.h | 9 ++- 2 files changed, 148 insertions(+), 22 deletions(-)drivers/bios_emulator/atibios.c +69
-2@@ -62,40 +62,158 @@ 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) +/* Addres im memory of VBE region */ +const int vbe_offset =0x2000 ; + +static const void *bios_ptr (const void *buf,BE_VGAInfo *vga_info, +u32 x86_dword_ptr) +{ +u32 seg_ofs, flat; + + seg_ofs =le32_to_cpu (x86_dword_ptr); + flat = ((seg_ofs &0xffff0000 ) >>12 ) | (seg_ofs &0xffff ); +if (flat >=0xc0000 ) +return vga_info->BIOSImage + flat -0xc0000 ; +else +return buf + (flat - vbe_offset); +} + +static int atibios_debug_mode (BE_VGAInfo *vga_info,RMREGS *regs, +int vesa_mode,struct vbe_mode_info *mode_info) +{ +void *buffer = (void *)(M .mem_base + vbe_offset); +u16 buffer_seg = (((unsigned long )vbe_offset) >>4 ) &0xff00 ; +u16 buffer_adr = ((unsigned long )vbe_offset) &0xffff ; +struct vesa_mode_info *vm; +struct vbe_info *info; +const u16 *modes_bios, *ptr; +u16 *modes; +int size; + +debug ("VBE: Getting information\n" ); + regs->e.eax =VESA_GET_INFO ; + regs->e.esi = buffer_seg; + regs->e.edi = buffer_adr; + info = buffer; +memset (info,'\0' ,sizeof (*info)); +strcpy (info->signature,"VBE2" ); +BE_int86 (0x10 , regs, regs); +if (regs->e.eax !=0x4f ) { +debug ("VESA_GET_INFO: error %x\n" , regs->e.eax); +return -ENOSYS ; + } +debug ("version %x\n" ,le16_to_cpu (info->version)); +debug ("oem '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->oem_string_ptr)); +debug ("vendor '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->vendor_name_ptr)); +debug ("product '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->product_name_ptr)); +debug ("rev '%s'\n" , (char *)bios_ptr (buffer, vga_info, + info->product_rev_ptr)); + modes_bios =bios_ptr (buffer, vga_info, info->modes_ptr); +debug ("Modes: " ); +for (ptr = modes_bios; *ptr !=0xffff ; ptr++) +debug ("%x " ,le16_to_cpu (*ptr)); +debug ("\nmemory %dMB\n" ,le16_to_cpu (info->total_memory) >>4 ); + size = (ptr - modes_bios) *sizeof (u16) +2 ; + modes =malloc (size); +if (!modes) +return -ENOMEM ; +memcpy (modes, modes_bios, size); + + regs->e.eax =VESA_GET_CUR_MODE ; +BE_int86 (0x10 , regs, regs); +if (regs->e.eax !=0x4f ) { +debug ("VESA_GET_CUR_MODE: error %x\n" , regs->e.eax); +return -ENOSYS ; + } +debug ("Current mode %x\n" , regs->e.ebx); + +for (ptr = modes; *ptr !=0xffff ; ptr++) {
Quoted 8 lines
drivers/bios_emulator/atibios.c static u32 saveBaseAddress14; · line 138
Quoted 5 lines
drivers/bios_emulator/atibios.c +5
-0+int mode =le16_to_cpu (*ptr); +bool linear_ok; +int attr; + +break ;There is a lot of dead code following. Has this break been left over from debugging? Or should the whole loop be eliminated?
Yes the break should be removed. This is debug code for printing out the modes.
Regards,
Simon
PATCH 6/10 x86: pci: Don't stop when we get a vendor/device mismatch
In reply to Simon GlassThese are quite common and we may as well press on and not be so picky.
---
drivers/pci/pci_rom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci_rom.c +1 -1
@@ -117,7 +117,7 @@ static int pci_rom_probe(pci_dev_t dev, uint class, (vendev == mapped_vendev)) {printf ("ID mismatch: vendor ID %04x, device ID %04x\n" , rom_vendor, rom_device); -return -EPERM ; +/* Continue anyway */ } debug("PCI ROM image, Class Code %04x%02x, Code Type %02x\n",
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 6/10 x86: pci: Don't stop when we get a vendor/device mismatch
Quoted 13 lines · Simon Glass
These are quite common and we may as well press on and not be so picky.
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_rom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/pci_rom.c +0
-0
drivers/pci/pci_rom.c static int pci_rom_probe(pci_dev_t dev, uint class,
Quoted 9 lines
drivers/pci/pci_rom.c +1
-2@@ -117,7 +117,7 @@ static int pci_rom_probe(pci_dev_t dev, uint class, (vendev == mapped_vendev)) {printf ("ID mismatch: vendor ID %04x, device ID %04x\n" , rom_vendor, rom_device); -return -EPERM ; +/* Continue anyway */ } debug("PCI ROM image, Class Code %04x%02x, Code Type %02x\n", --
PATCH 6/10 x86: pci: Don't stop when we get a vendor/device mismatch
Quoted 8 lines · Bin Meng
Quoted 7 lines · Simon Glass
These are quite common and we may as well press on and not be so picky.
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_rom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-x86.
PATCH 7/10 x86: Add a VESA video driver
In reply to Simon GlassAdd a driver intended to cope with any VESA-compatible x86 graphics adapter. It will not support ROMs which use OpenFirmware (Forth) since there is no support for that in U-Boot. This means that MAC OS cards will not work.
---
drivers/video/Makefile | 1 + drivers/video/vesa_fb.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 drivers/video/vesa_fb.c
drivers/video/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o obj-$(CONFIG_VIDEO_TEGRA) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o +obj-$(CONFIG_VIDEO_VESA) += vesa_fb.o obj-$(CONFIG_VIDEO_X86) += x86_fb.o obj-$(CONFIG_FORMIKE) += formike.o obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
drivers/video/vesa_fb.c new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 7/10 x86: Add a VESA video driver
Quoted 5 lines · Simon Glass
Add a driver intended to cope with any VESA-compatible x86 graphics adapter. It will not support ROMs which use OpenFirmware (Forth) since there is no support for that in U-Boot. This means that MAC OS cards will not work.
Quoted 7 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/video/Makefile | 1 + drivers/video/vesa_fb.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 drivers/video/vesa_fb.c
Rebased and added Kconfig info which was required to make this build as expected.
Applied to u-boot-x86.
PATCH 8/10 x86: Drop the x86_fb driver
In reply to Simon GlassNow that we have a full VESA driver we may as well use that. We need to support the VESA layer being set up by early start-up code or by running a VGA ROM.
---
drivers/video/Makefile | 1 - drivers/video/x86_fb.c | 38 -------------------------------------- include/configs/chromebook_link.h | 2 +- 3 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 drivers/video/x86_fb.c
drivers/video/Makefile +0 -1
@@ -47,7 +47,6 @@ obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o obj-$(CONFIG_VIDEO_TEGRA) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_VIDEO_VESA) += vesa_fb.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 deleted +0 -38
@@ -1,38 +0,0 @@ -/* -* -* 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); -debug ("Frame buffer at %x\n" , gdev->frameAdrs); - -return (void *)gdev; -}
include/configs/chromebook_link.h +1 -1
@@ -41,7 +41,7 @@#define CONFIG_X86_OPTION_ROM_FILE pci8086,0166.bin#define CONFIG_X86_OPTION_ROM_ADDR 0xfff90000 -#define CONFIG_VIDEO_X86 +#define CONFIG_VIDEO_VESA #define CONFIG_PCI_MEM_BUS 0xe0000000#define CONFIG_PCI_MEM_PHYS CONFIG_PCI_MEM_BUS
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 8/10 x86: Drop the x86_fb driver
Quoted 4 lines · Simon Glass
Now that we have a full VESA driver we may as well use that. We need to support the VESA layer being set up by early start-up code or by running a VGA ROM.
Quoted 8 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/video/Makefile | 1 - drivers/video/x86_fb.c | 38 -------------------------------------- include/configs/chromebook_link.h | 2 +- 3 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 drivers/video/x86_fb.c
Dropped the header file change and moved it to Kconfig, where this now resides since Bin's series was applied first.
Applied to u-boot-x86.
PATCH 9/10 x86: Access the VGA ROM when needed
In reply to Simon GlassAdd code to the generic pci_rom file to access the VGA ROM in PCI space when needed.
---
drivers/pci/pci_auto.c | 28 +++++++++++++++++++++++++++- drivers/pci/pci_rom.c | 7 ++++++- include/pci.h | 9 +++++++++ 3 files changed, 42 insertions(+), 2 deletions(-)
drivers/pci/pci_auto.c +27 -1
@@ -11,7 +11,7 @@*/ #include <common.h> - +#include <errno.h> #include <pci.h> #undef DEBUG
@@ -191,6 +191,32 @@ void pciauto_setup_device(struct pci_controller *hose,pci_hose_write_config_byte (hose, dev,PCI_LATENCY_TIMER ,0x80 ); } +int pciauto_setup_rom (struct pci_controller *hose,pci_dev_t dev) +{ +pci_addr_t bar_value; +pci_size_t bar_size; +u32 bar_response; +u16 cmdstat =0 ; + +pci_hose_write_config_dword (hose, dev,PCI_ROM_ADDRESS ,-2 ); +pci_hose_read_config_dword (hose, dev,PCI_ROM_ADDRESS , &bar_response); +if (!bar_response) +return -ENOENT ; + + bar_size = -(bar_response & ~1 ); +DEBUGF ("PCI Autoconfig: ROM, size=%#x, " , bar_size); +if (pciauto_region_allocate (hose->pci_mem, bar_size, &bar_value) ==0 ) { +pci_hose_write_config_dword (hose, dev,PCI_ROM_ADDRESS , + bar_value); + } +DEBUGF ("\n" ); +pci_hose_read_config_word (hose, dev,PCI_COMMAND , &cmdstat); + cmdstat |=PCI_COMMAND_IO |PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER ; +pci_hose_write_config_word (hose, dev,PCI_COMMAND , cmdstat); + +return 0 ; +} +void pciauto_prescan_setup_bridge (struct pci_controller *hose,pci_dev_t dev,int sub_bus) {
drivers/pci/pci_rom.c +6 -1
@@ -81,7 +81,12 @@ static int pci_rom_probe(pci_dev_t dev, uint class,#ifdef CONFIG_X86_OPTION_ROM_ADDR rom_address =CONFIG_X86_OPTION_ROM_ADDR ;#else -pci_write_config_dword (dev,PCI_ROM_ADDRESS , (u32 )PCI_ROM_ADDRESS_MASK ); + +if (pciauto_setup_rom (pci_bus_to_hose (PCI_BUS (dev)), dev)) { +debug ("Cannot find option ROM\n" ); +return -ENOENT ; + } +pci_read_config_dword (dev,PCI_ROM_ADDRESS , &rom_address);if (rom_address ==0x00000000 || rom_address ==0xffffffff ) {debug ("%s: rom_address=%x\n" , __func__, rom_address);
include/pci.h +9 -0
@@ -701,5 +701,14 @@ void pci_write_bar32(struct pci_controller *hose, pci_dev_t dev, int barnum,* */ u32 pci_read_bar32 (struct pci_controller *hose,pci_dev_t dev,int barnum); +/** +* pciauto_setup_rom() - Set up access to a device ROM +* +* @hose: PCI hose to use +* @dev: PCI device to adjust +* @return 0 if done, -ve on error +*/ +int pciauto_setup_rom (struct pci_controller *hose,pci_dev_t dev); +#endif /* __ASSEMBLY__ */ #endif /* _PCI_H */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 9/10 x86: Access the VGA ROM when needed
Hi Simon,
Quoted 33 lines · Simon Glass
Add code to the generic
pci_romfile to access the VGA ROM in PCI space when needed.Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_auto.c | 28 +++++++++++++++++++++++++++- drivers/pci/pci_rom.c | 7 ++++++- include/pci.h | 9 +++++++++ 3 files changed, 42 insertions(+), 2 deletions(-)drivers/pci/pci_auto.c +6
-1@@ -11,7 +11,7 @@*/ #include <common.h> - +#include <errno.h> #include <pci.h> #undef DEBUG@@ -191,6 +191,32 @@ void pciauto_setup_device(struct pci_controller *hose,pci_hose_write_config_byte (hose, dev,PCI_LATENCY_TIMER ,0x80 ); } +int pciauto_setup_rom (struct pci_controller *hose,pci_dev_t dev) +{ +pci_addr_t bar_value; +pci_size_t bar_size; +u32 bar_response;
drivers/pci/pci_auto.c void pciauto_setup_device(struct pci_controller *hose, · line 208
Quoted 10 lines
drivers/pci/pci_auto.c +10
-0+u16 cmdstat =0 ; + +pci_hose_write_config_dword (hose, dev,PCI_ROM_ADDRESS ,-2 ); +pci_hose_read_config_dword (hose, dev,PCI_ROM_ADDRESS , &bar_response); +if (!bar_response) +return -ENOENT ; + + bar_size = -(bar_response & ~1 ); +DEBUGF ("PCI Autoconfig: ROM, size=%#x, " , bar_size); +if (pciauto_region_allocate (hose->pci_mem, bar_size, &bar_value) ==0 ) {
Should we assume pci roms are always mapped using the pci_mem region? If not, maybe we can add another parameter 'region_type' to pciauto_setup_rom()?
Quoted 42 lines
drivers/pci/pci_auto.c +11
-0+pci_hose_write_config_dword (hose, dev,PCI_ROM_ADDRESS , + bar_value); + } +DEBUGF ("\n" ); +pci_hose_read_config_word (hose, dev,PCI_COMMAND , &cmdstat); + cmdstat |=PCI_COMMAND_IO |PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER ; +pci_hose_write_config_word (hose, dev,PCI_COMMAND , cmdstat); + +return 0 ; +} +void pciauto_prescan_setup_bridge (struct pci_controller *hose,pci_dev_t dev,int sub_bus) {drivers/pci/pci_rom.c +6
-1@@ -81,7 +81,12 @@ static int pci_rom_probe(pci_dev_t dev, uint class,#ifdef CONFIG_X86_OPTION_ROM_ADDR rom_address =CONFIG_X86_OPTION_ROM_ADDR ;#else -pci_write_config_dword (dev,PCI_ROM_ADDRESS , (u32 )PCI_ROM_ADDRESS_MASK ); + +if (pciauto_setup_rom (pci_bus_to_hose (PCI_BUS (dev)), dev)) { +debug ("Cannot find option ROM\n" ); +return -ENOENT ; + } +pci_read_config_dword (dev,PCI_ROM_ADDRESS , &rom_address);if (rom_address ==0x00000000 || rom_address ==0xffffffff ) {debug ("%s: rom_address=%x\n" , __func__, rom_address);include/pci.h +2
-0@@ -701,5 +701,14 @@ void pci_write_bar32(struct pci_controller *hose, pci_dev_t dev, int barnum,* */ u32 pci_read_bar32 (struct pci_controller *hose,pci_dev_t dev,int barnum); +/** +* pciauto_setup_rom() - Set up access to a device ROM
include/pci.h void pci_write_bar32(struct pci_controller *hose, pci_dev_t dev, int barnum,
Quoted 10 lines
include/pci.h +7
-1+* +* @hose: PCI hose to use +* @dev: PCI device to adjust +* @return 0 if done, -ve on error +*/ +int pciauto_setup_rom (struct pci_controller *hose,pci_dev_t dev); +#endif /* __ASSEMBLY__ */ #endif /* _PCI_H */ --
Regards,
Bin
PATCH 9/10 x86: Access the VGA ROM when needed
Hi Bin,
Quoted 42 lines · Bin Meng
Hi Simon,
Quoted 39 lines · Simon Glass
Add code to the generic
pci_romfile to access the VGA ROM in PCI space when needed.Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_auto.c | 28 +++++++++++++++++++++++++++- drivers/pci/pci_rom.c | 7 ++++++- include/pci.h | 9 +++++++++ 3 files changed, 42 insertions(+), 2 deletions(-)drivers/pci/pci_auto.c +12
-1@@ -11,7 +11,7 @@*/ #include <common.h> - +#include <errno.h> #include <pci.h> #undef DEBUG@@ -191,6 +191,32 @@ void pciauto_setup_device(struct pci_controller *hose,pci_hose_write_config_byte (hose, dev,PCI_LATENCY_TIMER ,0x80 ); } +int pciauto_setup_rom (struct pci_controller *hose,pci_dev_t dev) +{ +pci_addr_t bar_value; +pci_size_t bar_size; +u32 bar_response; +u16 cmdstat =0 ; + +pci_hose_write_config_dword (hose, dev,PCI_ROM_ADDRESS ,-2 ); +pci_hose_read_config_dword (hose, dev,PCI_ROM_ADDRESS , &bar_response); +if (!bar_response) +return -ENOENT ;
Quoted 8 lines
drivers/pci/pci_auto.c void pciauto_setup_device(struct pci_controller *hose, · line 208
Quoted 4 lines
drivers/pci/pci_auto.c +4
-0+ + bar_size = -(bar_response & ~1 ); +DEBUGF ("PCI Autoconfig: ROM, size=%#x, " , bar_size); +if (pciauto_region_allocate (hose->pci_mem, bar_size, &bar_value) ==0 ) {Should we assume pci roms are always mapped using the
pci_memregion? If not, maybe we can add another parameter 'region_type' topciauto_setup_rom()?
I'm not sure - do you think we should support the cacheable area too? Would that help?
Quoted 41 lines
Quoted 41 lines
drivers/pci/pci_auto.c +11
-0+pci_hose_write_config_dword (hose, dev,PCI_ROM_ADDRESS , + bar_value); + } +DEBUGF ("\n" ); +pci_hose_read_config_word (hose, dev,PCI_COMMAND , &cmdstat); + cmdstat |=PCI_COMMAND_IO |PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER ; +pci_hose_write_config_word (hose, dev,PCI_COMMAND , cmdstat); + +return 0 ; +} +void pciauto_prescan_setup_bridge (struct pci_controller *hose,pci_dev_t dev,int sub_bus) {drivers/pci/pci_rom.c +6
-1@@ -81,7 +81,12 @@ static int pci_rom_probe(pci_dev_t dev, uint class,#ifdef CONFIG_X86_OPTION_ROM_ADDR rom_address =CONFIG_X86_OPTION_ROM_ADDR ;#else -pci_write_config_dword (dev,PCI_ROM_ADDRESS , (u32 )PCI_ROM_ADDRESS_MASK ); + +if (pciauto_setup_rom (pci_bus_to_hose (PCI_BUS (dev)), dev)) { +debug ("Cannot find option ROM\n" ); +return -ENOENT ; + } +pci_read_config_dword (dev,PCI_ROM_ADDRESS , &rom_address);if (rom_address ==0x00000000 || rom_address ==0xffffffff ) {debug ("%s: rom_address=%x\n" , __func__, rom_address);include/pci.h +0
-0@@ -701,5 +701,14 @@ void pci_write_bar32(struct pci_controller *hose, pci_dev_t dev, int barnum,* */ u32 pci_read_bar32 (struct pci_controller *hose,pci_dev_t dev,int barnum);
Quoted 11 lines
include/pci.h void pci_write_bar32(struct pci_controller *hose, pci_dev_t dev, int barnum, · line 714
Quoted 11 lines
include/pci.h +9
-0+/** +* pciauto_setup_rom() - Set up access to a device ROM +* +* @hose: PCI hose to use +* @dev: PCI device to adjust +* @return 0 if done, -ve on error +*/ +int pciauto_setup_rom (struct pci_controller *hose,pci_dev_t dev); +#endif /* __ASSEMBLY__ */ #endif /* _PCI_H */
Regards,
Simon
PATCH 9/10 x86: Access the VGA ROM when needed
Hi Simon,
Quoted 34 lines · Simon Glass
Hi Bin,
Quoted 31 lines · Bin Meng
Hi Simon,
Quoted 28 lines · Simon Glass
Add code to the generic
pci_romfile to access the VGA ROM in PCI space when needed.Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_auto.c | 28 +++++++++++++++++++++++++++- drivers/pci/pci_rom.c | 7 ++++++- include/pci.h | 9 +++++++++ 3 files changed, 42 insertions(+), 2 deletions(-)drivers/pci/pci_auto.c +1
-1@@ -11,7 +11,7 @@*/ #include <common.h> - +#include <errno.h> #include <pci.h> #undef DEBUG@@ -191,6 +191,32 @@ void pciauto_setup_device(struct pci_controller *hose,pci_hose_write_config_byte (hose, dev,PCI_LATENCY_TIMER ,0x80 ); }
Quoted 8 lines
Quoted 8 lines
drivers/pci/pci_auto.c void pciauto_setup_device(struct pci_controller *hose, · line 201
Quoted 8 lines
drivers/pci/pci_auto.c +8
-0+int pciauto_setup_rom (struct pci_controller *hose,pci_dev_t dev) +{ +pci_addr_t bar_value; +pci_size_t bar_size; +u32 bar_response; +u16 cmdstat =0 ; + +pci_hose_write_config_dword (hose, dev,PCI_ROM_ADDRESS ,-2 );
I think it is better for people to understand if not writing -2.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
drivers/pci/pci_auto.c +7
-0+pci_hose_read_config_dword (hose, dev,PCI_ROM_ADDRESS , &bar_response); +if (!bar_response) +return -ENOENT ; + + bar_size = -(bar_response & ~1 ); +DEBUGF ("PCI Autoconfig: ROM, size=%#x, " , bar_size); +if (pciauto_region_allocate (hose->pci_mem, bar_size, &bar_value) ==0 ) {
Quoted 7 lines
Quoted 3 lines
Should we assume pci roms are always mapped using the
pci_memregion? If not, maybe we can add another parameter 'region_type' topciauto_setup_rom()?I'm not sure - do you think we should support the cacheable area too? Would that help?
I'm not sure either. I thought you might know more than me as so far I see pci rom is used for vga, ahci, pxe roms, and storage media for mac addresses on some ethernet cards. They all belong to pci_mem regions. Let's do it pci_mem and revisit it in the future if we see something different.
[snip]
Regards,
Bin
PATCH 9/10 x86: Access the VGA ROM when needed
Hi Bin,
Quoted 37 lines · Bin Meng
Hi Simon,
Quoted 34 lines · Simon Glass
Hi Bin,
Quoted 31 lines · Bin Meng
Hi Simon,
Quoted 28 lines · Simon Glass
Add code to the generic
pci_romfile to access the VGA ROM in PCI space when needed.Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_auto.c | 28 +++++++++++++++++++++++++++- drivers/pci/pci_rom.c | 7 ++++++- include/pci.h | 9 +++++++++ 3 files changed, 42 insertions(+), 2 deletions(-)drivers/pci/pci_auto.c +1
-1@@ -11,7 +11,7 @@*/ #include <common.h> - +#include <errno.h> #include <pci.h> #undef DEBUG@@ -191,6 +191,32 @@ void pciauto_setup_device(struct pci_controller *hose,pci_hose_write_config_byte (hose, dev,PCI_LATENCY_TIMER ,0x80 ); }
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
drivers/pci/pci_auto.c void pciauto_setup_device(struct pci_controller *hose, · line 201
Quoted 8 lines
drivers/pci/pci_auto.c +8
-0+int pciauto_setup_rom (struct pci_controller *hose,pci_dev_t dev) +{ +pci_addr_t bar_value; +pci_size_t bar_size; +u32 bar_response; +u16 cmdstat =0 ; + +pci_hose_write_config_dword (hose, dev,PCI_ROM_ADDRESS ,-2 );I think it is better for people to understand if not writing -2.
What should we use instead?
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
drivers/pci/pci_auto.c +7
-0+pci_hose_read_config_dword (hose, dev,PCI_ROM_ADDRESS , &bar_response); +if (!bar_response) +return -ENOENT ; + + bar_size = -(bar_response & ~1 ); +DEBUGF ("PCI Autoconfig: ROM, size=%#x, " , bar_size); +if (pciauto_region_allocate (hose->pci_mem, bar_size, &bar_value) ==0 ) {Quoted 7 lines
Quoted 3 lines
Should we assume pci roms are always mapped using the
pci_memregion? If not, maybe we can add another parameter 'region_type' topciauto_setup_rom()?I'm not sure - do you think we should support the cacheable area too? Would that help?
Quoted 5 lines
I'm not sure either. I thought you might know more than me as so far I see pci rom is used for vga, ahci, pxe roms, and storage media for mac addresses on some ethernet cards. They all belong to
pci_memregions. Let's do itpci_memand revisit it in the future if we see something different.
OK.
Regards,
Simon
PATCH 9/10 x86: Access the VGA ROM when needed
Hi Simon,
Quoted 51 lines · Simon Glass
Hi Bin,
Quoted 37 lines · Bin Meng
Hi Simon,
Quoted 34 lines · Simon Glass
Hi Bin,
Quoted 31 lines · Bin Meng
Hi Simon,
Quoted 28 lines · Simon Glass
Add code to the generic
pci_romfile to access the VGA ROM in PCI space when needed.Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_auto.c | 28 +++++++++++++++++++++++++++- drivers/pci/pci_rom.c | 7 ++++++- include/pci.h | 9 +++++++++ 3 files changed, 42 insertions(+), 2 deletions(-)drivers/pci/pci_auto.c +1
-1@@ -11,7 +11,7 @@*/ #include <common.h> - +#include <errno.h> #include <pci.h> #undef DEBUG@@ -191,6 +191,32 @@ void pciauto_setup_device(struct pci_controller *hose,pci_hose_write_config_byte (hose, dev,PCI_LATENCY_TIMER ,0x80 ); }Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
drivers/pci/pci_auto.c void pciauto_setup_device(struct pci_controller *hose, · line 201
Quoted 8 lines
drivers/pci/pci_auto.c +8
-0+int pciauto_setup_rom (struct pci_controller *hose,pci_dev_t dev) +{ +pci_addr_t bar_value; +pci_size_t bar_size; +u32 bar_response; +u16 cmdstat =0 ; + +pci_hose_write_config_dword (hose, dev,PCI_ROM_ADDRESS ,-2 );I think it is better for people to understand if not writing -2.
Quoted 1 line
What should we use instead?
0xfffffffe
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 9 lines
drivers/pci/pci_auto.c void pciauto_setup_device(struct pci_controller *hose, · line 208
Quoted 8 lines
drivers/pci/pci_auto.c +7
-0+pci_hose_read_config_dword (hose, dev,PCI_ROM_ADDRESS , &bar_response); +if (!bar_response) +return -ENOENT ; + + bar_size = -(bar_response & ~1 ); +DEBUGF ("PCI Autoconfig: ROM, size=%#x, " , bar_size); +if (pciauto_region_allocate (hose->pci_mem, bar_size, &bar_value) ==0 ) {Quoted 3 lines
Should we assume pci roms are always mapped using the
pci_memregion? If not, maybe we can add another parameter 'region_type' topciauto_setup_rom()?I'm not sure - do you think we should support the cacheable area too? Would that help?
Quoted 8 lines
Quoted 5 lines
I'm not sure either. I thought you might know more than me as so far I see pci rom is used for vga, ahci, pxe roms, and storage media for mac addresses on some ethernet cards. They all belong to
pci_memregions. Let's do itpci_memand revisit it in the future if we see something different.OK.
Regards,
Bin
PATCH 10/10 RFC: Test code for glacier PCI video support
In reply to Simon GlassNOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
include/configs/canyonlands.h +31 -0
@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/
@@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \
@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE +#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Simon,
Quoted 8 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
Did you test a PCIe video card on chromebook_link? Looks like there are things we still need to do to support VGA rom on x86. In the bridge control (offset 0x3e) register of the PCI bridge, there is a VGA enable bit which currently U-Boot does not configure. I believe this will stop video card from working. However, so far I even cannot read the content of the VGA rom (all returns 0xFF) after I manually enabled this VGA enable bit. Do you know what may cause this?
[snip]
Regards,
Bin
PATCH 10/10 RFC: Test code for glacier PCI video support
In reply to Simon GlassHi Simon,
Quoted 56 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +23
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN
include/configs/canyonlands.h
Quoted 10 lines
include/configs/canyonlands.h +8
-1+#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE +#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --
Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
Regards,
Bin
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Bin,
Quoted 64 lines · Bin Meng
Hi Simon,
Quoted 61 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +28
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE
Quoted 8 lines
include/configs/canyonlands.h
Quoted 5 lines
include/configs/canyonlands.h +3
-1+#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
It is all there - I am using the existing support. If you see pci_run_vga_bios() it calls biosemu_run() in the emulation case.
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
For the ROM, pci_rom_load() works for me, after pciauto_setup_rom() is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.
Regards,
Simon
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Simon,
Quoted 76 lines · Simon Glass
Hi Bin,
Quoted 64 lines · Bin Meng
Hi Simon,
Quoted 61 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +28
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE Quoted 8 lines
include/configs/canyonlands.h
Quoted 5 lines
include/configs/canyonlands.h +3
-1+#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
Quoted 2 lines
It is all there - I am using the existing support. If you see
pci_run_vga_bios()it callsbiosemu_run()in the emulation case.
Sorry I mean the complete canyonlands codes which calls pci_run_vga_bios(). I see currently pci_run_vga_bios() is only called by chromebook_link. And do you think the int15_handler() required by the biosemu needs to be common?
Quoted 4 lines
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
Which platform do you use? I doubt the VGA enable bit only affects x86 as it opens the A0000 and I/O address decoding which is only applicable on x86.
Quoted 3 lines
For the ROM,
pci_rom_load()works for me, afterpciauto_setup_rom()is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.
Yes, I called pciauto_setup_rom() in my codes. I also verified the expansion ROM address register has bit0 set to 1 which means enabled.
Regards,
Bin
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Bin,
Quoted 79 lines · Bin Meng
Hi Simon,
Quoted 76 lines · Simon Glass
Hi Bin,
Quoted 72 lines · Bin Meng
Hi Simon,
Quoted 56 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +23
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN include/configs/canyonlands.h
Quoted 10 lines
include/configs/canyonlands.h +8
-1+#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE +#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
Quoted 7 lines
Quoted 2 lines
It is all there - I am using the existing support. If you see
pci_run_vga_bios()it callsbiosemu_run()in the emulation case.Sorry I mean the complete canyonlands codes which calls
pci_run_vga_bios(). I see currentlypci_run_vga_bios()is only called bychromebook_link. And do you think theint15_handler()required by the biosemu needs to be common?
This series is at u-boot-x86/vesa.
You can see the call from the vesa video driver, vesa_fb.c.
Re int15_handler(), yes I think it should be, but so far I haven't needed it.
I think the ROM access code can be made more common, but I left that task for now.
Quoted 9 lines
Quoted 5 lines
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
Which platform do you use? I doubt the VGA enable bit only affects x86 as it opens the A0000 and I/O address decoding which is only applicable on x86.
I'm only using glacier and link so far. I suspect there might be something wrong as only one of my video cards works fully on glacier - another once gives a snowy picture.
Quoted 7 lines
Quoted 4 lines
For the ROM,
pci_rom_load()works for me, afterpciauto_setup_rom()is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.Yes, I called
pciauto_setup_rom()in my codes. I also verified the expansion ROM address register has bit0 set to 1 which means enabled.
And you still can't see the ROM? Does the BAR give the correct ROM size? Do you enable memory access in the command register?
Regards,
Simon
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Simon,
Quoted 85 lines · Simon Glass
Hi Bin,
Quoted 82 lines · Bin Meng
Hi Simon,
Quoted 78 lines · Simon Glass
Hi Bin,
Quoted 64 lines · Bin Meng
Hi Simon,
Quoted 61 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +28
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE Quoted 8 lines
include/configs/canyonlands.h
Quoted 5 lines
include/configs/canyonlands.h +3
-1+#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
It is all there - I am using the existing support. If you see
pci_run_vga_bios()it callsbiosemu_run()in the emulation case.
Quoted 8 lines
Quoted 4 lines
Sorry I mean the complete canyonlands codes which calls
pci_run_vga_bios(). I see currentlypci_run_vga_bios()is only called bychromebook_link. And do you think theint15_handler()required by the biosemu needs to be common?This series is at u-boot-x86/vesa.
You can see the call from the vesa video driver,
vesa_fb.c.
Ah, I see. I can have a try on a non-x86 board.
Quoted 1 line
Re
int15_handler(), yes I think it should be, but so far I haven't needed it.
So what does int15_hander() normally do? I see the vesa_fb.c provided NULL for int15_handler, but the call in arch/x86/cpu/ivybridge/gma.c does not pass NULL.
Quoted 9 lines
I think the ROM access code can be made more common, but I left that task for now.
Quoted 6 lines
Quoted 5 lines
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
Quoted 7 lines
Quoted 3 lines
Which platform do you use? I doubt the VGA enable bit only affects x86 as it opens the A0000 and I/O address decoding which is only applicable on x86.
I'm only using glacier and link so far. I suspect there might be something wrong as only one of my video cards works fully on glacier - another once gives a snowy picture.
So VGA enable bit is unset on Link as well? That's interesting. When you mentioned two cards, did you insert them simultaneously? I believe only one card will work due to only one card will respond VGA cycles.
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
For the ROM,
pci_rom_load()works for me, afterpciauto_setup_rom()is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.Yes, I called
pciauto_setup_rom()in my codes. I also verified the expansion ROM address register has bit0 set to 1 which means enabled.And you still can't see the ROM? Does the BAR give the correct ROM size? Do you enable memory access in the command register?
I confirm the BAR gave the correct size and memory access in the command register is turned on (this is by U-Boot's pci enumeration process), but it still cannot. And finally I just figured it out the root cause. It turns out we cannot simply add an API pciauto_setup_rom() like this. It needs to setup the bridge's mem_base/mem_limit register pair in order to have the bridge claim the outbound memory window. That means calling pciauto_setup_rom() separately from pci_run_vga_rom() will not work as it does not touch the bridge registers. But I am wondering, why does it work on your glacier and link board? Is that because the pci controller on glacier and link ignore the values of mem_base/mem_limit? I don't believe it is the case since mem_base/mem_limit behavior is defined in PCI spec. Or this register pair on glacier and link is set up to a larger value which happened to cover the ROM space?
Regards,
Bin
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Bin,
Quoted 97 lines · Bin Meng
Hi Simon,
Quoted 85 lines · Simon Glass
Hi Bin,
Quoted 82 lines · Bin Meng
Hi Simon,
Quoted 78 lines · Simon Glass
Hi Bin,
Quoted 64 lines · Bin Meng
Hi Simon,
Quoted 61 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +28
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE Quoted 8 lines
include/configs/canyonlands.h
Quoted 5 lines
include/configs/canyonlands.h +3
-1+#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
It is all there - I am using the existing support. If you see
pci_run_vga_bios()it callsbiosemu_run()in the emulation case.Quoted 8 lines
Quoted 4 lines
Sorry I mean the complete canyonlands codes which calls
pci_run_vga_bios(). I see currentlypci_run_vga_bios()is only called bychromebook_link. And do you think theint15_handler()required by the biosemu needs to be common?This series is at u-boot-x86/vesa.
You can see the call from the vesa video driver,
vesa_fb.c.
Quoted 7 lines
Ah, I see. I can have a try on a non-x86 board.
Quoted 1 line
Re
int15_handler(), yes I think it should be, but so far I haven't needed it.So what does
int15_hander()normally do? I see thevesa_fb.cprovided NULL forint15_handler, but the call inarch/x86/cpu/ivybridge/gma.cdoes not pass NULL.
See the existing int15_handler() in that file. It allows selection of output device and scaling. I doubt it matters for most boards.
Quoted 14 lines
Quoted 14 lines
I think the ROM access code can be made more common, but I left that task for now.
Quoted 9 lines
Quoted 5 lines
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
Which platform do you use? I doubt the VGA enable bit only affects x86 as it opens the A0000 and I/O address decoding which is only applicable on x86.
Quoted 7 lines
Quoted 3 lines
I'm only using glacier and link so far. I suspect there might be something wrong as only one of my video cards works fully on glacier - another once gives a snowy picture.
So VGA enable bit is unset on Link as well? That's interesting. When you mentioned two cards, did you insert them simultaneously? I believe only one card will work due to only one card will respond VGA cycles.
No it's set on Link I believe - see bd82x6x_pci_bus_enable_resources().
I only used one card at a time.
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
For the ROM,
pci_rom_load()works for me, afterpciauto_setup_rom()is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.Yes, I called
pciauto_setup_rom()in my codes. I also verified the expansion ROM address register has bit0 set to 1 which means enabled.And you still can't see the ROM? Does the BAR give the correct ROM size? Do you enable memory access in the command register?
Quoted 14 lines
I confirm the BAR gave the correct size and memory access in the command register is turned on (this is by U-Boot's pci enumeration process), but it still cannot. And finally I just figured it out the root cause. It turns out we cannot simply add an API
pciauto_setup_rom()like this. It needs to setup the bridge's mem_base/mem_limit register pair in order to have the bridge claim the outbound memory window. That means callingpciauto_setup_rom()separately frompci_run_vga_rom()will not work as it does not touch the bridge registers. But I am wondering, why does it work on your glacier and link board? Is that because the pci controller on glacier and link ignore the values of mem_base/mem_limit? I don't believe it is the case since mem_base/mem_limit behavior is defined in PCI spec. Or this register pair on glacier and link is set up to a larger value which happened to cover the ROM space?
It did not work originally, but I was keen to separate the ROM enable from the rest of the PCI scan, because if we have a lot of ROMs we don't want to use up lots of memory space for them. Perhaps it isn't worth worrying about. I had problems along the lines of what you describe, but then the problems cleared up - I'm not quite sure exactly what happened. Yes it seems wrong to not set up the bridge property.
There is also the VGA I/O registers which we currently emulate, but could perhaps pass through to the card.
So do you have it working now?
Regards,
Simon
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Simon,
Quoted 102 lines · Simon Glass
Hi Bin,
Quoted 99 lines · Bin Meng
Hi Simon,
Quoted 85 lines · Simon Glass
Hi Bin,
Quoted 82 lines · Bin Meng
Hi Simon,
Quoted 78 lines · Simon Glass
Hi Bin,
Quoted 64 lines · Bin Meng
Hi Simon,
Quoted 61 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +28
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE Quoted 8 lines
include/configs/canyonlands.h
Quoted 5 lines
include/configs/canyonlands.h +3
-1+#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
It is all there - I am using the existing support. If you see
pci_run_vga_bios()it callsbiosemu_run()in the emulation case.Quoted 8 lines
Quoted 4 lines
Sorry I mean the complete canyonlands codes which calls
pci_run_vga_bios(). I see currentlypci_run_vga_bios()is only called bychromebook_link. And do you think theint15_handler()required by the biosemu needs to be common?This series is at u-boot-x86/vesa.
You can see the call from the vesa video driver,
vesa_fb.c.Ah, I see. I can have a try on a non-x86 board.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Re
int15_handler(), yes I think it should be, but so far I haven't needed it.So what does
int15_hander()normally do? I see thevesa_fb.cprovided NULL forint15_handler, but the call inarch/x86/cpu/ivybridge/gma.cdoes not pass NULL.See the existing
int15_handler()in that file. It allows selection of output device and scaling. I doubt it matters for most boards.
OK, so looks we should not make this int15_handler() common.
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
I think the ROM access code can be made more common, but I left that task for now.
Quoted 9 lines
Quoted 5 lines
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
Which platform do you use? I doubt the VGA enable bit only affects x86 as it opens the A0000 and I/O address decoding which is only applicable on x86.
I'm only using glacier and link so far. I suspect there might be something wrong as only one of my video cards works fully on glacier - another once gives a snowy picture.
Quoted 5 lines
Quoted 3 lines
So VGA enable bit is unset on Link as well? That's interesting. When you mentioned two cards, did you insert them simultaneously? I believe only one card will work due to only one card will respond VGA cycles.
No it's set on Link I believe - see
bd82x6x_pci_bus_enable_resources().
I don't see where does this bd82x6x_pci_bus_enable_resources() get called.
Quoted 29 lines
I only used one card at a time.
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
For the ROM,
pci_rom_load()works for me, afterpciauto_setup_rom()is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.Yes, I called
pciauto_setup_rom()in my codes. I also verified the expansion ROM address register has bit0 set to 1 which means enabled.And you still can't see the ROM? Does the BAR give the correct ROM size? Do you enable memory access in the command register?
Quoted 14 lines
I confirm the BAR gave the correct size and memory access in the command register is turned on (this is by U-Boot's pci enumeration process), but it still cannot. And finally I just figured it out the root cause. It turns out we cannot simply add an API
pciauto_setup_rom()like this. It needs to setup the bridge's mem_base/mem_limit register pair in order to have the bridge claim the outbound memory window. That means callingpciauto_setup_rom()separately frompci_run_vga_rom()will not work as it does not touch the bridge registers. But I am wondering, why does it work on your glacier and link board? Is that because the pci controller on glacier and link ignore the values of mem_base/mem_limit? I don't believe it is the case since mem_base/mem_limit behavior is defined in PCI spec. Or this register pair on glacier and link is set up to a larger value which happened to cover the ROM space?
Quoted 7 lines
It did not work originally, but I was keen to separate the ROM enable from the rest of the PCI scan, because if we have a lot of ROMs we don't want to use up lots of memory space for them. Perhaps it isn't worth worrying about. I had problems along the lines of what you describe, but then the problems cleared up - I'm not quite sure exactly what happened. Yes it seems wrong to not set up the bridge property.
Would you rework this pci rom support? Maybe in the PCI driver model series, that we use a device tree property (something like 'enable-rom' with a vendor id/device id pair to tell the enueration process that when it hit a vendor id/device id that mathes the dts it should enable the ROM and the enumeration process will automatically set up the mem_base/mem_limit for the bridge device automatically.
Quoted 2 lines
There is also the VGA I/O registers which we currently emulate, but could perhaps pass through to the card.
What do you mean by 'VGA I/O reigsters are emulated'?
Quoted 2 lines
So do you have it working now?
It is still not working on my Crown Bay board. The card's VGA rom does not execute properly. It hangs in the execution in both native mode and biosemu mode. Looks like we may still have an issue in the real mode stub, or the biosemu codes. Note this same video card works correctly with the AMI commercial BIOS.
Regards,
Bin
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Bin,
Quoted 134 lines · Bin Meng
Hi Simon,
Quoted 102 lines · Simon Glass
Hi Bin,
Quoted 99 lines · Bin Meng
Hi Simon,
Quoted 85 lines · Simon Glass
Hi Bin,
Quoted 82 lines · Bin Meng
Hi Simon,
Quoted 78 lines · Simon Glass
Hi Bin,
Quoted 64 lines · Bin Meng
Hi Simon,
Quoted 61 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +28
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE Quoted 8 lines
include/configs/canyonlands.h
Quoted 5 lines
include/configs/canyonlands.h +3
-1+#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
It is all there - I am using the existing support. If you see
pci_run_vga_bios()it callsbiosemu_run()in the emulation case.Quoted 8 lines
Quoted 4 lines
Sorry I mean the complete canyonlands codes which calls
pci_run_vga_bios(). I see currentlypci_run_vga_bios()is only called bychromebook_link. And do you think theint15_handler()required by the biosemu needs to be common?This series is at u-boot-x86/vesa.
You can see the call from the vesa video driver,
vesa_fb.c.Ah, I see. I can have a try on a non-x86 board.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Re
int15_handler(), yes I think it should be, but so far I haven't needed it.So what does
int15_hander()normally do? I see thevesa_fb.cprovided NULL forint15_handler, but the call inarch/x86/cpu/ivybridge/gma.cdoes not pass NULL.See the existing
int15_handler()in that file. It allows selection of output device and scaling. I doubt it matters for most boards.OK, so looks we should not make this
int15_handler()common.Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
I think the ROM access code can be made more common, but I left that task for now.
Quoted 9 lines
Quoted 5 lines
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
Which platform do you use? I doubt the VGA enable bit only affects x86 as it opens the A0000 and I/O address decoding which is only applicable on x86.
I'm only using glacier and link so far. I suspect there might be something wrong as only one of my video cards works fully on glacier - another once gives a snowy picture.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
So VGA enable bit is unset on Link as well? That's interesting. When you mentioned two cards, did you insert them simultaneously? I believe only one card will work due to only one card will respond VGA cycles.
No it's set on Link I believe - see
bd82x6x_pci_bus_enable_resources().I don't see where does this
bd82x6x_pci_bus_enable_resources()get called.
Actually neither do I, looks like an oversight.
Quoted 38 lines
Quoted 30 lines
I only used one card at a time.
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
For the ROM,
pci_rom_load()works for me, afterpciauto_setup_rom()is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.Yes, I called
pciauto_setup_rom()in my codes. I also verified the expansion ROM address register has bit0 set to 1 which means enabled.And you still can't see the ROM? Does the BAR give the correct ROM size? Do you enable memory access in the command register?
Quoted 14 lines
I confirm the BAR gave the correct size and memory access in the command register is turned on (this is by U-Boot's pci enumeration process), but it still cannot. And finally I just figured it out the root cause. It turns out we cannot simply add an API
pciauto_setup_rom()like this. It needs to setup the bridge's mem_base/mem_limit register pair in order to have the bridge claim the outbound memory window. That means callingpciauto_setup_rom()separately frompci_run_vga_rom()will not work as it does not touch the bridge registers. But I am wondering, why does it work on your glacier and link board? Is that because the pci controller on glacier and link ignore the values of mem_base/mem_limit? I don't believe it is the case since mem_base/mem_limit behavior is defined in PCI spec. Or this register pair on glacier and link is set up to a larger value which happened to cover the ROM space?Quoted 7 lines
It did not work originally, but I was keen to separate the ROM enable from the rest of the PCI scan, because if we have a lot of ROMs we don't want to use up lots of memory space for them. Perhaps it isn't worth worrying about. I had problems along the lines of what you describe, but then the problems cleared up - I'm not quite sure exactly what happened. Yes it seems wrong to not set up the bridge property.
Quoted 6 lines
Would you rework this pci rom support? Maybe in the PCI driver model series, that we use a device tree property (something like 'enable-rom' with a vendor id/device id pair to tell the enueration process that when it hit a vendor id/device id that mathes the dts it should enable the ROM and the enumeration process will automatically set up the mem_base/mem_limit for the bridge device automatically.
OK let's address that when I get back to it.
Quoted 6 lines
Quoted 3 lines
There is also the VGA I/O registers which we currently emulate, but could perhaps pass through to the card.
What do you mean by 'VGA I/O reigsters are emulated'?
Quoted 8 lines
Quoted 2 lines
So do you have it working now?
It is still not working on my Crown Bay board. The card's VGA rom does not execute properly. It hangs in the execution in both native mode and biosemu mode. Looks like we may still have an issue in the real mode stub, or the biosemu codes. Note this same video card works correctly with the AMI commercial BIOS.
I do have an updated BIOS emulator - there are some bugs in the current one. I'll see if I can post a (huge) patch. That might not be it though.
Some cards hang for ages waiting for a timer, and we don't emulate that properly.
Regards,
Simon
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Simon,
Quoted 141 lines · Simon Glass
Hi Bin,
Quoted 138 lines · Bin Meng
Hi Simon,
Quoted 102 lines · Simon Glass
Hi Bin,
Quoted 99 lines · Bin Meng
Hi Simon,
Quoted 85 lines · Simon Glass
Hi Bin,
Quoted 82 lines · Bin Meng
Hi Simon,
Quoted 78 lines · Simon Glass
Hi Bin,
Quoted 64 lines · Bin Meng
Hi Simon,
Quoted 61 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +28
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE Quoted 8 lines
include/configs/canyonlands.h
Quoted 5 lines
include/configs/canyonlands.h +3
-1+#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
It is all there - I am using the existing support. If you see
pci_run_vga_bios()it callsbiosemu_run()in the emulation case.Quoted 8 lines
Quoted 4 lines
Sorry I mean the complete canyonlands codes which calls
pci_run_vga_bios(). I see currentlypci_run_vga_bios()is only called bychromebook_link. And do you think theint15_handler()required by the biosemu needs to be common?This series is at u-boot-x86/vesa.
You can see the call from the vesa video driver,
vesa_fb.c.Ah, I see. I can have a try on a non-x86 board.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Re
int15_handler(), yes I think it should be, but so far I haven't needed it.So what does
int15_hander()normally do? I see thevesa_fb.cprovided NULL forint15_handler, but the call inarch/x86/cpu/ivybridge/gma.cdoes not pass NULL.See the existing
int15_handler()in that file. It allows selection of output device and scaling. I doubt it matters for most boards.OK, so looks we should not make this
int15_handler()common.Quoted 22 lines
Quoted 21 lines
Quoted 10 lines
I think the ROM access code can be made more common, but I left that task for now.
Quoted 6 lines
Quoted 5 lines
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
Quoted 7 lines
Quoted 3 lines
Which platform do you use? I doubt the VGA enable bit only affects x86 as it opens the A0000 and I/O address decoding which is only applicable on x86.
I'm only using glacier and link so far. I suspect there might be something wrong as only one of my video cards works fully on glacier - another once gives a snowy picture.
So VGA enable bit is unset on Link as well? That's interesting. When you mentioned two cards, did you insert them simultaneously? I believe only one card will work due to only one card will respond VGA cycles.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
No it's set on Link I believe - see
bd82x6x_pci_bus_enable_resources().I don't see where does this
bd82x6x_pci_bus_enable_resources()get called.Actually neither do I, looks like an oversight.
Ah, that's really interesting. So that means on the Link board the VGA enable bit (on Ivybridge PCH chipset) does not matter but the VGA card does work.
Quoted 38 lines
Quoted 38 lines
Quoted 37 lines
I only used one card at a time.
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
For the ROM,
pci_rom_load()works for me, afterpciauto_setup_rom()is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.Yes, I called
pciauto_setup_rom()in my codes. I also verified the expansion ROM address register has bit0 set to 1 which means enabled.And you still can't see the ROM? Does the BAR give the correct ROM size? Do you enable memory access in the command register?
Quoted 14 lines
I confirm the BAR gave the correct size and memory access in the command register is turned on (this is by U-Boot's pci enumeration process), but it still cannot. And finally I just figured it out the root cause. It turns out we cannot simply add an API
pciauto_setup_rom()like this. It needs to setup the bridge's mem_base/mem_limit register pair in order to have the bridge claim the outbound memory window. That means callingpciauto_setup_rom()separately frompci_run_vga_rom()will not work as it does not touch the bridge registers. But I am wondering, why does it work on your glacier and link board? Is that because the pci controller on glacier and link ignore the values of mem_base/mem_limit? I don't believe it is the case since mem_base/mem_limit behavior is defined in PCI spec. Or this register pair on glacier and link is set up to a larger value which happened to cover the ROM space?It did not work originally, but I was keen to separate the ROM enable from the rest of the PCI scan, because if we have a lot of ROMs we don't want to use up lots of memory space for them. Perhaps it isn't worth worrying about. I had problems along the lines of what you describe, but then the problems cleared up - I'm not quite sure exactly what happened. Yes it seems wrong to not set up the bridge property.
Quoted 9 lines
Quoted 6 lines
Would you rework this pci rom support? Maybe in the PCI driver model series, that we use a device tree property (something like 'enable-rom' with a vendor id/device id pair to tell the enueration process that when it hit a vendor id/device id that mathes the dts it should enable the ROM and the enumeration process will automatically set up the mem_base/mem_limit for the bridge device automatically.
OK let's address that when I get back to it.
Sounds good. I know Freescale PCI/PCIe controller has a separate register (not in configuration space) which controls the outbound window base/size which covers the memory-mapped registers and ROM space. If you get a card directly connected to the host controller, current way in your patch series will work. This is due to the controller ignores the mem_base/mem_limit settings and I would call this an implementation specific behavior. However as for as I see most standard bridge chipsets (like PLX series bridges) implement this correctly per the PCI spec. And I believe Intel's chipset also implements this per spec. That's why I see this does not work on Tunnel Creek. I suspect on canyonlands board the PCI host controller has something similar to the Freescale one and your video card is directly connected to the host controller so that you can get it work. But what I don't understand is you get it work on Link which is an x86 board.
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
There is also the VGA I/O registers which we currently emulate, but could perhaps pass through to the card.
What do you mean by 'VGA I/O reigsters are emulated'?
So I am still wondering what is the emulation you talked about?
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines
So do you have it working now?
It is still not working on my Crown Bay board. The card's VGA rom does not execute properly. It hangs in the execution in both native mode and biosemu mode. Looks like we may still have an issue in the real mode stub, or the biosemu codes. Note this same video card works correctly with the AMI commercial BIOS.
Quoted 7 lines
I do have an updated BIOS emulator - there are some bugs in the current one. I'll see if I can post a (huge) patch. That might not be it though.
Some cards hang for ages waiting for a timer, and we don't emulate that properly.
Could you elaborate more on this timer issue? Looks it affects both native and emulation modes. I will see if I can get a fix. Right now I don't have a clue and am stuck. I have to find another video card to test this series.
Regards,
Bin
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Bin,
Quoted 146 lines · Bin Meng
Hi Simon,
Quoted 143 lines · Simon Glass
Hi Bin,
Quoted 140 lines · Bin Meng
Hi Simon,
Quoted 102 lines · Simon Glass
Hi Bin,
Quoted 99 lines · Bin Meng
Hi Simon,
Quoted 85 lines · Simon Glass
Hi Bin,
Quoted 82 lines · Bin Meng
Hi Simon,
Quoted 78 lines · Simon Glass
Hi Bin,
Quoted 64 lines · Bin Meng
Hi Simon,
Quoted 61 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +28
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE Quoted 8 lines
include/configs/canyonlands.h
Quoted 5 lines
include/configs/canyonlands.h +3
-1+#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
It is all there - I am using the existing support. If you see
pci_run_vga_bios()it callsbiosemu_run()in the emulation case.Quoted 8 lines
Quoted 4 lines
Sorry I mean the complete canyonlands codes which calls
pci_run_vga_bios(). I see currentlypci_run_vga_bios()is only called bychromebook_link. And do you think theint15_handler()required by the biosemu needs to be common?This series is at u-boot-x86/vesa.
You can see the call from the vesa video driver,
vesa_fb.c.Ah, I see. I can have a try on a non-x86 board.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Re
int15_handler(), yes I think it should be, but so far I haven't needed it.So what does
int15_hander()normally do? I see thevesa_fb.cprovided NULL forint15_handler, but the call inarch/x86/cpu/ivybridge/gma.cdoes not pass NULL.See the existing
int15_handler()in that file. It allows selection of output device and scaling. I doubt it matters for most boards.OK, so looks we should not make this
int15_handler()common.Quoted 23 lines
Quoted 14 lines
Quoted 14 lines
I think the ROM access code can be made more common, but I left that task for now.
Quoted 9 lines
Quoted 5 lines
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
Which platform do you use? I doubt the VGA enable bit only affects x86 as it opens the A0000 and I/O address decoding which is only applicable on x86.
Quoted 7 lines
Quoted 3 lines
I'm only using glacier and link so far. I suspect there might be something wrong as only one of my video cards works fully on glacier - another once gives a snowy picture.
So VGA enable bit is unset on Link as well? That's interesting. When you mentioned two cards, did you insert them simultaneously? I believe only one card will work due to only one card will respond VGA cycles.
No it's set on Link I believe - see
bd82x6x_pci_bus_enable_resources().
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
I don't see where does this
bd82x6x_pci_bus_enable_resources()get called.Actually neither do I, looks like an oversight.
Ah, that's really interesting. So that means on the Link board the VGA enable bit (on Ivybridge PCH chipset) does not matter but the VGA card does work.
Well one point is that we don't have the frame buffer at 0xa0000. I'm not sure we care what is there.
Quoted 49 lines
Quoted 39 lines
Quoted 39 lines
Quoted 38 lines
I only used one card at a time.
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
For the ROM,
pci_rom_load()works for me, afterpciauto_setup_rom()is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.Yes, I called
pciauto_setup_rom()in my codes. I also verified the expansion ROM address register has bit0 set to 1 which means enabled.And you still can't see the ROM? Does the BAR give the correct ROM size? Do you enable memory access in the command register?
Quoted 14 lines
I confirm the BAR gave the correct size and memory access in the command register is turned on (this is by U-Boot's pci enumeration process), but it still cannot. And finally I just figured it out the root cause. It turns out we cannot simply add an API
pciauto_setup_rom()like this. It needs to setup the bridge's mem_base/mem_limit register pair in order to have the bridge claim the outbound memory window. That means callingpciauto_setup_rom()separately frompci_run_vga_rom()will not work as it does not touch the bridge registers. But I am wondering, why does it work on your glacier and link board? Is that because the pci controller on glacier and link ignore the values of mem_base/mem_limit? I don't believe it is the case since mem_base/mem_limit behavior is defined in PCI spec. Or this register pair on glacier and link is set up to a larger value which happened to cover the ROM space?It did not work originally, but I was keen to separate the ROM enable from the rest of the PCI scan, because if we have a lot of ROMs we don't want to use up lots of memory space for them. Perhaps it isn't worth worrying about. I had problems along the lines of what you describe, but then the problems cleared up - I'm not quite sure exactly what happened. Yes it seems wrong to not set up the bridge property.
Quoted 9 lines
Quoted 6 lines
Would you rework this pci rom support? Maybe in the PCI driver model series, that we use a device tree property (something like 'enable-rom' with a vendor id/device id pair to tell the enueration process that when it hit a vendor id/device id that mathes the dts it should enable the ROM and the enumeration process will automatically set up the mem_base/mem_limit for the bridge device automatically.
OK let's address that when I get back to it.
Quoted 15 lines
Sounds good. I know Freescale PCI/PCIe controller has a separate register (not in configuration space) which controls the outbound window base/size which covers the memory-mapped registers and ROM space. If you get a card directly connected to the host controller, current way in your patch series will work. This is due to the controller ignores the mem_base/mem_limit settings and I would call this an implementation specific behavior. However as for as I see most standard bridge chipsets (like PLX series bridges) implement this correctly per the PCI spec. And I believe Intel's chipset also implements this per spec. That's why I see this does not work on Tunnel Creek. I suspect on canyonlands board the PCI host controller has something similar to the Freescale one and your video card is directly connected to the host controller so that you can get it work. But what I don't understand is you get it work on Link which is an x86 board.
Well if we don't access VGA registers and don't access (<1MB) VGA memory then perhaps it doesn't matter?
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
There is also the VGA I/O registers which we currently emulate, but could perhaps pass through to the card.
What do you mean by 'VGA I/O reigsters are emulated'?
So I am still wondering what is the emulation you talked about?
See VGA_inpb() for example.
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines
Quoted 3 lines
So do you have it working now?
It is still not working on my Crown Bay board. The card's VGA rom does not execute properly. It hangs in the execution in both native mode and biosemu mode. Looks like we may still have an issue in the real mode stub, or the biosemu codes. Note this same video card works correctly with the AMI commercial BIOS.
I do have an updated BIOS emulator - there are some bugs in the current one. I'll see if I can post a (huge) patch. That might not be it though.
Quoted 8 lines
Quoted 3 lines
Some cards hang for ages waiting for a timer, and we don't emulate that properly.
Could you elaborate more on this timer issue? Looks it affects both native and emulation modes. I will see if I can get a fix. Right now I don't have a clue and am stuck. I have to find another video card to test this series.
It should not affect native execution because the timer is correctly set up in that case and does not need emulating.
There might be something else that the card needs to work.
In my case I tried several cards. This is the only one that worked perfectly:
http://www.amazon.com/gp/product/B003S746S4/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1
Regards,
Simon
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Simon,
Quoted 151 lines · Simon Glass
Hi Bin,
Quoted 148 lines · Bin Meng
Hi Simon,
Quoted 145 lines · Simon Glass
Hi Bin,
Quoted 141 lines · Bin Meng
Hi Simon,
Quoted 102 lines · Simon Glass
Hi Bin,
Quoted 99 lines · Bin Meng
Hi Simon,
Quoted 85 lines · Simon Glass
Hi Bin,
Quoted 82 lines · Bin Meng
Hi Simon,
Quoted 78 lines · Simon Glass
Hi Bin,
Quoted 64 lines · Bin Meng
Hi Simon,
Quoted 61 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +28
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE Quoted 8 lines
include/configs/canyonlands.h
Quoted 5 lines
include/configs/canyonlands.h +3
-1+#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
It is all there - I am using the existing support. If you see
pci_run_vga_bios()it callsbiosemu_run()in the emulation case.Quoted 8 lines
Quoted 4 lines
Sorry I mean the complete canyonlands codes which calls
pci_run_vga_bios(). I see currentlypci_run_vga_bios()is only called bychromebook_link. And do you think theint15_handler()required by the biosemu needs to be common?This series is at u-boot-x86/vesa.
You can see the call from the vesa video driver,
vesa_fb.c.Ah, I see. I can have a try on a non-x86 board.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Re
int15_handler(), yes I think it should be, but so far I haven't needed it.So what does
int15_hander()normally do? I see thevesa_fb.cprovided NULL forint15_handler, but the call inarch/x86/cpu/ivybridge/gma.cdoes not pass NULL.See the existing
int15_handler()in that file. It allows selection of output device and scaling. I doubt it matters for most boards.OK, so looks we should not make this
int15_handler()common.Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
I think the ROM access code can be made more common, but I left that task for now.
Quoted 9 lines
Quoted 5 lines
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
Which platform do you use? I doubt the VGA enable bit only affects x86 as it opens the A0000 and I/O address decoding which is only applicable on x86.
I'm only using glacier and link so far. I suspect there might be something wrong as only one of my video cards works fully on glacier - another once gives a snowy picture.
Quoted 5 lines
Quoted 3 lines
So VGA enable bit is unset on Link as well? That's interesting. When you mentioned two cards, did you insert them simultaneously? I believe only one card will work due to only one card will respond VGA cycles.
No it's set on Link I believe - see
bd82x6x_pci_bus_enable_resources().I don't see where does this
bd82x6x_pci_bus_enable_resources()get called.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Actually neither do I, looks like an oversight.
Ah, that's really interesting. So that means on the Link board the VGA enable bit (on Ivybridge PCH chipset) does not matter but the VGA card does work.
Well one point is that we don't have the frame buffer at
0xa0000. I'm not sure we care what is there.
Is the frame buffer address at 0xa0000 in the native mode?
Quoted 65 lines
Quoted 49 lines
Quoted 39 lines
Quoted 39 lines
Quoted 38 lines
I only used one card at a time.
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
For the ROM,
pci_rom_load()works for me, afterpciauto_setup_rom()is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.Yes, I called
pciauto_setup_rom()in my codes. I also verified the expansion ROM address register has bit0 set to 1 which means enabled.And you still can't see the ROM? Does the BAR give the correct ROM size? Do you enable memory access in the command register?
Quoted 14 lines
I confirm the BAR gave the correct size and memory access in the command register is turned on (this is by U-Boot's pci enumeration process), but it still cannot. And finally I just figured it out the root cause. It turns out we cannot simply add an API
pciauto_setup_rom()like this. It needs to setup the bridge's mem_base/mem_limit register pair in order to have the bridge claim the outbound memory window. That means callingpciauto_setup_rom()separately frompci_run_vga_rom()will not work as it does not touch the bridge registers. But I am wondering, why does it work on your glacier and link board? Is that because the pci controller on glacier and link ignore the values of mem_base/mem_limit? I don't believe it is the case since mem_base/mem_limit behavior is defined in PCI spec. Or this register pair on glacier and link is set up to a larger value which happened to cover the ROM space?It did not work originally, but I was keen to separate the ROM enable from the rest of the PCI scan, because if we have a lot of ROMs we don't want to use up lots of memory space for them. Perhaps it isn't worth worrying about. I had problems along the lines of what you describe, but then the problems cleared up - I'm not quite sure exactly what happened. Yes it seems wrong to not set up the bridge property.
Quoted 9 lines
Quoted 6 lines
Would you rework this pci rom support? Maybe in the PCI driver model series, that we use a device tree property (something like 'enable-rom' with a vendor id/device id pair to tell the enueration process that when it hit a vendor id/device id that mathes the dts it should enable the ROM and the enumeration process will automatically set up the mem_base/mem_limit for the bridge device automatically.
OK let's address that when I get back to it.
Quoted 15 lines
Sounds good. I know Freescale PCI/PCIe controller has a separate register (not in configuration space) which controls the outbound window base/size which covers the memory-mapped registers and ROM space. If you get a card directly connected to the host controller, current way in your patch series will work. This is due to the controller ignores the mem_base/mem_limit settings and I would call this an implementation specific behavior. However as for as I see most standard bridge chipsets (like PLX series bridges) implement this correctly per the PCI spec. And I believe Intel's chipset also implements this per spec. That's why I see this does not work on Tunnel Creek. I suspect on canyonlands board the PCI host controller has something similar to the Freescale one and your video card is directly connected to the host controller so that you can get it work. But what I don't understand is you get it work on Link which is an x86 board.
Quoted 2 lines
Well if we don't access VGA registers and don't access (<1MB) VGA memory then perhaps it doesn't matter?
No, what I described above (mem_base/mem_limit) is about PCI ROMs. I am curious that how you can access to the PCI ROM on Canyonlands and Link and I suspect Canyonlands may have something similar to Freescale's implementation and your video card is directly connected to the host controller (no bridge chipset between them). But I still don't understnad the Link since it is x86 and Intel chipset.
Quoted 11 lines
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
There is also the VGA I/O registers which we currently emulate, but could perhaps pass through to the card.
What do you mean by 'VGA I/O reigsters are emulated'?
So I am still wondering what is the emulation you talked about?
See
VGA_inpb()for example.
Thanks. I see this is for biosemu mode. What about native mode?
Quoted 23 lines
Quoted 14 lines
Quoted 14 lines
Quoted 9 lines
Quoted 3 lines
So do you have it working now?
It is still not working on my Crown Bay board. The card's VGA rom does not execute properly. It hangs in the execution in both native mode and biosemu mode. Looks like we may still have an issue in the real mode stub, or the biosemu codes. Note this same video card works correctly with the AMI commercial BIOS.
I do have an updated BIOS emulator - there are some bugs in the current one. I'll see if I can post a (huge) patch. That might not be it though.
Quoted 8 lines
Quoted 3 lines
Some cards hang for ages waiting for a timer, and we don't emulate that properly.
Could you elaborate more on this timer issue? Looks it affects both native and emulation modes. I will see if I can get a fix. Right now I don't have a clue and am stuck. I have to find another video card to test this series.
Quoted 9 lines
It should not affect native execution because the timer is correctly set up in that case and does not need emulating.
There might be something else that the card needs to work.
In my case I tried several cards. This is the only one that worked perfectly:
http://www.amazon.com/gp/product/B003S746S4/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1
Thanks for the info. I will try to find another card to test.
Regards,
Bin
PATCH 10/10 RFC: Test code for glacier PCI video support
Hi Bin,
Quoted 156 lines · Bin Meng
Hi Simon,
Quoted 153 lines · Simon Glass
Hi Bin,
Quoted 150 lines · Bin Meng
Hi Simon,
Quoted 146 lines · Simon Glass
Hi Bin,
Quoted 134 lines · Bin Meng
Hi Simon,
Quoted 102 lines · Simon Glass
Hi Bin,
Quoted 99 lines · Bin Meng
Hi Simon,
Quoted 85 lines · Simon Glass
Hi Bin,
Quoted 82 lines · Bin Meng
Hi Simon,
Quoted 78 lines · Simon Glass
Hi Bin,
Quoted 64 lines · Bin Meng
Hi Simon,
Quoted 61 lines · Simon Glass
NOT TO APPLY
This shows how to enable video for the glacier board, as an example of the emulator working on a VESA-compliant graphics card.
Signed-off-by Simon Glass <[email protected]>---
include/configs/canyonlands.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/configs/canyonlands.h +28
-0@@ -133,6 +133,9 @@#define CONFIG_SYS_NOR_CS 0/* NOR chip connected to CSx */ #define CONFIG_SYS_NAND_CS 3/* NAND chip connected to CSx */ +#define CONFIG_CONSOLE_MUX +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/*----------------------------------------------------------------------- * FLASH related *----------------------------------------------------------------------*/ @@ -359,6 +362,15 @@"ramdisk_addr=fc200000\0" \"pciconfighost=1\0" \"pcie_mode=RP:RP\0" \ +"eth1addr=00:01:ec:00:f4:9d\0" \ +"eth2addr=00:01:ec:00:f4:9e\0" \ +"eth3addr=00:01:ec:00:f4:9f\0" \ +"ethact=ppc_4xx_eth0\0" \ +"ethaddr=00:01:ec:00:f4:9c\0" \ +"stderr=serial\0" \ +"stdin=serial\0" \ +"stdout=serial,vga\0" \ +"autoload=n\0" \ ""#else /* defined(CONFIG_ARCHES) */ #define CONFIG_EXTRA_ENV_SETTINGS \@@ -675,4 +687,23 @@ }#endif +#define CONFIG_VIDEO + +#ifdef CONFIG_VIDEO +#define CONFIG_BIOSEMU /* x86 bios emulator for vga bios */ +#define CONFIG_VIDEO_VESA +#define VIDEO_IO_OFFSET 0xd8000000 +#define CONFIG_SYS_ISA_IO_BASE_ADDRESS VIDEO_IO_OFFSET +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO +#define CONFIG_CFB_CONSOLE +#define CONFIG_SPLASH_SCREEN +#define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_CMD_BMP +#endif + +#define CONFIG_FRAMEBUFFER_SET_VESA_MODE Quoted 8 lines
include/configs/canyonlands.h
Quoted 5 lines
include/configs/canyonlands.h +3
-1+#define CONFIG_FRAMEBUFFER_VESA_MODE 0x114 +#define CONFIG_CMD_TFTPPUT +#endif /* __CONFIG_H */ --Could you also post the codes that actually run the vga bios on ppc target? I may find another non-x86 board to test.
It is all there - I am using the existing support. If you see
pci_run_vga_bios()it callsbiosemu_run()in the emulation case.Quoted 8 lines
Quoted 4 lines
Sorry I mean the complete canyonlands codes which calls
pci_run_vga_bios(). I see currentlypci_run_vga_bios()is only called bychromebook_link. And do you think theint15_handler()required by the biosemu needs to be common?This series is at u-boot-x86/vesa.
You can see the call from the vesa video driver,
vesa_fb.c.Ah, I see. I can have a try on a non-x86 board.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Re
int15_handler(), yes I think it should be, but so far I haven't needed it.So what does
int15_hander()normally do? I see thevesa_fb.cprovided NULL forint15_handler, but the call inarch/x86/cpu/ivybridge/gma.cdoes not pass NULL.See the existing
int15_handler()in that file. It allows selection of output device and scaling. I doubt it matters for most boards.OK, so looks we should not make this
int15_handler()common.Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
I think the ROM access code can be made more common, but I left that task for now.
Quoted 9 lines
Quoted 5 lines
Re your other question I was looking for the VGA enable bit, as I remembered it from years ago. It doesn't seem to be needed for that platforms I have tested. But if it is generally needed we should add it.
Which platform do you use? I doubt the VGA enable bit only affects x86 as it opens the A0000 and I/O address decoding which is only applicable on x86.
I'm only using glacier and link so far. I suspect there might be something wrong as only one of my video cards works fully on glacier - another once gives a snowy picture.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
So VGA enable bit is unset on Link as well? That's interesting. When you mentioned two cards, did you insert them simultaneously? I believe only one card will work due to only one card will respond VGA cycles.
No it's set on Link I believe - see
bd82x6x_pci_bus_enable_resources().I don't see where does this
bd82x6x_pci_bus_enable_resources()get called.Actually neither do I, looks like an oversight.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Ah, that's really interesting. So that means on the Link board the VGA enable bit (on Ivybridge PCH chipset) does not matter but the VGA card does work.
Well one point is that we don't have the frame buffer at
0xa0000. I'm not sure we care what is there.Is the frame buffer address at
0xa0000in the native mode?
My understanding is that it is at 0xd0000000 in native mode.
Quoted 69 lines
Quoted 66 lines
Quoted 50 lines
Quoted 40 lines
Quoted 40 lines
Quoted 39 lines
I only used one card at a time.
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
For the ROM,
pci_rom_load()works for me, afterpciauto_setup_rom()is called. I wonder if you haven't enabled the ROM BAR? I initially got the same result as you.Yes, I called
pciauto_setup_rom()in my codes. I also verified the expansion ROM address register has bit0 set to 1 which means enabled.And you still can't see the ROM? Does the BAR give the correct ROM size? Do you enable memory access in the command register?
Quoted 14 lines
I confirm the BAR gave the correct size and memory access in the command register is turned on (this is by U-Boot's pci enumeration process), but it still cannot. And finally I just figured it out the root cause. It turns out we cannot simply add an API
pciauto_setup_rom()like this. It needs to setup the bridge's mem_base/mem_limit register pair in order to have the bridge claim the outbound memory window. That means callingpciauto_setup_rom()separately frompci_run_vga_rom()will not work as it does not touch the bridge registers. But I am wondering, why does it work on your glacier and link board? Is that because the pci controller on glacier and link ignore the values of mem_base/mem_limit? I don't believe it is the case since mem_base/mem_limit behavior is defined in PCI spec. Or this register pair on glacier and link is set up to a larger value which happened to cover the ROM space?It did not work originally, but I was keen to separate the ROM enable from the rest of the PCI scan, because if we have a lot of ROMs we don't want to use up lots of memory space for them. Perhaps it isn't worth worrying about. I had problems along the lines of what you describe, but then the problems cleared up - I'm not quite sure exactly what happened. Yes it seems wrong to not set up the bridge property.
Quoted 9 lines
Quoted 6 lines
Would you rework this pci rom support? Maybe in the PCI driver model series, that we use a device tree property (something like 'enable-rom' with a vendor id/device id pair to tell the enueration process that when it hit a vendor id/device id that mathes the dts it should enable the ROM and the enumeration process will automatically set up the mem_base/mem_limit for the bridge device automatically.
OK let's address that when I get back to it.
Quoted 15 lines
Sounds good. I know Freescale PCI/PCIe controller has a separate register (not in configuration space) which controls the outbound window base/size which covers the memory-mapped registers and ROM space. If you get a card directly connected to the host controller, current way in your patch series will work. This is due to the controller ignores the mem_base/mem_limit settings and I would call this an implementation specific behavior. However as for as I see most standard bridge chipsets (like PLX series bridges) implement this correctly per the PCI spec. And I believe Intel's chipset also implements this per spec. That's why I see this does not work on Tunnel Creek. I suspect on canyonlands board the PCI host controller has something similar to the Freescale one and your video card is directly connected to the host controller so that you can get it work. But what I don't understand is you get it work on Link which is an x86 board.
Quoted 2 lines
Well if we don't access VGA registers and don't access (<1MB) VGA memory then perhaps it doesn't matter?
Quoted 6 lines
No, what I described above (mem_base/mem_limit) is about PCI ROMs. I am curious that how you can access to the PCI ROM on Canyonlands and Link and I suspect Canyonlands may have something similar to Freescale's implementation and your video card is directly connected to the host controller (no bridge chipset between them). But I still don't understnad the Link since it is x86 and Intel chipset.
On link we get the ROM from the main ROM rather than the video card. That is controlled by CONFIG_X86_OPTION_ROM_ADDR.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
There is also the VGA I/O registers which we currently emulate, but could perhaps pass through to the card.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
What do you mean by 'VGA I/O reigsters are emulated'?
So I am still wondering what is the emulation you talked about?
See
VGA_inpb()for example.Thanks. I see this is for biosemu mode. What about native mode?
In that case we can emulate VGA but we don't need to, so we don't. I think I did try it out and it didn't seem to make any difference.
Quoted 27 lines
Quoted 27 lines
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
Quoted 4 lines
So do you have it working now?
It is still not working on my Crown Bay board. The card's VGA rom does not execute properly. It hangs in the execution in both native mode and biosemu mode. Looks like we may still have an issue in the real mode stub, or the biosemu codes. Note this same video card works correctly with the AMI commercial BIOS.
I do have an updated BIOS emulator - there are some bugs in the current one. I'll see if I can post a (huge) patch. That might not be it though.
Quoted 8 lines
Quoted 3 lines
Some cards hang for ages waiting for a timer, and we don't emulate that properly.
Could you elaborate more on this timer issue? Looks it affects both native and emulation modes. I will see if I can get a fix. Right now I don't have a clue and am stuck. I have to find another video card to test this series.
It should not affect native execution because the timer is correctly set up in that case and does not need emulating.
Quoted 8 lines
Quoted 6 lines
There might be something else that the card needs to work.
In my case I tried several cards. This is the only one that worked perfectly:
http://www.amazon.com/gp/product/B003S746S4/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1
Thanks for the info. I will try to find another card to test.
Good luck :-)
Regards,
Simon