74523b8501
This adds ASL code as well as scripts for processing it, imported from seabios git tree commit 51684b7ced75fb76776e8ee84833fcfb6ecf12dd Will be used for runtime acpi table generation. Note: This patch reuses some code from SeaBIOS, which was originally under LGPLv2 and then relicensed to GPLv3 or LGPLv3, in QEMU under GPLv2+. This relicensing has been acked by all contributors that had contributed to the code since the v2->v3 relicense. ACKs approving the v2+ relicensing are listed below. The list might include ACKs from people not holding copyright on any parts of the reused code, but it's better to err on the side of caution and include them. Affected SeaBIOS files (GPLv2+ license headers added) <http://thread.gmane.org/gmane.comp.bios.coreboot.seabios/5949>: src/acpi-dsdt-cpu-hotplug.dsl src/acpi-dsdt-dbug.dsl src/acpi-dsdt-hpet.dsl src/acpi-dsdt-isa.dsl src/acpi-dsdt-pci-crs.dsl src/acpi.c src/acpi.h src/ssdt-misc.dsl src/ssdt-pcihp.dsl src/ssdt-proc.dsl tools/acpi_extract.py tools/acpi_extract_preprocess.py Each one of the listed people agreed to the following: > If you allow the use of your contribution in QEMU under the > terms of GPLv2 or later as proposed by this patch, > please respond to this mail including the line: > > Acked-by: Name <email address> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Jason Baron <jbaron@akamai.com> Acked-by: David Woodhouse <David.Woodhouse@intel.com> Acked-by: Gleb Natapov <gleb@redhat.com> Acked-by: Marcelo Tosatti <mtosatti@redhat.com> Acked-by: Dave Frodin <dave.frodin@se-eng.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Kevin O'Connor <kevin@koconnor.net> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Acked-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Magnus Christensson <magnus.christensson@intel.com> Acked-by: Hu Tao <hutao@cn.fujitsu.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Tested-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
94 lines
3.3 KiB
Plaintext
94 lines
3.3 KiB
Plaintext
/*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/****************************************************************
|
|
* CPU hotplug
|
|
****************************************************************/
|
|
|
|
Scope(\_SB) {
|
|
/* Objects filled in by run-time generated SSDT */
|
|
External(NTFY, MethodObj)
|
|
External(CPON, PkgObj)
|
|
|
|
/* Methods called by run-time generated SSDT Processor objects */
|
|
Method(CPMA, 1, NotSerialized) {
|
|
// _MAT method - create an madt apic buffer
|
|
// Arg0 = Processor ID = Local APIC ID
|
|
// Local0 = CPON flag for this cpu
|
|
Store(DerefOf(Index(CPON, Arg0)), Local0)
|
|
// Local1 = Buffer (in madt apic form) to return
|
|
Store(Buffer(8) {0x00, 0x08, 0x00, 0x00, 0x00, 0, 0, 0}, Local1)
|
|
// Update the processor id, lapic id, and enable/disable status
|
|
Store(Arg0, Index(Local1, 2))
|
|
Store(Arg0, Index(Local1, 3))
|
|
Store(Local0, Index(Local1, 4))
|
|
Return (Local1)
|
|
}
|
|
Method(CPST, 1, NotSerialized) {
|
|
// _STA method - return ON status of cpu
|
|
// Arg0 = Processor ID = Local APIC ID
|
|
// Local0 = CPON flag for this cpu
|
|
Store(DerefOf(Index(CPON, Arg0)), Local0)
|
|
If (Local0) {
|
|
Return (0xF)
|
|
} Else {
|
|
Return (0x0)
|
|
}
|
|
}
|
|
Method(CPEJ, 2, NotSerialized) {
|
|
// _EJ0 method - eject callback
|
|
Sleep(200)
|
|
}
|
|
|
|
/* CPU hotplug notify method */
|
|
OperationRegion(PRST, SystemIO, 0xaf00, 32)
|
|
Field(PRST, ByteAcc, NoLock, Preserve) {
|
|
PRS, 256
|
|
}
|
|
Method(PRSC, 0) {
|
|
// Local5 = active cpu bitmap
|
|
Store(PRS, Local5)
|
|
// Local2 = last read byte from bitmap
|
|
Store(Zero, Local2)
|
|
// Local0 = Processor ID / APIC ID iterator
|
|
Store(Zero, Local0)
|
|
While (LLess(Local0, SizeOf(CPON))) {
|
|
// Local1 = CPON flag for this cpu
|
|
Store(DerefOf(Index(CPON, Local0)), Local1)
|
|
If (And(Local0, 0x07)) {
|
|
// Shift down previously read bitmap byte
|
|
ShiftRight(Local2, 1, Local2)
|
|
} Else {
|
|
// Read next byte from cpu bitmap
|
|
Store(DerefOf(Index(Local5, ShiftRight(Local0, 3))), Local2)
|
|
}
|
|
// Local3 = active state for this cpu
|
|
Store(And(Local2, 1), Local3)
|
|
|
|
If (LNotEqual(Local1, Local3)) {
|
|
// State change - update CPON with new state
|
|
Store(Local3, Index(CPON, Local0))
|
|
// Do CPU notify
|
|
If (LEqual(Local3, 1)) {
|
|
NTFY(Local0, 1)
|
|
} Else {
|
|
NTFY(Local0, 3)
|
|
}
|
|
}
|
|
Increment(Local0)
|
|
}
|
|
}
|
|
}
|