mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
retrieve option roms from lar.
Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Ronald G. Minnich <rminnich@gmail.com> git-svn-id: svn://coreboot.org/repository/coreboot-v3@657 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
2dc8f8ec2f
commit
7920e8a96a
1 changed files with 25 additions and 5 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include <device/pci_ids.h>
|
#include <device/pci_ids.h>
|
||||||
#include <device/pci_ops.h>
|
#include <device/pci_ops.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <lar.h>
|
||||||
|
|
||||||
struct rom_header *pci_rom_probe(struct device *dev)
|
struct rom_header *pci_rom_probe(struct device *dev)
|
||||||
{
|
{
|
||||||
|
@ -35,12 +36,30 @@ struct rom_header *pci_rom_probe(struct device *dev)
|
||||||
struct pci_data *rom_data;
|
struct pci_data *rom_data;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned char sum = 0, *rom_bytes;
|
unsigned char sum = 0, *rom_bytes;
|
||||||
|
struct mem_file archive, result;
|
||||||
|
|
||||||
if (dev->on_mainboard) {
|
if (dev->on_mainboard) {
|
||||||
|
int ret;
|
||||||
|
char pcifile[] = "pci0000,0000.rom";
|
||||||
/* In case some device PCI_ROM_ADDRESS can not be set
|
/* In case some device PCI_ROM_ADDRESS can not be set
|
||||||
* or readonly.
|
* or readonly.
|
||||||
*/
|
*/
|
||||||
rom_address = dev->rom_address;
|
init_archive(&archive);
|
||||||
|
sprintf(pcifile, "pci%04x,%04x.rom", dev->id.u.pci.vendor,
|
||||||
|
dev->id.u.pci.device);
|
||||||
|
|
||||||
|
ret = find_file(&archive, pcifile, &result);
|
||||||
|
if (ret) {
|
||||||
|
printk(BIOS_INFO, "No option rom for onboard device.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME hardcode to 0xc0000 for now because we can only init
|
||||||
|
* VGA anyways.
|
||||||
|
*/
|
||||||
|
process_file(&result, (void *)0xc0000);
|
||||||
|
rom_address = 0xc0000;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS);
|
rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS);
|
||||||
}
|
}
|
||||||
|
@ -140,10 +159,11 @@ struct rom_header *pci_rom_load(struct device *dev,
|
||||||
if (dev != vga_pri)
|
if (dev != vga_pri)
|
||||||
return NULL; // Only one VGA supported.
|
return NULL; // Only one VGA supported.
|
||||||
#endif
|
#endif
|
||||||
printk(BIOS_DEBUG,
|
if (rom_header != (void *)PCI_VGA_RAM_IMAGE_START) {
|
||||||
"Copying VGA ROM image from %p to 0x%x, 0x%x bytes\n",
|
printk(BIOS_DEBUG, "Copying VGA ROM image from %p to 0x%x, 0x%x bytes\n",
|
||||||
rom_header, PCI_VGA_RAM_IMAGE_START, rom_size);
|
rom_header, PCI_VGA_RAM_IMAGE_START, rom_size);
|
||||||
memcpy((void *)PCI_VGA_RAM_IMAGE_START, rom_header, rom_size);
|
memcpy((void *)PCI_VGA_RAM_IMAGE_START, rom_header, rom_size);
|
||||||
|
}
|
||||||
vga_inited = 1;
|
vga_inited = 1;
|
||||||
return (struct rom_header *)(PCI_VGA_RAM_IMAGE_START);
|
return (struct rom_header *)(PCI_VGA_RAM_IMAGE_START);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue