diff options
author | Jaroslav Kysela <perex@suse.cz> | 2006-02-01 07:08:56 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-02-01 07:08:56 -0500 |
commit | 847b9d01474f710e7a018186917d05e59e258309 (patch) | |
tree | c0da8777ce350c4b048aa6ed2c41fdd109c42e92 /drivers | |
parent | d1d051b28e9d3c3bed0bd15a2b49df3d04f7768f (diff) | |
parent | a6df590dd8b7644c8e298e3b13442bcd6ceeb739 (diff) |
Merge with rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'drivers')
187 files changed, 9364 insertions, 4922 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index a05fe5843e6c..f04d864770ad 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -14,7 +14,6 @@ | |||
14 | * -- special case some senses, e.g. 3a/0 -> no media present, reduce retries | 14 | * -- special case some senses, e.g. 3a/0 -> no media present, reduce retries |
15 | * -- verify the 13 conditions and do bulk resets | 15 | * -- verify the 13 conditions and do bulk resets |
16 | * -- kill last_pipe and simply do two-state clearing on both pipes | 16 | * -- kill last_pipe and simply do two-state clearing on both pipes |
17 | * -- verify protocol (bulk) from USB descriptors (maybe...) | ||
18 | * -- highmem | 17 | * -- highmem |
19 | * -- move top_sense and work_bcs into separate allocations (if they survive) | 18 | * -- move top_sense and work_bcs into separate allocations (if they survive) |
20 | * for cache purists and esoteric architectures. | 19 | * for cache purists and esoteric architectures. |
@@ -355,7 +354,7 @@ struct ub_lun { | |||
355 | * The USB device instance. | 354 | * The USB device instance. |
356 | */ | 355 | */ |
357 | struct ub_dev { | 356 | struct ub_dev { |
358 | spinlock_t lock; | 357 | spinlock_t *lock; |
359 | atomic_t poison; /* The USB device is disconnected */ | 358 | atomic_t poison; /* The USB device is disconnected */ |
360 | int openc; /* protected by ub_lock! */ | 359 | int openc; /* protected by ub_lock! */ |
361 | /* kref is too implicit for our taste */ | 360 | /* kref is too implicit for our taste */ |
@@ -420,11 +419,13 @@ static void ub_state_sense(struct ub_dev *sc, struct ub_scsi_cmd *cmd); | |||
420 | static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd, | 419 | static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd, |
421 | int stalled_pipe); | 420 | int stalled_pipe); |
422 | static void ub_top_sense_done(struct ub_dev *sc, struct ub_scsi_cmd *scmd); | 421 | static void ub_top_sense_done(struct ub_dev *sc, struct ub_scsi_cmd *scmd); |
423 | static void ub_reset_enter(struct ub_dev *sc); | 422 | static void ub_reset_enter(struct ub_dev *sc, int try); |
424 | static void ub_reset_task(void *arg); | 423 | static void ub_reset_task(void *arg); |
425 | static int ub_sync_tur(struct ub_dev *sc, struct ub_lun *lun); | 424 | static int ub_sync_tur(struct ub_dev *sc, struct ub_lun *lun); |
426 | static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun, | 425 | static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun, |
427 | struct ub_capacity *ret); | 426 | struct ub_capacity *ret); |
427 | static int ub_sync_reset(struct ub_dev *sc); | ||
428 | static int ub_probe_clear_stall(struct ub_dev *sc, int stalled_pipe); | ||
428 | static int ub_probe_lun(struct ub_dev *sc, int lnum); | 429 | static int ub_probe_lun(struct ub_dev *sc, int lnum); |
429 | 430 | ||
430 | /* | 431 | /* |
@@ -452,6 +453,10 @@ MODULE_DEVICE_TABLE(usb, ub_usb_ids); | |||
452 | #define UB_MAX_HOSTS 26 | 453 | #define UB_MAX_HOSTS 26 |
453 | static char ub_hostv[UB_MAX_HOSTS]; | 454 | static char ub_hostv[UB_MAX_HOSTS]; |
454 | 455 | ||
456 | #define UB_QLOCK_NUM 5 | ||
457 | static spinlock_t ub_qlockv[UB_QLOCK_NUM]; | ||
458 | static int ub_qlock_next = 0; | ||
459 | |||
455 | static DEFINE_SPINLOCK(ub_lock); /* Locks globals and ->openc */ | 460 | static DEFINE_SPINLOCK(ub_lock); /* Locks globals and ->openc */ |
456 | 461 | ||
457 | /* | 462 | /* |
@@ -531,7 +536,7 @@ static ssize_t ub_diag_show(struct device *dev, struct device_attribute *attr, | |||
531 | return 0; | 536 | return 0; |
532 | 537 | ||
533 | cnt = 0; | 538 | cnt = 0; |
534 | spin_lock_irqsave(&sc->lock, flags); | 539 | spin_lock_irqsave(sc->lock, flags); |
535 | 540 | ||
536 | cnt += sprintf(page + cnt, | 541 | cnt += sprintf(page + cnt, |
537 | "poison %d reset %d\n", | 542 | "poison %d reset %d\n", |
@@ -579,7 +584,7 @@ static ssize_t ub_diag_show(struct device *dev, struct device_attribute *attr, | |||
579 | if (++nc == SCMD_TRACE_SZ) nc = 0; | 584 | if (++nc == SCMD_TRACE_SZ) nc = 0; |
580 | } | 585 | } |
581 | 586 | ||
582 | spin_unlock_irqrestore(&sc->lock, flags); | 587 | spin_unlock_irqrestore(sc->lock, flags); |
583 | return cnt; | 588 | return cnt; |
584 | } | 589 | } |
585 | 590 | ||
@@ -627,6 +632,24 @@ static void ub_id_put(int id) | |||
627 | } | 632 | } |
628 | 633 | ||
629 | /* | 634 | /* |
635 | * This is necessitated by the fact that blk_cleanup_queue does not | ||
636 | * necesserily destroy the queue. Instead, it may merely decrease q->refcnt. | ||
637 | * Since our blk_init_queue() passes a spinlock common with ub_dev, | ||
638 | * we have life time issues when ub_cleanup frees ub_dev. | ||
639 | */ | ||
640 | static spinlock_t *ub_next_lock(void) | ||
641 | { | ||
642 | unsigned long flags; | ||
643 | spinlock_t *ret; | ||
644 | |||
645 | spin_lock_irqsave(&ub_lock, flags); | ||
646 | ret = &ub_qlockv[ub_qlock_next]; | ||
647 | ub_qlock_next = (ub_qlock_next + 1) % UB_QLOCK_NUM; | ||
648 | spin_unlock_irqrestore(&ub_lock, flags); | ||
649 | return ret; | ||
650 | } | ||
651 | |||
652 | /* | ||
630 | * Downcount for deallocation. This rides on two assumptions: | 653 | * Downcount for deallocation. This rides on two assumptions: |
631 | * - once something is poisoned, its refcount cannot grow | 654 | * - once something is poisoned, its refcount cannot grow |
632 | * - opens cannot happen at this time (del_gendisk was done) | 655 | * - opens cannot happen at this time (del_gendisk was done) |
@@ -961,7 +984,7 @@ static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, | |||
961 | if (atomic_read(&sc->poison)) | 984 | if (atomic_read(&sc->poison)) |
962 | return -ENXIO; | 985 | return -ENXIO; |
963 | 986 | ||
964 | ub_reset_enter(sc); | 987 | ub_reset_enter(sc, urq->current_try); |
965 | 988 | ||
966 | if (urq->current_try >= 3) | 989 | if (urq->current_try >= 3) |
967 | return -EIO; | 990 | return -EIO; |
@@ -997,8 +1020,6 @@ static int ub_rw_cmd_retry(struct ub_dev *sc, struct ub_lun *lun, | |||
997 | * No exceptions. | 1020 | * No exceptions. |
998 | * | 1021 | * |
999 | * Host is assumed locked. | 1022 | * Host is assumed locked. |
1000 | * | ||
1001 | * XXX We only support Bulk for the moment. | ||
1002 | */ | 1023 | */ |
1003 | static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | 1024 | static int ub_submit_scsi(struct ub_dev *sc, struct ub_scsi_cmd *cmd) |
1004 | { | 1025 | { |
@@ -1083,9 +1104,10 @@ static void ub_urb_timeout(unsigned long arg) | |||
1083 | struct ub_dev *sc = (struct ub_dev *) arg; | 1104 | struct ub_dev *sc = (struct ub_dev *) arg; |
1084 | unsigned long flags; | 1105 | unsigned long flags; |
1085 | 1106 | ||
1086 | spin_lock_irqsave(&sc->lock, flags); | 1107 | spin_lock_irqsave(sc->lock, flags); |
1087 | usb_unlink_urb(&sc->work_urb); | 1108 | if (!ub_is_completed(&sc->work_done)) |
1088 | spin_unlock_irqrestore(&sc->lock, flags); | 1109 | usb_unlink_urb(&sc->work_urb); |
1110 | spin_unlock_irqrestore(sc->lock, flags); | ||
1089 | } | 1111 | } |
1090 | 1112 | ||
1091 | /* | 1113 | /* |
@@ -1108,10 +1130,9 @@ static void ub_scsi_action(unsigned long _dev) | |||
1108 | struct ub_dev *sc = (struct ub_dev *) _dev; | 1130 | struct ub_dev *sc = (struct ub_dev *) _dev; |
1109 | unsigned long flags; | 1131 | unsigned long flags; |
1110 | 1132 | ||
1111 | spin_lock_irqsave(&sc->lock, flags); | 1133 | spin_lock_irqsave(sc->lock, flags); |
1112 | del_timer(&sc->work_timer); | ||
1113 | ub_scsi_dispatch(sc); | 1134 | ub_scsi_dispatch(sc); |
1114 | spin_unlock_irqrestore(&sc->lock, flags); | 1135 | spin_unlock_irqrestore(sc->lock, flags); |
1115 | } | 1136 | } |
1116 | 1137 | ||
1117 | static void ub_scsi_dispatch(struct ub_dev *sc) | 1138 | static void ub_scsi_dispatch(struct ub_dev *sc) |
@@ -1133,6 +1154,7 @@ static void ub_scsi_dispatch(struct ub_dev *sc) | |||
1133 | } else { | 1154 | } else { |
1134 | if (!ub_is_completed(&sc->work_done)) | 1155 | if (!ub_is_completed(&sc->work_done)) |
1135 | break; | 1156 | break; |
1157 | del_timer(&sc->work_timer); | ||
1136 | ub_scsi_urb_compl(sc, cmd); | 1158 | ub_scsi_urb_compl(sc, cmd); |
1137 | } | 1159 | } |
1138 | } | 1160 | } |
@@ -1680,16 +1702,18 @@ static void ub_top_sense_done(struct ub_dev *sc, struct ub_scsi_cmd *scmd) | |||
1680 | 1702 | ||
1681 | /* | 1703 | /* |
1682 | * Reset management | 1704 | * Reset management |
1705 | * XXX Move usb_reset_device to khubd. Hogging kevent is not a good thing. | ||
1706 | * XXX Make usb_sync_reset asynchronous. | ||
1683 | */ | 1707 | */ |
1684 | 1708 | ||
1685 | static void ub_reset_enter(struct ub_dev *sc) | 1709 | static void ub_reset_enter(struct ub_dev *sc, int try) |
1686 | { | 1710 | { |
1687 | 1711 | ||
1688 | if (sc->reset) { | 1712 | if (sc->reset) { |
1689 | /* This happens often on multi-LUN devices. */ | 1713 | /* This happens often on multi-LUN devices. */ |
1690 | return; | 1714 | return; |
1691 | } | 1715 | } |
1692 | sc->reset = 1; | 1716 | sc->reset = try + 1; |
1693 | 1717 | ||
1694 | #if 0 /* Not needed because the disconnect waits for us. */ | 1718 | #if 0 /* Not needed because the disconnect waits for us. */ |
1695 | unsigned long flags; | 1719 | unsigned long flags; |
@@ -1727,6 +1751,11 @@ static void ub_reset_task(void *arg) | |||
1727 | if (atomic_read(&sc->poison)) { | 1751 | if (atomic_read(&sc->poison)) { |
1728 | printk(KERN_NOTICE "%s: Not resetting disconnected device\n", | 1752 | printk(KERN_NOTICE "%s: Not resetting disconnected device\n", |
1729 | sc->name); /* P3 This floods. Remove soon. XXX */ | 1753 | sc->name); /* P3 This floods. Remove soon. XXX */ |
1754 | } else if ((sc->reset & 1) == 0) { | ||
1755 | ub_sync_reset(sc); | ||
1756 | msleep(700); /* usb-storage sleeps 6s (!) */ | ||
1757 | ub_probe_clear_stall(sc, sc->recv_bulk_pipe); | ||
1758 | ub_probe_clear_stall(sc, sc->send_bulk_pipe); | ||
1730 | } else if (sc->dev->actconfig->desc.bNumInterfaces != 1) { | 1759 | } else if (sc->dev->actconfig->desc.bNumInterfaces != 1) { |
1731 | printk(KERN_NOTICE "%s: Not resetting multi-interface device\n", | 1760 | printk(KERN_NOTICE "%s: Not resetting multi-interface device\n", |
1732 | sc->name); /* P3 This floods. Remove soon. XXX */ | 1761 | sc->name); /* P3 This floods. Remove soon. XXX */ |
@@ -1754,7 +1783,7 @@ static void ub_reset_task(void *arg) | |||
1754 | * queues of resets or anything. We do need a spinlock though, | 1783 | * queues of resets or anything. We do need a spinlock though, |
1755 | * to interact with block layer. | 1784 | * to interact with block layer. |
1756 | */ | 1785 | */ |
1757 | spin_lock_irqsave(&sc->lock, flags); | 1786 | spin_lock_irqsave(sc->lock, flags); |
1758 | sc->reset = 0; | 1787 | sc->reset = 0; |
1759 | tasklet_schedule(&sc->tasklet); | 1788 | tasklet_schedule(&sc->tasklet); |
1760 | list_for_each(p, &sc->luns) { | 1789 | list_for_each(p, &sc->luns) { |
@@ -1762,7 +1791,7 @@ static void ub_reset_task(void *arg) | |||
1762 | blk_start_queue(lun->disk->queue); | 1791 | blk_start_queue(lun->disk->queue); |
1763 | } | 1792 | } |
1764 | wake_up(&sc->reset_wait); | 1793 | wake_up(&sc->reset_wait); |
1765 | spin_unlock_irqrestore(&sc->lock, flags); | 1794 | spin_unlock_irqrestore(sc->lock, flags); |
1766 | } | 1795 | } |
1767 | 1796 | ||
1768 | /* | 1797 | /* |
@@ -1990,11 +2019,11 @@ static int ub_sync_tur(struct ub_dev *sc, struct ub_lun *lun) | |||
1990 | cmd->done = ub_probe_done; | 2019 | cmd->done = ub_probe_done; |
1991 | cmd->back = &compl; | 2020 | cmd->back = &compl; |
1992 | 2021 | ||
1993 | spin_lock_irqsave(&sc->lock, flags); | 2022 | spin_lock_irqsave(sc->lock, flags); |
1994 | cmd->tag = sc->tagcnt++; | 2023 | cmd->tag = sc->tagcnt++; |
1995 | 2024 | ||
1996 | rc = ub_submit_scsi(sc, cmd); | 2025 | rc = ub_submit_scsi(sc, cmd); |
1997 | spin_unlock_irqrestore(&sc->lock, flags); | 2026 | spin_unlock_irqrestore(sc->lock, flags); |
1998 | 2027 | ||
1999 | if (rc != 0) { | 2028 | if (rc != 0) { |
2000 | printk("ub: testing ready: submit error (%d)\n", rc); /* P3 */ | 2029 | printk("ub: testing ready: submit error (%d)\n", rc); /* P3 */ |
@@ -2052,11 +2081,11 @@ static int ub_sync_read_cap(struct ub_dev *sc, struct ub_lun *lun, | |||
2052 | cmd->done = ub_probe_done; | 2081 | cmd->done = ub_probe_done; |
2053 | cmd->back = &compl; | 2082 | cmd->back = &compl; |
2054 | 2083 | ||
2055 | spin_lock_irqsave(&sc->lock, flags); | 2084 | spin_lock_irqsave(sc->lock, flags); |
2056 | cmd->tag = sc->tagcnt++; | 2085 | cmd->tag = sc->tagcnt++; |
2057 | 2086 | ||
2058 | rc = ub_submit_scsi(sc, cmd); | 2087 | rc = ub_submit_scsi(sc, cmd); |
2059 | spin_unlock_irqrestore(&sc->lock, flags); | 2088 | spin_unlock_irqrestore(sc->lock, flags); |
2060 | 2089 | ||
2061 | if (rc != 0) { | 2090 | if (rc != 0) { |
2062 | printk("ub: reading capacity: submit error (%d)\n", rc); /* P3 */ | 2091 | printk("ub: reading capacity: submit error (%d)\n", rc); /* P3 */ |
@@ -2118,6 +2147,52 @@ static void ub_probe_timeout(unsigned long arg) | |||
2118 | } | 2147 | } |
2119 | 2148 | ||
2120 | /* | 2149 | /* |
2150 | * Reset with a Bulk reset. | ||
2151 | */ | ||
2152 | static int ub_sync_reset(struct ub_dev *sc) | ||
2153 | { | ||
2154 | int ifnum = sc->intf->cur_altsetting->desc.bInterfaceNumber; | ||
2155 | struct usb_ctrlrequest *cr; | ||
2156 | struct completion compl; | ||
2157 | struct timer_list timer; | ||
2158 | int rc; | ||
2159 | |||
2160 | init_completion(&compl); | ||
2161 | |||
2162 | cr = &sc->work_cr; | ||
2163 | cr->bRequestType = USB_TYPE_CLASS | USB_RECIP_INTERFACE; | ||
2164 | cr->bRequest = US_BULK_RESET_REQUEST; | ||
2165 | cr->wValue = cpu_to_le16(0); | ||
2166 | cr->wIndex = cpu_to_le16(ifnum); | ||
2167 | cr->wLength = cpu_to_le16(0); | ||
2168 | |||
2169 | usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, | ||
2170 | (unsigned char*) cr, NULL, 0, ub_probe_urb_complete, &compl); | ||
2171 | sc->work_urb.actual_length = 0; | ||
2172 | sc->work_urb.error_count = 0; | ||
2173 | sc->work_urb.status = 0; | ||
2174 | |||
2175 | if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) { | ||
2176 | printk(KERN_WARNING | ||
2177 | "%s: Unable to submit a bulk reset (%d)\n", sc->name, rc); | ||
2178 | return rc; | ||
2179 | } | ||
2180 | |||
2181 | init_timer(&timer); | ||
2182 | timer.function = ub_probe_timeout; | ||
2183 | timer.data = (unsigned long) &compl; | ||
2184 | timer.expires = jiffies + UB_CTRL_TIMEOUT; | ||
2185 | add_timer(&timer); | ||
2186 | |||
2187 | wait_for_completion(&compl); | ||
2188 | |||
2189 | del_timer_sync(&timer); | ||
2190 | usb_kill_urb(&sc->work_urb); | ||
2191 | |||
2192 | return sc->work_urb.status; | ||
2193 | } | ||
2194 | |||
2195 | /* | ||
2121 | * Get number of LUNs by the way of Bulk GetMaxLUN command. | 2196 | * Get number of LUNs by the way of Bulk GetMaxLUN command. |
2122 | */ | 2197 | */ |
2123 | static int ub_sync_getmaxlun(struct ub_dev *sc) | 2198 | static int ub_sync_getmaxlun(struct ub_dev *sc) |
@@ -2333,7 +2408,7 @@ static int ub_probe(struct usb_interface *intf, | |||
2333 | if ((sc = kmalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL) | 2408 | if ((sc = kmalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL) |
2334 | goto err_core; | 2409 | goto err_core; |
2335 | memset(sc, 0, sizeof(struct ub_dev)); | 2410 | memset(sc, 0, sizeof(struct ub_dev)); |
2336 | spin_lock_init(&sc->lock); | 2411 | sc->lock = ub_next_lock(); |
2337 | INIT_LIST_HEAD(&sc->luns); | 2412 | INIT_LIST_HEAD(&sc->luns); |
2338 | usb_init_urb(&sc->work_urb); | 2413 | usb_init_urb(&sc->work_urb); |
2339 | tasklet_init(&sc->tasklet, ub_scsi_action, (unsigned long)sc); | 2414 | tasklet_init(&sc->tasklet, ub_scsi_action, (unsigned long)sc); |
@@ -2483,7 +2558,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) | |||
2483 | disk->driverfs_dev = &sc->intf->dev; | 2558 | disk->driverfs_dev = &sc->intf->dev; |
2484 | 2559 | ||
2485 | rc = -ENOMEM; | 2560 | rc = -ENOMEM; |
2486 | if ((q = blk_init_queue(ub_request_fn, &sc->lock)) == NULL) | 2561 | if ((q = blk_init_queue(ub_request_fn, sc->lock)) == NULL) |
2487 | goto err_blkqinit; | 2562 | goto err_blkqinit; |
2488 | 2563 | ||
2489 | disk->queue = q; | 2564 | disk->queue = q; |
@@ -2554,7 +2629,7 @@ static void ub_disconnect(struct usb_interface *intf) | |||
2554 | * and the whole queue drains. So, we just use this code to | 2629 | * and the whole queue drains. So, we just use this code to |
2555 | * print warnings. | 2630 | * print warnings. |
2556 | */ | 2631 | */ |
2557 | spin_lock_irqsave(&sc->lock, flags); | 2632 | spin_lock_irqsave(sc->lock, flags); |
2558 | { | 2633 | { |
2559 | struct ub_scsi_cmd *cmd; | 2634 | struct ub_scsi_cmd *cmd; |
2560 | int cnt = 0; | 2635 | int cnt = 0; |
@@ -2571,7 +2646,7 @@ static void ub_disconnect(struct usb_interface *intf) | |||
2571 | "%d was queued after shutdown\n", sc->name, cnt); | 2646 | "%d was queued after shutdown\n", sc->name, cnt); |
2572 | } | 2647 | } |
2573 | } | 2648 | } |
2574 | spin_unlock_irqrestore(&sc->lock, flags); | 2649 | spin_unlock_irqrestore(sc->lock, flags); |
2575 | 2650 | ||
2576 | /* | 2651 | /* |
2577 | * Unregister the upper layer. | 2652 | * Unregister the upper layer. |
@@ -2590,19 +2665,15 @@ static void ub_disconnect(struct usb_interface *intf) | |||
2590 | } | 2665 | } |
2591 | 2666 | ||
2592 | /* | 2667 | /* |
2593 | * Taking a lock on a structure which is about to be freed | ||
2594 | * is very nonsensual. Here it is largely a way to do a debug freeze, | ||
2595 | * and a bracket which shows where the nonsensual code segment ends. | ||
2596 | * | ||
2597 | * Testing for -EINPROGRESS is always a bug, so we are bending | 2668 | * Testing for -EINPROGRESS is always a bug, so we are bending |
2598 | * the rules a little. | 2669 | * the rules a little. |
2599 | */ | 2670 | */ |
2600 | spin_lock_irqsave(&sc->lock, flags); | 2671 | spin_lock_irqsave(sc->lock, flags); |
2601 | if (sc->work_urb.status == -EINPROGRESS) { /* janitors: ignore */ | 2672 | if (sc->work_urb.status == -EINPROGRESS) { /* janitors: ignore */ |
2602 | printk(KERN_WARNING "%s: " | 2673 | printk(KERN_WARNING "%s: " |
2603 | "URB is active after disconnect\n", sc->name); | 2674 | "URB is active after disconnect\n", sc->name); |
2604 | } | 2675 | } |
2605 | spin_unlock_irqrestore(&sc->lock, flags); | 2676 | spin_unlock_irqrestore(sc->lock, flags); |
2606 | 2677 | ||
2607 | /* | 2678 | /* |
2608 | * There is virtually no chance that other CPU runs times so long | 2679 | * There is virtually no chance that other CPU runs times so long |
@@ -2636,6 +2707,10 @@ static struct usb_driver ub_driver = { | |||
2636 | static int __init ub_init(void) | 2707 | static int __init ub_init(void) |
2637 | { | 2708 | { |
2638 | int rc; | 2709 | int rc; |
2710 | int i; | ||
2711 | |||
2712 | for (i = 0; i < UB_QLOCK_NUM; i++) | ||
2713 | spin_lock_init(&ub_qlockv[i]); | ||
2639 | 2714 | ||
2640 | if ((rc = register_blkdev(UB_MAJOR, DRV_NAME)) != 0) | 2715 | if ((rc = register_blkdev(UB_MAJOR, DRV_NAME)) != 0) |
2641 | goto err_regblkdev; | 2716 | goto err_regblkdev; |
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 810679dcbbb0..9964c508c111 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -600,6 +600,26 @@ static void __devexit agp_amd64_remove(struct pci_dev *pdev) | |||
600 | agp_put_bridge(bridge); | 600 | agp_put_bridge(bridge); |
601 | } | 601 | } |
602 | 602 | ||
603 | #ifdef CONFIG_PM | ||
604 | |||
605 | static int agp_amd64_suspend(struct pci_dev *pdev, pm_message_t state) | ||
606 | { | ||
607 | pci_save_state(pdev); | ||
608 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
609 | |||
610 | return 0; | ||
611 | } | ||
612 | |||
613 | static int agp_amd64_resume(struct pci_dev *pdev) | ||
614 | { | ||
615 | pci_set_power_state(pdev, PCI_D0); | ||
616 | pci_restore_state(pdev); | ||
617 | |||
618 | return amd_8151_configure(); | ||
619 | } | ||
620 | |||
621 | #endif /* CONFIG_PM */ | ||
622 | |||
603 | static struct pci_device_id agp_amd64_pci_table[] = { | 623 | static struct pci_device_id agp_amd64_pci_table[] = { |
604 | { | 624 | { |
605 | .class = (PCI_CLASS_BRIDGE_HOST << 8), | 625 | .class = (PCI_CLASS_BRIDGE_HOST << 8), |
@@ -718,6 +738,10 @@ static struct pci_driver agp_amd64_pci_driver = { | |||
718 | .id_table = agp_amd64_pci_table, | 738 | .id_table = agp_amd64_pci_table, |
719 | .probe = agp_amd64_probe, | 739 | .probe = agp_amd64_probe, |
720 | .remove = agp_amd64_remove, | 740 | .remove = agp_amd64_remove, |
741 | #ifdef CONFIG_PM | ||
742 | .suspend = agp_amd64_suspend, | ||
743 | .resume = agp_amd64_resume, | ||
744 | #endif | ||
721 | }; | 745 | }; |
722 | 746 | ||
723 | 747 | ||
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c index 53372a83b675..5b74c36c116c 100644 --- a/drivers/char/agp/ati-agp.c +++ b/drivers/char/agp/ati-agp.c | |||
@@ -244,6 +244,22 @@ static int ati_configure(void) | |||
244 | } | 244 | } |
245 | 245 | ||
246 | 246 | ||
247 | #ifdef CONFIG_PM | ||
248 | static int agp_ati_resume(struct pci_dev *dev) | ||
249 | { | ||
250 | pci_restore_state(dev); | ||
251 | |||
252 | return ati_configure(); | ||
253 | } | ||
254 | |||
255 | static int agp_ati_suspend(struct pci_dev *dev, pm_message_t state) | ||
256 | { | ||
257 | pci_save_state(dev); | ||
258 | |||
259 | return 0; | ||
260 | } | ||
261 | #endif | ||
262 | |||
247 | /* | 263 | /* |
248 | *Since we don't need contigious memory we just try | 264 | *Since we don't need contigious memory we just try |
249 | * to get the gatt table once | 265 | * to get the gatt table once |
@@ -525,6 +541,10 @@ static struct pci_driver agp_ati_pci_driver = { | |||
525 | .id_table = agp_ati_pci_table, | 541 | .id_table = agp_ati_pci_table, |
526 | .probe = agp_ati_probe, | 542 | .probe = agp_ati_probe, |
527 | .remove = agp_ati_remove, | 543 | .remove = agp_ati_remove, |
544 | #ifdef CONFIG_PM | ||
545 | .resume = agp_ati_resume, | ||
546 | .suspend = agp_ati_suspend, | ||
547 | #endif | ||
528 | }; | 548 | }; |
529 | 549 | ||
530 | static int __init agp_ati_init(void) | 550 | static int __init agp_ati_init(void) |
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index 17f520c9d471..97eeb2345b18 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -592,7 +592,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) | |||
592 | struct agp_file_private *priv = file->private_data; | 592 | struct agp_file_private *priv = file->private_data; |
593 | struct agp_kern_info kerninfo; | 593 | struct agp_kern_info kerninfo; |
594 | 594 | ||
595 | down(&(agp_fe.agp_mutex)); | 595 | mutex_lock(&(agp_fe.agp_mutex)); |
596 | 596 | ||
597 | if (agp_fe.backend_acquired != TRUE) | 597 | if (agp_fe.backend_acquired != TRUE) |
598 | goto out_eperm; | 598 | goto out_eperm; |
@@ -627,7 +627,7 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) | |||
627 | size, vma->vm_page_prot)) { | 627 | size, vma->vm_page_prot)) { |
628 | goto out_again; | 628 | goto out_again; |
629 | } | 629 | } |
630 | up(&(agp_fe.agp_mutex)); | 630 | mutex_unlock(&(agp_fe.agp_mutex)); |
631 | return 0; | 631 | return 0; |
632 | } | 632 | } |
633 | 633 | ||
@@ -643,20 +643,20 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma) | |||
643 | size, vma->vm_page_prot)) { | 643 | size, vma->vm_page_prot)) { |
644 | goto out_again; | 644 | goto out_again; |
645 | } | 645 | } |
646 | up(&(agp_fe.agp_mutex)); | 646 | mutex_unlock(&(agp_fe.agp_mutex)); |
647 | return 0; | 647 | return 0; |
648 | } | 648 | } |
649 | 649 | ||
650 | out_eperm: | 650 | out_eperm: |
651 | up(&(agp_fe.agp_mutex)); | 651 | mutex_unlock(&(agp_fe.agp_mutex)); |
652 | return -EPERM; | 652 | return -EPERM; |
653 | 653 | ||
654 | out_inval: | 654 | out_inval: |
655 | up(&(agp_fe.agp_mutex)); | 655 | mutex_unlock(&(agp_fe.agp_mutex)); |
656 | return -EINVAL; | 656 | return -EINVAL; |
657 | 657 | ||
658 | out_again: | 658 | out_again: |
659 | up(&(agp_fe.agp_mutex)); | 659 | mutex_unlock(&(agp_fe.agp_mutex)); |
660 | return -EAGAIN; | 660 | return -EAGAIN; |
661 | } | 661 | } |
662 | 662 | ||
@@ -664,7 +664,7 @@ static int agp_release(struct inode *inode, struct file *file) | |||
664 | { | 664 | { |
665 | struct agp_file_private *priv = file->private_data; | 665 | struct agp_file_private *priv = file->private_data; |
666 | 666 | ||
667 | down(&(agp_fe.agp_mutex)); | 667 | mutex_lock(&(agp_fe.agp_mutex)); |
668 | 668 | ||
669 | DBG("priv=%p", priv); | 669 | DBG("priv=%p", priv); |
670 | 670 | ||
@@ -687,7 +687,7 @@ static int agp_release(struct inode *inode, struct file *file) | |||
687 | agp_remove_file_private(priv); | 687 | agp_remove_file_private(priv); |
688 | kfree(priv); | 688 | kfree(priv); |
689 | file->private_data = NULL; | 689 | file->private_data = NULL; |
690 | up(&(agp_fe.agp_mutex)); | 690 | mutex_unlock(&(agp_fe.agp_mutex)); |
691 | return 0; | 691 | return 0; |
692 | } | 692 | } |
693 | 693 | ||
@@ -698,7 +698,7 @@ static int agp_open(struct inode *inode, struct file *file) | |||
698 | struct agp_client *client; | 698 | struct agp_client *client; |
699 | int rc = -ENXIO; | 699 | int rc = -ENXIO; |
700 | 700 | ||
701 | down(&(agp_fe.agp_mutex)); | 701 | mutex_lock(&(agp_fe.agp_mutex)); |
702 | 702 | ||
703 | if (minor != AGPGART_MINOR) | 703 | if (minor != AGPGART_MINOR) |
704 | goto err_out; | 704 | goto err_out; |
@@ -723,13 +723,13 @@ static int agp_open(struct inode *inode, struct file *file) | |||
723 | file->private_data = (void *) priv; | 723 | file->private_data = (void *) priv; |
724 | agp_insert_file_private(priv); | 724 | agp_insert_file_private(priv); |
725 | DBG("private=%p, client=%p", priv, client); | 725 | DBG("private=%p, client=%p", priv, client); |
726 | up(&(agp_fe.agp_mutex)); | 726 | mutex_unlock(&(agp_fe.agp_mutex)); |
727 | return 0; | 727 | return 0; |
728 | 728 | ||
729 | err_out_nomem: | 729 | err_out_nomem: |
730 | rc = -ENOMEM; | 730 | rc = -ENOMEM; |
731 | err_out: | 731 | err_out: |
732 | up(&(agp_fe.agp_mutex)); | 732 | mutex_unlock(&(agp_fe.agp_mutex)); |
733 | return rc; | 733 | return rc; |
734 | } | 734 | } |
735 | 735 | ||
@@ -985,7 +985,7 @@ static int agp_ioctl(struct inode *inode, struct file *file, | |||
985 | int ret_val = -ENOTTY; | 985 | int ret_val = -ENOTTY; |
986 | 986 | ||
987 | DBG("priv=%p, cmd=%x", curr_priv, cmd); | 987 | DBG("priv=%p, cmd=%x", curr_priv, cmd); |
988 | down(&(agp_fe.agp_mutex)); | 988 | mutex_lock(&(agp_fe.agp_mutex)); |
989 | 989 | ||
990 | if ((agp_fe.current_controller == NULL) && | 990 | if ((agp_fe.current_controller == NULL) && |
991 | (cmd != AGPIOC_ACQUIRE)) { | 991 | (cmd != AGPIOC_ACQUIRE)) { |
@@ -1055,7 +1055,7 @@ static int agp_ioctl(struct inode *inode, struct file *file, | |||
1055 | 1055 | ||
1056 | ioctl_out: | 1056 | ioctl_out: |
1057 | DBG("ioctl returns %d\n", ret_val); | 1057 | DBG("ioctl returns %d\n", ret_val); |
1058 | up(&(agp_fe.agp_mutex)); | 1058 | mutex_unlock(&(agp_fe.agp_mutex)); |
1059 | return ret_val; | 1059 | return ret_val; |
1060 | } | 1060 | } |
1061 | 1061 | ||
@@ -1081,7 +1081,7 @@ static struct miscdevice agp_miscdev = | |||
1081 | int agp_frontend_initialize(void) | 1081 | int agp_frontend_initialize(void) |
1082 | { | 1082 | { |
1083 | memset(&agp_fe, 0, sizeof(struct agp_front_data)); | 1083 | memset(&agp_fe, 0, sizeof(struct agp_front_data)); |
1084 | sema_init(&(agp_fe.agp_mutex), 1); | 1084 | mutex_init(&(agp_fe.agp_mutex)); |
1085 | 1085 | ||
1086 | if (misc_register(&agp_miscdev)) { | 1086 | if (misc_register(&agp_miscdev)) { |
1087 | printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR); | 1087 | printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR); |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index e7bed5047dcc..631531fd97a5 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -422,7 +422,8 @@ static void intel_i830_init_gtt_entries(void) | |||
422 | /* Check it's really I915G */ | 422 | /* Check it's really I915G */ |
423 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || | 423 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || |
424 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || | 424 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || |
425 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB) | 425 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || |
426 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB) | ||
426 | gtt_entries = MB(48) - KB(size); | 427 | gtt_entries = MB(48) - KB(size); |
427 | else | 428 | else |
428 | gtt_entries = 0; | 429 | gtt_entries = 0; |
@@ -431,7 +432,8 @@ static void intel_i830_init_gtt_entries(void) | |||
431 | /* Check it's really I915G */ | 432 | /* Check it's really I915G */ |
432 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || | 433 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || |
433 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || | 434 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || |
434 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB) | 435 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || |
436 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB) | ||
435 | gtt_entries = MB(64) - KB(size); | 437 | gtt_entries = MB(64) - KB(size); |
436 | else | 438 | else |
437 | gtt_entries = 0; | 439 | gtt_entries = 0; |
@@ -1681,6 +1683,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
1681 | } | 1683 | } |
1682 | name = "945G"; | 1684 | name = "945G"; |
1683 | break; | 1685 | break; |
1686 | case PCI_DEVICE_ID_INTEL_82945GM_HB: | ||
1687 | if (find_i830(PCI_DEVICE_ID_INTEL_82945GM_IG)) { | ||
1688 | bridge->driver = &intel_915_driver; | ||
1689 | } else { | ||
1690 | bridge->driver = &intel_845_driver; | ||
1691 | } | ||
1692 | name = "945GM"; | ||
1693 | break; | ||
1684 | case PCI_DEVICE_ID_INTEL_7505_0: | 1694 | case PCI_DEVICE_ID_INTEL_7505_0: |
1685 | bridge->driver = &intel_7505_driver; | 1695 | bridge->driver = &intel_7505_driver; |
1686 | name = "E7505"; | 1696 | name = "E7505"; |
@@ -1821,6 +1831,7 @@ static struct pci_device_id agp_intel_pci_table[] = { | |||
1821 | ID(PCI_DEVICE_ID_INTEL_82915G_HB), | 1831 | ID(PCI_DEVICE_ID_INTEL_82915G_HB), |
1822 | ID(PCI_DEVICE_ID_INTEL_82915GM_HB), | 1832 | ID(PCI_DEVICE_ID_INTEL_82915GM_HB), |
1823 | ID(PCI_DEVICE_ID_INTEL_82945G_HB), | 1833 | ID(PCI_DEVICE_ID_INTEL_82945G_HB), |
1834 | ID(PCI_DEVICE_ID_INTEL_82945GM_HB), | ||
1824 | { } | 1835 | { } |
1825 | }; | 1836 | }; |
1826 | 1837 | ||
diff --git a/drivers/char/agp/isoch.c b/drivers/char/agp/isoch.c index 40083241804e..7c14a096b85e 100644 --- a/drivers/char/agp/isoch.c +++ b/drivers/char/agp/isoch.c | |||
@@ -218,10 +218,8 @@ static int agp_3_5_isochronous_node_enable(struct agp_bridge_data *bridge, | |||
218 | master[cdev].rq *= (1 << (master[cdev].y - 1)); | 218 | master[cdev].rq *= (1 << (master[cdev].y - 1)); |
219 | 219 | ||
220 | tot_rq += master[cdev].rq; | 220 | tot_rq += master[cdev].rq; |
221 | |||
222 | if (cdev == ndevs-1) | ||
223 | master[cdev].n += rem; | ||
224 | } | 221 | } |
222 | master[ndevs-1].n += rem; | ||
225 | 223 | ||
226 | /* Figure the number of isochronous and asynchronous RQ slots the | 224 | /* Figure the number of isochronous and asynchronous RQ slots the |
227 | * target is providing. */ | 225 | * target is providing. */ |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 277a843a87a6..7a511479ae29 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/cpu.h> | 27 | #include <linux/cpu.h> |
28 | #include <linux/completion.h> | 28 | #include <linux/completion.h> |
29 | #include <linux/mutex.h> | ||
29 | 30 | ||
30 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, "cpufreq-core", msg) | 31 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_CORE, "cpufreq-core", msg) |
31 | 32 | ||
@@ -55,7 +56,7 @@ static DECLARE_RWSEM (cpufreq_notifier_rwsem); | |||
55 | 56 | ||
56 | 57 | ||
57 | static LIST_HEAD(cpufreq_governor_list); | 58 | static LIST_HEAD(cpufreq_governor_list); |
58 | static DECLARE_MUTEX (cpufreq_governor_sem); | 59 | static DEFINE_MUTEX (cpufreq_governor_mutex); |
59 | 60 | ||
60 | struct cpufreq_policy * cpufreq_cpu_get(unsigned int cpu) | 61 | struct cpufreq_policy * cpufreq_cpu_get(unsigned int cpu) |
61 | { | 62 | { |
@@ -297,18 +298,18 @@ static int cpufreq_parse_governor (char *str_governor, unsigned int *policy, | |||
297 | return -EINVAL; | 298 | return -EINVAL; |
298 | } else { | 299 | } else { |
299 | struct cpufreq_governor *t; | 300 | struct cpufreq_governor *t; |
300 | down(&cpufreq_governor_sem); | 301 | mutex_lock(&cpufreq_governor_mutex); |
301 | if (!cpufreq_driver || !cpufreq_driver->target) | 302 | if (!cpufreq_driver || !cpufreq_driver->target) |
302 | goto out; | 303 | goto out; |
303 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) { | 304 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) { |
304 | if (!strnicmp(str_governor,t->name,CPUFREQ_NAME_LEN)) { | 305 | if (!strnicmp(str_governor,t->name,CPUFREQ_NAME_LEN)) { |
305 | *governor = t; | 306 | *governor = t; |
306 | up(&cpufreq_governor_sem); | 307 | mutex_unlock(&cpufreq_governor_mutex); |
307 | return 0; | 308 | return 0; |
308 | } | 309 | } |
309 | } | 310 | } |
310 | out: | 311 | out: |
311 | up(&cpufreq_governor_sem); | 312 | mutex_unlock(&cpufreq_governor_mutex); |
312 | } | 313 | } |
313 | return -EINVAL; | 314 | return -EINVAL; |
314 | } | 315 | } |
@@ -600,7 +601,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
600 | policy->cpu = cpu; | 601 | policy->cpu = cpu; |
601 | policy->cpus = cpumask_of_cpu(cpu); | 602 | policy->cpus = cpumask_of_cpu(cpu); |
602 | 603 | ||
603 | init_MUTEX_LOCKED(&policy->lock); | 604 | mutex_init(&policy->lock); |
605 | mutex_lock(&policy->lock); | ||
604 | init_completion(&policy->kobj_unregister); | 606 | init_completion(&policy->kobj_unregister); |
605 | INIT_WORK(&policy->update, handle_update, (void *)(long)cpu); | 607 | INIT_WORK(&policy->update, handle_update, (void *)(long)cpu); |
606 | 608 | ||
@@ -610,6 +612,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
610 | ret = cpufreq_driver->init(policy); | 612 | ret = cpufreq_driver->init(policy); |
611 | if (ret) { | 613 | if (ret) { |
612 | dprintk("initialization failed\n"); | 614 | dprintk("initialization failed\n"); |
615 | mutex_unlock(&policy->lock); | ||
613 | goto err_out; | 616 | goto err_out; |
614 | } | 617 | } |
615 | 618 | ||
@@ -621,9 +624,10 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
621 | strlcpy(policy->kobj.name, "cpufreq", KOBJ_NAME_LEN); | 624 | strlcpy(policy->kobj.name, "cpufreq", KOBJ_NAME_LEN); |
622 | 625 | ||
623 | ret = kobject_register(&policy->kobj); | 626 | ret = kobject_register(&policy->kobj); |
624 | if (ret) | 627 | if (ret) { |
628 | mutex_unlock(&policy->lock); | ||
625 | goto err_out_driver_exit; | 629 | goto err_out_driver_exit; |
626 | 630 | } | |
627 | /* set up files for this cpu device */ | 631 | /* set up files for this cpu device */ |
628 | drv_attr = cpufreq_driver->attr; | 632 | drv_attr = cpufreq_driver->attr; |
629 | while ((drv_attr) && (*drv_attr)) { | 633 | while ((drv_attr) && (*drv_attr)) { |
@@ -641,7 +645,7 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
641 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 645 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
642 | policy->governor = NULL; /* to assure that the starting sequence is | 646 | policy->governor = NULL; /* to assure that the starting sequence is |
643 | * run in cpufreq_set_policy */ | 647 | * run in cpufreq_set_policy */ |
644 | up(&policy->lock); | 648 | mutex_unlock(&policy->lock); |
645 | 649 | ||
646 | /* set default policy */ | 650 | /* set default policy */ |
647 | 651 | ||
@@ -762,10 +766,10 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev) | |||
762 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 766 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
763 | #endif | 767 | #endif |
764 | 768 | ||
765 | down(&data->lock); | 769 | mutex_lock(&data->lock); |
766 | if (cpufreq_driver->target) | 770 | if (cpufreq_driver->target) |
767 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); | 771 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); |
768 | up(&data->lock); | 772 | mutex_unlock(&data->lock); |
769 | 773 | ||
770 | kobject_unregister(&data->kobj); | 774 | kobject_unregister(&data->kobj); |
771 | 775 | ||
@@ -834,9 +838,9 @@ unsigned int cpufreq_quick_get(unsigned int cpu) | |||
834 | unsigned int ret = 0; | 838 | unsigned int ret = 0; |
835 | 839 | ||
836 | if (policy) { | 840 | if (policy) { |
837 | down(&policy->lock); | 841 | mutex_lock(&policy->lock); |
838 | ret = policy->cur; | 842 | ret = policy->cur; |
839 | up(&policy->lock); | 843 | mutex_unlock(&policy->lock); |
840 | cpufreq_cpu_put(policy); | 844 | cpufreq_cpu_put(policy); |
841 | } | 845 | } |
842 | 846 | ||
@@ -862,7 +866,7 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
862 | if (!cpufreq_driver->get) | 866 | if (!cpufreq_driver->get) |
863 | goto out; | 867 | goto out; |
864 | 868 | ||
865 | down(&policy->lock); | 869 | mutex_lock(&policy->lock); |
866 | 870 | ||
867 | ret = cpufreq_driver->get(cpu); | 871 | ret = cpufreq_driver->get(cpu); |
868 | 872 | ||
@@ -875,7 +879,7 @@ unsigned int cpufreq_get(unsigned int cpu) | |||
875 | } | 879 | } |
876 | } | 880 | } |
877 | 881 | ||
878 | up(&policy->lock); | 882 | mutex_unlock(&policy->lock); |
879 | 883 | ||
880 | out: | 884 | out: |
881 | cpufreq_cpu_put(policy); | 885 | cpufreq_cpu_put(policy); |
@@ -1158,11 +1162,11 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1158 | if (!policy) | 1162 | if (!policy) |
1159 | return -EINVAL; | 1163 | return -EINVAL; |
1160 | 1164 | ||
1161 | down(&policy->lock); | 1165 | mutex_lock(&policy->lock); |
1162 | 1166 | ||
1163 | ret = __cpufreq_driver_target(policy, target_freq, relation); | 1167 | ret = __cpufreq_driver_target(policy, target_freq, relation); |
1164 | 1168 | ||
1165 | up(&policy->lock); | 1169 | mutex_unlock(&policy->lock); |
1166 | 1170 | ||
1167 | cpufreq_cpu_put(policy); | 1171 | cpufreq_cpu_put(policy); |
1168 | 1172 | ||
@@ -1199,9 +1203,9 @@ int cpufreq_governor(unsigned int cpu, unsigned int event) | |||
1199 | if (!policy) | 1203 | if (!policy) |
1200 | return -EINVAL; | 1204 | return -EINVAL; |
1201 | 1205 | ||
1202 | down(&policy->lock); | 1206 | mutex_lock(&policy->lock); |
1203 | ret = __cpufreq_governor(policy, event); | 1207 | ret = __cpufreq_governor(policy, event); |
1204 | up(&policy->lock); | 1208 | mutex_unlock(&policy->lock); |
1205 | 1209 | ||
1206 | cpufreq_cpu_put(policy); | 1210 | cpufreq_cpu_put(policy); |
1207 | 1211 | ||
@@ -1217,17 +1221,17 @@ int cpufreq_register_governor(struct cpufreq_governor *governor) | |||
1217 | if (!governor) | 1221 | if (!governor) |
1218 | return -EINVAL; | 1222 | return -EINVAL; |
1219 | 1223 | ||
1220 | down(&cpufreq_governor_sem); | 1224 | mutex_lock(&cpufreq_governor_mutex); |
1221 | 1225 | ||
1222 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) { | 1226 | list_for_each_entry(t, &cpufreq_governor_list, governor_list) { |
1223 | if (!strnicmp(governor->name,t->name,CPUFREQ_NAME_LEN)) { | 1227 | if (!strnicmp(governor->name,t->name,CPUFREQ_NAME_LEN)) { |
1224 | up(&cpufreq_governor_sem); | 1228 | mutex_unlock(&cpufreq_governor_mutex); |
1225 | return -EBUSY; | 1229 | return -EBUSY; |
1226 | } | 1230 | } |
1227 | } | 1231 | } |
1228 | list_add(&governor->governor_list, &cpufreq_governor_list); | 1232 | list_add(&governor->governor_list, &cpufreq_governor_list); |
1229 | 1233 | ||
1230 | up(&cpufreq_governor_sem); | 1234 | mutex_unlock(&cpufreq_governor_mutex); |
1231 | 1235 | ||
1232 | return 0; | 1236 | return 0; |
1233 | } | 1237 | } |
@@ -1239,9 +1243,9 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor) | |||
1239 | if (!governor) | 1243 | if (!governor) |
1240 | return; | 1244 | return; |
1241 | 1245 | ||
1242 | down(&cpufreq_governor_sem); | 1246 | mutex_lock(&cpufreq_governor_mutex); |
1243 | list_del(&governor->governor_list); | 1247 | list_del(&governor->governor_list); |
1244 | up(&cpufreq_governor_sem); | 1248 | mutex_unlock(&cpufreq_governor_mutex); |
1245 | return; | 1249 | return; |
1246 | } | 1250 | } |
1247 | EXPORT_SYMBOL_GPL(cpufreq_unregister_governor); | 1251 | EXPORT_SYMBOL_GPL(cpufreq_unregister_governor); |
@@ -1268,9 +1272,9 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu) | |||
1268 | if (!cpu_policy) | 1272 | if (!cpu_policy) |
1269 | return -EINVAL; | 1273 | return -EINVAL; |
1270 | 1274 | ||
1271 | down(&cpu_policy->lock); | 1275 | mutex_lock(&cpu_policy->lock); |
1272 | memcpy(policy, cpu_policy, sizeof(struct cpufreq_policy)); | 1276 | memcpy(policy, cpu_policy, sizeof(struct cpufreq_policy)); |
1273 | up(&cpu_policy->lock); | 1277 | mutex_unlock(&cpu_policy->lock); |
1274 | 1278 | ||
1275 | cpufreq_cpu_put(cpu_policy); | 1279 | cpufreq_cpu_put(cpu_policy); |
1276 | 1280 | ||
@@ -1382,7 +1386,7 @@ int cpufreq_set_policy(struct cpufreq_policy *policy) | |||
1382 | return -EINVAL; | 1386 | return -EINVAL; |
1383 | 1387 | ||
1384 | /* lock this CPU */ | 1388 | /* lock this CPU */ |
1385 | down(&data->lock); | 1389 | mutex_lock(&data->lock); |
1386 | 1390 | ||
1387 | ret = __cpufreq_set_policy(data, policy); | 1391 | ret = __cpufreq_set_policy(data, policy); |
1388 | data->user_policy.min = data->min; | 1392 | data->user_policy.min = data->min; |
@@ -1390,7 +1394,7 @@ int cpufreq_set_policy(struct cpufreq_policy *policy) | |||
1390 | data->user_policy.policy = data->policy; | 1394 | data->user_policy.policy = data->policy; |
1391 | data->user_policy.governor = data->governor; | 1395 | data->user_policy.governor = data->governor; |
1392 | 1396 | ||
1393 | up(&data->lock); | 1397 | mutex_unlock(&data->lock); |
1394 | cpufreq_cpu_put(data); | 1398 | cpufreq_cpu_put(data); |
1395 | 1399 | ||
1396 | return ret; | 1400 | return ret; |
@@ -1414,7 +1418,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1414 | if (!data) | 1418 | if (!data) |
1415 | return -ENODEV; | 1419 | return -ENODEV; |
1416 | 1420 | ||
1417 | down(&data->lock); | 1421 | mutex_lock(&data->lock); |
1418 | 1422 | ||
1419 | dprintk("updating policy for CPU %u\n", cpu); | 1423 | dprintk("updating policy for CPU %u\n", cpu); |
1420 | memcpy(&policy, | 1424 | memcpy(&policy, |
@@ -1425,9 +1429,17 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1425 | policy.policy = data->user_policy.policy; | 1429 | policy.policy = data->user_policy.policy; |
1426 | policy.governor = data->user_policy.governor; | 1430 | policy.governor = data->user_policy.governor; |
1427 | 1431 | ||
1432 | /* BIOS might change freq behind our back | ||
1433 | -> ask driver for current freq and notify governors about a change */ | ||
1434 | if (cpufreq_driver->get) { | ||
1435 | policy.cur = cpufreq_driver->get(cpu); | ||
1436 | if (data->cur != policy.cur) | ||
1437 | cpufreq_out_of_sync(cpu, data->cur, policy.cur); | ||
1438 | } | ||
1439 | |||
1428 | ret = __cpufreq_set_policy(data, &policy); | 1440 | ret = __cpufreq_set_policy(data, &policy); |
1429 | 1441 | ||
1430 | up(&data->lock); | 1442 | mutex_unlock(&data->lock); |
1431 | 1443 | ||
1432 | cpufreq_cpu_put(data); | 1444 | cpufreq_cpu_put(data); |
1433 | return ret; | 1445 | return ret; |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 39543a2bed0f..ac38766b2583 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/jiffies.h> | 28 | #include <linux/jiffies.h> |
29 | #include <linux/kernel_stat.h> | 29 | #include <linux/kernel_stat.h> |
30 | #include <linux/percpu.h> | 30 | #include <linux/percpu.h> |
31 | 31 | #include <linux/mutex.h> | |
32 | /* | 32 | /* |
33 | * dbs is used in this file as a shortform for demandbased switching | 33 | * dbs is used in this file as a shortform for demandbased switching |
34 | * It helps to keep variable names smaller, simpler | 34 | * It helps to keep variable names smaller, simpler |
@@ -71,7 +71,7 @@ static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); | |||
71 | 71 | ||
72 | static unsigned int dbs_enable; /* number of CPUs using this policy */ | 72 | static unsigned int dbs_enable; /* number of CPUs using this policy */ |
73 | 73 | ||
74 | static DECLARE_MUTEX (dbs_sem); | 74 | static DEFINE_MUTEX (dbs_mutex); |
75 | static DECLARE_WORK (dbs_work, do_dbs_timer, NULL); | 75 | static DECLARE_WORK (dbs_work, do_dbs_timer, NULL); |
76 | 76 | ||
77 | struct dbs_tuners { | 77 | struct dbs_tuners { |
@@ -139,9 +139,9 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, | |||
139 | if (ret != 1 ) | 139 | if (ret != 1 ) |
140 | return -EINVAL; | 140 | return -EINVAL; |
141 | 141 | ||
142 | down(&dbs_sem); | 142 | mutex_lock(&dbs_mutex); |
143 | dbs_tuners_ins.sampling_down_factor = input; | 143 | dbs_tuners_ins.sampling_down_factor = input; |
144 | up(&dbs_sem); | 144 | mutex_unlock(&dbs_mutex); |
145 | 145 | ||
146 | return count; | 146 | return count; |
147 | } | 147 | } |
@@ -153,14 +153,14 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused, | |||
153 | int ret; | 153 | int ret; |
154 | ret = sscanf (buf, "%u", &input); | 154 | ret = sscanf (buf, "%u", &input); |
155 | 155 | ||
156 | down(&dbs_sem); | 156 | mutex_lock(&dbs_mutex); |
157 | if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) { | 157 | if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) { |
158 | up(&dbs_sem); | 158 | mutex_unlock(&dbs_mutex); |
159 | return -EINVAL; | 159 | return -EINVAL; |
160 | } | 160 | } |
161 | 161 | ||
162 | dbs_tuners_ins.sampling_rate = input; | 162 | dbs_tuners_ins.sampling_rate = input; |
163 | up(&dbs_sem); | 163 | mutex_unlock(&dbs_mutex); |
164 | 164 | ||
165 | return count; | 165 | return count; |
166 | } | 166 | } |
@@ -172,16 +172,16 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused, | |||
172 | int ret; | 172 | int ret; |
173 | ret = sscanf (buf, "%u", &input); | 173 | ret = sscanf (buf, "%u", &input); |
174 | 174 | ||
175 | down(&dbs_sem); | 175 | mutex_lock(&dbs_mutex); |
176 | if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || | 176 | if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || |
177 | input < MIN_FREQUENCY_UP_THRESHOLD || | 177 | input < MIN_FREQUENCY_UP_THRESHOLD || |
178 | input <= dbs_tuners_ins.down_threshold) { | 178 | input <= dbs_tuners_ins.down_threshold) { |
179 | up(&dbs_sem); | 179 | mutex_unlock(&dbs_mutex); |
180 | return -EINVAL; | 180 | return -EINVAL; |
181 | } | 181 | } |
182 | 182 | ||
183 | dbs_tuners_ins.up_threshold = input; | 183 | dbs_tuners_ins.up_threshold = input; |
184 | up(&dbs_sem); | 184 | mutex_unlock(&dbs_mutex); |
185 | 185 | ||
186 | return count; | 186 | return count; |
187 | } | 187 | } |
@@ -193,16 +193,16 @@ static ssize_t store_down_threshold(struct cpufreq_policy *unused, | |||
193 | int ret; | 193 | int ret; |
194 | ret = sscanf (buf, "%u", &input); | 194 | ret = sscanf (buf, "%u", &input); |
195 | 195 | ||
196 | down(&dbs_sem); | 196 | mutex_lock(&dbs_mutex); |
197 | if (ret != 1 || input > MAX_FREQUENCY_DOWN_THRESHOLD || | 197 | if (ret != 1 || input > MAX_FREQUENCY_DOWN_THRESHOLD || |
198 | input < MIN_FREQUENCY_DOWN_THRESHOLD || | 198 | input < MIN_FREQUENCY_DOWN_THRESHOLD || |
199 | input >= dbs_tuners_ins.up_threshold) { | 199 | input >= dbs_tuners_ins.up_threshold) { |
200 | up(&dbs_sem); | 200 | mutex_unlock(&dbs_mutex); |
201 | return -EINVAL; | 201 | return -EINVAL; |
202 | } | 202 | } |
203 | 203 | ||
204 | dbs_tuners_ins.down_threshold = input; | 204 | dbs_tuners_ins.down_threshold = input; |
205 | up(&dbs_sem); | 205 | mutex_unlock(&dbs_mutex); |
206 | 206 | ||
207 | return count; | 207 | return count; |
208 | } | 208 | } |
@@ -222,9 +222,9 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, | |||
222 | if ( input > 1 ) | 222 | if ( input > 1 ) |
223 | input = 1; | 223 | input = 1; |
224 | 224 | ||
225 | down(&dbs_sem); | 225 | mutex_lock(&dbs_mutex); |
226 | if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */ | 226 | if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */ |
227 | up(&dbs_sem); | 227 | mutex_unlock(&dbs_mutex); |
228 | return count; | 228 | return count; |
229 | } | 229 | } |
230 | dbs_tuners_ins.ignore_nice = input; | 230 | dbs_tuners_ins.ignore_nice = input; |
@@ -236,7 +236,7 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, | |||
236 | j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j); | 236 | j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j); |
237 | j_dbs_info->prev_cpu_idle_down = j_dbs_info->prev_cpu_idle_up; | 237 | j_dbs_info->prev_cpu_idle_down = j_dbs_info->prev_cpu_idle_up; |
238 | } | 238 | } |
239 | up(&dbs_sem); | 239 | mutex_unlock(&dbs_mutex); |
240 | 240 | ||
241 | return count; | 241 | return count; |
242 | } | 242 | } |
@@ -257,9 +257,9 @@ static ssize_t store_freq_step(struct cpufreq_policy *policy, | |||
257 | 257 | ||
258 | /* no need to test here if freq_step is zero as the user might actually | 258 | /* no need to test here if freq_step is zero as the user might actually |
259 | * want this, they would be crazy though :) */ | 259 | * want this, they would be crazy though :) */ |
260 | down(&dbs_sem); | 260 | mutex_lock(&dbs_mutex); |
261 | dbs_tuners_ins.freq_step = input; | 261 | dbs_tuners_ins.freq_step = input; |
262 | up(&dbs_sem); | 262 | mutex_unlock(&dbs_mutex); |
263 | 263 | ||
264 | return count; | 264 | return count; |
265 | } | 265 | } |
@@ -444,12 +444,12 @@ static void dbs_check_cpu(int cpu) | |||
444 | static void do_dbs_timer(void *data) | 444 | static void do_dbs_timer(void *data) |
445 | { | 445 | { |
446 | int i; | 446 | int i; |
447 | down(&dbs_sem); | 447 | mutex_lock(&dbs_mutex); |
448 | for_each_online_cpu(i) | 448 | for_each_online_cpu(i) |
449 | dbs_check_cpu(i); | 449 | dbs_check_cpu(i); |
450 | schedule_delayed_work(&dbs_work, | 450 | schedule_delayed_work(&dbs_work, |
451 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); | 451 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); |
452 | up(&dbs_sem); | 452 | mutex_unlock(&dbs_mutex); |
453 | } | 453 | } |
454 | 454 | ||
455 | static inline void dbs_timer_init(void) | 455 | static inline void dbs_timer_init(void) |
@@ -487,7 +487,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
487 | if (this_dbs_info->enable) /* Already enabled */ | 487 | if (this_dbs_info->enable) /* Already enabled */ |
488 | break; | 488 | break; |
489 | 489 | ||
490 | down(&dbs_sem); | 490 | mutex_lock(&dbs_mutex); |
491 | for_each_cpu_mask(j, policy->cpus) { | 491 | for_each_cpu_mask(j, policy->cpus) { |
492 | struct cpu_dbs_info_s *j_dbs_info; | 492 | struct cpu_dbs_info_s *j_dbs_info; |
493 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 493 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
@@ -521,11 +521,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
521 | dbs_timer_init(); | 521 | dbs_timer_init(); |
522 | } | 522 | } |
523 | 523 | ||
524 | up(&dbs_sem); | 524 | mutex_unlock(&dbs_mutex); |
525 | break; | 525 | break; |
526 | 526 | ||
527 | case CPUFREQ_GOV_STOP: | 527 | case CPUFREQ_GOV_STOP: |
528 | down(&dbs_sem); | 528 | mutex_lock(&dbs_mutex); |
529 | this_dbs_info->enable = 0; | 529 | this_dbs_info->enable = 0; |
530 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); | 530 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); |
531 | dbs_enable--; | 531 | dbs_enable--; |
@@ -536,12 +536,12 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
536 | if (dbs_enable == 0) | 536 | if (dbs_enable == 0) |
537 | dbs_timer_exit(); | 537 | dbs_timer_exit(); |
538 | 538 | ||
539 | up(&dbs_sem); | 539 | mutex_unlock(&dbs_mutex); |
540 | 540 | ||
541 | break; | 541 | break; |
542 | 542 | ||
543 | case CPUFREQ_GOV_LIMITS: | 543 | case CPUFREQ_GOV_LIMITS: |
544 | down(&dbs_sem); | 544 | mutex_lock(&dbs_mutex); |
545 | if (policy->max < this_dbs_info->cur_policy->cur) | 545 | if (policy->max < this_dbs_info->cur_policy->cur) |
546 | __cpufreq_driver_target( | 546 | __cpufreq_driver_target( |
547 | this_dbs_info->cur_policy, | 547 | this_dbs_info->cur_policy, |
@@ -550,7 +550,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
550 | __cpufreq_driver_target( | 550 | __cpufreq_driver_target( |
551 | this_dbs_info->cur_policy, | 551 | this_dbs_info->cur_policy, |
552 | policy->min, CPUFREQ_RELATION_L); | 552 | policy->min, CPUFREQ_RELATION_L); |
553 | up(&dbs_sem); | 553 | mutex_unlock(&dbs_mutex); |
554 | break; | 554 | break; |
555 | } | 555 | } |
556 | return 0; | 556 | return 0; |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index e69fd8dd1f1c..9ee9411f186f 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/jiffies.h> | 27 | #include <linux/jiffies.h> |
28 | #include <linux/kernel_stat.h> | 28 | #include <linux/kernel_stat.h> |
29 | #include <linux/percpu.h> | 29 | #include <linux/percpu.h> |
30 | #include <linux/mutex.h> | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * dbs is used in this file as a shortform for demandbased switching | 33 | * dbs is used in this file as a shortform for demandbased switching |
@@ -70,7 +71,7 @@ static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); | |||
70 | 71 | ||
71 | static unsigned int dbs_enable; /* number of CPUs using this policy */ | 72 | static unsigned int dbs_enable; /* number of CPUs using this policy */ |
72 | 73 | ||
73 | static DECLARE_MUTEX (dbs_sem); | 74 | static DEFINE_MUTEX (dbs_mutex); |
74 | static DECLARE_WORK (dbs_work, do_dbs_timer, NULL); | 75 | static DECLARE_WORK (dbs_work, do_dbs_timer, NULL); |
75 | 76 | ||
76 | struct dbs_tuners { | 77 | struct dbs_tuners { |
@@ -136,9 +137,9 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, | |||
136 | if (input > MAX_SAMPLING_DOWN_FACTOR || input < 1) | 137 | if (input > MAX_SAMPLING_DOWN_FACTOR || input < 1) |
137 | return -EINVAL; | 138 | return -EINVAL; |
138 | 139 | ||
139 | down(&dbs_sem); | 140 | mutex_lock(&dbs_mutex); |
140 | dbs_tuners_ins.sampling_down_factor = input; | 141 | dbs_tuners_ins.sampling_down_factor = input; |
141 | up(&dbs_sem); | 142 | mutex_unlock(&dbs_mutex); |
142 | 143 | ||
143 | return count; | 144 | return count; |
144 | } | 145 | } |
@@ -150,14 +151,14 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused, | |||
150 | int ret; | 151 | int ret; |
151 | ret = sscanf (buf, "%u", &input); | 152 | ret = sscanf (buf, "%u", &input); |
152 | 153 | ||
153 | down(&dbs_sem); | 154 | mutex_lock(&dbs_mutex); |
154 | if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) { | 155 | if (ret != 1 || input > MAX_SAMPLING_RATE || input < MIN_SAMPLING_RATE) { |
155 | up(&dbs_sem); | 156 | mutex_unlock(&dbs_mutex); |
156 | return -EINVAL; | 157 | return -EINVAL; |
157 | } | 158 | } |
158 | 159 | ||
159 | dbs_tuners_ins.sampling_rate = input; | 160 | dbs_tuners_ins.sampling_rate = input; |
160 | up(&dbs_sem); | 161 | mutex_unlock(&dbs_mutex); |
161 | 162 | ||
162 | return count; | 163 | return count; |
163 | } | 164 | } |
@@ -169,15 +170,15 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused, | |||
169 | int ret; | 170 | int ret; |
170 | ret = sscanf (buf, "%u", &input); | 171 | ret = sscanf (buf, "%u", &input); |
171 | 172 | ||
172 | down(&dbs_sem); | 173 | mutex_lock(&dbs_mutex); |
173 | if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || | 174 | if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || |
174 | input < MIN_FREQUENCY_UP_THRESHOLD) { | 175 | input < MIN_FREQUENCY_UP_THRESHOLD) { |
175 | up(&dbs_sem); | 176 | mutex_unlock(&dbs_mutex); |
176 | return -EINVAL; | 177 | return -EINVAL; |
177 | } | 178 | } |
178 | 179 | ||
179 | dbs_tuners_ins.up_threshold = input; | 180 | dbs_tuners_ins.up_threshold = input; |
180 | up(&dbs_sem); | 181 | mutex_unlock(&dbs_mutex); |
181 | 182 | ||
182 | return count; | 183 | return count; |
183 | } | 184 | } |
@@ -197,9 +198,9 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, | |||
197 | if ( input > 1 ) | 198 | if ( input > 1 ) |
198 | input = 1; | 199 | input = 1; |
199 | 200 | ||
200 | down(&dbs_sem); | 201 | mutex_lock(&dbs_mutex); |
201 | if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */ | 202 | if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */ |
202 | up(&dbs_sem); | 203 | mutex_unlock(&dbs_mutex); |
203 | return count; | 204 | return count; |
204 | } | 205 | } |
205 | dbs_tuners_ins.ignore_nice = input; | 206 | dbs_tuners_ins.ignore_nice = input; |
@@ -211,7 +212,7 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, | |||
211 | j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j); | 212 | j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j); |
212 | j_dbs_info->prev_cpu_idle_down = j_dbs_info->prev_cpu_idle_up; | 213 | j_dbs_info->prev_cpu_idle_down = j_dbs_info->prev_cpu_idle_up; |
213 | } | 214 | } |
214 | up(&dbs_sem); | 215 | mutex_unlock(&dbs_mutex); |
215 | 216 | ||
216 | return count; | 217 | return count; |
217 | } | 218 | } |
@@ -356,12 +357,12 @@ static void dbs_check_cpu(int cpu) | |||
356 | static void do_dbs_timer(void *data) | 357 | static void do_dbs_timer(void *data) |
357 | { | 358 | { |
358 | int i; | 359 | int i; |
359 | down(&dbs_sem); | 360 | mutex_lock(&dbs_mutex); |
360 | for_each_online_cpu(i) | 361 | for_each_online_cpu(i) |
361 | dbs_check_cpu(i); | 362 | dbs_check_cpu(i); |
362 | schedule_delayed_work(&dbs_work, | 363 | schedule_delayed_work(&dbs_work, |
363 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); | 364 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); |
364 | up(&dbs_sem); | 365 | mutex_unlock(&dbs_mutex); |
365 | } | 366 | } |
366 | 367 | ||
367 | static inline void dbs_timer_init(void) | 368 | static inline void dbs_timer_init(void) |
@@ -399,7 +400,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
399 | if (this_dbs_info->enable) /* Already enabled */ | 400 | if (this_dbs_info->enable) /* Already enabled */ |
400 | break; | 401 | break; |
401 | 402 | ||
402 | down(&dbs_sem); | 403 | mutex_lock(&dbs_mutex); |
403 | for_each_cpu_mask(j, policy->cpus) { | 404 | for_each_cpu_mask(j, policy->cpus) { |
404 | struct cpu_dbs_info_s *j_dbs_info; | 405 | struct cpu_dbs_info_s *j_dbs_info; |
405 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 406 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
@@ -435,11 +436,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
435 | dbs_timer_init(); | 436 | dbs_timer_init(); |
436 | } | 437 | } |
437 | 438 | ||
438 | up(&dbs_sem); | 439 | mutex_unlock(&dbs_mutex); |
439 | break; | 440 | break; |
440 | 441 | ||
441 | case CPUFREQ_GOV_STOP: | 442 | case CPUFREQ_GOV_STOP: |
442 | down(&dbs_sem); | 443 | mutex_lock(&dbs_mutex); |
443 | this_dbs_info->enable = 0; | 444 | this_dbs_info->enable = 0; |
444 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); | 445 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); |
445 | dbs_enable--; | 446 | dbs_enable--; |
@@ -450,12 +451,12 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
450 | if (dbs_enable == 0) | 451 | if (dbs_enable == 0) |
451 | dbs_timer_exit(); | 452 | dbs_timer_exit(); |
452 | 453 | ||
453 | up(&dbs_sem); | 454 | mutex_unlock(&dbs_mutex); |
454 | 455 | ||
455 | break; | 456 | break; |
456 | 457 | ||
457 | case CPUFREQ_GOV_LIMITS: | 458 | case CPUFREQ_GOV_LIMITS: |
458 | down(&dbs_sem); | 459 | mutex_lock(&dbs_mutex); |
459 | if (policy->max < this_dbs_info->cur_policy->cur) | 460 | if (policy->max < this_dbs_info->cur_policy->cur) |
460 | __cpufreq_driver_target( | 461 | __cpufreq_driver_target( |
461 | this_dbs_info->cur_policy, | 462 | this_dbs_info->cur_policy, |
@@ -464,7 +465,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
464 | __cpufreq_driver_target( | 465 | __cpufreq_driver_target( |
465 | this_dbs_info->cur_policy, | 466 | this_dbs_info->cur_policy, |
466 | policy->min, CPUFREQ_RELATION_L); | 467 | policy->min, CPUFREQ_RELATION_L); |
467 | up(&dbs_sem); | 468 | mutex_unlock(&dbs_mutex); |
468 | break; | 469 | break; |
469 | } | 470 | } |
470 | return 0; | 471 | return 0; |
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index d32bf3593cd3..92a0be22a2a9 100644 --- a/drivers/cpufreq/cpufreq_userspace.c +++ b/drivers/cpufreq/cpufreq_userspace.c | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | /* | 2 | /* |
2 | * linux/drivers/cpufreq/cpufreq_userspace.c | 3 | * linux/drivers/cpufreq/cpufreq_userspace.c |
3 | * | 4 | * |
@@ -21,6 +22,7 @@ | |||
21 | #include <linux/types.h> | 22 | #include <linux/types.h> |
22 | #include <linux/fs.h> | 23 | #include <linux/fs.h> |
23 | #include <linux/sysfs.h> | 24 | #include <linux/sysfs.h> |
25 | #include <linux/mutex.h> | ||
24 | 26 | ||
25 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
26 | 28 | ||
@@ -33,9 +35,8 @@ static unsigned int cpu_min_freq[NR_CPUS]; | |||
33 | static unsigned int cpu_cur_freq[NR_CPUS]; /* current CPU freq */ | 35 | static unsigned int cpu_cur_freq[NR_CPUS]; /* current CPU freq */ |
34 | static unsigned int cpu_set_freq[NR_CPUS]; /* CPU freq desired by userspace */ | 36 | static unsigned int cpu_set_freq[NR_CPUS]; /* CPU freq desired by userspace */ |
35 | static unsigned int cpu_is_managed[NR_CPUS]; | 37 | static unsigned int cpu_is_managed[NR_CPUS]; |
36 | static struct cpufreq_policy current_policy[NR_CPUS]; | ||
37 | 38 | ||
38 | static DECLARE_MUTEX (userspace_sem); | 39 | static DEFINE_MUTEX (userspace_mutex); |
39 | 40 | ||
40 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "userspace", msg) | 41 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "userspace", msg) |
41 | 42 | ||
@@ -64,35 +65,34 @@ static struct notifier_block userspace_cpufreq_notifier_block = { | |||
64 | * | 65 | * |
65 | * Sets the CPU frequency to freq. | 66 | * Sets the CPU frequency to freq. |
66 | */ | 67 | */ |
67 | static int cpufreq_set(unsigned int freq, unsigned int cpu) | 68 | static int cpufreq_set(unsigned int freq, struct cpufreq_policy *policy) |
68 | { | 69 | { |
69 | int ret = -EINVAL; | 70 | int ret = -EINVAL; |
70 | 71 | ||
71 | dprintk("cpufreq_set for cpu %u, freq %u kHz\n", cpu, freq); | 72 | dprintk("cpufreq_set for cpu %u, freq %u kHz\n", policy->cpu, freq); |
72 | 73 | ||
73 | down(&userspace_sem); | 74 | mutex_lock(&userspace_mutex); |
74 | if (!cpu_is_managed[cpu]) | 75 | if (!cpu_is_managed[policy->cpu]) |
75 | goto err; | 76 | goto err; |
76 | 77 | ||
77 | cpu_set_freq[cpu] = freq; | 78 | cpu_set_freq[policy->cpu] = freq; |
78 | 79 | ||
79 | if (freq < cpu_min_freq[cpu]) | 80 | if (freq < cpu_min_freq[policy->cpu]) |
80 | freq = cpu_min_freq[cpu]; | 81 | freq = cpu_min_freq[policy->cpu]; |
81 | if (freq > cpu_max_freq[cpu]) | 82 | if (freq > cpu_max_freq[policy->cpu]) |
82 | freq = cpu_max_freq[cpu]; | 83 | freq = cpu_max_freq[policy->cpu]; |
83 | 84 | ||
84 | /* | 85 | /* |
85 | * We're safe from concurrent calls to ->target() here | 86 | * We're safe from concurrent calls to ->target() here |
86 | * as we hold the userspace_sem lock. If we were calling | 87 | * as we hold the userspace_mutex lock. If we were calling |
87 | * cpufreq_driver_target, a deadlock situation might occur: | 88 | * cpufreq_driver_target, a deadlock situation might occur: |
88 | * A: cpufreq_set (lock userspace_sem) -> cpufreq_driver_target(lock policy->lock) | 89 | * A: cpufreq_set (lock userspace_mutex) -> cpufreq_driver_target(lock policy->lock) |
89 | * B: cpufreq_set_policy(lock policy->lock) -> __cpufreq_governor -> cpufreq_governor_userspace (lock userspace_sem) | 90 | * B: cpufreq_set_policy(lock policy->lock) -> __cpufreq_governor -> cpufreq_governor_userspace (lock userspace_mutex) |
90 | */ | 91 | */ |
91 | ret = __cpufreq_driver_target(¤t_policy[cpu], freq, | 92 | ret = __cpufreq_driver_target(policy, freq, CPUFREQ_RELATION_L); |
92 | CPUFREQ_RELATION_L); | ||
93 | 93 | ||
94 | err: | 94 | err: |
95 | up(&userspace_sem); | 95 | mutex_unlock(&userspace_mutex); |
96 | return ret; | 96 | return ret; |
97 | } | 97 | } |
98 | 98 | ||
@@ -113,7 +113,7 @@ store_speed (struct cpufreq_policy *policy, const char *buf, size_t count) | |||
113 | if (ret != 1) | 113 | if (ret != 1) |
114 | return -EINVAL; | 114 | return -EINVAL; |
115 | 115 | ||
116 | cpufreq_set(freq, policy->cpu); | 116 | cpufreq_set(freq, policy); |
117 | 117 | ||
118 | return count; | 118 | return count; |
119 | } | 119 | } |
@@ -134,44 +134,48 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy, | |||
134 | if (!cpu_online(cpu)) | 134 | if (!cpu_online(cpu)) |
135 | return -EINVAL; | 135 | return -EINVAL; |
136 | BUG_ON(!policy->cur); | 136 | BUG_ON(!policy->cur); |
137 | down(&userspace_sem); | 137 | mutex_lock(&userspace_mutex); |
138 | cpu_is_managed[cpu] = 1; | 138 | cpu_is_managed[cpu] = 1; |
139 | cpu_min_freq[cpu] = policy->min; | 139 | cpu_min_freq[cpu] = policy->min; |
140 | cpu_max_freq[cpu] = policy->max; | 140 | cpu_max_freq[cpu] = policy->max; |
141 | cpu_cur_freq[cpu] = policy->cur; | 141 | cpu_cur_freq[cpu] = policy->cur; |
142 | cpu_set_freq[cpu] = policy->cur; | 142 | cpu_set_freq[cpu] = policy->cur; |
143 | sysfs_create_file (&policy->kobj, &freq_attr_scaling_setspeed.attr); | 143 | sysfs_create_file (&policy->kobj, &freq_attr_scaling_setspeed.attr); |
144 | memcpy (¤t_policy[cpu], policy, sizeof(struct cpufreq_policy)); | ||
145 | dprintk("managing cpu %u started (%u - %u kHz, currently %u kHz)\n", cpu, cpu_min_freq[cpu], cpu_max_freq[cpu], cpu_cur_freq[cpu]); | 144 | dprintk("managing cpu %u started (%u - %u kHz, currently %u kHz)\n", cpu, cpu_min_freq[cpu], cpu_max_freq[cpu], cpu_cur_freq[cpu]); |
146 | up(&userspace_sem); | 145 | mutex_unlock(&userspace_mutex); |
147 | break; | 146 | break; |
148 | case CPUFREQ_GOV_STOP: | 147 | case CPUFREQ_GOV_STOP: |
149 | down(&userspace_sem); | 148 | mutex_lock(&userspace_mutex); |
150 | cpu_is_managed[cpu] = 0; | 149 | cpu_is_managed[cpu] = 0; |
151 | cpu_min_freq[cpu] = 0; | 150 | cpu_min_freq[cpu] = 0; |
152 | cpu_max_freq[cpu] = 0; | 151 | cpu_max_freq[cpu] = 0; |
153 | cpu_set_freq[cpu] = 0; | 152 | cpu_set_freq[cpu] = 0; |
154 | sysfs_remove_file (&policy->kobj, &freq_attr_scaling_setspeed.attr); | 153 | sysfs_remove_file (&policy->kobj, &freq_attr_scaling_setspeed.attr); |
155 | dprintk("managing cpu %u stopped\n", cpu); | 154 | dprintk("managing cpu %u stopped\n", cpu); |
156 | up(&userspace_sem); | 155 | mutex_unlock(&userspace_mutex); |
157 | break; | 156 | break; |
158 | case CPUFREQ_GOV_LIMITS: | 157 | case CPUFREQ_GOV_LIMITS: |
159 | down(&userspace_sem); | 158 | mutex_lock(&userspace_mutex); |
160 | cpu_min_freq[cpu] = policy->min; | 159 | dprintk("limit event for cpu %u: %u - %u kHz," |
161 | cpu_max_freq[cpu] = policy->max; | 160 | "currently %u kHz, last set to %u kHz\n", |
162 | dprintk("limit event for cpu %u: %u - %u kHz, currently %u kHz, last set to %u kHz\n", cpu, cpu_min_freq[cpu], cpu_max_freq[cpu], cpu_cur_freq[cpu], cpu_set_freq[cpu]); | 161 | cpu, policy->min, policy->max, |
162 | cpu_cur_freq[cpu], cpu_set_freq[cpu]); | ||
163 | if (policy->max < cpu_set_freq[cpu]) { | 163 | if (policy->max < cpu_set_freq[cpu]) { |
164 | __cpufreq_driver_target(¤t_policy[cpu], policy->max, | 164 | __cpufreq_driver_target(policy, policy->max, |
165 | CPUFREQ_RELATION_H); | 165 | CPUFREQ_RELATION_H); |
166 | } else if (policy->min > cpu_set_freq[cpu]) { | 166 | } |
167 | __cpufreq_driver_target(¤t_policy[cpu], policy->min, | 167 | else if (policy->min > cpu_set_freq[cpu]) { |
168 | CPUFREQ_RELATION_L); | 168 | __cpufreq_driver_target(policy, policy->min, |
169 | } else { | 169 | CPUFREQ_RELATION_L); |
170 | __cpufreq_driver_target(¤t_policy[cpu], cpu_set_freq[cpu], | ||
171 | CPUFREQ_RELATION_L); | ||
172 | } | 170 | } |
173 | memcpy (¤t_policy[cpu], policy, sizeof(struct cpufreq_policy)); | 171 | else { |
174 | up(&userspace_sem); | 172 | __cpufreq_driver_target(policy, cpu_set_freq[cpu], |
173 | CPUFREQ_RELATION_L); | ||
174 | } | ||
175 | cpu_min_freq[cpu] = policy->min; | ||
176 | cpu_max_freq[cpu] = policy->max; | ||
177 | cpu_cur_freq[cpu] = policy->cur; | ||
178 | mutex_unlock(&userspace_mutex); | ||
175 | break; | 179 | break; |
176 | } | 180 | } |
177 | return 0; | 181 | return 0; |
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index acda7d63d6fe..501cc054cb3b 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c | |||
@@ -956,6 +956,8 @@ static void ib_sa_remove_one(struct ib_device *device) | |||
956 | 956 | ||
957 | ib_unregister_event_handler(&sa_dev->event_handler); | 957 | ib_unregister_event_handler(&sa_dev->event_handler); |
958 | 958 | ||
959 | flush_scheduled_work(); | ||
960 | |||
959 | for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) { | 961 | for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) { |
960 | ib_unregister_mad_agent(sa_dev->port[i].agent); | 962 | ib_unregister_mad_agent(sa_dev->port[i].agent); |
961 | kref_put(&sa_dev->port[i].sm_ah->ref, free_sm_ah); | 963 | kref_put(&sa_dev->port[i].sm_ah->ref, free_sm_ah); |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 96ea79b63df7..903f85a4bc0c 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -902,6 +902,7 @@ static void __exit ib_uverbs_cleanup(void) | |||
902 | unregister_filesystem(&uverbs_event_fs); | 902 | unregister_filesystem(&uverbs_event_fs); |
903 | class_destroy(uverbs_class); | 903 | class_destroy(uverbs_class); |
904 | unregister_chrdev_region(IB_UVERBS_BASE_DEV, IB_UVERBS_MAX_DEVICES); | 904 | unregister_chrdev_region(IB_UVERBS_BASE_DEV, IB_UVERBS_MAX_DEVICES); |
905 | flush_scheduled_work(); | ||
905 | idr_destroy(&ib_uverbs_pd_idr); | 906 | idr_destroy(&ib_uverbs_pd_idr); |
906 | idr_destroy(&ib_uverbs_mr_idr); | 907 | idr_destroy(&ib_uverbs_mr_idr); |
907 | idr_destroy(&ib_uverbs_mw_idr); | 908 | idr_destroy(&ib_uverbs_mw_idr); |
diff --git a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c index a14eed08a0fc..a19e0ed03d7c 100644 --- a/drivers/infiniband/hw/mthca/mthca_av.c +++ b/drivers/infiniband/hw/mthca/mthca_av.c | |||
@@ -184,7 +184,7 @@ int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah, | |||
184 | ah->av->sl_tclass_flowlabel & cpu_to_be32(0xfffff); | 184 | ah->av->sl_tclass_flowlabel & cpu_to_be32(0xfffff); |
185 | ib_get_cached_gid(&dev->ib_dev, | 185 | ib_get_cached_gid(&dev->ib_dev, |
186 | be32_to_cpu(ah->av->port_pd) >> 24, | 186 | be32_to_cpu(ah->av->port_pd) >> 24, |
187 | ah->av->gid_index, | 187 | ah->av->gid_index % dev->limits.gid_table_len, |
188 | &header->grh.source_gid); | 188 | &header->grh.source_gid); |
189 | memcpy(header->grh.destination_gid.raw, | 189 | memcpy(header->grh.destination_gid.raw, |
190 | ah->av->dgid, 16); | 190 | ah->av->dgid, 16); |
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c index be1791be627b..f9b9b93dc501 100644 --- a/drivers/infiniband/hw/mthca/mthca_cmd.c +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c | |||
@@ -199,8 +199,7 @@ static int mthca_cmd_post(struct mthca_dev *dev, | |||
199 | { | 199 | { |
200 | int err = 0; | 200 | int err = 0; |
201 | 201 | ||
202 | if (down_interruptible(&dev->cmd.hcr_sem)) | 202 | mutex_lock(&dev->cmd.hcr_mutex); |
203 | return -EINTR; | ||
204 | 203 | ||
205 | if (event) { | 204 | if (event) { |
206 | unsigned long end = jiffies + GO_BIT_TIMEOUT; | 205 | unsigned long end = jiffies + GO_BIT_TIMEOUT; |
@@ -238,7 +237,7 @@ static int mthca_cmd_post(struct mthca_dev *dev, | |||
238 | op), dev->hcr + 6 * 4); | 237 | op), dev->hcr + 6 * 4); |
239 | 238 | ||
240 | out: | 239 | out: |
241 | up(&dev->cmd.hcr_sem); | 240 | mutex_unlock(&dev->cmd.hcr_mutex); |
242 | return err; | 241 | return err; |
243 | } | 242 | } |
244 | 243 | ||
@@ -255,8 +254,7 @@ static int mthca_cmd_poll(struct mthca_dev *dev, | |||
255 | int err = 0; | 254 | int err = 0; |
256 | unsigned long end; | 255 | unsigned long end; |
257 | 256 | ||
258 | if (down_interruptible(&dev->cmd.poll_sem)) | 257 | down(&dev->cmd.poll_sem); |
259 | return -EINTR; | ||
260 | 258 | ||
261 | err = mthca_cmd_post(dev, in_param, | 259 | err = mthca_cmd_post(dev, in_param, |
262 | out_param ? *out_param : 0, | 260 | out_param ? *out_param : 0, |
@@ -333,8 +331,7 @@ static int mthca_cmd_wait(struct mthca_dev *dev, | |||
333 | int err = 0; | 331 | int err = 0; |
334 | struct mthca_cmd_context *context; | 332 | struct mthca_cmd_context *context; |
335 | 333 | ||
336 | if (down_interruptible(&dev->cmd.event_sem)) | 334 | down(&dev->cmd.event_sem); |
337 | return -EINTR; | ||
338 | 335 | ||
339 | spin_lock(&dev->cmd.context_lock); | 336 | spin_lock(&dev->cmd.context_lock); |
340 | BUG_ON(dev->cmd.free_head < 0); | 337 | BUG_ON(dev->cmd.free_head < 0); |
@@ -438,7 +435,7 @@ static int mthca_cmd_imm(struct mthca_dev *dev, | |||
438 | 435 | ||
439 | int mthca_cmd_init(struct mthca_dev *dev) | 436 | int mthca_cmd_init(struct mthca_dev *dev) |
440 | { | 437 | { |
441 | sema_init(&dev->cmd.hcr_sem, 1); | 438 | mutex_init(&dev->cmd.hcr_mutex); |
442 | sema_init(&dev->cmd.poll_sem, 1); | 439 | sema_init(&dev->cmd.poll_sem, 1); |
443 | dev->cmd.use_events = 0; | 440 | dev->cmd.use_events = 0; |
444 | 441 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h index a104ab041ea3..2a165fd06e57 100644 --- a/drivers/infiniband/hw/mthca/mthca_dev.h +++ b/drivers/infiniband/hw/mthca/mthca_dev.h | |||
@@ -44,6 +44,8 @@ | |||
44 | #include <linux/pci.h> | 44 | #include <linux/pci.h> |
45 | #include <linux/dma-mapping.h> | 45 | #include <linux/dma-mapping.h> |
46 | #include <linux/timer.h> | 46 | #include <linux/timer.h> |
47 | #include <linux/mutex.h> | ||
48 | |||
47 | #include <asm/semaphore.h> | 49 | #include <asm/semaphore.h> |
48 | 50 | ||
49 | #include "mthca_provider.h" | 51 | #include "mthca_provider.h" |
@@ -111,7 +113,7 @@ enum { | |||
111 | struct mthca_cmd { | 113 | struct mthca_cmd { |
112 | struct pci_pool *pool; | 114 | struct pci_pool *pool; |
113 | int use_events; | 115 | int use_events; |
114 | struct semaphore hcr_sem; | 116 | struct mutex hcr_mutex; |
115 | struct semaphore poll_sem; | 117 | struct semaphore poll_sem; |
116 | struct semaphore event_sem; | 118 | struct semaphore event_sem; |
117 | int max_cmds; | 119 | int max_cmds; |
@@ -256,7 +258,7 @@ struct mthca_av_table { | |||
256 | }; | 258 | }; |
257 | 259 | ||
258 | struct mthca_mcg_table { | 260 | struct mthca_mcg_table { |
259 | struct semaphore sem; | 261 | struct mutex mutex; |
260 | struct mthca_alloc alloc; | 262 | struct mthca_alloc alloc; |
261 | struct mthca_icm_table *table; | 263 | struct mthca_icm_table *table; |
262 | }; | 264 | }; |
@@ -301,7 +303,7 @@ struct mthca_dev { | |||
301 | u64 ddr_end; | 303 | u64 ddr_end; |
302 | 304 | ||
303 | MTHCA_DECLARE_DOORBELL_LOCK(doorbell_lock) | 305 | MTHCA_DECLARE_DOORBELL_LOCK(doorbell_lock) |
304 | struct semaphore cap_mask_mutex; | 306 | struct mutex cap_mask_mutex; |
305 | 307 | ||
306 | void __iomem *hcr; | 308 | void __iomem *hcr; |
307 | void __iomem *kar; | 309 | void __iomem *kar; |
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 8b00d9a0f6f4..9c849d27b06e 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c | |||
@@ -155,6 +155,13 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim | |||
155 | return -ENODEV; | 155 | return -ENODEV; |
156 | } | 156 | } |
157 | 157 | ||
158 | if (dev_lim->uar_size > pci_resource_len(mdev->pdev, 2)) { | ||
159 | mthca_err(mdev, "HCA reported UAR size of 0x%x bigger than " | ||
160 | "PCI resource 2 size of 0x%lx, aborting.\n", | ||
161 | dev_lim->uar_size, pci_resource_len(mdev->pdev, 2)); | ||
162 | return -ENODEV; | ||
163 | } | ||
164 | |||
158 | mdev->limits.num_ports = dev_lim->num_ports; | 165 | mdev->limits.num_ports = dev_lim->num_ports; |
159 | mdev->limits.vl_cap = dev_lim->max_vl; | 166 | mdev->limits.vl_cap = dev_lim->max_vl; |
160 | mdev->limits.mtu_cap = dev_lim->max_mtu; | 167 | mdev->limits.mtu_cap = dev_lim->max_mtu; |
@@ -976,8 +983,7 @@ static int __devinit mthca_init_one(struct pci_dev *pdev, | |||
976 | err = -ENODEV; | 983 | err = -ENODEV; |
977 | goto err_disable_pdev; | 984 | goto err_disable_pdev; |
978 | } | 985 | } |
979 | if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM) || | 986 | if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { |
980 | pci_resource_len(pdev, 2) != 1 << 23) { | ||
981 | dev_err(&pdev->dev, "Missing UAR, aborting.\n"); | 987 | dev_err(&pdev->dev, "Missing UAR, aborting.\n"); |
982 | err = -ENODEV; | 988 | err = -ENODEV; |
983 | goto err_disable_pdev; | 989 | goto err_disable_pdev; |
diff --git a/drivers/infiniband/hw/mthca/mthca_mcg.c b/drivers/infiniband/hw/mthca/mthca_mcg.c index 77bc6c746f43..321f11e707f2 100644 --- a/drivers/infiniband/hw/mthca/mthca_mcg.c +++ b/drivers/infiniband/hw/mthca/mthca_mcg.c | |||
@@ -154,10 +154,7 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
154 | return PTR_ERR(mailbox); | 154 | return PTR_ERR(mailbox); |
155 | mgm = mailbox->buf; | 155 | mgm = mailbox->buf; |
156 | 156 | ||
157 | if (down_interruptible(&dev->mcg_table.sem)) { | 157 | mutex_lock(&dev->mcg_table.mutex); |
158 | err = -EINTR; | ||
159 | goto err_sem; | ||
160 | } | ||
161 | 158 | ||
162 | err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index); | 159 | err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index); |
163 | if (err) | 160 | if (err) |
@@ -241,8 +238,8 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
241 | BUG_ON(index < dev->limits.num_mgms); | 238 | BUG_ON(index < dev->limits.num_mgms); |
242 | mthca_free(&dev->mcg_table.alloc, index); | 239 | mthca_free(&dev->mcg_table.alloc, index); |
243 | } | 240 | } |
244 | up(&dev->mcg_table.sem); | 241 | mutex_unlock(&dev->mcg_table.mutex); |
245 | err_sem: | 242 | |
246 | mthca_free_mailbox(dev, mailbox); | 243 | mthca_free_mailbox(dev, mailbox); |
247 | return err; | 244 | return err; |
248 | } | 245 | } |
@@ -263,10 +260,7 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
263 | return PTR_ERR(mailbox); | 260 | return PTR_ERR(mailbox); |
264 | mgm = mailbox->buf; | 261 | mgm = mailbox->buf; |
265 | 262 | ||
266 | if (down_interruptible(&dev->mcg_table.sem)) { | 263 | mutex_lock(&dev->mcg_table.mutex); |
267 | err = -EINTR; | ||
268 | goto err_sem; | ||
269 | } | ||
270 | 264 | ||
271 | err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index); | 265 | err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index); |
272 | if (err) | 266 | if (err) |
@@ -371,8 +365,8 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
371 | } | 365 | } |
372 | 366 | ||
373 | out: | 367 | out: |
374 | up(&dev->mcg_table.sem); | 368 | mutex_unlock(&dev->mcg_table.mutex); |
375 | err_sem: | 369 | |
376 | mthca_free_mailbox(dev, mailbox); | 370 | mthca_free_mailbox(dev, mailbox); |
377 | return err; | 371 | return err; |
378 | } | 372 | } |
@@ -389,7 +383,7 @@ int __devinit mthca_init_mcg_table(struct mthca_dev *dev) | |||
389 | if (err) | 383 | if (err) |
390 | return err; | 384 | return err; |
391 | 385 | ||
392 | init_MUTEX(&dev->mcg_table.sem); | 386 | mutex_init(&dev->mcg_table.mutex); |
393 | 387 | ||
394 | return 0; | 388 | return 0; |
395 | } | 389 | } |
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index 9fb985a016e9..d709cb162a72 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c | |||
@@ -50,7 +50,7 @@ enum { | |||
50 | }; | 50 | }; |
51 | 51 | ||
52 | struct mthca_user_db_table { | 52 | struct mthca_user_db_table { |
53 | struct semaphore mutex; | 53 | struct mutex mutex; |
54 | struct { | 54 | struct { |
55 | u64 uvirt; | 55 | u64 uvirt; |
56 | struct scatterlist mem; | 56 | struct scatterlist mem; |
@@ -158,7 +158,7 @@ int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int ob | |||
158 | int ret = 0; | 158 | int ret = 0; |
159 | u8 status; | 159 | u8 status; |
160 | 160 | ||
161 | down(&table->mutex); | 161 | mutex_lock(&table->mutex); |
162 | 162 | ||
163 | if (table->icm[i]) { | 163 | if (table->icm[i]) { |
164 | ++table->icm[i]->refcount; | 164 | ++table->icm[i]->refcount; |
@@ -184,7 +184,7 @@ int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int ob | |||
184 | ++table->icm[i]->refcount; | 184 | ++table->icm[i]->refcount; |
185 | 185 | ||
186 | out: | 186 | out: |
187 | up(&table->mutex); | 187 | mutex_unlock(&table->mutex); |
188 | return ret; | 188 | return ret; |
189 | } | 189 | } |
190 | 190 | ||
@@ -198,7 +198,7 @@ void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int o | |||
198 | 198 | ||
199 | i = (obj & (table->num_obj - 1)) * table->obj_size / MTHCA_TABLE_CHUNK_SIZE; | 199 | i = (obj & (table->num_obj - 1)) * table->obj_size / MTHCA_TABLE_CHUNK_SIZE; |
200 | 200 | ||
201 | down(&table->mutex); | 201 | mutex_lock(&table->mutex); |
202 | 202 | ||
203 | if (--table->icm[i]->refcount == 0) { | 203 | if (--table->icm[i]->refcount == 0) { |
204 | mthca_UNMAP_ICM(dev, table->virt + i * MTHCA_TABLE_CHUNK_SIZE, | 204 | mthca_UNMAP_ICM(dev, table->virt + i * MTHCA_TABLE_CHUNK_SIZE, |
@@ -207,7 +207,7 @@ void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int o | |||
207 | table->icm[i] = NULL; | 207 | table->icm[i] = NULL; |
208 | } | 208 | } |
209 | 209 | ||
210 | up(&table->mutex); | 210 | mutex_unlock(&table->mutex); |
211 | } | 211 | } |
212 | 212 | ||
213 | void *mthca_table_find(struct mthca_icm_table *table, int obj) | 213 | void *mthca_table_find(struct mthca_icm_table *table, int obj) |
@@ -220,7 +220,7 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj) | |||
220 | if (!table->lowmem) | 220 | if (!table->lowmem) |
221 | return NULL; | 221 | return NULL; |
222 | 222 | ||
223 | down(&table->mutex); | 223 | mutex_lock(&table->mutex); |
224 | 224 | ||
225 | idx = (obj & (table->num_obj - 1)) * table->obj_size; | 225 | idx = (obj & (table->num_obj - 1)) * table->obj_size; |
226 | icm = table->icm[idx / MTHCA_TABLE_CHUNK_SIZE]; | 226 | icm = table->icm[idx / MTHCA_TABLE_CHUNK_SIZE]; |
@@ -240,7 +240,7 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj) | |||
240 | } | 240 | } |
241 | 241 | ||
242 | out: | 242 | out: |
243 | up(&table->mutex); | 243 | mutex_unlock(&table->mutex); |
244 | return page ? lowmem_page_address(page) + offset : NULL; | 244 | return page ? lowmem_page_address(page) + offset : NULL; |
245 | } | 245 | } |
246 | 246 | ||
@@ -301,7 +301,7 @@ struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev, | |||
301 | table->num_obj = nobj; | 301 | table->num_obj = nobj; |
302 | table->obj_size = obj_size; | 302 | table->obj_size = obj_size; |
303 | table->lowmem = use_lowmem; | 303 | table->lowmem = use_lowmem; |
304 | init_MUTEX(&table->mutex); | 304 | mutex_init(&table->mutex); |
305 | 305 | ||
306 | for (i = 0; i < num_icm; ++i) | 306 | for (i = 0; i < num_icm; ++i) |
307 | table->icm[i] = NULL; | 307 | table->icm[i] = NULL; |
@@ -380,7 +380,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar, | |||
380 | if (index < 0 || index > dev->uar_table.uarc_size / 8) | 380 | if (index < 0 || index > dev->uar_table.uarc_size / 8) |
381 | return -EINVAL; | 381 | return -EINVAL; |
382 | 382 | ||
383 | down(&db_tab->mutex); | 383 | mutex_lock(&db_tab->mutex); |
384 | 384 | ||
385 | i = index / MTHCA_DB_REC_PER_PAGE; | 385 | i = index / MTHCA_DB_REC_PER_PAGE; |
386 | 386 | ||
@@ -424,7 +424,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar, | |||
424 | db_tab->page[i].refcount = 1; | 424 | db_tab->page[i].refcount = 1; |
425 | 425 | ||
426 | out: | 426 | out: |
427 | up(&db_tab->mutex); | 427 | mutex_unlock(&db_tab->mutex); |
428 | return ret; | 428 | return ret; |
429 | } | 429 | } |
430 | 430 | ||
@@ -439,11 +439,11 @@ void mthca_unmap_user_db(struct mthca_dev *dev, struct mthca_uar *uar, | |||
439 | * pages until we clean up the whole db table. | 439 | * pages until we clean up the whole db table. |
440 | */ | 440 | */ |
441 | 441 | ||
442 | down(&db_tab->mutex); | 442 | mutex_lock(&db_tab->mutex); |
443 | 443 | ||
444 | --db_tab->page[index / MTHCA_DB_REC_PER_PAGE].refcount; | 444 | --db_tab->page[index / MTHCA_DB_REC_PER_PAGE].refcount; |
445 | 445 | ||
446 | up(&db_tab->mutex); | 446 | mutex_unlock(&db_tab->mutex); |
447 | } | 447 | } |
448 | 448 | ||
449 | struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev) | 449 | struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev) |
@@ -460,7 +460,7 @@ struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev) | |||
460 | if (!db_tab) | 460 | if (!db_tab) |
461 | return ERR_PTR(-ENOMEM); | 461 | return ERR_PTR(-ENOMEM); |
462 | 462 | ||
463 | init_MUTEX(&db_tab->mutex); | 463 | mutex_init(&db_tab->mutex); |
464 | for (i = 0; i < npages; ++i) { | 464 | for (i = 0; i < npages; ++i) { |
465 | db_tab->page[i].refcount = 0; | 465 | db_tab->page[i].refcount = 0; |
466 | db_tab->page[i].uvirt = 0; | 466 | db_tab->page[i].uvirt = 0; |
@@ -499,7 +499,7 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type, | |||
499 | int ret = 0; | 499 | int ret = 0; |
500 | u8 status; | 500 | u8 status; |
501 | 501 | ||
502 | down(&dev->db_tab->mutex); | 502 | mutex_lock(&dev->db_tab->mutex); |
503 | 503 | ||
504 | switch (type) { | 504 | switch (type) { |
505 | case MTHCA_DB_TYPE_CQ_ARM: | 505 | case MTHCA_DB_TYPE_CQ_ARM: |
@@ -585,7 +585,7 @@ found: | |||
585 | *db = (__be32 *) &page->db_rec[j]; | 585 | *db = (__be32 *) &page->db_rec[j]; |
586 | 586 | ||
587 | out: | 587 | out: |
588 | up(&dev->db_tab->mutex); | 588 | mutex_unlock(&dev->db_tab->mutex); |
589 | 589 | ||
590 | return ret; | 590 | return ret; |
591 | } | 591 | } |
@@ -601,7 +601,7 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index) | |||
601 | 601 | ||
602 | page = dev->db_tab->page + i; | 602 | page = dev->db_tab->page + i; |
603 | 603 | ||
604 | down(&dev->db_tab->mutex); | 604 | mutex_lock(&dev->db_tab->mutex); |
605 | 605 | ||
606 | page->db_rec[j] = 0; | 606 | page->db_rec[j] = 0; |
607 | if (i >= dev->db_tab->min_group2) | 607 | if (i >= dev->db_tab->min_group2) |
@@ -624,7 +624,7 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index) | |||
624 | ++dev->db_tab->min_group2; | 624 | ++dev->db_tab->min_group2; |
625 | } | 625 | } |
626 | 626 | ||
627 | up(&dev->db_tab->mutex); | 627 | mutex_unlock(&dev->db_tab->mutex); |
628 | } | 628 | } |
629 | 629 | ||
630 | int mthca_init_db_tab(struct mthca_dev *dev) | 630 | int mthca_init_db_tab(struct mthca_dev *dev) |
@@ -638,7 +638,7 @@ int mthca_init_db_tab(struct mthca_dev *dev) | |||
638 | if (!dev->db_tab) | 638 | if (!dev->db_tab) |
639 | return -ENOMEM; | 639 | return -ENOMEM; |
640 | 640 | ||
641 | init_MUTEX(&dev->db_tab->mutex); | 641 | mutex_init(&dev->db_tab->mutex); |
642 | 642 | ||
643 | dev->db_tab->npages = dev->uar_table.uarc_size / 4096; | 643 | dev->db_tab->npages = dev->uar_table.uarc_size / 4096; |
644 | dev->db_tab->max_group1 = 0; | 644 | dev->db_tab->max_group1 = 0; |
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.h b/drivers/infiniband/hw/mthca/mthca_memfree.h index 4fdca26eea85..36f1141a08aa 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.h +++ b/drivers/infiniband/hw/mthca/mthca_memfree.h | |||
@@ -39,8 +39,7 @@ | |||
39 | 39 | ||
40 | #include <linux/list.h> | 40 | #include <linux/list.h> |
41 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
42 | 42 | #include <linux/mutex.h> | |
43 | #include <asm/semaphore.h> | ||
44 | 43 | ||
45 | #define MTHCA_ICM_CHUNK_LEN \ | 44 | #define MTHCA_ICM_CHUNK_LEN \ |
46 | ((256 - sizeof (struct list_head) - 2 * sizeof (int)) / \ | 45 | ((256 - sizeof (struct list_head) - 2 * sizeof (int)) / \ |
@@ -64,7 +63,7 @@ struct mthca_icm_table { | |||
64 | int num_obj; | 63 | int num_obj; |
65 | int obj_size; | 64 | int obj_size; |
66 | int lowmem; | 65 | int lowmem; |
67 | struct semaphore mutex; | 66 | struct mutex mutex; |
68 | struct mthca_icm *icm[0]; | 67 | struct mthca_icm *icm[0]; |
69 | }; | 68 | }; |
70 | 69 | ||
@@ -147,7 +146,7 @@ struct mthca_db_table { | |||
147 | int max_group1; | 146 | int max_group1; |
148 | int min_group2; | 147 | int min_group2; |
149 | struct mthca_db_page *page; | 148 | struct mthca_db_page *page; |
150 | struct semaphore mutex; | 149 | struct mutex mutex; |
151 | }; | 150 | }; |
152 | 151 | ||
153 | enum mthca_db_type { | 152 | enum mthca_db_type { |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 484a7e6b7f8c..e88e39aef85a 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
@@ -185,7 +185,7 @@ static int mthca_modify_port(struct ib_device *ibdev, | |||
185 | int err; | 185 | int err; |
186 | u8 status; | 186 | u8 status; |
187 | 187 | ||
188 | if (down_interruptible(&to_mdev(ibdev)->cap_mask_mutex)) | 188 | if (mutex_lock_interruptible(&to_mdev(ibdev)->cap_mask_mutex)) |
189 | return -ERESTARTSYS; | 189 | return -ERESTARTSYS; |
190 | 190 | ||
191 | err = mthca_query_port(ibdev, port, &attr); | 191 | err = mthca_query_port(ibdev, port, &attr); |
@@ -207,7 +207,7 @@ static int mthca_modify_port(struct ib_device *ibdev, | |||
207 | } | 207 | } |
208 | 208 | ||
209 | out: | 209 | out: |
210 | up(&to_mdev(ibdev)->cap_mask_mutex); | 210 | mutex_unlock(&to_mdev(ibdev)->cap_mask_mutex); |
211 | return err; | 211 | return err; |
212 | } | 212 | } |
213 | 213 | ||
@@ -1185,7 +1185,7 @@ int mthca_register_device(struct mthca_dev *dev) | |||
1185 | dev->ib_dev.post_recv = mthca_tavor_post_receive; | 1185 | dev->ib_dev.post_recv = mthca_tavor_post_receive; |
1186 | } | 1186 | } |
1187 | 1187 | ||
1188 | init_MUTEX(&dev->cap_mask_mutex); | 1188 | mutex_init(&dev->cap_mask_mutex); |
1189 | 1189 | ||
1190 | ret = ib_register_device(&dev->ib_dev); | 1190 | ret = ib_register_device(&dev->ib_dev); |
1191 | if (ret) | 1191 | if (ret) |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index fd3f5c862a5d..c3b5f79d1168 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -505,7 +505,7 @@ static void neigh_add_path(struct sk_buff *skb, struct net_device *dev) | |||
505 | 505 | ||
506 | list_add_tail(&neigh->list, &path->neigh_list); | 506 | list_add_tail(&neigh->list, &path->neigh_list); |
507 | 507 | ||
508 | if (path->pathrec.dlid) { | 508 | if (path->ah) { |
509 | kref_get(&path->ah->ref); | 509 | kref_get(&path->ah->ref); |
510 | neigh->ah = path->ah; | 510 | neigh->ah = path->ah; |
511 | 511 | ||
@@ -591,7 +591,7 @@ static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev, | |||
591 | return; | 591 | return; |
592 | } | 592 | } |
593 | 593 | ||
594 | if (path->pathrec.dlid) { | 594 | if (path->ah) { |
595 | ipoib_dbg(priv, "Send unicast ARP to %04x\n", | 595 | ipoib_dbg(priv, "Send unicast ARP to %04x\n", |
596 | be16_to_cpu(path->pathrec.dlid)); | 596 | be16_to_cpu(path->pathrec.dlid)); |
597 | 597 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 98039da0caf0..ccaa0c387076 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -97,6 +97,7 @@ static void ipoib_mcast_free(struct ipoib_mcast *mcast) | |||
97 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 97 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
98 | struct ipoib_neigh *neigh, *tmp; | 98 | struct ipoib_neigh *neigh, *tmp; |
99 | unsigned long flags; | 99 | unsigned long flags; |
100 | int tx_dropped = 0; | ||
100 | 101 | ||
101 | ipoib_dbg_mcast(netdev_priv(dev), | 102 | ipoib_dbg_mcast(netdev_priv(dev), |
102 | "deleting multicast group " IPOIB_GID_FMT "\n", | 103 | "deleting multicast group " IPOIB_GID_FMT "\n", |
@@ -123,8 +124,14 @@ static void ipoib_mcast_free(struct ipoib_mcast *mcast) | |||
123 | if (mcast->ah) | 124 | if (mcast->ah) |
124 | ipoib_put_ah(mcast->ah); | 125 | ipoib_put_ah(mcast->ah); |
125 | 126 | ||
126 | while (!skb_queue_empty(&mcast->pkt_queue)) | 127 | while (!skb_queue_empty(&mcast->pkt_queue)) { |
128 | ++tx_dropped; | ||
127 | dev_kfree_skb_any(skb_dequeue(&mcast->pkt_queue)); | 129 | dev_kfree_skb_any(skb_dequeue(&mcast->pkt_queue)); |
130 | } | ||
131 | |||
132 | spin_lock_irqsave(&priv->tx_lock, flags); | ||
133 | priv->stats.tx_dropped += tx_dropped; | ||
134 | spin_unlock_irqrestore(&priv->tx_lock, flags); | ||
128 | 135 | ||
129 | kfree(mcast); | 136 | kfree(mcast); |
130 | } | 137 | } |
@@ -276,8 +283,10 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, | |||
276 | } | 283 | } |
277 | 284 | ||
278 | /* actually send any queued packets */ | 285 | /* actually send any queued packets */ |
286 | spin_lock_irq(&priv->tx_lock); | ||
279 | while (!skb_queue_empty(&mcast->pkt_queue)) { | 287 | while (!skb_queue_empty(&mcast->pkt_queue)) { |
280 | struct sk_buff *skb = skb_dequeue(&mcast->pkt_queue); | 288 | struct sk_buff *skb = skb_dequeue(&mcast->pkt_queue); |
289 | spin_unlock_irq(&priv->tx_lock); | ||
281 | 290 | ||
282 | skb->dev = dev; | 291 | skb->dev = dev; |
283 | 292 | ||
@@ -288,7 +297,9 @@ static int ipoib_mcast_join_finish(struct ipoib_mcast *mcast, | |||
288 | 297 | ||
289 | if (dev_queue_xmit(skb)) | 298 | if (dev_queue_xmit(skb)) |
290 | ipoib_warn(priv, "dev_queue_xmit failed to requeue packet\n"); | 299 | ipoib_warn(priv, "dev_queue_xmit failed to requeue packet\n"); |
300 | spin_lock_irq(&priv->tx_lock); | ||
291 | } | 301 | } |
302 | spin_unlock_irq(&priv->tx_lock); | ||
292 | 303 | ||
293 | return 0; | 304 | return 0; |
294 | } | 305 | } |
@@ -300,6 +311,7 @@ ipoib_mcast_sendonly_join_complete(int status, | |||
300 | { | 311 | { |
301 | struct ipoib_mcast *mcast = mcast_ptr; | 312 | struct ipoib_mcast *mcast = mcast_ptr; |
302 | struct net_device *dev = mcast->dev; | 313 | struct net_device *dev = mcast->dev; |
314 | struct ipoib_dev_priv *priv = netdev_priv(dev); | ||
303 | 315 | ||
304 | if (!status) | 316 | if (!status) |
305 | ipoib_mcast_join_finish(mcast, mcmember); | 317 | ipoib_mcast_join_finish(mcast, mcmember); |
@@ -310,8 +322,12 @@ ipoib_mcast_sendonly_join_complete(int status, | |||
310 | IPOIB_GID_ARG(mcast->mcmember.mgid), status); | 322 | IPOIB_GID_ARG(mcast->mcmember.mgid), status); |
311 | 323 | ||
312 | /* Flush out any queued packets */ | 324 | /* Flush out any queued packets */ |
313 | while (!skb_queue_empty(&mcast->pkt_queue)) | 325 | spin_lock_irq(&priv->tx_lock); |
326 | while (!skb_queue_empty(&mcast->pkt_queue)) { | ||
327 | ++priv->stats.tx_dropped; | ||
314 | dev_kfree_skb_any(skb_dequeue(&mcast->pkt_queue)); | 328 | dev_kfree_skb_any(skb_dequeue(&mcast->pkt_queue)); |
329 | } | ||
330 | spin_unlock_irq(&priv->tx_lock); | ||
315 | 331 | ||
316 | /* Clear the busy flag so we try again */ | 332 | /* Clear the busy flag so we try again */ |
317 | clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); | 333 | clear_bit(IPOIB_MCAST_FLAG_BUSY, &mcast->flags); |
@@ -687,6 +703,7 @@ void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid, | |||
687 | if (!mcast) { | 703 | if (!mcast) { |
688 | ipoib_warn(priv, "unable to allocate memory for " | 704 | ipoib_warn(priv, "unable to allocate memory for " |
689 | "multicast structure\n"); | 705 | "multicast structure\n"); |
706 | ++priv->stats.tx_dropped; | ||
690 | dev_kfree_skb_any(skb); | 707 | dev_kfree_skb_any(skb); |
691 | goto out; | 708 | goto out; |
692 | } | 709 | } |
@@ -700,8 +717,10 @@ void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid, | |||
700 | if (!mcast->ah) { | 717 | if (!mcast->ah) { |
701 | if (skb_queue_len(&mcast->pkt_queue) < IPOIB_MAX_MCAST_QUEUE) | 718 | if (skb_queue_len(&mcast->pkt_queue) < IPOIB_MAX_MCAST_QUEUE) |
702 | skb_queue_tail(&mcast->pkt_queue, skb); | 719 | skb_queue_tail(&mcast->pkt_queue, skb); |
703 | else | 720 | else { |
721 | ++priv->stats.tx_dropped; | ||
704 | dev_kfree_skb_any(skb); | 722 | dev_kfree_skb_any(skb); |
723 | } | ||
705 | 724 | ||
706 | if (mcast->query) | 725 | if (mcast->query) |
707 | ipoib_dbg_mcast(priv, "no address vector, " | 726 | ipoib_dbg_mcast(priv, "no address vector, " |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 31207e664148..2d2d4ac3525a 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -357,9 +357,9 @@ static void srp_remove_work(void *target_ptr) | |||
357 | target->state = SRP_TARGET_REMOVED; | 357 | target->state = SRP_TARGET_REMOVED; |
358 | spin_unlock_irq(target->scsi_host->host_lock); | 358 | spin_unlock_irq(target->scsi_host->host_lock); |
359 | 359 | ||
360 | down(&target->srp_host->target_mutex); | 360 | mutex_lock(&target->srp_host->target_mutex); |
361 | list_del(&target->list); | 361 | list_del(&target->list); |
362 | up(&target->srp_host->target_mutex); | 362 | mutex_unlock(&target->srp_host->target_mutex); |
363 | 363 | ||
364 | scsi_remove_host(target->scsi_host); | 364 | scsi_remove_host(target->scsi_host); |
365 | ib_destroy_cm_id(target->cm_id); | 365 | ib_destroy_cm_id(target->cm_id); |
@@ -1254,9 +1254,9 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target) | |||
1254 | if (scsi_add_host(target->scsi_host, host->dev->dma_device)) | 1254 | if (scsi_add_host(target->scsi_host, host->dev->dma_device)) |
1255 | return -ENODEV; | 1255 | return -ENODEV; |
1256 | 1256 | ||
1257 | down(&host->target_mutex); | 1257 | mutex_lock(&host->target_mutex); |
1258 | list_add_tail(&target->list, &host->target_list); | 1258 | list_add_tail(&target->list, &host->target_list); |
1259 | up(&host->target_mutex); | 1259 | mutex_unlock(&host->target_mutex); |
1260 | 1260 | ||
1261 | target->state = SRP_TARGET_LIVE; | 1261 | target->state = SRP_TARGET_LIVE; |
1262 | 1262 | ||
@@ -1525,7 +1525,7 @@ static struct srp_host *srp_add_port(struct ib_device *device, u8 port) | |||
1525 | return NULL; | 1525 | return NULL; |
1526 | 1526 | ||
1527 | INIT_LIST_HEAD(&host->target_list); | 1527 | INIT_LIST_HEAD(&host->target_list); |
1528 | init_MUTEX(&host->target_mutex); | 1528 | mutex_init(&host->target_mutex); |
1529 | init_completion(&host->released); | 1529 | init_completion(&host->released); |
1530 | host->dev = device; | 1530 | host->dev = device; |
1531 | host->port = port; | 1531 | host->port = port; |
@@ -1626,7 +1626,7 @@ static void srp_remove_one(struct ib_device *device) | |||
1626 | * Mark all target ports as removed, so we stop queueing | 1626 | * Mark all target ports as removed, so we stop queueing |
1627 | * commands and don't try to reconnect. | 1627 | * commands and don't try to reconnect. |
1628 | */ | 1628 | */ |
1629 | down(&host->target_mutex); | 1629 | mutex_lock(&host->target_mutex); |
1630 | list_for_each_entry_safe(target, tmp_target, | 1630 | list_for_each_entry_safe(target, tmp_target, |
1631 | &host->target_list, list) { | 1631 | &host->target_list, list) { |
1632 | spin_lock_irqsave(target->scsi_host->host_lock, flags); | 1632 | spin_lock_irqsave(target->scsi_host->host_lock, flags); |
@@ -1634,7 +1634,7 @@ static void srp_remove_one(struct ib_device *device) | |||
1634 | target->state = SRP_TARGET_REMOVED; | 1634 | target->state = SRP_TARGET_REMOVED; |
1635 | spin_unlock_irqrestore(target->scsi_host->host_lock, flags); | 1635 | spin_unlock_irqrestore(target->scsi_host->host_lock, flags); |
1636 | } | 1636 | } |
1637 | up(&host->target_mutex); | 1637 | mutex_unlock(&host->target_mutex); |
1638 | 1638 | ||
1639 | /* | 1639 | /* |
1640 | * Wait for any reconnection tasks that may have | 1640 | * Wait for any reconnection tasks that may have |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index b564f18caf78..4e7727df32f1 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h | |||
@@ -37,8 +37,7 @@ | |||
37 | 37 | ||
38 | #include <linux/types.h> | 38 | #include <linux/types.h> |
39 | #include <linux/list.h> | 39 | #include <linux/list.h> |
40 | 40 | #include <linux/mutex.h> | |
41 | #include <asm/semaphore.h> | ||
42 | 41 | ||
43 | #include <scsi/scsi_host.h> | 42 | #include <scsi/scsi_host.h> |
44 | #include <scsi/scsi_cmnd.h> | 43 | #include <scsi/scsi_cmnd.h> |
@@ -85,7 +84,7 @@ struct srp_host { | |||
85 | struct ib_mr *mr; | 84 | struct ib_mr *mr; |
86 | struct class_device class_dev; | 85 | struct class_device class_dev; |
87 | struct list_head target_list; | 86 | struct list_head target_list; |
88 | struct semaphore target_mutex; | 87 | struct mutex target_mutex; |
89 | struct completion released; | 88 | struct completion released; |
90 | struct list_head list; | 89 | struct list_head list; |
91 | }; | 90 | }; |
diff --git a/drivers/input/joystick/a3d.c b/drivers/input/joystick/a3d.c index 4571ea3a4b92..4612d13ea756 100644 --- a/drivers/input/joystick/a3d.c +++ b/drivers/input/joystick/a3d.c | |||
@@ -57,7 +57,7 @@ static char *a3d_names[] = { NULL, "FP-Gaming Assassin 3D", "MadCatz Panther", " | |||
57 | struct a3d { | 57 | struct a3d { |
58 | struct gameport *gameport; | 58 | struct gameport *gameport; |
59 | struct gameport *adc; | 59 | struct gameport *adc; |
60 | struct input_dev dev; | 60 | struct input_dev *dev; |
61 | int axes[4]; | 61 | int axes[4]; |
62 | int buttons; | 62 | int buttons; |
63 | int mode; | 63 | int mode; |
@@ -115,7 +115,7 @@ static int a3d_csum(char *data, int count) | |||
115 | 115 | ||
116 | static void a3d_read(struct a3d *a3d, unsigned char *data) | 116 | static void a3d_read(struct a3d *a3d, unsigned char *data) |
117 | { | 117 | { |
118 | struct input_dev *dev = &a3d->dev; | 118 | struct input_dev *dev = a3d->dev; |
119 | 119 | ||
120 | switch (a3d->mode) { | 120 | switch (a3d->mode) { |
121 | 121 | ||
@@ -265,14 +265,20 @@ static void a3d_close(struct input_dev *dev) | |||
265 | static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv) | 265 | static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv) |
266 | { | 266 | { |
267 | struct a3d *a3d; | 267 | struct a3d *a3d; |
268 | struct input_dev *input_dev; | ||
268 | struct gameport *adc; | 269 | struct gameport *adc; |
269 | unsigned char data[A3D_MAX_LENGTH]; | 270 | unsigned char data[A3D_MAX_LENGTH]; |
270 | int i; | 271 | int i; |
271 | int err; | 272 | int err; |
272 | 273 | ||
273 | if (!(a3d = kzalloc(sizeof(struct a3d), GFP_KERNEL))) | 274 | a3d = kzalloc(sizeof(struct a3d), GFP_KERNEL); |
274 | return -ENOMEM; | 275 | input_dev = input_allocate_device(); |
276 | if (!a3d || !input_dev) { | ||
277 | err = -ENOMEM; | ||
278 | goto fail1; | ||
279 | } | ||
275 | 280 | ||
281 | a3d->dev = input_dev; | ||
276 | a3d->gameport = gameport; | 282 | a3d->gameport = gameport; |
277 | 283 | ||
278 | gameport_set_drvdata(gameport, a3d); | 284 | gameport_set_drvdata(gameport, a3d); |
@@ -302,42 +308,48 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
302 | 308 | ||
303 | sprintf(a3d->phys, "%s/input0", gameport->phys); | 309 | sprintf(a3d->phys, "%s/input0", gameport->phys); |
304 | 310 | ||
311 | input_dev->name = a3d_names[a3d->mode]; | ||
312 | input_dev->phys = a3d->phys; | ||
313 | input_dev->id.bustype = BUS_GAMEPORT; | ||
314 | input_dev->id.vendor = GAMEPORT_ID_VENDOR_MADCATZ; | ||
315 | input_dev->id.product = a3d->mode; | ||
316 | input_dev->id.version = 0x0100; | ||
317 | input_dev->cdev.dev = &gameport->dev; | ||
318 | input_dev->private = a3d; | ||
319 | input_dev->open = a3d_open; | ||
320 | input_dev->close = a3d_close; | ||
321 | |||
305 | if (a3d->mode == A3D_MODE_PXL) { | 322 | if (a3d->mode == A3D_MODE_PXL) { |
306 | 323 | ||
307 | int axes[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER }; | 324 | int axes[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER }; |
308 | 325 | ||
309 | a3d->length = 33; | 326 | a3d->length = 33; |
310 | 327 | ||
311 | init_input_dev(&a3d->dev); | 328 | input_dev->evbit[0] |= BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL); |
312 | 329 | input_dev->relbit[0] |= BIT(REL_X) | BIT(REL_Y); | |
313 | a3d->dev.evbit[0] |= BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL); | 330 | input_dev->absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_RUDDER) |
314 | a3d->dev.relbit[0] |= BIT(REL_X) | BIT(REL_Y); | 331 | | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y) | BIT(ABS_HAT1X) | BIT(ABS_HAT1Y); |
315 | a3d->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_RUDDER) | 332 | input_dev->keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE) |
316 | | BIT(ABS_HAT0X) | BIT(ABS_HAT0Y) | BIT(ABS_HAT1X) | BIT(ABS_HAT1Y); | 333 | | BIT(BTN_SIDE) | BIT(BTN_EXTRA); |
317 | 334 | input_dev->keybit[LONG(BTN_JOYSTICK)] |= BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | |
318 | a3d->dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | 335 | | BIT(BTN_PINKIE); |
319 | | BIT(BTN_SIDE) | BIT(BTN_EXTRA); | ||
320 | |||
321 | a3d->dev.keybit[LONG(BTN_JOYSTICK)] |= BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_PINKIE); | ||
322 | 336 | ||
323 | a3d_read(a3d, data); | 337 | a3d_read(a3d, data); |
324 | 338 | ||
325 | for (i = 0; i < 4; i++) { | 339 | for (i = 0; i < 4; i++) { |
326 | if (i < 2) | 340 | if (i < 2) |
327 | input_set_abs_params(&a3d->dev, axes[i], 48, a3d->dev.abs[axes[i]] * 2 - 48, 0, 8); | 341 | input_set_abs_params(input_dev, axes[i], 48, input_dev->abs[axes[i]] * 2 - 48, 0, 8); |
328 | else | 342 | else |
329 | input_set_abs_params(&a3d->dev, axes[i], 2, 253, 0, 0); | 343 | input_set_abs_params(input_dev, axes[i], 2, 253, 0, 0); |
330 | input_set_abs_params(&a3d->dev, ABS_HAT0X + i, -1, 1, 0, 0); | 344 | input_set_abs_params(input_dev, ABS_HAT0X + i, -1, 1, 0, 0); |
331 | } | 345 | } |
332 | 346 | ||
333 | } else { | 347 | } else { |
334 | a3d->length = 29; | 348 | a3d->length = 29; |
335 | 349 | ||
336 | init_input_dev(&a3d->dev); | 350 | input_dev->evbit[0] |= BIT(EV_KEY) | BIT(EV_REL); |
337 | 351 | input_dev->relbit[0] |= BIT(REL_X) | BIT(REL_Y); | |
338 | a3d->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_REL); | 352 | input_dev->keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE); |
339 | a3d->dev.relbit[0] |= BIT(REL_X) | BIT(REL_Y); | ||
340 | a3d->dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE); | ||
341 | 353 | ||
342 | a3d_read(a3d, data); | 354 | a3d_read(a3d, data); |
343 | 355 | ||
@@ -358,24 +370,17 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
358 | } | 370 | } |
359 | } | 371 | } |
360 | 372 | ||
361 | a3d->dev.private = a3d; | 373 | err = input_register_device(a3d->dev); |
362 | a3d->dev.open = a3d_open; | 374 | if (err) |
363 | a3d->dev.close = a3d_close; | 375 | goto fail3; |
364 | |||
365 | a3d->dev.name = a3d_names[a3d->mode]; | ||
366 | a3d->dev.phys = a3d->phys; | ||
367 | a3d->dev.id.bustype = BUS_GAMEPORT; | ||
368 | a3d->dev.id.vendor = GAMEPORT_ID_VENDOR_MADCATZ; | ||
369 | a3d->dev.id.product = a3d->mode; | ||
370 | a3d->dev.id.version = 0x0100; | ||
371 | |||
372 | input_register_device(&a3d->dev); | ||
373 | printk(KERN_INFO "input: %s on %s\n", a3d_names[a3d->mode], a3d->phys); | ||
374 | 376 | ||
375 | return 0; | 377 | return 0; |
376 | 378 | ||
377 | fail2: gameport_close(gameport); | 379 | fail3: if (a3d->adc) |
378 | fail1: gameport_set_drvdata(gameport, NULL); | 380 | gameport_unregister_port(a3d->adc); |
381 | fail2: gameport_close(gameport); | ||
382 | fail1: gameport_set_drvdata(gameport, NULL); | ||
383 | input_free_device(input_dev); | ||
379 | kfree(a3d); | 384 | kfree(a3d); |
380 | return err; | 385 | return err; |
381 | } | 386 | } |
@@ -384,11 +389,9 @@ static void a3d_disconnect(struct gameport *gameport) | |||
384 | { | 389 | { |
385 | struct a3d *a3d = gameport_get_drvdata(gameport); | 390 | struct a3d *a3d = gameport_get_drvdata(gameport); |
386 | 391 | ||
387 | input_unregister_device(&a3d->dev); | 392 | input_unregister_device(a3d->dev); |
388 | if (a3d->adc) { | 393 | if (a3d->adc) |
389 | gameport_unregister_port(a3d->adc); | 394 | gameport_unregister_port(a3d->adc); |
390 | a3d->adc = NULL; | ||
391 | } | ||
392 | gameport_close(gameport); | 395 | gameport_close(gameport); |
393 | gameport_set_drvdata(gameport, NULL); | 396 | gameport_set_drvdata(gameport, NULL); |
394 | kfree(a3d); | 397 | kfree(a3d); |
@@ -397,6 +400,7 @@ static void a3d_disconnect(struct gameport *gameport) | |||
397 | static struct gameport_driver a3d_drv = { | 400 | static struct gameport_driver a3d_drv = { |
398 | .driver = { | 401 | .driver = { |
399 | .name = "adc", | 402 | .name = "adc", |
403 | .owner = THIS_MODULE, | ||
400 | }, | 404 | }, |
401 | .description = DRIVER_DESC, | 405 | .description = DRIVER_DESC, |
402 | .connect = a3d_connect, | 406 | .connect = a3d_connect, |
diff --git a/drivers/input/joystick/db9.c b/drivers/input/joystick/db9.c index 499344c72756..dcffc34f30c3 100644 --- a/drivers/input/joystick/db9.c +++ b/drivers/input/joystick/db9.c | |||
@@ -275,68 +275,70 @@ static unsigned char db9_saturn_read_packet(struct parport *port, unsigned char | |||
275 | /* | 275 | /* |
276 | * db9_saturn_report() analyzes packet and reports. | 276 | * db9_saturn_report() analyzes packet and reports. |
277 | */ | 277 | */ |
278 | static int db9_saturn_report(unsigned char id, unsigned char data[60], struct input_dev *dev, int n, int max_pads) | 278 | static int db9_saturn_report(unsigned char id, unsigned char data[60], struct input_dev *devs[], int n, int max_pads) |
279 | { | 279 | { |
280 | struct input_dev *dev; | ||
280 | int tmp, i, j; | 281 | int tmp, i, j; |
281 | 282 | ||
282 | tmp = (id == 0x41) ? 60 : 10; | 283 | tmp = (id == 0x41) ? 60 : 10; |
283 | for (j = 0; (j < tmp) && (n < max_pads); j += 10, n++) { | 284 | for (j = 0; j < tmp && n < max_pads; j += 10, n++) { |
285 | dev = devs[n]; | ||
284 | switch (data[j]) { | 286 | switch (data[j]) { |
285 | case 0x16: /* multi controller (analog 4 axis) */ | 287 | case 0x16: /* multi controller (analog 4 axis) */ |
286 | input_report_abs(dev + n, db9_abs[5], data[j + 6]); | 288 | input_report_abs(dev, db9_abs[5], data[j + 6]); |
287 | case 0x15: /* mission stick (analog 3 axis) */ | 289 | case 0x15: /* mission stick (analog 3 axis) */ |
288 | input_report_abs(dev + n, db9_abs[3], data[j + 4]); | 290 | input_report_abs(dev, db9_abs[3], data[j + 4]); |
289 | input_report_abs(dev + n, db9_abs[4], data[j + 5]); | 291 | input_report_abs(dev, db9_abs[4], data[j + 5]); |
290 | case 0x13: /* racing controller (analog 1 axis) */ | 292 | case 0x13: /* racing controller (analog 1 axis) */ |
291 | input_report_abs(dev + n, db9_abs[2], data[j + 3]); | 293 | input_report_abs(dev, db9_abs[2], data[j + 3]); |
292 | case 0x34: /* saturn keyboard (udlr ZXC ASD QE Esc) */ | 294 | case 0x34: /* saturn keyboard (udlr ZXC ASD QE Esc) */ |
293 | case 0x02: /* digital pad (digital 2 axis + buttons) */ | 295 | case 0x02: /* digital pad (digital 2 axis + buttons) */ |
294 | input_report_abs(dev + n, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64)); | 296 | input_report_abs(dev, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64)); |
295 | input_report_abs(dev + n, db9_abs[1], !(data[j + 1] & 32) - !(data[j + 1] & 16)); | 297 | input_report_abs(dev, db9_abs[1], !(data[j + 1] & 32) - !(data[j + 1] & 16)); |
296 | for (i = 0; i < 9; i++) | 298 | for (i = 0; i < 9; i++) |
297 | input_report_key(dev + n, db9_cd32_btn[i], ~data[j + db9_saturn_byte[i]] & db9_saturn_mask[i]); | 299 | input_report_key(dev, db9_cd32_btn[i], ~data[j + db9_saturn_byte[i]] & db9_saturn_mask[i]); |
298 | break; | 300 | break; |
299 | case 0x19: /* mission stick x2 (analog 6 axis + buttons) */ | 301 | case 0x19: /* mission stick x2 (analog 6 axis + buttons) */ |
300 | input_report_abs(dev + n, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64)); | 302 | input_report_abs(dev, db9_abs[0], !(data[j + 1] & 128) - !(data[j + 1] & 64)); |
301 | input_report_abs(dev + n, db9_abs[1], !(data[j + 1] & 32) - !(data[j + 1] & 16)); | 303 | input_report_abs(dev, db9_abs[1], !(data[j + 1] & 32) - !(data[j + 1] & 16)); |
302 | for (i = 0; i < 9; i++) | 304 | for (i = 0; i < 9; i++) |
303 | input_report_key(dev + n, db9_cd32_btn[i], ~data[j + db9_saturn_byte[i]] & db9_saturn_mask[i]); | 305 | input_report_key(dev, db9_cd32_btn[i], ~data[j + db9_saturn_byte[i]] & db9_saturn_mask[i]); |
304 | input_report_abs(dev + n, db9_abs[2], data[j + 3]); | 306 | input_report_abs(dev, db9_abs[2], data[j + 3]); |
305 | input_report_abs(dev + n, db9_abs[3], data[j + 4]); | 307 | input_report_abs(dev, db9_abs[3], data[j + 4]); |
306 | input_report_abs(dev + n, db9_abs[4], data[j + 5]); | 308 | input_report_abs(dev, db9_abs[4], data[j + 5]); |
307 | /* | 309 | /* |
308 | input_report_abs(dev + n, db9_abs[8], (data[j + 6] & 128 ? 0 : 1) - (data[j + 6] & 64 ? 0 : 1)); | 310 | input_report_abs(dev, db9_abs[8], (data[j + 6] & 128 ? 0 : 1) - (data[j + 6] & 64 ? 0 : 1)); |
309 | input_report_abs(dev + n, db9_abs[9], (data[j + 6] & 32 ? 0 : 1) - (data[j + 6] & 16 ? 0 : 1)); | 311 | input_report_abs(dev, db9_abs[9], (data[j + 6] & 32 ? 0 : 1) - (data[j + 6] & 16 ? 0 : 1)); |
310 | */ | 312 | */ |
311 | input_report_abs(dev + n, db9_abs[6], data[j + 7]); | 313 | input_report_abs(dev, db9_abs[6], data[j + 7]); |
312 | input_report_abs(dev + n, db9_abs[7], data[j + 8]); | 314 | input_report_abs(dev, db9_abs[7], data[j + 8]); |
313 | input_report_abs(dev + n, db9_abs[5], data[j + 9]); | 315 | input_report_abs(dev, db9_abs[5], data[j + 9]); |
314 | break; | 316 | break; |
315 | case 0xd3: /* sankyo ff (analog 1 axis + stop btn) */ | 317 | case 0xd3: /* sankyo ff (analog 1 axis + stop btn) */ |
316 | input_report_key(dev + n, BTN_A, data[j + 3] & 0x80); | 318 | input_report_key(dev, BTN_A, data[j + 3] & 0x80); |
317 | input_report_abs(dev + n, db9_abs[2], data[j + 3] & 0x7f); | 319 | input_report_abs(dev, db9_abs[2], data[j + 3] & 0x7f); |
318 | break; | 320 | break; |
319 | case 0xe3: /* shuttle mouse (analog 2 axis + buttons. signed value) */ | 321 | case 0xe3: /* shuttle mouse (analog 2 axis + buttons. signed value) */ |
320 | input_report_key(dev + n, BTN_START, data[j + 1] & 0x08); | 322 | input_report_key(dev, BTN_START, data[j + 1] & 0x08); |
321 | input_report_key(dev + n, BTN_A, data[j + 1] & 0x04); | 323 | input_report_key(dev, BTN_A, data[j + 1] & 0x04); |
322 | input_report_key(dev + n, BTN_C, data[j + 1] & 0x02); | 324 | input_report_key(dev, BTN_C, data[j + 1] & 0x02); |
323 | input_report_key(dev + n, BTN_B, data[j + 1] & 0x01); | 325 | input_report_key(dev, BTN_B, data[j + 1] & 0x01); |
324 | input_report_abs(dev + n, db9_abs[2], data[j + 2] ^ 0x80); | 326 | input_report_abs(dev, db9_abs[2], data[j + 2] ^ 0x80); |
325 | input_report_abs(dev + n, db9_abs[3], (0xff-(data[j + 3] ^ 0x80))+1); /* */ | 327 | input_report_abs(dev, db9_abs[3], (0xff-(data[j + 3] ^ 0x80))+1); /* */ |
326 | break; | 328 | break; |
327 | case 0xff: | 329 | case 0xff: |
328 | default: /* no pad */ | 330 | default: /* no pad */ |
329 | input_report_abs(dev + n, db9_abs[0], 0); | 331 | input_report_abs(dev, db9_abs[0], 0); |
330 | input_report_abs(dev + n, db9_abs[1], 0); | 332 | input_report_abs(dev, db9_abs[1], 0); |
331 | for (i = 0; i < 9; i++) | 333 | for (i = 0; i < 9; i++) |
332 | input_report_key(dev + n, db9_cd32_btn[i], 0); | 334 | input_report_key(dev, db9_cd32_btn[i], 0); |
333 | break; | 335 | break; |
334 | } | 336 | } |
335 | } | 337 | } |
336 | return n; | 338 | return n; |
337 | } | 339 | } |
338 | 340 | ||
339 | static int db9_saturn(int mode, struct parport *port, struct input_dev *dev) | 341 | static int db9_saturn(int mode, struct parport *port, struct input_dev *devs[]) |
340 | { | 342 | { |
341 | unsigned char id, data[60]; | 343 | unsigned char id, data[60]; |
342 | int type, n, max_pads; | 344 | int type, n, max_pads; |
@@ -361,7 +363,7 @@ static int db9_saturn(int mode, struct parport *port, struct input_dev *dev) | |||
361 | max_pads = min(db9_modes[mode].n_pads, DB9_MAX_DEVICES); | 363 | max_pads = min(db9_modes[mode].n_pads, DB9_MAX_DEVICES); |
362 | for (tmp = 0, i = 0; i < n; i++) { | 364 | for (tmp = 0, i = 0; i < n; i++) { |
363 | id = db9_saturn_read_packet(port, data, type + i, 1); | 365 | id = db9_saturn_read_packet(port, data, type + i, 1); |
364 | tmp = db9_saturn_report(id, data, dev, tmp, max_pads); | 366 | tmp = db9_saturn_report(id, data, devs, tmp, max_pads); |
365 | } | 367 | } |
366 | return 0; | 368 | return 0; |
367 | } | 369 | } |
@@ -489,7 +491,7 @@ static void db9_timer(unsigned long private) | |||
489 | case DB9_SATURN_DPP: | 491 | case DB9_SATURN_DPP: |
490 | case DB9_SATURN_DPP_2: | 492 | case DB9_SATURN_DPP_2: |
491 | 493 | ||
492 | db9_saturn(db9->mode, port, dev); | 494 | db9_saturn(db9->mode, port, db9->dev); |
493 | break; | 495 | break; |
494 | 496 | ||
495 | case DB9_CD32_PAD: | 497 | case DB9_CD32_PAD: |
@@ -614,7 +616,7 @@ static struct db9 __init *db9_probe(int parport, int mode) | |||
614 | if (!input_dev) { | 616 | if (!input_dev) { |
615 | printk(KERN_ERR "db9.c: Not enough memory for input device\n"); | 617 | printk(KERN_ERR "db9.c: Not enough memory for input device\n"); |
616 | err = -ENOMEM; | 618 | err = -ENOMEM; |
617 | goto err_free_devs; | 619 | goto err_unreg_devs; |
618 | } | 620 | } |
619 | 621 | ||
620 | sprintf(db9->phys[i], "%s/input%d", db9->pd->port->name, i); | 622 | sprintf(db9->phys[i], "%s/input%d", db9->pd->port->name, i); |
@@ -640,13 +642,17 @@ static struct db9 __init *db9_probe(int parport, int mode) | |||
640 | input_set_abs_params(input_dev, db9_abs[j], 1, 255, 0, 0); | 642 | input_set_abs_params(input_dev, db9_abs[j], 1, 255, 0, 0); |
641 | } | 643 | } |
642 | 644 | ||
643 | input_register_device(input_dev); | 645 | err = input_register_device(input_dev); |
646 | if (err) | ||
647 | goto err_free_dev; | ||
644 | } | 648 | } |
645 | 649 | ||
646 | parport_put_port(pp); | 650 | parport_put_port(pp); |
647 | return db9; | 651 | return db9; |
648 | 652 | ||
649 | err_free_devs: | 653 | err_free_dev: |
654 | input_free_device(db9->dev[i]); | ||
655 | err_unreg_devs: | ||
650 | while (--i >= 0) | 656 | while (--i >= 0) |
651 | input_unregister_device(db9->dev[i]); | 657 | input_unregister_device(db9->dev[i]); |
652 | kfree(db9); | 658 | kfree(db9); |
@@ -658,7 +664,7 @@ static struct db9 __init *db9_probe(int parport, int mode) | |||
658 | return ERR_PTR(err); | 664 | return ERR_PTR(err); |
659 | } | 665 | } |
660 | 666 | ||
661 | static void __exit db9_remove(struct db9 *db9) | 667 | static void db9_remove(struct db9 *db9) |
662 | { | 668 | { |
663 | int i; | 669 | int i; |
664 | 670 | ||
@@ -696,7 +702,8 @@ static int __init db9_init(void) | |||
696 | 702 | ||
697 | if (err) { | 703 | if (err) { |
698 | while (--i >= 0) | 704 | while (--i >= 0) |
699 | db9_remove(db9_base[i]); | 705 | if (db9_base[i]) |
706 | db9_remove(db9_base[i]); | ||
700 | return err; | 707 | return err; |
701 | } | 708 | } |
702 | 709 | ||
diff --git a/drivers/input/joystick/gamecon.c b/drivers/input/joystick/gamecon.c index 7df2d82f2c83..900587acdb47 100644 --- a/drivers/input/joystick/gamecon.c +++ b/drivers/input/joystick/gamecon.c | |||
@@ -159,6 +159,48 @@ static void gc_n64_read_packet(struct gc *gc, unsigned char *data) | |||
159 | 159 | ||
160 | } | 160 | } |
161 | 161 | ||
162 | static void gc_n64_process_packet(struct gc *gc) | ||
163 | { | ||
164 | unsigned char data[GC_N64_LENGTH]; | ||
165 | signed char axes[2]; | ||
166 | struct input_dev *dev; | ||
167 | int i, j, s; | ||
168 | |||
169 | gc_n64_read_packet(gc, data); | ||
170 | |||
171 | for (i = 0; i < GC_MAX_DEVICES; i++) { | ||
172 | |||
173 | dev = gc->dev[i]; | ||
174 | if (!dev) | ||
175 | continue; | ||
176 | |||
177 | s = gc_status_bit[i]; | ||
178 | |||
179 | if (s & gc->pads[GC_N64] & ~(data[8] | data[9])) { | ||
180 | |||
181 | axes[0] = axes[1] = 0; | ||
182 | |||
183 | for (j = 0; j < 8; j++) { | ||
184 | if (data[23 - j] & s) | ||
185 | axes[0] |= 1 << j; | ||
186 | if (data[31 - j] & s) | ||
187 | axes[1] |= 1 << j; | ||
188 | } | ||
189 | |||
190 | input_report_abs(dev, ABS_X, axes[0]); | ||
191 | input_report_abs(dev, ABS_Y, -axes[1]); | ||
192 | |||
193 | input_report_abs(dev, ABS_HAT0X, !(s & data[6]) - !(s & data[7])); | ||
194 | input_report_abs(dev, ABS_HAT0Y, !(s & data[4]) - !(s & data[5])); | ||
195 | |||
196 | for (j = 0; j < 10; j++) | ||
197 | input_report_key(dev, gc_n64_btn[j], s & data[gc_n64_bytes[j]]); | ||
198 | |||
199 | input_sync(dev); | ||
200 | } | ||
201 | } | ||
202 | } | ||
203 | |||
162 | /* | 204 | /* |
163 | * NES/SNES support. | 205 | * NES/SNES support. |
164 | */ | 206 | */ |
@@ -198,6 +240,39 @@ static void gc_nes_read_packet(struct gc *gc, int length, unsigned char *data) | |||
198 | } | 240 | } |
199 | } | 241 | } |
200 | 242 | ||
243 | static void gc_nes_process_packet(struct gc *gc) | ||
244 | { | ||
245 | unsigned char data[GC_SNES_LENGTH]; | ||
246 | struct input_dev *dev; | ||
247 | int i, j, s; | ||
248 | |||
249 | gc_nes_read_packet(gc, gc->pads[GC_SNES] ? GC_SNES_LENGTH : GC_NES_LENGTH, data); | ||
250 | |||
251 | for (i = 0; i < GC_MAX_DEVICES; i++) { | ||
252 | |||
253 | dev = gc->dev[i]; | ||
254 | if (!dev) | ||
255 | continue; | ||
256 | |||
257 | s = gc_status_bit[i]; | ||
258 | |||
259 | if (s & (gc->pads[GC_NES] | gc->pads[GC_SNES])) { | ||
260 | input_report_abs(dev, ABS_X, !(s & data[6]) - !(s & data[7])); | ||
261 | input_report_abs(dev, ABS_Y, !(s & data[4]) - !(s & data[5])); | ||
262 | } | ||
263 | |||
264 | if (s & gc->pads[GC_NES]) | ||
265 | for (j = 0; j < 4; j++) | ||
266 | input_report_key(dev, gc_snes_btn[j], s & data[gc_nes_bytes[j]]); | ||
267 | |||
268 | if (s & gc->pads[GC_SNES]) | ||
269 | for (j = 0; j < 8; j++) | ||
270 | input_report_key(dev, gc_snes_btn[j], s & data[gc_snes_bytes[j]]); | ||
271 | |||
272 | input_sync(dev); | ||
273 | } | ||
274 | } | ||
275 | |||
201 | /* | 276 | /* |
202 | * Multisystem joystick support | 277 | * Multisystem joystick support |
203 | */ | 278 | */ |
@@ -219,6 +294,35 @@ static void gc_multi_read_packet(struct gc *gc, int length, unsigned char *data) | |||
219 | } | 294 | } |
220 | } | 295 | } |
221 | 296 | ||
297 | static void gc_multi_process_packet(struct gc *gc) | ||
298 | { | ||
299 | unsigned char data[GC_MULTI2_LENGTH]; | ||
300 | struct input_dev *dev; | ||
301 | int i, s; | ||
302 | |||
303 | gc_multi_read_packet(gc, gc->pads[GC_MULTI2] ? GC_MULTI2_LENGTH : GC_MULTI_LENGTH, data); | ||
304 | |||
305 | for (i = 0; i < GC_MAX_DEVICES; i++) { | ||
306 | |||
307 | dev = gc->dev[i]; | ||
308 | if (!dev) | ||
309 | continue; | ||
310 | |||
311 | s = gc_status_bit[i]; | ||
312 | |||
313 | if (s & (gc->pads[GC_MULTI] | gc->pads[GC_MULTI2])) { | ||
314 | input_report_abs(dev, ABS_X, !(s & data[2]) - !(s & data[3])); | ||
315 | input_report_abs(dev, ABS_Y, !(s & data[0]) - !(s & data[1])); | ||
316 | input_report_key(dev, BTN_TRIGGER, s & data[4]); | ||
317 | } | ||
318 | |||
319 | if (s & gc->pads[GC_MULTI2]) | ||
320 | input_report_key(dev, BTN_THUMB, s & data[5]); | ||
321 | |||
322 | input_sync(dev); | ||
323 | } | ||
324 | } | ||
325 | |||
222 | /* | 326 | /* |
223 | * PSX support | 327 | * PSX support |
224 | * | 328 | * |
@@ -263,10 +367,11 @@ static short gc_psx_ddr_btn[] = { BTN_0, BTN_1, BTN_2, BTN_3 }; | |||
263 | * the psx pad. | 367 | * the psx pad. |
264 | */ | 368 | */ |
265 | 369 | ||
266 | static void gc_psx_command(struct gc *gc, int b, unsigned char data[5]) | 370 | static void gc_psx_command(struct gc *gc, int b, unsigned char data[GC_MAX_DEVICES]) |
267 | { | 371 | { |
268 | int i, j, cmd, read; | 372 | int i, j, cmd, read; |
269 | for (i = 0; i < 5; i++) | 373 | |
374 | for (i = 0; i < GC_MAX_DEVICES; i++) | ||
270 | data[i] = 0; | 375 | data[i] = 0; |
271 | 376 | ||
272 | for (i = 0; i < GC_PSX_LENGTH; i++, b >>= 1) { | 377 | for (i = 0; i < GC_PSX_LENGTH; i++, b >>= 1) { |
@@ -274,7 +379,7 @@ static void gc_psx_command(struct gc *gc, int b, unsigned char data[5]) | |||
274 | parport_write_data(gc->pd->port, cmd | GC_PSX_POWER); | 379 | parport_write_data(gc->pd->port, cmd | GC_PSX_POWER); |
275 | udelay(gc_psx_delay); | 380 | udelay(gc_psx_delay); |
276 | read = parport_read_status(gc->pd->port) ^ 0x80; | 381 | read = parport_read_status(gc->pd->port) ^ 0x80; |
277 | for (j = 0; j < 5; j++) | 382 | for (j = 0; j < GC_MAX_DEVICES; j++) |
278 | data[j] |= (read & gc_status_bit[j] & (gc->pads[GC_PSX] | gc->pads[GC_DDR])) ? (1 << i) : 0; | 383 | data[j] |= (read & gc_status_bit[j] & (gc->pads[GC_PSX] | gc->pads[GC_DDR])) ? (1 << i) : 0; |
279 | parport_write_data(gc->pd->port, cmd | GC_PSX_CLOCK | GC_PSX_POWER); | 384 | parport_write_data(gc->pd->port, cmd | GC_PSX_CLOCK | GC_PSX_POWER); |
280 | udelay(gc_psx_delay); | 385 | udelay(gc_psx_delay); |
@@ -286,11 +391,12 @@ static void gc_psx_command(struct gc *gc, int b, unsigned char data[5]) | |||
286 | * device identifier code. | 391 | * device identifier code. |
287 | */ | 392 | */ |
288 | 393 | ||
289 | static void gc_psx_read_packet(struct gc *gc, unsigned char data[5][GC_PSX_BYTES], unsigned char id[5]) | 394 | static void gc_psx_read_packet(struct gc *gc, unsigned char data[GC_MAX_DEVICES][GC_PSX_BYTES], |
395 | unsigned char id[GC_MAX_DEVICES]) | ||
290 | { | 396 | { |
291 | int i, j, max_len = 0; | 397 | int i, j, max_len = 0; |
292 | unsigned long flags; | 398 | unsigned long flags; |
293 | unsigned char data2[5]; | 399 | unsigned char data2[GC_MAX_DEVICES]; |
294 | 400 | ||
295 | parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); /* Select pad */ | 401 | parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); /* Select pad */ |
296 | udelay(gc_psx_delay); | 402 | udelay(gc_psx_delay); |
@@ -303,7 +409,7 @@ static void gc_psx_read_packet(struct gc *gc, unsigned char data[5][GC_PSX_BYTES | |||
303 | gc_psx_command(gc, 0x42, id); /* Get device ids */ | 409 | gc_psx_command(gc, 0x42, id); /* Get device ids */ |
304 | gc_psx_command(gc, 0, data2); /* Dump status */ | 410 | gc_psx_command(gc, 0, data2); /* Dump status */ |
305 | 411 | ||
306 | for (i =0; i < 5; i++) /* Find the longest pad */ | 412 | for (i =0; i < GC_MAX_DEVICES; i++) /* Find the longest pad */ |
307 | if((gc_status_bit[i] & (gc->pads[GC_PSX] | gc->pads[GC_DDR])) | 413 | if((gc_status_bit[i] & (gc->pads[GC_PSX] | gc->pads[GC_DDR])) |
308 | && (GC_PSX_LEN(id[i]) > max_len) | 414 | && (GC_PSX_LEN(id[i]) > max_len) |
309 | && (GC_PSX_LEN(id[i]) <= GC_PSX_BYTES)) | 415 | && (GC_PSX_LEN(id[i]) <= GC_PSX_BYTES)) |
@@ -311,7 +417,7 @@ static void gc_psx_read_packet(struct gc *gc, unsigned char data[5][GC_PSX_BYTES | |||
311 | 417 | ||
312 | for (i = 0; i < max_len; i++) { /* Read in all the data */ | 418 | for (i = 0; i < max_len; i++) { /* Read in all the data */ |
313 | gc_psx_command(gc, 0, data2); | 419 | gc_psx_command(gc, 0, data2); |
314 | for (j = 0; j < 5; j++) | 420 | for (j = 0; j < GC_MAX_DEVICES; j++) |
315 | data[j][i] = data2[j]; | 421 | data[j][i] = data2[j]; |
316 | } | 422 | } |
317 | 423 | ||
@@ -319,185 +425,124 @@ static void gc_psx_read_packet(struct gc *gc, unsigned char data[5][GC_PSX_BYTES | |||
319 | 425 | ||
320 | parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); | 426 | parport_write_data(gc->pd->port, GC_PSX_CLOCK | GC_PSX_SELECT | GC_PSX_POWER); |
321 | 427 | ||
322 | for(i = 0; i < 5; i++) /* Set id's to the real value */ | 428 | for(i = 0; i < GC_MAX_DEVICES; i++) /* Set id's to the real value */ |
323 | id[i] = GC_PSX_ID(id[i]); | 429 | id[i] = GC_PSX_ID(id[i]); |
324 | } | 430 | } |
325 | 431 | ||
326 | /* | 432 | static void gc_psx_process_packet(struct gc *gc) |
327 | * gc_timer() reads and analyzes console pads data. | 433 | { |
328 | */ | 434 | unsigned char data[GC_MAX_DEVICES][GC_PSX_BYTES]; |
435 | unsigned char id[GC_MAX_DEVICES]; | ||
436 | struct input_dev *dev; | ||
437 | int i, j; | ||
329 | 438 | ||
330 | #define GC_MAX_LENGTH GC_N64_LENGTH | 439 | gc_psx_read_packet(gc, data, id); |
331 | 440 | ||
332 | static void gc_timer(unsigned long private) | 441 | for (i = 0; i < GC_MAX_DEVICES; i++) { |
333 | { | ||
334 | struct gc *gc = (void *) private; | ||
335 | unsigned char data[GC_MAX_LENGTH]; | ||
336 | unsigned char data_psx[5][GC_PSX_BYTES]; | ||
337 | int i, j, s; | ||
338 | 442 | ||
339 | /* | 443 | dev = gc->dev[i]; |
340 | * N64 pads - must be read first, any read confuses them for 200 us | 444 | if (!dev) |
341 | */ | 445 | continue; |
342 | 446 | ||
343 | if (gc->pads[GC_N64]) { | 447 | switch (id[i]) { |
344 | 448 | ||
345 | gc_n64_read_packet(gc, data); | 449 | case GC_PSX_RUMBLE: |
346 | 450 | ||
347 | for (i = 0; i < 5; i++) { | 451 | input_report_key(dev, BTN_THUMBL, ~data[i][0] & 0x04); |
452 | input_report_key(dev, BTN_THUMBR, ~data[i][0] & 0x02); | ||
348 | 453 | ||
349 | s = gc_status_bit[i]; | 454 | case GC_PSX_NEGCON: |
455 | case GC_PSX_ANALOG: | ||
350 | 456 | ||
351 | if (s & gc->pads[GC_N64] & ~(data[8] | data[9])) { | 457 | if (gc->pads[GC_DDR] & gc_status_bit[i]) { |
458 | for(j = 0; j < 4; j++) | ||
459 | input_report_key(dev, gc_psx_ddr_btn[j], ~data[i][0] & (0x10 << j)); | ||
460 | } else { | ||
461 | for (j = 0; j < 4; j++) | ||
462 | input_report_abs(dev, gc_psx_abs[j + 2], data[i][j + 2]); | ||
352 | 463 | ||
353 | signed char axes[2]; | 464 | input_report_abs(dev, ABS_X, 128 + !(data[i][0] & 0x20) * 127 - !(data[i][0] & 0x80) * 128); |
354 | axes[0] = axes[1] = 0; | 465 | input_report_abs(dev, ABS_Y, 128 + !(data[i][0] & 0x40) * 127 - !(data[i][0] & 0x10) * 128); |
466 | } | ||
355 | 467 | ||
356 | for (j = 0; j < 8; j++) { | 468 | for (j = 0; j < 8; j++) |
357 | if (data[23 - j] & s) axes[0] |= 1 << j; | 469 | input_report_key(dev, gc_psx_btn[j], ~data[i][1] & (1 << j)); |
358 | if (data[31 - j] & s) axes[1] |= 1 << j; | 470 | |
471 | input_report_key(dev, BTN_START, ~data[i][0] & 0x08); | ||
472 | input_report_key(dev, BTN_SELECT, ~data[i][0] & 0x01); | ||
473 | |||
474 | input_sync(dev); | ||
475 | |||
476 | break; | ||
477 | |||
478 | case GC_PSX_NORMAL: | ||
479 | if (gc->pads[GC_DDR] & gc_status_bit[i]) { | ||
480 | for(j = 0; j < 4; j++) | ||
481 | input_report_key(dev, gc_psx_ddr_btn[j], ~data[i][0] & (0x10 << j)); | ||
482 | } else { | ||
483 | input_report_abs(dev, ABS_X, 128 + !(data[i][0] & 0x20) * 127 - !(data[i][0] & 0x80) * 128); | ||
484 | input_report_abs(dev, ABS_Y, 128 + !(data[i][0] & 0x40) * 127 - !(data[i][0] & 0x10) * 128); | ||
485 | |||
486 | /* for some reason if the extra axes are left unset they drift */ | ||
487 | /* for (j = 0; j < 4; j++) | ||
488 | input_report_abs(dev, gc_psx_abs[j + 2], 128); | ||
489 | * This needs to be debugged properly, | ||
490 | * maybe fuzz processing needs to be done in input_sync() | ||
491 | * --vojtech | ||
492 | */ | ||
359 | } | 493 | } |
360 | 494 | ||
361 | input_report_abs(gc->dev[i], ABS_X, axes[0]); | 495 | for (j = 0; j < 8; j++) |
362 | input_report_abs(gc->dev[i], ABS_Y, -axes[1]); | 496 | input_report_key(dev, gc_psx_btn[j], ~data[i][1] & (1 << j)); |
497 | |||
498 | input_report_key(dev, BTN_START, ~data[i][0] & 0x08); | ||
499 | input_report_key(dev, BTN_SELECT, ~data[i][0] & 0x01); | ||
363 | 500 | ||
364 | input_report_abs(gc->dev[i], ABS_HAT0X, !(s & data[6]) - !(s & data[7])); | 501 | input_sync(dev); |
365 | input_report_abs(gc->dev[i], ABS_HAT0Y, !(s & data[4]) - !(s & data[5])); | ||
366 | 502 | ||
367 | for (j = 0; j < 10; j++) | 503 | break; |
368 | input_report_key(gc->dev[i], gc_n64_btn[j], s & data[gc_n64_bytes[j]]); | ||
369 | 504 | ||
370 | input_sync(gc->dev[i]); | 505 | case 0: /* not a pad, ignore */ |
371 | } | 506 | break; |
372 | } | 507 | } |
373 | } | 508 | } |
509 | } | ||
374 | 510 | ||
375 | /* | 511 | /* |
376 | * NES and SNES pads | 512 | * gc_timer() initiates reads of console pads data. |
377 | */ | 513 | */ |
378 | 514 | ||
379 | if (gc->pads[GC_NES] || gc->pads[GC_SNES]) { | 515 | static void gc_timer(unsigned long private) |
380 | 516 | { | |
381 | gc_nes_read_packet(gc, gc->pads[GC_SNES] ? GC_SNES_LENGTH : GC_NES_LENGTH, data); | 517 | struct gc *gc = (void *) private; |
382 | |||
383 | for (i = 0; i < 5; i++) { | ||
384 | |||
385 | s = gc_status_bit[i]; | ||
386 | 518 | ||
387 | if (s & (gc->pads[GC_NES] | gc->pads[GC_SNES])) { | 519 | /* |
388 | input_report_abs(gc->dev[i], ABS_X, !(s & data[6]) - !(s & data[7])); | 520 | * N64 pads - must be read first, any read confuses them for 200 us |
389 | input_report_abs(gc->dev[i], ABS_Y, !(s & data[4]) - !(s & data[5])); | 521 | */ |
390 | } | ||
391 | 522 | ||
392 | if (s & gc->pads[GC_NES]) | 523 | if (gc->pads[GC_N64]) |
393 | for (j = 0; j < 4; j++) | 524 | gc_n64_process_packet(gc); |
394 | input_report_key(gc->dev[i], gc_snes_btn[j], s & data[gc_nes_bytes[j]]); | ||
395 | 525 | ||
396 | if (s & gc->pads[GC_SNES]) | 526 | /* |
397 | for (j = 0; j < 8; j++) | 527 | * NES and SNES pads |
398 | input_report_key(gc->dev[i], gc_snes_btn[j], s & data[gc_snes_bytes[j]]); | 528 | */ |
399 | 529 | ||
400 | input_sync(gc->dev[i]); | 530 | if (gc->pads[GC_NES] || gc->pads[GC_SNES]) |
401 | } | 531 | gc_nes_process_packet(gc); |
402 | } | ||
403 | 532 | ||
404 | /* | 533 | /* |
405 | * Multi and Multi2 joysticks | 534 | * Multi and Multi2 joysticks |
406 | */ | 535 | */ |
407 | 536 | ||
408 | if (gc->pads[GC_MULTI] || gc->pads[GC_MULTI2]) { | 537 | if (gc->pads[GC_MULTI] || gc->pads[GC_MULTI2]) |
409 | 538 | gc_multi_process_packet(gc); | |
410 | gc_multi_read_packet(gc, gc->pads[GC_MULTI2] ? GC_MULTI2_LENGTH : GC_MULTI_LENGTH, data); | ||
411 | |||
412 | for (i = 0; i < 5; i++) { | ||
413 | |||
414 | s = gc_status_bit[i]; | ||
415 | |||
416 | if (s & (gc->pads[GC_MULTI] | gc->pads[GC_MULTI2])) { | ||
417 | input_report_abs(gc->dev[i], ABS_X, !(s & data[2]) - !(s & data[3])); | ||
418 | input_report_abs(gc->dev[i], ABS_Y, !(s & data[0]) - !(s & data[1])); | ||
419 | input_report_key(gc->dev[i], BTN_TRIGGER, s & data[4]); | ||
420 | } | ||
421 | |||
422 | if (s & gc->pads[GC_MULTI2]) | ||
423 | input_report_key(gc->dev[i], BTN_THUMB, s & data[5]); | ||
424 | |||
425 | input_sync(gc->dev[i]); | ||
426 | } | ||
427 | } | ||
428 | 539 | ||
429 | /* | 540 | /* |
430 | * PSX controllers | 541 | * PSX controllers |
431 | */ | 542 | */ |
432 | 543 | ||
433 | if (gc->pads[GC_PSX] || gc->pads[GC_DDR]) { | 544 | if (gc->pads[GC_PSX] || gc->pads[GC_DDR]) |
434 | 545 | gc_psx_process_packet(gc); | |
435 | gc_psx_read_packet(gc, data_psx, data); | ||
436 | |||
437 | for (i = 0; i < 5; i++) { | ||
438 | switch (data[i]) { | ||
439 | |||
440 | case GC_PSX_RUMBLE: | ||
441 | |||
442 | input_report_key(gc->dev[i], BTN_THUMBL, ~data_psx[i][0] & 0x04); | ||
443 | input_report_key(gc->dev[i], BTN_THUMBR, ~data_psx[i][0] & 0x02); | ||
444 | |||
445 | case GC_PSX_NEGCON: | ||
446 | case GC_PSX_ANALOG: | ||
447 | |||
448 | if (gc->pads[GC_DDR] & gc_status_bit[i]) { | ||
449 | for(j = 0; j < 4; j++) | ||
450 | input_report_key(gc->dev[i], gc_psx_ddr_btn[j], ~data_psx[i][0] & (0x10 << j)); | ||
451 | } else { | ||
452 | for (j = 0; j < 4; j++) | ||
453 | input_report_abs(gc->dev[i], gc_psx_abs[j+2], data_psx[i][j + 2]); | ||
454 | |||
455 | input_report_abs(gc->dev[i], ABS_X, 128 + !(data_psx[i][0] & 0x20) * 127 - !(data_psx[i][0] & 0x80) * 128); | ||
456 | input_report_abs(gc->dev[i], ABS_Y, 128 + !(data_psx[i][0] & 0x40) * 127 - !(data_psx[i][0] & 0x10) * 128); | ||
457 | } | ||
458 | |||
459 | for (j = 0; j < 8; j++) | ||
460 | input_report_key(gc->dev[i], gc_psx_btn[j], ~data_psx[i][1] & (1 << j)); | ||
461 | |||
462 | input_report_key(gc->dev[i], BTN_START, ~data_psx[i][0] & 0x08); | ||
463 | input_report_key(gc->dev[i], BTN_SELECT, ~data_psx[i][0] & 0x01); | ||
464 | |||
465 | input_sync(gc->dev[i]); | ||
466 | |||
467 | break; | ||
468 | |||
469 | case GC_PSX_NORMAL: | ||
470 | if (gc->pads[GC_DDR] & gc_status_bit[i]) { | ||
471 | for(j = 0; j < 4; j++) | ||
472 | input_report_key(gc->dev[i], gc_psx_ddr_btn[j], ~data_psx[i][0] & (0x10 << j)); | ||
473 | } else { | ||
474 | input_report_abs(gc->dev[i], ABS_X, 128 + !(data_psx[i][0] & 0x20) * 127 - !(data_psx[i][0] & 0x80) * 128); | ||
475 | input_report_abs(gc->dev[i], ABS_Y, 128 + !(data_psx[i][0] & 0x40) * 127 - !(data_psx[i][0] & 0x10) * 128); | ||
476 | |||
477 | /* for some reason if the extra axes are left unset they drift */ | ||
478 | /* for (j = 0; j < 4; j++) | ||
479 | input_report_abs(gc->dev[i], gc_psx_abs[j+2], 128); | ||
480 | * This needs to be debugged properly, | ||
481 | * maybe fuzz processing needs to be done in input_sync() | ||
482 | * --vojtech | ||
483 | */ | ||
484 | } | ||
485 | |||
486 | for (j = 0; j < 8; j++) | ||
487 | input_report_key(gc->dev[i], gc_psx_btn[j], ~data_psx[i][1] & (1 << j)); | ||
488 | |||
489 | input_report_key(gc->dev[i], BTN_START, ~data_psx[i][0] & 0x08); | ||
490 | input_report_key(gc->dev[i], BTN_SELECT, ~data_psx[i][0] & 0x01); | ||
491 | |||
492 | input_sync(gc->dev[i]); | ||
493 | |||
494 | break; | ||
495 | |||
496 | case 0: /* not a pad, ignore */ | ||
497 | break; | ||
498 | } | ||
499 | } | ||
500 | } | ||
501 | 546 | ||
502 | mod_timer(&gc->timer, jiffies + GC_REFRESH_TIME); | 547 | mod_timer(&gc->timer, jiffies + GC_REFRESH_TIME); |
503 | } | 548 | } |
@@ -654,16 +699,18 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads) | |||
654 | gc->timer.data = (long) gc; | 699 | gc->timer.data = (long) gc; |
655 | gc->timer.function = gc_timer; | 700 | gc->timer.function = gc_timer; |
656 | 701 | ||
657 | for (i = 0; i < n_pads; i++) { | 702 | for (i = 0; i < n_pads && i < GC_MAX_DEVICES; i++) { |
658 | if (!pads[i]) | 703 | if (!pads[i]) |
659 | continue; | 704 | continue; |
660 | 705 | ||
661 | sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i); | 706 | sprintf(gc->phys[i], "%s/input%d", gc->pd->port->name, i); |
662 | err = gc_setup_pad(gc, i, pads[i]); | 707 | err = gc_setup_pad(gc, i, pads[i]); |
663 | if (err) | 708 | if (err) |
664 | goto err_free_devs; | 709 | goto err_unreg_devs; |
665 | 710 | ||
666 | input_register_device(gc->dev[i]); | 711 | err = input_register_device(gc->dev[i]); |
712 | if (err) | ||
713 | goto err_free_dev; | ||
667 | } | 714 | } |
668 | 715 | ||
669 | if (!gc->pads[0]) { | 716 | if (!gc->pads[0]) { |
@@ -675,9 +722,12 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads) | |||
675 | parport_put_port(pp); | 722 | parport_put_port(pp); |
676 | return gc; | 723 | return gc; |
677 | 724 | ||
678 | err_free_devs: | 725 | err_free_dev: |
726 | input_free_device(gc->dev[i]); | ||
727 | err_unreg_devs: | ||
679 | while (--i >= 0) | 728 | while (--i >= 0) |
680 | input_unregister_device(gc->dev[i]); | 729 | if (gc->dev[i]) |
730 | input_unregister_device(gc->dev[i]); | ||
681 | err_free_gc: | 731 | err_free_gc: |
682 | kfree(gc); | 732 | kfree(gc); |
683 | err_unreg_pardev: | 733 | err_unreg_pardev: |
@@ -688,7 +738,7 @@ static struct gc __init *gc_probe(int parport, int *pads, int n_pads) | |||
688 | return ERR_PTR(err); | 738 | return ERR_PTR(err); |
689 | } | 739 | } |
690 | 740 | ||
691 | static void __exit gc_remove(struct gc *gc) | 741 | static void gc_remove(struct gc *gc) |
692 | { | 742 | { |
693 | int i; | 743 | int i; |
694 | 744 | ||
@@ -726,7 +776,8 @@ static int __init gc_init(void) | |||
726 | 776 | ||
727 | if (err) { | 777 | if (err) { |
728 | while (--i >= 0) | 778 | while (--i >= 0) |
729 | gc_remove(gc_base[i]); | 779 | if (gc_base[i]) |
780 | gc_remove(gc_base[i]); | ||
730 | return err; | 781 | return err; |
731 | } | 782 | } |
732 | 783 | ||
diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c index a936e7aedb10..20cb98ac2d79 100644 --- a/drivers/input/joystick/grip.c +++ b/drivers/input/joystick/grip.c | |||
@@ -192,6 +192,9 @@ static void grip_poll(struct gameport *gameport) | |||
192 | for (i = 0; i < 2; i++) { | 192 | for (i = 0; i < 2; i++) { |
193 | 193 | ||
194 | dev = grip->dev[i]; | 194 | dev = grip->dev[i]; |
195 | if (!dev) | ||
196 | continue; | ||
197 | |||
195 | grip->reads++; | 198 | grip->reads++; |
196 | 199 | ||
197 | switch (grip->mode[i]) { | 200 | switch (grip->mode[i]) { |
@@ -381,12 +384,15 @@ static int grip_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
381 | if (t > 0) | 384 | if (t > 0) |
382 | set_bit(t, input_dev->keybit); | 385 | set_bit(t, input_dev->keybit); |
383 | 386 | ||
384 | input_register_device(grip->dev[i]); | 387 | err = input_register_device(grip->dev[i]); |
388 | if (err) | ||
389 | goto fail4; | ||
385 | } | 390 | } |
386 | 391 | ||
387 | return 0; | 392 | return 0; |
388 | 393 | ||
389 | fail3: for (i = 0; i < 2; i++) | 394 | fail4: input_free_device(grip->dev[i]); |
395 | fail3: while (--i >= 0) | ||
390 | if (grip->dev[i]) | 396 | if (grip->dev[i]) |
391 | input_unregister_device(grip->dev[i]); | 397 | input_unregister_device(grip->dev[i]); |
392 | fail2: gameport_close(gameport); | 398 | fail2: gameport_close(gameport); |
@@ -411,6 +417,7 @@ static void grip_disconnect(struct gameport *gameport) | |||
411 | static struct gameport_driver grip_drv = { | 417 | static struct gameport_driver grip_drv = { |
412 | .driver = { | 418 | .driver = { |
413 | .name = "grip", | 419 | .name = "grip", |
420 | .owner = THIS_MODULE, | ||
414 | }, | 421 | }, |
415 | .description = DRIVER_DESC, | 422 | .description = DRIVER_DESC, |
416 | .connect = grip_connect, | 423 | .connect = grip_connect, |
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c index 64b9c31c47fc..b6bc04998047 100644 --- a/drivers/input/joystick/iforce/iforce-main.c +++ b/drivers/input/joystick/iforce/iforce-main.c | |||
@@ -345,7 +345,7 @@ int iforce_init_device(struct iforce *iforce) | |||
345 | int i; | 345 | int i; |
346 | 346 | ||
347 | input_dev = input_allocate_device(); | 347 | input_dev = input_allocate_device(); |
348 | if (input_dev) | 348 | if (!input_dev) |
349 | return -ENOMEM; | 349 | return -ENOMEM; |
350 | 350 | ||
351 | init_waitqueue_head(&iforce->wait); | 351 | init_waitqueue_head(&iforce->wait); |
diff --git a/drivers/input/joystick/iforce/iforce-packets.c b/drivers/input/joystick/iforce/iforce-packets.c index 4a2629243e19..76cb1f88f4e8 100644 --- a/drivers/input/joystick/iforce/iforce-packets.c +++ b/drivers/input/joystick/iforce/iforce-packets.c | |||
@@ -167,9 +167,9 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data, | |||
167 | iforce->expect_packet = 0; | 167 | iforce->expect_packet = 0; |
168 | iforce->ecmd = cmd; | 168 | iforce->ecmd = cmd; |
169 | memcpy(iforce->edata, data, IFORCE_MAX_LENGTH); | 169 | memcpy(iforce->edata, data, IFORCE_MAX_LENGTH); |
170 | wake_up(&iforce->wait); | ||
171 | } | 170 | } |
172 | #endif | 171 | #endif |
172 | wake_up(&iforce->wait); | ||
173 | 173 | ||
174 | if (!iforce->type) { | 174 | if (!iforce->type) { |
175 | being_used--; | 175 | being_used--; |
@@ -264,7 +264,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) | |||
264 | wait_event_interruptible_timeout(iforce->wait, | 264 | wait_event_interruptible_timeout(iforce->wait, |
265 | iforce->ctrl->status != -EINPROGRESS, HZ); | 265 | iforce->ctrl->status != -EINPROGRESS, HZ); |
266 | 266 | ||
267 | if (iforce->ctrl->status != -EINPROGRESS) { | 267 | if (iforce->ctrl->status) { |
268 | usb_unlink_urb(iforce->ctrl); | 268 | usb_unlink_urb(iforce->ctrl); |
269 | return -1; | 269 | return -1; |
270 | } | 270 | } |
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c index bc2fce60f9f8..fe79d158456d 100644 --- a/drivers/input/joystick/iforce/iforce-usb.c +++ b/drivers/input/joystick/iforce/iforce-usb.c | |||
@@ -95,7 +95,6 @@ static void iforce_usb_irq(struct urb *urb, struct pt_regs *regs) | |||
95 | goto exit; | 95 | goto exit; |
96 | } | 96 | } |
97 | 97 | ||
98 | wake_up(&iforce->wait); | ||
99 | iforce_process_packet(iforce, | 98 | iforce_process_packet(iforce, |
100 | (iforce->data[0] << 8) | (urb->actual_length - 1), iforce->data + 1, regs); | 99 | (iforce->data[0] << 8) | (urb->actual_length - 1), iforce->data + 1, regs); |
101 | 100 | ||
diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c index 78dd163cd702..2b2ec1057dee 100644 --- a/drivers/input/joystick/sidewinder.c +++ b/drivers/input/joystick/sidewinder.c | |||
@@ -736,7 +736,7 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
736 | sprintf(sw->name, "Microsoft SideWinder %s", sw_name[sw->type]); | 736 | sprintf(sw->name, "Microsoft SideWinder %s", sw_name[sw->type]); |
737 | sprintf(sw->phys[i], "%s/input%d", gameport->phys, i); | 737 | sprintf(sw->phys[i], "%s/input%d", gameport->phys, i); |
738 | 738 | ||
739 | input_dev = input_allocate_device(); | 739 | sw->dev[i] = input_dev = input_allocate_device(); |
740 | if (!input_dev) { | 740 | if (!input_dev) { |
741 | err = -ENOMEM; | 741 | err = -ENOMEM; |
742 | goto fail3; | 742 | goto fail3; |
@@ -771,12 +771,15 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) | |||
771 | 771 | ||
772 | dbg("%s%s [%d-bit id %d data %d]\n", sw->name, comment, m, l, k); | 772 | dbg("%s%s [%d-bit id %d data %d]\n", sw->name, comment, m, l, k); |
773 | 773 | ||
774 | input_register_device(sw->dev[i]); | 774 | err = input_register_device(sw->dev[i]); |
775 | if (err) | ||
776 | goto fail4; | ||
775 | } | 777 | } |
776 | 778 | ||
777 | return 0; | 779 | return 0; |
778 | 780 | ||
779 | fail3: while (--i >= 0) | 781 | fail4: input_free_device(sw->dev[i]); |
782 | fail3: while (--i >= 0) | ||
780 | input_unregister_device(sw->dev[i]); | 783 | input_unregister_device(sw->dev[i]); |
781 | fail2: gameport_close(gameport); | 784 | fail2: gameport_close(gameport); |
782 | fail1: gameport_set_drvdata(gameport, NULL); | 785 | fail1: gameport_set_drvdata(gameport, NULL); |
@@ -801,6 +804,7 @@ static void sw_disconnect(struct gameport *gameport) | |||
801 | static struct gameport_driver sw_drv = { | 804 | static struct gameport_driver sw_drv = { |
802 | .driver = { | 805 | .driver = { |
803 | .name = "sidewinder", | 806 | .name = "sidewinder", |
807 | .owner = THIS_MODULE, | ||
804 | }, | 808 | }, |
805 | .description = DRIVER_DESC, | 809 | .description = DRIVER_DESC, |
806 | .connect = sw_connect, | 810 | .connect = sw_connect, |
diff --git a/drivers/input/joystick/tmdc.c b/drivers/input/joystick/tmdc.c index 60e2aac7d06e..bb23ed2a04a6 100644 --- a/drivers/input/joystick/tmdc.c +++ b/drivers/input/joystick/tmdc.c | |||
@@ -284,13 +284,13 @@ static int tmdc_setup_port(struct tmdc *tmdc, int idx, unsigned char *data) | |||
284 | struct tmdc_port *port; | 284 | struct tmdc_port *port; |
285 | struct input_dev *input_dev; | 285 | struct input_dev *input_dev; |
286 | int i, j, b = 0; | 286 | int i, j, b = 0; |
287 | int err; | ||
287 | 288 | ||
288 | tmdc->port[idx] = port = kzalloc(sizeof (struct tmdc_port), GFP_KERNEL); | 289 | tmdc->port[idx] = port = kzalloc(sizeof (struct tmdc_port), GFP_KERNEL); |
289 | input_dev = input_allocate_device(); | 290 | input_dev = input_allocate_device(); |
290 | if (!port || !input_dev) { | 291 | if (!port || !input_dev) { |
291 | kfree(port); | 292 | err = -ENOMEM; |
292 | input_free_device(input_dev); | 293 | goto fail; |
293 | return -ENOMEM; | ||
294 | } | 294 | } |
295 | 295 | ||
296 | port->mode = data[TMDC_BYTE_ID]; | 296 | port->mode = data[TMDC_BYTE_ID]; |
@@ -347,9 +347,15 @@ static int tmdc_setup_port(struct tmdc *tmdc, int idx, unsigned char *data) | |||
347 | b += port->btnc[i]; | 347 | b += port->btnc[i]; |
348 | } | 348 | } |
349 | 349 | ||
350 | input_register_device(port->dev); | 350 | err = input_register_device(port->dev); |
351 | if (err) | ||
352 | goto fail; | ||
351 | 353 | ||
352 | return 0; | 354 | return 0; |
355 | |||
356 | fail: input_free_device(input_dev); | ||
357 | kfree(port); | ||
358 | return err; | ||
353 | } | 359 | } |
354 | 360 | ||
355 | /* | 361 | /* |
@@ -424,6 +430,7 @@ static void tmdc_disconnect(struct gameport *gameport) | |||
424 | static struct gameport_driver tmdc_drv = { | 430 | static struct gameport_driver tmdc_drv = { |
425 | .driver = { | 431 | .driver = { |
426 | .name = "tmdc", | 432 | .name = "tmdc", |
433 | .owner = THIS_MODULE, | ||
427 | }, | 434 | }, |
428 | .description = DRIVER_DESC, | 435 | .description = DRIVER_DESC, |
429 | .connect = tmdc_connect, | 436 | .connect = tmdc_connect, |
diff --git a/drivers/input/joystick/turbografx.c b/drivers/input/joystick/turbografx.c index 7e9764937d06..b154938e88a4 100644 --- a/drivers/input/joystick/turbografx.c +++ b/drivers/input/joystick/turbografx.c | |||
@@ -204,14 +204,14 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
204 | if (n_buttons[i] > 6) { | 204 | if (n_buttons[i] > 6) { |
205 | printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]); | 205 | printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]); |
206 | err = -EINVAL; | 206 | err = -EINVAL; |
207 | goto err_free_devs; | 207 | goto err_unreg_devs; |
208 | } | 208 | } |
209 | 209 | ||
210 | tgfx->dev[i] = input_dev = input_allocate_device(); | 210 | tgfx->dev[i] = input_dev = input_allocate_device(); |
211 | if (!input_dev) { | 211 | if (!input_dev) { |
212 | printk(KERN_ERR "turbografx.c: Not enough memory for input device\n"); | 212 | printk(KERN_ERR "turbografx.c: Not enough memory for input device\n"); |
213 | err = -ENOMEM; | 213 | err = -ENOMEM; |
214 | goto err_free_devs; | 214 | goto err_unreg_devs; |
215 | } | 215 | } |
216 | 216 | ||
217 | tgfx->sticks |= (1 << i); | 217 | tgfx->sticks |= (1 << i); |
@@ -238,7 +238,9 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
238 | for (j = 0; j < n_buttons[i]; j++) | 238 | for (j = 0; j < n_buttons[i]; j++) |
239 | set_bit(tgfx_buttons[j], input_dev->keybit); | 239 | set_bit(tgfx_buttons[j], input_dev->keybit); |
240 | 240 | ||
241 | input_register_device(tgfx->dev[i]); | 241 | err = input_register_device(tgfx->dev[i]); |
242 | if (err) | ||
243 | goto err_free_dev; | ||
242 | } | 244 | } |
243 | 245 | ||
244 | if (!tgfx->sticks) { | 246 | if (!tgfx->sticks) { |
@@ -249,9 +251,12 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
249 | 251 | ||
250 | return tgfx; | 252 | return tgfx; |
251 | 253 | ||
252 | err_free_devs: | 254 | err_free_dev: |
255 | input_free_device(tgfx->dev[i]); | ||
256 | err_unreg_devs: | ||
253 | while (--i >= 0) | 257 | while (--i >= 0) |
254 | input_unregister_device(tgfx->dev[i]); | 258 | if (tgfx->dev[i]) |
259 | input_unregister_device(tgfx->dev[i]); | ||
255 | err_free_tgfx: | 260 | err_free_tgfx: |
256 | kfree(tgfx); | 261 | kfree(tgfx); |
257 | err_unreg_pardev: | 262 | err_unreg_pardev: |
@@ -262,7 +267,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) | |||
262 | return ERR_PTR(err); | 267 | return ERR_PTR(err); |
263 | } | 268 | } |
264 | 269 | ||
265 | static void __exit tgfx_remove(struct tgfx *tgfx) | 270 | static void tgfx_remove(struct tgfx *tgfx) |
266 | { | 271 | { |
267 | int i; | 272 | int i; |
268 | 273 | ||
@@ -300,7 +305,8 @@ static int __init tgfx_init(void) | |||
300 | 305 | ||
301 | if (err) { | 306 | if (err) { |
302 | while (--i >= 0) | 307 | while (--i >= 0) |
303 | tgfx_remove(tgfx_base[i]); | 308 | if (tgfx_base[i]) |
309 | tgfx_remove(tgfx_base[i]); | ||
304 | return err; | 310 | return err; |
305 | } | 311 | } |
306 | 312 | ||
diff --git a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c index cd3a1e742a30..7f8b0093c5bc 100644 --- a/drivers/input/joystick/twidjoy.c +++ b/drivers/input/joystick/twidjoy.c | |||
@@ -265,13 +265,13 @@ static struct serio_driver twidjoy_drv = { | |||
265 | * The functions for inserting/removing us as a module. | 265 | * The functions for inserting/removing us as a module. |
266 | */ | 266 | */ |
267 | 267 | ||
268 | int __init twidjoy_init(void) | 268 | static int __init twidjoy_init(void) |
269 | { | 269 | { |
270 | serio_register_driver(&twidjoy_drv); | 270 | serio_register_driver(&twidjoy_drv); |
271 | return 0; | 271 | return 0; |
272 | } | 272 | } |
273 | 273 | ||
274 | void __exit twidjoy_exit(void) | 274 | static void __exit twidjoy_exit(void) |
275 | { | 275 | { |
276 | serio_unregister_driver(&twidjoy_drv); | 276 | serio_unregister_driver(&twidjoy_drv); |
277 | } | 277 | } |
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index e08dbe08f46d..4bad588d0e5d 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -50,6 +50,18 @@ config INPUT_WISTRON_BTNS | |||
50 | To compile this driver as a module, choose M here: the module will | 50 | To compile this driver as a module, choose M here: the module will |
51 | be called wistron_btns. | 51 | be called wistron_btns. |
52 | 52 | ||
53 | config INPUT_IXP4XX_BEEPER | ||
54 | tristate "IXP4XX Beeper support" | ||
55 | depends on ARCH_IXP4XX | ||
56 | help | ||
57 | If you say yes here, you can connect a beeper to the | ||
58 | ixp4xx gpio pins. This is used by the LinkSys NSLU2. | ||
59 | |||
60 | If unsure, say Y. | ||
61 | |||
62 | To compile this driver as a module, choose M here: the | ||
63 | module will be called ixp4xx-beeper. | ||
64 | |||
53 | config INPUT_UINPUT | 65 | config INPUT_UINPUT |
54 | tristate "User level driver support" | 66 | tristate "User level driver support" |
55 | help | 67 | help |
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index ce44cce01285..184c4129470d 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile | |||
@@ -11,3 +11,4 @@ obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o | |||
11 | obj-$(CONFIG_INPUT_UINPUT) += uinput.o | 11 | obj-$(CONFIG_INPUT_UINPUT) += uinput.o |
12 | obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o | 12 | obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o |
13 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o | 13 | obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o |
14 | obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o | ||
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c new file mode 100644 index 000000000000..d448bb5e4869 --- /dev/null +++ b/drivers/input/misc/ixp4xx-beeper.c | |||
@@ -0,0 +1,183 @@ | |||
1 | /* | ||
2 | * Generic IXP4xx beeper driver | ||
3 | * | ||
4 | * Copyright (C) 2005 Tower Technologies | ||
5 | * | ||
6 | * based on nslu2-io.c | ||
7 | * Copyright (C) 2004 Karen Spearel | ||
8 | * | ||
9 | * Author: Alessandro Zummo <a.zummo@towertech.it> | ||
10 | * Maintainers: http://www.nslu2-linux.org/ | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/input.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <asm/hardware.h> | ||
23 | |||
24 | MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); | ||
25 | MODULE_DESCRIPTION("ixp4xx beeper driver"); | ||
26 | MODULE_LICENSE("GPL"); | ||
27 | |||
28 | static DEFINE_SPINLOCK(beep_lock); | ||
29 | |||
30 | static void ixp4xx_spkr_control(unsigned int pin, unsigned int count) | ||
31 | { | ||
32 | unsigned long flags; | ||
33 | |||
34 | spin_lock_irqsave(&beep_lock, flags); | ||
35 | |||
36 | if (count) { | ||
37 | gpio_line_config(pin, IXP4XX_GPIO_OUT); | ||
38 | gpio_line_set(pin, IXP4XX_GPIO_LOW); | ||
39 | |||
40 | *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE; | ||
41 | } else { | ||
42 | gpio_line_config(pin, IXP4XX_GPIO_IN); | ||
43 | gpio_line_set(pin, IXP4XX_GPIO_HIGH); | ||
44 | |||
45 | *IXP4XX_OSRT2 = 0; | ||
46 | } | ||
47 | |||
48 | spin_unlock_irqrestore(&beep_lock, flags); | ||
49 | } | ||
50 | |||
51 | static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | ||
52 | { | ||
53 | unsigned int pin = (unsigned int) dev->private; | ||
54 | unsigned int count = 0; | ||
55 | |||
56 | if (type != EV_SND) | ||
57 | return -1; | ||
58 | |||
59 | switch (code) { | ||
60 | case SND_BELL: | ||
61 | if (value) | ||
62 | value = 1000; | ||
63 | case SND_TONE: | ||
64 | break; | ||
65 | default: | ||
66 | return -1; | ||
67 | } | ||
68 | |||
69 | if (value > 20 && value < 32767) | ||
70 | #ifndef FREQ | ||
71 | count = (ixp4xx_get_board_tick_rate() / (value * 4)) - 1; | ||
72 | #else | ||
73 | count = (FREQ / (value * 4)) - 1; | ||
74 | #endif | ||
75 | |||
76 | ixp4xx_spkr_control(pin, count); | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
82 | { | ||
83 | /* clear interrupt */ | ||
84 | *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND; | ||
85 | |||
86 | /* flip the beeper output */ | ||
87 | *IXP4XX_GPIO_GPOUTR ^= (1 << (unsigned int) dev_id); | ||
88 | |||
89 | return IRQ_HANDLED; | ||
90 | } | ||
91 | |||
92 | static int __devinit ixp4xx_spkr_probe(struct platform_device *dev) | ||
93 | { | ||
94 | struct input_dev *input_dev; | ||
95 | int err; | ||
96 | |||
97 | input_dev = input_allocate_device(); | ||
98 | if (!input_dev) | ||
99 | return -ENOMEM; | ||
100 | |||
101 | input_dev->private = (void *) dev->id; | ||
102 | input_dev->name = "ixp4xx beeper", | ||
103 | input_dev->phys = "ixp4xx/gpio"; | ||
104 | input_dev->id.bustype = BUS_HOST; | ||
105 | input_dev->id.vendor = 0x001f; | ||
106 | input_dev->id.product = 0x0001; | ||
107 | input_dev->id.version = 0x0100; | ||
108 | input_dev->cdev.dev = &dev->dev; | ||
109 | |||
110 | input_dev->evbit[0] = BIT(EV_SND); | ||
111 | input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); | ||
112 | input_dev->event = ixp4xx_spkr_event; | ||
113 | |||
114 | err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt, | ||
115 | SA_INTERRUPT | SA_TIMER, "ixp4xx-beeper", (void *) dev->id); | ||
116 | if (err) | ||
117 | goto err_free_device; | ||
118 | |||
119 | err = input_register_device(input_dev); | ||
120 | if (err) | ||
121 | goto err_free_irq; | ||
122 | |||
123 | platform_set_drvdata(dev, input_dev); | ||
124 | |||
125 | return 0; | ||
126 | |||
127 | err_free_irq: | ||
128 | free_irq(IRQ_IXP4XX_TIMER2, dev); | ||
129 | err_free_device: | ||
130 | input_free_device(input_dev); | ||
131 | |||
132 | return err; | ||
133 | } | ||
134 | |||
135 | static int __devexit ixp4xx_spkr_remove(struct platform_device *dev) | ||
136 | { | ||
137 | struct input_dev *input_dev = platform_get_drvdata(dev); | ||
138 | unsigned int pin = (unsigned int) input_dev->private; | ||
139 | |||
140 | input_unregister_device(input_dev); | ||
141 | platform_set_drvdata(dev, NULL); | ||
142 | |||
143 | /* turn the speaker off */ | ||
144 | disable_irq(IRQ_IXP4XX_TIMER2); | ||
145 | ixp4xx_spkr_control(pin, 0); | ||
146 | |||
147 | free_irq(IRQ_IXP4XX_TIMER2, dev); | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | static void ixp4xx_spkr_shutdown(struct platform_device *dev) | ||
153 | { | ||
154 | struct input_dev *input_dev = platform_get_drvdata(dev); | ||
155 | unsigned int pin = (unsigned int) input_dev->private; | ||
156 | |||
157 | /* turn off the speaker */ | ||
158 | disable_irq(IRQ_IXP4XX_TIMER2); | ||
159 | ixp4xx_spkr_control(pin, 0); | ||
160 | } | ||
161 | |||
162 | static struct platform_driver ixp4xx_spkr_platform_driver = { | ||
163 | .driver = { | ||
164 | .name = "ixp4xx-beeper", | ||
165 | .owner = THIS_MODULE, | ||
166 | }, | ||
167 | .probe = ixp4xx_spkr_probe, | ||
168 | .remove = __devexit_p(ixp4xx_spkr_remove), | ||
169 | .shutdown = ixp4xx_spkr_shutdown, | ||
170 | }; | ||
171 | |||
172 | static int __init ixp4xx_spkr_init(void) | ||
173 | { | ||
174 | return platform_driver_register(&ixp4xx_spkr_platform_driver); | ||
175 | } | ||
176 | |||
177 | static void __exit ixp4xx_spkr_exit(void) | ||
178 | { | ||
179 | platform_driver_unregister(&ixp4xx_spkr_platform_driver); | ||
180 | } | ||
181 | |||
182 | module_init(ixp4xx_spkr_init); | ||
183 | module_exit(ixp4xx_spkr_exit); | ||
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 7665fd9ce559..19b1b0121726 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -403,6 +403,7 @@ static int genius_detect(struct psmouse *psmouse, int set_properties) | |||
403 | set_bit(REL_WHEEL, psmouse->dev->relbit); | 403 | set_bit(REL_WHEEL, psmouse->dev->relbit); |
404 | 404 | ||
405 | psmouse->vendor = "Genius"; | 405 | psmouse->vendor = "Genius"; |
406 | psmouse->name = "Mouse"; | ||
406 | psmouse->pktsize = 4; | 407 | psmouse->pktsize = 4; |
407 | } | 408 | } |
408 | 409 | ||
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index 81fd7a97a93d..9abed18d2ecf 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -356,7 +356,7 @@ static void mousedev_free(struct mousedev *mousedev) | |||
356 | kfree(mousedev); | 356 | kfree(mousedev); |
357 | } | 357 | } |
358 | 358 | ||
359 | static int mixdev_release(void) | 359 | static void mixdev_release(void) |
360 | { | 360 | { |
361 | struct input_handle *handle; | 361 | struct input_handle *handle; |
362 | 362 | ||
@@ -370,8 +370,6 @@ static int mixdev_release(void) | |||
370 | mousedev_free(mousedev); | 370 | mousedev_free(mousedev); |
371 | } | 371 | } |
372 | } | 372 | } |
373 | |||
374 | return 0; | ||
375 | } | 373 | } |
376 | 374 | ||
377 | static int mousedev_release(struct inode * inode, struct file * file) | 375 | static int mousedev_release(struct inode * inode, struct file * file) |
@@ -384,9 +382,8 @@ static int mousedev_release(struct inode * inode, struct file * file) | |||
384 | 382 | ||
385 | if (!--list->mousedev->open) { | 383 | if (!--list->mousedev->open) { |
386 | if (list->mousedev->minor == MOUSEDEV_MIX) | 384 | if (list->mousedev->minor == MOUSEDEV_MIX) |
387 | return mixdev_release(); | 385 | mixdev_release(); |
388 | 386 | else if (!mousedev_mix.open) { | |
389 | if (!mousedev_mix.open) { | ||
390 | if (list->mousedev->exist) | 387 | if (list->mousedev->exist) |
391 | input_close_device(&list->mousedev->handle); | 388 | input_close_device(&list->mousedev->handle); |
392 | else | 389 | else |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index dd8c6a9ffc76..b45a45ca7cc9 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -29,9 +29,6 @@ | |||
29 | #ifdef CONFIG_ARCH_OMAP | 29 | #ifdef CONFIG_ARCH_OMAP |
30 | #include <asm/arch/gpio.h> | 30 | #include <asm/arch/gpio.h> |
31 | #endif | 31 | #endif |
32 | |||
33 | #else | ||
34 | #define set_irq_type(irq,type) do{}while(0) | ||
35 | #endif | 32 | #endif |
36 | 33 | ||
37 | 34 | ||
@@ -509,14 +506,14 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
509 | ts->msg.complete = ads7846_rx; | 506 | ts->msg.complete = ads7846_rx; |
510 | ts->msg.context = ts; | 507 | ts->msg.context = ts; |
511 | 508 | ||
512 | if (request_irq(spi->irq, ads7846_irq, SA_SAMPLE_RANDOM, | 509 | if (request_irq(spi->irq, ads7846_irq, |
513 | spi->dev.bus_id, ts)) { | 510 | SA_SAMPLE_RANDOM | SA_TRIGGER_FALLING, |
511 | spi->dev.bus_id, ts)) { | ||
514 | dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); | 512 | dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq); |
515 | input_unregister_device(&ts->input); | 513 | input_unregister_device(&ts->input); |
516 | kfree(ts); | 514 | kfree(ts); |
517 | return -EBUSY; | 515 | return -EBUSY; |
518 | } | 516 | } |
519 | set_irq_type(spi->irq, IRQT_FALLING); | ||
520 | 517 | ||
521 | dev_info(&spi->dev, "touchscreen, irq %d\n", spi->irq); | 518 | dev_info(&spi->dev, "touchscreen, irq %d\n", spi->irq); |
522 | 519 | ||
diff --git a/drivers/input/touchscreen/mk712.c b/drivers/input/touchscreen/mk712.c index 4844d250a5eb..3226830eea08 100644 --- a/drivers/input/touchscreen/mk712.c +++ b/drivers/input/touchscreen/mk712.c | |||
@@ -154,7 +154,7 @@ static void mk712_close(struct input_dev *dev) | |||
154 | spin_unlock_irqrestore(&mk712_lock, flags); | 154 | spin_unlock_irqrestore(&mk712_lock, flags); |
155 | } | 155 | } |
156 | 156 | ||
157 | int __init mk712_init(void) | 157 | static int __init mk712_init(void) |
158 | { | 158 | { |
159 | int err; | 159 | int err; |
160 | 160 | ||
diff --git a/drivers/message/fusion/Makefile b/drivers/message/fusion/Makefile index 8a2e2657f4c2..33ace373241c 100644 --- a/drivers/message/fusion/Makefile +++ b/drivers/message/fusion/Makefile | |||
@@ -29,6 +29,8 @@ | |||
29 | # For mptctl: | 29 | # For mptctl: |
30 | #CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL | 30 | #CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL |
31 | # | 31 | # |
32 | # For mptfc: | ||
33 | #CFLAGS_mptfc.o += -DMPT_DEBUG_FC | ||
32 | 34 | ||
33 | #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC | 35 | #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC |
34 | 36 | ||
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index d890b2b8a93e..9a2c7605d49c 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c | |||
@@ -81,6 +81,10 @@ MODULE_LICENSE("GPL"); | |||
81 | /* | 81 | /* |
82 | * cmd line parameters | 82 | * cmd line parameters |
83 | */ | 83 | */ |
84 | static int mpt_msi_enable; | ||
85 | module_param(mpt_msi_enable, int, 0); | ||
86 | MODULE_PARM_DESC(mpt_msi_enable, " MSI Support Enable (default=0)"); | ||
87 | |||
84 | #ifdef MFCNT | 88 | #ifdef MFCNT |
85 | static int mfcounter = 0; | 89 | static int mfcounter = 0; |
86 | #define PRINT_MF_COUNT 20000 | 90 | #define PRINT_MF_COUNT 20000 |
@@ -174,7 +178,7 @@ static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc); | |||
174 | static int ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply, int *evHandlers); | 178 | static int ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply, int *evHandlers); |
175 | static void mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf); | 179 | static void mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf); |
176 | static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info); | 180 | static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info); |
177 | static void mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info); | 181 | static void mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info); |
178 | static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info); | 182 | static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info); |
179 | 183 | ||
180 | /* module entry point */ | 184 | /* module entry point */ |
@@ -313,7 +317,7 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa) | |||
313 | if (ioc->bus_type == FC) | 317 | if (ioc->bus_type == FC) |
314 | mpt_fc_log_info(ioc, log_info); | 318 | mpt_fc_log_info(ioc, log_info); |
315 | else if (ioc->bus_type == SPI) | 319 | else if (ioc->bus_type == SPI) |
316 | mpt_sp_log_info(ioc, log_info); | 320 | mpt_spi_log_info(ioc, log_info); |
317 | else if (ioc->bus_type == SAS) | 321 | else if (ioc->bus_type == SAS) |
318 | mpt_sas_log_info(ioc, log_info); | 322 | mpt_sas_log_info(ioc, log_info); |
319 | } | 323 | } |
@@ -1444,6 +1448,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1444 | 1448 | ||
1445 | ioc->pci_irq = -1; | 1449 | ioc->pci_irq = -1; |
1446 | if (pdev->irq) { | 1450 | if (pdev->irq) { |
1451 | if (mpt_msi_enable && !pci_enable_msi(pdev)) | ||
1452 | printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n", ioc->name); | ||
1453 | |||
1447 | r = request_irq(pdev->irq, mpt_interrupt, SA_SHIRQ, ioc->name, ioc); | 1454 | r = request_irq(pdev->irq, mpt_interrupt, SA_SHIRQ, ioc->name, ioc); |
1448 | 1455 | ||
1449 | if (r < 0) { | 1456 | if (r < 0) { |
@@ -1483,6 +1490,10 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1483 | 1490 | ||
1484 | list_del(&ioc->list); | 1491 | list_del(&ioc->list); |
1485 | free_irq(ioc->pci_irq, ioc); | 1492 | free_irq(ioc->pci_irq, ioc); |
1493 | if (mpt_msi_enable) | ||
1494 | pci_disable_msi(pdev); | ||
1495 | if (ioc->alt_ioc) | ||
1496 | ioc->alt_ioc->alt_ioc = NULL; | ||
1486 | iounmap(mem); | 1497 | iounmap(mem); |
1487 | kfree(ioc); | 1498 | kfree(ioc); |
1488 | pci_set_drvdata(pdev, NULL); | 1499 | pci_set_drvdata(pdev, NULL); |
@@ -2136,6 +2147,8 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc) | |||
2136 | 2147 | ||
2137 | if (ioc->pci_irq != -1) { | 2148 | if (ioc->pci_irq != -1) { |
2138 | free_irq(ioc->pci_irq, ioc); | 2149 | free_irq(ioc->pci_irq, ioc); |
2150 | if (mpt_msi_enable) | ||
2151 | pci_disable_msi(ioc->pcidev); | ||
2139 | ioc->pci_irq = -1; | 2152 | ioc->pci_irq = -1; |
2140 | } | 2153 | } |
2141 | 2154 | ||
@@ -2157,6 +2170,10 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc) | |||
2157 | sz_last = ioc->alloc_total; | 2170 | sz_last = ioc->alloc_total; |
2158 | dprintk((KERN_INFO MYNAM ": %s: free'd %d of %d bytes\n", | 2171 | dprintk((KERN_INFO MYNAM ": %s: free'd %d of %d bytes\n", |
2159 | ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first)); | 2172 | ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first)); |
2173 | |||
2174 | if (ioc->alt_ioc) | ||
2175 | ioc->alt_ioc->alt_ioc = NULL; | ||
2176 | |||
2160 | kfree(ioc); | 2177 | kfree(ioc); |
2161 | } | 2178 | } |
2162 | 2179 | ||
@@ -2770,13 +2787,16 @@ SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag) | |||
2770 | 2787 | ||
2771 | /* RAID FW may take a long time to enable | 2788 | /* RAID FW may take a long time to enable |
2772 | */ | 2789 | */ |
2773 | if ( (ioc->facts.ProductID & MPI_FW_HEADER_PID_PROD_MASK) | 2790 | if (((ioc->facts.ProductID & MPI_FW_HEADER_PID_PROD_MASK) |
2774 | > MPI_FW_HEADER_PID_PROD_TARGET_SCSI ) { | 2791 | > MPI_FW_HEADER_PID_PROD_TARGET_SCSI) || |
2775 | rc = mpt_handshake_req_reply_wait(ioc, req_sz, (u32*)&port_enable, | 2792 | (ioc->bus_type == SAS)) { |
2776 | reply_sz, (u16*)&reply_buf, 300 /*seconds*/, sleepFlag); | 2793 | rc = mpt_handshake_req_reply_wait(ioc, req_sz, |
2794 | (u32*)&port_enable, reply_sz, (u16*)&reply_buf, | ||
2795 | 300 /*seconds*/, sleepFlag); | ||
2777 | } else { | 2796 | } else { |
2778 | rc = mpt_handshake_req_reply_wait(ioc, req_sz, (u32*)&port_enable, | 2797 | rc = mpt_handshake_req_reply_wait(ioc, req_sz, |
2779 | reply_sz, (u16*)&reply_buf, 30 /*seconds*/, sleepFlag); | 2798 | (u32*)&port_enable, reply_sz, (u16*)&reply_buf, |
2799 | 30 /*seconds*/, sleepFlag); | ||
2780 | } | 2800 | } |
2781 | return rc; | 2801 | return rc; |
2782 | } | 2802 | } |
@@ -4387,6 +4407,138 @@ mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode) | |||
4387 | } | 4407 | } |
4388 | 4408 | ||
4389 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 4409 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
4410 | |||
4411 | static void | ||
4412 | mptbase_raid_process_event_data(MPT_ADAPTER *ioc, | ||
4413 | MpiEventDataRaid_t * pRaidEventData) | ||
4414 | { | ||
4415 | int volume; | ||
4416 | int reason; | ||
4417 | int disk; | ||
4418 | int status; | ||
4419 | int flags; | ||
4420 | int state; | ||
4421 | |||
4422 | volume = pRaidEventData->VolumeID; | ||
4423 | reason = pRaidEventData->ReasonCode; | ||
4424 | disk = pRaidEventData->PhysDiskNum; | ||
4425 | status = le32_to_cpu(pRaidEventData->SettingsStatus); | ||
4426 | flags = (status >> 0) & 0xff; | ||
4427 | state = (status >> 8) & 0xff; | ||
4428 | |||
4429 | if (reason == MPI_EVENT_RAID_RC_DOMAIN_VAL_NEEDED) { | ||
4430 | return; | ||
4431 | } | ||
4432 | |||
4433 | if ((reason >= MPI_EVENT_RAID_RC_PHYSDISK_CREATED && | ||
4434 | reason <= MPI_EVENT_RAID_RC_PHYSDISK_STATUS_CHANGED) || | ||
4435 | (reason == MPI_EVENT_RAID_RC_SMART_DATA)) { | ||
4436 | printk(MYIOC_s_INFO_FMT "RAID STATUS CHANGE for PhysDisk %d\n", | ||
4437 | ioc->name, disk); | ||
4438 | } else { | ||
4439 | printk(MYIOC_s_INFO_FMT "RAID STATUS CHANGE for VolumeID %d\n", | ||
4440 | ioc->name, volume); | ||
4441 | } | ||
4442 | |||
4443 | switch(reason) { | ||
4444 | case MPI_EVENT_RAID_RC_VOLUME_CREATED: | ||
4445 | printk(MYIOC_s_INFO_FMT " volume has been created\n", | ||
4446 | ioc->name); | ||
4447 | break; | ||
4448 | |||
4449 | case MPI_EVENT_RAID_RC_VOLUME_DELETED: | ||
4450 | |||
4451 | printk(MYIOC_s_INFO_FMT " volume has been deleted\n", | ||
4452 | ioc->name); | ||
4453 | break; | ||
4454 | |||
4455 | case MPI_EVENT_RAID_RC_VOLUME_SETTINGS_CHANGED: | ||
4456 | printk(MYIOC_s_INFO_FMT " volume settings have been changed\n", | ||
4457 | ioc->name); | ||
4458 | break; | ||
4459 | |||
4460 | case MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED: | ||
4461 | printk(MYIOC_s_INFO_FMT " volume is now %s%s%s%s\n", | ||
4462 | ioc->name, | ||
4463 | state == MPI_RAIDVOL0_STATUS_STATE_OPTIMAL | ||
4464 | ? "optimal" | ||
4465 | : state == MPI_RAIDVOL0_STATUS_STATE_DEGRADED | ||
4466 | ? "degraded" | ||
4467 | : state == MPI_RAIDVOL0_STATUS_STATE_FAILED | ||
4468 | ? "failed" | ||
4469 | : "state unknown", | ||
4470 | flags & MPI_RAIDVOL0_STATUS_FLAG_ENABLED | ||
4471 | ? ", enabled" : "", | ||
4472 | flags & MPI_RAIDVOL0_STATUS_FLAG_QUIESCED | ||
4473 | ? ", quiesced" : "", | ||
4474 | flags & MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS | ||
4475 | ? ", resync in progress" : "" ); | ||
4476 | break; | ||
4477 | |||
4478 | case MPI_EVENT_RAID_RC_VOLUME_PHYSDISK_CHANGED: | ||
4479 | printk(MYIOC_s_INFO_FMT " volume membership of PhysDisk %d has changed\n", | ||
4480 | ioc->name, disk); | ||
4481 | break; | ||
4482 | |||
4483 | case MPI_EVENT_RAID_RC_PHYSDISK_CREATED: | ||
4484 | printk(MYIOC_s_INFO_FMT " PhysDisk has been created\n", | ||
4485 | ioc->name); | ||
4486 | break; | ||
4487 | |||
4488 | case MPI_EVENT_RAID_RC_PHYSDISK_DELETED: | ||
4489 | printk(MYIOC_s_INFO_FMT " PhysDisk has been deleted\n", | ||
4490 | ioc->name); | ||
4491 | break; | ||
4492 | |||
4493 | case MPI_EVENT_RAID_RC_PHYSDISK_SETTINGS_CHANGED: | ||
4494 | printk(MYIOC_s_INFO_FMT " PhysDisk settings have been changed\n", | ||
4495 | ioc->name); | ||
4496 | break; | ||
4497 | |||
4498 | case MPI_EVENT_RAID_RC_PHYSDISK_STATUS_CHANGED: | ||
4499 | printk(MYIOC_s_INFO_FMT " PhysDisk is now %s%s%s\n", | ||
4500 | ioc->name, | ||
4501 | state == MPI_PHYSDISK0_STATUS_ONLINE | ||
4502 | ? "online" | ||
4503 | : state == MPI_PHYSDISK0_STATUS_MISSING | ||
4504 | ? "missing" | ||
4505 | : state == MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE | ||
4506 | ? "not compatible" | ||
4507 | : state == MPI_PHYSDISK0_STATUS_FAILED | ||
4508 | ? "failed" | ||
4509 | : state == MPI_PHYSDISK0_STATUS_INITIALIZING | ||
4510 | ? "initializing" | ||
4511 | : state == MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED | ||
4512 | ? "offline requested" | ||
4513 | : state == MPI_PHYSDISK0_STATUS_FAILED_REQUESTED | ||
4514 | ? "failed requested" | ||
4515 | : state == MPI_PHYSDISK0_STATUS_OTHER_OFFLINE | ||
4516 | ? "offline" | ||
4517 | : "state unknown", | ||
4518 | flags & MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC | ||
4519 | ? ", out of sync" : "", | ||
4520 | flags & MPI_PHYSDISK0_STATUS_FLAG_QUIESCED | ||
4521 | ? ", quiesced" : "" ); | ||
4522 | break; | ||
4523 | |||
4524 | case MPI_EVENT_RAID_RC_DOMAIN_VAL_NEEDED: | ||
4525 | printk(MYIOC_s_INFO_FMT " Domain Validation needed for PhysDisk %d\n", | ||
4526 | ioc->name, disk); | ||
4527 | break; | ||
4528 | |||
4529 | case MPI_EVENT_RAID_RC_SMART_DATA: | ||
4530 | printk(MYIOC_s_INFO_FMT " SMART data received, ASC/ASCQ = %02xh/%02xh\n", | ||
4531 | ioc->name, pRaidEventData->ASC, pRaidEventData->ASCQ); | ||
4532 | break; | ||
4533 | |||
4534 | case MPI_EVENT_RAID_RC_REPLACE_ACTION_STARTED: | ||
4535 | printk(MYIOC_s_INFO_FMT " replacement of PhysDisk %d has started\n", | ||
4536 | ioc->name, disk); | ||
4537 | break; | ||
4538 | } | ||
4539 | } | ||
4540 | |||
4541 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
4390 | /* | 4542 | /* |
4391 | * GetIoUnitPage2 - Retrieve BIOS version and boot order information. | 4543 | * GetIoUnitPage2 - Retrieve BIOS version and boot order information. |
4392 | * @ioc: Pointer to MPT_ADAPTER structure | 4544 | * @ioc: Pointer to MPT_ADAPTER structure |
@@ -4598,6 +4750,14 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum) | |||
4598 | SCSIPortPage2_t *pPP2 = (SCSIPortPage2_t *) pbuf; | 4750 | SCSIPortPage2_t *pPP2 = (SCSIPortPage2_t *) pbuf; |
4599 | MpiDeviceInfo_t *pdevice = NULL; | 4751 | MpiDeviceInfo_t *pdevice = NULL; |
4600 | 4752 | ||
4753 | /* | ||
4754 | * Save "Set to Avoid SCSI Bus Resets" flag | ||
4755 | */ | ||
4756 | ioc->spi_data.bus_reset = | ||
4757 | (le32_to_cpu(pPP2->PortFlags) & | ||
4758 | MPI_SCSIPORTPAGE2_PORT_FLAGS_AVOID_SCSI_RESET) ? | ||
4759 | 0 : 1 ; | ||
4760 | |||
4601 | /* Save the Port Page 2 data | 4761 | /* Save the Port Page 2 data |
4602 | * (reformat into a 32bit quantity) | 4762 | * (reformat into a 32bit quantity) |
4603 | */ | 4763 | */ |
@@ -5967,6 +6127,10 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply | |||
5967 | } | 6127 | } |
5968 | } | 6128 | } |
5969 | break; | 6129 | break; |
6130 | case MPI_EVENT_INTEGRATED_RAID: | ||
6131 | mptbase_raid_process_event_data(ioc, | ||
6132 | (MpiEventDataRaid_t *)pEventReply->Data); | ||
6133 | break; | ||
5970 | default: | 6134 | default: |
5971 | break; | 6135 | break; |
5972 | } | 6136 | } |
@@ -6046,7 +6210,7 @@ mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info) | |||
6046 | 6210 | ||
6047 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 6211 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
6048 | /* | 6212 | /* |
6049 | * mpt_sp_log_info - Log information returned from SCSI Parallel IOC. | 6213 | * mpt_spi_log_info - Log information returned from SCSI Parallel IOC. |
6050 | * @ioc: Pointer to MPT_ADAPTER structure | 6214 | * @ioc: Pointer to MPT_ADAPTER structure |
6051 | * @mr: Pointer to MPT reply frame | 6215 | * @mr: Pointer to MPT reply frame |
6052 | * @log_info: U32 LogInfo word from the IOC | 6216 | * @log_info: U32 LogInfo word from the IOC |
@@ -6054,7 +6218,7 @@ mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info) | |||
6054 | * Refer to lsi/sp_log.h. | 6218 | * Refer to lsi/sp_log.h. |
6055 | */ | 6219 | */ |
6056 | static void | 6220 | static void |
6057 | mpt_sp_log_info(MPT_ADAPTER *ioc, u32 log_info) | 6221 | mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info) |
6058 | { | 6222 | { |
6059 | u32 info = log_info & 0x00FF0000; | 6223 | u32 info = log_info & 0x00FF0000; |
6060 | char *desc = "unknown"; | 6224 | char *desc = "unknown"; |
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h index 47053ac65068..ea2649ecad1f 100644 --- a/drivers/message/fusion/mptbase.h +++ b/drivers/message/fusion/mptbase.h | |||
@@ -76,8 +76,8 @@ | |||
76 | #define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR | 76 | #define COPYRIGHT "Copyright (c) 1999-2005 " MODULEAUTHOR |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #define MPT_LINUX_VERSION_COMMON "3.03.06" | 79 | #define MPT_LINUX_VERSION_COMMON "3.03.07" |
80 | #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.06" | 80 | #define MPT_LINUX_PACKAGE_NAME "@(#)mptlinux-3.03.07" |
81 | #define WHAT_MAGIC_STRING "@" "(" "#" ")" | 81 | #define WHAT_MAGIC_STRING "@" "(" "#" ")" |
82 | 82 | ||
83 | #define show_mptmod_ver(s,ver) \ | 83 | #define show_mptmod_ver(s,ver) \ |
@@ -123,7 +123,7 @@ | |||
123 | #define MPT_MAX_FRAME_SIZE 128 | 123 | #define MPT_MAX_FRAME_SIZE 128 |
124 | #define MPT_DEFAULT_FRAME_SIZE 128 | 124 | #define MPT_DEFAULT_FRAME_SIZE 128 |
125 | 125 | ||
126 | #define MPT_REPLY_FRAME_SIZE 0x40 /* Must be a multiple of 8 */ | 126 | #define MPT_REPLY_FRAME_SIZE 0x50 /* Must be a multiple of 8 */ |
127 | 127 | ||
128 | #define MPT_SG_REQ_128_SCALE 1 | 128 | #define MPT_SG_REQ_128_SCALE 1 |
129 | #define MPT_SG_REQ_96_SCALE 2 | 129 | #define MPT_SG_REQ_96_SCALE 2 |
@@ -510,9 +510,10 @@ struct mptfc_rport_info | |||
510 | { | 510 | { |
511 | struct list_head list; | 511 | struct list_head list; |
512 | struct fc_rport *rport; | 512 | struct fc_rport *rport; |
513 | VirtDevice *vdev; | 513 | struct scsi_target *starget; |
514 | FCDevicePage0_t pg0; | 514 | FCDevicePage0_t pg0; |
515 | u8 flags; | 515 | u8 flags; |
516 | u8 remap_needed; | ||
516 | }; | 517 | }; |
517 | 518 | ||
518 | /* | 519 | /* |
@@ -631,6 +632,7 @@ typedef struct _MPT_ADAPTER | |||
631 | struct mutex sas_topology_mutex; | 632 | struct mutex sas_topology_mutex; |
632 | MPT_SAS_MGMT sas_mgmt; | 633 | MPT_SAS_MGMT sas_mgmt; |
633 | int num_ports; | 634 | int num_ports; |
635 | struct work_struct mptscsih_persistTask; | ||
634 | 636 | ||
635 | struct list_head fc_rports; | 637 | struct list_head fc_rports; |
636 | spinlock_t fc_rport_lock; /* list and ri flags */ | 638 | spinlock_t fc_rport_lock; /* list and ri flags */ |
@@ -803,6 +805,12 @@ typedef struct _mpt_sge { | |||
803 | #define dreplyprintk(x) | 805 | #define dreplyprintk(x) |
804 | #endif | 806 | #endif |
805 | 807 | ||
808 | #ifdef DMPT_DEBUG_FC | ||
809 | #define dfcprintk(x) printk x | ||
810 | #else | ||
811 | #define dfcprintk(x) | ||
812 | #endif | ||
813 | |||
806 | #ifdef MPT_DEBUG_TM | 814 | #ifdef MPT_DEBUG_TM |
807 | #define dtmprintk(x) printk x | 815 | #define dtmprintk(x) printk x |
808 | #define DBG_DUMP_TM_REQUEST_FRAME(mfp) \ | 816 | #define DBG_DUMP_TM_REQUEST_FRAME(mfp) \ |
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index b102c7666d0e..c3a3499bce2a 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c | |||
@@ -93,10 +93,11 @@ static int mptfcDoneCtx = -1; | |||
93 | static int mptfcTaskCtx = -1; | 93 | static int mptfcTaskCtx = -1; |
94 | static int mptfcInternalCtx = -1; /* Used only for internal commands */ | 94 | static int mptfcInternalCtx = -1; /* Used only for internal commands */ |
95 | 95 | ||
96 | int mptfc_slave_alloc(struct scsi_device *device); | 96 | static int mptfc_target_alloc(struct scsi_target *starget); |
97 | static int mptfc_slave_alloc(struct scsi_device *sdev); | ||
97 | static int mptfc_qcmd(struct scsi_cmnd *SCpnt, | 98 | static int mptfc_qcmd(struct scsi_cmnd *SCpnt, |
98 | void (*done)(struct scsi_cmnd *)); | 99 | void (*done)(struct scsi_cmnd *)); |
99 | 100 | static void mptfc_target_destroy(struct scsi_target *starget); | |
100 | static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout); | 101 | static void mptfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout); |
101 | static void __devexit mptfc_remove(struct pci_dev *pdev); | 102 | static void __devexit mptfc_remove(struct pci_dev *pdev); |
102 | 103 | ||
@@ -107,10 +108,10 @@ static struct scsi_host_template mptfc_driver_template = { | |||
107 | .name = "MPT FC Host", | 108 | .name = "MPT FC Host", |
108 | .info = mptscsih_info, | 109 | .info = mptscsih_info, |
109 | .queuecommand = mptfc_qcmd, | 110 | .queuecommand = mptfc_qcmd, |
110 | .target_alloc = mptscsih_target_alloc, | 111 | .target_alloc = mptfc_target_alloc, |
111 | .slave_alloc = mptfc_slave_alloc, | 112 | .slave_alloc = mptfc_slave_alloc, |
112 | .slave_configure = mptscsih_slave_configure, | 113 | .slave_configure = mptscsih_slave_configure, |
113 | .target_destroy = mptscsih_target_destroy, | 114 | .target_destroy = mptfc_target_destroy, |
114 | .slave_destroy = mptscsih_slave_destroy, | 115 | .slave_destroy = mptscsih_slave_destroy, |
115 | .change_queue_depth = mptscsih_change_queue_depth, | 116 | .change_queue_depth = mptscsih_change_queue_depth, |
116 | .eh_abort_handler = mptscsih_abort, | 117 | .eh_abort_handler = mptscsih_abort, |
@@ -348,14 +349,33 @@ mptfc_generate_rport_ids(FCDevicePage0_t *pg0, struct fc_rport_identifiers *rid) | |||
348 | } | 349 | } |
349 | 350 | ||
350 | static void | 351 | static void |
352 | mptfc_remap_sdev(struct scsi_device *sdev, void *arg) | ||
353 | { | ||
354 | VirtDevice *vdev; | ||
355 | VirtTarget *vtarget; | ||
356 | struct scsi_target *starget; | ||
357 | |||
358 | starget = scsi_target(sdev); | ||
359 | if (starget->hostdata == arg) { | ||
360 | vtarget = arg; | ||
361 | vdev = sdev->hostdata; | ||
362 | if (vdev) { | ||
363 | vdev->bus_id = vtarget->bus_id; | ||
364 | vdev->target_id = vtarget->target_id; | ||
365 | } | ||
366 | } | ||
367 | } | ||
368 | |||
369 | static void | ||
351 | mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) | 370 | mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) |
352 | { | 371 | { |
353 | struct fc_rport_identifiers rport_ids; | 372 | struct fc_rport_identifiers rport_ids; |
354 | struct fc_rport *rport; | 373 | struct fc_rport *rport; |
355 | struct mptfc_rport_info *ri; | 374 | struct mptfc_rport_info *ri; |
356 | int match = 0; | 375 | int new_ri = 1; |
357 | u64 port_name; | 376 | u64 pn; |
358 | unsigned long flags; | 377 | unsigned long flags; |
378 | VirtTarget *vtarget; | ||
359 | 379 | ||
360 | if (mptfc_generate_rport_ids(pg0, &rport_ids) < 0) | 380 | if (mptfc_generate_rport_ids(pg0, &rport_ids) < 0) |
361 | return; | 381 | return; |
@@ -363,14 +383,14 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) | |||
363 | /* scan list looking for a match */ | 383 | /* scan list looking for a match */ |
364 | spin_lock_irqsave(&ioc->fc_rport_lock, flags); | 384 | spin_lock_irqsave(&ioc->fc_rport_lock, flags); |
365 | list_for_each_entry(ri, &ioc->fc_rports, list) { | 385 | list_for_each_entry(ri, &ioc->fc_rports, list) { |
366 | port_name = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; | 386 | pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; |
367 | if (port_name == rport_ids.port_name) { /* match */ | 387 | if (pn == rport_ids.port_name) { /* match */ |
368 | list_move_tail(&ri->list, &ioc->fc_rports); | 388 | list_move_tail(&ri->list, &ioc->fc_rports); |
369 | match = 1; | 389 | new_ri = 0; |
370 | break; | 390 | break; |
371 | } | 391 | } |
372 | } | 392 | } |
373 | if (!match) { /* allocate one */ | 393 | if (new_ri) { /* allocate one */ |
374 | spin_unlock_irqrestore(&ioc->fc_rport_lock, flags); | 394 | spin_unlock_irqrestore(&ioc->fc_rport_lock, flags); |
375 | ri = kzalloc(sizeof(struct mptfc_rport_info), GFP_KERNEL); | 395 | ri = kzalloc(sizeof(struct mptfc_rport_info), GFP_KERNEL); |
376 | if (!ri) | 396 | if (!ri) |
@@ -382,40 +402,43 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) | |||
382 | ri->pg0 = *pg0; /* add/update pg0 data */ | 402 | ri->pg0 = *pg0; /* add/update pg0 data */ |
383 | ri->flags &= ~MPT_RPORT_INFO_FLAGS_MISSING; | 403 | ri->flags &= ~MPT_RPORT_INFO_FLAGS_MISSING; |
384 | 404 | ||
405 | /* MPT_RPORT_INFO_FLAGS_REGISTERED - rport not previously deleted */ | ||
385 | if (!(ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED)) { | 406 | if (!(ri->flags & MPT_RPORT_INFO_FLAGS_REGISTERED)) { |
386 | ri->flags |= MPT_RPORT_INFO_FLAGS_REGISTERED; | 407 | ri->flags |= MPT_RPORT_INFO_FLAGS_REGISTERED; |
387 | spin_unlock_irqrestore(&ioc->fc_rport_lock, flags); | 408 | spin_unlock_irqrestore(&ioc->fc_rport_lock, flags); |
388 | rport = fc_remote_port_add(ioc->sh,channel, &rport_ids); | 409 | rport = fc_remote_port_add(ioc->sh, channel, &rport_ids); |
389 | spin_lock_irqsave(&ioc->fc_rport_lock, flags); | 410 | spin_lock_irqsave(&ioc->fc_rport_lock, flags); |
390 | if (rport) { | 411 | if (rport) { |
391 | if (*((struct mptfc_rport_info **)rport->dd_data) != ri) { | 412 | ri->rport = rport; |
392 | ri->flags &= ~MPT_RPORT_INFO_FLAGS_MAPPED_VDEV; | 413 | if (new_ri) /* may have been reset by user */ |
393 | ri->vdev = NULL; | 414 | rport->dev_loss_tmo = mptfc_dev_loss_tmo; |
394 | ri->rport = rport; | 415 | *((struct mptfc_rport_info **)rport->dd_data) = ri; |
395 | *((struct mptfc_rport_info **)rport->dd_data) = ri; | ||
396 | } | ||
397 | rport->dev_loss_tmo = mptfc_dev_loss_tmo; | ||
398 | /* | 416 | /* |
399 | * if already mapped, remap here. If not mapped, | 417 | * if already mapped, remap here. If not mapped, |
400 | * slave_alloc will allocate vdev and map | 418 | * target_alloc will allocate vtarget and map, |
419 | * slave_alloc will fill in vdev from vtarget. | ||
401 | */ | 420 | */ |
402 | if (ri->flags & MPT_RPORT_INFO_FLAGS_MAPPED_VDEV) { | 421 | if (ri->starget) { |
403 | ri->vdev->target_id = ri->pg0.CurrentTargetID; | 422 | vtarget = ri->starget->hostdata; |
404 | ri->vdev->bus_id = ri->pg0.CurrentBus; | 423 | if (vtarget) { |
405 | ri->vdev->vtarget->target_id = ri->vdev->target_id; | 424 | vtarget->target_id = pg0->CurrentTargetID; |
406 | ri->vdev->vtarget->bus_id = ri->vdev->bus_id; | 425 | vtarget->bus_id = pg0->CurrentBus; |
426 | starget_for_each_device(ri->starget, | ||
427 | vtarget,mptfc_remap_sdev); | ||
428 | } | ||
429 | ri->remap_needed = 0; | ||
407 | } | 430 | } |
408 | #ifdef MPT_DEBUG | 431 | dfcprintk ((MYIOC_s_INFO_FMT |
409 | printk ("mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, " | 432 | "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, " |
410 | "rport tid %d, tmo %d\n", | 433 | "rport tid %d, tmo %d\n", |
411 | ioc->sh->host_no, | 434 | ioc->name, |
435 | oc->sh->host_no, | ||
412 | pg0->PortIdentifier, | 436 | pg0->PortIdentifier, |
413 | pg0->WWNN, | 437 | pg0->WWNN, |
414 | pg0->WWPN, | 438 | pg0->WWPN, |
415 | pg0->CurrentTargetID, | 439 | pg0->CurrentTargetID, |
416 | ri->rport->scsi_target_id, | 440 | ri->rport->scsi_target_id, |
417 | ri->rport->dev_loss_tmo); | 441 | ri->rport->dev_loss_tmo)); |
418 | #endif | ||
419 | } else { | 442 | } else { |
420 | list_del(&ri->list); | 443 | list_del(&ri->list); |
421 | kfree(ri); | 444 | kfree(ri); |
@@ -427,6 +450,65 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0) | |||
427 | } | 450 | } |
428 | 451 | ||
429 | /* | 452 | /* |
453 | * OS entry point to allow for host driver to free allocated memory | ||
454 | * Called if no device present or device being unloaded | ||
455 | */ | ||
456 | static void | ||
457 | mptfc_target_destroy(struct scsi_target *starget) | ||
458 | { | ||
459 | struct fc_rport *rport; | ||
460 | struct mptfc_rport_info *ri; | ||
461 | |||
462 | rport = starget_to_rport(starget); | ||
463 | if (rport) { | ||
464 | ri = *((struct mptfc_rport_info **)rport->dd_data); | ||
465 | if (ri) /* better be! */ | ||
466 | ri->starget = NULL; | ||
467 | } | ||
468 | if (starget->hostdata) | ||
469 | kfree(starget->hostdata); | ||
470 | starget->hostdata = NULL; | ||
471 | } | ||
472 | |||
473 | /* | ||
474 | * OS entry point to allow host driver to alloc memory | ||
475 | * for each scsi target. Called once per device the bus scan. | ||
476 | * Return non-zero if allocation fails. | ||
477 | */ | ||
478 | static int | ||
479 | mptfc_target_alloc(struct scsi_target *starget) | ||
480 | { | ||
481 | VirtTarget *vtarget; | ||
482 | struct fc_rport *rport; | ||
483 | struct mptfc_rport_info *ri; | ||
484 | int rc; | ||
485 | |||
486 | vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); | ||
487 | if (!vtarget) | ||
488 | return -ENOMEM; | ||
489 | starget->hostdata = vtarget; | ||
490 | |||
491 | rc = -ENODEV; | ||
492 | rport = starget_to_rport(starget); | ||
493 | if (rport) { | ||
494 | ri = *((struct mptfc_rport_info **)rport->dd_data); | ||
495 | if (ri) { /* better be! */ | ||
496 | vtarget->target_id = ri->pg0.CurrentTargetID; | ||
497 | vtarget->bus_id = ri->pg0.CurrentBus; | ||
498 | ri->starget = starget; | ||
499 | ri->remap_needed = 0; | ||
500 | rc = 0; | ||
501 | } | ||
502 | } | ||
503 | if (rc != 0) { | ||
504 | kfree(vtarget); | ||
505 | starget->hostdata = NULL; | ||
506 | } | ||
507 | |||
508 | return rc; | ||
509 | } | ||
510 | |||
511 | /* | ||
430 | * OS entry point to allow host driver to alloc memory | 512 | * OS entry point to allow host driver to alloc memory |
431 | * for each scsi device. Called once per device the bus scan. | 513 | * for each scsi device. Called once per device the bus scan. |
432 | * Return non-zero if allocation fails. | 514 | * Return non-zero if allocation fails. |
@@ -440,7 +522,6 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
440 | VirtDevice *vdev; | 522 | VirtDevice *vdev; |
441 | struct scsi_target *starget; | 523 | struct scsi_target *starget; |
442 | struct fc_rport *rport; | 524 | struct fc_rport *rport; |
443 | struct mptfc_rport_info *ri; | ||
444 | unsigned long flags; | 525 | unsigned long flags; |
445 | 526 | ||
446 | 527 | ||
@@ -451,55 +532,44 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
451 | 532 | ||
452 | hd = (MPT_SCSI_HOST *)sdev->host->hostdata; | 533 | hd = (MPT_SCSI_HOST *)sdev->host->hostdata; |
453 | 534 | ||
454 | vdev = kmalloc(sizeof(VirtDevice), GFP_KERNEL); | 535 | vdev = kzalloc(sizeof(VirtDevice), GFP_KERNEL); |
455 | if (!vdev) { | 536 | if (!vdev) { |
456 | printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", | 537 | printk(MYIOC_s_ERR_FMT "slave_alloc kmalloc(%zd) FAILED!\n", |
457 | hd->ioc->name, sizeof(VirtDevice)); | 538 | hd->ioc->name, sizeof(VirtDevice)); |
458 | return -ENOMEM; | 539 | return -ENOMEM; |
459 | } | 540 | } |
460 | memset(vdev, 0, sizeof(VirtDevice)); | ||
461 | 541 | ||
462 | spin_lock_irqsave(&hd->ioc->fc_rport_lock,flags); | 542 | spin_lock_irqsave(&hd->ioc->fc_rport_lock,flags); |
463 | 543 | ||
464 | if (!(ri = *((struct mptfc_rport_info **)rport->dd_data))) { | ||
465 | spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags); | ||
466 | kfree(vdev); | ||
467 | return -ENODEV; | ||
468 | } | ||
469 | |||
470 | sdev->hostdata = vdev; | 544 | sdev->hostdata = vdev; |
471 | starget = scsi_target(sdev); | 545 | starget = scsi_target(sdev); |
472 | vtarget = starget->hostdata; | 546 | vtarget = starget->hostdata; |
547 | |||
473 | if (vtarget->num_luns == 0) { | 548 | if (vtarget->num_luns == 0) { |
549 | vtarget->ioc_id = hd->ioc->id; | ||
474 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES | | 550 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES | |
475 | MPT_TARGET_FLAGS_VALID_INQUIRY; | 551 | MPT_TARGET_FLAGS_VALID_INQUIRY; |
476 | hd->Targets[sdev->id] = vtarget; | 552 | hd->Targets[sdev->id] = vtarget; |
477 | } | 553 | } |
478 | 554 | ||
479 | vtarget->target_id = vdev->target_id; | ||
480 | vtarget->bus_id = vdev->bus_id; | ||
481 | |||
482 | vdev->vtarget = vtarget; | 555 | vdev->vtarget = vtarget; |
483 | vdev->ioc_id = hd->ioc->id; | 556 | vdev->ioc_id = hd->ioc->id; |
484 | vdev->lun = sdev->lun; | 557 | vdev->lun = sdev->lun; |
485 | vdev->target_id = ri->pg0.CurrentTargetID; | 558 | vdev->target_id = vtarget->target_id; |
486 | vdev->bus_id = ri->pg0.CurrentBus; | 559 | vdev->bus_id = vtarget->bus_id; |
487 | |||
488 | ri->flags |= MPT_RPORT_INFO_FLAGS_MAPPED_VDEV; | ||
489 | ri->vdev = vdev; | ||
490 | 560 | ||
491 | spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags); | 561 | spin_unlock_irqrestore(&hd->ioc->fc_rport_lock,flags); |
492 | 562 | ||
493 | vtarget->num_luns++; | 563 | vtarget->num_luns++; |
494 | 564 | ||
495 | #ifdef MPT_DEBUG | 565 | dfcprintk ((MYIOC_s_INFO_FMT |
496 | printk ("mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, " | 566 | "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, " |
497 | "CurrentTargetID %d, %x %llx %llx\n", | 567 | "CurrentTargetID %d, %x %llx %llx\n", |
498 | sdev->host->host_no, | 568 | ioc->name, |
499 | vtarget->num_luns, | 569 | sdev->host->host_no, |
500 | sdev->id, ri->pg0.CurrentTargetID, | 570 | vtarget->num_luns, |
501 | ri->pg0.PortIdentifier, ri->pg0.WWPN, ri->pg0.WWNN); | 571 | sdev->id, ri->pg0.CurrentTargetID, |
502 | #endif | 572 | ri->pg0.PortIdentifier, ri->pg0.WWPN, ri->pg0.WWNN)); |
503 | 573 | ||
504 | return 0; | 574 | return 0; |
505 | } | 575 | } |
@@ -507,6 +577,7 @@ mptfc_slave_alloc(struct scsi_device *sdev) | |||
507 | static int | 577 | static int |
508 | mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | 578 | mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) |
509 | { | 579 | { |
580 | struct mptfc_rport_info *ri; | ||
510 | struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device)); | 581 | struct fc_rport *rport = starget_to_rport(scsi_target(SCpnt->device)); |
511 | int err; | 582 | int err; |
512 | 583 | ||
@@ -516,6 +587,10 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) | |||
516 | done(SCpnt); | 587 | done(SCpnt); |
517 | return 0; | 588 | return 0; |
518 | } | 589 | } |
590 | ri = *((struct mptfc_rport_info **)rport->dd_data); | ||
591 | if (unlikely(ri->remap_needed)) | ||
592 | return SCSI_MLQUEUE_HOST_BUSY; | ||
593 | |||
519 | return mptscsih_qcmd(SCpnt,done); | 594 | return mptscsih_qcmd(SCpnt,done); |
520 | } | 595 | } |
521 | 596 | ||
@@ -591,16 +666,20 @@ mptfc_rescan_devices(void *arg) | |||
591 | 666 | ||
592 | ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED| | 667 | ri->flags &= ~(MPT_RPORT_INFO_FLAGS_REGISTERED| |
593 | MPT_RPORT_INFO_FLAGS_MISSING); | 668 | MPT_RPORT_INFO_FLAGS_MISSING); |
669 | ri->remap_needed = 1; | ||
594 | fc_remote_port_delete(ri->rport); | 670 | fc_remote_port_delete(ri->rport); |
595 | /* | 671 | /* |
596 | * remote port not really deleted 'cause | 672 | * remote port not really deleted 'cause |
597 | * binding is by WWPN and driver only | 673 | * binding is by WWPN and driver only |
598 | * registers FCP_TARGETs | 674 | * registers FCP_TARGETs but cannot trust |
675 | * data structures. | ||
599 | */ | 676 | */ |
600 | #ifdef MPT_DEBUG | 677 | ri->rport = NULL; |
601 | printk ("mptfc_rescan.%d: %llx deleted\n", | 678 | dfcprintk ((MYIOC_s_INFO_FMT |
602 | ioc->sh->host_no, ri->pg0.WWPN); | 679 | "mptfc_rescan.%d: %llx deleted\n", |
603 | #endif | 680 | ioc->name, |
681 | ioc->sh->host_no, | ||
682 | ri->pg0.WWPN)); | ||
604 | } | 683 | } |
605 | } | 684 | } |
606 | spin_unlock_irqrestore(&ioc->fc_rport_lock,flags); | 685 | spin_unlock_irqrestore(&ioc->fc_rport_lock,flags); |
@@ -872,9 +951,8 @@ mptfc_init(void) | |||
872 | } | 951 | } |
873 | 952 | ||
874 | error = pci_register_driver(&mptfc_driver); | 953 | error = pci_register_driver(&mptfc_driver); |
875 | if (error) { | 954 | if (error) |
876 | fc_release_transport(mptfc_transport_template); | 955 | fc_release_transport(mptfc_transport_template); |
877 | } | ||
878 | 956 | ||
879 | return error; | 957 | return error; |
880 | } | 958 | } |
@@ -885,7 +963,8 @@ mptfc_init(void) | |||
885 | * @pdev: Pointer to pci_dev structure | 963 | * @pdev: Pointer to pci_dev structure |
886 | * | 964 | * |
887 | */ | 965 | */ |
888 | static void __devexit mptfc_remove(struct pci_dev *pdev) | 966 | static void __devexit |
967 | mptfc_remove(struct pci_dev *pdev) | ||
889 | { | 968 | { |
890 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); | 969 | MPT_ADAPTER *ioc = pci_get_drvdata(pdev); |
891 | struct mptfc_rport_info *p, *n; | 970 | struct mptfc_rport_info *p, *n; |
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 5a06d8d8694e..2512d0e6155e 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -89,6 +89,8 @@ static int mptsasMgmtCtx = -1; | |||
89 | enum mptsas_hotplug_action { | 89 | enum mptsas_hotplug_action { |
90 | MPTSAS_ADD_DEVICE, | 90 | MPTSAS_ADD_DEVICE, |
91 | MPTSAS_DEL_DEVICE, | 91 | MPTSAS_DEL_DEVICE, |
92 | MPTSAS_ADD_RAID, | ||
93 | MPTSAS_DEL_RAID, | ||
92 | }; | 94 | }; |
93 | 95 | ||
94 | struct mptsas_hotplug_event { | 96 | struct mptsas_hotplug_event { |
@@ -114,6 +116,7 @@ struct mptsas_hotplug_event { | |||
114 | 116 | ||
115 | struct mptsas_devinfo { | 117 | struct mptsas_devinfo { |
116 | u16 handle; /* unique id to address this device */ | 118 | u16 handle; /* unique id to address this device */ |
119 | u16 handle_parent; /* unique id to address parent device */ | ||
117 | u8 phy_id; /* phy number of parent device */ | 120 | u8 phy_id; /* phy number of parent device */ |
118 | u8 port_id; /* sas physical port this device | 121 | u8 port_id; /* sas physical port this device |
119 | is assoc'd with */ | 122 | is assoc'd with */ |
@@ -301,9 +304,8 @@ mptsas_slave_alloc(struct scsi_device *sdev) | |||
301 | } | 304 | } |
302 | mutex_unlock(&hd->ioc->sas_topology_mutex); | 305 | mutex_unlock(&hd->ioc->sas_topology_mutex); |
303 | 306 | ||
304 | printk("No matching SAS device found!!\n"); | ||
305 | kfree(vdev); | 307 | kfree(vdev); |
306 | return -ENODEV; | 308 | return -ENXIO; |
307 | 309 | ||
308 | out: | 310 | out: |
309 | vtarget->ioc_id = vdev->ioc_id; | 311 | vtarget->ioc_id = vdev->ioc_id; |
@@ -321,6 +323,7 @@ mptsas_slave_destroy(struct scsi_device *sdev) | |||
321 | struct sas_rphy *rphy; | 323 | struct sas_rphy *rphy; |
322 | struct mptsas_portinfo *p; | 324 | struct mptsas_portinfo *p; |
323 | int i; | 325 | int i; |
326 | VirtDevice *vdev; | ||
324 | 327 | ||
325 | /* | 328 | /* |
326 | * Handle hotplug removal case. | 329 | * Handle hotplug removal case. |
@@ -344,8 +347,29 @@ mptsas_slave_destroy(struct scsi_device *sdev) | |||
344 | out: | 347 | out: |
345 | mutex_unlock(&hd->ioc->sas_topology_mutex); | 348 | mutex_unlock(&hd->ioc->sas_topology_mutex); |
346 | /* | 349 | /* |
347 | * TODO: Issue target reset to flush firmware outstanding commands. | 350 | * Issue target reset to flush firmware outstanding commands. |
348 | */ | 351 | */ |
352 | vdev = sdev->hostdata; | ||
353 | if (vdev->configured_lun){ | ||
354 | if (mptscsih_TMHandler(hd, | ||
355 | MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, | ||
356 | vdev->bus_id, | ||
357 | vdev->target_id, | ||
358 | 0, 0, 5 /* 5 second timeout */) | ||
359 | < 0){ | ||
360 | |||
361 | /* The TM request failed! | ||
362 | * Fatal error case. | ||
363 | */ | ||
364 | printk(MYIOC_s_WARN_FMT | ||
365 | "Error processing TaskMgmt id=%d TARGET_RESET\n", | ||
366 | hd->ioc->name, | ||
367 | vdev->target_id); | ||
368 | |||
369 | hd->tmPending = 0; | ||
370 | hd->tmState = TM_STATE_NONE; | ||
371 | } | ||
372 | } | ||
349 | mptscsih_slave_destroy(sdev); | 373 | mptscsih_slave_destroy(sdev); |
350 | } | 374 | } |
351 | 375 | ||
@@ -714,6 +738,7 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info, | |||
714 | mptsas_print_device_pg0(buffer); | 738 | mptsas_print_device_pg0(buffer); |
715 | 739 | ||
716 | device_info->handle = le16_to_cpu(buffer->DevHandle); | 740 | device_info->handle = le16_to_cpu(buffer->DevHandle); |
741 | device_info->handle_parent = le16_to_cpu(buffer->ParentDevHandle); | ||
717 | device_info->phy_id = buffer->PhyNum; | 742 | device_info->phy_id = buffer->PhyNum; |
718 | device_info->port_id = buffer->PhysicalPort; | 743 | device_info->port_id = buffer->PhysicalPort; |
719 | device_info->id = buffer->TargetID; | 744 | device_info->id = buffer->TargetID; |
@@ -863,6 +888,26 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, | |||
863 | return error; | 888 | return error; |
864 | } | 889 | } |
865 | 890 | ||
891 | /* | ||
892 | * Returns true if there is a scsi end device | ||
893 | */ | ||
894 | static inline int | ||
895 | mptsas_is_end_device(struct mptsas_devinfo * attached) | ||
896 | { | ||
897 | if ((attached->handle) && | ||
898 | (attached->device_info & | ||
899 | MPI_SAS_DEVICE_INFO_END_DEVICE) && | ||
900 | ((attached->device_info & | ||
901 | MPI_SAS_DEVICE_INFO_SSP_TARGET) | | ||
902 | (attached->device_info & | ||
903 | MPI_SAS_DEVICE_INFO_STP_TARGET) | | ||
904 | (attached->device_info & | ||
905 | MPI_SAS_DEVICE_INFO_SATA_DEVICE))) | ||
906 | return 1; | ||
907 | else | ||
908 | return 0; | ||
909 | } | ||
910 | |||
866 | static void | 911 | static void |
867 | mptsas_parse_device_info(struct sas_identify *identify, | 912 | mptsas_parse_device_info(struct sas_identify *identify, |
868 | struct mptsas_devinfo *device_info) | 913 | struct mptsas_devinfo *device_info) |
@@ -1227,7 +1272,7 @@ mptsas_find_phyinfo_by_parent(MPT_ADAPTER *ioc, u16 parent_handle, u8 phy_id) | |||
1227 | } | 1272 | } |
1228 | 1273 | ||
1229 | static struct mptsas_phyinfo * | 1274 | static struct mptsas_phyinfo * |
1230 | mptsas_find_phyinfo_by_handle(MPT_ADAPTER *ioc, u16 handle) | 1275 | mptsas_find_phyinfo_by_target(MPT_ADAPTER *ioc, u32 id) |
1231 | { | 1276 | { |
1232 | struct mptsas_portinfo *port_info; | 1277 | struct mptsas_portinfo *port_info; |
1233 | struct mptsas_phyinfo *phy_info = NULL; | 1278 | struct mptsas_phyinfo *phy_info = NULL; |
@@ -1239,12 +1284,12 @@ mptsas_find_phyinfo_by_handle(MPT_ADAPTER *ioc, u16 handle) | |||
1239 | */ | 1284 | */ |
1240 | mutex_lock(&ioc->sas_topology_mutex); | 1285 | mutex_lock(&ioc->sas_topology_mutex); |
1241 | list_for_each_entry(port_info, &ioc->sas_topology, list) { | 1286 | list_for_each_entry(port_info, &ioc->sas_topology, list) { |
1242 | for (i = 0; i < port_info->num_phys; i++) { | 1287 | for (i = 0; i < port_info->num_phys; i++) |
1243 | if (port_info->phy_info[i].attached.handle == handle) { | 1288 | if (mptsas_is_end_device(&port_info->phy_info[i].attached)) |
1244 | phy_info = &port_info->phy_info[i]; | 1289 | if (port_info->phy_info[i].attached.id == id) { |
1245 | break; | 1290 | phy_info = &port_info->phy_info[i]; |
1246 | } | 1291 | break; |
1247 | } | 1292 | } |
1248 | } | 1293 | } |
1249 | mutex_unlock(&ioc->sas_topology_mutex); | 1294 | mutex_unlock(&ioc->sas_topology_mutex); |
1250 | 1295 | ||
@@ -1258,36 +1303,58 @@ mptsas_hotplug_work(void *arg) | |||
1258 | MPT_ADAPTER *ioc = ev->ioc; | 1303 | MPT_ADAPTER *ioc = ev->ioc; |
1259 | struct mptsas_phyinfo *phy_info; | 1304 | struct mptsas_phyinfo *phy_info; |
1260 | struct sas_rphy *rphy; | 1305 | struct sas_rphy *rphy; |
1306 | struct scsi_device *sdev; | ||
1261 | char *ds = NULL; | 1307 | char *ds = NULL; |
1262 | 1308 | struct mptsas_devinfo sas_device; | |
1263 | if (ev->device_info & MPI_SAS_DEVICE_INFO_SSP_TARGET) | ||
1264 | ds = "ssp"; | ||
1265 | if (ev->device_info & MPI_SAS_DEVICE_INFO_STP_TARGET) | ||
1266 | ds = "stp"; | ||
1267 | if (ev->device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE) | ||
1268 | ds = "sata"; | ||
1269 | 1309 | ||
1270 | switch (ev->event_type) { | 1310 | switch (ev->event_type) { |
1271 | case MPTSAS_DEL_DEVICE: | 1311 | case MPTSAS_DEL_DEVICE: |
1272 | printk(MYIOC_s_INFO_FMT | ||
1273 | "removing %s device, channel %d, id %d, phy %d\n", | ||
1274 | ioc->name, ds, ev->channel, ev->id, ev->phy_id); | ||
1275 | 1312 | ||
1276 | phy_info = mptsas_find_phyinfo_by_handle(ioc, ev->handle); | 1313 | phy_info = mptsas_find_phyinfo_by_target(ioc, ev->id); |
1277 | if (!phy_info) { | 1314 | if (!phy_info) { |
1278 | printk("mptsas: remove event for non-existant PHY.\n"); | 1315 | printk("mptsas: remove event for non-existant PHY.\n"); |
1279 | break; | 1316 | break; |
1280 | } | 1317 | } |
1281 | 1318 | ||
1319 | if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_SSP_TARGET) | ||
1320 | ds = "ssp"; | ||
1321 | if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_STP_TARGET) | ||
1322 | ds = "stp"; | ||
1323 | if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE) | ||
1324 | ds = "sata"; | ||
1325 | |||
1326 | printk(MYIOC_s_INFO_FMT | ||
1327 | "removing %s device, channel %d, id %d, phy %d\n", | ||
1328 | ioc->name, ds, ev->channel, ev->id, phy_info->phy_id); | ||
1329 | |||
1282 | if (phy_info->rphy) { | 1330 | if (phy_info->rphy) { |
1283 | sas_rphy_delete(phy_info->rphy); | 1331 | sas_rphy_delete(phy_info->rphy); |
1284 | phy_info->rphy = NULL; | 1332 | phy_info->rphy = NULL; |
1285 | } | 1333 | } |
1286 | break; | 1334 | break; |
1287 | case MPTSAS_ADD_DEVICE: | 1335 | case MPTSAS_ADD_DEVICE: |
1288 | printk(MYIOC_s_INFO_FMT | 1336 | |
1289 | "attaching %s device, channel %d, id %d, phy %d\n", | 1337 | /* |
1290 | ioc->name, ds, ev->channel, ev->id, ev->phy_id); | 1338 | * When there is no sas address, |
1339 | * RAID volumes are being deleted, | ||
1340 | * and hidden phy disk are being added. | ||
1341 | * We don't know the SAS data yet, | ||
1342 | * so lookup sas device page to get | ||
1343 | * pertaining info | ||
1344 | */ | ||
1345 | if (!ev->sas_address) { | ||
1346 | if (mptsas_sas_device_pg0(ioc, | ||
1347 | &sas_device, ev->id, | ||
1348 | (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID << | ||
1349 | MPI_SAS_DEVICE_PGAD_FORM_SHIFT))) | ||
1350 | break; | ||
1351 | ev->handle = sas_device.handle; | ||
1352 | ev->parent_handle = sas_device.handle_parent; | ||
1353 | ev->channel = sas_device.channel; | ||
1354 | ev->phy_id = sas_device.phy_id; | ||
1355 | ev->sas_address = sas_device.sas_address; | ||
1356 | ev->device_info = sas_device.device_info; | ||
1357 | } | ||
1291 | 1358 | ||
1292 | phy_info = mptsas_find_phyinfo_by_parent(ioc, | 1359 | phy_info = mptsas_find_phyinfo_by_parent(ioc, |
1293 | ev->parent_handle, ev->phy_id); | 1360 | ev->parent_handle, ev->phy_id); |
@@ -1310,10 +1377,23 @@ mptsas_hotplug_work(void *arg) | |||
1310 | phy_info->attached.sas_address = ev->sas_address; | 1377 | phy_info->attached.sas_address = ev->sas_address; |
1311 | phy_info->attached.device_info = ev->device_info; | 1378 | phy_info->attached.device_info = ev->device_info; |
1312 | 1379 | ||
1380 | if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_SSP_TARGET) | ||
1381 | ds = "ssp"; | ||
1382 | if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_STP_TARGET) | ||
1383 | ds = "stp"; | ||
1384 | if (phy_info->attached.device_info & MPI_SAS_DEVICE_INFO_SATA_DEVICE) | ||
1385 | ds = "sata"; | ||
1386 | |||
1387 | printk(MYIOC_s_INFO_FMT | ||
1388 | "attaching %s device, channel %d, id %d, phy %d\n", | ||
1389 | ioc->name, ds, ev->channel, ev->id, ev->phy_id); | ||
1390 | |||
1391 | |||
1313 | rphy = sas_rphy_alloc(phy_info->phy); | 1392 | rphy = sas_rphy_alloc(phy_info->phy); |
1314 | if (!rphy) | 1393 | if (!rphy) |
1315 | break; /* non-fatal: an rphy can be added later */ | 1394 | break; /* non-fatal: an rphy can be added later */ |
1316 | 1395 | ||
1396 | rphy->scsi_target_id = phy_info->attached.id; | ||
1317 | mptsas_parse_device_info(&rphy->identify, &phy_info->attached); | 1397 | mptsas_parse_device_info(&rphy->identify, &phy_info->attached); |
1318 | if (sas_rphy_add(rphy)) { | 1398 | if (sas_rphy_add(rphy)) { |
1319 | sas_rphy_free(rphy); | 1399 | sas_rphy_free(rphy); |
@@ -1322,6 +1402,40 @@ mptsas_hotplug_work(void *arg) | |||
1322 | 1402 | ||
1323 | phy_info->rphy = rphy; | 1403 | phy_info->rphy = rphy; |
1324 | break; | 1404 | break; |
1405 | case MPTSAS_ADD_RAID: | ||
1406 | sdev = scsi_device_lookup( | ||
1407 | ioc->sh, | ||
1408 | ioc->num_ports, | ||
1409 | ev->id, | ||
1410 | 0); | ||
1411 | if (sdev) { | ||
1412 | scsi_device_put(sdev); | ||
1413 | break; | ||
1414 | } | ||
1415 | printk(MYIOC_s_INFO_FMT | ||
1416 | "attaching device, channel %d, id %d\n", | ||
1417 | ioc->name, ioc->num_ports, ev->id); | ||
1418 | scsi_add_device(ioc->sh, | ||
1419 | ioc->num_ports, | ||
1420 | ev->id, | ||
1421 | 0); | ||
1422 | mpt_findImVolumes(ioc); | ||
1423 | break; | ||
1424 | case MPTSAS_DEL_RAID: | ||
1425 | sdev = scsi_device_lookup( | ||
1426 | ioc->sh, | ||
1427 | ioc->num_ports, | ||
1428 | ev->id, | ||
1429 | 0); | ||
1430 | if (!sdev) | ||
1431 | break; | ||
1432 | printk(MYIOC_s_INFO_FMT | ||
1433 | "removing device, channel %d, id %d\n", | ||
1434 | ioc->name, ioc->num_ports, ev->id); | ||
1435 | scsi_remove_device(sdev); | ||
1436 | scsi_device_put(sdev); | ||
1437 | mpt_findImVolumes(ioc); | ||
1438 | break; | ||
1325 | } | 1439 | } |
1326 | 1440 | ||
1327 | kfree(ev); | 1441 | kfree(ev); |
@@ -1372,23 +1486,94 @@ mptscsih_send_sas_event(MPT_ADAPTER *ioc, | |||
1372 | schedule_work(&ev->work); | 1486 | schedule_work(&ev->work); |
1373 | } | 1487 | } |
1374 | 1488 | ||
1489 | static void | ||
1490 | mptscsih_send_raid_event(MPT_ADAPTER *ioc, | ||
1491 | EVENT_DATA_RAID *raid_event_data) | ||
1492 | { | ||
1493 | struct mptsas_hotplug_event *ev; | ||
1494 | RAID_VOL0_STATUS * volumeStatus; | ||
1495 | |||
1496 | if (ioc->bus_type != SAS) | ||
1497 | return; | ||
1498 | |||
1499 | ev = kmalloc(sizeof(*ev), GFP_ATOMIC); | ||
1500 | if (!ev) { | ||
1501 | printk(KERN_WARNING "mptsas: lost hotplug event\n"); | ||
1502 | return; | ||
1503 | } | ||
1504 | |||
1505 | memset(ev,0,sizeof(struct mptsas_hotplug_event)); | ||
1506 | INIT_WORK(&ev->work, mptsas_hotplug_work, ev); | ||
1507 | ev->ioc = ioc; | ||
1508 | ev->id = raid_event_data->VolumeID; | ||
1509 | |||
1510 | switch (raid_event_data->ReasonCode) { | ||
1511 | case MPI_EVENT_RAID_RC_PHYSDISK_DELETED: | ||
1512 | ev->event_type = MPTSAS_ADD_DEVICE; | ||
1513 | break; | ||
1514 | case MPI_EVENT_RAID_RC_PHYSDISK_CREATED: | ||
1515 | ev->event_type = MPTSAS_DEL_DEVICE; | ||
1516 | break; | ||
1517 | case MPI_EVENT_RAID_RC_VOLUME_DELETED: | ||
1518 | ev->event_type = MPTSAS_DEL_RAID; | ||
1519 | break; | ||
1520 | case MPI_EVENT_RAID_RC_VOLUME_CREATED: | ||
1521 | ev->event_type = MPTSAS_ADD_RAID; | ||
1522 | break; | ||
1523 | case MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED: | ||
1524 | volumeStatus = (RAID_VOL0_STATUS *) & | ||
1525 | raid_event_data->SettingsStatus; | ||
1526 | ev->event_type = (volumeStatus->State == | ||
1527 | MPI_RAIDVOL0_STATUS_STATE_FAILED) ? | ||
1528 | MPTSAS_DEL_RAID : MPTSAS_ADD_RAID; | ||
1529 | break; | ||
1530 | default: | ||
1531 | break; | ||
1532 | } | ||
1533 | schedule_work(&ev->work); | ||
1534 | } | ||
1535 | |||
1536 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
1537 | /* work queue thread to clear the persitency table */ | ||
1538 | static void | ||
1539 | mptscsih_sas_persist_clear_table(void * arg) | ||
1540 | { | ||
1541 | MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; | ||
1542 | |||
1543 | mptbase_sas_persist_operation(ioc, MPI_SAS_OP_CLEAR_NOT_PRESENT); | ||
1544 | } | ||
1545 | |||
1375 | static int | 1546 | static int |
1376 | mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply) | 1547 | mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply) |
1377 | { | 1548 | { |
1549 | int rc=1; | ||
1378 | u8 event = le32_to_cpu(reply->Event) & 0xFF; | 1550 | u8 event = le32_to_cpu(reply->Event) & 0xFF; |
1379 | 1551 | ||
1380 | if (!ioc->sh) | 1552 | if (!ioc->sh) |
1381 | return 1; | 1553 | goto out; |
1382 | 1554 | ||
1383 | switch (event) { | 1555 | switch (event) { |
1384 | case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: | 1556 | case MPI_EVENT_SAS_DEVICE_STATUS_CHANGE: |
1385 | mptscsih_send_sas_event(ioc, | 1557 | mptscsih_send_sas_event(ioc, |
1386 | (EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *)reply->Data); | 1558 | (EVENT_DATA_SAS_DEVICE_STATUS_CHANGE *)reply->Data); |
1387 | return 1; /* currently means nothing really */ | 1559 | break; |
1388 | 1560 | case MPI_EVENT_INTEGRATED_RAID: | |
1561 | mptscsih_send_raid_event(ioc, | ||
1562 | (EVENT_DATA_RAID *)reply->Data); | ||
1563 | break; | ||
1564 | case MPI_EVENT_PERSISTENT_TABLE_FULL: | ||
1565 | INIT_WORK(&ioc->mptscsih_persistTask, | ||
1566 | mptscsih_sas_persist_clear_table, | ||
1567 | (void *)ioc); | ||
1568 | schedule_work(&ioc->mptscsih_persistTask); | ||
1569 | break; | ||
1389 | default: | 1570 | default: |
1390 | return mptscsih_event_process(ioc, reply); | 1571 | rc = mptscsih_event_process(ioc, reply); |
1572 | break; | ||
1391 | } | 1573 | } |
1574 | out: | ||
1575 | |||
1576 | return rc; | ||
1392 | } | 1577 | } |
1393 | 1578 | ||
1394 | static int | 1579 | static int |
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index cdac5578fdf2..05789e505464 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c | |||
@@ -144,7 +144,6 @@ static int mptscsih_tm_pending_wait(MPT_SCSI_HOST * hd); | |||
144 | static int mptscsih_tm_wait_for_completion(MPT_SCSI_HOST * hd, ulong timeout ); | 144 | static int mptscsih_tm_wait_for_completion(MPT_SCSI_HOST * hd, ulong timeout ); |
145 | static u32 SCPNT_TO_LOOKUP_IDX(struct scsi_cmnd *sc); | 145 | static u32 SCPNT_TO_LOOKUP_IDX(struct scsi_cmnd *sc); |
146 | 146 | ||
147 | static int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout); | ||
148 | static int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout); | 147 | static int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout); |
149 | 148 | ||
150 | int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); | 149 | int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); |
@@ -159,11 +158,9 @@ static int mptscsih_writeIOCPage4(MPT_SCSI_HOST *hd, int target_id, int bus); | |||
159 | int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); | 158 | int mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *r); |
160 | static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd); | 159 | static int mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *iocmd); |
161 | static void mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice); | 160 | static void mptscsih_synchronize_cache(MPT_SCSI_HOST *hd, VirtDevice *vdevice); |
162 | static void mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget); | 161 | static void mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtDevice *vdevice); |
163 | static int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id); | 162 | static int mptscsih_is_phys_disk(MPT_ADAPTER *ioc, int id); |
164 | 163 | ||
165 | static struct work_struct mptscsih_persistTask; | ||
166 | |||
167 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION | 164 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION |
168 | static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io); | 165 | static int mptscsih_do_raid(MPT_SCSI_HOST *hd, u8 action, INTERNAL_CMD *io); |
169 | static void mptscsih_domainValidation(void *hd); | 166 | static void mptscsih_domainValidation(void *hd); |
@@ -563,11 +560,24 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
563 | MPT_SCSI_HOST *hd; | 560 | MPT_SCSI_HOST *hd; |
564 | SCSIIORequest_t *pScsiReq; | 561 | SCSIIORequest_t *pScsiReq; |
565 | SCSIIOReply_t *pScsiReply; | 562 | SCSIIOReply_t *pScsiReply; |
566 | u16 req_idx; | 563 | u16 req_idx, req_idx_MR; |
567 | 564 | ||
568 | hd = (MPT_SCSI_HOST *) ioc->sh->hostdata; | 565 | hd = (MPT_SCSI_HOST *) ioc->sh->hostdata; |
569 | 566 | ||
570 | req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); | 567 | req_idx = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx); |
568 | req_idx_MR = (mr != NULL) ? | ||
569 | le16_to_cpu(mr->u.frame.hwhdr.msgctxu.fld.req_idx) : req_idx; | ||
570 | if ((req_idx != req_idx_MR) || | ||
571 | (mf->u.frame.linkage.arg1 == 0xdeadbeaf)) { | ||
572 | printk(MYIOC_s_ERR_FMT "Received a mf that was already freed\n", | ||
573 | ioc->name); | ||
574 | printk (MYIOC_s_ERR_FMT | ||
575 | "req_idx=%x req_idx_MR=%x mf=%p mr=%p sc=%p\n", | ||
576 | ioc->name, req_idx, req_idx_MR, mf, mr, | ||
577 | hd->ScsiLookup[req_idx_MR]); | ||
578 | return 0; | ||
579 | } | ||
580 | |||
571 | sc = hd->ScsiLookup[req_idx]; | 581 | sc = hd->ScsiLookup[req_idx]; |
572 | if (sc == NULL) { | 582 | if (sc == NULL) { |
573 | MPIHeader_t *hdr = (MPIHeader_t *)mf; | 583 | MPIHeader_t *hdr = (MPIHeader_t *)mf; |
@@ -730,6 +740,8 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
730 | 740 | ||
731 | break; | 741 | break; |
732 | 742 | ||
743 | case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */ | ||
744 | sc->resid=0; | ||
733 | case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */ | 745 | case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: /* 0x0040 */ |
734 | case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */ | 746 | case MPI_IOCSTATUS_SUCCESS: /* 0x0000 */ |
735 | if (scsi_status == MPI_SCSI_STATUS_BUSY) | 747 | if (scsi_status == MPI_SCSI_STATUS_BUSY) |
@@ -789,7 +801,6 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) | |||
789 | case MPI_IOCSTATUS_INSUFFICIENT_RESOURCES: /* 0x0006 */ | 801 | case MPI_IOCSTATUS_INSUFFICIENT_RESOURCES: /* 0x0006 */ |
790 | case MPI_IOCSTATUS_INVALID_FIELD: /* 0x0007 */ | 802 | case MPI_IOCSTATUS_INVALID_FIELD: /* 0x0007 */ |
791 | case MPI_IOCSTATUS_INVALID_STATE: /* 0x0008 */ | 803 | case MPI_IOCSTATUS_INVALID_STATE: /* 0x0008 */ |
792 | case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */ | ||
793 | case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */ | 804 | case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */ |
794 | case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED: /* 0x004A */ | 805 | case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED: /* 0x004A */ |
795 | default: | 806 | default: |
@@ -1530,7 +1541,7 @@ mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx) | |||
1530 | * | 1541 | * |
1531 | * Returns 0 for SUCCESS or -1 if FAILED. | 1542 | * Returns 0 for SUCCESS or -1 if FAILED. |
1532 | */ | 1543 | */ |
1533 | static int | 1544 | int |
1534 | mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout) | 1545 | mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout) |
1535 | { | 1546 | { |
1536 | MPT_ADAPTER *ioc; | 1547 | MPT_ADAPTER *ioc; |
@@ -1721,6 +1732,20 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun | |||
1721 | return retval; | 1732 | return retval; |
1722 | } | 1733 | } |
1723 | 1734 | ||
1735 | static int | ||
1736 | mptscsih_get_tm_timeout(MPT_ADAPTER *ioc) | ||
1737 | { | ||
1738 | switch (ioc->bus_type) { | ||
1739 | case FC: | ||
1740 | return 40; | ||
1741 | case SAS: | ||
1742 | return 10; | ||
1743 | case SPI: | ||
1744 | default: | ||
1745 | return 2; | ||
1746 | } | ||
1747 | } | ||
1748 | |||
1724 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 1749 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
1725 | /** | 1750 | /** |
1726 | * mptscsih_abort - Abort linux scsi_cmnd routine, new_eh variant | 1751 | * mptscsih_abort - Abort linux scsi_cmnd routine, new_eh variant |
@@ -1792,7 +1817,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt) | |||
1792 | vdev = SCpnt->device->hostdata; | 1817 | vdev = SCpnt->device->hostdata; |
1793 | retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, | 1818 | retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, |
1794 | vdev->bus_id, vdev->target_id, vdev->lun, | 1819 | vdev->bus_id, vdev->target_id, vdev->lun, |
1795 | ctx2abort, 2 /* 2 second timeout */); | 1820 | ctx2abort, mptscsih_get_tm_timeout(ioc)); |
1796 | 1821 | ||
1797 | printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", | 1822 | printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", |
1798 | hd->ioc->name, | 1823 | hd->ioc->name, |
@@ -1843,7 +1868,7 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt) | |||
1843 | vdev = SCpnt->device->hostdata; | 1868 | vdev = SCpnt->device->hostdata; |
1844 | retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, | 1869 | retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, |
1845 | vdev->bus_id, vdev->target_id, | 1870 | vdev->bus_id, vdev->target_id, |
1846 | 0, 0, 5 /* 5 second timeout */); | 1871 | 0, 0, mptscsih_get_tm_timeout(hd->ioc)); |
1847 | 1872 | ||
1848 | printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n", | 1873 | printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n", |
1849 | hd->ioc->name, | 1874 | hd->ioc->name, |
@@ -1893,7 +1918,7 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt) | |||
1893 | 1918 | ||
1894 | vdev = SCpnt->device->hostdata; | 1919 | vdev = SCpnt->device->hostdata; |
1895 | retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, | 1920 | retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, |
1896 | vdev->bus_id, 0, 0, 0, 5 /* 5 second timeout */); | 1921 | vdev->bus_id, 0, 0, 0, mptscsih_get_tm_timeout(hd->ioc)); |
1897 | 1922 | ||
1898 | printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n", | 1923 | printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n", |
1899 | hd->ioc->name, | 1924 | hd->ioc->name, |
@@ -2016,6 +2041,42 @@ mptscsih_tm_wait_for_completion(MPT_SCSI_HOST * hd, ulong timeout ) | |||
2016 | } | 2041 | } |
2017 | 2042 | ||
2018 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2043 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2044 | static void | ||
2045 | mptscsih_taskmgmt_response_code(MPT_ADAPTER *ioc, u8 response_code) | ||
2046 | { | ||
2047 | char *desc; | ||
2048 | |||
2049 | switch (response_code) { | ||
2050 | case MPI_SCSITASKMGMT_RSP_TM_COMPLETE: | ||
2051 | desc = "The task completed."; | ||
2052 | break; | ||
2053 | case MPI_SCSITASKMGMT_RSP_INVALID_FRAME: | ||
2054 | desc = "The IOC received an invalid frame status."; | ||
2055 | break; | ||
2056 | case MPI_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED: | ||
2057 | desc = "The task type is not supported."; | ||
2058 | break; | ||
2059 | case MPI_SCSITASKMGMT_RSP_TM_FAILED: | ||
2060 | desc = "The requested task failed."; | ||
2061 | break; | ||
2062 | case MPI_SCSITASKMGMT_RSP_TM_SUCCEEDED: | ||
2063 | desc = "The task completed successfully."; | ||
2064 | break; | ||
2065 | case MPI_SCSITASKMGMT_RSP_TM_INVALID_LUN: | ||
2066 | desc = "The LUN request is invalid."; | ||
2067 | break; | ||
2068 | case MPI_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC: | ||
2069 | desc = "The task is in the IOC queue and has not been sent to target."; | ||
2070 | break; | ||
2071 | default: | ||
2072 | desc = "unknown"; | ||
2073 | break; | ||
2074 | } | ||
2075 | printk(MYIOC_s_INFO_FMT "Response Code(0x%08x): F/W: %s\n", | ||
2076 | ioc->name, response_code, desc); | ||
2077 | } | ||
2078 | |||
2079 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
2019 | /** | 2080 | /** |
2020 | * mptscsih_taskmgmt_complete - Registered with Fusion MPT base driver | 2081 | * mptscsih_taskmgmt_complete - Registered with Fusion MPT base driver |
2021 | * @ioc: Pointer to MPT_ADAPTER structure | 2082 | * @ioc: Pointer to MPT_ADAPTER structure |
@@ -2064,6 +2125,11 @@ mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *m | |||
2064 | /* Figure out if this was ABORT_TASK, TARGET_RESET, or BUS_RESET! */ | 2125 | /* Figure out if this was ABORT_TASK, TARGET_RESET, or BUS_RESET! */ |
2065 | tmType = pScsiTmReq->TaskType; | 2126 | tmType = pScsiTmReq->TaskType; |
2066 | 2127 | ||
2128 | if (ioc->facts.MsgVersion >= MPI_VERSION_01_05 && | ||
2129 | pScsiTmReply->ResponseCode) | ||
2130 | mptscsih_taskmgmt_response_code(ioc, | ||
2131 | pScsiTmReply->ResponseCode); | ||
2132 | |||
2067 | dtmprintk((MYIOC_s_WARN_FMT " TaskType = %d, TerminationCount=%d\n", | 2133 | dtmprintk((MYIOC_s_WARN_FMT " TaskType = %d, TerminationCount=%d\n", |
2068 | ioc->name, tmType, le32_to_cpu(pScsiTmReply->TerminationCount))); | 2134 | ioc->name, tmType, le32_to_cpu(pScsiTmReply->TerminationCount))); |
2069 | DBG_DUMP_TM_REPLY_FRAME((u32 *)pScsiTmReply); | 2135 | DBG_DUMP_TM_REPLY_FRAME((u32 *)pScsiTmReply); |
@@ -2255,7 +2321,7 @@ mptscsih_slave_destroy(struct scsi_device *sdev) | |||
2255 | vtarget->luns[0] &= ~(1 << vdevice->lun); | 2321 | vtarget->luns[0] &= ~(1 << vdevice->lun); |
2256 | vtarget->num_luns--; | 2322 | vtarget->num_luns--; |
2257 | if (vtarget->num_luns == 0) { | 2323 | if (vtarget->num_luns == 0) { |
2258 | mptscsih_negotiate_to_asyn_narrow(hd, vtarget); | 2324 | mptscsih_negotiate_to_asyn_narrow(hd, vdevice); |
2259 | if (hd->ioc->bus_type == SPI) { | 2325 | if (hd->ioc->bus_type == SPI) { |
2260 | if (mptscsih_is_phys_disk(hd->ioc, vtarget->target_id)) { | 2326 | if (mptscsih_is_phys_disk(hd->ioc, vtarget->target_id)) { |
2261 | hd->ioc->spi_data.forceDv |= MPT_SCSICFG_RELOAD_IOC_PG3; | 2327 | hd->ioc->spi_data.forceDv |= MPT_SCSICFG_RELOAD_IOC_PG3; |
@@ -2585,16 +2651,6 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) | |||
2585 | } | 2651 | } |
2586 | 2652 | ||
2587 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 2653 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
2588 | /* work queue thread to clear the persitency table */ | ||
2589 | static void | ||
2590 | mptscsih_sas_persist_clear_table(void * arg) | ||
2591 | { | ||
2592 | MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg; | ||
2593 | |||
2594 | mptbase_sas_persist_operation(ioc, MPI_SAS_OP_CLEAR_NOT_PRESENT); | ||
2595 | } | ||
2596 | |||
2597 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
2598 | int | 2654 | int |
2599 | mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | 2655 | mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) |
2600 | { | 2656 | { |
@@ -2656,13 +2712,6 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply) | |||
2656 | break; | 2712 | break; |
2657 | } | 2713 | } |
2658 | 2714 | ||
2659 | /* Persistent table is full. */ | ||
2660 | case MPI_EVENT_PERSISTENT_TABLE_FULL: | ||
2661 | INIT_WORK(&mptscsih_persistTask, | ||
2662 | mptscsih_sas_persist_clear_table,(void *)ioc); | ||
2663 | schedule_work(&mptscsih_persistTask); | ||
2664 | break; | ||
2665 | |||
2666 | case MPI_EVENT_NONE: /* 00 */ | 2715 | case MPI_EVENT_NONE: /* 00 */ |
2667 | case MPI_EVENT_LOG_DATA: /* 01 */ | 2716 | case MPI_EVENT_LOG_DATA: /* 01 */ |
2668 | case MPI_EVENT_STATE_CHANGE: /* 02 */ | 2717 | case MPI_EVENT_STATE_CHANGE: /* 02 */ |
@@ -3863,8 +3912,9 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io) | |||
3863 | * | 3912 | * |
3864 | */ | 3913 | */ |
3865 | static void | 3914 | static void |
3866 | mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget) | 3915 | mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtDevice *vdevice) |
3867 | { | 3916 | { |
3917 | VirtTarget *vtarget = vdevice->vtarget; | ||
3868 | MPT_ADAPTER *ioc= hd->ioc; | 3918 | MPT_ADAPTER *ioc= hd->ioc; |
3869 | SCSIDevicePage1_t *pcfg1Data; | 3919 | SCSIDevicePage1_t *pcfg1Data; |
3870 | CONFIGPARMS cfg; | 3920 | CONFIGPARMS cfg; |
@@ -3874,7 +3924,8 @@ mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget) | |||
3874 | int requested, configuration, data,i; | 3924 | int requested, configuration, data,i; |
3875 | u8 flags, factor; | 3925 | u8 flags, factor; |
3876 | 3926 | ||
3877 | if (ioc->bus_type != SPI) | 3927 | if ((ioc->bus_type != SPI) || |
3928 | (!vdevice->configured_lun)) | ||
3878 | return; | 3929 | return; |
3879 | 3930 | ||
3880 | if (!ioc->spi_data.sdp1length) | 3931 | if (!ioc->spi_data.sdp1length) |
@@ -3910,7 +3961,7 @@ mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget) | |||
3910 | } | 3961 | } |
3911 | mptscsih_setDevicePage1Flags(0, MPT_ASYNC, 0, &requested, | 3962 | mptscsih_setDevicePage1Flags(0, MPT_ASYNC, 0, &requested, |
3912 | &configuration, flags); | 3963 | &configuration, flags); |
3913 | dnegoprintk(("syncronize cache: id=%d width=0 factor=MPT_ASYNC " | 3964 | dnegoprintk(("nego asyn narrow: id=%d width=0 factor=MPT_ASYNC " |
3914 | "offset=0 negoFlags=%x request=%x config=%x\n", | 3965 | "offset=0 negoFlags=%x request=%x config=%x\n", |
3915 | id, flags, requested, configuration)); | 3966 | id, flags, requested, configuration)); |
3916 | pcfg1Data->RequestedParameters = cpu_to_le32(requested); | 3967 | pcfg1Data->RequestedParameters = cpu_to_le32(requested); |
@@ -3923,7 +3974,7 @@ mptscsih_negotiate_to_asyn_narrow(MPT_SCSI_HOST *hd, VirtTarget *vtarget) | |||
3923 | flags = vtarget->negoFlags; | 3974 | flags = vtarget->negoFlags; |
3924 | mptscsih_setDevicePage1Flags(0, MPT_ASYNC, 0, &requested, | 3975 | mptscsih_setDevicePage1Flags(0, MPT_ASYNC, 0, &requested, |
3925 | &configuration, flags); | 3976 | &configuration, flags); |
3926 | dnegoprintk(("syncronize cache: id=%d width=0 factor=MPT_ASYNC " | 3977 | dnegoprintk(("nego asyn narrow: id=%d width=0 factor=MPT_ASYNC " |
3927 | "offset=0 negoFlags=%x request=%x config=%x\n", | 3978 | "offset=0 negoFlags=%x request=%x config=%x\n", |
3928 | vtarget->target_id, flags, requested, configuration)); | 3979 | vtarget->target_id, flags, requested, configuration)); |
3929 | pcfg1Data->RequestedParameters = cpu_to_le32(requested); | 3980 | pcfg1Data->RequestedParameters = cpu_to_le32(requested); |
@@ -5620,5 +5671,6 @@ EXPORT_SYMBOL(mptscsih_event_process); | |||
5620 | EXPORT_SYMBOL(mptscsih_ioc_reset); | 5671 | EXPORT_SYMBOL(mptscsih_ioc_reset); |
5621 | EXPORT_SYMBOL(mptscsih_change_queue_depth); | 5672 | EXPORT_SYMBOL(mptscsih_change_queue_depth); |
5622 | EXPORT_SYMBOL(mptscsih_timer_expired); | 5673 | EXPORT_SYMBOL(mptscsih_timer_expired); |
5674 | EXPORT_SYMBOL(mptscsih_TMHandler); | ||
5623 | 5675 | ||
5624 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | 5676 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ |
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h index d3cba12f4bd9..44b248d51ea3 100644 --- a/drivers/message/fusion/mptscsih.h +++ b/drivers/message/fusion/mptscsih.h | |||
@@ -108,3 +108,4 @@ extern int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pE | |||
108 | extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); | 108 | extern int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); |
109 | extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth); | 109 | extern int mptscsih_change_queue_depth(struct scsi_device *sdev, int qdepth); |
110 | extern void mptscsih_timer_expired(unsigned long data); | 110 | extern void mptscsih_timer_expired(unsigned long data); |
111 | extern int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout); | ||
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index 7dce29277cb7..f148dfa39117 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c | |||
@@ -384,6 +384,14 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
384 | goto out_mptspi_probe; | 384 | goto out_mptspi_probe; |
385 | } | 385 | } |
386 | 386 | ||
387 | /* | ||
388 | * issue internal bus reset | ||
389 | */ | ||
390 | if (ioc->spi_data.bus_reset) | ||
391 | mptscsih_TMHandler(hd, | ||
392 | MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, | ||
393 | 0, 0, 0, 0, 5); | ||
394 | |||
387 | scsi_scan_host(sh); | 395 | scsi_scan_host(sh); |
388 | return 0; | 396 | return 0; |
389 | 397 | ||
@@ -445,7 +453,7 @@ static void __exit | |||
445 | mptspi_exit(void) | 453 | mptspi_exit(void) |
446 | { | 454 | { |
447 | pci_unregister_driver(&mptspi_driver); | 455 | pci_unregister_driver(&mptspi_driver); |
448 | 456 | ||
449 | mpt_reset_deregister(mptspiDoneCtx); | 457 | mpt_reset_deregister(mptspiDoneCtx); |
450 | dprintk((KERN_INFO MYNAM | 458 | dprintk((KERN_INFO MYNAM |
451 | ": Deregistered for IOC reset notifications\n")); | 459 | ": Deregistered for IOC reset notifications\n")); |
diff --git a/drivers/misc/ibmasm/uart.c b/drivers/misc/ibmasm/uart.c index 7e98434cfa37..9783caf49696 100644 --- a/drivers/misc/ibmasm/uart.c +++ b/drivers/misc/ibmasm/uart.c | |||
@@ -50,7 +50,7 @@ void ibmasm_register_uart(struct service_processor *sp) | |||
50 | memset(&uport, 0, sizeof(struct uart_port)); | 50 | memset(&uport, 0, sizeof(struct uart_port)); |
51 | uport.irq = sp->irq; | 51 | uport.irq = sp->irq; |
52 | uport.uartclk = 3686400; | 52 | uport.uartclk = 3686400; |
53 | uport.flags = UPF_AUTOPROBE | UPF_SHARE_IRQ; | 53 | uport.flags = UPF_SHARE_IRQ; |
54 | uport.iotype = UPIO_MEM; | 54 | uport.iotype = UPIO_MEM; |
55 | uport.membase = iomem_base; | 55 | uport.membase = iomem_base; |
56 | 56 | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 626508afe1b1..6a6a08441804 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2034,13 +2034,28 @@ config SKGE | |||
2034 | It does not support the link failover and network management | 2034 | It does not support the link failover and network management |
2035 | features that "portable" vendor supplied sk98lin driver does. | 2035 | features that "portable" vendor supplied sk98lin driver does. |
2036 | 2036 | ||
2037 | This driver supports adapters based on the original Yukon chipset: | ||
2038 | Marvell 88E8001, Belkin F5D5005, CNet GigaCard, DLink DGE-530T, | ||
2039 | Linksys EG1032/EG1064, 3Com 3C940/3C940B, SysKonnect SK-9871/9872. | ||
2040 | |||
2041 | It does not support the newer Yukon2 chipset: a separate driver, | ||
2042 | sky2, is provided for Yukon2-based adapters. | ||
2043 | |||
2044 | To compile this driver as a module, choose M here: the module | ||
2045 | will be called skge. This is recommended. | ||
2037 | 2046 | ||
2038 | config SKY2 | 2047 | config SKY2 |
2039 | tristate "SysKonnect Yukon2 support (EXPERIMENTAL)" | 2048 | tristate "SysKonnect Yukon2 support (EXPERIMENTAL)" |
2040 | depends on PCI && EXPERIMENTAL | 2049 | depends on PCI && EXPERIMENTAL |
2041 | select CRC32 | 2050 | select CRC32 |
2042 | ---help--- | 2051 | ---help--- |
2043 | This driver support the Marvell Yukon 2 Gigabit Ethernet adapter. | 2052 | This driver supports Gigabit Ethernet adapters based on the the |
2053 | Marvell Yukon 2 chipset: | ||
2054 | Marvell 88E8021/88E8022/88E8035/88E8036/88E8038/88E8050/88E8052/ | ||
2055 | 88E8053/88E8055/88E8061/88E8062, SysKonnect SK-9E21D/SK-9S21 | ||
2056 | |||
2057 | This driver does not support the original Yukon chipset: a seperate | ||
2058 | driver, skge, is provided for Yukon-based adapters. | ||
2044 | 2059 | ||
2045 | To compile this driver as a module, choose M here: the module | 2060 | To compile this driver as a module, choose M here: the module |
2046 | will be called sky2. This is recommended. | 2061 | will be called sky2. This is recommended. |
@@ -2050,8 +2065,15 @@ config SK98LIN | |||
2050 | depends on PCI | 2065 | depends on PCI |
2051 | ---help--- | 2066 | ---help--- |
2052 | Say Y here if you have a Marvell Yukon or SysKonnect SK-98xx/SK-95xx | 2067 | Say Y here if you have a Marvell Yukon or SysKonnect SK-98xx/SK-95xx |
2053 | compliant Gigabit Ethernet Adapter. The following adapters are supported | 2068 | compliant Gigabit Ethernet Adapter. |
2054 | by this driver: | 2069 | |
2070 | This driver supports the original Yukon chipset. A cleaner driver is | ||
2071 | also available (skge) which seems to work better than this one. | ||
2072 | |||
2073 | This driver does not support the newer Yukon2 chipset. A seperate | ||
2074 | driver, sky2, is provided to support Yukon2-based adapters. | ||
2075 | |||
2076 | The following adapters are supported by this driver: | ||
2055 | - 3Com 3C940 Gigabit LOM Ethernet Adapter | 2077 | - 3Com 3C940 Gigabit LOM Ethernet Adapter |
2056 | - 3Com 3C941 Gigabit LOM Ethernet Adapter | 2078 | - 3Com 3C941 Gigabit LOM Ethernet Adapter |
2057 | - Allied Telesyn AT-2970LX Gigabit Ethernet Adapter | 2079 | - Allied Telesyn AT-2970LX Gigabit Ethernet Adapter |
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index b8953de5664a..b508812e97ac 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c | |||
@@ -1002,6 +1002,8 @@ static int __devinit ace_init(struct net_device *dev) | |||
1002 | 1002 | ||
1003 | mac1 = 0; | 1003 | mac1 = 0; |
1004 | for(i = 0; i < 4; i++) { | 1004 | for(i = 0; i < 4; i++) { |
1005 | int tmp; | ||
1006 | |||
1005 | mac1 = mac1 << 8; | 1007 | mac1 = mac1 << 8; |
1006 | tmp = read_eeprom_byte(dev, 0x8c+i); | 1008 | tmp = read_eeprom_byte(dev, 0x8c+i); |
1007 | if (tmp < 0) { | 1009 | if (tmp < 0) { |
@@ -1012,6 +1014,8 @@ static int __devinit ace_init(struct net_device *dev) | |||
1012 | } | 1014 | } |
1013 | mac2 = 0; | 1015 | mac2 = 0; |
1014 | for(i = 4; i < 8; i++) { | 1016 | for(i = 4; i < 8; i++) { |
1017 | int tmp; | ||
1018 | |||
1015 | mac2 = mac2 << 8; | 1019 | mac2 = mac2 << 8; |
1016 | tmp = read_eeprom_byte(dev, 0x8c+i); | 1020 | tmp = read_eeprom_byte(dev, 0x8c+i); |
1017 | if (tmp < 0) { | 1021 | if (tmp < 0) { |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index df9d6e80c4f2..c3267e4e1bb0 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -1399,7 +1399,6 @@ static int b44_open(struct net_device *dev) | |||
1399 | b44_init_rings(bp); | 1399 | b44_init_rings(bp); |
1400 | b44_init_hw(bp); | 1400 | b44_init_hw(bp); |
1401 | 1401 | ||
1402 | netif_carrier_off(dev); | ||
1403 | b44_check_phy(bp); | 1402 | b44_check_phy(bp); |
1404 | 1403 | ||
1405 | err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); | 1404 | err = request_irq(dev->irq, b44_interrupt, SA_SHIRQ, dev->name, dev); |
@@ -1464,7 +1463,7 @@ static int b44_close(struct net_device *dev) | |||
1464 | #endif | 1463 | #endif |
1465 | b44_halt(bp); | 1464 | b44_halt(bp); |
1466 | b44_free_rings(bp); | 1465 | b44_free_rings(bp); |
1467 | netif_carrier_off(bp->dev); | 1466 | netif_carrier_off(dev); |
1468 | 1467 | ||
1469 | spin_unlock_irq(&bp->lock); | 1468 | spin_unlock_irq(&bp->lock); |
1470 | 1469 | ||
@@ -2000,6 +1999,8 @@ static int __devinit b44_init_one(struct pci_dev *pdev, | |||
2000 | dev->irq = pdev->irq; | 1999 | dev->irq = pdev->irq; |
2001 | SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); | 2000 | SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); |
2002 | 2001 | ||
2002 | netif_carrier_off(dev); | ||
2003 | |||
2003 | err = b44_get_invariants(bp); | 2004 | err = b44_get_invariants(bp); |
2004 | if (err) { | 2005 | if (err) { |
2005 | printk(KERN_ERR PFX "Problem fetching invariants of chip, " | 2006 | printk(KERN_ERR PFX "Problem fetching invariants of chip, " |
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 49fa1e4413fa..a24200d0a616 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* bnx2.c: Broadcom NX2 network driver. | 1 | /* bnx2.c: Broadcom NX2 network driver. |
2 | * | 2 | * |
3 | * Copyright (c) 2004, 2005 Broadcom Corporation | 3 | * Copyright (c) 2004, 2005, 2006 Broadcom Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -14,8 +14,8 @@ | |||
14 | 14 | ||
15 | #define DRV_MODULE_NAME "bnx2" | 15 | #define DRV_MODULE_NAME "bnx2" |
16 | #define PFX DRV_MODULE_NAME ": " | 16 | #define PFX DRV_MODULE_NAME ": " |
17 | #define DRV_MODULE_VERSION "1.4.30" | 17 | #define DRV_MODULE_VERSION "1.4.31" |
18 | #define DRV_MODULE_RELDATE "October 11, 2005" | 18 | #define DRV_MODULE_RELDATE "January 19, 2006" |
19 | 19 | ||
20 | #define RUN_AT(x) (jiffies + (x)) | 20 | #define RUN_AT(x) (jiffies + (x)) |
21 | 21 | ||
@@ -316,6 +316,10 @@ bnx2_enable_int(struct bnx2 *bp) | |||
316 | u32 val; | 316 | u32 val; |
317 | 317 | ||
318 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | 318 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, |
319 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | ||
320 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT | bp->last_status_idx); | ||
321 | |||
322 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | ||
319 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | bp->last_status_idx); | 323 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | bp->last_status_idx); |
320 | 324 | ||
321 | val = REG_RD(bp, BNX2_HC_COMMAND); | 325 | val = REG_RD(bp, BNX2_HC_COMMAND); |
@@ -1171,7 +1175,8 @@ bnx2_init_5708s_phy(struct bnx2 *bp) | |||
1171 | } | 1175 | } |
1172 | 1176 | ||
1173 | if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || | 1177 | if ((CHIP_ID(bp) == CHIP_ID_5708_A0) || |
1174 | (CHIP_ID(bp) == CHIP_ID_5708_B0)) { | 1178 | (CHIP_ID(bp) == CHIP_ID_5708_B0) || |
1179 | (CHIP_ID(bp) == CHIP_ID_5708_B1)) { | ||
1175 | /* increase tx signal amplitude */ | 1180 | /* increase tx signal amplitude */ |
1176 | bnx2_write_phy(bp, BCM5708S_BLK_ADDR, | 1181 | bnx2_write_phy(bp, BCM5708S_BLK_ADDR, |
1177 | BCM5708S_BLK_ADDR_TX_MISC); | 1182 | BCM5708S_BLK_ADDR_TX_MISC); |
@@ -1326,44 +1331,78 @@ bnx2_set_mac_loopback(struct bnx2 *bp) | |||
1326 | return 0; | 1331 | return 0; |
1327 | } | 1332 | } |
1328 | 1333 | ||
1334 | static int bnx2_test_link(struct bnx2 *); | ||
1335 | |||
1336 | static int | ||
1337 | bnx2_set_phy_loopback(struct bnx2 *bp) | ||
1338 | { | ||
1339 | u32 mac_mode; | ||
1340 | int rc, i; | ||
1341 | |||
1342 | spin_lock_bh(&bp->phy_lock); | ||
1343 | rc = bnx2_write_phy(bp, MII_BMCR, BMCR_LOOPBACK | BMCR_FULLDPLX | | ||
1344 | BMCR_SPEED1000); | ||
1345 | spin_unlock_bh(&bp->phy_lock); | ||
1346 | if (rc) | ||
1347 | return rc; | ||
1348 | |||
1349 | for (i = 0; i < 10; i++) { | ||
1350 | if (bnx2_test_link(bp) == 0) | ||
1351 | break; | ||
1352 | udelay(10); | ||
1353 | } | ||
1354 | |||
1355 | mac_mode = REG_RD(bp, BNX2_EMAC_MODE); | ||
1356 | mac_mode &= ~(BNX2_EMAC_MODE_PORT | BNX2_EMAC_MODE_HALF_DUPLEX | | ||
1357 | BNX2_EMAC_MODE_MAC_LOOP | BNX2_EMAC_MODE_FORCE_LINK | | ||
1358 | BNX2_EMAC_MODE_25G); | ||
1359 | |||
1360 | mac_mode |= BNX2_EMAC_MODE_PORT_GMII; | ||
1361 | REG_WR(bp, BNX2_EMAC_MODE, mac_mode); | ||
1362 | bp->link_up = 1; | ||
1363 | return 0; | ||
1364 | } | ||
1365 | |||
1329 | static int | 1366 | static int |
1330 | bnx2_fw_sync(struct bnx2 *bp, u32 msg_data) | 1367 | bnx2_fw_sync(struct bnx2 *bp, u32 msg_data, int silent) |
1331 | { | 1368 | { |
1332 | int i; | 1369 | int i; |
1333 | u32 val; | 1370 | u32 val; |
1334 | 1371 | ||
1335 | if (bp->fw_timed_out) | ||
1336 | return -EBUSY; | ||
1337 | |||
1338 | bp->fw_wr_seq++; | 1372 | bp->fw_wr_seq++; |
1339 | msg_data |= bp->fw_wr_seq; | 1373 | msg_data |= bp->fw_wr_seq; |
1340 | 1374 | ||
1341 | REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_MB, msg_data); | 1375 | REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_MB, msg_data); |
1342 | 1376 | ||
1343 | /* wait for an acknowledgement. */ | 1377 | /* wait for an acknowledgement. */ |
1344 | for (i = 0; i < (FW_ACK_TIME_OUT_MS * 1000)/5; i++) { | 1378 | for (i = 0; i < (FW_ACK_TIME_OUT_MS / 10); i++) { |
1345 | udelay(5); | 1379 | msleep(10); |
1346 | 1380 | ||
1347 | val = REG_RD_IND(bp, bp->shmem_base + BNX2_FW_MB); | 1381 | val = REG_RD_IND(bp, bp->shmem_base + BNX2_FW_MB); |
1348 | 1382 | ||
1349 | if ((val & BNX2_FW_MSG_ACK) == (msg_data & BNX2_DRV_MSG_SEQ)) | 1383 | if ((val & BNX2_FW_MSG_ACK) == (msg_data & BNX2_DRV_MSG_SEQ)) |
1350 | break; | 1384 | break; |
1351 | } | 1385 | } |
1386 | if ((msg_data & BNX2_DRV_MSG_DATA) == BNX2_DRV_MSG_DATA_WAIT0) | ||
1387 | return 0; | ||
1352 | 1388 | ||
1353 | /* If we timed out, inform the firmware that this is the case. */ | 1389 | /* If we timed out, inform the firmware that this is the case. */ |
1354 | if (((val & BNX2_FW_MSG_ACK) != (msg_data & BNX2_DRV_MSG_SEQ)) && | 1390 | if ((val & BNX2_FW_MSG_ACK) != (msg_data & BNX2_DRV_MSG_SEQ)) { |
1355 | ((msg_data & BNX2_DRV_MSG_DATA) != BNX2_DRV_MSG_DATA_WAIT0)) { | 1391 | if (!silent) |
1392 | printk(KERN_ERR PFX "fw sync timeout, reset code = " | ||
1393 | "%x\n", msg_data); | ||
1356 | 1394 | ||
1357 | msg_data &= ~BNX2_DRV_MSG_CODE; | 1395 | msg_data &= ~BNX2_DRV_MSG_CODE; |
1358 | msg_data |= BNX2_DRV_MSG_CODE_FW_TIMEOUT; | 1396 | msg_data |= BNX2_DRV_MSG_CODE_FW_TIMEOUT; |
1359 | 1397 | ||
1360 | REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_MB, msg_data); | 1398 | REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_MB, msg_data); |
1361 | 1399 | ||
1362 | bp->fw_timed_out = 1; | ||
1363 | |||
1364 | return -EBUSY; | 1400 | return -EBUSY; |
1365 | } | 1401 | } |
1366 | 1402 | ||
1403 | if ((val & BNX2_FW_MSG_STATUS_MASK) != BNX2_FW_MSG_STATUS_OK) | ||
1404 | return -EIO; | ||
1405 | |||
1367 | return 0; | 1406 | return 0; |
1368 | } | 1407 | } |
1369 | 1408 | ||
@@ -1657,7 +1696,7 @@ bnx2_rx_int(struct bnx2 *bp, int budget) | |||
1657 | rmb(); | 1696 | rmb(); |
1658 | while (sw_cons != hw_cons) { | 1697 | while (sw_cons != hw_cons) { |
1659 | unsigned int len; | 1698 | unsigned int len; |
1660 | u16 status; | 1699 | u32 status; |
1661 | struct sw_bd *rx_buf; | 1700 | struct sw_bd *rx_buf; |
1662 | struct sk_buff *skb; | 1701 | struct sk_buff *skb; |
1663 | 1702 | ||
@@ -1673,7 +1712,7 @@ bnx2_rx_int(struct bnx2 *bp, int budget) | |||
1673 | rx_hdr = (struct l2_fhdr *) skb->data; | 1712 | rx_hdr = (struct l2_fhdr *) skb->data; |
1674 | len = rx_hdr->l2_fhdr_pkt_len - 4; | 1713 | len = rx_hdr->l2_fhdr_pkt_len - 4; |
1675 | 1714 | ||
1676 | if (rx_hdr->l2_fhdr_errors & | 1715 | if ((status = rx_hdr->l2_fhdr_status) & |
1677 | (L2_FHDR_ERRORS_BAD_CRC | | 1716 | (L2_FHDR_ERRORS_BAD_CRC | |
1678 | L2_FHDR_ERRORS_PHY_DECODE | | 1717 | L2_FHDR_ERRORS_PHY_DECODE | |
1679 | L2_FHDR_ERRORS_ALIGNMENT | | 1718 | L2_FHDR_ERRORS_ALIGNMENT | |
@@ -1732,15 +1771,13 @@ reuse_rx: | |||
1732 | 1771 | ||
1733 | } | 1772 | } |
1734 | 1773 | ||
1735 | status = rx_hdr->l2_fhdr_status; | ||
1736 | skb->ip_summed = CHECKSUM_NONE; | 1774 | skb->ip_summed = CHECKSUM_NONE; |
1737 | if (bp->rx_csum && | 1775 | if (bp->rx_csum && |
1738 | (status & (L2_FHDR_STATUS_TCP_SEGMENT | | 1776 | (status & (L2_FHDR_STATUS_TCP_SEGMENT | |
1739 | L2_FHDR_STATUS_UDP_DATAGRAM))) { | 1777 | L2_FHDR_STATUS_UDP_DATAGRAM))) { |
1740 | 1778 | ||
1741 | u16 cksum = rx_hdr->l2_fhdr_tcp_udp_xsum; | 1779 | if (likely((status & (L2_FHDR_ERRORS_TCP_XSUM | |
1742 | 1780 | L2_FHDR_ERRORS_UDP_XSUM)) == 0)) | |
1743 | if (cksum == 0xffff) | ||
1744 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1781 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
1745 | } | 1782 | } |
1746 | 1783 | ||
@@ -1794,7 +1831,7 @@ static irqreturn_t | |||
1794 | bnx2_msi(int irq, void *dev_instance, struct pt_regs *regs) | 1831 | bnx2_msi(int irq, void *dev_instance, struct pt_regs *regs) |
1795 | { | 1832 | { |
1796 | struct net_device *dev = dev_instance; | 1833 | struct net_device *dev = dev_instance; |
1797 | struct bnx2 *bp = dev->priv; | 1834 | struct bnx2 *bp = netdev_priv(dev); |
1798 | 1835 | ||
1799 | prefetch(bp->status_blk); | 1836 | prefetch(bp->status_blk); |
1800 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | 1837 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, |
@@ -1814,7 +1851,7 @@ static irqreturn_t | |||
1814 | bnx2_interrupt(int irq, void *dev_instance, struct pt_regs *regs) | 1851 | bnx2_interrupt(int irq, void *dev_instance, struct pt_regs *regs) |
1815 | { | 1852 | { |
1816 | struct net_device *dev = dev_instance; | 1853 | struct net_device *dev = dev_instance; |
1817 | struct bnx2 *bp = dev->priv; | 1854 | struct bnx2 *bp = netdev_priv(dev); |
1818 | 1855 | ||
1819 | /* When using INTx, it is possible for the interrupt to arrive | 1856 | /* When using INTx, it is possible for the interrupt to arrive |
1820 | * at the CPU before the status block posted prior to the | 1857 | * at the CPU before the status block posted prior to the |
@@ -1859,7 +1896,7 @@ bnx2_has_work(struct bnx2 *bp) | |||
1859 | static int | 1896 | static int |
1860 | bnx2_poll(struct net_device *dev, int *budget) | 1897 | bnx2_poll(struct net_device *dev, int *budget) |
1861 | { | 1898 | { |
1862 | struct bnx2 *bp = dev->priv; | 1899 | struct bnx2 *bp = netdev_priv(dev); |
1863 | 1900 | ||
1864 | if ((bp->status_blk->status_attn_bits & | 1901 | if ((bp->status_blk->status_attn_bits & |
1865 | STATUS_ATTN_BITS_LINK_STATE) != | 1902 | STATUS_ATTN_BITS_LINK_STATE) != |
@@ -1891,9 +1928,20 @@ bnx2_poll(struct net_device *dev, int *budget) | |||
1891 | 1928 | ||
1892 | if (!bnx2_has_work(bp)) { | 1929 | if (!bnx2_has_work(bp)) { |
1893 | netif_rx_complete(dev); | 1930 | netif_rx_complete(dev); |
1931 | if (likely(bp->flags & USING_MSI_FLAG)) { | ||
1932 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | ||
1933 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | ||
1934 | bp->last_status_idx); | ||
1935 | return 0; | ||
1936 | } | ||
1937 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | ||
1938 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | ||
1939 | BNX2_PCICFG_INT_ACK_CMD_MASK_INT | | ||
1940 | bp->last_status_idx); | ||
1941 | |||
1894 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, | 1942 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, |
1895 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | | 1943 | BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID | |
1896 | bp->last_status_idx); | 1944 | bp->last_status_idx); |
1897 | return 0; | 1945 | return 0; |
1898 | } | 1946 | } |
1899 | 1947 | ||
@@ -1906,7 +1954,7 @@ bnx2_poll(struct net_device *dev, int *budget) | |||
1906 | static void | 1954 | static void |
1907 | bnx2_set_rx_mode(struct net_device *dev) | 1955 | bnx2_set_rx_mode(struct net_device *dev) |
1908 | { | 1956 | { |
1909 | struct bnx2 *bp = dev->priv; | 1957 | struct bnx2 *bp = netdev_priv(dev); |
1910 | u32 rx_mode, sort_mode; | 1958 | u32 rx_mode, sort_mode; |
1911 | int i; | 1959 | int i; |
1912 | 1960 | ||
@@ -1916,11 +1964,11 @@ bnx2_set_rx_mode(struct net_device *dev) | |||
1916 | BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); | 1964 | BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG); |
1917 | sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN; | 1965 | sort_mode = 1 | BNX2_RPM_SORT_USER0_BC_EN; |
1918 | #ifdef BCM_VLAN | 1966 | #ifdef BCM_VLAN |
1919 | if (!bp->vlgrp) { | 1967 | if (!bp->vlgrp && !(bp->flags & ASF_ENABLE_FLAG)) |
1920 | rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; | 1968 | rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; |
1921 | } | ||
1922 | #else | 1969 | #else |
1923 | rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; | 1970 | if (!(bp->flags & ASF_ENABLE_FLAG)) |
1971 | rx_mode |= BNX2_EMAC_RX_MODE_KEEP_VLAN_TAG; | ||
1924 | #endif | 1972 | #endif |
1925 | if (dev->flags & IFF_PROMISC) { | 1973 | if (dev->flags & IFF_PROMISC) { |
1926 | /* Promiscuous mode. */ | 1974 | /* Promiscuous mode. */ |
@@ -2338,7 +2386,6 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state) | |||
2338 | val |= BNX2_EMAC_MODE_PORT_MII | | 2386 | val |= BNX2_EMAC_MODE_PORT_MII | |
2339 | BNX2_EMAC_MODE_MPKT_RCVD | | 2387 | BNX2_EMAC_MODE_MPKT_RCVD | |
2340 | BNX2_EMAC_MODE_ACPI_RCVD | | 2388 | BNX2_EMAC_MODE_ACPI_RCVD | |
2341 | BNX2_EMAC_MODE_FORCE_LINK | | ||
2342 | BNX2_EMAC_MODE_MPKT; | 2389 | BNX2_EMAC_MODE_MPKT; |
2343 | 2390 | ||
2344 | REG_WR(bp, BNX2_EMAC_MODE, val); | 2391 | REG_WR(bp, BNX2_EMAC_MODE, val); |
@@ -2374,7 +2421,8 @@ bnx2_set_power_state(struct bnx2 *bp, pci_power_t state) | |||
2374 | wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; | 2421 | wol_msg = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; |
2375 | } | 2422 | } |
2376 | 2423 | ||
2377 | bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT3 | wol_msg); | 2424 | if (!(bp->flags & NO_WOL_FLAG)) |
2425 | bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT3 | wol_msg, 0); | ||
2378 | 2426 | ||
2379 | pmcsr &= ~PCI_PM_CTRL_STATE_MASK; | 2427 | pmcsr &= ~PCI_PM_CTRL_STATE_MASK; |
2380 | if ((CHIP_ID(bp) == CHIP_ID_5706_A0) || | 2428 | if ((CHIP_ID(bp) == CHIP_ID_5706_A0) || |
@@ -2708,9 +2756,16 @@ bnx2_init_nvram(struct bnx2 *bp) | |||
2708 | if (j == entry_count) { | 2756 | if (j == entry_count) { |
2709 | bp->flash_info = NULL; | 2757 | bp->flash_info = NULL; |
2710 | printk(KERN_ALERT PFX "Unknown flash/EEPROM type.\n"); | 2758 | printk(KERN_ALERT PFX "Unknown flash/EEPROM type.\n"); |
2711 | rc = -ENODEV; | 2759 | return -ENODEV; |
2712 | } | 2760 | } |
2713 | 2761 | ||
2762 | val = REG_RD_IND(bp, bp->shmem_base + BNX2_SHARED_HW_CFG_CONFIG2); | ||
2763 | val &= BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK; | ||
2764 | if (val) | ||
2765 | bp->flash_size = val; | ||
2766 | else | ||
2767 | bp->flash_size = bp->flash_info->total_size; | ||
2768 | |||
2714 | return rc; | 2769 | return rc; |
2715 | } | 2770 | } |
2716 | 2771 | ||
@@ -3014,16 +3069,14 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) | |||
3014 | val = REG_RD(bp, BNX2_MISC_ENABLE_CLR_BITS); | 3069 | val = REG_RD(bp, BNX2_MISC_ENABLE_CLR_BITS); |
3015 | udelay(5); | 3070 | udelay(5); |
3016 | 3071 | ||
3072 | /* Wait for the firmware to tell us it is ok to issue a reset. */ | ||
3073 | bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT0 | reset_code, 1); | ||
3074 | |||
3017 | /* Deposit a driver reset signature so the firmware knows that | 3075 | /* Deposit a driver reset signature so the firmware knows that |
3018 | * this is a soft reset. */ | 3076 | * this is a soft reset. */ |
3019 | REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_RESET_SIGNATURE, | 3077 | REG_WR_IND(bp, bp->shmem_base + BNX2_DRV_RESET_SIGNATURE, |
3020 | BNX2_DRV_RESET_SIGNATURE_MAGIC); | 3078 | BNX2_DRV_RESET_SIGNATURE_MAGIC); |
3021 | 3079 | ||
3022 | bp->fw_timed_out = 0; | ||
3023 | |||
3024 | /* Wait for the firmware to tell us it is ok to issue a reset. */ | ||
3025 | bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT0 | reset_code); | ||
3026 | |||
3027 | /* Do a dummy read to force the chip to complete all current transaction | 3080 | /* Do a dummy read to force the chip to complete all current transaction |
3028 | * before we issue a reset. */ | 3081 | * before we issue a reset. */ |
3029 | val = REG_RD(bp, BNX2_MISC_ID); | 3082 | val = REG_RD(bp, BNX2_MISC_ID); |
@@ -3062,10 +3115,10 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code) | |||
3062 | return -ENODEV; | 3115 | return -ENODEV; |
3063 | } | 3116 | } |
3064 | 3117 | ||
3065 | bp->fw_timed_out = 0; | ||
3066 | |||
3067 | /* Wait for the firmware to finish its initialization. */ | 3118 | /* Wait for the firmware to finish its initialization. */ |
3068 | bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT1 | reset_code); | 3119 | rc = bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT1 | reset_code, 0); |
3120 | if (rc) | ||
3121 | return rc; | ||
3069 | 3122 | ||
3070 | if (CHIP_ID(bp) == CHIP_ID_5706_A0) { | 3123 | if (CHIP_ID(bp) == CHIP_ID_5706_A0) { |
3071 | /* Adjust the voltage regular to two steps lower. The default | 3124 | /* Adjust the voltage regular to two steps lower. The default |
@@ -3083,6 +3136,7 @@ static int | |||
3083 | bnx2_init_chip(struct bnx2 *bp) | 3136 | bnx2_init_chip(struct bnx2 *bp) |
3084 | { | 3137 | { |
3085 | u32 val; | 3138 | u32 val; |
3139 | int rc; | ||
3086 | 3140 | ||
3087 | /* Make sure the interrupt is not active. */ | 3141 | /* Make sure the interrupt is not active. */ |
3088 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, BNX2_PCICFG_INT_ACK_CMD_MASK_INT); | 3142 | REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, BNX2_PCICFG_INT_ACK_CMD_MASK_INT); |
@@ -3098,7 +3152,7 @@ bnx2_init_chip(struct bnx2 *bp) | |||
3098 | 3152 | ||
3099 | val |= (0x2 << 20) | (1 << 11); | 3153 | val |= (0x2 << 20) | (1 << 11); |
3100 | 3154 | ||
3101 | if ((bp->flags & PCIX_FLAG) && (bp->bus_speed_mhz = 133)) | 3155 | if ((bp->flags & PCIX_FLAG) && (bp->bus_speed_mhz == 133)) |
3102 | val |= (1 << 23); | 3156 | val |= (1 << 23); |
3103 | 3157 | ||
3104 | if ((CHIP_NUM(bp) == CHIP_NUM_5706) && | 3158 | if ((CHIP_NUM(bp) == CHIP_NUM_5706) && |
@@ -3218,17 +3272,22 @@ bnx2_init_chip(struct bnx2 *bp) | |||
3218 | 3272 | ||
3219 | REG_WR(bp, BNX2_HC_ATTN_BITS_ENABLE, STATUS_ATTN_BITS_LINK_STATE); | 3273 | REG_WR(bp, BNX2_HC_ATTN_BITS_ENABLE, STATUS_ATTN_BITS_LINK_STATE); |
3220 | 3274 | ||
3275 | if (REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_FEATURE) & | ||
3276 | BNX2_PORT_FEATURE_ASF_ENABLED) | ||
3277 | bp->flags |= ASF_ENABLE_FLAG; | ||
3278 | |||
3221 | /* Initialize the receive filter. */ | 3279 | /* Initialize the receive filter. */ |
3222 | bnx2_set_rx_mode(bp->dev); | 3280 | bnx2_set_rx_mode(bp->dev); |
3223 | 3281 | ||
3224 | bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT2 | BNX2_DRV_MSG_CODE_RESET); | 3282 | rc = bnx2_fw_sync(bp, BNX2_DRV_MSG_DATA_WAIT2 | BNX2_DRV_MSG_CODE_RESET, |
3283 | 0); | ||
3225 | 3284 | ||
3226 | REG_WR(bp, BNX2_MISC_ENABLE_SET_BITS, 0x5ffffff); | 3285 | REG_WR(bp, BNX2_MISC_ENABLE_SET_BITS, 0x5ffffff); |
3227 | REG_RD(bp, BNX2_MISC_ENABLE_SET_BITS); | 3286 | REG_RD(bp, BNX2_MISC_ENABLE_SET_BITS); |
3228 | 3287 | ||
3229 | udelay(20); | 3288 | udelay(20); |
3230 | 3289 | ||
3231 | return 0; | 3290 | return rc; |
3232 | } | 3291 | } |
3233 | 3292 | ||
3234 | 3293 | ||
@@ -3880,26 +3939,33 @@ bnx2_test_memory(struct bnx2 *bp) | |||
3880 | return ret; | 3939 | return ret; |
3881 | } | 3940 | } |
3882 | 3941 | ||
3942 | #define BNX2_MAC_LOOPBACK 0 | ||
3943 | #define BNX2_PHY_LOOPBACK 1 | ||
3944 | |||
3883 | static int | 3945 | static int |
3884 | bnx2_test_loopback(struct bnx2 *bp) | 3946 | bnx2_run_loopback(struct bnx2 *bp, int loopback_mode) |
3885 | { | 3947 | { |
3886 | unsigned int pkt_size, num_pkts, i; | 3948 | unsigned int pkt_size, num_pkts, i; |
3887 | struct sk_buff *skb, *rx_skb; | 3949 | struct sk_buff *skb, *rx_skb; |
3888 | unsigned char *packet; | 3950 | unsigned char *packet; |
3889 | u16 rx_start_idx, rx_idx, send_idx; | 3951 | u16 rx_start_idx, rx_idx; |
3890 | u32 send_bseq, val; | 3952 | u32 val; |
3891 | dma_addr_t map; | 3953 | dma_addr_t map; |
3892 | struct tx_bd *txbd; | 3954 | struct tx_bd *txbd; |
3893 | struct sw_bd *rx_buf; | 3955 | struct sw_bd *rx_buf; |
3894 | struct l2_fhdr *rx_hdr; | 3956 | struct l2_fhdr *rx_hdr; |
3895 | int ret = -ENODEV; | 3957 | int ret = -ENODEV; |
3896 | 3958 | ||
3897 | if (!netif_running(bp->dev)) | 3959 | if (loopback_mode == BNX2_MAC_LOOPBACK) { |
3898 | return -ENODEV; | 3960 | bp->loopback = MAC_LOOPBACK; |
3899 | 3961 | bnx2_set_mac_loopback(bp); | |
3900 | bp->loopback = MAC_LOOPBACK; | 3962 | } |
3901 | bnx2_reset_nic(bp, BNX2_DRV_MSG_CODE_DIAG); | 3963 | else if (loopback_mode == BNX2_PHY_LOOPBACK) { |
3902 | bnx2_set_mac_loopback(bp); | 3964 | bp->loopback = 0; |
3965 | bnx2_set_phy_loopback(bp); | ||
3966 | } | ||
3967 | else | ||
3968 | return -EINVAL; | ||
3903 | 3969 | ||
3904 | pkt_size = 1514; | 3970 | pkt_size = 1514; |
3905 | skb = dev_alloc_skb(pkt_size); | 3971 | skb = dev_alloc_skb(pkt_size); |
@@ -3921,11 +3987,9 @@ bnx2_test_loopback(struct bnx2 *bp) | |||
3921 | udelay(5); | 3987 | udelay(5); |
3922 | rx_start_idx = bp->status_blk->status_rx_quick_consumer_index0; | 3988 | rx_start_idx = bp->status_blk->status_rx_quick_consumer_index0; |
3923 | 3989 | ||
3924 | send_idx = 0; | ||
3925 | send_bseq = 0; | ||
3926 | num_pkts = 0; | 3990 | num_pkts = 0; |
3927 | 3991 | ||
3928 | txbd = &bp->tx_desc_ring[send_idx]; | 3992 | txbd = &bp->tx_desc_ring[TX_RING_IDX(bp->tx_prod)]; |
3929 | 3993 | ||
3930 | txbd->tx_bd_haddr_hi = (u64) map >> 32; | 3994 | txbd->tx_bd_haddr_hi = (u64) map >> 32; |
3931 | txbd->tx_bd_haddr_lo = (u64) map & 0xffffffff; | 3995 | txbd->tx_bd_haddr_lo = (u64) map & 0xffffffff; |
@@ -3933,13 +3997,11 @@ bnx2_test_loopback(struct bnx2 *bp) | |||
3933 | txbd->tx_bd_vlan_tag_flags = TX_BD_FLAGS_START | TX_BD_FLAGS_END; | 3997 | txbd->tx_bd_vlan_tag_flags = TX_BD_FLAGS_START | TX_BD_FLAGS_END; |
3934 | 3998 | ||
3935 | num_pkts++; | 3999 | num_pkts++; |
3936 | send_idx = NEXT_TX_BD(send_idx); | 4000 | bp->tx_prod = NEXT_TX_BD(bp->tx_prod); |
3937 | 4001 | bp->tx_prod_bseq += pkt_size; | |
3938 | send_bseq += pkt_size; | ||
3939 | |||
3940 | REG_WR16(bp, MB_TX_CID_ADDR + BNX2_L2CTX_TX_HOST_BIDX, send_idx); | ||
3941 | REG_WR(bp, MB_TX_CID_ADDR + BNX2_L2CTX_TX_HOST_BSEQ, send_bseq); | ||
3942 | 4002 | ||
4003 | REG_WR16(bp, MB_TX_CID_ADDR + BNX2_L2CTX_TX_HOST_BIDX, bp->tx_prod); | ||
4004 | REG_WR(bp, MB_TX_CID_ADDR + BNX2_L2CTX_TX_HOST_BSEQ, bp->tx_prod_bseq); | ||
3943 | 4005 | ||
3944 | udelay(100); | 4006 | udelay(100); |
3945 | 4007 | ||
@@ -3952,7 +4014,7 @@ bnx2_test_loopback(struct bnx2 *bp) | |||
3952 | pci_unmap_single(bp->pdev, map, pkt_size, PCI_DMA_TODEVICE); | 4014 | pci_unmap_single(bp->pdev, map, pkt_size, PCI_DMA_TODEVICE); |
3953 | dev_kfree_skb_irq(skb); | 4015 | dev_kfree_skb_irq(skb); |
3954 | 4016 | ||
3955 | if (bp->status_blk->status_tx_quick_consumer_index0 != send_idx) { | 4017 | if (bp->status_blk->status_tx_quick_consumer_index0 != bp->tx_prod) { |
3956 | goto loopback_test_done; | 4018 | goto loopback_test_done; |
3957 | } | 4019 | } |
3958 | 4020 | ||
@@ -3971,7 +4033,7 @@ bnx2_test_loopback(struct bnx2 *bp) | |||
3971 | pci_unmap_addr(rx_buf, mapping), | 4033 | pci_unmap_addr(rx_buf, mapping), |
3972 | bp->rx_buf_size, PCI_DMA_FROMDEVICE); | 4034 | bp->rx_buf_size, PCI_DMA_FROMDEVICE); |
3973 | 4035 | ||
3974 | if (rx_hdr->l2_fhdr_errors & | 4036 | if (rx_hdr->l2_fhdr_status & |
3975 | (L2_FHDR_ERRORS_BAD_CRC | | 4037 | (L2_FHDR_ERRORS_BAD_CRC | |
3976 | L2_FHDR_ERRORS_PHY_DECODE | | 4038 | L2_FHDR_ERRORS_PHY_DECODE | |
3977 | L2_FHDR_ERRORS_ALIGNMENT | | 4039 | L2_FHDR_ERRORS_ALIGNMENT | |
@@ -3998,6 +4060,30 @@ loopback_test_done: | |||
3998 | return ret; | 4060 | return ret; |
3999 | } | 4061 | } |
4000 | 4062 | ||
4063 | #define BNX2_MAC_LOOPBACK_FAILED 1 | ||
4064 | #define BNX2_PHY_LOOPBACK_FAILED 2 | ||
4065 | #define BNX2_LOOPBACK_FAILED (BNX2_MAC_LOOPBACK_FAILED | \ | ||
4066 | BNX2_PHY_LOOPBACK_FAILED) | ||
4067 | |||
4068 | static int | ||
4069 | bnx2_test_loopback(struct bnx2 *bp) | ||
4070 | { | ||
4071 | int rc = 0; | ||
4072 | |||
4073 | if (!netif_running(bp->dev)) | ||
4074 | return BNX2_LOOPBACK_FAILED; | ||
4075 | |||
4076 | bnx2_reset_nic(bp, BNX2_DRV_MSG_CODE_RESET); | ||
4077 | spin_lock_bh(&bp->phy_lock); | ||
4078 | bnx2_init_phy(bp); | ||
4079 | spin_unlock_bh(&bp->phy_lock); | ||
4080 | if (bnx2_run_loopback(bp, BNX2_MAC_LOOPBACK)) | ||
4081 | rc |= BNX2_MAC_LOOPBACK_FAILED; | ||
4082 | if (bnx2_run_loopback(bp, BNX2_PHY_LOOPBACK)) | ||
4083 | rc |= BNX2_PHY_LOOPBACK_FAILED; | ||
4084 | return rc; | ||
4085 | } | ||
4086 | |||
4001 | #define NVRAM_SIZE 0x200 | 4087 | #define NVRAM_SIZE 0x200 |
4002 | #define CRC32_RESIDUAL 0xdebb20e3 | 4088 | #define CRC32_RESIDUAL 0xdebb20e3 |
4003 | 4089 | ||
@@ -4167,7 +4253,7 @@ bnx2_restart_timer: | |||
4167 | static int | 4253 | static int |
4168 | bnx2_open(struct net_device *dev) | 4254 | bnx2_open(struct net_device *dev) |
4169 | { | 4255 | { |
4170 | struct bnx2 *bp = dev->priv; | 4256 | struct bnx2 *bp = netdev_priv(dev); |
4171 | int rc; | 4257 | int rc; |
4172 | 4258 | ||
4173 | bnx2_set_power_state(bp, PCI_D0); | 4259 | bnx2_set_power_state(bp, PCI_D0); |
@@ -4280,7 +4366,7 @@ bnx2_reset_task(void *data) | |||
4280 | static void | 4366 | static void |
4281 | bnx2_tx_timeout(struct net_device *dev) | 4367 | bnx2_tx_timeout(struct net_device *dev) |
4282 | { | 4368 | { |
4283 | struct bnx2 *bp = dev->priv; | 4369 | struct bnx2 *bp = netdev_priv(dev); |
4284 | 4370 | ||
4285 | /* This allows the netif to be shutdown gracefully before resetting */ | 4371 | /* This allows the netif to be shutdown gracefully before resetting */ |
4286 | schedule_work(&bp->reset_task); | 4372 | schedule_work(&bp->reset_task); |
@@ -4291,7 +4377,7 @@ bnx2_tx_timeout(struct net_device *dev) | |||
4291 | static void | 4377 | static void |
4292 | bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp) | 4378 | bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp) |
4293 | { | 4379 | { |
4294 | struct bnx2 *bp = dev->priv; | 4380 | struct bnx2 *bp = netdev_priv(dev); |
4295 | 4381 | ||
4296 | bnx2_netif_stop(bp); | 4382 | bnx2_netif_stop(bp); |
4297 | 4383 | ||
@@ -4305,7 +4391,7 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp) | |||
4305 | static void | 4391 | static void |
4306 | bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid) | 4392 | bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid) |
4307 | { | 4393 | { |
4308 | struct bnx2 *bp = dev->priv; | 4394 | struct bnx2 *bp = netdev_priv(dev); |
4309 | 4395 | ||
4310 | bnx2_netif_stop(bp); | 4396 | bnx2_netif_stop(bp); |
4311 | 4397 | ||
@@ -4326,7 +4412,7 @@ bnx2_vlan_rx_kill_vid(struct net_device *dev, uint16_t vid) | |||
4326 | static int | 4412 | static int |
4327 | bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | 4413 | bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) |
4328 | { | 4414 | { |
4329 | struct bnx2 *bp = dev->priv; | 4415 | struct bnx2 *bp = netdev_priv(dev); |
4330 | dma_addr_t mapping; | 4416 | dma_addr_t mapping; |
4331 | struct tx_bd *txbd; | 4417 | struct tx_bd *txbd; |
4332 | struct sw_bd *tx_buf; | 4418 | struct sw_bd *tx_buf; |
@@ -4455,7 +4541,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4455 | static int | 4541 | static int |
4456 | bnx2_close(struct net_device *dev) | 4542 | bnx2_close(struct net_device *dev) |
4457 | { | 4543 | { |
4458 | struct bnx2 *bp = dev->priv; | 4544 | struct bnx2 *bp = netdev_priv(dev); |
4459 | u32 reset_code; | 4545 | u32 reset_code; |
4460 | 4546 | ||
4461 | /* Calling flush_scheduled_work() may deadlock because | 4547 | /* Calling flush_scheduled_work() may deadlock because |
@@ -4467,7 +4553,9 @@ bnx2_close(struct net_device *dev) | |||
4467 | 4553 | ||
4468 | bnx2_netif_stop(bp); | 4554 | bnx2_netif_stop(bp); |
4469 | del_timer_sync(&bp->timer); | 4555 | del_timer_sync(&bp->timer); |
4470 | if (bp->wol) | 4556 | if (bp->flags & NO_WOL_FLAG) |
4557 | reset_code = BNX2_DRV_MSG_CODE_UNLOAD; | ||
4558 | else if (bp->wol) | ||
4471 | reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL; | 4559 | reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL; |
4472 | else | 4560 | else |
4473 | reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; | 4561 | reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; |
@@ -4501,7 +4589,7 @@ bnx2_close(struct net_device *dev) | |||
4501 | static struct net_device_stats * | 4589 | static struct net_device_stats * |
4502 | bnx2_get_stats(struct net_device *dev) | 4590 | bnx2_get_stats(struct net_device *dev) |
4503 | { | 4591 | { |
4504 | struct bnx2 *bp = dev->priv; | 4592 | struct bnx2 *bp = netdev_priv(dev); |
4505 | struct statistics_block *stats_blk = bp->stats_blk; | 4593 | struct statistics_block *stats_blk = bp->stats_blk; |
4506 | struct net_device_stats *net_stats = &bp->net_stats; | 4594 | struct net_device_stats *net_stats = &bp->net_stats; |
4507 | 4595 | ||
@@ -4575,7 +4663,7 @@ bnx2_get_stats(struct net_device *dev) | |||
4575 | static int | 4663 | static int |
4576 | bnx2_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 4664 | bnx2_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
4577 | { | 4665 | { |
4578 | struct bnx2 *bp = dev->priv; | 4666 | struct bnx2 *bp = netdev_priv(dev); |
4579 | 4667 | ||
4580 | cmd->supported = SUPPORTED_Autoneg; | 4668 | cmd->supported = SUPPORTED_Autoneg; |
4581 | if (bp->phy_flags & PHY_SERDES_FLAG) { | 4669 | if (bp->phy_flags & PHY_SERDES_FLAG) { |
@@ -4622,7 +4710,7 @@ bnx2_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
4622 | static int | 4710 | static int |
4623 | bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 4711 | bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
4624 | { | 4712 | { |
4625 | struct bnx2 *bp = dev->priv; | 4713 | struct bnx2 *bp = netdev_priv(dev); |
4626 | u8 autoneg = bp->autoneg; | 4714 | u8 autoneg = bp->autoneg; |
4627 | u8 req_duplex = bp->req_duplex; | 4715 | u8 req_duplex = bp->req_duplex; |
4628 | u16 req_line_speed = bp->req_line_speed; | 4716 | u16 req_line_speed = bp->req_line_speed; |
@@ -4694,7 +4782,7 @@ bnx2_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
4694 | static void | 4782 | static void |
4695 | bnx2_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 4783 | bnx2_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) |
4696 | { | 4784 | { |
4697 | struct bnx2 *bp = dev->priv; | 4785 | struct bnx2 *bp = netdev_priv(dev); |
4698 | 4786 | ||
4699 | strcpy(info->driver, DRV_MODULE_NAME); | 4787 | strcpy(info->driver, DRV_MODULE_NAME); |
4700 | strcpy(info->version, DRV_MODULE_VERSION); | 4788 | strcpy(info->version, DRV_MODULE_VERSION); |
@@ -4702,15 +4790,14 @@ bnx2_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | |||
4702 | info->fw_version[0] = ((bp->fw_ver & 0xff000000) >> 24) + '0'; | 4790 | info->fw_version[0] = ((bp->fw_ver & 0xff000000) >> 24) + '0'; |
4703 | info->fw_version[2] = ((bp->fw_ver & 0xff0000) >> 16) + '0'; | 4791 | info->fw_version[2] = ((bp->fw_ver & 0xff0000) >> 16) + '0'; |
4704 | info->fw_version[4] = ((bp->fw_ver & 0xff00) >> 8) + '0'; | 4792 | info->fw_version[4] = ((bp->fw_ver & 0xff00) >> 8) + '0'; |
4705 | info->fw_version[6] = (bp->fw_ver & 0xff) + '0'; | 4793 | info->fw_version[1] = info->fw_version[3] = '.'; |
4706 | info->fw_version[1] = info->fw_version[3] = info->fw_version[5] = '.'; | 4794 | info->fw_version[5] = 0; |
4707 | info->fw_version[7] = 0; | ||
4708 | } | 4795 | } |
4709 | 4796 | ||
4710 | static void | 4797 | static void |
4711 | bnx2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | 4798 | bnx2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
4712 | { | 4799 | { |
4713 | struct bnx2 *bp = dev->priv; | 4800 | struct bnx2 *bp = netdev_priv(dev); |
4714 | 4801 | ||
4715 | if (bp->flags & NO_WOL_FLAG) { | 4802 | if (bp->flags & NO_WOL_FLAG) { |
4716 | wol->supported = 0; | 4803 | wol->supported = 0; |
@@ -4729,7 +4816,7 @@ bnx2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
4729 | static int | 4816 | static int |
4730 | bnx2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | 4817 | bnx2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
4731 | { | 4818 | { |
4732 | struct bnx2 *bp = dev->priv; | 4819 | struct bnx2 *bp = netdev_priv(dev); |
4733 | 4820 | ||
4734 | if (wol->wolopts & ~WAKE_MAGIC) | 4821 | if (wol->wolopts & ~WAKE_MAGIC) |
4735 | return -EINVAL; | 4822 | return -EINVAL; |
@@ -4749,7 +4836,7 @@ bnx2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
4749 | static int | 4836 | static int |
4750 | bnx2_nway_reset(struct net_device *dev) | 4837 | bnx2_nway_reset(struct net_device *dev) |
4751 | { | 4838 | { |
4752 | struct bnx2 *bp = dev->priv; | 4839 | struct bnx2 *bp = netdev_priv(dev); |
4753 | u32 bmcr; | 4840 | u32 bmcr; |
4754 | 4841 | ||
4755 | if (!(bp->autoneg & AUTONEG_SPEED)) { | 4842 | if (!(bp->autoneg & AUTONEG_SPEED)) { |
@@ -4785,19 +4872,19 @@ bnx2_nway_reset(struct net_device *dev) | |||
4785 | static int | 4872 | static int |
4786 | bnx2_get_eeprom_len(struct net_device *dev) | 4873 | bnx2_get_eeprom_len(struct net_device *dev) |
4787 | { | 4874 | { |
4788 | struct bnx2 *bp = dev->priv; | 4875 | struct bnx2 *bp = netdev_priv(dev); |
4789 | 4876 | ||
4790 | if (bp->flash_info == 0) | 4877 | if (bp->flash_info == NULL) |
4791 | return 0; | 4878 | return 0; |
4792 | 4879 | ||
4793 | return (int) bp->flash_info->total_size; | 4880 | return (int) bp->flash_size; |
4794 | } | 4881 | } |
4795 | 4882 | ||
4796 | static int | 4883 | static int |
4797 | bnx2_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | 4884 | bnx2_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, |
4798 | u8 *eebuf) | 4885 | u8 *eebuf) |
4799 | { | 4886 | { |
4800 | struct bnx2 *bp = dev->priv; | 4887 | struct bnx2 *bp = netdev_priv(dev); |
4801 | int rc; | 4888 | int rc; |
4802 | 4889 | ||
4803 | /* parameters already validated in ethtool_get_eeprom */ | 4890 | /* parameters already validated in ethtool_get_eeprom */ |
@@ -4811,7 +4898,7 @@ static int | |||
4811 | bnx2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | 4898 | bnx2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, |
4812 | u8 *eebuf) | 4899 | u8 *eebuf) |
4813 | { | 4900 | { |
4814 | struct bnx2 *bp = dev->priv; | 4901 | struct bnx2 *bp = netdev_priv(dev); |
4815 | int rc; | 4902 | int rc; |
4816 | 4903 | ||
4817 | /* parameters already validated in ethtool_set_eeprom */ | 4904 | /* parameters already validated in ethtool_set_eeprom */ |
@@ -4824,7 +4911,7 @@ bnx2_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | |||
4824 | static int | 4911 | static int |
4825 | bnx2_get_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) | 4912 | bnx2_get_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) |
4826 | { | 4913 | { |
4827 | struct bnx2 *bp = dev->priv; | 4914 | struct bnx2 *bp = netdev_priv(dev); |
4828 | 4915 | ||
4829 | memset(coal, 0, sizeof(struct ethtool_coalesce)); | 4916 | memset(coal, 0, sizeof(struct ethtool_coalesce)); |
4830 | 4917 | ||
@@ -4846,7 +4933,7 @@ bnx2_get_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) | |||
4846 | static int | 4933 | static int |
4847 | bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) | 4934 | bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) |
4848 | { | 4935 | { |
4849 | struct bnx2 *bp = dev->priv; | 4936 | struct bnx2 *bp = netdev_priv(dev); |
4850 | 4937 | ||
4851 | bp->rx_ticks = (u16) coal->rx_coalesce_usecs; | 4938 | bp->rx_ticks = (u16) coal->rx_coalesce_usecs; |
4852 | if (bp->rx_ticks > 0x3ff) bp->rx_ticks = 0x3ff; | 4939 | if (bp->rx_ticks > 0x3ff) bp->rx_ticks = 0x3ff; |
@@ -4890,7 +4977,7 @@ bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal) | |||
4890 | static void | 4977 | static void |
4891 | bnx2_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) | 4978 | bnx2_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) |
4892 | { | 4979 | { |
4893 | struct bnx2 *bp = dev->priv; | 4980 | struct bnx2 *bp = netdev_priv(dev); |
4894 | 4981 | ||
4895 | ering->rx_max_pending = MAX_RX_DESC_CNT; | 4982 | ering->rx_max_pending = MAX_RX_DESC_CNT; |
4896 | ering->rx_mini_max_pending = 0; | 4983 | ering->rx_mini_max_pending = 0; |
@@ -4907,7 +4994,7 @@ bnx2_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) | |||
4907 | static int | 4994 | static int |
4908 | bnx2_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) | 4995 | bnx2_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) |
4909 | { | 4996 | { |
4910 | struct bnx2 *bp = dev->priv; | 4997 | struct bnx2 *bp = netdev_priv(dev); |
4911 | 4998 | ||
4912 | if ((ering->rx_pending > MAX_RX_DESC_CNT) || | 4999 | if ((ering->rx_pending > MAX_RX_DESC_CNT) || |
4913 | (ering->tx_pending > MAX_TX_DESC_CNT) || | 5000 | (ering->tx_pending > MAX_TX_DESC_CNT) || |
@@ -4930,7 +5017,7 @@ bnx2_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ering) | |||
4930 | static void | 5017 | static void |
4931 | bnx2_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) | 5018 | bnx2_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) |
4932 | { | 5019 | { |
4933 | struct bnx2 *bp = dev->priv; | 5020 | struct bnx2 *bp = netdev_priv(dev); |
4934 | 5021 | ||
4935 | epause->autoneg = ((bp->autoneg & AUTONEG_FLOW_CTRL) != 0); | 5022 | epause->autoneg = ((bp->autoneg & AUTONEG_FLOW_CTRL) != 0); |
4936 | epause->rx_pause = ((bp->flow_ctrl & FLOW_CTRL_RX) != 0); | 5023 | epause->rx_pause = ((bp->flow_ctrl & FLOW_CTRL_RX) != 0); |
@@ -4940,7 +5027,7 @@ bnx2_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) | |||
4940 | static int | 5027 | static int |
4941 | bnx2_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) | 5028 | bnx2_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) |
4942 | { | 5029 | { |
4943 | struct bnx2 *bp = dev->priv; | 5030 | struct bnx2 *bp = netdev_priv(dev); |
4944 | 5031 | ||
4945 | bp->req_flow_ctrl = 0; | 5032 | bp->req_flow_ctrl = 0; |
4946 | if (epause->rx_pause) | 5033 | if (epause->rx_pause) |
@@ -4967,7 +5054,7 @@ bnx2_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *epause) | |||
4967 | static u32 | 5054 | static u32 |
4968 | bnx2_get_rx_csum(struct net_device *dev) | 5055 | bnx2_get_rx_csum(struct net_device *dev) |
4969 | { | 5056 | { |
4970 | struct bnx2 *bp = dev->priv; | 5057 | struct bnx2 *bp = netdev_priv(dev); |
4971 | 5058 | ||
4972 | return bp->rx_csum; | 5059 | return bp->rx_csum; |
4973 | } | 5060 | } |
@@ -4975,7 +5062,7 @@ bnx2_get_rx_csum(struct net_device *dev) | |||
4975 | static int | 5062 | static int |
4976 | bnx2_set_rx_csum(struct net_device *dev, u32 data) | 5063 | bnx2_set_rx_csum(struct net_device *dev, u32 data) |
4977 | { | 5064 | { |
4978 | struct bnx2 *bp = dev->priv; | 5065 | struct bnx2 *bp = netdev_priv(dev); |
4979 | 5066 | ||
4980 | bp->rx_csum = data; | 5067 | bp->rx_csum = data; |
4981 | return 0; | 5068 | return 0; |
@@ -5124,7 +5211,7 @@ bnx2_self_test_count(struct net_device *dev) | |||
5124 | static void | 5211 | static void |
5125 | bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf) | 5212 | bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf) |
5126 | { | 5213 | { |
5127 | struct bnx2 *bp = dev->priv; | 5214 | struct bnx2 *bp = netdev_priv(dev); |
5128 | 5215 | ||
5129 | memset(buf, 0, sizeof(u64) * BNX2_NUM_TESTS); | 5216 | memset(buf, 0, sizeof(u64) * BNX2_NUM_TESTS); |
5130 | if (etest->flags & ETH_TEST_FL_OFFLINE) { | 5217 | if (etest->flags & ETH_TEST_FL_OFFLINE) { |
@@ -5140,10 +5227,8 @@ bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf) | |||
5140 | buf[1] = 1; | 5227 | buf[1] = 1; |
5141 | etest->flags |= ETH_TEST_FL_FAILED; | 5228 | etest->flags |= ETH_TEST_FL_FAILED; |
5142 | } | 5229 | } |
5143 | if (bnx2_test_loopback(bp) != 0) { | 5230 | if ((buf[2] = bnx2_test_loopback(bp)) != 0) |
5144 | buf[2] = 1; | ||
5145 | etest->flags |= ETH_TEST_FL_FAILED; | 5231 | etest->flags |= ETH_TEST_FL_FAILED; |
5146 | } | ||
5147 | 5232 | ||
5148 | if (!netif_running(bp->dev)) { | 5233 | if (!netif_running(bp->dev)) { |
5149 | bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET); | 5234 | bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET); |
@@ -5200,7 +5285,7 @@ static void | |||
5200 | bnx2_get_ethtool_stats(struct net_device *dev, | 5285 | bnx2_get_ethtool_stats(struct net_device *dev, |
5201 | struct ethtool_stats *stats, u64 *buf) | 5286 | struct ethtool_stats *stats, u64 *buf) |
5202 | { | 5287 | { |
5203 | struct bnx2 *bp = dev->priv; | 5288 | struct bnx2 *bp = netdev_priv(dev); |
5204 | int i; | 5289 | int i; |
5205 | u32 *hw_stats = (u32 *) bp->stats_blk; | 5290 | u32 *hw_stats = (u32 *) bp->stats_blk; |
5206 | u8 *stats_len_arr = NULL; | 5291 | u8 *stats_len_arr = NULL; |
@@ -5240,7 +5325,7 @@ bnx2_get_ethtool_stats(struct net_device *dev, | |||
5240 | static int | 5325 | static int |
5241 | bnx2_phys_id(struct net_device *dev, u32 data) | 5326 | bnx2_phys_id(struct net_device *dev, u32 data) |
5242 | { | 5327 | { |
5243 | struct bnx2 *bp = dev->priv; | 5328 | struct bnx2 *bp = netdev_priv(dev); |
5244 | int i; | 5329 | int i; |
5245 | u32 save; | 5330 | u32 save; |
5246 | 5331 | ||
@@ -5312,7 +5397,7 @@ static int | |||
5312 | bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 5397 | bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
5313 | { | 5398 | { |
5314 | struct mii_ioctl_data *data = if_mii(ifr); | 5399 | struct mii_ioctl_data *data = if_mii(ifr); |
5315 | struct bnx2 *bp = dev->priv; | 5400 | struct bnx2 *bp = netdev_priv(dev); |
5316 | int err; | 5401 | int err; |
5317 | 5402 | ||
5318 | switch(cmd) { | 5403 | switch(cmd) { |
@@ -5354,7 +5439,7 @@ static int | |||
5354 | bnx2_change_mac_addr(struct net_device *dev, void *p) | 5439 | bnx2_change_mac_addr(struct net_device *dev, void *p) |
5355 | { | 5440 | { |
5356 | struct sockaddr *addr = p; | 5441 | struct sockaddr *addr = p; |
5357 | struct bnx2 *bp = dev->priv; | 5442 | struct bnx2 *bp = netdev_priv(dev); |
5358 | 5443 | ||
5359 | if (!is_valid_ether_addr(addr->sa_data)) | 5444 | if (!is_valid_ether_addr(addr->sa_data)) |
5360 | return -EINVAL; | 5445 | return -EINVAL; |
@@ -5370,7 +5455,7 @@ bnx2_change_mac_addr(struct net_device *dev, void *p) | |||
5370 | static int | 5455 | static int |
5371 | bnx2_change_mtu(struct net_device *dev, int new_mtu) | 5456 | bnx2_change_mtu(struct net_device *dev, int new_mtu) |
5372 | { | 5457 | { |
5373 | struct bnx2 *bp = dev->priv; | 5458 | struct bnx2 *bp = netdev_priv(dev); |
5374 | 5459 | ||
5375 | if (((new_mtu + ETH_HLEN) > MAX_ETHERNET_JUMBO_PACKET_SIZE) || | 5460 | if (((new_mtu + ETH_HLEN) > MAX_ETHERNET_JUMBO_PACKET_SIZE) || |
5376 | ((new_mtu + ETH_HLEN) < MIN_ETHERNET_PACKET_SIZE)) | 5461 | ((new_mtu + ETH_HLEN) < MIN_ETHERNET_PACKET_SIZE)) |
@@ -5391,7 +5476,7 @@ bnx2_change_mtu(struct net_device *dev, int new_mtu) | |||
5391 | static void | 5476 | static void |
5392 | poll_bnx2(struct net_device *dev) | 5477 | poll_bnx2(struct net_device *dev) |
5393 | { | 5478 | { |
5394 | struct bnx2 *bp = dev->priv; | 5479 | struct bnx2 *bp = netdev_priv(dev); |
5395 | 5480 | ||
5396 | disable_irq(bp->pdev->irq); | 5481 | disable_irq(bp->pdev->irq); |
5397 | bnx2_interrupt(bp->pdev->irq, dev, NULL); | 5482 | bnx2_interrupt(bp->pdev->irq, dev, NULL); |
@@ -5409,7 +5494,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
5409 | 5494 | ||
5410 | SET_MODULE_OWNER(dev); | 5495 | SET_MODULE_OWNER(dev); |
5411 | SET_NETDEV_DEV(dev, &pdev->dev); | 5496 | SET_NETDEV_DEV(dev, &pdev->dev); |
5412 | bp = dev->priv; | 5497 | bp = netdev_priv(dev); |
5413 | 5498 | ||
5414 | bp->flags = 0; | 5499 | bp->flags = 0; |
5415 | bp->phy_flags = 0; | 5500 | bp->phy_flags = 0; |
@@ -5629,6 +5714,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) | |||
5629 | } | 5714 | } |
5630 | } | 5715 | } |
5631 | 5716 | ||
5717 | if (CHIP_NUM(bp) == CHIP_NUM_5708) | ||
5718 | bp->flags |= NO_WOL_FLAG; | ||
5719 | |||
5632 | if (CHIP_ID(bp) == CHIP_ID_5706_A0) { | 5720 | if (CHIP_ID(bp) == CHIP_ID_5706_A0) { |
5633 | bp->tx_quick_cons_trip_int = | 5721 | bp->tx_quick_cons_trip_int = |
5634 | bp->tx_quick_cons_trip; | 5722 | bp->tx_quick_cons_trip; |
@@ -5725,7 +5813,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
5725 | dev->ethtool_ops = &bnx2_ethtool_ops; | 5813 | dev->ethtool_ops = &bnx2_ethtool_ops; |
5726 | dev->weight = 64; | 5814 | dev->weight = 64; |
5727 | 5815 | ||
5728 | bp = dev->priv; | 5816 | bp = netdev_priv(dev); |
5729 | 5817 | ||
5730 | #if defined(HAVE_POLL_CONTROLLER) || defined(CONFIG_NET_POLL_CONTROLLER) | 5818 | #if defined(HAVE_POLL_CONTROLLER) || defined(CONFIG_NET_POLL_CONTROLLER) |
5731 | dev->poll_controller = poll_bnx2; | 5819 | dev->poll_controller = poll_bnx2; |
@@ -5784,7 +5872,7 @@ static void __devexit | |||
5784 | bnx2_remove_one(struct pci_dev *pdev) | 5872 | bnx2_remove_one(struct pci_dev *pdev) |
5785 | { | 5873 | { |
5786 | struct net_device *dev = pci_get_drvdata(pdev); | 5874 | struct net_device *dev = pci_get_drvdata(pdev); |
5787 | struct bnx2 *bp = dev->priv; | 5875 | struct bnx2 *bp = netdev_priv(dev); |
5788 | 5876 | ||
5789 | flush_scheduled_work(); | 5877 | flush_scheduled_work(); |
5790 | 5878 | ||
@@ -5803,7 +5891,7 @@ static int | |||
5803 | bnx2_suspend(struct pci_dev *pdev, pm_message_t state) | 5891 | bnx2_suspend(struct pci_dev *pdev, pm_message_t state) |
5804 | { | 5892 | { |
5805 | struct net_device *dev = pci_get_drvdata(pdev); | 5893 | struct net_device *dev = pci_get_drvdata(pdev); |
5806 | struct bnx2 *bp = dev->priv; | 5894 | struct bnx2 *bp = netdev_priv(dev); |
5807 | u32 reset_code; | 5895 | u32 reset_code; |
5808 | 5896 | ||
5809 | if (!netif_running(dev)) | 5897 | if (!netif_running(dev)) |
@@ -5812,7 +5900,9 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state) | |||
5812 | bnx2_netif_stop(bp); | 5900 | bnx2_netif_stop(bp); |
5813 | netif_device_detach(dev); | 5901 | netif_device_detach(dev); |
5814 | del_timer_sync(&bp->timer); | 5902 | del_timer_sync(&bp->timer); |
5815 | if (bp->wol) | 5903 | if (bp->flags & NO_WOL_FLAG) |
5904 | reset_code = BNX2_DRV_MSG_CODE_UNLOAD; | ||
5905 | else if (bp->wol) | ||
5816 | reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL; | 5906 | reset_code = BNX2_DRV_MSG_CODE_SUSPEND_WOL; |
5817 | else | 5907 | else |
5818 | reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; | 5908 | reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL; |
@@ -5826,7 +5916,7 @@ static int | |||
5826 | bnx2_resume(struct pci_dev *pdev) | 5916 | bnx2_resume(struct pci_dev *pdev) |
5827 | { | 5917 | { |
5828 | struct net_device *dev = pci_get_drvdata(pdev); | 5918 | struct net_device *dev = pci_get_drvdata(pdev); |
5829 | struct bnx2 *bp = dev->priv; | 5919 | struct bnx2 *bp = netdev_priv(dev); |
5830 | 5920 | ||
5831 | if (!netif_running(dev)) | 5921 | if (!netif_running(dev)) |
5832 | return 0; | 5922 | return 0; |
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index 76bb5f1a250b..9f691cbd666b 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* bnx2.h: Broadcom NX2 network driver. | 1 | /* bnx2.h: Broadcom NX2 network driver. |
2 | * | 2 | * |
3 | * Copyright (c) 2004, 2005 Broadcom Corporation | 3 | * Copyright (c) 2004, 2005, 2006 Broadcom Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -277,19 +277,7 @@ struct statistics_block { | |||
277 | * l2_fhdr definition | 277 | * l2_fhdr definition |
278 | */ | 278 | */ |
279 | struct l2_fhdr { | 279 | struct l2_fhdr { |
280 | #if defined(__BIG_ENDIAN) | 280 | u32 l2_fhdr_status; |
281 | u16 l2_fhdr_errors; | ||
282 | u16 l2_fhdr_status; | ||
283 | #elif defined(__LITTLE_ENDIAN) | ||
284 | u16 l2_fhdr_status; | ||
285 | u16 l2_fhdr_errors; | ||
286 | #endif | ||
287 | #define L2_FHDR_ERRORS_BAD_CRC (1<<1) | ||
288 | #define L2_FHDR_ERRORS_PHY_DECODE (1<<2) | ||
289 | #define L2_FHDR_ERRORS_ALIGNMENT (1<<3) | ||
290 | #define L2_FHDR_ERRORS_TOO_SHORT (1<<4) | ||
291 | #define L2_FHDR_ERRORS_GIANT_FRAME (1<<5) | ||
292 | |||
293 | #define L2_FHDR_STATUS_RULE_CLASS (0x7<<0) | 281 | #define L2_FHDR_STATUS_RULE_CLASS (0x7<<0) |
294 | #define L2_FHDR_STATUS_RULE_P2 (1<<3) | 282 | #define L2_FHDR_STATUS_RULE_P2 (1<<3) |
295 | #define L2_FHDR_STATUS_RULE_P3 (1<<4) | 283 | #define L2_FHDR_STATUS_RULE_P3 (1<<4) |
@@ -301,6 +289,14 @@ struct l2_fhdr { | |||
301 | #define L2_FHDR_STATUS_TCP_SEGMENT (1<<14) | 289 | #define L2_FHDR_STATUS_TCP_SEGMENT (1<<14) |
302 | #define L2_FHDR_STATUS_UDP_DATAGRAM (1<<15) | 290 | #define L2_FHDR_STATUS_UDP_DATAGRAM (1<<15) |
303 | 291 | ||
292 | #define L2_FHDR_ERRORS_BAD_CRC (1<<17) | ||
293 | #define L2_FHDR_ERRORS_PHY_DECODE (1<<18) | ||
294 | #define L2_FHDR_ERRORS_ALIGNMENT (1<<19) | ||
295 | #define L2_FHDR_ERRORS_TOO_SHORT (1<<20) | ||
296 | #define L2_FHDR_ERRORS_GIANT_FRAME (1<<21) | ||
297 | #define L2_FHDR_ERRORS_TCP_XSUM (1<<28) | ||
298 | #define L2_FHDR_ERRORS_UDP_XSUM (1<<31) | ||
299 | |||
304 | u32 l2_fhdr_hash; | 300 | u32 l2_fhdr_hash; |
305 | #if defined(__BIG_ENDIAN) | 301 | #if defined(__BIG_ENDIAN) |
306 | u16 l2_fhdr_pkt_len; | 302 | u16 l2_fhdr_pkt_len; |
@@ -3956,6 +3952,7 @@ struct bnx2 { | |||
3956 | #define NO_WOL_FLAG 8 | 3952 | #define NO_WOL_FLAG 8 |
3957 | #define USING_DAC_FLAG 0x10 | 3953 | #define USING_DAC_FLAG 0x10 |
3958 | #define USING_MSI_FLAG 0x20 | 3954 | #define USING_MSI_FLAG 0x20 |
3955 | #define ASF_ENABLE_FLAG 0x40 | ||
3959 | 3956 | ||
3960 | u32 phy_flags; | 3957 | u32 phy_flags; |
3961 | #define PHY_SERDES_FLAG 1 | 3958 | #define PHY_SERDES_FLAG 1 |
@@ -3986,6 +3983,7 @@ struct bnx2 { | |||
3986 | #define CHIP_ID_5706_A2 0x57060020 | 3983 | #define CHIP_ID_5706_A2 0x57060020 |
3987 | #define CHIP_ID_5708_A0 0x57080000 | 3984 | #define CHIP_ID_5708_A0 0x57080000 |
3988 | #define CHIP_ID_5708_B0 0x57081000 | 3985 | #define CHIP_ID_5708_B0 0x57081000 |
3986 | #define CHIP_ID_5708_B1 0x57081010 | ||
3989 | 3987 | ||
3990 | #define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf) | 3988 | #define CHIP_BOND_ID(bp) (((bp)->chip_id) & 0xf) |
3991 | 3989 | ||
@@ -3998,7 +3996,7 @@ struct bnx2 { | |||
3998 | u16 bus_speed_mhz; | 3996 | u16 bus_speed_mhz; |
3999 | u8 wol; | 3997 | u8 wol; |
4000 | 3998 | ||
4001 | u8 fw_timed_out; | 3999 | u8 pad; |
4002 | 4000 | ||
4003 | u16 fw_wr_seq; | 4001 | u16 fw_wr_seq; |
4004 | u16 fw_drv_pulse_wr_seq; | 4002 | u16 fw_drv_pulse_wr_seq; |
@@ -4074,6 +4072,7 @@ struct bnx2 { | |||
4074 | struct net_device_stats net_stats; | 4072 | struct net_device_stats net_stats; |
4075 | 4073 | ||
4076 | struct flash_spec *flash_info; | 4074 | struct flash_spec *flash_info; |
4075 | u32 flash_size; | ||
4077 | }; | 4076 | }; |
4078 | 4077 | ||
4079 | static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset); | 4078 | static u32 bnx2_reg_rd_ind(struct bnx2 *bp, u32 offset); |
@@ -4172,7 +4171,7 @@ struct fw_info { | |||
4172 | * the firmware has timed out, the driver will assume there is no firmware | 4171 | * the firmware has timed out, the driver will assume there is no firmware |
4173 | * running and there won't be any firmware-driver synchronization during a | 4172 | * running and there won't be any firmware-driver synchronization during a |
4174 | * driver reset. */ | 4173 | * driver reset. */ |
4175 | #define FW_ACK_TIME_OUT_MS 50 | 4174 | #define FW_ACK_TIME_OUT_MS 100 |
4176 | 4175 | ||
4177 | 4176 | ||
4178 | #define BNX2_DRV_RESET_SIGNATURE 0x00000000 | 4177 | #define BNX2_DRV_RESET_SIGNATURE 0x00000000 |
@@ -4275,6 +4274,9 @@ struct fw_info { | |||
4275 | #define BNX2_SHARED_HW_CFG_LED_MODE_GPHY1 0x100 | 4274 | #define BNX2_SHARED_HW_CFG_LED_MODE_GPHY1 0x100 |
4276 | #define BNX2_SHARED_HW_CFG_LED_MODE_GPHY2 0x200 | 4275 | #define BNX2_SHARED_HW_CFG_LED_MODE_GPHY2 0x200 |
4277 | 4276 | ||
4277 | #define BNX2_SHARED_HW_CFG_CONFIG2 0x00000040 | ||
4278 | #define BNX2_SHARED_HW_CFG2_NVM_SIZE_MASK 0x00fff000 | ||
4279 | |||
4278 | #define BNX2_DEV_INFO_BC_REV 0x0000004c | 4280 | #define BNX2_DEV_INFO_BC_REV 0x0000004c |
4279 | 4281 | ||
4280 | #define BNX2_PORT_HW_CFG_MAC_UPPER 0x00000050 | 4282 | #define BNX2_PORT_HW_CFG_MAC_UPPER 0x00000050 |
diff --git a/drivers/net/bnx2_fw.h b/drivers/net/bnx2_fw.h index ab07a4900e9a..0c21bd849814 100644 --- a/drivers/net/bnx2_fw.h +++ b/drivers/net/bnx2_fw.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* bnx2_fw.h: Broadcom NX2 network driver. | 1 | /* bnx2_fw.h: Broadcom NX2 network driver. |
2 | * | 2 | * |
3 | * Copyright (c) 2004, 2005 Broadcom Corporation | 3 | * Copyright (c) 2004, 2005, 2006 Broadcom Corporation |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -978,20 +978,20 @@ static u32 bnx2_COM_b06FwSbss[(0x1c/4) + 1] = { 0x0 }; | |||
978 | static int bnx2_RXP_b06FwReleaseMajor = 0x1; | 978 | static int bnx2_RXP_b06FwReleaseMajor = 0x1; |
979 | static int bnx2_RXP_b06FwReleaseMinor = 0x0; | 979 | static int bnx2_RXP_b06FwReleaseMinor = 0x0; |
980 | static int bnx2_RXP_b06FwReleaseFix = 0x0; | 980 | static int bnx2_RXP_b06FwReleaseFix = 0x0; |
981 | static u32 bnx2_RXP_b06FwStartAddr = 0x08003104; | 981 | static u32 bnx2_RXP_b06FwStartAddr = 0x08003184; |
982 | static u32 bnx2_RXP_b06FwTextAddr = 0x08000000; | 982 | static u32 bnx2_RXP_b06FwTextAddr = 0x08000000; |
983 | static int bnx2_RXP_b06FwTextLen = 0x562c; | 983 | static int bnx2_RXP_b06FwTextLen = 0x588c; |
984 | static u32 bnx2_RXP_b06FwDataAddr = 0x08005660; | 984 | static u32 bnx2_RXP_b06FwDataAddr = 0x080058e0; |
985 | static int bnx2_RXP_b06FwDataLen = 0x0; | 985 | static int bnx2_RXP_b06FwDataLen = 0x0; |
986 | static u32 bnx2_RXP_b06FwRodataAddr = 0x00000000; | 986 | static u32 bnx2_RXP_b06FwRodataAddr = 0x08005890; |
987 | static int bnx2_RXP_b06FwRodataLen = 0x0; | 987 | static int bnx2_RXP_b06FwRodataLen = 0x28; |
988 | static u32 bnx2_RXP_b06FwBssAddr = 0x08005680; | 988 | static u32 bnx2_RXP_b06FwBssAddr = 0x08005900; |
989 | static int bnx2_RXP_b06FwBssLen = 0x1394; | 989 | static int bnx2_RXP_b06FwBssLen = 0x13a4; |
990 | static u32 bnx2_RXP_b06FwSbssAddr = 0x08005660; | 990 | static u32 bnx2_RXP_b06FwSbssAddr = 0x080058e0; |
991 | static int bnx2_RXP_b06FwSbssLen = 0x18; | 991 | static int bnx2_RXP_b06FwSbssLen = 0x1c; |
992 | static u32 bnx2_RXP_b06FwText[(0x562c/4) + 1] = { | 992 | static u32 bnx2_RXP_b06FwText[(0x588c/4) + 1] = { |
993 | 0x0a000c41, 0x00000000, 0x00000000, 0x0000000d, 0x72787020, 0x322e352e, | 993 | 0x0a000c61, 0x00000000, 0x00000000, 0x0000000d, 0x72787020, 0x322e362e, |
994 | 0x38000000, 0x02050803, 0x00000000, 0x0000000d, 0x00000000, 0x00000000, | 994 | 0x31000000, 0x02060103, 0x00000000, 0x0000000d, 0x00000000, 0x00000000, |
995 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, | 995 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
996 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, | 996 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
997 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, | 997 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
@@ -1513,408 +1513,435 @@ static u32 bnx2_RXP_b06FwText[(0x562c/4) + 1] = { | |||
1513 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, | 1513 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1514 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, | 1514 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1515 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, | 1515 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1516 | 0x10000003, 0x00000000, 0x0000000d, 0x0000000d, 0x3c020800, 0x24425660, | 1516 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1517 | 0x3c030800, 0x24636a14, 0xac400000, 0x0043202b, 0x1480fffd, 0x24420004, | 1517 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1518 | 0x3c1d0800, 0x37bd7ffc, 0x03a0f021, 0x3c100800, 0x26103104, 0x3c1c0800, | 1518 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1519 | 0x279c5660, 0x0e001035, 0x00000000, 0x0000000d, 0x3c080800, 0x8d023100, | 1519 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1520 | 0x2c420080, 0x50400001, 0xad003100, 0x8d073100, 0x3c040800, 0x24840100, | 1520 | 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, |
1521 | 0x8f460100, 0x00071840, 0x00671821, 0x00031940, 0x00641021, 0xac460000, | 1521 | 0x00000000, 0x00000000, 0x10000003, 0x00000000, 0x0000000d, 0x0000000d, |
1522 | 0x8f450104, 0x00831021, 0xac450004, 0x8f460108, 0xac460008, 0x8f45010c, | 1522 | 0x3c020800, 0x244258e0, 0x3c030800, 0x24636ca4, 0xac400000, 0x0043202b, |
1523 | 0xac45000c, 0x8f460114, 0xac460010, 0x8f450118, 0xac450014, 0x8f460124, | 1523 | 0x1480fffd, 0x24420004, 0x3c1d0800, 0x37bd7ffc, 0x03a0f021, 0x3c100800, |
1524 | 0xac460018, 0x8f450128, 0xac45001c, 0x8f464010, 0xac460020, 0x8f454014, | 1524 | 0x26103184, 0x3c1c0800, 0x279c58e0, 0x0e00104a, 0x00000000, 0x0000000d, |
1525 | 0xac450024, 0x8f464018, 0xac460028, 0x8f45401c, 0xac45002c, 0x8f464020, | 1525 | 0x27bdffe8, 0xafb00010, 0xafbf0014, 0x0e000f1d, 0x00808021, 0x1440000d, |
1526 | 0xac460030, 0x8f454024, 0xac450034, 0x8f464028, 0xac460038, 0x8f45402c, | 1526 | 0x00000000, 0x8f820010, 0x10400005, 0x00000000, 0x9743011c, 0x9742011e, |
1527 | 0xac45003c, 0x8f464030, 0xac460040, 0x8f454034, 0xac450044, 0x8f464038, | 1527 | 0x0a000c89, 0x00021400, 0x9743011e, 0x9742011c, 0x00021400, 0x00621825, |
1528 | 0xac460048, 0x8f45403c, 0xac45004c, 0x8f464040, 0xac460050, 0x8f454044, | 1528 | 0xaf830004, 0x8f840008, 0x3c020020, 0x34424000, 0x00821824, 0x54620004, |
1529 | 0xac450054, 0x8f464048, 0xac460058, 0x8f45404c, 0x24e70001, 0x00402021, | 1529 | 0x3c020020, 0x8f820014, 0x0a000c9a, 0x34421000, 0x34428000, 0x00821824, |
1530 | 0xad073100, 0x03e00008, 0xac85005c, 0x8f820004, 0x9743010c, 0x00804821, | 1530 | 0x14620004, 0x00000000, 0x8f820014, 0x34428000, 0xaf820014, 0x8f820008, |
1531 | 0x00403021, 0x30421000, 0x10400010, 0x306affff, 0x30c20020, 0x1440000e, | 1531 | 0x9743010c, 0x00403021, 0x30421000, 0x10400010, 0x3069ffff, 0x30c20020, |
1532 | 0x24070005, 0x3c021000, 0x00c21024, 0x10400009, 0x3c030dff, 0x3463ffff, | 1532 | 0x1440000e, 0x24070005, 0x3c021000, 0x00c21024, 0x10400009, 0x3c030dff, |
1533 | 0x3c020e00, 0x00c21024, 0x0062182b, 0x50600004, 0x24070001, 0x0a000cb1, | 1533 | 0x3463ffff, 0x3c020e00, 0x00c21024, 0x0062182b, 0x50600004, 0x24070001, |
1534 | 0x3c020800, 0x24070001, 0x3c020800, 0x8c430034, 0x1460001d, 0x00405821, | 1534 | 0x0a000cb2, 0x3c020800, 0x24070001, 0x3c020800, 0x8c430034, 0x1460001d, |
1535 | 0x8f820010, 0x30424000, 0x1440001a, 0x3c020001, 0x3c021f01, 0x00c24024, | 1535 | 0x00405821, 0x8f820014, 0x30424000, 0x1440001a, 0x3c020001, 0x3c021f01, |
1536 | 0x3c031000, 0x15030015, 0x3c020001, 0x31420200, 0x54400012, 0x3c020001, | 1536 | 0x00c24024, 0x3c031000, 0x15030015, 0x3c020001, 0x31220200, 0x14400012, |
1537 | 0x9744010e, 0x24020003, 0xa342018b, 0x97850012, 0x24020002, 0x34e30002, | 1537 | 0x3c020001, 0x9744010e, 0x24020003, 0xa342018b, 0x97850016, 0x24020002, |
1538 | 0xaf400180, 0xa742018c, 0xa7430188, 0x24840004, 0x30a5bfff, 0xa744018e, | 1538 | 0x34e30002, 0xaf400180, 0xa742018c, 0xa7430188, 0x24840004, 0x30a5bfff, |
1539 | 0xa74501a6, 0xaf4801b8, 0x03e00008, 0x00001021, 0x3c020001, 0x00c21024, | 1539 | 0xa744018e, 0xa74501a6, 0xaf4801b8, 0x0a000f19, 0x00001021, 0x3c020001, |
1540 | 0x10400039, 0x00000000, 0x9742010e, 0x3c038000, 0x3046ffff, 0x8f4201b8, | 1540 | 0x00c21024, 0x1040002f, 0x00000000, 0x9742010e, 0x3c038000, 0x3046ffff, |
1541 | 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x97840006, 0x8f85000c, | 1541 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x9784000a, |
1542 | 0x24020080, 0x24030002, 0xaf420180, 0xa743018c, 0xa746018e, 0x10a00005, | 1542 | 0x8f850004, 0x8f870014, 0x24020080, 0x24030002, 0xaf420180, 0x24020003, |
1543 | 0xa7440190, 0x9743011c, 0x9742011e, 0x0a000cec, 0x00021400, 0x9743011e, | 1543 | 0xa743018c, 0xa746018e, 0xa7420188, 0x30e28000, 0xa7440190, 0x1040000c, |
1544 | 0x9742011c, 0x00021400, 0x00621825, 0xaf4301a8, 0x8f840010, 0x24020003, | 1544 | 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000, |
1545 | 0x30838000, 0x1060000d, 0xa7420188, 0x93420116, 0x304200fc, 0x005a1021, | 1545 | 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x00e21024, 0xaf820014, |
1546 | 0x24424004, 0x8c430000, 0x3063ffff, 0x14600005, 0x00000000, 0x3c02ffff, | 1546 | 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff, |
1547 | 0x34427fff, 0x00821024, 0xaf820010, 0x97820012, 0x9743010c, 0x8f440104, | 1547 | 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x0a000f19, |
1548 | 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, | 1548 | 0x00001021, 0x8f820014, 0x30434000, 0x10600016, 0x00404021, 0x3c020f00, |
1549 | 0x3c021000, 0xaf4201b8, 0x03e00008, 0x00001021, 0x8f820010, 0x30434000, | 1549 | 0x00c21024, 0x14400012, 0x00000000, 0x93420116, 0x34424000, 0x03421821, |
1550 | 0x10600016, 0x00404021, 0x3c020f00, 0x00c21024, 0x14400012, 0x00000000, | 1550 | 0x94650002, 0x2ca21389, 0x1040000b, 0x3c020800, 0x24425900, 0x00051942, |
1551 | 0x93420116, 0x34424000, 0x03421821, 0x94650002, 0x2ca21389, 0x1040000b, | 1551 | 0x00031880, 0x00621821, 0x30a5001f, 0x8c640000, 0x24020001, 0x00a21004, |
1552 | 0x3c020800, 0x24425680, 0x00051942, 0x00031880, 0x00621821, 0x30a5001f, | 1552 | 0x00822024, 0x02048025, 0x12000030, 0x3c021000, 0x9742010e, 0x34e80002, |
1553 | 0x8c640000, 0x24020001, 0x00a21004, 0x00822024, 0x01244825, 0x11200039, | 1553 | 0x3c038000, 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, |
1554 | 0x3c021000, 0x9742010e, 0x34e70002, 0x3c038000, 0x24420004, 0x3046ffff, | 1554 | 0x24020003, 0xa342018b, 0x9784000a, 0x8f850004, 0x8f870014, 0x24020180, |
1555 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x97840006, | 1555 | 0x24030002, 0xaf420180, 0xa743018c, 0xa746018e, 0xa7480188, 0x30e28000, |
1556 | 0x8f85000c, 0x24020180, 0x24030002, 0xaf420180, 0xa743018c, 0xa746018e, | 1556 | 0xa7440190, 0x1040000c, 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021, |
1557 | 0x10a00005, 0xa7440190, 0x9743011c, 0x9742011e, 0x0a000d41, 0x00021400, | ||
1558 | 0x9743011e, 0x9742011c, 0x00021400, 0x00621825, 0xaf4301a8, 0x8f840010, | ||
1559 | 0x30828000, 0x1040000c, 0xa7470188, 0x93420116, 0x304200fc, 0x005a1021, | ||
1560 | 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, | 1557 | 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, |
1561 | 0x00821024, 0xaf820010, 0x97820012, 0x9743010c, 0x8f440104, 0x3042bfff, | 1558 | 0x00e21024, 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, |
1562 | 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, | 1559 | 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, |
1563 | 0xaf4201b8, 0x03e00008, 0x00001021, 0x00c21024, 0x104000e3, 0x3c020800, | 1560 | 0xaf4201b8, 0x0a000f19, 0x00001021, 0x00c21024, 0x104000c0, 0x3c020800, |
1564 | 0x8c430030, 0x10600040, 0x31024000, 0x1040003e, 0x3c030f00, 0x00c31824, | 1561 | 0x8c430030, 0x10600037, 0x31024000, 0x10400035, 0x3c030f00, 0x00c31824, |
1565 | 0x3c020100, 0x0043102b, 0x1440003a, 0x3c030800, 0x9742010e, 0x34e70002, | 1562 | 0x3c020100, 0x0043102b, 0x14400031, 0x3c030800, 0x9742010e, 0x34e80002, |
1566 | 0x3c038000, 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, | 1563 | 0x3c038000, 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, |
1567 | 0x24020003, 0xa342018b, 0x97840006, 0x8f85000c, 0x24020080, 0x24030002, | 1564 | 0x24020003, 0xa342018b, 0x9784000a, 0x8f850004, 0x8f870014, 0x24020080, |
1568 | 0xaf420180, 0xa743018c, 0xa746018e, 0x10a00005, 0xa7440190, 0x9743011c, | 1565 | 0x24030002, 0xaf420180, 0xa743018c, 0xa746018e, 0xa7480188, 0x30e28000, |
1569 | 0x9742011e, 0x0a000d86, 0x00021400, 0x9743011e, 0x9742011c, 0x00021400, | 1566 | 0xa7440190, 0x1040000c, 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021, |
1570 | 0x00621825, 0xaf4301a8, 0x8f840010, 0x30828000, 0x1040000c, 0xa7470188, | 1567 | 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, |
1568 | 0x00e21024, 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, | ||
1569 | 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, | ||
1570 | 0xaf4201b8, 0x0a000f19, 0x00001021, 0x3c030800, 0x8c620024, 0x30420008, | ||
1571 | 0x10400035, 0x34ea0002, 0x3c020f00, 0x00c21024, 0x14400032, 0x8d620034, | ||
1572 | 0x31220200, 0x1040002f, 0x8d620034, 0x9742010e, 0x30e8fffb, 0x3c038000, | ||
1573 | 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, | ||
1574 | 0xa342018b, 0x9784000a, 0x8f850004, 0x8f870014, 0x24020180, 0x24030002, | ||
1575 | 0xaf420180, 0xa743018c, 0xa746018e, 0xa7480188, 0x30e28000, 0xa7440190, | ||
1576 | 0x1040000c, 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, | ||
1577 | 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x00e21024, | ||
1578 | 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, | ||
1579 | 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, | ||
1580 | 0x8d620034, 0x8f860008, 0x10400012, 0x30c20100, 0x10400010, 0x3c020f00, | ||
1581 | 0x00c21024, 0x3c030200, 0x1043000c, 0x3c020800, 0x8c430038, 0x8f840004, | ||
1582 | 0x3c020800, 0x2442003c, 0x2463ffff, 0x00832024, 0x00822021, 0x90830000, | ||
1583 | 0x24630004, 0x0a000de1, 0x000329c0, 0x00000000, 0x00061602, 0x3042000f, | ||
1584 | 0x000229c0, 0x3c04fc00, 0x00441021, 0x3c030300, 0x0062182b, 0x50600001, | ||
1585 | 0x24050800, 0x9742010e, 0x3148ffff, 0x3c038000, 0x24420004, 0x3046ffff, | ||
1586 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x9783000a, | ||
1587 | 0x8f840004, 0x8f870014, 0x24020002, 0xaf450180, 0xa742018c, 0xa746018e, | ||
1588 | 0xa7480188, 0x30e28000, 0xa7430190, 0x1040000c, 0xaf4401a8, 0x93420116, | ||
1589 | 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, | ||
1590 | 0x3c02ffff, 0x34427fff, 0x00e21024, 0xaf820014, 0x97820016, 0x9743010c, | ||
1591 | 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, | ||
1592 | 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x0a000f19, 0x00001021, 0x8f424000, | ||
1593 | 0x30420100, 0x104000d5, 0x3c020800, 0x8c440024, 0x24030001, 0x1483002f, | ||
1594 | 0x00405021, 0x9742010e, 0x34e70002, 0x3c038000, 0x24420004, 0x3045ffff, | ||
1595 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x9783000a, | ||
1596 | 0x8f840004, 0x8f860014, 0x24020002, 0xaf400180, 0xa742018c, 0xa745018e, | ||
1597 | 0xa7470188, 0x30c28000, 0xa7430190, 0x1040000c, 0xaf4401a8, 0x93420116, | ||
1598 | 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, | ||
1599 | 0x3c02ffff, 0x34427fff, 0x00c21024, 0xaf820014, 0x97820016, 0x9743010c, | ||
1600 | 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, | ||
1601 | 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x0a000f19, 0x00001021, 0x30820001, | ||
1602 | 0x1040002e, 0x30eb0004, 0x9742010e, 0x30e9fffb, 0x3c038000, 0x24420004, | ||
1603 | 0x3045ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, | ||
1604 | 0x9783000a, 0x8f840004, 0x8f860014, 0x24020002, 0xaf400180, 0xa742018c, | ||
1605 | 0xa745018e, 0xa7470188, 0x30c28000, 0xa7430190, 0x1040000c, 0xaf4401a8, | ||
1571 | 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, | 1606 | 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, |
1572 | 0x14600004, 0x3c02ffff, 0x34427fff, 0x00821024, 0xaf820010, 0x97820012, | 1607 | 0x14600004, 0x3c02ffff, 0x34427fff, 0x00c21024, 0xaf820014, 0x97820016, |
1573 | 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, | 1608 | 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, |
1574 | 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x03e00008, 0x00001021, | 1609 | 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x3127ffff, 0x8d420024, |
1575 | 0x3c030800, 0x8c620024, 0x30420008, 0x1040003e, 0x34e80002, 0x3c020f00, | 1610 | 0x30420004, 0x10400030, 0x8d420024, 0x9742010e, 0x30e9fffb, 0x3c038000, |
1576 | 0x00c21024, 0x1440003b, 0x8d620034, 0x31420200, 0x10400038, 0x8d620034, | ||
1577 | 0x9742010e, 0x30e7fffb, 0x3c038000, 0x24420004, 0x3046ffff, 0x8f4201b8, | ||
1578 | 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x97840006, 0x8f85000c, | ||
1579 | 0x24020180, 0x24030002, 0xaf420180, 0xa743018c, 0xa746018e, 0x10a00005, | ||
1580 | 0xa7440190, 0x9743011c, 0x9742011e, 0x0a000dca, 0x00021400, 0x9743011e, | ||
1581 | 0x9742011c, 0x00021400, 0x00621825, 0xaf4301a8, 0x8f840010, 0x30828000, | ||
1582 | 0x1040000c, 0xa7470188, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, | ||
1583 | 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x00821024, | ||
1584 | 0xaf820010, 0x97820012, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, | ||
1585 | 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, | ||
1586 | 0x8d620034, 0x8f860004, 0x1040001a, 0x30c20100, 0x10400018, 0x3c020f00, | ||
1587 | 0x00c21024, 0x3c030200, 0x10430014, 0x00000000, 0x8f82000c, 0x10400004, | ||
1588 | 0x00000000, 0x9742011c, 0x0a000df8, 0x3044ffff, 0x9742011e, 0x3044ffff, | ||
1589 | 0x3c030800, 0x8c620038, 0x3c030800, 0x2463003c, 0x2442ffff, 0x00822024, | ||
1590 | 0x00831821, 0x90620000, 0x24420004, 0x0a000e0d, 0x000229c0, 0x00000000, | ||
1591 | 0x00061602, 0x3042000f, 0x000229c0, 0x3c04fc00, 0x00441021, 0x3c030300, | ||
1592 | 0x0062182b, 0x50600001, 0x24050800, 0x9742010e, 0x3107ffff, 0x3c038000, | ||
1593 | 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, | 1611 | 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, |
1594 | 0xa342018b, 0x97830006, 0x8f84000c, 0x24020002, 0xaf450180, 0xa742018c, | 1612 | 0xa342018b, 0x9784000a, 0x8f850004, 0x8f880014, 0x24020100, 0x24030002, |
1595 | 0xa746018e, 0x10800005, 0xa7430190, 0x9743011c, 0x9742011e, 0x0a000e26, | 1613 | 0xaf420180, 0xa743018c, 0xa746018e, 0xa7470188, 0x31028000, 0xa7440190, |
1596 | 0x00021400, 0x9743011e, 0x9742011c, 0x00021400, 0x00621825, 0xaf4301a8, | 1614 | 0x1040000c, 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, |
1597 | 0x8f840010, 0x30828000, 0x1040000c, 0xa7470188, 0x93420116, 0x304200fc, | 1615 | 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x01021024, |
1598 | 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, | 1616 | 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, |
1599 | 0x34427fff, 0x00821024, 0xaf820010, 0x97820012, 0x9743010c, 0x8f440104, | 1617 | 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, |
1600 | 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, | 1618 | 0x3127ffff, 0x8d420024, 0x30420008, 0x1040002d, 0x00000000, 0x9742010e, |
1601 | 0x3c021000, 0xaf4201b8, 0x03e00008, 0x00001021, 0x8f424000, 0x30420100, | 1619 | 0x3c038000, 0x24420004, 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, |
1602 | 0x104000f9, 0x3c020800, 0x8c440024, 0x24030001, 0x14830038, 0x00404821, | 1620 | 0x24020003, 0xa342018b, 0x9784000a, 0x8f850004, 0x8f880014, 0x24020180, |
1603 | 0x9742010e, 0x34e60002, 0x3c038000, 0x24420004, 0x3045ffff, 0x8f4201b8, | 1621 | 0x24030002, 0xaf420180, 0xa743018c, 0xa746018e, 0xa7470188, 0x31028000, |
1604 | 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x97830006, 0x8f84000c, | 1622 | 0xa7440190, 0x1040000c, 0xaf4501a8, 0x93420116, 0x304200fc, 0x005a1021, |
1605 | 0x24020002, 0xaf400180, 0xa742018c, 0xa745018e, 0x10800005, 0xa7430190, | 1623 | 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, |
1606 | 0x9743011c, 0x9742011e, 0x0a000e65, 0x00021400, 0x9743011e, 0x9742011c, | 1624 | 0x01021024, 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, |
1607 | 0x00021400, 0x00621825, 0xaf4301a8, 0x8f840010, 0x30828000, 0x1040000c, | 1625 | 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, |
1608 | 0xa7460188, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000, | 1626 | 0xaf4201b8, 0x15600041, 0x00001021, 0x27440180, 0x3c038000, 0x8f4201b8, |
1609 | 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x00821024, 0xaf820010, | 1627 | 0x00431024, 0x1440fffd, 0x24022000, 0x24030002, 0xa4820008, 0xa083000b, |
1610 | 0x97820012, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff, | 1628 | 0xa4800010, 0x3c021000, 0xaf4201b8, 0x0a000f19, 0x00001021, 0x3c030800, |
1611 | 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x03e00008, | 1629 | 0x8c620024, 0x30420001, 0x1040002e, 0x00001021, 0x9742010e, 0x34e70002, |
1612 | 0x00001021, 0x30820001, 0x10400037, 0x30ea0004, 0x9742010e, 0x30e8fffb, | ||
1613 | 0x3c038000, 0x24420004, 0x3045ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, | 1630 | 0x3c038000, 0x24420004, 0x3045ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, |
1614 | 0x24020003, 0xa342018b, 0x97830006, 0x8f84000c, 0x24020002, 0xaf400180, | 1631 | 0x24020003, 0xa342018b, 0x9783000a, 0x8f840004, 0x8f860014, 0x24020002, |
1615 | 0xa742018c, 0xa745018e, 0x10800005, 0xa7430190, 0x9743011c, 0x9742011e, | 1632 | 0xaf400180, 0xa742018c, 0xa745018e, 0xa7470188, 0x30c28000, 0xa7430190, |
1616 | 0x0a000e9f, 0x00021400, 0x9743011e, 0x9742011c, 0x00021400, 0x00621825, | 1633 | 0x1040000c, 0xaf4401a8, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, |
1617 | 0xaf4301a8, 0x8f840010, 0x30828000, 0x1040000c, 0xa7470188, 0x93420116, | 1634 | 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x00c21024, |
1618 | 0x304200fc, 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, | 1635 | 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, |
1619 | 0x3c02ffff, 0x34427fff, 0x00821024, 0xaf820010, 0x97820012, 0x9743010c, | ||
1620 | 0x8f440104, 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, | ||
1621 | 0xaf4301ac, 0x3c021000, 0xaf4201b8, 0x3107ffff, 0x8d220024, 0x30420004, | ||
1622 | 0x10400039, 0x8d220024, 0x9742010e, 0x30e8fffb, 0x3c038000, 0x24420004, | ||
1623 | 0x3046ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, | ||
1624 | 0x97840006, 0x8f85000c, 0x24020100, 0x24030002, 0xaf420180, 0xa743018c, | ||
1625 | 0xa746018e, 0x10a00005, 0xa7440190, 0x9743011c, 0x9742011e, 0x0a000eda, | ||
1626 | 0x00021400, 0x9743011e, 0x9742011c, 0x00021400, 0x00621825, 0xaf4301a8, | ||
1627 | 0x8f840010, 0x30828000, 0x1040000c, 0xa7470188, 0x93420116, 0x304200fc, | ||
1628 | 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, | ||
1629 | 0x34427fff, 0x00821024, 0xaf820010, 0x97820012, 0x9743010c, 0x8f440104, | ||
1630 | 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, | ||
1631 | 0x3c021000, 0xaf4201b8, 0x3107ffff, 0x8d220024, 0x30420008, 0x10400036, | ||
1632 | 0x00000000, 0x9742010e, 0x3c038000, 0x24420004, 0x3046ffff, 0x8f4201b8, | ||
1633 | 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x97840006, 0x8f85000c, | ||
1634 | 0x24020180, 0x24030002, 0xaf420180, 0xa743018c, 0xa746018e, 0x10a00005, | ||
1635 | 0xa7440190, 0x9743011c, 0x9742011e, 0x0a000f14, 0x00021400, 0x9743011e, | ||
1636 | 0x9742011c, 0x00021400, 0x00621825, 0xaf4301a8, 0x8f840010, 0x30828000, | ||
1637 | 0x1040000c, 0xa7470188, 0x93420116, 0x304200fc, 0x005a1021, 0x24424004, | ||
1638 | 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, 0x00821024, | ||
1639 | 0xaf820010, 0x97820012, 0x9743010c, 0x8f440104, 0x3042bfff, 0x00031c00, | ||
1640 | 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, | 1636 | 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, 0xaf4201b8, |
1641 | 0x1540004a, 0x00001021, 0x27440180, 0x3c038000, 0x8f4201b8, 0x00431024, | 1637 | 0x00001021, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x8f4b0070, |
1642 | 0x1440fffd, 0x24022000, 0x24030002, 0xa4820008, 0xa083000b, 0xa4800010, | 1638 | 0x93420112, 0x8f840008, 0x00022882, 0x30820100, 0x14400003, 0x24a30003, |
1643 | 0x3c021000, 0xaf4201b8, 0x03e00008, 0x00001021, 0x3c030800, 0x8c620024, | 1639 | 0x03e00008, 0x00001021, 0x30824000, 0x10400010, 0x27424000, 0x00031880, |
1644 | 0x30420001, 0x10400037, 0x00001021, 0x9742010e, 0x34e60002, 0x3c038000, | 1640 | 0x00431021, 0x8c470000, 0x24a30004, 0x00031880, 0x27424000, 0x00431021, |
1645 | 0x24420004, 0x3045ffff, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, | 1641 | 0x8c490000, 0x93430116, 0x27424000, 0x306300fc, 0x00431021, 0x8c4a0000, |
1646 | 0xa342018b, 0x97830006, 0x8f84000c, 0x24020002, 0xaf400180, 0xa742018c, | 1642 | 0x0a000f45, 0x3c030800, 0x30822000, 0x1040ffea, 0x00031880, 0x27424000, |
1647 | 0xa745018e, 0x10800005, 0xa7430190, 0x9743011c, 0x9742011e, 0x0a000f5e, | 1643 | 0x00431021, 0x8c470000, 0x24a30004, 0x00031880, 0x27424000, 0x00431021, |
1648 | 0x00021400, 0x9743011e, 0x9742011c, 0x00021400, 0x00621825, 0xaf4301a8, | 1644 | 0x8c490000, 0x00005021, 0x3c030800, 0x24680100, 0x00071602, 0x00021080, |
1649 | 0x8f840010, 0x30828000, 0x1040000c, 0xa7460188, 0x93420116, 0x304200fc, | 1645 | 0x00481021, 0x8c460000, 0x00071b82, 0x306303fc, 0x01031821, 0x8c640400, |
1646 | 0x00071182, 0x304203fc, 0x01021021, 0x8c450800, 0x30e300ff, 0x00031880, | ||
1647 | 0x01031821, 0x00091602, 0x00021080, 0x01021021, 0x00c43026, 0x8c640c00, | ||
1648 | 0x8c431000, 0x00c53026, 0x00091382, 0x304203fc, 0x01021021, 0x8c451400, | ||
1649 | 0x312200ff, 0x00021080, 0x01021021, 0x00c43026, 0x00c33026, 0x00091982, | ||
1650 | 0x306303fc, 0x01031821, 0x8c641800, 0x8c431c00, 0x00c53026, 0x00c43026, | ||
1651 | 0x11400015, 0x00c33026, 0x000a1602, 0x00021080, 0x01021021, 0x8c432000, | ||
1652 | 0x000a1382, 0x304203fc, 0x01021021, 0x8c452400, 0x314200ff, 0x00021080, | ||
1653 | 0x01021021, 0x00c33026, 0x000a1982, 0x306303fc, 0x01031821, 0x8c642800, | ||
1654 | 0x8c432c00, 0x00c53026, 0x00c43026, 0x00c33026, 0x8f430070, 0x3c050800, | ||
1655 | 0x8ca43100, 0x2c820020, 0x10400008, 0x006b5823, 0x3c020800, 0x24423104, | ||
1656 | 0x00041880, 0x00621821, 0x24820001, 0xac6b0000, 0xaca23100, 0xaf860004, | ||
1657 | 0x03e00008, 0x24020001, 0x27bdffe8, 0xafbf0010, 0x8f460128, 0x8f840010, | ||
1658 | 0xaf460020, 0x8f450104, 0x8f420100, 0x24030800, 0xaf850008, 0xaf820014, | ||
1659 | 0xaf4301b8, 0x1080000a, 0x3c020800, 0x8c430034, 0x10600007, 0x30a22000, | ||
1660 | 0x10400005, 0x34a30100, 0x8f82000c, 0xaf830008, 0x24420001, 0xaf82000c, | ||
1661 | 0x3c020800, 0x8c4300c0, 0x10600006, 0x3c030800, 0x8c6200c4, 0x24040001, | ||
1662 | 0x24420001, 0x0a000fd5, 0xac6200c4, 0x8f820008, 0x3c030010, 0x00431024, | ||
1663 | 0x14400009, 0x3c02001f, 0x3c030800, 0x8c620020, 0x00002021, 0x24420001, | ||
1664 | 0x0e000c78, 0xac620020, 0x0a000fd5, 0x00402021, 0x3442ff00, 0x14c20009, | ||
1665 | 0x2403bfff, 0x3c030800, 0x8c620020, 0x24040001, 0x24420001, 0x0e000c78, | ||
1666 | 0xac620020, 0x0a000fd5, 0x00402021, 0x8f820014, 0x00431024, 0x14400006, | ||
1667 | 0x00000000, 0xaf400048, 0x0e0011a9, 0xaf400040, 0x0a000fd5, 0x00402021, | ||
1668 | 0x0e001563, 0x00000000, 0x00402021, 0x10800005, 0x3c024000, 0x8f430124, | ||
1669 | 0x3c026020, 0xac430014, 0x3c024000, 0xaf420138, 0x00000000, 0x8fbf0010, | ||
1670 | 0x03e00008, 0x27bd0018, 0x27bdffe0, 0xafbf0018, 0xafb10014, 0xafb00010, | ||
1671 | 0x8f420140, 0xaf420020, 0x8f430148, 0x3c027000, 0x00621824, 0x3c023000, | ||
1672 | 0x10620021, 0x0043102b, 0x14400006, 0x3c024000, 0x3c022000, 0x10620009, | ||
1673 | 0x3c024000, 0x0a001040, 0x00000000, 0x10620045, 0x3c025000, 0x10620047, | ||
1674 | 0x3c024000, 0x0a001040, 0x00000000, 0x27440180, 0x3c038000, 0x8f4201b8, | ||
1675 | 0x00431024, 0x1440fffd, 0x00000000, 0x8f420148, 0x24030002, 0xa083000b, | ||
1676 | 0x00021402, 0xa4820008, 0x8f430148, 0xa4830010, 0x8f420144, 0x3c031000, | ||
1677 | 0xac820024, 0xaf4301b8, 0x0a001040, 0x3c024000, 0x8f420148, 0x24030002, | ||
1678 | 0x3044ffff, 0x00021402, 0x305000ff, 0x1203000c, 0x27510180, 0x2a020003, | ||
1679 | 0x10400005, 0x24020003, 0x0600001d, 0x36053000, 0x0a001027, 0x3c038000, | ||
1680 | 0x12020007, 0x00000000, 0x0a001034, 0x00000000, 0x0e00112c, 0x00000000, | ||
1681 | 0x0a001025, 0x00402021, 0x0e00113e, 0x00000000, 0x00402021, 0x36053000, | ||
1682 | 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020002, 0xa6250008, | ||
1683 | 0xa222000b, 0xa6240010, 0x8f420144, 0x3c031000, 0xae220024, 0xaf4301b8, | ||
1684 | 0x0a001040, 0x3c024000, 0x0000000d, 0x00000000, 0x240002bf, 0x0a001040, | ||
1685 | 0x3c024000, 0x0e001441, 0x00000000, 0x0a001040, 0x3c024000, 0x0e0015ea, | ||
1686 | 0x00000000, 0x3c024000, 0xaf420178, 0x00000000, 0x8fbf0018, 0x8fb10014, | ||
1687 | 0x8fb00010, 0x03e00008, 0x27bd0020, 0x24020800, 0x03e00008, 0xaf4201b8, | ||
1688 | 0x27bdffe8, 0x3c04600c, 0xafbf0014, 0xafb00010, 0x8c825000, 0x3c1a8000, | ||
1689 | 0x2403ff7f, 0x3c106000, 0x00431024, 0x3442380c, 0x24030003, 0xac825000, | ||
1690 | 0x3c020008, 0xaf430008, 0x8e040808, 0x0342d825, 0x8e020808, 0x3c030800, | ||
1691 | 0xac600020, 0x3084fff0, 0x2c840001, 0x3042fff0, 0x38420010, 0x2c420001, | ||
1692 | 0xaf840010, 0xaf820000, 0x0e00160c, 0x00000000, 0x0e001561, 0x00000000, | ||
1693 | 0x3c020400, 0x3442000c, 0x3c03ffff, 0x34630806, 0xae021948, 0xae03194c, | ||
1694 | 0x8e021980, 0x34420200, 0xae021980, 0x8f500000, 0x32020003, 0x1040fffd, | ||
1695 | 0x32020001, 0x10400004, 0x32020002, 0x0e000f92, 0x00000000, 0x32020002, | ||
1696 | 0x1040fff6, 0x00000000, 0x0e000fe0, 0x00000000, 0x0a001071, 0x00000000, | ||
1697 | 0x27bdffe8, 0x3c04600c, 0xafbf0014, 0xafb00010, 0x8c825000, 0x3c1a8000, | ||
1698 | 0x2403ff7f, 0x3c106000, 0x00431024, 0x3442380c, 0x24030003, 0xac825000, | ||
1699 | 0x3c020008, 0xaf430008, 0x8e040808, 0x0342d825, 0x8e020808, 0x3c030800, | ||
1700 | 0xac600020, 0x3084fff0, 0x2c840001, 0x3042fff0, 0x38420010, 0x2c420001, | ||
1701 | 0xaf840010, 0xaf820000, 0x0e00160c, 0x00000000, 0x0e001561, 0x00000000, | ||
1702 | 0x3c020400, 0x3442000c, 0x3c03ffff, 0x34630806, 0xae021948, 0xae03194c, | ||
1703 | 0x8e021980, 0x8fbf0014, 0x34420200, 0xae021980, 0x8fb00010, 0x03e00008, | ||
1704 | 0x27bd0018, 0x00804821, 0x30a5ffff, 0x30c6ffff, 0x30e7ffff, 0x3c038000, | ||
1705 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, 0xa342018b, 0x9783000a, | ||
1706 | 0x8f840004, 0x8f880014, 0xaf490180, 0xa745018c, 0xa746018e, 0xa7470188, | ||
1707 | 0x31028000, 0xa7430190, 0x1040000c, 0xaf4401a8, 0x93420116, 0x304200fc, | ||
1650 | 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, | 1708 | 0x005a1021, 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, |
1651 | 0x34427fff, 0x00821024, 0xaf820010, 0x97820012, 0x9743010c, 0x8f440104, | 1709 | 0x34427fff, 0x01021024, 0xaf820014, 0x97820016, 0x9743010c, 0x8f440104, |
1652 | 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, | 1710 | 0x3042bfff, 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, |
1653 | 0x3c021000, 0xaf4201b8, 0x00001021, 0x03e00008, 0x00000000, 0x27bdffe8, | 1711 | 0x3c021000, 0xaf4201b8, 0x03e00008, 0x00000000, 0x27440180, 0x3c038000, |
1654 | 0xafbf0010, 0x8f460128, 0x8f84000c, 0xaf460020, 0x8f450104, 0x8f420100, | 1712 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24022000, 0x24030002, 0xa4820008, |
1655 | 0x24030800, 0xaf850004, 0xaf820010, 0xaf4301b8, 0x1080000a, 0x3c020800, | 1713 | 0xa083000b, 0xa4800010, 0x3c021000, 0xaf4201b8, 0x03e00008, 0x00000000, |
1656 | 0x8c430034, 0x10600007, 0x30a22000, 0x10400005, 0x34a30100, 0x8f820008, | ||
1657 | 0xaf830004, 0x24420001, 0xaf820008, 0x3c020800, 0x8c4300c0, 0x10600006, | ||
1658 | 0x3c030800, 0x8c6200c4, 0x24040001, 0x24420001, 0x0a000fc0, 0xac6200c4, | ||
1659 | 0x8f820004, 0x3c030010, 0x00431024, 0x14400009, 0x3c02001f, 0x3c030800, | ||
1660 | 0x8c620020, 0x00002021, 0x24420001, 0x0e000c99, 0xac620020, 0x0a000fc0, | ||
1661 | 0x00402021, 0x3442ff00, 0x14c20009, 0x2403bfff, 0x3c030800, 0x8c620020, | ||
1662 | 0x24040001, 0x24420001, 0x0e000c99, 0xac620020, 0x0a000fc0, 0x00402021, | ||
1663 | 0x8f820010, 0x00431024, 0x14400006, 0x00000000, 0xaf400048, 0x0e001144, | ||
1664 | 0xaf400040, 0x0a000fc0, 0x00402021, 0x0e0014c9, 0x00000000, 0x00402021, | ||
1665 | 0x10800005, 0x3c024000, 0x8f430124, 0x3c026020, 0xac430014, 0x3c024000, | ||
1666 | 0xaf420138, 0x00000000, 0x8fbf0010, 0x03e00008, 0x27bd0018, 0x27bdffe0, | ||
1667 | 0xafbf0018, 0xafb10014, 0xafb00010, 0x8f420140, 0xaf420020, 0x8f430148, | ||
1668 | 0x3c027000, 0x00621824, 0x3c023000, 0x10620021, 0x0043102b, 0x14400006, | ||
1669 | 0x3c024000, 0x3c022000, 0x10620009, 0x3c024000, 0x0a00102b, 0x00000000, | ||
1670 | 0x10620045, 0x3c025000, 0x10620047, 0x3c024000, 0x0a00102b, 0x00000000, | ||
1671 | 0x27440180, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, | 1714 | 0x27440180, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, |
1672 | 0x8f420148, 0x24030002, 0xa083000b, 0x00021402, 0xa4820008, 0x8f430148, | 1715 | 0x8f420148, 0x24030002, 0xa083000b, 0x00021402, 0xa4820008, 0x8f430148, |
1673 | 0xa4830010, 0x8f420144, 0x3c031000, 0xac820024, 0xaf4301b8, 0x0a00102b, | 1716 | 0xa4830010, 0x8f420144, 0x3c031000, 0xac820024, 0x03e00008, 0xaf4301b8, |
1674 | 0x3c024000, 0x8f420148, 0x24030002, 0x3044ffff, 0x00021402, 0x305000ff, | 1717 | 0x27bdffe0, 0xafbf0018, 0xafb10014, 0xafb00010, 0x8f420148, 0x24030002, |
1675 | 0x1203000c, 0x27510180, 0x2a020003, 0x10400005, 0x24020003, 0x0600001d, | 1718 | 0x3044ffff, 0x00021402, 0x305000ff, 0x1203000c, 0x27510180, 0x2a020003, |
1676 | 0x36053000, 0x0a001012, 0x3c038000, 0x12020007, 0x00000000, 0x0a00101f, | 1719 | 0x10400005, 0x24020003, 0x0600001d, 0x36053000, 0x0a001117, 0x3c038000, |
1677 | 0x00000000, 0x0e00111f, 0x00000000, 0x0a001010, 0x00402021, 0x0e001131, | 1720 | 0x12020007, 0x00000000, 0x0a001124, 0x00000000, 0x0e00112c, 0x00000000, |
1678 | 0x00000000, 0x00402021, 0x36053000, 0x3c038000, 0x8f4201b8, 0x00431024, | 1721 | 0x0a001115, 0x00402021, 0x0e00113e, 0x00000000, 0x00402021, 0x36053000, |
1679 | 0x1440fffd, 0x24020002, 0xa6250008, 0xa222000b, 0xa6240010, 0x8f420144, | 1722 | 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020002, 0xa6250008, |
1680 | 0x3c031000, 0xae220024, 0xaf4301b8, 0x0a00102b, 0x3c024000, 0x0000000d, | 1723 | 0xa222000b, 0xa6240010, 0x8f420144, 0x3c031000, 0xae220024, 0xaf4301b8, |
1681 | 0x00000000, 0x24000295, 0x0a00102b, 0x3c024000, 0x0e0013a7, 0x00000000, | 1724 | 0x0a001128, 0x8fbf0018, 0x0000000d, 0x00000000, 0x240002bf, 0x8fbf0018, |
1682 | 0x0a00102b, 0x3c024000, 0x0e001552, 0x00000000, 0x3c024000, 0xaf420178, | 1725 | 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020, 0x3084ffff, 0x2c821389, |
1683 | 0x00000000, 0x8fbf0018, 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020, | 1726 | 0x1040000d, 0x00001021, 0x3c030800, 0x24635900, 0x00042942, 0x00052880, |
1684 | 0x24020800, 0x03e00008, 0xaf4201b8, 0x27bdffe8, 0x3c04600c, 0xafbf0014, | 1727 | 0x00a32821, 0x3086001f, 0x8ca40000, 0x24030001, 0x00c31804, 0x00832025, |
1685 | 0xafb00010, 0x8c825000, 0x3c1a8000, 0x2403ff7f, 0x3c106000, 0x00431024, | 1728 | 0x03e00008, 0xaca40000, 0x03e00008, 0x24020091, 0x3084ffff, 0x2c821389, |
1686 | 0x3442380c, 0x24030003, 0xac825000, 0x3c020008, 0xaf430008, 0x8e040808, | 1729 | 0x1040000e, 0x00001021, 0x3c030800, 0x24635900, 0x00042942, 0x00052880, |
1687 | 0x0342d825, 0x8e020808, 0x3c030800, 0xac600020, 0x3084fff0, 0x2c840001, | 1730 | 0x00a32821, 0x3086001f, 0x24030001, 0x8ca40000, 0x00c31804, 0x00031827, |
1688 | 0x3042fff0, 0x38420010, 0x2c420001, 0xaf84000c, 0xaf820000, 0x0e001574, | 1731 | 0x00832024, 0x03e00008, 0xaca40000, 0x03e00008, 0x24020091, 0x9482000c, |
1689 | 0x00000000, 0x0e0014c7, 0x00000000, 0x3c020400, 0x3442000c, 0x3c03ffff, | 1732 | 0x24870014, 0x00021302, 0x00021080, 0x00824021, 0x00e8182b, 0x1060004f, |
1690 | 0x34630806, 0xae021948, 0xae03194c, 0x8e021980, 0x34420200, 0xae021980, | 1733 | 0x00000000, 0x90e30000, 0x2c620009, 0x10400047, 0x3c020800, 0x24425890, |
1691 | 0x8f500000, 0x32020003, 0x1040fffd, 0x32020001, 0x10400004, 0x32020002, | 1734 | 0x00031880, 0x00621821, 0x8c640000, 0x00800008, 0x00000000, 0x0a0011a4, |
1692 | 0x0e000f7d, 0x00000000, 0x32020002, 0x1040fff6, 0x00000000, 0x0e000fcb, | 1735 | 0x24e70001, 0x90e30001, 0x2402000a, 0x54620024, 0x01003821, 0x01071023, |
1693 | 0x00000000, 0x0a00105c, 0x00000000, 0x27bdffe8, 0x3c04600c, 0xafbf0014, | 1736 | 0x2c42000a, 0x54400020, 0x01003821, 0x3c050800, 0x8ca26c98, 0x24e70002, |
1694 | 0xafb00010, 0x8c825000, 0x3c1a8000, 0x2403ff7f, 0x3c106000, 0x00431024, | 1737 | 0x34420100, 0xaca26c98, 0x90e30000, 0x90e20001, 0x90e40002, 0x90e60003, |
1695 | 0x3442380c, 0x24030003, 0xac825000, 0x3c020008, 0xaf430008, 0x8e040808, | 1738 | 0x24e70004, 0x24a56c98, 0x00031e00, 0x00021400, 0x00621825, 0x00042200, |
1696 | 0x0342d825, 0x8e020808, 0x3c030800, 0xac600020, 0x3084fff0, 0x2c840001, | 1739 | 0x00641825, 0x00661825, 0xaca30004, 0x90e20000, 0x90e30001, 0x90e40002, |
1697 | 0x3042fff0, 0x38420010, 0x2c420001, 0xaf84000c, 0xaf820000, 0x0e001574, | 1740 | 0x90e60003, 0x24e70004, 0x00021600, 0x00031c00, 0x00431025, 0x00042200, |
1698 | 0x00000000, 0x0e0014c7, 0x00000000, 0x3c020400, 0x3442000c, 0x3c03ffff, | 1741 | 0x00441025, 0x00461025, 0x0a0011a4, 0xaca20008, 0x90e30001, 0x24020004, |
1699 | 0x34630806, 0xae021948, 0xae03194c, 0x8e021980, 0x8fbf0014, 0x34420200, | 1742 | 0x1062000e, 0x00601021, 0x0a00119e, 0x01001021, 0x90e30001, 0x24020003, |
1700 | 0xae021980, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x30a5ffff, 0x30c6ffff, | 1743 | 0x10620008, 0x00601021, 0x0a00119e, 0x01001021, 0x90e30001, 0x24020002, |
1701 | 0x30e7ffff, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020003, | 1744 | 0x14620003, 0x01001021, 0x00601021, 0x00e21021, 0x0a0011a4, 0x00403821, |
1702 | 0xa342018b, 0x97830006, 0x8f82000c, 0xaf440180, 0xa745018c, 0xa746018e, | 1745 | 0x90e20001, 0x0a0011a4, 0x00e23821, 0x01003821, 0x00e8102b, 0x5440ffb4, |
1703 | 0x10400005, 0xa7430190, 0x9743011c, 0x9742011e, 0x0a0010ad, 0x00021400, | 1746 | 0x90e30000, 0x03e00008, 0x24020001, 0x27bdff90, 0x3c030800, 0xafbf006c, |
1704 | 0x9743011e, 0x9742011c, 0x00021400, 0x00621825, 0xaf4301a8, 0x8f840010, | 1747 | 0xafbe0068, 0xafb70064, 0xafb60060, 0xafb5005c, 0xafb40058, 0xafb30054, |
1705 | 0x30828000, 0x1040000c, 0xa7470188, 0x93420116, 0x304200fc, 0x005a1021, | 1748 | 0xafb20050, 0xafb1004c, 0xafb00048, 0xac606c98, 0x93620023, 0x30420010, |
1706 | 0x24424004, 0x8c430000, 0x3063ffff, 0x14600004, 0x3c02ffff, 0x34427fff, | 1749 | 0x1440027c, 0x24020001, 0x93420116, 0x93630005, 0x34424000, 0x30630001, |
1707 | 0x00821024, 0xaf820010, 0x97820012, 0x9743010c, 0x8f440104, 0x3042bfff, | 1750 | 0x14600005, 0x0342b021, 0x0e0015e0, 0x00000000, 0x0a001436, 0x8fbf006c, |
1708 | 0x00031c00, 0x3084ffff, 0x00641825, 0xa74201a6, 0xaf4301ac, 0x3c021000, | 1751 | 0x93420112, 0x8f430104, 0x3c040020, 0x34424000, 0x00641824, 0x10600012, |
1709 | 0xaf4201b8, 0x03e00008, 0x00000000, 0x27440180, 0x3c038000, 0x8f4201b8, | 1752 | 0x03422821, 0x27450180, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, |
1710 | 0x00431024, 0x1440fffd, 0x24022000, 0x24030002, 0xa4820008, 0xa083000b, | 1753 | 0x00000000, 0x8f420128, 0xaca20000, 0x8f640040, 0x24030008, 0x240240c1, |
1711 | 0xa4800010, 0x3c021000, 0xaf4201b8, 0x03e00008, 0x00000000, 0x27440180, | 1754 | 0xa4a20008, 0x24020002, 0xa0a2000b, 0x3c021000, 0x0a0011f1, 0xa0a3000a, |
1712 | 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x8f420148, | 1755 | 0x8f420104, 0x3c030040, 0x00431024, 0x1040001d, 0x3c038000, 0x27450180, |
1713 | 0x24030002, 0xa083000b, 0x00021402, 0xa4820008, 0x8f430148, 0xa4830010, | 1756 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128, 0xaca20000, |
1714 | 0x8f420144, 0x3c031000, 0xac820024, 0x03e00008, 0xaf4301b8, 0x27bdffe0, | 1757 | 0x8f640040, 0x24030010, 0x240240c1, 0xa4a20008, 0x24020002, 0xa0a3000a, |
1715 | 0xafbf0018, 0xafb10014, 0xafb00010, 0x8f420148, 0x24030002, 0x3044ffff, | 1758 | 0x24030008, 0xa0a2000b, 0x3c021000, 0xa4a30010, 0xa0a00012, 0xa0a00013, |
1716 | 0x00021402, 0x305000ff, 0x1203000c, 0x27510180, 0x2a020003, 0x10400005, | 1759 | 0xaca00014, 0xaca00024, 0xaca00028, 0xaca0002c, 0xaca40018, 0x0e0015e0, |
1717 | 0x24020003, 0x0600001d, 0x36053000, 0x0a00110a, 0x3c038000, 0x12020007, | 1760 | 0xaf4201b8, 0x0a001436, 0x8fbf006c, 0x8f820000, 0x10400016, 0x00000000, |
1718 | 0x00000000, 0x0a001117, 0x00000000, 0x0e00111f, 0x00000000, 0x0a001108, | 1761 | 0x8f420104, 0x3c030001, 0x00431024, 0x10400011, 0x00000000, 0x8ca3000c, |
1719 | 0x00402021, 0x0e001131, 0x00000000, 0x00402021, 0x36053000, 0x3c038000, | 1762 | 0x8f620030, 0x1462022d, 0x24020001, 0x8ca30010, 0x8f62002c, 0x14620229, |
1720 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020002, 0xa6250008, 0xa222000b, | 1763 | 0x24020001, 0x9763003a, 0x96c20000, 0x14430225, 0x24020001, 0x97630038, |
1721 | 0xa6240010, 0x8f420144, 0x3c031000, 0xae220024, 0xaf4301b8, 0x0a00111b, | 1764 | 0x96c20002, 0x14430221, 0x24020001, 0xaf400048, 0xaf400054, 0xaf400040, |
1722 | 0x8fbf0018, 0x0000000d, 0x00000000, 0x24000295, 0x8fbf0018, 0x8fb10014, | 1765 | 0x8f740040, 0x8f650048, 0x00b43023, 0x04c10004, 0x00000000, 0x0000000d, |
1723 | 0x8fb00010, 0x03e00008, 0x27bd0020, 0x3084ffff, 0x2c821389, 0x1040000d, | 1766 | 0x00000000, 0x240001af, 0x9742011a, 0x3052ffff, 0x12400004, 0x8ed30004, |
1724 | 0x00001021, 0x3c030800, 0x24635680, 0x00042942, 0x00052880, 0x00a32821, | 1767 | 0x02721021, 0x0a001228, 0x2451ffff, 0x02608821, 0x92d7000d, 0xa7a00020, |
1725 | 0x3086001f, 0x8ca40000, 0x24030001, 0x00c31804, 0x00832025, 0x03e00008, | 1768 | 0xa3a0001a, 0xafa00028, 0x9362003f, 0x32e30004, 0x1060003a, 0x305000ff, |
1726 | 0xaca40000, 0x03e00008, 0x24020091, 0x3084ffff, 0x2c821389, 0x1040000e, | 1769 | 0x24040012, 0x16040006, 0x24020001, 0x3c040800, 0x8c830028, 0x24630001, |
1727 | 0x00001021, 0x3c030800, 0x24635680, 0x00042942, 0x00052880, 0x00a32821, | 1770 | 0x0a001328, 0xac830028, 0x8f620044, 0x16620010, 0x27a60010, 0x27450180, |
1728 | 0x3086001f, 0x24030001, 0x8ca40000, 0x00c31804, 0x00031827, 0x00832024, | 1771 | 0x3c038000, 0x2402001a, 0xa7a20020, 0x24020020, 0xafb40028, 0xa3b00022, |
1729 | 0x03e00008, 0xaca40000, 0x03e00008, 0x24020091, 0x27bdffb0, 0xafbf0048, | 1772 | 0xa3a40023, 0xa3a2001a, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, |
1730 | 0x93620023, 0x30420010, 0x1440025b, 0x24020001, 0x93420116, 0x93630005, | 1773 | 0x0a00130d, 0x00000000, 0x8f620044, 0x02621023, 0x0440001a, 0x02651023, |
1731 | 0x34424000, 0x30630001, 0x14600005, 0x03425821, 0x0e001548, 0x00000000, | 1774 | 0x044100d9, 0x24020001, 0x3c020800, 0x8c4300d8, 0x10600004, 0x24020001, |
1732 | 0x0a0013a5, 0x8fbf0048, 0x93420112, 0x8f430104, 0x3c040020, 0x34424000, | 1775 | 0xa7a20020, 0x0a00125e, 0xafb40028, 0x2402001a, 0xa7a20020, 0x24020020, |
1733 | 0x00641824, 0x10600012, 0x03422821, 0x27450180, 0x3c038000, 0x8f4201b8, | 1776 | 0xafb40028, 0xa3b00022, 0xa3a40023, 0xa3a2001a, 0x27a60010, 0x27450180, |
1777 | 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x0a00130d, | ||
1778 | 0x00000000, 0x0a001328, 0x24020001, 0x0293f023, 0x1bc00016, 0x025e102a, | ||
1779 | 0x54400007, 0x32f700fe, 0x57d2000f, 0x027e9821, 0x32e20001, 0x5440000c, | ||
1780 | 0x027e9821, 0x32f700fe, 0x0240f021, 0x3c040800, 0x8c8300c8, 0x00009021, | ||
1781 | 0x24020001, 0xa7a20020, 0xafb40028, 0x24630001, 0x0a001282, 0xac8300c8, | ||
1782 | 0x025e1023, 0x0a001282, 0x3052ffff, 0x0000f021, 0x24a2ffff, 0x02221823, | ||
1783 | 0x1860001f, 0x0072102a, 0x54400019, 0x00a08821, 0x97a20020, 0x3c040800, | ||
1784 | 0x8c8300cc, 0xafb40028, 0x34420001, 0x24630001, 0xa7a20020, 0x02741026, | ||
1785 | 0x2c420001, 0xac8300cc, 0x2cc30001, 0x00431024, 0x1440000a, 0x02401821, | ||
1786 | 0x27a60010, 0x27450180, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, | ||
1787 | 0x00000000, 0x0a00130d, 0x00000000, 0x00a08821, 0x02431023, 0x3052ffff, | ||
1788 | 0x0a0012ae, 0x32f700f6, 0x02741023, 0x18400008, 0x97a20020, 0x3c040800, | ||
1789 | 0x8c8300d4, 0xafb30028, 0x34420400, 0x24630001, 0xa7a20020, 0xac8300d4, | ||
1790 | 0x32e20002, 0x1040001c, 0x32e20010, 0x8f620044, 0x1662000d, 0x27a60010, | ||
1791 | 0x97a20020, 0x27450180, 0x3c038000, 0xafb40028, 0x34420001, 0xa7a20020, | ||
1792 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x0a00130d, 0x00000000, | ||
1793 | 0x97a20020, 0x27450180, 0x3c038000, 0xafb40028, 0x34420001, 0xa7a20020, | ||
1794 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x0a00130d, 0x00000000, | ||
1795 | 0x54400003, 0x8ed50008, 0x0a001328, 0x24020001, 0x8f630054, 0x26a2ffff, | ||
1796 | 0x00431023, 0x18400011, 0x27a60010, 0x97a20020, 0x3c040800, 0x8c8300d0, | ||
1797 | 0x27450180, 0x3c078000, 0xafb40028, 0x34420001, 0x24630001, 0xa7a20020, | ||
1798 | 0xac8300d0, 0x8f4201b8, 0x00471024, 0x1440fffd, 0x00000000, 0x0a00130d, | ||
1799 | 0x00000000, 0x32e20020, 0x10400011, 0x00000000, 0x96c20012, 0x0052102b, | ||
1800 | 0x10400008, 0x97a20020, 0x96d20012, 0x12400003, 0x02721021, 0x0a0012f2, | ||
1801 | 0x2451ffff, 0x02608821, 0x97a20020, 0x93a3001a, 0x34420008, 0x34630004, | ||
1802 | 0xa7a20020, 0xa3a3001a, 0x8f420104, 0x3c030080, 0x00431024, 0x10400037, | ||
1803 | 0x3a03000a, 0x0e001151, 0x02c02021, 0x24030002, 0x1443002b, 0x3c030800, | ||
1804 | 0x27a60010, 0x97a20020, 0x27450180, 0x3c038000, 0xafb40028, 0x34420001, | ||
1805 | 0xa7a20020, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128, | ||
1806 | 0xaca20000, 0x8cc30018, 0x240240c1, 0xa4a20008, 0xaca30018, 0x90c4000a, | ||
1807 | 0x24020002, 0xa0a2000b, 0xa0a4000a, 0x94c20010, 0xa4a20010, 0x90c30012, | ||
1808 | 0xa0a30012, 0x90c20013, 0xa0a20013, 0x8cc30014, 0xaca30014, 0x8cc20024, | ||
1809 | 0xaca20024, 0x8cc30028, 0xaca30028, 0x8cc4002c, 0x24020001, 0x3c031000, | ||
1810 | 0xaca4002c, 0xaf4301b8, 0xaf400044, 0xaf400050, 0x0a001436, 0x8fbf006c, | ||
1811 | 0x8c626c98, 0x30420100, 0x10400003, 0x24636c98, 0x8c620004, 0xaf62017c, | ||
1812 | 0x3a03000a, 0x2c630001, 0x3a02000c, 0x2c420001, 0x00621825, 0x14600003, | ||
1813 | 0x2402000e, 0x56020030, 0x00009021, 0x52400008, 0x96c4000e, 0x12400004, | ||
1814 | 0xa7b20040, 0x02721021, 0x0a001343, 0x2451ffff, 0x02608821, 0x96c4000e, | ||
1815 | 0x93630035, 0x8f62004c, 0x00642004, 0x00952021, 0x00821023, 0x18400015, | ||
1816 | 0x00000000, 0x8f620018, 0x02621023, 0x1c400015, 0x97a20020, 0x8f620018, | ||
1817 | 0x1662001c, 0x00000000, 0x8f62001c, 0x02a21023, 0x1c40000e, 0x97a20020, | ||
1818 | 0x8f62001c, 0x16a20015, 0x00000000, 0x8f620058, 0x00821023, 0x18400011, | ||
1819 | 0x97a20020, 0x0a001364, 0xafb10028, 0x8f620058, 0x00821023, 0x0441000b, | ||
1820 | 0x97a20020, 0xafb10028, 0xafb30034, 0xafb50038, 0xafa4003c, 0x34420020, | ||
1821 | 0x0a00136d, 0xa7a20020, 0x02809821, 0x02608821, 0x8f640058, 0x8f62004c, | ||
1822 | 0x02a21023, 0x18400009, 0x00000000, 0x8f620054, 0x02a21023, 0x1c400005, | ||
1823 | 0x97a20020, 0xafb10028, 0xafb50024, 0x0a001385, 0x34420040, 0x9742011a, | ||
1824 | 0x1440000c, 0x24020014, 0x8f620058, 0x14820009, 0x24020014, 0x8f63004c, | ||
1825 | 0x8f620054, 0x10620004, 0x97a20020, 0xafb10028, 0x34420080, 0xa7a20020, | ||
1826 | 0x24020014, 0x1202000a, 0x2a020015, 0x10400005, 0x2402000c, 0x12020006, | ||
1827 | 0x32e20001, 0x0a0013c6, 0x00000000, 0x24020016, 0x16020035, 0x32e20001, | ||
1828 | 0x8f620084, 0x24420001, 0x16a20031, 0x32e20001, 0x24020014, 0x12020021, | ||
1829 | 0x2a020015, 0x10400005, 0x2402000c, 0x12020008, 0x32e20001, 0x0a0013c6, | ||
1830 | 0x00000000, 0x24020016, 0x1202000c, 0x32e20001, 0x0a0013c6, 0x00000000, | ||
1831 | 0x97a30020, 0x2402000e, 0xafb10028, 0xa3b00022, 0xa3a20023, 0xafb50024, | ||
1832 | 0x34630054, 0x0a0013c5, 0xa7a30020, 0x97a20020, 0x93a4001a, 0x24030010, | ||
1833 | 0xafb10028, 0xa3b00022, 0xa3a30023, 0xafb50024, 0x3442005d, 0x34840002, | ||
1834 | 0xa7a20020, 0x0a0013c5, 0xa3a4001a, 0x97a20020, 0x24030012, 0xa3a30023, | ||
1835 | 0x93a3001a, 0xafb10028, 0xa3b00022, 0xafb50024, 0x3042fffe, 0x3442005c, | ||
1836 | 0x34630002, 0xa7a20020, 0xa3a3001a, 0x32e20001, 0x10400030, 0x2402000c, | ||
1837 | 0x12020013, 0x2a02000d, 0x10400005, 0x2402000a, 0x12020008, 0x97a20020, | ||
1838 | 0x0a0013f8, 0x32e20009, 0x2402000e, 0x1202001b, 0x32e20009, 0x0a0013f9, | ||
1839 | 0x0002102b, 0x93a4001a, 0x24030008, 0xafb10028, 0xa3b00022, 0xa3a30023, | ||
1840 | 0x0a0013f4, 0x34420013, 0x97a30020, 0x30620004, 0x14400005, 0x93a2001a, | ||
1841 | 0x3463001b, 0xa7a30020, 0x0a0013e7, 0x24030016, 0x3463001b, 0xa7a30020, | ||
1842 | 0x24030010, 0xafb10028, 0xa3b00022, 0xa3a30023, 0x34420002, 0x0a0013f7, | ||
1843 | 0xa3a2001a, 0x97a20020, 0x93a4001a, 0x24030010, 0xafb10028, 0xa3b00022, | ||
1844 | 0xa3a30023, 0x3442001b, 0x34840002, 0xa7a20020, 0xa3a4001a, 0x32e20009, | ||
1845 | 0x0002102b, 0x00021023, 0x30420007, 0x12400015, 0x34450003, 0x8f820018, | ||
1846 | 0x24030800, 0x27440180, 0x24420001, 0xaf820018, 0x24020004, 0xaf4301b8, | ||
1847 | 0xa4850008, 0xa082000b, 0x93430120, 0x00003021, 0x3c021000, 0xa492000e, | ||
1848 | 0xac950024, 0xac930028, 0x007e1821, 0xa483000c, 0xaf4201b8, 0x0a001413, | ||
1849 | 0x97a20020, 0x24060001, 0x97a20020, 0x10400020, 0x27450180, 0x3c038000, | ||
1850 | 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128, 0xaca20000, | ||
1851 | 0x8fa30028, 0x240240c1, 0xa4a20008, 0xaca30018, 0x93a4001a, 0x24020002, | ||
1852 | 0xa0a2000b, 0xa0a4000a, 0x97a20020, 0xa4a20010, 0x93a30022, 0xa0a30012, | ||
1853 | 0x93a20023, 0xa0a20013, 0x8fa30024, 0xaca30014, 0x8fa20034, 0xaca20024, | ||
1854 | 0x8fa30038, 0xaca30028, 0x8fa2003c, 0x3c031000, 0xaca2002c, 0xaf4301b8, | ||
1855 | 0x00c01021, 0x8fbf006c, 0x8fbe0068, 0x8fb70064, 0x8fb60060, 0x8fb5005c, | ||
1856 | 0x8fb40058, 0x8fb30054, 0x8fb20050, 0x8fb1004c, 0x8fb00048, 0x03e00008, | ||
1857 | 0x27bd0070, 0x8f470140, 0x8f460148, 0x3c028000, 0x00c24024, 0x00062c02, | ||
1858 | 0x30a300ff, 0x24020019, 0x106200e7, 0x27440180, 0x2862001a, 0x1040001f, | ||
1859 | 0x24020008, 0x106200be, 0x28620009, 0x1040000d, 0x24020001, 0x10620046, | ||
1860 | 0x28620002, 0x50400005, 0x24020006, 0x1060002e, 0x00a01821, 0x0a00155e, | ||
1861 | 0x00000000, 0x1062005b, 0x00a01821, 0x0a00155e, 0x00000000, 0x2402000b, | ||
1862 | 0x10620084, 0x2862000c, 0x10400005, 0x24020009, 0x106200bc, 0x00061c02, | ||
1863 | 0x0a00155e, 0x00000000, 0x2402000e, 0x106200b7, 0x00061c02, 0x0a00155e, | ||
1864 | 0x00000000, 0x28620021, 0x10400009, 0x2862001f, 0x104000c1, 0x2402001b, | ||
1865 | 0x106200bf, 0x2402001c, 0x1062009a, 0x00061c02, 0x0a00155e, 0x00000000, | ||
1866 | 0x240200c2, 0x106200ca, 0x286200c3, 0x10400005, 0x24020080, 0x1062005a, | ||
1867 | 0x00a01821, 0x0a00155e, 0x00000000, 0x240200c9, 0x106200cd, 0x30c5ffff, | ||
1868 | 0x0a00155e, 0x00000000, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, | ||
1869 | 0x24020001, 0xa4830008, 0x24030002, 0xac870000, 0xac800004, 0xa082000a, | ||
1870 | 0xa083000b, 0xa4860010, 0x8f430144, 0x3c021000, 0xac800028, 0xac830024, | ||
1871 | 0x3c036000, 0xaf4201b8, 0x03e00008, 0xac600808, 0x11000009, 0x00a01821, | ||
1872 | 0x3c020800, 0x24030002, 0xa0436c88, 0x24426c88, 0xac470008, 0x8f430144, | ||
1873 | 0x03e00008, 0xac430004, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, | ||
1874 | 0x24020002, 0xac800000, 0xac870004, 0xa4830008, 0xa082000a, 0xa082000b, | ||
1875 | 0xa4860010, 0xac800024, 0x8f420144, 0x3c031000, 0xac820028, 0x3c026000, | ||
1876 | 0xaf4301b8, 0x03e00008, 0xac400808, 0x3c080800, 0x3c058000, 0x8f4201b8, | ||
1877 | 0x00451024, 0x1440fffd, 0x00000000, 0xac870000, 0x91026c88, 0x00002821, | ||
1878 | 0x10400002, 0x25076c88, 0x8ce50008, 0xac850004, 0xa4830008, 0x91036c88, | ||
1879 | 0x24020002, 0xa082000b, 0xa4860010, 0x34630001, 0xa083000a, 0x8f420144, | ||
1880 | 0xac820024, 0x91036c88, 0x10600002, 0x00001021, 0x8ce20004, 0xac820028, | ||
1881 | 0x3c021000, 0xaf4201b8, 0x3c026000, 0xa1006c88, 0x03e00008, 0xac400808, | ||
1882 | 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x24020002, 0xa082000b, | ||
1883 | 0xa4830008, 0xa4860010, 0x8f420144, 0x3c031000, 0xa4820012, 0x03e00008, | ||
1884 | 0xaf4301b8, 0x30c2ffff, 0x14400028, 0x00061c02, 0x93620005, 0x30420004, | ||
1885 | 0x14400020, 0x3c029000, 0x34420001, 0x00e21025, 0xaf420020, 0x3c038000, | ||
1886 | 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, 0x93620005, 0x3c038000, | ||
1887 | 0x34630001, 0x00e31825, 0x34420004, 0xa3620005, 0xaf430020, 0x93620005, | ||
1888 | 0x30420004, 0x14400003, 0x3c038000, 0x0000000d, 0x3c038000, 0x8f4201b8, | ||
1889 | 0x00431024, 0x1440fffd, 0x24020005, 0x3c031000, 0xac870000, 0xa082000b, | ||
1890 | 0xaf4301b8, 0x0a00150d, 0x00061c02, 0x0000000d, 0x03e00008, 0x00000000, | ||
1891 | 0x00061c02, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x24020001, | ||
1892 | 0xa4830008, 0x24030002, 0xac870000, 0xac800004, 0xa082000a, 0xa083000b, | ||
1893 | 0xa4860010, 0x8f430144, 0x3c021000, 0xac800028, 0xac830024, 0x03e00008, | ||
1894 | 0xaf4201b8, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x24020002, | ||
1895 | 0xac800000, 0xac870004, 0xa4830008, 0xa082000a, 0xa082000b, 0xa4860010, | ||
1896 | 0xac800024, 0x8f420144, 0x3c031000, 0xac820028, 0x03e00008, 0xaf4301b8, | ||
1897 | 0x00061c02, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x24020001, | ||
1898 | 0xa4830008, 0x24030002, 0xa082000a, 0x3c021000, 0xac870000, 0xac800004, | ||
1899 | 0xa083000b, 0xa4860010, 0xac800024, 0xac800028, 0x03e00008, 0xaf4201b8, | ||
1900 | 0x00a01821, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x24020002, | ||
1901 | 0xac870000, 0xac800004, 0xa4830008, 0xa080000a, 0x0a001518, 0xa082000b, | ||
1902 | 0x8f440144, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020002, | ||
1903 | 0x240340c9, 0xaf470180, 0xa342018b, 0x3c021000, 0xa7430188, 0xaf4401a4, | ||
1904 | 0xaf4501a8, 0xaf4001ac, 0x03e00008, 0xaf4201b8, 0x0000000d, 0x03e00008, | ||
1905 | 0x00000000, 0x03e00008, 0x00000000, 0x8f420100, 0x3042003e, 0x14400011, | ||
1906 | 0x24020001, 0xaf400048, 0x8f420100, 0x304207c0, 0x10400005, 0x00000000, | ||
1907 | 0xaf40004c, 0xaf400050, 0x03e00008, 0x24020001, 0xaf400054, 0xaf400040, | ||
1908 | 0x8f420100, 0x30423800, 0x54400001, 0xaf400044, 0x24020001, 0x03e00008, | ||
1909 | 0x00000000, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020002, | ||
1910 | 0x240340c9, 0xaf440180, 0xa342018b, 0x3c021000, 0xa7430188, 0xaf4501a4, | ||
1911 | 0xaf4601a8, 0xaf4701ac, 0x03e00008, 0xaf4201b8, 0x3c029000, 0x34420001, | ||
1912 | 0x00822025, 0xaf440020, 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd, | ||
1913 | 0x00000000, 0x03e00008, 0x00000000, 0x3c028000, 0x34420001, 0x00822025, | ||
1914 | 0x03e00008, 0xaf440020, 0x308600ff, 0x27450180, 0x3c038000, 0x8f4201b8, | ||
1734 | 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128, 0xaca20000, 0x8f640040, | 1915 | 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128, 0xaca20000, 0x8f640040, |
1735 | 0x24030008, 0x240240c1, 0xa4a20008, 0x24020002, 0xa0a2000b, 0x3c021000, | 1916 | 0x24030008, 0x240240c1, 0xa4a20008, 0x24020002, 0xa0a2000b, 0x3c021000, |
1736 | 0x0a001181, 0xa0a3000a, 0x8f420104, 0x3c030040, 0x00431024, 0x1040001d, | 1917 | 0xa0a6000a, 0xa4a30010, 0xa0a00012, 0xa0a00013, 0xaca00014, 0xaca00024, |
1737 | 0x3c038000, 0x27450180, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, | 1918 | 0xaca00028, 0xaca0002c, 0xaca40018, 0x03e00008, 0xaf4201b8, 0x24020001, |
1738 | 0x8f420128, 0xaca20000, 0x8f640040, 0x24030010, 0x240240c1, 0xa4a20008, | 1919 | 0xacc40000, 0x03e00008, 0xa4e50000, 0x24020001, 0xaf400044, 0x03e00008, |
1739 | 0x24020002, 0xa0a3000a, 0x24030008, 0xa0a2000b, 0x3c021000, 0xa4a30010, | 1920 | 0xaf400050, 0x00803021, 0x27450180, 0x3c038000, 0x8f4201b8, 0x00431024, |
1740 | 0xa0a00012, 0xa0a00013, 0xaca00014, 0xaca00024, 0xaca00028, 0xaca0002c, | 1921 | 0x1440fffd, 0x00000000, 0x8f420128, 0xaca20000, 0x8cc30018, 0x240240c1, |
1741 | 0xaca40018, 0x0e001548, 0xaf4201b8, 0x0a0013a5, 0x8fbf0048, 0x8f820000, | 1922 | 0xa4a20008, 0xaca30018, 0x90c4000a, 0x24020002, 0xa0a2000b, 0xa0a4000a, |
1742 | 0x10400016, 0x00000000, 0x8f420104, 0x3c030001, 0x00431024, 0x10400011, | 1923 | 0x94c20010, 0xa4a20010, 0x90c30012, 0xa0a30012, 0x90c20013, 0xa0a20013, |
1743 | 0x00000000, 0x8ca3000c, 0x8f620030, 0x1462020c, 0x24020001, 0x8ca30010, | 1924 | 0x8cc30014, 0xaca30014, 0x8cc20024, 0xaca20024, 0x8cc30028, 0xaca30028, |
1744 | 0x8f62002c, 0x14620208, 0x24020001, 0x9763003a, 0x95620000, 0x14430204, | 1925 | 0x8cc2002c, 0x3c031000, 0xaca2002c, 0x24020001, 0xaf4301b8, 0xaf400044, |
1745 | 0x24020001, 0x97630038, 0x95620002, 0x14430200, 0x24020001, 0xaf400048, | 1926 | 0x03e00008, 0xaf400050, 0x27bdffe8, 0xafbf0010, 0x0e001047, 0x00000000, |
1746 | 0xaf400054, 0xaf400040, 0x8f690040, 0x8f6a0048, 0x01497023, 0x05c10004, | 1927 | 0x00002021, 0x0e000c78, 0xaf400180, 0x8fbf0010, 0x03e00008, 0x27bd0018, |
1747 | 0x00000000, 0x0000000d, 0x00000000, 0x24000169, 0x9742011a, 0x3046ffff, | 1928 | 0x8f460148, 0x27450180, 0x3c038000, 0x00061402, 0x304700ff, 0x8f4201b8, |
1748 | 0x10c00004, 0x8d680004, 0x01061021, 0x0a0011b8, 0x2445ffff, 0x01002821, | 1929 | 0x00431024, 0x1440fffd, 0x00000000, 0x8f440140, 0x00061202, 0x304200ff, |
1749 | 0x916c000d, 0xa7a00020, 0xa3a0001a, 0xafa00028, 0x9362003f, 0x31830004, | 1930 | 0x00061c02, 0xaca20004, 0x24020002, 0xa4a30008, 0x30c300ff, 0xa0a2000b, |
1750 | 0x1060003a, 0x304700ff, 0x24040012, 0x14e40006, 0x24020001, 0x3c040800, | 1931 | 0xaca30024, 0x10e0000a, 0xaca40000, 0x28e20004, 0x14400005, 0x24020001, |
1751 | 0x8c830028, 0x24630001, 0x0a00128d, 0xac830028, 0x8f620044, 0x15020010, | 1932 | 0x24020005, 0x54e20005, 0xa0a0000a, 0x24020001, 0x0a001609, 0xa0a2000a, |
1752 | 0x27a60010, 0x27450180, 0x3c038000, 0x2402001a, 0xa7a20020, 0x24020020, | 1933 | 0xa0a0000a, 0x3c021000, 0x03e00008, 0xaf4201b8, 0x03e00008, 0x00001021, |
1753 | 0xafa90028, 0xa3a70022, 0xa3a40023, 0xa3a2001a, 0x8f4201b8, 0x00431024, | 1934 | 0x10c00007, 0x00000000, 0x8ca20000, 0x24c6ffff, 0x24a50004, 0xac820000, |
1754 | 0x1440fffd, 0x00000000, 0x0a001272, 0x00000000, 0x8f620044, 0x01021023, | 1935 | 0x14c0fffb, 0x24840004, 0x03e00008, 0x00000000, 0x0a00161f, 0x00a01021, |
1755 | 0x0440001a, 0x010a1023, 0x044100ae, 0x24020001, 0x3c020800, 0x8c4300d8, | 1936 | 0xac860000, 0x00000000, 0x00000000, 0x24840004, 0x00a01021, 0x1440fffa, |
1756 | 0x10600004, 0x24020001, 0xa7a20020, 0x0a0011ee, 0xafa90028, 0x2402001a, | 1937 | 0x24a5ffff, 0x03e00008, 0x00000000, 0x00000000 }; |
1757 | 0xa7a20020, 0x24020020, 0xafa90028, 0xa3a70022, 0xa3a40023, 0xa3a2001a, | ||
1758 | 0x27a60010, 0x27450180, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, | ||
1759 | 0x00000000, 0x0a001272, 0x00000000, 0x0a00128d, 0x24020001, 0x01286823, | ||
1760 | 0x19a00016, 0x00cd102a, 0x54400007, 0x318c00fe, 0x55a6000f, 0x010d4021, | ||
1761 | 0x31820001, 0x5440000c, 0x010d4021, 0x318c00fe, 0x00c06821, 0x3c040800, | ||
1762 | 0x8c8300c8, 0x00003021, 0x24020001, 0xa7a20020, 0xafa90028, 0x24630001, | ||
1763 | 0x0a001212, 0xac8300c8, 0x00cd1023, 0x0a001212, 0x3046ffff, 0x00006821, | ||
1764 | 0x2542ffff, 0x00a21823, 0x1860001e, 0x0066102a, 0x14400018, 0x01402821, | ||
1765 | 0x97a20020, 0x3c040800, 0x8c8300cc, 0xafa90028, 0x34420001, 0x24630001, | ||
1766 | 0xa7a20020, 0x01091026, 0x2c420001, 0xac8300cc, 0x2dc30001, 0x00431024, | ||
1767 | 0x1440000a, 0x00c01821, 0x27a60010, 0x27450180, 0x3c038000, 0x8f4201b8, | ||
1768 | 0x00431024, 0x1440fffd, 0x00000000, 0x0a001272, 0x00000000, 0x00c31023, | ||
1769 | 0x3046ffff, 0x0a00123d, 0x318c00f6, 0x01091023, 0x18400008, 0x97a20020, | ||
1770 | 0x3c040800, 0x8c8300d4, 0xafa80028, 0x34420400, 0x24630001, 0xa7a20020, | ||
1771 | 0xac8300d4, 0x31820002, 0x1040001c, 0x31820010, 0x8f620044, 0x1502000d, | ||
1772 | 0x27a60010, 0x97a20020, 0x27450180, 0x3c038000, 0xafa90028, 0x34420001, | ||
1773 | 0xa7a20020, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x0a001272, | ||
1774 | 0x00000000, 0x97a20020, 0x27450180, 0x3c038000, 0xafa90028, 0x34420001, | ||
1775 | 0xa7a20020, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x0a001272, | ||
1776 | 0x00000000, 0x54400003, 0x8d6a0008, 0x0a00128d, 0x24020001, 0x8f630054, | ||
1777 | 0x2542ffff, 0x00431023, 0x1840002e, 0x97a20020, 0x27a60010, 0x3c040800, | ||
1778 | 0x8c8300d0, 0x27450180, 0x3c078000, 0xafa90028, 0x34420001, 0x24630001, | ||
1779 | 0xa7a20020, 0xac8300d0, 0x8f4201b8, 0x00471024, 0x1440fffd, 0x00000000, | ||
1780 | 0x8f420128, 0xaca20000, 0x8cc30018, 0x240240c1, 0xa4a20008, 0xaca30018, | ||
1781 | 0x90c4000a, 0x24020002, 0xa0a2000b, 0xa0a4000a, 0x94c20010, 0xa4a20010, | ||
1782 | 0x90c30012, 0xa0a30012, 0x90c20013, 0xa0a20013, 0x8cc30014, 0xaca30014, | ||
1783 | 0x8cc20024, 0xaca20024, 0x8cc30028, 0xaca30028, 0x8cc4002c, 0x24020001, | ||
1784 | 0x3c031000, 0xaca4002c, 0xaf4301b8, 0xaf400044, 0xaf400050, 0x0a0013a5, | ||
1785 | 0x8fbf0048, 0x31820020, 0x10400011, 0x00000000, 0x95620012, 0x0046102b, | ||
1786 | 0x10400008, 0x97a20020, 0x95660012, 0x10c00003, 0x01061021, 0x0a00129e, | ||
1787 | 0x2445ffff, 0x01002821, 0x97a20020, 0x93a3001a, 0x34420008, 0x34630004, | ||
1788 | 0xa7a20020, 0xa3a3001a, 0x8f420104, 0x38e3000a, 0x2c630001, 0x38e2000c, | ||
1789 | 0x2c420001, 0x00621825, 0x14600003, 0x2402000e, 0x54e2002a, 0x00003021, | ||
1790 | 0x50c00008, 0x9564000e, 0x10c00004, 0xa7a60040, 0x01061021, 0x0a0012b6, | ||
1791 | 0x2445ffff, 0x01002821, 0x9564000e, 0x93630035, 0x8f62004c, 0x00642004, | ||
1792 | 0x008a2021, 0x00821023, 0x1840001d, 0x00000000, 0x8f620018, 0x01021023, | ||
1793 | 0x1c40000f, 0x97a20020, 0x8f620018, 0x15020016, 0x00000000, 0x8f62001c, | ||
1794 | 0x01421023, 0x1c400008, 0x97a20020, 0x8f62001c, 0x1542000f, 0x00000000, | ||
1795 | 0x8f620058, 0x00821023, 0x1840000b, 0x97a20020, 0xafa50028, 0xafa80034, | ||
1796 | 0xafaa0038, 0xafa4003c, 0x34420020, 0x0a0012da, 0xa7a20020, 0x01204021, | ||
1797 | 0x01002821, 0x8f640058, 0x8f62004c, 0x01421023, 0x18400009, 0x00000000, | ||
1798 | 0x8f620054, 0x01421023, 0x1c400005, 0x97a20020, 0xafa50028, 0xafaa0024, | ||
1799 | 0x0a0012f2, 0x34420040, 0x9742011a, 0x1440000c, 0x24020014, 0x8f620058, | ||
1800 | 0x14820009, 0x24020014, 0x8f63004c, 0x8f620054, 0x10620004, 0x97a20020, | ||
1801 | 0xafa50028, 0x34420080, 0xa7a20020, 0x24020014, 0x10e2000a, 0x28e20015, | ||
1802 | 0x10400005, 0x2402000c, 0x10e20006, 0x31820001, 0x0a001333, 0x00000000, | ||
1803 | 0x24020016, 0x14e20035, 0x31820001, 0x8f620084, 0x24420001, 0x15420031, | ||
1804 | 0x31820001, 0x24020014, 0x10e20021, 0x28e20015, 0x10400005, 0x2402000c, | ||
1805 | 0x10e20008, 0x31820001, 0x0a001333, 0x00000000, 0x24020016, 0x10e2000c, | ||
1806 | 0x31820001, 0x0a001333, 0x00000000, 0x97a30020, 0x2402000e, 0xafa50028, | ||
1807 | 0xa3a70022, 0xa3a20023, 0xafaa0024, 0x34630054, 0x0a001332, 0xa7a30020, | ||
1808 | 0x97a20020, 0x93a4001a, 0x24030010, 0xafa50028, 0xa3a70022, 0xa3a30023, | ||
1809 | 0xafaa0024, 0x3442005d, 0x34840002, 0xa7a20020, 0x0a001332, 0xa3a4001a, | ||
1810 | 0x97a20020, 0x24030012, 0xa3a30023, 0x93a3001a, 0xafa50028, 0xa3a70022, | ||
1811 | 0xafaa0024, 0x3042fffe, 0x3442005c, 0x34630002, 0xa7a20020, 0xa3a3001a, | ||
1812 | 0x31820001, 0x10400030, 0x2402000c, 0x10e20013, 0x28e2000d, 0x10400005, | ||
1813 | 0x2402000a, 0x10e20008, 0x97a20020, 0x0a001365, 0x31820009, 0x2402000e, | ||
1814 | 0x10e2001b, 0x31820009, 0x0a001366, 0x0002102b, 0x93a4001a, 0x24030008, | ||
1815 | 0xafa50028, 0xa3a70022, 0xa3a30023, 0x0a001361, 0x34420013, 0x97a30020, | ||
1816 | 0x30620004, 0x14400005, 0x93a2001a, 0x3463001b, 0xa7a30020, 0x0a001354, | ||
1817 | 0x24030016, 0x3463001b, 0xa7a30020, 0x24030010, 0xafa50028, 0xa3a70022, | ||
1818 | 0xa3a30023, 0x34420002, 0x0a001364, 0xa3a2001a, 0x97a20020, 0x93a4001a, | ||
1819 | 0x24030010, 0xafa50028, 0xa3a70022, 0xa3a30023, 0x3442001b, 0x34840002, | ||
1820 | 0xa7a20020, 0xa3a4001a, 0x31820009, 0x0002102b, 0x00021023, 0x30420007, | ||
1821 | 0x10c00017, 0x34440003, 0x8f820014, 0x24030800, 0x27450180, 0x24420001, | ||
1822 | 0xaf820014, 0x24020004, 0xaf4301b8, 0xa4a40008, 0xa0a2000b, 0x93440120, | ||
1823 | 0x3c031000, 0xa4a6000e, 0xacaa0024, 0xaca80028, 0x008d2021, 0xa4a4000c, | ||
1824 | 0xaf4301b8, 0x97a20020, 0x00003021, 0x3042ffbf, 0x0a001381, 0xa7a20020, | ||
1825 | 0x24060001, 0x97a20020, 0x10400020, 0x27450180, 0x3c038000, 0x8f4201b8, | ||
1826 | 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128, 0xaca20000, 0x8fa30028, | ||
1827 | 0x240240c1, 0xa4a20008, 0xaca30018, 0x93a4001a, 0x24020002, 0xa0a2000b, | ||
1828 | 0xa0a4000a, 0x97a20020, 0xa4a20010, 0x93a30022, 0xa0a30012, 0x93a20023, | ||
1829 | 0xa0a20013, 0x8fa30024, 0xaca30014, 0x8fa20034, 0xaca20024, 0x8fa30038, | ||
1830 | 0xaca30028, 0x8fa2003c, 0x3c031000, 0xaca2002c, 0xaf4301b8, 0x00c01021, | ||
1831 | 0x8fbf0048, 0x03e00008, 0x27bd0050, 0x8f470140, 0x8f460148, 0x3c028000, | ||
1832 | 0x00c24024, 0x00062c02, 0x30a300ff, 0x24020019, 0x106200e7, 0x27440180, | ||
1833 | 0x2862001a, 0x1040001f, 0x24020008, 0x106200be, 0x28620009, 0x1040000d, | ||
1834 | 0x24020001, 0x10620046, 0x28620002, 0x50400005, 0x24020006, 0x1060002e, | ||
1835 | 0x00a01821, 0x0a0014c4, 0x00000000, 0x1062005b, 0x00a01821, 0x0a0014c4, | ||
1836 | 0x00000000, 0x2402000b, 0x10620084, 0x2862000c, 0x10400005, 0x24020009, | ||
1837 | 0x106200bc, 0x00061c02, 0x0a0014c4, 0x00000000, 0x2402000e, 0x106200b7, | ||
1838 | 0x00061c02, 0x0a0014c4, 0x00000000, 0x28620021, 0x10400009, 0x2862001f, | ||
1839 | 0x104000c1, 0x2402001b, 0x106200bf, 0x2402001c, 0x1062009a, 0x00061c02, | ||
1840 | 0x0a0014c4, 0x00000000, 0x240200c2, 0x106200ca, 0x286200c3, 0x10400005, | ||
1841 | 0x24020080, 0x1062005a, 0x00a01821, 0x0a0014c4, 0x00000000, 0x240200c9, | ||
1842 | 0x106200cd, 0x30c5ffff, 0x0a0014c4, 0x00000000, 0x3c058000, 0x8f4201b8, | ||
1843 | 0x00451024, 0x1440fffd, 0x24020001, 0xa4830008, 0x24030002, 0xac870000, | ||
1844 | 0xac800004, 0xa082000a, 0xa083000b, 0xa4860010, 0x8f430144, 0x3c021000, | ||
1845 | 0xac800028, 0xac830024, 0x3c036000, 0xaf4201b8, 0x03e00008, 0xac600808, | ||
1846 | 0x11000009, 0x00a01821, 0x3c020800, 0x24030002, 0xa0436a08, 0x24426a08, | ||
1847 | 0xac470008, 0x8f430144, 0x03e00008, 0xac430004, 0x3c058000, 0x8f4201b8, | ||
1848 | 0x00451024, 0x1440fffd, 0x24020002, 0xac800000, 0xac870004, 0xa4830008, | ||
1849 | 0xa082000a, 0xa082000b, 0xa4860010, 0xac800024, 0x8f420144, 0x3c031000, | ||
1850 | 0xac820028, 0x3c026000, 0xaf4301b8, 0x03e00008, 0xac400808, 0x3c080800, | ||
1851 | 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, 0x00000000, 0xac870000, | ||
1852 | 0x91026a08, 0x00002821, 0x10400002, 0x25076a08, 0x8ce50008, 0xac850004, | ||
1853 | 0xa4830008, 0x91036a08, 0x24020002, 0xa082000b, 0xa4860010, 0x34630001, | ||
1854 | 0xa083000a, 0x8f420144, 0xac820024, 0x91036a08, 0x10600002, 0x00001021, | ||
1855 | 0x8ce20004, 0xac820028, 0x3c021000, 0xaf4201b8, 0x3c026000, 0xa1006a08, | ||
1856 | 0x03e00008, 0xac400808, 0x3c058000, 0x8f4201b8, 0x00451024, 0x1440fffd, | ||
1857 | 0x24020002, 0xa082000b, 0xa4830008, 0xa4860010, 0x8f420144, 0x3c031000, | ||
1858 | 0xa4820012, 0x03e00008, 0xaf4301b8, 0x30c2ffff, 0x14400028, 0x00061c02, | ||
1859 | 0x93620005, 0x30420004, 0x14400020, 0x3c029000, 0x34420001, 0x00e21025, | ||
1860 | 0xaf420020, 0x3c038000, 0x8f420020, 0x00431024, 0x1440fffd, 0x00000000, | ||
1861 | 0x93620005, 0x3c038000, 0x34630001, 0x00e31825, 0x34420004, 0xa3620005, | ||
1862 | 0xaf430020, 0x93620005, 0x30420004, 0x14400003, 0x3c038000, 0x0000000d, | ||
1863 | 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x24020005, 0x3c031000, | ||
1864 | 0xac870000, 0xa082000b, 0xaf4301b8, 0x0a001473, 0x00061c02, 0x0000000d, | ||
1865 | 0x03e00008, 0x00000000, 0x00061c02, 0x3c058000, 0x8f4201b8, 0x00451024, | ||
1866 | 0x1440fffd, 0x24020001, 0xa4830008, 0x24030002, 0xac870000, 0xac800004, | ||
1867 | 0xa082000a, 0xa083000b, 0xa4860010, 0x8f430144, 0x3c021000, 0xac800028, | ||
1868 | 0xac830024, 0x03e00008, 0xaf4201b8, 0x3c058000, 0x8f4201b8, 0x00451024, | ||
1869 | 0x1440fffd, 0x24020002, 0xac800000, 0xac870004, 0xa4830008, 0xa082000a, | ||
1870 | 0xa082000b, 0xa4860010, 0xac800024, 0x8f420144, 0x3c031000, 0xac820028, | ||
1871 | 0x03e00008, 0xaf4301b8, 0x00061c02, 0x3c058000, 0x8f4201b8, 0x00451024, | ||
1872 | 0x1440fffd, 0x24020001, 0xa4830008, 0x24030002, 0xa082000a, 0x3c021000, | ||
1873 | 0xac870000, 0xac800004, 0xa083000b, 0xa4860010, 0xac800024, 0xac800028, | ||
1874 | 0x03e00008, 0xaf4201b8, 0x00a01821, 0x3c058000, 0x8f4201b8, 0x00451024, | ||
1875 | 0x1440fffd, 0x24020002, 0xac870000, 0xac800004, 0xa4830008, 0xa080000a, | ||
1876 | 0x0a00147e, 0xa082000b, 0x8f440144, 0x3c038000, 0x8f4201b8, 0x00431024, | ||
1877 | 0x1440fffd, 0x24020002, 0x240340c9, 0xaf470180, 0xa342018b, 0x3c021000, | ||
1878 | 0xa7430188, 0xaf4401a4, 0xaf4501a8, 0xaf4001ac, 0x03e00008, 0xaf4201b8, | ||
1879 | 0x0000000d, 0x03e00008, 0x00000000, 0x03e00008, 0x00000000, 0x8f420100, | ||
1880 | 0x3042003e, 0x14400011, 0x24020001, 0xaf400048, 0x8f420100, 0x304207c0, | ||
1881 | 0x10400005, 0x00000000, 0xaf40004c, 0xaf400050, 0x03e00008, 0x24020001, | ||
1882 | 0xaf400054, 0xaf400040, 0x8f420100, 0x30423800, 0x54400001, 0xaf400044, | ||
1883 | 0x24020001, 0x03e00008, 0x00000000, 0x3c038000, 0x8f4201b8, 0x00431024, | ||
1884 | 0x1440fffd, 0x24020002, 0x240340c9, 0xaf440180, 0xa342018b, 0x3c021000, | ||
1885 | 0xa7430188, 0xaf4501a4, 0xaf4601a8, 0xaf4701ac, 0x03e00008, 0xaf4201b8, | ||
1886 | 0x3c029000, 0x34420001, 0x00822025, 0xaf440020, 0x3c038000, 0x8f420020, | ||
1887 | 0x00431024, 0x1440fffd, 0x00000000, 0x03e00008, 0x00000000, 0x3c028000, | ||
1888 | 0x34420001, 0x00822025, 0x03e00008, 0xaf440020, 0x308600ff, 0x27450180, | ||
1889 | 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, 0x8f420128, | ||
1890 | 0xaca20000, 0x8f640040, 0x24030008, 0x240240c1, 0xa4a20008, 0x24020002, | ||
1891 | 0xa0a2000b, 0x3c021000, 0xa0a6000a, 0xa4a30010, 0xa0a00012, 0xa0a00013, | ||
1892 | 0xaca00014, 0xaca00024, 0xaca00028, 0xaca0002c, 0xaca40018, 0x03e00008, | ||
1893 | 0xaf4201b8, 0x24020001, 0xacc40000, 0x03e00008, 0xa4e50000, 0x03e00008, | ||
1894 | 0x24020001, 0x24020001, 0xaf400044, 0x03e00008, 0xaf400050, 0x00803021, | ||
1895 | 0x27450180, 0x3c038000, 0x8f4201b8, 0x00431024, 0x1440fffd, 0x00000000, | ||
1896 | 0x8f420128, 0xaca20000, 0x8cc30018, 0x240240c1, 0xa4a20008, 0xaca30018, | ||
1897 | 0x90c4000a, 0x24020002, 0xa0a2000b, 0xa0a4000a, 0x94c20010, 0xa4a20010, | ||
1898 | 0x90c30012, 0xa0a30012, 0x90c20013, 0xa0a20013, 0x8cc30014, 0xaca30014, | ||
1899 | 0x8cc20024, 0xaca20024, 0x8cc30028, 0xaca30028, 0x8cc2002c, 0x3c031000, | ||
1900 | 0xaca2002c, 0x24020001, 0xaf4301b8, 0xaf400044, 0x03e00008, 0xaf400050, | ||
1901 | 0x27bdffe8, 0xafbf0010, 0x0e001032, 0x00000000, 0x00002021, 0x0e000c99, | ||
1902 | 0xaf400180, 0x8fbf0010, 0x03e00008, 0x27bd0018, 0x8f460148, 0x27450180, | ||
1903 | 0x3c038000, 0x00061402, 0x304700ff, 0x8f4201b8, 0x00431024, 0x1440fffd, | ||
1904 | 0x00000000, 0x8f440140, 0x00061202, 0x304200ff, 0x00061c02, 0xaca20004, | ||
1905 | 0x24020002, 0xa4a30008, 0x30c300ff, 0xa0a2000b, 0xaca30024, 0x10e0000a, | ||
1906 | 0xaca40000, 0x28e20004, 0x14400005, 0x24020001, 0x24020005, 0x54e20005, | ||
1907 | 0xa0a0000a, 0x24020001, 0x0a001571, 0xa0a2000a, 0xa0a0000a, 0x3c021000, | ||
1908 | 0x03e00008, 0xaf4201b8, 0x03e00008, 0x00001021, 0x10c00007, 0x00000000, | ||
1909 | 0x8ca20000, 0x24c6ffff, 0x24a50004, 0xac820000, 0x14c0fffb, 0x24840004, | ||
1910 | 0x03e00008, 0x00000000, 0x0a001587, 0x00a01021, 0xac860000, 0x00000000, | ||
1911 | 0x00000000, 0x24840004, 0x00a01021, 0x1440fffa, 0x24a5ffff, 0x03e00008, | ||
1912 | 0x00000000, 0x00000000 }; | ||
1913 | 1938 | ||
1914 | static u32 bnx2_RXP_b06FwData[(0x0/4) + 1] = { 0x0 }; | 1939 | static u32 bnx2_RXP_b06FwData[(0x0/4) + 1] = { 0x0 }; |
1915 | static u32 bnx2_RXP_b06FwRodata[(0x0/4) + 1] = { 0x0 }; | 1940 | static u32 bnx2_RXP_b06FwRodata[(0x28/4) + 1] = { |
1916 | static u32 bnx2_RXP_b06FwBss[(0x1394/4) + 1] = { 0x0 }; | 1941 | 0x0800468c, 0x0800458c, 0x08004630, 0x08004648, 0x08004660, 0x08004680, |
1917 | static u32 bnx2_RXP_b06FwSbss[(0x18/4) + 1] = { 0x0 }; | 1942 | 0x0800468c, 0x0800468c, 0x08004594, 0x00000000, 0x00000000 }; |
1943 | static u32 bnx2_RXP_b06FwBss[(0x13a4/4) + 1] = { 0x0 }; | ||
1944 | static u32 bnx2_RXP_b06FwSbss[(0x1c/4) + 1] = { 0x0 }; | ||
1918 | 1945 | ||
1919 | static u32 bnx2_rv2p_proc1[] = { | 1946 | static u32 bnx2_rv2p_proc1[] = { |
1920 | 0x00000008, 0xac000001, 0x0000000c, 0x2f800001, 0x00000010, 0x213f0004, | 1947 | 0x00000008, 0xac000001, 0x0000000c, 0x2f800001, 0x00000010, 0x213f0004, |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 2582d98ef5c3..4ff006c37626 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -576,7 +576,7 @@ static int bond_update_speed_duplex(struct slave *slave) | |||
576 | slave->duplex = DUPLEX_FULL; | 576 | slave->duplex = DUPLEX_FULL; |
577 | 577 | ||
578 | if (slave_dev->ethtool_ops) { | 578 | if (slave_dev->ethtool_ops) { |
579 | u32 res; | 579 | int res; |
580 | 580 | ||
581 | if (!slave_dev->ethtool_ops->get_settings) { | 581 | if (!slave_dev->ethtool_ops->get_settings) { |
582 | return -1; | 582 | return -1; |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 40ae36b20c9d..7ef4b0434a3f 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -444,6 +444,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) | |||
444 | netif_rx(skb); | 444 | netif_rx(skb); |
445 | #endif | 445 | #endif |
446 | } | 446 | } |
447 | dev->last_rx = jiffies; | ||
447 | } | 448 | } |
448 | 449 | ||
449 | return received_packets; | 450 | return received_packets; |
@@ -461,7 +462,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) | |||
461 | */ | 462 | */ |
462 | 463 | ||
463 | static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id, | 464 | static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id, |
464 | struct pt_regs *regs) | 465 | struct pt_regs *regs) |
465 | { | 466 | { |
466 | struct net_device *dev = (struct net_device *)dev_id; | 467 | struct net_device *dev = (struct net_device *)dev_id; |
467 | struct mv643xx_private *mp = netdev_priv(dev); | 468 | struct mv643xx_private *mp = netdev_priv(dev); |
@@ -1047,16 +1048,15 @@ static int mv643xx_poll(struct net_device *dev, int *budget) | |||
1047 | 1048 | ||
1048 | static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb) | 1049 | static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb) |
1049 | { | 1050 | { |
1050 | unsigned int frag; | 1051 | unsigned int frag; |
1051 | skb_frag_t *fragp; | 1052 | skb_frag_t *fragp; |
1052 | 1053 | ||
1053 | for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { | 1054 | for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { |
1054 | fragp = &skb_shinfo(skb)->frags[frag]; | 1055 | fragp = &skb_shinfo(skb)->frags[frag]; |
1055 | if (fragp->size <= 8 && fragp->page_offset & 0x7) | 1056 | if (fragp->size <= 8 && fragp->page_offset & 0x7) |
1056 | return 1; | 1057 | return 1; |
1057 | 1058 | } | |
1058 | } | 1059 | return 0; |
1059 | return 0; | ||
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | 1062 | ||
@@ -2137,26 +2137,26 @@ static void eth_port_set_multicast_list(struct net_device *dev) | |||
2137 | */ | 2137 | */ |
2138 | if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI)) { | 2138 | if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI)) { |
2139 | for (table_index = 0; table_index <= 0xFC; table_index += 4) { | 2139 | for (table_index = 0; table_index <= 0xFC; table_index += 4) { |
2140 | /* Set all entries in DA filter special multicast | 2140 | /* Set all entries in DA filter special multicast |
2141 | * table (Ex_dFSMT) | 2141 | * table (Ex_dFSMT) |
2142 | * Set for ETH_Q0 for now | 2142 | * Set for ETH_Q0 for now |
2143 | * Bits | 2143 | * Bits |
2144 | * 0 Accept=1, Drop=0 | 2144 | * 0 Accept=1, Drop=0 |
2145 | * 3-1 Queue ETH_Q0=0 | 2145 | * 3-1 Queue ETH_Q0=0 |
2146 | * 7-4 Reserved = 0; | 2146 | * 7-4 Reserved = 0; |
2147 | */ | 2147 | */ |
2148 | mv_write(MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); | 2148 | mv_write(MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); |
2149 | 2149 | ||
2150 | /* Set all entries in DA filter other multicast | 2150 | /* Set all entries in DA filter other multicast |
2151 | * table (Ex_dFOMT) | 2151 | * table (Ex_dFOMT) |
2152 | * Set for ETH_Q0 for now | 2152 | * Set for ETH_Q0 for now |
2153 | * Bits | 2153 | * Bits |
2154 | * 0 Accept=1, Drop=0 | 2154 | * 0 Accept=1, Drop=0 |
2155 | * 3-1 Queue ETH_Q0=0 | 2155 | * 3-1 Queue ETH_Q0=0 |
2156 | * 7-4 Reserved = 0; | 2156 | * 7-4 Reserved = 0; |
2157 | */ | 2157 | */ |
2158 | mv_write(MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); | 2158 | mv_write(MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); |
2159 | } | 2159 | } |
2160 | return; | 2160 | return; |
2161 | } | 2161 | } |
2162 | 2162 | ||
@@ -2617,7 +2617,6 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2617 | struct eth_tx_desc *current_descriptor; | 2617 | struct eth_tx_desc *current_descriptor; |
2618 | struct eth_tx_desc *first_descriptor; | 2618 | struct eth_tx_desc *first_descriptor; |
2619 | u32 command; | 2619 | u32 command; |
2620 | unsigned long flags; | ||
2621 | 2620 | ||
2622 | /* Do not process Tx ring in case of Tx ring resource error */ | 2621 | /* Do not process Tx ring in case of Tx ring resource error */ |
2623 | if (mp->tx_resource_err) | 2622 | if (mp->tx_resource_err) |
@@ -2634,8 +2633,6 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2634 | return ETH_ERROR; | 2633 | return ETH_ERROR; |
2635 | } | 2634 | } |
2636 | 2635 | ||
2637 | spin_lock_irqsave(&mp->lock, flags); | ||
2638 | |||
2639 | mp->tx_ring_skbs++; | 2636 | mp->tx_ring_skbs++; |
2640 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); | 2637 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); |
2641 | 2638 | ||
@@ -2685,15 +2682,11 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2685 | mp->tx_resource_err = 1; | 2682 | mp->tx_resource_err = 1; |
2686 | mp->tx_curr_desc_q = tx_first_desc; | 2683 | mp->tx_curr_desc_q = tx_first_desc; |
2687 | 2684 | ||
2688 | spin_unlock_irqrestore(&mp->lock, flags); | ||
2689 | |||
2690 | return ETH_QUEUE_LAST_RESOURCE; | 2685 | return ETH_QUEUE_LAST_RESOURCE; |
2691 | } | 2686 | } |
2692 | 2687 | ||
2693 | mp->tx_curr_desc_q = tx_next_desc; | 2688 | mp->tx_curr_desc_q = tx_next_desc; |
2694 | 2689 | ||
2695 | spin_unlock_irqrestore(&mp->lock, flags); | ||
2696 | |||
2697 | return ETH_OK; | 2690 | return ETH_OK; |
2698 | } | 2691 | } |
2699 | #else | 2692 | #else |
@@ -2704,14 +2697,11 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2704 | int tx_desc_used; | 2697 | int tx_desc_used; |
2705 | struct eth_tx_desc *current_descriptor; | 2698 | struct eth_tx_desc *current_descriptor; |
2706 | unsigned int command_status; | 2699 | unsigned int command_status; |
2707 | unsigned long flags; | ||
2708 | 2700 | ||
2709 | /* Do not process Tx ring in case of Tx ring resource error */ | 2701 | /* Do not process Tx ring in case of Tx ring resource error */ |
2710 | if (mp->tx_resource_err) | 2702 | if (mp->tx_resource_err) |
2711 | return ETH_QUEUE_FULL; | 2703 | return ETH_QUEUE_FULL; |
2712 | 2704 | ||
2713 | spin_lock_irqsave(&mp->lock, flags); | ||
2714 | |||
2715 | mp->tx_ring_skbs++; | 2705 | mp->tx_ring_skbs++; |
2716 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); | 2706 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); |
2717 | 2707 | ||
@@ -2742,12 +2732,9 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
2742 | /* Check for ring index overlap in the Tx desc ring */ | 2732 | /* Check for ring index overlap in the Tx desc ring */ |
2743 | if (tx_desc_curr == tx_desc_used) { | 2733 | if (tx_desc_curr == tx_desc_used) { |
2744 | mp->tx_resource_err = 1; | 2734 | mp->tx_resource_err = 1; |
2745 | |||
2746 | spin_unlock_irqrestore(&mp->lock, flags); | ||
2747 | return ETH_QUEUE_LAST_RESOURCE; | 2735 | return ETH_QUEUE_LAST_RESOURCE; |
2748 | } | 2736 | } |
2749 | 2737 | ||
2750 | spin_unlock_irqrestore(&mp->lock, flags); | ||
2751 | return ETH_OK; | 2738 | return ETH_OK; |
2752 | } | 2739 | } |
2753 | #endif | 2740 | #endif |
@@ -2898,8 +2885,10 @@ static ETH_FUNC_RET_STATUS eth_port_receive(struct mv643xx_private *mp, | |||
2898 | p_pkt_info->return_info = mp->rx_skb[rx_curr_desc]; | 2885 | p_pkt_info->return_info = mp->rx_skb[rx_curr_desc]; |
2899 | p_pkt_info->l4i_chk = p_rx_desc->buf_size; | 2886 | p_pkt_info->l4i_chk = p_rx_desc->buf_size; |
2900 | 2887 | ||
2901 | /* Clean the return info field to indicate that the packet has been */ | 2888 | /* |
2902 | /* moved to the upper layers */ | 2889 | * Clean the return info field to indicate that the |
2890 | * packet has been moved to the upper layers | ||
2891 | */ | ||
2903 | mp->rx_skb[rx_curr_desc] = NULL; | 2892 | mp->rx_skb[rx_curr_desc] = NULL; |
2904 | 2893 | ||
2905 | /* Update current index in data structure */ | 2894 | /* Update current index in data structure */ |
@@ -2980,7 +2969,7 @@ struct mv643xx_stats { | |||
2980 | }; | 2969 | }; |
2981 | 2970 | ||
2982 | #define MV643XX_STAT(m) sizeof(((struct mv643xx_private *)0)->m), \ | 2971 | #define MV643XX_STAT(m) sizeof(((struct mv643xx_private *)0)->m), \ |
2983 | offsetof(struct mv643xx_private, m) | 2972 | offsetof(struct mv643xx_private, m) |
2984 | 2973 | ||
2985 | static const struct mv643xx_stats mv643xx_gstrings_stats[] = { | 2974 | static const struct mv643xx_stats mv643xx_gstrings_stats[] = { |
2986 | { "rx_packets", MV643XX_STAT(stats.rx_packets) }, | 2975 | { "rx_packets", MV643XX_STAT(stats.rx_packets) }, |
@@ -3131,9 +3120,8 @@ mv643xx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
3131 | return 0; | 3120 | return 0; |
3132 | } | 3121 | } |
3133 | 3122 | ||
3134 | static void | 3123 | static void mv643xx_get_drvinfo(struct net_device *netdev, |
3135 | mv643xx_get_drvinfo(struct net_device *netdev, | 3124 | struct ethtool_drvinfo *drvinfo) |
3136 | struct ethtool_drvinfo *drvinfo) | ||
3137 | { | 3125 | { |
3138 | strncpy(drvinfo->driver, mv643xx_driver_name, 32); | 3126 | strncpy(drvinfo->driver, mv643xx_driver_name, 32); |
3139 | strncpy(drvinfo->version, mv643xx_driver_version, 32); | 3127 | strncpy(drvinfo->version, mv643xx_driver_version, 32); |
@@ -3142,39 +3130,37 @@ mv643xx_get_drvinfo(struct net_device *netdev, | |||
3142 | drvinfo->n_stats = MV643XX_STATS_LEN; | 3130 | drvinfo->n_stats = MV643XX_STATS_LEN; |
3143 | } | 3131 | } |
3144 | 3132 | ||
3145 | static int | 3133 | static int mv643xx_get_stats_count(struct net_device *netdev) |
3146 | mv643xx_get_stats_count(struct net_device *netdev) | ||
3147 | { | 3134 | { |
3148 | return MV643XX_STATS_LEN; | 3135 | return MV643XX_STATS_LEN; |
3149 | } | 3136 | } |
3150 | 3137 | ||
3151 | static void | 3138 | static void mv643xx_get_ethtool_stats(struct net_device *netdev, |
3152 | mv643xx_get_ethtool_stats(struct net_device *netdev, | 3139 | struct ethtool_stats *stats, uint64_t *data) |
3153 | struct ethtool_stats *stats, uint64_t *data) | ||
3154 | { | 3140 | { |
3155 | struct mv643xx_private *mp = netdev->priv; | 3141 | struct mv643xx_private *mp = netdev->priv; |
3156 | int i; | 3142 | int i; |
3157 | 3143 | ||
3158 | eth_update_mib_counters(mp); | 3144 | eth_update_mib_counters(mp); |
3159 | 3145 | ||
3160 | for(i = 0; i < MV643XX_STATS_LEN; i++) { | 3146 | for (i = 0; i < MV643XX_STATS_LEN; i++) { |
3161 | char *p = (char *)mp+mv643xx_gstrings_stats[i].stat_offset; | 3147 | char *p = (char *)mp+mv643xx_gstrings_stats[i].stat_offset; |
3162 | data[i] = (mv643xx_gstrings_stats[i].sizeof_stat == | 3148 | data[i] = (mv643xx_gstrings_stats[i].sizeof_stat == |
3163 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; | 3149 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; |
3164 | } | 3150 | } |
3165 | } | 3151 | } |
3166 | 3152 | ||
3167 | static void | 3153 | static void mv643xx_get_strings(struct net_device *netdev, uint32_t stringset, |
3168 | mv643xx_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) | 3154 | uint8_t *data) |
3169 | { | 3155 | { |
3170 | int i; | 3156 | int i; |
3171 | 3157 | ||
3172 | switch(stringset) { | 3158 | switch(stringset) { |
3173 | case ETH_SS_STATS: | 3159 | case ETH_SS_STATS: |
3174 | for (i=0; i < MV643XX_STATS_LEN; i++) { | 3160 | for (i=0; i < MV643XX_STATS_LEN; i++) { |
3175 | memcpy(data + i * ETH_GSTRING_LEN, | 3161 | memcpy(data + i * ETH_GSTRING_LEN, |
3176 | mv643xx_gstrings_stats[i].stat_string, | 3162 | mv643xx_gstrings_stats[i].stat_string, |
3177 | ETH_GSTRING_LEN); | 3163 | ETH_GSTRING_LEN); |
3178 | } | 3164 | } |
3179 | break; | 3165 | break; |
3180 | } | 3166 | } |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 89c46787676c..49b597cbc19a 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -3586,7 +3586,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
3586 | txdp->Buffer_Pointer = (u64) pci_map_page | 3586 | txdp->Buffer_Pointer = (u64) pci_map_page |
3587 | (sp->pdev, frag->page, frag->page_offset, | 3587 | (sp->pdev, frag->page, frag->page_offset, |
3588 | frag->size, PCI_DMA_TODEVICE); | 3588 | frag->size, PCI_DMA_TODEVICE); |
3589 | txdp->Control_1 |= TXD_BUFFER0_SIZE(frag->size); | 3589 | txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size); |
3590 | if (skb_shinfo(skb)->ufo_size) | 3590 | if (skb_shinfo(skb)->ufo_size) |
3591 | txdp->Control_1 |= TXD_UFO_EN; | 3591 | txdp->Control_1 |= TXD_UFO_EN; |
3592 | } | 3592 | } |
diff --git a/drivers/net/wireless/hostap/Kconfig b/drivers/net/wireless/hostap/Kconfig index c8f6286dd35f..308f773ad566 100644 --- a/drivers/net/wireless/hostap/Kconfig +++ b/drivers/net/wireless/hostap/Kconfig | |||
@@ -75,7 +75,7 @@ config HOSTAP_PCI | |||
75 | 75 | ||
76 | config HOSTAP_CS | 76 | config HOSTAP_CS |
77 | tristate "Host AP driver for Prism2/2.5/3 PC Cards" | 77 | tristate "Host AP driver for Prism2/2.5/3 PC Cards" |
78 | depends on PCMCIA!=n && HOSTAP | 78 | depends on PCMCIA && HOSTAP |
79 | ---help--- | 79 | ---help--- |
80 | Host AP driver's version for Prism2/2.5/3 PC Cards. | 80 | Host AP driver's version for Prism2/2.5/3 PC Cards. |
81 | 81 | ||
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index 8bf02763b5c7..6290c9f7e939 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c | |||
@@ -2201,6 +2201,17 @@ static int ipw2100_alloc_skb(struct ipw2100_priv *priv, | |||
2201 | #define SEARCH_SNAPSHOT 1 | 2201 | #define SEARCH_SNAPSHOT 1 |
2202 | 2202 | ||
2203 | #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) | 2203 | #define SNAPSHOT_ADDR(ofs) (priv->snapshot[((ofs) >> 12) & 0xff] + ((ofs) & 0xfff)) |
2204 | static void ipw2100_snapshot_free(struct ipw2100_priv *priv) | ||
2205 | { | ||
2206 | int i; | ||
2207 | if (!priv->snapshot[0]) | ||
2208 | return; | ||
2209 | for (i = 0; i < 0x30; i++) | ||
2210 | kfree(priv->snapshot[i]); | ||
2211 | priv->snapshot[0] = NULL; | ||
2212 | } | ||
2213 | |||
2214 | #ifdef CONFIG_IPW2100_DEBUG_C3 | ||
2204 | static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) | 2215 | static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) |
2205 | { | 2216 | { |
2206 | int i; | 2217 | int i; |
@@ -2221,16 +2232,6 @@ static int ipw2100_snapshot_alloc(struct ipw2100_priv *priv) | |||
2221 | return 1; | 2232 | return 1; |
2222 | } | 2233 | } |
2223 | 2234 | ||
2224 | static void ipw2100_snapshot_free(struct ipw2100_priv *priv) | ||
2225 | { | ||
2226 | int i; | ||
2227 | if (!priv->snapshot[0]) | ||
2228 | return; | ||
2229 | for (i = 0; i < 0x30; i++) | ||
2230 | kfree(priv->snapshot[i]); | ||
2231 | priv->snapshot[0] = NULL; | ||
2232 | } | ||
2233 | |||
2234 | static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, | 2235 | static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, |
2235 | size_t len, int mode) | 2236 | size_t len, int mode) |
2236 | { | 2237 | { |
@@ -2269,6 +2270,7 @@ static u32 ipw2100_match_buf(struct ipw2100_priv *priv, u8 * in_buf, | |||
2269 | 2270 | ||
2270 | return ret; | 2271 | return ret; |
2271 | } | 2272 | } |
2273 | #endif | ||
2272 | 2274 | ||
2273 | /* | 2275 | /* |
2274 | * | 2276 | * |
@@ -7112,11 +7114,17 @@ static int ipw2100_wx_set_txpow(struct net_device *dev, | |||
7112 | { | 7114 | { |
7113 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7115 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7114 | int err = 0, value; | 7116 | int err = 0, value; |
7117 | |||
7118 | if (ipw_radio_kill_sw(priv, wrqu->txpower.disabled)) | ||
7119 | return -EINPROGRESS; | ||
7115 | 7120 | ||
7116 | if (priv->ieee->iw_mode != IW_MODE_ADHOC) | 7121 | if (priv->ieee->iw_mode != IW_MODE_ADHOC) |
7122 | return 0; | ||
7123 | |||
7124 | if ((wrqu->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) | ||
7117 | return -EINVAL; | 7125 | return -EINVAL; |
7118 | 7126 | ||
7119 | if (wrqu->txpower.disabled == 1 || wrqu->txpower.fixed == 0) | 7127 | if (wrqu->txpower.fixed == 0) |
7120 | value = IPW_TX_POWER_DEFAULT; | 7128 | value = IPW_TX_POWER_DEFAULT; |
7121 | else { | 7129 | else { |
7122 | if (wrqu->txpower.value < IPW_TX_POWER_MIN_DBM || | 7130 | if (wrqu->txpower.value < IPW_TX_POWER_MIN_DBM || |
@@ -7151,24 +7159,19 @@ static int ipw2100_wx_get_txpow(struct net_device *dev, | |||
7151 | 7159 | ||
7152 | struct ipw2100_priv *priv = ieee80211_priv(dev); | 7160 | struct ipw2100_priv *priv = ieee80211_priv(dev); |
7153 | 7161 | ||
7154 | if (priv->ieee->iw_mode != IW_MODE_ADHOC) { | 7162 | wrqu->txpower.disabled = (priv->status & STATUS_RF_KILL_MASK) ? 1 : 0; |
7155 | wrqu->power.disabled = 1; | ||
7156 | return 0; | ||
7157 | } | ||
7158 | 7163 | ||
7159 | if (priv->tx_power == IPW_TX_POWER_DEFAULT) { | 7164 | if (priv->tx_power == IPW_TX_POWER_DEFAULT) { |
7160 | wrqu->power.fixed = 0; | 7165 | wrqu->txpower.fixed = 0; |
7161 | wrqu->power.value = IPW_TX_POWER_MAX_DBM; | 7166 | wrqu->txpower.value = IPW_TX_POWER_MAX_DBM; |
7162 | wrqu->power.disabled = 1; | ||
7163 | } else { | 7167 | } else { |
7164 | wrqu->power.disabled = 0; | 7168 | wrqu->txpower.fixed = 1; |
7165 | wrqu->power.fixed = 1; | 7169 | wrqu->txpower.value = priv->tx_power; |
7166 | wrqu->power.value = priv->tx_power; | ||
7167 | } | 7170 | } |
7168 | 7171 | ||
7169 | wrqu->power.flags = IW_TXPOW_DBM; | 7172 | wrqu->txpower.flags = IW_TXPOW_DBM; |
7170 | 7173 | ||
7171 | IPW_DEBUG_WX("GET TX Power -> %d \n", wrqu->power.value); | 7174 | IPW_DEBUG_WX("GET TX Power -> %d \n", wrqu->txpower.value); |
7172 | 7175 | ||
7173 | return 0; | 7176 | return 0; |
7174 | } | 7177 | } |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 4c28e332ecc3..916b24c544e2 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -8012,6 +8012,10 @@ static int ipw_sw_reset(struct ipw_priv *priv, int init) | |||
8012 | else | 8012 | else |
8013 | IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); | 8013 | IPW_DEBUG_INFO("Auto adhoc creation disabled.\n"); |
8014 | 8014 | ||
8015 | priv->config &= ~CFG_STATIC_ESSID; | ||
8016 | priv->essid_len = 0; | ||
8017 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); | ||
8018 | |||
8015 | if (disable) { | 8019 | if (disable) { |
8016 | priv->status |= STATUS_RF_KILL_SW; | 8020 | priv->status |= STATUS_RF_KILL_SW; |
8017 | IPW_DEBUG_INFO("Radio disabled.\n"); | 8021 | IPW_DEBUG_INFO("Radio disabled.\n"); |
@@ -11035,7 +11039,6 @@ static int ipw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
11035 | net_dev->set_multicast_list = ipw_net_set_multicast_list; | 11039 | net_dev->set_multicast_list = ipw_net_set_multicast_list; |
11036 | net_dev->set_mac_address = ipw_net_set_mac_address; | 11040 | net_dev->set_mac_address = ipw_net_set_mac_address; |
11037 | priv->wireless_data.spy_data = &priv->ieee->spy_data; | 11041 | priv->wireless_data.spy_data = &priv->ieee->spy_data; |
11038 | priv->wireless_data.ieee80211 = priv->ieee; | ||
11039 | net_dev->wireless_data = &priv->wireless_data; | 11042 | net_dev->wireless_data = &priv->wireless_data; |
11040 | net_dev->wireless_handlers = &ipw_wx_handler_def; | 11043 | net_dev->wireless_handlers = &ipw_wx_handler_def; |
11041 | net_dev->ethtool_ops = &ipw_ethtool_ops; | 11044 | net_dev->ethtool_ops = &ipw_ethtool_ops; |
@@ -11121,8 +11124,8 @@ static void ipw_pci_remove(struct pci_dev *pdev) | |||
11121 | /* Free MAC hash list for ADHOC */ | 11124 | /* Free MAC hash list for ADHOC */ |
11122 | for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) { | 11125 | for (i = 0; i < IPW_IBSS_MAC_HASH_SIZE; i++) { |
11123 | list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { | 11126 | list_for_each_safe(p, q, &priv->ibss_mac_hash[i]) { |
11124 | kfree(list_entry(p, struct ipw_ibss_seq, list)); | ||
11125 | list_del(p); | 11127 | list_del(p); |
11128 | kfree(list_entry(p, struct ipw_ibss_seq, list)); | ||
11126 | } | 11129 | } |
11127 | } | 11130 | } |
11128 | 11131 | ||
diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index b664708481cc..3c128b692bce 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c | |||
@@ -261,13 +261,13 @@ orinoco_cs_config(dev_link_t *link) | |||
261 | /* Note that the CIS values need to be rescaled */ | 261 | /* Note that the CIS values need to be rescaled */ |
262 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 262 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
263 | if (conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { | 263 | if (conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { |
264 | DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, CIS = %d)\n", conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); | 264 | DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, cfg CIS = %d)\n", conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); |
265 | if (!ignore_cis_vcc) | 265 | if (!ignore_cis_vcc) |
266 | goto next_entry; | 266 | goto next_entry; |
267 | } | 267 | } |
268 | } else if (dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { | 268 | } else if (dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { |
269 | if (conf.Vcc != dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) { | 269 | if (conf.Vcc != dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) { |
270 | DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, CIS = %d)\n", conf.Vcc, dflt.vcc.param[CISTPL_POWER_VNOM] / 10000); | 270 | DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, dflt CIS = %d)\n", conf.Vcc, dflt.vcc.param[CISTPL_POWER_VNOM] / 10000); |
271 | if(!ignore_cis_vcc) | 271 | if(!ignore_cis_vcc) |
272 | goto next_entry; | 272 | goto next_entry; |
273 | } | 273 | } |
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig index 2f1289eebb3c..222a1cc4aa28 100644 --- a/drivers/pci/hotplug/Kconfig +++ b/drivers/pci/hotplug/Kconfig | |||
@@ -11,8 +11,7 @@ config HOTPLUG_PCI | |||
11 | ---help--- | 11 | ---help--- |
12 | Say Y here if you have a motherboard with a PCI Hotplug controller. | 12 | Say Y here if you have a motherboard with a PCI Hotplug controller. |
13 | This allows you to add and remove PCI cards while the machine is | 13 | This allows you to add and remove PCI cards while the machine is |
14 | powered up and running. The file system pcihpfs must be mounted | 14 | powered up and running. |
15 | in order to interact with any PCI Hotplug controllers. | ||
16 | 15 | ||
17 | To compile this driver as a module, choose M here: the | 16 | To compile this driver as a module, choose M here: the |
18 | module will be called pci_hotplug. | 17 | module will be called pci_hotplug. |
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index 7e7f913ba7b9..317457dd4014 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -302,7 +302,7 @@ static int ibm_get_table_from_acpi(char **bufp) | |||
302 | } | 302 | } |
303 | 303 | ||
304 | package = (union acpi_object *) buffer.pointer; | 304 | package = (union acpi_object *) buffer.pointer; |
305 | if(!(package) || | 305 | if (!(package) || |
306 | (package->type != ACPI_TYPE_PACKAGE) || | 306 | (package->type != ACPI_TYPE_PACKAGE) || |
307 | !(package->package.elements)) { | 307 | !(package->package.elements)) { |
308 | err("%s: Invalid APCI object\n", __FUNCTION__); | 308 | err("%s: Invalid APCI object\n", __FUNCTION__); |
@@ -405,7 +405,7 @@ static acpi_status __init ibm_find_acpi_device(acpi_handle handle, | |||
405 | } | 405 | } |
406 | info.hardware_id.value[sizeof(info.hardware_id.value) - 1] = '\0'; | 406 | info.hardware_id.value[sizeof(info.hardware_id.value) - 1] = '\0'; |
407 | 407 | ||
408 | if(info.current_status && (info.valid & ACPI_VALID_HID) && | 408 | if (info.current_status && (info.valid & ACPI_VALID_HID) && |
409 | (!strcmp(info.hardware_id.value, IBM_HARDWARE_ID1) || | 409 | (!strcmp(info.hardware_id.value, IBM_HARDWARE_ID1) || |
410 | !strcmp(info.hardware_id.value, IBM_HARDWARE_ID2))) { | 410 | !strcmp(info.hardware_id.value, IBM_HARDWARE_ID2))) { |
411 | dbg("found hardware: %s, handle: %p\n", info.hardware_id.value, | 411 | dbg("found hardware: %s, handle: %p\n", info.hardware_id.value, |
@@ -449,13 +449,11 @@ static int __init ibm_acpiphp_init(void) | |||
449 | } | 449 | } |
450 | 450 | ||
451 | ibm_note.device = device; | 451 | ibm_note.device = device; |
452 | status = acpi_install_notify_handler( | 452 | status = acpi_install_notify_handler(ibm_acpi_handle, |
453 | ibm_acpi_handle, | 453 | ACPI_DEVICE_NOTIFY, ibm_handle_events, |
454 | ACPI_DEVICE_NOTIFY, | ||
455 | ibm_handle_events, | ||
456 | &ibm_note); | 454 | &ibm_note); |
457 | if (ACPI_FAILURE(status)) { | 455 | if (ACPI_FAILURE(status)) { |
458 | err("%s: Failed to register notification handler\n", | 456 | err("%s: Failed to register notification handler\n", |
459 | __FUNCTION__); | 457 | __FUNCTION__); |
460 | retval = -EBUSY; | 458 | retval = -EBUSY; |
461 | goto init_cleanup; | 459 | goto init_cleanup; |
@@ -482,14 +480,13 @@ static void __exit ibm_acpiphp_exit(void) | |||
482 | if (acpiphp_unregister_attention(&ibm_attention_info)) | 480 | if (acpiphp_unregister_attention(&ibm_attention_info)) |
483 | err("%s: attention info deregistration failed", __FUNCTION__); | 481 | err("%s: attention info deregistration failed", __FUNCTION__); |
484 | 482 | ||
485 | status = acpi_remove_notify_handler( | 483 | status = acpi_remove_notify_handler( |
486 | ibm_acpi_handle, | 484 | ibm_acpi_handle, |
487 | ACPI_DEVICE_NOTIFY, | 485 | ACPI_DEVICE_NOTIFY, |
488 | ibm_handle_events); | 486 | ibm_handle_events); |
489 | if (ACPI_FAILURE(status)) | 487 | if (ACPI_FAILURE(status)) |
490 | err("%s: Notification handler removal failed\n", | 488 | err("%s: Notification handler removal failed\n", __FUNCTION__); |
491 | __FUNCTION__); | 489 | /* remove the /sys entries */ |
492 | // remove the /sys entries | ||
493 | if (sysfs_remove_bin_file(sysdir, &ibm_apci_table_attr)) | 490 | if (sysfs_remove_bin_file(sysdir, &ibm_apci_table_attr)) |
494 | err("%s: removal of sysfs file apci_table failed\n", | 491 | err("%s: removal of sysfs file apci_table failed\n", |
495 | __FUNCTION__); | 492 | __FUNCTION__); |
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index aabf1e70b528..dc59da675c08 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c | |||
@@ -235,12 +235,12 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) | |||
235 | { | 235 | { |
236 | int rc = 0; | 236 | int rc = 0; |
237 | struct slot *pslot; | 237 | struct slot *pslot; |
238 | u8 cmd; | 238 | u8 cmd = 0x00; /* avoid compiler warning */ |
239 | 239 | ||
240 | debug("set_attention_status - Entry hotplug_slot[%lx] value[%x]\n", | 240 | debug("set_attention_status - Entry hotplug_slot[%lx] value[%x]\n", |
241 | (ulong) hotplug_slot, value); | 241 | (ulong) hotplug_slot, value); |
242 | ibmphp_lock_operations(); | 242 | ibmphp_lock_operations(); |
243 | cmd = 0x00; // avoid compiler warning | 243 | |
244 | 244 | ||
245 | if (hotplug_slot) { | 245 | if (hotplug_slot) { |
246 | switch (value) { | 246 | switch (value) { |
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index 7d93dbaf628d..3eefe2cec72d 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c | |||
@@ -103,13 +103,13 @@ static struct slot *find_slot(struct device_node *dn) | |||
103 | struct list_head *tmp, *n; | 103 | struct list_head *tmp, *n; |
104 | struct slot *slot; | 104 | struct slot *slot; |
105 | 105 | ||
106 | list_for_each_safe(tmp, n, &rpaphp_slot_head) { | 106 | list_for_each_safe(tmp, n, &rpaphp_slot_head) { |
107 | slot = list_entry(tmp, struct slot, rpaphp_slot_list); | 107 | slot = list_entry(tmp, struct slot, rpaphp_slot_list); |
108 | if (slot->dn == dn) | 108 | if (slot->dn == dn) |
109 | return slot; | 109 | return slot; |
110 | } | 110 | } |
111 | 111 | ||
112 | return NULL; | 112 | return NULL; |
113 | } | 113 | } |
114 | 114 | ||
115 | static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent, | 115 | static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent, |
@@ -126,9 +126,9 @@ static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent, | |||
126 | return NULL; | 126 | return NULL; |
127 | } | 127 | } |
128 | 128 | ||
129 | static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) | 129 | static void dlpar_pci_add_bus(struct device_node *dn) |
130 | { | 130 | { |
131 | struct pci_dn *pdn = dn->data; | 131 | struct pci_dn *pdn = PCI_DN(dn); |
132 | struct pci_controller *phb = pdn->phb; | 132 | struct pci_controller *phb = pdn->phb; |
133 | struct pci_dev *dev = NULL; | 133 | struct pci_dev *dev = NULL; |
134 | 134 | ||
@@ -139,52 +139,52 @@ static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn) | |||
139 | if (!dev) { | 139 | if (!dev) { |
140 | printk(KERN_ERR "%s: failed to create pci dev for %s\n", | 140 | printk(KERN_ERR "%s: failed to create pci dev for %s\n", |
141 | __FUNCTION__, dn->full_name); | 141 | __FUNCTION__, dn->full_name); |
142 | return NULL; | 142 | return; |
143 | } | 143 | } |
144 | 144 | ||
145 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || | 145 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || |
146 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) | 146 | dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) |
147 | of_scan_pci_bridge(dn, dev); | 147 | of_scan_pci_bridge(dn, dev); |
148 | 148 | ||
149 | rpaphp_init_new_devs(dev->subordinate); | 149 | pcibios_fixup_new_pci_devices(dev->subordinate,0); |
150 | 150 | ||
151 | /* Claim new bus resources */ | 151 | /* Claim new bus resources */ |
152 | pcibios_claim_one_bus(dev->bus); | 152 | pcibios_claim_one_bus(dev->bus); |
153 | 153 | ||
154 | /* ioremap() for child bus, which may or may not succeed */ | 154 | /* ioremap() for child bus, which may or may not succeed */ |
155 | (void) remap_bus_range(dev->bus); | 155 | remap_bus_range(dev->subordinate); |
156 | 156 | ||
157 | /* Add new devices to global lists. Register in proc, sysfs. */ | 157 | /* Add new devices to global lists. Register in proc, sysfs. */ |
158 | pci_bus_add_devices(phb->bus); | 158 | pci_bus_add_devices(phb->bus); |
159 | |||
160 | /* Confirm new bridge dev was created */ | ||
161 | dev = dlpar_find_new_dev(phb->bus, dn); | ||
162 | if (dev) { | ||
163 | if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { | ||
164 | printk(KERN_ERR "%s: unexpected header type %d\n", | ||
165 | __FUNCTION__, dev->hdr_type); | ||
166 | return NULL; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | return dev; | ||
171 | } | 159 | } |
172 | 160 | ||
173 | static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn) | 161 | static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn) |
174 | { | 162 | { |
175 | struct pci_dev *dev; | 163 | struct pci_dev *dev; |
164 | struct pci_controller *phb; | ||
176 | 165 | ||
177 | if (rpaphp_find_pci_bus(dn)) | 166 | if (pcibios_find_pci_bus(dn)) |
178 | return -EINVAL; | 167 | return -EINVAL; |
179 | 168 | ||
180 | /* Add pci bus */ | 169 | /* Add pci bus */ |
181 | dev = dlpar_pci_add_bus(dn); | 170 | dlpar_pci_add_bus(dn); |
171 | |||
172 | /* Confirm new bridge dev was created */ | ||
173 | phb = PCI_DN(dn)->phb; | ||
174 | dev = dlpar_find_new_dev(phb->bus, dn); | ||
175 | |||
182 | if (!dev) { | 176 | if (!dev) { |
183 | printk(KERN_ERR "%s: unable to add bus %s\n", __FUNCTION__, | 177 | printk(KERN_ERR "%s: unable to add bus %s\n", __FUNCTION__, |
184 | drc_name); | 178 | drc_name); |
185 | return -EIO; | 179 | return -EIO; |
186 | } | 180 | } |
187 | 181 | ||
182 | if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) { | ||
183 | printk(KERN_ERR "%s: unexpected header type %d, unable to add bus %s\n", | ||
184 | __FUNCTION__, dev->hdr_type, drc_name); | ||
185 | return -EIO; | ||
186 | } | ||
187 | |||
188 | /* Add hotplug slot */ | 188 | /* Add hotplug slot */ |
189 | if (rpaphp_add_slot(dn)) { | 189 | if (rpaphp_add_slot(dn)) { |
190 | printk(KERN_ERR "%s: unable to add hotplug slot %s\n", | 190 | printk(KERN_ERR "%s: unable to add hotplug slot %s\n", |
@@ -221,13 +221,13 @@ static int dlpar_remove_phb(char *drc_name, struct device_node *dn) | |||
221 | struct pci_dn *pdn; | 221 | struct pci_dn *pdn; |
222 | int rc = 0; | 222 | int rc = 0; |
223 | 223 | ||
224 | if (!rpaphp_find_pci_bus(dn)) | 224 | if (!pcibios_find_pci_bus(dn)) |
225 | return -EINVAL; | 225 | return -EINVAL; |
226 | 226 | ||
227 | slot = find_slot(dn); | 227 | slot = find_slot(dn); |
228 | if (slot) { | 228 | if (slot) { |
229 | /* Remove hotplug slot */ | 229 | /* Remove hotplug slot */ |
230 | if (rpaphp_remove_slot(slot)) { | 230 | if (rpaphp_deregister_slot(slot)) { |
231 | printk(KERN_ERR | 231 | printk(KERN_ERR |
232 | "%s: unable to remove hotplug slot %s\n", | 232 | "%s: unable to remove hotplug slot %s\n", |
233 | __FUNCTION__, drc_name); | 233 | __FUNCTION__, drc_name); |
@@ -366,21 +366,25 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn) | |||
366 | struct pci_bus *bus; | 366 | struct pci_bus *bus; |
367 | struct slot *slot; | 367 | struct slot *slot; |
368 | 368 | ||
369 | bus = rpaphp_find_pci_bus(dn); | 369 | bus = pcibios_find_pci_bus(dn); |
370 | if (!bus) | 370 | if (!bus) |
371 | return -EINVAL; | 371 | return -EINVAL; |
372 | 372 | ||
373 | slot = find_slot(dn); | 373 | slot = find_slot(dn); |
374 | if (slot) { | 374 | if (slot) { |
375 | /* Remove hotplug slot */ | 375 | /* Remove hotplug slot */ |
376 | if (rpaphp_remove_slot(slot)) { | 376 | if (rpaphp_deregister_slot(slot)) { |
377 | printk(KERN_ERR | 377 | printk(KERN_ERR |
378 | "%s: unable to remove hotplug slot %s\n", | 378 | "%s: unable to remove hotplug slot %s\n", |
379 | __FUNCTION__, drc_name); | 379 | __FUNCTION__, drc_name); |
380 | return -EIO; | 380 | return -EIO; |
381 | } | 381 | } |
382 | } else { | 382 | } else { |
383 | rpaphp_unconfig_pci_adapter(bus); | 383 | struct pci_dev *dev, *tmp; |
384 | list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { | ||
385 | eeh_remove_bus_device(dev); | ||
386 | pci_remove_bus_device(dev); | ||
387 | } | ||
384 | } | 388 | } |
385 | 389 | ||
386 | if (unmap_bus_range(bus)) { | 390 | if (unmap_bus_range(bus)) { |
diff --git a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h index 57ea71a7bda5..310b6186c0e5 100644 --- a/drivers/pci/hotplug/rpaphp.h +++ b/drivers/pci/hotplug/rpaphp.h | |||
@@ -88,16 +88,10 @@ extern int num_slots; | |||
88 | /* function prototypes */ | 88 | /* function prototypes */ |
89 | 89 | ||
90 | /* rpaphp_pci.c */ | 90 | /* rpaphp_pci.c */ |
91 | extern struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn); | ||
92 | extern int rpaphp_claim_resource(struct pci_dev *dev, int resource); | ||
93 | extern int rpaphp_enable_pci_slot(struct slot *slot); | 91 | extern int rpaphp_enable_pci_slot(struct slot *slot); |
94 | extern int register_pci_slot(struct slot *slot); | 92 | extern int rpaphp_register_pci_slot(struct slot *slot); |
95 | extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value); | 93 | extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value); |
96 | extern void rpaphp_init_new_devs(struct pci_bus *bus); | 94 | extern int rpaphp_get_sensor_state(struct slot *slot, int *state); |
97 | extern void rpaphp_eeh_init_nodes(struct device_node *dn); | ||
98 | |||
99 | extern int rpaphp_config_pci_adapter(struct pci_bus *bus); | ||
100 | extern int rpaphp_unconfig_pci_adapter(struct pci_bus *bus); | ||
101 | 95 | ||
102 | /* rpaphp_core.c */ | 96 | /* rpaphp_core.c */ |
103 | extern int rpaphp_add_slot(struct device_node *dn); | 97 | extern int rpaphp_add_slot(struct device_node *dn); |
@@ -108,8 +102,8 @@ extern int rpaphp_get_drc_props(struct device_node *dn, int *drc_index, | |||
108 | /* rpaphp_slot.c */ | 102 | /* rpaphp_slot.c */ |
109 | extern void dealloc_slot_struct(struct slot *slot); | 103 | extern void dealloc_slot_struct(struct slot *slot); |
110 | extern struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, int power_domain); | 104 | extern struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, int power_domain); |
111 | extern int register_slot(struct slot *slot); | 105 | extern int rpaphp_register_slot(struct slot *slot); |
112 | extern int deregister_slot(struct slot *slot); | 106 | extern int rpaphp_deregister_slot(struct slot *slot); |
113 | extern int rpaphp_get_power_status(struct slot *slot, u8 * value); | 107 | extern int rpaphp_get_power_status(struct slot *slot, u8 * value); |
114 | extern int rpaphp_set_attention_status(struct slot *slot, u8 status); | 108 | extern int rpaphp_set_attention_status(struct slot *slot, u8 status); |
115 | 109 | ||
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index cf075c34b578..6e79f5675b0d 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -56,25 +56,6 @@ MODULE_LICENSE("GPL"); | |||
56 | 56 | ||
57 | module_param(debug, bool, 0644); | 57 | module_param(debug, bool, 0644); |
58 | 58 | ||
59 | static int enable_slot(struct hotplug_slot *slot); | ||
60 | static int disable_slot(struct hotplug_slot *slot); | ||
61 | static int set_attention_status(struct hotplug_slot *slot, u8 value); | ||
62 | static int get_power_status(struct hotplug_slot *slot, u8 * value); | ||
63 | static int get_attention_status(struct hotplug_slot *slot, u8 * value); | ||
64 | static int get_adapter_status(struct hotplug_slot *slot, u8 * value); | ||
65 | static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value); | ||
66 | |||
67 | struct hotplug_slot_ops rpaphp_hotplug_slot_ops = { | ||
68 | .owner = THIS_MODULE, | ||
69 | .enable_slot = enable_slot, | ||
70 | .disable_slot = disable_slot, | ||
71 | .set_attention_status = set_attention_status, | ||
72 | .get_power_status = get_power_status, | ||
73 | .get_attention_status = get_attention_status, | ||
74 | .get_adapter_status = get_adapter_status, | ||
75 | .get_max_bus_speed = get_max_bus_speed, | ||
76 | }; | ||
77 | |||
78 | static int rpaphp_get_attention_status(struct slot *slot) | 59 | static int rpaphp_get_attention_status(struct slot *slot) |
79 | { | 60 | { |
80 | return slot->hotplug_slot->info->attention_status; | 61 | return slot->hotplug_slot->info->attention_status; |
@@ -196,11 +177,6 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe | |||
196 | return 0; | 177 | return 0; |
197 | } | 178 | } |
198 | 179 | ||
199 | int rpaphp_remove_slot(struct slot *slot) | ||
200 | { | ||
201 | return deregister_slot(slot); | ||
202 | } | ||
203 | |||
204 | static int get_children_props(struct device_node *dn, int **drc_indexes, | 180 | static int get_children_props(struct device_node *dn, int **drc_indexes, |
205 | int **drc_names, int **drc_types, int **drc_power_domains) | 181 | int **drc_names, int **drc_types, int **drc_power_domains) |
206 | { | 182 | { |
@@ -307,13 +283,15 @@ static int is_php_dn(struct device_node *dn, int **indexes, int **names, | |||
307 | return 0; | 283 | return 0; |
308 | } | 284 | } |
309 | 285 | ||
310 | /**************************************************************** | 286 | /** |
287 | * rpaphp_add_slot -- add hotplug or dlpar slot | ||
288 | * | ||
311 | * rpaphp not only registers PCI hotplug slots(HOTPLUG), | 289 | * rpaphp not only registers PCI hotplug slots(HOTPLUG), |
312 | * but also logical DR slots(EMBEDDED). | 290 | * but also logical DR slots(EMBEDDED). |
313 | * HOTPLUG slot: An adapter can be physically added/removed. | 291 | * HOTPLUG slot: An adapter can be physically added/removed. |
314 | * EMBEDDED slot: An adapter can be logically removed/added | 292 | * EMBEDDED slot: An adapter can be logically removed/added |
315 | * from/to a partition with the slot. | 293 | * from/to a partition with the slot. |
316 | ***************************************************************/ | 294 | */ |
317 | int rpaphp_add_slot(struct device_node *dn) | 295 | int rpaphp_add_slot(struct device_node *dn) |
318 | { | 296 | { |
319 | struct slot *slot; | 297 | struct slot *slot; |
@@ -344,7 +322,7 @@ int rpaphp_add_slot(struct device_node *dn) | |||
344 | dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n", | 322 | dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n", |
345 | indexes[i + 1], name, type); | 323 | indexes[i + 1], name, type); |
346 | 324 | ||
347 | retval = register_pci_slot(slot); | 325 | retval = rpaphp_register_pci_slot(slot); |
348 | } | 326 | } |
349 | } | 327 | } |
350 | exit: | 328 | exit: |
@@ -393,53 +371,85 @@ static void __exit rpaphp_exit(void) | |||
393 | cleanup_slots(); | 371 | cleanup_slots(); |
394 | } | 372 | } |
395 | 373 | ||
396 | static int enable_slot(struct hotplug_slot *hotplug_slot) | 374 | static int __enable_slot(struct slot *slot) |
397 | { | 375 | { |
398 | int retval = 0; | 376 | int state; |
399 | struct slot *slot = (struct slot *)hotplug_slot->private; | 377 | int retval; |
400 | 378 | ||
401 | if (slot->state == CONFIGURED) { | 379 | if (slot->state == CONFIGURED) |
402 | dbg("%s: %s is already enabled\n", __FUNCTION__, slot->name); | 380 | return 0; |
403 | goto exit; | 381 | |
382 | retval = rpaphp_get_sensor_state(slot, &state); | ||
383 | if (retval) | ||
384 | return retval; | ||
385 | |||
386 | if (state == PRESENT) { | ||
387 | pcibios_add_pci_devices(slot->bus); | ||
388 | slot->state = CONFIGURED; | ||
389 | } else if (state == EMPTY) { | ||
390 | slot->state = EMPTY; | ||
391 | } else { | ||
392 | err("%s: slot[%s] is in invalid state\n", __FUNCTION__, slot->name); | ||
393 | slot->state = NOT_VALID; | ||
394 | return -EINVAL; | ||
404 | } | 395 | } |
396 | return 0; | ||
397 | } | ||
398 | |||
399 | static int enable_slot(struct hotplug_slot *hotplug_slot) | ||
400 | { | ||
401 | int retval; | ||
402 | struct slot *slot = (struct slot *)hotplug_slot->private; | ||
405 | 403 | ||
406 | dbg("ENABLING SLOT %s\n", slot->name); | ||
407 | down(&rpaphp_sem); | 404 | down(&rpaphp_sem); |
408 | retval = rpaphp_enable_pci_slot(slot); | 405 | retval = __enable_slot(slot); |
409 | up(&rpaphp_sem); | 406 | up(&rpaphp_sem); |
410 | exit: | 407 | |
411 | dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); | ||
412 | return retval; | 408 | return retval; |
413 | } | 409 | } |
414 | 410 | ||
415 | static int disable_slot(struct hotplug_slot *hotplug_slot) | 411 | static int __disable_slot(struct slot *slot) |
416 | { | 412 | { |
417 | int retval = -EINVAL; | 413 | struct pci_dev *dev, *tmp; |
418 | struct slot *slot = (struct slot *)hotplug_slot->private; | ||
419 | 414 | ||
420 | dbg("%s - Entry: slot[%s]\n", __FUNCTION__, slot->name); | 415 | if (slot->state == NOT_CONFIGURED) |
416 | return -EINVAL; | ||
421 | 417 | ||
422 | if (slot->state == NOT_CONFIGURED) { | 418 | list_for_each_entry_safe(dev, tmp, &slot->bus->devices, bus_list) { |
423 | dbg("%s: %s is already disabled\n", __FUNCTION__, slot->name); | 419 | eeh_remove_bus_device(dev); |
424 | goto exit; | 420 | pci_remove_bus_device(dev); |
425 | } | 421 | } |
426 | 422 | ||
427 | dbg("DISABLING SLOT %s\n", slot->name); | 423 | slot->state = NOT_CONFIGURED; |
424 | return 0; | ||
425 | } | ||
426 | |||
427 | static int disable_slot(struct hotplug_slot *hotplug_slot) | ||
428 | { | ||
429 | struct slot *slot = (struct slot *)hotplug_slot->private; | ||
430 | int retval; | ||
431 | |||
428 | down(&rpaphp_sem); | 432 | down(&rpaphp_sem); |
429 | retval = rpaphp_unconfig_pci_adapter(slot->bus); | 433 | retval = __disable_slot (slot); |
430 | up(&rpaphp_sem); | 434 | up(&rpaphp_sem); |
431 | slot->state = NOT_CONFIGURED; | 435 | |
432 | info("%s: devices in slot[%s] unconfigured.\n", __FUNCTION__, | ||
433 | slot->name); | ||
434 | exit: | ||
435 | dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); | ||
436 | return retval; | 436 | return retval; |
437 | } | 437 | } |
438 | 438 | ||
439 | struct hotplug_slot_ops rpaphp_hotplug_slot_ops = { | ||
440 | .owner = THIS_MODULE, | ||
441 | .enable_slot = enable_slot, | ||
442 | .disable_slot = disable_slot, | ||
443 | .set_attention_status = set_attention_status, | ||
444 | .get_power_status = get_power_status, | ||
445 | .get_attention_status = get_attention_status, | ||
446 | .get_adapter_status = get_adapter_status, | ||
447 | .get_max_bus_speed = get_max_bus_speed, | ||
448 | }; | ||
449 | |||
439 | module_init(rpaphp_init); | 450 | module_init(rpaphp_init); |
440 | module_exit(rpaphp_exit); | 451 | module_exit(rpaphp_exit); |
441 | 452 | ||
442 | EXPORT_SYMBOL_GPL(rpaphp_add_slot); | 453 | EXPORT_SYMBOL_GPL(rpaphp_add_slot); |
443 | EXPORT_SYMBOL_GPL(rpaphp_remove_slot); | ||
444 | EXPORT_SYMBOL_GPL(rpaphp_slot_head); | 454 | EXPORT_SYMBOL_GPL(rpaphp_slot_head); |
445 | EXPORT_SYMBOL_GPL(rpaphp_get_drc_props); | 455 | EXPORT_SYMBOL_GPL(rpaphp_get_drc_props); |
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index 396b54b0c847..6f6cbede5135 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -32,37 +32,7 @@ | |||
32 | #include "../pci.h" /* for pci_add_new_bus */ | 32 | #include "../pci.h" /* for pci_add_new_bus */ |
33 | #include "rpaphp.h" | 33 | #include "rpaphp.h" |
34 | 34 | ||
35 | static struct pci_bus *find_bus_among_children(struct pci_bus *bus, | 35 | int rpaphp_get_sensor_state(struct slot *slot, int *state) |
36 | struct device_node *dn) | ||
37 | { | ||
38 | struct pci_bus *child = NULL; | ||
39 | struct list_head *tmp; | ||
40 | struct device_node *busdn; | ||
41 | |||
42 | busdn = pci_bus_to_OF_node(bus); | ||
43 | if (busdn == dn) | ||
44 | return bus; | ||
45 | |||
46 | list_for_each(tmp, &bus->children) { | ||
47 | child = find_bus_among_children(pci_bus_b(tmp), dn); | ||
48 | if (child) | ||
49 | break; | ||
50 | } | ||
51 | return child; | ||
52 | } | ||
53 | |||
54 | struct pci_bus *rpaphp_find_pci_bus(struct device_node *dn) | ||
55 | { | ||
56 | struct pci_dn *pdn = dn->data; | ||
57 | |||
58 | if (!pdn || !pdn->phb || !pdn->phb->bus) | ||
59 | return NULL; | ||
60 | |||
61 | return find_bus_among_children(pdn->phb->bus, dn); | ||
62 | } | ||
63 | EXPORT_SYMBOL_GPL(rpaphp_find_pci_bus); | ||
64 | |||
65 | static int rpaphp_get_sensor_state(struct slot *slot, int *state) | ||
66 | { | 36 | { |
67 | int rc; | 37 | int rc; |
68 | int setlevel; | 38 | int setlevel; |
@@ -120,7 +90,7 @@ int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value) | |||
120 | /* config/unconfig adapter */ | 90 | /* config/unconfig adapter */ |
121 | *value = slot->state; | 91 | *value = slot->state; |
122 | } else { | 92 | } else { |
123 | bus = rpaphp_find_pci_bus(slot->dn); | 93 | bus = pcibios_find_pci_bus(slot->dn); |
124 | if (bus && !list_empty(&bus->devices)) | 94 | if (bus && !list_empty(&bus->devices)) |
125 | *value = CONFIGURED; | 95 | *value = CONFIGURED; |
126 | else | 96 | else |
@@ -131,140 +101,6 @@ exit: | |||
131 | return rc; | 101 | return rc; |
132 | } | 102 | } |
133 | 103 | ||
134 | /* Must be called before pci_bus_add_devices */ | ||
135 | void rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) | ||
136 | { | ||
137 | struct pci_dev *dev; | ||
138 | |||
139 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
140 | /* | ||
141 | * Skip already-present devices (which are on the | ||
142 | * global device list.) | ||
143 | */ | ||
144 | if (list_empty(&dev->global_list)) { | ||
145 | int i; | ||
146 | |||
147 | /* Need to setup IOMMU tables */ | ||
148 | ppc_md.iommu_dev_setup(dev); | ||
149 | |||
150 | if(fix_bus) | ||
151 | pcibios_fixup_device_resources(dev, bus); | ||
152 | pci_read_irq_line(dev); | ||
153 | for (i = 0; i < PCI_NUM_RESOURCES; i++) { | ||
154 | struct resource *r = &dev->resource[i]; | ||
155 | |||
156 | if (r->parent || !r->start || !r->flags) | ||
157 | continue; | ||
158 | pci_claim_resource(dev, i); | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | |||
164 | static void rpaphp_eeh_add_bus_device(struct pci_bus *bus) | ||
165 | { | ||
166 | struct pci_dev *dev; | ||
167 | |||
168 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
169 | eeh_add_device_late(dev); | ||
170 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | ||
171 | struct pci_bus *subbus = dev->subordinate; | ||
172 | if (subbus) | ||
173 | rpaphp_eeh_add_bus_device (subbus); | ||
174 | } | ||
175 | } | ||
176 | } | ||
177 | |||
178 | static int rpaphp_pci_config_bridge(struct pci_dev *dev) | ||
179 | { | ||
180 | u8 sec_busno; | ||
181 | struct pci_bus *child_bus; | ||
182 | struct pci_dev *child_dev; | ||
183 | |||
184 | dbg("Enter %s: BRIDGE dev=%s\n", __FUNCTION__, pci_name(dev)); | ||
185 | |||
186 | /* get busno of downstream bus */ | ||
187 | pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno); | ||
188 | |||
189 | /* add to children of PCI bridge dev->bus */ | ||
190 | child_bus = pci_add_new_bus(dev->bus, dev, sec_busno); | ||
191 | if (!child_bus) { | ||
192 | err("%s: could not add second bus\n", __FUNCTION__); | ||
193 | return -EIO; | ||
194 | } | ||
195 | sprintf(child_bus->name, "PCI Bus #%02x", child_bus->number); | ||
196 | /* do pci_scan_child_bus */ | ||
197 | pci_scan_child_bus(child_bus); | ||
198 | |||
199 | list_for_each_entry(child_dev, &child_bus->devices, bus_list) { | ||
200 | eeh_add_device_late(child_dev); | ||
201 | } | ||
202 | |||
203 | /* fixup new pci devices without touching bus struct */ | ||
204 | rpaphp_fixup_new_pci_devices(child_bus, 0); | ||
205 | |||
206 | /* Make the discovered devices available */ | ||
207 | pci_bus_add_devices(child_bus); | ||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | void rpaphp_init_new_devs(struct pci_bus *bus) | ||
212 | { | ||
213 | rpaphp_fixup_new_pci_devices(bus, 0); | ||
214 | rpaphp_eeh_add_bus_device(bus); | ||
215 | } | ||
216 | EXPORT_SYMBOL_GPL(rpaphp_init_new_devs); | ||
217 | |||
218 | /***************************************************************************** | ||
219 | rpaphp_pci_config_slot() will configure all devices under the | ||
220 | given slot->dn and return the the first pci_dev. | ||
221 | *****************************************************************************/ | ||
222 | static struct pci_dev * | ||
223 | rpaphp_pci_config_slot(struct pci_bus *bus) | ||
224 | { | ||
225 | struct device_node *dn = pci_bus_to_OF_node(bus); | ||
226 | struct pci_dev *dev = NULL; | ||
227 | int slotno; | ||
228 | int num; | ||
229 | |||
230 | dbg("Enter %s: dn=%s bus=%s\n", __FUNCTION__, dn->full_name, bus->name); | ||
231 | if (!dn || !dn->child) | ||
232 | return NULL; | ||
233 | |||
234 | if (_machine == PLATFORM_PSERIES_LPAR) { | ||
235 | of_scan_bus(dn, bus); | ||
236 | if (list_empty(&bus->devices)) { | ||
237 | err("%s: No new device found\n", __FUNCTION__); | ||
238 | return NULL; | ||
239 | } | ||
240 | |||
241 | rpaphp_init_new_devs(bus); | ||
242 | pci_bus_add_devices(bus); | ||
243 | dev = list_entry(&bus->devices, struct pci_dev, bus_list); | ||
244 | } else { | ||
245 | slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); | ||
246 | |||
247 | /* pci_scan_slot should find all children */ | ||
248 | num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); | ||
249 | if (num) { | ||
250 | rpaphp_fixup_new_pci_devices(bus, 1); | ||
251 | pci_bus_add_devices(bus); | ||
252 | } | ||
253 | if (list_empty(&bus->devices)) { | ||
254 | err("%s: No new device found\n", __FUNCTION__); | ||
255 | return NULL; | ||
256 | } | ||
257 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
258 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) | ||
259 | rpaphp_pci_config_bridge(dev); | ||
260 | |||
261 | rpaphp_eeh_add_bus_device(bus); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | return dev; | ||
266 | } | ||
267 | |||
268 | static void print_slot_pci_funcs(struct pci_bus *bus) | 104 | static void print_slot_pci_funcs(struct pci_bus *bus) |
269 | { | 105 | { |
270 | struct device_node *dn; | 106 | struct device_node *dn; |
@@ -280,60 +116,6 @@ static void print_slot_pci_funcs(struct pci_bus *bus) | |||
280 | return; | 116 | return; |
281 | } | 117 | } |
282 | 118 | ||
283 | int rpaphp_config_pci_adapter(struct pci_bus *bus) | ||
284 | { | ||
285 | struct device_node *dn = pci_bus_to_OF_node(bus); | ||
286 | struct pci_dev *dev; | ||
287 | int rc = -ENODEV; | ||
288 | |||
289 | dbg("Entry %s: slot[%s]\n", __FUNCTION__, dn->full_name); | ||
290 | if (!dn) | ||
291 | goto exit; | ||
292 | |||
293 | eeh_add_device_tree_early(dn); | ||
294 | dev = rpaphp_pci_config_slot(bus); | ||
295 | if (!dev) { | ||
296 | err("%s: can't find any devices.\n", __FUNCTION__); | ||
297 | goto exit; | ||
298 | } | ||
299 | print_slot_pci_funcs(bus); | ||
300 | rc = 0; | ||
301 | exit: | ||
302 | dbg("Exit %s: rc=%d\n", __FUNCTION__, rc); | ||
303 | return rc; | ||
304 | } | ||
305 | EXPORT_SYMBOL_GPL(rpaphp_config_pci_adapter); | ||
306 | |||
307 | static void rpaphp_eeh_remove_bus_device(struct pci_dev *dev) | ||
308 | { | ||
309 | eeh_remove_device(dev); | ||
310 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { | ||
311 | struct pci_bus *bus = dev->subordinate; | ||
312 | struct list_head *ln; | ||
313 | if (!bus) | ||
314 | return; | ||
315 | for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { | ||
316 | struct pci_dev *pdev = pci_dev_b(ln); | ||
317 | if (pdev) | ||
318 | rpaphp_eeh_remove_bus_device(pdev); | ||
319 | } | ||
320 | |||
321 | } | ||
322 | return; | ||
323 | } | ||
324 | |||
325 | int rpaphp_unconfig_pci_adapter(struct pci_bus *bus) | ||
326 | { | ||
327 | struct pci_dev *dev, *tmp; | ||
328 | |||
329 | list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { | ||
330 | rpaphp_eeh_remove_bus_device(dev); | ||
331 | pci_remove_bus_device(dev); | ||
332 | } | ||
333 | return 0; | ||
334 | } | ||
335 | EXPORT_SYMBOL_GPL(rpaphp_unconfig_pci_adapter); | ||
336 | |||
337 | static int setup_pci_hotplug_slot_info(struct slot *slot) | 119 | static int setup_pci_hotplug_slot_info(struct slot *slot) |
338 | { | 120 | { |
339 | struct hotplug_slot_info *hotplug_slot_info = slot->hotplug_slot->info; | 121 | struct hotplug_slot_info *hotplug_slot_info = slot->hotplug_slot->info; |
@@ -370,7 +152,7 @@ static int setup_pci_slot(struct slot *slot) | |||
370 | struct pci_bus *bus; | 152 | struct pci_bus *bus; |
371 | 153 | ||
372 | BUG_ON(!dn); | 154 | BUG_ON(!dn); |
373 | bus = rpaphp_find_pci_bus(dn); | 155 | bus = pcibios_find_pci_bus(dn); |
374 | if (!bus) { | 156 | if (!bus) { |
375 | err("%s: no pci_bus for dn %s\n", __FUNCTION__, dn->full_name); | 157 | err("%s: no pci_bus for dn %s\n", __FUNCTION__, dn->full_name); |
376 | goto exit_rc; | 158 | goto exit_rc; |
@@ -395,10 +177,7 @@ static int setup_pci_slot(struct slot *slot) | |||
395 | if (slot->hotplug_slot->info->adapter_status == NOT_CONFIGURED) { | 177 | if (slot->hotplug_slot->info->adapter_status == NOT_CONFIGURED) { |
396 | dbg("%s CONFIGURING pci adapter in slot[%s]\n", | 178 | dbg("%s CONFIGURING pci adapter in slot[%s]\n", |
397 | __FUNCTION__, slot->name); | 179 | __FUNCTION__, slot->name); |
398 | if (rpaphp_config_pci_adapter(slot->bus)) { | 180 | pcibios_add_pci_devices(slot->bus); |
399 | err("%s: CONFIG pci adapter failed\n", __FUNCTION__); | ||
400 | goto exit_rc; | ||
401 | } | ||
402 | 181 | ||
403 | } else if (slot->hotplug_slot->info->adapter_status != CONFIGURED) { | 182 | } else if (slot->hotplug_slot->info->adapter_status != CONFIGURED) { |
404 | err("%s: slot[%s]'s adapter_status is NOT_VALID.\n", | 183 | err("%s: slot[%s]'s adapter_status is NOT_VALID.\n", |
@@ -420,7 +199,7 @@ exit_rc: | |||
420 | return -EINVAL; | 199 | return -EINVAL; |
421 | } | 200 | } |
422 | 201 | ||
423 | int register_pci_slot(struct slot *slot) | 202 | int rpaphp_register_pci_slot(struct slot *slot) |
424 | { | 203 | { |
425 | int rc = -EINVAL; | 204 | int rc = -EINVAL; |
426 | 205 | ||
@@ -428,42 +207,8 @@ int register_pci_slot(struct slot *slot) | |||
428 | goto exit_rc; | 207 | goto exit_rc; |
429 | if (setup_pci_slot(slot)) | 208 | if (setup_pci_slot(slot)) |
430 | goto exit_rc; | 209 | goto exit_rc; |
431 | rc = register_slot(slot); | 210 | rc = rpaphp_register_slot(slot); |
432 | exit_rc: | 211 | exit_rc: |
433 | return rc; | 212 | return rc; |
434 | } | 213 | } |
435 | 214 | ||
436 | int rpaphp_enable_pci_slot(struct slot *slot) | ||
437 | { | ||
438 | int retval = 0, state; | ||
439 | |||
440 | retval = rpaphp_get_sensor_state(slot, &state); | ||
441 | if (retval) | ||
442 | goto exit; | ||
443 | dbg("%s: sensor state[%d]\n", __FUNCTION__, state); | ||
444 | /* if slot is not empty, enable the adapter */ | ||
445 | if (state == PRESENT) { | ||
446 | dbg("%s : slot[%s] is occupied.\n", __FUNCTION__, slot->name); | ||
447 | retval = rpaphp_config_pci_adapter(slot->bus); | ||
448 | if (!retval) { | ||
449 | slot->state = CONFIGURED; | ||
450 | info("%s: devices in slot[%s] configured\n", | ||
451 | __FUNCTION__, slot->name); | ||
452 | } else { | ||
453 | slot->state = NOT_CONFIGURED; | ||
454 | dbg("%s: no pci_dev struct for adapter in slot[%s]\n", | ||
455 | __FUNCTION__, slot->name); | ||
456 | } | ||
457 | } else if (state == EMPTY) { | ||
458 | dbg("%s : slot[%s] is empty\n", __FUNCTION__, slot->name); | ||
459 | slot->state = EMPTY; | ||
460 | } else { | ||
461 | err("%s: slot[%s] is in invalid state\n", __FUNCTION__, | ||
462 | slot->name); | ||
463 | slot->state = NOT_VALID; | ||
464 | retval = -EINVAL; | ||
465 | } | ||
466 | exit: | ||
467 | dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); | ||
468 | return retval; | ||
469 | } | ||
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c index daa89ae57123..04cc1e7275ce 100644 --- a/drivers/pci/hotplug/rpaphp_slot.c +++ b/drivers/pci/hotplug/rpaphp_slot.c | |||
@@ -35,16 +35,16 @@ | |||
35 | 35 | ||
36 | static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf) | 36 | static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf) |
37 | { | 37 | { |
38 | char *value; | 38 | char *value; |
39 | int retval = -ENOENT; | 39 | int retval = -ENOENT; |
40 | struct slot *slot = (struct slot *)php_slot->private; | 40 | struct slot *slot = (struct slot *)php_slot->private; |
41 | 41 | ||
42 | if (!slot) | 42 | if (!slot) |
43 | return retval; | 43 | return retval; |
44 | 44 | ||
45 | value = slot->location; | 45 | value = slot->location; |
46 | retval = sprintf (buf, "%s\n", value); | 46 | retval = sprintf (buf, "%s\n", value); |
47 | return retval; | 47 | return retval; |
48 | } | 48 | } |
49 | 49 | ||
50 | static struct hotplug_slot_attribute hotplug_slot_attr_location = { | 50 | static struct hotplug_slot_attribute hotplug_slot_attr_location = { |
@@ -137,7 +137,7 @@ static int is_registered(struct slot *slot) | |||
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
139 | 139 | ||
140 | int deregister_slot(struct slot *slot) | 140 | int rpaphp_deregister_slot(struct slot *slot) |
141 | { | 141 | { |
142 | int retval = 0; | 142 | int retval = 0; |
143 | struct hotplug_slot *php_slot = slot->hotplug_slot; | 143 | struct hotplug_slot *php_slot = slot->hotplug_slot; |
@@ -160,7 +160,7 @@ int deregister_slot(struct slot *slot) | |||
160 | return retval; | 160 | return retval; |
161 | } | 161 | } |
162 | 162 | ||
163 | int register_slot(struct slot *slot) | 163 | int rpaphp_register_slot(struct slot *slot) |
164 | { | 164 | { |
165 | int retval; | 165 | int retval; |
166 | 166 | ||
@@ -169,7 +169,7 @@ int register_slot(struct slot *slot) | |||
169 | slot->power_domain, slot->type); | 169 | slot->power_domain, slot->type); |
170 | /* should not try to register the same slot twice */ | 170 | /* should not try to register the same slot twice */ |
171 | if (is_registered(slot)) { /* should't be here */ | 171 | if (is_registered(slot)) { /* should't be here */ |
172 | err("register_slot: slot[%s] is already registered\n", slot->name); | 172 | err("rpaphp_register_slot: slot[%s] is already registered\n", slot->name); |
173 | rpaphp_release_slot(slot->hotplug_slot); | 173 | rpaphp_release_slot(slot->hotplug_slot); |
174 | return -EAGAIN; | 174 | return -EAGAIN; |
175 | } | 175 | } |
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h index ce0e9b6ce833..7d6f521d02ea 100644 --- a/drivers/pci/hotplug/shpchp.h +++ b/drivers/pci/hotplug/shpchp.h | |||
@@ -95,6 +95,7 @@ struct controller { | |||
95 | u8 function; | 95 | u8 function; |
96 | u8 slot_device_offset; | 96 | u8 slot_device_offset; |
97 | u8 add_support; | 97 | u8 add_support; |
98 | u32 pcix_misc2_reg; /* for amd pogo errata */ | ||
98 | enum pci_bus_speed speed; | 99 | enum pci_bus_speed speed; |
99 | u32 first_slot; /* First physical slot number */ | 100 | u32 first_slot; /* First physical slot number */ |
100 | u8 slot_bus; /* Bus where the slots handled by this controller sit */ | 101 | u8 slot_bus; /* Bus where the slots handled by this controller sit */ |
@@ -113,6 +114,26 @@ struct hotplug_params { | |||
113 | 114 | ||
114 | /* Define AMD SHPC ID */ | 115 | /* Define AMD SHPC ID */ |
115 | #define PCI_DEVICE_ID_AMD_GOLAM_7450 0x7450 | 116 | #define PCI_DEVICE_ID_AMD_GOLAM_7450 0x7450 |
117 | #define PCI_DEVICE_ID_AMD_POGO_7458 0x7458 | ||
118 | |||
119 | /* AMD PCIX bridge registers */ | ||
120 | |||
121 | #define PCIX_MEM_BASE_LIMIT_OFFSET 0x1C | ||
122 | #define PCIX_MISCII_OFFSET 0x48 | ||
123 | #define PCIX_MISC_BRIDGE_ERRORS_OFFSET 0x80 | ||
124 | |||
125 | /* AMD PCIX_MISCII masks and offsets */ | ||
126 | #define PERRNONFATALENABLE_MASK 0x00040000 | ||
127 | #define PERRFATALENABLE_MASK 0x00080000 | ||
128 | #define PERRFLOODENABLE_MASK 0x00100000 | ||
129 | #define SERRNONFATALENABLE_MASK 0x00200000 | ||
130 | #define SERRFATALENABLE_MASK 0x00400000 | ||
131 | |||
132 | /* AMD PCIX_MISC_BRIDGE_ERRORS masks and offsets */ | ||
133 | #define PERR_OBSERVED_MASK 0x00000001 | ||
134 | |||
135 | /* AMD PCIX_MEM_BASE_LIMIT masks */ | ||
136 | #define RSE_MASK 0x40000000 | ||
116 | 137 | ||
117 | #define INT_BUTTON_IGNORE 0 | 138 | #define INT_BUTTON_IGNORE 0 |
118 | #define INT_PRESENCE_ON 1 | 139 | #define INT_PRESENCE_ON 1 |
@@ -333,6 +354,79 @@ static inline int wait_for_ctrl_irq (struct controller *ctrl) | |||
333 | return retval; | 354 | return retval; |
334 | } | 355 | } |
335 | 356 | ||
357 | static inline void amd_pogo_errata_save_misc_reg(struct slot *p_slot) | ||
358 | { | ||
359 | u32 pcix_misc2_temp; | ||
360 | |||
361 | /* save MiscII register */ | ||
362 | pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp); | ||
363 | |||
364 | p_slot->ctrl->pcix_misc2_reg = pcix_misc2_temp; | ||
365 | |||
366 | /* clear SERR/PERR enable bits */ | ||
367 | pcix_misc2_temp &= ~SERRFATALENABLE_MASK; | ||
368 | pcix_misc2_temp &= ~SERRNONFATALENABLE_MASK; | ||
369 | pcix_misc2_temp &= ~PERRFLOODENABLE_MASK; | ||
370 | pcix_misc2_temp &= ~PERRFATALENABLE_MASK; | ||
371 | pcix_misc2_temp &= ~PERRNONFATALENABLE_MASK; | ||
372 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, pcix_misc2_temp); | ||
373 | } | ||
374 | |||
375 | static inline void amd_pogo_errata_restore_misc_reg(struct slot *p_slot) | ||
376 | { | ||
377 | u32 pcix_misc2_temp; | ||
378 | u32 pcix_bridge_errors_reg; | ||
379 | u32 pcix_mem_base_reg; | ||
380 | u8 perr_set; | ||
381 | u8 rse_set; | ||
382 | |||
383 | /* write-one-to-clear Bridge_Errors[ PERR_OBSERVED ] */ | ||
384 | pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, &pcix_bridge_errors_reg); | ||
385 | perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK; | ||
386 | if (perr_set) { | ||
387 | dbg ("%s W1C: Bridge_Errors[ PERR_OBSERVED = %08X]\n",__FUNCTION__ , perr_set); | ||
388 | |||
389 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set); | ||
390 | } | ||
391 | |||
392 | /* write-one-to-clear Memory_Base_Limit[ RSE ] */ | ||
393 | pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg); | ||
394 | rse_set = pcix_mem_base_reg & RSE_MASK; | ||
395 | if (rse_set) { | ||
396 | dbg ("%s W1C: Memory_Base_Limit[ RSE ]\n",__FUNCTION__ ); | ||
397 | |||
398 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); | ||
399 | } | ||
400 | /* restore MiscII register */ | ||
401 | pci_read_config_dword( p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, &pcix_misc2_temp ); | ||
402 | |||
403 | if (p_slot->ctrl->pcix_misc2_reg & SERRFATALENABLE_MASK) | ||
404 | pcix_misc2_temp |= SERRFATALENABLE_MASK; | ||
405 | else | ||
406 | pcix_misc2_temp &= ~SERRFATALENABLE_MASK; | ||
407 | |||
408 | if (p_slot->ctrl->pcix_misc2_reg & SERRNONFATALENABLE_MASK) | ||
409 | pcix_misc2_temp |= SERRNONFATALENABLE_MASK; | ||
410 | else | ||
411 | pcix_misc2_temp &= ~SERRNONFATALENABLE_MASK; | ||
412 | |||
413 | if (p_slot->ctrl->pcix_misc2_reg & PERRFLOODENABLE_MASK) | ||
414 | pcix_misc2_temp |= PERRFLOODENABLE_MASK; | ||
415 | else | ||
416 | pcix_misc2_temp &= ~PERRFLOODENABLE_MASK; | ||
417 | |||
418 | if (p_slot->ctrl->pcix_misc2_reg & PERRFATALENABLE_MASK) | ||
419 | pcix_misc2_temp |= PERRFATALENABLE_MASK; | ||
420 | else | ||
421 | pcix_misc2_temp &= ~PERRFATALENABLE_MASK; | ||
422 | |||
423 | if (p_slot->ctrl->pcix_misc2_reg & PERRNONFATALENABLE_MASK) | ||
424 | pcix_misc2_temp |= PERRNONFATALENABLE_MASK; | ||
425 | else | ||
426 | pcix_misc2_temp &= ~PERRNONFATALENABLE_MASK; | ||
427 | pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISCII_OFFSET, pcix_misc2_temp); | ||
428 | } | ||
429 | |||
336 | #define SLOT_NAME_SIZE 10 | 430 | #define SLOT_NAME_SIZE 10 |
337 | 431 | ||
338 | static inline void make_slot_name(char *buffer, int buffer_size, struct slot *slot) | 432 | static inline void make_slot_name(char *buffer, int buffer_size, struct slot *slot) |
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c index 25ccb0e47593..643252d9bf3b 100644 --- a/drivers/pci/hotplug/shpchp_ctrl.c +++ b/drivers/pci/hotplug/shpchp_ctrl.c | |||
@@ -894,7 +894,17 @@ int shpchp_enable_slot (struct slot *p_slot) | |||
894 | dbg("%s: p_slot->pwr_save %x\n", __FUNCTION__, p_slot->pwr_save); | 894 | dbg("%s: p_slot->pwr_save %x\n", __FUNCTION__, p_slot->pwr_save); |
895 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); | 895 | p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); |
896 | 896 | ||
897 | rc = board_added(p_slot); | 897 | if(((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) || |
898 | (p_slot->ctrl->pci_dev->device == PCI_DEVICE_ID_AMD_POGO_7458)) | ||
899 | && p_slot->ctrl->num_slots == 1) { | ||
900 | /* handle amd pogo errata; this must be done before enable */ | ||
901 | amd_pogo_errata_save_misc_reg(p_slot); | ||
902 | rc = board_added(p_slot); | ||
903 | /* handle amd pogo errata; this must be done after enable */ | ||
904 | amd_pogo_errata_restore_misc_reg(p_slot); | ||
905 | } else | ||
906 | rc = board_added(p_slot); | ||
907 | |||
898 | if (rc) { | 908 | if (rc) { |
899 | p_slot->hpc_ops->get_adapter_status(p_slot, | 909 | p_slot->hpc_ops->get_adapter_status(p_slot, |
900 | &(p_slot->presence_save)); | 910 | &(p_slot->presence_save)); |
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 202b7507a357..48723d6fa60f 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -137,6 +137,8 @@ static void set_msi_affinity(unsigned int vector, cpumask_t cpu_mask) | |||
137 | break; | 137 | break; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | #else | ||
141 | #define set_msi_affinity NULL | ||
140 | #endif /* CONFIG_SMP */ | 142 | #endif /* CONFIG_SMP */ |
141 | 143 | ||
142 | static void mask_MSI_irq(unsigned int vector) | 144 | static void mask_MSI_irq(unsigned int vector) |
@@ -214,7 +216,7 @@ static struct hw_interrupt_type msix_irq_type = { | |||
214 | .disable = mask_MSI_irq, | 216 | .disable = mask_MSI_irq, |
215 | .ack = mask_MSI_irq, | 217 | .ack = mask_MSI_irq, |
216 | .end = end_msi_irq_w_maskbit, | 218 | .end = end_msi_irq_w_maskbit, |
217 | .set_affinity = set_msi_irq_affinity | 219 | .set_affinity = set_msi_affinity |
218 | }; | 220 | }; |
219 | 221 | ||
220 | /* | 222 | /* |
@@ -230,7 +232,7 @@ static struct hw_interrupt_type msi_irq_w_maskbit_type = { | |||
230 | .disable = mask_MSI_irq, | 232 | .disable = mask_MSI_irq, |
231 | .ack = mask_MSI_irq, | 233 | .ack = mask_MSI_irq, |
232 | .end = end_msi_irq_w_maskbit, | 234 | .end = end_msi_irq_w_maskbit, |
233 | .set_affinity = set_msi_irq_affinity | 235 | .set_affinity = set_msi_affinity |
234 | }; | 236 | }; |
235 | 237 | ||
236 | /* | 238 | /* |
@@ -246,7 +248,7 @@ static struct hw_interrupt_type msi_irq_wo_maskbit_type = { | |||
246 | .disable = do_nothing, | 248 | .disable = do_nothing, |
247 | .ack = do_nothing, | 249 | .ack = do_nothing, |
248 | .end = end_msi_irq_wo_maskbit, | 250 | .end = end_msi_irq_wo_maskbit, |
249 | .set_affinity = set_msi_irq_affinity | 251 | .set_affinity = set_msi_affinity |
250 | }; | 252 | }; |
251 | 253 | ||
252 | static void msi_data_init(struct msg_data *msi_data, | 254 | static void msi_data_init(struct msg_data *msi_data, |
@@ -416,7 +418,9 @@ static void attach_msi_entry(struct msi_desc *entry, int vector) | |||
416 | 418 | ||
417 | static void irq_handler_init(int cap_id, int pos, int mask) | 419 | static void irq_handler_init(int cap_id, int pos, int mask) |
418 | { | 420 | { |
419 | spin_lock(&irq_desc[pos].lock); | 421 | unsigned long flags; |
422 | |||
423 | spin_lock_irqsave(&irq_desc[pos].lock, flags); | ||
420 | if (cap_id == PCI_CAP_ID_MSIX) | 424 | if (cap_id == PCI_CAP_ID_MSIX) |
421 | irq_desc[pos].handler = &msix_irq_type; | 425 | irq_desc[pos].handler = &msix_irq_type; |
422 | else { | 426 | else { |
@@ -425,7 +429,7 @@ static void irq_handler_init(int cap_id, int pos, int mask) | |||
425 | else | 429 | else |
426 | irq_desc[pos].handler = &msi_irq_w_maskbit_type; | 430 | irq_desc[pos].handler = &msi_irq_w_maskbit_type; |
427 | } | 431 | } |
428 | spin_unlock(&irq_desc[pos].lock); | 432 | spin_unlock_irqrestore(&irq_desc[pos].lock, flags); |
429 | } | 433 | } |
430 | 434 | ||
431 | static void enable_msi_mode(struct pci_dev *dev, int pos, int type) | 435 | static void enable_msi_mode(struct pci_dev *dev, int pos, int type) |
diff --git a/drivers/pci/msi.h b/drivers/pci/msi.h index 402136a5c9e4..4ac52d441e47 100644 --- a/drivers/pci/msi.h +++ b/drivers/pci/msi.h | |||
@@ -22,12 +22,6 @@ extern int vector_irq[NR_VECTORS]; | |||
22 | extern void (*interrupt[NR_IRQS])(void); | 22 | extern void (*interrupt[NR_IRQS])(void); |
23 | extern int pci_vector_resources(int last, int nr_released); | 23 | extern int pci_vector_resources(int last, int nr_released); |
24 | 24 | ||
25 | #ifdef CONFIG_SMP | ||
26 | #define set_msi_irq_affinity set_msi_affinity | ||
27 | #else | ||
28 | #define set_msi_irq_affinity NULL | ||
29 | #endif | ||
30 | |||
31 | /* | 25 | /* |
32 | * MSI-X Address Register | 26 | * MSI-X Address Register |
33 | */ | 27 | */ |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index d2a633efa10a..d2d187916643 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -163,6 +163,7 @@ int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap) | |||
163 | return __pci_bus_find_cap(bus, devfn, hdr_type & 0x7f, cap); | 163 | return __pci_bus_find_cap(bus, devfn, hdr_type & 0x7f, cap); |
164 | } | 164 | } |
165 | 165 | ||
166 | #if 0 | ||
166 | /** | 167 | /** |
167 | * pci_find_ext_capability - Find an extended capability | 168 | * pci_find_ext_capability - Find an extended capability |
168 | * @dev: PCI device to query | 169 | * @dev: PCI device to query |
@@ -210,6 +211,7 @@ int pci_find_ext_capability(struct pci_dev *dev, int cap) | |||
210 | 211 | ||
211 | return 0; | 212 | return 0; |
212 | } | 213 | } |
214 | #endif /* 0 */ | ||
213 | 215 | ||
214 | /** | 216 | /** |
215 | * pci_find_parent_resource - return resource region of parent bus of given region | 217 | * pci_find_parent_resource - return resource region of parent bus of given region |
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 50d6685dcbcc..ea9277b7f899 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -112,6 +112,7 @@ pci_claim_resource(struct pci_dev *dev, int resource) | |||
112 | 112 | ||
113 | return err; | 113 | return err; |
114 | } | 114 | } |
115 | EXPORT_SYMBOL_GPL(pci_claim_resource); | ||
115 | 116 | ||
116 | int pci_assign_resource(struct pci_dev *dev, int resno) | 117 | int pci_assign_resource(struct pci_dev *dev, int resno) |
117 | { | 118 | { |
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 19bd346951dd..a800fb51168b 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -286,6 +286,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
286 | board_ahci }, /* ICH8M */ | 286 | board_ahci }, /* ICH8M */ |
287 | { PCI_VENDOR_ID_INTEL, 0x282a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 287 | { PCI_VENDOR_ID_INTEL, 0x282a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
288 | board_ahci }, /* ICH8M */ | 288 | board_ahci }, /* ICH8M */ |
289 | { 0x197b, 0x2360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
290 | board_ahci }, /* JMicron JMB360 */ | ||
291 | { 0x197b, 0x2363, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
292 | board_ahci }, /* JMicron JMB363 */ | ||
289 | { } /* terminate list */ | 293 | { } /* terminate list */ |
290 | }; | 294 | }; |
291 | 295 | ||
@@ -802,7 +806,6 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) | |||
802 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); | 806 | struct pci_dev *pdev = to_pci_dev(probe_ent->dev); |
803 | void __iomem *mmio = probe_ent->mmio_base; | 807 | void __iomem *mmio = probe_ent->mmio_base; |
804 | u32 tmp, cap_save; | 808 | u32 tmp, cap_save; |
805 | u16 tmp16; | ||
806 | unsigned int i, j, using_dac; | 809 | unsigned int i, j, using_dac; |
807 | int rc; | 810 | int rc; |
808 | void __iomem *port_mmio; | 811 | void __iomem *port_mmio; |
@@ -836,9 +839,13 @@ static int ahci_host_init(struct ata_probe_ent *probe_ent) | |||
836 | writel(0xf, mmio + HOST_PORTS_IMPL); | 839 | writel(0xf, mmio + HOST_PORTS_IMPL); |
837 | (void) readl(mmio + HOST_PORTS_IMPL); /* flush */ | 840 | (void) readl(mmio + HOST_PORTS_IMPL); /* flush */ |
838 | 841 | ||
839 | pci_read_config_word(pdev, 0x92, &tmp16); | 842 | if (pdev->vendor == PCI_VENDOR_ID_INTEL) { |
840 | tmp16 |= 0xf; | 843 | u16 tmp16; |
841 | pci_write_config_word(pdev, 0x92, tmp16); | 844 | |
845 | pci_read_config_word(pdev, 0x92, &tmp16); | ||
846 | tmp16 |= 0xf; | ||
847 | pci_write_config_word(pdev, 0x92, tmp16); | ||
848 | } | ||
842 | 849 | ||
843 | hpriv->cap = readl(mmio + HOST_CAP); | 850 | hpriv->cap = readl(mmio + HOST_CAP); |
844 | hpriv->port_map = readl(mmio + HOST_PORTS_IMPL); | 851 | hpriv->port_map = readl(mmio + HOST_PORTS_IMPL); |
@@ -1082,6 +1089,10 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1082 | if (have_msi) | 1089 | if (have_msi) |
1083 | hpriv->flags |= AHCI_FLAG_MSI; | 1090 | hpriv->flags |= AHCI_FLAG_MSI; |
1084 | 1091 | ||
1092 | /* JMicron-specific fixup: make sure we're in AHCI mode */ | ||
1093 | if (pdev->vendor == 0x197b) | ||
1094 | pci_write_config_byte(pdev, 0x41, 0xa1); | ||
1095 | |||
1085 | /* initialize adapter */ | 1096 | /* initialize adapter */ |
1086 | rc = ahci_host_init(probe_ent); | 1097 | rc = ahci_host_init(probe_ent); |
1087 | if (rc) | 1098 | if (rc) |
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic79xx b/drivers/scsi/aic7xxx/Kconfig.aic79xx index 69ed77fcb71f..7955ebe8e1e8 100644 --- a/drivers/scsi/aic7xxx/Kconfig.aic79xx +++ b/drivers/scsi/aic7xxx/Kconfig.aic79xx | |||
@@ -37,13 +37,13 @@ config AIC79XX_CMDS_PER_DEVICE | |||
37 | config AIC79XX_RESET_DELAY_MS | 37 | config AIC79XX_RESET_DELAY_MS |
38 | int "Initial bus reset delay in milli-seconds" | 38 | int "Initial bus reset delay in milli-seconds" |
39 | depends on SCSI_AIC79XX | 39 | depends on SCSI_AIC79XX |
40 | default "15000" | 40 | default "5000" |
41 | ---help--- | 41 | ---help--- |
42 | The number of milliseconds to delay after an initial bus reset. | 42 | The number of milliseconds to delay after an initial bus reset. |
43 | The bus settle delay following all error recovery actions is | 43 | The bus settle delay following all error recovery actions is |
44 | dictated by the SCSI layer and is not affected by this value. | 44 | dictated by the SCSI layer and is not affected by this value. |
45 | 45 | ||
46 | Default: 15000 (15 seconds) | 46 | Default: 5000 (5 seconds) |
47 | 47 | ||
48 | config AIC79XX_BUILD_FIRMWARE | 48 | config AIC79XX_BUILD_FIRMWARE |
49 | bool "Build Adapter Firmware with Kernel Build" | 49 | bool "Build Adapter Firmware with Kernel Build" |
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h index 2cfdbef447db..1d11f7e77564 100644 --- a/drivers/scsi/aic7xxx/aic79xx.h +++ b/drivers/scsi/aic7xxx/aic79xx.h | |||
@@ -37,7 +37,7 @@ | |||
37 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 37 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | * POSSIBILITY OF SUCH DAMAGES. | 38 | * POSSIBILITY OF SUCH DAMAGES. |
39 | * | 39 | * |
40 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#108 $ | 40 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.h#109 $ |
41 | * | 41 | * |
42 | * $FreeBSD$ | 42 | * $FreeBSD$ |
43 | */ | 43 | */ |
@@ -222,6 +222,7 @@ typedef enum { | |||
222 | typedef enum { | 222 | typedef enum { |
223 | AHD_FENONE = 0x00000, | 223 | AHD_FENONE = 0x00000, |
224 | AHD_WIDE = 0x00001,/* Wide Channel */ | 224 | AHD_WIDE = 0x00001,/* Wide Channel */ |
225 | AHD_AIC79XXB_SLOWCRC = 0x00002,/* SLOWCRC bit should be set */ | ||
225 | AHD_MULTI_FUNC = 0x00100,/* Multi-Function/Channel Device */ | 226 | AHD_MULTI_FUNC = 0x00100,/* Multi-Function/Channel Device */ |
226 | AHD_TARGETMODE = 0x01000,/* Has tested target mode support */ | 227 | AHD_TARGETMODE = 0x01000,/* Has tested target mode support */ |
227 | AHD_MULTIROLE = 0x02000,/* Space for two roles at a time */ | 228 | AHD_MULTIROLE = 0x02000,/* Space for two roles at a time */ |
diff --git a/drivers/scsi/aic7xxx/aic79xx.reg b/drivers/scsi/aic7xxx/aic79xx.reg index 3a3204703b15..be14e2ecb8f7 100644 --- a/drivers/scsi/aic7xxx/aic79xx.reg +++ b/drivers/scsi/aic7xxx/aic79xx.reg | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Aic79xx register and scratch ram definitions. | 2 | * Aic79xx register and scratch ram definitions. |
3 | * | 3 | * |
4 | * Copyright (c) 1994-2001 Justin T. Gibbs. | 4 | * Copyright (c) 1994-2001, 2004 Justin T. Gibbs. |
5 | * Copyright (c) 2000-2002 Adaptec Inc. | 5 | * Copyright (c) 2000-2002 Adaptec Inc. |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
@@ -39,7 +39,7 @@ | |||
39 | * | 39 | * |
40 | * $FreeBSD$ | 40 | * $FreeBSD$ |
41 | */ | 41 | */ |
42 | VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#76 $" | 42 | VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#77 $" |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * This file is processed by the aic7xxx_asm utility for use in assembling | 45 | * This file is processed by the aic7xxx_asm utility for use in assembling |
@@ -3715,8 +3715,9 @@ scratch_ram { | |||
3715 | 3715 | ||
3716 | SEQ_FLAGS2 { | 3716 | SEQ_FLAGS2 { |
3717 | size 1 | 3717 | size 1 |
3718 | field TARGET_MSG_PENDING 0x02 | 3718 | field PENDING_MK_MESSAGE 0x01 |
3719 | field SELECTOUT_QFROZEN 0x04 | 3719 | field TARGET_MSG_PENDING 0x02 |
3720 | field SELECTOUT_QFROZEN 0x04 | ||
3720 | } | 3721 | } |
3721 | 3722 | ||
3722 | ALLOCFIFO_SCBPTR { | 3723 | ALLOCFIFO_SCBPTR { |
@@ -3777,6 +3778,26 @@ scratch_ram { | |||
3777 | CMDSIZE_TABLE { | 3778 | CMDSIZE_TABLE { |
3778 | size 8 | 3779 | size 8 |
3779 | } | 3780 | } |
3781 | /* | ||
3782 | * When an SCB with the MK_MESSAGE flag is | ||
3783 | * queued to the controller, it cannot enter | ||
3784 | * the waiting for selection list until the | ||
3785 | * selections for any previously queued | ||
3786 | * commands to that target complete. During | ||
3787 | * the wait, the MK_MESSAGE SCB is queued | ||
3788 | * here. | ||
3789 | */ | ||
3790 | MK_MESSAGE_SCB { | ||
3791 | size 2 | ||
3792 | } | ||
3793 | /* | ||
3794 | * Saved SCSIID of MK_MESSAGE_SCB to avoid | ||
3795 | * an extra SCBPTR operation when deciding | ||
3796 | * if the MK_MESSAGE_SCB can be run. | ||
3797 | */ | ||
3798 | MK_MESSAGE_SCSIID { | ||
3799 | size 1 | ||
3800 | } | ||
3780 | } | 3801 | } |
3781 | 3802 | ||
3782 | /************************* Hardware SCB Definition ****************************/ | 3803 | /************************* Hardware SCB Definition ****************************/ |
diff --git a/drivers/scsi/aic7xxx/aic79xx.seq b/drivers/scsi/aic7xxx/aic79xx.seq index bef1f9d369b6..58bc17591b54 100644 --- a/drivers/scsi/aic7xxx/aic79xx.seq +++ b/drivers/scsi/aic7xxx/aic79xx.seq | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Adaptec U320 device driver firmware for Linux and FreeBSD. | 2 | * Adaptec U320 device driver firmware for Linux and FreeBSD. |
3 | * | 3 | * |
4 | * Copyright (c) 1994-2001 Justin T. Gibbs. | 4 | * Copyright (c) 1994-2001, 2004 Justin T. Gibbs. |
5 | * Copyright (c) 2000-2002 Adaptec Inc. | 5 | * Copyright (c) 2000-2002 Adaptec Inc. |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
@@ -40,7 +40,7 @@ | |||
40 | * $FreeBSD$ | 40 | * $FreeBSD$ |
41 | */ | 41 | */ |
42 | 42 | ||
43 | VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#119 $" | 43 | VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#120 $" |
44 | PATCH_ARG_LIST = "struct ahd_softc *ahd" | 44 | PATCH_ARG_LIST = "struct ahd_softc *ahd" |
45 | PREFIX = "ahd_" | 45 | PREFIX = "ahd_" |
46 | 46 | ||
@@ -110,10 +110,8 @@ check_waiting_list: | |||
110 | * one last time. | 110 | * one last time. |
111 | */ | 111 | */ |
112 | test SSTAT0, SELDO jnz select_out; | 112 | test SSTAT0, SELDO jnz select_out; |
113 | END_CRITICAL; | ||
114 | call start_selection; | 113 | call start_selection; |
115 | idle_loop_checkbus: | 114 | idle_loop_checkbus: |
116 | BEGIN_CRITICAL; | ||
117 | test SSTAT0, SELDO jnz select_out; | 115 | test SSTAT0, SELDO jnz select_out; |
118 | END_CRITICAL; | 116 | END_CRITICAL; |
119 | test SSTAT0, SELDI jnz select_in; | 117 | test SSTAT0, SELDI jnz select_in; |
@@ -294,7 +292,6 @@ fetch_new_scb_inprog: | |||
294 | test CCSCBCTL, ARRDONE jz return; | 292 | test CCSCBCTL, ARRDONE jz return; |
295 | fetch_new_scb_done: | 293 | fetch_new_scb_done: |
296 | and CCSCBCTL, ~(CCARREN|CCSCBEN); | 294 | and CCSCBCTL, ~(CCARREN|CCSCBEN); |
297 | bmov REG0, SCBPTR, 2; | ||
298 | clr A; | 295 | clr A; |
299 | add CMDS_PENDING, 1; | 296 | add CMDS_PENDING, 1; |
300 | adc CMDS_PENDING[1], A; | 297 | adc CMDS_PENDING[1], A; |
@@ -316,43 +313,117 @@ fetch_new_scb_done: | |||
316 | clr SCB_FIFO_USE_COUNT; | 313 | clr SCB_FIFO_USE_COUNT; |
317 | /* Update the next SCB address to download. */ | 314 | /* Update the next SCB address to download. */ |
318 | bmov NEXT_QUEUED_SCB_ADDR, SCB_NEXT_SCB_BUSADDR, 4; | 315 | bmov NEXT_QUEUED_SCB_ADDR, SCB_NEXT_SCB_BUSADDR, 4; |
316 | /* | ||
317 | * NULL out the SCB links since these fields | ||
318 | * occupy the same location as SCB_NEXT_SCB_BUSADDR. | ||
319 | */ | ||
319 | mvi SCB_NEXT[1], SCB_LIST_NULL; | 320 | mvi SCB_NEXT[1], SCB_LIST_NULL; |
320 | mvi SCB_NEXT2[1], SCB_LIST_NULL; | 321 | mvi SCB_NEXT2[1], SCB_LIST_NULL; |
321 | /* Increment our position in the QINFIFO. */ | 322 | /* Increment our position in the QINFIFO. */ |
322 | mov NONE, SNSCB_QOFF; | 323 | mov NONE, SNSCB_QOFF; |
324 | |||
323 | /* | 325 | /* |
324 | * SCBs that want to send messages are always | 326 | * Save SCBID of this SCB in REG0 since |
325 | * queued independently. This ensures that they | 327 | * SCBPTR will be clobbered during target |
326 | * are at the head of the SCB list to select out | 328 | * list updates. We also record the SCB's |
327 | * to a target and we will see the MK_MESSAGE flag. | 329 | * flags so that we can refer to them even |
330 | * after SCBPTR has been changed. | ||
331 | */ | ||
332 | bmov REG0, SCBPTR, 2; | ||
333 | mov A, SCB_CONTROL; | ||
334 | |||
335 | /* | ||
336 | * Find the tail SCB of the execution queue | ||
337 | * for this target. | ||
328 | */ | 338 | */ |
329 | test SCB_CONTROL, MK_MESSAGE jnz first_new_target_scb; | ||
330 | shr SINDEX, 3, SCB_SCSIID; | 339 | shr SINDEX, 3, SCB_SCSIID; |
331 | and SINDEX, ~0x1; | 340 | and SINDEX, ~0x1; |
332 | mvi SINDEX[1], (WAITING_SCB_TAILS >> 8); | 341 | mvi SINDEX[1], (WAITING_SCB_TAILS >> 8); |
333 | bmov DINDEX, SINDEX, 2; | 342 | bmov DINDEX, SINDEX, 2; |
334 | bmov SCBPTR, SINDIR, 2; | 343 | bmov SCBPTR, SINDIR, 2; |
344 | |||
345 | /* | ||
346 | * Update the tail to point to the new SCB. | ||
347 | */ | ||
335 | bmov DINDIR, REG0, 2; | 348 | bmov DINDIR, REG0, 2; |
349 | |||
350 | /* | ||
351 | * If the queue was empty, queue this SCB as | ||
352 | * the first for this target. | ||
353 | */ | ||
336 | cmp SCBPTR[1], SCB_LIST_NULL je first_new_target_scb; | 354 | cmp SCBPTR[1], SCB_LIST_NULL je first_new_target_scb; |
355 | |||
356 | /* | ||
357 | * SCBs that want to send messages must always be | ||
358 | * at the head of their per-target queue so that | ||
359 | * ATN can be asserted even if the current | ||
360 | * negotiation agreement is packetized. If the | ||
361 | * target queue is empty, the SCB can be queued | ||
362 | * immediately. If the queue is not empty, we must | ||
363 | * wait for it to empty before entering this SCB | ||
364 | * into the waiting for selection queue. Otherwise | ||
365 | * our batching and round-robin selection scheme | ||
366 | * could allow commands to be queued out of order. | ||
367 | * To simplify the implementation, we stop pulling | ||
368 | * new commands from the host until the MK_MESSAGE | ||
369 | * SCB can be queued to the waiting for selection | ||
370 | * list. | ||
371 | */ | ||
372 | test A, MK_MESSAGE jz batch_scb; | ||
373 | |||
374 | /* | ||
375 | * If the last SCB is also a MK_MESSAGE SCB, then | ||
376 | * order is preserved even if we batch. | ||
377 | */ | ||
378 | test SCB_CONTROL, MK_MESSAGE jz batch_scb; | ||
379 | |||
380 | /* | ||
381 | * Defer this SCB and stop fetching new SCBs until | ||
382 | * it can be queued. Since the SCB_SCSIID of the | ||
383 | * tail SCB must be the same as that of the newly | ||
384 | * queued SCB, there is no need to restore the SCBID | ||
385 | * here. | ||
386 | */ | ||
387 | or SEQ_FLAGS2, PENDING_MK_MESSAGE; | ||
388 | bmov MK_MESSAGE_SCB, REG0, 2; | ||
389 | mov MK_MESSAGE_SCSIID, SCB_SCSIID ret; | ||
390 | |||
391 | batch_scb: | ||
392 | /* | ||
393 | * Otherwise just update the previous tail SCB to | ||
394 | * point to the new tail. | ||
395 | */ | ||
337 | bmov SCB_NEXT, REG0, 2 ret; | 396 | bmov SCB_NEXT, REG0, 2 ret; |
397 | |||
338 | first_new_target_scb: | 398 | first_new_target_scb: |
399 | /* | ||
400 | * Append SCB to the tail of the waiting for | ||
401 | * selection list. | ||
402 | */ | ||
339 | cmp WAITING_TID_HEAD[1], SCB_LIST_NULL je first_new_scb; | 403 | cmp WAITING_TID_HEAD[1], SCB_LIST_NULL je first_new_scb; |
340 | bmov SCBPTR, WAITING_TID_TAIL, 2; | 404 | bmov SCBPTR, WAITING_TID_TAIL, 2; |
341 | bmov SCB_NEXT2, REG0, 2; | 405 | bmov SCB_NEXT2, REG0, 2; |
342 | bmov WAITING_TID_TAIL, REG0, 2 ret; | 406 | bmov WAITING_TID_TAIL, REG0, 2 ret; |
343 | first_new_scb: | 407 | first_new_scb: |
408 | /* | ||
409 | * Whole list is empty, so the head of | ||
410 | * the list must be initialized too. | ||
411 | */ | ||
344 | bmov WAITING_TID_HEAD, REG0, 2; | 412 | bmov WAITING_TID_HEAD, REG0, 2; |
345 | bmov WAITING_TID_TAIL, REG0, 2 ret; | 413 | bmov WAITING_TID_TAIL, REG0, 2 ret; |
346 | END_CRITICAL; | 414 | END_CRITICAL; |
347 | 415 | ||
348 | scbdma_idle: | 416 | scbdma_idle: |
349 | /* | 417 | /* |
350 | * Give precedence to downloading new SCBs to execute | 418 | * Don't bother downloading new SCBs to execute |
351 | * unless select-outs are currently frozen. | 419 | * if select-outs are currently frozen or we have |
420 | * a MK_MESSAGE SCB waiting to enter the queue. | ||
352 | */ | 421 | */ |
353 | test SEQ_FLAGS2, SELECTOUT_QFROZEN jnz . + 2; | 422 | test SEQ_FLAGS2, SELECTOUT_QFROZEN|PENDING_MK_MESSAGE |
423 | jnz scbdma_no_new_scbs; | ||
354 | BEGIN_CRITICAL; | 424 | BEGIN_CRITICAL; |
355 | test QOFF_CTLSTA, NEW_SCB_AVAIL jnz fetch_new_scb; | 425 | test QOFF_CTLSTA, NEW_SCB_AVAIL jnz fetch_new_scb; |
426 | scbdma_no_new_scbs: | ||
356 | cmp COMPLETE_DMA_SCB_HEAD[1], SCB_LIST_NULL jne dma_complete_scb; | 427 | cmp COMPLETE_DMA_SCB_HEAD[1], SCB_LIST_NULL jne dma_complete_scb; |
357 | cmp COMPLETE_SCB_HEAD[1], SCB_LIST_NULL je return; | 428 | cmp COMPLETE_SCB_HEAD[1], SCB_LIST_NULL je return; |
358 | /* FALLTHROUGH */ | 429 | /* FALLTHROUGH */ |
@@ -671,27 +742,41 @@ curscb_ww_done: | |||
671 | } | 742 | } |
672 | 743 | ||
673 | /* | 744 | /* |
674 | * Requeue any SCBs not sent, to the tail of the waiting Q. | 745 | * The whole list made it. Clear our tail pointer to indicate |
746 | * that the per-target selection queue is now empty. | ||
675 | */ | 747 | */ |
676 | cmp SCB_NEXT[1], SCB_LIST_NULL je select_out_list_done; | 748 | cmp SCB_NEXT[1], SCB_LIST_NULL je select_out_clear_tail; |
677 | 749 | ||
678 | /* | 750 | /* |
751 | * Requeue any SCBs not sent, to the tail of the waiting Q. | ||
679 | * We know that neither the per-TID list nor the list of | 752 | * We know that neither the per-TID list nor the list of |
680 | * TIDs is empty. Use this knowledge to our advantage. | 753 | * TIDs is empty. Use this knowledge to our advantage and |
754 | * queue the remainder to the tail of the global execution | ||
755 | * queue. | ||
681 | */ | 756 | */ |
682 | bmov REG0, SCB_NEXT, 2; | 757 | bmov REG0, SCB_NEXT, 2; |
758 | select_out_queue_remainder: | ||
683 | bmov SCBPTR, WAITING_TID_TAIL, 2; | 759 | bmov SCBPTR, WAITING_TID_TAIL, 2; |
684 | bmov SCB_NEXT2, REG0, 2; | 760 | bmov SCB_NEXT2, REG0, 2; |
685 | bmov WAITING_TID_TAIL, REG0, 2; | 761 | bmov WAITING_TID_TAIL, REG0, 2; |
686 | jmp select_out_inc_tid_q; | 762 | jmp select_out_inc_tid_q; |
687 | 763 | ||
688 | select_out_list_done: | 764 | select_out_clear_tail: |
765 | /* | ||
766 | * Queue any pending MK_MESSAGE SCB for this target now | ||
767 | * that the queue is empty. | ||
768 | */ | ||
769 | test SEQ_FLAGS2, PENDING_MK_MESSAGE jz select_out_no_mk_message_scb; | ||
770 | mov A, MK_MESSAGE_SCSIID; | ||
771 | cmp SCB_SCSIID, A jne select_out_no_mk_message_scb; | ||
772 | and SEQ_FLAGS2, ~PENDING_MK_MESSAGE; | ||
773 | bmov REG0, MK_MESSAGE_SCB, 2; | ||
774 | jmp select_out_queue_remainder; | ||
775 | |||
776 | select_out_no_mk_message_scb: | ||
689 | /* | 777 | /* |
690 | * The whole list made it. Just clear our TID's tail pointer | 778 | * Clear this target's execution tail and increment the queue. |
691 | * unless we were queued independently due to our need to | ||
692 | * send a message. | ||
693 | */ | 779 | */ |
694 | test SCB_CONTROL, MK_MESSAGE jnz select_out_inc_tid_q; | ||
695 | shr DINDEX, 3, SCB_SCSIID; | 780 | shr DINDEX, 3, SCB_SCSIID; |
696 | or DINDEX, 1; /* Want only the second byte */ | 781 | or DINDEX, 1; /* Want only the second byte */ |
697 | mvi DINDEX[1], ((WAITING_SCB_TAILS) >> 8); | 782 | mvi DINDEX[1], ((WAITING_SCB_TAILS) >> 8); |
@@ -703,8 +788,8 @@ select_out_inc_tid_q: | |||
703 | mvi WAITING_TID_TAIL[1], SCB_LIST_NULL; | 788 | mvi WAITING_TID_TAIL[1], SCB_LIST_NULL; |
704 | bmov SCBPTR, CURRSCB, 2; | 789 | bmov SCBPTR, CURRSCB, 2; |
705 | mvi CLRSINT0, CLRSELDO; | 790 | mvi CLRSINT0, CLRSELDO; |
706 | test LQOSTAT2, LQOPHACHGOUTPKT jnz unexpected_nonpkt_phase; | 791 | test LQOSTAT2, LQOPHACHGOUTPKT jnz unexpected_nonpkt_mode_cleared; |
707 | test LQOSTAT1, LQOPHACHGINPKT jnz unexpected_nonpkt_phase; | 792 | test LQOSTAT1, LQOPHACHGINPKT jnz unexpected_nonpkt_mode_cleared; |
708 | 793 | ||
709 | /* | 794 | /* |
710 | * If this is a packetized connection, return to our | 795 | * If this is a packetized connection, return to our |
@@ -2127,6 +2212,18 @@ SET_DST_MODE M_DFF0; | |||
2127 | mvi DFFSXFRCTL, CLRCHN; | 2212 | mvi DFFSXFRCTL, CLRCHN; |
2128 | unexpected_nonpkt_mode_cleared: | 2213 | unexpected_nonpkt_mode_cleared: |
2129 | mvi CLRSINT2, CLRNONPACKREQ; | 2214 | mvi CLRSINT2, CLRNONPACKREQ; |
2215 | if ((ahd->bugs & AHD_BUSFREEREV_BUG) != 0) { | ||
2216 | /* | ||
2217 | * Test to ensure that the bus has not | ||
2218 | * already gone free prior to clearing | ||
2219 | * any stale busfree status. This avoids | ||
2220 | * a window whereby a busfree just after | ||
2221 | * a selection could be missed. | ||
2222 | */ | ||
2223 | test SCSISIGI, BSYI jz . + 2; | ||
2224 | mvi CLRSINT1,CLRBUSFREE; | ||
2225 | or SIMODE1, ENBUSFREE; | ||
2226 | } | ||
2130 | test SCSIPHASE, ~(MSG_IN_PHASE|MSG_OUT_PHASE) jnz illegal_phase; | 2227 | test SCSIPHASE, ~(MSG_IN_PHASE|MSG_OUT_PHASE) jnz illegal_phase; |
2131 | SET_SEQINTCODE(ENTERING_NONPACK) | 2228 | SET_SEQINTCODE(ENTERING_NONPACK) |
2132 | jmp ITloop; | 2229 | jmp ITloop; |
diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index db8f5ce99ee3..342f77966a5b 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c | |||
@@ -37,7 +37,7 @@ | |||
37 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 37 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | * POSSIBILITY OF SUCH DAMAGES. | 38 | * POSSIBILITY OF SUCH DAMAGES. |
39 | * | 39 | * |
40 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#247 $ | 40 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.c#250 $ |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #ifdef __linux__ | 43 | #ifdef __linux__ |
@@ -197,7 +197,8 @@ static int ahd_search_scb_list(struct ahd_softc *ahd, int target, | |||
197 | char channel, int lun, u_int tag, | 197 | char channel, int lun, u_int tag, |
198 | role_t role, uint32_t status, | 198 | role_t role, uint32_t status, |
199 | ahd_search_action action, | 199 | ahd_search_action action, |
200 | u_int *list_head, u_int tid); | 200 | u_int *list_head, u_int *list_tail, |
201 | u_int tid); | ||
201 | static void ahd_stitch_tid_list(struct ahd_softc *ahd, | 202 | static void ahd_stitch_tid_list(struct ahd_softc *ahd, |
202 | u_int tid_prev, u_int tid_cur, | 203 | u_int tid_prev, u_int tid_cur, |
203 | u_int tid_next); | 204 | u_int tid_next); |
@@ -1660,7 +1661,8 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat) | |||
1660 | * so just clear the error. | 1661 | * so just clear the error. |
1661 | */ | 1662 | */ |
1662 | ahd_outb(ahd, CLRLQIINT1, CLRLQICRCI_NLQ); | 1663 | ahd_outb(ahd, CLRLQIINT1, CLRLQICRCI_NLQ); |
1663 | } else if ((status & BUSFREE) != 0) { | 1664 | } else if ((status & BUSFREE) != 0 |
1665 | || (lqistat1 & LQOBUSFREE) != 0) { | ||
1664 | u_int lqostat1; | 1666 | u_int lqostat1; |
1665 | int restart; | 1667 | int restart; |
1666 | int clear_fifo; | 1668 | int clear_fifo; |
@@ -2025,10 +2027,6 @@ ahd_handle_pkt_busfree(struct ahd_softc *ahd, u_int busfreetime) | |||
2025 | u_int waiting_t; | 2027 | u_int waiting_t; |
2026 | u_int next; | 2028 | u_int next; |
2027 | 2029 | ||
2028 | if ((busfreetime & BUSFREE_LQO) == 0) | ||
2029 | printf("%s: Warning, BUSFREE time is 0x%x. " | ||
2030 | "Expected BUSFREE_LQO.\n", | ||
2031 | ahd_name(ahd), busfreetime); | ||
2032 | /* | 2030 | /* |
2033 | * The LQO manager detected an unexpected busfree | 2031 | * The LQO manager detected an unexpected busfree |
2034 | * either: | 2032 | * either: |
@@ -2251,8 +2249,14 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd) | |||
2251 | struct ahd_tmode_tstate *tstate; | 2249 | struct ahd_tmode_tstate *tstate; |
2252 | 2250 | ||
2253 | /* | 2251 | /* |
2254 | * PPR Rejected. Try non-ppr negotiation | 2252 | * PPR Rejected. |
2255 | * and retry command. | 2253 | * |
2254 | * If the previous negotiation was packetized, | ||
2255 | * this could be because the device has been | ||
2256 | * reset without our knowledge. Force our | ||
2257 | * current negotiation to async and retry the | ||
2258 | * negotiation. Otherwise retry the command | ||
2259 | * with non-ppr negotiation. | ||
2256 | */ | 2260 | */ |
2257 | #ifdef AHD_DEBUG | 2261 | #ifdef AHD_DEBUG |
2258 | if ((ahd_debug & AHD_SHOW_MESSAGES) != 0) | 2262 | if ((ahd_debug & AHD_SHOW_MESSAGES) != 0) |
@@ -2261,11 +2265,34 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd) | |||
2261 | tinfo = ahd_fetch_transinfo(ahd, devinfo.channel, | 2265 | tinfo = ahd_fetch_transinfo(ahd, devinfo.channel, |
2262 | devinfo.our_scsiid, | 2266 | devinfo.our_scsiid, |
2263 | devinfo.target, &tstate); | 2267 | devinfo.target, &tstate); |
2264 | tinfo->curr.transport_version = 2; | 2268 | if ((tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ)!=0) { |
2265 | tinfo->goal.transport_version = 2; | 2269 | ahd_set_width(ahd, &devinfo, |
2266 | tinfo->goal.ppr_options = 0; | 2270 | MSG_EXT_WDTR_BUS_8_BIT, |
2267 | ahd_qinfifo_requeue_tail(ahd, scb); | 2271 | AHD_TRANS_CUR, |
2268 | printerror = 0; | 2272 | /*paused*/TRUE); |
2273 | ahd_set_syncrate(ahd, &devinfo, | ||
2274 | /*period*/0, /*offset*/0, | ||
2275 | /*ppr_options*/0, | ||
2276 | AHD_TRANS_CUR, | ||
2277 | /*paused*/TRUE); | ||
2278 | /* | ||
2279 | * The expect PPR busfree handler below | ||
2280 | * will effect the retry and necessary | ||
2281 | * abort. | ||
2282 | */ | ||
2283 | } else { | ||
2284 | tinfo->curr.transport_version = 2; | ||
2285 | tinfo->goal.transport_version = 2; | ||
2286 | tinfo->goal.ppr_options = 0; | ||
2287 | /* | ||
2288 | * Remove any SCBs in the waiting for selection | ||
2289 | * queue that may also be for this target so | ||
2290 | * that command ordering is preserved. | ||
2291 | */ | ||
2292 | ahd_freeze_devq(ahd, scb); | ||
2293 | ahd_qinfifo_requeue_tail(ahd, scb); | ||
2294 | printerror = 0; | ||
2295 | } | ||
2269 | } else if (ahd_sent_msg(ahd, AHDMSG_EXT, MSG_EXT_WDTR, FALSE) | 2296 | } else if (ahd_sent_msg(ahd, AHDMSG_EXT, MSG_EXT_WDTR, FALSE) |
2270 | && ppr_busfree == 0) { | 2297 | && ppr_busfree == 0) { |
2271 | /* | 2298 | /* |
@@ -2280,6 +2307,12 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd) | |||
2280 | MSG_EXT_WDTR_BUS_8_BIT, | 2307 | MSG_EXT_WDTR_BUS_8_BIT, |
2281 | AHD_TRANS_CUR|AHD_TRANS_GOAL, | 2308 | AHD_TRANS_CUR|AHD_TRANS_GOAL, |
2282 | /*paused*/TRUE); | 2309 | /*paused*/TRUE); |
2310 | /* | ||
2311 | * Remove any SCBs in the waiting for selection | ||
2312 | * queue that may also be for this target so that | ||
2313 | * command ordering is preserved. | ||
2314 | */ | ||
2315 | ahd_freeze_devq(ahd, scb); | ||
2283 | ahd_qinfifo_requeue_tail(ahd, scb); | 2316 | ahd_qinfifo_requeue_tail(ahd, scb); |
2284 | printerror = 0; | 2317 | printerror = 0; |
2285 | } else if (ahd_sent_msg(ahd, AHDMSG_EXT, MSG_EXT_SDTR, FALSE) | 2318 | } else if (ahd_sent_msg(ahd, AHDMSG_EXT, MSG_EXT_SDTR, FALSE) |
@@ -2297,6 +2330,12 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd) | |||
2297 | /*ppr_options*/0, | 2330 | /*ppr_options*/0, |
2298 | AHD_TRANS_CUR|AHD_TRANS_GOAL, | 2331 | AHD_TRANS_CUR|AHD_TRANS_GOAL, |
2299 | /*paused*/TRUE); | 2332 | /*paused*/TRUE); |
2333 | /* | ||
2334 | * Remove any SCBs in the waiting for selection | ||
2335 | * queue that may also be for this target so that | ||
2336 | * command ordering is preserved. | ||
2337 | */ | ||
2338 | ahd_freeze_devq(ahd, scb); | ||
2300 | ahd_qinfifo_requeue_tail(ahd, scb); | 2339 | ahd_qinfifo_requeue_tail(ahd, scb); |
2301 | printerror = 0; | 2340 | printerror = 0; |
2302 | } else if ((ahd->msg_flags & MSG_FLAG_EXPECT_IDE_BUSFREE) != 0 | 2341 | } else if ((ahd->msg_flags & MSG_FLAG_EXPECT_IDE_BUSFREE) != 0 |
@@ -2369,14 +2408,14 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd) | |||
2369 | */ | 2408 | */ |
2370 | printf("%s: ", ahd_name(ahd)); | 2409 | printf("%s: ", ahd_name(ahd)); |
2371 | } | 2410 | } |
2372 | if (lastphase != P_BUSFREE) | ||
2373 | ahd_force_renegotiation(ahd, &devinfo); | ||
2374 | printf("Unexpected busfree %s, %d SCBs aborted, " | 2411 | printf("Unexpected busfree %s, %d SCBs aborted, " |
2375 | "PRGMCNT == 0x%x\n", | 2412 | "PRGMCNT == 0x%x\n", |
2376 | ahd_lookup_phase_entry(lastphase)->phasemsg, | 2413 | ahd_lookup_phase_entry(lastphase)->phasemsg, |
2377 | aborted, | 2414 | aborted, |
2378 | ahd_inw(ahd, PRGMCNT)); | 2415 | ahd_inw(ahd, PRGMCNT)); |
2379 | ahd_dump_card_state(ahd); | 2416 | ahd_dump_card_state(ahd); |
2417 | if (lastphase != P_BUSFREE) | ||
2418 | ahd_force_renegotiation(ahd, &devinfo); | ||
2380 | } | 2419 | } |
2381 | /* Always restart the sequencer. */ | 2420 | /* Always restart the sequencer. */ |
2382 | return (1); | 2421 | return (1); |
@@ -3293,6 +3332,15 @@ ahd_update_neg_table(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, | |||
3293 | con_opts |= WIDEXFER; | 3332 | con_opts |= WIDEXFER; |
3294 | 3333 | ||
3295 | /* | 3334 | /* |
3335 | * Slow down our CRC interval to be | ||
3336 | * compatible with packetized U320 devices | ||
3337 | * that can't handle a CRC at full speed | ||
3338 | */ | ||
3339 | if (ahd->features & AHD_AIC79XXB_SLOWCRC) { | ||
3340 | con_opts |= ENSLOWCRC; | ||
3341 | } | ||
3342 | |||
3343 | /* | ||
3296 | * During packetized transfers, the target will | 3344 | * During packetized transfers, the target will |
3297 | * give us the oportunity to send command packets | 3345 | * give us the oportunity to send command packets |
3298 | * without us asserting attention. | 3346 | * without us asserting attention. |
@@ -3315,7 +3363,6 @@ ahd_update_pending_scbs(struct ahd_softc *ahd) | |||
3315 | { | 3363 | { |
3316 | struct scb *pending_scb; | 3364 | struct scb *pending_scb; |
3317 | int pending_scb_count; | 3365 | int pending_scb_count; |
3318 | u_int scb_tag; | ||
3319 | int paused; | 3366 | int paused; |
3320 | u_int saved_scbptr; | 3367 | u_int saved_scbptr; |
3321 | ahd_mode_state saved_modes; | 3368 | ahd_mode_state saved_modes; |
@@ -3333,7 +3380,6 @@ ahd_update_pending_scbs(struct ahd_softc *ahd) | |||
3333 | pending_scb_count = 0; | 3380 | pending_scb_count = 0; |
3334 | LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) { | 3381 | LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) { |
3335 | struct ahd_devinfo devinfo; | 3382 | struct ahd_devinfo devinfo; |
3336 | struct hardware_scb *pending_hscb; | ||
3337 | struct ahd_initiator_tinfo *tinfo; | 3383 | struct ahd_initiator_tinfo *tinfo; |
3338 | struct ahd_tmode_tstate *tstate; | 3384 | struct ahd_tmode_tstate *tstate; |
3339 | 3385 | ||
@@ -3341,11 +3387,10 @@ ahd_update_pending_scbs(struct ahd_softc *ahd) | |||
3341 | tinfo = ahd_fetch_transinfo(ahd, devinfo.channel, | 3387 | tinfo = ahd_fetch_transinfo(ahd, devinfo.channel, |
3342 | devinfo.our_scsiid, | 3388 | devinfo.our_scsiid, |
3343 | devinfo.target, &tstate); | 3389 | devinfo.target, &tstate); |
3344 | pending_hscb = pending_scb->hscb; | ||
3345 | if ((tstate->auto_negotiate & devinfo.target_mask) == 0 | 3390 | if ((tstate->auto_negotiate & devinfo.target_mask) == 0 |
3346 | && (pending_scb->flags & SCB_AUTO_NEGOTIATE) != 0) { | 3391 | && (pending_scb->flags & SCB_AUTO_NEGOTIATE) != 0) { |
3347 | pending_scb->flags &= ~SCB_AUTO_NEGOTIATE; | 3392 | pending_scb->flags &= ~SCB_AUTO_NEGOTIATE; |
3348 | pending_hscb->control &= ~MK_MESSAGE; | 3393 | pending_scb->hscb->control &= ~MK_MESSAGE; |
3349 | } | 3394 | } |
3350 | ahd_sync_scb(ahd, pending_scb, | 3395 | ahd_sync_scb(ahd, pending_scb, |
3351 | BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); | 3396 | BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); |
@@ -3377,18 +3422,15 @@ ahd_update_pending_scbs(struct ahd_softc *ahd) | |||
3377 | ahd_outb(ahd, SCSISEQ0, ahd_inb(ahd, SCSISEQ0) & ~ENSELO); | 3422 | ahd_outb(ahd, SCSISEQ0, ahd_inb(ahd, SCSISEQ0) & ~ENSELO); |
3378 | saved_scbptr = ahd_get_scbptr(ahd); | 3423 | saved_scbptr = ahd_get_scbptr(ahd); |
3379 | /* Ensure that the hscbs down on the card match the new information */ | 3424 | /* Ensure that the hscbs down on the card match the new information */ |
3380 | for (scb_tag = 0; scb_tag < ahd->scb_data.maxhscbs; scb_tag++) { | 3425 | LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) { |
3381 | struct hardware_scb *pending_hscb; | 3426 | u_int scb_tag; |
3382 | u_int control; | 3427 | u_int control; |
3383 | 3428 | ||
3384 | pending_scb = ahd_lookup_scb(ahd, scb_tag); | 3429 | scb_tag = SCB_GET_TAG(pending_scb); |
3385 | if (pending_scb == NULL) | ||
3386 | continue; | ||
3387 | ahd_set_scbptr(ahd, scb_tag); | 3430 | ahd_set_scbptr(ahd, scb_tag); |
3388 | pending_hscb = pending_scb->hscb; | ||
3389 | control = ahd_inb_scbram(ahd, SCB_CONTROL); | 3431 | control = ahd_inb_scbram(ahd, SCB_CONTROL); |
3390 | control &= ~MK_MESSAGE; | 3432 | control &= ~MK_MESSAGE; |
3391 | control |= pending_hscb->control & MK_MESSAGE; | 3433 | control |= pending_scb->hscb->control & MK_MESSAGE; |
3392 | ahd_outb(ahd, SCB_CONTROL, control); | 3434 | ahd_outb(ahd, SCB_CONTROL, control); |
3393 | } | 3435 | } |
3394 | ahd_set_scbptr(ahd, saved_scbptr); | 3436 | ahd_set_scbptr(ahd, saved_scbptr); |
@@ -6500,13 +6542,14 @@ ahd_chip_init(struct ahd_softc *ahd) | |||
6500 | | ENLQIOVERI_LQ|ENLQIOVERI_NLQ); | 6542 | | ENLQIOVERI_LQ|ENLQIOVERI_NLQ); |
6501 | ahd_outb(ahd, LQOMODE0, ENLQOATNLQ|ENLQOATNPKT|ENLQOTCRC); | 6543 | ahd_outb(ahd, LQOMODE0, ENLQOATNLQ|ENLQOATNPKT|ENLQOTCRC); |
6502 | /* | 6544 | /* |
6503 | * An interrupt from LQOBUSFREE is made redundant by the | 6545 | * We choose to have the sequencer catch LQOPHCHGINPKT errors |
6504 | * BUSFREE interrupt. We choose to have the sequencer catch | 6546 | * manually for the command phase at the start of a packetized |
6505 | * LQOPHCHGINPKT errors manually for the command phase at the | 6547 | * selection case. ENLQOBUSFREE should be made redundant by |
6506 | * start of a packetized selection case. | 6548 | * the BUSFREE interrupt, but it seems that some LQOBUSFREE |
6507 | ahd_outb(ahd, LQOMODE1, ENLQOBUSFREE|ENLQOPHACHGINPKT); | 6549 | * events fail to assert the BUSFREE interrupt so we must |
6550 | * also enable LQOBUSFREE interrupts. | ||
6508 | */ | 6551 | */ |
6509 | ahd_outb(ahd, LQOMODE1, 0); | 6552 | ahd_outb(ahd, LQOMODE1, ENLQOBUSFREE); |
6510 | 6553 | ||
6511 | /* | 6554 | /* |
6512 | * Setup sequencer interrupt handlers. | 6555 | * Setup sequencer interrupt handlers. |
@@ -6617,6 +6660,8 @@ ahd_chip_init(struct ahd_softc *ahd) | |||
6617 | /* We don't have any waiting selections */ | 6660 | /* We don't have any waiting selections */ |
6618 | ahd_outw(ahd, WAITING_TID_HEAD, SCB_LIST_NULL); | 6661 | ahd_outw(ahd, WAITING_TID_HEAD, SCB_LIST_NULL); |
6619 | ahd_outw(ahd, WAITING_TID_TAIL, SCB_LIST_NULL); | 6662 | ahd_outw(ahd, WAITING_TID_TAIL, SCB_LIST_NULL); |
6663 | ahd_outw(ahd, MK_MESSAGE_SCB, SCB_LIST_NULL); | ||
6664 | ahd_outw(ahd, MK_MESSAGE_SCSIID, 0xFF); | ||
6620 | for (i = 0; i < AHD_NUM_TARGETS; i++) | 6665 | for (i = 0; i < AHD_NUM_TARGETS; i++) |
6621 | ahd_outw(ahd, WAITING_SCB_TAILS + (2 * i), SCB_LIST_NULL); | 6666 | ahd_outw(ahd, WAITING_SCB_TAILS + (2 * i), SCB_LIST_NULL); |
6622 | 6667 | ||
@@ -6704,6 +6749,18 @@ ahd_chip_init(struct ahd_softc *ahd) | |||
6704 | 6749 | ||
6705 | ahd_loadseq(ahd); | 6750 | ahd_loadseq(ahd); |
6706 | ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); | 6751 | ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); |
6752 | |||
6753 | if (ahd->features & AHD_AIC79XXB_SLOWCRC) { | ||
6754 | u_int negodat3 = ahd_inb(ahd, NEGCONOPTS); | ||
6755 | |||
6756 | negodat3 |= ENSLOWCRC; | ||
6757 | ahd_outb(ahd, NEGCONOPTS, negodat3); | ||
6758 | negodat3 = ahd_inb(ahd, NEGCONOPTS); | ||
6759 | if (!(negodat3 & ENSLOWCRC)) | ||
6760 | printf("aic79xx: failed to set the SLOWCRC bit\n"); | ||
6761 | else | ||
6762 | printf("aic79xx: SLOWCRC bit set\n"); | ||
6763 | } | ||
6707 | } | 6764 | } |
6708 | 6765 | ||
6709 | /* | 6766 | /* |
@@ -7260,12 +7317,28 @@ ahd_reset_cmds_pending(struct ahd_softc *ahd) | |||
7260 | ahd->flags &= ~AHD_UPDATE_PEND_CMDS; | 7317 | ahd->flags &= ~AHD_UPDATE_PEND_CMDS; |
7261 | } | 7318 | } |
7262 | 7319 | ||
7320 | void | ||
7321 | ahd_done_with_status(struct ahd_softc *ahd, struct scb *scb, uint32_t status) | ||
7322 | { | ||
7323 | cam_status ostat; | ||
7324 | cam_status cstat; | ||
7325 | |||
7326 | ostat = ahd_get_transaction_status(scb); | ||
7327 | if (ostat == CAM_REQ_INPROG) | ||
7328 | ahd_set_transaction_status(scb, status); | ||
7329 | cstat = ahd_get_transaction_status(scb); | ||
7330 | if (cstat != CAM_REQ_CMP) | ||
7331 | ahd_freeze_scb(scb); | ||
7332 | ahd_done(ahd, scb); | ||
7333 | } | ||
7334 | |||
7263 | int | 7335 | int |
7264 | ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, | 7336 | ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, |
7265 | int lun, u_int tag, role_t role, uint32_t status, | 7337 | int lun, u_int tag, role_t role, uint32_t status, |
7266 | ahd_search_action action) | 7338 | ahd_search_action action) |
7267 | { | 7339 | { |
7268 | struct scb *scb; | 7340 | struct scb *scb; |
7341 | struct scb *mk_msg_scb; | ||
7269 | struct scb *prev_scb; | 7342 | struct scb *prev_scb; |
7270 | ahd_mode_state saved_modes; | 7343 | ahd_mode_state saved_modes; |
7271 | u_int qinstart; | 7344 | u_int qinstart; |
@@ -7274,6 +7347,7 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, | |||
7274 | u_int tid_next; | 7347 | u_int tid_next; |
7275 | u_int tid_prev; | 7348 | u_int tid_prev; |
7276 | u_int scbid; | 7349 | u_int scbid; |
7350 | u_int seq_flags2; | ||
7277 | u_int savedscbptr; | 7351 | u_int savedscbptr; |
7278 | uint32_t busaddr; | 7352 | uint32_t busaddr; |
7279 | int found; | 7353 | int found; |
@@ -7329,23 +7403,10 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, | |||
7329 | found++; | 7403 | found++; |
7330 | switch (action) { | 7404 | switch (action) { |
7331 | case SEARCH_COMPLETE: | 7405 | case SEARCH_COMPLETE: |
7332 | { | ||
7333 | cam_status ostat; | ||
7334 | cam_status cstat; | ||
7335 | |||
7336 | ostat = ahd_get_transaction_status(scb); | ||
7337 | if (ostat == CAM_REQ_INPROG) | ||
7338 | ahd_set_transaction_status(scb, | ||
7339 | status); | ||
7340 | cstat = ahd_get_transaction_status(scb); | ||
7341 | if (cstat != CAM_REQ_CMP) | ||
7342 | ahd_freeze_scb(scb); | ||
7343 | if ((scb->flags & SCB_ACTIVE) == 0) | 7406 | if ((scb->flags & SCB_ACTIVE) == 0) |
7344 | printf("Inactive SCB in qinfifo\n"); | 7407 | printf("Inactive SCB in qinfifo\n"); |
7345 | ahd_done(ahd, scb); | 7408 | ahd_done_with_status(ahd, scb, status); |
7346 | |||
7347 | /* FALLTHROUGH */ | 7409 | /* FALLTHROUGH */ |
7348 | } | ||
7349 | case SEARCH_REMOVE: | 7410 | case SEARCH_REMOVE: |
7350 | break; | 7411 | break; |
7351 | case SEARCH_PRINT: | 7412 | case SEARCH_PRINT: |
@@ -7375,21 +7436,24 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, | |||
7375 | * looking for matches. | 7436 | * looking for matches. |
7376 | */ | 7437 | */ |
7377 | ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); | 7438 | ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); |
7439 | seq_flags2 = ahd_inb(ahd, SEQ_FLAGS2); | ||
7440 | if ((seq_flags2 & PENDING_MK_MESSAGE) != 0) { | ||
7441 | scbid = ahd_inw(ahd, MK_MESSAGE_SCB); | ||
7442 | mk_msg_scb = ahd_lookup_scb(ahd, scbid); | ||
7443 | } else | ||
7444 | mk_msg_scb = NULL; | ||
7378 | savedscbptr = ahd_get_scbptr(ahd); | 7445 | savedscbptr = ahd_get_scbptr(ahd); |
7379 | tid_next = ahd_inw(ahd, WAITING_TID_HEAD); | 7446 | tid_next = ahd_inw(ahd, WAITING_TID_HEAD); |
7380 | tid_prev = SCB_LIST_NULL; | 7447 | tid_prev = SCB_LIST_NULL; |
7381 | targets = 0; | 7448 | targets = 0; |
7382 | for (scbid = tid_next; !SCBID_IS_NULL(scbid); scbid = tid_next) { | 7449 | for (scbid = tid_next; !SCBID_IS_NULL(scbid); scbid = tid_next) { |
7383 | u_int tid_head; | 7450 | u_int tid_head; |
7451 | u_int tid_tail; | ||
7384 | 7452 | ||
7385 | /* | ||
7386 | * We limit based on the number of SCBs since | ||
7387 | * MK_MESSAGE SCBs are not in the per-tid lists. | ||
7388 | */ | ||
7389 | targets++; | 7453 | targets++; |
7390 | if (targets > AHD_SCB_MAX) { | 7454 | if (targets > AHD_NUM_TARGETS) |
7391 | panic("TID LIST LOOP"); | 7455 | panic("TID LIST LOOP"); |
7392 | } | 7456 | |
7393 | if (scbid >= ahd->scb_data.numscbs) { | 7457 | if (scbid >= ahd->scb_data.numscbs) { |
7394 | printf("%s: Waiting TID List inconsistency. " | 7458 | printf("%s: Waiting TID List inconsistency. " |
7395 | "SCB index == 0x%x, yet numscbs == 0x%x.", | 7459 | "SCB index == 0x%x, yet numscbs == 0x%x.", |
@@ -7419,8 +7483,71 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, | |||
7419 | tid_head = scbid; | 7483 | tid_head = scbid; |
7420 | found += ahd_search_scb_list(ahd, target, channel, | 7484 | found += ahd_search_scb_list(ahd, target, channel, |
7421 | lun, tag, role, status, | 7485 | lun, tag, role, status, |
7422 | action, &tid_head, | 7486 | action, &tid_head, &tid_tail, |
7423 | SCB_GET_TARGET(ahd, scb)); | 7487 | SCB_GET_TARGET(ahd, scb)); |
7488 | /* | ||
7489 | * Check any MK_MESSAGE SCB that is still waiting to | ||
7490 | * enter this target's waiting for selection queue. | ||
7491 | */ | ||
7492 | if (mk_msg_scb != NULL | ||
7493 | && ahd_match_scb(ahd, mk_msg_scb, target, channel, | ||
7494 | lun, tag, role)) { | ||
7495 | |||
7496 | /* | ||
7497 | * We found an scb that needs to be acted on. | ||
7498 | */ | ||
7499 | found++; | ||
7500 | switch (action) { | ||
7501 | case SEARCH_COMPLETE: | ||
7502 | if ((mk_msg_scb->flags & SCB_ACTIVE) == 0) | ||
7503 | printf("Inactive SCB pending MK_MSG\n"); | ||
7504 | ahd_done_with_status(ahd, mk_msg_scb, status); | ||
7505 | /* FALLTHROUGH */ | ||
7506 | case SEARCH_REMOVE: | ||
7507 | { | ||
7508 | u_int tail_offset; | ||
7509 | |||
7510 | printf("Removing MK_MSG scb\n"); | ||
7511 | |||
7512 | /* | ||
7513 | * Reset our tail to the tail of the | ||
7514 | * main per-target list. | ||
7515 | */ | ||
7516 | tail_offset = WAITING_SCB_TAILS | ||
7517 | + (2 * SCB_GET_TARGET(ahd, mk_msg_scb)); | ||
7518 | ahd_outw(ahd, tail_offset, tid_tail); | ||
7519 | |||
7520 | seq_flags2 &= ~PENDING_MK_MESSAGE; | ||
7521 | ahd_outb(ahd, SEQ_FLAGS2, seq_flags2); | ||
7522 | ahd_outw(ahd, CMDS_PENDING, | ||
7523 | ahd_inw(ahd, CMDS_PENDING)-1); | ||
7524 | mk_msg_scb = NULL; | ||
7525 | break; | ||
7526 | } | ||
7527 | case SEARCH_PRINT: | ||
7528 | printf(" 0x%x", SCB_GET_TAG(scb)); | ||
7529 | /* FALLTHROUGH */ | ||
7530 | case SEARCH_COUNT: | ||
7531 | break; | ||
7532 | } | ||
7533 | } | ||
7534 | |||
7535 | if (mk_msg_scb != NULL | ||
7536 | && SCBID_IS_NULL(tid_head) | ||
7537 | && ahd_match_scb(ahd, scb, target, channel, CAM_LUN_WILDCARD, | ||
7538 | SCB_LIST_NULL, ROLE_UNKNOWN)) { | ||
7539 | |||
7540 | /* | ||
7541 | * When removing the last SCB for a target | ||
7542 | * queue with a pending MK_MESSAGE scb, we | ||
7543 | * must queue the MK_MESSAGE scb. | ||
7544 | */ | ||
7545 | printf("Queueing mk_msg_scb\n"); | ||
7546 | tid_head = ahd_inw(ahd, MK_MESSAGE_SCB); | ||
7547 | seq_flags2 &= ~PENDING_MK_MESSAGE; | ||
7548 | ahd_outb(ahd, SEQ_FLAGS2, seq_flags2); | ||
7549 | mk_msg_scb = NULL; | ||
7550 | } | ||
7424 | if (tid_head != scbid) | 7551 | if (tid_head != scbid) |
7425 | ahd_stitch_tid_list(ahd, tid_prev, tid_head, tid_next); | 7552 | ahd_stitch_tid_list(ahd, tid_prev, tid_head, tid_next); |
7426 | if (!SCBID_IS_NULL(tid_head)) | 7553 | if (!SCBID_IS_NULL(tid_head)) |
@@ -7428,6 +7555,8 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, | |||
7428 | if (action == SEARCH_PRINT) | 7555 | if (action == SEARCH_PRINT) |
7429 | printf(")\n"); | 7556 | printf(")\n"); |
7430 | } | 7557 | } |
7558 | |||
7559 | /* Restore saved state. */ | ||
7431 | ahd_set_scbptr(ahd, savedscbptr); | 7560 | ahd_set_scbptr(ahd, savedscbptr); |
7432 | ahd_restore_modes(ahd, saved_modes); | 7561 | ahd_restore_modes(ahd, saved_modes); |
7433 | return (found); | 7562 | return (found); |
@@ -7436,7 +7565,8 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, | |||
7436 | static int | 7565 | static int |
7437 | ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel, | 7566 | ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel, |
7438 | int lun, u_int tag, role_t role, uint32_t status, | 7567 | int lun, u_int tag, role_t role, uint32_t status, |
7439 | ahd_search_action action, u_int *list_head, u_int tid) | 7568 | ahd_search_action action, u_int *list_head, |
7569 | u_int *list_tail, u_int tid) | ||
7440 | { | 7570 | { |
7441 | struct scb *scb; | 7571 | struct scb *scb; |
7442 | u_int scbid; | 7572 | u_int scbid; |
@@ -7448,6 +7578,7 @@ ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel, | |||
7448 | found = 0; | 7578 | found = 0; |
7449 | prev = SCB_LIST_NULL; | 7579 | prev = SCB_LIST_NULL; |
7450 | next = *list_head; | 7580 | next = *list_head; |
7581 | *list_tail = SCB_LIST_NULL; | ||
7451 | for (scbid = next; !SCBID_IS_NULL(scbid); scbid = next) { | 7582 | for (scbid = next; !SCBID_IS_NULL(scbid); scbid = next) { |
7452 | if (scbid >= ahd->scb_data.numscbs) { | 7583 | if (scbid >= ahd->scb_data.numscbs) { |
7453 | printf("%s:SCB List inconsistency. " | 7584 | printf("%s:SCB List inconsistency. " |
@@ -7463,6 +7594,7 @@ ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel, | |||
7463 | panic("Waiting List traversal\n"); | 7594 | panic("Waiting List traversal\n"); |
7464 | } | 7595 | } |
7465 | ahd_set_scbptr(ahd, scbid); | 7596 | ahd_set_scbptr(ahd, scbid); |
7597 | *list_tail = scbid; | ||
7466 | next = ahd_inw_scbram(ahd, SCB_NEXT); | 7598 | next = ahd_inw_scbram(ahd, SCB_NEXT); |
7467 | if (ahd_match_scb(ahd, scb, target, channel, | 7599 | if (ahd_match_scb(ahd, scb, target, channel, |
7468 | lun, SCB_LIST_NULL, role) == 0) { | 7600 | lun, SCB_LIST_NULL, role) == 0) { |
@@ -7472,24 +7604,14 @@ ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel, | |||
7472 | found++; | 7604 | found++; |
7473 | switch (action) { | 7605 | switch (action) { |
7474 | case SEARCH_COMPLETE: | 7606 | case SEARCH_COMPLETE: |
7475 | { | ||
7476 | cam_status ostat; | ||
7477 | cam_status cstat; | ||
7478 | |||
7479 | ostat = ahd_get_transaction_status(scb); | ||
7480 | if (ostat == CAM_REQ_INPROG) | ||
7481 | ahd_set_transaction_status(scb, status); | ||
7482 | cstat = ahd_get_transaction_status(scb); | ||
7483 | if (cstat != CAM_REQ_CMP) | ||
7484 | ahd_freeze_scb(scb); | ||
7485 | if ((scb->flags & SCB_ACTIVE) == 0) | 7607 | if ((scb->flags & SCB_ACTIVE) == 0) |
7486 | printf("Inactive SCB in Waiting List\n"); | 7608 | printf("Inactive SCB in Waiting List\n"); |
7487 | ahd_done(ahd, scb); | 7609 | ahd_done_with_status(ahd, scb, status); |
7488 | /* FALLTHROUGH */ | 7610 | /* FALLTHROUGH */ |
7489 | } | ||
7490 | case SEARCH_REMOVE: | 7611 | case SEARCH_REMOVE: |
7491 | ahd_rem_wscb(ahd, scbid, prev, next, tid); | 7612 | ahd_rem_wscb(ahd, scbid, prev, next, tid); |
7492 | if (prev == SCB_LIST_NULL) | 7613 | *list_tail = prev; |
7614 | if (SCBID_IS_NULL(prev)) | ||
7493 | *list_head = next; | 7615 | *list_head = next; |
7494 | break; | 7616 | break; |
7495 | case SEARCH_PRINT: | 7617 | case SEARCH_PRINT: |
@@ -7558,14 +7680,17 @@ ahd_rem_wscb(struct ahd_softc *ahd, u_int scbid, | |||
7558 | } | 7680 | } |
7559 | 7681 | ||
7560 | /* | 7682 | /* |
7561 | * SCBs that had MK_MESSAGE set in them will not | 7683 | * SCBs that have MK_MESSAGE set in them may |
7562 | * be queued to the per-target lists, so don't | 7684 | * cause the tail pointer to be updated without |
7563 | * blindly clear the tail pointer. | 7685 | * setting the next pointer of the previous tail. |
7686 | * Only clear the tail if the removed SCB was | ||
7687 | * the tail. | ||
7564 | */ | 7688 | */ |
7565 | tail_offset = WAITING_SCB_TAILS + (2 * tid); | 7689 | tail_offset = WAITING_SCB_TAILS + (2 * tid); |
7566 | if (SCBID_IS_NULL(next) | 7690 | if (SCBID_IS_NULL(next) |
7567 | && ahd_inw(ahd, tail_offset) == scbid) | 7691 | && ahd_inw(ahd, tail_offset) == scbid) |
7568 | ahd_outw(ahd, tail_offset, prev); | 7692 | ahd_outw(ahd, tail_offset, prev); |
7693 | |||
7569 | ahd_add_scb_to_free_list(ahd, scbid); | 7694 | ahd_add_scb_to_free_list(ahd, scbid); |
7570 | return (next); | 7695 | return (next); |
7571 | } | 7696 | } |
@@ -8148,11 +8273,6 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb) | |||
8148 | ahd_setup_data_scb(ahd, scb); | 8273 | ahd_setup_data_scb(ahd, scb); |
8149 | scb->flags |= SCB_SENSE; | 8274 | scb->flags |= SCB_SENSE; |
8150 | ahd_queue_scb(ahd, scb); | 8275 | ahd_queue_scb(ahd, scb); |
8151 | /* | ||
8152 | * Ensure we have enough time to actually | ||
8153 | * retrieve the sense. | ||
8154 | */ | ||
8155 | ahd_scb_timer_reset(scb, 5 * 1000000); | ||
8156 | break; | 8276 | break; |
8157 | } | 8277 | } |
8158 | case SCSI_STATUS_OK: | 8278 | case SCSI_STATUS_OK: |
@@ -8793,6 +8913,9 @@ ahd_dump_card_state(struct ahd_softc *ahd) | |||
8793 | * Mode independent registers. | 8913 | * Mode independent registers. |
8794 | */ | 8914 | */ |
8795 | cur_col = 0; | 8915 | cur_col = 0; |
8916 | ahd_intstat_print(ahd_inb(ahd, INTSTAT), &cur_col, 50); | ||
8917 | ahd_seloid_print(ahd_inb(ahd, SELOID), &cur_col, 50); | ||
8918 | ahd_selid_print(ahd_inb(ahd, SELID), &cur_col, 50); | ||
8796 | ahd_hs_mailbox_print(ahd_inb(ahd, LOCAL_HS_MAILBOX), &cur_col, 50); | 8919 | ahd_hs_mailbox_print(ahd_inb(ahd, LOCAL_HS_MAILBOX), &cur_col, 50); |
8797 | ahd_intctl_print(ahd_inb(ahd, INTCTL), &cur_col, 50); | 8920 | ahd_intctl_print(ahd_inb(ahd, INTCTL), &cur_col, 50); |
8798 | ahd_seqintstat_print(ahd_inb(ahd, SEQINTSTAT), &cur_col, 50); | 8921 | ahd_seqintstat_print(ahd_inb(ahd, SEQINTSTAT), &cur_col, 50); |
@@ -8808,6 +8931,12 @@ ahd_dump_card_state(struct ahd_softc *ahd) | |||
8808 | ahd_seqintctl_print(ahd_inb(ahd, SEQINTCTL), &cur_col, 50); | 8931 | ahd_seqintctl_print(ahd_inb(ahd, SEQINTCTL), &cur_col, 50); |
8809 | ahd_seq_flags_print(ahd_inb(ahd, SEQ_FLAGS), &cur_col, 50); | 8932 | ahd_seq_flags_print(ahd_inb(ahd, SEQ_FLAGS), &cur_col, 50); |
8810 | ahd_seq_flags2_print(ahd_inb(ahd, SEQ_FLAGS2), &cur_col, 50); | 8933 | ahd_seq_flags2_print(ahd_inb(ahd, SEQ_FLAGS2), &cur_col, 50); |
8934 | ahd_qfreeze_count_print(ahd_inw(ahd, QFREEZE_COUNT), &cur_col, 50); | ||
8935 | ahd_kernel_qfreeze_count_print(ahd_inw(ahd, KERNEL_QFREEZE_COUNT), | ||
8936 | &cur_col, 50); | ||
8937 | ahd_mk_message_scb_print(ahd_inw(ahd, MK_MESSAGE_SCB), &cur_col, 50); | ||
8938 | ahd_mk_message_scsiid_print(ahd_inb(ahd, MK_MESSAGE_SCSIID), | ||
8939 | &cur_col, 50); | ||
8811 | ahd_sstat0_print(ahd_inb(ahd, SSTAT0), &cur_col, 50); | 8940 | ahd_sstat0_print(ahd_inb(ahd, SSTAT0), &cur_col, 50); |
8812 | ahd_sstat1_print(ahd_inb(ahd, SSTAT1), &cur_col, 50); | 8941 | ahd_sstat1_print(ahd_inb(ahd, SSTAT1), &cur_col, 50); |
8813 | ahd_sstat2_print(ahd_inb(ahd, SSTAT2), &cur_col, 50); | 8942 | ahd_sstat2_print(ahd_inb(ahd, SSTAT2), &cur_col, 50); |
@@ -8915,7 +9044,7 @@ ahd_dump_card_state(struct ahd_softc *ahd) | |||
8915 | 9044 | ||
8916 | ahd_set_modes(ahd, AHD_MODE_DFF0 + i, AHD_MODE_DFF0 + i); | 9045 | ahd_set_modes(ahd, AHD_MODE_DFF0 + i, AHD_MODE_DFF0 + i); |
8917 | fifo_scbptr = ahd_get_scbptr(ahd); | 9046 | fifo_scbptr = ahd_get_scbptr(ahd); |
8918 | printf("\n%s: FIFO%d %s, LONGJMP == 0x%x, SCB 0x%x\n", | 9047 | printf("\n\n%s: FIFO%d %s, LONGJMP == 0x%x, SCB 0x%x\n", |
8919 | ahd_name(ahd), i, | 9048 | ahd_name(ahd), i, |
8920 | (dffstat & (FIFO0FREE << i)) ? "Free" : "Active", | 9049 | (dffstat & (FIFO0FREE << i)) ? "Free" : "Active", |
8921 | ahd_inw(ahd, LONGJMP_ADDR), fifo_scbptr); | 9050 | ahd_inw(ahd, LONGJMP_ADDR), fifo_scbptr); |
@@ -8970,6 +9099,9 @@ ahd_dump_card_state(struct ahd_softc *ahd) | |||
8970 | printf("%s: OS_SPACE_CNT = 0x%x MAXCMDCNT = 0x%x\n", | 9099 | printf("%s: OS_SPACE_CNT = 0x%x MAXCMDCNT = 0x%x\n", |
8971 | ahd_name(ahd), ahd_inb(ahd, OS_SPACE_CNT), | 9100 | ahd_name(ahd), ahd_inb(ahd, OS_SPACE_CNT), |
8972 | ahd_inb(ahd, MAXCMDCNT)); | 9101 | ahd_inb(ahd, MAXCMDCNT)); |
9102 | printf("%s: SAVED_SCSIID = 0x%x SAVED_LUN = 0x%x\n", | ||
9103 | ahd_name(ahd), ahd_inb(ahd, SAVED_SCSIID), | ||
9104 | ahd_inb(ahd, SAVED_LUN)); | ||
8973 | ahd_simode0_print(ahd_inb(ahd, SIMODE0), &cur_col, 50); | 9105 | ahd_simode0_print(ahd_inb(ahd, SIMODE0), &cur_col, 50); |
8974 | printf("\n"); | 9106 | printf("\n"); |
8975 | ahd_set_modes(ahd, AHD_MODE_CCHAN, AHD_MODE_CCHAN); | 9107 | ahd_set_modes(ahd, AHD_MODE_CCHAN, AHD_MODE_CCHAN); |
diff --git a/drivers/scsi/aic7xxx/aic79xx_inline.h b/drivers/scsi/aic7xxx/aic79xx_inline.h index 91c4f7f484b1..8ad3ce945b9e 100644 --- a/drivers/scsi/aic7xxx/aic79xx_inline.h +++ b/drivers/scsi/aic7xxx/aic79xx_inline.h | |||
@@ -37,7 +37,7 @@ | |||
37 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 37 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | * POSSIBILITY OF SUCH DAMAGES. | 38 | * POSSIBILITY OF SUCH DAMAGES. |
39 | * | 39 | * |
40 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx_inline.h#58 $ | 40 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx_inline.h#59 $ |
41 | * | 41 | * |
42 | * $FreeBSD$ | 42 | * $FreeBSD$ |
43 | */ | 43 | */ |
@@ -804,9 +804,10 @@ ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb) | |||
804 | uint64_t host_dataptr; | 804 | uint64_t host_dataptr; |
805 | 805 | ||
806 | host_dataptr = ahd_le64toh(scb->hscb->dataptr); | 806 | host_dataptr = ahd_le64toh(scb->hscb->dataptr); |
807 | printf("%s: Queueing SCB 0x%x bus addr 0x%x - 0x%x%x/0x%x\n", | 807 | printf("%s: Queueing SCB %d:0x%x bus addr 0x%x - 0x%x%x/0x%x\n", |
808 | ahd_name(ahd), | 808 | ahd_name(ahd), |
809 | SCB_GET_TAG(scb), ahd_le32toh(scb->hscb->hscb_busaddr), | 809 | SCB_GET_TAG(scb), scb->hscb->scsiid, |
810 | ahd_le32toh(scb->hscb->hscb_busaddr), | ||
810 | (u_int)((host_dataptr >> 32) & 0xFFFFFFFF), | 811 | (u_int)((host_dataptr >> 32) & 0xFFFFFFFF), |
811 | (u_int)(host_dataptr & 0xFFFFFFFF), | 812 | (u_int)(host_dataptr & 0xFFFFFFFF), |
812 | ahd_le32toh(scb->hscb->datacnt)); | 813 | ahd_le32toh(scb->hscb->datacnt)); |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 2567e29960bd..7254ea535a16 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c | |||
@@ -314,6 +314,21 @@ static uint32_t aic79xx_seltime; | |||
314 | */ | 314 | */ |
315 | uint32_t aic79xx_periodic_otag; | 315 | uint32_t aic79xx_periodic_otag; |
316 | 316 | ||
317 | /* Some storage boxes are using an LSI chip which has a bug making it | ||
318 | * impossible to use aic79xx Rev B chip in 320 speeds. The following | ||
319 | * storage boxes have been reported to be buggy: | ||
320 | * EonStor 3U 16-Bay: U16U-G3A3 | ||
321 | * EonStor 2U 12-Bay: U12U-G3A3 | ||
322 | * SentinelRAID: 2500F R5 / R6 | ||
323 | * SentinelRAID: 2500F R1 | ||
324 | * SentinelRAID: 2500F/1500F | ||
325 | * SentinelRAID: 150F | ||
326 | * | ||
327 | * To get around this LSI bug, you can set your board to 160 mode | ||
328 | * or you can enable the SLOWCRC bit. | ||
329 | */ | ||
330 | uint32_t aic79xx_slowcrc; | ||
331 | |||
317 | /* | 332 | /* |
318 | * Module information and settable options. | 333 | * Module information and settable options. |
319 | */ | 334 | */ |
@@ -343,6 +358,7 @@ MODULE_PARM_DESC(aic79xx, | |||
343 | " amplitude:<int> Set the signal amplitude (0-7).\n" | 358 | " amplitude:<int> Set the signal amplitude (0-7).\n" |
344 | " seltime:<int> Selection Timeout:\n" | 359 | " seltime:<int> Selection Timeout:\n" |
345 | " (0/256ms,1/128ms,2/64ms,3/32ms)\n" | 360 | " (0/256ms,1/128ms,2/64ms,3/32ms)\n" |
361 | " slowcrc Turn on the SLOWCRC bit (Rev B only)\n" | ||
346 | "\n" | 362 | "\n" |
347 | " Sample /etc/modprobe.conf line:\n" | 363 | " Sample /etc/modprobe.conf line:\n" |
348 | " Enable verbose logging\n" | 364 | " Enable verbose logging\n" |
@@ -1003,6 +1019,7 @@ aic79xx_setup(char *s) | |||
1003 | { "slewrate", NULL }, | 1019 | { "slewrate", NULL }, |
1004 | { "precomp", NULL }, | 1020 | { "precomp", NULL }, |
1005 | { "amplitude", NULL }, | 1021 | { "amplitude", NULL }, |
1022 | { "slowcrc", &aic79xx_slowcrc }, | ||
1006 | }; | 1023 | }; |
1007 | 1024 | ||
1008 | end = strchr(s, '\0'); | 1025 | end = strchr(s, '\0'); |
@@ -1072,7 +1089,6 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa | |||
1072 | return (ENOMEM); | 1089 | return (ENOMEM); |
1073 | 1090 | ||
1074 | *((struct ahd_softc **)host->hostdata) = ahd; | 1091 | *((struct ahd_softc **)host->hostdata) = ahd; |
1075 | ahd_lock(ahd, &s); | ||
1076 | ahd->platform_data->host = host; | 1092 | ahd->platform_data->host = host; |
1077 | host->can_queue = AHD_MAX_QUEUE; | 1093 | host->can_queue = AHD_MAX_QUEUE; |
1078 | host->cmd_per_lun = 2; | 1094 | host->cmd_per_lun = 2; |
@@ -1083,7 +1099,9 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa | |||
1083 | host->max_lun = AHD_NUM_LUNS; | 1099 | host->max_lun = AHD_NUM_LUNS; |
1084 | host->max_channel = 0; | 1100 | host->max_channel = 0; |
1085 | host->sg_tablesize = AHD_NSEG; | 1101 | host->sg_tablesize = AHD_NSEG; |
1102 | ahd_lock(ahd, &s); | ||
1086 | ahd_set_unit(ahd, ahd_linux_unit++); | 1103 | ahd_set_unit(ahd, ahd_linux_unit++); |
1104 | ahd_unlock(ahd, &s); | ||
1087 | sprintf(buf, "scsi%d", host->host_no); | 1105 | sprintf(buf, "scsi%d", host->host_no); |
1088 | new_name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT); | 1106 | new_name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT); |
1089 | if (new_name != NULL) { | 1107 | if (new_name != NULL) { |
@@ -1093,7 +1111,6 @@ ahd_linux_register_host(struct ahd_softc *ahd, struct scsi_host_template *templa | |||
1093 | host->unique_id = ahd->unit; | 1111 | host->unique_id = ahd->unit; |
1094 | ahd_linux_initialize_scsi_bus(ahd); | 1112 | ahd_linux_initialize_scsi_bus(ahd); |
1095 | ahd_intr_enable(ahd, TRUE); | 1113 | ahd_intr_enable(ahd, TRUE); |
1096 | ahd_unlock(ahd, &s); | ||
1097 | 1114 | ||
1098 | host->transportt = ahd_linux_transport_template; | 1115 | host->transportt = ahd_linux_transport_template; |
1099 | 1116 | ||
@@ -1127,6 +1144,7 @@ ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd) | |||
1127 | { | 1144 | { |
1128 | u_int target_id; | 1145 | u_int target_id; |
1129 | u_int numtarg; | 1146 | u_int numtarg; |
1147 | unsigned long s; | ||
1130 | 1148 | ||
1131 | target_id = 0; | 1149 | target_id = 0; |
1132 | numtarg = 0; | 1150 | numtarg = 0; |
@@ -1139,6 +1157,8 @@ ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd) | |||
1139 | else | 1157 | else |
1140 | numtarg = (ahd->features & AHD_WIDE) ? 16 : 8; | 1158 | numtarg = (ahd->features & AHD_WIDE) ? 16 : 8; |
1141 | 1159 | ||
1160 | ahd_lock(ahd, &s); | ||
1161 | |||
1142 | /* | 1162 | /* |
1143 | * Force negotiation to async for all targets that | 1163 | * Force negotiation to async for all targets that |
1144 | * will not see an initial bus reset. | 1164 | * will not see an initial bus reset. |
@@ -1155,16 +1175,12 @@ ahd_linux_initialize_scsi_bus(struct ahd_softc *ahd) | |||
1155 | ahd_update_neg_request(ahd, &devinfo, tstate, | 1175 | ahd_update_neg_request(ahd, &devinfo, tstate, |
1156 | tinfo, AHD_NEG_ALWAYS); | 1176 | tinfo, AHD_NEG_ALWAYS); |
1157 | } | 1177 | } |
1178 | ahd_unlock(ahd, &s); | ||
1158 | /* Give the bus some time to recover */ | 1179 | /* Give the bus some time to recover */ |
1159 | if ((ahd->flags & AHD_RESET_BUS_A) != 0) { | 1180 | if ((ahd->flags & AHD_RESET_BUS_A) != 0) { |
1160 | ahd_freeze_simq(ahd); | 1181 | ahd_freeze_simq(ahd); |
1161 | init_timer(&ahd->platform_data->reset_timer); | 1182 | msleep(AIC79XX_RESET_DELAY); |
1162 | ahd->platform_data->reset_timer.data = (u_long)ahd; | 1183 | ahd_release_simq(ahd); |
1163 | ahd->platform_data->reset_timer.expires = | ||
1164 | jiffies + (AIC79XX_RESET_DELAY * HZ)/1000; | ||
1165 | ahd->platform_data->reset_timer.function = | ||
1166 | (ahd_linux_callback_t *)ahd_release_simq; | ||
1167 | add_timer(&ahd->platform_data->reset_timer); | ||
1168 | } | 1184 | } |
1169 | } | 1185 | } |
1170 | 1186 | ||
@@ -2033,6 +2049,9 @@ ahd_linux_sem_timeout(u_long arg) | |||
2033 | void | 2049 | void |
2034 | ahd_freeze_simq(struct ahd_softc *ahd) | 2050 | ahd_freeze_simq(struct ahd_softc *ahd) |
2035 | { | 2051 | { |
2052 | unsigned long s; | ||
2053 | |||
2054 | ahd_lock(ahd, &s); | ||
2036 | ahd->platform_data->qfrozen++; | 2055 | ahd->platform_data->qfrozen++; |
2037 | if (ahd->platform_data->qfrozen == 1) { | 2056 | if (ahd->platform_data->qfrozen == 1) { |
2038 | scsi_block_requests(ahd->platform_data->host); | 2057 | scsi_block_requests(ahd->platform_data->host); |
@@ -2040,6 +2059,7 @@ ahd_freeze_simq(struct ahd_softc *ahd) | |||
2040 | CAM_LUN_WILDCARD, SCB_LIST_NULL, | 2059 | CAM_LUN_WILDCARD, SCB_LIST_NULL, |
2041 | ROLE_INITIATOR, CAM_REQUEUE_REQ); | 2060 | ROLE_INITIATOR, CAM_REQUEUE_REQ); |
2042 | } | 2061 | } |
2062 | ahd_unlock(ahd, &s); | ||
2043 | } | 2063 | } |
2044 | 2064 | ||
2045 | void | 2065 | void |
@@ -2344,8 +2364,9 @@ done: | |||
2344 | ahd_name(ahd), dev->active); | 2364 | ahd_name(ahd), dev->active); |
2345 | retval = FAILED; | 2365 | retval = FAILED; |
2346 | } | 2366 | } |
2347 | } | 2367 | } else |
2348 | ahd_unlock(ahd, &flags); | 2368 | ahd_unlock(ahd, &flags); |
2369 | |||
2349 | return (retval); | 2370 | return (retval); |
2350 | } | 2371 | } |
2351 | 2372 | ||
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index cb74fccc8100..9cb101345107 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h | |||
@@ -36,7 +36,7 @@ | |||
36 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 36 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
37 | * POSSIBILITY OF SUCH DAMAGES. | 37 | * POSSIBILITY OF SUCH DAMAGES. |
38 | * | 38 | * |
39 | * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#137 $ | 39 | * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#166 $ |
40 | * | 40 | * |
41 | */ | 41 | */ |
42 | #ifndef _AIC79XX_LINUX_H_ | 42 | #ifndef _AIC79XX_LINUX_H_ |
@@ -228,7 +228,6 @@ typedef struct timer_list ahd_timer_t; | |||
228 | typedef void ahd_linux_callback_t (u_long); | 228 | typedef void ahd_linux_callback_t (u_long); |
229 | static __inline void ahd_timer_reset(ahd_timer_t *timer, int usec, | 229 | static __inline void ahd_timer_reset(ahd_timer_t *timer, int usec, |
230 | ahd_callback_t *func, void *arg); | 230 | ahd_callback_t *func, void *arg); |
231 | static __inline void ahd_scb_timer_reset(struct scb *scb, u_int usec); | ||
232 | 231 | ||
233 | static __inline void | 232 | static __inline void |
234 | ahd_timer_reset(ahd_timer_t *timer, int usec, ahd_callback_t *func, void *arg) | 233 | ahd_timer_reset(ahd_timer_t *timer, int usec, ahd_callback_t *func, void *arg) |
@@ -243,12 +242,6 @@ ahd_timer_reset(ahd_timer_t *timer, int usec, ahd_callback_t *func, void *arg) | |||
243 | add_timer(timer); | 242 | add_timer(timer); |
244 | } | 243 | } |
245 | 244 | ||
246 | static __inline void | ||
247 | ahd_scb_timer_reset(struct scb *scb, u_int usec) | ||
248 | { | ||
249 | mod_timer(&scb->io_ctx->eh_timeout, jiffies + (usec * HZ)/1000000); | ||
250 | } | ||
251 | |||
252 | /***************************** SMP support ************************************/ | 245 | /***************************** SMP support ************************************/ |
253 | #include <linux/spinlock.h> | 246 | #include <linux/spinlock.h> |
254 | 247 | ||
@@ -389,7 +382,6 @@ struct ahd_platform_data { | |||
389 | 382 | ||
390 | spinlock_t spin_lock; | 383 | spinlock_t spin_lock; |
391 | u_int qfrozen; | 384 | u_int qfrozen; |
392 | struct timer_list reset_timer; | ||
393 | struct semaphore eh_sem; | 385 | struct semaphore eh_sem; |
394 | struct Scsi_Host *host; /* pointer to scsi host */ | 386 | struct Scsi_Host *host; /* pointer to scsi host */ |
395 | #define AHD_LINUX_NOIRQ ((uint32_t)~0) | 387 | #define AHD_LINUX_NOIRQ ((uint32_t)~0) |
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c index bf360ae021ab..ebbf7e4ff4cc 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c | |||
@@ -220,10 +220,10 @@ ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, u_long *base, | |||
220 | *base2 = pci_resource_start(ahd->dev_softc, 3); | 220 | *base2 = pci_resource_start(ahd->dev_softc, 3); |
221 | if (*base == 0 || *base2 == 0) | 221 | if (*base == 0 || *base2 == 0) |
222 | return (ENOMEM); | 222 | return (ENOMEM); |
223 | if (request_region(*base, 256, "aic79xx") == 0) | 223 | if (!request_region(*base, 256, "aic79xx")) |
224 | return (ENOMEM); | 224 | return (ENOMEM); |
225 | if (request_region(*base2, 256, "aic79xx") == 0) { | 225 | if (!request_region(*base2, 256, "aic79xx")) { |
226 | release_region(*base2, 256); | 226 | release_region(*base, 256); |
227 | return (ENOMEM); | 227 | return (ENOMEM); |
228 | } | 228 | } |
229 | return (0); | 229 | return (0); |
@@ -237,7 +237,7 @@ ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd, | |||
237 | u_long start; | 237 | u_long start; |
238 | u_long base_page; | 238 | u_long base_page; |
239 | u_long base_offset; | 239 | u_long base_offset; |
240 | int error; | 240 | int error = 0; |
241 | 241 | ||
242 | if (aic79xx_allow_memio == 0) | 242 | if (aic79xx_allow_memio == 0) |
243 | return (ENOMEM); | 243 | return (ENOMEM); |
@@ -245,16 +245,15 @@ ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd, | |||
245 | if ((ahd->bugs & AHD_PCIX_MMAPIO_BUG) != 0) | 245 | if ((ahd->bugs & AHD_PCIX_MMAPIO_BUG) != 0) |
246 | return (ENOMEM); | 246 | return (ENOMEM); |
247 | 247 | ||
248 | error = 0; | ||
249 | start = pci_resource_start(ahd->dev_softc, 1); | 248 | start = pci_resource_start(ahd->dev_softc, 1); |
250 | base_page = start & PAGE_MASK; | 249 | base_page = start & PAGE_MASK; |
251 | base_offset = start - base_page; | 250 | base_offset = start - base_page; |
252 | if (start != 0) { | 251 | if (start != 0) { |
253 | *bus_addr = start; | 252 | *bus_addr = start; |
254 | if (request_mem_region(start, 0x1000, "aic79xx") == 0) | 253 | if (!request_mem_region(start, 0x1000, "aic79xx")) |
255 | error = ENOMEM; | 254 | error = ENOMEM; |
256 | if (error == 0) { | 255 | if (!error) { |
257 | *maddr = ioremap_nocache(base_page, base_offset + 256); | 256 | *maddr = ioremap_nocache(base_page, base_offset + 512); |
258 | if (*maddr == NULL) { | 257 | if (*maddr == NULL) { |
259 | error = ENOMEM; | 258 | error = ENOMEM; |
260 | release_mem_region(start, 0x1000); | 259 | release_mem_region(start, 0x1000); |
@@ -344,7 +343,7 @@ ahd_pci_map_int(struct ahd_softc *ahd) | |||
344 | 343 | ||
345 | error = request_irq(ahd->dev_softc->irq, ahd_linux_isr, | 344 | error = request_irq(ahd->dev_softc->irq, ahd_linux_isr, |
346 | SA_SHIRQ, "aic79xx", ahd); | 345 | SA_SHIRQ, "aic79xx", ahd); |
347 | if (error == 0) | 346 | if (!error) |
348 | ahd->platform_data->irq = ahd->dev_softc->irq; | 347 | ahd->platform_data->irq = ahd->dev_softc->irq; |
349 | 348 | ||
350 | return (-error); | 349 | return (-error); |
diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c index 196a6344b037..757242e522c2 100644 --- a/drivers/scsi/aic7xxx/aic79xx_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_pci.c | |||
@@ -38,7 +38,7 @@ | |||
38 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 38 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
39 | * POSSIBILITY OF SUCH DAMAGES. | 39 | * POSSIBILITY OF SUCH DAMAGES. |
40 | * | 40 | * |
41 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#89 $ | 41 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx_pci.c#92 $ |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #ifdef __linux__ | 44 | #ifdef __linux__ |
@@ -950,12 +950,19 @@ ahd_aic790X_setup(struct ahd_softc *ahd) | |||
950 | if ((ahd->flags & AHD_HP_BOARD) == 0) | 950 | if ((ahd->flags & AHD_HP_BOARD) == 0) |
951 | AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVA); | 951 | AHD_SET_SLEWRATE(ahd, AHD_SLEWRATE_DEF_REVA); |
952 | } else { | 952 | } else { |
953 | /* This is revision B and newer. */ | ||
954 | extern uint32_t aic79xx_slowcrc; | ||
953 | u_int devconfig1; | 955 | u_int devconfig1; |
954 | 956 | ||
955 | ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS | 957 | ahd->features |= AHD_RTI|AHD_NEW_IOCELL_OPTS |
956 | | AHD_NEW_DFCNTRL_OPTS|AHD_FAST_CDB_DELIVERY; | 958 | | AHD_NEW_DFCNTRL_OPTS|AHD_FAST_CDB_DELIVERY |
959 | | AHD_BUSFREEREV_BUG; | ||
957 | ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG; | 960 | ahd->bugs |= AHD_LQOOVERRUN_BUG|AHD_EARLY_REQ_BUG; |
958 | 961 | ||
962 | /* If the user requested the the SLOWCRC bit to be set. */ | ||
963 | if (aic79xx_slowcrc) | ||
964 | ahd->features |= AHD_AIC79XXB_SLOWCRC; | ||
965 | |||
959 | /* | 966 | /* |
960 | * Some issues have been resolved in the 7901B. | 967 | * Some issues have been resolved in the 7901B. |
961 | */ | 968 | */ |
diff --git a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped index 8763b158856b..2068e00d2c75 100644 --- a/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped +++ b/drivers/scsi/aic7xxx/aic79xx_reg.h_shipped | |||
@@ -2,8 +2,8 @@ | |||
2 | * DO NOT EDIT - This file is automatically generated | 2 | * DO NOT EDIT - This file is automatically generated |
3 | * from the following source files: | 3 | * from the following source files: |
4 | * | 4 | * |
5 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#119 $ | 5 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#120 $ |
6 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#76 $ | 6 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#77 $ |
7 | */ | 7 | */ |
8 | typedef int (ahd_reg_print_t)(u_int, u_int *, u_int); | 8 | typedef int (ahd_reg_print_t)(u_int, u_int *, u_int); |
9 | typedef struct ahd_reg_parse_entry { | 9 | typedef struct ahd_reg_parse_entry { |
@@ -2204,6 +2204,20 @@ ahd_reg_print_t ahd_cmdsize_table_print; | |||
2204 | #endif | 2204 | #endif |
2205 | 2205 | ||
2206 | #if AIC_DEBUG_REGISTERS | 2206 | #if AIC_DEBUG_REGISTERS |
2207 | ahd_reg_print_t ahd_mk_message_scb_print; | ||
2208 | #else | ||
2209 | #define ahd_mk_message_scb_print(regvalue, cur_col, wrap) \ | ||
2210 | ahd_print_register(NULL, 0, "MK_MESSAGE_SCB", 0x160, regvalue, cur_col, wrap) | ||
2211 | #endif | ||
2212 | |||
2213 | #if AIC_DEBUG_REGISTERS | ||
2214 | ahd_reg_print_t ahd_mk_message_scsiid_print; | ||
2215 | #else | ||
2216 | #define ahd_mk_message_scsiid_print(regvalue, cur_col, wrap) \ | ||
2217 | ahd_print_register(NULL, 0, "MK_MESSAGE_SCSIID", 0x162, regvalue, cur_col, wrap) | ||
2218 | #endif | ||
2219 | |||
2220 | #if AIC_DEBUG_REGISTERS | ||
2207 | ahd_reg_print_t ahd_scb_base_print; | 2221 | ahd_reg_print_t ahd_scb_base_print; |
2208 | #else | 2222 | #else |
2209 | #define ahd_scb_base_print(regvalue, cur_col, wrap) \ | 2223 | #define ahd_scb_base_print(regvalue, cur_col, wrap) \ |
@@ -3638,6 +3652,7 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; | |||
3638 | #define SEQ_FLAGS2 0x14d | 3652 | #define SEQ_FLAGS2 0x14d |
3639 | #define SELECTOUT_QFROZEN 0x04 | 3653 | #define SELECTOUT_QFROZEN 0x04 |
3640 | #define TARGET_MSG_PENDING 0x02 | 3654 | #define TARGET_MSG_PENDING 0x02 |
3655 | #define PENDING_MK_MESSAGE 0x01 | ||
3641 | 3656 | ||
3642 | #define ALLOCFIFO_SCBPTR 0x14e | 3657 | #define ALLOCFIFO_SCBPTR 0x14e |
3643 | 3658 | ||
@@ -3655,6 +3670,10 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; | |||
3655 | 3670 | ||
3656 | #define CMDSIZE_TABLE 0x158 | 3671 | #define CMDSIZE_TABLE 0x158 |
3657 | 3672 | ||
3673 | #define MK_MESSAGE_SCB 0x160 | ||
3674 | |||
3675 | #define MK_MESSAGE_SCSIID 0x162 | ||
3676 | |||
3658 | #define SCB_BASE 0x180 | 3677 | #define SCB_BASE 0x180 |
3659 | 3678 | ||
3660 | #define SCB_RESIDUAL_DATACNT 0x180 | 3679 | #define SCB_RESIDUAL_DATACNT 0x180 |
@@ -3800,5 +3819,5 @@ ahd_reg_print_t ahd_scb_disconnected_lists_print; | |||
3800 | 3819 | ||
3801 | 3820 | ||
3802 | /* Exported Labels */ | 3821 | /* Exported Labels */ |
3803 | #define LABEL_seq_isr 0x285 | 3822 | #define LABEL_seq_isr 0x28f |
3804 | #define LABEL_timer_isr 0x281 | 3823 | #define LABEL_timer_isr 0x28b |
diff --git a/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped b/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped index a4137c985376..db38a61a8cb4 100644 --- a/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped +++ b/drivers/scsi/aic7xxx/aic79xx_reg_print.c_shipped | |||
@@ -2,8 +2,8 @@ | |||
2 | * DO NOT EDIT - This file is automatically generated | 2 | * DO NOT EDIT - This file is automatically generated |
3 | * from the following source files: | 3 | * from the following source files: |
4 | * | 4 | * |
5 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#118 $ | 5 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#120 $ |
6 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#75 $ | 6 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#77 $ |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "aic79xx_osm.h" | 9 | #include "aic79xx_osm.h" |
@@ -3382,6 +3382,7 @@ ahd_initiator_tag_print(u_int regvalue, u_int *cur_col, u_int wrap) | |||
3382 | } | 3382 | } |
3383 | 3383 | ||
3384 | static ahd_reg_parse_entry_t SEQ_FLAGS2_parse_table[] = { | 3384 | static ahd_reg_parse_entry_t SEQ_FLAGS2_parse_table[] = { |
3385 | { "PENDING_MK_MESSAGE", 0x01, 0x01 }, | ||
3385 | { "TARGET_MSG_PENDING", 0x02, 0x02 }, | 3386 | { "TARGET_MSG_PENDING", 0x02, 0x02 }, |
3386 | { "SELECTOUT_QFROZEN", 0x04, 0x04 } | 3387 | { "SELECTOUT_QFROZEN", 0x04, 0x04 } |
3387 | }; | 3388 | }; |
@@ -3389,7 +3390,7 @@ static ahd_reg_parse_entry_t SEQ_FLAGS2_parse_table[] = { | |||
3389 | int | 3390 | int |
3390 | ahd_seq_flags2_print(u_int regvalue, u_int *cur_col, u_int wrap) | 3391 | ahd_seq_flags2_print(u_int regvalue, u_int *cur_col, u_int wrap) |
3391 | { | 3392 | { |
3392 | return (ahd_print_register(SEQ_FLAGS2_parse_table, 2, "SEQ_FLAGS2", | 3393 | return (ahd_print_register(SEQ_FLAGS2_parse_table, 3, "SEQ_FLAGS2", |
3393 | 0x14d, regvalue, cur_col, wrap)); | 3394 | 0x14d, regvalue, cur_col, wrap)); |
3394 | } | 3395 | } |
3395 | 3396 | ||
@@ -3450,6 +3451,20 @@ ahd_cmdsize_table_print(u_int regvalue, u_int *cur_col, u_int wrap) | |||
3450 | } | 3451 | } |
3451 | 3452 | ||
3452 | int | 3453 | int |
3454 | ahd_mk_message_scb_print(u_int regvalue, u_int *cur_col, u_int wrap) | ||
3455 | { | ||
3456 | return (ahd_print_register(NULL, 0, "MK_MESSAGE_SCB", | ||
3457 | 0x160, regvalue, cur_col, wrap)); | ||
3458 | } | ||
3459 | |||
3460 | int | ||
3461 | ahd_mk_message_scsiid_print(u_int regvalue, u_int *cur_col, u_int wrap) | ||
3462 | { | ||
3463 | return (ahd_print_register(NULL, 0, "MK_MESSAGE_SCSIID", | ||
3464 | 0x162, regvalue, cur_col, wrap)); | ||
3465 | } | ||
3466 | |||
3467 | int | ||
3453 | ahd_scb_base_print(u_int regvalue, u_int *cur_col, u_int wrap) | 3468 | ahd_scb_base_print(u_int regvalue, u_int *cur_col, u_int wrap) |
3454 | { | 3469 | { |
3455 | return (ahd_print_register(NULL, 0, "SCB_BASE", | 3470 | return (ahd_print_register(NULL, 0, "SCB_BASE", |
diff --git a/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped b/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped index b1e5365be230..11bed07e90b7 100644 --- a/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped +++ b/drivers/scsi/aic7xxx/aic79xx_seq.h_shipped | |||
@@ -2,17 +2,17 @@ | |||
2 | * DO NOT EDIT - This file is automatically generated | 2 | * DO NOT EDIT - This file is automatically generated |
3 | * from the following source files: | 3 | * from the following source files: |
4 | * | 4 | * |
5 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#119 $ | 5 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.seq#120 $ |
6 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#76 $ | 6 | * $Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#77 $ |
7 | */ | 7 | */ |
8 | static uint8_t seqprog[] = { | 8 | static uint8_t seqprog[] = { |
9 | 0xff, 0x02, 0x06, 0x78, | 9 | 0xff, 0x02, 0x06, 0x78, |
10 | 0x00, 0xea, 0x64, 0x59, | 10 | 0x00, 0xea, 0x6e, 0x59, |
11 | 0x01, 0xea, 0x04, 0x30, | 11 | 0x01, 0xea, 0x04, 0x30, |
12 | 0xff, 0x04, 0x0c, 0x78, | 12 | 0xff, 0x04, 0x0c, 0x78, |
13 | 0x19, 0xea, 0x64, 0x59, | 13 | 0x19, 0xea, 0x6e, 0x59, |
14 | 0x19, 0xea, 0x04, 0x00, | 14 | 0x19, 0xea, 0x04, 0x00, |
15 | 0x33, 0xea, 0x5e, 0x59, | 15 | 0x33, 0xea, 0x68, 0x59, |
16 | 0x33, 0xea, 0x00, 0x00, | 16 | 0x33, 0xea, 0x00, 0x00, |
17 | 0x60, 0x3a, 0x3a, 0x68, | 17 | 0x60, 0x3a, 0x3a, 0x68, |
18 | 0x04, 0x4d, 0x35, 0x78, | 18 | 0x04, 0x4d, 0x35, 0x78, |
@@ -33,15 +33,15 @@ static uint8_t seqprog[] = { | |||
33 | 0xff, 0xea, 0x62, 0x02, | 33 | 0xff, 0xea, 0x62, 0x02, |
34 | 0x00, 0xe2, 0x3a, 0x40, | 34 | 0x00, 0xe2, 0x3a, 0x40, |
35 | 0xff, 0x21, 0x3b, 0x70, | 35 | 0xff, 0x21, 0x3b, 0x70, |
36 | 0x40, 0x4b, 0xaa, 0x69, | 36 | 0x40, 0x4b, 0xb4, 0x69, |
37 | 0x00, 0xe2, 0x68, 0x59, | 37 | 0x00, 0xe2, 0x72, 0x59, |
38 | 0x40, 0x4b, 0xaa, 0x69, | 38 | 0x40, 0x4b, 0xb4, 0x69, |
39 | 0x20, 0x4b, 0x96, 0x69, | 39 | 0x20, 0x4b, 0xa0, 0x69, |
40 | 0xfc, 0x42, 0x44, 0x78, | 40 | 0xfc, 0x42, 0x44, 0x78, |
41 | 0x10, 0x40, 0x44, 0x78, | 41 | 0x10, 0x40, 0x44, 0x78, |
42 | 0x00, 0xe2, 0xfc, 0x5d, | 42 | 0x00, 0xe2, 0x10, 0x5e, |
43 | 0x20, 0x4d, 0x48, 0x78, | 43 | 0x20, 0x4d, 0x48, 0x78, |
44 | 0x00, 0xe2, 0xfc, 0x5d, | 44 | 0x00, 0xe2, 0x10, 0x5e, |
45 | 0x30, 0x3f, 0xc0, 0x09, | 45 | 0x30, 0x3f, 0xc0, 0x09, |
46 | 0x30, 0xe0, 0x50, 0x60, | 46 | 0x30, 0xe0, 0x50, 0x60, |
47 | 0x7f, 0x4a, 0x94, 0x08, | 47 | 0x7f, 0x4a, 0x94, 0x08, |
@@ -51,7 +51,7 @@ static uint8_t seqprog[] = { | |||
51 | 0x00, 0xe2, 0x76, 0x58, | 51 | 0x00, 0xe2, 0x76, 0x58, |
52 | 0x00, 0xe2, 0x86, 0x58, | 52 | 0x00, 0xe2, 0x86, 0x58, |
53 | 0x00, 0xe2, 0x06, 0x40, | 53 | 0x00, 0xe2, 0x06, 0x40, |
54 | 0x33, 0xea, 0x5e, 0x59, | 54 | 0x33, 0xea, 0x68, 0x59, |
55 | 0x33, 0xea, 0x00, 0x00, | 55 | 0x33, 0xea, 0x00, 0x00, |
56 | 0x01, 0x52, 0x84, 0x78, | 56 | 0x01, 0x52, 0x84, 0x78, |
57 | 0x02, 0x58, 0x50, 0x31, | 57 | 0x02, 0x58, 0x50, 0x31, |
@@ -59,26 +59,26 @@ static uint8_t seqprog[] = { | |||
59 | 0xff, 0x97, 0x6f, 0x78, | 59 | 0xff, 0x97, 0x6f, 0x78, |
60 | 0x50, 0x4b, 0x6a, 0x68, | 60 | 0x50, 0x4b, 0x6a, 0x68, |
61 | 0xbf, 0x3a, 0x74, 0x08, | 61 | 0xbf, 0x3a, 0x74, 0x08, |
62 | 0x14, 0xea, 0x64, 0x59, | 62 | 0x14, 0xea, 0x6e, 0x59, |
63 | 0x14, 0xea, 0x04, 0x00, | 63 | 0x14, 0xea, 0x04, 0x00, |
64 | 0x08, 0x92, 0x25, 0x03, | 64 | 0x08, 0x92, 0x25, 0x03, |
65 | 0xff, 0x90, 0x5f, 0x68, | 65 | 0xff, 0x90, 0x5f, 0x68, |
66 | 0x00, 0xe2, 0x76, 0x5b, | 66 | 0x00, 0xe2, 0x8a, 0x5b, |
67 | 0x00, 0xe2, 0x5e, 0x40, | 67 | 0x00, 0xe2, 0x5e, 0x40, |
68 | 0x00, 0xea, 0x5e, 0x59, | 68 | 0x00, 0xea, 0x68, 0x59, |
69 | 0x01, 0xea, 0x00, 0x30, | 69 | 0x01, 0xea, 0x00, 0x30, |
70 | 0x80, 0xf9, 0x7e, 0x68, | 70 | 0x80, 0xf9, 0x7e, 0x68, |
71 | 0x00, 0xe2, 0x5c, 0x59, | 71 | 0x00, 0xe2, 0x66, 0x59, |
72 | 0x11, 0xea, 0x5e, 0x59, | 72 | 0x11, 0xea, 0x68, 0x59, |
73 | 0x11, 0xea, 0x00, 0x00, | 73 | 0x11, 0xea, 0x00, 0x00, |
74 | 0x80, 0xf9, 0x5c, 0x79, | 74 | 0x80, 0xf9, 0x66, 0x79, |
75 | 0xff, 0xea, 0xd4, 0x0d, | 75 | 0xff, 0xea, 0xd4, 0x0d, |
76 | 0x22, 0xea, 0x5e, 0x59, | 76 | 0x22, 0xea, 0x68, 0x59, |
77 | 0x22, 0xea, 0x00, 0x00, | 77 | 0x22, 0xea, 0x00, 0x00, |
78 | 0x10, 0x16, 0x90, 0x78, | 78 | 0x10, 0x16, 0x90, 0x78, |
79 | 0x10, 0x16, 0x2c, 0x00, | 79 | 0x10, 0x16, 0x2c, 0x00, |
80 | 0x01, 0x0b, 0xae, 0x32, | 80 | 0x01, 0x0b, 0xae, 0x32, |
81 | 0x18, 0xad, 0x12, 0x79, | 81 | 0x18, 0xad, 0x1c, 0x79, |
82 | 0x04, 0xad, 0xdc, 0x68, | 82 | 0x04, 0xad, 0xdc, 0x68, |
83 | 0x80, 0xad, 0x84, 0x78, | 83 | 0x80, 0xad, 0x84, 0x78, |
84 | 0x10, 0xad, 0xaa, 0x78, | 84 | 0x10, 0xad, 0xaa, 0x78, |
@@ -118,7 +118,6 @@ static uint8_t seqprog[] = { | |||
118 | 0x80, 0x18, 0x30, 0x04, | 118 | 0x80, 0x18, 0x30, 0x04, |
119 | 0x40, 0xad, 0x84, 0x78, | 119 | 0x40, 0xad, 0x84, 0x78, |
120 | 0xe7, 0xad, 0x5a, 0x09, | 120 | 0xe7, 0xad, 0x5a, 0x09, |
121 | 0x02, 0xa8, 0x40, 0x31, | ||
122 | 0xff, 0xea, 0xc0, 0x09, | 121 | 0xff, 0xea, 0xc0, 0x09, |
123 | 0x01, 0x54, 0xa9, 0x1a, | 122 | 0x01, 0x54, 0xa9, 0x1a, |
124 | 0x00, 0x55, 0xab, 0x22, | 123 | 0x00, 0x55, 0xab, 0x22, |
@@ -128,24 +127,30 @@ static uint8_t seqprog[] = { | |||
128 | 0xff, 0xea, 0x5a, 0x03, | 127 | 0xff, 0xea, 0x5a, 0x03, |
129 | 0xff, 0xea, 0x5e, 0x03, | 128 | 0xff, 0xea, 0x5e, 0x03, |
130 | 0x01, 0x10, 0xd4, 0x31, | 129 | 0x01, 0x10, 0xd4, 0x31, |
131 | 0x10, 0x92, 0x07, 0x69, | 130 | 0x02, 0xa8, 0x40, 0x31, |
131 | 0x01, 0x92, 0xc1, 0x31, | ||
132 | 0x3d, 0x93, 0xc5, 0x29, | 132 | 0x3d, 0x93, 0xc5, 0x29, |
133 | 0xfe, 0xe2, 0xc4, 0x09, | 133 | 0xfe, 0xe2, 0xc4, 0x09, |
134 | 0x01, 0xea, 0xc6, 0x01, | 134 | 0x01, 0xea, 0xc6, 0x01, |
135 | 0x02, 0xe2, 0xc8, 0x31, | 135 | 0x02, 0xe2, 0xc8, 0x31, |
136 | 0x02, 0xec, 0x50, 0x31, | 136 | 0x02, 0xec, 0x50, 0x31, |
137 | 0x02, 0xa0, 0xda, 0x31, | 137 | 0x02, 0xa0, 0xda, 0x31, |
138 | 0xff, 0xa9, 0x06, 0x71, | 138 | 0xff, 0xa9, 0x10, 0x71, |
139 | 0x10, 0xe0, 0x0e, 0x79, | ||
140 | 0x10, 0x92, 0x0f, 0x79, | ||
141 | 0x01, 0x4d, 0x9b, 0x02, | ||
142 | 0x02, 0xa0, 0xc0, 0x32, | ||
143 | 0x01, 0x93, 0xc5, 0x36, | ||
139 | 0x02, 0xa0, 0x58, 0x37, | 144 | 0x02, 0xa0, 0x58, 0x37, |
140 | 0xff, 0x21, 0x0f, 0x71, | 145 | 0xff, 0x21, 0x19, 0x71, |
141 | 0x02, 0x22, 0x51, 0x31, | 146 | 0x02, 0x22, 0x51, 0x31, |
142 | 0x02, 0xa0, 0x5c, 0x33, | 147 | 0x02, 0xa0, 0x5c, 0x33, |
143 | 0x02, 0xa0, 0x44, 0x36, | 148 | 0x02, 0xa0, 0x44, 0x36, |
144 | 0x02, 0xa0, 0x40, 0x32, | 149 | 0x02, 0xa0, 0x40, 0x32, |
145 | 0x02, 0xa0, 0x44, 0x36, | 150 | 0x02, 0xa0, 0x44, 0x36, |
146 | 0x04, 0x4d, 0x17, 0x69, | 151 | 0x05, 0x4d, 0x21, 0x69, |
147 | 0x40, 0x16, 0x48, 0x69, | 152 | 0x40, 0x16, 0x52, 0x69, |
148 | 0xff, 0x2d, 0x4d, 0x61, | 153 | 0xff, 0x2d, 0x57, 0x61, |
149 | 0xff, 0x29, 0x85, 0x70, | 154 | 0xff, 0x29, 0x85, 0x70, |
150 | 0x02, 0x28, 0x55, 0x32, | 155 | 0x02, 0x28, 0x55, 0x32, |
151 | 0x01, 0xea, 0x5a, 0x01, | 156 | 0x01, 0xea, 0x5a, 0x01, |
@@ -159,22 +164,22 @@ static uint8_t seqprog[] = { | |||
159 | 0x01, 0x56, 0xad, 0x1a, | 164 | 0x01, 0x56, 0xad, 0x1a, |
160 | 0xff, 0x54, 0xa9, 0x1a, | 165 | 0xff, 0x54, 0xa9, 0x1a, |
161 | 0xff, 0x55, 0xab, 0x22, | 166 | 0xff, 0x55, 0xab, 0x22, |
162 | 0xff, 0x8d, 0x41, 0x71, | 167 | 0xff, 0x8d, 0x4b, 0x71, |
163 | 0x80, 0xac, 0x40, 0x71, | 168 | 0x80, 0xac, 0x4a, 0x71, |
164 | 0x20, 0x16, 0x40, 0x69, | 169 | 0x20, 0x16, 0x4a, 0x69, |
165 | 0x00, 0xac, 0xc4, 0x19, | 170 | 0x00, 0xac, 0xc4, 0x19, |
166 | 0x07, 0xe2, 0x40, 0xf9, | 171 | 0x07, 0xe2, 0x4a, 0xf9, |
167 | 0x02, 0x8c, 0x51, 0x31, | 172 | 0x02, 0x8c, 0x51, 0x31, |
168 | 0x00, 0xe2, 0x24, 0x41, | 173 | 0x00, 0xe2, 0x2e, 0x41, |
169 | 0x01, 0xac, 0x08, 0x31, | 174 | 0x01, 0xac, 0x08, 0x31, |
170 | 0x09, 0xea, 0x5a, 0x01, | 175 | 0x09, 0xea, 0x5a, 0x01, |
171 | 0x02, 0x8c, 0x51, 0x32, | 176 | 0x02, 0x8c, 0x51, 0x32, |
172 | 0xff, 0xea, 0x1a, 0x07, | 177 | 0xff, 0xea, 0x1a, 0x07, |
173 | 0x04, 0x24, 0xf9, 0x30, | 178 | 0x04, 0x24, 0xf9, 0x30, |
174 | 0x1d, 0xea, 0x52, 0x41, | 179 | 0x1d, 0xea, 0x5c, 0x41, |
175 | 0x02, 0x2c, 0x51, 0x31, | 180 | 0x02, 0x2c, 0x51, 0x31, |
176 | 0x04, 0xa8, 0xf9, 0x30, | 181 | 0x04, 0xa8, 0xf9, 0x30, |
177 | 0x19, 0xea, 0x52, 0x41, | 182 | 0x19, 0xea, 0x5c, 0x41, |
178 | 0x06, 0xea, 0x08, 0x81, | 183 | 0x06, 0xea, 0x08, 0x81, |
179 | 0x01, 0xe2, 0x5a, 0x35, | 184 | 0x01, 0xe2, 0x5a, 0x35, |
180 | 0x02, 0xf2, 0xf0, 0x31, | 185 | 0x02, 0xf2, 0xf0, 0x31, |
@@ -190,27 +195,27 @@ static uint8_t seqprog[] = { | |||
190 | 0x02, 0x20, 0xb9, 0x30, | 195 | 0x02, 0x20, 0xb9, 0x30, |
191 | 0x02, 0x20, 0x51, 0x31, | 196 | 0x02, 0x20, 0x51, 0x31, |
192 | 0x4c, 0x93, 0xd7, 0x28, | 197 | 0x4c, 0x93, 0xd7, 0x28, |
193 | 0x10, 0x92, 0x77, 0x79, | 198 | 0x10, 0x92, 0x81, 0x79, |
194 | 0x01, 0x6b, 0xc0, 0x30, | 199 | 0x01, 0x6b, 0xc0, 0x30, |
195 | 0x02, 0x64, 0xc8, 0x00, | 200 | 0x02, 0x64, 0xc8, 0x00, |
196 | 0x40, 0x3a, 0x74, 0x04, | 201 | 0x40, 0x3a, 0x74, 0x04, |
197 | 0x00, 0xe2, 0x76, 0x58, | 202 | 0x00, 0xe2, 0x76, 0x58, |
198 | 0x33, 0xea, 0x5e, 0x59, | 203 | 0x33, 0xea, 0x68, 0x59, |
199 | 0x33, 0xea, 0x00, 0x00, | 204 | 0x33, 0xea, 0x00, 0x00, |
200 | 0x30, 0x3f, 0xc0, 0x09, | 205 | 0x30, 0x3f, 0xc0, 0x09, |
201 | 0x30, 0xe0, 0x78, 0x61, | 206 | 0x30, 0xe0, 0x82, 0x61, |
202 | 0x20, 0x3f, 0x8e, 0x69, | 207 | 0x20, 0x3f, 0x98, 0x69, |
203 | 0x10, 0x3f, 0x78, 0x79, | 208 | 0x10, 0x3f, 0x82, 0x79, |
204 | 0x02, 0xea, 0x7e, 0x00, | 209 | 0x02, 0xea, 0x7e, 0x00, |
205 | 0x00, 0xea, 0x5e, 0x59, | 210 | 0x00, 0xea, 0x68, 0x59, |
206 | 0x01, 0xea, 0x00, 0x30, | 211 | 0x01, 0xea, 0x00, 0x30, |
207 | 0x02, 0x4e, 0x51, 0x35, | 212 | 0x02, 0x4e, 0x51, 0x35, |
208 | 0x01, 0xea, 0x7e, 0x00, | 213 | 0x01, 0xea, 0x7e, 0x00, |
209 | 0x11, 0xea, 0x5e, 0x59, | 214 | 0x11, 0xea, 0x68, 0x59, |
210 | 0x11, 0xea, 0x00, 0x00, | 215 | 0x11, 0xea, 0x00, 0x00, |
211 | 0x02, 0x4e, 0x51, 0x35, | 216 | 0x02, 0x4e, 0x51, 0x35, |
212 | 0xc0, 0x4a, 0x94, 0x00, | 217 | 0xc0, 0x4a, 0x94, 0x00, |
213 | 0x04, 0x41, 0x9c, 0x79, | 218 | 0x04, 0x41, 0xa6, 0x79, |
214 | 0x08, 0xea, 0x98, 0x00, | 219 | 0x08, 0xea, 0x98, 0x00, |
215 | 0x08, 0x57, 0xae, 0x00, | 220 | 0x08, 0x57, 0xae, 0x00, |
216 | 0x08, 0x3c, 0x78, 0x00, | 221 | 0x08, 0x3c, 0x78, 0x00, |
@@ -218,12 +223,12 @@ static uint8_t seqprog[] = { | |||
218 | 0x0f, 0x67, 0xc0, 0x09, | 223 | 0x0f, 0x67, 0xc0, 0x09, |
219 | 0x00, 0x3a, 0x75, 0x02, | 224 | 0x00, 0x3a, 0x75, 0x02, |
220 | 0x20, 0xea, 0x96, 0x00, | 225 | 0x20, 0xea, 0x96, 0x00, |
221 | 0x00, 0xe2, 0x14, 0x42, | 226 | 0x00, 0xe2, 0x28, 0x42, |
222 | 0xc0, 0x4a, 0x94, 0x00, | 227 | 0xc0, 0x4a, 0x94, 0x00, |
223 | 0x40, 0x3a, 0xc8, 0x69, | 228 | 0x40, 0x3a, 0xd2, 0x69, |
224 | 0x02, 0x55, 0x06, 0x68, | 229 | 0x02, 0x55, 0x06, 0x68, |
225 | 0x02, 0x56, 0xc8, 0x69, | 230 | 0x02, 0x56, 0xd2, 0x69, |
226 | 0xff, 0x5b, 0xc8, 0x61, | 231 | 0xff, 0x5b, 0xd2, 0x61, |
227 | 0x02, 0x20, 0x51, 0x31, | 232 | 0x02, 0x20, 0x51, 0x31, |
228 | 0x80, 0xea, 0xb2, 0x01, | 233 | 0x80, 0xea, 0xb2, 0x01, |
229 | 0x44, 0xea, 0x00, 0x00, | 234 | 0x44, 0xea, 0x00, 0x00, |
@@ -231,40 +236,45 @@ static uint8_t seqprog[] = { | |||
231 | 0x33, 0xea, 0x00, 0x00, | 236 | 0x33, 0xea, 0x00, 0x00, |
232 | 0xff, 0xea, 0xb2, 0x09, | 237 | 0xff, 0xea, 0xb2, 0x09, |
233 | 0xff, 0xe0, 0xc0, 0x19, | 238 | 0xff, 0xe0, 0xc0, 0x19, |
234 | 0xff, 0xe0, 0xca, 0x79, | 239 | 0xff, 0xe0, 0xd4, 0x79, |
235 | 0x02, 0xac, 0x51, 0x31, | 240 | 0x02, 0xac, 0x51, 0x31, |
236 | 0x00, 0xe2, 0xc0, 0x41, | 241 | 0x00, 0xe2, 0xca, 0x41, |
237 | 0x02, 0x5e, 0x50, 0x31, | 242 | 0x02, 0x5e, 0x50, 0x31, |
238 | 0x02, 0xa8, 0xb8, 0x30, | 243 | 0x02, 0xa8, 0xb8, 0x30, |
239 | 0x02, 0x5c, 0x50, 0x31, | 244 | 0x02, 0x5c, 0x50, 0x31, |
240 | 0xff, 0xad, 0xdb, 0x71, | 245 | 0xff, 0xad, 0xe5, 0x71, |
241 | 0x02, 0xac, 0x41, 0x31, | 246 | 0x02, 0xac, 0x41, 0x31, |
242 | 0x02, 0x22, 0x51, 0x31, | 247 | 0x02, 0x22, 0x51, 0x31, |
243 | 0x02, 0xa0, 0x5c, 0x33, | 248 | 0x02, 0xa0, 0x5c, 0x33, |
244 | 0x02, 0xa0, 0x44, 0x32, | 249 | 0x02, 0xa0, 0x44, 0x32, |
245 | 0x00, 0xe2, 0xe4, 0x41, | 250 | 0x00, 0xe2, 0xf8, 0x41, |
246 | 0x10, 0x92, 0xe5, 0x69, | 251 | 0x01, 0x4d, 0xf1, 0x79, |
252 | 0x01, 0x62, 0xc1, 0x31, | ||
253 | 0x00, 0x93, 0xf1, 0x61, | ||
254 | 0xfe, 0x4d, 0x9b, 0x0a, | ||
255 | 0x02, 0x60, 0x41, 0x31, | ||
256 | 0x00, 0xe2, 0xdc, 0x41, | ||
247 | 0x3d, 0x93, 0xc9, 0x29, | 257 | 0x3d, 0x93, 0xc9, 0x29, |
248 | 0x01, 0xe4, 0xc8, 0x01, | 258 | 0x01, 0xe4, 0xc8, 0x01, |
249 | 0x01, 0xea, 0xca, 0x01, | 259 | 0x01, 0xea, 0xca, 0x01, |
250 | 0xff, 0xea, 0xda, 0x01, | 260 | 0xff, 0xea, 0xda, 0x01, |
251 | 0x02, 0x20, 0x51, 0x31, | 261 | 0x02, 0x20, 0x51, 0x31, |
252 | 0x02, 0xae, 0x41, 0x32, | 262 | 0x02, 0xae, 0x41, 0x32, |
253 | 0xff, 0x21, 0xed, 0x61, | 263 | 0xff, 0x21, 0x01, 0x62, |
254 | 0xff, 0xea, 0x46, 0x02, | 264 | 0xff, 0xea, 0x46, 0x02, |
255 | 0x02, 0x5c, 0x50, 0x31, | 265 | 0x02, 0x5c, 0x50, 0x31, |
256 | 0x40, 0xea, 0x96, 0x00, | 266 | 0x40, 0xea, 0x96, 0x00, |
257 | 0x02, 0x56, 0x04, 0x6e, | 267 | 0x02, 0x56, 0x20, 0x6e, |
258 | 0x01, 0x55, 0x04, 0x6e, | 268 | 0x01, 0x55, 0x20, 0x6e, |
259 | 0x10, 0x92, 0xf9, 0x79, | 269 | 0x10, 0x92, 0x0d, 0x7a, |
260 | 0x10, 0x40, 0x02, 0x6a, | 270 | 0x10, 0x40, 0x16, 0x6a, |
261 | 0x01, 0x56, 0x02, 0x7a, | 271 | 0x01, 0x56, 0x16, 0x7a, |
262 | 0xff, 0x97, 0x07, 0x78, | 272 | 0xff, 0x97, 0x07, 0x78, |
263 | 0x13, 0xea, 0x64, 0x59, | 273 | 0x13, 0xea, 0x6e, 0x59, |
264 | 0x13, 0xea, 0x04, 0x00, | 274 | 0x13, 0xea, 0x04, 0x00, |
265 | 0x00, 0xe2, 0x06, 0x40, | 275 | 0x00, 0xe2, 0x06, 0x40, |
266 | 0xbf, 0x3a, 0x74, 0x08, | 276 | 0xbf, 0x3a, 0x74, 0x08, |
267 | 0x04, 0x41, 0x08, 0x7a, | 277 | 0x04, 0x41, 0x1c, 0x7a, |
268 | 0x08, 0xea, 0x98, 0x00, | 278 | 0x08, 0xea, 0x98, 0x00, |
269 | 0x08, 0x57, 0xae, 0x00, | 279 | 0x08, 0x57, 0xae, 0x00, |
270 | 0x01, 0x93, 0x75, 0x32, | 280 | 0x01, 0x93, 0x75, 0x32, |
@@ -272,108 +282,108 @@ static uint8_t seqprog[] = { | |||
272 | 0x40, 0xea, 0x72, 0x02, | 282 | 0x40, 0xea, 0x72, 0x02, |
273 | 0x08, 0x3c, 0x78, 0x00, | 283 | 0x08, 0x3c, 0x78, 0x00, |
274 | 0x80, 0xea, 0x6e, 0x02, | 284 | 0x80, 0xea, 0x6e, 0x02, |
275 | 0x00, 0xe2, 0xe2, 0x5b, | 285 | 0x00, 0xe2, 0xf6, 0x5b, |
276 | 0x01, 0x3c, 0xc1, 0x31, | 286 | 0x01, 0x3c, 0xc1, 0x31, |
277 | 0x9f, 0xe0, 0x84, 0x7c, | 287 | 0x9f, 0xe0, 0x98, 0x7c, |
278 | 0x80, 0xe0, 0x28, 0x72, | 288 | 0x80, 0xe0, 0x3c, 0x72, |
279 | 0xa0, 0xe0, 0x64, 0x72, | 289 | 0xa0, 0xe0, 0x78, 0x72, |
280 | 0xc0, 0xe0, 0x5a, 0x72, | 290 | 0xc0, 0xe0, 0x6e, 0x72, |
281 | 0xe0, 0xe0, 0x94, 0x72, | 291 | 0xe0, 0xe0, 0xa8, 0x72, |
282 | 0x01, 0xea, 0x64, 0x59, | 292 | 0x01, 0xea, 0x6e, 0x59, |
283 | 0x01, 0xea, 0x04, 0x00, | 293 | 0x01, 0xea, 0x04, 0x00, |
284 | 0x00, 0xe2, 0x14, 0x42, | 294 | 0x00, 0xe2, 0x28, 0x42, |
285 | 0x80, 0x39, 0x2f, 0x7a, | 295 | 0x80, 0x39, 0x43, 0x7a, |
286 | 0x03, 0xea, 0x64, 0x59, | 296 | 0x03, 0xea, 0x6e, 0x59, |
287 | 0x03, 0xea, 0x04, 0x00, | 297 | 0x03, 0xea, 0x04, 0x00, |
288 | 0xee, 0x00, 0x36, 0x6a, | 298 | 0xee, 0x00, 0x4a, 0x6a, |
289 | 0x05, 0xea, 0xb4, 0x00, | 299 | 0x05, 0xea, 0xb4, 0x00, |
290 | 0x33, 0xea, 0x5e, 0x59, | 300 | 0x33, 0xea, 0x68, 0x59, |
291 | 0x33, 0xea, 0x00, 0x00, | 301 | 0x33, 0xea, 0x00, 0x00, |
292 | 0x02, 0xa8, 0x9c, 0x32, | 302 | 0x02, 0xa8, 0x9c, 0x32, |
293 | 0x00, 0xe2, 0x7e, 0x59, | 303 | 0x00, 0xe2, 0x88, 0x59, |
294 | 0xef, 0x96, 0xd5, 0x19, | 304 | 0xef, 0x96, 0xd5, 0x19, |
295 | 0x00, 0xe2, 0x46, 0x52, | 305 | 0x00, 0xe2, 0x5a, 0x52, |
296 | 0x09, 0x80, 0xe1, 0x30, | 306 | 0x09, 0x80, 0xe1, 0x30, |
297 | 0x02, 0xea, 0x36, 0x00, | 307 | 0x02, 0xea, 0x36, 0x00, |
298 | 0xa8, 0xea, 0x32, 0x00, | 308 | 0xa8, 0xea, 0x32, 0x00, |
299 | 0x00, 0xe2, 0x4c, 0x42, | 309 | 0x00, 0xe2, 0x60, 0x42, |
300 | 0x01, 0x96, 0xd1, 0x30, | 310 | 0x01, 0x96, 0xd1, 0x30, |
301 | 0x10, 0x80, 0x89, 0x31, | 311 | 0x10, 0x80, 0x89, 0x31, |
302 | 0x20, 0xea, 0x32, 0x00, | 312 | 0x20, 0xea, 0x32, 0x00, |
303 | 0xbf, 0x39, 0x73, 0x0a, | 313 | 0xbf, 0x39, 0x73, 0x0a, |
304 | 0x10, 0x4c, 0x56, 0x6a, | 314 | 0x10, 0x4c, 0x6a, 0x6a, |
305 | 0x20, 0x19, 0x4e, 0x6a, | 315 | 0x20, 0x19, 0x62, 0x6a, |
306 | 0x20, 0x19, 0x52, 0x6a, | 316 | 0x20, 0x19, 0x66, 0x6a, |
307 | 0x02, 0x4d, 0x14, 0x6a, | 317 | 0x02, 0x4d, 0x28, 0x6a, |
308 | 0x40, 0x39, 0x73, 0x02, | 318 | 0x40, 0x39, 0x73, 0x02, |
309 | 0x00, 0xe2, 0x14, 0x42, | 319 | 0x00, 0xe2, 0x28, 0x42, |
310 | 0x80, 0x39, 0xd5, 0x6a, | 320 | 0x80, 0x39, 0xe9, 0x6a, |
311 | 0x01, 0x44, 0x10, 0x33, | 321 | 0x01, 0x44, 0x10, 0x33, |
312 | 0x08, 0x92, 0x25, 0x03, | 322 | 0x08, 0x92, 0x25, 0x03, |
313 | 0x00, 0xe2, 0x14, 0x42, | 323 | 0x00, 0xe2, 0x28, 0x42, |
314 | 0x10, 0xea, 0x80, 0x00, | 324 | 0x10, 0xea, 0x80, 0x00, |
315 | 0x01, 0x37, 0xc5, 0x31, | 325 | 0x01, 0x37, 0xc5, 0x31, |
316 | 0x80, 0xe2, 0x80, 0x62, | 326 | 0x80, 0xe2, 0x94, 0x62, |
317 | 0x10, 0x92, 0xa5, 0x6a, | 327 | 0x10, 0x92, 0xb9, 0x6a, |
318 | 0xc0, 0x94, 0xc5, 0x01, | 328 | 0xc0, 0x94, 0xc5, 0x01, |
319 | 0x40, 0x92, 0x71, 0x6a, | 329 | 0x40, 0x92, 0x85, 0x6a, |
320 | 0xbf, 0xe2, 0xc4, 0x09, | 330 | 0xbf, 0xe2, 0xc4, 0x09, |
321 | 0x20, 0x92, 0x85, 0x7a, | 331 | 0x20, 0x92, 0x99, 0x7a, |
322 | 0x01, 0xe2, 0x88, 0x30, | 332 | 0x01, 0xe2, 0x88, 0x30, |
323 | 0x00, 0xe2, 0xe2, 0x5b, | 333 | 0x00, 0xe2, 0xf6, 0x5b, |
324 | 0xa0, 0x3c, 0x8d, 0x62, | 334 | 0xa0, 0x3c, 0xa1, 0x62, |
325 | 0x23, 0x92, 0x89, 0x08, | 335 | 0x23, 0x92, 0x89, 0x08, |
326 | 0x00, 0xe2, 0xe2, 0x5b, | 336 | 0x00, 0xe2, 0xf6, 0x5b, |
327 | 0xa0, 0x3c, 0x8d, 0x62, | 337 | 0xa0, 0x3c, 0xa1, 0x62, |
328 | 0x00, 0xa8, 0x84, 0x42, | 338 | 0x00, 0xa8, 0x98, 0x42, |
329 | 0xff, 0xe2, 0x84, 0x62, | 339 | 0xff, 0xe2, 0x98, 0x62, |
330 | 0x00, 0xe2, 0xa4, 0x42, | 340 | 0x00, 0xe2, 0xb8, 0x42, |
331 | 0x40, 0xea, 0x98, 0x00, | 341 | 0x40, 0xea, 0x98, 0x00, |
332 | 0x01, 0xe2, 0x88, 0x30, | 342 | 0x01, 0xe2, 0x88, 0x30, |
333 | 0x00, 0xe2, 0xe2, 0x5b, | 343 | 0x00, 0xe2, 0xf6, 0x5b, |
334 | 0xa0, 0x3c, 0x63, 0x72, | 344 | 0xa0, 0x3c, 0x77, 0x72, |
335 | 0x40, 0xea, 0x98, 0x00, | 345 | 0x40, 0xea, 0x98, 0x00, |
336 | 0x01, 0x37, 0x95, 0x32, | 346 | 0x01, 0x37, 0x95, 0x32, |
337 | 0x08, 0xea, 0x6e, 0x02, | 347 | 0x08, 0xea, 0x6e, 0x02, |
338 | 0x00, 0xe2, 0x14, 0x42, | 348 | 0x00, 0xe2, 0x28, 0x42, |
339 | 0xe0, 0xea, 0xfe, 0x5b, | 349 | 0xe0, 0xea, 0x12, 0x5c, |
340 | 0x80, 0xe0, 0xe0, 0x6a, | 350 | 0x80, 0xe0, 0xf4, 0x6a, |
341 | 0x04, 0xe0, 0x92, 0x73, | 351 | 0x04, 0xe0, 0xa6, 0x73, |
342 | 0x02, 0xe0, 0xc4, 0x73, | 352 | 0x02, 0xe0, 0xd8, 0x73, |
343 | 0x00, 0xea, 0x3e, 0x73, | 353 | 0x00, 0xea, 0x52, 0x73, |
344 | 0x03, 0xe0, 0xd4, 0x73, | 354 | 0x03, 0xe0, 0xe8, 0x73, |
345 | 0x23, 0xe0, 0xb6, 0x72, | 355 | 0x23, 0xe0, 0xca, 0x72, |
346 | 0x08, 0xe0, 0xdc, 0x72, | 356 | 0x08, 0xe0, 0xf0, 0x72, |
347 | 0x00, 0xe2, 0xe2, 0x5b, | 357 | 0x00, 0xe2, 0xf6, 0x5b, |
348 | 0x07, 0xea, 0x64, 0x59, | 358 | 0x07, 0xea, 0x6e, 0x59, |
349 | 0x07, 0xea, 0x04, 0x00, | 359 | 0x07, 0xea, 0x04, 0x00, |
350 | 0x08, 0x48, 0x15, 0x72, | 360 | 0x08, 0x48, 0x29, 0x72, |
351 | 0x04, 0x48, 0xb3, 0x62, | 361 | 0x04, 0x48, 0xc7, 0x62, |
352 | 0x01, 0x49, 0x89, 0x30, | 362 | 0x01, 0x49, 0x89, 0x30, |
353 | 0x00, 0xe2, 0xa4, 0x42, | 363 | 0x00, 0xe2, 0xb8, 0x42, |
354 | 0x01, 0x44, 0xd4, 0x31, | 364 | 0x01, 0x44, 0xd4, 0x31, |
355 | 0x00, 0xe2, 0xa4, 0x42, | 365 | 0x00, 0xe2, 0xb8, 0x42, |
356 | 0x01, 0x00, 0x6c, 0x32, | 366 | 0x01, 0x00, 0x6c, 0x32, |
357 | 0x33, 0xea, 0x5e, 0x59, | 367 | 0x33, 0xea, 0x68, 0x59, |
358 | 0x33, 0xea, 0x00, 0x00, | 368 | 0x33, 0xea, 0x00, 0x00, |
359 | 0x4c, 0x3a, 0xc1, 0x28, | 369 | 0x4c, 0x3a, 0xc1, 0x28, |
360 | 0x01, 0x64, 0xc0, 0x31, | 370 | 0x01, 0x64, 0xc0, 0x31, |
361 | 0x00, 0x36, 0x5f, 0x59, | 371 | 0x00, 0x36, 0x69, 0x59, |
362 | 0x01, 0x36, 0x01, 0x30, | 372 | 0x01, 0x36, 0x01, 0x30, |
363 | 0x01, 0xe0, 0xda, 0x7a, | 373 | 0x01, 0xe0, 0xee, 0x7a, |
364 | 0xa0, 0xea, 0xf4, 0x5b, | 374 | 0xa0, 0xea, 0x08, 0x5c, |
365 | 0x01, 0xa0, 0xda, 0x62, | 375 | 0x01, 0xa0, 0xee, 0x62, |
366 | 0x01, 0x84, 0xcf, 0x7a, | 376 | 0x01, 0x84, 0xe3, 0x7a, |
367 | 0x01, 0x95, 0xdd, 0x6a, | 377 | 0x01, 0x95, 0xf1, 0x6a, |
368 | 0x05, 0xea, 0x64, 0x59, | 378 | 0x05, 0xea, 0x6e, 0x59, |
369 | 0x05, 0xea, 0x04, 0x00, | 379 | 0x05, 0xea, 0x04, 0x00, |
370 | 0x00, 0xe2, 0xdc, 0x42, | 380 | 0x00, 0xe2, 0xf0, 0x42, |
371 | 0x03, 0xea, 0x64, 0x59, | 381 | 0x03, 0xea, 0x6e, 0x59, |
372 | 0x03, 0xea, 0x04, 0x00, | 382 | 0x03, 0xea, 0x04, 0x00, |
373 | 0x00, 0xe2, 0xdc, 0x42, | 383 | 0x00, 0xe2, 0xf0, 0x42, |
374 | 0x07, 0xea, 0x06, 0x5c, | 384 | 0x07, 0xea, 0x1a, 0x5c, |
375 | 0x01, 0x44, 0xd4, 0x31, | 385 | 0x01, 0x44, 0xd4, 0x31, |
376 | 0x00, 0xe2, 0x14, 0x42, | 386 | 0x00, 0xe2, 0x28, 0x42, |
377 | 0x3f, 0xe0, 0x76, 0x0a, | 387 | 0x3f, 0xe0, 0x76, 0x0a, |
378 | 0xc0, 0x3a, 0xc1, 0x09, | 388 | 0xc0, 0x3a, 0xc1, 0x09, |
379 | 0x00, 0x3b, 0x51, 0x01, | 389 | 0x00, 0x3b, 0x51, 0x01, |
@@ -384,54 +394,54 @@ static uint8_t seqprog[] = { | |||
384 | 0x01, 0xea, 0xc6, 0x01, | 394 | 0x01, 0xea, 0xc6, 0x01, |
385 | 0x02, 0xe2, 0xc8, 0x31, | 395 | 0x02, 0xe2, 0xc8, 0x31, |
386 | 0x02, 0xec, 0x40, 0x31, | 396 | 0x02, 0xec, 0x40, 0x31, |
387 | 0xff, 0xa1, 0xfc, 0x72, | 397 | 0xff, 0xa1, 0x10, 0x73, |
388 | 0x02, 0xe8, 0xda, 0x31, | 398 | 0x02, 0xe8, 0xda, 0x31, |
389 | 0x02, 0xa0, 0x50, 0x31, | 399 | 0x02, 0xa0, 0x50, 0x31, |
390 | 0x00, 0xe2, 0x1e, 0x43, | 400 | 0x00, 0xe2, 0x32, 0x43, |
391 | 0x80, 0x39, 0x73, 0x02, | 401 | 0x80, 0x39, 0x73, 0x02, |
392 | 0x01, 0x44, 0xd4, 0x31, | 402 | 0x01, 0x44, 0xd4, 0x31, |
393 | 0x00, 0xe2, 0xe2, 0x5b, | 403 | 0x00, 0xe2, 0xf6, 0x5b, |
394 | 0x01, 0x39, 0x73, 0x02, | 404 | 0x01, 0x39, 0x73, 0x02, |
395 | 0xe0, 0x3c, 0x39, 0x63, | 405 | 0xe0, 0x3c, 0x4d, 0x63, |
396 | 0x02, 0x39, 0x73, 0x02, | 406 | 0x02, 0x39, 0x73, 0x02, |
397 | 0x20, 0x46, 0x32, 0x63, | 407 | 0x20, 0x46, 0x46, 0x63, |
398 | 0xff, 0xea, 0x52, 0x09, | 408 | 0xff, 0xea, 0x52, 0x09, |
399 | 0xa8, 0xea, 0xf4, 0x5b, | 409 | 0xa8, 0xea, 0x08, 0x5c, |
400 | 0x04, 0x92, 0x19, 0x7b, | 410 | 0x04, 0x92, 0x2d, 0x7b, |
401 | 0x01, 0x3a, 0xc1, 0x31, | 411 | 0x01, 0x3a, 0xc1, 0x31, |
402 | 0x00, 0x93, 0x19, 0x63, | 412 | 0x00, 0x93, 0x2d, 0x63, |
403 | 0x01, 0x3b, 0xc1, 0x31, | 413 | 0x01, 0x3b, 0xc1, 0x31, |
404 | 0x00, 0x94, 0x23, 0x73, | 414 | 0x00, 0x94, 0x37, 0x73, |
405 | 0x01, 0xa9, 0x52, 0x11, | 415 | 0x01, 0xa9, 0x52, 0x11, |
406 | 0xff, 0xa9, 0x0e, 0x6b, | 416 | 0xff, 0xa9, 0x22, 0x6b, |
407 | 0x00, 0xe2, 0x32, 0x43, | 417 | 0x00, 0xe2, 0x46, 0x43, |
408 | 0x10, 0x39, 0x73, 0x02, | 418 | 0x10, 0x39, 0x73, 0x02, |
409 | 0x04, 0x92, 0x33, 0x7b, | 419 | 0x04, 0x92, 0x47, 0x7b, |
410 | 0xfb, 0x92, 0x25, 0x0b, | 420 | 0xfb, 0x92, 0x25, 0x0b, |
411 | 0xff, 0xea, 0x72, 0x0a, | 421 | 0xff, 0xea, 0x72, 0x0a, |
412 | 0x01, 0xa4, 0x2d, 0x6b, | 422 | 0x01, 0xa4, 0x41, 0x6b, |
413 | 0x02, 0xa8, 0x9c, 0x32, | 423 | 0x02, 0xa8, 0x9c, 0x32, |
414 | 0x00, 0xe2, 0x7e, 0x59, | 424 | 0x00, 0xe2, 0x88, 0x59, |
415 | 0x10, 0x92, 0xdd, 0x7a, | 425 | 0x10, 0x92, 0xf1, 0x7a, |
416 | 0xff, 0xea, 0x06, 0x5c, | 426 | 0xff, 0xea, 0x1a, 0x5c, |
417 | 0x00, 0xe2, 0xdc, 0x42, | 427 | 0x00, 0xe2, 0xf0, 0x42, |
418 | 0x04, 0xea, 0x64, 0x59, | 428 | 0x04, 0xea, 0x6e, 0x59, |
419 | 0x04, 0xea, 0x04, 0x00, | 429 | 0x04, 0xea, 0x04, 0x00, |
420 | 0x00, 0xe2, 0xdc, 0x42, | 430 | 0x00, 0xe2, 0xf0, 0x42, |
421 | 0x04, 0xea, 0x64, 0x59, | 431 | 0x04, 0xea, 0x6e, 0x59, |
422 | 0x04, 0xea, 0x04, 0x00, | 432 | 0x04, 0xea, 0x04, 0x00, |
423 | 0x00, 0xe2, 0x14, 0x42, | 433 | 0x00, 0xe2, 0x28, 0x42, |
424 | 0x08, 0x92, 0xd5, 0x7a, | 434 | 0x08, 0x92, 0xe9, 0x7a, |
425 | 0xc0, 0x39, 0x49, 0x7b, | 435 | 0xc0, 0x39, 0x5d, 0x7b, |
426 | 0x80, 0x39, 0xd5, 0x6a, | 436 | 0x80, 0x39, 0xe9, 0x6a, |
427 | 0xff, 0x88, 0x49, 0x6b, | 437 | 0xff, 0x88, 0x5d, 0x6b, |
428 | 0x40, 0x39, 0xd5, 0x6a, | 438 | 0x40, 0x39, 0xe9, 0x6a, |
429 | 0x10, 0x92, 0x4f, 0x7b, | 439 | 0x10, 0x92, 0x63, 0x7b, |
430 | 0x0a, 0xea, 0x64, 0x59, | 440 | 0x0a, 0xea, 0x6e, 0x59, |
431 | 0x0a, 0xea, 0x04, 0x00, | 441 | 0x0a, 0xea, 0x04, 0x00, |
432 | 0x00, 0xe2, 0x6e, 0x5b, | 442 | 0x00, 0xe2, 0x82, 0x5b, |
433 | 0x00, 0xe2, 0xae, 0x43, | 443 | 0x00, 0xe2, 0xc2, 0x43, |
434 | 0x50, 0x4b, 0x56, 0x6b, | 444 | 0x50, 0x4b, 0x6a, 0x6b, |
435 | 0xbf, 0x3a, 0x74, 0x08, | 445 | 0xbf, 0x3a, 0x74, 0x08, |
436 | 0x01, 0xe0, 0xf4, 0x31, | 446 | 0x01, 0xe0, 0xf4, 0x31, |
437 | 0xff, 0xea, 0xc0, 0x09, | 447 | 0xff, 0xea, 0xc0, 0x09, |
@@ -441,31 +451,31 @@ static uint8_t seqprog[] = { | |||
441 | 0x01, 0xfa, 0xc0, 0x35, | 451 | 0x01, 0xfa, 0xc0, 0x35, |
442 | 0x02, 0xa8, 0x90, 0x32, | 452 | 0x02, 0xa8, 0x90, 0x32, |
443 | 0x02, 0xea, 0xb4, 0x00, | 453 | 0x02, 0xea, 0xb4, 0x00, |
444 | 0x33, 0xea, 0x5e, 0x59, | 454 | 0x33, 0xea, 0x68, 0x59, |
445 | 0x33, 0xea, 0x00, 0x00, | 455 | 0x33, 0xea, 0x00, 0x00, |
446 | 0x02, 0x48, 0x51, 0x31, | 456 | 0x02, 0x48, 0x51, 0x31, |
447 | 0xff, 0x90, 0x85, 0x68, | 457 | 0xff, 0x90, 0x85, 0x68, |
448 | 0xff, 0x88, 0x7b, 0x6b, | 458 | 0xff, 0x88, 0x8f, 0x6b, |
449 | 0x01, 0xa4, 0x77, 0x6b, | 459 | 0x01, 0xa4, 0x8b, 0x6b, |
450 | 0x02, 0xa4, 0x7f, 0x6b, | 460 | 0x02, 0xa4, 0x93, 0x6b, |
451 | 0x01, 0x84, 0x7f, 0x7b, | 461 | 0x01, 0x84, 0x93, 0x7b, |
452 | 0x02, 0x28, 0x19, 0x33, | 462 | 0x02, 0x28, 0x19, 0x33, |
453 | 0x02, 0xa8, 0x50, 0x36, | 463 | 0x02, 0xa8, 0x50, 0x36, |
454 | 0xff, 0x88, 0x7f, 0x73, | 464 | 0xff, 0x88, 0x93, 0x73, |
455 | 0x00, 0xe2, 0x52, 0x5b, | 465 | 0x00, 0xe2, 0x66, 0x5b, |
456 | 0x02, 0xa8, 0x20, 0x33, | 466 | 0x02, 0xa8, 0x20, 0x33, |
457 | 0x04, 0xa4, 0x49, 0x03, | 467 | 0x04, 0xa4, 0x49, 0x03, |
458 | 0xff, 0xea, 0x1a, 0x03, | 468 | 0xff, 0xea, 0x1a, 0x03, |
459 | 0xff, 0x2d, 0x8b, 0x63, | 469 | 0xff, 0x2d, 0x9f, 0x63, |
460 | 0x02, 0xa8, 0x58, 0x32, | 470 | 0x02, 0xa8, 0x58, 0x32, |
461 | 0x02, 0xa8, 0x5c, 0x36, | 471 | 0x02, 0xa8, 0x5c, 0x36, |
462 | 0x02, 0xa8, 0x40, 0x31, | 472 | 0x02, 0xa8, 0x40, 0x31, |
463 | 0x02, 0x2e, 0x51, 0x31, | 473 | 0x02, 0x2e, 0x51, 0x31, |
464 | 0x02, 0xa0, 0x18, 0x33, | 474 | 0x02, 0xa0, 0x18, 0x33, |
465 | 0x02, 0xa0, 0x5c, 0x36, | 475 | 0x02, 0xa0, 0x5c, 0x36, |
466 | 0xc0, 0x39, 0xd5, 0x6a, | 476 | 0xc0, 0x39, 0xe9, 0x6a, |
467 | 0x04, 0x92, 0x25, 0x03, | 477 | 0x04, 0x92, 0x25, 0x03, |
468 | 0x20, 0x92, 0xaf, 0x6b, | 478 | 0x20, 0x92, 0xc3, 0x6b, |
469 | 0x02, 0xa8, 0x40, 0x31, | 479 | 0x02, 0xa8, 0x40, 0x31, |
470 | 0xc0, 0x3a, 0xc1, 0x09, | 480 | 0xc0, 0x3a, 0xc1, 0x09, |
471 | 0x00, 0x3b, 0x51, 0x01, | 481 | 0x00, 0x3b, 0x51, 0x01, |
@@ -480,60 +490,60 @@ static uint8_t seqprog[] = { | |||
480 | 0xf7, 0x57, 0xae, 0x08, | 490 | 0xf7, 0x57, 0xae, 0x08, |
481 | 0x08, 0xea, 0x98, 0x00, | 491 | 0x08, 0xea, 0x98, 0x00, |
482 | 0x01, 0x44, 0xd4, 0x31, | 492 | 0x01, 0x44, 0xd4, 0x31, |
483 | 0xee, 0x00, 0xb8, 0x6b, | 493 | 0xee, 0x00, 0xcc, 0x6b, |
484 | 0x02, 0xea, 0xb4, 0x00, | 494 | 0x02, 0xea, 0xb4, 0x00, |
485 | 0xc0, 0xea, 0x72, 0x02, | 495 | 0xc0, 0xea, 0x72, 0x02, |
486 | 0x09, 0x4c, 0xba, 0x7b, | 496 | 0x09, 0x4c, 0xce, 0x7b, |
487 | 0x01, 0xea, 0x78, 0x02, | 497 | 0x01, 0xea, 0x78, 0x02, |
488 | 0x08, 0x4c, 0x06, 0x68, | 498 | 0x08, 0x4c, 0x06, 0x68, |
489 | 0x0b, 0xea, 0x64, 0x59, | 499 | 0x0b, 0xea, 0x6e, 0x59, |
490 | 0x0b, 0xea, 0x04, 0x00, | 500 | 0x0b, 0xea, 0x04, 0x00, |
491 | 0x01, 0x44, 0xd4, 0x31, | 501 | 0x01, 0x44, 0xd4, 0x31, |
492 | 0x20, 0x39, 0x15, 0x7a, | 502 | 0x20, 0x39, 0x29, 0x7a, |
493 | 0x00, 0xe2, 0xcc, 0x5b, | 503 | 0x00, 0xe2, 0xe0, 0x5b, |
494 | 0x00, 0xe2, 0x14, 0x42, | 504 | 0x00, 0xe2, 0x28, 0x42, |
495 | 0x01, 0x84, 0xd1, 0x7b, | 505 | 0x01, 0x84, 0xe5, 0x7b, |
496 | 0x01, 0xa4, 0x49, 0x07, | 506 | 0x01, 0xa4, 0x49, 0x07, |
497 | 0x08, 0x60, 0x30, 0x33, | 507 | 0x08, 0x60, 0x30, 0x33, |
498 | 0x08, 0x80, 0x41, 0x37, | 508 | 0x08, 0x80, 0x41, 0x37, |
499 | 0xdf, 0x39, 0x73, 0x0a, | 509 | 0xdf, 0x39, 0x73, 0x0a, |
500 | 0xee, 0x00, 0xde, 0x6b, | 510 | 0xee, 0x00, 0xf2, 0x6b, |
501 | 0x05, 0xea, 0xb4, 0x00, | 511 | 0x05, 0xea, 0xb4, 0x00, |
502 | 0x33, 0xea, 0x5e, 0x59, | 512 | 0x33, 0xea, 0x68, 0x59, |
503 | 0x33, 0xea, 0x00, 0x00, | 513 | 0x33, 0xea, 0x00, 0x00, |
504 | 0x00, 0xe2, 0x7e, 0x59, | 514 | 0x00, 0xe2, 0x88, 0x59, |
505 | 0x00, 0xe2, 0xdc, 0x42, | 515 | 0x00, 0xe2, 0xf0, 0x42, |
506 | 0xff, 0x42, 0xee, 0x6b, | 516 | 0xff, 0x42, 0x02, 0x6c, |
507 | 0x01, 0x41, 0xe2, 0x6b, | 517 | 0x01, 0x41, 0xf6, 0x6b, |
508 | 0x02, 0x41, 0xe2, 0x7b, | 518 | 0x02, 0x41, 0xf6, 0x7b, |
509 | 0xff, 0x42, 0xee, 0x6b, | 519 | 0xff, 0x42, 0x02, 0x6c, |
510 | 0x01, 0x41, 0xe2, 0x6b, | 520 | 0x01, 0x41, 0xf6, 0x6b, |
511 | 0x02, 0x41, 0xe2, 0x7b, | 521 | 0x02, 0x41, 0xf6, 0x7b, |
512 | 0xff, 0x42, 0xee, 0x7b, | 522 | 0xff, 0x42, 0x02, 0x7c, |
513 | 0x04, 0x4c, 0xe2, 0x6b, | 523 | 0x04, 0x4c, 0xf6, 0x6b, |
514 | 0xe0, 0x41, 0x78, 0x0e, | 524 | 0xe0, 0x41, 0x78, 0x0e, |
515 | 0x01, 0x44, 0xd4, 0x31, | 525 | 0x01, 0x44, 0xd4, 0x31, |
516 | 0xff, 0x42, 0xf6, 0x7b, | 526 | 0xff, 0x42, 0x0a, 0x7c, |
517 | 0x04, 0x4c, 0xf6, 0x6b, | 527 | 0x04, 0x4c, 0x0a, 0x6c, |
518 | 0xe0, 0x41, 0x78, 0x0a, | 528 | 0xe0, 0x41, 0x78, 0x0a, |
519 | 0xe0, 0x3c, 0x15, 0x62, | 529 | 0xe0, 0x3c, 0x29, 0x62, |
520 | 0xff, 0xea, 0xca, 0x09, | 530 | 0xff, 0xea, 0xca, 0x09, |
521 | 0x01, 0xe2, 0xc8, 0x31, | 531 | 0x01, 0xe2, 0xc8, 0x31, |
522 | 0x01, 0x46, 0xda, 0x35, | 532 | 0x01, 0x46, 0xda, 0x35, |
523 | 0x01, 0x44, 0xd4, 0x35, | 533 | 0x01, 0x44, 0xd4, 0x35, |
524 | 0x10, 0xea, 0x80, 0x00, | 534 | 0x10, 0xea, 0x80, 0x00, |
525 | 0x01, 0xe2, 0x6e, 0x36, | 535 | 0x01, 0xe2, 0x6e, 0x36, |
526 | 0x04, 0xa6, 0x0e, 0x7c, | 536 | 0x04, 0xa6, 0x22, 0x7c, |
527 | 0xff, 0xea, 0x5a, 0x09, | 537 | 0xff, 0xea, 0x5a, 0x09, |
528 | 0xff, 0xea, 0x4c, 0x0d, | 538 | 0xff, 0xea, 0x4c, 0x0d, |
529 | 0x01, 0xa6, 0x3a, 0x6c, | 539 | 0x01, 0xa6, 0x4e, 0x6c, |
530 | 0x10, 0xad, 0x84, 0x78, | 540 | 0x10, 0xad, 0x84, 0x78, |
531 | 0x80, 0xad, 0x32, 0x6c, | 541 | 0x80, 0xad, 0x46, 0x6c, |
532 | 0x08, 0xad, 0x84, 0x68, | 542 | 0x08, 0xad, 0x84, 0x68, |
533 | 0x20, 0x19, 0x26, 0x7c, | 543 | 0x20, 0x19, 0x3a, 0x7c, |
534 | 0x80, 0xea, 0xb2, 0x01, | 544 | 0x80, 0xea, 0xb2, 0x01, |
535 | 0x11, 0x00, 0x00, 0x10, | 545 | 0x11, 0x00, 0x00, 0x10, |
536 | 0x02, 0xa6, 0x22, 0x7c, | 546 | 0x02, 0xa6, 0x36, 0x7c, |
537 | 0xff, 0xea, 0xb2, 0x0d, | 547 | 0xff, 0xea, 0xb2, 0x0d, |
538 | 0x11, 0x00, 0x00, 0x10, | 548 | 0x11, 0x00, 0x00, 0x10, |
539 | 0xff, 0xea, 0xb2, 0x09, | 549 | 0xff, 0xea, 0xb2, 0x09, |
@@ -561,7 +571,7 @@ static uint8_t seqprog[] = { | |||
561 | 0x00, 0x86, 0x0d, 0x23, | 571 | 0x00, 0x86, 0x0d, 0x23, |
562 | 0x00, 0x87, 0x0f, 0x23, | 572 | 0x00, 0x87, 0x0f, 0x23, |
563 | 0x01, 0x84, 0xc5, 0x31, | 573 | 0x01, 0x84, 0xc5, 0x31, |
564 | 0x80, 0x83, 0x5d, 0x7c, | 574 | 0x80, 0x83, 0x71, 0x7c, |
565 | 0x02, 0xe2, 0xc4, 0x01, | 575 | 0x02, 0xe2, 0xc4, 0x01, |
566 | 0xff, 0xea, 0x4c, 0x09, | 576 | 0xff, 0xea, 0x4c, 0x09, |
567 | 0x01, 0xe2, 0x36, 0x30, | 577 | 0x01, 0xe2, 0x36, 0x30, |
@@ -572,75 +582,75 @@ static uint8_t seqprog[] = { | |||
572 | 0xfe, 0xa6, 0x4c, 0x0d, | 582 | 0xfe, 0xa6, 0x4c, 0x0d, |
573 | 0x0b, 0x98, 0xe1, 0x30, | 583 | 0x0b, 0x98, 0xe1, 0x30, |
574 | 0xfd, 0xa4, 0x49, 0x09, | 584 | 0xfd, 0xa4, 0x49, 0x09, |
575 | 0x80, 0xa3, 0x71, 0x7c, | 585 | 0x80, 0xa3, 0x85, 0x7c, |
576 | 0x02, 0xa4, 0x48, 0x01, | 586 | 0x02, 0xa4, 0x48, 0x01, |
577 | 0x01, 0xa4, 0x36, 0x30, | 587 | 0x01, 0xa4, 0x36, 0x30, |
578 | 0xa8, 0xea, 0x32, 0x00, | 588 | 0xa8, 0xea, 0x32, 0x00, |
579 | 0xfd, 0xa4, 0x49, 0x0b, | 589 | 0xfd, 0xa4, 0x49, 0x0b, |
580 | 0x05, 0xa3, 0x07, 0x33, | 590 | 0x05, 0xa3, 0x07, 0x33, |
581 | 0x80, 0x83, 0x7d, 0x6c, | 591 | 0x80, 0x83, 0x91, 0x6c, |
582 | 0x02, 0xea, 0x4c, 0x05, | 592 | 0x02, 0xea, 0x4c, 0x05, |
583 | 0xff, 0xea, 0x4c, 0x0d, | 593 | 0xff, 0xea, 0x4c, 0x0d, |
584 | 0x00, 0xe2, 0x56, 0x59, | 594 | 0x00, 0xe2, 0x60, 0x59, |
585 | 0x02, 0xa6, 0x10, 0x6c, | 595 | 0x02, 0xa6, 0x24, 0x6c, |
586 | 0x80, 0xf9, 0xf2, 0x05, | 596 | 0x80, 0xf9, 0xf2, 0x05, |
587 | 0xc0, 0x39, 0x8b, 0x7c, | 597 | 0xc0, 0x39, 0x9f, 0x7c, |
588 | 0x03, 0xea, 0x64, 0x59, | 598 | 0x03, 0xea, 0x6e, 0x59, |
589 | 0x03, 0xea, 0x04, 0x00, | 599 | 0x03, 0xea, 0x04, 0x00, |
590 | 0x20, 0x39, 0xaf, 0x7c, | 600 | 0x20, 0x39, 0xc3, 0x7c, |
591 | 0x01, 0x84, 0x95, 0x6c, | 601 | 0x01, 0x84, 0xa9, 0x6c, |
592 | 0x06, 0xea, 0x64, 0x59, | 602 | 0x06, 0xea, 0x6e, 0x59, |
593 | 0x06, 0xea, 0x04, 0x00, | 603 | 0x06, 0xea, 0x04, 0x00, |
594 | 0x00, 0xe2, 0xb2, 0x44, | 604 | 0x00, 0xe2, 0xc6, 0x44, |
595 | 0x01, 0x00, 0x6c, 0x32, | 605 | 0x01, 0x00, 0x6c, 0x32, |
596 | 0xee, 0x00, 0x9e, 0x6c, | 606 | 0xee, 0x00, 0xb2, 0x6c, |
597 | 0x05, 0xea, 0xb4, 0x00, | 607 | 0x05, 0xea, 0xb4, 0x00, |
598 | 0x33, 0xea, 0x5e, 0x59, | 608 | 0x33, 0xea, 0x68, 0x59, |
599 | 0x33, 0xea, 0x00, 0x00, | 609 | 0x33, 0xea, 0x00, 0x00, |
600 | 0x80, 0x3d, 0x7a, 0x00, | 610 | 0x80, 0x3d, 0x7a, 0x00, |
601 | 0xfc, 0x42, 0xa0, 0x7c, | 611 | 0xfc, 0x42, 0xb4, 0x7c, |
602 | 0x7f, 0x3d, 0x7a, 0x08, | 612 | 0x7f, 0x3d, 0x7a, 0x08, |
603 | 0x00, 0x36, 0x5f, 0x59, | 613 | 0x00, 0x36, 0x69, 0x59, |
604 | 0x01, 0x36, 0x01, 0x30, | 614 | 0x01, 0x36, 0x01, 0x30, |
605 | 0x09, 0xea, 0x64, 0x59, | 615 | 0x09, 0xea, 0x6e, 0x59, |
606 | 0x09, 0xea, 0x04, 0x00, | 616 | 0x09, 0xea, 0x04, 0x00, |
607 | 0x00, 0xe2, 0x14, 0x42, | 617 | 0x00, 0xe2, 0x28, 0x42, |
608 | 0x01, 0xa4, 0x95, 0x6c, | 618 | 0x01, 0xa4, 0xa9, 0x6c, |
609 | 0x00, 0xe2, 0x68, 0x5c, | 619 | 0x00, 0xe2, 0x7c, 0x5c, |
610 | 0x20, 0x39, 0x73, 0x02, | 620 | 0x20, 0x39, 0x73, 0x02, |
611 | 0x01, 0x00, 0x6c, 0x32, | 621 | 0x01, 0x00, 0x6c, 0x32, |
612 | 0x02, 0xa6, 0xba, 0x7c, | 622 | 0x02, 0xa6, 0xce, 0x7c, |
613 | 0x00, 0xe2, 0x7e, 0x5c, | 623 | 0x00, 0xe2, 0x92, 0x5c, |
614 | 0x00, 0xe2, 0x76, 0x58, | 624 | 0x00, 0xe2, 0x76, 0x58, |
615 | 0x00, 0xe2, 0x86, 0x58, | 625 | 0x00, 0xe2, 0x86, 0x58, |
616 | 0x00, 0xe2, 0x5a, 0x58, | 626 | 0x00, 0xe2, 0x5a, 0x58, |
617 | 0x00, 0x36, 0x5f, 0x59, | 627 | 0x00, 0x36, 0x69, 0x59, |
618 | 0x01, 0x36, 0x01, 0x30, | 628 | 0x01, 0x36, 0x01, 0x30, |
619 | 0x20, 0x19, 0xba, 0x6c, | 629 | 0x20, 0x19, 0xce, 0x6c, |
620 | 0x00, 0xe2, 0xea, 0x5c, | 630 | 0x00, 0xe2, 0xfe, 0x5c, |
621 | 0x04, 0x19, 0xd4, 0x6c, | 631 | 0x04, 0x19, 0xe8, 0x6c, |
622 | 0x02, 0x19, 0x32, 0x00, | 632 | 0x02, 0x19, 0x32, 0x00, |
623 | 0x01, 0x84, 0xd5, 0x7c, | 633 | 0x01, 0x84, 0xe9, 0x7c, |
624 | 0x01, 0x1b, 0xce, 0x7c, | 634 | 0x01, 0x1b, 0xe2, 0x7c, |
625 | 0x01, 0x1a, 0xd4, 0x6c, | 635 | 0x01, 0x1a, 0xe8, 0x6c, |
626 | 0x00, 0xe2, 0x84, 0x44, | 636 | 0x00, 0xe2, 0x98, 0x44, |
627 | 0x80, 0x4b, 0xda, 0x6c, | 637 | 0x80, 0x4b, 0xee, 0x6c, |
628 | 0x01, 0x4c, 0xd6, 0x7c, | 638 | 0x01, 0x4c, 0xea, 0x7c, |
629 | 0x03, 0x42, 0x84, 0x6c, | 639 | 0x03, 0x42, 0x98, 0x6c, |
630 | 0x00, 0xe2, 0x0a, 0x5c, | 640 | 0x00, 0xe2, 0x1e, 0x5c, |
631 | 0x80, 0xf9, 0xf2, 0x01, | 641 | 0x80, 0xf9, 0xf2, 0x01, |
632 | 0x04, 0x39, 0x15, 0x7a, | 642 | 0x04, 0x39, 0x29, 0x7a, |
633 | 0x00, 0xe2, 0x14, 0x42, | 643 | 0x00, 0xe2, 0x28, 0x42, |
634 | 0x08, 0x5d, 0xf2, 0x6c, | 644 | 0x08, 0x5d, 0x06, 0x6d, |
635 | 0x00, 0xe2, 0x76, 0x58, | 645 | 0x00, 0xe2, 0x76, 0x58, |
636 | 0x00, 0x36, 0x5f, 0x59, | 646 | 0x00, 0x36, 0x69, 0x59, |
637 | 0x01, 0x36, 0x01, 0x30, | 647 | 0x01, 0x36, 0x01, 0x30, |
638 | 0x02, 0x1b, 0xe2, 0x7c, | 648 | 0x02, 0x1b, 0xf6, 0x7c, |
639 | 0x08, 0x5d, 0xf0, 0x7c, | 649 | 0x08, 0x5d, 0x04, 0x7d, |
640 | 0x03, 0x68, 0x00, 0x37, | 650 | 0x03, 0x68, 0x00, 0x37, |
641 | 0x01, 0x84, 0x09, 0x07, | 651 | 0x01, 0x84, 0x09, 0x07, |
642 | 0x80, 0x1b, 0xfc, 0x7c, | 652 | 0x80, 0x1b, 0x10, 0x7d, |
643 | 0x80, 0x84, 0xfd, 0x6c, | 653 | 0x80, 0x84, 0x11, 0x6d, |
644 | 0xff, 0x85, 0x0b, 0x1b, | 654 | 0xff, 0x85, 0x0b, 0x1b, |
645 | 0xff, 0x86, 0x0d, 0x23, | 655 | 0xff, 0x86, 0x0d, 0x23, |
646 | 0xff, 0x87, 0x0f, 0x23, | 656 | 0xff, 0x87, 0x0f, 0x23, |
@@ -652,161 +662,164 @@ static uint8_t seqprog[] = { | |||
652 | 0xf9, 0xd9, 0xb2, 0x0d, | 662 | 0xf9, 0xd9, 0xb2, 0x0d, |
653 | 0x01, 0xd9, 0xb2, 0x05, | 663 | 0x01, 0xd9, 0xb2, 0x05, |
654 | 0x01, 0x52, 0x48, 0x31, | 664 | 0x01, 0x52, 0x48, 0x31, |
655 | 0x20, 0xa4, 0x26, 0x7d, | 665 | 0x20, 0xa4, 0x3a, 0x7d, |
656 | 0x20, 0x5b, 0x26, 0x7d, | 666 | 0x20, 0x5b, 0x3a, 0x7d, |
657 | 0x80, 0xf9, 0x34, 0x7d, | 667 | 0x80, 0xf9, 0x48, 0x7d, |
658 | 0x02, 0xea, 0xb4, 0x00, | 668 | 0x02, 0xea, 0xb4, 0x00, |
659 | 0x11, 0x00, 0x00, 0x10, | 669 | 0x11, 0x00, 0x00, 0x10, |
660 | 0x04, 0x19, 0x40, 0x7d, | 670 | 0x04, 0x19, 0x54, 0x7d, |
661 | 0xdf, 0x19, 0x32, 0x08, | 671 | 0xdf, 0x19, 0x32, 0x08, |
662 | 0x60, 0x5b, 0x40, 0x6d, | 672 | 0x60, 0x5b, 0x54, 0x6d, |
663 | 0x01, 0x4c, 0x1a, 0x7d, | 673 | 0x01, 0x4c, 0x2e, 0x7d, |
664 | 0x20, 0x19, 0x32, 0x00, | 674 | 0x20, 0x19, 0x32, 0x00, |
665 | 0x01, 0xd9, 0xb2, 0x05, | 675 | 0x01, 0xd9, 0xb2, 0x05, |
666 | 0x02, 0xea, 0xb4, 0x00, | 676 | 0x02, 0xea, 0xb4, 0x00, |
667 | 0x01, 0xd9, 0xb2, 0x05, | 677 | 0x01, 0xd9, 0xb2, 0x05, |
668 | 0x10, 0x5b, 0x38, 0x6d, | 678 | 0x10, 0x5b, 0x4c, 0x6d, |
669 | 0x08, 0x5b, 0x42, 0x6d, | 679 | 0x08, 0x5b, 0x56, 0x6d, |
670 | 0x20, 0x5b, 0x32, 0x6d, | 680 | 0x20, 0x5b, 0x46, 0x6d, |
671 | 0x02, 0x5b, 0x62, 0x6d, | 681 | 0x02, 0x5b, 0x76, 0x6d, |
672 | 0x0e, 0xea, 0x64, 0x59, | 682 | 0x0e, 0xea, 0x6e, 0x59, |
673 | 0x0e, 0xea, 0x04, 0x00, | 683 | 0x0e, 0xea, 0x04, 0x00, |
674 | 0x80, 0xf9, 0x22, 0x6d, | 684 | 0x80, 0xf9, 0x36, 0x6d, |
675 | 0xdf, 0x5c, 0xb8, 0x08, | 685 | 0xdf, 0x5c, 0xb8, 0x08, |
676 | 0x01, 0xd9, 0xb2, 0x05, | 686 | 0x01, 0xd9, 0xb2, 0x05, |
677 | 0x01, 0xa4, 0x1d, 0x6e, | 687 | 0x01, 0xa4, 0x37, 0x6e, |
678 | 0x00, 0xe2, 0x68, 0x5c, | 688 | 0x00, 0xe2, 0x7c, 0x5c, |
679 | 0x00, 0xe2, 0x6c, 0x5d, | 689 | 0x00, 0xe2, 0x80, 0x5d, |
680 | 0x01, 0x90, 0x21, 0x1b, | 690 | 0x01, 0x90, 0x21, 0x1b, |
681 | 0x01, 0xd9, 0xb2, 0x05, | 691 | 0x01, 0xd9, 0xb2, 0x05, |
682 | 0x00, 0xe2, 0x52, 0x5b, | 692 | 0x00, 0xe2, 0x66, 0x5b, |
683 | 0xf3, 0x96, 0xd5, 0x19, | 693 | 0xf3, 0x96, 0xd5, 0x19, |
684 | 0x00, 0xe2, 0x50, 0x55, | 694 | 0x00, 0xe2, 0x64, 0x55, |
685 | 0x80, 0x96, 0x51, 0x6d, | 695 | 0x80, 0x96, 0x65, 0x6d, |
686 | 0x0f, 0xea, 0x64, 0x59, | 696 | 0x0f, 0xea, 0x6e, 0x59, |
687 | 0x0f, 0xea, 0x04, 0x00, | 697 | 0x0f, 0xea, 0x04, 0x00, |
688 | 0x00, 0xe2, 0x58, 0x45, | 698 | 0x00, 0xe2, 0x6c, 0x45, |
689 | 0x04, 0x8c, 0xe1, 0x30, | 699 | 0x04, 0x8c, 0xe1, 0x30, |
690 | 0x01, 0xea, 0xf2, 0x00, | 700 | 0x01, 0xea, 0xf2, 0x00, |
691 | 0x02, 0xea, 0x36, 0x00, | 701 | 0x02, 0xea, 0x36, 0x00, |
692 | 0xa8, 0xea, 0x32, 0x00, | 702 | 0xa8, 0xea, 0x32, 0x00, |
693 | 0xff, 0x97, 0x5f, 0x7d, | 703 | 0xff, 0x97, 0x73, 0x7d, |
694 | 0x14, 0xea, 0x64, 0x59, | 704 | 0x14, 0xea, 0x6e, 0x59, |
695 | 0x14, 0xea, 0x04, 0x00, | 705 | 0x14, 0xea, 0x04, 0x00, |
696 | 0x00, 0xe2, 0xce, 0x5d, | 706 | 0x00, 0xe2, 0xe2, 0x5d, |
697 | 0x01, 0xd9, 0xb2, 0x05, | 707 | 0x01, 0xd9, 0xb2, 0x05, |
698 | 0x09, 0x80, 0xe1, 0x30, | 708 | 0x09, 0x80, 0xe1, 0x30, |
699 | 0x02, 0xea, 0x36, 0x00, | 709 | 0x02, 0xea, 0x36, 0x00, |
700 | 0xa8, 0xea, 0x32, 0x00, | 710 | 0xa8, 0xea, 0x32, 0x00, |
701 | 0x00, 0xe2, 0xc6, 0x5d, | 711 | 0x00, 0xe2, 0xda, 0x5d, |
702 | 0x01, 0xd9, 0xb2, 0x05, | 712 | 0x01, 0xd9, 0xb2, 0x05, |
703 | 0x02, 0xa6, 0x7c, 0x7d, | 713 | 0x02, 0xa6, 0x90, 0x7d, |
704 | 0x00, 0xe2, 0x56, 0x59, | 714 | 0x00, 0xe2, 0x60, 0x59, |
705 | 0x20, 0x5b, 0x8a, 0x6d, | 715 | 0x20, 0x5b, 0x9e, 0x6d, |
706 | 0xfc, 0x42, 0x76, 0x7d, | 716 | 0xfc, 0x42, 0x8a, 0x7d, |
707 | 0x10, 0x40, 0x78, 0x6d, | 717 | 0x10, 0x40, 0x8c, 0x6d, |
708 | 0x20, 0x4d, 0x7a, 0x7d, | 718 | 0x20, 0x4d, 0x8e, 0x7d, |
709 | 0x08, 0x5d, 0x8a, 0x6d, | 719 | 0x08, 0x5d, 0x9e, 0x6d, |
710 | 0x02, 0xa6, 0x10, 0x6c, | 720 | 0x02, 0xa6, 0x24, 0x6c, |
711 | 0x00, 0xe2, 0x56, 0x59, | 721 | 0x00, 0xe2, 0x60, 0x59, |
712 | 0x20, 0x5b, 0x8a, 0x6d, | 722 | 0x20, 0x5b, 0x9e, 0x6d, |
713 | 0x01, 0x1b, 0xaa, 0x6d, | 723 | 0x01, 0x1b, 0xbe, 0x6d, |
714 | 0xfc, 0x42, 0x86, 0x7d, | 724 | 0xfc, 0x42, 0x9a, 0x7d, |
715 | 0x10, 0x40, 0x88, 0x6d, | 725 | 0x10, 0x40, 0x9c, 0x6d, |
716 | 0x20, 0x4d, 0x84, 0x78, | 726 | 0x20, 0x4d, 0x84, 0x78, |
717 | 0x08, 0x5d, 0x84, 0x78, | 727 | 0x08, 0x5d, 0x84, 0x78, |
718 | 0x02, 0x19, 0x32, 0x00, | 728 | 0x02, 0x19, 0x32, 0x00, |
719 | 0x01, 0x5b, 0x40, 0x31, | 729 | 0x01, 0x5b, 0x40, 0x31, |
720 | 0x00, 0xe2, 0xea, 0x5c, | 730 | 0x00, 0xe2, 0xfe, 0x5c, |
721 | 0x00, 0xe2, 0xcc, 0x5b, | 731 | 0x00, 0xe2, 0xe0, 0x5b, |
722 | 0x20, 0xea, 0xb6, 0x00, | 732 | 0x20, 0xea, 0xb6, 0x00, |
723 | 0x00, 0xe2, 0x0a, 0x5c, | 733 | 0x00, 0xe2, 0x1e, 0x5c, |
724 | 0x20, 0x5c, 0xb8, 0x00, | 734 | 0x20, 0x5c, 0xb8, 0x00, |
725 | 0x04, 0x19, 0xa0, 0x6d, | 735 | 0x04, 0x19, 0xb4, 0x6d, |
726 | 0x01, 0x1a, 0xa0, 0x6d, | 736 | 0x01, 0x1a, 0xb4, 0x6d, |
727 | 0x00, 0xe2, 0x56, 0x59, | 737 | 0x00, 0xe2, 0x60, 0x59, |
728 | 0x01, 0x1a, 0x84, 0x78, | 738 | 0x01, 0x1a, 0x84, 0x78, |
729 | 0x80, 0xf9, 0xf2, 0x01, | 739 | 0x80, 0xf9, 0xf2, 0x01, |
730 | 0x20, 0xa0, 0x04, 0x7e, | 740 | 0x20, 0xa0, 0x18, 0x7e, |
731 | 0xff, 0x90, 0x21, 0x1b, | 741 | 0xff, 0x90, 0x21, 0x1b, |
732 | 0x08, 0x92, 0x63, 0x6b, | 742 | 0x08, 0x92, 0x77, 0x6b, |
733 | 0x02, 0xea, 0xb4, 0x04, | 743 | 0x02, 0xea, 0xb4, 0x04, |
734 | 0x01, 0xa4, 0x49, 0x03, | 744 | 0x01, 0xa4, 0x49, 0x03, |
735 | 0x40, 0x5b, 0xba, 0x6d, | 745 | 0x40, 0x5b, 0xce, 0x6d, |
736 | 0x00, 0xe2, 0x56, 0x59, | 746 | 0x00, 0xe2, 0x60, 0x59, |
737 | 0x40, 0x5b, 0xba, 0x6d, | 747 | 0x40, 0x5b, 0xce, 0x6d, |
738 | 0x04, 0x5d, 0x1e, 0x7e, | 748 | 0x04, 0x5d, 0x38, 0x7e, |
739 | 0x01, 0x1a, 0x1e, 0x7e, | 749 | 0x01, 0x1a, 0x38, 0x7e, |
740 | 0x20, 0x4d, 0x84, 0x78, | 750 | 0x20, 0x4d, 0x84, 0x78, |
741 | 0x40, 0x5b, 0x04, 0x7e, | 751 | 0x40, 0x5b, 0x18, 0x7e, |
742 | 0x04, 0x5d, 0x1e, 0x7e, | 752 | 0x04, 0x5d, 0x38, 0x7e, |
743 | 0x01, 0x1a, 0x1e, 0x7e, | 753 | 0x01, 0x1a, 0x38, 0x7e, |
744 | 0x80, 0xf9, 0xf2, 0x01, | 754 | 0x80, 0xf9, 0xf2, 0x01, |
745 | 0xff, 0x90, 0x21, 0x1b, | 755 | 0xff, 0x90, 0x21, 0x1b, |
746 | 0x08, 0x92, 0x63, 0x6b, | 756 | 0x08, 0x92, 0x77, 0x6b, |
747 | 0x02, 0xea, 0xb4, 0x04, | 757 | 0x02, 0xea, 0xb4, 0x04, |
748 | 0x00, 0xe2, 0x56, 0x59, | 758 | 0x00, 0xe2, 0x60, 0x59, |
749 | 0x01, 0x1b, 0x84, 0x78, | 759 | 0x01, 0x1b, 0x84, 0x78, |
750 | 0x80, 0xf9, 0xf2, 0x01, | 760 | 0x80, 0xf9, 0xf2, 0x01, |
751 | 0x02, 0xea, 0xb4, 0x04, | 761 | 0x02, 0xea, 0xb4, 0x04, |
752 | 0x00, 0xe2, 0x56, 0x59, | 762 | 0x00, 0xe2, 0x60, 0x59, |
753 | 0x01, 0x1b, 0xe2, 0x6d, | 763 | 0x01, 0x1b, 0xf6, 0x6d, |
754 | 0x40, 0x5b, 0xf0, 0x7d, | 764 | 0x40, 0x5b, 0x04, 0x7e, |
755 | 0x01, 0x1b, 0xe2, 0x6d, | 765 | 0x01, 0x1b, 0xf6, 0x6d, |
756 | 0x02, 0x19, 0x32, 0x00, | 766 | 0x02, 0x19, 0x32, 0x00, |
757 | 0x01, 0x1a, 0x84, 0x78, | 767 | 0x01, 0x1a, 0x84, 0x78, |
758 | 0x80, 0xf9, 0xf2, 0x01, | 768 | 0x80, 0xf9, 0xf2, 0x01, |
759 | 0xff, 0xea, 0x10, 0x03, | 769 | 0xff, 0xea, 0x10, 0x03, |
760 | 0x08, 0x92, 0x25, 0x03, | 770 | 0x08, 0x92, 0x25, 0x03, |
761 | 0x00, 0xe2, 0x62, 0x43, | 771 | 0x00, 0xe2, 0x76, 0x43, |
762 | 0x01, 0x1a, 0xec, 0x7d, | 772 | 0x01, 0x1a, 0x00, 0x7e, |
763 | 0x40, 0x5b, 0xe8, 0x7d, | 773 | 0x40, 0x5b, 0xfc, 0x7d, |
764 | 0x01, 0x1a, 0xd6, 0x6d, | 774 | 0x01, 0x1a, 0xea, 0x6d, |
765 | 0xfc, 0x42, 0x84, 0x78, | 775 | 0xfc, 0x42, 0x84, 0x78, |
766 | 0x01, 0x1a, 0xf0, 0x6d, | 776 | 0x01, 0x1a, 0x04, 0x6e, |
767 | 0x10, 0xea, 0x64, 0x59, | 777 | 0x10, 0xea, 0x6e, 0x59, |
768 | 0x10, 0xea, 0x04, 0x00, | 778 | 0x10, 0xea, 0x04, 0x00, |
769 | 0xfc, 0x42, 0x84, 0x78, | 779 | 0xfc, 0x42, 0x84, 0x78, |
770 | 0x10, 0x40, 0xf6, 0x6d, | 780 | 0x10, 0x40, 0x0a, 0x6e, |
771 | 0x20, 0x4d, 0x84, 0x78, | 781 | 0x20, 0x4d, 0x84, 0x78, |
772 | 0x40, 0x5b, 0xd6, 0x6d, | 782 | 0x40, 0x5b, 0xea, 0x6d, |
773 | 0x01, 0x1a, 0x84, 0x78, | 783 | 0x01, 0x1a, 0x84, 0x78, |
774 | 0x01, 0x90, 0x21, 0x1b, | 784 | 0x01, 0x90, 0x21, 0x1b, |
775 | 0x30, 0x3f, 0xc0, 0x09, | 785 | 0x30, 0x3f, 0xc0, 0x09, |
776 | 0x30, 0xe0, 0x84, 0x60, | 786 | 0x30, 0xe0, 0x84, 0x60, |
777 | 0x40, 0x4b, 0x84, 0x68, | 787 | 0x40, 0x4b, 0x84, 0x68, |
778 | 0xff, 0xea, 0x52, 0x01, | 788 | 0xff, 0xea, 0x52, 0x01, |
779 | 0xee, 0x00, 0x0c, 0x6e, | 789 | 0xee, 0x00, 0x20, 0x6e, |
780 | 0x80, 0xf9, 0xf2, 0x01, | 790 | 0x80, 0xf9, 0xf2, 0x01, |
781 | 0xff, 0x90, 0x21, 0x1b, | 791 | 0xff, 0x90, 0x21, 0x1b, |
782 | 0x02, 0xea, 0xb4, 0x00, | 792 | 0x02, 0xea, 0xb4, 0x00, |
783 | 0x20, 0xea, 0x9a, 0x00, | 793 | 0x20, 0xea, 0x9a, 0x00, |
784 | 0xf3, 0x42, 0x16, 0x6e, | 794 | 0x04, 0x41, 0x26, 0x7e, |
785 | 0x12, 0xea, 0x64, 0x59, | 795 | 0x08, 0xea, 0x98, 0x00, |
796 | 0x08, 0x57, 0xae, 0x00, | ||
797 | 0xf3, 0x42, 0x30, 0x6e, | ||
798 | 0x12, 0xea, 0x6e, 0x59, | ||
786 | 0x12, 0xea, 0x04, 0x00, | 799 | 0x12, 0xea, 0x04, 0x00, |
787 | 0x00, 0xe2, 0x14, 0x42, | 800 | 0x00, 0xe2, 0x28, 0x42, |
788 | 0x0d, 0xea, 0x64, 0x59, | 801 | 0x0d, 0xea, 0x6e, 0x59, |
789 | 0x0d, 0xea, 0x04, 0x00, | 802 | 0x0d, 0xea, 0x04, 0x00, |
790 | 0x00, 0xe2, 0x14, 0x42, | 803 | 0x00, 0xe2, 0x28, 0x42, |
791 | 0x01, 0x90, 0x21, 0x1b, | 804 | 0x01, 0x90, 0x21, 0x1b, |
792 | 0x11, 0xea, 0x64, 0x59, | 805 | 0x11, 0xea, 0x6e, 0x59, |
793 | 0x11, 0xea, 0x04, 0x00, | 806 | 0x11, 0xea, 0x04, 0x00, |
794 | 0x00, 0xe2, 0x52, 0x5b, | 807 | 0x00, 0xe2, 0x66, 0x5b, |
795 | 0x08, 0x5a, 0xb4, 0x00, | 808 | 0x08, 0x5a, 0xb4, 0x00, |
796 | 0x00, 0xe2, 0x44, 0x5e, | 809 | 0x00, 0xe2, 0x5e, 0x5e, |
797 | 0xa8, 0xea, 0x32, 0x00, | 810 | 0xa8, 0xea, 0x32, 0x00, |
798 | 0x00, 0xe2, 0x56, 0x59, | 811 | 0x00, 0xe2, 0x60, 0x59, |
799 | 0x80, 0x1a, 0x32, 0x7e, | 812 | 0x80, 0x1a, 0x4c, 0x7e, |
800 | 0x00, 0xe2, 0x44, 0x5e, | 813 | 0x00, 0xe2, 0x5e, 0x5e, |
801 | 0x80, 0x19, 0x32, 0x00, | 814 | 0x80, 0x19, 0x32, 0x00, |
802 | 0x40, 0x5b, 0x38, 0x6e, | 815 | 0x40, 0x5b, 0x52, 0x6e, |
803 | 0x08, 0x5a, 0x38, 0x7e, | 816 | 0x08, 0x5a, 0x52, 0x7e, |
804 | 0x20, 0x4d, 0x84, 0x78, | 817 | 0x20, 0x4d, 0x84, 0x78, |
805 | 0x02, 0x84, 0x09, 0x03, | 818 | 0x02, 0x84, 0x09, 0x03, |
806 | 0x40, 0x5b, 0x04, 0x7e, | 819 | 0x40, 0x5b, 0x18, 0x7e, |
807 | 0xff, 0x90, 0x21, 0x1b, | 820 | 0xff, 0x90, 0x21, 0x1b, |
808 | 0x80, 0xf9, 0xf2, 0x01, | 821 | 0x80, 0xf9, 0xf2, 0x01, |
809 | 0x08, 0x92, 0x63, 0x6b, | 822 | 0x08, 0x92, 0x77, 0x6b, |
810 | 0x02, 0xea, 0xb4, 0x04, | 823 | 0x02, 0xea, 0xb4, 0x04, |
811 | 0x01, 0x40, 0xe1, 0x30, | 824 | 0x01, 0x40, 0xe1, 0x30, |
812 | 0x05, 0x41, 0xe3, 0x98, | 825 | 0x05, 0x41, 0xe3, 0x98, |
@@ -1039,138 +1052,138 @@ static struct patch { | |||
1039 | { ahd_patch0_func, 64, 1, 1 }, | 1052 | { ahd_patch0_func, 64, 1, 1 }, |
1040 | { ahd_patch2_func, 67, 1, 2 }, | 1053 | { ahd_patch2_func, 67, 1, 2 }, |
1041 | { ahd_patch0_func, 68, 1, 1 }, | 1054 | { ahd_patch0_func, 68, 1, 1 }, |
1042 | { ahd_patch4_func, 116, 1, 1 }, | 1055 | { ahd_patch4_func, 115, 1, 1 }, |
1043 | { ahd_patch2_func, 175, 3, 1 }, | 1056 | { ahd_patch2_func, 180, 3, 1 }, |
1044 | { ahd_patch1_func, 178, 2, 1 }, | 1057 | { ahd_patch1_func, 183, 2, 1 }, |
1045 | { ahd_patch5_func, 180, 1, 1 }, | 1058 | { ahd_patch5_func, 185, 1, 1 }, |
1046 | { ahd_patch2_func, 189, 1, 2 }, | 1059 | { ahd_patch2_func, 194, 1, 2 }, |
1047 | { ahd_patch0_func, 190, 1, 1 }, | 1060 | { ahd_patch0_func, 195, 1, 1 }, |
1048 | { ahd_patch6_func, 191, 2, 2 }, | 1061 | { ahd_patch6_func, 196, 2, 2 }, |
1049 | { ahd_patch0_func, 193, 6, 3 }, | 1062 | { ahd_patch0_func, 198, 6, 3 }, |
1050 | { ahd_patch2_func, 196, 1, 2 }, | 1063 | { ahd_patch2_func, 201, 1, 2 }, |
1051 | { ahd_patch0_func, 197, 1, 1 }, | 1064 | { ahd_patch0_func, 202, 1, 1 }, |
1052 | { ahd_patch2_func, 200, 1, 2 }, | 1065 | { ahd_patch2_func, 205, 1, 2 }, |
1053 | { ahd_patch0_func, 201, 1, 1 }, | 1066 | { ahd_patch0_func, 206, 1, 1 }, |
1054 | { ahd_patch3_func, 203, 1, 1 }, | 1067 | { ahd_patch3_func, 208, 1, 1 }, |
1055 | { ahd_patch7_func, 204, 3, 1 }, | 1068 | { ahd_patch7_func, 209, 3, 1 }, |
1056 | { ahd_patch3_func, 213, 1, 1 }, | 1069 | { ahd_patch3_func, 218, 1, 1 }, |
1057 | { ahd_patch5_func, 214, 16, 2 }, | 1070 | { ahd_patch5_func, 219, 16, 2 }, |
1058 | { ahd_patch0_func, 230, 1, 1 }, | 1071 | { ahd_patch0_func, 235, 1, 1 }, |
1059 | { ahd_patch8_func, 250, 2, 1 }, | 1072 | { ahd_patch8_func, 260, 2, 1 }, |
1060 | { ahd_patch1_func, 254, 1, 2 }, | 1073 | { ahd_patch1_func, 264, 1, 2 }, |
1061 | { ahd_patch0_func, 255, 1, 1 }, | 1074 | { ahd_patch0_func, 265, 1, 1 }, |
1062 | { ahd_patch7_func, 258, 3, 1 }, | 1075 | { ahd_patch7_func, 268, 3, 1 }, |
1063 | { ahd_patch1_func, 273, 1, 2 }, | 1076 | { ahd_patch1_func, 283, 1, 2 }, |
1064 | { ahd_patch0_func, 274, 1, 1 }, | 1077 | { ahd_patch0_func, 284, 1, 1 }, |
1065 | { ahd_patch1_func, 277, 1, 2 }, | 1078 | { ahd_patch1_func, 287, 1, 2 }, |
1066 | { ahd_patch0_func, 278, 1, 1 }, | 1079 | { ahd_patch0_func, 288, 1, 1 }, |
1067 | { ahd_patch2_func, 281, 1, 2 }, | 1080 | { ahd_patch2_func, 291, 1, 2 }, |
1068 | { ahd_patch0_func, 282, 1, 1 }, | 1081 | { ahd_patch0_func, 292, 1, 1 }, |
1069 | { ahd_patch9_func, 295, 2, 2 }, | 1082 | { ahd_patch9_func, 305, 2, 2 }, |
1070 | { ahd_patch0_func, 297, 1, 1 }, | 1083 | { ahd_patch0_func, 307, 1, 1 }, |
1071 | { ahd_patch1_func, 339, 1, 2 }, | 1084 | { ahd_patch1_func, 349, 1, 2 }, |
1072 | { ahd_patch0_func, 340, 1, 1 }, | 1085 | { ahd_patch0_func, 350, 1, 1 }, |
1073 | { ahd_patch2_func, 348, 1, 2 }, | 1086 | { ahd_patch2_func, 358, 1, 2 }, |
1074 | { ahd_patch0_func, 349, 1, 1 }, | 1087 | { ahd_patch0_func, 359, 1, 1 }, |
1075 | { ahd_patch2_func, 352, 1, 2 }, | 1088 | { ahd_patch2_func, 362, 1, 2 }, |
1076 | { ahd_patch0_func, 353, 1, 1 }, | ||
1077 | { ahd_patch1_func, 359, 1, 2 }, | ||
1078 | { ahd_patch0_func, 360, 1, 1 }, | ||
1079 | { ahd_patch1_func, 362, 1, 2 }, | ||
1080 | { ahd_patch0_func, 363, 1, 1 }, | 1089 | { ahd_patch0_func, 363, 1, 1 }, |
1081 | { ahd_patch10_func, 382, 1, 1 }, | 1090 | { ahd_patch1_func, 369, 1, 2 }, |
1082 | { ahd_patch10_func, 385, 1, 1 }, | 1091 | { ahd_patch0_func, 370, 1, 1 }, |
1083 | { ahd_patch10_func, 387, 1, 1 }, | 1092 | { ahd_patch1_func, 372, 1, 2 }, |
1084 | { ahd_patch10_func, 399, 1, 1 }, | 1093 | { ahd_patch0_func, 373, 1, 1 }, |
1085 | { ahd_patch1_func, 409, 1, 2 }, | 1094 | { ahd_patch10_func, 392, 1, 1 }, |
1086 | { ahd_patch0_func, 410, 1, 1 }, | 1095 | { ahd_patch10_func, 395, 1, 1 }, |
1087 | { ahd_patch1_func, 412, 1, 2 }, | 1096 | { ahd_patch10_func, 397, 1, 1 }, |
1088 | { ahd_patch0_func, 413, 1, 1 }, | 1097 | { ahd_patch10_func, 409, 1, 1 }, |
1089 | { ahd_patch1_func, 421, 1, 2 }, | 1098 | { ahd_patch1_func, 419, 1, 2 }, |
1090 | { ahd_patch0_func, 422, 1, 1 }, | 1099 | { ahd_patch0_func, 420, 1, 1 }, |
1091 | { ahd_patch2_func, 435, 1, 2 }, | 1100 | { ahd_patch1_func, 422, 1, 2 }, |
1092 | { ahd_patch0_func, 436, 1, 1 }, | 1101 | { ahd_patch0_func, 423, 1, 1 }, |
1093 | { ahd_patch11_func, 472, 1, 1 }, | 1102 | { ahd_patch1_func, 431, 1, 2 }, |
1094 | { ahd_patch1_func, 480, 1, 2 }, | 1103 | { ahd_patch0_func, 432, 1, 1 }, |
1095 | { ahd_patch0_func, 481, 1, 1 }, | 1104 | { ahd_patch2_func, 445, 1, 2 }, |
1096 | { ahd_patch2_func, 493, 1, 2 }, | 1105 | { ahd_patch0_func, 446, 1, 1 }, |
1097 | { ahd_patch0_func, 494, 1, 1 }, | 1106 | { ahd_patch11_func, 482, 1, 1 }, |
1098 | { ahd_patch12_func, 497, 6, 2 }, | 1107 | { ahd_patch1_func, 490, 1, 2 }, |
1099 | { ahd_patch0_func, 503, 1, 1 }, | 1108 | { ahd_patch0_func, 491, 1, 1 }, |
1100 | { ahd_patch13_func, 524, 7, 1 }, | 1109 | { ahd_patch2_func, 503, 1, 2 }, |
1101 | { ahd_patch14_func, 533, 1, 1 }, | 1110 | { ahd_patch0_func, 504, 1, 1 }, |
1102 | { ahd_patch15_func, 542, 1, 1 }, | 1111 | { ahd_patch12_func, 507, 6, 2 }, |
1103 | { ahd_patch16_func, 543, 1, 2 }, | 1112 | { ahd_patch0_func, 513, 1, 1 }, |
1104 | { ahd_patch0_func, 544, 1, 1 }, | 1113 | { ahd_patch13_func, 534, 7, 1 }, |
1105 | { ahd_patch17_func, 547, 1, 1 }, | 1114 | { ahd_patch14_func, 543, 1, 1 }, |
1106 | { ahd_patch16_func, 548, 1, 1 }, | 1115 | { ahd_patch15_func, 552, 1, 1 }, |
1107 | { ahd_patch18_func, 559, 1, 2 }, | 1116 | { ahd_patch16_func, 553, 1, 2 }, |
1108 | { ahd_patch0_func, 560, 1, 1 }, | 1117 | { ahd_patch0_func, 554, 1, 1 }, |
1109 | { ahd_patch1_func, 579, 1, 2 }, | 1118 | { ahd_patch17_func, 557, 1, 1 }, |
1110 | { ahd_patch0_func, 580, 1, 1 }, | 1119 | { ahd_patch16_func, 558, 1, 1 }, |
1111 | { ahd_patch1_func, 583, 1, 2 }, | 1120 | { ahd_patch18_func, 569, 1, 2 }, |
1112 | { ahd_patch0_func, 584, 1, 1 }, | 1121 | { ahd_patch0_func, 570, 1, 1 }, |
1113 | { ahd_patch2_func, 589, 1, 2 }, | 1122 | { ahd_patch1_func, 589, 1, 2 }, |
1114 | { ahd_patch0_func, 590, 1, 1 }, | 1123 | { ahd_patch0_func, 590, 1, 1 }, |
1115 | { ahd_patch2_func, 594, 1, 2 }, | 1124 | { ahd_patch1_func, 593, 1, 2 }, |
1116 | { ahd_patch0_func, 595, 1, 1 }, | 1125 | { ahd_patch0_func, 594, 1, 1 }, |
1117 | { ahd_patch1_func, 596, 1, 2 }, | 1126 | { ahd_patch2_func, 599, 1, 2 }, |
1118 | { ahd_patch0_func, 597, 1, 1 }, | 1127 | { ahd_patch0_func, 600, 1, 1 }, |
1119 | { ahd_patch2_func, 608, 1, 2 }, | 1128 | { ahd_patch2_func, 604, 1, 2 }, |
1120 | { ahd_patch0_func, 609, 1, 1 }, | 1129 | { ahd_patch0_func, 605, 1, 1 }, |
1121 | { ahd_patch19_func, 613, 1, 1 }, | 1130 | { ahd_patch1_func, 606, 1, 2 }, |
1122 | { ahd_patch20_func, 618, 1, 1 }, | 1131 | { ahd_patch0_func, 607, 1, 1 }, |
1123 | { ahd_patch21_func, 619, 2, 1 }, | 1132 | { ahd_patch2_func, 618, 1, 2 }, |
1124 | { ahd_patch20_func, 623, 1, 2 }, | 1133 | { ahd_patch0_func, 619, 1, 1 }, |
1125 | { ahd_patch0_func, 624, 1, 1 }, | 1134 | { ahd_patch19_func, 623, 1, 1 }, |
1126 | { ahd_patch2_func, 627, 1, 2 }, | 1135 | { ahd_patch20_func, 628, 1, 1 }, |
1127 | { ahd_patch0_func, 628, 1, 1 }, | 1136 | { ahd_patch21_func, 629, 2, 1 }, |
1128 | { ahd_patch2_func, 643, 1, 2 }, | 1137 | { ahd_patch20_func, 633, 1, 2 }, |
1129 | { ahd_patch0_func, 644, 1, 1 }, | 1138 | { ahd_patch0_func, 634, 1, 1 }, |
1130 | { ahd_patch13_func, 645, 14, 1 }, | 1139 | { ahd_patch2_func, 637, 1, 2 }, |
1131 | { ahd_patch1_func, 663, 1, 2 }, | 1140 | { ahd_patch0_func, 638, 1, 1 }, |
1132 | { ahd_patch0_func, 664, 1, 1 }, | 1141 | { ahd_patch2_func, 653, 1, 2 }, |
1133 | { ahd_patch13_func, 665, 1, 1 }, | 1142 | { ahd_patch0_func, 654, 1, 1 }, |
1134 | { ahd_patch1_func, 677, 1, 2 }, | 1143 | { ahd_patch13_func, 655, 14, 1 }, |
1135 | { ahd_patch0_func, 678, 1, 1 }, | 1144 | { ahd_patch1_func, 673, 1, 2 }, |
1136 | { ahd_patch1_func, 685, 1, 2 }, | 1145 | { ahd_patch0_func, 674, 1, 1 }, |
1137 | { ahd_patch0_func, 686, 1, 1 }, | 1146 | { ahd_patch13_func, 675, 1, 1 }, |
1138 | { ahd_patch19_func, 709, 1, 1 }, | 1147 | { ahd_patch1_func, 687, 1, 2 }, |
1139 | { ahd_patch19_func, 747, 1, 1 }, | 1148 | { ahd_patch0_func, 688, 1, 1 }, |
1140 | { ahd_patch1_func, 758, 1, 2 }, | 1149 | { ahd_patch1_func, 695, 1, 2 }, |
1141 | { ahd_patch0_func, 759, 1, 1 }, | 1150 | { ahd_patch0_func, 696, 1, 1 }, |
1142 | { ahd_patch1_func, 776, 1, 2 }, | 1151 | { ahd_patch19_func, 719, 1, 1 }, |
1143 | { ahd_patch0_func, 777, 1, 1 }, | 1152 | { ahd_patch19_func, 757, 1, 1 }, |
1144 | { ahd_patch1_func, 779, 1, 2 }, | 1153 | { ahd_patch1_func, 768, 1, 2 }, |
1145 | { ahd_patch0_func, 780, 1, 1 }, | 1154 | { ahd_patch0_func, 769, 1, 1 }, |
1146 | { ahd_patch1_func, 783, 1, 2 }, | 1155 | { ahd_patch7_func, 785, 3, 1 }, |
1147 | { ahd_patch0_func, 784, 1, 1 }, | 1156 | { ahd_patch1_func, 789, 1, 2 }, |
1148 | { ahd_patch22_func, 786, 1, 2 }, | 1157 | { ahd_patch0_func, 790, 1, 1 }, |
1149 | { ahd_patch0_func, 787, 2, 1 }, | 1158 | { ahd_patch1_func, 792, 1, 2 }, |
1150 | { ahd_patch23_func, 790, 4, 2 }, | 1159 | { ahd_patch0_func, 793, 1, 1 }, |
1151 | { ahd_patch0_func, 794, 1, 1 }, | 1160 | { ahd_patch1_func, 796, 1, 2 }, |
1152 | { ahd_patch23_func, 802, 11, 1 } | 1161 | { ahd_patch0_func, 797, 1, 1 }, |
1162 | { ahd_patch22_func, 799, 1, 2 }, | ||
1163 | { ahd_patch0_func, 800, 2, 1 }, | ||
1164 | { ahd_patch23_func, 803, 4, 2 }, | ||
1165 | { ahd_patch0_func, 807, 1, 1 }, | ||
1166 | { ahd_patch23_func, 815, 11, 1 } | ||
1153 | }; | 1167 | }; |
1154 | 1168 | ||
1155 | static struct cs { | 1169 | static struct cs { |
1156 | uint16_t begin; | 1170 | uint16_t begin; |
1157 | uint16_t end; | 1171 | uint16_t end; |
1158 | } critical_sections[] = { | 1172 | } critical_sections[] = { |
1159 | { 17, 28 }, | 1173 | { 17, 30 }, |
1160 | { 29, 30 }, | ||
1161 | { 47, 58 }, | 1174 | { 47, 58 }, |
1162 | { 61, 63 }, | 1175 | { 61, 63 }, |
1163 | { 65, 66 }, | 1176 | { 65, 66 }, |
1164 | { 72, 92 }, | 1177 | { 72, 92 }, |
1165 | { 110, 137 }, | 1178 | { 110, 142 }, |
1166 | { 138, 175 }, | 1179 | { 143, 180 }, |
1167 | { 180, 188 }, | 1180 | { 185, 193 }, |
1168 | { 213, 264 }, | 1181 | { 218, 274 }, |
1169 | { 425, 433 }, | 1182 | { 435, 443 }, |
1170 | { 443, 445 }, | 1183 | { 453, 455 }, |
1171 | { 448, 457 }, | 1184 | { 458, 467 }, |
1172 | { 709, 739 }, | 1185 | { 719, 749 }, |
1173 | { 749, 753 } | 1186 | { 759, 763 } |
1174 | }; | 1187 | }; |
1175 | 1188 | ||
1176 | static const int num_critical_sections = sizeof(critical_sections) | 1189 | static const int num_critical_sections = sizeof(critical_sections) |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm.c b/drivers/scsi/aic7xxx/aicasm/aicasm.c index f936b691232f..924102720b14 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm.c +++ b/drivers/scsi/aic7xxx/aicasm/aicasm.c | |||
@@ -37,7 +37,7 @@ | |||
37 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 37 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | * POSSIBILITY OF SUCH DAMAGES. | 38 | * POSSIBILITY OF SUCH DAMAGES. |
39 | * | 39 | * |
40 | * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm.c#22 $ | 40 | * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm.c#23 $ |
41 | * | 41 | * |
42 | * $FreeBSD$ | 42 | * $FreeBSD$ |
43 | */ | 43 | */ |
@@ -609,10 +609,10 @@ output_listing(char *ifilename) | |||
609 | 609 | ||
610 | while (line < cur_instr->srcline) { | 610 | while (line < cur_instr->srcline) { |
611 | fgets(buf, sizeof(buf), ifile); | 611 | fgets(buf, sizeof(buf), ifile); |
612 | fprintf(listfile, "\t\t%s", buf); | 612 | fprintf(listfile, " \t%s", buf); |
613 | line++; | 613 | line++; |
614 | } | 614 | } |
615 | fprintf(listfile, "%03x %02x%02x%02x%02x", instrptr, | 615 | fprintf(listfile, "%04x %02x%02x%02x%02x", instrptr, |
616 | #ifdef __LITTLE_ENDIAN | 616 | #ifdef __LITTLE_ENDIAN |
617 | cur_instr->format.bytes[0], | 617 | cur_instr->format.bytes[0], |
618 | cur_instr->format.bytes[1], | 618 | cur_instr->format.bytes[1], |
@@ -624,14 +624,23 @@ output_listing(char *ifilename) | |||
624 | cur_instr->format.bytes[1], | 624 | cur_instr->format.bytes[1], |
625 | cur_instr->format.bytes[0]); | 625 | cur_instr->format.bytes[0]); |
626 | #endif | 626 | #endif |
627 | fgets(buf, sizeof(buf), ifile); | 627 | /* |
628 | fprintf(listfile, "\t%s", buf); | 628 | * Macro expansions can cause several instructions |
629 | line++; | 629 | * to be output for a single source line. Only |
630 | * advance the line once in these cases. | ||
631 | */ | ||
632 | if (line == cur_instr->srcline) { | ||
633 | fgets(buf, sizeof(buf), ifile); | ||
634 | fprintf(listfile, "\t%s", buf); | ||
635 | line++; | ||
636 | } else { | ||
637 | fprintf(listfile, "\n"); | ||
638 | } | ||
630 | instrptr++; | 639 | instrptr++; |
631 | } | 640 | } |
632 | /* Dump the remainder of the file */ | 641 | /* Dump the remainder of the file */ |
633 | while(fgets(buf, sizeof(buf), ifile) != NULL) | 642 | while(fgets(buf, sizeof(buf), ifile) != NULL) |
634 | fprintf(listfile, "\t\t%s", buf); | 643 | fprintf(listfile, " %s", buf); |
635 | 644 | ||
636 | fclose(ifile); | 645 | fclose(ifile); |
637 | } | 646 | } |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y index 67e046d96625..c328596def3c 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_gram.y | |||
@@ -38,7 +38,7 @@ | |||
38 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 38 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
39 | * POSSIBILITY OF SUCH DAMAGES. | 39 | * POSSIBILITY OF SUCH DAMAGES. |
40 | * | 40 | * |
41 | * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_gram.y#29 $ | 41 | * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_gram.y#30 $ |
42 | * | 42 | * |
43 | * $FreeBSD$ | 43 | * $FreeBSD$ |
44 | */ | 44 | */ |
@@ -157,6 +157,8 @@ static int is_download_const(expression_t *immed); | |||
157 | 157 | ||
158 | %token T_END_CS | 158 | %token T_END_CS |
159 | 159 | ||
160 | %token T_PAD_PAGE | ||
161 | |||
160 | %token T_FIELD | 162 | %token T_FIELD |
161 | 163 | ||
162 | %token T_ENUM | 164 | %token T_ENUM |
@@ -189,6 +191,10 @@ static int is_download_const(expression_t *immed); | |||
189 | 191 | ||
190 | %token <value> T_OR | 192 | %token <value> T_OR |
191 | 193 | ||
194 | /* 16 bit extensions */ | ||
195 | %token <value> T_OR16 T_AND16 T_XOR16 T_ADD16 | ||
196 | %token <value> T_ADC16 T_MVI16 T_TEST16 T_CMP16 T_CMPXCHG | ||
197 | |||
192 | %token T_RET | 198 | %token T_RET |
193 | 199 | ||
194 | %token T_NOP | 200 | %token T_NOP |
@@ -207,7 +213,7 @@ static int is_download_const(expression_t *immed); | |||
207 | 213 | ||
208 | %type <expression> expression immediate immediate_or_a | 214 | %type <expression> expression immediate immediate_or_a |
209 | 215 | ||
210 | %type <value> export ret f1_opcode f2_opcode jmp_jc_jnc_call jz_jnz je_jne | 216 | %type <value> export ret f1_opcode f2_opcode f4_opcode jmp_jc_jnc_call jz_jnz je_jne |
211 | 217 | ||
212 | %type <value> mode_value mode_list macro_arglist | 218 | %type <value> mode_value mode_list macro_arglist |
213 | 219 | ||
@@ -1304,6 +1310,15 @@ f2_opcode: | |||
1304 | | T_ROR { $$ = AIC_OP_ROR; } | 1310 | | T_ROR { $$ = AIC_OP_ROR; } |
1305 | ; | 1311 | ; |
1306 | 1312 | ||
1313 | f4_opcode: | ||
1314 | T_OR16 { $$ = AIC_OP_OR16; } | ||
1315 | | T_AND16 { $$ = AIC_OP_AND16; } | ||
1316 | | T_XOR16 { $$ = AIC_OP_XOR16; } | ||
1317 | | T_ADD16 { $$ = AIC_OP_ADD16; } | ||
1318 | | T_ADC16 { $$ = AIC_OP_ADC16; } | ||
1319 | | T_MVI16 { $$ = AIC_OP_MVI16; } | ||
1320 | ; | ||
1321 | |||
1307 | code: | 1322 | code: |
1308 | f2_opcode destination ',' expression opt_source ret ';' | 1323 | f2_opcode destination ',' expression opt_source ret ';' |
1309 | { | 1324 | { |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h index e64f802bbaaa..9df9e2ce3538 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h | |||
@@ -37,13 +37,14 @@ | |||
37 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 37 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
38 | * POSSIBILITY OF SUCH DAMAGES. | 38 | * POSSIBILITY OF SUCH DAMAGES. |
39 | * | 39 | * |
40 | * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_insformat.h#11 $ | 40 | * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_insformat.h#12 $ |
41 | * | 41 | * |
42 | * $FreeBSD$ | 42 | * $FreeBSD$ |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <asm/byteorder.h> | 45 | #include <asm/byteorder.h> |
46 | 46 | ||
47 | /* 8bit ALU logic operations */ | ||
47 | struct ins_format1 { | 48 | struct ins_format1 { |
48 | #ifdef __LITTLE_ENDIAN | 49 | #ifdef __LITTLE_ENDIAN |
49 | uint32_t immediate : 8, | 50 | uint32_t immediate : 8, |
@@ -62,6 +63,7 @@ struct ins_format1 { | |||
62 | #endif | 63 | #endif |
63 | }; | 64 | }; |
64 | 65 | ||
66 | /* 8bit ALU shift/rotate operations */ | ||
65 | struct ins_format2 { | 67 | struct ins_format2 { |
66 | #ifdef __LITTLE_ENDIAN | 68 | #ifdef __LITTLE_ENDIAN |
67 | uint32_t shift_control : 8, | 69 | uint32_t shift_control : 8, |
@@ -80,6 +82,7 @@ struct ins_format2 { | |||
80 | #endif | 82 | #endif |
81 | }; | 83 | }; |
82 | 84 | ||
85 | /* 8bit branch control operations */ | ||
83 | struct ins_format3 { | 86 | struct ins_format3 { |
84 | #ifdef __LITTLE_ENDIAN | 87 | #ifdef __LITTLE_ENDIAN |
85 | uint32_t immediate : 8, | 88 | uint32_t immediate : 8, |
@@ -96,10 +99,68 @@ struct ins_format3 { | |||
96 | #endif | 99 | #endif |
97 | }; | 100 | }; |
98 | 101 | ||
102 | /* 16bit ALU logic operations */ | ||
103 | struct ins_format4 { | ||
104 | #ifdef __LITTLE_ENDIAN | ||
105 | uint32_t opcode_ext : 8, | ||
106 | source : 9, | ||
107 | destination : 9, | ||
108 | ret : 1, | ||
109 | opcode : 4, | ||
110 | parity : 1; | ||
111 | #else | ||
112 | uint32_t parity : 1, | ||
113 | opcode : 4, | ||
114 | ret : 1, | ||
115 | destination : 9, | ||
116 | source : 9, | ||
117 | opcode_ext : 8; | ||
118 | #endif | ||
119 | }; | ||
120 | |||
121 | /* 16bit branch control operations */ | ||
122 | struct ins_format5 { | ||
123 | #ifdef __LITTLE_ENDIAN | ||
124 | uint32_t opcode_ext : 8, | ||
125 | source : 9, | ||
126 | address : 10, | ||
127 | opcode : 4, | ||
128 | parity : 1; | ||
129 | #else | ||
130 | uint32_t parity : 1, | ||
131 | opcode : 4, | ||
132 | address : 10, | ||
133 | source : 9, | ||
134 | opcode_ext : 8; | ||
135 | #endif | ||
136 | }; | ||
137 | |||
138 | /* Far branch operations */ | ||
139 | struct ins_format6 { | ||
140 | #ifdef __LITTLE_ENDIAN | ||
141 | uint32_t page : 3, | ||
142 | opcode_ext : 5, | ||
143 | source : 9, | ||
144 | address : 10, | ||
145 | opcode : 4, | ||
146 | parity : 1; | ||
147 | #else | ||
148 | uint32_t parity : 1, | ||
149 | opcode : 4, | ||
150 | address : 10, | ||
151 | source : 9, | ||
152 | opcode_ext : 5, | ||
153 | page : 3; | ||
154 | #endif | ||
155 | }; | ||
156 | |||
99 | union ins_formats { | 157 | union ins_formats { |
100 | struct ins_format1 format1; | 158 | struct ins_format1 format1; |
101 | struct ins_format2 format2; | 159 | struct ins_format2 format2; |
102 | struct ins_format3 format3; | 160 | struct ins_format3 format3; |
161 | struct ins_format4 format4; | ||
162 | struct ins_format5 format5; | ||
163 | struct ins_format6 format6; | ||
103 | uint8_t bytes[4]; | 164 | uint8_t bytes[4]; |
104 | uint32_t integer; | 165 | uint32_t integer; |
105 | }; | 166 | }; |
@@ -118,6 +179,8 @@ struct instruction { | |||
118 | #define AIC_OP_ROL 0x5 | 179 | #define AIC_OP_ROL 0x5 |
119 | #define AIC_OP_BMOV 0x6 | 180 | #define AIC_OP_BMOV 0x6 |
120 | 181 | ||
182 | #define AIC_OP_MVI16 0x7 | ||
183 | |||
121 | #define AIC_OP_JMP 0x8 | 184 | #define AIC_OP_JMP 0x8 |
122 | #define AIC_OP_JC 0x9 | 185 | #define AIC_OP_JC 0x9 |
123 | #define AIC_OP_JNC 0xa | 186 | #define AIC_OP_JNC 0xa |
@@ -131,3 +194,26 @@ struct instruction { | |||
131 | #define AIC_OP_SHL 0x10 | 194 | #define AIC_OP_SHL 0x10 |
132 | #define AIC_OP_SHR 0x20 | 195 | #define AIC_OP_SHR 0x20 |
133 | #define AIC_OP_ROR 0x30 | 196 | #define AIC_OP_ROR 0x30 |
197 | |||
198 | /* 16bit Ops. Low byte main opcode. High byte extended opcode. */ | ||
199 | #define AIC_OP_OR16 0x8005 | ||
200 | #define AIC_OP_AND16 0x8105 | ||
201 | #define AIC_OP_XOR16 0x8205 | ||
202 | #define AIC_OP_ADD16 0x8305 | ||
203 | #define AIC_OP_ADC16 0x8405 | ||
204 | #define AIC_OP_JNE16 0x8805 | ||
205 | #define AIC_OP_JNZ16 0x8905 | ||
206 | #define AIC_OP_JE16 0x8C05 | ||
207 | #define AIC_OP_JZ16 0x8B05 | ||
208 | #define AIC_OP_JMP16 0x9005 | ||
209 | #define AIC_OP_JC16 0x9105 | ||
210 | #define AIC_OP_JNC16 0x9205 | ||
211 | #define AIC_OP_CALL16 0x9305 | ||
212 | #define AIC_OP_CALL16 0x9305 | ||
213 | |||
214 | /* Page extension is low three bits of second opcode byte. */ | ||
215 | #define AIC_OP_JMPF 0xA005 | ||
216 | #define AIC_OP_CALLF 0xB005 | ||
217 | #define AIC_OP_JCF 0xC005 | ||
218 | #define AIC_OP_JNCF 0xD005 | ||
219 | #define AIC_OP_CMPXCHG 0xE005 | ||
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l b/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l index 45c0b233d0bc..7c3983f868a9 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_scan.l | |||
@@ -38,7 +38,7 @@ | |||
38 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 38 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
39 | * POSSIBILITY OF SUCH DAMAGES. | 39 | * POSSIBILITY OF SUCH DAMAGES. |
40 | * | 40 | * |
41 | * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_scan.l#19 $ | 41 | * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_scan.l#20 $ |
42 | * | 42 | * |
43 | * $FreeBSD$ | 43 | * $FreeBSD$ |
44 | */ | 44 | */ |
@@ -132,7 +132,7 @@ if[ \t]*\( { | |||
132 | *string_buf_ptr++ = *yptr++; | 132 | *string_buf_ptr++ = *yptr++; |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | else { return T_ELSE; } | |
136 | VERSION { return T_VERSION; } | 136 | VERSION { return T_VERSION; } |
137 | PREFIX { return T_PREFIX; } | 137 | PREFIX { return T_PREFIX; } |
138 | PATCH_ARG_LIST { return T_PATCH_ARG_LIST; } | 138 | PATCH_ARG_LIST { return T_PATCH_ARG_LIST; } |
@@ -173,10 +173,6 @@ RW|RO|WO { | |||
173 | yylval.value = WO; | 173 | yylval.value = WO; |
174 | return T_MODE; | 174 | return T_MODE; |
175 | } | 175 | } |
176 | BEGIN_CRITICAL { return T_BEGIN_CS; } | ||
177 | END_CRITICAL { return T_END_CS; } | ||
178 | SET_SRC_MODE { return T_SET_SRC_MODE; } | ||
179 | SET_DST_MODE { return T_SET_DST_MODE; } | ||
180 | field { return T_FIELD; } | 176 | field { return T_FIELD; } |
181 | enum { return T_ENUM; } | 177 | enum { return T_ENUM; } |
182 | mask { return T_MASK; } | 178 | mask { return T_MASK; } |
@@ -192,6 +188,13 @@ none { return T_NONE; } | |||
192 | sindex { return T_SINDEX; } | 188 | sindex { return T_SINDEX; } |
193 | A { return T_A; } | 189 | A { return T_A; } |
194 | 190 | ||
191 | /* Instruction Formatting */ | ||
192 | PAD_PAGE { return T_PAD_PAGE; } | ||
193 | BEGIN_CRITICAL { return T_BEGIN_CS; } | ||
194 | END_CRITICAL { return T_END_CS; } | ||
195 | SET_SRC_MODE { return T_SET_SRC_MODE; } | ||
196 | SET_DST_MODE { return T_SET_DST_MODE; } | ||
197 | |||
195 | /* Opcodes */ | 198 | /* Opcodes */ |
196 | shl { return T_SHL; } | 199 | shl { return T_SHL; } |
197 | shr { return T_SHR; } | 200 | shr { return T_SHR; } |
@@ -223,7 +226,17 @@ and { return T_AND; } | |||
223 | or { return T_OR; } | 226 | or { return T_OR; } |
224 | ret { return T_RET; } | 227 | ret { return T_RET; } |
225 | nop { return T_NOP; } | 228 | nop { return T_NOP; } |
226 | else { return T_ELSE; } | 229 | |
230 | /* ARP2 16bit extensions */ | ||
231 | or16 { return T_OR16; } | ||
232 | and16 { return T_AND16; } | ||
233 | xor16 { return T_XOR16; } | ||
234 | add16 { return T_ADD16; } | ||
235 | adc16 { return T_ADC16; } | ||
236 | mvi16 { return T_MVI16; } | ||
237 | test16 { return T_TEST16; } | ||
238 | cmp16 { return T_CMP16; } | ||
239 | cmpxchg { return T_CMPXCHG; } | ||
227 | 240 | ||
228 | /* Allowed Symbols */ | 241 | /* Allowed Symbols */ |
229 | \<\< { return T_EXPR_LSHIFT; } | 242 | \<\< { return T_EXPR_LSHIFT; } |
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index c8a32cf47d73..cbf825263f3b 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c | |||
@@ -246,6 +246,7 @@ struct ScsiReqBlk { | |||
246 | * total_xfer_length in xferred. These values are restored in | 246 | * total_xfer_length in xferred. These values are restored in |
247 | * pci_unmap_srb_sense. This is the only place xferred is used. | 247 | * pci_unmap_srb_sense. This is the only place xferred is used. |
248 | */ | 248 | */ |
249 | unsigned char *virt_addr_req; /* Saved virtual address of the request buffer */ | ||
249 | u32 xferred; /* Saved copy of total_xfer_length */ | 250 | u32 xferred; /* Saved copy of total_xfer_length */ |
250 | 251 | ||
251 | u16 state; | 252 | u16 state; |
@@ -2017,7 +2018,7 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left) | |||
2017 | sg_verify_length(srb); | 2018 | sg_verify_length(srb); |
2018 | 2019 | ||
2019 | /* we need the corresponding virtual address */ | 2020 | /* we need the corresponding virtual address */ |
2020 | if (!segment) { | 2021 | if (!segment || (srb->flag & AUTO_REQSENSE)) { |
2021 | srb->virt_addr += xferred; | 2022 | srb->virt_addr += xferred; |
2022 | return; | 2023 | return; |
2023 | } | 2024 | } |
@@ -3318,6 +3319,7 @@ static void pci_unmap_srb_sense(struct AdapterCtlBlk *acb, | |||
3318 | srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].address; | 3319 | srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].address; |
3319 | srb->segment_x[0].length = | 3320 | srb->segment_x[0].length = |
3320 | srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].length; | 3321 | srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].length; |
3322 | srb->virt_addr = srb->virt_addr_req; | ||
3321 | } | 3323 | } |
3322 | 3324 | ||
3323 | 3325 | ||
@@ -3711,6 +3713,8 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, | |||
3711 | srb->xferred = srb->total_xfer_length; | 3713 | srb->xferred = srb->total_xfer_length; |
3712 | /* srb->segment_x : a one entry of S/G list table */ | 3714 | /* srb->segment_x : a one entry of S/G list table */ |
3713 | srb->total_xfer_length = sizeof(cmd->sense_buffer); | 3715 | srb->total_xfer_length = sizeof(cmd->sense_buffer); |
3716 | srb->virt_addr_req = srb->virt_addr; | ||
3717 | srb->virt_addr = cmd->sense_buffer; | ||
3714 | srb->segment_x[0].length = sizeof(cmd->sense_buffer); | 3718 | srb->segment_x[0].length = sizeof(cmd->sense_buffer); |
3715 | /* Map sense buffer */ | 3719 | /* Map sense buffer */ |
3716 | srb->segment_x[0].address = | 3720 | srb->segment_x[0].address = |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 822b9fa706f3..eaefeddb2b4a 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -87,7 +87,7 @@ static int max_channel = 3; | |||
87 | static int init_timeout = 5; | 87 | static int init_timeout = 5; |
88 | static int max_requests = 50; | 88 | static int max_requests = 50; |
89 | 89 | ||
90 | #define IBMVSCSI_VERSION "1.5.7" | 90 | #define IBMVSCSI_VERSION "1.5.8" |
91 | 91 | ||
92 | MODULE_DESCRIPTION("IBM Virtual SCSI"); | 92 | MODULE_DESCRIPTION("IBM Virtual SCSI"); |
93 | MODULE_AUTHOR("Dave Boutcher"); | 93 | MODULE_AUTHOR("Dave Boutcher"); |
@@ -534,7 +534,6 @@ static int map_data_for_srp_cmd(struct scsi_cmnd *cmd, | |||
534 | static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, | 534 | static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, |
535 | struct ibmvscsi_host_data *hostdata) | 535 | struct ibmvscsi_host_data *hostdata) |
536 | { | 536 | { |
537 | struct scsi_cmnd *cmnd; | ||
538 | u64 *crq_as_u64 = (u64 *) &evt_struct->crq; | 537 | u64 *crq_as_u64 = (u64 *) &evt_struct->crq; |
539 | int rc; | 538 | int rc; |
540 | 539 | ||
@@ -544,19 +543,8 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, | |||
544 | * can handle more requests (can_queue) when we actually can't | 543 | * can handle more requests (can_queue) when we actually can't |
545 | */ | 544 | */ |
546 | if ((evt_struct->crq.format == VIOSRP_SRP_FORMAT) && | 545 | if ((evt_struct->crq.format == VIOSRP_SRP_FORMAT) && |
547 | (atomic_dec_if_positive(&hostdata->request_limit) < 0)) { | 546 | (atomic_dec_if_positive(&hostdata->request_limit) < 0)) |
548 | /* See if the adapter is disabled */ | 547 | goto send_error; |
549 | if (atomic_read(&hostdata->request_limit) < 0) | ||
550 | goto send_error; | ||
551 | |||
552 | printk(KERN_WARNING | ||
553 | "ibmvscsi: Warning, request_limit exceeded\n"); | ||
554 | unmap_cmd_data(&evt_struct->iu.srp.cmd, | ||
555 | evt_struct, | ||
556 | hostdata->dev); | ||
557 | free_event_struct(&hostdata->pool, evt_struct); | ||
558 | return SCSI_MLQUEUE_HOST_BUSY; | ||
559 | } | ||
560 | 548 | ||
561 | /* Copy the IU into the transfer area */ | 549 | /* Copy the IU into the transfer area */ |
562 | *evt_struct->xfer_iu = evt_struct->iu; | 550 | *evt_struct->xfer_iu = evt_struct->iu; |
@@ -572,7 +560,7 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, | |||
572 | ibmvscsi_send_crq(hostdata, crq_as_u64[0], crq_as_u64[1])) != 0) { | 560 | ibmvscsi_send_crq(hostdata, crq_as_u64[0], crq_as_u64[1])) != 0) { |
573 | list_del(&evt_struct->list); | 561 | list_del(&evt_struct->list); |
574 | 562 | ||
575 | printk(KERN_ERR "ibmvscsi: failed to send event struct rc %d\n", | 563 | printk(KERN_ERR "ibmvscsi: send error %d\n", |
576 | rc); | 564 | rc); |
577 | goto send_error; | 565 | goto send_error; |
578 | } | 566 | } |
@@ -582,14 +570,8 @@ static int ibmvscsi_send_srp_event(struct srp_event_struct *evt_struct, | |||
582 | send_error: | 570 | send_error: |
583 | unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); | 571 | unmap_cmd_data(&evt_struct->iu.srp.cmd, evt_struct, hostdata->dev); |
584 | 572 | ||
585 | if ((cmnd = evt_struct->cmnd) != NULL) { | ||
586 | cmnd->result = DID_ERROR << 16; | ||
587 | evt_struct->cmnd_done(cmnd); | ||
588 | } else if (evt_struct->done) | ||
589 | evt_struct->done(evt_struct); | ||
590 | |||
591 | free_event_struct(&hostdata->pool, evt_struct); | 573 | free_event_struct(&hostdata->pool, evt_struct); |
592 | return 0; | 574 | return SCSI_MLQUEUE_HOST_BUSY; |
593 | } | 575 | } |
594 | 576 | ||
595 | /** | 577 | /** |
@@ -802,7 +784,8 @@ static void login_rsp(struct srp_event_struct *evt_struct) | |||
802 | case SRP_LOGIN_RSP_TYPE: /* it worked! */ | 784 | case SRP_LOGIN_RSP_TYPE: /* it worked! */ |
803 | break; | 785 | break; |
804 | case SRP_LOGIN_REJ_TYPE: /* refused! */ | 786 | case SRP_LOGIN_REJ_TYPE: /* refused! */ |
805 | printk(KERN_INFO "ibmvscsi: SRP_LOGIN_REQ rejected\n"); | 787 | printk(KERN_INFO "ibmvscsi: SRP_LOGIN_REJ reason %u\n", |
788 | evt_struct->xfer_iu->srp.login_rej.reason); | ||
806 | /* Login failed. */ | 789 | /* Login failed. */ |
807 | atomic_set(&hostdata->request_limit, -1); | 790 | atomic_set(&hostdata->request_limit, -1); |
808 | return; | 791 | return; |
@@ -834,6 +817,9 @@ static void login_rsp(struct srp_event_struct *evt_struct) | |||
834 | return; | 817 | return; |
835 | } | 818 | } |
836 | 819 | ||
820 | /* If we had any pending I/Os, kick them */ | ||
821 | scsi_unblock_requests(hostdata->host); | ||
822 | |||
837 | send_mad_adapter_info(hostdata); | 823 | send_mad_adapter_info(hostdata); |
838 | return; | 824 | return; |
839 | } | 825 | } |
@@ -862,6 +848,7 @@ static int send_srp_login(struct ibmvscsi_host_data *hostdata) | |||
862 | init_timeout * HZ); | 848 | init_timeout * HZ); |
863 | 849 | ||
864 | login = &evt_struct->iu.srp.login_req; | 850 | login = &evt_struct->iu.srp.login_req; |
851 | memset(login, 0x00, sizeof(struct srp_login_req)); | ||
865 | login->type = SRP_LOGIN_REQ_TYPE; | 852 | login->type = SRP_LOGIN_REQ_TYPE; |
866 | login->max_requested_initiator_to_target_iulen = sizeof(union srp_iu); | 853 | login->max_requested_initiator_to_target_iulen = sizeof(union srp_iu); |
867 | login->required_buffer_formats = 0x0006; | 854 | login->required_buffer_formats = 0x0006; |
@@ -1122,7 +1109,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd) | |||
1122 | * purge_requests: Our virtual adapter just shut down. purge any sent requests | 1109 | * purge_requests: Our virtual adapter just shut down. purge any sent requests |
1123 | * @hostdata: the adapter | 1110 | * @hostdata: the adapter |
1124 | */ | 1111 | */ |
1125 | static void purge_requests(struct ibmvscsi_host_data *hostdata) | 1112 | static void purge_requests(struct ibmvscsi_host_data *hostdata, int error_code) |
1126 | { | 1113 | { |
1127 | struct srp_event_struct *tmp_evt, *pos; | 1114 | struct srp_event_struct *tmp_evt, *pos; |
1128 | unsigned long flags; | 1115 | unsigned long flags; |
@@ -1131,7 +1118,7 @@ static void purge_requests(struct ibmvscsi_host_data *hostdata) | |||
1131 | list_for_each_entry_safe(tmp_evt, pos, &hostdata->sent, list) { | 1118 | list_for_each_entry_safe(tmp_evt, pos, &hostdata->sent, list) { |
1132 | list_del(&tmp_evt->list); | 1119 | list_del(&tmp_evt->list); |
1133 | if (tmp_evt->cmnd) { | 1120 | if (tmp_evt->cmnd) { |
1134 | tmp_evt->cmnd->result = (DID_ERROR << 16); | 1121 | tmp_evt->cmnd->result = (error_code << 16); |
1135 | unmap_cmd_data(&tmp_evt->iu.srp.cmd, | 1122 | unmap_cmd_data(&tmp_evt->iu.srp.cmd, |
1136 | tmp_evt, | 1123 | tmp_evt, |
1137 | tmp_evt->hostdata->dev); | 1124 | tmp_evt->hostdata->dev); |
@@ -1186,12 +1173,30 @@ void ibmvscsi_handle_crq(struct viosrp_crq *crq, | |||
1186 | printk(KERN_ERR "ibmvscsi: unknown crq message type\n"); | 1173 | printk(KERN_ERR "ibmvscsi: unknown crq message type\n"); |
1187 | } | 1174 | } |
1188 | return; | 1175 | return; |
1189 | case 0xFF: /* Hypervisor telling us the connection is closed */ | 1176 | case 0xFF: /* Hypervisor telling us the connection is closed */ |
1190 | printk(KERN_INFO "ibmvscsi: Virtual adapter failed!\n"); | 1177 | scsi_block_requests(hostdata->host); |
1178 | if (crq->format == 0x06) { | ||
1179 | /* We need to re-setup the interpartition connection */ | ||
1180 | printk(KERN_INFO | ||
1181 | "ibmvscsi: Re-enabling adapter!\n"); | ||
1182 | purge_requests(hostdata, DID_REQUEUE); | ||
1183 | if (ibmvscsi_reenable_crq_queue(&hostdata->queue, | ||
1184 | hostdata) == 0) | ||
1185 | if (ibmvscsi_send_crq(hostdata, | ||
1186 | 0xC001000000000000LL, 0)) | ||
1187 | printk(KERN_ERR | ||
1188 | "ibmvscsi: transmit error after" | ||
1189 | " enable\n"); | ||
1190 | } else { | ||
1191 | printk(KERN_INFO | ||
1192 | "ibmvscsi: Virtual adapter failed rc %d!\n", | ||
1193 | crq->format); | ||
1191 | 1194 | ||
1192 | atomic_set(&hostdata->request_limit, -1); | 1195 | atomic_set(&hostdata->request_limit, -1); |
1193 | purge_requests(hostdata); | 1196 | purge_requests(hostdata, DID_ERROR); |
1194 | ibmvscsi_reset_crq_queue(&hostdata->queue, hostdata); | 1197 | ibmvscsi_reset_crq_queue(&hostdata->queue, hostdata); |
1198 | } | ||
1199 | scsi_unblock_requests(hostdata->host); | ||
1195 | return; | 1200 | return; |
1196 | case 0x80: /* real payload */ | 1201 | case 0x80: /* real payload */ |
1197 | break; | 1202 | break; |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h index 5b0edd1f1921..4550d71e4744 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.h +++ b/drivers/scsi/ibmvscsi/ibmvscsi.h | |||
@@ -103,6 +103,9 @@ void ibmvscsi_release_crq_queue(struct crq_queue *queue, | |||
103 | int ibmvscsi_reset_crq_queue(struct crq_queue *queue, | 103 | int ibmvscsi_reset_crq_queue(struct crq_queue *queue, |
104 | struct ibmvscsi_host_data *hostdata); | 104 | struct ibmvscsi_host_data *hostdata); |
105 | 105 | ||
106 | int ibmvscsi_reenable_crq_queue(struct crq_queue *queue, | ||
107 | struct ibmvscsi_host_data *hostdata); | ||
108 | |||
106 | void ibmvscsi_handle_crq(struct viosrp_crq *crq, | 109 | void ibmvscsi_handle_crq(struct viosrp_crq *crq, |
107 | struct ibmvscsi_host_data *hostdata); | 110 | struct ibmvscsi_host_data *hostdata); |
108 | int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata, | 111 | int ibmvscsi_send_crq(struct ibmvscsi_host_data *hostdata, |
diff --git a/drivers/scsi/ibmvscsi/iseries_vscsi.c b/drivers/scsi/ibmvscsi/iseries_vscsi.c index ce15d9e39621..7eed0b098171 100644 --- a/drivers/scsi/ibmvscsi/iseries_vscsi.c +++ b/drivers/scsi/ibmvscsi/iseries_vscsi.c | |||
@@ -124,6 +124,19 @@ int ibmvscsi_reset_crq_queue(struct crq_queue *queue, | |||
124 | } | 124 | } |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * reenable_crq_queue: - reenables a crq after a failure | ||
128 | * @queue: crq_queue to initialize and register | ||
129 | * @hostdata: ibmvscsi_host_data of host | ||
130 | * | ||
131 | * no-op for iSeries | ||
132 | */ | ||
133 | int ibmvscsi_reenable_crq_queue(struct crq_queue *queue, | ||
134 | struct ibmvscsi_host_data *hostdata) | ||
135 | { | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | /** | ||
127 | * ibmvscsi_send_crq: - Send a CRQ | 140 | * ibmvscsi_send_crq: - Send a CRQ |
128 | * @hostdata: the adapter | 141 | * @hostdata: the adapter |
129 | * @word1: the first 64 bits of the data | 142 | * @word1: the first 64 bits of the data |
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c index 75db2f5c545e..f47dd87c05e7 100644 --- a/drivers/scsi/ibmvscsi/rpa_vscsi.c +++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c | |||
@@ -281,6 +281,28 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue, | |||
281 | } | 281 | } |
282 | 282 | ||
283 | /** | 283 | /** |
284 | * reenable_crq_queue: - reenables a crq after | ||
285 | * @queue: crq_queue to initialize and register | ||
286 | * @hostdata: ibmvscsi_host_data of host | ||
287 | * | ||
288 | */ | ||
289 | int ibmvscsi_reenable_crq_queue(struct crq_queue *queue, | ||
290 | struct ibmvscsi_host_data *hostdata) | ||
291 | { | ||
292 | int rc; | ||
293 | struct vio_dev *vdev = to_vio_dev(hostdata->dev); | ||
294 | |||
295 | /* Re-enable the CRQ */ | ||
296 | do { | ||
297 | rc = plpar_hcall_norets(H_ENABLE_CRQ, vdev->unit_address); | ||
298 | } while ((rc == H_InProgress) || (rc == H_Busy) || (H_isLongBusy(rc))); | ||
299 | |||
300 | if (rc) | ||
301 | printk(KERN_ERR "ibmvscsi: Error %d enabling adapter\n", rc); | ||
302 | return rc; | ||
303 | } | ||
304 | |||
305 | /** | ||
284 | * reset_crq_queue: - resets a crq after a failure | 306 | * reset_crq_queue: - resets a crq after a failure |
285 | * @queue: crq_queue to initialize and register | 307 | * @queue: crq_queue to initialize and register |
286 | * @hostdata: ibmvscsi_host_data of host | 308 | * @hostdata: ibmvscsi_host_data of host |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index e5e1ca44e1ee..86c546164da9 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -3499,6 +3499,7 @@ ips_map_status(ips_ha_t * ha, ips_scb_t * scb, ips_stat_t * sp) | |||
3499 | int device_error; | 3499 | int device_error; |
3500 | uint32_t transfer_len; | 3500 | uint32_t transfer_len; |
3501 | IPS_DCDB_TABLE_TAPE *tapeDCDB; | 3501 | IPS_DCDB_TABLE_TAPE *tapeDCDB; |
3502 | IPS_SCSI_INQ_DATA inquiryData; | ||
3502 | 3503 | ||
3503 | METHOD_TRACE("ips_map_status", 1); | 3504 | METHOD_TRACE("ips_map_status", 1); |
3504 | 3505 | ||
@@ -3557,13 +3558,13 @@ ips_map_status(ips_ha_t * ha, ips_scb_t * scb, ips_stat_t * sp) | |||
3557 | errcode = DID_OK; | 3558 | errcode = DID_OK; |
3558 | 3559 | ||
3559 | /* Restrict access to physical DASD */ | 3560 | /* Restrict access to physical DASD */ |
3560 | if ((scb->scsi_cmd->cmnd[0] == INQUIRY) && | 3561 | if (scb->scsi_cmd->cmnd[0] == INQUIRY) { |
3561 | ((((char *) scb->scsi_cmd-> | 3562 | ips_scmd_buf_read(scb->scsi_cmd, |
3562 | buffer)[0] & 0x1f) == TYPE_DISK)) { | 3563 | &inquiryData, sizeof (inquiryData)); |
3563 | /* underflow -- no error */ | 3564 | if ((inquiryData.DeviceType & 0x1f) == TYPE_DISK) { |
3564 | /* restrict access to physical DASD */ | 3565 | errcode = DID_TIME_OUT; |
3565 | errcode = DID_TIME_OUT; | 3566 | break; |
3566 | break; | 3567 | } |
3567 | } | 3568 | } |
3568 | } else | 3569 | } else |
3569 | errcode = DID_ERROR; | 3570 | errcode = DID_ERROR; |
@@ -4135,6 +4136,7 @@ ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus) | |||
4135 | uint8_t basic_status; | 4136 | uint8_t basic_status; |
4136 | uint8_t ext_status; | 4137 | uint8_t ext_status; |
4137 | int errcode; | 4138 | int errcode; |
4139 | IPS_SCSI_INQ_DATA inquiryData; | ||
4138 | 4140 | ||
4139 | METHOD_TRACE("ips_chkstatus", 1); | 4141 | METHOD_TRACE("ips_chkstatus", 1); |
4140 | 4142 | ||
@@ -4255,11 +4257,11 @@ ips_chkstatus(ips_ha_t * ha, IPS_STATUS * pstatus) | |||
4255 | scb->scsi_cmd->result = errcode << 16; | 4257 | scb->scsi_cmd->result = errcode << 16; |
4256 | } else { /* bus == 0 */ | 4258 | } else { /* bus == 0 */ |
4257 | /* restrict access to physical drives */ | 4259 | /* restrict access to physical drives */ |
4258 | if ((scb->scsi_cmd->cmnd[0] == INQUIRY) && | 4260 | if (scb->scsi_cmd->cmnd[0] == INQUIRY) { |
4259 | ((((char *) scb->scsi_cmd->buffer)[0] & 0x1f) == | 4261 | ips_scmd_buf_read(scb->scsi_cmd, |
4260 | TYPE_DISK)) { | 4262 | &inquiryData, sizeof (inquiryData)); |
4261 | 4263 | if ((inquiryData.DeviceType & 0x1f) == TYPE_DISK) | |
4262 | scb->scsi_cmd->result = DID_TIME_OUT << 16; | 4264 | scb->scsi_cmd->result = DID_TIME_OUT << 16; |
4263 | } | 4265 | } |
4264 | } /* else */ | 4266 | } /* else */ |
4265 | } else { /* recovered error / success */ | 4267 | } else { /* recovered error / success */ |
@@ -5012,7 +5014,7 @@ ips_init_copperhead(ips_ha_t * ha) | |||
5012 | break; | 5014 | break; |
5013 | 5015 | ||
5014 | /* Delay for 1 Second */ | 5016 | /* Delay for 1 Second */ |
5015 | MDELAY(IPS_ONE_SEC); | 5017 | msleep(IPS_ONE_SEC); |
5016 | } | 5018 | } |
5017 | 5019 | ||
5018 | if (j >= 45) | 5020 | if (j >= 45) |
@@ -5038,7 +5040,7 @@ ips_init_copperhead(ips_ha_t * ha) | |||
5038 | break; | 5040 | break; |
5039 | 5041 | ||
5040 | /* Delay for 1 Second */ | 5042 | /* Delay for 1 Second */ |
5041 | MDELAY(IPS_ONE_SEC); | 5043 | msleep(IPS_ONE_SEC); |
5042 | } | 5044 | } |
5043 | 5045 | ||
5044 | if (j >= 240) | 5046 | if (j >= 240) |
@@ -5056,7 +5058,7 @@ ips_init_copperhead(ips_ha_t * ha) | |||
5056 | break; | 5058 | break; |
5057 | 5059 | ||
5058 | /* Delay for 1 Second */ | 5060 | /* Delay for 1 Second */ |
5059 | MDELAY(IPS_ONE_SEC); | 5061 | msleep(IPS_ONE_SEC); |
5060 | } | 5062 | } |
5061 | 5063 | ||
5062 | if (i >= 240) | 5064 | if (i >= 240) |
@@ -5106,7 +5108,7 @@ ips_init_copperhead_memio(ips_ha_t * ha) | |||
5106 | break; | 5108 | break; |
5107 | 5109 | ||
5108 | /* Delay for 1 Second */ | 5110 | /* Delay for 1 Second */ |
5109 | MDELAY(IPS_ONE_SEC); | 5111 | msleep(IPS_ONE_SEC); |
5110 | } | 5112 | } |
5111 | 5113 | ||
5112 | if (j >= 45) | 5114 | if (j >= 45) |
@@ -5132,7 +5134,7 @@ ips_init_copperhead_memio(ips_ha_t * ha) | |||
5132 | break; | 5134 | break; |
5133 | 5135 | ||
5134 | /* Delay for 1 Second */ | 5136 | /* Delay for 1 Second */ |
5135 | MDELAY(IPS_ONE_SEC); | 5137 | msleep(IPS_ONE_SEC); |
5136 | } | 5138 | } |
5137 | 5139 | ||
5138 | if (j >= 240) | 5140 | if (j >= 240) |
@@ -5150,7 +5152,7 @@ ips_init_copperhead_memio(ips_ha_t * ha) | |||
5150 | break; | 5152 | break; |
5151 | 5153 | ||
5152 | /* Delay for 1 Second */ | 5154 | /* Delay for 1 Second */ |
5153 | MDELAY(IPS_ONE_SEC); | 5155 | msleep(IPS_ONE_SEC); |
5154 | } | 5156 | } |
5155 | 5157 | ||
5156 | if (i >= 240) | 5158 | if (i >= 240) |
@@ -5202,7 +5204,7 @@ ips_init_morpheus(ips_ha_t * ha) | |||
5202 | break; | 5204 | break; |
5203 | 5205 | ||
5204 | /* Delay for 1 Second */ | 5206 | /* Delay for 1 Second */ |
5205 | MDELAY(IPS_ONE_SEC); | 5207 | msleep(IPS_ONE_SEC); |
5206 | } | 5208 | } |
5207 | 5209 | ||
5208 | if (i >= 45) { | 5210 | if (i >= 45) { |
@@ -5228,7 +5230,7 @@ ips_init_morpheus(ips_ha_t * ha) | |||
5228 | if (Post != 0x4F00) | 5230 | if (Post != 0x4F00) |
5229 | break; | 5231 | break; |
5230 | /* Delay for 1 Second */ | 5232 | /* Delay for 1 Second */ |
5231 | MDELAY(IPS_ONE_SEC); | 5233 | msleep(IPS_ONE_SEC); |
5232 | } | 5234 | } |
5233 | 5235 | ||
5234 | if (i >= 120) { | 5236 | if (i >= 120) { |
@@ -5258,7 +5260,7 @@ ips_init_morpheus(ips_ha_t * ha) | |||
5258 | break; | 5260 | break; |
5259 | 5261 | ||
5260 | /* Delay for 1 Second */ | 5262 | /* Delay for 1 Second */ |
5261 | MDELAY(IPS_ONE_SEC); | 5263 | msleep(IPS_ONE_SEC); |
5262 | } | 5264 | } |
5263 | 5265 | ||
5264 | if (i >= 240) { | 5266 | if (i >= 240) { |
@@ -5318,12 +5320,12 @@ ips_reset_copperhead(ips_ha_t * ha) | |||
5318 | outb(IPS_BIT_RST, ha->io_addr + IPS_REG_SCPR); | 5320 | outb(IPS_BIT_RST, ha->io_addr + IPS_REG_SCPR); |
5319 | 5321 | ||
5320 | /* Delay for 1 Second */ | 5322 | /* Delay for 1 Second */ |
5321 | MDELAY(IPS_ONE_SEC); | 5323 | msleep(IPS_ONE_SEC); |
5322 | 5324 | ||
5323 | outb(0, ha->io_addr + IPS_REG_SCPR); | 5325 | outb(0, ha->io_addr + IPS_REG_SCPR); |
5324 | 5326 | ||
5325 | /* Delay for 1 Second */ | 5327 | /* Delay for 1 Second */ |
5326 | MDELAY(IPS_ONE_SEC); | 5328 | msleep(IPS_ONE_SEC); |
5327 | 5329 | ||
5328 | if ((*ha->func.init) (ha)) | 5330 | if ((*ha->func.init) (ha)) |
5329 | break; | 5331 | break; |
@@ -5363,12 +5365,12 @@ ips_reset_copperhead_memio(ips_ha_t * ha) | |||
5363 | writeb(IPS_BIT_RST, ha->mem_ptr + IPS_REG_SCPR); | 5365 | writeb(IPS_BIT_RST, ha->mem_ptr + IPS_REG_SCPR); |
5364 | 5366 | ||
5365 | /* Delay for 1 Second */ | 5367 | /* Delay for 1 Second */ |
5366 | MDELAY(IPS_ONE_SEC); | 5368 | msleep(IPS_ONE_SEC); |
5367 | 5369 | ||
5368 | writeb(0, ha->mem_ptr + IPS_REG_SCPR); | 5370 | writeb(0, ha->mem_ptr + IPS_REG_SCPR); |
5369 | 5371 | ||
5370 | /* Delay for 1 Second */ | 5372 | /* Delay for 1 Second */ |
5371 | MDELAY(IPS_ONE_SEC); | 5373 | msleep(IPS_ONE_SEC); |
5372 | 5374 | ||
5373 | if ((*ha->func.init) (ha)) | 5375 | if ((*ha->func.init) (ha)) |
5374 | break; | 5376 | break; |
@@ -5409,7 +5411,7 @@ ips_reset_morpheus(ips_ha_t * ha) | |||
5409 | writel(0x80000000, ha->mem_ptr + IPS_REG_I960_IDR); | 5411 | writel(0x80000000, ha->mem_ptr + IPS_REG_I960_IDR); |
5410 | 5412 | ||
5411 | /* Delay for 5 Seconds */ | 5413 | /* Delay for 5 Seconds */ |
5412 | MDELAY(5 * IPS_ONE_SEC); | 5414 | msleep(5 * IPS_ONE_SEC); |
5413 | 5415 | ||
5414 | /* Do a PCI config read to wait for adapter */ | 5416 | /* Do a PCI config read to wait for adapter */ |
5415 | pci_read_config_byte(ha->pcidev, 4, &junk); | 5417 | pci_read_config_byte(ha->pcidev, 4, &junk); |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index cfbceb504718..07b1e7cc61df 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1700,6 +1700,31 @@ static unsigned int ata_msense_rw_recovery(u8 **ptr_io, const u8 *last) | |||
1700 | return sizeof(def_rw_recovery_mpage); | 1700 | return sizeof(def_rw_recovery_mpage); |
1701 | } | 1701 | } |
1702 | 1702 | ||
1703 | /* | ||
1704 | * We can turn this into a real blacklist if it's needed, for now just | ||
1705 | * blacklist any Maxtor BANC1G10 revision firmware | ||
1706 | */ | ||
1707 | static int ata_dev_supports_fua(u16 *id) | ||
1708 | { | ||
1709 | unsigned char model[41], fw[9]; | ||
1710 | |||
1711 | if (!ata_id_has_fua(id)) | ||
1712 | return 0; | ||
1713 | |||
1714 | model[40] = '\0'; | ||
1715 | fw[8] = '\0'; | ||
1716 | |||
1717 | ata_dev_id_string(id, model, ATA_ID_PROD_OFS, sizeof(model) - 1); | ||
1718 | ata_dev_id_string(id, fw, ATA_ID_FW_REV_OFS, sizeof(fw) - 1); | ||
1719 | |||
1720 | if (strncmp(model, "Maxtor", 6)) | ||
1721 | return 1; | ||
1722 | if (strncmp(fw, "BANC1G10", 8)) | ||
1723 | return 1; | ||
1724 | |||
1725 | return 0; /* blacklisted */ | ||
1726 | } | ||
1727 | |||
1703 | /** | 1728 | /** |
1704 | * ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands | 1729 | * ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands |
1705 | * @args: device IDENTIFY data / SCSI command of interest. | 1730 | * @args: device IDENTIFY data / SCSI command of interest. |
@@ -1797,7 +1822,7 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
1797 | return 0; | 1822 | return 0; |
1798 | 1823 | ||
1799 | dpofua = 0; | 1824 | dpofua = 0; |
1800 | if (ata_id_has_fua(args->id) && dev->flags & ATA_DFLAG_LBA48 && | 1825 | if (ata_dev_supports_fua(args->id) && dev->flags & ATA_DFLAG_LBA48 && |
1801 | (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) | 1826 | (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) |
1802 | dpofua = 1 << 4; | 1827 | dpofua = 1 << 4; |
1803 | 1828 | ||
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index 511ed52a5807..a487f414960e 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * 2 of the License, or (at your option) any later version. | 10 | * 2 of the License, or (at your option) any later version. |
11 | * | 11 | * |
12 | * FILE : megaraid_sas.c | 12 | * FILE : megaraid_sas.c |
13 | * Version : v00.00.02.00-rc4 | 13 | * Version : v00.00.02.02 |
14 | * | 14 | * |
15 | * Authors: | 15 | * Authors: |
16 | * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com> | 16 | * Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com> |
@@ -55,13 +55,13 @@ static struct pci_device_id megasas_pci_table[] = { | |||
55 | 55 | ||
56 | { | 56 | { |
57 | PCI_VENDOR_ID_LSI_LOGIC, | 57 | PCI_VENDOR_ID_LSI_LOGIC, |
58 | PCI_DEVICE_ID_LSI_SAS1064R, | 58 | PCI_DEVICE_ID_LSI_SAS1064R, // xscale IOP |
59 | PCI_ANY_ID, | 59 | PCI_ANY_ID, |
60 | PCI_ANY_ID, | 60 | PCI_ANY_ID, |
61 | }, | 61 | }, |
62 | { | 62 | { |
63 | PCI_VENDOR_ID_DELL, | 63 | PCI_VENDOR_ID_DELL, |
64 | PCI_DEVICE_ID_DELL_PERC5, | 64 | PCI_DEVICE_ID_DELL_PERC5, // xscale IOP |
65 | PCI_ANY_ID, | 65 | PCI_ANY_ID, |
66 | PCI_ANY_ID, | 66 | PCI_ANY_ID, |
67 | }, | 67 | }, |
@@ -119,12 +119,18 @@ megasas_return_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd) | |||
119 | spin_unlock_irqrestore(&instance->cmd_pool_lock, flags); | 119 | spin_unlock_irqrestore(&instance->cmd_pool_lock, flags); |
120 | } | 120 | } |
121 | 121 | ||
122 | |||
123 | /** | ||
124 | * The following functions are defined for xscale | ||
125 | * (deviceid : 1064R, PERC5) controllers | ||
126 | */ | ||
127 | |||
122 | /** | 128 | /** |
123 | * megasas_enable_intr - Enables interrupts | 129 | * megasas_enable_intr_xscale - Enables interrupts |
124 | * @regs: MFI register set | 130 | * @regs: MFI register set |
125 | */ | 131 | */ |
126 | static inline void | 132 | static inline void |
127 | megasas_enable_intr(struct megasas_register_set __iomem * regs) | 133 | megasas_enable_intr_xscale(struct megasas_register_set __iomem * regs) |
128 | { | 134 | { |
129 | writel(1, &(regs)->outbound_intr_mask); | 135 | writel(1, &(regs)->outbound_intr_mask); |
130 | 136 | ||
@@ -133,13 +139,73 @@ megasas_enable_intr(struct megasas_register_set __iomem * regs) | |||
133 | } | 139 | } |
134 | 140 | ||
135 | /** | 141 | /** |
142 | * megasas_read_fw_status_reg_xscale - returns the current FW status value | ||
143 | * @regs: MFI register set | ||
144 | */ | ||
145 | static u32 | ||
146 | megasas_read_fw_status_reg_xscale(struct megasas_register_set __iomem * regs) | ||
147 | { | ||
148 | return readl(&(regs)->outbound_msg_0); | ||
149 | } | ||
150 | /** | ||
151 | * megasas_clear_interrupt_xscale - Check & clear interrupt | ||
152 | * @regs: MFI register set | ||
153 | */ | ||
154 | static int | ||
155 | megasas_clear_intr_xscale(struct megasas_register_set __iomem * regs) | ||
156 | { | ||
157 | u32 status; | ||
158 | /* | ||
159 | * Check if it is our interrupt | ||
160 | */ | ||
161 | status = readl(®s->outbound_intr_status); | ||
162 | |||
163 | if (!(status & MFI_OB_INTR_STATUS_MASK)) { | ||
164 | return 1; | ||
165 | } | ||
166 | |||
167 | /* | ||
168 | * Clear the interrupt by writing back the same value | ||
169 | */ | ||
170 | writel(status, ®s->outbound_intr_status); | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | /** | ||
176 | * megasas_fire_cmd_xscale - Sends command to the FW | ||
177 | * @frame_phys_addr : Physical address of cmd | ||
178 | * @frame_count : Number of frames for the command | ||
179 | * @regs : MFI register set | ||
180 | */ | ||
181 | static inline void | ||
182 | megasas_fire_cmd_xscale(dma_addr_t frame_phys_addr,u32 frame_count, struct megasas_register_set __iomem *regs) | ||
183 | { | ||
184 | writel((frame_phys_addr >> 3)|(frame_count), | ||
185 | &(regs)->inbound_queue_port); | ||
186 | } | ||
187 | |||
188 | static struct megasas_instance_template megasas_instance_template_xscale = { | ||
189 | |||
190 | .fire_cmd = megasas_fire_cmd_xscale, | ||
191 | .enable_intr = megasas_enable_intr_xscale, | ||
192 | .clear_intr = megasas_clear_intr_xscale, | ||
193 | .read_fw_status_reg = megasas_read_fw_status_reg_xscale, | ||
194 | }; | ||
195 | |||
196 | /** | ||
197 | * This is the end of set of functions & definitions specific | ||
198 | * to xscale (deviceid : 1064R, PERC5) controllers | ||
199 | */ | ||
200 | |||
201 | /** | ||
136 | * megasas_disable_intr - Disables interrupts | 202 | * megasas_disable_intr - Disables interrupts |
137 | * @regs: MFI register set | 203 | * @regs: MFI register set |
138 | */ | 204 | */ |
139 | static inline void | 205 | static inline void |
140 | megasas_disable_intr(struct megasas_register_set __iomem * regs) | 206 | megasas_disable_intr(struct megasas_register_set __iomem * regs) |
141 | { | 207 | { |
142 | u32 mask = readl(®s->outbound_intr_mask) & (~0x00000001); | 208 | u32 mask = 0x1f; |
143 | writel(mask, ®s->outbound_intr_mask); | 209 | writel(mask, ®s->outbound_intr_mask); |
144 | 210 | ||
145 | /* Dummy readl to force pci flush */ | 211 | /* Dummy readl to force pci flush */ |
@@ -167,8 +233,7 @@ megasas_issue_polled(struct megasas_instance *instance, struct megasas_cmd *cmd) | |||
167 | /* | 233 | /* |
168 | * Issue the frame using inbound queue port | 234 | * Issue the frame using inbound queue port |
169 | */ | 235 | */ |
170 | writel(cmd->frame_phys_addr >> 3, | 236 | instance->instancet->fire_cmd(cmd->frame_phys_addr ,0,instance->reg_set); |
171 | &instance->reg_set->inbound_queue_port); | ||
172 | 237 | ||
173 | /* | 238 | /* |
174 | * Wait for cmd_status to change | 239 | * Wait for cmd_status to change |
@@ -198,8 +263,7 @@ megasas_issue_blocked_cmd(struct megasas_instance *instance, | |||
198 | { | 263 | { |
199 | cmd->cmd_status = ENODATA; | 264 | cmd->cmd_status = ENODATA; |
200 | 265 | ||
201 | writel(cmd->frame_phys_addr >> 3, | 266 | instance->instancet->fire_cmd(cmd->frame_phys_addr ,0,instance->reg_set); |
202 | &instance->reg_set->inbound_queue_port); | ||
203 | 267 | ||
204 | wait_event(instance->int_cmd_wait_q, (cmd->cmd_status != ENODATA)); | 268 | wait_event(instance->int_cmd_wait_q, (cmd->cmd_status != ENODATA)); |
205 | 269 | ||
@@ -242,8 +306,7 @@ megasas_issue_blocked_abort_cmd(struct megasas_instance *instance, | |||
242 | cmd->sync_cmd = 1; | 306 | cmd->sync_cmd = 1; |
243 | cmd->cmd_status = 0xFF; | 307 | cmd->cmd_status = 0xFF; |
244 | 308 | ||
245 | writel(cmd->frame_phys_addr >> 3, | 309 | instance->instancet->fire_cmd(cmd->frame_phys_addr ,0,instance->reg_set); |
246 | &instance->reg_set->inbound_queue_port); | ||
247 | 310 | ||
248 | /* | 311 | /* |
249 | * Wait for this cmd to complete | 312 | * Wait for this cmd to complete |
@@ -558,112 +621,29 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp, | |||
558 | } | 621 | } |
559 | 622 | ||
560 | /** | 623 | /** |
561 | * megasas_build_cmd - Prepares a command packet | 624 | * megasas_is_ldio - Checks if the cmd is for logical drive |
562 | * @instance: Adapter soft state | 625 | * @scmd: SCSI command |
563 | * @scp: SCSI command | 626 | * |
564 | * @frame_count: [OUT] Number of frames used to prepare this command | 627 | * Called by megasas_queue_command to find out if the command to be queued |
628 | * is a logical drive command | ||
565 | */ | 629 | */ |
566 | static struct megasas_cmd *megasas_build_cmd(struct megasas_instance | 630 | static inline int megasas_is_ldio(struct scsi_cmnd *cmd) |
567 | *instance, | ||
568 | struct scsi_cmnd *scp, | ||
569 | int *frame_count) | ||
570 | { | 631 | { |
571 | u32 logical_cmd; | 632 | if (!MEGASAS_IS_LOGICAL(cmd)) |
572 | struct megasas_cmd *cmd; | 633 | return 0; |
573 | 634 | switch (cmd->cmnd[0]) { | |
574 | /* | 635 | case READ_10: |
575 | * Find out if this is logical or physical drive command. | 636 | case WRITE_10: |
576 | */ | 637 | case READ_12: |
577 | logical_cmd = MEGASAS_IS_LOGICAL(scp); | 638 | case WRITE_12: |
578 | 639 | case READ_6: | |
579 | /* | 640 | case WRITE_6: |
580 | * Logical drive command | 641 | case READ_16: |
581 | */ | 642 | case WRITE_16: |
582 | if (logical_cmd) { | 643 | return 1; |
583 | 644 | default: | |
584 | if (scp->device->id >= MEGASAS_MAX_LD) { | 645 | return 0; |
585 | scp->result = DID_BAD_TARGET << 16; | ||
586 | return NULL; | ||
587 | } | ||
588 | |||
589 | switch (scp->cmnd[0]) { | ||
590 | |||
591 | case READ_10: | ||
592 | case WRITE_10: | ||
593 | case READ_12: | ||
594 | case WRITE_12: | ||
595 | case READ_6: | ||
596 | case WRITE_6: | ||
597 | case READ_16: | ||
598 | case WRITE_16: | ||
599 | /* | ||
600 | * Fail for LUN > 0 | ||
601 | */ | ||
602 | if (scp->device->lun) { | ||
603 | scp->result = DID_BAD_TARGET << 16; | ||
604 | return NULL; | ||
605 | } | ||
606 | |||
607 | cmd = megasas_get_cmd(instance); | ||
608 | |||
609 | if (!cmd) { | ||
610 | scp->result = DID_IMM_RETRY << 16; | ||
611 | return NULL; | ||
612 | } | ||
613 | |||
614 | *frame_count = megasas_build_ldio(instance, scp, cmd); | ||
615 | |||
616 | if (!(*frame_count)) { | ||
617 | megasas_return_cmd(instance, cmd); | ||
618 | return NULL; | ||
619 | } | ||
620 | |||
621 | return cmd; | ||
622 | |||
623 | default: | ||
624 | /* | ||
625 | * Fail for LUN > 0 | ||
626 | */ | ||
627 | if (scp->device->lun) { | ||
628 | scp->result = DID_BAD_TARGET << 16; | ||
629 | return NULL; | ||
630 | } | ||
631 | |||
632 | cmd = megasas_get_cmd(instance); | ||
633 | |||
634 | if (!cmd) { | ||
635 | scp->result = DID_IMM_RETRY << 16; | ||
636 | return NULL; | ||
637 | } | ||
638 | |||
639 | *frame_count = megasas_build_dcdb(instance, scp, cmd); | ||
640 | |||
641 | if (!(*frame_count)) { | ||
642 | megasas_return_cmd(instance, cmd); | ||
643 | return NULL; | ||
644 | } | ||
645 | |||
646 | return cmd; | ||
647 | } | ||
648 | } else { | ||
649 | cmd = megasas_get_cmd(instance); | ||
650 | |||
651 | if (!cmd) { | ||
652 | scp->result = DID_IMM_RETRY << 16; | ||
653 | return NULL; | ||
654 | } | ||
655 | |||
656 | *frame_count = megasas_build_dcdb(instance, scp, cmd); | ||
657 | |||
658 | if (!(*frame_count)) { | ||
659 | megasas_return_cmd(instance, cmd); | ||
660 | return NULL; | ||
661 | } | ||
662 | |||
663 | return cmd; | ||
664 | } | 646 | } |
665 | |||
666 | return NULL; | ||
667 | } | 647 | } |
668 | 648 | ||
669 | /** | 649 | /** |
@@ -684,13 +664,27 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | |||
684 | scmd->scsi_done = done; | 664 | scmd->scsi_done = done; |
685 | scmd->result = 0; | 665 | scmd->result = 0; |
686 | 666 | ||
687 | cmd = megasas_build_cmd(instance, scmd, &frame_count); | 667 | if (MEGASAS_IS_LOGICAL(scmd) && |
688 | 668 | (scmd->device->id >= MEGASAS_MAX_LD || scmd->device->lun)) { | |
689 | if (!cmd) { | 669 | scmd->result = DID_BAD_TARGET << 16; |
690 | done(scmd); | 670 | goto out_done; |
691 | return 0; | ||
692 | } | 671 | } |
693 | 672 | ||
673 | cmd = megasas_get_cmd(instance); | ||
674 | if (!cmd) | ||
675 | return SCSI_MLQUEUE_HOST_BUSY; | ||
676 | |||
677 | /* | ||
678 | * Logical drive command | ||
679 | */ | ||
680 | if (megasas_is_ldio(scmd)) | ||
681 | frame_count = megasas_build_ldio(instance, scmd, cmd); | ||
682 | else | ||
683 | frame_count = megasas_build_dcdb(instance, scmd, cmd); | ||
684 | |||
685 | if (!frame_count) | ||
686 | goto out_return_cmd; | ||
687 | |||
694 | cmd->scmd = scmd; | 688 | cmd->scmd = scmd; |
695 | scmd->SCp.ptr = (char *)cmd; | 689 | scmd->SCp.ptr = (char *)cmd; |
696 | scmd->SCp.sent_command = jiffies; | 690 | scmd->SCp.sent_command = jiffies; |
@@ -702,10 +696,15 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *)) | |||
702 | instance->fw_outstanding++; | 696 | instance->fw_outstanding++; |
703 | spin_unlock_irqrestore(&instance->instance_lock, flags); | 697 | spin_unlock_irqrestore(&instance->instance_lock, flags); |
704 | 698 | ||
705 | writel(((cmd->frame_phys_addr >> 3) | (cmd->frame_count - 1)), | 699 | instance->instancet->fire_cmd(cmd->frame_phys_addr ,cmd->frame_count-1,instance->reg_set); |
706 | &instance->reg_set->inbound_queue_port); | ||
707 | 700 | ||
708 | return 0; | 701 | return 0; |
702 | |||
703 | out_return_cmd: | ||
704 | megasas_return_cmd(instance, cmd); | ||
705 | out_done: | ||
706 | done(scmd); | ||
707 | return 0; | ||
709 | } | 708 | } |
710 | 709 | ||
711 | /** | 710 | /** |
@@ -1108,7 +1107,6 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd, | |||
1108 | static int | 1107 | static int |
1109 | megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status) | 1108 | megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status) |
1110 | { | 1109 | { |
1111 | u32 status; | ||
1112 | u32 producer; | 1110 | u32 producer; |
1113 | u32 consumer; | 1111 | u32 consumer; |
1114 | u32 context; | 1112 | u32 context; |
@@ -1116,17 +1114,10 @@ megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status) | |||
1116 | 1114 | ||
1117 | /* | 1115 | /* |
1118 | * Check if it is our interrupt | 1116 | * Check if it is our interrupt |
1117 | * Clear the interrupt | ||
1119 | */ | 1118 | */ |
1120 | status = readl(&instance->reg_set->outbound_intr_status); | 1119 | if(instance->instancet->clear_intr(instance->reg_set)) |
1121 | |||
1122 | if (!(status & MFI_OB_INTR_STATUS_MASK)) { | ||
1123 | return IRQ_NONE; | 1120 | return IRQ_NONE; |
1124 | } | ||
1125 | |||
1126 | /* | ||
1127 | * Clear the interrupt by writing back the same value | ||
1128 | */ | ||
1129 | writel(status, &instance->reg_set->outbound_intr_status); | ||
1130 | 1121 | ||
1131 | producer = *instance->producer; | 1122 | producer = *instance->producer; |
1132 | consumer = *instance->consumer; | 1123 | consumer = *instance->consumer; |
@@ -1160,7 +1151,7 @@ static irqreturn_t megasas_isr(int irq, void *devp, struct pt_regs *regs) | |||
1160 | 1151 | ||
1161 | /** | 1152 | /** |
1162 | * megasas_transition_to_ready - Move the FW to READY state | 1153 | * megasas_transition_to_ready - Move the FW to READY state |
1163 | * @reg_set: MFI register set | 1154 | * @instance: Adapter soft state |
1164 | * | 1155 | * |
1165 | * During the initialization, FW passes can potentially be in any one of | 1156 | * During the initialization, FW passes can potentially be in any one of |
1166 | * several possible states. If the FW in operational, waiting-for-handshake | 1157 | * several possible states. If the FW in operational, waiting-for-handshake |
@@ -1168,14 +1159,14 @@ static irqreturn_t megasas_isr(int irq, void *devp, struct pt_regs *regs) | |||
1168 | * has to wait for the ready state. | 1159 | * has to wait for the ready state. |
1169 | */ | 1160 | */ |
1170 | static int | 1161 | static int |
1171 | megasas_transition_to_ready(struct megasas_register_set __iomem * reg_set) | 1162 | megasas_transition_to_ready(struct megasas_instance* instance) |
1172 | { | 1163 | { |
1173 | int i; | 1164 | int i; |
1174 | u8 max_wait; | 1165 | u8 max_wait; |
1175 | u32 fw_state; | 1166 | u32 fw_state; |
1176 | u32 cur_state; | 1167 | u32 cur_state; |
1177 | 1168 | ||
1178 | fw_state = readl(®_set->outbound_msg_0) & MFI_STATE_MASK; | 1169 | fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) & MFI_STATE_MASK; |
1179 | 1170 | ||
1180 | while (fw_state != MFI_STATE_READY) { | 1171 | while (fw_state != MFI_STATE_READY) { |
1181 | 1172 | ||
@@ -1193,7 +1184,7 @@ megasas_transition_to_ready(struct megasas_register_set __iomem * reg_set) | |||
1193 | * Set the CLR bit in inbound doorbell | 1184 | * Set the CLR bit in inbound doorbell |
1194 | */ | 1185 | */ |
1195 | writel(MFI_INIT_CLEAR_HANDSHAKE, | 1186 | writel(MFI_INIT_CLEAR_HANDSHAKE, |
1196 | ®_set->inbound_doorbell); | 1187 | &instance->reg_set->inbound_doorbell); |
1197 | 1188 | ||
1198 | max_wait = 2; | 1189 | max_wait = 2; |
1199 | cur_state = MFI_STATE_WAIT_HANDSHAKE; | 1190 | cur_state = MFI_STATE_WAIT_HANDSHAKE; |
@@ -1203,8 +1194,8 @@ megasas_transition_to_ready(struct megasas_register_set __iomem * reg_set) | |||
1203 | /* | 1194 | /* |
1204 | * Bring it to READY state; assuming max wait 2 secs | 1195 | * Bring it to READY state; assuming max wait 2 secs |
1205 | */ | 1196 | */ |
1206 | megasas_disable_intr(reg_set); | 1197 | megasas_disable_intr(instance->reg_set); |
1207 | writel(MFI_INIT_READY, ®_set->inbound_doorbell); | 1198 | writel(MFI_INIT_READY, &instance->reg_set->inbound_doorbell); |
1208 | 1199 | ||
1209 | max_wait = 10; | 1200 | max_wait = 10; |
1210 | cur_state = MFI_STATE_OPERATIONAL; | 1201 | cur_state = MFI_STATE_OPERATIONAL; |
@@ -1253,8 +1244,8 @@ megasas_transition_to_ready(struct megasas_register_set __iomem * reg_set) | |||
1253 | * The cur_state should not last for more than max_wait secs | 1244 | * The cur_state should not last for more than max_wait secs |
1254 | */ | 1245 | */ |
1255 | for (i = 0; i < (max_wait * 1000); i++) { | 1246 | for (i = 0; i < (max_wait * 1000); i++) { |
1256 | fw_state = MFI_STATE_MASK & | 1247 | fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) & |
1257 | readl(®_set->outbound_msg_0); | 1248 | MFI_STATE_MASK ; |
1258 | 1249 | ||
1259 | if (fw_state == cur_state) { | 1250 | if (fw_state == cur_state) { |
1260 | msleep(1); | 1251 | msleep(1); |
@@ -1616,18 +1607,20 @@ static int megasas_init_mfi(struct megasas_instance *instance) | |||
1616 | 1607 | ||
1617 | reg_set = instance->reg_set; | 1608 | reg_set = instance->reg_set; |
1618 | 1609 | ||
1610 | instance->instancet = &megasas_instance_template_xscale; | ||
1611 | |||
1619 | /* | 1612 | /* |
1620 | * We expect the FW state to be READY | 1613 | * We expect the FW state to be READY |
1621 | */ | 1614 | */ |
1622 | if (megasas_transition_to_ready(instance->reg_set)) | 1615 | if (megasas_transition_to_ready(instance)) |
1623 | goto fail_ready_state; | 1616 | goto fail_ready_state; |
1624 | 1617 | ||
1625 | /* | 1618 | /* |
1626 | * Get various operational parameters from status register | 1619 | * Get various operational parameters from status register |
1627 | */ | 1620 | */ |
1628 | instance->max_fw_cmds = readl(®_set->outbound_msg_0) & 0x00FFFF; | 1621 | instance->max_fw_cmds = instance->instancet->read_fw_status_reg(reg_set) & 0x00FFFF; |
1629 | instance->max_num_sge = (readl(®_set->outbound_msg_0) & 0xFF0000) >> | 1622 | instance->max_num_sge = (instance->instancet->read_fw_status_reg(reg_set) & 0xFF0000) >> |
1630 | 0x10; | 1623 | 0x10; |
1631 | /* | 1624 | /* |
1632 | * Create a pool of commands | 1625 | * Create a pool of commands |
1633 | */ | 1626 | */ |
@@ -1936,8 +1929,7 @@ megasas_register_aen(struct megasas_instance *instance, u32 seq_num, | |||
1936 | /* | 1929 | /* |
1937 | * Issue the aen registration frame | 1930 | * Issue the aen registration frame |
1938 | */ | 1931 | */ |
1939 | writel(cmd->frame_phys_addr >> 3, | 1932 | instance->instancet->fire_cmd(cmd->frame_phys_addr ,0,instance->reg_set); |
1940 | &instance->reg_set->inbound_queue_port); | ||
1941 | 1933 | ||
1942 | return 0; | 1934 | return 0; |
1943 | } | 1935 | } |
@@ -2126,7 +2118,7 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
2126 | goto fail_irq; | 2118 | goto fail_irq; |
2127 | } | 2119 | } |
2128 | 2120 | ||
2129 | megasas_enable_intr(instance->reg_set); | 2121 | instance->instancet->enable_intr(instance->reg_set); |
2130 | 2122 | ||
2131 | /* | 2123 | /* |
2132 | * Store instance in PCI softstate | 2124 | * Store instance in PCI softstate |
@@ -2681,9 +2673,8 @@ megasas_mgmt_compat_ioctl(struct file *file, unsigned int cmd, | |||
2681 | unsigned long arg) | 2673 | unsigned long arg) |
2682 | { | 2674 | { |
2683 | switch (cmd) { | 2675 | switch (cmd) { |
2684 | case MEGASAS_IOC_FIRMWARE:{ | 2676 | case MEGASAS_IOC_FIRMWARE32: |
2685 | return megasas_mgmt_compat_ioctl_fw(file, arg); | 2677 | return megasas_mgmt_compat_ioctl_fw(file, arg); |
2686 | } | ||
2687 | case MEGASAS_IOC_GET_AEN: | 2678 | case MEGASAS_IOC_GET_AEN: |
2688 | return megasas_mgmt_ioctl_aen(file, arg); | 2679 | return megasas_mgmt_ioctl_aen(file, arg); |
2689 | } | 2680 | } |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index eaec9d531424..d6d166c0663f 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -18,10 +18,9 @@ | |||
18 | /** | 18 | /** |
19 | * MegaRAID SAS Driver meta data | 19 | * MegaRAID SAS Driver meta data |
20 | */ | 20 | */ |
21 | #define MEGASAS_VERSION "00.00.02.00-rc4" | 21 | #define MEGASAS_VERSION "00.00.02.02" |
22 | #define MEGASAS_RELDATE "Sep 16, 2005" | 22 | #define MEGASAS_RELDATE "Jan 23, 2006" |
23 | #define MEGASAS_EXT_VERSION "Fri Sep 16 12:37:08 EDT 2005" | 23 | #define MEGASAS_EXT_VERSION "Mon Jan 23 14:09:01 PST 2006" |
24 | |||
25 | /* | 24 | /* |
26 | * ===================================== | 25 | * ===================================== |
27 | * MegaRAID SAS MFI firmware definitions | 26 | * MegaRAID SAS MFI firmware definitions |
@@ -1013,6 +1012,16 @@ struct megasas_evt_detail { | |||
1013 | 1012 | ||
1014 | } __attribute__ ((packed)); | 1013 | } __attribute__ ((packed)); |
1015 | 1014 | ||
1015 | struct megasas_instance_template { | ||
1016 | void (*fire_cmd)(dma_addr_t ,u32 ,struct megasas_register_set __iomem *); | ||
1017 | |||
1018 | void (*enable_intr)(struct megasas_register_set __iomem *) ; | ||
1019 | |||
1020 | int (*clear_intr)(struct megasas_register_set __iomem *); | ||
1021 | |||
1022 | u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); | ||
1023 | }; | ||
1024 | |||
1016 | struct megasas_instance { | 1025 | struct megasas_instance { |
1017 | 1026 | ||
1018 | u32 *producer; | 1027 | u32 *producer; |
@@ -1056,6 +1065,8 @@ struct megasas_instance { | |||
1056 | u32 fw_outstanding; | 1065 | u32 fw_outstanding; |
1057 | u32 hw_crit_error; | 1066 | u32 hw_crit_error; |
1058 | spinlock_t instance_lock; | 1067 | spinlock_t instance_lock; |
1068 | |||
1069 | struct megasas_instance_template *instancet; | ||
1059 | }; | 1070 | }; |
1060 | 1071 | ||
1061 | #define MEGASAS_IS_LOGICAL(scp) \ | 1072 | #define MEGASAS_IS_LOGICAL(scp) \ |
@@ -1125,11 +1136,10 @@ struct compat_megasas_iocpacket { | |||
1125 | struct compat_iovec sgl[MAX_IOCTL_SGE]; | 1136 | struct compat_iovec sgl[MAX_IOCTL_SGE]; |
1126 | } __attribute__ ((packed)); | 1137 | } __attribute__ ((packed)); |
1127 | 1138 | ||
1128 | #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct compat_megasas_iocpacket) | ||
1129 | #else | ||
1130 | #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket) | ||
1131 | #endif | 1139 | #endif |
1132 | 1140 | ||
1141 | #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket) | ||
1142 | #define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket) | ||
1133 | #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen) | 1143 | #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen) |
1134 | 1144 | ||
1135 | struct megasas_mgmt_info { | 1145 | struct megasas_mgmt_info { |
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 0878f95b5449..e0230249fa0f 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c | |||
@@ -17,9 +17,11 @@ | |||
17 | * General Public License for more details. | 17 | * General Public License for more details. |
18 | * | 18 | * |
19 | ******************************************************************************/ | 19 | ******************************************************************************/ |
20 | #define QLA1280_VERSION "3.25" | 20 | #define QLA1280_VERSION "3.26" |
21 | /***************************************************************************** | 21 | /***************************************************************************** |
22 | Revision History: | 22 | Revision History: |
23 | Rev 3.26, January 16, 2006 Jes Sorensen | ||
24 | - Ditch all < 2.6 support | ||
23 | Rev 3.25.1, February 10, 2005 Christoph Hellwig | 25 | Rev 3.25.1, February 10, 2005 Christoph Hellwig |
24 | - use pci_map_single to map non-S/G requests | 26 | - use pci_map_single to map non-S/G requests |
25 | - remove qla1280_proc_info | 27 | - remove qla1280_proc_info |
@@ -356,25 +358,18 @@ | |||
356 | #include <asm/types.h> | 358 | #include <asm/types.h> |
357 | #include <asm/system.h> | 359 | #include <asm/system.h> |
358 | 360 | ||
359 | #if LINUX_VERSION_CODE >= 0x020545 | ||
360 | #include <scsi/scsi.h> | 361 | #include <scsi/scsi.h> |
361 | #include <scsi/scsi_cmnd.h> | 362 | #include <scsi/scsi_cmnd.h> |
362 | #include <scsi/scsi_device.h> | 363 | #include <scsi/scsi_device.h> |
363 | #include <scsi/scsi_host.h> | 364 | #include <scsi/scsi_host.h> |
364 | #include <scsi/scsi_tcq.h> | 365 | #include <scsi/scsi_tcq.h> |
365 | #else | ||
366 | #include <linux/blk.h> | ||
367 | #include "scsi.h" | ||
368 | #include <scsi/scsi_host.h> | ||
369 | #include "sd.h" | ||
370 | #endif | ||
371 | 366 | ||
372 | #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) | 367 | #if defined(CONFIG_IA64_GENERIC) || defined(CONFIG_IA64_SGI_SN2) |
373 | #include <asm/sn/io.h> | 368 | #include <asm/sn/io.h> |
374 | #endif | 369 | #endif |
375 | 370 | ||
376 | #if LINUX_VERSION_CODE < 0x020407 | 371 | #if LINUX_VERSION_CODE < 0x020600 |
377 | #error "Kernels older than 2.4.7 are no longer supported" | 372 | #error "Kernels older than 2.6.0 are no longer supported" |
378 | #endif | 373 | #endif |
379 | 374 | ||
380 | 375 | ||
@@ -441,52 +436,6 @@ | |||
441 | 436 | ||
442 | #define NVRAM_DELAY() udelay(500) /* 2 microseconds */ | 437 | #define NVRAM_DELAY() udelay(500) /* 2 microseconds */ |
443 | 438 | ||
444 | #if LINUX_VERSION_CODE < 0x020500 | ||
445 | #define HOST_LOCK &io_request_lock | ||
446 | #define irqreturn_t void | ||
447 | #define IRQ_RETVAL(foo) | ||
448 | #define MSG_ORDERED_TAG 1 | ||
449 | |||
450 | #define DMA_BIDIRECTIONAL SCSI_DATA_UNKNOWN | ||
451 | #define DMA_TO_DEVICE SCSI_DATA_WRITE | ||
452 | #define DMA_FROM_DEVICE SCSI_DATA_READ | ||
453 | #define DMA_NONE SCSI_DATA_NONE | ||
454 | |||
455 | #ifndef HAVE_SECTOR_T | ||
456 | typedef unsigned int sector_t; | ||
457 | #endif | ||
458 | |||
459 | static inline void | ||
460 | scsi_adjust_queue_depth(struct scsi_device *device, int tag, int depth) | ||
461 | { | ||
462 | if (tag) { | ||
463 | device->tagged_queue = tag; | ||
464 | device->current_tag = 0; | ||
465 | } | ||
466 | device->queue_depth = depth; | ||
467 | } | ||
468 | static inline struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *t, size_t s) | ||
469 | { | ||
470 | return scsi_register(t, s); | ||
471 | } | ||
472 | static inline void scsi_host_put(struct Scsi_Host *h) | ||
473 | { | ||
474 | scsi_unregister(h); | ||
475 | } | ||
476 | #else | ||
477 | #define HOST_LOCK ha->host->host_lock | ||
478 | #endif | ||
479 | #if LINUX_VERSION_CODE < 0x020600 | ||
480 | #define DEV_SIMPLE_TAGS(device) device->tagged_queue | ||
481 | /* | ||
482 | * Hack around that qla1280_remove_one is called from | ||
483 | * qla1280_release in 2.4 | ||
484 | */ | ||
485 | #undef __devexit | ||
486 | #define __devexit | ||
487 | #else | ||
488 | #define DEV_SIMPLE_TAGS(device) device->simple_tags | ||
489 | #endif | ||
490 | #if defined(__ia64__) && !defined(ia64_platform_is) | 439 | #if defined(__ia64__) && !defined(ia64_platform_is) |
491 | #define ia64_platform_is(foo) (!strcmp(x, platform_name)) | 440 | #define ia64_platform_is(foo) (!strcmp(x, platform_name)) |
492 | #endif | 441 | #endif |
@@ -506,9 +455,6 @@ static void qla1280_remove_one(struct pci_dev *); | |||
506 | * QLogic Driver Support Function Prototypes. | 455 | * QLogic Driver Support Function Prototypes. |
507 | */ | 456 | */ |
508 | static void qla1280_done(struct scsi_qla_host *); | 457 | static void qla1280_done(struct scsi_qla_host *); |
509 | #if LINUX_VERSION_CODE < 0x020545 | ||
510 | static void qla1280_get_target_options(struct scsi_cmnd *, struct scsi_qla_host *); | ||
511 | #endif | ||
512 | static int qla1280_get_token(char *); | 458 | static int qla1280_get_token(char *); |
513 | static int qla1280_setup(char *s) __init; | 459 | static int qla1280_setup(char *s) __init; |
514 | 460 | ||
@@ -610,11 +556,7 @@ __setup("qla1280=", qla1280_setup); | |||
610 | #define CMD_SNSLEN(Cmnd) sizeof(Cmnd->sense_buffer) | 556 | #define CMD_SNSLEN(Cmnd) sizeof(Cmnd->sense_buffer) |
611 | #define CMD_RESULT(Cmnd) Cmnd->result | 557 | #define CMD_RESULT(Cmnd) Cmnd->result |
612 | #define CMD_HANDLE(Cmnd) Cmnd->host_scribble | 558 | #define CMD_HANDLE(Cmnd) Cmnd->host_scribble |
613 | #if LINUX_VERSION_CODE < 0x020545 | ||
614 | #define CMD_REQUEST(Cmnd) Cmnd->request.cmd | ||
615 | #else | ||
616 | #define CMD_REQUEST(Cmnd) Cmnd->request->cmd | 559 | #define CMD_REQUEST(Cmnd) Cmnd->request->cmd |
617 | #endif | ||
618 | 560 | ||
619 | #define CMD_HOST(Cmnd) Cmnd->device->host | 561 | #define CMD_HOST(Cmnd) Cmnd->device->host |
620 | #define SCSI_BUS_32(Cmnd) Cmnd->device->channel | 562 | #define SCSI_BUS_32(Cmnd) Cmnd->device->channel |
@@ -1064,10 +1006,10 @@ qla1280_error_action(struct scsi_cmnd *cmd, enum action action) | |||
1064 | add_timer(&timer); | 1006 | add_timer(&timer); |
1065 | 1007 | ||
1066 | /* wait for the action to complete (or the timer to expire) */ | 1008 | /* wait for the action to complete (or the timer to expire) */ |
1067 | spin_unlock_irq(HOST_LOCK); | 1009 | spin_unlock_irq(ha->host->host_lock); |
1068 | wait_for_completion(&wait); | 1010 | wait_for_completion(&wait); |
1069 | del_timer_sync(&timer); | 1011 | del_timer_sync(&timer); |
1070 | spin_lock_irq(HOST_LOCK); | 1012 | spin_lock_irq(ha->host->host_lock); |
1071 | sp->wait = NULL; | 1013 | sp->wait = NULL; |
1072 | 1014 | ||
1073 | /* the only action we might get a fail for is abort */ | 1015 | /* the only action we might get a fail for is abort */ |
@@ -1173,96 +1115,6 @@ qla1280_biosparam(struct scsi_device *sdev, struct block_device *bdev, | |||
1173 | return 0; | 1115 | return 0; |
1174 | } | 1116 | } |
1175 | 1117 | ||
1176 | #if LINUX_VERSION_CODE < 0x020600 | ||
1177 | static int | ||
1178 | qla1280_detect(struct scsi_host_template *template) | ||
1179 | { | ||
1180 | struct pci_device_id *id = &qla1280_pci_tbl[0]; | ||
1181 | struct pci_dev *pdev = NULL; | ||
1182 | int num_hosts = 0; | ||
1183 | |||
1184 | if (sizeof(struct srb) > sizeof(Scsi_Pointer)) { | ||
1185 | printk(KERN_WARNING | ||
1186 | "qla1280: struct srb too big, aborting\n"); | ||
1187 | return 0; | ||
1188 | } | ||
1189 | |||
1190 | if ((DMA_BIDIRECTIONAL != PCI_DMA_BIDIRECTIONAL) || | ||
1191 | (DMA_TO_DEVICE != PCI_DMA_TODEVICE) || | ||
1192 | (DMA_FROM_DEVICE != PCI_DMA_FROMDEVICE) || | ||
1193 | (DMA_NONE != PCI_DMA_NONE)) { | ||
1194 | printk(KERN_WARNING | ||
1195 | "qla1280: dma direction bits don't match\n"); | ||
1196 | return 0; | ||
1197 | } | ||
1198 | |||
1199 | #ifdef MODULE | ||
1200 | /* | ||
1201 | * If we are called as a module, the qla1280 pointer may not be null | ||
1202 | * and it would point to our bootup string, just like on the lilo | ||
1203 | * command line. IF not NULL, then process this config string with | ||
1204 | * qla1280_setup | ||
1205 | * | ||
1206 | * Boot time Options | ||
1207 | * To add options at boot time add a line to your lilo.conf file like: | ||
1208 | * append="qla1280=verbose,max_tags:{{255,255,255,255},{255,255,255,255}}" | ||
1209 | * which will result in the first four devices on the first two | ||
1210 | * controllers being set to a tagged queue depth of 32. | ||
1211 | */ | ||
1212 | if (qla1280) | ||
1213 | qla1280_setup(qla1280); | ||
1214 | #endif | ||
1215 | |||
1216 | /* First Initialize QLA12160 on PCI Bus 1 Dev 2 */ | ||
1217 | while ((pdev = pci_find_device(id->vendor, id->device, pdev))) { | ||
1218 | if (pdev->bus->number == 1 && PCI_SLOT(pdev->devfn) == 2) { | ||
1219 | if (!qla1280_probe_one(pdev, id)) | ||
1220 | num_hosts++; | ||
1221 | } | ||
1222 | } | ||
1223 | |||
1224 | pdev = NULL; | ||
1225 | /* Try and find each different type of adapter we support */ | ||
1226 | for (id = &qla1280_pci_tbl[0]; id->device; id++) { | ||
1227 | while ((pdev = pci_find_device(id->vendor, id->device, pdev))) { | ||
1228 | /* | ||
1229 | * skip QLA12160 already initialized on | ||
1230 | * PCI Bus 1 Dev 2 since we already initialized | ||
1231 | * and presented it | ||
1232 | */ | ||
1233 | if (id->device == PCI_DEVICE_ID_QLOGIC_ISP12160 && | ||
1234 | pdev->bus->number == 1 && | ||
1235 | PCI_SLOT(pdev->devfn) == 2) | ||
1236 | continue; | ||
1237 | |||
1238 | if (!qla1280_probe_one(pdev, id)) | ||
1239 | num_hosts++; | ||
1240 | } | ||
1241 | } | ||
1242 | |||
1243 | return num_hosts; | ||
1244 | } | ||
1245 | |||
1246 | /* | ||
1247 | * This looks a bit ugly as we could just pass down host to | ||
1248 | * qla1280_remove_one, but I want to keep qla1280_release purely a wrapper | ||
1249 | * around pci_driver::remove as used from 2.6 onwards. | ||
1250 | */ | ||
1251 | static int | ||
1252 | qla1280_release(struct Scsi_Host *host) | ||
1253 | { | ||
1254 | struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; | ||
1255 | |||
1256 | qla1280_remove_one(ha->pdev); | ||
1257 | return 0; | ||
1258 | } | ||
1259 | |||
1260 | static int | ||
1261 | qla1280_biosparam_old(Disk * disk, kdev_t dev, int geom[]) | ||
1262 | { | ||
1263 | return qla1280_biosparam(disk->device, NULL, disk->capacity, geom); | ||
1264 | } | ||
1265 | #endif | ||
1266 | 1118 | ||
1267 | /* disable risc and host interrupts */ | 1119 | /* disable risc and host interrupts */ |
1268 | static inline void | 1120 | static inline void |
@@ -1295,7 +1147,7 @@ qla1280_intr_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
1295 | ENTER_INTR ("qla1280_intr_handler"); | 1147 | ENTER_INTR ("qla1280_intr_handler"); |
1296 | ha = (struct scsi_qla_host *)dev_id; | 1148 | ha = (struct scsi_qla_host *)dev_id; |
1297 | 1149 | ||
1298 | spin_lock(HOST_LOCK); | 1150 | spin_lock(ha->host->host_lock); |
1299 | 1151 | ||
1300 | ha->isr_count++; | 1152 | ha->isr_count++; |
1301 | reg = ha->iobase; | 1153 | reg = ha->iobase; |
@@ -1311,7 +1163,7 @@ qla1280_intr_handler(int irq, void *dev_id, struct pt_regs *regs) | |||
1311 | if (!list_empty(&ha->done_q)) | 1163 | if (!list_empty(&ha->done_q)) |
1312 | qla1280_done(ha); | 1164 | qla1280_done(ha); |
1313 | 1165 | ||
1314 | spin_unlock(HOST_LOCK); | 1166 | spin_unlock(ha->host->host_lock); |
1315 | 1167 | ||
1316 | qla1280_enable_intrs(ha); | 1168 | qla1280_enable_intrs(ha); |
1317 | 1169 | ||
@@ -1411,11 +1263,9 @@ qla1280_slave_configure(struct scsi_device *device) | |||
1411 | scsi_adjust_queue_depth(device, 0, default_depth); | 1263 | scsi_adjust_queue_depth(device, 0, default_depth); |
1412 | } | 1264 | } |
1413 | 1265 | ||
1414 | #if LINUX_VERSION_CODE > 0x020500 | ||
1415 | nv->bus[bus].target[target].parameter.enable_sync = device->sdtr; | 1266 | nv->bus[bus].target[target].parameter.enable_sync = device->sdtr; |
1416 | nv->bus[bus].target[target].parameter.enable_wide = device->wdtr; | 1267 | nv->bus[bus].target[target].parameter.enable_wide = device->wdtr; |
1417 | nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = device->ppr; | 1268 | nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = device->ppr; |
1418 | #endif | ||
1419 | 1269 | ||
1420 | if (driver_setup.no_sync || | 1270 | if (driver_setup.no_sync || |
1421 | (driver_setup.sync_mask && | 1271 | (driver_setup.sync_mask && |
@@ -1432,38 +1282,14 @@ qla1280_slave_configure(struct scsi_device *device) | |||
1432 | nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 0; | 1282 | nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 0; |
1433 | } | 1283 | } |
1434 | 1284 | ||
1435 | spin_lock_irqsave(HOST_LOCK, flags); | 1285 | spin_lock_irqsave(ha->host->host_lock, flags); |
1436 | if (nv->bus[bus].target[target].parameter.enable_sync) | 1286 | if (nv->bus[bus].target[target].parameter.enable_sync) |
1437 | status = qla1280_set_target_parameters(ha, bus, target); | 1287 | status = qla1280_set_target_parameters(ha, bus, target); |
1438 | qla1280_get_target_parameters(ha, device); | 1288 | qla1280_get_target_parameters(ha, device); |
1439 | spin_unlock_irqrestore(HOST_LOCK, flags); | 1289 | spin_unlock_irqrestore(ha->host->host_lock, flags); |
1440 | return status; | 1290 | return status; |
1441 | } | 1291 | } |
1442 | 1292 | ||
1443 | #if LINUX_VERSION_CODE < 0x020545 | ||
1444 | /************************************************************************** | ||
1445 | * qla1280_select_queue_depth | ||
1446 | * | ||
1447 | * Sets the queue depth for each SCSI device hanging off the input | ||
1448 | * host adapter. We use a queue depth of 2 for devices that do not | ||
1449 | * support tagged queueing. | ||
1450 | **************************************************************************/ | ||
1451 | static void | ||
1452 | qla1280_select_queue_depth(struct Scsi_Host *host, struct scsi_device *sdev_q) | ||
1453 | { | ||
1454 | struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; | ||
1455 | struct scsi_device *sdev; | ||
1456 | |||
1457 | ENTER("qla1280_select_queue_depth"); | ||
1458 | for (sdev = sdev_q; sdev; sdev = sdev->next) | ||
1459 | if (sdev->host == host) | ||
1460 | qla1280_slave_configure(sdev); | ||
1461 | |||
1462 | if (sdev_q) | ||
1463 | qla1280_check_for_dead_scsi_bus(ha, sdev_q->channel); | ||
1464 | LEAVE("qla1280_select_queue_depth"); | ||
1465 | } | ||
1466 | #endif | ||
1467 | 1293 | ||
1468 | /* | 1294 | /* |
1469 | * qla1280_done | 1295 | * qla1280_done |
@@ -1523,10 +1349,6 @@ qla1280_done(struct scsi_qla_host *ha) | |||
1523 | CMD_HANDLE(sp->cmd) = (unsigned char *)INVALID_HANDLE; | 1349 | CMD_HANDLE(sp->cmd) = (unsigned char *)INVALID_HANDLE; |
1524 | ha->actthreads--; | 1350 | ha->actthreads--; |
1525 | 1351 | ||
1526 | #if LINUX_VERSION_CODE < 0x020500 | ||
1527 | if (cmd->cmnd[0] == INQUIRY) | ||
1528 | qla1280_get_target_options(cmd, ha); | ||
1529 | #endif | ||
1530 | (*(cmd)->scsi_done)(cmd); | 1352 | (*(cmd)->scsi_done)(cmd); |
1531 | 1353 | ||
1532 | if(sp->wait != NULL) | 1354 | if(sp->wait != NULL) |
@@ -1655,9 +1477,7 @@ qla1280_initialize_adapter(struct scsi_qla_host *ha) | |||
1655 | struct device_reg __iomem *reg; | 1477 | struct device_reg __iomem *reg; |
1656 | int status; | 1478 | int status; |
1657 | int bus; | 1479 | int bus; |
1658 | #if LINUX_VERSION_CODE > 0x020500 | ||
1659 | unsigned long flags; | 1480 | unsigned long flags; |
1660 | #endif | ||
1661 | 1481 | ||
1662 | ENTER("qla1280_initialize_adapter"); | 1482 | ENTER("qla1280_initialize_adapter"); |
1663 | 1483 | ||
@@ -1695,15 +1515,12 @@ qla1280_initialize_adapter(struct scsi_qla_host *ha) | |||
1695 | "NVRAM\n"); | 1515 | "NVRAM\n"); |
1696 | } | 1516 | } |
1697 | 1517 | ||
1698 | #if LINUX_VERSION_CODE >= 0x020500 | ||
1699 | /* | 1518 | /* |
1700 | * It's necessary to grab the spin here as qla1280_mailbox_command | 1519 | * It's necessary to grab the spin here as qla1280_mailbox_command |
1701 | * needs to be able to drop the lock unconditionally to wait | 1520 | * needs to be able to drop the lock unconditionally to wait |
1702 | * for completion. | 1521 | * for completion. |
1703 | * In 2.4 ->detect is called with the io_request_lock held. | ||
1704 | */ | 1522 | */ |
1705 | spin_lock_irqsave(HOST_LOCK, flags); | 1523 | spin_lock_irqsave(ha->host->host_lock, flags); |
1706 | #endif | ||
1707 | 1524 | ||
1708 | status = qla1280_load_firmware(ha); | 1525 | status = qla1280_load_firmware(ha); |
1709 | if (status) { | 1526 | if (status) { |
@@ -1735,9 +1552,8 @@ qla1280_initialize_adapter(struct scsi_qla_host *ha) | |||
1735 | 1552 | ||
1736 | ha->flags.online = 1; | 1553 | ha->flags.online = 1; |
1737 | out: | 1554 | out: |
1738 | #if LINUX_VERSION_CODE >= 0x020500 | 1555 | spin_unlock_irqrestore(ha->host->host_lock, flags); |
1739 | spin_unlock_irqrestore(HOST_LOCK, flags); | 1556 | |
1740 | #endif | ||
1741 | if (status) | 1557 | if (status) |
1742 | dprintk(2, "qla1280_initialize_adapter: **** FAILED ****\n"); | 1558 | dprintk(2, "qla1280_initialize_adapter: **** FAILED ****\n"); |
1743 | 1559 | ||
@@ -2650,14 +2466,14 @@ qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb) | |||
2650 | timer.function = qla1280_mailbox_timeout; | 2466 | timer.function = qla1280_mailbox_timeout; |
2651 | add_timer(&timer); | 2467 | add_timer(&timer); |
2652 | 2468 | ||
2653 | spin_unlock_irq(HOST_LOCK); | 2469 | spin_unlock_irq(ha->host->host_lock); |
2654 | WRT_REG_WORD(®->host_cmd, HC_SET_HOST_INT); | 2470 | WRT_REG_WORD(®->host_cmd, HC_SET_HOST_INT); |
2655 | data = qla1280_debounce_register(®->istatus); | 2471 | data = qla1280_debounce_register(®->istatus); |
2656 | 2472 | ||
2657 | wait_for_completion(&wait); | 2473 | wait_for_completion(&wait); |
2658 | del_timer_sync(&timer); | 2474 | del_timer_sync(&timer); |
2659 | 2475 | ||
2660 | spin_lock_irq(HOST_LOCK); | 2476 | spin_lock_irq(ha->host->host_lock); |
2661 | 2477 | ||
2662 | ha->mailbox_wait = NULL; | 2478 | ha->mailbox_wait = NULL; |
2663 | 2479 | ||
@@ -2770,9 +2586,9 @@ qla1280_bus_reset(struct scsi_qla_host *ha, int bus) | |||
2770 | ha->bus_settings[bus].scsi_bus_dead = 1; | 2586 | ha->bus_settings[bus].scsi_bus_dead = 1; |
2771 | ha->bus_settings[bus].failed_reset_count++; | 2587 | ha->bus_settings[bus].failed_reset_count++; |
2772 | } else { | 2588 | } else { |
2773 | spin_unlock_irq(HOST_LOCK); | 2589 | spin_unlock_irq(ha->host->host_lock); |
2774 | ssleep(reset_delay); | 2590 | ssleep(reset_delay); |
2775 | spin_lock_irq(HOST_LOCK); | 2591 | spin_lock_irq(ha->host->host_lock); |
2776 | 2592 | ||
2777 | ha->bus_settings[bus].scsi_bus_dead = 0; | 2593 | ha->bus_settings[bus].scsi_bus_dead = 0; |
2778 | ha->bus_settings[bus].failed_reset_count = 0; | 2594 | ha->bus_settings[bus].failed_reset_count = 0; |
@@ -3078,7 +2894,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
3078 | (SCSI_TCN_32(cmd) | BIT_7) : SCSI_TCN_32(cmd); | 2894 | (SCSI_TCN_32(cmd) | BIT_7) : SCSI_TCN_32(cmd); |
3079 | 2895 | ||
3080 | /* Enable simple tag queuing if device supports it. */ | 2896 | /* Enable simple tag queuing if device supports it. */ |
3081 | if (DEV_SIMPLE_TAGS(cmd->device)) | 2897 | if (cmd->device->simple_tags) |
3082 | pkt->control_flags |= cpu_to_le16(BIT_3); | 2898 | pkt->control_flags |= cpu_to_le16(BIT_3); |
3083 | 2899 | ||
3084 | /* Load SCSI command packet. */ | 2900 | /* Load SCSI command packet. */ |
@@ -3377,7 +3193,7 @@ qla1280_32bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) | |||
3377 | (SCSI_TCN_32(cmd) | BIT_7) : SCSI_TCN_32(cmd); | 3193 | (SCSI_TCN_32(cmd) | BIT_7) : SCSI_TCN_32(cmd); |
3378 | 3194 | ||
3379 | /* Enable simple tag queuing if device supports it. */ | 3195 | /* Enable simple tag queuing if device supports it. */ |
3380 | if (DEV_SIMPLE_TAGS(cmd->device)) | 3196 | if (cmd->device->simple_tags) |
3381 | pkt->control_flags |= cpu_to_le16(BIT_3); | 3197 | pkt->control_flags |= cpu_to_le16(BIT_3); |
3382 | 3198 | ||
3383 | /* Load SCSI command packet. */ | 3199 | /* Load SCSI command packet. */ |
@@ -3889,50 +3705,6 @@ qla1280_rst_aen(struct scsi_qla_host *ha) | |||
3889 | } | 3705 | } |
3890 | 3706 | ||
3891 | 3707 | ||
3892 | #if LINUX_VERSION_CODE < 0x020500 | ||
3893 | /* | ||
3894 | * | ||
3895 | */ | ||
3896 | static void | ||
3897 | qla1280_get_target_options(struct scsi_cmnd *cmd, struct scsi_qla_host *ha) | ||
3898 | { | ||
3899 | unsigned char *result; | ||
3900 | struct nvram *n; | ||
3901 | int bus, target, lun; | ||
3902 | |||
3903 | bus = SCSI_BUS_32(cmd); | ||
3904 | target = SCSI_TCN_32(cmd); | ||
3905 | lun = SCSI_LUN_32(cmd); | ||
3906 | |||
3907 | /* | ||
3908 | * Make sure to not touch anything if someone is using the | ||
3909 | * sg interface. | ||
3910 | */ | ||
3911 | if (cmd->use_sg || (CMD_RESULT(cmd) >> 16) != DID_OK || lun) | ||
3912 | return; | ||
3913 | |||
3914 | result = cmd->request_buffer; | ||
3915 | n = &ha->nvram; | ||
3916 | |||
3917 | n->bus[bus].target[target].parameter.enable_wide = 0; | ||
3918 | n->bus[bus].target[target].parameter.enable_sync = 0; | ||
3919 | n->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 0; | ||
3920 | |||
3921 | if (result[7] & 0x60) | ||
3922 | n->bus[bus].target[target].parameter.enable_wide = 1; | ||
3923 | if (result[7] & 0x10) | ||
3924 | n->bus[bus].target[target].parameter.enable_sync = 1; | ||
3925 | if ((result[2] >= 3) && (result[4] + 5 > 56) && | ||
3926 | (result[56] & 0x4)) | ||
3927 | n->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 1; | ||
3928 | |||
3929 | dprintk(2, "get_target_options(): wide %i, sync %i, ppr %i\n", | ||
3930 | n->bus[bus].target[target].parameter.enable_wide, | ||
3931 | n->bus[bus].target[target].parameter.enable_sync, | ||
3932 | n->bus[bus].target[target].ppr_1x160.flags.enable_ppr); | ||
3933 | } | ||
3934 | #endif | ||
3935 | |||
3936 | /* | 3708 | /* |
3937 | * qla1280_status_entry | 3709 | * qla1280_status_entry |
3938 | * Processes received ISP status entry. | 3710 | * Processes received ISP status entry. |
@@ -4271,7 +4043,7 @@ qla1280_get_target_parameters(struct scsi_qla_host *ha, | |||
4271 | } else | 4043 | } else |
4272 | printk(" Async"); | 4044 | printk(" Async"); |
4273 | 4045 | ||
4274 | if (DEV_SIMPLE_TAGS(device)) | 4046 | if (device->simple_tags) |
4275 | printk(", Tagged queuing: depth %d", device->queue_depth); | 4047 | printk(", Tagged queuing: depth %d", device->queue_depth); |
4276 | printk("\n"); | 4048 | printk("\n"); |
4277 | } | 4049 | } |
@@ -4485,7 +4257,7 @@ qla1280_get_token(char *str) | |||
4485 | return ret; | 4257 | return ret; |
4486 | } | 4258 | } |
4487 | 4259 | ||
4488 | #if LINUX_VERSION_CODE >= 0x020600 | 4260 | |
4489 | static struct scsi_host_template qla1280_driver_template = { | 4261 | static struct scsi_host_template qla1280_driver_template = { |
4490 | .module = THIS_MODULE, | 4262 | .module = THIS_MODULE, |
4491 | .proc_name = "qla1280", | 4263 | .proc_name = "qla1280", |
@@ -4504,27 +4276,7 @@ static struct scsi_host_template qla1280_driver_template = { | |||
4504 | .cmd_per_lun = 1, | 4276 | .cmd_per_lun = 1, |
4505 | .use_clustering = ENABLE_CLUSTERING, | 4277 | .use_clustering = ENABLE_CLUSTERING, |
4506 | }; | 4278 | }; |
4507 | #else | 4279 | |
4508 | static struct scsi_host_template qla1280_driver_template = { | ||
4509 | .proc_name = "qla1280", | ||
4510 | .name = "Qlogic ISP 1280/12160", | ||
4511 | .detect = qla1280_detect, | ||
4512 | .release = qla1280_release, | ||
4513 | .info = qla1280_info, | ||
4514 | .queuecommand = qla1280_queuecommand, | ||
4515 | .eh_abort_handler = qla1280_eh_abort, | ||
4516 | .eh_device_reset_handler= qla1280_eh_device_reset, | ||
4517 | .eh_bus_reset_handler = qla1280_eh_bus_reset, | ||
4518 | .eh_host_reset_handler = qla1280_eh_adapter_reset, | ||
4519 | .bios_param = qla1280_biosparam_old, | ||
4520 | .can_queue = 0xfffff, | ||
4521 | .this_id = -1, | ||
4522 | .sg_tablesize = SG_ALL, | ||
4523 | .cmd_per_lun = 1, | ||
4524 | .use_clustering = ENABLE_CLUSTERING, | ||
4525 | .use_new_eh_code = 1, | ||
4526 | }; | ||
4527 | #endif | ||
4528 | 4280 | ||
4529 | static int __devinit | 4281 | static int __devinit |
4530 | qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | 4282 | qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) |
@@ -4615,10 +4367,6 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
4615 | host->max_sectors = 1024; | 4367 | host->max_sectors = 1024; |
4616 | host->unique_id = host->host_no; | 4368 | host->unique_id = host->host_no; |
4617 | 4369 | ||
4618 | #if LINUX_VERSION_CODE < 0x020545 | ||
4619 | host->select_queue_depths = qla1280_select_queue_depth; | ||
4620 | #endif | ||
4621 | |||
4622 | error = -ENODEV; | 4370 | error = -ENODEV; |
4623 | 4371 | ||
4624 | #if MEMORY_MAPPED_IO | 4372 | #if MEMORY_MAPPED_IO |
@@ -4666,21 +4414,15 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
4666 | 4414 | ||
4667 | pci_set_drvdata(pdev, host); | 4415 | pci_set_drvdata(pdev, host); |
4668 | 4416 | ||
4669 | #if LINUX_VERSION_CODE >= 0x020600 | ||
4670 | error = scsi_add_host(host, &pdev->dev); | 4417 | error = scsi_add_host(host, &pdev->dev); |
4671 | if (error) | 4418 | if (error) |
4672 | goto error_disable_adapter; | 4419 | goto error_disable_adapter; |
4673 | scsi_scan_host(host); | 4420 | scsi_scan_host(host); |
4674 | #else | ||
4675 | scsi_set_pci_device(host, pdev); | ||
4676 | #endif | ||
4677 | 4421 | ||
4678 | return 0; | 4422 | return 0; |
4679 | 4423 | ||
4680 | #if LINUX_VERSION_CODE >= 0x020600 | ||
4681 | error_disable_adapter: | 4424 | error_disable_adapter: |
4682 | qla1280_disable_intrs(ha); | 4425 | qla1280_disable_intrs(ha); |
4683 | #endif | ||
4684 | error_free_irq: | 4426 | error_free_irq: |
4685 | free_irq(pdev->irq, ha); | 4427 | free_irq(pdev->irq, ha); |
4686 | error_release_region: | 4428 | error_release_region: |
@@ -4712,9 +4454,7 @@ qla1280_remove_one(struct pci_dev *pdev) | |||
4712 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 4454 | struct Scsi_Host *host = pci_get_drvdata(pdev); |
4713 | struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; | 4455 | struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; |
4714 | 4456 | ||
4715 | #if LINUX_VERSION_CODE >= 0x020600 | ||
4716 | scsi_remove_host(host); | 4457 | scsi_remove_host(host); |
4717 | #endif | ||
4718 | 4458 | ||
4719 | qla1280_disable_intrs(ha); | 4459 | qla1280_disable_intrs(ha); |
4720 | 4460 | ||
@@ -4738,7 +4478,6 @@ qla1280_remove_one(struct pci_dev *pdev) | |||
4738 | scsi_host_put(host); | 4478 | scsi_host_put(host); |
4739 | } | 4479 | } |
4740 | 4480 | ||
4741 | #if LINUX_VERSION_CODE >= 0x020600 | ||
4742 | static struct pci_driver qla1280_pci_driver = { | 4481 | static struct pci_driver qla1280_pci_driver = { |
4743 | .name = "qla1280", | 4482 | .name = "qla1280", |
4744 | .id_table = qla1280_pci_tbl, | 4483 | .id_table = qla1280_pci_tbl, |
@@ -4784,10 +4523,6 @@ qla1280_exit(void) | |||
4784 | module_init(qla1280_init); | 4523 | module_init(qla1280_init); |
4785 | module_exit(qla1280_exit); | 4524 | module_exit(qla1280_exit); |
4786 | 4525 | ||
4787 | #else | ||
4788 | # define driver_template qla1280_driver_template | ||
4789 | # include "scsi_module.c" | ||
4790 | #endif | ||
4791 | 4526 | ||
4792 | MODULE_AUTHOR("Qlogic & Jes Sorensen"); | 4527 | MODULE_AUTHOR("Qlogic & Jes Sorensen"); |
4793 | MODULE_DESCRIPTION("Qlogic ISP SCSI (qla1x80/qla1x160) driver"); | 4528 | MODULE_DESCRIPTION("Qlogic ISP SCSI (qla1x80/qla1x160) driver"); |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 79d8a914f9d0..bad066e5772a 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -1680,7 +1680,8 @@ typedef struct fc_port { | |||
1680 | uint8_t mp_byte; /* multi-path byte (not used) */ | 1680 | uint8_t mp_byte; /* multi-path byte (not used) */ |
1681 | uint8_t cur_path; /* current path id */ | 1681 | uint8_t cur_path; /* current path id */ |
1682 | 1682 | ||
1683 | struct fc_rport *rport; | 1683 | spinlock_t rport_lock; |
1684 | struct fc_rport *rport, *drport; | ||
1684 | u32 supported_classes; | 1685 | u32 supported_classes; |
1685 | struct work_struct rport_add_work; | 1686 | struct work_struct rport_add_work; |
1686 | struct work_struct rport_del_work; | 1687 | struct work_struct rport_del_work; |
@@ -2270,6 +2271,7 @@ typedef struct scsi_qla_host { | |||
2270 | #define LOOP_RESET_NEEDED 24 | 2271 | #define LOOP_RESET_NEEDED 24 |
2271 | #define BEACON_BLINK_NEEDED 25 | 2272 | #define BEACON_BLINK_NEEDED 25 |
2272 | #define REGISTER_FDMI_NEEDED 26 | 2273 | #define REGISTER_FDMI_NEEDED 26 |
2274 | #define FCPORT_UPDATE_NEEDED 27 | ||
2273 | 2275 | ||
2274 | uint32_t device_flags; | 2276 | uint32_t device_flags; |
2275 | #define DFLG_LOCAL_DEVICES BIT_0 | 2277 | #define DFLG_LOCAL_DEVICES BIT_0 |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 32be4c14cccb..35266bd5d538 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -47,9 +47,11 @@ extern int qla2x00_local_device_login(scsi_qla_host_t *, uint16_t); | |||
47 | extern void qla2x00_restart_queues(scsi_qla_host_t *, uint8_t); | 47 | extern void qla2x00_restart_queues(scsi_qla_host_t *, uint8_t); |
48 | 48 | ||
49 | extern void qla2x00_rescan_fcports(scsi_qla_host_t *); | 49 | extern void qla2x00_rescan_fcports(scsi_qla_host_t *); |
50 | extern void qla2x00_update_fcports(scsi_qla_host_t *); | ||
50 | 51 | ||
51 | extern int qla2x00_abort_isp(scsi_qla_host_t *); | 52 | extern int qla2x00_abort_isp(scsi_qla_host_t *); |
52 | 53 | ||
54 | extern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *); | ||
53 | extern void qla2x00_reg_remote_port(scsi_qla_host_t *, fc_port_t *); | 55 | extern void qla2x00_reg_remote_port(scsi_qla_host_t *, fc_port_t *); |
54 | 56 | ||
55 | /* | 57 | /* |
@@ -70,8 +72,8 @@ extern char *qla2x00_get_fw_version_str(struct scsi_qla_host *, char *); | |||
70 | 72 | ||
71 | extern void qla2x00_cmd_timeout(srb_t *); | 73 | extern void qla2x00_cmd_timeout(srb_t *); |
72 | 74 | ||
73 | extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int); | 75 | extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int); |
74 | extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *); | 76 | extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int); |
75 | 77 | ||
76 | extern void qla2x00_blink_led(scsi_qla_host_t *); | 78 | extern void qla2x00_blink_led(scsi_qla_host_t *); |
77 | 79 | ||
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index a91fea69ad63..e67bb0997818 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -32,7 +32,6 @@ static int qla2x00_fw_ready(scsi_qla_host_t *); | |||
32 | static int qla2x00_configure_hba(scsi_qla_host_t *); | 32 | static int qla2x00_configure_hba(scsi_qla_host_t *); |
33 | static int qla2x00_configure_loop(scsi_qla_host_t *); | 33 | static int qla2x00_configure_loop(scsi_qla_host_t *); |
34 | static int qla2x00_configure_local_loop(scsi_qla_host_t *); | 34 | static int qla2x00_configure_local_loop(scsi_qla_host_t *); |
35 | static void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *); | ||
36 | static int qla2x00_configure_fabric(scsi_qla_host_t *); | 35 | static int qla2x00_configure_fabric(scsi_qla_host_t *); |
37 | static int qla2x00_find_all_fabric_devs(scsi_qla_host_t *, struct list_head *); | 36 | static int qla2x00_find_all_fabric_devs(scsi_qla_host_t *, struct list_head *); |
38 | static int qla2x00_device_resync(scsi_qla_host_t *); | 37 | static int qla2x00_device_resync(scsi_qla_host_t *); |
@@ -1688,10 +1687,16 @@ static void | |||
1688 | qla2x00_rport_del(void *data) | 1687 | qla2x00_rport_del(void *data) |
1689 | { | 1688 | { |
1690 | fc_port_t *fcport = data; | 1689 | fc_port_t *fcport = data; |
1690 | struct fc_rport *rport; | ||
1691 | unsigned long flags; | ||
1692 | |||
1693 | spin_lock_irqsave(&fcport->rport_lock, flags); | ||
1694 | rport = fcport->drport; | ||
1695 | fcport->drport = NULL; | ||
1696 | spin_unlock_irqrestore(&fcport->rport_lock, flags); | ||
1697 | if (rport) | ||
1698 | fc_remote_port_delete(rport); | ||
1691 | 1699 | ||
1692 | if (fcport->rport) | ||
1693 | fc_remote_port_delete(fcport->rport); | ||
1694 | fcport->rport = NULL; | ||
1695 | } | 1700 | } |
1696 | 1701 | ||
1697 | /** | 1702 | /** |
@@ -1719,6 +1724,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *ha, gfp_t flags) | |||
1719 | atomic_set(&fcport->state, FCS_UNCONFIGURED); | 1724 | atomic_set(&fcport->state, FCS_UNCONFIGURED); |
1720 | fcport->flags = FCF_RLC_SUPPORT; | 1725 | fcport->flags = FCF_RLC_SUPPORT; |
1721 | fcport->supported_classes = FC_COS_UNSPECIFIED; | 1726 | fcport->supported_classes = FC_COS_UNSPECIFIED; |
1727 | spin_lock_init(&fcport->rport_lock); | ||
1722 | INIT_WORK(&fcport->rport_add_work, qla2x00_rport_add, fcport); | 1728 | INIT_WORK(&fcport->rport_add_work, qla2x00_rport_add, fcport); |
1723 | INIT_WORK(&fcport->rport_del_work, qla2x00_rport_del, fcport); | 1729 | INIT_WORK(&fcport->rport_del_work, qla2x00_rport_del, fcport); |
1724 | 1730 | ||
@@ -2008,7 +2014,7 @@ qla2x00_probe_for_all_luns(scsi_qla_host_t *ha) | |||
2008 | { | 2014 | { |
2009 | fc_port_t *fcport; | 2015 | fc_port_t *fcport; |
2010 | 2016 | ||
2011 | qla2x00_mark_all_devices_lost(ha); | 2017 | qla2x00_mark_all_devices_lost(ha, 0); |
2012 | list_for_each_entry(fcport, &ha->fcports, list) { | 2018 | list_for_each_entry(fcport, &ha->fcports, list) { |
2013 | if (fcport->port_type != FCT_TARGET) | 2019 | if (fcport->port_type != FCT_TARGET) |
2014 | continue; | 2020 | continue; |
@@ -2032,13 +2038,9 @@ qla2x00_probe_for_all_luns(scsi_qla_host_t *ha) | |||
2032 | * Context: | 2038 | * Context: |
2033 | * Kernel context. | 2039 | * Kernel context. |
2034 | */ | 2040 | */ |
2035 | static void | 2041 | void |
2036 | qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) | 2042 | qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) |
2037 | { | 2043 | { |
2038 | uint16_t index; | ||
2039 | unsigned long flags; | ||
2040 | srb_t *sp; | ||
2041 | |||
2042 | fcport->ha = ha; | 2044 | fcport->ha = ha; |
2043 | fcport->login_retry = 0; | 2045 | fcport->login_retry = 0; |
2044 | fcport->port_login_retry_count = ha->port_down_retry_count * | 2046 | fcport->port_login_retry_count = ha->port_down_retry_count * |
@@ -2047,28 +2049,6 @@ qla2x00_update_fcport(scsi_qla_host_t *ha, fc_port_t *fcport) | |||
2047 | PORT_RETRY_TIME); | 2049 | PORT_RETRY_TIME); |
2048 | fcport->flags &= ~FCF_LOGIN_NEEDED; | 2050 | fcport->flags &= ~FCF_LOGIN_NEEDED; |
2049 | 2051 | ||
2050 | /* | ||
2051 | * Check for outstanding cmd on tape Bypass LUN discovery if active | ||
2052 | * command on tape. | ||
2053 | */ | ||
2054 | if (fcport->flags & FCF_TAPE_PRESENT) { | ||
2055 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
2056 | for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) { | ||
2057 | fc_port_t *sfcp; | ||
2058 | |||
2059 | if ((sp = ha->outstanding_cmds[index]) != 0) { | ||
2060 | sfcp = sp->fcport; | ||
2061 | if (sfcp == fcport) { | ||
2062 | atomic_set(&fcport->state, FCS_ONLINE); | ||
2063 | spin_unlock_irqrestore( | ||
2064 | &ha->hardware_lock, flags); | ||
2065 | return; | ||
2066 | } | ||
2067 | } | ||
2068 | } | ||
2069 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
2070 | } | ||
2071 | |||
2072 | if (fcport->port_type == FCT_INITIATOR || | 2052 | if (fcport->port_type == FCT_INITIATOR || |
2073 | fcport->port_type == FCT_BROADCAST) | 2053 | fcport->port_type == FCT_BROADCAST) |
2074 | fcport->device_type = TYPE_PROCESSOR; | 2054 | fcport->device_type = TYPE_PROCESSOR; |
@@ -2084,24 +2064,29 @@ qla2x00_reg_remote_port(scsi_qla_host_t *ha, fc_port_t *fcport) | |||
2084 | { | 2064 | { |
2085 | struct fc_rport_identifiers rport_ids; | 2065 | struct fc_rport_identifiers rport_ids; |
2086 | struct fc_rport *rport; | 2066 | struct fc_rport *rport; |
2067 | unsigned long flags; | ||
2087 | 2068 | ||
2088 | if (fcport->rport) { | 2069 | if (fcport->drport) |
2089 | fc_remote_port_delete(fcport->rport); | 2070 | qla2x00_rport_del(fcport); |
2090 | fcport->rport = NULL; | 2071 | if (fcport->rport) |
2091 | } | 2072 | return; |
2092 | 2073 | ||
2093 | rport_ids.node_name = wwn_to_u64(fcport->node_name); | 2074 | rport_ids.node_name = wwn_to_u64(fcport->node_name); |
2094 | rport_ids.port_name = wwn_to_u64(fcport->port_name); | 2075 | rport_ids.port_name = wwn_to_u64(fcport->port_name); |
2095 | rport_ids.port_id = fcport->d_id.b.domain << 16 | | 2076 | rport_ids.port_id = fcport->d_id.b.domain << 16 | |
2096 | fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; | 2077 | fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; |
2097 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; | 2078 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; |
2098 | fcport->rport = rport = fc_remote_port_add(ha->host, 0, &rport_ids); | 2079 | rport = fc_remote_port_add(ha->host, 0, &rport_ids); |
2099 | if (!rport) { | 2080 | if (!rport) { |
2100 | qla_printk(KERN_WARNING, ha, | 2081 | qla_printk(KERN_WARNING, ha, |
2101 | "Unable to allocate fc remote port!\n"); | 2082 | "Unable to allocate fc remote port!\n"); |
2102 | return; | 2083 | return; |
2103 | } | 2084 | } |
2085 | spin_lock_irqsave(&fcport->rport_lock, flags); | ||
2086 | fcport->rport = rport; | ||
2104 | *((fc_port_t **)rport->dd_data) = fcport; | 2087 | *((fc_port_t **)rport->dd_data) = fcport; |
2088 | spin_unlock_irqrestore(&fcport->rport_lock, flags); | ||
2089 | |||
2105 | rport->supported_classes = fcport->supported_classes; | 2090 | rport->supported_classes = fcport->supported_classes; |
2106 | 2091 | ||
2107 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; | 2092 | rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; |
@@ -2217,12 +2202,11 @@ qla2x00_configure_fabric(scsi_qla_host_t *ha) | |||
2217 | 2202 | ||
2218 | if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) { | 2203 | if (atomic_read(&fcport->state) == FCS_DEVICE_LOST) { |
2219 | qla2x00_mark_device_lost(ha, fcport, | 2204 | qla2x00_mark_device_lost(ha, fcport, |
2220 | ql2xplogiabsentdevice); | 2205 | ql2xplogiabsentdevice, 0); |
2221 | if (fcport->loop_id != FC_NO_LOOP_ID && | 2206 | if (fcport->loop_id != FC_NO_LOOP_ID && |
2222 | (fcport->flags & FCF_TAPE_PRESENT) == 0 && | 2207 | (fcport->flags & FCF_TAPE_PRESENT) == 0 && |
2223 | fcport->port_type != FCT_INITIATOR && | 2208 | fcport->port_type != FCT_INITIATOR && |
2224 | fcport->port_type != FCT_BROADCAST) { | 2209 | fcport->port_type != FCT_BROADCAST) { |
2225 | |||
2226 | ha->isp_ops.fabric_logout(ha, | 2210 | ha->isp_ops.fabric_logout(ha, |
2227 | fcport->loop_id, | 2211 | fcport->loop_id, |
2228 | fcport->d_id.b.domain, | 2212 | fcport->d_id.b.domain, |
@@ -2694,7 +2678,8 @@ qla2x00_device_resync(scsi_qla_host_t *ha) | |||
2694 | if (atomic_read(&fcport->state) == FCS_ONLINE) { | 2678 | if (atomic_read(&fcport->state) == FCS_ONLINE) { |
2695 | if (format != 3 || | 2679 | if (format != 3 || |
2696 | fcport->port_type != FCT_INITIATOR) { | 2680 | fcport->port_type != FCT_INITIATOR) { |
2697 | qla2x00_mark_device_lost(ha, fcport, 0); | 2681 | qla2x00_mark_device_lost(ha, fcport, |
2682 | 0, 0); | ||
2698 | } | 2683 | } |
2699 | } | 2684 | } |
2700 | fcport->flags &= ~FCF_FARP_DONE; | 2685 | fcport->flags &= ~FCF_FARP_DONE; |
@@ -2741,8 +2726,7 @@ qla2x00_fabric_dev_login(scsi_qla_host_t *ha, fc_port_t *fcport, | |||
2741 | ha->isp_ops.fabric_logout(ha, fcport->loop_id, | 2726 | ha->isp_ops.fabric_logout(ha, fcport->loop_id, |
2742 | fcport->d_id.b.domain, fcport->d_id.b.area, | 2727 | fcport->d_id.b.domain, fcport->d_id.b.area, |
2743 | fcport->d_id.b.al_pa); | 2728 | fcport->d_id.b.al_pa); |
2744 | qla2x00_mark_device_lost(ha, fcport, 1); | 2729 | qla2x00_mark_device_lost(ha, fcport, 1, 0); |
2745 | |||
2746 | } else { | 2730 | } else { |
2747 | qla2x00_update_fcport(ha, fcport); | 2731 | qla2x00_update_fcport(ha, fcport); |
2748 | } | 2732 | } |
@@ -2855,7 +2839,7 @@ qla2x00_fabric_login(scsi_qla_host_t *ha, fc_port_t *fcport, | |||
2855 | ha->isp_ops.fabric_logout(ha, fcport->loop_id, | 2839 | ha->isp_ops.fabric_logout(ha, fcport->loop_id, |
2856 | fcport->d_id.b.domain, fcport->d_id.b.area, | 2840 | fcport->d_id.b.domain, fcport->d_id.b.area, |
2857 | fcport->d_id.b.al_pa); | 2841 | fcport->d_id.b.al_pa); |
2858 | qla2x00_mark_device_lost(ha, fcport, 1); | 2842 | qla2x00_mark_device_lost(ha, fcport, 1, 0); |
2859 | 2843 | ||
2860 | rval = 1; | 2844 | rval = 1; |
2861 | break; | 2845 | break; |
@@ -2990,6 +2974,17 @@ qla2x00_rescan_fcports(scsi_qla_host_t *ha) | |||
2990 | qla2x00_probe_for_all_luns(ha); | 2974 | qla2x00_probe_for_all_luns(ha); |
2991 | } | 2975 | } |
2992 | 2976 | ||
2977 | void | ||
2978 | qla2x00_update_fcports(scsi_qla_host_t *ha) | ||
2979 | { | ||
2980 | fc_port_t *fcport; | ||
2981 | |||
2982 | /* Go with deferred removal of rport references. */ | ||
2983 | list_for_each_entry(fcport, &ha->fcports, list) | ||
2984 | if (fcport->drport) | ||
2985 | qla2x00_rport_del(fcport); | ||
2986 | } | ||
2987 | |||
2993 | /* | 2988 | /* |
2994 | * qla2x00_abort_isp | 2989 | * qla2x00_abort_isp |
2995 | * Resets ISP and aborts all outstanding commands. | 2990 | * Resets ISP and aborts all outstanding commands. |
@@ -3019,7 +3014,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) | |||
3019 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); | 3014 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); |
3020 | if (atomic_read(&ha->loop_state) != LOOP_DOWN) { | 3015 | if (atomic_read(&ha->loop_state) != LOOP_DOWN) { |
3021 | atomic_set(&ha->loop_state, LOOP_DOWN); | 3016 | atomic_set(&ha->loop_state, LOOP_DOWN); |
3022 | qla2x00_mark_all_devices_lost(ha); | 3017 | qla2x00_mark_all_devices_lost(ha, 0); |
3023 | } else { | 3018 | } else { |
3024 | if (!atomic_read(&ha->loop_down_timer)) | 3019 | if (!atomic_read(&ha->loop_down_timer)) |
3025 | atomic_set(&ha->loop_down_timer, | 3020 | atomic_set(&ha->loop_down_timer, |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index f63af081d4ff..71a46fcee8cc 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c | |||
@@ -389,7 +389,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
389 | if (atomic_read(&ha->loop_state) != LOOP_DOWN) { | 389 | if (atomic_read(&ha->loop_state) != LOOP_DOWN) { |
390 | atomic_set(&ha->loop_state, LOOP_DOWN); | 390 | atomic_set(&ha->loop_state, LOOP_DOWN); |
391 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); | 391 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); |
392 | qla2x00_mark_all_devices_lost(ha); | 392 | qla2x00_mark_all_devices_lost(ha, 1); |
393 | } | 393 | } |
394 | 394 | ||
395 | set_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags); | 395 | set_bit(REGISTER_FC4_NEEDED, &ha->dpc_flags); |
@@ -432,7 +432,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
432 | atomic_set(&ha->loop_state, LOOP_DOWN); | 432 | atomic_set(&ha->loop_state, LOOP_DOWN); |
433 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); | 433 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); |
434 | ha->device_flags |= DFLG_NO_CABLE; | 434 | ha->device_flags |= DFLG_NO_CABLE; |
435 | qla2x00_mark_all_devices_lost(ha); | 435 | qla2x00_mark_all_devices_lost(ha, 1); |
436 | } | 436 | } |
437 | 437 | ||
438 | ha->flags.management_server_logged_in = 0; | 438 | ha->flags.management_server_logged_in = 0; |
@@ -453,7 +453,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
453 | if (atomic_read(&ha->loop_state) != LOOP_DOWN) { | 453 | if (atomic_read(&ha->loop_state) != LOOP_DOWN) { |
454 | atomic_set(&ha->loop_state, LOOP_DOWN); | 454 | atomic_set(&ha->loop_state, LOOP_DOWN); |
455 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); | 455 | atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME); |
456 | qla2x00_mark_all_devices_lost(ha); | 456 | qla2x00_mark_all_devices_lost(ha, 1); |
457 | } | 457 | } |
458 | 458 | ||
459 | set_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); | 459 | set_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); |
@@ -482,7 +482,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
482 | if (!atomic_read(&ha->loop_down_timer)) | 482 | if (!atomic_read(&ha->loop_down_timer)) |
483 | atomic_set(&ha->loop_down_timer, | 483 | atomic_set(&ha->loop_down_timer, |
484 | LOOP_DOWN_TIME); | 484 | LOOP_DOWN_TIME); |
485 | qla2x00_mark_all_devices_lost(ha); | 485 | qla2x00_mark_all_devices_lost(ha, 1); |
486 | } | 486 | } |
487 | 487 | ||
488 | if (!(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags))) { | 488 | if (!(test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags))) { |
@@ -506,7 +506,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
506 | if (!atomic_read(&ha->loop_down_timer)) | 506 | if (!atomic_read(&ha->loop_down_timer)) |
507 | atomic_set(&ha->loop_down_timer, | 507 | atomic_set(&ha->loop_down_timer, |
508 | LOOP_DOWN_TIME); | 508 | LOOP_DOWN_TIME); |
509 | qla2x00_mark_all_devices_lost(ha); | 509 | qla2x00_mark_all_devices_lost(ha, 1); |
510 | } | 510 | } |
511 | 511 | ||
512 | set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); | 512 | set_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags); |
@@ -580,7 +580,7 @@ qla2x00_async_event(scsi_qla_host_t *ha, uint16_t *mb) | |||
580 | */ | 580 | */ |
581 | atomic_set(&ha->loop_state, LOOP_UP); | 581 | atomic_set(&ha->loop_state, LOOP_UP); |
582 | 582 | ||
583 | qla2x00_mark_all_devices_lost(ha); | 583 | qla2x00_mark_all_devices_lost(ha, 1); |
584 | 584 | ||
585 | ha->flags.rscn_queue_overflow = 1; | 585 | ha->flags.rscn_queue_overflow = 1; |
586 | 586 | ||
@@ -1091,7 +1091,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) | |||
1091 | 1091 | ||
1092 | cp->result = DID_BUS_BUSY << 16; | 1092 | cp->result = DID_BUS_BUSY << 16; |
1093 | if (atomic_read(&fcport->state) == FCS_ONLINE) { | 1093 | if (atomic_read(&fcport->state) == FCS_ONLINE) { |
1094 | qla2x00_mark_device_lost(ha, fcport, 1); | 1094 | qla2x00_mark_device_lost(ha, fcport, 1, 1); |
1095 | } | 1095 | } |
1096 | break; | 1096 | break; |
1097 | 1097 | ||
@@ -1135,7 +1135,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) | |||
1135 | 1135 | ||
1136 | /* Check to see if logout occurred. */ | 1136 | /* Check to see if logout occurred. */ |
1137 | if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT)) | 1137 | if ((le16_to_cpu(sts->status_flags) & SF_LOGOUT_SENT)) |
1138 | qla2x00_mark_device_lost(ha, fcport, 1); | 1138 | qla2x00_mark_device_lost(ha, fcport, 1, 1); |
1139 | break; | 1139 | break; |
1140 | 1140 | ||
1141 | case CS_QUEUE_FULL: | 1141 | case CS_QUEUE_FULL: |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 4916847d84ec..5866a7c706a8 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -756,7 +756,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd) | |||
756 | if (ret == SUCCESS) { | 756 | if (ret == SUCCESS) { |
757 | if (fcport->flags & FC_FABRIC_DEVICE) { | 757 | if (fcport->flags & FC_FABRIC_DEVICE) { |
758 | ha->isp_ops.fabric_logout(ha, fcport->loop_id); | 758 | ha->isp_ops.fabric_logout(ha, fcport->loop_id); |
759 | qla2x00_mark_device_lost(ha, fcport); | 759 | qla2x00_mark_device_lost(ha, fcport, 0, 0); |
760 | } | 760 | } |
761 | } | 761 | } |
762 | #endif | 762 | #endif |
@@ -1642,6 +1642,31 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1642 | pci_disable_device(ha->pdev); | 1642 | pci_disable_device(ha->pdev); |
1643 | } | 1643 | } |
1644 | 1644 | ||
1645 | static inline void | ||
1646 | qla2x00_schedule_rport_del(struct scsi_qla_host *ha, fc_port_t *fcport, | ||
1647 | int defer) | ||
1648 | { | ||
1649 | unsigned long flags; | ||
1650 | struct fc_rport *rport; | ||
1651 | |||
1652 | if (!fcport->rport) | ||
1653 | return; | ||
1654 | |||
1655 | rport = fcport->rport; | ||
1656 | if (defer) { | ||
1657 | spin_lock_irqsave(&fcport->rport_lock, flags); | ||
1658 | fcport->drport = rport; | ||
1659 | fcport->rport = NULL; | ||
1660 | spin_unlock_irqrestore(&fcport->rport_lock, flags); | ||
1661 | set_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags); | ||
1662 | } else { | ||
1663 | spin_lock_irqsave(&fcport->rport_lock, flags); | ||
1664 | fcport->rport = NULL; | ||
1665 | spin_unlock_irqrestore(&fcport->rport_lock, flags); | ||
1666 | fc_remote_port_delete(rport); | ||
1667 | } | ||
1668 | } | ||
1669 | |||
1645 | /* | 1670 | /* |
1646 | * qla2x00_mark_device_lost Updates fcport state when device goes offline. | 1671 | * qla2x00_mark_device_lost Updates fcport state when device goes offline. |
1647 | * | 1672 | * |
@@ -1652,10 +1677,10 @@ qla2x00_free_device(scsi_qla_host_t *ha) | |||
1652 | * Context: | 1677 | * Context: |
1653 | */ | 1678 | */ |
1654 | void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport, | 1679 | void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport, |
1655 | int do_login) | 1680 | int do_login, int defer) |
1656 | { | 1681 | { |
1657 | if (atomic_read(&fcport->state) == FCS_ONLINE && fcport->rport) | 1682 | if (atomic_read(&fcport->state) == FCS_ONLINE) |
1658 | schedule_work(&fcport->rport_del_work); | 1683 | qla2x00_schedule_rport_del(ha, fcport, defer); |
1659 | 1684 | ||
1660 | /* | 1685 | /* |
1661 | * We may need to retry the login, so don't change the state of the | 1686 | * We may need to retry the login, so don't change the state of the |
@@ -1702,7 +1727,7 @@ void qla2x00_mark_device_lost(scsi_qla_host_t *ha, fc_port_t *fcport, | |||
1702 | * Context: | 1727 | * Context: |
1703 | */ | 1728 | */ |
1704 | void | 1729 | void |
1705 | qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha) | 1730 | qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha, int defer) |
1706 | { | 1731 | { |
1707 | fc_port_t *fcport; | 1732 | fc_port_t *fcport; |
1708 | 1733 | ||
@@ -1716,10 +1741,13 @@ qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha) | |||
1716 | */ | 1741 | */ |
1717 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) | 1742 | if (atomic_read(&fcport->state) == FCS_DEVICE_DEAD) |
1718 | continue; | 1743 | continue; |
1719 | if (atomic_read(&fcport->state) == FCS_ONLINE && fcport->rport) | 1744 | if (atomic_read(&fcport->state) == FCS_ONLINE) |
1720 | schedule_work(&fcport->rport_del_work); | 1745 | qla2x00_schedule_rport_del(ha, fcport, defer); |
1721 | atomic_set(&fcport->state, FCS_DEVICE_LOST); | 1746 | atomic_set(&fcport->state, FCS_DEVICE_LOST); |
1722 | } | 1747 | } |
1748 | |||
1749 | if (defer && ha->dpc_wait && !ha->dpc_active) | ||
1750 | up(ha->dpc_wait); | ||
1723 | } | 1751 | } |
1724 | 1752 | ||
1725 | /* | 1753 | /* |
@@ -2161,6 +2189,9 @@ qla2x00_do_dpc(void *data) | |||
2161 | ha->host_no)); | 2189 | ha->host_no)); |
2162 | } | 2190 | } |
2163 | 2191 | ||
2192 | if (test_and_clear_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags)) | ||
2193 | qla2x00_update_fcports(ha); | ||
2194 | |||
2164 | if (test_and_clear_bit(LOOP_RESET_NEEDED, &ha->dpc_flags)) { | 2195 | if (test_and_clear_bit(LOOP_RESET_NEEDED, &ha->dpc_flags)) { |
2165 | DEBUG(printk("scsi(%ld): dpc: sched loop_reset()\n", | 2196 | DEBUG(printk("scsi(%ld): dpc: sched loop_reset()\n", |
2166 | ha->host_no)); | 2197 | ha->host_no)); |
@@ -2219,13 +2250,8 @@ qla2x00_do_dpc(void *data) | |||
2219 | DEBUG(printk("scsi(%ld): port login OK: logged in ID 0x%x\n", | 2250 | DEBUG(printk("scsi(%ld): port login OK: logged in ID 0x%x\n", |
2220 | ha->host_no, fcport->loop_id)); | 2251 | ha->host_no, fcport->loop_id)); |
2221 | 2252 | ||
2222 | fcport->port_login_retry_count = | 2253 | qla2x00_update_fcport(ha, |
2223 | ha->port_down_retry_count * PORT_RETRY_TIME; | 2254 | fcport); |
2224 | atomic_set(&fcport->state, FCS_ONLINE); | ||
2225 | atomic_set(&fcport->port_down_timer, | ||
2226 | ha->port_down_retry_count * PORT_RETRY_TIME); | ||
2227 | |||
2228 | fcport->login_retry = 0; | ||
2229 | } else if (status == 1) { | 2255 | } else if (status == 1) { |
2230 | set_bit(RELOGIN_NEEDED, &ha->dpc_flags); | 2256 | set_bit(RELOGIN_NEEDED, &ha->dpc_flags); |
2231 | /* retry the login again */ | 2257 | /* retry the login again */ |
@@ -2469,6 +2495,7 @@ qla2x00_timer(scsi_qla_host_t *ha) | |||
2469 | if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || | 2495 | if ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || |
2470 | test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || | 2496 | test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || |
2471 | test_bit(LOOP_RESET_NEEDED, &ha->dpc_flags) || | 2497 | test_bit(LOOP_RESET_NEEDED, &ha->dpc_flags) || |
2498 | test_bit(FCPORT_UPDATE_NEEDED, &ha->dpc_flags) || | ||
2472 | start_dpc || | 2499 | start_dpc || |
2473 | test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) || | 2500 | test_bit(LOGIN_RETRY_NEEDED, &ha->dpc_flags) || |
2474 | test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) || | 2501 | test_bit(RESET_MARKER_NEEDED, &ha->dpc_flags) || |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index a2333d2c7af0..5cc97b721661 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -1350,7 +1350,7 @@ static void scsi_eh_lock_door(struct scsi_device *sdev) | |||
1350 | cmnd[4] = SCSI_REMOVAL_PREVENT; | 1350 | cmnd[4] = SCSI_REMOVAL_PREVENT; |
1351 | cmnd[5] = 0; | 1351 | cmnd[5] = 0; |
1352 | 1352 | ||
1353 | scsi_execute_async(sdev, cmnd, DMA_NONE, NULL, 0, 0, 10 * HZ, | 1353 | scsi_execute_async(sdev, cmnd, 6, DMA_NONE, NULL, 0, 0, 10 * HZ, |
1354 | 5, NULL, NULL, GFP_KERNEL); | 1354 | 5, NULL, NULL, GFP_KERNEL); |
1355 | } | 1355 | } |
1356 | 1356 | ||
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 3574ba935af8..4a602853a98e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -436,6 +436,7 @@ free_bios: | |||
436 | * scsi_execute_async - insert request | 436 | * scsi_execute_async - insert request |
437 | * @sdev: scsi device | 437 | * @sdev: scsi device |
438 | * @cmd: scsi command | 438 | * @cmd: scsi command |
439 | * @cmd_len: length of scsi cdb | ||
439 | * @data_direction: data direction | 440 | * @data_direction: data direction |
440 | * @buffer: data buffer (this can be a kernel buffer or scatterlist) | 441 | * @buffer: data buffer (this can be a kernel buffer or scatterlist) |
441 | * @bufflen: len of buffer | 442 | * @bufflen: len of buffer |
@@ -445,7 +446,7 @@ free_bios: | |||
445 | * @flags: or into request flags | 446 | * @flags: or into request flags |
446 | **/ | 447 | **/ |
447 | int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, | 448 | int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, |
448 | int data_direction, void *buffer, unsigned bufflen, | 449 | int cmd_len, int data_direction, void *buffer, unsigned bufflen, |
449 | int use_sg, int timeout, int retries, void *privdata, | 450 | int use_sg, int timeout, int retries, void *privdata, |
450 | void (*done)(void *, char *, int, int), gfp_t gfp) | 451 | void (*done)(void *, char *, int, int), gfp_t gfp) |
451 | { | 452 | { |
@@ -472,7 +473,7 @@ int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd, | |||
472 | if (err) | 473 | if (err) |
473 | goto free_req; | 474 | goto free_req; |
474 | 475 | ||
475 | req->cmd_len = COMMAND_SIZE(cmd[0]); | 476 | req->cmd_len = cmd_len; |
476 | memcpy(req->cmd, cmd, req->cmd_len); | 477 | memcpy(req->cmd, cmd, req->cmd_len); |
477 | req->sense = sioc->sense; | 478 | req->sense = sioc->sense; |
478 | req->sense_len = 0; | 479 | req->sense_len = 0; |
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index a3e0b7bc2d7b..210dab5879fa 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -377,7 +377,7 @@ static void sas_phy_release(struct device *dev) | |||
377 | /** | 377 | /** |
378 | * sas_phy_alloc -- allocates and initialize a SAS PHY structure | 378 | * sas_phy_alloc -- allocates and initialize a SAS PHY structure |
379 | * @parent: Parent device | 379 | * @parent: Parent device |
380 | * @number: Port number | 380 | * @number: Phy index |
381 | * | 381 | * |
382 | * Allocates an SAS PHY structure. It will be added in the device tree | 382 | * Allocates an SAS PHY structure. It will be added in the device tree |
383 | * below the device specified by @parent, which has to be either a Scsi_Host | 383 | * below the device specified by @parent, which has to be either a Scsi_Host |
@@ -595,8 +595,8 @@ struct sas_rphy *sas_rphy_alloc(struct sas_phy *parent) | |||
595 | device_initialize(&rphy->dev); | 595 | device_initialize(&rphy->dev); |
596 | rphy->dev.parent = get_device(&parent->dev); | 596 | rphy->dev.parent = get_device(&parent->dev); |
597 | rphy->dev.release = sas_rphy_release; | 597 | rphy->dev.release = sas_rphy_release; |
598 | sprintf(rphy->dev.bus_id, "rphy-%d:%d", | 598 | sprintf(rphy->dev.bus_id, "rphy-%d:%d-%d", |
599 | shost->host_no, parent->number); | 599 | shost->host_no, parent->port_identifier, parent->number); |
600 | transport_setup_device(&rphy->dev); | 600 | transport_setup_device(&rphy->dev); |
601 | 601 | ||
602 | return rphy; | 602 | return rphy; |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 78aad9582bcf..7d0700091f3d 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -741,7 +741,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp, | |||
741 | hp->duration = jiffies_to_msecs(jiffies); | 741 | hp->duration = jiffies_to_msecs(jiffies); |
742 | /* Now send everything of to mid-level. The next time we hear about this | 742 | /* Now send everything of to mid-level. The next time we hear about this |
743 | packet is when sg_cmd_done() is called (i.e. a callback). */ | 743 | packet is when sg_cmd_done() is called (i.e. a callback). */ |
744 | if (scsi_execute_async(sdp->device, cmnd, data_dir, srp->data.buffer, | 744 | if (scsi_execute_async(sdp->device, cmnd, hp->cmd_len, data_dir, srp->data.buffer, |
745 | hp->dxfer_len, srp->data.k_use_sg, timeout, | 745 | hp->dxfer_len, srp->data.k_use_sg, timeout, |
746 | SG_DEFAULT_RETRIES, srp, sg_cmd_done, | 746 | SG_DEFAULT_RETRIES, srp, sg_cmd_done, |
747 | GFP_ATOMIC)) { | 747 | GFP_ATOMIC)) { |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 13b1d3aac265..7f96f33c1bb1 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -508,7 +508,7 @@ st_do_scsi(struct st_request * SRpnt, struct scsi_tape * STp, unsigned char *cmd | |||
508 | STp->buffer->cmdstat.have_sense = 0; | 508 | STp->buffer->cmdstat.have_sense = 0; |
509 | STp->buffer->syscall_result = 0; | 509 | STp->buffer->syscall_result = 0; |
510 | 510 | ||
511 | if (scsi_execute_async(STp->device, cmd, direction, | 511 | if (scsi_execute_async(STp->device, cmd, COMMAND_SIZE(cmd[0]), direction, |
512 | &((STp->buffer)->sg[0]), bytes, (STp->buffer)->sg_segs, | 512 | &((STp->buffer)->sg[0]), bytes, (STp->buffer)->sg_segs, |
513 | timeout, retries, SRpnt, st_sleep_done, GFP_KERNEL)) { | 513 | timeout, retries, SRpnt, st_sleep_done, GFP_KERNEL)) { |
514 | /* could not allocate the buffer or request was too large */ | 514 | /* could not allocate the buffer or request was too large */ |
diff --git a/drivers/serial/21285.c b/drivers/serial/21285.c index 221999bcf8fe..7aef7518b0d1 100644 --- a/drivers/serial/21285.c +++ b/drivers/serial/21285.c | |||
@@ -366,7 +366,7 @@ static struct uart_port serial21285_port = { | |||
366 | .irq = NO_IRQ, | 366 | .irq = NO_IRQ, |
367 | .fifosize = 16, | 367 | .fifosize = 16, |
368 | .ops = &serial21285_ops, | 368 | .ops = &serial21285_ops, |
369 | .flags = ASYNC_BOOT_AUTOCONF, | 369 | .flags = UPF_BOOT_AUTOCONF, |
370 | }; | 370 | }; |
371 | 371 | ||
372 | static void serial21285_setup_ports(void) | 372 | static void serial21285_setup_ports(void) |
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index bc36edff2058..179c1f065e60 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/console.h> | 32 | #include <linux/console.h> |
33 | #include <linux/sysrq.h> | 33 | #include <linux/sysrq.h> |
34 | #include <linux/mca.h> | ||
35 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
36 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
37 | #include <linux/tty.h> | 36 | #include <linux/tty.h> |
@@ -2027,12 +2026,6 @@ static void serial8250_config_port(struct uart_port *port, int flags) | |||
2027 | int ret; | 2026 | int ret; |
2028 | 2027 | ||
2029 | /* | 2028 | /* |
2030 | * Don't probe for MCA ports on non-MCA machines. | ||
2031 | */ | ||
2032 | if (up->port.flags & UPF_BOOT_ONLYMCA && !MCA_bus) | ||
2033 | return; | ||
2034 | |||
2035 | /* | ||
2036 | * Find the region that we can probe for. This in turn | 2029 | * Find the region that we can probe for. This in turn |
2037 | * tells us whether we can probe for the type of port. | 2030 | * tells us whether we can probe for the type of port. |
2038 | */ | 2031 | */ |
@@ -2164,7 +2157,7 @@ serial8250_register_ports(struct uart_driver *drv, struct device *dev) | |||
2164 | /* | 2157 | /* |
2165 | * Wait for transmitter & holding register to empty | 2158 | * Wait for transmitter & holding register to empty |
2166 | */ | 2159 | */ |
2167 | static inline void wait_for_xmitr(struct uart_8250_port *up) | 2160 | static inline void wait_for_xmitr(struct uart_8250_port *up, int bits) |
2168 | { | 2161 | { |
2169 | unsigned int status, tmout = 10000; | 2162 | unsigned int status, tmout = 10000; |
2170 | 2163 | ||
@@ -2178,7 +2171,7 @@ static inline void wait_for_xmitr(struct uart_8250_port *up) | |||
2178 | if (--tmout == 0) | 2171 | if (--tmout == 0) |
2179 | break; | 2172 | break; |
2180 | udelay(1); | 2173 | udelay(1); |
2181 | } while ((status & BOTH_EMPTY) != BOTH_EMPTY); | 2174 | } while ((status & bits) != bits); |
2182 | 2175 | ||
2183 | /* Wait up to 1s for flow control if necessary */ | 2176 | /* Wait up to 1s for flow control if necessary */ |
2184 | if (up->port.flags & UPF_CONS_FLOW) { | 2177 | if (up->port.flags & UPF_CONS_FLOW) { |
@@ -2218,7 +2211,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
2218 | * Now, do each character | 2211 | * Now, do each character |
2219 | */ | 2212 | */ |
2220 | for (i = 0; i < count; i++, s++) { | 2213 | for (i = 0; i < count; i++, s++) { |
2221 | wait_for_xmitr(up); | 2214 | wait_for_xmitr(up, UART_LSR_THRE); |
2222 | 2215 | ||
2223 | /* | 2216 | /* |
2224 | * Send the character out. | 2217 | * Send the character out. |
@@ -2226,7 +2219,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
2226 | */ | 2219 | */ |
2227 | serial_out(up, UART_TX, *s); | 2220 | serial_out(up, UART_TX, *s); |
2228 | if (*s == 10) { | 2221 | if (*s == 10) { |
2229 | wait_for_xmitr(up); | 2222 | wait_for_xmitr(up, UART_LSR_THRE); |
2230 | serial_out(up, UART_TX, 13); | 2223 | serial_out(up, UART_TX, 13); |
2231 | } | 2224 | } |
2232 | } | 2225 | } |
@@ -2235,8 +2228,8 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count) | |||
2235 | * Finally, wait for transmitter to become empty | 2228 | * Finally, wait for transmitter to become empty |
2236 | * and restore the IER | 2229 | * and restore the IER |
2237 | */ | 2230 | */ |
2238 | wait_for_xmitr(up); | 2231 | wait_for_xmitr(up, BOTH_EMPTY); |
2239 | serial_out(up, UART_IER, ier); | 2232 | serial_out(up, UART_IER, ier | UART_IER_THRI); |
2240 | } | 2233 | } |
2241 | 2234 | ||
2242 | static int serial8250_console_setup(struct console *co, char *options) | 2235 | static int serial8250_console_setup(struct console *co, char *options) |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 9fd1925de361..0d38f0f2ae29 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -23,7 +23,7 @@ config SERIAL_8250 | |||
23 | work.) | 23 | work.) |
24 | 24 | ||
25 | To compile this driver as a module, choose M here: the | 25 | To compile this driver as a module, choose M here: the |
26 | module will be called serial. | 26 | module will be called 8250. |
27 | [WARNING: Do not compile this driver as a module if you are using | 27 | [WARNING: Do not compile this driver as a module if you are using |
28 | non-standard serial ports, since the configuration information will | 28 | non-standard serial ports, since the configuration information will |
29 | be lost when the driver is unloaded. This limitation may be lifted | 29 | be lost when the driver is unloaded. This limitation may be lifted |
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index 3490022e9fdc..429de2723a1c 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c | |||
@@ -566,7 +566,7 @@ static struct uart_amba_port amba_ports[UART_NR] = { | |||
566 | .uartclk = 14745600, | 566 | .uartclk = 14745600, |
567 | .fifosize = 16, | 567 | .fifosize = 16, |
568 | .ops = &amba_pl010_pops, | 568 | .ops = &amba_pl010_pops, |
569 | .flags = ASYNC_BOOT_AUTOCONF, | 569 | .flags = UPF_BOOT_AUTOCONF, |
570 | .line = 0, | 570 | .line = 0, |
571 | }, | 571 | }, |
572 | .dtr_mask = 1 << 5, | 572 | .dtr_mask = 1 << 5, |
@@ -581,7 +581,7 @@ static struct uart_amba_port amba_ports[UART_NR] = { | |||
581 | .uartclk = 14745600, | 581 | .uartclk = 14745600, |
582 | .fifosize = 16, | 582 | .fifosize = 16, |
583 | .ops = &amba_pl010_pops, | 583 | .ops = &amba_pl010_pops, |
584 | .flags = ASYNC_BOOT_AUTOCONF, | 584 | .flags = UPF_BOOT_AUTOCONF, |
585 | .line = 1, | 585 | .line = 1, |
586 | }, | 586 | }, |
587 | .dtr_mask = 1 << 7, | 587 | .dtr_mask = 1 << 7, |
diff --git a/drivers/serial/clps711x.c b/drivers/serial/clps711x.c index 8ef999481f93..ce7b2e4ecd17 100644 --- a/drivers/serial/clps711x.c +++ b/drivers/serial/clps711x.c | |||
@@ -410,7 +410,7 @@ static struct uart_port clps711x_ports[UART_NR] = { | |||
410 | .fifosize = 16, | 410 | .fifosize = 16, |
411 | .ops = &clps711x_pops, | 411 | .ops = &clps711x_pops, |
412 | .line = 0, | 412 | .line = 0, |
413 | .flags = ASYNC_BOOT_AUTOCONF, | 413 | .flags = UPF_BOOT_AUTOCONF, |
414 | }, | 414 | }, |
415 | { | 415 | { |
416 | .iobase = SYSCON2, | 416 | .iobase = SYSCON2, |
@@ -419,7 +419,7 @@ static struct uart_port clps711x_ports[UART_NR] = { | |||
419 | .fifosize = 16, | 419 | .fifosize = 16, |
420 | .ops = &clps711x_pops, | 420 | .ops = &clps711x_pops, |
421 | .line = 1, | 421 | .line = 1, |
422 | .flags = ASYNC_BOOT_AUTOCONF, | 422 | .flags = UPF_BOOT_AUTOCONF, |
423 | } | 423 | } |
424 | }; | 424 | }; |
425 | 425 | ||
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c index 587cc6a95114..858048efe1ed 100644 --- a/drivers/serial/imx.c +++ b/drivers/serial/imx.c | |||
@@ -402,10 +402,10 @@ static int imx_startup(struct uart_port *port) | |||
402 | DRIVER_NAME, sport); | 402 | DRIVER_NAME, sport); |
403 | if (retval) goto error_out2; | 403 | if (retval) goto error_out2; |
404 | 404 | ||
405 | retval = request_irq(sport->rtsirq, imx_rtsint, 0, | 405 | retval = request_irq(sport->rtsirq, imx_rtsint, |
406 | SA_TRIGGER_FALLING | SA_TRIGGER_RISING, | ||
406 | DRIVER_NAME, sport); | 407 | DRIVER_NAME, sport); |
407 | if (retval) goto error_out3; | 408 | if (retval) goto error_out3; |
408 | set_irq_type(sport->rtsirq, IRQT_BOTHEDGE); | ||
409 | 409 | ||
410 | /* | 410 | /* |
411 | * Finally, clear and enable interrupts | 411 | * Finally, clear and enable interrupts |
@@ -674,7 +674,7 @@ static struct imx_port imx_ports[] = { | |||
674 | .irq = UART1_MINT_RX, | 674 | .irq = UART1_MINT_RX, |
675 | .uartclk = 16000000, | 675 | .uartclk = 16000000, |
676 | .fifosize = 8, | 676 | .fifosize = 8, |
677 | .flags = ASYNC_BOOT_AUTOCONF, | 677 | .flags = UPF_BOOT_AUTOCONF, |
678 | .ops = &imx_pops, | 678 | .ops = &imx_pops, |
679 | .line = 0, | 679 | .line = 0, |
680 | }, | 680 | }, |
@@ -690,7 +690,7 @@ static struct imx_port imx_ports[] = { | |||
690 | .irq = UART2_MINT_RX, | 690 | .irq = UART2_MINT_RX, |
691 | .uartclk = 16000000, | 691 | .uartclk = 16000000, |
692 | .fifosize = 8, | 692 | .fifosize = 8, |
693 | .flags = ASYNC_BOOT_AUTOCONF, | 693 | .flags = UPF_BOOT_AUTOCONF, |
694 | .ops = &imx_pops, | 694 | .ops = &imx_pops, |
695 | .line = 1, | 695 | .line = 1, |
696 | }, | 696 | }, |
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index eb4883efb7c6..0a2dd6c5b95f 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c | |||
@@ -1060,7 +1060,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
1060 | dbg("resource %p (%lx..%lx)\n", res, res->start, res->end); | 1060 | dbg("resource %p (%lx..%lx)\n", res, res->start, res->end); |
1061 | 1061 | ||
1062 | port->mapbase = res->start; | 1062 | port->mapbase = res->start; |
1063 | port->membase = S3C24XX_VA_UART + (res->start - S3C2410_PA_UART); | 1063 | port->membase = S3C24XX_VA_UART + (res->start - S3C24XX_PA_UART); |
1064 | port->irq = platform_get_irq(platdev, 0); | 1064 | port->irq = platform_get_irq(platdev, 0); |
1065 | 1065 | ||
1066 | ourport->clk = clk_get(&platdev->dev, "uart"); | 1066 | ourport->clk = clk_get(&platdev->dev, "uart"); |
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index 1bd93168f504..ff7b60b4de37 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c | |||
@@ -665,21 +665,21 @@ void __init sa1100_register_uart(int idx, int port) | |||
665 | sa1100_ports[idx].port.membase = (void __iomem *)&Ser1UTCR0; | 665 | sa1100_ports[idx].port.membase = (void __iomem *)&Ser1UTCR0; |
666 | sa1100_ports[idx].port.mapbase = _Ser1UTCR0; | 666 | sa1100_ports[idx].port.mapbase = _Ser1UTCR0; |
667 | sa1100_ports[idx].port.irq = IRQ_Ser1UART; | 667 | sa1100_ports[idx].port.irq = IRQ_Ser1UART; |
668 | sa1100_ports[idx].port.flags = ASYNC_BOOT_AUTOCONF; | 668 | sa1100_ports[idx].port.flags = UPF_BOOT_AUTOCONF; |
669 | break; | 669 | break; |
670 | 670 | ||
671 | case 2: | 671 | case 2: |
672 | sa1100_ports[idx].port.membase = (void __iomem *)&Ser2UTCR0; | 672 | sa1100_ports[idx].port.membase = (void __iomem *)&Ser2UTCR0; |
673 | sa1100_ports[idx].port.mapbase = _Ser2UTCR0; | 673 | sa1100_ports[idx].port.mapbase = _Ser2UTCR0; |
674 | sa1100_ports[idx].port.irq = IRQ_Ser2ICP; | 674 | sa1100_ports[idx].port.irq = IRQ_Ser2ICP; |
675 | sa1100_ports[idx].port.flags = ASYNC_BOOT_AUTOCONF; | 675 | sa1100_ports[idx].port.flags = UPF_BOOT_AUTOCONF; |
676 | break; | 676 | break; |
677 | 677 | ||
678 | case 3: | 678 | case 3: |
679 | sa1100_ports[idx].port.membase = (void __iomem *)&Ser3UTCR0; | 679 | sa1100_ports[idx].port.membase = (void __iomem *)&Ser3UTCR0; |
680 | sa1100_ports[idx].port.mapbase = _Ser3UTCR0; | 680 | sa1100_ports[idx].port.mapbase = _Ser3UTCR0; |
681 | sa1100_ports[idx].port.irq = IRQ_Ser3UART; | 681 | sa1100_ports[idx].port.irq = IRQ_Ser3UART; |
682 | sa1100_ports[idx].port.flags = ASYNC_BOOT_AUTOCONF; | 682 | sa1100_ports[idx].port.flags = UPF_BOOT_AUTOCONF; |
683 | break; | 683 | break; |
684 | 684 | ||
685 | default: | 685 | default: |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 943770470b9d..0717abfdae06 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -332,7 +332,7 @@ uart_get_baud_rate(struct uart_port *port, struct termios *termios, | |||
332 | struct termios *old, unsigned int min, unsigned int max) | 332 | struct termios *old, unsigned int min, unsigned int max) |
333 | { | 333 | { |
334 | unsigned int try, baud, altbaud = 38400; | 334 | unsigned int try, baud, altbaud = 38400; |
335 | unsigned int flags = port->flags & UPF_SPD_MASK; | 335 | upf_t flags = port->flags & UPF_SPD_MASK; |
336 | 336 | ||
337 | if (flags == UPF_SPD_HI) | 337 | if (flags == UPF_SPD_HI) |
338 | altbaud = 57600; | 338 | altbaud = 57600; |
@@ -615,8 +615,9 @@ static int uart_set_info(struct uart_state *state, | |||
615 | struct serial_struct new_serial; | 615 | struct serial_struct new_serial; |
616 | struct uart_port *port = state->port; | 616 | struct uart_port *port = state->port; |
617 | unsigned long new_port; | 617 | unsigned long new_port; |
618 | unsigned int change_irq, change_port, old_flags, closing_wait; | 618 | unsigned int change_irq, change_port, closing_wait; |
619 | unsigned int old_custom_divisor, close_delay; | 619 | unsigned int old_custom_divisor, close_delay; |
620 | upf_t old_flags, new_flags; | ||
620 | int retval = 0; | 621 | int retval = 0; |
621 | 622 | ||
622 | if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) | 623 | if (copy_from_user(&new_serial, newinfo, sizeof(new_serial))) |
@@ -655,6 +656,7 @@ static int uart_set_info(struct uart_state *state, | |||
655 | new_serial.type != port->type; | 656 | new_serial.type != port->type; |
656 | 657 | ||
657 | old_flags = port->flags; | 658 | old_flags = port->flags; |
659 | new_flags = new_serial.flags; | ||
658 | old_custom_divisor = port->custom_divisor; | 660 | old_custom_divisor = port->custom_divisor; |
659 | 661 | ||
660 | if (!capable(CAP_SYS_ADMIN)) { | 662 | if (!capable(CAP_SYS_ADMIN)) { |
@@ -664,10 +666,10 @@ static int uart_set_info(struct uart_state *state, | |||
664 | (close_delay != state->close_delay) || | 666 | (close_delay != state->close_delay) || |
665 | (closing_wait != state->closing_wait) || | 667 | (closing_wait != state->closing_wait) || |
666 | (new_serial.xmit_fifo_size != port->fifosize) || | 668 | (new_serial.xmit_fifo_size != port->fifosize) || |
667 | (((new_serial.flags ^ old_flags) & ~UPF_USR_MASK) != 0)) | 669 | (((new_flags ^ old_flags) & ~UPF_USR_MASK) != 0)) |
668 | goto exit; | 670 | goto exit; |
669 | port->flags = ((port->flags & ~UPF_USR_MASK) | | 671 | port->flags = ((port->flags & ~UPF_USR_MASK) | |
670 | (new_serial.flags & UPF_USR_MASK)); | 672 | (new_flags & UPF_USR_MASK)); |
671 | port->custom_divisor = new_serial.custom_divisor; | 673 | port->custom_divisor = new_serial.custom_divisor; |
672 | goto check_and_exit; | 674 | goto check_and_exit; |
673 | } | 675 | } |
@@ -764,7 +766,7 @@ static int uart_set_info(struct uart_state *state, | |||
764 | port->irq = new_serial.irq; | 766 | port->irq = new_serial.irq; |
765 | port->uartclk = new_serial.baud_base * 16; | 767 | port->uartclk = new_serial.baud_base * 16; |
766 | port->flags = (port->flags & ~UPF_CHANGE_MASK) | | 768 | port->flags = (port->flags & ~UPF_CHANGE_MASK) | |
767 | (new_serial.flags & UPF_CHANGE_MASK); | 769 | (new_flags & UPF_CHANGE_MASK); |
768 | port->custom_divisor = new_serial.custom_divisor; | 770 | port->custom_divisor = new_serial.custom_divisor; |
769 | state->close_delay = close_delay; | 771 | state->close_delay = close_delay; |
770 | state->closing_wait = closing_wait; | 772 | state->closing_wait = closing_wait; |
@@ -1870,7 +1872,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port) | |||
1870 | mutex_lock(&state->mutex); | 1872 | mutex_lock(&state->mutex); |
1871 | 1873 | ||
1872 | if (state->info && state->info->flags & UIF_INITIALIZED) { | 1874 | if (state->info && state->info->flags & UIF_INITIALIZED) { |
1873 | struct uart_ops *ops = port->ops; | 1875 | const struct uart_ops *ops = port->ops; |
1874 | 1876 | ||
1875 | spin_lock_irq(&port->lock); | 1877 | spin_lock_irq(&port->lock); |
1876 | ops->stop_tx(port); | 1878 | ops->stop_tx(port); |
@@ -1932,7 +1934,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | |||
1932 | } | 1934 | } |
1933 | 1935 | ||
1934 | if (state->info && state->info->flags & UIF_INITIALIZED) { | 1936 | if (state->info && state->info->flags & UIF_INITIALIZED) { |
1935 | struct uart_ops *ops = port->ops; | 1937 | const struct uart_ops *ops = port->ops; |
1936 | int ret; | 1938 | int ret; |
1937 | 1939 | ||
1938 | ops->set_mctrl(port, 0); | 1940 | ops->set_mctrl(port, 0); |
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c index d4a1f0e798c1..d0490f67f597 100644 --- a/drivers/serial/serial_lh7a40x.c +++ b/drivers/serial/serial_lh7a40x.c | |||
@@ -506,7 +506,7 @@ static struct uart_port_lh7a40x lh7a40x_ports[DEV_NR] = { | |||
506 | .uartclk = 14745600/2, | 506 | .uartclk = 14745600/2, |
507 | .fifosize = 16, | 507 | .fifosize = 16, |
508 | .ops = &lh7a40x_uart_ops, | 508 | .ops = &lh7a40x_uart_ops, |
509 | .flags = ASYNC_BOOT_AUTOCONF, | 509 | .flags = UPF_BOOT_AUTOCONF, |
510 | .line = 0, | 510 | .line = 0, |
511 | }, | 511 | }, |
512 | }, | 512 | }, |
@@ -519,7 +519,7 @@ static struct uart_port_lh7a40x lh7a40x_ports[DEV_NR] = { | |||
519 | .uartclk = 14745600/2, | 519 | .uartclk = 14745600/2, |
520 | .fifosize = 16, | 520 | .fifosize = 16, |
521 | .ops = &lh7a40x_uart_ops, | 521 | .ops = &lh7a40x_uart_ops, |
522 | .flags = ASYNC_BOOT_AUTOCONF, | 522 | .flags = UPF_BOOT_AUTOCONF, |
523 | .line = 1, | 523 | .line = 1, |
524 | }, | 524 | }, |
525 | }, | 525 | }, |
@@ -532,7 +532,7 @@ static struct uart_port_lh7a40x lh7a40x_ports[DEV_NR] = { | |||
532 | .uartclk = 14745600/2, | 532 | .uartclk = 14745600/2, |
533 | .fifosize = 16, | 533 | .fifosize = 16, |
534 | .ops = &lh7a40x_uart_ops, | 534 | .ops = &lh7a40x_uart_ops, |
535 | .flags = ASYNC_BOOT_AUTOCONF, | 535 | .flags = UPF_BOOT_AUTOCONF, |
536 | .line = 2, | 536 | .line = 2, |
537 | }, | 537 | }, |
538 | }, | 538 | }, |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index a9e070759628..0111206327ca 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -1113,10 +1113,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1113 | .port = { | 1113 | .port = { |
1114 | .membase = (void *)0xfffffe80, | 1114 | .membase = (void *)0xfffffe80, |
1115 | .mapbase = 0xfffffe80, | 1115 | .mapbase = 0xfffffe80, |
1116 | .iotype = SERIAL_IO_MEM, | 1116 | .iotype = UPIO_MEM, |
1117 | .irq = 25, | 1117 | .irq = 25, |
1118 | .ops = &sci_uart_ops, | 1118 | .ops = &sci_uart_ops, |
1119 | .flags = ASYNC_BOOT_AUTOCONF, | 1119 | .flags = UPF_BOOT_AUTOCONF, |
1120 | .line = 0, | 1120 | .line = 0, |
1121 | }, | 1121 | }, |
1122 | .type = PORT_SCI, | 1122 | .type = PORT_SCI, |
@@ -1128,10 +1128,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1128 | .port = { | 1128 | .port = { |
1129 | .membase = (void *)SCIF0, | 1129 | .membase = (void *)SCIF0, |
1130 | .mapbase = SCIF0, | 1130 | .mapbase = SCIF0, |
1131 | .iotype = SERIAL_IO_MEM, | 1131 | .iotype = UPIO_MEM, |
1132 | .irq = 55, | 1132 | .irq = 55, |
1133 | .ops = &sci_uart_ops, | 1133 | .ops = &sci_uart_ops, |
1134 | .flags = ASYNC_BOOT_AUTOCONF, | 1134 | .flags = UPF_BOOT_AUTOCONF, |
1135 | .line = 0, | 1135 | .line = 0, |
1136 | }, | 1136 | }, |
1137 | .type = PORT_SCIF, | 1137 | .type = PORT_SCIF, |
@@ -1142,10 +1142,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1142 | .port = { | 1142 | .port = { |
1143 | .membase = (void *)SCIF2, | 1143 | .membase = (void *)SCIF2, |
1144 | .mapbase = SCIF2, | 1144 | .mapbase = SCIF2, |
1145 | .iotype = SERIAL_IO_MEM, | 1145 | .iotype = UPIO_MEM, |
1146 | .irq = 59, | 1146 | .irq = 59, |
1147 | .ops = &sci_uart_ops, | 1147 | .ops = &sci_uart_ops, |
1148 | .flags = ASYNC_BOOT_AUTOCONF, | 1148 | .flags = UPF_BOOT_AUTOCONF, |
1149 | .line = 1, | 1149 | .line = 1, |
1150 | }, | 1150 | }, |
1151 | .type = PORT_SCIF, | 1151 | .type = PORT_SCIF, |
@@ -1157,10 +1157,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1157 | .port = { | 1157 | .port = { |
1158 | .membase = (void *)0xfffffe80, | 1158 | .membase = (void *)0xfffffe80, |
1159 | .mapbase = 0xfffffe80, | 1159 | .mapbase = 0xfffffe80, |
1160 | .iotype = SERIAL_IO_MEM, | 1160 | .iotype = UPIO_MEM, |
1161 | .irq = 25, | 1161 | .irq = 25, |
1162 | .ops = &sci_uart_ops, | 1162 | .ops = &sci_uart_ops, |
1163 | .flags = ASYNC_BOOT_AUTOCONF, | 1163 | .flags = UPF_BOOT_AUTOCONF, |
1164 | .line = 0, | 1164 | .line = 0, |
1165 | }, | 1165 | }, |
1166 | .type = PORT_SCI, | 1166 | .type = PORT_SCI, |
@@ -1171,10 +1171,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1171 | .port = { | 1171 | .port = { |
1172 | .membase = (void *)0xa4000150, | 1172 | .membase = (void *)0xa4000150, |
1173 | .mapbase = 0xa4000150, | 1173 | .mapbase = 0xa4000150, |
1174 | .iotype = SERIAL_IO_MEM, | 1174 | .iotype = UPIO_MEM, |
1175 | .irq = 59, | 1175 | .irq = 59, |
1176 | .ops = &sci_uart_ops, | 1176 | .ops = &sci_uart_ops, |
1177 | .flags = ASYNC_BOOT_AUTOCONF, | 1177 | .flags = UPF_BOOT_AUTOCONF, |
1178 | .line = 1, | 1178 | .line = 1, |
1179 | }, | 1179 | }, |
1180 | .type = PORT_SCIF, | 1180 | .type = PORT_SCIF, |
@@ -1185,10 +1185,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1185 | .port = { | 1185 | .port = { |
1186 | .membase = (void *)0xa4000140, | 1186 | .membase = (void *)0xa4000140, |
1187 | .mapbase = 0xa4000140, | 1187 | .mapbase = 0xa4000140, |
1188 | .iotype = SERIAL_IO_MEM, | 1188 | .iotype = UPIO_MEM, |
1189 | .irq = 55, | 1189 | .irq = 55, |
1190 | .ops = &sci_uart_ops, | 1190 | .ops = &sci_uart_ops, |
1191 | .flags = ASYNC_BOOT_AUTOCONF, | 1191 | .flags = UPF_BOOT_AUTOCONF, |
1192 | .line = 2, | 1192 | .line = 2, |
1193 | }, | 1193 | }, |
1194 | .type = PORT_IRDA, | 1194 | .type = PORT_IRDA, |
@@ -1200,10 +1200,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1200 | .port = { | 1200 | .port = { |
1201 | .membase = (void *)0xA4430000, | 1201 | .membase = (void *)0xA4430000, |
1202 | .mapbase = 0xA4430000, | 1202 | .mapbase = 0xA4430000, |
1203 | .iotype = SERIAL_IO_MEM, | 1203 | .iotype = UPIO_MEM, |
1204 | .irq = 25, | 1204 | .irq = 25, |
1205 | .ops = &sci_uart_ops, | 1205 | .ops = &sci_uart_ops, |
1206 | .flags = ASYNC_BOOT_AUTOCONF, | 1206 | .flags = UPF_BOOT_AUTOCONF, |
1207 | .line = 0, | 1207 | .line = 0, |
1208 | }, | 1208 | }, |
1209 | .type = PORT_SCIF, | 1209 | .type = PORT_SCIF, |
@@ -1215,10 +1215,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1215 | .port = { | 1215 | .port = { |
1216 | .membase = (void *)0xffe00000, | 1216 | .membase = (void *)0xffe00000, |
1217 | .mapbase = 0xffe00000, | 1217 | .mapbase = 0xffe00000, |
1218 | .iotype = SERIAL_IO_MEM, | 1218 | .iotype = UPIO_MEM, |
1219 | .irq = 25, | 1219 | .irq = 25, |
1220 | .ops = &sci_uart_ops, | 1220 | .ops = &sci_uart_ops, |
1221 | .flags = ASYNC_BOOT_AUTOCONF, | 1221 | .flags = UPF_BOOT_AUTOCONF, |
1222 | .line = 0, | 1222 | .line = 0, |
1223 | }, | 1223 | }, |
1224 | .type = PORT_SCIF, | 1224 | .type = PORT_SCIF, |
@@ -1230,10 +1230,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1230 | .port = { | 1230 | .port = { |
1231 | .membase = (void *)0xffe80000, | 1231 | .membase = (void *)0xffe80000, |
1232 | .mapbase = 0xffe80000, | 1232 | .mapbase = 0xffe80000, |
1233 | .iotype = SERIAL_IO_MEM, | 1233 | .iotype = UPIO_MEM, |
1234 | .irq = 43, | 1234 | .irq = 43, |
1235 | .ops = &sci_uart_ops, | 1235 | .ops = &sci_uart_ops, |
1236 | .flags = ASYNC_BOOT_AUTOCONF, | 1236 | .flags = UPF_BOOT_AUTOCONF, |
1237 | .line = 0, | 1237 | .line = 0, |
1238 | }, | 1238 | }, |
1239 | .type = PORT_SCIF, | 1239 | .type = PORT_SCIF, |
@@ -1245,10 +1245,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1245 | .port = { | 1245 | .port = { |
1246 | .membase = (void *)0xffe00000, | 1246 | .membase = (void *)0xffe00000, |
1247 | .mapbase = 0xffe00000, | 1247 | .mapbase = 0xffe00000, |
1248 | .iotype = SERIAL_IO_MEM, | 1248 | .iotype = UPIO_MEM, |
1249 | .irq = 25, | 1249 | .irq = 25, |
1250 | .ops = &sci_uart_ops, | 1250 | .ops = &sci_uart_ops, |
1251 | .flags = ASYNC_BOOT_AUTOCONF, | 1251 | .flags = UPF_BOOT_AUTOCONF, |
1252 | .line = 0, | 1252 | .line = 0, |
1253 | }, | 1253 | }, |
1254 | .type = PORT_SCI, | 1254 | .type = PORT_SCI, |
@@ -1259,10 +1259,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1259 | .port = { | 1259 | .port = { |
1260 | .membase = (void *)0xffe80000, | 1260 | .membase = (void *)0xffe80000, |
1261 | .mapbase = 0xffe80000, | 1261 | .mapbase = 0xffe80000, |
1262 | .iotype = SERIAL_IO_MEM, | 1262 | .iotype = UPIO_MEM, |
1263 | .irq = 43, | 1263 | .irq = 43, |
1264 | .ops = &sci_uart_ops, | 1264 | .ops = &sci_uart_ops, |
1265 | .flags = ASYNC_BOOT_AUTOCONF, | 1265 | .flags = UPF_BOOT_AUTOCONF, |
1266 | .line = 1, | 1266 | .line = 1, |
1267 | }, | 1267 | }, |
1268 | .type = PORT_SCIF, | 1268 | .type = PORT_SCIF, |
@@ -1274,10 +1274,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1274 | .port = { | 1274 | .port = { |
1275 | .membase = (void *)0xfe600000, | 1275 | .membase = (void *)0xfe600000, |
1276 | .mapbase = 0xfe600000, | 1276 | .mapbase = 0xfe600000, |
1277 | .iotype = SERIAL_IO_MEM, | 1277 | .iotype = UPIO_MEM, |
1278 | .irq = 55, | 1278 | .irq = 55, |
1279 | .ops = &sci_uart_ops, | 1279 | .ops = &sci_uart_ops, |
1280 | .flags = ASYNC_BOOT_AUTOCONF, | 1280 | .flags = UPF_BOOT_AUTOCONF, |
1281 | .line = 0, | 1281 | .line = 0, |
1282 | }, | 1282 | }, |
1283 | .type = PORT_SCIF, | 1283 | .type = PORT_SCIF, |
@@ -1288,10 +1288,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1288 | .port = { | 1288 | .port = { |
1289 | .membase = (void *)0xfe610000, | 1289 | .membase = (void *)0xfe610000, |
1290 | .mapbase = 0xfe610000, | 1290 | .mapbase = 0xfe610000, |
1291 | .iotype = SERIAL_IO_MEM, | 1291 | .iotype = UPIO_MEM, |
1292 | .irq = 75, | 1292 | .irq = 75, |
1293 | .ops = &sci_uart_ops, | 1293 | .ops = &sci_uart_ops, |
1294 | .flags = ASYNC_BOOT_AUTOCONF, | 1294 | .flags = UPF_BOOT_AUTOCONF, |
1295 | .line = 1, | 1295 | .line = 1, |
1296 | }, | 1296 | }, |
1297 | .type = PORT_SCIF, | 1297 | .type = PORT_SCIF, |
@@ -1302,10 +1302,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1302 | .port = { | 1302 | .port = { |
1303 | .membase = (void *)0xfe620000, | 1303 | .membase = (void *)0xfe620000, |
1304 | .mapbase = 0xfe620000, | 1304 | .mapbase = 0xfe620000, |
1305 | .iotype = SERIAL_IO_MEM, | 1305 | .iotype = UPIO_MEM, |
1306 | .irq = 79, | 1306 | .irq = 79, |
1307 | .ops = &sci_uart_ops, | 1307 | .ops = &sci_uart_ops, |
1308 | .flags = ASYNC_BOOT_AUTOCONF, | 1308 | .flags = UPF_BOOT_AUTOCONF, |
1309 | .line = 2, | 1309 | .line = 2, |
1310 | }, | 1310 | }, |
1311 | .type = PORT_SCIF, | 1311 | .type = PORT_SCIF, |
@@ -1317,10 +1317,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1317 | .port = { | 1317 | .port = { |
1318 | .membase = (void *)0xffe80000, | 1318 | .membase = (void *)0xffe80000, |
1319 | .mapbase = 0xffe80000, | 1319 | .mapbase = 0xffe80000, |
1320 | .iotype = SERIAL_IO_MEM, | 1320 | .iotype = UPIO_MEM, |
1321 | .irq = 43, | 1321 | .irq = 43, |
1322 | .ops = &sci_uart_ops, | 1322 | .ops = &sci_uart_ops, |
1323 | .flags = ASYNC_BOOT_AUTOCONF, | 1323 | .flags = UPF_BOOT_AUTOCONF, |
1324 | .line = 0, | 1324 | .line = 0, |
1325 | }, | 1325 | }, |
1326 | .type = PORT_SCIF, | 1326 | .type = PORT_SCIF, |
@@ -1332,10 +1332,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1332 | .port = { | 1332 | .port = { |
1333 | .membase = (void *)0xffe00000, | 1333 | .membase = (void *)0xffe00000, |
1334 | .mapbase = 0xffe00000, | 1334 | .mapbase = 0xffe00000, |
1335 | .iotype = SERIAL_IO_MEM, | 1335 | .iotype = UPIO_MEM, |
1336 | .irq = 26, | 1336 | .irq = 26, |
1337 | .ops = &sci_uart_ops, | 1337 | .ops = &sci_uart_ops, |
1338 | .flags = ASYNC_BOOT_AUTOCONF, | 1338 | .flags = UPF_BOOT_AUTOCONF, |
1339 | .line = 0, | 1339 | .line = 0, |
1340 | }, | 1340 | }, |
1341 | .type = PORT_SCIF, | 1341 | .type = PORT_SCIF, |
@@ -1346,10 +1346,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1346 | .port = { | 1346 | .port = { |
1347 | .membase = (void *)0xffe80000, | 1347 | .membase = (void *)0xffe80000, |
1348 | .mapbase = 0xffe80000, | 1348 | .mapbase = 0xffe80000, |
1349 | .iotype = SERIAL_IO_MEM, | 1349 | .iotype = UPIO_MEM, |
1350 | .irq = 43, | 1350 | .irq = 43, |
1351 | .ops = &sci_uart_ops, | 1351 | .ops = &sci_uart_ops, |
1352 | .flags = ASYNC_BOOT_AUTOCONF, | 1352 | .flags = UPF_BOOT_AUTOCONF, |
1353 | .line = 1, | 1353 | .line = 1, |
1354 | }, | 1354 | }, |
1355 | .type = PORT_SCIF, | 1355 | .type = PORT_SCIF, |
@@ -1359,10 +1359,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1359 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) | 1359 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) |
1360 | { | 1360 | { |
1361 | .port = { | 1361 | .port = { |
1362 | .iotype = SERIAL_IO_MEM, | 1362 | .iotype = UPIO_MEM, |
1363 | .irq = 42, | 1363 | .irq = 42, |
1364 | .ops = &sci_uart_ops, | 1364 | .ops = &sci_uart_ops, |
1365 | .flags = ASYNC_BOOT_AUTOCONF, | 1365 | .flags = UPF_BOOT_AUTOCONF, |
1366 | .line = 0, | 1366 | .line = 0, |
1367 | }, | 1367 | }, |
1368 | .type = PORT_SCIF, | 1368 | .type = PORT_SCIF, |
@@ -1374,10 +1374,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1374 | .port = { | 1374 | .port = { |
1375 | .membase = (void *)0x00ffffb0, | 1375 | .membase = (void *)0x00ffffb0, |
1376 | .mapbase = 0x00ffffb0, | 1376 | .mapbase = 0x00ffffb0, |
1377 | .iotype = SERIAL_IO_MEM, | 1377 | .iotype = UPIO_MEM, |
1378 | .irq = 54, | 1378 | .irq = 54, |
1379 | .ops = &sci_uart_ops, | 1379 | .ops = &sci_uart_ops, |
1380 | .flags = ASYNC_BOOT_AUTOCONF, | 1380 | .flags = UPF_BOOT_AUTOCONF, |
1381 | .line = 0, | 1381 | .line = 0, |
1382 | }, | 1382 | }, |
1383 | .type = PORT_SCI, | 1383 | .type = PORT_SCI, |
@@ -1388,10 +1388,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1388 | .port = { | 1388 | .port = { |
1389 | .membase = (void *)0x00ffffb8, | 1389 | .membase = (void *)0x00ffffb8, |
1390 | .mapbase = 0x00ffffb8, | 1390 | .mapbase = 0x00ffffb8, |
1391 | .iotype = SERIAL_IO_MEM, | 1391 | .iotype = UPIO_MEM, |
1392 | .irq = 58, | 1392 | .irq = 58, |
1393 | .ops = &sci_uart_ops, | 1393 | .ops = &sci_uart_ops, |
1394 | .flags = ASYNC_BOOT_AUTOCONF, | 1394 | .flags = UPF_BOOT_AUTOCONF, |
1395 | .line = 1, | 1395 | .line = 1, |
1396 | }, | 1396 | }, |
1397 | .type = PORT_SCI, | 1397 | .type = PORT_SCI, |
@@ -1402,10 +1402,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1402 | .port = { | 1402 | .port = { |
1403 | .membase = (void *)0x00ffffc0, | 1403 | .membase = (void *)0x00ffffc0, |
1404 | .mapbase = 0x00ffffc0, | 1404 | .mapbase = 0x00ffffc0, |
1405 | .iotype = SERIAL_IO_MEM, | 1405 | .iotype = UPIO_MEM, |
1406 | .irq = 62, | 1406 | .irq = 62, |
1407 | .ops = &sci_uart_ops, | 1407 | .ops = &sci_uart_ops, |
1408 | .flags = ASYNC_BOOT_AUTOCONF, | 1408 | .flags = UPF_BOOT_AUTOCONF, |
1409 | .line = 2, | 1409 | .line = 2, |
1410 | }, | 1410 | }, |
1411 | .type = PORT_SCI, | 1411 | .type = PORT_SCI, |
@@ -1417,10 +1417,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1417 | .port = { | 1417 | .port = { |
1418 | .membase = (void *)0x00ffff78, | 1418 | .membase = (void *)0x00ffff78, |
1419 | .mapbase = 0x00ffff78, | 1419 | .mapbase = 0x00ffff78, |
1420 | .iotype = SERIAL_IO_MEM, | 1420 | .iotype = UPIO_MEM, |
1421 | .irq = 90, | 1421 | .irq = 90, |
1422 | .ops = &sci_uart_ops, | 1422 | .ops = &sci_uart_ops, |
1423 | .flags = ASYNC_BOOT_AUTOCONF, | 1423 | .flags = UPF_BOOT_AUTOCONF, |
1424 | .line = 0, | 1424 | .line = 0, |
1425 | }, | 1425 | }, |
1426 | .type = PORT_SCI, | 1426 | .type = PORT_SCI, |
@@ -1431,10 +1431,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1431 | .port = { | 1431 | .port = { |
1432 | .membase = (void *)0x00ffff80, | 1432 | .membase = (void *)0x00ffff80, |
1433 | .mapbase = 0x00ffff80, | 1433 | .mapbase = 0x00ffff80, |
1434 | .iotype = SERIAL_IO_MEM, | 1434 | .iotype = UPIO_MEM, |
1435 | .irq = 94, | 1435 | .irq = 94, |
1436 | .ops = &sci_uart_ops, | 1436 | .ops = &sci_uart_ops, |
1437 | .flags = ASYNC_BOOT_AUTOCONF, | 1437 | .flags = UPF_BOOT_AUTOCONF, |
1438 | .line = 1, | 1438 | .line = 1, |
1439 | }, | 1439 | }, |
1440 | .type = PORT_SCI, | 1440 | .type = PORT_SCI, |
@@ -1445,10 +1445,10 @@ static struct sci_port sci_ports[SCI_NPORTS] = { | |||
1445 | .port = { | 1445 | .port = { |
1446 | .membase = (void *)0x00ffff88, | 1446 | .membase = (void *)0x00ffff88, |
1447 | .mapbase = 0x00ffff88, | 1447 | .mapbase = 0x00ffff88, |
1448 | .iotype = SERIAL_IO_MEM, | 1448 | .iotype = UPIO_MEM, |
1449 | .irq = 98, | 1449 | .irq = 98, |
1450 | .ops = &sci_uart_ops, | 1450 | .ops = &sci_uart_ops, |
1451 | .flags = ASYNC_BOOT_AUTOCONF, | 1451 | .flags = UPF_BOOT_AUTOCONF, |
1452 | .line = 2, | 1452 | .line = 2, |
1453 | }, | 1453 | }, |
1454 | .type = PORT_SCI, | 1454 | .type = PORT_SCI, |
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 9a3665b34d97..bc67442c6b4c 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c | |||
@@ -669,7 +669,7 @@ static int sunsu_startup(struct uart_port *port) | |||
669 | * if it is, then bail out, because there's likely no UART | 669 | * if it is, then bail out, because there's likely no UART |
670 | * here. | 670 | * here. |
671 | */ | 671 | */ |
672 | if (!(up->port.flags & ASYNC_BUGGY_UART) && | 672 | if (!(up->port.flags & UPF_BUGGY_UART) && |
673 | (serial_inp(up, UART_LSR) == 0xff)) { | 673 | (serial_inp(up, UART_LSR) == 0xff)) { |
674 | printk("ttyS%d: LSR safety check engaged!\n", up->port.line); | 674 | printk("ttyS%d: LSR safety check engaged!\n", up->port.line); |
675 | return -ENODEV; | 675 | return -ENODEV; |
@@ -707,7 +707,7 @@ static int sunsu_startup(struct uart_port *port) | |||
707 | up->ier = UART_IER_RLSI | UART_IER_RDI; | 707 | up->ier = UART_IER_RLSI | UART_IER_RDI; |
708 | serial_outp(up, UART_IER, up->ier); | 708 | serial_outp(up, UART_IER, up->ier); |
709 | 709 | ||
710 | if (up->port.flags & ASYNC_FOURPORT) { | 710 | if (up->port.flags & UPF_FOURPORT) { |
711 | unsigned int icp; | 711 | unsigned int icp; |
712 | /* | 712 | /* |
713 | * Enable interrupts on the AST Fourport board | 713 | * Enable interrupts on the AST Fourport board |
@@ -740,7 +740,7 @@ static void sunsu_shutdown(struct uart_port *port) | |||
740 | serial_outp(up, UART_IER, 0); | 740 | serial_outp(up, UART_IER, 0); |
741 | 741 | ||
742 | spin_lock_irqsave(&up->port.lock, flags); | 742 | spin_lock_irqsave(&up->port.lock, flags); |
743 | if (up->port.flags & ASYNC_FOURPORT) { | 743 | if (up->port.flags & UPF_FOURPORT) { |
744 | /* reset interrupts on the AST Fourport board */ | 744 | /* reset interrupts on the AST Fourport board */ |
745 | inb((up->port.iobase & 0xfe0) | 0x1f); | 745 | inb((up->port.iobase & 0xfe0) | 0x1f); |
746 | up->port.mctrl |= TIOCM_OUT1; | 746 | up->port.mctrl |= TIOCM_OUT1; |
@@ -1132,7 +1132,7 @@ ebus_done: | |||
1132 | 1132 | ||
1133 | spin_lock_irqsave(&up->port.lock, flags); | 1133 | spin_lock_irqsave(&up->port.lock, flags); |
1134 | 1134 | ||
1135 | if (!(up->port.flags & ASYNC_BUGGY_UART)) { | 1135 | if (!(up->port.flags & UPF_BUGGY_UART)) { |
1136 | /* | 1136 | /* |
1137 | * Do a simple existence test first; if we fail this, there's | 1137 | * Do a simple existence test first; if we fail this, there's |
1138 | * no point trying anything else. | 1138 | * no point trying anything else. |
@@ -1170,7 +1170,7 @@ ebus_done: | |||
1170 | * manufacturer would be stupid enough to design a board | 1170 | * manufacturer would be stupid enough to design a board |
1171 | * that conflicts with COM 1-4 --- we hope! | 1171 | * that conflicts with COM 1-4 --- we hope! |
1172 | */ | 1172 | */ |
1173 | if (!(up->port.flags & ASYNC_SKIP_TEST)) { | 1173 | if (!(up->port.flags & UPF_SKIP_TEST)) { |
1174 | serial_outp(up, UART_MCR, UART_MCR_LOOP | 0x0A); | 1174 | serial_outp(up, UART_MCR, UART_MCR_LOOP | 0x0A); |
1175 | status1 = serial_inp(up, UART_MSR) & 0xF0; | 1175 | status1 = serial_inp(up, UART_MSR) & 0xF0; |
1176 | serial_outp(up, UART_MCR, save_mcr); | 1176 | serial_outp(up, UART_MCR, save_mcr); |
@@ -1371,7 +1371,7 @@ static __inline__ void wait_for_xmitr(struct uart_sunsu_port *up) | |||
1371 | } while ((status & BOTH_EMPTY) != BOTH_EMPTY); | 1371 | } while ((status & BOTH_EMPTY) != BOTH_EMPTY); |
1372 | 1372 | ||
1373 | /* Wait up to 1s for flow control if necessary */ | 1373 | /* Wait up to 1s for flow control if necessary */ |
1374 | if (up->port.flags & ASYNC_CONS_FLOW) { | 1374 | if (up->port.flags & UPF_CONS_FLOW) { |
1375 | tmout = 1000000; | 1375 | tmout = 1000000; |
1376 | while (--tmout && | 1376 | while (--tmout && |
1377 | ((serial_in(up, UART_MSR) & UART_MSR_CTS) == 0)) | 1377 | ((serial_in(up, UART_MSR) & UART_MSR_CTS) == 0)) |
@@ -1513,7 +1513,7 @@ static int __init sunsu_serial_init(void) | |||
1513 | up->su_type == SU_PORT_KBD) | 1513 | up->su_type == SU_PORT_KBD) |
1514 | continue; | 1514 | continue; |
1515 | 1515 | ||
1516 | up->port.flags |= ASYNC_BOOT_AUTOCONF; | 1516 | up->port.flags |= UPF_BOOT_AUTOCONF; |
1517 | up->port.type = PORT_UNKNOWN; | 1517 | up->port.type = PORT_UNKNOWN; |
1518 | up->port.uartclk = (SU_BASE_BAUD * 16); | 1518 | up->port.uartclk = (SU_BASE_BAUD * 16); |
1519 | 1519 | ||
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index 3639c3f8d357..36e476dd9123 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -38,6 +38,7 @@ obj-$(CONFIG_USB_XPAD) += input/ | |||
38 | 38 | ||
39 | obj-$(CONFIG_USB_DABUSB) += media/ | 39 | obj-$(CONFIG_USB_DABUSB) += media/ |
40 | obj-$(CONFIG_USB_DSBR) += media/ | 40 | obj-$(CONFIG_USB_DSBR) += media/ |
41 | obj-$(CONFIG_USB_ET61X251) += media/ | ||
41 | obj-$(CONFIG_USB_IBMCAM) += media/ | 42 | obj-$(CONFIG_USB_IBMCAM) += media/ |
42 | obj-$(CONFIG_USB_KONICAWC) += media/ | 43 | obj-$(CONFIG_USB_KONICAWC) += media/ |
43 | obj-$(CONFIG_USB_OV511) += media/ | 44 | obj-$(CONFIG_USB_OV511) += media/ |
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index af0a41e7870e..04631dcbabbc 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/init.h> | 36 | #include <linux/init.h> |
37 | #include <linux/device.h> /* FIXME: linux/firmware.h should include it itself */ | 37 | #include <linux/device.h> /* FIXME: linux/firmware.h should include it itself */ |
38 | #include <linux/firmware.h> | 38 | #include <linux/firmware.h> |
39 | #include <linux/mutex.h> | ||
39 | 40 | ||
40 | #include "usbatm.h" | 41 | #include "usbatm.h" |
41 | 42 | ||
@@ -160,7 +161,7 @@ struct cxacru_data { | |||
160 | struct work_struct poll_work; | 161 | struct work_struct poll_work; |
161 | 162 | ||
162 | /* contol handles */ | 163 | /* contol handles */ |
163 | struct semaphore cm_serialize; | 164 | struct mutex cm_serialize; |
164 | u8 *rcv_buf; | 165 | u8 *rcv_buf; |
165 | u8 *snd_buf; | 166 | u8 *snd_buf; |
166 | struct urb *rcv_urb; | 167 | struct urb *rcv_urb; |
@@ -219,7 +220,7 @@ static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm, | |||
219 | goto fail; | 220 | goto fail; |
220 | } | 221 | } |
221 | 222 | ||
222 | down(&instance->cm_serialize); | 223 | mutex_lock(&instance->cm_serialize); |
223 | 224 | ||
224 | /* submit reading urb before the writing one */ | 225 | /* submit reading urb before the writing one */ |
225 | init_completion(&instance->rcv_done); | 226 | init_completion(&instance->rcv_done); |
@@ -288,7 +289,7 @@ static int cxacru_cm(struct cxacru_data *instance, enum cxacru_cm_request cm, | |||
288 | ret = offd; | 289 | ret = offd; |
289 | dbg("cm %#x", cm); | 290 | dbg("cm %#x", cm); |
290 | fail: | 291 | fail: |
291 | up(&instance->cm_serialize); | 292 | mutex_unlock(&instance->cm_serialize); |
292 | return ret; | 293 | return ret; |
293 | } | 294 | } |
294 | 295 | ||
@@ -352,7 +353,6 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance, | |||
352 | struct atm_dev *atm_dev) | 353 | struct atm_dev *atm_dev) |
353 | { | 354 | { |
354 | struct cxacru_data *instance = usbatm_instance->driver_data; | 355 | struct cxacru_data *instance = usbatm_instance->driver_data; |
355 | struct device *dev = &usbatm_instance->usb_intf->dev; | ||
356 | /* | 356 | /* |
357 | struct atm_dev *atm_dev = usbatm_instance->atm_dev; | 357 | struct atm_dev *atm_dev = usbatm_instance->atm_dev; |
358 | */ | 358 | */ |
@@ -364,14 +364,14 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance, | |||
364 | ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_MAC_ADDRESS, NULL, 0, | 364 | ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_MAC_ADDRESS, NULL, 0, |
365 | atm_dev->esi, sizeof(atm_dev->esi)); | 365 | atm_dev->esi, sizeof(atm_dev->esi)); |
366 | if (ret < 0) { | 366 | if (ret < 0) { |
367 | dev_err(dev, "cxacru_atm_start: CARD_GET_MAC_ADDRESS returned %d\n", ret); | 367 | atm_err(usbatm_instance, "cxacru_atm_start: CARD_GET_MAC_ADDRESS returned %d\n", ret); |
368 | return ret; | 368 | return ret; |
369 | } | 369 | } |
370 | 370 | ||
371 | /* start ADSL */ | 371 | /* start ADSL */ |
372 | ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0); | 372 | ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0); |
373 | if (ret < 0) { | 373 | if (ret < 0) { |
374 | dev_err(dev, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret); | 374 | atm_err(usbatm_instance, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret); |
375 | return ret; | 375 | return ret; |
376 | } | 376 | } |
377 | 377 | ||
@@ -383,13 +383,13 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance, | |||
383 | static void cxacru_poll_status(struct cxacru_data *instance) | 383 | static void cxacru_poll_status(struct cxacru_data *instance) |
384 | { | 384 | { |
385 | u32 buf[CXINF_MAX] = {}; | 385 | u32 buf[CXINF_MAX] = {}; |
386 | struct device *dev = &instance->usbatm->usb_intf->dev; | 386 | struct usbatm_data *usbatm = instance->usbatm; |
387 | struct atm_dev *atm_dev = instance->usbatm->atm_dev; | 387 | struct atm_dev *atm_dev = usbatm->atm_dev; |
388 | int ret; | 388 | int ret; |
389 | 389 | ||
390 | ret = cxacru_cm_get_array(instance, CM_REQUEST_CARD_INFO_GET, buf, CXINF_MAX); | 390 | ret = cxacru_cm_get_array(instance, CM_REQUEST_CARD_INFO_GET, buf, CXINF_MAX); |
391 | if (ret < 0) { | 391 | if (ret < 0) { |
392 | dev_warn(dev, "poll status: error %d\n", ret); | 392 | atm_warn(usbatm, "poll status: error %d\n", ret); |
393 | goto reschedule; | 393 | goto reschedule; |
394 | } | 394 | } |
395 | 395 | ||
@@ -400,50 +400,50 @@ static void cxacru_poll_status(struct cxacru_data *instance) | |||
400 | switch (instance->line_status) { | 400 | switch (instance->line_status) { |
401 | case 0: | 401 | case 0: |
402 | atm_dev->signal = ATM_PHY_SIG_LOST; | 402 | atm_dev->signal = ATM_PHY_SIG_LOST; |
403 | dev_info(dev, "ADSL line: down\n"); | 403 | atm_info(usbatm, "ADSL line: down\n"); |
404 | break; | 404 | break; |
405 | 405 | ||
406 | case 1: | 406 | case 1: |
407 | atm_dev->signal = ATM_PHY_SIG_LOST; | 407 | atm_dev->signal = ATM_PHY_SIG_LOST; |
408 | dev_info(dev, "ADSL line: attemtping to activate\n"); | 408 | atm_info(usbatm, "ADSL line: attempting to activate\n"); |
409 | break; | 409 | break; |
410 | 410 | ||
411 | case 2: | 411 | case 2: |
412 | atm_dev->signal = ATM_PHY_SIG_LOST; | 412 | atm_dev->signal = ATM_PHY_SIG_LOST; |
413 | dev_info(dev, "ADSL line: training\n"); | 413 | atm_info(usbatm, "ADSL line: training\n"); |
414 | break; | 414 | break; |
415 | 415 | ||
416 | case 3: | 416 | case 3: |
417 | atm_dev->signal = ATM_PHY_SIG_LOST; | 417 | atm_dev->signal = ATM_PHY_SIG_LOST; |
418 | dev_info(dev, "ADSL line: channel analysis\n"); | 418 | atm_info(usbatm, "ADSL line: channel analysis\n"); |
419 | break; | 419 | break; |
420 | 420 | ||
421 | case 4: | 421 | case 4: |
422 | atm_dev->signal = ATM_PHY_SIG_LOST; | 422 | atm_dev->signal = ATM_PHY_SIG_LOST; |
423 | dev_info(dev, "ADSL line: exchange\n"); | 423 | atm_info(usbatm, "ADSL line: exchange\n"); |
424 | break; | 424 | break; |
425 | 425 | ||
426 | case 5: | 426 | case 5: |
427 | atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424; | 427 | atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424; |
428 | atm_dev->signal = ATM_PHY_SIG_FOUND; | 428 | atm_dev->signal = ATM_PHY_SIG_FOUND; |
429 | 429 | ||
430 | dev_info(dev, "ADSL line: up (%d kb/s down | %d kb/s up)\n", | 430 | atm_info(usbatm, "ADSL line: up (%d kb/s down | %d kb/s up)\n", |
431 | buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]); | 431 | buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]); |
432 | break; | 432 | break; |
433 | 433 | ||
434 | case 6: | 434 | case 6: |
435 | atm_dev->signal = ATM_PHY_SIG_LOST; | 435 | atm_dev->signal = ATM_PHY_SIG_LOST; |
436 | dev_info(dev, "ADSL line: waiting\n"); | 436 | atm_info(usbatm, "ADSL line: waiting\n"); |
437 | break; | 437 | break; |
438 | 438 | ||
439 | case 7: | 439 | case 7: |
440 | atm_dev->signal = ATM_PHY_SIG_LOST; | 440 | atm_dev->signal = ATM_PHY_SIG_LOST; |
441 | dev_info(dev, "ADSL line: initializing\n"); | 441 | atm_info(usbatm, "ADSL line: initializing\n"); |
442 | break; | 442 | break; |
443 | 443 | ||
444 | default: | 444 | default: |
445 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; | 445 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; |
446 | dev_info(dev, "Unknown line state %02x\n", instance->line_status); | 446 | atm_info(usbatm, "Unknown line state %02x\n", instance->line_status); |
447 | break; | 447 | break; |
448 | } | 448 | } |
449 | reschedule: | 449 | reschedule: |
@@ -504,8 +504,8 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
504 | { | 504 | { |
505 | int ret; | 505 | int ret; |
506 | int off; | 506 | int off; |
507 | struct usb_device *usb_dev = instance->usbatm->usb_dev; | 507 | struct usbatm_data *usbatm = instance->usbatm; |
508 | struct device *dev = &instance->usbatm->usb_intf->dev; | 508 | struct usb_device *usb_dev = usbatm->usb_dev; |
509 | u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct }; | 509 | u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct }; |
510 | u32 val; | 510 | u32 val; |
511 | 511 | ||
@@ -515,7 +515,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
515 | val = cpu_to_le32(instance->modem_type->pll_f_clk); | 515 | val = cpu_to_le32(instance->modem_type->pll_f_clk); |
516 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4); | 516 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4); |
517 | if (ret) { | 517 | if (ret) { |
518 | dev_err(dev, "FirmwarePllFClkValue failed: %d\n", ret); | 518 | usb_err(usbatm, "FirmwarePllFClkValue failed: %d\n", ret); |
519 | return; | 519 | return; |
520 | } | 520 | } |
521 | 521 | ||
@@ -523,7 +523,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
523 | val = cpu_to_le32(instance->modem_type->pll_b_clk); | 523 | val = cpu_to_le32(instance->modem_type->pll_b_clk); |
524 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4); | 524 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4); |
525 | if (ret) { | 525 | if (ret) { |
526 | dev_err(dev, "FirmwarePllBClkValue failed: %d\n", ret); | 526 | usb_err(usbatm, "FirmwarePllBClkValue failed: %d\n", ret); |
527 | return; | 527 | return; |
528 | } | 528 | } |
529 | 529 | ||
@@ -531,14 +531,14 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
531 | val = cpu_to_le32(SDRAM_ENA); | 531 | val = cpu_to_le32(SDRAM_ENA); |
532 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SDRAMEN_ADDR, (u8 *) &val, 4); | 532 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SDRAMEN_ADDR, (u8 *) &val, 4); |
533 | if (ret) { | 533 | if (ret) { |
534 | dev_err(dev, "Enable SDRAM failed: %d\n", ret); | 534 | usb_err(usbatm, "Enable SDRAM failed: %d\n", ret); |
535 | return; | 535 | return; |
536 | } | 536 | } |
537 | 537 | ||
538 | /* Firmware */ | 538 | /* Firmware */ |
539 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size); | 539 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size); |
540 | if (ret) { | 540 | if (ret) { |
541 | dev_err(dev, "Firmware upload failed: %d\n", ret); | 541 | usb_err(usbatm, "Firmware upload failed: %d\n", ret); |
542 | return; | 542 | return; |
543 | } | 543 | } |
544 | 544 | ||
@@ -546,7 +546,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
546 | if (instance->modem_type->boot_rom_patch) { | 546 | if (instance->modem_type->boot_rom_patch) { |
547 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size); | 547 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size); |
548 | if (ret) { | 548 | if (ret) { |
549 | dev_err(dev, "Boot ROM patching failed: %d\n", ret); | 549 | usb_err(usbatm, "Boot ROM patching failed: %d\n", ret); |
550 | return; | 550 | return; |
551 | } | 551 | } |
552 | } | 552 | } |
@@ -554,7 +554,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
554 | /* Signature */ | 554 | /* Signature */ |
555 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) signature, 4); | 555 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) signature, 4); |
556 | if (ret) { | 556 | if (ret) { |
557 | dev_err(dev, "Signature storing failed: %d\n", ret); | 557 | usb_err(usbatm, "Signature storing failed: %d\n", ret); |
558 | return; | 558 | return; |
559 | } | 559 | } |
560 | 560 | ||
@@ -566,7 +566,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
566 | ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0); | 566 | ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0); |
567 | } | 567 | } |
568 | if (ret) { | 568 | if (ret) { |
569 | dev_err(dev, "Passing control to firmware failed: %d\n", ret); | 569 | usb_err(usbatm, "Passing control to firmware failed: %d\n", ret); |
570 | return; | 570 | return; |
571 | } | 571 | } |
572 | 572 | ||
@@ -580,7 +580,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
580 | 580 | ||
581 | ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0); | 581 | ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0); |
582 | if (ret < 0) { | 582 | if (ret < 0) { |
583 | dev_err(dev, "modem failed to initialize: %d\n", ret); | 583 | usb_err(usbatm, "modem failed to initialize: %d\n", ret); |
584 | return; | 584 | return; |
585 | } | 585 | } |
586 | 586 | ||
@@ -597,7 +597,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
597 | ret = cxacru_cm(instance, CM_REQUEST_CARD_DATA_SET, | 597 | ret = cxacru_cm(instance, CM_REQUEST_CARD_DATA_SET, |
598 | (u8 *) buf, len, NULL, 0); | 598 | (u8 *) buf, len, NULL, 0); |
599 | if (ret < 0) { | 599 | if (ret < 0) { |
600 | dev_err(dev, "load config data failed: %d\n", ret); | 600 | usb_err(usbatm, "load config data failed: %d\n", ret); |
601 | return; | 601 | return; |
602 | } | 602 | } |
603 | } | 603 | } |
@@ -608,18 +608,19 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
608 | static int cxacru_find_firmware(struct cxacru_data *instance, | 608 | static int cxacru_find_firmware(struct cxacru_data *instance, |
609 | char* phase, const struct firmware **fw_p) | 609 | char* phase, const struct firmware **fw_p) |
610 | { | 610 | { |
611 | struct device *dev = &instance->usbatm->usb_intf->dev; | 611 | struct usbatm_data *usbatm = instance->usbatm; |
612 | struct device *dev = &usbatm->usb_intf->dev; | ||
612 | char buf[16]; | 613 | char buf[16]; |
613 | 614 | ||
614 | sprintf(buf, "cxacru-%s.bin", phase); | 615 | sprintf(buf, "cxacru-%s.bin", phase); |
615 | dbg("cxacru_find_firmware: looking for %s", buf); | 616 | dbg("cxacru_find_firmware: looking for %s", buf); |
616 | 617 | ||
617 | if (request_firmware(fw_p, buf, dev)) { | 618 | if (request_firmware(fw_p, buf, dev)) { |
618 | dev_dbg(dev, "no stage %s firmware found\n", phase); | 619 | usb_dbg(usbatm, "no stage %s firmware found\n", phase); |
619 | return -ENOENT; | 620 | return -ENOENT; |
620 | } | 621 | } |
621 | 622 | ||
622 | dev_info(dev, "found firmware %s\n", buf); | 623 | usb_info(usbatm, "found firmware %s\n", buf); |
623 | 624 | ||
624 | return 0; | 625 | return 0; |
625 | } | 626 | } |
@@ -627,20 +628,19 @@ static int cxacru_find_firmware(struct cxacru_data *instance, | |||
627 | static int cxacru_heavy_init(struct usbatm_data *usbatm_instance, | 628 | static int cxacru_heavy_init(struct usbatm_data *usbatm_instance, |
628 | struct usb_interface *usb_intf) | 629 | struct usb_interface *usb_intf) |
629 | { | 630 | { |
630 | struct device *dev = &usbatm_instance->usb_intf->dev; | ||
631 | const struct firmware *fw, *bp, *cf; | 631 | const struct firmware *fw, *bp, *cf; |
632 | struct cxacru_data *instance = usbatm_instance->driver_data; | 632 | struct cxacru_data *instance = usbatm_instance->driver_data; |
633 | 633 | ||
634 | int ret = cxacru_find_firmware(instance, "fw", &fw); | 634 | int ret = cxacru_find_firmware(instance, "fw", &fw); |
635 | if (ret) { | 635 | if (ret) { |
636 | dev_warn(dev, "firmware (cxacru-fw.bin) unavailable (hotplug misconfiguration?)\n"); | 636 | usb_warn(usbatm_instance, "firmware (cxacru-fw.bin) unavailable (system misconfigured?)\n"); |
637 | return ret; | 637 | return ret; |
638 | } | 638 | } |
639 | 639 | ||
640 | if (instance->modem_type->boot_rom_patch) { | 640 | if (instance->modem_type->boot_rom_patch) { |
641 | ret = cxacru_find_firmware(instance, "bp", &bp); | 641 | ret = cxacru_find_firmware(instance, "bp", &bp); |
642 | if (ret) { | 642 | if (ret) { |
643 | dev_warn(dev, "boot ROM patch (cxacru-bp.bin) unavailable (hotplug misconfiguration?)\n"); | 643 | usb_warn(usbatm_instance, "boot ROM patch (cxacru-bp.bin) unavailable (system misconfigured?)\n"); |
644 | release_firmware(fw); | 644 | release_firmware(fw); |
645 | return ret; | 645 | return ret; |
646 | } | 646 | } |
@@ -667,22 +667,19 @@ static int cxacru_heavy_init(struct usbatm_data *usbatm_instance, | |||
667 | } | 667 | } |
668 | 668 | ||
669 | static int cxacru_bind(struct usbatm_data *usbatm_instance, | 669 | static int cxacru_bind(struct usbatm_data *usbatm_instance, |
670 | struct usb_interface *intf, const struct usb_device_id *id, | 670 | struct usb_interface *intf, const struct usb_device_id *id) |
671 | int *need_heavy_init) | ||
672 | { | 671 | { |
673 | struct cxacru_data *instance; | 672 | struct cxacru_data *instance; |
674 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 673 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
675 | int ret; | 674 | int ret; |
676 | 675 | ||
677 | /* instance init */ | 676 | /* instance init */ |
678 | instance = kmalloc(sizeof(*instance), GFP_KERNEL); | 677 | instance = kzalloc(sizeof(*instance), GFP_KERNEL); |
679 | if (!instance) { | 678 | if (!instance) { |
680 | dbg("cxacru_bind: no memory for instance data"); | 679 | dbg("cxacru_bind: no memory for instance data"); |
681 | return -ENOMEM; | 680 | return -ENOMEM; |
682 | } | 681 | } |
683 | 682 | ||
684 | memset(instance, 0, sizeof(*instance)); | ||
685 | |||
686 | instance->usbatm = usbatm_instance; | 683 | instance->usbatm = usbatm_instance; |
687 | instance->modem_type = (struct cxacru_modem_type *) id->driver_info; | 684 | instance->modem_type = (struct cxacru_modem_type *) id->driver_info; |
688 | 685 | ||
@@ -721,13 +718,13 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance, | |||
721 | instance->snd_buf, PAGE_SIZE, | 718 | instance->snd_buf, PAGE_SIZE, |
722 | cxacru_blocking_completion, &instance->snd_done, 4); | 719 | cxacru_blocking_completion, &instance->snd_done, 4); |
723 | 720 | ||
724 | init_MUTEX(&instance->cm_serialize); | 721 | mutex_init(&instance->cm_serialize); |
725 | 722 | ||
726 | INIT_WORK(&instance->poll_work, (void *)cxacru_poll_status, instance); | 723 | INIT_WORK(&instance->poll_work, (void *)cxacru_poll_status, instance); |
727 | 724 | ||
728 | usbatm_instance->driver_data = instance; | 725 | usbatm_instance->driver_data = instance; |
729 | 726 | ||
730 | *need_heavy_init = cxacru_card_status(instance); | 727 | usbatm_instance->flags = (cxacru_card_status(instance) ? 0 : UDSL_SKIP_HEAVY_INIT); |
731 | 728 | ||
732 | return 0; | 729 | return 0; |
733 | 730 | ||
@@ -787,12 +784,12 @@ static const struct usb_device_id cxacru_usb_ids[] = { | |||
787 | { /* V = Conexant P = ADSL modem (Hasbani project) */ | 784 | { /* V = Conexant P = ADSL modem (Hasbani project) */ |
788 | USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00 | 785 | USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00 |
789 | }, | 786 | }, |
790 | { /* V = Conexant P = ADSL modem (Well PTI-800 */ | ||
791 | USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00 | ||
792 | }, | ||
793 | { /* V = Conexant P = ADSL modem */ | 787 | { /* V = Conexant P = ADSL modem */ |
794 | USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00 | 788 | USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00 |
795 | }, | 789 | }, |
790 | { /* V = Conexant P = ADSL modem (Well PTI-800) */ | ||
791 | USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00 | ||
792 | }, | ||
796 | { /* V = Conexant P = ADSL modem */ | 793 | { /* V = Conexant P = ADSL modem */ |
797 | USB_DEVICE(0x0572, 0xcb06), .driver_info = (unsigned long) &cxacru_cb00 | 794 | USB_DEVICE(0x0572, 0xcb06), .driver_info = (unsigned long) &cxacru_cb00 |
798 | }, | 795 | }, |
@@ -835,14 +832,13 @@ static const struct usb_device_id cxacru_usb_ids[] = { | |||
835 | MODULE_DEVICE_TABLE(usb, cxacru_usb_ids); | 832 | MODULE_DEVICE_TABLE(usb, cxacru_usb_ids); |
836 | 833 | ||
837 | static struct usbatm_driver cxacru_driver = { | 834 | static struct usbatm_driver cxacru_driver = { |
838 | .owner = THIS_MODULE, | ||
839 | .driver_name = cxacru_driver_name, | 835 | .driver_name = cxacru_driver_name, |
840 | .bind = cxacru_bind, | 836 | .bind = cxacru_bind, |
841 | .heavy_init = cxacru_heavy_init, | 837 | .heavy_init = cxacru_heavy_init, |
842 | .unbind = cxacru_unbind, | 838 | .unbind = cxacru_unbind, |
843 | .atm_start = cxacru_atm_start, | 839 | .atm_start = cxacru_atm_start, |
844 | .in = CXACRU_EP_DATA, | 840 | .bulk_in = CXACRU_EP_DATA, |
845 | .out = CXACRU_EP_DATA, | 841 | .bulk_out = CXACRU_EP_DATA, |
846 | .rx_padding = 3, | 842 | .rx_padding = 3, |
847 | .tx_padding = 11, | 843 | .tx_padding = 11, |
848 | }; | 844 | }; |
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index c1b47d74e206..7860c8a5800d 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c | |||
@@ -35,12 +35,14 @@ | |||
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/stat.h> | 36 | #include <linux/stat.h> |
37 | #include <linux/timer.h> | 37 | #include <linux/timer.h> |
38 | #include <linux/types.h> | ||
39 | #include <linux/usb_ch9.h> | ||
38 | #include <linux/workqueue.h> | 40 | #include <linux/workqueue.h> |
39 | 41 | ||
40 | #include "usbatm.h" | 42 | #include "usbatm.h" |
41 | 43 | ||
42 | #define DRIVER_AUTHOR "Johan Verrept, Duncan Sands <duncan.sands@free.fr>" | 44 | #define DRIVER_AUTHOR "Johan Verrept, Duncan Sands <duncan.sands@free.fr>" |
43 | #define DRIVER_VERSION "1.9" | 45 | #define DRIVER_VERSION "1.10" |
44 | #define DRIVER_DESC "Alcatel SpeedTouch USB driver version " DRIVER_VERSION | 46 | #define DRIVER_DESC "Alcatel SpeedTouch USB driver version " DRIVER_VERSION |
45 | 47 | ||
46 | static const char speedtch_driver_name[] = "speedtch"; | 48 | static const char speedtch_driver_name[] = "speedtch"; |
@@ -66,31 +68,42 @@ static const char speedtch_driver_name[] = "speedtch"; | |||
66 | 68 | ||
67 | #define RESUBMIT_DELAY 1000 /* milliseconds */ | 69 | #define RESUBMIT_DELAY 1000 /* milliseconds */ |
68 | 70 | ||
69 | #define DEFAULT_ALTSETTING 1 | 71 | #define DEFAULT_BULK_ALTSETTING 1 |
72 | #define DEFAULT_ISOC_ALTSETTING 2 | ||
70 | #define DEFAULT_DL_512_FIRST 0 | 73 | #define DEFAULT_DL_512_FIRST 0 |
74 | #define DEFAULT_ENABLE_ISOC 0 | ||
71 | #define DEFAULT_SW_BUFFERING 0 | 75 | #define DEFAULT_SW_BUFFERING 0 |
72 | 76 | ||
73 | static int altsetting = DEFAULT_ALTSETTING; | 77 | static unsigned int altsetting = 0; /* zero means: use the default */ |
74 | static int dl_512_first = DEFAULT_DL_512_FIRST; | 78 | static int dl_512_first = DEFAULT_DL_512_FIRST; |
79 | static int enable_isoc = DEFAULT_ENABLE_ISOC; | ||
75 | static int sw_buffering = DEFAULT_SW_BUFFERING; | 80 | static int sw_buffering = DEFAULT_SW_BUFFERING; |
76 | 81 | ||
77 | module_param(altsetting, int, S_IRUGO | S_IWUSR); | 82 | module_param(altsetting, uint, S_IRUGO | S_IWUSR); |
78 | MODULE_PARM_DESC(altsetting, | 83 | MODULE_PARM_DESC(altsetting, |
79 | "Alternative setting for data interface (default: " | 84 | "Alternative setting for data interface (bulk_default: " |
80 | __MODULE_STRING(DEFAULT_ALTSETTING) ")"); | 85 | __MODULE_STRING(DEFAULT_BULK_ALTSETTING) "; isoc_default: " |
86 | __MODULE_STRING(DEFAULT_ISOC_ALTSETTING) ")"); | ||
81 | 87 | ||
82 | module_param(dl_512_first, bool, S_IRUGO | S_IWUSR); | 88 | module_param(dl_512_first, bool, S_IRUGO | S_IWUSR); |
83 | MODULE_PARM_DESC(dl_512_first, | 89 | MODULE_PARM_DESC(dl_512_first, |
84 | "Read 512 bytes before sending firmware (default: " | 90 | "Read 512 bytes before sending firmware (default: " |
85 | __MODULE_STRING(DEFAULT_DL_512_FIRST) ")"); | 91 | __MODULE_STRING(DEFAULT_DL_512_FIRST) ")"); |
86 | 92 | ||
93 | module_param(enable_isoc, bool, S_IRUGO | S_IWUSR); | ||
94 | MODULE_PARM_DESC(enable_isoc, | ||
95 | "Use isochronous transfers if available (default: " | ||
96 | __MODULE_STRING(DEFAULT_ENABLE_ISOC) ")"); | ||
97 | |||
87 | module_param(sw_buffering, bool, S_IRUGO | S_IWUSR); | 98 | module_param(sw_buffering, bool, S_IRUGO | S_IWUSR); |
88 | MODULE_PARM_DESC(sw_buffering, | 99 | MODULE_PARM_DESC(sw_buffering, |
89 | "Enable software buffering (default: " | 100 | "Enable software buffering (default: " |
90 | __MODULE_STRING(DEFAULT_SW_BUFFERING) ")"); | 101 | __MODULE_STRING(DEFAULT_SW_BUFFERING) ")"); |
91 | 102 | ||
103 | #define INTERFACE_DATA 1 | ||
92 | #define ENDPOINT_INT 0x81 | 104 | #define ENDPOINT_INT 0x81 |
93 | #define ENDPOINT_DATA 0x07 | 105 | #define ENDPOINT_BULK_DATA 0x07 |
106 | #define ENDPOINT_ISOC_DATA 0x07 | ||
94 | #define ENDPOINT_FIRMWARE 0x05 | 107 | #define ENDPOINT_FIRMWARE 0x05 |
95 | 108 | ||
96 | #define hex2int(c) ( (c >= '0') && (c <= '9') ? (c - '0') : ((c & 0xf) + 9) ) | 109 | #define hex2int(c) ( (c >= '0') && (c <= '9') ? (c - '0') : ((c & 0xf) + 9) ) |
@@ -98,6 +111,8 @@ MODULE_PARM_DESC(sw_buffering, | |||
98 | struct speedtch_instance_data { | 111 | struct speedtch_instance_data { |
99 | struct usbatm_data *usbatm; | 112 | struct usbatm_data *usbatm; |
100 | 113 | ||
114 | unsigned int altsetting; | ||
115 | |||
101 | struct work_struct status_checker; | 116 | struct work_struct status_checker; |
102 | 117 | ||
103 | unsigned char last_status; | 118 | unsigned char last_status; |
@@ -205,7 +220,7 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance, | |||
205 | buffer, 0x200, &actual_length, 2000); | 220 | buffer, 0x200, &actual_length, 2000); |
206 | 221 | ||
207 | if (ret < 0 && ret != -ETIMEDOUT) | 222 | if (ret < 0 && ret != -ETIMEDOUT) |
208 | usb_dbg(usbatm, "%s: read BLOCK0 from modem failed (%d)!\n", __func__, ret); | 223 | usb_warn(usbatm, "%s: read BLOCK0 from modem failed (%d)!\n", __func__, ret); |
209 | else | 224 | else |
210 | usb_dbg(usbatm, "%s: BLOCK0 downloaded (%d bytes)\n", __func__, ret); | 225 | usb_dbg(usbatm, "%s: BLOCK0 downloaded (%d bytes)\n", __func__, ret); |
211 | } | 226 | } |
@@ -219,7 +234,7 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance, | |||
219 | buffer, thislen, &actual_length, DATA_TIMEOUT); | 234 | buffer, thislen, &actual_length, DATA_TIMEOUT); |
220 | 235 | ||
221 | if (ret < 0) { | 236 | if (ret < 0) { |
222 | usb_dbg(usbatm, "%s: write BLOCK1 to modem failed (%d)!\n", __func__, ret); | 237 | usb_err(usbatm, "%s: write BLOCK1 to modem failed (%d)!\n", __func__, ret); |
223 | goto out_free; | 238 | goto out_free; |
224 | } | 239 | } |
225 | usb_dbg(usbatm, "%s: BLOCK1 uploaded (%zu bytes)\n", __func__, fw1->size); | 240 | usb_dbg(usbatm, "%s: BLOCK1 uploaded (%zu bytes)\n", __func__, fw1->size); |
@@ -232,7 +247,7 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance, | |||
232 | buffer, 0x200, &actual_length, DATA_TIMEOUT); | 247 | buffer, 0x200, &actual_length, DATA_TIMEOUT); |
233 | 248 | ||
234 | if (ret < 0) { | 249 | if (ret < 0) { |
235 | usb_dbg(usbatm, "%s: read BLOCK2 from modem failed (%d)!\n", __func__, ret); | 250 | usb_err(usbatm, "%s: read BLOCK2 from modem failed (%d)!\n", __func__, ret); |
236 | goto out_free; | 251 | goto out_free; |
237 | } | 252 | } |
238 | usb_dbg(usbatm, "%s: BLOCK2 downloaded (%d bytes)\n", __func__, actual_length); | 253 | usb_dbg(usbatm, "%s: BLOCK2 downloaded (%d bytes)\n", __func__, actual_length); |
@@ -246,7 +261,7 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance, | |||
246 | buffer, thislen, &actual_length, DATA_TIMEOUT); | 261 | buffer, thislen, &actual_length, DATA_TIMEOUT); |
247 | 262 | ||
248 | if (ret < 0) { | 263 | if (ret < 0) { |
249 | usb_dbg(usbatm, "%s: write BLOCK3 to modem failed (%d)!\n", __func__, ret); | 264 | usb_err(usbatm, "%s: write BLOCK3 to modem failed (%d)!\n", __func__, ret); |
250 | goto out_free; | 265 | goto out_free; |
251 | } | 266 | } |
252 | } | 267 | } |
@@ -259,7 +274,7 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance, | |||
259 | buffer, 0x200, &actual_length, DATA_TIMEOUT); | 274 | buffer, 0x200, &actual_length, DATA_TIMEOUT); |
260 | 275 | ||
261 | if (ret < 0) { | 276 | if (ret < 0) { |
262 | usb_dbg(usbatm, "%s: read BLOCK4 from modem failed (%d)!\n", __func__, ret); | 277 | usb_err(usbatm, "%s: read BLOCK4 from modem failed (%d)!\n", __func__, ret); |
263 | goto out_free; | 278 | goto out_free; |
264 | } | 279 | } |
265 | 280 | ||
@@ -270,6 +285,11 @@ static int speedtch_upload_firmware(struct speedtch_instance_data *instance, | |||
270 | because we're in our own kernel thread anyway. */ | 285 | because we're in our own kernel thread anyway. */ |
271 | msleep_interruptible(1000); | 286 | msleep_interruptible(1000); |
272 | 287 | ||
288 | if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) { | ||
289 | usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, instance->altsetting, ret); | ||
290 | goto out_free; | ||
291 | } | ||
292 | |||
273 | /* Enable software buffering, if requested */ | 293 | /* Enable software buffering, if requested */ |
274 | if (sw_buffering) | 294 | if (sw_buffering) |
275 | speedtch_set_swbuff(instance, 1); | 295 | speedtch_set_swbuff(instance, 1); |
@@ -285,8 +305,8 @@ out: | |||
285 | return ret; | 305 | return ret; |
286 | } | 306 | } |
287 | 307 | ||
288 | static int speedtch_find_firmware(struct usb_interface *intf, int phase, | 308 | static int speedtch_find_firmware(struct usbatm_data *usbatm, struct usb_interface *intf, |
289 | const struct firmware **fw_p) | 309 | int phase, const struct firmware **fw_p) |
290 | { | 310 | { |
291 | struct device *dev = &intf->dev; | 311 | struct device *dev = &intf->dev; |
292 | const u16 bcdDevice = le16_to_cpu(interface_to_usbdev(intf)->descriptor.bcdDevice); | 312 | const u16 bcdDevice = le16_to_cpu(interface_to_usbdev(intf)->descriptor.bcdDevice); |
@@ -295,24 +315,24 @@ static int speedtch_find_firmware(struct usb_interface *intf, int phase, | |||
295 | char buf[24]; | 315 | char buf[24]; |
296 | 316 | ||
297 | sprintf(buf, "speedtch-%d.bin.%x.%02x", phase, major_revision, minor_revision); | 317 | sprintf(buf, "speedtch-%d.bin.%x.%02x", phase, major_revision, minor_revision); |
298 | dev_dbg(dev, "%s: looking for %s\n", __func__, buf); | 318 | usb_dbg(usbatm, "%s: looking for %s\n", __func__, buf); |
299 | 319 | ||
300 | if (request_firmware(fw_p, buf, dev)) { | 320 | if (request_firmware(fw_p, buf, dev)) { |
301 | sprintf(buf, "speedtch-%d.bin.%x", phase, major_revision); | 321 | sprintf(buf, "speedtch-%d.bin.%x", phase, major_revision); |
302 | dev_dbg(dev, "%s: looking for %s\n", __func__, buf); | 322 | usb_dbg(usbatm, "%s: looking for %s\n", __func__, buf); |
303 | 323 | ||
304 | if (request_firmware(fw_p, buf, dev)) { | 324 | if (request_firmware(fw_p, buf, dev)) { |
305 | sprintf(buf, "speedtch-%d.bin", phase); | 325 | sprintf(buf, "speedtch-%d.bin", phase); |
306 | dev_dbg(dev, "%s: looking for %s\n", __func__, buf); | 326 | usb_dbg(usbatm, "%s: looking for %s\n", __func__, buf); |
307 | 327 | ||
308 | if (request_firmware(fw_p, buf, dev)) { | 328 | if (request_firmware(fw_p, buf, dev)) { |
309 | dev_warn(dev, "no stage %d firmware found!\n", phase); | 329 | usb_err(usbatm, "%s: no stage %d firmware found!\n", __func__, phase); |
310 | return -ENOENT; | 330 | return -ENOENT; |
311 | } | 331 | } |
312 | } | 332 | } |
313 | } | 333 | } |
314 | 334 | ||
315 | dev_info(dev, "found stage %d firmware %s\n", phase, buf); | 335 | usb_info(usbatm, "found stage %d firmware %s\n", phase, buf); |
316 | 336 | ||
317 | return 0; | 337 | return 0; |
318 | } | 338 | } |
@@ -323,15 +343,16 @@ static int speedtch_heavy_init(struct usbatm_data *usbatm, struct usb_interface | |||
323 | struct speedtch_instance_data *instance = usbatm->driver_data; | 343 | struct speedtch_instance_data *instance = usbatm->driver_data; |
324 | int ret; | 344 | int ret; |
325 | 345 | ||
326 | if ((ret = speedtch_find_firmware(intf, 1, &fw1)) < 0) | 346 | if ((ret = speedtch_find_firmware(usbatm, intf, 1, &fw1)) < 0) |
327 | return ret; | 347 | return ret; |
328 | 348 | ||
329 | if ((ret = speedtch_find_firmware(intf, 2, &fw2)) < 0) { | 349 | if ((ret = speedtch_find_firmware(usbatm, intf, 2, &fw2)) < 0) { |
330 | release_firmware(fw1); | 350 | release_firmware(fw1); |
331 | return ret; | 351 | return ret; |
332 | } | 352 | } |
333 | 353 | ||
334 | ret = speedtch_upload_firmware(instance, fw1, fw2); | 354 | if ((ret = speedtch_upload_firmware(instance, fw1, fw2)) < 0) |
355 | usb_err(usbatm, "%s: firmware upload failed (%d)!\n", __func__, ret); | ||
335 | 356 | ||
336 | release_firmware(fw2); | 357 | release_firmware(fw2); |
337 | release_firmware(fw1); | 358 | release_firmware(fw1); |
@@ -428,7 +449,9 @@ static void speedtch_check_status(struct speedtch_instance_data *instance) | |||
428 | int down_speed, up_speed, ret; | 449 | int down_speed, up_speed, ret; |
429 | unsigned char status; | 450 | unsigned char status; |
430 | 451 | ||
452 | #ifdef VERBOSE_DEBUG | ||
431 | atm_dbg(usbatm, "%s entered\n", __func__); | 453 | atm_dbg(usbatm, "%s entered\n", __func__); |
454 | #endif | ||
432 | 455 | ||
433 | ret = speedtch_read_status(instance); | 456 | ret = speedtch_read_status(instance); |
434 | if (ret < 0) { | 457 | if (ret < 0) { |
@@ -441,9 +464,9 @@ static void speedtch_check_status(struct speedtch_instance_data *instance) | |||
441 | 464 | ||
442 | status = buf[OFFSET_7]; | 465 | status = buf[OFFSET_7]; |
443 | 466 | ||
444 | atm_dbg(usbatm, "%s: line state %02x\n", __func__, status); | ||
445 | |||
446 | if ((status != instance->last_status) || !status) { | 467 | if ((status != instance->last_status) || !status) { |
468 | atm_dbg(usbatm, "%s: line state 0x%02x\n", __func__, status); | ||
469 | |||
447 | switch (status) { | 470 | switch (status) { |
448 | case 0: | 471 | case 0: |
449 | atm_dev->signal = ATM_PHY_SIG_LOST; | 472 | atm_dev->signal = ATM_PHY_SIG_LOST; |
@@ -484,7 +507,7 @@ static void speedtch_check_status(struct speedtch_instance_data *instance) | |||
484 | 507 | ||
485 | default: | 508 | default: |
486 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; | 509 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; |
487 | atm_info(usbatm, "Unknown line state %02x\n", status); | 510 | atm_info(usbatm, "unknown line state %02x\n", status); |
488 | break; | 511 | break; |
489 | } | 512 | } |
490 | 513 | ||
@@ -583,11 +606,6 @@ static int speedtch_atm_start(struct usbatm_data *usbatm, struct atm_dev *atm_de | |||
583 | 606 | ||
584 | atm_dbg(usbatm, "%s entered\n", __func__); | 607 | atm_dbg(usbatm, "%s entered\n", __func__); |
585 | 608 | ||
586 | if ((ret = usb_set_interface(usb_dev, 1, altsetting)) < 0) { | ||
587 | atm_dbg(usbatm, "%s: usb_set_interface returned %d!\n", __func__, ret); | ||
588 | return ret; | ||
589 | } | ||
590 | |||
591 | /* Set MAC address, it is stored in the serial number */ | 609 | /* Set MAC address, it is stored in the serial number */ |
592 | memset(atm_dev->esi, 0, sizeof(atm_dev->esi)); | 610 | memset(atm_dev->esi, 0, sizeof(atm_dev->esi)); |
593 | if (usb_string(usb_dev, usb_dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) == 12) { | 611 | if (usb_string(usb_dev, usb_dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) == 12) { |
@@ -678,20 +696,27 @@ static void speedtch_release_interfaces(struct usb_device *usb_dev, int num_inte | |||
678 | 696 | ||
679 | static int speedtch_bind(struct usbatm_data *usbatm, | 697 | static int speedtch_bind(struct usbatm_data *usbatm, |
680 | struct usb_interface *intf, | 698 | struct usb_interface *intf, |
681 | const struct usb_device_id *id, | 699 | const struct usb_device_id *id) |
682 | int *need_heavy_init) | ||
683 | { | 700 | { |
684 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 701 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
685 | struct usb_interface *cur_intf; | 702 | struct usb_interface *cur_intf, *data_intf; |
686 | struct speedtch_instance_data *instance; | 703 | struct speedtch_instance_data *instance; |
687 | int ifnum = intf->altsetting->desc.bInterfaceNumber; | 704 | int ifnum = intf->altsetting->desc.bInterfaceNumber; |
688 | int num_interfaces = usb_dev->actconfig->desc.bNumInterfaces; | 705 | int num_interfaces = usb_dev->actconfig->desc.bNumInterfaces; |
689 | int i, ret; | 706 | int i, ret; |
707 | int use_isoc; | ||
690 | 708 | ||
691 | usb_dbg(usbatm, "%s entered\n", __func__); | 709 | usb_dbg(usbatm, "%s entered\n", __func__); |
692 | 710 | ||
711 | /* sanity checks */ | ||
712 | |||
693 | if (usb_dev->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC) { | 713 | if (usb_dev->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC) { |
694 | usb_dbg(usbatm, "%s: wrong device class %d\n", __func__, usb_dev->descriptor.bDeviceClass); | 714 | usb_err(usbatm, "%s: wrong device class %d\n", __func__, usb_dev->descriptor.bDeviceClass); |
715 | return -ENODEV; | ||
716 | } | ||
717 | |||
718 | if (!(data_intf = usb_ifnum_to_if(usb_dev, INTERFACE_DATA))) { | ||
719 | usb_err(usbatm, "%s: data interface not found!\n", __func__); | ||
695 | return -ENODEV; | 720 | return -ENODEV; |
696 | } | 721 | } |
697 | 722 | ||
@@ -704,25 +729,71 @@ static int speedtch_bind(struct usbatm_data *usbatm, | |||
704 | ret = usb_driver_claim_interface(&speedtch_usb_driver, cur_intf, usbatm); | 729 | ret = usb_driver_claim_interface(&speedtch_usb_driver, cur_intf, usbatm); |
705 | 730 | ||
706 | if (ret < 0) { | 731 | if (ret < 0) { |
707 | usb_dbg(usbatm, "%s: failed to claim interface %d (%d)\n", __func__, i, ret); | 732 | usb_err(usbatm, "%s: failed to claim interface %2d (%d)!\n", __func__, i, ret); |
708 | speedtch_release_interfaces(usb_dev, i); | 733 | speedtch_release_interfaces(usb_dev, i); |
709 | return ret; | 734 | return ret; |
710 | } | 735 | } |
711 | } | 736 | } |
712 | } | 737 | } |
713 | 738 | ||
714 | instance = kmalloc(sizeof(*instance), GFP_KERNEL); | 739 | instance = kzalloc(sizeof(*instance), GFP_KERNEL); |
715 | 740 | ||
716 | if (!instance) { | 741 | if (!instance) { |
717 | usb_dbg(usbatm, "%s: no memory for instance data!\n", __func__); | 742 | usb_err(usbatm, "%s: no memory for instance data!\n", __func__); |
718 | ret = -ENOMEM; | 743 | ret = -ENOMEM; |
719 | goto fail_release; | 744 | goto fail_release; |
720 | } | 745 | } |
721 | 746 | ||
722 | memset(instance, 0, sizeof(struct speedtch_instance_data)); | ||
723 | |||
724 | instance->usbatm = usbatm; | 747 | instance->usbatm = usbatm; |
725 | 748 | ||
749 | /* altsetting and enable_isoc may change at any moment, so take a snapshot */ | ||
750 | instance->altsetting = altsetting; | ||
751 | use_isoc = enable_isoc; | ||
752 | |||
753 | if (instance->altsetting) | ||
754 | if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) { | ||
755 | usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, instance->altsetting, ret); | ||
756 | instance->altsetting = 0; /* fall back to default */ | ||
757 | } | ||
758 | |||
759 | if (!instance->altsetting && use_isoc) | ||
760 | if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_ISOC_ALTSETTING)) < 0) { | ||
761 | usb_dbg(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_ISOC_ALTSETTING, ret); | ||
762 | use_isoc = 0; /* fall back to bulk */ | ||
763 | } | ||
764 | |||
765 | if (use_isoc) { | ||
766 | const struct usb_host_interface *desc = data_intf->cur_altsetting; | ||
767 | const __u8 target_address = USB_DIR_IN | usbatm->driver->isoc_in; | ||
768 | int i; | ||
769 | |||
770 | use_isoc = 0; /* fall back to bulk if endpoint not found */ | ||
771 | |||
772 | for (i=0; i<desc->desc.bNumEndpoints; i++) { | ||
773 | const struct usb_endpoint_descriptor *endpoint_desc = &desc->endpoint[i].desc; | ||
774 | |||
775 | if ((endpoint_desc->bEndpointAddress == target_address)) { | ||
776 | use_isoc = (endpoint_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
777 | USB_ENDPOINT_XFER_ISOC; | ||
778 | break; | ||
779 | } | ||
780 | } | ||
781 | |||
782 | if (!use_isoc) | ||
783 | usb_info(usbatm, "isochronous transfer not supported - using bulk\n"); | ||
784 | } | ||
785 | |||
786 | if (!use_isoc && !instance->altsetting) | ||
787 | if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_BULK_ALTSETTING)) < 0) { | ||
788 | usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_BULK_ALTSETTING, ret); | ||
789 | goto fail_free; | ||
790 | } | ||
791 | |||
792 | if (!instance->altsetting) | ||
793 | instance->altsetting = use_isoc ? DEFAULT_ISOC_ALTSETTING : DEFAULT_BULK_ALTSETTING; | ||
794 | |||
795 | usbatm->flags |= (use_isoc ? UDSL_USE_ISOC : 0); | ||
796 | |||
726 | INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance); | 797 | INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance); |
727 | 798 | ||
728 | instance->status_checker.timer.function = speedtch_status_poll; | 799 | instance->status_checker.timer.function = speedtch_status_poll; |
@@ -749,13 +820,15 @@ static int speedtch_bind(struct usbatm_data *usbatm, | |||
749 | 0x12, 0xc0, 0x07, 0x00, | 820 | 0x12, 0xc0, 0x07, 0x00, |
750 | instance->scratch_buffer + OFFSET_7, SIZE_7, 500); | 821 | instance->scratch_buffer + OFFSET_7, SIZE_7, 500); |
751 | 822 | ||
752 | *need_heavy_init = (ret != SIZE_7); | 823 | usbatm->flags |= (ret == SIZE_7 ? UDSL_SKIP_HEAVY_INIT : 0); |
753 | 824 | ||
754 | usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, need_heavy_init ? "not" : "already"); | 825 | usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, usbatm->flags & UDSL_SKIP_HEAVY_INIT ? "already" : "not"); |
755 | 826 | ||
756 | if (*need_heavy_init) | 827 | if (!(usbatm->flags & UDSL_SKIP_HEAVY_INIT)) |
757 | if ((ret = usb_reset_device(usb_dev)) < 0) | 828 | if ((ret = usb_reset_device(usb_dev)) < 0) { |
829 | usb_err(usbatm, "%s: device reset failed (%d)!\n", __func__, ret); | ||
758 | goto fail_free; | 830 | goto fail_free; |
831 | } | ||
759 | 832 | ||
760 | usbatm->driver_data = instance; | 833 | usbatm->driver_data = instance; |
761 | 834 | ||
@@ -787,15 +860,15 @@ static void speedtch_unbind(struct usbatm_data *usbatm, struct usb_interface *in | |||
787 | ***********/ | 860 | ***********/ |
788 | 861 | ||
789 | static struct usbatm_driver speedtch_usbatm_driver = { | 862 | static struct usbatm_driver speedtch_usbatm_driver = { |
790 | .owner = THIS_MODULE, | ||
791 | .driver_name = speedtch_driver_name, | 863 | .driver_name = speedtch_driver_name, |
792 | .bind = speedtch_bind, | 864 | .bind = speedtch_bind, |
793 | .heavy_init = speedtch_heavy_init, | 865 | .heavy_init = speedtch_heavy_init, |
794 | .unbind = speedtch_unbind, | 866 | .unbind = speedtch_unbind, |
795 | .atm_start = speedtch_atm_start, | 867 | .atm_start = speedtch_atm_start, |
796 | .atm_stop = speedtch_atm_stop, | 868 | .atm_stop = speedtch_atm_stop, |
797 | .in = ENDPOINT_DATA, | 869 | .bulk_in = ENDPOINT_BULK_DATA, |
798 | .out = ENDPOINT_DATA | 870 | .bulk_out = ENDPOINT_BULK_DATA, |
871 | .isoc_in = ENDPOINT_ISOC_DATA | ||
799 | }; | 872 | }; |
800 | 873 | ||
801 | static int speedtch_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | 874 | static int speedtch_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) |
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c index 7d2a679989ed..830d2c982670 100644 --- a/drivers/usb/atm/ueagle-atm.c +++ b/drivers/usb/atm/ueagle-atm.c | |||
@@ -63,11 +63,12 @@ | |||
63 | #include <linux/ctype.h> | 63 | #include <linux/ctype.h> |
64 | #include <linux/kthread.h> | 64 | #include <linux/kthread.h> |
65 | #include <linux/version.h> | 65 | #include <linux/version.h> |
66 | #include <linux/mutex.h> | ||
66 | #include <asm/unaligned.h> | 67 | #include <asm/unaligned.h> |
67 | 68 | ||
68 | #include "usbatm.h" | 69 | #include "usbatm.h" |
69 | 70 | ||
70 | #define EAGLEUSBVERSION "ueagle 1.1" | 71 | #define EAGLEUSBVERSION "ueagle 1.2" |
71 | 72 | ||
72 | 73 | ||
73 | /* | 74 | /* |
@@ -358,16 +359,19 @@ struct intr_pkt { | |||
358 | #define INTR_PKT_SIZE 28 | 359 | #define INTR_PKT_SIZE 28 |
359 | 360 | ||
360 | static struct usb_driver uea_driver; | 361 | static struct usb_driver uea_driver; |
361 | static DECLARE_MUTEX(uea_semaphore); | 362 | static DEFINE_MUTEX(uea_mutex); |
362 | static const char *chip_name[] = {"ADI930", "Eagle I", "Eagle II", "Eagle III"}; | 363 | static const char *chip_name[] = {"ADI930", "Eagle I", "Eagle II", "Eagle III"}; |
363 | 364 | ||
364 | static int modem_index; | 365 | static int modem_index; |
365 | static unsigned int debug; | 366 | static unsigned int debug; |
367 | static int use_iso[NB_MODEM] = {[0 ... (NB_MODEM - 1)] = 1}; | ||
366 | static int sync_wait[NB_MODEM]; | 368 | static int sync_wait[NB_MODEM]; |
367 | static char *cmv_file[NB_MODEM]; | 369 | static char *cmv_file[NB_MODEM]; |
368 | 370 | ||
369 | module_param(debug, uint, 0644); | 371 | module_param(debug, uint, 0644); |
370 | MODULE_PARM_DESC(debug, "module debug level (0=off,1=on,2=verbose)"); | 372 | MODULE_PARM_DESC(debug, "module debug level (0=off,1=on,2=verbose)"); |
373 | module_param_array(use_iso, bool, NULL, 0644); | ||
374 | MODULE_PARM_DESC(use_iso, "use isochronous usb pipe for incoming traffic"); | ||
371 | module_param_array(sync_wait, bool, NULL, 0644); | 375 | module_param_array(sync_wait, bool, NULL, 0644); |
372 | MODULE_PARM_DESC(sync_wait, "wait the synchronisation before starting ATM"); | 376 | MODULE_PARM_DESC(sync_wait, "wait the synchronisation before starting ATM"); |
373 | module_param_array(cmv_file, charp, NULL, 0644); | 377 | module_param_array(cmv_file, charp, NULL, 0644); |
@@ -628,8 +632,7 @@ static int request_dsp(struct uea_softc *sc) | |||
628 | dsp_name = FW_DIR "DSPep.bin"; | 632 | dsp_name = FW_DIR "DSPep.bin"; |
629 | } | 633 | } |
630 | 634 | ||
631 | ret = request_firmware(&sc->dsp_firm, | 635 | ret = request_firmware(&sc->dsp_firm, dsp_name, &sc->usb_dev->dev); |
632 | dsp_name, &sc->usb_dev->dev); | ||
633 | if (ret < 0) { | 636 | if (ret < 0) { |
634 | uea_err(INS_TO_USBDEV(sc), | 637 | uea_err(INS_TO_USBDEV(sc), |
635 | "requesting firmware %s failed with error %d\n", | 638 | "requesting firmware %s failed with error %d\n", |
@@ -744,7 +747,6 @@ static inline int wait_cmv_ack(struct uea_softc *sc) | |||
744 | return ret; | 747 | return ret; |
745 | 748 | ||
746 | return (ret == 0) ? -ETIMEDOUT : 0; | 749 | return (ret == 0) ? -ETIMEDOUT : 0; |
747 | |||
748 | } | 750 | } |
749 | 751 | ||
750 | #define UCDC_SEND_ENCAPSULATED_COMMAND 0x00 | 752 | #define UCDC_SEND_ENCAPSULATED_COMMAND 0x00 |
@@ -935,6 +937,7 @@ static int uea_stat(struct uea_softc *sc) | |||
935 | * ADI930 don't support it (-EPIPE error). | 937 | * ADI930 don't support it (-EPIPE error). |
936 | */ | 938 | */ |
937 | if (UEA_CHIP_VERSION(sc) != ADI930 | 939 | if (UEA_CHIP_VERSION(sc) != ADI930 |
940 | && !use_iso[sc->modem_index] | ||
938 | && sc->stats.phy.dsrate != (data >> 16) * 32) { | 941 | && sc->stats.phy.dsrate != (data >> 16) * 32) { |
939 | /* Original timming from ADI(used in windows driver) | 942 | /* Original timming from ADI(used in windows driver) |
940 | * 0x20ffff>>16 * 32 = 32 * 32 = 1Mbits | 943 | * 0x20ffff>>16 * 32 = 32 * 32 = 1Mbits |
@@ -1010,7 +1013,7 @@ static int request_cmvs(struct uea_softc *sc, | |||
1010 | int ret, size; | 1013 | int ret, size; |
1011 | u8 *data; | 1014 | u8 *data; |
1012 | char *file; | 1015 | char *file; |
1013 | static char cmv_name[256] = FW_DIR; | 1016 | char cmv_name[FIRMWARE_NAME_MAX]; /* 30 bytes stack variable */ |
1014 | 1017 | ||
1015 | if (cmv_file[sc->modem_index] == NULL) { | 1018 | if (cmv_file[sc->modem_index] == NULL) { |
1016 | if (UEA_CHIP_VERSION(sc) == ADI930) | 1019 | if (UEA_CHIP_VERSION(sc) == ADI930) |
@@ -1184,8 +1187,7 @@ static int load_XILINX_firmware(struct uea_softc *sc) | |||
1184 | } | 1187 | } |
1185 | } | 1188 | } |
1186 | 1189 | ||
1187 | /* finish to send the fpga | 1190 | /* finish to send the fpga */ |
1188 | */ | ||
1189 | ret = uea_request(sc, 0xe, 1, 0, NULL); | 1191 | ret = uea_request(sc, 0xe, 1, 0, NULL); |
1190 | if (ret < 0) { | 1192 | if (ret < 0) { |
1191 | uea_err(INS_TO_USBDEV(sc), | 1193 | uea_err(INS_TO_USBDEV(sc), |
@@ -1193,9 +1195,7 @@ static int load_XILINX_firmware(struct uea_softc *sc) | |||
1193 | goto err1; | 1195 | goto err1; |
1194 | } | 1196 | } |
1195 | 1197 | ||
1196 | /* | 1198 | /* Tell the modem we finish : de-assert reset */ |
1197 | * Tell the modem we finish : de-assert reset | ||
1198 | */ | ||
1199 | value = 0; | 1199 | value = 0; |
1200 | ret = uea_send_modem_cmd(sc->usb_dev, 0xe, 1, &value); | 1200 | ret = uea_send_modem_cmd(sc->usb_dev, 0xe, 1, &value); |
1201 | if (ret < 0) | 1201 | if (ret < 0) |
@@ -1209,6 +1209,7 @@ err0: | |||
1209 | return ret; | 1209 | return ret; |
1210 | } | 1210 | } |
1211 | 1211 | ||
1212 | /* The modem send us an ack. First with check if it right */ | ||
1212 | static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv) | 1213 | static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv) |
1213 | { | 1214 | { |
1214 | uea_enters(INS_TO_USBDEV(sc)); | 1215 | uea_enters(INS_TO_USBDEV(sc)); |
@@ -1268,23 +1269,19 @@ bad1: | |||
1268 | */ | 1269 | */ |
1269 | static void uea_intr(struct urb *urb, struct pt_regs *regs) | 1270 | static void uea_intr(struct urb *urb, struct pt_regs *regs) |
1270 | { | 1271 | { |
1271 | struct uea_softc *sc = (struct uea_softc *)urb->context; | 1272 | struct uea_softc *sc = urb->context; |
1272 | struct intr_pkt *intr; | 1273 | struct intr_pkt *intr = urb->transfer_buffer; |
1273 | uea_enters(INS_TO_USBDEV(sc)); | 1274 | uea_enters(INS_TO_USBDEV(sc)); |
1274 | 1275 | ||
1275 | if (urb->status < 0) { | 1276 | if (unlikely(urb->status < 0)) { |
1276 | uea_err(INS_TO_USBDEV(sc), "uea_intr() failed with %d\n", | 1277 | uea_err(INS_TO_USBDEV(sc), "uea_intr() failed with %d\n", |
1277 | urb->status); | 1278 | urb->status); |
1278 | return; | 1279 | return; |
1279 | } | 1280 | } |
1280 | 1281 | ||
1281 | intr = (struct intr_pkt *) urb->transfer_buffer; | ||
1282 | |||
1283 | /* device-to-host interrupt */ | 1282 | /* device-to-host interrupt */ |
1284 | if (intr->bType != 0x08 || sc->booting) { | 1283 | if (intr->bType != 0x08 || sc->booting) { |
1285 | uea_err(INS_TO_USBDEV(sc), "wrong intr\n"); | 1284 | uea_err(INS_TO_USBDEV(sc), "wrong interrupt\n"); |
1286 | // rebooting ? | ||
1287 | // sc->reset = 1; | ||
1288 | goto resubmit; | 1285 | goto resubmit; |
1289 | } | 1286 | } |
1290 | 1287 | ||
@@ -1300,7 +1297,7 @@ static void uea_intr(struct urb *urb, struct pt_regs *regs) | |||
1300 | break; | 1297 | break; |
1301 | 1298 | ||
1302 | default: | 1299 | default: |
1303 | uea_err(INS_TO_USBDEV(sc), "unknown intr %u\n", | 1300 | uea_err(INS_TO_USBDEV(sc), "unknown interrupt %u\n", |
1304 | le16_to_cpu(intr->wInterrupt)); | 1301 | le16_to_cpu(intr->wInterrupt)); |
1305 | } | 1302 | } |
1306 | 1303 | ||
@@ -1379,7 +1376,7 @@ static void uea_stop(struct uea_softc *sc) | |||
1379 | int ret; | 1376 | int ret; |
1380 | uea_enters(INS_TO_USBDEV(sc)); | 1377 | uea_enters(INS_TO_USBDEV(sc)); |
1381 | ret = kthread_stop(sc->kthread); | 1378 | ret = kthread_stop(sc->kthread); |
1382 | uea_info(INS_TO_USBDEV(sc), "kthread finish with status %d\n", ret); | 1379 | uea_dbg(INS_TO_USBDEV(sc), "kthread finish with status %d\n", ret); |
1383 | 1380 | ||
1384 | /* stop any pending boot process */ | 1381 | /* stop any pending boot process */ |
1385 | flush_scheduled_work(); | 1382 | flush_scheduled_work(); |
@@ -1418,13 +1415,13 @@ static ssize_t read_status(struct device *dev, struct device_attribute *attr, | |||
1418 | int ret = -ENODEV; | 1415 | int ret = -ENODEV; |
1419 | struct uea_softc *sc; | 1416 | struct uea_softc *sc; |
1420 | 1417 | ||
1421 | down(&uea_semaphore); | 1418 | mutex_lock(&uea_mutex); |
1422 | sc = dev_to_uea(dev); | 1419 | sc = dev_to_uea(dev); |
1423 | if (!sc) | 1420 | if (!sc) |
1424 | goto out; | 1421 | goto out; |
1425 | ret = snprintf(buf, 10, "%08x\n", sc->stats.phy.state); | 1422 | ret = snprintf(buf, 10, "%08x\n", sc->stats.phy.state); |
1426 | out: | 1423 | out: |
1427 | up(&uea_semaphore); | 1424 | mutex_unlock(&uea_mutex); |
1428 | return ret; | 1425 | return ret; |
1429 | } | 1426 | } |
1430 | 1427 | ||
@@ -1434,14 +1431,14 @@ static ssize_t reboot(struct device *dev, struct device_attribute *attr, | |||
1434 | int ret = -ENODEV; | 1431 | int ret = -ENODEV; |
1435 | struct uea_softc *sc; | 1432 | struct uea_softc *sc; |
1436 | 1433 | ||
1437 | down(&uea_semaphore); | 1434 | mutex_lock(&uea_mutex); |
1438 | sc = dev_to_uea(dev); | 1435 | sc = dev_to_uea(dev); |
1439 | if (!sc) | 1436 | if (!sc) |
1440 | goto out; | 1437 | goto out; |
1441 | sc->reset = 1; | 1438 | sc->reset = 1; |
1442 | ret = count; | 1439 | ret = count; |
1443 | out: | 1440 | out: |
1444 | up(&uea_semaphore); | 1441 | mutex_unlock(&uea_mutex); |
1445 | return ret; | 1442 | return ret; |
1446 | } | 1443 | } |
1447 | 1444 | ||
@@ -1453,7 +1450,7 @@ static ssize_t read_human_status(struct device *dev, struct device_attribute *at | |||
1453 | int ret = -ENODEV; | 1450 | int ret = -ENODEV; |
1454 | struct uea_softc *sc; | 1451 | struct uea_softc *sc; |
1455 | 1452 | ||
1456 | down(&uea_semaphore); | 1453 | mutex_lock(&uea_mutex); |
1457 | sc = dev_to_uea(dev); | 1454 | sc = dev_to_uea(dev); |
1458 | if (!sc) | 1455 | if (!sc) |
1459 | goto out; | 1456 | goto out; |
@@ -1473,7 +1470,7 @@ static ssize_t read_human_status(struct device *dev, struct device_attribute *at | |||
1473 | break; | 1470 | break; |
1474 | } | 1471 | } |
1475 | out: | 1472 | out: |
1476 | up(&uea_semaphore); | 1473 | mutex_unlock(&uea_mutex); |
1477 | return ret; | 1474 | return ret; |
1478 | } | 1475 | } |
1479 | 1476 | ||
@@ -1485,7 +1482,7 @@ static ssize_t read_delin(struct device *dev, struct device_attribute *attr, | |||
1485 | int ret = -ENODEV; | 1482 | int ret = -ENODEV; |
1486 | struct uea_softc *sc; | 1483 | struct uea_softc *sc; |
1487 | 1484 | ||
1488 | down(&uea_semaphore); | 1485 | mutex_lock(&uea_mutex); |
1489 | sc = dev_to_uea(dev); | 1486 | sc = dev_to_uea(dev); |
1490 | if (!sc) | 1487 | if (!sc) |
1491 | goto out; | 1488 | goto out; |
@@ -1497,7 +1494,7 @@ static ssize_t read_delin(struct device *dev, struct device_attribute *attr, | |||
1497 | else | 1494 | else |
1498 | ret = sprintf(buf, "GOOD\n"); | 1495 | ret = sprintf(buf, "GOOD\n"); |
1499 | out: | 1496 | out: |
1500 | up(&uea_semaphore); | 1497 | mutex_unlock(&uea_mutex); |
1501 | return ret; | 1498 | return ret; |
1502 | } | 1499 | } |
1503 | 1500 | ||
@@ -1511,7 +1508,7 @@ static ssize_t read_##name(struct device *dev, \ | |||
1511 | int ret = -ENODEV; \ | 1508 | int ret = -ENODEV; \ |
1512 | struct uea_softc *sc; \ | 1509 | struct uea_softc *sc; \ |
1513 | \ | 1510 | \ |
1514 | down(&uea_semaphore); \ | 1511 | mutex_lock(&uea_mutex); \ |
1515 | sc = dev_to_uea(dev); \ | 1512 | sc = dev_to_uea(dev); \ |
1516 | if (!sc) \ | 1513 | if (!sc) \ |
1517 | goto out; \ | 1514 | goto out; \ |
@@ -1519,7 +1516,7 @@ static ssize_t read_##name(struct device *dev, \ | |||
1519 | if (reset) \ | 1516 | if (reset) \ |
1520 | sc->stats.phy.name = 0; \ | 1517 | sc->stats.phy.name = 0; \ |
1521 | out: \ | 1518 | out: \ |
1522 | up(&uea_semaphore); \ | 1519 | mutex_unlock(&uea_mutex); \ |
1523 | return ret; \ | 1520 | return ret; \ |
1524 | } \ | 1521 | } \ |
1525 | \ | 1522 | \ |
@@ -1617,7 +1614,7 @@ static void create_fs_entries(struct uea_softc *sc, struct usb_interface *intf) | |||
1617 | } | 1614 | } |
1618 | 1615 | ||
1619 | static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, | 1616 | static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, |
1620 | const struct usb_device_id *id, int *heavy) | 1617 | const struct usb_device_id *id) |
1621 | { | 1618 | { |
1622 | struct usb_device *usb = interface_to_usbdev(intf); | 1619 | struct usb_device *usb = interface_to_usbdev(intf); |
1623 | struct uea_softc *sc; | 1620 | struct uea_softc *sc; |
@@ -1629,16 +1626,14 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, | |||
1629 | if (ifnum != UEA_INTR_IFACE_NO) | 1626 | if (ifnum != UEA_INTR_IFACE_NO) |
1630 | return -ENODEV; | 1627 | return -ENODEV; |
1631 | 1628 | ||
1632 | *heavy = sync_wait[modem_index]; | 1629 | usbatm->flags = (sync_wait[modem_index] ? 0 : UDSL_SKIP_HEAVY_INIT); |
1633 | 1630 | ||
1634 | /* interface 1 is for outbound traffic */ | 1631 | /* interface 1 is for outbound traffic */ |
1635 | ret = claim_interface(usb, usbatm, UEA_US_IFACE_NO); | 1632 | ret = claim_interface(usb, usbatm, UEA_US_IFACE_NO); |
1636 | if (ret < 0) | 1633 | if (ret < 0) |
1637 | return ret; | 1634 | return ret; |
1638 | 1635 | ||
1639 | /* ADI930 has only 2 interfaces and inbound traffic | 1636 | /* ADI930 has only 2 interfaces and inbound traffic is on interface 1 */ |
1640 | * is on interface 1 | ||
1641 | */ | ||
1642 | if (UEA_CHIP_VERSION(id) != ADI930) { | 1637 | if (UEA_CHIP_VERSION(id) != ADI930) { |
1643 | /* interface 2 is for inbound traffic */ | 1638 | /* interface 2 is for inbound traffic */ |
1644 | ret = claim_interface(usb, usbatm, UEA_DS_IFACE_NO); | 1639 | ret = claim_interface(usb, usbatm, UEA_DS_IFACE_NO); |
@@ -1658,6 +1653,25 @@ static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf, | |||
1658 | sc->modem_index = (modem_index < NB_MODEM) ? modem_index++ : 0; | 1653 | sc->modem_index = (modem_index < NB_MODEM) ? modem_index++ : 0; |
1659 | sc->driver_info = id->driver_info; | 1654 | sc->driver_info = id->driver_info; |
1660 | 1655 | ||
1656 | /* ADI930 don't support iso */ | ||
1657 | if (UEA_CHIP_VERSION(id) != ADI930 && use_iso[sc->modem_index]) { | ||
1658 | int i; | ||
1659 | |||
1660 | /* try set fastest alternate for inbound traffic interface */ | ||
1661 | for (i = FASTEST_ISO_INTF; i > 0; i--) | ||
1662 | if (usb_set_interface(usb, UEA_DS_IFACE_NO, i) == 0) | ||
1663 | break; | ||
1664 | |||
1665 | if (i > 0) { | ||
1666 | uea_dbg(usb, "set alternate %d for 2 interface\n", i); | ||
1667 | uea_info(usb, "using iso mode\n"); | ||
1668 | usbatm->flags |= UDSL_USE_ISOC | UDSL_IGNORE_EILSEQ; | ||
1669 | } else { | ||
1670 | uea_err(usb, "setting any alternate failed for " | ||
1671 | "2 interface, using bulk mode\n"); | ||
1672 | } | ||
1673 | } | ||
1674 | |||
1661 | ret = uea_boot(sc); | 1675 | ret = uea_boot(sc); |
1662 | if (ret < 0) { | 1676 | if (ret < 0) { |
1663 | kfree(sc); | 1677 | kfree(sc); |
@@ -1701,13 +1715,13 @@ static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf) | |||
1701 | 1715 | ||
1702 | static struct usbatm_driver uea_usbatm_driver = { | 1716 | static struct usbatm_driver uea_usbatm_driver = { |
1703 | .driver_name = "ueagle-atm", | 1717 | .driver_name = "ueagle-atm", |
1704 | .owner = THIS_MODULE, | ||
1705 | .bind = uea_bind, | 1718 | .bind = uea_bind, |
1706 | .atm_start = uea_atm_open, | 1719 | .atm_start = uea_atm_open, |
1707 | .unbind = uea_unbind, | 1720 | .unbind = uea_unbind, |
1708 | .heavy_init = uea_heavy, | 1721 | .heavy_init = uea_heavy, |
1709 | .in = UEA_BULK_DATA_PIPE, | 1722 | .bulk_in = UEA_BULK_DATA_PIPE, |
1710 | .out = UEA_BULK_DATA_PIPE, | 1723 | .bulk_out = UEA_BULK_DATA_PIPE, |
1724 | .isoc_in = UEA_ISO_DATA_PIPE, | ||
1711 | }; | 1725 | }; |
1712 | 1726 | ||
1713 | static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id) | 1727 | static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id) |
@@ -1738,9 +1752,9 @@ static void uea_disconnect(struct usb_interface *intf) | |||
1738 | * Pre-firmware device has one interface | 1752 | * Pre-firmware device has one interface |
1739 | */ | 1753 | */ |
1740 | if (usb->config->desc.bNumInterfaces != 1 && ifnum == 0) { | 1754 | if (usb->config->desc.bNumInterfaces != 1 && ifnum == 0) { |
1741 | down(&uea_semaphore); | 1755 | mutex_lock(&uea_mutex); |
1742 | usbatm_usb_disconnect(intf); | 1756 | usbatm_usb_disconnect(intf); |
1743 | up(&uea_semaphore); | 1757 | mutex_unlock(&uea_mutex); |
1744 | uea_info(usb, "ADSL device removed\n"); | 1758 | uea_info(usb, "ADSL device removed\n"); |
1745 | } | 1759 | } |
1746 | 1760 | ||
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index 7af1883d4bf9..c1211fc037d9 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -72,6 +72,7 @@ | |||
72 | #include <linux/kernel.h> | 72 | #include <linux/kernel.h> |
73 | #include <linux/module.h> | 73 | #include <linux/module.h> |
74 | #include <linux/moduleparam.h> | 74 | #include <linux/moduleparam.h> |
75 | #include <linux/netdevice.h> | ||
75 | #include <linux/proc_fs.h> | 76 | #include <linux/proc_fs.h> |
76 | #include <linux/sched.h> | 77 | #include <linux/sched.h> |
77 | #include <linux/signal.h> | 78 | #include <linux/signal.h> |
@@ -91,19 +92,18 @@ static int usbatm_print_packet(const unsigned char *data, int len); | |||
91 | #endif | 92 | #endif |
92 | 93 | ||
93 | #define DRIVER_AUTHOR "Johan Verrept, Duncan Sands <duncan.sands@free.fr>" | 94 | #define DRIVER_AUTHOR "Johan Verrept, Duncan Sands <duncan.sands@free.fr>" |
94 | #define DRIVER_VERSION "1.9" | 95 | #define DRIVER_VERSION "1.10" |
95 | #define DRIVER_DESC "Generic USB ATM/DSL I/O, version " DRIVER_VERSION | 96 | #define DRIVER_DESC "Generic USB ATM/DSL I/O, version " DRIVER_VERSION |
96 | 97 | ||
97 | static const char usbatm_driver_name[] = "usbatm"; | 98 | static const char usbatm_driver_name[] = "usbatm"; |
98 | 99 | ||
99 | #define UDSL_MAX_RCV_URBS 16 | 100 | #define UDSL_MAX_RCV_URBS 16 |
100 | #define UDSL_MAX_SND_URBS 16 | 101 | #define UDSL_MAX_SND_URBS 16 |
101 | #define UDSL_MAX_RCV_BUF_SIZE 1024 /* ATM cells */ | 102 | #define UDSL_MAX_BUF_SIZE 64 * 1024 /* bytes */ |
102 | #define UDSL_MAX_SND_BUF_SIZE 1024 /* ATM cells */ | ||
103 | #define UDSL_DEFAULT_RCV_URBS 4 | 103 | #define UDSL_DEFAULT_RCV_URBS 4 |
104 | #define UDSL_DEFAULT_SND_URBS 4 | 104 | #define UDSL_DEFAULT_SND_URBS 4 |
105 | #define UDSL_DEFAULT_RCV_BUF_SIZE 64 /* ATM cells */ | 105 | #define UDSL_DEFAULT_RCV_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ |
106 | #define UDSL_DEFAULT_SND_BUF_SIZE 64 /* ATM cells */ | 106 | #define UDSL_DEFAULT_SND_BUF_SIZE 64 * ATM_CELL_SIZE /* bytes */ |
107 | 107 | ||
108 | #define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) | 108 | #define ATM_CELL_HEADER (ATM_CELL_SIZE - ATM_CELL_PAYLOAD) |
109 | 109 | ||
@@ -111,8 +111,8 @@ static const char usbatm_driver_name[] = "usbatm"; | |||
111 | 111 | ||
112 | static unsigned int num_rcv_urbs = UDSL_DEFAULT_RCV_URBS; | 112 | static unsigned int num_rcv_urbs = UDSL_DEFAULT_RCV_URBS; |
113 | static unsigned int num_snd_urbs = UDSL_DEFAULT_SND_URBS; | 113 | static unsigned int num_snd_urbs = UDSL_DEFAULT_SND_URBS; |
114 | static unsigned int rcv_buf_size = UDSL_DEFAULT_RCV_BUF_SIZE; | 114 | static unsigned int rcv_buf_bytes = UDSL_DEFAULT_RCV_BUF_SIZE; |
115 | static unsigned int snd_buf_size = UDSL_DEFAULT_SND_BUF_SIZE; | 115 | static unsigned int snd_buf_bytes = UDSL_DEFAULT_SND_BUF_SIZE; |
116 | 116 | ||
117 | module_param(num_rcv_urbs, uint, S_IRUGO); | 117 | module_param(num_rcv_urbs, uint, S_IRUGO); |
118 | MODULE_PARM_DESC(num_rcv_urbs, | 118 | MODULE_PARM_DESC(num_rcv_urbs, |
@@ -126,15 +126,15 @@ MODULE_PARM_DESC(num_snd_urbs, | |||
126 | __MODULE_STRING(UDSL_MAX_SND_URBS) ", default: " | 126 | __MODULE_STRING(UDSL_MAX_SND_URBS) ", default: " |
127 | __MODULE_STRING(UDSL_DEFAULT_SND_URBS) ")"); | 127 | __MODULE_STRING(UDSL_DEFAULT_SND_URBS) ")"); |
128 | 128 | ||
129 | module_param(rcv_buf_size, uint, S_IRUGO); | 129 | module_param(rcv_buf_bytes, uint, S_IRUGO); |
130 | MODULE_PARM_DESC(rcv_buf_size, | 130 | MODULE_PARM_DESC(rcv_buf_bytes, |
131 | "Size of the buffers used for reception in ATM cells (range: 1-" | 131 | "Size of the buffers used for reception, in bytes (range: 1-" |
132 | __MODULE_STRING(UDSL_MAX_RCV_BUF_SIZE) ", default: " | 132 | __MODULE_STRING(UDSL_MAX_BUF_SIZE) ", default: " |
133 | __MODULE_STRING(UDSL_DEFAULT_RCV_BUF_SIZE) ")"); | 133 | __MODULE_STRING(UDSL_DEFAULT_RCV_BUF_SIZE) ")"); |
134 | 134 | ||
135 | module_param(snd_buf_size, uint, S_IRUGO); | 135 | module_param(snd_buf_bytes, uint, S_IRUGO); |
136 | MODULE_PARM_DESC(snd_buf_size, | 136 | MODULE_PARM_DESC(snd_buf_bytes, |
137 | "Size of the buffers used for transmission in ATM cells (range: 1-" | 137 | "Size of the buffers used for transmission, in bytes (range: 1-" |
138 | __MODULE_STRING(UDSL_MAX_SND_BUF_SIZE) ", default: " | 138 | __MODULE_STRING(UDSL_MAX_SND_BUF_SIZE) ", default: " |
139 | __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")"); | 139 | __MODULE_STRING(UDSL_DEFAULT_SND_BUF_SIZE) ")"); |
140 | 140 | ||
@@ -166,10 +166,10 @@ struct usbatm_control { | |||
166 | 166 | ||
167 | /* ATM */ | 167 | /* ATM */ |
168 | 168 | ||
169 | static void usbatm_atm_dev_close(struct atm_dev *dev); | 169 | static void usbatm_atm_dev_close(struct atm_dev *atm_dev); |
170 | static int usbatm_atm_open(struct atm_vcc *vcc); | 170 | static int usbatm_atm_open(struct atm_vcc *vcc); |
171 | static void usbatm_atm_close(struct atm_vcc *vcc); | 171 | static void usbatm_atm_close(struct atm_vcc *vcc); |
172 | static int usbatm_atm_ioctl(struct atm_dev *dev, unsigned int cmd, void __user * arg); | 172 | static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd, void __user * arg); |
173 | static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb); | 173 | static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb); |
174 | static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t * pos, char *page); | 174 | static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t * pos, char *page); |
175 | 175 | ||
@@ -199,7 +199,7 @@ static inline void usbatm_pop(struct atm_vcc *vcc, struct sk_buff *skb) | |||
199 | if (vcc->pop) | 199 | if (vcc->pop) |
200 | vcc->pop(vcc, skb); | 200 | vcc->pop(vcc, skb); |
201 | else | 201 | else |
202 | dev_kfree_skb(skb); | 202 | dev_kfree_skb_any(skb); |
203 | } | 203 | } |
204 | 204 | ||
205 | 205 | ||
@@ -234,8 +234,9 @@ static int usbatm_submit_urb(struct urb *urb) | |||
234 | 234 | ||
235 | ret = usb_submit_urb(urb, GFP_ATOMIC); | 235 | ret = usb_submit_urb(urb, GFP_ATOMIC); |
236 | if (ret) { | 236 | if (ret) { |
237 | atm_dbg(channel->usbatm, "%s: urb 0x%p submission failed (%d)!\n", | 237 | if (printk_ratelimit()) |
238 | __func__, urb, ret); | 238 | atm_warn(channel->usbatm, "%s: urb 0x%p submission failed (%d)!\n", |
239 | __func__, urb, ret); | ||
239 | 240 | ||
240 | /* consider all errors transient and return the buffer back to the queue */ | 241 | /* consider all errors transient and return the buffer back to the queue */ |
241 | urb->status = -EAGAIN; | 242 | urb->status = -EAGAIN; |
@@ -269,10 +270,16 @@ static void usbatm_complete(struct urb *urb, struct pt_regs *regs) | |||
269 | 270 | ||
270 | spin_unlock_irqrestore(&channel->lock, flags); | 271 | spin_unlock_irqrestore(&channel->lock, flags); |
271 | 272 | ||
272 | if (unlikely(urb->status)) | 273 | if (unlikely(urb->status) && |
274 | (!(channel->usbatm->flags & UDSL_IGNORE_EILSEQ) || | ||
275 | urb->status != -EILSEQ )) | ||
276 | { | ||
277 | if (printk_ratelimit()) | ||
278 | atm_warn(channel->usbatm, "%s: urb 0x%p failed (%d)!\n", | ||
279 | __func__, urb, urb->status); | ||
273 | /* throttle processing in case of an error */ | 280 | /* throttle processing in case of an error */ |
274 | mod_timer(&channel->delay, jiffies + msecs_to_jiffies(THROTTLE_MSECS)); | 281 | mod_timer(&channel->delay, jiffies + msecs_to_jiffies(THROTTLE_MSECS)); |
275 | else | 282 | } else |
276 | tasklet_schedule(&channel->tasklet); | 283 | tasklet_schedule(&channel->tasklet); |
277 | } | 284 | } |
278 | 285 | ||
@@ -284,129 +291,167 @@ static void usbatm_complete(struct urb *urb, struct pt_regs *regs) | |||
284 | static inline struct usbatm_vcc_data *usbatm_find_vcc(struct usbatm_data *instance, | 291 | static inline struct usbatm_vcc_data *usbatm_find_vcc(struct usbatm_data *instance, |
285 | short vpi, int vci) | 292 | short vpi, int vci) |
286 | { | 293 | { |
287 | struct usbatm_vcc_data *vcc; | 294 | struct usbatm_vcc_data *vcc_data; |
288 | 295 | ||
289 | list_for_each_entry(vcc, &instance->vcc_list, list) | 296 | list_for_each_entry(vcc_data, &instance->vcc_list, list) |
290 | if ((vcc->vci == vci) && (vcc->vpi == vpi)) | 297 | if ((vcc_data->vci == vci) && (vcc_data->vpi == vpi)) |
291 | return vcc; | 298 | return vcc_data; |
292 | return NULL; | 299 | return NULL; |
293 | } | 300 | } |
294 | 301 | ||
295 | static void usbatm_extract_cells(struct usbatm_data *instance, | 302 | static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char *source) |
296 | unsigned char *source, unsigned int avail_data) | ||
297 | { | 303 | { |
298 | struct usbatm_vcc_data *cached_vcc = NULL; | ||
299 | struct atm_vcc *vcc; | 304 | struct atm_vcc *vcc; |
300 | struct sk_buff *sarb; | 305 | struct sk_buff *sarb; |
301 | unsigned int stride = instance->rx_channel.stride; | 306 | short vpi = ((source[0] & 0x0f) << 4) | (source[1] >> 4); |
302 | int vci, cached_vci = 0; | 307 | int vci = ((source[1] & 0x0f) << 12) | (source[2] << 4) | (source[3] >> 4); |
303 | short vpi, cached_vpi = 0; | 308 | u8 pti = ((source[3] & 0xe) >> 1); |
304 | u8 pti; | ||
305 | 309 | ||
306 | for (; avail_data >= stride; avail_data -= stride, source += stride) { | 310 | vdbg("%s: vpi %hd, vci %d, pti %d", __func__, vpi, vci, pti); |
307 | vpi = ((source[0] & 0x0f) << 4) | (source[1] >> 4); | ||
308 | vci = ((source[1] & 0x0f) << 12) | (source[2] << 4) | (source[3] >> 4); | ||
309 | pti = ((source[3] & 0xe) >> 1); | ||
310 | 311 | ||
311 | vdbg("%s: vpi %hd, vci %d, pti %d", __func__, vpi, vci, pti); | 312 | if ((vci != instance->cached_vci) || (vpi != instance->cached_vpi)) { |
313 | instance->cached_vpi = vpi; | ||
314 | instance->cached_vci = vci; | ||
312 | 315 | ||
313 | if ((vci != cached_vci) || (vpi != cached_vpi)) { | 316 | instance->cached_vcc = usbatm_find_vcc(instance, vpi, vci); |
314 | cached_vpi = vpi; | ||
315 | cached_vci = vci; | ||
316 | 317 | ||
317 | cached_vcc = usbatm_find_vcc(instance, vpi, vci); | 318 | if (!instance->cached_vcc) |
319 | atm_rldbg(instance, "%s: unknown vpi/vci (%hd/%d)!\n", __func__, vpi, vci); | ||
320 | } | ||
318 | 321 | ||
319 | if (!cached_vcc) | 322 | if (!instance->cached_vcc) |
320 | atm_dbg(instance, "%s: unknown vpi/vci (%hd/%d)!\n", __func__, vpi, vci); | 323 | return; |
321 | } | ||
322 | 324 | ||
323 | if (!cached_vcc) | 325 | vcc = instance->cached_vcc->vcc; |
324 | continue; | ||
325 | 326 | ||
326 | vcc = cached_vcc->vcc; | 327 | /* OAM F5 end-to-end */ |
328 | if (pti == ATM_PTI_E2EF5) { | ||
329 | if (printk_ratelimit()) | ||
330 | atm_warn(instance, "%s: OAM not supported (vpi %d, vci %d)!\n", | ||
331 | __func__, vpi, vci); | ||
332 | atomic_inc(&vcc->stats->rx_err); | ||
333 | return; | ||
334 | } | ||
327 | 335 | ||
328 | /* OAM F5 end-to-end */ | 336 | sarb = instance->cached_vcc->sarb; |
329 | if (pti == ATM_PTI_E2EF5) { | ||
330 | atm_warn(instance, "%s: OAM not supported (vpi %d, vci %d)!\n", __func__, vpi, vci); | ||
331 | atomic_inc(&vcc->stats->rx_err); | ||
332 | continue; | ||
333 | } | ||
334 | 337 | ||
335 | sarb = cached_vcc->sarb; | 338 | if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) { |
339 | atm_rldbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", | ||
340 | __func__, sarb->len, vcc); | ||
341 | /* discard cells already received */ | ||
342 | skb_trim(sarb, 0); | ||
343 | UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); | ||
344 | } | ||
336 | 345 | ||
337 | if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) { | 346 | memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); |
338 | atm_dbg(instance, "%s: buffer overrun (sarb->len %u, vcc: 0x%p)!\n", | 347 | __skb_put(sarb, ATM_CELL_PAYLOAD); |
339 | __func__, sarb->len, vcc); | ||
340 | /* discard cells already received */ | ||
341 | skb_trim(sarb, 0); | ||
342 | UDSL_ASSERT(sarb->tail + ATM_CELL_PAYLOAD <= sarb->end); | ||
343 | } | ||
344 | 348 | ||
345 | memcpy(sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); | 349 | if (pti & 1) { |
346 | __skb_put(sarb, ATM_CELL_PAYLOAD); | 350 | struct sk_buff *skb; |
351 | unsigned int length; | ||
352 | unsigned int pdu_length; | ||
347 | 353 | ||
348 | if (pti & 1) { | 354 | length = (source[ATM_CELL_SIZE - 6] << 8) + source[ATM_CELL_SIZE - 5]; |
349 | struct sk_buff *skb; | ||
350 | unsigned int length; | ||
351 | unsigned int pdu_length; | ||
352 | 355 | ||
353 | length = (source[ATM_CELL_SIZE - 6] << 8) + source[ATM_CELL_SIZE - 5]; | 356 | /* guard against overflow */ |
357 | if (length > ATM_MAX_AAL5_PDU) { | ||
358 | atm_rldbg(instance, "%s: bogus length %u (vcc: 0x%p)!\n", | ||
359 | __func__, length, vcc); | ||
360 | atomic_inc(&vcc->stats->rx_err); | ||
361 | goto out; | ||
362 | } | ||
354 | 363 | ||
355 | /* guard against overflow */ | 364 | pdu_length = usbatm_pdu_length(length); |
356 | if (length > ATM_MAX_AAL5_PDU) { | ||
357 | atm_dbg(instance, "%s: bogus length %u (vcc: 0x%p)!\n", | ||
358 | __func__, length, vcc); | ||
359 | atomic_inc(&vcc->stats->rx_err); | ||
360 | goto out; | ||
361 | } | ||
362 | 365 | ||
363 | pdu_length = usbatm_pdu_length(length); | 366 | if (sarb->len < pdu_length) { |
367 | atm_rldbg(instance, "%s: bogus pdu_length %u (sarb->len: %u, vcc: 0x%p)!\n", | ||
368 | __func__, pdu_length, sarb->len, vcc); | ||
369 | atomic_inc(&vcc->stats->rx_err); | ||
370 | goto out; | ||
371 | } | ||
364 | 372 | ||
365 | if (sarb->len < pdu_length) { | 373 | if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) { |
366 | atm_dbg(instance, "%s: bogus pdu_length %u (sarb->len: %u, vcc: 0x%p)!\n", | 374 | atm_rldbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", |
367 | __func__, pdu_length, sarb->len, vcc); | 375 | __func__, vcc); |
368 | atomic_inc(&vcc->stats->rx_err); | 376 | atomic_inc(&vcc->stats->rx_err); |
369 | goto out; | 377 | goto out; |
370 | } | 378 | } |
371 | 379 | ||
372 | if (crc32_be(~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) { | 380 | vdbg("%s: got packet (length: %u, pdu_length: %u, vcc: 0x%p)", __func__, length, pdu_length, vcc); |
373 | atm_dbg(instance, "%s: packet failed crc check (vcc: 0x%p)!\n", | ||
374 | __func__, vcc); | ||
375 | atomic_inc(&vcc->stats->rx_err); | ||
376 | goto out; | ||
377 | } | ||
378 | 381 | ||
379 | vdbg("%s: got packet (length: %u, pdu_length: %u, vcc: 0x%p)", __func__, length, pdu_length, vcc); | 382 | if (!(skb = dev_alloc_skb(length))) { |
383 | if (printk_ratelimit()) | ||
384 | atm_err(instance, "%s: no memory for skb (length: %u)!\n", | ||
385 | __func__, length); | ||
386 | atomic_inc(&vcc->stats->rx_drop); | ||
387 | goto out; | ||
388 | } | ||
380 | 389 | ||
381 | if (!(skb = dev_alloc_skb(length))) { | 390 | vdbg("%s: allocated new sk_buff (skb: 0x%p, skb->truesize: %u)", __func__, skb, skb->truesize); |
382 | atm_dbg(instance, "%s: no memory for skb (length: %u)!\n", __func__, length); | ||
383 | atomic_inc(&vcc->stats->rx_drop); | ||
384 | goto out; | ||
385 | } | ||
386 | 391 | ||
387 | vdbg("%s: allocated new sk_buff (skb: 0x%p, skb->truesize: %u)", __func__, skb, skb->truesize); | 392 | if (!atm_charge(vcc, skb->truesize)) { |
393 | atm_rldbg(instance, "%s: failed atm_charge (skb->truesize: %u)!\n", | ||
394 | __func__, skb->truesize); | ||
395 | dev_kfree_skb_any(skb); | ||
396 | goto out; /* atm_charge increments rx_drop */ | ||
397 | } | ||
388 | 398 | ||
389 | if (!atm_charge(vcc, skb->truesize)) { | 399 | memcpy(skb->data, sarb->tail - pdu_length, length); |
390 | atm_dbg(instance, "%s: failed atm_charge (skb->truesize: %u)!\n", __func__, skb->truesize); | 400 | __skb_put(skb, length); |
391 | dev_kfree_skb(skb); | ||
392 | goto out; /* atm_charge increments rx_drop */ | ||
393 | } | ||
394 | 401 | ||
395 | memcpy(skb->data, sarb->tail - pdu_length, length); | 402 | vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", |
396 | __skb_put(skb, length); | 403 | __func__, skb, skb->len, skb->truesize); |
397 | 404 | ||
398 | vdbg("%s: sending skb 0x%p, skb->len %u, skb->truesize %u", | 405 | PACKETDEBUG(skb->data, skb->len); |
399 | __func__, skb, skb->len, skb->truesize); | ||
400 | 406 | ||
401 | PACKETDEBUG(skb->data, skb->len); | 407 | vcc->push(vcc, skb); |
402 | 408 | ||
403 | vcc->push(vcc, skb); | 409 | atomic_inc(&vcc->stats->rx); |
410 | out: | ||
411 | skb_trim(sarb, 0); | ||
412 | } | ||
413 | } | ||
404 | 414 | ||
405 | atomic_inc(&vcc->stats->rx); | 415 | static void usbatm_extract_cells(struct usbatm_data *instance, |
406 | out: | 416 | unsigned char *source, unsigned int avail_data) |
407 | skb_trim(sarb, 0); | 417 | { |
418 | unsigned int stride = instance->rx_channel.stride; | ||
419 | unsigned int buf_usage = instance->buf_usage; | ||
420 | |||
421 | /* extract cells from incoming data, taking into account that | ||
422 | * the length of avail data may not be a multiple of stride */ | ||
423 | |||
424 | if (buf_usage > 0) { | ||
425 | /* we have a partially received atm cell */ | ||
426 | unsigned char *cell_buf = instance->cell_buf; | ||
427 | unsigned int space_left = stride - buf_usage; | ||
428 | |||
429 | UDSL_ASSERT(buf_usage <= stride); | ||
430 | |||
431 | if (avail_data >= space_left) { | ||
432 | /* add new data and process cell */ | ||
433 | memcpy(cell_buf + buf_usage, source, space_left); | ||
434 | source += space_left; | ||
435 | avail_data -= space_left; | ||
436 | usbatm_extract_one_cell(instance, cell_buf); | ||
437 | instance->buf_usage = 0; | ||
438 | } else { | ||
439 | /* not enough data to fill the cell */ | ||
440 | memcpy(cell_buf + buf_usage, source, avail_data); | ||
441 | instance->buf_usage = buf_usage + avail_data; | ||
442 | return; | ||
408 | } | 443 | } |
409 | } | 444 | } |
445 | |||
446 | for (; avail_data >= stride; avail_data -= stride, source += stride) | ||
447 | usbatm_extract_one_cell(instance, source); | ||
448 | |||
449 | if (avail_data > 0) { | ||
450 | /* length was not a multiple of stride - | ||
451 | * save remaining data for next call */ | ||
452 | memcpy(instance->cell_buf, source, avail_data); | ||
453 | instance->buf_usage = avail_data; | ||
454 | } | ||
410 | } | 455 | } |
411 | 456 | ||
412 | 457 | ||
@@ -420,14 +465,14 @@ static unsigned int usbatm_write_cells(struct usbatm_data *instance, | |||
420 | { | 465 | { |
421 | struct usbatm_control *ctrl = UDSL_SKB(skb); | 466 | struct usbatm_control *ctrl = UDSL_SKB(skb); |
422 | struct atm_vcc *vcc = ctrl->atm.vcc; | 467 | struct atm_vcc *vcc = ctrl->atm.vcc; |
423 | unsigned int num_written; | 468 | unsigned int bytes_written; |
424 | unsigned int stride = instance->tx_channel.stride; | 469 | unsigned int stride = instance->tx_channel.stride; |
425 | 470 | ||
426 | vdbg("%s: skb->len=%d, avail_space=%u", __func__, skb->len, avail_space); | 471 | vdbg("%s: skb->len=%d, avail_space=%u", __func__, skb->len, avail_space); |
427 | UDSL_ASSERT(!(avail_space % stride)); | 472 | UDSL_ASSERT(!(avail_space % stride)); |
428 | 473 | ||
429 | for (num_written = 0; num_written < avail_space && ctrl->len; | 474 | for (bytes_written = 0; bytes_written < avail_space && ctrl->len; |
430 | num_written += stride, target += stride) { | 475 | bytes_written += stride, target += stride) { |
431 | unsigned int data_len = min_t(unsigned int, skb->len, ATM_CELL_PAYLOAD); | 476 | unsigned int data_len = min_t(unsigned int, skb->len, ATM_CELL_PAYLOAD); |
432 | unsigned int left = ATM_CELL_PAYLOAD - data_len; | 477 | unsigned int left = ATM_CELL_PAYLOAD - data_len; |
433 | u8 *ptr = target; | 478 | u8 *ptr = target; |
@@ -470,7 +515,7 @@ static unsigned int usbatm_write_cells(struct usbatm_data *instance, | |||
470 | ctrl->crc = crc32_be(ctrl->crc, ptr, left); | 515 | ctrl->crc = crc32_be(ctrl->crc, ptr, left); |
471 | } | 516 | } |
472 | 517 | ||
473 | return num_written; | 518 | return bytes_written; |
474 | } | 519 | } |
475 | 520 | ||
476 | 521 | ||
@@ -487,16 +532,40 @@ static void usbatm_rx_process(unsigned long data) | |||
487 | vdbg("%s: processing urb 0x%p", __func__, urb); | 532 | vdbg("%s: processing urb 0x%p", __func__, urb); |
488 | 533 | ||
489 | if (usb_pipeisoc(urb->pipe)) { | 534 | if (usb_pipeisoc(urb->pipe)) { |
535 | unsigned char *merge_start = NULL; | ||
536 | unsigned int merge_length = 0; | ||
537 | const unsigned int packet_size = instance->rx_channel.packet_size; | ||
490 | int i; | 538 | int i; |
491 | for (i = 0; i < urb->number_of_packets; i++) | 539 | |
492 | if (!urb->iso_frame_desc[i].status) | 540 | for (i = 0; i < urb->number_of_packets; i++) { |
493 | usbatm_extract_cells(instance, | 541 | if (!urb->iso_frame_desc[i].status) { |
494 | (u8 *)urb->transfer_buffer + urb->iso_frame_desc[i].offset, | 542 | unsigned int actual_length = urb->iso_frame_desc[i].actual_length; |
495 | urb->iso_frame_desc[i].actual_length); | 543 | |
496 | } | 544 | UDSL_ASSERT(actual_length <= packet_size); |
497 | else | 545 | |
546 | if (!merge_length) | ||
547 | merge_start = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset; | ||
548 | merge_length += actual_length; | ||
549 | if (merge_length && (actual_length < packet_size)) { | ||
550 | usbatm_extract_cells(instance, merge_start, merge_length); | ||
551 | merge_length = 0; | ||
552 | } | ||
553 | } else { | ||
554 | atm_rldbg(instance, "%s: status %d in frame %d!\n", __func__, urb->status, i); | ||
555 | if (merge_length) | ||
556 | usbatm_extract_cells(instance, merge_start, merge_length); | ||
557 | merge_length = 0; | ||
558 | instance->buf_usage = 0; | ||
559 | } | ||
560 | } | ||
561 | |||
562 | if (merge_length) | ||
563 | usbatm_extract_cells(instance, merge_start, merge_length); | ||
564 | } else | ||
498 | if (!urb->status) | 565 | if (!urb->status) |
499 | usbatm_extract_cells(instance, urb->transfer_buffer, urb->actual_length); | 566 | usbatm_extract_cells(instance, urb->transfer_buffer, urb->actual_length); |
567 | else | ||
568 | instance->buf_usage = 0; | ||
500 | 569 | ||
501 | if (usbatm_submit_urb(urb)) | 570 | if (usbatm_submit_urb(urb)) |
502 | return; | 571 | return; |
@@ -514,7 +583,7 @@ static void usbatm_tx_process(unsigned long data) | |||
514 | struct sk_buff *skb = instance->current_skb; | 583 | struct sk_buff *skb = instance->current_skb; |
515 | struct urb *urb = NULL; | 584 | struct urb *urb = NULL; |
516 | const unsigned int buf_size = instance->tx_channel.buf_size; | 585 | const unsigned int buf_size = instance->tx_channel.buf_size; |
517 | unsigned int num_written = 0; | 586 | unsigned int bytes_written = 0; |
518 | u8 *buffer = NULL; | 587 | u8 *buffer = NULL; |
519 | 588 | ||
520 | if (!skb) | 589 | if (!skb) |
@@ -526,16 +595,16 @@ static void usbatm_tx_process(unsigned long data) | |||
526 | if (!urb) | 595 | if (!urb) |
527 | break; /* no more senders */ | 596 | break; /* no more senders */ |
528 | buffer = urb->transfer_buffer; | 597 | buffer = urb->transfer_buffer; |
529 | num_written = (urb->status == -EAGAIN) ? | 598 | bytes_written = (urb->status == -EAGAIN) ? |
530 | urb->transfer_buffer_length : 0; | 599 | urb->transfer_buffer_length : 0; |
531 | } | 600 | } |
532 | 601 | ||
533 | num_written += usbatm_write_cells(instance, skb, | 602 | bytes_written += usbatm_write_cells(instance, skb, |
534 | buffer + num_written, | 603 | buffer + bytes_written, |
535 | buf_size - num_written); | 604 | buf_size - bytes_written); |
536 | 605 | ||
537 | vdbg("%s: wrote %u bytes from skb 0x%p to urb 0x%p", | 606 | vdbg("%s: wrote %u bytes from skb 0x%p to urb 0x%p", |
538 | __func__, num_written, skb, urb); | 607 | __func__, bytes_written, skb, urb); |
539 | 608 | ||
540 | if (!UDSL_SKB(skb)->len) { | 609 | if (!UDSL_SKB(skb)->len) { |
541 | struct atm_vcc *vcc = UDSL_SKB(skb)->atm.vcc; | 610 | struct atm_vcc *vcc = UDSL_SKB(skb)->atm.vcc; |
@@ -546,8 +615,8 @@ static void usbatm_tx_process(unsigned long data) | |||
546 | skb = skb_dequeue(&instance->sndqueue); | 615 | skb = skb_dequeue(&instance->sndqueue); |
547 | } | 616 | } |
548 | 617 | ||
549 | if (num_written == buf_size || (!skb && num_written)) { | 618 | if (bytes_written == buf_size || (!skb && bytes_written)) { |
550 | urb->transfer_buffer_length = num_written; | 619 | urb->transfer_buffer_length = bytes_written; |
551 | 620 | ||
552 | if (usbatm_submit_urb(urb)) | 621 | if (usbatm_submit_urb(urb)) |
553 | break; | 622 | break; |
@@ -593,20 +662,24 @@ static int usbatm_atm_send(struct atm_vcc *vcc, struct sk_buff *skb) | |||
593 | 662 | ||
594 | vdbg("%s called (skb 0x%p, len %u)", __func__, skb, skb->len); | 663 | vdbg("%s called (skb 0x%p, len %u)", __func__, skb, skb->len); |
595 | 664 | ||
596 | if (!instance) { | 665 | /* racy disconnection check - fine */ |
597 | dbg("%s: NULL data!", __func__); | 666 | if (!instance || instance->disconnected) { |
667 | #ifdef DEBUG | ||
668 | if (printk_ratelimit()) | ||
669 | printk(KERN_DEBUG "%s: %s!\n", __func__, instance ? "disconnected" : "NULL instance"); | ||
670 | #endif | ||
598 | err = -ENODEV; | 671 | err = -ENODEV; |
599 | goto fail; | 672 | goto fail; |
600 | } | 673 | } |
601 | 674 | ||
602 | if (vcc->qos.aal != ATM_AAL5) { | 675 | if (vcc->qos.aal != ATM_AAL5) { |
603 | atm_dbg(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal); | 676 | atm_rldbg(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal); |
604 | err = -EINVAL; | 677 | err = -EINVAL; |
605 | goto fail; | 678 | goto fail; |
606 | } | 679 | } |
607 | 680 | ||
608 | if (skb->len > ATM_MAX_AAL5_PDU) { | 681 | if (skb->len > ATM_MAX_AAL5_PDU) { |
609 | atm_dbg(instance, "%s: packet too long (%d vs %d)!\n", | 682 | atm_rldbg(instance, "%s: packet too long (%d vs %d)!\n", |
610 | __func__, skb->len, ATM_MAX_AAL5_PDU); | 683 | __func__, skb->len, ATM_MAX_AAL5_PDU); |
611 | err = -EINVAL; | 684 | err = -EINVAL; |
612 | goto fail; | 685 | goto fail; |
@@ -665,16 +738,16 @@ static void usbatm_put_instance(struct usbatm_data *instance) | |||
665 | ** ATM ** | 738 | ** ATM ** |
666 | **********/ | 739 | **********/ |
667 | 740 | ||
668 | static void usbatm_atm_dev_close(struct atm_dev *dev) | 741 | static void usbatm_atm_dev_close(struct atm_dev *atm_dev) |
669 | { | 742 | { |
670 | struct usbatm_data *instance = dev->dev_data; | 743 | struct usbatm_data *instance = atm_dev->dev_data; |
671 | 744 | ||
672 | dbg("%s", __func__); | 745 | dbg("%s", __func__); |
673 | 746 | ||
674 | if (!instance) | 747 | if (!instance) |
675 | return; | 748 | return; |
676 | 749 | ||
677 | dev->dev_data = NULL; | 750 | atm_dev->dev_data = NULL; /* catch bugs */ |
678 | usbatm_put_instance(instance); /* taken in usbatm_atm_init */ | 751 | usbatm_put_instance(instance); /* taken in usbatm_atm_init */ |
679 | } | 752 | } |
680 | 753 | ||
@@ -706,15 +779,19 @@ static int usbatm_atm_proc_read(struct atm_dev *atm_dev, loff_t * pos, char *pag | |||
706 | atomic_read(&atm_dev->stats.aal5.rx_err), | 779 | atomic_read(&atm_dev->stats.aal5.rx_err), |
707 | atomic_read(&atm_dev->stats.aal5.rx_drop)); | 780 | atomic_read(&atm_dev->stats.aal5.rx_drop)); |
708 | 781 | ||
709 | if (!left--) | 782 | if (!left--) { |
710 | switch (atm_dev->signal) { | 783 | if (instance->disconnected) |
711 | case ATM_PHY_SIG_FOUND: | 784 | return sprintf(page, "Disconnected\n"); |
712 | return sprintf(page, "Line up\n"); | 785 | else |
713 | case ATM_PHY_SIG_LOST: | 786 | switch (atm_dev->signal) { |
714 | return sprintf(page, "Line down\n"); | 787 | case ATM_PHY_SIG_FOUND: |
715 | default: | 788 | return sprintf(page, "Line up\n"); |
716 | return sprintf(page, "Line state unknown\n"); | 789 | case ATM_PHY_SIG_LOST: |
717 | } | 790 | return sprintf(page, "Line down\n"); |
791 | default: | ||
792 | return sprintf(page, "Line state unknown\n"); | ||
793 | } | ||
794 | } | ||
718 | 795 | ||
719 | return 0; | 796 | return 0; |
720 | } | 797 | } |
@@ -735,13 +812,24 @@ static int usbatm_atm_open(struct atm_vcc *vcc) | |||
735 | atm_dbg(instance, "%s: vpi %hd, vci %d\n", __func__, vpi, vci); | 812 | atm_dbg(instance, "%s: vpi %hd, vci %d\n", __func__, vpi, vci); |
736 | 813 | ||
737 | /* only support AAL5 */ | 814 | /* only support AAL5 */ |
738 | if ((vcc->qos.aal != ATM_AAL5) || (vcc->qos.rxtp.max_sdu < 0) | 815 | if ((vcc->qos.aal != ATM_AAL5)) { |
739 | || (vcc->qos.rxtp.max_sdu > ATM_MAX_AAL5_PDU)) { | 816 | atm_warn(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal); |
740 | atm_dbg(instance, "%s: unsupported ATM type %d!\n", __func__, vcc->qos.aal); | 817 | return -EINVAL; |
818 | } | ||
819 | |||
820 | /* sanity checks */ | ||
821 | if ((vcc->qos.rxtp.max_sdu < 0) || (vcc->qos.rxtp.max_sdu > ATM_MAX_AAL5_PDU)) { | ||
822 | atm_dbg(instance, "%s: max_sdu %d out of range!\n", __func__, vcc->qos.rxtp.max_sdu); | ||
741 | return -EINVAL; | 823 | return -EINVAL; |
742 | } | 824 | } |
743 | 825 | ||
744 | down(&instance->serialize); /* vs self, usbatm_atm_close */ | 826 | mutex_lock(&instance->serialize); /* vs self, usbatm_atm_close, usbatm_usb_disconnect */ |
827 | |||
828 | if (instance->disconnected) { | ||
829 | atm_dbg(instance, "%s: disconnected!\n", __func__); | ||
830 | ret = -ENODEV; | ||
831 | goto fail; | ||
832 | } | ||
745 | 833 | ||
746 | if (usbatm_find_vcc(instance, vpi, vci)) { | 834 | if (usbatm_find_vcc(instance, vpi, vci)) { |
747 | atm_dbg(instance, "%s: %hd/%d already in use!\n", __func__, vpi, vci); | 835 | atm_dbg(instance, "%s: %hd/%d already in use!\n", __func__, vpi, vci); |
@@ -749,20 +837,19 @@ static int usbatm_atm_open(struct atm_vcc *vcc) | |||
749 | goto fail; | 837 | goto fail; |
750 | } | 838 | } |
751 | 839 | ||
752 | if (!(new = kmalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) { | 840 | if (!(new = kzalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) { |
753 | atm_dbg(instance, "%s: no memory for vcc_data!\n", __func__); | 841 | atm_err(instance, "%s: no memory for vcc_data!\n", __func__); |
754 | ret = -ENOMEM; | 842 | ret = -ENOMEM; |
755 | goto fail; | 843 | goto fail; |
756 | } | 844 | } |
757 | 845 | ||
758 | memset(new, 0, sizeof(struct usbatm_vcc_data)); | ||
759 | new->vcc = vcc; | 846 | new->vcc = vcc; |
760 | new->vpi = vpi; | 847 | new->vpi = vpi; |
761 | new->vci = vci; | 848 | new->vci = vci; |
762 | 849 | ||
763 | new->sarb = alloc_skb(usbatm_pdu_length(vcc->qos.rxtp.max_sdu), GFP_KERNEL); | 850 | new->sarb = alloc_skb(usbatm_pdu_length(vcc->qos.rxtp.max_sdu), GFP_KERNEL); |
764 | if (!new->sarb) { | 851 | if (!new->sarb) { |
765 | atm_dbg(instance, "%s: no memory for SAR buffer!\n", __func__); | 852 | atm_err(instance, "%s: no memory for SAR buffer!\n", __func__); |
766 | ret = -ENOMEM; | 853 | ret = -ENOMEM; |
767 | goto fail; | 854 | goto fail; |
768 | } | 855 | } |
@@ -770,6 +857,9 @@ static int usbatm_atm_open(struct atm_vcc *vcc) | |||
770 | vcc->dev_data = new; | 857 | vcc->dev_data = new; |
771 | 858 | ||
772 | tasklet_disable(&instance->rx_channel.tasklet); | 859 | tasklet_disable(&instance->rx_channel.tasklet); |
860 | instance->cached_vcc = new; | ||
861 | instance->cached_vpi = vpi; | ||
862 | instance->cached_vci = vci; | ||
773 | list_add(&new->list, &instance->vcc_list); | 863 | list_add(&new->list, &instance->vcc_list); |
774 | tasklet_enable(&instance->rx_channel.tasklet); | 864 | tasklet_enable(&instance->rx_channel.tasklet); |
775 | 865 | ||
@@ -777,7 +867,7 @@ static int usbatm_atm_open(struct atm_vcc *vcc) | |||
777 | set_bit(ATM_VF_PARTIAL, &vcc->flags); | 867 | set_bit(ATM_VF_PARTIAL, &vcc->flags); |
778 | set_bit(ATM_VF_READY, &vcc->flags); | 868 | set_bit(ATM_VF_READY, &vcc->flags); |
779 | 869 | ||
780 | up(&instance->serialize); | 870 | mutex_unlock(&instance->serialize); |
781 | 871 | ||
782 | atm_dbg(instance, "%s: allocated vcc data 0x%p\n", __func__, new); | 872 | atm_dbg(instance, "%s: allocated vcc data 0x%p\n", __func__, new); |
783 | 873 | ||
@@ -785,7 +875,7 @@ static int usbatm_atm_open(struct atm_vcc *vcc) | |||
785 | 875 | ||
786 | fail: | 876 | fail: |
787 | kfree(new); | 877 | kfree(new); |
788 | up(&instance->serialize); | 878 | mutex_unlock(&instance->serialize); |
789 | return ret; | 879 | return ret; |
790 | } | 880 | } |
791 | 881 | ||
@@ -806,9 +896,14 @@ static void usbatm_atm_close(struct atm_vcc *vcc) | |||
806 | 896 | ||
807 | usbatm_cancel_send(instance, vcc); | 897 | usbatm_cancel_send(instance, vcc); |
808 | 898 | ||
809 | down(&instance->serialize); /* vs self, usbatm_atm_open */ | 899 | mutex_lock(&instance->serialize); /* vs self, usbatm_atm_open, usbatm_usb_disconnect */ |
810 | 900 | ||
811 | tasklet_disable(&instance->rx_channel.tasklet); | 901 | tasklet_disable(&instance->rx_channel.tasklet); |
902 | if (instance->cached_vcc == vcc_data) { | ||
903 | instance->cached_vcc = NULL; | ||
904 | instance->cached_vpi = ATM_VPI_UNSPEC; | ||
905 | instance->cached_vci = ATM_VCI_UNSPEC; | ||
906 | } | ||
812 | list_del(&vcc_data->list); | 907 | list_del(&vcc_data->list); |
813 | tasklet_enable(&instance->rx_channel.tasklet); | 908 | tasklet_enable(&instance->rx_channel.tasklet); |
814 | 909 | ||
@@ -824,14 +919,21 @@ static void usbatm_atm_close(struct atm_vcc *vcc) | |||
824 | clear_bit(ATM_VF_PARTIAL, &vcc->flags); | 919 | clear_bit(ATM_VF_PARTIAL, &vcc->flags); |
825 | clear_bit(ATM_VF_ADDR, &vcc->flags); | 920 | clear_bit(ATM_VF_ADDR, &vcc->flags); |
826 | 921 | ||
827 | up(&instance->serialize); | 922 | mutex_unlock(&instance->serialize); |
828 | 923 | ||
829 | atm_dbg(instance, "%s successful\n", __func__); | 924 | atm_dbg(instance, "%s successful\n", __func__); |
830 | } | 925 | } |
831 | 926 | ||
832 | static int usbatm_atm_ioctl(struct atm_dev *dev, unsigned int cmd, | 927 | static int usbatm_atm_ioctl(struct atm_dev *atm_dev, unsigned int cmd, |
833 | void __user * arg) | 928 | void __user * arg) |
834 | { | 929 | { |
930 | struct usbatm_data *instance = atm_dev->dev_data; | ||
931 | |||
932 | if (!instance || instance->disconnected) { | ||
933 | dbg("%s: %s!", __func__, instance ? "disconnected" : "NULL instance"); | ||
934 | return -ENODEV; | ||
935 | } | ||
936 | |||
835 | switch (cmd) { | 937 | switch (cmd) { |
836 | case ATM_QUERYLOOP: | 938 | case ATM_QUERYLOOP: |
837 | return put_user(ATM_LM_NONE, (int __user *)arg) ? -EFAULT : 0; | 939 | return put_user(ATM_LM_NONE, (int __user *)arg) ? -EFAULT : 0; |
@@ -845,10 +947,13 @@ static int usbatm_atm_init(struct usbatm_data *instance) | |||
845 | struct atm_dev *atm_dev; | 947 | struct atm_dev *atm_dev; |
846 | int ret, i; | 948 | int ret, i; |
847 | 949 | ||
848 | /* ATM init */ | 950 | /* ATM init. The ATM initialization scheme suffers from an intrinsic race |
951 | * condition: callbacks we register can be executed at once, before we have | ||
952 | * initialized the struct atm_dev. To protect against this, all callbacks | ||
953 | * abort if atm_dev->dev_data is NULL. */ | ||
849 | atm_dev = atm_dev_register(instance->driver_name, &usbatm_atm_devops, -1, NULL); | 954 | atm_dev = atm_dev_register(instance->driver_name, &usbatm_atm_devops, -1, NULL); |
850 | if (!atm_dev) { | 955 | if (!atm_dev) { |
851 | usb_dbg(instance, "%s: failed to register ATM device!\n", __func__); | 956 | usb_err(instance, "%s: failed to register ATM device!\n", __func__); |
852 | return -1; | 957 | return -1; |
853 | } | 958 | } |
854 | 959 | ||
@@ -862,12 +967,13 @@ static int usbatm_atm_init(struct usbatm_data *instance) | |||
862 | atm_dev->link_rate = 128 * 1000 / 424; | 967 | atm_dev->link_rate = 128 * 1000 / 424; |
863 | 968 | ||
864 | if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) { | 969 | if (instance->driver->atm_start && ((ret = instance->driver->atm_start(instance, atm_dev)) < 0)) { |
865 | atm_dbg(instance, "%s: atm_start failed: %d!\n", __func__, ret); | 970 | atm_err(instance, "%s: atm_start failed: %d!\n", __func__, ret); |
866 | goto fail; | 971 | goto fail; |
867 | } | 972 | } |
868 | 973 | ||
869 | /* ready for ATM callbacks */ | ||
870 | usbatm_get_instance(instance); /* dropped in usbatm_atm_dev_close */ | 974 | usbatm_get_instance(instance); /* dropped in usbatm_atm_dev_close */ |
975 | |||
976 | /* ready for ATM callbacks */ | ||
871 | mb(); | 977 | mb(); |
872 | atm_dev->dev_data = instance; | 978 | atm_dev->dev_data = instance; |
873 | 979 | ||
@@ -903,9 +1009,9 @@ static int usbatm_do_heavy_init(void *arg) | |||
903 | if (!ret) | 1009 | if (!ret) |
904 | ret = usbatm_atm_init(instance); | 1010 | ret = usbatm_atm_init(instance); |
905 | 1011 | ||
906 | down(&instance->serialize); | 1012 | mutex_lock(&instance->serialize); |
907 | instance->thread_pid = -1; | 1013 | instance->thread_pid = -1; |
908 | up(&instance->serialize); | 1014 | mutex_unlock(&instance->serialize); |
909 | 1015 | ||
910 | complete_and_exit(&instance->thread_exited, ret); | 1016 | complete_and_exit(&instance->thread_exited, ret); |
911 | } | 1017 | } |
@@ -915,13 +1021,13 @@ static int usbatm_heavy_init(struct usbatm_data *instance) | |||
915 | int ret = kernel_thread(usbatm_do_heavy_init, instance, CLONE_KERNEL); | 1021 | int ret = kernel_thread(usbatm_do_heavy_init, instance, CLONE_KERNEL); |
916 | 1022 | ||
917 | if (ret < 0) { | 1023 | if (ret < 0) { |
918 | usb_dbg(instance, "%s: failed to create kernel_thread (%d)!\n", __func__, ret); | 1024 | usb_err(instance, "%s: failed to create kernel_thread (%d)!\n", __func__, ret); |
919 | return ret; | 1025 | return ret; |
920 | } | 1026 | } |
921 | 1027 | ||
922 | down(&instance->serialize); | 1028 | mutex_lock(&instance->serialize); |
923 | instance->thread_pid = ret; | 1029 | instance->thread_pid = ret; |
924 | up(&instance->serialize); | 1030 | mutex_unlock(&instance->serialize); |
925 | 1031 | ||
926 | wait_for_completion(&instance->thread_started); | 1032 | wait_for_completion(&instance->thread_started); |
927 | 1033 | ||
@@ -951,9 +1057,9 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, | |||
951 | char *buf; | 1057 | char *buf; |
952 | int error = -ENOMEM; | 1058 | int error = -ENOMEM; |
953 | int i, length; | 1059 | int i, length; |
954 | int need_heavy; | 1060 | unsigned int maxpacket, num_packets; |
955 | 1061 | ||
956 | dev_dbg(dev, "%s: trying driver %s with vendor=0x%x, product=0x%x, ifnum %d\n", | 1062 | dev_dbg(dev, "%s: trying driver %s with vendor=%04x, product=%04x, ifnum %2d\n", |
957 | __func__, driver->driver_name, | 1063 | __func__, driver->driver_name, |
958 | le16_to_cpu(usb_dev->descriptor.idVendor), | 1064 | le16_to_cpu(usb_dev->descriptor.idVendor), |
959 | le16_to_cpu(usb_dev->descriptor.idProduct), | 1065 | le16_to_cpu(usb_dev->descriptor.idProduct), |
@@ -962,7 +1068,7 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, | |||
962 | /* instance init */ | 1068 | /* instance init */ |
963 | instance = kzalloc(sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs + num_snd_urbs), GFP_KERNEL); | 1069 | instance = kzalloc(sizeof(*instance) + sizeof(struct urb *) * (num_rcv_urbs + num_snd_urbs), GFP_KERNEL); |
964 | if (!instance) { | 1070 | if (!instance) { |
965 | dev_dbg(dev, "%s: no memory for instance data!\n", __func__); | 1071 | dev_err(dev, "%s: no memory for instance data!\n", __func__); |
966 | return -ENOMEM; | 1072 | return -ENOMEM; |
967 | } | 1073 | } |
968 | 1074 | ||
@@ -996,66 +1102,96 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, | |||
996 | snprintf(buf, length, ")"); | 1102 | snprintf(buf, length, ")"); |
997 | 1103 | ||
998 | bind: | 1104 | bind: |
999 | need_heavy = 1; | 1105 | if (driver->bind && (error = driver->bind(instance, intf, id)) < 0) { |
1000 | if (driver->bind && (error = driver->bind(instance, intf, id, &need_heavy)) < 0) { | 1106 | dev_err(dev, "%s: bind failed: %d!\n", __func__, error); |
1001 | dev_dbg(dev, "%s: bind failed: %d!\n", __func__, error); | ||
1002 | goto fail_free; | 1107 | goto fail_free; |
1003 | } | 1108 | } |
1004 | 1109 | ||
1005 | /* private fields */ | 1110 | /* private fields */ |
1006 | 1111 | ||
1007 | kref_init(&instance->refcount); /* dropped in usbatm_usb_disconnect */ | 1112 | kref_init(&instance->refcount); /* dropped in usbatm_usb_disconnect */ |
1008 | init_MUTEX(&instance->serialize); | 1113 | mutex_init(&instance->serialize); |
1009 | 1114 | ||
1010 | instance->thread_pid = -1; | 1115 | instance->thread_pid = -1; |
1011 | init_completion(&instance->thread_started); | 1116 | init_completion(&instance->thread_started); |
1012 | init_completion(&instance->thread_exited); | 1117 | init_completion(&instance->thread_exited); |
1013 | 1118 | ||
1014 | INIT_LIST_HEAD(&instance->vcc_list); | 1119 | INIT_LIST_HEAD(&instance->vcc_list); |
1120 | skb_queue_head_init(&instance->sndqueue); | ||
1015 | 1121 | ||
1016 | usbatm_init_channel(&instance->rx_channel); | 1122 | usbatm_init_channel(&instance->rx_channel); |
1017 | usbatm_init_channel(&instance->tx_channel); | 1123 | usbatm_init_channel(&instance->tx_channel); |
1018 | tasklet_init(&instance->rx_channel.tasklet, usbatm_rx_process, (unsigned long)instance); | 1124 | tasklet_init(&instance->rx_channel.tasklet, usbatm_rx_process, (unsigned long)instance); |
1019 | tasklet_init(&instance->tx_channel.tasklet, usbatm_tx_process, (unsigned long)instance); | 1125 | tasklet_init(&instance->tx_channel.tasklet, usbatm_tx_process, (unsigned long)instance); |
1020 | instance->rx_channel.endpoint = usb_rcvbulkpipe(usb_dev, driver->in); | ||
1021 | instance->tx_channel.endpoint = usb_sndbulkpipe(usb_dev, driver->out); | ||
1022 | instance->rx_channel.stride = ATM_CELL_SIZE + driver->rx_padding; | 1126 | instance->rx_channel.stride = ATM_CELL_SIZE + driver->rx_padding; |
1023 | instance->tx_channel.stride = ATM_CELL_SIZE + driver->tx_padding; | 1127 | instance->tx_channel.stride = ATM_CELL_SIZE + driver->tx_padding; |
1024 | instance->rx_channel.buf_size = rcv_buf_size * instance->rx_channel.stride; | ||
1025 | instance->tx_channel.buf_size = snd_buf_size * instance->tx_channel.stride; | ||
1026 | instance->rx_channel.usbatm = instance->tx_channel.usbatm = instance; | 1128 | instance->rx_channel.usbatm = instance->tx_channel.usbatm = instance; |
1027 | 1129 | ||
1028 | skb_queue_head_init(&instance->sndqueue); | 1130 | if ((instance->flags & UDSL_USE_ISOC) && driver->isoc_in) |
1131 | instance->rx_channel.endpoint = usb_rcvisocpipe(usb_dev, driver->isoc_in); | ||
1132 | else | ||
1133 | instance->rx_channel.endpoint = usb_rcvbulkpipe(usb_dev, driver->bulk_in); | ||
1134 | |||
1135 | instance->tx_channel.endpoint = usb_sndbulkpipe(usb_dev, driver->bulk_out); | ||
1136 | |||
1137 | /* tx buffer size must be a positive multiple of the stride */ | ||
1138 | instance->tx_channel.buf_size = max (instance->tx_channel.stride, | ||
1139 | snd_buf_bytes - (snd_buf_bytes % instance->tx_channel.stride)); | ||
1140 | |||
1141 | /* rx buffer size must be a positive multiple of the endpoint maxpacket */ | ||
1142 | maxpacket = usb_maxpacket(usb_dev, instance->rx_channel.endpoint, 0); | ||
1143 | |||
1144 | if ((maxpacket < 1) || (maxpacket > UDSL_MAX_BUF_SIZE)) { | ||
1145 | dev_err(dev, "%s: invalid endpoint %02x!\n", __func__, | ||
1146 | usb_pipeendpoint(instance->rx_channel.endpoint)); | ||
1147 | error = -EINVAL; | ||
1148 | goto fail_unbind; | ||
1149 | } | ||
1150 | |||
1151 | num_packets = max (1U, (rcv_buf_bytes + maxpacket / 2) / maxpacket); /* round */ | ||
1152 | |||
1153 | if (num_packets * maxpacket > UDSL_MAX_BUF_SIZE) | ||
1154 | num_packets--; | ||
1155 | |||
1156 | instance->rx_channel.buf_size = num_packets * maxpacket; | ||
1157 | instance->rx_channel.packet_size = maxpacket; | ||
1158 | |||
1159 | #ifdef DEBUG | ||
1160 | for (i = 0; i < 2; i++) { | ||
1161 | struct usbatm_channel *channel = i ? | ||
1162 | &instance->tx_channel : &instance->rx_channel; | ||
1163 | |||
1164 | dev_dbg(dev, "%s: using %d byte buffer for %s channel 0x%p\n", __func__, channel->buf_size, i ? "tx" : "rx", channel); | ||
1165 | } | ||
1166 | #endif | ||
1167 | |||
1168 | /* initialize urbs */ | ||
1029 | 1169 | ||
1030 | for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) { | 1170 | for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) { |
1031 | struct urb *urb; | ||
1032 | u8 *buffer; | 1171 | u8 *buffer; |
1033 | unsigned int iso_packets = 0, iso_size = 0; | ||
1034 | struct usbatm_channel *channel = i < num_rcv_urbs ? | 1172 | struct usbatm_channel *channel = i < num_rcv_urbs ? |
1035 | &instance->rx_channel : &instance->tx_channel; | 1173 | &instance->rx_channel : &instance->tx_channel; |
1174 | struct urb *urb; | ||
1175 | unsigned int iso_packets = usb_pipeisoc(channel->endpoint) ? channel->buf_size / channel->packet_size : 0; | ||
1036 | 1176 | ||
1037 | if (usb_pipeisoc(channel->endpoint)) { | 1177 | UDSL_ASSERT(!usb_pipeisoc(channel->endpoint) || usb_pipein(channel->endpoint)); |
1038 | /* don't expect iso out endpoints */ | ||
1039 | iso_size = usb_maxpacket(instance->usb_dev, channel->endpoint, 0); | ||
1040 | iso_size -= iso_size % channel->stride; /* alignment */ | ||
1041 | BUG_ON(!iso_size); | ||
1042 | iso_packets = (channel->buf_size - 1) / iso_size + 1; | ||
1043 | } | ||
1044 | 1178 | ||
1045 | urb = usb_alloc_urb(iso_packets, GFP_KERNEL); | 1179 | urb = usb_alloc_urb(iso_packets, GFP_KERNEL); |
1046 | if (!urb) { | 1180 | if (!urb) { |
1047 | dev_dbg(dev, "%s: no memory for urb %d!\n", __func__, i); | 1181 | dev_err(dev, "%s: no memory for urb %d!\n", __func__, i); |
1182 | error = -ENOMEM; | ||
1048 | goto fail_unbind; | 1183 | goto fail_unbind; |
1049 | } | 1184 | } |
1050 | 1185 | ||
1051 | instance->urbs[i] = urb; | 1186 | instance->urbs[i] = urb; |
1052 | 1187 | ||
1053 | buffer = kmalloc(channel->buf_size, GFP_KERNEL); | 1188 | /* zero the tx padding to avoid leaking information */ |
1189 | buffer = kzalloc(channel->buf_size, GFP_KERNEL); | ||
1054 | if (!buffer) { | 1190 | if (!buffer) { |
1055 | dev_dbg(dev, "%s: no memory for buffer %d!\n", __func__, i); | 1191 | dev_err(dev, "%s: no memory for buffer %d!\n", __func__, i); |
1192 | error = -ENOMEM; | ||
1056 | goto fail_unbind; | 1193 | goto fail_unbind; |
1057 | } | 1194 | } |
1058 | memset(buffer, 0, channel->buf_size); | ||
1059 | 1195 | ||
1060 | usb_fill_bulk_urb(urb, instance->usb_dev, channel->endpoint, | 1196 | usb_fill_bulk_urb(urb, instance->usb_dev, channel->endpoint, |
1061 | buffer, channel->buf_size, usbatm_complete, channel); | 1197 | buffer, channel->buf_size, usbatm_complete, channel); |
@@ -1065,9 +1201,8 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, | |||
1065 | urb->transfer_flags = URB_ISO_ASAP; | 1201 | urb->transfer_flags = URB_ISO_ASAP; |
1066 | urb->number_of_packets = iso_packets; | 1202 | urb->number_of_packets = iso_packets; |
1067 | for (j = 0; j < iso_packets; j++) { | 1203 | for (j = 0; j < iso_packets; j++) { |
1068 | urb->iso_frame_desc[j].offset = iso_size * j; | 1204 | urb->iso_frame_desc[j].offset = channel->packet_size * j; |
1069 | urb->iso_frame_desc[j].length = min_t(int, iso_size, | 1205 | urb->iso_frame_desc[j].length = channel->packet_size; |
1070 | channel->buf_size - urb->iso_frame_desc[j].offset); | ||
1071 | } | 1206 | } |
1072 | } | 1207 | } |
1073 | 1208 | ||
@@ -1079,7 +1214,17 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, | |||
1079 | __func__, urb->transfer_buffer, urb->transfer_buffer_length, urb); | 1214 | __func__, urb->transfer_buffer, urb->transfer_buffer_length, urb); |
1080 | } | 1215 | } |
1081 | 1216 | ||
1082 | if (need_heavy && driver->heavy_init) { | 1217 | instance->cached_vpi = ATM_VPI_UNSPEC; |
1218 | instance->cached_vci = ATM_VCI_UNSPEC; | ||
1219 | instance->cell_buf = kmalloc(instance->rx_channel.stride, GFP_KERNEL); | ||
1220 | |||
1221 | if (!instance->cell_buf) { | ||
1222 | dev_err(dev, "%s: no memory for cell buffer!\n", __func__); | ||
1223 | error = -ENOMEM; | ||
1224 | goto fail_unbind; | ||
1225 | } | ||
1226 | |||
1227 | if (!(instance->flags & UDSL_SKIP_HEAVY_INIT) && driver->heavy_init) { | ||
1083 | error = usbatm_heavy_init(instance); | 1228 | error = usbatm_heavy_init(instance); |
1084 | } else { | 1229 | } else { |
1085 | complete(&instance->thread_exited); /* pretend that heavy_init was run */ | 1230 | complete(&instance->thread_exited); /* pretend that heavy_init was run */ |
@@ -1098,6 +1243,8 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, | |||
1098 | if (instance->driver->unbind) | 1243 | if (instance->driver->unbind) |
1099 | instance->driver->unbind(instance, intf); | 1244 | instance->driver->unbind(instance, intf); |
1100 | fail_free: | 1245 | fail_free: |
1246 | kfree(instance->cell_buf); | ||
1247 | |||
1101 | for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) { | 1248 | for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) { |
1102 | if (instance->urbs[i]) | 1249 | if (instance->urbs[i]) |
1103 | kfree(instance->urbs[i]->transfer_buffer); | 1250 | kfree(instance->urbs[i]->transfer_buffer); |
@@ -1114,6 +1261,7 @@ void usbatm_usb_disconnect(struct usb_interface *intf) | |||
1114 | { | 1261 | { |
1115 | struct device *dev = &intf->dev; | 1262 | struct device *dev = &intf->dev; |
1116 | struct usbatm_data *instance = usb_get_intfdata(intf); | 1263 | struct usbatm_data *instance = usb_get_intfdata(intf); |
1264 | struct usbatm_vcc_data *vcc_data; | ||
1117 | int i; | 1265 | int i; |
1118 | 1266 | ||
1119 | dev_dbg(dev, "%s entered\n", __func__); | 1267 | dev_dbg(dev, "%s entered\n", __func__); |
@@ -1125,13 +1273,19 @@ void usbatm_usb_disconnect(struct usb_interface *intf) | |||
1125 | 1273 | ||
1126 | usb_set_intfdata(intf, NULL); | 1274 | usb_set_intfdata(intf, NULL); |
1127 | 1275 | ||
1128 | down(&instance->serialize); | 1276 | mutex_lock(&instance->serialize); |
1277 | instance->disconnected = 1; | ||
1129 | if (instance->thread_pid >= 0) | 1278 | if (instance->thread_pid >= 0) |
1130 | kill_proc(instance->thread_pid, SIGTERM, 1); | 1279 | kill_proc(instance->thread_pid, SIGTERM, 1); |
1131 | up(&instance->serialize); | 1280 | mutex_unlock(&instance->serialize); |
1132 | 1281 | ||
1133 | wait_for_completion(&instance->thread_exited); | 1282 | wait_for_completion(&instance->thread_exited); |
1134 | 1283 | ||
1284 | mutex_lock(&instance->serialize); | ||
1285 | list_for_each_entry(vcc_data, &instance->vcc_list, list) | ||
1286 | vcc_release_async(vcc_data->vcc, -EPIPE); | ||
1287 | mutex_unlock(&instance->serialize); | ||
1288 | |||
1135 | tasklet_disable(&instance->rx_channel.tasklet); | 1289 | tasklet_disable(&instance->rx_channel.tasklet); |
1136 | tasklet_disable(&instance->tx_channel.tasklet); | 1290 | tasklet_disable(&instance->tx_channel.tasklet); |
1137 | 1291 | ||
@@ -1141,6 +1295,14 @@ void usbatm_usb_disconnect(struct usb_interface *intf) | |||
1141 | del_timer_sync(&instance->rx_channel.delay); | 1295 | del_timer_sync(&instance->rx_channel.delay); |
1142 | del_timer_sync(&instance->tx_channel.delay); | 1296 | del_timer_sync(&instance->tx_channel.delay); |
1143 | 1297 | ||
1298 | /* turn usbatm_[rt]x_process into something close to a no-op */ | ||
1299 | /* no need to take the spinlock */ | ||
1300 | INIT_LIST_HEAD(&instance->rx_channel.list); | ||
1301 | INIT_LIST_HEAD(&instance->tx_channel.list); | ||
1302 | |||
1303 | tasklet_enable(&instance->rx_channel.tasklet); | ||
1304 | tasklet_enable(&instance->tx_channel.tasklet); | ||
1305 | |||
1144 | if (instance->atm_dev && instance->driver->atm_stop) | 1306 | if (instance->atm_dev && instance->driver->atm_stop) |
1145 | instance->driver->atm_stop(instance, instance->atm_dev); | 1307 | instance->driver->atm_stop(instance, instance->atm_dev); |
1146 | 1308 | ||
@@ -1149,19 +1311,13 @@ void usbatm_usb_disconnect(struct usb_interface *intf) | |||
1149 | 1311 | ||
1150 | instance->driver_data = NULL; | 1312 | instance->driver_data = NULL; |
1151 | 1313 | ||
1152 | /* turn usbatm_[rt]x_process into noop */ | ||
1153 | /* no need to take the spinlock */ | ||
1154 | INIT_LIST_HEAD(&instance->rx_channel.list); | ||
1155 | INIT_LIST_HEAD(&instance->tx_channel.list); | ||
1156 | |||
1157 | tasklet_enable(&instance->rx_channel.tasklet); | ||
1158 | tasklet_enable(&instance->tx_channel.tasklet); | ||
1159 | |||
1160 | for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) { | 1314 | for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) { |
1161 | kfree(instance->urbs[i]->transfer_buffer); | 1315 | kfree(instance->urbs[i]->transfer_buffer); |
1162 | usb_free_urb(instance->urbs[i]); | 1316 | usb_free_urb(instance->urbs[i]); |
1163 | } | 1317 | } |
1164 | 1318 | ||
1319 | kfree(instance->cell_buf); | ||
1320 | |||
1165 | /* ATM finalize */ | 1321 | /* ATM finalize */ |
1166 | if (instance->atm_dev) | 1322 | if (instance->atm_dev) |
1167 | atm_dev_deregister(instance->atm_dev); | 1323 | atm_dev_deregister(instance->atm_dev); |
@@ -1186,10 +1342,10 @@ static int __init usbatm_usb_init(void) | |||
1186 | 1342 | ||
1187 | if ((num_rcv_urbs > UDSL_MAX_RCV_URBS) | 1343 | if ((num_rcv_urbs > UDSL_MAX_RCV_URBS) |
1188 | || (num_snd_urbs > UDSL_MAX_SND_URBS) | 1344 | || (num_snd_urbs > UDSL_MAX_SND_URBS) |
1189 | || (rcv_buf_size < 1) | 1345 | || (rcv_buf_bytes < 1) |
1190 | || (rcv_buf_size > UDSL_MAX_RCV_BUF_SIZE) | 1346 | || (rcv_buf_bytes > UDSL_MAX_BUF_SIZE) |
1191 | || (snd_buf_size < 1) | 1347 | || (snd_buf_bytes < 1) |
1192 | || (snd_buf_size > UDSL_MAX_SND_BUF_SIZE)) | 1348 | || (snd_buf_bytes > UDSL_MAX_BUF_SIZE)) |
1193 | return -EINVAL; | 1349 | return -EINVAL; |
1194 | 1350 | ||
1195 | return 0; | 1351 | return 0; |
diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h index 1adacd60d713..ff8551e93372 100644 --- a/drivers/usb/atm/usbatm.h +++ b/drivers/usb/atm/usbatm.h | |||
@@ -24,21 +24,21 @@ | |||
24 | #ifndef _USBATM_H_ | 24 | #ifndef _USBATM_H_ |
25 | #define _USBATM_H_ | 25 | #define _USBATM_H_ |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | |||
29 | /* | ||
30 | #define VERBOSE_DEBUG | ||
31 | */ | ||
32 | |||
33 | #include <asm/semaphore.h> | 27 | #include <asm/semaphore.h> |
34 | #include <linux/atm.h> | 28 | #include <linux/atm.h> |
35 | #include <linux/atmdev.h> | 29 | #include <linux/atmdev.h> |
36 | #include <linux/completion.h> | 30 | #include <linux/completion.h> |
37 | #include <linux/device.h> | 31 | #include <linux/device.h> |
32 | #include <linux/kernel.h> | ||
38 | #include <linux/kref.h> | 33 | #include <linux/kref.h> |
39 | #include <linux/list.h> | 34 | #include <linux/list.h> |
40 | #include <linux/stringify.h> | 35 | #include <linux/stringify.h> |
41 | #include <linux/usb.h> | 36 | #include <linux/usb.h> |
37 | #include <linux/mutex.h> | ||
38 | |||
39 | /* | ||
40 | #define VERBOSE_DEBUG | ||
41 | */ | ||
42 | 42 | ||
43 | #ifdef DEBUG | 43 | #ifdef DEBUG |
44 | #define UDSL_ASSERT(x) BUG_ON(!(x)) | 44 | #define UDSL_ASSERT(x) BUG_ON(!(x)) |
@@ -52,8 +52,13 @@ | |||
52 | dev_info(&(instance)->usb_intf->dev , format , ## arg) | 52 | dev_info(&(instance)->usb_intf->dev , format , ## arg) |
53 | #define usb_warn(instance, format, arg...) \ | 53 | #define usb_warn(instance, format, arg...) \ |
54 | dev_warn(&(instance)->usb_intf->dev , format , ## arg) | 54 | dev_warn(&(instance)->usb_intf->dev , format , ## arg) |
55 | #ifdef DEBUG | ||
55 | #define usb_dbg(instance, format, arg...) \ | 56 | #define usb_dbg(instance, format, arg...) \ |
56 | dev_dbg(&(instance)->usb_intf->dev , format , ## arg) | 57 | dev_printk(KERN_DEBUG , &(instance)->usb_intf->dev , format , ## arg) |
58 | #else | ||
59 | #define usb_dbg(instance, format, arg...) \ | ||
60 | do {} while (0) | ||
61 | #endif | ||
57 | 62 | ||
58 | /* FIXME: move to dev_* once ATM is driver model aware */ | 63 | /* FIXME: move to dev_* once ATM is driver model aware */ |
59 | #define atm_printk(level, instance, format, arg...) \ | 64 | #define atm_printk(level, instance, format, arg...) \ |
@@ -69,12 +74,24 @@ | |||
69 | #ifdef DEBUG | 74 | #ifdef DEBUG |
70 | #define atm_dbg(instance, format, arg...) \ | 75 | #define atm_dbg(instance, format, arg...) \ |
71 | atm_printk(KERN_DEBUG, instance , format , ## arg) | 76 | atm_printk(KERN_DEBUG, instance , format , ## arg) |
77 | #define atm_rldbg(instance, format, arg...) \ | ||
78 | if (printk_ratelimit()) \ | ||
79 | atm_printk(KERN_DEBUG, instance , format , ## arg) | ||
72 | #else | 80 | #else |
73 | #define atm_dbg(instance, format, arg...) \ | 81 | #define atm_dbg(instance, format, arg...) \ |
74 | do {} while (0) | 82 | do {} while (0) |
83 | #define atm_rldbg(instance, format, arg...) \ | ||
84 | do {} while (0) | ||
75 | #endif | 85 | #endif |
76 | 86 | ||
77 | 87 | ||
88 | /* flags, set by mini-driver in bind() */ | ||
89 | |||
90 | #define UDSL_SKIP_HEAVY_INIT (1<<0) | ||
91 | #define UDSL_USE_ISOC (1<<1) | ||
92 | #define UDSL_IGNORE_EILSEQ (1<<2) | ||
93 | |||
94 | |||
78 | /* mini driver */ | 95 | /* mini driver */ |
79 | 96 | ||
80 | struct usbatm_data; | 97 | struct usbatm_data; |
@@ -86,16 +103,11 @@ struct usbatm_data; | |||
86 | */ | 103 | */ |
87 | 104 | ||
88 | struct usbatm_driver { | 105 | struct usbatm_driver { |
89 | struct module *owner; | ||
90 | |||
91 | const char *driver_name; | 106 | const char *driver_name; |
92 | 107 | ||
93 | /* | 108 | /* init device ... can sleep, or cause probe() failure */ |
94 | * init device ... can sleep, or cause probe() failure. Drivers with a heavy_init | ||
95 | * method can avoid having it called by setting need_heavy_init to zero. | ||
96 | */ | ||
97 | int (*bind) (struct usbatm_data *, struct usb_interface *, | 109 | int (*bind) (struct usbatm_data *, struct usb_interface *, |
98 | const struct usb_device_id *id, int *need_heavy_init); | 110 | const struct usb_device_id *id); |
99 | 111 | ||
100 | /* additional device initialization that is too slow to be done in probe() */ | 112 | /* additional device initialization that is too slow to be done in probe() */ |
101 | int (*heavy_init) (struct usbatm_data *, struct usb_interface *); | 113 | int (*heavy_init) (struct usbatm_data *, struct usb_interface *); |
@@ -109,8 +121,9 @@ struct usbatm_driver { | |||
109 | /* cleanup ATM device ... can sleep, but can't fail */ | 121 | /* cleanup ATM device ... can sleep, but can't fail */ |
110 | void (*atm_stop) (struct usbatm_data *, struct atm_dev *); | 122 | void (*atm_stop) (struct usbatm_data *, struct atm_dev *); |
111 | 123 | ||
112 | int in; /* rx endpoint */ | 124 | int bulk_in; /* bulk rx endpoint */ |
113 | int out; /* tx endpoint */ | 125 | int isoc_in; /* isochronous rx endpoint */ |
126 | int bulk_out; /* bulk tx endpoint */ | ||
114 | 127 | ||
115 | unsigned rx_padding; | 128 | unsigned rx_padding; |
116 | unsigned tx_padding; | 129 | unsigned tx_padding; |
@@ -125,6 +138,7 @@ struct usbatm_channel { | |||
125 | int endpoint; /* usb pipe */ | 138 | int endpoint; /* usb pipe */ |
126 | unsigned int stride; /* ATM cell size + padding */ | 139 | unsigned int stride; /* ATM cell size + padding */ |
127 | unsigned int buf_size; /* urb buffer size */ | 140 | unsigned int buf_size; /* urb buffer size */ |
141 | unsigned int packet_size; /* endpoint maxpacket */ | ||
128 | spinlock_t lock; | 142 | spinlock_t lock; |
129 | struct list_head list; | 143 | struct list_head list; |
130 | struct tasklet_struct tasklet; | 144 | struct tasklet_struct tasklet; |
@@ -143,6 +157,7 @@ struct usbatm_data { | |||
143 | struct usbatm_driver *driver; | 157 | struct usbatm_driver *driver; |
144 | void *driver_data; | 158 | void *driver_data; |
145 | char driver_name[16]; | 159 | char driver_name[16]; |
160 | unsigned int flags; /* set by mini-driver in bind() */ | ||
146 | 161 | ||
147 | /* USB device */ | 162 | /* USB device */ |
148 | struct usb_device *usb_dev; | 163 | struct usb_device *usb_dev; |
@@ -157,7 +172,8 @@ struct usbatm_data { | |||
157 | ********************************/ | 172 | ********************************/ |
158 | 173 | ||
159 | struct kref refcount; | 174 | struct kref refcount; |
160 | struct semaphore serialize; | 175 | struct mutex serialize; |
176 | int disconnected; | ||
161 | 177 | ||
162 | /* heavy init */ | 178 | /* heavy init */ |
163 | int thread_pid; | 179 | int thread_pid; |
@@ -171,7 +187,14 @@ struct usbatm_data { | |||
171 | struct usbatm_channel tx_channel; | 187 | struct usbatm_channel tx_channel; |
172 | 188 | ||
173 | struct sk_buff_head sndqueue; | 189 | struct sk_buff_head sndqueue; |
174 | struct sk_buff *current_skb; /* being emptied */ | 190 | struct sk_buff *current_skb; /* being emptied */ |
191 | |||
192 | struct usbatm_vcc_data *cached_vcc; | ||
193 | int cached_vci; | ||
194 | short cached_vpi; | ||
195 | |||
196 | unsigned char *cell_buf; /* holds partial rx cell */ | ||
197 | unsigned int buf_usage; | ||
175 | 198 | ||
176 | struct urb *urbs[0]; | 199 | struct urb *urbs[0]; |
177 | }; | 200 | }; |
diff --git a/drivers/usb/atm/xusbatm.c b/drivers/usb/atm/xusbatm.c index 5c76e3aaaa5e..42d6823b82b3 100644 --- a/drivers/usb/atm/xusbatm.c +++ b/drivers/usb/atm/xusbatm.c | |||
@@ -41,6 +41,8 @@ XUSBATM_PARM(rx_endpoint, unsigned char, byte, "rx endpoint number"); | |||
41 | XUSBATM_PARM(tx_endpoint, unsigned char, byte, "tx endpoint number"); | 41 | XUSBATM_PARM(tx_endpoint, unsigned char, byte, "tx endpoint number"); |
42 | XUSBATM_PARM(rx_padding, unsigned char, byte, "rx padding (default 0)"); | 42 | XUSBATM_PARM(rx_padding, unsigned char, byte, "rx padding (default 0)"); |
43 | XUSBATM_PARM(tx_padding, unsigned char, byte, "tx padding (default 0)"); | 43 | XUSBATM_PARM(tx_padding, unsigned char, byte, "tx padding (default 0)"); |
44 | XUSBATM_PARM(rx_altsetting, unsigned char, byte, "rx altsetting (default 0)"); | ||
45 | XUSBATM_PARM(tx_altsetting, unsigned char, byte, "rx altsetting (default 0)"); | ||
44 | 46 | ||
45 | static const char xusbatm_driver_name[] = "xusbatm"; | 47 | static const char xusbatm_driver_name[] = "xusbatm"; |
46 | 48 | ||
@@ -48,82 +50,118 @@ static struct usbatm_driver xusbatm_drivers[XUSBATM_DRIVERS_MAX]; | |||
48 | static struct usb_device_id xusbatm_usb_ids[XUSBATM_DRIVERS_MAX + 1]; | 50 | static struct usb_device_id xusbatm_usb_ids[XUSBATM_DRIVERS_MAX + 1]; |
49 | static struct usb_driver xusbatm_usb_driver; | 51 | static struct usb_driver xusbatm_usb_driver; |
50 | 52 | ||
51 | static int usb_intf_has_ep(const struct usb_interface *intf, u8 ep) | 53 | static struct usb_interface *xusbatm_find_intf (struct usb_device *usb_dev, int altsetting, u8 ep) |
52 | { | 54 | { |
55 | struct usb_host_interface *alt; | ||
56 | struct usb_interface *intf; | ||
53 | int i, j; | 57 | int i, j; |
54 | 58 | ||
55 | for (i = 0; i < intf->num_altsetting; i++) { | 59 | for(i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) |
56 | struct usb_host_interface *alt = intf->altsetting; | 60 | if ((intf = usb_dev->actconfig->interface[i]) && (alt = usb_altnum_to_altsetting(intf, altsetting))) |
57 | for (j = 0; j < alt->desc.bNumEndpoints; j++) | 61 | for (j = 0; j < alt->desc.bNumEndpoints; j++) |
58 | if ((alt->endpoint[i].desc.bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) == ep) | 62 | if (alt->endpoint[j].desc.bEndpointAddress == ep) |
59 | return 1; | 63 | return intf; |
64 | return NULL; | ||
65 | } | ||
66 | |||
67 | static int xusbatm_capture_intf (struct usbatm_data *usbatm, struct usb_device *usb_dev, | ||
68 | struct usb_interface *intf, int altsetting, int claim) | ||
69 | { | ||
70 | int ifnum = intf->altsetting->desc.bInterfaceNumber; | ||
71 | int ret; | ||
72 | |||
73 | if (claim && (ret = usb_driver_claim_interface(&xusbatm_usb_driver, intf, usbatm))) { | ||
74 | usb_err(usbatm, "%s: failed to claim interface %2d (%d)!\n", __func__, ifnum, ret); | ||
75 | return ret; | ||
76 | } | ||
77 | if ((ret = usb_set_interface(usb_dev, ifnum, altsetting))) { | ||
78 | usb_err(usbatm, "%s: altsetting %2d for interface %2d failed (%d)!\n", __func__, altsetting, ifnum, ret); | ||
79 | return ret; | ||
60 | } | 80 | } |
61 | return 0; | 81 | return 0; |
62 | } | 82 | } |
63 | 83 | ||
64 | static int xusbatm_bind(struct usbatm_data *usbatm_instance, | 84 | static void xusbatm_release_intf (struct usb_device *usb_dev, struct usb_interface *intf, int claimed) |
65 | struct usb_interface *intf, const struct usb_device_id *id, | 85 | { |
66 | int *need_heavy_init) | 86 | if (claimed) { |
87 | usb_set_intfdata(intf, NULL); | ||
88 | usb_driver_release_interface(&xusbatm_usb_driver, intf); | ||
89 | } | ||
90 | } | ||
91 | |||
92 | static int xusbatm_bind(struct usbatm_data *usbatm, | ||
93 | struct usb_interface *intf, const struct usb_device_id *id) | ||
67 | { | 94 | { |
68 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 95 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
69 | int drv_ix = id - xusbatm_usb_ids; | 96 | int drv_ix = id - xusbatm_usb_ids; |
70 | int rx_ep_present = usb_intf_has_ep(intf, rx_endpoint[drv_ix]); | 97 | int rx_alt = rx_altsetting[drv_ix]; |
71 | int tx_ep_present = usb_intf_has_ep(intf, tx_endpoint[drv_ix]); | 98 | int tx_alt = tx_altsetting[drv_ix]; |
72 | u8 searched_ep = rx_ep_present ? tx_endpoint[drv_ix] : rx_endpoint[drv_ix]; | 99 | struct usb_interface *rx_intf = xusbatm_find_intf(usb_dev, rx_alt, rx_endpoint[drv_ix]); |
73 | int i, ret; | 100 | struct usb_interface *tx_intf = xusbatm_find_intf(usb_dev, tx_alt, tx_endpoint[drv_ix]); |
74 | 101 | int ret; | |
75 | usb_dbg(usbatm_instance, "%s: binding driver %d: vendor %#x product %#x" | 102 | |
76 | " rx: ep %#x padd %d tx: ep %#x padd %d\n", | 103 | usb_dbg(usbatm, "%s: binding driver %d: vendor %04x product %04x" |
104 | " rx: ep %02x padd %d alt %2d tx: ep %02x padd %d alt %2d\n", | ||
77 | __func__, drv_ix, vendor[drv_ix], product[drv_ix], | 105 | __func__, drv_ix, vendor[drv_ix], product[drv_ix], |
78 | rx_endpoint[drv_ix], rx_padding[drv_ix], | 106 | rx_endpoint[drv_ix], rx_padding[drv_ix], rx_alt, |
79 | tx_endpoint[drv_ix], tx_padding[drv_ix]); | 107 | tx_endpoint[drv_ix], tx_padding[drv_ix], tx_alt); |
108 | |||
109 | if (!rx_intf || !tx_intf) { | ||
110 | if (!rx_intf) | ||
111 | usb_dbg(usbatm, "%s: no interface contains endpoint %02x in altsetting %2d\n", | ||
112 | __func__, rx_endpoint[drv_ix], rx_alt); | ||
113 | if (!tx_intf) | ||
114 | usb_dbg(usbatm, "%s: no interface contains endpoint %02x in altsetting %2d\n", | ||
115 | __func__, tx_endpoint[drv_ix], tx_alt); | ||
116 | return -ENODEV; | ||
117 | } | ||
80 | 118 | ||
81 | if (!rx_ep_present && !tx_ep_present) { | 119 | if ((rx_intf != intf) && (tx_intf != intf)) |
82 | usb_dbg(usbatm_instance, "%s: intf #%d has neither rx (%#x) nor tx (%#x) endpoint\n", | ||
83 | __func__, intf->altsetting->desc.bInterfaceNumber, | ||
84 | rx_endpoint[drv_ix], tx_endpoint[drv_ix]); | ||
85 | return -ENODEV; | 120 | return -ENODEV; |
121 | |||
122 | if ((rx_intf == tx_intf) && (rx_alt != tx_alt)) { | ||
123 | usb_err(usbatm, "%s: altsettings clash on interface %2d (%2d vs %2d)!\n", __func__, | ||
124 | rx_intf->altsetting->desc.bInterfaceNumber, rx_alt, tx_alt); | ||
125 | return -EINVAL; | ||
86 | } | 126 | } |
87 | 127 | ||
88 | if (rx_ep_present && tx_ep_present) | 128 | usb_dbg(usbatm, "%s: rx If#=%2d; tx If#=%2d\n", __func__, |
89 | return 0; | 129 | rx_intf->altsetting->desc.bInterfaceNumber, |
130 | tx_intf->altsetting->desc.bInterfaceNumber); | ||
90 | 131 | ||
91 | for(i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) { | 132 | if ((ret = xusbatm_capture_intf(usbatm, usb_dev, rx_intf, rx_alt, rx_intf != intf))) |
92 | struct usb_interface *cur_if = usb_dev->actconfig->interface[i]; | 133 | return ret; |
93 | 134 | ||
94 | if (cur_if != intf && usb_intf_has_ep(cur_if, searched_ep)) { | 135 | if ((tx_intf != rx_intf) && (ret = xusbatm_capture_intf(usbatm, usb_dev, tx_intf, tx_alt, tx_intf != intf))) { |
95 | ret = usb_driver_claim_interface(&xusbatm_usb_driver, | 136 | xusbatm_release_intf(usb_dev, rx_intf, rx_intf != intf); |
96 | cur_if, usbatm_instance); | 137 | return ret; |
97 | if (!ret) | ||
98 | usb_err(usbatm_instance, "%s: failed to claim interface #%d (%d)\n", | ||
99 | __func__, cur_if->altsetting->desc.bInterfaceNumber, ret); | ||
100 | return ret; | ||
101 | } | ||
102 | } | 138 | } |
103 | 139 | ||
104 | usb_err(usbatm_instance, "%s: no interface has endpoint %#x\n", | 140 | return 0; |
105 | __func__, searched_ep); | ||
106 | return -ENODEV; | ||
107 | } | 141 | } |
108 | 142 | ||
109 | static void xusbatm_unbind(struct usbatm_data *usbatm_instance, | 143 | static void xusbatm_unbind(struct usbatm_data *usbatm, |
110 | struct usb_interface *intf) | 144 | struct usb_interface *intf) |
111 | { | 145 | { |
112 | struct usb_device *usb_dev = interface_to_usbdev(intf); | 146 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
113 | int i; | 147 | int i; |
114 | usb_dbg(usbatm_instance, "%s entered\n", __func__); | 148 | |
149 | usb_dbg(usbatm, "%s entered\n", __func__); | ||
115 | 150 | ||
116 | for(i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) { | 151 | for(i = 0; i < usb_dev->actconfig->desc.bNumInterfaces; i++) { |
117 | struct usb_interface *cur_if = usb_dev->actconfig->interface[i]; | 152 | struct usb_interface *cur_intf = usb_dev->actconfig->interface[i]; |
118 | usb_set_intfdata(cur_if, NULL); | 153 | |
119 | usb_driver_release_interface(&xusbatm_usb_driver, cur_if); | 154 | if (cur_intf && (usb_get_intfdata(cur_intf) == usbatm)) { |
155 | usb_set_intfdata(cur_intf, NULL); | ||
156 | usb_driver_release_interface(&xusbatm_usb_driver, cur_intf); | ||
157 | } | ||
120 | } | 158 | } |
121 | } | 159 | } |
122 | 160 | ||
123 | static int xusbatm_atm_start(struct usbatm_data *usbatm_instance, | 161 | static int xusbatm_atm_start(struct usbatm_data *usbatm, |
124 | struct atm_dev *atm_dev) | 162 | struct atm_dev *atm_dev) |
125 | { | 163 | { |
126 | atm_dbg(usbatm_instance, "%s entered\n", __func__); | 164 | atm_dbg(usbatm, "%s entered\n", __func__); |
127 | 165 | ||
128 | /* use random MAC as we've no way to get it from the device */ | 166 | /* use random MAC as we've no way to get it from the device */ |
129 | random_ether_addr(atm_dev->esi); | 167 | random_ether_addr(atm_dev->esi); |
@@ -161,18 +199,19 @@ static int __init xusbatm_init(void) | |||
161 | } | 199 | } |
162 | 200 | ||
163 | for (i = 0; i < num_vendor; i++) { | 201 | for (i = 0; i < num_vendor; i++) { |
202 | rx_endpoint[i] |= USB_DIR_IN; | ||
203 | tx_endpoint[i] &= USB_ENDPOINT_NUMBER_MASK; | ||
204 | |||
164 | xusbatm_usb_ids[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE; | 205 | xusbatm_usb_ids[i].match_flags = USB_DEVICE_ID_MATCH_DEVICE; |
165 | xusbatm_usb_ids[i].idVendor = vendor[i]; | 206 | xusbatm_usb_ids[i].idVendor = vendor[i]; |
166 | xusbatm_usb_ids[i].idProduct = product[i]; | 207 | xusbatm_usb_ids[i].idProduct = product[i]; |
167 | 208 | ||
168 | |||
169 | xusbatm_drivers[i].owner = THIS_MODULE; | ||
170 | xusbatm_drivers[i].driver_name = xusbatm_driver_name; | 209 | xusbatm_drivers[i].driver_name = xusbatm_driver_name; |
171 | xusbatm_drivers[i].bind = xusbatm_bind; | 210 | xusbatm_drivers[i].bind = xusbatm_bind; |
172 | xusbatm_drivers[i].unbind = xusbatm_unbind; | 211 | xusbatm_drivers[i].unbind = xusbatm_unbind; |
173 | xusbatm_drivers[i].atm_start = xusbatm_atm_start; | 212 | xusbatm_drivers[i].atm_start = xusbatm_atm_start; |
174 | xusbatm_drivers[i].in = rx_endpoint[i]; | 213 | xusbatm_drivers[i].bulk_in = rx_endpoint[i]; |
175 | xusbatm_drivers[i].out = tx_endpoint[i]; | 214 | xusbatm_drivers[i].bulk_out = tx_endpoint[i]; |
176 | xusbatm_drivers[i].rx_padding = rx_padding[i]; | 215 | xusbatm_drivers[i].rx_padding = rx_padding[i]; |
177 | xusbatm_drivers[i].tx_padding = tx_padding[i]; | 216 | xusbatm_drivers[i].tx_padding = tx_padding[i]; |
178 | } | 217 | } |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index b9fd39fd1b5b..97bdeb1c2181 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -1014,8 +1014,13 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | down(&open_sem); | 1016 | down(&open_sem); |
1017 | if (!usb_get_intfdata(intf)) { | ||
1018 | up(&open_sem); | ||
1019 | return; | ||
1020 | } | ||
1017 | acm->dev = NULL; | 1021 | acm->dev = NULL; |
1018 | usb_set_intfdata (intf, NULL); | 1022 | usb_set_intfdata(acm->control, NULL); |
1023 | usb_set_intfdata(acm->data, NULL); | ||
1019 | 1024 | ||
1020 | tasklet_disable(&acm->urb_task); | 1025 | tasklet_disable(&acm->urb_task); |
1021 | 1026 | ||
@@ -1036,7 +1041,7 @@ static void acm_disconnect(struct usb_interface *intf) | |||
1036 | for (i = 0; i < ACM_NRB; i++) | 1041 | for (i = 0; i < ACM_NRB; i++) |
1037 | usb_buffer_free(usb_dev, acm->readsize, acm->rb[i].base, acm->rb[i].dma); | 1042 | usb_buffer_free(usb_dev, acm->readsize, acm->rb[i].base, acm->rb[i].dma); |
1038 | 1043 | ||
1039 | usb_driver_release_interface(&acm_driver, acm->data); | 1044 | usb_driver_release_interface(&acm_driver, intf == acm->control ? acm->data : intf); |
1040 | 1045 | ||
1041 | if (!acm->used) { | 1046 | if (!acm->used) { |
1042 | acm_tty_unregister(acm); | 1047 | acm_tty_unregister(acm); |
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index dba4cc026077..d34848ac30b0 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> | 7 | * Copyright (c) 2000 Vojtech Pavlik <vojtech@suse.cz> |
8 | # Copyright (c) 2001 Pete Zaitcev <zaitcev@redhat.com> | 8 | # Copyright (c) 2001 Pete Zaitcev <zaitcev@redhat.com> |
9 | # Copyright (c) 2001 David Paschal <paschal@rcsis.com> | 9 | # Copyright (c) 2001 David Paschal <paschal@rcsis.com> |
10 | * Copyright (c) 2006 Oliver Neukum <oliver@neukum.name> | ||
10 | * | 11 | * |
11 | * USB Printer Device Class driver for USB printers and printer cables | 12 | * USB Printer Device Class driver for USB printers and printer cables |
12 | * | 13 | * |
@@ -273,13 +274,16 @@ static void usblp_bulk_read(struct urb *urb, struct pt_regs *regs) | |||
273 | { | 274 | { |
274 | struct usblp *usblp = urb->context; | 275 | struct usblp *usblp = urb->context; |
275 | 276 | ||
276 | if (!usblp || !usblp->dev || !usblp->used || !usblp->present) | 277 | if (unlikely(!usblp || !usblp->dev || !usblp->used)) |
277 | return; | 278 | return; |
278 | 279 | ||
280 | if (unlikely(!usblp->present)) | ||
281 | goto unplug; | ||
279 | if (unlikely(urb->status)) | 282 | if (unlikely(urb->status)) |
280 | warn("usblp%d: nonzero read/write bulk status received: %d", | 283 | warn("usblp%d: nonzero read/write bulk status received: %d", |
281 | usblp->minor, urb->status); | 284 | usblp->minor, urb->status); |
282 | usblp->rcomplete = 1; | 285 | usblp->rcomplete = 1; |
286 | unplug: | ||
283 | wake_up_interruptible(&usblp->wait); | 287 | wake_up_interruptible(&usblp->wait); |
284 | } | 288 | } |
285 | 289 | ||
@@ -287,13 +291,15 @@ static void usblp_bulk_write(struct urb *urb, struct pt_regs *regs) | |||
287 | { | 291 | { |
288 | struct usblp *usblp = urb->context; | 292 | struct usblp *usblp = urb->context; |
289 | 293 | ||
290 | if (!usblp || !usblp->dev || !usblp->used || !usblp->present) | 294 | if (unlikely(!usblp || !usblp->dev || !usblp->used)) |
291 | return; | 295 | return; |
292 | 296 | if (unlikely(!usblp->present)) | |
297 | goto unplug; | ||
293 | if (unlikely(urb->status)) | 298 | if (unlikely(urb->status)) |
294 | warn("usblp%d: nonzero read/write bulk status received: %d", | 299 | warn("usblp%d: nonzero read/write bulk status received: %d", |
295 | usblp->minor, urb->status); | 300 | usblp->minor, urb->status); |
296 | usblp->wcomplete = 1; | 301 | usblp->wcomplete = 1; |
302 | unplug: | ||
297 | wake_up_interruptible(&usblp->wait); | 303 | wake_up_interruptible(&usblp->wait); |
298 | } | 304 | } |
299 | 305 | ||
@@ -627,9 +633,8 @@ done: | |||
627 | 633 | ||
628 | static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | 634 | static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
629 | { | 635 | { |
630 | DECLARE_WAITQUEUE(wait, current); | ||
631 | struct usblp *usblp = file->private_data; | 636 | struct usblp *usblp = file->private_data; |
632 | int timeout, err = 0, transfer_length = 0; | 637 | int timeout, rv, err = 0, transfer_length = 0; |
633 | size_t writecount = 0; | 638 | size_t writecount = 0; |
634 | 639 | ||
635 | while (writecount < count) { | 640 | while (writecount < count) { |
@@ -641,24 +646,11 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t | |||
641 | } | 646 | } |
642 | 647 | ||
643 | timeout = USBLP_WRITE_TIMEOUT; | 648 | timeout = USBLP_WRITE_TIMEOUT; |
644 | add_wait_queue(&usblp->wait, &wait); | ||
645 | while ( 1==1 ) { | ||
646 | 649 | ||
647 | if (signal_pending(current)) { | 650 | rv = wait_event_interruptible_timeout(usblp->wait, usblp->wcomplete || !usblp->present , timeout); |
648 | remove_wait_queue(&usblp->wait, &wait); | 651 | if (rv < 0) |
649 | return writecount ? writecount : -EINTR; | 652 | return writecount ? writecount : -EINTR; |
650 | } | ||
651 | set_current_state(TASK_INTERRUPTIBLE); | ||
652 | if (timeout && !usblp->wcomplete) { | ||
653 | timeout = schedule_timeout(timeout); | ||
654 | } else { | ||
655 | set_current_state(TASK_RUNNING); | ||
656 | break; | ||
657 | } | ||
658 | } | ||
659 | remove_wait_queue(&usblp->wait, &wait); | ||
660 | } | 653 | } |
661 | |||
662 | down (&usblp->sem); | 654 | down (&usblp->sem); |
663 | if (!usblp->present) { | 655 | if (!usblp->present) { |
664 | up (&usblp->sem); | 656 | up (&usblp->sem); |
@@ -724,7 +716,7 @@ static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t | |||
724 | static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) | 716 | static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
725 | { | 717 | { |
726 | struct usblp *usblp = file->private_data; | 718 | struct usblp *usblp = file->private_data; |
727 | DECLARE_WAITQUEUE(wait, current); | 719 | int rv; |
728 | 720 | ||
729 | if (!usblp->bidir) | 721 | if (!usblp->bidir) |
730 | return -EINVAL; | 722 | return -EINVAL; |
@@ -742,26 +734,13 @@ static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count, | |||
742 | count = -EAGAIN; | 734 | count = -EAGAIN; |
743 | goto done; | 735 | goto done; |
744 | } | 736 | } |
745 | 737 | up(&usblp->sem); | |
746 | add_wait_queue(&usblp->wait, &wait); | 738 | rv = wait_event_interruptible(usblp->wait, usblp->rcomplete || !usblp->present); |
747 | while (1==1) { | 739 | down(&usblp->sem); |
748 | if (signal_pending(current)) { | 740 | if (rv < 0) { |
749 | count = -EINTR; | 741 | count = -EINTR; |
750 | remove_wait_queue(&usblp->wait, &wait); | 742 | goto done; |
751 | goto done; | ||
752 | } | ||
753 | up (&usblp->sem); | ||
754 | set_current_state(TASK_INTERRUPTIBLE); | ||
755 | if (!usblp->rcomplete) { | ||
756 | schedule(); | ||
757 | } else { | ||
758 | set_current_state(TASK_RUNNING); | ||
759 | down(&usblp->sem); | ||
760 | break; | ||
761 | } | ||
762 | down (&usblp->sem); | ||
763 | } | 743 | } |
764 | remove_wait_queue(&usblp->wait, &wait); | ||
765 | } | 744 | } |
766 | 745 | ||
767 | if (!usblp->present) { | 746 | if (!usblp->present) { |
@@ -874,11 +853,10 @@ static int usblp_probe(struct usb_interface *intf, | |||
874 | 853 | ||
875 | /* Malloc and start initializing usblp structure so we can use it | 854 | /* Malloc and start initializing usblp structure so we can use it |
876 | * directly. */ | 855 | * directly. */ |
877 | if (!(usblp = kmalloc(sizeof(struct usblp), GFP_KERNEL))) { | 856 | if (!(usblp = kzalloc(sizeof(struct usblp), GFP_KERNEL))) { |
878 | err("out of memory for usblp"); | 857 | err("out of memory for usblp"); |
879 | goto abort; | 858 | goto abort; |
880 | } | 859 | } |
881 | memset(usblp, 0, sizeof(struct usblp)); | ||
882 | usblp->dev = dev; | 860 | usblp->dev = dev; |
883 | init_MUTEX (&usblp->sem); | 861 | init_MUTEX (&usblp->sem); |
884 | init_waitqueue_head(&usblp->wait); | 862 | init_waitqueue_head(&usblp->wait); |
@@ -1214,10 +1192,9 @@ static int __init usblp_init(void) | |||
1214 | { | 1192 | { |
1215 | int retval; | 1193 | int retval; |
1216 | retval = usb_register(&usblp_driver); | 1194 | retval = usb_register(&usblp_driver); |
1217 | if (retval) | 1195 | if (!retval) |
1218 | goto out; | 1196 | info(DRIVER_VERSION ": " DRIVER_DESC); |
1219 | info(DRIVER_VERSION ": " DRIVER_DESC); | 1197 | |
1220 | out: | ||
1221 | return retval; | 1198 | return retval; |
1222 | } | 1199 | } |
1223 | 1200 | ||
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 319de03944e7..7135e542679d 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/ctype.h> | 13 | #include <linux/ctype.h> |
14 | #include <linux/device.h> | 14 | #include <linux/device.h> |
15 | #include <asm/byteorder.h> | 15 | #include <asm/byteorder.h> |
16 | #include <asm/scatterlist.h> | ||
16 | 17 | ||
17 | #include "hcd.h" /* for usbcore internals */ | 18 | #include "hcd.h" /* for usbcore internals */ |
18 | #include "usb.h" | 19 | #include "usb.h" |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 081796726b95..dad4d8fd8180 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -468,6 +468,7 @@ int usb_unlink_urb(struct urb *urb) | |||
468 | */ | 468 | */ |
469 | void usb_kill_urb(struct urb *urb) | 469 | void usb_kill_urb(struct urb *urb) |
470 | { | 470 | { |
471 | might_sleep(); | ||
471 | if (!(urb && urb->dev && urb->dev->bus && urb->dev->bus->op)) | 472 | if (!(urb && urb->dev && urb->dev->bus && urb->dev->bus->op)) |
472 | return; | 473 | return; |
473 | spin_lock_irq(&urb->lock); | 474 | spin_lock_irq(&urb->lock); |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 9a4edc5657aa..0aab7d24c768 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -135,6 +135,7 @@ struct dev_data { | |||
135 | setup_out_ready : 1, | 135 | setup_out_ready : 1, |
136 | setup_out_error : 1, | 136 | setup_out_error : 1, |
137 | setup_abort : 1; | 137 | setup_abort : 1; |
138 | unsigned setup_wLength; | ||
138 | 139 | ||
139 | /* the rest is basically write-once */ | 140 | /* the rest is basically write-once */ |
140 | struct usb_config_descriptor *config, *hs_config; | 141 | struct usb_config_descriptor *config, *hs_config; |
@@ -942,6 +943,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len) | |||
942 | } | 943 | } |
943 | req->complete = ep0_complete; | 944 | req->complete = ep0_complete; |
944 | req->length = len; | 945 | req->length = len; |
946 | req->zero = 0; | ||
945 | return 0; | 947 | return 0; |
946 | } | 948 | } |
947 | 949 | ||
@@ -1161,10 +1163,13 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
1161 | spin_unlock_irq (&dev->lock); | 1163 | spin_unlock_irq (&dev->lock); |
1162 | if (copy_from_user (dev->req->buf, buf, len)) | 1164 | if (copy_from_user (dev->req->buf, buf, len)) |
1163 | retval = -EFAULT; | 1165 | retval = -EFAULT; |
1164 | else | 1166 | else { |
1167 | if (len < dev->setup_wLength) | ||
1168 | dev->req->zero = 1; | ||
1165 | retval = usb_ep_queue ( | 1169 | retval = usb_ep_queue ( |
1166 | dev->gadget->ep0, dev->req, | 1170 | dev->gadget->ep0, dev->req, |
1167 | GFP_KERNEL); | 1171 | GFP_KERNEL); |
1172 | } | ||
1168 | if (retval < 0) { | 1173 | if (retval < 0) { |
1169 | spin_lock_irq (&dev->lock); | 1174 | spin_lock_irq (&dev->lock); |
1170 | clean_req (dev->gadget->ep0, dev->req); | 1175 | clean_req (dev->gadget->ep0, dev->req); |
@@ -1483,6 +1488,7 @@ unrecognized: | |||
1483 | delegate: | 1488 | delegate: |
1484 | dev->setup_in = (ctrl->bRequestType & USB_DIR_IN) | 1489 | dev->setup_in = (ctrl->bRequestType & USB_DIR_IN) |
1485 | ? 1 : 0; | 1490 | ? 1 : 0; |
1491 | dev->setup_wLength = w_length; | ||
1486 | dev->setup_out_ready = 0; | 1492 | dev->setup_out_ready = 0; |
1487 | dev->setup_out_error = 0; | 1493 | dev->setup_out_error = 0; |
1488 | value = 0; | 1494 | value = 0; |
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c index c32e1f7476da..67b13ab2f3f5 100644 --- a/drivers/usb/gadget/net2280.c +++ b/drivers/usb/gadget/net2280.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/config.h> | 47 | #include <linux/config.h> |
48 | #include <linux/module.h> | 48 | #include <linux/module.h> |
49 | #include <linux/pci.h> | 49 | #include <linux/pci.h> |
50 | #include <linux/dma-mapping.h> | ||
50 | #include <linux/kernel.h> | 51 | #include <linux/kernel.h> |
51 | #include <linux/delay.h> | 52 | #include <linux/delay.h> |
52 | #include <linux/ioport.h> | 53 | #include <linux/ioport.h> |
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 2fc110d3ad5a..ae7a1c0f5748 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -165,8 +165,8 @@ static unsigned buflen = 4096; | |||
165 | static unsigned qlen = 32; | 165 | static unsigned qlen = 32; |
166 | static unsigned pattern = 0; | 166 | static unsigned pattern = 0; |
167 | 167 | ||
168 | module_param (buflen, uint, S_IRUGO|S_IWUSR); | 168 | module_param (buflen, uint, S_IRUGO); |
169 | module_param (qlen, uint, S_IRUGO|S_IWUSR); | 169 | module_param (qlen, uint, S_IRUGO); |
170 | module_param (pattern, uint, S_IRUGO|S_IWUSR); | 170 | module_param (pattern, uint, S_IRUGO|S_IWUSR); |
171 | 171 | ||
172 | /* | 172 | /* |
@@ -1127,8 +1127,10 @@ zero_unbind (struct usb_gadget *gadget) | |||
1127 | DBG (dev, "unbind\n"); | 1127 | DBG (dev, "unbind\n"); |
1128 | 1128 | ||
1129 | /* we've already been disconnected ... no i/o is active */ | 1129 | /* we've already been disconnected ... no i/o is active */ |
1130 | if (dev->req) | 1130 | if (dev->req) { |
1131 | dev->req->length = USB_BUFSIZ; | ||
1131 | free_ep_req (gadget->ep0, dev->req); | 1132 | free_ep_req (gadget->ep0, dev->req); |
1133 | } | ||
1132 | del_timer_sync (&dev->resume); | 1134 | del_timer_sync (&dev->resume); |
1133 | kfree (dev); | 1135 | kfree (dev); |
1134 | set_gadget_data (gadget, NULL); | 1136 | set_gadget_data (gadget, NULL); |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 08ca0f849dab..3a6687df5594 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -24,46 +24,11 @@ | |||
24 | 24 | ||
25 | /*-------------------------------------------------------------------------*/ | 25 | /*-------------------------------------------------------------------------*/ |
26 | 26 | ||
27 | /* EHCI 0.96 (and later) section 5.1 says how to kick BIOS/SMM/... | ||
28 | * off the controller (maybe it can boot from highspeed USB disks). | ||
29 | */ | ||
30 | static int bios_handoff(struct ehci_hcd *ehci, int where, u32 cap) | ||
31 | { | ||
32 | struct pci_dev *pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller); | ||
33 | |||
34 | /* always say Linux will own the hardware */ | ||
35 | pci_write_config_byte(pdev, where + 3, 1); | ||
36 | |||
37 | /* maybe wait a while for BIOS to respond */ | ||
38 | if (cap & (1 << 16)) { | ||
39 | int msec = 5000; | ||
40 | |||
41 | do { | ||
42 | msleep(10); | ||
43 | msec -= 10; | ||
44 | pci_read_config_dword(pdev, where, &cap); | ||
45 | } while ((cap & (1 << 16)) && msec); | ||
46 | if (cap & (1 << 16)) { | ||
47 | ehci_err(ehci, "BIOS handoff failed (%d, %08x)\n", | ||
48 | where, cap); | ||
49 | // some BIOS versions seem buggy... | ||
50 | // return 1; | ||
51 | ehci_warn(ehci, "continuing after BIOS bug...\n"); | ||
52 | /* disable all SMIs, and clear "BIOS owns" flag */ | ||
53 | pci_write_config_dword(pdev, where + 4, 0); | ||
54 | pci_write_config_byte(pdev, where + 2, 0); | ||
55 | } else | ||
56 | ehci_dbg(ehci, "BIOS handoff succeeded\n"); | ||
57 | } | ||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | /* called after powerup, by probe or system-pm "wakeup" */ | 27 | /* called after powerup, by probe or system-pm "wakeup" */ |
62 | static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) | 28 | static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) |
63 | { | 29 | { |
64 | u32 temp; | 30 | u32 temp; |
65 | int retval; | 31 | int retval; |
66 | unsigned count = 256/4; | ||
67 | 32 | ||
68 | /* optional debug port, normally in the first BAR */ | 33 | /* optional debug port, normally in the first BAR */ |
69 | temp = pci_find_capability(pdev, 0x0a); | 34 | temp = pci_find_capability(pdev, 0x0a); |
@@ -84,32 +49,9 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) | |||
84 | } | 49 | } |
85 | } | 50 | } |
86 | 51 | ||
87 | temp = HCC_EXT_CAPS(readl(&ehci->caps->hcc_params)); | 52 | /* we expect static quirk code to handle the "extended capabilities" |
88 | 53 | * (currently just BIOS handoff) allowed starting with EHCI 0.96 | |
89 | /* EHCI 0.96 and later may have "extended capabilities" */ | 54 | */ |
90 | while (temp && count--) { | ||
91 | u32 cap; | ||
92 | |||
93 | pci_read_config_dword(pdev, temp, &cap); | ||
94 | ehci_dbg(ehci, "capability %04x at %02x\n", cap, temp); | ||
95 | switch (cap & 0xff) { | ||
96 | case 1: /* BIOS/SMM/... handoff */ | ||
97 | if (bios_handoff(ehci, temp, cap) != 0) | ||
98 | return -EOPNOTSUPP; | ||
99 | break; | ||
100 | case 0: /* illegal reserved capability */ | ||
101 | ehci_dbg(ehci, "illegal capability!\n"); | ||
102 | cap = 0; | ||
103 | /* FALLTHROUGH */ | ||
104 | default: /* unknown */ | ||
105 | break; | ||
106 | } | ||
107 | temp = (cap >> 8) & 0xff; | ||
108 | } | ||
109 | if (!count) { | ||
110 | ehci_err(ehci, "bogus capabilities ... PCI problems!\n"); | ||
111 | return -EIO; | ||
112 | } | ||
113 | 55 | ||
114 | /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ | 56 | /* PCI Memory-Write-Invalidate cycle support is optional (uncommon) */ |
115 | retval = pci_set_mwi(pdev); | 57 | retval = pci_set_mwi(pdev); |
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 57e77374d228..ebcca9700671 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1063,6 +1063,7 @@ sitd_slot_ok ( | |||
1063 | 1063 | ||
1064 | /* for IN, check CSPLIT */ | 1064 | /* for IN, check CSPLIT */ |
1065 | if (stream->c_usecs) { | 1065 | if (stream->c_usecs) { |
1066 | uf = uframe & 7; | ||
1066 | max_used = 100 - stream->c_usecs; | 1067 | max_used = 100 - stream->c_usecs; |
1067 | do { | 1068 | do { |
1068 | tmp = 1 << uf; | 1069 | tmp = 1 << uf; |
@@ -1843,8 +1844,7 @@ done: | |||
1843 | #else | 1844 | #else |
1844 | 1845 | ||
1845 | static inline int | 1846 | static inline int |
1846 | sitd_submit (struct ehci_hcd *ehci, struct urb *urb, | 1847 | sitd_submit (struct ehci_hcd *ehci, struct urb *urb, gfp_t mem_flags) |
1847 | unsigned mem_flags) | ||
1848 | { | 1848 | { |
1849 | ehci_dbg (ehci, "split iso support is disabled\n"); | 1849 | ehci_dbg (ehci, "split iso support is disabled\n"); |
1850 | return -ENOSYS; | 1850 | return -ENOSYS; |
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index 584b8dc65119..972ce04889f8 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c | |||
@@ -1420,20 +1420,22 @@ static int isp116x_bus_suspend(struct usb_hcd *hcd) | |||
1420 | int ret = 0; | 1420 | int ret = 0; |
1421 | 1421 | ||
1422 | spin_lock_irqsave(&isp116x->lock, flags); | 1422 | spin_lock_irqsave(&isp116x->lock, flags); |
1423 | |||
1424 | val = isp116x_read_reg32(isp116x, HCCONTROL); | 1423 | val = isp116x_read_reg32(isp116x, HCCONTROL); |
1424 | |||
1425 | switch (val & HCCONTROL_HCFS) { | 1425 | switch (val & HCCONTROL_HCFS) { |
1426 | case HCCONTROL_USB_OPER: | 1426 | case HCCONTROL_USB_OPER: |
1427 | spin_unlock_irqrestore(&isp116x->lock, flags); | ||
1427 | val &= (~HCCONTROL_HCFS & ~HCCONTROL_RWE); | 1428 | val &= (~HCCONTROL_HCFS & ~HCCONTROL_RWE); |
1428 | val |= HCCONTROL_USB_SUSPEND; | 1429 | val |= HCCONTROL_USB_SUSPEND; |
1429 | if (device_may_wakeup(&hcd->self.root_hub->dev)) | 1430 | if (device_may_wakeup(&hcd->self.root_hub->dev)) |
1430 | val |= HCCONTROL_RWE; | 1431 | val |= HCCONTROL_RWE; |
1431 | /* Wait for usb transfers to finish */ | 1432 | /* Wait for usb transfers to finish */ |
1432 | mdelay(2); | 1433 | msleep(2); |
1434 | spin_lock_irqsave(&isp116x->lock, flags); | ||
1433 | isp116x_write_reg32(isp116x, HCCONTROL, val); | 1435 | isp116x_write_reg32(isp116x, HCCONTROL, val); |
1436 | spin_unlock_irqrestore(&isp116x->lock, flags); | ||
1434 | /* Wait for devices to suspend */ | 1437 | /* Wait for devices to suspend */ |
1435 | mdelay(5); | 1438 | msleep(5); |
1436 | case HCCONTROL_USB_SUSPEND: | ||
1437 | break; | 1439 | break; |
1438 | case HCCONTROL_USB_RESUME: | 1440 | case HCCONTROL_USB_RESUME: |
1439 | isp116x_write_reg32(isp116x, HCCONTROL, | 1441 | isp116x_write_reg32(isp116x, HCCONTROL, |
@@ -1441,12 +1443,11 @@ static int isp116x_bus_suspend(struct usb_hcd *hcd) | |||
1441 | HCCONTROL_USB_RESET); | 1443 | HCCONTROL_USB_RESET); |
1442 | case HCCONTROL_USB_RESET: | 1444 | case HCCONTROL_USB_RESET: |
1443 | ret = -EBUSY; | 1445 | ret = -EBUSY; |
1446 | default: /* HCCONTROL_USB_SUSPEND */ | ||
1447 | spin_unlock_irqrestore(&isp116x->lock, flags); | ||
1444 | break; | 1448 | break; |
1445 | default: | ||
1446 | ret = -EINVAL; | ||
1447 | } | 1449 | } |
1448 | 1450 | ||
1449 | spin_unlock_irqrestore(&isp116x->lock, flags); | ||
1450 | return ret; | 1451 | return ret; |
1451 | } | 1452 | } |
1452 | 1453 | ||
@@ -1715,9 +1716,9 @@ static struct platform_driver isp116x_driver = { | |||
1715 | .remove = isp116x_remove, | 1716 | .remove = isp116x_remove, |
1716 | .suspend = isp116x_suspend, | 1717 | .suspend = isp116x_suspend, |
1717 | .resume = isp116x_resume, | 1718 | .resume = isp116x_resume, |
1718 | .driver = { | 1719 | .driver = { |
1719 | .name = (char *)hcd_name, | 1720 | .name = (char *)hcd_name, |
1720 | }, | 1721 | }, |
1721 | }; | 1722 | }; |
1722 | 1723 | ||
1723 | /*-----------------------------------------------------------------*/ | 1724 | /*-----------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c index 77cd6ac07e3c..db280ca7b7a0 100644 --- a/drivers/usb/host/ohci-au1xxx.c +++ b/drivers/usb/host/ohci-au1xxx.c | |||
@@ -67,7 +67,7 @@ static void au1xxx_stop_hc(struct platform_device *dev) | |||
67 | ": stopping Au1xxx OHCI USB Controller\n"); | 67 | ": stopping Au1xxx OHCI USB Controller\n"); |
68 | 68 | ||
69 | /* Disable clock */ | 69 | /* Disable clock */ |
70 | au_writel(readl((void *)USB_HOST_CONFIG) & ~USBH_ENABLE_CE, USB_HOST_CONFIG); | 70 | au_writel(au_readl(USB_HOST_CONFIG) & ~USBH_ENABLE_CE, USB_HOST_CONFIG); |
71 | } | 71 | } |
72 | 72 | ||
73 | 73 | ||
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 3ef2c0cdf1db..e9e5bc178cef 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -190,7 +190,7 @@ static void __devinit quirk_usb_handoff_ohci(struct pci_dev *pdev) | |||
190 | msleep(10); | 190 | msleep(10); |
191 | } | 191 | } |
192 | if (wait_time <= 0) | 192 | if (wait_time <= 0) |
193 | printk(KERN_WARNING "%s %s: early BIOS handoff " | 193 | printk(KERN_WARNING "%s %s: BIOS handoff " |
194 | "failed (BIOS bug ?)\n", | 194 | "failed (BIOS bug ?)\n", |
195 | pdev->dev.bus_id, "OHCI"); | 195 | pdev->dev.bus_id, "OHCI"); |
196 | 196 | ||
@@ -212,8 +212,9 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev) | |||
212 | { | 212 | { |
213 | int wait_time, delta; | 213 | int wait_time, delta; |
214 | void __iomem *base, *op_reg_base; | 214 | void __iomem *base, *op_reg_base; |
215 | u32 hcc_params, val, temp; | 215 | u32 hcc_params, val; |
216 | u8 cap_length; | 216 | u8 offset, cap_length; |
217 | int count = 256/4; | ||
217 | 218 | ||
218 | if (!mmio_resource_enabled(pdev, 0)) | 219 | if (!mmio_resource_enabled(pdev, 0)) |
219 | return; | 220 | return; |
@@ -224,51 +225,80 @@ static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev) | |||
224 | 225 | ||
225 | cap_length = readb(base); | 226 | cap_length = readb(base); |
226 | op_reg_base = base + cap_length; | 227 | op_reg_base = base + cap_length; |
228 | |||
229 | /* EHCI 0.96 and later may have "extended capabilities" | ||
230 | * spec section 5.1 explains the bios handoff, e.g. for | ||
231 | * booting from USB disk or using a usb keyboard | ||
232 | */ | ||
227 | hcc_params = readl(base + EHCI_HCC_PARAMS); | 233 | hcc_params = readl(base + EHCI_HCC_PARAMS); |
228 | hcc_params = (hcc_params >> 8) & 0xff; | 234 | offset = (hcc_params >> 8) & 0xff; |
229 | if (hcc_params) { | 235 | while (offset && count--) { |
230 | pci_read_config_dword(pdev, | 236 | u32 cap; |
231 | hcc_params + EHCI_USBLEGSUP, | 237 | int msec; |
232 | &val); | 238 | |
233 | if (((val & 0xff) == 1) && (val & EHCI_USBLEGSUP_BIOS)) { | 239 | pci_read_config_dword(pdev, offset, &cap); |
234 | /* | 240 | switch (cap & 0xff) { |
235 | * Ok, BIOS is in smm mode, try to hand off... | 241 | case 1: /* BIOS/SMM/... handoff support */ |
242 | if ((cap & EHCI_USBLEGSUP_BIOS)) { | ||
243 | pr_debug("%s %s: BIOS handoff\n", | ||
244 | pdev->dev.bus_id, "EHCI"); | ||
245 | |||
246 | /* BIOS workaround (?): be sure the | ||
247 | * pre-Linux code receives the SMI | ||
248 | */ | ||
249 | pci_read_config_dword(pdev, | ||
250 | offset + EHCI_USBLEGCTLSTS, | ||
251 | &val); | ||
252 | pci_write_config_dword(pdev, | ||
253 | offset + EHCI_USBLEGCTLSTS, | ||
254 | val | EHCI_USBLEGCTLSTS_SOOE); | ||
255 | } | ||
256 | |||
257 | /* always say Linux will own the hardware | ||
258 | * by setting EHCI_USBLEGSUP_OS. | ||
236 | */ | 259 | */ |
237 | pci_read_config_dword(pdev, | 260 | pci_write_config_byte(pdev, offset + 3, 1); |
238 | hcc_params + EHCI_USBLEGCTLSTS, | ||
239 | &temp); | ||
240 | pci_write_config_dword(pdev, | ||
241 | hcc_params + EHCI_USBLEGCTLSTS, | ||
242 | temp | EHCI_USBLEGCTLSTS_SOOE); | ||
243 | val |= EHCI_USBLEGSUP_OS; | ||
244 | pci_write_config_dword(pdev, | ||
245 | hcc_params + EHCI_USBLEGSUP, | ||
246 | val); | ||
247 | 261 | ||
248 | wait_time = 500; | 262 | /* if boot firmware now owns EHCI, spin till |
249 | do { | 263 | * it hands it over. |
264 | */ | ||
265 | msec = 5000; | ||
266 | while ((cap & EHCI_USBLEGSUP_BIOS) && (msec > 0)) { | ||
250 | msleep(10); | 267 | msleep(10); |
251 | wait_time -= 10; | 268 | msec -= 10; |
252 | pci_read_config_dword(pdev, | 269 | pci_read_config_dword(pdev, offset, &cap); |
253 | hcc_params + EHCI_USBLEGSUP, | 270 | } |
254 | &val); | 271 | |
255 | } while (wait_time && (val & EHCI_USBLEGSUP_BIOS)); | 272 | if (cap & EHCI_USBLEGSUP_BIOS) { |
256 | if (!wait_time) { | 273 | /* well, possibly buggy BIOS... try to shut |
257 | /* | 274 | * it down, and hope nothing goes too wrong |
258 | * well, possibly buggy BIOS... | ||
259 | */ | 275 | */ |
260 | printk(KERN_WARNING "%s %s: early BIOS handoff " | 276 | printk(KERN_WARNING "%s %s: BIOS handoff " |
261 | "failed (BIOS bug ?)\n", | 277 | "failed (BIOS bug ?)\n", |
262 | pdev->dev.bus_id, "EHCI"); | 278 | pdev->dev.bus_id, "EHCI"); |
263 | pci_write_config_dword(pdev, | 279 | pci_write_config_byte(pdev, offset + 2, 0); |
264 | hcc_params + EHCI_USBLEGSUP, | ||
265 | EHCI_USBLEGSUP_OS); | ||
266 | pci_write_config_dword(pdev, | ||
267 | hcc_params + EHCI_USBLEGCTLSTS, | ||
268 | 0); | ||
269 | } | 280 | } |
281 | |||
282 | /* just in case, always disable EHCI SMIs */ | ||
283 | pci_write_config_dword(pdev, | ||
284 | offset + EHCI_USBLEGCTLSTS, | ||
285 | 0); | ||
286 | break; | ||
287 | case 0: /* illegal reserved capability */ | ||
288 | cap = 0; | ||
289 | /* FALLTHROUGH */ | ||
290 | default: | ||
291 | printk(KERN_WARNING "%s %s: unrecognized " | ||
292 | "capability %02x\n", | ||
293 | pdev->dev.bus_id, "EHCI", | ||
294 | cap & 0xff); | ||
295 | break; | ||
270 | } | 296 | } |
297 | offset = (cap >> 8) & 0xff; | ||
271 | } | 298 | } |
299 | if (!count) | ||
300 | printk(KERN_DEBUG "%s %s: capability loop?\n", | ||
301 | pdev->dev.bus_id, "EHCI"); | ||
272 | 302 | ||
273 | /* | 303 | /* |
274 | * halt EHCI & disable its interrupts in any case | 304 | * halt EHCI & disable its interrupts in any case |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index b6076004a437..782398045f9f 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -672,9 +672,9 @@ static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb, struct ur | |||
672 | /* Low-speed transfers get a different queue, and won't hog the bus. | 672 | /* Low-speed transfers get a different queue, and won't hog the bus. |
673 | * Also, some devices enumerate better without FSBR; the easiest way | 673 | * Also, some devices enumerate better without FSBR; the easiest way |
674 | * to do that is to put URBs on the low-speed queue while the device | 674 | * to do that is to put URBs on the low-speed queue while the device |
675 | * is in the DEFAULT state. */ | 675 | * isn't in the CONFIGURED state. */ |
676 | if (urb->dev->speed == USB_SPEED_LOW || | 676 | if (urb->dev->speed == USB_SPEED_LOW || |
677 | urb->dev->state == USB_STATE_DEFAULT) | 677 | urb->dev->state != USB_STATE_CONFIGURED) |
678 | skelqh = uhci->skel_ls_control_qh; | 678 | skelqh = uhci->skel_ls_control_qh; |
679 | else { | 679 | else { |
680 | skelqh = uhci->skel_fs_control_qh; | 680 | skelqh = uhci->skel_fs_control_qh; |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index a91e72c41415..6f7a684c3e07 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -1307,7 +1307,7 @@ void hid_init_reports(struct hid_device *hid) | |||
1307 | } | 1307 | } |
1308 | 1308 | ||
1309 | if (err) | 1309 | if (err) |
1310 | warn("timeout initializing reports\n"); | 1310 | warn("timeout initializing reports"); |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | #define USB_VENDOR_ID_WACOM 0x056a | 1313 | #define USB_VENDOR_ID_WACOM 0x056a |
@@ -1453,6 +1453,9 @@ void hid_init_reports(struct hid_device *hid) | |||
1453 | #define USB_VENDOR_ID_CHERRY 0x046a | 1453 | #define USB_VENDOR_ID_CHERRY 0x046a |
1454 | #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 | 1454 | #define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023 |
1455 | 1455 | ||
1456 | #define USB_VENDOR_ID_HP 0x03f0 | ||
1457 | #define USB_DEVICE_ID_HP_USBHUB_KB 0x020c | ||
1458 | |||
1456 | /* | 1459 | /* |
1457 | * Alphabetically sorted blacklist by quirk type. | 1460 | * Alphabetically sorted blacklist by quirk type. |
1458 | */ | 1461 | */ |
@@ -1566,6 +1569,7 @@ static const struct hid_blacklist { | |||
1566 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, | 1569 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, |
1567 | { USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_KEYBOARD, HID_QUIRK_NOGET}, | 1570 | { USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_KEYBOARD, HID_QUIRK_NOGET}, |
1568 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, | 1571 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, |
1572 | { USB_VENDOR_ID_HP, USB_DEVICE_ID_HP_USBHUB_KB, HID_QUIRK_NOGET }, | ||
1569 | { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, | 1573 | { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, |
1570 | 1574 | ||
1571 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_POWERMOUSE, HID_QUIRK_2WHEEL_POWERMOUSE }, | 1575 | { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_POWERMOUSE, HID_QUIRK_2WHEEL_POWERMOUSE }, |
@@ -1828,9 +1832,6 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) | |||
1828 | hid->urbctrl->transfer_dma = hid->ctrlbuf_dma; | 1832 | hid->urbctrl->transfer_dma = hid->ctrlbuf_dma; |
1829 | hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); | 1833 | hid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP); |
1830 | 1834 | ||
1831 | /* May be needed for some devices */ | ||
1832 | usb_clear_halt(hid->dev, hid->urbin->pipe); | ||
1833 | |||
1834 | return hid; | 1835 | return hid; |
1835 | 1836 | ||
1836 | fail: | 1837 | fail: |
diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 4dff8473553d..925f5aba06f5 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/usb.h> | 35 | #include <linux/usb.h> |
36 | #include "hid.h" | 36 | #include "hid.h" |
37 | #include <linux/hiddev.h> | 37 | #include <linux/hiddev.h> |
38 | #include <linux/devfs_fs_kernel.h> | ||
39 | 38 | ||
40 | #ifdef CONFIG_USB_DYNAMIC_MINORS | 39 | #ifdef CONFIG_USB_DYNAMIC_MINORS |
41 | #define HIDDEV_MINOR_BASE 0 | 40 | #define HIDDEV_MINOR_BASE 0 |
@@ -632,7 +631,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
632 | 631 | ||
633 | else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) && | 632 | else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) && |
634 | (uref_multi->num_values > HID_MAX_MULTI_USAGES || | 633 | (uref_multi->num_values > HID_MAX_MULTI_USAGES || |
635 | uref->usage_index + uref_multi->num_values >= field->report_count)) | 634 | uref->usage_index + uref_multi->num_values > field->report_count)) |
636 | goto inval; | 635 | goto inval; |
637 | } | 636 | } |
638 | 637 | ||
@@ -832,12 +831,10 @@ static /* const */ struct usb_driver hiddev_driver = { | |||
832 | 831 | ||
833 | int __init hiddev_init(void) | 832 | int __init hiddev_init(void) |
834 | { | 833 | { |
835 | devfs_mk_dir("usb/hid"); | ||
836 | return usb_register(&hiddev_driver); | 834 | return usb_register(&hiddev_driver); |
837 | } | 835 | } |
838 | 836 | ||
839 | void hiddev_exit(void) | 837 | void hiddev_exit(void) |
840 | { | 838 | { |
841 | usb_deregister(&hiddev_driver); | 839 | usb_deregister(&hiddev_driver); |
842 | devfs_remove("usb/hid"); | ||
843 | } | 840 | } |
diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c index 3b3c7b4120a2..697c5e573a11 100644 --- a/drivers/usb/input/touchkitusb.c +++ b/drivers/usb/input/touchkitusb.c | |||
@@ -337,6 +337,9 @@ static int touchkit_probe(struct usb_interface *intf, | |||
337 | touchkit->data, TOUCHKIT_REPORT_DATA_SIZE, | 337 | touchkit->data, TOUCHKIT_REPORT_DATA_SIZE, |
338 | touchkit_irq, touchkit, endpoint->bInterval); | 338 | touchkit_irq, touchkit, endpoint->bInterval); |
339 | 339 | ||
340 | touchkit->irq->transfer_dma = touchkit->data_dma; | ||
341 | touchkit->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
342 | |||
340 | input_register_device(touchkit->input); | 343 | input_register_device(touchkit->input); |
341 | 344 | ||
342 | usb_set_intfdata(intf, touchkit); | 345 | usb_set_intfdata(intf, touchkit); |
diff --git a/drivers/usb/input/yealink.c b/drivers/usb/input/yealink.c index 1bfc105ad4d6..37d2f0ba0319 100644 --- a/drivers/usb/input/yealink.c +++ b/drivers/usb/input/yealink.c | |||
@@ -59,7 +59,7 @@ | |||
59 | #include "map_to_7segment.h" | 59 | #include "map_to_7segment.h" |
60 | #include "yealink.h" | 60 | #include "yealink.h" |
61 | 61 | ||
62 | #define DRIVER_VERSION "yld-20050816" | 62 | #define DRIVER_VERSION "yld-20051230" |
63 | #define DRIVER_AUTHOR "Henk Vergonet" | 63 | #define DRIVER_AUTHOR "Henk Vergonet" |
64 | #define DRIVER_DESC "Yealink phone driver" | 64 | #define DRIVER_DESC "Yealink phone driver" |
65 | 65 | ||
@@ -786,16 +786,25 @@ static struct attribute_group yld_attr_group = { | |||
786 | * Linux interface and usb initialisation | 786 | * Linux interface and usb initialisation |
787 | ******************************************************************************/ | 787 | ******************************************************************************/ |
788 | 788 | ||
789 | static const struct yld_device { | 789 | struct driver_info { |
790 | u16 idVendor; | ||
791 | u16 idProduct; | ||
792 | char *name; | 790 | char *name; |
793 | } yld_device[] = { | ||
794 | { 0x6993, 0xb001, "Yealink usb-p1k" }, | ||
795 | }; | 791 | }; |
796 | 792 | ||
797 | static struct usb_device_id usb_table [] = { | 793 | static const struct driver_info info_P1K = { |
798 | { USB_INTERFACE_INFO(USB_CLASS_HID, 0, 0) }, | 794 | .name = "Yealink usb-p1k", |
795 | }; | ||
796 | |||
797 | static const struct usb_device_id usb_table [] = { | ||
798 | { | ||
799 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | | ||
800 | USB_DEVICE_ID_MATCH_INT_INFO, | ||
801 | .idVendor = 0x6993, | ||
802 | .idProduct = 0xb001, | ||
803 | .bInterfaceClass = USB_CLASS_HID, | ||
804 | .bInterfaceSubClass = 0, | ||
805 | .bInterfaceProtocol = 0, | ||
806 | .driver_info = (kernel_ulong_t)&info_P1K | ||
807 | }, | ||
799 | { } | 808 | { } |
800 | }; | 809 | }; |
801 | 810 | ||
@@ -842,33 +851,16 @@ static void usb_disconnect(struct usb_interface *intf) | |||
842 | usb_cleanup(yld, 0); | 851 | usb_cleanup(yld, 0); |
843 | } | 852 | } |
844 | 853 | ||
845 | static int usb_match(struct usb_device *udev) | ||
846 | { | ||
847 | int i; | ||
848 | u16 idVendor = le16_to_cpu(udev->descriptor.idVendor); | ||
849 | u16 idProduct = le16_to_cpu(udev->descriptor.idProduct); | ||
850 | |||
851 | for (i = 0; i < ARRAY_SIZE(yld_device); i++) { | ||
852 | if ((idVendor == yld_device[i].idVendor) && | ||
853 | (idProduct == yld_device[i].idProduct)) | ||
854 | return i; | ||
855 | } | ||
856 | return -ENODEV; | ||
857 | } | ||
858 | |||
859 | static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | 854 | static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) |
860 | { | 855 | { |
861 | struct usb_device *udev = interface_to_usbdev (intf); | 856 | struct usb_device *udev = interface_to_usbdev (intf); |
857 | struct driver_info *nfo = (struct driver_info *)id->driver_info; | ||
862 | struct usb_host_interface *interface; | 858 | struct usb_host_interface *interface; |
863 | struct usb_endpoint_descriptor *endpoint; | 859 | struct usb_endpoint_descriptor *endpoint; |
864 | struct yealink_dev *yld; | 860 | struct yealink_dev *yld; |
865 | struct input_dev *input_dev; | 861 | struct input_dev *input_dev; |
866 | int ret, pipe, i; | 862 | int ret, pipe, i; |
867 | 863 | ||
868 | i = usb_match(udev); | ||
869 | if (i < 0) | ||
870 | return -ENODEV; | ||
871 | |||
872 | interface = intf->cur_altsetting; | 864 | interface = intf->cur_altsetting; |
873 | endpoint = &interface->endpoint[0].desc; | 865 | endpoint = &interface->endpoint[0].desc; |
874 | if (!(endpoint->bEndpointAddress & USB_DIR_IN)) | 866 | if (!(endpoint->bEndpointAddress & USB_DIR_IN)) |
@@ -915,7 +907,7 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
915 | pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); | 907 | pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress); |
916 | ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); | 908 | ret = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); |
917 | if (ret != USB_PKT_LEN) | 909 | if (ret != USB_PKT_LEN) |
918 | err("invalid payload size %d, expected %d", ret, USB_PKT_LEN); | 910 | err("invalid payload size %d, expected %zd", ret, USB_PKT_LEN); |
919 | 911 | ||
920 | /* initialise irq urb */ | 912 | /* initialise irq urb */ |
921 | usb_fill_int_urb(yld->urb_irq, udev, pipe, yld->irq_data, | 913 | usb_fill_int_urb(yld->urb_irq, udev, pipe, yld->irq_data, |
@@ -948,7 +940,7 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
948 | strlcat(yld->phys, "/input0", sizeof(yld->phys)); | 940 | strlcat(yld->phys, "/input0", sizeof(yld->phys)); |
949 | 941 | ||
950 | /* register settings for the input device */ | 942 | /* register settings for the input device */ |
951 | input_dev->name = yld_device[i].name; | 943 | input_dev->name = nfo->name; |
952 | input_dev->phys = yld->phys; | 944 | input_dev->phys = yld->phys; |
953 | usb_to_input_id(udev, &input_dev->id); | 945 | usb_to_input_id(udev, &input_dev->id); |
954 | input_dev->cdev.dev = &intf->dev; | 946 | input_dev->cdev.dev = &intf->dev; |
diff --git a/drivers/usb/media/Kconfig b/drivers/usb/media/Kconfig index 21232ee2974c..0d3d2cc5d7be 100644 --- a/drivers/usb/media/Kconfig +++ b/drivers/usb/media/Kconfig | |||
@@ -53,6 +53,21 @@ config USB_DSBR | |||
53 | To compile this driver as a module, choose M here: the | 53 | To compile this driver as a module, choose M here: the |
54 | module will be called dsbr100. | 54 | module will be called dsbr100. |
55 | 55 | ||
56 | config USB_ET61X251 | ||
57 | tristate "USB ET61X[12]51 PC Camera Controller support" | ||
58 | depends on USB && VIDEO_DEV | ||
59 | ---help--- | ||
60 | Say Y here if you want support for cameras based on Etoms ET61X151 | ||
61 | or ET61X251 PC Camera Controllers. | ||
62 | |||
63 | See <file:Documentation/usb/et61x251.txt> for more informations. | ||
64 | |||
65 | This driver uses the Video For Linux API. You must say Y or M to | ||
66 | "Video For Linux" to use this driver. | ||
67 | |||
68 | To compile this driver as a module, choose M here: the | ||
69 | module will be called et61x251. | ||
70 | |||
56 | config USB_IBMCAM | 71 | config USB_IBMCAM |
57 | tristate "USB IBM (Xirlink) C-it Camera support" | 72 | tristate "USB IBM (Xirlink) C-it Camera support" |
58 | depends on USB && VIDEO_DEV | 73 | depends on USB && VIDEO_DEV |
@@ -209,5 +224,3 @@ config USB_PWC | |||
209 | 224 | ||
210 | To compile this driver as a module, choose M here: the | 225 | To compile this driver as a module, choose M here: the |
211 | module will be called pwc. | 226 | module will be called pwc. |
212 | |||
213 | |||
diff --git a/drivers/usb/media/Makefile b/drivers/usb/media/Makefile index d83adffa925f..3957aa1be0f2 100644 --- a/drivers/usb/media/Makefile +++ b/drivers/usb/media/Makefile | |||
@@ -3,9 +3,11 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bcb.o sn9c102_tas5110c1b.o sn9c102_tas5130d1b.o | 5 | sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bcb.o sn9c102_tas5110c1b.o sn9c102_tas5130d1b.o |
6 | et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o | ||
6 | 7 | ||
7 | obj-$(CONFIG_USB_DABUSB) += dabusb.o | 8 | obj-$(CONFIG_USB_DABUSB) += dabusb.o |
8 | obj-$(CONFIG_USB_DSBR) += dsbr100.o | 9 | obj-$(CONFIG_USB_DSBR) += dsbr100.o |
10 | obj-$(CONFIG_USB_ET61X251) += et61x251.o | ||
9 | obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o | 11 | obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o |
10 | obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o | 12 | obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o |
11 | obj-$(CONFIG_USB_OV511) += ov511.o | 13 | obj-$(CONFIG_USB_OV511) += ov511.o |
diff --git a/drivers/usb/media/et61x251.h b/drivers/usb/media/et61x251.h new file mode 100644 index 000000000000..652238f329f3 --- /dev/null +++ b/drivers/usb/media/et61x251.h | |||
@@ -0,0 +1,220 @@ | |||
1 | /*************************************************************************** | ||
2 | * V4L2 driver for ET61X[12]51 PC Camera Controllers * | ||
3 | * * | ||
4 | * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * | ||
5 | * * | ||
6 | * This program is free software; you can redistribute it and/or modify * | ||
7 | * it under the terms of the GNU General Public License as published by * | ||
8 | * the Free Software Foundation; either version 2 of the License, or * | ||
9 | * (at your option) any later version. * | ||
10 | * * | ||
11 | * This program is distributed in the hope that it will be useful, * | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
14 | * GNU General Public License for more details. * | ||
15 | * * | ||
16 | * You should have received a copy of the GNU General Public License * | ||
17 | * along with this program; if not, write to the Free Software * | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * | ||
19 | ***************************************************************************/ | ||
20 | |||
21 | #ifndef _ET61X251_H_ | ||
22 | #define _ET61X251_H_ | ||
23 | |||
24 | #include <linux/version.h> | ||
25 | #include <linux/usb.h> | ||
26 | #include <linux/videodev2.h> | ||
27 | #include <media/v4l2-common.h> | ||
28 | #include <linux/device.h> | ||
29 | #include <linux/list.h> | ||
30 | #include <linux/spinlock.h> | ||
31 | #include <linux/time.h> | ||
32 | #include <linux/wait.h> | ||
33 | #include <linux/types.h> | ||
34 | #include <linux/param.h> | ||
35 | #include <linux/rwsem.h> | ||
36 | #include <asm/semaphore.h> | ||
37 | |||
38 | #include "et61x251_sensor.h" | ||
39 | |||
40 | /*****************************************************************************/ | ||
41 | |||
42 | #define ET61X251_DEBUG | ||
43 | #define ET61X251_DEBUG_LEVEL 2 | ||
44 | #define ET61X251_MAX_DEVICES 64 | ||
45 | #define ET61X251_PRESERVE_IMGSCALE 0 | ||
46 | #define ET61X251_FORCE_MUNMAP 0 | ||
47 | #define ET61X251_MAX_FRAMES 32 | ||
48 | #define ET61X251_COMPRESSION_QUALITY 0 | ||
49 | #define ET61X251_URBS 2 | ||
50 | #define ET61X251_ISO_PACKETS 7 | ||
51 | #define ET61X251_ALTERNATE_SETTING 13 | ||
52 | #define ET61X251_URB_TIMEOUT msecs_to_jiffies(2 * ET61X251_ISO_PACKETS) | ||
53 | #define ET61X251_CTRL_TIMEOUT 100 | ||
54 | |||
55 | /*****************************************************************************/ | ||
56 | |||
57 | static const struct usb_device_id et61x251_id_table[] = { | ||
58 | { USB_DEVICE(0x102c, 0x6151), }, | ||
59 | { USB_DEVICE(0x102c, 0x6251), }, | ||
60 | { USB_DEVICE(0x102c, 0x6253), }, | ||
61 | { USB_DEVICE(0x102c, 0x6254), }, | ||
62 | { USB_DEVICE(0x102c, 0x6255), }, | ||
63 | { USB_DEVICE(0x102c, 0x6256), }, | ||
64 | { USB_DEVICE(0x102c, 0x6257), }, | ||
65 | { USB_DEVICE(0x102c, 0x6258), }, | ||
66 | { USB_DEVICE(0x102c, 0x6259), }, | ||
67 | { USB_DEVICE(0x102c, 0x625a), }, | ||
68 | { USB_DEVICE(0x102c, 0x625b), }, | ||
69 | { USB_DEVICE(0x102c, 0x625c), }, | ||
70 | { USB_DEVICE(0x102c, 0x625d), }, | ||
71 | { USB_DEVICE(0x102c, 0x625e), }, | ||
72 | { USB_DEVICE(0x102c, 0x625f), }, | ||
73 | { USB_DEVICE(0x102c, 0x6260), }, | ||
74 | { USB_DEVICE(0x102c, 0x6261), }, | ||
75 | { USB_DEVICE(0x102c, 0x6262), }, | ||
76 | { USB_DEVICE(0x102c, 0x6263), }, | ||
77 | { USB_DEVICE(0x102c, 0x6264), }, | ||
78 | { USB_DEVICE(0x102c, 0x6265), }, | ||
79 | { USB_DEVICE(0x102c, 0x6266), }, | ||
80 | { USB_DEVICE(0x102c, 0x6267), }, | ||
81 | { USB_DEVICE(0x102c, 0x6268), }, | ||
82 | { USB_DEVICE(0x102c, 0x6269), }, | ||
83 | { } | ||
84 | }; | ||
85 | |||
86 | ET61X251_SENSOR_TABLE | ||
87 | |||
88 | /*****************************************************************************/ | ||
89 | |||
90 | enum et61x251_frame_state { | ||
91 | F_UNUSED, | ||
92 | F_QUEUED, | ||
93 | F_GRABBING, | ||
94 | F_DONE, | ||
95 | F_ERROR, | ||
96 | }; | ||
97 | |||
98 | struct et61x251_frame_t { | ||
99 | void* bufmem; | ||
100 | struct v4l2_buffer buf; | ||
101 | enum et61x251_frame_state state; | ||
102 | struct list_head frame; | ||
103 | unsigned long vma_use_count; | ||
104 | }; | ||
105 | |||
106 | enum et61x251_dev_state { | ||
107 | DEV_INITIALIZED = 0x01, | ||
108 | DEV_DISCONNECTED = 0x02, | ||
109 | DEV_MISCONFIGURED = 0x04, | ||
110 | }; | ||
111 | |||
112 | enum et61x251_io_method { | ||
113 | IO_NONE, | ||
114 | IO_READ, | ||
115 | IO_MMAP, | ||
116 | }; | ||
117 | |||
118 | enum et61x251_stream_state { | ||
119 | STREAM_OFF, | ||
120 | STREAM_INTERRUPT, | ||
121 | STREAM_ON, | ||
122 | }; | ||
123 | |||
124 | struct et61x251_sysfs_attr { | ||
125 | u8 reg, i2c_reg; | ||
126 | }; | ||
127 | |||
128 | struct et61x251_module_param { | ||
129 | u8 force_munmap; | ||
130 | }; | ||
131 | |||
132 | static DECLARE_MUTEX(et61x251_sysfs_lock); | ||
133 | static DECLARE_RWSEM(et61x251_disconnect); | ||
134 | |||
135 | struct et61x251_device { | ||
136 | struct video_device* v4ldev; | ||
137 | |||
138 | struct et61x251_sensor* sensor; | ||
139 | |||
140 | struct usb_device* usbdev; | ||
141 | struct urb* urb[ET61X251_URBS]; | ||
142 | void* transfer_buffer[ET61X251_URBS]; | ||
143 | u8* control_buffer; | ||
144 | |||
145 | struct et61x251_frame_t *frame_current, frame[ET61X251_MAX_FRAMES]; | ||
146 | struct list_head inqueue, outqueue; | ||
147 | u32 frame_count, nbuffers, nreadbuffers; | ||
148 | |||
149 | enum et61x251_io_method io; | ||
150 | enum et61x251_stream_state stream; | ||
151 | |||
152 | struct v4l2_jpegcompression compression; | ||
153 | |||
154 | struct et61x251_sysfs_attr sysfs; | ||
155 | struct et61x251_module_param module_param; | ||
156 | |||
157 | enum et61x251_dev_state state; | ||
158 | u8 users; | ||
159 | |||
160 | struct semaphore dev_sem, fileop_sem; | ||
161 | spinlock_t queue_lock; | ||
162 | wait_queue_head_t open, wait_frame, wait_stream; | ||
163 | }; | ||
164 | |||
165 | /*****************************************************************************/ | ||
166 | |||
167 | void | ||
168 | et61x251_attach_sensor(struct et61x251_device* cam, | ||
169 | struct et61x251_sensor* sensor) | ||
170 | { | ||
171 | cam->sensor = sensor; | ||
172 | cam->sensor->usbdev = cam->usbdev; | ||
173 | } | ||
174 | |||
175 | /*****************************************************************************/ | ||
176 | |||
177 | #undef DBG | ||
178 | #undef KDBG | ||
179 | #ifdef ET61X251_DEBUG | ||
180 | # define DBG(level, fmt, args...) \ | ||
181 | do { \ | ||
182 | if (debug >= (level)) { \ | ||
183 | if ((level) == 1) \ | ||
184 | dev_err(&cam->usbdev->dev, fmt "\n", ## args); \ | ||
185 | else if ((level) == 2) \ | ||
186 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ | ||
187 | else if ((level) >= 3) \ | ||
188 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | ||
189 | __FUNCTION__, __LINE__ , ## args); \ | ||
190 | } \ | ||
191 | } while (0) | ||
192 | # define KDBG(level, fmt, args...) \ | ||
193 | do { \ | ||
194 | if (debug >= (level)) { \ | ||
195 | if ((level) == 1 || (level) == 2) \ | ||
196 | pr_info("et61x251: " fmt "\n", ## args); \ | ||
197 | else if ((level) == 3) \ | ||
198 | pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ | ||
199 | __LINE__ , ## args); \ | ||
200 | } \ | ||
201 | } while (0) | ||
202 | # define V4LDBG(level, name, cmd) \ | ||
203 | do { \ | ||
204 | if (debug >= (level)) \ | ||
205 | v4l_print_ioctl(name, cmd); \ | ||
206 | } while (0) | ||
207 | #else | ||
208 | # define DBG(level, fmt, args...) do {;} while(0) | ||
209 | # define KDBG(level, fmt, args...) do {;} while(0) | ||
210 | # define V4LDBG(level, name, cmd) do {;} while(0) | ||
211 | #endif | ||
212 | |||
213 | #undef PDBG | ||
214 | #define PDBG(fmt, args...) \ | ||
215 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args) | ||
216 | |||
217 | #undef PDBGG | ||
218 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | ||
219 | |||
220 | #endif /* _ET61X251_H_ */ | ||
diff --git a/drivers/usb/media/et61x251_core.c b/drivers/usb/media/et61x251_core.c new file mode 100644 index 000000000000..2c0171a5ad62 --- /dev/null +++ b/drivers/usb/media/et61x251_core.c | |||
@@ -0,0 +1,2605 @@ | |||
1 | /*************************************************************************** | ||
2 | * V4L2 driver for ET61X[12]51 PC Camera Controllers * | ||
3 | * * | ||
4 | * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * | ||
5 | * * | ||
6 | * This program is free software; you can redistribute it and/or modify * | ||
7 | * it under the terms of the GNU General Public License as published by * | ||
8 | * the Free Software Foundation; either version 2 of the License, or * | ||
9 | * (at your option) any later version. * | ||
10 | * * | ||
11 | * This program is distributed in the hope that it will be useful, * | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
14 | * GNU General Public License for more details. * | ||
15 | * * | ||
16 | * You should have received a copy of the GNU General Public License * | ||
17 | * along with this program; if not, write to the Free Software * | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * | ||
19 | ***************************************************************************/ | ||
20 | |||
21 | #include <linux/module.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/param.h> | ||
25 | #include <linux/moduleparam.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/string.h> | ||
29 | #include <linux/device.h> | ||
30 | #include <linux/fs.h> | ||
31 | #include <linux/delay.h> | ||
32 | #include <linux/stddef.h> | ||
33 | #include <linux/compiler.h> | ||
34 | #include <linux/ioctl.h> | ||
35 | #include <linux/poll.h> | ||
36 | #include <linux/stat.h> | ||
37 | #include <linux/mm.h> | ||
38 | #include <linux/vmalloc.h> | ||
39 | #include <linux/page-flags.h> | ||
40 | #include <linux/byteorder/generic.h> | ||
41 | #include <asm/page.h> | ||
42 | #include <asm/uaccess.h> | ||
43 | |||
44 | #include "et61x251.h" | ||
45 | |||
46 | /*****************************************************************************/ | ||
47 | |||
48 | #define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \ | ||
49 | "PC Camera Controllers" | ||
50 | #define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia" | ||
51 | #define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | ||
52 | #define ET61X251_MODULE_LICENSE "GPL" | ||
53 | #define ET61X251_MODULE_VERSION "1:1.01" | ||
54 | #define ET61X251_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 1) | ||
55 | |||
56 | /*****************************************************************************/ | ||
57 | |||
58 | MODULE_DEVICE_TABLE(usb, et61x251_id_table); | ||
59 | |||
60 | MODULE_AUTHOR(ET61X251_MODULE_AUTHOR " " ET61X251_AUTHOR_EMAIL); | ||
61 | MODULE_DESCRIPTION(ET61X251_MODULE_NAME); | ||
62 | MODULE_VERSION(ET61X251_MODULE_VERSION); | ||
63 | MODULE_LICENSE(ET61X251_MODULE_LICENSE); | ||
64 | |||
65 | static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1}; | ||
66 | module_param_array(video_nr, short, NULL, 0444); | ||
67 | MODULE_PARM_DESC(video_nr, | ||
68 | "\n<-1|n[,...]> Specify V4L2 minor mode number." | ||
69 | "\n -1 = use next available (default)" | ||
70 | "\n n = use minor number n (integer >= 0)" | ||
71 | "\nYou can specify up to " | ||
72 | __MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way." | ||
73 | "\nFor example:" | ||
74 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" | ||
75 | "\nthe second registered camera and use auto for the first" | ||
76 | "\none and for every other camera." | ||
77 | "\n"); | ||
78 | |||
79 | static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] = | ||
80 | ET61X251_FORCE_MUNMAP}; | ||
81 | module_param_array(force_munmap, bool, NULL, 0444); | ||
82 | MODULE_PARM_DESC(force_munmap, | ||
83 | "\n<0|1[,...]> Force the application to unmap previously" | ||
84 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" | ||
85 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" | ||
86 | "\nthis feature. This parameter is specific for each" | ||
87 | "\ndetected camera." | ||
88 | "\n 0 = do not force memory unmapping" | ||
89 | "\n 1 = force memory unmapping (save memory)" | ||
90 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." | ||
91 | "\n"); | ||
92 | |||
93 | #ifdef ET61X251_DEBUG | ||
94 | static unsigned short debug = ET61X251_DEBUG_LEVEL; | ||
95 | module_param(debug, ushort, 0644); | ||
96 | MODULE_PARM_DESC(debug, | ||
97 | "\n<n> Debugging information level, from 0 to 3:" | ||
98 | "\n0 = none (use carefully)" | ||
99 | "\n1 = critical errors" | ||
100 | "\n2 = significant informations" | ||
101 | "\n3 = more verbose messages" | ||
102 | "\nLevel 3 is useful for testing only, when only " | ||
103 | "one device is used." | ||
104 | "\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"." | ||
105 | "\n"); | ||
106 | #endif | ||
107 | |||
108 | /*****************************************************************************/ | ||
109 | |||
110 | static u32 | ||
111 | et61x251_request_buffers(struct et61x251_device* cam, u32 count, | ||
112 | enum et61x251_io_method io) | ||
113 | { | ||
114 | struct v4l2_pix_format* p = &(cam->sensor->pix_format); | ||
115 | struct v4l2_rect* r = &(cam->sensor->cropcap.bounds); | ||
116 | const size_t imagesize = cam->module_param.force_munmap || | ||
117 | io == IO_READ ? | ||
118 | (p->width * p->height * p->priv) / 8 : | ||
119 | (r->width * r->height * p->priv) / 8; | ||
120 | void* buff = NULL; | ||
121 | u32 i; | ||
122 | |||
123 | if (count > ET61X251_MAX_FRAMES) | ||
124 | count = ET61X251_MAX_FRAMES; | ||
125 | |||
126 | cam->nbuffers = count; | ||
127 | while (cam->nbuffers > 0) { | ||
128 | if ((buff = vmalloc_32(cam->nbuffers * PAGE_ALIGN(imagesize)))) | ||
129 | break; | ||
130 | cam->nbuffers--; | ||
131 | } | ||
132 | |||
133 | for (i = 0; i < cam->nbuffers; i++) { | ||
134 | cam->frame[i].bufmem = buff + i*PAGE_ALIGN(imagesize); | ||
135 | cam->frame[i].buf.index = i; | ||
136 | cam->frame[i].buf.m.offset = i*PAGE_ALIGN(imagesize); | ||
137 | cam->frame[i].buf.length = imagesize; | ||
138 | cam->frame[i].buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
139 | cam->frame[i].buf.sequence = 0; | ||
140 | cam->frame[i].buf.field = V4L2_FIELD_NONE; | ||
141 | cam->frame[i].buf.memory = V4L2_MEMORY_MMAP; | ||
142 | cam->frame[i].buf.flags = 0; | ||
143 | } | ||
144 | |||
145 | return cam->nbuffers; | ||
146 | } | ||
147 | |||
148 | |||
149 | static void et61x251_release_buffers(struct et61x251_device* cam) | ||
150 | { | ||
151 | if (cam->nbuffers) { | ||
152 | vfree(cam->frame[0].bufmem); | ||
153 | cam->nbuffers = 0; | ||
154 | } | ||
155 | cam->frame_current = NULL; | ||
156 | } | ||
157 | |||
158 | |||
159 | static void et61x251_empty_framequeues(struct et61x251_device* cam) | ||
160 | { | ||
161 | u32 i; | ||
162 | |||
163 | INIT_LIST_HEAD(&cam->inqueue); | ||
164 | INIT_LIST_HEAD(&cam->outqueue); | ||
165 | |||
166 | for (i = 0; i < ET61X251_MAX_FRAMES; i++) { | ||
167 | cam->frame[i].state = F_UNUSED; | ||
168 | cam->frame[i].buf.bytesused = 0; | ||
169 | } | ||
170 | } | ||
171 | |||
172 | |||
173 | static void et61x251_requeue_outqueue(struct et61x251_device* cam) | ||
174 | { | ||
175 | struct et61x251_frame_t *i; | ||
176 | |||
177 | list_for_each_entry(i, &cam->outqueue, frame) { | ||
178 | i->state = F_QUEUED; | ||
179 | list_add(&i->frame, &cam->inqueue); | ||
180 | } | ||
181 | |||
182 | INIT_LIST_HEAD(&cam->outqueue); | ||
183 | } | ||
184 | |||
185 | |||
186 | static void et61x251_queue_unusedframes(struct et61x251_device* cam) | ||
187 | { | ||
188 | unsigned long lock_flags; | ||
189 | u32 i; | ||
190 | |||
191 | for (i = 0; i < cam->nbuffers; i++) | ||
192 | if (cam->frame[i].state == F_UNUSED) { | ||
193 | cam->frame[i].state = F_QUEUED; | ||
194 | spin_lock_irqsave(&cam->queue_lock, lock_flags); | ||
195 | list_add_tail(&cam->frame[i].frame, &cam->inqueue); | ||
196 | spin_unlock_irqrestore(&cam->queue_lock, lock_flags); | ||
197 | } | ||
198 | } | ||
199 | |||
200 | /*****************************************************************************/ | ||
201 | |||
202 | int et61x251_write_reg(struct et61x251_device* cam, u8 value, u16 index) | ||
203 | { | ||
204 | struct usb_device* udev = cam->usbdev; | ||
205 | u8* buff = cam->control_buffer; | ||
206 | int res; | ||
207 | |||
208 | *buff = value; | ||
209 | |||
210 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | ||
211 | 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); | ||
212 | if (res < 0) { | ||
213 | DBG(3, "Failed to write a register (value 0x%02X, index " | ||
214 | "0x%02X, error %d)", value, index, res); | ||
215 | return -1; | ||
216 | } | ||
217 | |||
218 | return 0; | ||
219 | } | ||
220 | |||
221 | |||
222 | int et61x251_read_reg(struct et61x251_device* cam, u16 index) | ||
223 | { | ||
224 | struct usb_device* udev = cam->usbdev; | ||
225 | u8* buff = cam->control_buffer; | ||
226 | int res; | ||
227 | |||
228 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, | ||
229 | 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); | ||
230 | if (res < 0) | ||
231 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", | ||
232 | index, res); | ||
233 | |||
234 | return (res >= 0) ? (int)(*buff) : -1; | ||
235 | } | ||
236 | |||
237 | |||
238 | static int | ||
239 | et61x251_i2c_wait(struct et61x251_device* cam, struct et61x251_sensor* sensor) | ||
240 | { | ||
241 | int i, r; | ||
242 | |||
243 | for (i = 1; i <= 8; i++) { | ||
244 | if (sensor->interface == ET61X251_I2C_3WIRES) { | ||
245 | r = et61x251_read_reg(cam, 0x8e); | ||
246 | if (!(r & 0x02) && (r >= 0)) | ||
247 | return 0; | ||
248 | } else { | ||
249 | r = et61x251_read_reg(cam, 0x8b); | ||
250 | if (!(r & 0x01) && (r >= 0)) | ||
251 | return 0; | ||
252 | } | ||
253 | if (r < 0) | ||
254 | return -EIO; | ||
255 | udelay(8*8); /* minimum for sensors at 400kHz */ | ||
256 | } | ||
257 | |||
258 | return -EBUSY; | ||
259 | } | ||
260 | |||
261 | |||
262 | int | ||
263 | et61x251_i2c_try_read(struct et61x251_device* cam, | ||
264 | struct et61x251_sensor* sensor, u8 address) | ||
265 | { | ||
266 | struct usb_device* udev = cam->usbdev; | ||
267 | u8* data = cam->control_buffer; | ||
268 | int err = 0, res; | ||
269 | |||
270 | data[0] = address; | ||
271 | data[1] = cam->sensor->i2c_slave_id; | ||
272 | data[2] = cam->sensor->rsta | 0x10; | ||
273 | data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02); | ||
274 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | ||
275 | 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT); | ||
276 | if (res < 0) | ||
277 | err += res; | ||
278 | |||
279 | err += et61x251_i2c_wait(cam, sensor); | ||
280 | |||
281 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, | ||
282 | 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT); | ||
283 | if (res < 0) | ||
284 | err += res; | ||
285 | |||
286 | if (err) | ||
287 | DBG(3, "I2C read failed for %s image sensor", sensor->name); | ||
288 | |||
289 | PDBGG("I2C read: address 0x%02X, value: 0x%02X", address, data[0]); | ||
290 | |||
291 | return err ? -1 : (int)data[0]; | ||
292 | } | ||
293 | |||
294 | |||
295 | int | ||
296 | et61x251_i2c_try_write(struct et61x251_device* cam, | ||
297 | struct et61x251_sensor* sensor, u8 address, u8 value) | ||
298 | { | ||
299 | struct usb_device* udev = cam->usbdev; | ||
300 | u8* data = cam->control_buffer; | ||
301 | int err = 0, res; | ||
302 | |||
303 | data[0] = address; | ||
304 | data[1] = cam->sensor->i2c_slave_id; | ||
305 | data[2] = cam->sensor->rsta | 0x12; | ||
306 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | ||
307 | 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); | ||
308 | if (res < 0) | ||
309 | err += res; | ||
310 | |||
311 | data[0] = value; | ||
312 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | ||
313 | 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); | ||
314 | if (res < 0) | ||
315 | err += res; | ||
316 | |||
317 | err += et61x251_i2c_wait(cam, sensor); | ||
318 | |||
319 | if (err) | ||
320 | DBG(3, "I2C write failed for %s image sensor", sensor->name); | ||
321 | |||
322 | PDBGG("I2C write: address 0x%02X, value: 0x%02X", address, value); | ||
323 | |||
324 | return err ? -1 : 0; | ||
325 | } | ||
326 | |||
327 | |||
328 | int | ||
329 | et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, | ||
330 | u8 data3, u8 data4, u8 data5, u8 data6, u8 data7, | ||
331 | u8 data8, u8 address) | ||
332 | { | ||
333 | struct usb_device* udev = cam->usbdev; | ||
334 | u8* data = cam->control_buffer; | ||
335 | int err = 0, res; | ||
336 | |||
337 | if (!cam->sensor) | ||
338 | return -1; | ||
339 | |||
340 | data[0] = data2; | ||
341 | data[1] = data3; | ||
342 | data[2] = data4; | ||
343 | data[3] = data5; | ||
344 | data[4] = data6; | ||
345 | data[5] = data7; | ||
346 | data[6] = data8; | ||
347 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | ||
348 | 0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT); | ||
349 | if (res < 0) | ||
350 | err += res; | ||
351 | |||
352 | data[0] = address; | ||
353 | data[1] = cam->sensor->i2c_slave_id; | ||
354 | data[2] = cam->sensor->rsta | 0x02 | (n << 4); | ||
355 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | ||
356 | 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); | ||
357 | if (res < 0) | ||
358 | err += res; | ||
359 | |||
360 | /* Start writing through the serial interface */ | ||
361 | data[0] = data1; | ||
362 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | ||
363 | 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); | ||
364 | if (res < 0) | ||
365 | err += res; | ||
366 | |||
367 | err += et61x251_i2c_wait(cam, cam->sensor); | ||
368 | |||
369 | if (err) | ||
370 | DBG(3, "I2C raw write failed for %s image sensor", | ||
371 | cam->sensor->name); | ||
372 | |||
373 | PDBGG("I2C raw write: %u bytes, address = 0x%02X, data1 = 0x%02X, " | ||
374 | "data2 = 0x%02X, data3 = 0x%02X, data4 = 0x%02X, data5 = 0x%02X," | ||
375 | " data6 = 0x%02X, data7 = 0x%02X, data8 = 0x%02X", n, address, | ||
376 | data1, data2, data3, data4, data5, data6, data7, data8); | ||
377 | |||
378 | return err ? -1 : 0; | ||
379 | |||
380 | } | ||
381 | |||
382 | |||
383 | int et61x251_i2c_read(struct et61x251_device* cam, u8 address) | ||
384 | { | ||
385 | if (!cam->sensor) | ||
386 | return -1; | ||
387 | |||
388 | return et61x251_i2c_try_read(cam, cam->sensor, address); | ||
389 | } | ||
390 | |||
391 | |||
392 | int et61x251_i2c_write(struct et61x251_device* cam, u8 address, u8 value) | ||
393 | { | ||
394 | if (!cam->sensor) | ||
395 | return -1; | ||
396 | |||
397 | return et61x251_i2c_try_write(cam, cam->sensor, address, value); | ||
398 | } | ||
399 | |||
400 | /*****************************************************************************/ | ||
401 | |||
402 | static void et61x251_urb_complete(struct urb *urb, struct pt_regs* regs) | ||
403 | { | ||
404 | struct et61x251_device* cam = urb->context; | ||
405 | struct et61x251_frame_t** f; | ||
406 | size_t imagesize; | ||
407 | u8 i; | ||
408 | int err = 0; | ||
409 | |||
410 | if (urb->status == -ENOENT) | ||
411 | return; | ||
412 | |||
413 | f = &cam->frame_current; | ||
414 | |||
415 | if (cam->stream == STREAM_INTERRUPT) { | ||
416 | cam->stream = STREAM_OFF; | ||
417 | if ((*f)) | ||
418 | (*f)->state = F_QUEUED; | ||
419 | DBG(3, "Stream interrupted"); | ||
420 | wake_up_interruptible(&cam->wait_stream); | ||
421 | } | ||
422 | |||
423 | if (cam->state & DEV_DISCONNECTED) | ||
424 | return; | ||
425 | |||
426 | if (cam->state & DEV_MISCONFIGURED) { | ||
427 | wake_up_interruptible(&cam->wait_frame); | ||
428 | return; | ||
429 | } | ||
430 | |||
431 | if (cam->stream == STREAM_OFF || list_empty(&cam->inqueue)) | ||
432 | goto resubmit_urb; | ||
433 | |||
434 | if (!(*f)) | ||
435 | (*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t, | ||
436 | frame); | ||
437 | |||
438 | imagesize = (cam->sensor->pix_format.width * | ||
439 | cam->sensor->pix_format.height * | ||
440 | cam->sensor->pix_format.priv) / 8; | ||
441 | |||
442 | for (i = 0; i < urb->number_of_packets; i++) { | ||
443 | unsigned int len, status; | ||
444 | void *pos; | ||
445 | u8* b1, * b2, sof; | ||
446 | const u8 VOID_BYTES = 6; | ||
447 | size_t imglen; | ||
448 | |||
449 | len = urb->iso_frame_desc[i].actual_length; | ||
450 | status = urb->iso_frame_desc[i].status; | ||
451 | pos = urb->iso_frame_desc[i].offset + urb->transfer_buffer; | ||
452 | |||
453 | if (status) { | ||
454 | DBG(3, "Error in isochronous frame"); | ||
455 | (*f)->state = F_ERROR; | ||
456 | continue; | ||
457 | } | ||
458 | |||
459 | b1 = pos++; | ||
460 | b2 = pos++; | ||
461 | sof = ((*b1 & 0x3f) == 63); | ||
462 | imglen = ((*b1 & 0xc0) << 2) | *b2; | ||
463 | |||
464 | PDBGG("Isochrnous frame: length %u, #%u i, image length %zu", | ||
465 | len, i, imglen); | ||
466 | |||
467 | if ((*f)->state == F_QUEUED || (*f)->state == F_ERROR) | ||
468 | start_of_frame: | ||
469 | if (sof) { | ||
470 | (*f)->state = F_GRABBING; | ||
471 | (*f)->buf.bytesused = 0; | ||
472 | do_gettimeofday(&(*f)->buf.timestamp); | ||
473 | pos += 22; | ||
474 | DBG(3, "SOF detected: new video frame"); | ||
475 | } | ||
476 | |||
477 | if ((*f)->state == F_GRABBING) { | ||
478 | if (sof && (*f)->buf.bytesused) { | ||
479 | if (cam->sensor->pix_format.pixelformat == | ||
480 | V4L2_PIX_FMT_ET61X251) | ||
481 | goto end_of_frame; | ||
482 | else { | ||
483 | DBG(3, "Not expected SOF detected " | ||
484 | "after %lu bytes", | ||
485 | (unsigned long)(*f)->buf.bytesused); | ||
486 | (*f)->state = F_ERROR; | ||
487 | continue; | ||
488 | } | ||
489 | } | ||
490 | |||
491 | if ((*f)->buf.bytesused + imglen > imagesize) { | ||
492 | DBG(3, "Video frame size exceeded"); | ||
493 | (*f)->state = F_ERROR; | ||
494 | continue; | ||
495 | } | ||
496 | |||
497 | pos += VOID_BYTES; | ||
498 | |||
499 | memcpy((*f)->bufmem+(*f)->buf.bytesused, pos, imglen); | ||
500 | (*f)->buf.bytesused += imglen; | ||
501 | |||
502 | if ((*f)->buf.bytesused == imagesize) { | ||
503 | u32 b; | ||
504 | end_of_frame: | ||
505 | b = (*f)->buf.bytesused; | ||
506 | (*f)->state = F_DONE; | ||
507 | (*f)->buf.sequence= ++cam->frame_count; | ||
508 | spin_lock(&cam->queue_lock); | ||
509 | list_move_tail(&(*f)->frame, &cam->outqueue); | ||
510 | if (!list_empty(&cam->inqueue)) | ||
511 | (*f) = list_entry(cam->inqueue.next, | ||
512 | struct et61x251_frame_t, | ||
513 | frame); | ||
514 | else | ||
515 | (*f) = NULL; | ||
516 | spin_unlock(&cam->queue_lock); | ||
517 | DBG(3, "Video frame captured: : %lu bytes", | ||
518 | (unsigned long)(b)); | ||
519 | |||
520 | if (!(*f)) | ||
521 | goto resubmit_urb; | ||
522 | |||
523 | if (sof && | ||
524 | cam->sensor->pix_format.pixelformat == | ||
525 | V4L2_PIX_FMT_ET61X251) | ||
526 | goto start_of_frame; | ||
527 | } | ||
528 | } | ||
529 | } | ||
530 | |||
531 | resubmit_urb: | ||
532 | urb->dev = cam->usbdev; | ||
533 | err = usb_submit_urb(urb, GFP_ATOMIC); | ||
534 | if (err < 0 && err != -EPERM) { | ||
535 | cam->state |= DEV_MISCONFIGURED; | ||
536 | DBG(1, "usb_submit_urb() failed"); | ||
537 | } | ||
538 | |||
539 | wake_up_interruptible(&cam->wait_frame); | ||
540 | } | ||
541 | |||
542 | |||
543 | static int et61x251_start_transfer(struct et61x251_device* cam) | ||
544 | { | ||
545 | struct usb_device *udev = cam->usbdev; | ||
546 | struct urb* urb; | ||
547 | const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832, | ||
548 | 864, 896, 920, 956, 980, 1000, | ||
549 | 1022}; | ||
550 | const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING]; | ||
551 | s8 i, j; | ||
552 | int err = 0; | ||
553 | |||
554 | for (i = 0; i < ET61X251_URBS; i++) { | ||
555 | cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz, | ||
556 | GFP_KERNEL); | ||
557 | if (!cam->transfer_buffer[i]) { | ||
558 | err = -ENOMEM; | ||
559 | DBG(1, "Not enough memory"); | ||
560 | goto free_buffers; | ||
561 | } | ||
562 | } | ||
563 | |||
564 | for (i = 0; i < ET61X251_URBS; i++) { | ||
565 | urb = usb_alloc_urb(ET61X251_ISO_PACKETS, GFP_KERNEL); | ||
566 | cam->urb[i] = urb; | ||
567 | if (!urb) { | ||
568 | err = -ENOMEM; | ||
569 | DBG(1, "usb_alloc_urb() failed"); | ||
570 | goto free_urbs; | ||
571 | } | ||
572 | urb->dev = udev; | ||
573 | urb->context = cam; | ||
574 | urb->pipe = usb_rcvisocpipe(udev, 1); | ||
575 | urb->transfer_flags = URB_ISO_ASAP; | ||
576 | urb->number_of_packets = ET61X251_ISO_PACKETS; | ||
577 | urb->complete = et61x251_urb_complete; | ||
578 | urb->transfer_buffer = cam->transfer_buffer[i]; | ||
579 | urb->transfer_buffer_length = psz * ET61X251_ISO_PACKETS; | ||
580 | urb->interval = 1; | ||
581 | for (j = 0; j < ET61X251_ISO_PACKETS; j++) { | ||
582 | urb->iso_frame_desc[j].offset = psz * j; | ||
583 | urb->iso_frame_desc[j].length = psz; | ||
584 | } | ||
585 | } | ||
586 | |||
587 | err = et61x251_write_reg(cam, 0x01, 0x03); | ||
588 | err = et61x251_write_reg(cam, 0x00, 0x03); | ||
589 | err = et61x251_write_reg(cam, 0x08, 0x03); | ||
590 | if (err) { | ||
591 | err = -EIO; | ||
592 | DBG(1, "I/O hardware error"); | ||
593 | goto free_urbs; | ||
594 | } | ||
595 | |||
596 | err = usb_set_interface(udev, 0, ET61X251_ALTERNATE_SETTING); | ||
597 | if (err) { | ||
598 | DBG(1, "usb_set_interface() failed"); | ||
599 | goto free_urbs; | ||
600 | } | ||
601 | |||
602 | cam->frame_current = NULL; | ||
603 | |||
604 | for (i = 0; i < ET61X251_URBS; i++) { | ||
605 | err = usb_submit_urb(cam->urb[i], GFP_KERNEL); | ||
606 | if (err) { | ||
607 | for (j = i-1; j >= 0; j--) | ||
608 | usb_kill_urb(cam->urb[j]); | ||
609 | DBG(1, "usb_submit_urb() failed, error %d", err); | ||
610 | goto free_urbs; | ||
611 | } | ||
612 | } | ||
613 | |||
614 | return 0; | ||
615 | |||
616 | free_urbs: | ||
617 | for (i = 0; (i < ET61X251_URBS) && cam->urb[i]; i++) | ||
618 | usb_free_urb(cam->urb[i]); | ||
619 | |||
620 | free_buffers: | ||
621 | for (i = 0; (i < ET61X251_URBS) && cam->transfer_buffer[i]; i++) | ||
622 | kfree(cam->transfer_buffer[i]); | ||
623 | |||
624 | return err; | ||
625 | } | ||
626 | |||
627 | |||
628 | static int et61x251_stop_transfer(struct et61x251_device* cam) | ||
629 | { | ||
630 | struct usb_device *udev = cam->usbdev; | ||
631 | s8 i; | ||
632 | int err = 0; | ||
633 | |||
634 | if (cam->state & DEV_DISCONNECTED) | ||
635 | return 0; | ||
636 | |||
637 | for (i = ET61X251_URBS-1; i >= 0; i--) { | ||
638 | usb_kill_urb(cam->urb[i]); | ||
639 | usb_free_urb(cam->urb[i]); | ||
640 | kfree(cam->transfer_buffer[i]); | ||
641 | } | ||
642 | |||
643 | err = usb_set_interface(udev, 0, 0); /* 0 Mb/s */ | ||
644 | if (err) | ||
645 | DBG(3, "usb_set_interface() failed"); | ||
646 | |||
647 | return err; | ||
648 | } | ||
649 | |||
650 | |||
651 | static int et61x251_stream_interrupt(struct et61x251_device* cam) | ||
652 | { | ||
653 | int err = 0; | ||
654 | |||
655 | cam->stream = STREAM_INTERRUPT; | ||
656 | err = wait_event_timeout(cam->wait_stream, | ||
657 | (cam->stream == STREAM_OFF) || | ||
658 | (cam->state & DEV_DISCONNECTED), | ||
659 | ET61X251_URB_TIMEOUT); | ||
660 | if (cam->state & DEV_DISCONNECTED) | ||
661 | return -ENODEV; | ||
662 | else if (err) { | ||
663 | cam->state |= DEV_MISCONFIGURED; | ||
664 | DBG(1, "URB timeout reached. The camera is misconfigured. To " | ||
665 | "use it, close and open /dev/video%d again.", | ||
666 | cam->v4ldev->minor); | ||
667 | return err; | ||
668 | } | ||
669 | |||
670 | return 0; | ||
671 | } | ||
672 | |||
673 | /*****************************************************************************/ | ||
674 | |||
675 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
676 | static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count) | ||
677 | { | ||
678 | char str[5]; | ||
679 | char* endp; | ||
680 | unsigned long val; | ||
681 | |||
682 | if (len < 4) { | ||
683 | strncpy(str, buff, len); | ||
684 | str[len+1] = '\0'; | ||
685 | } else { | ||
686 | strncpy(str, buff, 4); | ||
687 | str[4] = '\0'; | ||
688 | } | ||
689 | |||
690 | val = simple_strtoul(str, &endp, 0); | ||
691 | |||
692 | *count = 0; | ||
693 | if (val <= 0xff) | ||
694 | *count = (ssize_t)(endp - str); | ||
695 | if ((*count) && (len == *count+1) && (buff[*count] == '\n')) | ||
696 | *count += 1; | ||
697 | |||
698 | return (u8)val; | ||
699 | } | ||
700 | |||
701 | /* | ||
702 | NOTE 1: being inside one of the following methods implies that the v4l | ||
703 | device exists for sure (see kobjects and reference counters) | ||
704 | NOTE 2: buffers are PAGE_SIZE long | ||
705 | */ | ||
706 | |||
707 | static ssize_t et61x251_show_reg(struct class_device* cd, char* buf) | ||
708 | { | ||
709 | struct et61x251_device* cam; | ||
710 | ssize_t count; | ||
711 | |||
712 | if (down_interruptible(&et61x251_sysfs_lock)) | ||
713 | return -ERESTARTSYS; | ||
714 | |||
715 | cam = video_get_drvdata(to_video_device(cd)); | ||
716 | if (!cam) { | ||
717 | up(&et61x251_sysfs_lock); | ||
718 | return -ENODEV; | ||
719 | } | ||
720 | |||
721 | count = sprintf(buf, "%u\n", cam->sysfs.reg); | ||
722 | |||
723 | up(&et61x251_sysfs_lock); | ||
724 | |||
725 | return count; | ||
726 | } | ||
727 | |||
728 | |||
729 | static ssize_t | ||
730 | et61x251_store_reg(struct class_device* cd, const char* buf, size_t len) | ||
731 | { | ||
732 | struct et61x251_device* cam; | ||
733 | u8 index; | ||
734 | ssize_t count; | ||
735 | |||
736 | if (down_interruptible(&et61x251_sysfs_lock)) | ||
737 | return -ERESTARTSYS; | ||
738 | |||
739 | cam = video_get_drvdata(to_video_device(cd)); | ||
740 | if (!cam) { | ||
741 | up(&et61x251_sysfs_lock); | ||
742 | return -ENODEV; | ||
743 | } | ||
744 | |||
745 | index = et61x251_strtou8(buf, len, &count); | ||
746 | if (index > 0x8e || !count) { | ||
747 | up(&et61x251_sysfs_lock); | ||
748 | return -EINVAL; | ||
749 | } | ||
750 | |||
751 | cam->sysfs.reg = index; | ||
752 | |||
753 | DBG(2, "Moved ET61X[12]51 register index to 0x%02X", cam->sysfs.reg); | ||
754 | DBG(3, "Written bytes: %zd", count); | ||
755 | |||
756 | up(&et61x251_sysfs_lock); | ||
757 | |||
758 | return count; | ||
759 | } | ||
760 | |||
761 | |||
762 | static ssize_t et61x251_show_val(struct class_device* cd, char* buf) | ||
763 | { | ||
764 | struct et61x251_device* cam; | ||
765 | ssize_t count; | ||
766 | int val; | ||
767 | |||
768 | if (down_interruptible(&et61x251_sysfs_lock)) | ||
769 | return -ERESTARTSYS; | ||
770 | |||
771 | cam = video_get_drvdata(to_video_device(cd)); | ||
772 | if (!cam) { | ||
773 | up(&et61x251_sysfs_lock); | ||
774 | return -ENODEV; | ||
775 | } | ||
776 | |||
777 | if ((val = et61x251_read_reg(cam, cam->sysfs.reg)) < 0) { | ||
778 | up(&et61x251_sysfs_lock); | ||
779 | return -EIO; | ||
780 | } | ||
781 | |||
782 | count = sprintf(buf, "%d\n", val); | ||
783 | |||
784 | DBG(3, "Read bytes: %zd", count); | ||
785 | |||
786 | up(&et61x251_sysfs_lock); | ||
787 | |||
788 | return count; | ||
789 | } | ||
790 | |||
791 | |||
792 | static ssize_t | ||
793 | et61x251_store_val(struct class_device* cd, const char* buf, size_t len) | ||
794 | { | ||
795 | struct et61x251_device* cam; | ||
796 | u8 value; | ||
797 | ssize_t count; | ||
798 | int err; | ||
799 | |||
800 | if (down_interruptible(&et61x251_sysfs_lock)) | ||
801 | return -ERESTARTSYS; | ||
802 | |||
803 | cam = video_get_drvdata(to_video_device(cd)); | ||
804 | if (!cam) { | ||
805 | up(&et61x251_sysfs_lock); | ||
806 | return -ENODEV; | ||
807 | } | ||
808 | |||
809 | value = et61x251_strtou8(buf, len, &count); | ||
810 | if (!count) { | ||
811 | up(&et61x251_sysfs_lock); | ||
812 | return -EINVAL; | ||
813 | } | ||
814 | |||
815 | err = et61x251_write_reg(cam, value, cam->sysfs.reg); | ||
816 | if (err) { | ||
817 | up(&et61x251_sysfs_lock); | ||
818 | return -EIO; | ||
819 | } | ||
820 | |||
821 | DBG(2, "Written ET61X[12]51 reg. 0x%02X, val. 0x%02X", | ||
822 | cam->sysfs.reg, value); | ||
823 | DBG(3, "Written bytes: %zd", count); | ||
824 | |||
825 | up(&et61x251_sysfs_lock); | ||
826 | |||
827 | return count; | ||
828 | } | ||
829 | |||
830 | |||
831 | static ssize_t et61x251_show_i2c_reg(struct class_device* cd, char* buf) | ||
832 | { | ||
833 | struct et61x251_device* cam; | ||
834 | ssize_t count; | ||
835 | |||
836 | if (down_interruptible(&et61x251_sysfs_lock)) | ||
837 | return -ERESTARTSYS; | ||
838 | |||
839 | cam = video_get_drvdata(to_video_device(cd)); | ||
840 | if (!cam) { | ||
841 | up(&et61x251_sysfs_lock); | ||
842 | return -ENODEV; | ||
843 | } | ||
844 | |||
845 | count = sprintf(buf, "%u\n", cam->sysfs.i2c_reg); | ||
846 | |||
847 | DBG(3, "Read bytes: %zd", count); | ||
848 | |||
849 | up(&et61x251_sysfs_lock); | ||
850 | |||
851 | return count; | ||
852 | } | ||
853 | |||
854 | |||
855 | static ssize_t | ||
856 | et61x251_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) | ||
857 | { | ||
858 | struct et61x251_device* cam; | ||
859 | u8 index; | ||
860 | ssize_t count; | ||
861 | |||
862 | if (down_interruptible(&et61x251_sysfs_lock)) | ||
863 | return -ERESTARTSYS; | ||
864 | |||
865 | cam = video_get_drvdata(to_video_device(cd)); | ||
866 | if (!cam) { | ||
867 | up(&et61x251_sysfs_lock); | ||
868 | return -ENODEV; | ||
869 | } | ||
870 | |||
871 | index = et61x251_strtou8(buf, len, &count); | ||
872 | if (!count) { | ||
873 | up(&et61x251_sysfs_lock); | ||
874 | return -EINVAL; | ||
875 | } | ||
876 | |||
877 | cam->sysfs.i2c_reg = index; | ||
878 | |||
879 | DBG(2, "Moved sensor register index to 0x%02X", cam->sysfs.i2c_reg); | ||
880 | DBG(3, "Written bytes: %zd", count); | ||
881 | |||
882 | up(&et61x251_sysfs_lock); | ||
883 | |||
884 | return count; | ||
885 | } | ||
886 | |||
887 | |||
888 | static ssize_t et61x251_show_i2c_val(struct class_device* cd, char* buf) | ||
889 | { | ||
890 | struct et61x251_device* cam; | ||
891 | ssize_t count; | ||
892 | int val; | ||
893 | |||
894 | if (down_interruptible(&et61x251_sysfs_lock)) | ||
895 | return -ERESTARTSYS; | ||
896 | |||
897 | cam = video_get_drvdata(to_video_device(cd)); | ||
898 | if (!cam) { | ||
899 | up(&et61x251_sysfs_lock); | ||
900 | return -ENODEV; | ||
901 | } | ||
902 | |||
903 | if (!(cam->sensor->sysfs_ops & ET61X251_I2C_READ)) { | ||
904 | up(&et61x251_sysfs_lock); | ||
905 | return -ENOSYS; | ||
906 | } | ||
907 | |||
908 | if ((val = et61x251_i2c_read(cam, cam->sysfs.i2c_reg)) < 0) { | ||
909 | up(&et61x251_sysfs_lock); | ||
910 | return -EIO; | ||
911 | } | ||
912 | |||
913 | count = sprintf(buf, "%d\n", val); | ||
914 | |||
915 | DBG(3, "Read bytes: %zd", count); | ||
916 | |||
917 | up(&et61x251_sysfs_lock); | ||
918 | |||
919 | return count; | ||
920 | } | ||
921 | |||
922 | |||
923 | static ssize_t | ||
924 | et61x251_store_i2c_val(struct class_device* cd, const char* buf, size_t len) | ||
925 | { | ||
926 | struct et61x251_device* cam; | ||
927 | u8 value; | ||
928 | ssize_t count; | ||
929 | int err; | ||
930 | |||
931 | if (down_interruptible(&et61x251_sysfs_lock)) | ||
932 | return -ERESTARTSYS; | ||
933 | |||
934 | cam = video_get_drvdata(to_video_device(cd)); | ||
935 | if (!cam) { | ||
936 | up(&et61x251_sysfs_lock); | ||
937 | return -ENODEV; | ||
938 | } | ||
939 | |||
940 | if (!(cam->sensor->sysfs_ops & ET61X251_I2C_READ)) { | ||
941 | up(&et61x251_sysfs_lock); | ||
942 | return -ENOSYS; | ||
943 | } | ||
944 | |||
945 | value = et61x251_strtou8(buf, len, &count); | ||
946 | if (!count) { | ||
947 | up(&et61x251_sysfs_lock); | ||
948 | return -EINVAL; | ||
949 | } | ||
950 | |||
951 | err = et61x251_i2c_write(cam, cam->sysfs.i2c_reg, value); | ||
952 | if (err) { | ||
953 | up(&et61x251_sysfs_lock); | ||
954 | return -EIO; | ||
955 | } | ||
956 | |||
957 | DBG(2, "Written sensor reg. 0x%02X, val. 0x%02X", | ||
958 | cam->sysfs.i2c_reg, value); | ||
959 | DBG(3, "Written bytes: %zd", count); | ||
960 | |||
961 | up(&et61x251_sysfs_lock); | ||
962 | |||
963 | return count; | ||
964 | } | ||
965 | |||
966 | |||
967 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, | ||
968 | et61x251_show_reg, et61x251_store_reg); | ||
969 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, | ||
970 | et61x251_show_val, et61x251_store_val); | ||
971 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, | ||
972 | et61x251_show_i2c_reg, et61x251_store_i2c_reg); | ||
973 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, | ||
974 | et61x251_show_i2c_val, et61x251_store_i2c_val); | ||
975 | |||
976 | |||
977 | static void et61x251_create_sysfs(struct et61x251_device* cam) | ||
978 | { | ||
979 | struct video_device *v4ldev = cam->v4ldev; | ||
980 | |||
981 | video_device_create_file(v4ldev, &class_device_attr_reg); | ||
982 | video_device_create_file(v4ldev, &class_device_attr_val); | ||
983 | if (cam->sensor && cam->sensor->sysfs_ops) { | ||
984 | video_device_create_file(v4ldev, &class_device_attr_i2c_reg); | ||
985 | video_device_create_file(v4ldev, &class_device_attr_i2c_val); | ||
986 | } | ||
987 | } | ||
988 | #endif /* CONFIG_VIDEO_ADV_DEBUG */ | ||
989 | |||
990 | /*****************************************************************************/ | ||
991 | |||
992 | static int | ||
993 | et61x251_set_pix_format(struct et61x251_device* cam, | ||
994 | struct v4l2_pix_format* pix) | ||
995 | { | ||
996 | int r, err = 0; | ||
997 | |||
998 | if ((r = et61x251_read_reg(cam, 0x12)) < 0) | ||
999 | err += r; | ||
1000 | if (pix->pixelformat == V4L2_PIX_FMT_ET61X251) | ||
1001 | err += et61x251_write_reg(cam, r & 0xfd, 0x12); | ||
1002 | else | ||
1003 | err += et61x251_write_reg(cam, r | 0x02, 0x12); | ||
1004 | |||
1005 | return err ? -EIO : 0; | ||
1006 | } | ||
1007 | |||
1008 | |||
1009 | static int | ||
1010 | et61x251_set_compression(struct et61x251_device* cam, | ||
1011 | struct v4l2_jpegcompression* compression) | ||
1012 | { | ||
1013 | int r, err = 0; | ||
1014 | |||
1015 | if ((r = et61x251_read_reg(cam, 0x12)) < 0) | ||
1016 | err += r; | ||
1017 | if (compression->quality == 0) | ||
1018 | err += et61x251_write_reg(cam, r & 0xfb, 0x12); | ||
1019 | else | ||
1020 | err += et61x251_write_reg(cam, r | 0x04, 0x12); | ||
1021 | |||
1022 | return err ? -EIO : 0; | ||
1023 | } | ||
1024 | |||
1025 | |||
1026 | static int et61x251_set_scale(struct et61x251_device* cam, u8 scale) | ||
1027 | { | ||
1028 | int r = 0, err = 0; | ||
1029 | |||
1030 | r = et61x251_read_reg(cam, 0x12); | ||
1031 | if (r < 0) | ||
1032 | err += r; | ||
1033 | |||
1034 | if (scale == 1) | ||
1035 | err += et61x251_write_reg(cam, r & ~0x01, 0x12); | ||
1036 | else if (scale == 2) | ||
1037 | err += et61x251_write_reg(cam, r | 0x01, 0x12); | ||
1038 | |||
1039 | if (err) | ||
1040 | return -EIO; | ||
1041 | |||
1042 | PDBGG("Scaling factor: %u", scale); | ||
1043 | |||
1044 | return 0; | ||
1045 | } | ||
1046 | |||
1047 | |||
1048 | static int | ||
1049 | et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect) | ||
1050 | { | ||
1051 | struct et61x251_sensor* s = cam->sensor; | ||
1052 | u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left + | ||
1053 | s->active_pixel.left), | ||
1054 | fmw_sy = (u16)(rect->top - s->cropcap.bounds.top + | ||
1055 | s->active_pixel.top), | ||
1056 | fmw_length = (u16)(rect->width), | ||
1057 | fmw_height = (u16)(rect->height); | ||
1058 | int err = 0; | ||
1059 | |||
1060 | err += et61x251_write_reg(cam, fmw_sx & 0xff, 0x69); | ||
1061 | err += et61x251_write_reg(cam, fmw_sy & 0xff, 0x6a); | ||
1062 | err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b); | ||
1063 | err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c); | ||
1064 | err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6) | ||
1065 | | ((fmw_length & 0x300) >> 4) | ||
1066 | | ((fmw_height & 0x300) >> 2), 0x6d); | ||
1067 | if (err) | ||
1068 | return -EIO; | ||
1069 | |||
1070 | PDBGG("fmw_sx, fmw_sy, fmw_length, fmw_height: %u %u %u %u", | ||
1071 | fmw_sx, fmw_sy, fmw_length, fmw_height); | ||
1072 | |||
1073 | return 0; | ||
1074 | } | ||
1075 | |||
1076 | |||
1077 | static int et61x251_init(struct et61x251_device* cam) | ||
1078 | { | ||
1079 | struct et61x251_sensor* s = cam->sensor; | ||
1080 | struct v4l2_control ctrl; | ||
1081 | struct v4l2_queryctrl *qctrl; | ||
1082 | struct v4l2_rect* rect; | ||
1083 | u8 i = 0; | ||
1084 | int err = 0; | ||
1085 | |||
1086 | if (!(cam->state & DEV_INITIALIZED)) { | ||
1087 | init_waitqueue_head(&cam->open); | ||
1088 | qctrl = s->qctrl; | ||
1089 | rect = &(s->cropcap.defrect); | ||
1090 | cam->compression.quality = ET61X251_COMPRESSION_QUALITY; | ||
1091 | } else { /* use current values */ | ||
1092 | qctrl = s->_qctrl; | ||
1093 | rect = &(s->_rect); | ||
1094 | } | ||
1095 | |||
1096 | err += et61x251_set_scale(cam, rect->width / s->pix_format.width); | ||
1097 | err += et61x251_set_crop(cam, rect); | ||
1098 | if (err) | ||
1099 | return err; | ||
1100 | |||
1101 | if (s->init) { | ||
1102 | err = s->init(cam); | ||
1103 | if (err) { | ||
1104 | DBG(3, "Sensor initialization failed"); | ||
1105 | return err; | ||
1106 | } | ||
1107 | } | ||
1108 | |||
1109 | err += et61x251_set_compression(cam, &cam->compression); | ||
1110 | err += et61x251_set_pix_format(cam, &s->pix_format); | ||
1111 | if (s->set_pix_format) | ||
1112 | err += s->set_pix_format(cam, &s->pix_format); | ||
1113 | if (err) | ||
1114 | return err; | ||
1115 | |||
1116 | if (s->pix_format.pixelformat == V4L2_PIX_FMT_ET61X251) | ||
1117 | DBG(3, "Compressed video format is active, quality %d", | ||
1118 | cam->compression.quality); | ||
1119 | else | ||
1120 | DBG(3, "Uncompressed video format is active"); | ||
1121 | |||
1122 | if (s->set_crop) | ||
1123 | if ((err = s->set_crop(cam, rect))) { | ||
1124 | DBG(3, "set_crop() failed"); | ||
1125 | return err; | ||
1126 | } | ||
1127 | |||
1128 | if (s->set_ctrl) { | ||
1129 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) | ||
1130 | if (s->qctrl[i].id != 0 && | ||
1131 | !(s->qctrl[i].flags & V4L2_CTRL_FLAG_DISABLED)) { | ||
1132 | ctrl.id = s->qctrl[i].id; | ||
1133 | ctrl.value = qctrl[i].default_value; | ||
1134 | err = s->set_ctrl(cam, &ctrl); | ||
1135 | if (err) { | ||
1136 | DBG(3, "Set %s control failed", | ||
1137 | s->qctrl[i].name); | ||
1138 | return err; | ||
1139 | } | ||
1140 | DBG(3, "Image sensor supports '%s' control", | ||
1141 | s->qctrl[i].name); | ||
1142 | } | ||
1143 | } | ||
1144 | |||
1145 | if (!(cam->state & DEV_INITIALIZED)) { | ||
1146 | init_MUTEX(&cam->fileop_sem); | ||
1147 | spin_lock_init(&cam->queue_lock); | ||
1148 | init_waitqueue_head(&cam->wait_frame); | ||
1149 | init_waitqueue_head(&cam->wait_stream); | ||
1150 | cam->nreadbuffers = 2; | ||
1151 | memcpy(s->_qctrl, s->qctrl, sizeof(s->qctrl)); | ||
1152 | memcpy(&(s->_rect), &(s->cropcap.defrect), | ||
1153 | sizeof(struct v4l2_rect)); | ||
1154 | cam->state |= DEV_INITIALIZED; | ||
1155 | } | ||
1156 | |||
1157 | DBG(2, "Initialization succeeded"); | ||
1158 | return 0; | ||
1159 | } | ||
1160 | |||
1161 | |||
1162 | static void et61x251_release_resources(struct et61x251_device* cam) | ||
1163 | { | ||
1164 | down(&et61x251_sysfs_lock); | ||
1165 | |||
1166 | DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); | ||
1167 | video_set_drvdata(cam->v4ldev, NULL); | ||
1168 | video_unregister_device(cam->v4ldev); | ||
1169 | |||
1170 | up(&et61x251_sysfs_lock); | ||
1171 | |||
1172 | kfree(cam->control_buffer); | ||
1173 | } | ||
1174 | |||
1175 | /*****************************************************************************/ | ||
1176 | |||
1177 | static int et61x251_open(struct inode* inode, struct file* filp) | ||
1178 | { | ||
1179 | struct et61x251_device* cam; | ||
1180 | int err = 0; | ||
1181 | |||
1182 | /* | ||
1183 | This is the only safe way to prevent race conditions with | ||
1184 | disconnect | ||
1185 | */ | ||
1186 | if (!down_read_trylock(&et61x251_disconnect)) | ||
1187 | return -ERESTARTSYS; | ||
1188 | |||
1189 | cam = video_get_drvdata(video_devdata(filp)); | ||
1190 | |||
1191 | if (down_interruptible(&cam->dev_sem)) { | ||
1192 | up_read(&et61x251_disconnect); | ||
1193 | return -ERESTARTSYS; | ||
1194 | } | ||
1195 | |||
1196 | if (cam->users) { | ||
1197 | DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor); | ||
1198 | if ((filp->f_flags & O_NONBLOCK) || | ||
1199 | (filp->f_flags & O_NDELAY)) { | ||
1200 | err = -EWOULDBLOCK; | ||
1201 | goto out; | ||
1202 | } | ||
1203 | up(&cam->dev_sem); | ||
1204 | err = wait_event_interruptible_exclusive(cam->open, | ||
1205 | cam->state & DEV_DISCONNECTED | ||
1206 | || !cam->users); | ||
1207 | if (err) { | ||
1208 | up_read(&et61x251_disconnect); | ||
1209 | return err; | ||
1210 | } | ||
1211 | if (cam->state & DEV_DISCONNECTED) { | ||
1212 | up_read(&et61x251_disconnect); | ||
1213 | return -ENODEV; | ||
1214 | } | ||
1215 | down(&cam->dev_sem); | ||
1216 | } | ||
1217 | |||
1218 | |||
1219 | if (cam->state & DEV_MISCONFIGURED) { | ||
1220 | err = et61x251_init(cam); | ||
1221 | if (err) { | ||
1222 | DBG(1, "Initialization failed again. " | ||
1223 | "I will retry on next open()."); | ||
1224 | goto out; | ||
1225 | } | ||
1226 | cam->state &= ~DEV_MISCONFIGURED; | ||
1227 | } | ||
1228 | |||
1229 | if ((err = et61x251_start_transfer(cam))) | ||
1230 | goto out; | ||
1231 | |||
1232 | filp->private_data = cam; | ||
1233 | cam->users++; | ||
1234 | cam->io = IO_NONE; | ||
1235 | cam->stream = STREAM_OFF; | ||
1236 | cam->nbuffers = 0; | ||
1237 | cam->frame_count = 0; | ||
1238 | et61x251_empty_framequeues(cam); | ||
1239 | |||
1240 | DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); | ||
1241 | |||
1242 | out: | ||
1243 | up(&cam->dev_sem); | ||
1244 | up_read(&et61x251_disconnect); | ||
1245 | return err; | ||
1246 | } | ||
1247 | |||
1248 | |||
1249 | static int et61x251_release(struct inode* inode, struct file* filp) | ||
1250 | { | ||
1251 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | ||
1252 | |||
1253 | down(&cam->dev_sem); /* prevent disconnect() to be called */ | ||
1254 | |||
1255 | et61x251_stop_transfer(cam); | ||
1256 | |||
1257 | et61x251_release_buffers(cam); | ||
1258 | |||
1259 | if (cam->state & DEV_DISCONNECTED) { | ||
1260 | et61x251_release_resources(cam); | ||
1261 | up(&cam->dev_sem); | ||
1262 | kfree(cam); | ||
1263 | return 0; | ||
1264 | } | ||
1265 | |||
1266 | cam->users--; | ||
1267 | wake_up_interruptible_nr(&cam->open, 1); | ||
1268 | |||
1269 | DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); | ||
1270 | |||
1271 | up(&cam->dev_sem); | ||
1272 | |||
1273 | return 0; | ||
1274 | } | ||
1275 | |||
1276 | |||
1277 | static ssize_t | ||
1278 | et61x251_read(struct file* filp, char __user * buf, | ||
1279 | size_t count, loff_t* f_pos) | ||
1280 | { | ||
1281 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | ||
1282 | struct et61x251_frame_t* f, * i; | ||
1283 | unsigned long lock_flags; | ||
1284 | int err = 0; | ||
1285 | |||
1286 | if (down_interruptible(&cam->fileop_sem)) | ||
1287 | return -ERESTARTSYS; | ||
1288 | |||
1289 | if (cam->state & DEV_DISCONNECTED) { | ||
1290 | DBG(1, "Device not present"); | ||
1291 | up(&cam->fileop_sem); | ||
1292 | return -ENODEV; | ||
1293 | } | ||
1294 | |||
1295 | if (cam->state & DEV_MISCONFIGURED) { | ||
1296 | DBG(1, "The camera is misconfigured. Close and open it " | ||
1297 | "again."); | ||
1298 | up(&cam->fileop_sem); | ||
1299 | return -EIO; | ||
1300 | } | ||
1301 | |||
1302 | if (cam->io == IO_MMAP) { | ||
1303 | DBG(3, "Close and open the device again to choose the read " | ||
1304 | "method"); | ||
1305 | up(&cam->fileop_sem); | ||
1306 | return -EINVAL; | ||
1307 | } | ||
1308 | |||
1309 | if (cam->io == IO_NONE) { | ||
1310 | if (!et61x251_request_buffers(cam, cam->nreadbuffers, | ||
1311 | IO_READ)) { | ||
1312 | DBG(1, "read() failed, not enough memory"); | ||
1313 | up(&cam->fileop_sem); | ||
1314 | return -ENOMEM; | ||
1315 | } | ||
1316 | cam->io = IO_READ; | ||
1317 | cam->stream = STREAM_ON; | ||
1318 | } | ||
1319 | |||
1320 | if (list_empty(&cam->inqueue)) { | ||
1321 | if (!list_empty(&cam->outqueue)) | ||
1322 | et61x251_empty_framequeues(cam); | ||
1323 | et61x251_queue_unusedframes(cam); | ||
1324 | } | ||
1325 | |||
1326 | if (!count) { | ||
1327 | up(&cam->fileop_sem); | ||
1328 | return 0; | ||
1329 | } | ||
1330 | |||
1331 | if (list_empty(&cam->outqueue)) { | ||
1332 | if (filp->f_flags & O_NONBLOCK) { | ||
1333 | up(&cam->fileop_sem); | ||
1334 | return -EAGAIN; | ||
1335 | } | ||
1336 | err = wait_event_interruptible | ||
1337 | ( cam->wait_frame, | ||
1338 | (!list_empty(&cam->outqueue)) || | ||
1339 | (cam->state & DEV_DISCONNECTED) || | ||
1340 | (cam->state & DEV_MISCONFIGURED) ); | ||
1341 | if (err) { | ||
1342 | up(&cam->fileop_sem); | ||
1343 | return err; | ||
1344 | } | ||
1345 | if (cam->state & DEV_DISCONNECTED) { | ||
1346 | up(&cam->fileop_sem); | ||
1347 | return -ENODEV; | ||
1348 | } | ||
1349 | if (cam->state & DEV_MISCONFIGURED) { | ||
1350 | up(&cam->fileop_sem); | ||
1351 | return -EIO; | ||
1352 | } | ||
1353 | } | ||
1354 | |||
1355 | f = list_entry(cam->outqueue.prev, struct et61x251_frame_t, frame); | ||
1356 | |||
1357 | if (count > f->buf.bytesused) | ||
1358 | count = f->buf.bytesused; | ||
1359 | |||
1360 | if (copy_to_user(buf, f->bufmem, count)) { | ||
1361 | err = -EFAULT; | ||
1362 | goto exit; | ||
1363 | } | ||
1364 | *f_pos += count; | ||
1365 | |||
1366 | exit: | ||
1367 | spin_lock_irqsave(&cam->queue_lock, lock_flags); | ||
1368 | list_for_each_entry(i, &cam->outqueue, frame) | ||
1369 | i->state = F_UNUSED; | ||
1370 | INIT_LIST_HEAD(&cam->outqueue); | ||
1371 | spin_unlock_irqrestore(&cam->queue_lock, lock_flags); | ||
1372 | |||
1373 | et61x251_queue_unusedframes(cam); | ||
1374 | |||
1375 | PDBGG("Frame #%lu, bytes read: %zu", | ||
1376 | (unsigned long)f->buf.index, count); | ||
1377 | |||
1378 | up(&cam->fileop_sem); | ||
1379 | |||
1380 | return err ? err : count; | ||
1381 | } | ||
1382 | |||
1383 | |||
1384 | static unsigned int et61x251_poll(struct file *filp, poll_table *wait) | ||
1385 | { | ||
1386 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | ||
1387 | struct et61x251_frame_t* f; | ||
1388 | unsigned long lock_flags; | ||
1389 | unsigned int mask = 0; | ||
1390 | |||
1391 | if (down_interruptible(&cam->fileop_sem)) | ||
1392 | return POLLERR; | ||
1393 | |||
1394 | if (cam->state & DEV_DISCONNECTED) { | ||
1395 | DBG(1, "Device not present"); | ||
1396 | goto error; | ||
1397 | } | ||
1398 | |||
1399 | if (cam->state & DEV_MISCONFIGURED) { | ||
1400 | DBG(1, "The camera is misconfigured. Close and open it " | ||
1401 | "again."); | ||
1402 | goto error; | ||
1403 | } | ||
1404 | |||
1405 | if (cam->io == IO_NONE) { | ||
1406 | if (!et61x251_request_buffers(cam, cam->nreadbuffers, | ||
1407 | IO_READ)) { | ||
1408 | DBG(1, "poll() failed, not enough memory"); | ||
1409 | goto error; | ||
1410 | } | ||
1411 | cam->io = IO_READ; | ||
1412 | cam->stream = STREAM_ON; | ||
1413 | } | ||
1414 | |||
1415 | if (cam->io == IO_READ) { | ||
1416 | spin_lock_irqsave(&cam->queue_lock, lock_flags); | ||
1417 | list_for_each_entry(f, &cam->outqueue, frame) | ||
1418 | f->state = F_UNUSED; | ||
1419 | INIT_LIST_HEAD(&cam->outqueue); | ||
1420 | spin_unlock_irqrestore(&cam->queue_lock, lock_flags); | ||
1421 | et61x251_queue_unusedframes(cam); | ||
1422 | } | ||
1423 | |||
1424 | poll_wait(filp, &cam->wait_frame, wait); | ||
1425 | |||
1426 | if (!list_empty(&cam->outqueue)) | ||
1427 | mask |= POLLIN | POLLRDNORM; | ||
1428 | |||
1429 | up(&cam->fileop_sem); | ||
1430 | |||
1431 | return mask; | ||
1432 | |||
1433 | error: | ||
1434 | up(&cam->fileop_sem); | ||
1435 | return POLLERR; | ||
1436 | } | ||
1437 | |||
1438 | |||
1439 | static void et61x251_vm_open(struct vm_area_struct* vma) | ||
1440 | { | ||
1441 | struct et61x251_frame_t* f = vma->vm_private_data; | ||
1442 | f->vma_use_count++; | ||
1443 | } | ||
1444 | |||
1445 | |||
1446 | static void et61x251_vm_close(struct vm_area_struct* vma) | ||
1447 | { | ||
1448 | /* NOTE: buffers are not freed here */ | ||
1449 | struct et61x251_frame_t* f = vma->vm_private_data; | ||
1450 | f->vma_use_count--; | ||
1451 | } | ||
1452 | |||
1453 | |||
1454 | static struct vm_operations_struct et61x251_vm_ops = { | ||
1455 | .open = et61x251_vm_open, | ||
1456 | .close = et61x251_vm_close, | ||
1457 | }; | ||
1458 | |||
1459 | |||
1460 | static int et61x251_mmap(struct file* filp, struct vm_area_struct *vma) | ||
1461 | { | ||
1462 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | ||
1463 | unsigned long size = vma->vm_end - vma->vm_start, | ||
1464 | start = vma->vm_start; | ||
1465 | void *pos; | ||
1466 | u32 i; | ||
1467 | |||
1468 | if (down_interruptible(&cam->fileop_sem)) | ||
1469 | return -ERESTARTSYS; | ||
1470 | |||
1471 | if (cam->state & DEV_DISCONNECTED) { | ||
1472 | DBG(1, "Device not present"); | ||
1473 | up(&cam->fileop_sem); | ||
1474 | return -ENODEV; | ||
1475 | } | ||
1476 | |||
1477 | if (cam->state & DEV_MISCONFIGURED) { | ||
1478 | DBG(1, "The camera is misconfigured. Close and open it " | ||
1479 | "again."); | ||
1480 | up(&cam->fileop_sem); | ||
1481 | return -EIO; | ||
1482 | } | ||
1483 | |||
1484 | if (cam->io != IO_MMAP || !(vma->vm_flags & VM_WRITE) || | ||
1485 | size != PAGE_ALIGN(cam->frame[0].buf.length)) { | ||
1486 | up(&cam->fileop_sem); | ||
1487 | return -EINVAL; | ||
1488 | } | ||
1489 | |||
1490 | for (i = 0; i < cam->nbuffers; i++) { | ||
1491 | if ((cam->frame[i].buf.m.offset>>PAGE_SHIFT) == vma->vm_pgoff) | ||
1492 | break; | ||
1493 | } | ||
1494 | if (i == cam->nbuffers) { | ||
1495 | up(&cam->fileop_sem); | ||
1496 | return -EINVAL; | ||
1497 | } | ||
1498 | |||
1499 | vma->vm_flags |= VM_IO; | ||
1500 | vma->vm_flags |= VM_RESERVED; | ||
1501 | |||
1502 | pos = cam->frame[i].bufmem; | ||
1503 | while (size > 0) { /* size is page-aligned */ | ||
1504 | if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { | ||
1505 | up(&cam->fileop_sem); | ||
1506 | return -EAGAIN; | ||
1507 | } | ||
1508 | start += PAGE_SIZE; | ||
1509 | pos += PAGE_SIZE; | ||
1510 | size -= PAGE_SIZE; | ||
1511 | } | ||
1512 | |||
1513 | vma->vm_ops = &et61x251_vm_ops; | ||
1514 | vma->vm_private_data = &cam->frame[i]; | ||
1515 | |||
1516 | et61x251_vm_open(vma); | ||
1517 | |||
1518 | up(&cam->fileop_sem); | ||
1519 | |||
1520 | return 0; | ||
1521 | } | ||
1522 | |||
1523 | /*****************************************************************************/ | ||
1524 | |||
1525 | static int | ||
1526 | et61x251_vidioc_querycap(struct et61x251_device* cam, void __user * arg) | ||
1527 | { | ||
1528 | struct v4l2_capability cap = { | ||
1529 | .driver = "et61x251", | ||
1530 | .version = ET61X251_MODULE_VERSION_CODE, | ||
1531 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | | ||
1532 | V4L2_CAP_STREAMING, | ||
1533 | }; | ||
1534 | |||
1535 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); | ||
1536 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) | ||
1537 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, | ||
1538 | sizeof(cap.bus_info)); | ||
1539 | |||
1540 | if (copy_to_user(arg, &cap, sizeof(cap))) | ||
1541 | return -EFAULT; | ||
1542 | |||
1543 | return 0; | ||
1544 | } | ||
1545 | |||
1546 | |||
1547 | static int | ||
1548 | et61x251_vidioc_enuminput(struct et61x251_device* cam, void __user * arg) | ||
1549 | { | ||
1550 | struct v4l2_input i; | ||
1551 | |||
1552 | if (copy_from_user(&i, arg, sizeof(i))) | ||
1553 | return -EFAULT; | ||
1554 | |||
1555 | if (i.index) | ||
1556 | return -EINVAL; | ||
1557 | |||
1558 | memset(&i, 0, sizeof(i)); | ||
1559 | strcpy(i.name, "Camera"); | ||
1560 | |||
1561 | if (copy_to_user(arg, &i, sizeof(i))) | ||
1562 | return -EFAULT; | ||
1563 | |||
1564 | return 0; | ||
1565 | } | ||
1566 | |||
1567 | |||
1568 | static int | ||
1569 | et61x251_vidioc_gs_input(struct et61x251_device* cam, void __user * arg) | ||
1570 | { | ||
1571 | int index; | ||
1572 | |||
1573 | if (copy_from_user(&index, arg, sizeof(index))) | ||
1574 | return -EFAULT; | ||
1575 | |||
1576 | if (index != 0) | ||
1577 | return -EINVAL; | ||
1578 | |||
1579 | return 0; | ||
1580 | } | ||
1581 | |||
1582 | |||
1583 | static int | ||
1584 | et61x251_vidioc_query_ctrl(struct et61x251_device* cam, void __user * arg) | ||
1585 | { | ||
1586 | struct et61x251_sensor* s = cam->sensor; | ||
1587 | struct v4l2_queryctrl qc; | ||
1588 | u8 i; | ||
1589 | |||
1590 | if (copy_from_user(&qc, arg, sizeof(qc))) | ||
1591 | return -EFAULT; | ||
1592 | |||
1593 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) | ||
1594 | if (qc.id && qc.id == s->qctrl[i].id) { | ||
1595 | memcpy(&qc, &(s->qctrl[i]), sizeof(qc)); | ||
1596 | if (copy_to_user(arg, &qc, sizeof(qc))) | ||
1597 | return -EFAULT; | ||
1598 | return 0; | ||
1599 | } | ||
1600 | |||
1601 | return -EINVAL; | ||
1602 | } | ||
1603 | |||
1604 | |||
1605 | static int | ||
1606 | et61x251_vidioc_g_ctrl(struct et61x251_device* cam, void __user * arg) | ||
1607 | { | ||
1608 | struct et61x251_sensor* s = cam->sensor; | ||
1609 | struct v4l2_control ctrl; | ||
1610 | int err = 0; | ||
1611 | u8 i; | ||
1612 | |||
1613 | if (!s->get_ctrl && !s->set_ctrl) | ||
1614 | return -EINVAL; | ||
1615 | |||
1616 | if (copy_from_user(&ctrl, arg, sizeof(ctrl))) | ||
1617 | return -EFAULT; | ||
1618 | |||
1619 | if (!s->get_ctrl) { | ||
1620 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) | ||
1621 | if (ctrl.id == s->qctrl[i].id) { | ||
1622 | ctrl.value = s->_qctrl[i].default_value; | ||
1623 | goto exit; | ||
1624 | } | ||
1625 | return -EINVAL; | ||
1626 | } else | ||
1627 | err = s->get_ctrl(cam, &ctrl); | ||
1628 | |||
1629 | exit: | ||
1630 | if (copy_to_user(arg, &ctrl, sizeof(ctrl))) | ||
1631 | return -EFAULT; | ||
1632 | |||
1633 | return err; | ||
1634 | } | ||
1635 | |||
1636 | |||
1637 | static int | ||
1638 | et61x251_vidioc_s_ctrl(struct et61x251_device* cam, void __user * arg) | ||
1639 | { | ||
1640 | struct et61x251_sensor* s = cam->sensor; | ||
1641 | struct v4l2_control ctrl; | ||
1642 | u8 i; | ||
1643 | int err = 0; | ||
1644 | |||
1645 | if (!s->set_ctrl) | ||
1646 | return -EINVAL; | ||
1647 | |||
1648 | if (copy_from_user(&ctrl, arg, sizeof(ctrl))) | ||
1649 | return -EFAULT; | ||
1650 | |||
1651 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) | ||
1652 | if (ctrl.id == s->qctrl[i].id) { | ||
1653 | if (ctrl.value < s->qctrl[i].minimum || | ||
1654 | ctrl.value > s->qctrl[i].maximum) | ||
1655 | return -ERANGE; | ||
1656 | ctrl.value -= ctrl.value % s->qctrl[i].step; | ||
1657 | break; | ||
1658 | } | ||
1659 | |||
1660 | if ((err = s->set_ctrl(cam, &ctrl))) | ||
1661 | return err; | ||
1662 | |||
1663 | s->_qctrl[i].default_value = ctrl.value; | ||
1664 | |||
1665 | return 0; | ||
1666 | } | ||
1667 | |||
1668 | |||
1669 | static int | ||
1670 | et61x251_vidioc_cropcap(struct et61x251_device* cam, void __user * arg) | ||
1671 | { | ||
1672 | struct v4l2_cropcap* cc = &(cam->sensor->cropcap); | ||
1673 | |||
1674 | cc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1675 | cc->pixelaspect.numerator = 1; | ||
1676 | cc->pixelaspect.denominator = 1; | ||
1677 | |||
1678 | if (copy_to_user(arg, cc, sizeof(*cc))) | ||
1679 | return -EFAULT; | ||
1680 | |||
1681 | return 0; | ||
1682 | } | ||
1683 | |||
1684 | |||
1685 | static int | ||
1686 | et61x251_vidioc_g_crop(struct et61x251_device* cam, void __user * arg) | ||
1687 | { | ||
1688 | struct et61x251_sensor* s = cam->sensor; | ||
1689 | struct v4l2_crop crop = { | ||
1690 | .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, | ||
1691 | }; | ||
1692 | |||
1693 | memcpy(&(crop.c), &(s->_rect), sizeof(struct v4l2_rect)); | ||
1694 | |||
1695 | if (copy_to_user(arg, &crop, sizeof(crop))) | ||
1696 | return -EFAULT; | ||
1697 | |||
1698 | return 0; | ||
1699 | } | ||
1700 | |||
1701 | |||
1702 | static int | ||
1703 | et61x251_vidioc_s_crop(struct et61x251_device* cam, void __user * arg) | ||
1704 | { | ||
1705 | struct et61x251_sensor* s = cam->sensor; | ||
1706 | struct v4l2_crop crop; | ||
1707 | struct v4l2_rect* rect; | ||
1708 | struct v4l2_rect* bounds = &(s->cropcap.bounds); | ||
1709 | struct v4l2_pix_format* pix_format = &(s->pix_format); | ||
1710 | u8 scale; | ||
1711 | const enum et61x251_stream_state stream = cam->stream; | ||
1712 | const u32 nbuffers = cam->nbuffers; | ||
1713 | u32 i; | ||
1714 | int err = 0; | ||
1715 | |||
1716 | if (copy_from_user(&crop, arg, sizeof(crop))) | ||
1717 | return -EFAULT; | ||
1718 | |||
1719 | rect = &(crop.c); | ||
1720 | |||
1721 | if (crop.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1722 | return -EINVAL; | ||
1723 | |||
1724 | if (cam->module_param.force_munmap) | ||
1725 | for (i = 0; i < cam->nbuffers; i++) | ||
1726 | if (cam->frame[i].vma_use_count) { | ||
1727 | DBG(3, "VIDIOC_S_CROP failed. " | ||
1728 | "Unmap the buffers first."); | ||
1729 | return -EINVAL; | ||
1730 | } | ||
1731 | |||
1732 | /* Preserve R,G or B origin */ | ||
1733 | rect->left = (s->_rect.left & 1L) ? rect->left | 1L : rect->left & ~1L; | ||
1734 | rect->top = (s->_rect.top & 1L) ? rect->top | 1L : rect->top & ~1L; | ||
1735 | |||
1736 | if (rect->width < 4) | ||
1737 | rect->width = 4; | ||
1738 | if (rect->height < 4) | ||
1739 | rect->height = 4; | ||
1740 | if (rect->width > bounds->width) | ||
1741 | rect->width = bounds->width; | ||
1742 | if (rect->height > bounds->height) | ||
1743 | rect->height = bounds->height; | ||
1744 | if (rect->left < bounds->left) | ||
1745 | rect->left = bounds->left; | ||
1746 | if (rect->top < bounds->top) | ||
1747 | rect->top = bounds->top; | ||
1748 | if (rect->left + rect->width > bounds->left + bounds->width) | ||
1749 | rect->left = bounds->left+bounds->width - rect->width; | ||
1750 | if (rect->top + rect->height > bounds->top + bounds->height) | ||
1751 | rect->top = bounds->top+bounds->height - rect->height; | ||
1752 | |||
1753 | rect->width &= ~3L; | ||
1754 | rect->height &= ~3L; | ||
1755 | |||
1756 | if (ET61X251_PRESERVE_IMGSCALE) { | ||
1757 | /* Calculate the actual scaling factor */ | ||
1758 | u32 a, b; | ||
1759 | a = rect->width * rect->height; | ||
1760 | b = pix_format->width * pix_format->height; | ||
1761 | scale = b ? (u8)((a / b) < 4 ? 1 : 2) : 1; | ||
1762 | } else | ||
1763 | scale = 1; | ||
1764 | |||
1765 | if (cam->stream == STREAM_ON) | ||
1766 | if ((err = et61x251_stream_interrupt(cam))) | ||
1767 | return err; | ||
1768 | |||
1769 | if (copy_to_user(arg, &crop, sizeof(crop))) { | ||
1770 | cam->stream = stream; | ||
1771 | return -EFAULT; | ||
1772 | } | ||
1773 | |||
1774 | if (cam->module_param.force_munmap || cam->io == IO_READ) | ||
1775 | et61x251_release_buffers(cam); | ||
1776 | |||
1777 | err = et61x251_set_crop(cam, rect); | ||
1778 | if (s->set_crop) | ||
1779 | err += s->set_crop(cam, rect); | ||
1780 | err += et61x251_set_scale(cam, scale); | ||
1781 | |||
1782 | if (err) { /* atomic, no rollback in ioctl() */ | ||
1783 | cam->state |= DEV_MISCONFIGURED; | ||
1784 | DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To " | ||
1785 | "use the camera, close and open /dev/video%d again.", | ||
1786 | cam->v4ldev->minor); | ||
1787 | return -EIO; | ||
1788 | } | ||
1789 | |||
1790 | s->pix_format.width = rect->width/scale; | ||
1791 | s->pix_format.height = rect->height/scale; | ||
1792 | memcpy(&(s->_rect), rect, sizeof(*rect)); | ||
1793 | |||
1794 | if ((cam->module_param.force_munmap || cam->io == IO_READ) && | ||
1795 | nbuffers != et61x251_request_buffers(cam, nbuffers, cam->io)) { | ||
1796 | cam->state |= DEV_MISCONFIGURED; | ||
1797 | DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To " | ||
1798 | "use the camera, close and open /dev/video%d again.", | ||
1799 | cam->v4ldev->minor); | ||
1800 | return -ENOMEM; | ||
1801 | } | ||
1802 | |||
1803 | if (cam->io == IO_READ) | ||
1804 | et61x251_empty_framequeues(cam); | ||
1805 | else if (cam->module_param.force_munmap) | ||
1806 | et61x251_requeue_outqueue(cam); | ||
1807 | |||
1808 | cam->stream = stream; | ||
1809 | |||
1810 | return 0; | ||
1811 | } | ||
1812 | |||
1813 | |||
1814 | static int | ||
1815 | et61x251_vidioc_enum_fmt(struct et61x251_device* cam, void __user * arg) | ||
1816 | { | ||
1817 | struct v4l2_fmtdesc fmtd; | ||
1818 | |||
1819 | if (copy_from_user(&fmtd, arg, sizeof(fmtd))) | ||
1820 | return -EFAULT; | ||
1821 | |||
1822 | if (fmtd.index == 0) { | ||
1823 | strcpy(fmtd.description, "bayer rgb"); | ||
1824 | fmtd.pixelformat = V4L2_PIX_FMT_SBGGR8; | ||
1825 | } else if (fmtd.index == 1) { | ||
1826 | strcpy(fmtd.description, "compressed"); | ||
1827 | fmtd.pixelformat = V4L2_PIX_FMT_ET61X251; | ||
1828 | fmtd.flags = V4L2_FMT_FLAG_COMPRESSED; | ||
1829 | } else | ||
1830 | return -EINVAL; | ||
1831 | |||
1832 | fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1833 | memset(&fmtd.reserved, 0, sizeof(fmtd.reserved)); | ||
1834 | |||
1835 | if (copy_to_user(arg, &fmtd, sizeof(fmtd))) | ||
1836 | return -EFAULT; | ||
1837 | |||
1838 | return 0; | ||
1839 | } | ||
1840 | |||
1841 | |||
1842 | static int | ||
1843 | et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg) | ||
1844 | { | ||
1845 | struct v4l2_format format; | ||
1846 | struct v4l2_pix_format* pfmt = &(cam->sensor->pix_format); | ||
1847 | |||
1848 | if (copy_from_user(&format, arg, sizeof(format))) | ||
1849 | return -EFAULT; | ||
1850 | |||
1851 | if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1852 | return -EINVAL; | ||
1853 | |||
1854 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251) | ||
1855 | ? 0 : (pfmt->width * pfmt->priv) / 8; | ||
1856 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); | ||
1857 | pfmt->field = V4L2_FIELD_NONE; | ||
1858 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); | ||
1859 | |||
1860 | if (copy_to_user(arg, &format, sizeof(format))) | ||
1861 | return -EFAULT; | ||
1862 | |||
1863 | return 0; | ||
1864 | } | ||
1865 | |||
1866 | |||
1867 | static int | ||
1868 | et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, | ||
1869 | void __user * arg) | ||
1870 | { | ||
1871 | struct et61x251_sensor* s = cam->sensor; | ||
1872 | struct v4l2_format format; | ||
1873 | struct v4l2_pix_format* pix; | ||
1874 | struct v4l2_pix_format* pfmt = &(s->pix_format); | ||
1875 | struct v4l2_rect* bounds = &(s->cropcap.bounds); | ||
1876 | struct v4l2_rect rect; | ||
1877 | u8 scale; | ||
1878 | const enum et61x251_stream_state stream = cam->stream; | ||
1879 | const u32 nbuffers = cam->nbuffers; | ||
1880 | u32 i; | ||
1881 | int err = 0; | ||
1882 | |||
1883 | if (copy_from_user(&format, arg, sizeof(format))) | ||
1884 | return -EFAULT; | ||
1885 | |||
1886 | pix = &(format.fmt.pix); | ||
1887 | |||
1888 | if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1889 | return -EINVAL; | ||
1890 | |||
1891 | memcpy(&rect, &(s->_rect), sizeof(rect)); | ||
1892 | |||
1893 | { /* calculate the actual scaling factor */ | ||
1894 | u32 a, b; | ||
1895 | a = rect.width * rect.height; | ||
1896 | b = pix->width * pix->height; | ||
1897 | scale = b ? (u8)((a / b) < 4 ? 1 : 2) : 1; | ||
1898 | } | ||
1899 | |||
1900 | rect.width = scale * pix->width; | ||
1901 | rect.height = scale * pix->height; | ||
1902 | |||
1903 | if (rect.width < 4) | ||
1904 | rect.width = 4; | ||
1905 | if (rect.height < 4) | ||
1906 | rect.height = 4; | ||
1907 | if (rect.width > bounds->left + bounds->width - rect.left) | ||
1908 | rect.width = bounds->left + bounds->width - rect.left; | ||
1909 | if (rect.height > bounds->top + bounds->height - rect.top) | ||
1910 | rect.height = bounds->top + bounds->height - rect.top; | ||
1911 | |||
1912 | rect.width &= ~3L; | ||
1913 | rect.height &= ~3L; | ||
1914 | |||
1915 | { /* adjust the scaling factor */ | ||
1916 | u32 a, b; | ||
1917 | a = rect.width * rect.height; | ||
1918 | b = pix->width * pix->height; | ||
1919 | scale = b ? (u8)((a / b) < 4 ? 1 : 2) : 1; | ||
1920 | } | ||
1921 | |||
1922 | pix->width = rect.width / scale; | ||
1923 | pix->height = rect.height / scale; | ||
1924 | |||
1925 | if (pix->pixelformat != V4L2_PIX_FMT_ET61X251 && | ||
1926 | pix->pixelformat != V4L2_PIX_FMT_SBGGR8) | ||
1927 | pix->pixelformat = pfmt->pixelformat; | ||
1928 | pix->priv = pfmt->priv; /* bpp */ | ||
1929 | pix->colorspace = pfmt->colorspace; | ||
1930 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) | ||
1931 | ? 0 : (pix->width * pix->priv) / 8; | ||
1932 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); | ||
1933 | pix->field = V4L2_FIELD_NONE; | ||
1934 | |||
1935 | if (cmd == VIDIOC_TRY_FMT) { | ||
1936 | if (copy_to_user(arg, &format, sizeof(format))) | ||
1937 | return -EFAULT; | ||
1938 | return 0; | ||
1939 | } | ||
1940 | |||
1941 | if (cam->module_param.force_munmap) | ||
1942 | for (i = 0; i < cam->nbuffers; i++) | ||
1943 | if (cam->frame[i].vma_use_count) { | ||
1944 | DBG(3, "VIDIOC_S_FMT failed. " | ||
1945 | "Unmap the buffers first."); | ||
1946 | return -EINVAL; | ||
1947 | } | ||
1948 | |||
1949 | if (cam->stream == STREAM_ON) | ||
1950 | if ((err = et61x251_stream_interrupt(cam))) | ||
1951 | return err; | ||
1952 | |||
1953 | if (copy_to_user(arg, &format, sizeof(format))) { | ||
1954 | cam->stream = stream; | ||
1955 | return -EFAULT; | ||
1956 | } | ||
1957 | |||
1958 | if (cam->module_param.force_munmap || cam->io == IO_READ) | ||
1959 | et61x251_release_buffers(cam); | ||
1960 | |||
1961 | err += et61x251_set_pix_format(cam, pix); | ||
1962 | err += et61x251_set_crop(cam, &rect); | ||
1963 | if (s->set_pix_format) | ||
1964 | err += s->set_pix_format(cam, pix); | ||
1965 | if (s->set_crop) | ||
1966 | err += s->set_crop(cam, &rect); | ||
1967 | err += et61x251_set_scale(cam, scale); | ||
1968 | |||
1969 | if (err) { /* atomic, no rollback in ioctl() */ | ||
1970 | cam->state |= DEV_MISCONFIGURED; | ||
1971 | DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To " | ||
1972 | "use the camera, close and open /dev/video%d again.", | ||
1973 | cam->v4ldev->minor); | ||
1974 | return -EIO; | ||
1975 | } | ||
1976 | |||
1977 | memcpy(pfmt, pix, sizeof(*pix)); | ||
1978 | memcpy(&(s->_rect), &rect, sizeof(rect)); | ||
1979 | |||
1980 | if ((cam->module_param.force_munmap || cam->io == IO_READ) && | ||
1981 | nbuffers != et61x251_request_buffers(cam, nbuffers, cam->io)) { | ||
1982 | cam->state |= DEV_MISCONFIGURED; | ||
1983 | DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To " | ||
1984 | "use the camera, close and open /dev/video%d again.", | ||
1985 | cam->v4ldev->minor); | ||
1986 | return -ENOMEM; | ||
1987 | } | ||
1988 | |||
1989 | if (cam->io == IO_READ) | ||
1990 | et61x251_empty_framequeues(cam); | ||
1991 | else if (cam->module_param.force_munmap) | ||
1992 | et61x251_requeue_outqueue(cam); | ||
1993 | |||
1994 | cam->stream = stream; | ||
1995 | |||
1996 | return 0; | ||
1997 | } | ||
1998 | |||
1999 | |||
2000 | static int | ||
2001 | et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg) | ||
2002 | { | ||
2003 | if (copy_to_user(arg, &cam->compression, | ||
2004 | sizeof(cam->compression))) | ||
2005 | return -EFAULT; | ||
2006 | |||
2007 | return 0; | ||
2008 | } | ||
2009 | |||
2010 | |||
2011 | static int | ||
2012 | et61x251_vidioc_s_jpegcomp(struct et61x251_device* cam, void __user * arg) | ||
2013 | { | ||
2014 | struct v4l2_jpegcompression jc; | ||
2015 | const enum et61x251_stream_state stream = cam->stream; | ||
2016 | int err = 0; | ||
2017 | |||
2018 | if (copy_from_user(&jc, arg, sizeof(jc))) | ||
2019 | return -EFAULT; | ||
2020 | |||
2021 | if (jc.quality != 0 && jc.quality != 1) | ||
2022 | return -EINVAL; | ||
2023 | |||
2024 | if (cam->stream == STREAM_ON) | ||
2025 | if ((err = et61x251_stream_interrupt(cam))) | ||
2026 | return err; | ||
2027 | |||
2028 | err += et61x251_set_compression(cam, &jc); | ||
2029 | if (err) { /* atomic, no rollback in ioctl() */ | ||
2030 | cam->state |= DEV_MISCONFIGURED; | ||
2031 | DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " | ||
2032 | "problems. To use the camera, close and open " | ||
2033 | "/dev/video%d again.", cam->v4ldev->minor); | ||
2034 | return -EIO; | ||
2035 | } | ||
2036 | |||
2037 | cam->compression.quality = jc.quality; | ||
2038 | |||
2039 | cam->stream = stream; | ||
2040 | |||
2041 | return 0; | ||
2042 | } | ||
2043 | |||
2044 | |||
2045 | static int | ||
2046 | et61x251_vidioc_reqbufs(struct et61x251_device* cam, void __user * arg) | ||
2047 | { | ||
2048 | struct v4l2_requestbuffers rb; | ||
2049 | u32 i; | ||
2050 | int err; | ||
2051 | |||
2052 | if (copy_from_user(&rb, arg, sizeof(rb))) | ||
2053 | return -EFAULT; | ||
2054 | |||
2055 | if (rb.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || | ||
2056 | rb.memory != V4L2_MEMORY_MMAP) | ||
2057 | return -EINVAL; | ||
2058 | |||
2059 | if (cam->io == IO_READ) { | ||
2060 | DBG(3, "Close and open the device again to choose the mmap " | ||
2061 | "I/O method"); | ||
2062 | return -EINVAL; | ||
2063 | } | ||
2064 | |||
2065 | for (i = 0; i < cam->nbuffers; i++) | ||
2066 | if (cam->frame[i].vma_use_count) { | ||
2067 | DBG(3, "VIDIOC_REQBUFS failed. " | ||
2068 | "Previous buffers are still mapped."); | ||
2069 | return -EINVAL; | ||
2070 | } | ||
2071 | |||
2072 | if (cam->stream == STREAM_ON) | ||
2073 | if ((err = et61x251_stream_interrupt(cam))) | ||
2074 | return err; | ||
2075 | |||
2076 | et61x251_empty_framequeues(cam); | ||
2077 | |||
2078 | et61x251_release_buffers(cam); | ||
2079 | if (rb.count) | ||
2080 | rb.count = et61x251_request_buffers(cam, rb.count, IO_MMAP); | ||
2081 | |||
2082 | if (copy_to_user(arg, &rb, sizeof(rb))) { | ||
2083 | et61x251_release_buffers(cam); | ||
2084 | cam->io = IO_NONE; | ||
2085 | return -EFAULT; | ||
2086 | } | ||
2087 | |||
2088 | cam->io = rb.count ? IO_MMAP : IO_NONE; | ||
2089 | |||
2090 | return 0; | ||
2091 | } | ||
2092 | |||
2093 | |||
2094 | static int | ||
2095 | et61x251_vidioc_querybuf(struct et61x251_device* cam, void __user * arg) | ||
2096 | { | ||
2097 | struct v4l2_buffer b; | ||
2098 | |||
2099 | if (copy_from_user(&b, arg, sizeof(b))) | ||
2100 | return -EFAULT; | ||
2101 | |||
2102 | if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || | ||
2103 | b.index >= cam->nbuffers || cam->io != IO_MMAP) | ||
2104 | return -EINVAL; | ||
2105 | |||
2106 | memcpy(&b, &cam->frame[b.index].buf, sizeof(b)); | ||
2107 | |||
2108 | if (cam->frame[b.index].vma_use_count) | ||
2109 | b.flags |= V4L2_BUF_FLAG_MAPPED; | ||
2110 | |||
2111 | if (cam->frame[b.index].state == F_DONE) | ||
2112 | b.flags |= V4L2_BUF_FLAG_DONE; | ||
2113 | else if (cam->frame[b.index].state != F_UNUSED) | ||
2114 | b.flags |= V4L2_BUF_FLAG_QUEUED; | ||
2115 | |||
2116 | if (copy_to_user(arg, &b, sizeof(b))) | ||
2117 | return -EFAULT; | ||
2118 | |||
2119 | return 0; | ||
2120 | } | ||
2121 | |||
2122 | |||
2123 | static int | ||
2124 | et61x251_vidioc_qbuf(struct et61x251_device* cam, void __user * arg) | ||
2125 | { | ||
2126 | struct v4l2_buffer b; | ||
2127 | unsigned long lock_flags; | ||
2128 | |||
2129 | if (copy_from_user(&b, arg, sizeof(b))) | ||
2130 | return -EFAULT; | ||
2131 | |||
2132 | if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || | ||
2133 | b.index >= cam->nbuffers || cam->io != IO_MMAP) | ||
2134 | return -EINVAL; | ||
2135 | |||
2136 | if (cam->frame[b.index].state != F_UNUSED) | ||
2137 | return -EINVAL; | ||
2138 | |||
2139 | cam->frame[b.index].state = F_QUEUED; | ||
2140 | |||
2141 | spin_lock_irqsave(&cam->queue_lock, lock_flags); | ||
2142 | list_add_tail(&cam->frame[b.index].frame, &cam->inqueue); | ||
2143 | spin_unlock_irqrestore(&cam->queue_lock, lock_flags); | ||
2144 | |||
2145 | PDBGG("Frame #%lu queued", (unsigned long)b.index); | ||
2146 | |||
2147 | return 0; | ||
2148 | } | ||
2149 | |||
2150 | |||
2151 | static int | ||
2152 | et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, | ||
2153 | void __user * arg) | ||
2154 | { | ||
2155 | struct v4l2_buffer b; | ||
2156 | struct et61x251_frame_t *f; | ||
2157 | unsigned long lock_flags; | ||
2158 | int err = 0; | ||
2159 | |||
2160 | if (copy_from_user(&b, arg, sizeof(b))) | ||
2161 | return -EFAULT; | ||
2162 | |||
2163 | if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io!= IO_MMAP) | ||
2164 | return -EINVAL; | ||
2165 | |||
2166 | if (list_empty(&cam->outqueue)) { | ||
2167 | if (cam->stream == STREAM_OFF) | ||
2168 | return -EINVAL; | ||
2169 | if (filp->f_flags & O_NONBLOCK) | ||
2170 | return -EAGAIN; | ||
2171 | err = wait_event_interruptible | ||
2172 | ( cam->wait_frame, | ||
2173 | (!list_empty(&cam->outqueue)) || | ||
2174 | (cam->state & DEV_DISCONNECTED) || | ||
2175 | (cam->state & DEV_MISCONFIGURED) ); | ||
2176 | if (err) | ||
2177 | return err; | ||
2178 | if (cam->state & DEV_DISCONNECTED) | ||
2179 | return -ENODEV; | ||
2180 | if (cam->state & DEV_MISCONFIGURED) | ||
2181 | return -EIO; | ||
2182 | } | ||
2183 | |||
2184 | spin_lock_irqsave(&cam->queue_lock, lock_flags); | ||
2185 | f = list_entry(cam->outqueue.next, struct et61x251_frame_t, frame); | ||
2186 | list_del(cam->outqueue.next); | ||
2187 | spin_unlock_irqrestore(&cam->queue_lock, lock_flags); | ||
2188 | |||
2189 | f->state = F_UNUSED; | ||
2190 | |||
2191 | memcpy(&b, &f->buf, sizeof(b)); | ||
2192 | if (f->vma_use_count) | ||
2193 | b.flags |= V4L2_BUF_FLAG_MAPPED; | ||
2194 | |||
2195 | if (copy_to_user(arg, &b, sizeof(b))) | ||
2196 | return -EFAULT; | ||
2197 | |||
2198 | PDBGG("Frame #%lu dequeued", (unsigned long)f->buf.index); | ||
2199 | |||
2200 | return 0; | ||
2201 | } | ||
2202 | |||
2203 | |||
2204 | static int | ||
2205 | et61x251_vidioc_streamon(struct et61x251_device* cam, void __user * arg) | ||
2206 | { | ||
2207 | int type; | ||
2208 | |||
2209 | if (copy_from_user(&type, arg, sizeof(type))) | ||
2210 | return -EFAULT; | ||
2211 | |||
2212 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) | ||
2213 | return -EINVAL; | ||
2214 | |||
2215 | if (list_empty(&cam->inqueue)) | ||
2216 | return -EINVAL; | ||
2217 | |||
2218 | cam->stream = STREAM_ON; | ||
2219 | |||
2220 | DBG(3, "Stream on"); | ||
2221 | |||
2222 | return 0; | ||
2223 | } | ||
2224 | |||
2225 | |||
2226 | static int | ||
2227 | et61x251_vidioc_streamoff(struct et61x251_device* cam, void __user * arg) | ||
2228 | { | ||
2229 | int type, err; | ||
2230 | |||
2231 | if (copy_from_user(&type, arg, sizeof(type))) | ||
2232 | return -EFAULT; | ||
2233 | |||
2234 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) | ||
2235 | return -EINVAL; | ||
2236 | |||
2237 | if (cam->stream == STREAM_ON) | ||
2238 | if ((err = et61x251_stream_interrupt(cam))) | ||
2239 | return err; | ||
2240 | |||
2241 | et61x251_empty_framequeues(cam); | ||
2242 | |||
2243 | DBG(3, "Stream off"); | ||
2244 | |||
2245 | return 0; | ||
2246 | } | ||
2247 | |||
2248 | |||
2249 | static int | ||
2250 | et61x251_vidioc_g_parm(struct et61x251_device* cam, void __user * arg) | ||
2251 | { | ||
2252 | struct v4l2_streamparm sp; | ||
2253 | |||
2254 | if (copy_from_user(&sp, arg, sizeof(sp))) | ||
2255 | return -EFAULT; | ||
2256 | |||
2257 | if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
2258 | return -EINVAL; | ||
2259 | |||
2260 | sp.parm.capture.extendedmode = 0; | ||
2261 | sp.parm.capture.readbuffers = cam->nreadbuffers; | ||
2262 | |||
2263 | if (copy_to_user(arg, &sp, sizeof(sp))) | ||
2264 | return -EFAULT; | ||
2265 | |||
2266 | return 0; | ||
2267 | } | ||
2268 | |||
2269 | |||
2270 | static int | ||
2271 | et61x251_vidioc_s_parm(struct et61x251_device* cam, void __user * arg) | ||
2272 | { | ||
2273 | struct v4l2_streamparm sp; | ||
2274 | |||
2275 | if (copy_from_user(&sp, arg, sizeof(sp))) | ||
2276 | return -EFAULT; | ||
2277 | |||
2278 | if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
2279 | return -EINVAL; | ||
2280 | |||
2281 | sp.parm.capture.extendedmode = 0; | ||
2282 | |||
2283 | if (sp.parm.capture.readbuffers == 0) | ||
2284 | sp.parm.capture.readbuffers = cam->nreadbuffers; | ||
2285 | |||
2286 | if (sp.parm.capture.readbuffers > ET61X251_MAX_FRAMES) | ||
2287 | sp.parm.capture.readbuffers = ET61X251_MAX_FRAMES; | ||
2288 | |||
2289 | if (copy_to_user(arg, &sp, sizeof(sp))) | ||
2290 | return -EFAULT; | ||
2291 | |||
2292 | cam->nreadbuffers = sp.parm.capture.readbuffers; | ||
2293 | |||
2294 | return 0; | ||
2295 | } | ||
2296 | |||
2297 | |||
2298 | static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, | ||
2299 | unsigned int cmd, void __user * arg) | ||
2300 | { | ||
2301 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | ||
2302 | |||
2303 | switch (cmd) { | ||
2304 | |||
2305 | case VIDIOC_QUERYCAP: | ||
2306 | return et61x251_vidioc_querycap(cam, arg); | ||
2307 | |||
2308 | case VIDIOC_ENUMINPUT: | ||
2309 | return et61x251_vidioc_enuminput(cam, arg); | ||
2310 | |||
2311 | case VIDIOC_G_INPUT: | ||
2312 | case VIDIOC_S_INPUT: | ||
2313 | return et61x251_vidioc_gs_input(cam, arg); | ||
2314 | |||
2315 | case VIDIOC_QUERYCTRL: | ||
2316 | return et61x251_vidioc_query_ctrl(cam, arg); | ||
2317 | |||
2318 | case VIDIOC_G_CTRL: | ||
2319 | return et61x251_vidioc_g_ctrl(cam, arg); | ||
2320 | |||
2321 | case VIDIOC_S_CTRL_OLD: | ||
2322 | case VIDIOC_S_CTRL: | ||
2323 | return et61x251_vidioc_s_ctrl(cam, arg); | ||
2324 | |||
2325 | case VIDIOC_CROPCAP_OLD: | ||
2326 | case VIDIOC_CROPCAP: | ||
2327 | return et61x251_vidioc_cropcap(cam, arg); | ||
2328 | |||
2329 | case VIDIOC_G_CROP: | ||
2330 | return et61x251_vidioc_g_crop(cam, arg); | ||
2331 | |||
2332 | case VIDIOC_S_CROP: | ||
2333 | return et61x251_vidioc_s_crop(cam, arg); | ||
2334 | |||
2335 | case VIDIOC_ENUM_FMT: | ||
2336 | return et61x251_vidioc_enum_fmt(cam, arg); | ||
2337 | |||
2338 | case VIDIOC_G_FMT: | ||
2339 | return et61x251_vidioc_g_fmt(cam, arg); | ||
2340 | |||
2341 | case VIDIOC_TRY_FMT: | ||
2342 | case VIDIOC_S_FMT: | ||
2343 | return et61x251_vidioc_try_s_fmt(cam, cmd, arg); | ||
2344 | |||
2345 | case VIDIOC_G_JPEGCOMP: | ||
2346 | return et61x251_vidioc_g_jpegcomp(cam, arg); | ||
2347 | |||
2348 | case VIDIOC_S_JPEGCOMP: | ||
2349 | return et61x251_vidioc_s_jpegcomp(cam, arg); | ||
2350 | |||
2351 | case VIDIOC_REQBUFS: | ||
2352 | return et61x251_vidioc_reqbufs(cam, arg); | ||
2353 | |||
2354 | case VIDIOC_QUERYBUF: | ||
2355 | return et61x251_vidioc_querybuf(cam, arg); | ||
2356 | |||
2357 | case VIDIOC_QBUF: | ||
2358 | return et61x251_vidioc_qbuf(cam, arg); | ||
2359 | |||
2360 | case VIDIOC_DQBUF: | ||
2361 | return et61x251_vidioc_dqbuf(cam, filp, arg); | ||
2362 | |||
2363 | case VIDIOC_STREAMON: | ||
2364 | return et61x251_vidioc_streamon(cam, arg); | ||
2365 | |||
2366 | case VIDIOC_STREAMOFF: | ||
2367 | return et61x251_vidioc_streamoff(cam, arg); | ||
2368 | |||
2369 | case VIDIOC_G_PARM: | ||
2370 | return et61x251_vidioc_g_parm(cam, arg); | ||
2371 | |||
2372 | case VIDIOC_S_PARM_OLD: | ||
2373 | case VIDIOC_S_PARM: | ||
2374 | return et61x251_vidioc_s_parm(cam, arg); | ||
2375 | |||
2376 | case VIDIOC_G_STD: | ||
2377 | case VIDIOC_S_STD: | ||
2378 | case VIDIOC_QUERYSTD: | ||
2379 | case VIDIOC_ENUMSTD: | ||
2380 | case VIDIOC_QUERYMENU: | ||
2381 | return -EINVAL; | ||
2382 | |||
2383 | default: | ||
2384 | return -EINVAL; | ||
2385 | |||
2386 | } | ||
2387 | } | ||
2388 | |||
2389 | |||
2390 | static int et61x251_ioctl(struct inode* inode, struct file* filp, | ||
2391 | unsigned int cmd, unsigned long arg) | ||
2392 | { | ||
2393 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | ||
2394 | int err = 0; | ||
2395 | |||
2396 | if (down_interruptible(&cam->fileop_sem)) | ||
2397 | return -ERESTARTSYS; | ||
2398 | |||
2399 | if (cam->state & DEV_DISCONNECTED) { | ||
2400 | DBG(1, "Device not present"); | ||
2401 | up(&cam->fileop_sem); | ||
2402 | return -ENODEV; | ||
2403 | } | ||
2404 | |||
2405 | if (cam->state & DEV_MISCONFIGURED) { | ||
2406 | DBG(1, "The camera is misconfigured. Close and open it " | ||
2407 | "again."); | ||
2408 | up(&cam->fileop_sem); | ||
2409 | return -EIO; | ||
2410 | } | ||
2411 | |||
2412 | V4LDBG(3, "et61x251", cmd); | ||
2413 | |||
2414 | err = et61x251_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); | ||
2415 | |||
2416 | up(&cam->fileop_sem); | ||
2417 | |||
2418 | return err; | ||
2419 | } | ||
2420 | |||
2421 | |||
2422 | static struct file_operations et61x251_fops = { | ||
2423 | .owner = THIS_MODULE, | ||
2424 | .open = et61x251_open, | ||
2425 | .release = et61x251_release, | ||
2426 | .ioctl = et61x251_ioctl, | ||
2427 | .read = et61x251_read, | ||
2428 | .poll = et61x251_poll, | ||
2429 | .mmap = et61x251_mmap, | ||
2430 | .llseek = no_llseek, | ||
2431 | }; | ||
2432 | |||
2433 | /*****************************************************************************/ | ||
2434 | |||
2435 | /* It exists a single interface only. We do not need to validate anything. */ | ||
2436 | static int | ||
2437 | et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | ||
2438 | { | ||
2439 | struct usb_device *udev = interface_to_usbdev(intf); | ||
2440 | struct et61x251_device* cam; | ||
2441 | static unsigned int dev_nr = 0; | ||
2442 | unsigned int i; | ||
2443 | int err = 0; | ||
2444 | |||
2445 | if (!(cam = kzalloc(sizeof(struct et61x251_device), GFP_KERNEL))) | ||
2446 | return -ENOMEM; | ||
2447 | |||
2448 | cam->usbdev = udev; | ||
2449 | |||
2450 | if (!(cam->control_buffer = kzalloc(8, GFP_KERNEL))) { | ||
2451 | DBG(1, "kmalloc() failed"); | ||
2452 | err = -ENOMEM; | ||
2453 | goto fail; | ||
2454 | } | ||
2455 | |||
2456 | if (!(cam->v4ldev = video_device_alloc())) { | ||
2457 | DBG(1, "video_device_alloc() failed"); | ||
2458 | err = -ENOMEM; | ||
2459 | goto fail; | ||
2460 | } | ||
2461 | |||
2462 | init_MUTEX(&cam->dev_sem); | ||
2463 | |||
2464 | DBG(2, "ET61X[12]51 PC Camera Controller detected " | ||
2465 | "(vid/pid 0x%04X/0x%04X)",id->idVendor, id->idProduct); | ||
2466 | |||
2467 | for (i = 0; et61x251_sensor_table[i]; i++) { | ||
2468 | err = et61x251_sensor_table[i](cam); | ||
2469 | if (!err) | ||
2470 | break; | ||
2471 | } | ||
2472 | |||
2473 | if (!err && cam->sensor) | ||
2474 | DBG(2, "%s image sensor detected", cam->sensor->name); | ||
2475 | else { | ||
2476 | DBG(1, "No supported image sensor detected"); | ||
2477 | err = -ENODEV; | ||
2478 | goto fail; | ||
2479 | } | ||
2480 | |||
2481 | if (et61x251_init(cam)) { | ||
2482 | DBG(1, "Initialization failed. I will retry on open()."); | ||
2483 | cam->state |= DEV_MISCONFIGURED; | ||
2484 | } | ||
2485 | |||
2486 | strcpy(cam->v4ldev->name, "ET61X[12]51 PC Camera"); | ||
2487 | cam->v4ldev->owner = THIS_MODULE; | ||
2488 | cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; | ||
2489 | cam->v4ldev->hardware = 0; | ||
2490 | cam->v4ldev->fops = &et61x251_fops; | ||
2491 | cam->v4ldev->minor = video_nr[dev_nr]; | ||
2492 | cam->v4ldev->release = video_device_release; | ||
2493 | video_set_drvdata(cam->v4ldev, cam); | ||
2494 | |||
2495 | down(&cam->dev_sem); | ||
2496 | |||
2497 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | ||
2498 | video_nr[dev_nr]); | ||
2499 | if (err) { | ||
2500 | DBG(1, "V4L2 device registration failed"); | ||
2501 | if (err == -ENFILE && video_nr[dev_nr] == -1) | ||
2502 | DBG(1, "Free /dev/videoX node not found"); | ||
2503 | video_nr[dev_nr] = -1; | ||
2504 | dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0; | ||
2505 | up(&cam->dev_sem); | ||
2506 | goto fail; | ||
2507 | } | ||
2508 | |||
2509 | DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); | ||
2510 | |||
2511 | cam->module_param.force_munmap = force_munmap[dev_nr]; | ||
2512 | |||
2513 | dev_nr = (dev_nr < ET61X251_MAX_DEVICES-1) ? dev_nr+1 : 0; | ||
2514 | |||
2515 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
2516 | et61x251_create_sysfs(cam); | ||
2517 | DBG(2, "Optional device control through 'sysfs' interface ready"); | ||
2518 | #endif | ||
2519 | |||
2520 | usb_set_intfdata(intf, cam); | ||
2521 | |||
2522 | up(&cam->dev_sem); | ||
2523 | |||
2524 | return 0; | ||
2525 | |||
2526 | fail: | ||
2527 | if (cam) { | ||
2528 | kfree(cam->control_buffer); | ||
2529 | if (cam->v4ldev) | ||
2530 | video_device_release(cam->v4ldev); | ||
2531 | kfree(cam); | ||
2532 | } | ||
2533 | return err; | ||
2534 | } | ||
2535 | |||
2536 | |||
2537 | static void et61x251_usb_disconnect(struct usb_interface* intf) | ||
2538 | { | ||
2539 | struct et61x251_device* cam = usb_get_intfdata(intf); | ||
2540 | |||
2541 | if (!cam) | ||
2542 | return; | ||
2543 | |||
2544 | down_write(&et61x251_disconnect); | ||
2545 | |||
2546 | down(&cam->dev_sem); | ||
2547 | |||
2548 | DBG(2, "Disconnecting %s...", cam->v4ldev->name); | ||
2549 | |||
2550 | wake_up_interruptible_all(&cam->open); | ||
2551 | |||
2552 | if (cam->users) { | ||
2553 | DBG(2, "Device /dev/video%d is open! Deregistration and " | ||
2554 | "memory deallocation are deferred on close.", | ||
2555 | cam->v4ldev->minor); | ||
2556 | cam->state |= DEV_MISCONFIGURED; | ||
2557 | et61x251_stop_transfer(cam); | ||
2558 | cam->state |= DEV_DISCONNECTED; | ||
2559 | wake_up_interruptible(&cam->wait_frame); | ||
2560 | wake_up_interruptible(&cam->wait_stream); | ||
2561 | } else { | ||
2562 | cam->state |= DEV_DISCONNECTED; | ||
2563 | et61x251_release_resources(cam); | ||
2564 | } | ||
2565 | |||
2566 | up(&cam->dev_sem); | ||
2567 | |||
2568 | if (!cam->users) | ||
2569 | kfree(cam); | ||
2570 | |||
2571 | up_write(&et61x251_disconnect); | ||
2572 | } | ||
2573 | |||
2574 | |||
2575 | static struct usb_driver et61x251_usb_driver = { | ||
2576 | .name = "et61x251", | ||
2577 | .id_table = et61x251_id_table, | ||
2578 | .probe = et61x251_usb_probe, | ||
2579 | .disconnect = et61x251_usb_disconnect, | ||
2580 | }; | ||
2581 | |||
2582 | /*****************************************************************************/ | ||
2583 | |||
2584 | static int __init et61x251_module_init(void) | ||
2585 | { | ||
2586 | int err = 0; | ||
2587 | |||
2588 | KDBG(2, ET61X251_MODULE_NAME " v" ET61X251_MODULE_VERSION); | ||
2589 | KDBG(3, ET61X251_MODULE_AUTHOR); | ||
2590 | |||
2591 | if ((err = usb_register(&et61x251_usb_driver))) | ||
2592 | KDBG(1, "usb_register() failed"); | ||
2593 | |||
2594 | return err; | ||
2595 | } | ||
2596 | |||
2597 | |||
2598 | static void __exit et61x251_module_exit(void) | ||
2599 | { | ||
2600 | usb_deregister(&et61x251_usb_driver); | ||
2601 | } | ||
2602 | |||
2603 | |||
2604 | module_init(et61x251_module_init); | ||
2605 | module_exit(et61x251_module_exit); | ||
diff --git a/drivers/usb/media/et61x251_sensor.h b/drivers/usb/media/et61x251_sensor.h new file mode 100644 index 000000000000..b9df91062fc0 --- /dev/null +++ b/drivers/usb/media/et61x251_sensor.h | |||
@@ -0,0 +1,115 @@ | |||
1 | /*************************************************************************** | ||
2 | * API for image sensors connected to ET61X[12]51 PC Camera Controllers * | ||
3 | * * | ||
4 | * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * | ||
5 | * * | ||
6 | * This program is free software; you can redistribute it and/or modify * | ||
7 | * it under the terms of the GNU General Public License as published by * | ||
8 | * the Free Software Foundation; either version 2 of the License, or * | ||
9 | * (at your option) any later version. * | ||
10 | * * | ||
11 | * This program is distributed in the hope that it will be useful, * | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
14 | * GNU General Public License for more details. * | ||
15 | * * | ||
16 | * You should have received a copy of the GNU General Public License * | ||
17 | * along with this program; if not, write to the Free Software * | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * | ||
19 | ***************************************************************************/ | ||
20 | |||
21 | #ifndef _ET61X251_SENSOR_H_ | ||
22 | #define _ET61X251_SENSOR_H_ | ||
23 | |||
24 | #include <linux/usb.h> | ||
25 | #include <linux/videodev.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/stddef.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <asm/types.h> | ||
30 | |||
31 | struct et61x251_device; | ||
32 | struct et61x251_sensor; | ||
33 | |||
34 | /*****************************************************************************/ | ||
35 | |||
36 | extern int et61x251_probe_tas5130d1b(struct et61x251_device* cam); | ||
37 | |||
38 | #define ET61X251_SENSOR_TABLE \ | ||
39 | /* Weak detections must go at the end of the list */ \ | ||
40 | static int (*et61x251_sensor_table[])(struct et61x251_device*) = { \ | ||
41 | &et61x251_probe_tas5130d1b, \ | ||
42 | NULL, \ | ||
43 | }; | ||
44 | |||
45 | extern void | ||
46 | et61x251_attach_sensor(struct et61x251_device* cam, | ||
47 | struct et61x251_sensor* sensor); | ||
48 | |||
49 | /*****************************************************************************/ | ||
50 | |||
51 | extern int et61x251_write_reg(struct et61x251_device*, u8 value, u16 index); | ||
52 | extern int et61x251_read_reg(struct et61x251_device*, u16 index); | ||
53 | extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value); | ||
54 | extern int et61x251_i2c_read(struct et61x251_device*, u8 address); | ||
55 | extern int et61x251_i2c_try_write(struct et61x251_device*, | ||
56 | struct et61x251_sensor*, u8 address, | ||
57 | u8 value); | ||
58 | extern int et61x251_i2c_try_read(struct et61x251_device*, | ||
59 | struct et61x251_sensor*, u8 address); | ||
60 | extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1, | ||
61 | u8 data2, u8 data3, u8 data4, u8 data5, | ||
62 | u8 data6, u8 data7, u8 data8, u8 address); | ||
63 | |||
64 | /*****************************************************************************/ | ||
65 | |||
66 | enum et61x251_i2c_sysfs_ops { | ||
67 | ET61X251_I2C_READ = 0x01, | ||
68 | ET61X251_I2C_WRITE = 0x02, | ||
69 | }; | ||
70 | |||
71 | enum et61x251_i2c_interface { | ||
72 | ET61X251_I2C_2WIRES, | ||
73 | ET61X251_I2C_3WIRES, | ||
74 | }; | ||
75 | |||
76 | /* Repeat start condition when RSTA is high */ | ||
77 | enum et61x251_i2c_rsta { | ||
78 | ET61X251_I2C_RSTA_STOP = 0x00, /* stop then start */ | ||
79 | ET61X251_I2C_RSTA_REPEAT = 0x01, /* repeat start */ | ||
80 | }; | ||
81 | |||
82 | #define ET61X251_MAX_CTRLS V4L2_CID_LASTP1-V4L2_CID_BASE+10 | ||
83 | |||
84 | struct et61x251_sensor { | ||
85 | char name[32]; | ||
86 | |||
87 | enum et61x251_i2c_sysfs_ops sysfs_ops; | ||
88 | |||
89 | enum et61x251_i2c_interface interface; | ||
90 | u8 i2c_slave_id; | ||
91 | enum et61x251_i2c_rsta rsta; | ||
92 | struct v4l2_rect active_pixel; /* left and top define FVSX and FVSY */ | ||
93 | |||
94 | struct v4l2_queryctrl qctrl[ET61X251_MAX_CTRLS]; | ||
95 | struct v4l2_cropcap cropcap; | ||
96 | struct v4l2_pix_format pix_format; | ||
97 | |||
98 | int (*init)(struct et61x251_device* cam); | ||
99 | int (*get_ctrl)(struct et61x251_device* cam, | ||
100 | struct v4l2_control* ctrl); | ||
101 | int (*set_ctrl)(struct et61x251_device* cam, | ||
102 | const struct v4l2_control* ctrl); | ||
103 | int (*set_crop)(struct et61x251_device* cam, | ||
104 | const struct v4l2_rect* rect); | ||
105 | int (*set_pix_format)(struct et61x251_device* cam, | ||
106 | const struct v4l2_pix_format* pix); | ||
107 | |||
108 | const struct usb_device* usbdev; | ||
109 | |||
110 | /* Private */ | ||
111 | struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS]; | ||
112 | struct v4l2_rect _rect; | ||
113 | }; | ||
114 | |||
115 | #endif /* _ET61X251_SENSOR_H_ */ | ||
diff --git a/drivers/usb/media/et61x251_tas5130d1b.c b/drivers/usb/media/et61x251_tas5130d1b.c new file mode 100644 index 000000000000..65f1ae9cf2b3 --- /dev/null +++ b/drivers/usb/media/et61x251_tas5130d1b.c | |||
@@ -0,0 +1,137 @@ | |||
1 | /*************************************************************************** | ||
2 | * Plug-in for TAS5130D1B image sensor connected to the ET61X[12]51 * | ||
3 | * PC Camera Controllers * | ||
4 | * * | ||
5 | * Copyright (C) 2006 by Luca Risolia <luca.risolia@studio.unibo.it> * | ||
6 | * * | ||
7 | * This program is free software; you can redistribute it and/or modify * | ||
8 | * it under the terms of the GNU General Public License as published by * | ||
9 | * the Free Software Foundation; either version 2 of the License, or * | ||
10 | * (at your option) any later version. * | ||
11 | * * | ||
12 | * This program is distributed in the hope that it will be useful, * | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
15 | * GNU General Public License for more details. * | ||
16 | * * | ||
17 | * You should have received a copy of the GNU General Public License * | ||
18 | * along with this program; if not, write to the Free Software * | ||
19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * | ||
20 | ***************************************************************************/ | ||
21 | |||
22 | #include "et61x251_sensor.h" | ||
23 | |||
24 | |||
25 | static int tas5130d1b_init(struct et61x251_device* cam) | ||
26 | { | ||
27 | int err = 0; | ||
28 | |||
29 | err += et61x251_write_reg(cam, 0x14, 0x01); | ||
30 | err += et61x251_write_reg(cam, 0x1b, 0x02); | ||
31 | err += et61x251_write_reg(cam, 0x02, 0x12); | ||
32 | err += et61x251_write_reg(cam, 0x0e, 0x60); | ||
33 | err += et61x251_write_reg(cam, 0x80, 0x61); | ||
34 | err += et61x251_write_reg(cam, 0xf0, 0x62); | ||
35 | err += et61x251_write_reg(cam, 0x03, 0x63); | ||
36 | err += et61x251_write_reg(cam, 0x14, 0x64); | ||
37 | err += et61x251_write_reg(cam, 0xf4, 0x65); | ||
38 | err += et61x251_write_reg(cam, 0x01, 0x66); | ||
39 | err += et61x251_write_reg(cam, 0x05, 0x67); | ||
40 | err += et61x251_write_reg(cam, 0x8f, 0x68); | ||
41 | err += et61x251_write_reg(cam, 0x0f, 0x8d); | ||
42 | err += et61x251_write_reg(cam, 0x08, 0x8e); | ||
43 | |||
44 | return err; | ||
45 | } | ||
46 | |||
47 | |||
48 | static int tas5130d1b_set_ctrl(struct et61x251_device* cam, | ||
49 | const struct v4l2_control* ctrl) | ||
50 | { | ||
51 | int err = 0; | ||
52 | |||
53 | switch (ctrl->id) { | ||
54 | case V4L2_CID_GAIN: | ||
55 | err += et61x251_i2c_raw_write(cam, 2, 0x20, | ||
56 | 0xf6-ctrl->value, 0, 0, 0, | ||
57 | 0, 0, 0, 0); | ||
58 | break; | ||
59 | case V4L2_CID_EXPOSURE: | ||
60 | err += et61x251_i2c_raw_write(cam, 2, 0x40, | ||
61 | 0x47-ctrl->value, 0, 0, 0, | ||
62 | 0, 0, 0, 0); | ||
63 | break; | ||
64 | default: | ||
65 | return -EINVAL; | ||
66 | } | ||
67 | |||
68 | return err ? -EIO : 0; | ||
69 | } | ||
70 | |||
71 | |||
72 | static struct et61x251_sensor tas5130d1b = { | ||
73 | .name = "TAS5130D1B", | ||
74 | .interface = ET61X251_I2C_3WIRES, | ||
75 | .rsta = ET61X251_I2C_RSTA_STOP, | ||
76 | .active_pixel = { | ||
77 | .left = 106, | ||
78 | .top = 13, | ||
79 | }, | ||
80 | .init = &tas5130d1b_init, | ||
81 | .qctrl = { | ||
82 | { | ||
83 | .id = V4L2_CID_GAIN, | ||
84 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
85 | .name = "global gain", | ||
86 | .minimum = 0x00, | ||
87 | .maximum = 0xf6, | ||
88 | .step = 0x02, | ||
89 | .default_value = 0x0d, | ||
90 | .flags = 0, | ||
91 | }, | ||
92 | { | ||
93 | .id = V4L2_CID_EXPOSURE, | ||
94 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
95 | .name = "exposure", | ||
96 | .minimum = 0x00, | ||
97 | .maximum = 0x47, | ||
98 | .step = 0x01, | ||
99 | .default_value = 0x23, | ||
100 | .flags = 0, | ||
101 | }, | ||
102 | }, | ||
103 | .set_ctrl = &tas5130d1b_set_ctrl, | ||
104 | .cropcap = { | ||
105 | .bounds = { | ||
106 | .left = 0, | ||
107 | .top = 0, | ||
108 | .width = 640, | ||
109 | .height = 480, | ||
110 | }, | ||
111 | .defrect = { | ||
112 | .left = 0, | ||
113 | .top = 0, | ||
114 | .width = 640, | ||
115 | .height = 480, | ||
116 | }, | ||
117 | }, | ||
118 | .pix_format = { | ||
119 | .width = 640, | ||
120 | .height = 480, | ||
121 | .pixelformat = V4L2_PIX_FMT_SBGGR8, | ||
122 | .priv = 8, | ||
123 | }, | ||
124 | }; | ||
125 | |||
126 | |||
127 | int et61x251_probe_tas5130d1b(struct et61x251_device* cam) | ||
128 | { | ||
129 | /* This sensor has no identifiers, so let's attach it anyway */ | ||
130 | et61x251_attach_sensor(cam, &tas5130d1b); | ||
131 | |||
132 | /* Sensor detection is based on USB pid/vid */ | ||
133 | if (le16_to_cpu(tas5130d1b.usbdev->descriptor.idProduct) != 0x6251) | ||
134 | return -ENODEV; | ||
135 | |||
136 | return 0; | ||
137 | } | ||
diff --git a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c index 8af665bbe330..51e9cc06f7e3 100644 --- a/drivers/usb/media/ov511.c +++ b/drivers/usb/media/ov511.c | |||
@@ -204,22 +204,10 @@ MODULE_LICENSE("GPL"); | |||
204 | 204 | ||
205 | static struct usb_driver ov511_driver; | 205 | static struct usb_driver ov511_driver; |
206 | 206 | ||
207 | static struct ov51x_decomp_ops *ov511_decomp_ops; | ||
208 | static struct ov51x_decomp_ops *ov511_mmx_decomp_ops; | ||
209 | static struct ov51x_decomp_ops *ov518_decomp_ops; | ||
210 | static struct ov51x_decomp_ops *ov518_mmx_decomp_ops; | ||
211 | |||
212 | /* Number of times to retry a failed I2C transaction. Increase this if you | 207 | /* Number of times to retry a failed I2C transaction. Increase this if you |
213 | * are getting "Failed to read sensor ID..." */ | 208 | * are getting "Failed to read sensor ID..." */ |
214 | static const int i2c_detect_tries = 5; | 209 | static const int i2c_detect_tries = 5; |
215 | 210 | ||
216 | /* MMX support is present in kernel and CPU. Checked upon decomp module load. */ | ||
217 | #if defined(__i386__) || defined(__x86_64__) | ||
218 | #define ov51x_mmx_available (cpu_has_mmx) | ||
219 | #else | ||
220 | #define ov51x_mmx_available (0) | ||
221 | #endif | ||
222 | |||
223 | static struct usb_device_id device_table [] = { | 211 | static struct usb_device_id device_table [] = { |
224 | { USB_DEVICE(VEND_OMNIVISION, PROD_OV511) }, | 212 | { USB_DEVICE(VEND_OMNIVISION, PROD_OV511) }, |
225 | { USB_DEVICE(VEND_OMNIVISION, PROD_OV511PLUS) }, | 213 | { USB_DEVICE(VEND_OMNIVISION, PROD_OV511PLUS) }, |
@@ -3012,93 +3000,18 @@ yuv420raw_to_yuv420p(struct ov511_frame *frame, | |||
3012 | * | 3000 | * |
3013 | **********************************************************************/ | 3001 | **********************************************************************/ |
3014 | 3002 | ||
3015 | /* Chooses a decompression module, locks it, and sets ov->decomp_ops | ||
3016 | * accordingly. Returns -ENXIO if decompressor is not available, otherwise | ||
3017 | * returns 0 if no other error. | ||
3018 | */ | ||
3019 | static int | 3003 | static int |
3020 | request_decompressor(struct usb_ov511 *ov) | 3004 | request_decompressor(struct usb_ov511 *ov) |
3021 | { | 3005 | { |
3022 | if (!ov) | 3006 | if (ov->bclass == BCL_OV511 || ov->bclass == BCL_OV518) { |
3023 | return -ENODEV; | 3007 | err("No decompressor available"); |
3024 | |||
3025 | if (ov->decomp_ops) { | ||
3026 | err("ERROR: Decompressor already requested!"); | ||
3027 | return -EINVAL; | ||
3028 | } | ||
3029 | |||
3030 | lock_kernel(); | ||
3031 | |||
3032 | /* Try to get MMX, and fall back on no-MMX if necessary */ | ||
3033 | if (ov->bclass == BCL_OV511) { | ||
3034 | if (ov511_mmx_decomp_ops) { | ||
3035 | PDEBUG(3, "Using OV511 MMX decompressor"); | ||
3036 | ov->decomp_ops = ov511_mmx_decomp_ops; | ||
3037 | } else if (ov511_decomp_ops) { | ||
3038 | PDEBUG(3, "Using OV511 decompressor"); | ||
3039 | ov->decomp_ops = ov511_decomp_ops; | ||
3040 | } else { | ||
3041 | err("No decompressor available"); | ||
3042 | } | ||
3043 | } else if (ov->bclass == BCL_OV518) { | ||
3044 | if (ov518_mmx_decomp_ops) { | ||
3045 | PDEBUG(3, "Using OV518 MMX decompressor"); | ||
3046 | ov->decomp_ops = ov518_mmx_decomp_ops; | ||
3047 | } else if (ov518_decomp_ops) { | ||
3048 | PDEBUG(3, "Using OV518 decompressor"); | ||
3049 | ov->decomp_ops = ov518_decomp_ops; | ||
3050 | } else { | ||
3051 | err("No decompressor available"); | ||
3052 | } | ||
3053 | } else { | 3008 | } else { |
3054 | err("Unknown bridge"); | 3009 | err("Unknown bridge"); |
3055 | } | 3010 | } |
3056 | 3011 | ||
3057 | if (!ov->decomp_ops) | ||
3058 | goto nosys; | ||
3059 | |||
3060 | if (!ov->decomp_ops->owner) { | ||
3061 | ov->decomp_ops = NULL; | ||
3062 | goto nosys; | ||
3063 | } | ||
3064 | |||
3065 | if (!try_module_get(ov->decomp_ops->owner)) | ||
3066 | goto nosys; | ||
3067 | |||
3068 | unlock_kernel(); | ||
3069 | return 0; | ||
3070 | |||
3071 | nosys: | ||
3072 | unlock_kernel(); | ||
3073 | return -ENOSYS; | 3012 | return -ENOSYS; |
3074 | } | 3013 | } |
3075 | 3014 | ||
3076 | /* Unlocks decompression module and nulls ov->decomp_ops. Safe to call even | ||
3077 | * if ov->decomp_ops is NULL. | ||
3078 | */ | ||
3079 | static void | ||
3080 | release_decompressor(struct usb_ov511 *ov) | ||
3081 | { | ||
3082 | int released = 0; /* Did we actually do anything? */ | ||
3083 | |||
3084 | if (!ov) | ||
3085 | return; | ||
3086 | |||
3087 | lock_kernel(); | ||
3088 | |||
3089 | if (ov->decomp_ops) { | ||
3090 | module_put(ov->decomp_ops->owner); | ||
3091 | released = 1; | ||
3092 | } | ||
3093 | |||
3094 | ov->decomp_ops = NULL; | ||
3095 | |||
3096 | unlock_kernel(); | ||
3097 | |||
3098 | if (released) | ||
3099 | PDEBUG(3, "Decompressor released"); | ||
3100 | } | ||
3101 | |||
3102 | static void | 3015 | static void |
3103 | decompress(struct usb_ov511 *ov, struct ov511_frame *frame, | 3016 | decompress(struct usb_ov511 *ov, struct ov511_frame *frame, |
3104 | unsigned char *pIn0, unsigned char *pOut0) | 3017 | unsigned char *pIn0, unsigned char *pOut0) |
@@ -3107,31 +3020,6 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame, | |||
3107 | if (request_decompressor(ov)) | 3020 | if (request_decompressor(ov)) |
3108 | return; | 3021 | return; |
3109 | 3022 | ||
3110 | PDEBUG(4, "Decompressing %d bytes", frame->bytes_recvd); | ||
3111 | |||
3112 | if (frame->format == VIDEO_PALETTE_GREY | ||
3113 | && ov->decomp_ops->decomp_400) { | ||
3114 | int ret = ov->decomp_ops->decomp_400( | ||
3115 | pIn0, | ||
3116 | pOut0, | ||
3117 | frame->compbuf, | ||
3118 | frame->rawwidth, | ||
3119 | frame->rawheight, | ||
3120 | frame->bytes_recvd); | ||
3121 | PDEBUG(4, "DEBUG: decomp_400 returned %d", ret); | ||
3122 | } else if (frame->format != VIDEO_PALETTE_GREY | ||
3123 | && ov->decomp_ops->decomp_420) { | ||
3124 | int ret = ov->decomp_ops->decomp_420( | ||
3125 | pIn0, | ||
3126 | pOut0, | ||
3127 | frame->compbuf, | ||
3128 | frame->rawwidth, | ||
3129 | frame->rawheight, | ||
3130 | frame->bytes_recvd); | ||
3131 | PDEBUG(4, "DEBUG: decomp_420 returned %d", ret); | ||
3132 | } else { | ||
3133 | err("Decompressor does not support this format"); | ||
3134 | } | ||
3135 | } | 3023 | } |
3136 | 3024 | ||
3137 | /********************************************************************** | 3025 | /********************************************************************** |
@@ -4087,8 +3975,6 @@ ov51x_v4l1_close(struct inode *inode, struct file *file) | |||
4087 | ov->user--; | 3975 | ov->user--; |
4088 | ov51x_stop_isoc(ov); | 3976 | ov51x_stop_isoc(ov); |
4089 | 3977 | ||
4090 | release_decompressor(ov); | ||
4091 | |||
4092 | if (ov->led_policy == LED_AUTO) | 3978 | if (ov->led_policy == LED_AUTO) |
4093 | ov51x_led_control(ov, 0); | 3979 | ov51x_led_control(ov, 0); |
4094 | 3980 | ||
@@ -6021,82 +5907,6 @@ static struct usb_driver ov511_driver = { | |||
6021 | * | 5907 | * |
6022 | ***************************************************************************/ | 5908 | ***************************************************************************/ |
6023 | 5909 | ||
6024 | /* Returns 0 for success */ | ||
6025 | int | ||
6026 | ov511_register_decomp_module(int ver, struct ov51x_decomp_ops *ops, int ov518, | ||
6027 | int mmx) | ||
6028 | { | ||
6029 | if (ver != DECOMP_INTERFACE_VER) { | ||
6030 | err("Decompression module has incompatible"); | ||
6031 | err("interface version %d", ver); | ||
6032 | err("Interface version %d is required", DECOMP_INTERFACE_VER); | ||
6033 | return -EINVAL; | ||
6034 | } | ||
6035 | |||
6036 | if (!ops) | ||
6037 | return -EFAULT; | ||
6038 | |||
6039 | if (mmx && !ov51x_mmx_available) { | ||
6040 | err("MMX not available on this system or kernel"); | ||
6041 | return -EINVAL; | ||
6042 | } | ||
6043 | |||
6044 | lock_kernel(); | ||
6045 | |||
6046 | if (ov518) { | ||
6047 | if (mmx) { | ||
6048 | if (ov518_mmx_decomp_ops) | ||
6049 | goto err_in_use; | ||
6050 | else | ||
6051 | ov518_mmx_decomp_ops = ops; | ||
6052 | } else { | ||
6053 | if (ov518_decomp_ops) | ||
6054 | goto err_in_use; | ||
6055 | else | ||
6056 | ov518_decomp_ops = ops; | ||
6057 | } | ||
6058 | } else { | ||
6059 | if (mmx) { | ||
6060 | if (ov511_mmx_decomp_ops) | ||
6061 | goto err_in_use; | ||
6062 | else | ||
6063 | ov511_mmx_decomp_ops = ops; | ||
6064 | } else { | ||
6065 | if (ov511_decomp_ops) | ||
6066 | goto err_in_use; | ||
6067 | else | ||
6068 | ov511_decomp_ops = ops; | ||
6069 | } | ||
6070 | } | ||
6071 | |||
6072 | unlock_kernel(); | ||
6073 | return 0; | ||
6074 | |||
6075 | err_in_use: | ||
6076 | unlock_kernel(); | ||
6077 | return -EBUSY; | ||
6078 | } | ||
6079 | |||
6080 | void | ||
6081 | ov511_deregister_decomp_module(int ov518, int mmx) | ||
6082 | { | ||
6083 | lock_kernel(); | ||
6084 | |||
6085 | if (ov518) { | ||
6086 | if (mmx) | ||
6087 | ov518_mmx_decomp_ops = NULL; | ||
6088 | else | ||
6089 | ov518_decomp_ops = NULL; | ||
6090 | } else { | ||
6091 | if (mmx) | ||
6092 | ov511_mmx_decomp_ops = NULL; | ||
6093 | else | ||
6094 | ov511_decomp_ops = NULL; | ||
6095 | } | ||
6096 | |||
6097 | unlock_kernel(); | ||
6098 | } | ||
6099 | |||
6100 | static int __init | 5910 | static int __init |
6101 | usb_ov511_init(void) | 5911 | usb_ov511_init(void) |
6102 | { | 5912 | { |
@@ -6123,5 +5933,3 @@ usb_ov511_exit(void) | |||
6123 | module_init(usb_ov511_init); | 5933 | module_init(usb_ov511_init); |
6124 | module_exit(usb_ov511_exit); | 5934 | module_exit(usb_ov511_exit); |
6125 | 5935 | ||
6126 | EXPORT_SYMBOL(ov511_register_decomp_module); | ||
6127 | EXPORT_SYMBOL(ov511_deregister_decomp_module); | ||
diff --git a/drivers/usb/media/pwc/pwc-ctrl.c b/drivers/usb/media/pwc/pwc-ctrl.c index 359c4b2df735..3ebb6e9cdf92 100644 --- a/drivers/usb/media/pwc/pwc-ctrl.c +++ b/drivers/usb/media/pwc/pwc-ctrl.c | |||
@@ -1152,45 +1152,6 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) | |||
1152 | /* End of Add-Ons */ | 1152 | /* End of Add-Ons */ |
1153 | /* ************************************************* */ | 1153 | /* ************************************************* */ |
1154 | 1154 | ||
1155 | /* Linux 2.5.something and 2.6 pass direct pointers to arguments of | ||
1156 | ioctl() calls. With 2.4, you have to do tedious copy_from_user() | ||
1157 | and copy_to_user() calls. With these macros we circumvent this, | ||
1158 | and let me maintain only one source file. The functionality is | ||
1159 | exactly the same otherwise. | ||
1160 | */ | ||
1161 | |||
1162 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) | ||
1163 | |||
1164 | /* define local variable for arg */ | ||
1165 | #define ARG_DEF(ARG_type, ARG_name)\ | ||
1166 | ARG_type *ARG_name = arg; | ||
1167 | /* copy arg to local variable */ | ||
1168 | #define ARG_IN(ARG_name) /* nothing */ | ||
1169 | /* argument itself (referenced) */ | ||
1170 | #define ARGR(ARG_name) (*ARG_name) | ||
1171 | /* argument address */ | ||
1172 | #define ARGA(ARG_name) ARG_name | ||
1173 | /* copy local variable to arg */ | ||
1174 | #define ARG_OUT(ARG_name) /* nothing */ | ||
1175 | |||
1176 | #else | ||
1177 | |||
1178 | #define ARG_DEF(ARG_type, ARG_name)\ | ||
1179 | ARG_type ARG_name; | ||
1180 | #define ARG_IN(ARG_name)\ | ||
1181 | if (copy_from_user(&ARG_name, arg, sizeof(ARG_name))) {\ | ||
1182 | ret = -EFAULT;\ | ||
1183 | break;\ | ||
1184 | } | ||
1185 | #define ARGR(ARG_name) ARG_name | ||
1186 | #define ARGA(ARG_name) &ARG_name | ||
1187 | #define ARG_OUT(ARG_name)\ | ||
1188 | if (copy_to_user(arg, &ARG_name, sizeof(ARG_name))) {\ | ||
1189 | ret = -EFAULT;\ | ||
1190 | break;\ | ||
1191 | } | ||
1192 | |||
1193 | #endif | ||
1194 | 1155 | ||
1195 | int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | 1156 | int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) |
1196 | { | 1157 | { |
@@ -1220,243 +1181,206 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1220 | 1181 | ||
1221 | case VIDIOCPWCSCQUAL: | 1182 | case VIDIOCPWCSCQUAL: |
1222 | { | 1183 | { |
1223 | ARG_DEF(int, qual) | 1184 | int *qual = arg; |
1224 | 1185 | ||
1225 | ARG_IN(qual) | 1186 | if (*qual < 0 || *qual > 3) |
1226 | if (ARGR(qual) < 0 || ARGR(qual) > 3) | ||
1227 | ret = -EINVAL; | 1187 | ret = -EINVAL; |
1228 | else | 1188 | else |
1229 | ret = pwc_try_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, ARGR(qual), pdev->vsnapshot); | 1189 | ret = pwc_try_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, *qual, pdev->vsnapshot); |
1230 | if (ret >= 0) | 1190 | if (ret >= 0) |
1231 | pdev->vcompression = ARGR(qual); | 1191 | pdev->vcompression = *qual; |
1232 | break; | 1192 | break; |
1233 | } | 1193 | } |
1234 | 1194 | ||
1235 | case VIDIOCPWCGCQUAL: | 1195 | case VIDIOCPWCGCQUAL: |
1236 | { | 1196 | { |
1237 | ARG_DEF(int, qual) | 1197 | int *qual = arg; |
1238 | 1198 | *qual = pdev->vcompression; | |
1239 | ARGR(qual) = pdev->vcompression; | ||
1240 | ARG_OUT(qual) | ||
1241 | break; | 1199 | break; |
1242 | } | 1200 | } |
1243 | 1201 | ||
1244 | case VIDIOCPWCPROBE: | 1202 | case VIDIOCPWCPROBE: |
1245 | { | 1203 | { |
1246 | ARG_DEF(struct pwc_probe, probe) | 1204 | struct pwc_probe *probe = arg; |
1247 | 1205 | strcpy(probe->name, pdev->vdev->name); | |
1248 | strcpy(ARGR(probe).name, pdev->vdev->name); | 1206 | probe->type = pdev->type; |
1249 | ARGR(probe).type = pdev->type; | ||
1250 | ARG_OUT(probe) | ||
1251 | break; | 1207 | break; |
1252 | } | 1208 | } |
1253 | 1209 | ||
1254 | case VIDIOCPWCGSERIAL: | 1210 | case VIDIOCPWCGSERIAL: |
1255 | { | 1211 | { |
1256 | ARG_DEF(struct pwc_serial, serial) | 1212 | struct pwc_serial *serial = arg; |
1257 | 1213 | strcpy(serial->serial, pdev->serial); | |
1258 | strcpy(ARGR(serial).serial, pdev->serial); | ||
1259 | ARG_OUT(serial) | ||
1260 | break; | 1214 | break; |
1261 | } | 1215 | } |
1262 | 1216 | ||
1263 | case VIDIOCPWCSAGC: | 1217 | case VIDIOCPWCSAGC: |
1264 | { | 1218 | { |
1265 | ARG_DEF(int, agc) | 1219 | int *agc = arg; |
1266 | 1220 | if (pwc_set_agc(pdev, *agc < 0 ? 1 : 0, *agc)) | |
1267 | ARG_IN(agc) | ||
1268 | if (pwc_set_agc(pdev, ARGR(agc) < 0 ? 1 : 0, ARGR(agc))) | ||
1269 | ret = -EINVAL; | 1221 | ret = -EINVAL; |
1270 | break; | 1222 | break; |
1271 | } | 1223 | } |
1272 | 1224 | ||
1273 | case VIDIOCPWCGAGC: | 1225 | case VIDIOCPWCGAGC: |
1274 | { | 1226 | { |
1275 | ARG_DEF(int, agc) | 1227 | int *agc = arg; |
1276 | 1228 | ||
1277 | if (pwc_get_agc(pdev, ARGA(agc))) | 1229 | if (pwc_get_agc(pdev, agc)) |
1278 | ret = -EINVAL; | 1230 | ret = -EINVAL; |
1279 | ARG_OUT(agc) | ||
1280 | break; | 1231 | break; |
1281 | } | 1232 | } |
1282 | 1233 | ||
1283 | case VIDIOCPWCSSHUTTER: | 1234 | case VIDIOCPWCSSHUTTER: |
1284 | { | 1235 | { |
1285 | ARG_DEF(int, shutter_speed) | 1236 | int *shutter_speed = arg; |
1286 | 1237 | ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed); | |
1287 | ARG_IN(shutter_speed) | ||
1288 | ret = pwc_set_shutter_speed(pdev, ARGR(shutter_speed) < 0 ? 1 : 0, ARGR(shutter_speed)); | ||
1289 | break; | 1238 | break; |
1290 | } | 1239 | } |
1291 | 1240 | ||
1292 | case VIDIOCPWCSAWB: | 1241 | case VIDIOCPWCSAWB: |
1293 | { | 1242 | { |
1294 | ARG_DEF(struct pwc_whitebalance, wb) | 1243 | struct pwc_whitebalance *wb = arg; |
1295 | 1244 | ||
1296 | ARG_IN(wb) | 1245 | ret = pwc_set_awb(pdev, wb->mode); |
1297 | ret = pwc_set_awb(pdev, ARGR(wb).mode); | 1246 | if (ret >= 0 && wb->mode == PWC_WB_MANUAL) { |
1298 | if (ret >= 0 && ARGR(wb).mode == PWC_WB_MANUAL) { | 1247 | pwc_set_red_gain(pdev, wb->manual_red); |
1299 | pwc_set_red_gain(pdev, ARGR(wb).manual_red); | 1248 | pwc_set_blue_gain(pdev, wb->manual_blue); |
1300 | pwc_set_blue_gain(pdev, ARGR(wb).manual_blue); | ||
1301 | } | 1249 | } |
1302 | break; | 1250 | break; |
1303 | } | 1251 | } |
1304 | 1252 | ||
1305 | case VIDIOCPWCGAWB: | 1253 | case VIDIOCPWCGAWB: |
1306 | { | 1254 | { |
1307 | ARG_DEF(struct pwc_whitebalance, wb) | 1255 | struct pwc_whitebalance *wb = arg; |
1308 | 1256 | ||
1309 | memset(ARGA(wb), 0, sizeof(struct pwc_whitebalance)); | 1257 | memset(wb, 0, sizeof(struct pwc_whitebalance)); |
1310 | ARGR(wb).mode = pwc_get_awb(pdev); | 1258 | wb->mode = pwc_get_awb(pdev); |
1311 | if (ARGR(wb).mode < 0) | 1259 | if (wb->mode < 0) |
1312 | ret = -EINVAL; | 1260 | ret = -EINVAL; |
1313 | else { | 1261 | else { |
1314 | if (ARGR(wb).mode == PWC_WB_MANUAL) { | 1262 | if (wb->mode == PWC_WB_MANUAL) { |
1315 | ret = pwc_get_red_gain(pdev, &ARGR(wb).manual_red); | 1263 | ret = pwc_get_red_gain(pdev, &wb->manual_red); |
1316 | if (ret < 0) | 1264 | if (ret < 0) |
1317 | break; | 1265 | break; |
1318 | ret = pwc_get_blue_gain(pdev, &ARGR(wb).manual_blue); | 1266 | ret = pwc_get_blue_gain(pdev, &wb->manual_blue); |
1319 | if (ret < 0) | 1267 | if (ret < 0) |
1320 | break; | 1268 | break; |
1321 | } | 1269 | } |
1322 | if (ARGR(wb).mode == PWC_WB_AUTO) { | 1270 | if (wb->mode == PWC_WB_AUTO) { |
1323 | ret = pwc_read_red_gain(pdev, &ARGR(wb).read_red); | 1271 | ret = pwc_read_red_gain(pdev, &wb->read_red); |
1324 | if (ret < 0) | 1272 | if (ret < 0) |
1325 | break; | 1273 | break; |
1326 | ret =pwc_read_blue_gain(pdev, &ARGR(wb).read_blue); | 1274 | ret = pwc_read_blue_gain(pdev, &wb->read_blue); |
1327 | if (ret < 0) | 1275 | if (ret < 0) |
1328 | break; | 1276 | break; |
1329 | } | 1277 | } |
1330 | } | 1278 | } |
1331 | ARG_OUT(wb) | ||
1332 | break; | 1279 | break; |
1333 | } | 1280 | } |
1334 | 1281 | ||
1335 | case VIDIOCPWCSAWBSPEED: | 1282 | case VIDIOCPWCSAWBSPEED: |
1336 | { | 1283 | { |
1337 | ARG_DEF(struct pwc_wb_speed, wbs) | 1284 | struct pwc_wb_speed *wbs = arg; |
1338 | 1285 | ||
1339 | if (ARGR(wbs).control_speed > 0) { | 1286 | if (wbs->control_speed > 0) { |
1340 | ret = pwc_set_wb_speed(pdev, ARGR(wbs).control_speed); | 1287 | ret = pwc_set_wb_speed(pdev, wbs->control_speed); |
1341 | } | 1288 | } |
1342 | if (ARGR(wbs).control_delay > 0) { | 1289 | if (wbs->control_delay > 0) { |
1343 | ret = pwc_set_wb_delay(pdev, ARGR(wbs).control_delay); | 1290 | ret = pwc_set_wb_delay(pdev, wbs->control_delay); |
1344 | } | 1291 | } |
1345 | break; | 1292 | break; |
1346 | } | 1293 | } |
1347 | 1294 | ||
1348 | case VIDIOCPWCGAWBSPEED: | 1295 | case VIDIOCPWCGAWBSPEED: |
1349 | { | 1296 | { |
1350 | ARG_DEF(struct pwc_wb_speed, wbs) | 1297 | struct pwc_wb_speed *wbs = arg; |
1351 | 1298 | ||
1352 | ret = pwc_get_wb_speed(pdev, &ARGR(wbs).control_speed); | 1299 | ret = pwc_get_wb_speed(pdev, &wbs->control_speed); |
1353 | if (ret < 0) | 1300 | if (ret < 0) |
1354 | break; | 1301 | break; |
1355 | ret = pwc_get_wb_delay(pdev, &ARGR(wbs).control_delay); | 1302 | ret = pwc_get_wb_delay(pdev, &wbs->control_delay); |
1356 | if (ret < 0) | 1303 | if (ret < 0) |
1357 | break; | 1304 | break; |
1358 | ARG_OUT(wbs) | ||
1359 | break; | 1305 | break; |
1360 | } | 1306 | } |
1361 | 1307 | ||
1362 | case VIDIOCPWCSLED: | 1308 | case VIDIOCPWCSLED: |
1363 | { | 1309 | { |
1364 | ARG_DEF(struct pwc_leds, leds) | 1310 | struct pwc_leds *leds = arg; |
1365 | 1311 | ret = pwc_set_leds(pdev, leds->led_on, leds->led_off); | |
1366 | ARG_IN(leds) | ||
1367 | ret = pwc_set_leds(pdev, ARGR(leds).led_on, ARGR(leds).led_off); | ||
1368 | break; | 1312 | break; |
1369 | } | 1313 | } |
1370 | 1314 | ||
1371 | 1315 | ||
1372 | case VIDIOCPWCGLED: | 1316 | case VIDIOCPWCGLED: |
1373 | { | 1317 | { |
1374 | ARG_DEF(struct pwc_leds, leds) | 1318 | struct pwc_leds *leds = arg; |
1375 | 1319 | ret = pwc_get_leds(pdev, &leds->led_on, &leds->led_off); | |
1376 | ret = pwc_get_leds(pdev, &ARGR(leds).led_on, &ARGR(leds).led_off); | ||
1377 | ARG_OUT(leds) | ||
1378 | break; | 1320 | break; |
1379 | } | 1321 | } |
1380 | 1322 | ||
1381 | case VIDIOCPWCSCONTOUR: | 1323 | case VIDIOCPWCSCONTOUR: |
1382 | { | 1324 | { |
1383 | ARG_DEF(int, contour) | 1325 | int *contour = arg; |
1384 | 1326 | ret = pwc_set_contour(pdev, *contour); | |
1385 | ARG_IN(contour) | ||
1386 | ret = pwc_set_contour(pdev, ARGR(contour)); | ||
1387 | break; | 1327 | break; |
1388 | } | 1328 | } |
1389 | 1329 | ||
1390 | case VIDIOCPWCGCONTOUR: | 1330 | case VIDIOCPWCGCONTOUR: |
1391 | { | 1331 | { |
1392 | ARG_DEF(int, contour) | 1332 | int *contour = arg; |
1393 | 1333 | ret = pwc_get_contour(pdev, contour); | |
1394 | ret = pwc_get_contour(pdev, ARGA(contour)); | ||
1395 | ARG_OUT(contour) | ||
1396 | break; | 1334 | break; |
1397 | } | 1335 | } |
1398 | 1336 | ||
1399 | case VIDIOCPWCSBACKLIGHT: | 1337 | case VIDIOCPWCSBACKLIGHT: |
1400 | { | 1338 | { |
1401 | ARG_DEF(int, backlight) | 1339 | int *backlight = arg; |
1402 | 1340 | ret = pwc_set_backlight(pdev, *backlight); | |
1403 | ARG_IN(backlight) | ||
1404 | ret = pwc_set_backlight(pdev, ARGR(backlight)); | ||
1405 | break; | 1341 | break; |
1406 | } | 1342 | } |
1407 | 1343 | ||
1408 | case VIDIOCPWCGBACKLIGHT: | 1344 | case VIDIOCPWCGBACKLIGHT: |
1409 | { | 1345 | { |
1410 | ARG_DEF(int, backlight) | 1346 | int *backlight = arg; |
1411 | 1347 | ret = pwc_get_backlight(pdev, backlight); | |
1412 | ret = pwc_get_backlight(pdev, ARGA(backlight)); | ||
1413 | ARG_OUT(backlight) | ||
1414 | break; | 1348 | break; |
1415 | } | 1349 | } |
1416 | 1350 | ||
1417 | case VIDIOCPWCSFLICKER: | 1351 | case VIDIOCPWCSFLICKER: |
1418 | { | 1352 | { |
1419 | ARG_DEF(int, flicker) | 1353 | int *flicker = arg; |
1420 | 1354 | ret = pwc_set_flicker(pdev, *flicker); | |
1421 | ARG_IN(flicker) | ||
1422 | ret = pwc_set_flicker(pdev, ARGR(flicker)); | ||
1423 | break; | 1355 | break; |
1424 | } | 1356 | } |
1425 | 1357 | ||
1426 | case VIDIOCPWCGFLICKER: | 1358 | case VIDIOCPWCGFLICKER: |
1427 | { | 1359 | { |
1428 | ARG_DEF(int, flicker) | 1360 | int *flicker = arg; |
1429 | 1361 | ret = pwc_get_flicker(pdev, flicker); | |
1430 | ret = pwc_get_flicker(pdev, ARGA(flicker)); | ||
1431 | ARG_OUT(flicker) | ||
1432 | break; | 1362 | break; |
1433 | } | 1363 | } |
1434 | 1364 | ||
1435 | case VIDIOCPWCSDYNNOISE: | 1365 | case VIDIOCPWCSDYNNOISE: |
1436 | { | 1366 | { |
1437 | ARG_DEF(int, dynnoise) | 1367 | int *dynnoise = arg; |
1438 | 1368 | ret = pwc_set_dynamic_noise(pdev, *dynnoise); | |
1439 | ARG_IN(dynnoise) | ||
1440 | ret = pwc_set_dynamic_noise(pdev, ARGR(dynnoise)); | ||
1441 | break; | 1369 | break; |
1442 | } | 1370 | } |
1443 | 1371 | ||
1444 | case VIDIOCPWCGDYNNOISE: | 1372 | case VIDIOCPWCGDYNNOISE: |
1445 | { | 1373 | { |
1446 | ARG_DEF(int, dynnoise) | 1374 | int *dynnoise = arg; |
1447 | 1375 | ret = pwc_get_dynamic_noise(pdev, dynnoise); | |
1448 | ret = pwc_get_dynamic_noise(pdev, ARGA(dynnoise)); | ||
1449 | ARG_OUT(dynnoise); | ||
1450 | break; | 1376 | break; |
1451 | } | 1377 | } |
1452 | 1378 | ||
1453 | case VIDIOCPWCGREALSIZE: | 1379 | case VIDIOCPWCGREALSIZE: |
1454 | { | 1380 | { |
1455 | ARG_DEF(struct pwc_imagesize, size) | 1381 | struct pwc_imagesize *size = arg; |
1456 | 1382 | size->width = pdev->image.x; | |
1457 | ARGR(size).width = pdev->image.x; | 1383 | size->height = pdev->image.y; |
1458 | ARGR(size).height = pdev->image.y; | ||
1459 | ARG_OUT(size) | ||
1460 | break; | 1384 | break; |
1461 | } | 1385 | } |
1462 | 1386 | ||
@@ -1464,10 +1388,9 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1464 | { | 1388 | { |
1465 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1389 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1466 | { | 1390 | { |
1467 | ARG_DEF(int, flags) | 1391 | int *flags = arg; |
1468 | 1392 | ||
1469 | ARG_IN(flags) | 1393 | ret = pwc_mpt_reset(pdev, *flags); |
1470 | ret = pwc_mpt_reset(pdev, ARGR(flags)); | ||
1471 | if (ret >= 0) | 1394 | if (ret >= 0) |
1472 | { | 1395 | { |
1473 | pdev->pan_angle = 0; | 1396 | pdev->pan_angle = 0; |
@@ -1485,10 +1408,8 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1485 | { | 1408 | { |
1486 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1409 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1487 | { | 1410 | { |
1488 | ARG_DEF(struct pwc_mpt_range, range) | 1411 | struct pwc_mpt_range *range = arg; |
1489 | 1412 | *range = pdev->angle_range; | |
1490 | ARGR(range) = pdev->angle_range; | ||
1491 | ARG_OUT(range) | ||
1492 | } | 1413 | } |
1493 | else | 1414 | else |
1494 | { | 1415 | { |
@@ -1503,21 +1424,19 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1503 | 1424 | ||
1504 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1425 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1505 | { | 1426 | { |
1506 | ARG_DEF(struct pwc_mpt_angles, angles) | 1427 | struct pwc_mpt_angles *angles = arg; |
1507 | |||
1508 | ARG_IN(angles) | ||
1509 | /* The camera can only set relative angles, so | 1428 | /* The camera can only set relative angles, so |
1510 | do some calculations when getting an absolute angle . | 1429 | do some calculations when getting an absolute angle . |
1511 | */ | 1430 | */ |
1512 | if (ARGR(angles).absolute) | 1431 | if (angles->absolute) |
1513 | { | 1432 | { |
1514 | new_pan = ARGR(angles).pan; | 1433 | new_pan = angles->pan; |
1515 | new_tilt = ARGR(angles).tilt; | 1434 | new_tilt = angles->tilt; |
1516 | } | 1435 | } |
1517 | else | 1436 | else |
1518 | { | 1437 | { |
1519 | new_pan = pdev->pan_angle + ARGR(angles).pan; | 1438 | new_pan = pdev->pan_angle + angles->pan; |
1520 | new_tilt = pdev->tilt_angle + ARGR(angles).tilt; | 1439 | new_tilt = pdev->tilt_angle + angles->tilt; |
1521 | } | 1440 | } |
1522 | /* check absolute ranges */ | 1441 | /* check absolute ranges */ |
1523 | if (new_pan < pdev->angle_range.pan_min || | 1442 | if (new_pan < pdev->angle_range.pan_min || |
@@ -1560,12 +1479,11 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1560 | 1479 | ||
1561 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1480 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1562 | { | 1481 | { |
1563 | ARG_DEF(struct pwc_mpt_angles, angles) | 1482 | struct pwc_mpt_angles *angles = arg; |
1564 | 1483 | ||
1565 | ARGR(angles).absolute = 1; | 1484 | angles->absolute = 1; |
1566 | ARGR(angles).pan = pdev->pan_angle; | 1485 | angles->pan = pdev->pan_angle; |
1567 | ARGR(angles).tilt = pdev->tilt_angle; | 1486 | angles->tilt = pdev->tilt_angle; |
1568 | ARG_OUT(angles) | ||
1569 | } | 1487 | } |
1570 | else | 1488 | else |
1571 | { | 1489 | { |
@@ -1578,10 +1496,8 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1578 | { | 1496 | { |
1579 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1497 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1580 | { | 1498 | { |
1581 | ARG_DEF(struct pwc_mpt_status, status) | 1499 | struct pwc_mpt_status *status = arg; |
1582 | 1500 | ret = pwc_mpt_get_status(pdev, status); | |
1583 | ret = pwc_mpt_get_status(pdev, ARGA(status)); | ||
1584 | ARG_OUT(status) | ||
1585 | } | 1501 | } |
1586 | else | 1502 | else |
1587 | { | 1503 | { |
@@ -1592,24 +1508,22 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1592 | 1508 | ||
1593 | case VIDIOCPWCGVIDCMD: | 1509 | case VIDIOCPWCGVIDCMD: |
1594 | { | 1510 | { |
1595 | ARG_DEF(struct pwc_video_command, cmd); | 1511 | struct pwc_video_command *cmd = arg; |
1596 | 1512 | ||
1597 | ARGR(cmd).type = pdev->type; | 1513 | cmd->type = pdev->type; |
1598 | ARGR(cmd).release = pdev->release; | 1514 | cmd->release = pdev->release; |
1599 | ARGR(cmd).command_len = pdev->cmd_len; | 1515 | cmd->command_len = pdev->cmd_len; |
1600 | memcpy(&ARGR(cmd).command_buf, pdev->cmd_buf, pdev->cmd_len); | 1516 | memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len); |
1601 | ARGR(cmd).bandlength = pdev->vbandlength; | 1517 | cmd->bandlength = pdev->vbandlength; |
1602 | ARGR(cmd).frame_size = pdev->frame_size; | 1518 | cmd->frame_size = pdev->frame_size; |
1603 | ARG_OUT(cmd) | ||
1604 | break; | 1519 | break; |
1605 | } | 1520 | } |
1606 | /* | 1521 | /* |
1607 | case VIDIOCPWCGVIDTABLE: | 1522 | case VIDIOCPWCGVIDTABLE: |
1608 | { | 1523 | { |
1609 | ARG_DEF(struct pwc_table_init_buffer, table); | 1524 | struct pwc_table_init_buffer *table = arg; |
1610 | ARGR(table).len = pdev->cmd_len; | 1525 | table->len = pdev->cmd_len; |
1611 | memcpy(&ARGR(table).buffer, pdev->decompress_data, pdev->decompressor->table_size); | 1526 | memcpy(&table->buffer, pdev->decompress_data, pdev->decompressor->table_size); |
1612 | ARG_OUT(table) | ||
1613 | break; | 1527 | break; |
1614 | } | 1528 | } |
1615 | */ | 1529 | */ |
diff --git a/drivers/usb/media/sn9c102.h b/drivers/usb/media/sn9c102.h index e5cea0e2eb57..17d60c1eea7e 100644 --- a/drivers/usb/media/sn9c102.h +++ b/drivers/usb/media/sn9c102.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * V4L2 driver for SN9C10x PC Camera Controllers * | 2 | * V4L2 driver for SN9C10x PC Camera Controllers * |
3 | * * | 3 | * * |
4 | * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | 4 | * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * | 7 | * it under the terms of the GNU General Public License as published by * |
@@ -23,7 +23,8 @@ | |||
23 | 23 | ||
24 | #include <linux/version.h> | 24 | #include <linux/version.h> |
25 | #include <linux/usb.h> | 25 | #include <linux/usb.h> |
26 | #include <linux/videodev.h> | 26 | #include <linux/videodev2.h> |
27 | #include <media/v4l2-common.h> | ||
27 | #include <linux/device.h> | 28 | #include <linux/device.h> |
28 | #include <linux/list.h> | 29 | #include <linux/list.h> |
29 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
@@ -52,13 +53,6 @@ | |||
52 | 53 | ||
53 | /*****************************************************************************/ | 54 | /*****************************************************************************/ |
54 | 55 | ||
55 | #define SN9C102_MODULE_NAME "V4L2 driver for SN9C10x PC Camera Controllers" | ||
56 | #define SN9C102_MODULE_AUTHOR "(C) 2004-2005 Luca Risolia" | ||
57 | #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | ||
58 | #define SN9C102_MODULE_LICENSE "GPL" | ||
59 | #define SN9C102_MODULE_VERSION "1:1.24a" | ||
60 | #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 24) | ||
61 | |||
62 | enum sn9c102_bridge { | 56 | enum sn9c102_bridge { |
63 | BRIDGE_SN9C101 = 0x01, | 57 | BRIDGE_SN9C101 = 0x01, |
64 | BRIDGE_SN9C102 = 0x02, | 58 | BRIDGE_SN9C102 = 0x02, |
@@ -102,12 +96,13 @@ enum sn9c102_stream_state { | |||
102 | STREAM_ON, | 96 | STREAM_ON, |
103 | }; | 97 | }; |
104 | 98 | ||
99 | typedef char sn9c103_sof_header_t[18]; | ||
105 | typedef char sn9c102_sof_header_t[12]; | 100 | typedef char sn9c102_sof_header_t[12]; |
106 | typedef char sn9c102_eof_header_t[4]; | 101 | typedef char sn9c102_eof_header_t[4]; |
107 | 102 | ||
108 | struct sn9c102_sysfs_attr { | 103 | struct sn9c102_sysfs_attr { |
109 | u8 reg, i2c_reg; | 104 | u8 reg, i2c_reg; |
110 | sn9c102_sof_header_t frame_header; | 105 | sn9c103_sof_header_t frame_header; |
111 | }; | 106 | }; |
112 | 107 | ||
113 | struct sn9c102_module_param { | 108 | struct sn9c102_module_param { |
@@ -118,8 +113,6 @@ static DECLARE_MUTEX(sn9c102_sysfs_lock); | |||
118 | static DECLARE_RWSEM(sn9c102_disconnect); | 113 | static DECLARE_RWSEM(sn9c102_disconnect); |
119 | 114 | ||
120 | struct sn9c102_device { | 115 | struct sn9c102_device { |
121 | struct device dev; | ||
122 | |||
123 | struct video_device* v4ldev; | 116 | struct video_device* v4ldev; |
124 | 117 | ||
125 | enum sn9c102_bridge bridge; | 118 | enum sn9c102_bridge bridge; |
@@ -140,8 +133,8 @@ struct sn9c102_device { | |||
140 | struct v4l2_jpegcompression compression; | 133 | struct v4l2_jpegcompression compression; |
141 | 134 | ||
142 | struct sn9c102_sysfs_attr sysfs; | 135 | struct sn9c102_sysfs_attr sysfs; |
143 | sn9c102_sof_header_t sof_header; | 136 | sn9c103_sof_header_t sof_header; |
144 | u16 reg[32]; | 137 | u16 reg[63]; |
145 | 138 | ||
146 | struct sn9c102_module_param module_param; | 139 | struct sn9c102_module_param module_param; |
147 | 140 | ||
@@ -160,7 +153,6 @@ sn9c102_attach_sensor(struct sn9c102_device* cam, | |||
160 | struct sn9c102_sensor* sensor) | 153 | struct sn9c102_sensor* sensor) |
161 | { | 154 | { |
162 | cam->sensor = sensor; | 155 | cam->sensor = sensor; |
163 | cam->sensor->dev = &cam->dev; | ||
164 | cam->sensor->usbdev = cam->usbdev; | 156 | cam->sensor->usbdev = cam->usbdev; |
165 | } | 157 | } |
166 | 158 | ||
@@ -170,19 +162,24 @@ sn9c102_attach_sensor(struct sn9c102_device* cam, | |||
170 | #undef KDBG | 162 | #undef KDBG |
171 | #ifdef SN9C102_DEBUG | 163 | #ifdef SN9C102_DEBUG |
172 | # define DBG(level, fmt, args...) \ | 164 | # define DBG(level, fmt, args...) \ |
173 | { \ | 165 | do { \ |
174 | if (debug >= (level)) { \ | 166 | if (debug >= (level)) { \ |
175 | if ((level) == 1) \ | 167 | if ((level) == 1) \ |
176 | dev_err(&cam->dev, fmt "\n", ## args); \ | 168 | dev_err(&cam->usbdev->dev, fmt "\n", ## args); \ |
177 | else if ((level) == 2) \ | 169 | else if ((level) == 2) \ |
178 | dev_info(&cam->dev, fmt "\n", ## args); \ | 170 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
179 | else if ((level) >= 3) \ | 171 | else if ((level) >= 3) \ |
180 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", \ | 172 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
181 | __FUNCTION__, __LINE__ , ## args); \ | 173 | __FUNCTION__, __LINE__ , ## args); \ |
182 | } \ | 174 | } \ |
183 | } | 175 | } while (0) |
176 | # define V4LDBG(level, name, cmd) \ | ||
177 | do { \ | ||
178 | if (debug >= (level)) \ | ||
179 | v4l_print_ioctl(name, cmd); \ | ||
180 | } while (0) | ||
184 | # define KDBG(level, fmt, args...) \ | 181 | # define KDBG(level, fmt, args...) \ |
185 | { \ | 182 | do { \ |
186 | if (debug >= (level)) { \ | 183 | if (debug >= (level)) { \ |
187 | if ((level) == 1 || (level) == 2) \ | 184 | if ((level) == 1 || (level) == 2) \ |
188 | pr_info("sn9c102: " fmt "\n", ## args); \ | 185 | pr_info("sn9c102: " fmt "\n", ## args); \ |
@@ -190,17 +187,18 @@ sn9c102_attach_sensor(struct sn9c102_device* cam, | |||
190 | pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \ | 187 | pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \ |
191 | __LINE__ , ## args); \ | 188 | __LINE__ , ## args); \ |
192 | } \ | 189 | } \ |
193 | } | 190 | } while (0) |
194 | #else | 191 | #else |
195 | # define KDBG(level, fmt, args...) do {;} while(0); | 192 | # define DBG(level, fmt, args...) do {;} while(0) |
196 | # define DBG(level, fmt, args...) do {;} while(0); | 193 | # define V4LDBG(level, name, cmd) do {;} while(0) |
194 | # define KDBG(level, fmt, args...) do {;} while(0) | ||
197 | #endif | 195 | #endif |
198 | 196 | ||
199 | #undef PDBG | 197 | #undef PDBG |
200 | #define PDBG(fmt, args...) \ | 198 | #define PDBG(fmt, args...) \ |
201 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args); | 199 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", __FUNCTION__, __LINE__ , ## args) |
202 | 200 | ||
203 | #undef PDBGG | 201 | #undef PDBGG |
204 | #define PDBGG(fmt, args...) do {;} while(0); /* placeholder */ | 202 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |
205 | 203 | ||
206 | #endif /* _SN9C102_H_ */ | 204 | #endif /* _SN9C102_H_ */ |
diff --git a/drivers/usb/media/sn9c102_core.c b/drivers/usb/media/sn9c102_core.c index 8d1a1c357d5a..c81397e4714b 100644 --- a/drivers/usb/media/sn9c102_core.c +++ b/drivers/usb/media/sn9c102_core.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * V4L2 driver for SN9C10x PC Camera Controllers * | 2 | * V4L2 driver for SN9C10x PC Camera Controllers * |
3 | * * | 3 | * * |
4 | * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | 4 | * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * | 7 | * it under the terms of the GNU General Public License as published by * |
@@ -45,6 +45,15 @@ | |||
45 | 45 | ||
46 | /*****************************************************************************/ | 46 | /*****************************************************************************/ |
47 | 47 | ||
48 | #define SN9C102_MODULE_NAME "V4L2 driver for SN9C10x PC Camera Controllers" | ||
49 | #define SN9C102_MODULE_AUTHOR "(C) 2004-2006 Luca Risolia" | ||
50 | #define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | ||
51 | #define SN9C102_MODULE_LICENSE "GPL" | ||
52 | #define SN9C102_MODULE_VERSION "1:1.26" | ||
53 | #define SN9C102_MODULE_VERSION_CODE KERNEL_VERSION(1, 0, 26) | ||
54 | |||
55 | /*****************************************************************************/ | ||
56 | |||
48 | MODULE_DEVICE_TABLE(usb, sn9c102_id_table); | 57 | MODULE_DEVICE_TABLE(usb, sn9c102_id_table); |
49 | 58 | ||
50 | MODULE_AUTHOR(SN9C102_MODULE_AUTHOR " " SN9C102_AUTHOR_EMAIL); | 59 | MODULE_AUTHOR(SN9C102_MODULE_AUTHOR " " SN9C102_AUTHOR_EMAIL); |
@@ -70,10 +79,10 @@ static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] = | |||
70 | SN9C102_FORCE_MUNMAP}; | 79 | SN9C102_FORCE_MUNMAP}; |
71 | module_param_array(force_munmap, bool, NULL, 0444); | 80 | module_param_array(force_munmap, bool, NULL, 0444); |
72 | MODULE_PARM_DESC(force_munmap, | 81 | MODULE_PARM_DESC(force_munmap, |
73 | "\n<0|1[,...]> Force the application to unmap previously " | 82 | "\n<0|1[,...]> Force the application to unmap previously" |
74 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or " | 83 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" |
75 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support " | 84 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" |
76 | "\nthis feature. This parameter is specific for each " | 85 | "\nthis feature. This parameter is specific for each" |
77 | "\ndetected camera." | 86 | "\ndetected camera." |
78 | "\n 0 = do not force memory unmapping" | 87 | "\n 0 = do not force memory unmapping" |
79 | "\n 1 = force memory unmapping (save memory)" | 88 | "\n 1 = force memory unmapping (save memory)" |
@@ -102,6 +111,9 @@ static sn9c102_sof_header_t sn9c102_sof_header[] = { | |||
102 | {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96, 0x01}, | 111 | {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96, 0x01}, |
103 | }; | 112 | }; |
104 | 113 | ||
114 | static sn9c103_sof_header_t sn9c103_sof_header[] = { | ||
115 | {0xff, 0xff, 0x00, 0xc4, 0xc4, 0x96, 0x20}, | ||
116 | }; | ||
105 | 117 | ||
106 | static sn9c102_eof_header_t sn9c102_eof_header[] = { | 118 | static sn9c102_eof_header_t sn9c102_eof_header[] = { |
107 | {0x00, 0x00, 0x00, 0x00}, | 119 | {0x00, 0x00, 0x00, 0x00}, |
@@ -112,50 +124,6 @@ static sn9c102_eof_header_t sn9c102_eof_header[] = { | |||
112 | 124 | ||
113 | /*****************************************************************************/ | 125 | /*****************************************************************************/ |
114 | 126 | ||
115 | static void* rvmalloc(size_t size) | ||
116 | { | ||
117 | void* mem; | ||
118 | unsigned long adr; | ||
119 | |||
120 | size = PAGE_ALIGN(size); | ||
121 | |||
122 | mem = vmalloc_32((unsigned long)size); | ||
123 | if (!mem) | ||
124 | return NULL; | ||
125 | |||
126 | memset(mem, 0, size); | ||
127 | |||
128 | adr = (unsigned long)mem; | ||
129 | while (size > 0) { | ||
130 | SetPageReserved(vmalloc_to_page((void *)adr)); | ||
131 | adr += PAGE_SIZE; | ||
132 | size -= PAGE_SIZE; | ||
133 | } | ||
134 | |||
135 | return mem; | ||
136 | } | ||
137 | |||
138 | |||
139 | static void rvfree(void* mem, size_t size) | ||
140 | { | ||
141 | unsigned long adr; | ||
142 | |||
143 | if (!mem) | ||
144 | return; | ||
145 | |||
146 | size = PAGE_ALIGN(size); | ||
147 | |||
148 | adr = (unsigned long)mem; | ||
149 | while (size > 0) { | ||
150 | ClearPageReserved(vmalloc_to_page((void *)adr)); | ||
151 | adr += PAGE_SIZE; | ||
152 | size -= PAGE_SIZE; | ||
153 | } | ||
154 | |||
155 | vfree(mem); | ||
156 | } | ||
157 | |||
158 | |||
159 | static u32 | 127 | static u32 |
160 | sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, | 128 | sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, |
161 | enum sn9c102_io_method io) | 129 | enum sn9c102_io_method io) |
@@ -174,7 +142,7 @@ sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, | |||
174 | 142 | ||
175 | cam->nbuffers = count; | 143 | cam->nbuffers = count; |
176 | while (cam->nbuffers > 0) { | 144 | while (cam->nbuffers > 0) { |
177 | if ((buff = rvmalloc(cam->nbuffers * PAGE_ALIGN(imagesize)))) | 145 | if ((buff = vmalloc_32(cam->nbuffers * PAGE_ALIGN(imagesize)))) |
178 | break; | 146 | break; |
179 | cam->nbuffers--; | 147 | cam->nbuffers--; |
180 | } | 148 | } |
@@ -198,10 +166,10 @@ sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, | |||
198 | static void sn9c102_release_buffers(struct sn9c102_device* cam) | 166 | static void sn9c102_release_buffers(struct sn9c102_device* cam) |
199 | { | 167 | { |
200 | if (cam->nbuffers) { | 168 | if (cam->nbuffers) { |
201 | rvfree(cam->frame[0].bufmem, | 169 | vfree(cam->frame[0].bufmem); |
202 | cam->nbuffers * PAGE_ALIGN(cam->frame[0].buf.length)); | ||
203 | cam->nbuffers = 0; | 170 | cam->nbuffers = 0; |
204 | } | 171 | } |
172 | cam->frame_current = NULL; | ||
205 | } | 173 | } |
206 | 174 | ||
207 | 175 | ||
@@ -219,6 +187,19 @@ static void sn9c102_empty_framequeues(struct sn9c102_device* cam) | |||
219 | } | 187 | } |
220 | 188 | ||
221 | 189 | ||
190 | static void sn9c102_requeue_outqueue(struct sn9c102_device* cam) | ||
191 | { | ||
192 | struct sn9c102_frame_t *i; | ||
193 | |||
194 | list_for_each_entry(i, &cam->outqueue, frame) { | ||
195 | i->state = F_QUEUED; | ||
196 | list_add(&i->frame, &cam->inqueue); | ||
197 | } | ||
198 | |||
199 | INIT_LIST_HEAD(&cam->outqueue); | ||
200 | } | ||
201 | |||
202 | |||
222 | static void sn9c102_queue_unusedframes(struct sn9c102_device* cam) | 203 | static void sn9c102_queue_unusedframes(struct sn9c102_device* cam) |
223 | { | 204 | { |
224 | unsigned long lock_flags; | 205 | unsigned long lock_flags; |
@@ -235,19 +216,46 @@ static void sn9c102_queue_unusedframes(struct sn9c102_device* cam) | |||
235 | 216 | ||
236 | /*****************************************************************************/ | 217 | /*****************************************************************************/ |
237 | 218 | ||
219 | int sn9c102_write_regs(struct sn9c102_device* cam, u8* buff, u16 index) | ||
220 | { | ||
221 | struct usb_device* udev = cam->usbdev; | ||
222 | int i, res; | ||
223 | |||
224 | if (index + sizeof(buff) >= ARRAY_SIZE(cam->reg)) | ||
225 | return -1; | ||
226 | |||
227 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | ||
228 | index, 0, buff, sizeof(buff), | ||
229 | SN9C102_CTRL_TIMEOUT*sizeof(buff)); | ||
230 | if (res < 0) { | ||
231 | DBG(3, "Failed to write registers (index 0x%02X, error %d)", | ||
232 | index, res); | ||
233 | return -1; | ||
234 | } | ||
235 | |||
236 | for (i = 0; i < sizeof(buff); i++) | ||
237 | cam->reg[index+i] = buff[i]; | ||
238 | |||
239 | return 0; | ||
240 | } | ||
241 | |||
242 | |||
238 | int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index) | 243 | int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index) |
239 | { | 244 | { |
240 | struct usb_device* udev = cam->usbdev; | 245 | struct usb_device* udev = cam->usbdev; |
241 | u8* buff = cam->control_buffer; | 246 | u8* buff = cam->control_buffer; |
242 | int res; | 247 | int res; |
243 | 248 | ||
249 | if (index >= ARRAY_SIZE(cam->reg)) | ||
250 | return -1; | ||
251 | |||
244 | *buff = value; | 252 | *buff = value; |
245 | 253 | ||
246 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 254 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
247 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); | 255 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); |
248 | if (res < 0) { | 256 | if (res < 0) { |
249 | DBG(3, "Failed to write a register (value 0x%02X, index " | 257 | DBG(3, "Failed to write a register (value 0x%02X, index " |
250 | "0x%02X, error %d)", value, index, res) | 258 | "0x%02X, error %d)", value, index, res); |
251 | return -1; | 259 | return -1; |
252 | } | 260 | } |
253 | 261 | ||
@@ -268,7 +276,7 @@ static int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) | |||
268 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); | 276 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); |
269 | if (res < 0) | 277 | if (res < 0) |
270 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", | 278 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", |
271 | index, res) | 279 | index, res); |
272 | 280 | ||
273 | return (res >= 0) ? (int)(*buff) : -1; | 281 | return (res >= 0) ? (int)(*buff) : -1; |
274 | } | 282 | } |
@@ -276,8 +284,8 @@ static int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) | |||
276 | 284 | ||
277 | int sn9c102_pread_reg(struct sn9c102_device* cam, u16 index) | 285 | int sn9c102_pread_reg(struct sn9c102_device* cam, u16 index) |
278 | { | 286 | { |
279 | if (index > 0x1f) | 287 | if (index >= ARRAY_SIZE(cam->reg)) |
280 | return -EINVAL; | 288 | return -1; |
281 | 289 | ||
282 | return cam->reg[index]; | 290 | return cam->reg[index]; |
283 | } | 291 | } |
@@ -367,10 +375,10 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | |||
367 | err += sn9c102_i2c_detect_read_error(cam, sensor); | 375 | err += sn9c102_i2c_detect_read_error(cam, sensor); |
368 | 376 | ||
369 | PDBGG("I2C read: address 0x%02X, first read byte: 0x%02X", data1, | 377 | PDBGG("I2C read: address 0x%02X, first read byte: 0x%02X", data1, |
370 | data[4]) | 378 | data[4]); |
371 | 379 | ||
372 | if (err) { | 380 | if (err) { |
373 | DBG(3, "I2C read failed for %s image sensor", sensor->name) | 381 | DBG(3, "I2C read failed for %s image sensor", sensor->name); |
374 | return -1; | 382 | return -1; |
375 | } | 383 | } |
376 | 384 | ||
@@ -410,11 +418,11 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | |||
410 | err += sn9c102_i2c_detect_write_error(cam, sensor); | 418 | err += sn9c102_i2c_detect_write_error(cam, sensor); |
411 | 419 | ||
412 | if (err) | 420 | if (err) |
413 | DBG(3, "I2C write failed for %s image sensor", sensor->name) | 421 | DBG(3, "I2C write failed for %s image sensor", sensor->name); |
414 | 422 | ||
415 | PDBGG("I2C raw write: %u bytes, data0 = 0x%02X, data1 = 0x%02X, " | 423 | PDBGG("I2C raw write: %u bytes, data0 = 0x%02X, data1 = 0x%02X, " |
416 | "data2 = 0x%02X, data3 = 0x%02X, data4 = 0x%02X, data5 = 0x%02X", | 424 | "data2 = 0x%02X, data3 = 0x%02X, data4 = 0x%02X, data5 = 0x%02X", |
417 | n, data0, data1, data2, data3, data4, data5) | 425 | n, data0, data1, data2, data3, data4, data5); |
418 | 426 | ||
419 | return err ? -1 : 0; | 427 | return err ? -1 : 0; |
420 | } | 428 | } |
@@ -461,13 +469,27 @@ int sn9c102_i2c_write(struct sn9c102_device* cam, u8 address, u8 value) | |||
461 | static void* | 469 | static void* |
462 | sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) | 470 | sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) |
463 | { | 471 | { |
464 | size_t soflen = sizeof(sn9c102_sof_header_t), i; | 472 | size_t soflen = 0, i; |
465 | u8 j, n = sizeof(sn9c102_sof_header) / soflen; | 473 | u8 j, n = 0; |
466 | 474 | ||
467 | for (i = 0; (len >= soflen) && (i <= len - soflen); i++) | 475 | switch (cam->bridge) { |
476 | case BRIDGE_SN9C101: | ||
477 | case BRIDGE_SN9C102: | ||
478 | soflen = sizeof(sn9c102_sof_header_t); | ||
479 | n = sizeof(sn9c102_sof_header) / soflen; | ||
480 | break; | ||
481 | case BRIDGE_SN9C103: | ||
482 | soflen = sizeof(sn9c103_sof_header_t); | ||
483 | n = sizeof(sn9c103_sof_header) / soflen; | ||
484 | } | ||
485 | |||
486 | for (i = 0; (len >= soflen) && (i <= len - soflen); i++) | ||
468 | for (j = 0; j < n; j++) | 487 | for (j = 0; j < n; j++) |
469 | /* It's enough to compare 7 bytes */ | 488 | /* The invariable part of the header is 6 bytes long */ |
470 | if (!memcmp(mem + i, sn9c102_sof_header[j], 7)) { | 489 | if ((cam->bridge != BRIDGE_SN9C103 && |
490 | !memcmp(mem + i, sn9c102_sof_header[j], 6)) || | ||
491 | (cam->bridge == BRIDGE_SN9C103 && | ||
492 | !memcmp(mem + i, sn9c103_sof_header[j], 6))) { | ||
471 | memcpy(cam->sof_header, mem + i, soflen); | 493 | memcpy(cam->sof_header, mem + i, soflen); |
472 | /* Skip the header */ | 494 | /* Skip the header */ |
473 | return mem + i + soflen; | 495 | return mem + i + soflen; |
@@ -499,8 +521,7 @@ static void sn9c102_urb_complete(struct urb *urb, struct pt_regs* regs) | |||
499 | { | 521 | { |
500 | struct sn9c102_device* cam = urb->context; | 522 | struct sn9c102_device* cam = urb->context; |
501 | struct sn9c102_frame_t** f; | 523 | struct sn9c102_frame_t** f; |
502 | size_t imagesize; | 524 | size_t imagesize, soflen; |
503 | unsigned long lock_flags; | ||
504 | u8 i; | 525 | u8 i; |
505 | int err = 0; | 526 | int err = 0; |
506 | 527 | ||
@@ -513,7 +534,7 @@ static void sn9c102_urb_complete(struct urb *urb, struct pt_regs* regs) | |||
513 | cam->stream = STREAM_OFF; | 534 | cam->stream = STREAM_OFF; |
514 | if ((*f)) | 535 | if ((*f)) |
515 | (*f)->state = F_QUEUED; | 536 | (*f)->state = F_QUEUED; |
516 | DBG(3, "Stream interrupted") | 537 | DBG(3, "Stream interrupted"); |
517 | wake_up_interruptible(&cam->wait_stream); | 538 | wake_up_interruptible(&cam->wait_stream); |
518 | } | 539 | } |
519 | 540 | ||
@@ -536,6 +557,10 @@ static void sn9c102_urb_complete(struct urb *urb, struct pt_regs* regs) | |||
536 | cam->sensor->pix_format.height * | 557 | cam->sensor->pix_format.height * |
537 | cam->sensor->pix_format.priv) / 8; | 558 | cam->sensor->pix_format.priv) / 8; |
538 | 559 | ||
560 | soflen = (cam->bridge) == BRIDGE_SN9C103 ? | ||
561 | sizeof(sn9c103_sof_header_t) : | ||
562 | sizeof(sn9c102_sof_header_t); | ||
563 | |||
539 | for (i = 0; i < urb->number_of_packets; i++) { | 564 | for (i = 0; i < urb->number_of_packets; i++) { |
540 | unsigned int img, len, status; | 565 | unsigned int img, len, status; |
541 | void *pos, *sof, *eof; | 566 | void *pos, *sof, *eof; |
@@ -545,19 +570,12 @@ static void sn9c102_urb_complete(struct urb *urb, struct pt_regs* regs) | |||
545 | pos = urb->iso_frame_desc[i].offset + urb->transfer_buffer; | 570 | pos = urb->iso_frame_desc[i].offset + urb->transfer_buffer; |
546 | 571 | ||
547 | if (status) { | 572 | if (status) { |
548 | DBG(3, "Error in isochronous frame") | 573 | DBG(3, "Error in isochronous frame"); |
549 | (*f)->state = F_ERROR; | 574 | (*f)->state = F_ERROR; |
550 | continue; | 575 | continue; |
551 | } | 576 | } |
552 | 577 | ||
553 | PDBGG("Isochrnous frame: length %u, #%u i", len, i) | 578 | PDBGG("Isochrnous frame: length %u, #%u i", len, i); |
554 | |||
555 | /* | ||
556 | NOTE: It is probably correct to assume that SOF and EOF | ||
557 | headers do not occur between two consecutive packets, | ||
558 | but who knows..Whatever is the truth, this assumption | ||
559 | doesn't introduce bugs. | ||
560 | */ | ||
561 | 579 | ||
562 | redo: | 580 | redo: |
563 | sof = sn9c102_find_sof_header(cam, pos, len); | 581 | sof = sn9c102_find_sof_header(cam, pos, len); |
@@ -575,10 +593,10 @@ end_of_frame: | |||
575 | imagesize; | 593 | imagesize; |
576 | img = imagesize - (*f)->buf.bytesused; | 594 | img = imagesize - (*f)->buf.bytesused; |
577 | DBG(3, "Expected EOF not found: " | 595 | DBG(3, "Expected EOF not found: " |
578 | "video frame cut") | 596 | "video frame cut"); |
579 | if (eof) | 597 | if (eof) |
580 | DBG(3, "Exceeded limit: +%u " | 598 | DBG(3, "Exceeded limit: +%u " |
581 | "bytes", (unsigned)(b)) | 599 | "bytes", (unsigned)(b)); |
582 | } | 600 | } |
583 | 601 | ||
584 | memcpy((*f)->bufmem + (*f)->buf.bytesused, pos, | 602 | memcpy((*f)->bufmem + (*f)->buf.bytesused, pos, |
@@ -595,8 +613,7 @@ end_of_frame: | |||
595 | u32 b = (*f)->buf.bytesused; | 613 | u32 b = (*f)->buf.bytesused; |
596 | (*f)->state = F_DONE; | 614 | (*f)->state = F_DONE; |
597 | (*f)->buf.sequence= ++cam->frame_count; | 615 | (*f)->buf.sequence= ++cam->frame_count; |
598 | spin_lock_irqsave(&cam->queue_lock, | 616 | spin_lock(&cam->queue_lock); |
599 | lock_flags); | ||
600 | list_move_tail(&(*f)->frame, | 617 | list_move_tail(&(*f)->frame, |
601 | &cam->outqueue); | 618 | &cam->outqueue); |
602 | if (!list_empty(&cam->inqueue)) | 619 | if (!list_empty(&cam->inqueue)) |
@@ -606,13 +623,11 @@ end_of_frame: | |||
606 | frame ); | 623 | frame ); |
607 | else | 624 | else |
608 | (*f) = NULL; | 625 | (*f) = NULL; |
609 | spin_unlock_irqrestore(&cam->queue_lock | 626 | spin_unlock(&cam->queue_lock); |
610 | , lock_flags); | ||
611 | memcpy(cam->sysfs.frame_header, | 627 | memcpy(cam->sysfs.frame_header, |
612 | cam->sof_header, | 628 | cam->sof_header, soflen); |
613 | sizeof(sn9c102_sof_header_t)); | 629 | DBG(3, "Video frame captured: %lu " |
614 | DBG(3, "Video frame captured: " | 630 | "bytes", (unsigned long)(b)); |
615 | "%lu bytes", (unsigned long)(b)) | ||
616 | 631 | ||
617 | if (!(*f)) | 632 | if (!(*f)) |
618 | goto resubmit_urb; | 633 | goto resubmit_urb; |
@@ -621,18 +636,19 @@ end_of_frame: | |||
621 | (*f)->state = F_ERROR; | 636 | (*f)->state = F_ERROR; |
622 | DBG(3, "Not expected EOF after %lu " | 637 | DBG(3, "Not expected EOF after %lu " |
623 | "bytes of image data", | 638 | "bytes of image data", |
624 | (unsigned long)((*f)->buf.bytesused)) | 639 | (unsigned long) |
640 | ((*f)->buf.bytesused)); | ||
625 | } | 641 | } |
626 | 642 | ||
627 | if (sof) /* (1) */ | 643 | if (sof) /* (1) */ |
628 | goto start_of_frame; | 644 | goto start_of_frame; |
629 | 645 | ||
630 | } else if (eof) { | 646 | } else if (eof) { |
631 | DBG(3, "EOF without SOF") | 647 | DBG(3, "EOF without SOF"); |
632 | continue; | 648 | continue; |
633 | 649 | ||
634 | } else { | 650 | } else { |
635 | PDBGG("Ignoring pointless isochronous frame") | 651 | PDBGG("Ignoring pointless isochronous frame"); |
636 | continue; | 652 | continue; |
637 | } | 653 | } |
638 | 654 | ||
@@ -642,7 +658,7 @@ start_of_frame: | |||
642 | (*f)->buf.bytesused = 0; | 658 | (*f)->buf.bytesused = 0; |
643 | len -= (sof - pos); | 659 | len -= (sof - pos); |
644 | pos = sof; | 660 | pos = sof; |
645 | DBG(3, "SOF detected: new video frame") | 661 | DBG(3, "SOF detected: new video frame"); |
646 | if (len) | 662 | if (len) |
647 | goto redo; | 663 | goto redo; |
648 | 664 | ||
@@ -653,12 +669,13 @@ start_of_frame: | |||
653 | else { | 669 | else { |
654 | if (cam->sensor->pix_format.pixelformat == | 670 | if (cam->sensor->pix_format.pixelformat == |
655 | V4L2_PIX_FMT_SN9C10X) { | 671 | V4L2_PIX_FMT_SN9C10X) { |
656 | eof = sof-sizeof(sn9c102_sof_header_t); | 672 | eof = sof - soflen; |
657 | goto end_of_frame; | 673 | goto end_of_frame; |
658 | } else { | 674 | } else { |
659 | DBG(3, "SOF before expected EOF after " | 675 | DBG(3, "SOF before expected EOF after " |
660 | "%lu bytes of image data", | 676 | "%lu bytes of image data", |
661 | (unsigned long)((*f)->buf.bytesused)) | 677 | (unsigned long) |
678 | ((*f)->buf.bytesused)); | ||
662 | goto start_of_frame; | 679 | goto start_of_frame; |
663 | } | 680 | } |
664 | } | 681 | } |
@@ -670,7 +687,7 @@ resubmit_urb: | |||
670 | err = usb_submit_urb(urb, GFP_ATOMIC); | 687 | err = usb_submit_urb(urb, GFP_ATOMIC); |
671 | if (err < 0 && err != -EPERM) { | 688 | if (err < 0 && err != -EPERM) { |
672 | cam->state |= DEV_MISCONFIGURED; | 689 | cam->state |= DEV_MISCONFIGURED; |
673 | DBG(1, "usb_submit_urb() failed") | 690 | DBG(1, "usb_submit_urb() failed"); |
674 | } | 691 | } |
675 | 692 | ||
676 | wake_up_interruptible(&cam->wait_frame); | 693 | wake_up_interruptible(&cam->wait_frame); |
@@ -681,18 +698,22 @@ static int sn9c102_start_transfer(struct sn9c102_device* cam) | |||
681 | { | 698 | { |
682 | struct usb_device *udev = cam->usbdev; | 699 | struct usb_device *udev = cam->usbdev; |
683 | struct urb* urb; | 700 | struct urb* urb; |
684 | const unsigned int wMaxPacketSize[] = {0, 128, 256, 384, 512, | 701 | const unsigned int sn9c102_wMaxPacketSize[] = {0, 128, 256, 384, 512, |
685 | 680, 800, 900, 1023}; | 702 | 680, 800, 900, 1023}; |
686 | const unsigned int psz = wMaxPacketSize[SN9C102_ALTERNATE_SETTING]; | 703 | const unsigned int sn9c103_wMaxPacketSize[] = {0, 128, 256, 384, 512, |
704 | 680, 800, 900, 1003}; | ||
705 | const unsigned int psz = (cam->bridge == BRIDGE_SN9C103) ? | ||
706 | sn9c103_wMaxPacketSize[SN9C102_ALTERNATE_SETTING] : | ||
707 | sn9c102_wMaxPacketSize[SN9C102_ALTERNATE_SETTING]; | ||
687 | s8 i, j; | 708 | s8 i, j; |
688 | int err = 0; | 709 | int err = 0; |
689 | 710 | ||
690 | for (i = 0; i < SN9C102_URBS; i++) { | 711 | for (i = 0; i < SN9C102_URBS; i++) { |
691 | cam->transfer_buffer[i] = kmalloc(SN9C102_ISO_PACKETS * psz, | 712 | cam->transfer_buffer[i] = kzalloc(SN9C102_ISO_PACKETS * psz, |
692 | GFP_KERNEL); | 713 | GFP_KERNEL); |
693 | if (!cam->transfer_buffer[i]) { | 714 | if (!cam->transfer_buffer[i]) { |
694 | err = -ENOMEM; | 715 | err = -ENOMEM; |
695 | DBG(1, "Not enough memory") | 716 | DBG(1, "Not enough memory"); |
696 | goto free_buffers; | 717 | goto free_buffers; |
697 | } | 718 | } |
698 | } | 719 | } |
@@ -702,7 +723,7 @@ static int sn9c102_start_transfer(struct sn9c102_device* cam) | |||
702 | cam->urb[i] = urb; | 723 | cam->urb[i] = urb; |
703 | if (!urb) { | 724 | if (!urb) { |
704 | err = -ENOMEM; | 725 | err = -ENOMEM; |
705 | DBG(1, "usb_alloc_urb() failed") | 726 | DBG(1, "usb_alloc_urb() failed"); |
706 | goto free_urbs; | 727 | goto free_urbs; |
707 | } | 728 | } |
708 | urb->dev = udev; | 729 | urb->dev = udev; |
@@ -725,14 +746,14 @@ static int sn9c102_start_transfer(struct sn9c102_device* cam) | |||
725 | err = sn9c102_write_reg(cam, cam->reg[0x01] | 0x04, 0x01); | 746 | err = sn9c102_write_reg(cam, cam->reg[0x01] | 0x04, 0x01); |
726 | if (err) { | 747 | if (err) { |
727 | err = -EIO; | 748 | err = -EIO; |
728 | DBG(1, "I/O hardware error") | 749 | DBG(1, "I/O hardware error"); |
729 | goto free_urbs; | 750 | goto free_urbs; |
730 | } | 751 | } |
731 | } | 752 | } |
732 | 753 | ||
733 | err = usb_set_interface(udev, 0, SN9C102_ALTERNATE_SETTING); | 754 | err = usb_set_interface(udev, 0, SN9C102_ALTERNATE_SETTING); |
734 | if (err) { | 755 | if (err) { |
735 | DBG(1, "usb_set_interface() failed") | 756 | DBG(1, "usb_set_interface() failed"); |
736 | goto free_urbs; | 757 | goto free_urbs; |
737 | } | 758 | } |
738 | 759 | ||
@@ -743,7 +764,7 @@ static int sn9c102_start_transfer(struct sn9c102_device* cam) | |||
743 | if (err) { | 764 | if (err) { |
744 | for (j = i-1; j >= 0; j--) | 765 | for (j = i-1; j >= 0; j--) |
745 | usb_kill_urb(cam->urb[j]); | 766 | usb_kill_urb(cam->urb[j]); |
746 | DBG(1, "usb_submit_urb() failed, error %d", err) | 767 | DBG(1, "usb_submit_urb() failed, error %d", err); |
747 | goto free_urbs; | 768 | goto free_urbs; |
748 | } | 769 | } |
749 | } | 770 | } |
@@ -779,7 +800,7 @@ static int sn9c102_stop_transfer(struct sn9c102_device* cam) | |||
779 | 800 | ||
780 | err = usb_set_interface(udev, 0, 0); /* 0 Mb/s */ | 801 | err = usb_set_interface(udev, 0, 0); /* 0 Mb/s */ |
781 | if (err) | 802 | if (err) |
782 | DBG(3, "usb_set_interface() failed") | 803 | DBG(3, "usb_set_interface() failed"); |
783 | 804 | ||
784 | return err; | 805 | return err; |
785 | } | 806 | } |
@@ -799,7 +820,7 @@ static int sn9c102_stream_interrupt(struct sn9c102_device* cam) | |||
799 | else if (err) { | 820 | else if (err) { |
800 | cam->state |= DEV_MISCONFIGURED; | 821 | cam->state |= DEV_MISCONFIGURED; |
801 | DBG(1, "The camera is misconfigured. To use it, close and " | 822 | DBG(1, "The camera is misconfigured. To use it, close and " |
802 | "open /dev/video%d again.", cam->v4ldev->minor) | 823 | "open /dev/video%d again.", cam->v4ldev->minor); |
803 | return err; | 824 | return err; |
804 | } | 825 | } |
805 | 826 | ||
@@ -808,6 +829,7 @@ static int sn9c102_stream_interrupt(struct sn9c102_device* cam) | |||
808 | 829 | ||
809 | /*****************************************************************************/ | 830 | /*****************************************************************************/ |
810 | 831 | ||
832 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
811 | static u8 sn9c102_strtou8(const char* buff, size_t len, ssize_t* count) | 833 | static u8 sn9c102_strtou8(const char* buff, size_t len, ssize_t* count) |
812 | { | 834 | { |
813 | char str[5]; | 835 | char str[5]; |
@@ -885,8 +907,8 @@ sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len) | |||
885 | 907 | ||
886 | cam->sysfs.reg = index; | 908 | cam->sysfs.reg = index; |
887 | 909 | ||
888 | DBG(2, "Moved SN9C10X register index to 0x%02X", cam->sysfs.reg) | 910 | DBG(2, "Moved SN9C10X register index to 0x%02X", cam->sysfs.reg); |
889 | DBG(3, "Written bytes: %zd", count) | 911 | DBG(3, "Written bytes: %zd", count); |
890 | 912 | ||
891 | up(&sn9c102_sysfs_lock); | 913 | up(&sn9c102_sysfs_lock); |
892 | 914 | ||
@@ -916,7 +938,7 @@ static ssize_t sn9c102_show_val(struct class_device* cd, char* buf) | |||
916 | 938 | ||
917 | count = sprintf(buf, "%d\n", val); | 939 | count = sprintf(buf, "%d\n", val); |
918 | 940 | ||
919 | DBG(3, "Read bytes: %zd", count) | 941 | DBG(3, "Read bytes: %zd", count); |
920 | 942 | ||
921 | up(&sn9c102_sysfs_lock); | 943 | up(&sn9c102_sysfs_lock); |
922 | 944 | ||
@@ -954,8 +976,8 @@ sn9c102_store_val(struct class_device* cd, const char* buf, size_t len) | |||
954 | } | 976 | } |
955 | 977 | ||
956 | DBG(2, "Written SN9C10X reg. 0x%02X, val. 0x%02X", | 978 | DBG(2, "Written SN9C10X reg. 0x%02X, val. 0x%02X", |
957 | cam->sysfs.reg, value) | 979 | cam->sysfs.reg, value); |
958 | DBG(3, "Written bytes: %zd", count) | 980 | DBG(3, "Written bytes: %zd", count); |
959 | 981 | ||
960 | up(&sn9c102_sysfs_lock); | 982 | up(&sn9c102_sysfs_lock); |
961 | 983 | ||
@@ -979,7 +1001,7 @@ static ssize_t sn9c102_show_i2c_reg(struct class_device* cd, char* buf) | |||
979 | 1001 | ||
980 | count = sprintf(buf, "%u\n", cam->sysfs.i2c_reg); | 1002 | count = sprintf(buf, "%u\n", cam->sysfs.i2c_reg); |
981 | 1003 | ||
982 | DBG(3, "Read bytes: %zd", count) | 1004 | DBG(3, "Read bytes: %zd", count); |
983 | 1005 | ||
984 | up(&sn9c102_sysfs_lock); | 1006 | up(&sn9c102_sysfs_lock); |
985 | 1007 | ||
@@ -1011,8 +1033,8 @@ sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) | |||
1011 | 1033 | ||
1012 | cam->sysfs.i2c_reg = index; | 1034 | cam->sysfs.i2c_reg = index; |
1013 | 1035 | ||
1014 | DBG(2, "Moved sensor register index to 0x%02X", cam->sysfs.i2c_reg) | 1036 | DBG(2, "Moved sensor register index to 0x%02X", cam->sysfs.i2c_reg); |
1015 | DBG(3, "Written bytes: %zd", count) | 1037 | DBG(3, "Written bytes: %zd", count); |
1016 | 1038 | ||
1017 | up(&sn9c102_sysfs_lock); | 1039 | up(&sn9c102_sysfs_lock); |
1018 | 1040 | ||
@@ -1047,7 +1069,7 @@ static ssize_t sn9c102_show_i2c_val(struct class_device* cd, char* buf) | |||
1047 | 1069 | ||
1048 | count = sprintf(buf, "%d\n", val); | 1070 | count = sprintf(buf, "%d\n", val); |
1049 | 1071 | ||
1050 | DBG(3, "Read bytes: %zd", count) | 1072 | DBG(3, "Read bytes: %zd", count); |
1051 | 1073 | ||
1052 | up(&sn9c102_sysfs_lock); | 1074 | up(&sn9c102_sysfs_lock); |
1053 | 1075 | ||
@@ -1090,8 +1112,8 @@ sn9c102_store_i2c_val(struct class_device* cd, const char* buf, size_t len) | |||
1090 | } | 1112 | } |
1091 | 1113 | ||
1092 | DBG(2, "Written sensor reg. 0x%02X, val. 0x%02X", | 1114 | DBG(2, "Written sensor reg. 0x%02X, val. 0x%02X", |
1093 | cam->sysfs.i2c_reg, value) | 1115 | cam->sysfs.i2c_reg, value); |
1094 | DBG(3, "Written bytes: %zd", count) | 1116 | DBG(3, "Written bytes: %zd", count); |
1095 | 1117 | ||
1096 | up(&sn9c102_sysfs_lock); | 1118 | up(&sn9c102_sysfs_lock); |
1097 | 1119 | ||
@@ -1193,7 +1215,7 @@ static ssize_t sn9c102_show_frame_header(struct class_device* cd, char* buf) | |||
1193 | count = sizeof(cam->sysfs.frame_header); | 1215 | count = sizeof(cam->sysfs.frame_header); |
1194 | memcpy(buf, cam->sysfs.frame_header, count); | 1216 | memcpy(buf, cam->sysfs.frame_header, count); |
1195 | 1217 | ||
1196 | DBG(3, "Frame header, read bytes: %zd", count) | 1218 | DBG(3, "Frame header, read bytes: %zd", count); |
1197 | 1219 | ||
1198 | return count; | 1220 | return count; |
1199 | } | 1221 | } |
@@ -1227,11 +1249,12 @@ static void sn9c102_create_sysfs(struct sn9c102_device* cam) | |||
1227 | video_device_create_file(v4ldev, &class_device_attr_blue); | 1249 | video_device_create_file(v4ldev, &class_device_attr_blue); |
1228 | video_device_create_file(v4ldev, &class_device_attr_red); | 1250 | video_device_create_file(v4ldev, &class_device_attr_red); |
1229 | } | 1251 | } |
1230 | if (cam->sensor->sysfs_ops) { | 1252 | if (cam->sensor && cam->sensor->sysfs_ops) { |
1231 | video_device_create_file(v4ldev, &class_device_attr_i2c_reg); | 1253 | video_device_create_file(v4ldev, &class_device_attr_i2c_reg); |
1232 | video_device_create_file(v4ldev, &class_device_attr_i2c_val); | 1254 | video_device_create_file(v4ldev, &class_device_attr_i2c_val); |
1233 | } | 1255 | } |
1234 | } | 1256 | } |
1257 | #endif /* CONFIG_VIDEO_ADV_DEBUG */ | ||
1235 | 1258 | ||
1236 | /*****************************************************************************/ | 1259 | /*****************************************************************************/ |
1237 | 1260 | ||
@@ -1281,7 +1304,7 @@ static int sn9c102_set_scale(struct sn9c102_device* cam, u8 scale) | |||
1281 | if (err) | 1304 | if (err) |
1282 | return -EIO; | 1305 | return -EIO; |
1283 | 1306 | ||
1284 | PDBGG("Scaling factor: %u", scale) | 1307 | PDBGG("Scaling factor: %u", scale); |
1285 | 1308 | ||
1286 | return 0; | 1309 | return 0; |
1287 | } | 1310 | } |
@@ -1304,7 +1327,7 @@ static int sn9c102_set_crop(struct sn9c102_device* cam, struct v4l2_rect* rect) | |||
1304 | return -EIO; | 1327 | return -EIO; |
1305 | 1328 | ||
1306 | PDBGG("h_start, v_start, h_size, v_size, ho_size, vo_size " | 1329 | PDBGG("h_start, v_start, h_size, v_size, ho_size, vo_size " |
1307 | "%u %u %u %u", h_start, v_start, h_size, v_size) | 1330 | "%u %u %u %u", h_start, v_start, h_size, v_size); |
1308 | 1331 | ||
1309 | return 0; | 1332 | return 0; |
1310 | } | 1333 | } |
@@ -1336,7 +1359,7 @@ static int sn9c102_init(struct sn9c102_device* cam) | |||
1336 | if (s->init) { | 1359 | if (s->init) { |
1337 | err = s->init(cam); | 1360 | err = s->init(cam); |
1338 | if (err) { | 1361 | if (err) { |
1339 | DBG(3, "Sensor initialization failed") | 1362 | DBG(3, "Sensor initialization failed"); |
1340 | return err; | 1363 | return err; |
1341 | } | 1364 | } |
1342 | } | 1365 | } |
@@ -1353,13 +1376,13 @@ static int sn9c102_init(struct sn9c102_device* cam) | |||
1353 | 1376 | ||
1354 | if (s->pix_format.pixelformat == V4L2_PIX_FMT_SN9C10X) | 1377 | if (s->pix_format.pixelformat == V4L2_PIX_FMT_SN9C10X) |
1355 | DBG(3, "Compressed video format is active, quality %d", | 1378 | DBG(3, "Compressed video format is active, quality %d", |
1356 | cam->compression.quality) | 1379 | cam->compression.quality); |
1357 | else | 1380 | else |
1358 | DBG(3, "Uncompressed video format is active") | 1381 | DBG(3, "Uncompressed video format is active"); |
1359 | 1382 | ||
1360 | if (s->set_crop) | 1383 | if (s->set_crop) |
1361 | if ((err = s->set_crop(cam, rect))) { | 1384 | if ((err = s->set_crop(cam, rect))) { |
1362 | DBG(3, "set_crop() failed") | 1385 | DBG(3, "set_crop() failed"); |
1363 | return err; | 1386 | return err; |
1364 | } | 1387 | } |
1365 | 1388 | ||
@@ -1372,11 +1395,11 @@ static int sn9c102_init(struct sn9c102_device* cam) | |||
1372 | err = s->set_ctrl(cam, &ctrl); | 1395 | err = s->set_ctrl(cam, &ctrl); |
1373 | if (err) { | 1396 | if (err) { |
1374 | DBG(3, "Set %s control failed", | 1397 | DBG(3, "Set %s control failed", |
1375 | s->qctrl[i].name) | 1398 | s->qctrl[i].name); |
1376 | return err; | 1399 | return err; |
1377 | } | 1400 | } |
1378 | DBG(3, "Image sensor supports '%s' control", | 1401 | DBG(3, "Image sensor supports '%s' control", |
1379 | s->qctrl[i].name) | 1402 | s->qctrl[i].name); |
1380 | } | 1403 | } |
1381 | } | 1404 | } |
1382 | 1405 | ||
@@ -1392,7 +1415,7 @@ static int sn9c102_init(struct sn9c102_device* cam) | |||
1392 | cam->state |= DEV_INITIALIZED; | 1415 | cam->state |= DEV_INITIALIZED; |
1393 | } | 1416 | } |
1394 | 1417 | ||
1395 | DBG(2, "Initialization succeeded") | 1418 | DBG(2, "Initialization succeeded"); |
1396 | return 0; | 1419 | return 0; |
1397 | } | 1420 | } |
1398 | 1421 | ||
@@ -1401,7 +1424,7 @@ static void sn9c102_release_resources(struct sn9c102_device* cam) | |||
1401 | { | 1424 | { |
1402 | down(&sn9c102_sysfs_lock); | 1425 | down(&sn9c102_sysfs_lock); |
1403 | 1426 | ||
1404 | DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor) | 1427 | DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->minor); |
1405 | video_set_drvdata(cam->v4ldev, NULL); | 1428 | video_set_drvdata(cam->v4ldev, NULL); |
1406 | video_unregister_device(cam->v4ldev); | 1429 | video_unregister_device(cam->v4ldev); |
1407 | 1430 | ||
@@ -1432,7 +1455,7 @@ static int sn9c102_open(struct inode* inode, struct file* filp) | |||
1432 | } | 1455 | } |
1433 | 1456 | ||
1434 | if (cam->users) { | 1457 | if (cam->users) { |
1435 | DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor) | 1458 | DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->minor); |
1436 | if ((filp->f_flags & O_NONBLOCK) || | 1459 | if ((filp->f_flags & O_NONBLOCK) || |
1437 | (filp->f_flags & O_NDELAY)) { | 1460 | (filp->f_flags & O_NDELAY)) { |
1438 | err = -EWOULDBLOCK; | 1461 | err = -EWOULDBLOCK; |
@@ -1458,7 +1481,7 @@ static int sn9c102_open(struct inode* inode, struct file* filp) | |||
1458 | err = sn9c102_init(cam); | 1481 | err = sn9c102_init(cam); |
1459 | if (err) { | 1482 | if (err) { |
1460 | DBG(1, "Initialization failed again. " | 1483 | DBG(1, "Initialization failed again. " |
1461 | "I will retry on next open().") | 1484 | "I will retry on next open()."); |
1462 | goto out; | 1485 | goto out; |
1463 | } | 1486 | } |
1464 | cam->state &= ~DEV_MISCONFIGURED; | 1487 | cam->state &= ~DEV_MISCONFIGURED; |
@@ -1475,7 +1498,7 @@ static int sn9c102_open(struct inode* inode, struct file* filp) | |||
1475 | cam->frame_count = 0; | 1498 | cam->frame_count = 0; |
1476 | sn9c102_empty_framequeues(cam); | 1499 | sn9c102_empty_framequeues(cam); |
1477 | 1500 | ||
1478 | DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor) | 1501 | DBG(3, "Video device /dev/video%d is open", cam->v4ldev->minor); |
1479 | 1502 | ||
1480 | out: | 1503 | out: |
1481 | up(&cam->dev_sem); | 1504 | up(&cam->dev_sem); |
@@ -1504,7 +1527,7 @@ static int sn9c102_release(struct inode* inode, struct file* filp) | |||
1504 | cam->users--; | 1527 | cam->users--; |
1505 | wake_up_interruptible_nr(&cam->open, 1); | 1528 | wake_up_interruptible_nr(&cam->open, 1); |
1506 | 1529 | ||
1507 | DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor) | 1530 | DBG(3, "Video device /dev/video%d closed", cam->v4ldev->minor); |
1508 | 1531 | ||
1509 | up(&cam->dev_sem); | 1532 | up(&cam->dev_sem); |
1510 | 1533 | ||
@@ -1524,32 +1547,38 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
1524 | return -ERESTARTSYS; | 1547 | return -ERESTARTSYS; |
1525 | 1548 | ||
1526 | if (cam->state & DEV_DISCONNECTED) { | 1549 | if (cam->state & DEV_DISCONNECTED) { |
1527 | DBG(1, "Device not present") | 1550 | DBG(1, "Device not present"); |
1528 | up(&cam->fileop_sem); | 1551 | up(&cam->fileop_sem); |
1529 | return -ENODEV; | 1552 | return -ENODEV; |
1530 | } | 1553 | } |
1531 | 1554 | ||
1532 | if (cam->state & DEV_MISCONFIGURED) { | 1555 | if (cam->state & DEV_MISCONFIGURED) { |
1533 | DBG(1, "The camera is misconfigured. Close and open it again.") | 1556 | DBG(1, "The camera is misconfigured. Close and open it " |
1557 | "again."); | ||
1534 | up(&cam->fileop_sem); | 1558 | up(&cam->fileop_sem); |
1535 | return -EIO; | 1559 | return -EIO; |
1536 | } | 1560 | } |
1537 | 1561 | ||
1538 | if (cam->io == IO_MMAP) { | 1562 | if (cam->io == IO_MMAP) { |
1539 | DBG(3, "Close and open the device again to choose " | 1563 | DBG(3, "Close and open the device again to choose " |
1540 | "the read method") | 1564 | "the read method"); |
1541 | up(&cam->fileop_sem); | 1565 | up(&cam->fileop_sem); |
1542 | return -EINVAL; | 1566 | return -EINVAL; |
1543 | } | 1567 | } |
1544 | 1568 | ||
1545 | if (cam->io == IO_NONE) { | 1569 | if (cam->io == IO_NONE) { |
1546 | if (!sn9c102_request_buffers(cam,cam->nreadbuffers, IO_READ)) { | 1570 | if (!sn9c102_request_buffers(cam,cam->nreadbuffers, IO_READ)) { |
1547 | DBG(1, "read() failed, not enough memory") | 1571 | DBG(1, "read() failed, not enough memory"); |
1548 | up(&cam->fileop_sem); | 1572 | up(&cam->fileop_sem); |
1549 | return -ENOMEM; | 1573 | return -ENOMEM; |
1550 | } | 1574 | } |
1551 | cam->io = IO_READ; | 1575 | cam->io = IO_READ; |
1552 | cam->stream = STREAM_ON; | 1576 | cam->stream = STREAM_ON; |
1577 | } | ||
1578 | |||
1579 | if (list_empty(&cam->inqueue)) { | ||
1580 | if (!list_empty(&cam->outqueue)) | ||
1581 | sn9c102_empty_framequeues(cam); | ||
1553 | sn9c102_queue_unusedframes(cam); | 1582 | sn9c102_queue_unusedframes(cam); |
1554 | } | 1583 | } |
1555 | 1584 | ||
@@ -1584,6 +1613,16 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
1584 | 1613 | ||
1585 | f = list_entry(cam->outqueue.prev, struct sn9c102_frame_t, frame); | 1614 | f = list_entry(cam->outqueue.prev, struct sn9c102_frame_t, frame); |
1586 | 1615 | ||
1616 | if (count > f->buf.bytesused) | ||
1617 | count = f->buf.bytesused; | ||
1618 | |||
1619 | if (copy_to_user(buf, f->bufmem, count)) { | ||
1620 | err = -EFAULT; | ||
1621 | goto exit; | ||
1622 | } | ||
1623 | *f_pos += count; | ||
1624 | |||
1625 | exit: | ||
1587 | spin_lock_irqsave(&cam->queue_lock, lock_flags); | 1626 | spin_lock_irqsave(&cam->queue_lock, lock_flags); |
1588 | list_for_each_entry(i, &cam->outqueue, frame) | 1627 | list_for_each_entry(i, &cam->outqueue, frame) |
1589 | i->state = F_UNUSED; | 1628 | i->state = F_UNUSED; |
@@ -1592,16 +1631,8 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
1592 | 1631 | ||
1593 | sn9c102_queue_unusedframes(cam); | 1632 | sn9c102_queue_unusedframes(cam); |
1594 | 1633 | ||
1595 | if (count > f->buf.bytesused) | 1634 | PDBGG("Frame #%lu, bytes read: %zu", |
1596 | count = f->buf.bytesused; | 1635 | (unsigned long)f->buf.index, count); |
1597 | |||
1598 | if (copy_to_user(buf, f->bufmem, count)) { | ||
1599 | up(&cam->fileop_sem); | ||
1600 | return -EFAULT; | ||
1601 | } | ||
1602 | *f_pos += count; | ||
1603 | |||
1604 | PDBGG("Frame #%lu, bytes read: %zu", (unsigned long)f->buf.index,count) | ||
1605 | 1636 | ||
1606 | up(&cam->fileop_sem); | 1637 | up(&cam->fileop_sem); |
1607 | 1638 | ||
@@ -1612,33 +1643,42 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
1612 | static unsigned int sn9c102_poll(struct file *filp, poll_table *wait) | 1643 | static unsigned int sn9c102_poll(struct file *filp, poll_table *wait) |
1613 | { | 1644 | { |
1614 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | 1645 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); |
1646 | struct sn9c102_frame_t* f; | ||
1647 | unsigned long lock_flags; | ||
1615 | unsigned int mask = 0; | 1648 | unsigned int mask = 0; |
1616 | 1649 | ||
1617 | if (down_interruptible(&cam->fileop_sem)) | 1650 | if (down_interruptible(&cam->fileop_sem)) |
1618 | return POLLERR; | 1651 | return POLLERR; |
1619 | 1652 | ||
1620 | if (cam->state & DEV_DISCONNECTED) { | 1653 | if (cam->state & DEV_DISCONNECTED) { |
1621 | DBG(1, "Device not present") | 1654 | DBG(1, "Device not present"); |
1622 | goto error; | 1655 | goto error; |
1623 | } | 1656 | } |
1624 | 1657 | ||
1625 | if (cam->state & DEV_MISCONFIGURED) { | 1658 | if (cam->state & DEV_MISCONFIGURED) { |
1626 | DBG(1, "The camera is misconfigured. Close and open it again.") | 1659 | DBG(1, "The camera is misconfigured. Close and open it " |
1660 | "again."); | ||
1627 | goto error; | 1661 | goto error; |
1628 | } | 1662 | } |
1629 | 1663 | ||
1630 | if (cam->io == IO_NONE) { | 1664 | if (cam->io == IO_NONE) { |
1631 | if (!sn9c102_request_buffers(cam, cam->nreadbuffers, | 1665 | if (!sn9c102_request_buffers(cam, cam->nreadbuffers, |
1632 | IO_READ)) { | 1666 | IO_READ)) { |
1633 | DBG(1, "poll() failed, not enough memory") | 1667 | DBG(1, "poll() failed, not enough memory"); |
1634 | goto error; | 1668 | goto error; |
1635 | } | 1669 | } |
1636 | cam->io = IO_READ; | 1670 | cam->io = IO_READ; |
1637 | cam->stream = STREAM_ON; | 1671 | cam->stream = STREAM_ON; |
1638 | } | 1672 | } |
1639 | 1673 | ||
1640 | if (cam->io == IO_READ) | 1674 | if (cam->io == IO_READ) { |
1675 | spin_lock_irqsave(&cam->queue_lock, lock_flags); | ||
1676 | list_for_each_entry(f, &cam->outqueue, frame) | ||
1677 | f->state = F_UNUSED; | ||
1678 | INIT_LIST_HEAD(&cam->outqueue); | ||
1679 | spin_unlock_irqrestore(&cam->queue_lock, lock_flags); | ||
1641 | sn9c102_queue_unusedframes(cam); | 1680 | sn9c102_queue_unusedframes(cam); |
1681 | } | ||
1642 | 1682 | ||
1643 | poll_wait(filp, &cam->wait_frame, wait); | 1683 | poll_wait(filp, &cam->wait_frame, wait); |
1644 | 1684 | ||
@@ -1680,22 +1720,22 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) | |||
1680 | { | 1720 | { |
1681 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | 1721 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); |
1682 | unsigned long size = vma->vm_end - vma->vm_start, | 1722 | unsigned long size = vma->vm_end - vma->vm_start, |
1683 | start = vma->vm_start, | 1723 | start = vma->vm_start; |
1684 | pos, | 1724 | void *pos; |
1685 | page; | ||
1686 | u32 i; | 1725 | u32 i; |
1687 | 1726 | ||
1688 | if (down_interruptible(&cam->fileop_sem)) | 1727 | if (down_interruptible(&cam->fileop_sem)) |
1689 | return -ERESTARTSYS; | 1728 | return -ERESTARTSYS; |
1690 | 1729 | ||
1691 | if (cam->state & DEV_DISCONNECTED) { | 1730 | if (cam->state & DEV_DISCONNECTED) { |
1692 | DBG(1, "Device not present") | 1731 | DBG(1, "Device not present"); |
1693 | up(&cam->fileop_sem); | 1732 | up(&cam->fileop_sem); |
1694 | return -ENODEV; | 1733 | return -ENODEV; |
1695 | } | 1734 | } |
1696 | 1735 | ||
1697 | if (cam->state & DEV_MISCONFIGURED) { | 1736 | if (cam->state & DEV_MISCONFIGURED) { |
1698 | DBG(1, "The camera is misconfigured. Close and open it again.") | 1737 | DBG(1, "The camera is misconfigured. Close and open it " |
1738 | "again."); | ||
1699 | up(&cam->fileop_sem); | 1739 | up(&cam->fileop_sem); |
1700 | return -EIO; | 1740 | return -EIO; |
1701 | } | 1741 | } |
@@ -1715,15 +1755,12 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) | |||
1715 | return -EINVAL; | 1755 | return -EINVAL; |
1716 | } | 1756 | } |
1717 | 1757 | ||
1718 | /* VM_IO is eventually going to replace PageReserved altogether */ | ||
1719 | vma->vm_flags |= VM_IO; | 1758 | vma->vm_flags |= VM_IO; |
1720 | vma->vm_flags |= VM_RESERVED; /* avoid to swap out this VMA */ | 1759 | vma->vm_flags |= VM_RESERVED; |
1721 | 1760 | ||
1722 | pos = (unsigned long)cam->frame[i].bufmem; | 1761 | pos = cam->frame[i].bufmem; |
1723 | while (size > 0) { /* size is page-aligned */ | 1762 | while (size > 0) { /* size is page-aligned */ |
1724 | page = vmalloc_to_pfn((void *)pos); | 1763 | if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { |
1725 | if (remap_pfn_range(vma, start, page, PAGE_SIZE, | ||
1726 | vma->vm_page_prot)) { | ||
1727 | up(&cam->fileop_sem); | 1764 | up(&cam->fileop_sem); |
1728 | return -EAGAIN; | 1765 | return -EAGAIN; |
1729 | } | 1766 | } |
@@ -1742,738 +1779,861 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) | |||
1742 | return 0; | 1779 | return 0; |
1743 | } | 1780 | } |
1744 | 1781 | ||
1782 | /*****************************************************************************/ | ||
1745 | 1783 | ||
1746 | static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, | 1784 | static int |
1747 | unsigned int cmd, void __user * arg) | 1785 | sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg) |
1748 | { | 1786 | { |
1749 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | 1787 | struct v4l2_capability cap = { |
1788 | .driver = "sn9c102", | ||
1789 | .version = SN9C102_MODULE_VERSION_CODE, | ||
1790 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | | ||
1791 | V4L2_CAP_STREAMING, | ||
1792 | }; | ||
1793 | |||
1794 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); | ||
1795 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) | ||
1796 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, | ||
1797 | sizeof(cap.bus_info)); | ||
1798 | |||
1799 | if (copy_to_user(arg, &cap, sizeof(cap))) | ||
1800 | return -EFAULT; | ||
1750 | 1801 | ||
1751 | switch (cmd) { | 1802 | return 0; |
1803 | } | ||
1752 | 1804 | ||
1753 | case VIDIOC_QUERYCAP: | ||
1754 | { | ||
1755 | struct v4l2_capability cap = { | ||
1756 | .driver = "sn9c102", | ||
1757 | .version = SN9C102_MODULE_VERSION_CODE, | ||
1758 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | | ||
1759 | V4L2_CAP_READWRITE | | ||
1760 | V4L2_CAP_STREAMING, | ||
1761 | }; | ||
1762 | |||
1763 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); | ||
1764 | if (usb_make_path(cam->usbdev, cap.bus_info, | ||
1765 | sizeof(cap.bus_info)) < 0) | ||
1766 | strlcpy(cap.bus_info, cam->dev.bus_id, | ||
1767 | sizeof(cap.bus_info)); | ||
1768 | |||
1769 | if (copy_to_user(arg, &cap, sizeof(cap))) | ||
1770 | return -EFAULT; | ||
1771 | 1805 | ||
1772 | return 0; | 1806 | static int |
1773 | } | 1807 | sn9c102_vidioc_enuminput(struct sn9c102_device* cam, void __user * arg) |
1808 | { | ||
1809 | struct v4l2_input i; | ||
1774 | 1810 | ||
1775 | case VIDIOC_ENUMINPUT: | 1811 | if (copy_from_user(&i, arg, sizeof(i))) |
1776 | { | 1812 | return -EFAULT; |
1777 | struct v4l2_input i; | ||
1778 | 1813 | ||
1779 | if (copy_from_user(&i, arg, sizeof(i))) | 1814 | if (i.index) |
1780 | return -EFAULT; | 1815 | return -EINVAL; |
1781 | 1816 | ||
1782 | if (i.index) | 1817 | memset(&i, 0, sizeof(i)); |
1783 | return -EINVAL; | 1818 | strcpy(i.name, "Camera"); |
1784 | 1819 | ||
1785 | memset(&i, 0, sizeof(i)); | 1820 | if (copy_to_user(arg, &i, sizeof(i))) |
1786 | strcpy(i.name, "USB"); | 1821 | return -EFAULT; |
1787 | 1822 | ||
1788 | if (copy_to_user(arg, &i, sizeof(i))) | 1823 | return 0; |
1789 | return -EFAULT; | 1824 | } |
1790 | 1825 | ||
1791 | return 0; | ||
1792 | } | ||
1793 | 1826 | ||
1794 | case VIDIOC_G_INPUT: | 1827 | static int |
1795 | case VIDIOC_S_INPUT: | 1828 | sn9c102_vidioc_gs_input(struct sn9c102_device* cam, void __user * arg) |
1796 | { | 1829 | { |
1797 | int index; | 1830 | int index; |
1798 | 1831 | ||
1799 | if (copy_from_user(&index, arg, sizeof(index))) | 1832 | if (copy_from_user(&index, arg, sizeof(index))) |
1800 | return -EFAULT; | 1833 | return -EFAULT; |
1801 | 1834 | ||
1802 | if (index != 0) | 1835 | if (index != 0) |
1803 | return -EINVAL; | 1836 | return -EINVAL; |
1804 | 1837 | ||
1805 | return 0; | 1838 | return 0; |
1806 | } | 1839 | } |
1807 | 1840 | ||
1808 | case VIDIOC_QUERYCTRL: | ||
1809 | { | ||
1810 | struct sn9c102_sensor* s = cam->sensor; | ||
1811 | struct v4l2_queryctrl qc; | ||
1812 | u8 i; | ||
1813 | 1841 | ||
1814 | if (copy_from_user(&qc, arg, sizeof(qc))) | 1842 | static int |
1815 | return -EFAULT; | 1843 | sn9c102_vidioc_query_ctrl(struct sn9c102_device* cam, void __user * arg) |
1844 | { | ||
1845 | struct sn9c102_sensor* s = cam->sensor; | ||
1846 | struct v4l2_queryctrl qc; | ||
1847 | u8 i; | ||
1816 | 1848 | ||
1849 | if (copy_from_user(&qc, arg, sizeof(qc))) | ||
1850 | return -EFAULT; | ||
1851 | |||
1852 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) | ||
1853 | if (qc.id && qc.id == s->qctrl[i].id) { | ||
1854 | memcpy(&qc, &(s->qctrl[i]), sizeof(qc)); | ||
1855 | if (copy_to_user(arg, &qc, sizeof(qc))) | ||
1856 | return -EFAULT; | ||
1857 | return 0; | ||
1858 | } | ||
1859 | |||
1860 | return -EINVAL; | ||
1861 | } | ||
1862 | |||
1863 | |||
1864 | static int | ||
1865 | sn9c102_vidioc_g_ctrl(struct sn9c102_device* cam, void __user * arg) | ||
1866 | { | ||
1867 | struct sn9c102_sensor* s = cam->sensor; | ||
1868 | struct v4l2_control ctrl; | ||
1869 | int err = 0; | ||
1870 | u8 i; | ||
1871 | |||
1872 | if (!s->get_ctrl && !s->set_ctrl) | ||
1873 | return -EINVAL; | ||
1874 | |||
1875 | if (copy_from_user(&ctrl, arg, sizeof(ctrl))) | ||
1876 | return -EFAULT; | ||
1877 | |||
1878 | if (!s->get_ctrl) { | ||
1817 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) | 1879 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) |
1818 | if (qc.id && qc.id == s->qctrl[i].id) { | 1880 | if (ctrl.id && ctrl.id == s->qctrl[i].id) { |
1819 | memcpy(&qc, &(s->qctrl[i]), sizeof(qc)); | 1881 | ctrl.value = s->_qctrl[i].default_value; |
1820 | if (copy_to_user(arg, &qc, sizeof(qc))) | 1882 | goto exit; |
1821 | return -EFAULT; | ||
1822 | return 0; | ||
1823 | } | 1883 | } |
1824 | |||
1825 | return -EINVAL; | 1884 | return -EINVAL; |
1826 | } | 1885 | } else |
1886 | err = s->get_ctrl(cam, &ctrl); | ||
1827 | 1887 | ||
1828 | case VIDIOC_G_CTRL: | 1888 | exit: |
1829 | { | 1889 | if (copy_to_user(arg, &ctrl, sizeof(ctrl))) |
1830 | struct sn9c102_sensor* s = cam->sensor; | 1890 | return -EFAULT; |
1831 | struct v4l2_control ctrl; | ||
1832 | int err = 0; | ||
1833 | 1891 | ||
1834 | if (!s->get_ctrl) | 1892 | return err; |
1835 | return -EINVAL; | 1893 | } |
1836 | 1894 | ||
1837 | if (copy_from_user(&ctrl, arg, sizeof(ctrl))) | ||
1838 | return -EFAULT; | ||
1839 | 1895 | ||
1840 | err = s->get_ctrl(cam, &ctrl); | 1896 | static int |
1897 | sn9c102_vidioc_s_ctrl(struct sn9c102_device* cam, void __user * arg) | ||
1898 | { | ||
1899 | struct sn9c102_sensor* s = cam->sensor; | ||
1900 | struct v4l2_control ctrl; | ||
1901 | u8 i; | ||
1902 | int err = 0; | ||
1841 | 1903 | ||
1842 | if (copy_to_user(arg, &ctrl, sizeof(ctrl))) | 1904 | if (!s->set_ctrl) |
1843 | return -EFAULT; | 1905 | return -EINVAL; |
1906 | |||
1907 | if (copy_from_user(&ctrl, arg, sizeof(ctrl))) | ||
1908 | return -EFAULT; | ||
1844 | 1909 | ||
1910 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) | ||
1911 | if (ctrl.id == s->qctrl[i].id) { | ||
1912 | if (ctrl.value < s->qctrl[i].minimum || | ||
1913 | ctrl.value > s->qctrl[i].maximum) | ||
1914 | return -ERANGE; | ||
1915 | ctrl.value -= ctrl.value % s->qctrl[i].step; | ||
1916 | break; | ||
1917 | } | ||
1918 | |||
1919 | if ((err = s->set_ctrl(cam, &ctrl))) | ||
1845 | return err; | 1920 | return err; |
1846 | } | ||
1847 | 1921 | ||
1848 | case VIDIOC_S_CTRL_OLD: | 1922 | s->_qctrl[i].default_value = ctrl.value; |
1849 | case VIDIOC_S_CTRL: | ||
1850 | { | ||
1851 | struct sn9c102_sensor* s = cam->sensor; | ||
1852 | struct v4l2_control ctrl; | ||
1853 | u8 i; | ||
1854 | int err = 0; | ||
1855 | 1923 | ||
1856 | if (!s->set_ctrl) | 1924 | PDBGG("VIDIOC_S_CTRL: id %lu, value %lu", |
1857 | return -EINVAL; | 1925 | (unsigned long)ctrl.id, (unsigned long)ctrl.value); |
1858 | 1926 | ||
1859 | if (copy_from_user(&ctrl, arg, sizeof(ctrl))) | 1927 | return 0; |
1860 | return -EFAULT; | 1928 | } |
1861 | 1929 | ||
1862 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) | 1930 | |
1863 | if (ctrl.id == s->qctrl[i].id) { | 1931 | static int |
1864 | if (ctrl.value < s->qctrl[i].minimum || | 1932 | sn9c102_vidioc_cropcap(struct sn9c102_device* cam, void __user * arg) |
1865 | ctrl.value > s->qctrl[i].maximum) | 1933 | { |
1866 | return -ERANGE; | 1934 | struct v4l2_cropcap* cc = &(cam->sensor->cropcap); |
1867 | ctrl.value -= ctrl.value % s->qctrl[i].step; | 1935 | |
1868 | break; | 1936 | cc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1937 | cc->pixelaspect.numerator = 1; | ||
1938 | cc->pixelaspect.denominator = 1; | ||
1939 | |||
1940 | if (copy_to_user(arg, cc, sizeof(*cc))) | ||
1941 | return -EFAULT; | ||
1942 | |||
1943 | return 0; | ||
1944 | } | ||
1945 | |||
1946 | |||
1947 | static int | ||
1948 | sn9c102_vidioc_g_crop(struct sn9c102_device* cam, void __user * arg) | ||
1949 | { | ||
1950 | struct sn9c102_sensor* s = cam->sensor; | ||
1951 | struct v4l2_crop crop = { | ||
1952 | .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, | ||
1953 | }; | ||
1954 | |||
1955 | memcpy(&(crop.c), &(s->_rect), sizeof(struct v4l2_rect)); | ||
1956 | |||
1957 | if (copy_to_user(arg, &crop, sizeof(crop))) | ||
1958 | return -EFAULT; | ||
1959 | |||
1960 | return 0; | ||
1961 | } | ||
1962 | |||
1963 | |||
1964 | static int | ||
1965 | sn9c102_vidioc_s_crop(struct sn9c102_device* cam, void __user * arg) | ||
1966 | { | ||
1967 | struct sn9c102_sensor* s = cam->sensor; | ||
1968 | struct v4l2_crop crop; | ||
1969 | struct v4l2_rect* rect; | ||
1970 | struct v4l2_rect* bounds = &(s->cropcap.bounds); | ||
1971 | struct v4l2_pix_format* pix_format = &(s->pix_format); | ||
1972 | u8 scale; | ||
1973 | const enum sn9c102_stream_state stream = cam->stream; | ||
1974 | const u32 nbuffers = cam->nbuffers; | ||
1975 | u32 i; | ||
1976 | int err = 0; | ||
1977 | |||
1978 | if (copy_from_user(&crop, arg, sizeof(crop))) | ||
1979 | return -EFAULT; | ||
1980 | |||
1981 | rect = &(crop.c); | ||
1982 | |||
1983 | if (crop.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1984 | return -EINVAL; | ||
1985 | |||
1986 | if (cam->module_param.force_munmap) | ||
1987 | for (i = 0; i < cam->nbuffers; i++) | ||
1988 | if (cam->frame[i].vma_use_count) { | ||
1989 | DBG(3, "VIDIOC_S_CROP failed. " | ||
1990 | "Unmap the buffers first."); | ||
1991 | return -EINVAL; | ||
1869 | } | 1992 | } |
1870 | 1993 | ||
1871 | if ((err = s->set_ctrl(cam, &ctrl))) | 1994 | /* Preserve R,G or B origin */ |
1995 | rect->left = (s->_rect.left & 1L) ? rect->left | 1L : rect->left & ~1L; | ||
1996 | rect->top = (s->_rect.top & 1L) ? rect->top | 1L : rect->top & ~1L; | ||
1997 | |||
1998 | if (rect->width < 16) | ||
1999 | rect->width = 16; | ||
2000 | if (rect->height < 16) | ||
2001 | rect->height = 16; | ||
2002 | if (rect->width > bounds->width) | ||
2003 | rect->width = bounds->width; | ||
2004 | if (rect->height > bounds->height) | ||
2005 | rect->height = bounds->height; | ||
2006 | if (rect->left < bounds->left) | ||
2007 | rect->left = bounds->left; | ||
2008 | if (rect->top < bounds->top) | ||
2009 | rect->top = bounds->top; | ||
2010 | if (rect->left + rect->width > bounds->left + bounds->width) | ||
2011 | rect->left = bounds->left+bounds->width - rect->width; | ||
2012 | if (rect->top + rect->height > bounds->top + bounds->height) | ||
2013 | rect->top = bounds->top+bounds->height - rect->height; | ||
2014 | |||
2015 | rect->width &= ~15L; | ||
2016 | rect->height &= ~15L; | ||
2017 | |||
2018 | if (SN9C102_PRESERVE_IMGSCALE) { | ||
2019 | /* Calculate the actual scaling factor */ | ||
2020 | u32 a, b; | ||
2021 | a = rect->width * rect->height; | ||
2022 | b = pix_format->width * pix_format->height; | ||
2023 | scale = b ? (u8)((a / b) < 4 ? 1 : ((a / b) < 16 ? 2 : 4)) : 1; | ||
2024 | } else | ||
2025 | scale = 1; | ||
2026 | |||
2027 | if (cam->stream == STREAM_ON) | ||
2028 | if ((err = sn9c102_stream_interrupt(cam))) | ||
1872 | return err; | 2029 | return err; |
1873 | 2030 | ||
1874 | s->_qctrl[i].default_value = ctrl.value; | 2031 | if (copy_to_user(arg, &crop, sizeof(crop))) { |
2032 | cam->stream = stream; | ||
2033 | return -EFAULT; | ||
2034 | } | ||
2035 | |||
2036 | if (cam->module_param.force_munmap || cam->io == IO_READ) | ||
2037 | sn9c102_release_buffers(cam); | ||
1875 | 2038 | ||
1876 | PDBGG("VIDIOC_S_CTRL: id %lu, value %lu", | 2039 | err = sn9c102_set_crop(cam, rect); |
1877 | (unsigned long)ctrl.id, (unsigned long)ctrl.value) | 2040 | if (s->set_crop) |
2041 | err += s->set_crop(cam, rect); | ||
2042 | err += sn9c102_set_scale(cam, scale); | ||
1878 | 2043 | ||
1879 | return 0; | 2044 | if (err) { /* atomic, no rollback in ioctl() */ |
2045 | cam->state |= DEV_MISCONFIGURED; | ||
2046 | DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To " | ||
2047 | "use the camera, close and open /dev/video%d again.", | ||
2048 | cam->v4ldev->minor); | ||
2049 | return -EIO; | ||
1880 | } | 2050 | } |
1881 | 2051 | ||
1882 | case VIDIOC_CROPCAP: | 2052 | s->pix_format.width = rect->width/scale; |
1883 | { | 2053 | s->pix_format.height = rect->height/scale; |
1884 | struct v4l2_cropcap* cc = &(cam->sensor->cropcap); | 2054 | memcpy(&(s->_rect), rect, sizeof(*rect)); |
1885 | 2055 | ||
1886 | cc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 2056 | if ((cam->module_param.force_munmap || cam->io == IO_READ) && |
1887 | cc->pixelaspect.numerator = 1; | 2057 | nbuffers != sn9c102_request_buffers(cam, nbuffers, cam->io)) { |
1888 | cc->pixelaspect.denominator = 1; | 2058 | cam->state |= DEV_MISCONFIGURED; |
2059 | DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To " | ||
2060 | "use the camera, close and open /dev/video%d again.", | ||
2061 | cam->v4ldev->minor); | ||
2062 | return -ENOMEM; | ||
2063 | } | ||
1889 | 2064 | ||
1890 | if (copy_to_user(arg, cc, sizeof(*cc))) | 2065 | if (cam->io == IO_READ) |
1891 | return -EFAULT; | 2066 | sn9c102_empty_framequeues(cam); |
2067 | else if (cam->module_param.force_munmap) | ||
2068 | sn9c102_requeue_outqueue(cam); | ||
1892 | 2069 | ||
1893 | return 0; | 2070 | cam->stream = stream; |
1894 | } | ||
1895 | 2071 | ||
1896 | case VIDIOC_G_CROP: | 2072 | return 0; |
1897 | { | 2073 | } |
1898 | struct sn9c102_sensor* s = cam->sensor; | ||
1899 | struct v4l2_crop crop = { | ||
1900 | .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, | ||
1901 | }; | ||
1902 | 2074 | ||
1903 | memcpy(&(crop.c), &(s->_rect), sizeof(struct v4l2_rect)); | ||
1904 | 2075 | ||
1905 | if (copy_to_user(arg, &crop, sizeof(crop))) | 2076 | static int |
1906 | return -EFAULT; | 2077 | sn9c102_vidioc_enum_fmt(struct sn9c102_device* cam, void __user * arg) |
2078 | { | ||
2079 | struct v4l2_fmtdesc fmtd; | ||
1907 | 2080 | ||
1908 | return 0; | 2081 | if (copy_from_user(&fmtd, arg, sizeof(fmtd))) |
1909 | } | 2082 | return -EFAULT; |
1910 | 2083 | ||
1911 | case VIDIOC_S_CROP: | 2084 | if (fmtd.index == 0) { |
1912 | { | 2085 | strcpy(fmtd.description, "bayer rgb"); |
1913 | struct sn9c102_sensor* s = cam->sensor; | 2086 | fmtd.pixelformat = V4L2_PIX_FMT_SBGGR8; |
1914 | struct v4l2_crop crop; | 2087 | } else if (fmtd.index == 1) { |
1915 | struct v4l2_rect* rect; | 2088 | strcpy(fmtd.description, "compressed"); |
1916 | struct v4l2_rect* bounds = &(s->cropcap.bounds); | 2089 | fmtd.pixelformat = V4L2_PIX_FMT_SN9C10X; |
1917 | struct v4l2_pix_format* pix_format = &(s->pix_format); | 2090 | fmtd.flags = V4L2_FMT_FLAG_COMPRESSED; |
1918 | u8 scale; | 2091 | } else |
1919 | const enum sn9c102_stream_state stream = cam->stream; | 2092 | return -EINVAL; |
1920 | const u32 nbuffers = cam->nbuffers; | ||
1921 | u32 i; | ||
1922 | int err = 0; | ||
1923 | |||
1924 | if (copy_from_user(&crop, arg, sizeof(crop))) | ||
1925 | return -EFAULT; | ||
1926 | 2093 | ||
1927 | rect = &(crop.c); | 2094 | fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
2095 | memset(&fmtd.reserved, 0, sizeof(fmtd.reserved)); | ||
1928 | 2096 | ||
1929 | if (crop.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 2097 | if (copy_to_user(arg, &fmtd, sizeof(fmtd))) |
1930 | return -EINVAL; | 2098 | return -EFAULT; |
1931 | 2099 | ||
1932 | if (cam->module_param.force_munmap) | 2100 | return 0; |
1933 | for (i = 0; i < cam->nbuffers; i++) | 2101 | } |
1934 | if (cam->frame[i].vma_use_count) { | ||
1935 | DBG(3, "VIDIOC_S_CROP failed. " | ||
1936 | "Unmap the buffers first.") | ||
1937 | return -EINVAL; | ||
1938 | } | ||
1939 | 2102 | ||
1940 | /* Preserve R,G or B origin */ | ||
1941 | rect->left = (s->_rect.left & 1L) ? | ||
1942 | rect->left | 1L : rect->left & ~1L; | ||
1943 | rect->top = (s->_rect.top & 1L) ? | ||
1944 | rect->top | 1L : rect->top & ~1L; | ||
1945 | |||
1946 | if (rect->width < 16) | ||
1947 | rect->width = 16; | ||
1948 | if (rect->height < 16) | ||
1949 | rect->height = 16; | ||
1950 | if (rect->width > bounds->width) | ||
1951 | rect->width = bounds->width; | ||
1952 | if (rect->height > bounds->height) | ||
1953 | rect->height = bounds->height; | ||
1954 | if (rect->left < bounds->left) | ||
1955 | rect->left = bounds->left; | ||
1956 | if (rect->top < bounds->top) | ||
1957 | rect->top = bounds->top; | ||
1958 | if (rect->left + rect->width > bounds->left + bounds->width) | ||
1959 | rect->left = bounds->left+bounds->width - rect->width; | ||
1960 | if (rect->top + rect->height > bounds->top + bounds->height) | ||
1961 | rect->top = bounds->top+bounds->height - rect->height; | ||
1962 | |||
1963 | rect->width &= ~15L; | ||
1964 | rect->height &= ~15L; | ||
1965 | |||
1966 | if (SN9C102_PRESERVE_IMGSCALE) { | ||
1967 | /* Calculate the actual scaling factor */ | ||
1968 | u32 a, b; | ||
1969 | a = rect->width * rect->height; | ||
1970 | b = pix_format->width * pix_format->height; | ||
1971 | scale = b ? (u8)((a / b) < 4 ? 1 : | ||
1972 | ((a / b) < 16 ? 2 : 4)) : 1; | ||
1973 | } else | ||
1974 | scale = 1; | ||
1975 | |||
1976 | if (cam->stream == STREAM_ON) | ||
1977 | if ((err = sn9c102_stream_interrupt(cam))) | ||
1978 | return err; | ||
1979 | |||
1980 | if (copy_to_user(arg, &crop, sizeof(crop))) { | ||
1981 | cam->stream = stream; | ||
1982 | return -EFAULT; | ||
1983 | } | ||
1984 | 2103 | ||
1985 | if (cam->module_param.force_munmap || cam->io == IO_READ) | 2104 | static int |
1986 | sn9c102_release_buffers(cam); | 2105 | sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) |
2106 | { | ||
2107 | struct v4l2_format format; | ||
2108 | struct v4l2_pix_format* pfmt = &(cam->sensor->pix_format); | ||
1987 | 2109 | ||
1988 | err = sn9c102_set_crop(cam, rect); | 2110 | if (copy_from_user(&format, arg, sizeof(format))) |
1989 | if (s->set_crop) | 2111 | return -EFAULT; |
1990 | err += s->set_crop(cam, rect); | ||
1991 | err += sn9c102_set_scale(cam, scale); | ||
1992 | 2112 | ||
1993 | if (err) { /* atomic, no rollback in ioctl() */ | 2113 | if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1994 | cam->state |= DEV_MISCONFIGURED; | 2114 | return -EINVAL; |
1995 | DBG(1, "VIDIOC_S_CROP failed because of hardware " | ||
1996 | "problems. To use the camera, close and open " | ||
1997 | "/dev/video%d again.", cam->v4ldev->minor) | ||
1998 | return -EIO; | ||
1999 | } | ||
2000 | 2115 | ||
2001 | s->pix_format.width = rect->width/scale; | 2116 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X) |
2002 | s->pix_format.height = rect->height/scale; | 2117 | ? 0 : (pfmt->width * pfmt->priv) / 8; |
2003 | memcpy(&(s->_rect), rect, sizeof(*rect)); | 2118 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); |
2004 | 2119 | pfmt->field = V4L2_FIELD_NONE; | |
2005 | if ((cam->module_param.force_munmap || cam->io == IO_READ) && | 2120 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); |
2006 | nbuffers != sn9c102_request_buffers(cam, nbuffers, | ||
2007 | cam->io)) { | ||
2008 | cam->state |= DEV_MISCONFIGURED; | ||
2009 | DBG(1, "VIDIOC_S_CROP failed because of not enough " | ||
2010 | "memory. To use the camera, close and open " | ||
2011 | "/dev/video%d again.", cam->v4ldev->minor) | ||
2012 | return -ENOMEM; | ||
2013 | } | ||
2014 | 2121 | ||
2015 | cam->stream = stream; | 2122 | if (copy_to_user(arg, &format, sizeof(format))) |
2123 | return -EFAULT; | ||
2016 | 2124 | ||
2017 | return 0; | 2125 | return 0; |
2018 | } | 2126 | } |
2019 | 2127 | ||
2020 | case VIDIOC_ENUM_FMT: | ||
2021 | { | ||
2022 | struct v4l2_fmtdesc fmtd; | ||
2023 | 2128 | ||
2024 | if (copy_from_user(&fmtd, arg, sizeof(fmtd))) | 2129 | static int |
2025 | return -EFAULT; | 2130 | sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, |
2131 | void __user * arg) | ||
2132 | { | ||
2133 | struct sn9c102_sensor* s = cam->sensor; | ||
2134 | struct v4l2_format format; | ||
2135 | struct v4l2_pix_format* pix; | ||
2136 | struct v4l2_pix_format* pfmt = &(s->pix_format); | ||
2137 | struct v4l2_rect* bounds = &(s->cropcap.bounds); | ||
2138 | struct v4l2_rect rect; | ||
2139 | u8 scale; | ||
2140 | const enum sn9c102_stream_state stream = cam->stream; | ||
2141 | const u32 nbuffers = cam->nbuffers; | ||
2142 | u32 i; | ||
2143 | int err = 0; | ||
2026 | 2144 | ||
2027 | if (fmtd.index == 0) { | 2145 | if (copy_from_user(&format, arg, sizeof(format))) |
2028 | strcpy(fmtd.description, "bayer rgb"); | 2146 | return -EFAULT; |
2029 | fmtd.pixelformat = V4L2_PIX_FMT_SBGGR8; | ||
2030 | } else if (fmtd.index == 1) { | ||
2031 | strcpy(fmtd.description, "compressed"); | ||
2032 | fmtd.pixelformat = V4L2_PIX_FMT_SN9C10X; | ||
2033 | fmtd.flags = V4L2_FMT_FLAG_COMPRESSED; | ||
2034 | } else | ||
2035 | return -EINVAL; | ||
2036 | 2147 | ||
2037 | fmtd.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 2148 | pix = &(format.fmt.pix); |
2038 | memset(&fmtd.reserved, 0, sizeof(fmtd.reserved)); | ||
2039 | 2149 | ||
2040 | if (copy_to_user(arg, &fmtd, sizeof(fmtd))) | 2150 | if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
2041 | return -EFAULT; | 2151 | return -EINVAL; |
2042 | 2152 | ||
2043 | return 0; | 2153 | memcpy(&rect, &(s->_rect), sizeof(rect)); |
2154 | |||
2155 | { /* calculate the actual scaling factor */ | ||
2156 | u32 a, b; | ||
2157 | a = rect.width * rect.height; | ||
2158 | b = pix->width * pix->height; | ||
2159 | scale = b ? (u8)((a / b) < 4 ? 1 : ((a / b) < 16 ? 2 : 4)) : 1; | ||
2044 | } | 2160 | } |
2045 | 2161 | ||
2046 | case VIDIOC_G_FMT: | 2162 | rect.width = scale * pix->width; |
2047 | { | 2163 | rect.height = scale * pix->height; |
2048 | struct v4l2_format format; | ||
2049 | struct v4l2_pix_format* pfmt = &(cam->sensor->pix_format); | ||
2050 | 2164 | ||
2051 | if (copy_from_user(&format, arg, sizeof(format))) | 2165 | if (rect.width < 16) |
2052 | return -EFAULT; | 2166 | rect.width = 16; |
2167 | if (rect.height < 16) | ||
2168 | rect.height = 16; | ||
2169 | if (rect.width > bounds->left + bounds->width - rect.left) | ||
2170 | rect.width = bounds->left + bounds->width - rect.left; | ||
2171 | if (rect.height > bounds->top + bounds->height - rect.top) | ||
2172 | rect.height = bounds->top + bounds->height - rect.top; | ||
2053 | 2173 | ||
2054 | if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 2174 | rect.width &= ~15L; |
2055 | return -EINVAL; | 2175 | rect.height &= ~15L; |
2176 | |||
2177 | { /* adjust the scaling factor */ | ||
2178 | u32 a, b; | ||
2179 | a = rect.width * rect.height; | ||
2180 | b = pix->width * pix->height; | ||
2181 | scale = b ? (u8)((a / b) < 4 ? 1 : ((a / b) < 16 ? 2 : 4)) : 1; | ||
2182 | } | ||
2056 | 2183 | ||
2057 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X) | 2184 | pix->width = rect.width / scale; |
2058 | ? 0 : (pfmt->width * pfmt->priv) / 8; | 2185 | pix->height = rect.height / scale; |
2059 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); | ||
2060 | pfmt->field = V4L2_FIELD_NONE; | ||
2061 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); | ||
2062 | 2186 | ||
2187 | if (pix->pixelformat != V4L2_PIX_FMT_SN9C10X && | ||
2188 | pix->pixelformat != V4L2_PIX_FMT_SBGGR8) | ||
2189 | pix->pixelformat = pfmt->pixelformat; | ||
2190 | pix->priv = pfmt->priv; /* bpp */ | ||
2191 | pix->colorspace = pfmt->colorspace; | ||
2192 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) | ||
2193 | ? 0 : (pix->width * pix->priv) / 8; | ||
2194 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); | ||
2195 | pix->field = V4L2_FIELD_NONE; | ||
2196 | |||
2197 | if (cmd == VIDIOC_TRY_FMT) { | ||
2063 | if (copy_to_user(arg, &format, sizeof(format))) | 2198 | if (copy_to_user(arg, &format, sizeof(format))) |
2064 | return -EFAULT; | 2199 | return -EFAULT; |
2065 | |||
2066 | return 0; | 2200 | return 0; |
2067 | } | 2201 | } |
2068 | 2202 | ||
2069 | case VIDIOC_TRY_FMT: | 2203 | if (cam->module_param.force_munmap) |
2070 | case VIDIOC_S_FMT: | 2204 | for (i = 0; i < cam->nbuffers; i++) |
2071 | { | 2205 | if (cam->frame[i].vma_use_count) { |
2072 | struct sn9c102_sensor* s = cam->sensor; | 2206 | DBG(3, "VIDIOC_S_FMT failed. Unmap the " |
2073 | struct v4l2_format format; | 2207 | "buffers first."); |
2074 | struct v4l2_pix_format* pix; | 2208 | return -EINVAL; |
2075 | struct v4l2_pix_format* pfmt = &(s->pix_format); | 2209 | } |
2076 | struct v4l2_rect* bounds = &(s->cropcap.bounds); | ||
2077 | struct v4l2_rect rect; | ||
2078 | u8 scale; | ||
2079 | const enum sn9c102_stream_state stream = cam->stream; | ||
2080 | const u32 nbuffers = cam->nbuffers; | ||
2081 | u32 i; | ||
2082 | int err = 0; | ||
2083 | |||
2084 | if (copy_from_user(&format, arg, sizeof(format))) | ||
2085 | return -EFAULT; | ||
2086 | 2210 | ||
2087 | pix = &(format.fmt.pix); | 2211 | if (cam->stream == STREAM_ON) |
2212 | if ((err = sn9c102_stream_interrupt(cam))) | ||
2213 | return err; | ||
2088 | 2214 | ||
2089 | if (format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 2215 | if (copy_to_user(arg, &format, sizeof(format))) { |
2090 | return -EINVAL; | 2216 | cam->stream = stream; |
2217 | return -EFAULT; | ||
2218 | } | ||
2091 | 2219 | ||
2092 | memcpy(&rect, &(s->_rect), sizeof(rect)); | 2220 | if (cam->module_param.force_munmap || cam->io == IO_READ) |
2221 | sn9c102_release_buffers(cam); | ||
2093 | 2222 | ||
2094 | { /* calculate the actual scaling factor */ | 2223 | err += sn9c102_set_pix_format(cam, pix); |
2095 | u32 a, b; | 2224 | err += sn9c102_set_crop(cam, &rect); |
2096 | a = rect.width * rect.height; | 2225 | if (s->set_pix_format) |
2097 | b = pix->width * pix->height; | 2226 | err += s->set_pix_format(cam, pix); |
2098 | scale = b ? (u8)((a / b) < 4 ? 1 : | 2227 | if (s->set_crop) |
2099 | ((a / b) < 16 ? 2 : 4)) : 1; | 2228 | err += s->set_crop(cam, &rect); |
2100 | } | 2229 | err += sn9c102_set_scale(cam, scale); |
2101 | 2230 | ||
2102 | rect.width = scale * pix->width; | 2231 | if (err) { /* atomic, no rollback in ioctl() */ |
2103 | rect.height = scale * pix->height; | 2232 | cam->state |= DEV_MISCONFIGURED; |
2104 | 2233 | DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To " | |
2105 | if (rect.width < 16) | 2234 | "use the camera, close and open /dev/video%d again.", |
2106 | rect.width = 16; | 2235 | cam->v4ldev->minor); |
2107 | if (rect.height < 16) | 2236 | return -EIO; |
2108 | rect.height = 16; | 2237 | } |
2109 | if (rect.width > bounds->left + bounds->width - rect.left) | ||
2110 | rect.width = bounds->left + bounds->width - rect.left; | ||
2111 | if (rect.height > bounds->top + bounds->height - rect.top) | ||
2112 | rect.height = bounds->top + bounds->height - rect.top; | ||
2113 | |||
2114 | rect.width &= ~15L; | ||
2115 | rect.height &= ~15L; | ||
2116 | |||
2117 | { /* adjust the scaling factor */ | ||
2118 | u32 a, b; | ||
2119 | a = rect.width * rect.height; | ||
2120 | b = pix->width * pix->height; | ||
2121 | scale = b ? (u8)((a / b) < 4 ? 1 : | ||
2122 | ((a / b) < 16 ? 2 : 4)) : 1; | ||
2123 | } | ||
2124 | 2238 | ||
2125 | pix->width = rect.width / scale; | 2239 | memcpy(pfmt, pix, sizeof(*pix)); |
2126 | pix->height = rect.height / scale; | 2240 | memcpy(&(s->_rect), &rect, sizeof(rect)); |
2127 | |||
2128 | if (pix->pixelformat != V4L2_PIX_FMT_SN9C10X && | ||
2129 | pix->pixelformat != V4L2_PIX_FMT_SBGGR8) | ||
2130 | pix->pixelformat = pfmt->pixelformat; | ||
2131 | pix->priv = pfmt->priv; /* bpp */ | ||
2132 | pix->colorspace = pfmt->colorspace; | ||
2133 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) | ||
2134 | ? 0 : (pix->width * pix->priv) / 8; | ||
2135 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); | ||
2136 | pix->field = V4L2_FIELD_NONE; | ||
2137 | |||
2138 | if (cmd == VIDIOC_TRY_FMT) { | ||
2139 | if (copy_to_user(arg, &format, sizeof(format))) | ||
2140 | return -EFAULT; | ||
2141 | return 0; | ||
2142 | } | ||
2143 | 2241 | ||
2144 | if (cam->module_param.force_munmap) | 2242 | if ((cam->module_param.force_munmap || cam->io == IO_READ) && |
2145 | for (i = 0; i < cam->nbuffers; i++) | 2243 | nbuffers != sn9c102_request_buffers(cam, nbuffers, cam->io)) { |
2146 | if (cam->frame[i].vma_use_count) { | 2244 | cam->state |= DEV_MISCONFIGURED; |
2147 | DBG(3, "VIDIOC_S_FMT failed. " | 2245 | DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To " |
2148 | "Unmap the buffers first.") | 2246 | "use the camera, close and open /dev/video%d again.", |
2149 | return -EINVAL; | 2247 | cam->v4ldev->minor); |
2150 | } | 2248 | return -ENOMEM; |
2249 | } | ||
2151 | 2250 | ||
2152 | if (cam->stream == STREAM_ON) | 2251 | if (cam->io == IO_READ) |
2153 | if ((err = sn9c102_stream_interrupt(cam))) | 2252 | sn9c102_empty_framequeues(cam); |
2154 | return err; | 2253 | else if (cam->module_param.force_munmap) |
2254 | sn9c102_requeue_outqueue(cam); | ||
2155 | 2255 | ||
2156 | if (copy_to_user(arg, &format, sizeof(format))) { | 2256 | cam->stream = stream; |
2157 | cam->stream = stream; | ||
2158 | return -EFAULT; | ||
2159 | } | ||
2160 | 2257 | ||
2161 | if (cam->module_param.force_munmap || cam->io == IO_READ) | 2258 | return 0; |
2162 | sn9c102_release_buffers(cam); | 2259 | } |
2163 | |||
2164 | err += sn9c102_set_pix_format(cam, pix); | ||
2165 | err += sn9c102_set_crop(cam, &rect); | ||
2166 | if (s->set_pix_format) | ||
2167 | err += s->set_pix_format(cam, pix); | ||
2168 | if (s->set_crop) | ||
2169 | err += s->set_crop(cam, &rect); | ||
2170 | err += sn9c102_set_scale(cam, scale); | ||
2171 | |||
2172 | if (err) { /* atomic, no rollback in ioctl() */ | ||
2173 | cam->state |= DEV_MISCONFIGURED; | ||
2174 | DBG(1, "VIDIOC_S_FMT failed because of hardware " | ||
2175 | "problems. To use the camera, close and open " | ||
2176 | "/dev/video%d again.", cam->v4ldev->minor) | ||
2177 | return -EIO; | ||
2178 | } | ||
2179 | 2260 | ||
2180 | memcpy(pfmt, pix, sizeof(*pix)); | ||
2181 | memcpy(&(s->_rect), &rect, sizeof(rect)); | ||
2182 | 2261 | ||
2183 | if ((cam->module_param.force_munmap || cam->io == IO_READ) && | 2262 | static int |
2184 | nbuffers != sn9c102_request_buffers(cam, nbuffers, | 2263 | sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) |
2185 | cam->io)) { | 2264 | { |
2186 | cam->state |= DEV_MISCONFIGURED; | 2265 | if (copy_to_user(arg, &cam->compression, |
2187 | DBG(1, "VIDIOC_S_FMT failed because of not enough " | 2266 | sizeof(cam->compression))) |
2188 | "memory. To use the camera, close and open " | 2267 | return -EFAULT; |
2189 | "/dev/video%d again.", cam->v4ldev->minor) | ||
2190 | return -ENOMEM; | ||
2191 | } | ||
2192 | 2268 | ||
2193 | cam->stream = stream; | 2269 | return 0; |
2270 | } | ||
2194 | 2271 | ||
2195 | return 0; | ||
2196 | } | ||
2197 | 2272 | ||
2198 | case VIDIOC_G_JPEGCOMP: | 2273 | static int |
2199 | { | 2274 | sn9c102_vidioc_s_jpegcomp(struct sn9c102_device* cam, void __user * arg) |
2200 | if (copy_to_user(arg, &cam->compression, | 2275 | { |
2201 | sizeof(cam->compression))) | 2276 | struct v4l2_jpegcompression jc; |
2202 | return -EFAULT; | 2277 | const enum sn9c102_stream_state stream = cam->stream; |
2278 | int err = 0; | ||
2203 | 2279 | ||
2204 | return 0; | 2280 | if (copy_from_user(&jc, arg, sizeof(jc))) |
2205 | } | 2281 | return -EFAULT; |
2206 | 2282 | ||
2207 | case VIDIOC_S_JPEGCOMP: | 2283 | if (jc.quality != 0 && jc.quality != 1) |
2208 | { | 2284 | return -EINVAL; |
2209 | struct v4l2_jpegcompression jc; | ||
2210 | const enum sn9c102_stream_state stream = cam->stream; | ||
2211 | int err = 0; | ||
2212 | 2285 | ||
2213 | if (copy_from_user(&jc, arg, sizeof(jc))) | 2286 | if (cam->stream == STREAM_ON) |
2214 | return -EFAULT; | 2287 | if ((err = sn9c102_stream_interrupt(cam))) |
2288 | return err; | ||
2215 | 2289 | ||
2216 | if (jc.quality != 0 && jc.quality != 1) | 2290 | err += sn9c102_set_compression(cam, &jc); |
2217 | return -EINVAL; | 2291 | if (err) { /* atomic, no rollback in ioctl() */ |
2292 | cam->state |= DEV_MISCONFIGURED; | ||
2293 | DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " | ||
2294 | "problems. To use the camera, close and open " | ||
2295 | "/dev/video%d again.", cam->v4ldev->minor); | ||
2296 | return -EIO; | ||
2297 | } | ||
2218 | 2298 | ||
2219 | if (cam->stream == STREAM_ON) | 2299 | cam->compression.quality = jc.quality; |
2220 | if ((err = sn9c102_stream_interrupt(cam))) | ||
2221 | return err; | ||
2222 | 2300 | ||
2223 | err += sn9c102_set_compression(cam, &jc); | 2301 | cam->stream = stream; |
2224 | if (err) { /* atomic, no rollback in ioctl() */ | ||
2225 | cam->state |= DEV_MISCONFIGURED; | ||
2226 | DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware " | ||
2227 | "problems. To use the camera, close and open " | ||
2228 | "/dev/video%d again.", cam->v4ldev->minor) | ||
2229 | return -EIO; | ||
2230 | } | ||
2231 | 2302 | ||
2232 | cam->compression.quality = jc.quality; | 2303 | return 0; |
2304 | } | ||
2233 | 2305 | ||
2234 | cam->stream = stream; | ||
2235 | 2306 | ||
2236 | return 0; | 2307 | static int |
2237 | } | 2308 | sn9c102_vidioc_reqbufs(struct sn9c102_device* cam, void __user * arg) |
2309 | { | ||
2310 | struct v4l2_requestbuffers rb; | ||
2311 | u32 i; | ||
2312 | int err; | ||
2238 | 2313 | ||
2239 | case VIDIOC_REQBUFS: | 2314 | if (copy_from_user(&rb, arg, sizeof(rb))) |
2240 | { | 2315 | return -EFAULT; |
2241 | struct v4l2_requestbuffers rb; | ||
2242 | u32 i; | ||
2243 | int err; | ||
2244 | 2316 | ||
2245 | if (copy_from_user(&rb, arg, sizeof(rb))) | 2317 | if (rb.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || |
2246 | return -EFAULT; | 2318 | rb.memory != V4L2_MEMORY_MMAP) |
2319 | return -EINVAL; | ||
2247 | 2320 | ||
2248 | if (rb.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || | 2321 | if (cam->io == IO_READ) { |
2249 | rb.memory != V4L2_MEMORY_MMAP) | 2322 | DBG(3, "Close and open the device again to choose the mmap " |
2250 | return -EINVAL; | 2323 | "I/O method"); |
2324 | return -EINVAL; | ||
2325 | } | ||
2251 | 2326 | ||
2252 | if (cam->io == IO_READ) { | 2327 | for (i = 0; i < cam->nbuffers; i++) |
2253 | DBG(3, "Close and open the device again to choose " | 2328 | if (cam->frame[i].vma_use_count) { |
2254 | "the mmap I/O method") | 2329 | DBG(3, "VIDIOC_REQBUFS failed. Previous buffers are " |
2330 | "still mapped."); | ||
2255 | return -EINVAL; | 2331 | return -EINVAL; |
2256 | } | 2332 | } |
2257 | 2333 | ||
2258 | for (i = 0; i < cam->nbuffers; i++) | 2334 | if (cam->stream == STREAM_ON) |
2259 | if (cam->frame[i].vma_use_count) { | 2335 | if ((err = sn9c102_stream_interrupt(cam))) |
2260 | DBG(3, "VIDIOC_REQBUFS failed. " | 2336 | return err; |
2261 | "Previous buffers are still mapped.") | ||
2262 | return -EINVAL; | ||
2263 | } | ||
2264 | 2337 | ||
2265 | if (cam->stream == STREAM_ON) | 2338 | sn9c102_empty_framequeues(cam); |
2266 | if ((err = sn9c102_stream_interrupt(cam))) | ||
2267 | return err; | ||
2268 | 2339 | ||
2269 | sn9c102_empty_framequeues(cam); | 2340 | sn9c102_release_buffers(cam); |
2341 | if (rb.count) | ||
2342 | rb.count = sn9c102_request_buffers(cam, rb.count, IO_MMAP); | ||
2270 | 2343 | ||
2344 | if (copy_to_user(arg, &rb, sizeof(rb))) { | ||
2271 | sn9c102_release_buffers(cam); | 2345 | sn9c102_release_buffers(cam); |
2272 | if (rb.count) | 2346 | cam->io = IO_NONE; |
2273 | rb.count = sn9c102_request_buffers(cam, rb.count, | 2347 | return -EFAULT; |
2274 | IO_MMAP); | 2348 | } |
2275 | 2349 | ||
2276 | if (copy_to_user(arg, &rb, sizeof(rb))) { | 2350 | cam->io = rb.count ? IO_MMAP : IO_NONE; |
2277 | sn9c102_release_buffers(cam); | ||
2278 | cam->io = IO_NONE; | ||
2279 | return -EFAULT; | ||
2280 | } | ||
2281 | 2351 | ||
2282 | cam->io = rb.count ? IO_MMAP : IO_NONE; | 2352 | return 0; |
2353 | } | ||
2283 | 2354 | ||
2284 | return 0; | ||
2285 | } | ||
2286 | 2355 | ||
2287 | case VIDIOC_QUERYBUF: | 2356 | static int |
2288 | { | 2357 | sn9c102_vidioc_querybuf(struct sn9c102_device* cam, void __user * arg) |
2289 | struct v4l2_buffer b; | 2358 | { |
2359 | struct v4l2_buffer b; | ||
2290 | 2360 | ||
2291 | if (copy_from_user(&b, arg, sizeof(b))) | 2361 | if (copy_from_user(&b, arg, sizeof(b))) |
2292 | return -EFAULT; | 2362 | return -EFAULT; |
2293 | 2363 | ||
2294 | if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || | 2364 | if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || |
2295 | b.index >= cam->nbuffers || cam->io != IO_MMAP) | 2365 | b.index >= cam->nbuffers || cam->io != IO_MMAP) |
2296 | return -EINVAL; | 2366 | return -EINVAL; |
2297 | 2367 | ||
2298 | memcpy(&b, &cam->frame[b.index].buf, sizeof(b)); | 2368 | memcpy(&b, &cam->frame[b.index].buf, sizeof(b)); |
2299 | 2369 | ||
2300 | if (cam->frame[b.index].vma_use_count) | 2370 | if (cam->frame[b.index].vma_use_count) |
2301 | b.flags |= V4L2_BUF_FLAG_MAPPED; | 2371 | b.flags |= V4L2_BUF_FLAG_MAPPED; |
2302 | 2372 | ||
2303 | if (cam->frame[b.index].state == F_DONE) | 2373 | if (cam->frame[b.index].state == F_DONE) |
2304 | b.flags |= V4L2_BUF_FLAG_DONE; | 2374 | b.flags |= V4L2_BUF_FLAG_DONE; |
2305 | else if (cam->frame[b.index].state != F_UNUSED) | 2375 | else if (cam->frame[b.index].state != F_UNUSED) |
2306 | b.flags |= V4L2_BUF_FLAG_QUEUED; | 2376 | b.flags |= V4L2_BUF_FLAG_QUEUED; |
2307 | 2377 | ||
2308 | if (copy_to_user(arg, &b, sizeof(b))) | 2378 | if (copy_to_user(arg, &b, sizeof(b))) |
2309 | return -EFAULT; | 2379 | return -EFAULT; |
2310 | 2380 | ||
2311 | return 0; | 2381 | return 0; |
2312 | } | 2382 | } |
2313 | 2383 | ||
2314 | case VIDIOC_QBUF: | ||
2315 | { | ||
2316 | struct v4l2_buffer b; | ||
2317 | unsigned long lock_flags; | ||
2318 | 2384 | ||
2319 | if (copy_from_user(&b, arg, sizeof(b))) | 2385 | static int |
2320 | return -EFAULT; | 2386 | sn9c102_vidioc_qbuf(struct sn9c102_device* cam, void __user * arg) |
2387 | { | ||
2388 | struct v4l2_buffer b; | ||
2389 | unsigned long lock_flags; | ||
2321 | 2390 | ||
2322 | if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || | 2391 | if (copy_from_user(&b, arg, sizeof(b))) |
2323 | b.index >= cam->nbuffers || cam->io != IO_MMAP) | 2392 | return -EFAULT; |
2324 | return -EINVAL; | ||
2325 | 2393 | ||
2326 | if (cam->frame[b.index].state != F_UNUSED) | 2394 | if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || |
2327 | return -EINVAL; | 2395 | b.index >= cam->nbuffers || cam->io != IO_MMAP) |
2396 | return -EINVAL; | ||
2328 | 2397 | ||
2329 | cam->frame[b.index].state = F_QUEUED; | 2398 | if (cam->frame[b.index].state != F_UNUSED) |
2399 | return -EINVAL; | ||
2330 | 2400 | ||
2331 | spin_lock_irqsave(&cam->queue_lock, lock_flags); | 2401 | cam->frame[b.index].state = F_QUEUED; |
2332 | list_add_tail(&cam->frame[b.index].frame, &cam->inqueue); | ||
2333 | spin_unlock_irqrestore(&cam->queue_lock, lock_flags); | ||
2334 | 2402 | ||
2335 | PDBGG("Frame #%lu queued", (unsigned long)b.index) | 2403 | spin_lock_irqsave(&cam->queue_lock, lock_flags); |
2404 | list_add_tail(&cam->frame[b.index].frame, &cam->inqueue); | ||
2405 | spin_unlock_irqrestore(&cam->queue_lock, lock_flags); | ||
2336 | 2406 | ||
2337 | return 0; | 2407 | PDBGG("Frame #%lu queued", (unsigned long)b.index); |
2338 | } | ||
2339 | 2408 | ||
2340 | case VIDIOC_DQBUF: | 2409 | return 0; |
2341 | { | 2410 | } |
2342 | struct v4l2_buffer b; | ||
2343 | struct sn9c102_frame_t *f; | ||
2344 | unsigned long lock_flags; | ||
2345 | int err = 0; | ||
2346 | 2411 | ||
2347 | if (copy_from_user(&b, arg, sizeof(b))) | ||
2348 | return -EFAULT; | ||
2349 | 2412 | ||
2350 | if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io!= IO_MMAP) | 2413 | static int |
2414 | sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, | ||
2415 | void __user * arg) | ||
2416 | { | ||
2417 | struct v4l2_buffer b; | ||
2418 | struct sn9c102_frame_t *f; | ||
2419 | unsigned long lock_flags; | ||
2420 | int err = 0; | ||
2421 | |||
2422 | if (copy_from_user(&b, arg, sizeof(b))) | ||
2423 | return -EFAULT; | ||
2424 | |||
2425 | if (b.type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) | ||
2426 | return -EINVAL; | ||
2427 | |||
2428 | if (list_empty(&cam->outqueue)) { | ||
2429 | if (cam->stream == STREAM_OFF) | ||
2351 | return -EINVAL; | 2430 | return -EINVAL; |
2431 | if (filp->f_flags & O_NONBLOCK) | ||
2432 | return -EAGAIN; | ||
2433 | err = wait_event_interruptible | ||
2434 | ( cam->wait_frame, | ||
2435 | (!list_empty(&cam->outqueue)) || | ||
2436 | (cam->state & DEV_DISCONNECTED) || | ||
2437 | (cam->state & DEV_MISCONFIGURED) ); | ||
2438 | if (err) | ||
2439 | return err; | ||
2440 | if (cam->state & DEV_DISCONNECTED) | ||
2441 | return -ENODEV; | ||
2442 | if (cam->state & DEV_MISCONFIGURED) | ||
2443 | return -EIO; | ||
2444 | } | ||
2352 | 2445 | ||
2353 | if (list_empty(&cam->outqueue)) { | 2446 | spin_lock_irqsave(&cam->queue_lock, lock_flags); |
2354 | if (cam->stream == STREAM_OFF) | 2447 | f = list_entry(cam->outqueue.next, struct sn9c102_frame_t, frame); |
2355 | return -EINVAL; | 2448 | list_del(cam->outqueue.next); |
2356 | if (filp->f_flags & O_NONBLOCK) | 2449 | spin_unlock_irqrestore(&cam->queue_lock, lock_flags); |
2357 | return -EAGAIN; | ||
2358 | err = wait_event_interruptible | ||
2359 | ( cam->wait_frame, | ||
2360 | (!list_empty(&cam->outqueue)) || | ||
2361 | (cam->state & DEV_DISCONNECTED) || | ||
2362 | (cam->state & DEV_MISCONFIGURED) ); | ||
2363 | if (err) | ||
2364 | return err; | ||
2365 | if (cam->state & DEV_DISCONNECTED) | ||
2366 | return -ENODEV; | ||
2367 | if (cam->state & DEV_MISCONFIGURED) | ||
2368 | return -EIO; | ||
2369 | } | ||
2370 | 2450 | ||
2371 | spin_lock_irqsave(&cam->queue_lock, lock_flags); | 2451 | f->state = F_UNUSED; |
2372 | f = list_entry(cam->outqueue.next, struct sn9c102_frame_t, | ||
2373 | frame); | ||
2374 | list_del(cam->outqueue.next); | ||
2375 | spin_unlock_irqrestore(&cam->queue_lock, lock_flags); | ||
2376 | 2452 | ||
2377 | f->state = F_UNUSED; | 2453 | memcpy(&b, &f->buf, sizeof(b)); |
2454 | if (f->vma_use_count) | ||
2455 | b.flags |= V4L2_BUF_FLAG_MAPPED; | ||
2378 | 2456 | ||
2379 | memcpy(&b, &f->buf, sizeof(b)); | 2457 | if (copy_to_user(arg, &b, sizeof(b))) |
2380 | if (f->vma_use_count) | 2458 | return -EFAULT; |
2381 | b.flags |= V4L2_BUF_FLAG_MAPPED; | ||
2382 | 2459 | ||
2383 | if (copy_to_user(arg, &b, sizeof(b))) | 2460 | PDBGG("Frame #%lu dequeued", (unsigned long)f->buf.index); |
2384 | return -EFAULT; | ||
2385 | 2461 | ||
2386 | PDBGG("Frame #%lu dequeued", (unsigned long)f->buf.index) | 2462 | return 0; |
2463 | } | ||
2387 | 2464 | ||
2388 | return 0; | ||
2389 | } | ||
2390 | 2465 | ||
2391 | case VIDIOC_STREAMON: | 2466 | static int |
2392 | { | 2467 | sn9c102_vidioc_streamon(struct sn9c102_device* cam, void __user * arg) |
2393 | int type; | 2468 | { |
2469 | int type; | ||
2394 | 2470 | ||
2395 | if (copy_from_user(&type, arg, sizeof(type))) | 2471 | if (copy_from_user(&type, arg, sizeof(type))) |
2396 | return -EFAULT; | 2472 | return -EFAULT; |
2397 | 2473 | ||
2398 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) | 2474 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) |
2399 | return -EINVAL; | 2475 | return -EINVAL; |
2400 | 2476 | ||
2401 | if (list_empty(&cam->inqueue)) | 2477 | if (list_empty(&cam->inqueue)) |
2402 | return -EINVAL; | 2478 | return -EINVAL; |
2403 | 2479 | ||
2404 | cam->stream = STREAM_ON; | 2480 | cam->stream = STREAM_ON; |
2405 | 2481 | ||
2406 | DBG(3, "Stream on") | 2482 | DBG(3, "Stream on"); |
2407 | 2483 | ||
2408 | return 0; | 2484 | return 0; |
2409 | } | 2485 | } |
2410 | 2486 | ||
2411 | case VIDIOC_STREAMOFF: | ||
2412 | { | ||
2413 | int type, err; | ||
2414 | 2487 | ||
2415 | if (copy_from_user(&type, arg, sizeof(type))) | 2488 | static int |
2416 | return -EFAULT; | 2489 | sn9c102_vidioc_streamoff(struct sn9c102_device* cam, void __user * arg) |
2490 | { | ||
2491 | int type, err; | ||
2417 | 2492 | ||
2418 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) | 2493 | if (copy_from_user(&type, arg, sizeof(type))) |
2419 | return -EINVAL; | 2494 | return -EFAULT; |
2420 | 2495 | ||
2421 | if (cam->stream == STREAM_ON) | 2496 | if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE || cam->io != IO_MMAP) |
2422 | if ((err = sn9c102_stream_interrupt(cam))) | 2497 | return -EINVAL; |
2423 | return err; | ||
2424 | 2498 | ||
2425 | sn9c102_empty_framequeues(cam); | 2499 | if (cam->stream == STREAM_ON) |
2500 | if ((err = sn9c102_stream_interrupt(cam))) | ||
2501 | return err; | ||
2426 | 2502 | ||
2427 | DBG(3, "Stream off") | 2503 | sn9c102_empty_framequeues(cam); |
2428 | 2504 | ||
2429 | return 0; | 2505 | DBG(3, "Stream off"); |
2430 | } | ||
2431 | 2506 | ||
2432 | case VIDIOC_G_PARM: | 2507 | return 0; |
2433 | { | 2508 | } |
2434 | struct v4l2_streamparm sp; | ||
2435 | 2509 | ||
2436 | if (copy_from_user(&sp, arg, sizeof(sp))) | ||
2437 | return -EFAULT; | ||
2438 | 2510 | ||
2439 | if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 2511 | static int |
2440 | return -EINVAL; | 2512 | sn9c102_vidioc_g_parm(struct sn9c102_device* cam, void __user * arg) |
2513 | { | ||
2514 | struct v4l2_streamparm sp; | ||
2515 | |||
2516 | if (copy_from_user(&sp, arg, sizeof(sp))) | ||
2517 | return -EFAULT; | ||
2518 | |||
2519 | if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
2520 | return -EINVAL; | ||
2521 | |||
2522 | sp.parm.capture.extendedmode = 0; | ||
2523 | sp.parm.capture.readbuffers = cam->nreadbuffers; | ||
2524 | |||
2525 | if (copy_to_user(arg, &sp, sizeof(sp))) | ||
2526 | return -EFAULT; | ||
2527 | |||
2528 | return 0; | ||
2529 | } | ||
2530 | |||
2531 | |||
2532 | static int | ||
2533 | sn9c102_vidioc_s_parm(struct sn9c102_device* cam, void __user * arg) | ||
2534 | { | ||
2535 | struct v4l2_streamparm sp; | ||
2536 | |||
2537 | if (copy_from_user(&sp, arg, sizeof(sp))) | ||
2538 | return -EFAULT; | ||
2539 | |||
2540 | if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
2541 | return -EINVAL; | ||
2542 | |||
2543 | sp.parm.capture.extendedmode = 0; | ||
2441 | 2544 | ||
2442 | sp.parm.capture.extendedmode = 0; | 2545 | if (sp.parm.capture.readbuffers == 0) |
2443 | sp.parm.capture.readbuffers = cam->nreadbuffers; | 2546 | sp.parm.capture.readbuffers = cam->nreadbuffers; |
2444 | 2547 | ||
2445 | if (copy_to_user(arg, &sp, sizeof(sp))) | 2548 | if (sp.parm.capture.readbuffers > SN9C102_MAX_FRAMES) |
2446 | return -EFAULT; | 2549 | sp.parm.capture.readbuffers = SN9C102_MAX_FRAMES; |
2447 | 2550 | ||
2448 | return 0; | 2551 | if (copy_to_user(arg, &sp, sizeof(sp))) |
2449 | } | 2552 | return -EFAULT; |
2450 | 2553 | ||
2451 | case VIDIOC_S_PARM_OLD: | 2554 | cam->nreadbuffers = sp.parm.capture.readbuffers; |
2452 | case VIDIOC_S_PARM: | ||
2453 | { | ||
2454 | struct v4l2_streamparm sp; | ||
2455 | 2555 | ||
2456 | if (copy_from_user(&sp, arg, sizeof(sp))) | 2556 | return 0; |
2457 | return -EFAULT; | 2557 | } |
2458 | 2558 | ||
2459 | if (sp.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
2460 | return -EINVAL; | ||
2461 | 2559 | ||
2462 | sp.parm.capture.extendedmode = 0; | 2560 | static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, |
2561 | unsigned int cmd, void __user * arg) | ||
2562 | { | ||
2563 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | ||
2564 | |||
2565 | switch (cmd) { | ||
2566 | |||
2567 | case VIDIOC_QUERYCAP: | ||
2568 | return sn9c102_vidioc_querycap(cam, arg); | ||
2463 | 2569 | ||
2464 | if (sp.parm.capture.readbuffers == 0) | 2570 | case VIDIOC_ENUMINPUT: |
2465 | sp.parm.capture.readbuffers = cam->nreadbuffers; | 2571 | return sn9c102_vidioc_enuminput(cam, arg); |
2466 | 2572 | ||
2467 | if (sp.parm.capture.readbuffers > SN9C102_MAX_FRAMES) | 2573 | case VIDIOC_G_INPUT: |
2468 | sp.parm.capture.readbuffers = SN9C102_MAX_FRAMES; | 2574 | case VIDIOC_S_INPUT: |
2575 | return sn9c102_vidioc_gs_input(cam, arg); | ||
2469 | 2576 | ||
2470 | if (copy_to_user(arg, &sp, sizeof(sp))) | 2577 | case VIDIOC_QUERYCTRL: |
2471 | return -EFAULT; | 2578 | return sn9c102_vidioc_query_ctrl(cam, arg); |
2472 | 2579 | ||
2473 | cam->nreadbuffers = sp.parm.capture.readbuffers; | 2580 | case VIDIOC_G_CTRL: |
2581 | return sn9c102_vidioc_g_ctrl(cam, arg); | ||
2474 | 2582 | ||
2475 | return 0; | 2583 | case VIDIOC_S_CTRL_OLD: |
2476 | } | 2584 | case VIDIOC_S_CTRL: |
2585 | return sn9c102_vidioc_s_ctrl(cam, arg); | ||
2586 | |||
2587 | case VIDIOC_CROPCAP_OLD: | ||
2588 | case VIDIOC_CROPCAP: | ||
2589 | return sn9c102_vidioc_cropcap(cam, arg); | ||
2590 | |||
2591 | case VIDIOC_G_CROP: | ||
2592 | return sn9c102_vidioc_g_crop(cam, arg); | ||
2593 | |||
2594 | case VIDIOC_S_CROP: | ||
2595 | return sn9c102_vidioc_s_crop(cam, arg); | ||
2596 | |||
2597 | case VIDIOC_ENUM_FMT: | ||
2598 | return sn9c102_vidioc_enum_fmt(cam, arg); | ||
2599 | |||
2600 | case VIDIOC_G_FMT: | ||
2601 | return sn9c102_vidioc_g_fmt(cam, arg); | ||
2602 | |||
2603 | case VIDIOC_TRY_FMT: | ||
2604 | case VIDIOC_S_FMT: | ||
2605 | return sn9c102_vidioc_try_s_fmt(cam, cmd, arg); | ||
2606 | |||
2607 | case VIDIOC_G_JPEGCOMP: | ||
2608 | return sn9c102_vidioc_g_jpegcomp(cam, arg); | ||
2609 | |||
2610 | case VIDIOC_S_JPEGCOMP: | ||
2611 | return sn9c102_vidioc_s_jpegcomp(cam, arg); | ||
2612 | |||
2613 | case VIDIOC_REQBUFS: | ||
2614 | return sn9c102_vidioc_reqbufs(cam, arg); | ||
2615 | |||
2616 | case VIDIOC_QUERYBUF: | ||
2617 | return sn9c102_vidioc_querybuf(cam, arg); | ||
2618 | |||
2619 | case VIDIOC_QBUF: | ||
2620 | return sn9c102_vidioc_qbuf(cam, arg); | ||
2621 | |||
2622 | case VIDIOC_DQBUF: | ||
2623 | return sn9c102_vidioc_dqbuf(cam, filp, arg); | ||
2624 | |||
2625 | case VIDIOC_STREAMON: | ||
2626 | return sn9c102_vidioc_streamon(cam, arg); | ||
2627 | |||
2628 | case VIDIOC_STREAMOFF: | ||
2629 | return sn9c102_vidioc_streamoff(cam, arg); | ||
2630 | |||
2631 | case VIDIOC_G_PARM: | ||
2632 | return sn9c102_vidioc_g_parm(cam, arg); | ||
2633 | |||
2634 | case VIDIOC_S_PARM_OLD: | ||
2635 | case VIDIOC_S_PARM: | ||
2636 | return sn9c102_vidioc_s_parm(cam, arg); | ||
2477 | 2637 | ||
2478 | case VIDIOC_G_STD: | 2638 | case VIDIOC_G_STD: |
2479 | case VIDIOC_S_STD: | 2639 | case VIDIOC_S_STD: |
@@ -2499,17 +2659,20 @@ static int sn9c102_ioctl(struct inode* inode, struct file* filp, | |||
2499 | return -ERESTARTSYS; | 2659 | return -ERESTARTSYS; |
2500 | 2660 | ||
2501 | if (cam->state & DEV_DISCONNECTED) { | 2661 | if (cam->state & DEV_DISCONNECTED) { |
2502 | DBG(1, "Device not present") | 2662 | DBG(1, "Device not present"); |
2503 | up(&cam->fileop_sem); | 2663 | up(&cam->fileop_sem); |
2504 | return -ENODEV; | 2664 | return -ENODEV; |
2505 | } | 2665 | } |
2506 | 2666 | ||
2507 | if (cam->state & DEV_MISCONFIGURED) { | 2667 | if (cam->state & DEV_MISCONFIGURED) { |
2508 | DBG(1, "The camera is misconfigured. Close and open it again.") | 2668 | DBG(1, "The camera is misconfigured. Close and open it " |
2669 | "again."); | ||
2509 | up(&cam->fileop_sem); | 2670 | up(&cam->fileop_sem); |
2510 | return -EIO; | 2671 | return -EIO; |
2511 | } | 2672 | } |
2512 | 2673 | ||
2674 | V4LDBG(3, "sn9c102", cmd); | ||
2675 | |||
2513 | err = sn9c102_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); | 2676 | err = sn9c102_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); |
2514 | 2677 | ||
2515 | up(&cam->fileop_sem); | 2678 | up(&cam->fileop_sem); |
@@ -2517,9 +2680,10 @@ static int sn9c102_ioctl(struct inode* inode, struct file* filp, | |||
2517 | return err; | 2680 | return err; |
2518 | } | 2681 | } |
2519 | 2682 | ||
2683 | /*****************************************************************************/ | ||
2520 | 2684 | ||
2521 | static struct file_operations sn9c102_fops = { | 2685 | static struct file_operations sn9c102_fops = { |
2522 | .owner = THIS_MODULE, | 2686 | .owner = THIS_MODULE, |
2523 | .open = sn9c102_open, | 2687 | .open = sn9c102_open, |
2524 | .release = sn9c102_release, | 2688 | .release = sn9c102_release, |
2525 | .ioctl = sn9c102_ioctl, | 2689 | .ioctl = sn9c102_ioctl, |
@@ -2538,36 +2702,22 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2538 | struct usb_device *udev = interface_to_usbdev(intf); | 2702 | struct usb_device *udev = interface_to_usbdev(intf); |
2539 | struct sn9c102_device* cam; | 2703 | struct sn9c102_device* cam; |
2540 | static unsigned int dev_nr = 0; | 2704 | static unsigned int dev_nr = 0; |
2541 | unsigned int i, n; | 2705 | unsigned int i; |
2542 | int err = 0, r; | 2706 | int err = 0, r; |
2543 | 2707 | ||
2544 | n = ARRAY_SIZE(sn9c102_id_table); | 2708 | if (!(cam = kzalloc(sizeof(struct sn9c102_device), GFP_KERNEL))) |
2545 | for (i = 0; i < n-1; i++) | ||
2546 | if (le16_to_cpu(udev->descriptor.idVendor) == | ||
2547 | sn9c102_id_table[i].idVendor && | ||
2548 | le16_to_cpu(udev->descriptor.idProduct) == | ||
2549 | sn9c102_id_table[i].idProduct) | ||
2550 | break; | ||
2551 | if (i == n-1) | ||
2552 | return -ENODEV; | ||
2553 | |||
2554 | if (!(cam = kmalloc(sizeof(struct sn9c102_device), GFP_KERNEL))) | ||
2555 | return -ENOMEM; | 2709 | return -ENOMEM; |
2556 | memset(cam, 0, sizeof(*cam)); | ||
2557 | 2710 | ||
2558 | cam->usbdev = udev; | 2711 | cam->usbdev = udev; |
2559 | 2712 | ||
2560 | memcpy(&cam->dev, &udev->dev, sizeof(struct device)); | 2713 | if (!(cam->control_buffer = kzalloc(8, GFP_KERNEL))) { |
2561 | 2714 | DBG(1, "kmalloc() failed"); | |
2562 | if (!(cam->control_buffer = kmalloc(8, GFP_KERNEL))) { | ||
2563 | DBG(1, "kmalloc() failed") | ||
2564 | err = -ENOMEM; | 2715 | err = -ENOMEM; |
2565 | goto fail; | 2716 | goto fail; |
2566 | } | 2717 | } |
2567 | memset(cam->control_buffer, 0, 8); | ||
2568 | 2718 | ||
2569 | if (!(cam->v4ldev = video_device_alloc())) { | 2719 | if (!(cam->v4ldev = video_device_alloc())) { |
2570 | DBG(1, "video_device_alloc() failed") | 2720 | DBG(1, "video_device_alloc() failed"); |
2571 | err = -ENOMEM; | 2721 | err = -ENOMEM; |
2572 | goto fail; | 2722 | goto fail; |
2573 | } | 2723 | } |
@@ -2577,25 +2727,22 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2577 | r = sn9c102_read_reg(cam, 0x00); | 2727 | r = sn9c102_read_reg(cam, 0x00); |
2578 | if (r < 0 || r != 0x10) { | 2728 | if (r < 0 || r != 0x10) { |
2579 | DBG(1, "Sorry, this is not a SN9C10x based camera " | 2729 | DBG(1, "Sorry, this is not a SN9C10x based camera " |
2580 | "(vid/pid 0x%04X/0x%04X)", | 2730 | "(vid/pid 0x%04X/0x%04X)", id->idVendor, id->idProduct); |
2581 | sn9c102_id_table[i].idVendor,sn9c102_id_table[i].idProduct) | ||
2582 | err = -ENODEV; | 2731 | err = -ENODEV; |
2583 | goto fail; | 2732 | goto fail; |
2584 | } | 2733 | } |
2585 | 2734 | ||
2586 | cam->bridge = (sn9c102_id_table[i].idProduct & 0xffc0) == 0x6080 ? | 2735 | cam->bridge = (id->idProduct & 0xffc0) == 0x6080 ? |
2587 | BRIDGE_SN9C103 : BRIDGE_SN9C102; | 2736 | BRIDGE_SN9C103 : BRIDGE_SN9C102; |
2588 | switch (cam->bridge) { | 2737 | switch (cam->bridge) { |
2589 | case BRIDGE_SN9C101: | 2738 | case BRIDGE_SN9C101: |
2590 | case BRIDGE_SN9C102: | 2739 | case BRIDGE_SN9C102: |
2591 | DBG(2, "SN9C10[12] PC Camera Controller detected " | 2740 | DBG(2, "SN9C10[12] PC Camera Controller detected " |
2592 | "(vid/pid 0x%04X/0x%04X)", sn9c102_id_table[i].idVendor, | 2741 | "(vid/pid 0x%04X/0x%04X)", id->idVendor, id->idProduct); |
2593 | sn9c102_id_table[i].idProduct) | ||
2594 | break; | 2742 | break; |
2595 | case BRIDGE_SN9C103: | 2743 | case BRIDGE_SN9C103: |
2596 | DBG(2, "SN9C103 PC Camera Controller detected " | 2744 | DBG(2, "SN9C103 PC Camera Controller detected " |
2597 | "(vid/pid 0x%04X/0x%04X)", sn9c102_id_table[i].idVendor, | 2745 | "(vid/pid 0x%04X/0x%04X)", id->idVendor, id->idProduct); |
2598 | sn9c102_id_table[i].idProduct) | ||
2599 | break; | 2746 | break; |
2600 | } | 2747 | } |
2601 | 2748 | ||
@@ -2606,24 +2753,24 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2606 | } | 2753 | } |
2607 | 2754 | ||
2608 | if (!err && cam->sensor) { | 2755 | if (!err && cam->sensor) { |
2609 | DBG(2, "%s image sensor detected", cam->sensor->name) | 2756 | DBG(2, "%s image sensor detected", cam->sensor->name); |
2610 | DBG(3, "Support for %s maintained by %s", | 2757 | DBG(3, "Support for %s maintained by %s", |
2611 | cam->sensor->name, cam->sensor->maintainer) | 2758 | cam->sensor->name, cam->sensor->maintainer); |
2612 | } else { | 2759 | } else { |
2613 | DBG(1, "No supported image sensor detected") | 2760 | DBG(1, "No supported image sensor detected"); |
2614 | err = -ENODEV; | 2761 | err = -ENODEV; |
2615 | goto fail; | 2762 | goto fail; |
2616 | } | 2763 | } |
2617 | 2764 | ||
2618 | if (sn9c102_init(cam)) { | 2765 | if (sn9c102_init(cam)) { |
2619 | DBG(1, "Initialization failed. I will retry on open().") | 2766 | DBG(1, "Initialization failed. I will retry on open()."); |
2620 | cam->state |= DEV_MISCONFIGURED; | 2767 | cam->state |= DEV_MISCONFIGURED; |
2621 | } | 2768 | } |
2622 | 2769 | ||
2623 | strcpy(cam->v4ldev->name, "SN9C10x PC Camera"); | 2770 | strcpy(cam->v4ldev->name, "SN9C10x PC Camera"); |
2624 | cam->v4ldev->owner = THIS_MODULE; | 2771 | cam->v4ldev->owner = THIS_MODULE; |
2625 | cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; | 2772 | cam->v4ldev->type = VID_TYPE_CAPTURE | VID_TYPE_SCALES; |
2626 | cam->v4ldev->hardware = VID_HARDWARE_SN9C102; | 2773 | cam->v4ldev->hardware = 0; |
2627 | cam->v4ldev->fops = &sn9c102_fops; | 2774 | cam->v4ldev->fops = &sn9c102_fops; |
2628 | cam->v4ldev->minor = video_nr[dev_nr]; | 2775 | cam->v4ldev->minor = video_nr[dev_nr]; |
2629 | cam->v4ldev->release = video_device_release; | 2776 | cam->v4ldev->release = video_device_release; |
@@ -2634,23 +2781,25 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2634 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 2781 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
2635 | video_nr[dev_nr]); | 2782 | video_nr[dev_nr]); |
2636 | if (err) { | 2783 | if (err) { |
2637 | DBG(1, "V4L2 device registration failed") | 2784 | DBG(1, "V4L2 device registration failed"); |
2638 | if (err == -ENFILE && video_nr[dev_nr] == -1) | 2785 | if (err == -ENFILE && video_nr[dev_nr] == -1) |
2639 | DBG(1, "Free /dev/videoX node not found") | 2786 | DBG(1, "Free /dev/videoX node not found"); |
2640 | video_nr[dev_nr] = -1; | 2787 | video_nr[dev_nr] = -1; |
2641 | dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; | 2788 | dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; |
2642 | up(&cam->dev_sem); | 2789 | up(&cam->dev_sem); |
2643 | goto fail; | 2790 | goto fail; |
2644 | } | 2791 | } |
2645 | 2792 | ||
2646 | DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor) | 2793 | DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->minor); |
2647 | 2794 | ||
2648 | cam->module_param.force_munmap = force_munmap[dev_nr]; | 2795 | cam->module_param.force_munmap = force_munmap[dev_nr]; |
2649 | 2796 | ||
2650 | dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; | 2797 | dev_nr = (dev_nr < SN9C102_MAX_DEVICES-1) ? dev_nr+1 : 0; |
2651 | 2798 | ||
2799 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
2652 | sn9c102_create_sysfs(cam); | 2800 | sn9c102_create_sysfs(cam); |
2653 | DBG(2, "Optional device control through 'sysfs' interface ready") | 2801 | DBG(2, "Optional device control through 'sysfs' interface ready"); |
2802 | #endif | ||
2654 | 2803 | ||
2655 | usb_set_intfdata(intf, cam); | 2804 | usb_set_intfdata(intf, cam); |
2656 | 2805 | ||
@@ -2680,14 +2829,14 @@ static void sn9c102_usb_disconnect(struct usb_interface* intf) | |||
2680 | 2829 | ||
2681 | down(&cam->dev_sem); | 2830 | down(&cam->dev_sem); |
2682 | 2831 | ||
2683 | DBG(2, "Disconnecting %s...", cam->v4ldev->name) | 2832 | DBG(2, "Disconnecting %s...", cam->v4ldev->name); |
2684 | 2833 | ||
2685 | wake_up_interruptible_all(&cam->open); | 2834 | wake_up_interruptible_all(&cam->open); |
2686 | 2835 | ||
2687 | if (cam->users) { | 2836 | if (cam->users) { |
2688 | DBG(2, "Device /dev/video%d is open! Deregistration and " | 2837 | DBG(2, "Device /dev/video%d is open! Deregistration and " |
2689 | "memory deallocation are deferred on close.", | 2838 | "memory deallocation are deferred on close.", |
2690 | cam->v4ldev->minor) | 2839 | cam->v4ldev->minor); |
2691 | cam->state |= DEV_MISCONFIGURED; | 2840 | cam->state |= DEV_MISCONFIGURED; |
2692 | sn9c102_stop_transfer(cam); | 2841 | sn9c102_stop_transfer(cam); |
2693 | cam->state |= DEV_DISCONNECTED; | 2842 | cam->state |= DEV_DISCONNECTED; |
@@ -2720,11 +2869,11 @@ static int __init sn9c102_module_init(void) | |||
2720 | { | 2869 | { |
2721 | int err = 0; | 2870 | int err = 0; |
2722 | 2871 | ||
2723 | KDBG(2, SN9C102_MODULE_NAME " v" SN9C102_MODULE_VERSION) | 2872 | KDBG(2, SN9C102_MODULE_NAME " v" SN9C102_MODULE_VERSION); |
2724 | KDBG(3, SN9C102_MODULE_AUTHOR) | 2873 | KDBG(3, SN9C102_MODULE_AUTHOR); |
2725 | 2874 | ||
2726 | if ((err = usb_register(&sn9c102_usb_driver))) | 2875 | if ((err = usb_register(&sn9c102_usb_driver))) |
2727 | KDBG(1, "usb_register() failed") | 2876 | KDBG(1, "usb_register() failed"); |
2728 | 2877 | ||
2729 | return err; | 2878 | return err; |
2730 | } | 2879 | } |
diff --git a/drivers/usb/media/sn9c102_hv7131d.c b/drivers/usb/media/sn9c102_hv7131d.c index 18070d5333cf..46c12ec3ca62 100644 --- a/drivers/usb/media/sn9c102_hv7131d.c +++ b/drivers/usb/media/sn9c102_hv7131d.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Plug-in for HV7131D image sensor connected to the SN9C10x PC Camera * | 2 | * Plug-in for HV7131D image sensor connected to the SN9C10x PC Camera * |
3 | * Controllers * | 3 | * Controllers * |
4 | * * | 4 | * * |
5 | * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | 5 | * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * |
6 | * * | 6 | * * |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
diff --git a/drivers/usb/media/sn9c102_mi0343.c b/drivers/usb/media/sn9c102_mi0343.c index 86676abf3547..d9aa7a61095d 100644 --- a/drivers/usb/media/sn9c102_mi0343.c +++ b/drivers/usb/media/sn9c102_mi0343.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Plug-in for MI-0343 image sensor connected to the SN9C10x PC Camera * | 2 | * Plug-in for MI-0343 image sensor connected to the SN9C10x PC Camera * |
3 | * Controllers * | 3 | * Controllers * |
4 | * * | 4 | * * |
5 | * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | 5 | * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * |
6 | * * | 6 | * * |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
diff --git a/drivers/usb/media/sn9c102_ov7630.c b/drivers/usb/media/sn9c102_ov7630.c index d27c5aedeaf8..4a36519b5af4 100644 --- a/drivers/usb/media/sn9c102_ov7630.c +++ b/drivers/usb/media/sn9c102_ov7630.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Plug-in for OV7630 image sensor connected to the SN9C10x PC Camera * | 2 | * Plug-in for OV7630 image sensor connected to the SN9C10x PC Camera * |
3 | * Controllers * | 3 | * Controllers * |
4 | * * | 4 | * * |
5 | * Copyright (C) 2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | 5 | * Copyright (C) 2005-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * |
6 | * * | 6 | * * |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
@@ -375,8 +375,10 @@ int sn9c102_probe_ov7630(struct sn9c102_device* cam) | |||
375 | 375 | ||
376 | sn9c102_attach_sensor(cam, &ov7630); | 376 | sn9c102_attach_sensor(cam, &ov7630); |
377 | 377 | ||
378 | if (le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x608f && | 378 | if (le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x602c && |
379 | le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x602c) | 379 | le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x602d && |
380 | le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x608f && | ||
381 | le16_to_cpu(ov7630.usbdev->descriptor.idProduct) != 0x60b0) | ||
380 | return -ENODEV; | 382 | return -ENODEV; |
381 | 383 | ||
382 | err += sn9c102_write_reg(cam, 0x01, 0x01); | 384 | err += sn9c102_write_reg(cam, 0x01, 0x01); |
diff --git a/drivers/usb/media/sn9c102_pas106b.c b/drivers/usb/media/sn9c102_pas106b.c index 48e3ec39d4e2..b1dee78abe04 100644 --- a/drivers/usb/media/sn9c102_pas106b.c +++ b/drivers/usb/media/sn9c102_pas106b.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Plug-in for PAS106B image sensor connected to the SN9C10x PC Camera * | 2 | * Plug-in for PAS106B image sensor connected to the SN9C10x PC Camera * |
3 | * Controllers * | 3 | * Controllers * |
4 | * * | 4 | * * |
5 | * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | 5 | * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * |
6 | * * | 6 | * * |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
diff --git a/drivers/usb/media/sn9c102_sensor.h b/drivers/usb/media/sn9c102_sensor.h index a45166c3488c..7d953b24f2f2 100644 --- a/drivers/usb/media/sn9c102_sensor.h +++ b/drivers/usb/media/sn9c102_sensor.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * API for image sensors connected to the SN9C10x PC Camera Controllers * | 2 | * API for image sensors connected to the SN9C10x PC Camera Controllers * |
3 | * * | 3 | * * |
4 | * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | 4 | * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License as published by * | 7 | * it under the terms of the GNU General Public License as published by * |
@@ -92,7 +92,18 @@ extern void | |||
92 | sn9c102_attach_sensor(struct sn9c102_device* cam, | 92 | sn9c102_attach_sensor(struct sn9c102_device* cam, |
93 | struct sn9c102_sensor* sensor); | 93 | struct sn9c102_sensor* sensor); |
94 | 94 | ||
95 | /* Each SN9C10X camera has proper PID/VID identifiers. Add them here in case.*/ | 95 | /* |
96 | Each SN9C10x camera has proper PID/VID identifiers. | ||
97 | SN9C103 supports multiple interfaces, but we only handle the video class | ||
98 | interface. | ||
99 | */ | ||
100 | #define SN9C102_USB_DEVICE(vend, prod, intclass) \ | ||
101 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | ||
102 | USB_DEVICE_ID_MATCH_INT_CLASS, \ | ||
103 | .idVendor = (vend), \ | ||
104 | .idProduct = (prod), \ | ||
105 | .bInterfaceClass = (intclass) | ||
106 | |||
96 | #define SN9C102_ID_TABLE \ | 107 | #define SN9C102_ID_TABLE \ |
97 | static const struct usb_device_id sn9c102_id_table[] = { \ | 108 | static const struct usb_device_id sn9c102_id_table[] = { \ |
98 | { USB_DEVICE(0x0c45, 0x6001), }, /* TAS5110C1B */ \ | 109 | { USB_DEVICE(0x0c45, 0x6001), }, /* TAS5110C1B */ \ |
@@ -107,33 +118,34 @@ static const struct usb_device_id sn9c102_id_table[] = { \ | |||
107 | { USB_DEVICE(0x0c45, 0x602b), }, /* MI-0343 */ \ | 118 | { USB_DEVICE(0x0c45, 0x602b), }, /* MI-0343 */ \ |
108 | { USB_DEVICE(0x0c45, 0x602c), }, /* OV7630 */ \ | 119 | { USB_DEVICE(0x0c45, 0x602c), }, /* OV7630 */ \ |
109 | { USB_DEVICE(0x0c45, 0x602d), }, \ | 120 | { USB_DEVICE(0x0c45, 0x602d), }, \ |
121 | { USB_DEVICE(0x0c45, 0x602e), }, /* OV7630 */ \ | ||
110 | { USB_DEVICE(0x0c45, 0x6030), }, /* MI03x */ \ | 122 | { USB_DEVICE(0x0c45, 0x6030), }, /* MI03x */ \ |
111 | { USB_DEVICE(0x0c45, 0x6080), }, \ | 123 | { SN9C102_USB_DEVICE(0x0c45, 0x6080, 0xff), }, \ |
112 | { USB_DEVICE(0x0c45, 0x6082), }, /* MI0343 and MI0360 */ \ | 124 | { SN9C102_USB_DEVICE(0x0c45, 0x6082, 0xff), }, /* MI0343 & MI0360 */ \ |
113 | { USB_DEVICE(0x0c45, 0x6083), }, /* HV7131[D|E1] */ \ | 125 | { SN9C102_USB_DEVICE(0x0c45, 0x6083, 0xff), }, /* HV7131[D|E1] */ \ |
114 | { USB_DEVICE(0x0c45, 0x6088), }, \ | 126 | { SN9C102_USB_DEVICE(0x0c45, 0x6088, 0xff), }, \ |
115 | { USB_DEVICE(0x0c45, 0x608a), }, \ | 127 | { SN9C102_USB_DEVICE(0x0c45, 0x608a, 0xff), }, \ |
116 | { USB_DEVICE(0x0c45, 0x608b), }, \ | 128 | { SN9C102_USB_DEVICE(0x0c45, 0x608b, 0xff), }, \ |
117 | { USB_DEVICE(0x0c45, 0x608c), }, /* HV7131x */ \ | 129 | { SN9C102_USB_DEVICE(0x0c45, 0x608c, 0xff), }, /* HV7131x */ \ |
118 | { USB_DEVICE(0x0c45, 0x608e), }, /* CIS-VF10 */ \ | 130 | { SN9C102_USB_DEVICE(0x0c45, 0x608e, 0xff), }, /* CIS-VF10 */ \ |
119 | { USB_DEVICE(0x0c45, 0x608f), }, /* OV7630 */ \ | 131 | { SN9C102_USB_DEVICE(0x0c45, 0x608f, 0xff), }, /* OV7630 */ \ |
120 | { USB_DEVICE(0x0c45, 0x60a0), }, \ | 132 | { SN9C102_USB_DEVICE(0x0c45, 0x60a0, 0xff), }, \ |
121 | { USB_DEVICE(0x0c45, 0x60a2), }, \ | 133 | { SN9C102_USB_DEVICE(0x0c45, 0x60a2, 0xff), }, \ |
122 | { USB_DEVICE(0x0c45, 0x60a3), }, \ | 134 | { SN9C102_USB_DEVICE(0x0c45, 0x60a3, 0xff), }, \ |
123 | { USB_DEVICE(0x0c45, 0x60a8), }, /* PAS106B */ \ | 135 | { SN9C102_USB_DEVICE(0x0c45, 0x60a8, 0xff), }, /* PAS106B */ \ |
124 | { USB_DEVICE(0x0c45, 0x60aa), }, /* TAS5130D1B */ \ | 136 | { SN9C102_USB_DEVICE(0x0c45, 0x60aa, 0xff), }, /* TAS5130D1B */ \ |
125 | { USB_DEVICE(0x0c45, 0x60ab), }, /* TAS5110C1B */ \ | 137 | { SN9C102_USB_DEVICE(0x0c45, 0x60ab, 0xff), }, /* TAS5110C1B */ \ |
126 | { USB_DEVICE(0x0c45, 0x60ac), }, \ | 138 | { SN9C102_USB_DEVICE(0x0c45, 0x60ac, 0xff), }, \ |
127 | { USB_DEVICE(0x0c45, 0x60ae), }, \ | 139 | { SN9C102_USB_DEVICE(0x0c45, 0x60ae, 0xff), }, \ |
128 | { USB_DEVICE(0x0c45, 0x60af), }, /* PAS202BCB */ \ | 140 | { SN9C102_USB_DEVICE(0x0c45, 0x60af, 0xff), }, /* PAS202BCB */ \ |
129 | { USB_DEVICE(0x0c45, 0x60b0), }, \ | 141 | { SN9C102_USB_DEVICE(0x0c45, 0x60b0, 0xff), }, /* OV7630 (?) */ \ |
130 | { USB_DEVICE(0x0c45, 0x60b2), }, \ | 142 | { SN9C102_USB_DEVICE(0x0c45, 0x60b2, 0xff), }, \ |
131 | { USB_DEVICE(0x0c45, 0x60b3), }, \ | 143 | { SN9C102_USB_DEVICE(0x0c45, 0x60b3, 0xff), }, \ |
132 | { USB_DEVICE(0x0c45, 0x60b8), }, \ | 144 | { SN9C102_USB_DEVICE(0x0c45, 0x60b8, 0xff), }, \ |
133 | { USB_DEVICE(0x0c45, 0x60ba), }, \ | 145 | { SN9C102_USB_DEVICE(0x0c45, 0x60ba, 0xff), }, \ |
134 | { USB_DEVICE(0x0c45, 0x60bb), }, \ | 146 | { SN9C102_USB_DEVICE(0x0c45, 0x60bb, 0xff), }, \ |
135 | { USB_DEVICE(0x0c45, 0x60bc), }, \ | 147 | { SN9C102_USB_DEVICE(0x0c45, 0x60bc, 0xff), }, \ |
136 | { USB_DEVICE(0x0c45, 0x60be), }, \ | 148 | { SN9C102_USB_DEVICE(0x0c45, 0x60be, 0xff), }, \ |
137 | { } \ | 149 | { } \ |
138 | }; | 150 | }; |
139 | 151 | ||
@@ -177,16 +189,18 @@ extern int sn9c102_i2c_write(struct sn9c102_device*, u8 address, u8 value); | |||
177 | extern int sn9c102_i2c_read(struct sn9c102_device*, u8 address); | 189 | extern int sn9c102_i2c_read(struct sn9c102_device*, u8 address); |
178 | 190 | ||
179 | /* I/O on registers in the bridge. Could be used by the sensor methods too */ | 191 | /* I/O on registers in the bridge. Could be used by the sensor methods too */ |
192 | extern int sn9c102_write_regs(struct sn9c102_device*, u8* buff, u16 index); | ||
180 | extern int sn9c102_write_reg(struct sn9c102_device*, u8 value, u16 index); | 193 | extern int sn9c102_write_reg(struct sn9c102_device*, u8 value, u16 index); |
181 | extern int sn9c102_pread_reg(struct sn9c102_device*, u16 index); | 194 | extern int sn9c102_pread_reg(struct sn9c102_device*, u16 index); |
182 | 195 | ||
183 | /* | 196 | /* |
184 | NOTE: there are no exported debugging functions. To uniform the output you | 197 | NOTE: there are no exported debugging functions. To uniform the output you |
185 | must use the dev_info()/dev_warn()/dev_err() macros defined in device.h, | 198 | must use the dev_info()/dev_warn()/dev_err() macros defined in device.h, |
186 | already included here, the argument being the struct device 'dev' of the | 199 | already included here, the argument being the struct device '&usbdev->dev' |
187 | sensor structure. Do NOT use these macros before the sensor is attached or | 200 | of the sensor structure. Do NOT use these macros before the sensor is |
188 | the kernel will crash! However, you should not need to notify the user about | 201 | attached or the kernel will crash! However, you should not need to notify |
189 | common errors or other messages, since this is done by the master module. | 202 | the user about common errors or other messages, since this is done by the |
203 | master module. | ||
190 | */ | 204 | */ |
191 | 205 | ||
192 | /*****************************************************************************/ | 206 | /*****************************************************************************/ |
@@ -345,13 +359,6 @@ struct sn9c102_sensor { | |||
345 | error code without rolling back. | 359 | error code without rolling back. |
346 | */ | 360 | */ |
347 | 361 | ||
348 | const struct device* dev; | ||
349 | /* | ||
350 | This is the argument for dev_err(), dev_info() and dev_warn(). It | ||
351 | is used for debugging purposes. You must not access the struct | ||
352 | before the sensor is attached. | ||
353 | */ | ||
354 | |||
355 | const struct usb_device* usbdev; | 362 | const struct usb_device* usbdev; |
356 | /* | 363 | /* |
357 | Points to the usb_device struct after the sensor is attached. | 364 | Points to the usb_device struct after the sensor is attached. |
diff --git a/drivers/usb/media/sn9c102_tas5110c1b.c b/drivers/usb/media/sn9c102_tas5110c1b.c index 8775999b5aff..32ddf236cafe 100644 --- a/drivers/usb/media/sn9c102_tas5110c1b.c +++ b/drivers/usb/media/sn9c102_tas5110c1b.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Plug-in for TAS5110C1B image sensor connected to the SN9C10x PC Camera * | 2 | * Plug-in for TAS5110C1B image sensor connected to the SN9C10x PC Camera * |
3 | * Controllers * | 3 | * Controllers * |
4 | * * | 4 | * * |
5 | * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | 5 | * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * |
6 | * * | 6 | * * |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
diff --git a/drivers/usb/media/sn9c102_tas5130d1b.c b/drivers/usb/media/sn9c102_tas5130d1b.c index 927eafdd8c73..a0728f0ae00c 100644 --- a/drivers/usb/media/sn9c102_tas5130d1b.c +++ b/drivers/usb/media/sn9c102_tas5130d1b.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Plug-in for TAS5130D1B image sensor connected to the SN9C10x PC Camera * | 2 | * Plug-in for TAS5130D1B image sensor connected to the SN9C10x PC Camera * |
3 | * Controllers * | 3 | * Controllers * |
4 | * * | 4 | * * |
5 | * Copyright (C) 2004-2005 by Luca Risolia <luca.risolia@studio.unibo.it> * | 5 | * Copyright (C) 2004-2006 by Luca Risolia <luca.risolia@studio.unibo.it> * |
6 | * * | 6 | * * |
7 | * This program is free software; you can redistribute it and/or modify * | 7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * | 8 | * it under the terms of the GNU General Public License as published by * |
diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c index bff9434c8e55..9937fc64c8bf 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/usb/media/w9968cf.c | |||
@@ -62,7 +62,6 @@ MODULE_LICENSE(W9968CF_MODULE_LICENSE); | |||
62 | MODULE_SUPPORTED_DEVICE("Video"); | 62 | MODULE_SUPPORTED_DEVICE("Video"); |
63 | 63 | ||
64 | static int ovmod_load = W9968CF_OVMOD_LOAD; | 64 | static int ovmod_load = W9968CF_OVMOD_LOAD; |
65 | static int vppmod_load = W9968CF_VPPMOD_LOAD; | ||
66 | static unsigned short simcams = W9968CF_SIMCAMS; | 65 | static unsigned short simcams = W9968CF_SIMCAMS; |
67 | static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ | 66 | static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ |
68 | static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 67 | static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
@@ -107,7 +106,6 @@ static unsigned int param_nv[24]; /* number of values per parameter */ | |||
107 | 106 | ||
108 | #ifdef CONFIG_KMOD | 107 | #ifdef CONFIG_KMOD |
109 | module_param(ovmod_load, bool, 0644); | 108 | module_param(ovmod_load, bool, 0644); |
110 | module_param(vppmod_load, bool, 0444); | ||
111 | #endif | 109 | #endif |
112 | module_param(simcams, ushort, 0644); | 110 | module_param(simcams, ushort, 0644); |
113 | module_param_array(video_nr, short, ¶m_nv[0], 0444); | 111 | module_param_array(video_nr, short, ¶m_nv[0], 0444); |
@@ -150,18 +148,6 @@ MODULE_PARM_DESC(ovmod_load, | |||
150 | "\ninto memory." | 148 | "\ninto memory." |
151 | "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." | 149 | "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." |
152 | "\n"); | 150 | "\n"); |
153 | MODULE_PARM_DESC(vppmod_load, | ||
154 | "\n<0|1> Automatic 'w9968cf-vpp' module loading." | ||
155 | "\n0 disabled, 1 enabled." | ||
156 | "\nIf enabled, every time an application attempts to open a" | ||
157 | "\ncamera, 'insmod' searches for the video post-processing" | ||
158 | "\nmodule in the system and loads it automatically (if" | ||
159 | "\npresent). The optional 'w9968cf-vpp' module adds extra" | ||
160 | "\n image manipulation functions to the 'w9968cf' module,like" | ||
161 | "\nsoftware up-scaling,colour conversions and video decoding" | ||
162 | "\nfor very high frame rates." | ||
163 | "\nDefault value is "__MODULE_STRING(W9968CF_VPPMOD_LOAD)"." | ||
164 | "\n"); | ||
165 | #endif | 151 | #endif |
166 | MODULE_PARM_DESC(simcams, | 152 | MODULE_PARM_DESC(simcams, |
167 | "\n<n> Number of cameras allowed to stream simultaneously." | 153 | "\n<n> Number of cameras allowed to stream simultaneously." |
@@ -492,10 +478,6 @@ static void w9968cf_push_frame(struct w9968cf_device*, u8 f_num); | |||
492 | static void w9968cf_pop_frame(struct w9968cf_device*,struct w9968cf_frame_t**); | 478 | static void w9968cf_pop_frame(struct w9968cf_device*,struct w9968cf_frame_t**); |
493 | static void w9968cf_release_resources(struct w9968cf_device*); | 479 | static void w9968cf_release_resources(struct w9968cf_device*); |
494 | 480 | ||
495 | /* Intermodule communication */ | ||
496 | static int w9968cf_vppmod_detect(struct w9968cf_device*); | ||
497 | static void w9968cf_vppmod_release(struct w9968cf_device*); | ||
498 | |||
499 | 481 | ||
500 | 482 | ||
501 | /**************************************************************************** | 483 | /**************************************************************************** |
@@ -2737,9 +2719,7 @@ static int w9968cf_open(struct inode* inode, struct file* filp) | |||
2737 | cam->streaming = 0; | 2719 | cam->streaming = 0; |
2738 | cam->misconfigured = 0; | 2720 | cam->misconfigured = 0; |
2739 | 2721 | ||
2740 | if (!w9968cf_vpp) | 2722 | w9968cf_adjust_configuration(cam); |
2741 | if ((err = w9968cf_vppmod_detect(cam))) | ||
2742 | goto out; | ||
2743 | 2723 | ||
2744 | if ((err = w9968cf_allocate_memory(cam))) | 2724 | if ((err = w9968cf_allocate_memory(cam))) |
2745 | goto deallocate_memory; | 2725 | goto deallocate_memory; |
@@ -2766,7 +2746,6 @@ static int w9968cf_open(struct inode* inode, struct file* filp) | |||
2766 | 2746 | ||
2767 | deallocate_memory: | 2747 | deallocate_memory: |
2768 | w9968cf_deallocate_memory(cam); | 2748 | w9968cf_deallocate_memory(cam); |
2769 | out: | ||
2770 | DBG(2, "Failed to open the video device") | 2749 | DBG(2, "Failed to open the video device") |
2771 | up(&cam->dev_sem); | 2750 | up(&cam->dev_sem); |
2772 | up_read(&w9968cf_disconnect); | 2751 | up_read(&w9968cf_disconnect); |
@@ -2784,8 +2763,6 @@ static int w9968cf_release(struct inode* inode, struct file* filp) | |||
2784 | 2763 | ||
2785 | w9968cf_stop_transfer(cam); | 2764 | w9968cf_stop_transfer(cam); |
2786 | 2765 | ||
2787 | w9968cf_vppmod_release(cam); | ||
2788 | |||
2789 | if (cam->disconnected) { | 2766 | if (cam->disconnected) { |
2790 | w9968cf_release_resources(cam); | 2767 | w9968cf_release_resources(cam); |
2791 | up(&cam->dev_sem); | 2768 | up(&cam->dev_sem); |
@@ -3681,106 +3658,6 @@ static struct usb_driver w9968cf_usb_driver = { | |||
3681 | * Module init, exit and intermodule communication * | 3658 | * Module init, exit and intermodule communication * |
3682 | ****************************************************************************/ | 3659 | ****************************************************************************/ |
3683 | 3660 | ||
3684 | static int w9968cf_vppmod_detect(struct w9968cf_device* cam) | ||
3685 | { | ||
3686 | if (!w9968cf_vpp) | ||
3687 | if (vppmod_load) | ||
3688 | request_module("w9968cf-vpp"); | ||
3689 | |||
3690 | down(&w9968cf_vppmod_lock); | ||
3691 | |||
3692 | if (!w9968cf_vpp) { | ||
3693 | DBG(4, "Video post-processing module not detected") | ||
3694 | w9968cf_adjust_configuration(cam); | ||
3695 | goto out; | ||
3696 | } | ||
3697 | |||
3698 | if (!try_module_get(w9968cf_vpp->owner)) { | ||
3699 | DBG(1, "Couldn't increment the reference count of " | ||
3700 | "the video post-processing module") | ||
3701 | up(&w9968cf_vppmod_lock); | ||
3702 | return -ENOSYS; | ||
3703 | } | ||
3704 | |||
3705 | w9968cf_vpp->busy++; | ||
3706 | |||
3707 | DBG(5, "Video post-processing module detected") | ||
3708 | |||
3709 | out: | ||
3710 | up(&w9968cf_vppmod_lock); | ||
3711 | return 0; | ||
3712 | } | ||
3713 | |||
3714 | |||
3715 | static void w9968cf_vppmod_release(struct w9968cf_device* cam) | ||
3716 | { | ||
3717 | down(&w9968cf_vppmod_lock); | ||
3718 | |||
3719 | if (w9968cf_vpp && w9968cf_vpp->busy) { | ||
3720 | module_put(w9968cf_vpp->owner); | ||
3721 | w9968cf_vpp->busy--; | ||
3722 | wake_up(&w9968cf_vppmod_wait); | ||
3723 | DBG(5, "Video post-processing module released") | ||
3724 | } | ||
3725 | |||
3726 | up(&w9968cf_vppmod_lock); | ||
3727 | } | ||
3728 | |||
3729 | |||
3730 | int w9968cf_vppmod_register(struct w9968cf_vpp_t* vpp) | ||
3731 | { | ||
3732 | down(&w9968cf_vppmod_lock); | ||
3733 | |||
3734 | if (w9968cf_vpp) { | ||
3735 | KDBG(1, "Video post-processing module already registered") | ||
3736 | up(&w9968cf_vppmod_lock); | ||
3737 | return -EINVAL; | ||
3738 | } | ||
3739 | |||
3740 | w9968cf_vpp = vpp; | ||
3741 | w9968cf_vpp->busy = 0; | ||
3742 | |||
3743 | KDBG(2, "Video post-processing module registered") | ||
3744 | up(&w9968cf_vppmod_lock); | ||
3745 | return 0; | ||
3746 | } | ||
3747 | |||
3748 | |||
3749 | int w9968cf_vppmod_deregister(struct w9968cf_vpp_t* vpp) | ||
3750 | { | ||
3751 | down(&w9968cf_vppmod_lock); | ||
3752 | |||
3753 | if (!w9968cf_vpp) { | ||
3754 | up(&w9968cf_vppmod_lock); | ||
3755 | return -EINVAL; | ||
3756 | } | ||
3757 | |||
3758 | if (w9968cf_vpp != vpp) { | ||
3759 | KDBG(1, "Only the owner can unregister the video " | ||
3760 | "post-processing module") | ||
3761 | up(&w9968cf_vppmod_lock); | ||
3762 | return -EINVAL; | ||
3763 | } | ||
3764 | |||
3765 | if (w9968cf_vpp->busy) { | ||
3766 | KDBG(2, "Video post-processing module busy. Wait for it to be " | ||
3767 | "released...") | ||
3768 | up(&w9968cf_vppmod_lock); | ||
3769 | wait_event(w9968cf_vppmod_wait, !w9968cf_vpp->busy); | ||
3770 | w9968cf_vpp = NULL; | ||
3771 | goto out; | ||
3772 | } | ||
3773 | |||
3774 | w9968cf_vpp = NULL; | ||
3775 | |||
3776 | up(&w9968cf_vppmod_lock); | ||
3777 | |||
3778 | out: | ||
3779 | KDBG(2, "Video post-processing module unregistered") | ||
3780 | return 0; | ||
3781 | } | ||
3782 | |||
3783 | |||
3784 | static int __init w9968cf_module_init(void) | 3661 | static int __init w9968cf_module_init(void) |
3785 | { | 3662 | { |
3786 | int err; | 3663 | int err; |
@@ -3810,6 +3687,3 @@ static void __exit w9968cf_module_exit(void) | |||
3810 | module_init(w9968cf_module_init); | 3687 | module_init(w9968cf_module_init); |
3811 | module_exit(w9968cf_module_exit); | 3688 | module_exit(w9968cf_module_exit); |
3812 | 3689 | ||
3813 | |||
3814 | EXPORT_SYMBOL(w9968cf_vppmod_register); | ||
3815 | EXPORT_SYMBOL(w9968cf_vppmod_deregister); | ||
diff --git a/drivers/usb/media/w9968cf.h b/drivers/usb/media/w9968cf.h index 8acbfe205bc7..47a6ff794171 100644 --- a/drivers/usb/media/w9968cf.h +++ b/drivers/usb/media/w9968cf.h | |||
@@ -195,7 +195,6 @@ enum w9968cf_vpp_flag { | |||
195 | }; | 195 | }; |
196 | 196 | ||
197 | static struct w9968cf_vpp_t* w9968cf_vpp; | 197 | static struct w9968cf_vpp_t* w9968cf_vpp; |
198 | static DECLARE_MUTEX(w9968cf_vppmod_lock); | ||
199 | static DECLARE_WAIT_QUEUE_HEAD(w9968cf_vppmod_wait); | 198 | static DECLARE_WAIT_QUEUE_HEAD(w9968cf_vppmod_wait); |
200 | 199 | ||
201 | static LIST_HEAD(w9968cf_dev_list); /* head of V4L registered cameras list */ | 200 | static LIST_HEAD(w9968cf_dev_list); /* head of V4L registered cameras list */ |
diff --git a/drivers/usb/media/w9968cf_vpp.h b/drivers/usb/media/w9968cf_vpp.h index 3f5317dc4c29..f3b91b782671 100644 --- a/drivers/usb/media/w9968cf_vpp.h +++ b/drivers/usb/media/w9968cf_vpp.h | |||
@@ -37,7 +37,4 @@ struct w9968cf_vpp_t { | |||
37 | u8 busy; /* read-only flag: module is/is not in use */ | 37 | u8 busy; /* read-only flag: module is/is not in use */ |
38 | }; | 38 | }; |
39 | 39 | ||
40 | extern int w9968cf_vppmod_register(struct w9968cf_vpp_t*); | ||
41 | extern int w9968cf_vppmod_deregister(struct w9968cf_vpp_t*); | ||
42 | |||
43 | #endif /* _W9968CF_VPP_H_ */ | 40 | #endif /* _W9968CF_VPP_H_ */ |
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 449b2501acf3..ad2f4cccd388 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c | |||
@@ -2093,6 +2093,8 @@ static void auerswald_disconnect (struct usb_interface *intf) | |||
2093 | static struct usb_device_id auerswald_ids [] = { | 2093 | static struct usb_device_id auerswald_ids [] = { |
2094 | { USB_DEVICE (ID_AUERSWALD, 0x00C0) }, /* COMpact 2104 USB */ | 2094 | { USB_DEVICE (ID_AUERSWALD, 0x00C0) }, /* COMpact 2104 USB */ |
2095 | { USB_DEVICE (ID_AUERSWALD, 0x00DB) }, /* COMpact 4410/2206 USB */ | 2095 | { USB_DEVICE (ID_AUERSWALD, 0x00DB) }, /* COMpact 4410/2206 USB */ |
2096 | { USB_DEVICE (ID_AUERSWALD, 0x00DC) }, /* COMpact 4406 DSL */ | ||
2097 | { USB_DEVICE (ID_AUERSWALD, 0x00DD) }, /* COMpact 2204 USB */ | ||
2096 | { USB_DEVICE (ID_AUERSWALD, 0x00F1) }, /* Comfort 2000 System Telephone */ | 2098 | { USB_DEVICE (ID_AUERSWALD, 0x00F1) }, /* Comfort 2000 System Telephone */ |
2097 | { USB_DEVICE (ID_AUERSWALD, 0x00F2) }, /* Comfort 1200 System Telephone */ | 2099 | { USB_DEVICE (ID_AUERSWALD, 0x00F2) }, /* Comfort 1200 System Telephone */ |
2098 | { } /* Terminating entry */ | 2100 | { } /* Terminating entry */ |
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 981d8a5fbfd9..331d4ae949ed 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c | |||
@@ -593,7 +593,7 @@ static struct file_operations ld_usb_fops = { | |||
593 | 593 | ||
594 | /* | 594 | /* |
595 | * usb class driver info in order to get a minor number from the usb core, | 595 | * usb class driver info in order to get a minor number from the usb core, |
596 | * and to have the device registered with devfs and the driver core | 596 | * and to have the device registered with the driver core |
597 | */ | 597 | */ |
598 | static struct usb_class_driver ld_usb_class = { | 598 | static struct usb_class_driver ld_usb_class = { |
599 | .name = "ldusb%d", | 599 | .name = "ldusb%d", |
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index 541181695040..3094970615cb 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c | |||
@@ -916,6 +916,10 @@ static const struct usb_device_id products [] = { | |||
916 | // Linksys USB200M Rev 2 | 916 | // Linksys USB200M Rev 2 |
917 | USB_DEVICE (0x13b1, 0x0018), | 917 | USB_DEVICE (0x13b1, 0x0018), |
918 | .driver_info = (unsigned long) &ax88772_info, | 918 | .driver_info = (unsigned long) &ax88772_info, |
919 | }, { | ||
920 | // 0Q0 cable ethernet | ||
921 | USB_DEVICE (0x1557, 0x7720), | ||
922 | .driver_info = (unsigned long) &ax88772_info, | ||
919 | }, | 923 | }, |
920 | { }, // END | 924 | { }, // END |
921 | }; | 925 | }; |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index da46b351e188..dc7a069503e0 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -32,7 +32,7 @@ | |||
32 | /* | 32 | /* |
33 | * Version Information | 33 | * Version Information |
34 | */ | 34 | */ |
35 | #define DRIVER_VERSION "v0.05" | 35 | #define DRIVER_VERSION "v0.06" |
36 | #define DRIVER_DESC "Silicon Labs CP2101/CP2102 RS232 serial adaptor driver" | 36 | #define DRIVER_DESC "Silicon Labs CP2101/CP2102 RS232 serial adaptor driver" |
37 | 37 | ||
38 | /* | 38 | /* |
@@ -55,11 +55,15 @@ static int debug; | |||
55 | 55 | ||
56 | static struct usb_device_id id_table [] = { | 56 | static struct usb_device_id id_table [] = { |
57 | { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ | 57 | { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ |
58 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | ||
59 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ | ||
60 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ | ||
61 | { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ | 58 | { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ |
62 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ | 59 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ |
60 | { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ | ||
61 | { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */ | ||
62 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ | ||
63 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ | ||
64 | { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ | ||
65 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ | ||
66 | { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ | ||
63 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ | 67 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ |
64 | { } /* Terminating Entry */ | 68 | { } /* Terminating Entry */ |
65 | }; | 69 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 10bc1bf23b35..f2b4ca8692d8 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -476,10 +476,16 @@ static struct usb_device_id id_table_combined [] = { | |||
476 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, | 476 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, |
477 | { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, | 477 | { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, |
478 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, | 478 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, |
479 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16C_PID) }, | ||
479 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, | 480 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, |
481 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HRC_PID) }, | ||
480 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) }, | 482 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) }, |
481 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, | 483 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, |
482 | { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, | 484 | { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, |
485 | { USB_DEVICE(FTDI_VID, FTDI_TTUSB_PID) }, | ||
486 | { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_777_PID) }, | ||
487 | { USB_DEVICE(FTDI_VID, FTDI_WESTREX_MODEL_8900F_PID) }, | ||
488 | { USB_DEVICE(FTDI_VID, FTDI_PCDJ_DAC2_PID) }, | ||
483 | { }, /* Optional parameter entry */ | 489 | { }, /* Optional parameter entry */ |
484 | { } /* Terminating entry */ | 490 | { } /* Terminating entry */ |
485 | }; | 491 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 00d45f8600de..ca40f16370f1 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -31,9 +31,14 @@ | |||
31 | #define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */ | 31 | #define FTDI_NF_RIC_VID 0x0DCD /* Vendor Id */ |
32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ | 32 | #define FTDI_NF_RIC_PID 0x0001 /* Product Id */ |
33 | 33 | ||
34 | |||
34 | /* www.irtrans.de device */ | 35 | /* www.irtrans.de device */ |
35 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ | 36 | #define FTDI_IRTRANS_PID 0xFC60 /* Product Id */ |
36 | 37 | ||
38 | |||
39 | /* www.thoughttechnology.com/ TT-USB provide with procomp use ftdi_sio */ | ||
40 | #define FTDI_TTUSB_PID 0xFF20 /* Product Id */ | ||
41 | |||
37 | /* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */ | 42 | /* www.crystalfontz.com devices - thanx for providing free devices for evaluation ! */ |
38 | /* they use the ftdi chipset for the USB interface and the vendor id is the same */ | 43 | /* they use the ftdi chipset for the USB interface and the vendor id is the same */ |
39 | #define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */ | 44 | #define FTDI_XF_632_PID 0xFC08 /* 632: 16x2 Character Display */ |
@@ -51,6 +56,12 @@ | |||
51 | #define FTDI_VNHCPCUSB_D_PID 0xfe38 /* Product Id */ | 56 | #define FTDI_VNHCPCUSB_D_PID 0xfe38 /* Product Id */ |
52 | 57 | ||
53 | /* | 58 | /* |
59 | * PCDJ use ftdi based dj-controllers. The following PID is for their DAC-2 device | ||
60 | * http://www.pcdjhardware.com/DAC2.asp (PID sent by Wouter Paesen) | ||
61 | * (the VID is the standard ftdi vid (FTDI_VID) */ | ||
62 | #define FTDI_PCDJ_DAC2_PID 0xFA88 | ||
63 | |||
64 | /* | ||
54 | * The following are the values for the Matrix Orbital LCD displays, | 65 | * The following are the values for the Matrix Orbital LCD displays, |
55 | * which are the FT232BM ( similar to the 8U232AM ) | 66 | * which are the FT232BM ( similar to the 8U232AM ) |
56 | */ | 67 | */ |
@@ -215,8 +226,10 @@ | |||
215 | * Definitions for ATIK Instruments astronomical USB based cameras | 226 | * Definitions for ATIK Instruments astronomical USB based cameras |
216 | * Check it at http://www.atik-instruments.com/ | 227 | * Check it at http://www.atik-instruments.com/ |
217 | */ | 228 | */ |
218 | #define FTDI_ATIK_ATK16_PID 0xDF30 /* ATIK ATK-16 Camera */ | 229 | #define FTDI_ATIK_ATK16_PID 0xDF30 /* ATIK ATK-16 Grayscale Camera */ |
219 | #define FTDI_ATIK_ATK16HR_PID 0xDF31 /* ATIK ATK-16HR Camera */ | 230 | #define FTDI_ATIK_ATK16C_PID 0xDF32 /* ATIK ATK-16C Colour Camera */ |
231 | #define FTDI_ATIK_ATK16HR_PID 0xDF31 /* ATIK ATK-16HR Grayscale Camera */ | ||
232 | #define FTDI_ATIK_ATK16HRC_PID 0xDF33 /* ATIK ATK-16HRC Colour Camera */ | ||
220 | 233 | ||
221 | /* | 234 | /* |
222 | * Protego product ids | 235 | * Protego product ids |
@@ -365,6 +378,12 @@ | |||
365 | #define POSIFLEX_VID 0x0d3a /* Vendor ID */ | 378 | #define POSIFLEX_VID 0x0d3a /* Vendor ID */ |
366 | #define POSIFLEX_PP7000_PID 0x0300 /* PP-7000II thermal printer */ | 379 | #define POSIFLEX_PP7000_PID 0x0300 /* PP-7000II thermal printer */ |
367 | 380 | ||
381 | /* | ||
382 | * Westrex International devices submitted by Cory Lee | ||
383 | */ | ||
384 | #define FTDI_WESTREX_MODEL_777_PID 0xDC00 /* Model 777 */ | ||
385 | #define FTDI_WESTREX_MODEL_8900F_PID 0xDC01 /* Model 8900F */ | ||
386 | |||
368 | /* Commands */ | 387 | /* Commands */ |
369 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 388 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
370 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 389 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 0eb883f44ada..e8e575e037c1 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -73,7 +73,9 @@ static struct usb_device_id id_table [] = { | |||
73 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, | 73 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, |
74 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) }, | 74 | { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) }, |
75 | { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, | 75 | { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, |
76 | { USB_DEVICE( NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID ) }, | 76 | { USB_DEVICE(NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID ) }, |
77 | { USB_DEVICE(CA_42_CA42_VENDOR_ID, CA_42_CA42_PRODUCT_ID ) }, | ||
78 | { USB_DEVICE(SAGEM_VENDOR_ID, SAGEM_PRODUCT_ID) }, | ||
77 | { } /* Terminating entry */ | 79 | { } /* Terminating entry */ |
78 | }; | 80 | }; |
79 | 81 | ||
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 21d434d81813..1807087a76e3 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -64,3 +64,10 @@ | |||
64 | /* Nokia CA-42 Cable */ | 64 | /* Nokia CA-42 Cable */ |
65 | #define NOKIA_CA42_VENDOR_ID 0x078b | 65 | #define NOKIA_CA42_VENDOR_ID 0x078b |
66 | #define NOKIA_CA42_PRODUCT_ID 0x1234 | 66 | #define NOKIA_CA42_PRODUCT_ID 0x1234 |
67 | |||
68 | /* CA-42 CLONE Cable www.ca-42.com chipset: Prolific Technology Inc */ | ||
69 | #define CA_42_CA42_VENDOR_ID 0x10b5 | ||
70 | #define CA_42_CA42_PRODUCT_ID 0xac70 | ||
71 | |||
72 | #define SAGEM_VENDOR_ID 0x079b | ||
73 | #define SAGEM_PRODUCT_ID 0x0027 | ||
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c index 5b06f9240d05..ab173b30076e 100644 --- a/drivers/usb/storage/initializers.c +++ b/drivers/usb/storage/initializers.c | |||
@@ -45,6 +45,12 @@ | |||
45 | #include "debug.h" | 45 | #include "debug.h" |
46 | #include "transport.h" | 46 | #include "transport.h" |
47 | 47 | ||
48 | #define RIO_MSC 0x08 | ||
49 | #define RIOP_INIT "RIOP\x00\x01\x08" | ||
50 | #define RIOP_INIT_LEN 7 | ||
51 | #define RIO_SEND_LEN 40 | ||
52 | #define RIO_RECV_LEN 0x200 | ||
53 | |||
48 | /* This places the Shuttle/SCM USB<->SCSI bridge devices in multi-target | 54 | /* This places the Shuttle/SCM USB<->SCSI bridge devices in multi-target |
49 | * mode */ | 55 | * mode */ |
50 | int usb_stor_euscsi_init(struct us_data *us) | 56 | int usb_stor_euscsi_init(struct us_data *us) |
@@ -91,3 +97,70 @@ int usb_stor_ucr61s2b_init(struct us_data *us) | |||
91 | 97 | ||
92 | return (res ? -1 : 0); | 98 | return (res ? -1 : 0); |
93 | } | 99 | } |
100 | |||
101 | /* Place the Rio Karma into mass storage mode. | ||
102 | * | ||
103 | * The initialization begins by sending 40 bytes starting | ||
104 | * RIOP\x00\x01\x08\x00, which the device will ack with a 512-byte | ||
105 | * packet with the high four bits set and everything else null. | ||
106 | * | ||
107 | * Next, we send RIOP\x80\x00\x08\x00. Each time, a 512 byte response | ||
108 | * must be read, but we must loop until byte 5 in the response is 0x08, | ||
109 | * indicating success. */ | ||
110 | int rio_karma_init(struct us_data *us) | ||
111 | { | ||
112 | int result, partial; | ||
113 | char *recv; | ||
114 | unsigned long timeout; | ||
115 | |||
116 | // us->iobuf is big enough to hold cmd but not receive | ||
117 | if (!(recv = kmalloc(RIO_RECV_LEN, GFP_KERNEL))) | ||
118 | goto die_nomem; | ||
119 | |||
120 | US_DEBUGP("Initializing Karma...\n"); | ||
121 | |||
122 | memset(us->iobuf, 0, RIO_SEND_LEN); | ||
123 | memcpy(us->iobuf, RIOP_INIT, RIOP_INIT_LEN); | ||
124 | |||
125 | result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, | ||
126 | us->iobuf, RIO_SEND_LEN, &partial); | ||
127 | if (result != USB_STOR_XFER_GOOD) | ||
128 | goto die; | ||
129 | |||
130 | result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, | ||
131 | recv, RIO_RECV_LEN, &partial); | ||
132 | if (result != USB_STOR_XFER_GOOD) | ||
133 | goto die; | ||
134 | |||
135 | us->iobuf[4] = 0x80; | ||
136 | us->iobuf[5] = 0; | ||
137 | timeout = jiffies + msecs_to_jiffies(3000); | ||
138 | for (;;) { | ||
139 | US_DEBUGP("Sending init command\n"); | ||
140 | result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, | ||
141 | us->iobuf, RIO_SEND_LEN, &partial); | ||
142 | if (result != USB_STOR_XFER_GOOD) | ||
143 | goto die; | ||
144 | |||
145 | result = usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, | ||
146 | recv, RIO_RECV_LEN, &partial); | ||
147 | if (result != USB_STOR_XFER_GOOD) | ||
148 | goto die; | ||
149 | |||
150 | if (recv[5] == RIO_MSC) | ||
151 | break; | ||
152 | if (time_after(jiffies, timeout)) | ||
153 | goto die; | ||
154 | msleep(10); | ||
155 | } | ||
156 | US_DEBUGP("Karma initialized.\n"); | ||
157 | kfree(recv); | ||
158 | return 0; | ||
159 | |||
160 | die: | ||
161 | kfree(recv); | ||
162 | die_nomem: | ||
163 | US_DEBUGP("Could not initialize karma.\n"); | ||
164 | return USB_STOR_TRANSPORT_FAILED; | ||
165 | } | ||
166 | |||
diff --git a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h index 4c1b2bd2e2e4..f9907a5cf129 100644 --- a/drivers/usb/storage/initializers.h +++ b/drivers/usb/storage/initializers.h | |||
@@ -48,3 +48,4 @@ int usb_stor_euscsi_init(struct us_data *us); | |||
48 | /* This function is required to activate all four slots on the UCR-61S2B | 48 | /* This function is required to activate all four slots on the UCR-61S2B |
49 | * flash reader */ | 49 | * flash reader */ |
50 | int usb_stor_ucr61s2b_init(struct us_data *us); | 50 | int usb_stor_ucr61s2b_init(struct us_data *us); |
51 | int rio_karma_init(struct us_data *us); | ||
diff --git a/drivers/usb/storage/libusual.c b/drivers/usb/storage/libusual.c index b28151d1b609..b1ec4a718547 100644 --- a/drivers/usb/storage/libusual.c +++ b/drivers/usb/storage/libusual.c | |||
@@ -116,7 +116,7 @@ EXPORT_SYMBOL_GPL(usb_usual_check_type); | |||
116 | static int usu_probe(struct usb_interface *intf, | 116 | static int usu_probe(struct usb_interface *intf, |
117 | const struct usb_device_id *id) | 117 | const struct usb_device_id *id) |
118 | { | 118 | { |
119 | int type; | 119 | unsigned long type; |
120 | int rc; | 120 | int rc; |
121 | unsigned long flags; | 121 | unsigned long flags; |
122 | 122 | ||
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index dc301e567cfc..ee958f986eb8 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -145,6 +145,11 @@ UNUSUAL_DEV( 0x0451, 0x5416, 0x0100, 0x0100, | |||
145 | US_SC_DEVICE, US_PR_BULK, NULL, | 145 | US_SC_DEVICE, US_PR_BULK, NULL, |
146 | US_FL_NEED_OVERRIDE ), | 146 | US_FL_NEED_OVERRIDE ), |
147 | 147 | ||
148 | UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101, | ||
149 | "Rio", | ||
150 | "Rio Karma", | ||
151 | US_SC_SCSI, US_PR_BULK, rio_karma_init, 0), | ||
152 | |||
148 | /* Patch submitted by Philipp Friedrich <philipp@void.at> */ | 153 | /* Patch submitted by Philipp Friedrich <philipp@void.at> */ |
149 | UNUSUAL_DEV( 0x0482, 0x0100, 0x0100, 0x0100, | 154 | UNUSUAL_DEV( 0x0482, 0x0100, 0x0100, 0x0100, |
150 | "Kyocera", | 155 | "Kyocera", |
@@ -424,11 +429,11 @@ UNUSUAL_DEV( 0x054c, 0x0010, 0x0106, 0x0450, | |||
424 | US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ), | 429 | US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ), |
425 | 430 | ||
426 | /* This entry is needed because the device reports Sub=ff */ | 431 | /* This entry is needed because the device reports Sub=ff */ |
427 | UNUSUAL_DEV( 0x054c, 0x0010, 0x0500, 0x0500, | 432 | UNUSUAL_DEV( 0x054c, 0x0010, 0x0500, 0x0600, |
428 | "Sony", | 433 | "Sony", |
429 | "DSC-T1", | 434 | "DSC-T1/T5", |
430 | US_SC_8070, US_PR_DEVICE, NULL, | 435 | US_SC_8070, US_PR_DEVICE, NULL, |
431 | US_FL_SINGLE_LUN ), | 436 | US_FL_SINGLE_LUN ), |
432 | 437 | ||
433 | 438 | ||
434 | /* Reported by wim@geeks.nl */ | 439 | /* Reported by wim@geeks.nl */ |
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index 5d02f16b7d0e..4de9fb56ebfc 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c | |||
@@ -234,7 +234,7 @@ static struct file_operations skel_fops = { | |||
234 | 234 | ||
235 | /* | 235 | /* |
236 | * usb class driver info in order to get a minor number from the usb core, | 236 | * usb class driver info in order to get a minor number from the usb core, |
237 | * and to have the device registered with devfs and the driver core | 237 | * and to have the device registered with the driver core |
238 | */ | 238 | */ |
239 | static struct usb_class_driver skel_class = { | 239 | static struct usb_class_driver skel_class = { |
240 | .name = "skel%d", | 240 | .name = "skel%d", |
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index b2187175d03f..6761b68c35e9 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c | |||
@@ -116,9 +116,10 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var) | |||
116 | int ret = 0; | 116 | int ret = 0; |
117 | 117 | ||
118 | memset(&var->transp, 0, sizeof(var->transp)); | 118 | memset(&var->transp, 0, sizeof(var->transp)); |
119 | memset(&var->red, 0, sizeof(var->red)); | 119 | |
120 | memset(&var->green, 0, sizeof(var->green)); | 120 | var->red.msb_right = 0; |
121 | memset(&var->blue, 0, sizeof(var->blue)); | 121 | var->green.msb_right = 0; |
122 | var->blue.msb_right = 0; | ||
122 | 123 | ||
123 | switch (var->bits_per_pixel) { | 124 | switch (var->bits_per_pixel) { |
124 | case 1: | 125 | case 1: |
@@ -133,34 +134,20 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var) | |||
133 | var->blue.offset = 0; | 134 | var->blue.offset = 0; |
134 | break; | 135 | break; |
135 | case 16: | 136 | case 16: |
136 | var->red.length = 5; | 137 | var->red.length = 5; |
137 | var->green.length = 6; | 138 | var->blue.length = 5; |
138 | var->blue.length = 5; | 139 | /* |
139 | if (fb->panel->cntl & CNTL_BGR) { | 140 | * Green length can be 5 or 6 depending whether |
140 | var->red.offset = 11; | 141 | * we're operating in RGB555 or RGB565 mode. |
141 | var->green.offset = 5; | 142 | */ |
142 | var->blue.offset = 0; | 143 | if (var->green.length != 5 && var->green.length != 6) |
143 | } else { | 144 | var->green.length = 6; |
144 | var->red.offset = 0; | ||
145 | var->green.offset = 5; | ||
146 | var->blue.offset = 11; | ||
147 | } | ||
148 | break; | 145 | break; |
149 | case 32: | 146 | case 32: |
150 | if (fb->panel->cntl & CNTL_LCDTFT) { | 147 | if (fb->panel->cntl & CNTL_LCDTFT) { |
151 | var->red.length = 8; | 148 | var->red.length = 8; |
152 | var->green.length = 8; | 149 | var->green.length = 8; |
153 | var->blue.length = 8; | 150 | var->blue.length = 8; |
154 | |||
155 | if (fb->panel->cntl & CNTL_BGR) { | ||
156 | var->red.offset = 16; | ||
157 | var->green.offset = 8; | ||
158 | var->blue.offset = 0; | ||
159 | } else { | ||
160 | var->red.offset = 0; | ||
161 | var->green.offset = 8; | ||
162 | var->blue.offset = 16; | ||
163 | } | ||
164 | break; | 151 | break; |
165 | } | 152 | } |
166 | default: | 153 | default: |
@@ -168,6 +155,23 @@ clcdfb_set_bitfields(struct clcd_fb *fb, struct fb_var_screeninfo *var) | |||
168 | break; | 155 | break; |
169 | } | 156 | } |
170 | 157 | ||
158 | /* | ||
159 | * >= 16bpp displays have separate colour component bitfields | ||
160 | * encoded in the pixel data. Calculate their position from | ||
161 | * the bitfield length defined above. | ||
162 | */ | ||
163 | if (ret == 0 && var->bits_per_pixel >= 16) { | ||
164 | if (fb->panel->cntl & CNTL_BGR) { | ||
165 | var->blue.offset = 0; | ||
166 | var->green.offset = var->blue.offset + var->blue.length; | ||
167 | var->red.offset = var->green.offset + var->green.length; | ||
168 | } else { | ||
169 | var->red.offset = 0; | ||
170 | var->green.offset = var->red.offset + var->red.length; | ||
171 | var->blue.offset = var->green.offset + var->green.length; | ||
172 | } | ||
173 | } | ||
174 | |||
171 | return ret; | 175 | return ret; |
172 | } | 176 | } |
173 | 177 | ||
diff --git a/drivers/video/cyblafb.c b/drivers/video/cyblafb.c index 2b972461a030..0ae0a97b0fed 100644 --- a/drivers/video/cyblafb.c +++ b/drivers/video/cyblafb.c | |||
@@ -1665,7 +1665,6 @@ static int __devinit cyblafb_init(void) | |||
1665 | } | 1665 | } |
1666 | #endif | 1666 | #endif |
1667 | output("CyblaFB version %s initializing\n", VERSION); | 1667 | output("CyblaFB version %s initializing\n", VERSION); |
1668 | return pci_module_init(&cyblafb_pci_driver); | ||
1669 | return pci_register_driver(&cyblafb_pci_driver); | 1668 | return pci_register_driver(&cyblafb_pci_driver); |
1670 | } | 1669 | } |
1671 | 1670 | ||