mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
[HVM] ACPI: Clean up table definitions, move under hvmloader/
directory pending tighter integration of table generation into hvmloader. This patch also includes the TPM TIS SSDT generator from Stefan Berger at IBM. Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
69ff2305bb
commit
883236e49a
26 files changed
+1179
-1361
No files matched your search
@@ -9,7 +9,6 @@ INST_DIR := $(DESTDIR)/usr/lib/xen/boot
|
||||
SUBDIRS :=
|
||||
SUBDIRS += rombios
|
||||
SUBDIRS += vgabios
|
||||
SUBDIRS += acpi
|
||||
SUBDIRS += vmxassist
|
||||
SUBDIRS += hvmloader
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
#/*
|
||||
# * 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.
|
||||
# *
|
||||
# */
|
||||
#
|
||||
|
||||
XEN_ROOT = ../../..
|
||||
include $(XEN_ROOT)/tools/Rules.mk
|
||||
|
||||
# Compiler flag
|
||||
HOSTCFLAGS += -I. -I../../libxc
|
||||
|
||||
# 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 -tc acpi_dsdt.asl
|
||||
mv acpi_dsdt.hex acpi_dsdt.c
|
||||
echo "int DsdtLen=sizeof(AmlCode);" >> acpi_dsdt.c
|
||||
rm *.aml
|
||||
# iasl -oa -tc acpi_dsdt.asl
|
||||
|
||||
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_PROG) $(IASL_VER)/compiler/iasl /usr/bin/iasl
|
||||
|
||||
$(ACPI_GEN):$(C_SRC) $(H_SRC) acpi_dsdt.c
|
||||
$(HOSTCC) -o $(ACPI_GEN) $(HOSTCFLAGS) $(shell ls *.c)
|
||||
|
||||
$(ACPI_BIN):$(ACPI_GEN)
|
||||
./$(ACPI_GEN) $(ACPI_BIN)
|
||||
|
||||
clean:
|
||||
rm -rf *.o $(ACPI_GEN) $(ACPI_BIN) $(IASL_VER)
|
||||
rm -rf $(IASL_VER).tar.gz
|
||||
|
||||
install: all
|
||||
@@ -1,331 +0,0 @@
|
||||
/*
|
||||
* 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_
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed int int32_t;
|
||||
#ifdef __i386__
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef signed long long int64_t;
|
||||
#else
|
||||
typedef unsigned long uint64_t;
|
||||
typedef signed long int64_t;
|
||||
#endif
|
||||
|
||||
#include <xen/xen.h>
|
||||
|
||||
#pragma pack (1)
|
||||
|
||||
//
|
||||
// common ACPI header.
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
uint32_t Signature;
|
||||
uint32_t Length;
|
||||
uint8_t Revision;
|
||||
uint8_t Checksum;
|
||||
uint8_t OemId[6];
|
||||
uint64_t OemTableId;
|
||||
uint32_t OemRevision;
|
||||
uint32_t CreatorId;
|
||||
uint32_t 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 {
|
||||
uint8_t AddressSpaceId;
|
||||
uint8_t RegisterBitWidth;
|
||||
uint8_t RegisterBitOffset;
|
||||
uint8_t Reserved;
|
||||
uint64_t 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 {
|
||||
uint64_t Signature;
|
||||
uint8_t Checksum;
|
||||
uint8_t OemId[6];
|
||||
uint8_t Reserved;
|
||||
uint32_t RsdtAddress;
|
||||
} ACPI_1_0_RSDP;
|
||||
|
||||
|
||||
//
|
||||
// Root System Description Pointer Structure
|
||||
//
|
||||
typedef struct {
|
||||
uint64_t Signature;
|
||||
uint8_t Checksum;
|
||||
uint8_t OemId[6];
|
||||
uint8_t Revision;
|
||||
uint32_t RsdtAddress;
|
||||
uint32_t Length;
|
||||
uint64_t XsdtAddress;
|
||||
uint8_t ExtendedChecksum;
|
||||
uint8_t 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;
|
||||
uint32_t 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;
|
||||
uint64_t 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;
|
||||
uint32_t FirmwareCtrl;
|
||||
uint32_t Dsdt;
|
||||
uint8_t Reserved0;
|
||||
uint8_t PreferredPmProfile;
|
||||
uint16_t SciInt;
|
||||
uint32_t SmiCmd;
|
||||
uint8_t AcpiEnable;
|
||||
uint8_t AcpiDisable;
|
||||
uint8_t S4BiosReq;
|
||||
uint8_t PstateCnt;
|
||||
uint32_t Pm1aEvtBlk;
|
||||
uint32_t Pm1bEvtBlk;
|
||||
uint32_t Pm1aCntBlk;
|
||||
uint32_t Pm1bCntBlk;
|
||||
uint32_t Pm2CntBlk;
|
||||
uint32_t PmTmrBlk;
|
||||
uint32_t Gpe0Blk;
|
||||
uint32_t Gpe1Blk;
|
||||
uint8_t Pm1EvtLen;
|
||||
uint8_t Pm1CntLen;
|
||||
uint8_t Pm2CntLen;
|
||||
uint8_t PmTmrLen;
|
||||
uint8_t Gpe0BlkLen;
|
||||
uint8_t Gpe1BlkLen;
|
||||
uint8_t Gpe1Base;
|
||||
uint8_t CstCnt;
|
||||
uint16_t PLvl2Lat;
|
||||
uint16_t PLvl3Lat;
|
||||
uint16_t FlushSize;
|
||||
uint16_t FlushStride;
|
||||
uint8_t DutyOffset;
|
||||
uint8_t DutyWidth;
|
||||
uint8_t DayAlrm;
|
||||
uint8_t MonAlrm;
|
||||
uint8_t Century;
|
||||
uint16_t IaPcBootArch;
|
||||
uint8_t Reserved1;
|
||||
uint32_t Flags;
|
||||
ACPI_GENERIC_ADDRESS_STRUCTURE ResetReg;
|
||||
uint8_t ResetValue;
|
||||
uint8_t Reserved2[3];
|
||||
uint64_t XFirmwareCtrl;
|
||||
uint64_t 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 {
|
||||
uint32_t Signature;
|
||||
uint32_t Length;
|
||||
uint32_t HardwareSignature;
|
||||
uint32_t FirmwareWakingVector;
|
||||
uint32_t GlobalLock;
|
||||
uint32_t Flags;
|
||||
uint64_t XFirmwareWakingVector;
|
||||
uint8_t Version;
|
||||
uint8_t 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;
|
||||
uint32_t LocalApicAddress;
|
||||
uint32_t 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 {
|
||||
uint8_t Type;
|
||||
uint8_t Length;
|
||||
uint8_t AcpiProcessorId;
|
||||
uint8_t ApicId;
|
||||
uint32_t 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 {
|
||||
uint8_t Type;
|
||||
uint8_t Length;
|
||||
uint8_t IoApicId;
|
||||
uint8_t Reserved;
|
||||
uint32_t IoApicAddress;
|
||||
uint32_t 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 (4*1024) //Currently 4K is enough
|
||||
|
||||
void
|
||||
AcpiBuildTable(uint8_t* buf);
|
||||
|
||||
#endif
|
||||
@@ -1,232 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
uint32_t RsdpOffset;
|
||||
uint32_t RsdtOffset;
|
||||
uint32_t XsdtOffset;
|
||||
uint32_t FadtOffset;
|
||||
uint32_t MadtOffset;
|
||||
uint32_t FacsOffset;
|
||||
uint32_t DsdtOffset;
|
||||
}ACPI_TABLE_ALL;
|
||||
|
||||
static
|
||||
void
|
||||
MemCopy(void* src, void* dst, int len){
|
||||
|
||||
uint8_t* src0=src;
|
||||
uint8_t* dst0=dst;
|
||||
|
||||
while(len--){
|
||||
*(dst0++)=*(src0++);
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
SetCheckSum(
|
||||
void* Table,
|
||||
uint32_t ChecksumOffset,
|
||||
uint32_t 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
|
||||
*/
|
||||
{
|
||||
uint8_t Sum = 0;
|
||||
uint8_t *Ptr;
|
||||
|
||||
Ptr=Table;
|
||||
Ptr[ChecksumOffset]=0;
|
||||
while (Length--) {
|
||||
Sum = (uint8_t)(Sum + (*Ptr++));
|
||||
}
|
||||
|
||||
Ptr = Table;
|
||||
Ptr[ChecksumOffset] = (uint8_t) (0xff - Sum + 1);
|
||||
}
|
||||
|
||||
//
|
||||
// FIELD_OFFSET - returns the byte offset to a field within a structure
|
||||
//
|
||||
#define FIELD_OFFSET(TYPE,Field) ((uint32_t)(&(((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 = (uint32_t)(ACPI_PHYSICAL_ADDRESS+
|
||||
table->RsdtOffset);
|
||||
table->Rsdp->XsdtAddress = (uint64_t)(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] = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->FadtOffset);
|
||||
table->Rsdt->Entry[1] = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->MadtOffset);
|
||||
table->Rsdt->Header.Length = sizeof (ACPI_TABLE_HEADER) +
|
||||
2*sizeof(uint32_t);
|
||||
SetCheckSum(table->Rsdt,
|
||||
FIELD_OFFSET(ACPI_TABLE_HEADER, Checksum),
|
||||
table->Rsdt->Header.Length
|
||||
);
|
||||
|
||||
//XSDT Update
|
||||
table->Xsdt->Entry[0] = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->FadtOffset);
|
||||
table->Xsdt->Entry[1] = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->MadtOffset);
|
||||
table->Xsdt->Header.Length = sizeof (ACPI_TABLE_HEADER) +
|
||||
2*sizeof(uint64_t);
|
||||
SetCheckSum(table->Xsdt,
|
||||
FIELD_OFFSET(ACPI_TABLE_HEADER, Checksum),
|
||||
table->Xsdt->Header.Length
|
||||
);
|
||||
|
||||
// FADT Update
|
||||
table->Fadt->Dsdt = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->DsdtOffset);
|
||||
table->Fadt->XDsdt = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->DsdtOffset);
|
||||
table->Fadt->FirmwareCtrl = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->FacsOffset);
|
||||
table->Fadt->XFirmwareCtrl = (uint64_t)(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(uint8_t* 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);
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* 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,
|
||||
}
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
@@ -1,193 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
}
|
||||
|
||||
};
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
* 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_
|
||||
|
||||
#include <xen/hvm/ioreq.h>
|
||||
|
||||
//
|
||||
// FADT Definitions, see ACPI 2.0 specification for details.
|
||||
//
|
||||
|
||||
#define ACPI_OEM_FADT_REVISION 0x00000001 // TBD
|
||||
|
||||
#define ACPI_PREFERRED_PM_PROFILE 0x00
|
||||
#define ACPI_SCI_INT 0x0009
|
||||
#define ACPI_SMI_CMD 0x00000000
|
||||
#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 0x00
|
||||
#define ACPI_CST_CNT 0x00
|
||||
#define ACPI_P_LVL2_LAT 0x0064
|
||||
#define ACPI_P_LVL3_LAT 0X03E8
|
||||
#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_PROC_C1 | ACPI_SLP_BUTTON | \
|
||||
ACPI_WBINVD | ACPI_PWR_BUTTON | \
|
||||
ACPI_FIX_RTC | ACPI_TMR_VAL_EXT)
|
||||
|
||||
//
|
||||
// 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 0x20
|
||||
#define ACPI_PM1A_EVT_BLK_BIT_OFFSET 0x00
|
||||
|
||||
//
|
||||
// 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
|
||||
|
||||
//
|
||||
// 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
|
||||
|
||||
//
|
||||
// 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
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* 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,
|
||||
},
|
||||
|
||||
//
|
||||
// IO APIC
|
||||
//
|
||||
{
|
||||
{
|
||||
ACPI_IO_APIC,
|
||||
sizeof (ACPI_IO_APIC_STRUCTURE),
|
||||
0x00,
|
||||
0x00,
|
||||
ACPI_IO_APIC_ADDRESS_1,
|
||||
0x0000
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// LOCAL APIC Entries for up to 32 processors.
|
||||
//
|
||||
{
|
||||
{
|
||||
ACPI_PROCESSOR_LOCAL_APIC,
|
||||
sizeof (ACPI_LOCAL_APIC_STRUCTURE),
|
||||
0x00,
|
||||
0x00,
|
||||
0x00000001,
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -40,27 +40,30 @@ OBJCOPY = objcopy
|
||||
CFLAGS += $(DEFINES) -I. $(XENINC) -fno-builtin -O2 -msoft-float
|
||||
LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,$(LOADADDR)
|
||||
|
||||
SRCS = hvmloader.c acpi_madt.c mp_tables.c util.c smbios.c
|
||||
SRCS = hvmloader.c acpi_madt.c mp_tables.c util.c smbios.c acpi_utils.c
|
||||
OBJS = $(patsubst %.c,%.o,$(SRCS))
|
||||
|
||||
.PHONY: all
|
||||
all: hvmloader
|
||||
|
||||
acpi/acpi.bin:
|
||||
$(MAKE) -C acpi
|
||||
|
||||
hvmloader: roms.h $(SRCS)
|
||||
$(CC) $(CFLAGS) -c $(SRCS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o hvmloader.tmp $(OBJS)
|
||||
$(OBJCOPY) hvmloader.tmp hvmloader
|
||||
rm -f hvmloader.tmp
|
||||
|
||||
roms.h: ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin ../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../vmxassist/vmxassist.bin ../acpi/acpi.bin
|
||||
roms.h: ../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin ../vgabios/VGABIOS-lgpl-latest.cirrus.bin ../vmxassist/vmxassist.bin acpi/acpi.bin
|
||||
sh ./mkhex rombios ../rombios/BIOS-bochs-latest > roms.h
|
||||
sh ./mkhex vgabios_stdvga ../vgabios/VGABIOS-lgpl-latest.bin >> roms.h
|
||||
sh ./mkhex vgabios_cirrusvga ../vgabios/VGABIOS-lgpl-latest.cirrus.bin >> roms.h
|
||||
sh ./mkhex vmxassist ../vmxassist/vmxassist.bin >> roms.h
|
||||
sh ./mkhex acpi ../acpi/acpi.bin >> roms.h
|
||||
sh ./mkhex acpi acpi/acpi.bin >> roms.h
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f roms.h acpi.h
|
||||
rm -f hvmloader hvmloader.tmp hvmloader.o $(OBJS)
|
||||
|
||||
$(MAKE) -C acpi clean
|
||||
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
XEN_ROOT = ../../../..
|
||||
include $(XEN_ROOT)/tools/Rules.mk
|
||||
|
||||
HOSTCFLAGS += -I. -I.. -I$(XEN_ROOT)/tools/libxc
|
||||
|
||||
C_SRC = build.c dsdt.c gen.c static_tables.c
|
||||
H_SRC = $(wildcard *.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)
|
||||
|
||||
dsdt.c: dsdt.asl
|
||||
$(MAKE) iasl
|
||||
iasl -tc dsdt.asl
|
||||
mv dsdt.hex dsdt.c
|
||||
echo "int DsdtLen=sizeof(AmlCode);" >> 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_PROG) $(IASL_VER)/compiler/iasl /usr/bin/iasl
|
||||
|
||||
$(ACPI_GEN): $(C_SRC) $(H_SRC)
|
||||
$(HOSTCC) -o $(ACPI_GEN) $(HOSTCFLAGS) $(C_SRC)
|
||||
|
||||
$(ACPI_BIN): $(ACPI_GEN)
|
||||
./$(ACPI_GEN) $(ACPI_BIN)
|
||||
|
||||
clean:
|
||||
rm -rf *.o $(ACPI_GEN) $(ACPI_BIN) $(IASL_VER)
|
||||
rm -rf $(IASL_VER).tar.gz
|
||||
|
||||
install: all
|
||||
File renamed without changes.
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
* 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_
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef signed int int32_t;
|
||||
#ifdef __i386__
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef signed long long int64_t;
|
||||
#else
|
||||
typedef unsigned long uint64_t;
|
||||
typedef signed long int64_t;
|
||||
#endif
|
||||
|
||||
#include <xen/xen.h>
|
||||
|
||||
#pragma pack (1)
|
||||
|
||||
/*
|
||||
* Common ACPI header.
|
||||
*/
|
||||
struct acpi_header {
|
||||
uint32_t signature;
|
||||
uint32_t length;
|
||||
uint8_t revision;
|
||||
uint8_t checksum;
|
||||
uint8_t oem_id[6];
|
||||
uint64_t oem_table_id;
|
||||
uint32_t oem_revision;
|
||||
uint32_t creator_id;
|
||||
uint32_t creator_revision;
|
||||
};
|
||||
|
||||
#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.
|
||||
*/
|
||||
struct acpi_20_generic_address {
|
||||
uint8_t address_space_id;
|
||||
uint8_t register_bit_width;
|
||||
uint8_t register_bit_offset;
|
||||
uint8_t reserved;
|
||||
uint64_t address;
|
||||
};
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
struct acpi_10_rsdp {
|
||||
uint64_t signature;
|
||||
uint8_t checksum;
|
||||
uint8_t oem_id[6];
|
||||
uint8_t reserved;
|
||||
uint32_t rsdt_address;
|
||||
};
|
||||
|
||||
/*
|
||||
* Root System Description Pointer Structure.
|
||||
*/
|
||||
struct acpi_20_rsdp {
|
||||
uint64_t signature;
|
||||
uint8_t checksum;
|
||||
uint8_t oem_id[6];
|
||||
uint8_t revision;
|
||||
uint32_t rsdt_address;
|
||||
uint32_t length;
|
||||
uint64_t xsdt_address;
|
||||
uint8_t extended_checksum;
|
||||
uint8_t reserved[3];
|
||||
};
|
||||
|
||||
/*
|
||||
* The maximum number of entrys in RSDT or XSDT.
|
||||
*/
|
||||
#define ACPI_MAX_NUM_TABLES 5
|
||||
|
||||
/*
|
||||
* Root System Description Table (RSDT).
|
||||
*/
|
||||
struct acpi_20_rsdt {
|
||||
struct acpi_header header;
|
||||
uint32_t entry[ACPI_MAX_NUM_TABLES];
|
||||
};
|
||||
#define ACPI_2_0_RSDT_REVISION 0x01
|
||||
|
||||
/*
|
||||
* Extended System Description Table (XSDT).
|
||||
*/
|
||||
struct acpi_20_xsdt {
|
||||
struct acpi_header header;
|
||||
uint64_t entry[ACPI_MAX_NUM_TABLES];
|
||||
};
|
||||
#define ACPI_2_0_XSDT_REVISION 0x01
|
||||
|
||||
/*
|
||||
* Fixed ACPI Description Table Structure (FADT).
|
||||
*/
|
||||
struct acpi_20_fadt {
|
||||
struct acpi_header header;
|
||||
uint32_t firmware_ctrl;
|
||||
uint32_t dsdt;
|
||||
uint8_t reserved0;
|
||||
uint8_t preferred_pm_profile;
|
||||
uint16_t sci_int;
|
||||
uint32_t smi_cmd;
|
||||
uint8_t acpi_enable;
|
||||
uint8_t acpi_disable;
|
||||
uint8_t s4bios_req;
|
||||
uint8_t pstate_cnt;
|
||||
uint32_t pm1a_evt_blk;
|
||||
uint32_t pm1b_evt_blk;
|
||||
uint32_t pm1a_cnt_blk;
|
||||
uint32_t pm1b_cnt_blk;
|
||||
uint32_t pm2_cnt_blk;
|
||||
uint32_t pm_tmr_blk;
|
||||
uint32_t gpe0_blk;
|
||||
uint32_t gpe1_blk;
|
||||
uint8_t pm1_evt_len;
|
||||
uint8_t pm1_cnt_len;
|
||||
uint8_t pm2_cnt_len;
|
||||
uint8_t pm_tmr_len;
|
||||
uint8_t gpe0_blk_len;
|
||||
uint8_t gpe1_blk_len;
|
||||
uint8_t gpe1_base;
|
||||
uint8_t cst_cnt;
|
||||
uint16_t p_lvl2_lat;
|
||||
uint16_t p_lvl3_lat;
|
||||
uint16_t flush_size;
|
||||
uint16_t flush_stride;
|
||||
uint8_t duty_offset;
|
||||
uint8_t duty_width;
|
||||
uint8_t day_alrm;
|
||||
uint8_t mon_alrm;
|
||||
uint8_t century;
|
||||
uint16_t iapc_boot_arch;
|
||||
uint8_t reserved1;
|
||||
uint32_t flags;
|
||||
struct acpi_20_generic_address reset_reg;
|
||||
uint8_t reset_value;
|
||||
uint8_t reserved2[3];
|
||||
uint64_t x_firmware_ctrl;
|
||||
uint64_t x_dsdt;
|
||||
struct acpi_20_generic_address x_pm1a_evt_blk;
|
||||
struct acpi_20_generic_address x_pm1b_evt_blk;
|
||||
struct acpi_20_generic_address x_pm1a_cnt_blk;
|
||||
struct acpi_20_generic_address x_pm1b_cnt_blk;
|
||||
struct acpi_20_generic_address x_pm2_cnt_blk;
|
||||
struct acpi_20_generic_address x_pm_tmr_blk;
|
||||
struct acpi_20_generic_address x_gpe0_blk;
|
||||
struct acpi_20_generic_address x_gpe1_blk;
|
||||
};
|
||||
#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).
|
||||
*/
|
||||
struct acpi_20_facs {
|
||||
uint32_t signature;
|
||||
uint32_t length;
|
||||
uint32_t hardware_signature;
|
||||
uint32_t firmware_waking_vector;
|
||||
uint32_t global_lock;
|
||||
uint32_t flags;
|
||||
uint64_t x_firmware_waking_vector;
|
||||
uint8_t version;
|
||||
uint8_t reserved[31];
|
||||
};
|
||||
|
||||
#define ACPI_2_0_FACS_VERSION 0x01
|
||||
|
||||
/*
|
||||
* Multiple APIC Description Table header definition (MADT).
|
||||
*/
|
||||
struct acpi_20_madt_header {
|
||||
struct acpi_header header;
|
||||
uint32_t lapic_addr;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
#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.
|
||||
*/
|
||||
struct acpi_20_madt_lapic {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint8_t acpi_processor_id;
|
||||
uint8_t apic_id;
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
/*
|
||||
* Local APIC Flags. All other bits are reserved and must be 0.
|
||||
*/
|
||||
#define ACPI_LOCAL_APIC_ENABLED (1 << 0)
|
||||
|
||||
/*
|
||||
* IO APIC Structure.
|
||||
*/
|
||||
struct acpi_20_madt_ioapic {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint8_t ioapic_id;
|
||||
uint8_t reserved;
|
||||
uint32_t ioapic_addr;
|
||||
uint32_t gsi_base;
|
||||
};
|
||||
|
||||
struct acpi_20_madt {
|
||||
struct acpi_20_madt_header header;
|
||||
struct acpi_20_madt_ioapic io_apic[1];
|
||||
struct acpi_20_madt_lapic lapic[32];
|
||||
};
|
||||
|
||||
/*
|
||||
* Table Signatures.
|
||||
*/
|
||||
#define ACPI_2_0_RSDP_SIGNATURE 0x2052545020445352LL /* "RSD PTR " */
|
||||
#define ACPI_2_0_FACS_SIGNATURE 0x53434146 /* "FACS" */
|
||||
#define ACPI_2_0_FADT_SIGNATURE 0x50434146 /* "FADT" */
|
||||
#define ACPI_2_0_MADT_SIGNATURE 0x43495041 /* "APIC" */
|
||||
#define ACPI_2_0_RSDT_SIGNATURE 0x54445352 /* "RSDT" */
|
||||
#define ACPI_2_0_XSDT_SIGNATURE 0x54445358 /* "XSDT" */
|
||||
|
||||
#pragma pack ()
|
||||
|
||||
#define ACPI_PHYSICAL_ADDRESS 0xEA000
|
||||
#define ACPI_TABLE_SIZE (4*1024)
|
||||
|
||||
void AcpiBuildTable(uint8_t *buf);
|
||||
|
||||
#endif /* _ACPI_2_0_H_ */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
* c-set-style: "BSD"
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
extern struct acpi_20_rsdp Rsdp;
|
||||
extern struct acpi_20_rsdt Rsdt;
|
||||
extern struct acpi_20_xsdt Xsdt;
|
||||
extern struct acpi_20_fadt Fadt;
|
||||
extern struct acpi_20_madt Madt;
|
||||
extern struct acpi_20_facs Facs;
|
||||
extern unsigned char *AmlCode;
|
||||
extern int DsdtLen;
|
||||
|
||||
|
||||
typedef struct _ACPI_TABLE_ALL{
|
||||
struct acpi_20_rsdp *Rsdp;
|
||||
struct acpi_20_rsdt *Rsdt;
|
||||
struct acpi_20_xsdt *Xsdt;
|
||||
struct acpi_20_fadt *Fadt;
|
||||
struct acpi_20_madt *Madt;
|
||||
struct acpi_20_facs *Facs;
|
||||
unsigned char *Dsdt;
|
||||
uint32_t RsdpOffset;
|
||||
uint32_t RsdtOffset;
|
||||
uint32_t XsdtOffset;
|
||||
uint32_t FadtOffset;
|
||||
uint32_t MadtOffset;
|
||||
uint32_t FacsOffset;
|
||||
uint32_t DsdtOffset;
|
||||
}ACPI_TABLE_ALL;
|
||||
|
||||
static
|
||||
void
|
||||
MemCopy(void* src, void* dst, int len){
|
||||
|
||||
uint8_t* src0=src;
|
||||
uint8_t* dst0=dst;
|
||||
|
||||
while(len--){
|
||||
*(dst0++)=*(src0++);
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
SetCheckSum(
|
||||
void* Table,
|
||||
uint32_t ChecksumOffset,
|
||||
uint32_t 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
|
||||
*/
|
||||
{
|
||||
uint8_t Sum = 0;
|
||||
uint8_t *Ptr;
|
||||
|
||||
Ptr=Table;
|
||||
Ptr[ChecksumOffset]=0;
|
||||
while (Length--) {
|
||||
Sum = (uint8_t)(Sum + (*Ptr++));
|
||||
}
|
||||
|
||||
Ptr = Table;
|
||||
Ptr[ChecksumOffset] = (uint8_t) (0xff - Sum + 1);
|
||||
}
|
||||
|
||||
//
|
||||
// FIELD_OFFSET - returns the byte offset to a field within a structure
|
||||
//
|
||||
#define FIELD_OFFSET(TYPE,Field) ((uint32_t)(&(((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->rsdt_address = (uint32_t)(ACPI_PHYSICAL_ADDRESS+
|
||||
table->RsdtOffset);
|
||||
table->Rsdp->xsdt_address = (uint64_t)(ACPI_PHYSICAL_ADDRESS+
|
||||
table->XsdtOffset);
|
||||
SetCheckSum(table->Rsdp,
|
||||
FIELD_OFFSET(struct acpi_10_rsdp, checksum),
|
||||
sizeof(struct acpi_10_rsdp)
|
||||
);
|
||||
SetCheckSum(table->Rsdp,
|
||||
FIELD_OFFSET(struct acpi_20_rsdp,
|
||||
extended_checksum),
|
||||
sizeof(struct acpi_20_rsdp)
|
||||
);
|
||||
|
||||
|
||||
//RSDT Update
|
||||
table->Rsdt->entry[0] = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->FadtOffset);
|
||||
table->Rsdt->entry[1] = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->MadtOffset);
|
||||
table->Rsdt->header.length = sizeof (struct acpi_header) +
|
||||
2*sizeof(uint32_t);
|
||||
SetCheckSum(table->Rsdt,
|
||||
FIELD_OFFSET(struct acpi_header, checksum),
|
||||
table->Rsdt->header.length
|
||||
);
|
||||
|
||||
//XSDT Update
|
||||
table->Xsdt->entry[0] = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->FadtOffset);
|
||||
table->Xsdt->entry[1] = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->MadtOffset);
|
||||
table->Xsdt->header.length = sizeof (struct acpi_header) +
|
||||
2*sizeof(uint64_t);
|
||||
SetCheckSum(table->Xsdt,
|
||||
FIELD_OFFSET(struct acpi_header, checksum),
|
||||
table->Xsdt->header.length
|
||||
);
|
||||
|
||||
// FADT Update
|
||||
table->Fadt->dsdt = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->DsdtOffset);
|
||||
table->Fadt->x_dsdt = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->DsdtOffset);
|
||||
table->Fadt->firmware_ctrl = (uint32_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->FacsOffset);
|
||||
table->Fadt->x_firmware_ctrl = (uint64_t)(ACPI_PHYSICAL_ADDRESS +
|
||||
table->FacsOffset);
|
||||
SetCheckSum(table->Fadt,
|
||||
FIELD_OFFSET(struct acpi_header, checksum),
|
||||
sizeof(struct acpi_20_fadt)
|
||||
);
|
||||
|
||||
// MADT update
|
||||
SetCheckSum(table->Madt,
|
||||
FIELD_OFFSET(struct acpi_header, checksum),
|
||||
sizeof(struct acpi_20_madt)
|
||||
);
|
||||
}
|
||||
|
||||
void
|
||||
AcpiBuildTable(uint8_t* 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 = (struct acpi_20_facs *)(&buf[offset]);
|
||||
MemCopy(&Facs, table.Facs, sizeof(struct acpi_20_facs));
|
||||
offset += sizeof(struct acpi_20_facs);
|
||||
|
||||
// RSDP
|
||||
table.RsdpOffset = offset;
|
||||
table.Rsdp = (struct acpi_20_rsdp *)(&buf[offset]);
|
||||
MemCopy(&Rsdp, table.Rsdp, sizeof(struct acpi_20_rsdp));
|
||||
offset += sizeof(struct acpi_20_rsdp);
|
||||
|
||||
// RSDT
|
||||
table.RsdtOffset = offset;
|
||||
table.Rsdt = (struct acpi_20_rsdt *)(&buf[offset]);
|
||||
MemCopy(&Rsdt, table.Rsdt, sizeof(struct acpi_20_rsdt));
|
||||
offset += sizeof(struct acpi_20_rsdt);
|
||||
|
||||
// XSDT
|
||||
table.XsdtOffset = offset;
|
||||
table.Xsdt = (struct acpi_20_xsdt *)(&buf[offset]);
|
||||
MemCopy(&Xsdt, table.Xsdt, sizeof(struct acpi_20_xsdt));
|
||||
offset += sizeof(struct acpi_20_xsdt);
|
||||
|
||||
// FADT
|
||||
table.FadtOffset = offset;
|
||||
table.Fadt = (struct acpi_20_fadt *)(&buf[offset]);
|
||||
MemCopy(&Fadt, table.Fadt, sizeof(struct acpi_20_fadt));
|
||||
offset += sizeof(struct acpi_20_fadt);
|
||||
|
||||
// MADT
|
||||
table.MadtOffset = offset;
|
||||
table.Madt = (struct acpi_20_madt*)(&buf[offset]);
|
||||
MemCopy(&Madt, table.Madt, sizeof(struct acpi_20_madt));
|
||||
offset += sizeof(struct acpi_20_madt);
|
||||
|
||||
// DSDT
|
||||
table.DsdtOffset = offset;
|
||||
table.Dsdt = (unsigned char *)(&buf[offset]);
|
||||
MemCopy(&AmlCode, table.Dsdt, DsdtLen);
|
||||
offset += DsdtLen;
|
||||
|
||||
UpdateTable(&table);
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
* c-set-style: "BSD"
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Intel Corporation.
|
||||
* Copyright (c) 2006, Keir Fraser, XenSource Inc.
|
||||
*
|
||||
* 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 <xen/hvm/ioreq.h>
|
||||
|
||||
/*
|
||||
* Multiple APIC Description Table (MADT).
|
||||
*/
|
||||
|
||||
struct acpi_20_madt Madt = {
|
||||
.header = {
|
||||
.header = {
|
||||
.signature = ACPI_2_0_MADT_SIGNATURE,
|
||||
.length = sizeof(struct acpi_20_madt),
|
||||
.revision = ACPI_2_0_MADT_REVISION,
|
||||
.oem_id = ACPI_OEM_ID,
|
||||
.oem_table_id = ACPI_OEM_TABLE_ID,
|
||||
.oem_revision = ACPI_OEM_REVISION,
|
||||
.creator_id = ACPI_CREATOR_ID,
|
||||
.creator_revision = ACPI_CREATOR_REVISION
|
||||
},
|
||||
.lapic_addr = 0xFEE00000,
|
||||
.flags = ACPI_PCAT_COMPAT
|
||||
},
|
||||
|
||||
/* IO APIC */
|
||||
.io_apic = {
|
||||
[0] = {
|
||||
.type = ACPI_IO_APIC,
|
||||
.length = sizeof(struct acpi_20_madt_ioapic),
|
||||
.ioapic_addr = 0xFEC00000
|
||||
}
|
||||
},
|
||||
|
||||
/* Local APIC entries for up to 32 processors. */
|
||||
.lapic = {
|
||||
[0] = {
|
||||
.type = ACPI_PROCESSOR_LOCAL_APIC,
|
||||
.length = sizeof(struct acpi_20_madt_lapic),
|
||||
.flags = 0x00000001
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Firmware ACPI Control Structure (FACS).
|
||||
*/
|
||||
|
||||
struct acpi_20_facs Facs = {
|
||||
.signature = ACPI_2_0_FACS_SIGNATURE,
|
||||
.length = sizeof(struct acpi_20_facs),
|
||||
.version = ACPI_2_0_FACS_VERSION
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Fixed ACPI Description Table (FADT).
|
||||
*/
|
||||
|
||||
#define ACPI_PM1A_EVT_BLK_BIT_WIDTH 0x20
|
||||
#define ACPI_PM1A_EVT_BLK_BIT_OFFSET 0x00
|
||||
#define ACPI_PM1A_CNT_BLK_BIT_WIDTH 0x10
|
||||
#define ACPI_PM1A_CNT_BLK_BIT_OFFSET 0x00
|
||||
#define ACPI_PM_TMR_BLK_BIT_WIDTH 0x20
|
||||
#define ACPI_PM_TMR_BLK_BIT_OFFSET 0x00
|
||||
|
||||
struct acpi_20_fadt Fadt = {
|
||||
.header = {
|
||||
.signature = ACPI_2_0_FADT_SIGNATURE,
|
||||
.length = sizeof(struct acpi_20_fadt),
|
||||
.revision = ACPI_2_0_FADT_REVISION,
|
||||
.oem_id = ACPI_OEM_ID,
|
||||
.oem_table_id = ACPI_OEM_TABLE_ID,
|
||||
.oem_revision = ACPI_OEM_REVISION,
|
||||
.creator_id = ACPI_CREATOR_ID,
|
||||
.creator_revision = ACPI_CREATOR_REVISION
|
||||
},
|
||||
|
||||
.sci_int = 9,
|
||||
|
||||
.pm1a_evt_blk = ACPI_PM1A_EVT_BLK_ADDRESS,
|
||||
.pm1a_cnt_blk = ACPI_PM1A_CNT_BLK_ADDRESS,
|
||||
.pm_tmr_blk = ACPI_PM_TMR_BLK_ADDRESS,
|
||||
.pm1_evt_len = ACPI_PM1A_EVT_BLK_BIT_WIDTH / 8,
|
||||
.pm1_cnt_len = ACPI_PM1A_CNT_BLK_BIT_WIDTH / 8,
|
||||
.pm_tmr_len = ACPI_PM_TMR_BLK_BIT_WIDTH / 8,
|
||||
|
||||
.p_lvl2_lat = 0x0fff, /* >100, means we do not support C2 state */
|
||||
.p_lvl3_lat = 0x0fff, /* >1000, means we do not support C3 state */
|
||||
.iapc_boot_arch = ACPI_LEGACY_DEVICES | ACPI_8042,
|
||||
.flags = (ACPI_PROC_C1 | ACPI_SLP_BUTTON |
|
||||
ACPI_WBINVD | ACPI_PWR_BUTTON |
|
||||
ACPI_FIX_RTC | ACPI_TMR_VAL_EXT),
|
||||
|
||||
.reset_reg = {
|
||||
.address_space_id = ACPI_SYSTEM_IO,
|
||||
.register_bit_width = 8, /* *must* be 8 */
|
||||
.register_bit_offset = 0, /* *must* be 0 */
|
||||
.address = 0xcf9
|
||||
},
|
||||
.reset_value = 6,
|
||||
|
||||
.x_pm1a_evt_blk = {
|
||||
.address_space_id = ACPI_SYSTEM_IO,
|
||||
.register_bit_width = ACPI_PM1A_EVT_BLK_BIT_WIDTH,
|
||||
.register_bit_offset = ACPI_PM1A_EVT_BLK_BIT_OFFSET,
|
||||
.address = ACPI_PM1A_EVT_BLK_ADDRESS,
|
||||
},
|
||||
|
||||
.x_pm1a_cnt_blk = {
|
||||
.address_space_id = ACPI_SYSTEM_IO,
|
||||
.register_bit_width = ACPI_PM1A_CNT_BLK_BIT_WIDTH,
|
||||
.register_bit_offset = ACPI_PM1A_CNT_BLK_BIT_OFFSET,
|
||||
.address = ACPI_PM1A_CNT_BLK_ADDRESS,
|
||||
},
|
||||
|
||||
.x_pm_tmr_blk = {
|
||||
.address_space_id = ACPI_SYSTEM_IO,
|
||||
.register_bit_width = ACPI_PM_TMR_BLK_BIT_WIDTH,
|
||||
.register_bit_offset = ACPI_PM_TMR_BLK_BIT_OFFSET,
|
||||
.address = ACPI_PM_TMR_BLK_ADDRESS,
|
||||
}
|
||||
};
|
||||
|
||||
struct acpi_20_rsdt Rsdt = {
|
||||
.header = {
|
||||
.signature = ACPI_2_0_RSDT_SIGNATURE,
|
||||
.length = sizeof(struct acpi_header),
|
||||
.revision = ACPI_2_0_RSDT_REVISION,
|
||||
.oem_id = ACPI_OEM_ID,
|
||||
.oem_table_id = ACPI_OEM_TABLE_ID,
|
||||
.oem_revision = ACPI_OEM_REVISION,
|
||||
.creator_id = ACPI_CREATOR_ID,
|
||||
.creator_revision = ACPI_CREATOR_REVISION
|
||||
}
|
||||
};
|
||||
|
||||
struct acpi_20_xsdt Xsdt = {
|
||||
.header = {
|
||||
.signature = ACPI_2_0_XSDT_SIGNATURE,
|
||||
.length = sizeof(struct acpi_header),
|
||||
.revision = ACPI_2_0_XSDT_REVISION,
|
||||
.oem_id = ACPI_OEM_ID,
|
||||
.oem_table_id = ACPI_OEM_TABLE_ID,
|
||||
.oem_revision = ACPI_OEM_REVISION,
|
||||
.creator_id = ACPI_CREATOR_ID,
|
||||
.creator_revision = ACPI_CREATOR_REVISION
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct acpi_20_rsdp Rsdp = {
|
||||
.signature = ACPI_2_0_RSDP_SIGNATURE,
|
||||
.oem_id = ACPI_OEM_ID,
|
||||
.revision = ACPI_OEM_REVISION,
|
||||
.length = sizeof(struct acpi_20_rsdp)
|
||||
};
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
* c-set-style: "BSD"
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
@@ -18,9 +18,9 @@
|
||||
* Place - Suite 330, Boston, MA 02111-1307 USA.
|
||||
*/
|
||||
|
||||
#include "../acpi/acpi2_0.h"
|
||||
#include "../acpi/acpi_madt.h"
|
||||
#include "acpi/acpi2_0.h"
|
||||
#include "util.h"
|
||||
#include "acpi_utils.h"
|
||||
#include <xen/hvm/hvm_info_table.h>
|
||||
|
||||
#define NULL ((void*)0)
|
||||
@@ -29,160 +29,134 @@ static struct hvm_info_table *table = NULL;
|
||||
|
||||
static int validate_hvm_info(struct hvm_info_table *t)
|
||||
{
|
||||
char signature[] = "HVM INFO";
|
||||
uint8_t *ptr = (uint8_t *)t;
|
||||
uint8_t sum = 0;
|
||||
int i;
|
||||
char signature[] = "HVM INFO";
|
||||
uint8_t *ptr = (uint8_t *)t;
|
||||
uint8_t sum = 0;
|
||||
int i;
|
||||
|
||||
/* strncmp(t->signature, "HVM INFO", 8) */
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (signature[i] != t->signature[i]) {
|
||||
puts("Bad hvm info signature\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* strncmp(t->signature, "HVM INFO", 8) */
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (signature[i] != t->signature[i]) {
|
||||
puts("Bad hvm info signature\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < t->length; i++)
|
||||
sum += ptr[i];
|
||||
for (i = 0; i < t->length; i++)
|
||||
sum += ptr[i];
|
||||
|
||||
return (sum == 0);
|
||||
return (sum == 0);
|
||||
}
|
||||
|
||||
/* xc_vmx_builder wrote hvm info at 0x9F800. Return it. */
|
||||
struct hvm_info_table *
|
||||
get_hvm_info_table(void)
|
||||
{
|
||||
struct hvm_info_table *t;
|
||||
struct hvm_info_table *t;
|
||||
|
||||
if (table != NULL)
|
||||
return table;
|
||||
if (table != NULL)
|
||||
return table;
|
||||
|
||||
t = (struct hvm_info_table *)HVM_INFO_PADDR;
|
||||
t = (struct hvm_info_table *)HVM_INFO_PADDR;
|
||||
|
||||
if (!validate_hvm_info(t)) {
|
||||
puts("Bad hvm info table\n");
|
||||
return NULL;
|
||||
}
|
||||
if (!validate_hvm_info(t)) {
|
||||
puts("Bad hvm info table\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
table = t;
|
||||
table = t;
|
||||
|
||||
return table;
|
||||
return table;
|
||||
}
|
||||
|
||||
int
|
||||
get_vcpu_nr(void)
|
||||
{
|
||||
struct hvm_info_table *t = get_hvm_info_table();
|
||||
return (t ? t->nr_vcpus : 1); /* default 1 vcpu */
|
||||
struct hvm_info_table *t = get_hvm_info_table();
|
||||
return (t ? t->nr_vcpus : 1); /* default 1 vcpu */
|
||||
}
|
||||
|
||||
int
|
||||
get_acpi_enabled(void)
|
||||
{
|
||||
struct hvm_info_table *t = get_hvm_info_table();
|
||||
return (t ? t->acpi_enabled : 0); /* default no acpi */
|
||||
struct hvm_info_table *t = get_hvm_info_table();
|
||||
return (t ? t->acpi_enabled : 0); /* default no acpi */
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
acpi_madt_get_madt(unsigned char *acpi_start)
|
||||
{
|
||||
ACPI_2_0_RSDP *rsdp=NULL;
|
||||
ACPI_2_0_RSDT *rsdt=NULL;
|
||||
ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE *madt;
|
||||
struct acpi_20_rsdt *rsdt;
|
||||
struct acpi_20_madt *madt;
|
||||
|
||||
rsdp = (ACPI_2_0_RSDP *)(acpi_start + sizeof(ACPI_2_0_FACS));
|
||||
if (rsdp->Signature != ACPI_2_0_RSDP_SIGNATURE) {
|
||||
puts("Bad RSDP signature\n");
|
||||
return NULL;
|
||||
}
|
||||
rsdt = acpi_rsdt_get(acpi_start);
|
||||
if (rsdt == NULL)
|
||||
return NULL;
|
||||
|
||||
rsdt= (ACPI_2_0_RSDT *)
|
||||
(acpi_start + rsdp->RsdtAddress - ACPI_PHYSICAL_ADDRESS);
|
||||
if (rsdt->Header.Signature != ACPI_2_0_RSDT_SIGNATURE) {
|
||||
puts("Bad RSDT signature\n");
|
||||
return NULL;
|
||||
}
|
||||
madt = (struct acpi_20_madt *)(acpi_start + rsdt->entry[1] -
|
||||
ACPI_PHYSICAL_ADDRESS);
|
||||
if (madt->header.header.signature != ACPI_2_0_MADT_SIGNATURE) {
|
||||
puts("Bad MADT signature \n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
madt = (ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE *)
|
||||
( acpi_start+ rsdt->Entry[1] - ACPI_PHYSICAL_ADDRESS);
|
||||
if (madt->Header.Header.Signature !=
|
||||
ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE) {
|
||||
puts("Bad MADT signature \n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return madt;
|
||||
}
|
||||
|
||||
static void
|
||||
set_checksum(void *start, int checksum_offset, int len)
|
||||
{
|
||||
unsigned char sum = 0;
|
||||
unsigned char *ptr;
|
||||
|
||||
ptr = start;
|
||||
ptr[checksum_offset] = 0;
|
||||
while (len--)
|
||||
sum += *ptr++;
|
||||
|
||||
ptr = start;
|
||||
ptr[checksum_offset] = -sum;
|
||||
return madt;
|
||||
}
|
||||
|
||||
static int
|
||||
acpi_madt_set_local_apics(
|
||||
int nr_vcpu,
|
||||
ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE *madt)
|
||||
int nr_vcpu,
|
||||
struct acpi_20_madt *madt)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if ((nr_vcpu > MAX_VIRT_CPUS) || (nr_vcpu < 0) || !madt)
|
||||
return -1;
|
||||
if ((nr_vcpu > MAX_VIRT_CPUS) || (nr_vcpu < 0) || !madt)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < nr_vcpu; i++) {
|
||||
madt->LocalApic[i].Type = ACPI_PROCESSOR_LOCAL_APIC;
|
||||
madt->LocalApic[i].Length = sizeof (ACPI_LOCAL_APIC_STRUCTURE);
|
||||
madt->LocalApic[i].AcpiProcessorId = i;
|
||||
madt->LocalApic[i].ApicId = i;
|
||||
madt->LocalApic[i].Flags = 1;
|
||||
}
|
||||
for (i = 0; i < nr_vcpu; i++) {
|
||||
madt->lapic[i].type = ACPI_PROCESSOR_LOCAL_APIC;
|
||||
madt->lapic[i].length = sizeof(struct acpi_20_madt_lapic);
|
||||
madt->lapic[i].acpi_processor_id = i;
|
||||
madt->lapic[i].apic_id = i;
|
||||
madt->lapic[i].flags = 1;
|
||||
}
|
||||
|
||||
madt->Header.Header.Length =
|
||||
sizeof(ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE) -
|
||||
(MAX_VIRT_CPUS - nr_vcpu)* sizeof(ACPI_LOCAL_APIC_STRUCTURE);
|
||||
madt->header.header.length =
|
||||
sizeof(struct acpi_20_madt) -
|
||||
(MAX_VIRT_CPUS - nr_vcpu) * sizeof(struct acpi_20_madt_lapic);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define FIELD_OFFSET(TYPE,Field) ((unsigned int)(&(((TYPE *) 0)->Field)))
|
||||
|
||||
int acpi_madt_update(unsigned char *acpi_start)
|
||||
{
|
||||
int rc;
|
||||
ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE *madt;
|
||||
int rc;
|
||||
struct acpi_20_madt *madt;
|
||||
|
||||
madt = acpi_madt_get_madt(acpi_start);
|
||||
if (!madt)
|
||||
return -1;
|
||||
madt = acpi_madt_get_madt(acpi_start);
|
||||
if (!madt)
|
||||
return -1;
|
||||
|
||||
rc = acpi_madt_set_local_apics(get_vcpu_nr(), madt);
|
||||
if (rc != 0)
|
||||
return rc;
|
||||
rc = acpi_madt_set_local_apics(get_vcpu_nr(), madt);
|
||||
if (rc != 0)
|
||||
return rc;
|
||||
|
||||
set_checksum(
|
||||
madt, FIELD_OFFSET(ACPI_TABLE_HEADER, Checksum),
|
||||
madt->Header.Header.Length);
|
||||
set_checksum(
|
||||
madt, FIELD_OFFSET(struct acpi_header, checksum),
|
||||
madt->header.header.length);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* c-file-style: "linux"
|
||||
* indent-tabs-mode: t
|
||||
* c-indent-level: 8
|
||||
* c-basic-offset: 8
|
||||
* tab-width: 8
|
||||
* mode: C
|
||||
* c-set-style: "BSD"
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,29 @@
|
||||
//**********************************************************************//
|
||||
//*
|
||||
//* Copyright (c) 2006, IBM 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.
|
||||
|
||||
//* SSDT for TPM TIS Interface for Xen with Qemu device model
|
||||
|
||||
DefinitionBlock ("SSDT_TPM.aml", "SSDT", 1, "IBM","xen", 2006)
|
||||
{
|
||||
Device (TPM) {
|
||||
Name (_HID, EisaId ("PNP0C31"))
|
||||
Name (_CRS, ResourceTemplate ()
|
||||
{
|
||||
Memory32Fixed (ReadWrite, 0xFED40000, 0x5000,)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
*
|
||||
* Intel ACPI Component Architecture
|
||||
* ASL Optimizing Compiler version 20060707 [Sep 11 2006]
|
||||
* Copyright (C) 2000 - 2006 Intel Corporation
|
||||
* Supports ACPI Specification Revision 3.0a
|
||||
*
|
||||
* Compilation of "acpi_ssdt_tpm.asl" - Mon Oct 30 11:28:27 2006
|
||||
*
|
||||
* C source code output
|
||||
*
|
||||
*/
|
||||
unsigned char AmlCode_TPM[] =
|
||||
{
|
||||
0x53,0x53,0x44,0x54,0x4C,0x00,0x00,0x00, /* 00000000 "SSDTL..." */
|
||||
0x01,0x6D,0x49,0x42,0x4D,0x00,0x00,0x00, /* 00000008 ".mIBM..." */
|
||||
0x78,0x65,0x6E,0x00,0x00,0x00,0x00,0x00, /* 00000010 "xen....." */
|
||||
0xD6,0x07,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
|
||||
0x07,0x07,0x06,0x20,0x5B,0x82,0x26,0x54, /* 00000020 "... [.&T" */
|
||||
0x50,0x4D,0x5F,0x08,0x5F,0x48,0x49,0x44, /* 00000028 "PM_._HID" */
|
||||
0x0C,0x41,0xD0,0x0C,0x31,0x08,0x5F,0x43, /* 00000030 ".A..1._C" */
|
||||
0x52,0x53,0x11,0x11,0x0A,0x0E,0x86,0x09, /* 00000038 "RS......" */
|
||||
0x00,0x01,0x00,0x00,0xD4,0xFE,0x00,0x50, /* 00000040 ".......P" */
|
||||
0x00,0x00,0x79,0x00,
|
||||
};
|
||||
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* Commonly used ACPI utility functions.
|
||||
* Probing for devices and writing SSDT entries into XSDT and RSDT tables.
|
||||
*
|
||||
* Yu Ke, ke.yu@intel.com
|
||||
* Copyright (c) 2005, Intel Corporation.
|
||||
* Copyright (c) 2006, IBM 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/acpi2_0.h"
|
||||
#include "acpi_utils.h"
|
||||
#include "util.h"
|
||||
|
||||
static int acpi_rsdt_add_entry_pointer(unsigned char *acpi_start,
|
||||
unsigned char *entry);
|
||||
static unsigned char *acpi_xsdt_add_entry(unsigned char *acpi_start,
|
||||
unsigned char **freemem,
|
||||
unsigned char *limit,
|
||||
unsigned char *table,
|
||||
unsigned int table_size);
|
||||
|
||||
void set_checksum(void *start, int checksum_offset, int len)
|
||||
{
|
||||
unsigned char sum = 0;
|
||||
unsigned char *ptr;
|
||||
|
||||
ptr = start;
|
||||
ptr[checksum_offset] = 0;
|
||||
while (len--)
|
||||
sum += *ptr++;
|
||||
|
||||
ptr = start;
|
||||
ptr[checksum_offset] = -sum;
|
||||
}
|
||||
|
||||
|
||||
#include "acpi_ssdt_tpm.h"
|
||||
static int acpi_tpm_tis_probe(unsigned char *acpi_start,
|
||||
unsigned char **freemem,
|
||||
unsigned char *limit)
|
||||
{
|
||||
int success = 1; /* not successful means 'out of memory' */
|
||||
unsigned char *addr;
|
||||
/* check TPM_DID, TPM_VID, TPM_RID in ioemu/hw/tpm_tis.c */
|
||||
uint16_t tis_did_vid_rid[] = {0x0001, 0x0001, 0x0001};
|
||||
|
||||
/* probe for TIS interface ... */
|
||||
if (memcmp((char *)(0xFED40000 + 0xF00),
|
||||
tis_did_vid_rid,
|
||||
sizeof(tis_did_vid_rid)) == 0) {
|
||||
puts("TIS is available\n");
|
||||
addr = acpi_xsdt_add_entry(acpi_start, freemem, limit,
|
||||
AmlCode_TPM, sizeof(AmlCode_TPM));
|
||||
if (addr == NULL)
|
||||
success = 0;
|
||||
else {
|
||||
/* legacy systems need an RSDT entry */
|
||||
acpi_rsdt_add_entry_pointer(acpi_start,
|
||||
addr);
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Call functions that probe for devices and have them register their
|
||||
* SSDT entries with the XSDT and RSDT tables.
|
||||
*/
|
||||
void acpi_update(unsigned char *acpi_start,
|
||||
unsigned long acpi_size,
|
||||
unsigned char *limit,
|
||||
unsigned char **freemem)
|
||||
{
|
||||
acpi_tpm_tis_probe(acpi_start, freemem, limit);
|
||||
}
|
||||
|
||||
|
||||
struct acpi_20_rsdt *acpi_rsdt_get(unsigned char *acpi_start)
|
||||
{
|
||||
struct acpi_20_rsdp *rsdp;
|
||||
struct acpi_20_rsdt *rsdt;
|
||||
|
||||
rsdp = (struct acpi_20_rsdp *)(acpi_start + sizeof(struct acpi_20_facs));
|
||||
if (rsdp->signature != ACPI_2_0_RSDP_SIGNATURE) {
|
||||
puts("Bad RSDP signature\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rsdt = (struct acpi_20_rsdt *)
|
||||
(acpi_start + rsdp->rsdt_address - ACPI_PHYSICAL_ADDRESS);
|
||||
if (rsdt->header.signature != ACPI_2_0_RSDT_SIGNATURE) {
|
||||
puts("Bad RSDT signature\n");
|
||||
return NULL;
|
||||
}
|
||||
return rsdt;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add an entry to the RSDT table given the pointer to the entry.
|
||||
*/
|
||||
static int acpi_rsdt_add_entry_pointer(unsigned char *acpi_start,
|
||||
unsigned char *entry)
|
||||
{
|
||||
struct acpi_20_rsdt *rsdt = acpi_rsdt_get(acpi_start);
|
||||
int found = 0;
|
||||
int i = 0;
|
||||
|
||||
/* get empty slot in the RSDT table */
|
||||
while (i < ACPI_MAX_NUM_TABLES) {
|
||||
if (rsdt->entry[i] == 0) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
rsdt->entry[i] = (uint64_t)(long)entry;
|
||||
rsdt->header.length =
|
||||
sizeof(struct acpi_header) +
|
||||
(i + 1) * sizeof(uint64_t);
|
||||
set_checksum(rsdt,
|
||||
FIELD_OFFSET(struct acpi_header, checksum),
|
||||
rsdt->header.length);
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
/* Get the XSDT table */
|
||||
struct acpi_20_xsdt *acpi_xsdt_get(unsigned char *acpi_start)
|
||||
{
|
||||
struct acpi_20_rsdp *rsdp;
|
||||
struct acpi_20_xsdt *xsdt;
|
||||
|
||||
rsdp = (struct acpi_20_rsdp *)(acpi_start + sizeof(struct acpi_20_facs));
|
||||
if (rsdp->signature != ACPI_2_0_RSDP_SIGNATURE) {
|
||||
puts("Bad RSDP signature\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
xsdt = (struct acpi_20_xsdt *)
|
||||
(acpi_start + rsdp->xsdt_address - ACPI_PHYSICAL_ADDRESS);
|
||||
if (xsdt->header.signature != ACPI_2_0_XSDT_SIGNATURE) {
|
||||
puts("Bad XSDT signature\n");
|
||||
return NULL;
|
||||
}
|
||||
return xsdt;
|
||||
}
|
||||
|
||||
/*
|
||||
add an entry to the xdst table entry pointers
|
||||
copy the given ssdt data to the current available memory at
|
||||
freemem, if it does not exceed the limit
|
||||
*/
|
||||
static unsigned char *acpi_xsdt_add_entry(unsigned char *acpi_start,
|
||||
unsigned char **freemem,
|
||||
unsigned char *limit,
|
||||
unsigned char *table,
|
||||
unsigned int table_size)
|
||||
{
|
||||
struct acpi_20_xsdt *xsdt = acpi_xsdt_get(acpi_start);
|
||||
int found = 0, i = 0;
|
||||
unsigned char *addr = NULL;
|
||||
|
||||
/* get empty slot in the Xsdt table */
|
||||
while (i < ACPI_MAX_NUM_TABLES) {
|
||||
if (xsdt->entry[i] == 0) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
/* memory below hard limit ? */
|
||||
if (*freemem + table_size <= limit) {
|
||||
puts("Copying SSDT entry!\n");
|
||||
addr = *freemem;
|
||||
memcpy(addr, table, table_size);
|
||||
xsdt->entry[i] = (uint64_t)(long)addr;
|
||||
*freemem += table_size;
|
||||
/* update the XSDT table */
|
||||
xsdt->header.length =
|
||||
sizeof(struct acpi_header) +
|
||||
(i + 1) * sizeof(uint64_t);
|
||||
set_checksum(xsdt,
|
||||
FIELD_OFFSET(struct acpi_header, checksum),
|
||||
xsdt->header.length);
|
||||
}
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2004, Intel Corporation.
|
||||
* Commonly used ACPI utility functions.
|
||||
*
|
||||
* Yu Ke, ke.yu@intel.com
|
||||
* Copyright (c) 2005, 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,
|
||||
@@ -13,32 +16,21 @@
|
||||
* 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_
|
||||
#ifndef ACPI_UTILS_H
|
||||
#define ACPI_UTILS_H
|
||||
|
||||
#include "acpi2_0.h"
|
||||
#define FIELD_OFFSET(TYPE,Field) ((unsigned int)(&(((TYPE *) 0)->Field)))
|
||||
|
||||
//
|
||||
// MADT Definitions, see ACPI 2.0 specification for details
|
||||
//
|
||||
#define NULL ((void*)0)
|
||||
|
||||
#define ACPI_LOCAL_APIC_ADDRESS 0xFEE00000
|
||||
void set_checksum(void *start, int checksum_offset, int len);
|
||||
void acpi_update(unsigned char *acpi_start,
|
||||
unsigned long acpi_size,
|
||||
unsigned char *limit,
|
||||
unsigned char **freemem);
|
||||
|
||||
#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_IO_APIC_STRUCTURE IoApic[1];
|
||||
ACPI_LOCAL_APIC_STRUCTURE LocalApic[32];
|
||||
} ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE;
|
||||
#pragma pack ()
|
||||
struct acpi_20_rsdt *acpi_rsdt_get(unsigned char *acpi_start);
|
||||
struct acpi_20_xsdt *acpi_xsdt_get(unsigned char *acpi_start);
|
||||
|
||||
#endif
|
||||
@@ -22,9 +22,10 @@
|
||||
* Place - Suite 330, Boston, MA 02111-1307 USA.
|
||||
*/
|
||||
#include "roms.h"
|
||||
#include "../acpi/acpi2_0.h" /* for ACPI_PHYSICAL_ADDRESS */
|
||||
#include "acpi/acpi2_0.h" /* for ACPI_PHYSICAL_ADDRESS */
|
||||
#include "hypercall.h"
|
||||
#include "util.h"
|
||||
#include "acpi_utils.h"
|
||||
#include "smbios.h"
|
||||
#include <xen/version.h>
|
||||
#include <xen/hvm/params.h>
|
||||
@@ -195,12 +196,18 @@ main(void)
|
||||
puts("Loading ACPI ...\n");
|
||||
acpi_madt_update((unsigned char *) acpi);
|
||||
if (ACPI_PHYSICAL_ADDRESS+sizeof(acpi) <= 0xF0000) {
|
||||
unsigned char *freemem = (unsigned char *)
|
||||
(ACPI_PHYSICAL_ADDRESS + sizeof(acpi));
|
||||
/*
|
||||
* Make sure acpi table does not overlap rombios
|
||||
* currently acpi less than 8K will be OK.
|
||||
*/
|
||||
memcpy((void *)ACPI_PHYSICAL_ADDRESS, acpi,
|
||||
sizeof(acpi));
|
||||
acpi_update((unsigned char *)ACPI_PHYSICAL_ADDRESS,
|
||||
sizeof(acpi),
|
||||
(unsigned char *)0xF0000,
|
||||
&freemem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* Place - Suite 330, Boston, MA 02111-1307 USA.
|
||||
*/
|
||||
|
||||
#include "../acpi/acpi2_0.h" /* for ACPI_PHYSICAL_ADDRESS */
|
||||
#include "acpi/acpi2_0.h" /* for ACPI_PHYSICAL_ADDRESS */
|
||||
#include "util.h"
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||