Debian Codegraph @

source/compiler/dtcompile.c

raw symbols SCIP
1 /******************************************************************************
2 *
3 * Module Name: dtcompile.c - Front-end for data table compiler
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2026, 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 MERCHANTABILITY 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 #define _DECLARE_DT_GLOBALS
45
46 #include "aslcompiler.h"
47
48 #define _COMPONENT DT_COMPILER
49 ACPI_MODULE_NAME ("dtcompile")
50
51 static char VersionString[9];
52
53
54 /* Local prototypes */
55
56 void
57 DtInitialize (
58 void);
59
60 static ACPI_STATUS
61 DtCompileDataTable (
62 DT_FIELD **Field);
63
64 static void
65 DtInsertCompilerIds (
66 DT_FIELD *FieldList);
67
68
69 /******************************************************************************
70 *
71 * FUNCTION: DtDoCompile
72 *
73 * PARAMETERS: None
74 *
75 * RETURN: Status
76 *
77 * DESCRIPTION: Main entry point for the data table compiler.
78 *
79 * Note: Assumes AslGbl_Files[ASL_FILE_INPUT] is initialized and the file is
80 * open at seek offset zero.
81 *
82 *****************************************************************************/
83
84 ACPI_STATUS
85 DtDoCompile (
86 void)
87 {
88 ACPI_STATUS Status;
89 UINT8 Event;
90 DT_FIELD *FieldList;
91 ASL_GLOBAL_FILE_NODE *FileNode;
92
93
94 /* Initialize globals */
95
96 DtInitialize ();
97
98 /* Preprocessor */
99
100 if (AslGbl_PreprocessFlag)
101 {
102 /* Preprocessor */
103
104 Event = UtBeginEvent ("Preprocess input file");
105 PrDoPreprocess ();
106 UtEndEvent (Event);
107
108 if (AslGbl_PreprocessOnly)
109 {
110 return (AE_OK);
111 }
112 }
113
114 /* Compile the parse tree */
115
116 if (AslGbl_DtLexBisonPrototype)
117 {
118 Event = UtBeginEvent ("Parse data table in prototype mode");
119
120 DtCompilerInitLexer (AslGbl_Files[ASL_FILE_INPUT].Handle);
121 DtCompilerParserparse ();
122 FieldList = AslGbl_FieldList;
123 DtCompilerTerminateLexer ();
124
125 UtEndEvent (Event);
126 }
127 else
128 {
129 /*
130 * Scan the input file (file is already open) and
131 * build the parse tree
132 */
133 Event = UtBeginEvent ("Scan and parse input file");
134 FieldList = DtScanFile (AslGbl_Files[ASL_FILE_INPUT].Handle);
135 UtEndEvent (Event);
136 }
137
138 /* Did the parse tree get successfully constructed? */
139
140 if (!FieldList)
141 {
142 /* TBD: temporary error message. Msgs should come from function above */
143
144 DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
145 "Input file does not appear to be an ASL or data table source file");
146
147 return (AE_ERROR);
148 }
149
150 Event = UtBeginEvent ("Compile parse tree");
151
152 Status = DtCompileDataTable (&FieldList);
153 UtEndEvent (Event);
154
155 FileNode = FlGetCurrentFileNode ();
156
157 FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
158 FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
159 DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
160 FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
161
162 if (ACPI_FAILURE (Status))
163 {
164 FileNode->ParserErrorDetected = TRUE;
165
166 /* TBD: temporary error message. Msgs should come from function above */
167
168 DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
169 "Could not compile input file");
170
171 return (Status);
172 }
173
174 /* Create/open the binary output file */
175
176 AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
177 Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix);
178 if (ACPI_FAILURE (Status))
179 {
180 return (Status);
181 }
182
183 /* Write the binary, then the optional hex file */
184
185 DtOutputBinary (AslGbl_RootTable);
186 HxDoHexOutput ();
187 DtWriteTableToListing ();
188
189 /* Save the compile time statistics to the current file node */
190
191 FileNode->TotalFields = AslGbl_InputFieldCount;
192 FileNode->OutputByteLength = AslGbl_TableLength;
193
194 return (Status);
195 }
196
197
198 /******************************************************************************
199 *
200 * FUNCTION: DtInitialize
201 *
202 * PARAMETERS: None
203 *
204 * RETURN: Status
205 *
206 * DESCRIPTION: Initialize data table compiler globals. Enables multiple
207 * compiles per invocation.
208 *
209 *****************************************************************************/
210
211 void
212 DtInitialize (
213 void)
214 {
215
216
217 AcpiUtSetIntegerWidth (2); /* Set width to 64 bits */
218
219 AslGbl_FieldList = NULL;
220 AslGbl_RootTable = NULL;
221 AslGbl_SubtableStack = NULL;
222
223 sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
224 return;
225 }
226
227
228 /******************************************************************************
229 *
230 * FUNCTION: DtInsertCompilerIds
231 *
232 * PARAMETERS: FieldList - Current field list pointer
233 *
234 * RETURN: None
235 *
236 * DESCRIPTION: Insert the IDs (Name, Version) of the current compiler into
237 * the original ACPI table header.
238 *
239 *****************************************************************************/
240
241 static void
242 DtInsertCompilerIds (
243 DT_FIELD *FieldList)
244 {
245 DT_FIELD *Next;
246 UINT32 i;
247
248
249 /*
250 * Don't insert current compiler ID if requested. Used for compiler
251 * debug/validation only.
252 */
253 if (AslGbl_UseOriginalCompilerId)
254 {
255 return;
256 }
257
258 /* Walk to the Compiler fields at the end of the header, with safety checks */
259
260 if (!FieldList)
261 {
262 DtError (ASL_WARNING, ASL_MSG_MALFORMED_HEADER, NULL, NULL);
263 return;
264 }
265
266 Next = FieldList;
267 for (i = 0; i < 7; i++)
268 {
269 if (!Next || !Next->Next)
270 {
271 /* Malformed/short header: cannot insert compiler IDs */
272 DtError (ASL_WARNING, ASL_MSG_MALFORMED_HEADER, FieldList, NULL);
273 return;
274 }
275 Next = Next->Next;
276 }
277
278 /* Ensure both Creator ID and Revision fields exist */
279 if (!Next || !Next->Next)
280 {
281 DtError (ASL_WARNING, ASL_MSG_MALFORMED_HEADER, FieldList, NULL);
282 return;
283 }
284
285 Next->Value = ASL_CREATOR_ID;
286 Next->Flags = DT_FIELD_NOT_ALLOCATED;
287
288 Next = Next->Next;
289 if (!Next)
290 {
291 DtError (ASL_WARNING, ASL_MSG_MALFORMED_HEADER, FieldList, NULL);
292 return;
293 }
294 Next->Value = VersionString;
295 Next->Flags = DT_FIELD_NOT_ALLOCATED;
296 }
297
298
299 /******************************************************************************
300 *
301 * FUNCTION: DtCompileDataTable
302 *
303 * PARAMETERS: FieldList - Current field list pointer
304 *
305 * RETURN: Status
306 *
307 * DESCRIPTION: Entry point to compile one data table
308 *
309 *****************************************************************************/
310
311 static ACPI_STATUS
312 DtCompileDataTable (
313 DT_FIELD **FieldList)
314 {
315 const ACPI_DMTABLE_DATA *TableData;
316 DT_SUBTABLE *Subtable;
317 char *Signature;
318 ACPI_TABLE_HEADER *AcpiTableHeader;
319 ACPI_STATUS Status;
320 DT_FIELD *RootField = *FieldList;
321
322
323 /* Verify that we at least have a table signature and save it */
324
325 Signature = DtGetFieldValue (*FieldList);
326 if (!Signature)
327 {
328 sprintf (AslGbl_MsgBuffer, "Expected \"%s\"", "Signature");
329 DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
330 *FieldList, AslGbl_MsgBuffer);
331 return (AE_ERROR);
332 }
333
334 AslGbl_Signature = UtLocalCacheCalloc (strlen (Signature) + 1);
335 strcpy (AslGbl_Signature, Signature);
336
337 /*
338 * Handle tables that don't use the common ACPI table header structure.
339 * Currently, these are the FACS and RSDP. Also check for an OEMx table,
340 * these tables have user-defined contents.
341 */
342 if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_FACS))
343 {
344 Status = DtCompileFacs (FieldList);
345 if (ACPI_FAILURE (Status))
346 {
347 return (Status);
348 }
349
350 DtSetTableLength ();
351 return (Status);
352 }
353 else if (ACPI_VALIDATE_RSDP_SIG (Signature))
354 {
355 Status = DtCompileRsdp (FieldList);
356 return (Status);
357 }
358 else if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_S3PT))
359 {
360 Status = DtCompileS3pt (FieldList);
361 if (ACPI_FAILURE (Status))
362 {
363 return (Status);
364 }
365
366 DtSetTableLength ();
367 return (Status);
368 }
369
370 /*
371 * If the first field is named "CDAT Table Length" (not "Signature"),
372 * assume that we have a CDAT table (whose table header does not have
373 * a signature). Instead, the TableLength field is where the
374 * signature would (normally) be.
375 */
376 else if (!strcmp ((*FieldList)->Name, "CDAT Table Length"))
377 {
378 /* No longer true: (However, use this technique in the disassembler)
379 * We are assuming that there
380 * should be at least one non-ASCII byte in the 4-character
381 * Signature field, (At least the high-order byte should be zero).
382 */
383 Status = DtCompileTable (FieldList, AcpiDmTableInfoCdatTableHdr,
384 &AslGbl_RootTable);
385 if (ACPI_FAILURE (Status))
386 {
387 return (Status);
388 }
389
390 /* Compile the CDAT */
391
392 DtPushSubtable (AslGbl_RootTable);
393 Status = DtCompileCdat ((void **) FieldList);
394 if (ACPI_FAILURE (Status))
395 {
396 return (Status);
397 }
398
399 /*
400 * Set the overall table length and the table checksum.
401 * The entire compiled table (including the CDAT table header with
402 * the table length and checksum) is in AslGbl_RootTable->Buffer.
403 */
404 DtSetTableLength ();
405 DtSetTableChecksum (&ACPI_CAST_PTR (ACPI_TABLE_CDAT, AslGbl_RootTable->Buffer)->Checksum);
406
407 DtDumpFieldList (RootField);
408 DtDumpSubtableList ();
409 return (AE_OK);
410 }
411
412 /*
413 * All other tables must use the common ACPI table header. Insert the
414 * current iASL IDs (name, version), and compile the header now.
415 */
416 DtInsertCompilerIds (*FieldList);
417
418 Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader,
419 &AslGbl_RootTable);
420 if (ACPI_FAILURE (Status))
421 {
422 return (Status);
423 }
424
425 DtPushSubtable (AslGbl_RootTable);
426
427 /* Validate the signature via the ACPI table list */
428
429 TableData = AcpiDmGetTableData (Signature);
430 if (!TableData || AslGbl_CompileGeneric)
431 {
432 /* Unknown table signature and/or force generic compile */
433
434 DtCompileGeneric ((void **) FieldList, NULL, NULL);
435 goto FinishHeader;
436 }
437
438 /* Dispatch to per-table compile */
439
440 if (TableData->CmTableHandler)
441 {
442 /* Complex table, has a handler */
443
444 Status = TableData->CmTableHandler ((void **) FieldList);
445 if (ACPI_FAILURE (Status))
446 {
447 return (Status);
448 }
449 }
450 else if (TableData->TableInfo)
451 {
452 /* Simple table, just walk the info table, unless its empty */
453
454 if (FieldList && *FieldList)
455 {
456 Subtable = NULL;
457 Status = DtCompileTable (FieldList, TableData->TableInfo,
458 &Subtable);
459 if (ACPI_FAILURE (Status))
460 {
461 return (Status);
462 }
463
464 DtInsertSubtable (AslGbl_RootTable, Subtable);
465 DtPopSubtable ();
466 }
467 }
468 else
469 {
470 DtFatal (ASL_MSG_COMPILER_INTERNAL, *FieldList,
471 "Missing table dispatch info");
472 return (AE_ERROR);
473 }
474
475 FinishHeader:
476
477 /* Set the final table length and then the checksum */
478
479 DtSetTableLength ();
480 AcpiTableHeader = ACPI_CAST_PTR (
481 ACPI_TABLE_HEADER, AslGbl_RootTable->Buffer);
482 DtSetTableChecksum (&AcpiTableHeader->Checksum);
483
484 DtDumpFieldList (RootField);
485 DtDumpSubtableList ();
486 return (AE_OK);
487 }
488
489
490 /******************************************************************************
491 *
492 * FUNCTION: DtCompileTable
493 *
494 * PARAMETERS: Field - Current field list pointer
495 * Info - Info table for this ACPI table
496 * RetSubtable - Compile result of table
497 *
498 * RETURN: Status
499 *
500 * DESCRIPTION: Compile a subtable
501 *
502 *****************************************************************************/
503
504 ACPI_STATUS
505 DtCompileTable (
506 DT_FIELD **Field,
507 ACPI_DMTABLE_INFO *Info,
508 DT_SUBTABLE **RetSubtable)
509 {
510 DT_FIELD *LocalField;
511 UINT32 Length;
512 DT_SUBTABLE *Subtable;
513 DT_SUBTABLE *InlineSubtable = NULL;
514 UINT32 FieldLength = 0;
515 UINT8 FieldType;
516 UINT8 *Buffer;
517 UINT8 *FlagBuffer = NULL;
518 char *String;
519 UINT32 CurrentFlagByteOffset = 0;
520 ACPI_STATUS Status = AE_OK;
521
522
523 if (!Field || !Info)
524 {
525 return (AE_BAD_PARAMETER);
526 }
527 if (!*Field)
528 {
529 /*
530 * The field list is empty, this means that we are out of fields to
531 * parse. In other words, we are at the end of the table.
532 */
533 return (AE_END_OF_TABLE);
534 }
535
536 /* Ignore optional subtable if name does not match */
537
538 if ((Info->Flags & DT_OPTIONAL) &&
539 strcmp ((*Field)->Name, Info->Name))
540 {
541 *RetSubtable = NULL;
542 return (AE_OK);
543 }
544
545 Length = DtGetSubtableLength (*Field, Info);
546 if (Length == ASL_EOF)
547 {
548 return (AE_ERROR);
549 }
550
551 Subtable = UtSubtableCacheCalloc ();
552
553 if (Length > 0)
554 {
555 String = UtLocalCacheCalloc (Length);
556 Subtable->Buffer = ACPI_CAST_PTR (UINT8, String);
557 }
558
559 Subtable->Length = Length;
560 Subtable->TotalLength = Length;
561 Buffer = Subtable->Buffer;
562
563 LocalField = *Field;
564 Subtable->Name = LocalField->Name;
565
566 /*
567 * Main loop walks the info table for this ACPI table or subtable
568 */
569 for (; Info->Name; Info++)
570 {
571 if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
572 {
573 continue;
574 }
575
576 if (!LocalField)
577 {
578 sprintf (AslGbl_MsgBuffer, "Found NULL field - Field name \"%s\" needed",
579 Info->Name);
580 DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer);
581 Status = AE_BAD_DATA;
582 goto Error;
583 }
584
585 /* Maintain table offsets */
586
587 LocalField->TableOffset = AslGbl_CurrentTableOffset;
588 FieldLength = DtGetFieldLength (LocalField, Info);
589 AslGbl_CurrentTableOffset += FieldLength;
590
591 FieldType = DtGetFieldType (Info);
592 AslGbl_InputFieldCount++;
593
594 if (FieldType != DT_FIELD_TYPE_INLINE_SUBTABLE &&
595 strcmp (Info->Name, LocalField->Name))
596 {
597 sprintf (AslGbl_MsgBuffer, "found \"%s\" expected \"%s\"",
598 LocalField->Name, Info->Name);
599 DtError (ASL_ERROR, ASL_MSG_INVALID_LABEL, LocalField, AslGbl_MsgBuffer);
600 }
601
602 switch (FieldType)
603 {
604 case DT_FIELD_TYPE_FLAGS_INTEGER:
605 /*
606 * Start of the definition of a flags field.
607 * This master flags integer starts at value zero, in preparation
608 * to compile and insert the flag fields from the individual bits
609 */
610 LocalField = LocalField->Next;
611 *Field = LocalField;
612
613 FlagBuffer = Buffer;
614 CurrentFlagByteOffset = Info->Offset;
615 break;
616
617 case DT_FIELD_TYPE_FLAG:
618
619 /* Individual Flag field, can be multiple bits */
620
621 if (FlagBuffer)
622 {
623 /*
624 * We must increment the FlagBuffer when we have crossed
625 * into the next flags byte within the flags field
626 * of type DT_FIELD_TYPE_FLAGS_INTEGER.
627 */
628 FlagBuffer += (Info->Offset - CurrentFlagByteOffset);
629 CurrentFlagByteOffset = Info->Offset;
630
631 DtCompileFlag (FlagBuffer, LocalField, Info);
632 }
633 else
634 {
635 /* TBD - this is an internal error */
636 }
637
638 LocalField = LocalField->Next;
639 *Field = LocalField;
640 break;
641
642 case DT_FIELD_TYPE_INLINE_SUBTABLE:
643 /*
644 * Recursion (one level max): compile GAS (Generic Address)
645 * or Notify in-line subtable
646 */
647 *Field = LocalField;
648
649 switch (Info->Opcode)
650 {
651 case ACPI_DMT_GAS:
652
653 Status = DtCompileTable (Field, AcpiDmTableInfoGas,
654 &InlineSubtable);
655 break;
656
657 case ACPI_DMT_HESTNTFY:
658
659 Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify,
660 &InlineSubtable);
661 break;
662
663 case ACPI_DMT_IORTMEM:
664
665 Status = DtCompileTable (Field, AcpiDmTableInfoIortAcc,
666 &InlineSubtable);
667 break;
668
669 default:
670 sprintf (AslGbl_MsgBuffer, "Invalid DMT opcode: 0x%.2X",
671 Info->Opcode);
672 DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer);
673 Status = AE_BAD_DATA;
674 break;
675 }
676
677 if (ACPI_FAILURE (Status))
678 {
679 goto Error;
680 }
681
682 DtSetSubtableLength (InlineSubtable);
683
684 memcpy (Buffer, InlineSubtable->Buffer, FieldLength);
685 LocalField = *Field;
686 break;
687
688 case DT_FIELD_TYPE_LABEL:
689
690 DtWriteFieldToListing (Buffer, LocalField, 0);
691 LocalField = LocalField->Next;
692 break;
693
694 default:
695
696 /* Normal case for most field types (Integer, String, etc.) */
697
698 DtCompileOneField (Buffer, LocalField,
699 FieldLength, FieldType, Info->Flags);
700
701 DtWriteFieldToListing (Buffer, LocalField, FieldLength);
702 LocalField = LocalField->Next;
703
704 if (Info->Flags & DT_LENGTH)
705 {
706 /* Field is an Integer that will contain a subtable length */
707
708 Subtable->LengthField = Buffer;
709 Subtable->SizeOfLengthField = FieldLength;
710 }
711 break;
712 }
713
714 Buffer += FieldLength;
715 }
716
717 *Field = LocalField;
718 *RetSubtable = Subtable;
719 return (AE_OK);
720
721 Error:
722 ACPI_FREE (Subtable->Buffer);
723 ACPI_FREE (Subtable);
724 return (Status);
725 }
726
727
728 /******************************************************************************
729 *
730 * FUNCTION: DtCompileTwoSubtables
731 *
732 * PARAMETERS: List - Current field list pointer
733 * TableInfo1 - Info table 1
734 * TableInfo1 - Info table 2
735 *
736 * RETURN: Status
737 *
738 * DESCRIPTION: Compile tables with a header and one or more same subtables.
739 * Include CPEP, EINJ, ERST, MCFG, MSCT, WDAT
740 *
741 *****************************************************************************/
742
743 ACPI_STATUS
744 DtCompileTwoSubtables (
745 void **List,
746 ACPI_DMTABLE_INFO *TableInfo1,
747 ACPI_DMTABLE_INFO *TableInfo2)
748 {
749 ACPI_STATUS Status;
750 DT_SUBTABLE *Subtable;
751 DT_SUBTABLE *ParentTable;
752 DT_FIELD **PFieldList = (DT_FIELD **) List;
753
754
755 Status = DtCompileTable (PFieldList, TableInfo1, &Subtable);
756 if (ACPI_FAILURE (Status))
757 {
758 return (Status);
759 }
760
761 ParentTable = DtPeekSubtable ();
762 DtInsertSubtable (ParentTable, Subtable);
763
764 while (*PFieldList)
765 {
766 Status = DtCompileTable (PFieldList, TableInfo2, &Subtable);
767 if (ACPI_FAILURE (Status))
768 {
769 return (Status);
770 }
771
772 DtInsertSubtable (ParentTable, Subtable);
773 }
774
775 return (AE_OK);
776 }
777
778
779 /******************************************************************************
780 *
781 * FUNCTION: DtCompilePadding
782 *
783 * PARAMETERS: Length - Padding field size
784 * RetSubtable - Compile result of table
785 *
786 * RETURN: Status
787 *
788 * DESCRIPTION: Compile a subtable for padding purpose
789 *
790 *****************************************************************************/
791
792 ACPI_STATUS
793 DtCompilePadding (
794 UINT32 Length,
795 DT_SUBTABLE **RetSubtable)
796 {
797 DT_SUBTABLE *Subtable;
798 /* UINT8 *Buffer; */
799 char *String;
800
801
802 Subtable = UtSubtableCacheCalloc ();
803
804 if (Length > 0)
805 {
806 String = UtLocalCacheCalloc (Length);
807 Subtable->Buffer = ACPI_CAST_PTR (UINT8, String);
808 }
809
810 Subtable->Length = Length;
811 Subtable->TotalLength = Length;
812 /* Buffer = Subtable->Buffer; */
813
814 *RetSubtable = Subtable;
815 return (AE_OK);
816 }