diff options
Diffstat (limited to 'drivers/acpi/resources/rscreate.c')
-rw-r--r-- | drivers/acpi/resources/rscreate.c | 297 |
1 files changed, 150 insertions, 147 deletions
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 8e0eae0d50bb..0911526b7ad8 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -41,15 +41,13 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acresrc.h> | 45 | #include <acpi/acresrc.h> |
47 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
48 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
49 | 48 | ||
50 | #define _COMPONENT ACPI_RESOURCES | 49 | #define _COMPONENT ACPI_RESOURCES |
51 | ACPI_MODULE_NAME ("rscreate") | 50 | ACPI_MODULE_NAME("rscreate") |
52 | |||
53 | 51 | ||
54 | /******************************************************************************* | 52 | /******************************************************************************* |
55 | * | 53 | * |
@@ -68,24 +66,20 @@ | |||
68 | * of device resources. | 66 | * of device resources. |
69 | * | 67 | * |
70 | ******************************************************************************/ | 68 | ******************************************************************************/ |
71 | |||
72 | acpi_status | 69 | acpi_status |
73 | acpi_rs_create_resource_list ( | 70 | acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, |
74 | union acpi_operand_object *byte_stream_buffer, | 71 | struct acpi_buffer *output_buffer) |
75 | struct acpi_buffer *output_buffer) | ||
76 | { | 72 | { |
77 | 73 | ||
78 | acpi_status status; | 74 | acpi_status status; |
79 | u8 *byte_stream_start; | 75 | u8 *byte_stream_start; |
80 | acpi_size list_size_needed = 0; | 76 | acpi_size list_size_needed = 0; |
81 | u32 byte_stream_buffer_length; | 77 | u32 byte_stream_buffer_length; |
82 | 78 | ||
79 | ACPI_FUNCTION_TRACE("rs_create_resource_list"); | ||
83 | 80 | ||
84 | ACPI_FUNCTION_TRACE ("rs_create_resource_list"); | 81 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_buffer = %p\n", |
85 | 82 | byte_stream_buffer)); | |
86 | |||
87 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n", | ||
88 | byte_stream_buffer)); | ||
89 | 83 | ||
90 | /* Params already validated, so we don't re-validate here */ | 84 | /* Params already validated, so we don't re-validate here */ |
91 | 85 | ||
@@ -96,36 +90,39 @@ acpi_rs_create_resource_list ( | |||
96 | * Pass the byte_stream_buffer into a module that can calculate | 90 | * Pass the byte_stream_buffer into a module that can calculate |
97 | * the buffer size needed for the linked list | 91 | * the buffer size needed for the linked list |
98 | */ | 92 | */ |
99 | status = acpi_rs_get_list_length (byte_stream_start, byte_stream_buffer_length, | 93 | status = |
100 | &list_size_needed); | 94 | acpi_rs_get_list_length(byte_stream_start, |
101 | 95 | byte_stream_buffer_length, | |
102 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", | 96 | &list_size_needed); |
103 | status, (u32) list_size_needed)); | 97 | |
104 | if (ACPI_FAILURE (status)) { | 98 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", |
105 | return_ACPI_STATUS (status); | 99 | status, (u32) list_size_needed)); |
100 | if (ACPI_FAILURE(status)) { | ||
101 | return_ACPI_STATUS(status); | ||
106 | } | 102 | } |
107 | 103 | ||
108 | /* Validate/Allocate/Clear caller buffer */ | 104 | /* Validate/Allocate/Clear caller buffer */ |
109 | 105 | ||
110 | status = acpi_ut_initialize_buffer (output_buffer, list_size_needed); | 106 | status = acpi_ut_initialize_buffer(output_buffer, list_size_needed); |
111 | if (ACPI_FAILURE (status)) { | 107 | if (ACPI_FAILURE(status)) { |
112 | return_ACPI_STATUS (status); | 108 | return_ACPI_STATUS(status); |
113 | } | 109 | } |
114 | 110 | ||
115 | /* Do the conversion */ | 111 | /* Do the conversion */ |
116 | 112 | ||
117 | status = acpi_rs_byte_stream_to_list (byte_stream_start, byte_stream_buffer_length, | 113 | status = |
118 | output_buffer->pointer); | 114 | acpi_rs_byte_stream_to_list(byte_stream_start, |
119 | if (ACPI_FAILURE (status)) { | 115 | byte_stream_buffer_length, |
120 | return_ACPI_STATUS (status); | 116 | output_buffer->pointer); |
117 | if (ACPI_FAILURE(status)) { | ||
118 | return_ACPI_STATUS(status); | ||
121 | } | 119 | } |
122 | 120 | ||
123 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 121 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", |
124 | output_buffer->pointer, (u32) output_buffer->length)); | 122 | output_buffer->pointer, (u32) output_buffer->length)); |
125 | return_ACPI_STATUS (AE_OK); | 123 | return_ACPI_STATUS(AE_OK); |
126 | } | 124 | } |
127 | 125 | ||
128 | |||
129 | /******************************************************************************* | 126 | /******************************************************************************* |
130 | * | 127 | * |
131 | * FUNCTION: acpi_rs_create_pci_routing_table | 128 | * FUNCTION: acpi_rs_create_pci_routing_table |
@@ -148,44 +145,41 @@ acpi_rs_create_resource_list ( | |||
148 | ******************************************************************************/ | 145 | ******************************************************************************/ |
149 | 146 | ||
150 | acpi_status | 147 | acpi_status |
151 | acpi_rs_create_pci_routing_table ( | 148 | acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, |
152 | union acpi_operand_object *package_object, | 149 | struct acpi_buffer *output_buffer) |
153 | struct acpi_buffer *output_buffer) | ||
154 | { | 150 | { |
155 | u8 *buffer; | 151 | u8 *buffer; |
156 | union acpi_operand_object **top_object_list; | 152 | union acpi_operand_object **top_object_list; |
157 | union acpi_operand_object **sub_object_list; | 153 | union acpi_operand_object **sub_object_list; |
158 | union acpi_operand_object *obj_desc; | 154 | union acpi_operand_object *obj_desc; |
159 | acpi_size buffer_size_needed = 0; | 155 | acpi_size buffer_size_needed = 0; |
160 | u32 number_of_elements; | 156 | u32 number_of_elements; |
161 | u32 index; | 157 | u32 index; |
162 | struct acpi_pci_routing_table *user_prt; | 158 | struct acpi_pci_routing_table *user_prt; |
163 | struct acpi_namespace_node *node; | 159 | struct acpi_namespace_node *node; |
164 | acpi_status status; | 160 | acpi_status status; |
165 | struct acpi_buffer path_buffer; | 161 | struct acpi_buffer path_buffer; |
166 | 162 | ||
167 | 163 | ACPI_FUNCTION_TRACE("rs_create_pci_routing_table"); | |
168 | ACPI_FUNCTION_TRACE ("rs_create_pci_routing_table"); | ||
169 | |||
170 | 164 | ||
171 | /* Params already validated, so we don't re-validate here */ | 165 | /* Params already validated, so we don't re-validate here */ |
172 | 166 | ||
173 | /* Get the required buffer length */ | 167 | /* Get the required buffer length */ |
174 | 168 | ||
175 | status = acpi_rs_get_pci_routing_table_length (package_object, | 169 | status = acpi_rs_get_pci_routing_table_length(package_object, |
176 | &buffer_size_needed); | 170 | &buffer_size_needed); |
177 | if (ACPI_FAILURE (status)) { | 171 | if (ACPI_FAILURE(status)) { |
178 | return_ACPI_STATUS (status); | 172 | return_ACPI_STATUS(status); |
179 | } | 173 | } |
180 | 174 | ||
181 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "buffer_size_needed = %X\n", | 175 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "buffer_size_needed = %X\n", |
182 | (u32) buffer_size_needed)); | 176 | (u32) buffer_size_needed)); |
183 | 177 | ||
184 | /* Validate/Allocate/Clear caller buffer */ | 178 | /* Validate/Allocate/Clear caller buffer */ |
185 | 179 | ||
186 | status = acpi_ut_initialize_buffer (output_buffer, buffer_size_needed); | 180 | status = acpi_ut_initialize_buffer(output_buffer, buffer_size_needed); |
187 | if (ACPI_FAILURE (status)) { | 181 | if (ACPI_FAILURE(status)) { |
188 | return_ACPI_STATUS (status); | 182 | return_ACPI_STATUS(status); |
189 | } | 183 | } |
190 | 184 | ||
191 | /* | 185 | /* |
@@ -193,10 +187,10 @@ acpi_rs_create_pci_routing_table ( | |||
193 | * should be a package that in turn contains an | 187 | * should be a package that in turn contains an |
194 | * acpi_integer Address, a u8 Pin, a Name and a u8 source_index. | 188 | * acpi_integer Address, a u8 Pin, a Name and a u8 source_index. |
195 | */ | 189 | */ |
196 | top_object_list = package_object->package.elements; | 190 | top_object_list = package_object->package.elements; |
197 | number_of_elements = package_object->package.count; | 191 | number_of_elements = package_object->package.count; |
198 | buffer = output_buffer->pointer; | 192 | buffer = output_buffer->pointer; |
199 | user_prt = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); | 193 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); |
200 | 194 | ||
201 | for (index = 0; index < number_of_elements; index++) { | 195 | for (index = 0; index < number_of_elements; index++) { |
202 | /* | 196 | /* |
@@ -206,31 +200,34 @@ acpi_rs_create_pci_routing_table ( | |||
206 | * be zero because we cleared the return buffer earlier | 200 | * be zero because we cleared the return buffer earlier |
207 | */ | 201 | */ |
208 | buffer += user_prt->length; | 202 | buffer += user_prt->length; |
209 | user_prt = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer); | 203 | user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); |
210 | 204 | ||
211 | /* | 205 | /* |
212 | * Fill in the Length field with the information we have at this point. | 206 | * Fill in the Length field with the information we have at this point. |
213 | * The minus four is to subtract the size of the u8 Source[4] member | 207 | * The minus four is to subtract the size of the u8 Source[4] member |
214 | * because it is added below. | 208 | * because it is added below. |
215 | */ | 209 | */ |
216 | user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); | 210 | user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4); |
217 | 211 | ||
218 | /* Each element of the top-level package must also be a package */ | 212 | /* Each element of the top-level package must also be a package */ |
219 | 213 | ||
220 | if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { | 214 | if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) { |
221 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 215 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
222 | "(PRT[%X]) Need sub-package, found %s\n", | 216 | "(PRT[%X]) Need sub-package, found %s\n", |
223 | index, acpi_ut_get_object_type_name (*top_object_list))); | 217 | index, |
224 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); | 218 | acpi_ut_get_object_type_name |
219 | (*top_object_list))); | ||
220 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
225 | } | 221 | } |
226 | 222 | ||
227 | /* Each sub-package must be of length 4 */ | 223 | /* Each sub-package must be of length 4 */ |
228 | 224 | ||
229 | if ((*top_object_list)->package.count != 4) { | 225 | if ((*top_object_list)->package.count != 4) { |
230 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 226 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
231 | "(PRT[%X]) Need package of length 4, found length %d\n", | 227 | "(PRT[%X]) Need package of length 4, found length %d\n", |
232 | index, (*top_object_list)->package.count)); | 228 | index, |
233 | return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT); | 229 | (*top_object_list)->package.count)); |
230 | return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT); | ||
234 | } | 231 | } |
235 | 232 | ||
236 | /* | 233 | /* |
@@ -243,40 +240,43 @@ acpi_rs_create_pci_routing_table ( | |||
243 | /* 1) First subobject: Dereference the PRT.Address */ | 240 | /* 1) First subobject: Dereference the PRT.Address */ |
244 | 241 | ||
245 | obj_desc = sub_object_list[0]; | 242 | obj_desc = sub_object_list[0]; |
246 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 243 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
247 | user_prt->address = obj_desc->integer.value; | 244 | user_prt->address = obj_desc->integer.value; |
248 | } | 245 | } else { |
249 | else { | 246 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
250 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 247 | "(PRT[%X].Address) Need Integer, found %s\n", |
251 | "(PRT[%X].Address) Need Integer, found %s\n", | 248 | index, |
252 | index, acpi_ut_get_object_type_name (obj_desc))); | 249 | acpi_ut_get_object_type_name |
253 | return_ACPI_STATUS (AE_BAD_DATA); | 250 | (obj_desc))); |
251 | return_ACPI_STATUS(AE_BAD_DATA); | ||
254 | } | 252 | } |
255 | 253 | ||
256 | /* 2) Second subobject: Dereference the PRT.Pin */ | 254 | /* 2) Second subobject: Dereference the PRT.Pin */ |
257 | 255 | ||
258 | obj_desc = sub_object_list[1]; | 256 | obj_desc = sub_object_list[1]; |
259 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 257 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
260 | user_prt->pin = (u32) obj_desc->integer.value; | 258 | user_prt->pin = (u32) obj_desc->integer.value; |
261 | } | 259 | } else { |
262 | else { | 260 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
263 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 261 | "(PRT[%X].Pin) Need Integer, found %s\n", |
264 | "(PRT[%X].Pin) Need Integer, found %s\n", | 262 | index, |
265 | index, acpi_ut_get_object_type_name (obj_desc))); | 263 | acpi_ut_get_object_type_name |
266 | return_ACPI_STATUS (AE_BAD_DATA); | 264 | (obj_desc))); |
265 | return_ACPI_STATUS(AE_BAD_DATA); | ||
267 | } | 266 | } |
268 | 267 | ||
269 | /* 3) Third subobject: Dereference the PRT.source_name */ | 268 | /* 3) Third subobject: Dereference the PRT.source_name */ |
270 | 269 | ||
271 | obj_desc = sub_object_list[2]; | 270 | obj_desc = sub_object_list[2]; |
272 | switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { | 271 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
273 | case ACPI_TYPE_LOCAL_REFERENCE: | 272 | case ACPI_TYPE_LOCAL_REFERENCE: |
274 | 273 | ||
275 | if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) { | 274 | if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) { |
276 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 275 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
277 | "(PRT[%X].Source) Need name, found reference op %X\n", | 276 | "(PRT[%X].Source) Need name, found reference op %X\n", |
278 | index, obj_desc->reference.opcode)); | 277 | index, |
279 | return_ACPI_STATUS (AE_BAD_DATA); | 278 | obj_desc->reference.opcode)); |
279 | return_ACPI_STATUS(AE_BAD_DATA); | ||
280 | } | 280 | } |
281 | 281 | ||
282 | node = obj_desc->reference.node; | 282 | node = obj_desc->reference.node; |
@@ -284,21 +284,23 @@ acpi_rs_create_pci_routing_table ( | |||
284 | /* Use *remaining* length of the buffer as max for pathname */ | 284 | /* Use *remaining* length of the buffer as max for pathname */ |
285 | 285 | ||
286 | path_buffer.length = output_buffer->length - | 286 | path_buffer.length = output_buffer->length - |
287 | (u32) ((u8 *) user_prt->source - | 287 | (u32) ((u8 *) user_prt->source - |
288 | (u8 *) output_buffer->pointer); | 288 | (u8 *) output_buffer->pointer); |
289 | path_buffer.pointer = user_prt->source; | 289 | path_buffer.pointer = user_prt->source; |
290 | 290 | ||
291 | status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); | 291 | status = |
292 | acpi_ns_handle_to_pathname((acpi_handle) node, | ||
293 | &path_buffer); | ||
292 | 294 | ||
293 | /* +1 to include null terminator */ | 295 | /* +1 to include null terminator */ |
294 | 296 | ||
295 | user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; | 297 | user_prt->length += |
298 | (u32) ACPI_STRLEN(user_prt->source) + 1; | ||
296 | break; | 299 | break; |
297 | 300 | ||
298 | |||
299 | case ACPI_TYPE_STRING: | 301 | case ACPI_TYPE_STRING: |
300 | 302 | ||
301 | ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); | 303 | ACPI_STRCPY(user_prt->source, obj_desc->string.pointer); |
302 | 304 | ||
303 | /* | 305 | /* |
304 | * Add to the Length field the length of the string | 306 | * Add to the Length field the length of the string |
@@ -307,7 +309,6 @@ acpi_rs_create_pci_routing_table ( | |||
307 | user_prt->length += obj_desc->string.length + 1; | 309 | user_prt->length += obj_desc->string.length + 1; |
308 | break; | 310 | break; |
309 | 311 | ||
310 | |||
311 | case ACPI_TYPE_INTEGER: | 312 | case ACPI_TYPE_INTEGER: |
312 | /* | 313 | /* |
313 | * If this is a number, then the Source Name is NULL, since the | 314 | * If this is a number, then the Source Name is NULL, since the |
@@ -315,33 +316,36 @@ acpi_rs_create_pci_routing_table ( | |||
315 | * | 316 | * |
316 | * Add to the Length field the length of the u32 NULL | 317 | * Add to the Length field the length of the u32 NULL |
317 | */ | 318 | */ |
318 | user_prt->length += sizeof (u32); | 319 | user_prt->length += sizeof(u32); |
319 | break; | 320 | break; |
320 | 321 | ||
321 | |||
322 | default: | 322 | default: |
323 | 323 | ||
324 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 324 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
325 | "(PRT[%X].Source) Need Ref/String/Integer, found %s\n", | 325 | "(PRT[%X].Source) Need Ref/String/Integer, found %s\n", |
326 | index, acpi_ut_get_object_type_name (obj_desc))); | 326 | index, |
327 | return_ACPI_STATUS (AE_BAD_DATA); | 327 | acpi_ut_get_object_type_name |
328 | (obj_desc))); | ||
329 | return_ACPI_STATUS(AE_BAD_DATA); | ||
328 | } | 330 | } |
329 | 331 | ||
330 | /* Now align the current length */ | 332 | /* Now align the current length */ |
331 | 333 | ||
332 | user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); | 334 | user_prt->length = |
335 | (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length); | ||
333 | 336 | ||
334 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 337 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
335 | 338 | ||
336 | obj_desc = sub_object_list[3]; | 339 | obj_desc = sub_object_list[3]; |
337 | if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { | 340 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
338 | user_prt->source_index = (u32) obj_desc->integer.value; | 341 | user_prt->source_index = (u32) obj_desc->integer.value; |
339 | } | 342 | } else { |
340 | else { | 343 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
341 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 344 | "(PRT[%X].source_index) Need Integer, found %s\n", |
342 | "(PRT[%X].source_index) Need Integer, found %s\n", | 345 | index, |
343 | index, acpi_ut_get_object_type_name (obj_desc))); | 346 | acpi_ut_get_object_type_name |
344 | return_ACPI_STATUS (AE_BAD_DATA); | 347 | (obj_desc))); |
348 | return_ACPI_STATUS(AE_BAD_DATA); | ||
345 | } | 349 | } |
346 | 350 | ||
347 | /* Point to the next union acpi_operand_object in the top level package */ | 351 | /* Point to the next union acpi_operand_object in the top level package */ |
@@ -349,12 +353,11 @@ acpi_rs_create_pci_routing_table ( | |||
349 | top_object_list++; | 353 | top_object_list++; |
350 | } | 354 | } |
351 | 355 | ||
352 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 356 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", |
353 | output_buffer->pointer, (u32) output_buffer->length)); | 357 | output_buffer->pointer, (u32) output_buffer->length)); |
354 | return_ACPI_STATUS (AE_OK); | 358 | return_ACPI_STATUS(AE_OK); |
355 | } | 359 | } |
356 | 360 | ||
357 | |||
358 | /******************************************************************************* | 361 | /******************************************************************************* |
359 | * | 362 | * |
360 | * FUNCTION: acpi_rs_create_byte_stream | 363 | * FUNCTION: acpi_rs_create_byte_stream |
@@ -374,19 +377,16 @@ acpi_rs_create_pci_routing_table ( | |||
374 | ******************************************************************************/ | 377 | ******************************************************************************/ |
375 | 378 | ||
376 | acpi_status | 379 | acpi_status |
377 | acpi_rs_create_byte_stream ( | 380 | acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, |
378 | struct acpi_resource *linked_list_buffer, | 381 | struct acpi_buffer *output_buffer) |
379 | struct acpi_buffer *output_buffer) | ||
380 | { | 382 | { |
381 | acpi_status status; | 383 | acpi_status status; |
382 | acpi_size byte_stream_size_needed = 0; | 384 | acpi_size byte_stream_size_needed = 0; |
383 | |||
384 | |||
385 | ACPI_FUNCTION_TRACE ("rs_create_byte_stream"); | ||
386 | 385 | ||
386 | ACPI_FUNCTION_TRACE("rs_create_byte_stream"); | ||
387 | 387 | ||
388 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "linked_list_buffer = %p\n", | 388 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", |
389 | linked_list_buffer)); | 389 | linked_list_buffer)); |
390 | 390 | ||
391 | /* | 391 | /* |
392 | * Params already validated, so we don't re-validate here | 392 | * Params already validated, so we don't re-validate here |
@@ -394,32 +394,35 @@ acpi_rs_create_byte_stream ( | |||
394 | * Pass the linked_list_buffer into a module that calculates | 394 | * Pass the linked_list_buffer into a module that calculates |
395 | * the buffer size needed for the byte stream. | 395 | * the buffer size needed for the byte stream. |
396 | */ | 396 | */ |
397 | status = acpi_rs_get_byte_stream_length (linked_list_buffer, | 397 | status = acpi_rs_get_byte_stream_length(linked_list_buffer, |
398 | &byte_stream_size_needed); | 398 | &byte_stream_size_needed); |
399 | 399 | ||
400 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", | 400 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "byte_stream_size_needed=%X, %s\n", |
401 | (u32) byte_stream_size_needed, acpi_format_exception (status))); | 401 | (u32) byte_stream_size_needed, |
402 | if (ACPI_FAILURE (status)) { | 402 | acpi_format_exception(status))); |
403 | return_ACPI_STATUS (status); | 403 | if (ACPI_FAILURE(status)) { |
404 | return_ACPI_STATUS(status); | ||
404 | } | 405 | } |
405 | 406 | ||
406 | /* Validate/Allocate/Clear caller buffer */ | 407 | /* Validate/Allocate/Clear caller buffer */ |
407 | 408 | ||
408 | status = acpi_ut_initialize_buffer (output_buffer, byte_stream_size_needed); | 409 | status = |
409 | if (ACPI_FAILURE (status)) { | 410 | acpi_ut_initialize_buffer(output_buffer, byte_stream_size_needed); |
410 | return_ACPI_STATUS (status); | 411 | if (ACPI_FAILURE(status)) { |
412 | return_ACPI_STATUS(status); | ||
411 | } | 413 | } |
412 | 414 | ||
413 | /* Do the conversion */ | 415 | /* Do the conversion */ |
414 | 416 | ||
415 | status = acpi_rs_list_to_byte_stream (linked_list_buffer, byte_stream_size_needed, | 417 | status = |
416 | output_buffer->pointer); | 418 | acpi_rs_list_to_byte_stream(linked_list_buffer, |
417 | if (ACPI_FAILURE (status)) { | 419 | byte_stream_size_needed, |
418 | return_ACPI_STATUS (status); | 420 | output_buffer->pointer); |
421 | if (ACPI_FAILURE(status)) { | ||
422 | return_ACPI_STATUS(status); | ||
419 | } | 423 | } |
420 | 424 | ||
421 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 425 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", |
422 | output_buffer->pointer, (u32) output_buffer->length)); | 426 | output_buffer->pointer, (u32) output_buffer->length)); |
423 | return_ACPI_STATUS (AE_OK); | 427 | return_ACPI_STATUS(AE_OK); |
424 | } | 428 | } |
425 | |||