[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] - add rudimentary poweroff support for fully-virtualized domains via ACPI



Add rudimentary ACPI support which allows a fully virtualized domain
to perform a poweroff via the S5 state.  This involves adding S5
information to the ASL file; adding ACPI I/O address processing to
qemu and modifying the FADT to point to these specific I/O addresses.
Note that this is a rudimentary implementation, which is expected
to allow growth over time.  Currently, only allow/detect writes
to one of the PM registers, even though the S5 package specifies
data for both.  Currently, this is sufficient for the kernels
tested. (Specifically, use of _PST, and _GST and other methods
are unneccessary and not implemented.)

As with all ACPI changes, understanding what to do was more painful
than the trivial amount of code required.

Prior to this change, some domains would simply spin forever in their
kernel.  With this change, the poweroff is signaled to qemu (just
like other poweroff cases) and the domain is terminated as a
poweroff request.

Signed-off-by: Ben Thomas(ben@xxxxxxxxxxxxxxx)

--
------------------------------------------------------------------------
Ben Thomas                                         Virtual Iron Software
bthomas@xxxxxxxxxxxxxxx                            Tower 1, Floor 2
978-849-1214                                       900 Chelmsford Street
                                                   Lowell, MA 01851
diff -r 85de2de64699 tools/firmware/acpi/acpi_dsdt.asl
--- a/tools/firmware/acpi/acpi_dsdt.asl Mon May 08 14:54:22 2006 +0100
+++ b/tools/firmware/acpi/acpi_dsdt.asl Mon May 08 14:24:40 2006 -0400
@@ -36,6 +36,16 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
         Processor (CPU2, 0x02, 0x00000000, 0x00) {}
         Processor (CPU3, 0x03, 0x00000000, 0x00) {}
     }
+
+/* Poweroff support - ties in with qemu emulation */
+
+    Name (\_S5, Package (0x04)
+    {
+        0x07, 
+        0x07, 
+        0x00, 
+        0x00
+    })
 
     Scope (\_SB)
     {
diff -r 85de2de64699 tools/firmware/acpi/acpi_dsdt.c
--- a/tools/firmware/acpi/acpi_dsdt.c   Mon May 08 14:54:22 2006 +0100
+++ b/tools/firmware/acpi/acpi_dsdt.c   Mon May 08 14:24:40 2006 -0400
@@ -1,161 +1,160 @@
 /*
  * 
  * Intel ACPI Component Architecture
- * ASL Optimizing Compiler / AML Disassembler version 20050513 [Jun  8 2005]
+ * ASL Optimizing Compiler / AML Disassembler version 20050624 [Aug 24 2005]
  * Copyright (C) 2000 - 2005 Intel Corporation
  * Supports ACPI Specification Revision 3.0
  * 
- * Compilation of "acpi_dsdt.asl" - Wed Jun 15 09:19:49 2005
+ * Compilation of "acpi_dsdt.asl" - Thu May  4 17:42:00 2006
  * 
  * C source code output
  *
  */
 unsigned char AmlCode[] = 
 {
-    0x44,0x53,0x44,0x54,0x87,0x04,0x00,0x00,  /* 00000000    "DSDT...." */
-    0x01,0x19,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
+    0x44,0x53,0x44,0x54,0x7C,0x04,0x00,0x00,  /* 00000000    "DSDT|..." */
+    0x01,0x72,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    ".rINTEL " */
     0x58,0x45,0x4E,0x20,0x20,0x20,0x20,0x20,  /* 00000010    "XEN     " */
     0x02,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
-    0x13,0x05,0x05,0x20,0x08,0x5C,0x50,0x4D,  /* 00000020    "... .\PM" */
-    0x42,0x53,0x0B,0x00,0x0C,0x08,0x5C,0x50,  /* 00000028    "BS....\P" */
-    0x4D,0x4C,0x4E,0x0A,0x08,0x08,0x5C,0x49,  /* 00000030    "MLN...\I" */
-    0x4F,0x42,0x31,0x0A,0x00,0x08,0x5C,0x49,  /* 00000038    "OB1...\I" */
-    0x4F,0x4C,0x31,0x0A,0x00,0x08,0x5C,0x41,  /* 00000040    "OL1...\A" */
-    0x50,0x43,0x42,0x0C,0x00,0x00,0xC0,0xFE,  /* 00000048    "PCB....." */
-    0x08,0x5C,0x41,0x50,0x43,0x4C,0x0C,0x00,  /* 00000050    ".\APCL.." */
-    0x00,0x01,0x00,0x08,0x5C,0x50,0x55,0x49,  /* 00000058    "....\PUI" */
-    0x44,0x0A,0x00,0x10,0x3A,0x5C,0x5F,0x50,  /* 00000060    "D...:\_P" */
-    0x52,0x5F,0x5B,0x83,0x0B,0x43,0x50,0x55,  /* 00000068    "R_[..CPU" */
-    0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x5B,  /* 00000070    "0......[" */
-    0x83,0x0B,0x43,0x50,0x55,0x31,0x01,0x00,  /* 00000078    "..CPU1.." */
-    0x00,0x00,0x00,0x00,0x5B,0x83,0x0B,0x43,  /* 00000080    "....[..C" */
-    0x50,0x55,0x32,0x02,0x00,0x00,0x00,0x00,  /* 00000088    "PU2....." */
-    0x00,0x5B,0x83,0x0B,0x43,0x50,0x55,0x33,  /* 00000090    ".[..CPU3" */
-    0x03,0x00,0x00,0x00,0x00,0x00,0x10,0x48,  /* 00000098    ".......H" */
-    0x3E,0x5C,0x5F,0x53,0x42,0x5F,0x5B,0x82,  /* 000000A0    ">\_SB_[." */
-    0x4F,0x3D,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 000000A8    "O=PCI0._" */
-    0x48,0x49,0x44,0x0C,0x41,0xD0,0x0A,0x03,  /* 000000B0    "HID.A..." */
-    0x08,0x5F,0x55,0x49,0x44,0x0A,0x00,0x08,  /* 000000B8    "._UID..." */
-    0x5F,0x41,0x44,0x52,0x0A,0x00,0x08,0x5F,  /* 000000C0    "_ADR..._" */
-    0x42,0x42,0x4E,0x0A,0x00,0x14,0x4A,0x06,  /* 000000C8    "BBN...J." */
-    0x5F,0x43,0x52,0x53,0x00,0x08,0x50,0x52,  /* 000000D0    "_CRS..PR" */
-    0x54,0x30,0x11,0x48,0x05,0x0A,0x54,0x88,  /* 000000D8    "T0.H..T." */
-    0x0D,0x00,0x02,0x0F,0x00,0x00,0x00,0x00,  /* 000000E0    "........" */
-    0x00,0xFF,0x00,0x00,0x00,0x00,0x01,0x47,  /* 000000E8    ".......G" */
-    0x01,0xF8,0x0C,0xF8,0x0C,0x01,0x08,0x88,  /* 000000F0    "........" */
-    0x0D,0x00,0x01,0x0C,0x03,0x00,0x00,0x00,  /* 000000F8    "........" */
-    0x00,0xF7,0x0C,0x00,0x00,0xF8,0x0C,0x88,  /* 00000100    "........" */
-    0x0D,0x00,0x01,0x0C,0x03,0x00,0x00,0x00,  /* 00000108    "........" */
-    0x0D,0xFF,0x0F,0x00,0x00,0x00,0x03,0x87,  /* 00000110    "........" */
-    0x17,0x00,0x00,0x0C,0x02,0x00,0x00,0x00,  /* 00000118    "........" */
-    0x00,0x00,0x00,0x0A,0x00,0xFF,0xFF,0x0F,  /* 00000120    "........" */
-    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,  /* 00000128    "........" */
-    0x00,0x79,0x00,0xA4,0x50,0x52,0x54,0x30,  /* 00000130    ".y..PRT0" */
-    0x08,0x41,0x49,0x52,0x30,0x12,0x47,0x05,  /* 00000138    ".AIR0.G." */
-    0x06,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x1F,  /* 00000140    "........" */
-    0x00,0x0A,0x02,0x0A,0x00,0x0A,0x17,0x12,  /* 00000148    "........" */
-    0x0D,0x04,0x0C,0xFF,0xFF,0x1F,0x00,0x0A,  /* 00000150    "........" */
-    0x03,0x0A,0x00,0x0A,0x13,0x12,0x0D,0x04,  /* 00000158    "........" */
-    0x0C,0xFF,0xFF,0x1D,0x00,0x0A,0x01,0x0A,  /* 00000160    "........" */
-    0x00,0x0A,0x13,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000168    "........" */
-    0xFF,0x1D,0x00,0x0A,0x00,0x0A,0x00,0x0A,  /* 00000170    "........" */
-    0x10,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x1D,  /* 00000178    "........" */
-    0x00,0x0A,0x02,0x0A,0x00,0x0A,0x12,0x12,  /* 00000180    "........" */
-    0x0D,0x04,0x0C,0xFF,0xFF,0x1D,0x00,0x0A,  /* 00000188    "........" */
-    0x03,0x0A,0x00,0x0A,0x17,0x14,0x0B,0x5F,  /* 00000190    "......._" */
-    0x50,0x52,0x54,0x00,0xA4,0x41,0x49,0x52,  /* 00000198    "PRT..AIR" */
-    0x30,0x5B,0x82,0x44,0x2E,0x49,0x53,0x41,  /* 000001A0    "0[.D.ISA" */
-    0x5F,0x08,0x5F,0x41,0x44,0x52,0x0C,0x00,  /* 000001A8    "_._ADR.." */
-    0x00,0x01,0x00,0x5B,0x82,0x47,0x0B,0x53,  /* 000001B0    "...[.G.S" */
-    0x59,0x53,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 000001B8    "YSR._HID" */
-    0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,0x55,  /* 000001C0    ".A...._U" */
-    0x49,0x44,0x0A,0x01,0x08,0x43,0x52,0x53,  /* 000001C8    "ID...CRS" */
-    0x5F,0x11,0x4E,0x08,0x0A,0x8A,0x47,0x01,  /* 000001D0    "_.N...G." */
-    0x10,0x00,0x10,0x00,0x00,0x10,0x47,0x01,  /* 000001D8    "......G." */
-    0x22,0x00,0x22,0x00,0x00,0x0C,0x47,0x01,  /* 000001E0    ""."...G." */
-    0x30,0x00,0x30,0x00,0x00,0x10,0x47,0x01,  /* 000001E8    "0.0...G." */
-    0x44,0x00,0x44,0x00,0x00,0x1C,0x47,0x01,  /* 000001F0    "D.D...G." */
-    0x62,0x00,0x62,0x00,0x00,0x02,0x47,0x01,  /* 000001F8    "b.b...G." */
-    0x65,0x00,0x65,0x00,0x00,0x0B,0x47,0x01,  /* 00000200    "e.e...G." */
-    0x72,0x00,0x72,0x00,0x00,0x0E,0x47,0x01,  /* 00000208    "r.r...G." */
-    0x80,0x00,0x80,0x00,0x00,0x01,0x47,0x01,  /* 00000210    "......G." */
-    0x84,0x00,0x84,0x00,0x00,0x03,0x47,0x01,  /* 00000218    "......G." */
-    0x88,0x00,0x88,0x00,0x00,0x01,0x47,0x01,  /* 00000220    "......G." */
-    0x8C,0x00,0x8C,0x00,0x00,0x03,0x47,0x01,  /* 00000228    "......G." */
-    0x90,0x00,0x90,0x00,0x00,0x10,0x47,0x01,  /* 00000230    "......G." */
-    0xA2,0x00,0xA2,0x00,0x00,0x1C,0x47,0x01,  /* 00000238    "......G." */
-    0xE0,0x00,0xE0,0x00,0x00,0x10,0x47,0x01,  /* 00000240    "......G." */
-    0xA0,0x08,0xA0,0x08,0x00,0x04,0x47,0x01,  /* 00000248    "......G." */
-    0xC0,0x0C,0xC0,0x0C,0x00,0x10,0x47,0x01,  /* 00000250    "......G." */
-    0xD0,0x04,0xD0,0x04,0x00,0x02,0x79,0x00,  /* 00000258    "......y." */
-    0x14,0x0B,0x5F,0x43,0x52,0x53,0x00,0xA4,  /* 00000260    ".._CRS.." */
-    0x43,0x52,0x53,0x5F,0x5B,0x82,0x2B,0x50,  /* 00000268    "CRS_[.+P" */
-    0x49,0x43,0x5F,0x08,0x5F,0x48,0x49,0x44,  /* 00000270    "IC_._HID" */
-    0x0B,0x41,0xD0,0x08,0x5F,0x43,0x52,0x53,  /* 00000278    ".A.._CRS" */
-    0x11,0x18,0x0A,0x15,0x47,0x01,0x20,0x00,  /* 00000280    "....G. ." */
-    0x20,0x00,0x01,0x02,0x47,0x01,0xA0,0x00,  /* 00000288    " ...G..." */
-    0xA0,0x00,0x01,0x02,0x22,0x04,0x00,0x79,  /* 00000290    "...."..y" */
-    0x00,0x5B,0x82,0x47,0x05,0x44,0x4D,0x41,  /* 00000298    ".[.G.DMA" */
-    0x30,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 000002A0    "0._HID.A" */
-    0xD0,0x02,0x00,0x08,0x5F,0x43,0x52,0x53,  /* 000002A8    "...._CRS" */
-    0x11,0x41,0x04,0x0A,0x3D,0x2A,0x10,0x04,  /* 000002B0    ".A..=*.." */
-    0x47,0x01,0x00,0x00,0x00,0x00,0x00,0x10,  /* 000002B8    "G......." */
-    0x47,0x01,0x81,0x00,0x81,0x00,0x00,0x03,  /* 000002C0    "G......." */
-    0x47,0x01,0x87,0x00,0x87,0x00,0x00,0x01,  /* 000002C8    "G......." */
-    0x47,0x01,0x89,0x00,0x89,0x00,0x00,0x03,  /* 000002D0    "G......." */
-    0x47,0x01,0x8F,0x00,0x8F,0x00,0x00,0x01,  /* 000002D8    "G......." */
-    0x47,0x01,0xC0,0x00,0xC0,0x00,0x00,0x20,  /* 000002E0    "G...... " */
-    0x47,0x01,0x80,0x04,0x80,0x04,0x00,0x10,  /* 000002E8    "G......." */
-    0x79,0x00,0x5B,0x82,0x25,0x54,0x4D,0x52,  /* 000002F0    "y.[.%TMR" */
-    0x5F,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 000002F8    "_._HID.A" */
-    0xD0,0x01,0x00,0x08,0x5F,0x43,0x52,0x53,  /* 00000300    "...._CRS" */
-    0x11,0x10,0x0A,0x0D,0x47,0x01,0x40,0x00,  /* 00000308    "....G.@." */
-    0x40,0x00,0x00,0x04,0x22,0x01,0x00,0x79,  /* 00000310    "@..."..y" */
-    0x00,0x5B,0x82,0x25,0x52,0x54,0x43,0x5F,  /* 00000318    ".[.%RTC_" */
-    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000320    "._HID.A." */
-    0x0B,0x00,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000328    "..._CRS." */
-    0x10,0x0A,0x0D,0x47,0x01,0x70,0x00,0x70,  /* 00000330    "...G.p.p" */
-    0x00,0x00,0x02,0x22,0x00,0x01,0x79,0x00,  /* 00000338    "..."..y." */
-    0x5B,0x82,0x22,0x53,0x50,0x4B,0x52,0x08,  /* 00000340    "[."SPKR." */
-    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x08,  /* 00000348    "_HID.A.." */
-    0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x0D,  /* 00000350    ".._CRS.." */
-    0x0A,0x0A,0x47,0x01,0x61,0x00,0x61,0x00,  /* 00000358    "..G.a.a." */
-    0x00,0x01,0x79,0x00,0x5B,0x82,0x31,0x50,  /* 00000360    "..y.[.1P" */
-    0x53,0x32,0x4D,0x08,0x5F,0x48,0x49,0x44,  /* 00000368    "S2M._HID" */
-    0x0C,0x41,0xD0,0x0F,0x13,0x08,0x5F,0x43,  /* 00000370    ".A...._C" */
-    0x49,0x44,0x0C,0x41,0xD0,0x0F,0x13,0x14,  /* 00000378    "ID.A...." */
-    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 00000380    "._STA..." */
-    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x08,  /* 00000388    ".._CRS.." */
-    0x0A,0x05,0x22,0x00,0x10,0x79,0x00,0x5B,  /* 00000390    ".."..y.[" */
-    0x82,0x42,0x04,0x50,0x53,0x32,0x4B,0x08,  /* 00000398    ".B.PS2K." */
-    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x03,  /* 000003A0    "_HID.A.." */
-    0x03,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 000003A8    ".._CID.A" */
-    0xD0,0x03,0x0B,0x14,0x09,0x5F,0x53,0x54,  /* 000003B0    "....._ST" */
-    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 000003B8    "A....._C" */
-    0x52,0x53,0x11,0x18,0x0A,0x15,0x47,0x01,  /* 000003C0    "RS....G." */
-    0x60,0x00,0x60,0x00,0x00,0x01,0x47,0x01,  /* 000003C8    "`.`...G." */
-    0x64,0x00,0x64,0x00,0x00,0x01,0x22,0x02,  /* 000003D0    "d.d..."." */
-    0x00,0x79,0x00,0x5B,0x82,0x3A,0x46,0x44,  /* 000003D8    ".y.[.:FD" */
-    0x43,0x30,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 000003E0    "C0._HID." */
-    0x41,0xD0,0x07,0x00,0x14,0x09,0x5F,0x53,  /* 000003E8    "A....._S" */
-    0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,  /* 000003F0    "TA....._" */
-    0x43,0x52,0x53,0x11,0x1B,0x0A,0x18,0x47,  /* 000003F8    "CRS....G" */
-    0x01,0xF0,0x03,0xF0,0x03,0x01,0x06,0x47,  /* 00000400    ".......G" */
-    0x01,0xF7,0x03,0xF7,0x03,0x01,0x01,0x22,  /* 00000408    "......."" */
-    0x40,0x00,0x2A,0x04,0x00,0x79,0x00,0x5B,  /* 00000410    "@.*..y.[" */
-    0x82,0x36,0x55,0x41,0x52,0x31,0x08,0x5F,  /* 00000418    ".6UAR1._" */
-    0x48,0x49,0x44,0x0C,0x41,0xD0,0x05,0x01,  /* 00000420    "HID.A..." */
-    0x08,0x5F,0x55,0x49,0x44,0x0A,0x01,0x14,  /* 00000428    "._UID..." */
-    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 00000430    "._STA..." */
-    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x10,  /* 00000438    ".._CRS.." */
-    0x0A,0x0D,0x47,0x01,0xF8,0x03,0xF8,0x03,  /* 00000440    "..G....." */
-    0x01,0x08,0x22,0x10,0x00,0x79,0x00,0x5B,  /* 00000448    ".."..y.[" */
-    0x82,0x36,0x55,0x41,0x52,0x32,0x08,0x5F,  /* 00000450    ".6UAR2._" */
-    0x48,0x49,0x44,0x0C,0x41,0xD0,0x05,0x01,  /* 00000458    "HID.A..." */
-    0x08,0x5F,0x55,0x49,0x44,0x0A,0x02,0x14,  /* 00000460    "._UID..." */
-    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 00000468    "._STA..." */
-    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x10,  /* 00000470    ".._CRS.." */
-    0x0A,0x0D,0x47,0x01,0xF8,0x02,0xF8,0x02,  /* 00000478    "..G....." */
-    0x01,0x08,0x22,0x08,0x00,0x79,0x00,
+    0x24,0x06,0x05,0x20,0x08,0x50,0x4D,0x42,  /* 00000020    "$.. .PMB" */
+    0x53,0x0B,0x00,0x0C,0x08,0x50,0x4D,0x4C,  /* 00000028    "S....PML" */
+    0x4E,0x0A,0x08,0x08,0x49,0x4F,0x42,0x31,  /* 00000030    "N...IOB1" */
+    0x00,0x08,0x49,0x4F,0x4C,0x31,0x00,0x08,  /* 00000038    "..IOL1.." */
+    0x41,0x50,0x43,0x42,0x0C,0x00,0x00,0xC0,  /* 00000040    "APCB...." */
+    0xFE,0x08,0x41,0x50,0x43,0x4C,0x0C,0x00,  /* 00000048    "..APCL.." */
+    0x00,0x01,0x00,0x08,0x50,0x55,0x49,0x44,  /* 00000050    "....PUID" */
+    0x00,0x10,0x39,0x5F,0x50,0x52,0x5F,0x5B,  /* 00000058    "..9_PR_[" */
+    0x83,0x0B,0x43,0x50,0x55,0x30,0x00,0x00,  /* 00000060    "..CPU0.." */
+    0x00,0x00,0x00,0x00,0x5B,0x83,0x0B,0x43,  /* 00000068    "....[..C" */
+    0x50,0x55,0x31,0x01,0x00,0x00,0x00,0x00,  /* 00000070    "PU1....." */
+    0x00,0x5B,0x83,0x0B,0x43,0x50,0x55,0x32,  /* 00000078    ".[..CPU2" */
+    0x02,0x00,0x00,0x00,0x00,0x00,0x5B,0x83,  /* 00000080    "......[." */
+    0x0B,0x43,0x50,0x55,0x33,0x03,0x00,0x00,  /* 00000088    ".CPU3..." */
+    0x00,0x00,0x00,0x08,0x5F,0x53,0x35,0x5F,  /* 00000090    "...._S5_" */
+    0x12,0x08,0x04,0x0A,0x07,0x0A,0x07,0x00,  /* 00000098    "........" */
+    0x00,0x10,0x4A,0x3D,0x5F,0x53,0x42,0x5F,  /* 000000A0    "..J=_SB_" */
+    0x5B,0x82,0x42,0x3D,0x50,0x43,0x49,0x30,  /* 000000A8    "[.B=PCI0" */
+    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 000000B0    "._HID.A." */
+    0x0A,0x03,0x08,0x5F,0x55,0x49,0x44,0x00,  /* 000000B8    "..._UID." */
+    0x08,0x5F,0x41,0x44,0x52,0x00,0x08,0x5F,  /* 000000C0    "._ADR.._" */
+    0x42,0x42,0x4E,0x00,0x14,0x4A,0x06,0x5F,  /* 000000C8    "BBN..J._" */
+    0x43,0x52,0x53,0x00,0x08,0x50,0x52,0x54,  /* 000000D0    "CRS..PRT" */
+    0x30,0x11,0x48,0x05,0x0A,0x54,0x88,0x0D,  /* 000000D8    "0.H..T.." */
+    0x00,0x02,0x0F,0x00,0x00,0x00,0x00,0x00,  /* 000000E0    "........" */
+    0xFF,0x00,0x00,0x00,0x00,0x01,0x47,0x01,  /* 000000E8    "......G." */
+    0xF8,0x0C,0xF8,0x0C,0x01,0x08,0x88,0x0D,  /* 000000F0    "........" */
+    0x00,0x01,0x0C,0x03,0x00,0x00,0x00,0x00,  /* 000000F8    "........" */
+    0xF7,0x0C,0x00,0x00,0xF8,0x0C,0x88,0x0D,  /* 00000100    "........" */
+    0x00,0x01,0x0C,0x03,0x00,0x00,0x00,0x0D,  /* 00000108    "........" */
+    0xFF,0x0F,0x00,0x00,0x00,0x03,0x87,0x17,  /* 00000110    "........" */
+    0x00,0x00,0x0C,0x02,0x00,0x00,0x00,0x00,  /* 00000118    "........" */
+    0x00,0x00,0x0A,0x00,0xFF,0xFF,0x0F,0x00,  /* 00000120    "........" */
+    0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,  /* 00000128    "........" */
+    0x79,0x00,0xA4,0x50,0x52,0x54,0x30,0x08,  /* 00000130    "y..PRT0." */
+    0x41,0x49,0x52,0x30,0x12,0x4F,0x04,0x06,  /* 00000138    "AIR0.O.." */
+    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x1F,0x00,  /* 00000140    "........" */
+    0x0A,0x02,0x00,0x0A,0x17,0x12,0x0C,0x04,  /* 00000148    "........" */
+    0x0C,0xFF,0xFF,0x1F,0x00,0x0A,0x03,0x00,  /* 00000150    "........" */
+    0x0A,0x13,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000158    "........" */
+    0x1D,0x00,0x01,0x00,0x0A,0x13,0x12,0x0B,  /* 00000160    "........" */
+    0x04,0x0C,0xFF,0xFF,0x1D,0x00,0x00,0x00,  /* 00000168    "........" */
+    0x0A,0x10,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000170    "........" */
+    0x1D,0x00,0x0A,0x02,0x00,0x0A,0x12,0x12,  /* 00000178    "........" */
+    0x0C,0x04,0x0C,0xFF,0xFF,0x1D,0x00,0x0A,  /* 00000180    "........" */
+    0x03,0x00,0x0A,0x17,0x14,0x0B,0x5F,0x50,  /* 00000188    "......_P" */
+    0x52,0x54,0x00,0xA4,0x41,0x49,0x52,0x30,  /* 00000190    "RT..AIR0" */
+    0x5B,0x82,0x42,0x2E,0x49,0x53,0x41,0x5F,  /* 00000198    "[.B.ISA_" */
+    0x08,0x5F,0x41,0x44,0x52,0x0C,0x00,0x00,  /* 000001A0    "._ADR..." */
+    0x01,0x00,0x5B,0x82,0x46,0x0B,0x53,0x59,  /* 000001A8    "..[.F.SY" */
+    0x53,0x52,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 000001B0    "SR._HID." */
+    0x41,0xD0,0x0C,0x02,0x08,0x5F,0x55,0x49,  /* 000001B8    "A...._UI" */
+    0x44,0x01,0x08,0x43,0x52,0x53,0x5F,0x11,  /* 000001C0    "D..CRS_." */
+    0x4E,0x08,0x0A,0x8A,0x47,0x01,0x10,0x00,  /* 000001C8    "N...G..." */
+    0x10,0x00,0x00,0x10,0x47,0x01,0x22,0x00,  /* 000001D0    "....G."." */
+    0x22,0x00,0x00,0x0C,0x47,0x01,0x30,0x00,  /* 000001D8    ""...G.0." */
+    0x30,0x00,0x00,0x10,0x47,0x01,0x44,0x00,  /* 000001E0    "0...G.D." */
+    0x44,0x00,0x00,0x1C,0x47,0x01,0x62,0x00,  /* 000001E8    "D...G.b." */
+    0x62,0x00,0x00,0x02,0x47,0x01,0x65,0x00,  /* 000001F0    "b...G.e." */
+    0x65,0x00,0x00,0x0B,0x47,0x01,0x72,0x00,  /* 000001F8    "e...G.r." */
+    0x72,0x00,0x00,0x0E,0x47,0x01,0x80,0x00,  /* 00000200    "r...G..." */
+    0x80,0x00,0x00,0x01,0x47,0x01,0x84,0x00,  /* 00000208    "....G..." */
+    0x84,0x00,0x00,0x03,0x47,0x01,0x88,0x00,  /* 00000210    "....G..." */
+    0x88,0x00,0x00,0x01,0x47,0x01,0x8C,0x00,  /* 00000218    "....G..." */
+    0x8C,0x00,0x00,0x03,0x47,0x01,0x90,0x00,  /* 00000220    "....G..." */
+    0x90,0x00,0x00,0x10,0x47,0x01,0xA2,0x00,  /* 00000228    "....G..." */
+    0xA2,0x00,0x00,0x1C,0x47,0x01,0xE0,0x00,  /* 00000230    "....G..." */
+    0xE0,0x00,0x00,0x10,0x47,0x01,0xA0,0x08,  /* 00000238    "....G..." */
+    0xA0,0x08,0x00,0x04,0x47,0x01,0xC0,0x0C,  /* 00000240    "....G..." */
+    0xC0,0x0C,0x00,0x10,0x47,0x01,0xD0,0x04,  /* 00000248    "....G..." */
+    0xD0,0x04,0x00,0x02,0x79,0x00,0x14,0x0B,  /* 00000250    "....y..." */
+    0x5F,0x43,0x52,0x53,0x00,0xA4,0x43,0x52,  /* 00000258    "_CRS..CR" */
+    0x53,0x5F,0x5B,0x82,0x2B,0x50,0x49,0x43,  /* 00000260    "S_[.+PIC" */
+    0x5F,0x08,0x5F,0x48,0x49,0x44,0x0B,0x41,  /* 00000268    "_._HID.A" */
+    0xD0,0x08,0x5F,0x43,0x52,0x53,0x11,0x18,  /* 00000270    ".._CRS.." */
+    0x0A,0x15,0x47,0x01,0x20,0x00,0x20,0x00,  /* 00000278    "..G. . ." */
+    0x01,0x02,0x47,0x01,0xA0,0x00,0xA0,0x00,  /* 00000280    "..G....." */
+    0x01,0x02,0x22,0x04,0x00,0x79,0x00,0x5B,  /* 00000288    ".."..y.[" */
+    0x82,0x47,0x05,0x44,0x4D,0x41,0x30,0x08,  /* 00000290    ".G.DMA0." */
+    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x02,  /* 00000298    "_HID.A.." */
+    0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x41,  /* 000002A0    ".._CRS.A" */
+    0x04,0x0A,0x3D,0x2A,0x10,0x04,0x47,0x01,  /* 000002A8    "..=*..G." */
+    0x00,0x00,0x00,0x00,0x00,0x10,0x47,0x01,  /* 000002B0    "......G." */
+    0x81,0x00,0x81,0x00,0x00,0x03,0x47,0x01,  /* 000002B8    "......G." */
+    0x87,0x00,0x87,0x00,0x00,0x01,0x47,0x01,  /* 000002C0    "......G." */
+    0x89,0x00,0x89,0x00,0x00,0x03,0x47,0x01,  /* 000002C8    "......G." */
+    0x8F,0x00,0x8F,0x00,0x00,0x01,0x47,0x01,  /* 000002D0    "......G." */
+    0xC0,0x00,0xC0,0x00,0x00,0x20,0x47,0x01,  /* 000002D8    "..... G." */
+    0x80,0x04,0x80,0x04,0x00,0x10,0x79,0x00,  /* 000002E0    "......y." */
+    0x5B,0x82,0x25,0x54,0x4D,0x52,0x5F,0x08,  /* 000002E8    "[.%TMR_." */
+    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x01,  /* 000002F0    "_HID.A.." */
+    0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x10,  /* 000002F8    ".._CRS.." */
+    0x0A,0x0D,0x47,0x01,0x40,0x00,0x40,0x00,  /* 00000300    "..G.@.@." */
+    0x00,0x04,0x22,0x01,0x00,0x79,0x00,0x5B,  /* 00000308    ".."..y.[" */
+    0x82,0x25,0x52,0x54,0x43,0x5F,0x08,0x5F,  /* 00000310    ".%RTC_._" */
+    0x48,0x49,0x44,0x0C,0x41,0xD0,0x0B,0x00,  /* 00000318    "HID.A..." */
+    0x08,0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,  /* 00000320    "._CRS..." */
+    0x0D,0x47,0x01,0x70,0x00,0x70,0x00,0x00,  /* 00000328    ".G.p.p.." */
+    0x02,0x22,0x00,0x01,0x79,0x00,0x5B,0x82,  /* 00000330    "."..y.[." */
+    0x22,0x53,0x50,0x4B,0x52,0x08,0x5F,0x48,  /* 00000338    ""SPKR._H" */
+    0x49,0x44,0x0C,0x41,0xD0,0x08,0x00,0x08,  /* 00000340    "ID.A...." */
+    0x5F,0x43,0x52,0x53,0x11,0x0D,0x0A,0x0A,  /* 00000348    "_CRS...." */
+    0x47,0x01,0x61,0x00,0x61,0x00,0x00,0x01,  /* 00000350    "G.a.a..." */
+    0x79,0x00,0x5B,0x82,0x31,0x50,0x53,0x32,  /* 00000358    "y.[.1PS2" */
+    0x4D,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000360    "M._HID.A" */
+    0xD0,0x0F,0x13,0x08,0x5F,0x43,0x49,0x44,  /* 00000368    "...._CID" */
+    0x0C,0x41,0xD0,0x0F,0x13,0x14,0x09,0x5F,  /* 00000370    ".A....._" */
+    0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,  /* 00000378    "STA....." */
+    0x5F,0x43,0x52,0x53,0x11,0x08,0x0A,0x05,  /* 00000380    "_CRS...." */
+    0x22,0x00,0x10,0x79,0x00,0x5B,0x82,0x42,  /* 00000388    ""..y.[.B" */
+    0x04,0x50,0x53,0x32,0x4B,0x08,0x5F,0x48,  /* 00000390    ".PS2K._H" */
+    0x49,0x44,0x0C,0x41,0xD0,0x03,0x03,0x08,  /* 00000398    "ID.A...." */
+    0x5F,0x43,0x49,0x44,0x0C,0x41,0xD0,0x03,  /* 000003A0    "_CID.A.." */
+    0x0B,0x14,0x09,0x5F,0x53,0x54,0x41,0x00,  /* 000003A8    "..._STA." */
+    0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,  /* 000003B0    "...._CRS" */
+    0x11,0x18,0x0A,0x15,0x47,0x01,0x60,0x00,  /* 000003B8    "....G.`." */
+    0x60,0x00,0x00,0x01,0x47,0x01,0x64,0x00,  /* 000003C0    "`...G.d." */
+    0x64,0x00,0x00,0x01,0x22,0x02,0x00,0x79,  /* 000003C8    "d..."..y" */
+    0x00,0x5B,0x82,0x3A,0x46,0x44,0x43,0x30,  /* 000003D0    ".[.:FDC0" */
+    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 000003D8    "._HID.A." */
+    0x07,0x00,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 000003E0    "...._STA" */
+    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 000003E8    "....._CR" */
+    0x53,0x11,0x1B,0x0A,0x18,0x47,0x01,0xF0,  /* 000003F0    "S....G.." */
+    0x03,0xF0,0x03,0x01,0x06,0x47,0x01,0xF7,  /* 000003F8    ".....G.." */
+    0x03,0xF7,0x03,0x01,0x01,0x22,0x40,0x00,  /* 00000400    "....."@." */
+    0x2A,0x04,0x00,0x79,0x00,0x5B,0x82,0x35,  /* 00000408    "*..y.[.5" */
+    0x55,0x41,0x52,0x31,0x08,0x5F,0x48,0x49,  /* 00000410    "UAR1._HI" */
+    0x44,0x0C,0x41,0xD0,0x05,0x01,0x08,0x5F,  /* 00000418    "D.A...._" */
+    0x55,0x49,0x44,0x01,0x14,0x09,0x5F,0x53,  /* 00000420    "UID..._S" */
+    0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,  /* 00000428    "TA....._" */
+    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000430    "CRS....G" */
+    0x01,0xF8,0x03,0xF8,0x03,0x01,0x08,0x22,  /* 00000438    "......."" */
+    0x10,0x00,0x79,0x00,0x5B,0x82,0x36,0x55,  /* 00000440    "..y.[.6U" */
+    0x41,0x52,0x32,0x08,0x5F,0x48,0x49,0x44,  /* 00000448    "AR2._HID" */
+    0x0C,0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,  /* 00000450    ".A...._U" */
+    0x49,0x44,0x0A,0x02,0x14,0x09,0x5F,0x53,  /* 00000458    "ID...._S" */
+    0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,  /* 00000460    "TA....._" */
+    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000468    "CRS....G" */
+    0x01,0xF8,0x02,0xF8,0x02,0x01,0x08,0x22,  /* 00000470    "......."" */
+    0x08,0x00,0x79,0x00,
 };
 int DsdtLen=sizeof(AmlCode);
diff -r 85de2de64699 tools/firmware/acpi/acpi_fadt.h
--- a/tools/firmware/acpi/acpi_fadt.h   Mon May 08 14:54:22 2006 +0100
+++ b/tools/firmware/acpi/acpi_fadt.h   Mon May 08 14:24:40 2006 -0400
@@ -59,7 +59,7 @@
 #define ACPI_PM1A_EVT_BLK_ADDRESS_SPACE_ID  ACPI_SYSTEM_IO
 #define ACPI_PM1A_EVT_BLK_BIT_WIDTH         0x00
 #define ACPI_PM1A_EVT_BLK_BIT_OFFSET        0x00
-#define ACPI_PM1A_EVT_BLK_ADDRESS           0x0000000000000000
+#define ACPI_PM1A_EVT_BLK_ADDRESS           0x0000000000008000
 
 //
 // PM1B Event Register Block Generic Address Information
@@ -73,7 +73,7 @@
 // PM1A Control Register Block Generic Address Information
 //
 #define ACPI_PM1A_CNT_BLK_ADDRESS_SPACE_ID  ACPI_SYSTEM_IO
-#define ACPI_PM1A_CNT_BLK_BIT_WIDTH         0x10
+#define ACPI_PM1A_CNT_BLK_BIT_WIDTH         0x08
 #define ACPI_PM1A_CNT_BLK_BIT_OFFSET        0x00
 #define ACPI_PM1A_CNT_BLK_ADDRESS           (ACPI_PM1A_EVT_BLK_ADDRESS + 0x04)
 
diff -r 85de2de64699 tools/ioemu/hw/pc.c
--- a/tools/ioemu/hw/pc.c       Mon May 08 14:54:22 2006 +0100
+++ b/tools/ioemu/hw/pc.c       Mon May 08 14:24:40 2006 -0400
@@ -373,6 +373,8 @@ static int serial_io[MAX_SERIAL_PORTS] =
 static int serial_io[MAX_SERIAL_PORTS] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
 static int serial_irq[MAX_SERIAL_PORTS] = { 4, 3, 4, 3 };
 
+extern int acpi_init(unsigned int base);
+
 #define NOBIOS 1
 
 /* PC hardware initialisation */
@@ -574,6 +576,7 @@ void pc_init(uint64_t ram_size, int vga_
     floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table);
 
     cmos_init(ram_size, boot_device, bs_table);
+    acpi_init(0x8000);
 
     /* must be done after all PCI devices are instanciated */
     /* XXX: should be done in the Bochs BIOS */
diff -r 85de2de64699 tools/ioemu/target-i386-dm/Makefile
--- a/tools/ioemu/target-i386-dm/Makefile       Mon May 08 14:54:22 2006 +0100
+++ b/tools/ioemu/target-i386-dm/Makefile       Mon May 08 14:24:40 2006 -0400
@@ -278,7 +278,7 @@ endif
 # Hardware support
 VL_OBJS+= ide.o ne2000.o pckbd.o vga.o dma.o
 VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259_stub.o pc.o port-e9.o
-VL_OBJS+= cirrus_vga.o pcnet.o
+VL_OBJS+= cirrus_vga.o pcnet.o acpi.o
 VL_OBJS+= $(SOUND_HW) $(AUDIODRV) mixeng.o
 
 ifeq ($(TARGET_ARCH), ppc)
@@ -318,7 +318,7 @@ endif
 endif
 
 $(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
-       $(CC) $(CFLAGS) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VNC_LIBS) 
$(VL_LIBS) -lpthread
+       $(CC) $(CFLAGS) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VNC_LIBS) 
$(VL_LIBS) -lpthread  -Wl,-Map,qemu-dm.map -Wl,--cref
 
 vnc.o: vnc.c keyboard_rdesktop.c
        $(CC) $(CFLAGS) $(DEFINES) $(VNC_CFLAGS) -c -o $@ $<
diff -r 85de2de64699 tools/ioemu/hw/acpi.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/ioemu/hw/acpi.c     Mon May 08 14:24:40 2006 -0400
@@ -0,0 +1,178 @@
+/*
+ * ACPI emulation
+ * 
+ * Copyright (c) 2006 Virtual Iron Software
+ *
+ * This module provides the beginnings of some ACPI emulation.
+ * Initially, this code handles writes to the sleep state
+ * registers. This is done to detect requests to power-off
+ * a guest domain.
+ *
+ * Later, and driven by empirical evidence, additional capabilities
+ * and emulation might be added.
+ *
+ * Currently, the FADT specifies a small register set, of which
+ * only PM1_CNTa is available.  In addition, the ASL code specifies
+ * the proper values to write on an S5 (poweroff) request, which
+ * this code understands.
+ *
+ */
+
+#include "vl.h"
+extern FILE* logfile;
+
+// Define some basic offsets to ACPI registers
+
+//#define DEBUG_ACPI
+#define        PM1a_STS        0x0
+#define        PM1a_EN         0x1
+#define        PM1b_STS        0x2
+#define        PM1b_EN         0x3
+#define        PM1_CNTa        0x4
+#define        PM1_CNTb        0x6
+
+// Values within PM1_CNTa that we need for power handling
+
+#define        SLP_TYP_MASK    0x1C00
+#define        SLP_VAL         0x1C00
+#define        SLP_EN          0x2000
+
+// Base ACPI register address
+
+static unsigned int acpi_base = 0;
+
+/* acpi_write_byte - handle byte writes for ACPI I/O region
+ *
+ * Input:
+ *     opaque  pointer to private data structure (currently NULL)
+ *     addr    I/O space address to be written
+ *     data    data to be written
+ *
+ * Output:
+ *     none
+ *
+ * Returns:
+ *     none
+ */
+
+static void acpi_write_byte(void *opaque, uint32_t addr, uint32_t data) {
+
+#ifdef DEBUG_ACPI
+  fprintf(logfile, "%s - addr 0x%x, data 0x%x\n", __FUNCTION__, addr, data);
+#endif
+
+  // All byte writes are currently ignored
+
+  return;
+}
+
+/* acpi_write_word - handle word writes for ACPI I/O region
+ *
+ * Input:
+ *     opaque  pointer to private data structure (currently NULL)
+ *     addr    I/O space address to be written
+ *     data    data to be written
+ *
+ * Output:
+ *     none
+ *
+ * Returns:
+ *     none
+ */
+
+static void acpi_write_word(void *opaque, uint32_t addr, uint32_t data) {
+
+#ifdef DEBUG_ACPI
+  fprintf(logfile, "%s - addr 0x%x, data 0x%x\n", __FUNCTION__, addr, data);
+#endif
+
+  // Only a write to PM1_CNTa for power operations is handled
+  // All others are ignored
+
+  if (addr == acpi_base + PM1_CNTa) {
+    if ( ( (data & SLP_EN) != 0) &&
+        ( (data & SLP_TYP_MASK) == SLP_VAL) ) {
+      qemu_system_shutdown_request();
+      fprintf(logfile, "%s - ACPI Power State 5 (poweroff) requested\n", 
__FUNCTION__);
+    }
+  }
+
+  return;
+}
+
+/* acpi_read_byte - handle byte reads for ACPI I/O region
+ *
+ * Input:
+ *     opaque  pointer to private data structure (currently NULL)
+ *     addr    I/O space address to be written
+ *
+ * Output:
+ *     none
+ *
+ * Returns:
+ *     data read
+ */
+
+static uint32_t acpi_read_byte(void *opaque, uint32_t addr) {
+
+#ifdef DEBUG_ACPI
+  fprintf(logfile, "%s - addr 0x%x\n", __FUNCTION__, addr);
+#endif
+
+  // All reads return 0
+
+  return 0;
+}
+
+/* acpi_read_word - handle word reads for ACPI I/O region
+ *
+ * Input:
+ *     opaque  pointer to private data structure (currently NULL)
+ *     addr    I/O space address to be written
+ *
+ * Output:
+ *     none
+ *
+ * Returns:
+ *     data read
+ */
+
+static uint32_t acpi_read_word(void *opaque, uint32_t addr) {
+
+#ifdef DEBUG_ACPI
+  fprintf(logfile, "%s - addr 0x%x\n", __FUNCTION__, addr);
+#endif
+
+  // All reads return 0
+
+  return 0;
+}
+
+/* acpi_init - initialize for ACPI I/O space operation handling
+ *
+ * Input:
+ *     base    base I/O address
+ *
+ * Output:
+ *     none
+ *
+ * Returns:
+ *     status
+ */
+
+int acpi_init(unsigned int base) {
+
+  fprintf(logfile, "%s - registering ACPI addresses at 0x%x\n", __FUNCTION__, 
base);
+
+  // Map 16 bytes of reads/writes for bytes/words
+
+  register_ioport_write(base, 16, sizeof(unsigned char), acpi_write_byte, 
NULL);
+  register_ioport_read(base,  16, sizeof(unsigned char), acpi_read_byte,  
NULL);
+
+  register_ioport_write(base, 16, sizeof(unsigned short), acpi_write_word, 
NULL);
+  register_ioport_read(base,  16, sizeof(unsigned short), acpi_read_word,  
NULL);
+
+  acpi_base = base;
+
+  return 0;
+}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.