]> Pileus Git - ~andy/linux/blob - include/acpi/actbl3.h
ACPICA: Add header file support for the ACPI 5 TPM2 ACPI table.
[~andy/linux] / include / acpi / actbl3.h
1 /******************************************************************************
2  *
3  * Name: actbl3.h - ACPI Table Definitions
4  *
5  *****************************************************************************/
6
7 /*
8  * Copyright (C) 2000 - 2012, Intel Corp.
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 __ACTBL3_H__
45 #define __ACTBL3_H__
46
47 /*******************************************************************************
48  *
49  * Additional ACPI Tables (3)
50  *
51  * These tables are not consumed directly by the ACPICA subsystem, but are
52  * included here to support device drivers and the AML disassembler.
53  *
54  * The tables in this file are fully defined within the ACPI specification.
55  *
56  ******************************************************************************/
57
58 /*
59  * Values for description table header signatures for tables defined in this
60  * file. Useful because they make it more difficult to inadvertently type in
61  * the wrong signature.
62  */
63 #define ACPI_SIG_BGRT           "BGRT"  /* Boot Graphics Resource Table */
64 #define ACPI_SIG_DRTM           "DRTM"  /* Dynamic Root of Trust for Measurement table */
65 #define ACPI_SIG_FPDT           "FPDT"  /* Firmware Performance Data Table */
66 #define ACPI_SIG_GTDT           "GTDT"  /* Generic Timer Description Table */
67 #define ACPI_SIG_MPST           "MPST"  /* Memory Power State Table */
68 #define ACPI_SIG_PCCT           "PCCT"  /* Platform Communications Channel Table */
69 #define ACPI_SIG_PMTT           "PMTT"  /* Platform Memory Topology Table */
70 #define ACPI_SIG_RASF           "RASF"  /* RAS Feature table */
71 #define ACPI_SIG_TPM2           "TPM2"  /* Trusted Platform Module 2.0 H/W interface table */
72
73 #define ACPI_SIG_S3PT           "S3PT"  /* S3 Performance (sub)Table */
74 #define ACPI_SIG_PCCS           "PCC"   /* PCC Shared Memory Region */
75
76 /* Reserved table signatures */
77
78 #define ACPI_SIG_CSRT           "CSRT"  /* Core System Resources Table */
79 #define ACPI_SIG_MATR           "MATR"  /* Memory Address Translation Table */
80 #define ACPI_SIG_MSDM           "MSDM"  /* Microsoft Data Management Table */
81 #define ACPI_SIG_WPBT           "WPBT"  /* Windows Platform Binary Table */
82
83 /*
84  * All tables must be byte-packed to match the ACPI specification, since
85  * the tables are provided by the system BIOS.
86  */
87 #pragma pack(1)
88
89 /*
90  * Note: C bitfields are not used for this reason:
91  *
92  * "Bitfields are great and easy to read, but unfortunately the C language
93  * does not specify the layout of bitfields in memory, which means they are
94  * essentially useless for dealing with packed data in on-disk formats or
95  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
96  * this decision was a design error in C. Ritchie could have picked an order
97  * and stuck with it." Norman Ramsey.
98  * See http://stackoverflow.com/a/1053662/41661
99  */
100
101 /*******************************************************************************
102  *
103  * BGRT - Boot Graphics Resource Table (ACPI 5.0)
104  *        Version 1
105  *
106  ******************************************************************************/
107
108 struct acpi_table_bgrt {
109         struct acpi_table_header header;        /* Common ACPI table header */
110         u16 version;
111         u8 status;
112         u8 image_type;
113         u64 image_address;
114         u32 image_offset_x;
115         u32 image_offset_y;
116 };
117
118 /*******************************************************************************
119  *
120  * DRTM - Dynamic Root of Trust for Measurement table
121  *
122  ******************************************************************************/
123
124 struct acpi_table_drtm {
125         struct acpi_table_header header;        /* Common ACPI table header */
126         u64 entry_base_address;
127         u64 entry_length;
128         u32 entry_address32;
129         u64 entry_address64;
130         u64 exit_address;
131         u64 log_area_address;
132         u32 log_area_length;
133         u64 arch_dependent_address;
134         u32 flags;
135 };
136
137 /* 1) Validated Tables List */
138
139 struct acpi_drtm_vtl_list {
140         u32 validated_table_list_count;
141 };
142
143 /* 2) Resources List */
144
145 struct acpi_drtm_resource_list {
146         u32 resource_list_count;
147 };
148
149 /* 3) Platform-specific Identifiers List */
150
151 struct acpi_drtm_id_list {
152         u32 id_list_count;
153 };
154
155 /*******************************************************************************
156  *
157  * FPDT - Firmware Performance Data Table (ACPI 5.0)
158  *        Version 1
159  *
160  ******************************************************************************/
161
162 struct acpi_table_fpdt {
163         struct acpi_table_header header;        /* Common ACPI table header */
164 };
165
166 /* FPDT subtable header */
167
168 struct acpi_fpdt_header {
169         u16 type;
170         u8 length;
171         u8 revision;
172 };
173
174 /* Values for Type field above */
175
176 enum acpi_fpdt_type {
177         ACPI_FPDT_TYPE_BOOT = 0,
178         ACPI_FPDT_TYPE_S3PERF = 1,
179 };
180
181 /*
182  * FPDT subtables
183  */
184
185 /* 0: Firmware Basic Boot Performance Record */
186
187 struct acpi_fpdt_boot {
188         struct acpi_fpdt_header header;
189         u8 reserved[4];
190         u64 reset_end;
191         u64 load_start;
192         u64 startup_start;
193         u64 exit_services_entry;
194         u64 exit_services_exit;
195 };
196
197 /* 1: S3 Performance Table Pointer Record */
198
199 struct acpi_fpdt_s3pt_ptr {
200         struct acpi_fpdt_header header;
201         u8 reserved[4];
202         u64 address;
203 };
204
205 /*
206  * S3PT - S3 Performance Table. This table is pointed to by the
207  * FPDT S3 Pointer Record above.
208  */
209 struct acpi_table_s3pt {
210         u8 signature[4];        /* "S3PT" */
211         u32 length;
212 };
213
214 /*
215  * S3PT Subtables
216  */
217 struct acpi_s3pt_header {
218         u16 type;
219         u8 length;
220         u8 revision;
221 };
222
223 /* Values for Type field above */
224
225 enum acpi_s3pt_type {
226         ACPI_S3PT_TYPE_RESUME = 0,
227         ACPI_S3PT_TYPE_SUSPEND = 1,
228 };
229
230 struct acpi_s3pt_resume {
231         struct acpi_s3pt_header header;
232         u32 resume_count;
233         u64 full_resume;
234         u64 average_resume;
235 };
236
237 struct acpi_s3pt_suspend {
238         struct acpi_s3pt_header header;
239         u64 suspend_start;
240         u64 suspend_end;
241 };
242
243 /*******************************************************************************
244  *
245  * GTDT - Generic Timer Description Table (ACPI 5.0)
246  *        Version 1
247  *
248  ******************************************************************************/
249
250 struct acpi_table_gtdt {
251         struct acpi_table_header header;        /* Common ACPI table header */
252         u64 address;
253         u32 flags;
254         u32 secure_pl1_interrupt;
255         u32 secure_pl1_flags;
256         u32 non_secure_pl1_interrupt;
257         u32 non_secure_pl1_flags;
258         u32 virtual_timer_interrupt;
259         u32 virtual_timer_flags;
260         u32 non_secure_pl2_interrupt;
261         u32 non_secure_pl2_flags;
262 };
263
264 /* Values for Flags field above */
265
266 #define ACPI_GTDT_MAPPED_BLOCK_PRESENT      1
267
268 /* Values for all "TimerFlags" fields above */
269
270 #define ACPI_GTDT_INTERRUPT_MODE            1
271 #define ACPI_GTDT_INTERRUPT_POLARITY        2
272
273 /*******************************************************************************
274  *
275  * MPST - Memory Power State Table (ACPI 5.0)
276  *        Version 1
277  *
278  ******************************************************************************/
279
280 #define ACPI_MPST_CHANNEL_INFO \
281         u8                              channel_id; \
282         u8                              reserved1[3]; \
283         u16                             power_node_count; \
284         u16                             reserved2;
285
286 /* Main table */
287
288 struct acpi_table_mpst {
289         struct acpi_table_header header;        /* Common ACPI table header */
290          ACPI_MPST_CHANNEL_INFO /* Platform Communication Channel */
291 };
292
293 /* Memory Platform Communication Channel Info */
294
295 struct acpi_mpst_channel {
296         ACPI_MPST_CHANNEL_INFO  /* Platform Communication Channel */
297 };
298
299 /* Memory Power Node Structure */
300
301 struct acpi_mpst_power_node {
302         u8 flags;
303         u8 reserved1;
304         u16 node_id;
305         u32 length;
306         u64 range_address;
307         u64 range_length;
308         u32 num_power_states;
309         u32 num_physical_components;
310 };
311
312 /* Values for Flags field above */
313
314 #define ACPI_MPST_ENABLED               1
315 #define ACPI_MPST_POWER_MANAGED         2
316 #define ACPI_MPST_HOT_PLUG_CAPABLE      4
317
318 /* Memory Power State Structure (follows POWER_NODE above) */
319
320 struct acpi_mpst_power_state {
321         u8 power_state;
322         u8 info_index;
323 };
324
325 /* Physical Component ID Structure (follows POWER_STATE above) */
326
327 struct acpi_mpst_component {
328         u16 component_id;
329 };
330
331 /* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
332
333 struct acpi_mpst_data_hdr {
334         u16 characteristics_count;
335         u16 reserved;
336 };
337
338 struct acpi_mpst_power_data {
339         u8 structure_id;
340         u8 flags;
341         u16 reserved1;
342         u32 average_power;
343         u32 power_saving;
344         u64 exit_latency;
345         u64 reserved2;
346 };
347
348 /* Values for Flags field above */
349
350 #define ACPI_MPST_PRESERVE              1
351 #define ACPI_MPST_AUTOENTRY             2
352 #define ACPI_MPST_AUTOEXIT              4
353
354 /* Shared Memory Region (not part of an ACPI table) */
355
356 struct acpi_mpst_shared {
357         u32 signature;
358         u16 pcc_command;
359         u16 pcc_status;
360         u32 command_register;
361         u32 status_register;
362         u32 power_state_id;
363         u32 power_node_id;
364         u64 energy_consumed;
365         u64 average_power;
366 };
367
368 /*******************************************************************************
369  *
370  * PCCT - Platform Communications Channel Table (ACPI 5.0)
371  *        Version 1
372  *
373  ******************************************************************************/
374
375 struct acpi_table_pcct {
376         struct acpi_table_header header;        /* Common ACPI table header */
377         u32 flags;
378         u32 latency;
379         u32 reserved;
380 };
381
382 /* Values for Flags field above */
383
384 #define ACPI_PCCT_DOORBELL              1
385
386 /*
387  * PCCT subtables
388  */
389
390 /* 0: Generic Communications Subspace */
391
392 struct acpi_pcct_subspace {
393         struct acpi_subtable_header header;
394         u8 reserved[6];
395         u64 base_address;
396         u64 length;
397         struct acpi_generic_address doorbell_register;
398         u64 preserve_mask;
399         u64 write_mask;
400 };
401
402 /*
403  * PCC memory structures (not part of the ACPI table)
404  */
405
406 /* Shared Memory Region */
407
408 struct acpi_pcct_shared_memory {
409         u32 signature;
410         u16 command;
411         u16 status;
412 };
413
414 /*******************************************************************************
415  *
416  * PMTT - Platform Memory Topology Table (ACPI 5.0)
417  *        Version 1
418  *
419  ******************************************************************************/
420
421 struct acpi_table_pmtt {
422         struct acpi_table_header header;        /* Common ACPI table header */
423         u32 reserved;
424 };
425
426 /* Common header for PMTT subtables that follow main table */
427
428 struct acpi_pmtt_header {
429         u8 type;
430         u8 reserved1;
431         u16 length;
432         u16 flags;
433         u16 reserved2;
434 };
435
436 /* Values for Type field above */
437
438 #define ACPI_PMTT_TYPE_SOCKET           0
439 #define ACPI_PMTT_TYPE_CONTROLLER       1
440 #define ACPI_PMTT_TYPE_DIMM             2
441 #define ACPI_PMTT_TYPE_RESERVED         3       /* 0x03-0xFF are reserved */
442
443 /* Values for Flags field above */
444
445 #define ACPI_PMTT_TOP_LEVEL             0x0001
446 #define ACPI_PMTT_PHYSICAL              0x0002
447 #define ACPI_PMTT_MEMORY_TYPE           0x000C
448
449 /*
450  * PMTT subtables, correspond to Type in struct acpi_pmtt_header
451  */
452
453 /* 0: Socket Structure */
454
455 struct acpi_pmtt_socket {
456         struct acpi_pmtt_header header;
457         u16 socket_id;
458         u16 reserved;
459 };
460
461 /* 1: Memory Controller subtable */
462
463 struct acpi_pmtt_controller {
464         struct acpi_pmtt_header header;
465         u32 read_latency;
466         u32 write_latency;
467         u32 read_bandwidth;
468         u32 write_bandwidth;
469         u16 access_width;
470         u16 alignment;
471         u16 reserved;
472         u16 domain_count;
473 };
474
475 /* 1a: Proximity Domain substructure */
476
477 struct acpi_pmtt_domain {
478         u32 proximity_domain;
479 };
480
481 /* 2: Physical Component Identifier (DIMM) */
482
483 struct acpi_pmtt_physical_component {
484         struct acpi_pmtt_header header;
485         u16 component_id;
486         u16 reserved;
487         u32 memory_size;
488         u32 bios_handle;
489 };
490
491 /*******************************************************************************
492  *
493  * RASF - RAS Feature Table (ACPI 5.0)
494  *        Version 1
495  *
496  ******************************************************************************/
497
498 struct acpi_table_rasf {
499         struct acpi_table_header header;        /* Common ACPI table header */
500         u8 channel_id[12];
501 };
502
503 /* RASF Platform Communication Channel Shared Memory Region */
504
505 struct acpi_rasf_shared_memory {
506         u32 signature;
507         u16 command;
508         u16 status;
509         u64 requested_address;
510         u64 requested_length;
511         u64 actual_address;
512         u64 actual_length;
513         u16 flags;
514         u8 speed;
515 };
516
517 /* Masks for Flags and Speed fields above */
518
519 #define ACPI_RASF_SCRUBBER_RUNNING      1
520 #define ACPI_RASF_SPEED                 (7<<1)
521
522 /* Channel Commands */
523
524 enum acpi_rasf_commands {
525         ACPI_RASF_GET_RAS_CAPABILITIES = 1,
526         ACPI_RASF_GET_PATROL_PARAMETERS = 2,
527         ACPI_RASF_START_PATROL_SCRUBBER = 3,
528         ACPI_RASF_STOP_PATROL_SCRUBBER = 4
529 };
530
531 /* Channel Command flags */
532
533 #define ACPI_RASF_GENERATE_SCI          (1<<15)
534
535 /* Status values */
536
537 enum acpi_rasf_status {
538         ACPI_RASF_SUCCESS = 0,
539         ACPI_RASF_NOT_VALID = 1,
540         ACPI_RASF_NOT_SUPPORTED = 2,
541         ACPI_RASF_BUSY = 3,
542         ACPI_RASF_FAILED = 4,
543         ACPI_RASF_ABORTED = 5,
544         ACPI_RASF_INVALID_DATA = 6
545 };
546
547 /* Status flags */
548
549 #define ACPI_RASF_COMMAND_COMPLETE      (1)
550 #define ACPI_RASF_SCI_DOORBELL          (1<<1)
551 #define ACPI_RASF_ERROR                 (1<<2)
552 #define ACPI_RASF_STATUS                (0x1F<<3)
553
554 /*******************************************************************************
555  *
556  * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
557  *        Version 3
558  *
559  * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011
560  *
561  ******************************************************************************/
562
563 struct acpi_table_tpm2 {
564         struct acpi_table_header header;        /* Common ACPI table header */
565         u32 flags;
566         u64 control_address;
567         u32 start_method;
568 };
569
570 /* Control area structure (not part of table, pointed to by control_address) */
571
572 struct acpi_tpm2_control {
573         u32 reserved;
574         u32 error;
575         u32 cancel;
576         u32 start;
577         u64 interrupt_control;
578         u32 command_size;
579         u64 command_address;
580         u32 response_size;
581         u64 response_address;
582 };
583
584 /* Reset to default packing */
585
586 #pragma pack()
587
588 #endif                          /* __ACTBL3_H__ */