From: "Jan Beulich" Subject: [PATCH v2] hvmloader: don't use AML operations on 64-bit fields Date: Tue, 27 May 2014 14:21:42 +0100 Message-ID: <5384AD860200007800015FA0@mail.emea.novell.com> References: <53846F840200007800015E99@mail.emea.novell.com> <538488A30200007800015F0A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part586A8276.1__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WpHK7-0006vC-Mh for xen-devel@lists.xenproject.org; Tue, 27 May 2014 13:21:48 +0000 In-Reply-To: <538488A30200007800015F0A@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Ian Campbell , Ian Jackson , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part586A8276.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline WinXP and Win2K3, while having no problem with the QWordMemory resource (there was another one there before), don't like operations on 64-bit fields. Split the fields d0688669 ("hvmloader: also cover PCI MMIO ranges above 4G with UC MTRR ranges") added to 32-bit ones, handling carry over explicitly. Sadly the constructs needed to create the sub-fields - nominally CreateDWordField(PRT0, \_SB.PCI0._CRS._Y02._MIN, MINL) CreateDWordField(PRT0, Add(\_SB.PCI0._CRS._Y02._MIN, 4), MINH) - can't be used: The former gets warned upon by newer iasl, i.e. would need to be replaced by the latter just with the addend changed to 0, and the latter doesn't translate properly with recent iasl). Hence, short of having an ASL/iasl expert at hand, we need to work around the shortcomings of various iasl versions. See the code comment. Signed-off-by: Jan Beulich --- v2: Avoid mis-compilation and warnings issued by newer iasl. --- a/tools/firmware/hvmloader/acpi/dsdt.asl +++ b/tools/firmware/hvmloader/acpi/dsdt.asl @@ -57,8 +57,10 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2,=20 MSUA, 32, /* MADT checksum address */ MAPA, 32, /* MADT LAPIC0 address */ VGIA, 32, /* VM generation id address */ - HMIN, 64, - HLEN, 64 + LMIN, 32, + HMIN, 32, + LLEN, 32, + HLEN, 32 } =20 /* Fix HCT test for 0x400 pci memory: @@ -176,15 +178,41 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2,=20 Add(MMIN, MLEN, MMAX) Subtract(MMAX, One, MMAX) =20 - CreateQWordField(PRT0, \_SB.PCI0._CRS._Y02._MIN, HMIN) - CreateQWordField(PRT0, \_SB.PCI0._CRS._Y02._MAX, HMAX) - CreateQWordField(PRT0, \_SB.PCI0._CRS._Y02._LEN, HLEN) - - Store(\_SB.HMIN, HMIN) - Store(\_SB.HLEN, HLEN) - Add(HMIN, HLEN, HMAX) - If(LOr(HMIN, HLEN)) { - Subtract(HMAX, One, HMAX) + /* + * WinXP / Win2K3 blue-screen for operations on 64-bit = values. + * Therefore we need to split the 64-bit calculations = needed + * here, but different iasl versions evaluate name = references + * to integers differently: + * Year (approximate) 2006 2008 2012 + * \_SB.PCI0._CRS._Y02 zero valid valid + * \_SB.PCI0._CRS._Y02._MIN valid valid huge + */ + If(LEqual(Zero, \_SB.PCI0._CRS._Y02)) { + Subtract(\_SB.PCI0._CRS._Y02._MIN, 14, Local0) + } Else { + Store(\_SB.PCI0._CRS._Y02, Local0) + } + CreateDWordField(PRT0, Add(Local0, 14), MINL) + CreateDWordField(PRT0, Add(Local0, 18), MINH) + CreateDWordField(PRT0, Add(Local0, 22), MAXL) + CreateDWordField(PRT0, Add(Local0, 26), MAXH) + CreateDWordField(PRT0, Add(Local0, 38), LENL) + CreateDWordField(PRT0, Add(Local0, 42), LENH) + + Store(\_SB.LMIN, MINL) + Store(\_SB.HMIN, MINH) + Store(\_SB.LLEN, LENL) + Store(\_SB.HLEN, LENH) + Add(MINL, LENL, MAXL) + Add(MINH, LENH, MAXH) + If(LLess(MAXL, MINL)) { + Add(MAXH, One, MAXH) + } + If(LOr(MINH, LENL)) { + If(LEqual(MAXL, 0)) { + Subtract(MAXH, One, MAXH) + } + Subtract(MAXL, One, MAXL) } =20 Return (PRT0) --=__Part586A8276.1__= Content-Type: text/plain; name="hvmloader-WinXP.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="hvmloader-WinXP.patch" hvmloader: don't use AML operations on 64-bit fields=0A=0AWinXP and = Win2K3, while having no problem with the QWordMemory resource=0A(there was = another one there before), don't like operations on 64-bit=0Afields. Split = the fields d0688669 ("hvmloader: also cover PCI MMIO=0Aranges above 4G = with UC MTRR ranges") added to 32-bit ones, handling=0Acarry over = explicitly.=0A=0ASadly the constructs needed to create the sub-fields - = nominally=0A=0A CreateDWordField(PRT0, \_SB.PCI0._CRS._Y02._MIN, = MINL)=0A CreateDWordField(PRT0, Add(\_SB.PCI0._CRS._Y02._MIN, 4), = MINH)=0A=0A- can't be used: The former gets warned upon by newer iasl, = i.e. would=0Aneed to be replaced by the latter just with the addend = changed to 0,=0Aand the latter doesn't translate properly with recent = iasl). Hence,=0Ashort of having an ASL/iasl expert at hand, we need to = work around the=0Ashortcomings of various iasl versions. See the code = comment.=0A=0ASigned-off-by: Jan Beulich =0A---=0Av2: = Avoid mis-compilation and warnings issued by newer iasl.=0A=0A--- = a/tools/firmware/hvmloader/acpi/dsdt.asl=0A+++ b/tools/firmware/hvmloader/a= cpi/dsdt.asl=0A@@ -57,8 +57,10 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, = =0A MSUA, 32, /* MADT checksum address */=0A MAPA, = 32, /* MADT LAPIC0 address */=0A VGIA, 32, /* VM generation id = address */=0A- HMIN, 64,=0A- HLEN, 64=0A+ = LMIN, 32,=0A+ HMIN, 32,=0A+ LLEN, 32,=0A+ = HLEN, 32=0A }=0A =0A /* Fix HCT test for 0x400 pci = memory:=0A@@ -176,15 +178,41 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, = =0A Add(MMIN, MLEN, MMAX)=0A Subtract(MMAX,= One, MMAX)=0A =0A- CreateQWordField(PRT0, \_SB.PCI0._CRS._Y= 02._MIN, HMIN)=0A- CreateQWordField(PRT0, \_SB.PCI0._CRS._Y0= 2._MAX, HMAX)=0A- CreateQWordField(PRT0, \_SB.PCI0._CRS._Y02= ._LEN, HLEN)=0A-=0A- Store(\_SB.HMIN, HMIN)=0A- = Store(\_SB.HLEN, HLEN)=0A- Add(HMIN, HLEN, HMAX)=0A- = If(LOr(HMIN, HLEN)) {=0A- Subtract(HMAX, = One, HMAX)=0A+ /*=0A+ * WinXP / Win2K3 = blue-screen for operations on 64-bit values.=0A+ * = Therefore we need to split the 64-bit calculations needed=0A+ = * here, but different iasl versions evaluate name references=0A+ = * to integers differently:=0A+ * Year (approximate= ) 2006 2008 2012=0A+ * \_SB.PCI0._CRS._Y02 = zero valid valid=0A+ * \_SB.PCI0._CRS._Y02._MIN = valid valid huge=0A+ */=0A+ = If(LEqual(Zero, \_SB.PCI0._CRS._Y02)) {=0A+ Subtract(\_S= B.PCI0._CRS._Y02._MIN, 14, Local0)=0A+ } Else {=0A+ = Store(\_SB.PCI0._CRS._Y02, Local0)=0A+ }=0A+ = CreateDWordField(PRT0, Add(Local0, 14), MINL)=0A+ = CreateDWordField(PRT0, Add(Local0, 18), MINH)=0A+ = CreateDWordField(PRT0, Add(Local0, 22), MAXL)=0A+ CreateDWor= dField(PRT0, Add(Local0, 26), MAXH)=0A+ CreateDWordField(PRT= 0, Add(Local0, 38), LENL)=0A+ CreateDWordField(PRT0, = Add(Local0, 42), LENH)=0A+=0A+ Store(\_SB.LMIN, MINL)=0A+ = Store(\_SB.HMIN, MINH)=0A+ Store(\_SB.LLEN, = LENL)=0A+ Store(\_SB.HLEN, LENH)=0A+ = Add(MINL, LENL, MAXL)=0A+ Add(MINH, LENH, MAXH)=0A+ = If(LLess(MAXL, MINL)) {=0A+ Add(MAXH, One, = MAXH)=0A+ }=0A+ If(LOr(MINH, LENL)) {=0A+ = If(LEqual(MAXL, 0)) {=0A+ Subtract(M= AXH, One, MAXH)=0A+ }=0A+ Subtract(MA= XL, One, MAXL)=0A }=0A =0A Return (PRT0)=0A --=__Part586A8276.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part586A8276.1__=--