xref: /openbmc/linux/include/acpi/actbl3.h (revision 65ee8aeb)
1 /******************************************************************************
2  *
3  * Name: actbl3.h - ACPI Table Definitions
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2015, 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_MATR           "MATR"	/* Memory Address Translation Table */
79 #define ACPI_SIG_MSDM           "MSDM"	/* Microsoft Data Management Table */
80 #define ACPI_SIG_WPBT           "WPBT"	/* Windows Platform Binary Table */
81 
82 /*
83  * All tables must be byte-packed to match the ACPI specification, since
84  * the tables are provided by the system BIOS.
85  */
86 #pragma pack(1)
87 
88 /*
89  * Note: C bitfields are not used for this reason:
90  *
91  * "Bitfields are great and easy to read, but unfortunately the C language
92  * does not specify the layout of bitfields in memory, which means they are
93  * essentially useless for dealing with packed data in on-disk formats or
94  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
95  * this decision was a design error in C. Ritchie could have picked an order
96  * and stuck with it." Norman Ramsey.
97  * See http://stackoverflow.com/a/1053662/41661
98  */
99 
100 /*******************************************************************************
101  *
102  * BGRT - Boot Graphics Resource Table (ACPI 5.0)
103  *        Version 1
104  *
105  ******************************************************************************/
106 
107 struct acpi_table_bgrt {
108 	struct acpi_table_header header;	/* Common ACPI table header */
109 	u16 version;
110 	u8 status;
111 	u8 image_type;
112 	u64 image_address;
113 	u32 image_offset_x;
114 	u32 image_offset_y;
115 };
116 
117 /*******************************************************************************
118  *
119  * DRTM - Dynamic Root of Trust for Measurement table
120  *
121  ******************************************************************************/
122 
123 struct acpi_table_drtm {
124 	struct acpi_table_header header;	/* Common ACPI table header */
125 	u64 entry_base_address;
126 	u64 entry_length;
127 	u32 entry_address32;
128 	u64 entry_address64;
129 	u64 exit_address;
130 	u64 log_area_address;
131 	u32 log_area_length;
132 	u64 arch_dependent_address;
133 	u32 flags;
134 };
135 
136 /* 1) Validated Tables List */
137 
138 struct acpi_drtm_vtl_list {
139 	u32 validated_table_list_count;
140 };
141 
142 /* 2) Resources List */
143 
144 struct acpi_drtm_resource_list {
145 	u32 resource_list_count;
146 };
147 
148 /* 3) Platform-specific Identifiers List */
149 
150 struct acpi_drtm_id_list {
151 	u32 id_list_count;
152 };
153 
154 /*******************************************************************************
155  *
156  * FPDT - Firmware Performance Data Table (ACPI 5.0)
157  *        Version 1
158  *
159  ******************************************************************************/
160 
161 struct acpi_table_fpdt {
162 	struct acpi_table_header header;	/* Common ACPI table header */
163 };
164 
165 /* FPDT subtable header */
166 
167 struct acpi_fpdt_header {
168 	u16 type;
169 	u8 length;
170 	u8 revision;
171 };
172 
173 /* Values for Type field above */
174 
175 enum acpi_fpdt_type {
176 	ACPI_FPDT_TYPE_BOOT = 0,
177 	ACPI_FPDT_TYPE_S3PERF = 1
178 };
179 
180 /*
181  * FPDT subtables
182  */
183 
184 /* 0: Firmware Basic Boot Performance Record */
185 
186 struct acpi_fpdt_boot {
187 	struct acpi_fpdt_header header;
188 	u8 reserved[4];
189 	u64 reset_end;
190 	u64 load_start;
191 	u64 startup_start;
192 	u64 exit_services_entry;
193 	u64 exit_services_exit;
194 };
195 
196 /* 1: S3 Performance Table Pointer Record */
197 
198 struct acpi_fpdt_s3pt_ptr {
199 	struct acpi_fpdt_header header;
200 	u8 reserved[4];
201 	u64 address;
202 };
203 
204 /*
205  * S3PT - S3 Performance Table. This table is pointed to by the
206  * FPDT S3 Pointer Record above.
207  */
208 struct acpi_table_s3pt {
209 	u8 signature[4];	/* "S3PT" */
210 	u32 length;
211 };
212 
213 /*
214  * S3PT Subtables
215  */
216 struct acpi_s3pt_header {
217 	u16 type;
218 	u8 length;
219 	u8 revision;
220 };
221 
222 /* Values for Type field above */
223 
224 enum acpi_s3pt_type {
225 	ACPI_S3PT_TYPE_RESUME = 0,
226 	ACPI_S3PT_TYPE_SUSPEND = 1
227 };
228 
229 struct acpi_s3pt_resume {
230 	struct acpi_s3pt_header header;
231 	u32 resume_count;
232 	u64 full_resume;
233 	u64 average_resume;
234 };
235 
236 struct acpi_s3pt_suspend {
237 	struct acpi_s3pt_header header;
238 	u64 suspend_start;
239 	u64 suspend_end;
240 };
241 
242 /*******************************************************************************
243  *
244  * GTDT - Generic Timer Description Table (ACPI 5.1)
245  *        Version 2
246  *
247  ******************************************************************************/
248 
249 struct acpi_table_gtdt {
250 	struct acpi_table_header header;	/* Common ACPI table header */
251 	u64 counter_block_addresss;
252 	u32 reserved;
253 	u32 secure_el1_interrupt;
254 	u32 secure_el1_flags;
255 	u32 non_secure_el1_interrupt;
256 	u32 non_secure_el1_flags;
257 	u32 virtual_timer_interrupt;
258 	u32 virtual_timer_flags;
259 	u32 non_secure_el2_interrupt;
260 	u32 non_secure_el2_flags;
261 	u64 counter_read_block_address;
262 	u32 platform_timer_count;
263 	u32 platform_timer_offset;
264 };
265 
266 /* Flag Definitions: Timer Block Physical Timers and Virtual timers */
267 
268 #define ACPI_GTDT_INTERRUPT_MODE        (1)
269 #define ACPI_GTDT_INTERRUPT_POLARITY    (1<<1)
270 #define ACPI_GTDT_ALWAYS_ON             (1<<2)
271 
272 /* Common GTDT subtable header */
273 
274 struct acpi_gtdt_header {
275 	u8 type;
276 	u16 length;
277 };
278 
279 /* Values for GTDT subtable type above */
280 
281 enum acpi_gtdt_type {
282 	ACPI_GTDT_TYPE_TIMER_BLOCK = 0,
283 	ACPI_GTDT_TYPE_WATCHDOG = 1,
284 	ACPI_GTDT_TYPE_RESERVED = 2	/* 2 and greater are reserved */
285 };
286 
287 /* GTDT Subtables, correspond to Type in struct acpi_gtdt_header */
288 
289 /* 0: Generic Timer Block */
290 
291 struct acpi_gtdt_timer_block {
292 	struct acpi_gtdt_header header;
293 	u8 reserved;
294 	u64 block_address;
295 	u32 timer_count;
296 	u32 timer_offset;
297 };
298 
299 /* Timer Sub-Structure, one per timer */
300 
301 struct acpi_gtdt_timer_entry {
302 	u8 frame_number;
303 	u8 reserved[3];
304 	u64 base_address;
305 	u64 el0_base_address;
306 	u32 timer_interrupt;
307 	u32 timer_flags;
308 	u32 virtual_timer_interrupt;
309 	u32 virtual_timer_flags;
310 	u32 common_flags;
311 };
312 
313 /* Flag Definitions: timer_flags and virtual_timer_flags above */
314 
315 #define ACPI_GTDT_GT_IRQ_MODE               (1)
316 #define ACPI_GTDT_GT_IRQ_POLARITY           (1<<1)
317 
318 /* Flag Definitions: common_flags above */
319 
320 #define ACPI_GTDT_GT_IS_SECURE_TIMER        (1)
321 #define ACPI_GTDT_GT_ALWAYS_ON              (1<<1)
322 
323 /* 1: SBSA Generic Watchdog Structure */
324 
325 struct acpi_gtdt_watchdog {
326 	struct acpi_gtdt_header header;
327 	u8 reserved;
328 	u64 refresh_frame_address;
329 	u64 control_frame_address;
330 	u32 timer_interrupt;
331 	u32 timer_flags;
332 };
333 
334 /* Flag Definitions: timer_flags above */
335 
336 #define ACPI_GTDT_WATCHDOG_IRQ_MODE         (1)
337 #define ACPI_GTDT_WATCHDOG_IRQ_POLARITY     (1<<1)
338 #define ACPI_GTDT_WATCHDOG_SECURE           (1<<2)
339 
340 /*******************************************************************************
341  *
342  * MPST - Memory Power State Table (ACPI 5.0)
343  *        Version 1
344  *
345  ******************************************************************************/
346 
347 #define ACPI_MPST_CHANNEL_INFO \
348 	u8                              channel_id; \
349 	u8                              reserved1[3]; \
350 	u16                             power_node_count; \
351 	u16                             reserved2;
352 
353 /* Main table */
354 
355 struct acpi_table_mpst {
356 	struct acpi_table_header header;	/* Common ACPI table header */
357 	 ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
358 };
359 
360 /* Memory Platform Communication Channel Info */
361 
362 struct acpi_mpst_channel {
363 	ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
364 };
365 
366 /* Memory Power Node Structure */
367 
368 struct acpi_mpst_power_node {
369 	u8 flags;
370 	u8 reserved1;
371 	u16 node_id;
372 	u32 length;
373 	u64 range_address;
374 	u64 range_length;
375 	u32 num_power_states;
376 	u32 num_physical_components;
377 };
378 
379 /* Values for Flags field above */
380 
381 #define ACPI_MPST_ENABLED               1
382 #define ACPI_MPST_POWER_MANAGED         2
383 #define ACPI_MPST_HOT_PLUG_CAPABLE      4
384 
385 /* Memory Power State Structure (follows POWER_NODE above) */
386 
387 struct acpi_mpst_power_state {
388 	u8 power_state;
389 	u8 info_index;
390 };
391 
392 /* Physical Component ID Structure (follows POWER_STATE above) */
393 
394 struct acpi_mpst_component {
395 	u16 component_id;
396 };
397 
398 /* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
399 
400 struct acpi_mpst_data_hdr {
401 	u16 characteristics_count;
402 	u16 reserved;
403 };
404 
405 struct acpi_mpst_power_data {
406 	u8 structure_id;
407 	u8 flags;
408 	u16 reserved1;
409 	u32 average_power;
410 	u32 power_saving;
411 	u64 exit_latency;
412 	u64 reserved2;
413 };
414 
415 /* Values for Flags field above */
416 
417 #define ACPI_MPST_PRESERVE              1
418 #define ACPI_MPST_AUTOENTRY             2
419 #define ACPI_MPST_AUTOEXIT              4
420 
421 /* Shared Memory Region (not part of an ACPI table) */
422 
423 struct acpi_mpst_shared {
424 	u32 signature;
425 	u16 pcc_command;
426 	u16 pcc_status;
427 	u32 command_register;
428 	u32 status_register;
429 	u32 power_state_id;
430 	u32 power_node_id;
431 	u64 energy_consumed;
432 	u64 average_power;
433 };
434 
435 /*******************************************************************************
436  *
437  * PCCT - Platform Communications Channel Table (ACPI 5.0)
438  *        Version 1
439  *
440  ******************************************************************************/
441 
442 struct acpi_table_pcct {
443 	struct acpi_table_header header;	/* Common ACPI table header */
444 	u32 flags;
445 	u64 reserved;
446 };
447 
448 /* Values for Flags field above */
449 
450 #define ACPI_PCCT_DOORBELL              1
451 
452 /* Values for subtable type in struct acpi_subtable_header */
453 
454 enum acpi_pcct_type {
455 	ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0,
456 	ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1,
457 	ACPI_PCCT_TYPE_RESERVED = 2	/* 2 and greater are reserved */
458 };
459 
460 /*
461  * PCCT Subtables, correspond to Type in struct acpi_subtable_header
462  */
463 
464 /* 0: Generic Communications Subspace */
465 
466 struct acpi_pcct_subspace {
467 	struct acpi_subtable_header header;
468 	u8 reserved[6];
469 	u64 base_address;
470 	u64 length;
471 	struct acpi_generic_address doorbell_register;
472 	u64 preserve_mask;
473 	u64 write_mask;
474 	u32 latency;
475 	u32 max_access_rate;
476 	u16 min_turnaround_time;
477 };
478 
479 /* 1: HW-reduced Communications Subspace (ACPI 5.1) */
480 
481 struct acpi_pcct_hw_reduced {
482 	struct acpi_subtable_header header;
483 	u32 doorbell_interrupt;
484 	u8 flags;
485 	u8 reserved;
486 	u64 base_address;
487 	u64 length;
488 	struct acpi_generic_address doorbell_register;
489 	u64 preserve_mask;
490 	u64 write_mask;
491 	u32 latency;
492 	u32 max_access_rate;
493 	u16 min_turnaround_time;
494 };
495 
496 /* Values for doorbell flags above */
497 
498 #define ACPI_PCCT_INTERRUPT_POLARITY    (1)
499 #define ACPI_PCCT_INTERRUPT_MODE        (1<<1)
500 
501 /*
502  * PCC memory structures (not part of the ACPI table)
503  */
504 
505 /* Shared Memory Region */
506 
507 struct acpi_pcct_shared_memory {
508 	u32 signature;
509 	u16 command;
510 	u16 status;
511 };
512 
513 /*******************************************************************************
514  *
515  * PMTT - Platform Memory Topology Table (ACPI 5.0)
516  *        Version 1
517  *
518  ******************************************************************************/
519 
520 struct acpi_table_pmtt {
521 	struct acpi_table_header header;	/* Common ACPI table header */
522 	u32 reserved;
523 };
524 
525 /* Common header for PMTT subtables that follow main table */
526 
527 struct acpi_pmtt_header {
528 	u8 type;
529 	u8 reserved1;
530 	u16 length;
531 	u16 flags;
532 	u16 reserved2;
533 };
534 
535 /* Values for Type field above */
536 
537 #define ACPI_PMTT_TYPE_SOCKET           0
538 #define ACPI_PMTT_TYPE_CONTROLLER       1
539 #define ACPI_PMTT_TYPE_DIMM             2
540 #define ACPI_PMTT_TYPE_RESERVED         3	/* 0x03-0xFF are reserved */
541 
542 /* Values for Flags field above */
543 
544 #define ACPI_PMTT_TOP_LEVEL             0x0001
545 #define ACPI_PMTT_PHYSICAL              0x0002
546 #define ACPI_PMTT_MEMORY_TYPE           0x000C
547 
548 /*
549  * PMTT subtables, correspond to Type in struct acpi_pmtt_header
550  */
551 
552 /* 0: Socket Structure */
553 
554 struct acpi_pmtt_socket {
555 	struct acpi_pmtt_header header;
556 	u16 socket_id;
557 	u16 reserved;
558 };
559 
560 /* 1: Memory Controller subtable */
561 
562 struct acpi_pmtt_controller {
563 	struct acpi_pmtt_header header;
564 	u32 read_latency;
565 	u32 write_latency;
566 	u32 read_bandwidth;
567 	u32 write_bandwidth;
568 	u16 access_width;
569 	u16 alignment;
570 	u16 reserved;
571 	u16 domain_count;
572 };
573 
574 /* 1a: Proximity Domain substructure */
575 
576 struct acpi_pmtt_domain {
577 	u32 proximity_domain;
578 };
579 
580 /* 2: Physical Component Identifier (DIMM) */
581 
582 struct acpi_pmtt_physical_component {
583 	struct acpi_pmtt_header header;
584 	u16 component_id;
585 	u16 reserved;
586 	u32 memory_size;
587 	u32 bios_handle;
588 };
589 
590 /*******************************************************************************
591  *
592  * RASF - RAS Feature Table (ACPI 5.0)
593  *        Version 1
594  *
595  ******************************************************************************/
596 
597 struct acpi_table_rasf {
598 	struct acpi_table_header header;	/* Common ACPI table header */
599 	u8 channel_id[12];
600 };
601 
602 /* RASF Platform Communication Channel Shared Memory Region */
603 
604 struct acpi_rasf_shared_memory {
605 	u32 signature;
606 	u16 command;
607 	u16 status;
608 	u16 version;
609 	u8 capabilities[16];
610 	u8 set_capabilities[16];
611 	u16 num_parameter_blocks;
612 	u32 set_capabilities_status;
613 };
614 
615 /* RASF Parameter Block Structure Header */
616 
617 struct acpi_rasf_parameter_block {
618 	u16 type;
619 	u16 version;
620 	u16 length;
621 };
622 
623 /* RASF Parameter Block Structure for PATROL_SCRUB */
624 
625 struct acpi_rasf_patrol_scrub_parameter {
626 	struct acpi_rasf_parameter_block header;
627 	u16 patrol_scrub_command;
628 	u64 requested_address_range[2];
629 	u64 actual_address_range[2];
630 	u16 flags;
631 	u8 requested_speed;
632 };
633 
634 /* Masks for Flags and Speed fields above */
635 
636 #define ACPI_RASF_SCRUBBER_RUNNING      1
637 #define ACPI_RASF_SPEED                 (7<<1)
638 #define ACPI_RASF_SPEED_SLOW            (0<<1)
639 #define ACPI_RASF_SPEED_MEDIUM          (4<<1)
640 #define ACPI_RASF_SPEED_FAST            (7<<1)
641 
642 /* Channel Commands */
643 
644 enum acpi_rasf_commands {
645 	ACPI_RASF_EXECUTE_RASF_COMMAND = 1
646 };
647 
648 /* Platform RAS Capabilities */
649 
650 enum acpi_rasf_capabiliities {
651 	ACPI_HW_PATROL_SCRUB_SUPPORTED = 0,
652 	ACPI_SW_PATROL_SCRUB_EXPOSED = 1
653 };
654 
655 /* Patrol Scrub Commands */
656 
657 enum acpi_rasf_patrol_scrub_commands {
658 	ACPI_RASF_GET_PATROL_PARAMETERS = 1,
659 	ACPI_RASF_START_PATROL_SCRUBBER = 2,
660 	ACPI_RASF_STOP_PATROL_SCRUBBER = 3
661 };
662 
663 /* Channel Command flags */
664 
665 #define ACPI_RASF_GENERATE_SCI          (1<<15)
666 
667 /* Status values */
668 
669 enum acpi_rasf_status {
670 	ACPI_RASF_SUCCESS = 0,
671 	ACPI_RASF_NOT_VALID = 1,
672 	ACPI_RASF_NOT_SUPPORTED = 2,
673 	ACPI_RASF_BUSY = 3,
674 	ACPI_RASF_FAILED = 4,
675 	ACPI_RASF_ABORTED = 5,
676 	ACPI_RASF_INVALID_DATA = 6
677 };
678 
679 /* Status flags */
680 
681 #define ACPI_RASF_COMMAND_COMPLETE      (1)
682 #define ACPI_RASF_SCI_DOORBELL          (1<<1)
683 #define ACPI_RASF_ERROR                 (1<<2)
684 #define ACPI_RASF_STATUS                (0x1F<<3)
685 
686 /*******************************************************************************
687  *
688  * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
689  *        Version 3
690  *
691  * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011
692  *
693  ******************************************************************************/
694 
695 struct acpi_table_tpm2 {
696 	struct acpi_table_header header;	/* Common ACPI table header */
697 	u32 flags;
698 	u64 control_address;
699 	u32 start_method;
700 };
701 
702 /* Control area structure (not part of table, pointed to by control_address) */
703 
704 struct acpi_tpm2_control {
705 	u32 reserved;
706 	u32 error;
707 	u32 cancel;
708 	u32 start;
709 	u64 interrupt_control;
710 	u32 command_size;
711 	u64 command_address;
712 	u32 response_size;
713 	u64 response_address;
714 };
715 
716 /* Reset to default packing */
717 
718 #pragma pack()
719 
720 #endif				/* __ACTBL3_H__ */
721