Index: ioemu/Makefile.target =================================================================== --- ioemu.orig/Makefile.target 2006-12-08 02:00:40.000000000 +0000 +++ ioemu/Makefile.target 2006-12-08 02:00:40.000000000 +0000 @@ -358,6 +358,7 @@ VL_OBJS+= fdc.o mc146818rtc.o serial.o pc.o VL_OBJS+= cirrus_vga.o mixeng.o parallel.o acpi.o piix_pci.o VL_OBJS+= usb-uhci.o +VL_OBJS+= piix4acpi.o DEFINES += -DHAS_AUDIO endif ifeq ($(TARGET_BASE_ARCH), ppc) Index: ioemu/hw/pc.c =================================================================== --- ioemu.orig/hw/pc.c 2006-12-08 02:00:40.000000000 +0000 +++ ioemu/hw/pc.c 2006-12-08 02:00:40.000000000 +0000 @@ -874,13 +874,19 @@ cmos_init(ram_size, boot_device, bs_table, timeoffset); + /* using PIIX4 acpi model */ + if (pci_enabled && acpi_enabled) + pci_piix4_acpi_init(pci_bus, piix3_devfn + 2); + if (pci_enabled && usb_enabled) { - usb_uhci_init(pci_bus, piix3_devfn + 2); + usb_uhci_init(pci_bus, piix3_devfn + (acpi_enabled ? 3 : 2)); } +#ifndef CONFIG_DM if (pci_enabled && acpi_enabled) { piix4_pm_init(pci_bus, piix3_devfn + 3); } +#endif /* !CONFIG_DM */ #if 0 /* ??? Need to figure out some way for the user to @@ -903,8 +909,10 @@ /* XXX: should be done in the Bochs BIOS */ if (pci_enabled) { pci_bios_init(); +#ifndef CONFIG_DM if (acpi_enabled) acpi_bios_init(); +#endif /* !CONFIG_DM */ } } Index: ioemu/hw/piix4acpi.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ ioemu/hw/piix4acpi.c 2006-12-08 02:00:40.000000000 +0000 @@ -0,0 +1,396 @@ +/* + * PIIX4 ACPI controller emulation + * + * Winston liwen Wang, winston.l.wang@intel.com + * Copyright (c) 2006 , Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "vl.h" +#define FREQUENCE_PMTIMER 3753425 +/* acpi register bit define here */ + +/* PM1_STS */ +#define TMROF_STS (1 << 0) +#define BM_STS (1 << 4) +#define GBL_STS (1 << 5) +#define PWRBTN_STS (1 << 8) +#define RTC_STS (1 << 10) +#define PRBTNOR_STS (1 << 11) +#define WAK_STS (1 << 15) +/* PM1_EN */ +#define TMROF_EN (1 << 0) +#define GBL_EN (1 << 5) +#define PWRBTN_EN (1 << 8) +#define RTC_EN (1 << 10) +/* PM1_CNT */ +#define SCI_EN (1 << 0) +#define GBL_RLS (1 << 2) +#define SLP_EN (1 << 13) + +typedef struct AcpiDeviceState AcpiDeviceState; +AcpiDeviceState *acpi_device_table; + +/* Bits of PM1a register define here */ +typedef struct PM1Event_BLK { + uint16_t pm1_status; /* pm1a_EVT_BLK */ + uint16_t pm1_enable; /* pm1a_EVT_BLK+2 */ +}PM1Event_BLK; + +typedef struct PCIAcpiState { + PCIDevice dev; + uint16_t irq; + uint16_t pm1_status; /* pm1a_EVT_BLK */ + uint16_t pm1_enable; /* pm1a_EVT_BLK+2 */ + uint16_t pm1_control; /* pm1a_ECNT_BLK */ + uint32_t pm1_timer; /* pmtmr_BLK */ +} PCIAcpiState; + +static PCIAcpiState *acpi_state; + +static inline void acpi_set_irq(PCIAcpiState *s) +{ +/* no real SCI event need for now, so comment the following line out */ +/* pic_set_irq(s->irq, 1); */ + printf("acpi_set_irq: s->irq %x \n",s->irq); +} + +static void acpi_reset(PCIAcpiState *s) +{ + uint8_t *pci_conf; + pci_conf = s->dev.config; + + pci_conf[0x42] = 0x00; + pci_conf[0x43] = 0x00; + s->irq = 9; + s->pm1_status = 0; + s->pm1_enable = 0x00; /* TMROF_EN should cleared */ + s->pm1_control = SCI_EN; /* SCI_EN */ + s->pm1_timer = 0; +} + +/*byte access */ +static void acpiPm1Status_writeb(void *opaque, uint32_t addr, uint32_t val) +{ + PCIAcpiState *s = opaque; + + if ((val&TMROF_STS)==TMROF_STS) + s->pm1_status = s->pm1_status&!TMROF_STS; + + if ((val&GBL_STS)==GBL_STS) + s->pm1_status = s->pm1_status&!GBL_STS; + +/* printf("acpiPm1Status_writeb \n addr %x val:%x pm1_status:%x \n", addr, val,s->pm1_status); */ +} + +static uint32_t acpiPm1Status_readb(void *opaque, uint32_t addr) +{ + PCIAcpiState *s = opaque; + uint32_t val; + + val = s->pm1_status; +/* printf("acpiPm1Status_readb \n addr %x val:%x\n", addr, val); */ + + return val; +} + +static void acpiPm1StatusP1_writeb(void *opaque, uint32_t addr, uint32_t val) +{ + PCIAcpiState *s = opaque; + + s->pm1_status = (val<<8)||(s->pm1_status); +/* printf("acpiPm1StatusP1_writeb \n addr %x val:%x\n", addr, val); */ +} + +static uint32_t acpiPm1StatusP1_readb(void *opaque, uint32_t addr) +{ + PCIAcpiState *s = opaque; + uint32_t val; + + val = (s->pm1_status)>>8; + printf("acpiPm1StatusP1_readb \n addr %x val:%x\n", addr, val); + + return val; +} + +static void acpiPm1Enable_writeb(void *opaque, uint32_t addr, uint32_t val) +{ + PCIAcpiState *s = opaque; + + s->pm1_enable = val; +/* printf("acpiPm1Enable_writeb \n addr %x val:%x\n", addr, val); */ +} + +static uint32_t acpiPm1Enable_readb(void *opaque, uint32_t addr) +{ + PCIAcpiState *s = opaque; + uint32_t val; + + val = (s->pm1_enable)||0x1; +/* printf("acpiPm1Enable_readb \n addr %x val:%x\n", addr, val); */ + + return val; +} + +static void acpiPm1EnableP1_writeb(void *opaque, uint32_t addr, uint32_t val) +{ + PCIAcpiState *s = opaque; + + s->pm1_enable = (val<<8)||(s->pm1_enable); +/* printf("acpiPm1EnableP1_writeb \n addr %x val:%x\n", addr, val); */ + +} + +static uint32_t acpiPm1EnableP1_readb(void *opaque, uint32_t addr) +{ + PCIAcpiState *s = opaque; + uint32_t val; + + val = (s->pm1_enable)>>8; +/* printf("acpiPm1EnableP1_readb \n addr %x val:%x\n", addr, val); */ + + return val; +} + +static void acpiPm1Control_writeb(void *opaque, uint32_t addr, uint32_t val) +{ + PCIAcpiState *s = opaque; + + s->pm1_control = val; +/* printf("acpiPm1Control_writeb \n addr %x val:%x\n", addr, val); */ + +} + +static uint32_t acpiPm1Control_readb(void *opaque, uint32_t addr) +{ + PCIAcpiState *s = opaque; + uint32_t val; + + val = s->pm1_control; +/* printf("acpiPm1Control_readb \n addr %x val:%x\n", addr, val); */ + + return val; +} + +static void acpiPm1ControlP1_writeb(void *opaque, uint32_t addr, uint32_t val) +{ + PCIAcpiState *s = opaque; + + s->pm1_control = (val<<8)||(s->pm1_control); +/* printf("acpiPm1ControlP1_writeb \n addr %x val:%x\n", addr, val); */ + +} + +static uint32_t acpiPm1ControlP1_readb(void *opaque, uint32_t addr) +{ + PCIAcpiState *s = opaque; + uint32_t val; + + val = (s->pm1_control)>>8; +/* printf("acpiPm1ControlP1_readb \n addr %x val:%x\n", addr, val); */ + + return val; +} + + +/* word access */ + +static void acpiPm1Status_writew(void *opaque, uint32_t addr, uint32_t val) +{ + PCIAcpiState *s = opaque; + + if ((val&TMROF_STS)==TMROF_STS) + s->pm1_status = s->pm1_status&!TMROF_STS; + + if ((val&GBL_STS)==GBL_STS) + s->pm1_status = s->pm1_status&!GBL_STS; + +/* printf("acpiPm1Status_writew \n addr %x val:%x pm1_status:%x \n", addr, val,s->pm1_status); */ +} + +static uint32_t acpiPm1Status_readw(void *opaque, uint32_t addr) +{ + PCIAcpiState *s = opaque; + uint32_t val; + + val = s->pm1_status; +/* printf("acpiPm1Status_readw \n addr %x val:%x\n", addr, val); */ + + return val; +} + +static void acpiPm1Enable_writew(void *opaque, uint32_t addr, uint32_t val) +{ + PCIAcpiState *s = opaque; + + s->pm1_enable = val; +/* printf("acpiPm1Enable_writew \n addr %x val:%x\n", addr, val); */ + +} + +static uint32_t acpiPm1Enable_readw(void *opaque, uint32_t addr) +{ + PCIAcpiState *s = opaque; + uint32_t val; + + val = s->pm1_e
--  LLVM binding
--  Copyright (C) 2014 Tristan Gingold
--
--  This program is free software: you can redistribute it and/or modify
--  it under the terms of the GNU General Public License as published by
--  the Free Software Foundation, either version 2 of the License, or
--  (at your option) any later version.
--
--  This program is distributed in the hope that it will be useful,
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--  GNU General Public License for more details.
--
--  You should have received a copy of the GNU General Public License
--  along with this program.  If not, see <gnu.org/licenses>.
with LLVM.Core; use LLVM.Core;

package LLVM.Transforms.Scalar is
   --  See llvm::createAggressiveDCEPass function.
   procedure AddAggressiveDCEPass(PM : PassManagerRef);
   pragma Import (C, AddAggressiveDCEPass, "LLVMAddAggressiveDCEPass");

   --  See llvm::createCFGSimplificationPass function.
   procedure AddCFGSimplificationPass(PM : PassManagerRef);
   pragma Import (C, AddCFGSimplificationPass, "LLVMAddCFGSimplificationPass");

   --  See llvm::createDeadStoreEliminationPass function.
   procedure AddDeadStoreEliminationPass(PM : PassManagerRef);
   pragma Import (C, AddDeadStoreEliminationPass,
                  "LLVMAddDeadStoreEliminationPass");

   --  See llvm::createScalarizerPass function.
   procedure AddScalarizerPass(PM : PassManagerRef);
   pragma Import (C, AddScalarizerPass, "LLVMAddScalarizerPass");

   --  See llvm::createGVNPass function.
   procedure AddGVNPass(PM : PassManagerRef);
   pragma Import (C, AddGVNPass, "LLVMAddGVNPass");

   --  See llvm::createIndVarSimplifyPass function.
   procedure AddIndVarSimplifyPass(PM : PassManagerRef);
   pragma Import (C, AddIndVarSimplifyPass, "LLVMAddIndVarSimplifyPass");

   --  See llvm::createInstructionCombiningPass function.
   procedure AddInstructionCombiningPass(PM : PassManagerRef);
   pragma Import (C, AddInstructionCombiningPass,
                  "LLVMAddInstructionCombiningPass");

   --  See llvm::createJumpThreadingPass function.
   procedure AddJumpThreadingPass(PM : PassManagerRef);
   pragma Import (C, AddJumpThreadingPass, "LLVMAddJumpThreadingPass");

   --  See llvm::createLICMPass function.
   procedure AddLICMPass(PM : PassManagerRef);
   pragma Import (C, AddLICMPass, "LLVMAddLICMPass");

   --  See llvm::createLoopDeletionPass function.
   procedure AddLoopDeletionPass(PM : PassManagerRef);
   pragma Import (C, AddLoopDeletionPass, "LLVMAddLoopDeletionPass");

   --  See llvm::createLoopIdiomPass function
   procedure AddLoopIdiomPass(PM : PassManagerRef);
   pragma Import (C, AddLoopIdiomPass, "LLVMAddLoopIdiomPass");

   --  See llvm::createLoopRotatePass function.
   procedure AddLoopRotatePass(PM : PassManagerRef);
   pragma Import (C, AddLoopRotatePass, "LLVMAddLoopRotatePass");

   --  See llvm::createLoopRerollPass function.
   procedure AddLoopRerollPass(PM : PassManagerRef);
   pragma Import (C, AddLoopRerollPass, "LLVMAddLoopRerollPass");

   --  See llvm::createLoopUnrollPass function.
   procedure AddLoopUnrollPass(PM : PassManagerRef);
   pragma Import (C, AddLoopUnrollPass, "LLVMAddLoopUnrollPass");

   --  See llvm::createLoopUnswitchPass function.
   procedure AddLoopUnswitchPass(PM : PassManagerRef);
   pragma Import (C, AddLoopUnswitchPass, "LLVMAddLoopUnswitchPass");

   --  See llvm::createMemCpyOptPass function.
   procedure AddMemCpyOptPass(PM : PassManagerRef);
   pragma Import (C, AddMemCpyOptPass, "LLVMAddMemCpyOptPass");

   --  See llvm::createPartiallyInlineLibCallsPass function.
   procedure AddPartiallyInlineLibCallsPass(PM : PassManagerRef);
   pragma Import (C, AddPartiallyInlineLibCallsPass,
                  "LLVMAddPartiallyInlineLibCallsPass");

   --  See llvm::createPromoteMemoryToRegisterPass function.
   procedure AddPromoteMemoryToRegisterPass(PM : PassManagerRef);
   pragma Import (C, AddPromoteMemoryToRegisterPass,
                  "LLVMAddPromoteMemoryToRegisterPass");

   --  See llvm::createReassociatePass function.
   procedure AddReassociatePass(PM : PassManagerRef);
   pragma Import (C, AddReassociatePass, "LLVMAddReassociatePass");

   --  See llvm::createSCCPPass function.
   procedure AddSCCPPass(PM : PassManagerRef);
   pragma Import (C, AddSCCPPass, "LLVMAddSCCPPass");

   --  See llvm::createScalarReplAggregatesPass function.
   procedure AddScalarReplAggregatesPass(PM : PassManagerRef);
   pragma Import (C, AddScalarReplAggregatesPass,
                  "LLVMAddScalarReplAggregatesPass");

   --  See llvm::createScalarReplAggregatesPass function.
   procedure AddScalarReplAggregatesPassSSA(PM : PassManagerRef);
   pragma Import (C, AddScalarReplAggregatesPassSSA,
                  "LLVMAddScalarReplAggregatesPassSSA");

   --  See llvm::createScalarReplAggregatesPass function.
   procedure AddScalarReplAggregatesPassWithThreshold
     (PM : PassManagerRef; Threshold : Integer);
   pragma Import (C, AddScalarReplAggregatesPassWithThreshold,
                  "LLVMAddScalarReplAggregatesPassWithThreshold");

   --  See llvm::createSimplifyLibCallsPass function.
   procedure AddSimplifyLibCallsPass(PM : PassManagerRef);
   pragma Import (C, AddSimplifyLibCallsPass, "LLVMAddSimplifyLibCallsPass");

   --  See llvm::createTailCallEliminationPass function.
   procedure AddTailCallEliminationPass(PM : PassManagerRef);
   pragma Import (C, AddTailCallEliminationPass,
                  "LLVMAddTailCallEliminationPass");

   --  See llvm::createConstantPropagationPass function.
   procedure AddConstantPropagationPass(PM : PassManagerRef);
   pragma Import (C, AddConstantPropagationPass,
                  "LLVMAddConstantPropagationPass");

   --  See llvm::demotePromoteMemoryToRegisterPass function.
   procedure AddDemoteMemoryToRegisterPass(PM : PassManagerRef);
   pragma Import (C, AddDemoteMemoryToRegisterPass,
                  "LLVMAddDemoteMemoryToRegisterPass");

   --  See llvm::createVerifierPass function.
   procedure AddVerifierPass(PM : PassManagerRef);
   pragma Import (C, AddVerifierPass, "LLVMAddVerifierPass");

   --  See llvm::createCorrelatedValuePropagationPass function
   procedure AddCorrelatedValuePropagationPass(PM : PassManagerRef);
   pragma Import (C, AddCorrelatedValuePropagationPass,
                  "LLVMAddCorrelatedValuePropagationPass");

   --  See llvm::createEarlyCSEPass function
   procedure AddEarlyCSEPass(PM : PassManagerRef);
   pragma Import (C, AddEarlyCSEPass, "LLVMAddEarlyCSEPass");

   --  See llvm::createLowerExpectIntrinsicPass function
   procedure AddLowerExpectIntrinsicPass(PM : PassManagerRef);
   pragma Import (C, AddLowerExpectIntrinsicPass,
                  "LLVMAddLowerExpectIntrinsicPass");

   --  See llvm::createTypeBasedAliasAnalysisPass function
   procedure AddTypeBasedAliasAnalysisPass(PM : PassManagerRef);
   pragma Import (C, AddTypeBasedAliasAnalysisPass,
                  "LLVMAddTypeBasedAliasAnalysisPass");

   --  See llvm::createBasicAliasAnalysisPass function
   procedure AddBasicAliasAnalysisPass(PM : PassManagerRef);
   pragma Import (C, AddBasicAliasAnalysisPass,
                  "LLVMAddBasicAliasAnalysisPass");
end LLVM.Transforms.Scalar;