diff options
Diffstat (limited to 'drivers')
277 files changed, 3022 insertions, 3296 deletions
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 8dcade63b04b..cae786ca8600 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
| @@ -196,11 +196,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
| 196 | notify_info->notify.value = (u16) notify_value; | 196 | notify_info->notify.value = (u16) notify_value; |
| 197 | notify_info->notify.handler_obj = handler_obj; | 197 | notify_info->notify.handler_obj = handler_obj; |
| 198 | 198 | ||
| 199 | acpi_ex_relinquish_interpreter(); | 199 | acpi_ex_exit_interpreter(); |
| 200 | 200 | ||
| 201 | acpi_ev_notify_dispatch(notify_info); | 201 | acpi_ev_notify_dispatch(notify_info); |
| 202 | 202 | ||
| 203 | acpi_ex_reacquire_interpreter(); | 203 | status = acpi_ex_enter_interpreter(); |
| 204 | if (ACPI_FAILURE(status)) { | ||
| 205 | return_ACPI_STATUS(status); | ||
| 206 | } | ||
| 207 | |||
| 204 | } | 208 | } |
| 205 | 209 | ||
| 206 | if (!handler_obj) { | 210 | if (!handler_obj) { |
| @@ -549,7 +553,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
| 549 | acpi_gbl_global_lock_acquired = FALSE; | 553 | acpi_gbl_global_lock_acquired = FALSE; |
| 550 | 554 | ||
| 551 | /* Release the local GL mutex */ | 555 | /* Release the local GL mutex */ |
| 552 | acpi_ev_global_lock_thread_id = 0; | 556 | acpi_ev_global_lock_thread_id = NULL; |
| 553 | acpi_ev_global_lock_acquired = 0; | 557 | acpi_ev_global_lock_acquired = 0; |
| 554 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex); | 558 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex); |
| 555 | return_ACPI_STATUS(status); | 559 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index e99f0c435a47..96b0e8431748 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
| @@ -291,6 +291,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
| 291 | u32 bit_width, acpi_integer * value) | 291 | u32 bit_width, acpi_integer * value) |
| 292 | { | 292 | { |
| 293 | acpi_status status; | 293 | acpi_status status; |
| 294 | acpi_status status2; | ||
| 294 | acpi_adr_space_handler handler; | 295 | acpi_adr_space_handler handler; |
| 295 | acpi_adr_space_setup region_setup; | 296 | acpi_adr_space_setup region_setup; |
| 296 | union acpi_operand_object *handler_desc; | 297 | union acpi_operand_object *handler_desc; |
| @@ -344,7 +345,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
| 344 | * setup will potentially execute control methods | 345 | * setup will potentially execute control methods |
| 345 | * (e.g., _REG method for this region) | 346 | * (e.g., _REG method for this region) |
| 346 | */ | 347 | */ |
| 347 | acpi_ex_relinquish_interpreter(); | 348 | acpi_ex_exit_interpreter(); |
| 348 | 349 | ||
| 349 | status = region_setup(region_obj, ACPI_REGION_ACTIVATE, | 350 | status = region_setup(region_obj, ACPI_REGION_ACTIVATE, |
| 350 | handler_desc->address_space.context, | 351 | handler_desc->address_space.context, |
| @@ -352,7 +353,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
| 352 | 353 | ||
| 353 | /* Re-enter the interpreter */ | 354 | /* Re-enter the interpreter */ |
| 354 | 355 | ||
| 355 | acpi_ex_reacquire_interpreter(); | 356 | status2 = acpi_ex_enter_interpreter(); |
| 357 | if (ACPI_FAILURE(status2)) { | ||
| 358 | return_ACPI_STATUS(status2); | ||
| 359 | } | ||
| 356 | 360 | ||
| 357 | /* Check for failure of the Region Setup */ | 361 | /* Check for failure of the Region Setup */ |
| 358 | 362 | ||
| @@ -405,7 +409,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
| 405 | * exit the interpreter because the handler *might* block -- we don't | 409 | * exit the interpreter because the handler *might* block -- we don't |
| 406 | * know what it will do, so we can't hold the lock on the intepreter. | 410 | * know what it will do, so we can't hold the lock on the intepreter. |
| 407 | */ | 411 | */ |
| 408 | acpi_ex_relinquish_interpreter(); | 412 | acpi_ex_exit_interpreter(); |
| 409 | } | 413 | } |
| 410 | 414 | ||
| 411 | /* Call the handler */ | 415 | /* Call the handler */ |
| @@ -426,7 +430,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
| 426 | * We just returned from a non-default handler, we must re-enter the | 430 | * We just returned from a non-default handler, we must re-enter the |
| 427 | * interpreter | 431 | * interpreter |
| 428 | */ | 432 | */ |
| 429 | acpi_ex_reacquire_interpreter(); | 433 | status2 = acpi_ex_enter_interpreter(); |
| 434 | if (ACPI_FAILURE(status2)) { | ||
| 435 | return_ACPI_STATUS(status2); | ||
| 436 | } | ||
| 430 | } | 437 | } |
| 431 | 438 | ||
| 432 | return_ACPI_STATUS(status); | 439 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 685a103a3587..a3379bafa676 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
| @@ -768,9 +768,11 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | |||
| 768 | return (AE_BAD_PARAMETER); | 768 | return (AE_BAD_PARAMETER); |
| 769 | } | 769 | } |
| 770 | 770 | ||
| 771 | /* Must lock interpreter to prevent race conditions */ | 771 | status = acpi_ex_enter_interpreter(); |
| 772 | if (ACPI_FAILURE(status)) { | ||
| 773 | return (status); | ||
| 774 | } | ||
| 772 | 775 | ||
| 773 | acpi_ex_enter_interpreter(); | ||
| 774 | status = acpi_ev_acquire_global_lock(timeout); | 776 | status = acpi_ev_acquire_global_lock(timeout); |
| 775 | acpi_ex_exit_interpreter(); | 777 | acpi_ex_exit_interpreter(); |
| 776 | 778 | ||
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 7c38528a7e83..ae97812681a3 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
| @@ -583,7 +583,10 @@ acpi_ex_create_method(u8 * aml_start, | |||
| 583 | * Get the sync_level. If method is serialized, a mutex will be | 583 | * Get the sync_level. If method is serialized, a mutex will be |
| 584 | * created for this method when it is parsed. | 584 | * created for this method when it is parsed. |
| 585 | */ | 585 | */ |
| 586 | if (method_flags & AML_METHOD_SERIALIZED) { | 586 | if (acpi_gbl_all_methods_serialized) { |
| 587 | obj_desc->method.sync_level = 0; | ||
| 588 | obj_desc->method.method_flags |= AML_METHOD_SERIALIZED; | ||
| 589 | } else if (method_flags & AML_METHOD_SERIALIZED) { | ||
| 587 | /* | 590 | /* |
| 588 | * ACPI 1.0: sync_level = 0 | 591 | * ACPI 1.0: sync_level = 0 |
| 589 | * ACPI 2.0: sync_level = sync_level in method declaration | 592 | * ACPI 2.0: sync_level = sync_level in method declaration |
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 9460baff3032..b2edf620ba89 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
| @@ -66,6 +66,7 @@ ACPI_MODULE_NAME("exsystem") | |||
| 66 | acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | 66 | acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) |
| 67 | { | 67 | { |
| 68 | acpi_status status; | 68 | acpi_status status; |
| 69 | acpi_status status2; | ||
| 69 | 70 | ||
| 70 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); | 71 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); |
| 71 | 72 | ||
| @@ -78,7 +79,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
| 78 | 79 | ||
| 79 | /* We must wait, so unlock the interpreter */ | 80 | /* We must wait, so unlock the interpreter */ |
| 80 | 81 | ||
| 81 | acpi_ex_relinquish_interpreter(); | 82 | acpi_ex_exit_interpreter(); |
| 82 | 83 | ||
| 83 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); | 84 | status = acpi_os_wait_semaphore(semaphore, 1, timeout); |
| 84 | 85 | ||
| @@ -88,7 +89,13 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
| 88 | 89 | ||
| 89 | /* Reacquire the interpreter */ | 90 | /* Reacquire the interpreter */ |
| 90 | 91 | ||
| 91 | acpi_ex_reacquire_interpreter(); | 92 | status2 = acpi_ex_enter_interpreter(); |
| 93 | if (ACPI_FAILURE(status2)) { | ||
| 94 | |||
| 95 | /* Report fatal error, could not acquire interpreter */ | ||
| 96 | |||
| 97 | return_ACPI_STATUS(status2); | ||
| 98 | } | ||
| 92 | } | 99 | } |
| 93 | 100 | ||
| 94 | return_ACPI_STATUS(status); | 101 | return_ACPI_STATUS(status); |
| @@ -112,6 +119,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) | |||
| 112 | acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | 119 | acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) |
| 113 | { | 120 | { |
| 114 | acpi_status status; | 121 | acpi_status status; |
| 122 | acpi_status status2; | ||
| 115 | 123 | ||
| 116 | ACPI_FUNCTION_TRACE(ex_system_wait_mutex); | 124 | ACPI_FUNCTION_TRACE(ex_system_wait_mutex); |
| 117 | 125 | ||
| @@ -124,7 +132,7 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
| 124 | 132 | ||
| 125 | /* We must wait, so unlock the interpreter */ | 133 | /* We must wait, so unlock the interpreter */ |
| 126 | 134 | ||
| 127 | acpi_ex_relinquish_interpreter(); | 135 | acpi_ex_exit_interpreter(); |
| 128 | 136 | ||
| 129 | status = acpi_os_acquire_mutex(mutex, timeout); | 137 | status = acpi_os_acquire_mutex(mutex, timeout); |
| 130 | 138 | ||
| @@ -134,7 +142,13 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) | |||
| 134 | 142 | ||
| 135 | /* Reacquire the interpreter */ | 143 | /* Reacquire the interpreter */ |
| 136 | 144 | ||
| 137 | acpi_ex_reacquire_interpreter(); | 145 | status2 = acpi_ex_enter_interpreter(); |
| 146 | if (ACPI_FAILURE(status2)) { | ||
| 147 | |||
| 148 | /* Report fatal error, could not acquire interpreter */ | ||
| 149 | |||
| 150 | return_ACPI_STATUS(status2); | ||
| 151 | } | ||
| 138 | } | 152 | } |
| 139 | 153 | ||
| 140 | return_ACPI_STATUS(status); | 154 | return_ACPI_STATUS(status); |
| @@ -195,18 +209,20 @@ acpi_status acpi_ex_system_do_stall(u32 how_long) | |||
| 195 | 209 | ||
| 196 | acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) | 210 | acpi_status acpi_ex_system_do_suspend(acpi_integer how_long) |
| 197 | { | 211 | { |
| 212 | acpi_status status; | ||
| 213 | |||
| 198 | ACPI_FUNCTION_ENTRY(); | 214 | ACPI_FUNCTION_ENTRY(); |
| 199 | 215 | ||
| 200 | /* Since this thread will sleep, we must release the interpreter */ | 216 | /* Since this thread will sleep, we must release the interpreter */ |
| 201 | 217 | ||
| 202 | acpi_ex_relinquish_interpreter(); | 218 | acpi_ex_exit_interpreter(); |
| 203 | 219 | ||
| 204 | acpi_os_sleep(how_long); | 220 | acpi_os_sleep(how_long); |
| 205 | 221 | ||
| 206 | /* And now we must get the interpreter again */ | 222 | /* And now we must get the interpreter again */ |
| 207 | 223 | ||
| 208 | acpi_ex_reacquire_interpreter(); | 224 | status = acpi_ex_enter_interpreter(); |
| 209 | return (AE_OK); | 225 | return (status); |
| 210 | } | 226 | } |
| 211 | 227 | ||
| 212 | /******************************************************************************* | 228 | /******************************************************************************* |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 6b0aeccbb69b..aea461f3a48c 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
| @@ -76,15 +76,14 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base); | |||
| 76 | * | 76 | * |
| 77 | * PARAMETERS: None | 77 | * PARAMETERS: None |
| 78 | * | 78 | * |
| 79 | * RETURN: None | 79 | * RETURN: Status |
| 80 | * | 80 | * |
| 81 | * DESCRIPTION: Enter the interpreter execution region. Failure to enter | 81 | * DESCRIPTION: Enter the interpreter execution region. Failure to enter |
| 82 | * the interpreter region is a fatal system error. Used in | 82 | * the interpreter region is a fatal system error |
| 83 | * conjunction with exit_interpreter. | ||
| 84 | * | 83 | * |
| 85 | ******************************************************************************/ | 84 | ******************************************************************************/ |
| 86 | 85 | ||
| 87 | void acpi_ex_enter_interpreter(void) | 86 | acpi_status acpi_ex_enter_interpreter(void) |
| 88 | { | 87 | { |
| 89 | acpi_status status; | 88 | acpi_status status; |
| 90 | 89 | ||
| @@ -92,42 +91,10 @@ void acpi_ex_enter_interpreter(void) | |||
| 92 | 91 | ||
| 93 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); | 92 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); |
| 94 | if (ACPI_FAILURE(status)) { | 93 | if (ACPI_FAILURE(status)) { |
| 95 | ACPI_ERROR((AE_INFO, | 94 | ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); |
| 96 | "Could not acquire AML Interpreter mutex")); | ||
| 97 | } | 95 | } |
| 98 | 96 | ||
| 99 | return_VOID; | 97 | return_ACPI_STATUS(status); |
| 100 | } | ||
| 101 | |||
| 102 | /******************************************************************************* | ||
| 103 | * | ||
| 104 | * FUNCTION: acpi_ex_reacquire_interpreter | ||
| 105 | * | ||
| 106 | * PARAMETERS: None | ||
| 107 | * | ||
| 108 | * RETURN: None | ||
| 109 | * | ||
| 110 | * DESCRIPTION: Reacquire the interpreter execution region from within the | ||
| 111 | * interpreter code. Failure to enter the interpreter region is a | ||
| 112 | * fatal system error. Used in conjuction with | ||
| 113 | * relinquish_interpreter | ||
| 114 | * | ||
| 115 | ******************************************************************************/ | ||
| 116 | |||
| 117 | void acpi_ex_reacquire_interpreter(void) | ||
| 118 | { | ||
| 119 | ACPI_FUNCTION_TRACE(ex_reacquire_interpreter); | ||
| 120 | |||
| 121 | /* | ||
| 122 | * If the global serialized flag is set, do not release the interpreter, | ||
| 123 | * since it was not actually released by acpi_ex_relinquish_interpreter. | ||
| 124 | * This forces the interpreter to be single threaded. | ||
| 125 | */ | ||
| 126 | if (!acpi_gbl_all_methods_serialized) { | ||
| 127 | acpi_ex_enter_interpreter(); | ||
| 128 | } | ||
| 129 | |||
| 130 | return_VOID; | ||
| 131 | } | 98 | } |
| 132 | 99 | ||
| 133 | /******************************************************************************* | 100 | /******************************************************************************* |
| @@ -138,9 +105,17 @@ void acpi_ex_reacquire_interpreter(void) | |||
| 138 | * | 105 | * |
| 139 | * RETURN: None | 106 | * RETURN: None |
| 140 | * | 107 | * |
| 141 | * DESCRIPTION: Exit the interpreter execution region. This is the top level | 108 | * DESCRIPTION: Exit the interpreter execution region |
| 142 | * routine used to exit the interpreter when all processing has | 109 | * |
| 143 | * been completed. | 110 | * Cases where the interpreter is unlocked: |
| 111 | * 1) Completion of the execution of a control method | ||
| 112 | * 2) Method blocked on a Sleep() AML opcode | ||
| 113 | * 3) Method blocked on an Acquire() AML opcode | ||
| 114 | * 4) Method blocked on a Wait() AML opcode | ||
| 115 | * 5) Method blocked to acquire the global lock | ||
| 116 | * 6) Method blocked to execute a serialized control method that is | ||
| 117 | * already executing | ||
| 118 | * 7) About to invoke a user-installed opregion handler | ||
| 144 | * | 119 | * |
| 145 | ******************************************************************************/ | 120 | ******************************************************************************/ |
| 146 | 121 | ||
| @@ -152,46 +127,7 @@ void acpi_ex_exit_interpreter(void) | |||
| 152 | 127 | ||
| 153 | status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); | 128 | status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); |
| 154 | if (ACPI_FAILURE(status)) { | 129 | if (ACPI_FAILURE(status)) { |
| 155 | ACPI_ERROR((AE_INFO, | 130 | ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); |
| 156 | "Could not release AML Interpreter mutex")); | ||
| 157 | } | ||
| 158 | |||
| 159 | return_VOID; | ||
| 160 | } | ||
| 161 | |||
| 162 | /******************************************************************************* | ||
| 163 | * | ||
| 164 | * FUNCTION: acpi_ex_relinquish_interpreter | ||
| 165 | * | ||
| 166 | * PARAMETERS: None | ||
| 167 | * | ||
| 168 | * RETURN: None | ||
| 169 | * | ||
| 170 | * DESCRIPTION: Exit the interpreter execution region, from within the | ||
| 171 | * interpreter - before attempting an operation that will possibly | ||
| 172 | * block the running thread. | ||
| 173 | * | ||
| 174 | * Cases where the interpreter is unlocked internally | ||
| 175 | * 1) Method to be blocked on a Sleep() AML opcode | ||
| 176 | * 2) Method to be blocked on an Acquire() AML opcode | ||
| 177 | * 3) Method to be blocked on a Wait() AML opcode | ||
| 178 | * 4) Method to be blocked to acquire the global lock | ||
| 179 | * 5) Method to be blocked waiting to execute a serialized control method | ||
| 180 | * that is currently executing | ||
| 181 | * 6) About to invoke a user-installed opregion handler | ||
| 182 | * | ||
| 183 | ******************************************************************************/ | ||
| 184 | |||
| 185 | void acpi_ex_relinquish_interpreter(void) | ||
| 186 | { | ||
| 187 | ACPI_FUNCTION_TRACE(ex_relinquish_interpreter); | ||
| 188 | |||
| 189 | /* | ||
| 190 | * If the global serialized flag is set, do not release the interpreter. | ||
| 191 | * This forces the interpreter to be single threaded. | ||
| 192 | */ | ||
| 193 | if (!acpi_gbl_all_methods_serialized) { | ||
| 194 | acpi_ex_exit_interpreter(); | ||
| 195 | } | 131 | } |
| 196 | 132 | ||
| 197 | return_VOID; | 133 | return_VOID; |
| @@ -205,8 +141,8 @@ void acpi_ex_relinquish_interpreter(void) | |||
| 205 | * | 141 | * |
| 206 | * RETURN: none | 142 | * RETURN: none |
| 207 | * | 143 | * |
| 208 | * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is | 144 | * DESCRIPTION: Truncate a number to 32-bits if the currently executing method |
| 209 | * 32-bit, as determined by the revision of the DSDT. | 145 | * belongs to a 32-bit ACPI table. |
| 210 | * | 146 | * |
| 211 | ******************************************************************************/ | 147 | ******************************************************************************/ |
| 212 | 148 | ||
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 8fa93125fd4c..c84b1faba28c 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c | |||
| @@ -300,6 +300,11 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
| 300 | /* | 300 | /* |
| 301 | * 2) Enable all wakeup GPEs | 301 | * 2) Enable all wakeup GPEs |
| 302 | */ | 302 | */ |
| 303 | status = acpi_hw_disable_all_gpes(); | ||
| 304 | if (ACPI_FAILURE(status)) { | ||
| 305 | return_ACPI_STATUS(status); | ||
| 306 | } | ||
| 307 | |||
| 303 | acpi_gbl_system_awake_and_running = FALSE; | 308 | acpi_gbl_system_awake_and_running = FALSE; |
| 304 | 309 | ||
| 305 | status = acpi_hw_enable_all_wakeup_gpes(); | 310 | status = acpi_hw_enable_all_wakeup_gpes(); |
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 36901362fd24..dc1096608f43 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
| @@ -2507,7 +2507,7 @@ static int __init setup_notify(struct ibm_struct *ibm) | |||
| 2507 | ret = acpi_bus_get_device(*ibm->handle, &ibm->device); | 2507 | ret = acpi_bus_get_device(*ibm->handle, &ibm->device); |
| 2508 | if (ret < 0) { | 2508 | if (ret < 0) { |
| 2509 | printk(IBM_ERR "%s device not present\n", ibm->name); | 2509 | printk(IBM_ERR "%s device not present\n", ibm->name); |
| 2510 | return 0; | 2510 | return -ENODEV; |
| 2511 | } | 2511 | } |
| 2512 | 2512 | ||
| 2513 | acpi_driver_data(ibm->device) = ibm; | 2513 | acpi_driver_data(ibm->device) = ibm; |
| @@ -2516,8 +2516,13 @@ static int __init setup_notify(struct ibm_struct *ibm) | |||
| 2516 | status = acpi_install_notify_handler(*ibm->handle, ibm->type, | 2516 | status = acpi_install_notify_handler(*ibm->handle, ibm->type, |
| 2517 | dispatch_notify, ibm); | 2517 | dispatch_notify, ibm); |
| 2518 | if (ACPI_FAILURE(status)) { | 2518 | if (ACPI_FAILURE(status)) { |
| 2519 | printk(IBM_ERR "acpi_install_notify_handler(%s) failed: %d\n", | 2519 | if (status == AE_ALREADY_EXISTS) { |
| 2520 | ibm->name, status); | 2520 | printk(IBM_NOTICE "another device driver is already handling %s events\n", |
| 2521 | ibm->name); | ||
| 2522 | } else { | ||
| 2523 | printk(IBM_ERR "acpi_install_notify_handler(%s) failed: %d\n", | ||
| 2524 | ibm->name, status); | ||
| 2525 | } | ||
| 2521 | return -ENODEV; | 2526 | return -ENODEV; |
| 2522 | } | 2527 | } |
| 2523 | ibm->notify_installed = 1; | 2528 | ibm->notify_installed = 1; |
| @@ -2553,6 +2558,8 @@ static int __init register_driver(struct ibm_struct *ibm) | |||
| 2553 | return ret; | 2558 | return ret; |
| 2554 | } | 2559 | } |
| 2555 | 2560 | ||
| 2561 | static void ibm_exit(struct ibm_struct *ibm); | ||
| 2562 | |||
| 2556 | static int __init ibm_init(struct ibm_struct *ibm) | 2563 | static int __init ibm_init(struct ibm_struct *ibm) |
| 2557 | { | 2564 | { |
| 2558 | int ret; | 2565 | int ret; |
| @@ -2594,6 +2601,12 @@ static int __init ibm_init(struct ibm_struct *ibm) | |||
| 2594 | 2601 | ||
| 2595 | if (ibm->notify) { | 2602 | if (ibm->notify) { |
| 2596 | ret = setup_notify(ibm); | 2603 | ret = setup_notify(ibm); |
| 2604 | if (ret == -ENODEV) { | ||
| 2605 | printk(IBM_NOTICE "disabling subdriver %s\n", | ||
| 2606 | ibm->name); | ||
| 2607 | ibm_exit(ibm); | ||
| 2608 | return 0; | ||
| 2609 | } | ||
| 2597 | if (ret < 0) | 2610 | if (ret < 0) |
| 2598 | return ret; | 2611 | return ret; |
| 2599 | } | 2612 | } |
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index aa6370c67ec1..26fd0dd6953d 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
| @@ -154,7 +154,11 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |||
| 154 | * Execute the method via the interpreter. The interpreter is locked | 154 | * Execute the method via the interpreter. The interpreter is locked |
| 155 | * here before calling into the AML parser | 155 | * here before calling into the AML parser |
| 156 | */ | 156 | */ |
| 157 | acpi_ex_enter_interpreter(); | 157 | status = acpi_ex_enter_interpreter(); |
| 158 | if (ACPI_FAILURE(status)) { | ||
| 159 | return_ACPI_STATUS(status); | ||
| 160 | } | ||
| 161 | |||
| 158 | status = acpi_ps_execute_method(info); | 162 | status = acpi_ps_execute_method(info); |
| 159 | acpi_ex_exit_interpreter(); | 163 | acpi_ex_exit_interpreter(); |
| 160 | } else { | 164 | } else { |
| @@ -178,7 +182,10 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |||
| 178 | * resolution, we must lock it because we could access an opregion. | 182 | * resolution, we must lock it because we could access an opregion. |
| 179 | * The opregion access code assumes that the interpreter is locked. | 183 | * The opregion access code assumes that the interpreter is locked. |
| 180 | */ | 184 | */ |
| 181 | acpi_ex_enter_interpreter(); | 185 | status = acpi_ex_enter_interpreter(); |
| 186 | if (ACPI_FAILURE(status)) { | ||
| 187 | return_ACPI_STATUS(status); | ||
| 188 | } | ||
| 182 | 189 | ||
| 183 | /* Function has a strange interface */ | 190 | /* Function has a strange interface */ |
| 184 | 191 | ||
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 33db2241044e..c4ab615f77fe 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
| @@ -214,7 +214,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
| 214 | u32 level, void *context, void **return_value) | 214 | u32 level, void *context, void **return_value) |
| 215 | { | 215 | { |
| 216 | acpi_object_type type; | 216 | acpi_object_type type; |
| 217 | acpi_status status = AE_OK; | 217 | acpi_status status; |
| 218 | struct acpi_init_walk_info *info = | 218 | struct acpi_init_walk_info *info = |
| 219 | (struct acpi_init_walk_info *)context; | 219 | (struct acpi_init_walk_info *)context; |
| 220 | struct acpi_namespace_node *node = | 220 | struct acpi_namespace_node *node = |
| @@ -268,7 +268,10 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
| 268 | /* | 268 | /* |
| 269 | * Must lock the interpreter before executing AML code | 269 | * Must lock the interpreter before executing AML code |
| 270 | */ | 270 | */ |
| 271 | acpi_ex_enter_interpreter(); | 271 | status = acpi_ex_enter_interpreter(); |
| 272 | if (ACPI_FAILURE(status)) { | ||
| 273 | return (status); | ||
| 274 | } | ||
| 272 | 275 | ||
| 273 | /* | 276 | /* |
| 274 | * Each of these types can contain executable AML code within the | 277 | * Each of these types can contain executable AML code within the |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index 7ac6ace50059..8904d0fae6a2 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
| @@ -170,6 +170,7 @@ acpi_evaluate_object(acpi_handle handle, | |||
| 170 | struct acpi_buffer *return_buffer) | 170 | struct acpi_buffer *return_buffer) |
| 171 | { | 171 | { |
| 172 | acpi_status status; | 172 | acpi_status status; |
| 173 | acpi_status status2; | ||
| 173 | struct acpi_evaluate_info *info; | 174 | struct acpi_evaluate_info *info; |
| 174 | acpi_size buffer_space_needed; | 175 | acpi_size buffer_space_needed; |
| 175 | u32 i; | 176 | u32 i; |
| @@ -328,12 +329,14 @@ acpi_evaluate_object(acpi_handle handle, | |||
| 328 | * Delete the internal return object. NOTE: Interpreter must be | 329 | * Delete the internal return object. NOTE: Interpreter must be |
| 329 | * locked to avoid race condition. | 330 | * locked to avoid race condition. |
| 330 | */ | 331 | */ |
| 331 | acpi_ex_enter_interpreter(); | 332 | status2 = acpi_ex_enter_interpreter(); |
| 333 | if (ACPI_SUCCESS(status2)) { | ||
| 332 | 334 | ||
| 333 | /* Remove one reference on the return object (should delete it) */ | 335 | /* Remove one reference on the return object (should delete it) */ |
| 334 | 336 | ||
| 335 | acpi_ut_remove_reference(info->return_object); | 337 | acpi_ut_remove_reference(info->return_object); |
| 336 | acpi_ex_exit_interpreter(); | 338 | acpi_ex_exit_interpreter(); |
| 339 | } | ||
| 337 | } | 340 | } |
| 338 | 341 | ||
| 339 | cleanup: | 342 | cleanup: |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 60773005b8af..cdf78943af4d 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -268,6 +268,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr, | |||
| 268 | struct acpi_processor_cx *cx) | 268 | struct acpi_processor_cx *cx) |
| 269 | { | 269 | { |
| 270 | struct acpi_processor_power *pwr = &pr->power; | 270 | struct acpi_processor_power *pwr = &pr->power; |
| 271 | u8 type = local_apic_timer_c2_ok ? ACPI_STATE_C3 : ACPI_STATE_C2; | ||
| 271 | 272 | ||
| 272 | /* | 273 | /* |
| 273 | * Check, if one of the previous states already marked the lapic | 274 | * Check, if one of the previous states already marked the lapic |
| @@ -276,7 +277,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr, | |||
| 276 | if (pwr->timer_broadcast_on_state < state) | 277 | if (pwr->timer_broadcast_on_state < state) |
| 277 | return; | 278 | return; |
| 278 | 279 | ||
| 279 | if (cx->type >= ACPI_STATE_C2) | 280 | if (cx->type >= type) |
| 280 | pr->power.timer_broadcast_on_state = state; | 281 | pr->power.timer_broadcast_on_state = state; |
| 281 | } | 282 | } |
| 282 | 283 | ||
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 849e2c361804..c3419182c9a7 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
| @@ -42,7 +42,9 @@ static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" }; | |||
| 42 | 42 | ||
| 43 | static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata; | 43 | static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata; |
| 44 | 44 | ||
| 45 | void acpi_table_print_madt_entry(struct acpi_subtable_header * header) | 45 | static int acpi_apic_instance __initdata; |
| 46 | |||
| 47 | void acpi_table_print_madt_entry(struct acpi_subtable_header *header) | ||
| 46 | { | 48 | { |
| 47 | if (!header) | 49 | if (!header) |
| 48 | return; | 50 | return; |
| @@ -183,8 +185,10 @@ acpi_table_parse_entries(char *id, | |||
| 183 | if (!handler) | 185 | if (!handler) |
| 184 | return -EINVAL; | 186 | return -EINVAL; |
| 185 | 187 | ||
| 186 | /* Locate the table (if exists). There should only be one. */ | 188 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) |
| 187 | acpi_get_table(id, 0, &table_header); | 189 | acpi_get_table(id, acpi_apic_instance, &table_header); |
| 190 | else | ||
| 191 | acpi_get_table(id, 0, &table_header); | ||
| 188 | 192 | ||
| 189 | if (!table_header) { | 193 | if (!table_header) { |
| 190 | printk(KERN_WARNING PREFIX "%4.4s not present\n", id); | 194 | printk(KERN_WARNING PREFIX "%4.4s not present\n", id); |
| @@ -237,10 +241,15 @@ acpi_table_parse_madt(enum acpi_madt_type id, | |||
| 237 | int __init acpi_table_parse(char *id, acpi_table_handler handler) | 241 | int __init acpi_table_parse(char *id, acpi_table_handler handler) |
| 238 | { | 242 | { |
| 239 | struct acpi_table_header *table = NULL; | 243 | struct acpi_table_header *table = NULL; |
| 244 | |||
| 240 | if (!handler) | 245 | if (!handler) |
| 241 | return -EINVAL; | 246 | return -EINVAL; |
| 242 | 247 | ||
| 243 | acpi_get_table(id, 0, &table); | 248 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) |
| 249 | acpi_get_table(id, acpi_apic_instance, &table); | ||
| 250 | else | ||
| 251 | acpi_get_table(id, 0, &table); | ||
| 252 | |||
| 244 | if (table) { | 253 | if (table) { |
| 245 | handler(table); | 254 | handler(table); |
| 246 | return 0; | 255 | return 0; |
| @@ -248,6 +257,31 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler) | |||
| 248 | return 1; | 257 | return 1; |
| 249 | } | 258 | } |
| 250 | 259 | ||
| 260 | /* | ||
| 261 | * The BIOS is supposed to supply a single APIC/MADT, | ||
| 262 | * but some report two. Provide a knob to use either. | ||
| 263 | * (don't you wish instance 0 and 1 were not the same?) | ||
| 264 | */ | ||
| 265 | static void __init check_multiple_madt(void) | ||
| 266 | { | ||
| 267 | struct acpi_table_header *table = NULL; | ||
| 268 | |||
| 269 | acpi_get_table(ACPI_SIG_MADT, 2, &table); | ||
| 270 | if (table) { | ||
| 271 | printk(KERN_WARNING PREFIX | ||
| 272 | "BIOS bug: multiple APIC/MADT found," | ||
| 273 | " using %d\n", acpi_apic_instance); | ||
| 274 | printk(KERN_WARNING PREFIX | ||
| 275 | "If \"acpi_apic_instance=%d\" works better, " | ||
| 276 | "notify linux-acpi@vger.kernel.org\n", | ||
| 277 | acpi_apic_instance ? 0 : 2); | ||
| 278 | |||
| 279 | } else | ||
| 280 | acpi_apic_instance = 0; | ||
| 281 | |||
| 282 | return; | ||
| 283 | } | ||
| 284 | |||
| 251 | /* | 285 | /* |
| 252 | * acpi_table_init() | 286 | * acpi_table_init() |
| 253 | * | 287 | * |
| @@ -257,9 +291,22 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler) | |||
| 257 | * result: sdt_entry[] is initialized | 291 | * result: sdt_entry[] is initialized |
| 258 | */ | 292 | */ |
| 259 | 293 | ||
| 260 | |||
| 261 | int __init acpi_table_init(void) | 294 | int __init acpi_table_init(void) |
| 262 | { | 295 | { |
| 263 | acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); | 296 | acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); |
| 297 | check_multiple_madt(); | ||
| 298 | return 0; | ||
| 299 | } | ||
| 300 | |||
| 301 | static int __init acpi_parse_apic_instance(char *str) | ||
| 302 | { | ||
| 303 | |||
| 304 | acpi_apic_instance = simple_strtoul(str, NULL, 0); | ||
| 305 | |||
| 306 | printk(KERN_NOTICE PREFIX "Shall use APIC/MADT table %d\n", | ||
| 307 | acpi_apic_instance); | ||
| 308 | |||
| 264 | return 0; | 309 | return 0; |
| 265 | } | 310 | } |
| 311 | |||
| 312 | early_param("acpi_apic_instance", acpi_parse_apic_instance); | ||
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 0ae8b9310cbf..589b98b7b216 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
| @@ -758,7 +758,8 @@ static void acpi_thermal_check(void *data) | |||
| 758 | del_timer(&(tz->timer)); | 758 | del_timer(&(tz->timer)); |
| 759 | } else { | 759 | } else { |
| 760 | if (timer_pending(&(tz->timer))) | 760 | if (timer_pending(&(tz->timer))) |
| 761 | mod_timer(&(tz->timer), (HZ * sleep_time) / 1000); | 761 | mod_timer(&(tz->timer), |
| 762 | jiffies + (HZ * sleep_time) / 1000); | ||
| 762 | else { | 763 | else { |
| 763 | tz->timer.data = (unsigned long)tz; | 764 | tz->timer.data = (unsigned long)tz; |
| 764 | tz->timer.function = acpi_thermal_run; | 765 | tz->timer.function = acpi_thermal_run; |
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index d16b5b0c8b76..7bdbe5a914d0 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
| @@ -564,7 +564,7 @@ config PATA_IXP4XX_CF | |||
| 564 | 564 | ||
| 565 | config PATA_SCC | 565 | config PATA_SCC |
| 566 | tristate "Toshiba's Cell Reference Set IDE support" | 566 | tristate "Toshiba's Cell Reference Set IDE support" |
| 567 | depends on PCI && PPC_IBM_CELL_BLADE | 567 | depends on PCI && PPC_CELLEB |
| 568 | help | 568 | help |
| 569 | This option enables support for the built-in IDE controller on | 569 | This option enables support for the built-in IDE controller on |
| 570 | Toshiba Cell Reference Board. | 570 | Toshiba Cell Reference Board. |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index dc7b56225923..fd27227771b4 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
| @@ -80,6 +80,7 @@ enum { | |||
| 80 | board_ahci_pi = 1, | 80 | board_ahci_pi = 1, |
| 81 | board_ahci_vt8251 = 2, | 81 | board_ahci_vt8251 = 2, |
| 82 | board_ahci_ign_iferr = 3, | 82 | board_ahci_ign_iferr = 3, |
| 83 | board_ahci_sb600 = 4, | ||
| 83 | 84 | ||
| 84 | /* global controller registers */ | 85 | /* global controller registers */ |
| 85 | HOST_CAP = 0x00, /* host capabilities */ | 86 | HOST_CAP = 0x00, /* host capabilities */ |
| @@ -168,6 +169,7 @@ enum { | |||
| 168 | AHCI_FLAG_NO_NCQ = (1 << 24), | 169 | AHCI_FLAG_NO_NCQ = (1 << 24), |
| 169 | AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 25), /* ignore IRQ_IF_ERR */ | 170 | AHCI_FLAG_IGN_IRQ_IF_ERR = (1 << 25), /* ignore IRQ_IF_ERR */ |
| 170 | AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */ | 171 | AHCI_FLAG_HONOR_PI = (1 << 26), /* honor PORTS_IMPL */ |
| 172 | AHCI_FLAG_IGN_SERR_INTERNAL = (1 << 27), /* ignore SERR_INTERNAL */ | ||
| 171 | }; | 173 | }; |
| 172 | 174 | ||
| 173 | struct ahci_cmd_hdr { | 175 | struct ahci_cmd_hdr { |
| @@ -362,6 +364,18 @@ static const struct ata_port_info ahci_port_info[] = { | |||
| 362 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 364 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
| 363 | .port_ops = &ahci_ops, | 365 | .port_ops = &ahci_ops, |
| 364 | }, | 366 | }, |
| 367 | /* board_ahci_sb600 */ | ||
| 368 | { | ||
| 369 | .sht = &ahci_sht, | ||
| 370 | .flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | | ||
| 371 | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | | ||
| 372 | ATA_FLAG_SKIP_D2H_BSY | | ||
| 373 | AHCI_FLAG_IGN_SERR_INTERNAL, | ||
| 374 | .pio_mask = 0x1f, /* pio0-4 */ | ||
| 375 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | ||
| 376 | .port_ops = &ahci_ops, | ||
| 377 | }, | ||
| 378 | |||
| 365 | }; | 379 | }; |
| 366 | 380 | ||
| 367 | static const struct pci_device_id ahci_pci_tbl[] = { | 381 | static const struct pci_device_id ahci_pci_tbl[] = { |
| @@ -399,7 +413,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
| 399 | PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci_ign_iferr }, | 413 | PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci_ign_iferr }, |
| 400 | 414 | ||
| 401 | /* ATI */ | 415 | /* ATI */ |
| 402 | { PCI_VDEVICE(ATI, 0x4380), board_ahci }, /* ATI SB600 non-raid */ | 416 | { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 non-raid */ |
| 403 | { PCI_VDEVICE(ATI, 0x4381), board_ahci }, /* ATI SB600 raid */ | 417 | { PCI_VDEVICE(ATI, 0x4381), board_ahci }, /* ATI SB600 raid */ |
| 404 | 418 | ||
| 405 | /* VIA */ | 419 | /* VIA */ |
| @@ -1067,8 +1081,11 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat) | |||
| 1067 | if (ap->flags & AHCI_FLAG_IGN_IRQ_IF_ERR) | 1081 | if (ap->flags & AHCI_FLAG_IGN_IRQ_IF_ERR) |
| 1068 | irq_stat &= ~PORT_IRQ_IF_ERR; | 1082 | irq_stat &= ~PORT_IRQ_IF_ERR; |
| 1069 | 1083 | ||
| 1070 | if (irq_stat & PORT_IRQ_TF_ERR) | 1084 | if (irq_stat & PORT_IRQ_TF_ERR) { |
| 1071 | err_mask |= AC_ERR_DEV; | 1085 | err_mask |= AC_ERR_DEV; |
| 1086 | if (ap->flags & AHCI_FLAG_IGN_SERR_INTERNAL) | ||
| 1087 | serror &= ~SERR_INTERNAL; | ||
| 1088 | } | ||
| 1072 | 1089 | ||
| 1073 | if (irq_stat & (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) { | 1090 | if (irq_stat & (PORT_IRQ_HBUS_ERR | PORT_IRQ_HBUS_DATA_ERR)) { |
| 1074 | err_mask |= AC_ERR_HOST_BUS; | 1091 | err_mask |= AC_ERR_HOST_BUS; |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index c428a56e6f31..03a0acff6cfa 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
| @@ -305,7 +305,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
| 305 | *gtf_address = 0UL; | 305 | *gtf_address = 0UL; |
| 306 | *obj_loc = 0UL; | 306 | *obj_loc = 0UL; |
| 307 | 307 | ||
| 308 | if (noacpi) | 308 | if (libata_noacpi) |
| 309 | return 0; | 309 | return 0; |
| 310 | 310 | ||
| 311 | if (ata_msg_probe(ap)) | 311 | if (ata_msg_probe(ap)) |
| @@ -531,7 +531,7 @@ static int do_drive_set_taskfiles(struct ata_port *ap, | |||
| 531 | ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", | 531 | ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", |
| 532 | __FUNCTION__, ap->port_no); | 532 | __FUNCTION__, ap->port_no); |
| 533 | 533 | ||
| 534 | if (noacpi || !(ap->cbl == ATA_CBL_SATA)) | 534 | if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA)) |
| 535 | return 0; | 535 | return 0; |
| 536 | 536 | ||
| 537 | if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) | 537 | if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) |
| @@ -574,7 +574,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
| 574 | unsigned long gtf_address; | 574 | unsigned long gtf_address; |
| 575 | unsigned long obj_loc; | 575 | unsigned long obj_loc; |
| 576 | 576 | ||
| 577 | if (noacpi) | 577 | if (libata_noacpi) |
| 578 | return 0; | 578 | return 0; |
| 579 | /* | 579 | /* |
| 580 | * TBD - implement PATA support. For now, | 580 | * TBD - implement PATA support. For now, |
| @@ -636,7 +636,7 @@ int ata_acpi_push_id(struct ata_port *ap, unsigned int ix) | |||
| 636 | struct acpi_object_list input; | 636 | struct acpi_object_list input; |
| 637 | union acpi_object in_params[1]; | 637 | union acpi_object in_params[1]; |
| 638 | 638 | ||
| 639 | if (noacpi) | 639 | if (libata_noacpi) |
| 640 | return 0; | 640 | return 0; |
| 641 | 641 | ||
| 642 | if (ata_msg_probe(ap)) | 642 | if (ata_msg_probe(ap)) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 3c1f8830ac8b..0abd72d0dec2 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -93,8 +93,8 @@ static int ata_probe_timeout = ATA_TMOUT_INTERNAL / HZ; | |||
| 93 | module_param(ata_probe_timeout, int, 0444); | 93 | module_param(ata_probe_timeout, int, 0444); |
| 94 | MODULE_PARM_DESC(ata_probe_timeout, "Set ATA probing timeout (seconds)"); | 94 | MODULE_PARM_DESC(ata_probe_timeout, "Set ATA probing timeout (seconds)"); |
| 95 | 95 | ||
| 96 | int noacpi; | 96 | int libata_noacpi = 1; |
| 97 | module_param(noacpi, int, 0444); | 97 | module_param_named(noacpi, libata_noacpi, int, 0444); |
| 98 | MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set"); | 98 | MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set"); |
| 99 | 99 | ||
| 100 | MODULE_AUTHOR("Jeff Garzik"); | 100 | MODULE_AUTHOR("Jeff Garzik"); |
| @@ -826,7 +826,7 @@ static u64 ata_id_n_sectors(const u16 *id) | |||
| 826 | /** | 826 | /** |
| 827 | * ata_id_to_dma_mode - Identify DMA mode from id block | 827 | * ata_id_to_dma_mode - Identify DMA mode from id block |
| 828 | * @dev: device to identify | 828 | * @dev: device to identify |
| 829 | * @mode: mode to assume if we cannot tell | 829 | * @unknown: mode to assume if we cannot tell |
| 830 | * | 830 | * |
| 831 | * Set up the timing values for the device based upon the identify | 831 | * Set up the timing values for the device based upon the identify |
| 832 | * reported values for the DMA mode. This function is used by drivers | 832 | * reported values for the DMA mode. This function is used by drivers |
| @@ -1784,6 +1784,13 @@ int ata_dev_configure(struct ata_device *dev) | |||
| 1784 | dev->max_sectors = ATA_MAX_SECTORS; | 1784 | dev->max_sectors = ATA_MAX_SECTORS; |
| 1785 | } | 1785 | } |
| 1786 | 1786 | ||
| 1787 | if (ata_device_blacklisted(dev) & ATA_HORKAGE_MAX_SEC_128) | ||
| 1788 | dev->max_sectors = min(ATA_MAX_SECTORS_128, dev->max_sectors); | ||
| 1789 | |||
| 1790 | /* limit ATAPI DMA to R/W commands only */ | ||
| 1791 | if (ata_device_blacklisted(dev) & ATA_HORKAGE_DMA_RW_ONLY) | ||
| 1792 | dev->horkage |= ATA_HORKAGE_DMA_RW_ONLY; | ||
| 1793 | |||
| 1787 | if (ap->ops->dev_config) | 1794 | if (ap->ops->dev_config) |
| 1788 | ap->ops->dev_config(ap, dev); | 1795 | ap->ops->dev_config(ap, dev); |
| 1789 | 1796 | ||
| @@ -3352,6 +3359,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 3352 | { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, | 3359 | { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, |
| 3353 | { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, | 3360 | { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, |
| 3354 | 3361 | ||
| 3362 | /* Weird ATAPI devices */ | ||
| 3363 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | | ||
| 3364 | ATA_HORKAGE_DMA_RW_ONLY }, | ||
| 3365 | |||
| 3355 | /* Devices we expect to fail diagnostics */ | 3366 | /* Devices we expect to fail diagnostics */ |
| 3356 | 3367 | ||
| 3357 | /* Devices where NCQ should be avoided */ | 3368 | /* Devices where NCQ should be avoided */ |
| @@ -3359,6 +3370,15 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 3359 | { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ }, | 3370 | { "WDC WD740ADFD-00", NULL, ATA_HORKAGE_NONCQ }, |
| 3360 | /* http://thread.gmane.org/gmane.linux.ide/14907 */ | 3371 | /* http://thread.gmane.org/gmane.linux.ide/14907 */ |
| 3361 | { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, | 3372 | { "FUJITSU MHT2060BH", NULL, ATA_HORKAGE_NONCQ }, |
| 3373 | /* NCQ is broken */ | ||
| 3374 | { "Maxtor 6L250S0", "BANC1G10", ATA_HORKAGE_NONCQ }, | ||
| 3375 | /* NCQ hard hangs device under heavier load, needs hard power cycle */ | ||
| 3376 | { "Maxtor 6B250S0", "BANC1B70", ATA_HORKAGE_NONCQ }, | ||
| 3377 | /* Blacklist entries taken from Silicon Image 3124/3132 | ||
| 3378 | Windows driver .inf file - also several Linux problem reports */ | ||
| 3379 | { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, }, | ||
| 3380 | { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, }, | ||
| 3381 | { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, }, | ||
| 3362 | 3382 | ||
| 3363 | /* Devices with NCQ limits */ | 3383 | /* Devices with NCQ limits */ |
| 3364 | 3384 | ||
| @@ -3670,6 +3690,26 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc) | |||
| 3670 | struct ata_port *ap = qc->ap; | 3690 | struct ata_port *ap = qc->ap; |
| 3671 | int rc = 0; /* Assume ATAPI DMA is OK by default */ | 3691 | int rc = 0; /* Assume ATAPI DMA is OK by default */ |
| 3672 | 3692 | ||
| 3693 | /* some drives can only do ATAPI DMA on read/write */ | ||
| 3694 | if (unlikely(qc->dev->horkage & ATA_HORKAGE_DMA_RW_ONLY)) { | ||
| 3695 | struct scsi_cmnd *cmd = qc->scsicmd; | ||
| 3696 | u8 *scsicmd = cmd->cmnd; | ||
| 3697 | |||
| 3698 | switch (scsicmd[0]) { | ||
| 3699 | case READ_10: | ||
| 3700 | case WRITE_10: | ||
| 3701 | case READ_12: | ||
| 3702 | case WRITE_12: | ||
| 3703 | case READ_6: | ||
| 3704 | case WRITE_6: | ||
| 3705 | /* atapi dma maybe ok */ | ||
| 3706 | break; | ||
| 3707 | default: | ||
| 3708 | /* turn off atapi dma */ | ||
| 3709 | return 1; | ||
| 3710 | } | ||
| 3711 | } | ||
| 3712 | |||
| 3673 | if (ap->ops->check_atapi_dma) | 3713 | if (ap->ops->check_atapi_dma) |
| 3674 | rc = ap->ops->check_atapi_dma(qc); | 3714 | rc = ap->ops->check_atapi_dma(qc); |
| 3675 | 3715 | ||
| @@ -4713,8 +4753,8 @@ static void fill_result_tf(struct ata_queued_cmd *qc) | |||
| 4713 | { | 4753 | { |
| 4714 | struct ata_port *ap = qc->ap; | 4754 | struct ata_port *ap = qc->ap; |
| 4715 | 4755 | ||
| 4716 | ap->ops->tf_read(ap, &qc->result_tf); | ||
| 4717 | qc->result_tf.flags = qc->tf.flags; | 4756 | qc->result_tf.flags = qc->tf.flags; |
| 4757 | ap->ops->tf_read(ap, &qc->result_tf); | ||
| 4718 | } | 4758 | } |
| 4719 | 4759 | ||
| 4720 | /** | 4760 | /** |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 7349c3dbf774..39f556c02992 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -982,26 +982,27 @@ static int ata_eh_read_log_10h(struct ata_device *dev, | |||
| 982 | * RETURNS: | 982 | * RETURNS: |
| 983 | * 0 on success, AC_ERR_* mask on failure | 983 | * 0 on success, AC_ERR_* mask on failure |
| 984 | */ | 984 | */ |
| 985 | static unsigned int atapi_eh_request_sense(struct ata_device *dev, | 985 | static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) |
| 986 | unsigned char *sense_buf) | ||
| 987 | { | 986 | { |
| 987 | struct ata_device *dev = qc->dev; | ||
| 988 | unsigned char *sense_buf = qc->scsicmd->sense_buffer; | ||
| 988 | struct ata_port *ap = dev->ap; | 989 | struct ata_port *ap = dev->ap; |
| 989 | struct ata_taskfile tf; | 990 | struct ata_taskfile tf; |
| 990 | u8 cdb[ATAPI_CDB_LEN]; | 991 | u8 cdb[ATAPI_CDB_LEN]; |
| 991 | 992 | ||
| 992 | DPRINTK("ATAPI request sense\n"); | 993 | DPRINTK("ATAPI request sense\n"); |
| 993 | 994 | ||
| 994 | ata_tf_init(dev, &tf); | ||
| 995 | |||
| 996 | /* FIXME: is this needed? */ | 995 | /* FIXME: is this needed? */ |
| 997 | memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE); | 996 | memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE); |
| 998 | 997 | ||
| 999 | /* XXX: why tf_read here? */ | 998 | /* initialize sense_buf with the error register, |
| 1000 | ap->ops->tf_read(ap, &tf); | 999 | * for the case where they are -not- overwritten |
| 1001 | 1000 | */ | |
| 1002 | /* fill these in, for the case where they are -not- overwritten */ | ||
| 1003 | sense_buf[0] = 0x70; | 1001 | sense_buf[0] = 0x70; |
| 1004 | sense_buf[2] = tf.feature >> 4; | 1002 | sense_buf[2] = qc->result_tf.feature >> 4; |
| 1003 | |||
| 1004 | /* some devices time out if garbage left in tf */ | ||
| 1005 | ata_tf_init(dev, &tf); | ||
| 1005 | 1006 | ||
| 1006 | memset(cdb, 0, ATAPI_CDB_LEN); | 1007 | memset(cdb, 0, ATAPI_CDB_LEN); |
| 1007 | cdb[0] = REQUEST_SENSE; | 1008 | cdb[0] = REQUEST_SENSE; |
| @@ -1165,8 +1166,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, | |||
| 1165 | 1166 | ||
| 1166 | case ATA_DEV_ATAPI: | 1167 | case ATA_DEV_ATAPI: |
| 1167 | if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { | 1168 | if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { |
| 1168 | tmp = atapi_eh_request_sense(qc->dev, | 1169 | tmp = atapi_eh_request_sense(qc); |
| 1169 | qc->scsicmd->sense_buffer); | ||
| 1170 | if (!tmp) { | 1170 | if (!tmp) { |
| 1171 | /* ATA_QCFLAG_SENSE_VALID is used to | 1171 | /* ATA_QCFLAG_SENSE_VALID is used to |
| 1172 | * tell atapi_qc_complete() that sense | 1172 | * tell atapi_qc_complete() that sense |
| @@ -1625,8 +1625,14 @@ static int ata_eh_reset(struct ata_port *ap, int classify, | |||
| 1625 | rc = prereset(ap); | 1625 | rc = prereset(ap); |
| 1626 | if (rc) { | 1626 | if (rc) { |
| 1627 | if (rc == -ENOENT) { | 1627 | if (rc == -ENOENT) { |
| 1628 | ata_port_printk(ap, KERN_DEBUG, "port disabled. ignoring.\n"); | 1628 | ata_port_printk(ap, KERN_DEBUG, |
| 1629 | "port disabled. ignoring.\n"); | ||
| 1629 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; | 1630 | ap->eh_context.i.action &= ~ATA_EH_RESET_MASK; |
| 1631 | |||
| 1632 | for (i = 0; i < ATA_MAX_DEVICES; i++) | ||
| 1633 | classes[i] = ATA_DEV_NONE; | ||
| 1634 | |||
| 1635 | rc = 0; | ||
| 1630 | } else | 1636 | } else |
| 1631 | ata_port_printk(ap, KERN_ERR, | 1637 | ata_port_printk(ap, KERN_ERR, |
| 1632 | "prereset failed (errno=%d)\n", rc); | 1638 | "prereset failed (errno=%d)\n", rc); |
| @@ -1737,12 +1743,17 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
| 1737 | { | 1743 | { |
| 1738 | struct ata_eh_context *ehc = &ap->eh_context; | 1744 | struct ata_eh_context *ehc = &ap->eh_context; |
| 1739 | struct ata_device *dev; | 1745 | struct ata_device *dev; |
| 1746 | unsigned int new_mask = 0; | ||
| 1740 | unsigned long flags; | 1747 | unsigned long flags; |
| 1741 | int i, rc = 0; | 1748 | int i, rc = 0; |
| 1742 | 1749 | ||
| 1743 | DPRINTK("ENTER\n"); | 1750 | DPRINTK("ENTER\n"); |
| 1744 | 1751 | ||
| 1745 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 1752 | /* For PATA drive side cable detection to work, IDENTIFY must |
| 1753 | * be done backwards such that PDIAG- is released by the slave | ||
| 1754 | * device before the master device is identified. | ||
| 1755 | */ | ||
| 1756 | for (i = ATA_MAX_DEVICES - 1; i >= 0; i--) { | ||
| 1746 | unsigned int action, readid_flags = 0; | 1757 | unsigned int action, readid_flags = 0; |
| 1747 | 1758 | ||
| 1748 | dev = &ap->device[i]; | 1759 | dev = &ap->device[i]; |
| @@ -1754,13 +1765,13 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
| 1754 | if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) { | 1765 | if (action & ATA_EH_REVALIDATE && ata_dev_ready(dev)) { |
| 1755 | if (ata_port_offline(ap)) { | 1766 | if (ata_port_offline(ap)) { |
| 1756 | rc = -EIO; | 1767 | rc = -EIO; |
| 1757 | break; | 1768 | goto err; |
| 1758 | } | 1769 | } |
| 1759 | 1770 | ||
| 1760 | ata_eh_about_to_do(ap, dev, ATA_EH_REVALIDATE); | 1771 | ata_eh_about_to_do(ap, dev, ATA_EH_REVALIDATE); |
| 1761 | rc = ata_dev_revalidate(dev, readid_flags); | 1772 | rc = ata_dev_revalidate(dev, readid_flags); |
| 1762 | if (rc) | 1773 | if (rc) |
| 1763 | break; | 1774 | goto err; |
| 1764 | 1775 | ||
| 1765 | ata_eh_done(ap, dev, ATA_EH_REVALIDATE); | 1776 | ata_eh_done(ap, dev, ATA_EH_REVALIDATE); |
| 1766 | 1777 | ||
| @@ -1778,40 +1789,53 @@ static int ata_eh_revalidate_and_attach(struct ata_port *ap, | |||
| 1778 | 1789 | ||
| 1779 | rc = ata_dev_read_id(dev, &dev->class, readid_flags, | 1790 | rc = ata_dev_read_id(dev, &dev->class, readid_flags, |
| 1780 | dev->id); | 1791 | dev->id); |
| 1781 | if (rc == 0) { | 1792 | switch (rc) { |
| 1782 | ehc->i.flags |= ATA_EHI_PRINTINFO; | 1793 | case 0: |
| 1783 | rc = ata_dev_configure(dev); | 1794 | new_mask |= 1 << i; |
| 1784 | ehc->i.flags &= ~ATA_EHI_PRINTINFO; | 1795 | break; |
| 1785 | } else if (rc == -ENOENT) { | 1796 | case -ENOENT: |
| 1786 | /* IDENTIFY was issued to non-existent | 1797 | /* IDENTIFY was issued to non-existent |
| 1787 | * device. No need to reset. Just | 1798 | * device. No need to reset. Just |
| 1788 | * thaw and kill the device. | 1799 | * thaw and kill the device. |
| 1789 | */ | 1800 | */ |
| 1790 | ata_eh_thaw_port(ap); | 1801 | ata_eh_thaw_port(ap); |
| 1791 | dev->class = ATA_DEV_UNKNOWN; | 1802 | dev->class = ATA_DEV_UNKNOWN; |
| 1792 | rc = 0; | ||
| 1793 | } | ||
| 1794 | |||
| 1795 | if (rc) { | ||
| 1796 | dev->class = ATA_DEV_UNKNOWN; | ||
| 1797 | break; | 1803 | break; |
| 1804 | default: | ||
| 1805 | dev->class = ATA_DEV_UNKNOWN; | ||
| 1806 | goto err; | ||
| 1798 | } | 1807 | } |
| 1808 | } | ||
| 1809 | } | ||
| 1799 | 1810 | ||
| 1800 | if (ata_dev_enabled(dev)) { | 1811 | /* Configure new devices forward such that user doesn't see |
| 1801 | spin_lock_irqsave(ap->lock, flags); | 1812 | * device detection messages backwards. |
| 1802 | ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; | 1813 | */ |
| 1803 | spin_unlock_irqrestore(ap->lock, flags); | 1814 | for (i = 0; i < ATA_MAX_DEVICES; i++) { |
| 1815 | dev = &ap->device[i]; | ||
| 1804 | 1816 | ||
| 1805 | /* new device discovered, configure xfermode */ | 1817 | if (!(new_mask & (1 << i))) |
| 1806 | ehc->i.flags |= ATA_EHI_SETMODE; | 1818 | continue; |
| 1807 | } | 1819 | |
| 1808 | } | 1820 | ehc->i.flags |= ATA_EHI_PRINTINFO; |
| 1821 | rc = ata_dev_configure(dev); | ||
| 1822 | ehc->i.flags &= ~ATA_EHI_PRINTINFO; | ||
| 1823 | if (rc) | ||
| 1824 | goto err; | ||
| 1825 | |||
| 1826 | spin_lock_irqsave(ap->lock, flags); | ||
| 1827 | ap->pflags |= ATA_PFLAG_SCSI_HOTPLUG; | ||
| 1828 | spin_unlock_irqrestore(ap->lock, flags); | ||
| 1829 | |||
| 1830 | /* new device discovered, configure xfermode */ | ||
| 1831 | ehc->i.flags |= ATA_EHI_SETMODE; | ||
| 1809 | } | 1832 | } |
| 1810 | 1833 | ||
| 1811 | if (rc) | 1834 | return 0; |
| 1812 | *r_failed_dev = dev; | ||
| 1813 | 1835 | ||
| 1814 | DPRINTK("EXIT\n"); | 1836 | err: |
| 1837 | *r_failed_dev = dev; | ||
| 1838 | DPRINTK("EXIT rc=%d\n", rc); | ||
| 1815 | return rc; | 1839 | return rc; |
| 1816 | } | 1840 | } |
| 1817 | 1841 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 6cc817a10204..e9364434182c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -333,7 +333,7 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg) | |||
| 333 | scsi_cmd[8] = args[3]; | 333 | scsi_cmd[8] = args[3]; |
| 334 | scsi_cmd[10] = args[4]; | 334 | scsi_cmd[10] = args[4]; |
| 335 | scsi_cmd[12] = args[5]; | 335 | scsi_cmd[12] = args[5]; |
| 336 | scsi_cmd[13] = args[6] & 0x0f; | 336 | scsi_cmd[13] = args[6] & 0x4f; |
| 337 | scsi_cmd[14] = args[0]; | 337 | scsi_cmd[14] = args[0]; |
| 338 | 338 | ||
| 339 | /* Good values for timeout and retries? Values below | 339 | /* Good values for timeout and retries? Values below |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index c42671493e8c..1f1e3a51f859 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
| @@ -56,7 +56,7 @@ extern struct workqueue_struct *ata_aux_wq; | |||
| 56 | extern int atapi_enabled; | 56 | extern int atapi_enabled; |
| 57 | extern int atapi_dmadir; | 57 | extern int atapi_dmadir; |
| 58 | extern int libata_fua; | 58 | extern int libata_fua; |
| 59 | extern int noacpi; | 59 | extern int libata_noacpi; |
| 60 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); | 60 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); |
| 61 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | 61 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, |
| 62 | u64 block, u32 n_block, unsigned int tf_flags, | 62 | u64 block, u32 n_block, unsigned int tf_flags, |
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c index 7ef834250a43..55cc293e7487 100644 --- a/drivers/ata/pata_cs5520.c +++ b/drivers/ata/pata_cs5520.c | |||
| @@ -208,7 +208,7 @@ static struct ata_port_operations cs5520_port_ops = { | |||
| 208 | static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) | 208 | static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
| 209 | { | 209 | { |
| 210 | u8 pcicfg; | 210 | u8 pcicfg; |
| 211 | void *iomap[5]; | 211 | void __iomem *iomap[5]; |
| 212 | static struct ata_probe_ent probe[2]; | 212 | static struct ata_probe_ent probe[2]; |
| 213 | int ports = 0; | 213 | int ports = 0; |
| 214 | 214 | ||
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index 9a0523b5c947..c6f0e1927551 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c | |||
| @@ -193,7 +193,7 @@ static __devinit int ixp4xx_pata_probe(struct platform_device *pdev) | |||
| 193 | 193 | ||
| 194 | irq = platform_get_irq(pdev, 0); | 194 | irq = platform_get_irq(pdev, 0); |
| 195 | if (irq) | 195 | if (irq) |
| 196 | set_irq_type(irq, IRQT_HIGH); | 196 | set_irq_type(irq, IRQT_RISING); |
| 197 | 197 | ||
| 198 | /* Setup expansion bus chip selects */ | 198 | /* Setup expansion bus chip selects */ |
| 199 | *data->cs0_cfg = data->cs0_bits; | 199 | *data->cs0_cfg = data->cs0_bits; |
| @@ -232,7 +232,6 @@ static __devexit int ixp4xx_pata_remove(struct platform_device *dev) | |||
| 232 | struct ata_host *host = platform_get_drvdata(dev); | 232 | struct ata_host *host = platform_get_drvdata(dev); |
| 233 | 233 | ||
| 234 | ata_host_detach(host); | 234 | ata_host_detach(host); |
| 235 | platform_set_drvdata(dev, NULL); | ||
| 236 | 235 | ||
| 237 | return 0; | 236 | return 0; |
| 238 | } | 237 | } |
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index f5d88729ca79..882c36eaf293 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
| @@ -329,7 +329,7 @@ mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv) | |||
| 329 | ae->dev = dev; | 329 | ae->dev = dev; |
| 330 | ae->irq = priv->ata_irq; | 330 | ae->irq = priv->ata_irq; |
| 331 | 331 | ||
| 332 | aio->cmd_addr = 0; /* Don't have a classic reg block */ | 332 | aio->cmd_addr = NULL; /* Don't have a classic reg block */ |
| 333 | aio->altstatus_addr = &priv->ata_regs->tf_control; | 333 | aio->altstatus_addr = &priv->ata_regs->tf_control; |
| 334 | aio->ctl_addr = &priv->ata_regs->tf_control; | 334 | aio->ctl_addr = &priv->ata_regs->tf_control; |
| 335 | aio->data_addr = &priv->ata_regs->tf_data; | 335 | aio->data_addr = &priv->ata_regs->tf_data; |
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c index acdc52cbe38a..0a1493398913 100644 --- a/drivers/ata/pata_pdc202xx_old.c +++ b/drivers/ata/pata_pdc202xx_old.c | |||
| @@ -195,7 +195,7 @@ static void pdc2026x_bmdma_start(struct ata_queued_cmd *qc) | |||
| 195 | /* Cases the state machine will not complete correctly without help */ | 195 | /* Cases the state machine will not complete correctly without help */ |
| 196 | if ((tf->flags & ATA_TFLAG_LBA48) || tf->protocol == ATA_PROT_ATAPI_DMA) | 196 | if ((tf->flags & ATA_TFLAG_LBA48) || tf->protocol == ATA_PROT_ATAPI_DMA) |
| 197 | { | 197 | { |
| 198 | len = qc->nbytes; | 198 | len = qc->nbytes / 2; |
| 199 | 199 | ||
| 200 | if (tf->flags & ATA_TFLAG_WRITE) | 200 | if (tf->flags & ATA_TFLAG_WRITE) |
| 201 | len |= 0x06000000; | 201 | len |= 0x06000000; |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index f48207865930..8dc3bc4f5863 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
| @@ -878,6 +878,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 878 | struct ata_port_info *port; | 878 | struct ata_port_info *port; |
| 879 | struct pci_dev *host = NULL; | 879 | struct pci_dev *host = NULL; |
| 880 | struct sis_chipset *chipset = NULL; | 880 | struct sis_chipset *chipset = NULL; |
| 881 | struct sis_chipset *sets; | ||
| 881 | 882 | ||
| 882 | static struct sis_chipset sis_chipsets[] = { | 883 | static struct sis_chipset sis_chipsets[] = { |
| 883 | 884 | ||
| @@ -932,10 +933,11 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 932 | 933 | ||
| 933 | /* We have to find the bridge first */ | 934 | /* We have to find the bridge first */ |
| 934 | 935 | ||
| 935 | for (chipset = &sis_chipsets[0]; chipset->device; chipset++) { | 936 | for (sets = &sis_chipsets[0]; sets->device; sets++) { |
| 936 | host = pci_get_device(PCI_VENDOR_ID_SI, chipset->device, NULL); | 937 | host = pci_get_device(PCI_VENDOR_ID_SI, sets->device, NULL); |
| 937 | if (host != NULL) { | 938 | if (host != NULL) { |
| 938 | if (chipset->device == 0x630) { /* SIS630 */ | 939 | chipset = sets; /* Match found */ |
| 940 | if (sets->device == 0x630) { /* SIS630 */ | ||
| 939 | u8 host_rev; | 941 | u8 host_rev; |
| 940 | pci_read_config_byte(host, PCI_REVISION_ID, &host_rev); | 942 | pci_read_config_byte(host, PCI_REVISION_ID, &host_rev); |
| 941 | if (host_rev >= 0x30) /* 630 ET */ | 943 | if (host_rev >= 0x30) /* 630 ET */ |
| @@ -946,7 +948,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 946 | } | 948 | } |
| 947 | 949 | ||
| 948 | /* Look for concealed bridges */ | 950 | /* Look for concealed bridges */ |
| 949 | if (host == NULL) { | 951 | if (chipset == NULL) { |
| 950 | /* Second check */ | 952 | /* Second check */ |
| 951 | u32 idemisc; | 953 | u32 idemisc; |
| 952 | u16 trueid; | 954 | u16 trueid; |
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c index 3193a603d1a1..1e21688bfcf2 100644 --- a/drivers/ata/sata_inic162x.c +++ b/drivers/ata/sata_inic162x.c | |||
| @@ -672,10 +672,6 @@ static int inic_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 672 | if (rc) | 672 | if (rc) |
| 673 | return rc; | 673 | return rc; |
| 674 | 674 | ||
| 675 | rc = pci_request_regions(pdev, DRV_NAME); | ||
| 676 | if (rc) | ||
| 677 | return rc; | ||
| 678 | |||
| 679 | rc = pcim_iomap_regions(pdev, 0x3f, DRV_NAME); | 675 | rc = pcim_iomap_regions(pdev, 0x3f, DRV_NAME); |
| 680 | if (rc) | 676 | if (rc) |
| 681 | return rc; | 677 | return rc; |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 75d961599651..5614df8c1ce2 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
| @@ -346,6 +346,7 @@ static const struct pci_device_id sil24_pci_tbl[] = { | |||
| 346 | { PCI_VDEVICE(CMD, 0x3124), BID_SIL3124 }, | 346 | { PCI_VDEVICE(CMD, 0x3124), BID_SIL3124 }, |
| 347 | { PCI_VDEVICE(INTEL, 0x3124), BID_SIL3124 }, | 347 | { PCI_VDEVICE(INTEL, 0x3124), BID_SIL3124 }, |
| 348 | { PCI_VDEVICE(CMD, 0x3132), BID_SIL3132 }, | 348 | { PCI_VDEVICE(CMD, 0x3132), BID_SIL3132 }, |
| 349 | { PCI_VDEVICE(CMD, 0x0242), BID_SIL3132 }, | ||
| 349 | { PCI_VDEVICE(CMD, 0x3131), BID_SIL3131 }, | 350 | { PCI_VDEVICE(CMD, 0x3131), BID_SIL3131 }, |
| 350 | { PCI_VDEVICE(CMD, 0x3531), BID_SIL3131 }, | 351 | { PCI_VDEVICE(CMD, 0x3531), BID_SIL3131 }, |
| 351 | 352 | ||
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index 1879e0cd56aa..a787f0d4a5ba 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c | |||
| @@ -354,7 +354,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 354 | return -ENOMEM; | 354 | return -ENOMEM; |
| 355 | 355 | ||
| 356 | if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) { | 356 | if (!(probe_ent->port_flags & SIS_FLAG_CFGSCR)) { |
| 357 | void *mmio; | 357 | void __iomem *mmio; |
| 358 | 358 | ||
| 359 | mmio = pcim_iomap(pdev, SIS_SCR_PCI_BAR, 0); | 359 | mmio = pcim_iomap(pdev, SIS_SCR_PCI_BAR, 0); |
| 360 | if (!mmio) | 360 | if (!mmio) |
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c index 0d7091e2077f..2ad2527cf5b3 100644 --- a/drivers/atm/zatm.c +++ b/drivers/atm/zatm.c | |||
| @@ -1177,7 +1177,7 @@ static void __devinit eprom_get_esi(struct atm_dev *dev) | |||
| 1177 | /*--------------------------------- entries ---------------------------------*/ | 1177 | /*--------------------------------- entries ---------------------------------*/ |
| 1178 | 1178 | ||
| 1179 | 1179 | ||
| 1180 | static int __init zatm_init(struct atm_dev *dev) | 1180 | static int __devinit zatm_init(struct atm_dev *dev) |
| 1181 | { | 1181 | { |
| 1182 | struct zatm_dev *zatm_dev; | 1182 | struct zatm_dev *zatm_dev; |
| 1183 | struct pci_dev *pci_dev; | 1183 | struct pci_dev *pci_dev; |
| @@ -1256,7 +1256,7 @@ static int __init zatm_init(struct atm_dev *dev) | |||
| 1256 | } | 1256 | } |
| 1257 | 1257 | ||
| 1258 | 1258 | ||
| 1259 | static int __init zatm_start(struct atm_dev *dev) | 1259 | static int __devinit zatm_start(struct atm_dev *dev) |
| 1260 | { | 1260 | { |
| 1261 | struct zatm_dev *zatm_dev = ZATM_DEV(dev); | 1261 | struct zatm_dev *zatm_dev = ZATM_DEV(dev); |
| 1262 | struct pci_dev *pdev = zatm_dev->pci_dev; | 1262 | struct pci_dev *pdev = zatm_dev->pci_dev; |
diff --git a/drivers/base/core.c b/drivers/base/core.c index f191afe62b4d..d7fcf823a42a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
| @@ -28,20 +28,6 @@ int (*platform_notify)(struct device * dev) = NULL; | |||
| 28 | int (*platform_notify_remove)(struct device * dev) = NULL; | 28 | int (*platform_notify_remove)(struct device * dev) = NULL; |
| 29 | 29 | ||
| 30 | /* | 30 | /* |
| 31 | * Detect the LANANA-assigned LOCAL/EXPERIMENTAL majors | ||
| 32 | */ | ||
| 33 | bool is_lanana_major(unsigned int major) | ||
| 34 | { | ||
| 35 | if (major >= 60 && major <= 63) | ||
| 36 | return 1; | ||
| 37 | if (major >= 120 && major <= 127) | ||
| 38 | return 1; | ||
| 39 | if (major >= 240 && major <= 254) | ||
| 40 | return 1; | ||
| 41 | return 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | /* | ||
| 45 | * sysfs bindings for devices. | 31 | * sysfs bindings for devices. |
| 46 | */ | 32 | */ |
| 47 | 33 | ||
| @@ -407,6 +393,35 @@ void device_remove_bin_file(struct device *dev, struct bin_attribute *attr) | |||
| 407 | } | 393 | } |
| 408 | EXPORT_SYMBOL_GPL(device_remove_bin_file); | 394 | EXPORT_SYMBOL_GPL(device_remove_bin_file); |
| 409 | 395 | ||
| 396 | /** | ||
| 397 | * device_schedule_callback - helper to schedule a callback for a device | ||
| 398 | * @dev: device. | ||
| 399 | * @func: callback function to invoke later. | ||
| 400 | * | ||
| 401 | * Attribute methods must not unregister themselves or their parent device | ||
| 402 | * (which would amount to the same thing). Attempts to do so will deadlock, | ||
| 403 | * since unregistration is mutually exclusive with driver callbacks. | ||
| 404 | * | ||
| 405 | * Instead methods can call this routine, which will attempt to allocate | ||
| 406 | * and schedule a workqueue request to call back @func with @dev as its | ||
| 407 | * argument in the workqueue's process context. @dev will be pinned until | ||
| 408 | * @func returns. | ||
| 409 | * | ||
| 410 | * Returns 0 if the request was submitted, -ENOMEM if storage could not | ||
| 411 | * be allocated. | ||
| 412 | * | ||
| 413 | * NOTE: This routine won't work if CONFIG_SYSFS isn't set! It uses an | ||
| 414 | * underlying sysfs routine (since it is intended for use by attribute | ||
| 415 | * methods), and if sysfs isn't available you'll get nothing but -ENOSYS. | ||
| 416 | */ | ||
| 417 | int device_schedule_callback(struct device *dev, | ||
| 418 | void (*func)(struct device *)) | ||
| 419 | { | ||
| 420 | return sysfs_schedule_callback(&dev->kobj, | ||
| 421 | (void (*)(void *)) func, dev); | ||
| 422 | } | ||
| 423 | EXPORT_SYMBOL_GPL(device_schedule_callback); | ||
| 424 | |||
| 410 | static void klist_children_get(struct klist_node *n) | 425 | static void klist_children_get(struct klist_node *n) |
| 411 | { | 426 | { |
| 412 | struct device *dev = container_of(n, struct device, knode_parent); | 427 | struct device *dev = container_of(n, struct device, knode_parent); |
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 1214cbd17d86..082bfded3854 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
| @@ -183,7 +183,14 @@ int driver_register(struct device_driver * drv) | |||
| 183 | void driver_unregister(struct device_driver * drv) | 183 | void driver_unregister(struct device_driver * drv) |
| 184 | { | 184 | { |
| 185 | bus_remove_driver(drv); | 185 | bus_remove_driver(drv); |
| 186 | wait_for_completion(&drv->unloaded); | 186 | /* |
| 187 | * If the driver is a module, we are probably in | ||
| 188 | * the module unload path, and we want to wait | ||
| 189 | * for everything to unload before we can actually | ||
| 190 | * finish the unload. | ||
| 191 | */ | ||
| 192 | if (drv->owner) | ||
| 193 | wait_for_completion(&drv->unloaded); | ||
| 187 | } | 194 | } |
| 188 | 195 | ||
| 189 | /** | 196 | /** |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index fdfa3d0cf6af..bbbb973a9d3c 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -54,7 +54,8 @@ int device_pm_add(struct device * dev) | |||
| 54 | int error; | 54 | int error; |
| 55 | 55 | ||
| 56 | pr_debug("PM: Adding info for %s:%s\n", | 56 | pr_debug("PM: Adding info for %s:%s\n", |
| 57 | dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); | 57 | dev->bus ? dev->bus->name : "No Bus", |
| 58 | kobject_name(&dev->kobj)); | ||
| 58 | down(&dpm_list_sem); | 59 | down(&dpm_list_sem); |
| 59 | list_add_tail(&dev->power.entry, &dpm_active); | 60 | list_add_tail(&dev->power.entry, &dpm_active); |
| 60 | device_pm_set_parent(dev, dev->parent); | 61 | device_pm_set_parent(dev, dev->parent); |
| @@ -67,7 +68,8 @@ int device_pm_add(struct device * dev) | |||
| 67 | void device_pm_remove(struct device * dev) | 68 | void device_pm_remove(struct device * dev) |
| 68 | { | 69 | { |
| 69 | pr_debug("PM: Removing info for %s:%s\n", | 70 | pr_debug("PM: Removing info for %s:%s\n", |
| 70 | dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); | 71 | dev->bus ? dev->bus->name : "No Bus", |
| 72 | kobject_name(&dev->kobj)); | ||
| 71 | down(&dpm_list_sem); | 73 | down(&dpm_list_sem); |
| 72 | dpm_sysfs_remove(dev); | 74 | dpm_sysfs_remove(dev); |
| 73 | put_device(dev->power.pm_parent); | 75 | put_device(dev->power.pm_parent); |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 0c716ee905d7..65a725cd3422 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
| @@ -1439,7 +1439,7 @@ static int rebuild_lun_table(ctlr_info_t *h, struct gendisk *del_disk) | |||
| 1439 | 1439 | ||
| 1440 | if (return_code == IO_OK) { | 1440 | if (return_code == IO_OK) { |
| 1441 | listlength = | 1441 | listlength = |
| 1442 | be32_to_cpu(*(__u32 *) ld_buff->LUNListLength); | 1442 | be32_to_cpu(*(__be32 *) ld_buff->LUNListLength); |
| 1443 | } else { /* reading number of logical volumes failed */ | 1443 | } else { /* reading number of logical volumes failed */ |
| 1444 | printk(KERN_WARNING "cciss: report logical volume" | 1444 | printk(KERN_WARNING "cciss: report logical volume" |
| 1445 | " command failed\n"); | 1445 | " command failed\n"); |
| @@ -1915,6 +1915,7 @@ static void cciss_geometry_inquiry(int ctlr, int logvol, | |||
| 1915 | "does not support reading geometry\n"); | 1915 | "does not support reading geometry\n"); |
| 1916 | drv->heads = 255; | 1916 | drv->heads = 255; |
| 1917 | drv->sectors = 32; // Sectors per track | 1917 | drv->sectors = 32; // Sectors per track |
| 1918 | drv->cylinders = total_size + 1; | ||
| 1918 | drv->raid_level = RAID_UNKNOWN; | 1919 | drv->raid_level = RAID_UNKNOWN; |
| 1919 | } else { | 1920 | } else { |
| 1920 | drv->heads = inq_buff->data_byte[6]; | 1921 | drv->heads = inq_buff->data_byte[6]; |
| @@ -1961,8 +1962,8 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size, | |||
| 1961 | ctlr, buf, sizeof(ReadCapdata_struct), | 1962 | ctlr, buf, sizeof(ReadCapdata_struct), |
| 1962 | 1, logvol, 0, NULL, TYPE_CMD); | 1963 | 1, logvol, 0, NULL, TYPE_CMD); |
| 1963 | if (return_code == IO_OK) { | 1964 | if (return_code == IO_OK) { |
| 1964 | *total_size = be32_to_cpu(*(__u32 *) buf->total_size); | 1965 | *total_size = be32_to_cpu(*(__be32 *) buf->total_size); |
| 1965 | *block_size = be32_to_cpu(*(__u32 *) buf->block_size); | 1966 | *block_size = be32_to_cpu(*(__be32 *) buf->block_size); |
| 1966 | } else { /* read capacity command failed */ | 1967 | } else { /* read capacity command failed */ |
| 1967 | printk(KERN_WARNING "cciss: read capacity failed\n"); | 1968 | printk(KERN_WARNING "cciss: read capacity failed\n"); |
| 1968 | *total_size = 0; | 1969 | *total_size = 0; |
| @@ -1997,8 +1998,8 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size, | |||
| 1997 | 1, logvol, 0, NULL, TYPE_CMD); | 1998 | 1, logvol, 0, NULL, TYPE_CMD); |
| 1998 | } | 1999 | } |
| 1999 | if (return_code == IO_OK) { | 2000 | if (return_code == IO_OK) { |
| 2000 | *total_size = be64_to_cpu(*(__u64 *) buf->total_size); | 2001 | *total_size = be64_to_cpu(*(__be64 *) buf->total_size); |
| 2001 | *block_size = be32_to_cpu(*(__u32 *) buf->block_size); | 2002 | *block_size = be32_to_cpu(*(__be32 *) buf->block_size); |
| 2002 | } else { /* read capacity command failed */ | 2003 | } else { /* read capacity command failed */ |
| 2003 | printk(KERN_WARNING "cciss: read capacity failed\n"); | 2004 | printk(KERN_WARNING "cciss: read capacity failed\n"); |
| 2004 | *total_size = 0; | 2005 | *total_size = 0; |
| @@ -3422,6 +3423,25 @@ static void cciss_remove_one(struct pci_dev *pdev) | |||
| 3422 | "already be removed \n"); | 3423 | "already be removed \n"); |
| 3423 | return; | 3424 | return; |
| 3424 | } | 3425 | } |
| 3426 | |||
| 3427 | remove_proc_entry(hba[i]->devname, proc_cciss); | ||
| 3428 | unregister_blkdev(hba[i]->major, hba[i]->devname); | ||
| 3429 | |||
| 3430 | /* remove it from the disk list */ | ||
| 3431 | for (j = 0; j < CISS_MAX_LUN; j++) { | ||
| 3432 | struct gendisk *disk = hba[i]->gendisk[j]; | ||
| 3433 | if (disk) { | ||
| 3434 | request_queue_t *q = disk->queue; | ||
| 3435 | |||
| 3436 | if (disk->flags & GENHD_FL_UP) | ||
| 3437 | del_gendisk(disk); | ||
| 3438 | if (q) | ||
| 3439 | blk_cleanup_queue(q); | ||
| 3440 | } | ||
| 3441 | } | ||
| 3442 | |||
| 3443 | cciss_unregister_scsi(i); /* unhook from SCSI subsystem */ | ||
| 3444 | |||
| 3425 | /* Turn board interrupts off and send the flush cache command */ | 3445 | /* Turn board interrupts off and send the flush cache command */ |
| 3426 | /* sendcmd will turn off interrupt, and send the flush... | 3446 | /* sendcmd will turn off interrupt, and send the flush... |
| 3427 | * To write all data in the battery backed cache to disks */ | 3447 | * To write all data in the battery backed cache to disks */ |
| @@ -3443,22 +3463,6 @@ static void cciss_remove_one(struct pci_dev *pdev) | |||
| 3443 | #endif /* CONFIG_PCI_MSI */ | 3463 | #endif /* CONFIG_PCI_MSI */ |
| 3444 | 3464 | ||
| 3445 | iounmap(hba[i]->vaddr); | 3465 | iounmap(hba[i]->vaddr); |
| 3446 | cciss_unregister_scsi(i); /* unhook from SCSI subsystem */ | ||
| 3447 | unregister_blkdev(hba[i]->major, hba[i]->devname); | ||
| 3448 | remove_proc_entry(hba[i]->devname, proc_cciss); | ||
| 3449 | |||
| 3450 | /* remove it from the disk list */ | ||
| 3451 | for (j = 0; j < CISS_MAX_LUN; j++) { | ||
| 3452 | struct gendisk *disk = hba[i]->gendisk[j]; | ||
| 3453 | if (disk) { | ||
| 3454 | request_queue_t *q = disk->queue; | ||
| 3455 | |||
| 3456 | if (disk->flags & GENHD_FL_UP) | ||
| 3457 | del_gendisk(disk); | ||
| 3458 | if (q) | ||
| 3459 | blk_cleanup_queue(q); | ||
| 3460 | } | ||
| 3461 | } | ||
| 3462 | 3466 | ||
| 3463 | pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(CommandList_struct), | 3467 | pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(CommandList_struct), |
| 3464 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); | 3468 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); |
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index c852eed91e4b..1eeb8f2cde71 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
| @@ -140,7 +140,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY}; | |||
| 140 | #include <linux/blkdev.h> | 140 | #include <linux/blkdev.h> |
| 141 | #include <asm/uaccess.h> | 141 | #include <asm/uaccess.h> |
| 142 | 142 | ||
| 143 | static spinlock_t pcd_lock; | 143 | static DEFINE_SPINLOCK(pcd_lock); |
| 144 | 144 | ||
| 145 | module_param(verbose, bool, 0644); | 145 | module_param(verbose, bool, 0644); |
| 146 | module_param(major, int, 0); | 146 | module_param(major, int, 0); |
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 99e2c8ce1cc4..31e01488eb51 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c | |||
| @@ -663,11 +663,11 @@ static enum action pd_identify(struct pd_unit *disk) | |||
| 663 | return Fail; | 663 | return Fail; |
| 664 | pi_read_block(disk->pi, pd_scratch, 512); | 664 | pi_read_block(disk->pi, pd_scratch, 512); |
| 665 | disk->can_lba = pd_scratch[99] & 2; | 665 | disk->can_lba = pd_scratch[99] & 2; |
| 666 | disk->sectors = le16_to_cpu(*(u16 *) (pd_scratch + 12)); | 666 | disk->sectors = le16_to_cpu(*(__le16 *) (pd_scratch + 12)); |
| 667 | disk->heads = le16_to_cpu(*(u16 *) (pd_scratch + 6)); | 667 | disk->heads = le16_to_cpu(*(__le16 *) (pd_scratch + 6)); |
| 668 | disk->cylinders = le16_to_cpu(*(u16 *) (pd_scratch + 2)); | 668 | disk->cylinders = le16_to_cpu(*(__le16 *) (pd_scratch + 2)); |
| 669 | if (disk->can_lba) | 669 | if (disk->can_lba) |
| 670 | disk->capacity = le32_to_cpu(*(u32 *) (pd_scratch + 120)); | 670 | disk->capacity = le32_to_cpu(*(__le32 *) (pd_scratch + 120)); |
| 671 | else | 671 | else |
| 672 | disk->capacity = disk->sectors * disk->heads * disk->cylinders; | 672 | disk->capacity = disk->sectors * disk->heads * disk->cylinders; |
| 673 | 673 | ||
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 7cdaa1951260..5826508f6731 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
| @@ -154,7 +154,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_LUN, D_DLY}; | |||
| 154 | #include <linux/blkpg.h> | 154 | #include <linux/blkpg.h> |
| 155 | #include <asm/uaccess.h> | 155 | #include <asm/uaccess.h> |
| 156 | 156 | ||
| 157 | static spinlock_t pf_spin_lock; | 157 | static DEFINE_SPINLOCK(pf_spin_lock); |
| 158 | 158 | ||
| 159 | module_param(verbose, bool, 0644); | 159 | module_param(verbose, bool, 0644); |
| 160 | module_param(major, int, 0); | 160 | module_param(major, int, 0); |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index a4fb70383188..f1b9dd7d47d6 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
| @@ -777,7 +777,8 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command * | |||
| 777 | rq->cmd_flags |= REQ_QUIET; | 777 | rq->cmd_flags |= REQ_QUIET; |
| 778 | 778 | ||
| 779 | blk_execute_rq(rq->q, pd->bdev->bd_disk, rq, 0); | 779 | blk_execute_rq(rq->q, pd->bdev->bd_disk, rq, 0); |
| 780 | ret = rq->errors; | 780 | if (rq->errors) |
| 781 | ret = -EIO; | ||
| 781 | out: | 782 | out: |
| 782 | blk_put_request(rq); | 783 | blk_put_request(rq); |
| 783 | return ret; | 784 | return ret; |
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 3429ece4ef92..d0c978fbc204 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
| @@ -386,6 +386,39 @@ config AU1000_SERIAL_CONSOLE | |||
| 386 | If you have an Alchemy AU1000 processor (MIPS based) and you want | 386 | If you have an Alchemy AU1000 processor (MIPS based) and you want |
| 387 | to use a console on a serial port, say Y. Otherwise, say N. | 387 | to use a console on a serial port, say Y. Otherwise, say N. |
| 388 | 388 | ||
| 389 | config SERIAL_DEC | ||
| 390 | bool "DECstation serial support" | ||
| 391 | depends on MACH_DECSTATION | ||
| 392 | default y | ||
| 393 | help | ||
| 394 | This selects whether you want to be asked about drivers for | ||
| 395 | DECstation serial ports. | ||
| 396 | |||
| 397 | Note that the answer to this question won't directly affect the | ||
| 398 | kernel: saying N will just cause the configurator to skip all | ||
| 399 | the questions about DECstation serial ports. | ||
| 400 | |||
| 401 | config SERIAL_DEC_CONSOLE | ||
| 402 | bool "Support for console on a DECstation serial port" | ||
| 403 | depends on SERIAL_DEC | ||
| 404 | default y | ||
| 405 | help | ||
| 406 | If you say Y here, it will be possible to use a serial port as the | ||
| 407 | system console (the system console is the device which receives all | ||
| 408 | kernel messages and warnings and which allows logins in single user | ||
| 409 | mode). Note that the firmware uses ttyS0 as the serial console on | ||
| 410 | the Maxine and ttyS2 on the others. | ||
| 411 | |||
| 412 | If unsure, say Y. | ||
| 413 | |||
| 414 | config ZS | ||
| 415 | bool "Z85C30 Serial Support" | ||
| 416 | depends on SERIAL_DEC | ||
| 417 | default y | ||
| 418 | help | ||
| 419 | Documentation on the Zilog 85C350 serial communications controller | ||
| 420 | is downloadable at <http://www.zilog.com/pdfs/serial/z85c30.pdf> | ||
| 421 | |||
| 389 | config A2232 | 422 | config A2232 |
| 390 | tristate "Commodore A2232 serial support (EXPERIMENTAL)" | 423 | tristate "Commodore A2232 serial support (EXPERIMENTAL)" |
| 391 | depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP | 424 | depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index e542a628f1c7..55392a45a14b 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
| @@ -18,11 +18,14 @@ | |||
| 18 | #define PCI_DEVICE_ID_INTEL_82965Q_IG 0x2992 | 18 | #define PCI_DEVICE_ID_INTEL_82965Q_IG 0x2992 |
| 19 | #define PCI_DEVICE_ID_INTEL_82965G_HB 0x29A0 | 19 | #define PCI_DEVICE_ID_INTEL_82965G_HB 0x29A0 |
| 20 | #define PCI_DEVICE_ID_INTEL_82965G_IG 0x29A2 | 20 | #define PCI_DEVICE_ID_INTEL_82965G_IG 0x29A2 |
| 21 | #define PCI_DEVICE_ID_INTEL_82965GM_HB 0x2A00 | ||
| 22 | #define PCI_DEVICE_ID_INTEL_82965GM_IG 0x2A02 | ||
| 21 | 23 | ||
| 22 | #define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \ | 24 | #define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \ |
| 23 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \ | 25 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \ |
| 24 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ | 26 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ |
| 25 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB) | 27 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \ |
| 28 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB) | ||
| 26 | 29 | ||
| 27 | 30 | ||
| 28 | extern int agp_memory_reserved; | 31 | extern int agp_memory_reserved; |
| @@ -428,9 +431,8 @@ static void intel_i830_init_gtt_entries(void) | |||
| 428 | 431 | ||
| 429 | if (IS_I965) { | 432 | if (IS_I965) { |
| 430 | u32 pgetbl_ctl; | 433 | u32 pgetbl_ctl; |
| 434 | pgetbl_ctl = readl(intel_i830_private.registers+I810_PGETBL_CTL); | ||
| 431 | 435 | ||
| 432 | pci_read_config_dword(agp_bridge->dev, I810_PGETBL_CTL, | ||
| 433 | &pgetbl_ctl); | ||
| 434 | /* The 965 has a field telling us the size of the GTT, | 436 | /* The 965 has a field telling us the size of the GTT, |
| 435 | * which may be larger than what is necessary to map the | 437 | * which may be larger than what is necessary to map the |
| 436 | * aperture. | 438 | * aperture. |
| @@ -1921,7 +1923,13 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
| 1921 | bridge->driver = &intel_845_driver; | 1923 | bridge->driver = &intel_845_driver; |
| 1922 | name = "965G"; | 1924 | name = "965G"; |
| 1923 | break; | 1925 | break; |
| 1924 | 1926 | case PCI_DEVICE_ID_INTEL_82965GM_HB: | |
| 1927 | if (find_i830(PCI_DEVICE_ID_INTEL_82965GM_IG)) | ||
| 1928 | bridge->driver = &intel_i965_driver; | ||
| 1929 | else | ||
| 1930 | bridge->driver = &intel_845_driver; | ||
| 1931 | name = "965GM"; | ||
| 1932 | break; | ||
| 1925 | case PCI_DEVICE_ID_INTEL_7505_0: | 1933 | case PCI_DEVICE_ID_INTEL_7505_0: |
| 1926 | bridge->driver = &intel_7505_driver; | 1934 | bridge->driver = &intel_7505_driver; |
| 1927 | name = "E7505"; | 1935 | name = "E7505"; |
| @@ -2080,6 +2088,7 @@ static struct pci_device_id agp_intel_pci_table[] = { | |||
| 2080 | ID(PCI_DEVICE_ID_INTEL_82965G_1_HB), | 2088 | ID(PCI_DEVICE_ID_INTEL_82965G_1_HB), |
| 2081 | ID(PCI_DEVICE_ID_INTEL_82965Q_HB), | 2089 | ID(PCI_DEVICE_ID_INTEL_82965Q_HB), |
| 2082 | ID(PCI_DEVICE_ID_INTEL_82965G_HB), | 2090 | ID(PCI_DEVICE_ID_INTEL_82965G_HB), |
| 2091 | ID(PCI_DEVICE_ID_INTEL_82965GM_HB), | ||
| 2083 | { } | 2092 | { } |
| 2084 | }; | 2093 | }; |
| 2085 | 2094 | ||
diff --git a/drivers/char/drm/Makefile b/drivers/char/drm/Makefile index 3ad0f648c6b2..6915a0599dfb 100644 --- a/drivers/char/drm/Makefile +++ b/drivers/char/drm/Makefile | |||
| @@ -15,7 +15,6 @@ i810-objs := i810_drv.o i810_dma.o | |||
| 15 | i830-objs := i830_drv.o i830_dma.o i830_irq.o | 15 | i830-objs := i830_drv.o i830_dma.o i830_irq.o |
| 16 | i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o | 16 | i915-objs := i915_drv.o i915_dma.o i915_irq.o i915_mem.o |
| 17 | radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o | 17 | radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o r300_cmdbuf.o |
| 18 | ffb-objs := ffb_drv.o ffb_context.o | ||
| 19 | sis-objs := sis_drv.o sis_mm.o | 18 | sis-objs := sis_drv.o sis_mm.o |
| 20 | savage-objs := savage_drv.o savage_bci.o savage_state.o | 19 | savage-objs := savage_drv.o savage_bci.o savage_state.o |
| 21 | via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o | 20 | via-objs := via_irq.o via_drv.o via_map.o via_mm.o via_dma.o via_verifier.o via_video.o via_dmablit.o |
| @@ -36,7 +35,6 @@ obj-$(CONFIG_DRM_MGA) += mga.o | |||
| 36 | obj-$(CONFIG_DRM_I810) += i810.o | 35 | obj-$(CONFIG_DRM_I810) += i810.o |
| 37 | obj-$(CONFIG_DRM_I830) += i830.o | 36 | obj-$(CONFIG_DRM_I830) += i830.o |
| 38 | obj-$(CONFIG_DRM_I915) += i915.o | 37 | obj-$(CONFIG_DRM_I915) += i915.o |
| 39 | obj-$(CONFIG_DRM_FFB) += ffb.o | ||
| 40 | obj-$(CONFIG_DRM_SIS) += sis.o | 38 | obj-$(CONFIG_DRM_SIS) += sis.o |
| 41 | obj-$(CONFIG_DRM_SAVAGE)+= savage.o | 39 | obj-$(CONFIG_DRM_SAVAGE)+= savage.o |
| 42 | obj-$(CONFIG_DRM_VIA) +=via.o | 40 | obj-$(CONFIG_DRM_VIA) +=via.o |
diff --git a/drivers/char/drm/ffb_context.c b/drivers/char/drm/ffb_context.c deleted file mode 100644 index ac9ab40d57aa..000000000000 --- a/drivers/char/drm/ffb_context.c +++ /dev/null | |||
| @@ -1,544 +0,0 @@ | |||
| 1 | /* $Id: ffb_context.c,v 1.5 2001/08/09 17:47:51 davem Exp $ | ||
| 2 | * ffb_context.c: Creator/Creator3D DRI/DRM context switching. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2000 David S. Miller (davem@redhat.com) | ||
| 5 | * | ||
| 6 | * Almost entirely stolen from tdfx_context.c, see there | ||
| 7 | * for authors. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <asm/upa.h> | ||
| 11 | |||
| 12 | #include "ffb.h" | ||
| 13 | #include "drmP.h" | ||
| 14 | |||
| 15 | #include "ffb_drv.h" | ||
| 16 | |||
| 17 | static int DRM(alloc_queue) (drm_device_t * dev, int is_2d_only) { | ||
| 18 | ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private; | ||
| 19 | int i; | ||
| 20 | |||
| 21 | for (i = 0; i < FFB_MAX_CTXS; i++) { | ||
| 22 | if (fpriv->hw_state[i] == NULL) | ||
| 23 | break; | ||
| 24 | } | ||
| 25 | if (i == FFB_MAX_CTXS) | ||
| 26 | return -1; | ||
| 27 | |||
| 28 | fpriv->hw_state[i] = kmalloc(sizeof(struct ffb_hw_context), GFP_KERNEL); | ||
| 29 | if (fpriv->hw_state[i] == NULL) | ||
| 30 | return -1; | ||
| 31 | |||
| 32 | fpriv->hw_state[i]->is_2d_only = is_2d_only; | ||
| 33 | |||
| 34 | /* Plus one because 0 is the special DRM_KERNEL_CONTEXT. */ | ||
| 35 | return i + 1; | ||
| 36 | } | ||
| 37 | |||
| 38 | static void ffb_save_context(ffb_dev_priv_t * fpriv, int idx) | ||
| 39 | { | ||
| 40 | ffb_fbcPtr ffb = fpriv->regs; | ||
| 41 | struct ffb_hw_context *ctx; | ||
| 42 | int i; | ||
| 43 | |||
| 44 | ctx = fpriv->hw_state[idx - 1]; | ||
| 45 | if (idx == 0 || ctx == NULL) | ||
| 46 | return; | ||
| 47 | |||
| 48 | if (ctx->is_2d_only) { | ||
| 49 | /* 2D applications only care about certain pieces | ||
| 50 | * of state. | ||
| 51 | */ | ||
| 52 | ctx->drawop = upa_readl(&ffb->drawop); | ||
| 53 | ctx->ppc = upa_readl(&ffb->ppc); | ||
| 54 | ctx->wid = upa_readl(&ffb->wid); | ||
| 55 | ctx->fg = upa_readl(&ffb->fg); | ||
| 56 | ctx->bg = upa_readl(&ffb->bg); | ||
| 57 | ctx->xclip = upa_readl(&ffb->xclip); | ||
| 58 | ctx->fbc = upa_readl(&ffb->fbc); | ||
| 59 | ctx->rop = upa_readl(&ffb->rop); | ||
| 60 | ctx->cmp = upa_readl(&ffb->cmp); | ||
| 61 | ctx->matchab = upa_readl(&ffb->matchab); | ||
| 62 | ctx->magnab = upa_readl(&ffb->magnab); | ||
| 63 | ctx->pmask = upa_readl(&ffb->pmask); | ||
| 64 | ctx->xpmask = upa_readl(&ffb->xpmask); | ||
| 65 | ctx->lpat = upa_readl(&ffb->lpat); | ||
| 66 | ctx->fontxy = upa_readl(&ffb->fontxy); | ||
| 67 | ctx->fontw = upa_readl(&ffb->fontw); | ||
| 68 | ctx->fontinc = upa_readl(&ffb->fontinc); | ||
| 69 | |||
| 70 | /* stencil/stencilctl only exists on FFB2+ and later | ||
| 71 | * due to the introduction of 3DRAM-III. | ||
| 72 | */ | ||
| 73 | if (fpriv->ffb_type == ffb2_vertical_plus || | ||
| 74 | fpriv->ffb_type == ffb2_horizontal_plus) { | ||
| 75 | ctx->stencil = upa_readl(&ffb->stencil); | ||
| 76 | ctx->stencilctl = upa_readl(&ffb->stencilctl); | ||
| 77 | } | ||
| 78 | |||
| 79 | for (i = 0; i < 32; i++) | ||
| 80 | ctx->area_pattern[i] = upa_readl(&ffb->pattern[i]); | ||
| 81 | ctx->ucsr = upa_readl(&ffb->ucsr); | ||
| 82 | return; | ||
| 83 | } | ||
| 84 | |||
| 85 | /* Fetch drawop. */ | ||
| 86 | ctx->drawop = upa_readl(&ffb->drawop); | ||
| 87 | |||
| 88 | /* If we were saving the vertex registers, this is where | ||
| 89 | * we would do it. We would save 32 32-bit words starting | ||
| 90 | * at ffb->suvtx. | ||
| 91 | */ | ||
| 92 | |||
| 93 | /* Capture rendering attributes. */ | ||
| 94 | |||
| 95 | ctx->ppc = upa_readl(&ffb->ppc); /* Pixel Processor Control */ | ||
| 96 | ctx->wid = upa_readl(&ffb->wid); /* Current WID */ | ||
| 97 | ctx->fg = upa_readl(&ffb->fg); /* Constant FG color */ | ||
| 98 | ctx->bg = upa_readl(&ffb->bg); /* Constant BG color */ | ||
| 99 | ctx->consty = upa_readl(&ffb->consty); /* Constant Y */ | ||
| 100 | ctx->constz = upa_readl(&ffb->constz); /* Constant Z */ | ||
| 101 | ctx->xclip = upa_readl(&ffb->xclip); /* X plane clip */ | ||
| 102 | ctx->dcss = upa_readl(&ffb->dcss); /* Depth Cue Scale Slope */ | ||
| 103 | ctx->vclipmin = upa_readl(&ffb->vclipmin); /* Primary XY clip, minimum */ | ||
| 104 | ctx->vclipmax = upa_readl(&ffb->vclipmax); /* Primary XY clip, maximum */ | ||
| 105 | ctx->vclipzmin = upa_readl(&ffb->vclipzmin); /* Primary Z clip, minimum */ | ||
| 106 | ctx->vclipzmax = upa_readl(&ffb->vclipzmax); /* Primary Z clip, maximum */ | ||
| 107 | ctx->dcsf = upa_readl(&ffb->dcsf); /* Depth Cue Scale Front Bound */ | ||
| 108 | ctx->dcsb = upa_readl(&ffb->dcsb); /* Depth Cue Scale Back Bound */ | ||
| 109 | ctx->dczf = upa_readl(&ffb->dczf); /* Depth Cue Scale Z Front */ | ||
| 110 | ctx->dczb = upa_readl(&ffb->dczb); /* Depth Cue Scale Z Back */ | ||
| 111 | ctx->blendc = upa_readl(&ffb->blendc); /* Alpha Blend Control */ | ||
| 112 | ctx->blendc1 = upa_readl(&ffb->blendc1); /* Alpha Blend Color 1 */ | ||
| 113 | ctx->blendc2 = upa_readl(&ffb->blendc2); /* Alpha Blend Color 2 */ | ||
| 114 | ctx->fbc = upa_readl(&ffb->fbc); /* Frame Buffer Control */ | ||
| 115 | ctx->rop = upa_readl(&ffb->rop); /* Raster Operation */ | ||
| 116 | ctx->cmp = upa_readl(&ffb->cmp); /* Compare Controls */ | ||
| 117 | ctx->matchab = upa_readl(&ffb->matchab); /* Buffer A/B Match Ops */ | ||
| 118 | ctx->matchc = upa_readl(&ffb->matchc); /* Buffer C Match Ops */ | ||
| 119 | ctx->magnab = upa_readl(&ffb->magnab); /* Buffer A/B Magnitude Ops */ | ||
| 120 | ctx->magnc = upa_readl(&ffb->magnc); /* Buffer C Magnitude Ops */ | ||
| 121 | ctx->pmask = upa_readl(&ffb->pmask); /* RGB Plane Mask */ | ||
| 122 | ctx->xpmask = upa_readl(&ffb->xpmask); /* X Plane Mask */ | ||
| 123 | ctx->ypmask = upa_readl(&ffb->ypmask); /* Y Plane Mask */ | ||
| 124 | ctx->zpmask = upa_readl(&ffb->zpmask); /* Z Plane Mask */ | ||
| 125 | |||
| 126 | /* Auxiliary Clips. */ | ||
| 127 | ctx->auxclip0min = upa_readl(&ffb->auxclip[0].min); | ||
| 128 | ctx->auxclip0max = upa_readl(&ffb->auxclip[0].max); | ||
| 129 | ctx->auxclip1min = upa_readl(&ffb->auxclip[1].min); | ||
| 130 | ctx->auxclip1max = upa_readl(&ffb->auxclip[1].max); | ||
| 131 | ctx->auxclip2min = upa_readl(&ffb->auxclip[2].min); | ||
| 132 | ctx->auxclip2max = upa_readl(&ffb->auxclip[2].max); | ||
| 133 | ctx->auxclip3min = upa_readl(&ffb->auxclip[3].min); | ||
| 134 | ctx->auxclip3max = upa_readl(&ffb->auxclip[3].max); | ||
| 135 | |||
| 136 | ctx->lpat = upa_readl(&ffb->lpat); /* Line Pattern */ | ||
| 137 | ctx->fontxy = upa_readl(&ffb->fontxy); /* XY Font Coordinate */ | ||
| 138 | ctx->fontw = upa_readl(&ffb->fontw); /* Font Width */ | ||
| 139 | ctx->fontinc = upa_readl(&ffb->fontinc); /* Font X/Y Increment */ | ||
| 140 | |||
| 141 | /* These registers/features only exist on FFB2 and later chips. */ | ||
| 142 | if (fpriv->ffb_type >= ffb2_prototype) { | ||
| 143 | ctx->dcss1 = upa_readl(&ffb->dcss1); /* Depth Cue Scale Slope 1 */ | ||
| 144 | ctx->dcss2 = upa_readl(&ffb->dcss2); /* Depth Cue Scale Slope 2 */ | ||
| 145 | ctx->dcss2 = upa_readl(&ffb->dcss3); /* Depth Cue Scale Slope 3 */ | ||
| 146 | ctx->dcs2 = upa_readl(&ffb->dcs2); /* Depth Cue Scale 2 */ | ||
| 147 | ctx->dcs3 = upa_readl(&ffb->dcs3); /* Depth Cue Scale 3 */ | ||
| 148 | ctx->dcs4 = upa_readl(&ffb->dcs4); /* Depth Cue Scale 4 */ | ||
| 149 | ctx->dcd2 = upa_readl(&ffb->dcd2); /* Depth Cue Depth 2 */ | ||
| 150 | ctx->dcd3 = upa_readl(&ffb->dcd3); /* Depth Cue Depth 3 */ | ||
| 151 | ctx->dcd4 = upa_readl(&ffb->dcd4); /* Depth Cue Depth 4 */ | ||
| 152 | |||
| 153 | /* And stencil/stencilctl only exists on FFB2+ and later | ||
| 154 | * due to the introduction of 3DRAM-III. | ||
| 155 | */ | ||
| 156 | if (fpriv->ffb_type == ffb2_vertical_plus || | ||
| 157 | fpriv->ffb_type == ffb2_horizontal_plus) { | ||
| 158 | ctx->stencil = upa_readl(&ffb->stencil); | ||
| 159 | ctx->stencilctl = upa_readl(&ffb->stencilctl); | ||
| 160 | } | ||
| 161 | } | ||
| 162 | |||
| 163 | /* Save the 32x32 area pattern. */ | ||
| 164 | for (i = 0; i < 32; i++) | ||
| 165 | ctx->area_pattern[i] = upa_readl(&ffb->pattern[i]); | ||
| 166 | |||
| 167 | /* Finally, stash away the User Constol/Status Register. */ | ||
| 168 | ctx->ucsr = upa_readl(&ffb->ucsr); | ||
| 169 | } | ||
| 170 | |||
| 171 | static void ffb_restore_context(ffb_dev_priv_t * fpriv, int old, int idx) | ||
| 172 | { | ||
| 173 | ffb_fbcPtr ffb = fpriv->regs; | ||
| 174 | struct ffb_hw_context *ctx; | ||
| 175 | int i; | ||
| 176 | |||
| 177 | ctx = fpriv->hw_state[idx - 1]; | ||
| 178 | if (idx == 0 || ctx == NULL) | ||
| 179 | return; | ||
| 180 | |||
| 181 | if (ctx->is_2d_only) { | ||
| 182 | /* 2D applications only care about certain pieces | ||
| 183 | * of state. | ||
| 184 | */ | ||
| 185 | upa_writel(ctx->drawop, &ffb->drawop); | ||
| 186 | |||
| 187 | /* If we were restoring the vertex registers, this is where | ||
| 188 | * we would do it. We would restore 32 32-bit words starting | ||
| 189 | * at ffb->suvtx. | ||
| 190 | */ | ||
| 191 | |||
| 192 | upa_writel(ctx->ppc, &ffb->ppc); | ||
| 193 | upa_writel(ctx->wid, &ffb->wid); | ||
| 194 | upa_writel(ctx->fg, &ffb->fg); | ||
| 195 | upa_writel(ctx->bg, &ffb->bg); | ||
| 196 | upa_writel(ctx->xclip, &ffb->xclip); | ||
| 197 | upa_writel(ctx->fbc, &ffb->fbc); | ||
| 198 | upa_writel(ctx->rop, &ffb->rop); | ||
| 199 | upa_writel(ctx->cmp, &ffb->cmp); | ||
| 200 | upa_writel(ctx->matchab, &ffb->matchab); | ||
| 201 | upa_writel(ctx->magnab, &ffb->magnab); | ||
| 202 | upa_writel(ctx->pmask, &ffb->pmask); | ||
| 203 | upa_writel(ctx->xpmask, &ffb->xpmask); | ||
| 204 | upa_writel(ctx->lpat, &ffb->lpat); | ||
| 205 | upa_writel(ctx->fontxy, &ffb->fontxy); | ||
| 206 | upa_writel(ctx->fontw, &ffb->fontw); | ||
| 207 | upa_writel(ctx->fontinc, &ffb->fontinc); | ||
| 208 | |||
| 209 | /* stencil/stencilctl only exists on FFB2+ and later | ||
| 210 | * due to the introduction of 3DRAM-III. | ||
| 211 | */ | ||
| 212 | if (fpriv->ffb_type == ffb2_vertical_plus || | ||
| 213 | fpriv->ffb_type == ffb2_horizontal_plus) { | ||
| 214 | upa_writel(ctx->stencil, &ffb->stencil); | ||
| 215 | upa_writel(ctx->stencilctl, &ffb->stencilctl); | ||
| 216 | upa_writel(0x80000000, &ffb->fbc); | ||
| 217 | upa_writel((ctx->stencilctl | 0x80000), | ||
| 218 | &ffb->rawstencilctl); | ||
| 219 | upa_writel(ctx->fbc, &ffb->fbc); | ||
| 220 | } | ||
| 221 | |||
| 222 | for (i = 0; i < 32; i++) | ||
| 223 | upa_writel(ctx->area_pattern[i], &ffb->pattern[i]); | ||
| 224 | upa_writel((ctx->ucsr & 0xf0000), &ffb->ucsr); | ||
| 225 | return; | ||
| 226 | } | ||
| 227 | |||
| 228 | /* Restore drawop. */ | ||
| 229 | upa_writel(ctx->drawop, &ffb->drawop); | ||
| 230 | |||
| 231 | /* If we were restoring the vertex registers, this is where | ||
| 232 | * we would do it. We would restore 32 32-bit words starting | ||
| 233 | * at ffb->suvtx. | ||
| 234 | */ | ||
| 235 | |||
| 236 | /* Restore rendering attributes. */ | ||
| 237 | |||
| 238 | upa_writel(ctx->ppc, &ffb->ppc); /* Pixel Processor Control */ | ||
| 239 | upa_writel(ctx->wid, &ffb->wid); /* Current WID */ | ||
| 240 | upa_writel(ctx->fg, &ffb->fg); /* Constant FG color */ | ||
| 241 | upa_writel(ctx->bg, &ffb->bg); /* Constant BG color */ | ||
| 242 | upa_writel(ctx->consty, &ffb->consty); /* Constant Y */ | ||
| 243 | upa_writel(ctx->constz, &ffb->constz); /* Constant Z */ | ||
| 244 | upa_writel(ctx->xclip, &ffb->xclip); /* X plane clip */ | ||
| 245 | upa_writel(ctx->dcss, &ffb->dcss); /* Depth Cue Scale Slope */ | ||
| 246 | upa_writel(ctx->vclipmin, &ffb->vclipmin); /* Primary XY clip, minimum */ | ||
| 247 | upa_writel(ctx->vclipmax, &ffb->vclipmax); /* Primary XY clip, maximum */ | ||
| 248 | upa_writel(ctx->vclipzmin, &ffb->vclipzmin); /* Primary Z clip, minimum */ | ||
| 249 | upa_writel(ctx->vclipzmax, &ffb->vclipzmax); /* Primary Z clip, maximum */ | ||
| 250 | upa_writel(ctx->dcsf, &ffb->dcsf); /* Depth Cue Scale Front Bound */ | ||
| 251 | upa_writel(ctx->dcsb, &ffb->dcsb); /* Depth Cue Scale Back Bound */ | ||
| 252 | upa_writel(ctx->dczf, &ffb->dczf); /* Depth Cue Scale Z Front */ | ||
| 253 | upa_writel(ctx->dczb, &ffb->dczb); /* Depth Cue Scale Z Back */ | ||
| 254 | upa_writel(ctx->blendc, &ffb->blendc); /* Alpha Blend Control */ | ||
| 255 | upa_writel(ctx->blendc1, &ffb->blendc1); /* Alpha Blend Color 1 */ | ||
| 256 | upa_writel(ctx->blendc2, &ffb->blendc2); /* Alpha Blend Color 2 */ | ||
| 257 | upa_writel(ctx->fbc, &ffb->fbc); /* Frame Buffer Control */ | ||
| 258 | upa_writel(ctx->rop, &ffb->rop); /* Raster Operation */ | ||
| 259 | upa_writel(ctx->cmp, &ffb->cmp); /* Compare Controls */ | ||
| 260 | upa_writel(ctx->matchab, &ffb->matchab); /* Buffer A/B Match Ops */ | ||
| 261 | upa_writel(ctx->matchc, &ffb->matchc); /* Buffer C Match Ops */ | ||
| 262 | upa_writel(ctx->magnab, &ffb->magnab); /* Buffer A/B Magnitude Ops */ | ||
| 263 | upa_writel(ctx->magnc, &ffb->magnc); /* Buffer C Magnitude Ops */ | ||
| 264 | upa_writel(ctx->pmask, &ffb->pmask); /* RGB Plane Mask */ | ||
| 265 | upa_writel(ctx->xpmask, &ffb->xpmask); /* X Plane Mask */ | ||
| 266 | upa_writel(ctx->ypmask, &ffb->ypmask); /* Y Plane Mask */ | ||
| 267 | upa_writel(ctx->zpmask, &ffb->zpmask); /* Z Plane Mask */ | ||
| 268 | |||
| 269 | /* Auxiliary Clips. */ | ||
| 270 | upa_writel(ctx->auxclip0min, &ffb->auxclip[0].min); | ||
| 271 | upa_writel(ctx->auxclip0max, &ffb->auxclip[0].max); | ||
| 272 | upa_writel(ctx->auxclip1min, &ffb->auxclip[1].min); | ||
| 273 | upa_writel(ctx->auxclip1max, &ffb->auxclip[1].max); | ||
| 274 | upa_writel(ctx->auxclip2min, &ffb->auxclip[2].min); | ||
| 275 | upa_writel(ctx->auxclip2max, &ffb->auxclip[2].max); | ||
| 276 | upa_writel(ctx->auxclip3min, &ffb->auxclip[3].min); | ||
| 277 | upa_writel(ctx->auxclip3max, &ffb->auxclip[3].max); | ||
| 278 | |||
| 279 | upa_writel(ctx->lpat, &ffb->lpat); /* Line Pattern */ | ||
| 280 | upa_writel(ctx->fontxy, &ffb->fontxy); /* XY Font Coordinate */ | ||
| 281 | upa_writel(ctx->fontw, &ffb->fontw); /* Font Width */ | ||
| 282 | upa_writel(ctx->fontinc, &ffb->fontinc); /* Font X/Y Increment */ | ||
| 283 | |||
| 284 | /* These registers/features only exist on FFB2 and later chips. */ | ||
| 285 | if (fpriv->ffb_type >= ffb2_prototype) { | ||
| 286 | upa_writel(ctx->dcss1, &ffb->dcss1); /* Depth Cue Scale Slope 1 */ | ||
| 287 | upa_writel(ctx->dcss2, &ffb->dcss2); /* Depth Cue Scale Slope 2 */ | ||
| 288 | upa_writel(ctx->dcss3, &ffb->dcss2); /* Depth Cue Scale Slope 3 */ | ||
| 289 | upa_writel(ctx->dcs2, &ffb->dcs2); /* Depth Cue Scale 2 */ | ||
| 290 | upa_writel(ctx->dcs3, &ffb->dcs3); /* Depth Cue Scale 3 */ | ||
| 291 | upa_writel(ctx->dcs4, &ffb->dcs4); /* Depth Cue Scale 4 */ | ||
| 292 | upa_writel(ctx->dcd2, &ffb->dcd2); /* Depth Cue Depth 2 */ | ||
| 293 | upa_writel(ctx->dcd3, &ffb->dcd3); /* Depth Cue Depth 3 */ | ||
| 294 | upa_writel(ctx->dcd4, &ffb->dcd4); /* Depth Cue Depth 4 */ | ||
| 295 | |||
| 296 | /* And stencil/stencilctl only exists on FFB2+ and later | ||
| 297 | * due to the introduction of 3DRAM-III. | ||
| 298 | */ | ||
| 299 | if (fpriv->ffb_type == ffb2_vertical_plus || | ||
| 300 | fpriv->ffb_type == ffb2_horizontal_plus) { | ||
| 301 | /* Unfortunately, there is a hardware bug on | ||
| 302 | * the FFB2+ chips which prevents a normal write | ||
| 303 | * to the stencil control register from working | ||
| 304 | * as it should. | ||
| 305 | * | ||
| 306 | * The state controlled by the FFB stencilctl register | ||
| 307 | * really gets transferred to the per-buffer instances | ||
| 308 | * of the stencilctl register in the 3DRAM chips. | ||
| 309 | * | ||
| 310 | * The bug is that FFB does not update buffer C correctly, | ||
| 311 | * so we have to do it by hand for them. | ||
| 312 | */ | ||
| 313 | |||
| 314 | /* This will update buffers A and B. */ | ||
| 315 | upa_writel(ctx->stencil, &ffb->stencil); | ||
| 316 | upa_writel(ctx->stencilctl, &ffb->stencilctl); | ||
| 317 | |||
| 318 | /* Force FFB to use buffer C 3dram regs. */ | ||
| 319 | upa_writel(0x80000000, &ffb->fbc); | ||
| 320 | upa_writel((ctx->stencilctl | 0x80000), | ||
| 321 | &ffb->rawstencilctl); | ||
| 322 | |||
| 323 | /* Now restore the correct FBC controls. */ | ||
| 324 | upa_writel(ctx->fbc, &ffb->fbc); | ||
| 325 | } | ||
| 326 | } | ||
| 327 | |||
| 328 | /* Restore the 32x32 area pattern. */ | ||
| 329 | for (i = 0; i < 32; i++) | ||
| 330 | upa_writel(ctx->area_pattern[i], &ffb->pattern[i]); | ||
| 331 | |||
| 332 | /* Finally, stash away the User Constol/Status Register. | ||
| 333 | * The only state we really preserve here is the picking | ||
| 334 | * control. | ||
| 335 | */ | ||
| 336 | upa_writel((ctx->ucsr & 0xf0000), &ffb->ucsr); | ||
| 337 | } | ||
| 338 | |||
| 339 | #define FFB_UCSR_FB_BUSY 0x01000000 | ||
| 340 | #define FFB_UCSR_RP_BUSY 0x02000000 | ||
| 341 | #define FFB_UCSR_ALL_BUSY (FFB_UCSR_RP_BUSY|FFB_UCSR_FB_BUSY) | ||
| 342 | |||
| 343 | static void FFBWait(ffb_fbcPtr ffb) | ||
| 344 | { | ||
| 345 | int limit = 100000; | ||
| 346 | |||
| 347 | do { | ||
| 348 | u32 regval = upa_readl(&ffb->ucsr); | ||
| 349 | |||
| 350 | if ((regval & FFB_UCSR_ALL_BUSY) == 0) | ||
| 351 | break; | ||
| 352 | } while (--limit); | ||
| 353 | } | ||
| 354 | |||
| 355 | int ffb_driver_context_switch(drm_device_t * dev, int old, int new) | ||
| 356 | { | ||
| 357 | ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private; | ||
| 358 | |||
| 359 | #ifdef DRM_DMA_HISTOGRAM | ||
| 360 | dev->ctx_start = get_cycles(); | ||
| 361 | #endif | ||
| 362 | |||
| 363 | DRM_DEBUG("Context switch from %d to %d\n", old, new); | ||
| 364 | |||
| 365 | if (new == dev->last_context || dev->last_context == 0) { | ||
| 366 | dev->last_context = new; | ||
| 367 | return 0; | ||
| 368 | } | ||
| 369 | |||
| 370 | FFBWait(fpriv->regs); | ||
| 371 | ffb_save_context(fpriv, old); | ||
| 372 | ffb_restore_context(fpriv, old, new); | ||
| 373 | FFBWait(fpriv->regs); | ||
| 374 | |||
| 375 | dev->last_context = new; | ||
| 376 | |||
| 377 | return 0; | ||
| 378 | } | ||
| 379 | |||
| 380 | int ffb_driver_resctx(struct inode *inode, struct file *filp, unsigned int cmd, | ||
| 381 | unsigned long arg) | ||
| 382 | { | ||
| 383 | drm_ctx_res_t res; | ||
| 384 | drm_ctx_t ctx; | ||
| 385 | int i; | ||
| 386 | |||
| 387 | DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); | ||
| 388 | if (copy_from_user(&res, (drm_ctx_res_t __user *) arg, sizeof(res))) | ||
| 389 | return -EFAULT; | ||
| 390 | if (res.count >= DRM_RESERVED_CONTEXTS) { | ||
| 391 | memset(&ctx, 0, sizeof(ctx)); | ||
| 392 | for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { | ||
| 393 | ctx.handle = i; | ||
| 394 | if (copy_to_user(&res.contexts[i], &i, sizeof(i))) | ||
| 395 | return -EFAULT; | ||
| 396 | } | ||
| 397 | } | ||
| 398 | res.count = DRM_RESERVED_CONTEXTS; | ||
| 399 | if (copy_to_user((drm_ctx_res_t __user *) arg, &res, sizeof(res))) | ||
| 400 | return -EFAULT; | ||
| 401 | return 0; | ||
| 402 | } | ||
| 403 | |||
| 404 | int ffb_driver_addctx(struct inode *inode, struct file *filp, unsigned int cmd, | ||
| 405 | unsigned long arg) | ||
| 406 | { | ||
| 407 | drm_file_t *priv = filp->private_data; | ||
| 408 | drm_device_t *dev = priv->dev; | ||
| 409 | drm_ctx_t ctx; | ||
| 410 | int idx; | ||
| 411 | |||
| 412 | if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) | ||
| 413 | return -EFAULT; | ||
| 414 | idx = DRM(alloc_queue) (dev, (ctx.flags & _DRM_CONTEXT_2DONLY)); | ||
| 415 | if (idx < 0) | ||
| 416 | return -ENFILE; | ||
| 417 | |||
| 418 | DRM_DEBUG("%d\n", ctx.handle); | ||
| 419 | ctx.handle = idx; | ||
| 420 | if (copy_to_user((drm_ctx_t __user *) arg, &ctx, sizeof(ctx))) | ||
| 421 | return -EFAULT; | ||
| 422 | return 0; | ||
| 423 | } | ||
| 424 | |||
| 425 | int ffb_driver_modctx(struct inode *inode, struct file *filp, unsigned int cmd, | ||
| 426 | unsigned long arg) | ||
| 427 | { | ||
| 428 | drm_file_t *priv = filp->private_data; | ||
| 429 | drm_device_t *dev = priv->dev; | ||
| 430 | ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private; | ||
| 431 | struct ffb_hw_context *hwctx; | ||
| 432 | drm_ctx_t ctx; | ||
| 433 | int idx; | ||
| 434 | |||
| 435 | if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) | ||
| 436 | return -EFAULT; | ||
| 437 | |||
| 438 | idx = ctx.handle; | ||
| 439 | if (idx <= 0 || idx >= FFB_MAX_CTXS) | ||
| 440 | return -EINVAL; | ||
| 441 | |||
| 442 | hwctx = fpriv->hw_state[idx - 1]; | ||
| 443 | if (hwctx == NULL) | ||
| 444 | return -EINVAL; | ||
| 445 | |||
| 446 | if ((ctx.flags & _DRM_CONTEXT_2DONLY) == 0) | ||
| 447 | hwctx->is_2d_only = 0; | ||
| 448 | else | ||
| 449 | hwctx->is_2d_only = 1; | ||
| 450 | |||
| 451 | return 0; | ||
| 452 | } | ||
| 453 | |||
| 454 | int ffb_driver_getctx(struct inode *inode, struct file *filp, unsigned int cmd, | ||
| 455 | unsigned long arg) | ||
| 456 | { | ||
| 457 | drm_file_t *priv = filp->private_data; | ||
| 458 | drm_device_t *dev = priv->dev; | ||
| 459 | ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private; | ||
| 460 | struct ffb_hw_context *hwctx; | ||
| 461 | drm_ctx_t ctx; | ||
| 462 | int idx; | ||
| 463 | |||
| 464 | if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) | ||
| 465 | return -EFAULT; | ||
| 466 | |||
| 467 | idx = ctx.handle; | ||
| 468 | if (idx <= 0 || idx >= FFB_MAX_CTXS) | ||
| 469 | return -EINVAL; | ||
| 470 | |||
| 471 | hwctx = fpriv->hw_state[idx - 1]; | ||
| 472 | if (hwctx == NULL) | ||
| 473 | return -EINVAL; | ||
| 474 | |||
| 475 | if (hwctx->is_2d_only != 0) | ||
| 476 | ctx.flags = _DRM_CONTEXT_2DONLY; | ||
| 477 | else | ||
| 478 | ctx.flags = 0; | ||
| 479 | |||
| 480 | if (copy_to_user((drm_ctx_t __user *) arg, &ctx, sizeof(ctx))) | ||
| 481 | return -EFAULT; | ||
| 482 | |||
| 483 | return 0; | ||
| 484 | } | ||
| 485 | |||
| 486 | int ffb_driver_switchctx(struct inode *inode, struct file *filp, | ||
| 487 | unsigned int cmd, unsigned long arg) | ||
| 488 | { | ||
| 489 | drm_file_t *priv = filp->private_data; | ||
| 490 | drm_device_t *dev = priv->dev; | ||
| 491 | drm_ctx_t ctx; | ||
| 492 | |||
| 493 | if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) | ||
| 494 | return -EFAULT; | ||
| 495 | DRM_DEBUG("%d\n", ctx.handle); | ||
| 496 | return ffb_driver_context_switch(dev, dev->last_context, ctx.handle); | ||
| 497 | } | ||
| 498 | |||
| 499 | int ffb_driver_newctx(struct inode *inode, struct file *filp, unsigned int cmd, | ||
| 500 | unsigned long arg) | ||
| 501 | { | ||
| 502 | drm_ctx_t ctx; | ||
| 503 | |||
| 504 | if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) | ||
| 505 | return -EFAULT; | ||
| 506 | DRM_DEBUG("%d\n", ctx.handle); | ||
| 507 | |||
| 508 | return 0; | ||
| 509 | } | ||
| 510 | |||
| 511 | int ffb_driver_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, | ||
| 512 | unsigned long arg) | ||
| 513 | { | ||
| 514 | drm_ctx_t ctx; | ||
| 515 | drm_file_t *priv = filp->private_data; | ||
| 516 | drm_device_t *dev = priv->dev; | ||
| 517 | ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private; | ||
| 518 | int idx; | ||
| 519 | |||
| 520 | if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx))) | ||
| 521 | return -EFAULT; | ||
| 522 | DRM_DEBUG("%d\n", ctx.handle); | ||
| 523 | |||
| 524 | idx = ctx.handle - 1; | ||
| 525 | if (idx < 0 || idx >= FFB_MAX_CTXS) | ||
| 526 | return -EINVAL; | ||
| 527 | |||
| 528 | kfree(fpriv->hw_state[idx]); | ||
| 529 | fpriv->hw_state[idx] = NULL; | ||
| 530 | return 0; | ||
| 531 | } | ||
| 532 | |||
| 533 | void ffb_set_context_ioctls(void) | ||
| 534 | { | ||
| 535 | DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)].func = ffb_driver_addctx; | ||
| 536 | DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)].func = ffb_driver_rmctx; | ||
| 537 | DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)].func = ffb_driver_modctx; | ||
| 538 | DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)].func = ffb_driver_getctx; | ||
| 539 | DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)].func = | ||
| 540 | ffb_driver_switchctx; | ||
| 541 | DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)].func = ffb_driver_newctx; | ||
| 542 | DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)].func = ffb_driver_resctx; | ||
| 543 | |||
| 544 | } | ||
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c deleted file mode 100644 index 9a19879e3b68..000000000000 --- a/drivers/char/drm/ffb_drv.c +++ /dev/null | |||
| @@ -1,355 +0,0 @@ | |||
| 1 | /* $Id: ffb_drv.c,v 1.16 2001/10/18 16:00:24 davem Exp $ | ||
| 2 | * ffb_drv.c: Creator/Creator3D direct rendering driver. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2000 David S. Miller (davem@redhat.com) | ||
| 5 | */ | ||
| 6 | |||
| 7 | #include "ffb.h" | ||
| 8 | #include "drmP.h" | ||
| 9 | |||
| 10 | #include "ffb_drv.h" | ||
| 11 | |||
| 12 | #include <linux/smp_lock.h> | ||
| 13 | #include <asm/shmparam.h> | ||
| 14 | #include <asm/oplib.h> | ||
| 15 | #include <asm/upa.h> | ||
| 16 | |||
| 17 | #define DRIVER_AUTHOR "David S. Miller" | ||
| 18 | |||
| 19 | #define DRIVER_NAME "ffb" | ||
| 20 | #define DRIVER_DESC "Creator/Creator3D" | ||
| 21 | #define DRIVER_DATE "20000517" | ||
| 22 | |||
| 23 | #define DRIVER_MAJOR 0 | ||
| 24 | #define DRIVER_MINOR 0 | ||
| 25 | #define DRIVER_PATCHLEVEL 1 | ||
| 26 | |||
| 27 | typedef struct _ffb_position_t { | ||
| 28 | int node; | ||
| 29 | int root; | ||
| 30 | } ffb_position_t; | ||
| 31 | |||
| 32 | static ffb_position_t *ffb_position; | ||
| 33 | |||
| 34 | static void get_ffb_type(ffb_dev_priv_t * ffb_priv, int instance) | ||
| 35 | { | ||
| 36 | volatile unsigned char *strap_bits; | ||
| 37 | unsigned char val; | ||
| 38 | |||
| 39 | strap_bits = (volatile unsigned char *) | ||
| 40 | (ffb_priv->card_phys_base + 0x00200000UL); | ||
| 41 | |||
| 42 | /* Don't ask, you have to read the value twice for whatever | ||
| 43 | * reason to get correct contents. | ||
| 44 | */ | ||
| 45 | val = upa_readb(strap_bits); | ||
| 46 | val = upa_readb(strap_bits); | ||
| 47 | switch (val & 0x78) { | ||
| 48 | case (0x0 << 5) | (0x0 << 3): | ||
| 49 | ffb_priv->ffb_type = ffb1_prototype; | ||
| 50 | printk("ffb%d: Detected FFB1 pre-FCS prototype\n", instance); | ||
| 51 | break; | ||
| 52 | case (0x0 << 5) | (0x1 << 3): | ||
| 53 | ffb_priv->ffb_type = ffb1_standard; | ||
| 54 | printk("ffb%d: Detected FFB1\n", instance); | ||
| 55 | break; | ||
| 56 | case (0x0 << 5) | (0x3 << 3): | ||
| 57 | ffb_priv->ffb_type = ffb1_speedsort; | ||
| 58 | printk("ffb%d: Detected FFB1-SpeedSort\n", instance); | ||
| 59 | break; | ||
| 60 | case (0x1 << 5) | (0x0 << 3): | ||
| 61 | ffb_priv->ffb_type = ffb2_prototype; | ||
| 62 | printk("ffb%d: Detected FFB2/vertical pre-FCS prototype\n", | ||
| 63 | instance); | ||
| 64 | break; | ||
| 65 | case (0x1 << 5) | (0x1 << 3): | ||
| 66 | ffb_priv->ffb_type = ffb2_vertical; | ||
| 67 | printk("ffb%d: Detected FFB2/vertical\n", instance); | ||
| 68 | break; | ||
| 69 | case (0x1 << 5) | (0x2 << 3): | ||
| 70 | ffb_priv->ffb_type = ffb2_vertical_plus; | ||
| 71 | printk("ffb%d: Detected FFB2+/vertical\n", instance); | ||
| 72 | break; | ||
| 73 | case (0x2 << 5) | (0x0 << 3): | ||
| 74 | ffb_priv->ffb_type = ffb2_horizontal; | ||
| 75 | printk("ffb%d: Detected FFB2/horizontal\n", instance); | ||
| 76 | break; | ||
| 77 | case (0x2 << 5) | (0x2 << 3): | ||
| 78 | ffb_priv->ffb_type = ffb2_horizontal; | ||
| 79 | printk("ffb%d: Detected FFB2+/horizontal\n", instance); | ||
| 80 | break; | ||
| 81 | default: | ||
| 82 | ffb_priv->ffb_type = ffb2_vertical; | ||
| 83 | printk("ffb%d: Unknown boardID[%08x], assuming FFB2\n", | ||
| 84 | instance, val); | ||
| 85 | break; | ||
| 86 | }; | ||
| 87 | } | ||
| 88 | |||
| 89 | static void ffb_apply_upa_parent_ranges(int parent, | ||
| 90 | struct linux_prom64_registers *regs) | ||
| 91 | { | ||
| 92 | struct linux_prom64_ranges ranges[PROMREG_MAX]; | ||
| 93 | char name[128]; | ||
| 94 | int len, i; | ||
| 95 | |||
| 96 | prom_getproperty(parent, "name", name, sizeof(name)); | ||
| 97 | if (strcmp(name, "upa") != 0) | ||
| 98 | return; | ||
| 99 | |||
| 100 | len = | ||
| 101 | prom_getproperty(parent, "ranges", (void *)ranges, sizeof(ranges)); | ||
| 102 | if (len <= 0) | ||
| 103 | return; | ||
| 104 | |||
| 105 | len /= sizeof(struct linux_prom64_ranges); | ||
| 106 | for (i = 0; i < len; i++) { | ||
| 107 | struct linux_prom64_ranges *rng = &ranges[i]; | ||
| 108 | u64 phys_addr = regs->phys_addr; | ||
| 109 | |||
| 110 | if (phys_addr >= rng->ot_child_base && | ||
| 111 | phys_addr < (rng->ot_child_base + rng->or_size)) { | ||
| 112 | regs->phys_addr -= rng->ot_child_base; | ||
| 113 | regs->phys_addr += rng->ot_parent_base; | ||
| 114 | return; | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 118 | return; | ||
| 119 | } | ||
| 120 | |||
| 121 | static int ffb_init_one(drm_device_t * dev, int prom_node, int parent_node, | ||
| 122 | int instance) | ||
| 123 | { | ||
| 124 | struct linux_prom64_registers regs[2 * PROMREG_MAX]; | ||
| 125 | ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private; | ||
| 126 | int i; | ||
| 127 | |||
| 128 | ffb_priv->prom_node = prom_node; | ||
| 129 | if (prom_getproperty(ffb_priv->prom_node, "reg", | ||
| 130 | (void *)regs, sizeof(regs)) <= 0) { | ||
| 131 | return -EINVAL; | ||
| 132 | } | ||
| 133 | ffb_apply_upa_parent_ranges(parent_node, ®s[0]); | ||
| 134 | ffb_priv->card_phys_base = regs[0].phys_addr; | ||
| 135 | ffb_priv->regs = (ffb_fbcPtr) | ||
| 136 | (regs[0].phys_addr + 0x00600000UL); | ||
| 137 | get_ffb_type(ffb_priv, instance); | ||
| 138 | for (i = 0; i < FFB_MAX_CTXS; i++) | ||
| 139 | ffb_priv->hw_state[i] = NULL; | ||
| 140 | |||
| 141 | return 0; | ||
| 142 | } | ||
| 143 | |||
| 144 | static drm_map_t *ffb_find_map(struct file *filp, unsigned long off) | ||
| 145 | { | ||
| 146 | drm_file_t *priv = filp->private_data; | ||
| 147 | drm_device_t *dev; | ||
| 148 | drm_map_list_t *r_list; | ||
| 149 | struct list_head *list; | ||
| 150 | drm_map_t *map; | ||
| 151 | |||
| 152 | if (!priv || (dev = priv->dev) == NULL) | ||
| 153 | return NULL; | ||
| 154 | |||
| 155 | list_for_each(list, &dev->maplist->head) { | ||
| 156 | r_list = (drm_map_list_t *) list; | ||
| 157 | map = r_list->map; | ||
| 158 | if (!map) | ||
| 159 | continue; | ||
| 160 | if (r_list->user_token == off) | ||
| 161 | return map; | ||
| 162 | } | ||
| 163 | |||
| 164 | return NULL; | ||
| 165 | } | ||
| 166 | |||
| 167 | unsigned long ffb_get_unmapped_area(struct file *filp, | ||
| 168 | unsigned long hint, | ||
| 169 | unsigned long len, | ||
| 170 | unsigned long pgoff, unsigned long flags) | ||
| 171 | { | ||
| 172 | drm_map_t *map = ffb_find_map(filp, pgoff << PAGE_SHIFT); | ||
| 173 | unsigned long addr = -ENOMEM; | ||
| 174 | |||
| 175 | if (!map) | ||
| 176 | return get_unmapped_area(NULL, hint, len, pgoff, flags); | ||
| 177 | |||
| 178 | if (map->type == _DRM_FRAME_BUFFER || map->type == _DRM_REGISTERS) { | ||
| 179 | #ifdef HAVE_ARCH_FB_UNMAPPED_AREA | ||
| 180 | addr = get_fb_unmapped_area(filp, hint, len, pgoff, flags); | ||
| 181 | #else | ||
| 182 | addr = get_unmapped_area(NULL, hint, len, pgoff, flags); | ||
| 183 | #endif | ||
| 184 | } else if (map->type == _DRM_SHM && SHMLBA > PAGE_SIZE) { | ||
| 185 | unsigned long slack = SHMLBA - PAGE_SIZE; | ||
| 186 | |||
| 187 | addr = get_unmapped_area(NULL, hint, len + slack, pgoff, flags); | ||
| 188 | if (!(addr & ~PAGE_MASK)) { | ||
| 189 | unsigned long kvirt = (unsigned long)map->handle; | ||
| 190 | |||
| 191 | if ((kvirt & (SHMLBA - 1)) != (addr & (SHMLBA - 1))) { | ||
| 192 | unsigned long koff, aoff; | ||
| 193 | |||
| 194 | koff = kvirt & (SHMLBA - 1); | ||
| 195 | aoff = addr & (SHMLBA - 1); | ||
| 196 | if (koff < aoff) | ||
| 197 | koff += SHMLBA; | ||
| 198 | |||
| 199 | addr += (koff - aoff); | ||
| 200 | } | ||
| 201 | } | ||
| 202 | } else { | ||
| 203 | addr = get_unmapped_area(NULL, hint, len, pgoff, flags); | ||
| 204 | } | ||
| 205 | |||
| 206 | return addr; | ||
| 207 | } | ||
| 208 | |||
| 209 | static int ffb_presetup(drm_device_t * dev) | ||
| 210 | { | ||
| 211 | ffb_dev_priv_t *ffb_priv; | ||
| 212 | int ret = 0; | ||
| 213 | int i = 0; | ||
| 214 | |||
| 215 | /* Check for the case where no device was found. */ | ||
| 216 | if (ffb_position == NULL) | ||
| 217 | return -ENODEV; | ||
| 218 | |||
| 219 | /* code used to use numdevs no numdevs anymore */ | ||
| 220 | ffb_priv = kmalloc(sizeof(ffb_dev_priv_t), GFP_KERNEL); | ||
| 221 | if (!ffb_priv) | ||
| 222 | return -ENOMEM; | ||
| 223 | memset(ffb_priv, 0, sizeof(*ffb_priv)); | ||
| 224 | dev->dev_private = ffb_priv; | ||
| 225 | |||
| 226 | ret = ffb_init_one(dev, ffb_position[i].node, ffb_position[i].root, i); | ||
| 227 | return ret; | ||
| 228 | } | ||
| 229 | |||
| 230 | static void ffb_driver_release(drm_device_t * dev, struct file *filp) | ||
| 231 | { | ||
| 232 | ffb_dev_priv_t *fpriv = (ffb_dev_priv_t *) dev->dev_private; | ||
| 233 | int context = _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock); | ||
| 234 | int idx; | ||
| 235 | |||
| 236 | idx = context - 1; | ||
| 237 | if (fpriv && | ||
| 238 | context != DRM_KERNEL_CONTEXT && fpriv->hw_state[idx] != NULL) { | ||
| 239 | kfree(fpriv->hw_state[idx]); | ||
| 240 | fpriv->hw_state[idx] = NULL; | ||
| 241 | } | ||
| 242 | } | ||
| 243 | |||
| 244 | static void ffb_driver_pretakedown(drm_device_t * dev) | ||
| 245 | { | ||
| 246 | kfree(dev->dev_private); | ||
| 247 | } | ||
| 248 | |||
| 249 | static int ffb_driver_postcleanup(drm_device_t * dev) | ||
| 250 | { | ||
| 251 | kfree(ffb_position); | ||
| 252 | return 0; | ||
| 253 | } | ||
| 254 | |||
| 255 | static void ffb_driver_kernel_context_switch_unlock(struct drm_device *dev, | ||
| 256 | drm_lock_t * lock) | ||
| 257 | { | ||
| 258 | dev->lock.filp = 0; | ||
| 259 | { | ||
| 260 | __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock; | ||
| 261 | unsigned int old, new, prev, ctx; | ||
| 262 | |||
| 263 | ctx = lock->context; | ||
| 264 | do { | ||
| 265 | old = *plock; | ||
| 266 | new = ctx; | ||
| 267 | prev = cmpxchg(plock, old, new); | ||
| 268 | } while (prev != old); | ||
| 269 | } | ||
| 270 | wake_up_interruptible(&dev->lock.lock_queue); | ||
| 271 | } | ||
| 272 | |||
| 273 | static unsigned long ffb_driver_get_map_ofs(drm_map_t * map) | ||
| 274 | { | ||
| 275 | return (map->offset & 0xffffffff); | ||
| 276 | } | ||
| 277 | |||
| 278 | static unsigned long ffb_driver_get_reg_ofs(drm_device_t * dev) | ||
| 279 | { | ||
| 280 | ffb_dev_priv_t *ffb_priv = (ffb_dev_priv_t *) dev->dev_private; | ||
| 281 | |||
| 282 | if (ffb_priv) | ||
| 283 | return ffb_priv->card_phys_base; | ||
| 284 | |||
| 285 | return 0; | ||
| 286 | } | ||
| 287 | |||
| 288 | static int postinit(struct drm_device *dev, unsigned long flags) | ||
| 289 | { | ||
| 290 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", | ||
| 291 | DRIVER_NAME, | ||
| 292 | DRIVER_MAJOR, | ||
| 293 | DRIVER_MINOR, DRIVER_PATCHLEVEL, DRIVER_DATE, dev->minor); | ||
| 294 | return 0; | ||
| 295 | } | ||
| 296 | |||
| 297 | static int version(drm_version_t * version) | ||
| 298 | { | ||
| 299 | int len; | ||
| 300 | |||
| 301 | version->version_major = DRIVER_MAJOR; | ||
| 302 | version->version_minor = DRIVER_MINOR; | ||
| 303 | version->version_patchlevel = DRIVER_PATCHLEVEL; | ||
| 304 | DRM_COPY(version->name, DRIVER_NAME); | ||
| 305 | DRM_COPY(version->date, DRIVER_DATE); | ||
| 306 | DRM_COPY(version->desc, DRIVER_DESC); | ||
| 307 | return 0; | ||
| 308 | } | ||
| 309 | |||
| 310 | static drm_ioctl_desc_t ioctls[] = { | ||
| 311 | |||
| 312 | }; | ||
| 313 | |||
| 314 | static struct drm_driver driver = { | ||
| 315 | .driver_features = 0, | ||
| 316 | .dev_priv_size = sizeof(u32), | ||
| 317 | .release = ffb_driver_release, | ||
| 318 | .presetup = ffb_presetup, | ||
| 319 | .pretakedown = ffb_driver_pretakedown, | ||
| 320 | .postcleanup = ffb_driver_postcleanup, | ||
| 321 | .kernel_context_switch = ffb_driver_context_switch, | ||
| 322 | .kernel_context_switch_unlock = ffb_driver_kernel_context_switch_unlock, | ||
| 323 | .get_map_ofs = ffb_driver_get_map_ofs, | ||
| 324 | .get_reg_ofs = ffb_driver_get_reg_ofs, | ||
| 325 | .postinit = postinit, | ||
| 326 | .version = version, | ||
| 327 | .ioctls = ioctls, | ||
| 328 | .num_ioctls = DRM_ARRAY_SIZE(ioctls), | ||
| 329 | .fops = { | ||
| 330 | .owner = THIS_MODULE, | ||
| 331 | .open = drm_open, | ||
| 332 | .release = drm_release, | ||
| 333 | .ioctl = drm_ioctl, | ||
| 334 | .mmap = drm_mmap, | ||
| 335 | .poll = drm_poll, | ||
| 336 | .fasync = drm_fasync, | ||
| 337 | } | ||
| 338 | , | ||
| 339 | }; | ||
| 340 | |||
| 341 | static int __init ffb_init(void) | ||
| 342 | { | ||
| 343 | return -ENODEV; | ||
| 344 | } | ||
| 345 | |||
| 346 | static void __exit ffb_exit(void) | ||
| 347 | { | ||
| 348 | } | ||
| 349 | |||
| 350 | module_init(ffb_init); | ||
| 351 | module_exit(ffb_exit); | ||
| 352 | |||
| 353 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
| 354 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
| 355 | MODULE_LICENSE("GPL and additional rights"); | ||
diff --git a/drivers/char/drm/ffb_drv.h b/drivers/char/drm/ffb_drv.h deleted file mode 100644 index 582afa6dd2b4..000000000000 --- a/drivers/char/drm/ffb_drv.h +++ /dev/null | |||
| @@ -1,379 +0,0 @@ | |||
| 1 | /* $Id: ffb_drv.h,v 1.1 2000/06/01 04:24:39 davem Exp $ | ||
| 2 | * ffb_drv.h: Creator/Creator3D direct rendering driver. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2000 David S. Miller (davem@redhat.com) | ||
| 5 | */ | ||
| 6 | |||
| 7 | /* Auxilliary clips. */ | ||
| 8 | typedef struct { | ||
| 9 | volatile unsigned int min; | ||
| 10 | volatile unsigned int max; | ||
| 11 | } ffb_auxclip, *ffb_auxclipPtr; | ||
| 12 | |||
| 13 | /* FFB register set. */ | ||
| 14 | typedef struct _ffb_fbc { | ||
| 15 | /* Next vertex registers, on the right we list which drawops | ||
| 16 | * use said register and the logical name the register has in | ||
| 17 | * that context. | ||
| 18 | *//* DESCRIPTION DRAWOP(NAME) */ | ||
| 19 | /*0x00*/ unsigned int pad1[3]; | ||
| 20 | /* Reserved */ | ||
| 21 | /*0x0c*/ volatile unsigned int alpha; | ||
| 22 | /* ALPHA Transparency */ | ||
| 23 | /*0x10*/ volatile unsigned int red; | ||
| 24 | /* RED */ | ||
| 25 | /*0x14*/ volatile unsigned int green; | ||
| 26 | /* GREEN */ | ||
| 27 | /*0x18*/ volatile unsigned int blue; | ||
| 28 | /* BLUE */ | ||
| 29 | /*0x1c*/ volatile unsigned int z; | ||
| 30 | /* DEPTH */ | ||
| 31 | /*0x20*/ volatile unsigned int y; | ||
| 32 | /* Y triangle(DOYF) */ | ||
| 33 | /* aadot(DYF) */ | ||
| 34 | /* ddline(DYF) */ | ||
| 35 | /* aaline(DYF) */ | ||
| 36 | /*0x24*/ volatile unsigned int x; | ||
| 37 | /* X triangle(DOXF) */ | ||
| 38 | /* aadot(DXF) */ | ||
| 39 | /* ddline(DXF) */ | ||
| 40 | /* aaline(DXF) */ | ||
| 41 | /*0x28*/ unsigned int pad2[2]; | ||
| 42 | /* Reserved */ | ||
| 43 | /*0x30*/ volatile unsigned int ryf; | ||
| 44 | /* Y (alias to DOYF) ddline(RYF) */ | ||
| 45 | /* aaline(RYF) */ | ||
| 46 | /* triangle(RYF) */ | ||
| 47 | /*0x34*/ volatile unsigned int rxf; | ||
| 48 | /* X ddline(RXF) */ | ||
| 49 | /* aaline(RXF) */ | ||
| 50 | /* triangle(RXF) */ | ||
| 51 | /*0x38*/ unsigned int pad3[2]; | ||
| 52 | /* Reserved */ | ||
| 53 | /*0x40*/ volatile unsigned int dmyf; | ||
| 54 | /* Y (alias to DOYF) triangle(DMYF) */ | ||
| 55 | /*0x44*/ volatile unsigned int dmxf; | ||
| 56 | /* X triangle(DMXF) */ | ||
| 57 | /*0x48*/ unsigned int pad4[2]; | ||
| 58 | /* Reserved */ | ||
| 59 | /*0x50*/ volatile unsigned int ebyi; | ||
| 60 | /* Y (alias to RYI) polygon(EBYI) */ | ||
| 61 | /*0x54*/ volatile unsigned int ebxi; | ||
| 62 | /* X polygon(EBXI) */ | ||
| 63 | /*0x58*/ unsigned int pad5[2]; | ||
| 64 | /* Reserved */ | ||
| 65 | /*0x60*/ volatile unsigned int by; | ||
| 66 | /* Y brline(RYI) */ | ||
| 67 | /* fastfill(OP) */ | ||
| 68 | /* polygon(YI) */ | ||
| 69 | /* rectangle(YI) */ | ||
| 70 | /* bcopy(SRCY) */ | ||
| 71 | /* vscroll(SRCY) */ | ||
| 72 | /*0x64*/ volatile unsigned int bx; | ||
| 73 | /* X brline(RXI) */ | ||
| 74 | /* polygon(XI) */ | ||
| 75 | /* rectangle(XI) */ | ||
| 76 | /* bcopy(SRCX) */ | ||
| 77 | /* vscroll(SRCX) */ | ||
| 78 | /* fastfill(GO) */ | ||
| 79 | /*0x68*/ volatile unsigned int dy; | ||
| 80 | /* destination Y fastfill(DSTY) */ | ||
| 81 | /* bcopy(DSRY) */ | ||
| 82 | /* vscroll(DSRY) */ | ||
| 83 | /*0x6c*/ volatile unsigned int dx; | ||
| 84 | /* destination X fastfill(DSTX) */ | ||
| 85 | /* bcopy(DSTX) */ | ||
| 86 | /* vscroll(DSTX) */ | ||
| 87 | /*0x70*/ volatile unsigned int bh; | ||
| 88 | /* Y (alias to RYI) brline(DYI) */ | ||
| 89 | /* dot(DYI) */ | ||
| 90 | /* polygon(ETYI) */ | ||
| 91 | /* Height fastfill(H) */ | ||
| 92 | /* bcopy(H) */ | ||
| 93 | /* vscroll(H) */ | ||
| 94 | /* Y count fastfill(NY) */ | ||
| 95 | /*0x74*/ volatile unsigned int bw; | ||
| 96 | /* X dot(DXI) */ | ||
| 97 | /* brline(DXI) */ | ||
| 98 | /* polygon(ETXI) */ | ||
| 99 | /* fastfill(W) */ | ||
| 100 | /* bcopy(W) */ | ||
| 101 | /* vscroll(W) */ | ||
| 102 | /* fastfill(NX) */ | ||
| 103 | /*0x78*/ unsigned int pad6[2]; | ||
| 104 | /* Reserved */ | ||
| 105 | /*0x80*/ unsigned int pad7[32]; | ||
| 106 | /* Reserved */ | ||
| 107 | |||
| 108 | /* Setup Unit's vertex state register */ | ||
| 109 | /*100*/ volatile unsigned int suvtx; | ||
| 110 | /*104*/ unsigned int pad8[63]; | ||
| 111 | /* Reserved */ | ||
| 112 | |||
| 113 | /* Frame Buffer Control Registers */ | ||
| 114 | /*200*/ volatile unsigned int ppc; | ||
| 115 | /* Pixel Processor Control */ | ||
| 116 | /*204*/ volatile unsigned int wid; | ||
| 117 | /* Current WID */ | ||
| 118 | /*208*/ volatile unsigned int fg; | ||
| 119 | /* FG data */ | ||
| 120 | /*20c*/ volatile unsigned int bg; | ||
| 121 | /* BG data */ | ||
| 122 | /*210*/ volatile unsigned int consty; | ||
| 123 | /* Constant Y */ | ||
| 124 | /*214*/ volatile unsigned int constz; | ||
| 125 | /* Constant Z */ | ||
| 126 | /*218*/ volatile unsigned int xclip; | ||
| 127 | /* X Clip */ | ||
| 128 | /*21c*/ volatile unsigned int dcss; | ||
| 129 | /* Depth Cue Scale Slope */ | ||
| 130 | /*220*/ volatile unsigned int vclipmin; | ||
| 131 | /* Viewclip XY Min Bounds */ | ||
| 132 | /*224*/ volatile unsigned int vclipmax; | ||
| 133 | /* Viewclip XY Max Bounds */ | ||
| 134 | /*228*/ volatile unsigned int vclipzmin; | ||
| 135 | /* Viewclip Z Min Bounds */ | ||
| 136 | /*22c*/ volatile unsigned int vclipzmax; | ||
| 137 | /* Viewclip Z Max Bounds */ | ||
| 138 | /*230*/ volatile unsigned int dcsf; | ||
| 139 | /* Depth Cue Scale Front Bound */ | ||
| 140 | /*234*/ volatile unsigned int dcsb; | ||
| 141 | /* Depth Cue Scale Back Bound */ | ||
| 142 | /*238*/ volatile unsigned int dczf; | ||
| 143 | /* Depth Cue Z Front */ | ||
| 144 | /*23c*/ volatile unsigned int dczb; | ||
| 145 | /* Depth Cue Z Back */ | ||
| 146 | /*240*/ unsigned int pad9; | ||
| 147 | /* Reserved */ | ||
| 148 | /*244*/ volatile unsigned int blendc; | ||
| 149 | /* Alpha Blend Control */ | ||
| 150 | /*248*/ volatile unsigned int blendc1; | ||
| 151 | /* Alpha Blend Color 1 */ | ||
| 152 | /*24c*/ volatile unsigned int blendc2; | ||
| 153 | /* Alpha Blend Color 2 */ | ||
| 154 | /*250*/ volatile unsigned int fbramitc; | ||
| 155 | /* FB RAM Interleave Test Control */ | ||
| 156 | /*254*/ volatile unsigned int fbc; | ||
| 157 | /* Frame Buffer Control */ | ||
| 158 | /*258*/ volatile unsigned int rop; | ||
| 159 | /* Raster OPeration */ | ||
| 160 | /*25c*/ volatile unsigned int cmp; | ||
| 161 | /* Frame Buffer Compare */ | ||
| 162 | /*260*/ volatile unsigned int matchab; | ||
| 163 | /* Buffer AB Match Mask */ | ||
| 164 | /*264*/ volatile unsigned int matchc; | ||
| 165 | /* Buffer C(YZ) Match Mask */ | ||
| 166 | /*268*/ volatile unsigned int magnab; | ||
| 167 | /* Buffer AB Magnitude Mask */ | ||
| 168 | /*26c*/ volatile unsigned int magnc; | ||
| 169 | /* Buffer C(YZ) Magnitude Mask */ | ||
| 170 | /*270*/ volatile unsigned int fbcfg0; | ||
| 171 | /* Frame Buffer Config 0 */ | ||
| 172 | /*274*/ volatile unsigned int fbcfg1; | ||
| 173 | /* Frame Buffer Config 1 */ | ||
| 174 | /*278*/ volatile unsigned int fbcfg2; | ||
| 175 | /* Frame Buffer Config 2 */ | ||
| 176 | /*27c*/ volatile unsigned int fbcfg3; | ||
| 177 | /* Frame Buffer Config 3 */ | ||
| 178 | /*280*/ volatile unsigned int ppcfg; | ||
| 179 | /* Pixel Processor Config */ | ||
| 180 | /*284*/ volatile unsigned int pick; | ||
| 181 | /* Picking Control */ | ||
| 182 | /*288*/ volatile unsigned int fillmode; | ||
| 183 | /* FillMode */ | ||
| 184 | /*28c*/ volatile unsigned int fbramwac; | ||
| 185 | /* FB RAM Write Address Control */ | ||
| 186 | /*290*/ volatile unsigned int pmask; | ||
| 187 | /* RGB PlaneMask */ | ||
| 188 | /*294*/ volatile unsigned int xpmask; | ||
| 189 | /* X PlaneMask */ | ||
| 190 | /*298*/ volatile unsigned int ypmask; | ||
| 191 | /* Y PlaneMask */ | ||
| 192 | /*29c*/ volatile unsigned int zpmask; | ||
| 193 | /* Z PlaneMask */ | ||
| 194 | /*2a0*/ ffb_auxclip auxclip[4]; | ||
| 195 | /* Auxilliary Viewport Clip */ | ||
| 196 | |||
| 197 | /* New 3dRAM III support regs */ | ||
| 198 | /*2c0*/ volatile unsigned int rawblend2; | ||
| 199 | /*2c4*/ volatile unsigned int rawpreblend; | ||
| 200 | /*2c8*/ volatile unsigned int rawstencil; | ||
| 201 | /*2cc*/ volatile unsigned int rawstencilctl; | ||
| 202 | /*2d0*/ volatile unsigned int threedram1; | ||
| 203 | /*2d4*/ volatile unsigned int threedram2; | ||
| 204 | /*2d8*/ volatile unsigned int passin; | ||
| 205 | /*2dc*/ volatile unsigned int rawclrdepth; | ||
| 206 | /*2e0*/ volatile unsigned int rawpmask; | ||
| 207 | /*2e4*/ volatile unsigned int rawcsrc; | ||
| 208 | /*2e8*/ volatile unsigned int rawmatch; | ||
| 209 | /*2ec*/ volatile unsigned int rawmagn; | ||
| 210 | /*2f0*/ volatile unsigned int rawropblend; | ||
| 211 | /*2f4*/ volatile unsigned int rawcmp; | ||
| 212 | /*2f8*/ volatile unsigned int rawwac; | ||
| 213 | /*2fc*/ volatile unsigned int fbramid; | ||
| 214 | |||
| 215 | /*300*/ volatile unsigned int drawop; | ||
| 216 | /* Draw OPeration */ | ||
| 217 | /*304*/ unsigned int pad10[2]; | ||
| 218 | /* Reserved */ | ||
| 219 | /*30c*/ volatile unsigned int lpat; | ||
| 220 | /* Line Pattern control */ | ||
| 221 | /*310*/ unsigned int pad11; | ||
| 222 | /* Reserved */ | ||
| 223 | /*314*/ volatile unsigned int fontxy; | ||
| 224 | /* XY Font coordinate */ | ||
| 225 | /*318*/ volatile unsigned int fontw; | ||
| 226 | /* Font Width */ | ||
| 227 | /*31c*/ volatile unsigned int fontinc; | ||
| 228 | /* Font Increment */ | ||
| 229 | /*320*/ volatile unsigned int font; | ||
| 230 | /* Font bits */ | ||
| 231 | /*324*/ unsigned int pad12[3]; | ||
| 232 | /* Reserved */ | ||
| 233 | /*330*/ volatile unsigned int blend2; | ||
| 234 | /*334*/ volatile unsigned int preblend; | ||
| 235 | /*338*/ volatile unsigned int stencil; | ||
| 236 | /*33c*/ volatile unsigned int stencilctl; | ||
| 237 | |||
| 238 | /*340*/ unsigned int pad13[4]; | ||
| 239 | /* Reserved */ | ||
| 240 | /*350*/ volatile unsigned int dcss1; | ||
| 241 | /* Depth Cue Scale Slope 1 */ | ||
| 242 | /*354*/ volatile unsigned int dcss2; | ||
| 243 | /* Depth Cue Scale Slope 2 */ | ||
| 244 | /*358*/ volatile unsigned int dcss3; | ||
| 245 | /* Depth Cue Scale Slope 3 */ | ||
| 246 | /*35c*/ volatile unsigned int widpmask; | ||
| 247 | /*360*/ volatile unsigned int dcs2; | ||
| 248 | /*364*/ volatile unsigned int dcs3; | ||
| 249 | /*368*/ volatile unsigned int dcs4; | ||
| 250 | /*36c*/ unsigned int pad14; | ||
| 251 | /* Reserved */ | ||
| 252 | /*370*/ volatile unsigned int dcd2; | ||
| 253 | /*374*/ volatile unsigned int dcd3; | ||
| 254 | /*378*/ volatile unsigned int dcd4; | ||
| 255 | /*37c*/ unsigned int pad15; | ||
| 256 | /* Reserved */ | ||
| 257 | /*380*/ volatile unsigned int pattern[32]; | ||
| 258 | /* area Pattern */ | ||
| 259 | /*400*/ unsigned int pad16[8]; | ||
| 260 | /* Reserved */ | ||
| 261 | /*420*/ volatile unsigned int reset; | ||
| 262 | /* chip RESET */ | ||
| 263 | /*424*/ unsigned int pad17[247]; | ||
| 264 | /* Reserved */ | ||
| 265 | /*800*/ volatile unsigned int devid; | ||
| 266 | /* Device ID */ | ||
| 267 | /*804*/ unsigned int pad18[63]; | ||
| 268 | /* Reserved */ | ||
| 269 | /*900*/ volatile unsigned int ucsr; | ||
| 270 | /* User Control & Status Register */ | ||
| 271 | /*904*/ unsigned int pad19[31]; | ||
| 272 | /* Reserved */ | ||
| 273 | /*980*/ volatile unsigned int mer; | ||
| 274 | /* Mode Enable Register */ | ||
| 275 | /*984*/ unsigned int pad20[1439]; | ||
| 276 | /* Reserved */ | ||
| 277 | } ffb_fbc, *ffb_fbcPtr; | ||
| 278 | |||
| 279 | struct ffb_hw_context { | ||
| 280 | int is_2d_only; | ||
| 281 | |||
| 282 | unsigned int ppc; | ||
| 283 | unsigned int wid; | ||
| 284 | unsigned int fg; | ||
| 285 | unsigned int bg; | ||
| 286 | unsigned int consty; | ||
| 287 | unsigned int constz; | ||
| 288 | unsigned int xclip; | ||
| 289 | unsigned int dcss; | ||
| 290 | unsigned int vclipmin; | ||
| 291 | unsigned int vclipmax; | ||
| 292 | unsigned int vclipzmin; | ||
| 293 | unsigned int vclipzmax; | ||
| 294 | unsigned int dcsf; | ||
| 295 | unsigned int dcsb; | ||
| 296 | unsigned int dczf; | ||
| 297 | unsigned int dczb; | ||
| 298 | unsigned int blendc; | ||
| 299 | unsigned int blendc1; | ||
| 300 | unsigned int blendc2; | ||
| 301 | unsigned int fbc; | ||
| 302 | unsigned int rop; | ||
| 303 | unsigned int cmp; | ||
| 304 | unsigned int matchab; | ||
| 305 | unsigned int matchc; | ||
| 306 | unsigned int magnab; | ||
| 307 | unsigned int magnc; | ||
| 308 | unsigned int pmask; | ||
| 309 | unsigned int xpmask; | ||
| 310 | unsigned int ypmask; | ||
| 311 | unsigned int zpmask; | ||
| 312 | unsigned int auxclip0min; | ||
| 313 | unsigned int auxclip0max; | ||
| 314 | unsigned int auxclip1min; | ||
| 315 | unsigned int auxclip1max; | ||
| 316 | unsigned int auxclip2min; | ||
| 317 | unsigned int auxclip2max; | ||
| 318 | unsigned int auxclip3min; | ||
| 319 | unsigned int auxclip3max; | ||
| 320 | unsigned int drawop; | ||
| 321 | unsigned int lpat; | ||
| 322 | unsigned int fontxy; | ||
| 323 | unsigned int fontw; | ||
| 324 | unsigned int fontinc; | ||
| 325 | unsigned int area_pattern[32]; | ||
| 326 | unsigned int ucsr; | ||
| 327 | unsigned int stencil; | ||
| 328 | unsigned int stencilctl; | ||
| 329 | unsigned int dcss1; | ||
| 330 | unsigned int dcss2; | ||
| 331 | unsigned int dcss3; | ||
| 332 | unsigned int dcs2; | ||
| 333 | unsigned int dcs3; | ||
| 334 | unsigned int dcs4; | ||
| 335 | unsigned int dcd2; | ||
| 336 | unsigned int dcd3; | ||
| 337 | unsigned int dcd4; | ||
| 338 | unsigned int mer; | ||
| 339 | }; | ||
| 340 | |||
| 341 | #define FFB_MAX_CTXS 32 | ||
| 342 | |||
| 343 | enum ffb_chip_type { | ||
| 344 | ffb1_prototype = 0, /* Early pre-FCS FFB */ | ||
| 345 | ffb1_standard, /* First FCS FFB, 100Mhz UPA, 66MHz gclk */ | ||
| 346 | ffb1_speedsort, /* Second FCS FFB, 100Mhz UPA, 75MHz gclk */ | ||
| 347 | ffb2_prototype, /* Early pre-FCS vertical FFB2 */ | ||
| 348 | ffb2_vertical, /* First FCS FFB2/vertical, 100Mhz UPA, 100MHZ gclk, | ||
| 349 | 75(SingleBuffer)/83(DoubleBuffer) MHz fclk */ | ||
| 350 | ffb2_vertical_plus, /* Second FCS FFB2/vertical, same timings */ | ||
| 351 | ffb2_horizontal, /* First FCS FFB2/horizontal, same timings as FFB2/vert */ | ||
| 352 | ffb2_horizontal_plus, /* Second FCS FFB2/horizontal, same timings */ | ||
| 353 | afb_m3, /* FCS Elite3D, 3 float chips */ | ||
| 354 | afb_m6 /* FCS Elite3D, 6 float chips */ | ||
| 355 | }; | ||
| 356 | |||
| 357 | typedef struct ffb_dev_priv { | ||
| 358 | /* Misc software state. */ | ||
| 359 | int prom_node; | ||
| 360 | enum ffb_chip_type ffb_type; | ||
| 361 | u64 card_phys_base; | ||
| 362 | struct miscdevice miscdev; | ||
| 363 | |||
| 364 | /* Controller registers. */ | ||
| 365 | ffb_fbcPtr regs; | ||
| 366 | |||
| 367 | /* Context table. */ | ||
| 368 | struct ffb_hw_context *hw_state[FFB_MAX_CTXS]; | ||
| 369 | } ffb_dev_priv_t; | ||
| 370 | |||
| 371 | extern unsigned long ffb_get_unmapped_area(struct file *filp, | ||
| 372 | unsigned long hint, | ||
| 373 | unsigned long len, | ||
| 374 | unsigned long pgoff, | ||
| 375 | unsigned long flags); | ||
| 376 | extern void ffb_set_context_ioctls(void); | ||
| 377 | extern drm_ioctl_desc_t DRM(ioctls)[]; | ||
| 378 | |||
| 379 | extern int ffb_driver_context_switch(drm_device_t * dev, int old, int new); | ||
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c index 337bbcdcf13d..8ea02755b1c9 100644 --- a/drivers/char/generic_serial.c +++ b/drivers/char/generic_serial.c | |||
| @@ -710,12 +710,6 @@ void gs_close(struct tty_struct * tty, struct file * filp) | |||
| 710 | } | 710 | } |
| 711 | 711 | ||
| 712 | 712 | ||
| 713 | static unsigned int gs_baudrates[] = { | ||
| 714 | 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, | ||
| 715 | 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600 | ||
| 716 | }; | ||
| 717 | |||
| 718 | |||
| 719 | void gs_set_termios (struct tty_struct * tty, | 713 | void gs_set_termios (struct tty_struct * tty, |
| 720 | struct ktermios * old_termios) | 714 | struct ktermios * old_termios) |
| 721 | { | 715 | { |
| @@ -771,7 +765,6 @@ void gs_set_termios (struct tty_struct * tty, | |||
| 771 | 765 | ||
| 772 | baudrate = tty_get_baud_rate(tty); | 766 | baudrate = tty_get_baud_rate(tty); |
| 773 | 767 | ||
| 774 | baudrate = gs_baudrates[baudrate]; | ||
| 775 | if ((tiosp->c_cflag & CBAUD) == B38400) { | 768 | if ((tiosp->c_cflag & CBAUD) == B38400) { |
| 776 | if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) | 769 | if ( (port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) |
| 777 | baudrate = 57600; | 770 | baudrate = 57600; |
diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c index 5f4fdcf7c96e..1f0962616ee5 100644 --- a/drivers/char/lcd.c +++ b/drivers/char/lcd.c | |||
| @@ -11,9 +11,6 @@ | |||
| 11 | * March 2001: Ported from 2.0.34 by Liam Davies | 11 | * March 2001: Ported from 2.0.34 by Liam Davies |
| 12 | * | 12 | * |
| 13 | */ | 13 | */ |
| 14 | |||
| 15 | #define RTC_IO_EXTENT 0x10 /*Only really two ports, but... */ | ||
| 16 | |||
| 17 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 18 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
| 19 | #include <linux/miscdevice.h> | 16 | #include <linux/miscdevice.h> |
| @@ -32,8 +29,6 @@ | |||
| 32 | 29 | ||
| 33 | #include "lcd.h" | 30 | #include "lcd.h" |
| 34 | 31 | ||
| 35 | static DEFINE_SPINLOCK(lcd_lock); | ||
| 36 | |||
| 37 | static int lcd_ioctl(struct inode *inode, struct file *file, | 32 | static int lcd_ioctl(struct inode *inode, struct file *file, |
| 38 | unsigned int cmd, unsigned long arg); | 33 | unsigned int cmd, unsigned long arg); |
| 39 | 34 | ||
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index f5c160caf9f4..5f066963f171 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
| @@ -248,7 +248,7 @@ static unsigned long get_unmapped_area_mem(struct file *file, | |||
| 248 | { | 248 | { |
| 249 | if (!valid_mmap_phys_addr_range(pgoff, len)) | 249 | if (!valid_mmap_phys_addr_range(pgoff, len)) |
| 250 | return (unsigned long) -EINVAL; | 250 | return (unsigned long) -EINVAL; |
| 251 | return pgoff; | 251 | return pgoff << PAGE_SHIFT; |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | /* can't do an in-place private mapping if there's no MMU */ | 254 | /* can't do an in-place private mapping if there's no MMU */ |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index a61fb6da5d03..80a01150b86c 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
| @@ -1338,43 +1338,23 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, unsigned int c | |||
| 1338 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) | 1338 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) |
| 1339 | * Caller should use TIOCGICOUNT to see which one it was | 1339 | * Caller should use TIOCGICOUNT to see which one it was |
| 1340 | */ | 1340 | */ |
| 1341 | case TIOCMIWAIT: { | 1341 | case TIOCMIWAIT: |
| 1342 | DECLARE_WAITQUEUE(wait, current); | 1342 | spin_lock_irqsave(&info->slock, flags); |
| 1343 | int ret; | 1343 | cnow = info->icount; /* note the counters on entry */ |
| 1344 | spin_unlock_irqrestore(&info->slock, flags); | ||
| 1345 | |||
| 1346 | wait_event_interruptible(info->delta_msr_wait, ({ | ||
| 1347 | cprev = cnow; | ||
| 1344 | spin_lock_irqsave(&info->slock, flags); | 1348 | spin_lock_irqsave(&info->slock, flags); |
| 1345 | cprev = info->icount; /* note the counters on entry */ | 1349 | cnow = info->icount; /* atomic copy */ |
| 1346 | spin_unlock_irqrestore(&info->slock, flags); | 1350 | spin_unlock_irqrestore(&info->slock, flags); |
| 1347 | 1351 | ||
| 1348 | add_wait_queue(&info->delta_msr_wait, &wait); | 1352 | ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
| 1349 | while (1) { | 1353 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
| 1350 | spin_lock_irqsave(&info->slock, flags); | 1354 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || |
| 1351 | cnow = info->icount; /* atomic copy */ | 1355 | ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)); |
| 1352 | spin_unlock_irqrestore(&info->slock, flags); | 1356 | })); |
| 1353 | 1357 | break; | |
| 1354 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 1355 | if (((arg & TIOCM_RNG) && | ||
| 1356 | (cnow.rng != cprev.rng)) || | ||
| 1357 | ((arg & TIOCM_DSR) && | ||
| 1358 | (cnow.dsr != cprev.dsr)) || | ||
| 1359 | ((arg & TIOCM_CD) && | ||
| 1360 | (cnow.dcd != cprev.dcd)) || | ||
| 1361 | ((arg & TIOCM_CTS) && | ||
| 1362 | (cnow.cts != cprev.cts))) { | ||
| 1363 | ret = 0; | ||
| 1364 | break; | ||
| 1365 | } | ||
| 1366 | /* see if a signal did it */ | ||
| 1367 | if (signal_pending(current)) { | ||
| 1368 | ret = -ERESTARTSYS; | ||
| 1369 | break; | ||
| 1370 | } | ||
| 1371 | cprev = cnow; | ||
| 1372 | } | ||
| 1373 | current->state = TASK_RUNNING; | ||
| 1374 | remove_wait_queue(&info->delta_msr_wait, &wait); | ||
| 1375 | break; | ||
| 1376 | } | ||
| 1377 | /* NOTREACHED */ | ||
| 1378 | /* | 1358 | /* |
| 1379 | * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) | 1359 | * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) |
| 1380 | * Return: write counters to the user passed counter struct | 1360 | * Return: write counters to the user passed counter struct |
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c index 9af07e4999d5..f7603b6aeb87 100644 --- a/drivers/char/mxser_new.c +++ b/drivers/char/mxser_new.c | |||
| @@ -1758,43 +1758,23 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, | |||
| 1758 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) | 1758 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) |
| 1759 | * Caller should use TIOCGICOUNT to see which one it was | 1759 | * Caller should use TIOCGICOUNT to see which one it was |
| 1760 | */ | 1760 | */ |
| 1761 | case TIOCMIWAIT: { | 1761 | case TIOCMIWAIT: |
| 1762 | DECLARE_WAITQUEUE(wait, current); | ||
| 1763 | int ret; | ||
| 1764 | spin_lock_irqsave(&info->slock, flags); | 1762 | spin_lock_irqsave(&info->slock, flags); |
| 1765 | cprev = info->icount; /* note the counters on entry */ | 1763 | cnow = info->icount; /* note the counters on entry */ |
| 1766 | spin_unlock_irqrestore(&info->slock, flags); | 1764 | spin_unlock_irqrestore(&info->slock, flags); |
| 1767 | 1765 | ||
| 1768 | add_wait_queue(&info->delta_msr_wait, &wait); | 1766 | wait_event_interruptible(info->delta_msr_wait, ({ |
| 1769 | while (1) { | 1767 | cprev = cnow; |
| 1770 | spin_lock_irqsave(&info->slock, flags); | 1768 | spin_lock_irqsave(&info->slock, flags); |
| 1771 | cnow = info->icount; /* atomic copy */ | 1769 | cnow = info->icount; /* atomic copy */ |
| 1772 | spin_unlock_irqrestore(&info->slock, flags); | 1770 | spin_unlock_irqrestore(&info->slock, flags); |
| 1773 | 1771 | ||
| 1774 | set_current_state(TASK_INTERRUPTIBLE); | 1772 | ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
| 1775 | if (((arg & TIOCM_RNG) && | 1773 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
| 1776 | (cnow.rng != cprev.rng)) || | 1774 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || |
| 1777 | ((arg & TIOCM_DSR) && | 1775 | ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts)); |
| 1778 | (cnow.dsr != cprev.dsr)) || | 1776 | })); |
| 1779 | ((arg & TIOCM_CD) && | ||
| 1780 | (cnow.dcd != cprev.dcd)) || | ||
| 1781 | ((arg & TIOCM_CTS) && | ||
| 1782 | (cnow.cts != cprev.cts))) { | ||
| 1783 | ret = 0; | ||
| 1784 | break; | ||
| 1785 | } | ||
| 1786 | /* see if a signal did it */ | ||
| 1787 | if (signal_pending(current)) { | ||
| 1788 | ret = -ERESTARTSYS; | ||
| 1789 | break; | ||
| 1790 | } | ||
| 1791 | cprev = cnow; | ||
| 1792 | } | ||
| 1793 | current->state = TASK_RUNNING; | ||
| 1794 | remove_wait_queue(&info->delta_msr_wait, &wait); | ||
| 1795 | break; | 1777 | break; |
| 1796 | } | ||
| 1797 | /* NOTREACHED */ | ||
| 1798 | /* | 1778 | /* |
| 1799 | * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) | 1779 | * Get counter of input serial line interrupts (DCD,RI,DSR,CTS) |
| 1800 | * Return: write counters to the user passed counter struct | 1780 | * Return: write counters to the user passed counter struct |
| @@ -2230,7 +2210,14 @@ end_intr: | |||
| 2230 | port->mon_data.rxcnt += cnt; | 2210 | port->mon_data.rxcnt += cnt; |
| 2231 | port->mon_data.up_rxcnt += cnt; | 2211 | port->mon_data.up_rxcnt += cnt; |
| 2232 | 2212 | ||
| 2213 | /* | ||
| 2214 | * We are called from an interrupt context with &port->slock | ||
| 2215 | * being held. Drop it temporarily in order to prevent | ||
| 2216 | * recursive locking. | ||
| 2217 | */ | ||
| 2218 | spin_unlock(&port->slock); | ||
| 2233 | tty_flip_buffer_push(tty); | 2219 | tty_flip_buffer_push(tty); |
| 2220 | spin_lock(&port->slock); | ||
| 2234 | } | 2221 | } |
| 2235 | 2222 | ||
| 2236 | static void mxser_transmit_chars(struct mxser_port *port) | 2223 | static void mxser_transmit_chars(struct mxser_port *port) |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index e45326856680..7a32df594907 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
| @@ -1376,6 +1376,8 @@ static void do_tty_hangup(struct work_struct *work) | |||
| 1376 | read_unlock(&tasklist_lock); | 1376 | read_unlock(&tasklist_lock); |
| 1377 | 1377 | ||
| 1378 | tty->flags = 0; | 1378 | tty->flags = 0; |
| 1379 | put_pid(tty->session); | ||
| 1380 | put_pid(tty->pgrp); | ||
| 1379 | tty->session = NULL; | 1381 | tty->session = NULL; |
| 1380 | tty->pgrp = NULL; | 1382 | tty->pgrp = NULL; |
| 1381 | tty->ctrl_status = 0; | 1383 | tty->ctrl_status = 0; |
| @@ -3841,6 +3843,9 @@ static struct pid *__proc_set_tty(struct task_struct *tsk, struct tty_struct *tt | |||
| 3841 | { | 3843 | { |
| 3842 | struct pid *old_pgrp; | 3844 | struct pid *old_pgrp; |
| 3843 | if (tty) { | 3845 | if (tty) { |
| 3846 | /* We should not have a session or pgrp to here but.... */ | ||
| 3847 | put_pid(tty->session); | ||
| 3848 | put_pid(tty->pgrp); | ||
| 3844 | tty->session = get_pid(task_session(tsk)); | 3849 | tty->session = get_pid(task_session(tsk)); |
| 3845 | tty->pgrp = get_pid(task_pgrp(tsk)); | 3850 | tty->pgrp = get_pid(task_pgrp(tsk)); |
| 3846 | } | 3851 | } |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index c3f8e383933b..1bbb45b937fd 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
| @@ -724,6 +724,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ | |||
| 724 | return -ENOMEM; | 724 | return -ENOMEM; |
| 725 | memset(vc, 0, sizeof(*vc)); | 725 | memset(vc, 0, sizeof(*vc)); |
| 726 | vc_cons[currcons].d = vc; | 726 | vc_cons[currcons].d = vc; |
| 727 | INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); | ||
| 727 | visual_init(vc, currcons, 1); | 728 | visual_init(vc, currcons, 1); |
| 728 | if (!*vc->vc_uni_pagedir_loc) | 729 | if (!*vc->vc_uni_pagedir_loc) |
| 729 | con_set_default_unimap(vc); | 730 | con_set_default_unimap(vc); |
| @@ -2185,10 +2186,28 @@ static void console_callback(struct work_struct *ignored) | |||
| 2185 | release_console_sem(); | 2186 | release_console_sem(); |
| 2186 | } | 2187 | } |
| 2187 | 2188 | ||
| 2188 | void set_console(int nr) | 2189 | int set_console(int nr) |
| 2189 | { | 2190 | { |
| 2191 | struct vc_data *vc = vc_cons[fg_console].d; | ||
| 2192 | |||
| 2193 | if (!vc_cons_allocated(nr) || vt_dont_switch || | ||
| 2194 | (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) { | ||
| 2195 | |||
| 2196 | /* | ||
| 2197 | * Console switch will fail in console_callback() or | ||
| 2198 | * change_console() so there is no point scheduling | ||
| 2199 | * the callback | ||
| 2200 | * | ||
| 2201 | * Existing set_console() users don't check the return | ||
| 2202 | * value so this shouldn't break anything | ||
| 2203 | */ | ||
| 2204 | return -EINVAL; | ||
| 2205 | } | ||
| 2206 | |||
| 2190 | want_console = nr; | 2207 | want_console = nr; |
| 2191 | schedule_console_callback(); | 2208 | schedule_console_callback(); |
| 2209 | |||
| 2210 | return 0; | ||
| 2192 | } | 2211 | } |
| 2193 | 2212 | ||
| 2194 | struct tty_driver *console_driver; | 2213 | struct tty_driver *console_driver; |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 3a5d301e783b..c9f2dd620e87 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
| @@ -34,7 +34,7 @@ | |||
| 34 | #include <linux/kbd_diacr.h> | 34 | #include <linux/kbd_diacr.h> |
| 35 | #include <linux/selection.h> | 35 | #include <linux/selection.h> |
| 36 | 36 | ||
| 37 | static char vt_dont_switch; | 37 | char vt_dont_switch; |
| 38 | extern struct tty_driver *console_driver; | 38 | extern struct tty_driver *console_driver; |
| 39 | 39 | ||
| 40 | #define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count) | 40 | #define VT_IS_IN_USE(i) (console_driver->ttys[i] && console_driver->ttys[i]->count) |
| @@ -1039,10 +1039,22 @@ int vt_waitactive(int vt) | |||
| 1039 | 1039 | ||
| 1040 | add_wait_queue(&vt_activate_queue, &wait); | 1040 | add_wait_queue(&vt_activate_queue, &wait); |
| 1041 | for (;;) { | 1041 | for (;;) { |
| 1042 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 1043 | retval = 0; | 1042 | retval = 0; |
| 1044 | if (vt == fg_console) | 1043 | |
| 1044 | /* | ||
| 1045 | * Synchronize with redraw_screen(). By acquiring the console | ||
| 1046 | * semaphore we make sure that the console switch is completed | ||
| 1047 | * before we return. If we didn't wait for the semaphore, we | ||
| 1048 | * could return at a point where fg_console has already been | ||
| 1049 | * updated, but the console switch hasn't been completed. | ||
| 1050 | */ | ||
| 1051 | acquire_console_sem(); | ||
| 1052 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 1053 | if (vt == fg_console) { | ||
| 1054 | release_console_sem(); | ||
| 1045 | break; | 1055 | break; |
| 1056 | } | ||
| 1057 | release_console_sem(); | ||
| 1046 | retval = -EINTR; | 1058 | retval = -EINTR; |
| 1047 | if (signal_pending(current)) | 1059 | if (signal_pending(current)) |
| 1048 | break; | 1060 | break; |
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index ea09d0c974ea..e812aa129e28 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig | |||
| @@ -301,6 +301,7 @@ config I6300ESB_WDT | |||
| 301 | config I8XX_TCO | 301 | config I8XX_TCO |
| 302 | tristate "Intel i8xx TCO Timer/Watchdog" | 302 | tristate "Intel i8xx TCO Timer/Watchdog" |
| 303 | depends on WATCHDOG && (X86 || IA64) && PCI | 303 | depends on WATCHDOG && (X86 || IA64) && PCI |
| 304 | default n | ||
| 304 | ---help--- | 305 | ---help--- |
| 305 | Hardware driver for the TCO timer built into the Intel 82801 | 306 | Hardware driver for the TCO timer built into the Intel 82801 |
| 306 | I/O Controller Hub family. The TCO (Total Cost of Ownership) | 307 | I/O Controller Hub family. The TCO (Total Cost of Ownership) |
diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c index 4a328ba0d262..76c7fa37fa6c 100644 --- a/drivers/char/watchdog/machzwd.c +++ b/drivers/char/watchdog/machzwd.c | |||
| @@ -314,21 +314,21 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
| 314 | { | 314 | { |
| 315 | void __user *argp = (void __user *)arg; | 315 | void __user *argp = (void __user *)arg; |
| 316 | int __user *p = argp; | 316 | int __user *p = argp; |
| 317 | switch(cmd){ | 317 | switch (cmd) { |
| 318 | case WDIOC_GETSUPPORT: | 318 | case WDIOC_GETSUPPORT: |
| 319 | if (copy_to_user(argp, &zf_info, sizeof(zf_info))) | 319 | if (copy_to_user(argp, &zf_info, sizeof(zf_info))) |
| 320 | return -EFAULT; | 320 | return -EFAULT; |
| 321 | break; | 321 | break; |
| 322 | 322 | ||
| 323 | case WDIOC_GETSTATUS: | 323 | case WDIOC_GETSTATUS: |
| 324 | return put_user(0, p); | 324 | return put_user(0, p); |
| 325 | 325 | ||
| 326 | case WDIOC_KEEPALIVE: | 326 | case WDIOC_KEEPALIVE: |
| 327 | zf_ping(0); | 327 | zf_ping(0); |
| 328 | break; | 328 | break; |
| 329 | 329 | ||
| 330 | default: | 330 | default: |
| 331 | return -ENOTTY; | 331 | return -ENOTTY; |
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | return 0; | 334 | return 0; |
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index d42060ede930..5ac309ee7f05 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c | |||
| @@ -90,7 +90,7 @@ __setup("acpi_pm_good", acpi_pm_good_setup); | |||
| 90 | static inline void acpi_pm_need_workaround(void) | 90 | static inline void acpi_pm_need_workaround(void) |
| 91 | { | 91 | { |
| 92 | clocksource_acpi_pm.read = acpi_pm_read_slow; | 92 | clocksource_acpi_pm.read = acpi_pm_read_slow; |
| 93 | clocksource_acpi_pm.rating = 110; | 93 | clocksource_acpi_pm.rating = 120; |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | /* | 96 | /* |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index f52facc570f5..3162010900c9 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -1015,6 +1015,10 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
| 1015 | { | 1015 | { |
| 1016 | unsigned int cpu = sys_dev->id; | 1016 | unsigned int cpu = sys_dev->id; |
| 1017 | int retval; | 1017 | int retval; |
| 1018 | |||
| 1019 | if (cpu_is_offline(cpu)) | ||
| 1020 | return 0; | ||
| 1021 | |||
| 1018 | if (unlikely(lock_policy_rwsem_write(cpu))) | 1022 | if (unlikely(lock_policy_rwsem_write(cpu))) |
| 1019 | BUG(); | 1023 | BUG(); |
| 1020 | 1024 | ||
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 15278044295c..322ee2984e3d 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
| @@ -176,6 +176,7 @@ void dma_chan_cleanup(struct kref *kref) | |||
| 176 | chan->client = NULL; | 176 | chan->client = NULL; |
| 177 | kref_put(&chan->device->refcount, dma_async_device_cleanup); | 177 | kref_put(&chan->device->refcount, dma_async_device_cleanup); |
| 178 | } | 178 | } |
| 179 | EXPORT_SYMBOL(dma_chan_cleanup); | ||
| 179 | 180 | ||
| 180 | static void dma_chan_free_rcu(struct rcu_head *rcu) | 181 | static void dma_chan_free_rcu(struct rcu_head *rcu) |
| 181 | { | 182 | { |
| @@ -261,6 +262,7 @@ struct dma_client *dma_async_client_register(dma_event_callback event_callback) | |||
| 261 | 262 | ||
| 262 | return client; | 263 | return client; |
| 263 | } | 264 | } |
| 265 | EXPORT_SYMBOL(dma_async_client_register); | ||
| 264 | 266 | ||
| 265 | /** | 267 | /** |
| 266 | * dma_async_client_unregister - unregister a client and free the &dma_client | 268 | * dma_async_client_unregister - unregister a client and free the &dma_client |
| @@ -287,6 +289,7 @@ void dma_async_client_unregister(struct dma_client *client) | |||
| 287 | kfree(client); | 289 | kfree(client); |
| 288 | dma_chans_rebalance(); | 290 | dma_chans_rebalance(); |
| 289 | } | 291 | } |
| 292 | EXPORT_SYMBOL(dma_async_client_unregister); | ||
| 290 | 293 | ||
| 291 | /** | 294 | /** |
| 292 | * dma_async_client_chan_request - request DMA channels | 295 | * dma_async_client_chan_request - request DMA channels |
| @@ -304,6 +307,7 @@ void dma_async_client_chan_request(struct dma_client *client, | |||
| 304 | client->chans_desired = number; | 307 | client->chans_desired = number; |
| 305 | dma_chans_rebalance(); | 308 | dma_chans_rebalance(); |
| 306 | } | 309 | } |
| 310 | EXPORT_SYMBOL(dma_async_client_chan_request); | ||
| 307 | 311 | ||
| 308 | /** | 312 | /** |
| 309 | * dma_async_device_register - registers DMA devices found | 313 | * dma_async_device_register - registers DMA devices found |
| @@ -346,6 +350,7 @@ int dma_async_device_register(struct dma_device *device) | |||
| 346 | 350 | ||
| 347 | return 0; | 351 | return 0; |
| 348 | } | 352 | } |
| 353 | EXPORT_SYMBOL(dma_async_device_register); | ||
| 349 | 354 | ||
| 350 | /** | 355 | /** |
| 351 | * dma_async_device_cleanup - function called when all references are released | 356 | * dma_async_device_cleanup - function called when all references are released |
| @@ -390,23 +395,12 @@ void dma_async_device_unregister(struct dma_device *device) | |||
| 390 | kref_put(&device->refcount, dma_async_device_cleanup); | 395 | kref_put(&device->refcount, dma_async_device_cleanup); |
| 391 | wait_for_completion(&device->done); | 396 | wait_for_completion(&device->done); |
| 392 | } | 397 | } |
| 398 | EXPORT_SYMBOL(dma_async_device_unregister); | ||
| 393 | 399 | ||
| 394 | static int __init dma_bus_init(void) | 400 | static int __init dma_bus_init(void) |
| 395 | { | 401 | { |
| 396 | mutex_init(&dma_list_mutex); | 402 | mutex_init(&dma_list_mutex); |
| 397 | return class_register(&dma_devclass); | 403 | return class_register(&dma_devclass); |
| 398 | } | 404 | } |
| 399 | |||
| 400 | subsys_initcall(dma_bus_init); | 405 | subsys_initcall(dma_bus_init); |
| 401 | 406 | ||
| 402 | EXPORT_SYMBOL(dma_async_client_register); | ||
| 403 | EXPORT_SYMBOL(dma_async_client_unregister); | ||
| 404 | EXPORT_SYMBOL(dma_async_client_chan_request); | ||
| 405 | EXPORT_SYMBOL(dma_async_memcpy_buf_to_buf); | ||
| 406 | EXPORT_SYMBOL(dma_async_memcpy_buf_to_pg); | ||
| 407 | EXPORT_SYMBOL(dma_async_memcpy_pg_to_pg); | ||
| 408 | EXPORT_SYMBOL(dma_async_memcpy_complete); | ||
| 409 | EXPORT_SYMBOL(dma_async_memcpy_issue_pending); | ||
| 410 | EXPORT_SYMBOL(dma_async_device_register); | ||
| 411 | EXPORT_SYMBOL(dma_async_device_unregister); | ||
| 412 | EXPORT_SYMBOL(dma_chan_cleanup); | ||
diff --git a/drivers/eisa/pci_eisa.c b/drivers/eisa/pci_eisa.c index 9e913629ef39..74edb1d0110f 100644 --- a/drivers/eisa/pci_eisa.c +++ b/drivers/eisa/pci_eisa.c | |||
| @@ -19,8 +19,8 @@ | |||
| 19 | /* There is only *one* pci_eisa device per machine, right ? */ | 19 | /* There is only *one* pci_eisa device per machine, right ? */ |
| 20 | static struct eisa_root_device pci_eisa_root; | 20 | static struct eisa_root_device pci_eisa_root; |
| 21 | 21 | ||
| 22 | static int __devinit pci_eisa_init (struct pci_dev *pdev, | 22 | static int __init pci_eisa_init(struct pci_dev *pdev, |
| 23 | const struct pci_device_id *ent) | 23 | const struct pci_device_id *ent) |
| 24 | { | 24 | { |
| 25 | int rc; | 25 | int rc; |
| 26 | 26 | ||
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index f4ee1afe488f..1cca32f46947 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <asm/byteorder.h> | 26 | #include <asm/byteorder.h> |
| 27 | #include <linux/input.h> | 27 | #include <linux/input.h> |
| 28 | #include <linux/wait.h> | 28 | #include <linux/wait.h> |
| 29 | #include <linux/vmalloc.h> | ||
| 29 | 30 | ||
| 30 | #include <linux/hid.h> | 31 | #include <linux/hid.h> |
| 31 | #include <linux/hiddev.h> | 32 | #include <linux/hiddev.h> |
| @@ -654,12 +655,13 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size) | |||
| 654 | memcpy(device->rdesc, start, size); | 655 | memcpy(device->rdesc, start, size); |
| 655 | device->rsize = size; | 656 | device->rsize = size; |
| 656 | 657 | ||
| 657 | if (!(parser = kzalloc(sizeof(struct hid_parser), GFP_KERNEL))) { | 658 | if (!(parser = vmalloc(sizeof(struct hid_parser)))) { |
| 658 | kfree(device->rdesc); | 659 | kfree(device->rdesc); |
| 659 | kfree(device->collection); | 660 | kfree(device->collection); |
| 660 | kfree(device); | 661 | kfree(device); |
| 661 | return NULL; | 662 | return NULL; |
| 662 | } | 663 | } |
| 664 | memset(parser, 0, sizeof(struct hid_parser)); | ||
| 663 | parser->device = device; | 665 | parser->device = device; |
| 664 | 666 | ||
| 665 | end = start + size; | 667 | end = start + size; |
| @@ -668,7 +670,7 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size) | |||
| 668 | if (item.format != HID_ITEM_FORMAT_SHORT) { | 670 | if (item.format != HID_ITEM_FORMAT_SHORT) { |
| 669 | dbg("unexpected long global item"); | 671 | dbg("unexpected long global item"); |
| 670 | hid_free_device(device); | 672 | hid_free_device(device); |
| 671 | kfree(parser); | 673 | vfree(parser); |
| 672 | return NULL; | 674 | return NULL; |
| 673 | } | 675 | } |
| 674 | 676 | ||
| @@ -676,7 +678,7 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size) | |||
| 676 | dbg("item %u %u %u %u parsing failed\n", | 678 | dbg("item %u %u %u %u parsing failed\n", |
| 677 | item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); | 679 | item.format, (unsigned)item.size, (unsigned)item.type, (unsigned)item.tag); |
| 678 | hid_free_device(device); | 680 | hid_free_device(device); |
| 679 | kfree(parser); | 681 | vfree(parser); |
| 680 | return NULL; | 682 | return NULL; |
| 681 | } | 683 | } |
| 682 | 684 | ||
| @@ -684,23 +686,23 @@ struct hid_device *hid_parse_report(__u8 *start, unsigned size) | |||
| 684 | if (parser->collection_stack_ptr) { | 686 | if (parser->collection_stack_ptr) { |
| 685 | dbg("unbalanced collection at end of report description"); | 687 | dbg("unbalanced collection at end of report description"); |
| 686 | hid_free_device(device); | 688 | hid_free_device(device); |
| 687 | kfree(parser); | 689 | vfree(parser); |
| 688 | return NULL; | 690 | return NULL; |
| 689 | } | 691 | } |
| 690 | if (parser->local.delimiter_depth) { | 692 | if (parser->local.delimiter_depth) { |
| 691 | dbg("unbalanced delimiter at end of report description"); | 693 | dbg("unbalanced delimiter at end of report description"); |
| 692 | hid_free_device(device); | 694 | hid_free_device(device); |
| 693 | kfree(parser); | 695 | vfree(parser); |
| 694 | return NULL; | 696 | return NULL; |
| 695 | } | 697 | } |
| 696 | kfree(parser); | 698 | vfree(parser); |
| 697 | return device; | 699 | return device; |
| 698 | } | 700 | } |
| 699 | } | 701 | } |
| 700 | 702 | ||
| 701 | dbg("item fetching failed at offset %d\n", (int)(end - start)); | 703 | dbg("item fetching failed at offset %d\n", (int)(end - start)); |
| 702 | hid_free_device(device); | 704 | hid_free_device(device); |
| 703 | kfree(parser); | 705 | vfree(parser); |
| 704 | return NULL; | 706 | return NULL; |
| 705 | } | 707 | } |
| 706 | EXPORT_SYMBOL_GPL(hid_parse_report); | 708 | EXPORT_SYMBOL_GPL(hid_parse_report); |
| @@ -753,8 +755,7 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) | |||
| 753 | 755 | ||
| 754 | report += offset >> 3; /* adjust byte index */ | 756 | report += offset >> 3; /* adjust byte index */ |
| 755 | offset &= 7; /* now only need bit offset into one byte */ | 757 | offset &= 7; /* now only need bit offset into one byte */ |
| 756 | x = get_unaligned((u64 *) report); | 758 | x = le64_to_cpu(get_unaligned((__le64 *) report)); |
| 757 | x = le64_to_cpu(x); | ||
| 758 | x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ | 759 | x = (x >> offset) & ((1ULL << n) - 1); /* extract bit field */ |
| 759 | return (u32) x; | 760 | return (u32) x; |
| 760 | } | 761 | } |
| @@ -769,7 +770,7 @@ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n) | |||
| 769 | */ | 770 | */ |
| 770 | static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) | 771 | static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u32 value) |
| 771 | { | 772 | { |
| 772 | u64 x; | 773 | __le64 x; |
| 773 | u64 m = (1ULL << n) - 1; | 774 | u64 m = (1ULL << n) - 1; |
| 774 | 775 | ||
| 775 | WARN_ON(n > 32); | 776 | WARN_ON(n > 32); |
| @@ -780,10 +781,10 @@ static __inline__ void implement(__u8 *report, unsigned offset, unsigned n, __u3 | |||
| 780 | report += offset >> 3; | 781 | report += offset >> 3; |
| 781 | offset &= 7; | 782 | offset &= 7; |
| 782 | 783 | ||
| 783 | x = get_unaligned((u64 *)report); | 784 | x = get_unaligned((__le64 *)report); |
| 784 | x &= cpu_to_le64(~(m << offset)); | 785 | x &= cpu_to_le64(~(m << offset)); |
| 785 | x |= cpu_to_le64(((u64) value) << offset); | 786 | x |= cpu_to_le64(((u64) value) << offset); |
| 786 | put_unaligned(x, (u64 *) report); | 787 | put_unaligned(x, (__le64 *) report); |
| 787 | } | 788 | } |
| 788 | 789 | ||
| 789 | /* | 790 | /* |
| @@ -873,10 +874,6 @@ static void hid_output_field(struct hid_field *field, __u8 *data) | |||
| 873 | unsigned size = field->report_size; | 874 | unsigned size = field->report_size; |
| 874 | unsigned n; | 875 | unsigned n; |
| 875 | 876 | ||
| 876 | /* make sure the unused bits in the last byte are zeros */ | ||
| 877 | if (count > 0 && size > 0) | ||
| 878 | data[(offset+count*size-1)/8] = 0; | ||
| 879 | |||
| 880 | for (n = 0; n < count; n++) { | 877 | for (n = 0; n < count; n++) { |
| 881 | if (field->logical_minimum < 0) /* signed values */ | 878 | if (field->logical_minimum < 0) /* signed values */ |
| 882 | implement(data, offset + n * size, size, s32ton(field->value[n], size)); | 879 | implement(data, offset + n * size, size, s32ton(field->value[n], size)); |
| @@ -972,7 +969,7 @@ int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int i | |||
| 972 | 969 | ||
| 973 | if (size < rsize) { | 970 | if (size < rsize) { |
| 974 | dbg("report %d is too short, (%d < %d)", report->id, size, rsize); | 971 | dbg("report %d is too short, (%d < %d)", report->id, size, rsize); |
| 975 | return -1; | 972 | memset(data + size, 0, rsize - size); |
| 976 | } | 973 | } |
| 977 | 974 | ||
| 978 | if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) | 975 | if ((hid->claimed & HID_CLAIMED_HIDDEV) && hid->hiddev_report_event) |
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index c3d4856fb618..6d105a1d41b1 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
| @@ -527,6 +527,7 @@ config SENSORS_W83792D | |||
| 527 | config SENSORS_W83793 | 527 | config SENSORS_W83793 |
| 528 | tristate "Winbond W83793" | 528 | tristate "Winbond W83793" |
| 529 | depends on HWMON && I2C && EXPERIMENTAL | 529 | depends on HWMON && I2C && EXPERIMENTAL |
| 530 | select HWMON_VID | ||
| 530 | help | 531 | help |
| 531 | If you say yes here you get support for the Winbond W83793 | 532 | If you say yes here you get support for the Winbond W83793 |
| 532 | hardware monitoring chip. | 533 | hardware monitoring chip. |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index da5828f2dfc2..30a76404f0af 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
| @@ -121,9 +121,9 @@ superio_exit(void) | |||
| 121 | * ISA constants | 121 | * ISA constants |
| 122 | */ | 122 | */ |
| 123 | 123 | ||
| 124 | #define REGION_ALIGNMENT ~7 | 124 | #define IOREGION_ALIGNMENT ~7 |
| 125 | #define REGION_OFFSET 5 | 125 | #define IOREGION_OFFSET 5 |
| 126 | #define REGION_LENGTH 2 | 126 | #define IOREGION_LENGTH 2 |
| 127 | #define ADDR_REG_OFFSET 5 | 127 | #define ADDR_REG_OFFSET 5 |
| 128 | #define DATA_REG_OFFSET 6 | 128 | #define DATA_REG_OFFSET 6 |
| 129 | 129 | ||
| @@ -407,7 +407,7 @@ static void w83627ehf_write_fan_div(struct i2c_client *client, int nr) | |||
| 407 | break; | 407 | break; |
| 408 | case 4: | 408 | case 4: |
| 409 | reg = (w83627ehf_read_value(client, W83627EHF_REG_DIODE) & 0x73) | 409 | reg = (w83627ehf_read_value(client, W83627EHF_REG_DIODE) & 0x73) |
| 410 | | ((data->fan_div[4] & 0x03) << 3) | 410 | | ((data->fan_div[4] & 0x03) << 2) |
| 411 | | ((data->fan_div[4] & 0x04) << 5); | 411 | | ((data->fan_div[4] & 0x04) << 5); |
| 412 | w83627ehf_write_value(client, W83627EHF_REG_DIODE, reg); | 412 | w83627ehf_write_value(client, W83627EHF_REG_DIODE, reg); |
| 413 | break; | 413 | break; |
| @@ -471,9 +471,9 @@ static struct w83627ehf_data *w83627ehf_update_device(struct device *dev) | |||
| 471 | time */ | 471 | time */ |
| 472 | if (data->fan[i] == 0xff | 472 | if (data->fan[i] == 0xff |
| 473 | && data->fan_div[i] < 0x07) { | 473 | && data->fan_div[i] < 0x07) { |
| 474 | dev_dbg(&client->dev, "Increasing fan %d " | 474 | dev_dbg(&client->dev, "Increasing fan%d " |
| 475 | "clock divider from %u to %u\n", | 475 | "clock divider from %u to %u\n", |
| 476 | i, div_from_reg(data->fan_div[i]), | 476 | i + 1, div_from_reg(data->fan_div[i]), |
| 477 | div_from_reg(data->fan_div[i] + 1)); | 477 | div_from_reg(data->fan_div[i] + 1)); |
| 478 | data->fan_div[i]++; | 478 | data->fan_div[i]++; |
| 479 | w83627ehf_write_fan_div(client, i); | 479 | w83627ehf_write_fan_div(client, i); |
| @@ -1194,7 +1194,7 @@ static int w83627ehf_detect(struct i2c_adapter *adapter) | |||
| 1194 | u8 fan4pin, fan5pin; | 1194 | u8 fan4pin, fan5pin; |
| 1195 | int i, err = 0; | 1195 | int i, err = 0; |
| 1196 | 1196 | ||
| 1197 | if (!request_region(address + REGION_OFFSET, REGION_LENGTH, | 1197 | if (!request_region(address + IOREGION_OFFSET, IOREGION_LENGTH, |
| 1198 | w83627ehf_driver.driver.name)) { | 1198 | w83627ehf_driver.driver.name)) { |
| 1199 | err = -EBUSY; | 1199 | err = -EBUSY; |
| 1200 | goto exit; | 1200 | goto exit; |
| @@ -1322,7 +1322,7 @@ exit_remove: | |||
| 1322 | exit_free: | 1322 | exit_free: |
| 1323 | kfree(data); | 1323 | kfree(data); |
| 1324 | exit_release: | 1324 | exit_release: |
| 1325 | release_region(address + REGION_OFFSET, REGION_LENGTH); | 1325 | release_region(address + IOREGION_OFFSET, IOREGION_LENGTH); |
| 1326 | exit: | 1326 | exit: |
| 1327 | return err; | 1327 | return err; |
| 1328 | } | 1328 | } |
| @@ -1337,7 +1337,7 @@ static int w83627ehf_detach_client(struct i2c_client *client) | |||
| 1337 | 1337 | ||
| 1338 | if ((err = i2c_detach_client(client))) | 1338 | if ((err = i2c_detach_client(client))) |
| 1339 | return err; | 1339 | return err; |
| 1340 | release_region(client->addr + REGION_OFFSET, REGION_LENGTH); | 1340 | release_region(client->addr + IOREGION_OFFSET, IOREGION_LENGTH); |
| 1341 | kfree(data); | 1341 | kfree(data); |
| 1342 | 1342 | ||
| 1343 | return 0; | 1343 | return 0; |
| @@ -1380,7 +1380,7 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr) | |||
| 1380 | superio_select(W83627EHF_LD_HWM); | 1380 | superio_select(W83627EHF_LD_HWM); |
| 1381 | val = (superio_inb(SIO_REG_ADDR) << 8) | 1381 | val = (superio_inb(SIO_REG_ADDR) << 8) |
| 1382 | | superio_inb(SIO_REG_ADDR + 1); | 1382 | | superio_inb(SIO_REG_ADDR + 1); |
| 1383 | *addr = val & REGION_ALIGNMENT; | 1383 | *addr = val & IOREGION_ALIGNMENT; |
| 1384 | if (*addr == 0) { | 1384 | if (*addr == 0) { |
| 1385 | superio_exit(); | 1385 | superio_exit(); |
| 1386 | return -ENODEV; | 1386 | return -ENODEV; |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index fb19dbb31e42..ece31d2c6c64 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
| @@ -344,8 +344,7 @@ config I2C_PARPORT_LIGHT | |||
| 344 | 344 | ||
| 345 | config I2C_PASEMI | 345 | config I2C_PASEMI |
| 346 | tristate "PA Semi SMBus interface" | 346 | tristate "PA Semi SMBus interface" |
| 347 | # depends on PPC_PASEMI && I2C && PCI | 347 | depends on PPC_PASEMI && I2C && PCI |
| 348 | depends on I2C && PCI | ||
| 349 | help | 348 | help |
| 350 | Supports the PA Semi PWRficient on-chip SMBus interfaces. | 349 | Supports the PA Semi PWRficient on-chip SMBus interfaces. |
| 351 | 350 | ||
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index e15f9e37716a..0c70f8293341 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c | |||
| @@ -254,7 +254,8 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, | |||
| 254 | break; | 254 | break; |
| 255 | 255 | ||
| 256 | case I2C_SMBUS_BLOCK_PROC_CALL: | 256 | case I2C_SMBUS_BLOCK_PROC_CALL: |
| 257 | len = min_t(u8, data->block[0], 31); | 257 | len = min_t(u8, data->block[0], |
| 258 | I2C_SMBUS_BLOCK_MAX - 1); | ||
| 258 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 259 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
| 259 | amd_ec_write(smbus, AMD_SMB_BCNT, len); | 260 | amd_ec_write(smbus, AMD_SMB_BCNT, len); |
| 260 | for (i = 0; i < len; i++) | 261 | for (i = 0; i < len; i++) |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 6569a36985bd..a320e7d82c1f 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
| @@ -97,6 +97,7 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write, | |||
| 97 | int command, int hwpec); | 97 | int command, int hwpec); |
| 98 | 98 | ||
| 99 | static unsigned long i801_smba; | 99 | static unsigned long i801_smba; |
| 100 | static unsigned char i801_original_hstcfg; | ||
| 100 | static struct pci_driver i801_driver; | 101 | static struct pci_driver i801_driver; |
| 101 | static struct pci_dev *I801_dev; | 102 | static struct pci_dev *I801_dev; |
| 102 | static int isich4; | 103 | static int isich4; |
| @@ -510,6 +511,7 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id | |||
| 510 | } | 511 | } |
| 511 | 512 | ||
| 512 | pci_read_config_byte(I801_dev, SMBHSTCFG, &temp); | 513 | pci_read_config_byte(I801_dev, SMBHSTCFG, &temp); |
| 514 | i801_original_hstcfg = temp; | ||
| 513 | temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ | 515 | temp &= ~SMBHSTCFG_I2C_EN; /* SMBus timing */ |
| 514 | if (!(temp & SMBHSTCFG_HST_EN)) { | 516 | if (!(temp & SMBHSTCFG_HST_EN)) { |
| 515 | dev_info(&dev->dev, "Enabling SMBus device\n"); | 517 | dev_info(&dev->dev, "Enabling SMBus device\n"); |
| @@ -543,6 +545,7 @@ exit: | |||
| 543 | static void __devexit i801_remove(struct pci_dev *dev) | 545 | static void __devexit i801_remove(struct pci_dev *dev) |
| 544 | { | 546 | { |
| 545 | i2c_del_adapter(&i801_adapter); | 547 | i2c_del_adapter(&i801_adapter); |
| 548 | pci_write_config_byte(I801_dev, SMBHSTCFG, i801_original_hstcfg); | ||
| 546 | pci_release_region(dev, SMBBAR); | 549 | pci_release_region(dev, SMBBAR); |
| 547 | /* | 550 | /* |
| 548 | * do not call pci_disable_device(dev) since it can cause hard hangs on | 551 | * do not call pci_disable_device(dev) since it can cause hard hangs on |
| @@ -550,11 +553,33 @@ static void __devexit i801_remove(struct pci_dev *dev) | |||
| 550 | */ | 553 | */ |
| 551 | } | 554 | } |
| 552 | 555 | ||
| 556 | #ifdef CONFIG_PM | ||
| 557 | static int i801_suspend(struct pci_dev *dev, pm_message_t mesg) | ||
| 558 | { | ||
| 559 | pci_save_state(dev); | ||
| 560 | pci_write_config_byte(dev, SMBHSTCFG, i801_original_hstcfg); | ||
| 561 | pci_set_power_state(dev, pci_choose_state(dev, mesg)); | ||
| 562 | return 0; | ||
| 563 | } | ||
| 564 | |||
| 565 | static int i801_resume(struct pci_dev *dev) | ||
| 566 | { | ||
| 567 | pci_set_power_state(dev, PCI_D0); | ||
| 568 | pci_restore_state(dev); | ||
| 569 | return pci_enable_device(dev); | ||
| 570 | } | ||
| 571 | #else | ||
| 572 | #define i801_suspend NULL | ||
| 573 | #define i801_resume NULL | ||
| 574 | #endif | ||
| 575 | |||
| 553 | static struct pci_driver i801_driver = { | 576 | static struct pci_driver i801_driver = { |
| 554 | .name = "i801_smbus", | 577 | .name = "i801_smbus", |
| 555 | .id_table = i801_ids, | 578 | .id_table = i801_ids, |
| 556 | .probe = i801_probe, | 579 | .probe = i801_probe, |
| 557 | .remove = __devexit_p(i801_remove), | 580 | .remove = __devexit_p(i801_remove), |
| 581 | .suspend = i801_suspend, | ||
| 582 | .resume = i801_resume, | ||
| 558 | }; | 583 | }; |
| 559 | 584 | ||
| 560 | static int __init i2c_i801_init(void) | 585 | static int __init i2c_i801_init(void) |
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c index f54fb5d65cc4..bf89eeef74e9 100644 --- a/drivers/i2c/busses/i2c-pasemi.c +++ b/drivers/i2c/busses/i2c-pasemi.c | |||
| @@ -141,7 +141,7 @@ static int pasemi_i2c_xfer_msg(struct i2c_adapter *adapter, | |||
| 141 | for (i = 0; i < msg->len - 1; i++) | 141 | for (i = 0; i < msg->len - 1; i++) |
| 142 | TXFIFO_WR(smbus, msg->buf[i]); | 142 | TXFIFO_WR(smbus, msg->buf[i]); |
| 143 | 143 | ||
| 144 | TXFIFO_WR(smbus, msg->buf[msg->len] | | 144 | TXFIFO_WR(smbus, msg->buf[msg->len-1] | |
| 145 | (stop ? MTXFIFO_STOP : 0)); | 145 | (stop ? MTXFIFO_STOP : 0)); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| @@ -226,7 +226,7 @@ static int pasemi_smb_xfer(struct i2c_adapter *adapter, | |||
| 226 | rd = RXFIFO_RD(smbus); | 226 | rd = RXFIFO_RD(smbus); |
| 227 | len = min_t(u8, (rd & MRXFIFO_DATA_M), | 227 | len = min_t(u8, (rd & MRXFIFO_DATA_M), |
| 228 | I2C_SMBUS_BLOCK_MAX); | 228 | I2C_SMBUS_BLOCK_MAX); |
| 229 | TXFIFO_WR(smbus, (len + 1) | MTXFIFO_READ | | 229 | TXFIFO_WR(smbus, len | MTXFIFO_READ | |
| 230 | MTXFIFO_STOP); | 230 | MTXFIFO_STOP); |
| 231 | } else { | 231 | } else { |
| 232 | len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX); | 232 | len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX); |
| @@ -258,7 +258,7 @@ static int pasemi_smb_xfer(struct i2c_adapter *adapter, | |||
| 258 | rd = RXFIFO_RD(smbus); | 258 | rd = RXFIFO_RD(smbus); |
| 259 | len = min_t(u8, (rd & MRXFIFO_DATA_M), | 259 | len = min_t(u8, (rd & MRXFIFO_DATA_M), |
| 260 | I2C_SMBUS_BLOCK_MAX - len); | 260 | I2C_SMBUS_BLOCK_MAX - len); |
| 261 | TXFIFO_WR(smbus, (len + 1) | MTXFIFO_READ | MTXFIFO_STOP); | 261 | TXFIFO_WR(smbus, len | MTXFIFO_READ | MTXFIFO_STOP); |
| 262 | break; | 262 | break; |
| 263 | 263 | ||
| 264 | default: | 264 | default: |
diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c index 15edf40828b4..8a2ff0c114d9 100644 --- a/drivers/i2c/chips/ds1374.c +++ b/drivers/i2c/chips/ds1374.c | |||
| @@ -207,6 +207,10 @@ static int ds1374_probe(struct i2c_adapter *adap, int addr, int kind) | |||
| 207 | client->driver = &ds1374_driver; | 207 | client->driver = &ds1374_driver; |
| 208 | 208 | ||
| 209 | ds1374_workqueue = create_singlethread_workqueue("ds1374"); | 209 | ds1374_workqueue = create_singlethread_workqueue("ds1374"); |
| 210 | if (!ds1374_workqueue) { | ||
| 211 | kfree(client); | ||
| 212 | return -ENOMEM; /* most expected reason */ | ||
| 213 | } | ||
| 210 | 214 | ||
| 211 | if ((rc = i2c_attach_client(client)) != 0) { | 215 | if ((rc = i2c_attach_client(client)) != 0) { |
| 212 | kfree(client); | 216 | kfree(client); |
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 5d134bb75ba1..5bdf64b77913 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
| @@ -57,6 +57,7 @@ if IDE | |||
| 57 | config IDE_MAX_HWIFS | 57 | config IDE_MAX_HWIFS |
| 58 | int "Max IDE interfaces" | 58 | int "Max IDE interfaces" |
| 59 | depends on ALPHA || SUPERH || IA64 || EMBEDDED | 59 | depends on ALPHA || SUPERH || IA64 || EMBEDDED |
| 60 | range 1 10 | ||
| 60 | default 4 | 61 | default 4 |
| 61 | help | 62 | help |
| 62 | This is the maximum number of IDE hardware interfaces that will | 63 | This is the maximum number of IDE hardware interfaces that will |
| @@ -103,8 +104,10 @@ config BLK_DEV_IDE_SATA | |||
| 103 | ---help--- | 104 | ---help--- |
| 104 | There are two drivers for Serial ATA controllers. | 105 | There are two drivers for Serial ATA controllers. |
| 105 | 106 | ||
| 106 | The main driver, "libata", exists inside the SCSI subsystem | 107 | The main driver, "libata", uses the SCSI subsystem |
| 107 | and supports most modern SATA controllers. | 108 | and supports most modern SATA controllers. In order to use it |
| 109 | you may take a look at "Serial ATA (prod) and Parallel ATA | ||
| 110 | (experimental) drivers". | ||
| 108 | 111 | ||
| 109 | The IDE driver (which you are currently configuring) supports | 112 | The IDE driver (which you are currently configuring) supports |
| 110 | a few first-generation SATA controllers. | 113 | a few first-generation SATA controllers. |
| @@ -434,24 +437,8 @@ config BLK_DEV_IDEDMA_FORCED | |||
| 434 | 437 | ||
| 435 | Generally say N here. | 438 | Generally say N here. |
| 436 | 439 | ||
| 437 | config IDEDMA_PCI_AUTO | ||
| 438 | bool "Use PCI DMA by default when available" | ||
| 439 | ---help--- | ||
| 440 | Prior to kernel version 2.1.112, Linux used to automatically use | ||
| 441 | DMA for IDE drives and chipsets which support it. Due to concerns | ||
| 442 | about a couple of cases where buggy hardware may have caused damage, | ||
| 443 | the default is now to NOT use DMA automatically. To revert to the | ||
| 444 | previous behaviour, say Y to this question. | ||
| 445 | |||
| 446 | If you suspect your hardware is at all flakey, say N here. | ||
| 447 | Do NOT email the IDE kernel people regarding this issue! | ||
| 448 | |||
| 449 | It is normally safe to answer Y to this question unless your | ||
| 450 | motherboard uses a VIA VP2 chipset, in which case you should say N. | ||
| 451 | |||
| 452 | config IDEDMA_ONLYDISK | 440 | config IDEDMA_ONLYDISK |
| 453 | bool "Enable DMA only for disks " | 441 | bool "Enable DMA only for disks " |
| 454 | depends on IDEDMA_PCI_AUTO | ||
| 455 | help | 442 | help |
| 456 | This is used if you know your ATAPI Devices are going to fail DMA | 443 | This is used if you know your ATAPI Devices are going to fail DMA |
| 457 | Transfers. | 444 | Transfers. |
| @@ -769,6 +756,14 @@ config BLK_DEV_TC86C001 | |||
| 769 | help | 756 | help |
| 770 | This driver adds support for Toshiba TC86C001 GOKU-S chip. | 757 | This driver adds support for Toshiba TC86C001 GOKU-S chip. |
| 771 | 758 | ||
| 759 | config BLK_DEV_CELLEB | ||
| 760 | tristate "Toshiba's Cell Reference Set IDE support" | ||
| 761 | depends on PPC_CELLEB | ||
| 762 | help | ||
| 763 | This driver provides support for the built-in IDE controller on | ||
| 764 | Toshiba Cell Reference Board. | ||
| 765 | If unsure, say Y. | ||
| 766 | |||
| 772 | endif | 767 | endif |
| 773 | 768 | ||
| 774 | config BLK_DEV_IDE_PMAC | 769 | config BLK_DEV_IDE_PMAC |
| @@ -800,14 +795,6 @@ config BLK_DEV_IDEDMA_PMAC | |||
| 800 | to transfer data to and from memory. Saying Y is safe and improves | 795 | to transfer data to and from memory. Saying Y is safe and improves |
| 801 | performance. | 796 | performance. |
| 802 | 797 | ||
| 803 | config BLK_DEV_IDE_CELLEB | ||
| 804 | bool "Toshiba's Cell Reference Set IDE support" | ||
| 805 | depends on PPC_CELLEB | ||
| 806 | help | ||
| 807 | This driver provides support for the built-in IDE controller on | ||
| 808 | Toshiba Cell Reference Board. | ||
| 809 | If unsure, say Y. | ||
| 810 | |||
| 811 | config BLK_DEV_IDE_SWARM | 798 | config BLK_DEV_IDE_SWARM |
| 812 | tristate "IDE for Sibyte evaluation boards" | 799 | tristate "IDE for Sibyte evaluation boards" |
| 813 | depends on SIBYTE_SB1xxx_SOC | 800 | depends on SIBYTE_SB1xxx_SOC |
| @@ -851,19 +838,6 @@ config BLK_DEV_IDEDMA_ICS | |||
| 851 | Say Y here if you want to add DMA (Direct Memory Access) support to | 838 | Say Y here if you want to add DMA (Direct Memory Access) support to |
| 852 | the ICS IDE driver. | 839 | the ICS IDE driver. |
| 853 | 840 | ||
| 854 | config IDEDMA_ICS_AUTO | ||
| 855 | bool "Use ICS DMA by default" | ||
| 856 | depends on BLK_DEV_IDEDMA_ICS | ||
| 857 | help | ||
| 858 | Prior to kernel version 2.1.112, Linux used to automatically use | ||
| 859 | DMA for IDE drives and chipsets which support it. Due to concerns | ||
| 860 | about a couple of cases where buggy hardware may have caused damage, | ||
| 861 | the default is now to NOT use DMA automatically. To revert to the | ||
| 862 | previous behaviour, say Y to this question. | ||
| 863 | |||
| 864 | If you suspect your hardware is at all flakey, say N here. | ||
| 865 | Do NOT email the IDE kernel people regarding this issue! | ||
| 866 | |||
| 867 | config BLK_DEV_IDE_RAPIDE | 841 | config BLK_DEV_IDE_RAPIDE |
| 868 | tristate "RapIDE interface support" | 842 | tristate "RapIDE interface support" |
| 869 | depends on ARM && ARCH_ACORN | 843 | depends on ARM && ARCH_ACORN |
| @@ -1086,9 +1060,6 @@ config IDEDMA_IVB | |||
| 1086 | 1060 | ||
| 1087 | It is normally safe to answer Y; however, the default is N. | 1061 | It is normally safe to answer Y; however, the default is N. |
| 1088 | 1062 | ||
| 1089 | config IDEDMA_AUTO | ||
| 1090 | def_bool IDEDMA_PCI_AUTO || IDEDMA_ICS_AUTO | ||
| 1091 | |||
| 1092 | endif | 1063 | endif |
| 1093 | 1064 | ||
| 1094 | config BLK_DEV_HD_ONLY | 1065 | config BLK_DEV_HD_ONLY |
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index 28feedfbd21d..d9f029e8ff74 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile | |||
| @@ -37,7 +37,6 @@ ide-core-$(CONFIG_BLK_DEV_Q40IDE) += legacy/q40ide.o | |||
| 37 | # built-in only drivers from ppc/ | 37 | # built-in only drivers from ppc/ |
| 38 | ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o | 38 | ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o |
| 39 | ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o | 39 | ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o |
| 40 | ide-core-$(CONFIG_BLK_DEV_IDE_CELLEB) += ppc/scc_pata.o | ||
| 41 | 40 | ||
| 42 | # built-in only drivers from h8300/ | 41 | # built-in only drivers from h8300/ |
| 43 | ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o | 42 | ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o |
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 40e5c66b81ce..e2953fc1fafb 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
| @@ -196,11 +196,6 @@ static void icside_maskproc(ide_drive_t *drive, int mask) | |||
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | #ifdef CONFIG_BLK_DEV_IDEDMA_ICS | 198 | #ifdef CONFIG_BLK_DEV_IDEDMA_ICS |
| 199 | |||
| 200 | #ifndef CONFIG_IDEDMA_ICS_AUTO | ||
| 201 | #warning CONFIG_IDEDMA_ICS_AUTO=n support is obsolete, and will be removed soon. | ||
| 202 | #endif | ||
| 203 | |||
| 204 | /* | 199 | /* |
| 205 | * SG-DMA support. | 200 | * SG-DMA support. |
| 206 | * | 201 | * |
| @@ -474,12 +469,6 @@ static int icside_dma_lostirq(ide_drive_t *drive) | |||
| 474 | 469 | ||
| 475 | static void icside_dma_init(ide_hwif_t *hwif) | 470 | static void icside_dma_init(ide_hwif_t *hwif) |
| 476 | { | 471 | { |
| 477 | int autodma = 0; | ||
| 478 | |||
| 479 | #ifdef CONFIG_IDEDMA_ICS_AUTO | ||
| 480 | autodma = 1; | ||
| 481 | #endif | ||
| 482 | |||
| 483 | printk(" %s: SG-DMA", hwif->name); | 472 | printk(" %s: SG-DMA", hwif->name); |
| 484 | 473 | ||
| 485 | hwif->atapi_dma = 1; | 474 | hwif->atapi_dma = 1; |
| @@ -489,7 +478,7 @@ static void icside_dma_init(ide_hwif_t *hwif) | |||
| 489 | hwif->dmatable_cpu = NULL; | 478 | hwif->dmatable_cpu = NULL; |
| 490 | hwif->dmatable_dma = 0; | 479 | hwif->dmatable_dma = 0; |
| 491 | hwif->speedproc = icside_set_speed; | 480 | hwif->speedproc = icside_set_speed; |
| 492 | hwif->autodma = autodma; | 481 | hwif->autodma = 1; |
| 493 | 482 | ||
| 494 | hwif->ide_dma_check = icside_dma_check; | 483 | hwif->ide_dma_check = icside_dma_check; |
| 495 | hwif->dma_host_off = icside_dma_host_off; | 484 | hwif->dma_host_off = icside_dma_host_off; |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 45a928c058cf..638becda81c6 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
| @@ -735,6 +735,15 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) | |||
| 735 | cdrom_saw_media_change (drive); | 735 | cdrom_saw_media_change (drive); |
| 736 | /*printk("%s: media changed\n",drive->name);*/ | 736 | /*printk("%s: media changed\n",drive->name);*/ |
| 737 | return 0; | 737 | return 0; |
| 738 | } else if ((sense_key == ILLEGAL_REQUEST) && | ||
| 739 | (rq->cmd[0] == GPCMD_START_STOP_UNIT)) { | ||
| 740 | /* | ||
| 741 | * Don't print error message for this condition-- | ||
| 742 | * SFF8090i indicates that 5/24/00 is the correct | ||
| 743 | * response to a request to close the tray if the | ||
| 744 | * drive doesn't have that capability. | ||
| 745 | * cdrom_log_sense() knows this! | ||
| 746 | */ | ||
| 738 | } else if (!(rq->cmd_flags & REQ_QUIET)) { | 747 | } else if (!(rq->cmd_flags & REQ_QUIET)) { |
| 739 | /* Otherwise, print an error. */ | 748 | /* Otherwise, print an error. */ |
| 740 | ide_dump_status(drive, "packet command error", stat); | 749 | ide_dump_status(drive, "packet command error", stat); |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 08e7cd043bcc..fd213088b06b 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
| @@ -767,7 +767,7 @@ int ide_set_dma(ide_drive_t *drive) | |||
| 767 | switch(rc) { | 767 | switch(rc) { |
| 768 | case -1: /* DMA needs to be disabled */ | 768 | case -1: /* DMA needs to be disabled */ |
| 769 | hwif->dma_off_quietly(drive); | 769 | hwif->dma_off_quietly(drive); |
| 770 | return 0; | 770 | return -1; |
| 771 | case 0: /* DMA needs to be enabled */ | 771 | case 0: /* DMA needs to be enabled */ |
| 772 | return hwif->ide_dma_on(drive); | 772 | return hwif->ide_dma_on(drive); |
| 773 | case 1: /* DMA setting cannot be changed */ | 773 | case 1: /* DMA setting cannot be changed */ |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index c193553f6fe7..8670112f1d39 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
| @@ -519,21 +519,24 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 | |||
| 519 | if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) | 519 | if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ && hwif->err_stops_fifo == 0) |
| 520 | try_to_flush_leftover_data(drive); | 520 | try_to_flush_leftover_data(drive); |
| 521 | 521 | ||
| 522 | if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) { | ||
| 523 | ide_kill_rq(drive, rq); | ||
| 524 | return ide_stopped; | ||
| 525 | } | ||
| 526 | |||
| 522 | if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) | 527 | if (hwif->INB(IDE_STATUS_REG) & (BUSY_STAT|DRQ_STAT)) |
| 523 | /* force an abort */ | 528 | rq->errors |= ERROR_RESET; |
| 524 | hwif->OUTB(WIN_IDLEIMMEDIATE, IDE_COMMAND_REG); | ||
| 525 | 529 | ||
| 526 | if (rq->errors >= ERROR_MAX || blk_noretry_request(rq)) | 530 | if ((rq->errors & ERROR_RESET) == ERROR_RESET) { |
| 527 | ide_kill_rq(drive, rq); | ||
| 528 | else { | ||
| 529 | if ((rq->errors & ERROR_RESET) == ERROR_RESET) { | ||
| 530 | ++rq->errors; | ||
| 531 | return ide_do_reset(drive); | ||
| 532 | } | ||
| 533 | if ((rq->errors & ERROR_RECAL) == ERROR_RECAL) | ||
| 534 | drive->special.b.recalibrate = 1; | ||
| 535 | ++rq->errors; | 531 | ++rq->errors; |
| 532 | return ide_do_reset(drive); | ||
| 536 | } | 533 | } |
| 534 | |||
| 535 | if ((rq->errors & ERROR_RECAL) == ERROR_RECAL) | ||
| 536 | drive->special.b.recalibrate = 1; | ||
| 537 | |||
| 538 | ++rq->errors; | ||
| 539 | |||
| 537 | return ide_stopped; | 540 | return ide_stopped; |
| 538 | } | 541 | } |
| 539 | 542 | ||
| @@ -1025,6 +1028,13 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) | |||
| 1025 | if (!drive->special.all) { | 1028 | if (!drive->special.all) { |
| 1026 | ide_driver_t *drv; | 1029 | ide_driver_t *drv; |
| 1027 | 1030 | ||
| 1031 | /* | ||
| 1032 | * We reset the drive so we need to issue a SETFEATURES. | ||
| 1033 | * Do it _after_ do_special() restored device parameters. | ||
| 1034 | */ | ||
| 1035 | if (drive->current_speed == 0xff) | ||
| 1036 | ide_config_drive_speed(drive, drive->desired_speed); | ||
| 1037 | |||
| 1028 | if (rq->cmd_type == REQ_TYPE_ATA_CMD || | 1038 | if (rq->cmd_type == REQ_TYPE_ATA_CMD || |
| 1029 | rq->cmd_type == REQ_TYPE_ATA_TASK || | 1039 | rq->cmd_type == REQ_TYPE_ATA_TASK || |
| 1030 | rq->cmd_type == REQ_TYPE_ATA_TASKFILE) | 1040 | rq->cmd_type == REQ_TYPE_ATA_TASKFILE) |
| @@ -1216,6 +1226,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) | |||
| 1216 | #endif | 1226 | #endif |
| 1217 | /* so that ide_timer_expiry knows what to do */ | 1227 | /* so that ide_timer_expiry knows what to do */ |
| 1218 | hwgroup->sleeping = 1; | 1228 | hwgroup->sleeping = 1; |
| 1229 | hwgroup->req_gen_timer = hwgroup->req_gen; | ||
| 1219 | mod_timer(&hwgroup->timer, sleep); | 1230 | mod_timer(&hwgroup->timer, sleep); |
| 1220 | /* we purposely leave hwgroup->busy==1 | 1231 | /* we purposely leave hwgroup->busy==1 |
| 1221 | * while sleeping */ | 1232 | * while sleeping */ |
| @@ -1401,7 +1412,8 @@ void ide_timer_expiry (unsigned long data) | |||
| 1401 | 1412 | ||
| 1402 | spin_lock_irqsave(&ide_lock, flags); | 1413 | spin_lock_irqsave(&ide_lock, flags); |
| 1403 | 1414 | ||
| 1404 | if ((handler = hwgroup->handler) == NULL) { | 1415 | if (((handler = hwgroup->handler) == NULL) || |
| 1416 | (hwgroup->req_gen != hwgroup->req_gen_timer)) { | ||
| 1405 | /* | 1417 | /* |
| 1406 | * Either a marginal timeout occurred | 1418 | * Either a marginal timeout occurred |
| 1407 | * (got the interrupt just as timer expired), | 1419 | * (got the interrupt just as timer expired), |
| @@ -1429,6 +1441,7 @@ void ide_timer_expiry (unsigned long data) | |||
| 1429 | if ((wait = expiry(drive)) > 0) { | 1441 | if ((wait = expiry(drive)) > 0) { |
| 1430 | /* reset timer */ | 1442 | /* reset timer */ |
| 1431 | hwgroup->timer.expires = jiffies + wait; | 1443 | hwgroup->timer.expires = jiffies + wait; |
| 1444 | hwgroup->req_gen_timer = hwgroup->req_gen; | ||
| 1432 | add_timer(&hwgroup->timer); | 1445 | add_timer(&hwgroup->timer); |
| 1433 | spin_unlock_irqrestore(&ide_lock, flags); | 1446 | spin_unlock_irqrestore(&ide_lock, flags); |
| 1434 | return; | 1447 | return; |
| @@ -1643,6 +1656,7 @@ irqreturn_t ide_intr (int irq, void *dev_id) | |||
| 1643 | printk(KERN_ERR "%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name); | 1656 | printk(KERN_ERR "%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name); |
| 1644 | } | 1657 | } |
| 1645 | hwgroup->handler = NULL; | 1658 | hwgroup->handler = NULL; |
| 1659 | hwgroup->req_gen++; | ||
| 1646 | del_timer(&hwgroup->timer); | 1660 | del_timer(&hwgroup->timer); |
| 1647 | spin_unlock(&ide_lock); | 1661 | spin_unlock(&ide_lock); |
| 1648 | 1662 | ||
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index bd513f5a2323..3caa176b3155 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
| @@ -583,8 +583,12 @@ u8 eighty_ninty_three (ide_drive_t *drive) | |||
| 583 | if(!(drive->id->hw_config & 0x4000)) | 583 | if(!(drive->id->hw_config & 0x4000)) |
| 584 | return 0; | 584 | return 0; |
| 585 | #endif /* CONFIG_IDEDMA_IVB */ | 585 | #endif /* CONFIG_IDEDMA_IVB */ |
| 586 | if (!(drive->id->hw_config & 0x2000)) | 586 | /* |
| 587 | return 0; | 587 | * FIXME: |
| 588 | * - change master/slave IDENTIFY order | ||
| 589 | * - force bit13 (80c cable present) check | ||
| 590 | * (unless the slave device is pre-ATA3) | ||
| 591 | */ | ||
| 588 | return 1; | 592 | return 1; |
| 589 | } | 593 | } |
| 590 | 594 | ||
| @@ -885,6 +889,7 @@ static void __ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, | |||
| 885 | hwgroup->handler = handler; | 889 | hwgroup->handler = handler; |
| 886 | hwgroup->expiry = expiry; | 890 | hwgroup->expiry = expiry; |
| 887 | hwgroup->timer.expires = jiffies + timeout; | 891 | hwgroup->timer.expires = jiffies + timeout; |
| 892 | hwgroup->req_gen_timer = hwgroup->req_gen; | ||
| 888 | add_timer(&hwgroup->timer); | 893 | add_timer(&hwgroup->timer); |
| 889 | } | 894 | } |
| 890 | 895 | ||
| @@ -925,6 +930,7 @@ void ide_execute_command(ide_drive_t *drive, task_ioreg_t cmd, ide_handler_t *ha | |||
| 925 | hwgroup->handler = handler; | 930 | hwgroup->handler = handler; |
| 926 | hwgroup->expiry = expiry; | 931 | hwgroup->expiry = expiry; |
| 927 | hwgroup->timer.expires = jiffies + timeout; | 932 | hwgroup->timer.expires = jiffies + timeout; |
| 933 | hwgroup->req_gen_timer = hwgroup->req_gen; | ||
| 928 | add_timer(&hwgroup->timer); | 934 | add_timer(&hwgroup->timer); |
| 929 | hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); | 935 | hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); |
| 930 | /* Drive takes 400nS to respond, we must avoid the IRQ being | 936 | /* Drive takes 400nS to respond, we must avoid the IRQ being |
| @@ -1090,6 +1096,9 @@ static void pre_reset(ide_drive_t *drive) | |||
| 1090 | if (HWIF(drive)->pre_reset != NULL) | 1096 | if (HWIF(drive)->pre_reset != NULL) |
| 1091 | HWIF(drive)->pre_reset(drive); | 1097 | HWIF(drive)->pre_reset(drive); |
| 1092 | 1098 | ||
| 1099 | if (drive->current_speed != 0xff) | ||
| 1100 | drive->desired_speed = drive->current_speed; | ||
| 1101 | drive->current_speed = 0xff; | ||
| 1093 | } | 1102 | } |
| 1094 | 1103 | ||
| 1095 | /* | 1104 | /* |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index dfbd74458522..ae5bf2be6f52 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
| @@ -177,11 +177,7 @@ DECLARE_MUTEX(ide_cfg_sem); | |||
| 177 | static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ | 177 | static int ide_scan_direction; /* THIS was formerly 2.2.x pci=reverse */ |
| 178 | #endif | 178 | #endif |
| 179 | 179 | ||
| 180 | #ifdef CONFIG_IDEDMA_AUTO | ||
| 181 | int noautodma = 0; | 180 | int noautodma = 0; |
| 182 | #else | ||
| 183 | int noautodma = 1; | ||
| 184 | #endif | ||
| 185 | 181 | ||
| 186 | EXPORT_SYMBOL(noautodma); | 182 | EXPORT_SYMBOL(noautodma); |
| 187 | 183 | ||
| @@ -1128,17 +1124,40 @@ static int set_io_32bit(ide_drive_t *drive, int arg) | |||
| 1128 | static int set_using_dma (ide_drive_t *drive, int arg) | 1124 | static int set_using_dma (ide_drive_t *drive, int arg) |
| 1129 | { | 1125 | { |
| 1130 | #ifdef CONFIG_BLK_DEV_IDEDMA | 1126 | #ifdef CONFIG_BLK_DEV_IDEDMA |
| 1127 | ide_hwif_t *hwif = drive->hwif; | ||
| 1128 | int err = -EPERM; | ||
| 1129 | |||
| 1131 | if (!drive->id || !(drive->id->capability & 1)) | 1130 | if (!drive->id || !(drive->id->capability & 1)) |
| 1132 | return -EPERM; | 1131 | goto out; |
| 1133 | if (HWIF(drive)->ide_dma_check == NULL) | 1132 | |
| 1134 | return -EPERM; | 1133 | if (hwif->ide_dma_check == NULL) |
| 1134 | goto out; | ||
| 1135 | |||
| 1136 | err = -EBUSY; | ||
| 1137 | if (ide_spin_wait_hwgroup(drive)) | ||
| 1138 | goto out; | ||
| 1139 | /* | ||
| 1140 | * set ->busy flag, unlock and let it ride | ||
| 1141 | */ | ||
| 1142 | hwif->hwgroup->busy = 1; | ||
| 1143 | spin_unlock_irq(&ide_lock); | ||
| 1144 | |||
| 1145 | err = 0; | ||
| 1146 | |||
| 1135 | if (arg) { | 1147 | if (arg) { |
| 1136 | if (ide_set_dma(drive)) | 1148 | if (ide_set_dma(drive) || hwif->ide_dma_on(drive)) |
| 1137 | return -EIO; | 1149 | err = -EIO; |
| 1138 | if (HWIF(drive)->ide_dma_on(drive)) return -EIO; | ||
| 1139 | } else | 1150 | } else |
| 1140 | ide_dma_off(drive); | 1151 | ide_dma_off(drive); |
| 1141 | return 0; | 1152 | |
| 1153 | /* | ||
| 1154 | * lock, clear ->busy flag and unlock before leaving | ||
| 1155 | */ | ||
| 1156 | spin_lock_irq(&ide_lock); | ||
| 1157 | hwif->hwgroup->busy = 0; | ||
| 1158 | spin_unlock_irq(&ide_lock); | ||
| 1159 | out: | ||
| 1160 | return err; | ||
| 1142 | #else | 1161 | #else |
| 1143 | return -EPERM; | 1162 | return -EPERM; |
| 1144 | #endif | 1163 | #endif |
| @@ -1943,6 +1962,8 @@ static char *media_string(ide_drive_t *drive) | |||
| 1943 | return "tape"; | 1962 | return "tape"; |
| 1944 | case ide_floppy: | 1963 | case ide_floppy: |
| 1945 | return "floppy"; | 1964 | return "floppy"; |
| 1965 | case ide_optical: | ||
| 1966 | return "optical"; | ||
| 1946 | default: | 1967 | default: |
| 1947 | return "UNKNOWN"; | 1968 | return "UNKNOWN"; |
| 1948 | } | 1969 | } |
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c index b2dc028dc8ca..d54d9fe92a7d 100644 --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c | |||
| @@ -639,6 +639,7 @@ static int au_ide_probe(struct device *dev) | |||
| 639 | _auide_hwif *ahwif = &auide_hwif; | 639 | _auide_hwif *ahwif = &auide_hwif; |
| 640 | ide_hwif_t *hwif; | 640 | ide_hwif_t *hwif; |
| 641 | struct resource *res; | 641 | struct resource *res; |
| 642 | hw_regs_t *hw; | ||
| 642 | int ret = 0; | 643 | int ret = 0; |
| 643 | 644 | ||
| 644 | #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) | 645 | #if defined(CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA) |
| @@ -681,7 +682,7 @@ static int au_ide_probe(struct device *dev) | |||
| 681 | /* FIXME: This might possibly break PCMCIA IDE devices */ | 682 | /* FIXME: This might possibly break PCMCIA IDE devices */ |
| 682 | 683 | ||
| 683 | hwif = &ide_hwifs[pdev->id]; | 684 | hwif = &ide_hwifs[pdev->id]; |
| 684 | hw_regs_t *hw = &hwif->hw; | 685 | hw = &hwif->hw; |
| 685 | hwif->irq = hw->irq = ahwif->irq; | 686 | hwif->irq = hw->irq = ahwif->irq; |
| 686 | hwif->chipset = ide_au1xxx; | 687 | hwif->chipset = ide_au1xxx; |
| 687 | 688 | ||
diff --git a/drivers/ide/pci/Makefile b/drivers/ide/pci/Makefile index 6591ff4753cb..95d1ea8f1f14 100644 --- a/drivers/ide/pci/Makefile +++ b/drivers/ide/pci/Makefile | |||
| @@ -3,6 +3,7 @@ obj-$(CONFIG_BLK_DEV_AEC62XX) += aec62xx.o | |||
| 3 | obj-$(CONFIG_BLK_DEV_ALI15X3) += alim15x3.o | 3 | obj-$(CONFIG_BLK_DEV_ALI15X3) += alim15x3.o |
| 4 | obj-$(CONFIG_BLK_DEV_AMD74XX) += amd74xx.o | 4 | obj-$(CONFIG_BLK_DEV_AMD74XX) += amd74xx.o |
| 5 | obj-$(CONFIG_BLK_DEV_ATIIXP) += atiixp.o | 5 | obj-$(CONFIG_BLK_DEV_ATIIXP) += atiixp.o |
| 6 | obj-$(CONFIG_BLK_DEV_CELLEB) += scc_pata.o | ||
| 6 | obj-$(CONFIG_BLK_DEV_CMD64X) += cmd64x.o | 7 | obj-$(CONFIG_BLK_DEV_CMD64X) += cmd64x.o |
| 7 | obj-$(CONFIG_BLK_DEV_CS5520) += cs5520.o | 8 | obj-$(CONFIG_BLK_DEV_CS5520) += cs5520.o |
| 8 | obj-$(CONFIG_BLK_DEV_CS5530) += cs5530.o | 9 | obj-$(CONFIG_BLK_DEV_CS5530) += cs5530.o |
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index b0d4825c56a9..561197f7b5bb 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16 | 1 | /* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16 |
| 2 | * | 2 | * |
| 3 | * linux/drivers/ide/pci/cmd64x.c Version 1.41 Feb 3, 2007 | 3 | * linux/drivers/ide/pci/cmd64x.c Version 1.42 Feb 8, 2007 |
| 4 | * | 4 | * |
| 5 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. | 5 | * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. |
| 6 | * Note, this driver is not used at all on other systems because | 6 | * Note, this driver is not used at all on other systems because |
| @@ -189,6 +189,11 @@ static int cmd64x_get_info (char *buffer, char **addr, off_t offset, int count) | |||
| 189 | 189 | ||
| 190 | #endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */ | 190 | #endif /* defined(DISPLAY_CMD64X_TIMINGS) && defined(CONFIG_PROC_FS) */ |
| 191 | 191 | ||
| 192 | static u8 quantize_timing(int timing, int quant) | ||
| 193 | { | ||
| 194 | return (timing + quant - 1) / quant; | ||
| 195 | } | ||
| 196 | |||
| 192 | /* | 197 | /* |
| 193 | * This routine writes the prepared setup/active/recovery counts | 198 | * This routine writes the prepared setup/active/recovery counts |
| 194 | * for a drive into the cmd646 chipset registers to active them. | 199 | * for a drive into the cmd646 chipset registers to active them. |
| @@ -268,47 +273,37 @@ static void program_drive_counts (ide_drive_t *drive, int setup_count, int activ | |||
| 268 | */ | 273 | */ |
| 269 | static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) | 274 | static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) |
| 270 | { | 275 | { |
| 271 | int setup_time, active_time, recovery_time; | 276 | int setup_time, active_time, cycle_time; |
| 272 | int clock_time, pio_mode, cycle_time; | 277 | u8 cycle_count, setup_count, active_count, recovery_count; |
| 273 | u8 recovery_count2, cycle_count; | 278 | u8 pio_mode; |
| 274 | int setup_count, active_count, recovery_count; | 279 | int clock_time = 1000 / system_bus_clock(); |
| 275 | int bus_speed = system_bus_clock(); | 280 | ide_pio_data_t pio; |
| 276 | ide_pio_data_t d; | ||
| 277 | 281 | ||
| 278 | pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &d); | 282 | pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &pio); |
| 279 | cycle_time = d.cycle_time; | 283 | cycle_time = pio.cycle_time; |
| 280 | 284 | ||
| 281 | /* | ||
| 282 | * I copied all this complicated stuff from cmd640.c and made a few | ||
| 283 | * minor changes. For now I am just going to pray that it is correct. | ||
| 284 | */ | ||
| 285 | setup_time = ide_pio_timings[pio_mode].setup_time; | 285 | setup_time = ide_pio_timings[pio_mode].setup_time; |
| 286 | active_time = ide_pio_timings[pio_mode].active_time; | 286 | active_time = ide_pio_timings[pio_mode].active_time; |
| 287 | recovery_time = cycle_time - (setup_time + active_time); | ||
| 288 | clock_time = 1000 / bus_speed; | ||
| 289 | cycle_count = (cycle_time + clock_time - 1) / clock_time; | ||
| 290 | |||
| 291 | setup_count = (setup_time + clock_time - 1) / clock_time; | ||
| 292 | 287 | ||
| 293 | active_count = (active_time + clock_time - 1) / clock_time; | 288 | setup_count = quantize_timing( setup_time, clock_time); |
| 289 | cycle_count = quantize_timing( cycle_time, clock_time); | ||
| 290 | active_count = quantize_timing(active_time, clock_time); | ||
| 294 | 291 | ||
| 295 | recovery_count = (recovery_time + clock_time - 1) / clock_time; | 292 | recovery_count = cycle_count - active_count; |
| 296 | recovery_count2 = cycle_count - (setup_count + active_count); | 293 | /* program_drive_counts() takes care of zero recovery cycles */ |
| 297 | if (recovery_count2 > recovery_count) | ||
| 298 | recovery_count = recovery_count2; | ||
| 299 | if (recovery_count > 16) { | 294 | if (recovery_count > 16) { |
| 300 | active_count += recovery_count - 16; | 295 | active_count += recovery_count - 16; |
| 301 | recovery_count = 16; | 296 | recovery_count = 16; |
| 302 | } | 297 | } |
| 303 | if (active_count > 16) | 298 | if (active_count > 16) |
| 304 | active_count = 16; /* maximum allowed by cmd646 */ | 299 | active_count = 16; /* maximum allowed by cmd64x */ |
| 305 | 300 | ||
| 306 | program_drive_counts (drive, setup_count, active_count, recovery_count); | 301 | program_drive_counts (drive, setup_count, active_count, recovery_count); |
| 307 | 302 | ||
| 308 | cmdprintk("%s: PIO mode wanted %d, selected %d (%dns)%s, " | 303 | cmdprintk("%s: PIO mode wanted %d, selected %d (%dns)%s, " |
| 309 | "clocks=%d/%d/%d\n", | 304 | "clocks=%d/%d/%d\n", |
| 310 | drive->name, mode_wanted, pio_mode, cycle_time, | 305 | drive->name, mode_wanted, pio_mode, cycle_time, |
| 311 | d.overridden ? " (overriding vendor mode)" : "", | 306 | pio.overridden ? " (overriding vendor mode)" : "", |
| 312 | setup_count, active_count, recovery_count); | 307 | setup_count, active_count, recovery_count); |
| 313 | 308 | ||
| 314 | return pio_mode; | 309 | return pio_mode; |
diff --git a/drivers/ide/pci/delkin_cb.c b/drivers/ide/pci/delkin_cb.c index d4b753e70119..dd7ec37fdeab 100644 --- a/drivers/ide/pci/delkin_cb.c +++ b/drivers/ide/pci/delkin_cb.c | |||
| @@ -108,6 +108,7 @@ delkin_cb_remove (struct pci_dev *dev) | |||
| 108 | 108 | ||
| 109 | static struct pci_device_id delkin_cb_pci_tbl[] __devinitdata = { | 109 | static struct pci_device_id delkin_cb_pci_tbl[] __devinitdata = { |
| 110 | { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 110 | { 0x1145, 0xf021, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, |
| 111 | { 0x1145, 0xf024, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | ||
| 111 | { 0, }, | 112 | { 0, }, |
| 112 | }; | 113 | }; |
| 113 | MODULE_DEVICE_TABLE(pci, delkin_cb_pci_tbl); | 114 | MODULE_DEVICE_TABLE(pci, delkin_cb_pci_tbl); |
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 60ecdc258c7c..ab6fa271aeb3 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
| @@ -1,10 +1,10 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * linux/drivers/ide/pci/hpt366.c Version 1.01 Dec 23, 2006 | 2 | * linux/drivers/ide/pci/hpt366.c Version 1.02 Apr 18, 2007 |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> |
| 5 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. | 5 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. |
| 6 | * Portions Copyright (C) 2003 Red Hat Inc | 6 | * Portions Copyright (C) 2003 Red Hat Inc |
| 7 | * Portions Copyright (C) 2005-2006 MontaVista Software, Inc. | 7 | * Portions Copyright (C) 2005-2007 MontaVista Software, Inc. |
| 8 | * | 8 | * |
| 9 | * Thanks to HighPoint Technologies for their assistance, and hardware. | 9 | * Thanks to HighPoint Technologies for their assistance, and hardware. |
| 10 | * Special Thanks to Jon Burchmore in SanDiego for the deep pockets, his | 10 | * Special Thanks to Jon Burchmore in SanDiego for the deep pockets, his |
| @@ -494,6 +494,7 @@ static struct hpt_info hpt302n __devinitdata = { | |||
| 494 | .chip_type = HPT302N, | 494 | .chip_type = HPT302N, |
| 495 | .max_mode = HPT302_ALLOW_ATA133_6 ? 4 : 3, | 495 | .max_mode = HPT302_ALLOW_ATA133_6 ? 4 : 3, |
| 496 | .dpll_clk = 77, | 496 | .dpll_clk = 77, |
| 497 | .settings = hpt37x_settings | ||
| 497 | }; | 498 | }; |
| 498 | 499 | ||
| 499 | static struct hpt_info hpt371n __devinitdata = { | 500 | static struct hpt_info hpt371n __devinitdata = { |
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index 53f25500c22b..be4fc96c29e0 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c | |||
| @@ -240,12 +240,31 @@ static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_devi | |||
| 240 | return 0; | 240 | return 0; |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | /* If libata is configured, jmicron PCI quirk will configure it such | ||
| 244 | * that the SATA ports are in AHCI function while the PATA ports are | ||
| 245 | * in a separate IDE function. In such cases, match device class and | ||
| 246 | * attach only to IDE. If libata isn't configured, keep the old | ||
| 247 | * behavior for backward compatibility. | ||
| 248 | */ | ||
| 249 | #if defined(CONFIG_ATA) || defined(CONFIG_ATA_MODULE) | ||
| 250 | #define JMB_CLASS PCI_CLASS_STORAGE_IDE << 8 | ||
| 251 | #define JMB_CLASS_MASK 0xffff00 | ||
| 252 | #else | ||
| 253 | #define JMB_CLASS 0 | ||
| 254 | #define JMB_CLASS_MASK 0 | ||
| 255 | #endif | ||
| 256 | |||
| 243 | static struct pci_device_id jmicron_pci_tbl[] = { | 257 | static struct pci_device_id jmicron_pci_tbl[] = { |
| 244 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, | 258 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, |
| 245 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, | 259 | PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 0}, |
| 246 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, | 260 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, |
| 247 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, | 261 | PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 1}, |
| 248 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, | 262 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, |
| 263 | PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 2}, | ||
| 264 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, | ||
| 265 | PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 3}, | ||
| 266 | { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368, | ||
| 267 | PCI_ANY_ID, PCI_ANY_ID, JMB_CLASS, JMB_CLASS_MASK, 4}, | ||
| 249 | { 0, }, | 268 | { 0, }, |
| 250 | }; | 269 | }; |
| 251 | 270 | ||
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c index 6ceb25bc5a7b..ace98929cc3d 100644 --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c | |||
| @@ -255,7 +255,7 @@ static int config_chipset_for_dma(ide_drive_t *drive) | |||
| 255 | printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name); | 255 | printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name); |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | if (drive->media != ide_disk) | 258 | if (drive->media != ide_disk && drive->media != ide_cdrom) |
| 259 | return 0; | 259 | return 0; |
| 260 | 260 | ||
| 261 | if (id->capability & 4) { | 261 | if (id->capability & 4) { |
| @@ -545,6 +545,7 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif) | |||
| 545 | 545 | ||
| 546 | hwif->drives[0].autotune = hwif->drives[1].autotune = 1; | 546 | hwif->drives[0].autotune = hwif->drives[1].autotune = 1; |
| 547 | 547 | ||
| 548 | hwif->atapi_dma = 1; | ||
| 548 | hwif->ultra_mask = 0x7f; | 549 | hwif->ultra_mask = 0x7f; |
| 549 | hwif->mwdma_mask = 0x07; | 550 | hwif->mwdma_mask = 0x07; |
| 550 | 551 | ||
diff --git a/drivers/ide/ppc/scc_pata.c b/drivers/ide/pci/scc_pata.c index f84bf791f72e..f84bf791f72e 100644 --- a/drivers/ide/ppc/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index a52c80fe7d3e..118fb3205ca8 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
| @@ -505,11 +505,6 @@ static void ide_hwif_setup_dma(struct pci_dev *dev, ide_pci_device_t *d, ide_hwi | |||
| 505 | } | 505 | } |
| 506 | } | 506 | } |
| 507 | } | 507 | } |
| 508 | |||
| 509 | #ifndef CONFIG_IDEDMA_PCI_AUTO | ||
| 510 | #warning CONFIG_IDEDMA_PCI_AUTO=n support is obsolete, and will be removed soon. | ||
| 511 | #endif | ||
| 512 | |||
| 513 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ | 508 | #endif /* CONFIG_BLK_DEV_IDEDMA_PCI*/ |
| 514 | 509 | ||
| 515 | /** | 510 | /** |
diff --git a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig index b8a47342cd2c..cd84a55ecf20 100644 --- a/drivers/ieee1394/Kconfig +++ b/drivers/ieee1394/Kconfig | |||
| @@ -138,9 +138,9 @@ config IEEE1394_DV1394 | |||
| 138 | tristate "OHCI-DV I/O support (deprecated)" | 138 | tristate "OHCI-DV I/O support (deprecated)" |
| 139 | depends on IEEE1394 && IEEE1394_OHCI1394 | 139 | depends on IEEE1394 && IEEE1394_OHCI1394 |
| 140 | help | 140 | help |
| 141 | The dv1394 driver will be removed from Linux in a future release. | 141 | The dv1394 driver is unsupported and may be removed from Linux in a |
| 142 | Its functionality is now provided by raw1394 together with libraries | 142 | future release. Its functionality is now provided by raw1394 together |
| 143 | such as libiec61883. | 143 | with libraries such as libiec61883. |
| 144 | 144 | ||
| 145 | config IEEE1394_RAWIO | 145 | config IEEE1394_RAWIO |
| 146 | tristate "Raw IEEE1394 I/O support" | 146 | tristate "Raw IEEE1394 I/O support" |
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index dee9529aa8e7..026e38face5c 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
| @@ -2564,8 +2564,8 @@ static int __init dv1394_init_module(void) | |||
| 2564 | int ret; | 2564 | int ret; |
| 2565 | 2565 | ||
| 2566 | printk(KERN_WARNING | 2566 | printk(KERN_WARNING |
| 2567 | "WARNING: The dv1394 driver is unsupported and will be removed " | 2567 | "NOTE: The dv1394 driver is unsupported and may be removed in a " |
| 2568 | "from Linux soon. Use raw1394 instead.\n"); | 2568 | "future Linux release. Use raw1394 instead.\n"); |
| 2569 | 2569 | ||
| 2570 | cdev_init(&dv1394_cdev, &dv1394_fops); | 2570 | cdev_init(&dv1394_cdev, &dv1394_fops); |
| 2571 | dv1394_cdev.owner = THIS_MODULE; | 2571 | dv1394_cdev.owner = THIS_MODULE; |
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index a95313521985..03e44b337eb0 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
| @@ -584,7 +584,10 @@ static void ether1394_add_host (struct hpsb_host *host) | |||
| 584 | } | 584 | } |
| 585 | 585 | ||
| 586 | SET_MODULE_OWNER(dev); | 586 | SET_MODULE_OWNER(dev); |
| 587 | #if 0 | ||
| 588 | /* FIXME - Is this the correct parent device anyway? */ | ||
| 587 | SET_NETDEV_DEV(dev, &host->device); | 589 | SET_NETDEV_DEV(dev, &host->device); |
| 590 | #endif | ||
| 588 | 591 | ||
| 589 | priv = netdev_priv(dev); | 592 | priv = netdev_priv(dev); |
| 590 | 593 | ||
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c index 818cf1aee8c7..f5e9aeec6f6e 100644 --- a/drivers/infiniband/hw/cxgb3/cxio_hal.c +++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c | |||
| @@ -498,9 +498,9 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p) | |||
| 498 | u64 sge_cmd, ctx0, ctx1; | 498 | u64 sge_cmd, ctx0, ctx1; |
| 499 | u64 base_addr; | 499 | u64 base_addr; |
| 500 | struct t3_modify_qp_wr *wqe; | 500 | struct t3_modify_qp_wr *wqe; |
| 501 | struct sk_buff *skb = alloc_skb(sizeof(*wqe), GFP_KERNEL); | 501 | struct sk_buff *skb; |
| 502 | |||
| 503 | 502 | ||
| 503 | skb = alloc_skb(sizeof(*wqe), GFP_KERNEL); | ||
| 504 | if (!skb) { | 504 | if (!skb) { |
| 505 | PDBG("%s alloc_skb failed\n", __FUNCTION__); | 505 | PDBG("%s alloc_skb failed\n", __FUNCTION__); |
| 506 | return -ENOMEM; | 506 | return -ENOMEM; |
| @@ -508,7 +508,7 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p) | |||
| 508 | err = cxio_hal_init_ctrl_cq(rdev_p); | 508 | err = cxio_hal_init_ctrl_cq(rdev_p); |
| 509 | if (err) { | 509 | if (err) { |
| 510 | PDBG("%s err %d initializing ctrl_cq\n", __FUNCTION__, err); | 510 | PDBG("%s err %d initializing ctrl_cq\n", __FUNCTION__, err); |
| 511 | return err; | 511 | goto err; |
| 512 | } | 512 | } |
| 513 | rdev_p->ctrl_qp.workq = dma_alloc_coherent( | 513 | rdev_p->ctrl_qp.workq = dma_alloc_coherent( |
| 514 | &(rdev_p->rnic_info.pdev->dev), | 514 | &(rdev_p->rnic_info.pdev->dev), |
| @@ -518,7 +518,8 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p) | |||
| 518 | GFP_KERNEL); | 518 | GFP_KERNEL); |
| 519 | if (!rdev_p->ctrl_qp.workq) { | 519 | if (!rdev_p->ctrl_qp.workq) { |
| 520 | PDBG("%s dma_alloc_coherent failed\n", __FUNCTION__); | 520 | PDBG("%s dma_alloc_coherent failed\n", __FUNCTION__); |
| 521 | return -ENOMEM; | 521 | err = -ENOMEM; |
| 522 | goto err; | ||
| 522 | } | 523 | } |
| 523 | pci_unmap_addr_set(&rdev_p->ctrl_qp, mapping, | 524 | pci_unmap_addr_set(&rdev_p->ctrl_qp, mapping, |
| 524 | rdev_p->ctrl_qp.dma_addr); | 525 | rdev_p->ctrl_qp.dma_addr); |
| @@ -556,6 +557,9 @@ static int cxio_hal_init_ctrl_qp(struct cxio_rdev *rdev_p) | |||
| 556 | rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2); | 557 | rdev_p->ctrl_qp.workq, 1 << T3_CTRL_QP_SIZE_LOG2); |
| 557 | skb->priority = CPL_PRIORITY_CONTROL; | 558 | skb->priority = CPL_PRIORITY_CONTROL; |
| 558 | return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb)); | 559 | return (cxgb3_ofld_send(rdev_p->t3cdev_p, skb)); |
| 560 | err: | ||
| 561 | kfree_skb(skb); | ||
| 562 | return err; | ||
| 559 | } | 563 | } |
| 560 | 564 | ||
| 561 | static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p) | 565 | static int cxio_hal_destroy_ctrl_qp(struct cxio_rdev *rdev_p) |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_cm.c b/drivers/infiniband/hw/cxgb3/iwch_cm.c index d0ed1d35ca3e..2d2de9b8b729 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_cm.c +++ b/drivers/infiniband/hw/cxgb3/iwch_cm.c | |||
| @@ -2026,6 +2026,17 @@ static int sched(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | |||
| 2026 | return 0; | 2026 | return 0; |
| 2027 | } | 2027 | } |
| 2028 | 2028 | ||
| 2029 | static int set_tcb_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx) | ||
| 2030 | { | ||
| 2031 | struct cpl_set_tcb_rpl *rpl = cplhdr(skb); | ||
| 2032 | |||
| 2033 | if (rpl->status != CPL_ERR_NONE) { | ||
| 2034 | printk(KERN_ERR MOD "Unexpected SET_TCB_RPL status %u " | ||
| 2035 | "for tid %u\n", rpl->status, GET_TID(rpl)); | ||
| 2036 | } | ||
| 2037 | return CPL_RET_BUF_DONE; | ||
| 2038 | } | ||
| 2039 | |||
| 2029 | int __init iwch_cm_init(void) | 2040 | int __init iwch_cm_init(void) |
| 2030 | { | 2041 | { |
| 2031 | skb_queue_head_init(&rxq); | 2042 | skb_queue_head_init(&rxq); |
| @@ -2053,6 +2064,7 @@ int __init iwch_cm_init(void) | |||
| 2053 | t3c_handlers[CPL_ABORT_REQ_RSS] = sched; | 2064 | t3c_handlers[CPL_ABORT_REQ_RSS] = sched; |
| 2054 | t3c_handlers[CPL_RDMA_TERMINATE] = sched; | 2065 | t3c_handlers[CPL_RDMA_TERMINATE] = sched; |
| 2055 | t3c_handlers[CPL_RDMA_EC_STATUS] = sched; | 2066 | t3c_handlers[CPL_RDMA_EC_STATUS] = sched; |
| 2067 | t3c_handlers[CPL_SET_TCB_RPL] = set_tcb_rpl; | ||
| 2056 | 2068 | ||
| 2057 | /* | 2069 | /* |
| 2058 | * These are the real handlers that are called from a | 2070 | * These are the real handlers that are called from a |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index f2774ae906bf..24e0df04f7db 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
| @@ -545,11 +545,14 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr, | |||
| 545 | php = to_iwch_pd(pd); | 545 | php = to_iwch_pd(pd); |
| 546 | if (mr_rereg_mask & IB_MR_REREG_ACCESS) | 546 | if (mr_rereg_mask & IB_MR_REREG_ACCESS) |
| 547 | mh.attr.perms = iwch_ib_to_tpt_access(acc); | 547 | mh.attr.perms = iwch_ib_to_tpt_access(acc); |
| 548 | if (mr_rereg_mask & IB_MR_REREG_TRANS) | 548 | if (mr_rereg_mask & IB_MR_REREG_TRANS) { |
| 549 | ret = build_phys_page_list(buffer_list, num_phys_buf, | 549 | ret = build_phys_page_list(buffer_list, num_phys_buf, |
| 550 | iova_start, | 550 | iova_start, |
| 551 | &total_size, &npages, | 551 | &total_size, &npages, |
| 552 | &shift, &page_list); | 552 | &shift, &page_list); |
| 553 | if (ret) | ||
| 554 | return ret; | ||
| 555 | } | ||
| 553 | 556 | ||
| 554 | ret = iwch_reregister_mem(rhp, php, &mh, shift, page_list, npages); | 557 | ret = iwch_reregister_mem(rhp, php, &mh, shift, page_list, npages); |
| 555 | kfree(page_list); | 558 | kfree(page_list); |
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c index 20f36bf8b2b6..f284be1c9166 100644 --- a/drivers/infiniband/hw/ehca/ehca_irq.c +++ b/drivers/infiniband/hw/ehca/ehca_irq.c | |||
| @@ -66,7 +66,9 @@ | |||
| 66 | static void queue_comp_task(struct ehca_cq *__cq); | 66 | static void queue_comp_task(struct ehca_cq *__cq); |
| 67 | 67 | ||
| 68 | static struct ehca_comp_pool* pool; | 68 | static struct ehca_comp_pool* pool; |
| 69 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 69 | static struct notifier_block comp_pool_callback_nb; | 70 | static struct notifier_block comp_pool_callback_nb; |
| 71 | #endif | ||
| 70 | 72 | ||
| 71 | static inline void comp_event_callback(struct ehca_cq *cq) | 73 | static inline void comp_event_callback(struct ehca_cq *cq) |
| 72 | { | 74 | { |
| @@ -733,6 +735,7 @@ static void take_over_work(struct ehca_comp_pool *pool, | |||
| 733 | 735 | ||
| 734 | } | 736 | } |
| 735 | 737 | ||
| 738 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 736 | static int comp_pool_callback(struct notifier_block *nfb, | 739 | static int comp_pool_callback(struct notifier_block *nfb, |
| 737 | unsigned long action, | 740 | unsigned long action, |
| 738 | void *hcpu) | 741 | void *hcpu) |
| @@ -775,6 +778,7 @@ static int comp_pool_callback(struct notifier_block *nfb, | |||
| 775 | 778 | ||
| 776 | return NOTIFY_OK; | 779 | return NOTIFY_OK; |
| 777 | } | 780 | } |
| 781 | #endif | ||
| 778 | 782 | ||
| 779 | int ehca_create_comp_pool(void) | 783 | int ehca_create_comp_pool(void) |
| 780 | { | 784 | { |
| @@ -805,9 +809,11 @@ int ehca_create_comp_pool(void) | |||
| 805 | } | 809 | } |
| 806 | } | 810 | } |
| 807 | 811 | ||
| 812 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 808 | comp_pool_callback_nb.notifier_call = comp_pool_callback; | 813 | comp_pool_callback_nb.notifier_call = comp_pool_callback; |
| 809 | comp_pool_callback_nb.priority =0; | 814 | comp_pool_callback_nb.priority =0; |
| 810 | register_cpu_notifier(&comp_pool_callback_nb); | 815 | register_cpu_notifier(&comp_pool_callback_nb); |
| 816 | #endif | ||
| 811 | 817 | ||
| 812 | printk(KERN_INFO "eHCA scaling code enabled\n"); | 818 | printk(KERN_INFO "eHCA scaling code enabled\n"); |
| 813 | 819 | ||
| @@ -821,7 +827,9 @@ void ehca_destroy_comp_pool(void) | |||
| 821 | if (!ehca_scaling_code) | 827 | if (!ehca_scaling_code) |
| 822 | return; | 828 | return; |
| 823 | 829 | ||
| 830 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 824 | unregister_cpu_notifier(&comp_pool_callback_nb); | 831 | unregister_cpu_notifier(&comp_pool_callback_nb); |
| 832 | #endif | ||
| 825 | 833 | ||
| 826 | for (i = 0; i < NR_CPUS; i++) { | 834 | for (i = 0; i < NR_CPUS; i++) { |
| 827 | if (cpu_online(i)) | 835 | if (cpu_online(i)) |
diff --git a/drivers/infiniband/hw/ipath/ipath_dma.c b/drivers/infiniband/hw/ipath/ipath_dma.c index f6f949040825..f87f003e3ef8 100644 --- a/drivers/infiniband/hw/ipath/ipath_dma.c +++ b/drivers/infiniband/hw/ipath/ipath_dma.c | |||
| @@ -167,7 +167,7 @@ static void *ipath_dma_alloc_coherent(struct ib_device *dev, size_t size, | |||
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | static void ipath_dma_free_coherent(struct ib_device *dev, size_t size, | 169 | static void ipath_dma_free_coherent(struct ib_device *dev, size_t size, |
| 170 | void *cpu_addr, dma_addr_t dma_handle) | 170 | void *cpu_addr, u64 dma_handle) |
| 171 | { | 171 | { |
| 172 | free_pages((unsigned long) cpu_addr, get_order(size)); | 172 | free_pages((unsigned long) cpu_addr, get_order(size)); |
| 173 | } | 173 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index 5b40a846ff95..ed55979bfd34 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
| @@ -451,12 +451,18 @@ bail: | |||
| 451 | return ret; | 451 | return ret; |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | static void remove_file(struct dentry *parent, char *name) | 454 | static int remove_file(struct dentry *parent, char *name) |
| 455 | { | 455 | { |
| 456 | struct dentry *tmp; | 456 | struct dentry *tmp; |
| 457 | int ret; | ||
| 457 | 458 | ||
| 458 | tmp = lookup_one_len(name, parent, strlen(name)); | 459 | tmp = lookup_one_len(name, parent, strlen(name)); |
| 459 | 460 | ||
| 461 | if (IS_ERR(tmp)) { | ||
| 462 | ret = PTR_ERR(tmp); | ||
| 463 | goto bail; | ||
| 464 | } | ||
| 465 | |||
| 460 | spin_lock(&dcache_lock); | 466 | spin_lock(&dcache_lock); |
| 461 | spin_lock(&tmp->d_lock); | 467 | spin_lock(&tmp->d_lock); |
| 462 | if (!(d_unhashed(tmp) && tmp->d_inode)) { | 468 | if (!(d_unhashed(tmp) && tmp->d_inode)) { |
| @@ -469,6 +475,14 @@ static void remove_file(struct dentry *parent, char *name) | |||
| 469 | spin_unlock(&tmp->d_lock); | 475 | spin_unlock(&tmp->d_lock); |
| 470 | spin_unlock(&dcache_lock); | 476 | spin_unlock(&dcache_lock); |
| 471 | } | 477 | } |
| 478 | |||
| 479 | ret = 0; | ||
| 480 | bail: | ||
| 481 | /* | ||
| 482 | * We don't expect clients to care about the return value, but | ||
| 483 | * it's there if they need it. | ||
| 484 | */ | ||
| 485 | return ret; | ||
| 472 | } | 486 | } |
| 473 | 487 | ||
| 474 | static int remove_device_files(struct super_block *sb, | 488 | static int remove_device_files(struct super_block *sb, |
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c index 8e4846b5c641..ee561c569d5f 100644 --- a/drivers/infiniband/hw/mthca/mthca_mr.c +++ b/drivers/infiniband/hw/mthca/mthca_mr.c | |||
| @@ -835,6 +835,7 @@ void mthca_arbel_fmr_unmap(struct mthca_dev *dev, struct mthca_fmr *fmr) | |||
| 835 | 835 | ||
| 836 | key = arbel_key_to_hw_index(fmr->ibmr.lkey); | 836 | key = arbel_key_to_hw_index(fmr->ibmr.lkey); |
| 837 | key &= dev->limits.num_mpts - 1; | 837 | key &= dev->limits.num_mpts - 1; |
| 838 | key = adjust_key(dev, key); | ||
| 838 | fmr->ibmr.lkey = fmr->ibmr.rkey = arbel_hw_index_to_key(key); | 839 | fmr->ibmr.lkey = fmr->ibmr.rkey = arbel_hw_index_to_key(key); |
| 839 | 840 | ||
| 840 | fmr->maps = 0; | 841 | fmr->maps = 0; |
| @@ -881,8 +882,8 @@ int mthca_init_mr_table(struct mthca_dev *dev) | |||
| 881 | } | 882 | } |
| 882 | mpts = mtts = 1 << i; | 883 | mpts = mtts = 1 << i; |
| 883 | } else { | 884 | } else { |
| 884 | mpts = dev->limits.num_mtt_segs; | 885 | mtts = dev->limits.num_mtt_segs; |
| 885 | mtts = dev->limits.num_mpts; | 886 | mpts = dev->limits.num_mpts; |
| 886 | } | 887 | } |
| 887 | 888 | ||
| 888 | if (!mthca_is_memfree(dev) && | 889 | if (!mthca_is_memfree(dev) && |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 3484e8ba24a4..2b242a4823f8 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
| @@ -131,7 +131,7 @@ static struct sk_buff *ipoib_cm_alloc_rx_skb(struct net_device *dev, int id, int | |||
| 131 | skb_fill_page_desc(skb, i, page, 0, PAGE_SIZE); | 131 | skb_fill_page_desc(skb, i, page, 0, PAGE_SIZE); |
| 132 | 132 | ||
| 133 | mapping[i + 1] = ib_dma_map_page(priv->ca, skb_shinfo(skb)->frags[i].page, | 133 | mapping[i + 1] = ib_dma_map_page(priv->ca, skb_shinfo(skb)->frags[i].page, |
| 134 | 0, PAGE_SIZE, DMA_TO_DEVICE); | 134 | 0, PAGE_SIZE, DMA_FROM_DEVICE); |
| 135 | if (unlikely(ib_dma_mapping_error(priv->ca, mapping[i + 1]))) | 135 | if (unlikely(ib_dma_mapping_error(priv->ca, mapping[i + 1]))) |
| 136 | goto partial_error; | 136 | goto partial_error; |
| 137 | } | 137 | } |
| @@ -452,7 +452,7 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_ | |||
| 452 | skb->len, tx->mtu); | 452 | skb->len, tx->mtu); |
| 453 | ++priv->stats.tx_dropped; | 453 | ++priv->stats.tx_dropped; |
| 454 | ++priv->stats.tx_errors; | 454 | ++priv->stats.tx_errors; |
| 455 | ipoib_cm_skb_too_long(dev, skb, tx->mtu - INFINIBAND_ALEN); | 455 | ipoib_cm_skb_too_long(dev, skb, tx->mtu - IPOIB_ENCAP_LEN); |
| 456 | return; | 456 | return; |
| 457 | } | 457 | } |
| 458 | 458 | ||
| @@ -1095,7 +1095,7 @@ static void ipoib_cm_stale_task(struct work_struct *work) | |||
| 1095 | /* List if sorted by LRU, start from tail, | 1095 | /* List if sorted by LRU, start from tail, |
| 1096 | * stop when we see a recently used entry */ | 1096 | * stop when we see a recently used entry */ |
| 1097 | p = list_entry(priv->cm.passive_ids.prev, typeof(*p), list); | 1097 | p = list_entry(priv->cm.passive_ids.prev, typeof(*p), list); |
| 1098 | if (time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT)) | 1098 | if (time_before_eq(jiffies, p->jiffies + IPOIB_CM_RX_TIMEOUT)) |
| 1099 | break; | 1099 | break; |
| 1100 | list_del_init(&p->list); | 1100 | list_del_init(&p->list); |
| 1101 | spin_unlock_irqrestore(&priv->lock, flags); | 1101 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index f2aa923ddbea..ba0ee5cf2ad7 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
| @@ -328,9 +328,9 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb, | |||
| 328 | struct ipoib_tx_buf *tx_req; | 328 | struct ipoib_tx_buf *tx_req; |
| 329 | u64 addr; | 329 | u64 addr; |
| 330 | 330 | ||
| 331 | if (unlikely(skb->len > priv->mcast_mtu + INFINIBAND_ALEN)) { | 331 | if (unlikely(skb->len > priv->mcast_mtu + IPOIB_ENCAP_LEN)) { |
| 332 | ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n", | 332 | ipoib_warn(priv, "packet len %d (> %d) too long to send, dropping\n", |
| 333 | skb->len, priv->mcast_mtu + INFINIBAND_ALEN); | 333 | skb->len, priv->mcast_mtu + IPOIB_ENCAP_LEN); |
| 334 | ++priv->stats.tx_dropped; | 334 | ++priv->stats.tx_dropped; |
| 335 | ++priv->stats.tx_errors; | 335 | ++priv->stats.tx_errors; |
| 336 | ipoib_cm_skb_too_long(dev, skb, priv->mcast_mtu); | 336 | ipoib_cm_skb_too_long(dev, skb, priv->mcast_mtu); |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index f9dbc6f68145..f2a40ae8e7d0 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
| @@ -380,7 +380,7 @@ static void path_rec_completion(int status, | |||
| 380 | struct net_device *dev = path->dev; | 380 | struct net_device *dev = path->dev; |
| 381 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 381 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| 382 | struct ipoib_ah *ah = NULL; | 382 | struct ipoib_ah *ah = NULL; |
| 383 | struct ipoib_neigh *neigh; | 383 | struct ipoib_neigh *neigh, *tn; |
| 384 | struct sk_buff_head skqueue; | 384 | struct sk_buff_head skqueue; |
| 385 | struct sk_buff *skb; | 385 | struct sk_buff *skb; |
| 386 | unsigned long flags; | 386 | unsigned long flags; |
| @@ -418,7 +418,7 @@ static void path_rec_completion(int status, | |||
| 418 | while ((skb = __skb_dequeue(&path->queue))) | 418 | while ((skb = __skb_dequeue(&path->queue))) |
| 419 | __skb_queue_tail(&skqueue, skb); | 419 | __skb_queue_tail(&skqueue, skb); |
| 420 | 420 | ||
| 421 | list_for_each_entry(neigh, &path->neigh_list, list) { | 421 | list_for_each_entry_safe(neigh, tn, &path->neigh_list, list) { |
| 422 | kref_get(&path->ah->ref); | 422 | kref_get(&path->ah->ref); |
| 423 | neigh->ah = path->ah; | 423 | neigh->ah = path->ah; |
| 424 | memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw, | 424 | memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw, |
| @@ -814,7 +814,7 @@ static void ipoib_set_mcast_list(struct net_device *dev) | |||
| 814 | queue_work(ipoib_workqueue, &priv->restart_task); | 814 | queue_work(ipoib_workqueue, &priv->restart_task); |
| 815 | } | 815 | } |
| 816 | 816 | ||
| 817 | static void ipoib_neigh_destructor(struct neighbour *n) | 817 | static void ipoib_neigh_cleanup(struct neighbour *n) |
| 818 | { | 818 | { |
| 819 | struct ipoib_neigh *neigh; | 819 | struct ipoib_neigh *neigh; |
| 820 | struct ipoib_dev_priv *priv = netdev_priv(n->dev); | 820 | struct ipoib_dev_priv *priv = netdev_priv(n->dev); |
| @@ -822,7 +822,7 @@ static void ipoib_neigh_destructor(struct neighbour *n) | |||
| 822 | struct ipoib_ah *ah = NULL; | 822 | struct ipoib_ah *ah = NULL; |
| 823 | 823 | ||
| 824 | ipoib_dbg(priv, | 824 | ipoib_dbg(priv, |
| 825 | "neigh_destructor for %06x " IPOIB_GID_FMT "\n", | 825 | "neigh_cleanup for %06x " IPOIB_GID_FMT "\n", |
| 826 | IPOIB_QPN(n->ha), | 826 | IPOIB_QPN(n->ha), |
| 827 | IPOIB_GID_RAW_ARG(n->ha + 4)); | 827 | IPOIB_GID_RAW_ARG(n->ha + 4)); |
| 828 | 828 | ||
| @@ -874,7 +874,7 @@ void ipoib_neigh_free(struct net_device *dev, struct ipoib_neigh *neigh) | |||
| 874 | 874 | ||
| 875 | static int ipoib_neigh_setup_dev(struct net_device *dev, struct neigh_parms *parms) | 875 | static int ipoib_neigh_setup_dev(struct net_device *dev, struct neigh_parms *parms) |
| 876 | { | 876 | { |
| 877 | parms->neigh_destructor = ipoib_neigh_destructor; | 877 | parms->neigh_cleanup = ipoib_neigh_cleanup; |
| 878 | 878 | ||
| 879 | return 0; | 879 | return 0; |
| 880 | } | 880 | } |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 56c87a81bb67..54fbead4de01 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
| @@ -644,6 +644,9 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) | |||
| 644 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 644 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| 645 | int ret = 0; | 645 | int ret = 0; |
| 646 | 646 | ||
| 647 | if (test_and_clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags)) | ||
| 648 | ib_sa_free_multicast(mcast->mc); | ||
| 649 | |||
| 647 | if (test_and_clear_bit(IPOIB_MCAST_FLAG_ATTACHED, &mcast->flags)) { | 650 | if (test_and_clear_bit(IPOIB_MCAST_FLAG_ATTACHED, &mcast->flags)) { |
| 648 | ipoib_dbg_mcast(priv, "leaving MGID " IPOIB_GID_FMT "\n", | 651 | ipoib_dbg_mcast(priv, "leaving MGID " IPOIB_GID_FMT "\n", |
| 649 | IPOIB_GID_ARG(mcast->mcmember.mgid)); | 652 | IPOIB_GID_ARG(mcast->mcmember.mgid)); |
| @@ -655,9 +658,6 @@ static int ipoib_mcast_leave(struct net_device *dev, struct ipoib_mcast *mcast) | |||
| 655 | ipoib_warn(priv, "ipoib_mcast_detach failed (result = %d)\n", ret); | 658 | ipoib_warn(priv, "ipoib_mcast_detach failed (result = %d)\n", ret); |
| 656 | } | 659 | } |
| 657 | 660 | ||
| 658 | if (test_and_clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags)) | ||
| 659 | ib_sa_free_multicast(mcast->mc); | ||
| 660 | |||
| 661 | return 0; | 661 | return 0; |
| 662 | } | 662 | } |
| 663 | 663 | ||
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h index cae8c96a55f8..8960196ffb0f 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.h +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h | |||
| @@ -245,7 +245,6 @@ struct iser_conn { | |||
| 245 | wait_queue_head_t wait; /* waitq for conn/disconn */ | 245 | wait_queue_head_t wait; /* waitq for conn/disconn */ |
| 246 | atomic_t post_recv_buf_count; /* posted rx count */ | 246 | atomic_t post_recv_buf_count; /* posted rx count */ |
| 247 | atomic_t post_send_buf_count; /* posted tx count */ | 247 | atomic_t post_send_buf_count; /* posted tx count */ |
| 248 | struct work_struct comperror_work; /* conn term sleepable ctx*/ | ||
| 249 | char name[ISER_OBJECT_NAME_SIZE]; | 248 | char name[ISER_OBJECT_NAME_SIZE]; |
| 250 | struct iser_page_vec *page_vec; /* represents SG to fmr maps* | 249 | struct iser_page_vec *page_vec; /* represents SG to fmr maps* |
| 251 | * maps serialized as tx is*/ | 250 | * maps serialized as tx is*/ |
diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 89e37283c836..278fcbccc2d9 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c | |||
| @@ -658,6 +658,7 @@ void iser_ctask_rdma_finalize(struct iscsi_iser_cmd_task *iser_ctask) | |||
| 658 | { | 658 | { |
| 659 | int deferred; | 659 | int deferred; |
| 660 | int is_rdma_aligned = 1; | 660 | int is_rdma_aligned = 1; |
| 661 | struct iser_regd_buf *regd; | ||
| 661 | 662 | ||
| 662 | /* if we were reading, copy back to unaligned sglist, | 663 | /* if we were reading, copy back to unaligned sglist, |
| 663 | * anyway dma_unmap and free the copy | 664 | * anyway dma_unmap and free the copy |
| @@ -672,20 +673,20 @@ void iser_ctask_rdma_finalize(struct iscsi_iser_cmd_task *iser_ctask) | |||
| 672 | } | 673 | } |
| 673 | 674 | ||
| 674 | if (iser_ctask->dir[ISER_DIR_IN]) { | 675 | if (iser_ctask->dir[ISER_DIR_IN]) { |
| 675 | deferred = iser_regd_buff_release | 676 | regd = &iser_ctask->rdma_regd[ISER_DIR_IN]; |
| 676 | (&iser_ctask->rdma_regd[ISER_DIR_IN]); | 677 | deferred = iser_regd_buff_release(regd); |
| 677 | if (deferred) { | 678 | if (deferred) { |
| 678 | iser_err("References remain for BUF-IN rdma reg\n"); | 679 | iser_err("%d references remain for BUF-IN rdma reg\n", |
| 679 | BUG(); | 680 | atomic_read(®d->ref_count)); |
| 680 | } | 681 | } |
| 681 | } | 682 | } |
| 682 | 683 | ||
| 683 | if (iser_ctask->dir[ISER_DIR_OUT]) { | 684 | if (iser_ctask->dir[ISER_DIR_OUT]) { |
| 684 | deferred = iser_regd_buff_release | 685 | regd = &iser_ctask->rdma_regd[ISER_DIR_OUT]; |
| 685 | (&iser_ctask->rdma_regd[ISER_DIR_OUT]); | 686 | deferred = iser_regd_buff_release(regd); |
| 686 | if (deferred) { | 687 | if (deferred) { |
| 687 | iser_err("References remain for BUF-OUT rdma reg\n"); | 688 | iser_err("%d references remain for BUF-OUT rdma reg\n", |
| 688 | BUG(); | 689 | atomic_read(®d->ref_count)); |
| 689 | } | 690 | } |
| 690 | } | 691 | } |
| 691 | 692 | ||
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 693b77002897..1fc967464a28 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
| @@ -48,7 +48,6 @@ | |||
| 48 | 48 | ||
| 49 | static void iser_cq_tasklet_fn(unsigned long data); | 49 | static void iser_cq_tasklet_fn(unsigned long data); |
| 50 | static void iser_cq_callback(struct ib_cq *cq, void *cq_context); | 50 | static void iser_cq_callback(struct ib_cq *cq, void *cq_context); |
| 51 | static void iser_comp_error_worker(struct work_struct *work); | ||
| 52 | 51 | ||
| 53 | static void iser_cq_event_callback(struct ib_event *cause, void *context) | 52 | static void iser_cq_event_callback(struct ib_event *cause, void *context) |
| 54 | { | 53 | { |
| @@ -480,7 +479,6 @@ int iser_conn_init(struct iser_conn **ibconn) | |||
| 480 | init_waitqueue_head(&ib_conn->wait); | 479 | init_waitqueue_head(&ib_conn->wait); |
| 481 | atomic_set(&ib_conn->post_recv_buf_count, 0); | 480 | atomic_set(&ib_conn->post_recv_buf_count, 0); |
| 482 | atomic_set(&ib_conn->post_send_buf_count, 0); | 481 | atomic_set(&ib_conn->post_send_buf_count, 0); |
| 483 | INIT_WORK(&ib_conn->comperror_work, iser_comp_error_worker); | ||
| 484 | INIT_LIST_HEAD(&ib_conn->conn_list); | 482 | INIT_LIST_HEAD(&ib_conn->conn_list); |
| 485 | spin_lock_init(&ib_conn->lock); | 483 | spin_lock_init(&ib_conn->lock); |
| 486 | 484 | ||
| @@ -753,26 +751,6 @@ int iser_post_send(struct iser_desc *tx_desc) | |||
| 753 | return ret_val; | 751 | return ret_val; |
| 754 | } | 752 | } |
| 755 | 753 | ||
| 756 | static void iser_comp_error_worker(struct work_struct *work) | ||
| 757 | { | ||
| 758 | struct iser_conn *ib_conn = | ||
| 759 | container_of(work, struct iser_conn, comperror_work); | ||
| 760 | |||
| 761 | /* getting here when the state is UP means that the conn is being * | ||
| 762 | * terminated asynchronously from the iSCSI layer's perspective. */ | ||
| 763 | if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP, | ||
| 764 | ISER_CONN_TERMINATING)) | ||
| 765 | iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn, | ||
| 766 | ISCSI_ERR_CONN_FAILED); | ||
| 767 | |||
| 768 | /* complete the termination process if disconnect event was delivered * | ||
| 769 | * note there are no more non completed posts to the QP */ | ||
| 770 | if (ib_conn->disc_evt_flag) { | ||
| 771 | ib_conn->state = ISER_CONN_DOWN; | ||
| 772 | wake_up_interruptible(&ib_conn->wait); | ||
| 773 | } | ||
| 774 | } | ||
| 775 | |||
| 776 | static void iser_handle_comp_error(struct iser_desc *desc) | 754 | static void iser_handle_comp_error(struct iser_desc *desc) |
| 777 | { | 755 | { |
| 778 | struct iser_dto *dto = &desc->dto; | 756 | struct iser_dto *dto = &desc->dto; |
| @@ -791,8 +769,22 @@ static void iser_handle_comp_error(struct iser_desc *desc) | |||
| 791 | } | 769 | } |
| 792 | 770 | ||
| 793 | if (atomic_read(&ib_conn->post_recv_buf_count) == 0 && | 771 | if (atomic_read(&ib_conn->post_recv_buf_count) == 0 && |
| 794 | atomic_read(&ib_conn->post_send_buf_count) == 0) | 772 | atomic_read(&ib_conn->post_send_buf_count) == 0) { |
| 795 | schedule_work(&ib_conn->comperror_work); | 773 | /* getting here when the state is UP means that the conn is * |
| 774 | * being terminated asynchronously from the iSCSI layer's * | ||
| 775 | * perspective. */ | ||
| 776 | if (iser_conn_state_comp_exch(ib_conn, ISER_CONN_UP, | ||
| 777 | ISER_CONN_TERMINATING)) | ||
| 778 | iscsi_conn_failure(ib_conn->iser_conn->iscsi_conn, | ||
| 779 | ISCSI_ERR_CONN_FAILED); | ||
| 780 | |||
| 781 | /* complete the termination process if disconnect event was delivered * | ||
| 782 | * note there are no more non completed posts to the QP */ | ||
| 783 | if (ib_conn->disc_evt_flag) { | ||
| 784 | ib_conn->state = ISER_CONN_DOWN; | ||
| 785 | wake_up_interruptible(&ib_conn->wait); | ||
| 786 | } | ||
| 787 | } | ||
| 796 | } | 788 | } |
| 797 | 789 | ||
| 798 | static void iser_cq_tasklet_fn(unsigned long data) | 790 | static void iser_cq_tasklet_fn(unsigned long data) |
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index c7db4032ef02..e8606c48c9c3 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c | |||
| @@ -553,6 +553,7 @@ static int ucb1400_ts_remove(struct device *dev) | |||
| 553 | } | 553 | } |
| 554 | 554 | ||
| 555 | static struct device_driver ucb1400_ts_driver = { | 555 | static struct device_driver ucb1400_ts_driver = { |
| 556 | .name = "ucb1400_ts", | ||
| 556 | .owner = THIS_MODULE, | 557 | .owner = THIS_MODULE, |
| 557 | .bus = &ac97_bus_type, | 558 | .bus = &ac97_bus_type, |
| 558 | .probe = ucb1400_ts_probe, | 559 | .probe = ucb1400_ts_probe, |
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index 63e51dd6debe..00e31609a238 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
| @@ -54,7 +54,7 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode"); | |||
| 54 | #define USB_SX353_PRODUCT_ID 0x0022 | 54 | #define USB_SX353_PRODUCT_ID 0x0022 |
| 55 | 55 | ||
| 56 | /* table of devices that work with this driver */ | 56 | /* table of devices that work with this driver */ |
| 57 | static struct usb_device_id gigaset_table [] = { | 57 | static const struct usb_device_id gigaset_table [] = { |
| 58 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) }, | 58 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3070_PRODUCT_ID) }, |
| 59 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) }, | 59 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_3075_PRODUCT_ID) }, |
| 60 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) }, | 60 | { USB_DEVICE(USB_GIGA_VENDOR_ID, USB_SX303_PRODUCT_ID) }, |
| @@ -2305,7 +2305,7 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
| 2305 | gigaset_unassign(cs); | 2305 | gigaset_unassign(cs); |
| 2306 | } | 2306 | } |
| 2307 | 2307 | ||
| 2308 | static struct gigaset_ops gigops = { | 2308 | static const struct gigaset_ops gigops = { |
| 2309 | gigaset_write_cmd, | 2309 | gigaset_write_cmd, |
| 2310 | gigaset_write_room, | 2310 | gigaset_write_room, |
| 2311 | gigaset_chars_in_buffer, | 2311 | gigaset_chars_in_buffer, |
diff --git a/drivers/isdn/gigaset/common.c b/drivers/isdn/gigaset/common.c index b460a73a7c85..6df336bdd571 100644 --- a/drivers/isdn/gigaset/common.c +++ b/drivers/isdn/gigaset/common.c | |||
| @@ -944,8 +944,8 @@ static DEFINE_SPINLOCK(driver_lock); | |||
| 944 | struct cardstate *gigaset_get_cs_by_id(int id) | 944 | struct cardstate *gigaset_get_cs_by_id(int id) |
| 945 | { | 945 | { |
| 946 | unsigned long flags; | 946 | unsigned long flags; |
| 947 | static struct cardstate *ret = NULL; | 947 | struct cardstate *ret = NULL; |
| 948 | static struct cardstate *cs; | 948 | struct cardstate *cs; |
| 949 | struct gigaset_driver *drv; | 949 | struct gigaset_driver *drv; |
| 950 | unsigned i; | 950 | unsigned i; |
| 951 | 951 | ||
| @@ -999,7 +999,7 @@ void gigaset_debugdrivers(void) | |||
| 999 | static struct cardstate *gigaset_get_cs_by_minor(unsigned minor) | 999 | static struct cardstate *gigaset_get_cs_by_minor(unsigned minor) |
| 1000 | { | 1000 | { |
| 1001 | unsigned long flags; | 1001 | unsigned long flags; |
| 1002 | static struct cardstate *ret = NULL; | 1002 | struct cardstate *ret = NULL; |
| 1003 | struct gigaset_driver *drv; | 1003 | struct gigaset_driver *drv; |
| 1004 | unsigned index; | 1004 | unsigned index; |
| 1005 | 1005 | ||
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index 4661e2c722bc..cec1ef342fcc 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c | |||
| @@ -409,7 +409,7 @@ static struct reply_t tab_cid[] = /* no dle mode */ //FIXME | |||
| 409 | }; | 409 | }; |
| 410 | #endif | 410 | #endif |
| 411 | 411 | ||
| 412 | static struct resp_type_t resp_type[]= | 412 | static const struct resp_type_t resp_type[] = |
| 413 | { | 413 | { |
| 414 | /*{"", RSP_EMPTY, RT_NOTHING},*/ | 414 | /*{"", RSP_EMPTY, RT_NOTHING},*/ |
| 415 | {"OK", RSP_OK, RT_NOTHING}, | 415 | {"OK", RSP_OK, RT_NOTHING}, |
| @@ -511,7 +511,7 @@ void gigaset_handle_modem_response(struct cardstate *cs) | |||
| 511 | unsigned char *argv[MAX_REC_PARAMS + 1]; | 511 | unsigned char *argv[MAX_REC_PARAMS + 1]; |
| 512 | int params; | 512 | int params; |
| 513 | int i, j; | 513 | int i, j; |
| 514 | struct resp_type_t *rt; | 514 | const struct resp_type_t *rt; |
| 515 | int curarg; | 515 | int curarg; |
| 516 | unsigned long flags; | 516 | unsigned long flags; |
| 517 | unsigned next, tail, head; | 517 | unsigned next, tail, head; |
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index 8c0eb522dab1..e0505f238807 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
| @@ -274,7 +274,7 @@ static inline void dump_bytes(enum debuglevel level, const char *tag, | |||
| 274 | * bit 12..10 = number of trailing '1' bits in result | 274 | * bit 12..10 = number of trailing '1' bits in result |
| 275 | * bit 14..13 = number of bits added by stuffing | 275 | * bit 14..13 = number of bits added by stuffing |
| 276 | */ | 276 | */ |
| 277 | static u16 stufftab[5 * 256] = { | 277 | static const u16 stufftab[5 * 256] = { |
| 278 | // previous 1s = 0: | 278 | // previous 1s = 0: |
| 279 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, | 279 | 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, |
| 280 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f, | 280 | 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x201f, |
| @@ -629,7 +629,7 @@ static inline void hdlc_frag(struct bc_state *bcs, unsigned inbits) | |||
| 629 | * (replacing 8 by 7 to make it fit; the algorithm won't care) | 629 | * (replacing 8 by 7 to make it fit; the algorithm won't care) |
| 630 | * bit 7 set if there are 5 or more "interior" consecutive '1' bits | 630 | * bit 7 set if there are 5 or more "interior" consecutive '1' bits |
| 631 | */ | 631 | */ |
| 632 | static unsigned char bitcounts[256] = { | 632 | static const unsigned char bitcounts[256] = { |
| 633 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, | 633 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, |
| 634 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, | 634 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x05, |
| 635 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, | 635 | 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, |
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c index c8b7db65e48f..ea44302e6e7e 100644 --- a/drivers/isdn/gigaset/ser-gigaset.c +++ b/drivers/isdn/gigaset/ser-gigaset.c | |||
| @@ -459,7 +459,7 @@ static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) | |||
| 459 | return -EINVAL; | 459 | return -EINVAL; |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | static struct gigaset_ops ops = { | 462 | static const struct gigaset_ops ops = { |
| 463 | gigaset_write_cmd, | 463 | gigaset_write_cmd, |
| 464 | gigaset_write_room, | 464 | gigaset_write_room, |
| 465 | gigaset_chars_in_buffer, | 465 | gigaset_chars_in_buffer, |
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index 04f2ad7ba8b0..2baef349c12d 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c | |||
| @@ -50,7 +50,7 @@ MODULE_PARM_DESC(cidmode, "Call-ID mode"); | |||
| 50 | #define USB_M105_PRODUCT_ID 0x0009 | 50 | #define USB_M105_PRODUCT_ID 0x0009 |
| 51 | 51 | ||
| 52 | /* table of devices that work with this driver */ | 52 | /* table of devices that work with this driver */ |
| 53 | static struct usb_device_id gigaset_table [] = { | 53 | static const struct usb_device_id gigaset_table [] = { |
| 54 | { USB_DEVICE(USB_M105_VENDOR_ID, USB_M105_PRODUCT_ID) }, | 54 | { USB_DEVICE(USB_M105_VENDOR_ID, USB_M105_PRODUCT_ID) }, |
| 55 | { } /* Terminating entry */ | 55 | { } /* Terminating entry */ |
| 56 | }; | 56 | }; |
| @@ -860,7 +860,7 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
| 860 | gigaset_unassign(cs); | 860 | gigaset_unassign(cs); |
| 861 | } | 861 | } |
| 862 | 862 | ||
| 863 | static struct gigaset_ops ops = { | 863 | static const struct gigaset_ops ops = { |
| 864 | gigaset_write_cmd, | 864 | gigaset_write_cmd, |
| 865 | gigaset_write_room, | 865 | gigaset_write_room, |
| 866 | gigaset_chars_in_buffer, | 866 | gigaset_chars_in_buffer, |
diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c index 9df9e3548cf1..c547a6665052 100644 --- a/drivers/isdn/hisax/isar.c +++ b/drivers/isdn/hisax/isar.c | |||
| @@ -440,7 +440,7 @@ isar_bh(struct work_struct *work) | |||
| 440 | { | 440 | { |
| 441 | struct BCState *bcs = container_of(work, struct BCState, tqueue); | 441 | struct BCState *bcs = container_of(work, struct BCState, tqueue); |
| 442 | 442 | ||
| 443 | BChannel_bh(bcs); | 443 | BChannel_bh(work); |
| 444 | if (test_and_clear_bit(B_LL_NOCARRIER, &bcs->event)) | 444 | if (test_and_clear_bit(B_LL_NOCARRIER, &bcs->event)) |
| 445 | ll_deliver_faxstat(bcs, ISDN_FAX_CLASS1_NOCARR); | 445 | ll_deliver_faxstat(bcs, ISDN_FAX_CLASS1_NOCARR); |
| 446 | if (test_and_clear_bit(B_LL_CONNECT, &bcs->event)) | 446 | if (test_and_clear_bit(B_LL_CONNECT, &bcs->event)) |
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index a163bca38973..dc7a8c78cbf9 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
| @@ -2464,7 +2464,7 @@ int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module) | |||
| 2464 | 2464 | ||
| 2465 | r = kvm_arch_ops->hardware_setup(); | 2465 | r = kvm_arch_ops->hardware_setup(); |
| 2466 | if (r < 0) | 2466 | if (r < 0) |
| 2467 | return r; | 2467 | goto out; |
| 2468 | 2468 | ||
| 2469 | on_each_cpu(kvm_arch_ops->hardware_enable, NULL, 0, 1); | 2469 | on_each_cpu(kvm_arch_ops->hardware_enable, NULL, 0, 1); |
| 2470 | r = register_cpu_notifier(&kvm_cpu_notifier); | 2470 | r = register_cpu_notifier(&kvm_cpu_notifier); |
| @@ -2500,6 +2500,8 @@ out_free_2: | |||
| 2500 | out_free_1: | 2500 | out_free_1: |
| 2501 | on_each_cpu(kvm_arch_ops->hardware_disable, NULL, 0, 1); | 2501 | on_each_cpu(kvm_arch_ops->hardware_disable, NULL, 0, 1); |
| 2502 | kvm_arch_ops->hardware_unsetup(); | 2502 | kvm_arch_ops->hardware_unsetup(); |
| 2503 | out: | ||
| 2504 | kvm_arch_ops = NULL; | ||
| 2503 | return r; | 2505 | return r; |
| 2504 | } | 2506 | } |
| 2505 | 2507 | ||
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index a1a93368f314..cab26f301eab 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
| @@ -131,7 +131,7 @@ static int dbg = 1; | |||
| 131 | (((address) >> PT32_LEVEL_SHIFT(level)) & ((1 << PT32_LEVEL_BITS) - 1)) | 131 | (((address) >> PT32_LEVEL_SHIFT(level)) & ((1 << PT32_LEVEL_BITS) - 1)) |
| 132 | 132 | ||
| 133 | 133 | ||
| 134 | #define PT64_BASE_ADDR_MASK (((1ULL << 52) - 1) & PAGE_MASK) | 134 | #define PT64_BASE_ADDR_MASK (((1ULL << 52) - 1) & ~(u64)(PAGE_SIZE-1)) |
| 135 | #define PT64_DIR_BASE_ADDR_MASK \ | 135 | #define PT64_DIR_BASE_ADDR_MASK \ |
| 136 | (PT64_BASE_ADDR_MASK & ~((1ULL << (PAGE_SHIFT + PT64_LEVEL_BITS)) - 1)) | 136 | (PT64_BASE_ADDR_MASK & ~((1ULL << (PAGE_SHIFT + PT64_LEVEL_BITS)) - 1)) |
| 137 | 137 | ||
| @@ -406,8 +406,8 @@ static void rmap_write_protect(struct kvm_vcpu *vcpu, u64 gfn) | |||
| 406 | spte = desc->shadow_ptes[0]; | 406 | spte = desc->shadow_ptes[0]; |
| 407 | } | 407 | } |
| 408 | BUG_ON(!spte); | 408 | BUG_ON(!spte); |
| 409 | BUG_ON((*spte & PT64_BASE_ADDR_MASK) != | 409 | BUG_ON((*spte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT |
| 410 | page_to_pfn(page) << PAGE_SHIFT); | 410 | != page_to_pfn(page)); |
| 411 | BUG_ON(!(*spte & PT_PRESENT_MASK)); | 411 | BUG_ON(!(*spte & PT_PRESENT_MASK)); |
| 412 | BUG_ON(!(*spte & PT_WRITABLE_MASK)); | 412 | BUG_ON(!(*spte & PT_WRITABLE_MASK)); |
| 413 | rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte); | 413 | rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte); |
| @@ -1093,22 +1093,40 @@ out: | |||
| 1093 | return r; | 1093 | return r; |
| 1094 | } | 1094 | } |
| 1095 | 1095 | ||
| 1096 | static void mmu_pre_write_zap_pte(struct kvm_vcpu *vcpu, | ||
| 1097 | struct kvm_mmu_page *page, | ||
| 1098 | u64 *spte) | ||
| 1099 | { | ||
| 1100 | u64 pte; | ||
| 1101 | struct kvm_mmu_page *child; | ||
| 1102 | |||
| 1103 | pte = *spte; | ||
| 1104 | if (is_present_pte(pte)) { | ||
| 1105 | if (page->role.level == PT_PAGE_TABLE_LEVEL) | ||
| 1106 | rmap_remove(vcpu, spte); | ||
| 1107 | else { | ||
| 1108 | child = page_header(pte & PT64_BASE_ADDR_MASK); | ||
| 1109 | mmu_page_remove_parent_pte(vcpu, child, spte); | ||
| 1110 | } | ||
| 1111 | } | ||
| 1112 | *spte = 0; | ||
| 1113 | } | ||
| 1114 | |||
| 1096 | void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes) | 1115 | void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes) |
| 1097 | { | 1116 | { |
| 1098 | gfn_t gfn = gpa >> PAGE_SHIFT; | 1117 | gfn_t gfn = gpa >> PAGE_SHIFT; |
| 1099 | struct kvm_mmu_page *page; | 1118 | struct kvm_mmu_page *page; |
| 1100 | struct kvm_mmu_page *child; | ||
| 1101 | struct hlist_node *node, *n; | 1119 | struct hlist_node *node, *n; |
| 1102 | struct hlist_head *bucket; | 1120 | struct hlist_head *bucket; |
| 1103 | unsigned index; | 1121 | unsigned index; |
| 1104 | u64 *spte; | 1122 | u64 *spte; |
| 1105 | u64 pte; | ||
| 1106 | unsigned offset = offset_in_page(gpa); | 1123 | unsigned offset = offset_in_page(gpa); |
| 1107 | unsigned pte_size; | 1124 | unsigned pte_size; |
| 1108 | unsigned page_offset; | 1125 | unsigned page_offset; |
| 1109 | unsigned misaligned; | 1126 | unsigned misaligned; |
| 1110 | int level; | 1127 | int level; |
| 1111 | int flooded = 0; | 1128 | int flooded = 0; |
| 1129 | int npte; | ||
| 1112 | 1130 | ||
| 1113 | pgprintk("%s: gpa %llx bytes %d\n", __FUNCTION__, gpa, bytes); | 1131 | pgprintk("%s: gpa %llx bytes %d\n", __FUNCTION__, gpa, bytes); |
| 1114 | if (gfn == vcpu->last_pt_write_gfn) { | 1132 | if (gfn == vcpu->last_pt_write_gfn) { |
| @@ -1144,22 +1162,27 @@ void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes) | |||
| 1144 | } | 1162 | } |
| 1145 | page_offset = offset; | 1163 | page_offset = offset; |
| 1146 | level = page->role.level; | 1164 | level = page->role.level; |
| 1165 | npte = 1; | ||
| 1147 | if (page->role.glevels == PT32_ROOT_LEVEL) { | 1166 | if (page->role.glevels == PT32_ROOT_LEVEL) { |
| 1148 | page_offset <<= 1; /* 32->64 */ | 1167 | page_offset <<= 1; /* 32->64 */ |
| 1168 | /* | ||
| 1169 | * A 32-bit pde maps 4MB while the shadow pdes map | ||
| 1170 | * only 2MB. So we need to double the offset again | ||
| 1171 | * and zap two pdes instead of one. | ||
| 1172 | */ | ||
| 1173 | if (level == PT32_ROOT_LEVEL) { | ||
| 1174 | page_offset &= ~7; /* kill rounding error */ | ||
| 1175 | page_offset <<= 1; | ||
| 1176 | npte = 2; | ||
| 1177 | } | ||
| 1149 | page_offset &= ~PAGE_MASK; | 1178 | page_offset &= ~PAGE_MASK; |
| 1150 | } | 1179 | } |
| 1151 | spte = __va(page->page_hpa); | 1180 | spte = __va(page->page_hpa); |
| 1152 | spte += page_offset / sizeof(*spte); | 1181 | spte += page_offset / sizeof(*spte); |
| 1153 | pte = *spte; | 1182 | while (npte--) { |
| 1154 | if (is_present_pte(pte)) { | 1183 | mmu_pre_write_zap_pte(vcpu, page, spte); |
| 1155 | if (level == PT_PAGE_TABLE_LEVEL) | 1184 | ++spte; |
| 1156 | rmap_remove(vcpu, spte); | ||
| 1157 | else { | ||
| 1158 | child = page_header(pte & PT64_BASE_ADDR_MASK); | ||
| 1159 | mmu_page_remove_parent_pte(vcpu, child, spte); | ||
| 1160 | } | ||
| 1161 | } | 1185 | } |
| 1162 | *spte = 0; | ||
| 1163 | } | 1186 | } |
| 1164 | } | 1187 | } |
| 1165 | 1188 | ||
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index c07178e61122..fbbf9d6b299f 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
| @@ -371,10 +371,10 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata) | |||
| 371 | data = vmcs_read32(GUEST_SYSENTER_CS); | 371 | data = vmcs_read32(GUEST_SYSENTER_CS); |
| 372 | break; | 372 | break; |
| 373 | case MSR_IA32_SYSENTER_EIP: | 373 | case MSR_IA32_SYSENTER_EIP: |
| 374 | data = vmcs_read32(GUEST_SYSENTER_EIP); | 374 | data = vmcs_readl(GUEST_SYSENTER_EIP); |
| 375 | break; | 375 | break; |
| 376 | case MSR_IA32_SYSENTER_ESP: | 376 | case MSR_IA32_SYSENTER_ESP: |
| 377 | data = vmcs_read32(GUEST_SYSENTER_ESP); | 377 | data = vmcs_readl(GUEST_SYSENTER_ESP); |
| 378 | break; | 378 | break; |
| 379 | default: | 379 | default: |
| 380 | msr = find_msr_entry(vcpu, msr_index); | 380 | msr = find_msr_entry(vcpu, msr_index); |
| @@ -412,10 +412,10 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data) | |||
| 412 | vmcs_write32(GUEST_SYSENTER_CS, data); | 412 | vmcs_write32(GUEST_SYSENTER_CS, data); |
| 413 | break; | 413 | break; |
| 414 | case MSR_IA32_SYSENTER_EIP: | 414 | case MSR_IA32_SYSENTER_EIP: |
| 415 | vmcs_write32(GUEST_SYSENTER_EIP, data); | 415 | vmcs_writel(GUEST_SYSENTER_EIP, data); |
| 416 | break; | 416 | break; |
| 417 | case MSR_IA32_SYSENTER_ESP: | 417 | case MSR_IA32_SYSENTER_ESP: |
| 418 | vmcs_write32(GUEST_SYSENTER_ESP, data); | 418 | vmcs_writel(GUEST_SYSENTER_ESP, data); |
| 419 | break; | 419 | break; |
| 420 | case MSR_IA32_TIME_STAMP_COUNTER: | 420 | case MSR_IA32_TIME_STAMP_COUNTER: |
| 421 | guest_write_tsc(data); | 421 | guest_write_tsc(data); |
| @@ -618,7 +618,7 @@ static void fix_pmode_dataseg(int seg, struct kvm_save_segment *save) | |||
| 618 | { | 618 | { |
| 619 | struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; | 619 | struct kvm_vmx_segment_field *sf = &kvm_vmx_segment_fields[seg]; |
| 620 | 620 | ||
| 621 | if (vmcs_readl(sf->base) == save->base) { | 621 | if (vmcs_readl(sf->base) == save->base && (save->base & AR_S_MASK)) { |
| 622 | vmcs_write16(sf->selector, save->selector); | 622 | vmcs_write16(sf->selector, save->selector); |
| 623 | vmcs_writel(sf->base, save->base); | 623 | vmcs_writel(sf->base, save->base); |
| 624 | vmcs_write32(sf->limit, save->limit); | 624 | vmcs_write32(sf->limit, save->limit); |
| @@ -1888,6 +1888,27 @@ again: | |||
| 1888 | [cr2]"i"(offsetof(struct kvm_vcpu, cr2)) | 1888 | [cr2]"i"(offsetof(struct kvm_vcpu, cr2)) |
| 1889 | : "cc", "memory" ); | 1889 | : "cc", "memory" ); |
| 1890 | 1890 | ||
| 1891 | /* | ||
| 1892 | * Reload segment selectors ASAP. (it's needed for a functional | ||
| 1893 | * kernel: x86 relies on having __KERNEL_PDA in %fs and x86_64 | ||
| 1894 | * relies on having 0 in %gs for the CPU PDA to work.) | ||
| 1895 | */ | ||
| 1896 | if (fs_gs_ldt_reload_needed) { | ||
| 1897 | load_ldt(ldt_sel); | ||
| 1898 | load_fs(fs_sel); | ||
| 1899 | /* | ||
| 1900 | * If we have to reload gs, we must take care to | ||
| 1901 | * preserve our gs base. | ||
| 1902 | */ | ||
| 1903 | local_irq_disable(); | ||
| 1904 | load_gs(gs_sel); | ||
| 1905 | #ifdef CONFIG_X86_64 | ||
| 1906 | wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE)); | ||
| 1907 | #endif | ||
| 1908 | local_irq_enable(); | ||
| 1909 | |||
| 1910 | reload_tss(); | ||
| 1911 | } | ||
| 1891 | ++kvm_stat.exits; | 1912 | ++kvm_stat.exits; |
| 1892 | 1913 | ||
| 1893 | save_msrs(vcpu->guest_msrs, NR_BAD_MSRS); | 1914 | save_msrs(vcpu->guest_msrs, NR_BAD_MSRS); |
| @@ -1905,22 +1926,6 @@ again: | |||
| 1905 | kvm_run->exit_reason = vmcs_read32(VM_INSTRUCTION_ERROR); | 1926 | kvm_run->exit_reason = vmcs_read32(VM_INSTRUCTION_ERROR); |
| 1906 | r = 0; | 1927 | r = 0; |
| 1907 | } else { | 1928 | } else { |
| 1908 | if (fs_gs_ldt_reload_needed) { | ||
| 1909 | load_ldt(ldt_sel); | ||
| 1910 | load_fs(fs_sel); | ||
| 1911 | /* | ||
| 1912 | * If we have to reload gs, we must take care to | ||
| 1913 | * preserve our gs base. | ||
| 1914 | */ | ||
| 1915 | local_irq_disable(); | ||
| 1916 | load_gs(gs_sel); | ||
| 1917 | #ifdef CONFIG_X86_64 | ||
| 1918 | wrmsrl(MSR_GS_BASE, vmcs_readl(HOST_GS_BASE)); | ||
| 1919 | #endif | ||
| 1920 | local_irq_enable(); | ||
| 1921 | |||
| 1922 | reload_tss(); | ||
| 1923 | } | ||
| 1924 | /* | 1929 | /* |
| 1925 | * Profile KVM exit RIPs: | 1930 | * Profile KVM exit RIPs: |
| 1926 | */ | 1931 | */ |
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c index 3096836d8bd3..c9f3dc4fd3ee 100644 --- a/drivers/macintosh/smu.c +++ b/drivers/macintosh/smu.c | |||
| @@ -1259,9 +1259,9 @@ static int smu_release(struct inode *inode, struct file *file) | |||
| 1259 | set_current_state(TASK_UNINTERRUPTIBLE); | 1259 | set_current_state(TASK_UNINTERRUPTIBLE); |
| 1260 | if (pp->cmd.status != 1) | 1260 | if (pp->cmd.status != 1) |
| 1261 | break; | 1261 | break; |
| 1262 | spin_lock_irqsave(&pp->lock, flags); | ||
| 1263 | schedule(); | ||
| 1264 | spin_unlock_irqrestore(&pp->lock, flags); | 1262 | spin_unlock_irqrestore(&pp->lock, flags); |
| 1263 | schedule(); | ||
| 1264 | spin_lock_irqsave(&pp->lock, flags); | ||
| 1265 | } | 1265 | } |
| 1266 | set_current_state(TASK_RUNNING); | 1266 | set_current_state(TASK_RUNNING); |
| 1267 | remove_wait_queue(&pp->wait, &wait); | 1267 | remove_wait_queue(&pp->wait, &wait); |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 5554adaa58f9..e61e0efe9ec7 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
| @@ -863,9 +863,7 @@ static int bitmap_init_from_disk(struct bitmap *bitmap, sector_t start) | |||
| 863 | 863 | ||
| 864 | /* We need 4 bits per page, rounded up to a multiple of sizeof(unsigned long) */ | 864 | /* We need 4 bits per page, rounded up to a multiple of sizeof(unsigned long) */ |
| 865 | bitmap->filemap_attr = kzalloc( | 865 | bitmap->filemap_attr = kzalloc( |
| 866 | (((num_pages*4/8)+sizeof(unsigned long)-1) | 866 | roundup( DIV_ROUND_UP(num_pages*4, 8), sizeof(unsigned long)), |
| 867 | /sizeof(unsigned long)) | ||
| 868 | *sizeof(unsigned long), | ||
| 869 | GFP_KERNEL); | 867 | GFP_KERNEL); |
| 870 | if (!bitmap->filemap_attr) | 868 | if (!bitmap->filemap_attr) |
| 871 | goto out; | 869 | goto out; |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index c625ddb8833d..d5ecd2d53046 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
| @@ -188,7 +188,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) | |||
| 188 | for (i=0; i < cnt-1 ; i++) { | 188 | for (i=0; i < cnt-1 ; i++) { |
| 189 | sector_t sz = 0; | 189 | sector_t sz = 0; |
| 190 | int j; | 190 | int j; |
| 191 | for (j=i; i<cnt-1 && sz < min_spacing ; j++) | 191 | for (j = i; j < cnt - 1 && sz < min_spacing; j++) |
| 192 | sz += conf->disks[j].size; | 192 | sz += conf->disks[j].size; |
| 193 | if (sz >= min_spacing && sz < conf->hash_spacing) | 193 | if (sz >= min_spacing && sz < conf->hash_spacing) |
| 194 | conf->hash_spacing = sz; | 194 | conf->hash_spacing = sz; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 6c06e825cff5..509171ca7fa8 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -1318,6 +1318,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
| 1318 | char b[BDEVNAME_SIZE]; | 1318 | char b[BDEVNAME_SIZE]; |
| 1319 | struct kobject *ko; | 1319 | struct kobject *ko; |
| 1320 | char *s; | 1320 | char *s; |
| 1321 | int err; | ||
| 1321 | 1322 | ||
| 1322 | if (rdev->mddev) { | 1323 | if (rdev->mddev) { |
| 1323 | MD_BUG(); | 1324 | MD_BUG(); |
| @@ -1352,20 +1353,35 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
| 1352 | while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL) | 1353 | while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL) |
| 1353 | *s = '!'; | 1354 | *s = '!'; |
| 1354 | 1355 | ||
| 1355 | list_add(&rdev->same_set, &mddev->disks); | ||
| 1356 | rdev->mddev = mddev; | 1356 | rdev->mddev = mddev; |
| 1357 | printk(KERN_INFO "md: bind<%s>\n", b); | 1357 | printk(KERN_INFO "md: bind<%s>\n", b); |
| 1358 | 1358 | ||
| 1359 | rdev->kobj.parent = &mddev->kobj; | 1359 | rdev->kobj.parent = &mddev->kobj; |
| 1360 | kobject_add(&rdev->kobj); | 1360 | if ((err = kobject_add(&rdev->kobj))) |
| 1361 | goto fail; | ||
| 1361 | 1362 | ||
| 1362 | if (rdev->bdev->bd_part) | 1363 | if (rdev->bdev->bd_part) |
| 1363 | ko = &rdev->bdev->bd_part->kobj; | 1364 | ko = &rdev->bdev->bd_part->kobj; |
| 1364 | else | 1365 | else |
| 1365 | ko = &rdev->bdev->bd_disk->kobj; | 1366 | ko = &rdev->bdev->bd_disk->kobj; |
| 1366 | sysfs_create_link(&rdev->kobj, ko, "block"); | 1367 | if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) { |
| 1368 | kobject_del(&rdev->kobj); | ||
| 1369 | goto fail; | ||
| 1370 | } | ||
| 1371 | list_add(&rdev->same_set, &mddev->disks); | ||
| 1367 | bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk); | 1372 | bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk); |
| 1368 | return 0; | 1373 | return 0; |
| 1374 | |||
| 1375 | fail: | ||
| 1376 | printk(KERN_WARNING "md: failed to register dev-%s for %s\n", | ||
| 1377 | b, mdname(mddev)); | ||
| 1378 | return err; | ||
| 1379 | } | ||
| 1380 | |||
| 1381 | static void delayed_delete(struct work_struct *ws) | ||
| 1382 | { | ||
| 1383 | mdk_rdev_t *rdev = container_of(ws, mdk_rdev_t, del_work); | ||
| 1384 | kobject_del(&rdev->kobj); | ||
| 1369 | } | 1385 | } |
| 1370 | 1386 | ||
| 1371 | static void unbind_rdev_from_array(mdk_rdev_t * rdev) | 1387 | static void unbind_rdev_from_array(mdk_rdev_t * rdev) |
| @@ -1380,7 +1396,12 @@ static void unbind_rdev_from_array(mdk_rdev_t * rdev) | |||
| 1380 | printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); | 1396 | printk(KERN_INFO "md: unbind<%s>\n", bdevname(rdev->bdev,b)); |
| 1381 | rdev->mddev = NULL; | 1397 | rdev->mddev = NULL; |
| 1382 | sysfs_remove_link(&rdev->kobj, "block"); | 1398 | sysfs_remove_link(&rdev->kobj, "block"); |
| 1383 | kobject_del(&rdev->kobj); | 1399 | |
| 1400 | /* We need to delay this, otherwise we can deadlock when | ||
| 1401 | * writing to 'remove' to "dev/state" | ||
| 1402 | */ | ||
| 1403 | INIT_WORK(&rdev->del_work, delayed_delete); | ||
| 1404 | schedule_work(&rdev->del_work); | ||
| 1384 | } | 1405 | } |
| 1385 | 1406 | ||
| 1386 | /* | 1407 | /* |
| @@ -2966,7 +2987,9 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) | |||
| 2966 | mddev->kobj.k_name = NULL; | 2987 | mddev->kobj.k_name = NULL; |
| 2967 | snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); | 2988 | snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); |
| 2968 | mddev->kobj.ktype = &md_ktype; | 2989 | mddev->kobj.ktype = &md_ktype; |
| 2969 | kobject_register(&mddev->kobj); | 2990 | if (kobject_register(&mddev->kobj)) |
| 2991 | printk(KERN_WARNING "md: cannot register %s/md - name in use\n", | ||
| 2992 | disk->disk_name); | ||
| 2970 | return NULL; | 2993 | return NULL; |
| 2971 | } | 2994 | } |
| 2972 | 2995 | ||
| @@ -3144,9 +3167,12 @@ static int do_md_run(mddev_t * mddev) | |||
| 3144 | bitmap_destroy(mddev); | 3167 | bitmap_destroy(mddev); |
| 3145 | return err; | 3168 | return err; |
| 3146 | } | 3169 | } |
| 3147 | if (mddev->pers->sync_request) | 3170 | if (mddev->pers->sync_request) { |
| 3148 | sysfs_create_group(&mddev->kobj, &md_redundancy_group); | 3171 | if (sysfs_create_group(&mddev->kobj, &md_redundancy_group)) |
| 3149 | else if (mddev->ro == 2) /* auto-readonly not meaningful */ | 3172 | printk(KERN_WARNING |
| 3173 | "md: cannot register extra attributes for %s\n", | ||
| 3174 | mdname(mddev)); | ||
| 3175 | } else if (mddev->ro == 2) /* auto-readonly not meaningful */ | ||
| 3150 | mddev->ro = 0; | 3176 | mddev->ro = 0; |
| 3151 | 3177 | ||
| 3152 | atomic_set(&mddev->writes_pending,0); | 3178 | atomic_set(&mddev->writes_pending,0); |
| @@ -3160,7 +3186,9 @@ static int do_md_run(mddev_t * mddev) | |||
| 3160 | if (rdev->raid_disk >= 0) { | 3186 | if (rdev->raid_disk >= 0) { |
| 3161 | char nm[20]; | 3187 | char nm[20]; |
| 3162 | sprintf(nm, "rd%d", rdev->raid_disk); | 3188 | sprintf(nm, "rd%d", rdev->raid_disk); |
| 3163 | sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); | 3189 | if (sysfs_create_link(&mddev->kobj, &rdev->kobj, nm)) |
| 3190 | printk("md: cannot register %s for %s\n", | ||
| 3191 | nm, mdname(mddev)); | ||
| 3164 | } | 3192 | } |
| 3165 | 3193 | ||
| 3166 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 3194 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); |
| @@ -3325,6 +3353,7 @@ static int do_md_stop(mddev_t * mddev, int mode) | |||
| 3325 | mddev->queue->merge_bvec_fn = NULL; | 3353 | mddev->queue->merge_bvec_fn = NULL; |
| 3326 | mddev->queue->unplug_fn = NULL; | 3354 | mddev->queue->unplug_fn = NULL; |
| 3327 | mddev->queue->issue_flush_fn = NULL; | 3355 | mddev->queue->issue_flush_fn = NULL; |
| 3356 | mddev->queue->backing_dev_info.congested_fn = NULL; | ||
| 3328 | if (mddev->pers->sync_request) | 3357 | if (mddev->pers->sync_request) |
| 3329 | sysfs_remove_group(&mddev->kobj, &md_redundancy_group); | 3358 | sysfs_remove_group(&mddev->kobj, &md_redundancy_group); |
| 3330 | 3359 | ||
| @@ -3371,6 +3400,9 @@ static int do_md_stop(mddev_t * mddev, int mode) | |||
| 3371 | sysfs_remove_link(&mddev->kobj, nm); | 3400 | sysfs_remove_link(&mddev->kobj, nm); |
| 3372 | } | 3401 | } |
| 3373 | 3402 | ||
| 3403 | /* make sure all delayed_delete calls have finished */ | ||
| 3404 | flush_scheduled_work(); | ||
| 3405 | |||
| 3374 | export_array(mddev); | 3406 | export_array(mddev); |
| 3375 | 3407 | ||
| 3376 | mddev->array_size = 0; | 3408 | mddev->array_size = 0; |
| @@ -5385,8 +5417,12 @@ static int remove_and_add_spares(mddev_t *mddev) | |||
| 5385 | if (mddev->pers->hot_add_disk(mddev,rdev)) { | 5417 | if (mddev->pers->hot_add_disk(mddev,rdev)) { |
| 5386 | char nm[20]; | 5418 | char nm[20]; |
| 5387 | sprintf(nm, "rd%d", rdev->raid_disk); | 5419 | sprintf(nm, "rd%d", rdev->raid_disk); |
| 5388 | sysfs_create_link(&mddev->kobj, | 5420 | if (sysfs_create_link(&mddev->kobj, |
| 5389 | &rdev->kobj, nm); | 5421 | &rdev->kobj, nm)) |
| 5422 | printk(KERN_WARNING | ||
| 5423 | "md: cannot register " | ||
| 5424 | "%s for %s\n", | ||
| 5425 | nm, mdname(mddev)); | ||
| 5390 | spares++; | 5426 | spares++; |
| 5391 | md_new_event(mddev); | 5427 | md_new_event(mddev); |
| 5392 | } else | 5428 | } else |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 54a1ad5eef42..8d59914f2057 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -3642,12 +3642,15 @@ static int run(mddev_t *mddev) | |||
| 3642 | } | 3642 | } |
| 3643 | 3643 | ||
| 3644 | /* Ok, everything is just fine now */ | 3644 | /* Ok, everything is just fine now */ |
| 3645 | sysfs_create_group(&mddev->kobj, &raid5_attrs_group); | 3645 | if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group)) |
| 3646 | printk(KERN_WARNING | ||
| 3647 | "raid5: failed to create sysfs attributes for %s\n", | ||
| 3648 | mdname(mddev)); | ||
| 3646 | 3649 | ||
| 3647 | mddev->queue->unplug_fn = raid5_unplug_device; | 3650 | mddev->queue->unplug_fn = raid5_unplug_device; |
| 3648 | mddev->queue->issue_flush_fn = raid5_issue_flush; | 3651 | mddev->queue->issue_flush_fn = raid5_issue_flush; |
| 3649 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | ||
| 3650 | mddev->queue->backing_dev_info.congested_data = mddev; | 3652 | mddev->queue->backing_dev_info.congested_data = mddev; |
| 3653 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | ||
| 3651 | 3654 | ||
| 3652 | mddev->array_size = mddev->size * (conf->previous_raid_disks - | 3655 | mddev->array_size = mddev->size * (conf->previous_raid_disks - |
| 3653 | conf->max_degraded); | 3656 | conf->max_degraded); |
| @@ -3678,6 +3681,7 @@ static int stop(mddev_t *mddev) | |||
| 3678 | mddev->thread = NULL; | 3681 | mddev->thread = NULL; |
| 3679 | shrink_stripes(conf); | 3682 | shrink_stripes(conf); |
| 3680 | kfree(conf->stripe_hashtbl); | 3683 | kfree(conf->stripe_hashtbl); |
| 3684 | mddev->queue->backing_dev_info.congested_fn = NULL; | ||
| 3681 | blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ | 3685 | blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ |
| 3682 | sysfs_remove_group(&mddev->kobj, &raid5_attrs_group); | 3686 | sysfs_remove_group(&mddev->kobj, &raid5_attrs_group); |
| 3683 | kfree(conf->disks); | 3687 | kfree(conf->disks); |
| @@ -3950,7 +3954,12 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
| 3950 | added_devices++; | 3954 | added_devices++; |
| 3951 | rdev->recovery_offset = 0; | 3955 | rdev->recovery_offset = 0; |
| 3952 | sprintf(nm, "rd%d", rdev->raid_disk); | 3956 | sprintf(nm, "rd%d", rdev->raid_disk); |
| 3953 | sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); | 3957 | if (sysfs_create_link(&mddev->kobj, |
| 3958 | &rdev->kobj, nm)) | ||
| 3959 | printk(KERN_WARNING | ||
| 3960 | "raid5: failed to create " | ||
| 3961 | " link %s for %s\n", | ||
| 3962 | nm, mdname(mddev)); | ||
| 3954 | } else | 3963 | } else |
| 3955 | break; | 3964 | break; |
| 3956 | } | 3965 | } |
| @@ -4104,6 +4113,10 @@ static struct mdk_personality raid4_personality = | |||
| 4104 | .spare_active = raid5_spare_active, | 4113 | .spare_active = raid5_spare_active, |
| 4105 | .sync_request = sync_request, | 4114 | .sync_request = sync_request, |
| 4106 | .resize = raid5_resize, | 4115 | .resize = raid5_resize, |
| 4116 | #ifdef CONFIG_MD_RAID5_RESHAPE | ||
| 4117 | .check_reshape = raid5_check_reshape, | ||
| 4118 | .start_reshape = raid5_start_reshape, | ||
| 4119 | #endif | ||
| 4107 | .quiesce = raid5_quiesce, | 4120 | .quiesce = raid5_quiesce, |
| 4108 | }; | 4121 | }; |
| 4109 | 4122 | ||
diff --git a/drivers/media/common/ir-functions.c b/drivers/media/common/ir-functions.c index cbf7c0564889..fcb194135627 100644 --- a/drivers/media/common/ir-functions.c +++ b/drivers/media/common/ir-functions.c | |||
| @@ -310,13 +310,15 @@ void ir_rc5_timer_end(unsigned long data) | |||
| 310 | tv.tv_usec - ir->base_time.tv_usec; | 310 | tv.tv_usec - ir->base_time.tv_usec; |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | /* Allow some timmer jitter (RC5 is ~24ms anyway so this is ok) */ | 313 | /* signal we're ready to start a new code */ |
| 314 | ir->active = 0; | ||
| 315 | |||
| 316 | /* Allow some timer jitter (RC5 is ~24ms anyway so this is ok) */ | ||
| 314 | if (gap < 28000) { | 317 | if (gap < 28000) { |
| 315 | dprintk(1, "ir-common: spurious timer_end\n"); | 318 | dprintk(1, "ir-common: spurious timer_end\n"); |
| 316 | return; | 319 | return; |
| 317 | } | 320 | } |
| 318 | 321 | ||
| 319 | ir->active = 0; | ||
| 320 | if (ir->last_bit < 20) { | 322 | if (ir->last_bit < 20) { |
| 321 | /* ignore spurious codes (caused by light/other remotes) */ | 323 | /* ignore spurious codes (caused by light/other remotes) */ |
| 322 | dprintk(1, "ir-common: short code: %x\n", ir->code); | 324 | dprintk(1, "ir-common: short code: %x\n", ir->code); |
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index fc77de45ca4d..a5c0e1a3e6d1 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
| @@ -180,8 +180,7 @@ static int dvb_dvr_release(struct inode *inode, struct file *file) | |||
| 180 | struct dvb_device *dvbdev = file->private_data; | 180 | struct dvb_device *dvbdev = file->private_data; |
| 181 | struct dmxdev *dmxdev = dvbdev->priv; | 181 | struct dmxdev *dmxdev = dvbdev->priv; |
| 182 | 182 | ||
| 183 | if (mutex_lock_interruptible(&dmxdev->mutex)) | 183 | mutex_lock(&dmxdev->mutex); |
| 184 | return -ERESTARTSYS; | ||
| 185 | 184 | ||
| 186 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) { | 185 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) { |
| 187 | dmxdev->demux->disconnect_frontend(dmxdev->demux); | 186 | dmxdev->demux->disconnect_frontend(dmxdev->demux); |
| @@ -673,13 +672,8 @@ static int dvb_demux_open(struct inode *inode, struct file *file) | |||
| 673 | static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev, | 672 | static int dvb_dmxdev_filter_free(struct dmxdev *dmxdev, |
| 674 | struct dmxdev_filter *dmxdevfilter) | 673 | struct dmxdev_filter *dmxdevfilter) |
| 675 | { | 674 | { |
| 676 | if (mutex_lock_interruptible(&dmxdev->mutex)) | 675 | mutex_lock(&dmxdev->mutex); |
| 677 | return -ERESTARTSYS; | 676 | mutex_lock(&dmxdevfilter->mutex); |
| 678 | |||
| 679 | if (mutex_lock_interruptible(&dmxdevfilter->mutex)) { | ||
| 680 | mutex_unlock(&dmxdev->mutex); | ||
| 681 | return -ERESTARTSYS; | ||
| 682 | } | ||
| 683 | 677 | ||
| 684 | dvb_dmxdev_filter_stop(dmxdevfilter); | 678 | dvb_dmxdev_filter_stop(dmxdevfilter); |
| 685 | dvb_dmxdev_filter_reset(dmxdevfilter); | 679 | dvb_dmxdev_filter_reset(dmxdevfilter); |
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index fcff5eab21a3..6d8d1c3df863 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c | |||
| @@ -673,8 +673,7 @@ static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed *ts_feed) | |||
| 673 | struct dvb_demux *demux = feed->demux; | 673 | struct dvb_demux *demux = feed->demux; |
| 674 | int ret; | 674 | int ret; |
| 675 | 675 | ||
| 676 | if (mutex_lock_interruptible(&demux->mutex)) | 676 | mutex_lock(&demux->mutex); |
| 677 | return -ERESTARTSYS; | ||
| 678 | 677 | ||
| 679 | if (feed->state < DMX_STATE_GO) { | 678 | if (feed->state < DMX_STATE_GO) { |
| 680 | mutex_unlock(&demux->mutex); | 679 | mutex_unlock(&demux->mutex); |
| @@ -748,8 +747,7 @@ static int dvbdmx_release_ts_feed(struct dmx_demux *dmx, | |||
| 748 | struct dvb_demux *demux = (struct dvb_demux *)dmx; | 747 | struct dvb_demux *demux = (struct dvb_demux *)dmx; |
| 749 | struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; | 748 | struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed; |
| 750 | 749 | ||
| 751 | if (mutex_lock_interruptible(&demux->mutex)) | 750 | mutex_lock(&demux->mutex); |
| 752 | return -ERESTARTSYS; | ||
| 753 | 751 | ||
| 754 | if (feed->state == DMX_STATE_FREE) { | 752 | if (feed->state == DMX_STATE_FREE) { |
| 755 | mutex_unlock(&demux->mutex); | 753 | mutex_unlock(&demux->mutex); |
| @@ -916,8 +914,7 @@ static int dmx_section_feed_stop_filtering(struct dmx_section_feed *feed) | |||
| 916 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | 914 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
| 917 | int ret; | 915 | int ret; |
| 918 | 916 | ||
| 919 | if (mutex_lock_interruptible(&dvbdmx->mutex)) | 917 | mutex_lock(&dvbdmx->mutex); |
| 920 | return -ERESTARTSYS; | ||
| 921 | 918 | ||
| 922 | if (!dvbdmx->stop_feed) { | 919 | if (!dvbdmx->stop_feed) { |
| 923 | mutex_unlock(&dvbdmx->mutex); | 920 | mutex_unlock(&dvbdmx->mutex); |
| @@ -942,8 +939,7 @@ static int dmx_section_feed_release_filter(struct dmx_section_feed *feed, | |||
| 942 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; | 939 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; |
| 943 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; | 940 | struct dvb_demux *dvbdmx = dvbdmxfeed->demux; |
| 944 | 941 | ||
| 945 | if (mutex_lock_interruptible(&dvbdmx->mutex)) | 942 | mutex_lock(&dvbdmx->mutex); |
| 946 | return -ERESTARTSYS; | ||
| 947 | 943 | ||
| 948 | if (dvbdmxfilter->feed != dvbdmxfeed) { | 944 | if (dvbdmxfilter->feed != dvbdmxfeed) { |
| 949 | mutex_unlock(&dvbdmx->mutex); | 945 | mutex_unlock(&dvbdmx->mutex); |
| @@ -1016,8 +1012,7 @@ static int dvbdmx_release_section_feed(struct dmx_demux *demux, | |||
| 1016 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; | 1012 | struct dvb_demux_feed *dvbdmxfeed = (struct dvb_demux_feed *)feed; |
| 1017 | struct dvb_demux *dvbdmx = (struct dvb_demux *)demux; | 1013 | struct dvb_demux *dvbdmx = (struct dvb_demux *)demux; |
| 1018 | 1014 | ||
| 1019 | if (mutex_lock_interruptible(&dvbdmx->mutex)) | 1015 | mutex_lock(&dvbdmx->mutex); |
| 1020 | return -ERESTARTSYS; | ||
| 1021 | 1016 | ||
| 1022 | if (dvbdmxfeed->state == DMX_STATE_FREE) { | 1017 | if (dvbdmxfeed->state == DMX_STATE_FREE) { |
| 1023 | mutex_unlock(&dvbdmx->mutex); | 1018 | mutex_unlock(&dvbdmx->mutex); |
| @@ -1126,8 +1121,7 @@ static int dvbdmx_connect_frontend(struct dmx_demux *demux, | |||
| 1126 | if (demux->frontend) | 1121 | if (demux->frontend) |
| 1127 | return -EINVAL; | 1122 | return -EINVAL; |
| 1128 | 1123 | ||
| 1129 | if (mutex_lock_interruptible(&dvbdemux->mutex)) | 1124 | mutex_lock(&dvbdemux->mutex); |
| 1130 | return -ERESTARTSYS; | ||
| 1131 | 1125 | ||
| 1132 | demux->frontend = frontend; | 1126 | demux->frontend = frontend; |
| 1133 | mutex_unlock(&dvbdemux->mutex); | 1127 | mutex_unlock(&dvbdemux->mutex); |
| @@ -1138,8 +1132,7 @@ static int dvbdmx_disconnect_frontend(struct dmx_demux *demux) | |||
| 1138 | { | 1132 | { |
| 1139 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; | 1133 | struct dvb_demux *dvbdemux = (struct dvb_demux *)demux; |
| 1140 | 1134 | ||
| 1141 | if (mutex_lock_interruptible(&dvbdemux->mutex)) | 1135 | mutex_lock(&dvbdemux->mutex); |
| 1142 | return -ERESTARTSYS; | ||
| 1143 | 1136 | ||
| 1144 | demux->frontend = NULL; | 1137 | demux->frontend = NULL; |
| 1145 | mutex_unlock(&dvbdemux->mutex); | 1138 | mutex_unlock(&dvbdemux->mutex); |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 490337b5ee3e..14a372a0fe8b 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
| @@ -203,8 +203,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
| 203 | 203 | ||
| 204 | int id; | 204 | int id; |
| 205 | 205 | ||
| 206 | if (mutex_lock_interruptible(&dvbdev_register_lock)) | 206 | mutex_lock(&dvbdev_register_lock); |
| 207 | return -ERESTARTSYS; | ||
| 208 | 207 | ||
| 209 | if ((id = dvbdev_get_free_id (adap, type)) < 0){ | 208 | if ((id = dvbdev_get_free_id (adap, type)) < 0){ |
| 210 | mutex_unlock(&dvbdev_register_lock); | 209 | mutex_unlock(&dvbdev_register_lock); |
| @@ -294,8 +293,7 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, struct modu | |||
| 294 | { | 293 | { |
| 295 | int num; | 294 | int num; |
| 296 | 295 | ||
| 297 | if (mutex_lock_interruptible(&dvbdev_register_lock)) | 296 | mutex_lock(&dvbdev_register_lock); |
| 298 | return -ERESTARTSYS; | ||
| 299 | 297 | ||
| 300 | if ((num = dvbdev_get_free_adapter_num ()) < 0) { | 298 | if ((num = dvbdev_get_free_adapter_num ()) < 0) { |
| 301 | mutex_unlock(&dvbdev_register_lock); | 299 | mutex_unlock(&dvbdev_register_lock); |
| @@ -323,8 +321,7 @@ EXPORT_SYMBOL(dvb_register_adapter); | |||
| 323 | 321 | ||
| 324 | int dvb_unregister_adapter(struct dvb_adapter *adap) | 322 | int dvb_unregister_adapter(struct dvb_adapter *adap) |
| 325 | { | 323 | { |
| 326 | if (mutex_lock_interruptible(&dvbdev_register_lock)) | 324 | mutex_lock(&dvbdev_register_lock); |
| 327 | return -ERESTARTSYS; | ||
| 328 | list_del (&adap->list_head); | 325 | list_del (&adap->list_head); |
| 329 | mutex_unlock(&dvbdev_register_lock); | 326 | mutex_unlock(&dvbdev_register_lock); |
| 330 | return 0; | 327 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index 9511a31c8f50..68ed3a788083 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | |||
| @@ -107,8 +107,6 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) | |||
| 107 | return -ENOMEM; | 107 | return -ENOMEM; |
| 108 | 108 | ||
| 109 | input_dev->evbit[0] = BIT(EV_KEY); | 109 | input_dev->evbit[0] = BIT(EV_KEY); |
| 110 | input_dev->keycodesize = sizeof(unsigned char); | ||
| 111 | input_dev->keycodemax = KEY_MAX; | ||
| 112 | input_dev->name = "IR-receiver inside an USB DVB receiver"; | 110 | input_dev->name = "IR-receiver inside an USB DVB receiver"; |
| 113 | input_dev->phys = d->rc_phys; | 111 | input_dev->phys = d->rc_phys; |
| 114 | usb_to_input_id(d->udev, &input_dev->id); | 112 | usb_to_input_id(d->udev, &input_dev->id); |
diff --git a/drivers/media/dvb/frontends/isl6421.c b/drivers/media/dvb/frontends/isl6421.c index ef319369ec26..c967148a5945 100644 --- a/drivers/media/dvb/frontends/isl6421.c +++ b/drivers/media/dvb/frontends/isl6421.c | |||
| @@ -122,6 +122,7 @@ struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter | |||
| 122 | /* detect if it is present or not */ | 122 | /* detect if it is present or not */ |
| 123 | if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) { | 123 | if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) { |
| 124 | kfree(isl6421); | 124 | kfree(isl6421); |
| 125 | fe->sec_priv = NULL; | ||
| 125 | return NULL; | 126 | return NULL; |
| 126 | } | 127 | } |
| 127 | 128 | ||
diff --git a/drivers/media/dvb/frontends/nxt200x.c b/drivers/media/dvb/frontends/nxt200x.c index 87c286ee6a00..b809f83d9563 100644 --- a/drivers/media/dvb/frontends/nxt200x.c +++ b/drivers/media/dvb/frontends/nxt200x.c | |||
| @@ -562,7 +562,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, | |||
| 562 | 562 | ||
| 563 | /* set input */ | 563 | /* set input */ |
| 564 | if (state->config->set_pll_input) | 564 | if (state->config->set_pll_input) |
| 565 | state->config->set_pll_input(buf, 1); | 565 | state->config->set_pll_input(buf+1, 1); |
| 566 | break; | 566 | break; |
| 567 | case VSB_8: | 567 | case VSB_8: |
| 568 | /* Set non-punctured clock for VSB */ | 568 | /* Set non-punctured clock for VSB */ |
| @@ -571,7 +571,7 @@ static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe, | |||
| 571 | 571 | ||
| 572 | /* set input */ | 572 | /* set input */ |
| 573 | if (state->config->set_pll_input) | 573 | if (state->config->set_pll_input) |
| 574 | state->config->set_pll_input(buf, 0); | 574 | state->config->set_pll_input(buf+1, 0); |
| 575 | break; | 575 | break; |
| 576 | default: | 576 | default: |
| 577 | return -EINVAL; | 577 | return -EINVAL; |
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c index 4c27a2d90a38..ccc429cbbad0 100644 --- a/drivers/media/dvb/frontends/tda10086.c +++ b/drivers/media/dvb/frontends/tda10086.c | |||
| @@ -212,7 +212,7 @@ static int tda10086_send_master_cmd (struct dvb_frontend* fe, | |||
| 212 | for(i=0; i< cmd->msg_len; i++) { | 212 | for(i=0; i< cmd->msg_len; i++) { |
| 213 | tda10086_write_byte(state, 0x48+i, cmd->msg[i]); | 213 | tda10086_write_byte(state, 0x48+i, cmd->msg[i]); |
| 214 | } | 214 | } |
| 215 | tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len + 1) << 4)); | 215 | tda10086_write_byte(state, 0x36, 0x08 | ((cmd->msg_len - 1) << 4)); |
| 216 | 216 | ||
| 217 | tda10086_diseqc_wait(state); | 217 | tda10086_diseqc_wait(state); |
| 218 | 218 | ||
diff --git a/drivers/media/dvb/pluto2/pluto2.c b/drivers/media/dvb/pluto2/pluto2.c index ffda71dfdd65..058df5c10034 100644 --- a/drivers/media/dvb/pluto2/pluto2.c +++ b/drivers/media/dvb/pluto2/pluto2.c | |||
| @@ -149,6 +149,15 @@ static inline void pluto_rw(struct pluto *pluto, u32 reg, u32 mask, u32 bits) | |||
| 149 | writel(val, &pluto->io_mem[reg]); | 149 | writel(val, &pluto->io_mem[reg]); |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | static void pluto_write_tscr(struct pluto *pluto, u32 val) | ||
| 153 | { | ||
| 154 | /* set the number of packets */ | ||
| 155 | val &= ~TSCR_ADEF; | ||
| 156 | val |= TS_DMA_PACKETS / 2; | ||
| 157 | |||
| 158 | pluto_writereg(pluto, REG_TSCR, val); | ||
| 159 | } | ||
| 160 | |||
| 152 | static void pluto_setsda(void *data, int state) | 161 | static void pluto_setsda(void *data, int state) |
| 153 | { | 162 | { |
| 154 | struct pluto *pluto = data; | 163 | struct pluto *pluto = data; |
| @@ -213,11 +222,11 @@ static void pluto_reset_ts(struct pluto *pluto, int reenable) | |||
| 213 | 222 | ||
| 214 | if (val & TSCR_RSTN) { | 223 | if (val & TSCR_RSTN) { |
| 215 | val &= ~TSCR_RSTN; | 224 | val &= ~TSCR_RSTN; |
| 216 | pluto_writereg(pluto, REG_TSCR, val); | 225 | pluto_write_tscr(pluto, val); |
| 217 | } | 226 | } |
| 218 | if (reenable) { | 227 | if (reenable) { |
| 219 | val |= TSCR_RSTN; | 228 | val |= TSCR_RSTN; |
| 220 | pluto_writereg(pluto, REG_TSCR, val); | 229 | pluto_write_tscr(pluto, val); |
| 221 | } | 230 | } |
| 222 | } | 231 | } |
| 223 | 232 | ||
| @@ -339,7 +348,7 @@ static irqreturn_t pluto_irq(int irq, void *dev_id) | |||
| 339 | } | 348 | } |
| 340 | 349 | ||
| 341 | /* ACK the interrupt */ | 350 | /* ACK the interrupt */ |
| 342 | pluto_writereg(pluto, REG_TSCR, tscr | TSCR_IACK); | 351 | pluto_write_tscr(pluto, tscr | TSCR_IACK); |
| 343 | 352 | ||
| 344 | return IRQ_HANDLED; | 353 | return IRQ_HANDLED; |
| 345 | } | 354 | } |
| @@ -348,9 +357,6 @@ static void __devinit pluto_enable_irqs(struct pluto *pluto) | |||
| 348 | { | 357 | { |
| 349 | u32 val = pluto_readreg(pluto, REG_TSCR); | 358 | u32 val = pluto_readreg(pluto, REG_TSCR); |
| 350 | 359 | ||
| 351 | /* set the number of packets */ | ||
| 352 | val &= ~TSCR_ADEF; | ||
| 353 | val |= TS_DMA_PACKETS / 2; | ||
| 354 | /* disable AFUL and LOCK interrupts */ | 360 | /* disable AFUL and LOCK interrupts */ |
| 355 | val |= (TSCR_MSKA | TSCR_MSKL); | 361 | val |= (TSCR_MSKA | TSCR_MSKL); |
| 356 | /* enable DMA and OVERFLOW interrupts */ | 362 | /* enable DMA and OVERFLOW interrupts */ |
| @@ -358,7 +364,7 @@ static void __devinit pluto_enable_irqs(struct pluto *pluto) | |||
| 358 | /* clear pending interrupts */ | 364 | /* clear pending interrupts */ |
| 359 | val |= TSCR_IACK; | 365 | val |= TSCR_IACK; |
| 360 | 366 | ||
| 361 | pluto_writereg(pluto, REG_TSCR, val); | 367 | pluto_write_tscr(pluto, val); |
| 362 | } | 368 | } |
| 363 | 369 | ||
| 364 | static void pluto_disable_irqs(struct pluto *pluto) | 370 | static void pluto_disable_irqs(struct pluto *pluto) |
| @@ -370,7 +376,7 @@ static void pluto_disable_irqs(struct pluto *pluto) | |||
| 370 | /* clear pending interrupts */ | 376 | /* clear pending interrupts */ |
| 371 | val |= TSCR_IACK; | 377 | val |= TSCR_IACK; |
| 372 | 378 | ||
| 373 | pluto_writereg(pluto, REG_TSCR, val); | 379 | pluto_write_tscr(pluto, val); |
| 374 | } | 380 | } |
| 375 | 381 | ||
| 376 | static int __devinit pluto_hw_init(struct pluto *pluto) | 382 | static int __devinit pluto_hw_init(struct pluto *pluto) |
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig index 920b63f8cf05..af66a5d5ecd8 100644 --- a/drivers/media/radio/Kconfig +++ b/drivers/media/radio/Kconfig | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | menu "Radio Adapters" | 5 | menu "Radio Adapters" |
| 6 | depends on VIDEO_DEV!=n | 6 | depends on VIDEO_DEV |
| 7 | 7 | ||
| 8 | config RADIO_CADET | 8 | config RADIO_CADET |
| 9 | tristate "ADS Cadet AM/FM Tuner" | 9 | tristate "ADS Cadet AM/FM Tuner" |
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 2fb9fe6a1ae7..ba1af3c8525e 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
| @@ -780,18 +780,16 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 780 | return 0; | 780 | return 0; |
| 781 | } | 781 | } |
| 782 | 782 | ||
| 783 | static int msp_suspend(struct device * dev, pm_message_t state) | 783 | static int msp_suspend(struct i2c_client *client, pm_message_t state) |
| 784 | { | 784 | { |
| 785 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | ||
| 786 | 785 | ||
| 787 | v4l_dbg(1, msp_debug, client, "suspend\n"); | 786 | v4l_dbg(1, msp_debug, client, "suspend\n"); |
| 788 | msp_reset(client); | 787 | msp_reset(client); |
| 789 | return 0; | 788 | return 0; |
| 790 | } | 789 | } |
| 791 | 790 | ||
| 792 | static int msp_resume(struct device * dev) | 791 | static int msp_resume(struct i2c_client *client) |
| 793 | { | 792 | { |
| 794 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | ||
| 795 | 793 | ||
| 796 | v4l_dbg(1, msp_debug, client, "resume\n"); | 794 | v4l_dbg(1, msp_debug, client, "resume\n"); |
| 797 | msp_wake_thread(client); | 795 | msp_wake_thread(client); |
| @@ -825,7 +823,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
| 825 | if (msp_reset(client) == -1) { | 823 | if (msp_reset(client) == -1) { |
| 826 | v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); | 824 | v4l_dbg(1, msp_debug, client, "msp3400 not found\n"); |
| 827 | kfree(client); | 825 | kfree(client); |
| 828 | return -1; | 826 | return 0; |
| 829 | } | 827 | } |
| 830 | 828 | ||
| 831 | state = kmalloc(sizeof(*state), GFP_KERNEL); | 829 | state = kmalloc(sizeof(*state), GFP_KERNEL); |
| @@ -859,7 +857,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
| 859 | v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n"); | 857 | v4l_dbg(1, msp_debug, client, "not an msp3400 (cannot read chip version)\n"); |
| 860 | kfree(state); | 858 | kfree(state); |
| 861 | kfree(client); | 859 | kfree(client); |
| 862 | return -1; | 860 | return 0; |
| 863 | } | 861 | } |
| 864 | 862 | ||
| 865 | msp_set_audio(client); | 863 | msp_set_audio(client); |
| @@ -996,11 +994,11 @@ static struct i2c_driver i2c_driver = { | |||
| 996 | .id = I2C_DRIVERID_MSP3400, | 994 | .id = I2C_DRIVERID_MSP3400, |
| 997 | .attach_adapter = msp_probe, | 995 | .attach_adapter = msp_probe, |
| 998 | .detach_client = msp_detach, | 996 | .detach_client = msp_detach, |
| 997 | .suspend = msp_suspend, | ||
| 998 | .resume = msp_resume, | ||
| 999 | .command = msp_command, | 999 | .command = msp_command, |
| 1000 | .driver = { | 1000 | .driver = { |
| 1001 | .name = "msp3400", | 1001 | .name = "msp3400", |
| 1002 | .suspend = msp_suspend, | ||
| 1003 | .resume = msp_resume, | ||
| 1004 | }, | 1002 | }, |
| 1005 | }; | 1003 | }; |
| 1006 | 1004 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index 1ff5138e4bb6..9916cf32494d 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
| @@ -1248,10 +1248,10 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) | |||
| 1248 | ret |= pvr2_write_register(hdw, 0xaa18, 0x00840000); /*unknown*/ | 1248 | ret |= pvr2_write_register(hdw, 0xaa18, 0x00840000); /*unknown*/ |
| 1249 | LOCK_TAKE(hdw->ctl_lock); do { | 1249 | LOCK_TAKE(hdw->ctl_lock); do { |
| 1250 | hdw->cmd_buffer[0] = FX2CMD_FWPOST1; | 1250 | hdw->cmd_buffer[0] = FX2CMD_FWPOST1; |
| 1251 | ret |= pvr2_send_request(hdw,hdw->cmd_buffer,1,0,0); | 1251 | ret |= pvr2_send_request(hdw,hdw->cmd_buffer,1,NULL,0); |
| 1252 | hdw->cmd_buffer[0] = FX2CMD_MEMSEL; | 1252 | hdw->cmd_buffer[0] = FX2CMD_MEMSEL; |
| 1253 | hdw->cmd_buffer[1] = 0; | 1253 | hdw->cmd_buffer[1] = 0; |
| 1254 | ret |= pvr2_send_request(hdw,hdw->cmd_buffer,2,0,0); | 1254 | ret |= pvr2_send_request(hdw,hdw->cmd_buffer,2,NULL,0); |
| 1255 | } while (0); LOCK_GIVE(hdw->ctl_lock); | 1255 | } while (0); LOCK_GIVE(hdw->ctl_lock); |
| 1256 | 1256 | ||
| 1257 | if (ret) { | 1257 | if (ret) { |
| @@ -1320,7 +1320,7 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw) | |||
| 1320 | LOCK_TAKE(hdw->ctl_lock); do { | 1320 | LOCK_TAKE(hdw->ctl_lock); do { |
| 1321 | hdw->cmd_buffer[0] = FX2CMD_MEMSEL; | 1321 | hdw->cmd_buffer[0] = FX2CMD_MEMSEL; |
| 1322 | hdw->cmd_buffer[1] = 0; | 1322 | hdw->cmd_buffer[1] = 0; |
| 1323 | ret |= pvr2_send_request(hdw,hdw->cmd_buffer,2,0,0); | 1323 | ret |= pvr2_send_request(hdw,hdw->cmd_buffer,2,NULL,0); |
| 1324 | } while (0); LOCK_GIVE(hdw->ctl_lock); | 1324 | } while (0); LOCK_GIVE(hdw->ctl_lock); |
| 1325 | 1325 | ||
| 1326 | if (ret) { | 1326 | if (ret) { |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 5313d342666e..25d3830b482a 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | |||
| @@ -808,11 +808,11 @@ static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp) | |||
| 808 | { | 808 | { |
| 809 | if (vp->dev_video) { | 809 | if (vp->dev_video) { |
| 810 | pvr2_v4l2_dev_destroy(vp->dev_video); | 810 | pvr2_v4l2_dev_destroy(vp->dev_video); |
| 811 | vp->dev_video = 0; | 811 | vp->dev_video = NULL; |
| 812 | } | 812 | } |
| 813 | if (vp->dev_radio) { | 813 | if (vp->dev_radio) { |
| 814 | pvr2_v4l2_dev_destroy(vp->dev_radio); | 814 | pvr2_v4l2_dev_destroy(vp->dev_radio); |
| 815 | vp->dev_radio = 0; | 815 | vp->dev_radio = NULL; |
| 816 | } | 816 | } |
| 817 | 817 | ||
| 818 | pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_v4l2 id=%p",vp); | 818 | pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_v4l2 id=%p",vp); |
| @@ -1138,7 +1138,7 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip, | |||
| 1138 | { | 1138 | { |
| 1139 | int mindevnum; | 1139 | int mindevnum; |
| 1140 | int unit_number; | 1140 | int unit_number; |
| 1141 | int *nr_ptr = 0; | 1141 | int *nr_ptr = NULL; |
| 1142 | dip->v4lp = vp; | 1142 | dip->v4lp = vp; |
| 1143 | 1143 | ||
| 1144 | 1144 | ||
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index 7735b6758921..4d5bbd859de1 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
| @@ -961,7 +961,7 @@ static void saa711x_set_v4lstd(struct i2c_client *client, v4l2_std_id std) | |||
| 961 | reg |= 0x10; | 961 | reg |= 0x10; |
| 962 | } else if (std == V4L2_STD_NTSC_M_JP) { | 962 | } else if (std == V4L2_STD_NTSC_M_JP) { |
| 963 | reg |= 0x40; | 963 | reg |= 0x40; |
| 964 | } else if (std == V4L2_STD_SECAM) { | 964 | } else if (std & V4L2_STD_SECAM) { |
| 965 | reg |= 0x50; | 965 | reg |= 0x50; |
| 966 | } | 966 | } |
| 967 | saa711x_write(client, R_0E_CHROMA_CNTL_1, reg); | 967 | saa711x_write(client, R_0E_CHROMA_CNTL_1, reg); |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 7be73e3763de..15dbc6bf42a7 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
| @@ -804,9 +804,8 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
| 804 | return 0; | 804 | return 0; |
| 805 | } | 805 | } |
| 806 | 806 | ||
| 807 | static int tuner_suspend(struct device *dev, pm_message_t state) | 807 | static int tuner_suspend(struct i2c_client *c, pm_message_t state) |
| 808 | { | 808 | { |
| 809 | struct i2c_client *c = container_of (dev, struct i2c_client, dev); | ||
| 810 | struct tuner *t = i2c_get_clientdata (c); | 809 | struct tuner *t = i2c_get_clientdata (c); |
| 811 | 810 | ||
| 812 | tuner_dbg ("suspend\n"); | 811 | tuner_dbg ("suspend\n"); |
| @@ -814,9 +813,8 @@ static int tuner_suspend(struct device *dev, pm_message_t state) | |||
| 814 | return 0; | 813 | return 0; |
| 815 | } | 814 | } |
| 816 | 815 | ||
| 817 | static int tuner_resume(struct device *dev) | 816 | static int tuner_resume(struct i2c_client *c) |
| 818 | { | 817 | { |
| 819 | struct i2c_client *c = container_of (dev, struct i2c_client, dev); | ||
| 820 | struct tuner *t = i2c_get_clientdata (c); | 818 | struct tuner *t = i2c_get_clientdata (c); |
| 821 | 819 | ||
| 822 | tuner_dbg ("resume\n"); | 820 | tuner_dbg ("resume\n"); |
| @@ -837,10 +835,10 @@ static struct i2c_driver driver = { | |||
| 837 | .attach_adapter = tuner_probe, | 835 | .attach_adapter = tuner_probe, |
| 838 | .detach_client = tuner_detach, | 836 | .detach_client = tuner_detach, |
| 839 | .command = tuner_command, | 837 | .command = tuner_command, |
| 838 | .suspend = tuner_suspend, | ||
| 839 | .resume = tuner_resume, | ||
| 840 | .driver = { | 840 | .driver = { |
| 841 | .name = "tuner", | 841 | .name = "tuner", |
| 842 | .suspend = tuner_suspend, | ||
| 843 | .resume = tuner_resume, | ||
| 844 | }, | 842 | }, |
| 845 | }; | 843 | }; |
| 846 | static struct i2c_client client_template = { | 844 | static struct i2c_client client_template = { |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 404c014db1bd..1d2d03f77894 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
| @@ -815,7 +815,7 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
| 815 | static int | 815 | static int |
| 816 | mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | 816 | mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) |
| 817 | { | 817 | { |
| 818 | MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; | 818 | MPT_SCSI_HOST *hd; |
| 819 | struct mptsas_target_reset_event *target_reset_list, *n; | 819 | struct mptsas_target_reset_event *target_reset_list, *n; |
| 820 | int rc; | 820 | int rc; |
| 821 | 821 | ||
| @@ -827,7 +827,10 @@ mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
| 827 | if (reset_phase != MPT_IOC_POST_RESET) | 827 | if (reset_phase != MPT_IOC_POST_RESET) |
| 828 | goto out; | 828 | goto out; |
| 829 | 829 | ||
| 830 | if (!hd || !hd->ioc) | 830 | if (!ioc->sh || !ioc->sh->hostdata) |
| 831 | goto out; | ||
| 832 | hd = (MPT_SCSI_HOST *)ioc->sh->hostdata; | ||
| 833 | if (!hd->ioc) | ||
| 831 | goto out; | 834 | goto out; |
| 832 | 835 | ||
| 833 | if (list_empty(&hd->target_reset_list)) | 836 | if (list_empty(&hd->target_reset_list)) |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index da9859f2caf2..b17c4b2bc9ef 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
| @@ -390,13 +390,6 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req) | |||
| 390 | return BLKPREP_KILL; | 390 | return BLKPREP_KILL; |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | /* request is already processed by us, so return */ | ||
| 394 | if (blk_special_request(req)) { | ||
| 395 | osm_debug("REQ_SPECIAL already set!\n"); | ||
| 396 | req->cmd_flags |= REQ_DONTPREP; | ||
| 397 | return BLKPREP_OK; | ||
| 398 | } | ||
| 399 | |||
| 400 | /* connect the i2o_block_request to the request */ | 393 | /* connect the i2o_block_request to the request */ |
| 401 | if (!req->special) { | 394 | if (!req->special) { |
| 402 | ireq = i2o_block_request_alloc(); | 395 | ireq = i2o_block_request_alloc(); |
| @@ -408,11 +401,8 @@ static int i2o_block_prep_req_fn(struct request_queue *q, struct request *req) | |||
| 408 | ireq->i2o_blk_dev = i2o_blk_dev; | 401 | ireq->i2o_blk_dev = i2o_blk_dev; |
| 409 | req->special = ireq; | 402 | req->special = ireq; |
| 410 | ireq->req = req; | 403 | ireq->req = req; |
| 411 | } else | 404 | } |
| 412 | ireq = req->special; | ||
| 413 | |||
| 414 | /* do not come back here */ | 405 | /* do not come back here */ |
| 415 | req->cmd_type = REQ_TYPE_SPECIAL; | ||
| 416 | req->cmd_flags |= REQ_DONTPREP; | 406 | req->cmd_flags |= REQ_DONTPREP; |
| 417 | 407 | ||
| 418 | return BLKPREP_OK; | 408 | return BLKPREP_OK; |
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index c707c8ebc1a2..b0b4458ae90b 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c | |||
| @@ -319,7 +319,7 @@ int sm501_unit_power(struct device *dev, unsigned int unit, unsigned int to) | |||
| 319 | 319 | ||
| 320 | mode &= 3; /* get current power mode */ | 320 | mode &= 3; /* get current power mode */ |
| 321 | 321 | ||
| 322 | if (unit > ARRAY_SIZE(sm->unit_power)) { | 322 | if (unit >= ARRAY_SIZE(sm->unit_power)) { |
| 323 | dev_err(dev, "%s: bad unit %d\n", __FUNCTION__, unit); | 323 | dev_err(dev, "%s: bad unit %d\n", __FUNCTION__, unit); |
| 324 | goto already; | 324 | goto already; |
| 325 | } | 325 | } |
diff --git a/drivers/mmc/imxmmc.c b/drivers/mmc/imxmmc.c index b060d4bfba29..0de5c9e94e74 100644 --- a/drivers/mmc/imxmmc.c +++ b/drivers/mmc/imxmmc.c | |||
| @@ -569,10 +569,12 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat) | |||
| 569 | 569 | ||
| 570 | if(host->dma_dir == DMA_FROM_DEVICE) { | 570 | if(host->dma_dir == DMA_FROM_DEVICE) { |
| 571 | imxmci_busy_wait_for_status(host, &stat, | 571 | imxmci_busy_wait_for_status(host, &stat, |
| 572 | STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE, | 572 | STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE | |
| 573 | STATUS_TIME_OUT_READ, | ||
| 573 | 50, "imxmci_cpu_driven_data read"); | 574 | 50, "imxmci_cpu_driven_data read"); |
| 574 | 575 | ||
| 575 | while((stat & (STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE)) && | 576 | while((stat & (STATUS_APPL_BUFF_FF | STATUS_DATA_TRANS_DONE)) && |
| 577 | !(stat & STATUS_TIME_OUT_READ) && | ||
| 576 | (host->data_cnt < 512)) { | 578 | (host->data_cnt < 512)) { |
| 577 | 579 | ||
| 578 | udelay(20); /* required for clocks < 8MHz*/ | 580 | udelay(20); /* required for clocks < 8MHz*/ |
| @@ -602,6 +604,12 @@ static int imxmci_cpu_driven_data(struct imxmci_host *host, unsigned int *pstat) | |||
| 602 | if(host->dma_size & 0x1ff) | 604 | if(host->dma_size & 0x1ff) |
| 603 | stat &= ~STATUS_CRC_READ_ERR; | 605 | stat &= ~STATUS_CRC_READ_ERR; |
| 604 | 606 | ||
| 607 | if(stat & STATUS_TIME_OUT_READ) { | ||
| 608 | dev_dbg(mmc_dev(host->mmc), "imxmci_cpu_driven_data read timeout STATUS = 0x%x\n", | ||
| 609 | stat); | ||
| 610 | trans_done = -1; | ||
| 611 | } | ||
| 612 | |||
| 605 | } else { | 613 | } else { |
| 606 | imxmci_busy_wait_for_status(host, &stat, | 614 | imxmci_busy_wait_for_status(host, &stat, |
| 607 | STATUS_APPL_BUFF_FE, | 615 | STATUS_APPL_BUFF_FE, |
| @@ -709,6 +717,9 @@ static void imxmci_tasklet_fnc(unsigned long data) | |||
| 709 | */ | 717 | */ |
| 710 | stat |= host->status_reg; | 718 | stat |= host->status_reg; |
| 711 | 719 | ||
| 720 | if(test_bit(IMXMCI_PEND_CPU_DATA_b, &host->pending_events)) | ||
| 721 | stat &= ~STATUS_CRC_READ_ERR; | ||
| 722 | |||
| 712 | if(test_bit(IMXMCI_PEND_WAIT_RESP_b, &host->pending_events)) { | 723 | if(test_bit(IMXMCI_PEND_WAIT_RESP_b, &host->pending_events)) { |
| 713 | imxmci_busy_wait_for_status(host, &stat, | 724 | imxmci_busy_wait_for_status(host, &stat, |
| 714 | STATUS_END_CMD_RESP | STATUS_ERR_MASK, | 725 | STATUS_END_CMD_RESP | STATUS_ERR_MASK, |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 5ff0922e628c..a3d46ea37126 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
| @@ -2263,6 +2263,7 @@ config GIANFAR | |||
| 2263 | tristate "Gianfar Ethernet" | 2263 | tristate "Gianfar Ethernet" |
| 2264 | depends on 85xx || 83xx || PPC_86xx | 2264 | depends on 85xx || 83xx || PPC_86xx |
| 2265 | select PHYLIB | 2265 | select PHYLIB |
| 2266 | select CRC32 | ||
| 2266 | help | 2267 | help |
| 2267 | This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx, | 2268 | This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx, |
| 2268 | and MPC86xx family of chips, and the FEC on the 8540. | 2269 | and MPC86xx family of chips, and the FEC on the 8540. |
| @@ -2372,22 +2373,23 @@ config CHELSIO_T1_NAPI | |||
| 2372 | when the driver is receiving lots of packets from the card. | 2373 | when the driver is receiving lots of packets from the card. |
| 2373 | 2374 | ||
| 2374 | config CHELSIO_T3 | 2375 | config CHELSIO_T3 |
| 2375 | tristate "Chelsio Communications T3 10Gb Ethernet support" | 2376 | tristate "Chelsio Communications T3 10Gb Ethernet support" |
| 2376 | depends on PCI | 2377 | depends on PCI |
| 2377 | help | 2378 | select FW_LOADER |
| 2378 | This driver supports Chelsio T3-based gigabit and 10Gb Ethernet | 2379 | help |
| 2379 | adapters. | 2380 | This driver supports Chelsio T3-based gigabit and 10Gb Ethernet |
| 2381 | adapters. | ||
| 2380 | 2382 | ||
| 2381 | For general information about Chelsio and our products, visit | 2383 | For general information about Chelsio and our products, visit |
| 2382 | our website at <http://www.chelsio.com>. | 2384 | our website at <http://www.chelsio.com>. |
| 2383 | 2385 | ||
| 2384 | For customer support, please visit our customer support page at | 2386 | For customer support, please visit our customer support page at |
| 2385 | <http://www.chelsio.com/support.htm>. | 2387 | <http://www.chelsio.com/support.htm>. |
| 2386 | 2388 | ||
| 2387 | Please send feedback to <linux-bugs@chelsio.com>. | 2389 | Please send feedback to <linux-bugs@chelsio.com>. |
| 2388 | 2390 | ||
| 2389 | To compile this driver as a module, choose M here: the module | 2391 | To compile this driver as a module, choose M here: the module |
| 2390 | will be called cxgb3. | 2392 | will be called cxgb3. |
| 2391 | 2393 | ||
| 2392 | config EHEA | 2394 | config EHEA |
| 2393 | tristate "eHEA Ethernet support" | 2395 | tristate "eHEA Ethernet support" |
diff --git a/drivers/net/atl1/atl1_hw.c b/drivers/net/atl1/atl1_hw.c index 314dbaabb642..69482e0d849b 100644 --- a/drivers/net/atl1/atl1_hw.c +++ b/drivers/net/atl1/atl1_hw.c | |||
| @@ -334,7 +334,6 @@ u32 atl1_hash_mc_addr(struct atl1_hw *hw, u8 *mc_addr) | |||
| 334 | int i; | 334 | int i; |
| 335 | 335 | ||
| 336 | crc32 = ether_crc_le(6, mc_addr); | 336 | crc32 = ether_crc_le(6, mc_addr); |
| 337 | crc32 = ~crc32; | ||
| 338 | for (i = 0; i < 32; i++) | 337 | for (i = 0; i < 32; i++) |
| 339 | value |= (((crc32 >> i) & 1) << (31 - i)); | 338 | value |= (((crc32 >> i) & 1) << (31 - i)); |
| 340 | 339 | ||
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index 88d4f70035bb..8606eac5bec8 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
| @@ -1328,7 +1328,7 @@ static int atl1_tx_csum(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
| 1328 | 1328 | ||
| 1329 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 1329 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
| 1330 | cso = skb->h.raw - skb->data; | 1330 | cso = skb->h.raw - skb->data; |
| 1331 | css = (skb->h.raw + skb->csum) - skb->data; | 1331 | css = (skb->h.raw + skb->csum_offset) - skb->data; |
| 1332 | if (unlikely(cso & 0x1)) { | 1332 | if (unlikely(cso & 0x1)) { |
| 1333 | printk(KERN_DEBUG "%s: payload offset != even number\n", | 1333 | printk(KERN_DEBUG "%s: payload offset != even number\n", |
| 1334 | atl1_driver_name); | 1334 | atl1_driver_name); |
| @@ -1562,7 +1562,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
| 1562 | /* mss will be nonzero if we're doing segment offload (TSO/GSO) */ | 1562 | /* mss will be nonzero if we're doing segment offload (TSO/GSO) */ |
| 1563 | mss = skb_shinfo(skb)->gso_size; | 1563 | mss = skb_shinfo(skb)->gso_size; |
| 1564 | if (mss) { | 1564 | if (mss) { |
| 1565 | if (skb->protocol == ntohs(ETH_P_IP)) { | 1565 | if (skb->protocol == htons(ETH_P_IP)) { |
| 1566 | proto_hdr_len = ((skb->h.raw - skb->data) + | 1566 | proto_hdr_len = ((skb->h.raw - skb->data) + |
| 1567 | (skb->h.th->doff << 2)); | 1567 | (skb->h.th->doff << 2)); |
| 1568 | if (unlikely(proto_hdr_len > len)) { | 1568 | if (unlikely(proto_hdr_len > len)) { |
| @@ -2320,6 +2320,16 @@ static void __devexit atl1_remove(struct pci_dev *pdev) | |||
| 2320 | return; | 2320 | return; |
| 2321 | 2321 | ||
| 2322 | adapter = netdev_priv(netdev); | 2322 | adapter = netdev_priv(netdev); |
| 2323 | |||
| 2324 | /* Some atl1 boards lack persistent storage for their MAC, and get it | ||
| 2325 | * from the BIOS during POST. If we've been messing with the MAC | ||
| 2326 | * address, we need to save the permanent one. | ||
| 2327 | */ | ||
| 2328 | if (memcmp(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN)) { | ||
| 2329 | memcpy(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN); | ||
| 2330 | atl1_set_mac_addr(&adapter->hw); | ||
| 2331 | } | ||
| 2332 | |||
| 2323 | iowrite16(0, adapter->hw.hw_addr + REG_GPHY_ENABLE); | 2333 | iowrite16(0, adapter->hw.hw_addr + REG_GPHY_ENABLE); |
| 2324 | unregister_netdev(netdev); | 2334 | unregister_netdev(netdev); |
| 2325 | pci_iounmap(pdev, adapter->hw.hw_addr); | 2335 | pci_iounmap(pdev, adapter->hw.hw_addr); |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index aaada572732a..d742bfe24471 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
| @@ -1709,7 +1709,7 @@ static void __b44_set_rx_mode(struct net_device *dev) | |||
| 1709 | bw32(bp, B44_RXCONFIG, val); | 1709 | bw32(bp, B44_RXCONFIG, val); |
| 1710 | } else { | 1710 | } else { |
| 1711 | unsigned char zero[6] = {0, 0, 0, 0, 0, 0}; | 1711 | unsigned char zero[6] = {0, 0, 0, 0, 0, 0}; |
| 1712 | int i = 0; | 1712 | int i = 1; |
| 1713 | 1713 | ||
| 1714 | __b44_set_mac_addr(bp); | 1714 | __b44_set_mac_addr(bp); |
| 1715 | 1715 | ||
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index c12e5ea61819..e85f5ec48f96 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
| @@ -54,8 +54,8 @@ | |||
| 54 | 54 | ||
| 55 | #define DRV_MODULE_NAME "bnx2" | 55 | #define DRV_MODULE_NAME "bnx2" |
| 56 | #define PFX DRV_MODULE_NAME ": " | 56 | #define PFX DRV_MODULE_NAME ": " |
| 57 | #define DRV_MODULE_VERSION "1.5.5" | 57 | #define DRV_MODULE_VERSION "1.5.8" |
| 58 | #define DRV_MODULE_RELDATE "February 1, 2007" | 58 | #define DRV_MODULE_RELDATE "April 24, 2007" |
| 59 | 59 | ||
| 60 | #define RUN_AT(x) (jiffies + (x)) | 60 | #define RUN_AT(x) (jiffies + (x)) |
| 61 | 61 | ||
| @@ -2033,8 +2033,8 @@ bnx2_has_work(struct bnx2 *bp) | |||
| 2033 | (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) | 2033 | (sblk->status_tx_quick_consumer_index0 != bp->hw_tx_cons)) |
| 2034 | return 1; | 2034 | return 1; |
| 2035 | 2035 | ||
| 2036 | if (((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != 0) != | 2036 | if ((sblk->status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) != |
| 2037 | bp->link_up) | 2037 | (sblk->status_attn_bits_ack & STATUS_ATTN_BITS_LINK_STATE)) |
| 2038 | return 1; | 2038 | return 1; |
| 2039 | 2039 | ||
| 2040 | return 0; | 2040 | return 0; |
| @@ -3099,20 +3099,18 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
| 3099 | 3099 | ||
| 3100 | if ((align_start = (offset32 & 3))) { | 3100 | if ((align_start = (offset32 & 3))) { |
| 3101 | offset32 &= ~3; | 3101 | offset32 &= ~3; |
| 3102 | len32 += (4 - align_start); | 3102 | len32 += align_start; |
| 3103 | if (len32 < 4) | ||
| 3104 | len32 = 4; | ||
| 3103 | if ((rc = bnx2_nvram_read(bp, offset32, start, 4))) | 3105 | if ((rc = bnx2_nvram_read(bp, offset32, start, 4))) |
| 3104 | return rc; | 3106 | return rc; |
| 3105 | } | 3107 | } |
| 3106 | 3108 | ||
| 3107 | if (len32 & 3) { | 3109 | if (len32 & 3) { |
| 3108 | if ((len32 > 4) || !align_start) { | 3110 | align_end = 4 - (len32 & 3); |
| 3109 | align_end = 4 - (len32 & 3); | 3111 | len32 += align_end; |
| 3110 | len32 += align_end; | 3112 | if ((rc = bnx2_nvram_read(bp, offset32 + len32 - 4, end, 4))) |
| 3111 | if ((rc = bnx2_nvram_read(bp, offset32 + len32 - 4, | 3113 | return rc; |
| 3112 | end, 4))) { | ||
| 3113 | return rc; | ||
| 3114 | } | ||
| 3115 | } | ||
| 3116 | } | 3114 | } |
| 3117 | 3115 | ||
| 3118 | if (align_start || align_end) { | 3116 | if (align_start || align_end) { |
| @@ -3187,17 +3185,17 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf, | |||
| 3187 | if ((rc = bnx2_enable_nvram_write(bp)) != 0) | 3185 | if ((rc = bnx2_enable_nvram_write(bp)) != 0) |
| 3188 | goto nvram_write_end; | 3186 | goto nvram_write_end; |
| 3189 | 3187 | ||
| 3190 | /* Erase the page */ | ||
| 3191 | if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0) | ||
| 3192 | goto nvram_write_end; | ||
| 3193 | |||
| 3194 | /* Re-enable the write again for the actual write */ | ||
| 3195 | bnx2_enable_nvram_write(bp); | ||
| 3196 | |||
| 3197 | /* Loop to write back the buffer data from page_start to | 3188 | /* Loop to write back the buffer data from page_start to |
| 3198 | * data_start */ | 3189 | * data_start */ |
| 3199 | i = 0; | 3190 | i = 0; |
| 3200 | if (bp->flash_info->buffered == 0) { | 3191 | if (bp->flash_info->buffered == 0) { |
| 3192 | /* Erase the page */ | ||
| 3193 | if ((rc = bnx2_nvram_erase_page(bp, page_start)) != 0) | ||
| 3194 | goto nvram_write_end; | ||
| 3195 | |||
| 3196 | /* Re-enable the write again for the actual write */ | ||
| 3197 | bnx2_enable_nvram_write(bp); | ||
| 3198 | |||
| 3201 | for (addr = page_start; addr < data_start; | 3199 | for (addr = page_start; addr < data_start; |
| 3202 | addr += 4, i += 4) { | 3200 | addr += 4, i += 4) { |
| 3203 | 3201 | ||
| @@ -3423,6 +3421,9 @@ bnx2_init_chip(struct bnx2 *bp) | |||
| 3423 | val = REG_RD(bp, BNX2_MQ_CONFIG); | 3421 | val = REG_RD(bp, BNX2_MQ_CONFIG); |
| 3424 | val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE; | 3422 | val &= ~BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE; |
| 3425 | val |= BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE_256; | 3423 | val |= BNX2_MQ_CONFIG_KNL_BYP_BLK_SIZE_256; |
| 3424 | if (CHIP_ID(bp) == CHIP_ID_5709_A0 || CHIP_ID(bp) == CHIP_ID_5709_A1) | ||
| 3425 | val |= BNX2_MQ_CONFIG_HALT_DIS; | ||
| 3426 | |||
| 3426 | REG_WR(bp, BNX2_MQ_CONFIG, val); | 3427 | REG_WR(bp, BNX2_MQ_CONFIG, val); |
| 3427 | 3428 | ||
| 3428 | val = 0x10000 + (MAX_CID_CNT * MB_KERNEL_CTX_SIZE); | 3429 | val = 0x10000 + (MAX_CID_CNT * MB_KERNEL_CTX_SIZE); |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index ccbdf81c6599..878eee58f12a 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
| @@ -6518,6 +6518,7 @@ struct bnx2 { | |||
| 6518 | #define CHIP_ID_5708_B0 0x57081000 | 6518 | #define CHIP_ID_5708_B0 0x57081000 |
| 6519 | #define CHIP_ID_5708_B1 0x57081010 | 6519 | #define CHIP_ID_5708_B1 0x57081010 |
| 6520 | #define CHIP_ID_5709_A0 0x57090000 | 6520 | #define CHIP_ID_5709_A0 0x57090000 |
| 6521 | #define CHIP_ID_5709_A1 0x57090010 | ||
| 6521 | 6522 | ||
| 6522 | #define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf) | 6523 | #define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf) |
| 6523 | 6524 | ||
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h index e23deeb7d06d..8d1379633698 100644 --- a/drivers/net/cxgb3/common.h +++ b/drivers/net/cxgb3/common.h | |||
| @@ -112,8 +112,7 @@ enum { | |||
| 112 | }; | 112 | }; |
| 113 | 113 | ||
| 114 | enum { | 114 | enum { |
| 115 | SUPPORTED_OFFLOAD = 1 << 24, | 115 | SUPPORTED_IRQ = 1 << 24 |
| 116 | SUPPORTED_IRQ = 1 << 25 | ||
| 117 | }; | 116 | }; |
| 118 | 117 | ||
| 119 | enum { /* adapter interrupt-maintained statistics */ | 118 | enum { /* adapter interrupt-maintained statistics */ |
| @@ -260,6 +259,10 @@ struct mac_stats { | |||
| 260 | unsigned long serdes_signal_loss; | 259 | unsigned long serdes_signal_loss; |
| 261 | unsigned long xaui_pcs_ctc_err; | 260 | unsigned long xaui_pcs_ctc_err; |
| 262 | unsigned long xaui_pcs_align_change; | 261 | unsigned long xaui_pcs_align_change; |
| 262 | |||
| 263 | unsigned long num_toggled; /* # times toggled TxEn due to stuck TX */ | ||
| 264 | unsigned long num_resets; /* # times reset due to stuck TX */ | ||
| 265 | |||
| 263 | }; | 266 | }; |
| 264 | 267 | ||
| 265 | struct tp_mib_stats { | 268 | struct tp_mib_stats { |
| @@ -354,6 +357,9 @@ enum { | |||
| 354 | MC5_MODE_72_BIT = 2 | 357 | MC5_MODE_72_BIT = 2 |
| 355 | }; | 358 | }; |
| 356 | 359 | ||
| 360 | /* MC5 min active region size */ | ||
| 361 | enum { MC5_MIN_TIDS = 16 }; | ||
| 362 | |||
| 357 | struct vpd_params { | 363 | struct vpd_params { |
| 358 | unsigned int cclk; | 364 | unsigned int cclk; |
| 359 | unsigned int mclk; | 365 | unsigned int mclk; |
| @@ -398,6 +404,13 @@ struct adapter_params { | |||
| 398 | unsigned int stats_update_period; /* MAC stats accumulation period */ | 404 | unsigned int stats_update_period; /* MAC stats accumulation period */ |
| 399 | unsigned int linkpoll_period; /* link poll period in 0.1s */ | 405 | unsigned int linkpoll_period; /* link poll period in 0.1s */ |
| 400 | unsigned int rev; /* chip revision */ | 406 | unsigned int rev; /* chip revision */ |
| 407 | unsigned int offload; | ||
| 408 | }; | ||
| 409 | |||
| 410 | enum { /* chip revisions */ | ||
| 411 | T3_REV_A = 0, | ||
| 412 | T3_REV_B = 2, | ||
| 413 | T3_REV_B2 = 3, | ||
| 401 | }; | 414 | }; |
| 402 | 415 | ||
| 403 | struct trace_params { | 416 | struct trace_params { |
| @@ -465,6 +478,13 @@ struct cmac { | |||
| 465 | struct adapter *adapter; | 478 | struct adapter *adapter; |
| 466 | unsigned int offset; | 479 | unsigned int offset; |
| 467 | unsigned int nucast; /* # of address filters for unicast MACs */ | 480 | unsigned int nucast; /* # of address filters for unicast MACs */ |
| 481 | unsigned int tx_tcnt; | ||
| 482 | unsigned int tx_xcnt; | ||
| 483 | u64 tx_mcnt; | ||
| 484 | unsigned int rx_xcnt; | ||
| 485 | u64 rx_mcnt; | ||
| 486 | unsigned int toggle_cnt; | ||
| 487 | unsigned int txen; | ||
| 468 | struct mac_stats stats; | 488 | struct mac_stats stats; |
| 469 | }; | 489 | }; |
| 470 | 490 | ||
| @@ -588,7 +608,7 @@ static inline int is_10G(const struct adapter *adap) | |||
| 588 | 608 | ||
| 589 | static inline int is_offload(const struct adapter *adap) | 609 | static inline int is_offload(const struct adapter *adap) |
| 590 | { | 610 | { |
| 591 | return adapter_info(adap)->caps & SUPPORTED_OFFLOAD; | 611 | return adap->params.offload; |
| 592 | } | 612 | } |
| 593 | 613 | ||
| 594 | static inline unsigned int core_ticks_per_usec(const struct adapter *adap) | 614 | static inline unsigned int core_ticks_per_usec(const struct adapter *adap) |
| @@ -666,6 +686,7 @@ int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]); | |||
| 666 | int t3_mac_set_num_ucast(struct cmac *mac, int n); | 686 | int t3_mac_set_num_ucast(struct cmac *mac, int n); |
| 667 | const struct mac_stats *t3_mac_update_stats(struct cmac *mac); | 687 | const struct mac_stats *t3_mac_update_stats(struct cmac *mac); |
| 668 | int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc); | 688 | int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc); |
| 689 | int t3b2_mac_watchdog_task(struct cmac *mac); | ||
| 669 | 690 | ||
| 670 | void t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode); | 691 | void t3_mc5_prep(struct adapter *adapter, struct mc5 *mc5, int mode); |
| 671 | int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, | 692 | int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, |
diff --git a/drivers/net/cxgb3/cxgb3_defs.h b/drivers/net/cxgb3/cxgb3_defs.h index e14862b43d17..483a594210a7 100644 --- a/drivers/net/cxgb3/cxgb3_defs.h +++ b/drivers/net/cxgb3/cxgb3_defs.h | |||
| @@ -67,7 +67,10 @@ static inline union listen_entry *stid2entry(const struct tid_info *t, | |||
| 67 | static inline struct t3c_tid_entry *lookup_tid(const struct tid_info *t, | 67 | static inline struct t3c_tid_entry *lookup_tid(const struct tid_info *t, |
| 68 | unsigned int tid) | 68 | unsigned int tid) |
| 69 | { | 69 | { |
| 70 | return tid < t->ntids ? &(t->tid_tab[tid]) : NULL; | 70 | struct t3c_tid_entry *t3c_tid = tid < t->ntids ? |
| 71 | &(t->tid_tab[tid]) : NULL; | ||
| 72 | |||
| 73 | return (t3c_tid && t3c_tid->client) ? t3c_tid : NULL; | ||
| 71 | } | 74 | } |
| 72 | 75 | ||
| 73 | /* | 76 | /* |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 7ff834e45d6b..67b4b219d927 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
| @@ -42,6 +42,7 @@ | |||
| 42 | #include <linux/workqueue.h> | 42 | #include <linux/workqueue.h> |
| 43 | #include <linux/proc_fs.h> | 43 | #include <linux/proc_fs.h> |
| 44 | #include <linux/rtnetlink.h> | 44 | #include <linux/rtnetlink.h> |
| 45 | #include <linux/firmware.h> | ||
| 45 | #include <asm/uaccess.h> | 46 | #include <asm/uaccess.h> |
| 46 | 47 | ||
| 47 | #include "common.h" | 48 | #include "common.h" |
| @@ -184,16 +185,24 @@ void t3_os_link_changed(struct adapter *adapter, int port_id, int link_stat, | |||
| 184 | int speed, int duplex, int pause) | 185 | int speed, int duplex, int pause) |
| 185 | { | 186 | { |
| 186 | struct net_device *dev = adapter->port[port_id]; | 187 | struct net_device *dev = adapter->port[port_id]; |
| 188 | struct port_info *pi = netdev_priv(dev); | ||
| 189 | struct cmac *mac = &pi->mac; | ||
| 187 | 190 | ||
| 188 | /* Skip changes from disabled ports. */ | 191 | /* Skip changes from disabled ports. */ |
| 189 | if (!netif_running(dev)) | 192 | if (!netif_running(dev)) |
| 190 | return; | 193 | return; |
| 191 | 194 | ||
| 192 | if (link_stat != netif_carrier_ok(dev)) { | 195 | if (link_stat != netif_carrier_ok(dev)) { |
| 193 | if (link_stat) | 196 | if (link_stat) { |
| 197 | t3_mac_enable(mac, MAC_DIRECTION_RX); | ||
| 194 | netif_carrier_on(dev); | 198 | netif_carrier_on(dev); |
| 195 | else | 199 | } else { |
| 196 | netif_carrier_off(dev); | 200 | netif_carrier_off(dev); |
| 201 | pi->phy.ops->power_down(&pi->phy, 1); | ||
| 202 | t3_mac_disable(mac, MAC_DIRECTION_RX); | ||
| 203 | t3_link_start(&pi->phy, mac, &pi->link_config); | ||
| 204 | } | ||
| 205 | |||
| 197 | link_report(dev); | 206 | link_report(dev); |
| 198 | } | 207 | } |
| 199 | } | 208 | } |
| @@ -406,7 +415,7 @@ static void quiesce_rx(struct adapter *adap) | |||
| 406 | static int setup_sge_qsets(struct adapter *adap) | 415 | static int setup_sge_qsets(struct adapter *adap) |
| 407 | { | 416 | { |
| 408 | int i, j, err, irq_idx = 0, qset_idx = 0, dummy_dev_idx = 0; | 417 | int i, j, err, irq_idx = 0, qset_idx = 0, dummy_dev_idx = 0; |
| 409 | unsigned int ntxq = is_offload(adap) ? SGE_TXQ_PER_SET : 1; | 418 | unsigned int ntxq = SGE_TXQ_PER_SET; |
| 410 | 419 | ||
| 411 | if (adap->params.rev > 0 && !(adap->flags & USING_MSI)) | 420 | if (adap->params.rev > 0 && !(adap->flags & USING_MSI)) |
| 412 | irq_idx = -1; | 421 | irq_idx = -1; |
| @@ -484,12 +493,14 @@ static ssize_t show_##name(struct device *d, struct device_attribute *attr, \ | |||
| 484 | static ssize_t set_nfilters(struct net_device *dev, unsigned int val) | 493 | static ssize_t set_nfilters(struct net_device *dev, unsigned int val) |
| 485 | { | 494 | { |
| 486 | struct adapter *adap = dev->priv; | 495 | struct adapter *adap = dev->priv; |
| 496 | int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0; | ||
| 487 | 497 | ||
| 488 | if (adap->flags & FULL_INIT_DONE) | 498 | if (adap->flags & FULL_INIT_DONE) |
| 489 | return -EBUSY; | 499 | return -EBUSY; |
| 490 | if (val && adap->params.rev == 0) | 500 | if (val && adap->params.rev == 0) |
| 491 | return -EINVAL; | 501 | return -EINVAL; |
| 492 | if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers) | 502 | if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers - |
| 503 | min_tids) | ||
| 493 | return -EINVAL; | 504 | return -EINVAL; |
| 494 | adap->params.mc5.nfilters = val; | 505 | adap->params.mc5.nfilters = val; |
| 495 | return 0; | 506 | return 0; |
| @@ -507,7 +518,8 @@ static ssize_t set_nservers(struct net_device *dev, unsigned int val) | |||
| 507 | 518 | ||
| 508 | if (adap->flags & FULL_INIT_DONE) | 519 | if (adap->flags & FULL_INIT_DONE) |
| 509 | return -EBUSY; | 520 | return -EBUSY; |
| 510 | if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters) | 521 | if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters - |
| 522 | MC5_MIN_TIDS) | ||
| 511 | return -EINVAL; | 523 | return -EINVAL; |
| 512 | adap->params.mc5.nservers = val; | 524 | adap->params.mc5.nservers = val; |
| 513 | return 0; | 525 | return 0; |
| @@ -707,6 +719,28 @@ static void bind_qsets(struct adapter *adap) | |||
| 707 | } | 719 | } |
| 708 | } | 720 | } |
| 709 | 721 | ||
| 722 | #define FW_FNAME "t3fw-%d.%d.%d.bin" | ||
| 723 | |||
| 724 | static int upgrade_fw(struct adapter *adap) | ||
| 725 | { | ||
| 726 | int ret; | ||
| 727 | char buf[64]; | ||
| 728 | const struct firmware *fw; | ||
| 729 | struct device *dev = &adap->pdev->dev; | ||
| 730 | |||
| 731 | snprintf(buf, sizeof(buf), FW_FNAME, FW_VERSION_MAJOR, | ||
| 732 | FW_VERSION_MINOR, FW_VERSION_MICRO); | ||
| 733 | ret = request_firmware(&fw, buf, dev); | ||
| 734 | if (ret < 0) { | ||
| 735 | dev_err(dev, "could not upgrade firmware: unable to load %s\n", | ||
| 736 | buf); | ||
| 737 | return ret; | ||
| 738 | } | ||
| 739 | ret = t3_load_fw(adap, fw->data, fw->size); | ||
| 740 | release_firmware(fw); | ||
| 741 | return ret; | ||
| 742 | } | ||
| 743 | |||
| 710 | /** | 744 | /** |
| 711 | * cxgb_up - enable the adapter | 745 | * cxgb_up - enable the adapter |
| 712 | * @adapter: adapter being enabled | 746 | * @adapter: adapter being enabled |
| @@ -723,6 +757,8 @@ static int cxgb_up(struct adapter *adap) | |||
| 723 | 757 | ||
| 724 | if (!(adap->flags & FULL_INIT_DONE)) { | 758 | if (!(adap->flags & FULL_INIT_DONE)) { |
| 725 | err = t3_check_fw_version(adap); | 759 | err = t3_check_fw_version(adap); |
| 760 | if (err == -EINVAL) | ||
| 761 | err = upgrade_fw(adap); | ||
| 726 | if (err) | 762 | if (err) |
| 727 | goto out; | 763 | goto out; |
| 728 | 764 | ||
| @@ -734,6 +770,8 @@ static int cxgb_up(struct adapter *adap) | |||
| 734 | if (err) | 770 | if (err) |
| 735 | goto out; | 771 | goto out; |
| 736 | 772 | ||
| 773 | t3_write_reg(adap, A_ULPRX_TDDP_PSZ, V_HPZ0(PAGE_SHIFT - 12)); | ||
| 774 | |||
| 737 | err = setup_sge_qsets(adap); | 775 | err = setup_sge_qsets(adap); |
| 738 | if (err) | 776 | if (err) |
| 739 | goto out; | 777 | goto out; |
| @@ -894,7 +932,7 @@ static int cxgb_open(struct net_device *dev) | |||
| 894 | return err; | 932 | return err; |
| 895 | 933 | ||
| 896 | set_bit(pi->port_id, &adapter->open_device_map); | 934 | set_bit(pi->port_id, &adapter->open_device_map); |
| 897 | if (!ofld_disable) { | 935 | if (is_offload(adapter) && !ofld_disable) { |
| 898 | err = offload_open(dev); | 936 | err = offload_open(dev); |
| 899 | if (err) | 937 | if (err) |
| 900 | printk(KERN_WARNING | 938 | printk(KERN_WARNING |
| @@ -1031,7 +1069,11 @@ static char stats_strings[][ETH_GSTRING_LEN] = { | |||
| 1031 | "VLANinsertions ", | 1069 | "VLANinsertions ", |
| 1032 | "TxCsumOffload ", | 1070 | "TxCsumOffload ", |
| 1033 | "RxCsumGood ", | 1071 | "RxCsumGood ", |
| 1034 | "RxDrops " | 1072 | "RxDrops ", |
| 1073 | |||
| 1074 | "CheckTXEnToggled ", | ||
| 1075 | "CheckResets ", | ||
| 1076 | |||
| 1035 | }; | 1077 | }; |
| 1036 | 1078 | ||
| 1037 | static int get_stats_count(struct net_device *dev) | 1079 | static int get_stats_count(struct net_device *dev) |
| @@ -1145,6 +1187,9 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats, | |||
| 1145 | *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_TX_CSUM); | 1187 | *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_TX_CSUM); |
| 1146 | *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_RX_CSUM_GOOD); | 1188 | *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_RX_CSUM_GOOD); |
| 1147 | *data++ = s->rx_cong_drops; | 1189 | *data++ = s->rx_cong_drops; |
| 1190 | |||
| 1191 | *data++ = s->num_toggled; | ||
| 1192 | *data++ = s->num_resets; | ||
| 1148 | } | 1193 | } |
| 1149 | 1194 | ||
| 1150 | static inline void reg_block_dump(struct adapter *ap, void *buf, | 1195 | static inline void reg_block_dump(struct adapter *ap, void *buf, |
| @@ -1362,23 +1407,27 @@ static int set_rx_csum(struct net_device *dev, u32 data) | |||
| 1362 | 1407 | ||
| 1363 | static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) | 1408 | static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e) |
| 1364 | { | 1409 | { |
| 1365 | struct adapter *adapter = dev->priv; | 1410 | const struct adapter *adapter = dev->priv; |
| 1411 | const struct port_info *pi = netdev_priv(dev); | ||
| 1412 | const struct qset_params *q = &adapter->params.sge.qset[pi->first_qset]; | ||
| 1366 | 1413 | ||
| 1367 | e->rx_max_pending = MAX_RX_BUFFERS; | 1414 | e->rx_max_pending = MAX_RX_BUFFERS; |
| 1368 | e->rx_mini_max_pending = 0; | 1415 | e->rx_mini_max_pending = 0; |
| 1369 | e->rx_jumbo_max_pending = MAX_RX_JUMBO_BUFFERS; | 1416 | e->rx_jumbo_max_pending = MAX_RX_JUMBO_BUFFERS; |
| 1370 | e->tx_max_pending = MAX_TXQ_ENTRIES; | 1417 | e->tx_max_pending = MAX_TXQ_ENTRIES; |
| 1371 | 1418 | ||
| 1372 | e->rx_pending = adapter->params.sge.qset[0].fl_size; | 1419 | e->rx_pending = q->fl_size; |
| 1373 | e->rx_mini_pending = adapter->params.sge.qset[0].rspq_size; | 1420 | e->rx_mini_pending = q->rspq_size; |
| 1374 | e->rx_jumbo_pending = adapter->params.sge.qset[0].jumbo_size; | 1421 | e->rx_jumbo_pending = q->jumbo_size; |
| 1375 | e->tx_pending = adapter->params.sge.qset[0].txq_size[0]; | 1422 | e->tx_pending = q->txq_size[0]; |
| 1376 | } | 1423 | } |
| 1377 | 1424 | ||
| 1378 | static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e) | 1425 | static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e) |
| 1379 | { | 1426 | { |
| 1380 | int i; | 1427 | int i; |
| 1428 | struct qset_params *q; | ||
| 1381 | struct adapter *adapter = dev->priv; | 1429 | struct adapter *adapter = dev->priv; |
| 1430 | const struct port_info *pi = netdev_priv(dev); | ||
| 1382 | 1431 | ||
| 1383 | if (e->rx_pending > MAX_RX_BUFFERS || | 1432 | if (e->rx_pending > MAX_RX_BUFFERS || |
| 1384 | e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS || | 1433 | e->rx_jumbo_pending > MAX_RX_JUMBO_BUFFERS || |
| @@ -1393,9 +1442,8 @@ static int set_sge_param(struct net_device *dev, struct ethtool_ringparam *e) | |||
| 1393 | if (adapter->flags & FULL_INIT_DONE) | 1442 | if (adapter->flags & FULL_INIT_DONE) |
| 1394 | return -EBUSY; | 1443 | return -EBUSY; |
| 1395 | 1444 | ||
| 1396 | for (i = 0; i < SGE_QSETS; ++i) { | 1445 | q = &adapter->params.sge.qset[pi->first_qset]; |
| 1397 | struct qset_params *q = &adapter->params.sge.qset[i]; | 1446 | for (i = 0; i < pi->nqsets; ++i, ++q) { |
| 1398 | |||
| 1399 | q->rspq_size = e->rx_mini_pending; | 1447 | q->rspq_size = e->rx_mini_pending; |
| 1400 | q->fl_size = e->rx_pending; | 1448 | q->fl_size = e->rx_pending; |
| 1401 | q->jumbo_size = e->rx_jumbo_pending; | 1449 | q->jumbo_size = e->rx_jumbo_pending; |
| @@ -2067,6 +2115,42 @@ static void check_link_status(struct adapter *adapter) | |||
| 2067 | } | 2115 | } |
| 2068 | } | 2116 | } |
| 2069 | 2117 | ||
| 2118 | static void check_t3b2_mac(struct adapter *adapter) | ||
| 2119 | { | ||
| 2120 | int i; | ||
| 2121 | |||
| 2122 | if (!rtnl_trylock()) /* synchronize with ifdown */ | ||
| 2123 | return; | ||
| 2124 | |||
| 2125 | for_each_port(adapter, i) { | ||
| 2126 | struct net_device *dev = adapter->port[i]; | ||
| 2127 | struct port_info *p = netdev_priv(dev); | ||
| 2128 | int status; | ||
| 2129 | |||
| 2130 | if (!netif_running(dev)) | ||
| 2131 | continue; | ||
| 2132 | |||
| 2133 | status = 0; | ||
| 2134 | if (netif_running(dev) && netif_carrier_ok(dev)) | ||
| 2135 | status = t3b2_mac_watchdog_task(&p->mac); | ||
| 2136 | if (status == 1) | ||
| 2137 | p->mac.stats.num_toggled++; | ||
| 2138 | else if (status == 2) { | ||
| 2139 | struct cmac *mac = &p->mac; | ||
| 2140 | |||
| 2141 | t3_mac_set_mtu(mac, dev->mtu); | ||
| 2142 | t3_mac_set_address(mac, 0, dev->dev_addr); | ||
| 2143 | cxgb_set_rxmode(dev); | ||
| 2144 | t3_link_start(&p->phy, mac, &p->link_config); | ||
| 2145 | t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX); | ||
| 2146 | t3_port_intr_enable(adapter, p->port_id); | ||
| 2147 | p->mac.stats.num_resets++; | ||
| 2148 | } | ||
| 2149 | } | ||
| 2150 | rtnl_unlock(); | ||
| 2151 | } | ||
| 2152 | |||
| 2153 | |||
| 2070 | static void t3_adap_check_task(struct work_struct *work) | 2154 | static void t3_adap_check_task(struct work_struct *work) |
| 2071 | { | 2155 | { |
| 2072 | struct adapter *adapter = container_of(work, struct adapter, | 2156 | struct adapter *adapter = container_of(work, struct adapter, |
| @@ -2087,6 +2171,9 @@ static void t3_adap_check_task(struct work_struct *work) | |||
| 2087 | adapter->check_task_cnt = 0; | 2171 | adapter->check_task_cnt = 0; |
| 2088 | } | 2172 | } |
| 2089 | 2173 | ||
| 2174 | if (p->rev == T3_REV_B2) | ||
| 2175 | check_t3b2_mac(adapter); | ||
| 2176 | |||
| 2090 | /* Schedule the next check update if any port is active. */ | 2177 | /* Schedule the next check update if any port is active. */ |
| 2091 | spin_lock(&adapter->work_lock); | 2178 | spin_lock(&adapter->work_lock); |
| 2092 | if (adapter->open_device_map & PORT_MASK) | 2179 | if (adapter->open_device_map & PORT_MASK) |
| @@ -2195,9 +2282,9 @@ static void __devinit print_port_info(struct adapter *adap, | |||
| 2195 | 2282 | ||
| 2196 | if (!test_bit(i, &adap->registered_device_map)) | 2283 | if (!test_bit(i, &adap->registered_device_map)) |
| 2197 | continue; | 2284 | continue; |
| 2198 | printk(KERN_INFO "%s: %s %s RNIC (rev %d) %s%s\n", | 2285 | printk(KERN_INFO "%s: %s %s %sNIC (rev %d) %s%s\n", |
| 2199 | dev->name, ai->desc, pi->port_type->desc, | 2286 | dev->name, ai->desc, pi->port_type->desc, |
| 2200 | adap->params.rev, buf, | 2287 | is_offload(adap) ? "R" : "", adap->params.rev, buf, |
| 2201 | (adap->flags & USING_MSIX) ? " MSI-X" : | 2288 | (adap->flags & USING_MSIX) ? " MSI-X" : |
| 2202 | (adap->flags & USING_MSI) ? " MSI" : ""); | 2289 | (adap->flags & USING_MSI) ? " MSI" : ""); |
| 2203 | if (adap->name == dev->name && adap->params.vpd.mclk) | 2290 | if (adap->name == dev->name && adap->params.vpd.mclk) |
diff --git a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c index f6ed033efb56..199e5066acf3 100644 --- a/drivers/net/cxgb3/cxgb3_offload.c +++ b/drivers/net/cxgb3/cxgb3_offload.c | |||
| @@ -508,6 +508,7 @@ void cxgb3_queue_tid_release(struct t3cdev *tdev, unsigned int tid) | |||
| 508 | 508 | ||
| 509 | spin_lock_bh(&td->tid_release_lock); | 509 | spin_lock_bh(&td->tid_release_lock); |
| 510 | p->ctx = (void *)td->tid_release_list; | 510 | p->ctx = (void *)td->tid_release_list; |
| 511 | p->client = NULL; | ||
| 511 | td->tid_release_list = p; | 512 | td->tid_release_list = p; |
| 512 | if (!p->ctx) | 513 | if (!p->ctx) |
| 513 | schedule_work(&td->tid_release_task); | 514 | schedule_work(&td->tid_release_task); |
| @@ -553,7 +554,9 @@ int cxgb3_alloc_atid(struct t3cdev *tdev, struct cxgb3_client *client, | |||
| 553 | struct tid_info *t = &(T3C_DATA(tdev))->tid_maps; | 554 | struct tid_info *t = &(T3C_DATA(tdev))->tid_maps; |
| 554 | 555 | ||
| 555 | spin_lock_bh(&t->atid_lock); | 556 | spin_lock_bh(&t->atid_lock); |
| 556 | if (t->afree) { | 557 | if (t->afree && |
| 558 | t->atids_in_use + atomic_read(&t->tids_in_use) + MC5_MIN_TIDS <= | ||
| 559 | t->ntids) { | ||
| 557 | union active_open_entry *p = t->afree; | 560 | union active_open_entry *p = t->afree; |
| 558 | 561 | ||
| 559 | atid = (p - t->atid_tab) + t->atid_base; | 562 | atid = (p - t->atid_tab) + t->atid_base; |
| @@ -621,7 +624,8 @@ static int do_act_open_rpl(struct t3cdev *dev, struct sk_buff *skb) | |||
| 621 | struct t3c_tid_entry *t3c_tid; | 624 | struct t3c_tid_entry *t3c_tid; |
| 622 | 625 | ||
| 623 | t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid); | 626 | t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid); |
| 624 | if (t3c_tid->ctx && t3c_tid->client && t3c_tid->client->handlers && | 627 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client && |
| 628 | t3c_tid->client->handlers && | ||
| 625 | t3c_tid->client->handlers[CPL_ACT_OPEN_RPL]) { | 629 | t3c_tid->client->handlers[CPL_ACT_OPEN_RPL]) { |
| 626 | return t3c_tid->client->handlers[CPL_ACT_OPEN_RPL] (dev, skb, | 630 | return t3c_tid->client->handlers[CPL_ACT_OPEN_RPL] (dev, skb, |
| 627 | t3c_tid-> | 631 | t3c_tid-> |
| @@ -640,7 +644,7 @@ static int do_stid_rpl(struct t3cdev *dev, struct sk_buff *skb) | |||
| 640 | struct t3c_tid_entry *t3c_tid; | 644 | struct t3c_tid_entry *t3c_tid; |
| 641 | 645 | ||
| 642 | t3c_tid = lookup_stid(&(T3C_DATA(dev))->tid_maps, stid); | 646 | t3c_tid = lookup_stid(&(T3C_DATA(dev))->tid_maps, stid); |
| 643 | if (t3c_tid->ctx && t3c_tid->client->handlers && | 647 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers && |
| 644 | t3c_tid->client->handlers[p->opcode]) { | 648 | t3c_tid->client->handlers[p->opcode]) { |
| 645 | return t3c_tid->client->handlers[p->opcode] (dev, skb, | 649 | return t3c_tid->client->handlers[p->opcode] (dev, skb, |
| 646 | t3c_tid->ctx); | 650 | t3c_tid->ctx); |
| @@ -658,7 +662,7 @@ static int do_hwtid_rpl(struct t3cdev *dev, struct sk_buff *skb) | |||
| 658 | struct t3c_tid_entry *t3c_tid; | 662 | struct t3c_tid_entry *t3c_tid; |
| 659 | 663 | ||
| 660 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); | 664 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); |
| 661 | if (t3c_tid->ctx && t3c_tid->client->handlers && | 665 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers && |
| 662 | t3c_tid->client->handlers[p->opcode]) { | 666 | t3c_tid->client->handlers[p->opcode]) { |
| 663 | return t3c_tid->client->handlers[p->opcode] | 667 | return t3c_tid->client->handlers[p->opcode] |
| 664 | (dev, skb, t3c_tid->ctx); | 668 | (dev, skb, t3c_tid->ctx); |
| @@ -687,6 +691,28 @@ static int do_cr(struct t3cdev *dev, struct sk_buff *skb) | |||
| 687 | } | 691 | } |
| 688 | } | 692 | } |
| 689 | 693 | ||
| 694 | /* | ||
| 695 | * Returns an sk_buff for a reply CPL message of size len. If the input | ||
| 696 | * sk_buff has no other users it is trimmed and reused, otherwise a new buffer | ||
| 697 | * is allocated. The input skb must be of size at least len. Note that this | ||
| 698 | * operation does not destroy the original skb data even if it decides to reuse | ||
| 699 | * the buffer. | ||
| 700 | */ | ||
| 701 | static struct sk_buff *cxgb3_get_cpl_reply_skb(struct sk_buff *skb, size_t len, | ||
| 702 | int gfp) | ||
| 703 | { | ||
| 704 | if (likely(!skb_cloned(skb))) { | ||
| 705 | BUG_ON(skb->len < len); | ||
| 706 | __skb_trim(skb, len); | ||
| 707 | skb_get(skb); | ||
| 708 | } else { | ||
| 709 | skb = alloc_skb(len, gfp); | ||
| 710 | if (skb) | ||
| 711 | __skb_put(skb, len); | ||
| 712 | } | ||
| 713 | return skb; | ||
| 714 | } | ||
| 715 | |||
| 690 | static int do_abort_req_rss(struct t3cdev *dev, struct sk_buff *skb) | 716 | static int do_abort_req_rss(struct t3cdev *dev, struct sk_buff *skb) |
| 691 | { | 717 | { |
| 692 | union opcode_tid *p = cplhdr(skb); | 718 | union opcode_tid *p = cplhdr(skb); |
| @@ -694,30 +720,39 @@ static int do_abort_req_rss(struct t3cdev *dev, struct sk_buff *skb) | |||
| 694 | struct t3c_tid_entry *t3c_tid; | 720 | struct t3c_tid_entry *t3c_tid; |
| 695 | 721 | ||
| 696 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); | 722 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); |
| 697 | if (t3c_tid->ctx && t3c_tid->client->handlers && | 723 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers && |
| 698 | t3c_tid->client->handlers[p->opcode]) { | 724 | t3c_tid->client->handlers[p->opcode]) { |
| 699 | return t3c_tid->client->handlers[p->opcode] | 725 | return t3c_tid->client->handlers[p->opcode] |
| 700 | (dev, skb, t3c_tid->ctx); | 726 | (dev, skb, t3c_tid->ctx); |
| 701 | } else { | 727 | } else { |
| 702 | struct cpl_abort_req_rss *req = cplhdr(skb); | 728 | struct cpl_abort_req_rss *req = cplhdr(skb); |
| 703 | struct cpl_abort_rpl *rpl; | 729 | struct cpl_abort_rpl *rpl; |
| 730 | struct sk_buff *reply_skb; | ||
| 731 | unsigned int tid = GET_TID(req); | ||
| 732 | u8 cmd = req->status; | ||
| 733 | |||
| 734 | if (req->status == CPL_ERR_RTX_NEG_ADVICE || | ||
| 735 | req->status == CPL_ERR_PERSIST_NEG_ADVICE) | ||
| 736 | goto out; | ||
| 704 | 737 | ||
| 705 | struct sk_buff *skb = | 738 | reply_skb = cxgb3_get_cpl_reply_skb(skb, |
| 706 | alloc_skb(sizeof(struct cpl_abort_rpl), GFP_ATOMIC); | 739 | sizeof(struct |
| 707 | if (!skb) { | 740 | cpl_abort_rpl), |
| 741 | GFP_ATOMIC); | ||
| 742 | |||
| 743 | if (!reply_skb) { | ||
| 708 | printk("do_abort_req_rss: couldn't get skb!\n"); | 744 | printk("do_abort_req_rss: couldn't get skb!\n"); |
| 709 | goto out; | 745 | goto out; |
| 710 | } | 746 | } |
| 711 | skb->priority = CPL_PRIORITY_DATA; | 747 | reply_skb->priority = CPL_PRIORITY_DATA; |
| 712 | __skb_put(skb, sizeof(struct cpl_abort_rpl)); | 748 | __skb_put(reply_skb, sizeof(struct cpl_abort_rpl)); |
| 713 | rpl = cplhdr(skb); | 749 | rpl = cplhdr(reply_skb); |
| 714 | rpl->wr.wr_hi = | 750 | rpl->wr.wr_hi = |
| 715 | htonl(V_WR_OP(FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL)); | 751 | htonl(V_WR_OP(FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL)); |
| 716 | rpl->wr.wr_lo = htonl(V_WR_TID(GET_TID(req))); | 752 | rpl->wr.wr_lo = htonl(V_WR_TID(tid)); |
| 717 | OPCODE_TID(rpl) = | 753 | OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, tid)); |
| 718 | htonl(MK_OPCODE_TID(CPL_ABORT_RPL, GET_TID(req))); | 754 | rpl->cmd = cmd; |
| 719 | rpl->cmd = req->status; | 755 | cxgb3_ofld_send(dev, reply_skb); |
| 720 | cxgb3_ofld_send(dev, skb); | ||
| 721 | out: | 756 | out: |
| 722 | return CPL_RET_BUF_DONE; | 757 | return CPL_RET_BUF_DONE; |
| 723 | } | 758 | } |
| @@ -730,7 +765,7 @@ static int do_act_establish(struct t3cdev *dev, struct sk_buff *skb) | |||
| 730 | struct t3c_tid_entry *t3c_tid; | 765 | struct t3c_tid_entry *t3c_tid; |
| 731 | 766 | ||
| 732 | t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid); | 767 | t3c_tid = lookup_atid(&(T3C_DATA(dev))->tid_maps, atid); |
| 733 | if (t3c_tid->ctx && t3c_tid->client->handlers && | 768 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers && |
| 734 | t3c_tid->client->handlers[CPL_ACT_ESTABLISH]) { | 769 | t3c_tid->client->handlers[CPL_ACT_ESTABLISH]) { |
| 735 | return t3c_tid->client->handlers[CPL_ACT_ESTABLISH] | 770 | return t3c_tid->client->handlers[CPL_ACT_ESTABLISH] |
| 736 | (dev, skb, t3c_tid->ctx); | 771 | (dev, skb, t3c_tid->ctx); |
| @@ -741,17 +776,6 @@ static int do_act_establish(struct t3cdev *dev, struct sk_buff *skb) | |||
| 741 | } | 776 | } |
| 742 | } | 777 | } |
| 743 | 778 | ||
| 744 | static int do_set_tcb_rpl(struct t3cdev *dev, struct sk_buff *skb) | ||
| 745 | { | ||
| 746 | struct cpl_set_tcb_rpl *rpl = cplhdr(skb); | ||
| 747 | |||
| 748 | if (rpl->status != CPL_ERR_NONE) | ||
| 749 | printk(KERN_ERR | ||
| 750 | "Unexpected SET_TCB_RPL status %u for tid %u\n", | ||
| 751 | rpl->status, GET_TID(rpl)); | ||
| 752 | return CPL_RET_BUF_DONE; | ||
| 753 | } | ||
| 754 | |||
| 755 | static int do_trace(struct t3cdev *dev, struct sk_buff *skb) | 779 | static int do_trace(struct t3cdev *dev, struct sk_buff *skb) |
| 756 | { | 780 | { |
| 757 | struct cpl_trace_pkt *p = cplhdr(skb); | 781 | struct cpl_trace_pkt *p = cplhdr(skb); |
| @@ -771,7 +795,7 @@ static int do_term(struct t3cdev *dev, struct sk_buff *skb) | |||
| 771 | struct t3c_tid_entry *t3c_tid; | 795 | struct t3c_tid_entry *t3c_tid; |
| 772 | 796 | ||
| 773 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); | 797 | t3c_tid = lookup_tid(&(T3C_DATA(dev))->tid_maps, hwtid); |
| 774 | if (t3c_tid->ctx && t3c_tid->client->handlers && | 798 | if (t3c_tid && t3c_tid->ctx && t3c_tid->client->handlers && |
| 775 | t3c_tid->client->handlers[opcode]) { | 799 | t3c_tid->client->handlers[opcode]) { |
| 776 | return t3c_tid->client->handlers[opcode] (dev, skb, | 800 | return t3c_tid->client->handlers[opcode] (dev, skb, |
| 777 | t3c_tid->ctx); | 801 | t3c_tid->ctx); |
| @@ -970,7 +994,7 @@ void cxgb_redirect(struct dst_entry *old, struct dst_entry *new) | |||
| 970 | for (tid = 0; tid < ti->ntids; tid++) { | 994 | for (tid = 0; tid < ti->ntids; tid++) { |
| 971 | te = lookup_tid(ti, tid); | 995 | te = lookup_tid(ti, tid); |
| 972 | BUG_ON(!te); | 996 | BUG_ON(!te); |
| 973 | if (te->ctx && te->client && te->client->redirect) { | 997 | if (te && te->ctx && te->client && te->client->redirect) { |
| 974 | update_tcb = te->client->redirect(te->ctx, old, new, e); | 998 | update_tcb = te->client->redirect(te->ctx, old, new, e); |
| 975 | if (update_tcb) { | 999 | if (update_tcb) { |
| 976 | l2t_hold(L2DATA(tdev), e); | 1000 | l2t_hold(L2DATA(tdev), e); |
| @@ -1213,7 +1237,8 @@ void __init cxgb3_offload_init(void) | |||
| 1213 | t3_register_cpl_handler(CPL_CLOSE_CON_RPL, do_hwtid_rpl); | 1237 | t3_register_cpl_handler(CPL_CLOSE_CON_RPL, do_hwtid_rpl); |
| 1214 | t3_register_cpl_handler(CPL_ABORT_REQ_RSS, do_abort_req_rss); | 1238 | t3_register_cpl_handler(CPL_ABORT_REQ_RSS, do_abort_req_rss); |
| 1215 | t3_register_cpl_handler(CPL_ACT_ESTABLISH, do_act_establish); | 1239 | t3_register_cpl_handler(CPL_ACT_ESTABLISH, do_act_establish); |
| 1216 | t3_register_cpl_handler(CPL_SET_TCB_RPL, do_set_tcb_rpl); | 1240 | t3_register_cpl_handler(CPL_SET_TCB_RPL, do_hwtid_rpl); |
| 1241 | t3_register_cpl_handler(CPL_GET_TCB_RPL, do_hwtid_rpl); | ||
| 1217 | t3_register_cpl_handler(CPL_RDMA_TERMINATE, do_term); | 1242 | t3_register_cpl_handler(CPL_RDMA_TERMINATE, do_term); |
| 1218 | t3_register_cpl_handler(CPL_RDMA_EC_STATUS, do_hwtid_rpl); | 1243 | t3_register_cpl_handler(CPL_RDMA_EC_STATUS, do_hwtid_rpl); |
| 1219 | t3_register_cpl_handler(CPL_TRACE_PKT, do_trace); | 1244 | t3_register_cpl_handler(CPL_TRACE_PKT, do_trace); |
diff --git a/drivers/net/cxgb3/mc5.c b/drivers/net/cxgb3/mc5.c index 644d62ea86a6..84c1ffa8e2d3 100644 --- a/drivers/net/cxgb3/mc5.c +++ b/drivers/net/cxgb3/mc5.c | |||
| @@ -328,6 +328,9 @@ int t3_mc5_init(struct mc5 *mc5, unsigned int nservers, unsigned int nfilters, | |||
| 328 | unsigned int tcam_size = mc5->tcam_size; | 328 | unsigned int tcam_size = mc5->tcam_size; |
| 329 | struct adapter *adap = mc5->adapter; | 329 | struct adapter *adap = mc5->adapter; |
| 330 | 330 | ||
| 331 | if (!tcam_size) | ||
| 332 | return 0; | ||
| 333 | |||
| 331 | if (nroutes > MAX_ROUTES || nroutes + nservers + nfilters > tcam_size) | 334 | if (nroutes > MAX_ROUTES || nroutes + nservers + nfilters > tcam_size) |
| 332 | return -EINVAL; | 335 | return -EINVAL; |
| 333 | 336 | ||
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h index b56c5f52bcdc..e5a553410e24 100644 --- a/drivers/net/cxgb3/regs.h +++ b/drivers/net/cxgb3/regs.h | |||
| @@ -1206,6 +1206,14 @@ | |||
| 1206 | 1206 | ||
| 1207 | #define A_TP_RX_TRC_KEY0 0x120 | 1207 | #define A_TP_RX_TRC_KEY0 0x120 |
| 1208 | 1208 | ||
| 1209 | #define A_TP_TX_DROP_CNT_CH0 0x12d | ||
| 1210 | |||
| 1211 | #define S_TXDROPCNTCH0RCVD 0 | ||
| 1212 | #define M_TXDROPCNTCH0RCVD 0xffff | ||
| 1213 | #define V_TXDROPCNTCH0RCVD(x) ((x) << S_TXDROPCNTCH0RCVD) | ||
| 1214 | #define G_TXDROPCNTCH0RCVD(x) (((x) >> S_TXDROPCNTCH0RCVD) & \ | ||
| 1215 | M_TXDROPCNTCH0RCVD) | ||
| 1216 | |||
| 1209 | #define A_ULPRX_CTL 0x500 | 1217 | #define A_ULPRX_CTL 0x500 |
| 1210 | 1218 | ||
| 1211 | #define S_ROUND_ROBIN 4 | 1219 | #define S_ROUND_ROBIN 4 |
| @@ -1226,9 +1234,15 @@ | |||
| 1226 | 1234 | ||
| 1227 | #define A_ULPRX_ISCSI_TAGMASK 0x514 | 1235 | #define A_ULPRX_ISCSI_TAGMASK 0x514 |
| 1228 | 1236 | ||
| 1237 | #define S_HPZ0 0 | ||
| 1238 | #define M_HPZ0 0xf | ||
| 1239 | #define V_HPZ0(x) ((x) << S_HPZ0) | ||
| 1240 | #define G_HPZ0(x) (((x) >> S_HPZ0) & M_HPZ0) | ||
| 1241 | |||
| 1229 | #define A_ULPRX_TDDP_LLIMIT 0x51c | 1242 | #define A_ULPRX_TDDP_LLIMIT 0x51c |
| 1230 | 1243 | ||
| 1231 | #define A_ULPRX_TDDP_ULIMIT 0x520 | 1244 | #define A_ULPRX_TDDP_ULIMIT 0x520 |
| 1245 | #define A_ULPRX_TDDP_PSZ 0x528 | ||
| 1232 | 1246 | ||
| 1233 | #define A_ULPRX_STAG_LLIMIT 0x52c | 1247 | #define A_ULPRX_STAG_LLIMIT 0x52c |
| 1234 | 1248 | ||
| @@ -1834,6 +1848,8 @@ | |||
| 1834 | #define V_TXPAUSEEN(x) ((x) << S_TXPAUSEEN) | 1848 | #define V_TXPAUSEEN(x) ((x) << S_TXPAUSEEN) |
| 1835 | #define F_TXPAUSEEN V_TXPAUSEEN(1U) | 1849 | #define F_TXPAUSEEN V_TXPAUSEEN(1U) |
| 1836 | 1850 | ||
| 1851 | #define A_XGM_TX_PAUSE_QUANTA 0x808 | ||
| 1852 | |||
| 1837 | #define A_XGM_RX_CTRL 0x80c | 1853 | #define A_XGM_RX_CTRL 0x80c |
| 1838 | 1854 | ||
| 1839 | #define S_RXEN 0 | 1855 | #define S_RXEN 0 |
| @@ -1920,11 +1936,20 @@ | |||
| 1920 | 1936 | ||
| 1921 | #define A_XGM_TXFIFO_CFG 0x888 | 1937 | #define A_XGM_TXFIFO_CFG 0x888 |
| 1922 | 1938 | ||
| 1939 | #define S_TXIPG 13 | ||
| 1940 | #define M_TXIPG 0xff | ||
| 1941 | #define V_TXIPG(x) ((x) << S_TXIPG) | ||
| 1942 | #define G_TXIPG(x) (((x) >> S_TXIPG) & M_TXIPG) | ||
| 1943 | |||
| 1923 | #define S_TXFIFOTHRESH 4 | 1944 | #define S_TXFIFOTHRESH 4 |
| 1924 | #define M_TXFIFOTHRESH 0x1ff | 1945 | #define M_TXFIFOTHRESH 0x1ff |
| 1925 | 1946 | ||
| 1926 | #define V_TXFIFOTHRESH(x) ((x) << S_TXFIFOTHRESH) | 1947 | #define V_TXFIFOTHRESH(x) ((x) << S_TXFIFOTHRESH) |
| 1927 | 1948 | ||
| 1949 | #define S_ENDROPPKT 21 | ||
| 1950 | #define V_ENDROPPKT(x) ((x) << S_ENDROPPKT) | ||
| 1951 | #define F_ENDROPPKT V_ENDROPPKT(1U) | ||
| 1952 | |||
| 1928 | #define A_XGM_SERDES_CTRL 0x890 | 1953 | #define A_XGM_SERDES_CTRL 0x890 |
| 1929 | #define A_XGM_SERDES_CTRL0 0x8e0 | 1954 | #define A_XGM_SERDES_CTRL0 0x8e0 |
| 1930 | 1955 | ||
| @@ -2190,6 +2215,13 @@ | |||
| 2190 | 2215 | ||
| 2191 | #define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4 | 2216 | #define A_XGM_RX_MAX_PKT_SIZE_ERR_CNT 0x9a4 |
| 2192 | 2217 | ||
| 2218 | #define A_XGM_TX_SPI4_SOP_EOP_CNT 0x9a8 | ||
| 2219 | |||
| 2220 | #define S_TXSPI4SOPCNT 16 | ||
| 2221 | #define M_TXSPI4SOPCNT 0xffff | ||
| 2222 | #define V_TXSPI4SOPCNT(x) ((x) << S_TXSPI4SOPCNT) | ||
| 2223 | #define G_TXSPI4SOPCNT(x) (((x) >> S_TXSPI4SOPCNT) & M_TXSPI4SOPCNT) | ||
| 2224 | |||
| 2193 | #define A_XGM_RX_SPI4_SOP_EOP_CNT 0x9ac | 2225 | #define A_XGM_RX_SPI4_SOP_EOP_CNT 0x9ac |
| 2194 | 2226 | ||
| 2195 | #define XGMAC0_1_BASE_ADDR 0xa00 | 2227 | #define XGMAC0_1_BASE_ADDR 0xa00 |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index c23783432e51..027ab2c3825c 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
| @@ -2631,7 +2631,7 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports, | |||
| 2631 | q->txq[TXQ_ETH].stop_thres = nports * | 2631 | q->txq[TXQ_ETH].stop_thres = nports * |
| 2632 | flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3); | 2632 | flits_to_desc(sgl_len(MAX_SKB_FRAGS + 1) + 3); |
| 2633 | 2633 | ||
| 2634 | if (ntxq == 1) { | 2634 | if (!is_offload(adapter)) { |
| 2635 | #ifdef USE_RX_PAGE | 2635 | #ifdef USE_RX_PAGE |
| 2636 | q->fl[0].buf_size = RX_PAGE_SIZE; | 2636 | q->fl[0].buf_size = RX_PAGE_SIZE; |
| 2637 | #else | 2637 | #else |
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c index eaa7a2e89a30..fb485d0a43d8 100644 --- a/drivers/net/cxgb3/t3_hw.c +++ b/drivers/net/cxgb3/t3_hw.c | |||
| @@ -438,23 +438,23 @@ static const struct adapter_info t3_adap_info[] = { | |||
| 438 | {2, 0, 0, 0, | 438 | {2, 0, 0, 0, |
| 439 | F_GPIO2_OEN | F_GPIO4_OEN | | 439 | F_GPIO2_OEN | F_GPIO4_OEN | |
| 440 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, | 440 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, |
| 441 | SUPPORTED_OFFLOAD, | 441 | 0, |
| 442 | &mi1_mdio_ops, "Chelsio PE9000"}, | 442 | &mi1_mdio_ops, "Chelsio PE9000"}, |
| 443 | {2, 0, 0, 0, | 443 | {2, 0, 0, 0, |
| 444 | F_GPIO2_OEN | F_GPIO4_OEN | | 444 | F_GPIO2_OEN | F_GPIO4_OEN | |
| 445 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, | 445 | F_GPIO2_OUT_VAL | F_GPIO4_OUT_VAL, F_GPIO3 | F_GPIO5, |
| 446 | SUPPORTED_OFFLOAD, | 446 | 0, |
| 447 | &mi1_mdio_ops, "Chelsio T302"}, | 447 | &mi1_mdio_ops, "Chelsio T302"}, |
| 448 | {1, 0, 0, 0, | 448 | {1, 0, 0, 0, |
| 449 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | | 449 | F_GPIO1_OEN | F_GPIO6_OEN | F_GPIO7_OEN | F_GPIO10_OEN | |
| 450 | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, | 450 | F_GPIO1_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, |
| 451 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD, | 451 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI, |
| 452 | &mi1_mdio_ext_ops, "Chelsio T310"}, | 452 | &mi1_mdio_ext_ops, "Chelsio T310"}, |
| 453 | {2, 0, 0, 0, | 453 | {2, 0, 0, 0, |
| 454 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | | 454 | F_GPIO1_OEN | F_GPIO2_OEN | F_GPIO4_OEN | F_GPIO5_OEN | F_GPIO6_OEN | |
| 455 | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | | 455 | F_GPIO7_OEN | F_GPIO10_OEN | F_GPIO11_OEN | F_GPIO1_OUT_VAL | |
| 456 | F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, | 456 | F_GPIO5_OUT_VAL | F_GPIO6_OUT_VAL | F_GPIO10_OUT_VAL, 0, |
| 457 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI | SUPPORTED_OFFLOAD, | 457 | SUPPORTED_10000baseT_Full | SUPPORTED_AUI, |
| 458 | &mi1_mdio_ext_ops, "Chelsio T320"}, | 458 | &mi1_mdio_ext_ops, "Chelsio T320"}, |
| 459 | }; | 459 | }; |
| 460 | 460 | ||
| @@ -681,7 +681,8 @@ enum { | |||
| 681 | SF_ERASE_SECTOR = 0xd8, /* erase sector */ | 681 | SF_ERASE_SECTOR = 0xd8, /* erase sector */ |
| 682 | 682 | ||
| 683 | FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */ | 683 | FW_FLASH_BOOT_ADDR = 0x70000, /* start address of FW in flash */ |
| 684 | FW_VERS_ADDR = 0x77ffc /* flash address holding FW version */ | 684 | FW_VERS_ADDR = 0x77ffc, /* flash address holding FW version */ |
| 685 | FW_MIN_SIZE = 8 /* at least version and csum */ | ||
| 685 | }; | 686 | }; |
| 686 | 687 | ||
| 687 | /** | 688 | /** |
| @@ -935,7 +936,7 @@ int t3_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size) | |||
| 935 | const u32 *p = (const u32 *)fw_data; | 936 | const u32 *p = (const u32 *)fw_data; |
| 936 | int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; | 937 | int ret, addr, fw_sector = FW_FLASH_BOOT_ADDR >> 16; |
| 937 | 938 | ||
| 938 | if (size & 3) | 939 | if ((size & 3) || size < FW_MIN_SIZE) |
| 939 | return -EINVAL; | 940 | return -EINVAL; |
| 940 | if (size > FW_VERS_ADDR + 8 - FW_FLASH_BOOT_ADDR) | 941 | if (size > FW_VERS_ADDR + 8 - FW_FLASH_BOOT_ADDR) |
| 941 | return -EFBIG; | 942 | return -EFBIG; |
| @@ -1522,19 +1523,25 @@ static int mac_intr_handler(struct adapter *adap, unsigned int idx) | |||
| 1522 | */ | 1523 | */ |
| 1523 | int t3_phy_intr_handler(struct adapter *adapter) | 1524 | int t3_phy_intr_handler(struct adapter *adapter) |
| 1524 | { | 1525 | { |
| 1525 | static const int intr_gpio_bits[] = { 8, 0x20 }; | 1526 | u32 mask, gpi = adapter_info(adapter)->gpio_intr; |
| 1526 | |||
| 1527 | u32 i, cause = t3_read_reg(adapter, A_T3DBG_INT_CAUSE); | 1527 | u32 i, cause = t3_read_reg(adapter, A_T3DBG_INT_CAUSE); |
| 1528 | 1528 | ||
| 1529 | for_each_port(adapter, i) { | 1529 | for_each_port(adapter, i) { |
| 1530 | if (cause & intr_gpio_bits[i]) { | 1530 | struct port_info *p = adap2pinfo(adapter, i); |
| 1531 | struct cphy *phy = &adap2pinfo(adapter, i)->phy; | 1531 | |
| 1532 | int phy_cause = phy->ops->intr_handler(phy); | 1532 | mask = gpi - (gpi & (gpi - 1)); |
| 1533 | gpi -= mask; | ||
| 1534 | |||
| 1535 | if (!(p->port_type->caps & SUPPORTED_IRQ)) | ||
| 1536 | continue; | ||
| 1537 | |||
| 1538 | if (cause & mask) { | ||
| 1539 | int phy_cause = p->phy.ops->intr_handler(&p->phy); | ||
| 1533 | 1540 | ||
| 1534 | if (phy_cause & cphy_cause_link_change) | 1541 | if (phy_cause & cphy_cause_link_change) |
| 1535 | t3_link_changed(adapter, i); | 1542 | t3_link_changed(adapter, i); |
| 1536 | if (phy_cause & cphy_cause_fifo_error) | 1543 | if (phy_cause & cphy_cause_fifo_error) |
| 1537 | phy->fifo_errors++; | 1544 | p->phy.fifo_errors++; |
| 1538 | } | 1545 | } |
| 1539 | } | 1546 | } |
| 1540 | 1547 | ||
| @@ -2899,6 +2906,9 @@ static int mc7_init(struct mc7 *mc7, unsigned int mc7_clock, int mem_type) | |||
| 2899 | struct adapter *adapter = mc7->adapter; | 2906 | struct adapter *adapter = mc7->adapter; |
| 2900 | const struct mc7_timing_params *p = &mc7_timings[mem_type]; | 2907 | const struct mc7_timing_params *p = &mc7_timings[mem_type]; |
| 2901 | 2908 | ||
| 2909 | if (!mc7->size) | ||
| 2910 | return 0; | ||
| 2911 | |||
| 2902 | val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); | 2912 | val = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); |
| 2903 | slow = val & F_SLOW; | 2913 | slow = val & F_SLOW; |
| 2904 | width = G_WIDTH(val); | 2914 | width = G_WIDTH(val); |
| @@ -3099,8 +3109,10 @@ int t3_init_hw(struct adapter *adapter, u32 fw_params) | |||
| 3099 | do { /* wait for uP to initialize */ | 3109 | do { /* wait for uP to initialize */ |
| 3100 | msleep(20); | 3110 | msleep(20); |
| 3101 | } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts); | 3111 | } while (t3_read_reg(adapter, A_CIM_HOST_ACC_DATA) && --attempts); |
| 3102 | if (!attempts) | 3112 | if (!attempts) { |
| 3113 | CH_ERR(adapter, "uP initialization timed out\n"); | ||
| 3103 | goto out_err; | 3114 | goto out_err; |
| 3115 | } | ||
| 3104 | 3116 | ||
| 3105 | err = 0; | 3117 | err = 0; |
| 3106 | out_err: | 3118 | out_err: |
| @@ -3200,7 +3212,7 @@ static void __devinit mc7_prep(struct adapter *adapter, struct mc7 *mc7, | |||
| 3200 | mc7->name = name; | 3212 | mc7->name = name; |
| 3201 | mc7->offset = base_addr - MC7_PMRX_BASE_ADDR; | 3213 | mc7->offset = base_addr - MC7_PMRX_BASE_ADDR; |
| 3202 | cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); | 3214 | cfg = t3_read_reg(adapter, mc7->offset + A_MC7_CFG); |
| 3203 | mc7->size = mc7_calc_size(cfg); | 3215 | mc7->size = mc7->size = G_DEN(cfg) == M_DEN ? 0 : mc7_calc_size(cfg); |
| 3204 | mc7->width = G_WIDTH(cfg); | 3216 | mc7->width = G_WIDTH(cfg); |
| 3205 | } | 3217 | } |
| 3206 | 3218 | ||
| @@ -3227,6 +3239,7 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai) | |||
| 3227 | V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1)); | 3239 | V_I2C_CLKDIV(adapter->params.vpd.cclk / 80 - 1)); |
| 3228 | t3_write_reg(adapter, A_T3DBG_GPIO_EN, | 3240 | t3_write_reg(adapter, A_T3DBG_GPIO_EN, |
| 3229 | ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL); | 3241 | ai->gpio_out | F_GPIO0_OEN | F_GPIO0_OUT_VAL); |
| 3242 | t3_write_reg(adapter, A_MC5_DB_SERVER_INDEX, 0); | ||
| 3230 | 3243 | ||
| 3231 | if (adapter->params.rev == 0 || !uses_xaui(adapter)) | 3244 | if (adapter->params.rev == 0 || !uses_xaui(adapter)) |
| 3232 | val |= F_ENRGMII; | 3245 | val |= F_ENRGMII; |
| @@ -3243,15 +3256,17 @@ void early_hw_init(struct adapter *adapter, const struct adapter_info *ai) | |||
| 3243 | } | 3256 | } |
| 3244 | 3257 | ||
| 3245 | /* | 3258 | /* |
| 3246 | * Reset the adapter. PCIe cards lose their config space during reset, PCI-X | 3259 | * Reset the adapter. |
| 3260 | * Older PCIe cards lose their config space during reset, PCI-X | ||
| 3247 | * ones don't. | 3261 | * ones don't. |
| 3248 | */ | 3262 | */ |
| 3249 | int t3_reset_adapter(struct adapter *adapter) | 3263 | int t3_reset_adapter(struct adapter *adapter) |
| 3250 | { | 3264 | { |
| 3251 | int i; | 3265 | int i, save_and_restore_pcie = |
| 3266 | adapter->params.rev < T3_REV_B2 && is_pcie(adapter); | ||
| 3252 | uint16_t devid = 0; | 3267 | uint16_t devid = 0; |
| 3253 | 3268 | ||
| 3254 | if (is_pcie(adapter)) | 3269 | if (save_and_restore_pcie) |
| 3255 | pci_save_state(adapter->pdev); | 3270 | pci_save_state(adapter->pdev); |
| 3256 | t3_write_reg(adapter, A_PL_RST, F_CRSTWRM | F_CRSTWRMMODE); | 3271 | t3_write_reg(adapter, A_PL_RST, F_CRSTWRM | F_CRSTWRMMODE); |
| 3257 | 3272 | ||
| @@ -3269,7 +3284,7 @@ int t3_reset_adapter(struct adapter *adapter) | |||
| 3269 | if (devid != 0x1425) | 3284 | if (devid != 0x1425) |
| 3270 | return -1; | 3285 | return -1; |
| 3271 | 3286 | ||
| 3272 | if (is_pcie(adapter)) | 3287 | if (save_and_restore_pcie) |
| 3273 | pci_restore_state(adapter->pdev); | 3288 | pci_restore_state(adapter->pdev); |
| 3274 | return 0; | 3289 | return 0; |
| 3275 | } | 3290 | } |
| @@ -3323,7 +3338,13 @@ int __devinit t3_prep_adapter(struct adapter *adapter, | |||
| 3323 | p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size); | 3338 | p->tx_num_pgs = pm_num_pages(p->chan_tx_size, p->tx_pg_size); |
| 3324 | p->ntimer_qs = p->cm_size >= (128 << 20) || | 3339 | p->ntimer_qs = p->cm_size >= (128 << 20) || |
| 3325 | adapter->params.rev > 0 ? 12 : 6; | 3340 | adapter->params.rev > 0 ? 12 : 6; |
| 3341 | } | ||
| 3342 | |||
| 3343 | adapter->params.offload = t3_mc7_size(&adapter->pmrx) && | ||
| 3344 | t3_mc7_size(&adapter->pmtx) && | ||
| 3345 | t3_mc7_size(&adapter->cm); | ||
| 3326 | 3346 | ||
| 3347 | if (is_offload(adapter)) { | ||
| 3327 | adapter->params.mc5.nservers = DEFAULT_NSERVERS; | 3348 | adapter->params.mc5.nservers = DEFAULT_NSERVERS; |
| 3328 | adapter->params.mc5.nfilters = adapter->params.rev > 0 ? | 3349 | adapter->params.mc5.nfilters = adapter->params.rev > 0 ? |
| 3329 | DEFAULT_NFILTERS : 0; | 3350 | DEFAULT_NFILTERS : 0; |
diff --git a/drivers/net/cxgb3/version.h b/drivers/net/cxgb3/version.h index 82278f850259..042e27e291cd 100644 --- a/drivers/net/cxgb3/version.h +++ b/drivers/net/cxgb3/version.h | |||
| @@ -36,6 +36,9 @@ | |||
| 36 | #define DRV_NAME "cxgb3" | 36 | #define DRV_NAME "cxgb3" |
| 37 | /* Driver version */ | 37 | /* Driver version */ |
| 38 | #define DRV_VERSION "1.0-ko" | 38 | #define DRV_VERSION "1.0-ko" |
| 39 | |||
| 40 | /* Firmware version */ | ||
| 39 | #define FW_VERSION_MAJOR 3 | 41 | #define FW_VERSION_MAJOR 3 |
| 40 | #define FW_VERSION_MINOR 2 | 42 | #define FW_VERSION_MINOR 3 |
| 43 | #define FW_VERSION_MICRO 0 | ||
| 41 | #endif /* __CHELSIO_VERSION_H */ | 44 | #endif /* __CHELSIO_VERSION_H */ |
diff --git a/drivers/net/cxgb3/xgmac.c b/drivers/net/cxgb3/xgmac.c index 907a272ae32d..a506792f9575 100644 --- a/drivers/net/cxgb3/xgmac.c +++ b/drivers/net/cxgb3/xgmac.c | |||
| @@ -124,9 +124,6 @@ int t3_mac_reset(struct cmac *mac) | |||
| 124 | xaui_serdes_reset(mac); | 124 | xaui_serdes_reset(mac); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | if (adap->params.rev > 0) | ||
| 128 | t3_write_reg(adap, A_XGM_PAUSE_TIMER + oft, 0xf000); | ||
| 129 | |||
| 130 | val = F_MAC_RESET_; | 127 | val = F_MAC_RESET_; |
| 131 | if (is_10G(adap)) | 128 | if (is_10G(adap)) |
| 132 | val |= F_PCS_RESET_; | 129 | val |= F_PCS_RESET_; |
| @@ -145,6 +142,58 @@ int t3_mac_reset(struct cmac *mac) | |||
| 145 | return 0; | 142 | return 0; |
| 146 | } | 143 | } |
| 147 | 144 | ||
| 145 | int t3b2_mac_reset(struct cmac *mac) | ||
| 146 | { | ||
| 147 | struct adapter *adap = mac->adapter; | ||
| 148 | unsigned int oft = mac->offset; | ||
| 149 | u32 val; | ||
| 150 | |||
| 151 | if (!macidx(mac)) | ||
| 152 | t3_set_reg_field(adap, A_MPS_CFG, F_PORT0ACTIVE, 0); | ||
| 153 | else | ||
| 154 | t3_set_reg_field(adap, A_MPS_CFG, F_PORT1ACTIVE, 0); | ||
| 155 | |||
| 156 | t3_write_reg(adap, A_XGM_RESET_CTRL + oft, F_MAC_RESET_); | ||
| 157 | t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */ | ||
| 158 | |||
| 159 | msleep(10); | ||
| 160 | |||
| 161 | /* Check for xgm Rx fifo empty */ | ||
| 162 | if (t3_wait_op_done(adap, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT + oft, | ||
| 163 | 0x80000000, 1, 5, 2)) { | ||
| 164 | CH_ERR(adap, "MAC %d Rx fifo drain failed\n", | ||
| 165 | macidx(mac)); | ||
| 166 | return -1; | ||
| 167 | } | ||
| 168 | |||
| 169 | t3_write_reg(adap, A_XGM_RESET_CTRL + oft, 0); | ||
| 170 | t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */ | ||
| 171 | |||
| 172 | val = F_MAC_RESET_; | ||
| 173 | if (is_10G(adap)) | ||
| 174 | val |= F_PCS_RESET_; | ||
| 175 | else if (uses_xaui(adap)) | ||
| 176 | val |= F_PCS_RESET_ | F_XG2G_RESET_; | ||
| 177 | else | ||
| 178 | val |= F_RGMII_RESET_ | F_XG2G_RESET_; | ||
| 179 | t3_write_reg(adap, A_XGM_RESET_CTRL + oft, val); | ||
| 180 | t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */ | ||
| 181 | if ((val & F_PCS_RESET_) && adap->params.rev) { | ||
| 182 | msleep(1); | ||
| 183 | t3b_pcs_reset(mac); | ||
| 184 | } | ||
| 185 | t3_write_reg(adap, A_XGM_RX_CFG + oft, | ||
| 186 | F_DISPAUSEFRAMES | F_EN1536BFRAMES | | ||
| 187 | F_RMFCS | F_ENJUMBO | F_ENHASHMCAST); | ||
| 188 | |||
| 189 | if (!macidx(mac)) | ||
| 190 | t3_set_reg_field(adap, A_MPS_CFG, 0, F_PORT0ACTIVE); | ||
| 191 | else | ||
| 192 | t3_set_reg_field(adap, A_MPS_CFG, 0, F_PORT1ACTIVE); | ||
| 193 | |||
| 194 | return 0; | ||
| 195 | } | ||
| 196 | |||
| 148 | /* | 197 | /* |
| 149 | * Set the exact match register 'idx' to recognize the given Ethernet address. | 198 | * Set the exact match register 'idx' to recognize the given Ethernet address. |
| 150 | */ | 199 | */ |
| @@ -251,9 +300,11 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) | |||
| 251 | * Adjust the PAUSE frame watermarks. We always set the LWM, and the | 300 | * Adjust the PAUSE frame watermarks. We always set the LWM, and the |
| 252 | * HWM only if flow-control is enabled. | 301 | * HWM only if flow-control is enabled. |
| 253 | */ | 302 | */ |
| 254 | hwm = max(MAC_RXFIFO_SIZE - 3 * mtu, MAC_RXFIFO_SIZE / 2U); | 303 | hwm = max_t(unsigned int, MAC_RXFIFO_SIZE - 3 * mtu, |
| 255 | hwm = min(hwm, 3 * MAC_RXFIFO_SIZE / 4 + 1024); | 304 | MAC_RXFIFO_SIZE * 38 / 100); |
| 256 | lwm = hwm - 1024; | 305 | hwm = min(hwm, MAC_RXFIFO_SIZE - 8192); |
| 306 | lwm = min(3 * (int)mtu, MAC_RXFIFO_SIZE / 4); | ||
| 307 | |||
| 257 | v = t3_read_reg(adap, A_XGM_RXFIFO_CFG + mac->offset); | 308 | v = t3_read_reg(adap, A_XGM_RXFIFO_CFG + mac->offset); |
| 258 | v &= ~V_RXFIFOPAUSELWM(M_RXFIFOPAUSELWM); | 309 | v &= ~V_RXFIFOPAUSELWM(M_RXFIFOPAUSELWM); |
| 259 | v |= V_RXFIFOPAUSELWM(lwm / 8); | 310 | v |= V_RXFIFOPAUSELWM(lwm / 8); |
| @@ -270,7 +321,15 @@ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu) | |||
| 270 | thres = mtu > thres ? (mtu - thres + 7) / 8 : 0; | 321 | thres = mtu > thres ? (mtu - thres + 7) / 8 : 0; |
| 271 | thres = max(thres, 8U); /* need at least 8 */ | 322 | thres = max(thres, 8U); /* need at least 8 */ |
| 272 | t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, | 323 | t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, |
| 273 | V_TXFIFOTHRESH(M_TXFIFOTHRESH), V_TXFIFOTHRESH(thres)); | 324 | V_TXFIFOTHRESH(M_TXFIFOTHRESH) | V_TXIPG(M_TXIPG), |
| 325 | V_TXFIFOTHRESH(thres) | V_TXIPG(1)); | ||
| 326 | |||
| 327 | if (adap->params.rev > 0) | ||
| 328 | t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset, | ||
| 329 | (hwm - lwm) * 4 / 8); | ||
| 330 | t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset, | ||
| 331 | MAC_RXFIFO_SIZE * 4 * 8 / 512); | ||
| 332 | |||
| 274 | return 0; | 333 | return 0; |
| 275 | } | 334 | } |
| 276 | 335 | ||
| @@ -298,12 +357,6 @@ int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc) | |||
| 298 | V_PORTSPEED(M_PORTSPEED), val); | 357 | V_PORTSPEED(M_PORTSPEED), val); |
| 299 | } | 358 | } |
| 300 | 359 | ||
| 301 | val = t3_read_reg(adap, A_XGM_RXFIFO_CFG + oft); | ||
| 302 | val &= ~V_RXFIFOPAUSEHWM(M_RXFIFOPAUSEHWM); | ||
| 303 | if (fc & PAUSE_TX) | ||
| 304 | val |= V_RXFIFOPAUSEHWM(G_RXFIFOPAUSELWM(val) + 128); /* +1KB */ | ||
| 305 | t3_write_reg(adap, A_XGM_RXFIFO_CFG + oft, val); | ||
| 306 | |||
| 307 | t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN, | 360 | t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN, |
| 308 | (fc & PAUSE_RX) ? F_TXPAUSEEN : 0); | 361 | (fc & PAUSE_RX) ? F_TXPAUSEEN : 0); |
| 309 | return 0; | 362 | return 0; |
| @@ -314,13 +367,28 @@ int t3_mac_enable(struct cmac *mac, int which) | |||
| 314 | int idx = macidx(mac); | 367 | int idx = macidx(mac); |
| 315 | struct adapter *adap = mac->adapter; | 368 | struct adapter *adap = mac->adapter; |
| 316 | unsigned int oft = mac->offset; | 369 | unsigned int oft = mac->offset; |
| 317 | 370 | struct mac_stats *s = &mac->stats; | |
| 371 | |||
| 318 | if (which & MAC_DIRECTION_TX) { | 372 | if (which & MAC_DIRECTION_TX) { |
| 319 | t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN); | 373 | t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN); |
| 320 | t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); | 374 | t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); |
| 321 | t3_write_reg(adap, A_TP_PIO_DATA, 0xbf000001); | 375 | t3_write_reg(adap, A_TP_PIO_DATA, 0xc0ede401); |
| 322 | t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE); | 376 | t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE); |
| 323 | t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx); | 377 | t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx); |
| 378 | |||
| 379 | t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + idx); | ||
| 380 | mac->tx_mcnt = s->tx_frames; | ||
| 381 | mac->tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, | ||
| 382 | A_TP_PIO_DATA))); | ||
| 383 | mac->tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, | ||
| 384 | A_XGM_TX_SPI4_SOP_EOP_CNT + | ||
| 385 | oft))); | ||
| 386 | mac->rx_mcnt = s->rx_frames; | ||
| 387 | mac->rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, | ||
| 388 | A_XGM_RX_SPI4_SOP_EOP_CNT + | ||
| 389 | oft))); | ||
| 390 | mac->txen = F_TXEN; | ||
| 391 | mac->toggle_cnt = 0; | ||
| 324 | } | 392 | } |
| 325 | if (which & MAC_DIRECTION_RX) | 393 | if (which & MAC_DIRECTION_RX) |
| 326 | t3_write_reg(adap, A_XGM_RX_CTRL + oft, F_RXEN); | 394 | t3_write_reg(adap, A_XGM_RX_CTRL + oft, F_RXEN); |
| @@ -331,19 +399,102 @@ int t3_mac_disable(struct cmac *mac, int which) | |||
| 331 | { | 399 | { |
| 332 | int idx = macidx(mac); | 400 | int idx = macidx(mac); |
| 333 | struct adapter *adap = mac->adapter; | 401 | struct adapter *adap = mac->adapter; |
| 402 | int val; | ||
| 334 | 403 | ||
| 335 | if (which & MAC_DIRECTION_TX) { | 404 | if (which & MAC_DIRECTION_TX) { |
| 336 | t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0); | 405 | t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0); |
| 337 | t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); | 406 | t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); |
| 338 | t3_write_reg(adap, A_TP_PIO_DATA, 0xc000001f); | 407 | t3_write_reg(adap, A_TP_PIO_DATA, 0xc000001f); |
| 339 | t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE); | 408 | t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE); |
| 340 | t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 0); | 409 | t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, 1 << idx); |
| 410 | mac->txen = 0; | ||
| 341 | } | 411 | } |
| 342 | if (which & MAC_DIRECTION_RX) | 412 | if (which & MAC_DIRECTION_RX) { |
| 413 | t3_set_reg_field(mac->adapter, A_XGM_RESET_CTRL + mac->offset, | ||
| 414 | F_PCS_RESET_, 0); | ||
| 415 | msleep(100); | ||
| 343 | t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0); | 416 | t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0); |
| 417 | val = F_MAC_RESET_; | ||
| 418 | if (is_10G(adap)) | ||
| 419 | val |= F_PCS_RESET_; | ||
| 420 | else if (uses_xaui(adap)) | ||
| 421 | val |= F_PCS_RESET_ | F_XG2G_RESET_; | ||
| 422 | else | ||
| 423 | val |= F_RGMII_RESET_ | F_XG2G_RESET_; | ||
| 424 | t3_write_reg(mac->adapter, A_XGM_RESET_CTRL + mac->offset, val); | ||
| 425 | } | ||
| 344 | return 0; | 426 | return 0; |
| 345 | } | 427 | } |
| 346 | 428 | ||
| 429 | int t3b2_mac_watchdog_task(struct cmac *mac) | ||
| 430 | { | ||
| 431 | struct adapter *adap = mac->adapter; | ||
| 432 | struct mac_stats *s = &mac->stats; | ||
| 433 | unsigned int tx_tcnt, tx_xcnt; | ||
| 434 | unsigned int tx_mcnt = s->tx_frames; | ||
| 435 | unsigned int rx_mcnt = s->rx_frames; | ||
| 436 | unsigned int rx_xcnt; | ||
| 437 | int status; | ||
| 438 | |||
| 439 | if (tx_mcnt == mac->tx_mcnt) { | ||
| 440 | tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, | ||
| 441 | A_XGM_TX_SPI4_SOP_EOP_CNT + | ||
| 442 | mac->offset))); | ||
| 443 | if (tx_xcnt == 0) { | ||
| 444 | t3_write_reg(adap, A_TP_PIO_ADDR, | ||
| 445 | A_TP_TX_DROP_CNT_CH0 + macidx(mac)); | ||
| 446 | tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, | ||
| 447 | A_TP_PIO_DATA))); | ||
| 448 | } else { | ||
| 449 | mac->toggle_cnt = 0; | ||
| 450 | return 0; | ||
| 451 | } | ||
| 452 | } else { | ||
| 453 | mac->toggle_cnt = 0; | ||
| 454 | return 0; | ||
| 455 | } | ||
| 456 | |||
| 457 | if (((tx_tcnt != mac->tx_tcnt) && | ||
| 458 | (tx_xcnt == 0) && (mac->tx_xcnt == 0)) || | ||
| 459 | ((mac->tx_mcnt == tx_mcnt) && | ||
| 460 | (tx_xcnt != 0) && (mac->tx_xcnt != 0))) { | ||
| 461 | if (mac->toggle_cnt > 4) | ||
| 462 | status = 2; | ||
| 463 | else | ||
| 464 | status = 1; | ||
| 465 | } else { | ||
| 466 | mac->toggle_cnt = 0; | ||
| 467 | return 0; | ||
| 468 | } | ||
| 469 | |||
| 470 | if (rx_mcnt != mac->rx_mcnt) | ||
| 471 | rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, | ||
| 472 | A_XGM_RX_SPI4_SOP_EOP_CNT + | ||
| 473 | mac->offset))); | ||
| 474 | else | ||
| 475 | return 0; | ||
| 476 | |||
| 477 | if (mac->rx_mcnt != s->rx_frames && rx_xcnt == 0 && mac->rx_xcnt == 0) | ||
| 478 | status = 2; | ||
| 479 | |||
| 480 | mac->tx_tcnt = tx_tcnt; | ||
| 481 | mac->tx_xcnt = tx_xcnt; | ||
| 482 | mac->tx_mcnt = s->tx_frames; | ||
| 483 | mac->rx_xcnt = rx_xcnt; | ||
| 484 | mac->rx_mcnt = s->rx_frames; | ||
| 485 | if (status == 1) { | ||
| 486 | t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0); | ||
| 487 | t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset); /* flush */ | ||
| 488 | t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, mac->txen); | ||
| 489 | t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset); /* flush */ | ||
| 490 | mac->toggle_cnt++; | ||
| 491 | } else if (status == 2) { | ||
| 492 | t3b2_mac_reset(mac); | ||
| 493 | mac->toggle_cnt = 0; | ||
| 494 | } | ||
| 495 | return status; | ||
| 496 | } | ||
| 497 | |||
| 347 | /* | 498 | /* |
| 348 | * This function is called periodically to accumulate the current values of the | 499 | * This function is called periodically to accumulate the current values of the |
| 349 | * RMON counters into the port statistics. Since the packet counters are only | 500 | * RMON counters into the port statistics. Since the packet counters are only |
| @@ -373,7 +524,11 @@ const struct mac_stats *t3_mac_update_stats(struct cmac *mac) | |||
| 373 | RMON_UPDATE(mac, rx_symbol_errs, RX_SYM_CODE_ERR_FRAMES); | 524 | RMON_UPDATE(mac, rx_symbol_errs, RX_SYM_CODE_ERR_FRAMES); |
| 374 | 525 | ||
| 375 | RMON_UPDATE(mac, rx_too_long, RX_OVERSIZE_FRAMES); | 526 | RMON_UPDATE(mac, rx_too_long, RX_OVERSIZE_FRAMES); |
| 376 | mac->stats.rx_too_long += RMON_READ(mac, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT); | 527 | |
| 528 | v = RMON_READ(mac, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT); | ||
| 529 | if (mac->adapter->params.rev == T3_REV_B2) | ||
| 530 | v &= 0x7fffffff; | ||
| 531 | mac->stats.rx_too_long += v; | ||
| 377 | 532 | ||
| 378 | RMON_UPDATE(mac, rx_frames_64, RX_64B_FRAMES); | 533 | RMON_UPDATE(mac, rx_frames_64, RX_64B_FRAMES); |
| 379 | RMON_UPDATE(mac, rx_frames_65_127, RX_65_127B_FRAMES); | 534 | RMON_UPDATE(mac, rx_frames_65_127, RX_65_127B_FRAMES); |
diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 5113eef755b9..f3807aaf10aa 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c | |||
| @@ -1491,8 +1491,9 @@ static void __init depca_platform_probe (void) | |||
| 1491 | depca_io_ports[i].device = pldev; | 1491 | depca_io_ports[i].device = pldev; |
| 1492 | 1492 | ||
| 1493 | if (platform_device_add(pldev)) { | 1493 | if (platform_device_add(pldev)) { |
| 1494 | platform_device_put(pldev); | ||
| 1495 | depca_io_ports[i].device = NULL; | 1494 | depca_io_ports[i].device = NULL; |
| 1495 | pldev->dev.platform_data = NULL; | ||
| 1496 | platform_device_put(pldev); | ||
| 1496 | continue; | 1497 | continue; |
| 1497 | } | 1498 | } |
| 1498 | 1499 | ||
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 1d08e937af82..b28a915bd980 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
| @@ -3796,7 +3796,7 @@ e1000_intr_msi(int irq, void *data) | |||
| 3796 | 3796 | ||
| 3797 | for (i = 0; i < E1000_MAX_INTR; i++) | 3797 | for (i = 0; i < E1000_MAX_INTR; i++) |
| 3798 | if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & | 3798 | if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
| 3799 | e1000_clean_tx_irq(adapter, adapter->tx_ring))) | 3799 | !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
| 3800 | break; | 3800 | break; |
| 3801 | 3801 | ||
| 3802 | if (likely(adapter->itr_setting & 3)) | 3802 | if (likely(adapter->itr_setting & 3)) |
| @@ -3899,7 +3899,7 @@ e1000_intr(int irq, void *data) | |||
| 3899 | 3899 | ||
| 3900 | for (i = 0; i < E1000_MAX_INTR; i++) | 3900 | for (i = 0; i < E1000_MAX_INTR; i++) |
| 3901 | if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & | 3901 | if (unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) & |
| 3902 | e1000_clean_tx_irq(adapter, adapter->tx_ring))) | 3902 | !e1000_clean_tx_irq(adapter, adapter->tx_ring))) |
| 3903 | break; | 3903 | break; |
| 3904 | 3904 | ||
| 3905 | if (likely(adapter->itr_setting & 3)) | 3905 | if (likely(adapter->itr_setting & 3)) |
| @@ -3949,7 +3949,7 @@ e1000_clean(struct net_device *poll_dev, int *budget) | |||
| 3949 | poll_dev->quota -= work_done; | 3949 | poll_dev->quota -= work_done; |
| 3950 | 3950 | ||
| 3951 | /* If no Tx and not enough Rx work done, exit the polling mode */ | 3951 | /* If no Tx and not enough Rx work done, exit the polling mode */ |
| 3952 | if ((tx_cleaned && (work_done < work_to_do)) || | 3952 | if ((!tx_cleaned && (work_done == 0)) || |
| 3953 | !netif_running(poll_dev)) { | 3953 | !netif_running(poll_dev)) { |
| 3954 | quit_polling: | 3954 | quit_polling: |
| 3955 | if (likely(adapter->itr_setting & 3)) | 3955 | if (likely(adapter->itr_setting & 3)) |
| @@ -3979,7 +3979,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, | |||
| 3979 | #ifdef CONFIG_E1000_NAPI | 3979 | #ifdef CONFIG_E1000_NAPI |
| 3980 | unsigned int count = 0; | 3980 | unsigned int count = 0; |
| 3981 | #endif | 3981 | #endif |
| 3982 | boolean_t cleaned = TRUE; | 3982 | boolean_t cleaned = FALSE; |
| 3983 | unsigned int total_tx_bytes=0, total_tx_packets=0; | 3983 | unsigned int total_tx_bytes=0, total_tx_packets=0; |
| 3984 | 3984 | ||
| 3985 | i = tx_ring->next_to_clean; | 3985 | i = tx_ring->next_to_clean; |
| @@ -4013,10 +4013,7 @@ e1000_clean_tx_irq(struct e1000_adapter *adapter, | |||
| 4013 | #ifdef CONFIG_E1000_NAPI | 4013 | #ifdef CONFIG_E1000_NAPI |
| 4014 | #define E1000_TX_WEIGHT 64 | 4014 | #define E1000_TX_WEIGHT 64 |
| 4015 | /* weight of a sort for tx, to avoid endless transmit cleanup */ | 4015 | /* weight of a sort for tx, to avoid endless transmit cleanup */ |
| 4016 | if (count++ == E1000_TX_WEIGHT) { | 4016 | if (count++ == E1000_TX_WEIGHT) break; |
| 4017 | cleaned = FALSE; | ||
| 4018 | break; | ||
| 4019 | } | ||
| 4020 | #endif | 4017 | #endif |
| 4021 | } | 4018 | } |
| 4022 | 4019 | ||
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c index c8c41f0a47d6..714ea1176ec7 100644 --- a/drivers/net/ewrk3.c +++ b/drivers/net/ewrk3.c | |||
| @@ -414,10 +414,9 @@ ewrk3_hw_init(struct net_device *dev, u_long iobase) | |||
| 414 | icr &= 0x70; | 414 | icr &= 0x70; |
| 415 | outb(icr, EWRK3_ICR); /* Disable all the IRQs */ | 415 | outb(icr, EWRK3_ICR); /* Disable all the IRQs */ |
| 416 | 416 | ||
| 417 | if (nicsr == (CSR_TXD | CSR_RXD)) | 417 | if (nicsr != (CSR_TXD | CSR_RXD)) |
| 418 | return -ENXIO; | 418 | return -ENXIO; |
| 419 | 419 | ||
| 420 | |||
| 421 | /* Check that the EEPROM is alive and well and not living on Pluto... */ | 420 | /* Check that the EEPROM is alive and well and not living on Pluto... */ |
| 422 | for (chksum = 0, i = 0; i < EEPROM_MAX; i += 2) { | 421 | for (chksum = 0, i = 0; i < EEPROM_MAX; i += 2) { |
| 423 | union { | 422 | union { |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 46e1697d9cfd..d04214e4e581 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
| @@ -2050,9 +2050,10 @@ static void nv_tx_timeout(struct net_device *dev) | |||
| 2050 | nv_drain_tx(dev); | 2050 | nv_drain_tx(dev); |
| 2051 | nv_init_tx(dev); | 2051 | nv_init_tx(dev); |
| 2052 | setup_hw_rings(dev, NV_SETUP_TX_RING); | 2052 | setup_hw_rings(dev, NV_SETUP_TX_RING); |
| 2053 | netif_wake_queue(dev); | ||
| 2054 | } | 2053 | } |
| 2055 | 2054 | ||
| 2055 | netif_wake_queue(dev); | ||
| 2056 | |||
| 2056 | /* 4) restart tx engine */ | 2057 | /* 4) restart tx engine */ |
| 2057 | nv_start_tx(dev); | 2058 | nv_start_tx(dev); |
| 2058 | spin_unlock_irq(&np->lock); | 2059 | spin_unlock_irq(&np->lock); |
| @@ -3536,7 +3537,10 @@ static void nv_do_nic_poll(unsigned long data) | |||
| 3536 | pci_push(base); | 3537 | pci_push(base); |
| 3537 | 3538 | ||
| 3538 | if (!using_multi_irqs(dev)) { | 3539 | if (!using_multi_irqs(dev)) { |
| 3539 | nv_nic_irq(0, dev); | 3540 | if (np->desc_ver == DESC_VER_3) |
| 3541 | nv_nic_irq_optimized(0, dev); | ||
| 3542 | else | ||
| 3543 | nv_nic_irq(0, dev); | ||
| 3540 | if (np->msi_flags & NV_MSI_X_ENABLED) | 3544 | if (np->msi_flags & NV_MSI_X_ENABLED) |
| 3541 | enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); | 3545 | enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector); |
| 3542 | else | 3546 | else |
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c index 59214e74b9cf..30baf6ecfc63 100644 --- a/drivers/net/hamradio/baycom_ser_fdx.c +++ b/drivers/net/hamradio/baycom_ser_fdx.c | |||
| @@ -75,12 +75,14 @@ | |||
| 75 | #include <linux/ioport.h> | 75 | #include <linux/ioport.h> |
| 76 | #include <linux/string.h> | 76 | #include <linux/string.h> |
| 77 | #include <linux/init.h> | 77 | #include <linux/init.h> |
| 78 | #include <asm/uaccess.h> | ||
| 79 | #include <asm/io.h> | ||
| 80 | #include <linux/hdlcdrv.h> | 78 | #include <linux/hdlcdrv.h> |
| 81 | #include <linux/baycom.h> | 79 | #include <linux/baycom.h> |
| 82 | #include <linux/jiffies.h> | 80 | #include <linux/jiffies.h> |
| 83 | 81 | ||
| 82 | #include <asm/uaccess.h> | ||
| 83 | #include <asm/io.h> | ||
| 84 | #include <asm/irq.h> | ||
| 85 | |||
| 84 | /* --------------------------------------------------------------------- */ | 86 | /* --------------------------------------------------------------------- */ |
| 85 | 87 | ||
| 86 | #define BAYCOM_DEBUG | 88 | #define BAYCOM_DEBUG |
diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c index ca2b21f9d444..07b4c0d7a75c 100644 --- a/drivers/net/ifb.c +++ b/drivers/net/ifb.c | |||
| @@ -96,17 +96,24 @@ static void ri_tasklet(unsigned long dev) | |||
| 96 | skb->tc_verd = SET_TC_NCLS(skb->tc_verd); | 96 | skb->tc_verd = SET_TC_NCLS(skb->tc_verd); |
| 97 | stats->tx_packets++; | 97 | stats->tx_packets++; |
| 98 | stats->tx_bytes +=skb->len; | 98 | stats->tx_bytes +=skb->len; |
| 99 | |||
| 100 | skb->dev = __dev_get_by_index(skb->iif); | ||
| 101 | if (!skb->dev) { | ||
| 102 | dev_kfree_skb(skb); | ||
| 103 | stats->tx_dropped++; | ||
| 104 | break; | ||
| 105 | } | ||
| 106 | skb->iif = _dev->ifindex; | ||
| 107 | |||
| 99 | if (from & AT_EGRESS) { | 108 | if (from & AT_EGRESS) { |
| 100 | dp->st_rx_frm_egr++; | 109 | dp->st_rx_frm_egr++; |
| 101 | dev_queue_xmit(skb); | 110 | dev_queue_xmit(skb); |
| 102 | } else if (from & AT_INGRESS) { | 111 | } else if (from & AT_INGRESS) { |
| 103 | |||
| 104 | dp->st_rx_frm_ing++; | 112 | dp->st_rx_frm_ing++; |
| 113 | skb_pull(skb, skb->dev->hard_header_len); | ||
| 105 | netif_rx(skb); | 114 | netif_rx(skb); |
| 106 | } else { | 115 | } else |
| 107 | dev_kfree_skb(skb); | 116 | BUG(); |
| 108 | stats->tx_dropped++; | ||
| 109 | } | ||
| 110 | } | 117 | } |
| 111 | 118 | ||
| 112 | if (netif_tx_trylock(_dev)) { | 119 | if (netif_tx_trylock(_dev)) { |
| @@ -157,26 +164,10 @@ static int ifb_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 157 | stats->rx_packets++; | 164 | stats->rx_packets++; |
| 158 | stats->rx_bytes+=skb->len; | 165 | stats->rx_bytes+=skb->len; |
| 159 | 166 | ||
| 160 | if (!from || !skb->input_dev) { | 167 | if (!(from & (AT_INGRESS|AT_EGRESS)) || !skb->iif) { |
| 161 | dropped: | ||
| 162 | dev_kfree_skb(skb); | 168 | dev_kfree_skb(skb); |
| 163 | stats->rx_dropped++; | 169 | stats->rx_dropped++; |
| 164 | return ret; | 170 | return ret; |
| 165 | } else { | ||
| 166 | /* | ||
| 167 | * note we could be going | ||
| 168 | * ingress -> egress or | ||
| 169 | * egress -> ingress | ||
| 170 | */ | ||
| 171 | skb->dev = skb->input_dev; | ||
| 172 | skb->input_dev = dev; | ||
| 173 | if (from & AT_INGRESS) { | ||
| 174 | skb_pull(skb, skb->dev->hard_header_len); | ||
| 175 | } else { | ||
| 176 | if (!(from & AT_EGRESS)) { | ||
| 177 | goto dropped; | ||
| 178 | } | ||
| 179 | } | ||
| 180 | } | 171 | } |
| 181 | 172 | ||
| 182 | if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) { | 173 | if (skb_queue_len(&dp->rq) >= dev->tx_queue_len) { |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 340ee99652eb..1d510bdc9b84 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
| @@ -1057,6 +1057,8 @@ static int stir421x_fw_upload(struct irda_usb_cb *self, | |||
| 1057 | 1057 | ||
| 1058 | if (ret < 0) | 1058 | if (ret < 0) |
| 1059 | break; | 1059 | break; |
| 1060 | |||
| 1061 | mdelay(10); | ||
| 1060 | } | 1062 | } |
| 1061 | 1063 | ||
| 1062 | kfree(patch_block); | 1064 | kfree(patch_block); |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 9137e239fac2..2272156af31e 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
| @@ -321,15 +321,22 @@ static void pxa_irda_fir_dma_tx_irq(int channel, void *data) | |||
| 321 | pxa_irda_set_speed(si, si->newspeed); | 321 | pxa_irda_set_speed(si, si->newspeed); |
| 322 | si->newspeed = 0; | 322 | si->newspeed = 0; |
| 323 | } else { | 323 | } else { |
| 324 | int i = 64; | ||
| 325 | |||
| 324 | ICCR0 = 0; | 326 | ICCR0 = 0; |
| 325 | pxa_irda_fir_dma_rx_start(si); | 327 | pxa_irda_fir_dma_rx_start(si); |
| 328 | while ((ICSR1 & ICSR1_RNE) && i--) | ||
| 329 | (void)ICDR; | ||
| 326 | ICCR0 = ICCR0_ITR | ICCR0_RXE; | 330 | ICCR0 = ICCR0_ITR | ICCR0_RXE; |
| 331 | |||
| 332 | if (i < 0) | ||
| 333 | printk(KERN_ERR "pxa_ir: cannot clear Rx FIFO!\n"); | ||
| 327 | } | 334 | } |
| 328 | netif_wake_queue(dev); | 335 | netif_wake_queue(dev); |
| 329 | } | 336 | } |
| 330 | 337 | ||
| 331 | /* EIF(Error in FIFO/End in Frame) handler for FIR */ | 338 | /* EIF(Error in FIFO/End in Frame) handler for FIR */ |
| 332 | static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev) | 339 | static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev, int icsr0) |
| 333 | { | 340 | { |
| 334 | unsigned int len, stat, data; | 341 | unsigned int len, stat, data; |
| 335 | 342 | ||
| @@ -350,7 +357,7 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev) | |||
| 350 | } | 357 | } |
| 351 | if (stat & ICSR1_ROR) { | 358 | if (stat & ICSR1_ROR) { |
| 352 | printk(KERN_DEBUG "pxa_ir: fir receive overrun\n"); | 359 | printk(KERN_DEBUG "pxa_ir: fir receive overrun\n"); |
| 353 | si->stats.rx_frame_errors++; | 360 | si->stats.rx_over_errors++; |
| 354 | } | 361 | } |
| 355 | } else { | 362 | } else { |
| 356 | si->dma_rx_buff[len++] = data; | 363 | si->dma_rx_buff[len++] = data; |
| @@ -362,7 +369,15 @@ static void pxa_irda_fir_irq_eif(struct pxa_irda *si, struct net_device *dev) | |||
| 362 | 369 | ||
| 363 | if (stat & ICSR1_EOF) { | 370 | if (stat & ICSR1_EOF) { |
| 364 | /* end of frame. */ | 371 | /* end of frame. */ |
| 365 | struct sk_buff *skb = alloc_skb(len+1,GFP_ATOMIC); | 372 | struct sk_buff *skb; |
| 373 | |||
| 374 | if (icsr0 & ICSR0_FRE) { | ||
| 375 | printk(KERN_ERR "pxa_ir: dropping erroneous frame\n"); | ||
| 376 | si->stats.rx_dropped++; | ||
| 377 | return; | ||
| 378 | } | ||
| 379 | |||
| 380 | skb = alloc_skb(len+1,GFP_ATOMIC); | ||
| 366 | if (!skb) { | 381 | if (!skb) { |
| 367 | printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n"); | 382 | printk(KERN_ERR "pxa_ir: fir out of memory for receive skb\n"); |
| 368 | si->stats.rx_dropped++; | 383 | si->stats.rx_dropped++; |
| @@ -392,7 +407,7 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id) | |||
| 392 | { | 407 | { |
| 393 | struct net_device *dev = dev_id; | 408 | struct net_device *dev = dev_id; |
| 394 | struct pxa_irda *si = netdev_priv(dev); | 409 | struct pxa_irda *si = netdev_priv(dev); |
| 395 | int icsr0; | 410 | int icsr0, i = 64; |
| 396 | 411 | ||
| 397 | /* stop RX DMA */ | 412 | /* stop RX DMA */ |
| 398 | DCSR(si->rxdma) &= ~DCSR_RUN; | 413 | DCSR(si->rxdma) &= ~DCSR_RUN; |
| @@ -412,13 +427,18 @@ static irqreturn_t pxa_irda_fir_irq(int irq, void *dev_id) | |||
| 412 | 427 | ||
| 413 | if (icsr0 & ICSR0_EIF) { | 428 | if (icsr0 & ICSR0_EIF) { |
| 414 | /* An error in FIFO occured, or there is a end of frame */ | 429 | /* An error in FIFO occured, or there is a end of frame */ |
| 415 | pxa_irda_fir_irq_eif(si, dev); | 430 | pxa_irda_fir_irq_eif(si, dev, icsr0); |
| 416 | } | 431 | } |
| 417 | 432 | ||
| 418 | ICCR0 = 0; | 433 | ICCR0 = 0; |
| 419 | pxa_irda_fir_dma_rx_start(si); | 434 | pxa_irda_fir_dma_rx_start(si); |
| 435 | while ((ICSR1 & ICSR1_RNE) && i--) | ||
| 436 | (void)ICDR; | ||
| 420 | ICCR0 = ICCR0_ITR | ICCR0_RXE; | 437 | ICCR0 = ICCR0_ITR | ICCR0_RXE; |
| 421 | 438 | ||
| 439 | if (i < 0) | ||
| 440 | printk(KERN_ERR "pxa_ir: cannot clear Rx FIFO!\n"); | ||
| 441 | |||
| 422 | return IRQ_HANDLED; | 442 | return IRQ_HANDLED; |
| 423 | } | 443 | } |
| 424 | 444 | ||
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 1ee27c360a4b..8015a7c5b0c9 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
| @@ -1379,7 +1379,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
| 1379 | 1379 | ||
| 1380 | spin_lock_init(&mp->lock); | 1380 | spin_lock_init(&mp->lock); |
| 1381 | 1381 | ||
| 1382 | port_num = pd->port_number; | 1382 | port_num = mp->port_num = pd->port_number; |
| 1383 | 1383 | ||
| 1384 | /* set default config values */ | 1384 | /* set default config values */ |
| 1385 | eth_port_uc_addr_get(dev, dev->dev_addr); | 1385 | eth_port_uc_addr_get(dev, dev->dev_addr); |
| @@ -1411,8 +1411,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
| 1411 | duplex = pd->duplex; | 1411 | duplex = pd->duplex; |
| 1412 | speed = pd->speed; | 1412 | speed = pd->speed; |
| 1413 | 1413 | ||
| 1414 | mp->port_num = port_num; | ||
| 1415 | |||
| 1416 | /* Hook up MII support for ethtool */ | 1414 | /* Hook up MII support for ethtool */ |
| 1417 | mp->mii.dev = dev; | 1415 | mp->mii.dev = dev; |
| 1418 | mp->mii.mdio_read = mv643xx_mdio_read; | 1416 | mp->mii.mdio_read = mv643xx_mdio_read; |
| @@ -1516,9 +1514,23 @@ static int mv643xx_eth_shared_remove(struct platform_device *pdev) | |||
| 1516 | return 0; | 1514 | return 0; |
| 1517 | } | 1515 | } |
| 1518 | 1516 | ||
| 1517 | static void mv643xx_eth_shutdown(struct platform_device *pdev) | ||
| 1518 | { | ||
| 1519 | struct net_device *dev = platform_get_drvdata(pdev); | ||
| 1520 | struct mv643xx_private *mp = netdev_priv(dev); | ||
| 1521 | unsigned int port_num = mp->port_num; | ||
| 1522 | |||
| 1523 | /* Mask all interrupts on ethernet port */ | ||
| 1524 | mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num), 0); | ||
| 1525 | mv_read (MV643XX_ETH_INTERRUPT_MASK_REG(port_num)); | ||
| 1526 | |||
| 1527 | eth_port_reset(port_num); | ||
| 1528 | } | ||
| 1529 | |||
| 1519 | static struct platform_driver mv643xx_eth_driver = { | 1530 | static struct platform_driver mv643xx_eth_driver = { |
| 1520 | .probe = mv643xx_eth_probe, | 1531 | .probe = mv643xx_eth_probe, |
| 1521 | .remove = mv643xx_eth_remove, | 1532 | .remove = mv643xx_eth_remove, |
| 1533 | .shutdown = mv643xx_eth_shutdown, | ||
| 1522 | .driver = { | 1534 | .driver = { |
| 1523 | .name = MV643XX_ETH_NAME, | 1535 | .name = MV643XX_ETH_NAME, |
| 1524 | }, | 1536 | }, |
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c index ac02b3b60f92..f8efe0e70a6b 100644 --- a/drivers/net/myri10ge/myri10ge.c +++ b/drivers/net/myri10ge/myri10ge.c | |||
| @@ -71,7 +71,7 @@ | |||
| 71 | #include "myri10ge_mcp.h" | 71 | #include "myri10ge_mcp.h" |
| 72 | #include "myri10ge_mcp_gen_header.h" | 72 | #include "myri10ge_mcp_gen_header.h" |
| 73 | 73 | ||
| 74 | #define MYRI10GE_VERSION_STR "1.2.0" | 74 | #define MYRI10GE_VERSION_STR "1.3.0-1.233" |
| 75 | 75 | ||
| 76 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); | 76 | MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); |
| 77 | MODULE_AUTHOR("Maintainer: help@myri.com"); | 77 | MODULE_AUTHOR("Maintainer: help@myri.com"); |
| @@ -234,7 +234,7 @@ static int myri10ge_msi = 1; /* enable msi by default */ | |||
| 234 | module_param(myri10ge_msi, int, S_IRUGO | S_IWUSR); | 234 | module_param(myri10ge_msi, int, S_IRUGO | S_IWUSR); |
| 235 | MODULE_PARM_DESC(myri10ge_msi, "Enable Message Signalled Interrupts\n"); | 235 | MODULE_PARM_DESC(myri10ge_msi, "Enable Message Signalled Interrupts\n"); |
| 236 | 236 | ||
| 237 | static int myri10ge_intr_coal_delay = 25; | 237 | static int myri10ge_intr_coal_delay = 75; |
| 238 | module_param(myri10ge_intr_coal_delay, int, S_IRUGO); | 238 | module_param(myri10ge_intr_coal_delay, int, S_IRUGO); |
| 239 | MODULE_PARM_DESC(myri10ge_intr_coal_delay, "Interrupt coalescing delay\n"); | 239 | MODULE_PARM_DESC(myri10ge_intr_coal_delay, "Interrupt coalescing delay\n"); |
| 240 | 240 | ||
| @@ -279,7 +279,7 @@ static int myri10ge_fill_thresh = 256; | |||
| 279 | module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR); | 279 | module_param(myri10ge_fill_thresh, int, S_IRUGO | S_IWUSR); |
| 280 | MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n"); | 280 | MODULE_PARM_DESC(myri10ge_fill_thresh, "Number of empty rx slots allowed\n"); |
| 281 | 281 | ||
| 282 | static int myri10ge_wcfifo = 1; | 282 | static int myri10ge_wcfifo = 0; |
| 283 | module_param(myri10ge_wcfifo, int, S_IRUGO); | 283 | module_param(myri10ge_wcfifo, int, S_IRUGO); |
| 284 | MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n"); | 284 | MODULE_PARM_DESC(myri10ge_wcfifo, "Enable WC Fifo when WC is enabled\n"); |
| 285 | 285 | ||
| @@ -900,9 +900,7 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, | |||
| 900 | /* try to refill entire ring */ | 900 | /* try to refill entire ring */ |
| 901 | while (rx->fill_cnt != (rx->cnt + rx->mask + 1)) { | 901 | while (rx->fill_cnt != (rx->cnt + rx->mask + 1)) { |
| 902 | idx = rx->fill_cnt & rx->mask; | 902 | idx = rx->fill_cnt & rx->mask; |
| 903 | 903 | if (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE) { | |
| 904 | if ((bytes < MYRI10GE_ALLOC_SIZE / 2) && | ||
| 905 | (rx->page_offset + bytes <= MYRI10GE_ALLOC_SIZE)) { | ||
| 906 | /* we can use part of previous page */ | 904 | /* we can use part of previous page */ |
| 907 | get_page(rx->page); | 905 | get_page(rx->page); |
| 908 | } else { | 906 | } else { |
| @@ -933,6 +931,13 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, | |||
| 933 | 931 | ||
| 934 | /* start next packet on a cacheline boundary */ | 932 | /* start next packet on a cacheline boundary */ |
| 935 | rx->page_offset += SKB_DATA_ALIGN(bytes); | 933 | rx->page_offset += SKB_DATA_ALIGN(bytes); |
| 934 | |||
| 935 | #if MYRI10GE_ALLOC_SIZE > 4096 | ||
| 936 | /* don't cross a 4KB boundary */ | ||
| 937 | if ((rx->page_offset >> 12) != | ||
| 938 | ((rx->page_offset + bytes - 1) >> 12)) | ||
| 939 | rx->page_offset = (rx->page_offset + 4096) & ~4095; | ||
| 940 | #endif | ||
| 936 | rx->fill_cnt++; | 941 | rx->fill_cnt++; |
| 937 | 942 | ||
| 938 | /* copy 8 descriptors to the firmware at a time */ | 943 | /* copy 8 descriptors to the firmware at a time */ |
| @@ -2007,10 +2012,9 @@ again: | |||
| 2007 | mss = 0; | 2012 | mss = 0; |
| 2008 | max_segments = MXGEFW_MAX_SEND_DESC; | 2013 | max_segments = MXGEFW_MAX_SEND_DESC; |
| 2009 | 2014 | ||
| 2010 | if (skb->len > (dev->mtu + ETH_HLEN)) { | 2015 | if (skb_is_gso(skb)) { |
| 2011 | mss = skb_shinfo(skb)->gso_size; | 2016 | mss = skb_shinfo(skb)->gso_size; |
| 2012 | if (mss != 0) | 2017 | max_segments = MYRI10GE_MAX_SEND_DESC_TSO; |
| 2013 | max_segments = MYRI10GE_MAX_SEND_DESC_TSO; | ||
| 2014 | } | 2018 | } |
| 2015 | 2019 | ||
| 2016 | if ((unlikely(avail < max_segments))) { | 2020 | if ((unlikely(avail < max_segments))) { |
| @@ -2483,6 +2487,12 @@ static void myri10ge_enable_ecrc(struct myri10ge_priv *mgp) | |||
| 2483 | 2487 | ||
| 2484 | #define PCI_DEVICE_ID_INTEL_E5000_PCIE23 0x25f7 | 2488 | #define PCI_DEVICE_ID_INTEL_E5000_PCIE23 0x25f7 |
| 2485 | #define PCI_DEVICE_ID_INTEL_E5000_PCIE47 0x25fa | 2489 | #define PCI_DEVICE_ID_INTEL_E5000_PCIE47 0x25fa |
| 2490 | #define PCI_DEVICE_ID_INTEL_6300ESB_PCIEE1 0x3510 | ||
| 2491 | #define PCI_DEVICE_ID_INTEL_6300ESB_PCIEE4 0x351b | ||
| 2492 | #define PCI_DEVICE_ID_INTEL_E3000_PCIE 0x2779 | ||
| 2493 | #define PCI_DEVICE_ID_INTEL_E3010_PCIE 0x277a | ||
| 2494 | #define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST 0x140 | ||
| 2495 | #define PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST 0x142 | ||
| 2486 | 2496 | ||
| 2487 | static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | 2497 | static void myri10ge_select_firmware(struct myri10ge_priv *mgp) |
| 2488 | { | 2498 | { |
| @@ -2514,6 +2524,24 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp) | |||
| 2514 | ((bridge->vendor == PCI_VENDOR_ID_SERVERWORKS | 2524 | ((bridge->vendor == PCI_VENDOR_ID_SERVERWORKS |
| 2515 | && bridge->device == | 2525 | && bridge->device == |
| 2516 | PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE) | 2526 | PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE) |
| 2527 | /* ServerWorks HT2100 */ | ||
| 2528 | || (bridge->vendor == PCI_VENDOR_ID_SERVERWORKS | ||
| 2529 | && bridge->device >= | ||
| 2530 | PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_FIRST | ||
| 2531 | && bridge->device <= | ||
| 2532 | PCI_DEVICE_ID_SERVERWORKS_HT2100_PCIE_LAST) | ||
| 2533 | /* All Intel E3000/E3010 PCIE ports */ | ||
| 2534 | || (bridge->vendor == PCI_VENDOR_ID_INTEL | ||
| 2535 | && (bridge->device == | ||
| 2536 | PCI_DEVICE_ID_INTEL_E3000_PCIE | ||
| 2537 | || bridge->device == | ||
| 2538 | PCI_DEVICE_ID_INTEL_E3010_PCIE)) | ||
| 2539 | /* All Intel 6310/6311/6321ESB PCIE ports */ | ||
| 2540 | || (bridge->vendor == PCI_VENDOR_ID_INTEL | ||
| 2541 | && bridge->device >= | ||
| 2542 | PCI_DEVICE_ID_INTEL_6300ESB_PCIEE1 | ||
| 2543 | && bridge->device <= | ||
| 2544 | PCI_DEVICE_ID_INTEL_6300ESB_PCIEE4) | ||
| 2517 | /* All Intel E5000 PCIE ports */ | 2545 | /* All Intel E5000 PCIE ports */ |
| 2518 | || (bridge->vendor == PCI_VENDOR_ID_INTEL | 2546 | || (bridge->vendor == PCI_VENDOR_ID_INTEL |
| 2519 | && bridge->device >= | 2547 | && bridge->device >= |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index c6172a77a6d7..349b96a3ec4c 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
| @@ -1712,7 +1712,7 @@ static void init_registers(struct net_device *dev) | |||
| 1712 | 1712 | ||
| 1713 | /* Enable interrupts by setting the interrupt mask. */ | 1713 | /* Enable interrupts by setting the interrupt mask. */ |
| 1714 | writel(DEFAULT_INTR, ioaddr + IntrMask); | 1714 | writel(DEFAULT_INTR, ioaddr + IntrMask); |
| 1715 | writel(1, ioaddr + IntrEnable); | 1715 | natsemi_irq_enable(dev); |
| 1716 | 1716 | ||
| 1717 | writel(RxOn | TxOn, ioaddr + ChipCmd); | 1717 | writel(RxOn | TxOn, ioaddr + ChipCmd); |
| 1718 | writel(StatsClear, ioaddr + StatsCtrl); /* Clear Stats */ | 1718 | writel(StatsClear, ioaddr + StatsCtrl); /* Clear Stats */ |
| @@ -2119,28 +2119,35 @@ static irqreturn_t intr_handler(int irq, void *dev_instance) | |||
| 2119 | struct netdev_private *np = netdev_priv(dev); | 2119 | struct netdev_private *np = netdev_priv(dev); |
| 2120 | void __iomem * ioaddr = ns_ioaddr(dev); | 2120 | void __iomem * ioaddr = ns_ioaddr(dev); |
| 2121 | 2121 | ||
| 2122 | if (np->hands_off) | 2122 | /* Reading IntrStatus automatically acknowledges so don't do |
| 2123 | * that while interrupts are disabled, (for example, while a | ||
| 2124 | * poll is scheduled). */ | ||
| 2125 | if (np->hands_off || !readl(ioaddr + IntrEnable)) | ||
| 2123 | return IRQ_NONE; | 2126 | return IRQ_NONE; |
| 2124 | 2127 | ||
| 2125 | /* Reading automatically acknowledges. */ | ||
| 2126 | np->intr_status = readl(ioaddr + IntrStatus); | 2128 | np->intr_status = readl(ioaddr + IntrStatus); |
| 2127 | 2129 | ||
| 2130 | if (!np->intr_status) | ||
| 2131 | return IRQ_NONE; | ||
| 2132 | |||
| 2128 | if (netif_msg_intr(np)) | 2133 | if (netif_msg_intr(np)) |
| 2129 | printk(KERN_DEBUG | 2134 | printk(KERN_DEBUG |
| 2130 | "%s: Interrupt, status %#08x, mask %#08x.\n", | 2135 | "%s: Interrupt, status %#08x, mask %#08x.\n", |
| 2131 | dev->name, np->intr_status, | 2136 | dev->name, np->intr_status, |
| 2132 | readl(ioaddr + IntrMask)); | 2137 | readl(ioaddr + IntrMask)); |
| 2133 | 2138 | ||
| 2134 | if (!np->intr_status) | ||
| 2135 | return IRQ_NONE; | ||
| 2136 | |||
| 2137 | prefetch(&np->rx_skbuff[np->cur_rx % RX_RING_SIZE]); | 2139 | prefetch(&np->rx_skbuff[np->cur_rx % RX_RING_SIZE]); |
| 2138 | 2140 | ||
| 2139 | if (netif_rx_schedule_prep(dev)) { | 2141 | if (netif_rx_schedule_prep(dev)) { |
| 2140 | /* Disable interrupts and register for poll */ | 2142 | /* Disable interrupts and register for poll */ |
| 2141 | natsemi_irq_disable(dev); | 2143 | natsemi_irq_disable(dev); |
| 2142 | __netif_rx_schedule(dev); | 2144 | __netif_rx_schedule(dev); |
| 2143 | } | 2145 | } else |
| 2146 | printk(KERN_WARNING | ||
| 2147 | "%s: Ignoring interrupt, status %#08x, mask %#08x.\n", | ||
| 2148 | dev->name, np->intr_status, | ||
| 2149 | readl(ioaddr + IntrMask)); | ||
| 2150 | |||
| 2144 | return IRQ_HANDLED; | 2151 | return IRQ_HANDLED; |
| 2145 | } | 2152 | } |
| 2146 | 2153 | ||
| @@ -2156,6 +2163,20 @@ static int natsemi_poll(struct net_device *dev, int *budget) | |||
| 2156 | int work_done = 0; | 2163 | int work_done = 0; |
| 2157 | 2164 | ||
| 2158 | do { | 2165 | do { |
| 2166 | if (netif_msg_intr(np)) | ||
| 2167 | printk(KERN_DEBUG | ||
| 2168 | "%s: Poll, status %#08x, mask %#08x.\n", | ||
| 2169 | dev->name, np->intr_status, | ||
| 2170 | readl(ioaddr + IntrMask)); | ||
| 2171 | |||
| 2172 | /* netdev_rx() may read IntrStatus again if the RX state | ||
| 2173 | * machine falls over so do it first. */ | ||
| 2174 | if (np->intr_status & | ||
| 2175 | (IntrRxDone | IntrRxIntr | RxStatusFIFOOver | | ||
| 2176 | IntrRxErr | IntrRxOverrun)) { | ||
| 2177 | netdev_rx(dev, &work_done, work_to_do); | ||
| 2178 | } | ||
| 2179 | |||
| 2159 | if (np->intr_status & | 2180 | if (np->intr_status & |
| 2160 | (IntrTxDone | IntrTxIntr | IntrTxIdle | IntrTxErr)) { | 2181 | (IntrTxDone | IntrTxIntr | IntrTxIdle | IntrTxErr)) { |
| 2161 | spin_lock(&np->lock); | 2182 | spin_lock(&np->lock); |
| @@ -2167,12 +2188,6 @@ static int natsemi_poll(struct net_device *dev, int *budget) | |||
| 2167 | if (np->intr_status & IntrAbnormalSummary) | 2188 | if (np->intr_status & IntrAbnormalSummary) |
| 2168 | netdev_error(dev, np->intr_status); | 2189 | netdev_error(dev, np->intr_status); |
| 2169 | 2190 | ||
| 2170 | if (np->intr_status & | ||
| 2171 | (IntrRxDone | IntrRxIntr | RxStatusFIFOOver | | ||
| 2172 | IntrRxErr | IntrRxOverrun)) { | ||
| 2173 | netdev_rx(dev, &work_done, work_to_do); | ||
| 2174 | } | ||
| 2175 | |||
| 2176 | *budget -= work_done; | 2191 | *budget -= work_done; |
| 2177 | dev->quota -= work_done; | 2192 | dev->quota -= work_done; |
| 2178 | 2193 | ||
| @@ -2399,19 +2414,8 @@ static struct net_device_stats *get_stats(struct net_device *dev) | |||
| 2399 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2414 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 2400 | static void natsemi_poll_controller(struct net_device *dev) | 2415 | static void natsemi_poll_controller(struct net_device *dev) |
| 2401 | { | 2416 | { |
| 2402 | struct netdev_private *np = netdev_priv(dev); | ||
| 2403 | |||
| 2404 | disable_irq(dev->irq); | 2417 | disable_irq(dev->irq); |
| 2405 | 2418 | intr_handler(dev->irq, dev); | |
| 2406 | /* | ||
| 2407 | * A real interrupt might have already reached us at this point | ||
| 2408 | * but NAPI might still haven't called us back. As the interrupt | ||
| 2409 | * status register is cleared by reading, we should prevent an | ||
| 2410 | * interrupt loss in this case... | ||
| 2411 | */ | ||
| 2412 | if (!np->intr_status) | ||
| 2413 | intr_handler(dev->irq, dev); | ||
| 2414 | |||
| 2415 | enable_irq(dev->irq); | 2419 | enable_irq(dev->irq); |
| 2416 | } | 2420 | } |
| 2417 | #endif | 2421 | #endif |
| @@ -3071,7 +3075,7 @@ static void enable_wol_mode(struct net_device *dev, int enable_intr) | |||
| 3071 | * Could be used to send a netlink message. | 3075 | * Could be used to send a netlink message. |
| 3072 | */ | 3076 | */ |
| 3073 | writel(WOLPkt | LinkChange, ioaddr + IntrMask); | 3077 | writel(WOLPkt | LinkChange, ioaddr + IntrMask); |
| 3074 | writel(1, ioaddr + IntrEnable); | 3078 | natsemi_irq_enable(dev); |
| 3075 | } | 3079 | } |
| 3076 | } | 3080 | } |
| 3077 | 3081 | ||
| @@ -3202,7 +3206,7 @@ static int natsemi_suspend (struct pci_dev *pdev, pm_message_t state) | |||
| 3202 | disable_irq(dev->irq); | 3206 | disable_irq(dev->irq); |
| 3203 | spin_lock_irq(&np->lock); | 3207 | spin_lock_irq(&np->lock); |
| 3204 | 3208 | ||
| 3205 | writel(0, ioaddr + IntrEnable); | 3209 | natsemi_irq_disable(dev); |
| 3206 | np->hands_off = 1; | 3210 | np->hands_off = 1; |
| 3207 | natsemi_stop_rxtx(dev); | 3211 | natsemi_stop_rxtx(dev); |
| 3208 | netif_stop_queue(dev); | 3212 | netif_stop_queue(dev); |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 81742e4e5610..dd8ce35332fe 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
| @@ -232,6 +232,7 @@ enum { | |||
| 232 | #define MPORT_SINGLE_FUNCTION_MODE 0x1111 | 232 | #define MPORT_SINGLE_FUNCTION_MODE 0x1111 |
| 233 | 233 | ||
| 234 | extern unsigned long long netxen_dma_mask; | 234 | extern unsigned long long netxen_dma_mask; |
| 235 | extern unsigned long last_schedule_time; | ||
| 235 | 236 | ||
| 236 | /* | 237 | /* |
| 237 | * NetXen host-peg signal message structure | 238 | * NetXen host-peg signal message structure |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 986ef98db229..ee1b5a24cbe7 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
| @@ -462,6 +462,7 @@ netxen_nic_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
| 462 | } | 462 | } |
| 463 | printk(KERN_INFO "%s: flash unlocked. \n", | 463 | printk(KERN_INFO "%s: flash unlocked. \n", |
| 464 | netxen_nic_driver_name); | 464 | netxen_nic_driver_name); |
| 465 | last_schedule_time = jiffies; | ||
| 465 | ret = netxen_flash_erase_secondary(adapter); | 466 | ret = netxen_flash_erase_secondary(adapter); |
| 466 | if (ret != FLASH_SUCCESS) { | 467 | if (ret != FLASH_SUCCESS) { |
| 467 | printk(KERN_ERR "%s: Flash erase failed.\n", | 468 | printk(KERN_ERR "%s: Flash erase failed.\n", |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 1be55702557d..6537574a9cda 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
| @@ -822,7 +822,10 @@ int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu) | |||
| 822 | { | 822 | { |
| 823 | struct netxen_adapter *adapter = port->adapter; | 823 | struct netxen_adapter *adapter = port->adapter; |
| 824 | new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE; | 824 | new_mtu += NETXEN_NIU_HDRSIZE + NETXEN_NIU_TLRSIZE; |
| 825 | netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, new_mtu); | 825 | if (port->portnum == 0) |
| 826 | netxen_nic_write_w0(adapter, NETXEN_NIU_XGE_MAX_FRAME_SIZE, new_mtu); | ||
| 827 | else if (port->portnum == 1) | ||
| 828 | netxen_nic_write_w0(adapter, NETXEN_NIU_XG1_MAX_FRAME_SIZE, new_mtu); | ||
| 826 | return 0; | 829 | return 0; |
| 827 | } | 830 | } |
| 828 | 831 | ||
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 586d32b676af..eff965dc5fff 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
| @@ -42,6 +42,8 @@ struct crb_addr_pair { | |||
| 42 | u32 data; | 42 | u32 data; |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | unsigned long last_schedule_time; | ||
| 46 | |||
| 45 | #define NETXEN_MAX_CRB_XFORM 60 | 47 | #define NETXEN_MAX_CRB_XFORM 60 |
| 46 | static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM]; | 48 | static unsigned int crb_addr_xform[NETXEN_MAX_CRB_XFORM]; |
| 47 | #define NETXEN_ADDR_ERROR (0xffffffff) | 49 | #define NETXEN_ADDR_ERROR (0xffffffff) |
| @@ -404,9 +406,14 @@ static inline int do_rom_fast_write(struct netxen_adapter *adapter, int addr, | |||
| 404 | static inline int | 406 | static inline int |
| 405 | do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp) | 407 | do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp) |
| 406 | { | 408 | { |
| 409 | if (jiffies > (last_schedule_time + (8 * HZ))) { | ||
| 410 | last_schedule_time = jiffies; | ||
| 411 | schedule(); | ||
| 412 | } | ||
| 413 | |||
| 407 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); | 414 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); |
| 408 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | 415 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); |
| 409 | udelay(70); /* prevent bursting on CRB */ | 416 | udelay(100); /* prevent bursting on CRB */ |
| 410 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 417 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
| 411 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); | 418 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); |
| 412 | if (netxen_wait_rom_done(adapter)) { | 419 | if (netxen_wait_rom_done(adapter)) { |
| @@ -415,7 +422,7 @@ do_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp) | |||
| 415 | } | 422 | } |
| 416 | /* reset abyte_cnt and dummy_byte_cnt */ | 423 | /* reset abyte_cnt and dummy_byte_cnt */ |
| 417 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); | 424 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); |
| 418 | udelay(70); /* prevent bursting on CRB */ | 425 | udelay(100); /* prevent bursting on CRB */ |
| 419 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 426 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
| 420 | 427 | ||
| 421 | *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); | 428 | *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); |
| @@ -431,6 +438,7 @@ do_rom_fast_read_words(struct netxen_adapter *adapter, int addr, | |||
| 431 | 438 | ||
| 432 | for (addridx = addr; addridx < (addr + size); addridx += 4) { | 439 | for (addridx = addr; addridx < (addr + size); addridx += 4) { |
| 433 | ret = do_rom_fast_read(adapter, addridx, (int *)bytes); | 440 | ret = do_rom_fast_read(adapter, addridx, (int *)bytes); |
| 441 | *(int *)bytes = cpu_to_le32(*(int *)bytes); | ||
| 434 | if (ret != 0) | 442 | if (ret != 0) |
| 435 | break; | 443 | break; |
| 436 | bytes += 4; | 444 | bytes += 4; |
| @@ -490,7 +498,7 @@ static inline int do_rom_fast_write_words(struct netxen_adapter *adapter, | |||
| 490 | int timeout = 0; | 498 | int timeout = 0; |
| 491 | int data; | 499 | int data; |
| 492 | 500 | ||
| 493 | data = *(u32*)bytes; | 501 | data = le32_to_cpu((*(u32*)bytes)); |
| 494 | 502 | ||
| 495 | ret = do_rom_fast_write(adapter, addridx, data); | 503 | ret = do_rom_fast_write(adapter, addridx, data); |
| 496 | if (ret < 0) | 504 | if (ret < 0) |
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c index 00ca0fdb837b..6ca4e4fa6b88 100644 --- a/drivers/net/pci-skeleton.c +++ b/drivers/net/pci-skeleton.c | |||
| @@ -710,8 +710,8 @@ match: | |||
| 710 | tp->chipset, | 710 | tp->chipset, |
| 711 | rtl_chip_info[tp->chipset].name); | 711 | rtl_chip_info[tp->chipset].name); |
| 712 | 712 | ||
| 713 | i = register_netdev (dev); | 713 | rc = register_netdev (dev); |
| 714 | if (i) | 714 | if (rc) |
| 715 | goto err_out_unmap; | 715 | goto err_out_unmap; |
| 716 | 716 | ||
| 717 | DPRINTK ("EXIT, returning 0\n"); | 717 | DPRINTK ("EXIT, returning 0\n"); |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index a956a51d284f..1060154ae750 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
| @@ -138,7 +138,7 @@ static const struct ethtool_ops netdev_ethtool_ops = { | |||
| 138 | 138 | ||
| 139 | ======================================================================*/ | 139 | ======================================================================*/ |
| 140 | 140 | ||
| 141 | static int ibmtr_attach(struct pcmcia_device *link) | 141 | static int __devinit ibmtr_attach(struct pcmcia_device *link) |
| 142 | { | 142 | { |
| 143 | ibmtr_dev_t *info; | 143 | ibmtr_dev_t *info; |
| 144 | struct net_device *dev; | 144 | struct net_device *dev; |
| @@ -217,7 +217,7 @@ static void ibmtr_detach(struct pcmcia_device *link) | |||
| 217 | #define CS_CHECK(fn, ret) \ | 217 | #define CS_CHECK(fn, ret) \ |
| 218 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | 218 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) |
| 219 | 219 | ||
| 220 | static int ibmtr_config(struct pcmcia_device *link) | 220 | static int __devinit ibmtr_config(struct pcmcia_device *link) |
| 221 | { | 221 | { |
| 222 | ibmtr_dev_t *info = link->priv; | 222 | ibmtr_dev_t *info = link->priv; |
| 223 | struct net_device *dev = info->dev; | 223 | struct net_device *dev = info->dev; |
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index 933e2f3c77aa..caabbc408c34 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
| @@ -802,9 +802,9 @@ process_input_packet(struct asyncppp *ap) | |||
| 802 | 802 | ||
| 803 | /* check for address/control and protocol compression */ | 803 | /* check for address/control and protocol compression */ |
| 804 | p = skb->data; | 804 | p = skb->data; |
| 805 | if (p[0] == PPP_ALLSTATIONS && p[1] == PPP_UI) { | 805 | if (p[0] == PPP_ALLSTATIONS) { |
| 806 | /* chop off address/control */ | 806 | /* chop off address/control */ |
| 807 | if (skb->len < 3) | 807 | if (p[1] != PPP_UI || skb->len < 3) |
| 808 | goto err; | 808 | goto err; |
| 809 | p = skb_pull(skb, 2); | 809 | p = skb_pull(skb, 2); |
| 810 | } | 810 | } |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 11b575f89856..ef58e4128782 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
| @@ -2544,6 +2544,9 @@ static void ppp_destroy_interface(struct ppp *ppp) | |||
| 2544 | ppp->active_filter = NULL; | 2544 | ppp->active_filter = NULL; |
| 2545 | #endif /* CONFIG_PPP_FILTER */ | 2545 | #endif /* CONFIG_PPP_FILTER */ |
| 2546 | 2546 | ||
| 2547 | if (ppp->xmit_pending) | ||
| 2548 | kfree_skb(ppp->xmit_pending); | ||
| 2549 | |||
| 2547 | kfree(ppp); | 2550 | kfree(ppp); |
| 2548 | } | 2551 | } |
| 2549 | 2552 | ||
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index d3f65dab306c..a8246eb2f8d9 100755 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c | |||
| @@ -1691,6 +1691,27 @@ static int ql_populate_free_queue(struct ql3_adapter *qdev) | |||
| 1691 | /* | 1691 | /* |
| 1692 | * Caller holds hw_lock. | 1692 | * Caller holds hw_lock. |
| 1693 | */ | 1693 | */ |
| 1694 | static void ql_update_small_bufq_prod_index(struct ql3_adapter *qdev) | ||
| 1695 | { | ||
| 1696 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
| 1697 | if (qdev->small_buf_release_cnt >= 16) { | ||
| 1698 | while (qdev->small_buf_release_cnt >= 16) { | ||
| 1699 | qdev->small_buf_q_producer_index++; | ||
| 1700 | |||
| 1701 | if (qdev->small_buf_q_producer_index == | ||
| 1702 | NUM_SBUFQ_ENTRIES) | ||
| 1703 | qdev->small_buf_q_producer_index = 0; | ||
| 1704 | qdev->small_buf_release_cnt -= 8; | ||
| 1705 | } | ||
| 1706 | wmb(); | ||
| 1707 | writel(qdev->small_buf_q_producer_index, | ||
| 1708 | &port_regs->CommonRegs.rxSmallQProducerIndex); | ||
| 1709 | } | ||
| 1710 | } | ||
| 1711 | |||
| 1712 | /* | ||
| 1713 | * Caller holds hw_lock. | ||
| 1714 | */ | ||
| 1694 | static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev) | 1715 | static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev) |
| 1695 | { | 1716 | { |
| 1696 | struct bufq_addr_element *lrg_buf_q_ele; | 1717 | struct bufq_addr_element *lrg_buf_q_ele; |
| @@ -1732,13 +1753,10 @@ static void ql_update_lrg_bufq_prod_index(struct ql3_adapter *qdev) | |||
| 1732 | lrg_buf_q_ele = qdev->lrg_buf_q_virt_addr; | 1753 | lrg_buf_q_ele = qdev->lrg_buf_q_virt_addr; |
| 1733 | } | 1754 | } |
| 1734 | } | 1755 | } |
| 1735 | 1756 | wmb(); | |
| 1736 | qdev->lrg_buf_next_free = lrg_buf_q_ele; | 1757 | qdev->lrg_buf_next_free = lrg_buf_q_ele; |
| 1737 | 1758 | writel(qdev->lrg_buf_q_producer_index, | |
| 1738 | ql_write_common_reg(qdev, | 1759 | &port_regs->CommonRegs.rxLargeQProducerIndex); |
| 1739 | &port_regs->CommonRegs. | ||
| 1740 | rxLargeQProducerIndex, | ||
| 1741 | qdev->lrg_buf_q_producer_index); | ||
| 1742 | } | 1760 | } |
| 1743 | } | 1761 | } |
| 1744 | 1762 | ||
| @@ -1915,17 +1933,18 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev, | |||
| 1915 | u16 checksum = le16_to_cpu(ib_ip_rsp_ptr->checksum); | 1933 | u16 checksum = le16_to_cpu(ib_ip_rsp_ptr->checksum); |
| 1916 | if (checksum & | 1934 | if (checksum & |
| 1917 | (IB_IP_IOCB_RSP_3032_ICE | | 1935 | (IB_IP_IOCB_RSP_3032_ICE | |
| 1918 | IB_IP_IOCB_RSP_3032_CE | | 1936 | IB_IP_IOCB_RSP_3032_CE)) { |
| 1919 | IB_IP_IOCB_RSP_3032_NUC)) { | ||
| 1920 | printk(KERN_ERR | 1937 | printk(KERN_ERR |
| 1921 | "%s: Bad checksum for this %s packet, checksum = %x.\n", | 1938 | "%s: Bad checksum for this %s packet, checksum = %x.\n", |
| 1922 | __func__, | 1939 | __func__, |
| 1923 | ((checksum & | 1940 | ((checksum & |
| 1924 | IB_IP_IOCB_RSP_3032_TCP) ? "TCP" : | 1941 | IB_IP_IOCB_RSP_3032_TCP) ? "TCP" : |
| 1925 | "UDP"),checksum); | 1942 | "UDP"),checksum); |
| 1926 | } else if (checksum & IB_IP_IOCB_RSP_3032_TCP) { | 1943 | } else if ((checksum & IB_IP_IOCB_RSP_3032_TCP) || |
| 1944 | (checksum & IB_IP_IOCB_RSP_3032_UDP && | ||
| 1945 | !(checksum & IB_IP_IOCB_RSP_3032_NUC))) { | ||
| 1927 | skb2->ip_summed = CHECKSUM_UNNECESSARY; | 1946 | skb2->ip_summed = CHECKSUM_UNNECESSARY; |
| 1928 | } | 1947 | } |
| 1929 | } | 1948 | } |
| 1930 | skb2->dev = qdev->ndev; | 1949 | skb2->dev = qdev->ndev; |
| 1931 | skb2->protocol = eth_type_trans(skb2, qdev->ndev); | 1950 | skb2->protocol = eth_type_trans(skb2, qdev->ndev); |
| @@ -1944,16 +1963,12 @@ static void ql_process_macip_rx_intr(struct ql3_adapter *qdev, | |||
| 1944 | static int ql_tx_rx_clean(struct ql3_adapter *qdev, | 1963 | static int ql_tx_rx_clean(struct ql3_adapter *qdev, |
| 1945 | int *tx_cleaned, int *rx_cleaned, int work_to_do) | 1964 | int *tx_cleaned, int *rx_cleaned, int work_to_do) |
| 1946 | { | 1965 | { |
| 1947 | struct ql3xxx_port_registers __iomem *port_regs = qdev->mem_map_registers; | ||
| 1948 | struct net_rsp_iocb *net_rsp; | 1966 | struct net_rsp_iocb *net_rsp; |
| 1949 | struct net_device *ndev = qdev->ndev; | 1967 | struct net_device *ndev = qdev->ndev; |
| 1950 | unsigned long hw_flags; | ||
| 1951 | int work_done = 0; | 1968 | int work_done = 0; |
| 1952 | 1969 | ||
| 1953 | u32 rsp_producer_index = le32_to_cpu(*(qdev->prsp_producer_index)); | ||
| 1954 | |||
| 1955 | /* While there are entries in the completion queue. */ | 1970 | /* While there are entries in the completion queue. */ |
| 1956 | while ((rsp_producer_index != | 1971 | while ((le32_to_cpu(*(qdev->prsp_producer_index)) != |
| 1957 | qdev->rsp_consumer_index) && (work_done < work_to_do)) { | 1972 | qdev->rsp_consumer_index) && (work_done < work_to_do)) { |
| 1958 | 1973 | ||
| 1959 | net_rsp = qdev->rsp_current; | 1974 | net_rsp = qdev->rsp_current; |
| @@ -2009,33 +2024,7 @@ static int ql_tx_rx_clean(struct ql3_adapter *qdev, | |||
| 2009 | work_done = *tx_cleaned + *rx_cleaned; | 2024 | work_done = *tx_cleaned + *rx_cleaned; |
| 2010 | } | 2025 | } |
| 2011 | 2026 | ||
| 2012 | if(work_done) { | 2027 | return work_done; |
| 2013 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | ||
| 2014 | |||
| 2015 | ql_update_lrg_bufq_prod_index(qdev); | ||
| 2016 | |||
| 2017 | if (qdev->small_buf_release_cnt >= 16) { | ||
| 2018 | while (qdev->small_buf_release_cnt >= 16) { | ||
| 2019 | qdev->small_buf_q_producer_index++; | ||
| 2020 | |||
| 2021 | if (qdev->small_buf_q_producer_index == | ||
| 2022 | NUM_SBUFQ_ENTRIES) | ||
| 2023 | qdev->small_buf_q_producer_index = 0; | ||
| 2024 | qdev->small_buf_release_cnt -= 8; | ||
| 2025 | } | ||
| 2026 | |||
| 2027 | wmb(); | ||
| 2028 | ql_write_common_reg(qdev, | ||
| 2029 | &port_regs->CommonRegs. | ||
| 2030 | rxSmallQProducerIndex, | ||
| 2031 | qdev->small_buf_q_producer_index); | ||
| 2032 | |||
| 2033 | } | ||
| 2034 | |||
| 2035 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | ||
| 2036 | } | ||
| 2037 | |||
| 2038 | return *tx_cleaned + *rx_cleaned; | ||
| 2039 | } | 2028 | } |
| 2040 | 2029 | ||
| 2041 | static int ql_poll(struct net_device *ndev, int *budget) | 2030 | static int ql_poll(struct net_device *ndev, int *budget) |
| @@ -2059,9 +2048,10 @@ quit_polling: | |||
| 2059 | netif_rx_complete(ndev); | 2048 | netif_rx_complete(ndev); |
| 2060 | 2049 | ||
| 2061 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); | 2050 | spin_lock_irqsave(&qdev->hw_lock, hw_flags); |
| 2062 | ql_write_common_reg(qdev, | 2051 | ql_update_small_bufq_prod_index(qdev); |
| 2063 | &port_regs->CommonRegs.rspQConsumerIndex, | 2052 | ql_update_lrg_bufq_prod_index(qdev); |
| 2064 | qdev->rsp_consumer_index); | 2053 | writel(qdev->rsp_consumer_index, |
| 2054 | &port_regs->CommonRegs.rspQConsumerIndex); | ||
| 2065 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); | 2055 | spin_unlock_irqrestore(&qdev->hw_lock, hw_flags); |
| 2066 | 2056 | ||
| 2067 | ql_enable_interrupts(qdev); | 2057 | ql_enable_interrupts(qdev); |
| @@ -2217,12 +2207,7 @@ static int ql_send_map(struct ql3_adapter *qdev, | |||
| 2217 | int seg_cnt, seg = 0; | 2207 | int seg_cnt, seg = 0; |
| 2218 | int frag_cnt = (int)skb_shinfo(skb)->nr_frags; | 2208 | int frag_cnt = (int)skb_shinfo(skb)->nr_frags; |
| 2219 | 2209 | ||
| 2220 | seg_cnt = tx_cb->seg_count = ql_get_seg_count(qdev, | 2210 | seg_cnt = tx_cb->seg_count; |
| 2221 | (skb_shinfo(skb)->nr_frags)); | ||
| 2222 | if(seg_cnt == -1) { | ||
| 2223 | printk(KERN_ERR PFX"%s: invalid segment count!\n",__func__); | ||
| 2224 | return NETDEV_TX_BUSY; | ||
| 2225 | } | ||
| 2226 | /* | 2211 | /* |
| 2227 | * Map the skb buffer first. | 2212 | * Map the skb buffer first. |
| 2228 | */ | 2213 | */ |
| @@ -2278,7 +2263,7 @@ static int ql_send_map(struct ql3_adapter *qdev, | |||
| 2278 | pci_unmap_addr_set(&tx_cb->map[seg], mapaddr, | 2263 | pci_unmap_addr_set(&tx_cb->map[seg], mapaddr, |
| 2279 | map); | 2264 | map); |
| 2280 | pci_unmap_len_set(&tx_cb->map[seg], maplen, | 2265 | pci_unmap_len_set(&tx_cb->map[seg], maplen, |
| 2281 | len); | 2266 | sizeof(struct oal)); |
| 2282 | oal_entry = (struct oal_entry *)oal; | 2267 | oal_entry = (struct oal_entry *)oal; |
| 2283 | oal++; | 2268 | oal++; |
| 2284 | seg++; | 2269 | seg++; |
| @@ -2380,6 +2365,7 @@ static int ql3xxx_send(struct sk_buff *skb, struct net_device *ndev) | |||
| 2380 | } | 2365 | } |
| 2381 | 2366 | ||
| 2382 | mac_iocb_ptr = tx_cb->queue_entry; | 2367 | mac_iocb_ptr = tx_cb->queue_entry; |
| 2368 | memset((void *)mac_iocb_ptr, 0, sizeof(struct ob_mac_iocb_req)); | ||
| 2383 | mac_iocb_ptr->opcode = qdev->mac_ob_opcode; | 2369 | mac_iocb_ptr->opcode = qdev->mac_ob_opcode; |
| 2384 | mac_iocb_ptr->flags = OB_MAC_IOCB_REQ_X; | 2370 | mac_iocb_ptr->flags = OB_MAC_IOCB_REQ_X; |
| 2385 | mac_iocb_ptr->flags |= qdev->mb_bit_mask; | 2371 | mac_iocb_ptr->flags |= qdev->mb_bit_mask; |
| @@ -3054,15 +3040,6 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev) | |||
| 3054 | goto out; | 3040 | goto out; |
| 3055 | } | 3041 | } |
| 3056 | 3042 | ||
| 3057 | if (qdev->mac_index) | ||
| 3058 | ql_write_page0_reg(qdev, | ||
| 3059 | &port_regs->mac1MaxFrameLengthReg, | ||
| 3060 | qdev->max_frame_size); | ||
| 3061 | else | ||
| 3062 | ql_write_page0_reg(qdev, | ||
| 3063 | &port_regs->mac0MaxFrameLengthReg, | ||
| 3064 | qdev->max_frame_size); | ||
| 3065 | |||
| 3066 | value = qdev->nvram_data.tcpMaxWindowSize; | 3043 | value = qdev->nvram_data.tcpMaxWindowSize; |
| 3067 | ql_write_page0_reg(qdev, &port_regs->tcpMaxWindow, value); | 3044 | ql_write_page0_reg(qdev, &port_regs->tcpMaxWindow, value); |
| 3068 | 3045 | ||
| @@ -3082,6 +3059,14 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev) | |||
| 3082 | ql_sem_unlock(qdev, QL_FLASH_SEM_MASK); | 3059 | ql_sem_unlock(qdev, QL_FLASH_SEM_MASK); |
| 3083 | } | 3060 | } |
| 3084 | 3061 | ||
| 3062 | if (qdev->mac_index) | ||
| 3063 | ql_write_page0_reg(qdev, | ||
| 3064 | &port_regs->mac1MaxFrameLengthReg, | ||
| 3065 | qdev->max_frame_size); | ||
| 3066 | else | ||
| 3067 | ql_write_page0_reg(qdev, | ||
| 3068 | &port_regs->mac0MaxFrameLengthReg, | ||
| 3069 | qdev->max_frame_size); | ||
| 3085 | 3070 | ||
| 3086 | if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, | 3071 | if(ql_sem_spinlock(qdev, QL_PHY_GIO_SEM_MASK, |
| 3087 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * | 3072 | (QL_RESOURCE_BITS_BASE_CODE | (qdev->mac_index) * |
| @@ -3152,7 +3137,8 @@ static int ql_adapter_initialize(struct ql3_adapter *qdev) | |||
| 3152 | if (qdev->device_id == QL3032_DEVICE_ID) { | 3137 | if (qdev->device_id == QL3032_DEVICE_ID) { |
| 3153 | value = | 3138 | value = |
| 3154 | (QL3032_PORT_CONTROL_EF | QL3032_PORT_CONTROL_KIE | | 3139 | (QL3032_PORT_CONTROL_EF | QL3032_PORT_CONTROL_KIE | |
| 3155 | QL3032_PORT_CONTROL_EIv6 | QL3032_PORT_CONTROL_EIv4); | 3140 | QL3032_PORT_CONTROL_EIv6 | QL3032_PORT_CONTROL_EIv4 | |
| 3141 | QL3032_PORT_CONTROL_ET); | ||
| 3156 | ql_write_page0_reg(qdev, &port_regs->functionControl, | 3142 | ql_write_page0_reg(qdev, &port_regs->functionControl, |
| 3157 | ((value << 16) | value)); | 3143 | ((value << 16) | value)); |
| 3158 | } else { | 3144 | } else { |
diff --git a/drivers/net/qla3xxx.h b/drivers/net/qla3xxx.h index 34cd6580fd07..0203f88f0544 100755 --- a/drivers/net/qla3xxx.h +++ b/drivers/net/qla3xxx.h | |||
| @@ -1014,8 +1014,7 @@ struct eeprom_data { | |||
| 1014 | 1014 | ||
| 1015 | /* Transmit and Receive Buffers */ | 1015 | /* Transmit and Receive Buffers */ |
| 1016 | #define NUM_LBUFQ_ENTRIES 128 | 1016 | #define NUM_LBUFQ_ENTRIES 128 |
| 1017 | #define JUMBO_NUM_LBUFQ_ENTRIES \ | 1017 | #define JUMBO_NUM_LBUFQ_ENTRIES 32 |
| 1018 | (NUM_LBUFQ_ENTRIES/(JUMBO_MTU_SIZE/NORMAL_MTU_SIZE)) | ||
| 1019 | #define NUM_SBUFQ_ENTRIES 64 | 1018 | #define NUM_SBUFQ_ENTRIES 64 |
| 1020 | #define QL_SMALL_BUFFER_SIZE 32 | 1019 | #define QL_SMALL_BUFFER_SIZE 32 |
| 1021 | #define QL_ADDR_ELE_PER_BUFQ_ENTRY \ | 1020 | #define QL_ADDR_ELE_PER_BUFQ_ENTRY \ |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 521b5f0618a4..6a77b8a92245 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
| @@ -66,6 +66,7 @@ VERSION 2.2LK <2005/01/25> | |||
| 66 | #include <linux/init.h> | 66 | #include <linux/init.h> |
| 67 | #include <linux/dma-mapping.h> | 67 | #include <linux/dma-mapping.h> |
| 68 | 68 | ||
| 69 | #include <asm/system.h> | ||
| 69 | #include <asm/io.h> | 70 | #include <asm/io.h> |
| 70 | #include <asm/irq.h> | 71 | #include <asm/irq.h> |
| 71 | 72 | ||
| @@ -486,6 +487,7 @@ static int rtl8169_rx_interrupt(struct net_device *, struct rtl8169_private *, | |||
| 486 | void __iomem *); | 487 | void __iomem *); |
| 487 | static int rtl8169_change_mtu(struct net_device *dev, int new_mtu); | 488 | static int rtl8169_change_mtu(struct net_device *dev, int new_mtu); |
| 488 | static void rtl8169_down(struct net_device *dev); | 489 | static void rtl8169_down(struct net_device *dev); |
| 490 | static void rtl8169_rx_clear(struct rtl8169_private *tp); | ||
| 489 | 491 | ||
| 490 | #ifdef CONFIG_R8169_NAPI | 492 | #ifdef CONFIG_R8169_NAPI |
| 491 | static int rtl8169_poll(struct net_device *dev, int *budget); | 493 | static int rtl8169_poll(struct net_device *dev, int *budget); |
| @@ -1751,16 +1753,10 @@ static int rtl8169_open(struct net_device *dev) | |||
| 1751 | { | 1753 | { |
| 1752 | struct rtl8169_private *tp = netdev_priv(dev); | 1754 | struct rtl8169_private *tp = netdev_priv(dev); |
| 1753 | struct pci_dev *pdev = tp->pci_dev; | 1755 | struct pci_dev *pdev = tp->pci_dev; |
| 1754 | int retval; | 1756 | int retval = -ENOMEM; |
| 1755 | 1757 | ||
| 1756 | rtl8169_set_rxbufsize(tp, dev); | ||
| 1757 | |||
| 1758 | retval = | ||
| 1759 | request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED, dev->name, dev); | ||
| 1760 | if (retval < 0) | ||
| 1761 | goto out; | ||
| 1762 | 1758 | ||
| 1763 | retval = -ENOMEM; | 1759 | rtl8169_set_rxbufsize(tp, dev); |
| 1764 | 1760 | ||
| 1765 | /* | 1761 | /* |
| 1766 | * Rx and Tx desscriptors needs 256 bytes alignment. | 1762 | * Rx and Tx desscriptors needs 256 bytes alignment. |
| @@ -1769,19 +1765,26 @@ static int rtl8169_open(struct net_device *dev) | |||
| 1769 | tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, | 1765 | tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, |
| 1770 | &tp->TxPhyAddr); | 1766 | &tp->TxPhyAddr); |
| 1771 | if (!tp->TxDescArray) | 1767 | if (!tp->TxDescArray) |
| 1772 | goto err_free_irq; | 1768 | goto out; |
| 1773 | 1769 | ||
| 1774 | tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, | 1770 | tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, |
| 1775 | &tp->RxPhyAddr); | 1771 | &tp->RxPhyAddr); |
| 1776 | if (!tp->RxDescArray) | 1772 | if (!tp->RxDescArray) |
| 1777 | goto err_free_tx; | 1773 | goto err_free_tx_0; |
| 1778 | 1774 | ||
| 1779 | retval = rtl8169_init_ring(dev); | 1775 | retval = rtl8169_init_ring(dev); |
| 1780 | if (retval < 0) | 1776 | if (retval < 0) |
| 1781 | goto err_free_rx; | 1777 | goto err_free_rx_1; |
| 1782 | 1778 | ||
| 1783 | INIT_DELAYED_WORK(&tp->task, NULL); | 1779 | INIT_DELAYED_WORK(&tp->task, NULL); |
| 1784 | 1780 | ||
| 1781 | smp_mb(); | ||
| 1782 | |||
| 1783 | retval = request_irq(dev->irq, rtl8169_interrupt, IRQF_SHARED, | ||
| 1784 | dev->name, dev); | ||
| 1785 | if (retval < 0) | ||
| 1786 | goto err_release_ring_2; | ||
| 1787 | |||
| 1785 | rtl8169_hw_start(dev); | 1788 | rtl8169_hw_start(dev); |
| 1786 | 1789 | ||
| 1787 | rtl8169_request_timer(dev); | 1790 | rtl8169_request_timer(dev); |
| @@ -1790,14 +1793,14 @@ static int rtl8169_open(struct net_device *dev) | |||
| 1790 | out: | 1793 | out: |
| 1791 | return retval; | 1794 | return retval; |
| 1792 | 1795 | ||
| 1793 | err_free_rx: | 1796 | err_release_ring_2: |
| 1797 | rtl8169_rx_clear(tp); | ||
| 1798 | err_free_rx_1: | ||
| 1794 | pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, | 1799 | pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, |
| 1795 | tp->RxPhyAddr); | 1800 | tp->RxPhyAddr); |
| 1796 | err_free_tx: | 1801 | err_free_tx_0: |
| 1797 | pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, | 1802 | pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, |
| 1798 | tp->TxPhyAddr); | 1803 | tp->TxPhyAddr); |
| 1799 | err_free_irq: | ||
| 1800 | free_irq(dev->irq, dev); | ||
| 1801 | goto out; | 1804 | goto out; |
| 1802 | } | 1805 | } |
| 1803 | 1806 | ||
| @@ -2887,7 +2890,7 @@ static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 2887 | void __iomem *ioaddr = tp->mmio_addr; | 2890 | void __iomem *ioaddr = tp->mmio_addr; |
| 2888 | 2891 | ||
| 2889 | if (!netif_running(dev)) | 2892 | if (!netif_running(dev)) |
| 2890 | goto out; | 2893 | goto out_pci_suspend; |
| 2891 | 2894 | ||
| 2892 | netif_device_detach(dev); | 2895 | netif_device_detach(dev); |
| 2893 | netif_stop_queue(dev); | 2896 | netif_stop_queue(dev); |
| @@ -2901,10 +2904,11 @@ static int rtl8169_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 2901 | 2904 | ||
| 2902 | spin_unlock_irq(&tp->lock); | 2905 | spin_unlock_irq(&tp->lock); |
| 2903 | 2906 | ||
| 2907 | out_pci_suspend: | ||
| 2904 | pci_save_state(pdev); | 2908 | pci_save_state(pdev); |
| 2905 | pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled); | 2909 | pci_enable_wake(pdev, pci_choose_state(pdev, state), tp->wol_enabled); |
| 2906 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 2910 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
| 2907 | out: | 2911 | |
| 2908 | return 0; | 2912 | return 0; |
| 2909 | } | 2913 | } |
| 2910 | 2914 | ||
| @@ -2912,15 +2916,15 @@ static int rtl8169_resume(struct pci_dev *pdev) | |||
| 2912 | { | 2916 | { |
| 2913 | struct net_device *dev = pci_get_drvdata(pdev); | 2917 | struct net_device *dev = pci_get_drvdata(pdev); |
| 2914 | 2918 | ||
| 2919 | pci_set_power_state(pdev, PCI_D0); | ||
| 2920 | pci_restore_state(pdev); | ||
| 2921 | pci_enable_wake(pdev, PCI_D0, 0); | ||
| 2922 | |||
| 2915 | if (!netif_running(dev)) | 2923 | if (!netif_running(dev)) |
| 2916 | goto out; | 2924 | goto out; |
| 2917 | 2925 | ||
| 2918 | netif_device_attach(dev); | 2926 | netif_device_attach(dev); |
| 2919 | 2927 | ||
| 2920 | pci_set_power_state(pdev, PCI_D0); | ||
| 2921 | pci_restore_state(pdev); | ||
| 2922 | pci_enable_wake(pdev, PCI_D0, 0); | ||
| 2923 | |||
| 2924 | rtl8169_schedule_work(dev, rtl8169_reset_task); | 2928 | rtl8169_schedule_work(dev, rtl8169_reset_task); |
| 2925 | out: | 2929 | out: |
| 2926 | return 0; | 2930 | return 0; |
diff --git a/drivers/net/saa9730.c b/drivers/net/saa9730.c index b269513cde45..143958f1ef0a 100644 --- a/drivers/net/saa9730.c +++ b/drivers/net/saa9730.c | |||
| @@ -64,37 +64,37 @@ static unsigned int pci_irq_line; | |||
| 64 | 64 | ||
| 65 | static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp) | 65 | static void evm_saa9730_enable_lan_int(struct lan_saa9730_private *lp) |
| 66 | { | 66 | { |
| 67 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, | 67 | writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, |
| 68 | &lp->evm_saa9730_regs->InterruptBlock1); | 68 | &lp->evm_saa9730_regs->InterruptBlock1); |
| 69 | outl(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT, | 69 | writel(readl(&lp->evm_saa9730_regs->InterruptStatus1) | EVM_LAN_INT, |
| 70 | &lp->evm_saa9730_regs->InterruptStatus1); | 70 | &lp->evm_saa9730_regs->InterruptStatus1); |
| 71 | outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT | | 71 | writel(readl(&lp->evm_saa9730_regs->InterruptEnable1) | EVM_LAN_INT | |
| 72 | EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1); | 72 | EVM_MASTER_EN, &lp->evm_saa9730_regs->InterruptEnable1); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp) | 75 | static void evm_saa9730_disable_lan_int(struct lan_saa9730_private *lp) |
| 76 | { | 76 | { |
| 77 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, | 77 | writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, |
| 78 | &lp->evm_saa9730_regs->InterruptBlock1); | 78 | &lp->evm_saa9730_regs->InterruptBlock1); |
| 79 | outl(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT, | 79 | writel(readl(&lp->evm_saa9730_regs->InterruptEnable1) & ~EVM_LAN_INT, |
| 80 | &lp->evm_saa9730_regs->InterruptEnable1); | 80 | &lp->evm_saa9730_regs->InterruptEnable1); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp) | 83 | static void evm_saa9730_clear_lan_int(struct lan_saa9730_private *lp) |
| 84 | { | 84 | { |
| 85 | outl(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1); | 85 | writel(EVM_LAN_INT, &lp->evm_saa9730_regs->InterruptStatus1); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp) | 88 | static void evm_saa9730_block_lan_int(struct lan_saa9730_private *lp) |
| 89 | { | 89 | { |
| 90 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, | 90 | writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) & ~EVM_LAN_INT, |
| 91 | &lp->evm_saa9730_regs->InterruptBlock1); | 91 | &lp->evm_saa9730_regs->InterruptBlock1); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp) | 94 | static void evm_saa9730_unblock_lan_int(struct lan_saa9730_private *lp) |
| 95 | { | 95 | { |
| 96 | outl(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, | 96 | writel(readl(&lp->evm_saa9730_regs->InterruptBlock1) | EVM_LAN_INT, |
| 97 | &lp->evm_saa9730_regs->InterruptBlock1); | 97 | &lp->evm_saa9730_regs->InterruptBlock1); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp) | 100 | static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp) |
| @@ -147,7 +147,7 @@ static void __attribute_used__ show_saa9730_regs(struct lan_saa9730_private *lp) | |||
| 147 | printk("lp->lan_saa9730_regs->RxStatus = %x\n", | 147 | printk("lp->lan_saa9730_regs->RxStatus = %x\n", |
| 148 | readl(&lp->lan_saa9730_regs->RxStatus)); | 148 | readl(&lp->lan_saa9730_regs->RxStatus)); |
| 149 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { | 149 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { |
| 150 | outl(i, &lp->lan_saa9730_regs->CamAddress); | 150 | writel(i, &lp->lan_saa9730_regs->CamAddress); |
| 151 | printk("lp->lan_saa9730_regs->CamData = %x\n", | 151 | printk("lp->lan_saa9730_regs->CamData = %x\n", |
| 152 | readl(&lp->lan_saa9730_regs->CamData)); | 152 | readl(&lp->lan_saa9730_regs->CamData)); |
| 153 | } | 153 | } |
| @@ -288,28 +288,27 @@ static int lan_saa9730_allocate_buffers(struct pci_dev *pdev, | |||
| 288 | * Set rx buffer A and rx buffer B to point to the first two buffer | 288 | * Set rx buffer A and rx buffer B to point to the first two buffer |
| 289 | * spaces. | 289 | * spaces. |
| 290 | */ | 290 | */ |
| 291 | outl(lp->dma_addr + rxoffset, | 291 | writel(lp->dma_addr + rxoffset, &lp->lan_saa9730_regs->RxBuffA); |
| 292 | &lp->lan_saa9730_regs->RxBuffA); | 292 | writel(lp->dma_addr + rxoffset + |
| 293 | outl(lp->dma_addr + rxoffset + | 293 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE, |
| 294 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_RCV_Q_SIZE, | 294 | &lp->lan_saa9730_regs->RxBuffB); |
| 295 | &lp->lan_saa9730_regs->RxBuffB); | ||
| 296 | 295 | ||
| 297 | /* | 296 | /* |
| 298 | * Set txm_buf_a and txm_buf_b to point to the first two buffer | 297 | * Set txm_buf_a and txm_buf_b to point to the first two buffer |
| 299 | * space | 298 | * space |
| 300 | */ | 299 | */ |
| 301 | outl(lp->dma_addr + txoffset, | 300 | writel(lp->dma_addr + txoffset, |
| 302 | &lp->lan_saa9730_regs->TxBuffA); | 301 | &lp->lan_saa9730_regs->TxBuffA); |
| 303 | outl(lp->dma_addr + txoffset + | 302 | writel(lp->dma_addr + txoffset + |
| 304 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE, | 303 | LAN_SAA9730_PACKET_SIZE * LAN_SAA9730_TXM_Q_SIZE, |
| 305 | &lp->lan_saa9730_regs->TxBuffB); | 304 | &lp->lan_saa9730_regs->TxBuffB); |
| 306 | 305 | ||
| 307 | /* Set packet number */ | 306 | /* Set packet number */ |
| 308 | outl((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) | | 307 | writel((lp->DmaRcvPackets << PK_COUNT_RX_A_SHF) | |
| 309 | (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) | | 308 | (lp->DmaRcvPackets << PK_COUNT_RX_B_SHF) | |
| 310 | (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) | | 309 | (lp->DmaTxmPackets << PK_COUNT_TX_A_SHF) | |
| 311 | (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF), | 310 | (lp->DmaTxmPackets << PK_COUNT_TX_B_SHF), |
| 312 | &lp->lan_saa9730_regs->PacketCount); | 311 | &lp->lan_saa9730_regs->PacketCount); |
| 313 | 312 | ||
| 314 | return 0; | 313 | return 0; |
| 315 | 314 | ||
| @@ -326,10 +325,10 @@ static int lan_saa9730_cam_load(struct lan_saa9730_private *lp) | |||
| 326 | 325 | ||
| 327 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { | 326 | for (i = 0; i < LAN_SAA9730_CAM_DWORDS; i++) { |
| 328 | /* First set address to where data is written */ | 327 | /* First set address to where data is written */ |
| 329 | outl(i, &lp->lan_saa9730_regs->CamAddress); | 328 | writel(i, &lp->lan_saa9730_regs->CamAddress); |
| 330 | outl((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) | 329 | writel((NetworkAddress[0] << 24) | (NetworkAddress[1] << 16) | |
| 331 | | (NetworkAddress[2] << 8) | NetworkAddress[3], | 330 | (NetworkAddress[2] << 8) | NetworkAddress[3], |
| 332 | &lp->lan_saa9730_regs->CamData); | 331 | &lp->lan_saa9730_regs->CamData); |
| 333 | NetworkAddress += 4; | 332 | NetworkAddress += 4; |
| 334 | } | 333 | } |
| 335 | return 0; | 334 | return 0; |
| @@ -365,8 +364,8 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
| 365 | } | 364 | } |
| 366 | 365 | ||
| 367 | /* Now set the control and address register. */ | 366 | /* Now set the control and address register. */ |
| 368 | outl(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF, | 367 | writel(MD_CA_BUSY | PHY_STATUS | PHY_ADDRESS << MD_CA_PHY_SHF, |
| 369 | &lp->lan_saa9730_regs->StationMgmtCtl); | 368 | &lp->lan_saa9730_regs->StationMgmtCtl); |
| 370 | 369 | ||
| 371 | /* check link status, spin here till station is not busy */ | 370 | /* check link status, spin here till station is not busy */ |
| 372 | i = 0; | 371 | i = 0; |
| @@ -391,23 +390,23 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
| 391 | /* Link is down, reset the PHY first. */ | 390 | /* Link is down, reset the PHY first. */ |
| 392 | 391 | ||
| 393 | /* set PHY address = 'CONTROL' */ | 392 | /* set PHY address = 'CONTROL' */ |
| 394 | outl(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL, | 393 | writel(PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | PHY_CONTROL, |
| 395 | &lp->lan_saa9730_regs->StationMgmtCtl); | 394 | &lp->lan_saa9730_regs->StationMgmtCtl); |
| 396 | 395 | ||
| 397 | /* Wait for 1 ms. */ | 396 | /* Wait for 1 ms. */ |
| 398 | mdelay(1); | 397 | mdelay(1); |
| 399 | 398 | ||
| 400 | /* set 'CONTROL' = force reset and renegotiate */ | 399 | /* set 'CONTROL' = force reset and renegotiate */ |
| 401 | outl(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG | | 400 | writel(PHY_CONTROL_RESET | PHY_CONTROL_AUTO_NEG | |
| 402 | PHY_CONTROL_RESTART_AUTO_NEG, | 401 | PHY_CONTROL_RESTART_AUTO_NEG, |
| 403 | &lp->lan_saa9730_regs->StationMgmtData); | 402 | &lp->lan_saa9730_regs->StationMgmtData); |
| 404 | 403 | ||
| 405 | /* Wait for 50 ms. */ | 404 | /* Wait for 50 ms. */ |
| 406 | mdelay(50); | 405 | mdelay(50); |
| 407 | 406 | ||
| 408 | /* set 'BUSY' to start operation */ | 407 | /* set 'BUSY' to start operation */ |
| 409 | outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | | 408 | writel(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | MD_CA_WR | |
| 410 | PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl); | 409 | PHY_CONTROL, &lp->lan_saa9730_regs->StationMgmtCtl); |
| 411 | 410 | ||
| 412 | /* await completion */ | 411 | /* await completion */ |
| 413 | i = 0; | 412 | i = 0; |
| @@ -427,9 +426,9 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
| 427 | 426 | ||
| 428 | for (l = 0; l < 2; l++) { | 427 | for (l = 0; l < 2; l++) { |
| 429 | /* set PHY address = 'STATUS' */ | 428 | /* set PHY address = 'STATUS' */ |
| 430 | outl(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | | 429 | writel(MD_CA_BUSY | PHY_ADDRESS << MD_CA_PHY_SHF | |
| 431 | PHY_STATUS, | 430 | PHY_STATUS, |
| 432 | &lp->lan_saa9730_regs->StationMgmtCtl); | 431 | &lp->lan_saa9730_regs->StationMgmtCtl); |
| 433 | 432 | ||
| 434 | /* await completion */ | 433 | /* await completion */ |
| 435 | i = 0; | 434 | i = 0; |
| @@ -462,35 +461,35 @@ static int lan_saa9730_mii_init(struct lan_saa9730_private *lp) | |||
| 462 | static int lan_saa9730_control_init(struct lan_saa9730_private *lp) | 461 | static int lan_saa9730_control_init(struct lan_saa9730_private *lp) |
| 463 | { | 462 | { |
| 464 | /* Initialize DMA control register. */ | 463 | /* Initialize DMA control register. */ |
| 465 | outl((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) | | 464 | writel((LANMB_ANY << DMA_CTL_MAX_XFER_SHF) | |
| 466 | (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) | | 465 | (LANEND_LITTLE << DMA_CTL_ENDIAN_SHF) | |
| 467 | (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF) | 466 | (LAN_SAA9730_RCV_Q_INT_THRESHOLD << DMA_CTL_RX_INT_COUNT_SHF) |
| 468 | | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN | | 467 | | DMA_CTL_RX_INT_TO_EN | DMA_CTL_RX_INT_EN | |
| 469 | DMA_CTL_MAC_RX_INT_EN | DMA_CTL_MAC_TX_INT_EN, | 468 | DMA_CTL_MAC_RX_INT_EN | DMA_CTL_MAC_TX_INT_EN, |
| 470 | &lp->lan_saa9730_regs->LanDmaCtl); | 469 | &lp->lan_saa9730_regs->LanDmaCtl); |
| 471 | 470 | ||
| 472 | /* Initial MAC control register. */ | 471 | /* Initial MAC control register. */ |
| 473 | outl((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP, | 472 | writel((MACCM_MII << MAC_CONTROL_CONN_SHF) | MAC_CONTROL_FULL_DUP, |
| 474 | &lp->lan_saa9730_regs->MacCtl); | 473 | &lp->lan_saa9730_regs->MacCtl); |
| 475 | 474 | ||
| 476 | /* Initialize CAM control register. */ | 475 | /* Initialize CAM control register. */ |
| 477 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC, | 476 | writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_BROAD_ACC, |
| 478 | &lp->lan_saa9730_regs->CamCtl); | 477 | &lp->lan_saa9730_regs->CamCtl); |
| 479 | 478 | ||
| 480 | /* | 479 | /* |
| 481 | * Initialize CAM enable register, only turn on first entry, should | 480 | * Initialize CAM enable register, only turn on first entry, should |
| 482 | * contain own addr. | 481 | * contain own addr. |
| 483 | */ | 482 | */ |
| 484 | outl(0x0001, &lp->lan_saa9730_regs->CamEnable); | 483 | writel(0x0001, &lp->lan_saa9730_regs->CamEnable); |
| 485 | 484 | ||
| 486 | /* Initialize Tx control register */ | 485 | /* Initialize Tx control register */ |
| 487 | outl(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl); | 486 | writel(TX_CTL_EN_COMP, &lp->lan_saa9730_regs->TxCtl); |
| 488 | 487 | ||
| 489 | /* Initialize Rcv control register */ | 488 | /* Initialize Rcv control register */ |
| 490 | outl(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl); | 489 | writel(RX_CTL_STRIP_CRC, &lp->lan_saa9730_regs->RxCtl); |
| 491 | 490 | ||
| 492 | /* Reset DMA engine */ | 491 | /* Reset DMA engine */ |
| 493 | outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); | 492 | writel(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); |
| 494 | 493 | ||
| 495 | return 0; | 494 | return 0; |
| 496 | } | 495 | } |
| @@ -500,14 +499,14 @@ static int lan_saa9730_stop(struct lan_saa9730_private *lp) | |||
| 500 | int i; | 499 | int i; |
| 501 | 500 | ||
| 502 | /* Stop DMA first */ | 501 | /* Stop DMA first */ |
| 503 | outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) & | 502 | writel(readl(&lp->lan_saa9730_regs->LanDmaCtl) & |
| 504 | ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA), | 503 | ~(DMA_CTL_EN_TX_DMA | DMA_CTL_EN_RX_DMA), |
| 505 | &lp->lan_saa9730_regs->LanDmaCtl); | 504 | &lp->lan_saa9730_regs->LanDmaCtl); |
| 506 | 505 | ||
| 507 | /* Set the SW Reset bits in DMA and MAC control registers */ | 506 | /* Set the SW Reset bits in DMA and MAC control registers */ |
| 508 | outl(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); | 507 | writel(DMA_TEST_SW_RESET, &lp->lan_saa9730_regs->DmaTest); |
| 509 | outl(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET, | 508 | writel(readl(&lp->lan_saa9730_regs->MacCtl) | MAC_CONTROL_RESET, |
| 510 | &lp->lan_saa9730_regs->MacCtl); | 509 | &lp->lan_saa9730_regs->MacCtl); |
| 511 | 510 | ||
| 512 | /* | 511 | /* |
| 513 | * Wait for MAC reset to have finished. The reset bit is auto cleared | 512 | * Wait for MAC reset to have finished. The reset bit is auto cleared |
| @@ -532,8 +531,8 @@ static int lan_saa9730_dma_init(struct lan_saa9730_private *lp) | |||
| 532 | /* Stop lan controller. */ | 531 | /* Stop lan controller. */ |
| 533 | lan_saa9730_stop(lp); | 532 | lan_saa9730_stop(lp); |
| 534 | 533 | ||
| 535 | outl(LAN_SAA9730_DEFAULT_TIME_OUT_CNT, | 534 | writel(LAN_SAA9730_DEFAULT_TIME_OUT_CNT, |
| 536 | &lp->lan_saa9730_regs->Timeout); | 535 | &lp->lan_saa9730_regs->Timeout); |
| 537 | 536 | ||
| 538 | return 0; | 537 | return 0; |
| 539 | } | 538 | } |
| @@ -552,19 +551,19 @@ static int lan_saa9730_start(struct lan_saa9730_private *lp) | |||
| 552 | lp->PendingTxmPacketIndex = 0; | 551 | lp->PendingTxmPacketIndex = 0; |
| 553 | lp->PendingTxmBufferIndex = 0; | 552 | lp->PendingTxmBufferIndex = 0; |
| 554 | 553 | ||
| 555 | outl(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA | | 554 | writel(readl(&lp->lan_saa9730_regs->LanDmaCtl) | DMA_CTL_EN_TX_DMA | |
| 556 | DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl); | 555 | DMA_CTL_EN_RX_DMA, &lp->lan_saa9730_regs->LanDmaCtl); |
| 557 | 556 | ||
| 558 | /* For Tx, turn on MAC then DMA */ | 557 | /* For Tx, turn on MAC then DMA */ |
| 559 | outl(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN, | 558 | writel(readl(&lp->lan_saa9730_regs->TxCtl) | TX_CTL_TX_EN, |
| 560 | &lp->lan_saa9730_regs->TxCtl); | 559 | &lp->lan_saa9730_regs->TxCtl); |
| 561 | 560 | ||
| 562 | /* For Rx, turn on DMA then MAC */ | 561 | /* For Rx, turn on DMA then MAC */ |
| 563 | outl(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN, | 562 | writel(readl(&lp->lan_saa9730_regs->RxCtl) | RX_CTL_RX_EN, |
| 564 | &lp->lan_saa9730_regs->RxCtl); | 563 | &lp->lan_saa9730_regs->RxCtl); |
| 565 | 564 | ||
| 566 | /* Set Ok2Use to let hardware own the buffers. */ | 565 | /* Set Ok2Use to let hardware own the buffers. */ |
| 567 | outl(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use); | 566 | writel(OK2USE_RX_A | OK2USE_RX_B, &lp->lan_saa9730_regs->Ok2Use); |
| 568 | 567 | ||
| 569 | return 0; | 568 | return 0; |
| 570 | } | 569 | } |
| @@ -587,7 +586,7 @@ static int lan_saa9730_tx(struct net_device *dev) | |||
| 587 | printk("lan_saa9730_tx interrupt\n"); | 586 | printk("lan_saa9730_tx interrupt\n"); |
| 588 | 587 | ||
| 589 | /* Clear interrupt. */ | 588 | /* Clear interrupt. */ |
| 590 | outl(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus); | 589 | writel(DMA_STATUS_MAC_TX_INT, &lp->lan_saa9730_regs->DmaStatus); |
| 591 | 590 | ||
| 592 | while (1) { | 591 | while (1) { |
| 593 | pPacket = lp->TxmBuffer[lp->PendingTxmBufferIndex] | 592 | pPacket = lp->TxmBuffer[lp->PendingTxmBufferIndex] |
| @@ -660,8 +659,8 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
| 660 | printk("lan_saa9730_rx interrupt\n"); | 659 | printk("lan_saa9730_rx interrupt\n"); |
| 661 | 660 | ||
| 662 | /* Clear receive interrupts. */ | 661 | /* Clear receive interrupts. */ |
| 663 | outl(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | | 662 | writel(DMA_STATUS_MAC_RX_INT | DMA_STATUS_RX_INT | |
| 664 | DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus); | 663 | DMA_STATUS_RX_TO_INT, &lp->lan_saa9730_regs->DmaStatus); |
| 665 | 664 | ||
| 666 | /* Address next packet */ | 665 | /* Address next packet */ |
| 667 | BufferIndex = lp->NextRcvBufferIndex; | 666 | BufferIndex = lp->NextRcvBufferIndex; |
| @@ -725,8 +724,8 @@ static int lan_saa9730_rx(struct net_device *dev) | |||
| 725 | *pPacket = cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF); | 724 | *pPacket = cpu_to_le32(RXSF_READY << RX_STAT_CTL_OWNER_SHF); |
| 726 | 725 | ||
| 727 | /* Make sure A or B is available to hardware as appropriate. */ | 726 | /* Make sure A or B is available to hardware as appropriate. */ |
| 728 | outl(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A, | 727 | writel(BufferIndex ? OK2USE_RX_B : OK2USE_RX_A, |
| 729 | &lp->lan_saa9730_regs->Ok2Use); | 728 | &lp->lan_saa9730_regs->Ok2Use); |
| 730 | 729 | ||
| 731 | /* Go to next packet in sequence. */ | 730 | /* Go to next packet in sequence. */ |
| 732 | lp->NextRcvPacketIndex++; | 731 | lp->NextRcvPacketIndex++; |
| @@ -844,8 +843,8 @@ static int lan_saa9730_write(struct lan_saa9730_private *lp, | |||
| 844 | (len << TX_STAT_CTL_LENGTH_SHF)); | 843 | (len << TX_STAT_CTL_LENGTH_SHF)); |
| 845 | 844 | ||
| 846 | /* Make sure A or B is available to hardware as appropriate. */ | 845 | /* Make sure A or B is available to hardware as appropriate. */ |
| 847 | outl(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A, | 846 | writel(BufferIndex ? OK2USE_TX_B : OK2USE_TX_A, |
| 848 | &lp->lan_saa9730_regs->Ok2Use); | 847 | &lp->lan_saa9730_regs->Ok2Use); |
| 849 | 848 | ||
| 850 | return 0; | 849 | return 0; |
| 851 | } | 850 | } |
| @@ -938,15 +937,15 @@ static void lan_saa9730_set_multicast(struct net_device *dev) | |||
| 938 | 937 | ||
| 939 | if (dev->flags & IFF_PROMISC) { | 938 | if (dev->flags & IFF_PROMISC) { |
| 940 | /* accept all packets */ | 939 | /* accept all packets */ |
| 941 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC | | 940 | writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_STATION_ACC | |
| 942 | CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, | 941 | CAM_CONTROL_GROUP_ACC | CAM_CONTROL_BROAD_ACC, |
| 943 | &lp->lan_saa9730_regs->CamCtl); | 942 | &lp->lan_saa9730_regs->CamCtl); |
| 944 | } else { | 943 | } else { |
| 945 | if (dev->flags & IFF_ALLMULTI) { | 944 | if (dev->flags & IFF_ALLMULTI) { |
| 946 | /* accept all multicast packets */ | 945 | /* accept all multicast packets */ |
| 947 | outl(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | | 946 | writel(CAM_CONTROL_COMP_EN | CAM_CONTROL_GROUP_ACC | |
| 948 | CAM_CONTROL_BROAD_ACC, | 947 | CAM_CONTROL_BROAD_ACC, |
| 949 | &lp->lan_saa9730_regs->CamCtl); | 948 | &lp->lan_saa9730_regs->CamCtl); |
| 950 | } else { | 949 | } else { |
| 951 | /* | 950 | /* |
| 952 | * Will handle the multicast stuff later. -carstenl | 951 | * Will handle the multicast stuff later. -carstenl |
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c index 1eae16b72b4b..103c3174ab54 100644 --- a/drivers/net/sb1250-mac.c +++ b/drivers/net/sb1250-mac.c | |||
| @@ -243,7 +243,7 @@ struct sbmac_softc { | |||
| 243 | * Controller-specific things | 243 | * Controller-specific things |
| 244 | */ | 244 | */ |
| 245 | 245 | ||
| 246 | volatile void __iomem *sbm_base; /* MAC's base address */ | 246 | void __iomem *sbm_base; /* MAC's base address */ |
| 247 | sbmac_state_t sbm_state; /* current state */ | 247 | sbmac_state_t sbm_state; /* current state */ |
| 248 | 248 | ||
| 249 | volatile void __iomem *sbm_macenable; /* MAC Enable Register */ | 249 | volatile void __iomem *sbm_macenable; /* MAC Enable Register */ |
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c index 4a926f20b6ea..c32c21af3fdd 100644 --- a/drivers/net/sc92031.c +++ b/drivers/net/sc92031.c | |||
| @@ -964,7 +964,7 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 964 | goto out; | 964 | goto out; |
| 965 | } | 965 | } |
| 966 | 966 | ||
| 967 | spin_lock_bh(&priv->lock); | 967 | spin_lock(&priv->lock); |
| 968 | 968 | ||
| 969 | if (unlikely(!netif_carrier_ok(dev))) { | 969 | if (unlikely(!netif_carrier_ok(dev))) { |
| 970 | err = -ENOLINK; | 970 | err = -ENOLINK; |
| @@ -1005,7 +1005,7 @@ static int sc92031_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1005 | netif_stop_queue(dev); | 1005 | netif_stop_queue(dev); |
| 1006 | 1006 | ||
| 1007 | out_unlock: | 1007 | out_unlock: |
| 1008 | spin_unlock_bh(&priv->lock); | 1008 | spin_unlock(&priv->lock); |
| 1009 | 1009 | ||
| 1010 | out: | 1010 | out: |
| 1011 | dev_kfree_skb(skb); | 1011 | dev_kfree_skb(skb); |
| @@ -1042,12 +1042,12 @@ static int sc92031_open(struct net_device *dev) | |||
| 1042 | priv->pm_config = 0; | 1042 | priv->pm_config = 0; |
| 1043 | 1043 | ||
| 1044 | /* Interrupts already disabled by sc92031_stop or sc92031_probe */ | 1044 | /* Interrupts already disabled by sc92031_stop or sc92031_probe */ |
| 1045 | spin_lock(&priv->lock); | 1045 | spin_lock_bh(&priv->lock); |
| 1046 | 1046 | ||
| 1047 | _sc92031_reset(dev); | 1047 | _sc92031_reset(dev); |
| 1048 | mmiowb(); | 1048 | mmiowb(); |
| 1049 | 1049 | ||
| 1050 | spin_unlock(&priv->lock); | 1050 | spin_unlock_bh(&priv->lock); |
| 1051 | sc92031_enable_interrupts(dev); | 1051 | sc92031_enable_interrupts(dev); |
| 1052 | 1052 | ||
| 1053 | if (netif_carrier_ok(dev)) | 1053 | if (netif_carrier_ok(dev)) |
| @@ -1077,13 +1077,13 @@ static int sc92031_stop(struct net_device *dev) | |||
| 1077 | /* Disable interrupts, stop Tx and Rx. */ | 1077 | /* Disable interrupts, stop Tx and Rx. */ |
| 1078 | sc92031_disable_interrupts(dev); | 1078 | sc92031_disable_interrupts(dev); |
| 1079 | 1079 | ||
| 1080 | spin_lock(&priv->lock); | 1080 | spin_lock_bh(&priv->lock); |
| 1081 | 1081 | ||
| 1082 | _sc92031_disable_tx_rx(dev); | 1082 | _sc92031_disable_tx_rx(dev); |
| 1083 | _sc92031_tx_clear(dev); | 1083 | _sc92031_tx_clear(dev); |
| 1084 | mmiowb(); | 1084 | mmiowb(); |
| 1085 | 1085 | ||
| 1086 | spin_unlock(&priv->lock); | 1086 | spin_unlock_bh(&priv->lock); |
| 1087 | 1087 | ||
| 1088 | free_irq(pdev->irq, dev); | 1088 | free_irq(pdev->irq, dev); |
| 1089 | pci_free_consistent(pdev, TX_BUF_TOT_LEN, priv->tx_bufs, | 1089 | pci_free_consistent(pdev, TX_BUF_TOT_LEN, priv->tx_bufs, |
| @@ -1539,13 +1539,13 @@ static int sc92031_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 1539 | /* Disable interrupts, stop Tx and Rx. */ | 1539 | /* Disable interrupts, stop Tx and Rx. */ |
| 1540 | sc92031_disable_interrupts(dev); | 1540 | sc92031_disable_interrupts(dev); |
| 1541 | 1541 | ||
| 1542 | spin_lock(&priv->lock); | 1542 | spin_lock_bh(&priv->lock); |
| 1543 | 1543 | ||
| 1544 | _sc92031_disable_tx_rx(dev); | 1544 | _sc92031_disable_tx_rx(dev); |
| 1545 | _sc92031_tx_clear(dev); | 1545 | _sc92031_tx_clear(dev); |
| 1546 | mmiowb(); | 1546 | mmiowb(); |
| 1547 | 1547 | ||
| 1548 | spin_unlock(&priv->lock); | 1548 | spin_unlock_bh(&priv->lock); |
| 1549 | 1549 | ||
| 1550 | out: | 1550 | out: |
| 1551 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 1551 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
| @@ -1565,12 +1565,12 @@ static int sc92031_resume(struct pci_dev *pdev) | |||
| 1565 | goto out; | 1565 | goto out; |
| 1566 | 1566 | ||
| 1567 | /* Interrupts already disabled by sc92031_suspend */ | 1567 | /* Interrupts already disabled by sc92031_suspend */ |
| 1568 | spin_lock(&priv->lock); | 1568 | spin_lock_bh(&priv->lock); |
| 1569 | 1569 | ||
| 1570 | _sc92031_reset(dev); | 1570 | _sc92031_reset(dev); |
| 1571 | mmiowb(); | 1571 | mmiowb(); |
| 1572 | 1572 | ||
| 1573 | spin_unlock(&priv->lock); | 1573 | spin_unlock_bh(&priv->lock); |
| 1574 | sc92031_enable_interrupts(dev); | 1574 | sc92031_enable_interrupts(dev); |
| 1575 | 1575 | ||
| 1576 | netif_device_attach(dev); | 1576 | netif_device_attach(dev); |
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c index b08508b35833..34463ce6f132 100644 --- a/drivers/net/sis190.c +++ b/drivers/net/sis190.c | |||
| @@ -324,6 +324,7 @@ static struct mii_chip_info { | |||
| 324 | u32 feature; | 324 | u32 feature; |
| 325 | } mii_chip_table[] = { | 325 | } mii_chip_table[] = { |
| 326 | { "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 }, | 326 | { "Broadcom PHY BCM5461", { 0x0020, 0x60c0 }, LAN, F_PHY_BCM5461 }, |
| 327 | { "Broadcom PHY AC131", { 0x0143, 0xbc70 }, LAN, 0 }, | ||
| 327 | { "Agere PHY ET1101B", { 0x0282, 0xf010 }, LAN, 0 }, | 328 | { "Agere PHY ET1101B", { 0x0282, 0xf010 }, LAN, 0 }, |
| 328 | { "Marvell PHY 88E1111", { 0x0141, 0x0cc0 }, LAN, F_PHY_88E1111 }, | 329 | { "Marvell PHY 88E1111", { 0x0141, 0x0cc0 }, LAN, F_PHY_88E1111 }, |
| 329 | { "Realtek PHY RTL8201", { 0x0000, 0x8200 }, LAN, 0 }, | 330 | { "Realtek PHY RTL8201", { 0x0000, 0x8200 }, LAN, 0 }, |
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c index b3750f284279..b2a3b19d773a 100644 --- a/drivers/net/sis900.c +++ b/drivers/net/sis900.c | |||
| @@ -1755,6 +1755,24 @@ static int sis900_rx(struct net_device *net_dev) | |||
| 1755 | } else { | 1755 | } else { |
| 1756 | struct sk_buff * skb; | 1756 | struct sk_buff * skb; |
| 1757 | 1757 | ||
| 1758 | pci_unmap_single(sis_priv->pci_dev, | ||
| 1759 | sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE, | ||
| 1760 | PCI_DMA_FROMDEVICE); | ||
| 1761 | |||
| 1762 | /* refill the Rx buffer, what if there is not enought | ||
| 1763 | * memory for new socket buffer ?? */ | ||
| 1764 | if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) { | ||
| 1765 | /* | ||
| 1766 | * Not enough memory to refill the buffer | ||
| 1767 | * so we need to recycle the old one so | ||
| 1768 | * as to avoid creating a memory hole | ||
| 1769 | * in the rx ring | ||
| 1770 | */ | ||
| 1771 | skb = sis_priv->rx_skbuff[entry]; | ||
| 1772 | sis_priv->stats.rx_dropped++; | ||
| 1773 | goto refill_rx_ring; | ||
| 1774 | } | ||
| 1775 | |||
| 1758 | /* This situation should never happen, but due to | 1776 | /* This situation should never happen, but due to |
| 1759 | some unknow bugs, it is possible that | 1777 | some unknow bugs, it is possible that |
| 1760 | we are working on NULL sk_buff :-( */ | 1778 | we are working on NULL sk_buff :-( */ |
| @@ -1768,9 +1786,6 @@ static int sis900_rx(struct net_device *net_dev) | |||
| 1768 | break; | 1786 | break; |
| 1769 | } | 1787 | } |
| 1770 | 1788 | ||
| 1771 | pci_unmap_single(sis_priv->pci_dev, | ||
| 1772 | sis_priv->rx_ring[entry].bufptr, RX_BUF_SIZE, | ||
| 1773 | PCI_DMA_FROMDEVICE); | ||
| 1774 | /* give the socket buffer to upper layers */ | 1789 | /* give the socket buffer to upper layers */ |
| 1775 | skb = sis_priv->rx_skbuff[entry]; | 1790 | skb = sis_priv->rx_skbuff[entry]; |
| 1776 | skb_put(skb, rx_size); | 1791 | skb_put(skb, rx_size); |
| @@ -1783,33 +1798,14 @@ static int sis900_rx(struct net_device *net_dev) | |||
| 1783 | net_dev->last_rx = jiffies; | 1798 | net_dev->last_rx = jiffies; |
| 1784 | sis_priv->stats.rx_bytes += rx_size; | 1799 | sis_priv->stats.rx_bytes += rx_size; |
| 1785 | sis_priv->stats.rx_packets++; | 1800 | sis_priv->stats.rx_packets++; |
| 1786 | 1801 | sis_priv->dirty_rx++; | |
| 1787 | /* refill the Rx buffer, what if there is not enought | 1802 | refill_rx_ring: |
| 1788 | * memory for new socket buffer ?? */ | ||
| 1789 | if ((skb = dev_alloc_skb(RX_BUF_SIZE)) == NULL) { | ||
| 1790 | /* not enough memory for skbuff, this makes a | ||
| 1791 | * "hole" on the buffer ring, it is not clear | ||
| 1792 | * how the hardware will react to this kind | ||
| 1793 | * of degenerated buffer */ | ||
| 1794 | if (netif_msg_rx_status(sis_priv)) | ||
| 1795 | printk(KERN_INFO "%s: Memory squeeze," | ||
| 1796 | "deferring packet.\n", | ||
| 1797 | net_dev->name); | ||
| 1798 | sis_priv->rx_skbuff[entry] = NULL; | ||
| 1799 | /* reset buffer descriptor state */ | ||
| 1800 | sis_priv->rx_ring[entry].cmdsts = 0; | ||
| 1801 | sis_priv->rx_ring[entry].bufptr = 0; | ||
| 1802 | sis_priv->stats.rx_dropped++; | ||
| 1803 | sis_priv->cur_rx++; | ||
| 1804 | break; | ||
| 1805 | } | ||
| 1806 | skb->dev = net_dev; | 1803 | skb->dev = net_dev; |
| 1807 | sis_priv->rx_skbuff[entry] = skb; | 1804 | sis_priv->rx_skbuff[entry] = skb; |
| 1808 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; | 1805 | sis_priv->rx_ring[entry].cmdsts = RX_BUF_SIZE; |
| 1809 | sis_priv->rx_ring[entry].bufptr = | 1806 | sis_priv->rx_ring[entry].bufptr = |
| 1810 | pci_map_single(sis_priv->pci_dev, skb->data, | 1807 | pci_map_single(sis_priv->pci_dev, skb->data, |
| 1811 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | 1808 | RX_BUF_SIZE, PCI_DMA_FROMDEVICE); |
| 1812 | sis_priv->dirty_rx++; | ||
| 1813 | } | 1809 | } |
| 1814 | sis_priv->cur_rx++; | 1810 | sis_priv->cur_rx++; |
| 1815 | entry = sis_priv->cur_rx % NUM_RX_DESC; | 1811 | entry = sis_priv->cur_rx % NUM_RX_DESC; |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index eea75a401b0c..d476a3cc2e94 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
| @@ -105,7 +105,8 @@ static const int txqaddr[] = { Q_XA1, Q_XA2 }; | |||
| 105 | static const int rxqaddr[] = { Q_R1, Q_R2 }; | 105 | static const int rxqaddr[] = { Q_R1, Q_R2 }; |
| 106 | static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F }; | 106 | static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F }; |
| 107 | static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F }; | 107 | static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F }; |
| 108 | static const u32 irqmask[] = { IS_R1_F|IS_XA1_F, IS_R2_F|IS_XA2_F }; | 108 | static const u32 napimask[] = { IS_R1_F|IS_XA1_F, IS_R2_F|IS_XA2_F }; |
| 109 | static const u32 portmask[] = { IS_PORT_1, IS_PORT_2 }; | ||
| 109 | 110 | ||
| 110 | static int skge_get_regs_len(struct net_device *dev) | 111 | static int skge_get_regs_len(struct net_device *dev) |
| 111 | { | 112 | { |
| @@ -162,27 +163,46 @@ static void skge_wol_init(struct skge_port *skge) | |||
| 162 | { | 163 | { |
| 163 | struct skge_hw *hw = skge->hw; | 164 | struct skge_hw *hw = skge->hw; |
| 164 | int port = skge->port; | 165 | int port = skge->port; |
| 165 | enum pause_control save_mode; | 166 | u16 ctrl; |
| 166 | u32 ctrl; | ||
| 167 | 167 | ||
| 168 | /* Bring hardware out of reset */ | ||
| 169 | skge_write16(hw, B0_CTST, CS_RST_CLR); | 168 | skge_write16(hw, B0_CTST, CS_RST_CLR); |
| 170 | skge_write16(hw, SK_REG(port, GMAC_LINK_CTRL), GMLC_RST_CLR); | 169 | skge_write16(hw, SK_REG(port, GMAC_LINK_CTRL), GMLC_RST_CLR); |
| 171 | 170 | ||
| 172 | skge_write8(hw, SK_REG(port, GPHY_CTRL), GPC_RST_CLR); | 171 | /* Turn on Vaux */ |
| 173 | skge_write8(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR); | 172 | skge_write8(hw, B0_POWER_CTRL, |
| 173 | PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_ON | PC_VCC_OFF); | ||
| 174 | 174 | ||
| 175 | /* Force to 10/100 skge_reset will re-enable on resume */ | 175 | /* WA code for COMA mode -- clear PHY reset */ |
| 176 | save_mode = skge->flow_control; | 176 | if (hw->chip_id == CHIP_ID_YUKON_LITE && |
| 177 | skge->flow_control = FLOW_MODE_SYMMETRIC; | 177 | hw->chip_rev >= CHIP_REV_YU_LITE_A3) { |
| 178 | u32 reg = skge_read32(hw, B2_GP_IO); | ||
| 179 | reg |= GP_DIR_9; | ||
| 180 | reg &= ~GP_IO_9; | ||
| 181 | skge_write32(hw, B2_GP_IO, reg); | ||
| 182 | } | ||
| 178 | 183 | ||
| 179 | ctrl = skge->advertising; | 184 | skge_write32(hw, SK_REG(port, GPHY_CTRL), |
| 180 | skge->advertising &= ~(ADVERTISED_1000baseT_Half|ADVERTISED_1000baseT_Full); | 185 | GPC_DIS_SLEEP | |
| 186 | GPC_HWCFG_M_3 | GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0 | | ||
| 187 | GPC_ANEG_1 | GPC_RST_SET); | ||
| 181 | 188 | ||
| 182 | skge_phy_reset(skge); | 189 | skge_write32(hw, SK_REG(port, GPHY_CTRL), |
| 190 | GPC_DIS_SLEEP | | ||
| 191 | GPC_HWCFG_M_3 | GPC_HWCFG_M_2 | GPC_HWCFG_M_1 | GPC_HWCFG_M_0 | | ||
| 192 | GPC_ANEG_1 | GPC_RST_CLR); | ||
| 193 | |||
| 194 | skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_RST_CLR); | ||
| 195 | |||
| 196 | /* Force to 10/100 skge_reset will re-enable on resume */ | ||
| 197 | gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, | ||
| 198 | PHY_AN_100FULL | PHY_AN_100HALF | | ||
| 199 | PHY_AN_10FULL | PHY_AN_10HALF| PHY_AN_CSMA); | ||
| 200 | /* no 1000 HD/FD */ | ||
| 201 | gm_phy_write(hw, port, PHY_MARV_1000T_CTRL, 0); | ||
| 202 | gm_phy_write(hw, port, PHY_MARV_CTRL, | ||
| 203 | PHY_CT_RESET | PHY_CT_SPS_LSB | PHY_CT_ANE | | ||
| 204 | PHY_CT_RE_CFG | PHY_CT_DUP_MD); | ||
| 183 | 205 | ||
| 184 | skge->flow_control = save_mode; | ||
| 185 | skge->advertising = ctrl; | ||
| 186 | 206 | ||
| 187 | /* Set GMAC to no flow control and auto update for speed/duplex */ | 207 | /* Set GMAC to no flow control and auto update for speed/duplex */ |
| 188 | gma_write16(hw, port, GM_GP_CTRL, | 208 | gma_write16(hw, port, GM_GP_CTRL, |
| @@ -226,12 +246,10 @@ static int skge_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
| 226 | struct skge_port *skge = netdev_priv(dev); | 246 | struct skge_port *skge = netdev_priv(dev); |
| 227 | struct skge_hw *hw = skge->hw; | 247 | struct skge_hw *hw = skge->hw; |
| 228 | 248 | ||
| 229 | if (wol->wolopts & wol_supported(hw)) | 249 | if (wol->wolopts & ~wol_supported(hw)) |
| 230 | return -EOPNOTSUPP; | 250 | return -EOPNOTSUPP; |
| 231 | 251 | ||
| 232 | skge->wol = wol->wolopts; | 252 | skge->wol = wol->wolopts; |
| 233 | if (!netif_running(dev)) | ||
| 234 | skge_wol_init(skge); | ||
| 235 | return 0; | 253 | return 0; |
| 236 | } | 254 | } |
| 237 | 255 | ||
| @@ -671,7 +689,7 @@ static void skge_led(struct skge_port *skge, enum led_mode mode) | |||
| 671 | struct skge_hw *hw = skge->hw; | 689 | struct skge_hw *hw = skge->hw; |
| 672 | int port = skge->port; | 690 | int port = skge->port; |
| 673 | 691 | ||
| 674 | mutex_lock(&hw->phy_mutex); | 692 | spin_lock_bh(&hw->phy_lock); |
| 675 | if (hw->chip_id == CHIP_ID_GENESIS) { | 693 | if (hw->chip_id == CHIP_ID_GENESIS) { |
| 676 | switch (mode) { | 694 | switch (mode) { |
| 677 | case LED_MODE_OFF: | 695 | case LED_MODE_OFF: |
| @@ -742,7 +760,7 @@ static void skge_led(struct skge_port *skge, enum led_mode mode) | |||
| 742 | PHY_M_LED_MO_RX(MO_LED_ON)); | 760 | PHY_M_LED_MO_RX(MO_LED_ON)); |
| 743 | } | 761 | } |
| 744 | } | 762 | } |
| 745 | mutex_unlock(&hw->phy_mutex); | 763 | spin_unlock_bh(&hw->phy_lock); |
| 746 | } | 764 | } |
| 747 | 765 | ||
| 748 | /* blink LED's for finding board */ | 766 | /* blink LED's for finding board */ |
| @@ -1316,7 +1334,7 @@ static void xm_phy_init(struct skge_port *skge) | |||
| 1316 | xm_phy_write(hw, port, PHY_XMAC_CTRL, ctrl); | 1334 | xm_phy_write(hw, port, PHY_XMAC_CTRL, ctrl); |
| 1317 | 1335 | ||
| 1318 | /* Poll PHY for status changes */ | 1336 | /* Poll PHY for status changes */ |
| 1319 | schedule_delayed_work(&skge->link_thread, LINK_HZ); | 1337 | mod_timer(&skge->link_timer, jiffies + LINK_HZ); |
| 1320 | } | 1338 | } |
| 1321 | 1339 | ||
| 1322 | static void xm_check_link(struct net_device *dev) | 1340 | static void xm_check_link(struct net_device *dev) |
| @@ -1391,10 +1409,9 @@ static void xm_check_link(struct net_device *dev) | |||
| 1391 | * Since internal PHY is wired to a level triggered pin, can't | 1409 | * Since internal PHY is wired to a level triggered pin, can't |
| 1392 | * get an interrupt when carrier is detected. | 1410 | * get an interrupt when carrier is detected. |
| 1393 | */ | 1411 | */ |
| 1394 | static void xm_link_timer(struct work_struct *work) | 1412 | static void xm_link_timer(unsigned long arg) |
| 1395 | { | 1413 | { |
| 1396 | struct skge_port *skge = | 1414 | struct skge_port *skge = (struct skge_port *) arg; |
| 1397 | container_of(work, struct skge_port, link_thread.work); | ||
| 1398 | struct net_device *dev = skge->netdev; | 1415 | struct net_device *dev = skge->netdev; |
| 1399 | struct skge_hw *hw = skge->hw; | 1416 | struct skge_hw *hw = skge->hw; |
| 1400 | int port = skge->port; | 1417 | int port = skge->port; |
| @@ -1414,13 +1431,13 @@ static void xm_link_timer(struct work_struct *work) | |||
| 1414 | goto nochange; | 1431 | goto nochange; |
| 1415 | } | 1432 | } |
| 1416 | 1433 | ||
| 1417 | mutex_lock(&hw->phy_mutex); | 1434 | spin_lock(&hw->phy_lock); |
| 1418 | xm_check_link(dev); | 1435 | xm_check_link(dev); |
| 1419 | mutex_unlock(&hw->phy_mutex); | 1436 | spin_unlock(&hw->phy_lock); |
| 1420 | 1437 | ||
| 1421 | nochange: | 1438 | nochange: |
| 1422 | if (netif_running(dev)) | 1439 | if (netif_running(dev)) |
| 1423 | schedule_delayed_work(&skge->link_thread, LINK_HZ); | 1440 | mod_timer(&skge->link_timer, jiffies + LINK_HZ); |
| 1424 | } | 1441 | } |
| 1425 | 1442 | ||
| 1426 | static void genesis_mac_init(struct skge_hw *hw, int port) | 1443 | static void genesis_mac_init(struct skge_hw *hw, int port) |
| @@ -2323,7 +2340,7 @@ static void skge_phy_reset(struct skge_port *skge) | |||
| 2323 | netif_stop_queue(skge->netdev); | 2340 | netif_stop_queue(skge->netdev); |
| 2324 | netif_carrier_off(skge->netdev); | 2341 | netif_carrier_off(skge->netdev); |
| 2325 | 2342 | ||
| 2326 | mutex_lock(&hw->phy_mutex); | 2343 | spin_lock_bh(&hw->phy_lock); |
| 2327 | if (hw->chip_id == CHIP_ID_GENESIS) { | 2344 | if (hw->chip_id == CHIP_ID_GENESIS) { |
| 2328 | genesis_reset(hw, port); | 2345 | genesis_reset(hw, port); |
| 2329 | genesis_mac_init(hw, port); | 2346 | genesis_mac_init(hw, port); |
| @@ -2331,7 +2348,7 @@ static void skge_phy_reset(struct skge_port *skge) | |||
| 2331 | yukon_reset(hw, port); | 2348 | yukon_reset(hw, port); |
| 2332 | yukon_init(hw, port); | 2349 | yukon_init(hw, port); |
| 2333 | } | 2350 | } |
| 2334 | mutex_unlock(&hw->phy_mutex); | 2351 | spin_unlock_bh(&hw->phy_lock); |
| 2335 | 2352 | ||
| 2336 | dev->set_multicast_list(dev); | 2353 | dev->set_multicast_list(dev); |
| 2337 | } | 2354 | } |
| @@ -2354,12 +2371,12 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
| 2354 | /* fallthru */ | 2371 | /* fallthru */ |
| 2355 | case SIOCGMIIREG: { | 2372 | case SIOCGMIIREG: { |
| 2356 | u16 val = 0; | 2373 | u16 val = 0; |
| 2357 | mutex_lock(&hw->phy_mutex); | 2374 | spin_lock_bh(&hw->phy_lock); |
| 2358 | if (hw->chip_id == CHIP_ID_GENESIS) | 2375 | if (hw->chip_id == CHIP_ID_GENESIS) |
| 2359 | err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); | 2376 | err = __xm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); |
| 2360 | else | 2377 | else |
| 2361 | err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); | 2378 | err = __gm_phy_read(hw, skge->port, data->reg_num & 0x1f, &val); |
| 2362 | mutex_unlock(&hw->phy_mutex); | 2379 | spin_unlock_bh(&hw->phy_lock); |
| 2363 | data->val_out = val; | 2380 | data->val_out = val; |
| 2364 | break; | 2381 | break; |
| 2365 | } | 2382 | } |
| @@ -2368,14 +2385,14 @@ static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
| 2368 | if (!capable(CAP_NET_ADMIN)) | 2385 | if (!capable(CAP_NET_ADMIN)) |
| 2369 | return -EPERM; | 2386 | return -EPERM; |
| 2370 | 2387 | ||
| 2371 | mutex_lock(&hw->phy_mutex); | 2388 | spin_lock_bh(&hw->phy_lock); |
| 2372 | if (hw->chip_id == CHIP_ID_GENESIS) | 2389 | if (hw->chip_id == CHIP_ID_GENESIS) |
| 2373 | err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f, | 2390 | err = xm_phy_write(hw, skge->port, data->reg_num & 0x1f, |
| 2374 | data->val_in); | 2391 | data->val_in); |
| 2375 | else | 2392 | else |
| 2376 | err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f, | 2393 | err = gm_phy_write(hw, skge->port, data->reg_num & 0x1f, |
| 2377 | data->val_in); | 2394 | data->val_in); |
| 2378 | mutex_unlock(&hw->phy_mutex); | 2395 | spin_unlock_bh(&hw->phy_lock); |
| 2379 | break; | 2396 | break; |
| 2380 | } | 2397 | } |
| 2381 | return err; | 2398 | return err; |
| @@ -2481,12 +2498,12 @@ static int skge_up(struct net_device *dev) | |||
| 2481 | goto free_rx_ring; | 2498 | goto free_rx_ring; |
| 2482 | 2499 | ||
| 2483 | /* Initialize MAC */ | 2500 | /* Initialize MAC */ |
| 2484 | mutex_lock(&hw->phy_mutex); | 2501 | spin_lock_bh(&hw->phy_lock); |
| 2485 | if (hw->chip_id == CHIP_ID_GENESIS) | 2502 | if (hw->chip_id == CHIP_ID_GENESIS) |
| 2486 | genesis_mac_init(hw, port); | 2503 | genesis_mac_init(hw, port); |
| 2487 | else | 2504 | else |
| 2488 | yukon_mac_init(hw, port); | 2505 | yukon_mac_init(hw, port); |
| 2489 | mutex_unlock(&hw->phy_mutex); | 2506 | spin_unlock_bh(&hw->phy_lock); |
| 2490 | 2507 | ||
| 2491 | /* Configure RAMbuffers */ | 2508 | /* Configure RAMbuffers */ |
| 2492 | chunk = hw->ram_size / ((hw->ports + 1)*2); | 2509 | chunk = hw->ram_size / ((hw->ports + 1)*2); |
| @@ -2504,6 +2521,11 @@ static int skge_up(struct net_device *dev) | |||
| 2504 | skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); | 2521 | skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); |
| 2505 | skge_led(skge, LED_MODE_ON); | 2522 | skge_led(skge, LED_MODE_ON); |
| 2506 | 2523 | ||
| 2524 | spin_lock_irq(&hw->hw_lock); | ||
| 2525 | hw->intr_mask |= portmask[port]; | ||
| 2526 | skge_write32(hw, B0_IMSK, hw->intr_mask); | ||
| 2527 | spin_unlock_irq(&hw->hw_lock); | ||
| 2528 | |||
| 2507 | netif_poll_enable(dev); | 2529 | netif_poll_enable(dev); |
| 2508 | return 0; | 2530 | return 0; |
| 2509 | 2531 | ||
| @@ -2530,8 +2552,17 @@ static int skge_down(struct net_device *dev) | |||
| 2530 | printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); | 2552 | printk(KERN_INFO PFX "%s: disabling interface\n", dev->name); |
| 2531 | 2553 | ||
| 2532 | netif_stop_queue(dev); | 2554 | netif_stop_queue(dev); |
| 2555 | |||
| 2533 | if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC) | 2556 | if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC) |
| 2534 | cancel_delayed_work(&skge->link_thread); | 2557 | del_timer_sync(&skge->link_timer); |
| 2558 | |||
| 2559 | netif_poll_disable(dev); | ||
| 2560 | netif_carrier_off(dev); | ||
| 2561 | |||
| 2562 | spin_lock_irq(&hw->hw_lock); | ||
| 2563 | hw->intr_mask &= ~portmask[port]; | ||
| 2564 | skge_write32(hw, B0_IMSK, hw->intr_mask); | ||
| 2565 | spin_unlock_irq(&hw->hw_lock); | ||
| 2535 | 2566 | ||
| 2536 | skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF); | 2567 | skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF); |
| 2537 | if (hw->chip_id == CHIP_ID_GENESIS) | 2568 | if (hw->chip_id == CHIP_ID_GENESIS) |
| @@ -2575,8 +2606,10 @@ static int skge_down(struct net_device *dev) | |||
| 2575 | 2606 | ||
| 2576 | skge_led(skge, LED_MODE_OFF); | 2607 | skge_led(skge, LED_MODE_OFF); |
| 2577 | 2608 | ||
| 2578 | netif_poll_disable(dev); | 2609 | netif_tx_lock_bh(dev); |
| 2579 | skge_tx_clean(dev); | 2610 | skge_tx_clean(dev); |
| 2611 | netif_tx_unlock_bh(dev); | ||
| 2612 | |||
| 2580 | skge_rx_clean(skge); | 2613 | skge_rx_clean(skge); |
| 2581 | 2614 | ||
| 2582 | kfree(skge->rx_ring.start); | 2615 | kfree(skge->rx_ring.start); |
| @@ -2721,7 +2754,6 @@ static void skge_tx_clean(struct net_device *dev) | |||
| 2721 | struct skge_port *skge = netdev_priv(dev); | 2754 | struct skge_port *skge = netdev_priv(dev); |
| 2722 | struct skge_element *e; | 2755 | struct skge_element *e; |
| 2723 | 2756 | ||
| 2724 | netif_tx_lock_bh(dev); | ||
| 2725 | for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) { | 2757 | for (e = skge->tx_ring.to_clean; e != skge->tx_ring.to_use; e = e->next) { |
| 2726 | struct skge_tx_desc *td = e->desc; | 2758 | struct skge_tx_desc *td = e->desc; |
| 2727 | skge_tx_free(skge, e, td->control); | 2759 | skge_tx_free(skge, e, td->control); |
| @@ -2730,7 +2762,6 @@ static void skge_tx_clean(struct net_device *dev) | |||
| 2730 | 2762 | ||
| 2731 | skge->tx_ring.to_clean = e; | 2763 | skge->tx_ring.to_clean = e; |
| 2732 | netif_wake_queue(dev); | 2764 | netif_wake_queue(dev); |
| 2733 | netif_tx_unlock_bh(dev); | ||
| 2734 | } | 2765 | } |
| 2735 | 2766 | ||
| 2736 | static void skge_tx_timeout(struct net_device *dev) | 2767 | static void skge_tx_timeout(struct net_device *dev) |
| @@ -3049,7 +3080,7 @@ static int skge_poll(struct net_device *dev, int *budget) | |||
| 3049 | 3080 | ||
| 3050 | spin_lock_irqsave(&hw->hw_lock, flags); | 3081 | spin_lock_irqsave(&hw->hw_lock, flags); |
| 3051 | __netif_rx_complete(dev); | 3082 | __netif_rx_complete(dev); |
| 3052 | hw->intr_mask |= irqmask[skge->port]; | 3083 | hw->intr_mask |= napimask[skge->port]; |
| 3053 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 3084 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
| 3054 | skge_read32(hw, B0_IMSK); | 3085 | skge_read32(hw, B0_IMSK); |
| 3055 | spin_unlock_irqrestore(&hw->hw_lock, flags); | 3086 | spin_unlock_irqrestore(&hw->hw_lock, flags); |
| @@ -3160,28 +3191,29 @@ static void skge_error_irq(struct skge_hw *hw) | |||
| 3160 | } | 3191 | } |
| 3161 | 3192 | ||
| 3162 | /* | 3193 | /* |
| 3163 | * Interrupt from PHY are handled in work queue | 3194 | * Interrupt from PHY are handled in tasklet (softirq) |
| 3164 | * because accessing phy registers requires spin wait which might | 3195 | * because accessing phy registers requires spin wait which might |
| 3165 | * cause excess interrupt latency. | 3196 | * cause excess interrupt latency. |
| 3166 | */ | 3197 | */ |
| 3167 | static void skge_extirq(struct work_struct *work) | 3198 | static void skge_extirq(unsigned long arg) |
| 3168 | { | 3199 | { |
| 3169 | struct skge_hw *hw = container_of(work, struct skge_hw, phy_work); | 3200 | struct skge_hw *hw = (struct skge_hw *) arg; |
| 3170 | int port; | 3201 | int port; |
| 3171 | 3202 | ||
| 3172 | mutex_lock(&hw->phy_mutex); | ||
| 3173 | for (port = 0; port < hw->ports; port++) { | 3203 | for (port = 0; port < hw->ports; port++) { |
| 3174 | struct net_device *dev = hw->dev[port]; | 3204 | struct net_device *dev = hw->dev[port]; |
| 3175 | struct skge_port *skge = netdev_priv(dev); | ||
| 3176 | 3205 | ||
| 3177 | if (netif_running(dev)) { | 3206 | if (netif_running(dev)) { |
| 3207 | struct skge_port *skge = netdev_priv(dev); | ||
| 3208 | |||
| 3209 | spin_lock(&hw->phy_lock); | ||
| 3178 | if (hw->chip_id != CHIP_ID_GENESIS) | 3210 | if (hw->chip_id != CHIP_ID_GENESIS) |
| 3179 | yukon_phy_intr(skge); | 3211 | yukon_phy_intr(skge); |
| 3180 | else if (hw->phy_type == SK_PHY_BCOM) | 3212 | else if (hw->phy_type == SK_PHY_BCOM) |
| 3181 | bcom_phy_intr(skge); | 3213 | bcom_phy_intr(skge); |
| 3214 | spin_unlock(&hw->phy_lock); | ||
| 3182 | } | 3215 | } |
| 3183 | } | 3216 | } |
| 3184 | mutex_unlock(&hw->phy_mutex); | ||
| 3185 | 3217 | ||
| 3186 | spin_lock_irq(&hw->hw_lock); | 3218 | spin_lock_irq(&hw->hw_lock); |
| 3187 | hw->intr_mask |= IS_EXT_REG; | 3219 | hw->intr_mask |= IS_EXT_REG; |
| @@ -3206,7 +3238,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id) | |||
| 3206 | status &= hw->intr_mask; | 3238 | status &= hw->intr_mask; |
| 3207 | if (status & IS_EXT_REG) { | 3239 | if (status & IS_EXT_REG) { |
| 3208 | hw->intr_mask &= ~IS_EXT_REG; | 3240 | hw->intr_mask &= ~IS_EXT_REG; |
| 3209 | schedule_work(&hw->phy_work); | 3241 | tasklet_schedule(&hw->phy_task); |
| 3210 | } | 3242 | } |
| 3211 | 3243 | ||
| 3212 | if (status & (IS_XA1_F|IS_R1_F)) { | 3244 | if (status & (IS_XA1_F|IS_R1_F)) { |
| @@ -3275,24 +3307,35 @@ static int skge_set_mac_address(struct net_device *dev, void *p) | |||
| 3275 | struct skge_hw *hw = skge->hw; | 3307 | struct skge_hw *hw = skge->hw; |
| 3276 | unsigned port = skge->port; | 3308 | unsigned port = skge->port; |
| 3277 | const struct sockaddr *addr = p; | 3309 | const struct sockaddr *addr = p; |
| 3310 | u16 ctrl; | ||
| 3278 | 3311 | ||
| 3279 | if (!is_valid_ether_addr(addr->sa_data)) | 3312 | if (!is_valid_ether_addr(addr->sa_data)) |
| 3280 | return -EADDRNOTAVAIL; | 3313 | return -EADDRNOTAVAIL; |
| 3281 | 3314 | ||
| 3282 | mutex_lock(&hw->phy_mutex); | ||
| 3283 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); | 3315 | memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); |
| 3284 | memcpy_toio(hw->regs + B2_MAC_1 + port*8, | ||
| 3285 | dev->dev_addr, ETH_ALEN); | ||
| 3286 | memcpy_toio(hw->regs + B2_MAC_2 + port*8, | ||
| 3287 | dev->dev_addr, ETH_ALEN); | ||
| 3288 | 3316 | ||
| 3289 | if (hw->chip_id == CHIP_ID_GENESIS) | 3317 | if (!netif_running(dev)) { |
| 3290 | xm_outaddr(hw, port, XM_SA, dev->dev_addr); | 3318 | memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN); |
| 3291 | else { | 3319 | memcpy_toio(hw->regs + B2_MAC_2 + port*8, dev->dev_addr, ETH_ALEN); |
| 3292 | gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr); | 3320 | } else { |
| 3293 | gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr); | 3321 | /* disable Rx */ |
| 3322 | spin_lock_bh(&hw->phy_lock); | ||
| 3323 | ctrl = gma_read16(hw, port, GM_GP_CTRL); | ||
| 3324 | gma_write16(hw, port, GM_GP_CTRL, ctrl & ~GM_GPCR_RX_ENA); | ||
| 3325 | |||
| 3326 | memcpy_toio(hw->regs + B2_MAC_1 + port*8, dev->dev_addr, ETH_ALEN); | ||
| 3327 | memcpy_toio(hw->regs + B2_MAC_2 + port*8, dev->dev_addr, ETH_ALEN); | ||
| 3328 | |||
| 3329 | if (hw->chip_id == CHIP_ID_GENESIS) | ||
| 3330 | xm_outaddr(hw, port, XM_SA, dev->dev_addr); | ||
| 3331 | else { | ||
| 3332 | gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr); | ||
| 3333 | gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr); | ||
| 3334 | } | ||
| 3335 | |||
| 3336 | gma_write16(hw, port, GM_GP_CTRL, ctrl); | ||
| 3337 | spin_unlock_bh(&hw->phy_lock); | ||
| 3294 | } | 3338 | } |
| 3295 | mutex_unlock(&hw->phy_mutex); | ||
| 3296 | 3339 | ||
| 3297 | return 0; | 3340 | return 0; |
| 3298 | } | 3341 | } |
| @@ -3407,10 +3450,9 @@ static int skge_reset(struct skge_hw *hw) | |||
| 3407 | else | 3450 | else |
| 3408 | hw->ram_size = t8 * 4096; | 3451 | hw->ram_size = t8 * 4096; |
| 3409 | 3452 | ||
| 3410 | hw->intr_mask = IS_HW_ERR | IS_PORT_1; | 3453 | hw->intr_mask = IS_HW_ERR; |
| 3411 | if (hw->ports > 1) | ||
| 3412 | hw->intr_mask |= IS_PORT_2; | ||
| 3413 | 3454 | ||
| 3455 | /* Use PHY IRQ for all but fiber based Genesis board */ | ||
| 3414 | if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)) | 3456 | if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)) |
| 3415 | hw->intr_mask |= IS_EXT_REG; | 3457 | hw->intr_mask |= IS_EXT_REG; |
| 3416 | 3458 | ||
| @@ -3478,14 +3520,12 @@ static int skge_reset(struct skge_hw *hw) | |||
| 3478 | 3520 | ||
| 3479 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 3521 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
| 3480 | 3522 | ||
| 3481 | mutex_lock(&hw->phy_mutex); | ||
| 3482 | for (i = 0; i < hw->ports; i++) { | 3523 | for (i = 0; i < hw->ports; i++) { |
| 3483 | if (hw->chip_id == CHIP_ID_GENESIS) | 3524 | if (hw->chip_id == CHIP_ID_GENESIS) |
| 3484 | genesis_reset(hw, i); | 3525 | genesis_reset(hw, i); |
| 3485 | else | 3526 | else |
| 3486 | yukon_reset(hw, i); | 3527 | yukon_reset(hw, i); |
| 3487 | } | 3528 | } |
| 3488 | mutex_unlock(&hw->phy_mutex); | ||
| 3489 | 3529 | ||
| 3490 | return 0; | 3530 | return 0; |
| 3491 | } | 3531 | } |
| @@ -3533,6 +3573,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
| 3533 | skge->netdev = dev; | 3573 | skge->netdev = dev; |
| 3534 | skge->hw = hw; | 3574 | skge->hw = hw; |
| 3535 | skge->msg_enable = netif_msg_init(debug, default_msg); | 3575 | skge->msg_enable = netif_msg_init(debug, default_msg); |
| 3576 | |||
| 3536 | skge->tx_ring.count = DEFAULT_TX_RING_SIZE; | 3577 | skge->tx_ring.count = DEFAULT_TX_RING_SIZE; |
| 3537 | skge->rx_ring.count = DEFAULT_RX_RING_SIZE; | 3578 | skge->rx_ring.count = DEFAULT_RX_RING_SIZE; |
| 3538 | 3579 | ||
| @@ -3549,7 +3590,7 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
| 3549 | skge->port = port; | 3590 | skge->port = port; |
| 3550 | 3591 | ||
| 3551 | /* Only used for Genesis XMAC */ | 3592 | /* Only used for Genesis XMAC */ |
| 3552 | INIT_DELAYED_WORK(&skge->link_thread, xm_link_timer); | 3593 | setup_timer(&skge->link_timer, xm_link_timer, (unsigned long) skge); |
| 3553 | 3594 | ||
| 3554 | if (hw->chip_id != CHIP_ID_GENESIS) { | 3595 | if (hw->chip_id != CHIP_ID_GENESIS) { |
| 3555 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; | 3596 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; |
| @@ -3631,9 +3672,9 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
| 3631 | } | 3672 | } |
| 3632 | 3673 | ||
| 3633 | hw->pdev = pdev; | 3674 | hw->pdev = pdev; |
| 3634 | mutex_init(&hw->phy_mutex); | ||
| 3635 | INIT_WORK(&hw->phy_work, skge_extirq); | ||
| 3636 | spin_lock_init(&hw->hw_lock); | 3675 | spin_lock_init(&hw->hw_lock); |
| 3676 | spin_lock_init(&hw->phy_lock); | ||
| 3677 | tasklet_init(&hw->phy_task, &skge_extirq, (unsigned long) hw); | ||
| 3637 | 3678 | ||
| 3638 | hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000); | 3679 | hw->regs = ioremap_nocache(pci_resource_start(pdev, 0), 0x4000); |
| 3639 | if (!hw->regs) { | 3680 | if (!hw->regs) { |
| @@ -3719,6 +3760,8 @@ static void __devexit skge_remove(struct pci_dev *pdev) | |||
| 3719 | dev0 = hw->dev[0]; | 3760 | dev0 = hw->dev[0]; |
| 3720 | unregister_netdev(dev0); | 3761 | unregister_netdev(dev0); |
| 3721 | 3762 | ||
| 3763 | tasklet_disable(&hw->phy_task); | ||
| 3764 | |||
| 3722 | spin_lock_irq(&hw->hw_lock); | 3765 | spin_lock_irq(&hw->hw_lock); |
| 3723 | hw->intr_mask = 0; | 3766 | hw->intr_mask = 0; |
| 3724 | skge_write32(hw, B0_IMSK, 0); | 3767 | skge_write32(hw, B0_IMSK, 0); |
| @@ -3741,21 +3784,6 @@ static void __devexit skge_remove(struct pci_dev *pdev) | |||
| 3741 | } | 3784 | } |
| 3742 | 3785 | ||
| 3743 | #ifdef CONFIG_PM | 3786 | #ifdef CONFIG_PM |
| 3744 | static int vaux_avail(struct pci_dev *pdev) | ||
| 3745 | { | ||
| 3746 | int pm_cap; | ||
| 3747 | |||
| 3748 | pm_cap = pci_find_capability(pdev, PCI_CAP_ID_PM); | ||
| 3749 | if (pm_cap) { | ||
| 3750 | u16 ctl; | ||
| 3751 | pci_read_config_word(pdev, pm_cap + PCI_PM_PMC, &ctl); | ||
| 3752 | if (ctl & PCI_PM_CAP_AUX_POWER) | ||
| 3753 | return 1; | ||
| 3754 | } | ||
| 3755 | return 0; | ||
| 3756 | } | ||
| 3757 | |||
| 3758 | |||
| 3759 | static int skge_suspend(struct pci_dev *pdev, pm_message_t state) | 3787 | static int skge_suspend(struct pci_dev *pdev, pm_message_t state) |
| 3760 | { | 3788 | { |
| 3761 | struct skge_hw *hw = pci_get_drvdata(pdev); | 3789 | struct skge_hw *hw = pci_get_drvdata(pdev); |
| @@ -3777,10 +3805,6 @@ static int skge_suspend(struct pci_dev *pdev, pm_message_t state) | |||
| 3777 | wol |= skge->wol; | 3805 | wol |= skge->wol; |
| 3778 | } | 3806 | } |
| 3779 | 3807 | ||
| 3780 | if (wol && vaux_avail(pdev)) | ||
| 3781 | skge_write8(hw, B0_POWER_CTRL, | ||
| 3782 | PC_VAUX_ENA | PC_VCC_ENA | PC_VAUX_ON | PC_VCC_OFF); | ||
| 3783 | |||
| 3784 | skge_write32(hw, B0_IMSK, 0); | 3808 | skge_write32(hw, B0_IMSK, 0); |
| 3785 | pci_enable_wake(pdev, pci_choose_state(pdev, state), wol); | 3809 | pci_enable_wake(pdev, pci_choose_state(pdev, state), wol); |
| 3786 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 3810 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); |
| @@ -3826,6 +3850,28 @@ out: | |||
| 3826 | } | 3850 | } |
| 3827 | #endif | 3851 | #endif |
| 3828 | 3852 | ||
| 3853 | static void skge_shutdown(struct pci_dev *pdev) | ||
| 3854 | { | ||
| 3855 | struct skge_hw *hw = pci_get_drvdata(pdev); | ||
| 3856 | int i, wol = 0; | ||
| 3857 | |||
| 3858 | for (i = 0; i < hw->ports; i++) { | ||
| 3859 | struct net_device *dev = hw->dev[i]; | ||
| 3860 | struct skge_port *skge = netdev_priv(dev); | ||
| 3861 | |||
| 3862 | if (skge->wol) | ||
| 3863 | skge_wol_init(skge); | ||
| 3864 | wol |= skge->wol; | ||
| 3865 | } | ||
| 3866 | |||
| 3867 | pci_enable_wake(pdev, PCI_D3hot, wol); | ||
| 3868 | pci_enable_wake(pdev, PCI_D3cold, wol); | ||
| 3869 | |||
| 3870 | pci_disable_device(pdev); | ||
| 3871 | pci_set_power_state(pdev, PCI_D3hot); | ||
| 3872 | |||
| 3873 | } | ||
| 3874 | |||
| 3829 | static struct pci_driver skge_driver = { | 3875 | static struct pci_driver skge_driver = { |
| 3830 | .name = DRV_NAME, | 3876 | .name = DRV_NAME, |
| 3831 | .id_table = skge_id_table, | 3877 | .id_table = skge_id_table, |
| @@ -3835,6 +3881,7 @@ static struct pci_driver skge_driver = { | |||
| 3835 | .suspend = skge_suspend, | 3881 | .suspend = skge_suspend, |
| 3836 | .resume = skge_resume, | 3882 | .resume = skge_resume, |
| 3837 | #endif | 3883 | #endif |
| 3884 | .shutdown = skge_shutdown, | ||
| 3838 | }; | 3885 | }; |
| 3839 | 3886 | ||
| 3840 | static int __init skge_init_module(void) | 3887 | static int __init skge_init_module(void) |
diff --git a/drivers/net/skge.h b/drivers/net/skge.h index e9354dfa7e9a..86467ae74d45 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h | |||
| @@ -2424,8 +2424,8 @@ struct skge_hw { | |||
| 2424 | u32 ram_size; | 2424 | u32 ram_size; |
| 2425 | u32 ram_offset; | 2425 | u32 ram_offset; |
| 2426 | u16 phy_addr; | 2426 | u16 phy_addr; |
| 2427 | struct work_struct phy_work; | 2427 | spinlock_t phy_lock; |
| 2428 | struct mutex phy_mutex; | 2428 | struct tasklet_struct phy_task; |
| 2429 | }; | 2429 | }; |
| 2430 | 2430 | ||
| 2431 | enum pause_control { | 2431 | enum pause_control { |
| @@ -2457,7 +2457,7 @@ struct skge_port { | |||
| 2457 | 2457 | ||
| 2458 | struct net_device_stats net_stats; | 2458 | struct net_device_stats net_stats; |
| 2459 | 2459 | ||
| 2460 | struct delayed_work link_thread; | 2460 | struct timer_list link_timer; |
| 2461 | enum pause_control flow_control; | 2461 | enum pause_control flow_control; |
| 2462 | enum pause_status flow_status; | 2462 | enum pause_status flow_status; |
| 2463 | u8 rx_csum; | 2463 | u8 rx_csum; |
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index ab0ab92583fe..ac36152c68bf 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
| @@ -49,7 +49,7 @@ | |||
| 49 | #include "sky2.h" | 49 | #include "sky2.h" |
| 50 | 50 | ||
| 51 | #define DRV_NAME "sky2" | 51 | #define DRV_NAME "sky2" |
| 52 | #define DRV_VERSION "1.13" | 52 | #define DRV_VERSION "1.14" |
| 53 | #define PFX DRV_NAME " " | 53 | #define PFX DRV_NAME " " |
| 54 | 54 | ||
| 55 | /* | 55 | /* |
| @@ -123,7 +123,10 @@ static const struct pci_device_id sky2_id_table[] = { | |||
| 123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ | 123 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4361) }, /* 88E8050 */ |
| 124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */ | 124 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4362) }, /* 88E8053 */ |
| 125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */ | 125 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4363) }, /* 88E8055 */ |
| 126 | #ifdef broken | ||
| 127 | /* This device causes data corruption problems that are not resolved */ | ||
| 126 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */ | 128 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4364) }, /* 88E8056 */ |
| 129 | #endif | ||
| 127 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */ | 130 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4366) }, /* 88EC036 */ |
| 128 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */ | 131 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4367) }, /* 88EC032 */ |
| 129 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */ | 132 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4368) }, /* 88EC034 */ |
| @@ -510,9 +513,9 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
| 510 | ledover &= ~PHY_M_LED_MO_RX; | 513 | ledover &= ~PHY_M_LED_MO_RX; |
| 511 | } | 514 | } |
| 512 | 515 | ||
| 513 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev == CHIP_REV_YU_EC_A1) { | 516 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && |
| 517 | hw->chip_rev == CHIP_REV_YU_EC_U_A1) { | ||
| 514 | /* apply fixes in PHY AFE */ | 518 | /* apply fixes in PHY AFE */ |
| 515 | pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR); | ||
| 516 | gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 255); | 519 | gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 255); |
| 517 | 520 | ||
| 518 | /* increase differential signal amplitude in 10BASE-T */ | 521 | /* increase differential signal amplitude in 10BASE-T */ |
| @@ -524,7 +527,7 @@ static void sky2_phy_init(struct sky2_hw *hw, unsigned port) | |||
| 524 | gm_phy_write(hw, port, 0x17, 0x2002); | 527 | gm_phy_write(hw, port, 0x17, 0x2002); |
| 525 | 528 | ||
| 526 | /* set page register to 0 */ | 529 | /* set page register to 0 */ |
| 527 | gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg); | 530 | gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 0); |
| 528 | } else if (hw->chip_id != CHIP_ID_YUKON_EX) { | 531 | } else if (hw->chip_id != CHIP_ID_YUKON_EX) { |
| 529 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); | 532 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); |
| 530 | 533 | ||
| @@ -740,12 +743,17 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) | |||
| 740 | if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) { | 743 | if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) { |
| 741 | sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8); | 744 | sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8); |
| 742 | sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8); | 745 | sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8); |
| 743 | if (hw->dev[port]->mtu > ETH_DATA_LEN) { | 746 | |
| 744 | /* set Tx GMAC FIFO Almost Empty Threshold */ | 747 | /* set Tx GMAC FIFO Almost Empty Threshold */ |
| 745 | sky2_write32(hw, SK_REG(port, TX_GMF_AE_THR), 0x180); | 748 | sky2_write32(hw, SK_REG(port, TX_GMF_AE_THR), |
| 746 | /* Disable Store & Forward mode for TX */ | 749 | (ECU_JUMBO_WM << 16) | ECU_AE_THR); |
| 747 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), TX_STFW_DIS); | 750 | |
| 748 | } | 751 | if (hw->dev[port]->mtu > ETH_DATA_LEN) |
| 752 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | ||
| 753 | TX_JUMBO_ENA | TX_STFW_DIS); | ||
| 754 | else | ||
| 755 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | ||
| 756 | TX_JUMBO_DIS | TX_STFW_ENA); | ||
| 749 | } | 757 | } |
| 750 | 758 | ||
| 751 | } | 759 | } |
| @@ -1278,7 +1286,7 @@ static int sky2_up(struct net_device *dev) | |||
| 1278 | /* Set almost empty threshold */ | 1286 | /* Set almost empty threshold */ |
| 1279 | if (hw->chip_id == CHIP_ID_YUKON_EC_U | 1287 | if (hw->chip_id == CHIP_ID_YUKON_EC_U |
| 1280 | && hw->chip_rev == CHIP_REV_YU_EC_U_A0) | 1288 | && hw->chip_rev == CHIP_REV_YU_EC_U_A0) |
| 1281 | sky2_write16(hw, Q_ADDR(txqaddr[port], Q_AL), 0x1a0); | 1289 | sky2_write16(hw, Q_ADDR(txqaddr[port], Q_AL), ECU_TXFF_LEV); |
| 1282 | 1290 | ||
| 1283 | sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, | 1291 | sky2_prefetch_init(hw, txqaddr[port], sky2->tx_le_map, |
| 1284 | TX_RING_SIZE - 1); | 1292 | TX_RING_SIZE - 1); |
| @@ -1561,6 +1569,7 @@ static int sky2_down(struct net_device *dev) | |||
| 1561 | 1569 | ||
| 1562 | /* Stop more packets from being queued */ | 1570 | /* Stop more packets from being queued */ |
| 1563 | netif_stop_queue(dev); | 1571 | netif_stop_queue(dev); |
| 1572 | netif_carrier_off(dev); | ||
| 1564 | 1573 | ||
| 1565 | /* Disable port IRQ */ | 1574 | /* Disable port IRQ */ |
| 1566 | imask = sky2_read32(hw, B0_IMSK); | 1575 | imask = sky2_read32(hw, B0_IMSK); |
| @@ -1583,13 +1592,6 @@ static int sky2_down(struct net_device *dev) | |||
| 1583 | sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), | 1592 | sky2_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), |
| 1584 | RB_RST_SET | RB_DIS_OP_MD); | 1593 | RB_RST_SET | RB_DIS_OP_MD); |
| 1585 | 1594 | ||
| 1586 | /* WA for dev. #4.209 */ | ||
| 1587 | if (hw->chip_id == CHIP_ID_YUKON_EC_U | ||
| 1588 | && (hw->chip_rev == CHIP_REV_YU_EC_U_A1 || hw->chip_rev == CHIP_REV_YU_EC_U_B0)) | ||
| 1589 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | ||
| 1590 | sky2->speed != SPEED_1000 ? | ||
| 1591 | TX_STFW_ENA : TX_STFW_DIS); | ||
| 1592 | |||
| 1593 | ctrl = gma_read16(hw, port, GM_GP_CTRL); | 1595 | ctrl = gma_read16(hw, port, GM_GP_CTRL); |
| 1594 | ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA); | 1596 | ctrl &= ~(GM_GPCR_TX_ENA | GM_GPCR_RX_ENA); |
| 1595 | gma_write16(hw, port, GM_GP_CTRL, ctrl); | 1597 | gma_write16(hw, port, GM_GP_CTRL, ctrl); |
| @@ -1889,6 +1891,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1889 | { | 1891 | { |
| 1890 | struct sky2_port *sky2 = netdev_priv(dev); | 1892 | struct sky2_port *sky2 = netdev_priv(dev); |
| 1891 | struct sky2_hw *hw = sky2->hw; | 1893 | struct sky2_hw *hw = sky2->hw; |
| 1894 | unsigned port = sky2->port; | ||
| 1892 | int err; | 1895 | int err; |
| 1893 | u16 ctl, mode; | 1896 | u16 ctl, mode; |
| 1894 | u32 imask; | 1897 | u32 imask; |
| @@ -1896,9 +1899,8 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1896 | if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) | 1899 | if (new_mtu < ETH_ZLEN || new_mtu > ETH_JUMBO_MTU) |
| 1897 | return -EINVAL; | 1900 | return -EINVAL; |
| 1898 | 1901 | ||
| 1899 | /* TSO on Yukon Ultra and MTU > 1500 not supported */ | 1902 | if (new_mtu > ETH_DATA_LEN && hw->chip_id == CHIP_ID_YUKON_FE) |
| 1900 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && new_mtu > ETH_DATA_LEN) | 1903 | return -EINVAL; |
| 1901 | dev->features &= ~NETIF_F_TSO; | ||
| 1902 | 1904 | ||
| 1903 | if (!netif_running(dev)) { | 1905 | if (!netif_running(dev)) { |
| 1904 | dev->mtu = new_mtu; | 1906 | dev->mtu = new_mtu; |
| @@ -1914,8 +1916,18 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1914 | 1916 | ||
| 1915 | synchronize_irq(hw->pdev->irq); | 1917 | synchronize_irq(hw->pdev->irq); |
| 1916 | 1918 | ||
| 1917 | ctl = gma_read16(hw, sky2->port, GM_GP_CTRL); | 1919 | if (hw->chip_id == CHIP_ID_YUKON_EC_U || hw->chip_id == CHIP_ID_YUKON_EX) { |
| 1918 | gma_write16(hw, sky2->port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA); | 1920 | if (new_mtu > ETH_DATA_LEN) { |
| 1921 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | ||
| 1922 | TX_JUMBO_ENA | TX_STFW_DIS); | ||
| 1923 | dev->features &= NETIF_F_TSO | NETIF_F_SG | NETIF_F_IP_CSUM; | ||
| 1924 | } else | ||
| 1925 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | ||
| 1926 | TX_JUMBO_DIS | TX_STFW_ENA); | ||
| 1927 | } | ||
| 1928 | |||
| 1929 | ctl = gma_read16(hw, port, GM_GP_CTRL); | ||
| 1930 | gma_write16(hw, port, GM_GP_CTRL, ctl & ~GM_GPCR_RX_ENA); | ||
| 1919 | sky2_rx_stop(sky2); | 1931 | sky2_rx_stop(sky2); |
| 1920 | sky2_rx_clean(sky2); | 1932 | sky2_rx_clean(sky2); |
| 1921 | 1933 | ||
| @@ -1927,9 +1939,9 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1927 | if (dev->mtu > ETH_DATA_LEN) | 1939 | if (dev->mtu > ETH_DATA_LEN) |
| 1928 | mode |= GM_SMOD_JUMBO_ENA; | 1940 | mode |= GM_SMOD_JUMBO_ENA; |
| 1929 | 1941 | ||
| 1930 | gma_write16(hw, sky2->port, GM_SERIAL_MODE, mode); | 1942 | gma_write16(hw, port, GM_SERIAL_MODE, mode); |
| 1931 | 1943 | ||
| 1932 | sky2_write8(hw, RB_ADDR(rxqaddr[sky2->port], RB_CTRL), RB_ENA_OP_MD); | 1944 | sky2_write8(hw, RB_ADDR(rxqaddr[port], RB_CTRL), RB_ENA_OP_MD); |
| 1933 | 1945 | ||
| 1934 | err = sky2_rx_start(sky2); | 1946 | err = sky2_rx_start(sky2); |
| 1935 | sky2_write32(hw, B0_IMSK, imask); | 1947 | sky2_write32(hw, B0_IMSK, imask); |
| @@ -1937,7 +1949,7 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
| 1937 | if (err) | 1949 | if (err) |
| 1938 | dev_close(dev); | 1950 | dev_close(dev); |
| 1939 | else { | 1951 | else { |
| 1940 | gma_write16(hw, sky2->port, GM_GP_CTRL, ctl); | 1952 | gma_write16(hw, port, GM_GP_CTRL, ctl); |
| 1941 | 1953 | ||
| 1942 | netif_poll_enable(hw->dev[0]); | 1954 | netif_poll_enable(hw->dev[0]); |
| 1943 | netif_wake_queue(dev); | 1955 | netif_wake_queue(dev); |
| @@ -2339,26 +2351,22 @@ static void sky2_mac_intr(struct sky2_hw *hw, unsigned port) | |||
| 2339 | } | 2351 | } |
| 2340 | } | 2352 | } |
| 2341 | 2353 | ||
| 2342 | /* This should never happen it is a fatal situation */ | 2354 | /* This should never happen it is a bug. */ |
| 2343 | static void sky2_descriptor_error(struct sky2_hw *hw, unsigned port, | 2355 | static void sky2_le_error(struct sky2_hw *hw, unsigned port, |
| 2344 | const char *rxtx, u32 mask) | 2356 | u16 q, unsigned ring_size) |
| 2345 | { | 2357 | { |
| 2346 | struct net_device *dev = hw->dev[port]; | 2358 | struct net_device *dev = hw->dev[port]; |
| 2347 | struct sky2_port *sky2 = netdev_priv(dev); | 2359 | struct sky2_port *sky2 = netdev_priv(dev); |
| 2348 | u32 imask; | 2360 | unsigned idx; |
| 2349 | 2361 | const u64 *le = (q == Q_R1 || q == Q_R2) | |
| 2350 | printk(KERN_ERR PFX "%s: %s descriptor error (hardware problem)\n", | 2362 | ? (u64 *) sky2->rx_le : (u64 *) sky2->tx_le; |
| 2351 | dev ? dev->name : "<not registered>", rxtx); | ||
| 2352 | 2363 | ||
| 2353 | imask = sky2_read32(hw, B0_IMSK); | 2364 | idx = sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_GET_IDX)); |
| 2354 | imask &= ~mask; | 2365 | printk(KERN_ERR PFX "%s: descriptor error q=%#x get=%u [%llx] put=%u\n", |
| 2355 | sky2_write32(hw, B0_IMSK, imask); | 2366 | dev->name, (unsigned) q, idx, (unsigned long long) le[idx], |
| 2367 | (unsigned) sky2_read16(hw, Y2_QADDR(q, PREF_UNIT_PUT_IDX))); | ||
| 2356 | 2368 | ||
| 2357 | if (dev) { | 2369 | sky2_write32(hw, Q_ADDR(q, Q_CSR), BMU_CLR_IRQ_CHK); |
| 2358 | spin_lock(&sky2->phy_lock); | ||
| 2359 | sky2_link_down(sky2); | ||
| 2360 | spin_unlock(&sky2->phy_lock); | ||
| 2361 | } | ||
| 2362 | } | 2370 | } |
| 2363 | 2371 | ||
| 2364 | /* If idle then force a fake soft NAPI poll once a second | 2372 | /* If idle then force a fake soft NAPI poll once a second |
| @@ -2382,23 +2390,15 @@ static void sky2_idle(unsigned long arg) | |||
| 2382 | mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout)); | 2390 | mod_timer(&hw->idle_timer, jiffies + msecs_to_jiffies(idle_timeout)); |
| 2383 | } | 2391 | } |
| 2384 | 2392 | ||
| 2385 | 2393 | /* Hardware/software error handling */ | |
| 2386 | static int sky2_poll(struct net_device *dev0, int *budget) | 2394 | static void sky2_err_intr(struct sky2_hw *hw, u32 status) |
| 2387 | { | 2395 | { |
| 2388 | struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw; | 2396 | if (net_ratelimit()) |
| 2389 | int work_limit = min(dev0->quota, *budget); | 2397 | dev_warn(&hw->pdev->dev, "error interrupt status=%#x\n", status); |
| 2390 | int work_done = 0; | ||
| 2391 | u32 status = sky2_read32(hw, B0_Y2_SP_EISR); | ||
| 2392 | 2398 | ||
| 2393 | if (status & Y2_IS_HW_ERR) | 2399 | if (status & Y2_IS_HW_ERR) |
| 2394 | sky2_hw_intr(hw); | 2400 | sky2_hw_intr(hw); |
| 2395 | 2401 | ||
| 2396 | if (status & Y2_IS_IRQ_PHY1) | ||
| 2397 | sky2_phy_intr(hw, 0); | ||
| 2398 | |||
| 2399 | if (status & Y2_IS_IRQ_PHY2) | ||
| 2400 | sky2_phy_intr(hw, 1); | ||
| 2401 | |||
| 2402 | if (status & Y2_IS_IRQ_MAC1) | 2402 | if (status & Y2_IS_IRQ_MAC1) |
| 2403 | sky2_mac_intr(hw, 0); | 2403 | sky2_mac_intr(hw, 0); |
| 2404 | 2404 | ||
| @@ -2406,16 +2406,33 @@ static int sky2_poll(struct net_device *dev0, int *budget) | |||
| 2406 | sky2_mac_intr(hw, 1); | 2406 | sky2_mac_intr(hw, 1); |
| 2407 | 2407 | ||
| 2408 | if (status & Y2_IS_CHK_RX1) | 2408 | if (status & Y2_IS_CHK_RX1) |
| 2409 | sky2_descriptor_error(hw, 0, "receive", Y2_IS_CHK_RX1); | 2409 | sky2_le_error(hw, 0, Q_R1, RX_LE_SIZE); |
| 2410 | 2410 | ||
| 2411 | if (status & Y2_IS_CHK_RX2) | 2411 | if (status & Y2_IS_CHK_RX2) |
| 2412 | sky2_descriptor_error(hw, 1, "receive", Y2_IS_CHK_RX2); | 2412 | sky2_le_error(hw, 1, Q_R2, RX_LE_SIZE); |
| 2413 | 2413 | ||
| 2414 | if (status & Y2_IS_CHK_TXA1) | 2414 | if (status & Y2_IS_CHK_TXA1) |
| 2415 | sky2_descriptor_error(hw, 0, "transmit", Y2_IS_CHK_TXA1); | 2415 | sky2_le_error(hw, 0, Q_XA1, TX_RING_SIZE); |
| 2416 | 2416 | ||
| 2417 | if (status & Y2_IS_CHK_TXA2) | 2417 | if (status & Y2_IS_CHK_TXA2) |
| 2418 | sky2_descriptor_error(hw, 1, "transmit", Y2_IS_CHK_TXA2); | 2418 | sky2_le_error(hw, 1, Q_XA2, TX_RING_SIZE); |
| 2419 | } | ||
| 2420 | |||
| 2421 | static int sky2_poll(struct net_device *dev0, int *budget) | ||
| 2422 | { | ||
| 2423 | struct sky2_hw *hw = ((struct sky2_port *) netdev_priv(dev0))->hw; | ||
| 2424 | int work_limit = min(dev0->quota, *budget); | ||
| 2425 | int work_done = 0; | ||
| 2426 | u32 status = sky2_read32(hw, B0_Y2_SP_EISR); | ||
| 2427 | |||
| 2428 | if (unlikely(status & Y2_IS_ERROR)) | ||
| 2429 | sky2_err_intr(hw, status); | ||
| 2430 | |||
| 2431 | if (status & Y2_IS_IRQ_PHY1) | ||
| 2432 | sky2_phy_intr(hw, 0); | ||
| 2433 | |||
| 2434 | if (status & Y2_IS_IRQ_PHY2) | ||
| 2435 | sky2_phy_intr(hw, 1); | ||
| 2419 | 2436 | ||
| 2420 | work_done = sky2_status_intr(hw, work_limit); | 2437 | work_done = sky2_status_intr(hw, work_limit); |
| 2421 | if (work_done < work_limit) { | 2438 | if (work_done < work_limit) { |
| @@ -2533,16 +2550,14 @@ static void sky2_reset(struct sky2_hw *hw) | |||
| 2533 | int i; | 2550 | int i; |
| 2534 | 2551 | ||
| 2535 | /* disable ASF */ | 2552 | /* disable ASF */ |
| 2536 | if (hw->chip_id <= CHIP_ID_YUKON_EC) { | 2553 | if (hw->chip_id == CHIP_ID_YUKON_EX) { |
| 2537 | if (hw->chip_id == CHIP_ID_YUKON_EX) { | 2554 | status = sky2_read16(hw, HCU_CCSR); |
| 2538 | status = sky2_read16(hw, HCU_CCSR); | 2555 | status &= ~(HCU_CCSR_AHB_RST | HCU_CCSR_CPU_RST_MODE | |
| 2539 | status &= ~(HCU_CCSR_AHB_RST | HCU_CCSR_CPU_RST_MODE | | 2556 | HCU_CCSR_UC_STATE_MSK); |
| 2540 | HCU_CCSR_UC_STATE_MSK); | 2557 | sky2_write16(hw, HCU_CCSR, status); |
| 2541 | sky2_write16(hw, HCU_CCSR, status); | 2558 | } else |
| 2542 | } else | 2559 | sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET); |
| 2543 | sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET); | 2560 | sky2_write16(hw, B0_CTST, Y2_ASF_DISABLE); |
| 2544 | sky2_write16(hw, B0_CTST, Y2_ASF_DISABLE); | ||
| 2545 | } | ||
| 2546 | 2561 | ||
| 2547 | /* do a SW reset */ | 2562 | /* do a SW reset */ |
| 2548 | sky2_write8(hw, B0_CTST, CS_RST_SET); | 2563 | sky2_write8(hw, B0_CTST, CS_RST_SET); |
| @@ -3327,6 +3342,36 @@ static void sky2_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
| 3327 | regs->len - B3_RI_WTO_R1); | 3342 | regs->len - B3_RI_WTO_R1); |
| 3328 | } | 3343 | } |
| 3329 | 3344 | ||
| 3345 | /* In order to do Jumbo packets on these chips, need to turn off the | ||
| 3346 | * transmit store/forward. Therefore checksum offload won't work. | ||
| 3347 | */ | ||
| 3348 | static int no_tx_offload(struct net_device *dev) | ||
| 3349 | { | ||
| 3350 | const struct sky2_port *sky2 = netdev_priv(dev); | ||
| 3351 | const struct sky2_hw *hw = sky2->hw; | ||
| 3352 | |||
| 3353 | return dev->mtu > ETH_DATA_LEN && | ||
| 3354 | (hw->chip_id == CHIP_ID_YUKON_EX | ||
| 3355 | || hw->chip_id == CHIP_ID_YUKON_EC_U); | ||
| 3356 | } | ||
| 3357 | |||
| 3358 | static int sky2_set_tx_csum(struct net_device *dev, u32 data) | ||
| 3359 | { | ||
| 3360 | if (data && no_tx_offload(dev)) | ||
| 3361 | return -EINVAL; | ||
| 3362 | |||
| 3363 | return ethtool_op_set_tx_csum(dev, data); | ||
| 3364 | } | ||
| 3365 | |||
| 3366 | |||
| 3367 | static int sky2_set_tso(struct net_device *dev, u32 data) | ||
| 3368 | { | ||
| 3369 | if (data && no_tx_offload(dev)) | ||
| 3370 | return -EINVAL; | ||
| 3371 | |||
| 3372 | return ethtool_op_set_tso(dev, data); | ||
| 3373 | } | ||
| 3374 | |||
| 3330 | static const struct ethtool_ops sky2_ethtool_ops = { | 3375 | static const struct ethtool_ops sky2_ethtool_ops = { |
| 3331 | .get_settings = sky2_get_settings, | 3376 | .get_settings = sky2_get_settings, |
| 3332 | .set_settings = sky2_set_settings, | 3377 | .set_settings = sky2_set_settings, |
| @@ -3342,9 +3387,9 @@ static const struct ethtool_ops sky2_ethtool_ops = { | |||
| 3342 | .get_sg = ethtool_op_get_sg, | 3387 | .get_sg = ethtool_op_get_sg, |
| 3343 | .set_sg = ethtool_op_set_sg, | 3388 | .set_sg = ethtool_op_set_sg, |
| 3344 | .get_tx_csum = ethtool_op_get_tx_csum, | 3389 | .get_tx_csum = ethtool_op_get_tx_csum, |
| 3345 | .set_tx_csum = ethtool_op_set_tx_csum, | 3390 | .set_tx_csum = sky2_set_tx_csum, |
| 3346 | .get_tso = ethtool_op_get_tso, | 3391 | .get_tso = ethtool_op_get_tso, |
| 3347 | .set_tso = ethtool_op_set_tso, | 3392 | .set_tso = sky2_set_tso, |
| 3348 | .get_rx_csum = sky2_get_rx_csum, | 3393 | .get_rx_csum = sky2_get_rx_csum, |
| 3349 | .set_rx_csum = sky2_set_rx_csum, | 3394 | .set_rx_csum = sky2_set_rx_csum, |
| 3350 | .get_strings = sky2_get_strings, | 3395 | .get_strings = sky2_get_strings, |
| @@ -3769,6 +3814,11 @@ static int sky2_resume(struct pci_dev *pdev) | |||
| 3769 | goto out; | 3814 | goto out; |
| 3770 | 3815 | ||
| 3771 | pci_enable_wake(pdev, PCI_D0, 0); | 3816 | pci_enable_wake(pdev, PCI_D0, 0); |
| 3817 | |||
| 3818 | /* Re-enable all clocks */ | ||
| 3819 | if (hw->chip_id == CHIP_ID_YUKON_EX || hw->chip_id == CHIP_ID_YUKON_EC_U) | ||
| 3820 | sky2_pci_write32(hw, PCI_DEV_REG3, 0); | ||
| 3821 | |||
| 3772 | sky2_reset(hw); | 3822 | sky2_reset(hw); |
| 3773 | 3823 | ||
| 3774 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); | 3824 | sky2_write32(hw, B0_IMSK, Y2_IS_BASE); |
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index ac24bdc42976..5efb5afc45ba 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
| @@ -288,6 +288,9 @@ enum { | |||
| 288 | | Y2_IS_CHK_TXA1 | Y2_IS_CHK_RX1, | 288 | | Y2_IS_CHK_TXA1 | Y2_IS_CHK_RX1, |
| 289 | Y2_IS_PORT_2 = Y2_IS_IRQ_PHY2 | Y2_IS_IRQ_MAC2 | 289 | Y2_IS_PORT_2 = Y2_IS_IRQ_PHY2 | Y2_IS_IRQ_MAC2 |
| 290 | | Y2_IS_CHK_TXA2 | Y2_IS_CHK_RX2, | 290 | | Y2_IS_CHK_TXA2 | Y2_IS_CHK_RX2, |
| 291 | Y2_IS_ERROR = Y2_IS_HW_ERR | | ||
| 292 | Y2_IS_IRQ_MAC1 | Y2_IS_CHK_TXA1 | Y2_IS_CHK_RX1 | | ||
| 293 | Y2_IS_IRQ_MAC2 | Y2_IS_CHK_TXA2 | Y2_IS_CHK_RX2, | ||
| 291 | }; | 294 | }; |
| 292 | 295 | ||
| 293 | /* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */ | 296 | /* B2_IRQM_HWE_MSK 32 bit IRQ Moderation HW Error Mask */ |
| @@ -738,6 +741,11 @@ enum { | |||
| 738 | TX_GMF_RP = 0x0d70,/* 32 bit Tx GMAC FIFO Read Pointer */ | 741 | TX_GMF_RP = 0x0d70,/* 32 bit Tx GMAC FIFO Read Pointer */ |
| 739 | TX_GMF_RSTP = 0x0d74,/* 32 bit Tx GMAC FIFO Restart Pointer */ | 742 | TX_GMF_RSTP = 0x0d74,/* 32 bit Tx GMAC FIFO Restart Pointer */ |
| 740 | TX_GMF_RLEV = 0x0d78,/* 32 bit Tx GMAC FIFO Read Level */ | 743 | TX_GMF_RLEV = 0x0d78,/* 32 bit Tx GMAC FIFO Read Level */ |
| 744 | |||
| 745 | /* Threshold values for Yukon-EC Ultra and Extreme */ | ||
| 746 | ECU_AE_THR = 0x0070, /* Almost Empty Threshold */ | ||
| 747 | ECU_TXFF_LEV = 0x01a0, /* Tx BMU FIFO Level */ | ||
| 748 | ECU_JUMBO_WM = 0x0080, /* Jumbo Mode Watermark */ | ||
| 741 | }; | 749 | }; |
| 742 | 750 | ||
| 743 | /* Descriptor Poll Timer Registers */ | 751 | /* Descriptor Poll Timer Registers */ |
| @@ -1631,6 +1639,9 @@ enum { | |||
| 1631 | TX_VLAN_TAG_ON = 1<<25,/* enable VLAN tagging */ | 1639 | TX_VLAN_TAG_ON = 1<<25,/* enable VLAN tagging */ |
| 1632 | TX_VLAN_TAG_OFF = 1<<24,/* disable VLAN tagging */ | 1640 | TX_VLAN_TAG_OFF = 1<<24,/* disable VLAN tagging */ |
| 1633 | 1641 | ||
| 1642 | TX_JUMBO_ENA = 1<<23,/* PCI Jumbo Mode enable (Yukon-EC Ultra) */ | ||
| 1643 | TX_JUMBO_DIS = 1<<22,/* PCI Jumbo Mode enable (Yukon-EC Ultra) */ | ||
| 1644 | |||
| 1634 | GMF_WSP_TST_ON = 1<<18,/* Write Shadow Pointer Test On */ | 1645 | GMF_WSP_TST_ON = 1<<18,/* Write Shadow Pointer Test On */ |
| 1635 | GMF_WSP_TST_OFF = 1<<17,/* Write Shadow Pointer Test Off */ | 1646 | GMF_WSP_TST_OFF = 1<<17,/* Write Shadow Pointer Test Off */ |
| 1636 | GMF_WSP_STEP = 1<<16,/* Write Shadow Pointer Step/Increment */ | 1647 | GMF_WSP_STEP = 1<<16,/* Write Shadow Pointer Step/Increment */ |
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 3b91af89e4c7..e3019d52c30f 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
| @@ -719,7 +719,7 @@ spider_net_prepare_tx_descr(struct spider_net_card *card, | |||
| 719 | SPIDER_NET_DESCR_CARDOWNED | SPIDER_NET_DMAC_NOCS; | 719 | SPIDER_NET_DESCR_CARDOWNED | SPIDER_NET_DMAC_NOCS; |
| 720 | spin_unlock_irqrestore(&chain->lock, flags); | 720 | spin_unlock_irqrestore(&chain->lock, flags); |
| 721 | 721 | ||
| 722 | if (skb->protocol == htons(ETH_P_IP)) | 722 | if (skb->protocol == htons(ETH_P_IP) && skb->ip_summed == CHECKSUM_PARTIAL) |
| 723 | switch (skb->nh.iph->protocol) { | 723 | switch (skb->nh.iph->protocol) { |
| 724 | case IPPROTO_TCP: | 724 | case IPPROTO_TCP: |
| 725 | hwdescr->dmac_cmd_status |= SPIDER_NET_DMAC_TCP; | 725 | hwdescr->dmac_cmd_status |= SPIDER_NET_DMAC_TCP; |
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index c62e85d89f41..7bee45b42a2c 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
| @@ -336,13 +336,27 @@ static int __init lance_probe( struct net_device *dev) | |||
| 336 | 336 | ||
| 337 | /* XXX - leak? */ | 337 | /* XXX - leak? */ |
| 338 | MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000); | 338 | MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000); |
| 339 | if (MEM == NULL) { | ||
| 340 | #ifdef CONFIG_SUN3 | ||
| 341 | iounmap((void __iomem *)ioaddr); | ||
| 342 | #endif | ||
| 343 | printk(KERN_WARNING "SUN3 Lance couldn't allocate DVMA memory\n"); | ||
| 344 | return 0; | ||
| 345 | } | ||
| 339 | 346 | ||
| 340 | lp->iobase = (volatile unsigned short *)ioaddr; | 347 | lp->iobase = (volatile unsigned short *)ioaddr; |
| 341 | dev->base_addr = (unsigned long)ioaddr; /* informational only */ | 348 | dev->base_addr = (unsigned long)ioaddr; /* informational only */ |
| 342 | 349 | ||
| 343 | REGA(CSR0) = CSR0_STOP; | 350 | REGA(CSR0) = CSR0_STOP; |
| 344 | 351 | ||
| 345 | request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev); | 352 | if (request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev) < 0) { |
| 353 | #ifdef CONFIG_SUN3 | ||
| 354 | iounmap((void __iomem *)ioaddr); | ||
| 355 | #endif | ||
| 356 | dvma_free((void *)MEM); | ||
| 357 | printk(KERN_WARNING "SUN3 Lance unable to allocate IRQ\n"); | ||
| 358 | return 0; | ||
| 359 | } | ||
| 346 | dev->irq = (unsigned short)LANCE_IRQ; | 360 | dev->irq = (unsigned short)LANCE_IRQ; |
| 347 | 361 | ||
| 348 | 362 | ||
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c index 616be8d0fa85..08ea61db46fe 100644 --- a/drivers/net/sungem.c +++ b/drivers/net/sungem.c | |||
| @@ -2530,6 +2530,35 @@ static struct net_device_stats *gem_get_stats(struct net_device *dev) | |||
| 2530 | return &gp->net_stats; | 2530 | return &gp->net_stats; |
| 2531 | } | 2531 | } |
| 2532 | 2532 | ||
| 2533 | static int gem_set_mac_address(struct net_device *dev, void *addr) | ||
| 2534 | { | ||
| 2535 | struct sockaddr *macaddr = (struct sockaddr *) addr; | ||
| 2536 | struct gem *gp = dev->priv; | ||
| 2537 | unsigned char *e = &dev->dev_addr[0]; | ||
| 2538 | |||
| 2539 | if (!is_valid_ether_addr(macaddr->sa_data)) | ||
| 2540 | return -EADDRNOTAVAIL; | ||
| 2541 | |||
| 2542 | if (!netif_running(dev) || !netif_device_present(dev)) { | ||
| 2543 | /* We'll just catch it later when the | ||
| 2544 | * device is up'd or resumed. | ||
| 2545 | */ | ||
| 2546 | memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len); | ||
| 2547 | return 0; | ||
| 2548 | } | ||
| 2549 | |||
| 2550 | mutex_lock(&gp->pm_mutex); | ||
| 2551 | memcpy(dev->dev_addr, macaddr->sa_data, dev->addr_len); | ||
| 2552 | if (gp->running) { | ||
| 2553 | writel((e[4] << 8) | e[5], gp->regs + MAC_ADDR0); | ||
| 2554 | writel((e[2] << 8) | e[3], gp->regs + MAC_ADDR1); | ||
| 2555 | writel((e[0] << 8) | e[1], gp->regs + MAC_ADDR2); | ||
| 2556 | } | ||
| 2557 | mutex_unlock(&gp->pm_mutex); | ||
| 2558 | |||
| 2559 | return 0; | ||
| 2560 | } | ||
| 2561 | |||
| 2533 | static void gem_set_multicast(struct net_device *dev) | 2562 | static void gem_set_multicast(struct net_device *dev) |
| 2534 | { | 2563 | { |
| 2535 | struct gem *gp = dev->priv; | 2564 | struct gem *gp = dev->priv; |
| @@ -3122,6 +3151,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev, | |||
| 3122 | dev->change_mtu = gem_change_mtu; | 3151 | dev->change_mtu = gem_change_mtu; |
| 3123 | dev->irq = pdev->irq; | 3152 | dev->irq = pdev->irq; |
| 3124 | dev->dma = 0; | 3153 | dev->dma = 0; |
| 3154 | dev->set_mac_address = gem_set_mac_address; | ||
| 3125 | #ifdef CONFIG_NET_POLL_CONTROLLER | 3155 | #ifdef CONFIG_NET_POLL_CONTROLLER |
| 3126 | dev->poll_controller = gem_poll_controller; | 3156 | dev->poll_controller = gem_poll_controller; |
| 3127 | #endif | 3157 | #endif |
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c index ef671739cfea..192bbc91c731 100644 --- a/drivers/net/sunhme.c +++ b/drivers/net/sunhme.c | |||
| @@ -3314,7 +3314,7 @@ static int __devexit hme_sbus_remove(struct of_device *dev) | |||
| 3314 | struct happy_meal *hp = dev_get_drvdata(&dev->dev); | 3314 | struct happy_meal *hp = dev_get_drvdata(&dev->dev); |
| 3315 | struct net_device *net_dev = hp->dev; | 3315 | struct net_device *net_dev = hp->dev; |
| 3316 | 3316 | ||
| 3317 | unregister_netdevice(net_dev); | 3317 | unregister_netdev(net_dev); |
| 3318 | 3318 | ||
| 3319 | /* XXX qfe parent interrupt... */ | 3319 | /* XXX qfe parent interrupt... */ |
| 3320 | 3320 | ||
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c index 5b00d79b5573..b0929a457b60 100644 --- a/drivers/net/sunlance.c +++ b/drivers/net/sunlance.c | |||
| @@ -1550,7 +1550,7 @@ static int __exit sunlance_sun4_remove(void) | |||
| 1550 | struct lance_private *lp = dev_get_drvdata(&sun4_sdev.ofdev.dev); | 1550 | struct lance_private *lp = dev_get_drvdata(&sun4_sdev.ofdev.dev); |
| 1551 | struct net_device *net_dev = lp->dev; | 1551 | struct net_device *net_dev = lp->dev; |
| 1552 | 1552 | ||
| 1553 | unregister_netdevice(net_dev); | 1553 | unregister_netdev(net_dev); |
| 1554 | 1554 | ||
| 1555 | lance_free_hwresources(lp); | 1555 | lance_free_hwresources(lp); |
| 1556 | 1556 | ||
| @@ -1590,7 +1590,7 @@ static int __devexit sunlance_sbus_remove(struct of_device *dev) | |||
| 1590 | struct lance_private *lp = dev_get_drvdata(&dev->dev); | 1590 | struct lance_private *lp = dev_get_drvdata(&dev->dev); |
| 1591 | struct net_device *net_dev = lp->dev; | 1591 | struct net_device *net_dev = lp->dev; |
| 1592 | 1592 | ||
| 1593 | unregister_netdevice(net_dev); | 1593 | unregister_netdev(net_dev); |
| 1594 | 1594 | ||
| 1595 | lance_free_hwresources(lp); | 1595 | lance_free_hwresources(lp); |
| 1596 | 1596 | ||
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c index 7874eb1ef043..f3bad56d476a 100644 --- a/drivers/net/sunqe.c +++ b/drivers/net/sunqe.c | |||
| @@ -845,6 +845,8 @@ static int __init qec_ether_init(struct sbus_dev *sdev) | |||
| 845 | if (!dev) | 845 | if (!dev) |
| 846 | return -ENOMEM; | 846 | return -ENOMEM; |
| 847 | 847 | ||
| 848 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); | ||
| 849 | |||
| 848 | qe = netdev_priv(dev); | 850 | qe = netdev_priv(dev); |
| 849 | 851 | ||
| 850 | i = of_getintprop_default(sdev->ofdev.node, "channel#", -1); | 852 | i = of_getintprop_default(sdev->ofdev.node, "channel#", -1); |
| @@ -960,7 +962,7 @@ static int __devexit qec_sbus_remove(struct of_device *dev) | |||
| 960 | struct sunqe *qp = dev_get_drvdata(&dev->dev); | 962 | struct sunqe *qp = dev_get_drvdata(&dev->dev); |
| 961 | struct net_device *net_dev = qp->dev; | 963 | struct net_device *net_dev = qp->dev; |
| 962 | 964 | ||
| 963 | unregister_netdevice(net_dev); | 965 | unregister_netdev(net_dev); |
| 964 | 966 | ||
| 965 | sbus_iounmap(qp->qcregs, CREG_REG_SIZE); | 967 | sbus_iounmap(qp->qcregs, CREG_REG_SIZE); |
| 966 | sbus_iounmap(qp->mregs, MREGS_REG_SIZE); | 968 | sbus_iounmap(qp->mregs, MREGS_REG_SIZE); |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 8c8f9f4d47a5..256969e1300c 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
| @@ -64,8 +64,8 @@ | |||
| 64 | 64 | ||
| 65 | #define DRV_MODULE_NAME "tg3" | 65 | #define DRV_MODULE_NAME "tg3" |
| 66 | #define PFX DRV_MODULE_NAME ": " | 66 | #define PFX DRV_MODULE_NAME ": " |
| 67 | #define DRV_MODULE_VERSION "3.74" | 67 | #define DRV_MODULE_VERSION "3.75" |
| 68 | #define DRV_MODULE_RELDATE "February 20, 2007" | 68 | #define DRV_MODULE_RELDATE "March 23, 2007" |
| 69 | 69 | ||
| 70 | #define TG3_DEF_MAC_MODE 0 | 70 | #define TG3_DEF_MAC_MODE 0 |
| 71 | #define TG3_DEF_RX_MODE 0 | 71 | #define TG3_DEF_RX_MODE 0 |
| @@ -3568,32 +3568,34 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id) | |||
| 3568 | * Reading the PCI State register will confirm whether the | 3568 | * Reading the PCI State register will confirm whether the |
| 3569 | * interrupt is ours and will flush the status block. | 3569 | * interrupt is ours and will flush the status block. |
| 3570 | */ | 3570 | */ |
| 3571 | if ((sblk->status & SD_STATUS_UPDATED) || | 3571 | if (unlikely(!(sblk->status & SD_STATUS_UPDATED))) { |
| 3572 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { | 3572 | if ((tp->tg3_flags & TG3_FLAG_CHIP_RESETTING) || |
| 3573 | /* | 3573 | (tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { |
| 3574 | * Writing any value to intr-mbox-0 clears PCI INTA# and | 3574 | handled = 0; |
| 3575 | * chip-internal interrupt pending events. | ||
| 3576 | * Writing non-zero to intr-mbox-0 additional tells the | ||
| 3577 | * NIC to stop sending us irqs, engaging "in-intr-handler" | ||
| 3578 | * event coalescing. | ||
| 3579 | */ | ||
| 3580 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | ||
| 3581 | 0x00000001); | ||
| 3582 | if (tg3_irq_sync(tp)) | ||
| 3583 | goto out; | 3575 | goto out; |
| 3584 | sblk->status &= ~SD_STATUS_UPDATED; | ||
| 3585 | if (likely(tg3_has_work(tp))) { | ||
| 3586 | prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]); | ||
| 3587 | netif_rx_schedule(dev); /* schedule NAPI poll */ | ||
| 3588 | } else { | ||
| 3589 | /* No work, shared interrupt perhaps? re-enable | ||
| 3590 | * interrupts, and flush that PCI write | ||
| 3591 | */ | ||
| 3592 | tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | ||
| 3593 | 0x00000000); | ||
| 3594 | } | 3576 | } |
| 3595 | } else { /* shared interrupt */ | 3577 | } |
| 3596 | handled = 0; | 3578 | |
| 3579 | /* | ||
| 3580 | * Writing any value to intr-mbox-0 clears PCI INTA# and | ||
| 3581 | * chip-internal interrupt pending events. | ||
| 3582 | * Writing non-zero to intr-mbox-0 additional tells the | ||
| 3583 | * NIC to stop sending us irqs, engaging "in-intr-handler" | ||
| 3584 | * event coalescing. | ||
| 3585 | */ | ||
| 3586 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); | ||
| 3587 | if (tg3_irq_sync(tp)) | ||
| 3588 | goto out; | ||
| 3589 | sblk->status &= ~SD_STATUS_UPDATED; | ||
| 3590 | if (likely(tg3_has_work(tp))) { | ||
| 3591 | prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]); | ||
| 3592 | netif_rx_schedule(dev); /* schedule NAPI poll */ | ||
| 3593 | } else { | ||
| 3594 | /* No work, shared interrupt perhaps? re-enable | ||
| 3595 | * interrupts, and flush that PCI write | ||
| 3596 | */ | ||
| 3597 | tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | ||
| 3598 | 0x00000000); | ||
| 3597 | } | 3599 | } |
| 3598 | out: | 3600 | out: |
| 3599 | return IRQ_RETVAL(handled); | 3601 | return IRQ_RETVAL(handled); |
| @@ -3611,31 +3613,33 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id) | |||
| 3611 | * Reading the PCI State register will confirm whether the | 3613 | * Reading the PCI State register will confirm whether the |
| 3612 | * interrupt is ours and will flush the status block. | 3614 | * interrupt is ours and will flush the status block. |
| 3613 | */ | 3615 | */ |
| 3614 | if ((sblk->status_tag != tp->last_tag) || | 3616 | if (unlikely(sblk->status_tag == tp->last_tag)) { |
| 3615 | !(tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { | 3617 | if ((tp->tg3_flags & TG3_FLAG_CHIP_RESETTING) || |
| 3616 | /* | 3618 | (tr32(TG3PCI_PCISTATE) & PCISTATE_INT_NOT_ACTIVE)) { |
| 3617 | * writing any value to intr-mbox-0 clears PCI INTA# and | 3619 | handled = 0; |
| 3618 | * chip-internal interrupt pending events. | ||
| 3619 | * writing non-zero to intr-mbox-0 additional tells the | ||
| 3620 | * NIC to stop sending us irqs, engaging "in-intr-handler" | ||
| 3621 | * event coalescing. | ||
| 3622 | */ | ||
| 3623 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, | ||
| 3624 | 0x00000001); | ||
| 3625 | if (tg3_irq_sync(tp)) | ||
| 3626 | goto out; | 3620 | goto out; |
| 3627 | if (netif_rx_schedule_prep(dev)) { | ||
| 3628 | prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]); | ||
| 3629 | /* Update last_tag to mark that this status has been | ||
| 3630 | * seen. Because interrupt may be shared, we may be | ||
| 3631 | * racing with tg3_poll(), so only update last_tag | ||
| 3632 | * if tg3_poll() is not scheduled. | ||
| 3633 | */ | ||
| 3634 | tp->last_tag = sblk->status_tag; | ||
| 3635 | __netif_rx_schedule(dev); | ||
| 3636 | } | 3621 | } |
| 3637 | } else { /* shared interrupt */ | 3622 | } |
| 3638 | handled = 0; | 3623 | |
| 3624 | /* | ||
| 3625 | * writing any value to intr-mbox-0 clears PCI INTA# and | ||
| 3626 | * chip-internal interrupt pending events. | ||
| 3627 | * writing non-zero to intr-mbox-0 additional tells the | ||
| 3628 | * NIC to stop sending us irqs, engaging "in-intr-handler" | ||
| 3629 | * event coalescing. | ||
| 3630 | */ | ||
| 3631 | tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001); | ||
| 3632 | if (tg3_irq_sync(tp)) | ||
| 3633 | goto out; | ||
| 3634 | if (netif_rx_schedule_prep(dev)) { | ||
| 3635 | prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]); | ||
| 3636 | /* Update last_tag to mark that this status has been | ||
| 3637 | * seen. Because interrupt may be shared, we may be | ||
| 3638 | * racing with tg3_poll(), so only update last_tag | ||
| 3639 | * if tg3_poll() is not scheduled. | ||
| 3640 | */ | ||
| 3641 | tp->last_tag = sblk->status_tag; | ||
| 3642 | __netif_rx_schedule(dev); | ||
| 3639 | } | 3643 | } |
| 3640 | out: | 3644 | out: |
| 3641 | return IRQ_RETVAL(handled); | 3645 | return IRQ_RETVAL(handled); |
| @@ -4823,6 +4827,21 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
| 4823 | if (write_op == tg3_write_flush_reg32) | 4827 | if (write_op == tg3_write_flush_reg32) |
| 4824 | tp->write32 = tg3_write32; | 4828 | tp->write32 = tg3_write32; |
| 4825 | 4829 | ||
| 4830 | /* Prevent the irq handler from reading or writing PCI registers | ||
| 4831 | * during chip reset when the memory enable bit in the PCI command | ||
| 4832 | * register may be cleared. The chip does not generate interrupt | ||
| 4833 | * at this time, but the irq handler may still be called due to irq | ||
| 4834 | * sharing or irqpoll. | ||
| 4835 | */ | ||
| 4836 | tp->tg3_flags |= TG3_FLAG_CHIP_RESETTING; | ||
| 4837 | if (tp->hw_status) { | ||
| 4838 | tp->hw_status->status = 0; | ||
| 4839 | tp->hw_status->status_tag = 0; | ||
| 4840 | } | ||
| 4841 | tp->last_tag = 0; | ||
| 4842 | smp_mb(); | ||
| 4843 | synchronize_irq(tp->pdev->irq); | ||
| 4844 | |||
| 4826 | /* do the reset */ | 4845 | /* do the reset */ |
| 4827 | val = GRC_MISC_CFG_CORECLK_RESET; | 4846 | val = GRC_MISC_CFG_CORECLK_RESET; |
| 4828 | 4847 | ||
| @@ -4904,6 +4923,8 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
| 4904 | 4923 | ||
| 4905 | pci_restore_state(tp->pdev); | 4924 | pci_restore_state(tp->pdev); |
| 4906 | 4925 | ||
| 4926 | tp->tg3_flags &= ~TG3_FLAG_CHIP_RESETTING; | ||
| 4927 | |||
| 4907 | /* Make sure PCI-X relaxed ordering bit is clear. */ | 4928 | /* Make sure PCI-X relaxed ordering bit is clear. */ |
| 4908 | pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val); | 4929 | pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val); |
| 4909 | val &= ~PCIX_CAPS_RELAXED_ORDERING; | 4930 | val &= ~PCIX_CAPS_RELAXED_ORDERING; |
| @@ -6321,8 +6342,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
| 6321 | RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB | | 6342 | RDMAC_MODE_ADDROFLOW_ENAB | RDMAC_MODE_FIFOOFLOW_ENAB | |
| 6322 | RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB | | 6343 | RDMAC_MODE_FIFOURUN_ENAB | RDMAC_MODE_FIFOOREAD_ENAB | |
| 6323 | RDMAC_MODE_LNGREAD_ENAB); | 6344 | RDMAC_MODE_LNGREAD_ENAB); |
| 6324 | if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) | ||
| 6325 | rdmac_mode |= RDMAC_MODE_SPLIT_ENABLE; | ||
| 6326 | 6345 | ||
| 6327 | /* If statement applies to 5705 and 5750 PCI devices only */ | 6346 | /* If statement applies to 5705 and 5750 PCI devices only */ |
| 6328 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 && | 6347 | if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 && |
| @@ -6495,9 +6514,6 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy) | |||
| 6495 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { | 6514 | } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) { |
| 6496 | val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK); | 6515 | val &= ~(PCIX_CAPS_SPLIT_MASK | PCIX_CAPS_BURST_MASK); |
| 6497 | val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT); | 6516 | val |= (PCIX_CAPS_MAX_BURST_CPIOB << PCIX_CAPS_BURST_SHIFT); |
| 6498 | if (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) | ||
| 6499 | val |= (tp->split_mode_max_reqs << | ||
| 6500 | PCIX_CAPS_SPLIT_SHIFT); | ||
| 6501 | } | 6517 | } |
| 6502 | tw32(TG3PCI_X_CAPS, val); | 6518 | tw32(TG3PCI_X_CAPS, val); |
| 6503 | } | 6519 | } |
| @@ -10863,14 +10879,6 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
| 10863 | grc_misc_cfg = tr32(GRC_MISC_CFG); | 10879 | grc_misc_cfg = tr32(GRC_MISC_CFG); |
| 10864 | grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK; | 10880 | grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK; |
| 10865 | 10881 | ||
| 10866 | /* Broadcom's driver says that CIOBE multisplit has a bug */ | ||
| 10867 | #if 0 | ||
| 10868 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 && | ||
| 10869 | grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5704CIOBE) { | ||
| 10870 | tp->tg3_flags |= TG3_FLAG_SPLIT_MODE; | ||
| 10871 | tp->split_mode_max_reqs = SPLIT_MODE_5704_MAX_REQ; | ||
| 10872 | } | ||
| 10873 | #endif | ||
| 10874 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 && | 10882 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 && |
| 10875 | (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 || | 10883 | (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 || |
| 10876 | grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) | 10884 | grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M)) |
| @@ -11968,14 +11976,12 @@ static int __devinit tg3_init_one(struct pci_dev *pdev, | |||
| 11968 | i == 5 ? '\n' : ':'); | 11976 | i == 5 ? '\n' : ':'); |
| 11969 | 11977 | ||
| 11970 | printk(KERN_INFO "%s: RXcsums[%d] LinkChgREG[%d] " | 11978 | printk(KERN_INFO "%s: RXcsums[%d] LinkChgREG[%d] " |
| 11971 | "MIirq[%d] ASF[%d] Split[%d] WireSpeed[%d] " | 11979 | "MIirq[%d] ASF[%d] WireSpeed[%d] TSOcap[%d]\n", |
| 11972 | "TSOcap[%d] \n", | ||
| 11973 | dev->name, | 11980 | dev->name, |
| 11974 | (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0, | 11981 | (tp->tg3_flags & TG3_FLAG_RX_CHECKSUMS) != 0, |
| 11975 | (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0, | 11982 | (tp->tg3_flags & TG3_FLAG_USE_LINKCHG_REG) != 0, |
| 11976 | (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0, | 11983 | (tp->tg3_flags & TG3_FLAG_USE_MI_INTERRUPT) != 0, |
| 11977 | (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0, | 11984 | (tp->tg3_flags & TG3_FLAG_ENABLE_ASF) != 0, |
| 11978 | (tp->tg3_flags & TG3_FLAG_SPLIT_MODE) != 0, | ||
| 11979 | (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0, | 11985 | (tp->tg3_flags2 & TG3_FLG2_NO_ETH_WIRE_SPEED) == 0, |
| 11980 | (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0); | 11986 | (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) != 0); |
| 11981 | printk(KERN_INFO "%s: dma_rwctrl[%08x] dma_mask[%d-bit]\n", | 11987 | printk(KERN_INFO "%s: dma_rwctrl[%08x] dma_mask[%d-bit]\n", |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 086892d8c1f1..d515ed23841b 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
| @@ -2223,7 +2223,7 @@ struct tg3 { | |||
| 2223 | #define TG3_FLAG_40BIT_DMA_BUG 0x08000000 | 2223 | #define TG3_FLAG_40BIT_DMA_BUG 0x08000000 |
| 2224 | #define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 | 2224 | #define TG3_FLAG_BROKEN_CHECKSUMS 0x10000000 |
| 2225 | #define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000 | 2225 | #define TG3_FLAG_GOT_SERDES_FLOWCTL 0x20000000 |
| 2226 | #define TG3_FLAG_SPLIT_MODE 0x40000000 | 2226 | #define TG3_FLAG_CHIP_RESETTING 0x40000000 |
| 2227 | #define TG3_FLAG_INIT_COMPLETE 0x80000000 | 2227 | #define TG3_FLAG_INIT_COMPLETE 0x80000000 |
| 2228 | u32 tg3_flags2; | 2228 | u32 tg3_flags2; |
| 2229 | #define TG3_FLG2_RESTART_TIMER 0x00000001 | 2229 | #define TG3_FLG2_RESTART_TIMER 0x00000001 |
| @@ -2262,9 +2262,6 @@ struct tg3 { | |||
| 2262 | #define TG3_FLG2_NO_FWARE_REPORTED 0x40000000 | 2262 | #define TG3_FLG2_NO_FWARE_REPORTED 0x40000000 |
| 2263 | #define TG3_FLG2_PHY_ADJUST_TRIM 0x80000000 | 2263 | #define TG3_FLG2_PHY_ADJUST_TRIM 0x80000000 |
| 2264 | 2264 | ||
| 2265 | u32 split_mode_max_reqs; | ||
| 2266 | #define SPLIT_MODE_5704_MAX_REQ 3 | ||
| 2267 | |||
| 2268 | struct timer_list timer; | 2265 | struct timer_list timer; |
| 2269 | u16 timer_counter; | 2266 | u16 timer_counter; |
| 2270 | u16 timer_multiplier; | 2267 | u16 timer_multiplier; |
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c index 36202e94ee91..01d55315ee8c 100644 --- a/drivers/net/tokenring/ibmtr.c +++ b/drivers/net/tokenring/ibmtr.c | |||
| @@ -346,7 +346,7 @@ static void ibmtr_cleanup_card(struct net_device *dev) | |||
| 346 | * which references it. | 346 | * which references it. |
| 347 | ****************************************************************************/ | 347 | ****************************************************************************/ |
| 348 | 348 | ||
| 349 | static int __init ibmtr_probe(struct net_device *dev) | 349 | static int __devinit ibmtr_probe(struct net_device *dev) |
| 350 | { | 350 | { |
| 351 | int i; | 351 | int i; |
| 352 | int base_addr = dev->base_addr; | 352 | int base_addr = dev->base_addr; |
| @@ -366,7 +366,7 @@ static int __init ibmtr_probe(struct net_device *dev) | |||
| 366 | return -ENODEV; | 366 | return -ENODEV; |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | int __init ibmtr_probe_card(struct net_device *dev) | 369 | int __devinit ibmtr_probe_card(struct net_device *dev) |
| 370 | { | 370 | { |
| 371 | int err = ibmtr_probe(dev); | 371 | int err = ibmtr_probe(dev); |
| 372 | if (!err) { | 372 | if (!err) { |
diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index 24a29c99ba94..9aeac76184f3 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c | |||
| @@ -190,13 +190,13 @@ | |||
| 190 | 190 | ||
| 191 | /* Structure/enum declaration ------------------------------- */ | 191 | /* Structure/enum declaration ------------------------------- */ |
| 192 | struct tx_desc { | 192 | struct tx_desc { |
| 193 | u32 tdes0, tdes1, tdes2, tdes3; /* Data for the card */ | 193 | __le32 tdes0, tdes1, tdes2, tdes3; /* Data for the card */ |
| 194 | char *tx_buf_ptr; /* Data for us */ | 194 | char *tx_buf_ptr; /* Data for us */ |
| 195 | struct tx_desc *next_tx_desc; | 195 | struct tx_desc *next_tx_desc; |
| 196 | } __attribute__(( aligned(32) )); | 196 | } __attribute__(( aligned(32) )); |
| 197 | 197 | ||
| 198 | struct rx_desc { | 198 | struct rx_desc { |
| 199 | u32 rdes0, rdes1, rdes2, rdes3; /* Data for the card */ | 199 | __le32 rdes0, rdes1, rdes2, rdes3; /* Data for the card */ |
| 200 | struct sk_buff *rx_skb_ptr; /* Data for us */ | 200 | struct sk_buff *rx_skb_ptr; /* Data for us */ |
| 201 | struct rx_desc *next_rx_desc; | 201 | struct rx_desc *next_rx_desc; |
| 202 | } __attribute__(( aligned(32) )); | 202 | } __attribute__(( aligned(32) )); |
| @@ -458,7 +458,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, | |||
| 458 | 458 | ||
| 459 | /* read 64 word srom data */ | 459 | /* read 64 word srom data */ |
| 460 | for (i = 0; i < 64; i++) | 460 | for (i = 0; i < 64; i++) |
| 461 | ((u16 *) db->srom)[i] = | 461 | ((__le16 *) db->srom)[i] = |
| 462 | cpu_to_le16(read_srom_word(db->ioaddr, i)); | 462 | cpu_to_le16(read_srom_word(db->ioaddr, i)); |
| 463 | 463 | ||
| 464 | /* Set Node address */ | 464 | /* Set Node address */ |
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c index dab88b958d6e..639e1e6913bf 100644 --- a/drivers/net/ucc_geth.c +++ b/drivers/net/ucc_geth.c | |||
| @@ -3607,7 +3607,6 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3607 | if (bd == ugeth->confBd[txQ]) { | 3607 | if (bd == ugeth->confBd[txQ]) { |
| 3608 | if (!netif_queue_stopped(dev)) | 3608 | if (!netif_queue_stopped(dev)) |
| 3609 | netif_stop_queue(dev); | 3609 | netif_stop_queue(dev); |
| 3610 | return NETDEV_TX_BUSY; | ||
| 3611 | } | 3610 | } |
| 3612 | 3611 | ||
| 3613 | ugeth->txBd[txQ] = bd; | 3612 | ugeth->txBd[txQ] = bd; |
| @@ -3623,7 +3622,7 @@ static int ucc_geth_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3623 | 3622 | ||
| 3624 | spin_unlock_irq(&ugeth->lock); | 3623 | spin_unlock_irq(&ugeth->lock); |
| 3625 | 3624 | ||
| 3626 | return NETDEV_TX_OK; | 3625 | return 0; |
| 3627 | } | 3626 | } |
| 3628 | 3627 | ||
| 3629 | static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit) | 3628 | static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit) |
diff --git a/drivers/net/wan/lmc/lmc_media.h b/drivers/net/wan/lmc/lmc_media.h deleted file mode 100644 index ddcc00403563..000000000000 --- a/drivers/net/wan/lmc/lmc_media.h +++ /dev/null | |||
| @@ -1,65 +0,0 @@ | |||
| 1 | #ifndef _LMC_MEDIA_H_ | ||
| 2 | #define _LMC_MEDIA_H_ | ||
| 3 | |||
| 4 | lmc_media_t lmc_ds3_media = { | ||
| 5 | lmc_ds3_init, /* special media init stuff */ | ||
| 6 | lmc_ds3_default, /* reset to default state */ | ||
| 7 | lmc_ds3_set_status, /* reset status to state provided */ | ||
| 8 | lmc_dummy_set_1, /* set clock source */ | ||
| 9 | lmc_dummy_set2_1, /* set line speed */ | ||
| 10 | lmc_ds3_set_100ft, /* set cable length */ | ||
| 11 | lmc_ds3_set_scram, /* set scrambler */ | ||
| 12 | lmc_ds3_get_link_status, /* get link status */ | ||
| 13 | lmc_dummy_set_1, /* set link status */ | ||
| 14 | lmc_ds3_set_crc_length, /* set CRC length */ | ||
| 15 | lmc_dummy_set_1, /* set T1 or E1 circuit type */ | ||
| 16 | lmc_ds3_watchdog | ||
| 17 | }; | ||
| 18 | |||
| 19 | lmc_media_t lmc_hssi_media = { | ||
| 20 | lmc_hssi_init, /* special media init stuff */ | ||
| 21 | lmc_hssi_default, /* reset to default state */ | ||
| 22 | lmc_hssi_set_status, /* reset status to state provided */ | ||
| 23 | lmc_hssi_set_clock, /* set clock source */ | ||
| 24 | lmc_dummy_set2_1, /* set line speed */ | ||
| 25 | lmc_dummy_set_1, /* set cable length */ | ||
| 26 | lmc_dummy_set_1, /* set scrambler */ | ||
| 27 | lmc_hssi_get_link_status, /* get link status */ | ||
| 28 | lmc_hssi_set_link_status, /* set link status */ | ||
| 29 | lmc_hssi_set_crc_length, /* set CRC length */ | ||
| 30 | lmc_dummy_set_1, /* set T1 or E1 circuit type */ | ||
| 31 | lmc_hssi_watchdog | ||
| 32 | }; | ||
| 33 | |||
| 34 | lmc_media_t lmc_ssi_media = { lmc_ssi_init, /* special media init stuff */ | ||
| 35 | lmc_ssi_default, /* reset to default state */ | ||
| 36 | lmc_ssi_set_status, /* reset status to state provided */ | ||
| 37 | lmc_ssi_set_clock, /* set clock source */ | ||
| 38 | lmc_ssi_set_speed, /* set line speed */ | ||
| 39 | lmc_dummy_set_1, /* set cable length */ | ||
| 40 | lmc_dummy_set_1, /* set scrambler */ | ||
| 41 | lmc_ssi_get_link_status, /* get link status */ | ||
| 42 | lmc_ssi_set_link_status, /* set link status */ | ||
| 43 | lmc_ssi_set_crc_length, /* set CRC length */ | ||
| 44 | lmc_dummy_set_1, /* set T1 or E1 circuit type */ | ||
| 45 | lmc_ssi_watchdog | ||
| 46 | }; | ||
| 47 | |||
| 48 | lmc_media_t lmc_t1_media = { | ||
| 49 | lmc_t1_init, /* special media init stuff */ | ||
| 50 | lmc_t1_default, /* reset to default state */ | ||
| 51 | lmc_t1_set_status, /* reset status to state provided */ | ||
| 52 | lmc_t1_set_clock, /* set clock source */ | ||
| 53 | lmc_dummy_set2_1, /* set line speed */ | ||
| 54 | lmc_dummy_set_1, /* set cable length */ | ||
| 55 | lmc_dummy_set_1, /* set scrambler */ | ||
| 56 | lmc_t1_get_link_status, /* get link status */ | ||
| 57 | lmc_dummy_set_1, /* set link status */ | ||
| 58 | lmc_t1_set_crc_length, /* set CRC length */ | ||
| 59 | lmc_t1_set_circuit_type, /* set T1 or E1 circuit type */ | ||
| 60 | lmc_t1_watchdog | ||
| 61 | }; | ||
| 62 | |||
| 63 | |||
| 64 | #endif | ||
| 65 | |||
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index a8c2bfe26c27..2ada76a93cb6 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
| @@ -2852,7 +2852,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port, | |||
| 2852 | if (rc) { | 2852 | if (rc) { |
| 2853 | airo_print_err(dev->name, "register interrupt %d failed, rc %d", | 2853 | airo_print_err(dev->name, "register interrupt %d failed, rc %d", |
| 2854 | irq, rc); | 2854 | irq, rc); |
| 2855 | goto err_out_unlink; | 2855 | goto err_out_nets; |
| 2856 | } | 2856 | } |
| 2857 | if (!is_pcmcia) { | 2857 | if (!is_pcmcia) { |
| 2858 | if (!request_region( dev->base_addr, 64, dev->name )) { | 2858 | if (!request_region( dev->base_addr, 64, dev->name )) { |
| @@ -2935,6 +2935,8 @@ err_out_res: | |||
| 2935 | release_region( dev->base_addr, 64 ); | 2935 | release_region( dev->base_addr, 64 ); |
| 2936 | err_out_irq: | 2936 | err_out_irq: |
| 2937 | free_irq(dev->irq, dev); | 2937 | free_irq(dev->irq, dev); |
| 2938 | err_out_nets: | ||
| 2939 | airo_networks_free(ai); | ||
| 2938 | err_out_unlink: | 2940 | err_out_unlink: |
| 2939 | del_airo_dev(dev); | 2941 | del_airo_dev(dev); |
| 2940 | err_out_thr: | 2942 | err_out_thr: |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c index 80cb88eb98c6..a38e7eec0e62 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c | |||
| @@ -946,6 +946,7 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm) | |||
| 946 | u8 channel; | 946 | u8 channel; |
| 947 | struct bcm43xx_phyinfo *phy; | 947 | struct bcm43xx_phyinfo *phy; |
| 948 | const char *iso_country; | 948 | const char *iso_country; |
| 949 | u8 max_bg_channel; | ||
| 949 | 950 | ||
| 950 | geo = kzalloc(sizeof(*geo), GFP_KERNEL); | 951 | geo = kzalloc(sizeof(*geo), GFP_KERNEL); |
| 951 | if (!geo) | 952 | if (!geo) |
| @@ -967,6 +968,23 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm) | |||
| 967 | } | 968 | } |
| 968 | iso_country = bcm43xx_locale_iso(bcm->sprom.locale); | 969 | iso_country = bcm43xx_locale_iso(bcm->sprom.locale); |
| 969 | 970 | ||
| 971 | /* set the maximum channel based on locale set in sprom or witle locale option */ | ||
| 972 | switch (bcm->sprom.locale) { | ||
| 973 | case BCM43xx_LOCALE_THAILAND: | ||
| 974 | case BCM43xx_LOCALE_ISRAEL: | ||
| 975 | case BCM43xx_LOCALE_JORDAN: | ||
| 976 | case BCM43xx_LOCALE_USA_CANADA_ANZ: | ||
| 977 | case BCM43xx_LOCALE_USA_LOW: | ||
| 978 | max_bg_channel = 11; | ||
| 979 | break; | ||
| 980 | case BCM43xx_LOCALE_JAPAN: | ||
| 981 | case BCM43xx_LOCALE_JAPAN_HIGH: | ||
| 982 | max_bg_channel = 14; | ||
| 983 | break; | ||
| 984 | default: | ||
| 985 | max_bg_channel = 13; | ||
| 986 | } | ||
| 987 | |||
| 970 | if (have_a) { | 988 | if (have_a) { |
| 971 | for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; | 989 | for (i = 0, channel = IEEE80211_52GHZ_MIN_CHANNEL; |
| 972 | channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { | 990 | channel <= IEEE80211_52GHZ_MAX_CHANNEL; channel++) { |
| @@ -978,7 +996,7 @@ static int bcm43xx_geo_init(struct bcm43xx_private *bcm) | |||
| 978 | } | 996 | } |
| 979 | if (have_bg) { | 997 | if (have_bg) { |
| 980 | for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; | 998 | for (i = 0, channel = IEEE80211_24GHZ_MIN_CHANNEL; |
| 981 | channel <= IEEE80211_24GHZ_MAX_CHANNEL; channel++) { | 999 | channel <= max_bg_channel; channel++) { |
| 982 | chan = &geo->bg[i++]; | 1000 | chan = &geo->bg[i++]; |
| 983 | chan->freq = bcm43xx_channel_to_freq_bg(channel); | 1001 | chan->freq = bcm43xx_channel_to_freq_bg(channel); |
| 984 | chan->channel = channel; | 1002 | chan->channel = channel; |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c index cae89258a640..72529a440f15 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c | |||
| @@ -757,7 +757,7 @@ static void bcm43xx_phy_initb5(struct bcm43xx_private *bcm) | |||
| 757 | if (radio->version == 0x2050) | 757 | if (radio->version == 0x2050) |
| 758 | bcm43xx_phy_write(bcm, 0x0038, 0x0667); | 758 | bcm43xx_phy_write(bcm, 0x0038, 0x0667); |
| 759 | 759 | ||
| 760 | if (phy->type == BCM43xx_PHYTYPE_G) { | 760 | if (phy->connected) { |
| 761 | if (radio->version == 0x2050) { | 761 | if (radio->version == 0x2050) { |
| 762 | bcm43xx_radio_write16(bcm, 0x007A, | 762 | bcm43xx_radio_write16(bcm, 0x007A, |
| 763 | bcm43xx_radio_read16(bcm, 0x007A) | 763 | bcm43xx_radio_read16(bcm, 0x007A) |
| @@ -978,7 +978,7 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | |||
| 978 | { | 978 | { |
| 979 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); | 979 | struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm); |
| 980 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); | 980 | struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm); |
| 981 | u16 backup_phy[15]; | 981 | u16 backup_phy[15] = {0}; |
| 982 | u16 backup_radio[3]; | 982 | u16 backup_radio[3]; |
| 983 | u16 backup_bband; | 983 | u16 backup_bband; |
| 984 | u16 i; | 984 | u16 i; |
| @@ -989,8 +989,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | |||
| 989 | backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001); | 989 | backup_phy[1] = bcm43xx_phy_read(bcm, 0x0001); |
| 990 | backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811); | 990 | backup_phy[2] = bcm43xx_phy_read(bcm, 0x0811); |
| 991 | backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812); | 991 | backup_phy[3] = bcm43xx_phy_read(bcm, 0x0812); |
| 992 | backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814); | 992 | if (phy->rev != 1) { |
| 993 | backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815); | 993 | backup_phy[4] = bcm43xx_phy_read(bcm, 0x0814); |
| 994 | backup_phy[5] = bcm43xx_phy_read(bcm, 0x0815); | ||
| 995 | } | ||
| 994 | backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A); | 996 | backup_phy[6] = bcm43xx_phy_read(bcm, 0x005A); |
| 995 | backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059); | 997 | backup_phy[7] = bcm43xx_phy_read(bcm, 0x0059); |
| 996 | backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058); | 998 | backup_phy[8] = bcm43xx_phy_read(bcm, 0x0058); |
| @@ -1018,14 +1020,16 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | |||
| 1018 | bcm43xx_phy_read(bcm, 0x0811) | 0x0001); | 1020 | bcm43xx_phy_read(bcm, 0x0811) | 0x0001); |
| 1019 | bcm43xx_phy_write(bcm, 0x0812, | 1021 | bcm43xx_phy_write(bcm, 0x0812, |
| 1020 | bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE); | 1022 | bcm43xx_phy_read(bcm, 0x0812) & 0xFFFE); |
| 1021 | bcm43xx_phy_write(bcm, 0x0814, | 1023 | if (phy->rev != 1) { |
| 1022 | bcm43xx_phy_read(bcm, 0x0814) | 0x0001); | 1024 | bcm43xx_phy_write(bcm, 0x0814, |
| 1023 | bcm43xx_phy_write(bcm, 0x0815, | 1025 | bcm43xx_phy_read(bcm, 0x0814) | 0x0001); |
| 1024 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE); | 1026 | bcm43xx_phy_write(bcm, 0x0815, |
| 1025 | bcm43xx_phy_write(bcm, 0x0814, | 1027 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFE); |
| 1026 | bcm43xx_phy_read(bcm, 0x0814) | 0x0002); | 1028 | bcm43xx_phy_write(bcm, 0x0814, |
| 1027 | bcm43xx_phy_write(bcm, 0x0815, | 1029 | bcm43xx_phy_read(bcm, 0x0814) | 0x0002); |
| 1028 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD); | 1030 | bcm43xx_phy_write(bcm, 0x0815, |
| 1031 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFD); | ||
| 1032 | } | ||
| 1029 | bcm43xx_phy_write(bcm, 0x0811, | 1033 | bcm43xx_phy_write(bcm, 0x0811, |
| 1030 | bcm43xx_phy_read(bcm, 0x0811) | 0x000C); | 1034 | bcm43xx_phy_read(bcm, 0x0811) | 0x000C); |
| 1031 | bcm43xx_phy_write(bcm, 0x0812, | 1035 | bcm43xx_phy_write(bcm, 0x0812, |
| @@ -1048,10 +1052,12 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | |||
| 1048 | bcm43xx_phy_read(bcm, 0x000A) | 1052 | bcm43xx_phy_read(bcm, 0x000A) |
| 1049 | | 0x2000); | 1053 | | 0x2000); |
| 1050 | } | 1054 | } |
| 1051 | bcm43xx_phy_write(bcm, 0x0814, | 1055 | if (phy->rev != 1) { |
| 1052 | bcm43xx_phy_read(bcm, 0x0814) | 0x0004); | 1056 | bcm43xx_phy_write(bcm, 0x0814, |
| 1053 | bcm43xx_phy_write(bcm, 0x0815, | 1057 | bcm43xx_phy_read(bcm, 0x0814) | 0x0004); |
| 1054 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB); | 1058 | bcm43xx_phy_write(bcm, 0x0815, |
| 1059 | bcm43xx_phy_read(bcm, 0x0815) & 0xFFFB); | ||
| 1060 | } | ||
| 1055 | bcm43xx_phy_write(bcm, 0x0003, | 1061 | bcm43xx_phy_write(bcm, 0x0003, |
| 1056 | (bcm43xx_phy_read(bcm, 0x0003) | 1062 | (bcm43xx_phy_read(bcm, 0x0003) |
| 1057 | & 0xFF9F) | 0x0040); | 1063 | & 0xFF9F) | 0x0040); |
| @@ -1138,8 +1144,10 @@ static void bcm43xx_calc_loopback_gain(struct bcm43xx_private *bcm) | |||
| 1138 | } | 1144 | } |
| 1139 | } | 1145 | } |
| 1140 | 1146 | ||
| 1141 | bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]); | 1147 | if (phy->rev != 1) { |
| 1142 | bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]); | 1148 | bcm43xx_phy_write(bcm, 0x0814, backup_phy[4]); |
| 1149 | bcm43xx_phy_write(bcm, 0x0815, backup_phy[5]); | ||
| 1150 | } | ||
| 1143 | bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]); | 1151 | bcm43xx_phy_write(bcm, 0x005A, backup_phy[6]); |
| 1144 | bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]); | 1152 | bcm43xx_phy_write(bcm, 0x0059, backup_phy[7]); |
| 1145 | bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]); | 1153 | bcm43xx_phy_write(bcm, 0x0058, backup_phy[8]); |
| @@ -1188,24 +1196,23 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
| 1188 | bcm43xx_phy_write(bcm, 0x0811, 0x0000); | 1196 | bcm43xx_phy_write(bcm, 0x0811, 0x0000); |
| 1189 | bcm43xx_phy_write(bcm, 0x0015, 0x00C0); | 1197 | bcm43xx_phy_write(bcm, 0x0015, 0x00C0); |
| 1190 | } | 1198 | } |
| 1191 | if (phy->rev >= 3) { | 1199 | if (phy->rev > 5) { |
| 1192 | bcm43xx_phy_write(bcm, 0x0811, 0x0400); | 1200 | bcm43xx_phy_write(bcm, 0x0811, 0x0400); |
| 1193 | bcm43xx_phy_write(bcm, 0x0015, 0x00C0); | 1201 | bcm43xx_phy_write(bcm, 0x0015, 0x00C0); |
| 1194 | } | 1202 | } |
| 1195 | if (phy->connected) { | 1203 | if (phy->rev >= 2 && phy->connected) { |
| 1196 | tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; | 1204 | tmp = bcm43xx_phy_read(bcm, 0x0400) & 0xFF; |
| 1197 | if (tmp < 6) { | 1205 | if (tmp ==3 || tmp == 5) { |
| 1198 | bcm43xx_phy_write(bcm, 0x04C2, 0x1816); | 1206 | bcm43xx_phy_write(bcm, 0x04C2, 0x1816); |
| 1199 | bcm43xx_phy_write(bcm, 0x04C3, 0x8006); | 1207 | bcm43xx_phy_write(bcm, 0x04C3, 0x8006); |
| 1200 | if (tmp != 3) { | 1208 | if (tmp == 5) { |
| 1201 | bcm43xx_phy_write(bcm, 0x04CC, | 1209 | bcm43xx_phy_write(bcm, 0x04CC, |
| 1202 | (bcm43xx_phy_read(bcm, 0x04CC) | 1210 | (bcm43xx_phy_read(bcm, 0x04CC) |
| 1203 | & 0x00FF) | 0x1F00); | 1211 | & 0x00FF) | 0x1F00); |
| 1204 | } | 1212 | } |
| 1205 | } | 1213 | } |
| 1206 | } | ||
| 1207 | if (phy->rev < 3 && phy->connected) | ||
| 1208 | bcm43xx_phy_write(bcm, 0x047E, 0x0078); | 1214 | bcm43xx_phy_write(bcm, 0x047E, 0x0078); |
| 1215 | } | ||
| 1209 | if (radio->revision == 8) { | 1216 | if (radio->revision == 8) { |
| 1210 | bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); | 1217 | bcm43xx_phy_write(bcm, 0x0801, bcm43xx_phy_read(bcm, 0x0801) | 0x0080); |
| 1211 | bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); | 1218 | bcm43xx_phy_write(bcm, 0x043E, bcm43xx_phy_read(bcm, 0x043E) | 0x0004); |
| @@ -1232,7 +1239,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
| 1232 | if (phy->rev >= 6) { | 1239 | if (phy->rev >= 6) { |
| 1233 | bcm43xx_phy_write(bcm, 0x0036, | 1240 | bcm43xx_phy_write(bcm, 0x0036, |
| 1234 | (bcm43xx_phy_read(bcm, 0x0036) | 1241 | (bcm43xx_phy_read(bcm, 0x0036) |
| 1235 | & 0xF000) | (radio->txctl2 << 12)); | 1242 | & 0x0FFF) | (radio->txctl2 << 12)); |
| 1236 | } | 1243 | } |
| 1237 | if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) | 1244 | if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) |
| 1238 | bcm43xx_phy_write(bcm, 0x002E, 0x8075); | 1245 | bcm43xx_phy_write(bcm, 0x002E, 0x8075); |
| @@ -1243,7 +1250,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
| 1243 | else | 1250 | else |
| 1244 | bcm43xx_phy_write(bcm, 0x002F, 0x0202); | 1251 | bcm43xx_phy_write(bcm, 0x002F, 0x0202); |
| 1245 | } | 1252 | } |
| 1246 | if (phy->connected) { | 1253 | if (phy->connected || phy->rev >= 2) { |
| 1247 | bcm43xx_phy_lo_adjust(bcm, 0); | 1254 | bcm43xx_phy_lo_adjust(bcm, 0); |
| 1248 | bcm43xx_phy_write(bcm, 0x080F, 0x8078); | 1255 | bcm43xx_phy_write(bcm, 0x080F, 0x8078); |
| 1249 | } | 1256 | } |
| @@ -1257,7 +1264,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm) | |||
| 1257 | */ | 1264 | */ |
| 1258 | bcm43xx_nrssi_hw_update(bcm, 0xFFFF); | 1265 | bcm43xx_nrssi_hw_update(bcm, 0xFFFF); |
| 1259 | bcm43xx_calc_nrssi_threshold(bcm); | 1266 | bcm43xx_calc_nrssi_threshold(bcm); |
| 1260 | } else if (phy->connected) { | 1267 | } else if (phy->connected || phy->rev >= 2) { |
| 1261 | if (radio->nrssi[0] == -1000) { | 1268 | if (radio->nrssi[0] == -1000) { |
| 1262 | assert(radio->nrssi[1] == -1000); | 1269 | assert(radio->nrssi[1] == -1000); |
| 1263 | bcm43xx_calc_nrssi_slope(bcm); | 1270 | bcm43xx_calc_nrssi_slope(bcm); |
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c index 32beb91b7164..4025dd0089d2 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_radio.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_radio.c | |||
| @@ -458,7 +458,7 @@ static void bcm43xx_calc_nrssi_offset(struct bcm43xx_private *bcm) | |||
| 458 | bcm43xx_phy_write(bcm, 0x005A, 0x0480); | 458 | bcm43xx_phy_write(bcm, 0x005A, 0x0480); |
| 459 | bcm43xx_phy_write(bcm, 0x0059, 0x0810); | 459 | bcm43xx_phy_write(bcm, 0x0059, 0x0810); |
| 460 | bcm43xx_phy_write(bcm, 0x0058, 0x000D); | 460 | bcm43xx_phy_write(bcm, 0x0058, 0x000D); |
| 461 | if (phy->rev == 0) { | 461 | if (phy->analog == 0) { |
| 462 | bcm43xx_phy_write(bcm, 0x0003, 0x0122); | 462 | bcm43xx_phy_write(bcm, 0x0003, 0x0122); |
| 463 | } else { | 463 | } else { |
| 464 | bcm43xx_phy_write(bcm, 0x000A, | 464 | bcm43xx_phy_write(bcm, 0x000A, |
| @@ -570,9 +570,9 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm) | |||
| 570 | nrssi0 = (s16)bcm43xx_phy_read(bcm, 0x0027); | 570 | nrssi0 = (s16)bcm43xx_phy_read(bcm, 0x0027); |
| 571 | bcm43xx_radio_write16(bcm, 0x007A, | 571 | bcm43xx_radio_write16(bcm, 0x007A, |
| 572 | bcm43xx_radio_read16(bcm, 0x007A) & 0x007F); | 572 | bcm43xx_radio_read16(bcm, 0x007A) & 0x007F); |
| 573 | if (phy->rev >= 2) { | 573 | if (phy->analog >= 2) { |
| 574 | bcm43xx_write16(bcm, 0x03E6, 0x0040); | 574 | bcm43xx_write16(bcm, 0x03E6, 0x0040); |
| 575 | } else if (phy->rev == 0) { | 575 | } else if (phy->analog == 0) { |
| 576 | bcm43xx_write16(bcm, 0x03E6, 0x0122); | 576 | bcm43xx_write16(bcm, 0x03E6, 0x0122); |
| 577 | } else { | 577 | } else { |
| 578 | bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT, | 578 | bcm43xx_write16(bcm, BCM43xx_MMIO_CHANNEL_EXT, |
| @@ -596,7 +596,7 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm) | |||
| 596 | bcm43xx_phy_write(bcm, 0x0015, backup[5]); | 596 | bcm43xx_phy_write(bcm, 0x0015, backup[5]); |
| 597 | bcm43xx_phy_write(bcm, 0x002A, backup[6]); | 597 | bcm43xx_phy_write(bcm, 0x002A, backup[6]); |
| 598 | bcm43xx_synth_pu_workaround(bcm, radio->channel); | 598 | bcm43xx_synth_pu_workaround(bcm, radio->channel); |
| 599 | if (phy->rev != 0) | 599 | if (phy->analog != 0) |
| 600 | bcm43xx_write16(bcm, 0x03F4, backup[13]); | 600 | bcm43xx_write16(bcm, 0x03F4, backup[13]); |
| 601 | 601 | ||
| 602 | bcm43xx_phy_write(bcm, 0x0020, backup[7]); | 602 | bcm43xx_phy_write(bcm, 0x0020, backup[7]); |
| @@ -692,7 +692,7 @@ void bcm43xx_calc_nrssi_slope(struct bcm43xx_private *bcm) | |||
| 692 | 692 | ||
| 693 | bcm43xx_radio_write16(bcm, 0x007A, | 693 | bcm43xx_radio_write16(bcm, 0x007A, |
| 694 | bcm43xx_radio_read16(bcm, 0x007A) & 0x007F); | 694 | bcm43xx_radio_read16(bcm, 0x007A) & 0x007F); |
| 695 | if (phy->rev >= 2) { | 695 | if (phy->analog >= 2) { |
| 696 | bcm43xx_phy_write(bcm, 0x0003, | 696 | bcm43xx_phy_write(bcm, 0x0003, |
| 697 | (bcm43xx_phy_read(bcm, 0x0003) | 697 | (bcm43xx_phy_read(bcm, 0x0003) |
| 698 | & 0xFF9F) | 0x0040); | 698 | & 0xFF9F) | 0x0040); |
| @@ -882,10 +882,10 @@ static void _stack_save(u32 *_stackptr, size_t *stackidx, | |||
| 882 | { | 882 | { |
| 883 | u32 *stackptr = &(_stackptr[*stackidx]); | 883 | u32 *stackptr = &(_stackptr[*stackidx]); |
| 884 | 884 | ||
| 885 | assert((offset & 0xF000) == 0x0000); | 885 | assert((offset & 0xE000) == 0x0000); |
| 886 | assert((id & 0xF0) == 0x00); | 886 | assert((id & 0xF8) == 0x00); |
| 887 | *stackptr = offset; | 887 | *stackptr = offset; |
| 888 | *stackptr |= ((u32)id) << 12; | 888 | *stackptr |= ((u32)id) << 13; |
| 889 | *stackptr |= ((u32)value) << 16; | 889 | *stackptr |= ((u32)value) << 16; |
| 890 | (*stackidx)++; | 890 | (*stackidx)++; |
| 891 | assert(*stackidx < BCM43xx_INTERFSTACK_SIZE); | 891 | assert(*stackidx < BCM43xx_INTERFSTACK_SIZE); |
| @@ -896,12 +896,12 @@ static u16 _stack_restore(u32 *stackptr, | |||
| 896 | { | 896 | { |
| 897 | size_t i; | 897 | size_t i; |
| 898 | 898 | ||
| 899 | assert((offset & 0xF000) == 0x0000); | 899 | assert((offset & 0xE000) == 0x0000); |
| 900 | assert((id & 0xF0) == 0x00); | 900 | assert((id & 0xF8) == 0x00); |
| 901 | for (i = 0; i < BCM43xx_INTERFSTACK_SIZE; i++, stackptr++) { | 901 | for (i = 0; i < BCM43xx_INTERFSTACK_SIZE; i++, stackptr++) { |
| 902 | if ((*stackptr & 0x00000FFF) != offset) | 902 | if ((*stackptr & 0x00001FFF) != offset) |
| 903 | continue; | 903 | continue; |
| 904 | if (((*stackptr & 0x0000F000) >> 12) != id) | 904 | if (((*stackptr & 0x00007000) >> 13) != id) |
| 905 | continue; | 905 | continue; |
| 906 | return ((*stackptr & 0xFFFF0000) >> 16); | 906 | return ((*stackptr & 0xFFFF0000) >> 16); |
| 907 | } | 907 | } |
| @@ -1579,7 +1579,7 @@ void bcm43xx_radio_set_tx_iq(struct bcm43xx_private *bcm) | |||
| 1579 | 1579 | ||
| 1580 | for (i = 0; i < 5; i++) { | 1580 | for (i = 0; i < 5; i++) { |
| 1581 | for (j = 0; j < 5; j++) { | 1581 | for (j = 0; j < 5; j++) { |
| 1582 | if (tmp == (data_high[i] << 4 | data_low[j])) { | 1582 | if (tmp == (data_high[i] | data_low[j])) { |
| 1583 | bcm43xx_phy_write(bcm, 0x0069, (i - j) << 8 | 0x00C0); | 1583 | bcm43xx_phy_write(bcm, 0x0069, (i - j) << 8 | 0x00C0); |
| 1584 | return; | 1584 | return; |
| 1585 | } | 1585 | } |
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c index 9c64f894b71b..87ee3ee020fe 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.c +++ b/drivers/net/wireless/zd1211rw/zd_chip.c | |||
| @@ -337,6 +337,7 @@ static int read_pod(struct zd_chip *chip, u8 *rf_type) | |||
| 337 | chip->patch_cr157 = (value >> 13) & 0x1; | 337 | chip->patch_cr157 = (value >> 13) & 0x1; |
| 338 | chip->patch_6m_band_edge = (value >> 21) & 0x1; | 338 | chip->patch_6m_band_edge = (value >> 21) & 0x1; |
| 339 | chip->new_phy_layout = (value >> 31) & 0x1; | 339 | chip->new_phy_layout = (value >> 31) & 0x1; |
| 340 | chip->al2230s_bit = (value >> 7) & 0x1; | ||
| 340 | chip->link_led = ((value >> 4) & 1) ? LED1 : LED2; | 341 | chip->link_led = ((value >> 4) & 1) ? LED1 : LED2; |
| 341 | chip->supports_tx_led = 1; | 342 | chip->supports_tx_led = 1; |
| 342 | if (value & (1 << 24)) { /* LED scenario */ | 343 | if (value & (1 << 24)) { /* LED scenario */ |
| @@ -591,16 +592,16 @@ int zd_chip_unlock_phy_regs(struct zd_chip *chip) | |||
| 591 | return r; | 592 | return r; |
| 592 | } | 593 | } |
| 593 | 594 | ||
| 594 | /* CR157 can be optionally patched by the EEPROM */ | 595 | /* CR157 can be optionally patched by the EEPROM for original ZD1211 */ |
| 595 | static int patch_cr157(struct zd_chip *chip) | 596 | static int patch_cr157(struct zd_chip *chip) |
| 596 | { | 597 | { |
| 597 | int r; | 598 | int r; |
| 598 | u32 value; | 599 | u16 value; |
| 599 | 600 | ||
| 600 | if (!chip->patch_cr157) | 601 | if (!chip->patch_cr157) |
| 601 | return 0; | 602 | return 0; |
| 602 | 603 | ||
| 603 | r = zd_ioread32_locked(chip, &value, E2P_PHY_REG); | 604 | r = zd_ioread16_locked(chip, &value, E2P_PHY_REG); |
| 604 | if (r) | 605 | if (r) |
| 605 | return r; | 606 | return r; |
| 606 | 607 | ||
| @@ -790,11 +791,6 @@ static int zd1211b_hw_reset_phy(struct zd_chip *chip) | |||
| 790 | goto out; | 791 | goto out; |
| 791 | 792 | ||
| 792 | r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); | 793 | r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); |
| 793 | if (r) | ||
| 794 | goto unlock; | ||
| 795 | |||
| 796 | r = patch_cr157(chip); | ||
| 797 | unlock: | ||
| 798 | t = zd_chip_unlock_phy_regs(chip); | 794 | t = zd_chip_unlock_phy_regs(chip); |
| 799 | if (t && !r) | 795 | if (t && !r) |
| 800 | r = t; | 796 | r = t; |
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h index b07569e391ee..e57ed75d9425 100644 --- a/drivers/net/wireless/zd1211rw/zd_chip.h +++ b/drivers/net/wireless/zd1211rw/zd_chip.h | |||
| @@ -641,8 +641,8 @@ enum { | |||
| 641 | * also only 11 channels. */ | 641 | * also only 11 channels. */ |
| 642 | #define E2P_ALLOWED_CHANNEL E2P_DATA(0x18) | 642 | #define E2P_ALLOWED_CHANNEL E2P_DATA(0x18) |
| 643 | 643 | ||
| 644 | #define E2P_PHY_REG E2P_DATA(0x1a) | ||
| 645 | #define E2P_DEVICE_VER E2P_DATA(0x20) | 644 | #define E2P_DEVICE_VER E2P_DATA(0x20) |
| 645 | #define E2P_PHY_REG E2P_DATA(0x25) | ||
| 646 | #define E2P_36M_CAL_VALUE1 E2P_DATA(0x28) | 646 | #define E2P_36M_CAL_VALUE1 E2P_DATA(0x28) |
| 647 | #define E2P_36M_CAL_VALUE2 E2P_DATA(0x2a) | 647 | #define E2P_36M_CAL_VALUE2 E2P_DATA(0x2a) |
| 648 | #define E2P_36M_CAL_VALUE3 E2P_DATA(0x2c) | 648 | #define E2P_36M_CAL_VALUE3 E2P_DATA(0x2c) |
| @@ -711,7 +711,7 @@ struct zd_chip { | |||
| 711 | u16 link_led; | 711 | u16 link_led; |
| 712 | unsigned int pa_type:4, | 712 | unsigned int pa_type:4, |
| 713 | patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, | 713 | patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, |
| 714 | new_phy_layout:1, | 714 | new_phy_layout:1, al2230s_bit:1, |
| 715 | is_zd1211b:1, supports_tx_led:1; | 715 | is_zd1211b:1, supports_tx_led:1; |
| 716 | }; | 716 | }; |
| 717 | 717 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c index 25323a13a3db..5235a7827ac5 100644 --- a/drivers/net/wireless/zd1211rw/zd_rf_al2230.c +++ b/drivers/net/wireless/zd1211rw/zd_rf_al2230.c | |||
| @@ -358,6 +358,12 @@ int zd_rf_init_al2230(struct zd_rf *rf) | |||
| 358 | { | 358 | { |
| 359 | struct zd_chip *chip = zd_rf_to_chip(rf); | 359 | struct zd_chip *chip = zd_rf_to_chip(rf); |
| 360 | 360 | ||
| 361 | if (chip->al2230s_bit) { | ||
| 362 | dev_err(zd_chip_dev(chip), "AL2230S devices are not yet " | ||
| 363 | "supported by this driver.\n"); | ||
| 364 | return -ENODEV; | ||
| 365 | } | ||
| 366 | |||
| 361 | rf->switch_radio_off = al2230_switch_radio_off; | 367 | rf->switch_radio_off = al2230_switch_radio_off; |
| 362 | if (chip->is_zd1211b) { | 368 | if (chip->is_zd1211b) { |
| 363 | rf->init_hw = zd1211b_al2230_init_hw; | 369 | rf->init_hw = zd1211b_al2230_init_hw; |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index aac8a1c5ba08..edaaad2f648b 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
| @@ -62,6 +62,7 @@ static struct usb_device_id usb_ids[] = { | |||
| 62 | { USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B }, | 62 | { USB_DEVICE(0x0471, 0x1236), .driver_info = DEVICE_ZD1211B }, |
| 63 | { USB_DEVICE(0x13b1, 0x0024), .driver_info = DEVICE_ZD1211B }, | 63 | { USB_DEVICE(0x13b1, 0x0024), .driver_info = DEVICE_ZD1211B }, |
| 64 | { USB_DEVICE(0x0586, 0x340f), .driver_info = DEVICE_ZD1211B }, | 64 | { USB_DEVICE(0x0586, 0x340f), .driver_info = DEVICE_ZD1211B }, |
| 65 | { USB_DEVICE(0x0baf, 0x0121), .driver_info = DEVICE_ZD1211B }, | ||
| 65 | /* "Driverless" devices that need ejecting */ | 66 | /* "Driverless" devices that need ejecting */ |
| 66 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, | 67 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, |
| 67 | {} | 68 | {} |
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c index 00e937e9240e..e7fbac529935 100644 --- a/drivers/oprofile/event_buffer.c +++ b/drivers/oprofile/event_buffer.c | |||
| @@ -70,11 +70,12 @@ void wake_up_buffer_waiter(void) | |||
| 70 | int alloc_event_buffer(void) | 70 | int alloc_event_buffer(void) |
| 71 | { | 71 | { |
| 72 | int err = -ENOMEM; | 72 | int err = -ENOMEM; |
| 73 | unsigned long flags; | ||
| 73 | 74 | ||
| 74 | spin_lock(&oprofilefs_lock); | 75 | spin_lock_irqsave(&oprofilefs_lock, flags); |
| 75 | buffer_size = fs_buffer_size; | 76 | buffer_size = fs_buffer_size; |
| 76 | buffer_watershed = fs_buffer_watershed; | 77 | buffer_watershed = fs_buffer_watershed; |
| 77 | spin_unlock(&oprofilefs_lock); | 78 | spin_unlock_irqrestore(&oprofilefs_lock, flags); |
| 78 | 79 | ||
| 79 | if (buffer_watershed >= buffer_size) | 80 | if (buffer_watershed >= buffer_size) |
| 80 | return -EINVAL; | 81 | return -EINVAL; |
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index 6e67b42ca46d..8543cb26cf34 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c | |||
| @@ -65,6 +65,7 @@ ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t co | |||
| 65 | int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count) | 65 | int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, size_t count) |
| 66 | { | 66 | { |
| 67 | char tmpbuf[TMPBUFSIZE]; | 67 | char tmpbuf[TMPBUFSIZE]; |
| 68 | unsigned long flags; | ||
| 68 | 69 | ||
| 69 | if (!count) | 70 | if (!count) |
| 70 | return 0; | 71 | return 0; |
| @@ -77,9 +78,9 @@ int oprofilefs_ulong_from_user(unsigned long * val, char const __user * buf, siz | |||
| 77 | if (copy_from_user(tmpbuf, buf, count)) | 78 | if (copy_from_user(tmpbuf, buf, count)) |
| 78 | return -EFAULT; | 79 | return -EFAULT; |
| 79 | 80 | ||
| 80 | spin_lock(&oprofilefs_lock); | 81 | spin_lock_irqsave(&oprofilefs_lock, flags); |
| 81 | *val = simple_strtoul(tmpbuf, NULL, 0); | 82 | *val = simple_strtoul(tmpbuf, NULL, 0); |
| 82 | spin_unlock(&oprofilefs_lock); | 83 | spin_unlock_irqrestore(&oprofilefs_lock, flags); |
| 83 | return 0; | 84 | return 0; |
| 84 | } | 85 | } |
| 85 | 86 | ||
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c index 9793533276ec..400bb90084cf 100644 --- a/drivers/parport/parport_sunbpp.c +++ b/drivers/parport/parport_sunbpp.c | |||
| @@ -126,7 +126,7 @@ static unsigned char status_sunbpp_to_pc(struct parport *p) | |||
| 126 | if (!(value_tcr & P_TCR_BUSY)) | 126 | if (!(value_tcr & P_TCR_BUSY)) |
| 127 | bits |= PARPORT_STATUS_BUSY; | 127 | bits |= PARPORT_STATUS_BUSY; |
| 128 | 128 | ||
| 129 | dprintk((KERN_DEBUG "tcr 0x%x ir 0x%x\n", regs->p_tcr, regs->p_ir)); | 129 | dprintk((KERN_DEBUG "tcr 0x%x ir 0x%x\n", value_tcr, value_ir)); |
| 130 | dprintk((KERN_DEBUG "read status 0x%x\n", bits)); | 130 | dprintk((KERN_DEBUG "read status 0x%x\n", bits)); |
| 131 | return bits; | 131 | return bits; |
| 132 | } | 132 | } |
| @@ -147,7 +147,7 @@ static unsigned char control_sunbpp_to_pc(struct parport *p) | |||
| 147 | if (value_or & P_OR_SLCT_IN) | 147 | if (value_or & P_OR_SLCT_IN) |
| 148 | bits |= PARPORT_CONTROL_SELECT; | 148 | bits |= PARPORT_CONTROL_SELECT; |
| 149 | 149 | ||
| 150 | dprintk((KERN_DEBUG "tcr 0x%x or 0x%x\n", regs->p_tcr, regs->p_or)); | 150 | dprintk((KERN_DEBUG "tcr 0x%x or 0x%x\n", value_tcr, value_or)); |
| 151 | dprintk((KERN_DEBUG "read control 0x%x\n", bits)); | 151 | dprintk((KERN_DEBUG "read control 0x%x\n", bits)); |
| 152 | return bits; | 152 | return bits; |
| 153 | } | 153 | } |
| @@ -165,7 +165,8 @@ static unsigned char parport_sunbpp_frob_control(struct parport *p, | |||
| 165 | unsigned char value_tcr = sbus_readb(®s->p_tcr); | 165 | unsigned char value_tcr = sbus_readb(®s->p_tcr); |
| 166 | unsigned char value_or = sbus_readb(®s->p_or); | 166 | unsigned char value_or = sbus_readb(®s->p_or); |
| 167 | 167 | ||
| 168 | dprintk((KERN_DEBUG "frob1: tcr 0x%x or 0x%x\n", regs->p_tcr, regs->p_or)); | 168 | dprintk((KERN_DEBUG "frob1: tcr 0x%x or 0x%x\n", |
| 169 | value_tcr, value_or)); | ||
| 169 | if (mask & PARPORT_CONTROL_STROBE) { | 170 | if (mask & PARPORT_CONTROL_STROBE) { |
| 170 | if (val & PARPORT_CONTROL_STROBE) { | 171 | if (val & PARPORT_CONTROL_STROBE) { |
| 171 | value_tcr &= ~P_TCR_DS; | 172 | value_tcr &= ~P_TCR_DS; |
| @@ -197,7 +198,8 @@ static unsigned char parport_sunbpp_frob_control(struct parport *p, | |||
| 197 | 198 | ||
| 198 | sbus_writeb(value_or, ®s->p_or); | 199 | sbus_writeb(value_or, ®s->p_or); |
| 199 | sbus_writeb(value_tcr, ®s->p_tcr); | 200 | sbus_writeb(value_tcr, ®s->p_tcr); |
| 200 | dprintk((KERN_DEBUG "frob2: tcr 0x%x or 0x%x\n", regs->p_tcr, regs->p_or)); | 201 | dprintk((KERN_DEBUG "frob2: tcr 0x%x or 0x%x\n", |
| 202 | value_tcr, value_or)); | ||
| 201 | return parport_sunbpp_read_control(p); | 203 | return parport_sunbpp_read_control(p); |
| 202 | } | 204 | } |
| 203 | 205 | ||
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 01869b1782e4..435c1958a7b7 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
| @@ -94,12 +94,14 @@ static void msi_set_mask_bit(unsigned int irq, int flag) | |||
| 94 | int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + | 94 | int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + |
| 95 | PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET; | 95 | PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET; |
| 96 | writel(flag, entry->mask_base + offset); | 96 | writel(flag, entry->mask_base + offset); |
| 97 | readl(entry->mask_base + offset); | ||
| 97 | break; | 98 | break; |
| 98 | } | 99 | } |
| 99 | default: | 100 | default: |
| 100 | BUG(); | 101 | BUG(); |
| 101 | break; | 102 | break; |
| 102 | } | 103 | } |
| 104 | entry->msi_attrib.masked = !!flag; | ||
| 103 | } | 105 | } |
| 104 | 106 | ||
| 105 | void read_msi_msg(unsigned int irq, struct msi_msg *msg) | 107 | void read_msi_msg(unsigned int irq, struct msi_msg *msg) |
| @@ -179,6 +181,7 @@ void write_msi_msg(unsigned int irq, struct msi_msg *msg) | |||
| 179 | default: | 181 | default: |
| 180 | BUG(); | 182 | BUG(); |
| 181 | } | 183 | } |
| 184 | entry->msg = *msg; | ||
| 182 | } | 185 | } |
| 183 | 186 | ||
| 184 | void mask_msi_irq(unsigned int irq) | 187 | void mask_msi_irq(unsigned int irq) |
| @@ -225,164 +228,60 @@ static struct msi_desc* alloc_msi_entry(void) | |||
| 225 | } | 228 | } |
| 226 | 229 | ||
| 227 | #ifdef CONFIG_PM | 230 | #ifdef CONFIG_PM |
| 228 | static int __pci_save_msi_state(struct pci_dev *dev) | ||
| 229 | { | ||
| 230 | int pos, i = 0; | ||
| 231 | u16 control; | ||
| 232 | struct pci_cap_saved_state *save_state; | ||
| 233 | u32 *cap; | ||
| 234 | |||
| 235 | if (!dev->msi_enabled) | ||
| 236 | return 0; | ||
| 237 | |||
| 238 | pos = pci_find_capability(dev, PCI_CAP_ID_MSI); | ||
| 239 | if (pos <= 0) | ||
| 240 | return 0; | ||
| 241 | |||
| 242 | save_state = kzalloc(sizeof(struct pci_cap_saved_state) + sizeof(u32) * 5, | ||
| 243 | GFP_KERNEL); | ||
| 244 | if (!save_state) { | ||
| 245 | printk(KERN_ERR "Out of memory in pci_save_msi_state\n"); | ||
| 246 | return -ENOMEM; | ||
| 247 | } | ||
| 248 | cap = &save_state->data[0]; | ||
| 249 | |||
| 250 | pci_read_config_dword(dev, pos, &cap[i++]); | ||
| 251 | control = cap[0] >> 16; | ||
| 252 | pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, &cap[i++]); | ||
| 253 | if (control & PCI_MSI_FLAGS_64BIT) { | ||
| 254 | pci_read_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, &cap[i++]); | ||
| 255 | pci_read_config_dword(dev, pos + PCI_MSI_DATA_64, &cap[i++]); | ||
| 256 | } else | ||
| 257 | pci_read_config_dword(dev, pos + PCI_MSI_DATA_32, &cap[i++]); | ||
| 258 | if (control & PCI_MSI_FLAGS_MASKBIT) | ||
| 259 | pci_read_config_dword(dev, pos + PCI_MSI_MASK_BIT, &cap[i++]); | ||
| 260 | save_state->cap_nr = PCI_CAP_ID_MSI; | ||
| 261 | pci_add_saved_cap(dev, save_state); | ||
| 262 | return 0; | ||
| 263 | } | ||
| 264 | |||
| 265 | static void __pci_restore_msi_state(struct pci_dev *dev) | 231 | static void __pci_restore_msi_state(struct pci_dev *dev) |
| 266 | { | 232 | { |
| 267 | int i = 0, pos; | 233 | int pos; |
| 268 | u16 control; | 234 | u16 control; |
| 269 | struct pci_cap_saved_state *save_state; | 235 | struct msi_desc *entry; |
| 270 | u32 *cap; | ||
| 271 | 236 | ||
| 272 | if (!dev->msi_enabled) | 237 | if (!dev->msi_enabled) |
| 273 | return; | 238 | return; |
| 274 | 239 | ||
| 275 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_MSI); | 240 | entry = get_irq_msi(dev->irq); |
| 276 | pos = pci_find_capability(dev, PCI_CAP_ID_MSI); | 241 | pos = entry->msi_attrib.pos; |
| 277 | if (!save_state || pos <= 0) | ||
| 278 | return; | ||
| 279 | cap = &save_state->data[0]; | ||
| 280 | 242 | ||
| 281 | pci_intx(dev, 0); /* disable intx */ | 243 | pci_intx(dev, 0); /* disable intx */ |
| 282 | control = cap[i++] >> 16; | ||
| 283 | msi_set_enable(dev, 0); | 244 | msi_set_enable(dev, 0); |
| 284 | pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_LO, cap[i++]); | 245 | write_msi_msg(dev->irq, &entry->msg); |
| 285 | if (control & PCI_MSI_FLAGS_64BIT) { | 246 | if (entry->msi_attrib.maskbit) |
| 286 | pci_write_config_dword(dev, pos + PCI_MSI_ADDRESS_HI, cap[i++]); | 247 | msi_set_mask_bit(dev->irq, entry->msi_attrib.masked); |
| 287 | pci_write_config_dword(dev, pos + PCI_MSI_DATA_64, cap[i++]); | 248 | |
| 288 | } else | 249 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &control); |
| 289 | pci_write_config_dword(dev, pos + PCI_MSI_DATA_32, cap[i++]); | 250 | control &= ~(PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE); |
| 290 | if (control & PCI_MSI_FLAGS_MASKBIT) | 251 | if (entry->msi_attrib.maskbit || !entry->msi_attrib.masked) |
| 291 | pci_write_config_dword(dev, pos + PCI_MSI_MASK_BIT, cap[i++]); | 252 | control |= PCI_MSI_FLAGS_ENABLE; |
| 292 | pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); | 253 | pci_write_config_word(dev, pos + PCI_MSI_FLAGS, control); |
| 293 | pci_remove_saved_cap(save_state); | ||
| 294 | kfree(save_state); | ||
| 295 | } | ||
| 296 | |||
| 297 | static int __pci_save_msix_state(struct pci_dev *dev) | ||
| 298 | { | ||
| 299 | int pos; | ||
| 300 | int irq, head, tail = 0; | ||
| 301 | u16 control; | ||
| 302 | struct pci_cap_saved_state *save_state; | ||
| 303 | |||
| 304 | if (!dev->msix_enabled) | ||
| 305 | return 0; | ||
| 306 | |||
| 307 | pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); | ||
| 308 | if (pos <= 0) | ||
| 309 | return 0; | ||
| 310 | |||
| 311 | /* save the capability */ | ||
| 312 | pci_read_config_word(dev, msi_control_reg(pos), &control); | ||
| 313 | save_state = kzalloc(sizeof(struct pci_cap_saved_state) + sizeof(u16), | ||
| 314 | GFP_KERNEL); | ||
| 315 | if (!save_state) { | ||
| 316 | printk(KERN_ERR "Out of memory in pci_save_msix_state\n"); | ||
| 317 | return -ENOMEM; | ||
| 318 | } | ||
| 319 | *((u16 *)&save_state->data[0]) = control; | ||
| 320 | |||
| 321 | /* save the table */ | ||
| 322 | irq = head = dev->first_msi_irq; | ||
| 323 | while (head != tail) { | ||
| 324 | struct msi_desc *entry; | ||
| 325 | |||
| 326 | entry = get_irq_msi(irq); | ||
| 327 | read_msi_msg(irq, &entry->msg_save); | ||
| 328 | |||
| 329 | tail = entry->link.tail; | ||
| 330 | irq = tail; | ||
| 331 | } | ||
| 332 | |||
| 333 | save_state->cap_nr = PCI_CAP_ID_MSIX; | ||
| 334 | pci_add_saved_cap(dev, save_state); | ||
| 335 | return 0; | ||
| 336 | } | ||
| 337 | |||
| 338 | int pci_save_msi_state(struct pci_dev *dev) | ||
| 339 | { | ||
| 340 | int rc; | ||
| 341 | |||
| 342 | rc = __pci_save_msi_state(dev); | ||
| 343 | if (rc) | ||
| 344 | return rc; | ||
| 345 | |||
| 346 | rc = __pci_save_msix_state(dev); | ||
| 347 | |||
| 348 | return rc; | ||
| 349 | } | 254 | } |
| 350 | 255 | ||
| 351 | static void __pci_restore_msix_state(struct pci_dev *dev) | 256 | static void __pci_restore_msix_state(struct pci_dev *dev) |
| 352 | { | 257 | { |
| 353 | u16 save; | ||
| 354 | int pos; | 258 | int pos; |
| 355 | int irq, head, tail = 0; | 259 | int irq, head, tail = 0; |
| 356 | struct msi_desc *entry; | 260 | struct msi_desc *entry; |
| 357 | struct pci_cap_saved_state *save_state; | 261 | u16 control; |
| 358 | 262 | ||
| 359 | if (!dev->msix_enabled) | 263 | if (!dev->msix_enabled) |
| 360 | return; | 264 | return; |
| 361 | 265 | ||
| 362 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_MSIX); | ||
| 363 | if (!save_state) | ||
| 364 | return; | ||
| 365 | save = *((u16 *)&save_state->data[0]); | ||
| 366 | pci_remove_saved_cap(save_state); | ||
| 367 | kfree(save_state); | ||
| 368 | |||
| 369 | pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); | ||
| 370 | if (pos <= 0) | ||
| 371 | return; | ||
| 372 | |||
| 373 | /* route the table */ | 266 | /* route the table */ |
| 374 | pci_intx(dev, 0); /* disable intx */ | 267 | pci_intx(dev, 0); /* disable intx */ |
| 375 | msix_set_enable(dev, 0); | 268 | msix_set_enable(dev, 0); |
| 376 | irq = head = dev->first_msi_irq; | 269 | irq = head = dev->first_msi_irq; |
| 270 | entry = get_irq_msi(irq); | ||
| 271 | pos = entry->msi_attrib.pos; | ||
| 377 | while (head != tail) { | 272 | while (head != tail) { |
| 378 | entry = get_irq_msi(irq); | 273 | entry = get_irq_msi(irq); |
| 379 | write_msi_msg(irq, &entry->msg_save); | 274 | write_msi_msg(irq, &entry->msg); |
| 275 | msi_set_mask_bit(irq, entry->msi_attrib.masked); | ||
| 380 | 276 | ||
| 381 | tail = entry->link.tail; | 277 | tail = entry->link.tail; |
| 382 | irq = tail; | 278 | irq = tail; |
| 383 | } | 279 | } |
| 384 | 280 | ||
| 385 | pci_write_config_word(dev, msi_control_reg(pos), save); | 281 | pci_read_config_word(dev, pos + PCI_MSIX_FLAGS, &control); |
| 282 | control &= ~PCI_MSIX_FLAGS_MASKALL; | ||
| 283 | control |= PCI_MSIX_FLAGS_ENABLE; | ||
| 284 | pci_write_config_word(dev, pos + PCI_MSIX_FLAGS, control); | ||
| 386 | } | 285 | } |
| 387 | 286 | ||
| 388 | void pci_restore_msi_state(struct pci_dev *dev) | 287 | void pci_restore_msi_state(struct pci_dev *dev) |
| @@ -420,6 +319,7 @@ static int msi_capability_init(struct pci_dev *dev) | |||
| 420 | entry->msi_attrib.is_64 = is_64bit_address(control); | 319 | entry->msi_attrib.is_64 = is_64bit_address(control); |
| 421 | entry->msi_attrib.entry_nr = 0; | 320 | entry->msi_attrib.entry_nr = 0; |
| 422 | entry->msi_attrib.maskbit = is_mask_bit_support(control); | 321 | entry->msi_attrib.maskbit = is_mask_bit_support(control); |
| 322 | entry->msi_attrib.masked = 1; | ||
| 423 | entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */ | 323 | entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */ |
| 424 | entry->msi_attrib.pos = pos; | 324 | entry->msi_attrib.pos = pos; |
| 425 | if (is_mask_bit_support(control)) { | 325 | if (is_mask_bit_support(control)) { |
| @@ -507,6 +407,7 @@ static int msix_capability_init(struct pci_dev *dev, | |||
| 507 | entry->msi_attrib.is_64 = 1; | 407 | entry->msi_attrib.is_64 = 1; |
| 508 | entry->msi_attrib.entry_nr = j; | 408 | entry->msi_attrib.entry_nr = j; |
| 509 | entry->msi_attrib.maskbit = 1; | 409 | entry->msi_attrib.maskbit = 1; |
| 410 | entry->msi_attrib.masked = 1; | ||
| 510 | entry->msi_attrib.default_irq = dev->irq; | 411 | entry->msi_attrib.default_irq = dev->irq; |
| 511 | entry->msi_attrib.pos = pos; | 412 | entry->msi_attrib.pos = pos; |
| 512 | entry->dev = dev; | 413 | entry->dev = dev; |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a32db0628157..d3eab057b2d3 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -551,7 +551,9 @@ static int pci_save_pcie_state(struct pci_dev *dev) | |||
| 551 | if (pos <= 0) | 551 | if (pos <= 0) |
| 552 | return 0; | 552 | return 0; |
| 553 | 553 | ||
| 554 | save_state = kzalloc(sizeof(*save_state) + sizeof(u16) * 4, GFP_KERNEL); | 554 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP); |
| 555 | if (!save_state) | ||
| 556 | save_state = kzalloc(sizeof(*save_state) + sizeof(u16) * 4, GFP_KERNEL); | ||
| 555 | if (!save_state) { | 557 | if (!save_state) { |
| 556 | dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n"); | 558 | dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n"); |
| 557 | return -ENOMEM; | 559 | return -ENOMEM; |
| @@ -582,8 +584,6 @@ static void pci_restore_pcie_state(struct pci_dev *dev) | |||
| 582 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]); | 584 | pci_write_config_word(dev, pos + PCI_EXP_LNKCTL, cap[i++]); |
| 583 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); | 585 | pci_write_config_word(dev, pos + PCI_EXP_SLTCTL, cap[i++]); |
| 584 | pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); | 586 | pci_write_config_word(dev, pos + PCI_EXP_RTCTL, cap[i++]); |
| 585 | pci_remove_saved_cap(save_state); | ||
| 586 | kfree(save_state); | ||
| 587 | } | 587 | } |
| 588 | 588 | ||
| 589 | 589 | ||
| @@ -597,7 +597,9 @@ static int pci_save_pcix_state(struct pci_dev *dev) | |||
| 597 | if (pos <= 0) | 597 | if (pos <= 0) |
| 598 | return 0; | 598 | return 0; |
| 599 | 599 | ||
| 600 | save_state = kzalloc(sizeof(*save_state) + sizeof(u16), GFP_KERNEL); | 600 | save_state = pci_find_saved_cap(dev, PCI_CAP_ID_EXP); |
| 601 | if (!save_state) | ||
| 602 | save_state = kzalloc(sizeof(*save_state) + sizeof(u16), GFP_KERNEL); | ||
| 601 | if (!save_state) { | 603 | if (!save_state) { |
| 602 | dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n"); | 604 | dev_err(&dev->dev, "Out of memory in pci_save_pcie_state\n"); |
| 603 | return -ENOMEM; | 605 | return -ENOMEM; |
| @@ -622,8 +624,6 @@ static void pci_restore_pcix_state(struct pci_dev *dev) | |||
| 622 | cap = (u16 *)&save_state->data[0]; | 624 | cap = (u16 *)&save_state->data[0]; |
| 623 | 625 | ||
| 624 | pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]); | 626 | pci_write_config_word(dev, pos + PCI_X_CMD, cap[i++]); |
| 625 | pci_remove_saved_cap(save_state); | ||
| 626 | kfree(save_state); | ||
| 627 | } | 627 | } |
| 628 | 628 | ||
| 629 | 629 | ||
| @@ -638,8 +638,6 @@ pci_save_state(struct pci_dev *dev) | |||
| 638 | /* XXX: 100% dword access ok here? */ | 638 | /* XXX: 100% dword access ok here? */ |
| 639 | for (i = 0; i < 16; i++) | 639 | for (i = 0; i < 16; i++) |
| 640 | pci_read_config_dword(dev, i * 4,&dev->saved_config_space[i]); | 640 | pci_read_config_dword(dev, i * 4,&dev->saved_config_space[i]); |
| 641 | if ((i = pci_save_msi_state(dev)) != 0) | ||
| 642 | return i; | ||
| 643 | if ((i = pci_save_pcie_state(dev)) != 0) | 641 | if ((i = pci_save_pcie_state(dev)) != 0) |
| 644 | return i; | 642 | return i; |
| 645 | if ((i = pci_save_pcix_state(dev)) != 0) | 643 | if ((i = pci_save_pcix_state(dev)) != 0) |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index ae7a975995a5..62ea04c8af64 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
| @@ -52,10 +52,8 @@ static inline void pci_no_msi(void) { } | |||
| 52 | #endif | 52 | #endif |
| 53 | 53 | ||
| 54 | #if defined(CONFIG_PCI_MSI) && defined(CONFIG_PM) | 54 | #if defined(CONFIG_PCI_MSI) && defined(CONFIG_PM) |
| 55 | int pci_save_msi_state(struct pci_dev *dev); | ||
| 56 | void pci_restore_msi_state(struct pci_dev *dev); | 55 | void pci_restore_msi_state(struct pci_dev *dev); |
| 57 | #else | 56 | #else |
| 58 | static inline int pci_save_msi_state(struct pci_dev *dev) { return 0; } | ||
| 59 | static inline void pci_restore_msi_state(struct pci_dev *dev) {} | 57 | static inline void pci_restore_msi_state(struct pci_dev *dev) {} |
| 60 | #endif | 58 | #endif |
| 61 | 59 | ||
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index 0be5a0b30725..df383645e366 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
| @@ -93,7 +93,7 @@ static int __devinit pcie_portdrv_probe (struct pci_dev *dev, | |||
| 93 | if (!dev->irq && dev->pin) { | 93 | if (!dev->irq && dev->pin) { |
| 94 | printk(KERN_WARNING | 94 | printk(KERN_WARNING |
| 95 | "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", | 95 | "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n", |
| 96 | __FUNCTION__, dev->device, dev->vendor); | 96 | __FUNCTION__, dev->vendor, dev->device); |
| 97 | } | 97 | } |
| 98 | if (pcie_port_device_register(dev)) { | 98 | if (pcie_port_device_register(dev)) { |
| 99 | pci_disable_device(dev); | 99 | pci_disable_device(dev); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index a4a96826d9e0..2fe1d690eb13 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
| @@ -682,34 +682,7 @@ static void pci_read_irq(struct pci_dev *dev) | |||
| 682 | dev->irq = irq; | 682 | dev->irq = irq; |
| 683 | } | 683 | } |
| 684 | 684 | ||
| 685 | static void change_legacy_io_resource(struct pci_dev * dev, unsigned index, | 685 | #define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED) |
| 686 | unsigned start, unsigned end) | ||
| 687 | { | ||
| 688 | unsigned base = start & PCI_BASE_ADDRESS_IO_MASK; | ||
| 689 | unsigned len = (end | ~PCI_BASE_ADDRESS_IO_MASK) - base + 1; | ||
| 690 | |||
| 691 | /* | ||
| 692 | * Some X versions get confused when the BARs reported through | ||
| 693 | * /sys or /proc differ from those seen in config space, thus | ||
| 694 | * try to update the config space values, too. | ||
| 695 | */ | ||
| 696 | if (!(pci_resource_flags(dev, index) & IORESOURCE_IO)) | ||
| 697 | printk(KERN_WARNING "%s: cannot adjust BAR%u (not I/O)\n", | ||
| 698 | pci_name(dev), index); | ||
| 699 | else if (pci_resource_len(dev, index) != len) | ||
| 700 | printk(KERN_WARNING "%s: cannot adjust BAR%u (size %04X)\n", | ||
| 701 | pci_name(dev), index, (unsigned)pci_resource_len(dev, index)); | ||
| 702 | else { | ||
| 703 | printk(KERN_INFO "%s: trying to change BAR%u from %04X to %04X\n", | ||
| 704 | pci_name(dev), index, | ||
| 705 | (unsigned)pci_resource_start(dev, index), base); | ||
| 706 | pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + index * 4, base); | ||
| 707 | } | ||
| 708 | pci_resource_start(dev, index) = start; | ||
| 709 | pci_resource_end(dev, index) = end; | ||
| 710 | pci_resource_flags(dev, index) = | ||
| 711 | IORESOURCE_IO | IORESOURCE_PCI_FIXED | PCI_BASE_ADDRESS_SPACE_IO; | ||
| 712 | } | ||
| 713 | 686 | ||
| 714 | /** | 687 | /** |
| 715 | * pci_setup_device - fill in class and map information of a device | 688 | * pci_setup_device - fill in class and map information of a device |
| @@ -762,12 +735,20 @@ static int pci_setup_device(struct pci_dev * dev) | |||
| 762 | u8 progif; | 735 | u8 progif; |
| 763 | pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); | 736 | pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); |
| 764 | if ((progif & 1) == 0) { | 737 | if ((progif & 1) == 0) { |
| 765 | change_legacy_io_resource(dev, 0, 0x1F0, 0x1F7); | 738 | dev->resource[0].start = 0x1F0; |
| 766 | change_legacy_io_resource(dev, 1, 0x3F6, 0x3F6); | 739 | dev->resource[0].end = 0x1F7; |
| 740 | dev->resource[0].flags = LEGACY_IO_RESOURCE; | ||
| 741 | dev->resource[1].start = 0x3F6; | ||
| 742 | dev->resource[1].end = 0x3F6; | ||
| 743 | dev->resource[1].flags = LEGACY_IO_RESOURCE; | ||
| 767 | } | 744 | } |
| 768 | if ((progif & 4) == 0) { | 745 | if ((progif & 4) == 0) { |
| 769 | change_legacy_io_resource(dev, 2, 0x170, 0x177); | 746 | dev->resource[2].start = 0x170; |
| 770 | change_legacy_io_resource(dev, 3, 0x376, 0x376); | 747 | dev->resource[2].end = 0x177; |
| 748 | dev->resource[2].flags = LEGACY_IO_RESOURCE; | ||
| 749 | dev->resource[3].start = 0x376; | ||
| 750 | dev->resource[3].end = 0x376; | ||
| 751 | dev->resource[3].flags = LEGACY_IO_RESOURCE; | ||
| 771 | } | 752 | } |
| 772 | } | 753 | } |
| 773 | break; | 754 | break; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 7f94fc098cd3..65d6f23ead41 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
| @@ -963,6 +963,13 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237, k8t_sound_ho | |||
| 963 | * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it | 963 | * bridge. Unfortunately, this device has no subvendor/subdevice ID. So it |
| 964 | * becomes necessary to do this tweak in two steps -- I've chosen the Host | 964 | * becomes necessary to do this tweak in two steps -- I've chosen the Host |
| 965 | * bridge as trigger. | 965 | * bridge as trigger. |
| 966 | * | ||
| 967 | * Note that we used to unhide the SMBus that way on Toshiba laptops | ||
| 968 | * (Satellite A40 and Tecra M2) but then found that the thermal management | ||
| 969 | * was done by SMM code, which could cause unsynchronized concurrent | ||
| 970 | * accesses to the SMBus registers, with potentially bad effects. Thus you | ||
| 971 | * should be very careful when adding new entries: if SMM is accessing the | ||
| 972 | * Intel SMBus, this is a very good reason to leave it hidden. | ||
| 966 | */ | 973 | */ |
| 967 | static int asus_hides_smbus; | 974 | static int asus_hides_smbus; |
| 968 | 975 | ||
| @@ -1040,17 +1047,6 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) | |||
| 1040 | case 0x099c: /* HP Compaq nx6110 */ | 1047 | case 0x099c: /* HP Compaq nx6110 */ |
| 1041 | asus_hides_smbus = 1; | 1048 | asus_hides_smbus = 1; |
| 1042 | } | 1049 | } |
| 1043 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_TOSHIBA)) { | ||
| 1044 | if (dev->device == PCI_DEVICE_ID_INTEL_82855GM_HB) | ||
| 1045 | switch(dev->subsystem_device) { | ||
| 1046 | case 0x0001: /* Toshiba Satellite A40 */ | ||
| 1047 | asus_hides_smbus = 1; | ||
| 1048 | } | ||
| 1049 | else if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) | ||
| 1050 | switch(dev->subsystem_device) { | ||
| 1051 | case 0x0001: /* Toshiba Tecra M2 */ | ||
| 1052 | asus_hides_smbus = 1; | ||
| 1053 | } | ||
| 1054 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { | 1050 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { |
| 1055 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) | 1051 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) |
| 1056 | switch(dev->subsystem_device) { | 1052 | switch(dev->subsystem_device) { |
diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c index 551bde5d9430..b693367d38cd 100644 --- a/drivers/pcmcia/au1000_generic.c +++ b/drivers/pcmcia/au1000_generic.c | |||
| @@ -372,7 +372,7 @@ int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level *ops, | |||
| 372 | skt->socket.resource_ops = &pccard_static_ops; | 372 | skt->socket.resource_ops = &pccard_static_ops; |
| 373 | skt->socket.ops = &au1x00_pcmcia_operations; | 373 | skt->socket.ops = &au1x00_pcmcia_operations; |
| 374 | skt->socket.owner = ops->owner; | 374 | skt->socket.owner = ops->owner; |
| 375 | skt->socket.dev.dev = dev; | 375 | skt->socket.dev.parent = dev; |
| 376 | 376 | ||
| 377 | init_timer(&skt->poll_timer); | 377 | init_timer(&skt->poll_timer); |
| 378 | skt->poll_timer.function = au1x00_pcmcia_poll_event; | 378 | skt->poll_timer.function = au1x00_pcmcia_poll_event; |
diff --git a/drivers/pcmcia/omap_cf.c b/drivers/pcmcia/omap_cf.c index d77f75129f8a..2df216b00817 100644 --- a/drivers/pcmcia/omap_cf.c +++ b/drivers/pcmcia/omap_cf.c | |||
| @@ -202,15 +202,14 @@ static struct pccard_operations omap_cf_ops = { | |||
| 202 | * "what chipselect is used". Boards could want more. | 202 | * "what chipselect is used". Boards could want more. |
| 203 | */ | 203 | */ |
| 204 | 204 | ||
| 205 | static int __devinit omap_cf_probe(struct device *dev) | 205 | static int __init omap_cf_probe(struct platform_device *pdev) |
| 206 | { | 206 | { |
| 207 | unsigned seg; | 207 | unsigned seg; |
| 208 | struct omap_cf_socket *cf; | 208 | struct omap_cf_socket *cf; |
| 209 | struct platform_device *pdev = to_platform_device(dev); | ||
| 210 | int irq; | 209 | int irq; |
| 211 | int status; | 210 | int status; |
| 212 | 211 | ||
| 213 | seg = (int) dev->platform_data; | 212 | seg = (int) pdev->dev.platform_data; |
| 214 | if (seg == 0 || seg > 3) | 213 | if (seg == 0 || seg > 3) |
| 215 | return -ENODEV; | 214 | return -ENODEV; |
| 216 | 215 | ||
| @@ -227,7 +226,7 @@ static int __devinit omap_cf_probe(struct device *dev) | |||
| 227 | cf->timer.data = (unsigned long) cf; | 226 | cf->timer.data = (unsigned long) cf; |
| 228 | 227 | ||
| 229 | cf->pdev = pdev; | 228 | cf->pdev = pdev; |
| 230 | dev_set_drvdata(dev, cf); | 229 | platform_set_drvdata(pdev, cf); |
| 231 | 230 | ||
| 232 | /* this primarily just shuts up irq handling noise */ | 231 | /* this primarily just shuts up irq handling noise */ |
| 233 | status = request_irq(irq, omap_cf_irq, IRQF_SHARED, | 232 | status = request_irq(irq, omap_cf_irq, IRQF_SHARED, |
| @@ -291,7 +290,7 @@ static int __devinit omap_cf_probe(struct device *dev) | |||
| 291 | omap_cf_present() ? "present" : "(not present)"); | 290 | omap_cf_present() ? "present" : "(not present)"); |
| 292 | 291 | ||
| 293 | cf->socket.owner = THIS_MODULE; | 292 | cf->socket.owner = THIS_MODULE; |
| 294 | cf->socket.dev.parent = dev; | 293 | cf->socket.dev.parent = &pdev->dev; |
| 295 | cf->socket.ops = &omap_cf_ops; | 294 | cf->socket.ops = &omap_cf_ops; |
| 296 | cf->socket.resource_ops = &pccard_static_ops; | 295 | cf->socket.resource_ops = &pccard_static_ops; |
| 297 | cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP | 296 | cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP |
| @@ -318,9 +317,9 @@ fail0: | |||
| 318 | return status; | 317 | return status; |
| 319 | } | 318 | } |
| 320 | 319 | ||
| 321 | static int __devexit omap_cf_remove(struct device *dev) | 320 | static int __exit omap_cf_remove(struct platform_device *pdev) |
| 322 | { | 321 | { |
| 323 | struct omap_cf_socket *cf = dev_get_drvdata(dev); | 322 | struct omap_cf_socket *cf = platform_get_drvdata(pdev); |
| 324 | 323 | ||
| 325 | cf->active = 0; | 324 | cf->active = 0; |
| 326 | pcmcia_unregister_socket(&cf->socket); | 325 | pcmcia_unregister_socket(&cf->socket); |
| @@ -332,26 +331,36 @@ static int __devexit omap_cf_remove(struct device *dev) | |||
| 332 | return 0; | 331 | return 0; |
| 333 | } | 332 | } |
| 334 | 333 | ||
| 335 | static struct device_driver omap_cf_driver = { | 334 | static int omap_cf_suspend(struct platform_device *pdev, pm_message_t mesg) |
| 336 | .name = (char *) driver_name, | 335 | { |
| 337 | .bus = &platform_bus_type, | 336 | return pcmcia_socket_dev_suspend(&pdev->dev, mesg); |
| 338 | .probe = omap_cf_probe, | 337 | } |
| 339 | .remove = __devexit_p(omap_cf_remove), | 338 | |
| 340 | .suspend = pcmcia_socket_dev_suspend, | 339 | static int omap_cf_resume(struct platform_device *pdev) |
| 341 | .resume = pcmcia_socket_dev_resume, | 340 | { |
| 341 | return pcmcia_socket_dev_resume(&pdev->dev); | ||
| 342 | } | ||
| 343 | |||
| 344 | static struct platform_driver omap_cf_driver = { | ||
| 345 | .driver = { | ||
| 346 | .name = (char *) driver_name, | ||
| 347 | }, | ||
| 348 | .remove = __exit_p(omap_cf_remove), | ||
| 349 | .suspend = omap_cf_suspend, | ||
| 350 | .resume = omap_cf_resume, | ||
| 342 | }; | 351 | }; |
| 343 | 352 | ||
| 344 | static int __init omap_cf_init(void) | 353 | static int __init omap_cf_init(void) |
| 345 | { | 354 | { |
| 346 | if (cpu_is_omap16xx()) | 355 | if (cpu_is_omap16xx()) |
| 347 | return driver_register(&omap_cf_driver); | 356 | return platform_driver_probe(&omap_cf_driver, omap_cf_probe); |
| 348 | return -ENODEV; | 357 | return -ENODEV; |
| 349 | } | 358 | } |
| 350 | 359 | ||
| 351 | static void __exit omap_cf_exit(void) | 360 | static void __exit omap_cf_exit(void) |
| 352 | { | 361 | { |
| 353 | if (cpu_is_omap16xx()) | 362 | if (cpu_is_omap16xx()) |
| 354 | driver_unregister(&omap_cf_driver); | 363 | platform_driver_unregister(&omap_cf_driver); |
| 355 | } | 364 | } |
| 356 | 365 | ||
| 357 | module_init(omap_cf_init); | 366 | module_init(omap_cf_init); |
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index 5026b345cb30..57e6ab1004d0 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c | |||
| @@ -451,7 +451,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev) | |||
| 451 | return -EINVAL; | 451 | return -EINVAL; |
| 452 | 452 | ||
| 453 | if(!pnp_can_configure(dev)) { | 453 | if(!pnp_can_configure(dev)) { |
| 454 | pnp_info("Device %s does not support resource configuration.", dev->dev.bus_id); | 454 | pnp_dbg("Device %s does not support resource configuration.", dev->dev.bus_id); |
| 455 | return -ENODEV; | 455 | return -ENODEV; |
| 456 | } | 456 | } |
| 457 | 457 | ||
| @@ -482,7 +482,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev) | |||
| 482 | int pnp_start_dev(struct pnp_dev *dev) | 482 | int pnp_start_dev(struct pnp_dev *dev) |
| 483 | { | 483 | { |
| 484 | if (!pnp_can_write(dev)) { | 484 | if (!pnp_can_write(dev)) { |
| 485 | pnp_info("Device %s does not support activation.", dev->dev.bus_id); | 485 | pnp_dbg("Device %s does not support activation.", dev->dev.bus_id); |
| 486 | return -EINVAL; | 486 | return -EINVAL; |
| 487 | } | 487 | } |
| 488 | 488 | ||
| @@ -506,7 +506,7 @@ int pnp_start_dev(struct pnp_dev *dev) | |||
| 506 | int pnp_stop_dev(struct pnp_dev *dev) | 506 | int pnp_stop_dev(struct pnp_dev *dev) |
| 507 | { | 507 | { |
| 508 | if (!pnp_can_disable(dev)) { | 508 | if (!pnp_can_disable(dev)) { |
| 509 | pnp_info("Device %s does not support disabling.", dev->dev.bus_id); | 509 | pnp_dbg("Device %s does not support disabling.", dev->dev.bus_id); |
| 510 | return -EINVAL; | 510 | return -EINVAL; |
| 511 | } | 511 | } |
| 512 | if (dev->protocol->disable(dev)<0) { | 512 | if (dev->protocol->disable(dev)<0) { |
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c index 2065e74bb63f..a8a95540b1ef 100644 --- a/drivers/pnp/system.c +++ b/drivers/pnp/system.c | |||
| @@ -22,7 +22,7 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
| 22 | { "", 0 } | 22 | { "", 0 } |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
| 25 | static void reserve_range(char *pnpid, int start, int end, int port) | 25 | static void reserve_range(const char *pnpid, resource_size_t start, resource_size_t end, int port) |
| 26 | { | 26 | { |
| 27 | struct resource *res; | 27 | struct resource *res; |
| 28 | char *regionid; | 28 | char *regionid; |
| @@ -32,9 +32,9 @@ static void reserve_range(char *pnpid, int start, int end, int port) | |||
| 32 | return; | 32 | return; |
| 33 | snprintf(regionid, 16, "pnp %s", pnpid); | 33 | snprintf(regionid, 16, "pnp %s", pnpid); |
| 34 | if (port) | 34 | if (port) |
| 35 | res = request_region(start,end-start+1,regionid); | 35 | res = request_region(start, end-start+1, regionid); |
| 36 | else | 36 | else |
| 37 | res = request_mem_region(start,end-start+1,regionid); | 37 | res = request_mem_region(start, end-start+1, regionid); |
| 38 | if (res == NULL) | 38 | if (res == NULL) |
| 39 | kfree(regionid); | 39 | kfree(regionid); |
| 40 | else | 40 | else |
| @@ -45,12 +45,13 @@ static void reserve_range(char *pnpid, int start, int end, int port) | |||
| 45 | * have double reservations. | 45 | * have double reservations. |
| 46 | */ | 46 | */ |
| 47 | printk(KERN_INFO | 47 | printk(KERN_INFO |
| 48 | "pnp: %s: %s range 0x%x-0x%x %s reserved\n", | 48 | "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n", |
| 49 | pnpid, port ? "ioport" : "iomem", start, end, | 49 | pnpid, port ? "ioport" : "iomem", |
| 50 | (unsigned long long)start, (unsigned long long)end, | ||
| 50 | NULL != res ? "has been" : "could not be"); | 51 | NULL != res ? "has been" : "could not be"); |
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | static void reserve_resources_of_dev(struct pnp_dev *dev) | 54 | static void reserve_resources_of_dev(const struct pnp_dev *dev) |
| 54 | { | 55 | { |
| 55 | int i; | 56 | int i; |
| 56 | 57 | ||
diff --git a/drivers/ps3/ps3av.c b/drivers/ps3/ps3av.c index 1926b4d3e1f4..d21e04ccb021 100644 --- a/drivers/ps3/ps3av.c +++ b/drivers/ps3/ps3av.c | |||
| @@ -24,6 +24,8 @@ | |||
| 24 | #include <linux/reboot.h> | 24 | #include <linux/reboot.h> |
| 25 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
| 26 | #include <linux/ioctl.h> | 26 | #include <linux/ioctl.h> |
| 27 | |||
| 28 | #include <asm/firmware.h> | ||
| 27 | #include <asm/lv1call.h> | 29 | #include <asm/lv1call.h> |
| 28 | #include <asm/ps3av.h> | 30 | #include <asm/ps3av.h> |
| 29 | #include <asm/ps3.h> | 31 | #include <asm/ps3.h> |
| @@ -947,7 +949,12 @@ static struct ps3_vuart_port_driver ps3av_driver = { | |||
| 947 | 949 | ||
| 948 | static int ps3av_module_init(void) | 950 | static int ps3av_module_init(void) |
| 949 | { | 951 | { |
| 950 | int error = ps3_vuart_port_driver_register(&ps3av_driver); | 952 | int error; |
| 953 | |||
| 954 | if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) | ||
| 955 | return -ENODEV; | ||
| 956 | |||
| 957 | error = ps3_vuart_port_driver_register(&ps3av_driver); | ||
| 951 | if (error) { | 958 | if (error) { |
| 952 | printk(KERN_ERR | 959 | printk(KERN_ERR |
| 953 | "%s: ps3_vuart_port_driver_register failed %d\n", | 960 | "%s: ps3_vuart_port_driver_register failed %d\n", |
diff --git a/drivers/ps3/ps3av_cmd.c b/drivers/ps3/ps3av_cmd.c index 21c97c80aa2e..bc70e81f8cb0 100644 --- a/drivers/ps3/ps3av_cmd.c +++ b/drivers/ps3/ps3av_cmd.c | |||
| @@ -485,12 +485,12 @@ static u8 ps3av_cnv_mclk(u32 fs) | |||
| 485 | 485 | ||
| 486 | static const u32 ps3av_ns_table[][5] = { | 486 | static const u32 ps3av_ns_table[][5] = { |
| 487 | /* D1, D2, D3, D4, D5 */ | 487 | /* D1, D2, D3, D4, D5 */ |
| 488 | [PS3AV_CMD_AUDIO_FS_44K-BASE] { 6272, 6272, 17836, 17836, 8918 }, | 488 | [PS3AV_CMD_AUDIO_FS_44K-BASE] = { 6272, 6272, 17836, 17836, 8918 }, |
| 489 | [PS3AV_CMD_AUDIO_FS_48K-BASE] { 6144, 6144, 11648, 11648, 5824 }, | 489 | [PS3AV_CMD_AUDIO_FS_48K-BASE] = { 6144, 6144, 11648, 11648, 5824 }, |
| 490 | [PS3AV_CMD_AUDIO_FS_88K-BASE] { 12544, 12544, 35672, 35672, 17836 }, | 490 | [PS3AV_CMD_AUDIO_FS_88K-BASE] = { 12544, 12544, 35672, 35672, 17836 }, |
| 491 | [PS3AV_CMD_AUDIO_FS_96K-BASE] { 12288, 12288, 23296, 23296, 11648 }, | 491 | [PS3AV_CMD_AUDIO_FS_96K-BASE] = { 12288, 12288, 23296, 23296, 11648 }, |
| 492 | [PS3AV_CMD_AUDIO_FS_176K-BASE] { 25088, 25088, 71344, 71344, 35672 }, | 492 | [PS3AV_CMD_AUDIO_FS_176K-BASE] = { 25088, 25088, 71344, 71344, 35672 }, |
| 493 | [PS3AV_CMD_AUDIO_FS_192K-BASE] { 24576, 24576, 46592, 46592, 23296 } | 493 | [PS3AV_CMD_AUDIO_FS_192K-BASE] = { 24576, 24576, 46592, 46592, 23296 } |
| 494 | }; | 494 | }; |
| 495 | 495 | ||
| 496 | static void ps3av_cnv_ns(u8 *ns, u32 fs, u32 video_vid) | 496 | static void ps3av_cnv_ns(u8 *ns, u32 fs, u32 video_vid) |
| @@ -543,9 +543,10 @@ static void ps3av_cnv_ns(u8 *ns, u32 fs, u32 video_vid) | |||
| 543 | 543 | ||
| 544 | #undef BASE | 544 | #undef BASE |
| 545 | 545 | ||
| 546 | static u8 ps3av_cnv_enable(u32 source, u8 *enable) | 546 | static u8 ps3av_cnv_enable(u32 source, const u8 *enable) |
| 547 | { | 547 | { |
| 548 | u8 *p, ret = 0; | 548 | const u8 *p; |
| 549 | u8 ret = 0; | ||
| 549 | 550 | ||
| 550 | if (source == PS3AV_CMD_AUDIO_SOURCE_SPDIF) { | 551 | if (source == PS3AV_CMD_AUDIO_SOURCE_SPDIF) { |
| 551 | ret = 0x03; | 552 | ret = 0x03; |
| @@ -559,9 +560,10 @@ static u8 ps3av_cnv_enable(u32 source, u8 *enable) | |||
| 559 | return ret; | 560 | return ret; |
| 560 | } | 561 | } |
| 561 | 562 | ||
| 562 | static u8 ps3av_cnv_fifomap(u8 *map) | 563 | static u8 ps3av_cnv_fifomap(const u8 *map) |
| 563 | { | 564 | { |
| 564 | u8 *p, ret = 0; | 565 | const u8 *p; |
| 566 | u8 ret = 0; | ||
| 565 | 567 | ||
| 566 | p = map; | 568 | p = map; |
| 567 | ret = p[0] + (p[1] << 2) + (p[2] << 4) + (p[3] << 6); | 569 | ret = p[0] + (p[1] << 2) + (p[2] << 4) + (p[3] << 6); |
| @@ -615,7 +617,7 @@ static void ps3av_cnv_info(struct ps3av_audio_info_frame *info, | |||
| 615 | info->pb5.lsv = mode->audio_downmix_level; | 617 | info->pb5.lsv = mode->audio_downmix_level; |
| 616 | } | 618 | } |
| 617 | 619 | ||
| 618 | static void ps3av_cnv_chstat(u8 *chstat, u8 *cs_info) | 620 | static void ps3av_cnv_chstat(u8 *chstat, const u8 *cs_info) |
| 619 | { | 621 | { |
| 620 | memcpy(chstat, cs_info, 5); | 622 | memcpy(chstat, cs_info, 5); |
| 621 | } | 623 | } |
diff --git a/drivers/ps3/sys-manager.c b/drivers/ps3/sys-manager.c index 0fc30be8b81e..3aa2b0dcc369 100644 --- a/drivers/ps3/sys-manager.c +++ b/drivers/ps3/sys-manager.c | |||
| @@ -22,7 +22,10 @@ | |||
| 22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 23 | #include <linux/workqueue.h> | 23 | #include <linux/workqueue.h> |
| 24 | #include <linux/reboot.h> | 24 | #include <linux/reboot.h> |
| 25 | |||
| 26 | #include <asm/firmware.h> | ||
| 25 | #include <asm/ps3.h> | 27 | #include <asm/ps3.h> |
| 28 | |||
| 26 | #include "vuart.h" | 29 | #include "vuart.h" |
| 27 | 30 | ||
| 28 | MODULE_AUTHOR("Sony Corporation"); | 31 | MODULE_AUTHOR("Sony Corporation"); |
| @@ -598,6 +601,9 @@ static struct ps3_vuart_port_driver ps3_sys_manager = { | |||
| 598 | 601 | ||
| 599 | static int __init ps3_sys_manager_init(void) | 602 | static int __init ps3_sys_manager_init(void) |
| 600 | { | 603 | { |
| 604 | if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) | ||
| 605 | return -ENODEV; | ||
| 606 | |||
| 601 | return ps3_vuart_port_driver_register(&ps3_sys_manager); | 607 | return ps3_vuart_port_driver_register(&ps3_sys_manager); |
| 602 | } | 608 | } |
| 603 | 609 | ||
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/vuart.c index 746298107d6f..6c12744eeb9d 100644 --- a/drivers/ps3/vuart.c +++ b/drivers/ps3/vuart.c | |||
| @@ -952,7 +952,7 @@ fail_alloc_irq: | |||
| 952 | kfree(dev->priv); | 952 | kfree(dev->priv); |
| 953 | dev->priv = NULL; | 953 | dev->priv = NULL; |
| 954 | fail_alloc: | 954 | fail_alloc: |
| 955 | vuart_bus_priv.devices[port_number] = 0; | 955 | vuart_bus_priv.devices[port_number] = NULL; |
| 956 | fail_match: | 956 | fail_match: |
| 957 | up(&vuart_bus_priv.probe_mutex); | 957 | up(&vuart_bus_priv.probe_mutex); |
| 958 | dev_dbg(&dev->core, "%s:%d failed\n", __func__, __LINE__); | 958 | dev_dbg(&dev->core, "%s:%d failed\n", __func__, __LINE__); |
| @@ -978,7 +978,7 @@ static int ps3_vuart_remove(struct device *_dev) | |||
| 978 | dev_dbg(&dev->core, "%s:%d: %s no remove method\n", __func__, | 978 | dev_dbg(&dev->core, "%s:%d: %s no remove method\n", __func__, |
| 979 | __LINE__, dev->core.bus_id); | 979 | __LINE__, dev->core.bus_id); |
| 980 | 980 | ||
| 981 | vuart_bus_priv.devices[dev->priv->port_number] = 0; | 981 | vuart_bus_priv.devices[dev->priv->port_number] = NULL; |
| 982 | 982 | ||
| 983 | if (--vuart_bus_priv.use_count == 0) { | 983 | if (--vuart_bus_priv.use_count == 0) { |
| 984 | BUG(); | 984 | BUG(); |
| @@ -1031,7 +1031,7 @@ int __init ps3_vuart_bus_init(void) | |||
| 1031 | pr_debug("%s:%d:\n", __func__, __LINE__); | 1031 | pr_debug("%s:%d:\n", __func__, __LINE__); |
| 1032 | 1032 | ||
| 1033 | if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) | 1033 | if (!firmware_has_feature(FW_FEATURE_PS3_LV1)) |
| 1034 | return 0; | 1034 | return -ENODEV; |
| 1035 | 1035 | ||
| 1036 | init_MUTEX(&vuart_bus_priv.probe_mutex); | 1036 | init_MUTEX(&vuart_bus_priv.probe_mutex); |
| 1037 | result = bus_register(&ps3_vuart_bus); | 1037 | result = bus_register(&ps3_vuart_bus); |
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 85bf795abdcc..7c0d60910077 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
| @@ -59,6 +59,19 @@ struct cmos_rtc { | |||
| 59 | 59 | ||
| 60 | static const char driver_name[] = "rtc_cmos"; | 60 | static const char driver_name[] = "rtc_cmos"; |
| 61 | 61 | ||
| 62 | /* The RTC_INTR register may have e.g. RTC_PF set even if RTC_PIE is clear; | ||
| 63 | * always mask it against the irq enable bits in RTC_CONTROL. Bit values | ||
| 64 | * are the same: PF==PIE, AF=AIE, UF=UIE; so RTC_IRQMASK works with both. | ||
| 65 | */ | ||
| 66 | #define RTC_IRQMASK (RTC_PF | RTC_AF | RTC_UF) | ||
| 67 | |||
| 68 | static inline int is_intr(u8 rtc_intr) | ||
| 69 | { | ||
| 70 | if (!(rtc_intr & RTC_IRQF)) | ||
| 71 | return 0; | ||
| 72 | return rtc_intr & RTC_IRQMASK; | ||
| 73 | } | ||
| 74 | |||
| 62 | /*----------------------------------------------------------------*/ | 75 | /*----------------------------------------------------------------*/ |
| 63 | 76 | ||
| 64 | static int cmos_read_time(struct device *dev, struct rtc_time *t) | 77 | static int cmos_read_time(struct device *dev, struct rtc_time *t) |
| @@ -188,7 +201,8 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
| 188 | rtc_control &= ~RTC_AIE; | 201 | rtc_control &= ~RTC_AIE; |
| 189 | CMOS_WRITE(rtc_control, RTC_CONTROL); | 202 | CMOS_WRITE(rtc_control, RTC_CONTROL); |
| 190 | rtc_intr = CMOS_READ(RTC_INTR_FLAGS); | 203 | rtc_intr = CMOS_READ(RTC_INTR_FLAGS); |
| 191 | if (rtc_intr) | 204 | rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF; |
| 205 | if (is_intr(rtc_intr)) | ||
| 192 | rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); | 206 | rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); |
| 193 | 207 | ||
| 194 | /* update alarm */ | 208 | /* update alarm */ |
| @@ -207,7 +221,8 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
| 207 | rtc_control |= RTC_AIE; | 221 | rtc_control |= RTC_AIE; |
| 208 | CMOS_WRITE(rtc_control, RTC_CONTROL); | 222 | CMOS_WRITE(rtc_control, RTC_CONTROL); |
| 209 | rtc_intr = CMOS_READ(RTC_INTR_FLAGS); | 223 | rtc_intr = CMOS_READ(RTC_INTR_FLAGS); |
| 210 | if (rtc_intr) | 224 | rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF; |
| 225 | if (is_intr(rtc_intr)) | ||
| 211 | rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); | 226 | rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); |
| 212 | } | 227 | } |
| 213 | 228 | ||
| @@ -287,7 +302,8 @@ cmos_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) | |||
| 287 | } | 302 | } |
| 288 | CMOS_WRITE(rtc_control, RTC_CONTROL); | 303 | CMOS_WRITE(rtc_control, RTC_CONTROL); |
| 289 | rtc_intr = CMOS_READ(RTC_INTR_FLAGS); | 304 | rtc_intr = CMOS_READ(RTC_INTR_FLAGS); |
| 290 | if (rtc_intr) | 305 | rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF; |
| 306 | if (is_intr(rtc_intr)) | ||
| 291 | rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); | 307 | rtc_update_irq(&cmos->rtc->class_dev, 1, rtc_intr); |
| 292 | spin_unlock_irqrestore(&rtc_lock, flags); | 308 | spin_unlock_irqrestore(&rtc_lock, flags); |
| 293 | return 0; | 309 | return 0; |
| @@ -353,12 +369,10 @@ static irqreturn_t cmos_interrupt(int irq, void *p) | |||
| 353 | 369 | ||
| 354 | spin_lock(&rtc_lock); | 370 | spin_lock(&rtc_lock); |
| 355 | irqstat = CMOS_READ(RTC_INTR_FLAGS); | 371 | irqstat = CMOS_READ(RTC_INTR_FLAGS); |
| 372 | irqstat &= (CMOS_READ(RTC_CONTROL) & RTC_IRQMASK) | RTC_IRQF; | ||
| 356 | spin_unlock(&rtc_lock); | 373 | spin_unlock(&rtc_lock); |
| 357 | 374 | ||
| 358 | if (irqstat) { | 375 | if (is_intr(irqstat)) { |
| 359 | /* NOTE: irqstat may have e.g. RTC_PF set | ||
| 360 | * even when RTC_PIE is clear... | ||
| 361 | */ | ||
| 362 | rtc_update_irq(p, 1, irqstat); | 376 | rtc_update_irq(p, 1, irqstat); |
| 363 | return IRQ_HANDLED; | 377 | return IRQ_HANDLED; |
| 364 | } else | 378 | } else |
| @@ -525,25 +539,26 @@ static int cmos_suspend(struct device *dev, pm_message_t mesg) | |||
| 525 | { | 539 | { |
| 526 | struct cmos_rtc *cmos = dev_get_drvdata(dev); | 540 | struct cmos_rtc *cmos = dev_get_drvdata(dev); |
| 527 | int do_wake = device_may_wakeup(dev); | 541 | int do_wake = device_may_wakeup(dev); |
| 528 | unsigned char tmp, irqstat; | 542 | unsigned char tmp; |
| 529 | 543 | ||
| 530 | /* only the alarm might be a wakeup event source */ | 544 | /* only the alarm might be a wakeup event source */ |
| 531 | spin_lock_irq(&rtc_lock); | 545 | spin_lock_irq(&rtc_lock); |
| 532 | cmos->suspend_ctrl = tmp = CMOS_READ(RTC_CONTROL); | 546 | cmos->suspend_ctrl = tmp = CMOS_READ(RTC_CONTROL); |
| 533 | if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) { | 547 | if (tmp & (RTC_PIE|RTC_AIE|RTC_UIE)) { |
| 548 | unsigned char irqstat; | ||
| 549 | |||
| 534 | if (do_wake) | 550 | if (do_wake) |
| 535 | tmp &= ~(RTC_PIE|RTC_UIE); | 551 | tmp &= ~(RTC_PIE|RTC_UIE); |
| 536 | else | 552 | else |
| 537 | tmp &= ~(RTC_PIE|RTC_AIE|RTC_UIE); | 553 | tmp &= ~(RTC_PIE|RTC_AIE|RTC_UIE); |
| 538 | CMOS_WRITE(tmp, RTC_CONTROL); | 554 | CMOS_WRITE(tmp, RTC_CONTROL); |
| 539 | irqstat = CMOS_READ(RTC_INTR_FLAGS); | 555 | irqstat = CMOS_READ(RTC_INTR_FLAGS); |
| 540 | } else | 556 | irqstat &= (tmp & RTC_IRQMASK) | RTC_IRQF; |
| 541 | irqstat = 0; | 557 | if (is_intr(irqstat)) |
| 558 | rtc_update_irq(&cmos->rtc->class_dev, 1, irqstat); | ||
| 559 | } | ||
| 542 | spin_unlock_irq(&rtc_lock); | 560 | spin_unlock_irq(&rtc_lock); |
| 543 | 561 | ||
| 544 | if (irqstat) | ||
| 545 | rtc_update_irq(&cmos->rtc->class_dev, 1, irqstat); | ||
| 546 | |||
| 547 | /* ACPI HOOK: enable ACPI_EVENT_RTC when (tmp & RTC_AIE) | 562 | /* ACPI HOOK: enable ACPI_EVENT_RTC when (tmp & RTC_AIE) |
| 548 | * ... it'd be best if we could do that under rtc_lock. | 563 | * ... it'd be best if we could do that under rtc_lock. |
| 549 | */ | 564 | */ |
| @@ -573,9 +588,10 @@ static int cmos_resume(struct device *dev) | |||
| 573 | spin_lock_irq(&rtc_lock); | 588 | spin_lock_irq(&rtc_lock); |
| 574 | CMOS_WRITE(tmp, RTC_CONTROL); | 589 | CMOS_WRITE(tmp, RTC_CONTROL); |
| 575 | tmp = CMOS_READ(RTC_INTR_FLAGS); | 590 | tmp = CMOS_READ(RTC_INTR_FLAGS); |
| 576 | spin_unlock_irq(&rtc_lock); | 591 | tmp &= (cmos->suspend_ctrl & RTC_IRQMASK) | RTC_IRQF; |
| 577 | if (tmp) | 592 | if (is_intr(tmp)) |
| 578 | rtc_update_irq(&cmos->rtc->class_dev, 1, tmp); | 593 | rtc_update_irq(&cmos->rtc->class_dev, 1, tmp); |
| 594 | spin_unlock_irq(&rtc_lock); | ||
| 579 | } | 595 | } |
| 580 | 596 | ||
| 581 | pr_debug("%s: resume, ctrl %02x\n", | 597 | pr_debug("%s: resume, ctrl %02x\n", |
| @@ -594,7 +610,7 @@ static int cmos_resume(struct device *dev) | |||
| 594 | /*----------------------------------------------------------------*/ | 610 | /*----------------------------------------------------------------*/ |
| 595 | 611 | ||
| 596 | /* The "CMOS" RTC normally lives on the platform_bus. On ACPI systems, | 612 | /* The "CMOS" RTC normally lives on the platform_bus. On ACPI systems, |
| 597 | * the device node may alternatively be created as a PNP device. | 613 | * the device node will always be created as a PNPACPI device. |
| 598 | */ | 614 | */ |
| 599 | 615 | ||
| 600 | #ifdef CONFIG_PNPACPI | 616 | #ifdef CONFIG_PNPACPI |
| @@ -673,7 +689,7 @@ module_exit(cmos_exit); | |||
| 673 | /*----------------------------------------------------------------*/ | 689 | /*----------------------------------------------------------------*/ |
| 674 | 690 | ||
| 675 | /* Platform setup should have set up an RTC device, when PNPACPI is | 691 | /* Platform setup should have set up an RTC device, when PNPACPI is |
| 676 | * unavailable ... this is the normal case, common even on PCs. | 692 | * unavailable ... this could happen even on (older) PCs. |
| 677 | */ | 693 | */ |
| 678 | 694 | ||
| 679 | static int __init cmos_platform_probe(struct platform_device *pdev) | 695 | static int __init cmos_platform_probe(struct platform_device *pdev) |
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index ab782bb46ac1..e810e4a44ed4 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
| @@ -65,7 +65,7 @@ static const u8 DASD_DIAG_CMS1[] = { 0xc3, 0xd4, 0xe2, 0xf1 };/* EBCDIC CMS1 */ | |||
| 65 | * resulting condition code and DIAG return code. */ | 65 | * resulting condition code and DIAG return code. */ |
| 66 | static inline int dia250(void *iob, int cmd) | 66 | static inline int dia250(void *iob, int cmd) |
| 67 | { | 67 | { |
| 68 | register unsigned long reg0 asm ("0") = (unsigned long) iob; | 68 | register unsigned long reg2 asm ("2") = (unsigned long) iob; |
| 69 | typedef union { | 69 | typedef union { |
| 70 | struct dasd_diag_init_io init_io; | 70 | struct dasd_diag_init_io init_io; |
| 71 | struct dasd_diag_rw_io rw_io; | 71 | struct dasd_diag_rw_io rw_io; |
| @@ -74,15 +74,15 @@ static inline int dia250(void *iob, int cmd) | |||
| 74 | 74 | ||
| 75 | rc = 3; | 75 | rc = 3; |
| 76 | asm volatile( | 76 | asm volatile( |
| 77 | " diag 0,%2,0x250\n" | 77 | " diag 2,%2,0x250\n" |
| 78 | "0: ipm %0\n" | 78 | "0: ipm %0\n" |
| 79 | " srl %0,28\n" | 79 | " srl %0,28\n" |
| 80 | " or %0,1\n" | 80 | " or %0,3\n" |
| 81 | "1:\n" | 81 | "1:\n" |
| 82 | EX_TABLE(0b,1b) | 82 | EX_TABLE(0b,1b) |
| 83 | : "+d" (rc), "=m" (*(addr_type *) iob) | 83 | : "+d" (rc), "=m" (*(addr_type *) iob) |
| 84 | : "d" (cmd), "d" (reg0), "m" (*(addr_type *) iob) | 84 | : "d" (cmd), "d" (reg2), "m" (*(addr_type *) iob) |
| 85 | : "1", "cc"); | 85 | : "3", "cc"); |
| 86 | return rc; | 86 | return rc; |
| 87 | } | 87 | } |
| 88 | 88 | ||
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index d48e3ca4752c..5aeb68e732b0 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
| @@ -71,19 +71,31 @@ __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) | |||
| 71 | * Provide an 'ungroup' attribute so the user can remove group devices no | 71 | * Provide an 'ungroup' attribute so the user can remove group devices no |
| 72 | * longer needed or accidentially created. Saves memory :) | 72 | * longer needed or accidentially created. Saves memory :) |
| 73 | */ | 73 | */ |
| 74 | static void ccwgroup_ungroup_callback(struct device *dev) | ||
| 75 | { | ||
| 76 | struct ccwgroup_device *gdev = to_ccwgroupdev(dev); | ||
| 77 | |||
| 78 | __ccwgroup_remove_symlinks(gdev); | ||
| 79 | device_unregister(dev); | ||
| 80 | } | ||
| 81 | |||
| 74 | static ssize_t | 82 | static ssize_t |
| 75 | ccwgroup_ungroup_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 83 | ccwgroup_ungroup_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
| 76 | { | 84 | { |
| 77 | struct ccwgroup_device *gdev; | 85 | struct ccwgroup_device *gdev; |
| 86 | int rc; | ||
| 78 | 87 | ||
| 79 | gdev = to_ccwgroupdev(dev); | 88 | gdev = to_ccwgroupdev(dev); |
| 80 | 89 | ||
| 81 | if (gdev->state != CCWGROUP_OFFLINE) | 90 | if (gdev->state != CCWGROUP_OFFLINE) |
| 82 | return -EINVAL; | 91 | return -EINVAL; |
| 83 | 92 | ||
| 84 | __ccwgroup_remove_symlinks(gdev); | 93 | /* Note that we cannot unregister the device from one of its |
| 85 | device_unregister(dev); | 94 | * attribute methods, so we have to use this roundabout approach. |
| 86 | 95 | */ | |
| 96 | rc = device_schedule_callback(dev, ccwgroup_ungroup_callback); | ||
| 97 | if (rc) | ||
| 98 | count = rc; | ||
| 87 | return count; | 99 | return count; |
| 88 | } | 100 | } |
| 89 | 101 | ||
diff --git a/drivers/s390/cio/device_status.c b/drivers/s390/cio/device_status.c index 6b1caea622ea..aa96e6752592 100644 --- a/drivers/s390/cio/device_status.c +++ b/drivers/s390/cio/device_status.c | |||
| @@ -221,6 +221,14 @@ ccw_device_accumulate_irb(struct ccw_device *cdev, struct irb *irb) | |||
| 221 | 221 | ||
| 222 | cdev_irb = &cdev->private->irb; | 222 | cdev_irb = &cdev->private->irb; |
| 223 | 223 | ||
| 224 | /* | ||
| 225 | * If the clear function had been performed, all formerly pending | ||
| 226 | * status at the subchannel has been cleared and we must not pass | ||
| 227 | * intermediate accumulated status to the device driver. | ||
| 228 | */ | ||
| 229 | if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) | ||
| 230 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | ||
| 231 | |||
| 224 | /* Copy bits which are valid only for the start function. */ | 232 | /* Copy bits which are valid only for the start function. */ |
| 225 | if (irb->scsw.fctl & SCSW_FCTL_START_FUNC) { | 233 | if (irb->scsw.fctl & SCSW_FCTL_START_FUNC) { |
| 226 | /* Copy key. */ | 234 | /* Copy key. */ |
| @@ -263,7 +271,11 @@ ccw_device_accumulate_irb(struct ccw_device *cdev, struct irb *irb) | |||
| 263 | cdev_irb->scsw.cpa = irb->scsw.cpa; | 271 | cdev_irb->scsw.cpa = irb->scsw.cpa; |
| 264 | /* Accumulate device status, but not the device busy flag. */ | 272 | /* Accumulate device status, but not the device busy flag. */ |
| 265 | cdev_irb->scsw.dstat &= ~DEV_STAT_BUSY; | 273 | cdev_irb->scsw.dstat &= ~DEV_STAT_BUSY; |
| 266 | cdev_irb->scsw.dstat |= irb->scsw.dstat; | 274 | /* dstat is not always valid. */ |
| 275 | if (irb->scsw.stctl & | ||
| 276 | (SCSW_STCTL_PRIM_STATUS | SCSW_STCTL_SEC_STATUS | ||
| 277 | | SCSW_STCTL_INTER_STATUS | SCSW_STCTL_ALERT_STATUS)) | ||
| 278 | cdev_irb->scsw.dstat |= irb->scsw.dstat; | ||
| 267 | /* Accumulate subchannel status. */ | 279 | /* Accumulate subchannel status. */ |
| 268 | cdev_irb->scsw.cstat |= irb->scsw.cstat; | 280 | cdev_irb->scsw.cstat |= irb->scsw.cstat; |
| 269 | /* Copy residual count if it is valid. */ | 281 | /* Copy residual count if it is valid. */ |
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index 5b1e3ff26c0b..05fac0733f3d 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
| @@ -210,9 +210,11 @@ again: | |||
| 210 | goto again; | 210 | goto again; |
| 211 | } | 211 | } |
| 212 | if (rc < 0) { | 212 | if (rc < 0) { |
| 213 | QDIO_DBF_TEXT3(1,trace,"sqberr"); | 213 | QDIO_DBF_TEXT3(1,trace,"sqberr"); |
| 214 | sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt,*cnt,ccq,q_no); | 214 | sprintf(dbf_text,"%2x,%2x",tmp_cnt,*cnt); |
| 215 | QDIO_DBF_TEXT3(1,trace,dbf_text); | 215 | QDIO_DBF_TEXT3(1,trace,dbf_text); |
| 216 | sprintf(dbf_text,"%d,%d",ccq,q_no); | ||
| 217 | QDIO_DBF_TEXT3(1,trace,dbf_text); | ||
| 216 | q->handler(q->cdev,QDIO_STATUS_ACTIVATE_CHECK_CONDITION| | 218 | q->handler(q->cdev,QDIO_STATUS_ACTIVATE_CHECK_CONDITION| |
| 217 | QDIO_STATUS_LOOK_FOR_ERROR, | 219 | QDIO_STATUS_LOOK_FOR_ERROR, |
| 218 | 0, 0, 0, -1, -1, q->int_parm); | 220 | 0, 0, 0, -1, -1, q->int_parm); |
| @@ -1250,7 +1252,6 @@ qdio_is_inbound_q_done(struct qdio_q *q) | |||
| 1250 | if (!no_used) { | 1252 | if (!no_used) { |
| 1251 | QDIO_DBF_TEXT4(0,trace,"inqisdnA"); | 1253 | QDIO_DBF_TEXT4(0,trace,"inqisdnA"); |
| 1252 | QDIO_DBF_HEX4(0,trace,&q,sizeof(void*)); | 1254 | QDIO_DBF_HEX4(0,trace,&q,sizeof(void*)); |
| 1253 | QDIO_DBF_TEXT4(0,trace,dbf_text); | ||
| 1254 | return 1; | 1255 | return 1; |
| 1255 | } | 1256 | } |
| 1256 | if (irq->is_qebsm) { | 1257 | if (irq->is_qebsm) { |
| @@ -3371,10 +3372,15 @@ qdio_do_qdio_fill_input(struct qdio_q *q, unsigned int qidx, | |||
| 3371 | unsigned int count, struct qdio_buffer *buffers) | 3372 | unsigned int count, struct qdio_buffer *buffers) |
| 3372 | { | 3373 | { |
| 3373 | struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; | 3374 | struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; |
| 3375 | int tmp = 0; | ||
| 3376 | |||
| 3374 | qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1); | 3377 | qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1); |
| 3375 | if (irq->is_qebsm) { | 3378 | if (irq->is_qebsm) { |
| 3376 | while (count) | 3379 | while (count) { |
| 3377 | set_slsb(q, &qidx, SLSB_CU_INPUT_EMPTY, &count); | 3380 | tmp = set_slsb(q, &qidx, SLSB_CU_INPUT_EMPTY, &count); |
| 3381 | if (!tmp) | ||
| 3382 | return; | ||
| 3383 | } | ||
| 3378 | return; | 3384 | return; |
| 3379 | } | 3385 | } |
| 3380 | for (;;) { | 3386 | for (;;) { |
| @@ -3390,11 +3396,15 @@ qdio_do_qdio_fill_output(struct qdio_q *q, unsigned int qidx, | |||
| 3390 | unsigned int count, struct qdio_buffer *buffers) | 3396 | unsigned int count, struct qdio_buffer *buffers) |
| 3391 | { | 3397 | { |
| 3392 | struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; | 3398 | struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; |
| 3399 | int tmp = 0; | ||
| 3393 | 3400 | ||
| 3394 | qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1); | 3401 | qidx &= (QDIO_MAX_BUFFERS_PER_Q - 1); |
| 3395 | if (irq->is_qebsm) { | 3402 | if (irq->is_qebsm) { |
| 3396 | while (count) | 3403 | while (count) { |
| 3397 | set_slsb(q, &qidx, SLSB_CU_OUTPUT_PRIMED, &count); | 3404 | tmp = set_slsb(q, &qidx, SLSB_CU_OUTPUT_PRIMED, &count); |
| 3405 | if (!tmp) | ||
| 3406 | return; | ||
| 3407 | } | ||
| 3398 | return; | 3408 | return; |
| 3399 | } | 3409 | } |
| 3400 | 3410 | ||
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index c7d1355237b6..bf37cdf43fae 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
| @@ -65,6 +65,8 @@ module_param_named(poll_thread, ap_thread_flag, int, 0000); | |||
| 65 | MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 1 (on)."); | 65 | MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 1 (on)."); |
| 66 | 66 | ||
| 67 | static struct device *ap_root_device = NULL; | 67 | static struct device *ap_root_device = NULL; |
| 68 | static DEFINE_SPINLOCK(ap_device_lock); | ||
| 69 | static LIST_HEAD(ap_device_list); | ||
| 68 | 70 | ||
| 69 | /** | 71 | /** |
| 70 | * Workqueue & timer for bus rescan. | 72 | * Workqueue & timer for bus rescan. |
| @@ -457,6 +459,9 @@ static int ap_device_probe(struct device *dev) | |||
| 457 | int rc; | 459 | int rc; |
| 458 | 460 | ||
| 459 | ap_dev->drv = ap_drv; | 461 | ap_dev->drv = ap_drv; |
| 462 | spin_lock_bh(&ap_device_lock); | ||
| 463 | list_add(&ap_dev->list, &ap_device_list); | ||
| 464 | spin_unlock_bh(&ap_device_lock); | ||
| 460 | rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; | 465 | rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; |
| 461 | return rc; | 466 | return rc; |
| 462 | } | 467 | } |
| @@ -497,6 +502,12 @@ static int ap_device_remove(struct device *dev) | |||
| 497 | ap_flush_queue(ap_dev); | 502 | ap_flush_queue(ap_dev); |
| 498 | if (ap_drv->remove) | 503 | if (ap_drv->remove) |
| 499 | ap_drv->remove(ap_dev); | 504 | ap_drv->remove(ap_dev); |
| 505 | spin_lock_bh(&ap_device_lock); | ||
| 506 | list_del_init(&ap_dev->list); | ||
| 507 | spin_unlock_bh(&ap_device_lock); | ||
| 508 | spin_lock_bh(&ap_dev->lock); | ||
| 509 | atomic_sub(ap_dev->queue_count, &ap_poll_requests); | ||
| 510 | spin_unlock_bh(&ap_dev->lock); | ||
| 500 | return 0; | 511 | return 0; |
| 501 | } | 512 | } |
| 502 | 513 | ||
| @@ -749,10 +760,16 @@ static void ap_scan_bus(struct work_struct *unused) | |||
| 749 | (void *)(unsigned long)qid, | 760 | (void *)(unsigned long)qid, |
| 750 | __ap_scan_bus); | 761 | __ap_scan_bus); |
| 751 | rc = ap_query_queue(qid, &queue_depth, &device_type); | 762 | rc = ap_query_queue(qid, &queue_depth, &device_type); |
| 752 | if (dev && rc) { | 763 | if (dev) { |
| 753 | put_device(dev); | 764 | ap_dev = to_ap_dev(dev); |
| 754 | device_unregister(dev); | 765 | spin_lock_bh(&ap_dev->lock); |
| 755 | continue; | 766 | if (rc || ap_dev->unregistered) { |
| 767 | spin_unlock_bh(&ap_dev->lock); | ||
| 768 | put_device(dev); | ||
| 769 | device_unregister(dev); | ||
| 770 | continue; | ||
| 771 | } else | ||
| 772 | spin_unlock_bh(&ap_dev->lock); | ||
| 756 | } | 773 | } |
| 757 | if (dev) { | 774 | if (dev) { |
| 758 | put_device(dev); | 775 | put_device(dev); |
| @@ -772,6 +789,7 @@ static void ap_scan_bus(struct work_struct *unused) | |||
| 772 | spin_lock_init(&ap_dev->lock); | 789 | spin_lock_init(&ap_dev->lock); |
| 773 | INIT_LIST_HEAD(&ap_dev->pendingq); | 790 | INIT_LIST_HEAD(&ap_dev->pendingq); |
| 774 | INIT_LIST_HEAD(&ap_dev->requestq); | 791 | INIT_LIST_HEAD(&ap_dev->requestq); |
| 792 | INIT_LIST_HEAD(&ap_dev->list); | ||
| 775 | if (device_type == 0) | 793 | if (device_type == 0) |
| 776 | ap_probe_device_type(ap_dev); | 794 | ap_probe_device_type(ap_dev); |
| 777 | else | 795 | else |
| @@ -852,6 +870,7 @@ static int ap_poll_read(struct ap_device *ap_dev, unsigned long *flags) | |||
| 852 | case AP_RESPONSE_NO_PENDING_REPLY: | 870 | case AP_RESPONSE_NO_PENDING_REPLY: |
| 853 | if (status.queue_empty) { | 871 | if (status.queue_empty) { |
| 854 | /* The card shouldn't forget requests but who knows. */ | 872 | /* The card shouldn't forget requests but who knows. */ |
| 873 | atomic_sub(ap_dev->queue_count, &ap_poll_requests); | ||
| 855 | ap_dev->queue_count = 0; | 874 | ap_dev->queue_count = 0; |
| 856 | list_splice_init(&ap_dev->pendingq, &ap_dev->requestq); | 875 | list_splice_init(&ap_dev->pendingq, &ap_dev->requestq); |
| 857 | ap_dev->requestq_count += ap_dev->pendingq_count; | 876 | ap_dev->requestq_count += ap_dev->pendingq_count; |
| @@ -985,7 +1004,7 @@ void ap_queue_message(struct ap_device *ap_dev, struct ap_message *ap_msg) | |||
| 985 | ap_dev->unregistered = 1; | 1004 | ap_dev->unregistered = 1; |
| 986 | } else { | 1005 | } else { |
| 987 | ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); | 1006 | ap_dev->drv->receive(ap_dev, ap_msg, ERR_PTR(-ENODEV)); |
| 988 | rc = 0; | 1007 | rc = -ENODEV; |
| 989 | } | 1008 | } |
| 990 | spin_unlock_bh(&ap_dev->lock); | 1009 | spin_unlock_bh(&ap_dev->lock); |
| 991 | if (rc == -ENODEV) | 1010 | if (rc == -ENODEV) |
| @@ -1033,31 +1052,29 @@ static void ap_poll_timeout(unsigned long unused) | |||
| 1033 | * polling until bit 2^0 of the control flags is not set. If bit 2^1 | 1052 | * polling until bit 2^0 of the control flags is not set. If bit 2^1 |
| 1034 | * of the control flags has been set arm the poll timer. | 1053 | * of the control flags has been set arm the poll timer. |
| 1035 | */ | 1054 | */ |
| 1036 | static int __ap_poll_all(struct device *dev, void *data) | 1055 | static int __ap_poll_all(struct ap_device *ap_dev, unsigned long *flags) |
| 1037 | { | 1056 | { |
| 1038 | struct ap_device *ap_dev = to_ap_dev(dev); | ||
| 1039 | int rc; | ||
| 1040 | |||
| 1041 | spin_lock(&ap_dev->lock); | 1057 | spin_lock(&ap_dev->lock); |
| 1042 | if (!ap_dev->unregistered) { | 1058 | if (!ap_dev->unregistered) { |
| 1043 | rc = ap_poll_queue(to_ap_dev(dev), (unsigned long *) data); | 1059 | if (ap_poll_queue(ap_dev, flags)) |
| 1044 | if (rc) | ||
| 1045 | ap_dev->unregistered = 1; | 1060 | ap_dev->unregistered = 1; |
| 1046 | } else | 1061 | } |
| 1047 | rc = 0; | ||
| 1048 | spin_unlock(&ap_dev->lock); | 1062 | spin_unlock(&ap_dev->lock); |
| 1049 | if (rc) | ||
| 1050 | device_unregister(&ap_dev->device); | ||
| 1051 | return 0; | 1063 | return 0; |
| 1052 | } | 1064 | } |
| 1053 | 1065 | ||
| 1054 | static void ap_poll_all(unsigned long dummy) | 1066 | static void ap_poll_all(unsigned long dummy) |
| 1055 | { | 1067 | { |
| 1056 | unsigned long flags; | 1068 | unsigned long flags; |
| 1069 | struct ap_device *ap_dev; | ||
| 1057 | 1070 | ||
| 1058 | do { | 1071 | do { |
| 1059 | flags = 0; | 1072 | flags = 0; |
| 1060 | bus_for_each_dev(&ap_bus_type, NULL, &flags, __ap_poll_all); | 1073 | spin_lock(&ap_device_lock); |
| 1074 | list_for_each_entry(ap_dev, &ap_device_list, list) { | ||
| 1075 | __ap_poll_all(ap_dev, &flags); | ||
| 1076 | } | ||
| 1077 | spin_unlock(&ap_device_lock); | ||
| 1061 | } while (flags & 1); | 1078 | } while (flags & 1); |
| 1062 | if (flags & 2) | 1079 | if (flags & 2) |
| 1063 | ap_schedule_poll_timer(); | 1080 | ap_schedule_poll_timer(); |
| @@ -1075,6 +1092,7 @@ static int ap_poll_thread(void *data) | |||
| 1075 | DECLARE_WAITQUEUE(wait, current); | 1092 | DECLARE_WAITQUEUE(wait, current); |
| 1076 | unsigned long flags; | 1093 | unsigned long flags; |
| 1077 | int requests; | 1094 | int requests; |
| 1095 | struct ap_device *ap_dev; | ||
| 1078 | 1096 | ||
| 1079 | set_user_nice(current, 19); | 1097 | set_user_nice(current, 19); |
| 1080 | while (1) { | 1098 | while (1) { |
| @@ -1092,10 +1110,12 @@ static int ap_poll_thread(void *data) | |||
| 1092 | set_current_state(TASK_RUNNING); | 1110 | set_current_state(TASK_RUNNING); |
| 1093 | remove_wait_queue(&ap_poll_wait, &wait); | 1111 | remove_wait_queue(&ap_poll_wait, &wait); |
| 1094 | 1112 | ||
| 1095 | local_bh_disable(); | ||
| 1096 | flags = 0; | 1113 | flags = 0; |
| 1097 | bus_for_each_dev(&ap_bus_type, NULL, &flags, __ap_poll_all); | 1114 | spin_lock_bh(&ap_device_lock); |
| 1098 | local_bh_enable(); | 1115 | list_for_each_entry(ap_dev, &ap_device_list, list) { |
| 1116 | __ap_poll_all(ap_dev, &flags); | ||
| 1117 | } | ||
| 1118 | spin_unlock_bh(&ap_device_lock); | ||
| 1099 | } | 1119 | } |
| 1100 | set_current_state(TASK_RUNNING); | 1120 | set_current_state(TASK_RUNNING); |
| 1101 | remove_wait_queue(&ap_poll_wait, &wait); | 1121 | remove_wait_queue(&ap_poll_wait, &wait); |
diff --git a/drivers/s390/crypto/ap_bus.h b/drivers/s390/crypto/ap_bus.h index 83b69c01cd6e..008559ea742b 100644 --- a/drivers/s390/crypto/ap_bus.h +++ b/drivers/s390/crypto/ap_bus.h | |||
| @@ -106,6 +106,7 @@ struct ap_device { | |||
| 106 | struct device device; | 106 | struct device device; |
| 107 | struct ap_driver *drv; /* Pointer to AP device driver. */ | 107 | struct ap_driver *drv; /* Pointer to AP device driver. */ |
| 108 | spinlock_t lock; /* Per device lock. */ | 108 | spinlock_t lock; /* Per device lock. */ |
| 109 | struct list_head list; /* private list of all AP devices. */ | ||
| 109 | 110 | ||
| 110 | ap_qid_t qid; /* AP queue id. */ | 111 | ap_qid_t qid; /* AP queue id. */ |
| 111 | int queue_depth; /* AP queue depth.*/ | 112 | int queue_depth; /* AP queue depth.*/ |
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 99761391f340..e3625a47a596 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c | |||
| @@ -298,14 +298,14 @@ static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex) | |||
| 298 | get_device(&zdev->ap_dev->device); | 298 | get_device(&zdev->ap_dev->device); |
| 299 | zdev->request_count++; | 299 | zdev->request_count++; |
| 300 | __zcrypt_decrease_preference(zdev); | 300 | __zcrypt_decrease_preference(zdev); |
| 301 | spin_unlock_bh(&zcrypt_device_lock); | ||
| 302 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { | 301 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { |
| 302 | spin_unlock_bh(&zcrypt_device_lock); | ||
| 303 | rc = zdev->ops->rsa_modexpo(zdev, mex); | 303 | rc = zdev->ops->rsa_modexpo(zdev, mex); |
| 304 | spin_lock_bh(&zcrypt_device_lock); | ||
| 304 | module_put(zdev->ap_dev->drv->driver.owner); | 305 | module_put(zdev->ap_dev->drv->driver.owner); |
| 305 | } | 306 | } |
| 306 | else | 307 | else |
| 307 | rc = -EAGAIN; | 308 | rc = -EAGAIN; |
| 308 | spin_lock_bh(&zcrypt_device_lock); | ||
| 309 | zdev->request_count--; | 309 | zdev->request_count--; |
| 310 | __zcrypt_increase_preference(zdev); | 310 | __zcrypt_increase_preference(zdev); |
| 311 | put_device(&zdev->ap_dev->device); | 311 | put_device(&zdev->ap_dev->device); |
| @@ -373,14 +373,14 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt) | |||
| 373 | get_device(&zdev->ap_dev->device); | 373 | get_device(&zdev->ap_dev->device); |
| 374 | zdev->request_count++; | 374 | zdev->request_count++; |
| 375 | __zcrypt_decrease_preference(zdev); | 375 | __zcrypt_decrease_preference(zdev); |
| 376 | spin_unlock_bh(&zcrypt_device_lock); | ||
| 377 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { | 376 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { |
| 377 | spin_unlock_bh(&zcrypt_device_lock); | ||
| 378 | rc = zdev->ops->rsa_modexpo_crt(zdev, crt); | 378 | rc = zdev->ops->rsa_modexpo_crt(zdev, crt); |
| 379 | spin_lock_bh(&zcrypt_device_lock); | ||
| 379 | module_put(zdev->ap_dev->drv->driver.owner); | 380 | module_put(zdev->ap_dev->drv->driver.owner); |
| 380 | } | 381 | } |
| 381 | else | 382 | else |
| 382 | rc = -EAGAIN; | 383 | rc = -EAGAIN; |
| 383 | spin_lock_bh(&zcrypt_device_lock); | ||
| 384 | zdev->request_count--; | 384 | zdev->request_count--; |
| 385 | __zcrypt_increase_preference(zdev); | 385 | __zcrypt_increase_preference(zdev); |
| 386 | put_device(&zdev->ap_dev->device); | 386 | put_device(&zdev->ap_dev->device); |
| @@ -408,14 +408,14 @@ static long zcrypt_send_cprb(struct ica_xcRB *xcRB) | |||
| 408 | get_device(&zdev->ap_dev->device); | 408 | get_device(&zdev->ap_dev->device); |
| 409 | zdev->request_count++; | 409 | zdev->request_count++; |
| 410 | __zcrypt_decrease_preference(zdev); | 410 | __zcrypt_decrease_preference(zdev); |
| 411 | spin_unlock_bh(&zcrypt_device_lock); | ||
| 412 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { | 411 | if (try_module_get(zdev->ap_dev->drv->driver.owner)) { |
| 412 | spin_unlock_bh(&zcrypt_device_lock); | ||
| 413 | rc = zdev->ops->send_cprb(zdev, xcRB); | 413 | rc = zdev->ops->send_cprb(zdev, xcRB); |
| 414 | spin_lock_bh(&zcrypt_device_lock); | ||
| 414 | module_put(zdev->ap_dev->drv->driver.owner); | 415 | module_put(zdev->ap_dev->drv->driver.owner); |
| 415 | } | 416 | } |
| 416 | else | 417 | else |
| 417 | rc = -EAGAIN; | 418 | rc = -EAGAIN; |
| 418 | spin_lock_bh(&zcrypt_device_lock); | ||
| 419 | zdev->request_count--; | 419 | zdev->request_count--; |
| 420 | __zcrypt_increase_preference(zdev); | 420 | __zcrypt_increase_preference(zdev); |
| 421 | put_device(&zdev->ap_dev->device); | 421 | put_device(&zdev->ap_dev->device); |
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h index e95c281f1e36..84b108d7c7fd 100644 --- a/drivers/s390/net/qeth.h +++ b/drivers/s390/net/qeth.h | |||
| @@ -873,7 +873,7 @@ qeth_realloc_headroom(struct qeth_card *card, struct sk_buff *skb, int size) | |||
| 873 | } | 873 | } |
| 874 | 874 | ||
| 875 | static inline struct sk_buff * | 875 | static inline struct sk_buff * |
| 876 | qeth_pskb_unshare(struct sk_buff *skb, int pri) | 876 | qeth_pskb_unshare(struct sk_buff *skb, gfp_t pri) |
| 877 | { | 877 | { |
| 878 | struct sk_buff *nskb; | 878 | struct sk_buff *nskb; |
| 879 | if (!skb_cloned(skb)) | 879 | if (!skb_cloned(skb)) |
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index eec28c142a59..5041c9dfbe3b 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c | |||
| @@ -249,7 +249,7 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp | |||
| 249 | #ifdef CONFIG_PCI | 249 | #ifdef CONFIG_PCI |
| 250 | struct pci_dev *pdev; | 250 | struct pci_dev *pdev; |
| 251 | struct pcidev_cookie *pcp; | 251 | struct pcidev_cookie *pcp; |
| 252 | pdev = pci_find_slot (((int *) op->oprom_array)[0], | 252 | pdev = pci_get_bus_and_slot (((int *) op->oprom_array)[0], |
| 253 | ((int *) op->oprom_array)[1]); | 253 | ((int *) op->oprom_array)[1]); |
| 254 | 254 | ||
| 255 | pcp = pdev->sysdata; | 255 | pcp = pdev->sysdata; |
| @@ -260,6 +260,7 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp | |||
| 260 | op->oprom_size = sizeof(int); | 260 | op->oprom_size = sizeof(int); |
| 261 | err = copyout(argp, op, bufsize + sizeof(int)); | 261 | err = copyout(argp, op, bufsize + sizeof(int)); |
| 262 | } | 262 | } |
| 263 | pci_dev_put(pdev); | ||
| 263 | #endif | 264 | #endif |
| 264 | } | 265 | } |
| 265 | 266 | ||
diff --git a/drivers/sbus/char/vfc_dev.c b/drivers/sbus/char/vfc_dev.c index 8bfb67ccdcd4..c3135e2fbd5a 100644 --- a/drivers/sbus/char/vfc_dev.c +++ b/drivers/sbus/char/vfc_dev.c | |||
| @@ -259,11 +259,10 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, void __user *argp) | |||
| 259 | if (copy_from_user(&inout, argp, sizeof(inout))) | 259 | if (copy_from_user(&inout, argp, sizeof(inout))) |
| 260 | return -EFAULT; | 260 | return -EFAULT; |
| 261 | 261 | ||
| 262 | buffer = kmalloc(inout.len, GFP_KERNEL); | 262 | buffer = kzalloc(inout.len, GFP_KERNEL); |
| 263 | if (buffer == NULL) | 263 | if (buffer == NULL) |
| 264 | return -ENOMEM; | 264 | return -ENOMEM; |
| 265 | 265 | ||
| 266 | memset(buffer,0,inout.len); | ||
| 267 | vfc_lock_device(dev); | 266 | vfc_lock_device(dev); |
| 268 | inout.ret= | 267 | inout.ret= |
| 269 | vfc_i2c_recvbuf(dev,inout.addr & 0xff | 268 | vfc_i2c_recvbuf(dev,inout.addr & 0xff |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index bf5d63e1beee..656bdb1352d8 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
| @@ -1864,10 +1864,17 @@ static int tw_scsiop_read_write(TW_Device_Extension *tw_dev, int request_id) | |||
| 1864 | /* This function will handle the request sense scsi command */ | 1864 | /* This function will handle the request sense scsi command */ |
| 1865 | static int tw_scsiop_request_sense(TW_Device_Extension *tw_dev, int request_id) | 1865 | static int tw_scsiop_request_sense(TW_Device_Extension *tw_dev, int request_id) |
| 1866 | { | 1866 | { |
| 1867 | char request_buffer[18]; | ||
| 1868 | |||
| 1867 | dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_request_sense()\n"); | 1869 | dprintk(KERN_NOTICE "3w-xxxx: tw_scsiop_request_sense()\n"); |
| 1868 | 1870 | ||
| 1869 | /* For now we just zero the request buffer */ | 1871 | memset(request_buffer, 0, sizeof(request_buffer)); |
| 1870 | memset(tw_dev->srb[request_id]->request_buffer, 0, tw_dev->srb[request_id]->request_bufflen); | 1872 | request_buffer[0] = 0x70; /* Immediate fixed format */ |
| 1873 | request_buffer[7] = 10; /* minimum size per SPC: 18 bytes */ | ||
| 1874 | /* leave all other fields zero, giving effectively NO_SENSE return */ | ||
| 1875 | tw_transfer_internal(tw_dev, request_id, request_buffer, | ||
| 1876 | sizeof(request_buffer)); | ||
| 1877 | |||
| 1871 | tw_dev->state[request_id] = TW_S_COMPLETED; | 1878 | tw_dev->state[request_id] = TW_S_COMPLETED; |
| 1872 | tw_state_request_finish(tw_dev, request_id); | 1879 | tw_state_request_finish(tw_dev, request_id); |
| 1873 | 1880 | ||
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 8c81cec85298..60446b88f721 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
| @@ -3091,6 +3091,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b) | |||
| 3091 | cmdp->u.raw64.direction = | 3091 | cmdp->u.raw64.direction = |
| 3092 | gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; | 3092 | gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; |
| 3093 | memcpy(cmdp->u.raw64.cmd,scp->cmnd,16); | 3093 | memcpy(cmdp->u.raw64.cmd,scp->cmnd,16); |
| 3094 | cmdp->u.raw64.sg_ranz = 0; | ||
| 3094 | } else { | 3095 | } else { |
| 3095 | cmdp->u.raw.reserved = 0; | 3096 | cmdp->u.raw.reserved = 0; |
| 3096 | cmdp->u.raw.mdisc_time = 0; | 3097 | cmdp->u.raw.mdisc_time = 0; |
| @@ -3107,6 +3108,7 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b) | |||
| 3107 | cmdp->u.raw.direction = | 3108 | cmdp->u.raw.direction = |
| 3108 | gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; | 3109 | gdth_direction_tab[scp->cmnd[0]]==DOU ? GDTH_DATA_OUT:GDTH_DATA_IN; |
| 3109 | memcpy(cmdp->u.raw.cmd,scp->cmnd,12); | 3110 | memcpy(cmdp->u.raw.cmd,scp->cmnd,12); |
| 3111 | cmdp->u.raw.sg_ranz = 0; | ||
| 3110 | } | 3112 | } |
| 3111 | 3113 | ||
| 3112 | if (scp->use_sg) { | 3114 | if (scp->use_sg) { |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 9d014e5a81c4..057fd7e0e379 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
| @@ -1817,10 +1817,9 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, | |||
| 1817 | struct lpfc_sli *psli = &phba->sli; | 1817 | struct lpfc_sli *psli = &phba->sli; |
| 1818 | struct lpfc_sli_ring *pring; | 1818 | struct lpfc_sli_ring *pring; |
| 1819 | 1819 | ||
| 1820 | if (state == pci_channel_io_perm_failure) { | 1820 | if (state == pci_channel_io_perm_failure) |
| 1821 | lpfc_pci_remove_one(pdev); | ||
| 1822 | return PCI_ERS_RESULT_DISCONNECT; | 1821 | return PCI_ERS_RESULT_DISCONNECT; |
| 1823 | } | 1822 | |
| 1824 | pci_disable_device(pdev); | 1823 | pci_disable_device(pdev); |
| 1825 | /* | 1824 | /* |
| 1826 | * There may be I/Os dropped by the firmware. | 1825 | * There may be I/Os dropped by the firmware. |
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 9b827ceec501..9f10689905a8 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
| @@ -1281,7 +1281,7 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) | |||
| 1281 | (struct scatterlist *)Cmnd->request_buffer, | 1281 | (struct scatterlist *)Cmnd->request_buffer, |
| 1282 | Cmnd->use_sg, | 1282 | Cmnd->use_sg, |
| 1283 | Cmnd->sc_data_direction); | 1283 | Cmnd->sc_data_direction); |
| 1284 | } else { | 1284 | } else if (Cmnd->request_bufflen) { |
| 1285 | sbus_unmap_single(qpti->sdev, | 1285 | sbus_unmap_single(qpti->sdev, |
| 1286 | (__u32)((unsigned long)Cmnd->SCp.ptr), | 1286 | (__u32)((unsigned long)Cmnd->SCp.ptr), |
| 1287 | Cmnd->request_bufflen, | 1287 | Cmnd->request_bufflen, |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index b8edcf5b5451..918bb6019540 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
| @@ -716,7 +716,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, | |||
| 716 | */ | 716 | */ |
| 717 | if (copy_sense) { | 717 | if (copy_sense) { |
| 718 | if (!SCSI_SENSE_VALID(scmd)) { | 718 | if (!SCSI_SENSE_VALID(scmd)) { |
| 719 | memcpy(scmd->sense_buffer, scmd->request_buffer, | 719 | memcpy(scmd->sense_buffer, page_address(sgl.page), |
| 720 | sizeof(scmd->sense_buffer)); | 720 | sizeof(scmd->sense_buffer)); |
| 721 | } | 721 | } |
| 722 | __free_page(sgl.page); | 722 | __free_page(sgl.page); |
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index c275dcac3f18..939de0de18bc 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
| @@ -452,10 +452,22 @@ store_rescan_field (struct device *dev, struct device_attribute *attr, const cha | |||
| 452 | } | 452 | } |
| 453 | static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field); | 453 | static DEVICE_ATTR(rescan, S_IWUSR, NULL, store_rescan_field); |
| 454 | 454 | ||
| 455 | static void sdev_store_delete_callback(struct device *dev) | ||
| 456 | { | ||
| 457 | scsi_remove_device(to_scsi_device(dev)); | ||
| 458 | } | ||
| 459 | |||
| 455 | static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf, | 460 | static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf, |
| 456 | size_t count) | 461 | size_t count) |
| 457 | { | 462 | { |
| 458 | scsi_remove_device(to_scsi_device(dev)); | 463 | int rc; |
| 464 | |||
| 465 | /* An attribute cannot be unregistered by one of its own methods, | ||
| 466 | * so we have to use this roundabout approach. | ||
| 467 | */ | ||
| 468 | rc = device_schedule_callback(dev, sdev_store_delete_callback); | ||
| 469 | if (rc) | ||
| 470 | count = rc; | ||
| 459 | return count; | 471 | return count; |
| 460 | }; | 472 | }; |
| 461 | static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); | 473 | static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index c129a0e8e807..90621c3312bc 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
| @@ -1310,7 +1310,8 @@ static unsigned int check_modem_status(struct uart_8250_port *up) | |||
| 1310 | { | 1310 | { |
| 1311 | unsigned int status = serial_in(up, UART_MSR); | 1311 | unsigned int status = serial_in(up, UART_MSR); |
| 1312 | 1312 | ||
| 1313 | if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI) { | 1313 | if (status & UART_MSR_ANY_DELTA && up->ier & UART_IER_MSI && |
| 1314 | up->port.info != NULL) { | ||
| 1314 | if (status & UART_MSR_TERI) | 1315 | if (status & UART_MSR_TERI) |
| 1315 | up->port.icount.rng++; | 1316 | up->port.icount.rng++; |
| 1316 | if (status & UART_MSR_DDSR) | 1317 | if (status & UART_MSR_DDSR) |
| @@ -1333,8 +1334,9 @@ static inline void | |||
| 1333 | serial8250_handle_port(struct uart_8250_port *up) | 1334 | serial8250_handle_port(struct uart_8250_port *up) |
| 1334 | { | 1335 | { |
| 1335 | unsigned int status; | 1336 | unsigned int status; |
| 1337 | unsigned long flags; | ||
| 1336 | 1338 | ||
| 1337 | spin_lock(&up->port.lock); | 1339 | spin_lock_irqsave(&up->port.lock, flags); |
| 1338 | 1340 | ||
| 1339 | status = serial_inp(up, UART_LSR); | 1341 | status = serial_inp(up, UART_LSR); |
| 1340 | 1342 | ||
| @@ -1346,7 +1348,7 @@ serial8250_handle_port(struct uart_8250_port *up) | |||
| 1346 | if (status & UART_LSR_THRE) | 1348 | if (status & UART_LSR_THRE) |
| 1347 | transmit_chars(up); | 1349 | transmit_chars(up); |
| 1348 | 1350 | ||
| 1349 | spin_unlock(&up->port.lock); | 1351 | spin_unlock_irqrestore(&up->port.lock, flags); |
| 1350 | } | 1352 | } |
| 1351 | 1353 | ||
| 1352 | /* | 1354 | /* |
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index cde5db44abf6..301c8c0be9d7 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
| @@ -340,6 +340,9 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
| 340 | { "FUJ02B8", 0 }, | 340 | { "FUJ02B8", 0 }, |
| 341 | { "FUJ02B9", 0 }, | 341 | { "FUJ02B9", 0 }, |
| 342 | { "FUJ02BC", 0 }, | 342 | { "FUJ02BC", 0 }, |
| 343 | /* Fujitsu Wacom Tablet PC devices */ | ||
| 344 | { "FUJ02E5", 0 }, | ||
| 345 | { "FUJ02E6", 0 }, | ||
| 343 | /* Rockwell's (PORALiNK) 33600 INT PNP */ | 346 | /* Rockwell's (PORALiNK) 33600 INT PNP */ |
| 344 | { "WCI0003", 0 }, | 347 | { "WCI0003", 0 }, |
| 345 | /* Unkown PnP modems */ | 348 | /* Unkown PnP modems */ |
diff --git a/drivers/serial/icom.c b/drivers/serial/icom.c index 41431d0d5512..246c5572667b 100644 --- a/drivers/serial/icom.c +++ b/drivers/serial/icom.c | |||
| @@ -164,7 +164,7 @@ static void free_port_memory(struct icom_port *icom_port) | |||
| 164 | } | 164 | } |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | static int __init get_port_memory(struct icom_port *icom_port) | 167 | static int __devinit get_port_memory(struct icom_port *icom_port) |
| 168 | { | 168 | { |
| 169 | int index; | 169 | int index; |
| 170 | unsigned long stgAddr; | 170 | unsigned long stgAddr; |
| @@ -1380,7 +1380,7 @@ static void icom_port_active(struct icom_port *icom_port, struct icom_adapter *i | |||
| 1380 | 0x8024 + 2 - 2 * (icom_port->port - 2); | 1380 | 0x8024 + 2 - 2 * (icom_port->port - 2); |
| 1381 | } | 1381 | } |
| 1382 | } | 1382 | } |
| 1383 | static int __init icom_load_ports(struct icom_adapter *icom_adapter) | 1383 | static int __devinit icom_load_ports(struct icom_adapter *icom_adapter) |
| 1384 | { | 1384 | { |
| 1385 | struct icom_port *icom_port; | 1385 | struct icom_port *icom_port; |
| 1386 | int port_num; | 1386 | int port_num; |
| @@ -1473,7 +1473,7 @@ static void icom_remove_adapter(struct icom_adapter *icom_adapter) | |||
| 1473 | } | 1473 | } |
| 1474 | } | 1474 | } |
| 1475 | 1475 | ||
| 1476 | free_irq(icom_adapter->irq_number, (void *) icom_adapter); | 1476 | free_irq(icom_adapter->pci_dev->irq, (void *) icom_adapter); |
| 1477 | iounmap(icom_adapter->base_addr); | 1477 | iounmap(icom_adapter->base_addr); |
| 1478 | icom_free_adapter(icom_adapter); | 1478 | icom_free_adapter(icom_adapter); |
| 1479 | pci_release_regions(icom_adapter->pci_dev); | 1479 | pci_release_regions(icom_adapter->pci_dev); |
| @@ -1539,7 +1539,6 @@ static int __devinit icom_probe(struct pci_dev *dev, | |||
| 1539 | } | 1539 | } |
| 1540 | 1540 | ||
| 1541 | icom_adapter->base_addr_pci = pci_resource_start(dev, 0); | 1541 | icom_adapter->base_addr_pci = pci_resource_start(dev, 0); |
| 1542 | icom_adapter->irq_number = dev->irq; | ||
| 1543 | icom_adapter->pci_dev = dev; | 1542 | icom_adapter->pci_dev = dev; |
| 1544 | icom_adapter->version = ent->driver_data; | 1543 | icom_adapter->version = ent->driver_data; |
| 1545 | icom_adapter->subsystem_id = ent->subdevice; | 1544 | icom_adapter->subsystem_id = ent->subdevice; |
| @@ -1570,7 +1569,7 @@ static int __devinit icom_probe(struct pci_dev *dev, | |||
| 1570 | icom_port = &icom_adapter->port_info[index]; | 1569 | icom_port = &icom_adapter->port_info[index]; |
| 1571 | 1570 | ||
| 1572 | if (icom_port->status == ICOM_PORT_ACTIVE) { | 1571 | if (icom_port->status == ICOM_PORT_ACTIVE) { |
| 1573 | icom_port->uart_port.irq = icom_port->adapter->irq_number; | 1572 | icom_port->uart_port.irq = icom_port->adapter->pci_dev->irq; |
| 1574 | icom_port->uart_port.type = PORT_ICOM; | 1573 | icom_port->uart_port.type = PORT_ICOM; |
| 1575 | icom_port->uart_port.iotype = UPIO_MEM; | 1574 | icom_port->uart_port.iotype = UPIO_MEM; |
| 1576 | icom_port->uart_port.membase = | 1575 | icom_port->uart_port.membase = |
diff --git a/drivers/serial/icom.h b/drivers/serial/icom.h index 798f1ef23712..e8578d8cd35e 100644 --- a/drivers/serial/icom.h +++ b/drivers/serial/icom.h | |||
| @@ -258,7 +258,6 @@ struct icom_port { | |||
| 258 | struct icom_adapter { | 258 | struct icom_adapter { |
| 259 | void __iomem * base_addr; | 259 | void __iomem * base_addr; |
| 260 | unsigned long base_addr_pci; | 260 | unsigned long base_addr_pci; |
| 261 | unsigned char irq_number; | ||
| 262 | struct pci_dev *pci_dev; | 261 | struct pci_dev *pci_dev; |
| 263 | struct icom_port port_info[4]; | 262 | struct icom_port port_info[4]; |
| 264 | int index; | 263 | int index; |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index c53b69610a51..46c40bbc4bc6 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
| @@ -17,6 +17,9 @@ | |||
| 17 | * License. See the file "COPYING" in the main directory of this archive | 17 | * License. See the file "COPYING" in the main directory of this archive |
| 18 | * for more details. | 18 | * for more details. |
| 19 | */ | 19 | */ |
| 20 | #if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
| 21 | #define SUPPORT_SYSRQ | ||
| 22 | #endif | ||
| 20 | 23 | ||
| 21 | #undef DEBUG | 24 | #undef DEBUG |
| 22 | 25 | ||
| @@ -49,11 +52,6 @@ | |||
| 49 | #endif | 52 | #endif |
| 50 | 53 | ||
| 51 | #include <asm/sci.h> | 54 | #include <asm/sci.h> |
| 52 | |||
| 53 | #if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
| 54 | #define SUPPORT_SYSRQ | ||
| 55 | #endif | ||
| 56 | |||
| 57 | #include "sh-sci.h" | 55 | #include "sh-sci.h" |
| 58 | 56 | ||
| 59 | struct sci_port { | 57 | struct sci_port { |
| @@ -645,6 +643,9 @@ static inline int sci_handle_breaks(struct uart_port *port) | |||
| 645 | struct tty_struct *tty = port->info->tty; | 643 | struct tty_struct *tty = port->info->tty; |
| 646 | struct sci_port *s = &sci_ports[port->line]; | 644 | struct sci_port *s = &sci_ports[port->line]; |
| 647 | 645 | ||
| 646 | if (uart_handle_break(port)) | ||
| 647 | return 0; | ||
| 648 | |||
| 648 | if (!s->break_flag && status & SCxSR_BRK(port)) { | 649 | if (!s->break_flag && status & SCxSR_BRK(port)) { |
| 649 | #if defined(CONFIG_CPU_SH3) | 650 | #if defined(CONFIG_CPU_SH3) |
| 650 | /* Debounce break */ | 651 | /* Debounce break */ |
diff --git a/drivers/spi/at25.c b/drivers/spi/at25.c index 48e4f48e779f..8efa07e8b8c2 100644 --- a/drivers/spi/at25.c +++ b/drivers/spi/at25.c | |||
| @@ -291,7 +291,7 @@ static int at25_probe(struct spi_device *spi) | |||
| 291 | */ | 291 | */ |
| 292 | sr = spi_w8r8(spi, AT25_RDSR); | 292 | sr = spi_w8r8(spi, AT25_RDSR); |
| 293 | if (sr < 0 || sr & AT25_SR_nRDY) { | 293 | if (sr < 0 || sr & AT25_SR_nRDY) { |
| 294 | dev_dbg(&at25->spi->dev, "rdsr --> %d (%02x)\n", sr, sr); | 294 | dev_dbg(&spi->dev, "rdsr --> %d (%02x)\n", sr, sr); |
| 295 | err = -ENXIO; | 295 | err = -ENXIO; |
| 296 | goto fail; | 296 | goto fail; |
| 297 | } | 297 | } |
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 6fa260d1a9be..66e7bc985797 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
| @@ -425,7 +425,7 @@ static int atmel_spi_setup(struct spi_device *spi) | |||
| 425 | if (ret) | 425 | if (ret) |
| 426 | return ret; | 426 | return ret; |
| 427 | spi->controller_state = (void *)npcs_pin; | 427 | spi->controller_state = (void *)npcs_pin; |
| 428 | gpio_direction_output(npcs_pin); | 428 | gpio_direction_output(npcs_pin, !(spi->mode & SPI_CS_HIGH)); |
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | dev_dbg(&spi->dev, | 431 | dev_dbg(&spi->dev, |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 2328128728be..6657331eed93 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
| @@ -189,8 +189,8 @@ static DECLARE_MUTEX(board_lock); | |||
| 189 | * this is exported so that for example a USB or parport based adapter | 189 | * this is exported so that for example a USB or parport based adapter |
| 190 | * driver could add devices (which it would learn about out-of-band). | 190 | * driver could add devices (which it would learn about out-of-band). |
| 191 | */ | 191 | */ |
| 192 | struct spi_device *__init_or_module | 192 | struct spi_device *spi_new_device(struct spi_master *master, |
| 193 | spi_new_device(struct spi_master *master, struct spi_board_info *chip) | 193 | struct spi_board_info *chip) |
| 194 | { | 194 | { |
| 195 | struct spi_device *proxy; | 195 | struct spi_device *proxy; |
| 196 | struct device *dev = master->cdev.dev; | 196 | struct device *dev = master->cdev.dev; |
| @@ -352,8 +352,7 @@ static struct class spi_master_class = { | |||
| 352 | * the master's methods before calling spi_register_master(); and (after errors | 352 | * the master's methods before calling spi_register_master(); and (after errors |
| 353 | * adding the device) calling spi_master_put() to prevent a memory leak. | 353 | * adding the device) calling spi_master_put() to prevent a memory leak. |
| 354 | */ | 354 | */ |
| 355 | struct spi_master * __init_or_module | 355 | struct spi_master *spi_alloc_master(struct device *dev, unsigned size) |
| 356 | spi_alloc_master(struct device *dev, unsigned size) | ||
| 357 | { | 356 | { |
| 358 | struct spi_master *master; | 357 | struct spi_master *master; |
| 359 | 358 | ||
| @@ -392,8 +391,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master); | |||
| 392 | * After a successful return, the caller is responsible for calling | 391 | * After a successful return, the caller is responsible for calling |
| 393 | * spi_unregister_master(). | 392 | * spi_unregister_master(). |
| 394 | */ | 393 | */ |
| 395 | int __init_or_module | 394 | int spi_register_master(struct spi_master *master) |
| 396 | spi_register_master(struct spi_master *master) | ||
| 397 | { | 395 | { |
| 398 | static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); | 396 | static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); |
| 399 | struct device *dev = master->cdev.dev; | 397 | struct device *dev = master->cdev.dev; |
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 24a330d82395..88425e1af4d3 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
| @@ -302,10 +302,6 @@ static void bitbang_work(struct work_struct *work) | |||
| 302 | setup_transfer = NULL; | 302 | setup_transfer = NULL; |
| 303 | 303 | ||
| 304 | list_for_each_entry (t, &m->transfers, transfer_list) { | 304 | list_for_each_entry (t, &m->transfers, transfer_list) { |
| 305 | if (bitbang->shutdown) { | ||
| 306 | status = -ESHUTDOWN; | ||
| 307 | break; | ||
| 308 | } | ||
| 309 | 305 | ||
| 310 | /* override or restore speed and wordsize */ | 306 | /* override or restore speed and wordsize */ |
| 311 | if (t->speed_hz || t->bits_per_word) { | 307 | if (t->speed_hz || t->bits_per_word) { |
| @@ -410,8 +406,6 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m) | |||
| 410 | m->status = -EINPROGRESS; | 406 | m->status = -EINPROGRESS; |
| 411 | 407 | ||
| 412 | bitbang = spi_master_get_devdata(spi->master); | 408 | bitbang = spi_master_get_devdata(spi->master); |
| 413 | if (bitbang->shutdown) | ||
| 414 | return -ESHUTDOWN; | ||
| 415 | 409 | ||
| 416 | spin_lock_irqsave(&bitbang->lock, flags); | 410 | spin_lock_irqsave(&bitbang->lock, flags); |
| 417 | if (!spi->max_speed_hz) | 411 | if (!spi->max_speed_hz) |
| @@ -507,28 +501,12 @@ EXPORT_SYMBOL_GPL(spi_bitbang_start); | |||
| 507 | */ | 501 | */ |
| 508 | int spi_bitbang_stop(struct spi_bitbang *bitbang) | 502 | int spi_bitbang_stop(struct spi_bitbang *bitbang) |
| 509 | { | 503 | { |
| 510 | unsigned limit = 500; | 504 | spi_unregister_master(bitbang->master); |
| 511 | |||
| 512 | spin_lock_irq(&bitbang->lock); | ||
| 513 | bitbang->shutdown = 0; | ||
| 514 | while (!list_empty(&bitbang->queue) && limit--) { | ||
| 515 | spin_unlock_irq(&bitbang->lock); | ||
| 516 | 505 | ||
| 517 | dev_dbg(bitbang->master->cdev.dev, "wait for queue\n"); | 506 | WARN_ON(!list_empty(&bitbang->queue)); |
| 518 | msleep(10); | ||
| 519 | |||
| 520 | spin_lock_irq(&bitbang->lock); | ||
| 521 | } | ||
| 522 | spin_unlock_irq(&bitbang->lock); | ||
| 523 | if (!list_empty(&bitbang->queue)) { | ||
| 524 | dev_err(bitbang->master->cdev.dev, "queue didn't empty\n"); | ||
| 525 | return -EBUSY; | ||
| 526 | } | ||
| 527 | 507 | ||
| 528 | destroy_workqueue(bitbang->workqueue); | 508 | destroy_workqueue(bitbang->workqueue); |
| 529 | 509 | ||
| 530 | spi_unregister_master(bitbang->master); | ||
| 531 | |||
| 532 | return 0; | 510 | return 0; |
| 533 | } | 511 | } |
| 534 | EXPORT_SYMBOL_GPL(spi_bitbang_stop); | 512 | EXPORT_SYMBOL_GPL(spi_bitbang_stop); |
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c index 651379c51ae6..b10211c420ef 100644 --- a/drivers/spi/spi_s3c24xx.c +++ b/drivers/spi/spi_s3c24xx.c | |||
| @@ -41,7 +41,7 @@ struct s3c24xx_spi { | |||
| 41 | int len; | 41 | int len; |
| 42 | int count; | 42 | int count; |
| 43 | 43 | ||
| 44 | int (*set_cs)(struct s3c2410_spi_info *spi, | 44 | void (*set_cs)(struct s3c2410_spi_info *spi, |
| 45 | int cs, int pol); | 45 | int cs, int pol); |
| 46 | 46 | ||
| 47 | /* data buffers */ | 47 | /* data buffers */ |
| @@ -77,7 +77,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | |||
| 77 | 77 | ||
| 78 | switch (value) { | 78 | switch (value) { |
| 79 | case BITBANG_CS_INACTIVE: | 79 | case BITBANG_CS_INACTIVE: |
| 80 | hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol^1); | 80 | hw->set_cs(hw->pdata, spi->chip_select, cspol^1); |
| 81 | break; | 81 | break; |
| 82 | 82 | ||
| 83 | case BITBANG_CS_ACTIVE: | 83 | case BITBANG_CS_ACTIVE: |
| @@ -98,7 +98,7 @@ static void s3c24xx_spi_chipsel(struct spi_device *spi, int value) | |||
| 98 | /* write new configration */ | 98 | /* write new configration */ |
| 99 | 99 | ||
| 100 | writeb(spcon, hw->regs + S3C2410_SPCON); | 100 | writeb(spcon, hw->regs + S3C2410_SPCON); |
| 101 | hw->pdata->set_cs(hw->pdata, spi->chip_select, cspol); | 101 | hw->set_cs(hw->pdata, spi->chip_select, cspol); |
| 102 | 102 | ||
| 103 | break; | 103 | break; |
| 104 | } | 104 | } |
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c index 3d72aa5cfc71..3524e3fc08b9 100644 --- a/drivers/tc/zs.c +++ b/drivers/tc/zs.c | |||
| @@ -70,7 +70,6 @@ | |||
| 70 | #include <asm/dec/machtype.h> | 70 | #include <asm/dec/machtype.h> |
| 71 | #include <asm/dec/serial.h> | 71 | #include <asm/dec/serial.h> |
| 72 | #include <asm/dec/system.h> | 72 | #include <asm/dec/system.h> |
| 73 | #include <asm/dec/tc.h> | ||
| 74 | 73 | ||
| 75 | #ifdef CONFIG_KGDB | 74 | #ifdef CONFIG_KGDB |
| 76 | #include <asm/kgdb.h> | 75 | #include <asm/kgdb.h> |
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index 63e50a1f1396..6584cf00f7f3 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c | |||
| @@ -202,6 +202,7 @@ struct quirk_printer_struct { | |||
| 202 | 202 | ||
| 203 | #define USBLP_QUIRK_BIDIR 0x1 /* reports bidir but requires unidirectional mode (no INs/reads) */ | 203 | #define USBLP_QUIRK_BIDIR 0x1 /* reports bidir but requires unidirectional mode (no INs/reads) */ |
| 204 | #define USBLP_QUIRK_USB_INIT 0x2 /* needs vendor USB init string */ | 204 | #define USBLP_QUIRK_USB_INIT 0x2 /* needs vendor USB init string */ |
| 205 | #define USBLP_QUIRK_BAD_CLASS 0x4 /* descriptor uses vendor-specific Class or SubClass */ | ||
| 205 | 206 | ||
| 206 | static const struct quirk_printer_struct quirk_printers[] = { | 207 | static const struct quirk_printer_struct quirk_printers[] = { |
| 207 | { 0x03f0, 0x0004, USBLP_QUIRK_BIDIR }, /* HP DeskJet 895C */ | 208 | { 0x03f0, 0x0004, USBLP_QUIRK_BIDIR }, /* HP DeskJet 895C */ |
| @@ -218,6 +219,7 @@ static const struct quirk_printer_struct quirk_printers[] = { | |||
| 218 | { 0x0409, 0xf0be, USBLP_QUIRK_BIDIR }, /* NEC Picty920 (HP OEM) */ | 219 | { 0x0409, 0xf0be, USBLP_QUIRK_BIDIR }, /* NEC Picty920 (HP OEM) */ |
| 219 | { 0x0409, 0xf1be, USBLP_QUIRK_BIDIR }, /* NEC Picty800 (HP OEM) */ | 220 | { 0x0409, 0xf1be, USBLP_QUIRK_BIDIR }, /* NEC Picty800 (HP OEM) */ |
| 220 | { 0x0482, 0x0010, USBLP_QUIRK_BIDIR }, /* Kyocera Mita FS 820, by zut <kernel@zut.de> */ | 221 | { 0x0482, 0x0010, USBLP_QUIRK_BIDIR }, /* Kyocera Mita FS 820, by zut <kernel@zut.de> */ |
| 222 | { 0x04b8, 0x0202, USBLP_QUIRK_BAD_CLASS }, /* Seiko Epson Receipt Printer M129C */ | ||
| 221 | { 0, 0 } | 223 | { 0, 0 } |
| 222 | }; | 224 | }; |
| 223 | 225 | ||
| @@ -1048,7 +1050,8 @@ static int usblp_select_alts(struct usblp *usblp) | |||
| 1048 | ifd = &if_alt->altsetting[i]; | 1050 | ifd = &if_alt->altsetting[i]; |
| 1049 | 1051 | ||
| 1050 | if (ifd->desc.bInterfaceClass != 7 || ifd->desc.bInterfaceSubClass != 1) | 1052 | if (ifd->desc.bInterfaceClass != 7 || ifd->desc.bInterfaceSubClass != 1) |
| 1051 | continue; | 1053 | if (!(usblp->quirks & USBLP_QUIRK_BAD_CLASS)) |
| 1054 | continue; | ||
| 1052 | 1055 | ||
| 1053 | if (ifd->desc.bInterfaceProtocol < USBLP_FIRST_PROTOCOL || | 1056 | if (ifd->desc.bInterfaceProtocol < USBLP_FIRST_PROTOCOL || |
| 1054 | ifd->desc.bInterfaceProtocol > USBLP_LAST_PROTOCOL) | 1057 | ifd->desc.bInterfaceProtocol > USBLP_LAST_PROTOCOL) |
| @@ -1232,6 +1235,7 @@ static struct usb_device_id usblp_ids [] = { | |||
| 1232 | { USB_INTERFACE_INFO(7, 1, 1) }, | 1235 | { USB_INTERFACE_INFO(7, 1, 1) }, |
| 1233 | { USB_INTERFACE_INFO(7, 1, 2) }, | 1236 | { USB_INTERFACE_INFO(7, 1, 2) }, |
| 1234 | { USB_INTERFACE_INFO(7, 1, 3) }, | 1237 | { USB_INTERFACE_INFO(7, 1, 3) }, |
| 1238 | { USB_DEVICE(0x04b8, 0x0202) }, /* Seiko Epson Receipt Printer M129C */ | ||
| 1235 | { } /* Terminating entry */ | 1239 | { } /* Terminating entry */ |
| 1236 | }; | 1240 | }; |
| 1237 | 1241 | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 0e5c646cb4f6..f08ec85a6d64 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
| @@ -30,7 +30,8 @@ | |||
| 30 | static const struct usb_device_id usb_quirk_list[] = { | 30 | static const struct usb_device_id usb_quirk_list[] = { |
| 31 | /* HP 5300/5370C scanner */ | 31 | /* HP 5300/5370C scanner */ |
| 32 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, | 32 | { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, |
| 33 | 33 | /* Seiko Epson Corp - Perfection 1670 */ | |
| 34 | { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | ||
| 34 | /* Elsa MicroLink 56k (V.250) */ | 35 | /* Elsa MicroLink 56k (V.250) */ |
| 35 | { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, | 36 | { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND }, |
| 36 | 37 | ||
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 8f9a2b615422..b394e63894d2 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
| @@ -296,6 +296,15 @@ omap_free_request(struct usb_ep *ep, struct usb_request *_req) | |||
| 296 | 296 | ||
| 297 | /*-------------------------------------------------------------------------*/ | 297 | /*-------------------------------------------------------------------------*/ |
| 298 | 298 | ||
| 299 | /* | ||
| 300 | * dma-coherent memory allocation (for dma-capable endpoints) | ||
| 301 | * | ||
| 302 | * NOTE: the dma_*_coherent() API calls suck. Most implementations are | ||
| 303 | * (a) page-oriented, so small buffers lose big; and (b) asymmetric with | ||
| 304 | * respect to calls with irqs disabled: alloc is safe, free is not. | ||
| 305 | * We currently work around (b), but not (a). | ||
| 306 | */ | ||
| 307 | |||
| 299 | static void * | 308 | static void * |
| 300 | omap_alloc_buffer( | 309 | omap_alloc_buffer( |
| 301 | struct usb_ep *_ep, | 310 | struct usb_ep *_ep, |
| @@ -307,6 +316,9 @@ omap_alloc_buffer( | |||
| 307 | void *retval; | 316 | void *retval; |
| 308 | struct omap_ep *ep; | 317 | struct omap_ep *ep; |
| 309 | 318 | ||
| 319 | if (!_ep) | ||
| 320 | return NULL; | ||
| 321 | |||
| 310 | ep = container_of(_ep, struct omap_ep, ep); | 322 | ep = container_of(_ep, struct omap_ep, ep); |
| 311 | if (use_dma && ep->has_dma) { | 323 | if (use_dma && ep->has_dma) { |
| 312 | static int warned; | 324 | static int warned; |
| @@ -326,6 +338,35 @@ omap_alloc_buffer( | |||
| 326 | return retval; | 338 | return retval; |
| 327 | } | 339 | } |
| 328 | 340 | ||
| 341 | static DEFINE_SPINLOCK(buflock); | ||
| 342 | static LIST_HEAD(buffers); | ||
| 343 | |||
| 344 | struct free_record { | ||
| 345 | struct list_head list; | ||
| 346 | struct device *dev; | ||
| 347 | unsigned bytes; | ||
| 348 | dma_addr_t dma; | ||
| 349 | }; | ||
| 350 | |||
| 351 | static void do_free(unsigned long ignored) | ||
| 352 | { | ||
| 353 | spin_lock_irq(&buflock); | ||
| 354 | while (!list_empty(&buffers)) { | ||
| 355 | struct free_record *buf; | ||
| 356 | |||
| 357 | buf = list_entry(buffers.next, struct free_record, list); | ||
| 358 | list_del(&buf->list); | ||
| 359 | spin_unlock_irq(&buflock); | ||
| 360 | |||
| 361 | dma_free_coherent(buf->dev, buf->bytes, buf, buf->dma); | ||
| 362 | |||
| 363 | spin_lock_irq(&buflock); | ||
| 364 | } | ||
| 365 | spin_unlock_irq(&buflock); | ||
| 366 | } | ||
| 367 | |||
| 368 | static DECLARE_TASKLET(deferred_free, do_free, 0); | ||
| 369 | |||
| 329 | static void omap_free_buffer( | 370 | static void omap_free_buffer( |
| 330 | struct usb_ep *_ep, | 371 | struct usb_ep *_ep, |
| 331 | void *buf, | 372 | void *buf, |
| @@ -333,13 +374,29 @@ static void omap_free_buffer( | |||
| 333 | unsigned bytes | 374 | unsigned bytes |
| 334 | ) | 375 | ) |
| 335 | { | 376 | { |
| 336 | struct omap_ep *ep; | 377 | if (!_ep) { |
| 378 | WARN_ON(1); | ||
| 379 | return; | ||
| 380 | } | ||
| 337 | 381 | ||
| 338 | ep = container_of(_ep, struct omap_ep, ep); | 382 | /* free memory into the right allocator */ |
| 339 | if (use_dma && _ep && ep->has_dma) | 383 | if (dma != DMA_ADDR_INVALID) { |
| 340 | dma_free_coherent(ep->udc->gadget.dev.parent, bytes, buf, dma); | 384 | struct omap_ep *ep; |
| 341 | else | 385 | struct free_record *rec = buf; |
| 342 | kfree (buf); | 386 | unsigned long flags; |
| 387 | |||
| 388 | ep = container_of(_ep, struct omap_ep, ep); | ||
| 389 | |||
| 390 | rec->dev = ep->udc->gadget.dev.parent; | ||
| 391 | rec->bytes = bytes; | ||
| 392 | rec->dma = dma; | ||
| 393 | |||
| 394 | spin_lock_irqsave(&buflock, flags); | ||
| 395 | list_add_tail(&rec->list, &buffers); | ||
| 396 | tasklet_schedule(&deferred_free); | ||
| 397 | spin_unlock_irqrestore(&buflock, flags); | ||
| 398 | } else | ||
| 399 | kfree(buf); | ||
| 343 | } | 400 | } |
| 344 | 401 | ||
| 345 | /*-------------------------------------------------------------------------*/ | 402 | /*-------------------------------------------------------------------------*/ |
| @@ -1691,12 +1748,38 @@ ep0out_status_stage: | |||
| 1691 | udc->ep0_pending = 0; | 1748 | udc->ep0_pending = 0; |
| 1692 | break; | 1749 | break; |
| 1693 | case USB_REQ_GET_STATUS: | 1750 | case USB_REQ_GET_STATUS: |
| 1751 | /* USB_ENDPOINT_HALT status? */ | ||
| 1752 | if (u.r.bRequestType != (USB_DIR_IN|USB_RECIP_ENDPOINT)) | ||
| 1753 | goto intf_status; | ||
| 1754 | |||
| 1755 | /* ep0 never stalls */ | ||
| 1756 | if (!(w_index & 0xf)) | ||
| 1757 | goto zero_status; | ||
| 1758 | |||
| 1759 | /* only active endpoints count */ | ||
| 1760 | ep = &udc->ep[w_index & 0xf]; | ||
| 1761 | if (w_index & USB_DIR_IN) | ||
| 1762 | ep += 16; | ||
| 1763 | if (!ep->desc) | ||
| 1764 | goto do_stall; | ||
| 1765 | |||
| 1766 | /* iso never stalls */ | ||
| 1767 | if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) | ||
| 1768 | goto zero_status; | ||
| 1769 | |||
| 1770 | /* FIXME don't assume non-halted endpoints!! */ | ||
| 1771 | ERR("%s status, can't report\n", ep->ep.name); | ||
| 1772 | goto do_stall; | ||
| 1773 | |||
| 1774 | intf_status: | ||
| 1694 | /* return interface status. if we were pedantic, | 1775 | /* return interface status. if we were pedantic, |
| 1695 | * we'd detect non-existent interfaces, and stall. | 1776 | * we'd detect non-existent interfaces, and stall. |
| 1696 | */ | 1777 | */ |
| 1697 | if (u.r.bRequestType | 1778 | if (u.r.bRequestType |
| 1698 | != (USB_DIR_IN|USB_RECIP_INTERFACE)) | 1779 | != (USB_DIR_IN|USB_RECIP_INTERFACE)) |
| 1699 | goto delegate; | 1780 | goto delegate; |
| 1781 | |||
| 1782 | zero_status: | ||
| 1700 | /* return two zero bytes */ | 1783 | /* return two zero bytes */ |
| 1701 | UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; | 1784 | UDC_EP_NUM_REG = UDC_EP_SEL|UDC_EP_DIR; |
| 1702 | UDC_DATA_REG = 0; | 1785 | UDC_DATA_REG = 0; |
| @@ -2068,7 +2151,7 @@ static irqreturn_t omap_udc_iso_irq(int irq, void *_dev) | |||
| 2068 | 2151 | ||
| 2069 | /*-------------------------------------------------------------------------*/ | 2152 | /*-------------------------------------------------------------------------*/ |
| 2070 | 2153 | ||
| 2071 | static inline int machine_needs_vbus_session(void) | 2154 | static inline int machine_without_vbus_sense(void) |
| 2072 | { | 2155 | { |
| 2073 | return (machine_is_omap_innovator() | 2156 | return (machine_is_omap_innovator() |
| 2074 | || machine_is_omap_osk() | 2157 | || machine_is_omap_osk() |
| @@ -2156,7 +2239,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver) | |||
| 2156 | /* boards that don't have VBUS sensing can't autogate 48MHz; | 2239 | /* boards that don't have VBUS sensing can't autogate 48MHz; |
| 2157 | * can't enter deep sleep while a gadget driver is active. | 2240 | * can't enter deep sleep while a gadget driver is active. |
| 2158 | */ | 2241 | */ |
| 2159 | if (machine_needs_vbus_session()) | 2242 | if (machine_without_vbus_sense()) |
| 2160 | omap_vbus_session(&udc->gadget, 1); | 2243 | omap_vbus_session(&udc->gadget, 1); |
| 2161 | 2244 | ||
| 2162 | done: | 2245 | done: |
| @@ -2179,7 +2262,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) | |||
| 2179 | if (udc->dc_clk != NULL) | 2262 | if (udc->dc_clk != NULL) |
| 2180 | omap_udc_enable_clock(1); | 2263 | omap_udc_enable_clock(1); |
| 2181 | 2264 | ||
| 2182 | if (machine_needs_vbus_session()) | 2265 | if (machine_without_vbus_sense()) |
| 2183 | omap_vbus_session(&udc->gadget, 0); | 2266 | omap_vbus_session(&udc->gadget, 0); |
| 2184 | 2267 | ||
| 2185 | if (udc->transceiver) | 2268 | if (udc->transceiver) |
| @@ -2822,7 +2905,7 @@ static int __init omap_udc_probe(struct platform_device *pdev) | |||
| 2822 | hmc = HMC_1510; | 2905 | hmc = HMC_1510; |
| 2823 | type = "(unknown)"; | 2906 | type = "(unknown)"; |
| 2824 | 2907 | ||
| 2825 | if (machine_is_omap_innovator() || machine_is_sx1()) { | 2908 | if (machine_without_vbus_sense()) { |
| 2826 | /* just set up software VBUS detect, and then | 2909 | /* just set up software VBUS detect, and then |
| 2827 | * later rig it so we always report VBUS. | 2910 | * later rig it so we always report VBUS. |
| 2828 | * FIXME without really sensing VBUS, we can't | 2911 | * FIXME without really sensing VBUS, we can't |
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 571f3ebb70ab..f01890dc8751 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
| @@ -2616,7 +2616,7 @@ lubbock_fail0: | |||
| 2616 | if (retval != 0) { | 2616 | if (retval != 0) { |
| 2617 | printk(KERN_ERR "%s: can't get irq %i, err %d\n", | 2617 | printk(KERN_ERR "%s: can't get irq %i, err %d\n", |
| 2618 | driver_name, vbus_irq, retval); | 2618 | driver_name, vbus_irq, retval); |
| 2619 | free_irq(irq, dev); | 2619 | free_irq(IRQ_USB, dev); |
| 2620 | return -EBUSY; | 2620 | return -EBUSY; |
| 2621 | } | 2621 | } |
| 2622 | } | 2622 | } |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index a74056488234..c7458f7e56cc 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -669,6 +669,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
| 669 | */ | 669 | */ |
| 670 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); | 670 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); |
| 671 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 671 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
| 672 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); | ||
| 672 | } | 673 | } |
| 673 | } | 674 | } |
| 674 | 675 | ||
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c index 8d24d3dc0a61..1497371583b9 100644 --- a/drivers/usb/host/uhci-debug.c +++ b/drivers/usb/host/uhci-debug.c | |||
| @@ -145,7 +145,8 @@ static int uhci_show_urbp(struct urb_priv *urbp, char *buf, int len, int space) | |||
| 145 | return out - buf; | 145 | return out - buf; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) | 148 | static int uhci_show_qh(struct uhci_hcd *uhci, |
| 149 | struct uhci_qh *qh, char *buf, int len, int space) | ||
| 149 | { | 150 | { |
| 150 | char *out = buf; | 151 | char *out = buf; |
| 151 | int i, nurbs; | 152 | int i, nurbs; |
| @@ -190,6 +191,9 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) | |||
| 190 | 191 | ||
| 191 | if (list_empty(&qh->queue)) { | 192 | if (list_empty(&qh->queue)) { |
| 192 | out += sprintf(out, "%*s queue is empty\n", space, ""); | 193 | out += sprintf(out, "%*s queue is empty\n", space, ""); |
| 194 | if (qh == uhci->skel_async_qh) | ||
| 195 | out += uhci_show_td(uhci->term_td, out, | ||
| 196 | len - (out - buf), 0); | ||
| 193 | } else { | 197 | } else { |
| 194 | struct urb_priv *urbp = list_entry(qh->queue.next, | 198 | struct urb_priv *urbp = list_entry(qh->queue.next, |
| 195 | struct urb_priv, node); | 199 | struct urb_priv, node); |
| @@ -343,6 +347,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len) | |||
| 343 | struct list_head *tmp, *head; | 347 | struct list_head *tmp, *head; |
| 344 | int nframes, nerrs; | 348 | int nframes, nerrs; |
| 345 | __le32 link; | 349 | __le32 link; |
| 350 | __le32 fsbr_link; | ||
| 346 | 351 | ||
| 347 | static const char * const qh_names[] = { | 352 | static const char * const qh_names[] = { |
| 348 | "unlink", "iso", "int128", "int64", "int32", "int16", | 353 | "unlink", "iso", "int128", "int64", "int32", "int16", |
| @@ -424,21 +429,22 @@ check_link: | |||
| 424 | 429 | ||
| 425 | out += sprintf(out, "Skeleton QHs\n"); | 430 | out += sprintf(out, "Skeleton QHs\n"); |
| 426 | 431 | ||
| 432 | fsbr_link = 0; | ||
| 427 | for (i = 0; i < UHCI_NUM_SKELQH; ++i) { | 433 | for (i = 0; i < UHCI_NUM_SKELQH; ++i) { |
| 428 | int cnt = 0; | 434 | int cnt = 0; |
| 429 | __le32 fsbr_link = 0; | ||
| 430 | 435 | ||
| 431 | qh = uhci->skelqh[i]; | 436 | qh = uhci->skelqh[i]; |
| 432 | out += sprintf(out, "- skel_%s_qh\n", qh_names[i]); \ | 437 | out += sprintf(out, "- skel_%s_qh\n", qh_names[i]); \ |
| 433 | out += uhci_show_qh(qh, out, len - (out - buf), 4); | 438 | out += uhci_show_qh(uhci, qh, out, len - (out - buf), 4); |
| 434 | 439 | ||
| 435 | /* Last QH is the Terminating QH, it's different */ | 440 | /* Last QH is the Terminating QH, it's different */ |
| 436 | if (i == SKEL_TERM) { | 441 | if (i == SKEL_TERM) { |
| 437 | if (qh_element(qh) != LINK_TO_TD(uhci->term_td)) | 442 | if (qh_element(qh) != LINK_TO_TD(uhci->term_td)) |
| 438 | out += sprintf(out, " skel_term_qh element is not set to term_td!\n"); | 443 | out += sprintf(out, " skel_term_qh element is not set to term_td!\n"); |
| 439 | if (link == LINK_TO_QH(uhci->skel_term_qh)) | 444 | link = fsbr_link; |
| 440 | goto check_qh_link; | 445 | if (!link) |
| 441 | continue; | 446 | link = LINK_TO_QH(uhci->skel_term_qh); |
| 447 | goto check_qh_link; | ||
| 442 | } | 448 | } |
| 443 | 449 | ||
| 444 | head = &qh->node; | 450 | head = &qh->node; |
| @@ -448,7 +454,7 @@ check_link: | |||
| 448 | qh = list_entry(tmp, struct uhci_qh, node); | 454 | qh = list_entry(tmp, struct uhci_qh, node); |
| 449 | tmp = tmp->next; | 455 | tmp = tmp->next; |
| 450 | if (++cnt <= 10) | 456 | if (++cnt <= 10) |
| 451 | out += uhci_show_qh(qh, out, | 457 | out += uhci_show_qh(uhci, qh, out, |
| 452 | len - (out - buf), 4); | 458 | len - (out - buf), 4); |
| 453 | if (!fsbr_link && qh->skel >= SKEL_FSBR) | 459 | if (!fsbr_link && qh->skel >= SKEL_FSBR) |
| 454 | fsbr_link = LINK_TO_QH(qh); | 460 | fsbr_link = LINK_TO_QH(qh); |
| @@ -463,8 +469,6 @@ check_link: | |||
| 463 | link = LINK_TO_QH(uhci->skel_async_qh); | 469 | link = LINK_TO_QH(uhci->skel_async_qh); |
| 464 | else if (!uhci->fsbr_is_on) | 470 | else if (!uhci->fsbr_is_on) |
| 465 | ; | 471 | ; |
| 466 | else if (fsbr_link) | ||
| 467 | link = fsbr_link; | ||
| 468 | else | 472 | else |
| 469 | link = LINK_TO_QH(uhci->skel_term_qh); | 473 | link = LINK_TO_QH(uhci->skel_term_qh); |
| 470 | check_qh_link: | 474 | check_qh_link: |
| @@ -573,8 +577,8 @@ static const struct file_operations uhci_debug_operations = { | |||
| 573 | static inline void lprintk(char *buf) | 577 | static inline void lprintk(char *buf) |
| 574 | {} | 578 | {} |
| 575 | 579 | ||
| 576 | static inline int uhci_show_qh(struct uhci_qh *qh, char *buf, | 580 | static inline int uhci_show_qh(struct uhci_hcd *uhci, |
| 577 | int len, int space) | 581 | struct uhci_qh *qh, char *buf, int len, int space) |
| 578 | { | 582 | { |
| 579 | return 0; | 583 | return 0; |
| 580 | } | 584 | } |
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index 44da4334f1d6..d22da26ff167 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c | |||
| @@ -632,7 +632,8 @@ static int uhci_start(struct usb_hcd *hcd) | |||
| 632 | */ | 632 | */ |
| 633 | for (i = SKEL_ISO + 1; i < SKEL_ASYNC; ++i) | 633 | for (i = SKEL_ISO + 1; i < SKEL_ASYNC; ++i) |
| 634 | uhci->skelqh[i]->link = LINK_TO_QH(uhci->skel_async_qh); | 634 | uhci->skelqh[i]->link = LINK_TO_QH(uhci->skel_async_qh); |
| 635 | uhci->skel_async_qh->link = uhci->skel_term_qh->link = UHCI_PTR_TERM; | 635 | uhci->skel_async_qh->link = UHCI_PTR_TERM; |
| 636 | uhci->skel_term_qh->link = LINK_TO_QH(uhci->skel_term_qh); | ||
| 636 | 637 | ||
| 637 | /* This dummy TD is to work around a bug in Intel PIIX controllers */ | 638 | /* This dummy TD is to work around a bug in Intel PIIX controllers */ |
| 638 | uhci_fill_td(uhci->term_td, 0, uhci_explen(0) | | 639 | uhci_fill_td(uhci->term_td, 0, uhci_explen(0) | |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index f4ebdb3e488f..19a0cc02b9a2 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
| @@ -45,43 +45,27 @@ static inline void uhci_clear_next_interrupt(struct uhci_hcd *uhci) | |||
| 45 | */ | 45 | */ |
| 46 | static void uhci_fsbr_on(struct uhci_hcd *uhci) | 46 | static void uhci_fsbr_on(struct uhci_hcd *uhci) |
| 47 | { | 47 | { |
| 48 | struct uhci_qh *fsbr_qh, *lqh, *tqh; | 48 | struct uhci_qh *lqh; |
| 49 | 49 | ||
| 50 | /* The terminating skeleton QH always points back to the first | ||
| 51 | * FSBR QH. Make the last async QH point to the terminating | ||
| 52 | * skeleton QH. */ | ||
| 50 | uhci->fsbr_is_on = 1; | 53 | uhci->fsbr_is_on = 1; |
| 51 | lqh = list_entry(uhci->skel_async_qh->node.prev, | 54 | lqh = list_entry(uhci->skel_async_qh->node.prev, |
| 52 | struct uhci_qh, node); | 55 | struct uhci_qh, node); |
| 53 | 56 | lqh->link = LINK_TO_QH(uhci->skel_term_qh); | |
| 54 | /* Find the first FSBR QH. Linear search through the list is | ||
| 55 | * acceptable because normally FSBR gets turned on as soon as | ||
| 56 | * one QH needs it. */ | ||
| 57 | fsbr_qh = NULL; | ||
| 58 | list_for_each_entry_reverse(tqh, &uhci->skel_async_qh->node, node) { | ||
| 59 | if (tqh->skel < SKEL_FSBR) | ||
| 60 | break; | ||
| 61 | fsbr_qh = tqh; | ||
| 62 | } | ||
| 63 | |||
| 64 | /* No FSBR QH means we must insert the terminating skeleton QH */ | ||
| 65 | if (!fsbr_qh) { | ||
| 66 | uhci->skel_term_qh->link = LINK_TO_QH(uhci->skel_term_qh); | ||
| 67 | wmb(); | ||
| 68 | lqh->link = uhci->skel_term_qh->link; | ||
| 69 | |||
| 70 | /* Otherwise loop the last QH to the first FSBR QH */ | ||
| 71 | } else | ||
| 72 | lqh->link = LINK_TO_QH(fsbr_qh); | ||
| 73 | } | 57 | } |
| 74 | 58 | ||
| 75 | static void uhci_fsbr_off(struct uhci_hcd *uhci) | 59 | static void uhci_fsbr_off(struct uhci_hcd *uhci) |
| 76 | { | 60 | { |
| 77 | struct uhci_qh *lqh; | 61 | struct uhci_qh *lqh; |
| 78 | 62 | ||
| 63 | /* Remove the link from the last async QH to the terminating | ||
| 64 | * skeleton QH. */ | ||
| 79 | uhci->fsbr_is_on = 0; | 65 | uhci->fsbr_is_on = 0; |
| 80 | lqh = list_entry(uhci->skel_async_qh->node.prev, | 66 | lqh = list_entry(uhci->skel_async_qh->node.prev, |
| 81 | struct uhci_qh, node); | 67 | struct uhci_qh, node); |
| 82 | 68 | lqh->link = UHCI_PTR_TERM; | |
| 83 | /* End the async list normally and unlink the terminating QH */ | ||
| 84 | lqh->link = uhci->skel_term_qh->link = UHCI_PTR_TERM; | ||
| 85 | } | 69 | } |
| 86 | 70 | ||
| 87 | static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb) | 71 | static void uhci_add_fsbr(struct uhci_hcd *uhci, struct urb *urb) |
| @@ -464,9 +448,8 @@ static void link_interrupt(struct uhci_hcd *uhci, struct uhci_qh *qh) | |||
| 464 | */ | 448 | */ |
| 465 | static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh) | 449 | static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh) |
| 466 | { | 450 | { |
| 467 | struct uhci_qh *pqh, *lqh; | 451 | struct uhci_qh *pqh; |
| 468 | __le32 link_to_new_qh; | 452 | __le32 link_to_new_qh; |
| 469 | __le32 *extra_link = &link_to_new_qh; | ||
| 470 | 453 | ||
| 471 | /* Find the predecessor QH for our new one and insert it in the list. | 454 | /* Find the predecessor QH for our new one and insert it in the list. |
| 472 | * The list of QHs is expected to be short, so linear search won't | 455 | * The list of QHs is expected to be short, so linear search won't |
| @@ -476,31 +459,17 @@ static void link_async(struct uhci_hcd *uhci, struct uhci_qh *qh) | |||
| 476 | break; | 459 | break; |
| 477 | } | 460 | } |
| 478 | list_add(&qh->node, &pqh->node); | 461 | list_add(&qh->node, &pqh->node); |
| 479 | qh->link = pqh->link; | ||
| 480 | |||
| 481 | link_to_new_qh = LINK_TO_QH(qh); | ||
| 482 | |||
| 483 | /* If this is now the first FSBR QH, take special action */ | ||
| 484 | if (uhci->fsbr_is_on && pqh->skel < SKEL_FSBR && | ||
| 485 | qh->skel >= SKEL_FSBR) { | ||
| 486 | lqh = list_entry(uhci->skel_async_qh->node.prev, | ||
| 487 | struct uhci_qh, node); | ||
| 488 | |||
| 489 | /* If the new QH is also the last one, we must unlink | ||
| 490 | * the terminating skeleton QH and make the new QH point | ||
| 491 | * back to itself. */ | ||
| 492 | if (qh == lqh) { | ||
| 493 | qh->link = link_to_new_qh; | ||
| 494 | extra_link = &uhci->skel_term_qh->link; | ||
| 495 | |||
| 496 | /* Otherwise the last QH must point to the new QH */ | ||
| 497 | } else | ||
| 498 | extra_link = &lqh->link; | ||
| 499 | } | ||
| 500 | 462 | ||
| 501 | /* Link it into the schedule */ | 463 | /* Link it into the schedule */ |
| 464 | qh->link = pqh->link; | ||
| 502 | wmb(); | 465 | wmb(); |
| 503 | *extra_link = pqh->link = link_to_new_qh; | 466 | link_to_new_qh = LINK_TO_QH(qh); |
| 467 | pqh->link = link_to_new_qh; | ||
| 468 | |||
| 469 | /* If this is now the first FSBR QH, link the terminating skeleton | ||
| 470 | * QH to it. */ | ||
| 471 | if (pqh->skel < SKEL_FSBR && qh->skel >= SKEL_FSBR) | ||
| 472 | uhci->skel_term_qh->link = link_to_new_qh; | ||
| 504 | } | 473 | } |
| 505 | 474 | ||
| 506 | /* | 475 | /* |
| @@ -561,31 +530,16 @@ static void unlink_interrupt(struct uhci_hcd *uhci, struct uhci_qh *qh) | |||
| 561 | */ | 530 | */ |
| 562 | static void unlink_async(struct uhci_hcd *uhci, struct uhci_qh *qh) | 531 | static void unlink_async(struct uhci_hcd *uhci, struct uhci_qh *qh) |
| 563 | { | 532 | { |
| 564 | struct uhci_qh *pqh, *lqh; | 533 | struct uhci_qh *pqh; |
| 565 | __le32 link_to_next_qh = qh->link; | 534 | __le32 link_to_next_qh = qh->link; |
| 566 | 535 | ||
| 567 | pqh = list_entry(qh->node.prev, struct uhci_qh, node); | 536 | pqh = list_entry(qh->node.prev, struct uhci_qh, node); |
| 568 | |||
| 569 | /* If this is the first FSBQ QH, take special action */ | ||
| 570 | if (uhci->fsbr_is_on && pqh->skel < SKEL_FSBR && | ||
| 571 | qh->skel >= SKEL_FSBR) { | ||
| 572 | lqh = list_entry(uhci->skel_async_qh->node.prev, | ||
| 573 | struct uhci_qh, node); | ||
| 574 | |||
| 575 | /* If this QH is also the last one, we must link in | ||
| 576 | * the terminating skeleton QH. */ | ||
| 577 | if (qh == lqh) { | ||
| 578 | link_to_next_qh = LINK_TO_QH(uhci->skel_term_qh); | ||
| 579 | uhci->skel_term_qh->link = link_to_next_qh; | ||
| 580 | wmb(); | ||
| 581 | qh->link = link_to_next_qh; | ||
| 582 | |||
| 583 | /* Otherwise the last QH must point to the new first FSBR QH */ | ||
| 584 | } else | ||
| 585 | lqh->link = link_to_next_qh; | ||
| 586 | } | ||
| 587 | |||
| 588 | pqh->link = link_to_next_qh; | 537 | pqh->link = link_to_next_qh; |
| 538 | |||
| 539 | /* If this was the old first FSBR QH, link the terminating skeleton | ||
| 540 | * QH to the next (new first FSBR) QH. */ | ||
| 541 | if (pqh->skel < SKEL_FSBR && qh->skel >= SKEL_FSBR) | ||
| 542 | uhci->skel_term_qh->link = link_to_next_qh; | ||
| 589 | mb(); | 543 | mb(); |
| 590 | } | 544 | } |
| 591 | 545 | ||
| @@ -1217,7 +1171,7 @@ static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb) | |||
| 1217 | 1171 | ||
| 1218 | if (debug > 1 && errbuf) { | 1172 | if (debug > 1 && errbuf) { |
| 1219 | /* Print the chain for debugging */ | 1173 | /* Print the chain for debugging */ |
| 1220 | uhci_show_qh(urbp->qh, errbuf, | 1174 | uhci_show_qh(uhci, urbp->qh, errbuf, |
| 1221 | ERRBUF_LEN, 0); | 1175 | ERRBUF_LEN, 0); |
| 1222 | lprintk(errbuf); | 1176 | lprintk(errbuf); |
| 1223 | } | 1177 | } |
diff --git a/drivers/usb/misc/berry_charge.c b/drivers/usb/misc/berry_charge.c index 60893c6c8221..b15f2fd8dab4 100644 --- a/drivers/usb/misc/berry_charge.c +++ b/drivers/usb/misc/berry_charge.c | |||
| @@ -69,7 +69,7 @@ static int magic_charge(struct usb_device *udev) | |||
| 69 | return retval; | 69 | return retval; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | dbg(&udev->dev, "Sending first magic command\n"); | 72 | dbg(&udev->dev, "Sending second magic command\n"); |
| 73 | retval = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 73 | retval = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
| 74 | 0xa2, 0x40, 0, 1, dummy_buffer, 0, 100); | 74 | 0xa2, 0x40, 0, 1, dummy_buffer, 0, 100); |
| 75 | if (retval != 0) { | 75 | if (retval != 0) { |
diff --git a/drivers/usb/net/dm9601.c b/drivers/usb/net/dm9601.c index c0bc52be5e10..5130cc7eb314 100644 --- a/drivers/usb/net/dm9601.c +++ b/drivers/usb/net/dm9601.c | |||
| @@ -578,6 +578,14 @@ static const struct usb_device_id products[] = { | |||
| 578 | USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */ | 578 | USB_DEVICE(0x0a46, 0x9601), /* Davicom USB-100 */ |
| 579 | .driver_info = (unsigned long)&dm9601_info, | 579 | .driver_info = (unsigned long)&dm9601_info, |
| 580 | }, | 580 | }, |
| 581 | { | ||
| 582 | USB_DEVICE(0x0a46, 0x6688), /* ZT6688 USB NIC */ | ||
| 583 | .driver_info = (unsigned long)&dm9601_info, | ||
| 584 | }, | ||
| 585 | { | ||
| 586 | USB_DEVICE(0x0a46, 0x0268), /* ShanTou ST268 USB NIC */ | ||
| 587 | .driver_info = (unsigned long)&dm9601_info, | ||
| 588 | }, | ||
| 581 | {}, // END | 589 | {}, // END |
| 582 | }; | 590 | }; |
| 583 | 591 | ||
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index d48c024cff59..6d12961cf9f9 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
| @@ -316,6 +316,7 @@ static int update_eth_regs_async(pegasus_t * pegasus) | |||
| 316 | return ret; | 316 | return ret; |
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | /* Returns 0 on success, error on failure */ | ||
| 319 | static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) | 320 | static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd) |
| 320 | { | 321 | { |
| 321 | int i; | 322 | int i; |
| @@ -847,10 +848,16 @@ static void intr_callback(struct urb *urb) | |||
| 847 | * d[0].NO_CARRIER kicks in only with failed TX. | 848 | * d[0].NO_CARRIER kicks in only with failed TX. |
| 848 | * ... so monitoring with MII may be safest. | 849 | * ... so monitoring with MII may be safest. |
| 849 | */ | 850 | */ |
| 850 | if (d[0] & NO_CARRIER) | 851 | if (pegasus->features & TRUST_LINK_STATUS) { |
| 851 | netif_carrier_off(net); | 852 | if (d[5] & LINK_STATUS) |
| 852 | else | 853 | netif_carrier_on(net); |
| 853 | netif_carrier_on(net); | 854 | else |
| 855 | netif_carrier_off(net); | ||
| 856 | } else { | ||
| 857 | /* Never set carrier _on_ based on ! NO_CARRIER */ | ||
| 858 | if (d[0] & NO_CARRIER) | ||
| 859 | netif_carrier_off(net); | ||
| 860 | } | ||
| 854 | 861 | ||
| 855 | /* bytes 3-4 == rx_lostpkt, reg 2E/2F */ | 862 | /* bytes 3-4 == rx_lostpkt, reg 2E/2F */ |
| 856 | pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; | 863 | pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4]; |
| @@ -950,7 +957,7 @@ static void set_carrier(struct net_device *net) | |||
| 950 | pegasus_t *pegasus = netdev_priv(net); | 957 | pegasus_t *pegasus = netdev_priv(net); |
| 951 | u16 tmp; | 958 | u16 tmp; |
| 952 | 959 | ||
| 953 | if (!read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp)) | 960 | if (read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp)) |
| 954 | return; | 961 | return; |
| 955 | 962 | ||
| 956 | if (tmp & BMSR_LSTATUS) | 963 | if (tmp & BMSR_LSTATUS) |
diff --git a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h index c7467823cd1c..c7aadb413e8c 100644 --- a/drivers/usb/net/pegasus.h +++ b/drivers/usb/net/pegasus.h | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | #define PEGASUS_II 0x80000000 | 12 | #define PEGASUS_II 0x80000000 |
| 13 | #define HAS_HOME_PNA 0x40000000 | 13 | #define HAS_HOME_PNA 0x40000000 |
| 14 | #define TRUST_LINK_STATUS 0x20000000 | ||
| 14 | 15 | ||
| 15 | #define PEGASUS_MTU 1536 | 16 | #define PEGASUS_MTU 1536 |
| 16 | #define RX_SKBS 4 | 17 | #define RX_SKBS 4 |
| @@ -203,7 +204,7 @@ PEGASUS_DEV( "AEI USB Fast Ethernet Adapter", VENDOR_AEILAB, 0x1701, | |||
| 203 | PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100, | 204 | PEGASUS_DEV( "Allied Telesyn Int. AT-USB100", VENDOR_ALLIEDTEL, 0xb100, |
| 204 | DEFAULT_GPIO_RESET | PEGASUS_II ) | 205 | DEFAULT_GPIO_RESET | PEGASUS_II ) |
| 205 | PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, | 206 | PEGASUS_DEV( "Belkin F5D5050 USB Ethernet", VENDOR_BELKIN, 0x0121, |
| 206 | DEFAULT_GPIO_RESET | PEGASUS_II ) | 207 | DEFAULT_GPIO_RESET | PEGASUS_II | TRUST_LINK_STATUS ) |
| 207 | PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986, | 208 | PEGASUS_DEV( "Billionton USB-100", VENDOR_BILLIONTON, 0x0986, |
| 208 | DEFAULT_GPIO_RESET ) | 209 | DEFAULT_GPIO_RESET ) |
| 209 | PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987, | 210 | PEGASUS_DEV( "Billionton USBLP-100", VENDOR_BILLIONTON, 0x0987, |
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index 310a8b5f5906..39a498362594 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c | |||
| @@ -18,11 +18,6 @@ | |||
| 18 | 18 | ||
| 19 | static struct usb_device_id id_table [] = { | 19 | static struct usb_device_id id_table [] = { |
| 20 | { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ | 20 | { USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */ |
| 21 | { USB_DEVICE(0x1410, 0x1110) }, /* Novatel Wireless Merlin CDMA */ | ||
| 22 | { USB_DEVICE(0x1410, 0x1130) }, /* Novatel Wireless S720 CDMA/EV-DO */ | ||
| 23 | { USB_DEVICE(0x1410, 0x2110) }, /* Novatel Wireless U720 CDMA/EV-DO */ | ||
| 24 | { USB_DEVICE(0x1410, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */ | ||
| 25 | { USB_DEVICE(0x1410, 0x1100) }, /* ExpressCard34 Qualcomm 3G CDMA */ | ||
| 26 | { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */ | 21 | { USB_DEVICE(0x413c, 0x8115) }, /* Dell Wireless HSDPA 5500 */ |
| 27 | { }, | 22 | { }, |
| 28 | }; | 23 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 1633a0fd48e8..8ff9d54b21e6 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -879,6 +879,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) | |||
| 879 | break; | 879 | break; |
| 880 | case FT232BM: /* FT232BM chip */ | 880 | case FT232BM: /* FT232BM chip */ |
| 881 | case FT2232C: /* FT2232C chip */ | 881 | case FT2232C: /* FT2232C chip */ |
| 882 | case FT232RL: | ||
| 882 | if (baud <= 3000000) { | 883 | if (baud <= 3000000) { |
| 883 | div_value = ftdi_232bm_baud_to_divisor(baud); | 884 | div_value = ftdi_232bm_baud_to_divisor(baud); |
| 884 | } else { | 885 | } else { |
| @@ -1021,9 +1022,12 @@ static void ftdi_determine_type(struct usb_serial_port *port) | |||
| 1021 | /* (It might be a BM because of the iSerialNumber bug, | 1022 | /* (It might be a BM because of the iSerialNumber bug, |
| 1022 | * but it will still work as an AM device.) */ | 1023 | * but it will still work as an AM device.) */ |
| 1023 | priv->chip_type = FT8U232AM; | 1024 | priv->chip_type = FT8U232AM; |
| 1024 | } else { | 1025 | } else if (version < 0x600) { |
| 1025 | /* Assume its an FT232BM (or FT245BM) */ | 1026 | /* Assume its an FT232BM (or FT245BM) */ |
| 1026 | priv->chip_type = FT232BM; | 1027 | priv->chip_type = FT232BM; |
| 1028 | } else { | ||
| 1029 | /* Assume its an FT232R */ | ||
| 1030 | priv->chip_type = FT232RL; | ||
| 1027 | } | 1031 | } |
| 1028 | info("Detected %s", ftdi_chip_name[priv->chip_type]); | 1032 | info("Detected %s", ftdi_chip_name[priv->chip_type]); |
| 1029 | } | 1033 | } |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 53baeec8f265..4f8282ad7720 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
| @@ -20,13 +20,14 @@ | |||
| 20 | #include <linux/usb/serial.h> | 20 | #include <linux/usb/serial.h> |
| 21 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
| 22 | 22 | ||
| 23 | static int generic_probe(struct usb_interface *interface, | ||
| 24 | const struct usb_device_id *id); | ||
| 25 | |||
| 26 | 23 | ||
| 27 | static int debug; | 24 | static int debug; |
| 28 | 25 | ||
| 29 | #ifdef CONFIG_USB_SERIAL_GENERIC | 26 | #ifdef CONFIG_USB_SERIAL_GENERIC |
| 27 | |||
| 28 | static int generic_probe(struct usb_interface *interface, | ||
| 29 | const struct usb_device_id *id); | ||
| 30 | |||
| 30 | static __u16 vendor = 0x05f9; | 31 | static __u16 vendor = 0x05f9; |
| 31 | static __u16 product = 0xffff; | 32 | static __u16 product = 0xffff; |
| 32 | 33 | ||
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 2d588fb82573..19bf403f9db2 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
| @@ -1628,6 +1628,7 @@ static struct usb_serial_driver moschip7720_2port_driver = { | |||
| 1628 | .chars_in_buffer = mos7720_chars_in_buffer, | 1628 | .chars_in_buffer = mos7720_chars_in_buffer, |
| 1629 | .break_ctl = mos7720_break, | 1629 | .break_ctl = mos7720_break, |
| 1630 | .read_bulk_callback = mos7720_bulk_in_callback, | 1630 | .read_bulk_callback = mos7720_bulk_in_callback, |
| 1631 | .read_int_callback = mos7720_interrupt_callback, | ||
| 1631 | }; | 1632 | }; |
| 1632 | 1633 | ||
| 1633 | static int __init moschip7720_init(void) | 1634 | static int __init moschip7720_init(void) |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index db92a7fb1f7c..e178e6f40319 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -109,7 +109,6 @@ static int option_send_setup(struct usb_serial_port *port); | |||
| 109 | #define HUAWEI_PRODUCT_E220 0x1003 | 109 | #define HUAWEI_PRODUCT_E220 0x1003 |
| 110 | 110 | ||
| 111 | #define NOVATELWIRELESS_VENDOR_ID 0x1410 | 111 | #define NOVATELWIRELESS_VENDOR_ID 0x1410 |
| 112 | #define NOVATELWIRELESS_PRODUCT_U740 0x1400 | ||
| 113 | 112 | ||
| 114 | #define ANYDATA_VENDOR_ID 0x16d5 | 113 | #define ANYDATA_VENDOR_ID 0x16d5 |
| 115 | #define ANYDATA_PRODUCT_ID 0x6501 | 114 | #define ANYDATA_PRODUCT_ID 0x6501 |
| @@ -152,7 +151,19 @@ static struct usb_device_id option_ids[] = { | |||
| 152 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) }, | 151 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) }, |
| 153 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, | 152 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600) }, |
| 154 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) }, | 153 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220) }, |
| 155 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID,NOVATELWIRELESS_PRODUCT_U740) }, | 154 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1100) }, /* Novatel Merlin XS620/S640 */ |
| 155 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1110) }, /* Novatel Merlin S620 */ | ||
| 156 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1120) }, /* Novatel Merlin EX720 */ | ||
| 157 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1130) }, /* Novatel Merlin S720 */ | ||
| 158 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1400) }, /* Novatel U730 */ | ||
| 159 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1410) }, /* Novatel U740 */ | ||
| 160 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1420) }, /* Novatel EU870 */ | ||
| 161 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1430) }, /* Novatel Merlin XU870 HSDPA/3G */ | ||
| 162 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x1430) }, /* Novatel XU870 */ | ||
| 163 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2100) }, /* Novatel EV620 CDMA/EV-DO */ | ||
| 164 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */ | ||
| 165 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ | ||
| 166 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */ | ||
| 156 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) }, | 167 | { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ID) }, |
| 157 | { } /* Terminating entry */ | 168 | { } /* Terminating entry */ |
| 158 | }; | 169 | }; |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 8511352251f3..7639022cdf84 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
| @@ -138,6 +138,11 @@ static void destroy_serial(struct kref *kref) | |||
| 138 | 138 | ||
| 139 | dbg("%s - %s", __FUNCTION__, serial->type->description); | 139 | dbg("%s - %s", __FUNCTION__, serial->type->description); |
| 140 | 140 | ||
| 141 | serial->type->shutdown(serial); | ||
| 142 | |||
| 143 | /* return the minor range that this device had */ | ||
| 144 | return_serial(serial); | ||
| 145 | |||
| 141 | for (i = 0; i < serial->num_ports; ++i) | 146 | for (i = 0; i < serial->num_ports; ++i) |
| 142 | serial->port[i]->open_count = 0; | 147 | serial->port[i]->open_count = 0; |
| 143 | 148 | ||
| @@ -148,12 +153,6 @@ static void destroy_serial(struct kref *kref) | |||
| 148 | serial->port[i] = NULL; | 153 | serial->port[i] = NULL; |
| 149 | } | 154 | } |
| 150 | 155 | ||
| 151 | if (serial->type->shutdown) | ||
| 152 | serial->type->shutdown(serial); | ||
| 153 | |||
| 154 | /* return the minor range that this device had */ | ||
| 155 | return_serial(serial); | ||
| 156 | |||
| 157 | /* If this is a "fake" port, we have to clean it up here, as it will | 156 | /* If this is a "fake" port, we have to clean it up here, as it will |
| 158 | * not get cleaned up in port_release() as it was never registered with | 157 | * not get cleaned up in port_release() as it was never registered with |
| 159 | * the driver core */ | 158 | * the driver core */ |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 2dd31e3f5107..4a9d0d5c7282 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
| @@ -327,6 +327,13 @@ UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100, | |||
| 327 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 327 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 328 | US_FL_FIX_CAPACITY), | 328 | US_FL_FIX_CAPACITY), |
| 329 | 329 | ||
| 330 | /* Reported by Emil Larsson <emil@swip.net> */ | ||
| 331 | UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0100, | ||
| 332 | "NIKON", | ||
| 333 | "NIKON DSC D80", | ||
| 334 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
| 335 | US_FL_FIX_CAPACITY), | ||
| 336 | |||
| 330 | /* BENQ DC5330 | 337 | /* BENQ DC5330 |
| 331 | * Reported by Manuel Fombuena <mfombuena@ya.com> and | 338 | * Reported by Manuel Fombuena <mfombuena@ya.com> and |
| 332 | * Frank Copeland <fjc@thingy.apana.org.au> */ | 339 | * Frank Copeland <fjc@thingy.apana.org.au> */ |
| @@ -1411,6 +1418,16 @@ UNUSUAL_DEV( 0x22b8, 0x3010, 0x0001, 0x0001, | |||
| 1411 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1418 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
| 1412 | US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), | 1419 | US_FL_FIX_CAPACITY | US_FL_IGNORE_RESIDUE ), |
| 1413 | 1420 | ||
| 1421 | /* | ||
| 1422 | * Patch by Pete Zaitcev <zaitcev@redhat.com> | ||
| 1423 | * Report by Mark Patton. Red Hat bz#208928. | ||
| 1424 | */ | ||
| 1425 | UNUSUAL_DEV( 0x22b8, 0x4810, 0x0001, 0x0001, | ||
| 1426 | "Motorola", | ||
| 1427 | "RAZR V3i", | ||
| 1428 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
| 1429 | US_FL_FIX_CAPACITY), | ||
| 1430 | |||
| 1414 | /* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ | 1431 | /* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */ |
| 1415 | UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, | 1432 | UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999, |
| 1416 | "MPIO", | 1433 | "MPIO", |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 7f5a59836818..8372ace4a0d9 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
| @@ -139,7 +139,7 @@ config FB_TILEBLITTING | |||
| 139 | This is particularly important to one driver, matroxfb. If | 139 | This is particularly important to one driver, matroxfb. If |
| 140 | unsure, say N. | 140 | unsure, say N. |
| 141 | 141 | ||
| 142 | comment "Frambuffer hardware drivers" | 142 | comment "Frame buffer hardware drivers" |
| 143 | depends on FB | 143 | depends on FB |
| 144 | 144 | ||
| 145 | config FB_CIRRUS | 145 | config FB_CIRRUS |
| @@ -1320,7 +1320,7 @@ config FB_AU1100 | |||
| 1320 | 1320 | ||
| 1321 | config FB_AU1200 | 1321 | config FB_AU1200 |
| 1322 | bool "Au1200 LCD Driver" | 1322 | bool "Au1200 LCD Driver" |
| 1323 | depends on FB && MIPS && SOC_AU1200 | 1323 | depends on (FB = y) && MIPS && SOC_AU1200 |
| 1324 | select FB_CFB_FILLRECT | 1324 | select FB_CFB_FILLRECT |
| 1325 | select FB_CFB_COPYAREA | 1325 | select FB_CFB_COPYAREA |
| 1326 | select FB_CFB_IMAGEBLIT | 1326 | select FB_CFB_IMAGEBLIT |
| @@ -1470,7 +1470,7 @@ config FB_G364 | |||
| 1470 | 1470 | ||
| 1471 | config FB_68328 | 1471 | config FB_68328 |
| 1472 | bool "Motorola 68328 native frame buffer support" | 1472 | bool "Motorola 68328 native frame buffer support" |
| 1473 | depends on FB && (M68328 || M68EZ328 || M68VZ328) | 1473 | depends on (FB = y) && (M68328 || M68EZ328 || M68VZ328) |
| 1474 | select FB_CFB_FILLRECT | 1474 | select FB_CFB_FILLRECT |
| 1475 | select FB_CFB_COPYAREA | 1475 | select FB_CFB_COPYAREA |
| 1476 | select FB_CFB_IMAGEBLIT | 1476 | select FB_CFB_IMAGEBLIT |
| @@ -1616,7 +1616,7 @@ config FB_IBM_GXT4500 | |||
| 1616 | 1616 | ||
| 1617 | config FB_PS3 | 1617 | config FB_PS3 |
| 1618 | bool "PS3 GPU framebuffer driver" | 1618 | bool "PS3 GPU framebuffer driver" |
| 1619 | depends on FB && PS3_PS3AV | 1619 | depends on (FB = y) && PS3_PS3AV |
| 1620 | select FB_CFB_FILLRECT | 1620 | select FB_CFB_FILLRECT |
| 1621 | select FB_CFB_COPYAREA | 1621 | select FB_CFB_COPYAREA |
| 1622 | select FB_CFB_IMAGEBLIT | 1622 | select FB_CFB_IMAGEBLIT |
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index d1312477813e..6b488b8a7eee 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c | |||
| @@ -199,8 +199,8 @@ static int locomolcd_remove(struct locomo_dev *dev) | |||
| 199 | { | 199 | { |
| 200 | unsigned long flags; | 200 | unsigned long flags; |
| 201 | 201 | ||
| 202 | locomobl_data.brightness = 0; | 202 | locomolcd_bl_device->props.brightness = 0; |
| 203 | locomobl_data.power = 0; | 203 | locomolcd_bl_device->props.power = 0; |
| 204 | locomolcd_set_intensity(locomolcd_bl_device); | 204 | locomolcd_set_intensity(locomolcd_bl_device); |
| 205 | 205 | ||
| 206 | backlight_device_unregister(locomolcd_bl_device); | 206 | backlight_device_unregister(locomolcd_bl_device); |
diff --git a/drivers/video/backlight/progear_bl.c b/drivers/video/backlight/progear_bl.c index 702269357861..836ab4df0ef2 100644 --- a/drivers/video/backlight/progear_bl.c +++ b/drivers/video/backlight/progear_bl.c | |||
| @@ -65,13 +65,13 @@ static int progearbl_probe(struct platform_device *pdev) | |||
| 65 | u8 temp; | 65 | u8 temp; |
| 66 | struct backlight_device *progear_backlight_device; | 66 | struct backlight_device *progear_backlight_device; |
| 67 | 67 | ||
| 68 | pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 0); | 68 | pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL); |
| 69 | if (!pmu_dev) { | 69 | if (!pmu_dev) { |
| 70 | printk("ALI M7101 PMU not found.\n"); | 70 | printk("ALI M7101 PMU not found.\n"); |
| 71 | return -ENODEV; | 71 | return -ENODEV; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, 0); | 74 | sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); |
| 75 | if (!sb_dev) { | 75 | if (!sb_dev) { |
| 76 | printk("ALI 1533 SB not found.\n"); | 76 | printk("ALI 1533 SB not found.\n"); |
| 77 | pci_dev_put(pmu_dev); | 77 | pci_dev_put(pmu_dev); |
diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index 9bb6257d6918..b0b2e40bbd9f 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c | |||
| @@ -186,8 +186,7 @@ static int bw2_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) | |||
| 186 | * Initialisation | 186 | * Initialisation |
| 187 | */ | 187 | */ |
| 188 | 188 | ||
| 189 | static void | 189 | static void __devinit bw2_init_fix(struct fb_info *info, int linebytes) |
| 190 | bw2_init_fix(struct fb_info *info, int linebytes) | ||
| 191 | { | 190 | { |
| 192 | strlcpy(info->fix.id, "bwtwo", sizeof(info->fix.id)); | 191 | strlcpy(info->fix.id, "bwtwo", sizeof(info->fix.id)); |
| 193 | 192 | ||
| @@ -199,43 +198,44 @@ bw2_init_fix(struct fb_info *info, int linebytes) | |||
| 199 | info->fix.accel = FB_ACCEL_SUN_BWTWO; | 198 | info->fix.accel = FB_ACCEL_SUN_BWTWO; |
| 200 | } | 199 | } |
| 201 | 200 | ||
| 202 | static u8 bw2regs_1600[] __initdata = { | 201 | static u8 bw2regs_1600[] __devinitdata = { |
| 203 | 0x14, 0x8b, 0x15, 0x28, 0x16, 0x03, 0x17, 0x13, | 202 | 0x14, 0x8b, 0x15, 0x28, 0x16, 0x03, 0x17, 0x13, |
| 204 | 0x18, 0x7b, 0x19, 0x05, 0x1a, 0x34, 0x1b, 0x2e, | 203 | 0x18, 0x7b, 0x19, 0x05, 0x1a, 0x34, 0x1b, 0x2e, |
| 205 | 0x1c, 0x00, 0x1d, 0x0a, 0x1e, 0xff, 0x1f, 0x01, | 204 | 0x1c, 0x00, 0x1d, 0x0a, 0x1e, 0xff, 0x1f, 0x01, |
| 206 | 0x10, 0x21, 0 | 205 | 0x10, 0x21, 0 |
| 207 | }; | 206 | }; |
| 208 | 207 | ||
| 209 | static u8 bw2regs_ecl[] __initdata = { | 208 | static u8 bw2regs_ecl[] __devinitdata = { |
| 210 | 0x14, 0x65, 0x15, 0x1e, 0x16, 0x04, 0x17, 0x0c, | 209 | 0x14, 0x65, 0x15, 0x1e, 0x16, 0x04, 0x17, 0x0c, |
| 211 | 0x18, 0x5e, 0x19, 0x03, 0x1a, 0xa7, 0x1b, 0x23, | 210 | 0x18, 0x5e, 0x19, 0x03, 0x1a, 0xa7, 0x1b, 0x23, |
| 212 | 0x1c, 0x00, 0x1d, 0x08, 0x1e, 0xff, 0x1f, 0x01, | 211 | 0x1c, 0x00, 0x1d, 0x08, 0x1e, 0xff, 0x1f, 0x01, |
| 213 | 0x10, 0x20, 0 | 212 | 0x10, 0x20, 0 |
| 214 | }; | 213 | }; |
| 215 | 214 | ||
| 216 | static u8 bw2regs_analog[] __initdata = { | 215 | static u8 bw2regs_analog[] __devinitdata = { |
| 217 | 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x03, 0x17, 0x13, | 216 | 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x03, 0x17, 0x13, |
| 218 | 0x18, 0xb0, 0x19, 0x03, 0x1a, 0xa6, 0x1b, 0x22, | 217 | 0x18, 0xb0, 0x19, 0x03, 0x1a, 0xa6, 0x1b, 0x22, |
| 219 | 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, | 218 | 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, |
| 220 | 0x10, 0x20, 0 | 219 | 0x10, 0x20, 0 |
| 221 | }; | 220 | }; |
| 222 | 221 | ||
| 223 | static u8 bw2regs_76hz[] __initdata = { | 222 | static u8 bw2regs_76hz[] __devinitdata = { |
| 224 | 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, | 223 | 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, |
| 225 | 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, | 224 | 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, |
| 226 | 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, | 225 | 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, |
| 227 | 0x10, 0x24, 0 | 226 | 0x10, 0x24, 0 |
| 228 | }; | 227 | }; |
| 229 | 228 | ||
| 230 | static u8 bw2regs_66hz[] __initdata = { | 229 | static u8 bw2regs_66hz[] __devinitdata = { |
| 231 | 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, | 230 | 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, |
| 232 | 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, | 231 | 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, |
| 233 | 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, | 232 | 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, |
| 234 | 0x10, 0x20, 0 | 233 | 0x10, 0x20, 0 |
| 235 | }; | 234 | }; |
| 236 | 235 | ||
| 237 | static void bw2_do_default_mode(struct bw2_par *par, struct fb_info *info, | 236 | static void __devinit bw2_do_default_mode(struct bw2_par *par, |
| 238 | int *linebytes) | 237 | struct fb_info *info, |
| 238 | int *linebytes) | ||
| 239 | { | 239 | { |
| 240 | u8 status, mon; | 240 | u8 status, mon; |
| 241 | u8 *p; | 241 | u8 *p; |
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index ec6a51a5822d..b071bb632b97 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c | |||
| @@ -354,7 +354,8 @@ static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) | |||
| 354 | * Initialisation | 354 | * Initialisation |
| 355 | */ | 355 | */ |
| 356 | 356 | ||
| 357 | static void cg14_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) | 357 | static void __devinit cg14_init_fix(struct fb_info *info, int linebytes, |
| 358 | struct device_node *dp) | ||
| 358 | { | 359 | { |
| 359 | const char *name = dp->name; | 360 | const char *name = dp->name; |
| 360 | 361 | ||
| @@ -368,7 +369,7 @@ static void cg14_init_fix(struct fb_info *info, int linebytes, struct device_nod | |||
| 368 | info->fix.accel = FB_ACCEL_SUN_CG14; | 369 | info->fix.accel = FB_ACCEL_SUN_CG14; |
| 369 | } | 370 | } |
| 370 | 371 | ||
| 371 | static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] __initdata = { | 372 | static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] __devinitdata = { |
| 372 | { | 373 | { |
| 373 | .voff = CG14_REGS, | 374 | .voff = CG14_REGS, |
| 374 | .poff = 0x80000000, | 375 | .poff = 0x80000000, |
diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index ada6f7e3a891..767c850f8eb7 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c | |||
| @@ -186,8 +186,7 @@ static int cg3_setcolreg(unsigned regno, | |||
| 186 | * @blank_mode: the blank mode we want. | 186 | * @blank_mode: the blank mode we want. |
| 187 | * @info: frame buffer structure that represents a single frame buffer | 187 | * @info: frame buffer structure that represents a single frame buffer |
| 188 | */ | 188 | */ |
| 189 | static int | 189 | static int cg3_blank(int blank, struct fb_info *info) |
| 190 | cg3_blank(int blank, struct fb_info *info) | ||
| 191 | { | 190 | { |
| 192 | struct cg3_par *par = (struct cg3_par *) info->par; | 191 | struct cg3_par *par = (struct cg3_par *) info->par; |
| 193 | struct cg3_regs __iomem *regs = par->regs; | 192 | struct cg3_regs __iomem *regs = par->regs; |
| @@ -251,8 +250,8 @@ static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) | |||
| 251 | * Initialisation | 250 | * Initialisation |
| 252 | */ | 251 | */ |
| 253 | 252 | ||
| 254 | static void | 253 | static void __devinit cg3_init_fix(struct fb_info *info, int linebytes, |
| 255 | cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) | 254 | struct device_node *dp) |
| 256 | { | 255 | { |
| 257 | strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); | 256 | strlcpy(info->fix.id, dp->name, sizeof(info->fix.id)); |
| 258 | 257 | ||
| @@ -264,8 +263,8 @@ cg3_init_fix(struct fb_info *info, int linebytes, struct device_node *dp) | |||
| 264 | info->fix.accel = FB_ACCEL_SUN_CGTHREE; | 263 | info->fix.accel = FB_ACCEL_SUN_CGTHREE; |
| 265 | } | 264 | } |
| 266 | 265 | ||
| 267 | static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var, | 266 | static void __devinit cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var, |
| 268 | struct device_node *dp) | 267 | struct device_node *dp) |
| 269 | { | 268 | { |
| 270 | char *params; | 269 | char *params; |
| 271 | char *p; | 270 | char *p; |
| @@ -287,36 +286,36 @@ static void cg3_rdi_maybe_fixup_var(struct fb_var_screeninfo *var, | |||
| 287 | } | 286 | } |
| 288 | } | 287 | } |
| 289 | 288 | ||
| 290 | static u8 cg3regvals_66hz[] __initdata = { /* 1152 x 900, 66 Hz */ | 289 | static u8 cg3regvals_66hz[] __devinitdata = { /* 1152 x 900, 66 Hz */ |
| 291 | 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, | 290 | 0x14, 0xbb, 0x15, 0x2b, 0x16, 0x04, 0x17, 0x14, |
| 292 | 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, | 291 | 0x18, 0xae, 0x19, 0x03, 0x1a, 0xa8, 0x1b, 0x24, |
| 293 | 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, | 292 | 0x1c, 0x01, 0x1d, 0x05, 0x1e, 0xff, 0x1f, 0x01, |
| 294 | 0x10, 0x20, 0 | 293 | 0x10, 0x20, 0 |
| 295 | }; | 294 | }; |
| 296 | 295 | ||
| 297 | static u8 cg3regvals_76hz[] __initdata = { /* 1152 x 900, 76 Hz */ | 296 | static u8 cg3regvals_76hz[] __devinitdata = { /* 1152 x 900, 76 Hz */ |
| 298 | 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, | 297 | 0x14, 0xb7, 0x15, 0x27, 0x16, 0x03, 0x17, 0x0f, |
| 299 | 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, | 298 | 0x18, 0xae, 0x19, 0x03, 0x1a, 0xae, 0x1b, 0x2a, |
| 300 | 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, | 299 | 0x1c, 0x01, 0x1d, 0x09, 0x1e, 0xff, 0x1f, 0x01, |
| 301 | 0x10, 0x24, 0 | 300 | 0x10, 0x24, 0 |
| 302 | }; | 301 | }; |
| 303 | 302 | ||
| 304 | static u8 cg3regvals_rdi[] __initdata = { /* 640 x 480, cgRDI */ | 303 | static u8 cg3regvals_rdi[] __devinitdata = { /* 640 x 480, cgRDI */ |
| 305 | 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10, | 304 | 0x14, 0x70, 0x15, 0x20, 0x16, 0x08, 0x17, 0x10, |
| 306 | 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51, | 305 | 0x18, 0x06, 0x19, 0x02, 0x1a, 0x31, 0x1b, 0x51, |
| 307 | 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01, | 306 | 0x1c, 0x06, 0x1d, 0x0c, 0x1e, 0xff, 0x1f, 0x01, |
| 308 | 0x10, 0x22, 0 | 307 | 0x10, 0x22, 0 |
| 309 | }; | 308 | }; |
| 310 | 309 | ||
| 311 | static u8 *cg3_regvals[] __initdata = { | 310 | static u8 *cg3_regvals[] __devinitdata = { |
| 312 | cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi | 311 | cg3regvals_66hz, cg3regvals_76hz, cg3regvals_rdi |
| 313 | }; | 312 | }; |
| 314 | 313 | ||
| 315 | static u_char cg3_dacvals[] __initdata = { | 314 | static u_char cg3_dacvals[] __devinitdata = { |
| 316 | 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0 | 315 | 4, 0xff, 5, 0x00, 6, 0x70, 7, 0x00, 0 |
| 317 | }; | 316 | }; |
| 318 | 317 | ||
| 319 | static void cg3_do_default_mode(struct cg3_par *par) | 318 | static void __devinit cg3_do_default_mode(struct cg3_par *par) |
| 320 | { | 319 | { |
| 321 | enum cg3_type type; | 320 | enum cg3_type type; |
| 322 | u8 *p; | 321 | u8 *p; |
| @@ -433,7 +432,8 @@ static int __devinit cg3_init_one(struct of_device *op) | |||
| 433 | return 0; | 432 | return 0; |
| 434 | } | 433 | } |
| 435 | 434 | ||
| 436 | static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id *match) | 435 | static int __devinit cg3_probe(struct of_device *dev, |
| 436 | const struct of_device_id *match) | ||
| 437 | { | 437 | { |
| 438 | struct of_device *op = to_of_device(&dev->dev); | 438 | struct of_device *op = to_of_device(&dev->dev); |
| 439 | 439 | ||
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index 15854aec3180..1d4e8354b561 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c | |||
| @@ -336,14 +336,30 @@ struct ffb_dac { | |||
| 336 | u32 value2; | 336 | u32 value2; |
| 337 | }; | 337 | }; |
| 338 | 338 | ||
| 339 | #define FFB_DAC_UCTRL 0x1001 /* User Control */ | ||
| 340 | #define FFB_DAC_UCTRL_MANREV 0x00000f00 /* 4-bit Manufacturing Revision */ | ||
| 341 | #define FFB_DAC_UCTRL_MANREV_SHIFT 8 | ||
| 342 | #define FFB_DAC_TGEN 0x6000 /* Timing Generator */ | ||
| 343 | #define FFB_DAC_TGEN_VIDE 0x00000001 /* Video Enable */ | ||
| 344 | #define FFB_DAC_DID 0x8000 /* Device Identification */ | ||
| 345 | #define FFB_DAC_DID_PNUM 0x0ffff000 /* Device Part Number */ | ||
| 346 | #define FFB_DAC_DID_PNUM_SHIFT 12 | ||
| 347 | #define FFB_DAC_DID_REV 0xf0000000 /* Device Revision */ | ||
| 348 | #define FFB_DAC_DID_REV_SHIFT 28 | ||
| 349 | |||
| 350 | #define FFB_DAC_CUR_CTRL 0x100 | ||
| 351 | #define FFB_DAC_CUR_CTRL_P0 0x00000001 | ||
| 352 | #define FFB_DAC_CUR_CTRL_P1 0x00000002 | ||
| 353 | |||
| 339 | struct ffb_par { | 354 | struct ffb_par { |
| 340 | spinlock_t lock; | 355 | spinlock_t lock; |
| 341 | struct ffb_fbc __iomem *fbc; | 356 | struct ffb_fbc __iomem *fbc; |
| 342 | struct ffb_dac __iomem *dac; | 357 | struct ffb_dac __iomem *dac; |
| 343 | 358 | ||
| 344 | u32 flags; | 359 | u32 flags; |
| 345 | #define FFB_FLAG_AFB 0x00000001 | 360 | #define FFB_FLAG_AFB 0x00000001 /* AFB m3 or m6 */ |
| 346 | #define FFB_FLAG_BLANKED 0x00000002 | 361 | #define FFB_FLAG_BLANKED 0x00000002 /* screen is blanked */ |
| 362 | #define FFB_FLAG_INVCURSOR 0x00000004 /* DAC has inverted cursor logic */ | ||
| 347 | 363 | ||
| 348 | u32 fg_cache __attribute__((aligned (8))); | 364 | u32 fg_cache __attribute__((aligned (8))); |
| 349 | u32 bg_cache; | 365 | u32 bg_cache; |
| @@ -354,7 +370,6 @@ struct ffb_par { | |||
| 354 | unsigned long physbase; | 370 | unsigned long physbase; |
| 355 | unsigned long fbsize; | 371 | unsigned long fbsize; |
| 356 | 372 | ||
| 357 | int dac_rev; | ||
| 358 | int board_type; | 373 | int board_type; |
| 359 | }; | 374 | }; |
| 360 | 375 | ||
| @@ -426,11 +441,12 @@ static void ffb_switch_from_graph(struct ffb_par *par) | |||
| 426 | FFBWait(par); | 441 | FFBWait(par); |
| 427 | 442 | ||
| 428 | /* Disable cursor. */ | 443 | /* Disable cursor. */ |
| 429 | upa_writel(0x100, &dac->type2); | 444 | upa_writel(FFB_DAC_CUR_CTRL, &dac->type2); |
| 430 | if (par->dac_rev <= 2) | 445 | if (par->flags & FFB_FLAG_INVCURSOR) |
| 431 | upa_writel(0, &dac->value2); | 446 | upa_writel(0, &dac->value2); |
| 432 | else | 447 | else |
| 433 | upa_writel(3, &dac->value2); | 448 | upa_writel((FFB_DAC_CUR_CTRL_P0 | |
| 449 | FFB_DAC_CUR_CTRL_P1), &dac->value2); | ||
| 434 | 450 | ||
| 435 | spin_unlock_irqrestore(&par->lock, flags); | 451 | spin_unlock_irqrestore(&par->lock, flags); |
| 436 | } | 452 | } |
| @@ -664,18 +680,18 @@ ffb_blank(int blank, struct fb_info *info) | |||
| 664 | struct ffb_par *par = (struct ffb_par *) info->par; | 680 | struct ffb_par *par = (struct ffb_par *) info->par; |
| 665 | struct ffb_dac __iomem *dac = par->dac; | 681 | struct ffb_dac __iomem *dac = par->dac; |
| 666 | unsigned long flags; | 682 | unsigned long flags; |
| 667 | u32 tmp; | 683 | u32 val; |
| 684 | int i; | ||
| 668 | 685 | ||
| 669 | spin_lock_irqsave(&par->lock, flags); | 686 | spin_lock_irqsave(&par->lock, flags); |
| 670 | 687 | ||
| 671 | FFBWait(par); | 688 | FFBWait(par); |
| 672 | 689 | ||
| 690 | upa_writel(FFB_DAC_TGEN, &dac->type); | ||
| 691 | val = upa_readl(&dac->value); | ||
| 673 | switch (blank) { | 692 | switch (blank) { |
| 674 | case FB_BLANK_UNBLANK: /* Unblanking */ | 693 | case FB_BLANK_UNBLANK: /* Unblanking */ |
| 675 | upa_writel(0x6000, &dac->type); | 694 | val |= FFB_DAC_TGEN_VIDE; |
| 676 | tmp = (upa_readl(&dac->value) | 0x1); | ||
| 677 | upa_writel(0x6000, &dac->type); | ||
| 678 | upa_writel(tmp, &dac->value); | ||
| 679 | par->flags &= ~FFB_FLAG_BLANKED; | 695 | par->flags &= ~FFB_FLAG_BLANKED; |
| 680 | break; | 696 | break; |
| 681 | 697 | ||
| @@ -683,13 +699,16 @@ ffb_blank(int blank, struct fb_info *info) | |||
| 683 | case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */ | 699 | case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */ |
| 684 | case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */ | 700 | case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */ |
| 685 | case FB_BLANK_POWERDOWN: /* Poweroff */ | 701 | case FB_BLANK_POWERDOWN: /* Poweroff */ |
| 686 | upa_writel(0x6000, &dac->type); | 702 | val &= ~FFB_DAC_TGEN_VIDE; |
| 687 | tmp = (upa_readl(&dac->value) & ~0x1); | ||
| 688 | upa_writel(0x6000, &dac->type); | ||
| 689 | upa_writel(tmp, &dac->value); | ||
| 690 | par->flags |= FFB_FLAG_BLANKED; | 703 | par->flags |= FFB_FLAG_BLANKED; |
| 691 | break; | 704 | break; |
| 692 | } | 705 | } |
| 706 | upa_writel(FFB_DAC_TGEN, &dac->type); | ||
| 707 | upa_writel(val, &dac->value); | ||
| 708 | for (i = 0; i < 10; i++) { | ||
| 709 | upa_writel(FFB_DAC_TGEN, &dac->type); | ||
| 710 | upa_readl(&dac->value); | ||
| 711 | } | ||
| 693 | 712 | ||
| 694 | spin_unlock_irqrestore(&par->lock, flags); | 713 | spin_unlock_irqrestore(&par->lock, flags); |
| 695 | 714 | ||
| @@ -894,6 +913,7 @@ static int ffb_init_one(struct of_device *op) | |||
| 894 | struct ffb_dac __iomem *dac; | 913 | struct ffb_dac __iomem *dac; |
| 895 | struct all_info *all; | 914 | struct all_info *all; |
| 896 | int err; | 915 | int err; |
| 916 | u32 dac_pnum, dac_rev, dac_mrev; | ||
| 897 | 917 | ||
| 898 | all = kzalloc(sizeof(*all), GFP_KERNEL); | 918 | all = kzalloc(sizeof(*all), GFP_KERNEL); |
| 899 | if (!all) | 919 | if (!all) |
| @@ -948,17 +968,31 @@ static int ffb_init_one(struct of_device *op) | |||
| 948 | if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0) | 968 | if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0) |
| 949 | upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr); | 969 | upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr); |
| 950 | 970 | ||
| 951 | ffb_switch_from_graph(&all->par); | ||
| 952 | |||
| 953 | dac = all->par.dac; | 971 | dac = all->par.dac; |
| 954 | upa_writel(0x8000, &dac->type); | 972 | upa_writel(FFB_DAC_DID, &dac->type); |
| 955 | all->par.dac_rev = upa_readl(&dac->value) >> 0x1c; | 973 | dac_pnum = upa_readl(&dac->value); |
| 974 | dac_rev = (dac_pnum & FFB_DAC_DID_REV) >> FFB_DAC_DID_REV_SHIFT; | ||
| 975 | dac_pnum = (dac_pnum & FFB_DAC_DID_PNUM) >> FFB_DAC_DID_PNUM_SHIFT; | ||
| 976 | |||
| 977 | upa_writel(FFB_DAC_UCTRL, &dac->type); | ||
| 978 | dac_mrev = upa_readl(&dac->value); | ||
| 979 | dac_mrev = (dac_mrev & FFB_DAC_UCTRL_MANREV) >> | ||
| 980 | FFB_DAC_UCTRL_MANREV_SHIFT; | ||
| 956 | 981 | ||
| 957 | /* Elite3D has different DAC revision numbering, and no DAC revisions | 982 | /* Elite3D has different DAC revision numbering, and no DAC revisions |
| 958 | * have the reversed meaning of cursor enable. | 983 | * have the reversed meaning of cursor enable. Otherwise, Pacifica 1 |
| 984 | * ramdacs with manufacturing revision less than 3 have inverted | ||
| 985 | * cursor logic. We identify Pacifica 1 as not Pacifica 2, the | ||
| 986 | * latter having a part number value of 0x236e. | ||
| 959 | */ | 987 | */ |
| 960 | if (all->par.flags & FFB_FLAG_AFB) | 988 | if ((all->par.flags & FFB_FLAG_AFB) || dac_pnum == 0x236e) { |
| 961 | all->par.dac_rev = 10; | 989 | all->par.flags &= ~FFB_FLAG_INVCURSOR; |
| 990 | } else { | ||
| 991 | if (dac_mrev < 3) | ||
| 992 | all->par.flags |= FFB_FLAG_INVCURSOR; | ||
| 993 | } | ||
| 994 | |||
| 995 | ffb_switch_from_graph(&all->par); | ||
| 962 | 996 | ||
| 963 | /* Unblank it just to be sure. When there are multiple | 997 | /* Unblank it just to be sure. When there are multiple |
| 964 | * FFB/AFB cards in the system, or it is not the OBP | 998 | * FFB/AFB cards in the system, or it is not the OBP |
| @@ -993,10 +1027,12 @@ static int ffb_init_one(struct of_device *op) | |||
| 993 | 1027 | ||
| 994 | dev_set_drvdata(&op->dev, all); | 1028 | dev_set_drvdata(&op->dev, all); |
| 995 | 1029 | ||
| 996 | printk("%s: %s at %016lx, type %d, DAC revision %d\n", | 1030 | printk("%s: %s at %016lx, type %d, " |
| 1031 | "DAC pnum[%x] rev[%d] manuf_rev[%d]\n", | ||
| 997 | dp->full_name, | 1032 | dp->full_name, |
| 998 | ((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"), | 1033 | ((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"), |
| 999 | all->par.physbase, all->par.board_type, all->par.dac_rev); | 1034 | all->par.physbase, all->par.board_type, |
| 1035 | dac_pnum, dac_rev, dac_mrev); | ||
| 1000 | 1036 | ||
| 1001 | return 0; | 1037 | return 0; |
| 1002 | } | 1038 | } |
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index 1d1c7c624d7f..d7ece8d17a2c 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
| @@ -285,8 +285,6 @@ static const struct riva_regs reg_template = { | |||
| 285 | #define MAX_LEVEL 0x534 | 285 | #define MAX_LEVEL 0x534 |
| 286 | #define LEVEL_STEP ((MAX_LEVEL - MIN_LEVEL) / FB_BACKLIGHT_MAX) | 286 | #define LEVEL_STEP ((MAX_LEVEL - MIN_LEVEL) / FB_BACKLIGHT_MAX) |
| 287 | 287 | ||
| 288 | static struct backlight_properties riva_bl_data; | ||
| 289 | |||
| 290 | static int riva_bl_get_level_brightness(struct riva_par *par, | 288 | static int riva_bl_get_level_brightness(struct riva_par *par, |
| 291 | int level) | 289 | int level) |
| 292 | { | 290 | { |
| @@ -372,7 +370,7 @@ static void riva_bl_init(struct riva_par *par) | |||
| 372 | FB_BACKLIGHT_MAX); | 370 | FB_BACKLIGHT_MAX); |
| 373 | 371 | ||
| 374 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | 372 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; |
| 375 | bd->props.brightness = riva_bl_data.max_brightness; | 373 | bd->props.brightness = bd->props.max_brightness; |
| 376 | bd->props.power = FB_BLANK_UNBLANK; | 374 | bd->props.power = FB_BLANK_UNBLANK; |
| 377 | backlight_update_status(bd); | 375 | backlight_update_status(bd); |
| 378 | 376 | ||
diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c index 98919a6975f0..3091b20124b4 100644 --- a/drivers/video/s3fb.c +++ b/drivers/video/s3fb.c | |||
| @@ -1000,11 +1000,12 @@ err_enable_device: | |||
| 1000 | static void __devexit s3_pci_remove(struct pci_dev *dev) | 1000 | static void __devexit s3_pci_remove(struct pci_dev *dev) |
| 1001 | { | 1001 | { |
| 1002 | struct fb_info *info = pci_get_drvdata(dev); | 1002 | struct fb_info *info = pci_get_drvdata(dev); |
| 1003 | struct s3fb_info *par = info->par; | ||
| 1004 | 1003 | ||
| 1005 | if (info) { | 1004 | if (info) { |
| 1006 | 1005 | ||
| 1007 | #ifdef CONFIG_MTRR | 1006 | #ifdef CONFIG_MTRR |
| 1007 | struct s3fb_info *par = info->par; | ||
| 1008 | |||
| 1008 | if (par->mtrr_reg >= 0) { | 1009 | if (par->mtrr_reg >= 0) { |
| 1009 | mtrr_del(par->mtrr_reg, 0, 0); | 1010 | mtrr_del(par->mtrr_reg, 0, 0); |
| 1010 | par->mtrr_reg = -1; | 1011 | par->mtrr_reg = -1; |
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index 4afa30522fdb..0166ec2ccf32 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
| @@ -384,6 +384,19 @@ SavageSetup2DEngine(struct savagefb_par *par) | |||
| 384 | BCI_SEND(0); | 384 | BCI_SEND(0); |
| 385 | BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD2); | 385 | BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD2); |
| 386 | BCI_SEND(GlobalBitmapDescriptor); | 386 | BCI_SEND(GlobalBitmapDescriptor); |
| 387 | |||
| 388 | /* | ||
| 389 | * I don't know why, sending this twice fixes the intial black screen, | ||
| 390 | * prevents X from crashing at least in Toshiba laptops with SavageIX. | ||
| 391 | * --Tony | ||
| 392 | */ | ||
| 393 | par->bci_ptr = 0; | ||
| 394 | par->SavageWaitFifo(par, 4); | ||
| 395 | |||
| 396 | BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD1); | ||
| 397 | BCI_SEND(0); | ||
| 398 | BCI_SEND(BCI_CMD_SETREG | (1 << 16) | BCI_GBD2); | ||
| 399 | BCI_SEND(GlobalBitmapDescriptor); | ||
| 387 | } | 400 | } |
| 388 | 401 | ||
| 389 | static void savagefb_set_clip(struct fb_info *info) | 402 | static void savagefb_set_clip(struct fb_info *info) |
| @@ -496,7 +509,7 @@ static int common_calc_clock(long freq, int min_m, int min_n1, int max_n1, | |||
| 496 | #ifdef SAVAGEFB_DEBUG | 509 | #ifdef SAVAGEFB_DEBUG |
| 497 | /* This function is used to debug, it prints out the contents of s3 regs */ | 510 | /* This function is used to debug, it prints out the contents of s3 regs */ |
| 498 | 511 | ||
| 499 | static void SavagePrintRegs(void) | 512 | static void SavagePrintRegs(struct savagefb_par *par) |
| 500 | { | 513 | { |
| 501 | unsigned char i; | 514 | unsigned char i; |
| 502 | int vgaCRIndex = 0x3d4; | 515 | int vgaCRIndex = 0x3d4; |
| @@ -1525,7 +1538,7 @@ static int savagefb_set_par(struct fb_info *info) | |||
| 1525 | savagefb_set_fix(info); | 1538 | savagefb_set_fix(info); |
| 1526 | savagefb_set_clip(info); | 1539 | savagefb_set_clip(info); |
| 1527 | 1540 | ||
| 1528 | SavagePrintRegs(); | 1541 | SavagePrintRegs(par); |
| 1529 | return 0; | 1542 | return 0; |
| 1530 | } | 1543 | } |
| 1531 | 1544 | ||
| @@ -2155,7 +2168,6 @@ static int __devinit savagefb_probe(struct pci_dev* dev, | |||
| 2155 | int video_len; | 2168 | int video_len; |
| 2156 | 2169 | ||
| 2157 | DBG("savagefb_probe"); | 2170 | DBG("savagefb_probe"); |
| 2158 | SavagePrintRegs(); | ||
| 2159 | 2171 | ||
| 2160 | info = framebuffer_alloc(sizeof(struct savagefb_par), &dev->dev); | 2172 | info = framebuffer_alloc(sizeof(struct savagefb_par), &dev->dev); |
| 2161 | if (!info) | 2173 | if (!info) |
diff --git a/drivers/video/sstfb.c b/drivers/video/sstfb.c index 59cd1e750f30..62fa5500361d 100644 --- a/drivers/video/sstfb.c +++ b/drivers/video/sstfb.c | |||
| @@ -257,6 +257,7 @@ static void __sst_dac_write(u8 __iomem *vbase, u8 reg, u8 val) | |||
| 257 | r_dprintk("sst_dac_write(%#x, %#x)\n", reg, val); | 257 | r_dprintk("sst_dac_write(%#x, %#x)\n", reg, val); |
| 258 | reg &= 0x07; | 258 | reg &= 0x07; |
| 259 | __sst_write(vbase, DAC_DATA,(((u32)reg << 8)) | (u32)val); | 259 | __sst_write(vbase, DAC_DATA,(((u32)reg << 8)) | (u32)val); |
| 260 | __sst_wait_idle(vbase); | ||
| 260 | } | 261 | } |
| 261 | 262 | ||
| 262 | /* indexed access to ti/att dacs */ | 263 | /* indexed access to ti/att dacs */ |
