sd: remove 'ssd' driver support
[unleashed/tickless.git] / arch / x86 / include / sys / acpi / amlresrc.h
blob960da1b31076735a219a0e3f7cd945170bb786ae
1 /******************************************************************************
3 * Module Name: amlresrc.h - AML resource descriptors
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2016, Intel Corp.
9 * All rights reserved.
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.
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.
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.
44 /* acpisrc:StructDefs -- for acpisrc conversion */
46 #ifndef __AMLRESRC_H
47 #define __AMLRESRC_H
51 * Resource descriptor tags, as defined in the ACPI specification.
52 * Used to symbolically reference fields within a descriptor.
54 #define ACPI_RESTAG_ADDRESS "_ADR"
55 #define ACPI_RESTAG_ALIGNMENT "_ALN"
56 #define ACPI_RESTAG_ADDRESSSPACE "_ASI"
57 #define ACPI_RESTAG_ACCESSSIZE "_ASZ"
58 #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
59 #define ACPI_RESTAG_BASEADDRESS "_BAS"
60 #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
61 #define ACPI_RESTAG_DEBOUNCETIME "_DBT"
62 #define ACPI_RESTAG_DECODE "_DEC"
63 #define ACPI_RESTAG_DEVICEPOLARITY "_DPL"
64 #define ACPI_RESTAG_DMA "_DMA"
65 #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
66 #define ACPI_RESTAG_DRIVESTRENGTH "_DRS"
67 #define ACPI_RESTAG_ENDIANNESS "_END"
68 #define ACPI_RESTAG_FLOWCONTROL "_FLC"
69 #define ACPI_RESTAG_GRANULARITY "_GRA"
70 #define ACPI_RESTAG_INTERRUPT "_INT"
71 #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
72 #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
73 #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
74 #define ACPI_RESTAG_IORESTRICTION "_IOR"
75 #define ACPI_RESTAG_LENGTH "_LEN"
76 #define ACPI_RESTAG_LINE "_LIN"
77 #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
78 #define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
79 #define ACPI_RESTAG_MAXADDR "_MAX"
80 #define ACPI_RESTAG_MINADDR "_MIN"
81 #define ACPI_RESTAG_MAXTYPE "_MAF"
82 #define ACPI_RESTAG_MINTYPE "_MIF"
83 #define ACPI_RESTAG_MODE "_MOD"
84 #define ACPI_RESTAG_PARITY "_PAR"
85 #define ACPI_RESTAG_PHASE "_PHA"
86 #define ACPI_RESTAG_PIN "_PIN"
87 #define ACPI_RESTAG_PINCONFIG "_PPI"
88 #define ACPI_RESTAG_POLARITY "_POL"
89 #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
90 #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
91 #define ACPI_RESTAG_RANGETYPE "_RNG"
92 #define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
93 #define ACPI_RESTAG_LENGTH_RX "_RXL"
94 #define ACPI_RESTAG_LENGTH_TX "_TXL"
95 #define ACPI_RESTAG_SLAVEMODE "_SLV"
96 #define ACPI_RESTAG_SPEED "_SPE"
97 #define ACPI_RESTAG_STOPBITS "_STB"
98 #define ACPI_RESTAG_TRANSLATION "_TRA"
99 #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
100 #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
101 #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
102 #define ACPI_RESTAG_VENDORDATA "_VEN"
105 /* Default sizes for "small" resource descriptors */
107 #define ASL_RDESC_IRQ_SIZE 0x02
108 #define ASL_RDESC_DMA_SIZE 0x02
109 #define ASL_RDESC_ST_DEPEND_SIZE 0x00
110 #define ASL_RDESC_END_DEPEND_SIZE 0x00
111 #define ASL_RDESC_IO_SIZE 0x07
112 #define ASL_RDESC_FIXED_IO_SIZE 0x03
113 #define ASL_RDESC_FIXED_DMA_SIZE 0x05
114 #define ASL_RDESC_END_TAG_SIZE 0x01
117 typedef struct asl_resource_node
119 UINT32 BufferLength;
120 void *Buffer;
121 struct asl_resource_node *Next;
123 } ASL_RESOURCE_NODE;
125 typedef struct asl_resource_info
127 ACPI_PARSE_OBJECT *DescriptorTypeOp; /* Resource descriptor parse node */
128 ACPI_PARSE_OBJECT *MappingOp; /* Used for mapfile support */
129 UINT32 CurrentByteOffset; /* Offset in resource template */
131 } ASL_RESOURCE_INFO;
134 /* Macros used to generate AML resource length fields */
136 #define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
137 #define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
140 * Resource descriptors defined in the ACPI specification.
142 * Packing/alignment must be BYTE because these descriptors
143 * are used to overlay the raw AML byte stream.
145 #pragma pack(1)
148 * SMALL descriptors
150 #define AML_RESOURCE_SMALL_HEADER_COMMON \
151 UINT8 DescriptorType;
153 typedef struct aml_resource_small_header
155 AML_RESOURCE_SMALL_HEADER_COMMON
157 } AML_RESOURCE_SMALL_HEADER;
160 typedef struct aml_resource_irq
162 AML_RESOURCE_SMALL_HEADER_COMMON
163 UINT16 IrqMask;
164 UINT8 Flags;
166 } AML_RESOURCE_IRQ;
169 typedef struct aml_resource_irq_noflags
171 AML_RESOURCE_SMALL_HEADER_COMMON
172 UINT16 IrqMask;
174 } AML_RESOURCE_IRQ_NOFLAGS;
177 typedef struct aml_resource_dma
179 AML_RESOURCE_SMALL_HEADER_COMMON
180 UINT8 DmaChannelMask;
181 UINT8 Flags;
183 } AML_RESOURCE_DMA;
186 typedef struct aml_resource_start_dependent
188 AML_RESOURCE_SMALL_HEADER_COMMON
189 UINT8 Flags;
191 } AML_RESOURCE_START_DEPENDENT;
194 typedef struct aml_resource_start_dependent_noprio
196 AML_RESOURCE_SMALL_HEADER_COMMON
198 } AML_RESOURCE_START_DEPENDENT_NOPRIO;
201 typedef struct aml_resource_end_dependent
203 AML_RESOURCE_SMALL_HEADER_COMMON
205 } AML_RESOURCE_END_DEPENDENT;
208 typedef struct aml_resource_io
210 AML_RESOURCE_SMALL_HEADER_COMMON
211 UINT8 Flags;
212 UINT16 Minimum;
213 UINT16 Maximum;
214 UINT8 Alignment;
215 UINT8 AddressLength;
217 } AML_RESOURCE_IO;
220 typedef struct aml_resource_fixed_io
222 AML_RESOURCE_SMALL_HEADER_COMMON
223 UINT16 Address;
224 UINT8 AddressLength;
226 } AML_RESOURCE_FIXED_IO;
229 typedef struct aml_resource_vendor_small
231 AML_RESOURCE_SMALL_HEADER_COMMON
233 } AML_RESOURCE_VENDOR_SMALL;
236 typedef struct aml_resource_end_tag
238 AML_RESOURCE_SMALL_HEADER_COMMON
239 UINT8 Checksum;
241 } AML_RESOURCE_END_TAG;
244 typedef struct aml_resource_fixed_dma
246 AML_RESOURCE_SMALL_HEADER_COMMON
247 UINT16 RequestLines;
248 UINT16 Channels;
249 UINT8 Width;
251 } AML_RESOURCE_FIXED_DMA;
255 * LARGE descriptors
257 #define AML_RESOURCE_LARGE_HEADER_COMMON \
258 UINT8 DescriptorType;\
259 UINT16 ResourceLength;
261 typedef struct aml_resource_large_header
263 AML_RESOURCE_LARGE_HEADER_COMMON
265 } AML_RESOURCE_LARGE_HEADER;
268 /* General Flags for address space resource descriptors */
270 #define ACPI_RESOURCE_FLAG_DEC 2
271 #define ACPI_RESOURCE_FLAG_MIF 4
272 #define ACPI_RESOURCE_FLAG_MAF 8
274 typedef struct aml_resource_memory24
276 AML_RESOURCE_LARGE_HEADER_COMMON
277 UINT8 Flags;
278 UINT16 Minimum;
279 UINT16 Maximum;
280 UINT16 Alignment;
281 UINT16 AddressLength;
283 } AML_RESOURCE_MEMORY24;
286 typedef struct aml_resource_vendor_large
288 AML_RESOURCE_LARGE_HEADER_COMMON
290 } AML_RESOURCE_VENDOR_LARGE;
293 typedef struct aml_resource_memory32
295 AML_RESOURCE_LARGE_HEADER_COMMON
296 UINT8 Flags;
297 UINT32 Minimum;
298 UINT32 Maximum;
299 UINT32 Alignment;
300 UINT32 AddressLength;
302 } AML_RESOURCE_MEMORY32;
305 typedef struct aml_resource_fixed_memory32
307 AML_RESOURCE_LARGE_HEADER_COMMON
308 UINT8 Flags;
309 UINT32 Address;
310 UINT32 AddressLength;
312 } AML_RESOURCE_FIXED_MEMORY32;
315 #define AML_RESOURCE_ADDRESS_COMMON \
316 UINT8 ResourceType; \
317 UINT8 Flags; \
318 UINT8 SpecificFlags;
321 typedef struct aml_resource_address
323 AML_RESOURCE_LARGE_HEADER_COMMON
324 AML_RESOURCE_ADDRESS_COMMON
326 } AML_RESOURCE_ADDRESS;
329 typedef struct aml_resource_extended_address64
331 AML_RESOURCE_LARGE_HEADER_COMMON
332 AML_RESOURCE_ADDRESS_COMMON
333 UINT8 RevisionID;
334 UINT8 Reserved;
335 UINT64 Granularity;
336 UINT64 Minimum;
337 UINT64 Maximum;
338 UINT64 TranslationOffset;
339 UINT64 AddressLength;
340 UINT64 TypeSpecific;
342 } AML_RESOURCE_EXTENDED_ADDRESS64;
344 #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
347 typedef struct aml_resource_address64
349 AML_RESOURCE_LARGE_HEADER_COMMON
350 AML_RESOURCE_ADDRESS_COMMON
351 UINT64 Granularity;
352 UINT64 Minimum;
353 UINT64 Maximum;
354 UINT64 TranslationOffset;
355 UINT64 AddressLength;
357 } AML_RESOURCE_ADDRESS64;
360 typedef struct aml_resource_address32
362 AML_RESOURCE_LARGE_HEADER_COMMON
363 AML_RESOURCE_ADDRESS_COMMON
364 UINT32 Granularity;
365 UINT32 Minimum;
366 UINT32 Maximum;
367 UINT32 TranslationOffset;
368 UINT32 AddressLength;
370 } AML_RESOURCE_ADDRESS32;
373 typedef struct aml_resource_address16
375 AML_RESOURCE_LARGE_HEADER_COMMON
376 AML_RESOURCE_ADDRESS_COMMON
377 UINT16 Granularity;
378 UINT16 Minimum;
379 UINT16 Maximum;
380 UINT16 TranslationOffset;
381 UINT16 AddressLength;
383 } AML_RESOURCE_ADDRESS16;
386 typedef struct aml_resource_extended_irq
388 AML_RESOURCE_LARGE_HEADER_COMMON
389 UINT8 Flags;
390 UINT8 InterruptCount;
391 UINT32 Interrupts[1];
392 /* ResSourceIndex, ResSource optional fields follow */
394 } AML_RESOURCE_EXTENDED_IRQ;
397 typedef struct aml_resource_generic_register
399 AML_RESOURCE_LARGE_HEADER_COMMON
400 UINT8 AddressSpaceId;
401 UINT8 BitWidth;
402 UINT8 BitOffset;
403 UINT8 AccessSize; /* ACPI 3.0, was previously Reserved */
404 UINT64 Address;
406 } AML_RESOURCE_GENERIC_REGISTER;
409 /* Common descriptor for GpioInt and GpioIo (ACPI 5.0) */
411 typedef struct aml_resource_gpio
413 AML_RESOURCE_LARGE_HEADER_COMMON
414 UINT8 RevisionId;
415 UINT8 ConnectionType;
416 UINT16 Flags;
417 UINT16 IntFlags;
418 UINT8 PinConfig;
419 UINT16 DriveStrength;
420 UINT16 DebounceTimeout;
421 UINT16 PinTableOffset;
422 UINT8 ResSourceIndex;
423 UINT16 ResSourceOffset;
424 UINT16 VendorOffset;
425 UINT16 VendorLength;
427 * Optional fields follow immediately:
428 * 1) PIN list (Words)
429 * 2) Resource Source String
430 * 3) Vendor Data bytes
433 } AML_RESOURCE_GPIO;
435 #define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */
437 /* Values for ConnectionType above */
439 #define AML_RESOURCE_GPIO_TYPE_INT 0
440 #define AML_RESOURCE_GPIO_TYPE_IO 1
441 #define AML_RESOURCE_MAX_GPIOTYPE 1
444 /* Common preamble for all serial descriptors (ACPI 5.0) */
446 #define AML_RESOURCE_SERIAL_COMMON \
447 UINT8 RevisionId; \
448 UINT8 ResSourceIndex; \
449 UINT8 Type; \
450 UINT8 Flags; \
451 UINT16 TypeSpecificFlags; \
452 UINT8 TypeRevisionId; \
453 UINT16 TypeDataLength; \
455 /* Values for the type field above */
457 #define AML_RESOURCE_I2C_SERIALBUSTYPE 1
458 #define AML_RESOURCE_SPI_SERIALBUSTYPE 2
459 #define AML_RESOURCE_UART_SERIALBUSTYPE 3
460 #define AML_RESOURCE_MAX_SERIALBUSTYPE 3
461 #define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
463 typedef struct aml_resource_common_serialbus
465 AML_RESOURCE_LARGE_HEADER_COMMON
466 AML_RESOURCE_SERIAL_COMMON
468 } AML_RESOURCE_COMMON_SERIALBUS;
470 typedef struct aml_resource_i2c_serialbus
472 AML_RESOURCE_LARGE_HEADER_COMMON
473 AML_RESOURCE_SERIAL_COMMON
474 UINT32 ConnectionSpeed;
475 UINT16 SlaveAddress;
477 * Optional fields follow immediately:
478 * 1) Vendor Data bytes
479 * 2) Resource Source String
482 } AML_RESOURCE_I2C_SERIALBUS;
484 #define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */
485 #define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */
486 #define AML_RESOURCE_I2C_MIN_DATA_LEN 6
488 typedef struct aml_resource_spi_serialbus
490 AML_RESOURCE_LARGE_HEADER_COMMON
491 AML_RESOURCE_SERIAL_COMMON
492 UINT32 ConnectionSpeed;
493 UINT8 DataBitLength;
494 UINT8 ClockPhase;
495 UINT8 ClockPolarity;
496 UINT16 DeviceSelection;
498 * Optional fields follow immediately:
499 * 1) Vendor Data bytes
500 * 2) Resource Source String
503 } AML_RESOURCE_SPI_SERIALBUS;
505 #define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */
506 #define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */
507 #define AML_RESOURCE_SPI_MIN_DATA_LEN 9
510 typedef struct aml_resource_uart_serialbus
512 AML_RESOURCE_LARGE_HEADER_COMMON
513 AML_RESOURCE_SERIAL_COMMON
514 UINT32 DefaultBaudRate;
515 UINT16 RxFifoSize;
516 UINT16 TxFifoSize;
517 UINT8 Parity;
518 UINT8 LinesEnabled;
520 * Optional fields follow immediately:
521 * 1) Vendor Data bytes
522 * 2) Resource Source String
525 } AML_RESOURCE_UART_SERIALBUS;
527 #define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */
528 #define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */
529 #define AML_RESOURCE_UART_MIN_DATA_LEN 10
532 /* restore default alignment */
534 #pragma pack()
536 /* Union of all resource descriptors, so we can allocate the worst case */
538 typedef union aml_resource
540 /* Descriptor headers */
542 UINT8 DescriptorType;
543 AML_RESOURCE_SMALL_HEADER SmallHeader;
544 AML_RESOURCE_LARGE_HEADER LargeHeader;
546 /* Small resource descriptors */
548 AML_RESOURCE_IRQ Irq;
549 AML_RESOURCE_DMA Dma;
550 AML_RESOURCE_START_DEPENDENT StartDpf;
551 AML_RESOURCE_END_DEPENDENT EndDpf;
552 AML_RESOURCE_IO Io;
553 AML_RESOURCE_FIXED_IO FixedIo;
554 AML_RESOURCE_FIXED_DMA FixedDma;
555 AML_RESOURCE_VENDOR_SMALL VendorSmall;
556 AML_RESOURCE_END_TAG EndTag;
558 /* Large resource descriptors */
560 AML_RESOURCE_MEMORY24 Memory24;
561 AML_RESOURCE_GENERIC_REGISTER GenericReg;
562 AML_RESOURCE_VENDOR_LARGE VendorLarge;
563 AML_RESOURCE_MEMORY32 Memory32;
564 AML_RESOURCE_FIXED_MEMORY32 FixedMemory32;
565 AML_RESOURCE_ADDRESS16 Address16;
566 AML_RESOURCE_ADDRESS32 Address32;
567 AML_RESOURCE_ADDRESS64 Address64;
568 AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
569 AML_RESOURCE_EXTENDED_IRQ ExtendedIrq;
570 AML_RESOURCE_GPIO Gpio;
571 AML_RESOURCE_I2C_SERIALBUS I2cSerialBus;
572 AML_RESOURCE_SPI_SERIALBUS SpiSerialBus;
573 AML_RESOURCE_UART_SERIALBUS UartSerialBus;
574 AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus;
576 /* Utility overlays */
578 AML_RESOURCE_ADDRESS Address;
579 UINT32 DwordItem;
580 UINT16 WordItem;
581 UINT8 ByteItem;
583 } AML_RESOURCE;
586 /* Interfaces used by both the disassembler and compiler */
588 void
589 MpSaveGpioInfo (
590 ACPI_PARSE_OBJECT *Op,
591 AML_RESOURCE *Resource,
592 UINT32 PinCount,
593 UINT16 *PinList,
594 char *DeviceName);
596 void
597 MpSaveSerialInfo (
598 ACPI_PARSE_OBJECT *Op,
599 AML_RESOURCE *Resource,
600 char *DeviceName);
602 char *
603 MpGetHidFromParseTree (
604 ACPI_NAMESPACE_NODE *HidNode);
606 char *
607 MpGetHidViaNamestring (
608 char *DeviceName);
610 char *
611 MpGetConnectionInfo (
612 ACPI_PARSE_OBJECT *Op,
613 UINT32 PinIndex,
614 ACPI_NAMESPACE_NODE **TargetNode,
615 char **TargetName);
617 char *
618 MpGetParentDeviceHid (
619 ACPI_PARSE_OBJECT *Op,
620 ACPI_NAMESPACE_NODE **TargetNode,
621 char **ParentDeviceName);
623 char *
624 MpGetDdnValue (
625 char *DeviceName);
627 char *
628 MpGetHidValue (
629 ACPI_NAMESPACE_NODE *DeviceNode);
631 #endif