ce69acd4549cb952fdf535cd9ae053957d0ff52f
[dragonfly.git] / sys / contrib / dev / acpica / source / include / actbl3.h
1 /******************************************************************************
2  *
3  * Name: actbl3.h - ACPI Table Definitions
4  *
5  *****************************************************************************/
6
7 /*
8  * Copyright (C) 2000 - 2014, 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  *
50  * Additional ACPI Tables (3)
51  *
52  * These tables are not consumed directly by the ACPICA subsystem, but are
53  * included here to support device drivers and the AML disassembler.
54  *
55  * The tables in this file are fully defined within the ACPI specification.
56  *
57  ******************************************************************************/
58
59
60 /*
61  * Values for description table header signatures for tables defined in this
62  * file. Useful because they make it more difficult to inadvertently type in
63  * the wrong signature.
64  */
65 #define ACPI_SIG_BGRT           "BGRT"      /* Boot Graphics Resource Table */
66 #define ACPI_SIG_DRTM           "DRTM"      /* Dynamic Root of Trust for Measurement table */
67 #define ACPI_SIG_FPDT           "FPDT"      /* Firmware Performance Data Table */
68 #define ACPI_SIG_GTDT           "GTDT"      /* Generic Timer Description Table */
69 #define ACPI_SIG_MPST           "MPST"      /* Memory Power State Table */
70 #define ACPI_SIG_PCCT           "PCCT"      /* Platform Communications Channel Table */
71 #define ACPI_SIG_PMTT           "PMTT"      /* Platform Memory Topology Table */
72 #define ACPI_SIG_RASF           "RASF"      /* RAS Feature table */
73 #define ACPI_SIG_TPM2           "TPM2"      /* Trusted Platform Module 2.0 H/W interface table */
74
75 #define ACPI_SIG_S3PT           "S3PT"      /* S3 Performance (sub)Table */
76 #define ACPI_SIG_PCCS           "PCC"       /* PCC Shared Memory Region */
77
78 /* Reserved table signatures */
79
80 #define ACPI_SIG_MATR           "MATR"      /* Memory Address Translation Table */
81 #define ACPI_SIG_MSDM           "MSDM"      /* Microsoft Data Management Table */
82 #define ACPI_SIG_WPBT           "WPBT"      /* Windows Platform Binary Table */
83
84 /*
85  * All tables must be byte-packed to match the ACPI specification, since
86  * the tables are provided by the system BIOS.
87  */
88 #pragma pack(1)
89
90 /*
91  * Note: C bitfields are not used for this reason:
92  *
93  * "Bitfields are great and easy to read, but unfortunately the C language
94  * does not specify the layout of bitfields in memory, which means they are
95  * essentially useless for dealing with packed data in on-disk formats or
96  * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
97  * this decision was a design error in C. Ritchie could have picked an order
98  * and stuck with it." Norman Ramsey.
99  * See http://stackoverflow.com/a/1053662/41661
100  */
101
102
103 /*******************************************************************************
104  *
105  * BGRT - Boot Graphics Resource Table (ACPI 5.0)
106  *        Version 1
107  *
108  ******************************************************************************/
109
110 typedef struct acpi_table_bgrt
111 {
112     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
113     UINT16                  Version;
114     UINT8                   Status;
115     UINT8                   ImageType;
116     UINT64                  ImageAddress;
117     UINT32                  ImageOffsetX;
118     UINT32                  ImageOffsetY;
119
120 } ACPI_TABLE_BGRT;
121
122
123 /*******************************************************************************
124  *
125  * DRTM - Dynamic Root of Trust for Measurement table
126  *
127  ******************************************************************************/
128
129 typedef struct acpi_table_drtm
130 {
131     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
132     UINT64                  EntryBaseAddress;
133     UINT64                  EntryLength;
134     UINT32                  EntryAddress32;
135     UINT64                  EntryAddress64;
136     UINT64                  ExitAddress;
137     UINT64                  LogAreaAddress;
138     UINT32                  LogAreaLength;
139     UINT64                  ArchDependentAddress;
140     UINT32                  Flags;
141
142 } ACPI_TABLE_DRTM;
143
144 /* 1) Validated Tables List */
145
146 typedef struct acpi_drtm_vtl_list
147 {
148     UINT32                  ValidatedTableListCount;
149
150 } ACPI_DRTM_VTL_LIST;
151
152 /* 2) Resources List */
153
154 typedef struct acpi_drtm_resource_list
155 {
156     UINT32                  ResourceListCount;
157
158 } ACPI_DRTM_RESOURCE_LIST;
159
160 /* 3) Platform-specific Identifiers List */
161
162 typedef struct acpi_drtm_id_list
163 {
164     UINT32                  IdListCount;
165
166 } ACPI_DRTM_ID_LIST;
167
168
169 /*******************************************************************************
170  *
171  * FPDT - Firmware Performance Data Table (ACPI 5.0)
172  *        Version 1
173  *
174  ******************************************************************************/
175
176 typedef struct acpi_table_fpdt
177 {
178     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
179
180 } ACPI_TABLE_FPDT;
181
182
183 /* FPDT subtable header */
184
185 typedef struct acpi_fpdt_header
186 {
187     UINT16                  Type;
188     UINT8                   Length;
189     UINT8                   Revision;
190
191 } ACPI_FPDT_HEADER;
192
193 /* Values for Type field above */
194
195 enum AcpiFpdtType
196 {
197     ACPI_FPDT_TYPE_BOOT                 = 0,
198     ACPI_FPDT_TYPE_S3PERF               = 1
199 };
200
201
202 /*
203  * FPDT subtables
204  */
205
206 /* 0: Firmware Basic Boot Performance Record */
207
208 typedef struct acpi_fpdt_boot
209 {
210     ACPI_FPDT_HEADER        Header;
211     UINT8                   Reserved[4];
212     UINT64                  ResetEnd;
213     UINT64                  LoadStart;
214     UINT64                  StartupStart;
215     UINT64                  ExitServicesEntry;
216     UINT64                  ExitServicesExit;
217
218 } ACPI_FPDT_BOOT;
219
220
221 /* 1: S3 Performance Table Pointer Record */
222
223 typedef struct acpi_fpdt_s3pt_ptr
224 {
225     ACPI_FPDT_HEADER        Header;
226     UINT8                   Reserved[4];
227     UINT64                  Address;
228
229 } ACPI_FPDT_S3PT_PTR;
230
231
232 /*
233  * S3PT - S3 Performance Table. This table is pointed to by the
234  * FPDT S3 Pointer Record above.
235  */
236 typedef struct acpi_table_s3pt
237 {
238     UINT8                   Signature[4]; /* "S3PT" */
239     UINT32                  Length;
240
241 } ACPI_TABLE_S3PT;
242
243
244 /*
245  * S3PT Subtables
246  */
247 typedef struct acpi_s3pt_header
248 {
249     UINT16                  Type;
250     UINT8                   Length;
251     UINT8                   Revision;
252
253 } ACPI_S3PT_HEADER;
254
255 /* Values for Type field above */
256
257 enum AcpiS3ptType
258 {
259     ACPI_S3PT_TYPE_RESUME               = 0,
260     ACPI_S3PT_TYPE_SUSPEND              = 1
261 };
262
263 typedef struct acpi_s3pt_resume
264 {
265     ACPI_S3PT_HEADER        Header;
266     UINT32                  ResumeCount;
267     UINT64                  FullResume;
268     UINT64                  AverageResume;
269
270 } ACPI_S3PT_RESUME;
271
272 typedef struct acpi_s3pt_suspend
273 {
274     ACPI_S3PT_HEADER        Header;
275     UINT64                  SuspendStart;
276     UINT64                  SuspendEnd;
277
278 } ACPI_S3PT_SUSPEND;
279
280
281 /*******************************************************************************
282  *
283  * GTDT - Generic Timer Description Table (ACPI 5.0)
284  *        Version 1
285  *
286  ******************************************************************************/
287
288 typedef struct acpi_table_gtdt
289 {
290     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
291     UINT64                  Address;
292     UINT32                  Flags;
293     UINT32                  SecurePl1Interrupt;
294     UINT32                  SecurePl1Flags;
295     UINT32                  NonSecurePl1Interrupt;
296     UINT32                  NonSecurePl1Flags;
297     UINT32                  VirtualTimerInterrupt;
298     UINT32                  VirtualTimerFlags;
299     UINT32                  NonSecurePl2Interrupt;
300     UINT32                  NonSecurePl2Flags;
301
302 } ACPI_TABLE_GTDT;
303
304 /* Values for Flags field above */
305
306 #define ACPI_GTDT_MAPPED_BLOCK_PRESENT      1
307
308 /* Values for all "TimerFlags" fields above */
309
310 #define ACPI_GTDT_INTERRUPT_MODE            1
311 #define ACPI_GTDT_INTERRUPT_POLARITY        2
312
313
314 /*******************************************************************************
315  *
316  * MPST - Memory Power State Table (ACPI 5.0)
317  *        Version 1
318  *
319  ******************************************************************************/
320
321 #define ACPI_MPST_CHANNEL_INFO \
322     UINT8                   ChannelId; \
323     UINT8                   Reserved1[3]; \
324     UINT16                  PowerNodeCount; \
325     UINT16                  Reserved2;
326
327 /* Main table */
328
329 typedef struct acpi_table_mpst
330 {
331     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
332     ACPI_MPST_CHANNEL_INFO                      /* Platform Communication Channel */
333
334 } ACPI_TABLE_MPST;
335
336
337 /* Memory Platform Communication Channel Info */
338
339 typedef struct acpi_mpst_channel
340 {
341     ACPI_MPST_CHANNEL_INFO                      /* Platform Communication Channel */
342
343 } ACPI_MPST_CHANNEL;
344
345
346 /* Memory Power Node Structure */
347
348 typedef struct acpi_mpst_power_node
349 {
350     UINT8                   Flags;
351     UINT8                   Reserved1;
352     UINT16                  NodeId;
353     UINT32                  Length;
354     UINT64                  RangeAddress;
355     UINT64                  RangeLength;
356     UINT32                  NumPowerStates;
357     UINT32                  NumPhysicalComponents;
358
359 } ACPI_MPST_POWER_NODE;
360
361 /* Values for Flags field above */
362
363 #define ACPI_MPST_ENABLED               1
364 #define ACPI_MPST_POWER_MANAGED         2
365 #define ACPI_MPST_HOT_PLUG_CAPABLE      4
366
367
368 /* Memory Power State Structure (follows POWER_NODE above) */
369
370 typedef struct acpi_mpst_power_state
371 {
372     UINT8                   PowerState;
373     UINT8                   InfoIndex;
374
375 } ACPI_MPST_POWER_STATE;
376
377
378 /* Physical Component ID Structure (follows POWER_STATE above) */
379
380 typedef struct acpi_mpst_component
381 {
382     UINT16                  ComponentId;
383
384 } ACPI_MPST_COMPONENT;
385
386
387 /* Memory Power State Characteristics Structure (follows all POWER_NODEs) */
388
389 typedef struct acpi_mpst_data_hdr
390 {
391     UINT16                  CharacteristicsCount;
392     UINT16                  Reserved;
393
394 } ACPI_MPST_DATA_HDR;
395
396 typedef struct acpi_mpst_power_data
397 {
398     UINT8                   StructureId;
399     UINT8                   Flags;
400     UINT16                  Reserved1;
401     UINT32                  AveragePower;
402     UINT32                  PowerSaving;
403     UINT64                  ExitLatency;
404     UINT64                  Reserved2;
405
406 } ACPI_MPST_POWER_DATA;
407
408 /* Values for Flags field above */
409
410 #define ACPI_MPST_PRESERVE              1
411 #define ACPI_MPST_AUTOENTRY             2
412 #define ACPI_MPST_AUTOEXIT              4
413
414
415 /* Shared Memory Region (not part of an ACPI table) */
416
417 typedef struct acpi_mpst_shared
418 {
419     UINT32                  Signature;
420     UINT16                  PccCommand;
421     UINT16                  PccStatus;
422     UINT32                  CommandRegister;
423     UINT32                  StatusRegister;
424     UINT32                  PowerStateId;
425     UINT32                  PowerNodeId;
426     UINT64                  EnergyConsumed;
427     UINT64                  AveragePower;
428
429 } ACPI_MPST_SHARED;
430
431
432 /*******************************************************************************
433  *
434  * PCCT - Platform Communications Channel Table (ACPI 5.0)
435  *        Version 1
436  *
437  ******************************************************************************/
438
439 typedef struct acpi_table_pcct
440 {
441     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
442     UINT32                  Flags;
443     UINT64                  Reserved;
444
445 } ACPI_TABLE_PCCT;
446
447 /* Values for Flags field above */
448
449 #define ACPI_PCCT_DOORBELL              1
450
451 /* Values for subtable type in ACPI_SUBTABLE_HEADER */
452
453 enum AcpiPcctType
454 {
455     ACPI_PCCT_TYPE_GENERIC_SUBSPACE     = 0,
456     ACPI_PCCT_TYPE_RESERVED             = 1     /* 1 and greater are reserved */
457 };
458
459 /*
460  * PCCT Subtables, correspond to Type in ACPI_SUBTABLE_HEADER
461  */
462
463 /* 0: Generic Communications Subspace */
464
465 typedef struct acpi_pcct_subspace
466 {
467     ACPI_SUBTABLE_HEADER    Header;
468     UINT8                   Reserved[6];
469     UINT64                  BaseAddress;
470     UINT64                  Length;
471     ACPI_GENERIC_ADDRESS    DoorbellRegister;
472     UINT64                  PreserveMask;
473     UINT64                  WriteMask;
474     UINT32                  Latency;
475     UINT32                  MaxAccessRate;
476     UINT16                  MinTurnaroundTime;
477
478 } ACPI_PCCT_SUBSPACE;
479
480
481 /*
482  * PCC memory structures (not part of the ACPI table)
483  */
484
485 /* Shared Memory Region */
486
487 typedef struct acpi_pcct_shared_memory
488 {
489     UINT32                  Signature;
490     UINT16                  Command;
491     UINT16                  Status;
492
493 } ACPI_PCCT_SHARED_MEMORY;
494
495
496 /*******************************************************************************
497  *
498  * PMTT - Platform Memory Topology Table (ACPI 5.0)
499  *        Version 1
500  *
501  ******************************************************************************/
502
503 typedef struct acpi_table_pmtt
504 {
505     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
506     UINT32                  Reserved;
507
508 } ACPI_TABLE_PMTT;
509
510
511 /* Common header for PMTT subtables that follow main table */
512
513 typedef struct acpi_pmtt_header
514 {
515     UINT8                   Type;
516     UINT8                   Reserved1;
517     UINT16                  Length;
518     UINT16                  Flags;
519     UINT16                  Reserved2;
520
521 } ACPI_PMTT_HEADER;
522
523 /* Values for Type field above */
524
525 #define ACPI_PMTT_TYPE_SOCKET           0
526 #define ACPI_PMTT_TYPE_CONTROLLER       1
527 #define ACPI_PMTT_TYPE_DIMM             2
528 #define ACPI_PMTT_TYPE_RESERVED         3 /* 0x03-0xFF are reserved */
529
530 /* Values for Flags field above */
531
532 #define ACPI_PMTT_TOP_LEVEL             0x0001
533 #define ACPI_PMTT_PHYSICAL              0x0002
534 #define ACPI_PMTT_MEMORY_TYPE           0x000C
535
536
537 /*
538  * PMTT subtables, correspond to Type in acpi_pmtt_header
539  */
540
541
542 /* 0: Socket Structure */
543
544 typedef struct acpi_pmtt_socket
545 {
546     ACPI_PMTT_HEADER        Header;
547     UINT16                  SocketId;
548     UINT16                  Reserved;
549
550 } ACPI_PMTT_SOCKET;
551
552
553 /* 1: Memory Controller subtable */
554
555 typedef struct acpi_pmtt_controller
556 {
557     ACPI_PMTT_HEADER        Header;
558     UINT32                  ReadLatency;
559     UINT32                  WriteLatency;
560     UINT32                  ReadBandwidth;
561     UINT32                  WriteBandwidth;
562     UINT16                  AccessWidth;
563     UINT16                  Alignment;
564     UINT16                  Reserved;
565     UINT16                  DomainCount;
566
567 } ACPI_PMTT_CONTROLLER;
568
569 /* 1a: Proximity Domain substructure */
570
571 typedef struct acpi_pmtt_domain
572 {
573     UINT32                  ProximityDomain;
574
575 } ACPI_PMTT_DOMAIN;
576
577
578 /* 2: Physical Component Identifier (DIMM) */
579
580 typedef struct acpi_pmtt_physical_component
581 {
582     ACPI_PMTT_HEADER        Header;
583     UINT16                  ComponentId;
584     UINT16                  Reserved;
585     UINT32                  MemorySize;
586     UINT32                  BiosHandle;
587
588 } ACPI_PMTT_PHYSICAL_COMPONENT;
589
590
591 /*******************************************************************************
592  *
593  * RASF - RAS Feature Table (ACPI 5.0)
594  *        Version 1
595  *
596  ******************************************************************************/
597
598 typedef struct acpi_table_rasf
599 {
600     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
601     UINT8                   ChannelId[12];
602
603 } ACPI_TABLE_RASF;
604
605 /* RASF Platform Communication Channel Shared Memory Region */
606
607 typedef struct acpi_rasf_shared_memory
608 {
609     UINT32                  Signature;
610     UINT16                  Command;
611     UINT16                  Status;
612     UINT16                  Version;
613     UINT8                   Capabilities[16];
614     UINT8                   SetCapabilities[16];
615     UINT16                  NumParameterBlocks;
616     UINT32                  SetCapabilitiesStatus;
617
618 } ACPI_RASF_SHARED_MEMORY;
619
620 /* RASF Parameter Block Structure Header */
621
622 typedef struct acpi_rasf_parameter_block
623 {
624     UINT16                  Type;
625     UINT16                  Version;
626     UINT16                  Length;
627
628 } ACPI_RASF_PARAMETER_BLOCK;
629
630 /* RASF Parameter Block Structure for PATROL_SCRUB */
631
632 typedef struct acpi_rasf_patrol_scrub_parameter
633 {
634     ACPI_RASF_PARAMETER_BLOCK   Header;
635     UINT16                      PatrolScrubCommand;
636     UINT64                      RequestedAddressRange[2];
637     UINT64                      ActualAddressRange[2];
638     UINT16                      Flags;
639     UINT8                       RequestedSpeed;
640
641 } ACPI_RASF_PATROL_SCRUB_PARAMETER;
642
643 /* Masks for Flags and Speed fields above */
644
645 #define ACPI_RASF_SCRUBBER_RUNNING      1
646 #define ACPI_RASF_SPEED                 (7<<1)
647 #define ACPI_RASF_SPEED_SLOW            (0<<1)
648 #define ACPI_RASF_SPEED_MEDIUM          (4<<1)
649 #define ACPI_RASF_SPEED_FAST            (7<<1)
650
651 /* Channel Commands */
652
653 enum AcpiRasfCommands
654 {
655     ACPI_RASF_EXECUTE_RASF_COMMAND      = 1
656 };
657
658 /* Platform RAS Capabilities */
659
660 enum AcpiRasfCapabiliities
661 {
662     ACPI_HW_PATROL_SCRUB_SUPPORTED      = 0,
663     ACPI_SW_PATROL_SCRUB_EXPOSED        = 1
664 };
665
666 /* Patrol Scrub Commands */
667
668 enum AcpiRasfPatrolScrubCommands
669 {
670     ACPI_RASF_GET_PATROL_PARAMETERS     = 1,
671     ACPI_RASF_START_PATROL_SCRUBBER     = 2,
672     ACPI_RASF_STOP_PATROL_SCRUBBER      = 3
673 };
674
675 /* Channel Command flags */
676
677 #define ACPI_RASF_GENERATE_SCI          (1<<15)
678
679 /* Status values */
680
681 enum AcpiRasfStatus
682 {
683     ACPI_RASF_SUCCESS                   = 0,
684     ACPI_RASF_NOT_VALID                 = 1,
685     ACPI_RASF_NOT_SUPPORTED             = 2,
686     ACPI_RASF_BUSY                      = 3,
687     ACPI_RASF_FAILED                    = 4,
688     ACPI_RASF_ABORTED                   = 5,
689     ACPI_RASF_INVALID_DATA              = 6
690 };
691
692 /* Status flags */
693
694 #define ACPI_RASF_COMMAND_COMPLETE      (1)
695 #define ACPI_RASF_SCI_DOORBELL          (1<<1)
696 #define ACPI_RASF_ERROR                 (1<<2)
697 #define ACPI_RASF_STATUS                (0x1F<<3)
698
699
700 /*******************************************************************************
701  *
702  * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table
703  *        Version 3
704  *
705  * Conforms to "TPM 2.0 Hardware Interface Table (TPM2)" 29 November 2011
706  *
707  ******************************************************************************/
708
709 typedef struct acpi_table_tpm2
710 {
711     ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
712     UINT32                  Flags;
713     UINT64                  ControlAddress;
714     UINT32                  StartMethod;
715
716 } ACPI_TABLE_TPM2;
717
718 /* Control area structure (not part of table, pointed to by ControlAddress) */
719
720 typedef struct acpi_tpm2_control
721 {
722     UINT32                  Reserved;
723     UINT32                  Error;
724     UINT32                  Cancel;
725     UINT32                  Start;
726     UINT64                  InterruptControl;
727     UINT32                  CommandSize;
728     UINT64                  CommandAddress;
729     UINT32                  ResponseSize;
730     UINT64                  ResponseAddress;
731
732 } ACPI_TPM2_CONTROL;
733
734
735 /* Reset to default packing */
736
737 #pragma pack()
738
739 #endif /* __ACTBL3_H__ */