xref: /titanic_41/usr/src/uts/intel/sys/acpi/acresrc.h (revision 6be356c5780a1ccb886bba08d6eb56b61f021564)
1 /******************************************************************************
2  *
3  * Name: acresrc.h - Resource Manager function prototypes
4  *       $Revision: 1.48 $
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2005, 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  * Resource dispatch and info tables
128  */
129 typedef struct acpi_resource_info
130 {
131     UINT8                   LengthType;
132     UINT8                   MinimumAmlResourceLength;
133     UINT8                   MinimumInternalStructLength;
134 
135 } ACPI_RESOURCE_INFO;
136 
137 /* Types for LengthType above */
138 
139 #define ACPI_FIXED_LENGTH           0
140 #define ACPI_VARIABLE_LENGTH        1
141 #define ACPI_SMALL_VARIABLE_LENGTH  2
142 
143 /* Handlers */
144 
145 typedef ACPI_STATUS (*ACPI_SET_RESOURCE_HANDLER) (
146     ACPI_RESOURCE           *Resource,
147     AML_RESOURCE            *Aml);
148 
149 typedef ACPI_STATUS (*ACPI_GET_RESOURCE_HANDLER) (
150     AML_RESOURCE            *Aml,
151     UINT16                  AmlResourceLength,
152     ACPI_RESOURCE           *Resource);
153 
154 typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (
155     ACPI_RESOURCE_DATA      *Data);
156 
157 /* Tables indexed by internal resource type */
158 
159 extern UINT8                        AcpiGbl_AmlResourceSizes[];
160 extern ACPI_SET_RESOURCE_HANDLER    AcpiGbl_SetResourceDispatch[];
161 extern ACPI_DUMP_RESOURCE_HANDLER   AcpiGbl_DumpResourceDispatch[];
162 
163 /* Tables indexed by raw AML resource descriptor type */
164 
165 extern ACPI_RESOURCE_INFO           AcpiGbl_SmResourceInfo[];
166 extern ACPI_RESOURCE_INFO           AcpiGbl_LgResourceInfo[];
167 extern ACPI_GET_RESOURCE_HANDLER    AcpiGbl_SmGetResourceDispatch[];
168 extern ACPI_GET_RESOURCE_HANDLER    AcpiGbl_LgGetResourceDispatch[];
169 
170 
171 /*
172  *  Function prototypes called from Acpi* APIs
173  */
174 ACPI_STATUS
175 AcpiRsGetPrtMethodData (
176     ACPI_HANDLE             Handle,
177     ACPI_BUFFER             *RetBuffer);
178 
179 ACPI_STATUS
180 AcpiRsGetCrsMethodData (
181     ACPI_HANDLE             Handle,
182     ACPI_BUFFER             *RetBuffer);
183 
184 ACPI_STATUS
185 AcpiRsGetPrsMethodData (
186     ACPI_HANDLE             Handle,
187     ACPI_BUFFER             *RetBuffer);
188 
189 ACPI_STATUS
190 AcpiRsGetMethodData (
191     ACPI_HANDLE             Handle,
192     char                    *Path,
193     ACPI_BUFFER             *RetBuffer);
194 
195 ACPI_STATUS
196 AcpiRsSetSrsMethodData (
197     ACPI_HANDLE             Handle,
198     ACPI_BUFFER             *RetBuffer);
199 
200 ACPI_STATUS
201 AcpiRsCreateResourceList (
202     ACPI_OPERAND_OBJECT     *AmlBuffer,
203     ACPI_BUFFER             *OutputBuffer);
204 
205 ACPI_STATUS
206 AcpiRsCreateAmlResources (
207     ACPI_RESOURCE           *LinkedListBuffer,
208     ACPI_BUFFER             *OutputBuffer);
209 
210 ACPI_STATUS
211 AcpiRsCreatePciRoutingTable (
212     ACPI_OPERAND_OBJECT     *PackageObject,
213     ACPI_BUFFER             *OutputBuffer);
214 
215 
216 /*
217  * rsdump
218  */
219 void
220 AcpiRsDumpResourceList (
221     ACPI_RESOURCE           *Resource);
222 
223 void
224 AcpiRsDumpIrqList (
225     UINT8                   *RouteTable);
226 
227 
228 /*
229  * rscalc
230  */
231 ACPI_STATUS
232 AcpiRsGetListLength (
233     UINT8                   *AmlBuffer,
234     UINT32                  AmlBufferLength,
235     ACPI_SIZE               *SizeNeeded);
236 
237 ACPI_STATUS
238 AcpiRsGetAmlLength (
239     ACPI_RESOURCE           *LinkedListBuffer,
240     ACPI_SIZE               *SizeNeeded);
241 
242 ACPI_STATUS
243 AcpiRsGetPciRoutingTableLength (
244     ACPI_OPERAND_OBJECT     *PackageObject,
245     ACPI_SIZE               *BufferSizeNeeded);
246 
247 ACPI_STATUS
248 AcpiRsConvertAmlToResources (
249     UINT8                   *AmlBuffer,
250     UINT32                  AmlBufferLength,
251     UINT8                   *OutputBuffer);
252 
253 ACPI_STATUS
254 AcpiRsConvertResourcesToAml (
255     ACPI_RESOURCE           *Resource,
256     ACPI_SIZE               AmlSizeNeeded,
257     UINT8                   *OutputBuffer);
258 
259 
260 /*
261  * rsio
262  */
263 ACPI_STATUS
264 AcpiRsGetIo (
265     AML_RESOURCE            *Aml,
266     UINT16                  AmlResourceLength,
267     ACPI_RESOURCE           *Resource);
268 
269 ACPI_STATUS
270 AcpiRsSetIo (
271     ACPI_RESOURCE           *Resource,
272     AML_RESOURCE            *Aml);
273 
274 ACPI_STATUS
275 AcpiRsGetFixedIo (
276     AML_RESOURCE            *Aml,
277     UINT16                  AmlResourceLength,
278     ACPI_RESOURCE           *Resource);
279 
280 ACPI_STATUS
281 AcpiRsSetFixedIo (
282     ACPI_RESOURCE           *Resource,
283     AML_RESOURCE            *Aml);
284 
285 ACPI_STATUS
286 AcpiRsGetDma (
287     AML_RESOURCE            *Aml,
288     UINT16                  AmlResourceLength,
289     ACPI_RESOURCE           *Resource);
290 
291 ACPI_STATUS
292 AcpiRsSetDma (
293     ACPI_RESOURCE           *Resource,
294     AML_RESOURCE            *Aml);
295 
296 
297 /*
298  * rsirq
299  */
300 ACPI_STATUS
301 AcpiRsGetIrq (
302     AML_RESOURCE            *Aml,
303     UINT16                  AmlResourceLength,
304     ACPI_RESOURCE           *Resource);
305 
306 ACPI_STATUS
307 AcpiRsSetIrq (
308     ACPI_RESOURCE           *Resource,
309     AML_RESOURCE            *Aml);
310 
311 ACPI_STATUS
312 AcpiRsGetExtIrq (
313     AML_RESOURCE            *Aml,
314     UINT16                  AmlResourceLength,
315     ACPI_RESOURCE           *Resource);
316 
317 ACPI_STATUS
318 AcpiRsSetExtIrq (
319     ACPI_RESOURCE           *Resource,
320     AML_RESOURCE            *Aml);
321 
322 
323 /*
324  * rsaddr
325  */
326 ACPI_STATUS
327 AcpiRsGetAddress16 (
328     AML_RESOURCE            *Aml,
329     UINT16                  AmlResourceLength,
330     ACPI_RESOURCE           *Resource);
331 
332 ACPI_STATUS
333 AcpiRsSetAddress16 (
334     ACPI_RESOURCE           *Resource,
335     AML_RESOURCE            *Aml);
336 
337 ACPI_STATUS
338 AcpiRsGetAddress32 (
339     AML_RESOURCE            *Aml,
340     UINT16                  AmlResourceLength,
341     ACPI_RESOURCE           *Resource);
342 
343 ACPI_STATUS
344 AcpiRsSetAddress32 (
345     ACPI_RESOURCE           *Resource,
346     AML_RESOURCE            *Aml);
347 
348 ACPI_STATUS
349 AcpiRsGetAddress64 (
350     AML_RESOURCE            *Aml,
351     UINT16                  AmlResourceLength,
352     ACPI_RESOURCE           *Resource);
353 
354 ACPI_STATUS
355 AcpiRsSetAddress64 (
356     ACPI_RESOURCE           *Resource,
357     AML_RESOURCE            *Aml);
358 
359 ACPI_STATUS
360 AcpiRsGetExtAddress64 (
361     AML_RESOURCE            *Aml,
362     UINT16                  AmlResourceLength,
363     ACPI_RESOURCE           *Resource);
364 
365 ACPI_STATUS
366 AcpiRsSetExtAddress64 (
367     ACPI_RESOURCE           *Resource,
368     AML_RESOURCE            *Aml);
369 
370 
371 /*
372  * rsmemory
373  */
374 ACPI_STATUS
375 AcpiRsGetMemory24 (
376     AML_RESOURCE            *Aml,
377     UINT16                  AmlResourceLength,
378     ACPI_RESOURCE           *Resource);
379 
380 ACPI_STATUS
381 AcpiRsSetMemory24 (
382     ACPI_RESOURCE           *Resource,
383     AML_RESOURCE            *Aml);
384 
385 ACPI_STATUS
386 AcpiRsGetMemory32 (
387     AML_RESOURCE            *Aml,
388     UINT16                  AmlResourceLength,
389     ACPI_RESOURCE           *Resource);
390 
391 ACPI_STATUS
392 AcpiRsSetMemory32 (
393     ACPI_RESOURCE           *Resource,
394     AML_RESOURCE            *Aml);
395 
396 ACPI_STATUS
397 AcpiRsGetFixedMemory32 (
398     AML_RESOURCE            *Aml,
399     UINT16                  AmlResourceLength,
400     ACPI_RESOURCE           *Resource);
401 
402 ACPI_STATUS
403 AcpiRsSetFixedMemory32 (
404     ACPI_RESOURCE           *Resource,
405     AML_RESOURCE            *Aml);
406 
407 
408 /*
409  * rsmisc
410  */
411 ACPI_STATUS
412 AcpiRsGetGenericReg (
413     AML_RESOURCE            *Aml,
414     UINT16                  AmlResourceLength,
415     ACPI_RESOURCE           *Resource);
416 
417 ACPI_STATUS
418 AcpiRsSetGenericReg (
419     ACPI_RESOURCE           *Resource,
420     AML_RESOURCE            *Aml);
421 
422 ACPI_STATUS
423 AcpiRsGetVendor (
424     AML_RESOURCE            *Aml,
425     UINT16                  AmlResourceLength,
426     ACPI_RESOURCE           *Resource);
427 
428 ACPI_STATUS
429 AcpiRsSetVendor (
430     ACPI_RESOURCE           *Resource,
431     AML_RESOURCE            *Aml);
432 
433 ACPI_STATUS
434 AcpiRsGetStartDpf (
435     AML_RESOURCE            *Aml,
436     UINT16                  AmlResourceLength,
437     ACPI_RESOURCE           *Resource);
438 
439 ACPI_STATUS
440 AcpiRsSetStartDpf (
441     ACPI_RESOURCE           *Resource,
442     AML_RESOURCE            *Aml);
443 
444 ACPI_STATUS
445 AcpiRsGetEndDpf (
446     AML_RESOURCE            *Aml,
447     UINT16                  AmlResourceLength,
448     ACPI_RESOURCE           *Resource);
449 
450 ACPI_STATUS
451 AcpiRsSetEndDpf (
452     ACPI_RESOURCE           *Resource,
453     AML_RESOURCE            *Aml);
454 
455 ACPI_STATUS
456 AcpiRsGetEndTag (
457     AML_RESOURCE            *Aml,
458     UINT16                  AmlResourceLength,
459     ACPI_RESOURCE           *Resource);
460 
461 ACPI_STATUS
462 AcpiRsSetEndTag (
463     ACPI_RESOURCE           *Resource,
464     AML_RESOURCE            *Aml);
465 
466 /*
467  * rsutils
468  */
469 void
470 AcpiRsMoveData (
471     void                    *Destination,
472     void                    *Source,
473     UINT16                  ItemCount,
474     UINT8                   MoveType);
475 
476 /* Types used in MoveType above */
477 
478 #define ACPI_MOVE_TYPE_16_TO_32        0
479 #define ACPI_MOVE_TYPE_32_TO_16        1
480 #define ACPI_MOVE_TYPE_32_TO_32        2
481 #define ACPI_MOVE_TYPE_64_TO_64        3
482 
483 
484 UINT16
485 AcpiRsGetResourceSource (
486     UINT16                  ResourceLength,
487     ACPI_SIZE               MinimumLength,
488     ACPI_RESOURCE_SOURCE    *ResourceSource,
489     AML_RESOURCE            *Aml,
490     char                    *StringPtr);
491 
492 ACPI_SIZE
493 AcpiRsSetResourceSource (
494     AML_RESOURCE            *Aml,
495     ACPI_SIZE               MinimumLength,
496     ACPI_RESOURCE_SOURCE    *ResourceSource);
497 
498 UINT8
499 AcpiRsGetResourceType (
500     UINT8                   ResourceStartByte);
501 
502 UINT32
503 AcpiRsGetDescriptorLength (
504     AML_RESOURCE            *Aml);
505 
506 UINT16
507 AcpiRsGetResourceLength (
508     AML_RESOURCE            *Aml);
509 
510 void
511 AcpiRsSetResourceHeader (
512     UINT8                   DescriptorType,
513     ACPI_SIZE               TotalLength,
514     AML_RESOURCE            *Aml);
515 
516 ACPI_RESOURCE_INFO *
517 AcpiRsGetResourceInfo (
518     UINT8                   ResourceType);
519 
520 
521 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
522 /*
523  * rsdump
524  */
525 void
526 AcpiRsDumpIrq (
527     ACPI_RESOURCE_DATA      *Resource);
528 
529 void
530 AcpiRsDumpAddress16 (
531     ACPI_RESOURCE_DATA      *Resource);
532 
533 void
534 AcpiRsDumpAddress32 (
535     ACPI_RESOURCE_DATA      *Resource);
536 
537 void
538 AcpiRsDumpAddress64 (
539     ACPI_RESOURCE_DATA      *Resource);
540 
541 void
542 AcpiRsDumpExtAddress64 (
543     ACPI_RESOURCE_DATA      *Resource);
544 
545 void
546 AcpiRsDumpDma (
547     ACPI_RESOURCE_DATA      *Resource);
548 
549 void
550 AcpiRsDumpIo (
551     ACPI_RESOURCE_DATA      *Resource);
552 
553 void
554 AcpiRsDumpExtIrq (
555     ACPI_RESOURCE_DATA      *Resource);
556 
557 void
558 AcpiRsDumpFixedIo (
559     ACPI_RESOURCE_DATA      *Resource);
560 
561 void
562 AcpiRsDumpFixedMemory32 (
563     ACPI_RESOURCE_DATA      *Resource);
564 
565 void
566 AcpiRsDumpMemory24 (
567     ACPI_RESOURCE_DATA      *Resource);
568 
569 void
570 AcpiRsDumpMemory32 (
571     ACPI_RESOURCE_DATA      *Resource);
572 
573 void
574 AcpiRsDumpStartDpf (
575     ACPI_RESOURCE_DATA      *Resource);
576 
577 void
578 AcpiRsDumpVendor (
579     ACPI_RESOURCE_DATA      *Resource);
580 
581 void
582 AcpiRsDumpGenericReg (
583     ACPI_RESOURCE_DATA      *Resource);
584 
585 void
586 AcpiRsDumpEndDpf (
587     ACPI_RESOURCE_DATA      *Resource);
588 
589 void
590 AcpiRsDumpEndTag (
591     ACPI_RESOURCE_DATA      *Resource);
592 
593 #endif
594 
595 #endif  /* __ACRESRC_H__ */
596