WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH][7/10] ACPI support for guest firmware.

To: Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH][7/10] ACPI support for guest firmware.
From: Arun Sharma <arun.sharma@xxxxxxxxx>
Date: Wed, 29 Jun 2005 22:52:13 -0700
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 30 Jun 2005 05:47:56 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
ACPI support for guest firmware.

Signed-off-by: Ke Yu <ke.yu@xxxxxxxxx>
Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>

diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/Makefile
--- a/tools/firmware/Makefile   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/Makefile   Thu Jun 30 04:23:18 2005
@@ -7,6 +7,7 @@
 SUBDIRS :=
 SUBDIRS += rombios
 SUBDIRS += vgabios
+SUBDIRS += acpi
 SUBDIRS += vmxassist
 
 .PHONY: all install clean
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/vmxassist/vmxloader.c
--- a/tools/firmware/vmxassist/vmxloader.c      Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/vmxassist/vmxloader.c      Thu Jun 30 04:23:18 2005
@@ -23,6 +23,12 @@
  */
 #include "machine.h"
 #include "roms.h"
+
+#ifdef _ACPI_
+#include "acpi.h"
+#include "../acpi/acpi2_0.h"  // for ACPI_PHYSICAL_ADDRESS
+#endif
+
 
 /*
  * C runtime start off
@@ -102,6 +108,16 @@
                memcpy((void *)0xC0000,
                        vgabios_stdvga, sizeof(vgabios_stdvga));
        }
+#ifdef _ACPI_
+       puts("Loading ACPI ...\n");
+    if (ACPI_PHYSICAL_ADDRESS+sizeof(acpi) <= 0xF0000 ){
+        /* make sure acpi table does not overlap rombios
+                * currently acpi less than 8K will be OK.
+                */
+                memcpy((void *)ACPI_PHYSICAL_ADDRESS, acpi, sizeof(acpi));
+       }
+#endif
+                       
        puts("Loading VMXAssist ...\n");
        memcpy((void *)TEXTADDR, vmxassist, sizeof(vmxassist));
        puts("Go ...\n");
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/vmxassist/Makefile
--- a/tools/firmware/vmxassist/Makefile Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/vmxassist/Makefile Thu Jun 30 04:23:18 2005
@@ -24,8 +24,8 @@
 # The emulator code lives in ROM space
 TEXTADDR=0x000D0000
 
-DEFINES=-DDEBUG -DTEXTADDR=${TEXTADDR}
-XENINC=-I$(XEN_ROOT)/xen/include
+DEFINES=-DDEBUG -DTEXTADDR=${TEXTADDR} -D_ACPI_
+XENINC=-I$(XEN_ROOT)/xen/include -I$(XEN_ROOT)/tools/libxc
 #DEFINES=-DDEBUG -DTEST -DTEXTADDR=${TEXTADDR}
 #XENINC=-I/home/leendert/xen/xeno-unstable.bk/xen/include
 
@@ -44,7 +44,7 @@
 
 all: vmxloader
 
-vmxloader: roms.h vmxloader.c
+vmxloader: roms.h vmxloader.c acpi.h
        ${CC} ${CFLAGS} ${DEFINES} -c vmxloader.c
        $(CC) -o vmxloader.tmp -m32 -nostdlib -Wl,-N -Wl,-Ttext -Wl,0x100000 
vmxloader.o
        objcopy --change-addresses=0xC0000000 vmxloader.tmp vmxloader
@@ -79,6 +79,9 @@
        ./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus.bin >> 
roms.h
        ./mkhex vmxassist vmxassist.bin >> roms.h
 
+acpi.h: ../acpi/acpi.bin
+       ./mkhex acpi ../acpi/acpi.bin > acpi.h
+
 offsets.h: gen
        ./gen > offsets.h
 
@@ -86,7 +89,7 @@
        ${CC} ${CFLAGS} -o gen gen.c
 
 clean:
-       rm -f vmxassist vmxassist.tmp vmxassist.bin vmxassist.run vmxassist.sym 
head.s roms.h
+       rm -f vmxassist vmxassist.tmp vmxassist.bin vmxassist.run vmxassist.sym 
head.s roms.h acpi.h
        rm -f vmxloader vmxloader.tmp vmxloader.o ${OBJECTS}
        rm -f gen gen.o offsets.h
 
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_madt.c
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_madt.c   Thu Jun 30 04:23:18 2005
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+#include "acpi_madt.h"
+
+//
+// Multiple APIC Description Table
+//
+
+ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt = {
+               {
+                               {
+                                               
ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+                                               sizeof 
(ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE),
+                                               ACPI_2_0_MADT_REVISION,
+                                               0x00,  // Checksum
+                                               ACPI_OEM_ID, 
+                                               ACPI_OEM_TABLE_ID,  
+                                               ACPI_OEM_REVISION, 
+                                               ACPI_CREATOR_ID,  
+                                               ACPI_CREATOR_REVISION, 
+                               },
+                               ACPI_LOCAL_APIC_ADDRESS,
+                               ACPI_MULTIPLE_APIC_FLAGS,
+               },
+               //
+               // LOCAL APIC Entries for 4 processors.
+               //
+               {
+                               {
+                                               ACPI_PROCESSOR_LOCAL_APIC,      
                    
+                                               sizeof 
(ACPI_LOCAL_APIC_STRUCTURE),     
+                                               0x00,                           
                          
+                                               0x00,                           
                          
+                                               0x00000001,                     
                          
+                               },
+
+                               {
+                                               ACPI_PROCESSOR_LOCAL_APIC,      
                    
+                                               sizeof 
(ACPI_LOCAL_APIC_STRUCTURE),     
+                                               0x01,                           
                          
+                                               0x00,                           
                          
+                                               0x00000000
+                               },                                              
 
+
+                               {
+                                               ACPI_PROCESSOR_LOCAL_APIC,      
                    
+                                               sizeof 
(ACPI_LOCAL_APIC_STRUCTURE),     
+                                               0x02,                           
                          
+                                               0x00,                           
                          
+                                               0x00000000
+                               },                                              
 
+
+                               {
+                                               ACPI_PROCESSOR_LOCAL_APIC,      
                    
+                                               sizeof 
(ACPI_LOCAL_APIC_STRUCTURE),     
+                                               0x03,                           
                          
+                                               0x00,                           
                          
+                                               0x00000000
+                               }
+               }
+               ,
+
+               //
+               // IO APIC
+               // 
+               {
+                               {
+                                               ACPI_IO_APIC,                   
      
+                                               sizeof 
(ACPI_IO_APIC_STRUCTURE),  
+                                               0x00,                           
          
+                                               0x00,                   
+                                               ACPI_IO_APIC_ADDRESS_1,
+                                               0x0000
+                               }
+               }
+};
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_madt.h
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_madt.h   Thu Jun 30 04:23:18 2005
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+#ifndef _MADT_H_
+#define _MADT_H_
+
+#include "acpi2_0.h"
+
+//
+// MADT Definitions, see ACPI 2.0 specification for details
+//
+
+#define ACPI_LOCAL_APIC_ADDRESS 0xFEE00000
+
+#define ACPI_MULTIPLE_APIC_FLAGS      (ACPI_PCAT_COMPAT)
+
+#define ACPI_IO_APIC_ADDRESS_1   0xFEC00000
+
+//
+// MADT structure
+//
+#pragma pack (1)
+typedef struct {
+  ACPI_2_0_MADT                                Header;
+  ACPI_LOCAL_APIC_STRUCTURE     LocalApic[4];
+  ACPI_IO_APIC_STRUCTURE        IoApic[1];
+} ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE;
+#pragma pack ()
+
+#endif
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/README
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/README        Thu Jun 30 04:23:18 2005
@@ -0,0 +1,24 @@
+ACPI Table for domain firmware
+
+
+INSTALL
+-----------------
+Simply make is OK.
+# make 
+
+
+Note on DSDT Table
+------------------
+DSDT table source code is acpi_dsdt.asl
+It is already compiled and the output is acpi_dsdt.c
+Usually, user is not expected to change the acpi_dsdt.asl.
+In case that the acpi_dsdt.asl need to be updated, please 
+Follow the instruction:
+
+# make acpi_dsdt.c
+
+Note:
+DSDT compiler "iasl" is needed. By default, it will be downloaded 
+using wget in Makefile. if it failed, please download manually from 
+http://developer.intel.com/technology/iapc/acpi/downloads.htm. 
+then compile and install iasl
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_dsdt.asl
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_dsdt.asl Thu Jun 30 04:23:18 2005
@@ -0,0 +1,312 @@
+//**********************************************************************//
+//*
+//* Copyright (c) 2004, Intel Corporation.
+//*
+//* This program is free software; you can redistribute it and/or modify it
+//* under the terms and conditions of the GNU General Public License,
+//* version 2, as published by the Free Software Foundation.
+//*
+//* This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 
Temple
+//* Place - Suite 330, Boston, MA 02111-1307 USA.
+
+//**
+//**           DSDT for Xen with Qemu device model
+//**
+//**
+
+DefinitionBlock ("DSDT.aml", "DSDT", 1, "INTEL ", "XEN     ", 2)
+{
+    Name (\PMBS, 0x0C00)
+    Name (\PMLN, 0x08)
+    Name (\IOB1, 0x00)
+    Name (\IOL1, 0x00)
+    Name (\APCB, 0xFEC00000)
+    Name (\APCL, 0x00010000)
+    Name (\PUID, 0x00)
+    Scope (\_PR)
+    {
+        Processor (CPU0, 0x00, 0x00000000, 0x00) {}
+        Processor (CPU1, 0x01, 0x00000000, 0x00) {}
+        Processor (CPU2, 0x02, 0x00000000, 0x00) {}
+        Processor (CPU3, 0x03, 0x00000000, 0x00) {}
+    }
+
+    Scope (\_SB)
+    {
+        Device (PCI0)
+        {
+            Name (_HID, EisaId ("PNP0A03"))
+            Name (_UID, 0x00)
+            Name (_ADR, 0x00)
+            Name (_BBN, 0x00)
+            Method (_CRS, 0, NotSerialized)
+            {
+                Name (PRT0, ResourceTemplate ()
+                {
+                                       /* bus number is from 0 - 255*/
+                    WordBusNumber (ResourceConsumer, MinFixed, MaxFixed, 
SubDecode,
+                        0x0000,
+                        0x0000,
+                        0x00FF,
+                        0x0000,
+                        0x0100)
+                    IO (Decode16, 0x0CF8, 0x0CF8, 0x01, 0x08)
+                    WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, 
EntireRange,
+                        0x0000,
+                        0x0000,
+                        0x0CF7,
+                        0x0000,
+                        0x0CF8)
+                    WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, 
EntireRange,
+                        0x0000,
+                        0x0D00,
+                        0x0FFF,
+                        0x0000,
+                        0x0300)
+                    DWordMemory (ResourceProducer, PosDecode, MinFixed, 
MaxFixed, Cacheable, ReadOnly,
+                        0x00000000,
+                        0x000A0000,
+                        0x000FFFFF,
+                        0x00000000,
+                        0x00060000)
+                })
+                Return (PRT0)
+            }
+
+            Name (AIR0, Package (0x06)
+            {
+               Package (0x04)
+                {
+                    0x001FFFFF, 
+                    0x02, 
+                    0x00, 
+                    0x17
+                }, 
+
+                Package (0x04)
+                {
+                    0x001FFFFF, 
+                    0x03, 
+                    0x00, 
+                    0x13
+                }, 
+
+                Package (0x04)
+                {
+                    0x001DFFFF, 
+                    0x01, 
+                    0x00, 
+                    0x13
+                }, 
+
+                Package (0x04)
+                {
+                    0x001DFFFF, 
+                    0x00, 
+                    0x00, 
+                    0x10
+                }, 
+
+                Package (0x04)
+                {
+                    0x001DFFFF, 
+                    0x02, 
+                    0x00, 
+                    0x12
+                }, 
+
+                Package (0x04)
+                {
+                    0x001DFFFF, 
+                    0x03, 
+                    0x00, 
+                    0x17
+                }
+            })
+            Method (_PRT, 0, NotSerialized)
+            {
+                Return (AIR0)
+            }
+
+            Device (ISA)
+            {
+                Name (_ADR, 0x00010000) /*TODO, device id, PCI bus num, ...*/
+
+                Device (SYSR)
+                {
+                    Name (_HID, EisaId ("PNP0C02"))
+                    Name (_UID, 0x01)
+                    Name (CRS, ResourceTemplate ()
+                    {
+                                               /* TODO: list hidden resources 
*/
+                        IO (Decode16, 0x0010, 0x0010, 0x00, 0x10)
+                        IO (Decode16, 0x0022, 0x0022, 0x00, 0x0C)
+                        IO (Decode16, 0x0030, 0x0030, 0x00, 0x10)
+                        IO (Decode16, 0x0044, 0x0044, 0x00, 0x1C)
+                        IO (Decode16, 0x0062, 0x0062, 0x00, 0x02)
+                        IO (Decode16, 0x0065, 0x0065, 0x00, 0x0B)
+                        IO (Decode16, 0x0072, 0x0072, 0x00, 0x0E)
+                        IO (Decode16, 0x0080, 0x0080, 0x00, 0x01)
+                        IO (Decode16, 0x0084, 0x0084, 0x00, 0x03)
+                        IO (Decode16, 0x0088, 0x0088, 0x00, 0x01)
+                        IO (Decode16, 0x008C, 0x008C, 0x00, 0x03)
+                        IO (Decode16, 0x0090, 0x0090, 0x00, 0x10)
+                        IO (Decode16, 0x00A2, 0x00A2, 0x00, 0x1C)
+                        IO (Decode16, 0x00E0, 0x00E0, 0x00, 0x10)
+                        IO (Decode16, 0x08A0, 0x08A0, 0x00, 0x04)
+                        IO (Decode16, 0x0CC0, 0x0CC0, 0x00, 0x10)
+                        IO (Decode16, 0x04D0, 0x04D0, 0x00, 0x02)
+                    })
+                    Method (_CRS, 0, NotSerialized)
+                    {
+                        Return (CRS)
+                    }
+                }
+
+                Device (PIC)
+                {
+                    Name (_HID, EisaId ("PNP0000"))
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x0020, 0x0020, 0x01, 0x02)
+                        IO (Decode16, 0x00A0, 0x00A0, 0x01, 0x02)
+                        IRQNoFlags () {2}
+                    })
+                }
+
+                Device (DMA0)
+                {
+                    Name (_HID, EisaId ("PNP0200"))
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        DMA (Compatibility, BusMaster, Transfer8) {4}
+                        IO (Decode16, 0x0000, 0x0000, 0x00, 0x10)
+                        IO (Decode16, 0x0081, 0x0081, 0x00, 0x03)
+                        IO (Decode16, 0x0087, 0x0087, 0x00, 0x01)
+                        IO (Decode16, 0x0089, 0x0089, 0x00, 0x03)
+                        IO (Decode16, 0x008F, 0x008F, 0x00, 0x01)
+                        IO (Decode16, 0x00C0, 0x00C0, 0x00, 0x20)
+                                               IO (Decode16, 0x0480, 0x0480, 
0x00, 0x10)
+                    })
+                }
+
+                Device (TMR)
+                {
+                    Name (_HID, EisaId ("PNP0100"))
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x0040, 0x0040, 0x00, 0x04)
+                        IRQNoFlags () {0}
+                    })
+                }
+
+                Device (RTC)
+                {
+                    Name (_HID, EisaId ("PNP0B00"))
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x0070, 0x0070, 0x00, 0x02)
+                        IRQNoFlags () {8}
+                    })
+                }
+
+                Device (SPKR)
+                {
+                    Name (_HID, EisaId ("PNP0800"))
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x0061, 0x0061, 0x00, 0x01)
+                    })
+                }
+
+                Device (PS2M)
+                {
+                    Name (_HID, EisaId ("PNP0F13"))
+                    Name (_CID, 0x130FD041)
+                    Method (_STA, 0, NotSerialized)
+                    {
+                        Return (0x0F)
+                    }
+
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IRQNoFlags () {12}
+                    })
+                }
+
+                Device (PS2K)
+                {
+                    Name (_HID, EisaId ("PNP0303"))
+                    Name (_CID, 0x0B03D041)
+                    Method (_STA, 0, NotSerialized)
+                    {
+                        Return (0x0F)
+                    }
+
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x0060, 0x0060, 0x00, 0x01)
+                        IO (Decode16, 0x0064, 0x0064, 0x00, 0x01)
+                        IRQNoFlags () {1}
+                    })
+                }
+
+                Device (FDC0)
+                {
+                    Name (_HID, EisaId ("PNP0700"))
+                    Method (_STA, 0, NotSerialized)
+                    {
+                          Return (0x0F)
+                    }
+
+                    Name (_CRS, ResourceTemplate ()
+                    {
+                        IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
+                        IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
+                        IRQNoFlags () {6}
+                        DMA (Compatibility, NotBusMaster, Transfer8) {2}
+                    })
+                }
+
+                Device (UAR1)
+                {
+                    Name (_HID, EisaId ("PNP0501"))
+                    Name (_UID, 0x01)
+                    Method (_STA, 0, NotSerialized)
+                    {
+                        Return (0x0F)
+                    }
+
+                    Name (_CRS, ResourceTemplate()
+                    {
+                        IO (Decode16, 0x03F8, 0x03F8, 0x01, 0x08)
+                        IRQNoFlags () {4}
+                    })
+                }
+
+                Device (UAR2)
+                {
+                    Name (_HID, EisaId ("PNP0501"))
+                    Name (_UID, 0x02)
+                    Method (_STA, 0, NotSerialized)
+                    {
+                        Return (0x0F)
+                    }
+
+                    Name (_CRS, ResourceTemplate()
+                    {
+                        IO (Decode16, 0x02F8, 0x02F8, 0x01, 0x08)
+                        IRQNoFlags () {3}
+                    })
+                } 
+            }
+        }
+    }
+}
+
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi2_0.h
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi2_0.h     Thu Jun 30 04:23:18 2005
@@ -0,0 +1,317 @@
+/*
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+#ifndef _ACPI_2_0_H_
+#define _ACPI_2_0_H_
+
+#include "xc.h"  // for u8, u16, u32, u64 definition
+
+#pragma pack (1)
+
+//
+// common ACPI header.  
+//
+
+typedef struct {
+               u32                     Signature;
+               u32             Length;
+               u8                      Revision;
+               u8                      Checksum;
+               u8                      OemId[6];
+               u64                     OemTableId;
+               u32                     OemRevision;
+               u32                     CreatorId;
+               u32                     CreatorRevision;
+} ACPI_TABLE_HEADER;
+
+
+#define ACPI_OEM_ID                    {'I','N','T','E','L',' '}
+#define ACPI_OEM_TABLE_ID              0x544244                // "TBD"
+#define ACPI_OEM_REVISION              0x00000002
+#define ACPI_CREATOR_ID                0x00                    // TBD 
+#define ACPI_CREATOR_REVISION  0x00000002              
+
+//
+// ACPI 2.0 Generic Address Space definition
+//
+typedef struct {
+               u8                            AddressSpaceId;
+               u8                            RegisterBitWidth;
+               u8                            RegisterBitOffset;
+               u8                            Reserved;
+               u64                           Address;
+} ACPI_GENERIC_ADDRESS_STRUCTURE;
+
+//
+// Generic Address Space Address IDs
+//
+#define ACPI_SYSTEM_MEMORY 0
+#define ACPI_SYSTEM_IO 1
+#define ACPI_PCI_CONFIGURATION_SPACE 2
+#define ACPI_EMBEDDED_CONTROLLER 3
+#define ACPI_SMBUS 4
+#define ACPI_FUNCTIONAL_FIXED_HARDWARE 0x7F
+
+//
+// Root System Description Pointer Structure in ACPI 1.0
+//
+typedef struct {
+               u64                           Signature;
+               u8                            Checksum;
+               u8                            OemId[6];
+               u8                            Reserved;
+               u32                           RsdtAddress;
+} ACPI_1_0_RSDP;
+
+
+//
+// Root System Description Pointer Structure
+//
+typedef struct {
+               u64                           Signature;
+               u8                            Checksum;
+               u8                            OemId[6];
+               u8                            Revision;
+               u32                           RsdtAddress;
+               u32                           Length;
+               u64                           XsdtAddress;
+               u8                            ExtendedChecksum;
+               u8                            Reserved[3];
+} ACPI_2_0_RSDP;
+
+
+//
+// The maximum number of entrys in RSDT or XSDT
+//
+#define ACPI_MAX_NUM_TABLES 2
+
+//
+// Root System Description Table (RSDT)
+//
+
+typedef struct {
+               ACPI_TABLE_HEADER Header;
+               u32 Entry[ACPI_MAX_NUM_TABLES];
+}ACPI_2_0_RSDT;
+
+//
+// RSDT Revision (as defined in ACPI 2.0 spec.)
+//
+
+#define ACPI_2_0_RSDT_REVISION 0x01
+
+//
+// Extended System Description Table (XSDT)
+//
+
+typedef struct _ACPI_2_0_XSDT{
+               ACPI_TABLE_HEADER Header;
+               u64 Entry[ACPI_MAX_NUM_TABLES];
+}ACPI_2_0_XSDT;
+#define ACPI_2_0_XSDT_REVISION 0x01
+
+//
+// Fixed ACPI Description Table Structure (FADT)
+// 
+
+typedef struct  {
+               ACPI_TABLE_HEADER               Header;
+               u32                                    FirmwareCtrl;
+               u32                                    Dsdt;
+               u8                                     Reserved0;
+               u8                                     PreferredPmProfile;
+               u16                                    SciInt;
+               u32                                    SmiCmd;
+               u8                                     AcpiEnable;
+               u8                                     AcpiDisable;
+               u8                                     S4BiosReq;
+               u8                                     PstateCnt;
+               u32                                    Pm1aEvtBlk;
+               u32                                    Pm1bEvtBlk;
+               u32                                    Pm1aCntBlk;
+               u32                                    Pm1bCntBlk;
+               u32                                    Pm2CntBlk;
+               u32                                    PmTmrBlk;
+               u32                                    Gpe0Blk;
+               u32                                    Gpe1Blk;
+               u8                                     Pm1EvtLen;
+               u8                                     Pm1CntLen;
+               u8                                     Pm2CntLen;
+               u8                                     PmTmrLen;
+               u8                                     Gpe0BlkLen;
+               u8                                     Gpe1BlkLen;
+               u8                                     Gpe1Base;
+               u8                                     CstCnt;
+               u16                                    PLvl2Lat;
+               u16                                    PLvl3Lat;
+               u16                                    FlushSize;
+               u16                                    FlushStride;
+               u8                                     DutyOffset;
+               u8                                     DutyWidth;
+               u8                                     DayAlrm;
+               u8                                     MonAlrm;
+               u8                                     Century;
+               u16                                    IaPcBootArch;
+               u8                                     Reserved1;
+               u32                                    Flags;
+               ACPI_GENERIC_ADDRESS_STRUCTURE    ResetReg;
+               u8                                     ResetValue;
+               u8                                     Reserved2[3];
+               u64                                    XFirmwareCtrl;
+               u64                                    XDsdt;
+               ACPI_GENERIC_ADDRESS_STRUCTURE    XPm1aEvtBlk;
+               ACPI_GENERIC_ADDRESS_STRUCTURE    XPm1bEvtBlk;
+               ACPI_GENERIC_ADDRESS_STRUCTURE    XPm1aCntBlk;
+               ACPI_GENERIC_ADDRESS_STRUCTURE    XPm1bCntBlk;
+               ACPI_GENERIC_ADDRESS_STRUCTURE    XPm2CntBlk;
+               ACPI_GENERIC_ADDRESS_STRUCTURE    XPmTmrBlk;
+               ACPI_GENERIC_ADDRESS_STRUCTURE    XGpe0Blk;
+               ACPI_GENERIC_ADDRESS_STRUCTURE    XGpe1Blk;
+} ACPI_2_0_FADT;
+#define ACPI_2_0_FADT_REVISION 0x03
+
+//
+// FADT Boot Architecture Flags
+//
+#define ACPI_LEGACY_DEVICES (1 << 0)
+#define ACPI_8042           (1 << 1)
+
+//
+// FADT Fixed Feature Flags
+//
+#define ACPI_WBINVD         (1 << 0)
+#define ACPI_WBINVD_FLUSH   (1 << 1)
+#define ACPI_PROC_C1        (1 << 2)
+#define ACPI_P_LVL2_UP      (1 << 3)
+#define ACPI_PWR_BUTTON     (1 << 4)
+#define ACPI_SLP_BUTTON     (1 << 5)
+#define ACPI_FIX_RTC        (1 << 6)
+#define ACPI_RTC_S4         (1 << 7)
+#define ACPI_TMR_VAL_EXT    (1 << 8)
+#define ACPI_DCK_CAP        (1 << 9)
+#define ACPI_RESET_REG_SUP  (1 << 10)
+#define ACPI_SEALED_CASE    (1 << 11)
+#define ACPI_HEADLESS       (1 << 12)
+#define ACPI_CPU_SW_SLP     (1 << 13)
+
+//
+// Firmware ACPI Control Structure (FACS)
+//
+typedef struct {
+               u32                               Signature;
+               u32                               Length;
+               u32                               HardwareSignature;
+               u32                               FirmwareWakingVector;
+               u32                               GlobalLock;
+               u32                               Flags;
+               u64                               XFirmwareWakingVector;
+               u8                                Version;
+               u8                                Reserved[31];
+} ACPI_2_0_FACS;
+
+#define ACPI_2_0_FACS_VERSION 0x01
+
+//
+// Multiple APIC Description Table header definition (MADT)
+//
+typedef struct {
+               ACPI_TABLE_HEADER                       Header;
+               u32                                     LocalApicAddress;
+               u32                                     Flags;
+} ACPI_2_0_MADT;
+
+#define ACPI_2_0_MADT_REVISION 0x01
+
+//
+// Multiple APIC Flags
+//
+#define ACPI_PCAT_COMPAT (1 << 0)
+
+//
+// Multiple APIC Description Table APIC structure types
+//
+#define ACPI_PROCESSOR_LOCAL_APIC           0x00
+#define ACPI_IO_APIC                        0x01
+#define ACPI_INTERRUPT_SOURCE_OVERRIDE      0x02
+#define ACPI_NON_MASKABLE_INTERRUPT_SOURCE  0x03
+#define ACPI_LOCAL_APIC_NMI                 0x04
+#define ACPI_LOCAL_APIC_ADDRESS_OVERRIDE    0x05
+#define ACPI_IO_SAPIC                       0x06
+#define ACPI_PROCESSOR_LOCAL_SAPIC          0x07
+#define ACPI_PLATFORM_INTERRUPT_SOURCES     0x08
+
+//
+// APIC Structure Definitions
+//
+
+//
+// Processor Local APIC Structure Definition
+//
+
+typedef struct {
+               u8                                             Type;
+               u8                                             Length;
+               u8                                             AcpiProcessorId;
+               u8                                             ApicId;
+               u32                                            Flags;
+} ACPI_LOCAL_APIC_STRUCTURE;
+
+//
+// Local APIC Flags.  All other bits are reserved and must be 0.
+//
+
+#define ACPI_LOCAL_APIC_ENABLED (1 << 0)
+
+//
+// IO APIC Structure
+//
+
+typedef struct {
+               u8                                             Type;
+               u8                                             Length;
+               u8                                             IoApicId;
+               u8                                             Reserved;
+               u32                                            IoApicAddress;
+               u32                                            
GlobalSystemInterruptBase;
+} ACPI_IO_APIC_STRUCTURE;
+
+// Tabel Signature
+#define ACPI_2_0_RSDP_SIGNATURE 0x2052545020445352LL  // "RSD PTR "
+
+#define ACPI_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE 0x54445344  
//"DSDT"
+
+#define ACPI_2_0_FACS_SIGNATURE 0x53434146 // "FACS"
+
+#define ACPI_2_0_FADT_SIGNATURE 0x50434146 // "FADT"
+
+#define ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE 0x43495041  // "APIC"
+
+#define ACPI_2_0_RSDT_SIGNATURE 0x54445352  // "RSDT"
+
+#define ACPI_2_0_XSDT_SIGNATURE 0x54445358  // "XSDT"
+
+#pragma pack ()
+
+// The physical that acpi table reside in the guest BIOS
+//#define ACPI_PHYSICAL_ADDRESS 0xE2000
+#define ACPI_PHYSICAL_ADDRESS 0xEA000
+#define ACPI_TABLE_SIZE (2*1024)  //Currently 2K is enough
+
+void
+AcpiBuildTable(u8* buf);
+
+#endif
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_facs.c
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_facs.c   Thu Jun 30 04:23:18 2005
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+#include "acpi2_0.h"
+#include "acpi_facs.h"
+
+//
+// Firmware ACPI Control Structure
+//
+
+ACPI_2_0_FACS Facs = {
+               ACPI_2_0_FACS_SIGNATURE,
+               sizeof (ACPI_2_0_FACS),
+
+               //
+               // Hardware Signature
+               //
+               0x00000000,
+
+               ACPI_FIRMWARE_WAKING_VECTOR,
+               ACPI_GLOBAL_LOCK,
+               ACPI_FIRMWARE_CONTROL_STRUCTURE_FLAGS,
+               ACPI_X_FIRMWARE_WAKING_VECTOR,
+               ACPI_2_0_FACS_VERSION,
+               {
+                               0x00,  // Reserved Fields
+                               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,
+               }
+};
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_facs.h
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_facs.h   Thu Jun 30 04:23:18 2005
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+#ifndef _FACS_H
+#define _FACS_H
+
+//
+// FACS Definitions
+//
+
+#define ACPI_FIRMWARE_WAKING_VECTOR 0x00000000
+#define ACPI_GLOBAL_LOCK 0x00000000
+
+#define ACPI_FIRMWARE_CONTROL_STRUCTURE_FLAGS 0x00000000
+
+#define ACPI_X_FIRMWARE_WAKING_VECTOR 0x0000000000000000
+
+#endif
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_dsdt.c
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_dsdt.c   Thu Jun 30 04:23:18 2005
@@ -0,0 +1,161 @@
+/*
+ * 
+ * Intel ACPI Component Architecture
+ * ASL Optimizing Compiler / AML Disassembler version 20050513 [Jun  8 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
+ * 
+ * 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 " */
+    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,
+};
+int DsdtLen=sizeof(AmlCode);
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/Makefile
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/Makefile      Thu Jun 30 04:23:18 2005
@@ -0,0 +1,68 @@
+#/*
+# * Copyright (c) 2004, Intel Corporation.
+# *
+# * This program is free software; you can redistribute it and/or modify it
+# * under the terms and conditions of the GNU General Public License,
+# * version 2, as published by the Free Software Foundation.
+# *
+# * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 
Temple
+# * Place - Suite 330, Boston, MA 02111-1307 USA.
+# *
+# */
+#
+# Compiler flag
+CFLAG=-I. -I../../libxc
+       
+# Compiler tool        
+CC=gcc
+
+# TARGET
+C_SRC=$(shell ls *.c)
+H_SRC=$(shell ls *.h)
+ACPI_GEN=acpigen
+ACPI_BIN=acpi.bin
+
+IASL_VER=acpica-unix-20050513
+IASL_URL=http://developer.intel.com/technology/iapc/acpi/downloads/$(IASL_VER).tar.gz
+
+vpath iasl $(PATH)
+all:$(ACPI_BIN)
+       
+acpi_dsdt.c:acpi_dsdt.asl
+       $(MAKE) iasl
+       iasl -oa -tc acpi_dsdt.asl
+       mv acpi_dsdt.hex acpi_dsdt.c
+       echo "int DsdtLen=sizeof(AmlCode);" >> acpi_dsdt.c
+       rm *.aml
+
+iasl:
+       @echo
+       @echo "ACPI ASL compiler(iasl) is needed"
+       @echo "Download Intel ACPI CA"
+       @echo "If wget failed, please download and compile manually from"
+       @echo "http://developer.intel.com/technology/iapc/acpi/downloads.htm";
+       @echo 
+       wget $(IASL_URL)
+       tar xzf $(IASL_VER).tar.gz
+       make -C $(IASL_VER)/compiler
+       install $(IASL_VER)/compiler/iasl /usr/bin/iasl
+
+$(ACPI_GEN):$(C_SRC) $(H_SRC) acpi_dsdt.c
+       $(CC) -o $(ACPI_GEN) $(CFLAG) $(shell ls *.c)
+
+$(ACPI_BIN):$(ACPI_GEN)
+       ./$(ACPI_GEN) $(ACPI_BIN)
+       
+clean:
+       rm -rf *.o $(ACPI_GEN) $(ACPI_BIN) $(IASL_VER) 
+#   rm -f acpi_dsdt.c
+       rm -rf  $(IASL_VER).tar.gz
+install:all
+               
+       
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_rsdt.c
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_rsdt.c   Thu Jun 30 04:23:18 2005
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+#include "acpi2_0.h"
+
+ACPI_2_0_RSDT Rsdt={   
+               {
+                               ACPI_2_0_RSDT_SIGNATURE,
+                               sizeof (ACPI_TABLE_HEADER), // udpated later
+                               ACPI_2_0_RSDT_REVISION,
+                               0x0,                              //Checksum, 
updated later
+                               ACPI_OEM_ID, 
+                               ACPI_OEM_TABLE_ID,
+                               ACPI_OEM_REVISION,
+                               ACPI_CREATOR_ID,
+                               ACPI_CREATOR_REVISION,
+               },
+               {0x0, 0x0}
+};
+
+ACPI_2_0_XSDT Xsdt={
+               {
+                               ACPI_2_0_XSDT_SIGNATURE,
+                               sizeof (ACPI_TABLE_HEADER),  //update later
+                               ACPI_2_0_XSDT_REVISION,
+                               0x0,                              //Checksum, 
update later
+                               ACPI_OEM_ID, 
+                               ACPI_OEM_TABLE_ID,
+                               ACPI_OEM_REVISION,
+                               ACPI_CREATOR_ID,
+                               ACPI_CREATOR_REVISION,
+               },
+               {0x0, 0x0},
+};
+
+
+ACPI_2_0_RSDP Rsdp={
+               ACPI_2_0_RSDP_SIGNATURE,
+               0x00, // Checksum, updated in later
+               ACPI_OEM_ID,  // OEM ID,
+               ACPI_OEM_REVISION, 
+               0x0, // RSDT address, updated later
+               sizeof (ACPI_2_0_RSDP),
+               0x0, // XSDT address, updated later
+               0x0, // Extended Checksum, update later
+               {
+                               0x0, // Reserved
+                               0x0, // Reserved
+                               0x0, // Reserved
+               }
+};
+
+
+
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_build.c
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_build.c  Thu Jun 30 04:23:18 2005
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+
+#include "acpi2_0.h"
+#include "acpi_madt.h"
+
+extern ACPI_2_0_RSDP Rsdp;
+extern ACPI_2_0_RSDT Rsdt;
+extern ACPI_2_0_XSDT Xsdt;
+extern ACPI_2_0_FADT Fadt;
+extern ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE Madt;
+extern ACPI_2_0_FACS Facs;
+extern unsigned char *AmlCode;
+extern int DsdtLen;
+
+
+typedef struct _ACPI_TABLE_ALL{
+               ACPI_2_0_RSDP *Rsdp;
+               ACPI_2_0_RSDT *Rsdt;
+               ACPI_2_0_XSDT *Xsdt;
+               ACPI_2_0_FADT *Fadt;
+               ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE *Madt;
+               ACPI_2_0_FACS *Facs;
+               unsigned char* Dsdt;
+               u32 RsdpOffset;
+               u32 RsdtOffset;
+               u32 XsdtOffset;
+               u32 FadtOffset;
+               u32 MadtOffset;
+               u32 FacsOffset;
+               u32 DsdtOffset;
+}ACPI_TABLE_ALL;
+
+static 
+void
+MemCopy(void* src, void* dst, int len){
+
+       u8* src0=src;
+       u8* dst0=dst;   
+
+       while(len--){
+               *(dst0++)=*(src0++);
+       }
+}
+
+static
+void
+SetCheckSum(
+  void*  Table, 
+  u32 ChecksumOffset,
+  u32 Length
+)
+/*
+ * Routine Description:
+ *      Calculate Checksum and store the result in the checksum 
+ *     filed of the table      
+ *
+ * INPUT:
+ *     Table:          Start pointer of table
+ *     ChecksumOffset: Offset of checksum field in the table
+ *     Length:         Length of Table
+ */
+{
+       u8 Sum = 0;  
+       u8 *Ptr;
+
+       Ptr=Table;
+       Ptr[ChecksumOffset]=0;
+       while (Length--) {    
+               Sum = (u8)(Sum + (*Ptr++));
+       }
+       
+       Ptr = Table;
+       Ptr[ChecksumOffset] = (u8) (0xff - Sum + 1);
+}
+
+//
+//  FIELD_OFFSET - returns the byte offset to a field within a structure
+//
+#define FIELD_OFFSET(TYPE,Field) ((u32)(&(((TYPE *) 0)->Field)))
+
+static
+void
+UpdateTable(
+       ACPI_TABLE_ALL *table
+)
+/*
+ * Update the ACPI table:
+ *             fill in the actuall physical address of RSDT, XSDT, FADT, MADT, 
FACS
+ *             Caculate the checksum
+ */
+{    
+       // RSDP Update  
+       table->Rsdp->RsdtAddress = (u32)(ACPI_PHYSICAL_ADDRESS+
+                                       table->RsdtOffset);
+       table->Rsdp->XsdtAddress = (u64)(ACPI_PHYSICAL_ADDRESS+
+                                       table->XsdtOffset);
+       SetCheckSum(table->Rsdp,
+                                       FIELD_OFFSET(ACPI_1_0_RSDP, Checksum),
+                                       sizeof(ACPI_1_0_RSDP)
+                          );
+       SetCheckSum(table->Rsdp,
+                                       FIELD_OFFSET(ACPI_2_0_RSDP,
+                                                       ExtendedChecksum),
+                                       sizeof(ACPI_2_0_RSDP)
+                          );
+
+       
+       //RSDT Update
+       table->Rsdt->Entry[0] = (u32)(ACPI_PHYSICAL_ADDRESS + 
+                                       table->FadtOffset);     
+       table->Rsdt->Entry[1] = (u32)(ACPI_PHYSICAL_ADDRESS + 
+                                       table->MadtOffset);
+       table->Rsdt->Header.Length = sizeof (ACPI_TABLE_HEADER) +
+                                       2*sizeof(u32);
+       SetCheckSum(table->Rsdt,
+                                       FIELD_OFFSET(ACPI_TABLE_HEADER, 
Checksum),
+                                       table->Rsdt->Header.Length
+                          );   
+       
+       //XSDT  Update
+       table->Xsdt->Entry[0] = (u64)(ACPI_PHYSICAL_ADDRESS +
+                                       table->FadtOffset);
+       table->Xsdt->Entry[1] = (u64)(ACPI_PHYSICAL_ADDRESS + 
+                                       table->MadtOffset);     
+       table->Xsdt->Header.Length = sizeof (ACPI_TABLE_HEADER) + 
+                                       2*sizeof(u64);
+       SetCheckSum(table->Xsdt,
+                                       FIELD_OFFSET(ACPI_TABLE_HEADER, 
Checksum),
+                                       table->Xsdt->Header.Length
+                          );
+
+       // FADT Update
+       table->Fadt->Dsdt = (u32)(ACPI_PHYSICAL_ADDRESS + 
+                                       table->DsdtOffset);     
+       table->Fadt->XDsdt = (u64)(ACPI_PHYSICAL_ADDRESS + 
+                                  table->DsdtOffset);
+       table->Fadt->FirmwareCtrl = (u32)(ACPI_PHYSICAL_ADDRESS +
+                                       table->FacsOffset);
+       table->Fadt->XFirmwareCtrl = (u64)(ACPI_PHYSICAL_ADDRESS + 
+                                       table->FacsOffset);     
+       SetCheckSum(table->Fadt,
+                                       FIELD_OFFSET(ACPI_TABLE_HEADER, 
Checksum),
+                                       sizeof(ACPI_2_0_FADT)
+                          );
+       
+       // MADT update
+       SetCheckSum(table->Madt,
+                                       FIELD_OFFSET(ACPI_TABLE_HEADER, 
Checksum),
+                                       
sizeof(ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE)
+                          );
+}
+
+void
+AcpiBuildTable(u8* buf)
+/*
+ * Copy all the ACPI table to buffer
+ * Buffer Layout:
+ *             FACS
+ *             RSDP
+ *             RSDT
+ *             XSDT
+ *             FADT
+ *             MADT
+ *             DSDT            
+ *
+ */            
+{
+       ACPI_TABLE_ALL table;
+       int offset=0;
+
+       // FACS: should be 64-bit alignment     
+       // so it is put at the start of buffer
+       // as the buffer is 64 bit alignment
+       table.FacsOffset = offset;
+       table.Facs = (ACPI_2_0_FACS*)(&buf[offset]);
+       MemCopy(&Facs, table.Facs, sizeof(ACPI_2_0_FACS));
+       offset += sizeof(ACPI_2_0_FACS);
+
+       // RSDP
+       table.RsdpOffset = offset;
+       table.Rsdp = (ACPI_2_0_RSDP*)(&buf[offset]);
+       MemCopy(&Rsdp, table.Rsdp, sizeof(ACPI_2_0_RSDP));
+       offset+=sizeof(ACPI_2_0_RSDP);
+
+       // RSDT
+       table.RsdtOffset = offset;
+       table.Rsdt = (ACPI_2_0_RSDT*)(&buf[offset]);
+       MemCopy(&Rsdt, table.Rsdt, sizeof(ACPI_2_0_RSDT));
+       offset+=sizeof(ACPI_2_0_RSDT);
+       
+       // XSDT
+       table.XsdtOffset = offset;
+       table.Xsdt = (ACPI_2_0_XSDT*)(&buf[offset]);
+       MemCopy(&Xsdt, table.Xsdt, sizeof(ACPI_2_0_XSDT));
+       offset+=sizeof(ACPI_2_0_XSDT);
+       
+       // FADT
+       table.FadtOffset = offset;
+       table.Fadt = (ACPI_2_0_FADT*)(&buf[offset]);
+       MemCopy(&Fadt, table.Fadt, sizeof(ACPI_2_0_FADT));
+       offset+=sizeof(ACPI_2_0_FADT);
+       
+       // MADT
+       table.MadtOffset = offset;
+       table.Madt = (ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE*)(&buf[offset]);
+       MemCopy(&Madt, table.Madt, 
sizeof(ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE));
+       offset+=sizeof(ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE);
+
+       // DSDT
+       table.DsdtOffset = offset;
+       table.Dsdt = (unsigned char*)(&buf[offset]);
+       MemCopy(&AmlCode, table.Dsdt, DsdtLen);
+       offset+=DsdtLen; 
+       
+       UpdateTable(&table);
+}
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_fadt.c
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_fadt.c   Thu Jun 30 04:23:18 2005
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+
+#include "acpi2_0.h"
+#include "acpi_fadt.h"
+
+//
+// Fixed ACPI Description Table
+//
+
+ACPI_2_0_FADT Fadt = {
+               {
+                               ACPI_2_0_FADT_SIGNATURE,
+                               sizeof (ACPI_2_0_FADT),
+                               ACPI_2_0_FADT_REVISION,
+                               0x00,// Checksum will be updated later
+                               ACPI_OEM_ID,  // OEM ID
+                               ACPI_OEM_TABLE_ID,  // OEM Table ID
+                               ACPI_OEM_REVISION, // OEM Revision
+                               ACPI_CREATOR_ID,  // Creator ID
+                               ACPI_CREATOR_REVISION,  // Creator Revision 
+               },
+               //
+               // These addresses will be updated later
+               //
+               0x00000000,   // Physical Address (0~4G) of the FACS
+               0x00000000,   // Physical Address (0~4G) of the DSDT
+
+               0x00,  
+               ACPI_PREFERRED_PM_PROFILE,  // Enterprise 
+               ACPI_SCI_INT,               // IRQ 9
+               ACPI_SMI_CMD,               
+               ACPI_ACPI_ENABLE,
+               ACPI_ACPI_DISABLE,
+               ACPI_S4_BIOS_REQ,  // zero. not supported
+               ACPI_PSTATE_CNT,   // not supported
+
+               ACPI_PM1A_EVT_BLK_ADDRESS,  // required
+               ACPI_PM1B_EVT_BLK_ADDRESS,  // not supported 
+               ACPI_PM1A_CNT_BLK_ADDRESS,  // required
+               ACPI_PM1B_CNT_BLK_ADDRESS,  // not supported 
+               ACPI_PM2_CNT_BLK_ADDRESS,   // not supported 
+               ACPI_PM_TMR_BLK_ADDRESS,    // required
+               ACPI_GPE0_BLK_ADDRESS,      // not supported
+               ACPI_GPE1_BLK_ADDRESS,      // not supported 
+               ACPI_PM1_EVT_LEN,           
+               ACPI_PM1_CNT_LEN,
+               ACPI_PM2_CNT_LEN,
+               ACPI_PM_TMR_LEN,
+               ACPI_GPE0_BLK_LEN,
+               ACPI_GPE1_BLK_LEN,
+               ACPI_GPE1_BASE,
+
+               ACPI_CST_CNT,
+               ACPI_P_LVL2_LAT,             // >100, not support C2 state
+               ACPI_P_LVL3_LAT,             // >1000, not support C3 state
+               ACPI_FLUSH_SIZE,             // not support
+               ACPI_FLUSH_STRIDE,           // not support
+               ACPI_DUTY_OFFSET,            // not support 
+               ACPI_DUTY_WIDTH,             // not support
+               ACPI_DAY_ALRM,               // not support
+               ACPI_MON_ALRM,               // not support
+               ACPI_CENTURY,                // not support
+               ACPI_IAPC_BOOT_ARCH,         
+               0x00,          
+               ACPI_FIXED_FEATURE_FLAGS,
+
+               //
+               // Reset Register Block
+               //
+               {               ACPI_RESET_REG_ADDRESS_SPACE_ID,
+                               ACPI_RESET_REG_BIT_WIDTH,
+                               ACPI_RESET_REG_BIT_OFFSET,
+                               0x00,
+                               ACPI_RESET_REG_ADDRESS,
+               },
+
+               ACPI_RESET_VALUE,
+               {
+                               0x00,
+                               0x00,
+                               0x00,
+               },
+               //
+               // These addresses will be updated later
+               //
+               0x0000000000000000,   // X_FIRMWARE_CTRL: 64bit physical 
address of the FACS.
+               0x0000000000000000,   // X_DSDT: 64bit physical address of the 
DSDT.
+
+               //
+               // PM1a Event Register Block
+               //
+               {
+                               ACPI_PM1A_EVT_BLK_ADDRESS_SPACE_ID,
+                               ACPI_PM1A_EVT_BLK_BIT_WIDTH,
+                               ACPI_PM1A_EVT_BLK_BIT_OFFSET,
+                               0x00,
+                               ACPI_PM1A_EVT_BLK_ADDRESS,
+               },
+
+               //
+               // PM1b Event Register Block
+               //
+               {
+                               ACPI_PM1B_EVT_BLK_ADDRESS_SPACE_ID,  // not 
support
+                               ACPI_PM1B_EVT_BLK_BIT_WIDTH,
+                               ACPI_PM1B_EVT_BLK_BIT_OFFSET,
+                               0x00,
+                               ACPI_PM1B_EVT_BLK_ADDRESS,
+               },
+
+               //
+               // PM1a Control Register Block
+               //
+               {
+                               ACPI_PM1A_CNT_BLK_ADDRESS_SPACE_ID,
+                               ACPI_PM1A_CNT_BLK_BIT_WIDTH,
+                               ACPI_PM1A_CNT_BLK_BIT_OFFSET,
+                               0x00,
+                               ACPI_PM1A_CNT_BLK_ADDRESS,
+               },
+
+               //
+               // PM1b Control Register Block
+               //
+               {
+                               ACPI_PM1B_CNT_BLK_ADDRESS_SPACE_ID,
+                               ACPI_PM1B_CNT_BLK_BIT_WIDTH,
+                               ACPI_PM1B_CNT_BLK_BIT_OFFSET,
+                               0x00,
+                               ACPI_PM1B_CNT_BLK_ADDRESS,
+               },
+
+               //
+               // PM2 Control Register Block
+               //
+               {
+                               ACPI_PM2_CNT_BLK_ADDRESS_SPACE_ID,
+                               ACPI_PM2_CNT_BLK_BIT_WIDTH,
+                               ACPI_PM2_CNT_BLK_BIT_OFFSET,
+                               0x00,
+                               ACPI_PM2_CNT_BLK_ADDRESS,
+               },
+
+               //
+               // PM Timer Control Register Block
+               //
+               {
+                               ACPI_PM_TMR_BLK_ADDRESS_SPACE_ID,
+                               ACPI_PM_TMR_BLK_BIT_WIDTH,
+                               ACPI_PM_TMR_BLK_BIT_OFFSET,
+                               0x00,
+                               ACPI_PM_TMR_BLK_ADDRESS,
+               },
+
+               //
+               // General Purpose Event 0 Register Block
+               //
+               {
+                               ACPI_GPE0_BLK_ADDRESS_SPACE_ID,
+                               ACPI_GPE0_BLK_BIT_WIDTH,
+                               ACPI_GPE0_BLK_BIT_OFFSET,
+                               0x00,
+                               ACPI_GPE0_BLK_ADDRESS,
+               },
+
+               //
+               // General Purpose Event 1 Register Block
+               //
+               {
+                               ACPI_GPE1_BLK_ADDRESS_SPACE_ID,
+                               ACPI_GPE1_BLK_BIT_WIDTH,
+                               ACPI_GPE1_BLK_BIT_OFFSET,
+                               0x00,
+                               ACPI_GPE1_BLK_ADDRESS
+               }
+               
+};
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_fadt.h
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_fadt.h   Thu Jun 30 04:23:18 2005
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+#ifndef _FADT_H_
+#define _FADT_H_
+
+//
+// FADT Definitions, see ACPI 2.0 specification for details.
+//
+
+#define ACPI_OEM_FADT_REVISION  0x00000000 // TBD
+
+#define ACPI_PREFERRED_PM_PROFILE 0x04
+#define ACPI_SCI_INT              0x0009
+#define ACPI_SMI_CMD              0x000000B2
+#define ACPI_ACPI_ENABLE    0x00
+#define ACPI_ACPI_DISABLE   0x00
+#define ACPI_S4_BIOS_REQ    0x00
+#define ACPI_PSTATE_CNT     0x00
+#define ACPI_GPE1_BASE      0x20
+#define ACPI_CST_CNT        0x00
+#define ACPI_P_LVL2_LAT     0x0065
+#define ACPI_P_LVL3_LAT     0X03E9
+#define ACPI_FLUSH_SIZE     0x00
+#define ACPI_FLUSH_STRIDE   0x00
+#define ACPI_DUTY_OFFSET    0x01
+#define ACPI_DUTY_WIDTH     0x00
+#define ACPI_DAY_ALRM       0x00
+#define ACPI_MON_ALRM       0x00
+#define ACPI_CENTURY        0x00
+
+//
+// IA-PC Boot Architecture Flags, see ACPI 2.0 table specification and 
Acpi2_0.h
+//
+#define ACPI_IAPC_BOOT_ARCH (ACPI_LEGACY_DEVICES | ACPI_8042)
+
+//
+// Fixed Feature Flags
+// 
+#define ACPI_FIXED_FEATURE_FLAGS (ACPI_SLP_BUTTON| ACPI_WBINVD  )
+
+//
+// PM1A Event Register Block Generic Address Information
+//
+#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
+
+//
+// PM1B Event Register Block Generic Address Information
+//
+#define ACPI_PM1B_EVT_BLK_ADDRESS_SPACE_ID  ACPI_SYSTEM_IO
+#define ACPI_PM1B_EVT_BLK_BIT_WIDTH         0x00
+#define ACPI_PM1B_EVT_BLK_BIT_OFFSET        0x00
+#define ACPI_PM1B_EVT_BLK_ADDRESS           0x0000000000000000
+
+//
+// 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_OFFSET        0x00
+#define ACPI_PM1A_CNT_BLK_ADDRESS           (ACPI_PM1A_EVT_BLK_ADDRESS + 0x04)
+
+//
+// PM1B Control Register Block Generic Address Information
+//
+#define ACPI_PM1B_CNT_BLK_ADDRESS_SPACE_ID  ACPI_SYSTEM_IO
+#define ACPI_PM1B_CNT_BLK_BIT_WIDTH         0x00
+#define ACPI_PM1B_CNT_BLK_BIT_OFFSET        0x00
+#define ACPI_PM1B_CNT_BLK_ADDRESS           0x0000000000000000
+
+//
+// PM2 Control Register Block Generic Address Information
+//
+#define ACPI_PM2_CNT_BLK_ADDRESS_SPACE_ID   ACPI_SYSTEM_IO
+#define ACPI_PM2_CNT_BLK_BIT_WIDTH          0x00
+#define ACPI_PM2_CNT_BLK_BIT_OFFSET         0x00
+#define ACPI_PM2_CNT_BLK_ADDRESS            0x0000000000000000
+
+//
+// Power Management Timer Control Register Block Generic Address 
+// Information
+//
+#define ACPI_PM_TMR_BLK_ADDRESS_SPACE_ID    ACPI_SYSTEM_IO
+#define ACPI_PM_TMR_BLK_BIT_WIDTH           0x20
+#define ACPI_PM_TMR_BLK_BIT_OFFSET          0x00
+#define ACPI_PM_TMR_BLK_ADDRESS             (ACPI_PM1A_EVT_BLK_ADDRESS + 0x08)
+
+//
+// General Purpose Event 0 Register Block Generic Address
+// Information
+//
+
+#define ACPI_GPE0_BLK_ADDRESS_SPACE_ID      ACPI_SYSTEM_IO
+#define ACPI_GPE0_BLK_BIT_WIDTH             0x00
+#define ACPI_GPE0_BLK_BIT_OFFSET            0x00
+#define ACPI_GPE0_BLK_ADDRESS               0x00
+
+//
+// General Purpose Event 1 Register Block Generic Address
+// Information
+//
+
+#define ACPI_GPE1_BLK_ADDRESS_SPACE_ID      ACPI_SYSTEM_IO
+#define ACPI_GPE1_BLK_BIT_WIDTH             0x00
+#define ACPI_GPE1_BLK_BIT_OFFSET            0x00
+#define ACPI_GPE1_BLK_ADDRESS               0x00
+
+
+//
+// Reset Register Generic Address Information
+//
+#define ACPI_RESET_REG_ADDRESS_SPACE_ID     ACPI_SYSTEM_IO
+#define ACPI_RESET_REG_BIT_WIDTH            0x08
+#define ACPI_RESET_REG_BIT_OFFSET           0x00
+#define ACPI_RESET_REG_ADDRESS              0x0000000000000CF9
+#define ACPI_RESET_VALUE                    0x06
+ 
+//
+// Number of bytes decoded by PM1 event blocks (a and b)
+//
+#define ACPI_PM1_EVT_LEN ((ACPI_PM1A_EVT_BLK_BIT_WIDTH + 
ACPI_PM1B_EVT_BLK_BIT_WIDTH) / 8)
+
+//
+// Number of bytes decoded by PM1 control blocks (a and b)
+//
+#define ACPI_PM1_CNT_LEN ((ACPI_PM1A_CNT_BLK_BIT_WIDTH + 
ACPI_PM1B_CNT_BLK_BIT_WIDTH) / 8)
+
+//
+// Number of bytes decoded by PM2 control block
+//
+#define ACPI_PM2_CNT_LEN (ACPI_PM2_CNT_BLK_BIT_WIDTH / 8)
+
+//
+// Number of bytes decoded by PM timer block
+//
+#define ACPI_PM_TMR_LEN (ACPI_PM_TMR_BLK_BIT_WIDTH / 8)
+
+//
+// Number of bytes decoded by GPE0 block
+//
+#define ACPI_GPE0_BLK_LEN (ACPI_GPE0_BLK_BIT_WIDTH / 8)
+
+//
+// Number of bytes decoded by GPE1 block
+//
+#define ACPI_GPE1_BLK_LEN   0
+
+#endif
diff -r 3c25261fef1c -r 5a8399ad9309 tools/firmware/acpi/acpi_gen.c
--- /dev/null   Thu Jun 30 04:18:49 2005
+++ b/tools/firmware/acpi/acpi_gen.c    Thu Jun 30 04:23:18 2005
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2004, Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ *
+ */
+#include "acpi2_0.h"
+#include "stdio.h"
+
+/*
+ * Generate acpi table
+ * write acpi table to binary: acpitable.bin
+ *
+ */
+ 
+#define USAGE "Usage: acpi_gen filename \n" \
+                         "       generage acpitable and write to the binary 
\n" \
+                         "       filename - the binary name\n"
+
+
+int main(int argc, char** argv){
+               char* filename;
+               char  buf[ACPI_TABLE_SIZE];
+               FILE* f=NULL;
+               int i;
+
+               for (i=0; i<ACPI_TABLE_SIZE; i++){
+                               buf[i]=0;
+               }
+
+               if (argc<2){
+                               fprintf(stderr,"%s",USAGE);
+                               exit(1);
+               }
+
+               filename = argv[1];
+               
+               if(!(f=fopen(filename, "w+"))){
+                               fprintf(stderr,"Can not open %s",filename);
+                               exit(1);
+               }               
+        AcpiBuildTable(buf);
+               if (fwrite(buf, ACPI_TABLE_SIZE, 1, f)<1){
+                               fprintf(stderr,"Can not write to 
%s\n",filename);
+                               exit(1);
+               }
+               return 0;               
+}

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH][7/10] ACPI support for guest firmware., Arun Sharma <=