import of ftp.dlink.com/GPL/DSMG-600_reB/ppclinux.tar.gz
[linux-2.4.21-pre4.git] / drivers / acpi / resources / rscalc.c
1 /*******************************************************************************
2  *
3  * Module Name: rscalc - Calculate stream and list lengths
4  *              $Revision: 1.1.1.1 $
5  *
6  ******************************************************************************/
7
8 /*
9  *  Copyright (C) 2000, 2001 R. Byron Moore
10  *
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  */
25
26
27 #include "acpi.h"
28 #include "acresrc.h"
29 #include "amlcode.h"
30 #include "acnamesp.h"
31
32 #define _COMPONENT          ACPI_RESOURCES
33          MODULE_NAME         ("rscalc")
34
35
36 /*******************************************************************************
37  *
38  * FUNCTION:    Acpi_rs_calculate_byte_stream_length
39  *
40  * PARAMETERS:  Linked_list         - Pointer to the resource linked list
41  *              Size_needed         - u32 pointer of the size buffer needed
42  *                                    to properly return the parsed data
43  *
44  * RETURN:      Status
45  *
46  * DESCRIPTION: Takes the resource byte stream and parses it once, calculating
47  *              the size buffer needed to hold the linked list that conveys
48  *              the resource data.
49  *
50  ******************************************************************************/
51
52 acpi_status
53 acpi_rs_calculate_byte_stream_length (
54         acpi_resource           *linked_list,
55         u32                     *size_needed)
56 {
57         u32                     byte_stream_size_needed = 0;
58         u32                     segment_size;
59         acpi_resource_ext_irq   *ex_irq = NULL;
60         u8                      done = FALSE;
61
62
63         FUNCTION_TRACE ("Rs_calculate_byte_stream_length");
64
65
66         while (!done) {
67                 /*
68                  * Init the variable that will hold the size to add to the total.
69                  */
70                 segment_size = 0;
71
72                 switch (linked_list->id) {
73                 case ACPI_RSTYPE_IRQ:
74                         /*
75                          * IRQ Resource
76                          * For an IRQ Resource, Byte 3, although optional, will
77                          * always be created - it holds IRQ information.
78                          */
79                         segment_size = 4;
80                         break;
81
82                 case ACPI_RSTYPE_DMA:
83                         /*
84                          * DMA Resource
85                          * For this resource the size is static
86                          */
87                         segment_size = 3;
88                         break;
89
90                 case ACPI_RSTYPE_START_DPF:
91                         /*
92                          * Start Dependent Functions Resource
93                          * For a Start_dependent_functions Resource, Byte 1,
94                          * although optional, will always be created.
95                          */
96                         segment_size = 2;
97                         break;
98
99                 case ACPI_RSTYPE_END_DPF:
100                         /*
101                          * End Dependent Functions Resource
102                          * For this resource the size is static
103                          */
104                         segment_size = 1;
105                         break;
106
107                 case ACPI_RSTYPE_IO:
108                         /*
109                          * IO Port Resource
110                          * For this resource the size is static
111                          */
112                         segment_size = 8;
113                         break;
114
115                 case ACPI_RSTYPE_FIXED_IO:
116                         /*
117                          * Fixed IO Port Resource
118                          * For this resource the size is static
119                          */
120                         segment_size = 4;
121                         break;
122
123                 case ACPI_RSTYPE_VENDOR:
124                         /*
125                          * Vendor Defined Resource
126                          * For a Vendor Specific resource, if the Length is
127                          * between 1 and 7 it will be created as a Small
128                          * Resource data type, otherwise it is a Large
129                          * Resource data type.
130                          */
131                         if (linked_list->data.vendor_specific.length > 7) {
132                                 segment_size = 3;
133                         }
134                         else {
135                                 segment_size = 1;
136                         }
137                         segment_size += linked_list->data.vendor_specific.length;
138                         break;
139
140                 case ACPI_RSTYPE_END_TAG:
141                         /*
142                          * End Tag
143                          * For this resource the size is static
144                          */
145                         segment_size = 2;
146                         done = TRUE;
147                         break;
148
149                 case ACPI_RSTYPE_MEM24:
150                         /*
151                          * 24-Bit Memory Resource
152                          * For this resource the size is static
153                          */
154                         segment_size = 12;
155                         break;
156
157                 case ACPI_RSTYPE_MEM32:
158                         /*
159                          * 32-Bit Memory Range Resource
160                          * For this resource the size is static
161                          */
162                         segment_size = 20;
163                         break;
164
165                 case ACPI_RSTYPE_FIXED_MEM32:
166                         /*
167                          * 32-Bit Fixed Memory Resource
168                          * For this resource the size is static
169                          */
170                         segment_size = 12;
171                         break;
172
173                 case ACPI_RSTYPE_ADDRESS16:
174                         /*
175                          * 16-Bit Address Resource
176                          * The base size of this byte stream is 16. If a
177                          * Resource Source string is not NULL, add 1 for
178                          * the Index + the length of the null terminated
179                          * string Resource Source + 1 for the null.
180                          */
181                         segment_size = 16;
182
183                         if (NULL != linked_list->data.address16.resource_source.string_ptr) {
184                                 segment_size += (1 +
185                                         linked_list->data.address16.resource_source.string_length);
186                         }
187                         break;
188
189                 case ACPI_RSTYPE_ADDRESS32:
190                         /*
191                          * 32-Bit Address Resource
192                          * The base size of this byte stream is 26. If a Resource
193                          * Source string is not NULL, add 1 for the Index + the
194                          * length of the null terminated string Resource Source +
195                          * 1 for the null.
196                          */
197                         segment_size = 26;
198
199                         if (NULL != linked_list->data.address32.resource_source.string_ptr) {
200                                 segment_size += (1 +
201                                         linked_list->data.address32.resource_source.string_length);
202                         }
203                         break;
204
205                 case ACPI_RSTYPE_ADDRESS64:
206                         /*
207                          * 64-Bit Address Resource
208                          * The base size of this byte stream is 46. If a Resource
209                          * Source string is not NULL, add 1 for the Index + the
210                          * length of the null terminated string Resource Source +
211                          * 1 for the null.
212                          */
213                         segment_size = 46;
214
215                         if (NULL != linked_list->data.address64.resource_source.string_ptr) {
216                                 segment_size += (1 +
217                                         linked_list->data.address64.resource_source.string_length);
218                         }
219                         break;
220
221                 case ACPI_RSTYPE_EXT_IRQ:
222                         /*
223                          * Extended IRQ Resource
224                          * The base size of this byte stream is 9. This is for an
225                          * Interrupt table length of 1.  For each additional
226                          * interrupt, add 4.
227                          * If a Resource Source string is not NULL, add 1 for the
228                          * Index + the length of the null terminated string
229                          * Resource Source + 1 for the null.
230                          */
231                         segment_size = 9 +
232                                 ((linked_list->data.extended_irq.number_of_interrupts - 1) * 4);
233
234                         if (NULL != ex_irq->resource_source.string_ptr) {
235                                 segment_size += (1 +
236                                         linked_list->data.extended_irq.resource_source.string_length);
237                         }
238                         break;
239
240                 default:
241                         /*
242                          * If we get here, everything is out of sync,
243                          * so exit with an error
244                          */
245                         return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
246                         break;
247
248                 } /* switch (Linked_list->Id) */
249
250                 /*
251                  * Update the total
252                  */
253                 byte_stream_size_needed += segment_size;
254
255                 /*
256                  * Point to the next object
257                  */
258                 linked_list = POINTER_ADD (acpi_resource,
259                                   linked_list, linked_list->length);
260         }
261
262         /*
263          * This is the data the caller needs
264          */
265         *size_needed = byte_stream_size_needed;
266         return_ACPI_STATUS (AE_OK);
267 }
268
269
270 /*******************************************************************************
271  *
272  * FUNCTION:    Acpi_rs_calculate_list_length
273  *
274  * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource byte stream
275  *              Byte_stream_buffer_length - Size of Byte_stream_buffer
276  *              Size_needed             - u32 pointer of the size buffer
277  *                                        needed to properly return the
278  *                                        parsed data
279  *
280  * RETURN:      Status
281  *
282  * DESCRIPTION: Takes the resource byte stream and parses it once, calculating
283  *              the size buffer needed to hold the linked list that conveys
284  *              the resource data.
285  *
286  ******************************************************************************/
287
288 acpi_status
289 acpi_rs_calculate_list_length (
290         u8                      *byte_stream_buffer,
291         u32                     byte_stream_buffer_length,
292         u32                     *size_needed)
293 {
294         u32                     buffer_size = 0;
295         u32                     bytes_parsed = 0;
296         u8                      number_of_interrupts = 0;
297         u8                      number_of_channels = 0;
298         u8                      resource_type;
299         u32                     structure_size;
300         u32                     bytes_consumed;
301         u8                      *buffer;
302         u8                      temp8;
303         u16                     temp16;
304         u8                      index;
305         u8                      additional_bytes;
306
307
308         FUNCTION_TRACE ("Rs_calculate_list_length");
309
310
311         while (bytes_parsed < byte_stream_buffer_length) {
312                 /*
313                  * The next byte in the stream is the resource type
314                  */
315                 resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
316
317                 switch (resource_type) {
318                 case RESOURCE_DESC_MEMORY_24:
319                         /*
320                          * 24-Bit Memory Resource
321                          */
322                         bytes_consumed = 12;
323
324                         structure_size = SIZEOF_RESOURCE (acpi_resource_mem24);
325                         break;
326
327
328                 case RESOURCE_DESC_LARGE_VENDOR:
329                         /*
330                          * Vendor Defined Resource
331                          */
332                         buffer = byte_stream_buffer;
333                         ++buffer;
334
335                         MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
336                         bytes_consumed = temp16 + 3;
337
338                         /*
339                          * Ensure a 32-bit boundary for the structure
340                          */
341                         temp16 = (u16) ROUND_UP_TO_32_bITS (temp16);
342
343                         structure_size = SIZEOF_RESOURCE (acpi_resource_vendor) +
344                                            (temp16 * sizeof (u8));
345                         break;
346
347
348                 case RESOURCE_DESC_MEMORY_32:
349                         /*
350                          * 32-Bit Memory Range Resource
351                          */
352
353                         bytes_consumed = 20;
354
355                         structure_size = SIZEOF_RESOURCE (acpi_resource_mem32);
356                         break;
357
358
359                 case RESOURCE_DESC_FIXED_MEMORY_32:
360                         /*
361                          * 32-Bit Fixed Memory Resource
362                          */
363                         bytes_consumed = 12;
364
365                         structure_size = SIZEOF_RESOURCE (acpi_resource_fixed_mem32);
366                         break;
367
368
369                 case RESOURCE_DESC_QWORD_ADDRESS_SPACE:
370                         /*
371                          * 64-Bit Address Resource
372                          */
373                         buffer = byte_stream_buffer;
374
375                         ++buffer;
376                         MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
377
378                         bytes_consumed = temp16 + 3;
379
380                         /*
381                          * Resource Source Index and Resource Source are
382                          * optional elements.  Check the length of the
383                          * Bytestream.  If it is greater than 43, that
384                          * means that an Index exists and is followed by
385                          * a null termininated string.  Therefore, set
386                          * the temp variable to the length minus the minimum
387                          * byte stream length plus the byte for the Index to
388                          * determine the size of the NULL terminiated string.
389                          */
390                         if (43 < temp16) {
391                                 temp8 = (u8) (temp16 - 44);
392                         }
393                         else {
394                                 temp8 = 0;
395                         }
396
397                         /*
398                          * Ensure a 64-bit boundary for the structure
399                          */
400                         temp8 = (u8) ROUND_UP_TO_64_bITS (temp8);
401
402                         structure_size = SIZEOF_RESOURCE (acpi_resource_address64) +
403                                            (temp8 * sizeof (u8));
404                         break;
405
406
407                 case RESOURCE_DESC_DWORD_ADDRESS_SPACE:
408                         /*
409                          * 32-Bit Address Resource
410                          */
411                         buffer = byte_stream_buffer;
412
413                         ++buffer;
414                         MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
415
416                         bytes_consumed = temp16 + 3;
417
418                         /*
419                          * Resource Source Index and Resource Source are
420                          * optional elements.  Check the length of the
421                          * Bytestream.  If it is greater than 23, that
422                          * means that an Index exists and is followed by
423                          * a null termininated string.  Therefore, set
424                          * the temp variable to the length minus the minimum
425                          * byte stream length plus the byte for the Index to
426                          * determine the size of the NULL terminiated string.
427                          */
428                         if (23 < temp16) {
429                                 temp8 = (u8) (temp16 - 24);
430                         }
431                         else {
432                                 temp8 = 0;
433                         }
434
435                         /*
436                          * Ensure a 32-bit boundary for the structure
437                          */
438                         temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
439
440                         structure_size = SIZEOF_RESOURCE (acpi_resource_address32) +
441                                            (temp8 * sizeof (u8));
442                         break;
443
444
445                 case RESOURCE_DESC_WORD_ADDRESS_SPACE:
446                         /*
447                          * 16-Bit Address Resource
448                          */
449                         buffer = byte_stream_buffer;
450
451                         ++buffer;
452                         MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
453
454                         bytes_consumed = temp16 + 3;
455
456                         /*
457                          * Resource Source Index and Resource Source are
458                          * optional elements.  Check the length of the
459                          * Bytestream.  If it is greater than 13, that
460                          * means that an Index exists and is followed by
461                          * a null termininated string.  Therefore, set
462                          * the temp variable to the length minus the minimum
463                          * byte stream length plus the byte for the Index to
464                          * determine the size of the NULL terminiated string.
465                          */
466                         if (13 < temp16) {
467                                 temp8 = (u8) (temp16 - 14);
468                         }
469                         else {
470                                 temp8 = 0;
471                         }
472
473                         /*
474                          * Ensure a 32-bit boundary for the structure
475                          */
476                         temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
477
478                         structure_size = SIZEOF_RESOURCE (acpi_resource_address16) +
479                                            (temp8 * sizeof (u8));
480                         break;
481
482
483                 case RESOURCE_DESC_EXTENDED_XRUPT:
484                         /*
485                          * Extended IRQ
486                          */
487                         buffer = byte_stream_buffer;
488
489                         ++buffer;
490                         MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
491
492                         bytes_consumed = temp16 + 3;
493
494                         /*
495                          * Point past the length field and the
496                          * Interrupt vector flags to save off the
497                          * Interrupt table length to the Temp8 variable.
498                          */
499                         buffer += 3;
500                         temp8 = *buffer;
501
502                         /*
503                          * To compensate for multiple interrupt numbers, add 4 bytes for
504                          * each additional interrupts greater than 1
505                          */
506                         additional_bytes = (u8) ((temp8 - 1) * 4);
507
508                         /*
509                          * Resource Source Index and Resource Source are
510                          * optional elements.  Check the length of the
511                          * Bytestream.  If it is greater than 9, that
512                          * means that an Index exists and is followed by
513                          * a null termininated string.  Therefore, set
514                          * the temp variable to the length minus the minimum
515                          * byte stream length plus the byte for the Index to
516                          * determine the size of the NULL terminiated string.
517                          */
518                         if (9 + additional_bytes < temp16) {
519                                 temp8 = (u8) (temp16 - (9 + additional_bytes));
520                         }
521
522                         else {
523                                 temp8 = 0;
524                         }
525
526                         /*
527                          * Ensure a 32-bit boundary for the structure
528                          */
529                         temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
530
531                         structure_size = SIZEOF_RESOURCE (acpi_resource_ext_irq) +
532                                            (additional_bytes * sizeof (u8)) +
533                                            (temp8 * sizeof (u8));
534                         break;
535
536
537                 case RESOURCE_DESC_IRQ_FORMAT:
538                         /*
539                          * IRQ Resource.
540                          * Determine if it there are two or three trailing bytes
541                          */
542                         buffer = byte_stream_buffer;
543                         temp8 = *buffer;
544
545                         if(temp8 & 0x01) {
546                                 bytes_consumed = 4;
547                         }
548
549                         else {
550                                 bytes_consumed = 3;
551                         }
552
553                         /*
554                          * Point past the descriptor
555                          */
556                         ++buffer;
557
558                         /*
559                          * Look at the number of bits set
560                          */
561                         MOVE_UNALIGNED16_TO_16 (&temp16, buffer);
562
563                         for (index = 0; index < 16; index++) {
564                                 if (temp16 & 0x1) {
565                                         ++number_of_interrupts;
566                                 }
567
568                                 temp16 >>= 1;
569                         }
570
571                         structure_size = SIZEOF_RESOURCE (acpi_resource_io) +
572                                            (number_of_interrupts * sizeof (u32));
573                         break;
574
575
576                 case RESOURCE_DESC_DMA_FORMAT:
577                         /*
578                          * DMA Resource
579                          */
580                         buffer = byte_stream_buffer;
581                         bytes_consumed = 3;
582
583                         /*
584                          * Point past the descriptor
585                          */
586                         ++buffer;
587
588                         /*
589                          * Look at the number of bits set
590                          */
591                         temp8 = *buffer;
592
593                         for(index = 0; index < 8; index++) {
594                                 if(temp8 & 0x1) {
595                                         ++number_of_channels;
596                                 }
597
598                                 temp8 >>= 1;
599                         }
600
601                         structure_size = SIZEOF_RESOURCE (acpi_resource_dma) +
602                                            (number_of_channels * sizeof (u32));
603                         break;
604
605
606                 case RESOURCE_DESC_START_DEPENDENT:
607                         /*
608                          * Start Dependent Functions Resource
609                          * Determine if it there are two or three trailing bytes
610                          */
611                         buffer = byte_stream_buffer;
612                         temp8 = *buffer;
613
614                         if(temp8 & 0x01) {
615                                 bytes_consumed = 2;
616                         }
617                         else {
618                                 bytes_consumed = 1;
619                         }
620
621                         structure_size = SIZEOF_RESOURCE (acpi_resource_start_dpf);
622                         break;
623
624
625                 case RESOURCE_DESC_END_DEPENDENT:
626                         /*
627                          * End Dependent Functions Resource
628                          */
629                         bytes_consumed = 1;
630                         structure_size = ACPI_RESOURCE_LENGTH;
631                         break;
632
633
634                 case RESOURCE_DESC_IO_PORT:
635                         /*
636                          * IO Port Resource
637                          */
638                         bytes_consumed = 8;
639                         structure_size = SIZEOF_RESOURCE (acpi_resource_io);
640                         break;
641
642
643                 case RESOURCE_DESC_FIXED_IO_PORT:
644                         /*
645                          * Fixed IO Port Resource
646                          */
647                         bytes_consumed = 4;
648                         structure_size = SIZEOF_RESOURCE (acpi_resource_fixed_io);
649                         break;
650
651
652                 case RESOURCE_DESC_SMALL_VENDOR:
653                         /*
654                          * Vendor Specific Resource
655                          */
656                         buffer = byte_stream_buffer;
657
658                         temp8 = *buffer;
659                         temp8 = (u8) (temp8 & 0x7);
660                         bytes_consumed = temp8 + 1;
661
662                         /*
663                          * Ensure a 32-bit boundary for the structure
664                          */
665                         temp8 = (u8) ROUND_UP_TO_32_bITS (temp8);
666                         structure_size = SIZEOF_RESOURCE (acpi_resource_vendor) +
667                                            (temp8 * sizeof (u8));
668                         break;
669
670
671                 case RESOURCE_DESC_END_TAG:
672                         /*
673                          * End Tag
674                          */
675                         bytes_consumed = 2;
676                         structure_size = ACPI_RESOURCE_LENGTH;
677                         byte_stream_buffer_length = bytes_parsed;
678                         break;
679
680
681                 default:
682                         /*
683                          * If we get here, everything is out of sync,
684                          *  so exit with an error
685                          */
686                         return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
687                         break;
688                 }
689
690
691                 /*
692                  * Update the return value and counter
693                  */
694                 buffer_size += structure_size;
695                 bytes_parsed += bytes_consumed;
696
697                 /*
698                  * Set the byte stream to point to the next resource
699                  */
700                 byte_stream_buffer += bytes_consumed;
701         }
702
703
704         /*
705          * This is the data the caller needs
706          */
707         *size_needed = buffer_size;
708         return_ACPI_STATUS (AE_OK);
709 }
710
711
712 /*******************************************************************************
713  *
714  * FUNCTION:    Acpi_rs_calculate_pci_routing_table_length
715  *
716  * PARAMETERS:  Package_object          - Pointer to the package object
717  *              Buffer_size_needed      - u32 pointer of the size buffer
718  *                                        needed to properly return the
719  *                                        parsed data
720  *
721  * RETURN:      Status
722  *
723  * DESCRIPTION: Given a package representing a PCI routing table, this
724  *              calculates the size of the corresponding linked list of
725  *              descriptions.
726  *
727  ******************************************************************************/
728
729 acpi_status
730 acpi_rs_calculate_pci_routing_table_length (
731         acpi_operand_object     *package_object,
732         u32                     *buffer_size_needed)
733 {
734         u32                     number_of_elements;
735         u32                     temp_size_needed = 0;
736         acpi_operand_object     **top_object_list;
737         u32                     index;
738         acpi_operand_object     *package_element;
739         acpi_operand_object     **sub_object_list;
740         u8                      name_found;
741         u32                     table_index;
742
743
744         FUNCTION_TRACE ("Rs_calculate_pci_routing_table_length");
745
746
747         number_of_elements = package_object->package.count;
748
749         /*
750          * Calculate the size of the return buffer.
751          * The base size is the number of elements * the sizes of the
752          * structures.  Additional space for the strings is added below.
753          * The minus one is to subtract the size of the u8 Source[1]
754          * member because it is added below.
755          *
756          * But each PRT_ENTRY structure has a pointer to a string and
757          * the size of that string must be found.
758          */
759         top_object_list = package_object->package.elements;
760
761         for (index = 0; index < number_of_elements; index++) {
762                 /*
763                  * Dereference the sub-package
764                  */
765                 package_element = *top_object_list;
766
767                 /*
768                  * The Sub_object_list will now point to an array of the
769                  * four IRQ elements: Address, Pin, Source and Source_index
770                  */
771                 sub_object_list = package_element->package.elements;
772
773                 /*
774                  * Scan the Irq_table_elements for the Source Name String
775                  */
776                 name_found = FALSE;
777
778                 for (table_index = 0; table_index < 4 && !name_found; table_index++) {
779                         if ((ACPI_TYPE_STRING == (*sub_object_list)->common.type) ||
780                                 ((INTERNAL_TYPE_REFERENCE == (*sub_object_list)->common.type) &&
781                                         ((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) {
782                                 name_found = TRUE;
783                         }
784
785                         else {
786                                 /*
787                                  * Look at the next element
788                                  */
789                                 sub_object_list++;
790                         }
791                 }
792
793                 temp_size_needed += (sizeof (pci_routing_table) - 4);
794
795                 /*
796                  * Was a String type found?
797                  */
798                 if (TRUE == name_found) {
799                         if (ACPI_TYPE_STRING == (*sub_object_list)->common.type) {
800                                 /*
801                                  * The length String.Length field includes the
802                                  * terminating NULL
803                                  */
804                                 temp_size_needed += (*sub_object_list)->string.length;
805                         }
806
807                         else {
808                                 temp_size_needed += acpi_ns_get_pathname_length (
809                                                    (*sub_object_list)->reference.node);
810                         }
811                 }
812
813                 else {
814                         /*
815                          * If no name was found, then this is a NULL, which is
816                          * translated as a u32 zero.
817                          */
818                         temp_size_needed += sizeof (u32);
819                 }
820
821                 /* Round up the size since each element must be aligned */
822
823                 temp_size_needed = ROUND_UP_TO_64_bITS (temp_size_needed);
824
825                 /*
826                  * Point to the next acpi_operand_object
827                  */
828                 top_object_list++;
829         }
830
831
832         /*
833          * Adding an extra element to the end of the list, essentially a NULL terminator
834          */
835         *buffer_size_needed = temp_size_needed + sizeof (pci_routing_table);
836         return_ACPI_STATUS (AE_OK);
837 }