@@ -28,7 +28,7 @@ union pamdata_u {
// Enable shadowing and copy bios.
static void
-__make_bios_writable_intel(u16 bdf, u32 pam0)
+make_bios_writable_intel(u16 bdf, u32 pam0)
{
// Read in current PAM settings from pci config space
union pamdata_u pamdata;
@@ -39,11 +39,11 @@ __make_bios_writable_intel(u16 bdf, u32 pam0)
// Make ram from 0xc0000-0xf0000 writable
int i;
for (i=0; i<6; i++)
- pam[i + 1] = 0x33;
+ pam[i + 1] = 0x22;
// Make ram from 0xf0000-0x100000 writable
int ram_present = pam[0] & 0x10;
- pam[0] = 0x30;
+ pam[0] = 0x20;
// Write PAM settings back to pci config space
pci_ioconfig_writel(bdf, ALIGN_DOWN(pam0, 4), pamdata.data32[0]);
@@ -54,24 +54,17 @@ __make_bios_writable_intel(u16 bdf, u32 pam0)
memcpy(VSYMBOL(code32flat_start)
, VSYMBOL(code32flat_start) + BIOS_SRC_OFFSET
, SYMBOL(code32flat_end) - SYMBOL(code32flat_start));
-}
-static void
-make_bios_writable_intel(u16 bdf, u32 pam0)
-{
- int reg = pci_ioconfig_readb(bdf, pam0);
- if (!(reg & 0x10)) {
- // QEMU doesn't fully implement the piix shadow capabilities -
- // if ram isn't backing the bios segment when shadowing is
- // disabled, the code itself won't be in memory. So, run the
- // code from the high-memory flash location.
- u32 pos = (u32)__make_bios_writable_intel + BIOS_SRC_OFFSET;
- void (*func)(u16 bdf, u32 pam0) = (void*)pos;
- func(bdf, pam0);
- return;
- }
- // Ram already present - just enable writes
- __make_bios_writable_intel(bdf, pam0);
+ // Make ram from 0xc0000-0xf0000 writable
+ for (i=0; i<6; i++)
+ pam[i + 1] = 0x33;
+
+ // Make ram from 0xf0000-0x100000 writable
+ pam[0] = 0x30;
+
+ // Write PAM settings back to pci config space
+ pci_ioconfig_writel(bdf, ALIGN_DOWN(pam0, 4), pamdata.data32[0]);
+ pci_ioconfig_writel(bdf, ALIGN_DOWN(pam0, 4) + 4, pamdata.data32[1]);
}
Lev Kujawski (3):