public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Jes Sorensen <jes@sgi.com>
Cc: Avi Kivity <avi@redhat.com>, "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [patch] qemu-kvm BIOS move _PR to SSDT
Date: Wed, 10 Jun 2009 18:13:01 +0300	[thread overview]
Message-ID: <20090610151301.GJ15949@redhat.com> (raw)
In-Reply-To: <4A2FCABE.2060207@sgi.com>

On Wed, Jun 10, 2009 at 05:01:18PM +0200, Jes Sorensen wrote:
> Index: qemu-kvm/kvm/bios/acpi-ssdt.dsl
> ===================================================================
> --- /dev/null
> +++ qemu-kvm/kvm/bios/acpi-ssdt.dsl
> @@ -0,0 +1,140 @@
> +/*
> + * Bochs/QEMU ACPI SSDT ASL definition
> + *
> + * Copyright (c) 2006 Fabrice Bellard
I am not sure that there is even one bit of code below written by Fabrice.

> + * Copyright (c) 2009 SGI, Jes Sorensen <jes@sgi.com>
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License version 2 as published by the Free Software Foundation.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
> + */
> +DefinitionBlock (
> +    "acpi-ssdt.aml",    // Output Filename
> +    "SSDT",             // Signature
> +    0x01,               // DSDT Compliance Revision
> +    "BXPC",             // OEMID
> +    "BXSSDT",           // TABLE ID
> +    0x1                 // OEM Revision
> +    )
> +{
> +   Scope (\_PR)
> +   {
> +	/* pointer to first element of MADT APIC structures */
> +	OperationRegion(ATPR, SystemMemory, 0x0514, 4)
> +	Field (ATPR, DwordAcc, NoLock, Preserve)
> +	{
> +		ATP, 32
> +	}
> +
> +#define madt_addr(nr)  Add (ATP, Multiply(nr, 8))
> +
> +#define gen_processor(nr, name) 				            \
> +	Processor (C##name, nr, 0x0000b010, 0x06) {                       \
> +	    OperationRegion (MATR, SystemMemory, madt_addr(nr), 8)          \
> +	    Field (MATR, ByteAcc, NoLock, Preserve)                         \
> +	    {                                                               \
> +	        MAT, 64                                                     \
> +	    }                                                               \
> +	    Field (MATR, ByteAcc, NoLock, Preserve)                         \
> +	    {                                                               \
> +	        Offset(4),                                                  \
> +	        FLG, 1                                                      \
> +	    }                                                               \
> +            Method(_MAT, 0) {                                               \
> +		Return(MAT)                                                 \
> +            }                                                               \
> +            Method (_STA) {                                                 \
> +                If (FLG) { Return(0xF) } Else { Return(0x9) }               \
> +            }                                                               \
> +        }                                                                   \
> +
> +
> +	gen_processor(0, 0)
> +	gen_processor(1, 1)
> +	gen_processor(2, 2)
> +	gen_processor(3, 3)
> +	gen_processor(4, 4)
> +	gen_processor(5, 5)
> +	gen_processor(6, 6)
> +	gen_processor(7, 7)
> +	gen_processor(8, 8)
> +	gen_processor(9, 9)
> +	gen_processor(10, A)
> +	gen_processor(11, B)
> +	gen_processor(12, C)
> +	gen_processor(13, D)
> +	gen_processor(14, E)
> +
> +	Method (NTFY, 2) {
> +#define gen_ntfy(nr)                                        \
> +	If (LEqual(Arg0, 0x##nr)) {                         \
> +		If (LNotEqual(Arg1, \_PR.C##nr.FLG)) {      \
> +			Store (Arg1, \_PR.C##nr.FLG)        \
> +			If (LEqual(Arg1, 1)) {              \
> +				Notify(C##nr, 1)            \
> +			} Else {                            \
> +				Notify(C##nr, 3)            \
> +			}                                   \
> +		}                                           \
> +	}
> +		gen_ntfy(0)
> +		gen_ntfy(1)
> +		gen_ntfy(2)
> +		gen_ntfy(3)
> +		gen_ntfy(4)
> +		gen_ntfy(5)
> +		gen_ntfy(6)
> +		gen_ntfy(7)
> +		gen_ntfy(8)
> +		gen_ntfy(9)
> +		gen_ntfy(A)
> +		gen_ntfy(B)
> +		gen_ntfy(C)
> +		gen_ntfy(D)
> +		gen_ntfy(E)
> +		Return(One)
> +	}
> +
> +	OperationRegion(PRST, SystemIO, 0xaf00, 32)
> +	Field (PRST, ByteAcc, NoLock, Preserve)
> +	{
> +		PRS, 256
> +	}
> +
> +	Method(PRSC, 0) {
> +		Store(PRS, Local3)
> +		Store(Zero, Local0)
> +		While(LLess(Local0, 32)) {
> +			Store(Zero, Local1)
> +			Store(DerefOf(Index(Local3, Local0)), Local2)
> +			While(LLess(Local1, 8)) {
> +				NTFY(Add(Multiply(Local0, 8), Local1),
> +						And(Local2, 1))
> +				ShiftRight(Local2, 1, Local2)
> +				Increment(Local1)
> +			}
> +			Increment(Local0)
> +		}
> +		Return(One)
> +	}
> +    }
> +
> +    Scope (\)
> +    {
> +        /* Debug Output */
> +        OperationRegion (DBG, SystemIO, 0xb044, 0x04)
> +        Field (DBG, DWordAcc, NoLock, Preserve)
> +        {
> +            DBGL,   32,
> +        }
> +    }
Except may be this one, but it should stay in DSDT.

--
			Gleb.

  reply	other threads:[~2009-06-10 15:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-10 15:01 [patch] qemu-kvm BIOS move _PR to SSDT Jes Sorensen
2009-06-10 15:13 ` Gleb Natapov [this message]
2009-06-10 15:30   ` Jes Sorensen
2009-06-10 16:15     ` Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090610151301.GJ15949@redhat.com \
    --to=gleb@redhat.com \
    --cc=avi@redhat.com \
    --cc=jes@sgi.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox