Skip to contentSkip to conversation

BIOS, ACPI, CMOS and Windows EvenID: 4

Qemu-devel Gleb Natapov 4 participants 18 messages Aug 20, 2008 – Sep 11, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

AML, that is shipped with BIOS, reads data from CMOS by directly
accessing ports 0x70-0x71. This makes windows guest unhappy. It logs error EventID 4 into event log:

     ACPI BIOS is attempting to read from an illegal IO port address (0x71),
     which lies in the 0x70 - 0x71 protected address range. This could
     lead to system instability. Please contact your system vendor for
     technical assistance.

We ignored this error for a long time since there was no any stability issues caused by it, but recently we encountered Windows 2008 reboot problem (one of 10 reboots hangs with ACPI error) that, according to Microsoft, is caused by CMOS access from AML code. Eliminating the access indeed fixed reboot problem. ACPI spec defines a way to read CMOS without accessing IO ports directly, but unfortunately neither Windows XP nor Linux implements this part of the spec (it works in Windows 2008 though). As far as I can see AML accesses CMOS in order to see how much memory is present and configure PCI hole to be maximum size. Is this really needed or we can just hard code a reasonably large PCI hole like in patch below and eliminate CMOS access? Any other ideas how to solve the problem?

Index: bios/acpi-dsdt.dsl
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/acpi-dsdt.dsl,v retrieving revision 1.3

acpi-dsdt.dsl +4 -33
diff -u -r1.3 acpi-dsdt.dsl
@@ -27,20 +27,6 @@
 {
     Scope (\)
     {
-        /* CMOS memory access */
-        OperationRegion (CMS, SystemIO, 0x70, 0x02)
-        Field (CMS, ByteAcc, NoLock, Preserve)
-        {
-            CMSI,   8,
-            CMSD,   8
-        }
-        Method (CMRD, 1, NotSerialized)
-        {
-            Store (Arg0, CMSI)
-            Store (CMSD, Local0)
-            Return (Local0)
-        }
-
         /* Debug Output */
         OperationRegion (DBG, SystemIO, 0xb044, 0x04)
         Field (DBG, DWordAcc, NoLock, Preserve)
@@ -99,9 +85,7 @@
                 Package() {0x0005ffff, 3, LNKD, 0},
             })
 
-            Method (_CRS, 0, NotSerialized)
-            {
-            Name (MEMP, ResourceTemplate ()
+            Name (_CRS, ResourceTemplate ()
             {
                 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
                     0x0000,             // Address Space Granularity
@@ -139,25 +123,12 @@
                     ,, , AddressRangeMemory, TypeStatic)
                 DWordMemory (ResourceProducer, PosDecode, MinNotFixed, MaxFixed, NonCacheable, ReadWrite,
                     0x00000000,         // Address Space Granularity
-                    0x00000000,         // Address Range Minimum
+                    0xE0000000,         // Address Range Minimum
                     0xFEBFFFFF,         // Address Range Maximum
                     0x00000000,         // Address Translation Offset
-                    0x00000000,         // Address Length
-                    ,, MEMF, AddressRangeMemory, TypeStatic)
+                    0x1EC00000,         // Address Length
+                    ,, , AddressRangeMemory, TypeStatic)
             })
-                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MIN, PMIN)
-                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MAX, PMAX)
-                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._LEN, PLEN)
-                /* compute available RAM */
-                Add(CMRD(0x34), ShiftLeft(CMRD(0x35), 8), Local0)
-                ShiftLeft(Local0, 16, Local0)
-                Add(Local0, 0x1000000, Local0)
-                /* update field of last region */
-                Store(Local0, PMIN)
-                Subtract (PMAX, PMIN, PLEN)
-                Increment (PLEN)
-                Return (MEMP)
-            }
         }
     }
 

--
Gleb.

#1 lore raw
Quoted 9 lines · Gleb Natapov

AML, that is shipped with BIOS, reads data from CMOS by directly accessing ports 0x70-0x71. This makes windows guest unhappy. It logs error EventID 4 into event log:

    ACPI BIOS is attempting to read from an illegal IO port address (0x71),
    which lies in the 0x70 - 0x71 protected address range. This could
    lead to system instability. Please contact your system vendor for
    technical assistance.

This seems to be documented at http://www.microsoft.com/whdc/archive/BIOSAML.mspx

Quoted 8 lines

We ignored this error for a long time since there was no any stability issues caused by it, but recently we encountered Windows 2008 reboot problem (one of 10 reboots hangs with ACPI error) that, according to Microsoft, is caused by CMOS access from AML code. Eliminating the access indeed fixed reboot problem. ACPI spec defines a way to read CMOS without accessing IO ports directly, but unfortunately neither Windows XP nor Linux implements this part of the spec (it works in Windows 2008 though).

Do you mean OperationRegion type CMOS?

Quoted 4 lines

As far as I can see AML accesses CMOS in order
to see how much memory is present and configure PCI hole to be maximum size. Is this really needed or we can just hard code a reasonably large PCI hole like in patch below and eliminate CMOS access

The AML of my real hardware does calculate the maximal hole. VMware seems to do the same.

Is there a minimal hole size specified somewhere? I looked at some specs but didn't find any.

Quoted 1 line

Any other ideas how to solve the problem?

The Microsoft document suggests to copy the CMOS data to somewhere in memory and access it there. I guess rombios space from 0xe000 to 0xffff could be a good candidate.
The 440fx specs says "The top of memory is determined by the value written into DRB7." We might get the proper value from there. But it also says "Note that the PMC supports a maximum of 1 Gbytes of DRAM."

Quoted 40 lines

Index: bios/acpi-dsdt.dsl
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/acpi-dsdt.dsl,v retrieving revision 1.3
diff -u -r1.3 acpi-dsdt.dsl

acpi-dsdt.dsl 20 Aug 2008 12:54:04 -0000 renamed from acpi-dsdt.dsl 26 Jan 2008 09:15:27 -0000 1.3 +1 -17
@@ -27,20 +27,6 @@
 {
    Scope (\)
    {
-        /* CMOS memory access */
-        OperationRegion (CMS, SystemIO, 0x70, 0x02)
-        Field (CMS, ByteAcc, NoLock, Preserve)
-        {
-            CMSI,   8,
-            CMSD,   8
-        }
-        Method (CMRD, 1, NotSerialized)
-        {
-            Store (Arg0, CMSI)
-            Store (CMSD, Local0)
-            Return (Local0)
-        }
-
        /* Debug Output */
        OperationRegion (DBG, SystemIO, 0xb044, 0x04)
        Field (DBG, DWordAcc, NoLock, Preserve)
@@ -99,9 +85,7 @@
                Package() {0x0005ffff, 3, LNKD, 0},
            })
 
-            Method (_CRS, 0, NotSerialized)
-            {
-            Name (MEMP, ResourceTemplate ()
+            Name (_CRS, ResourceTemplate ()
            {
                WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
                    0x0000,             // Address Space Granularity

acpi-dsdt.dsl 20 Aug 2008 12:54:04 -0000 line 126

Quoted 5 lines
acpi-dsdt.dsl 20 Aug 2008 12:54:04 -0000 renamed from acpi-dsdt.dsl 26 Jan 2008 09:15:27 -0000 1.3 +1 -1
@@ -139,25 +123,12 @@
                    ,, , AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinNotFixed, MaxFixed, NonCacheable, ReadWrite,
                    0x00000000,         // Address Space Granularity
-                    0x00000000,         // Address Range Minimum
+                    0xE0000000,         // Address Range Minimum

0xe0000000 comes from hw/pc.c ("if (ram_size >= 0xe0000000 ) { ...") ?

Quoted 13 lines
acpi-dsdt.dsl 20 Aug 2008 12:54:04 -0000 renamed from acpi-dsdt.dsl 26 Jan 2008 09:15:27 -0000 1.3 +2 -8
                    0xFEBFFFFF,         // Address Range Maximum
                    0x00000000,         // Address Translation Offset
-                    0x00000000,         // Address Length
-                    ,, MEMF, AddressRangeMemory, TypeStatic)
+                    0x1EC00000,         // Address Length
+                    ,, , AddressRangeMemory, TypeStatic)
            })
-                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MIN, PMIN)
-                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MAX, PMAX)
-                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._LEN, PLEN)
-                /* compute available RAM */
-                Add(CMRD(0x34), ShiftLeft(CMRD(0x35), 8), Local0)
-                ShiftLeft(Local0, 16, Local0)

acpi-dsdt.dsl 20 Aug 2008 12:54:04 -0000 line 134

Quoted 10 lines
acpi-dsdt.dsl 20 Aug 2008 12:54:04 -0000 renamed from acpi-dsdt.dsl 26 Jan 2008 09:15:27 -0000 1.3 +0 -7
-                Add(Local0, 0x1000000, Local0)
-                /* update field of last region */
-                Store(Local0, PMIN)
-                Subtract (PMAX, PMIN, PLEN)
-                Increment (PLEN)
-                Return (MEMP)
-            }
        }
    }
 

- Sebastian

#2 lore raw
Quoted 11 lines · Sebastian Herbszt
Quoted 8 lines

We ignored this error for a long time since there was no any stability issues caused by it, but recently we encountered Windows 2008 reboot problem (one of 10 reboots hangs with ACPI error) that, according to Microsoft, is caused by CMOS access from AML code. Eliminating the access indeed fixed reboot problem. ACPI spec defines a way to read CMOS without accessing IO ports directly, but unfortunately neither Windows XP nor Linux implements this part of the spec (it works in Windows 2008 though).

Do you mean OperationRegion type CMOS?

Yes. Tried that and it works only on Windows 2008 / Vista. XP doesn't boot and Linux complains that it doesn't have a handler for this region type. Linux can be fixed by XP is hopeless :)

Quoted 7 lines
Quoted 4 lines

As far as I can see AML accesses CMOS in order
to see how much memory is present and configure PCI hole to be maximum size. Is this really needed or we can just hard code a reasonably large PCI hole like in patch below and eliminate CMOS access

The AML of my real hardware does calculate the maximal hole. VMware seems to do the same.

My real HW reads it from a chipset.

Quoted 3 lines

Is there a minimal hole size specified somewhere? I looked at some specs but didn't find any.

Qemu has a minimal hole size hardcoded to start at 0xe0000000.

Quoted 6 lines
Quoted 2 lines

Any other ideas how to solve the problem?

The Microsoft document suggests to copy the CMOS data to somewhere in memory and access it there. I guess rombios space from 0xe000 to 0xffff could be a good candidate.

No need to copy the whole CMOS. Copying only memory size should be enough. Also putting it somewhere in first 4K should be better. You can't write into 0xe000-0xffff unless chipset shadows it in a memory.

Quoted 4 lines

The 440fx specs says "The top of memory is determined by the value written into DRB7." We might get the proper value from there. But it also says "Note that the PMC supports a maximum of 1 Gbytes of DRAM."

Yeah, I saw that my real HW takes top of the memory somewhere from the chipset and looked in 440fx specs if it has this info, but it turned out that we abuse 440fx and sometimes use much more memory that it supports. We can re-use DRB registers for our needs and store memory size there on POST (we can store 8 bytes there, so it should be enough) and read them from AML. Are all users of bochs BIOS uses the same chipset?

--
Gleb.

#3 lore raw
Quoted 2 lines · Gleb Natapov

Are all users of bochs BIOS uses the same
chipset?

The coreboot project has used the bochs bios to provide standard BIOS support on real hardware with various chipsets. However, they would not use the ACPI support in bochs bios.

The ACPI support in bochs bios is already 440fx specific, so I don't see a problem with adding another chipset specific rule.

-Kevin

#4 lore raw
Quoted 2 lines · Kevin O'Connor

The ACPI support in bochs bios is already 440fx specific, so I don't see a problem with adding another chipset specific rule.

So is something like this should be OK:

Index: acpi-dsdt.dsl
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/acpi-dsdt.dsl,v retrieving revision 1.3

acpi-dsdt.dsl +9 -15
diff -u -r1.3 acpi-dsdt.dsl
@@ -27,20 +27,6 @@
 {
     Scope (\)
     {
-        /* CMOS memory access */
-        OperationRegion (CMS, SystemIO, 0x70, 0x02)
-        Field (CMS, ByteAcc, NoLock, Preserve)
-        {
-            CMSI,   8,
-            CMSD,   8
-        }
-        Method (CMRD, 1, NotSerialized)
-        {
-            Store (Arg0, CMSI)
-            Store (CMSD, Local0)
-            Return (Local0)
-        }
-
         /* Debug Output */
         OperationRegion (DBG, SystemIO, 0xb044, 0x04)
         Field (DBG, DWordAcc, NoLock, Preserve)
@@ -56,6 +42,12 @@
             Name (_HID, EisaId ("PNP0A03"))
             Name (_ADR, 0x00)
             Name (_UID, 1)
+            OperationRegion (I440, PCI_Config, 0x60, 0x02)
+            Field (I440, ByteAcc, NoLock, Preserve)
+            {
+                 CM34,   8,
+                 CM35,   8,
+            }
             Name(_PRT, Package() {
                 /* PCI IRQ routing table, example from ACPI 2.0a specification,
                    section 6.2.8.1 */
@@ -149,7 +141,9 @@
                 CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MAX, PMAX)
                 CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._LEN, PLEN)
                 /* compute available RAM */
-                Add(CMRD(0x34), ShiftLeft(CMRD(0x35), 8), Local0)
+                Store(CM34, Local1)
+                Store(CM35, Local2)
+                Add(Local1, ShiftLeft(Local2, 8), Local0)
                 ShiftLeft(Local0, 16, Local0)
                 Add(Local0, 0x1000000, Local0)
                 /* update field of last region */

Index: rombios32.c
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios32.c,v
retrieving revision 1.29

rombios32.c +2 -0
diff -u -r1.29 rombios32.c
@@ -677,6 +677,8 @@
                 elcr[0], elcr[1]);
     } else if (vendor_id == PCI_VENDOR_ID_INTEL && device_id == PCI_DEVICE_ID_INTEL_82441) {
         /* i440 PCI bridge */
+        pci_config_writeb(d, 0x60, cmos_readb(0x34));
+        pci_config_writeb(d, 0x61, cmos_readb(0x35));
         bios_shadow_init(d);
     }
 }

--
Gleb.

#5 lore raw
Quoted 45 lines · Gleb Natapov

So is something like this should be OK:

Index: acpi-dsdt.dsl
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/acpi-dsdt.dsl,v retrieving revision 1.3
diff -u -r1.3 acpi-dsdt.dsl

acpi-dsdt.dsl 21 Aug 2008 14:13:35 -0000 renamed from acpi-dsdt.dsl 26 Jan 2008 09:15:27 -0000 1.3 +6 -14
@@ -27,20 +27,6 @@
 {
    Scope (\)
    {
-        /* CMOS memory access */
-        OperationRegion (CMS, SystemIO, 0x70, 0x02)
-        Field (CMS, ByteAcc, NoLock, Preserve)
-        {
-            CMSI,   8,
-            CMSD,   8
-        }
-        Method (CMRD, 1, NotSerialized)
-        {
-            Store (Arg0, CMSI)
-            Store (CMSD, Local0)
-            Return (Local0)
-        }
-
        /* Debug Output */
        OperationRegion (DBG, SystemIO, 0xb044, 0x04)
        Field (DBG, DWordAcc, NoLock, Preserve)
@@ -56,6 +42,12 @@
            Name (_HID, EisaId ("PNP0A03"))
            Name (_ADR, 0x00)
            Name (_UID, 1)
+            OperationRegion (I440, PCI_Config, 0x60, 0x02)
+            Field (I440, ByteAcc, NoLock, Preserve)
+            {
+                 CM34,   8,
+                 CM35,   8,
+            }
            Name(_PRT, Package() {
                /* PCI IRQ routing table, example from ACPI 2.0a specification,
                   section 6.2.8.1 */

acpi-dsdt.dsl 21 Aug 2008 14:13:35 -0000 line 149

Quoted 10 lines
acpi-dsdt.dsl 21 Aug 2008 14:13:35 -0000 renamed from acpi-dsdt.dsl 26 Jan 2008 09:15:27 -0000 1.3 +3 -1
@@ -149,7 +141,9 @@
                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MAX, PMAX)
                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._LEN, PLEN)
                /* compute available RAM */
-                Add(CMRD(0x34), ShiftLeft(CMRD(0x35), 8), Local0)
+                Store(CM34, Local1)
+                Store(CM35, Local2)
+                Add(Local1, ShiftLeft(Local2, 8), Local0)
                ShiftLeft(Local0, 16, Local0)
                Add(Local0, 0x1000000, Local0)
                /* update field of last region */

I just noticed the original code might not compute PMIN correctly for low memory configurations. If ram size is below 16MB CMOS registers 0x34 and 0x35 are set to zero. In this case PMIN is still computed by adding 16MB. This might be intended tho.

Quoted 8 lines

Index: rombios32.c
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/rombios32.c,v
retrieving revision 1.29
diff -u -r1.29 rombios32.c

rombios32.c 21 Aug 2008 14:13:36 -0000 line 684

Quoted 8 lines
rombios32.c 21 Aug 2008 14:13:36 -0000 renamed from rombios32.c 30 Jul 2008 15:13:40 -0000 1.29 +2 -0
@@ -677,6 +677,8 @@
                elcr[0], elcr[1]);
    } else if (vendor_id == PCI_VENDOR_ID_INTEL && device_id == PCI_DEVICE_ID_INTEL_82441) {
        /* i440 PCI bridge */
+        pci_config_writeb(d, 0x60, cmos_readb(0x34));
+        pci_config_writeb(d, 0x61, cmos_readb(0x35));
        bios_shadow_init(d);
    }
 }

I am not sure writing arbitrary values to those registers is such a good idea. Some OS, driver or application could rely on the information stored there.

The 440FX PMC supports up to 1GB of memory. Top of memory is the value read from DRB7 multiplied by 8MB, so the maximal DRB7 value is 0x80.
VMware and Virtual PC emulate the 440BX/ZX/DX PMC. The 440BX supports up to 1GB and the 440ZX up to 256MB of memory (i could not find any specs on the DX). I think both products support memory configurations above 1GB, so it might be useful to know what they program those DRBx registers to.

It would also be possible to program those DRBx registers correctly up to memory value of 1GB (or 2GB by using the info from the 440GX) and compute the pci hole properly, then just fall back to 0xe0000000 if the memory size does exceed 1GB.
Hard coding the hole start to 0xe0000000, like you did in your first patch, looks like the easiest solution tho.

- Sebastian

#9 lore raw
In reply to Gleb Natapov
Quoted 6 lines · Gleb Natapov
Quoted 3 lines

The Microsoft document suggests to copy the CMOS data to somewhere in memory and access it there. I guess rombios space from 0xe000 to 0xffff could be a good candidate.

No need to copy the whole CMOS. Copying only memory size should be enough. Also putting it somewhere in first 4K should be better. You can't write into 0xe000-0xffff unless chipset shadows it in a memory.

bios_shadow_init() from rombios32.c does already support this for the 440fx.

Quoted 11 lines
Quoted 4 lines

The 440fx specs says "The top of memory is determined by the value written into DRB7." We might get the proper value from there. But it also says "Note that the PMC supports a maximum of 1 Gbytes of DRAM."

Yeah, I saw that my real HW takes top of the memory somewhere from the chipset and looked in 440fx specs if it has this info, but it turned out that we abuse 440fx and sometimes use much more memory that it supports. We can re-use DRB registers for our needs and store memory size there on POST (we can store 8 bytes there, so it should be enough) and read them from AML. Are all users of bochs BIOS uses the same chipset?

I think bochs, qemu, xen and virtual box emulate the 440fx.

- Sebastian

#6 lore raw
In reply to Sebastian Herbszt
Quoted 7 lines · Sebastian Herbszt
Quoted 7 lines

diff -u -r1.29 rombios32.c

rombios32.c 21 Aug 2008 14:13:36 -0000 renamed from rombios32.c 30 Jul 2008 15:13:40 -0000 1.29 +0 -0
@@ -677,6 +677,8 @@
                elcr[0], elcr[1]);
    } else if (vendor_id == PCI_VENDOR_ID_INTEL && device_id == PCI_DEVICE_ID_INTEL_82441) {
        /* i440 PCI bridge */
Quoted 8 lines

rombios32.c 21 Aug 2008 14:13:36 -0000 line 684

Quoted 5 lines
rombios32.c 21 Aug 2008 14:13:36 -0000 renamed from rombios32.c 30 Jul 2008 15:13:40 -0000 1.29 +2 -0
+        pci_config_writeb(d, 0x60, cmos_readb(0x34));
+        pci_config_writeb(d, 0x61, cmos_readb(0x35));
        bios_shadow_init(d);
    }
 }

I am not sure writing arbitrary values to those registers is such a good idea. Some OS, driver or application could rely on the information stored there.

Currently nothing is written to memory configuration registers at all, so if there is an application that depend on this values to be correct it will be broken today too.

Quoted 3 lines

It would also be possible to program those DRBx registers correctly up to memory value of 1GB (or 2GB by using the info from the 440GX) and compute the pci hole properly, then just fall back to 0xe0000000 if the memory size does exceed 1GB.

Is there a need for 3GB pci hole especially on a system with only 1GB of main memory?

Quoted 2 lines

Hard coding the hole start to 0xe0000000, like you did in your first patch, looks like the easiest solution tho.

Yes, and I think it is good enough. What is the procedure of pushing the patch into bochs tree?

--
Gleb.

#10 lore raw
In reply to Gleb Natapov
Quoted 3 lines · Gleb Natapov

AML, that is shipped with BIOS, reads data from CMOS by directly
accessing ports 0x70-0x71. This makes windows guest unhappy. It logs error EventID 4 into event log:

[...]

Quoted 1 line

DWordMemory (ResourceProducer, PosDecode, MinNotFixed, MaxFixed, NonCacheable, ReadWrite,

With this patch, should that now read MinFixed instead of MinNotFixed?

-Kevin

#7 lore raw
In reply to Gleb Natapov
Quoted 5 lines · Gleb Natapov
Quoted 2 lines

I am not sure writing arbitrary values to those registers is such a good idea. Some OS, driver or application could rely on the information stored there.

Currently nothing is written to memory configuration registers at all, so if there is an application that depend on this values to be correct it will be broken today too.

The 440fx supports 8MB-1GB of memory. The default value for the DRBx registers is 01 (8MB). Bochs doesn't set the default value tho nor does the rombios set the correct one, so those registers stay with 0 values. If we set DRB0 and DRB1 to the CMOS values and keep DRB2 till DRB7 set to 0 we violate the assumption that DRB7 contains the top of memory value. In the all 0 case this is still somewhat valid.

Quoted 4 lines
Quoted 2 lines

Hard coding the hole start to 0xe0000000, like you did in your first patch, looks like the easiest solution tho.

Yes, and I think it is good enough. What is the procedure of pushing the patch into bochs tree?

Post it on the bochs patch tracker at sf
http://sourceforge.net/tracker/?atid=312580&group_id=12580&func=browse

- Sebastian

#8 lore raw

And please post complete patch, i.e. not only .dsl file but also its compiled .hex version patch.

Thanks,
Stanislav

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Sebastian Herbszt
Sent: Monday, August 25, 2008 12:30 AM
To: Gleb Natapov
Cc: [email protected]; Kevin O'Connor; [email protected]
Subject: Re: [Bochs-developers] BIOS, ACPI, CMOS and Windows EvenID: 4

Quoted 1 line · Gleb Natapov
Quoted 1 line

I am not sure writing arbitrary values to those registers is such a good

idea. Some OS,

Quoted 4 lines
Quoted 1 line

driver or application could rely on the information stored there.

Currently nothing is written to memory configuration registers at all, so if there is an application that depend on this values to be correct it will be broken today too.

The 440fx supports 8MB-1GB of memory. The default value for the DRBx registers is 01 (8MB). Bochs doesn't set the default value tho nor does the rombios set the correct one, so those registers stay with 0 values. If we set DRB0 and DRB1 to the CMOS values and keep DRB2 till DRB7 set to 0 we violate the assumption that DRB7 contains the top of memory value. In the all 0 case this is still somewhat valid.

Quoted 1 line
Quoted 1 line

Hard coding the hole start to 0xe0000000, like you did in your first

patch, looks like the

Quoted 3 lines
Quoted 1 line

easiest solution tho.

Yes, and I think it is good enough. What is the procedure of pushing the patch into bochs tree?

Post it on the bochs patch tracker at sf
http://sourceforge.net/tracker/?atid=312580&group_id=12580&func=browse

- Sebastian

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
bochs-developers mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bochs-developers

#11 lore raw
In reply to Kevin O'Connor
Quoted 9 lines · Kevin O'Connor
Quoted 3 lines · Gleb Natapov

AML, that is shipped with BIOS, reads data from CMOS by directly
accessing ports 0x70-0x71. This makes windows guest unhappy. It logs error EventID 4 into event log:

[...]

Quoted 1 line

DWordMemory (ResourceProducer, PosDecode, MinNotFixed, MaxFixed, NonCacheable, ReadWrite,

With this patch, should that now read MinFixed instead of MinNotFixed?

You are right. I fixed that and posted the patch to SF tracker.

--
Gleb.

#12 lore raw

There is no file attached to your patch.

Staniuslav

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Gleb Natapov
Sent: Monday, August 25, 2008 9:39 AM
To: Kevin O'Connor
Cc: [email protected]; [email protected]
Subject: Re: [Bochs-developers] BIOS, ACPI, CMOS and Windows EvenID: 4

Quoted 6 lines · Kevin O'Connor
Quoted 3 lines · Gleb Natapov

AML, that is shipped with BIOS, reads data from CMOS by directly
accessing ports 0x70-0x71. This makes windows guest unhappy. It logs error EventID 4 into event log:

[...]

Quoted 1 line

DWordMemory (ResourceProducer, PosDecode, MinNotFixed,

MaxFixed, NonCacheable, ReadWrite,

Quoted 3 lines

With this patch, should that now read MinFixed instead of MinNotFixed?

You are right. I fixed that and posted the patch to SF tracker.

--
Gleb.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
bochs-developers mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/bochs-developers

#13 lore raw
Quoted 2 lines · Stanislav Shwartsman

There is no file attached to your patch.

Yeah, I noticed, but don't know how to attached it now ;(

Send it here.

--
Gleb.

Index: acpi-dsdt.dsl
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/acpi-dsdt.dsl,v retrieving revision 1.3

acpi-dsdt.dsl +5 -34
diff -u -r1.3 acpi-dsdt.dsl
@@ -27,20 +27,6 @@
 {
     Scope (\)
     {
-        /* CMOS memory access */
-        OperationRegion (CMS, SystemIO, 0x70, 0x02)
-        Field (CMS, ByteAcc, NoLock, Preserve)
-        {
-            CMSI,   8,
-            CMSD,   8
-        }
-        Method (CMRD, 1, NotSerialized)
-        {
-            Store (Arg0, CMSI)
-            Store (CMSD, Local0)
-            Return (Local0)
-        }
-
         /* Debug Output */
         OperationRegion (DBG, SystemIO, 0xb044, 0x04)
         Field (DBG, DWordAcc, NoLock, Preserve)
@@ -99,9 +85,7 @@
                 Package() {0x0005ffff, 3, LNKD, 0},
             })
 
-            Method (_CRS, 0, NotSerialized)
-            {
-            Name (MEMP, ResourceTemplate ()
+            Name (_CRS, ResourceTemplate ()
             {
                 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
                     0x0000,             // Address Space Granularity
@@ -137,27 +121,14 @@
                     0x00000000,         // Address Translation Offset
                     0x00020000,         // Address Length
                     ,, , AddressRangeMemory, TypeStatic)
-                DWordMemory (ResourceProducer, PosDecode, MinNotFixed, MaxFixed, NonCacheable, ReadWrite,
+                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
                     0x00000000,         // Address Space Granularity
-                    0x00000000,         // Address Range Minimum
+                    0xE0000000,         // Address Range Minimum
                     0xFEBFFFFF,         // Address Range Maximum
                     0x00000000,         // Address Translation Offset
-                    0x00000000,         // Address Length
-                    ,, MEMF, AddressRangeMemory, TypeStatic)
+                    0x1EC00000,         // Address Length
+                    ,, , AddressRangeMemory, TypeStatic)
             })
-                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MIN, PMIN)
-                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._MAX, PMAX)
-                CreateDWordField (MEMP, \_SB.PCI0._CRS.MEMF._LEN, PLEN)
-                /* compute available RAM */
-                Add(CMRD(0x34), ShiftLeft(CMRD(0x35), 8), Local0)
-                ShiftLeft(Local0, 16, Local0)
-                Add(Local0, 0x1000000, Local0)
-                /* update field of last region */
-                Store(Local0, PMIN)
-                Subtract (PMAX, PMIN, PLEN)
-                Increment (PLEN)
-                Return (MEMP)
-            }
         }
     }
 

Index: acpi-dsdt.hex
===================================================================
RCS file: /cvsroot/bochs/bochs/bios/acpi-dsdt.hex,v retrieving revision 1.2

acpi-dsdt.hex +249 -268

533 lines not on this page · raw message

#15 lore raw
Quoted 4 lines · Sebastian Herbszt

Gleb,

Quoted 1 line · Stanislav Shwartsman
Quoted 8 lines
Quoted 1 line

There is no file attached to your patch.

i noticed the comment on the sf patch tracker:
"Attachment is missing. Patch can be found here
http://lists.gnu.org/archive/html/qemu-devel/2008-08/msg00980.html"

Is it me or your reply didn't make it to the bochs list?

I've got a reply that the mail is too big and it waits for moderation. So no my reply didn't make it.

--
Gleb.

#16 lore raw
In reply to Sebastian Herbszt

Hi,

As I already told, I have no idea about BIOS and can't check if the patch is correct.
I hope Volker could make a decision or you will follow the guideline that I tried to invent before.
Somebody of you (not just a patch author) should confirm that the patch is OK and could be safely merged to CVS.

Thanks,
Stanislav

-----Original Message-----
From: Sebastian Herbszt [mailto:[email protected]]
Sent: Sunday, August 31, 2008 10:35 PM
To: Stanislav Shwartsman; 'Gleb Natapov'; 'Kevin O'Connor'
Cc: [email protected]; [email protected]
Subject: Re: [Bochs-developers] BIOS, ACPI, CMOS and Windows EvenID: 4

Gleb,

Quoted 2 lines · Stanislav Shwartsman

There is no file attached to your patch.

i noticed the comment on the sf patch tracker:
"Attachment is missing. Patch can be found here
http://lists.gnu.org/archive/html/qemu-devel/2008-08/msg00980.html"

Is it me or your reply didn't make it to the bochs list?

- Sebastian

#17 lore raw
Quoted 8 lines · Stanislav Shwartsman

Hi,

As I already told, I have no idea about BIOS and can't check if the patch is correct.
I hope Volker could make a decision or you will follow the guideline that I tried to invent before.
Somebody of you (not just a patch author) should confirm that the patch is OK and could be safely merged to CVS.

The patch looks ok to me. The new version does address Kevin's comment about using MinFixed instead of MinNotFixed, so there are no outstanding issues. It already got commited to kvm-userspace as "kvm: bios: avoid accessing CMOS NVRAM from ACPI AML" [1] so it should already have some exposure.

[1] http://git.kernel.org/?p=virt/kvm/kvm-userspace.git;a=commit;h=04c154af9b1b5af9edee1cc0afbb3eac4b218531

- Sebastian