Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * |
| 3 | * Module Name: rscalc - Calculate stream and list lengths |
| 4 | * |
| 5 | ******************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2006, R. Byron Moore |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 MERCHANTIBILITY AND FITNESS FOR |
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 41 | * POSSIBILITY OF SUCH DAMAGES. |
| 42 | */ |
| 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <acpi/acpi.h> |
| 45 | #include <acpi/acresrc.h> |
| 46 | #include <acpi/amlcode.h> |
| 47 | #include <acpi/acnamesp.h> |
| 48 | |
| 49 | #define _COMPONENT ACPI_RESOURCES |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 50 | ACPI_MODULE_NAME("rscalc") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 52 | /* Local prototypes */ |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 53 | static u8 acpi_rs_count_set_bits(u16 bit_field); |
| 54 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 55 | static acpi_rs_length |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 56 | acpi_rs_struct_option_length(struct acpi_resource_source *resource_source); |
| 57 | |
| 58 | static u32 |
| 59 | acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length); |
| 60 | |
| 61 | /******************************************************************************* |
| 62 | * |
| 63 | * FUNCTION: acpi_rs_count_set_bits |
| 64 | * |
| 65 | * PARAMETERS: bit_field - Field in which to count bits |
| 66 | * |
| 67 | * RETURN: Number of bits set within the field |
| 68 | * |
| 69 | * DESCRIPTION: Count the number of bits set in a resource field. Used for |
| 70 | * (Short descriptor) interrupt and DMA lists. |
| 71 | * |
| 72 | ******************************************************************************/ |
| 73 | |
| 74 | static u8 acpi_rs_count_set_bits(u16 bit_field) |
| 75 | { |
| 76 | u8 bits_set; |
| 77 | |
| 78 | ACPI_FUNCTION_ENTRY(); |
| 79 | |
| 80 | for (bits_set = 0; bit_field; bits_set++) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 81 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 82 | /* Zero the least significant bit that is set */ |
| 83 | |
| 84 | bit_field &= (bit_field - 1); |
| 85 | } |
| 86 | |
| 87 | return (bits_set); |
| 88 | } |
| 89 | |
| 90 | /******************************************************************************* |
| 91 | * |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 92 | * FUNCTION: acpi_rs_struct_option_length |
| 93 | * |
| 94 | * PARAMETERS: resource_source - Pointer to optional descriptor field |
| 95 | * |
| 96 | * RETURN: Status |
| 97 | * |
| 98 | * DESCRIPTION: Common code to handle optional resource_source_index and |
| 99 | * resource_source fields in some Large descriptors. Used during |
| 100 | * list-to-stream conversion |
| 101 | * |
| 102 | ******************************************************************************/ |
| 103 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 104 | static acpi_rs_length |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 105 | acpi_rs_struct_option_length(struct acpi_resource_source *resource_source) |
| 106 | { |
| 107 | ACPI_FUNCTION_ENTRY(); |
| 108 | |
| 109 | /* |
| 110 | * If the resource_source string is valid, return the size of the string |
| 111 | * (string_length includes the NULL terminator) plus the size of the |
| 112 | * resource_source_index (1). |
| 113 | */ |
| 114 | if (resource_source->string_ptr) { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 115 | return ((acpi_rs_length) (resource_source->string_length + 1)); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | return (0); |
| 119 | } |
| 120 | |
| 121 | /******************************************************************************* |
| 122 | * |
| 123 | * FUNCTION: acpi_rs_stream_option_length |
| 124 | * |
| 125 | * PARAMETERS: resource_length - Length from the resource header |
| 126 | * minimum_total_length - Minimum length of this resource, before |
| 127 | * any optional fields. Includes header size |
| 128 | * |
| 129 | * RETURN: Length of optional string (0 if no string present) |
| 130 | * |
| 131 | * DESCRIPTION: Common code to handle optional resource_source_index and |
| 132 | * resource_source fields in some Large descriptors. Used during |
| 133 | * stream-to-list conversion |
| 134 | * |
| 135 | ******************************************************************************/ |
| 136 | |
| 137 | static u32 |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 138 | acpi_rs_stream_option_length(u32 resource_length, |
| 139 | u32 minimum_aml_resource_length) |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 140 | { |
| 141 | u32 string_length = 0; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 142 | |
| 143 | ACPI_FUNCTION_ENTRY(); |
| 144 | |
| 145 | /* |
| 146 | * The resource_source_index and resource_source are optional elements of some |
| 147 | * Large-type resource descriptors. |
| 148 | */ |
| 149 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 150 | /* |
| 151 | * If the length of the actual resource descriptor is greater than the ACPI |
| 152 | * spec-defined minimum length, it means that a resource_source_index exists |
| 153 | * and is followed by a (required) null terminated string. The string length |
| 154 | * (including the null terminator) is the resource length minus the minimum |
| 155 | * length, minus one byte for the resource_source_index itself. |
| 156 | */ |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 157 | if (resource_length > minimum_aml_resource_length) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 158 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 159 | /* Compute the length of the optional string */ |
| 160 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 161 | string_length = |
| 162 | resource_length - minimum_aml_resource_length - 1; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | /* Round up length to 32 bits for internal structure alignment */ |
| 166 | |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 167 | return ((u32) ACPI_ROUND_UP_to_32_bITS(string_length)); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 168 | } |
| 169 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | /******************************************************************************* |
| 171 | * |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 172 | * FUNCTION: acpi_rs_get_aml_length |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | * |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 174 | * PARAMETERS: Resource - Pointer to the resource linked list |
| 175 | * size_needed - Where the required size is returned |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 176 | * |
| 177 | * RETURN: Status |
| 178 | * |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 179 | * DESCRIPTION: Takes a linked list of internal resource descriptors and |
| 180 | * calculates the size buffer needed to hold the corresponding |
| 181 | * external resource byte stream. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | * |
| 183 | ******************************************************************************/ |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 184 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | acpi_status |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 186 | acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 188 | acpi_size aml_size_needed = 0; |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 189 | acpi_rs_length total_size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 191 | ACPI_FUNCTION_TRACE("rs_get_aml_length"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 193 | /* Traverse entire list of internal resource descriptors */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 194 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 195 | while (resource) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 196 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 197 | /* Validate the descriptor type */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 199 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 200 | return_ACPI_STATUS(AE_AML_INVALID_RESOURCE_TYPE); |
| 201 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 203 | /* Get the base size of the (external stream) resource descriptor */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 205 | total_size = acpi_gbl_aml_resource_sizes[resource->type]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 207 | /* |
| 208 | * Augment the base size for descriptors with optional and/or |
| 209 | * variable-length fields |
| 210 | */ |
| 211 | switch (resource->type) { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 212 | case ACPI_RESOURCE_TYPE_VENDOR: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | /* |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 214 | * Vendor Defined Resource: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | * For a Vendor Specific resource, if the Length is between 1 and 7 |
| 216 | * it will be created as a Small Resource data type, otherwise it |
| 217 | * is a Large Resource data type. |
| 218 | */ |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 219 | if (resource->data.vendor.byte_length > 7) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 220 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 221 | /* Base size of a Large resource descriptor */ |
| 222 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 223 | total_size = |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 224 | sizeof(struct aml_resource_large_header); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | } |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 226 | |
| 227 | /* Add the size of the vendor-specific data */ |
| 228 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 229 | total_size = (acpi_rs_length) |
| 230 | (total_size + resource->data.vendor.byte_length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | break; |
| 232 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 233 | case ACPI_RESOURCE_TYPE_END_TAG: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | /* |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 235 | * End Tag: |
| 236 | * We are done -- return the accumulated total size. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 238 | *size_needed = aml_size_needed + total_size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 240 | /* Normal exit */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 242 | return_ACPI_STATUS(AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 244 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | /* |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 246 | * 16-Bit Address Resource: |
| 247 | * Add the size of the optional resource_source info |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 249 | total_size = (acpi_rs_length) |
| 250 | (total_size + |
| 251 | acpi_rs_struct_option_length(&resource->data. |
| 252 | address16. |
| 253 | resource_source)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | break; |
| 255 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 256 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | /* |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 258 | * 32-Bit Address Resource: |
| 259 | * Add the size of the optional resource_source info |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 261 | total_size = (acpi_rs_length) |
| 262 | (total_size + |
| 263 | acpi_rs_struct_option_length(&resource->data. |
| 264 | address32. |
| 265 | resource_source)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | break; |
| 267 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 268 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | /* |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 270 | * 64-Bit Address Resource: |
| 271 | * Add the size of the optional resource_source info |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 273 | total_size = (acpi_rs_length) |
| 274 | (total_size + |
| 275 | acpi_rs_struct_option_length(&resource->data. |
| 276 | address64. |
| 277 | resource_source)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | break; |
| 279 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 280 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | /* |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 282 | * Extended IRQ Resource: |
| 283 | * Add the size of each additional optional interrupt beyond the |
| 284 | * required 1 (4 bytes for each u32 interrupt number) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | */ |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 286 | total_size = (acpi_rs_length) |
| 287 | (total_size + |
| 288 | ((resource->data.extended_irq.interrupt_count - |
| 289 | 1) * 4) + |
| 290 | /* Add the size of the optional resource_source info */ |
| 291 | acpi_rs_struct_option_length(&resource->data. |
| 292 | extended_irq. |
| 293 | resource_source)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | break; |
| 295 | |
| 296 | default: |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 297 | break; |
| 298 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 300 | /* Update the total */ |
| 301 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 302 | aml_size_needed += total_size; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 304 | /* Point to the next object */ |
| 305 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 306 | resource = |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 307 | ACPI_ADD_PTR(struct acpi_resource, resource, |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 308 | resource->length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | } |
| 310 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 311 | /* Did not find an end_tag resource descriptor */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 312 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 313 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | } |
| 315 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 316 | /******************************************************************************* |
| 317 | * |
| 318 | * FUNCTION: acpi_rs_get_list_length |
| 319 | * |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 320 | * PARAMETERS: aml_buffer - Pointer to the resource byte stream |
| 321 | * aml_buffer_length - Size of aml_buffer |
| 322 | * size_needed - Where the size needed is returned |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | * |
| 324 | * RETURN: Status |
| 325 | * |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 326 | * DESCRIPTION: Takes an external resource byte stream and calculates the size |
| 327 | * buffer needed to hold the corresponding internal resource |
| 328 | * descriptor linked list. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | * |
| 330 | ******************************************************************************/ |
| 331 | |
| 332 | acpi_status |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 333 | acpi_rs_get_list_length(u8 * aml_buffer, |
| 334 | u32 aml_buffer_length, acpi_size * size_needed) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | { |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 336 | acpi_status status; |
| 337 | u8 *end_aml; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 338 | u8 *buffer; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 339 | u32 buffer_size = 0; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 340 | u16 temp16; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 341 | u16 resource_length; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 342 | u32 extra_struct_bytes; |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 343 | u8 resource_index; |
| 344 | u8 minimum_aml_resource_length; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 346 | ACPI_FUNCTION_TRACE("rs_get_list_length"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 348 | end_aml = aml_buffer + aml_buffer_length; |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 349 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 350 | /* Walk the list of AML resource descriptors */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 352 | while (aml_buffer < end_aml) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 353 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 354 | /* Validate the Resource Type and Resource Length */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 356 | status = acpi_ut_validate_resource(aml_buffer, &resource_index); |
| 357 | if (ACPI_FAILURE(status)) { |
| 358 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | } |
| 360 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 361 | /* Get the resource length and base (minimum) AML size */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 362 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 363 | resource_length = acpi_ut_get_resource_length(aml_buffer); |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 364 | minimum_aml_resource_length = |
| 365 | acpi_gbl_resource_aml_sizes[resource_index]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 367 | /* |
| 368 | * Augment the size for descriptors with optional |
| 369 | * and/or variable length fields |
| 370 | */ |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 371 | extra_struct_bytes = 0; |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 372 | buffer = |
| 373 | aml_buffer + acpi_ut_get_resource_header_length(aml_buffer); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 374 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 375 | switch (acpi_ut_get_resource_type(aml_buffer)) { |
| 376 | case ACPI_RESOURCE_NAME_IRQ: |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 377 | /* |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 378 | * IRQ Resource: |
| 379 | * Get the number of bits set in the 16-bit IRQ mask |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 380 | */ |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 381 | ACPI_MOVE_16_TO_16(&temp16, buffer); |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 382 | extra_struct_bytes = acpi_rs_count_set_bits(temp16); |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 383 | break; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 384 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 385 | case ACPI_RESOURCE_NAME_DMA: |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 386 | /* |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 387 | * DMA Resource: |
| 388 | * Get the number of bits set in the 8-bit DMA mask |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 389 | */ |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 390 | extra_struct_bytes = acpi_rs_count_set_bits(*buffer); |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 391 | break; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 392 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 393 | case ACPI_RESOURCE_NAME_VENDOR_SMALL: |
| 394 | /* |
| 395 | * Vendor Resource: |
| 396 | * Ensure a 32-bit boundary for the structure |
| 397 | */ |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 398 | extra_struct_bytes = (u32) |
Len Brown | 4635861 | 2006-03-31 02:16:19 -0500 | [diff] [blame] | 399 | ACPI_ROUND_UP_to_32_bITS(resource_length) - |
| 400 | resource_length; |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 401 | break; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 402 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 403 | case ACPI_RESOURCE_NAME_END_TAG: |
| 404 | /* |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 405 | * End Tag: This is the normal exit, add size of end_tag |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 406 | */ |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 407 | *size_needed = buffer_size + ACPI_RS_SIZE_MIN; |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 408 | return_ACPI_STATUS(AE_OK); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 409 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 410 | case ACPI_RESOURCE_NAME_VENDOR_LARGE: |
| 411 | /* |
| 412 | * Vendor Resource: |
| 413 | * Add vendor data and ensure a 32-bit boundary for the structure |
| 414 | */ |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 415 | extra_struct_bytes = (u32) |
Len Brown | 4635861 | 2006-03-31 02:16:19 -0500 | [diff] [blame] | 416 | ACPI_ROUND_UP_to_32_bITS(resource_length) - |
| 417 | resource_length; |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 418 | break; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 419 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 420 | case ACPI_RESOURCE_NAME_ADDRESS32: |
| 421 | case ACPI_RESOURCE_NAME_ADDRESS16: |
| 422 | /* |
| 423 | * 32-Bit or 16-bit Address Resource: |
| 424 | * Add the size of any optional data (resource_source) |
| 425 | */ |
| 426 | extra_struct_bytes = |
| 427 | acpi_rs_stream_option_length(resource_length, |
| 428 | minimum_aml_resource_length); |
| 429 | break; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 430 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 431 | case ACPI_RESOURCE_NAME_EXTENDED_IRQ: |
| 432 | /* |
| 433 | * Extended IRQ: |
| 434 | * Point past the interrupt_vector_flags to get the |
| 435 | * interrupt_table_length. |
| 436 | */ |
| 437 | buffer++; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 438 | |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 439 | extra_struct_bytes = (u32) |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 440 | /* |
| 441 | * Add 4 bytes for each additional interrupt. Note: at |
| 442 | * least one interrupt is required and is included in |
| 443 | * the minimum descriptor size |
| 444 | */ |
| 445 | ((*buffer - 1) * sizeof(u32)) + |
| 446 | /* Add the size of any optional data (resource_source) */ |
| 447 | acpi_rs_stream_option_length(resource_length - |
| 448 | extra_struct_bytes, |
| 449 | minimum_aml_resource_length); |
| 450 | break; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 451 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 452 | case ACPI_RESOURCE_NAME_ADDRESS64: |
| 453 | /* |
| 454 | * 64-Bit Address Resource: |
| 455 | * Add the size of any optional data (resource_source) |
| 456 | * Ensure a 64-bit boundary for the structure |
| 457 | */ |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 458 | extra_struct_bytes = (u32) |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 459 | ACPI_ROUND_UP_to_64_bITS |
| 460 | (acpi_rs_stream_option_length |
| 461 | (resource_length, minimum_aml_resource_length)); |
| 462 | break; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 463 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 464 | default: |
| 465 | break; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | /* Update the required buffer size for the internal descriptor structs */ |
| 469 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 470 | temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] + |
| 471 | extra_struct_bytes); |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 472 | buffer_size += (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(temp16); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 473 | |
| 474 | /* |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 475 | * Point to the next resource within the stream |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 476 | * using the size of the header plus the length contained in the header |
| 477 | */ |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 478 | aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | } |
| 480 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 481 | /* Did not find an end_tag resource descriptor */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 482 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 483 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | } |
| 485 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | /******************************************************************************* |
| 487 | * |
| 488 | * FUNCTION: acpi_rs_get_pci_routing_table_length |
| 489 | * |
| 490 | * PARAMETERS: package_object - Pointer to the package object |
| 491 | * buffer_size_needed - u32 pointer of the size buffer |
| 492 | * needed to properly return the |
| 493 | * parsed data |
| 494 | * |
| 495 | * RETURN: Status |
| 496 | * |
| 497 | * DESCRIPTION: Given a package representing a PCI routing table, this |
| 498 | * calculates the size of the corresponding linked list of |
| 499 | * descriptions. |
| 500 | * |
| 501 | ******************************************************************************/ |
| 502 | |
| 503 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 504 | acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, |
| 505 | acpi_size * buffer_size_needed) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 507 | u32 number_of_elements; |
| 508 | acpi_size temp_size_needed = 0; |
| 509 | union acpi_operand_object **top_object_list; |
| 510 | u32 index; |
| 511 | union acpi_operand_object *package_element; |
| 512 | union acpi_operand_object **sub_object_list; |
| 513 | u8 name_found; |
| 514 | u32 table_index; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 515 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 516 | ACPI_FUNCTION_TRACE("rs_get_pci_routing_table_length"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 517 | |
| 518 | number_of_elements = package_object->package.count; |
| 519 | |
| 520 | /* |
| 521 | * Calculate the size of the return buffer. |
| 522 | * The base size is the number of elements * the sizes of the |
| 523 | * structures. Additional space for the strings is added below. |
| 524 | * The minus one is to subtract the size of the u8 Source[1] |
| 525 | * member because it is added below. |
| 526 | * |
| 527 | * But each PRT_ENTRY structure has a pointer to a string and |
| 528 | * the size of that string must be found. |
| 529 | */ |
| 530 | top_object_list = package_object->package.elements; |
| 531 | |
| 532 | for (index = 0; index < number_of_elements; index++) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame^] | 533 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 534 | /* Dereference the sub-package */ |
| 535 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | package_element = *top_object_list; |
| 537 | |
| 538 | /* |
| 539 | * The sub_object_list will now point to an array of the |
| 540 | * four IRQ elements: Address, Pin, Source and source_index |
| 541 | */ |
| 542 | sub_object_list = package_element->package.elements; |
| 543 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 544 | /* Scan the irq_table_elements for the Source Name String */ |
| 545 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 546 | name_found = FALSE; |
| 547 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 548 | for (table_index = 0; table_index < 4 && !name_found; |
| 549 | table_index++) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 550 | if (*sub_object_list && /* Null object allowed */ |
| 551 | ((ACPI_TYPE_STRING == |
| 552 | ACPI_GET_OBJECT_TYPE(*sub_object_list)) || |
| 553 | ((ACPI_TYPE_LOCAL_REFERENCE == |
| 554 | ACPI_GET_OBJECT_TYPE(*sub_object_list)) && |
| 555 | ((*sub_object_list)->reference.opcode == |
| 556 | AML_INT_NAMEPATH_OP)))) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | name_found = TRUE; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 558 | } else { |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 559 | /* Look at the next element */ |
| 560 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 561 | sub_object_list++; |
| 562 | } |
| 563 | } |
| 564 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 565 | temp_size_needed += (sizeof(struct acpi_pci_routing_table) - 4); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 567 | /* Was a String type found? */ |
| 568 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 569 | if (name_found) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 570 | if (ACPI_GET_OBJECT_TYPE(*sub_object_list) == |
| 571 | ACPI_TYPE_STRING) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 572 | /* |
| 573 | * The length String.Length field does not include the |
| 574 | * terminating NULL, add 1 |
| 575 | */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 576 | temp_size_needed += ((acpi_size) |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 577 | (*sub_object_list)->string. |
| 578 | length + 1); |
| 579 | } else { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 580 | temp_size_needed += acpi_ns_get_pathname_length((*sub_object_list)->reference.node); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 581 | } |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 582 | } else { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 583 | /* |
| 584 | * If no name was found, then this is a NULL, which is |
| 585 | * translated as a u32 zero. |
| 586 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 587 | temp_size_needed += sizeof(u32); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 588 | } |
| 589 | |
| 590 | /* Round up the size since each element must be aligned */ |
| 591 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 592 | temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 593 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 594 | /* Point to the next union acpi_operand_object */ |
| 595 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 | top_object_list++; |
| 597 | } |
| 598 | |
| 599 | /* |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 600 | * Adding an extra element to the end of the list, essentially a |
| 601 | * NULL terminator |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 602 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 603 | *buffer_size_needed = |
| 604 | temp_size_needed + sizeof(struct acpi_pci_routing_table); |
| 605 | return_ACPI_STATUS(AE_OK); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | } |