ACPI Specification for Xen Environment Table
Specification: LINARO-0003
Author: Parth Dixit<parth.dixit@linaro.org>, Julien Grall<julien.grall@citrix.com>
Revision History:
Version	Date	Comments
0.1	4 December 2014	Initial draft.
0.2	4 January 2015	First Revision
Title:
Define Xen Environment table for passing Xen specific information to DOM0.
License:
This work is licensed under the BSD License. To view a copy of this license, visit http://opensource.org/licenses/BSD-3-Clause.
Problem Statement:
DOM0(Linux) requires additional information about the Xen environment for proper communication with Xen. DOM0 shares some memory pages with Xen and it need the address and size of the memory allocated to it. DOM0 also needs to configure interrupt that will be used for notification of events.
The Xen Environment Table:
This specification lays out the structure and content of a new ACPI table – the Xen Environment Table (XENV). This table, while not currently part of the ACPI specification, may or may not become part of the specification at a later date.
The purpose of the XENV is to pass the starting memory address,memory size and event channel interrupt from Xen to DOM0.
The structure of the XENV is defined in Table 1.
Table 1. Xen Environment Table
Field	Byte Length	Byte Offset	Description
Signature	4	0	XENV to indicate that this is the Xen Environment Table.
Length	4	4	Length in bytes of the entire Table
Revision	1	8	1 – current revision level of the XENV
Checksum	1	9	Standard ACPI table checksum; i.e., the entire table must sum to zero
OEMID	6	10	OEM ID
OEM Table ID	8	16	OEM model ID
OEM Revision	4	24	OEM Revision of the XENV for the OEM Table ID
Creator ID	4	28	Vendor ID of the utility that created the table
Creator Revision	4	32	Revision of the utility that created the table
GNT Start	8	36	Starting address of the Grant Table Region
GNT Size	8	44	Size of the Grant Table Region
Evtchn Intr	4	52	PPI used to notify an event channel
Evtchn Intr Flags	1	56	Flags for the Evtchn Intr
The Grant Table region is optional. If not provided, the field “GNT Size" must be 0. The field "GNT start" is unknown.
The Event Channel Interrupt is optional. If not provided, the field "Evtchn Intr" must be 0 (consistent with other tables such as the GTDT). The field "Evtchn intr flags" is unknown.
Flags Definition for the Evtchn intr are defined in Table 2.
Table 2. Evtchn Intr Flags
Bit Field	Bit Offset	Number of bits	Description
Evtchn Intr Mode	0	1	This bit indicates the mode of the Evtchn Intr 1: Interrupt is Edge triggered 0: Interrupt is Level triggered
Evtchn Intr Polarity	1	1	This bit indicates the polarity the Evtchn Intr 1: Interrupt is Active low 0: Interrupt is Active high
Reserved	2	2	Reserved, must be zero
Example:
Below, we define a simple table with arbitrary address and interrupt number:
/*
* Template for [XENV] ACPI Table
* Format: [ByteLength] FieldName : HexFieldValue
*/
[0004] Signature : “XENV” // Xen Environment Table
[0004] Table Length : 00000000
[0001] Revision : 01
[0001] Checksum : 00
[0006] Oem ID : "XenVMM"
[0008] Oem Table ID : "TEMPLATE"
[0004] Oem Revision : 00000000
[0004] Asl Compiler ID : "INTL"
[0004] Asl Compiler Revision : 20140214
[0008] GNT Start : 0000000010000000
[0008] GNT Size : 0000000000002000
[0004] Evtchn Intr : 25
[0001] Evtchn Intr Flags(decoded below) : 03
Evtchn Intr Mode : 1
Evtchn Intr Polarity : 1