Index: root/xen-unstable.hg/tools/firmware/acpi/acpi2_0.h =================================================================== --- root.orig/xen-unstable.hg/tools/firmware/acpi/acpi2_0.h +++ root/xen-unstable.hg/tools/firmware/acpi/acpi2_0.h @@ -111,7 +111,7 @@ typedef struct { // // The maximum number of entrys in RSDT or XSDT // -#define ACPI_MAX_NUM_TABLES 2 +#define ACPI_MAX_NUM_TABLES 3 // // Root System Description Table (RSDT) @@ -126,7 +126,7 @@ typedef struct { // RSDT Revision (as defined in ACPI 2.0 spec.) // -#define ACPI_2_0_RSDT_REVISION 0x01 +#define ACPI_2_0_RSDT_REVISION 0x02 // // Extended System Description Table (XSDT) @@ -139,6 +139,20 @@ typedef struct _ACPI_2_0_XSDT{ #define ACPI_2_0_XSDT_REVISION 0x01 // +// TCG Hardware Interface Table (TCPA) +// + +typedef struct _ACPI_2_0_TCPA{ + ACPI_TABLE_HEADER Header; + uint16_t PlatformClass; + uint32_t LAML; + uint64_t LASA; +} ACPI_2_0_TCPA; + +#define ACPI_2_0_TCPA_REVISION 0x02 +#define ACPI_2_0_TCPA_LAML_SIZE (10*1024) + +// // Fixed ACPI Description Table Structure (FADT) // @@ -318,12 +332,14 @@ typedef struct { #define ACPI_2_0_XSDT_SIGNATURE 0x54445358 // "XSDT" +#define ACPI_2_0_TCPA_SIGNATURE 0x41504354 // "TCPA" + #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 +#define ACPI_PHYSICAL_ADDRESS 0xE2000 +#define ACPI_TABLE_SIZE (4*1024 + ACPI_2_0_TCPA_LAML_SIZE) void AcpiBuildTable(uint8_t* buf); Index: root/xen-unstable.hg/tools/firmware/acpi/acpi_build.c =================================================================== --- root.orig/xen-unstable.hg/tools/firmware/acpi/acpi_build.c +++ root/xen-unstable.hg/tools/firmware/acpi/acpi_build.c @@ -24,6 +24,7 @@ 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_TCPA Tcpa; extern ACPI_2_0_FACS Facs; extern unsigned char *AmlCode; extern int DsdtLen; @@ -35,6 +36,7 @@ typedef struct _ACPI_TABLE_ALL{ ACPI_2_0_XSDT *Xsdt; ACPI_2_0_FADT *Fadt; ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE *Madt; + ACPI_2_0_TCPA *Tcpa; ACPI_2_0_FACS *Facs; unsigned char* Dsdt; uint32_t RsdpOffset; @@ -42,6 +44,7 @@ typedef struct _ACPI_TABLE_ALL{ uint32_t XsdtOffset; uint32_t FadtOffset; uint32_t MadtOffset; + uint32_t TcpaOffset; uint32_t FacsOffset; uint32_t DsdtOffset; }ACPI_TABLE_ALL; @@ -126,8 +129,10 @@ UpdateTable( table->FadtOffset); table->Rsdt->Entry[1] = (uint32_t)(ACPI_PHYSICAL_ADDRESS + table->MadtOffset); + table->Rsdt->Entry[2] = (uint32_t)(ACPI_PHYSICAL_ADDRESS + + table->TcpaOffset); table->Rsdt->Header.Length = sizeof (ACPI_TABLE_HEADER) + - 2*sizeof(uint32_t); + 3*sizeof(uint32_t); SetCheckSum(table->Rsdt, FIELD_OFFSET(ACPI_TABLE_HEADER, Checksum), table->Rsdt->Header.Length @@ -138,8 +143,10 @@ UpdateTable( table->FadtOffset); table->Xsdt->Entry[1] = (uint64_t)(ACPI_PHYSICAL_ADDRESS + table->MadtOffset); + table->Xsdt->Entry[2] = (uint32_t)(ACPI_PHYSICAL_ADDRESS + + table->TcpaOffset); table->Xsdt->Header.Length = sizeof (ACPI_TABLE_HEADER) + - 2*sizeof(uint64_t); + 3*sizeof(uint64_t); SetCheckSum(table->Xsdt, FIELD_OFFSET(ACPI_TABLE_HEADER, Checksum), table->Xsdt->Header.Length @@ -164,6 +171,16 @@ UpdateTable( FIELD_OFFSET(ACPI_TABLE_HEADER, Checksum), sizeof(ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE) ); + + // TCPA Update + table->Tcpa->LASA = (uint64_t)(ACPI_PHYSICAL_ADDRESS + + table->TcpaOffset + + sizeof(ACPI_2_0_TCPA)); + + SetCheckSum(table->Tcpa, + FIELD_OFFSET(ACPI_TABLE_HEADER, Checksum), + sizeof(ACPI_2_0_TCPA) + ); } void @@ -175,6 +192,7 @@ AcpiBuildTable(uint8_t* buf) * RSDP * RSDT * XSDT + * TCPA * FADT * MADT * DSDT @@ -192,7 +210,8 @@ AcpiBuildTable(uint8_t* buf) MemCopy(&Facs, table.Facs, sizeof(ACPI_2_0_FACS)); offset += sizeof(ACPI_2_0_FACS); - // RSDP + // RSDP: must be 16-bit aligned to be found by Linux + offset = (offset + 0xf) & ~0xf; table.RsdpOffset = offset; table.Rsdp = (ACPI_2_0_RSDP*)(&buf[offset]); MemCopy(&Rsdp, table.Rsdp, sizeof(ACPI_2_0_RSDP)); @@ -222,6 +241,12 @@ AcpiBuildTable(uint8_t* buf) MemCopy(&Madt, table.Madt, sizeof(ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE)); offset+=sizeof(ACPI_MULTIPLE_APIC_DESCRIPTION_TABLE); + // TCPA + table.TcpaOffset = offset; + table.Tcpa = (ACPI_2_0_TCPA*)(&buf[offset]); + MemCopy(&Tcpa, table.Tcpa, sizeof(ACPI_2_0_TCPA)); + offset+=sizeof(ACPI_2_0_TCPA)+ACPI_2_0_TCPA_LAML_SIZE; + // DSDT table.DsdtOffset = offset; table.Dsdt = (unsigned char*)(&buf[offset]); Index: root/xen-unstable.hg/tools/firmware/acpi/acpi_tcpa.c =================================================================== --- /dev/null +++ root/xen-unstable.hg/tools/firmware/acpi/acpi_tcpa.c @@ -0,0 +1,42 @@ +/* + * 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 "acpi2_0.h" + +// +// TCPA ACPI Table +// Specification at https://www.trustedcomputinggroup.org/groups/server/TCG_ACPIGeneralSpecification_1-00_1-00_FINAL.pdf +// + +ACPI_2_0_TCPA Tcpa = { + { + ACPI_2_0_TCPA_SIGNATURE, + sizeof (ACPI_2_0_TCPA), + ACPI_2_0_TCPA_REVISION, + 0x00, // updated later + ACPI_OEM_ID, + ACPI_OEM_TABLE_ID, + ACPI_OEM_REVISION, + ACPI_CREATOR_ID, + ACPI_CREATOR_REVISION, + }, + + 0, + ACPI_2_0_TCPA_LAML_SIZE, + 0 +};