Skip to contentSkip to conversation

[0.12] Map BIOS f-segment as RAM, not as ROM

PATCH In review Alexander Graf 4 participants 4 messages Dec 4, 2009 – Dec 5, 2009

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 [0.12] Map BIOS f-segment as RAM, not as ROM

SeaBIOS needs to write to the f-segment. So it needs to have some way to set that from read-only to read-write, write in it and when it's done set it to read-only again.

On PCI we have a mechanism for that. The ISA machine does not though. To stay regression free and happily enable users to continue using the -M isapc machine let's just map it as RAM. The BIOS on PCI will set it to r/o later either way.

---

v1 -> v2:

- always map r/w

---
 hw/pc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/pc.c +1 -1
index 8c1b7ea..b5dabdd 100644
@@ -1075,7 +1075,7 @@ static void pc_init1(ram_addr_t ram_size,
         isa_bios_size = 128 * 1024;
     cpu_register_physical_memory(0x100000 - isa_bios_size,
                                  isa_bios_size,
-                                 (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM);
+                                 (bios_offset + bios_size - isa_bios_size));
 
 
 
Signature · 1 line
1.6.0.2
#1 lore raw
Quoted 10 lines · Alexander Graf

SeaBIOS needs to write to the f-segment. So it needs to have some way to set that from read-only to read-write, write in it and when it's done set it to read-only again.

On PCI we have a mechanism for that. The ISA machine does not though. To stay regression free and happily enable users to continue using the -M isapc machine let's just map it as RAM. The BIOS on PCI will set it to r/o later either way.

Thanks Alex. Figuring out what to do here has been on my todo and this seems like a reasonable solution.

Regards,

Anthony Liguori

#2 lore raw
In reply to Alexander Graf
Quoted 10 lines · Alexander Graf

SeaBIOS needs to write to the f-segment. So it needs to have some way to set that from read-only to read-write, write in it and when it's done set it to read-only again.

On PCI we have a mechanism for that. The ISA machine does not though. To stay regression free and happily enable users to continue using the -M isapc machine let's just map it as RAM. The BIOS on PCI will set it to r/o later either way.

Looks fine to me. Guest will be able to overwrite BIOS, but I don't think we should care about this too much. On KVM all ROM slots are writable anyway.

Quoted 24 lines

---

v1 -> v2:

- always map r/w

---
 hw/pc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/pc.c +1 -1
index 8c1b7ea..b5dabdd 100644
@@ -1075,7 +1075,7 @@ static void pc_init1(ram_addr_t ram_size,
         isa_bios_size = 128 * 1024;
     cpu_register_physical_memory(0x100000 - isa_bios_size,
                                  isa_bios_size,
-                                 (bios_offset + bios_size - isa_bios_size) | IO_MEM_ROM);
+                                 (bios_offset + bios_size - isa_bios_size));
 
 
 
Signature · 1 line
1.6.0.2

--
Gleb.

#3 lore raw
In reply to Alexander Graf
Quoted 7 lines · Alexander Graf

SeaBIOS needs to write to the f-segment. So it needs to have some way to set that from read-only to read-write, write in it and when it's done set it to read-only again.

On PCI we have a mechanism for that. The ISA machine does not though. To stay regression free and happily enable users to continue using the -M isapc machine let's just map it as RAM. The BIOS on PCI will set it to r/o later either way.

Thanks Alexander.

With this qemu patch, SeaBIOS still wouldn't boot from a harddrive because it only probed PCI ATA controllers. I committed 4ccb2312 to SeaBIOS to have it probe for ISA ATA controllers when no pci devices are found.

-Kevin