2014-06-15 22:25:17 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
|
|
/** @constructor */
|
|
|
|
function ACPI(cpu)
|
|
|
|
{
|
|
|
|
if(!ENABLE_ACPI)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var io = cpu.io;
|
|
|
|
|
|
|
|
var acpi = {
|
|
|
|
pci_id: 0x07 << 3,
|
|
|
|
pci_space: [
|
|
|
|
0x86, 0x80, 0x13, 0x71, 0x07, 0x00, 0x80, 0x02, 0x08, 0x00, 0x80, 0x06, 0x00, 0x00, 0x80, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x01, 0x00, 0x00,
|
|
|
|
],
|
|
|
|
pci_bars: [],
|
|
|
|
};
|
|
|
|
|
|
|
|
// 00:07.0 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
|
|
|
|
cpu.devices.pci.register_device(acpi);
|
|
|
|
|
|
|
|
var elcr = 0;
|
|
|
|
|
|
|
|
// ACPI, ELCR register
|
2014-10-21 21:51:42 +02:00
|
|
|
io.register_write(0x4d0, this, function(data)
|
2014-06-15 22:25:17 +02:00
|
|
|
{
|
|
|
|
elcr = elcr & 0xFF00 | data;
|
|
|
|
});
|
2014-10-21 21:51:42 +02:00
|
|
|
io.register_write(0x4d1, this, function(data)
|
2014-06-15 22:25:17 +02:00
|
|
|
{
|
|
|
|
elcr = elcr & 0xFF | data << 8;
|
|
|
|
});
|
|
|
|
|
2014-10-21 21:51:42 +02:00
|
|
|
io.register_read(0xb3, this, function()
|
2014-06-15 22:25:17 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
});
|
|
|
|
|
|
|
|
// ACPI, pmtimer
|
2014-10-21 21:51:42 +02:00
|
|
|
io.register_read(0xb008, this, function()
|
2014-06-15 22:25:17 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
});
|
2014-10-21 21:51:42 +02:00
|
|
|
io.register_read(0xb009, this, function()
|
2014-06-15 22:25:17 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
});
|
2014-10-21 21:51:42 +02:00
|
|
|
io.register_read(0xb00a, this, function()
|
2014-06-15 22:25:17 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
});
|
2014-10-21 21:51:42 +02:00
|
|
|
io.register_read(0xb00b, this, function()
|
2014-06-15 22:25:17 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
});
|
|
|
|
|
|
|
|
// ACPI status
|
2014-10-21 21:51:42 +02:00
|
|
|
io.register_read(0xb004, this, function(data)
|
2014-06-15 22:25:17 +02:00
|
|
|
{
|
|
|
|
dbg_log("b004 read");
|
|
|
|
return 1;
|
|
|
|
});
|
2014-10-21 21:51:42 +02:00
|
|
|
io.register_read(0xb005, this, function(data)
|
2014-06-15 22:25:17 +02:00
|
|
|
{
|
|
|
|
dbg_log("b005 read");
|
|
|
|
return 0;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2014-07-14 21:33:40 +02:00
|
|
|
io.mmap_register(0xFEE00000, 0x100000,
|
2014-06-15 22:25:17 +02:00
|
|
|
function(addr)
|
|
|
|
{
|
2014-07-14 21:33:40 +02:00
|
|
|
addr = addr - 0xFEE00000 | 0;
|
2014-06-15 22:25:17 +02:00
|
|
|
dbg_log("APIC read " + h(addr), LOG_CPU);
|
|
|
|
return 0;
|
|
|
|
},
|
|
|
|
function(addr, value)
|
|
|
|
{
|
2014-07-14 21:33:40 +02:00
|
|
|
addr = addr - 0xFEE00000 | 0;
|
2014-06-15 22:25:17 +02:00
|
|
|
dbg_log("APIC write " + h(addr), LOG_CPU);
|
|
|
|
});
|
|
|
|
}
|