CONFIG_PCI_ROM_RUN

git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1875 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Yinghai Lu 2005-01-14 22:04:49 +00:00
parent 688238a50c
commit 9e4faef7db
5 changed files with 39 additions and 5 deletions

View File

@ -1,3 +1,4 @@
uses CONFIG_PCI_ROM_RUN
object device.o object device.o
object root_device.o object root_device.o
object device_util.o object device_util.o
@ -7,5 +8,7 @@ object hypertransport.o
object pci_ops.o object pci_ops.o
object smbus_ops.o object smbus_ops.o
object pci_rom.o if CONFIG_PCI_ROM_RUN
dir emulator object pci_rom.o
dir emulator
end

View File

@ -364,6 +364,7 @@ void compute_allocate_resource(
} }
#if CONFIG_CONSOLE_VGA == 1
static void allocate_vga_resource(void) static void allocate_vga_resource(void)
{ {
#warning "FIXME modify allocate_vga_resource so it is less pci centric!" #warning "FIXME modify allocate_vga_resource so it is less pci centric!"
@ -401,7 +402,7 @@ static void allocate_vga_resource(void)
bus = (bus == bus->dev->bus)? 0 : bus->dev->bus; bus = (bus == bus->dev->bus)? 0 : bus->dev->bus;
} }
} }
#endif
/** /**
* @brief Assign the computed resources to the devices on the bus. * @brief Assign the computed resources to the devices on the bus.
@ -556,8 +557,10 @@ void dev_configure(void)
mem->flags |= IORESOURCE_ASSIGNED; mem->flags |= IORESOURCE_ASSIGNED;
mem->flags &= ~IORESOURCE_STORED; mem->flags &= ~IORESOURCE_STORED;
#if CONFIG_CONSOLE_VGA == 1
/* Allocate the VGA I/O resource.. */ /* Allocate the VGA I/O resource.. */
allocate_vga_resource(); allocate_vga_resource();
#endif
/* Store the computed resource allocations into device registers ... */ /* Store the computed resource allocations into device registers ... */
printk_info("Setting resources...\n"); printk_info("Setting resources...\n");

View File

@ -551,10 +551,12 @@ void pci_bus_enable_resources(struct device *dev)
{ {
uint16_t ctrl; uint16_t ctrl;
#if CONFIG_CONSOLE_VGA == 1
/* enable IO in command register if there is VGA card /* enable IO in command register if there is VGA card
* connected with (even it does not claim IO resource) */ * connected with (even it does not claim IO resource) */
if (dev->link[0].bridge_ctrl & PCI_BRIDGE_CTL_VGA) if (dev->link[0].bridge_ctrl & PCI_BRIDGE_CTL_VGA)
dev->command |= PCI_COMMAND_IO; dev->command |= PCI_COMMAND_IO;
#endif
ctrl = pci_read_config16(dev, PCI_BRIDGE_CONTROL); ctrl = pci_read_config16(dev, PCI_BRIDGE_CONTROL);
ctrl |= dev->link[0].bridge_ctrl; ctrl |= dev->link[0].bridge_ctrl;
@ -573,6 +575,7 @@ void pci_dev_set_subsystem(device_t dev, unsigned vendor, unsigned device)
((device & 0xffff) << 16) | (vendor & 0xffff)); ((device & 0xffff) << 16) | (vendor & 0xffff));
} }
#if CONFIG_PCI_ROM_RUN == 1
void pci_dev_init(struct device *dev) void pci_dev_init(struct device *dev)
{ {
struct rom_header *rom, *ram; struct rom_header *rom, *ram;
@ -581,9 +584,12 @@ void pci_dev_init(struct device *dev)
if (rom == NULL) if (rom == NULL)
return; return;
ram = pci_rom_load(dev, rom); ram = pci_rom_load(dev, rom);
if (ram == NULL)
return;
run_bios(dev, ram); run_bios(dev, ram);
} }
#endif
/** Default device operation for PCI devices */ /** Default device operation for PCI devices */
static struct pci_operations pci_dev_ops_pci = { static struct pci_operations pci_dev_ops_pci = {
@ -594,7 +600,11 @@ struct device_operations default_pci_ops_dev = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources, .enable_resources = pci_dev_enable_resources,
#if CONFIG_PCI_ROM_RUN == 1
.init = pci_dev_init, .init = pci_dev_init,
#else
.init = 0,
#endif
.scan_bus = 0, .scan_bus = 0,
.enable = 0, .enable = 0,
.ops_pci = &pci_dev_ops_pci, .ops_pci = &pci_dev_ops_pci,

View File

@ -11,11 +11,12 @@ struct rom_header * pci_rom_probe(struct device *dev)
struct pci_data *rom_data; struct pci_data *rom_data;
rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS); rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS);
if (rom_address == 0x00000000 || rom_address == 0xffffffff) { if (rom_address == 0x00000000 || rom_address == 0xffffffff) {
return NULL; return NULL;
} }
printk_spew("%s, rom address for %s = %x\n", printk_debug("%s, rom address for %s = %x\n",
__func__, dev_path(dev), rom_address); __func__, dev_path(dev), rom_address);
/* enable expansion ROM address decoding */ /* enable expansion ROM address decoding */
@ -53,6 +54,11 @@ struct rom_header * pci_rom_probe(struct device *dev)
} }
static void *pci_ram_image_start = PCI_RAM_IMAGE_START; static void *pci_ram_image_start = PCI_RAM_IMAGE_START;
#if CONFIG_CONSOLE_VGA == 1
int vga_inited = 0; // it will be used by vga_console
#endif
struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_header) struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_header)
{ {
struct pci_data * rom_data; struct pci_data * rom_data;
@ -64,10 +70,14 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade
rom_size = rom_header->size*512; rom_size = rom_header->size*512;
if (PCI_CLASS_DISPLAY_VGA == (rom_data->class_hi << 16 | rom_data->class_lo)) { if (PCI_CLASS_DISPLAY_VGA == (rom_data->class_hi << 16 | rom_data->class_lo)) {
#if CONFIG_CONSOLE_VGA == 1
if(vga_inited) return NULL; // only one VGA supported
printk_spew("%s, copying VGA ROM Image from %x to %x, %x bytes\n", printk_spew("%s, copying VGA ROM Image from %x to %x, %x bytes\n",
__func__, rom_header, PCI_VGA_RAM_IMAGE_START, rom_size); __func__, rom_header, PCI_VGA_RAM_IMAGE_START, rom_size);
memcpy(PCI_VGA_RAM_IMAGE_START, rom_header, rom_size); memcpy(PCI_VGA_RAM_IMAGE_START, rom_header, rom_size);
vga_inited = 1;
return (struct rom_header *) (PCI_VGA_RAM_IMAGE_START); return (struct rom_header *) (PCI_VGA_RAM_IMAGE_START);
#endif
} else { } else {
printk_spew("%s, copying non-VGA ROM Image from %x to %x, %x bytes\n", printk_spew("%s, copying non-VGA ROM Image from %x to %x, %x bytes\n",
__func__, rom_header, pci_ram_image_start, rom_size); __func__, rom_header, pci_ram_image_start, rom_size);
@ -77,4 +87,6 @@ struct rom_header *pci_rom_load(struct device *dev, struct rom_header *rom_heade
} }
/* disable expansion ROM address decoding */ /* disable expansion ROM address decoding */
pci_write_config32(dev, PCI_ROM_ADDRESS, rom_address & ~PCI_ROM_ADDRESS_ENABLE); pci_write_config32(dev, PCI_ROM_ADDRESS, rom_address & ~PCI_ROM_ADDRESS_ENABLE);
return NULL;
} }

View File

@ -51,6 +51,8 @@ uses CC
uses HOSTCC uses HOSTCC
uses OBJCOPY uses OBJCOPY
uses CONFIG_CHIP_NAME uses CONFIG_CHIP_NAME
uses CONFIG_CONSOLE_VGA
uses CONFIG_PCI_ROM_RUN
### ###
### Build options ### Build options
@ -115,7 +117,11 @@ default CONFIG_SMP=1
default CONFIG_MAX_CPUS=1 default CONFIG_MAX_CPUS=1
#BTEXT CONSOLE #BTEXT CONSOLE
default CONFIG_CONSOLE_BTEXT=1 #default CONFIG_CONSOLE_BTEXT=1
#VGA
default CONFIG_CONSOLE_VGA=1
default CONFIG_PCI_ROM_RUN=1
## ##
## Build code to setup a generic IOAPIC ## Build code to setup a generic IOAPIC