__make_bios_writable_intel(u16 bdf, u32 pam0)
{
// Make ram from 0xc0000-0xf0000 writable
- int clear = 0;
int i;
for (i=0; i<6; i++) {
u32 pam = pam0 + 1 + i;
- int reg = pci_config_readb(bdf, pam);
- if (CONFIG_OPTIONROMS_DEPLOYED && (reg & 0x11) != 0x11) {
- // Need to copy optionroms to work around qemu implementation
- void *mem = (void*)(BUILD_ROM_START + i * 32*1024);
- memcpy((void*)BUILD_BIOS_TMP_ADDR, mem, 32*1024);
- pci_config_writeb(bdf, pam, 0x33);
- memcpy(mem, (void*)BUILD_BIOS_TMP_ADDR, 32*1024);
- clear = 1;
- } else {
- pci_config_writeb(bdf, pam, 0x33);
- }
+ pci_config_writeb(bdf, pam, 0x33);
}
- if (clear)
- memset((void*)BUILD_BIOS_TMP_ADDR, 0, 32*1024);
// Make ram from 0xf0000-0x100000 writable
int reg = pci_config_readb(bdf, pam0);
memset(sources, 0, sizeof(sources));
u32 post_vga = rom_get_last();
- if (CONFIG_OPTIONROMS_DEPLOYED) {
- // Option roms are already deployed on the system.
- u32 pos = post_vga;
- while (pos < rom_get_max()) {
- int ret = init_optionrom((void*)pos, 0, 0);
- if (ret)
- pos += OPTION_ROM_ALIGN;
- else
- pos = rom_get_last();
- }
- } else {
- // Find and deploy PCI roms.
- struct pci_device *pci;
- foreachpci(pci) {
- if (pci->class == PCI_CLASS_DISPLAY_VGA || pci->have_driver)
- continue;
- init_pcirom(pci, 0, sources);
- }
-
- // Find and deploy CBFS roms not associated with a device.
- run_file_roms("genroms/", 0, sources);
+ // Find and deploy PCI roms.
+ struct pci_device *pci;
+ foreachpci(pci) {
+ if (pci->class == PCI_CLASS_DISPLAY_VGA || pci->have_driver)
+ continue;
+ init_pcirom(pci, 0, sources);
}
+
+ // Find and deploy CBFS roms not associated with a device.
+ run_file_roms("genroms/", 0, sources);
rom_reserve(0);
// All option roms found and deployed - now build BEV/BCV vectors.
RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
- if (CONFIG_OPTIONROMS_DEPLOYED) {
- // Option roms are already deployed on the system.
- init_optionrom((void*)BUILD_ROM_START, 0, 1);
- } else {
- // Clear option rom memory
- memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);
-
- // Find and deploy PCI VGA rom.
- struct pci_device *pci;
- foreachpci(pci) {
- if (!is_pci_vga(pci))
- continue;
- vgahook_setup(pci);
- init_pcirom(pci, 1, NULL);
- break;
- }
+ // Clear option rom memory
+ memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);
- // Find and deploy CBFS vga-style roms not associated with a device.
- run_file_roms("vgaroms/", 1, NULL);
+ // Find and deploy PCI VGA rom.
+ struct pci_device *pci;
+ foreachpci(pci) {
+ if (!is_pci_vga(pci))
+ continue;
+ vgahook_setup(pci);
+ init_pcirom(pci, 1, NULL);
+ break;
}
+
+ // Find and deploy CBFS vga-style roms not associated with a device.
+ run_file_roms("vgaroms/", 1, NULL);
rom_reserve(0);
if (rom_get_last() == BUILD_ROM_START)