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_STAO           "STAO" /* Status Override 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.1)
246  *        Version 2
247  *
248  ******************************************************************************/
249 
250 struct acpi_table_gtdt {
251 	struct acpi_table_header header;	/* Common ACPI table header */
252 	u64 counter_block_addresss;
253 	u32 reserved;
254 	u32 secure_el1_interrupt;
255 	u32 secure_el1_flags;
256 	u32 non_secure_el1_interrupt;
257 	u32 non_secure_el1_flags;
258 	u32 virtual_timer_interrupt;
259 	u32 virtual_timer_flags;
260 	u32 non_secure_el2_interrupt;
261 	u32 non_secure_el2_flags;
262 	u64 counter_read_block_address;
263 	u32 platform_timer_count;
264 	u32 platform_timer_offset;
265 };
266 
267 /* Flag Definitions: Timer Block Physical Timers and Virtual timers */
268 
269 #define ACPI_GTDT_INTERRUPT_MODE        (1)
270 #define ACPI_GTDT_INTERRUPT_POLARITY    (1<<1)
271 #define ACPI_GTDT_ALWAYS_ON             (1<<2)
272 
273 /* Common GTDT subtable header */
274 
275 struct acpi_gtdt_header {
276 	u8 type;
277 	u16 length;
278 };
279 
280 /* Values for GTDT subtable type above */
281 
282 enum acpi_gtdt_type {
283 	ACPI_GTDT_TYPE_TIMER_BLOCK = 0,
284 	ACPI_GTDT_TYPE_WATCHDOG = 1,
285 	ACPI_GTDT_TYPE_RESERVED = 2	/* 2 and greater are reserved */
286 };
287 
288 /* GTDT Subtables, correspond to Type in struct acpi_gtdt_header */
289 
290 /* 0: Generic Timer Block */
291 
292 struct acpi_gtdt_timer_block {
293 	struct acpi_gtdt_header header;
294 	u8 reserved;
295 	u64 block_address;
296 	u32 timer_count;
297 	u32 timer_offset;
298 };
299 
300 /* Timer Sub-Structure, one per timer */
301 
302 struct acpi_gtdt_timer_entry {
303 	u8 frame_number;
304 	u8 reserved[3];
305 	u64 base_address;
306 	u64 el0_base_address;
307 	u32 timer_interrupt;
308 	u32 timer_flags;
309 	u32 virtual_timer_interrupt;
310 	u32 virtual_timer_flags;
311 	u32 common_flags;
312 };
313 
314 /* Flag Definitions: timer_flags and virtual_timer_flags above */
315 
316 #define ACPI_GTDT_GT_IRQ_MODE		    (1)
317 #define ACPI_GTDT_GT_IRQ_POLARITY	    (1<<1)
318 
319 /* Flag Definitions: common_flags above */
320 
321 #define ACPI_GTDT_GT_IS_SECURE_TIMER	    (1)
322 #define ACPI_GTDT_GT_ALWAYS_ON		    (1<<1)
323 
324 /* 1: SBSA Generic Watchdog Structure */
325 
326 struct acpi_gtdt_watchdog {
327 	struct acpi_gtdt_header header;
328 	u8 reserved;
329 	u64 refresh_frame_address;
330 	u64 control_frame_address;
331 	u32 timer_interrupt;
332 	u32 timer_flags;
333 };
334 
335 /* Flag Definitions: timer_flags above */
336 
337 #define ACPI_GTDT_WATCHDOG_IRQ_MODE         (1)
338 #define ACPI_GTDT_WATCHDOG_IRQ_POLARITY     (1<<1)
339 #define ACPI_GTDT_WATCHDOG_SECURE           (1<<2)
340 
341 /*******************************************************************************
342  *
343  * MPST - Memory Power State Table (ACPI 5.0)
344  *        Version 1
345  *
346  ******************************************************************************/
347 
348 #define ACPI_MPST_CHANNEL_INFO \
349 	u16                             reserved1; \
350 	u8                              channel_id; \
351 	u8                              reserved2; \
352 	u16                             power_node_count;
353 
354 /* Main table */
355 
356 struct acpi_table_mpst {
357 	struct acpi_table_header header;	/* Common ACPI table header */
358 	 ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
359 };
360 
361 /* Memory Platform Communication Channel Info */
362 
363 struct acpi_mpst_channel {
364 	ACPI_MPST_CHANNEL_INFO	/* Platform Communication Channel */
365 };
366 
367 /* Memory Power Node Structure */
368 
369 struct acpi_mpst_power_node {
370 	u8 flags;
371 	u8 reserved1;
372 	u16 node_id;
373 	u32 length;
374 	u64 range_address;
375 	u64 range_length;
376 	u8 num_power_states;
377 	u8 num_physical_components;
378 	u16 reserved2;
379 };
380 
381 /* Values for Flags field above */
382 
383 #define ACPI_MPST_ENABLED               1
384 #define ACPI_MPST_POWER_MANAGED         2
385 #define ACPI_MPST_HOT_PLUG_CAPABLE      4
386 
387 /* Memory Power State Structure (follows POWER_NODE above) */
388 
389 struct acpi_mpst_power_state {
390 	u8 power_state;
391 	u8 info_index;
392 };
393 
394 /* Physical Component ID Structure (follows POWER_STATE above) */
395 
396 struct acpi_mpst_component {
397 	u16 component_id;
398 };
399 
400 /* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
401 
402 struct acpi_mpst_data_hdr {
403 	u16 characteristics_count;
404 };
405 
406 struct acpi_mpst_power_data {
407 	u8 revision;
408 	u8 flags;
409 	u16 reserved1;
410 	u32 average_power;
411 	u32 power_saving;
412 	u64 exit_latency;
413 	u64 reserved2;
414 };
415 
416 /* Values for Flags field above */
417 
418 #define ACPI_MPST_PRESERVE              1
419 #define ACPI_MPST_AUTOENTRY             2
420 #define ACPI_MPST_AUTOEXIT              4
421 
422 /* Shared Memory Region (not part of an ACPI table) */
423 
424 struct acpi_mpst_shared {
425 	u32 signature;
426 	u16 pcc_command;
427 	u16 pcc_status;
428 	u16 command_register;
429 	u16 status_register;
430 	u16 power_state_id;
431 	u16 power_node_id;
432 	u64 energy_consumed;
433 	u64 average_power;
434 };
435 
436 /*******************************************************************************
437  *
438  * PCCT - Platform Communications Channel Table (ACPI 5.0)
439  *        Version 1
440  *
441  ******************************************************************************/
442 
443 struct acpi_table_pcct {
444 	struct acpi_table_header header;	/* Common ACPI table header */
445 	u32 flags;
446 	u32 latency;
447 	u32 reserved;
448 };
449 
450 /* Values for Flags field above */
451 
452 #define ACPI_PCCT_DOORBELL              1
453 
454 /*
455  * PCCT subtables
456  */
457 
458 /* 0: Generic Communications Subspace */
459 
460 struct acpi_pcct_subspace {
461 	struct acpi_subtable_header header;
462 	u8 reserved[6];
463 	u64 base_address;
464 	u64 length;
465 	struct acpi_generic_address doorbell_register;
466 	u64 preserve_mask;
467 	u64 write_mask;
468 };
469 
470 /*
471  * PCC memory structures (not part of the ACPI table)
472  */
473 
474 /* Shared Memory Region */
475 
476 struct acpi_pcct_shared_memory {
477 	u32 signature;
478 	u16 command;
479 	u16 status;
480 };
481 
482 /*******************************************************************************
483  *
484  * PMTT - Platform Memory Topology Table (ACPI 5.0)
485  *        Version 1
486  *
487  ******************************************************************************/
488 
489 struct acpi_table_pmtt {
490 	struct acpi_table_header header;	/* Common ACPI table header */
491 	u32 reserved;
492 };
493 
494 /* Common header for PMTT subtables that follow main table */
495 
496 struct acpi_pmtt_header {
497 	u8 type;
498 	u8 reserved1;
499 	u16 length;
500 	u16 flags;
501 	u16 reserved2;
502 };
503 
504 /* Values for Type field above */
505 
506 #define ACPI_PMTT_TYPE_SOCKET           0
507 #define ACPI_PMTT_TYPE_CONTROLLER       1
508 #define ACPI_PMTT_TYPE_DIMM             2
509 #define ACPI_PMTT_TYPE_RESERVED         3	/* 0x03-0xFF are reserved */
510 
511 /* Values for Flags field above */
512 
513 #define ACPI_PMTT_TOP_LEVEL             0x0001
514 #define ACPI_PMTT_PHYSICAL              0x0002
515 #define ACPI_PMTT_MEMORY_TYPE           0x000C
516 
517 /*
518  * PMTT subtables, correspond to Type in struct acpi_pmtt_header
519  */
520 
521 /* 0: Socket Structure */
522 
523 struct acpi_pmtt_socket {
524 	struct acpi_pmtt_header header;
525 	u16 socket_id;
526 	u16 reserved;
527 };
528 
529 /* 1: Memory Controller subtable */
530 
531 struct acpi_pmtt_controller {
532 	struct acpi_pmtt_header header;
533 	u32 read_latency;
534 	u32 write_latency;
535 	u32 read_bandwidth;
536 	u32 write_bandwidth;
537 	u16 access_width;
538 	u16 alignment;
539 	u16 reserved;
540 	u16 domain_count;
541 };
542 
543 /* 1a: Proximity Domain substructure */
544 
545 struct acpi_pmtt_domain {
546 	u32 proximity_domain;
547 };
548 
549 /* 2: Physical Component Identifier (DIMM) */
550 
551 struct acpi_pmtt_physical_component {
552 	struct acpi_pmtt_header header;
553 	u16 component_id;
554 	u16 reserved;
555 	u32 memory_size;
556 	u32 bios_handle;
557 };
558 
559 /*******************************************************************************
560  *
561  * RASF - RAS Feature Table (ACPI 5.0)
562  *        Version 1
563  *
564  ******************************************************************************/
565 
566 struct acpi_table_rasf {
567 	struct acpi_table_header header;	/* Common ACPI table header */
568 	u8 channel_id[12];
569 };
570 
571 /* RASF Platform Communication Channel Shared Memory Region */
572 
573 struct acpi_rasf_shared_memory {
574 	u32 signature;
575 	u16 command;
576 	u16 status;
577 	u64 requested_address;
578 	u64 requested_length;
579 	u64 actual_address;
580 	u64 actual_length;
581 	u16 flags;
582 	u8 speed;
583 };
584 
585 /* Masks for Flags and Speed fields above */
586 
587 #define ACPI_RASF_SCRUBBER_RUNNING      1
588 #define ACPI_RASF_SPEED                 (7<<1)
589 
590 /* Channel Commands */
591 
592 enum acpi_rasf_commands {
593 	ACPI_RASF_GET_RAS_CAPABILITIES = 1,
594 	ACPI_RASF_GET_PATROL_PARAMETERS = 2,
595 	ACPI_RASF_START_PATROL_SCRUBBER = 3,
596 	ACPI_RASF_STOP_PATROL_SCRUBBER = 4
597 };
598 
599 /* Channel Command flags */
600 
601 #define ACPI_RASF_GENERATE_SCI          (1<<15)
602 
603 /* Status values */
604 
605 enum acpi_rasf_status {
606 	ACPI_RASF_SUCCESS = 0,
607 	ACPI_RASF_NOT_VALID = 1,
608 	ACPI_RASF_NOT_SUPPORTED = 2,
609 	ACPI_RASF_BUSY = 3,
610 	ACPI_RASF_FAILED = 4,
611 	ACPI_RASF_ABORTED = 5,
612 	ACPI_RASF_INVALID_DATA = 6
613 };
614 
615 /* Status flags */
616 
617 #define ACPI_RASF_COMMAND_COMPLETE      (1)
618 #define ACPI_RASF_SCI_DOORBELL          (1<<1)
619 #define ACPI_RASF_ERROR                 (1<<2)
620 #define ACPI_RASF_STATUS                (0x1F<<3)
621 
622 /*******************************************************************************
623  *
624  * STAO - Status Override Table (_STA override) - ACPI 6.0
625  *        Version 1
626  *
627  * Conforms to "ACPI Specification for Status Override Table"
628  * 6 January 2015
629  *
630  ******************************************************************************/
631 
632 struct acpi_table_stao {
633 	struct acpi_table_header header;	/* Common ACPI table header */
634 	u8 ignore_uart;
635 };
636 
637 /* Reset to default packing */
638 
639 #pragma pack()
640 
641 #endif				/* __ACTBL3_H__ */
642