* add PCI option rom switches to Kconfig

* fix up device specific code to honour those switches
* quoting fix for xcompile
* drop VGA_CONSOLE as it's not really useful for debugging purposes.
  VGA is only set up very late in the boot process, when everything
  critical in LinuxBIOS has already been initialized. If LinuxBIOS 
  fails, you will never see this on the console.

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>




git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@269 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
Stefan Reinauer 2007-03-22 18:03:28 +00:00
parent 8a8f3f4836
commit 44f1f0170d
7 changed files with 125 additions and 37 deletions

View file

@ -36,6 +36,7 @@ source mainboard/Kconfig
source arch/Kconfig
source lib/Kconfig
source console/Kconfig
source device/Kconfig
# These are used for internal purposes only.
source northbridge/Kconfig

View file

@ -128,12 +128,6 @@ config CONSOLE_SERIAL_9600
endchoice
config CONSOLE_VGA
boolean "VGA console support"
depends CONSOLE
help
Send LinuxBIOS output to VGA console as soon as VGA is initialized.
config CONSOLE_USB
boolean "USB2 console support (EXPERIMENTAL)"
depends CONSOLE && EXPERIMENTAL

90
device/Kconfig Normal file
View file

@ -0,0 +1,90 @@
##
## This file is part of the LinuxBIOS project.
##
## Copyright (C) 2007 coresystems GmbH
## Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; version 2 of the License
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
menu "Devices"
config PCI_OPTION_ROM_RUN
bool
help
Execute PCI/AGP option roms if available. This is required to
enable PCI/AGP VGA plugin cards. This option is not exposed
to the user but set by the options PCI_OPTION_ROM_RUN_VM86
and PCI_OPTION_ROM_RUN_X86EMU.
choice
prompt "Execute PCI Option ROMs"
default PCI_OPTION_ROM_RUN_VM86
help
Execute PCI/AGP option roms if available. You can choose to
execute PCI option roms natively (32bit x86 system required),
in an emulator (x86emu), or ignore option rom execution
config PCI_OPTION_ROM_RUN_X86EMU
bool "x86emu"
select PCI_OPTION_ROM_RUN
help
If choose this option, the x86 instruction set emulator
x86emu is used to execute 16bit legacy bios option roms.
x86emu is slow, big and safe. All 16bit x86 code is executed
in an encapsulated environment where it can not break out.
config PCI_OPTION_ROM_RUN_VM86
bool "vm86"
select PCI_OPTION_ROM_RUN
depends ARCH_X86
help
If choose this option, the virtual x86 mode "vm86" is used
to execute 16bit legacy bios option roms.
vm86 is very small, fast, and probably a little less safe than
x86emu, since it runs option roms on the real hardware instead
of an emulator.
config PCI_OPTION_ROM_RUN_NONE
bool "Disabled"
help
Do not execute PCI option roms at all.
If you choose this option, VGA plugin cards will not be
initialized.
endchoice
# This should probably become a CMOS option
config MULTIPLE_VGA_INIT
bool "Initialize all VGA cards"
depends PCI_OPTION_ROM_RUN
help
If you enable this option, all VGA cards will be initialized
If you disable this option, only the first VGA card will be
initialized.
config INITIALIZE_ONBOARD_VGA_FIRST
bool "Initialize onboard VGA first"
depends PCI_OPTION_ROM_RUN
help
Initialize onboard VGA chips before any plugin VGA cards
are initialized.
endmenu

View file

@ -503,13 +503,13 @@ void compute_allocate_resource(
}
#if defined(CONFIG_CONSOLE_VGA) && CONFIG_CONSOLE_VGA == 1
#if defined(CONFIG_PCI_OPTION_ROM_RUN) && CONFIG_PCI_OPTION_ROM_RUN == 1
struct device * vga_pri = 0;
int vga_inited = 0;
static void allocate_vga_resource(void)
{
#warning "FIXME modify allocate_vga_resource so it is less pci centric!"
#warning "This function knows to much about PCI stuff, it should be just a ietrator/visitor."
#warning "This function knows to much about PCI stuff, it should be just a iterator/visitor."
/* FIXME handle the VGA pallette snooping */
struct device *dev, *vga, *vga_onboard, *vga_first, *vga_last;
@ -549,7 +549,8 @@ static void allocate_vga_resource(void)
vga = vga_first;
}
#if CONFIG_CONSOLE_VGA_ONBOARD_AT_FIRST == 1
#if defined(CONFIG_INITIALIZE_ONBOARD_VGA_FIRST) && \
CONFIG_INITIALIZE_ONBOARD_VGA_FIRST == 1
if (vga_onboard) // will use on board vga as pri
#else
if (!vga) // will use last add on adapter as pri
@ -881,7 +882,7 @@ void dev_phase4(void)
mem->flags |= IORESOURCE_ASSIGNED;
mem->flags &= ~IORESOURCE_STORED;
#if defined(CONFIG_CONSOLE_VGA) && CONFIG_CONSOLE_VGA == 1
#if defined(CONFIG_PCI_OPTION_ROM_RUN) && CONFIG_PCI_OPTION_ROM_RUN == 1
/* Allocate the VGA I/O resource.. */
allocate_vga_resource();
#endif

View file

@ -655,9 +655,7 @@ void pci_dev_set_subsystem(struct device * dev, unsigned vendor, unsigned device
void pci_dev_init(struct device *dev)
{
#define CONFIG_PCI_ROM_RUN 1
// #warning "Need to set up CONFIG_PCI_ROM_RUN"
#if CONFIG_PCI_ROM_RUN == 1
#if defined(CONFIG_PCI_OPTION_ROM_RUN) && CONFIG_PCI_OPTION_ROM_RUN == 1
void run_bios(struct device * dev, unsigned long addr);
void do_vgabios(void);
struct rom_header *rom, *ram;
@ -669,12 +667,15 @@ void pci_dev_init(struct device *dev)
ram = pci_rom_load(dev, rom);
if (ram == NULL)
return;
//run_bios(dev, ram);
//void do_vgabios(void)
//
#if defined(CONFIG_PCI_OPTION_ROM_RUN_X86EMU) && \
CONFIG_PCI_OPTION_ROM_RUN_X86EMU == 1
run_bios(dev, ram);
#endif
#if defined(CONFIG_PCI_OPTION_ROM_RUN_VM86) && \
CONFIG_PCI_OPTION_ROM_RUN_VM86 == 1
do_vgabios();
#endif
#endif
}
/** Default device operation for PCI devices */

View file

@ -22,9 +22,6 @@
#include <device/pci_ops.h>
#include <string.h>
#define CONFIG_CONSOLE_VGA 1
#define CONFIG_CONSOLE_VGA_MULTI 0
struct rom_header * pci_rom_probe(struct device *dev)
{
unsigned long rom_address;
@ -60,7 +57,9 @@ struct rom_header * pci_rom_probe(struct device *dev)
return NULL;
}
rom_data = (unsigned char *) rom_header + le32_to_cpu(rom_header->data);
rom_data = (struct pci_data *)((unsigned char *) rom_header +
le32_to_cpu(rom_header->data));
printk(BIOS_SPEW, "PCI ROM Image, Vendor %04x, Device %04x,\n",
rom_data->vendor, rom_data->device);
if (dev->vendor != rom_data->vendor || dev->device != rom_data->device) {
@ -83,9 +82,9 @@ struct rom_header * pci_rom_probe(struct device *dev)
static void *pci_ram_image_start = (void *)PCI_RAM_IMAGE_START;
#if CONFIG_CONSOLE_VGA == 1
#if defined(CONFIG_PCI_OPTION_ROM_RUN) && CONFIG_PCI_OPTION_ROM_RUN == 1
extern int vga_inited; // defined in vga_console.c
#if CONFIG_CONSOLE_VGA_MULTI == 0
#ifndef CONFIG_MULTIPLE_VGA_INIT
extern struct device *vga_pri; // the primary vga device, defined in device.c
#endif
#endif
@ -100,8 +99,10 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade
rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS);
do {
rom_header = (unsigned char *) rom_header + image_size; // get next image
rom_data = (unsigned char *) rom_header + le32_to_cpu(rom_header->data);
rom_header = (struct rom_header *)((unsigned char *)rom_header
+ image_size); // get next image
rom_data = (struct pci_data *)((unsigned char *) rom_header +
le32_to_cpu(rom_header->data));
image_size = le32_to_cpu(rom_data->ilen) * 512;
} while ((rom_data->type!=0) && (rom_data->indicator!=0)); // make sure we got x86 version
@ -110,9 +111,9 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade
rom_size = rom_header->size * 512;
if (PCI_CLASS_DISPLAY_VGA == rom_data->class_hi) {
#if CONFIG_CONSOLE_VGA == 1
#if CONFIG_CONSOLE_VGA_MULTI == 0
//if (dev != vga_pri) return NULL; // only one VGA supported
#if defined(CONFIG_PCI_OPTION_ROM_RUN) && CONFIG_PCI_OPTION_ROM_RUN == 1
#ifndef CONFIG_MULTIPLE_VGA_INIT
if (dev != vga_pri) return NULL; // only one VGA supported
#endif
printk(BIOS_DEBUG, "Copying VGA ROM image from 0x%x to 0x%x, 0x%x bytes\n",
rom_header, PCI_VGA_RAM_IMAGE_START, rom_size);

View file

@ -27,20 +27,20 @@ ARCH=`uname -m | sed -e s/i.86/x86/ -e s/sun4u/sparc64/ \
case "$ARCH" in
"x86_64")
echo "CC_x86 := \"gcc -m32\""
echo "AS_x86 := \"as --32\""
echo "LD_x86 := \"ld -b elf32-i386 -melf_i386\""
echo "CC_x86 := gcc -m32"
echo "AS_x86 := as --32"
echo "LD_x86 := ld -b elf32-i386 -melf_i386"
;;
"x86")
echo "CC_x86 := \"gcc\""
echo "AS_x86 := \"as\""
echo "LD_x86 := \"ld\""
echo "CC_x86 := gcc"
echo "AS_x86 := as"
echo "LD_x86 := ld"
;;
*)
# FIXME: This should be detected.
echo "CC_x86 := \"i386-linux-gcc\""
echo "AS_x86 := \"i386-linux-as\""
echo "LD_x86 := \"i386-linux-ld\""
echo "CC_x86 := i386-linux-gcc"
echo "AS_x86 := i386-linux-as"
echo "LD_x86 := i386-linux-ld"
;;
esac