diff options
Diffstat (limited to 'drivers/acpi/resources/rsxface.c')
| -rw-r--r-- | drivers/acpi/resources/rsxface.c | 182 |
1 files changed, 78 insertions, 104 deletions
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 83c944b8b097..ee5a5c509199 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
| @@ -47,10 +47,9 @@ | |||
| 47 | #include <acpi/acresrc.h> | 47 | #include <acpi/acresrc.h> |
| 48 | 48 | ||
| 49 | #define _COMPONENT ACPI_RESOURCES | 49 | #define _COMPONENT ACPI_RESOURCES |
| 50 | ACPI_MODULE_NAME ("rsxface") | 50 | ACPI_MODULE_NAME("rsxface") |
| 51 | 51 | ||
| 52 | /* Local macros for 16,32-bit to 64-bit conversion */ | 52 | /* Local macros for 16,32-bit to 64-bit conversion */ |
| 53 | |||
| 54 | #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) | 53 | #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) |
| 55 | #define ACPI_COPY_ADDRESS(out, in) \ | 54 | #define ACPI_COPY_ADDRESS(out, in) \ |
| 56 | ACPI_COPY_FIELD(out, in, resource_type); \ | 55 | ACPI_COPY_FIELD(out, in, resource_type); \ |
| @@ -65,8 +64,6 @@ | |||
| 65 | ACPI_COPY_FIELD(out, in, address_translation_offset); \ | 64 | ACPI_COPY_FIELD(out, in, address_translation_offset); \ |
| 66 | ACPI_COPY_FIELD(out, in, address_length); \ | 65 | ACPI_COPY_FIELD(out, in, address_length); \ |
| 67 | ACPI_COPY_FIELD(out, in, resource_source); | 66 | ACPI_COPY_FIELD(out, in, resource_source); |
| 68 | |||
| 69 | |||
| 70 | /******************************************************************************* | 67 | /******************************************************************************* |
| 71 | * | 68 | * |
| 72 | * FUNCTION: acpi_get_irq_routing_table | 69 | * FUNCTION: acpi_get_irq_routing_table |
| @@ -89,17 +86,13 @@ | |||
| 89 | * the object indicated by the passed device_handle. | 86 | * the object indicated by the passed device_handle. |
| 90 | * | 87 | * |
| 91 | ******************************************************************************/ | 88 | ******************************************************************************/ |
| 92 | |||
| 93 | acpi_status | 89 | acpi_status |
| 94 | acpi_get_irq_routing_table ( | 90 | acpi_get_irq_routing_table(acpi_handle device_handle, |
| 95 | acpi_handle device_handle, | 91 | struct acpi_buffer *ret_buffer) |
| 96 | struct acpi_buffer *ret_buffer) | ||
| 97 | { | 92 | { |
| 98 | acpi_status status; | 93 | acpi_status status; |
| 99 | |||
| 100 | |||
| 101 | ACPI_FUNCTION_TRACE ("acpi_get_irq_routing_table "); | ||
| 102 | 94 | ||
| 95 | ACPI_FUNCTION_TRACE("acpi_get_irq_routing_table "); | ||
| 103 | 96 | ||
| 104 | /* | 97 | /* |
| 105 | * Must have a valid handle and buffer, So we have to have a handle | 98 | * Must have a valid handle and buffer, So we have to have a handle |
| @@ -108,19 +101,18 @@ acpi_get_irq_routing_table ( | |||
| 108 | * we'll be returning the needed buffer size, so keep going. | 101 | * we'll be returning the needed buffer size, so keep going. |
| 109 | */ | 102 | */ |
| 110 | if (!device_handle) { | 103 | if (!device_handle) { |
| 111 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 104 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 112 | } | 105 | } |
| 113 | 106 | ||
| 114 | status = acpi_ut_validate_buffer (ret_buffer); | 107 | status = acpi_ut_validate_buffer(ret_buffer); |
| 115 | if (ACPI_FAILURE (status)) { | 108 | if (ACPI_FAILURE(status)) { |
| 116 | return_ACPI_STATUS (status); | 109 | return_ACPI_STATUS(status); |
| 117 | } | 110 | } |
| 118 | 111 | ||
| 119 | status = acpi_rs_get_prt_method_data (device_handle, ret_buffer); | 112 | status = acpi_rs_get_prt_method_data(device_handle, ret_buffer); |
| 120 | return_ACPI_STATUS (status); | 113 | return_ACPI_STATUS(status); |
| 121 | } | 114 | } |
| 122 | 115 | ||
| 123 | |||
| 124 | /******************************************************************************* | 116 | /******************************************************************************* |
| 125 | * | 117 | * |
| 126 | * FUNCTION: acpi_get_current_resources | 118 | * FUNCTION: acpi_get_current_resources |
| @@ -146,15 +138,12 @@ acpi_get_irq_routing_table ( | |||
| 146 | ******************************************************************************/ | 138 | ******************************************************************************/ |
| 147 | 139 | ||
| 148 | acpi_status | 140 | acpi_status |
| 149 | acpi_get_current_resources ( | 141 | acpi_get_current_resources(acpi_handle device_handle, |
| 150 | acpi_handle device_handle, | 142 | struct acpi_buffer *ret_buffer) |
| 151 | struct acpi_buffer *ret_buffer) | ||
| 152 | { | 143 | { |
| 153 | acpi_status status; | 144 | acpi_status status; |
| 154 | |||
| 155 | |||
| 156 | ACPI_FUNCTION_TRACE ("acpi_get_current_resources"); | ||
| 157 | 145 | ||
| 146 | ACPI_FUNCTION_TRACE("acpi_get_current_resources"); | ||
| 158 | 147 | ||
| 159 | /* | 148 | /* |
| 160 | * Must have a valid handle and buffer, So we have to have a handle | 149 | * Must have a valid handle and buffer, So we have to have a handle |
| @@ -163,19 +152,19 @@ acpi_get_current_resources ( | |||
| 163 | * we'll be returning the needed buffer size, so keep going. | 152 | * we'll be returning the needed buffer size, so keep going. |
| 164 | */ | 153 | */ |
| 165 | if (!device_handle) { | 154 | if (!device_handle) { |
| 166 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 155 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 167 | } | 156 | } |
| 168 | 157 | ||
| 169 | status = acpi_ut_validate_buffer (ret_buffer); | 158 | status = acpi_ut_validate_buffer(ret_buffer); |
| 170 | if (ACPI_FAILURE (status)) { | 159 | if (ACPI_FAILURE(status)) { |
| 171 | return_ACPI_STATUS (status); | 160 | return_ACPI_STATUS(status); |
| 172 | } | 161 | } |
| 173 | 162 | ||
| 174 | status = acpi_rs_get_crs_method_data (device_handle, ret_buffer); | 163 | status = acpi_rs_get_crs_method_data(device_handle, ret_buffer); |
| 175 | return_ACPI_STATUS (status); | 164 | return_ACPI_STATUS(status); |
| 176 | } | 165 | } |
| 177 | EXPORT_SYMBOL(acpi_get_current_resources); | ||
| 178 | 166 | ||
| 167 | EXPORT_SYMBOL(acpi_get_current_resources); | ||
| 179 | 168 | ||
| 180 | /******************************************************************************* | 169 | /******************************************************************************* |
| 181 | * | 170 | * |
| @@ -200,15 +189,12 @@ EXPORT_SYMBOL(acpi_get_current_resources); | |||
| 200 | 189 | ||
| 201 | #ifdef ACPI_FUTURE_USAGE | 190 | #ifdef ACPI_FUTURE_USAGE |
| 202 | acpi_status | 191 | acpi_status |
| 203 | acpi_get_possible_resources ( | 192 | acpi_get_possible_resources(acpi_handle device_handle, |
| 204 | acpi_handle device_handle, | 193 | struct acpi_buffer *ret_buffer) |
| 205 | struct acpi_buffer *ret_buffer) | ||
| 206 | { | 194 | { |
| 207 | acpi_status status; | 195 | acpi_status status; |
| 208 | |||
| 209 | |||
| 210 | ACPI_FUNCTION_TRACE ("acpi_get_possible_resources"); | ||
| 211 | 196 | ||
| 197 | ACPI_FUNCTION_TRACE("acpi_get_possible_resources"); | ||
| 212 | 198 | ||
| 213 | /* | 199 | /* |
| 214 | * Must have a valid handle and buffer, So we have to have a handle | 200 | * Must have a valid handle and buffer, So we have to have a handle |
| @@ -217,20 +203,20 @@ acpi_get_possible_resources ( | |||
| 217 | * we'll be returning the needed buffer size, so keep going. | 203 | * we'll be returning the needed buffer size, so keep going. |
| 218 | */ | 204 | */ |
| 219 | if (!device_handle) { | 205 | if (!device_handle) { |
| 220 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 206 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 221 | } | 207 | } |
| 222 | 208 | ||
| 223 | status = acpi_ut_validate_buffer (ret_buffer); | 209 | status = acpi_ut_validate_buffer(ret_buffer); |
| 224 | if (ACPI_FAILURE (status)) { | 210 | if (ACPI_FAILURE(status)) { |
| 225 | return_ACPI_STATUS (status); | 211 | return_ACPI_STATUS(status); |
| 226 | } | 212 | } |
| 227 | 213 | ||
| 228 | status = acpi_rs_get_prs_method_data (device_handle, ret_buffer); | 214 | status = acpi_rs_get_prs_method_data(device_handle, ret_buffer); |
| 229 | return_ACPI_STATUS (status); | 215 | return_ACPI_STATUS(status); |
| 230 | } | 216 | } |
| 231 | EXPORT_SYMBOL(acpi_get_possible_resources); | ||
| 232 | #endif /* ACPI_FUTURE_USAGE */ | ||
| 233 | 217 | ||
| 218 | EXPORT_SYMBOL(acpi_get_possible_resources); | ||
| 219 | #endif /* ACPI_FUTURE_USAGE */ | ||
| 234 | 220 | ||
| 235 | /******************************************************************************* | 221 | /******************************************************************************* |
| 236 | * | 222 | * |
| @@ -252,37 +238,33 @@ EXPORT_SYMBOL(acpi_get_possible_resources); | |||
| 252 | ******************************************************************************/ | 238 | ******************************************************************************/ |
| 253 | 239 | ||
| 254 | acpi_status | 240 | acpi_status |
| 255 | acpi_walk_resources ( | 241 | acpi_walk_resources(acpi_handle device_handle, |
| 256 | acpi_handle device_handle, | 242 | char *path, |
| 257 | char *path, | 243 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) |
| 258 | ACPI_WALK_RESOURCE_CALLBACK user_function, | ||
| 259 | void *context) | ||
| 260 | { | 244 | { |
| 261 | acpi_status status; | 245 | acpi_status status; |
| 262 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 246 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 263 | struct acpi_resource *resource; | 247 | struct acpi_resource *resource; |
| 264 | struct acpi_resource *buffer_end; | 248 | struct acpi_resource *buffer_end; |
| 265 | |||
| 266 | |||
| 267 | ACPI_FUNCTION_TRACE ("acpi_walk_resources"); | ||
| 268 | 249 | ||
| 250 | ACPI_FUNCTION_TRACE("acpi_walk_resources"); | ||
| 269 | 251 | ||
| 270 | if (!device_handle || | 252 | if (!device_handle || |
| 271 | (ACPI_STRNCMP (path, METHOD_NAME__CRS, sizeof (METHOD_NAME__CRS)) && | 253 | (ACPI_STRNCMP(path, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && |
| 272 | ACPI_STRNCMP (path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS)))) { | 254 | ACPI_STRNCMP(path, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { |
| 273 | return_ACPI_STATUS (AE_BAD_PARAMETER); | 255 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 274 | } | 256 | } |
| 275 | 257 | ||
| 276 | status = acpi_rs_get_method_data (device_handle, path, &buffer); | 258 | status = acpi_rs_get_method_data(device_handle, path, &buffer); |
| 277 | if (ACPI_FAILURE (status)) { | 259 | if (ACPI_FAILURE(status)) { |
| 278 | return_ACPI_STATUS (status); | 260 | return_ACPI_STATUS(status); |
| 279 | } | 261 | } |
| 280 | 262 | ||
| 281 | /* Setup pointers */ | 263 | /* Setup pointers */ |
| 282 | 264 | ||
| 283 | resource = (struct acpi_resource *) buffer.pointer; | 265 | resource = (struct acpi_resource *)buffer.pointer; |
| 284 | buffer_end = ACPI_CAST_PTR (struct acpi_resource, | 266 | buffer_end = ACPI_CAST_PTR(struct acpi_resource, |
| 285 | ((u8 *) buffer.pointer + buffer.length)); | 267 | ((u8 *) buffer.pointer + buffer.length)); |
| 286 | 268 | ||
| 287 | /* Walk the resource list */ | 269 | /* Walk the resource list */ |
| 288 | 270 | ||
| @@ -291,7 +273,7 @@ acpi_walk_resources ( | |||
| 291 | break; | 273 | break; |
| 292 | } | 274 | } |
| 293 | 275 | ||
| 294 | status = user_function (resource, context); | 276 | status = user_function(resource, context); |
| 295 | 277 | ||
| 296 | switch (status) { | 278 | switch (status) { |
| 297 | case AE_OK: | 279 | case AE_OK: |
| @@ -318,7 +300,7 @@ acpi_walk_resources ( | |||
| 318 | 300 | ||
| 319 | /* Get the next resource descriptor */ | 301 | /* Get the next resource descriptor */ |
| 320 | 302 | ||
| 321 | resource = ACPI_NEXT_RESOURCE (resource); | 303 | resource = ACPI_NEXT_RESOURCE(resource); |
| 322 | 304 | ||
| 323 | /* Check for end-of-buffer */ | 305 | /* Check for end-of-buffer */ |
| 324 | 306 | ||
| @@ -327,13 +309,13 @@ acpi_walk_resources ( | |||
| 327 | } | 309 | } |
| 328 | } | 310 | } |
| 329 | 311 | ||
| 330 | cleanup: | 312 | cleanup: |
| 331 | 313 | ||
| 332 | acpi_os_free (buffer.pointer); | 314 | acpi_os_free(buffer.pointer); |
| 333 | return_ACPI_STATUS (status); | 315 | return_ACPI_STATUS(status); |
| 334 | } | 316 | } |
| 335 | EXPORT_SYMBOL(acpi_walk_resources); | ||
| 336 | 317 | ||
| 318 | EXPORT_SYMBOL(acpi_walk_resources); | ||
| 337 | 319 | ||
| 338 | /******************************************************************************* | 320 | /******************************************************************************* |
| 339 | * | 321 | * |
| @@ -354,30 +336,25 @@ EXPORT_SYMBOL(acpi_walk_resources); | |||
| 354 | ******************************************************************************/ | 336 | ******************************************************************************/ |
| 355 | 337 | ||
| 356 | acpi_status | 338 | acpi_status |
| 357 | acpi_set_current_resources ( | 339 | acpi_set_current_resources(acpi_handle device_handle, |
| 358 | acpi_handle device_handle, | 340 | struct acpi_buffer *in_buffer) |
| 359 | struct acpi_buffer *in_buffer) | ||
| 360 | { | 341 | { |
| 361 | acpi_status status; | 342 | acpi_status status; |
| 362 | |||
| 363 | |||
| 364 | ACPI_FUNCTION_TRACE ("acpi_set_current_resources"); | ||
| 365 | 343 | ||
| 344 | ACPI_FUNCTION_TRACE("acpi_set_current_resources"); | ||
| 366 | 345 | ||
| 367 | /* Must have a valid handle and buffer */ | 346 | /* Must have a valid handle and buffer */ |
| 368 | 347 | ||
| 369 | if ((!device_handle) || | 348 | if ((!device_handle) || |
| 370 | (!in_buffer) || | 349 | (!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { |
| 371 | (!in_buffer->pointer) || | 350 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
| 372 | (!in_buffer->length)) { | ||
| 373 | return_ACPI_STATUS (AE_BAD_PARAMETER); | ||
| 374 | } | 351 | } |
| 375 | 352 | ||
| 376 | status = acpi_rs_set_srs_method_data (device_handle, in_buffer); | 353 | status = acpi_rs_set_srs_method_data(device_handle, in_buffer); |
| 377 | return_ACPI_STATUS (status); | 354 | return_ACPI_STATUS(status); |
| 378 | } | 355 | } |
| 379 | EXPORT_SYMBOL(acpi_set_current_resources); | ||
| 380 | 356 | ||
| 357 | EXPORT_SYMBOL(acpi_set_current_resources); | ||
| 381 | 358 | ||
| 382 | /****************************************************************************** | 359 | /****************************************************************************** |
| 383 | * | 360 | * |
| @@ -398,41 +375,38 @@ EXPORT_SYMBOL(acpi_set_current_resources); | |||
| 398 | ******************************************************************************/ | 375 | ******************************************************************************/ |
| 399 | 376 | ||
| 400 | acpi_status | 377 | acpi_status |
| 401 | acpi_resource_to_address64 ( | 378 | acpi_resource_to_address64(struct acpi_resource *resource, |
| 402 | struct acpi_resource *resource, | 379 | struct acpi_resource_address64 *out) |
| 403 | struct acpi_resource_address64 *out) | ||
| 404 | { | 380 | { |
| 405 | struct acpi_resource_address16 *address16; | 381 | struct acpi_resource_address16 *address16; |
| 406 | struct acpi_resource_address32 *address32; | 382 | struct acpi_resource_address32 *address32; |
| 407 | |||
| 408 | 383 | ||
| 409 | switch (resource->id) { | 384 | switch (resource->id) { |
| 410 | case ACPI_RSTYPE_ADDRESS16: | 385 | case ACPI_RSTYPE_ADDRESS16: |
| 411 | 386 | ||
| 412 | address16 = (struct acpi_resource_address16 *) &resource->data; | 387 | address16 = (struct acpi_resource_address16 *)&resource->data; |
| 413 | ACPI_COPY_ADDRESS (out, address16); | 388 | ACPI_COPY_ADDRESS(out, address16); |
| 414 | break; | 389 | break; |
| 415 | 390 | ||
| 416 | |||
| 417 | case ACPI_RSTYPE_ADDRESS32: | 391 | case ACPI_RSTYPE_ADDRESS32: |
| 418 | 392 | ||
| 419 | address32 = (struct acpi_resource_address32 *) &resource->data; | 393 | address32 = (struct acpi_resource_address32 *)&resource->data; |
| 420 | ACPI_COPY_ADDRESS (out, address32); | 394 | ACPI_COPY_ADDRESS(out, address32); |
| 421 | break; | 395 | break; |
| 422 | 396 | ||
| 423 | |||
| 424 | case ACPI_RSTYPE_ADDRESS64: | 397 | case ACPI_RSTYPE_ADDRESS64: |
| 425 | 398 | ||
| 426 | /* Simple copy for 64 bit source */ | 399 | /* Simple copy for 64 bit source */ |
| 427 | 400 | ||
| 428 | ACPI_MEMCPY (out, &resource->data, sizeof (struct acpi_resource_address64)); | 401 | ACPI_MEMCPY(out, &resource->data, |
| 402 | sizeof(struct acpi_resource_address64)); | ||
| 429 | break; | 403 | break; |
| 430 | 404 | ||
| 431 | |||
| 432 | default: | 405 | default: |
| 433 | return (AE_BAD_PARAMETER); | 406 | return (AE_BAD_PARAMETER); |
| 434 | } | 407 | } |
| 435 | 408 | ||
| 436 | return (AE_OK); | 409 | return (AE_OK); |
| 437 | } | 410 | } |
| 411 | |||
| 438 | EXPORT_SYMBOL(acpi_resource_to_address64); | 412 | EXPORT_SYMBOL(acpi_resource_to_address64); |
