linux-old/arch/i386/kernel/acpitable.h
<<
>>
Prefs
   1/*
   2 *  acpitable.c - IA32-specific ACPI boot-time initialization (Revision: 1)
   3 *
   4 *  Copyright (C) 1999 Andrew Henroid
   5 *  Copyright (C) 2001 Richard Schaal
   6 *  Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
   7 *  Copyright (C) 2001 Jun Nakajima <jun.nakajima@intel.com>
   8 *  Copyright (C) 2001 Arjan van de Ven <arjanv@redhat.com>
   9 *
  10 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  11 *
  12 *  This program is free software; you can redistribute it and/or modify
  13 *  it under the terms of the GNU General Public License as published by
  14 *  the Free Software Foundation; either version 2 of the License, or
  15 *  (at your option) any later version.
  16 *
  17 *  This program is distributed in the hope that it will be useful,
  18 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  19 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20 *  GNU General Public License for more details.
  21 *
  22 *  You should have received a copy of the GNU General Public License
  23 *  along with this program; if not, write to the Free Software
  24 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  25 *
  26 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  27 *
  28 * $Id: acpitable.h,v 1.3 2001/11/03 22:41:34 fenrus Exp $
  29 */
  30
  31/*
  32 * The following codes are cut&pasted from drivers/acpi. Part of the code
  33 * there can be not updated or delivered yet.
  34 * To avoid conflicts when CONFIG_ACPI is defined, the following codes are
  35 * modified so that they are self-contained in this file.
  36 * -- jun
  37 */
  38 
  39#ifndef _HEADER_ACPITABLE_H_
  40#define _HEADER_ACPITABLE_H_
  41
  42#define dprintk printk
  43typedef unsigned int ACPI_TBLPTR;
  44
  45typedef struct {                /* ACPI common table header */
  46        char signature[4];      /* identifies type of table */
  47        u32 length;             /* length of table,
  48                                   in bytes, * including header */
  49        u8 revision;            /* specification minor version # */
  50        u8 checksum;            /* to make sum of entire table == 0 */
  51        char oem_id[6];         /* OEM identification */
  52        char oem_table_id[8];   /* OEM table identification */
  53        u32 oem_revision;       /* OEM revision number */
  54        char asl_compiler_id[4];        /* ASL compiler vendor ID */
  55        u32 asl_compiler_revision;      /* ASL compiler revision number */
  56} acpi_table_header __attribute__ ((packed));;
  57
  58enum {
  59        ACPI_APIC = 0,
  60        ACPI_BOOT,
  61        ACPI_DBGP,
  62        ACPI_DSDT,
  63        ACPI_ECDT,
  64        ACPI_ETDT,
  65        ACPI_FACP,
  66        ACPI_FACS,
  67        ACPI_OEMX,
  68        ACPI_PSDT,
  69        ACPI_SBST,
  70        ACPI_SLIT,
  71        ACPI_SPCR,
  72        ACPI_SRAT,
  73        ACPI_SSDT,
  74        ACPI_SPMI,
  75        ACPI_XSDT,
  76        ACPI_TABLE_COUNT
  77};
  78
  79static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
  80        "APIC",
  81        "BOOT",
  82        "DBGP",
  83        "DSDT",
  84        "ECDT",
  85        "ETDT",
  86        "FACP",
  87        "FACS",
  88        "OEM",
  89        "PSDT",
  90        "SBST",
  91        "SLIT",
  92        "SPCR",
  93        "SRAT",
  94        "SSDT",
  95        "SPMI",
  96        "XSDT"
  97};
  98
  99struct acpi_table_madt {
 100        acpi_table_header header;
 101        u32 lapic_address;
 102        struct {
 103                u32 pcat_compat:1;
 104                u32 reserved:31;
 105        } flags __attribute__ ((packed));
 106} __attribute__ ((packed));;
 107
 108enum {
 109        ACPI_MADT_LAPIC = 0,
 110        ACPI_MADT_IOAPIC,
 111        ACPI_MADT_INT_SRC_OVR,
 112        ACPI_MADT_NMI_SRC,
 113        ACPI_MADT_LAPIC_NMI,
 114        ACPI_MADT_LAPIC_ADDR_OVR,
 115        ACPI_MADT_IOSAPIC,
 116        ACPI_MADT_LSAPIC,
 117        ACPI_MADT_PLAT_INT_SRC,
 118        ACPI_MADT_ENTRY_COUNT
 119};
 120
 121#define RSDP_SIG                        "RSD PTR "
 122#define RSDT_SIG                        "RSDT"
 123
 124#define ACPI_DEBUG_PRINT(pl)
 125
 126#define ACPI_MEMORY_MODE                0x01
 127#define ACPI_LOGICAL_ADDRESSING         0x00
 128#define ACPI_PHYSICAL_ADDRESSING        0x01
 129
 130#define LO_RSDP_WINDOW_BASE             0       /* Physical Address */
 131#define HI_RSDP_WINDOW_BASE             0xE0000 /* Physical Address */
 132#define LO_RSDP_WINDOW_SIZE             0x400
 133#define HI_RSDP_WINDOW_SIZE             0x20000
 134#define RSDP_SCAN_STEP                  16
 135#define RSDP_CHECKSUM_LENGTH            20
 136
 137typedef int (*acpi_table_handler) (acpi_table_header * header, unsigned long);
 138
 139struct acpi_table_rsdp {
 140        char signature[8];
 141        u8 checksum;
 142        char oem_id[6];
 143        u8 revision;
 144        u32 rsdt_address;
 145} __attribute__ ((packed));
 146
 147struct acpi_table_rsdt {
 148        acpi_table_header header;
 149        u32 entry[ACPI_TABLE_COUNT];
 150} __attribute__ ((packed));
 151
 152typedef struct {
 153        u8 type;
 154        u8 length;
 155} acpi_madt_entry_header __attribute__ ((packed));
 156
 157typedef struct {
 158        u16 polarity:2;
 159        u16 trigger:2;
 160        u16 reserved:12;
 161} acpi_madt_int_flags __attribute__ ((packed));
 162
 163struct acpi_table_lapic {
 164        acpi_madt_entry_header header;
 165        u8 acpi_id;
 166        u8 id;
 167        struct {
 168                u32 enabled:1;
 169                u32 reserved:31;
 170        } flags __attribute__ ((packed));
 171} __attribute__ ((packed));
 172
 173struct acpi_table_ioapic {
 174        acpi_madt_entry_header header;
 175        u8 id;
 176        u8 reserved;
 177        u32 address;
 178        u32 global_irq_base;
 179} __attribute__ ((packed));
 180
 181struct acpi_table_int_src_ovr {
 182        acpi_madt_entry_header header;
 183        u8 bus;
 184        u8 bus_irq;
 185        u32 global_irq;
 186        acpi_madt_int_flags flags;
 187} __attribute__ ((packed));
 188
 189struct acpi_table_nmi_src {
 190        acpi_madt_entry_header header;
 191        acpi_madt_int_flags flags;
 192        u32 global_irq;
 193} __attribute__ ((packed));
 194
 195struct acpi_table_lapic_nmi {
 196        acpi_madt_entry_header header;
 197        u8 acpi_id;
 198        acpi_madt_int_flags flags;
 199        u8 lint;
 200} __attribute__ ((packed));
 201
 202struct acpi_table_lapic_addr_ovr {
 203        acpi_madt_entry_header header;
 204        u8 reserved[2];
 205        u64 address;
 206} __attribute__ ((packed));
 207
 208struct acpi_table_iosapic {
 209        acpi_madt_entry_header header;
 210        u8 id;
 211        u8 reserved;
 212        u32 global_irq_base;
 213        u64 address;
 214} __attribute__ ((packed));
 215
 216struct acpi_table_lsapic {
 217        acpi_madt_entry_header header;
 218        u8 acpi_id;
 219        u8 id;
 220        u8 eid;
 221        u8 reserved[3];
 222        struct {
 223                u32 enabled:1;
 224                u32 reserved:31;
 225        } flags;
 226} __attribute__ ((packed));
 227
 228struct acpi_table_plat_int_src {
 229        acpi_madt_entry_header header;
 230        acpi_madt_int_flags flags;
 231        u8 type;
 232        u8 id;
 233        u8 eid;
 234        u8 iosapic_vector;
 235        u32 global_irq;
 236        u32 reserved;
 237} __attribute__ ((packed));
 238
 239/*
 240 * ACPI Table Descriptor.  One per ACPI table
 241 */
 242typedef struct acpi_table_desc {
 243        struct acpi_table_desc *prev;
 244        struct acpi_table_desc *next;
 245        struct acpi_table_desc *installed_desc;
 246        acpi_table_header *pointer;
 247        void *base_pointer;
 248        u8 *aml_pointer;
 249        u64 physical_address;
 250        u32 aml_length;
 251        u32 length;
 252        u32 count;
 253        u16 table_id;
 254        u8 type;
 255        u8 allocation;
 256        u8 loaded_into_namespace;
 257
 258} acpi_table_desc __attribute__ ((packed));;
 259
 260#endif
 261
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.