xref: /titanic_52/usr/src/uts/intel/sys/acpi/acresrc.h (revision 2a8d6eba033e4713ab12b61178f0513f1f075482)
1 /******************************************************************************
2  *
3  * Name: acresrc.h - Resource Manager function prototypes
4  *       $Revision: 1.62 $
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26 
27  * make derivatives, distribute, use and display any portion of the Covered
28  * Code in any form, with the right to sublicense such rights; and
29  *
30  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31  * license (with the right to sublicense), under only those claims of Intel
32  * patents that are infringed by the Original Intel Code, to make, use, sell,
33  * offer to sell, and import the Covered Code and derivative works thereof
34  * solely to the minimum extent necessary to exercise the above copyright
35  * license, and in no event shall the patent license extend to any additions
36  * to or modifications of the Original Intel Code.  No other license or right
37  * is granted directly or by implication, estoppel or otherwise;
38  *
39  * The above copyright and patent license is granted only if the following
40  * conditions are met:
41  *
42  * 3. Conditions
43  *
44  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45  * Redistribution of source code of any substantial portion of the Covered
46  * Code or modification with rights to further distribute source must include
47  * the above Copyright Notice, the above License, this list of Conditions,
48  * and the following Disclaimer and Export Compliance provision.  In addition,
49  * Licensee must cause all Covered Code to which Licensee contributes to
50  * contain a file documenting the changes Licensee made to create that Covered
51  * Code and the date of any change.  Licensee must include in that file the
52  * documentation of any changes made by any predecessor Licensee.  Licensee
53  * must include a prominent statement that the modification is derived,
54  * directly or indirectly, from Original Intel Code.
55  *
56  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57  * Redistribution of source code of any substantial portion of the Covered
58  * Code or modification without rights to further distribute source must
59  * include the following Disclaimer and Export Compliance provision in the
60  * documentation and/or other materials provided with distribution.  In
61  * addition, Licensee may not authorize further sublicense of source of any
62  * portion of the Covered Code, and must include terms to the effect that the
63  * license from Licensee to its licensee is limited to the intellectual
64  * property embodied in the software Licensee provides to its licensee, and
65  * not to intellectual property embodied in modifications its licensee may
66  * make.
67  *
68  * 3.3. Redistribution of Executable. Redistribution in executable form of any
69  * substantial portion of the Covered Code or modification must reproduce the
70  * above Copyright Notice, and the following Disclaimer and Export Compliance
71  * provision in the documentation and/or other materials provided with the
72  * distribution.
73  *
74  * 3.4. Intel retains all right, title, and interest in and to the Original
75  * Intel Code.
76  *
77  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78  * Intel shall be used in advertising or otherwise to promote the sale, use or
79  * other dealings in products derived from or relating to the Covered Code
80  * without prior written authorization from Intel.
81  *
82  * 4. Disclaimer and Export Compliance
83  *
84  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90  * PARTICULAR PURPOSE.
91  *
92  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99  * LIMITED REMEDY.
100  *
101  * 4.3. Licensee shall not export, either directly or indirectly, any of this
102  * software or system incorporating such software without first obtaining any
103  * required license or other approval from the U. S. Department of Commerce or
104  * any other agency or department of the United States Government.  In the
105  * event Licensee exports any such software from the United States or
106  * re-exports any such software from a foreign destination, Licensee shall
107  * ensure that the distribution and export/re-export of the software is in
108  * compliance with all laws, regulations, orders, or other restrictions of the
109  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110  * any of its subsidiaries will export/re-export any technical data, process,
111  * software, or service, directly or indirectly, to any country for which the
112  * United States government or any agency thereof requires an export license,
113  * other governmental approval, or letter of assurance, without first obtaining
114  * such license, approval or letter.
115  *
116  *****************************************************************************/
117 
118 #ifndef __ACRESRC_H__
119 #define __ACRESRC_H__
120 
121 /* Need the AML resource descriptor structs */
122 
123 #include "amlresrc.h"
124 
125 
126 /*
127  * If possible, pack the following structures to byte alignment, since we
128  * don't care about performance for debug output. Two cases where we cannot
129  * pack the structures:
130  *
131  * 1) Hardware does not support misaligned memory transfers
132  * 2) Compiler does not support pointers within packed structures
133  */
134 #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
135 #pragma pack(1)
136 #endif
137 
138 /*
139  * Individual entry for the resource conversion tables
140  */
141 typedef const struct acpi_rsconvert_info
142 {
143     UINT8                   Opcode;
144     UINT8                   ResourceOffset;
145     UINT8                   AmlOffset;
146     UINT8                   Value;
147 
148 } ACPI_RSCONVERT_INFO;
149 
150 /* Resource conversion opcodes */
151 
152 #define ACPI_RSC_INITGET                0
153 #define ACPI_RSC_INITSET                1
154 #define ACPI_RSC_FLAGINIT               2
155 #define ACPI_RSC_1BITFLAG               3
156 #define ACPI_RSC_2BITFLAG               4
157 #define ACPI_RSC_COUNT                  5
158 #define ACPI_RSC_COUNT16                6
159 #define ACPI_RSC_LENGTH                 7
160 #define ACPI_RSC_MOVE8                  8
161 #define ACPI_RSC_MOVE16                 9
162 #define ACPI_RSC_MOVE32                 10
163 #define ACPI_RSC_MOVE64                 11
164 #define ACPI_RSC_SET8                   12
165 #define ACPI_RSC_DATA8                  13
166 #define ACPI_RSC_ADDRESS                14
167 #define ACPI_RSC_SOURCE                 15
168 #define ACPI_RSC_SOURCEX                16
169 #define ACPI_RSC_BITMASK                17
170 #define ACPI_RSC_BITMASK16              18
171 #define ACPI_RSC_EXIT_NE                19
172 #define ACPI_RSC_EXIT_LE                20
173 #define ACPI_RSC_EXIT_EQ                21
174 
175 /* Resource Conversion sub-opcodes */
176 
177 #define ACPI_RSC_COMPARE_AML_LENGTH     0
178 #define ACPI_RSC_COMPARE_VALUE          1
179 
180 #define ACPI_RSC_TABLE_SIZE(d)          (sizeof (d) / sizeof (ACPI_RSCONVERT_INFO))
181 
182 #define ACPI_RS_OFFSET(f)               (UINT8) ACPI_OFFSET (ACPI_RESOURCE,f)
183 #define AML_OFFSET(f)                   (UINT8) ACPI_OFFSET (AML_RESOURCE,f)
184 
185 
186 typedef const struct acpi_rsdump_info
187 {
188     UINT8                   Opcode;
189     UINT8                   Offset;
190     char                    *Name;
191     const char              **Pointer;
192 
193 } ACPI_RSDUMP_INFO;
194 
195 /* Values for the Opcode field above */
196 
197 #define ACPI_RSD_TITLE                  0
198 #define ACPI_RSD_LITERAL                1
199 #define ACPI_RSD_STRING                 2
200 #define ACPI_RSD_UINT8                  3
201 #define ACPI_RSD_UINT16                 4
202 #define ACPI_RSD_UINT32                 5
203 #define ACPI_RSD_UINT64                 6
204 #define ACPI_RSD_1BITFLAG               7
205 #define ACPI_RSD_2BITFLAG               8
206 #define ACPI_RSD_SHORTLIST              9
207 #define ACPI_RSD_LONGLIST               10
208 #define ACPI_RSD_DWORDLIST              11
209 #define ACPI_RSD_ADDRESS                12
210 #define ACPI_RSD_SOURCE                 13
211 
212 /* restore default alignment */
213 
214 #pragma pack()
215 
216 
217 /* Resource tables indexed by internal resource type */
218 
219 extern const UINT8              AcpiGbl_AmlResourceSizes[];
220 extern ACPI_RSCONVERT_INFO      *AcpiGbl_SetResourceDispatch[];
221 
222 /* Resource tables indexed by raw AML resource descriptor type */
223 
224 extern const UINT8              AcpiGbl_ResourceStructSizes[];
225 extern ACPI_RSCONVERT_INFO      *AcpiGbl_GetResourceDispatch[];
226 
227 
228 typedef struct acpi_vendor_walk_info
229 {
230     ACPI_VENDOR_UUID        *Uuid;
231     ACPI_BUFFER             *Buffer;
232     ACPI_STATUS             Status;
233 
234 } ACPI_VENDOR_WALK_INFO;
235 
236 
237 /*
238  * rscreate
239  */
240 ACPI_STATUS
241 AcpiRsCreateResourceList (
242     ACPI_OPERAND_OBJECT     *AmlBuffer,
243     ACPI_BUFFER             *OutputBuffer);
244 
245 ACPI_STATUS
246 AcpiRsCreateAmlResources (
247     ACPI_RESOURCE           *LinkedListBuffer,
248     ACPI_BUFFER             *OutputBuffer);
249 
250 ACPI_STATUS
251 AcpiRsCreatePciRoutingTable (
252     ACPI_OPERAND_OBJECT     *PackageObject,
253     ACPI_BUFFER             *OutputBuffer);
254 
255 
256 /*
257  * rsutils
258  */
259 ACPI_STATUS
260 AcpiRsGetPrtMethodData (
261     ACPI_NAMESPACE_NODE     *Node,
262     ACPI_BUFFER             *RetBuffer);
263 
264 ACPI_STATUS
265 AcpiRsGetCrsMethodData (
266     ACPI_NAMESPACE_NODE     *Node,
267     ACPI_BUFFER             *RetBuffer);
268 
269 ACPI_STATUS
270 AcpiRsGetPrsMethodData (
271     ACPI_NAMESPACE_NODE     *Node,
272     ACPI_BUFFER             *RetBuffer);
273 
274 ACPI_STATUS
275 AcpiRsGetMethodData (
276     ACPI_HANDLE             Handle,
277     char                    *Path,
278     ACPI_BUFFER             *RetBuffer);
279 
280 ACPI_STATUS
281 AcpiRsSetSrsMethodData (
282     ACPI_NAMESPACE_NODE     *Node,
283     ACPI_BUFFER             *RetBuffer);
284 
285 
286 /*
287  * rscalc
288  */
289 ACPI_STATUS
290 AcpiRsGetListLength (
291     UINT8                   *AmlBuffer,
292     UINT32                  AmlBufferLength,
293     ACPI_SIZE               *SizeNeeded);
294 
295 ACPI_STATUS
296 AcpiRsGetAmlLength (
297     ACPI_RESOURCE           *LinkedListBuffer,
298     ACPI_SIZE               *SizeNeeded);
299 
300 ACPI_STATUS
301 AcpiRsGetPciRoutingTableLength (
302     ACPI_OPERAND_OBJECT     *PackageObject,
303     ACPI_SIZE               *BufferSizeNeeded);
304 
305 ACPI_STATUS
306 AcpiRsConvertAmlToResources (
307     UINT8                   *Aml,
308     UINT32                  Length,
309     UINT32                  Offset,
310     UINT8                   ResourceIndex,
311     void                    *Context);
312 
313 ACPI_STATUS
314 AcpiRsConvertResourcesToAml (
315     ACPI_RESOURCE           *Resource,
316     ACPI_SIZE               AmlSizeNeeded,
317     UINT8                   *OutputBuffer);
318 
319 
320 /*
321  * rsaddr
322  */
323 void
324 AcpiRsSetAddressCommon (
325     AML_RESOURCE            *Aml,
326     ACPI_RESOURCE           *Resource);
327 
328 BOOLEAN
329 AcpiRsGetAddressCommon (
330     ACPI_RESOURCE           *Resource,
331     AML_RESOURCE            *Aml);
332 
333 
334 /*
335  * rsmisc
336  */
337 ACPI_STATUS
338 AcpiRsConvertAmlToResource (
339     ACPI_RESOURCE           *Resource,
340     AML_RESOURCE            *Aml,
341     ACPI_RSCONVERT_INFO     *Info);
342 
343 ACPI_STATUS
344 AcpiRsConvertResourceToAml (
345     ACPI_RESOURCE           *Resource,
346     AML_RESOURCE            *Aml,
347     ACPI_RSCONVERT_INFO     *Info);
348 
349 
350 /*
351  * rsutils
352  */
353 void
354 AcpiRsMoveData (
355     void                    *Destination,
356     void                    *Source,
357     UINT16                  ItemCount,
358     UINT8                   MoveType);
359 
360 UINT8
361 AcpiRsDecodeBitmask (
362     UINT16                  Mask,
363     UINT8                   *List);
364 
365 UINT16
366 AcpiRsEncodeBitmask (
367     UINT8                   *List,
368     UINT8                   Count);
369 
370 ACPI_RS_LENGTH
371 AcpiRsGetResourceSource (
372     ACPI_RS_LENGTH          ResourceLength,
373     ACPI_RS_LENGTH          MinimumLength,
374     ACPI_RESOURCE_SOURCE    *ResourceSource,
375     AML_RESOURCE            *Aml,
376     char                    *StringPtr);
377 
378 ACPI_RSDESC_SIZE
379 AcpiRsSetResourceSource (
380     AML_RESOURCE            *Aml,
381     ACPI_RS_LENGTH          MinimumLength,
382     ACPI_RESOURCE_SOURCE    *ResourceSource);
383 
384 void
385 AcpiRsSetResourceHeader (
386     UINT8                   DescriptorType,
387     ACPI_RSDESC_SIZE        TotalLength,
388     AML_RESOURCE            *Aml);
389 
390 void
391 AcpiRsSetResourceLength (
392     ACPI_RSDESC_SIZE        TotalLength,
393     AML_RESOURCE            *Aml);
394 
395 
396 /*
397  * rsdump
398  */
399 void
400 AcpiRsDumpResourceList (
401     ACPI_RESOURCE           *Resource);
402 
403 void
404 AcpiRsDumpIrqList (
405     UINT8                   *RouteTable);
406 
407 
408 /*
409  * Resource conversion tables
410  */
411 extern ACPI_RSCONVERT_INFO      AcpiRsConvertDma[];
412 extern ACPI_RSCONVERT_INFO      AcpiRsConvertEndDpf[];
413 extern ACPI_RSCONVERT_INFO      AcpiRsConvertIo[];
414 extern ACPI_RSCONVERT_INFO      AcpiRsConvertFixedIo[];
415 extern ACPI_RSCONVERT_INFO      AcpiRsConvertEndTag[];
416 extern ACPI_RSCONVERT_INFO      AcpiRsConvertMemory24[];
417 extern ACPI_RSCONVERT_INFO      AcpiRsConvertGenericReg[];
418 extern ACPI_RSCONVERT_INFO      AcpiRsConvertMemory32[];
419 extern ACPI_RSCONVERT_INFO      AcpiRsConvertFixedMemory32[];
420 extern ACPI_RSCONVERT_INFO      AcpiRsConvertAddress32[];
421 extern ACPI_RSCONVERT_INFO      AcpiRsConvertAddress16[];
422 extern ACPI_RSCONVERT_INFO      AcpiRsConvertExtIrq[];
423 extern ACPI_RSCONVERT_INFO      AcpiRsConvertAddress64[];
424 extern ACPI_RSCONVERT_INFO      AcpiRsConvertExtAddress64[];
425 
426 /* These resources require separate get/set tables */
427 
428 extern ACPI_RSCONVERT_INFO      AcpiRsGetIrq[];
429 extern ACPI_RSCONVERT_INFO      AcpiRsGetStartDpf[];
430 extern ACPI_RSCONVERT_INFO      AcpiRsGetVendorSmall[];
431 extern ACPI_RSCONVERT_INFO      AcpiRsGetVendorLarge[];
432 
433 extern ACPI_RSCONVERT_INFO      AcpiRsSetIrq[];
434 extern ACPI_RSCONVERT_INFO      AcpiRsSetStartDpf[];
435 extern ACPI_RSCONVERT_INFO      AcpiRsSetVendor[];
436 
437 
438 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
439 /*
440  * rsinfo
441  */
442 extern ACPI_RSDUMP_INFO         *AcpiGbl_DumpResourceDispatch[];
443 
444 /*
445  * rsdump
446  */
447 extern ACPI_RSDUMP_INFO         AcpiRsDumpIrq[];
448 extern ACPI_RSDUMP_INFO         AcpiRsDumpDma[];
449 extern ACPI_RSDUMP_INFO         AcpiRsDumpStartDpf[];
450 extern ACPI_RSDUMP_INFO         AcpiRsDumpEndDpf[];
451 extern ACPI_RSDUMP_INFO         AcpiRsDumpIo[];
452 extern ACPI_RSDUMP_INFO         AcpiRsDumpFixedIo[];
453 extern ACPI_RSDUMP_INFO         AcpiRsDumpVendor[];
454 extern ACPI_RSDUMP_INFO         AcpiRsDumpEndTag[];
455 extern ACPI_RSDUMP_INFO         AcpiRsDumpMemory24[];
456 extern ACPI_RSDUMP_INFO         AcpiRsDumpMemory32[];
457 extern ACPI_RSDUMP_INFO         AcpiRsDumpFixedMemory32[];
458 extern ACPI_RSDUMP_INFO         AcpiRsDumpAddress16[];
459 extern ACPI_RSDUMP_INFO         AcpiRsDumpAddress32[];
460 extern ACPI_RSDUMP_INFO         AcpiRsDumpAddress64[];
461 extern ACPI_RSDUMP_INFO         AcpiRsDumpExtAddress64[];
462 extern ACPI_RSDUMP_INFO         AcpiRsDumpExtIrq[];
463 extern ACPI_RSDUMP_INFO         AcpiRsDumpGenericReg[];
464 #endif
465 
466 #endif  /* __ACRESRC_H__ */
467