home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / src / linux-headers-2.6.17-6 / include / acpi / actbl.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-08-11  |  11.1 KB  |  317 lines

  1. /******************************************************************************
  2.  *
  3.  * Name: actbl.h - Table data structures defined in ACPI specification
  4.  *
  5.  *****************************************************************************/
  6.  
  7. /*
  8.  * Copyright (C) 2000 - 2006, R. Byron Moore
  9.  * All rights reserved.
  10.  *
  11.  * Redistribution and use in source and binary forms, with or without
  12.  * modification, are permitted provided that the following conditions
  13.  * are met:
  14.  * 1. Redistributions of source code must retain the above copyright
  15.  *    notice, this list of conditions, and the following disclaimer,
  16.  *    without modification.
  17.  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18.  *    substantially similar to the "NO WARRANTY" disclaimer below
  19.  *    ("Disclaimer") and any redistribution must be conditioned upon
  20.  *    including a substantially similar Disclaimer requirement for further
  21.  *    binary redistribution.
  22.  * 3. Neither the names of the above-listed copyright holders nor the names
  23.  *    of any contributors may be used to endorse or promote products derived
  24.  *    from this software without specific prior written permission.
  25.  *
  26.  * Alternatively, this software may be distributed under the terms of the
  27.  * GNU General Public License ("GPL") version 2 as published by the Free
  28.  * Software Foundation.
  29.  *
  30.  * NO WARRANTY
  31.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  32.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35.  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39.  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40.  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41.  * POSSIBILITY OF SUCH DAMAGES.
  42.  */
  43.  
  44. #ifndef __ACTBL_H__
  45. #define __ACTBL_H__
  46.  
  47. /*
  48.  * Note about bitfields: The u8 type is used for bitfields in ACPI tables.
  49.  * This is the only type that is even remotely portable. Anything else is not
  50.  * portable, so do not use any other bitfield types.
  51.  */
  52.  
  53. /*
  54.  *  Values for description table header signatures
  55.  */
  56. #define RSDP_NAME               "RSDP"
  57. #define RSDP_SIG                "RSD PTR "    /* RSDT Pointer signature */
  58. #define APIC_SIG                "APIC"    /* Multiple APIC Description Table */
  59. #define DSDT_SIG                "DSDT"    /* Differentiated System Description Table */
  60. #define FADT_SIG                "FACP"    /* Fixed ACPI Description Table */
  61. #define FACS_SIG                "FACS"    /* Firmware ACPI Control Structure */
  62. #define PSDT_SIG                "PSDT"    /* Persistent System Description Table */
  63. #define RSDT_SIG                "RSDT"    /* Root System Description Table */
  64. #define XSDT_SIG                "XSDT"    /* Extended  System Description Table */
  65. #define SSDT_SIG                "SSDT"    /* Secondary System Description Table */
  66. #define SBST_SIG                "SBST"    /* Smart Battery Specification Table */
  67. #define SPIC_SIG                "SPIC"    /* IOSAPIC table */
  68. #define BOOT_SIG                "BOOT"    /* Boot table */
  69.  
  70. #define GL_OWNED                0x02    /* Ownership of global lock is bit 1 */
  71.  
  72. /*
  73.  * Common table types.  The base code can remain
  74.  * constant if the underlying tables are changed
  75.  */
  76. #define RSDT_DESCRIPTOR         struct rsdt_descriptor_rev2
  77. #define XSDT_DESCRIPTOR         struct xsdt_descriptor_rev2
  78. #define FACS_DESCRIPTOR         struct facs_descriptor_rev2
  79. #define FADT_DESCRIPTOR         struct fadt_descriptor_rev2
  80.  
  81. #pragma pack(1)
  82.  
  83. /*
  84.  * ACPI Version-independent tables
  85.  *
  86.  * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
  87.  * are in separate files.
  88.  */
  89. struct rsdp_descriptor {    /* Root System Descriptor Pointer */
  90.     char signature[8];    /* ACPI signature, contains "RSD PTR " */
  91.     u8 checksum;        /* ACPI 1.0 checksum */
  92.     char oem_id[6];        /* OEM identification */
  93.     u8 revision;        /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
  94.     u32 rsdt_physical_address;    /* 32-bit physical address of the RSDT */
  95.     u32 length;        /* XSDT Length in bytes, including header */
  96.     u64 xsdt_physical_address;    /* 64-bit physical address of the XSDT */
  97.     u8 extended_checksum;    /* Checksum of entire table (ACPI 2.0) */
  98.     char reserved[3];    /* Reserved, must be zero */
  99. };
  100.  
  101. struct acpi_common_facs {    /* Common FACS for internal use */
  102.     u32 *global_lock;
  103.     u64 *firmware_waking_vector;
  104.     u8 vector_width;
  105. };
  106.  
  107. #define ACPI_TABLE_HEADER_DEF   /* ACPI common table header */ \
  108.     char                            signature[4];           /* ASCII table signature */\
  109.     u32                             length;                 /* Length of table in bytes, including this header */\
  110.     u8                              revision;               /* ACPI Specification minor version # */\
  111.     u8                              checksum;               /* To make sum of entire table == 0 */\
  112.     char                            oem_id[6];              /* ASCII OEM identification */\
  113.     char                            oem_table_id[8];        /* ASCII OEM table identification */\
  114.     u32                             oem_revision;           /* OEM revision number */\
  115.     char                            asl_compiler_id [4];    /* ASCII ASL compiler vendor ID */\
  116.     u32                             asl_compiler_revision;    /* ASL compiler version */
  117.  
  118. struct acpi_table_header {    /* ACPI common table header */
  119. ACPI_TABLE_HEADER_DEF};
  120.  
  121. /*
  122.  * MADT values and structures
  123.  */
  124.  
  125. /* Values for MADT PCATCompat */
  126.  
  127. #define DUAL_PIC                0
  128. #define MULTIPLE_APIC           1
  129.  
  130. /* Master MADT */
  131.  
  132. struct multiple_apic_table {
  133.     ACPI_TABLE_HEADER_DEF    /* ACPI common table header */
  134.     u32 local_apic_address;    /* Physical address of local APIC */
  135.  
  136.     /* Flags (32 bits) */
  137.  
  138.     u8 PCATcompat:1;    /* 00:    System also has dual 8259s */
  139.      u8:7;            /* 01-07: Reserved, must be zero */
  140.     u8 reserved1[3];    /* 08-31: Reserved, must be zero */
  141. };
  142.  
  143. /* Values for Type in APIC_HEADER_DEF */
  144.  
  145. #define APIC_PROCESSOR          0
  146. #define APIC_IO                 1
  147. #define APIC_XRUPT_OVERRIDE     2
  148. #define APIC_NMI                3
  149. #define APIC_LOCAL_NMI          4
  150. #define APIC_ADDRESS_OVERRIDE   5
  151. #define APIC_IO_SAPIC           6
  152. #define APIC_LOCAL_SAPIC        7
  153. #define APIC_XRUPT_SOURCE       8
  154. #define APIC_RESERVED           9    /* 9 and greater are reserved */
  155.  
  156. /*
  157.  * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
  158.  */
  159. #define APIC_HEADER_DEF                     /* Common APIC sub-structure header */\
  160.     u8                              type; \
  161.     u8                              length;
  162.  
  163. struct apic_header {
  164. APIC_HEADER_DEF};
  165.  
  166. /* Values for MPS INTI flags */
  167.  
  168. #define POLARITY_CONFORMS       0
  169. #define POLARITY_ACTIVE_HIGH    1
  170. #define POLARITY_RESERVED       2
  171. #define POLARITY_ACTIVE_LOW     3
  172.  
  173. #define TRIGGER_CONFORMS        0
  174. #define TRIGGER_EDGE            1
  175. #define TRIGGER_RESERVED        2
  176. #define TRIGGER_LEVEL           3
  177.  
  178. /* Common flag definitions (16 bits each) */
  179.  
  180. #define MPS_INTI_FLAGS \
  181.     u8                              polarity        : 2;    /* 00-01: Polarity of APIC I/O input signals */\
  182.     u8                              trigger_mode    : 2;    /* 02-03: Trigger mode of APIC input signals */\
  183.     u8                                              : 4;    /* 04-07: Reserved, must be zero */\
  184.     u8                              reserved1;    /* 08-15: Reserved, must be zero */
  185.  
  186. #define LOCAL_APIC_FLAGS \
  187.     u8                              processor_enabled: 1;   /* 00:    Processor is usable if set */\
  188.     u8                                              : 7;    /* 01-07: Reserved, must be zero */\
  189.     u8                              reserved2;    /* 08-15: Reserved, must be zero */
  190.  
  191. /* Sub-structures for MADT */
  192.  
  193. struct madt_processor_apic {
  194.     APIC_HEADER_DEF u8 processor_id;    /* ACPI processor id */
  195.     u8 local_apic_id;    /* Processor's local APIC id */
  196.  LOCAL_APIC_FLAGS};
  197.  
  198. struct madt_io_apic {
  199.     APIC_HEADER_DEF u8 io_apic_id;    /* I/O APIC ID */
  200.     u8 reserved;        /* Reserved - must be zero */
  201.     u32 address;        /* APIC physical address */
  202.     u32 interrupt;        /* Global system interrupt where INTI
  203.                  * lines start */
  204. };
  205.  
  206. struct madt_interrupt_override {
  207.     APIC_HEADER_DEF u8 bus;    /* 0 - ISA */
  208.     u8 source;        /* Interrupt source (IRQ) */
  209.     u32 interrupt;        /* Global system interrupt */
  210.  MPS_INTI_FLAGS};
  211.  
  212. struct madt_nmi_source {
  213.     APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt;    /* Global system interrupt */
  214. };
  215.  
  216. struct madt_local_apic_nmi {
  217.     APIC_HEADER_DEF u8 processor_id;    /* ACPI processor id */
  218.     MPS_INTI_FLAGS u8 lint;    /* LINTn to which NMI is connected */
  219. };
  220.  
  221. struct madt_address_override {
  222.     APIC_HEADER_DEF u16 reserved;    /* Reserved, must be zero */
  223.     u64 address;        /* APIC physical address */
  224. };
  225.  
  226. struct madt_io_sapic {
  227.     APIC_HEADER_DEF u8 io_sapic_id;    /* I/O SAPIC ID */
  228.     u8 reserved;        /* Reserved, must be zero */
  229.     u32 interrupt_base;    /* Glocal interrupt for SAPIC start */
  230.     u64 address;        /* SAPIC physical address */
  231. };
  232.  
  233. struct madt_local_sapic {
  234.     APIC_HEADER_DEF u8 processor_id;    /* ACPI processor id */
  235.     u8 local_sapic_id;    /* SAPIC ID */
  236.     u8 local_sapic_eid;    /* SAPIC EID */
  237.     u8 reserved[3];        /* Reserved, must be zero */
  238.      LOCAL_APIC_FLAGS u32 processor_uID;    /* Numeric UID - ACPI 3.0 */
  239.     char processor_uIDstring[1];    /* String UID  - ACPI 3.0 */
  240. };
  241.  
  242. struct madt_interrupt_source {
  243.     APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type;    /* 1=PMI, 2=INIT, 3=corrected */
  244.     u8 processor_id;    /* Processor ID */
  245.     u8 processor_eid;    /* Processor EID */
  246.     u8 io_sapic_vector;    /* Vector value for PMI interrupts */
  247.     u32 interrupt;        /* Global system interrupt */
  248.     u32 flags;        /* Interrupt Source Flags */
  249. };
  250.  
  251. /*
  252.  * Smart Battery
  253.  */
  254. struct smart_battery_table {
  255.     ACPI_TABLE_HEADER_DEF u32 warning_level;
  256.     u32 low_level;
  257.     u32 critical_level;
  258. };
  259.  
  260. #pragma pack()
  261.  
  262. /*
  263.  * ACPI Table information.  We save the table address, length,
  264.  * and type of memory allocation (mapped or allocated) for each
  265.  * table for 1) when we exit, and 2) if a new table is installed
  266.  */
  267. #define ACPI_MEM_NOT_ALLOCATED  0
  268. #define ACPI_MEM_ALLOCATED      1
  269. #define ACPI_MEM_MAPPED         2
  270.  
  271. /* Definitions for the Flags bitfield member of struct acpi_table_support */
  272.  
  273. #define ACPI_TABLE_SINGLE       0x00
  274. #define ACPI_TABLE_MULTIPLE     0x01
  275. #define ACPI_TABLE_EXECUTABLE   0x02
  276.  
  277. #define ACPI_TABLE_ROOT         0x00
  278. #define ACPI_TABLE_PRIMARY      0x10
  279. #define ACPI_TABLE_SECONDARY    0x20
  280. #define ACPI_TABLE_ALL          0x30
  281. #define ACPI_TABLE_TYPE_MASK    0x30
  282.  
  283. /* Data about each known table type */
  284.  
  285. struct acpi_table_support {
  286.     char *name;
  287.     char *signature;
  288.     void **global_ptr;
  289.     u8 sig_length;
  290.     u8 flags;
  291. };
  292.  
  293. /*
  294.  * Get the ACPI version-specific tables
  295.  */
  296. #include "actbl1.h"        /* Acpi 1.0 table definitions */
  297. #include "actbl2.h"        /* Acpi 2.0 table definitions */
  298.  
  299. extern u8 acpi_fadt_is_v1;    /* is set to 1 if FADT is revision 1,
  300.                  * needed for certain workarounds */
  301.  
  302. #pragma pack(1)
  303. /*
  304.  * High performance timer
  305.  */
  306. struct hpet_table {
  307.     ACPI_TABLE_HEADER_DEF u32 hardware_id;
  308.     struct acpi_generic_address base_address;
  309.     u8 hpet_number;
  310.     u16 clock_tick;
  311.     u8 attributes;
  312. };
  313.  
  314. #pragma pack()
  315.  
  316. #endif                /* __ACTBL_H__ */
  317.